@epam/ai-dial-visualizer-connector 0.45.0 → 0.46.0-dev.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +13 -3
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -204,10 +204,18 @@ class VisualizerConnector {
|
|
|
204
204
|
return __awaiter(this, arguments, void 0, function* (type, payload, waitForReady = true) {
|
|
205
205
|
var _a;
|
|
206
206
|
if (waitForReady) {
|
|
207
|
-
|
|
207
|
+
try {
|
|
208
|
+
yield this.iframeInteraction.ready();
|
|
209
|
+
}
|
|
210
|
+
catch (e) {
|
|
211
|
+
if (e === 'Chat Visualizer destroyed') {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
throw e;
|
|
215
|
+
}
|
|
208
216
|
}
|
|
209
|
-
if (!this.iframe.contentWindow) {
|
|
210
|
-
|
|
217
|
+
if (!this.iframe.isConnected || !this.iframe.contentWindow) {
|
|
218
|
+
return undefined;
|
|
211
219
|
}
|
|
212
220
|
const request = new DeferredRequest(`${this.options.visualizerName}/${type}`, {
|
|
213
221
|
payload,
|
|
@@ -242,6 +250,8 @@ class VisualizerConnector {
|
|
|
242
250
|
*/
|
|
243
251
|
destroy() {
|
|
244
252
|
window.removeEventListener('message', this.process);
|
|
253
|
+
// So Task.fail() never surfaces as "unhandled" if nothing awaited ready() yet (e.g. Strict Mode).
|
|
254
|
+
void this.iframeInteraction.ready().catch(() => { });
|
|
245
255
|
this.iframeInteraction.fail('Chat Visualizer destroyed');
|
|
246
256
|
this.root.removeChild(this.iframe);
|
|
247
257
|
this.root.removeChild(this.loader);
|
package/package.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@epam/ai-dial-visualizer-connector",
|
|
3
3
|
"description": "Package for connecting custom visualizer into DIAL Chat",
|
|
4
4
|
"homepage": "https://dialx.ai",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.46.0-dev.43",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@epam/ai-dial-shared": "0.
|
|
7
|
+
"@epam/ai-dial-shared": "0.46.0-dev.43"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"bugs": {
|