Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses claimInterpreter #4910

Merged
merged 55 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
2ce9ecb
Update schema
compulim Oct 11, 2023
2e60eb9
Move to claimInterpreter
compulim Oct 18, 2023
775a5e1
Move to claimInterpreter
compulim Oct 18, 2023
4fa3e94
Fix test
compulim Oct 18, 2023
0a2bda0
Add entry
compulim Oct 18, 2023
55d5497
Add replyAction as deprecated
compulim Feb 26, 2024
ee558dd
Add deprecation notes
compulim Feb 26, 2024
8d1caad
Remove unnecessary code
compulim Feb 26, 2024
67c74c5
Add new Schema.org things
compulim Feb 26, 2024
8ec582a
Add sensitivity label
compulim Feb 27, 2024
9aa81af
Fix text ellipsis and add tests
compulim Feb 28, 2024
7f4c71f
Remove Schema.org types (moved to core)
compulim Feb 28, 2024
fdb461f
Add valibot for Schema.org
compulim Mar 6, 2024
4763c4d
Componentize LinkDefinitions
compulim Mar 6, 2024
f742bd3
Rename props
compulim Mar 6, 2024
a7777ee
Cache const
compulim Mar 6, 2024
6efddbf
Ellipsis on overflow
compulim Mar 6, 2024
396b4fd
Chevron should not shrink
compulim Mar 6, 2024
8598d73
Read message sensitivity label from entities
compulim Mar 6, 2024
f794743
Add event
compulim Mar 6, 2024
c24c947
Turn plural into singular
compulim Mar 6, 2024
b577a71
Add getOrgSchemaMessage
compulim Mar 6, 2024
f107d24
Deprecate older Schema.org types
compulim Mar 7, 2024
abf6ab4
Remove deprecated Schema.org types
compulim Mar 7, 2024
5356bd6
Allow no accessory
compulim Mar 7, 2024
a97431d
Clean up
compulim Mar 7, 2024
79d4536
Should render link definitions without claims
compulim Mar 7, 2024
8a8b19d
Add test for message sensitivity label
compulim Mar 7, 2024
51e83da
Test accordion text
compulim Mar 7, 2024
1d0440d
Better tooltip
compulim Mar 7, 2024
2c5c84b
Rename props
compulim Mar 7, 2024
c7224f5
Update snapshot
compulim Mar 7, 2024
5f2e5b5
Fix backward compatibility
compulim Mar 7, 2024
869c0cb
Support non-numeric identifier
compulim Mar 8, 2024
c28cfda
Turn unknown scheme into button
compulim Mar 9, 2024
151c0e8
Update snapshots
compulim Mar 9, 2024
ca780dc
Add tests
compulim Mar 9, 2024
8aece33
No wrap on identifier
compulim Mar 9, 2024
a34c94a
Wrap pure identifier with zero-width space
compulim Mar 9, 2024
3daab0a
Update screenshot for word wrap
compulim Mar 9, 2024
d0b2443
Fix legacy VoteAction
compulim Mar 9, 2024
e244d7d
Fix timestamp
compulim Mar 9, 2024
e258c3c
Fix test
compulim Mar 9, 2024
31d3054
Show citation only when its thing is in the graph
compulim Mar 9, 2024
e2ca95c
Revert
compulim Mar 9, 2024
bb19e29
Dereference unconnected blank nodes
compulim Mar 18, 2024
a71eedf
Rename files
compulim Mar 18, 2024
2f00322
Add isEncrypted
compulim Mar 19, 2024
0a22c36
Add reference sample
compulim Mar 19, 2024
aca0ab1
Update schema
compulim Mar 21, 2024
d4dee70
Add zero-width space
compulim Apr 5, 2024
098b7e7
Fix test
compulim Apr 5, 2024
83fe74a
Fix test
compulim Apr 5, 2024
e2b9aa9
Fix ESLint
compulim Apr 5, 2024
f253259
Merge branch 'main' into feat-claim-interpreter
compulim Apr 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixes [#4866](https://github.com/microsoft/BotFramework-WebChat/issues/4866). Citation modal show fill screen width on mobile device and various fit-and-finish, by [@compulim](https://github.com/compulim), in PR [#4867](https://github.com/microsoft/BotFramework-WebChat/pull/4867)
- Fixes [#4878](https://github.com/microsoft/BotFramework-WebChat/issues/4878). `createStore` should return type of `Redux.Store`, by [@compulim](https://github.com/compulim), in PR [#4877](https://github.com/microsoft/BotFramework-WebChat/pull/4877)
- Fixes [#4957](https://github.com/microsoft/BotFramework-WebChat/issues/4957). Native chevron of the accordion in citation should be hidden, by [@compulim](https://github.com/compulim), in PR [#4958](https://github.com/microsoft/BotFramework-WebChat/pull/4958)
- Fixes [#4870](https://github.com/microsoft/BotFramework-WebChat/issues/4870). Originator should use `claimInterpreter` instead of `ReplyAction/provider`, by [@compulim](https://github.com/compulim), in PR [#4910](https://github.com/microsoft/BotFramework-WebChat/pull/4910)

### Added

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions __tests__/hooks/useRenderMarkdownAsHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test('renderMarkdown should add accessibility text for external links', async ()
await expect(
pageObjects.runHook('useRenderMarkdownAsHTML', [], fn => fn('Click [here](https://aka.ms/) to find out more.'))
).resolves.toMatchInlineSnapshot(`
"<p>Click <a href=\\"https://aka.ms/\\" aria-label=\\"here Opens in a new window; external.\\" rel=\\"noopener noreferrer\\" target=\\"_blank\\">here<img src=\\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\\" alt class=\\"webchat__render-markdown__external-link-icon\\" title=\\"Opens in a new window; external.\\" /></a> to find out more.</p>
"<p>Click \u200B<a href=\\"https://aka.ms/\\" aria-label=\\"here Opens in a new window; external.\\" rel=\\"noopener noreferrer\\" target=\\"_blank\\">here<img src=\\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\\" alt class=\\"webchat__render-markdown__external-link-icon\\" title=\\"Opens in a new window; external.\\" /></a>\u200B to find out more.</p>
"
`);
});
Expand All @@ -52,7 +52,7 @@ test('renderMarkdown should add accessibility text for external links with yue',
await expect(
pageObjects.runHook('useRenderMarkdownAsHTML', [], fn => fn('Click [here](https://aka.ms/) to find out more.'))
).resolves.toMatchInlineSnapshot(`
"<p>Click <a href=\\"https://aka.ms/\\" aria-label=\\"here 喺新嘅視窗開啟外部連結。\\" rel=\\"noopener noreferrer\\" target=\\"_blank\\">here<img src=\\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\\" alt class=\\"webchat__render-markdown__external-link-icon\\" title=\\"喺新嘅視窗開啟外部連結。\\" /></a> to find out more.</p>
"<p>Click \u200B<a href=\\"https://aka.ms/\\" aria-label=\\"here 喺新嘅視窗開啟外部連結。\\" rel=\\"noopener noreferrer\\" target=\\"_blank\\">here<img src=\\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\\" alt class=\\"webchat__render-markdown__external-link-icon\\" title=\\"喺新嘅視窗開啟外部連結。\\" /></a>\u200B to find out more.</p>
"
`);
});
2 changes: 1 addition & 1 deletion __tests__/html/accessibility.heroCard.heading.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

expect(document.querySelector('.ac-textBlock[role="heading"]')).toHaveProperty(
'innerText',
'Details about image 1'
'\u200BDetails about image 1\u200B'
);
});
</script>
Expand Down
148 changes: 148 additions & 0 deletions __tests__/html/linkDefinition/badge.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<!doctype html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
<script crossorigin="anonymous" src="/test-harness.js"></script>
<script crossorigin="anonymous" src="/test-page-object.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<main id="webchat"></main>
<script>
run(async function () {
const { directLine, store } = testHelpers.createDirectLineEmulator();

WebChat.renderWebChat(
{
directLine,
store
},
document.getElementById('webchat')
);

await pageConditions.uiConnected();

await directLine.emulateIncomingActivity({
entities: [
{
'@context': 'https://schema.org',
'@id': '',
'@type': 'Message',
citation: [
{
'@type': 'Claim',
appearance: {
'@type': 'DigitalDocument',
url: 'https://example.com/1/',
usageInfo: {
'@id': '_:1',
'@type': 'CreativeWork',
description:
'Nisi quis ut sint elit est nulla enim eiusmod. Deserunt commodo pariatur nostrud culpa aliquip esse pariatur exercitation nulla do proident. Est qui eiusmod aliquip deserunt labore consequat fugiat. Ullamco reprehenderit nostrud eiusmod nisi nulla esse id. Reprehenderit aliqua quis consectetur sit cupidatat fugiat Lorem ex labore. Eiusmod velit laborum quis tempor incididunt excepteur culpa esse nulla.',
keywords: ['encrypted-content'],
name: 'Sit veniam do irure velit est et quis ut Lorem reprehenderit commodo cillum occaecat',
pattern: {
'@type': 'DefinedTerm',
inDefinedTermSet: 'https://www.w3.org/TR/css-color-4/',
name: 'color',
termCode: 'orange'
}
}
},
position: 1
},
{
'@type': 'Claim',
appearance: {
'@type': 'DigitalDocument',
text: 'Incididunt amet dolore anim commodo fugiat occaecat elit nulla do consequat. Quis incididunt occaecat labore adipisicing. Cillum sunt velit consequat irure ipsum ullamco sint ea aute. Sunt et eu ut enim aliqua cupidatat non adipisicing dolore commodo dolor magna enim. Commodo reprehenderit excepteur ad nostrud ex id aliquip deserunt eiusmod. Esse non labore nulla voluptate.',
usageInfo: {
'@type': 'CreativeWork',
name: 'Velit exercitation',
pattern: {
'@type': 'DefinedTerm',
inDefinedTermSet: 'https://www.w3.org/TR/css-color-4/',
name: 'color',
termCode: 'Yellow'
}
}
},
position: 3
},
{
'@type': 'Claim',
appearance: {
'@type': 'DigitalDocument',
text: 'Ea nisi nostrud duis dolore aliqua sit reprehenderit minim est nisi id est sit. Amet mollit ex fugiat sint aliquip Lorem eiusmod incididunt nulla laboris labore nulla. In id exercitation ut non non Lorem consequat cupidatat deserunt do aliqua exercitation. Minim commodo aliquip dolore exercitation officia commodo sint aute aute. Fugiat laborum proident cupidatat quis eiusmod excepteur voluptate commodo. Ullamco minim duis id deserunt laboris ullamco cupidatat dolor est sint ut. Anim pariatur non ea do occaecat dolor sint ad.'
},
position: 4
}
],
type: 'https://schema.org/Message',
usageInfo: { '@id': '_:1' }
}
],
text: 'Ipsum[1] dolore[2] cupidatat[3] magna[4] consectetur[5] do tempor est excepteur.\n\n[1]: https://example.com/1/ "Sint amet id officia dolor ex eiusmod ipsum ipsum magna fugiat"\n[2]: https://example.com/2/ "Laboris cupidatat voluptate"\n[3]: _:3 "Velit nulla culpa eu ea consectetur consectetur dolore velit"\n[4]: _:4 "Adipisicing enim nulla"\n[5]: https://example.com/5',
type: 'message'
});

await host.snapshot();

const [firstActivityElement] = pageElements.activities();

const linkDefinitions = firstActivityElement.querySelectorAll('.webchat__link-definitions__list-item');

expect(linkDefinitions).toHaveProperty('length', 5);

expect(linkDefinitions[0].querySelector('.webchat__link-definitions__list-item-box').tagName).toBe('A');
expect(
linkDefinitions[0].querySelector('.webchat__link-definitions__list-item-text').getAttribute('title')
).toBe('Sint amet id officia dolor ex eiusmod ipsum ipsum magna fugiat');
expect(
linkDefinitions[0].querySelector('.webchat__link-definitions__list-item-badge').getAttribute('title')
).toBe(
'Sit veniam do irure velit est et quis ut Lorem reprehenderit commodo cillum occaecat\n\nNisi quis ut sint elit est nulla enim eiusmod. Deserunt commodo pariatur nostrud culpa aliquip esse pariatur exercitation nulla do proident. Est qui eiusmod aliquip deserunt labore consequat fugiat. Ullamco reprehenderit nostrud eiusmod nisi nulla esse id. Reprehenderit aliqua quis consectetur sit cupidatat fugiat Lorem ex labore. Eiusmod velit laborum quis tempor incididunt excepteur culpa esse nulla.'
);

expect(linkDefinitions[1].querySelector('.webchat__link-definitions__list-item-box').tagName).toBe('A');
expect(
linkDefinitions[1].querySelector('.webchat__link-definitions__list-item-text').getAttribute('title')
).toBe('Laboris cupidatat voluptate');
expect(linkDefinitions[1].querySelector('.webchat__link-definitions__list-item-badge')).toBeNull();

expect(linkDefinitions[2].querySelector('.webchat__link-definitions__list-item-box').tagName).toBe('BUTTON');
expect(
linkDefinitions[2].querySelector('.webchat__link-definitions__list-item-text').getAttribute('title')
).toBe('Velit nulla culpa eu ea consectetur consectetur dolore velit');
expect(
linkDefinitions[2].querySelector('.webchat__link-definitions__list-item-badge').getAttribute('title')
).toBe('Velit exercitation');

expect(linkDefinitions[3].querySelector('.webchat__link-definitions__list-item-box').tagName).toBe('BUTTON');
expect(
linkDefinitions[3].querySelector('.webchat__link-definitions__list-item-text').getAttribute('title')
).toBe('Adipisicing enim nulla');
expect(linkDefinitions[3].querySelector('.webchat__link-definitions__list-item-badge')).toBeNull();

expect(document.querySelector('.webchat__link-definitions__header-text')).toHaveProperty(
'textContent',
'5 references'
);

expect(document.querySelector('.webchat__link-definitions__message-sensitivity-label-text')).toHaveProperty(
'textContent',
'Sit veniam do irure velit est et quis ut Lorem reprehenderit commodo cillum occaecat'
);

expect(document.querySelector('.webchat__link-definitions__message-sensitivity-label')).toHaveProperty(
'title',
'Sit veniam do irure velit est et quis ut Lorem reprehenderit commodo cillum occaecat\n\nNisi quis ut sint elit est nulla enim eiusmod. Deserunt commodo pariatur nostrud culpa aliquip esse pariatur exercitation nulla do proident. Est qui eiusmod aliquip deserunt labore consequat fugiat. Ullamco reprehenderit nostrud eiusmod nisi nulla esse id. Reprehenderit aliqua quis consectetur sit cupidatat fugiat Lorem ex labore. Eiusmod velit laborum quis tempor incididunt excepteur culpa esse nulla.'
);

expect(
document.querySelector('.webchat__link-definitions__message-sensitivity-label--is-encrypted')
).toBeTruthy();
});
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions __tests__/html/linkDefinition/badge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */

describe('link definition', () => {
test('should display text ellipsis', () => runHTML('linkDefinition/badge.html'));
});
63 changes: 63 additions & 0 deletions __tests__/html/linkDefinition/identifierAsString.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!doctype html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
<script crossorigin="anonymous" src="/test-harness.js"></script>
<script crossorigin="anonymous" src="/test-page-object.js"></script>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<main id="webchat"></main>
<script>
run(async function () {
const { directLine, store } = testHelpers.createDirectLineEmulator();

WebChat.renderWebChat(
{
directLine,
store
},
document.getElementById('webchat')
);

await pageConditions.uiConnected();

await directLine.emulateIncomingActivity({
text: 'Ipsum[Abc] dolore[DEF] cupidatat[xyz] magna consectetur do tempor est excepteur.\n\n[Abc]: https://example.com/1/ "Sint amet id officia dolor ex eiusmod ipsum ipsum magna fugiat"\n[DEF]: https://example.com/2/ "Laboris cupidatat voluptate"\n[xyz]: https://example.com/3/ "Velit nulla culpa eu ea consectetur consectetur dolore velit"',
type: 'message'
});

await host.snapshot();

const [firstActivityElement] = pageElements.activities();

const linkDefinitions = firstActivityElement.querySelectorAll('.webchat__link-definitions__list-item');

expect(linkDefinitions).toHaveProperty('length', 3);

expect(linkDefinitions[0].querySelector('.webchat__link-definitions__list-item-box').tagName).toBe('A');
expect(
linkDefinitions[0].querySelector('.webchat__link-definitions__list-item-text').getAttribute('title')
).toBe('Sint amet id officia dolor ex eiusmod ipsum ipsum magna fugiat');

expect(linkDefinitions[1].querySelector('.webchat__link-definitions__list-item-box').tagName).toBe('A');
expect(
linkDefinitions[1].querySelector('.webchat__link-definitions__list-item-text').getAttribute('title')
).toBe('Laboris cupidatat voluptate');
expect(linkDefinitions[1].querySelector('.webchat__link-definitions__list-item-badge')).toBeNull();

expect(linkDefinitions[2].querySelector('.webchat__link-definitions__list-item-box').tagName).toBe('A');
expect(
linkDefinitions[2].querySelector('.webchat__link-definitions__list-item-text').getAttribute('title')
).toBe('Velit nulla culpa eu ea consectetur consectetur dolore velit');

expect(
[].map.call(
firstActivityElement.querySelectorAll('.webchat__link-definitions__badge'),
({ textContent }) => textContent
)
).toEqual(['Abc', 'DEF', 'xyz']);
});
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions __tests__/html/linkDefinition/identifierAsString.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */

describe('link definition', () => {
test('should display identifier of type string', () => runHTML('linkDefinition/identifierAsString.html'));
});
Loading
Loading