@telia-ace/knowledge-widget-bot-provider 0.0.1-next.5 → 0.0.1-next.7
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/{contact-method-list.4ee58573.js → contact-method-list.8a9dd3ec.js} +4 -4
- package/dist/contact-method-list.8a9dd3ec.js.map +1 -0
- package/dist/{contact-method.37f0020e.js → contact-method.baf5a019.js} +14 -14
- package/dist/contact-method.baf5a019.js.map +1 -0
- package/dist/feedback-list.a7f7ec9c.js +72 -0
- package/dist/feedback-list.a7f7ec9c.js.map +1 -0
- package/dist/{index.e647892d.js → index.721ac1d1.js} +122 -120
- package/dist/{index.e647892d.js.map → index.721ac1d1.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/{no-good-alternative.45aa0387.js → no-good-alternative.502e792b.js} +11 -10
- package/dist/no-good-alternative.502e792b.js.map +1 -0
- package/dist/{notification-list.cae1df51.js → notification-list.adec2988.js} +14 -13
- package/dist/notification-list.adec2988.js.map +1 -0
- package/dist/styles.a00306c5.js +12 -0
- package/dist/styles.a00306c5.js.map +1 -0
- package/dist/ui/styles.d.ts +4 -1
- package/package.json +11 -9
- package/dist/contact-method-list.4ee58573.js.map +0 -1
- package/dist/contact-method.37f0020e.js.map +0 -1
- package/dist/feedback-list.29c075b4.js +0 -70
- package/dist/feedback-list.29c075b4.js.map +0 -1
- package/dist/no-good-alternative.45aa0387.js.map +0 -1
- package/dist/notification-list.cae1df51.js.map +0 -1
- package/dist/styles.6c010dfc.js +0 -15
- package/dist/styles.6c010dfc.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var V = Object.defineProperty, j = Object.defineProperties;
|
|
2
2
|
var z = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var R = Object.getOwnPropertySymbols;
|
|
4
4
|
var W = Object.prototype.hasOwnProperty, _ = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
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
6
|
for (var e in t || (t = {}))
|
|
7
|
-
W.call(t, e) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
_.call(t, e) &&
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var b = (
|
|
14
|
-
var m = (
|
|
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((i, s) => {
|
|
15
15
|
var a = (S) => {
|
|
16
16
|
try {
|
|
17
17
|
d(e.next(S));
|
|
@@ -24,50 +24,50 @@ var m = (i, t, e) => new Promise((n, s) => {
|
|
|
24
24
|
} catch (o) {
|
|
25
25
|
s(o);
|
|
26
26
|
}
|
|
27
|
-
}, d = (S) => S.done ?
|
|
28
|
-
d((e = e.apply(
|
|
27
|
+
}, d = (S) => S.done ? i(S.value) : Promise.resolve(S.value).then(a, c);
|
|
28
|
+
d((e = e.apply(n, t)).next());
|
|
29
29
|
});
|
|
30
|
-
import { ConversationMessageListItemType as I, ConversationPlatform as D, registerCustomMessageComponent as
|
|
30
|
+
import { ConversationMessageListItemType as I, ConversationPlatform as D, registerCustomMessageComponent as B } from "@telia-ace/widget-conversation";
|
|
31
31
|
import { readStorage as J, createStorageWriter as F, StorageCategory as T } from "@telia-ace/widget-services";
|
|
32
32
|
import { uuid as N } from "@telia-ace/widget-utilities";
|
|
33
|
-
import { FormBuilder as
|
|
34
|
-
var f = /* @__PURE__ */ ((
|
|
35
|
-
const Q = (
|
|
36
|
-
if (
|
|
37
|
-
const { type: t, content: e } =
|
|
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
38
|
if (t && e)
|
|
39
39
|
return { type: t, content: e };
|
|
40
40
|
}
|
|
41
41
|
}, G = ({
|
|
42
|
-
isUser:
|
|
42
|
+
isUser: n,
|
|
43
43
|
items: t = [],
|
|
44
44
|
meta: e = {}
|
|
45
45
|
}) => {
|
|
46
|
-
const
|
|
46
|
+
const i = N();
|
|
47
47
|
return {
|
|
48
|
-
id:
|
|
49
|
-
isUser:
|
|
48
|
+
id: i,
|
|
49
|
+
isUser: n,
|
|
50
50
|
items: t.map((a) => ({
|
|
51
51
|
id: a.id || N(),
|
|
52
|
-
isUser:
|
|
53
|
-
groupId:
|
|
52
|
+
isUser: n,
|
|
53
|
+
groupId: i,
|
|
54
54
|
message: a.message || []
|
|
55
55
|
})),
|
|
56
56
|
meta: e
|
|
57
57
|
};
|
|
58
58
|
}, X = ({
|
|
59
|
-
id:
|
|
59
|
+
id: n,
|
|
60
60
|
title: t,
|
|
61
61
|
defaultIcon: e,
|
|
62
|
-
exits: [
|
|
62
|
+
exits: [i],
|
|
63
63
|
exitType: s,
|
|
64
64
|
confirmationText: a,
|
|
65
65
|
expandFormAutomatically: c,
|
|
66
66
|
form: d,
|
|
67
67
|
description: S
|
|
68
68
|
}, o = {}) => {
|
|
69
|
-
const { adapter: r } =
|
|
70
|
-
id:
|
|
69
|
+
const { adapter: r } = i || { Adapter: {} }, { clientName: l = "", settings: v = {}, customClientName: L = "" } = r, { validation: w } = o, p = {
|
|
70
|
+
id: n.toString(),
|
|
71
71
|
title: t,
|
|
72
72
|
description: S,
|
|
73
73
|
symbol: Q(e),
|
|
@@ -80,38 +80,38 @@ const Q = (i) => {
|
|
|
80
80
|
const { displayTextBeforeClick: h, textBeforeClick: g } = v;
|
|
81
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
82
|
}
|
|
83
|
-
return (l.indexOf("chat.popup") > -1 || l.indexOf("link") > -1 || l === "custom.adapter" && s === "custom") && (p.body = v, p.body.confirmationFallback = a), l.indexOf("ace") > -1 && (p.body = v), d && d.hasValueComponents && (w ? p.body.form =
|
|
84
|
-
}, Y = (
|
|
83
|
+
return (l.indexOf("chat.popup") > -1 || l.indexOf("link") > -1 || l === "custom.adapter" && s === "custom") && (p.body = v, p.body.confirmationFallback = a), l.indexOf("ace") > -1 && (p.body = v), d && d.hasValueComponents && (w ? p.body.form = A.fromLegacyForm(n.toString(), d, w).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) => (n == null ? void 0 : n.$type) === "Humany.Matching.Bots.Conversations.GuideListState, Humany.Matching" ? I.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 : I.ButtonList, Z = (n, t) => {
|
|
85
85
|
const { knowledgeBotEndpoint: e } = t.properties();
|
|
86
86
|
if (e)
|
|
87
87
|
return `${e}/conversations`;
|
|
88
|
-
const { data:
|
|
89
|
-
if (!
|
|
88
|
+
const { data: i } = n.get("$settings");
|
|
89
|
+
if (!i || !i.projection)
|
|
90
90
|
throw new Error("Missing Knowledge Bot endpoint");
|
|
91
|
-
return `${
|
|
92
|
-
}, tt = (
|
|
91
|
+
return `${i.projection}/conversations`;
|
|
92
|
+
}, tt = (n, {
|
|
93
93
|
submit: t,
|
|
94
94
|
errors: e,
|
|
95
|
-
meta:
|
|
95
|
+
meta: i
|
|
96
96
|
}) => {
|
|
97
97
|
var s;
|
|
98
|
-
if ((s =
|
|
99
|
-
const { body: a } =
|
|
100
|
-
return a.form.layout.submit || c.createComponent(q(t, "submit")), e && c.setValidationErrors(e),
|
|
98
|
+
if ((s = n == null ? void 0 : n.body) != null && s.form) {
|
|
99
|
+
const { body: a } = n, c = new A(a.form);
|
|
100
|
+
return a.form.layout.submit || c.createComponent(q(t, "submit")), e && c.setValidationErrors(e), i && c.setMeta(i), $(K({}, a), {
|
|
101
101
|
form: c.get()
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
return (
|
|
104
|
+
return (n == null ? void 0 : n.body) || {};
|
|
105
105
|
}, y = ({
|
|
106
|
-
messageId:
|
|
106
|
+
messageId: n,
|
|
107
107
|
message: t,
|
|
108
108
|
group: e
|
|
109
109
|
}) => ({
|
|
110
|
-
id:
|
|
110
|
+
id: n,
|
|
111
111
|
message: t,
|
|
112
112
|
groupId: e.id,
|
|
113
113
|
isUser: e.isUser
|
|
114
|
-
}), et = (
|
|
114
|
+
}), et = (n, t) => m(void 0, null, function* () {
|
|
115
115
|
const e = (o, r, l, v = {
|
|
116
116
|
actions: [],
|
|
117
117
|
entryId: r.id,
|
|
@@ -133,7 +133,7 @@ const Q = (i) => {
|
|
|
133
133
|
}
|
|
134
134
|
return p;
|
|
135
135
|
}), o === f.ContactList && (v.contactMethodIds = L), v;
|
|
136
|
-
},
|
|
136
|
+
}, i = (L, w, ...p) => m(void 0, [L, w, ...p], function* (o, r, l = [], v) {
|
|
137
137
|
const h = N();
|
|
138
138
|
switch (o.type) {
|
|
139
139
|
case "List": {
|
|
@@ -146,7 +146,7 @@ const Q = (i) => {
|
|
|
146
146
|
if (g && (E.header = g), (x == null ? void 0 : x.length) > 0) {
|
|
147
147
|
const u = Y(o.localState);
|
|
148
148
|
if (E = e(u, o, r.id, E), l.length) {
|
|
149
|
-
const k = l.find((M) => M.tags.includes("paging")),
|
|
149
|
+
const k = l.find((M) => M.tags.includes("paging")), O = l.find((M) => M.tags.includes("fallback"));
|
|
150
150
|
if (k != null && k.content && (r.meta.paging = {
|
|
151
151
|
actions: k.actions,
|
|
152
152
|
items: k.content.items,
|
|
@@ -159,8 +159,8 @@ const Q = (i) => {
|
|
|
159
159
|
groupId: v ? v.id : r.id
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
|
-
})),
|
|
163
|
-
const M =
|
|
162
|
+
})), O) {
|
|
163
|
+
const M = O.content.items.find(
|
|
164
164
|
(U) => U.actionKey === "help"
|
|
165
165
|
);
|
|
166
166
|
M && (C.push(
|
|
@@ -371,7 +371,7 @@ const Q = (i) => {
|
|
|
371
371
|
default:
|
|
372
372
|
return [];
|
|
373
373
|
}
|
|
374
|
-
}), s = (o) => ["CategorizedNoticeList", "NoticeList"].includes(o.type) ? (o.content.items || []).reduce((r, l) => (o.content.isInitialNotices && r.push(
|
|
374
|
+
}), s = (o) => ["CategorizedNoticeList", "NoticeList"].includes(o.type) ? (o.content.items || []).reduce((r, l) => (o.content.isInitialNotices && r.push($(K({}, o), {
|
|
375
375
|
id: N(),
|
|
376
376
|
type: l.type || o.type,
|
|
377
377
|
content: {
|
|
@@ -385,32 +385,32 @@ const Q = (i) => {
|
|
|
385
385
|
["List", 2],
|
|
386
386
|
["Contact", 3],
|
|
387
387
|
["CategorizedNoticeList", 10]
|
|
388
|
-
]), c = [], d =
|
|
388
|
+
]), c = [], d = n.sort((o, r) => {
|
|
389
389
|
var v = a.get(o.type) || 20, L = a.get(r.type) || 20;
|
|
390
390
|
return v - L;
|
|
391
391
|
}).filter((o) => !o.relation).reduce((o, r) => o.concat(s(r)), []), S = (o) => typeof o.actions.selector != "undefined";
|
|
392
392
|
for (const o of d) {
|
|
393
|
-
const r =
|
|
393
|
+
const r = n.filter(
|
|
394
394
|
(L) => L.relation === o.id && !S(L)
|
|
395
395
|
), l = G({ isUser: !1 });
|
|
396
|
-
(yield
|
|
396
|
+
(yield i(o, l, r, t)).forEach((L) => {
|
|
397
397
|
l.items.push(L);
|
|
398
398
|
}), l.items.length && c.push(l);
|
|
399
399
|
}
|
|
400
400
|
return c;
|
|
401
401
|
});
|
|
402
|
-
class
|
|
403
|
-
constructor(t, e,
|
|
402
|
+
class nt {
|
|
403
|
+
constructor(t, e, i, s) {
|
|
404
404
|
b(this, "globalState");
|
|
405
405
|
b(this, "localState");
|
|
406
406
|
b(this, "clientId");
|
|
407
407
|
b(this, "entries");
|
|
408
|
-
this.endpoint = t, this.events = e, this.store =
|
|
408
|
+
this.endpoint = t, this.events = e, this.store = i, this.container = s, this.clientId = N(), this.entries = [];
|
|
409
409
|
}
|
|
410
410
|
start(e) {
|
|
411
411
|
return m(this, arguments, function* ({ silent: t }) {
|
|
412
|
-
const
|
|
413
|
-
if (this.globalState =
|
|
412
|
+
const i = yield this.store.read("globalState"), s = yield this.store.read("localState"), a = yield this.store.read("entries");
|
|
413
|
+
if (this.globalState = i || this.globalState, this.localState = s || this.localState, this.entries = a || this.entries, t)
|
|
414
414
|
return;
|
|
415
415
|
const c = this.createInitialEnvelope();
|
|
416
416
|
return yield this.postEnvelope(c);
|
|
@@ -442,9 +442,9 @@ class it {
|
|
|
442
442
|
}
|
|
443
443
|
nextAction(t) {
|
|
444
444
|
return m(this, null, function* () {
|
|
445
|
-
var
|
|
445
|
+
var i;
|
|
446
446
|
const { paging: e } = t.meta;
|
|
447
|
-
if (!!((
|
|
447
|
+
if (!!((i = e.actions) != null && i.next))
|
|
448
448
|
return this.postEnvelope(
|
|
449
449
|
{
|
|
450
450
|
action: {
|
|
@@ -458,11 +458,11 @@ class it {
|
|
|
458
458
|
t
|
|
459
459
|
).then((s) => {
|
|
460
460
|
const a = t.items.findIndex((c) => c.message[0] === "link-list");
|
|
461
|
-
return a === -1 || !s ? t :
|
|
461
|
+
return a === -1 || !s ? t : $(K({}, t), {
|
|
462
462
|
meta: K(K({}, t.meta), s[0].meta),
|
|
463
463
|
items: [
|
|
464
464
|
...t.items.slice(0, a),
|
|
465
|
-
|
|
465
|
+
$(K({}, t.items[a]), {
|
|
466
466
|
message: [
|
|
467
467
|
s[0].items[0].message[0],
|
|
468
468
|
K(K({}, t.items[a].message[1]), s[0].items[0].message[1])
|
|
@@ -476,12 +476,12 @@ class it {
|
|
|
476
476
|
}
|
|
477
477
|
showContactMethodAction(t) {
|
|
478
478
|
return m(this, null, function* () {
|
|
479
|
-
const e = this.entries.find((s) => s.id === t.entryId),
|
|
480
|
-
if (!!
|
|
479
|
+
const e = this.entries.find((s) => s.id === t.entryId), i = e == null ? void 0 : e.actions[t.actionKey];
|
|
480
|
+
if (!!i)
|
|
481
481
|
return this.postEnvelope({
|
|
482
482
|
action: {
|
|
483
483
|
key: t.actionKey,
|
|
484
|
-
content:
|
|
484
|
+
content: i
|
|
485
485
|
},
|
|
486
486
|
localState: e.localState,
|
|
487
487
|
globalState: this.globalState,
|
|
@@ -515,15 +515,15 @@ class it {
|
|
|
515
515
|
postEnvelope(t, e) {
|
|
516
516
|
return m(this, null, function* () {
|
|
517
517
|
try {
|
|
518
|
-
const
|
|
519
|
-
if (!
|
|
520
|
-
throw
|
|
521
|
-
const s = yield
|
|
518
|
+
const i = yield fetch(this.endpoint, this.getHttpOptions(t));
|
|
519
|
+
if (!i.ok)
|
|
520
|
+
throw i;
|
|
521
|
+
const s = yield i.json();
|
|
522
522
|
return this.handleResponse(s, e);
|
|
523
|
-
} catch (
|
|
523
|
+
} catch (i) {
|
|
524
524
|
process.env.NODE_ENV !== "production" && console.warn("Something went wrong when posting the envelope.");
|
|
525
525
|
let s = "Something went wrong";
|
|
526
|
-
return (
|
|
526
|
+
return (i.message === "Failed to fetch" || i.message === "NetworkError when attempting to fetch resource.") && (s = "Lost connection... Please try again."), this.handleResponse({
|
|
527
527
|
entries: [
|
|
528
528
|
{
|
|
529
529
|
id: N(),
|
|
@@ -543,8 +543,8 @@ class it {
|
|
|
543
543
|
handleResponse(t, e) {
|
|
544
544
|
return m(this, null, function* () {
|
|
545
545
|
this.entries = this.entries.concat(t.entries), this.store.write(this.entries, "entries");
|
|
546
|
-
const
|
|
547
|
-
return
|
|
546
|
+
const i = t.entries.find((a) => a.type === "Widget");
|
|
547
|
+
return i && this.events.dispatch("provider:widget-entry", i.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);
|
|
548
548
|
});
|
|
549
549
|
}
|
|
550
550
|
getHttpOptions(t) {
|
|
@@ -564,7 +564,8 @@ class it {
|
|
|
564
564
|
return this.entries.find((e) => !!e.actions[t]);
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
|
|
567
|
+
const it = nt;
|
|
568
|
+
class st {
|
|
568
569
|
constructor(t) {
|
|
569
570
|
b(this, "enabled", !0);
|
|
570
571
|
b(this, "botProviderGlobalStateKey", "bot-provider-global-state");
|
|
@@ -600,15 +601,16 @@ class nt {
|
|
|
600
601
|
}
|
|
601
602
|
write(t, e) {
|
|
602
603
|
return m(this, null, function* () {
|
|
603
|
-
const
|
|
604
|
-
if (!this.enabled || !
|
|
604
|
+
const i = this.getKey(e);
|
|
605
|
+
if (!this.enabled || !i)
|
|
605
606
|
return;
|
|
606
|
-
(yield F(this.container,
|
|
607
|
+
(yield F(this.container, i, T.Necessary))(t);
|
|
607
608
|
});
|
|
608
609
|
}
|
|
609
610
|
}
|
|
610
|
-
|
|
611
|
-
|
|
611
|
+
const ot = st;
|
|
612
|
+
class at {
|
|
613
|
+
constructor(t, e, i) {
|
|
612
614
|
b(this, "agent");
|
|
613
615
|
b(this, "user");
|
|
614
616
|
b(this, "httpClient");
|
|
@@ -617,12 +619,12 @@ class st {
|
|
|
617
619
|
b(this, "store");
|
|
618
620
|
this.container = t, this.conversation = e;
|
|
619
621
|
const { events: s } = this.container.get("$widget");
|
|
620
|
-
this.events = s, this.store = new
|
|
622
|
+
this.events = s, this.store = new ot(t), this.agent = e.createAgent({
|
|
621
623
|
id: "knowledge-bot-agent",
|
|
622
624
|
name: "",
|
|
623
625
|
avatar: void 0
|
|
624
626
|
}), this.user = e.user;
|
|
625
|
-
const a = Z(t,
|
|
627
|
+
const a = Z(t, i);
|
|
626
628
|
this.httpClient = new it(a, s, this.store, this.container), this.events.subscribe("provider:widget-entry", (c, d) => {
|
|
627
629
|
this.onWidgetEntryReceived(d);
|
|
628
630
|
}), this.events.subscribe(
|
|
@@ -641,8 +643,8 @@ class st {
|
|
|
641
643
|
name: e.agent.name,
|
|
642
644
|
avatar: e.agent.avatar
|
|
643
645
|
});
|
|
644
|
-
const
|
|
645
|
-
silent: ((a = this.conversation.options) == null ? void 0 : a.silent) ||
|
|
646
|
+
const i = yield this.conversation.isRehydrated(), s = yield this.httpClient.start({
|
|
647
|
+
silent: ((a = this.conversation.options) == null ? void 0 : a.silent) || i
|
|
646
648
|
});
|
|
647
649
|
s && this.onMessagesReceived(s), t();
|
|
648
650
|
});
|
|
@@ -650,8 +652,8 @@ class st {
|
|
|
650
652
|
onMessagesReceived(t) {
|
|
651
653
|
return m(this, null, function* () {
|
|
652
654
|
this.groups = this.groups.concat(t), t.forEach((e) => {
|
|
653
|
-
const
|
|
654
|
-
e.isUser ? e.writer = this.user.print(
|
|
655
|
+
const i = e.items.map((s) => s.message);
|
|
656
|
+
e.isUser ? e.writer = this.user.print(i) : e.writer = this.agent.print(i);
|
|
655
657
|
});
|
|
656
658
|
});
|
|
657
659
|
}
|
|
@@ -663,30 +665,30 @@ class st {
|
|
|
663
665
|
{
|
|
664
666
|
if (typeof t == "string")
|
|
665
667
|
return;
|
|
666
|
-
const
|
|
668
|
+
const i = this.groups.find((s) => {
|
|
667
669
|
var a;
|
|
668
670
|
return s.id === ((a = t.data) == null ? void 0 : a.groupId);
|
|
669
671
|
});
|
|
670
|
-
if (
|
|
671
|
-
const s = yield this.httpClient.nextAction(
|
|
672
|
+
if (i) {
|
|
673
|
+
const s = yield this.httpClient.nextAction(i);
|
|
672
674
|
if (s) {
|
|
673
675
|
const a = s.items.map((c) => c.message);
|
|
674
|
-
|
|
676
|
+
i.meta.paging = s == null ? void 0 : s.meta.paging, i.writer.update(a);
|
|
675
677
|
}
|
|
676
678
|
}
|
|
677
679
|
}
|
|
678
680
|
break;
|
|
679
681
|
case "help":
|
|
680
682
|
{
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
+
const i = this.conversation.loading(), s = yield this.httpClient.helpAction();
|
|
684
|
+
i(), s && this.onMessagesReceived(s);
|
|
683
685
|
}
|
|
684
686
|
break;
|
|
685
687
|
default:
|
|
686
688
|
{
|
|
687
689
|
typeof t != "string" && t.label && this.printUserMessage(t.label);
|
|
688
|
-
const
|
|
689
|
-
s && this.onMessagesReceived(s),
|
|
690
|
+
const i = this.conversation.loading(), s = yield this.httpClient.defaultAction(e);
|
|
691
|
+
s && this.onMessagesReceived(s), i();
|
|
690
692
|
}
|
|
691
693
|
break;
|
|
692
694
|
}
|
|
@@ -707,8 +709,8 @@ class st {
|
|
|
707
709
|
}
|
|
708
710
|
onMessageSend(t) {
|
|
709
711
|
return m(this, null, function* () {
|
|
710
|
-
const e = this.conversation.loading(),
|
|
711
|
-
this.printUserMessage(t),
|
|
712
|
+
const e = this.conversation.loading(), i = yield this.httpClient.sendMessage(t);
|
|
713
|
+
this.printUserMessage(t), i && this.onMessagesReceived(i), e();
|
|
712
714
|
});
|
|
713
715
|
}
|
|
714
716
|
onWidgetEntryReceived(t) {
|
|
@@ -729,46 +731,46 @@ class st {
|
|
|
729
731
|
});
|
|
730
732
|
}
|
|
731
733
|
}
|
|
732
|
-
const
|
|
733
|
-
const t = yield D.getInstance(
|
|
734
|
-
|
|
735
|
-
|
|
734
|
+
const rt = at, ct = (n) => m(void 0, null, function* () {
|
|
735
|
+
const t = yield D.getInstance(n);
|
|
736
|
+
B(
|
|
737
|
+
n,
|
|
736
738
|
f.ContactList,
|
|
737
|
-
import("./contact-method-list.
|
|
738
|
-
),
|
|
739
|
-
|
|
739
|
+
import("./contact-method-list.8a9dd3ec.js")
|
|
740
|
+
), B(
|
|
741
|
+
n,
|
|
740
742
|
f.ContactMethod,
|
|
741
|
-
import("./contact-method.
|
|
742
|
-
),
|
|
743
|
-
|
|
743
|
+
import("./contact-method.baf5a019.js")
|
|
744
|
+
), B(
|
|
745
|
+
n,
|
|
744
746
|
f.NotificationList,
|
|
745
|
-
import("./notification-list.
|
|
746
|
-
),
|
|
747
|
-
|
|
747
|
+
import("./notification-list.adec2988.js")
|
|
748
|
+
), B(
|
|
749
|
+
n,
|
|
748
750
|
f.NoGoodAlternative,
|
|
749
|
-
import("./no-good-alternative.
|
|
750
|
-
),
|
|
751
|
-
|
|
751
|
+
import("./no-good-alternative.502e792b.js")
|
|
752
|
+
), B(
|
|
753
|
+
n,
|
|
752
754
|
f.FeedbackList,
|
|
753
|
-
import("./feedback-list.
|
|
754
|
-
), t.registerProvider("ace-knowledge-bot", (e,
|
|
755
|
-
const s = new
|
|
755
|
+
import("./feedback-list.a7f7ec9c.js")
|
|
756
|
+
), t.registerProvider("ace-knowledge-bot", (e, i) => {
|
|
757
|
+
const s = new rt(n, e, i);
|
|
756
758
|
s.initialize();
|
|
757
759
|
const a = [];
|
|
758
760
|
return a.push(
|
|
759
|
-
|
|
761
|
+
i.actions.watch("conversation.user-submit", (c, d) => {
|
|
760
762
|
s.onMessageSend(c.text);
|
|
761
763
|
})
|
|
762
764
|
), a.push(
|
|
763
|
-
|
|
765
|
+
i.actions.watch("conversation.action", (c, d) => (s.onInput(c), d(c)))
|
|
764
766
|
), a.push(
|
|
765
|
-
|
|
766
|
-
const { events: d } =
|
|
767
|
+
i.actions.create("evaluate", (c) => {
|
|
768
|
+
const { events: d } = n.get("$widget");
|
|
767
769
|
d.dispatch("bot-provider:evaluate", c);
|
|
768
770
|
})
|
|
769
771
|
), a.push(
|
|
770
|
-
|
|
771
|
-
const { events: d } =
|
|
772
|
+
i.actions.create("submit", (c) => {
|
|
773
|
+
const { events: d } = n.get("$widget");
|
|
772
774
|
d.dispatch("bot-provider:form-submitted", c);
|
|
773
775
|
})
|
|
774
776
|
), () => {
|
|
@@ -777,9 +779,9 @@ const dt = (i) => m(void 0, null, function* () {
|
|
|
777
779
|
});
|
|
778
780
|
};
|
|
779
781
|
});
|
|
780
|
-
});
|
|
782
|
+
}), mt = ct;
|
|
781
783
|
export {
|
|
782
|
-
|
|
784
|
+
mt as K,
|
|
783
785
|
tt as u
|
|
784
786
|
};
|
|
785
|
-
//# sourceMappingURL=index.
|
|
787
|
+
//# sourceMappingURL=index.721ac1d1.js.map
|