@xpert-ai/chatkit-ui5 0.16.2 → 0.17.1
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/dist/chatkit.cjs +27 -2
- package/dist/chatkit.cjs.map +1 -1
- package/dist/chatkit.ui5.js +27 -2
- package/dist/chatkit.ui5.js.map +1 -1
- package/dist/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/chatkit.cjs
CHANGED
|
@@ -384,7 +384,13 @@ function createSecureChannelId() {
|
|
|
384
384
|
return null;
|
|
385
385
|
}
|
|
386
386
|
function safeRandomUUID() {
|
|
387
|
-
|
|
387
|
+
const id = createSecureChannelId();
|
|
388
|
+
if (id === null) {
|
|
389
|
+
throw new Error(
|
|
390
|
+
"ChatKit requires crypto.randomUUID or crypto.getRandomValues to generate secure UUIDs."
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
return id;
|
|
388
394
|
}
|
|
389
395
|
function isTrustedChatKitMessageEvent(event, { channelId, expectedOrigin, expectedSource }) {
|
|
390
396
|
const payload = event.data;
|
|
@@ -433,6 +439,20 @@ class FrameSafeIntegrationError {
|
|
|
433
439
|
this.stack = new Error(message).stack;
|
|
434
440
|
}
|
|
435
441
|
}
|
|
442
|
+
function serializeFrameError(error) {
|
|
443
|
+
try {
|
|
444
|
+
return structuredClone(error);
|
|
445
|
+
} catch {
|
|
446
|
+
const message = error && typeof error === "object" && "message" in error && typeof error.message === "string" ? error.message : "ChatKit host request failed";
|
|
447
|
+
if (error && typeof error === "object" && "status" in error && typeof error.status === "number") {
|
|
448
|
+
return new FrameSafeHttpError(message, {
|
|
449
|
+
status: error.status,
|
|
450
|
+
statusText: "statusText" in error && typeof error.statusText === "string" ? error.statusText : void 0
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
return new Error(message);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
436
456
|
class BaseMessenger {
|
|
437
457
|
constructor({
|
|
438
458
|
handlers,
|
|
@@ -630,7 +650,8 @@ class BaseMessenger {
|
|
|
630
650
|
const message = {
|
|
631
651
|
__xpaiChatKit: true,
|
|
632
652
|
...this.channelId ? { channelId: this.channelId } : {},
|
|
633
|
-
...data
|
|
653
|
+
...data,
|
|
654
|
+
...data.type === "response" && data.error !== void 0 ? { error: serializeFrameError(data.error) } : {}
|
|
634
655
|
};
|
|
635
656
|
(_a2 = this.target()) == null ? void 0 : _a2.postMessage(message, this.targetOrigin, transfer);
|
|
636
657
|
}
|
|
@@ -2603,6 +2624,10 @@ class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requir
|
|
|
2603
2624
|
}
|
|
2604
2625
|
return connect(request);
|
|
2605
2626
|
},
|
|
2627
|
+
onWorkbenchNavigationChange: async (navigation) => {
|
|
2628
|
+
var _a2, _b2, _c2;
|
|
2629
|
+
await ((_c2 = (_b2 = (_a2 = __privateGet(this, _opts)) == null ? void 0 : _a2.workbench) == null ? void 0 : _b2.onNavigationChange) == null ? void 0 : _c2.call(_b2, navigation));
|
|
2630
|
+
},
|
|
2606
2631
|
onWorkbenchClientCommand: async ({
|
|
2607
2632
|
commandKey,
|
|
2608
2633
|
payload,
|