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