@opencx/widget 3.0.19 → 3.0.21
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/designs.cjs +72 -72
- package/dist/designs.cjs.map +1 -1
- package/dist/designs.js +36244 -36248
- package/dist/designs.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/src/designs/react/components/BotOrAgentMessage.d.ts +2 -8
- package/dist/src/designs/react/components/{Text.component.d.ts → BotOrAgentTextResponse.d.ts} +1 -2
- package/dist/src/headless/core/context/message.ctx.d.ts +1 -1
- package/dist/src/headless/core/index.d.ts +1 -1
- package/dist/src/headless/core/sdk/schema.d.ts +2 -6
- package/dist/src/headless/core/types/messages.d.ts +15 -8
- package/dist/src/headless/react/ComponentRegistry.d.ts +1 -2
- package/dist/src/headless/react/types/components.d.ts +1 -1
- package/dist/{useUploadFiles-sY8364dS.js → useUploadFiles-DNazXzpj.js} +11 -18
- package/dist/useUploadFiles-DNazXzpj.js.map +1 -0
- package/dist/{useUploadFiles-CyBcsF-U.cjs → useUploadFiles-DufH5njs.cjs} +3 -3
- package/dist/useUploadFiles-DufH5njs.cjs.map +1 -0
- package/dist/{widget.ctx-C4fHGXaH.cjs → widget.ctx-DoLfq9VQ.cjs} +2 -2
- package/dist/{widget.ctx-C4fHGXaH.cjs.map → widget.ctx-DoLfq9VQ.cjs.map} +1 -1
- package/dist/{widget.ctx-DkhYPIAY.js → widget.ctx-naCIXuET.js} +106 -105
- package/dist/{widget.ctx-DkhYPIAY.js.map → widget.ctx-naCIXuET.js.map} +1 -1
- package/dist-embed/script.js +110 -110
- package/dist-embed/script.js.map +1 -1
- package/package.json +1 -1
- package/dist/useUploadFiles-CyBcsF-U.cjs.map +0 -1
- package/dist/useUploadFiles-sY8364dS.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var M = (
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var M = (n) => {
|
|
3
|
+
throw TypeError(n);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var s = (
|
|
7
|
-
var h = (
|
|
5
|
+
var O = (n, t, e) => t in n ? L(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
6
|
+
var s = (n, t, e) => O(n, typeof t != "symbol" ? t + "" : t, e), R = (n, t, e) => t.has(n) || M("Cannot " + e);
|
|
7
|
+
var h = (n, t, e) => (R(n, t, "read from private field"), e ? e.call(n) : t.get(n)), P = (n, t, e) => t.has(n) ? M("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), C = (n, t, e, i) => (R(n, t, "write to private field"), i ? i.call(n, e) : t.set(n, e), e);
|
|
8
8
|
import T from "axios";
|
|
9
9
|
import E from "openapi-fetch";
|
|
10
10
|
import D from "lodash.isequal";
|
|
11
|
-
import { v4 as
|
|
12
|
-
const q = (
|
|
13
|
-
console.log(
|
|
14
|
-
},
|
|
11
|
+
import { v4 as B } from "uuid";
|
|
12
|
+
const q = (n) => {
|
|
13
|
+
console.log(n.error);
|
|
14
|
+
}, _ = (n) => {
|
|
15
15
|
const t = E({
|
|
16
|
-
baseUrl:
|
|
16
|
+
baseUrl: n.baseUrl
|
|
17
17
|
}), e = {
|
|
18
|
-
onRequest:
|
|
19
|
-
onResponse:
|
|
20
|
-
onError:
|
|
18
|
+
onRequest: n.onRequest,
|
|
19
|
+
onResponse: n.onResponse,
|
|
20
|
+
onError: n.onError || q
|
|
21
21
|
};
|
|
22
22
|
return t.use(e), t;
|
|
23
23
|
};
|
|
@@ -40,11 +40,11 @@ class H {
|
|
|
40
40
|
s(this, "createOpenAPIClient", ({
|
|
41
41
|
baseUrl: t,
|
|
42
42
|
headers: e
|
|
43
|
-
}) =>
|
|
43
|
+
}) => _({
|
|
44
44
|
baseUrl: t,
|
|
45
45
|
onRequest: ({ request: i }) => {
|
|
46
|
-
Object.entries(e).forEach(([
|
|
47
|
-
r && i.headers.set(
|
|
46
|
+
Object.entries(e).forEach(([a, r]) => {
|
|
47
|
+
r && i.headers.set(a, r);
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
}));
|
|
@@ -71,10 +71,10 @@ class H {
|
|
|
71
71
|
lastMessageTimestamp: e,
|
|
72
72
|
abortSignal: i
|
|
73
73
|
}) => {
|
|
74
|
-
const
|
|
74
|
+
const a = e ? { lastMessageTimestamp: e } : void 0;
|
|
75
75
|
return await this.client.GET(
|
|
76
76
|
"/backend/widget/v2/session/history/{sessionId}",
|
|
77
|
-
{ params: { path: { sessionId: t }, query:
|
|
77
|
+
{ params: { path: { sessionId: t }, query: a }, signal: i }
|
|
78
78
|
);
|
|
79
79
|
});
|
|
80
80
|
s(this, "createUnverifiedContact", async (t) => await this.client.POST(
|
|
@@ -105,19 +105,19 @@ class H {
|
|
|
105
105
|
s(this, "uploadFile", async (t, e = {}) => {
|
|
106
106
|
const i = new FormData();
|
|
107
107
|
i.append("file", t.file);
|
|
108
|
-
const { data:
|
|
108
|
+
const { data: a } = await this.uploadFileClient.post("", i, {
|
|
109
109
|
headers: {
|
|
110
110
|
"Content-Type": "multipart/form-data"
|
|
111
111
|
},
|
|
112
112
|
...e
|
|
113
113
|
});
|
|
114
|
-
return
|
|
114
|
+
return a;
|
|
115
115
|
});
|
|
116
116
|
s(this, "vote", async (t) => await this.client.POST("/backend/widget/v2/chat/vote", { body: t }));
|
|
117
|
-
var
|
|
117
|
+
var a;
|
|
118
118
|
this.config = t;
|
|
119
119
|
const { baseUrl: e, headers: i } = this.constructClientOptions(
|
|
120
|
-
(
|
|
120
|
+
(a = t.user) == null ? void 0 : a.token
|
|
121
121
|
);
|
|
122
122
|
this.client = this.createOpenAPIClient({ baseUrl: e, headers: i }), this.uploadFileClient = this.createAxiosUploadClient({ baseUrl: e, headers: i });
|
|
123
123
|
}
|
|
@@ -126,21 +126,21 @@ var l, f;
|
|
|
126
126
|
class p {
|
|
127
127
|
constructor(t) {
|
|
128
128
|
s(this, "subscribers", /* @__PURE__ */ new Set());
|
|
129
|
-
|
|
129
|
+
P(this, l);
|
|
130
130
|
s(this, "initialState");
|
|
131
|
-
|
|
131
|
+
P(this, f);
|
|
132
132
|
s(this, "lifecycleListeners", /* @__PURE__ */ new Map());
|
|
133
133
|
s(this, "emitLifecycle", (t, e) => {
|
|
134
134
|
const i = this.lifecycleListeners.get(t);
|
|
135
135
|
if (i) {
|
|
136
|
-
const
|
|
136
|
+
const a = {
|
|
137
137
|
type: t,
|
|
138
138
|
timestamp: Date.now(),
|
|
139
139
|
data: e
|
|
140
140
|
};
|
|
141
141
|
i.forEach((r) => {
|
|
142
142
|
try {
|
|
143
|
-
r(
|
|
143
|
+
r(a);
|
|
144
144
|
} catch {
|
|
145
145
|
}
|
|
146
146
|
});
|
|
@@ -150,8 +150,8 @@ class p {
|
|
|
150
150
|
Array.from(this.subscribers).forEach((i) => {
|
|
151
151
|
try {
|
|
152
152
|
i(t);
|
|
153
|
-
} catch (
|
|
154
|
-
this.emitLifecycle("error", { error:
|
|
153
|
+
} catch (a) {
|
|
154
|
+
this.emitLifecycle("error", { error: a });
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
});
|
|
@@ -181,7 +181,7 @@ class p {
|
|
|
181
181
|
this.emitLifecycle("beforeUpdate", {
|
|
182
182
|
previousState: h(this, l),
|
|
183
183
|
nextState: t
|
|
184
|
-
}), D(h(this, l), t) || (
|
|
184
|
+
}), D(h(this, l), t) || (C(this, l, t), C(this, f, Date.now()), this.emitLifecycle("stateChange", { state: t }), this.notifySubscribers(t)), this.emitLifecycle("afterUpdate", { state: t });
|
|
185
185
|
});
|
|
186
186
|
// TODO make this provide prev state
|
|
187
187
|
s(this, "setPartial", (t) => {
|
|
@@ -202,7 +202,7 @@ class p {
|
|
|
202
202
|
this.set(this.initialState);
|
|
203
203
|
});
|
|
204
204
|
s(this, "lastUpdated", () => h(this, f));
|
|
205
|
-
|
|
205
|
+
C(this, l, t), this.initialState = t, C(this, f, Date.now()), this.emitLifecycle("init", { initialState: h(this, l) });
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
l = new WeakMap(), f = new WeakMap();
|
|
@@ -219,10 +219,10 @@ class G {
|
|
|
219
219
|
return !!(!((e = this.state.get().contact) != null && e.token) && this.config.collectUserData);
|
|
220
220
|
});
|
|
221
221
|
s(this, "autoCreateUnverifiedUser", async () => {
|
|
222
|
-
var t, e, i,
|
|
222
|
+
var t, e, i, a;
|
|
223
223
|
await this.createUnverifiedContact({
|
|
224
224
|
name: ((e = (t = this.config.user) == null ? void 0 : t.data) == null ? void 0 : e.name) || "Anonymous",
|
|
225
|
-
email: (
|
|
225
|
+
email: (a = (i = this.config.user) == null ? void 0 : i.data) == null ? void 0 : a.email
|
|
226
226
|
});
|
|
227
227
|
});
|
|
228
228
|
s(this, "createUnverifiedContact", async (t) => {
|
|
@@ -237,15 +237,15 @@ class G {
|
|
|
237
237
|
this.state.setPartial({ isCreatingUnverifiedContact: !1 });
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
|
-
var i,
|
|
240
|
+
var i, a, r;
|
|
241
241
|
this.config = t, this.api = e, this.state = new p({
|
|
242
|
-
contact: (i = t.user) != null && i.token ? { token: (
|
|
242
|
+
contact: (i = t.user) != null && i.token ? { token: (a = t.user) == null ? void 0 : a.token } : null,
|
|
243
243
|
isCreatingUnverifiedContact: !1,
|
|
244
244
|
isErrorCreatingUnverifiedContact: !1
|
|
245
245
|
}), !((r = t.user) != null && r.token) && !t.collectUserData && this.autoCreateUnverifiedUser();
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
class
|
|
248
|
+
class v {
|
|
249
249
|
constructor() {
|
|
250
250
|
s(this, "state", new p({
|
|
251
251
|
isPolling: !1,
|
|
@@ -259,7 +259,7 @@ class x {
|
|
|
259
259
|
s(this, "stopPolling", null);
|
|
260
260
|
s(this, "startPolling", (t, e) => {
|
|
261
261
|
if (this.stopPolling) return;
|
|
262
|
-
const i = [],
|
|
262
|
+
const i = [], a = async () => {
|
|
263
263
|
this.abortController = new AbortController(), this.state.setPartial({ isPolling: !0 });
|
|
264
264
|
try {
|
|
265
265
|
await t(this.abortController.signal);
|
|
@@ -270,16 +270,16 @@ class x {
|
|
|
270
270
|
} finally {
|
|
271
271
|
this.state.setPartial({ isPolling: !1 });
|
|
272
272
|
}
|
|
273
|
-
this.abortController.signal.aborted ? console.log("Poller aborted, not scheduling anymore") : i.push(setTimeout(
|
|
273
|
+
this.abortController.signal.aborted ? console.log("Poller aborted, not scheduling anymore") : i.push(setTimeout(a, e));
|
|
274
274
|
};
|
|
275
|
-
|
|
275
|
+
a(), this.stopPolling = () => {
|
|
276
276
|
i.forEach(clearTimeout), this.state.reset();
|
|
277
277
|
};
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return
|
|
281
|
+
function y() {
|
|
282
|
+
return B();
|
|
283
283
|
}
|
|
284
284
|
class j {
|
|
285
285
|
constructor({
|
|
@@ -290,8 +290,8 @@ class j {
|
|
|
290
290
|
s(this, "config");
|
|
291
291
|
s(this, "api");
|
|
292
292
|
s(this, "contactCtx");
|
|
293
|
-
s(this, "activeSessionPoller", new
|
|
294
|
-
s(this, "sessionsRefresher", new
|
|
293
|
+
s(this, "activeSessionPoller", new v());
|
|
294
|
+
s(this, "sessionsRefresher", new v());
|
|
295
295
|
s(this, "sessionState", new p({
|
|
296
296
|
session: null,
|
|
297
297
|
isCreatingSession: !1
|
|
@@ -335,17 +335,17 @@ class j {
|
|
|
335
335
|
const { data: t } = await this.getSessions({ cursor: void 0 });
|
|
336
336
|
if (!t) return;
|
|
337
337
|
const e = [...t.items, ...this.sessionsState.get().data].filter(
|
|
338
|
-
(i,
|
|
338
|
+
(i, a, r) => a === r.findIndex((c) => i.id === c.id)
|
|
339
339
|
);
|
|
340
340
|
this.sessionsState.setPartial({ data: e });
|
|
341
341
|
}, 1e4);
|
|
342
342
|
});
|
|
343
343
|
s(this, "createSession", async () => {
|
|
344
|
-
var i,
|
|
344
|
+
var i, a;
|
|
345
345
|
this.sessionState.setPartial({ session: null, isCreatingSession: !0 });
|
|
346
346
|
const { data: t, error: e } = await this.api.createSession({
|
|
347
347
|
customData: (i = this.config.user) != null && i.externalId ? {
|
|
348
|
-
external_id: (
|
|
348
|
+
external_id: (a = this.config.user) == null ? void 0 : a.externalId
|
|
349
349
|
} : void 0
|
|
350
350
|
});
|
|
351
351
|
return t ? (this.sessionState.setPartial({ session: t, isCreatingSession: !1 }), t) : (console.error("Failed to create session:", e), null);
|
|
@@ -360,7 +360,7 @@ class j {
|
|
|
360
360
|
});
|
|
361
361
|
if (t) {
|
|
362
362
|
const i = [...this.sessionsState.get().data, ...t.items].filter(
|
|
363
|
-
(
|
|
363
|
+
(a, r, c) => r === c.findIndex((d) => a.id === d.id)
|
|
364
364
|
);
|
|
365
365
|
this.sessionsState.setPartial({
|
|
366
366
|
data: i,
|
|
@@ -390,7 +390,7 @@ class u {
|
|
|
390
390
|
s(this, "config");
|
|
391
391
|
s(this, "api");
|
|
392
392
|
s(this, "sessionCtx");
|
|
393
|
-
s(this, "poller", new
|
|
393
|
+
s(this, "poller", new v());
|
|
394
394
|
s(this, "state", new p({
|
|
395
395
|
messages: [],
|
|
396
396
|
isSendingMessage: !1,
|
|
@@ -409,9 +409,9 @@ class u {
|
|
|
409
409
|
});
|
|
410
410
|
});
|
|
411
411
|
s(this, "sendMessage", async (t) => {
|
|
412
|
-
var
|
|
412
|
+
var a, r, c, d, S, m, x, U, A;
|
|
413
413
|
this.sendMessageAbortController = new AbortController();
|
|
414
|
-
const e = this.state.get().isSendingMessage, i = ((
|
|
414
|
+
const e = this.state.get().isSendingMessage, i = ((a = this.sessionCtx.sessionState.get().session) == null ? void 0 : a.assignee.kind) === "ai";
|
|
415
415
|
if (e && i) {
|
|
416
416
|
console.warn("Cannot send messages while awaiting AI response");
|
|
417
417
|
return;
|
|
@@ -429,15 +429,15 @@ class u {
|
|
|
429
429
|
console.error("Failed to create session");
|
|
430
430
|
return;
|
|
431
431
|
}
|
|
432
|
-
const
|
|
433
|
-
if (!
|
|
432
|
+
const I = (c = this.sessionCtx.sessionState.get().session) == null ? void 0 : c.id;
|
|
433
|
+
if (!I) return;
|
|
434
434
|
const { data: o } = await this.api.sendMessage(
|
|
435
435
|
{
|
|
436
436
|
uuid: b.id,
|
|
437
437
|
bot_token: this.config.token,
|
|
438
438
|
headers: this.config.headers,
|
|
439
439
|
query_params: this.config.queryParams,
|
|
440
|
-
session_id:
|
|
440
|
+
session_id: I,
|
|
441
441
|
user: (d = this.config.user) == null ? void 0 : d.data,
|
|
442
442
|
...t
|
|
443
443
|
},
|
|
@@ -451,18 +451,18 @@ class u {
|
|
|
451
451
|
(F) => F.id === g.id
|
|
452
452
|
)) {
|
|
453
453
|
this.state.setPartial({
|
|
454
|
-
lastAIResMightSolveUserIssue: ((
|
|
454
|
+
lastAIResMightSolveUserIssue: ((S = o.autopilotResponse) == null ? void 0 : S.mightSolveUserIssue) || ((m = o.uiResponse) == null ? void 0 : m.mightSolveUserIssue)
|
|
455
455
|
});
|
|
456
456
|
return;
|
|
457
457
|
}
|
|
458
458
|
this.state.setPartial({
|
|
459
459
|
messages: [...w, g],
|
|
460
|
-
lastAIResMightSolveUserIssue: ((
|
|
460
|
+
lastAIResMightSolveUserIssue: ((x = o.autopilotResponse) == null ? void 0 : x.mightSolveUserIssue) || ((U = o.uiResponse) == null ? void 0 : U.mightSolveUserIssue)
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
463
|
} else {
|
|
464
|
-
const g = u.
|
|
465
|
-
((
|
|
464
|
+
const g = u.toBotErrorMessage(
|
|
465
|
+
((A = o == null ? void 0 : o.error) == null ? void 0 : A.message) || "Unknown error occurred"
|
|
466
466
|
), w = this.state.get().messages;
|
|
467
467
|
this.state.setPartial({
|
|
468
468
|
messages: [...w, g]
|
|
@@ -477,14 +477,14 @@ class u {
|
|
|
477
477
|
s(this, "fetchAndSetHistory", async (t, e) => {
|
|
478
478
|
var r;
|
|
479
479
|
this.state.get().messages.length === 0 && this.state.setPartial({ isInitialFetchLoading: !0 });
|
|
480
|
-
const i = (r = this.state.get().messages.at(-1)) == null ? void 0 : r.timestamp, { data:
|
|
480
|
+
const i = (r = this.state.get().messages.at(-1)) == null ? void 0 : r.timestamp, { data: a } = await this.api.getSessionHistory({
|
|
481
481
|
sessionId: t,
|
|
482
482
|
lastMessageTimestamp: i,
|
|
483
483
|
abortSignal: e
|
|
484
484
|
});
|
|
485
|
-
if (
|
|
486
|
-
const c = this.state.get().messages, d =
|
|
487
|
-
(
|
|
485
|
+
if (a && a.length > 0) {
|
|
486
|
+
const c = this.state.get().messages, d = a.map(u.mapHistoryToMessage).filter(
|
|
487
|
+
(S) => !c.some((m) => m.id === S.id)
|
|
488
488
|
);
|
|
489
489
|
this.state.setPartial({
|
|
490
490
|
messages: [...c, ...d]
|
|
@@ -496,24 +496,30 @@ class u {
|
|
|
496
496
|
}
|
|
497
497
|
/** Not the best name but whatever */
|
|
498
498
|
static mapHistoryToMessage(t) {
|
|
499
|
+
var a;
|
|
499
500
|
const e = {
|
|
500
501
|
id: t.publicId,
|
|
501
502
|
timestamp: t.sentAt || "",
|
|
502
503
|
attachments: t.attachments || void 0
|
|
503
504
|
};
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
505
|
+
if (t.sender.kind === "user")
|
|
506
|
+
return {
|
|
507
|
+
...e,
|
|
508
|
+
type: "FROM_USER",
|
|
509
|
+
content: t.content.text || "",
|
|
510
|
+
deliveredAt: t.sentAt || ""
|
|
511
|
+
};
|
|
512
|
+
if (t.sender.kind === "agent")
|
|
513
|
+
return {
|
|
514
|
+
...e,
|
|
515
|
+
type: "FROM_AGENT",
|
|
516
|
+
component: "agent_message",
|
|
517
|
+
data: {
|
|
518
|
+
message: t.content.text || ""
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
const i = (a = t.actionCalls) == null ? void 0 : a.at(-1);
|
|
522
|
+
return {
|
|
517
523
|
...e,
|
|
518
524
|
type: "FROM_BOT",
|
|
519
525
|
component: "bot_message",
|
|
@@ -524,13 +530,14 @@ class u {
|
|
|
524
530
|
avatar: t.sender.avatar || null
|
|
525
531
|
},
|
|
526
532
|
data: {
|
|
527
|
-
message: t.content.text
|
|
533
|
+
message: t.content.text || "",
|
|
534
|
+
action: i ? { name: i.actionName, data: i.result } : void 0
|
|
528
535
|
}
|
|
529
536
|
};
|
|
530
537
|
}
|
|
531
538
|
static toUserMessage(t, e) {
|
|
532
539
|
return {
|
|
533
|
-
id:
|
|
540
|
+
id: y(),
|
|
534
541
|
type: "FROM_USER",
|
|
535
542
|
content: t,
|
|
536
543
|
deliveredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -539,42 +546,36 @@ class u {
|
|
|
539
546
|
};
|
|
540
547
|
}
|
|
541
548
|
static toBotMessage(t) {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
id: P(),
|
|
557
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
558
|
-
component: e.name,
|
|
559
|
-
data: e.request_response
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
return null;
|
|
549
|
+
var e;
|
|
550
|
+
return t.success && t.autopilotResponse ? {
|
|
551
|
+
type: "FROM_BOT",
|
|
552
|
+
id: t.autopilotResponse.id || y(),
|
|
553
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
554
|
+
component: "bot_message",
|
|
555
|
+
data: {
|
|
556
|
+
message: t.autopilotResponse.value.content,
|
|
557
|
+
action: (e = t.uiResponse) != null && e.value.name ? {
|
|
558
|
+
name: t.uiResponse.value.name,
|
|
559
|
+
data: t.uiResponse.value.request_response
|
|
560
|
+
} : void 0
|
|
561
|
+
}
|
|
562
|
+
} : null;
|
|
563
563
|
}
|
|
564
|
-
static
|
|
564
|
+
static toBotErrorMessage(t) {
|
|
565
565
|
return {
|
|
566
566
|
type: "FROM_BOT",
|
|
567
|
-
id:
|
|
567
|
+
id: y(),
|
|
568
568
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
569
569
|
component: "TEXT",
|
|
570
570
|
data: {
|
|
571
571
|
message: t,
|
|
572
|
-
variant: "error"
|
|
572
|
+
variant: "error",
|
|
573
|
+
action: void 0
|
|
573
574
|
}
|
|
574
575
|
};
|
|
575
576
|
}
|
|
576
577
|
}
|
|
577
|
-
class
|
|
578
|
+
class N {
|
|
578
579
|
constructor({
|
|
579
580
|
contactCtx: t,
|
|
580
581
|
sessionCtx: e,
|
|
@@ -608,7 +609,7 @@ class X {
|
|
|
608
609
|
}), this.contactCtx = t, this.sessionCtx = e, this.resetChat = i, this.registerRoutingListener();
|
|
609
610
|
}
|
|
610
611
|
}
|
|
611
|
-
class
|
|
612
|
+
class Q {
|
|
612
613
|
constructor({ config: t }) {
|
|
613
614
|
s(this, "config");
|
|
614
615
|
s(this, "api");
|
|
@@ -630,7 +631,7 @@ class K {
|
|
|
630
631
|
config: this.config,
|
|
631
632
|
api: this.api,
|
|
632
633
|
sessionCtx: this.sessionCtx
|
|
633
|
-
}), this.routerCtx = new
|
|
634
|
+
}), this.routerCtx = new N({
|
|
634
635
|
contactCtx: this.contactCtx,
|
|
635
636
|
sessionCtx: this.sessionCtx,
|
|
636
637
|
resetChat: this.resetChat
|
|
@@ -639,6 +640,6 @@ class K {
|
|
|
639
640
|
}
|
|
640
641
|
export {
|
|
641
642
|
p as P,
|
|
642
|
-
|
|
643
|
+
Q as W
|
|
643
644
|
};
|
|
644
|
-
//# sourceMappingURL=widget.ctx-
|
|
645
|
+
//# sourceMappingURL=widget.ctx-naCIXuET.js.map
|