Skip to content

Commit ec5a00f

Browse files
authored
Fix minimal bundled build (#5519)
* Fix minimal build break * Add entry
1 parent cf546fb commit ec5a00f

File tree

8 files changed

+161
-1
lines changed

8 files changed

+161
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
239239
- Migrated to radio button for like/dislike where form submission is required
240240
- Fixed long citation identifiers break activity layout, in PR [#5507](https://github.com/microsoft/BotFramework-WebChat/pull/5507), by [@OEvgeny](https://github.com/OEvgeny)
241241
- Updated file-based import with `.js` extension and removed the file extension from build config, by [@compulim](https://github.com/compulim), in PR [#5516](https://github.com/microsoft/BotFramework-WebChat/pull/5516)
242+
- Fixed [#5518](https://github.com/microsoft/BotFramework-WebChat/issues/5518). Minimal bundled build should work properly, in PR [#5507](https://github.com/microsoft/BotFramework-WebChat/pull/5507), by [@compulim](https://github.com/compulim)
242243

243244
# Removed
244245

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
<script crossorigin="anonymous" src="/test-harness.js"></script>
6+
<script crossorigin="anonymous" src="/test-page-object.js"></script>
7+
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
8+
</head>
9+
<body>
10+
<main id="webchat"></main>
11+
<script>
12+
run(async function () {
13+
const {
14+
testHelpers: { createDirectLineEmulator }
15+
} = window;
16+
17+
const { directLine, store } = createDirectLineEmulator();
18+
19+
WebChat.renderWebChat({ directLine, store }, document.getElementById('webchat'));
20+
21+
await pageConditions.uiConnected();
22+
23+
await directLine.emulateIncomingActivity({
24+
from: {
25+
id: 'bot',
26+
role: 'bot'
27+
},
28+
text: 'Hello, World!',
29+
type: 'message'
30+
});
31+
32+
await pageConditions.numActivitiesShown(1);
33+
34+
await host.snapshot('local');
35+
36+
const metaMap = new Map(
37+
Array.from(document.querySelectorAll('meta'))
38+
.filter(element => element.name.startsWith('botframework-webchat'))
39+
.map(element => [element.name, element.getAttribute('content')])
40+
);
41+
42+
expect(metaMap.has('botframework-webchat:api')).toBe(true);
43+
expect(metaMap.get('botframework-webchat:bundle:variant')).toBe('full-es5');
44+
expect(metaMap.has('botframework-webchat:bundle:version')).toBe(true);
45+
expect(metaMap.has('botframework-webchat:bundle')).toBe(true);
46+
expect(metaMap.has('botframework-webchat:component')).toBe(true);
47+
expect(metaMap.has('botframework-webchat:core:version')).toBe(true);
48+
expect(metaMap.has('botframework-webchat:core')).toBe(true);
49+
expect(metaMap.has('botframework-webchat:ui:version')).toBe(true);
50+
});
51+
</script>
52+
</body>
53+
</html>
8.67 KB
Loading
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
<script crossorigin="anonymous" src="/test-harness.js"></script>
6+
<script crossorigin="anonymous" src="/test-page-object.js"></script>
7+
<script crossorigin="anonymous" src="/__dist__/webchat.js"></script>
8+
</head>
9+
<body>
10+
<main id="webchat"></main>
11+
<script>
12+
run(async function () {
13+
const {
14+
testHelpers: { createDirectLineEmulator }
15+
} = window;
16+
17+
const { directLine, store } = createDirectLineEmulator();
18+
19+
WebChat.renderWebChat({ directLine, store }, document.getElementById('webchat'));
20+
21+
await pageConditions.uiConnected();
22+
23+
await directLine.emulateIncomingActivity({
24+
from: {
25+
id: 'bot',
26+
role: 'bot'
27+
},
28+
text: 'Hello, World!',
29+
type: 'message'
30+
});
31+
32+
await pageConditions.numActivitiesShown(1);
33+
34+
await host.snapshot('local');
35+
36+
const metaMap = new Map(
37+
Array.from(document.querySelectorAll('meta'))
38+
.filter(element => element.name.startsWith('botframework-webchat'))
39+
.map(element => [element.name, element.getAttribute('content')])
40+
);
41+
42+
expect(metaMap.has('botframework-webchat:api')).toBe(true);
43+
expect(metaMap.get('botframework-webchat:bundle:variant')).toBe('full');
44+
expect(metaMap.has('botframework-webchat:bundle:version')).toBe(true);
45+
expect(metaMap.has('botframework-webchat:bundle')).toBe(true);
46+
expect(metaMap.has('botframework-webchat:component')).toBe(true);
47+
expect(metaMap.has('botframework-webchat:core:version')).toBe(true);
48+
expect(metaMap.has('botframework-webchat:core')).toBe(true);
49+
expect(metaMap.has('botframework-webchat:ui:version')).toBe(true);
50+
});
51+
</script>
52+
</body>
53+
</html>
8.67 KB
Loading
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
<script crossorigin="anonymous" src="/test-harness.js"></script>
6+
<script crossorigin="anonymous" src="/test-page-object.js"></script>
7+
<script crossorigin="anonymous" src="/__dist__/webchat-minimal.js"></script>
8+
</head>
9+
<body>
10+
<main id="webchat"></main>
11+
<script>
12+
run(async function () {
13+
const {
14+
testHelpers: { createDirectLineEmulator }
15+
} = window;
16+
17+
const { directLine, store } = createDirectLineEmulator();
18+
19+
WebChat.renderWebChat({ directLine, store }, document.getElementById('webchat'));
20+
21+
await pageConditions.uiConnected();
22+
23+
await directLine.emulateIncomingActivity({
24+
from: {
25+
id: 'bot',
26+
role: 'bot'
27+
},
28+
text: 'Hello, World!',
29+
type: 'message'
30+
});
31+
32+
await pageConditions.numActivitiesShown(1);
33+
34+
await host.snapshot('local');
35+
36+
const metaMap = new Map(
37+
Array.from(document.querySelectorAll('meta'))
38+
.filter(element => element.name.startsWith('botframework-webchat'))
39+
.map(element => [element.name, element.getAttribute('content')])
40+
);
41+
42+
expect(metaMap.has('botframework-webchat:api')).toBe(true);
43+
expect(metaMap.get('botframework-webchat:bundle:variant')).toBe('minimal');
44+
expect(metaMap.has('botframework-webchat:bundle:version')).toBe(true);
45+
expect(metaMap.has('botframework-webchat:bundle')).toBe(true);
46+
expect(metaMap.has('botframework-webchat:component')).toBe(true);
47+
expect(metaMap.has('botframework-webchat:core:version')).toBe(true);
48+
expect(metaMap.has('botframework-webchat:core')).toBe(true);
49+
expect(metaMap.has('botframework-webchat:ui:version')).toBe(true);
50+
});
51+
</script>
52+
</body>
53+
</html>
8.67 KB
Loading

packages/component/src/providers/HTMLContentTransformCOR/HTMLContentTransformComposer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type HTMLContentTransformComposerProps = Readonly<{
1313

1414
const HTMLContentTransformComposer = memo(({ children, middleware }: HTMLContentTransformComposerProps) => {
1515
const transform = useMemo<HTMLContentTransformFunction>(() => {
16-
const enhancers = middleware.map(enhancer => enhancer()).reverse();
16+
const enhancers = (middleware || []).map(enhancer => enhancer()).reverse();
1717

1818
return enhancers.reduce(
1919
(chain: HTMLContentTransformFunction, fn) => fn(chain),

0 commit comments

Comments
 (0)