@syntrologie/adapt-chatbot 2.8.0-canary.242 → 2.8.0-canary.243
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatAssistantLit.d.ts","sourceRoot":"","sources":["../src/ChatAssistantLit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"ChatAssistantLit.d.ts","sourceRoot":"","sources":["../src/ChatAssistantLit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAcD,eAAO,MAAM,yBAAyB;qBACnB,WAAW,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAoDpE,CAAC"}
|
package/dist/ChatAssistantLit.js
CHANGED
|
@@ -3280,25 +3280,24 @@ var SsePostTransport = class {
|
|
|
3280
3280
|
// src/ChatAssistantLit.ts
|
|
3281
3281
|
var ChatAssistantLitMountable = {
|
|
3282
3282
|
mount(container, mountConfig) {
|
|
3283
|
-
const {
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
if (!config || !runtime) {
|
|
3283
|
+
const incoming = mountConfig ?? {};
|
|
3284
|
+
const { runtime, instanceId, tileId, config: nestedConfig, ...flat } = incoming;
|
|
3285
|
+
const chatbotConfig = nestedConfig ?? (flat.backendUrl ? flat : void 0);
|
|
3286
|
+
const resolvedTileId = tileId ?? instanceId ?? "chatbot-widget";
|
|
3287
|
+
if (!chatbotConfig?.backendUrl || !runtime) {
|
|
3289
3288
|
container.innerHTML = '<div style="padding:16px;color:var(--sc-content-text-secondary-color,#87919f)">Chat widget requires config and runtime.</div>';
|
|
3290
3289
|
return () => {
|
|
3291
3290
|
container.innerHTML = "";
|
|
3292
3291
|
};
|
|
3293
3292
|
}
|
|
3294
|
-
const baseUrl =
|
|
3293
|
+
const baseUrl = chatbotConfig.backendUrl.replace(/\/$/, "");
|
|
3295
3294
|
const transport = new SsePostTransport({
|
|
3296
3295
|
sseUrl: `${baseUrl}/api/adaptive/session`,
|
|
3297
3296
|
postUrl: `${baseUrl}/api/adaptive/action`,
|
|
3298
3297
|
onA2UIEvent: (payload) => {
|
|
3299
3298
|
runtime.actions.applyBatch([payload]).then(() => {
|
|
3300
3299
|
runtime.events.publish("chatbot.a2ui_applied", {
|
|
3301
|
-
tileId
|
|
3300
|
+
tileId: resolvedTileId
|
|
3302
3301
|
});
|
|
3303
3302
|
}).catch((err) => {
|
|
3304
3303
|
console.error("[adaptive-chatbot] A2UI apply failed:", err);
|
|
@@ -3307,9 +3306,9 @@ var ChatAssistantLitMountable = {
|
|
|
3307
3306
|
});
|
|
3308
3307
|
const el = document.createElement("syntro-chat");
|
|
3309
3308
|
el.transport = transport;
|
|
3310
|
-
el.greeting =
|
|
3311
|
-
if (
|
|
3312
|
-
el.suggestions =
|
|
3309
|
+
el.greeting = chatbotConfig.greeting;
|
|
3310
|
+
if (chatbotConfig.suggestions) {
|
|
3311
|
+
el.suggestions = chatbotConfig.suggestions;
|
|
3313
3312
|
}
|
|
3314
3313
|
el.style.cssText = "display:flex;flex-direction:column;height:100%;width:100%;";
|
|
3315
3314
|
container.appendChild(el);
|
|
@@ -3328,4 +3327,4 @@ export {
|
|
|
3328
3327
|
dompurify/dist/purify.es.mjs:
|
|
3329
3328
|
(*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE *)
|
|
3330
3329
|
*/
|
|
3331
|
-
//# sourceMappingURL=chunk-
|
|
3330
|
+
//# sourceMappingURL=chunk-FM7MU2YX.js.map
|