diff --git a/CHANGELOG.md b/CHANGELOG.md
index 60a4245a69..5e6e5b06db 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -132,6 +132,11 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
- Unified build info and injection of `` tag, in PR [#5571](https://github.com/microsoft/BotFramework-WebChat/pull/5571), by [@compulim](https://github.com/compulim)
- Added documentation for `isPartOf` property, in PR [#5573](https://github.com/microsoft/BotFramework-WebChat/pull/5573), by [@compulim](https://github.com/compulim)
- `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)
+- Improved bundling, in PR [#5588](https://github.com/microsoft/BotFramework-WebChat/pull/5588), by [@compulim](https://github.com/compulim)
+ - New named exports
+ - `api`: `botframework-webchat-api/hook`
+ - `bundle`: `botframework-webchat/component`, `botframework-webchat/decorator` (internal-use), `botframework-webchat/hook`
+ - `component`: `botframework-webchat-component/component`, `botframework-webchat-component/hook`
### Changed
diff --git a/__tests__/html2/simple/fatModule/fluentTheme.skip.html b/__tests__/html2/simple/fatModule/fluentTheme.skip.html
new file mode 100644
index 0000000000..b4cc64287f
--- /dev/null
+++ b/__tests__/html2/simple/fatModule/fluentTheme.skip.html
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/__tests__/html2/simple/fatModule/simple.skip.html b/__tests__/html2/simple/fatModule/simple.skip.html
new file mode 100644
index 0000000000..c49876ffd4
--- /dev/null
+++ b/__tests__/html2/simple/fatModule/simple.skip.html
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/__tests__/html2/simple/fatModule/supportPolymiddleware.reactDOMRender.skip.html b/__tests__/html2/simple/fatModule/supportPolymiddleware.reactDOMRender.skip.html
new file mode 100644
index 0000000000..0751f822ed
--- /dev/null
+++ b/__tests__/html2/simple/fatModule/supportPolymiddleware.reactDOMRender.skip.html
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/__tests__/html2/simple/fatModule/supportPolymiddleware.renderWebChat.skip.html b/__tests__/html2/simple/fatModule/supportPolymiddleware.renderWebChat.skip.html
new file mode 100644
index 0000000000..050cc7a676
--- /dev/null
+++ b/__tests__/html2/simple/fatModule/supportPolymiddleware.renderWebChat.skip.html
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/__tests__/html2/simple.emulator.html b/__tests__/html2/simple/simple.emulator.html
similarity index 100%
rename from __tests__/html2/simple.emulator.html
rename to __tests__/html2/simple/simple.emulator.html
diff --git a/__tests__/html2/simple.html b/__tests__/html2/simple/simple.html
similarity index 100%
rename from __tests__/html2/simple.html
rename to __tests__/html2/simple/simple.html
diff --git a/__tests__/html2/simple.offline.html b/__tests__/html2/simple/simple.offline.html
similarity index 100%
rename from __tests__/html2/simple.offline.html
rename to __tests__/html2/simple/simple.offline.html
diff --git a/jest.legacy.config.js b/jest.legacy.config.js
index cde5ea0c34..f6cd01710c 100644
--- a/jest.legacy.config.js
+++ b/jest.legacy.config.js
@@ -41,6 +41,9 @@ const TRANSFORM_IGNORE_PACKAGES = [
'unist-util-stringify-position',
'uuid',
+ // Related to Speech SDK.
+ 'microsoft-cognitiveservices-speech-sdk',
+
// Related to Adaptive Cards.
'dom7',
'ssr-window',
diff --git a/package-lock.json b/package-lock.json
index d10bcd1e80..7827e11002 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3535,7 +3535,8 @@
},
"node_modules/@types/webrtc": {
"version": "0.0.37",
- "license": "MIT"
+ "resolved": "https://registry.npmjs.org/@types/webrtc/-/webrtc-0.0.37.tgz",
+ "integrity": "sha512-JGAJC/ZZDhcrrmepU4sPLQLIOIAgs5oIK+Ieq90K8fdaNMhfdfqmYatJdgif1NDQtvrSlTOGJDUYHIDunuufOg=="
},
"node_modules/@types/whatwg-mimetype": {
"version": "3.0.2",
@@ -4405,7 +4406,8 @@
},
"node_modules/asn1.js": {
"version": "5.4.1",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz",
+ "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==",
"dependencies": {
"bn.js": "^4.0.0",
"inherits": "^2.0.1",
@@ -4415,7 +4417,8 @@
},
"node_modules/asn1.js-rfc2560": {
"version": "5.0.1",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/asn1.js-rfc2560/-/asn1.js-rfc2560-5.0.1.tgz",
+ "integrity": "sha512-1PrVg6kuBziDN3PGFmRk3QrjpKvP9h/Hv5yMrFZvC1kpzP6dQRzf5BpKstANqHBkaOUmTpakJWhicTATOA/SbA==",
"dependencies": {
"asn1.js-rfc5280": "^3.0.0"
},
@@ -4425,14 +4428,16 @@
},
"node_modules/asn1.js-rfc5280": {
"version": "3.0.0",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/asn1.js-rfc5280/-/asn1.js-rfc5280-3.0.0.tgz",
+ "integrity": "sha512-Y2LZPOWeZ6qehv698ZgOGGCZXBQShObWnGthTrIFlIQjuV1gg2B8QOhWFRExq/MR1VnPpIIe7P9vX2vElxv+Pg==",
"dependencies": {
"asn1.js": "^5.0.0"
}
},
"node_modules/async-disk-cache": {
"version": "2.1.0",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/async-disk-cache/-/async-disk-cache-2.1.0.tgz",
+ "integrity": "sha512-iH+boep2xivfD9wMaZWkywYIURSmsL96d6MoqrC94BnGSvXE4Quf8hnJiHGFYhw/nLeIa1XyRaf4vvcvkwAefg==",
"dependencies": {
"debug": "^4.1.1",
"heimdalljs": "^0.2.3",
@@ -4448,7 +4453,8 @@
},
"node_modules/async-disk-cache/node_modules/mkdirp": {
"version": "0.5.6",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
+ "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"dependencies": {
"minimist": "^1.2.6"
},
@@ -4745,7 +4751,8 @@
},
"node_modules/binaryextensions": {
"version": "2.3.0",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.3.0.tgz",
+ "integrity": "sha512-nAihlQsYGyc5Bwq6+EsubvANYGExeJKHDO3RjnvwU042fawQTQfM3Kxn7IHUXQOz4bzfwsGYYHGSvXyW4zOGLg==",
"engines": {
"node": ">=0.8"
},
@@ -4754,8 +4761,9 @@
}
},
"node_modules/bn.js": {
- "version": "4.12.0",
- "license": "MIT"
+ "version": "4.12.2",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.2.tgz",
+ "integrity": "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw=="
},
"node_modules/body-parser": {
"version": "2.2.0",
@@ -6356,7 +6364,8 @@
},
"node_modules/editions": {
"version": "2.3.1",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/editions/-/editions-2.3.1.tgz",
+ "integrity": "sha512-ptGvkwTvGdGfC0hfhKg0MT+TRLRKGtUiWGBInxOm5pz7ssADezahjCUaYuZ8Dr+C05FW0AECIIPt4WBxVINEhA==",
"dependencies": {
"errlop": "^2.0.0",
"semver": "^6.3.0"
@@ -6452,7 +6461,8 @@
},
"node_modules/errlop": {
"version": "2.2.0",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/errlop/-/errlop-2.2.0.tgz",
+ "integrity": "sha512-e64Qj9+4aZzjzzFpZC7p5kmm/ccCrbLhAJplhsDXQFs87XTsXwOpH4s1Io2s90Tau/8r2j9f4l/thhDevRjzxw==",
"engines": {
"node": ">=0.8"
},
@@ -8448,14 +8458,16 @@
},
"node_modules/heimdalljs": {
"version": "0.2.6",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/heimdalljs/-/heimdalljs-0.2.6.tgz",
+ "integrity": "sha512-o9bd30+5vLBvBtzCPwwGqpry2+n0Hi6H1+qwt6y+0kwRHGGF8TFIhJPmnuM0xO97zaKrDZMwO/V56fAnn8m/tA==",
"dependencies": {
"rsvp": "~3.2.1"
}
},
"node_modules/heimdalljs/node_modules/rsvp": {
"version": "3.2.1",
- "license": "MIT"
+ "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-3.2.1.tgz",
+ "integrity": "sha512-Rf4YVNYpKjZ6ASAmibcwTNciQ5Co5Ztq6iZPEykHpkoflnD/K5ryE/rHehFsTm4NJj8nKDhbi3eKBWGogmNnkg=="
},
"node_modules/hoist-non-react-statics": {
"version": "3.3.2",
@@ -9493,7 +9505,8 @@
},
"node_modules/istextorbinary": {
"version": "2.6.0",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-2.6.0.tgz",
+ "integrity": "sha512-+XRlFseT8B3L9KyjxxLjfXSLMuErKDsd8DBNrsaxoViABMEZlOSCstwmw0qpoFX3+U6yWU1yhLudAe6/lETGGA==",
"dependencies": {
"binaryextensions": "^2.1.2",
"editions": "^2.2.0",
@@ -11889,81 +11902,50 @@
}
},
"node_modules/microsoft-cognitiveservices-speech-sdk": {
- "version": "1.17.0",
- "license": "MIT",
+ "version": "1.45.0",
+ "resolved": "https://registry.npmjs.org/microsoft-cognitiveservices-speech-sdk/-/microsoft-cognitiveservices-speech-sdk-1.45.0.tgz",
+ "integrity": "sha512-etTSMGxDELxBQtNL8cgq2bwMrE6CjgfC8oIqKH9I9ghFs4/ITyLXy9HZuo0wQItN1zfDH3FhBeR72TmApe6pCQ==",
"dependencies": {
+ "@types/webrtc": "^0.0.37",
"agent-base": "^6.0.1",
- "asn1.js-rfc2560": "^5.0.1",
- "asn1.js-rfc5280": "^3.0.0",
- "async-disk-cache": "^2.1.0",
+ "bent": "^7.3.12",
"https-proxy-agent": "^4.0.0",
- "simple-lru-cache": "0.0.2",
- "url-parse": "^1.4.7",
- "uuid": "^3.3.3",
- "ws": "^7.3.1",
- "xmlhttprequest-ts": "^1.0.1"
- }
- },
- "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/@angular/common": {
- "version": "18.2.5",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "tslib": "^2.3.0"
- },
- "engines": {
- "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
- },
- "peerDependencies": {
- "@angular/core": "18.2.5",
- "rxjs": "^6.5.3 || ^7.4.0"
- }
- },
- "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/@angular/core": {
- "version": "18.2.5",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "tslib": "^2.3.0"
- },
- "engines": {
- "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
- },
- "peerDependencies": {
- "rxjs": "^6.5.3 || ^7.4.0",
- "zone.js": "~0.14.10"
- }
- },
- "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/rxjs": {
- "version": "7.8.1",
- "license": "Apache-2.0",
- "peer": true,
- "dependencies": {
- "tslib": "^2.1.0"
+ "uuid": "^9.0.0",
+ "ws": "^8.18.2"
}
},
"node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid": {
- "version": "3.4.0",
- "license": "MIT",
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
+ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
"bin": {
- "uuid": "bin/uuid"
+ "uuid": "dist/bin/uuid"
}
},
- "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/xmlhttprequest-ts": {
- "version": "1.0.1",
- "license": "MIT",
- "dependencies": {
- "tslib": "^1.9.2"
+ "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/ws": {
+ "version": "8.18.3",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
+ "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
+ "engines": {
+ "node": ">=10.0.0"
},
"peerDependencies": {
- "@angular/common": ">= 5.0.0",
- "@angular/core": ">= 5.0.0"
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
}
},
- "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/xmlhttprequest-ts/node_modules/tslib": {
- "version": "1.14.1",
- "license": "0BSD"
- },
"node_modules/mime": {
"version": "1.6.0",
"dev": true,
@@ -12024,7 +12006,8 @@
},
"node_modules/minimalistic-assert": {
"version": "1.0.1",
- "license": "ISC"
+ "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
+ "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
},
"node_modules/minimatch": {
"version": "9.0.5",
@@ -13157,7 +13140,8 @@
},
"node_modules/querystringify": {
"version": "2.2.0",
- "license": "MIT"
+ "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
+ "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
},
"node_modules/queue-microtask": {
"version": "1.2.3",
@@ -13923,7 +13907,8 @@
},
"node_modules/rsvp": {
"version": "4.8.5",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
+ "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==",
"engines": {
"node": "6.* || >= 7.*"
}
@@ -14626,7 +14611,9 @@
"license": "ISC"
},
"node_modules/simple-lru-cache": {
- "version": "0.0.2"
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/simple-lru-cache/-/simple-lru-cache-0.0.2.tgz",
+ "integrity": "sha512-uEv/AFO0ADI7d99OHDmh1QfYzQk/izT1vCmu/riQfh7qjBVUUgRT87E5s5h7CxWCA/+YoZerykpEthzVrW3LIw=="
},
"node_modules/simple-update-in": {
"version": "2.2.0",
@@ -15428,7 +15415,8 @@
},
"node_modules/textextensions": {
"version": "2.6.0",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-2.6.0.tgz",
+ "integrity": "sha512-49WtAWS+tcsy93dRt6P0P3AMD2m5PvXRhuEA0kaXos5ZLlujtYmpmFsB+QvWUSxE1ZsstmYXfQ7L40+EcQgpAQ==",
"engines": {
"node": ">=0.8"
},
@@ -16327,7 +16315,8 @@
},
"node_modules/url-parse": {
"version": "1.5.10",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
+ "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
"dependencies": {
"querystringify": "^2.1.1",
"requires-port": "^1.0.0"
@@ -16385,7 +16374,8 @@
},
"node_modules/username-sync": {
"version": "1.0.3",
- "license": "MIT"
+ "resolved": "https://registry.npmjs.org/username-sync/-/username-sync-1.0.3.tgz",
+ "integrity": "sha512-m/7/FSqjJNAzF2La448c/aEom0gJy7HY7Y509h6l0ePvEkFictAGptwWaj1msWJ38JbfEDOUoE8kqFee9EHKdA=="
},
"node_modules/util-deprecate": {
"version": "1.0.2",
@@ -17093,11 +17083,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/zone.js": {
- "version": "0.14.10",
- "license": "MIT",
- "peer": true
- },
"node_modules/zwitch": {
"version": "2.0.4",
"license": "MIT",
@@ -17600,29 +17585,6 @@
"@types/hast": "^3.0.4"
}
},
- "packages/bundle/node_modules/microsoft-cognitiveservices-speech-sdk": {
- "version": "1.45.0",
- "license": "MIT",
- "dependencies": {
- "@types/webrtc": "^0.0.37",
- "agent-base": "^6.0.1",
- "bent": "^7.3.12",
- "https-proxy-agent": "^4.0.0",
- "uuid": "^9.0.0",
- "ws": "^8.18.2"
- }
- },
- "packages/bundle/node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid": {
- "version": "9.0.1",
- "funding": [
- "https://github.com/sponsors/broofa",
- "https://github.com/sponsors/ctavan"
- ],
- "license": "MIT",
- "bin": {
- "uuid": "dist/bin/uuid"
- }
- },
"packages/bundle/node_modules/oniguruma-to-es": {
"version": "3.1.1",
"license": "MIT",
@@ -17669,25 +17631,6 @@
"node": ">=14.17"
}
},
- "packages/bundle/node_modules/ws": {
- "version": "8.18.3",
- "license": "MIT",
- "engines": {
- "node": ">=10.0.0"
- },
- "peerDependencies": {
- "bufferutil": "^4.0.1",
- "utf-8-validate": ">=5.0.2"
- },
- "peerDependenciesMeta": {
- "bufferutil": {
- "optional": true
- },
- "utf-8-validate": {
- "optional": true
- }
- }
- },
"packages/component": {
"name": "botframework-webchat-component",
"version": "0.0.0-0",
@@ -18307,6 +18250,47 @@
"node": ">= 10.14.2"
}
},
+ "packages/directlinespeech/node_modules/@angular/common": {
+ "version": "20.3.1",
+ "resolved": "https://registry.npmjs.org/@angular/common/-/common-20.3.1.tgz",
+ "integrity": "sha512-7Ru3BO4MOBQRMu9GJS+061cUsevKNsNAMxXnQtcqEaNyntUg2v0XiMdv4I7pQGtkQjFK17bKAxQ97jqxJfqsRQ==",
+ "peer": true,
+ "dependencies": {
+ "tslib": "^2.3.0"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
+ },
+ "peerDependencies": {
+ "@angular/core": "20.3.1",
+ "rxjs": "^6.5.3 || ^7.4.0"
+ }
+ },
+ "packages/directlinespeech/node_modules/@angular/core": {
+ "version": "20.3.1",
+ "resolved": "https://registry.npmjs.org/@angular/core/-/core-20.3.1.tgz",
+ "integrity": "sha512-O03k9ivZ2CvoHXiXGH5WKlWlTtxF2UGMwGXWnV54vGViHwNcvU5Z3h6Ve6mdU9dYMHK9sGljYZnkRpwI3B8mnQ==",
+ "peer": true,
+ "dependencies": {
+ "tslib": "^2.3.0"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
+ },
+ "peerDependencies": {
+ "@angular/compiler": "20.3.1",
+ "rxjs": "^6.5.3 || ^7.4.0",
+ "zone.js": "~0.15.0"
+ },
+ "peerDependenciesMeta": {
+ "@angular/compiler": {
+ "optional": true
+ },
+ "zone.js": {
+ "optional": true
+ }
+ }
+ },
"packages/directlinespeech/node_modules/event-target-shim": {
"version": "6.0.2",
"license": "MIT",
@@ -18317,6 +18301,58 @@
"url": "https://github.com/sponsors/mysticatea"
}
},
+ "packages/directlinespeech/node_modules/microsoft-cognitiveservices-speech-sdk": {
+ "version": "1.17.0",
+ "resolved": "https://registry.npmjs.org/microsoft-cognitiveservices-speech-sdk/-/microsoft-cognitiveservices-speech-sdk-1.17.0.tgz",
+ "integrity": "sha512-RVUCpTeu1g+R4HB/PaLQmEfsdHzwEa6+2phgCiPA4lGIiR7ILEL7qZHHUWAG6W4zcjnWeiLnL7tVgMbyd5XGgA==",
+ "dependencies": {
+ "agent-base": "^6.0.1",
+ "asn1.js-rfc2560": "^5.0.1",
+ "asn1.js-rfc5280": "^3.0.0",
+ "async-disk-cache": "^2.1.0",
+ "https-proxy-agent": "^4.0.0",
+ "simple-lru-cache": "0.0.2",
+ "url-parse": "^1.4.7",
+ "uuid": "^3.3.3",
+ "ws": "^7.3.1",
+ "xmlhttprequest-ts": "^1.0.1"
+ }
+ },
+ "packages/directlinespeech/node_modules/rxjs": {
+ "version": "7.8.2",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
+ "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
+ "peer": true,
+ "dependencies": {
+ "tslib": "^2.1.0"
+ }
+ },
+ "packages/directlinespeech/node_modules/uuid": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
+ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
+ "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
+ "bin": {
+ "uuid": "bin/uuid"
+ }
+ },
+ "packages/directlinespeech/node_modules/xmlhttprequest-ts": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/xmlhttprequest-ts/-/xmlhttprequest-ts-1.0.1.tgz",
+ "integrity": "sha512-x+7u8NpBcwfBCeGqUpdGrR6+kGUGVjKc4wolyCz7CQqBZQp7VIyaF1xAvJ7ApRzvLeuiC4BbmrA6CWH9NqxK/g==",
+ "dependencies": {
+ "tslib": "^1.9.2"
+ },
+ "peerDependencies": {
+ "@angular/common": ">= 5.0.0",
+ "@angular/core": ">= 5.0.0"
+ }
+ },
+ "packages/directlinespeech/node_modules/xmlhttprequest-ts/node_modules/tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
+ },
"packages/fluent-theme": {
"name": "botframework-webchat-fluent-theme",
"version": "0.0.0-0",
@@ -19073,48 +19109,6 @@
"url": "https://github.com/sponsors/mysticatea"
}
},
- "packages/test/page-object/node_modules/microsoft-cognitiveservices-speech-sdk": {
- "version": "1.45.0",
- "license": "MIT",
- "dependencies": {
- "@types/webrtc": "^0.0.37",
- "agent-base": "^6.0.1",
- "bent": "^7.3.12",
- "https-proxy-agent": "^4.0.0",
- "uuid": "^9.0.0",
- "ws": "^8.18.2"
- }
- },
- "packages/test/page-object/node_modules/uuid": {
- "version": "9.0.1",
- "funding": [
- "https://github.com/sponsors/broofa",
- "https://github.com/sponsors/ctavan"
- ],
- "license": "MIT",
- "bin": {
- "uuid": "dist/bin/uuid"
- }
- },
- "packages/test/page-object/node_modules/ws": {
- "version": "8.18.3",
- "license": "MIT",
- "engines": {
- "node": ">=10.0.0"
- },
- "peerDependencies": {
- "bufferutil": "^4.0.1",
- "utf-8-validate": ">=5.0.2"
- },
- "peerDependenciesMeta": {
- "bufferutil": {
- "optional": true
- },
- "utf-8-validate": {
- "optional": true
- }
- }
- },
"packages/test/web-server": {
"name": "@msinternal/test-web-server",
"version": "0.0.0-0",
diff --git a/packages/api/hook.js b/packages/api/hook.js
new file mode 100644
index 0000000000..3d3902dd82
--- /dev/null
+++ b/packages/api/hook.js
@@ -0,0 +1,3 @@
+// This is required for Webpack 4 which does not support named exports.
+// eslint-disable-next-line no-undef
+module.exports = require('./dist/botframework-webchat-api.hook.js');
diff --git a/packages/api/package.json b/packages/api/package.json
index 5c5694a30c..c3e5475f4f 100644
--- a/packages/api/package.json
+++ b/packages/api/package.json
@@ -15,16 +15,6 @@
"default": "./dist/botframework-webchat-api.js"
}
},
- "./internal": {
- "import": {
- "types": "./dist/botframework-webchat-api.internal.d.mts",
- "default": "./dist/botframework-webchat-api.internal.mjs"
- },
- "require": {
- "types": "./dist/botframework-webchat-api.internal.d.ts",
- "default": "./dist/botframework-webchat-api.internal.js"
- }
- },
"./decorator": {
"import": {
"types": "./dist/botframework-webchat-api.decorator.d.mts",
@@ -35,6 +25,26 @@
"default": "./dist/botframework-webchat-api.decorator.js"
}
},
+ "./hook": {
+ "import": {
+ "types": "./dist/botframework-webchat-api.hook.d.mts",
+ "default": "./dist/botframework-webchat-api.hook.mjs"
+ },
+ "require": {
+ "types": "./dist/botframework-webchat-api.hook.d.ts",
+ "default": "./dist/botframework-webchat-api.hook.js"
+ }
+ },
+ "./internal": {
+ "import": {
+ "types": "./dist/botframework-webchat-api.internal.d.mts",
+ "default": "./dist/botframework-webchat-api.internal.mjs"
+ },
+ "require": {
+ "types": "./dist/botframework-webchat-api.internal.d.ts",
+ "default": "./dist/botframework-webchat-api.internal.js"
+ }
+ },
"./middleware": {
"import": {
"types": "./dist/botframework-webchat-api.middleware.d.mts",
diff --git a/packages/api/src/decorator.ts b/packages/api/src/boot/decorator.ts
similarity index 54%
rename from packages/api/src/decorator.ts
rename to packages/api/src/boot/decorator.ts
index 069821c719..aeb77a87ab 100644
--- a/packages/api/src/decorator.ts
+++ b/packages/api/src/boot/decorator.ts
@@ -1,8 +1,8 @@
// Decorator general
-export { default as DecoratorComposer } from './decorator/DecoratorComposer';
-export { type DecoratorMiddleware } from './decorator/types';
-export { default as useDecoratorRequest, type InferDecoratorRequest } from './decorator/useDecoratorRequest';
+export { default as DecoratorComposer } from '../decorator/DecoratorComposer';
+export { type DecoratorMiddleware } from '../decorator/types';
+export { default as useDecoratorRequest, type InferDecoratorRequest } from '../decorator/useDecoratorRequest';
// ActivityBorderDecorator
@@ -11,11 +11,11 @@ export {
createActivityBorderMiddleware,
ActivityBorderDecoratorRequest,
type ActivityBorderDecoratorProps
-} from './decorator/ActivityBorder/ActivityBorderDecorator';
+} from '../decorator/ActivityBorder/ActivityBorderDecorator';
// ActivityGroupingDecorator
export {
default as ActivityGroupingDecorator,
createActivityGroupingMiddleware
-} from './decorator/ActivityGrouping/ActivityGroupingDecorator';
+} from '../decorator/ActivityGrouping/ActivityGroupingDecorator';
diff --git a/packages/api/src/boot/hook.ts b/packages/api/src/boot/hook.ts
new file mode 100644
index 0000000000..8d6df8447f
--- /dev/null
+++ b/packages/api/src/boot/hook.ts
@@ -0,0 +1,77 @@
+export {
+ useActiveTyping,
+ useActivities,
+ useActivityKeys,
+ useActivityKeysByRead,
+ useAvatarForBot,
+ useAvatarForUser,
+ useBuildRenderActivityCallback,
+ useByteFormatter,
+ useConnectivityStatus,
+ useCreateActivityRenderer,
+ useCreateActivityStatusRenderer,
+ useCreateAttachmentForScreenReaderRenderer,
+ useCreateAvatarRenderer,
+ useCreateScrollToEndButtonRenderer,
+ useDateFormatter,
+ useDebouncedNotifications,
+ useDictateInterims,
+ useDictateState,
+ useDirection,
+ useDisabled,
+ useDismissNotification,
+ useEmitTypingIndicator,
+ useGetActivitiesByKey,
+ useGetActivityByKey,
+ useGetHasAcknowledgedByActivityKey,
+ useGetKeyByActivity,
+ useGetKeyByActivityId,
+ useGetSendTimeoutForActivity,
+ useGrammars,
+ useGroupActivities,
+ useGroupActivitiesByName,
+ useGroupTimestamp,
+ useLanguage,
+ useLastAcknowledgedActivityKey,
+ useLastReadActivityKey,
+ useLocalizer,
+ useMarkActivityAsSpoken,
+ useMarkActivityKeyAsRead,
+ useMarkAllAsAcknowledged,
+ useNotifications,
+ usePerformCardAction,
+ usePonyfill,
+ usePostActivity,
+ useReferenceGrammarID,
+ useRelativeTimeFormatter,
+ useRenderAttachment,
+ useRenderToast,
+ useRenderTypingIndicator,
+ useSendBoxAttachments,
+ useSendBoxValue,
+ useSendEvent,
+ useSendFiles,
+ useSendMessage,
+ useSendMessageBack,
+ useSendPostBack,
+ useSendStatusByActivityKey,
+ useSendTimeoutForActivity,
+ useSendTypingIndicator,
+ useSetNotification,
+ useShouldSpeakIncomingActivity,
+ useStartDictate,
+ useStopDictate,
+ useStyleOptions,
+ useSubmitSendBox,
+ useSuggestedActions,
+ useSuggestedActionsHooks,
+ useTimeoutForSend,
+ useTrackDimension,
+ useTrackEvent,
+ useTrackException,
+ useTrackTiming,
+ useUIState,
+ useUserID,
+ useUsername,
+ useVoiceSelector
+} from '../hooks/index';
diff --git a/packages/api/src/boot/internal.ts b/packages/api/src/boot/internal.ts
new file mode 100644
index 0000000000..1664e7cb61
--- /dev/null
+++ b/packages/api/src/boot/internal.ts
@@ -0,0 +1,3 @@
+export { default as LowPriorityDecoratorComposer } from '../decorator/internal/LowPriorityDecoratorComposer';
+export { default as useSetDictateState } from '../hooks/internal/useSetDictateState';
+export { LegacyActivityContextProvider, type LegacyActivityContextType } from '../legacy/LegacyActivityBridgeContext';
diff --git a/packages/api/src/middleware.ts b/packages/api/src/boot/middleware.ts
similarity index 95%
rename from packages/api/src/middleware.ts
rename to packages/api/src/boot/middleware.ts
index a15784a9a2..8d42eb1069 100644
--- a/packages/api/src/middleware.ts
+++ b/packages/api/src/boot/middleware.ts
@@ -30,4 +30,4 @@ export {
type ErrorBoxPolymiddlewareRequest
} from '@msinternal/botframework-webchat-api-middleware';
-export { default as createActivityPolymiddlewareFromLegacy } from './legacy/createActivityPolymiddlewareFromLegacy';
+export { default as createActivityPolymiddlewareFromLegacy } from '../legacy/createActivityPolymiddlewareFromLegacy';
diff --git a/packages/api/src/hooks/Composer.tsx b/packages/api/src/hooks/Composer.tsx
index 5d4fc7d1d2..dbd4b32865 100644
--- a/packages/api/src/hooks/Composer.tsx
+++ b/packages/api/src/hooks/Composer.tsx
@@ -46,8 +46,8 @@ import StyleOptions from '../StyleOptions';
import errorBoxTelemetryPolymiddleware from '../errorBox/errorBoxTelemetryPolymiddleware';
import PrecompiledGlobalize from '../external/PrecompiledGlobalize';
import usePonyfill from '../hooks/usePonyfill';
+import createActivityPolymiddlewareFromLegacy from '../legacy/createActivityPolymiddlewareFromLegacy';
import getAllLocalizedStrings from '../localization/getAllLocalizedStrings';
-import { createActivityPolymiddlewareFromLegacy } from '../middleware';
import { SendBoxMiddlewareProvider, type SendBoxMiddleware } from '../middleware/SendBoxMiddleware';
import {
SendBoxToolbarMiddlewareProvider,
diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts
index e6cd568e4a..2b2cff9478 100644
--- a/packages/api/src/index.ts
+++ b/packages/api/src/index.ts
@@ -1,41 +1,21 @@
-// TODO: Move the pattern to re-export.
-import {
- type LegacyActivityComponentFactory,
- type LegacyActivityMiddleware,
- type LegacyAttachmentMiddleware,
- type LegacyRenderAttachment
+export type {
+ /** @deprecated Use `polymiddleware` instead, this will be removed on or after 2027-08-16. */
+ LegacyActivityComponentFactory as ActivityComponentFactory,
+ /** @deprecated Use `polymiddleware` instead, this will be removed on or after 2027-08-16. */
+ LegacyActivityMiddleware as ActivityMiddleware,
+ /** @deprecated Use `polymiddleware` instead, this will be removed on or after 2027-08-16. */
+ LegacyAttachmentMiddleware as AttachmentMiddleware,
+ LegacyRenderAttachment as RenderAttachment
} from '@msinternal/botframework-webchat-api-middleware/legacy';
-import StyleOptions, { StrictStyleOptions } from './StyleOptions';
-import defaultStyleOptions from './defaultStyleOptions';
-import Composer, { ComposerProps } from './hooks/Composer';
-import * as hooks from './hooks/index';
-import concatMiddleware from './hooks/middleware/concatMiddleware';
-import { type ActivityStatusRenderer } from './hooks/useCreateActivityStatusRenderer'; // TODO: [P1] This line should export the one from the version from "middleware rework" workstream.
-import { type DebouncedNotification, type DebouncedNotifications } from './hooks/useDebouncedNotifications';
-import { type PostActivityFile } from './hooks/useSendFiles';
-import { localize } from './localization/Localize';
-import normalizeStyleOptions from './normalizeStyleOptions';
-import { type ActivityStatusMiddleware, type RenderActivityStatus } from './types/ActivityStatusMiddleware';
-import AttachmentForScreenReaderMiddleware, {
- AttachmentForScreenReaderComponentFactory
-} from './types/AttachmentForScreenReaderMiddleware';
-import AvatarMiddleware, { type AvatarComponentFactory } from './types/AvatarMiddleware';
-import CardActionMiddleware, { type PerformCardAction } from './types/CardActionMiddleware';
-import { type ContextOf } from './types/ContextOf';
-import GroupActivitiesMiddleware, { type GroupActivities } from './types/GroupActivitiesMiddleware';
-import { type Notification } from './types/Notification';
-import ScrollToEndButtonMiddleware, {
- type ScrollToEndButtonComponentFactory
-} from './types/ScrollToEndButtonMiddleware';
-import { type SendStatus } from './types/SendStatus';
-import ToastMiddleware, { type RenderToast } from './types/ToastMiddleware';
-import { type Typing } from './types/Typing';
-import TypingIndicatorMiddleware, { type RenderTypingIndicator } from './types/TypingIndicatorMiddleware';
-import { type WebSpeechPonyfill } from './types/WebSpeechPonyfill';
-import { type WebSpeechPonyfillFactory } from './types/WebSpeechPonyfillFactory';
-
-// #region Re-export
+export * as hooks from './boot/hook';
+export { default as defaultStyleOptions } from './defaultStyleOptions';
+export { default as Composer, type ComposerProps } from './hooks/Composer';
+export { default as concatMiddleware } from './hooks/middleware/concatMiddleware';
+export { type ActivityStatusRenderer } from './hooks/useCreateActivityStatusRenderer'; // TODO: [P1] This line should export the one from the version from "middleware rework" workstream.
+export { type DebouncedNotification, type DebouncedNotifications } from './hooks/useDebouncedNotifications';
+export { type PostActivityFile } from './hooks/useSendFiles';
+export { localize } from './localization/Localize';
export {
extractSendBoxMiddleware,
SendBoxMiddlewareProxy,
@@ -43,7 +23,6 @@ export {
type SendBoxMiddlewareProps,
type SendBoxMiddlewareRequest
} from './middleware/SendBoxMiddleware';
-
export {
extractSendBoxToolbarMiddleware,
SendBoxToolbarMiddlewareProxy,
@@ -51,48 +30,31 @@ export {
type SendBoxToolbarMiddlewareProps,
type SendBoxToolbarMiddlewareRequest
} from './middleware/SendBoxToolbarMiddleware';
-// #endregion
-
-export { Composer, concatMiddleware, defaultStyleOptions, hooks, localize, normalizeStyleOptions };
-
-export type {
- /** @deprecated Use `polymiddleware` instead, this will be removed on or after 2027-08-16. */
- LegacyActivityComponentFactory as ActivityComponentFactory,
- /** @deprecated Use `polymiddleware` instead, this will be removed on or after 2027-08-16. */
- LegacyActivityMiddleware as ActivityMiddleware,
- ActivityStatusMiddleware,
- ActivityStatusRenderer,
- AttachmentForScreenReaderComponentFactory,
- AttachmentForScreenReaderMiddleware,
- /** @deprecated Use `polymiddleware` instead, this will be removed on or after 2027-08-16. */
- LegacyAttachmentMiddleware as AttachmentMiddleware,
- AvatarComponentFactory,
- AvatarMiddleware,
- CardActionMiddleware,
- ComposerProps,
- ContextOf,
- DebouncedNotification,
- DebouncedNotifications,
- GroupActivities,
- GroupActivitiesMiddleware,
- Notification,
- PerformCardAction,
- PostActivityFile,
- RenderActivityStatus,
- LegacyRenderAttachment as RenderAttachment,
- RenderToast,
- RenderTypingIndicator,
- ScrollToEndButtonComponentFactory,
- ScrollToEndButtonMiddleware,
- SendStatus,
- StrictStyleOptions,
- StyleOptions,
- ToastMiddleware,
- Typing,
- TypingIndicatorMiddleware,
- WebSpeechPonyfill,
- WebSpeechPonyfillFactory
-};
+export { default as normalizeStyleOptions } from './normalizeStyleOptions';
+export { type StrictStyleOptions, type default as StyleOptions } from './StyleOptions';
+export { type ActivityStatusMiddleware, type RenderActivityStatus } from './types/ActivityStatusMiddleware';
+export {
+ type AttachmentForScreenReaderComponentFactory,
+ type default as AttachmentForScreenReaderMiddleware
+} from './types/AttachmentForScreenReaderMiddleware';
+export { type AvatarComponentFactory, type default as AvatarMiddleware } from './types/AvatarMiddleware';
+export { type default as CardActionMiddleware, type PerformCardAction } from './types/CardActionMiddleware';
+export { type ContextOf } from './types/ContextOf';
+export { type GroupActivities, type default as GroupActivitiesMiddleware } from './types/GroupActivitiesMiddleware';
+export { type Notification } from './types/Notification';
+export {
+ type ScrollToEndButtonComponentFactory,
+ type default as ScrollToEndButtonMiddleware
+} from './types/ScrollToEndButtonMiddleware';
+export { type SendStatus } from './types/SendStatus';
+export { type RenderToast, type default as ToastMiddleware } from './types/ToastMiddleware';
+export { type Typing } from './types/Typing';
+export {
+ type RenderTypingIndicator,
+ type default as TypingIndicatorMiddleware
+} from './types/TypingIndicatorMiddleware';
+export { type WebSpeechPonyfill } from './types/WebSpeechPonyfill';
+export { type WebSpeechPonyfillFactory } from './types/WebSpeechPonyfillFactory';
// #region Build info
import buildInfo from './buildInfo';
diff --git a/packages/api/src/internal.ts b/packages/api/src/internal.ts
deleted file mode 100644
index 9a7fdf8ca5..0000000000
--- a/packages/api/src/internal.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import LowPriorityDecoratorComposer from './decorator/internal/LowPriorityDecoratorComposer';
-import useSetDictateState from './hooks/internal/useSetDictateState';
-
-export { LegacyActivityContextProvider, type LegacyActivityContextType } from './legacy/LegacyActivityBridgeContext';
-
-export { LowPriorityDecoratorComposer, useSetDictateState };
diff --git a/packages/api/tsup.config.ts b/packages/api/tsup.config.ts
index bdc9e678c1..5ad48a19c5 100644
--- a/packages/api/tsup.config.ts
+++ b/packages/api/tsup.config.ts
@@ -9,9 +9,10 @@ const commonConfig = applyConfig(config => ({
...config,
entry: {
'botframework-webchat-api': './src/index.ts',
- 'botframework-webchat-api.decorator': './src/decorator.ts',
- 'botframework-webchat-api.internal': './src/internal.ts',
- 'botframework-webchat-api.middleware': './src/middleware.ts'
+ 'botframework-webchat-api.decorator': './src/boot/decorator.ts',
+ 'botframework-webchat-api.hook': './src/boot/hook.ts',
+ 'botframework-webchat-api.internal': './src/boot/internal.ts',
+ 'botframework-webchat-api.middleware': './src/boot/middleware.ts'
},
onSuccess: `touch ${DEPENDENT_PATHS.map(path => `../${path}`).join(' ')}`
}));
diff --git a/packages/base/tsup.config.ts b/packages/base/tsup.config.ts
index d40ab158ec..12174d0851 100644
--- a/packages/base/tsup.config.ts
+++ b/packages/base/tsup.config.ts
@@ -6,7 +6,7 @@ import { applyConfig } from '../../tsup.base.config';
const DEPENDENT_PATHS = [
'api/src/index.ts',
'api-middleware/src/index.ts',
- 'bundle/src/boot/exports/full.ts',
+ 'bundle/src/boot/exports/index.ts',
'component/src/index.ts',
'core/src/index.ts',
'debug-theme/src/index.ts',
diff --git a/packages/bundle/component.js b/packages/bundle/component.js
new file mode 100644
index 0000000000..94ba53c956
--- /dev/null
+++ b/packages/bundle/component.js
@@ -0,0 +1,3 @@
+// This is required for Webpack 4 which does not support named exports.
+// eslint-disable-next-line no-undef
+module.exports = require('./dist/botframework-webchat.component.js');
diff --git a/packages/bundle/hook.js b/packages/bundle/hook.js
new file mode 100644
index 0000000000..e5d7a8b63f
--- /dev/null
+++ b/packages/bundle/hook.js
@@ -0,0 +1,3 @@
+// This is required for Webpack 4 which does not support named exports.
+// eslint-disable-next-line no-undef
+module.exports = require('./dist/botframework-webchat.hook.js');
diff --git a/packages/bundle/package.json b/packages/bundle/package.json
index 7cfa54e7ba..b0c7cdc68e 100644
--- a/packages/bundle/package.json
+++ b/packages/bundle/package.json
@@ -15,6 +15,36 @@
"default": "./dist/botframework-webchat.js"
}
},
+ "./component": {
+ "import": {
+ "types": "./dist/botframework-webchat.component.d.mts",
+ "default": "./dist/botframework-webchat.component.mjs"
+ },
+ "require": {
+ "types": "./dist/botframework-webchat.component.d.ts",
+ "default": "./dist/botframework-webchat.component.js"
+ }
+ },
+ "./decorator": {
+ "import": {
+ "types": "./dist/botframework-webchat.decorator.d.mts",
+ "default": "./dist/botframework-webchat.decorator.mjs"
+ },
+ "require": {
+ "types": "./dist/botframework-webchat.decorator.d.ts",
+ "default": "./dist/botframework-webchat.decorator.js"
+ }
+ },
+ "./hook": {
+ "import": {
+ "types": "./dist/botframework-webchat.hook.d.mts",
+ "default": "./dist/botframework-webchat.hook.mjs"
+ },
+ "require": {
+ "types": "./dist/botframework-webchat.hook.d.ts",
+ "default": "./dist/botframework-webchat.hook.js"
+ }
+ },
"./internal": {
"import": {
"types": "./dist/botframework-webchat.internal.d.mts",
@@ -75,7 +105,8 @@
"precommit:eslint": "../../node_modules/.bin/eslint --report-unused-disable-directives --max-warnings 0",
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
"preversion": "cat package.json | jq '(.localDependencies // {} | to_entries | map([if .value == \"production\" then \"dependencies\" else \"devDependencies\" end, .key])) as $P | delpaths($P)' > package-temp.json && mv package-temp.json package.json",
- "start": "npm run build -- --watch"
+ "start": "npm run build -- --watch",
+ "test:tsd": "tsd"
},
"localDependencies": {
"@msinternal/botframework-webchat-base": "development",
diff --git a/packages/bundle/src/boot/actual/component/full.ts b/packages/bundle/src/boot/actual/component/full.ts
new file mode 100644
index 0000000000..fd52a1f23b
--- /dev/null
+++ b/packages/bundle/src/boot/actual/component/full.ts
@@ -0,0 +1,18 @@
+export * from './minimal';
+
+// #region Adds
+export { default as AdaptiveCardContent } from '../../../adaptiveCards/Attachment/AdaptiveCardContent';
+export { default as AnimationCardContent } from '../../../adaptiveCards/Attachment/AnimationCardContent';
+export { default as AudioCardContent } from '../../../adaptiveCards/Attachment/AudioCardContent';
+export { default as HeroCardContent } from '../../../adaptiveCards/Attachment/HeroCardContent';
+export { default as OAuthCardContent } from '../../../adaptiveCards/Attachment/OAuthCardContent';
+export { default as ReceiptCardContent } from '../../../adaptiveCards/Attachment/ReceiptCardContent';
+export { default as SignInCardContent } from '../../../adaptiveCards/Attachment/SignInCardContent';
+export { default as ThumbnailCardContent } from '../../../adaptiveCards/Attachment/ThumbnailCardContent';
+export { default as VideoCardContent } from '../../../adaptiveCards/Attachment/VideoCardContent';
+export { default as ReactWebChat } from '../../../FullReactWebChat';
+// #endregion
+
+// #region Overrides
+export { default as Composer } from '../../../FullComposer';
+// #endregion
diff --git a/packages/bundle/src/boot/actual/component/minimal.ts b/packages/bundle/src/boot/actual/component/minimal.ts
new file mode 100644
index 0000000000..23abbd7585
--- /dev/null
+++ b/packages/bundle/src/boot/actual/component/minimal.ts
@@ -0,0 +1,38 @@
+export {
+ AccessKeySinkSurface,
+ AttachmentBar,
+ AudioContent,
+ Avatar,
+ BasicConnectivityStatus,
+ BasicSendBox,
+ BasicSendBoxToolbar,
+ BasicToaster,
+ BasicTranscript,
+ BasicWebChat,
+ Bubble,
+ Composer,
+ DictationInterims,
+ ErrorBox,
+ FileContent,
+ HTMLVideoContent,
+ ImageContent,
+ LocalizedString,
+ MicrophoneButton,
+ ReactWebChat,
+ SendButton,
+ SendStatus,
+ SendTextBox,
+ SpeakActivity,
+ SuggestedActions,
+ TextArea,
+ TextContent,
+ ThemeProvider,
+ Timestamp,
+ UploadButton,
+ VideoContent,
+ VimeoContent,
+ YouTubeContent,
+ type BasicWebChatProps,
+ type ComposerProps,
+ type ReactWebChatProps
+} from 'botframework-webchat-component/component';
diff --git a/packages/bundle/src/boot/actual/decorator.ts b/packages/bundle/src/boot/actual/decorator.ts
new file mode 100644
index 0000000000..f5a3ea2854
--- /dev/null
+++ b/packages/bundle/src/boot/actual/decorator.ts
@@ -0,0 +1,13 @@
+export {
+ ActivityBorderDecorator,
+ ActivityBorderDecoratorRequest,
+ ActivityGroupingDecorator,
+ createActivityBorderMiddleware,
+ createActivityGroupingMiddleware,
+ DecoratorComposer,
+ useDecoratorRequest,
+ type ActivityBorderDecoratorProps,
+ type DecoratorMiddleware,
+ type InferDecoratorRequest
+} from 'botframework-webchat-api/decorator';
+export { BorderFlair, BorderLoader, WebChatDecorator } from 'botframework-webchat-component/decorator';
diff --git a/packages/bundle/src/boot/actual/full-es5.ts b/packages/bundle/src/boot/actual/full-es5.ts
deleted file mode 100644
index e97ecb1b59..0000000000
--- a/packages/bundle/src/boot/actual/full-es5.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import defaultCreateDirectLine from '../../createDirectLine';
-import defaultCreateDirectLineAppServiceExtension from '../../createDirectLineAppServiceExtension';
-import buildInfo from '../../buildInfo';
-import ReactWebChat from './full';
-
-buildInfo.set('variant', 'full-es5');
-
-const createDirectLine = (options: Omit[0], 'botAgent'>) => {
- (options as any).botAgent &&
- console.warn(
- 'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
- );
-
- return defaultCreateDirectLine({ ...options, botAgent: `WebChat/${buildInfo.version} (ES5)` });
-};
-
-const createDirectLineAppServiceExtension = (
- options: Omit[0], 'botAgent'>
-) => {
- (options as any).botAgent &&
- console.warn(
- 'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
- );
-
- return defaultCreateDirectLineAppServiceExtension({ ...options, botAgent: `WebChat/${buildInfo.version} (ES5)` });
-};
-
-// #region Re-exports
-export * from './full';
-// #endregion
-
-// #region Local exports
-export default ReactWebChat;
-
-export { createDirectLine, createDirectLineAppServiceExtension };
-// #endregion
diff --git a/packages/bundle/src/boot/actual/full.ts b/packages/bundle/src/boot/actual/full.ts
index 3ef23bc76b..1331eaa374 100644
--- a/packages/bundle/src/boot/actual/full.ts
+++ b/packages/bundle/src/boot/actual/full.ts
@@ -1,110 +1,26 @@
-import Composer from '../../FullComposer';
-import ReactWebChat from '../../FullReactWebChat';
-import AdaptiveCardContent from '../../adaptiveCards/Attachment/AdaptiveCardContent';
-import AnimationCardContent from '../../adaptiveCards/Attachment/AnimationCardContent';
-import AudioCardContent from '../../adaptiveCards/Attachment/AudioCardContent';
-import HeroCardContent from '../../adaptiveCards/Attachment/HeroCardContent';
-import OAuthCardContent from '../../adaptiveCards/Attachment/OAuthCardContent';
-import ReceiptCardContent from '../../adaptiveCards/Attachment/ReceiptCardContent';
-import SignInCardContent from '../../adaptiveCards/Attachment/SignInCardContent';
-import ThumbnailCardContent from '../../adaptiveCards/Attachment/ThumbnailCardContent';
-import VideoCardContent from '../../adaptiveCards/Attachment/VideoCardContent';
-import useAdaptiveCardsHostConfig from '../../adaptiveCards/hooks/useAdaptiveCardsHostConfig';
-import useAdaptiveCardsPackage from '../../adaptiveCards/hooks/useAdaptiveCardsPackage';
+export * from './minimal';
+
+// #region Build info
import buildInfo from '../../buildInfo';
-import defaultCreateDirectLine from '../../createDirectLine';
-import defaultCreateDirectLineAppServiceExtension from '../../createDirectLineAppServiceExtension';
-import useStyleOptions from '../../hooks/useStyleOptions';
-import useStyleSet from '../../hooks/useStyleSet';
-import coreRenderWebChat from '../../renderWebChat';
-import { Components as minimalComponents, hooks as minimalHooks } from './minimal';
buildInfo.set('variant', 'full');
-const { object: buildInfoObject, version } = buildInfo;
-
-const renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);
-
-const createDirectLine = (options: Omit[0], 'botAgent'>) => {
- (options as any).botAgent &&
- console.warn(
- 'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
- );
-
- return defaultCreateDirectLine({ ...options, botAgent: `WebChat/${version} (Full)` });
-};
-
-const createDirectLineAppServiceExtension = (
- options: Omit[0], 'botAgent'>
-) => {
- (options as any).botAgent &&
- console.warn(
- 'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
- );
-
- return defaultCreateDirectLineAppServiceExtension({ ...options, botAgent: `WebChat/${version} (Full)` });
-};
-
-const hooks = Object.freeze({
- ...minimalHooks,
- useAdaptiveCardsHostConfig,
- useAdaptiveCardsPackage,
- useStyleOptions,
- useStyleSet
-});
+const { version } = buildInfo;
+// #endregion
-const Components = Object.freeze({
- ...minimalComponents,
- AdaptiveCardContent,
- AnimationCardContent,
- AudioCardContent,
- Composer,
- HeroCardContent,
- OAuthCardContent,
- ReactWebChat,
- ReceiptCardContent,
- SignInCardContent,
- ThumbnailCardContent,
- VideoCardContent
-} as const);
+// #region Overrides
+export { default as createStyleSet } from '../../createFullStyleSet';
+export { ReactWebChat } from './component/full';
+export { renderWebChat } from './renderWebChat/full';
+export { type StrictStyleOptions, type StyleOptions } from './styleOptions/full';
+export { version };
+// #endregion
-// #region Re-exports
+// #region Adds
export { default as createAdaptiveCardsAttachmentForScreenReaderMiddleware } from '../../adaptiveCards/createAdaptiveCardsAttachmentForScreenReaderMiddleware';
export { default as createAdaptiveCardsAttachmentMiddleware } from '../../adaptiveCards/createAdaptiveCardsAttachmentMiddleware';
export { default as createCognitiveServicesSpeechServicesPonyfillFactory } from '../../createCognitiveServicesSpeechServicesPonyfillFactory';
export { default as createDirectLineSpeechAdapters } from '../../createDirectLineSpeechAdapters';
-export { default as createStyleSet } from '../../createFullStyleSet';
export { default as renderMarkdown } from '../../markdown/renderMarkdown';
export { type AdaptiveCardsPackage } from '../../types/AdaptiveCardsPackage';
-export {
- type StrictFullBundleStyleOptions as StrictStyleOptions,
- type default as StyleOptions
-} from '../../types/FullBundleStyleOptions';
-export {
- concatMiddleware,
- Constants,
- createBrowserWebSpeechPonyfillFactory,
- createStore,
- createStoreWithDevTools,
- createStoreWithOptions,
- decorator,
- internal,
- testIds,
- withEmoji
-} from './minimal';
-// #endregion
-
-// #region Local exports
-export default ReactWebChat;
-
-export {
- buildInfoObject as buildInfo,
- Components,
- createDirectLine,
- createDirectLineAppServiceExtension,
- hooks,
- ReactWebChat,
- renderWebChat,
- version
-};
// #endregion
diff --git a/packages/bundle/src/boot/actual/hook/full.ts b/packages/bundle/src/boot/actual/hook/full.ts
new file mode 100644
index 0000000000..7d1e4517c4
--- /dev/null
+++ b/packages/bundle/src/boot/actual/hook/full.ts
@@ -0,0 +1,8 @@
+export * from './minimal';
+
+// #region Adds
+export { default as useAdaptiveCardsHostConfig } from '../../../adaptiveCards/hooks/useAdaptiveCardsHostConfig';
+export { default as useAdaptiveCardsPackage } from '../../../adaptiveCards/hooks/useAdaptiveCardsPackage';
+export { default as useStyleOptions } from '../../../hooks/useStyleOptions';
+export { default as useStyleSet } from '../../../hooks/useStyleSet';
+// #endregion
diff --git a/packages/bundle/src/boot/actual/hook/minimal.ts b/packages/bundle/src/boot/actual/hook/minimal.ts
new file mode 100644
index 0000000000..69eadf421d
--- /dev/null
+++ b/packages/bundle/src/boot/actual/hook/minimal.ts
@@ -0,0 +1,99 @@
+export {
+ useActiveTyping,
+ useActivities,
+ useActivityKeys,
+ useActivityKeysByRead,
+ useAvatarForBot,
+ useAvatarForUser,
+ useBuildRenderActivityCallback,
+ useByteFormatter,
+ useConnectivityStatus,
+ useCreateActivityRenderer,
+ useCreateActivityStatusRenderer,
+ useCreateAttachmentForScreenReaderRenderer,
+ useCreateAvatarRenderer,
+ useCreateScrollToEndButtonRenderer,
+ useDateFormatter,
+ useDebouncedNotifications,
+ useDictateAbortable,
+ useDictateInterims,
+ useDictateState,
+ useDirection,
+ useDisabled,
+ useDismissNotification,
+ useEmitTypingIndicator,
+ useFocus,
+ useGetActivitiesByKey,
+ useGetActivityByKey,
+ useGetHasAcknowledgedByActivityKey,
+ useGetKeyByActivity,
+ useGetKeyByActivityId,
+ useGetSendTimeoutForActivity,
+ useGrammars,
+ useGroupActivities,
+ useGroupActivitiesByName,
+ useGroupTimestamp,
+ useLanguage,
+ useLastAcknowledgedActivityKey,
+ useLastReadActivityKey,
+ useLocalizer,
+ useMakeThumbnail,
+ useMarkActivityAsSpoken,
+ useMarkActivityKeyAsRead,
+ useMarkAllAsAcknowledged,
+ useMicrophoneButtonClick,
+ useMicrophoneButtonDisabled,
+ useNotifications,
+ useObserveScrollPosition,
+ useObserveTranscriptFocus,
+ usePerformCardAction,
+ usePonyfill,
+ usePostActivity,
+ useReferenceGrammarID,
+ useRegisterFocusSendBox,
+ useRelativeTimeFormatter,
+ useRenderAttachment,
+ useRenderMarkdownAsHTML,
+ useRenderToast,
+ useRenderTypingIndicator,
+ useScrollDown,
+ useScrollTo,
+ useScrollToEnd,
+ useScrollUp,
+ useSendBoxAttachments,
+ useSendBoxSpeechInterimsVisible,
+ useSendBoxValue,
+ useSendEvent,
+ useSendFiles,
+ useSendMessage,
+ useSendMessageBack,
+ useSendPostBack,
+ useSendStatusByActivityKey,
+ useSendTimeoutForActivity,
+ useSendTypingIndicator,
+ useSetNotification,
+ useShouldReduceMotion,
+ useShouldSpeakIncomingActivity,
+ useStartDictate,
+ useStopDictate,
+ useStyleOptions,
+ useStyleSet,
+ useSubmitSendBox,
+ useSuggestedActions,
+ useSuggestedActionsHooks,
+ useTextBoxSubmit,
+ useTextBoxValue,
+ useTimeoutForSend,
+ useTrackDimension,
+ useTrackEvent,
+ useTrackException,
+ useTrackTiming,
+ useTransformHTMLContent,
+ useTypingIndicatorVisible,
+ useUIState,
+ useUserID,
+ useUsername,
+ useVoiceSelector,
+ useWebSpeechPonyfill,
+ type SendBoxFocusOptions
+} from 'botframework-webchat-component/hook';
diff --git a/packages/bundle/src/boot/actual/internal.ts b/packages/bundle/src/boot/actual/internal.ts
new file mode 100644
index 0000000000..b7e4cee777
--- /dev/null
+++ b/packages/bundle/src/boot/actual/internal.ts
@@ -0,0 +1,15 @@
+// We should review exports in this file to make sure 1P = 3P.
+export { type ActivityMiddleware, type TypingIndicatorMiddleware } from 'botframework-webchat-api';
+export {
+ CodeHighlighterComposer,
+ createIconComponent,
+ parseDocumentFragmentFromString,
+ PartGrouping,
+ ScreenReaderText,
+ serializeDocumentFragmentIntoString,
+ useCodeHighlighter,
+ useInjectStyles,
+ useLiveRegion,
+ type HighlightCodeFn
+} from 'botframework-webchat-component/internal';
+export { getOrgSchemaMessage, type DirectLineCardAction, type WebChatActivity } from 'botframework-webchat-core';
diff --git a/packages/bundle/src/boot/actual/minimal.ts b/packages/bundle/src/boot/actual/minimal.ts
index 015dc36085..b6f82d3ef0 100644
--- a/packages/bundle/src/boot/actual/minimal.ts
+++ b/packages/bundle/src/boot/actual/minimal.ts
@@ -1,69 +1,17 @@
-import * as apiDecorator from 'botframework-webchat-api/decorator';
-import ReactWebChat from 'botframework-webchat-component';
-import * as componentDecorator from 'botframework-webchat-component/decorator';
-import * as internal from 'botframework-webchat-component/internal';
-
import buildInfo from '../../buildInfo';
-import defaultCreateDirectLine from '../../createDirectLine';
-import defaultCreateDirectLineAppServiceExtension from '../../createDirectLineAppServiceExtension';
-import coreRenderWebChat from '../../renderWebChat';
+// #region Build info
buildInfo.set('variant', 'minimal');
const { object: buildInfoObject, version } = buildInfo;
+// #endregion
-const renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);
-
-const createDirectLine = (options: Omit[0], 'botAgent'>) => {
- (options as any).botAgent &&
- console.warn(
- 'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
- );
-
- return defaultCreateDirectLine({ ...options, botAgent: `WebChat/${version} (Minimal)` });
-};
-
-const createDirectLineAppServiceExtension = (
- options: Omit[0], 'botAgent'>
-) => {
- (options as any).botAgent &&
- console.warn(
- 'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
- );
-
- return defaultCreateDirectLineAppServiceExtension({ ...options, botAgent: `WebChat/${version} (Minimal)` });
-};
-
-const decorator = Object.freeze({
- ...apiDecorator,
- ...componentDecorator
-});
-
-// #region Re-exports
-export { type StrictStyleOptions, type StyleOptions } from 'botframework-webchat-api';
-export {
- Components,
- concatMiddleware,
- createStyleSet,
- hooks,
- testIds,
- withEmoji
-} from 'botframework-webchat-component';
+export { concatMiddleware, createStyleSet, testIds, withEmoji } from 'botframework-webchat-component';
export { Constants, createStore, createStoreWithDevTools, createStoreWithOptions } from 'botframework-webchat-core';
export { default as createBrowserWebSpeechPonyfillFactory } from '../../createBrowserWebSpeechPonyfillFactory';
-// #endregion
-
-// #region Local exports
-export default ReactWebChat;
-
-export {
- buildInfoObject as buildInfo,
- createDirectLine,
- createDirectLineAppServiceExtension,
- decorator,
- internal,
- ReactWebChat,
- renderWebChat,
- version
-};
-// #endregion
+export { ReactWebChat, type ReactWebChatProps } from './component/minimal';
+export { default as createDirectLine } from './private/createDirectLine';
+export { default as createDirectLineAppServiceExtension } from './private/createDirectLineAppServiceExtension';
+export { renderWebChat } from './renderWebChat/minimal';
+export { type StrictStyleOptions, type StyleOptions } from './styleOptions/minimal';
+export { buildInfoObject as buildInfo, version };
diff --git a/packages/bundle/src/boot/actual/private/createDirectLine.ts b/packages/bundle/src/boot/actual/private/createDirectLine.ts
new file mode 100644
index 0000000000..6725d1b832
--- /dev/null
+++ b/packages/bundle/src/boot/actual/private/createDirectLine.ts
@@ -0,0 +1,13 @@
+import buildInfo from '../../../buildInfo';
+import defaultCreateDirectLine from '../../../createDirectLine';
+import getBotAgent from './getBotAgent';
+
+export default function createDirectLine(options: Omit[0], 'botAgent'>) {
+ (options as any).botAgent &&
+ console.warn(
+ 'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
+ );
+
+ // TODO: Put the "botAgent" string in "define" could simplify code here..
+ return defaultCreateDirectLine({ ...options, botAgent: getBotAgent(buildInfo) });
+}
diff --git a/packages/bundle/src/boot/actual/private/createDirectLineAppServiceExtension.ts b/packages/bundle/src/boot/actual/private/createDirectLineAppServiceExtension.ts
new file mode 100644
index 0000000000..be3d09cf39
--- /dev/null
+++ b/packages/bundle/src/boot/actual/private/createDirectLineAppServiceExtension.ts
@@ -0,0 +1,14 @@
+import buildInfo from '../../../buildInfo';
+import defaultCreateDirectLineAppServiceExtension from '../../../createDirectLineAppServiceExtension';
+import getBotAgent from './getBotAgent';
+
+export default function createDirectLineAppServiceExtension(
+ options: Omit[0], 'botAgent'>
+) {
+ (options as any).botAgent &&
+ console.warn(
+ 'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
+ );
+
+ return defaultCreateDirectLineAppServiceExtension({ ...options, botAgent: getBotAgent(buildInfo) });
+}
diff --git a/packages/bundle/src/boot/actual/private/getBotAgent.ts b/packages/bundle/src/boot/actual/private/getBotAgent.ts
new file mode 100644
index 0000000000..041763fc98
--- /dev/null
+++ b/packages/bundle/src/boot/actual/private/getBotAgent.ts
@@ -0,0 +1,17 @@
+import { type ReadonlyBuildInfo } from '@msinternal/botframework-webchat-base/utils';
+
+export default function getBotAgent(buildInfo: ReadonlyBuildInfo): `WebChat/${string} (${string})` {
+ switch (buildInfo.get('variant')) {
+ case 'full':
+ return `WebChat/${buildInfo.version} (Full)`;
+
+ case 'full-es5':
+ return `WebChat/${buildInfo.version} (ES5)`;
+
+ case 'minimal':
+ return `WebChat/${buildInfo.version} (Minimal)`;
+
+ default:
+ return `WebChat/${buildInfo.version} (Unknown)`;
+ }
+}
diff --git a/packages/bundle/src/boot/actual/renderWebChat/full.ts b/packages/bundle/src/boot/actual/renderWebChat/full.ts
new file mode 100644
index 0000000000..03cfdbedea
--- /dev/null
+++ b/packages/bundle/src/boot/actual/renderWebChat/full.ts
@@ -0,0 +1,6 @@
+import coreRenderWebChat from '../../../renderWebChat';
+import { ReactWebChat } from '../component/full';
+
+const renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);
+
+export { renderWebChat };
diff --git a/packages/bundle/src/boot/actual/renderWebChat/minimal.ts b/packages/bundle/src/boot/actual/renderWebChat/minimal.ts
new file mode 100644
index 0000000000..e21586847c
--- /dev/null
+++ b/packages/bundle/src/boot/actual/renderWebChat/minimal.ts
@@ -0,0 +1,6 @@
+import coreRenderWebChat from '../../../renderWebChat';
+import { ReactWebChat } from '../component/minimal';
+
+const renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);
+
+export { renderWebChat };
diff --git a/packages/bundle/src/boot/actual/styleOptions/full.ts b/packages/bundle/src/boot/actual/styleOptions/full.ts
new file mode 100644
index 0000000000..252a100f64
--- /dev/null
+++ b/packages/bundle/src/boot/actual/styleOptions/full.ts
@@ -0,0 +1,4 @@
+export {
+ type StrictFullBundleStyleOptions as StrictStyleOptions,
+ type default as StyleOptions
+} from '../../../types/FullBundleStyleOptions';
diff --git a/packages/bundle/src/boot/actual/styleOptions/minimal.ts b/packages/bundle/src/boot/actual/styleOptions/minimal.ts
new file mode 100644
index 0000000000..baee6fdc1c
--- /dev/null
+++ b/packages/bundle/src/boot/actual/styleOptions/minimal.ts
@@ -0,0 +1 @@
+export { type StrictStyleOptions, type StyleOptions } from 'botframework-webchat-api';
diff --git a/packages/bundle/src/boot/bundle/full-es5.ts b/packages/bundle/src/boot/bundle/full-es5.ts
deleted file mode 100644
index 93582ad8c0..0000000000
--- a/packages/bundle/src/boot/bundle/full-es5.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-// Importing polyfills required for IE11/ES5.
-import './polyfill/es5';
-
-import buildInfo from '../../buildInfo';
-import * as actual from '../actual/full-es5';
-import * as middleware from '../actual/middleware';
-
-// Until we have a development-specific bundle, we are not shipping createStoreWithDevTools in bundle.
-const { createStoreWithDevTools: _createStoreWithDevTools, ...exports } = actual;
-
-window['WebChat'] = Object.freeze({
- ...window['WebChat'],
- ...exports,
- buildInfo: buildInfo.object,
- middleware
-});
diff --git a/packages/bundle/src/boot/exports/component.ts b/packages/bundle/src/boot/exports/component.ts
new file mode 100644
index 0000000000..e82ed79727
--- /dev/null
+++ b/packages/bundle/src/boot/exports/component.ts
@@ -0,0 +1 @@
+export * from '../actual/component/full';
diff --git a/packages/bundle/src/boot/exports/decorator.ts b/packages/bundle/src/boot/exports/decorator.ts
new file mode 100644
index 0000000000..0c659581dd
--- /dev/null
+++ b/packages/bundle/src/boot/exports/decorator.ts
@@ -0,0 +1 @@
+export * from '../actual/decorator';
diff --git a/packages/bundle/src/boot/exports/full-es5.ts b/packages/bundle/src/boot/exports/full-es5.ts
deleted file mode 100644
index 912914a4e9..0000000000
--- a/packages/bundle/src/boot/exports/full-es5.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import ReactWebChat from '../actual/full-es5';
-
-export * from '../actual/full-es5';
-export default ReactWebChat;
diff --git a/packages/bundle/src/boot/exports/full.ts b/packages/bundle/src/boot/exports/full.ts
deleted file mode 100644
index 4863d37d12..0000000000
--- a/packages/bundle/src/boot/exports/full.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import ReactWebChat from '../actual/full';
-
-export * from '../actual/full';
-export default ReactWebChat;
diff --git a/packages/bundle/src/boot/exports/hook.ts b/packages/bundle/src/boot/exports/hook.ts
new file mode 100644
index 0000000000..e2b1e978be
--- /dev/null
+++ b/packages/bundle/src/boot/exports/hook.ts
@@ -0,0 +1 @@
+export * from '../actual/hook/full';
diff --git a/packages/bundle/src/boot/exports/index.ts b/packages/bundle/src/boot/exports/index.ts
new file mode 100644
index 0000000000..1ff1426846
--- /dev/null
+++ b/packages/bundle/src/boot/exports/index.ts
@@ -0,0 +1,20 @@
+export * from './minimal';
+
+// #region Overrides
+export * from '../actual/full';
+export {
+ createStyleSet,
+ ReactWebChat as default,
+ ReactWebChat,
+ renderWebChat,
+ version,
+ type StrictStyleOptions,
+ type StyleOptions
+} from '../actual/full';
+// #endregion
+
+// #region Overrides for backward compatibility
+// Web devs should move to named exports instead.
+export * as Components from '../actual/component/full';
+export * as hooks from '../actual/hook/full';
+// #endregion
diff --git a/packages/bundle/src/boot/exports/internal.ts b/packages/bundle/src/boot/exports/internal.ts
index 213a4c7fd7..af61492c07 100644
--- a/packages/bundle/src/boot/exports/internal.ts
+++ b/packages/bundle/src/boot/exports/internal.ts
@@ -1,11 +1 @@
-// We should review exports in this file to make sure 1P = 3P.
-export { type ActivityMiddleware, type TypingIndicatorMiddleware } from 'botframework-webchat-api';
-export {
- createActivityBorderMiddleware,
- createActivityGroupingMiddleware,
- DecoratorComposer,
- type DecoratorMiddleware
-} from 'botframework-webchat-api/decorator';
-export { WebChatDecorator } from 'botframework-webchat-component/decorator';
-export { createIconComponent, PartGrouping, useLiveRegion } from 'botframework-webchat-component/internal';
-export { getOrgSchemaMessage, type DirectLineCardAction, type WebChatActivity } from 'botframework-webchat-core';
+export * from '../actual/internal';
diff --git a/packages/bundle/src/boot/exports/minimal.ts b/packages/bundle/src/boot/exports/minimal.ts
index 398be1341e..c0f67e7f6c 100644
--- a/packages/bundle/src/boot/exports/minimal.ts
+++ b/packages/bundle/src/boot/exports/minimal.ts
@@ -1,4 +1,10 @@
-import ReactWebChat from '../actual/minimal';
-
export * from '../actual/minimal';
-export default ReactWebChat;
+export { ReactWebChat as default } from '../actual/minimal'; // export * does not export default.
+
+// #region Backward compatibility
+// Web devs should move to named exports instead.
+export * as Components from '../actual/component/minimal';
+export * as decorator from '../actual/decorator';
+export * as hooks from '../actual/hook/minimal';
+export * as internal from '../actual/internal';
+// #endregion
diff --git a/packages/bundle/src/boot/bundle/polyfill/es5.ts b/packages/bundle/src/boot/iife/polyfill/es5.ts
similarity index 100%
rename from packages/bundle/src/boot/bundle/polyfill/es5.ts
rename to packages/bundle/src/boot/iife/polyfill/es5.ts
diff --git a/packages/bundle/src/boot/bundle/polyfill/modern.ts b/packages/bundle/src/boot/iife/polyfill/modern.ts
similarity index 100%
rename from packages/bundle/src/boot/bundle/polyfill/modern.ts
rename to packages/bundle/src/boot/iife/polyfill/modern.ts
diff --git a/packages/bundle/src/boot/iife/webchat-es5.ts b/packages/bundle/src/boot/iife/webchat-es5.ts
new file mode 100644
index 0000000000..d8f792cac6
--- /dev/null
+++ b/packages/bundle/src/boot/iife/webchat-es5.ts
@@ -0,0 +1,9 @@
+// Importing polyfills required for IE11/ES5.
+import './polyfill/es5';
+
+import buildInfo from '../../buildInfo';
+
+buildInfo.set('variant', 'full-es5');
+
+// "./full" is IIFE, just importing it will inject to globalThis.
+import './webchat';
diff --git a/packages/bundle/src/boot/bundle/minimal.ts b/packages/bundle/src/boot/iife/webchat-minimal.ts
similarity index 56%
rename from packages/bundle/src/boot/bundle/minimal.ts
rename to packages/bundle/src/boot/iife/webchat-minimal.ts
index 52806ba83b..8a0bcc683e 100644
--- a/packages/bundle/src/boot/bundle/minimal.ts
+++ b/packages/bundle/src/boot/iife/webchat-minimal.ts
@@ -1,13 +1,11 @@
-import buildInfo from '../../buildInfo';
-import * as middleware from '../actual/middleware';
-import * as actual from '../actual/minimal.js';
+import * as actual from '../exports/minimal';
+import * as middleware from '../exports/middleware';
// Until we have a development-specific bundle, we are not shipping createStoreWithDevTools in bundle.
const { createStoreWithDevTools: _createStoreWithDevTools, ...exports } = actual;
window['WebChat'] = Object.freeze({
- ...window['WebChat'],
+ ...window['WebChat'], // Should be undefined, but just in case.
...exports,
- buildInfo: buildInfo.object,
middleware
});
diff --git a/packages/bundle/src/boot/bundle/full.ts b/packages/bundle/src/boot/iife/webchat.ts
similarity index 53%
rename from packages/bundle/src/boot/bundle/full.ts
rename to packages/bundle/src/boot/iife/webchat.ts
index 1283e97e9e..f973961003 100644
--- a/packages/bundle/src/boot/bundle/full.ts
+++ b/packages/bundle/src/boot/iife/webchat.ts
@@ -1,15 +1,11 @@
-import './polyfill/modern';
-
-import buildInfo from '../../buildInfo';
-import * as actual from '../actual/full';
-import * as middleware from '../actual/middleware';
+import * as actual from '../exports/index';
+import * as middleware from '../exports/middleware';
// Until we have a development-specific bundle, we are not shipping createStoreWithDevTools in bundle.
const { createStoreWithDevTools: _createStoreWithDevTools, ...exports } = actual;
window['WebChat'] = Object.freeze({
- ...window['WebChat'],
+ ...window['WebChat'], // Should be undefined, but just in case.
...exports,
- buildInfo: buildInfo.object,
middleware
});
diff --git a/packages/bundle/test-d/fail-once/create-direct-line-invalid-bot-agent.test-d.tsx b/packages/bundle/test-d/fail-once/create-direct-line-invalid-bot-agent.test-d.tsx
index 41356f9fa1..086f0fb11f 100644
--- a/packages/bundle/test-d/fail-once/create-direct-line-invalid-bot-agent.test-d.tsx
+++ b/packages/bundle/test-d/fail-once/create-direct-line-invalid-bot-agent.test-d.tsx
@@ -2,7 +2,7 @@ import '../setup';
import { expectNotAssignable } from 'tsd';
-import { createDirectLine } from '../../src/boot/exports/full';
+import { createDirectLine } from '../../src/boot/exports/index';
// "botAgent" is a forbidden option.
type CreateDirectLineInit = Parameters[0];
diff --git a/packages/bundle/test-d/fail-once/create-direct-line-invalid-option.test-d.tsx b/packages/bundle/test-d/fail-once/create-direct-line-invalid-option.test-d.tsx
index 16ad436c62..73be21a37d 100644
--- a/packages/bundle/test-d/fail-once/create-direct-line-invalid-option.test-d.tsx
+++ b/packages/bundle/test-d/fail-once/create-direct-line-invalid-option.test-d.tsx
@@ -2,7 +2,7 @@ import '../setup';
import { expectNotAssignable } from 'tsd';
-import { createDirectLine } from '../../src/boot/exports/full';
+import { createDirectLine } from '../../src/boot/exports/index';
type CreateDirectLineInit = Parameters[0];
diff --git a/packages/bundle/test-d/fail-once/invalid-prop-type-dir.test-d.tsx b/packages/bundle/test-d/fail-once/invalid-prop-type-dir.test-d.tsx
index ade2151bd3..3ecd473e67 100644
--- a/packages/bundle/test-d/fail-once/invalid-prop-type-dir.test-d.tsx
+++ b/packages/bundle/test-d/fail-once/invalid-prop-type-dir.test-d.tsx
@@ -3,7 +3,7 @@ import '../setup';
import { type ComponentType } from 'react';
import { expectNotAssignable } from 'tsd';
-import ReactWebChat from '../../src/boot/exports/full';
+import ReactWebChat from '../../src/boot/exports/index';
type PropsOf = T extends ComponentType ? P : never;
diff --git a/packages/bundle/test-d/fail-once/invalid-style-options-suggested-actions-stacked-overflow.test-d.ts b/packages/bundle/test-d/fail-once/invalid-style-options-suggested-actions-stacked-overflow.test-d.ts
index 4d03d6e534..18ed6f69ec 100644
--- a/packages/bundle/test-d/fail-once/invalid-style-options-suggested-actions-stacked-overflow.test-d.ts
+++ b/packages/bundle/test-d/fail-once/invalid-style-options-suggested-actions-stacked-overflow.test-d.ts
@@ -2,7 +2,7 @@ import '../setup';
import { expectNotAssignable } from 'tsd';
-import { createStyleSet } from '../../src/boot/exports/full';
+import { createStyleSet } from '../../src/boot/exports/index';
type CreateStyleSetInit = Parameters[0];
diff --git a/packages/bundle/test-d/fail-once/invalid-type-for-use-style-options.test-d.tsx b/packages/bundle/test-d/fail-once/invalid-type-for-use-style-options.test-d.tsx
index da5dcbcac6..1ee3f85b58 100644
--- a/packages/bundle/test-d/fail-once/invalid-type-for-use-style-options.test-d.tsx
+++ b/packages/bundle/test-d/fail-once/invalid-type-for-use-style-options.test-d.tsx
@@ -2,7 +2,7 @@ import '../setup';
import { expectNotAssignable } from 'tsd';
-import { hooks } from '../../src/boot/exports/full';
+import { hooks } from '../../src/boot/exports/index';
const [_styleOptions] = hooks.useStyleOptions();
diff --git a/packages/bundle/test-d/fail-once/no-children-for-react-web-chat-in-minimal.test-d.tsx b/packages/bundle/test-d/fail-once/no-children-for-react-web-chat-in-minimal.test-d.tsx
deleted file mode 100644
index 8b4bf6ad31..0000000000
--- a/packages/bundle/test-d/fail-once/no-children-for-react-web-chat-in-minimal.test-d.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import '../setup';
-
-import { expectNotAssignable } from 'tsd';
-
-import React, { type ComponentType } from 'react';
-
-import ReactWebChat from '../../src/boot/exports/full';
-
-type PropsOf = T extends ComponentType ? P : never;
-
-type Props = PropsOf;
-
-// should not contains any children.
-
-expectNotAssignable({ children:
{'Hello, World'}
, directLine: undefined });
-
-// Equivalent to:
-//
-//
Hello, World
-// ;
diff --git a/packages/bundle/test-d/fail-once/no-children-for-react-web-chat.test-d.tsx b/packages/bundle/test-d/fail-once/no-children-for-react-web-chat.test-d.tsx
index 8b4bf6ad31..6231d5c5f0 100644
--- a/packages/bundle/test-d/fail-once/no-children-for-react-web-chat.test-d.tsx
+++ b/packages/bundle/test-d/fail-once/no-children-for-react-web-chat.test-d.tsx
@@ -4,7 +4,7 @@ import { expectNotAssignable } from 'tsd';
import React, { type ComponentType } from 'react';
-import ReactWebChat from '../../src/boot/exports/full';
+import ReactWebChat from '../../src/boot/exports/index';
type PropsOf = T extends ComponentType ? P : never;
diff --git a/packages/bundle/test-d/fail-once/no-full-bundle-style-options-in-minimal-for-hooks.test-d.ts b/packages/bundle/test-d/fail-once/no-full-bundle-style-options-in-minimal-for-hooks.test-d.ts
deleted file mode 100644
index f85cc5549d..0000000000
--- a/packages/bundle/test-d/fail-once/no-full-bundle-style-options-in-minimal-for-hooks.test-d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import '../setup';
-
-import { expectNotAssignable } from 'tsd';
-
-import { hooks } from '../../src/boot/exports/minimal';
-
-type StyleOptions = ReturnType[0];
-
-// const [styleOptions] = hooks.useStyleOptions();
-
-expectNotAssignable({ cardEmphasisBackgroundColor: 'black' });
-
-// Equivalent to: styleOptions.cardEmphasisBackgroundColor = 'black';
diff --git a/packages/bundle/test-d/fail-once/no-full-bundle-style-options-in-minimal.test-d.ts b/packages/bundle/test-d/fail-once/no-full-bundle-style-options-in-minimal.test-d.ts
deleted file mode 100644
index 46a6180aa6..0000000000
--- a/packages/bundle/test-d/fail-once/no-full-bundle-style-options-in-minimal.test-d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import '../setup';
-
-import { expectNotAssignable } from 'tsd';
-
-import { createStyleSet } from '../../src/boot/exports/minimal';
-
-type CreateStyleSetInit = Parameters[0];
-
-// "cardEmphasisBackgroundColor" is a style options only available in full bundle.
-
-expectNotAssignable({ cardEmphasisBackgroundColor: 'orange' });
-
-// Equivalent to: createStyleSet({ cardEmphasisBackgroundColor: 'orange' });
diff --git a/packages/bundle/test-d/pass/additional-style-options-in-full.test-d.ts b/packages/bundle/test-d/pass/additional-style-options-in-full.test-d.ts
index c2d019668f..88ceb7ef95 100644
--- a/packages/bundle/test-d/pass/additional-style-options-in-full.test-d.ts
+++ b/packages/bundle/test-d/pass/additional-style-options-in-full.test-d.ts
@@ -1,5 +1,5 @@
import '../setup';
-import { createStyleSet } from '../../src/boot/exports/full';
+import { createStyleSet } from '../../src/boot/exports/index';
createStyleSet({ cardEmphasisBackgroundColor: 'orange' });
diff --git a/packages/bundle/test-d/pass/composition-with-store.test-d.tsx b/packages/bundle/test-d/pass/composition-with-store.test-d.tsx
index b23bfd463d..819a0bfbc1 100644
--- a/packages/bundle/test-d/pass/composition-with-store.test-d.tsx
+++ b/packages/bundle/test-d/pass/composition-with-store.test-d.tsx
@@ -3,7 +3,7 @@ import '../setup';
import React from 'react';
import ReactDOM from 'react-dom';
-import { Components, createStore } from '../../src/boot/exports/full';
+import { Components, createStore } from '../../src/boot/exports/index';
const { BasicWebChat, Composer } = Components;
diff --git a/packages/bundle/test-d/pass/correct-type-dir.test-d.tsx b/packages/bundle/test-d/pass/correct-type-dir.test-d.tsx
index 4e42ed0f1f..bcf37b5430 100644
--- a/packages/bundle/test-d/pass/correct-type-dir.test-d.tsx
+++ b/packages/bundle/test-d/pass/correct-type-dir.test-d.tsx
@@ -2,7 +2,7 @@ import '../setup';
import React from 'react';
-import ReactWebChat from '../../src/boot/exports/full';
+import ReactWebChat from '../../src/boot/exports/index';
// eslint-disable-next-line react/jsx-indent
;
diff --git a/packages/bundle/test-d/pass/import-component-send-text-box.test-d.tsx b/packages/bundle/test-d/pass/import-component-send-text-box.test-d.tsx
index a310f3f229..32dace4ce3 100644
--- a/packages/bundle/test-d/pass/import-component-send-text-box.test-d.tsx
+++ b/packages/bundle/test-d/pass/import-component-send-text-box.test-d.tsx
@@ -2,7 +2,7 @@ import '../setup';
import React from 'react';
-import { Components } from '../../src/boot/exports/full';
+import { Components } from '../../src/boot/exports/index';
const { SendTextBox } = Components;
diff --git a/packages/bundle/test-d/pass/import-create-direct-line.test-d.tsx b/packages/bundle/test-d/pass/import-create-direct-line.test-d.tsx
index 1bd321c4fb..8a5f9277f2 100644
--- a/packages/bundle/test-d/pass/import-create-direct-line.test-d.tsx
+++ b/packages/bundle/test-d/pass/import-create-direct-line.test-d.tsx
@@ -1,5 +1,5 @@
import '../setup';
-import { createDirectLine } from '../../src/boot/exports/full';
+import { createDirectLine } from '../../src/boot/exports/index';
createDirectLine({ token: 'faketoken' });
diff --git a/packages/bundle/test-d/pass/render-with-minimal-bundle.test-d.tsx b/packages/bundle/test-d/pass/render-with-minimal-bundle.test-d.tsx
deleted file mode 100644
index 96ffcdec21..0000000000
--- a/packages/bundle/test-d/pass/render-with-minimal-bundle.test-d.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import '../setup';
-
-import React from 'react';
-import ReactDOM from 'react-dom';
-
-import ReactWebChat, { createDirectLine } from '../../src/boot/exports/minimal';
-
-const directLine = createDirectLine({ token: '...' });
-const styleOptions = { accent: 'black' };
-
-ReactDOM.render(, document.getElementById('app'));
diff --git a/packages/bundle/test-d/pass/render-with-store.test-d.tsx b/packages/bundle/test-d/pass/render-with-store.test-d.tsx
index b50a77822d..427aeb825a 100644
--- a/packages/bundle/test-d/pass/render-with-store.test-d.tsx
+++ b/packages/bundle/test-d/pass/render-with-store.test-d.tsx
@@ -3,7 +3,7 @@ import '../setup';
import React from 'react';
import ReactDOM from 'react-dom';
-import { Components, createStore } from '../../src/boot/exports/full';
+import { Components, createStore } from '../../src/boot/exports/index';
const { Composer } = Components;
diff --git a/packages/bundle/test-d/pass/render-with-style-options.test-d.tsx b/packages/bundle/test-d/pass/render-with-style-options.test-d.tsx
index 11e3f8bf31..1e94d8386f 100644
--- a/packages/bundle/test-d/pass/render-with-style-options.test-d.tsx
+++ b/packages/bundle/test-d/pass/render-with-style-options.test-d.tsx
@@ -3,7 +3,7 @@ import '../setup';
import React from 'react';
import ReactDOM from 'react-dom';
-import ReactWebChat, { createDirectLine } from '../../src/boot/exports/full';
+import ReactWebChat, { createDirectLine } from '../../src/boot/exports/index';
const directLine = createDirectLine({ token: '...' });
const styleOptions = { accent: 'black', cardEmphasisBackgroundColor: 'orange' };
diff --git a/packages/bundle/test-d/pass/render-with-style-set.test-d.tsx b/packages/bundle/test-d/pass/render-with-style-set.test-d.tsx
index cacf53c4a6..aebc662bdf 100644
--- a/packages/bundle/test-d/pass/render-with-style-set.test-d.tsx
+++ b/packages/bundle/test-d/pass/render-with-style-set.test-d.tsx
@@ -3,7 +3,7 @@ import '../setup';
import React from 'react';
import ReactDOM from 'react-dom';
-import ReactWebChat, { createDirectLine, createStyleSet } from '../../src/boot/exports/minimal';
+import ReactWebChat, { createDirectLine, createStyleSet } from '../../src/boot/exports/index';
const directLine = createDirectLine({ token: '...' });
const styleOptions = { accent: 'black', cardEmphasisBackgroundColor: 'orange' };
diff --git a/packages/bundle/test-d/pass/render.test-d.tsx b/packages/bundle/test-d/pass/render.test-d.tsx
index de1dcb8f21..113628483a 100644
--- a/packages/bundle/test-d/pass/render.test-d.tsx
+++ b/packages/bundle/test-d/pass/render.test-d.tsx
@@ -3,7 +3,7 @@ import '../setup';
import React from 'react';
import ReactDOM from 'react-dom';
-import ReactWebChat, { createDirectLine } from '../../src/boot/exports/full';
+import ReactWebChat, { createDirectLine } from '../../src/boot/exports/index';
const directLine = createDirectLine({ token: '...' });
diff --git a/packages/bundle/test-d/pass/use-style-options-with-full-bundle.test-d.ts b/packages/bundle/test-d/pass/use-style-options-with-full-bundle.test-d.ts
index 788da9fe86..c69246eecb 100644
--- a/packages/bundle/test-d/pass/use-style-options-with-full-bundle.test-d.ts
+++ b/packages/bundle/test-d/pass/use-style-options-with-full-bundle.test-d.ts
@@ -1,6 +1,6 @@
import '../setup';
-import { hooks } from '../../src/boot/exports/full';
+import { hooks } from '../../src/boot/exports/index';
const [styleOptions] = hooks.useStyleOptions();
diff --git a/packages/bundle/test-d/pass/valid-style-options-suggested-actions-stacked-overflow.test-d.ts b/packages/bundle/test-d/pass/valid-style-options-suggested-actions-stacked-overflow.test-d.ts
index e004e2f834..e515120de0 100644
--- a/packages/bundle/test-d/pass/valid-style-options-suggested-actions-stacked-overflow.test-d.ts
+++ b/packages/bundle/test-d/pass/valid-style-options-suggested-actions-stacked-overflow.test-d.ts
@@ -1,6 +1,6 @@
import '../setup';
-import { createStyleSet } from '../../src/boot/exports/full';
+import { createStyleSet } from '../../src/boot/exports/index';
// Related to #4081.
createStyleSet({ suggestedActionsStackedOverflow: 'auto' });
diff --git a/packages/bundle/tsup.config.ts b/packages/bundle/tsup.config.ts
index e4df8df913..63662ab046 100644
--- a/packages/bundle/tsup.config.ts
+++ b/packages/bundle/tsup.config.ts
@@ -3,19 +3,6 @@ import { defineConfig } from 'tsup';
import { applyConfig } from '../../tsup.base.config';
-// Redirect import paths for "microsoft-cognitiveservices-speech-sdk(...)"
-// to point to es2015 distribution for all importing modules
-const resolveCognitiveServicesToES2015 = {
- name: 'microsoft-cognitiveservices-speech-sdk',
- setup(build) {
- // ESBuild use Go regular expressions and does not understand Unicode flag.
- // eslint-disable-next-line require-unicode-regexp
- build.onResolve({ filter: /microsoft-cognitiveservices-speech-sdk.+/ }, args => ({
- path: path.join(process.cwd(), '../../node_modules', args.path.replace('distrib/lib', 'distrib/es2015'))
- }));
- }
-};
-
// Redirect import paths for "react" and "react-dom"
const resolveReact = {
name: 'isomorphic-react',
@@ -31,11 +18,12 @@ const resolveReact = {
const commonConfig = applyConfig(config => ({
...config,
entry: {
- 'botframework-webchat': './src/boot/exports/full.ts',
- 'botframework-webchat.es5': './src/boot/exports/full-es5.ts',
+ 'botframework-webchat': './src/boot/exports/index.ts',
+ 'botframework-webchat.component': './src/boot/exports/component.ts',
+ 'botframework-webchat.decorator': './src/boot/exports/decorator.ts',
+ 'botframework-webchat.hook': './src/boot/exports/hook.ts',
'botframework-webchat.internal': './src/boot/exports/internal.ts',
- 'botframework-webchat.middleware': './src/boot/exports/middleware.ts',
- 'botframework-webchat.minimal': './src/boot/exports/minimal.ts'
+ 'botframework-webchat.middleware': './src/boot/exports/middleware.ts'
},
env: {
...config.env,
@@ -44,7 +32,6 @@ const commonConfig = applyConfig(config => ({
SPEECH_CONDUCT_OCSP_CHECK: '',
SPEECH_OCSP_CACHE_ROOT: ''
},
- esbuildPlugins: [...(config.esbuildPlugins ?? []), resolveCognitiveServicesToES2015],
noExternal: [
...(config.noExternal ?? []),
'@babel/runtime',
@@ -71,9 +58,9 @@ export default defineConfig([
},
dts: false,
entry: {
- webchat: './src/boot/bundle/full.ts',
- 'webchat-es5': './src/boot/bundle/full-es5.ts',
- 'webchat-minimal': './src/boot/bundle/minimal.ts'
+ webchat: './src/boot/iife/webchat.ts',
+ 'webchat-es5': './src/boot/iife/webchat-es5.ts',
+ 'webchat-minimal': './src/boot/iife/webchat-minimal.ts'
},
esbuildPlugins: [...(commonConfig.esbuildPlugins ?? []), resolveReact],
format: 'iife',
diff --git a/packages/component/component.js b/packages/component/component.js
new file mode 100644
index 0000000000..e482d8faae
--- /dev/null
+++ b/packages/component/component.js
@@ -0,0 +1,3 @@
+// This is required for Webpack 4 which does not support named exports.
+// eslint-disable-next-line no-undef
+module.exports = require('./dist/botframework-webchat-component.component.js');
diff --git a/packages/component/hook.js b/packages/component/hook.js
new file mode 100644
index 0000000000..05feeba281
--- /dev/null
+++ b/packages/component/hook.js
@@ -0,0 +1,3 @@
+// This is required for Webpack 4 which does not support named exports.
+// eslint-disable-next-line no-undef
+module.exports = require('./dist/botframework-webchat-component.hook.js');
diff --git a/packages/component/package.json b/packages/component/package.json
index f6d2535cf7..9e0772ebb3 100644
--- a/packages/component/package.json
+++ b/packages/component/package.json
@@ -15,14 +15,14 @@
"default": "./dist/botframework-webchat-component.js"
}
},
- "./internal": {
+ "./component": {
"import": {
- "types": "./dist/botframework-webchat-component.internal.d.mts",
- "default": "./dist/botframework-webchat-component.internal.mjs"
+ "types": "./dist/botframework-webchat-component.component.d.mts",
+ "default": "./dist/botframework-webchat-component.component.mjs"
},
"require": {
- "types": "./dist/botframework-webchat-component.internal.d.ts",
- "default": "./dist/botframework-webchat-component.internal.js"
+ "types": "./dist/botframework-webchat-component.component.d.ts",
+ "default": "./dist/botframework-webchat-component.component.js"
}
},
"./decorator": {
@@ -34,6 +34,26 @@
"types": "./dist/botframework-webchat-component.decorator.d.ts",
"default": "./dist/botframework-webchat-component.decorator.js"
}
+ },
+ "./hook": {
+ "import": {
+ "types": "./dist/botframework-webchat-component.hook.d.mts",
+ "default": "./dist/botframework-webchat-component.hook.mjs"
+ },
+ "require": {
+ "types": "./dist/botframework-webchat-component.hook.d.ts",
+ "default": "./dist/botframework-webchat-component.hook.js"
+ }
+ },
+ "./internal": {
+ "import": {
+ "types": "./dist/botframework-webchat-component.internal.d.mts",
+ "default": "./dist/botframework-webchat-component.internal.mjs"
+ },
+ "require": {
+ "types": "./dist/botframework-webchat-component.internal.d.ts",
+ "default": "./dist/botframework-webchat-component.internal.js"
+ }
}
},
"publishConfig": {
@@ -49,8 +69,8 @@
"url": "https://github.com/microsoft/BotFramework-WebChat/issues"
},
"files": [
- "./dist/**/*",
"./*.js",
+ "./dist/**/*",
"./src/**/*"
],
"homepage": "https://github.com/microsoft/BotFramework-WebChat/tree/main/packages/component#readme",
diff --git a/packages/component/src/ActivityStatus/AbsoluteTime.js b/packages/component/src/ActivityStatus/AbsoluteTime.js
deleted file mode 100644
index d979dc706c..0000000000
--- a/packages/component/src/ActivityStatus/AbsoluteTime.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import { hooks } from 'botframework-webchat-api';
-import PropTypes from 'prop-types';
-import React, { Fragment } from 'react';
-
-import ScreenReaderText from '../ScreenReaderText';
-
-const { useDateFormatter, useLocalizer } = hooks;
-
-const AbsoluteTime = ({ hide, value }) => {
- const localize = useLocalizer();
- const formatDate = useDateFormatter();
-
- const absoluteTime = formatDate(value);
-
- return (
-
-
- {!hide && {absoluteTime}}
-
- );
-};
-
-AbsoluteTime.defaultProps = {
- hide: false
-};
-
-AbsoluteTime.propTypes = {
- hide: PropTypes.bool,
- value: PropTypes.string.isRequired
-};
-
-export default AbsoluteTime;
diff --git a/packages/component/src/ActivityStatus/AbsoluteTime.tsx b/packages/component/src/ActivityStatus/AbsoluteTime.tsx
new file mode 100644
index 0000000000..be314ffc96
--- /dev/null
+++ b/packages/component/src/ActivityStatus/AbsoluteTime.tsx
@@ -0,0 +1,37 @@
+import { validateProps } from '@msinternal/botframework-webchat-react-valibot';
+import { hooks } from 'botframework-webchat-api';
+import React, { Fragment } from 'react';
+import { boolean, date, number, object, optional, pipe, readonly, string, union, type InferInput } from 'valibot';
+
+import ScreenReaderText from '../ScreenReaderText';
+
+const { useDateFormatter, useLocalizer } = hooks;
+
+const absoluteTimePropsSchema = pipe(
+ object({
+ hide: optional(boolean(), false),
+ value: union([date(), number(), string()])
+ }),
+ readonly()
+);
+
+type AbsoluteTimeProps = InferInput;
+
+const AbsoluteTime = (props: AbsoluteTimeProps) => {
+ const { hide, value } = validateProps(absoluteTimePropsSchema, props);
+
+ const localize = useLocalizer();
+ const formatDate = useDateFormatter();
+
+ const absoluteTime = formatDate(value);
+
+ return (
+
+
+ {!hide && {absoluteTime}}
+
+ );
+};
+
+export default AbsoluteTime;
+export { absoluteTimePropsSchema, type AbsoluteTimeProps };
diff --git a/packages/component/src/ActivityStatus/private/RelativeTime.js b/packages/component/src/ActivityStatus/private/RelativeTime.js
deleted file mode 100644
index 665b648632..0000000000
--- a/packages/component/src/ActivityStatus/private/RelativeTime.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import { hooks } from 'botframework-webchat-api';
-import PropTypes from 'prop-types';
-import React, { Fragment } from 'react';
-
-import ScreenReaderText from '../../ScreenReaderText';
-import useForceRenderAtInterval from '../../hooks/internal/useForceRenderAtInterval';
-
-const { useDateFormatter, useLocalizer, useRelativeTimeFormatter } = hooks;
-
-const TIMER_INTERVAL = 60000;
-
-const RelativeTime = ({ value }) => {
- const formatDate = useDateFormatter();
- const formatRelativeTime = useRelativeTimeFormatter();
- const localize = useLocalizer();
-
- useForceRenderAtInterval(value, TIMER_INTERVAL);
-
- return (
-
-
- {formatRelativeTime(value)}
-
- );
-};
-
-RelativeTime.propTypes = {
- value: PropTypes.string.isRequired
-};
-
-export default RelativeTime;
diff --git a/packages/component/src/ActivityStatus/private/RelativeTime.tsx b/packages/component/src/ActivityStatus/private/RelativeTime.tsx
new file mode 100644
index 0000000000..640bcc80b1
--- /dev/null
+++ b/packages/component/src/ActivityStatus/private/RelativeTime.tsx
@@ -0,0 +1,43 @@
+import { validateProps } from '@msinternal/botframework-webchat-react-valibot';
+import { hooks } from 'botframework-webchat-api';
+import React, { Fragment } from 'react';
+import { date, number, object, pipe, readonly, string, union, type InferInput } from 'valibot';
+
+import ScreenReaderText from '../../ScreenReaderText';
+import useForceRenderAtInterval from '../../hooks/internal/useForceRenderAtInterval';
+
+const { useDateFormatter, useLocalizer, usePonyfill, useRelativeTimeFormatter } = hooks;
+
+const TIMER_INTERVAL = 60000;
+
+const relativeTimePropsSchema = pipe(
+ object({
+ value: union([date(), number(), string()])
+ }),
+ readonly()
+);
+
+type RelativeTimeProps = InferInput;
+
+const RelativeTime = (props: RelativeTimeProps) => {
+ const { value } = validateProps(relativeTimePropsSchema, props);
+
+ const [{ Date }] = usePonyfill();
+ const formatDate = useDateFormatter();
+ const formatRelativeTime = useRelativeTimeFormatter();
+ const localize = useLocalizer();
+
+ const dateValue = new Date(value);
+
+ useForceRenderAtInterval(dateValue, TIMER_INTERVAL);
+
+ return (
+
+
+ {formatRelativeTime(dateValue)}
+
+ );
+};
+
+export default RelativeTime;
+export { relativeTimePropsSchema, type RelativeTimeProps };
diff --git a/packages/component/src/BasicConnectivityStatus.js b/packages/component/src/BasicConnectivityStatus.js
index 2cf4e3da5d..91080897f4 100644
--- a/packages/component/src/BasicConnectivityStatus.js
+++ b/packages/component/src/BasicConnectivityStatus.js
@@ -8,29 +8,29 @@ import ConnectivityStatusJavaScriptError from './ConnectivityStatus/JavaScriptEr
const { useDebouncedNotifications } = hooks;
-const BasicConnectivityStatus = () => {
+const BasicConnectivityStatus = ({ className }) => {
const [{ connectivitystatus: connectivityStatus }] = useDebouncedNotifications();
if (!connectivityStatus) {
- return false;
+ return null;
}
switch (connectivityStatus.message) {
case 'connecting':
- return ;
+ return ;
case 'javascripterror':
- return ;
+ return ;
case 'failedtoconnect':
- return ;
+ return ;
case 'reconnecting':
- return ;
+ return ;
case 'connected':
default:
- return ;
+ return ;
}
};
diff --git a/packages/component/src/BasicToaster.js b/packages/component/src/BasicToaster.js
index 90ecb8db3b..910a60b826 100644
--- a/packages/component/src/BasicToaster.js
+++ b/packages/component/src/BasicToaster.js
@@ -70,7 +70,7 @@ const TOAST_ACCORDION_IDS = {
other: 'TOAST_ACCORDION_OTHER'
};
-const BasicToaster = () => {
+const BasicToaster = ({ className }) => {
const instanceId = useMemo(randomId, []);
const [{ toaster: toasterStyleSet }] = useStyleSet();
const [debouncedNotifications] = useDebouncedNotifications();
@@ -157,7 +157,8 @@ const BasicToaster = () => {
'webchat__toaster--warn': highestLevel === 'warn'
},
rootClassName,
- toasterStyleSet + ''
+ toasterStyleSet + '',
+ className
)}
role="log"
>
diff --git a/packages/component/src/Styles/useCustomPropertiesClassName.ts b/packages/component/src/Styles/useCustomPropertiesClassName.ts
index 46c31005e5..5042464c4d 100644
--- a/packages/component/src/Styles/useCustomPropertiesClassName.ts
+++ b/packages/component/src/Styles/useCustomPropertiesClassName.ts
@@ -12,7 +12,7 @@ const webchatCustomPropertiesClass = 'webchat__css-custom-properties';
export default function useCustomPropertiesClassName() {
const [styleOptions] = useStyleOptions();
- const nonce = useNonce();
+ const [nonce] = useNonce();
const [styles, classNameState] = useMemo(() => {
const {
diff --git a/packages/component/src/boot/component.ts b/packages/component/src/boot/component.ts
new file mode 100644
index 0000000000..4f94cebe6c
--- /dev/null
+++ b/packages/component/src/boot/component.ts
@@ -0,0 +1,45 @@
+export { default as Composer, type ComposerProps } from '../Composer';
+export { default as ReactWebChat, type ReactWebChatProps } from '../ReactWebChat';
+
+// Components for restructuring BasicWebChat
+export { default as BasicConnectivityStatus } from '../BasicConnectivityStatus';
+export { default as BasicToaster } from '../BasicToaster';
+export { default as BasicTranscript } from '../BasicTranscript';
+export { default as BasicWebChat, type BasicWebChatProps } from '../BasicWebChat';
+export { default as BasicSendBox } from '../SendBox/BasicSendBox';
+export { default as BasicSendBoxToolbar } from '../SendBoxToolbar/BasicSendBoxToolbar';
+export { default as AccessKeySinkSurface } from '../Utils/AccessKeySink/Surface';
+
+// Components for recomposing activities and attachments
+export { default as AudioContent } from '../Attachment/AudioContent';
+export { default as FileContent } from '../Attachment/FileContent';
+export { default as HTMLVideoContent } from '../Attachment/HTMLVideoContent';
+export { default as ImageContent } from '../Attachment/ImageContent';
+export { default as TextContent } from '../Attachment/Text/TextContent';
+export { default as VideoContent } from '../Attachment/VideoContent';
+export { default as VimeoContent } from '../Attachment/VimeoContent';
+export { default as YouTubeContent } from '../Attachment/YouTubeContent';
+
+// Components for recomposing transcript
+export { default as Avatar } from '../Activity/Avatar';
+export { default as Bubble } from '../Activity/Bubble';
+export { default as SpeakActivity } from '../Activity/Speak';
+export { default as SendStatus } from '../ActivityStatus/SendStatus/SendStatus';
+export { default as Timestamp } from '../ActivityStatus/Timestamp';
+export { default as ErrorBox } from '../ErrorBox';
+
+// Components for recomposing send box
+export { AttachmentBar } from '../SendBox/AttachmentBar/index';
+export { default as DictationInterims } from '../SendBox/DictationInterims';
+export { default as MicrophoneButton } from '../SendBox/MicrophoneButton';
+export { default as SendButton } from '../SendBox/SendButton';
+export { default as SuggestedActions } from '../SendBox/SuggestedActions';
+export { default as SendTextBox } from '../SendBox/TextBox';
+export { default as UploadButton } from '../SendBoxToolbar/UploadButton';
+export { TextArea } from '../TextArea/index';
+
+// Components for localization
+export { default as LocalizedString } from '../Utils/LocalizedString';
+
+// Components for theme packs
+export { default as ThemeProvider } from '../providers/Theme/ThemeProvider';
diff --git a/packages/component/src/boot/decorator.ts b/packages/component/src/boot/decorator.ts
new file mode 100644
index 0000000000..d6ac554fa1
--- /dev/null
+++ b/packages/component/src/boot/decorator.ts
@@ -0,0 +1 @@
+export { BorderFlair, BorderLoader, WebChatDecorator } from '../decorator/index';
diff --git a/packages/component/src/boot/hook.ts b/packages/component/src/boot/hook.ts
new file mode 100644
index 0000000000..95dd2ec761
--- /dev/null
+++ b/packages/component/src/boot/hook.ts
@@ -0,0 +1,111 @@
+export {
+ useActiveTyping,
+ useActivities,
+ useActivityKeys,
+ useActivityKeysByRead,
+ useAvatarForBot,
+ useAvatarForUser,
+ useBuildRenderActivityCallback,
+ useByteFormatter,
+ useConnectivityStatus,
+ useCreateActivityRenderer,
+ useCreateActivityStatusRenderer,
+ useCreateAttachmentForScreenReaderRenderer,
+ useCreateAvatarRenderer,
+ useCreateScrollToEndButtonRenderer,
+ useDateFormatter,
+ useDebouncedNotifications,
+ useDictateInterims,
+ useDictateState,
+ useDirection,
+ useDisabled,
+ useDismissNotification,
+ useEmitTypingIndicator,
+ useGetActivitiesByKey,
+ useGetActivityByKey,
+ useGetHasAcknowledgedByActivityKey,
+ useGetKeyByActivity,
+ useGetKeyByActivityId,
+ useGetSendTimeoutForActivity,
+ useGrammars,
+ useGroupActivities,
+ useGroupActivitiesByName,
+ useGroupTimestamp,
+ useLanguage,
+ useLastAcknowledgedActivityKey,
+ useLastReadActivityKey,
+ useLocalizer,
+ useMarkActivityAsSpoken,
+ useMarkActivityKeyAsRead,
+ useMarkAllAsAcknowledged,
+ useNotifications,
+ usePerformCardAction,
+ usePonyfill,
+ usePostActivity,
+ useReferenceGrammarID,
+ useRelativeTimeFormatter,
+ useRenderAttachment,
+ useRenderToast,
+ useRenderTypingIndicator,
+ useSendBoxAttachments,
+ useSendBoxValue,
+ useSendEvent,
+ useSendMessageBack,
+ useSendPostBack,
+ useSendStatusByActivityKey,
+ useSendTimeoutForActivity,
+ useSendTypingIndicator,
+ useSetNotification,
+ useShouldSpeakIncomingActivity,
+ useStartDictate,
+ useStopDictate,
+ useStyleOptions,
+ useSubmitSendBox,
+ useSuggestedActions,
+ useSuggestedActionsHooks,
+ useTimeoutForSend,
+ useTrackDimension,
+ useTrackEvent,
+ useTrackException,
+ useTrackTiming,
+ useUIState,
+ useUserID,
+ useUsername,
+ useVoiceSelector
+} from 'botframework-webchat-api/hook';
+
+// #region Overrides
+export {
+ // We are overwriting the `useSendFiles` hook from bf-wc-api and adding thumbnailing support.
+ useSendFiles,
+ // We are overwriting the `useSendMessage` hook from bf-wc-api and adding thumbnailing support.
+ useSendMessage
+} from '../hooks/index';
+// #endregion
+
+// #region Adds
+export {
+ useDictateAbortable,
+ useFocus,
+ useMakeThumbnail,
+ useMicrophoneButtonClick,
+ useMicrophoneButtonDisabled,
+ useObserveScrollPosition,
+ useObserveTranscriptFocus,
+ useRegisterFocusSendBox,
+ useRenderMarkdownAsHTML,
+ useScrollDown,
+ useScrollTo,
+ useScrollToEnd,
+ useScrollUp,
+ useSendBoxSpeechInterimsVisible,
+ useShouldReduceMotion,
+ useStyleSet,
+ useTextBoxSubmit,
+ useTextBoxValue,
+ useTransformHTMLContent,
+ useTypingIndicatorVisible,
+ useWebSpeechPonyfill,
+ type SendBoxFocusOptions
+} from '../hooks/index';
+// #endregion
diff --git a/packages/component/src/boot/internal.ts b/packages/component/src/boot/internal.ts
new file mode 100644
index 0000000000..e874e74acf
--- /dev/null
+++ b/packages/component/src/boot/internal.ts
@@ -0,0 +1,12 @@
+export {
+ CodeHighlighterComposer,
+ useCodeHighlighter,
+ type HighlightCodeFn
+} from '../hooks/internal/codeHighlighter/index';
+export { default as useInjectStyles } from '../hooks/internal/useInjectStyles';
+export { default as PartGrouping } from '../Middleware/ActivityGrouping/ui/PartGrouping/PartGrouping';
+export { useLiveRegion } from '../providers/LiveRegionTwin/index';
+export { default as ScreenReaderText } from '../ScreenReaderText';
+export { default as createIconComponent } from '../Utils/createIconComponent';
+export { default as parseDocumentFragmentFromString } from '../Utils/parseDocumentFragmentFromString';
+export { default as serializeDocumentFragmentIntoString } from '../Utils/serializeDocumentFragmentIntoString';
diff --git a/packages/component/src/hooks/internal/UITracker.js b/packages/component/src/hooks/internal/UITracker.js
index ff8afb4366..f899c53994 100644
--- a/packages/component/src/hooks/internal/UITracker.js
+++ b/packages/component/src/hooks/internal/UITracker.js
@@ -24,7 +24,7 @@ const Tracker = () => {
trackDimension('prop:speechSynthesis', !!speechSynthesisCapability + '');
}, [trackDimension, speechRecognitionCapability, speechSynthesisCapability]);
- return false;
+ return null;
};
export default Tracker;
diff --git a/packages/component/src/hooks/internal/WebChatUIContext.ts b/packages/component/src/hooks/internal/WebChatUIContext.ts
index e71da3b23e..e4abf9494c 100644
--- a/packages/component/src/hooks/internal/WebChatUIContext.ts
+++ b/packages/component/src/hooks/internal/WebChatUIContext.ts
@@ -3,7 +3,25 @@ import { createContext, type MutableRefObject } from 'react';
import { type FocusTranscriptInit } from '../../types/internal/FocusTranscriptInit';
export type ContextType = {
- focusTranscriptCallbacksRef: MutableRefObject<((init: FocusTranscriptInit) => Promise)[]>;
+ focusTranscriptCallbacksRef: MutableRefObject<((init?: FocusTranscriptInit | undefined) => Promise)[]>;
+ nonce: string | undefined;
+
+ // TODO: [P0] Infer the following types.
+ dictateAbortable: any;
+ dispatchScrollPosition: any;
+ dispatchTranscriptFocusByActivityKey: any;
+ internalMarkdownItState: [any];
+ internalRenderMarkdownInline: any;
+ numTranscriptFocusObservers: any;
+ observeScrollPosition: any;
+ observeTranscriptFocus: any;
+ renderMarkdown: any;
+ scrollToCallbacksRef: any;
+ scrollToEndCallbacksRef: any;
+ setDictateAbortable: any;
+ styleSet: any;
+ suggestedActionsAccessKey: any;
+ webSpeechPonyfill: any;
};
const context = createContext(undefined as ContextType);
diff --git a/packages/component/src/hooks/internal/useForceRenderAtInterval.ts b/packages/component/src/hooks/internal/useForceRenderAtInterval.ts
index a68b990ec8..57a20d6f55 100644
--- a/packages/component/src/hooks/internal/useForceRenderAtInterval.ts
+++ b/packages/component/src/hooks/internal/useForceRenderAtInterval.ts
@@ -1,11 +1,11 @@
import { hooks } from 'botframework-webchat-api';
-import { useCallback, useState } from 'react';
import random from 'math-random';
+import { useCallback, useState } from 'react';
import useTimer from './useTimer';
-import type { Dispatch, SetStateAction } from 'react';
import type { GlobalScopePonyfill } from 'botframework-webchat-core';
+import type { Dispatch, SetStateAction } from 'react';
const { usePonyfill } = hooks;
@@ -16,8 +16,8 @@ const { usePonyfill } = hooks;
// False positive: we are using `Date` as a type.
// eslint-disable-next-line no-restricted-globals
-function nextTimer(origin: Date | number | string, interval: number, { Date }: GlobalScopePonyfill): number {
- const time = new Date(origin).getTime();
+function nextTimer(origin: Date, interval: number, { Date }: GlobalScopePonyfill): number {
+ const time = origin.getTime();
const now = Date.now();
return time > now ? time : now + interval - ((now - time) % interval);
@@ -26,9 +26,9 @@ function nextTimer(origin: Date | number | string, interval: number, { Date }: G
export default function useForceRenderAtInterval(
// False positive: we are using `Date` as a type.
// eslint-disable-next-line no-restricted-globals
- origin: Date | number | string,
+ origin: Date,
interval: number,
- fn: () => void
+ fn?: (() => void) | undefined
): [number, Dispatch>] {
const [ponyfill] = usePonyfill();
const [timer, setTimer] = useState(nextTimer(origin, interval, ponyfill));
diff --git a/packages/component/src/hooks/internal/useNonce.js b/packages/component/src/hooks/internal/useNonce.ts
similarity index 50%
rename from packages/component/src/hooks/internal/useNonce.js
rename to packages/component/src/hooks/internal/useNonce.ts
index beafccde87..54d21b6e53 100644
--- a/packages/component/src/hooks/internal/useNonce.js
+++ b/packages/component/src/hooks/internal/useNonce.ts
@@ -1,7 +1,7 @@
import useWebChatUIContext from './useWebChatUIContext';
-export default function useNonce() {
+export default function useNonce(): readonly [string | undefined] {
const { nonce } = useWebChatUIContext();
- return [nonce];
+ return Object.freeze([nonce]);
}
diff --git a/packages/component/src/index.ts b/packages/component/src/index.ts
index 4ced6a5c63..8d4269df49 100644
--- a/packages/component/src/index.ts
+++ b/packages/component/src/index.ts
@@ -1,143 +1,27 @@
-import { hooks as apiHooks, concatMiddleware, localize } from 'botframework-webchat-api';
-import { type WebChatActivity } from 'botframework-webchat-core';
+export { concatMiddleware, localize } from 'botframework-webchat-api';
+export { type WebChatActivity } from 'botframework-webchat-core';
-import ReactWebChat, { ReactWebChatProps } from './ReactWebChat';
-
-import Composer, { ComposerProps } from './Composer';
-
-import AccessKeySinkSurface from './Utils/AccessKeySink/Surface';
-
-import BasicConnectivityStatus from './BasicConnectivityStatus';
-import BasicToaster from './BasicToaster';
-import BasicTranscript from './BasicTranscript';
-import BasicWebChat, { BasicWebChatProps } from './BasicWebChat';
-import BasicSendBox from './SendBox/BasicSendBox';
-import BasicSendBoxToolbar from './SendBoxToolbar/BasicSendBoxToolbar';
-
-import Avatar from './Activity/Avatar';
-import Bubble from './Activity/Bubble';
-import SpeakActivity from './Activity/Speak';
-import SendStatus from './ActivityStatus/SendStatus/SendStatus';
-import Timestamp from './ActivityStatus/Timestamp';
-import ErrorBox from './ErrorBox';
-
-import LocalizedString from './Utils/LocalizedString';
-
-import AudioContent from './Attachment/AudioContent';
-import FileContent from './Attachment/FileContent';
-import HTMLVideoContent from './Attachment/HTMLVideoContent';
-import ImageContent from './Attachment/ImageContent';
-import TextContent from './Attachment/Text/TextContent';
-import VideoContent from './Attachment/VideoContent';
-import VimeoContent from './Attachment/VimeoContent';
-import YouTubeContent from './Attachment/YouTubeContent';
-
-import DictationInterims from './SendBox/DictationInterims';
-import MicrophoneButton from './SendBox/MicrophoneButton';
-import SendButton from './SendBox/SendButton';
-import SuggestedActions from './SendBox/SuggestedActions';
-import SendTextBox from './SendBox/TextBox';
-import UploadButton from './SendBoxToolbar/UploadButton';
-import { AttachmentBar } from './SendBox/AttachmentBar';
-import { TextArea } from './TextArea';
-
-import createCoreAttachmentMiddleware from './Attachment/createMiddleware';
-import createCoreActivityMiddleware from './Middleware/Activity/createCoreMiddleware';
-import createCoreActivityStatusMiddleware from './Middleware/ActivityStatus/createCoreMiddleware';
-import createStyleSet from './Styles/createStyleSet';
-import getTabIndex from './Utils/TypeFocusSink/getTabIndex';
-import Context from './hooks/internal/WebChatUIContext';
-import {
+export { default as createCoreAttachmentMiddleware } from './Attachment/createMiddleware';
+export { default as Context } from './hooks/internal/WebChatUIContext';
+export { default as createCoreActivityMiddleware } from './Middleware/Activity/createCoreMiddleware';
+export { default as createCoreActivityStatusMiddleware } from './Middleware/ActivityStatus/createCoreMiddleware';
+export {
type HTMLContentTransformEnhancer,
type HTMLContentTransformFunction,
type HTMLContentTransformMiddleware,
type HTMLContentTransformRequest
} from './providers/HTMLContentTransformCOR/index';
-import ThemeProvider from './providers/Theme/ThemeProvider';
-import testIds from './testIds';
-import withEmoji from './withEmoji/withEmoji';
-
-import * as componentHooks from './hooks/index';
+export { default as createStyleSet } from './Styles/createStyleSet';
+export { default as testIds } from './testIds';
+export { default as getTabIndex } from './Utils/TypeFocusSink/getTabIndex';
+export { default as withEmoji } from './withEmoji/withEmoji';
-export { type SendBoxFocusOptions } from './hooks/index';
-
-const hooks = {
- ...apiHooks,
- ...componentHooks
-};
-
-const Components = {
- BasicWebChat,
- Composer,
- ThemeProvider,
-
- // Components for restructuring BasicWebChat
- AccessKeySinkSurface,
- BasicConnectivityStatus,
- BasicSendBox,
- BasicSendBoxToolbar,
- BasicToaster,
- BasicTranscript,
-
- // Components for recomposing activities and attachments
- AudioContent,
- FileContent,
- HTMLVideoContent,
- ImageContent,
- TextContent,
- VideoContent,
- VimeoContent,
- YouTubeContent,
-
- // Components for recomposing transcript
- Avatar,
- Bubble,
- ErrorBox,
- SendStatus,
- SpeakActivity,
- Timestamp,
-
- // Components for recomposing send box
- AttachmentBar,
- DictationInterims,
- MicrophoneButton,
- SendButton,
- SendTextBox,
- SuggestedActions,
- TextArea,
- UploadButton,
-
- // Components for localization
- LocalizedString
-};
-
-export default ReactWebChat;
-
-export {
- Components,
- concatMiddleware,
- Context,
- createCoreActivityMiddleware,
- createCoreActivityStatusMiddleware,
- createCoreAttachmentMiddleware,
- createStyleSet,
- getTabIndex,
- hooks,
- localize,
- testIds,
- withEmoji
-};
+export type * from './boot/component';
+export * as Components from './boot/component';
+export type * from './boot/hook';
+export * as hooks from './boot/hook';
-export type {
- BasicWebChatProps,
- ComposerProps,
- HTMLContentTransformEnhancer,
- HTMLContentTransformFunction,
- HTMLContentTransformMiddleware,
- HTMLContentTransformRequest,
- ReactWebChatProps,
- WebChatActivity
-};
+export { ReactWebChat as default } from './boot/component';
// #region Build info
import buildInfo from './buildInfo';
diff --git a/packages/component/src/internal.ts b/packages/component/src/internal.ts
deleted file mode 100644
index 6bc17a5a23..0000000000
--- a/packages/component/src/internal.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import {
- CodeHighlighterComposer,
- useCodeHighlighter,
- type HighlightCodeFn
-} from './hooks/internal/codeHighlighter/index';
-import useInjectStyles from './hooks/internal/useInjectStyles';
-import { useLiveRegion } from './providers/LiveRegionTwin/index';
-import createIconComponent from './Utils/createIconComponent';
-import PartGrouping from './Middleware/ActivityGrouping/ui/PartGrouping/PartGrouping';
-import parseDocumentFragmentFromString from './Utils/parseDocumentFragmentFromString';
-import serializeDocumentFragmentIntoString from './Utils/serializeDocumentFragmentIntoString';
-
-export { default as ScreenReaderText } from './ScreenReaderText';
-
-export {
- CodeHighlighterComposer,
- createIconComponent,
- parseDocumentFragmentFromString,
- PartGrouping,
- serializeDocumentFragmentIntoString,
- useCodeHighlighter,
- useInjectStyles,
- useLiveRegion
-};
-
-export { type HighlightCodeFn };
diff --git a/packages/component/src/providers/CustomElements/customElements/CodeBlock.ts b/packages/component/src/providers/CustomElements/customElements/CodeBlock.ts
index b91c9d4fb1..4562b594e6 100644
--- a/packages/component/src/providers/CustomElements/customElements/CodeBlock.ts
+++ b/packages/component/src/providers/CustomElements/customElements/CodeBlock.ts
@@ -3,8 +3,9 @@ import { hooks } from 'botframework-webchat-api';
import { useStyles } from '@msinternal/botframework-webchat-styles/react';
import { ReactNode, useMemo, useRef } from 'react';
+import { useCodeHighlighter } from '../../../hooks/internal/codeHighlighter';
import { defaultHighlightCode, HighlightCodeFn } from '../../../hooks/internal/codeHighlighter/index';
-import { parseDocumentFragmentFromString, useCodeHighlighter } from '../../../internal';
+import parseDocumentFragmentFromString from '../../../Utils/parseDocumentFragmentFromString';
import styles from './CodeBlock.module.css';
diff --git a/packages/component/src/tsconfig.json b/packages/component/src/tsconfig.json
index 9daf0ad4e6..96766595e1 100644
--- a/packages/component/src/tsconfig.json
+++ b/packages/component/src/tsconfig.json
@@ -1,5 +1,6 @@
{
"compilerOptions": {
+ "allowJs": true,
"downlevelIteration": true,
"types": ["dom-speech-recognition"]
},
diff --git a/packages/component/tsup.config.ts b/packages/component/tsup.config.ts
index 997e60964e..43ad88af65 100644
--- a/packages/component/tsup.config.ts
+++ b/packages/component/tsup.config.ts
@@ -6,18 +6,26 @@ import { componentStyleContent as componentStyleContentPlaceholder } from './src
import { decoratorStyleContent as decoratorStyleContentPlaceholder } from './src/decorator/private/createStyles';
// TODO: [P1] Compute this automatically.
-const DEPENDENT_PATHS = ['bundle/src/boot/exports/full.ts'];
+const DEPENDENT_PATHS = ['bundle/src/boot/exports/index.ts'];
const commonConfig = applyConfig(config => ({
...config,
entry: {
'botframework-webchat-component': './src/index.ts',
- 'botframework-webchat-component.internal': './src/internal.ts',
- 'botframework-webchat-component.decorator': './src/decorator/index.ts'
+ 'botframework-webchat-component.component': './src/boot/component.ts',
+ 'botframework-webchat-component.decorator': './src/boot/decorator.ts',
+ 'botframework-webchat-component.hook': './src/boot/hook.ts',
+ 'botframework-webchat-component.internal': './src/boot/internal.ts'
},
esbuildPlugins: [
...(config.esbuildPlugins ?? []),
- injectCSSPlugin({ stylesPlaceholder: componentStyleContentPlaceholder }),
+ injectCSSPlugin({
+ // esbuild does not fully support CSS code splitting, every entry point has its own CSS file.
+ // Related to https://github.com/evanw/esbuild/issues/608.
+ getCSSText: (_source, cssFiles) =>
+ cssFiles.find(({ path }) => path.endsWith('botframework-webchat-component.component.css'))?.text,
+ stylesPlaceholder: componentStyleContentPlaceholder
+ }),
injectCSSPlugin({ stylesPlaceholder: decoratorStyleContentPlaceholder })
],
onSuccess: `touch ${DEPENDENT_PATHS.map(path => `../${path}`).join(' ')}`
diff --git a/packages/fluent-theme/src/external.umd/botframework-webchat-api/middleware.ts b/packages/fluent-theme/src/external.umd/botframework-webchat-api/middleware.ts
new file mode 100644
index 0000000000..a1c7f40652
--- /dev/null
+++ b/packages/fluent-theme/src/external.umd/botframework-webchat-api/middleware.ts
@@ -0,0 +1,3 @@
+///
+
+module.exports = (globalThis as any).WebChat.middleware;
diff --git a/packages/fluent-theme/src/external.umd/botframework-webchat-component/component.ts b/packages/fluent-theme/src/external.umd/botframework-webchat-component/component.ts
new file mode 100644
index 0000000000..3d9ae2f204
--- /dev/null
+++ b/packages/fluent-theme/src/external.umd/botframework-webchat-component/component.ts
@@ -0,0 +1,3 @@
+///
+
+module.exports = (globalThis as any).WebChat.Components;
diff --git a/packages/fluent-theme/src/external.umd/botframework-webchat-component/hook.ts b/packages/fluent-theme/src/external.umd/botframework-webchat-component/hook.ts
new file mode 100644
index 0000000000..7844b9c19e
--- /dev/null
+++ b/packages/fluent-theme/src/external.umd/botframework-webchat-component/hook.ts
@@ -0,0 +1,3 @@
+///
+
+module.exports = (globalThis as any).WebChat.hooks;
diff --git a/packages/fluent-theme/src/private/FluentThemeProvider.tsx b/packages/fluent-theme/src/private/FluentThemeProvider.tsx
index 5949529e33..d2745be784 100644
--- a/packages/fluent-theme/src/private/FluentThemeProvider.tsx
+++ b/packages/fluent-theme/src/private/FluentThemeProvider.tsx
@@ -5,10 +5,9 @@ import {
createActivityGroupingMiddleware,
DecoratorComposer,
WebChatDecorator,
- type ActivityMiddleware,
- type DecoratorMiddleware,
- type TypingIndicatorMiddleware
-} from 'botframework-webchat/internal';
+ type DecoratorMiddleware
+} from 'botframework-webchat/decorator';
+import { type ActivityMiddleware, type TypingIndicatorMiddleware } from 'botframework-webchat/internal';
import React, { memo, type ReactNode } from 'react';
import { ActivityDecorator } from '../components/activity';
diff --git a/packages/fluent-theme/tsup.config.ts b/packages/fluent-theme/tsup.config.ts
index 1df1a440bd..fe51b60fa3 100644
--- a/packages/fluent-theme/tsup.config.ts
+++ b/packages/fluent-theme/tsup.config.ts
@@ -23,8 +23,11 @@ const umdResolvePlugin = {
// ESBuild use Go regular expressions and does not understand Unicode flag.
// eslint-disable-next-line require-unicode-regexp
- build.onResolve({ filter: /^botframework-webchat-api\/decorator$/ }, () => ({
- path: join(fileURLToPath(import.meta.url), '../src/external.umd/botframework-webchat-api/decorator.ts')
+ build.onResolve({ filter: /^botframework-webchat-api\// }, args => ({
+ path: join(
+ fileURLToPath(import.meta.url),
+ `../src/external.umd/botframework-webchat-api/${args.path.split('/').slice(1).join('/')}.ts`
+ )
}));
// ESBuild use Go regular expressions and does not understand Unicode flag.
@@ -35,14 +38,11 @@ const umdResolvePlugin = {
// ESBuild use Go regular expressions and does not understand Unicode flag.
// eslint-disable-next-line require-unicode-regexp
- build.onResolve({ filter: /^botframework-webchat-component\/internal$/ }, () => ({
- path: join(fileURLToPath(import.meta.url), '../src/external.umd/botframework-webchat-component/internal.ts')
- }));
-
- // ESBuild use Go regular expressions and does not understand Unicode flag.
- // eslint-disable-next-line require-unicode-regexp
- build.onResolve({ filter: /^botframework-webchat-component\/decorator$/ }, () => ({
- path: join(fileURLToPath(import.meta.url), '../src/external.umd/botframework-webchat-component/decorator.ts')
+ build.onResolve({ filter: /^botframework-webchat-component\// }, args => ({
+ path: join(
+ fileURLToPath(import.meta.url),
+ `../src/external.umd/botframework-webchat-component/${args.path.split('/').slice(1).join('/')}.ts`
+ )
}));
}
};
diff --git a/packages/react-valibot/tsup.config.ts b/packages/react-valibot/tsup.config.ts
index 046cf4f520..f832eff721 100644
--- a/packages/react-valibot/tsup.config.ts
+++ b/packages/react-valibot/tsup.config.ts
@@ -6,7 +6,7 @@ import { applyConfig } from '../../tsup.base.config';
const DEPENDENT_PATHS = [
'api/src/index.ts',
'api-middleware/src/index.ts',
- 'bundle/src/boot/exports/full.ts',
+ 'bundle/src/boot/exports/index.ts',
'component/src/index.ts',
'debug-theme/src/index.ts',
'fluent-theme/src/index.ts',
diff --git a/packages/styles/src/build/private/injectCSSPlugin.ts b/packages/styles/src/build/private/injectCSSPlugin.ts
index b6957f5ecd..d69e2ad098 100644
--- a/packages/styles/src/build/private/injectCSSPlugin.ts
+++ b/packages/styles/src/build/private/injectCSSPlugin.ts
@@ -1,7 +1,8 @@
import { decode, encode } from '@jridgewell/sourcemap-codec';
-import type { Plugin } from 'esbuild';
+import type { OutputFile, Plugin } from 'esbuild';
export interface InjectCSSPluginOptions {
+ getCSSText?: ((source: OutputFile, cssFiles: OutputFile[]) => string | undefined | void) | undefined;
stylesPlaceholder: string;
}
@@ -19,31 +20,40 @@ function updateMappings(encoded: string, startIndex: number, offset: number) {
return encode(mappings);
}
-export default function injectCSSPlugin({ stylesPlaceholder }: InjectCSSPluginOptions): Plugin {
+export default function injectCSSPlugin({ getCSSText, stylesPlaceholder }: InjectCSSPluginOptions): Plugin {
if (!stylesPlaceholder) {
throw new Error('inject-css-plugin: no placeholder for styles provided');
}
+ getCSSText =
+ getCSSText ||
+ ((source, cssFiles) => {
+ const entryName = source.path.replace(/(\.js|\.mjs)$/u, '');
+ const css = cssFiles.find(f => f.path.replace(/(\.css)$/u, '') === entryName);
+
+ return css?.text;
+ });
+
const stylesPlaceholderQuoted = JSON.stringify(stylesPlaceholder);
return {
name: `inject-css-plugin(${stylesPlaceholder})`,
setup(build) {
build.onEnd(({ outputFiles = [] }) => {
+ const cssFiles = outputFiles.filter(({ path }) => path.match(/(\.css)$/u));
+
for (const file of outputFiles) {
if (file.path.match(/(\.js|\.mjs)$/u)) {
- const entryName = file.path.replace(/(\.js|\.mjs)$/u, '');
- const css = outputFiles.find(f => f.path.replace(/(\.css)$/u, '') === entryName);
-
+ const cssText = getCSSText(file, cssFiles);
const jsText = file?.text;
- if (css && jsText?.includes(stylesPlaceholderQuoted)) {
- const cssText = JSON.stringify(css.text);
+
+ if (cssText && jsText?.includes(stylesPlaceholderQuoted)) {
const index = jsText.indexOf(stylesPlaceholderQuoted);
const map = outputFiles.find(f => f.path.replace(/(\.map)$/u, '') === file.path);
const updatedJsText = [
jsText.slice(0, index),
- cssText,
+ JSON.stringify(cssText),
jsText.slice(index + stylesPlaceholderQuoted.length)
].join('');
diff --git a/tsup.base.config.ts b/tsup.base.config.ts
index 5c44c7c249..5b964d60ae 100644
--- a/tsup.base.config.ts
+++ b/tsup.base.config.ts
@@ -54,11 +54,11 @@ function applyConfig(
esbuildPlugins: EsbuildPlugin[];
target: Target[];
}
- ) => Options & {
+ ) => Omit & {
define: Record;
esbuildPlugins: EsbuildPlugin[];
target: Target[];
- }
+ } & { outDirWithTemp?: [`./${string}/`, `./${string}/`] | undefined }
): Options & {
define: Record;
esbuildPlugins: EsbuildPlugin[];
@@ -150,16 +150,28 @@ function applyConfig(
// All instances of tsup will try to copy at the same time and could fail with "cp: cannot create regular file './dist/...': File exists".
// We can have multiple config writing to their own folder and copy-merge. But then each config will own their version of `onSuccess`, could be messy.
+ const [outDir = './dist/', tmpDir = './dist.tmp/'] = nextOptions.outDirWithTemp || [];
+
// TODO: [P1] This merge is not elegant, we should move to Promise.
- nextOptions.onSuccess = [
- `while [ -z "$(find ./dist.tmp \\( -name '*.d.ts' -o -name '*.d.mts' \\) -print -quit)" ]; do sleep 0.2; done; mkdir -p ./dist/; sleep 0.5; until cp ./dist.tmp/* ./dist/; do sleep 0.5; done`,
- nextOptions.onSuccess
- ]
- .filter(Boolean)
- .join(' && ');
- nextOptions.outDir = './dist.tmp/';
+ const rectifiedOptions = {
+ ...nextOptions,
+ onSuccess: nextOptions.dts
+ ? [
+ `while [ -z "$(find ${tmpDir} \\( -name '*.d.ts' -o -name '*.d.mts' \\) -print -quit)" ]; do sleep 0.2; done; mkdir -p ${outDir}; sleep 0.5; until cp --recursive ${tmpDir}/* ${outDir} 2>/dev/null; do sleep 0.5; done`,
+ nextOptions.onSuccess
+ ]
+ .filter(Boolean)
+ .join(' && ')
+ : [
+ `mkdir -p ${outDir}; sleep 0.5; until cp --recursive ${tmpDir}/* ${outDir} 2>/dev/null; do sleep 0.5; done`,
+ nextOptions.onSuccess
+ ]
+ .filter(Boolean)
+ .join(' && '),
+ outDir: tmpDir
+ };
- return nextOptions;
+ return rectifiedOptions;
}
export { applyConfig };