Skip to content

Commit 5db1716

Browse files
authored
Merge branch 'main' into users/lexitaylor/fix-stricttype
2 parents b36cdbf + 47373eb commit 5db1716

89 files changed

Lines changed: 1688 additions & 4617 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
121121
- `@msinternal/botframework-webchat-react-hooks` for helpers for React hooks
122122
- Added link sanitization and ESLint rules, in PR [#5564](https://github.com/microsoft/BotFramework-WebChat/pull/5564), by [@compulim](https://github.com/compulim)
123123
- Added blob URL sanitization and ESLint rules, in PR [#5568](https://github.com/microsoft/BotFramework-WebChat/pull/5568), by [@compulim](https://github.com/compulim)
124-
- Added visual message grouping following the `isPartOf` property of the `Message` entity, in PR [#5553](https://github.com/microsoft/BotFramework-WebChat/pull/5553), by [@OEvgeny](https://github.com/OEvgeny)
124+
- Added visual message grouping following the `isPartOf` property of the `Message` entity, in PR [#5553](https://github.com/microsoft/BotFramework-WebChat/pull/5553), in PR [#5585](https://github.com/microsoft/BotFramework-WebChat/pull/5585), by [@OEvgeny](https://github.com/OEvgeny)
125125
- The mode is suitable for providing chain-of-thought reasoning
126126
- Added visual indication of `creativeWorkStatus` property in `Message` entity:
127127
- `undefined` - no indicator is shown
@@ -131,6 +131,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
131131
- The `position` property takes precedence over existing sequence ID
132132
- Unified build info and injection of `<meta>` tag, in PR [#5571](https://github.com/microsoft/BotFramework-WebChat/pull/5571), by [@compulim](https://github.com/compulim)
133133
- Added documentation for `isPartOf` property, in PR [#5573](https://github.com/microsoft/BotFramework-WebChat/pull/5573), by [@compulim](https://github.com/compulim)
134+
- `fluent-theme`: Changed dependencies to import solely from the "bundle" package, in PR [#5584](https://github.com/microsoft/BotFramework-WebChat/pull/5584), by [@compulim](https://github.com/compulim)
134135

135136
### Changed
136137

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
4+
<head>
5+
<title>Avatar layout: grouped</title>
6+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
7+
<script type="importmap">
8+
{
9+
"imports": {
10+
"react": "https://esm.sh/react@18.3.1",
11+
"react-dom": "https://esm.sh/react-dom@18.3.1",
12+
"react-dom/": "https://esm.sh/react-dom@18.3.1/",
13+
"@testduet/wait-for": "https://unpkg.com/@testduet/wait-for@main/dist/wait-for.mjs"
14+
}
15+
}
16+
</script>
17+
<script crossorigin="anonymous" src="/test-harness.js"></script>
18+
<script crossorigin="anonymous" src="/test-page-object.js"></script>
19+
<script type="module">
20+
import React from 'react';
21+
window.React = React;
22+
</script>
23+
<script defer crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
24+
</head>
25+
26+
<body>
27+
<main id="webchat"></main>
28+
<script type="module">
29+
import React from 'react';
30+
import { createRoot } from 'react-dom/client';
31+
32+
run(async function () {
33+
const {
34+
WebChat: { ReactWebChat }
35+
} = window;
36+
37+
const { directLine, store } = testHelpers.createDirectLineEmulator();
38+
39+
const root = createRoot(document.getElementById('webchat'));
40+
let webChatProps = { directLine, store };
41+
42+
const render = () => {
43+
root.render(React.createElement(ReactWebChat, webChatProps));
44+
};
45+
46+
const aiMessageEntity = {
47+
'@context': 'https://schema.org',
48+
'@id': '',
49+
'@type': 'Message',
50+
type: 'https://schema.org/Message',
51+
author: {
52+
'@context': 'https://schema.org',
53+
'@type': 'Person',
54+
name: 'Research',
55+
}
56+
};
57+
58+
render();
59+
60+
await pageConditions.uiConnected();
61+
62+
const botGroup1 = { isPartOf: { '@id': '_:bot-group-1', '@type': 'HowTo' } };
63+
const botGroup2 = { isPartOf: { '@id': '_:bot-group-2', '@type': 'HowTo' } };
64+
65+
const botIcon = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="20" fill="%235563B1"/></svg>';
66+
67+
// Test Case 1: No bot avatar for grouped messages
68+
directLine.emulateIncomingActivity({ from: { role: 'bot' }, text: 'Message 1.1', entities: [{ ...aiMessageEntity, ...botGroup1 }] });
69+
directLine.emulateIncomingActivity({ from: { role: 'bot' }, text: 'Message 1.2', entities: [{ ...aiMessageEntity, ...botGroup1 }] });
70+
directLine.emulateIncomingActivity({ from: { role: 'bot' }, text: 'Message 2.1', entities: [{ ...aiMessageEntity, ...botGroup2 }] });
71+
directLine.emulateIncomingActivity({ from: { role: 'bot' }, text: 'Message 2.2', entities: [{ ...aiMessageEntity, ...botGroup2 }] });
72+
directLine.emulateIncomingActivity({ from: { role: 'bot' }, text: 'Out of group' });
73+
await pageConditions.numActivitiesShown(5);
74+
await host.snapshot('local');
75+
76+
// Test Case 2: Bot avatar with initials
77+
webChatProps = { ...webChatProps, styleOptions: { botAvatarInitials: 'B' } };
78+
render();
79+
await pageConditions.numActivitiesShown(5);
80+
await host.snapshot('local');
81+
82+
// Test Case 3: Bot avatar with custom image
83+
webChatProps = { ...webChatProps, styleOptions: { botAvatarImage: botIcon, botAvatarInitials: 'B' } };
84+
render();
85+
await pageConditions.numActivitiesShown(5);
86+
await host.snapshot('local');
87+
88+
// Test Case 4: No user avatar
89+
directLine.emulateIncomingActivity({ from: { role: 'user' }, text: 'User message 1.1' });
90+
await pageConditions.numActivitiesShown(6);
91+
await host.snapshot('local');
92+
93+
// Test Case 5: User avatar with initials
94+
webChatProps = { ...webChatProps, styleOptions: { ...webChatProps.styleOptions, userAvatarInitials: 'U' } };
95+
render();
96+
await pageConditions.numActivitiesShown(6);
97+
await host.snapshot('local');
98+
});
99+
</script>
100+
</body>
101+
102+
</html>
20 KB
Loading
21.2 KB
Loading
20.9 KB
Loading
23.9 KB
Loading
24.8 KB
Loading

0 commit comments

Comments
 (0)