Skip to content

Commit 6d6f5ca

Browse files
committed
Initial commit
1 parent 6ee0a58 commit 6d6f5ca

25 files changed

Lines changed: 357 additions & 23 deletions
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
</head>
6+
<body>
7+
<main id="webchat"></main>
8+
<script type="importmap">
9+
{
10+
"imports": {
11+
"botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js",
12+
"botframework-webchat/experience/chatLauncher": "/__dist__/packages/bundle/static/botframework-webchat/experience/chatLauncher.js",
13+
"react": "/__dist__/packages/bundle/static/react.js",
14+
"react-dom": "/__dist__/packages/bundle/static/react-dom.js",
15+
"react-dom/client": "/__dist__/packages/bundle/static/react-dom/client.js"
16+
}
17+
}
18+
</script>
19+
<script type="module">
20+
import '/test-harness.mjs';
21+
import '/test-page-object.mjs';
22+
23+
import { createStoreWithOptions } from 'botframework-webchat';
24+
import { ChatLauncher } from 'botframework-webchat/experience/chatLauncher';
25+
import { createElement } from 'react';
26+
import { flushSync } from 'react-dom';
27+
import { createRoot } from 'react-dom/client';
28+
29+
run(async function () {
30+
const {
31+
testHelpers: { createDirectLineEmulator }
32+
} = window;
33+
34+
// TODO: This is for `createDirectLineEmulator` only, should find ways to eliminate this line.
35+
window.WebChat = { createStoreWithOptions };
36+
37+
const { directLine, store } = createDirectLineEmulator();
38+
39+
flushSync(() => createRoot(document.getElementById('webchat')).render(createElement(ChatLauncher, {})));
40+
41+
await host.snapshot('local');
42+
});
43+
</script>
44+
</body>
45+
</html>

lint-staged.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = {
1919
'packages/core/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:core'],
2020
'packages/debug-theme/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:debug-theme'],
2121
'packages/directlinespeech/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:directlinespeech'],
22+
'packages/experience-chat-launcher/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:experience-chat-launcher'],
2223
'packages/fluent-theme/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:fluent-theme'],
2324
'packages/isomorphic-react/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:isomorphic-react'],
2425
'packages/isomorphic-react-dom/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:isomorphic-react-dom'],

package-lock.json

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"./packages/isomorphic-react",
3333
"./packages/isomorphic-react-dom",
3434
"./packages/component",
35+
"./packages/experience-chat-launcher",
3536
"./packages/repack/adaptivecards",
3637
"./packages/repack/base64-js",
3738
"./packages/repack/botframework-directlinejs",
@@ -79,6 +80,7 @@
7980
"precommit:eslint:core": "cd packages && cd core && npm run precommit:eslint",
8081
"precommit:eslint:debug-theme": "cd packages && cd debug-theme && npm run precommit:eslint",
8182
"precommit:eslint:directlinespeech": "cd packages && cd directlinespeech && npm run precommit:eslint",
83+
"precommit:eslint:experience-chat-launcher": "cd packages && cd experience-chat-launcher && npm run precommit:eslint",
8284
"precommit:eslint:fluent-theme": "cd packages && cd fluent-theme && npm run precommit:eslint",
8385
"precommit:eslint:isomorphic-react": "cd packages && cd isomorphic-react && npm run precommit:eslint",
8486
"precommit:eslint:isomorphic-react-dom": "cd packages && cd isomorphic-react-dom && npm run precommit:eslint",
@@ -112,6 +114,7 @@
112114
"precommit:typecheck:component": "cd packages && cd component && npm run precommit:typecheck",
113115
"precommit:typecheck:core": "cd packages && cd core && npm run precommit:typecheck",
114116
"precommit:typecheck:debug-theme": "cd packages && cd debug-theme && npm run precommit:typecheck",
117+
"precommit:typecheck:experience-chat-launcher": "cd packages && cd experience-chat-launcher && npm run precommit:typecheck",
115118
"precommit:typecheck:fluent-theme": "cd packages && cd fluent-theme && npm run precommit:typecheck",
116119
"precommit:typecheck:react-hooks": "cd packages && cd react-hooks && npm run precommit:typecheck",
117120
"precommit:typecheck:react-valibot": "cd packages && cd react-valibot && npm run precommit:typecheck",
@@ -139,6 +142,7 @@
139142
"start:core": "cd packages && cd core && npm start",
140143
"start:debug-theme": "cd packages && cd debug-theme && npm start",
141144
"start:directlinespeech": "cd packages && cd directlinespeech && npm start",
145+
"start:experience-chat-launcher": "cd packages && cd experience-chat-launcher && npm start",
142146
"start:fluent-theme": "cd packages && cd fluent-theme && npm start",
143147
"start:react-hooks": "cd packages && cd react-hooks && npm start",
144148
"start:react-valibot": "cd packages && cd react-valibot && npm start",

packages/bundle/esbuild.static.mjs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,6 @@ import { readPackage } from 'read-pkg';
1111
import { fileURLToPath } from 'url';
1212
import { cssPlugin } from '../../esbuildPlugins.mjs';
1313

14-
// eslint-disable-next-line no-unused-vars
15-
const isomorphicReactPlugin = {
16-
name: 'isomorphic-react',
17-
setup(build) {
18-
// eslint-disable-next-line require-unicode-regexp
19-
build.onResolve({ filter: /^(react|react-dom)$/, namespace: 'file' }, ({ path }) => ({
20-
namespace: 'isomorphic-react',
21-
path
22-
}));
23-
24-
// eslint-disable-next-line require-unicode-regexp
25-
build.onLoad({ filter: /^react$/, namespace: 'isomorphic-react' }, () => ({
26-
contents: "import React from 'react'; module.exports = globalThis.React || React;"
27-
}));
28-
29-
// eslint-disable-next-line require-unicode-regexp
30-
build.onLoad({ filter: /^react-dom$/, namespace: 'isomorphic-react' }, () => ({
31-
contents: "import ReactDOM from 'react-dom'; module.exports = globalThis.ReactDOM || ReactDOM;"
32-
}));
33-
}
34-
};
35-
3614
function createWatcherPlugin(name) {
3715
/** @type { import('esbuild').Plugin } */
3816
return {
@@ -130,6 +108,7 @@ const IGNORED_OWN_PACKAGES = [
130108
'botframework-webchat': './src/boot/exports/index.ts',
131109
'botframework-webchat/component': './src/boot/exports/component.ts',
132110
'botframework-webchat/decorator': './src/boot/exports/decorator.ts',
111+
'botframework-webchat/experience/chatLauncher': './src/boot/exports/experience/chatLauncher.ts',
133112
'botframework-webchat/hook': './src/boot/exports/hook.ts',
134113
'botframework-webchat/internal': './src/boot/exports/internal.ts',
135114
'botframework-webchat/middleware': './src/boot/exports/middleware.ts',
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This is required for Webpack 4 which does not support named exports.
2+
// eslint-disable-next-line no-undef
3+
module.exports = require('./dist/botframework-webchat.experience.chat-launcher.js');

packages/bundle/package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
"default": "./dist/botframework-webchat.decorator.js"
3636
}
3737
},
38+
"./experience/chatLauncher": {
39+
"import": {
40+
"types": "./dist/botframework-webchat.experience.chat-launcher.d.mts",
41+
"default": "./dist/botframework-webchat.experience.chat-launcher.mjs"
42+
}
43+
},
3844
"./hook": {
3945
"import": {
4046
"types": "./dist/botframework-webchat.hook.d.mts",
@@ -82,6 +88,7 @@
8288
"homepage": "https://github.com/microsoft/BotFramework-WebChat/#readme",
8389
"files": [
8490
"./dist/**/*",
91+
"./experience/**/*",
8592
"./src/**/*",
8693
"./static/**/*"
8794
],
@@ -121,8 +128,9 @@
121128
"localDependencies": {
122129
"@msinternal/adaptivecards": "development",
123130
"@msinternal/base64-js": "development",
124-
"@msinternal/botframework-webchat-base": "development",
125131
"@msinternal/botframework-directlinejs": "development",
132+
"@msinternal/botframework-webchat-base": "development",
133+
"@msinternal/botframework-webchat-experience-chat-launcher": "development",
126134
"@msinternal/botframework-webchat-react-valibot": "development",
127135
"@msinternal/botframework-webchat-tsconfig": "development",
128136
"@msinternal/isomorphic-react-baseline": "development",
@@ -212,6 +220,7 @@
212220
"@msinternal/base64-js": "0.0.0-0",
213221
"@msinternal/botframework-directlinejs": "0.0.0-0",
214222
"@msinternal/botframework-webchat-base": "0.0.0-0",
223+
"@msinternal/botframework-webchat-experience-chat-launcher": "0.0.0-0",
215224
"@msinternal/botframework-webchat-react-valibot": "0.0.0-0",
216225
"@msinternal/botframework-webchat-tsconfig": "0.0.0-0",
217226
"@msinternal/isomorphic-react": "0.0.0-0",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { ChatLauncher } from '@msinternal/botframework-webchat-experience-chat-launcher';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../../actual/experience/chatLauncher';

packages/bundle/tsup.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const commonConfig = applyConfig(config => ({
2121
'botframework-webchat': './src/boot/exports/index.ts',
2222
'botframework-webchat.component': './src/boot/exports/component.ts',
2323
'botframework-webchat.decorator': './src/boot/exports/decorator.ts',
24+
'botframework-webchat.experience.chatLauncher': './src/boot/exports/experience/chatLauncher.ts',
2425
'botframework-webchat.hook': './src/boot/exports/hook.ts',
2526
'botframework-webchat.internal': './src/boot/exports/internal.ts',
2627
'botframework-webchat.middleware': './src/boot/exports/middleware.ts'

0 commit comments

Comments
 (0)