@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.55 → 0.0.1-alpha.56

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.
@@ -0,0 +1,664 @@
1
+ var T = Object.defineProperty, U = Object.defineProperties;
2
+ var j = Object.getOwnPropertyDescriptors;
3
+ var $ = Object.getOwnPropertySymbols;
4
+ var z = Object.prototype.hasOwnProperty, W = Object.prototype.propertyIsEnumerable;
5
+ var R = (n, t, e) => t in n ? T(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, M = (n, t) => {
6
+ for (var e in t || (t = {}))
7
+ z.call(t, e) && R(n, e, t[e]);
8
+ if ($)
9
+ for (var e of $(t))
10
+ W.call(t, e) && R(n, e, t[e]);
11
+ return n;
12
+ }, K = (n, t) => U(n, j(t));
13
+ var d = (n, t, e) => new Promise((s, o) => {
14
+ var r = (i) => {
15
+ try {
16
+ p(e.next(i));
17
+ } catch (a) {
18
+ o(a);
19
+ }
20
+ }, l = (i) => {
21
+ try {
22
+ p(e.throw(i));
23
+ } catch (a) {
24
+ o(a);
25
+ }
26
+ }, p = (i) => i.done ? s(i.value) : Promise.resolve(i.value).then(r, l);
27
+ p((e = e.apply(n, t)).next());
28
+ });
29
+ import { ConversationMessageListItemType as v, ConversationPlatform as _, registerCustomMessageComponent as H } from "@telia-ace/widget-conversation";
30
+ import { readStorage as A, createStorageWriter as F, StorageCategory as G } from "@telia-ace/widget-services";
31
+ import { uuid as k } from "@telia-ace/widget-utilities";
32
+ import { FormBuilder as O, submitButton as D } from "@telia-ace/widget-forms";
33
+ var f = /* @__PURE__ */ ((n) => (n.ContactMethod = "ace-knowledge-bot-contact-method", n.ContactList = "ace-knowledge-bot-contact-list", n.FeedbackList = "ace-knowledge-bot-feedback-list", n.NotificationList = "ace-knowledge-bot-notification-list", n.NoGoodAlternative = "ace-knowledge-bot-no-good-alternative", n))(f || {});
34
+ const J = (n) => {
35
+ if (n) {
36
+ const { type: t, content: e } = n;
37
+ if (t && e)
38
+ return { type: t, content: e };
39
+ }
40
+ }, P = ({
41
+ isUser: n,
42
+ items: t = [],
43
+ meta: e = {}
44
+ }) => {
45
+ const s = k();
46
+ return {
47
+ id: s,
48
+ isUser: n,
49
+ items: t.map((r) => ({
50
+ id: r.id || k(),
51
+ isUser: n,
52
+ groupId: s,
53
+ message: r.message || []
54
+ })),
55
+ meta: e
56
+ };
57
+ }, q = ({
58
+ id: n,
59
+ title: t,
60
+ defaultIcon: e,
61
+ exits: [s],
62
+ exitType: o,
63
+ confirmationText: r,
64
+ expandFormAutomatically: l,
65
+ form: p,
66
+ description: i
67
+ }, a = {}) => {
68
+ const { adapter: h } = s || { Adapter: {} }, { clientName: m = "", settings: y = {}, customClientName: S = "" } = h, { validation: E } = a, c = {
69
+ id: n.toString(),
70
+ title: t,
71
+ description: i,
72
+ symbol: J(e),
73
+ clientName: m === "custom.adapter" ? S : m,
74
+ expanded: !0,
75
+ inline: !0,
76
+ body: {}
77
+ };
78
+ if (m.indexOf("phone") > -1 || m.indexOf("freetext") > -1) {
79
+ const { displayTextBeforeClick: u, textBeforeClick: w } = y;
80
+ u === "true" && (c.expanded = !1, c.title = w), m.indexOf("phone.text") > -1 ? c.body.phoneNumber = y.phoneNumber : c.body.freetext = y.freetext;
81
+ }
82
+ return (m.indexOf("chat.popup") > -1 || m.indexOf("link") > -1 || m === "custom.adapter" && o === "custom") && (c.body = y, c.body.confirmationFallback = r), m.indexOf("ace") > -1 && (c.body = y), p && p.hasValueComponents && (E ? c.body.form = O.fromLegacyForm(n.toString(), p, E).get() : c.body.form = O.fromLegacyForm(n.toString(), p).get(), l || (c.expanded = c.inline = !1), c.body = Y(c, { submit: "Submit" })), a.guideId && (c.body.guideId = a.guideId), c;
83
+ }, Q = (n) => (n == null ? void 0 : n.$type) === "Humany.Matching.Bots.Conversations.GuideListState, Humany.Matching" ? v.LinkList : (n == null ? void 0 : n.$type) === "Humany.Matching.Bots.Conversations.States.GuideFeedbackState, Humany.Matching" ? f.FeedbackList : (n == null ? void 0 : n.$type) === "Humany.Matching.Bots.Conversations.States.ContactState, Humany.Matching" ? f.ContactList : v.ButtonList, X = (n, t) => {
84
+ const { knowledgeBotEndpoint: e } = t.properties();
85
+ if (e)
86
+ return `${e}/conversations`;
87
+ const { data: s } = n.get("$settings");
88
+ if (!s || !s.projection)
89
+ throw new Error("Missing Knowledge Bot endpoint");
90
+ return `${s.projection}/conversations`;
91
+ }, Y = (n, {
92
+ submit: t,
93
+ errors: e,
94
+ meta: s
95
+ }) => {
96
+ var o;
97
+ if ((o = n == null ? void 0 : n.body) != null && o.form) {
98
+ const { body: r } = n, l = new O(r.form);
99
+ return r.form.layout.submit || l.createComponent(D(t, "submit")), e && l.setValidationErrors(e), s && l.setMeta(s), K(M({}, r), {
100
+ form: l.get()
101
+ });
102
+ }
103
+ return (n == null ? void 0 : n.body) || {};
104
+ }, b = ({
105
+ messageId: n,
106
+ message: t,
107
+ group: e
108
+ }) => ({
109
+ id: n,
110
+ message: t,
111
+ groupId: e.id,
112
+ isUser: e.isUser
113
+ }), Z = (n, t) => d(void 0, null, function* () {
114
+ const e = (i, a, h, m = {
115
+ actions: [],
116
+ entryId: a.id,
117
+ groupId: h
118
+ }) => {
119
+ const y = [];
120
+ return m.actions = a.content.items.map((S) => {
121
+ var c;
122
+ const E = {
123
+ label: S.title,
124
+ actionKey: S.actionKey,
125
+ symbol: S.symbol ? S.symbol : void 0
126
+ };
127
+ if (S.data) {
128
+ const u = a.actions[S.actionKey];
129
+ i === f.ContactList ? (y.push(S.data.id), E.data = q(S.data, {
130
+ guideId: (c = u == null ? void 0 : u.guideId) == null ? void 0 : c.toString()
131
+ })) : E.data = S.data;
132
+ }
133
+ return E;
134
+ }), i === f.ContactList && (m.contactMethodIds = y), m;
135
+ }, s = (y, S, ...E) => d(void 0, [y, S, ...E], function* (i, a, h = [], m) {
136
+ const c = k();
137
+ switch (i.type) {
138
+ case "List": {
139
+ const { header: u, items: w, html: x } = i.content, I = [];
140
+ let g = {
141
+ actions: [],
142
+ entryId: i.id,
143
+ groupId: a.id
144
+ };
145
+ if (u && (g.header = u), (w == null ? void 0 : w.length) > 0) {
146
+ const N = Q(i.localState);
147
+ if (g = e(N, i, a.id, g), h.length) {
148
+ const C = h.find((L) => L.tags.includes("paging")), B = h.find((L) => L.tags.includes("fallback"));
149
+ if (C != null && C.content && (a.meta.paging = {
150
+ actions: C.actions,
151
+ items: C.content.items,
152
+ localState: C.localState
153
+ }, C.content.items.forEach((L) => {
154
+ g.actions.push({
155
+ label: L.title,
156
+ actionKey: L.actionKey,
157
+ data: {
158
+ groupId: m ? m.id : a.id
159
+ }
160
+ });
161
+ })), B) {
162
+ const L = B.content.items.find((V) => V.actionKey === "help");
163
+ L && (I.push(b({
164
+ messageId: c,
165
+ message: [
166
+ v.Separator,
167
+ void 0
168
+ ],
169
+ group: a
170
+ })), I.push(b({
171
+ messageId: c,
172
+ message: [
173
+ f.NoGoodAlternative,
174
+ { body: L.title }
175
+ ],
176
+ group: a
177
+ })));
178
+ }
179
+ }
180
+ I.unshift(b({
181
+ messageId: c,
182
+ message: [N, g],
183
+ group: a
184
+ }));
185
+ }
186
+ return x && I.unshift(b({
187
+ messageId: c,
188
+ message: [v.HTML, { body: x }],
189
+ group: a
190
+ })), I;
191
+ }
192
+ case "Text": {
193
+ const u = [];
194
+ if (u.push(b({
195
+ messageId: c,
196
+ message: [
197
+ v.HTML,
198
+ { body: i.content.html }
199
+ ],
200
+ group: a
201
+ })), h.length) {
202
+ const w = h.find((g) => {
203
+ var N;
204
+ return g.type === "List" && ((N = g.localState) == null ? void 0 : N.$type) === "Humany.Matching.Bots.Conversations.States.ContactState, Humany.Matching";
205
+ }), x = h.find((g) => g.tags.includes("dialog")), I = h.find((g) => g.tags.includes("feedback"));
206
+ if (x && u.push(b({
207
+ messageId: c,
208
+ message: [
209
+ v.ButtonList,
210
+ {
211
+ actions: x.content.items.map((g) => ({
212
+ label: g.title,
213
+ actionKey: g.actionKey
214
+ }))
215
+ }
216
+ ],
217
+ group: a
218
+ })), w) {
219
+ const g = e(f.ContactList, w, a.id);
220
+ u.push(b({
221
+ messageId: c,
222
+ message: [v.Separator, void 0],
223
+ group: a
224
+ })), u.push(b({
225
+ messageId: c,
226
+ message: [f.ContactList, g],
227
+ group: a
228
+ }));
229
+ }
230
+ I && (I.content.html && u.push(b({
231
+ messageId: c,
232
+ group: a,
233
+ message: [
234
+ v.HTML,
235
+ {
236
+ body: I.content.html
237
+ }
238
+ ]
239
+ })), u.push(b({
240
+ messageId: c,
241
+ group: a,
242
+ message: [
243
+ f.FeedbackList,
244
+ {
245
+ actions: I.content.items.map((g) => ({
246
+ actionKey: g.actionKey,
247
+ label: g.title
248
+ }))
249
+ }
250
+ ]
251
+ })));
252
+ }
253
+ return u;
254
+ }
255
+ case "Contact":
256
+ return [
257
+ b({
258
+ messageId: c,
259
+ message: [
260
+ f.ContactMethod,
261
+ {
262
+ contactMethodId: i.content.id,
263
+ groupId: a.id,
264
+ guideId: i.content.guideId
265
+ }
266
+ ],
267
+ group: a
268
+ })
269
+ ];
270
+ case "CategorizedNoticeList": {
271
+ const u = [
272
+ b({
273
+ messageId: c,
274
+ message: [
275
+ f.NotificationList,
276
+ {
277
+ id: i.content.item.id.toString(),
278
+ header: i.content.item.title,
279
+ items: i.content.item.listNotices,
280
+ symbol: i.content.item.defaultIcon
281
+ }
282
+ ],
283
+ group: a
284
+ })
285
+ ];
286
+ return (i.content.notices || []).forEach((w) => {
287
+ u.push(b({
288
+ messageId: c,
289
+ message: [
290
+ v.HTML,
291
+ {
292
+ body: w.body
293
+ }
294
+ ],
295
+ group: a
296
+ }));
297
+ }), u;
298
+ }
299
+ case "footerNotice":
300
+ return [
301
+ b({
302
+ messageId: c,
303
+ message: [
304
+ v.HTML,
305
+ {
306
+ body: i.content.item.body
307
+ }
308
+ ],
309
+ group: a
310
+ })
311
+ ];
312
+ case "Error":
313
+ return [
314
+ b({
315
+ messageId: c,
316
+ message: [
317
+ v.HTML,
318
+ {
319
+ body: i.content.message || "Something went wrong."
320
+ }
321
+ ],
322
+ group: a
323
+ })
324
+ ];
325
+ default:
326
+ return [];
327
+ }
328
+ }), o = (i) => ["CategorizedNoticeList", "NoticeList"].includes(i.type) ? (i.content.items || []).reduce((a, h) => (i.content.isInitialNotices && a.push(K(M({}, i), {
329
+ id: k(),
330
+ type: h.type || i.type,
331
+ content: {
332
+ $type: i.content.$type,
333
+ isInitialNotices: i.content.isInitialNotices,
334
+ notices: h.notices,
335
+ item: h
336
+ }
337
+ })), a), []) : i, r = /* @__PURE__ */ new Map([
338
+ ["Text", 1],
339
+ ["List", 2],
340
+ ["Contact", 3],
341
+ ["CategorizedNoticeList", 10]
342
+ ]), l = [], p = n.sort((i, a) => {
343
+ var m = r.get(i.type) || 20, y = r.get(a.type) || 20;
344
+ return m - y;
345
+ }).filter((i) => !i.relation).reduce((i, a) => i.concat(o(a)), []);
346
+ for (const i of p) {
347
+ const a = n.filter((y) => y.relation === i.id), h = P({ isUser: !1 });
348
+ (yield s(i, h, a, t)).forEach((y) => {
349
+ h.items.push(y);
350
+ }), h.items.length && l.push(h);
351
+ }
352
+ return l;
353
+ });
354
+ class tt {
355
+ constructor(t, e, s, o) {
356
+ this.endpoint = t, this.events = e, this.store = s, this.container = o, this.clientId = k(), this.entries = [];
357
+ }
358
+ start() {
359
+ return d(this, null, function* () {
360
+ const t = yield this.store.read();
361
+ if (t && t.length > 0) {
362
+ const e = this.store.readGlobalState();
363
+ return this.globalState = e, t;
364
+ } else {
365
+ const e = this.createInitialEnvelope();
366
+ return yield this.postEnvelope(e);
367
+ }
368
+ });
369
+ }
370
+ sendMessage(t) {
371
+ return d(this, null, function* () {
372
+ const e = {
373
+ command: { phrase: t },
374
+ globalState: this.globalState,
375
+ clientId: this.clientId
376
+ };
377
+ return yield this.postEnvelope(e);
378
+ });
379
+ }
380
+ helpAction() {
381
+ return d(this, null, function* () {
382
+ return this.postEnvelope({
383
+ action: {
384
+ key: "help",
385
+ content: {
386
+ $type: "Humany.Matching.Bots.Conversations.Actions.Help, Humany.Matching"
387
+ }
388
+ },
389
+ globalState: this.globalState,
390
+ clientId: this.clientId
391
+ });
392
+ });
393
+ }
394
+ nextAction(t) {
395
+ return d(this, null, function* () {
396
+ var s;
397
+ const { paging: e } = t.meta;
398
+ if (!!((s = e.actions) != null && s.next))
399
+ return this.postEnvelope({
400
+ action: {
401
+ key: "next",
402
+ content: e.actions.next
403
+ },
404
+ localState: e.localState,
405
+ globalState: this.globalState,
406
+ clientId: this.clientId
407
+ }, t).then((o) => {
408
+ const r = t.items.findIndex((l) => l.message[0] === "link-list");
409
+ return r === -1 || !o ? t : K(M({}, t), {
410
+ meta: M(M({}, t.meta), o[0].meta),
411
+ items: [
412
+ ...t.items.slice(0, r),
413
+ K(M({}, t.items[r]), {
414
+ message: [
415
+ o[0].items[0].message[0],
416
+ M(M({}, t.items[r].message[1]), o[0].items[0].message[1])
417
+ ]
418
+ }),
419
+ ...t.items.slice(r + 1)
420
+ ]
421
+ });
422
+ });
423
+ });
424
+ }
425
+ showContactMethodAction(t) {
426
+ return d(this, null, function* () {
427
+ const e = this.entries.find((o) => o.id === t.entryId), s = e == null ? void 0 : e.actions[t.actionKey];
428
+ if (!!s)
429
+ return this.postEnvelope({
430
+ action: {
431
+ key: t.actionKey,
432
+ content: s
433
+ },
434
+ localState: e.localState,
435
+ globalState: this.globalState,
436
+ clientId: this.clientId
437
+ });
438
+ });
439
+ }
440
+ defaultAction(t) {
441
+ return d(this, null, function* () {
442
+ const e = this.getEntryOfAction(t);
443
+ if (!!e)
444
+ return this.postEnvelope({
445
+ action: {
446
+ key: t,
447
+ content: e.actions[t]
448
+ },
449
+ localState: e.localState,
450
+ globalState: this.globalState,
451
+ clientId: this.clientId
452
+ });
453
+ });
454
+ }
455
+ createInitialEnvelope() {
456
+ return {
457
+ command: { site: this.endpoint },
458
+ clientId: this.clientId,
459
+ globalState: {},
460
+ funnel: this.container.get("$widget").name
461
+ };
462
+ }
463
+ postEnvelope(t, e) {
464
+ return d(this, null, function* () {
465
+ try {
466
+ const s = yield fetch(this.endpoint, this.getHttpOptions(t));
467
+ if (!s.ok)
468
+ throw s;
469
+ const o = yield s.json();
470
+ return this.handleResponse(o, e);
471
+ } catch (s) {
472
+ process.env.NODE_ENV !== "production" && console.warn("Something went wrong when posting the envelope.");
473
+ let o = "Something went wrong";
474
+ return s.message === "Failed to fetch" && (o = "Lost connection... Please try again."), this.handleResponse({
475
+ entries: [
476
+ {
477
+ id: k(),
478
+ type: "Error",
479
+ timestamp: new Date().toISOString(),
480
+ content: {
481
+ message: o
482
+ },
483
+ actions: {},
484
+ tags: []
485
+ }
486
+ ]
487
+ });
488
+ }
489
+ });
490
+ }
491
+ handleResponse(t, e) {
492
+ return d(this, null, function* () {
493
+ this.entries = this.entries.concat(t.entries);
494
+ const s = t.entries.find((r) => r.type === "Widget");
495
+ return s && this.events.dispatch("provider:widget-entry", s.content), t.globalState && (this.globalState = t.globalState), yield Z(t.entries, e);
496
+ });
497
+ }
498
+ getHttpOptions(t) {
499
+ const e = {
500
+ method: "POST",
501
+ headers: {
502
+ Accept: "application/json",
503
+ "Content-Type": "application/json"
504
+ }
505
+ };
506
+ return t.funnel = this.container.get("$widget").name, Object.assign({}, e, {
507
+ body: JSON.stringify(t),
508
+ credentials: "same-origin"
509
+ });
510
+ }
511
+ getEntryOfAction(t) {
512
+ return this.entries.find((e) => !!e.actions[t]);
513
+ }
514
+ }
515
+ class et {
516
+ constructor(t) {
517
+ this.container = t, this.enabled = !1, this.sessionMessageStorageVariable = "knowledge-bot-messages", this.botProviderGlobalStateKey = "bot-provider-global-state", this.botProviderMetaStateKey = "bot-provider-conversation-meta";
518
+ }
519
+ readGlobalState() {
520
+ return d(this, null, function* () {
521
+ return this.enabled ? yield A(this.container, this.botProviderGlobalStateKey) : void 0;
522
+ });
523
+ }
524
+ readMetaState() {
525
+ return d(this, null, function* () {
526
+ if (!!this.enabled)
527
+ return A(this.container, this.botProviderMetaStateKey);
528
+ });
529
+ }
530
+ write(t) {
531
+ return d(this, null, function* () {
532
+ if (!!this.enabled)
533
+ return F(this.container, this.sessionMessageStorageVariable, G.Necessary).then((e) => e(t));
534
+ });
535
+ }
536
+ read() {
537
+ return d(this, null, function* () {
538
+ return this.enabled ? A(this.container, this.sessionMessageStorageVariable).then((t) => t || []) : [];
539
+ });
540
+ }
541
+ }
542
+ class nt {
543
+ constructor(t, e, s) {
544
+ this.container = t, this.conversation = e, this.groups = [];
545
+ const { events: o } = this.container.get("$widget");
546
+ this.events = o, this.store = new et(t), this.agent = e.createAgent({
547
+ name: "",
548
+ avatar: void 0
549
+ }), this.user = e.user;
550
+ const r = X(t, s);
551
+ this.httpClient = new tt(r, o, this.store, this.container), this.events.subscribe("provider:widget-entry", (l, p) => {
552
+ this.onWidgetEntryReceived(p);
553
+ }), this.events.subscribe("provider:open-contact-method", (l, p) => d(this, null, function* () {
554
+ const i = yield this.httpClient.showContactMethodAction(p);
555
+ i && (p.contactMethod.title && this.printUserMessage(p.contactMethod.title), this.onMessagesReceived(i));
556
+ }));
557
+ }
558
+ initialize() {
559
+ return d(this, null, function* () {
560
+ const t = this.conversation.loading(), e = yield this.store.readMetaState();
561
+ e != null && e.agent && this.agent.update({
562
+ name: e.agent.name,
563
+ avatar: e.agent.avatar
564
+ });
565
+ const s = yield this.httpClient.start();
566
+ s && this.onMessagesReceived(s), t();
567
+ });
568
+ }
569
+ onMessagesReceived(t) {
570
+ return d(this, null, function* () {
571
+ this.groups = this.groups.concat(t), yield this.store.write(this.groups), t.forEach((e) => {
572
+ const s = e.items.map((o) => o.message);
573
+ e.isUser ? e.writer = this.user.print(s) : e.writer = this.agent.print(s);
574
+ });
575
+ });
576
+ }
577
+ onInput(t) {
578
+ return d(this, null, function* () {
579
+ const e = typeof t == "string" ? t : t.actionKey;
580
+ switch (e) {
581
+ case "next":
582
+ {
583
+ if (typeof t == "string")
584
+ return;
585
+ const s = this.groups.find((o) => {
586
+ var r;
587
+ return o.id === ((r = t.data) == null ? void 0 : r.groupId);
588
+ });
589
+ if (s) {
590
+ const o = yield this.httpClient.nextAction(s);
591
+ if (o) {
592
+ const r = o.items.map((l) => l.message);
593
+ s.meta.paging = o == null ? void 0 : o.meta.paging, s.writer.update(r);
594
+ }
595
+ }
596
+ }
597
+ break;
598
+ case "help":
599
+ {
600
+ const s = this.conversation.loading(), o = yield this.httpClient.helpAction();
601
+ s(), o && this.onMessagesReceived(o);
602
+ }
603
+ break;
604
+ default:
605
+ {
606
+ typeof t != "string" && t.label && this.printUserMessage(t.label);
607
+ const s = this.conversation.loading(), o = yield this.httpClient.defaultAction(e);
608
+ o && this.onMessagesReceived(o), s();
609
+ }
610
+ break;
611
+ }
612
+ });
613
+ }
614
+ printUserMessage(t) {
615
+ const e = P({
616
+ isUser: !0,
617
+ items: [
618
+ {
619
+ id: k(),
620
+ isUser: !0,
621
+ message: [v.HTML, { body: t }]
622
+ }
623
+ ]
624
+ });
625
+ return this.onMessagesReceived([e]), e;
626
+ }
627
+ onMessageSend(t) {
628
+ return d(this, null, function* () {
629
+ const e = this.conversation.loading(), s = yield this.httpClient.sendMessage(t);
630
+ this.printUserMessage(t), s && this.onMessagesReceived(s), e();
631
+ });
632
+ }
633
+ onWidgetEntryReceived(t) {
634
+ return d(this, null, function* () {
635
+ const e = {
636
+ name: t.agent.name,
637
+ avatar: t.agent.avatar
638
+ };
639
+ this.agent.update(e), (yield F(this.container, "bot-provider-conversation-meta", G.Necessary))({
640
+ agent: e
641
+ });
642
+ });
643
+ }
644
+ }
645
+ const ct = (n) => d(void 0, null, function* () {
646
+ const t = yield _.getInstance(n);
647
+ H(n, f.ContactList, import("./contact-method-list.fa7c8f40.js")), H(n, f.ContactMethod, import("./contact-method.23cd338c.js")), H(n, f.NotificationList, import("./notification-list.976cfcb5.js")), H(n, f.NoGoodAlternative, import("./no-good-alternative.ae1f1e39.js")), H(n, f.FeedbackList, import("./feedback-list.911dcc3c.js")), t.registerProvider("ace-knowledge-bot", (e, s) => {
648
+ const o = new nt(n, e, s);
649
+ o.initialize(), s.actions.watch("conversation.user-submit", (r, l) => {
650
+ o.onMessageSend(r.text);
651
+ }), s.actions.watch("conversation.action", (r, l) => (o.onInput(r), l(r))), s.actions.create("evaluate", (r) => {
652
+ const { events: l } = n.get("$widget");
653
+ l.dispatch("bot-provider:evaluate", r);
654
+ }), s.actions.create("submit", (r) => {
655
+ const { events: l } = n.get("$widget");
656
+ l.dispatch("bot-provider:form-submitted", r);
657
+ });
658
+ });
659
+ });
660
+ export {
661
+ ct as K,
662
+ Y as u
663
+ };
664
+ //# sourceMappingURL=index.1161f855.js.map