@telia-ace/knowledge-widget-bot-provider 0.0.23 → 0.0.24
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.3e8849ee.js → contact-method-list.4fcc98f1.js} +3 -3
- package/dist/{contact-method-list.3e8849ee.js.map → contact-method-list.4fcc98f1.js.map} +1 -1
- package/dist/{contact-method.4c64aaa7.js → contact-method.4e96a7d4.js} +2 -2
- package/dist/{contact-method.4c64aaa7.js.map → contact-method.4e96a7d4.js.map} +1 -1
- package/dist/{index.a97894e5.js → index.483ca2e8.js} +40 -39
- package/dist/index.483ca2e8.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +10 -10
- package/dist/index.a97894e5.js.map +0 -1
|
@@ -30,11 +30,11 @@ import y from "@emotion/styled";
|
|
|
30
30
|
import { ContactList as v, ContactMethod as w } from "@telia-ace/knowledge-widget-adapters";
|
|
31
31
|
import { useDispatch as A, useContainer as K } from "@telia-ace/knowledge-widget-ui";
|
|
32
32
|
import h, { useState as b, useEffect as N } from "react";
|
|
33
|
-
import P from "./contact-method.
|
|
33
|
+
import P from "./contact-method.4e96a7d4.js";
|
|
34
34
|
import "@telia-ace/knowledge-data-client";
|
|
35
35
|
import "@telia-ace/widget-forms";
|
|
36
36
|
import "@telia-ace/widget-utilities";
|
|
37
|
-
import "./index.
|
|
37
|
+
import "./index.483ca2e8.js";
|
|
38
38
|
import "@telia-ace/widget-conversation";
|
|
39
39
|
import "@telia-ace/widget-services";
|
|
40
40
|
const Y = ({ actions: e, entryId: t, groupId: n }) => {
|
|
@@ -125,4 +125,4 @@ const Y = ({ actions: e, entryId: t, groupId: n }) => {
|
|
|
125
125
|
export {
|
|
126
126
|
Y as default
|
|
127
127
|
};
|
|
128
|
-
//# sourceMappingURL=contact-method-list.
|
|
128
|
+
//# sourceMappingURL=contact-method-list.4fcc98f1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-method-list.
|
|
1
|
+
{"version":3,"file":"contact-method-list.4fcc98f1.js","sources":["../src/ui/contact-method-list.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport {\n ContactList,\n ContactMethodType,\n ContactMethod as GenericContactMethod,\n} from '@telia-ace/knowledge-widget-adapters';\nimport { useContainer, useDispatch } from '@telia-ace/knowledge-widget-ui';\nimport React, { useEffect, useState } from 'react';\nimport { ActionItem } from '../types';\nimport ContactMethod from './contact-method';\n\ntype Props = {\n actions: ActionItem[];\n contactMethodIds?: string[];\n entryId: string;\n groupId: string;\n};\nconst ContactMethodList: React.FC<Props> = ({ actions, entryId, groupId }) => {\n const dispatch = useDispatch();\n const container = useContainer();\n const [items, setItems] = useState<any[]>([]);\n const [expanded, setExpanded] = useState<string[]>([]);\n\n useEffect(() => {\n container.getAsync('contactMethods').then((platform: any) => {\n if (!platform) {\n return;\n }\n const promises = actions.map(async (action) => {\n if (!action.data?.clientName) {\n return null;\n }\n const cm = await platform.handleAdapters(action.data);\n\n return {\n ...cm,\n ...action.data,\n description: action.data.description ? action.data.description : cm.description,\n onClick: (event: React.MouseEvent, data: ContactMethodType) => {\n if (typeof cm.onClick === 'function') {\n cm.onClick(event, data);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n if (data.inline && !data.expanded) {\n setExpanded([...expanded, data.id]);\n } else {\n const { events } = container.get('$widget');\n events.dispatch('provider:open-contact-method', {\n entryId,\n contactMethod: data,\n actionKey: action.actionKey,\n });\n }\n },\n };\n });\n\n Promise.all(promises).then((result) => {\n setItems(result.filter((i) => !!i));\n });\n });\n }, [actions, container, entryId, expanded]);\n\n if (!items.length) {\n return null;\n }\n\n return (\n <StyledContactList\n className=\"humany-bot-contact-list\"\n contactMethods={items}\n dispatch={dispatch}\n itemRenderer={(cm: any, props: any) => {\n const isExpanded = expanded.includes(cm.id) || cm.expanded;\n if (isExpanded && cm.inline) {\n return (\n <StyledContactMethod\n contactMethodId={cm.id}\n groupId={groupId}\n guideId={cm.body.guideId}\n />\n );\n }\n return <StyledGenericContactMethod {...cm} {...props} />;\n }}\n />\n );\n};\n\nexport default ContactMethodList;\n\nconst StyledContactList = styled(ContactList)`\n > ul > li {\n a {\n display: flex;\n align-items: center;\n outline-offset: -2px;\n }\n\n &:not(:last-child) {\n ${(p) => p.theme.border && `border-bottom: ${p.theme.border};`}\n }\n }\n`;\n\nconst StyledContactMethod = styled(ContactMethod)`\n i {\n margin: 0 ${(p) => p.theme.sizes?.medium} 0 0;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n`;\nconst StyledGenericContactMethod = styled(GenericContactMethod)`\n padding: ${(p) => p.theme.sizes?.medium};\n i {\n margin: 0 ${(p) => p.theme.sizes?.medium} 0 0;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n`;\n"],"names":["ContactMethodList","actions","entryId","groupId","dispatch","useDispatch","container","useContainer","items","setItems","useState","expanded","setExpanded","useEffect","platform","promises","action","__async","_a","cm","__spreadProps","__spreadValues","event","data","events","result","i","React","StyledContactList","props","StyledContactMethod","StyledGenericContactMethod","styled","ContactList","p","ContactMethod","GenericContactMethod"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAMA,IAAqC,CAAC,EAAE,SAAAC,GAAS,SAAAC,GAAS,SAAAC,QAAc;AAC1E,QAAMC,IAAWC,KACXC,IAAYC,KACZ,CAACC,GAAOC,CAAQ,IAAIC,EAAgB,CAAE,CAAA,GACtC,CAACC,GAAUC,CAAW,IAAIF,EAAmB,CAAE,CAAA;AA6CjD,SA3CJG,EAAU,MAAM;AACZ,IAAAP,EAAU,SAAS,gBAAgB,EAAE,KAAK,CAACQ,MAAkB;AACzD,UAAI,CAACA;AACD;AAEJ,YAAMC,IAAWd,EAAQ,IAAI,CAAOe,MAAWC,EAAA;;AACvC,YAAA,GAACC,IAAAF,EAAO,SAAP,QAAAE,EAAa;AACP,iBAAA;AAEX,cAAMC,IAAK,MAAML,EAAS,eAAeE,EAAO,IAAI;A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,EAAA,IApBG;AAuBf,GAIMD,IAAoBI,EAAOC,CAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAS9B,CAACC,MAAMA,EAAE,MAAM,UAAU,kBAAkBA,EAAE,MAAM;AAAA;AAAA;AAAA,GAK3DJ,IAAsBE,EAAOG,CAAa;AAAA;AAAA,oBAE5B,CAACD,MAAM;;AAAA,UAAAhB,IAAAgB,EAAE,MAAM,UAAR,gBAAAhB,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAMpCa,IAA6BC,EAAOI,CAAoB;AAAA,eAC/C,CAACF,MAAM;;AAAA,UAAAhB,IAAAgB,EAAE,MAAM,UAAR,gBAAAhB,EAAe;AAAA;AAAA;AAAA,oBAEjB,CAACgB,MAAM;;AAAA,UAAAhB,IAAAgB,EAAE,MAAM,UAAR,gBAAAhB,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -33,7 +33,7 @@ import { useContainer as H, useDispatch as J, useConversation as K } from "@teli
|
|
|
33
33
|
import { FormBuilder as L } from "@telia-ace/widget-forms";
|
|
34
34
|
import { appendClassNames as O } from "@telia-ace/widget-utilities";
|
|
35
35
|
import P, { useState as Q, useRef as U, useEffect as z, useCallback as W } from "react";
|
|
36
|
-
import { u as A } from "./index.
|
|
36
|
+
import { u as A } from "./index.483ca2e8.js";
|
|
37
37
|
import "@telia-ace/widget-conversation";
|
|
38
38
|
import "@telia-ace/widget-services";
|
|
39
39
|
const ct = ({ contactMethodId: e, guideId: t, groupId: r, className: h }) => {
|
|
@@ -133,4 +133,4 @@ const ct = ({ contactMethodId: e, guideId: t, groupId: r, className: h }) => {
|
|
|
133
133
|
export {
|
|
134
134
|
ct as default
|
|
135
135
|
};
|
|
136
|
-
//# sourceMappingURL=contact-method.
|
|
136
|
+
//# sourceMappingURL=contact-method.4e96a7d4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-method.
|
|
1
|
+
{"version":3,"file":"contact-method.4e96a7d4.js","sources":["../src/ui/contact-method.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { DataClient, DataType } from '@telia-ace/knowledge-data-client';\nimport {\n ContactMethodPlatform,\n ContactMethod as GenericContactMethod,\n} from '@telia-ace/knowledge-widget-adapters';\nimport { useContainer, useConversation, useDispatch } from '@telia-ace/knowledge-widget-ui';\nimport { FormBuilder } from '@telia-ace/widget-forms';\nimport { appendClassNames } from '@telia-ace/widget-utilities';\nimport { Widget } from '@webprovisions/platform';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { updateForm } from '../utils';\n\ntype Props = {\n contactMethodId: string;\n groupId: string;\n guideId?: string;\n className?: string;\n};\nconst ContactMethod: React.FC<Props> = ({ contactMethodId, guideId, groupId, className }) => {\n const [contactMethod, setContactMethod] = useState<any>();\n const container = useContainer();\n const dispatch = useDispatch();\n const mountedRef = useRef<boolean>(true);\n const currentConversation = useConversation();\n\n useEffect(() => {\n const { events } = container.get('$widget') as Widget;\n\n const unsubscribe = events.subscribe('bot-provider:form-submitted', async (_, data) => {\n // making sure that this is the form that is submitted\n if (data.form.meta?.groupId !== groupId || data.id !== contactMethod.id) {\n return;\n }\n\n if (currentConversation) {\n if (!data.form.meta) {\n data.form.meta = {};\n }\n\n data.form.meta.conversation = currentConversation;\n }\n\n const platform = (await container.getAsync('contactMethods')) as ContactMethodPlatform;\n\n const updatedMethod = {\n ...contactMethod,\n body: {\n ...contactMethod.body,\n form: data.form,\n },\n };\n\n const { errors, valid, errorTypes } = await platform.validate(updatedMethod);\n\n if (!valid) {\n const builder = new FormBuilder(contactMethod.body.form);\n setContactMethod(undefined);\n\n builder.setValidationErrors(errors);\n\n updatedMethod.body = {\n ...updatedMethod.body,\n form: builder.get(),\n };\n\n setContactMethod({ ...updatedMethod });\n return;\n }\n\n const result = await platform.submit(updatedMethod);\n\n updatedMethod.confirmation = result;\n setContactMethod(updatedMethod);\n });\n\n const unsubscribeEvaluate = events.subscribe('bot-provider:evaluate', async (_, data) => {\n if (data.id != contactMethodId) {\n return;\n }\n\n const platform = (await container.getAsync('contactMethods')) as ContactMethodPlatform;\n\n const updatedForm = await platform.evaluate(contactMethod);\n\n let updatedMethod = {\n ...contactMethod,\n body: {\n ...contactMethod.body,\n form: updatedForm,\n },\n };\n\n const updatedBody = updateForm(updatedMethod, {\n submit: 'Submit',\n errors: {},\n meta: { groupId },\n });\n\n updatedMethod = {\n ...updatedMethod,\n body: updatedBody,\n };\n\n setContactMethod(updatedMethod);\n });\n\n return () => {\n unsubscribe();\n unsubscribeEvaluate();\n };\n }, [container, contactMethod, setContactMethod, currentConversation]);\n\n const fetchContactMethod = useCallback(\n async (id: string) => {\n const dataClient = await DataClient.getInstance(container);\n\n const cm = await dataClient.fetch(\n DataType.ContactMethod,\n {\n contactMethodId: id,\n guideId,\n },\n { noCache: true }\n );\n\n const body = updateForm(cm, {\n submit: 'Submit',\n errors: {},\n meta: { groupId },\n });\n cm.body = body;\n cm.body.guideId = guideId;\n\n if (!mountedRef.current) {\n return null;\n }\n setContactMethod(cm);\n },\n [mountedRef]\n );\n\n useEffect(() => {\n fetchContactMethod(contactMethodId);\n return () => {\n mountedRef.current = false; // clean up\n };\n }, [contactMethodId, fetchContactMethod]);\n\n if (!contactMethod) {\n return null;\n }\n return (\n <StyledGenericContactMethod\n {...contactMethod}\n body={{\n ...contactMethod.body,\n form: contactMethod.body.form\n ? {\n ...contactMethod.body.form,\n data: contactMethod.body.form?.data,\n layout: { ...contactMethod.body.form.layout },\n meta: contactMethod.body.form?.meta,\n schema: contactMethod.body.form?.schema,\n }\n : undefined,\n guideId: contactMethod.body.guideId,\n }}\n inline={true}\n expanded={true}\n dispatch={dispatch}\n className={appendClassNames('humany-bot-contact-method', className)}\n />\n );\n};\n\nexport default ContactMethod;\n\nconst StyledGenericContactMethod = styled(GenericContactMethod)`\n padding: ${(p) => p.theme.sizes?.normal} ${(p) => p.theme.sizes?.medium};\n`;\n"],"names":["ContactMethod","contactMethodId","guideId","groupId","className","contactMethod","setContactMethod","useState","container","useContainer","dispatch","useDispatch","mountedRef","useRef","currentConversation","useConversation","useEffect","events","unsubscribe","_","data","__async","_a","platform","updatedMethod","__spreadProps","__spreadValues","errors","valid","errorTypes","builder","FormBuilder","result","unsubscribeEvaluate","updatedForm","updatedBody","updateForm","fetchContactMethod","useCallback","id","cm","DataClient","DataType","body","React","StyledGenericContactMethod","_b","_c","appendClassNames","styled","GenericContactMethod","p"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAMA,KAAiC,CAAC,EAAE,iBAAAC,GAAiB,SAAAC,GAAS,SAAAC,GAAS,WAAAC,QAAgB;;AACzF,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAc,GAClDC,IAAYC,KACZC,IAAWC,KACXC,IAAaC,EAAgB,EAAI,GACjCC,IAAsBC;AAE5B,EAAAC,EAAU,MAAM;AACZ,UAAM,EAAE,QAAAC,EAAW,IAAAT,EAAU,IAAI,SAAS,GAEpCU,IAAcD,EAAO,UAAU,+BAA+B,CAAOE,GAAGC,MAASC,EAAA;;AAE/E,YAAAC,IAAAF,EAAK,KAAK,SAAV,gBAAAE,EAAgB,aAAYnB,KAAWiB,EAAK,OAAOf,EAAc;AACjE;AAGJ,MAAIS,MACKM,EAAK,KAAK,SACNA,EAAA,KAAK,OAAO,KAGhBA,EAAA,KAAK,KAAK,eAAeN;AAGlC,YAAMS,IAAY,MAAMf,EAAU,SAAS,gBAAgB,GAErDgB,IAAgBC,EAAAC,EAAA,IACfrB,IADe;AAAA,QAElB,MAAMoB,EAAAC,EAAA,IACCrB,EAAc,OADf;AAAA,UAEF,MAAMe,EAAK;AAAA,QACf;AAAA,MAAA,IAGE,EAAE,QAAAO,GAAQ,OAAAC,GAAO,YAAAC,EAAA,IAAe,MAAMN,EAAS,SAASC,CAAa;AAE3E,UAAI,CAACI,GAAO;AACR,cAAME,IAAU,IAAIC,EAAY1B,EA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AA;;AAAM,UAAA7B,IAAA6B,EAAE,MAAM,UAAR,gBAAA7B,EAAe;AAAA;AAAA;"}
|
|
@@ -11,7 +11,7 @@ var O = (s, t, e) => t in s ? _(s, t, { enumerable: !0, configurable: !0, writab
|
|
|
11
11
|
return s;
|
|
12
12
|
}, A = (s, t) => D(s, J(t));
|
|
13
13
|
var f = (s, t, e) => (O(s, typeof t != "symbol" ? t + "" : t, e), e);
|
|
14
|
-
var
|
|
14
|
+
var m = (s, t, e) => new Promise((i, n) => {
|
|
15
15
|
var c = (y) => {
|
|
16
16
|
try {
|
|
17
17
|
h(e.next(y));
|
|
@@ -105,7 +105,7 @@ const tt = (s) => {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
return (s == null ? void 0 : s.body) || {};
|
|
108
|
-
}, z = (s, t, e) =>
|
|
108
|
+
}, z = (s, t, e) => m(void 0, null, function* () {
|
|
109
109
|
(yield (yield s.getAsync("dataClient")).getClient()).parameters.set(t, e);
|
|
110
110
|
}), b = ({
|
|
111
111
|
messageId: s,
|
|
@@ -116,7 +116,7 @@ const tt = (s) => {
|
|
|
116
116
|
message: t,
|
|
117
117
|
groupId: e.id,
|
|
118
118
|
isUser: e.isUser
|
|
119
|
-
}), ot = (s, t, e) =>
|
|
119
|
+
}), ot = (s, t, e) => m(void 0, null, function* () {
|
|
120
120
|
const i = (a, o, l, I = {
|
|
121
121
|
actions: [],
|
|
122
122
|
entryId: o.id,
|
|
@@ -139,7 +139,7 @@ const tt = (s) => {
|
|
|
139
139
|
}
|
|
140
140
|
return P;
|
|
141
141
|
}), a === p.ContactList && (I.contactMethodIds = w), I;
|
|
142
|
-
}, n = (w, d, ...P) =>
|
|
142
|
+
}, n = (w, d, ...P) => m(void 0, [w, d, ...P], function* (a, o, l = [], I) {
|
|
143
143
|
var H, F;
|
|
144
144
|
const g = N();
|
|
145
145
|
switch (a.type !== "List" && a.tags.includes("guide") && ((F = (H = a.content.hints) == null ? void 0 : H[0]) == null ? void 0 : F.id) && (yield z(s, "LastGuideId", a.content.hints[0].id)), a.type) {
|
|
@@ -151,8 +151,8 @@ const tt = (s) => {
|
|
|
151
151
|
groupId: o.id
|
|
152
152
|
};
|
|
153
153
|
if (v && (E.header = v), (x == null ? void 0 : x.length) > 0) {
|
|
154
|
-
const
|
|
155
|
-
if (E = i(
|
|
154
|
+
const u = it(a);
|
|
155
|
+
if (E = i(u, a, o.id, E), l.length) {
|
|
156
156
|
const L = l.find((M) => M.tags.includes("paging")), G = l.find((M) => M.tags.includes("fallback"));
|
|
157
157
|
if (L != null && L.content && (o.meta.paging = {
|
|
158
158
|
actions: L.actions,
|
|
@@ -194,7 +194,7 @@ const tt = (s) => {
|
|
|
194
194
|
C.unshift(
|
|
195
195
|
b({
|
|
196
196
|
messageId: g,
|
|
197
|
-
message: [
|
|
197
|
+
message: [u, E],
|
|
198
198
|
group: o
|
|
199
199
|
})
|
|
200
200
|
);
|
|
@@ -220,12 +220,12 @@ const tt = (s) => {
|
|
|
220
220
|
})
|
|
221
221
|
), l.length) {
|
|
222
222
|
const x = l.find(
|
|
223
|
-
(
|
|
223
|
+
(u) => {
|
|
224
224
|
var L;
|
|
225
|
-
return
|
|
225
|
+
return u.type === "List" && ((L = u.localState) == null ? void 0 : L.$type) === "Humany.Matching.Bots.Conversations.States.ContactState, Humany.Matching";
|
|
226
226
|
}
|
|
227
|
-
), $ = l.find((
|
|
228
|
-
(
|
|
227
|
+
), $ = l.find((u) => u.tags.includes("dialog")), C = l.find((u) => u.tags.includes("feedback")), E = l.find(
|
|
228
|
+
(u) => u.tags.includes("contact") && u.type === "Contact"
|
|
229
229
|
);
|
|
230
230
|
if (E && v.push(
|
|
231
231
|
b({
|
|
@@ -246,16 +246,17 @@ const tt = (s) => {
|
|
|
246
246
|
message: [
|
|
247
247
|
S.ButtonList,
|
|
248
248
|
{
|
|
249
|
-
actions: $.content.items.map((
|
|
250
|
-
label:
|
|
251
|
-
actionKey:
|
|
249
|
+
actions: $.content.items.map((u) => ({
|
|
250
|
+
label: u.title,
|
|
251
|
+
actionKey: u.actionKey,
|
|
252
|
+
data: u.data
|
|
252
253
|
}))
|
|
253
254
|
}
|
|
254
255
|
],
|
|
255
256
|
group: o
|
|
256
257
|
})
|
|
257
258
|
), x) {
|
|
258
|
-
const
|
|
259
|
+
const u = i(
|
|
259
260
|
p.ContactList,
|
|
260
261
|
x,
|
|
261
262
|
o.id
|
|
@@ -269,7 +270,7 @@ const tt = (s) => {
|
|
|
269
270
|
), v.push(
|
|
270
271
|
b({
|
|
271
272
|
messageId: g,
|
|
272
|
-
message: [p.ContactList,
|
|
273
|
+
message: [p.ContactList, u],
|
|
273
274
|
group: o
|
|
274
275
|
})
|
|
275
276
|
);
|
|
@@ -292,9 +293,9 @@ const tt = (s) => {
|
|
|
292
293
|
message: [
|
|
293
294
|
p.FeedbackList,
|
|
294
295
|
{
|
|
295
|
-
actions: C.content.items.map((
|
|
296
|
-
actionKey:
|
|
297
|
-
label:
|
|
296
|
+
actions: C.content.items.map((u) => ({
|
|
297
|
+
actionKey: u.actionKey,
|
|
298
|
+
label: u.title
|
|
298
299
|
}))
|
|
299
300
|
}
|
|
300
301
|
]
|
|
@@ -415,7 +416,7 @@ class at {
|
|
|
415
416
|
this.endpoint = t, this.events = e, this.store = i, this.container = n, this.clientId = N(), this.entries = [];
|
|
416
417
|
}
|
|
417
418
|
start(e) {
|
|
418
|
-
return
|
|
419
|
+
return m(this, arguments, function* ({ silent: t }) {
|
|
419
420
|
const i = yield this.store.read("globalState"), n = yield this.store.read("localState"), c = yield this.store.read("entries");
|
|
420
421
|
if (this.globalState = i || this.globalState, this.localState = n || this.localState, this.entries = c || this.entries, t)
|
|
421
422
|
return;
|
|
@@ -424,7 +425,7 @@ class at {
|
|
|
424
425
|
});
|
|
425
426
|
}
|
|
426
427
|
sendMessage(t) {
|
|
427
|
-
return
|
|
428
|
+
return m(this, null, function* () {
|
|
428
429
|
const e = {
|
|
429
430
|
command: { phrase: t },
|
|
430
431
|
globalState: this.globalState,
|
|
@@ -434,7 +435,7 @@ class at {
|
|
|
434
435
|
});
|
|
435
436
|
}
|
|
436
437
|
helpAction() {
|
|
437
|
-
return
|
|
438
|
+
return m(this, null, function* () {
|
|
438
439
|
return this.postEnvelope({
|
|
439
440
|
action: {
|
|
440
441
|
key: "help",
|
|
@@ -448,7 +449,7 @@ class at {
|
|
|
448
449
|
});
|
|
449
450
|
}
|
|
450
451
|
nextAction(t) {
|
|
451
|
-
return
|
|
452
|
+
return m(this, null, function* () {
|
|
452
453
|
var i;
|
|
453
454
|
const { paging: e } = t.meta;
|
|
454
455
|
if (!!((i = e.actions) != null && i.next))
|
|
@@ -482,7 +483,7 @@ class at {
|
|
|
482
483
|
});
|
|
483
484
|
}
|
|
484
485
|
showContactMethodAction(t) {
|
|
485
|
-
return
|
|
486
|
+
return m(this, null, function* () {
|
|
486
487
|
const e = this.entries.find((n) => n.id === t.entryId), i = e == null ? void 0 : e.actions[t.actionKey];
|
|
487
488
|
if (!!i)
|
|
488
489
|
return this.postEnvelope({
|
|
@@ -497,7 +498,7 @@ class at {
|
|
|
497
498
|
});
|
|
498
499
|
}
|
|
499
500
|
defaultAction(t) {
|
|
500
|
-
return
|
|
501
|
+
return m(this, null, function* () {
|
|
501
502
|
const e = this.getEntryOfAction(t);
|
|
502
503
|
if (!!e)
|
|
503
504
|
return this.postEnvelope({
|
|
@@ -520,7 +521,7 @@ class at {
|
|
|
520
521
|
};
|
|
521
522
|
}
|
|
522
523
|
postEnvelope(t, e) {
|
|
523
|
-
return
|
|
524
|
+
return m(this, null, function* () {
|
|
524
525
|
try {
|
|
525
526
|
const i = yield fetch(this.endpoint, this.getHttpOptions(t));
|
|
526
527
|
if (!i.ok)
|
|
@@ -548,7 +549,7 @@ class at {
|
|
|
548
549
|
});
|
|
549
550
|
}
|
|
550
551
|
handleResponse(t, e) {
|
|
551
|
-
return
|
|
552
|
+
return m(this, null, function* () {
|
|
552
553
|
this.entries = this.entries.concat(t.entries), this.store.write(this.entries, "entries");
|
|
553
554
|
const i = t.entries.find((c) => c.type === "Widget");
|
|
554
555
|
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((c, r) => r.localState ? r.localState : c, void 0), this.store.write(this.localState, "localState"), yield ot(this.container, t.entries, e);
|
|
@@ -600,14 +601,14 @@ class rt {
|
|
|
600
601
|
return e;
|
|
601
602
|
}
|
|
602
603
|
read(t) {
|
|
603
|
-
return
|
|
604
|
+
return m(this, null, function* () {
|
|
604
605
|
const e = this.getKey(t);
|
|
605
606
|
if (!(!this.enabled || !e))
|
|
606
607
|
return Y(this.container, e);
|
|
607
608
|
});
|
|
608
609
|
}
|
|
609
610
|
write(t, e) {
|
|
610
|
-
return
|
|
611
|
+
return m(this, null, function* () {
|
|
611
612
|
const i = this.getKey(e);
|
|
612
613
|
if (!this.enabled || !i)
|
|
613
614
|
return;
|
|
@@ -636,14 +637,14 @@ class dt {
|
|
|
636
637
|
this.onWidgetEntryReceived(h);
|
|
637
638
|
}), this.events.subscribe(
|
|
638
639
|
"provider:open-contact-method",
|
|
639
|
-
(r, h) =>
|
|
640
|
+
(r, h) => m(this, null, function* () {
|
|
640
641
|
const y = yield this.httpClient.showContactMethodAction(h);
|
|
641
642
|
y && (h.contactMethod.title && this.printUserMessage(h.contactMethod.title), this.onMessagesReceived(y));
|
|
642
643
|
})
|
|
643
644
|
);
|
|
644
645
|
}
|
|
645
646
|
initialize() {
|
|
646
|
-
return
|
|
647
|
+
return m(this, null, function* () {
|
|
647
648
|
var c;
|
|
648
649
|
const t = this.conversation.loading(), e = yield this.store.read("meta");
|
|
649
650
|
e != null && e.agent && this.agent.update({
|
|
@@ -657,7 +658,7 @@ class dt {
|
|
|
657
658
|
});
|
|
658
659
|
}
|
|
659
660
|
onMessagesReceived(t) {
|
|
660
|
-
return
|
|
661
|
+
return m(this, null, function* () {
|
|
661
662
|
this.groups = this.groups.concat(t), t.forEach((e) => {
|
|
662
663
|
const i = e.items.map((n) => n.message);
|
|
663
664
|
e.isUser ? e.writer = this.user.print(i) : e.writer = this.agent.print(i);
|
|
@@ -665,7 +666,7 @@ class dt {
|
|
|
665
666
|
});
|
|
666
667
|
}
|
|
667
668
|
onInput(t) {
|
|
668
|
-
return
|
|
669
|
+
return m(this, null, function* () {
|
|
669
670
|
const e = typeof t == "string" ? t : t.actionKey;
|
|
670
671
|
switch (e) {
|
|
671
672
|
case "next":
|
|
@@ -715,13 +716,13 @@ class dt {
|
|
|
715
716
|
return this.onMessagesReceived([e]), e;
|
|
716
717
|
}
|
|
717
718
|
onMessageSend(t) {
|
|
718
|
-
return
|
|
719
|
+
return m(this, null, function* () {
|
|
719
720
|
const e = this.conversation.loading(), i = yield this.httpClient.sendMessage(t);
|
|
720
721
|
yield z(this.container, "phrase", t), this.printUserMessage(t), i && this.onMessagesReceived(i), e();
|
|
721
722
|
});
|
|
722
723
|
}
|
|
723
724
|
onWidgetEntryReceived(t) {
|
|
724
|
-
return
|
|
725
|
+
return m(this, null, function* () {
|
|
725
726
|
if (t.agent) {
|
|
726
727
|
const e = {
|
|
727
728
|
name: t.agent.name,
|
|
@@ -738,16 +739,16 @@ class dt {
|
|
|
738
739
|
});
|
|
739
740
|
}
|
|
740
741
|
}
|
|
741
|
-
const ht = dt, gt = (s) =>
|
|
742
|
+
const ht = dt, gt = (s) => m(void 0, null, function* () {
|
|
742
743
|
const t = yield X.getInstance(s);
|
|
743
744
|
B(
|
|
744
745
|
s,
|
|
745
746
|
p.ContactList,
|
|
746
|
-
import("./contact-method-list.
|
|
747
|
+
import("./contact-method-list.4fcc98f1.js")
|
|
747
748
|
), B(
|
|
748
749
|
s,
|
|
749
750
|
p.ContactMethod,
|
|
750
|
-
import("./contact-method.
|
|
751
|
+
import("./contact-method.4e96a7d4.js")
|
|
751
752
|
), B(
|
|
752
753
|
s,
|
|
753
754
|
p.NotificationList,
|
|
@@ -791,4 +792,4 @@ export {
|
|
|
791
792
|
yt as K,
|
|
792
793
|
nt as u
|
|
793
794
|
};
|
|
794
|
-
//# sourceMappingURL=index.
|
|
795
|
+
//# sourceMappingURL=index.483ca2e8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.483ca2e8.js","sources":["../src/types.ts","../src/utils.ts","../src/entry-handler.ts","../src/http-client.ts","../src/store.ts","../src/provider.ts","../src/plugin.ts"],"sourcesContent":["import { ConversationMessageListItemType } from '@telia-ace/widget-conversation';\n\nexport enum CustomMessageTypes {\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}\n\nexport type LooseObject = { [key: string]: any };\n\nexport interface ActionItem {\n label: string;\n actionKey: string;\n data?: any;\n description?: string;\n}\n\nexport interface MessageGroup {\n id: string;\n isUser: boolean;\n items: MessageGroupItem[];\n writer?: any;\n meta: { [key: string]: any };\n}\n\nexport interface MessageGroupItem {\n id: string;\n groupId: string;\n isUser: boolean;\n message: [ConversationMessageListItemType | CustomMessageTypes, any];\n}\n\nexport interface ClientEnvelope {\n command?: LooseObject;\n action?: {\n key: string;\n content: any;\n };\n globalState?: LooseObject;\n localState?: LooseObject;\n clientId?: string;\n funnel?: string;\n}\n\nexport interface ServerEnvelope {\n clientId?: string | undefined;\n entries: ServerEntry[];\n globalState?: GlobalState;\n resolveCommand?: string;\n clientEnvelope?: ClientEnvelope;\n}\n\nexport interface GlobalState {\n completedInteractionsCount: number;\n lastQuestion?: string;\n lastBotGuide: number;\n lastGuideTitle?: string;\n site: string;\n invincibleParameters: object;\n}\n\nexport interface ServerEntry {\n id: string;\n type: string;\n content: any;\n actions: { [key: string]: any };\n tags: string[];\n relation?: string;\n timestamp: string;\n localState?: { [key: string]: any };\n}\n\nexport interface ListContent {\n header?: string;\n actions: ActionItem[];\n contactMethodIds?: string[];\n entryId: string;\n groupId: string;\n}\n","import { ContactMethodType } from '@telia-ace/knowledge-widget-adapters';\nimport { Symbol } from '@telia-ace/knowledge-widget-ui';\nimport { ConversationMessageListItemType } from '@telia-ace/widget-conversation';\nimport { FormBuilder, submitButton } from '@telia-ace/widget-forms';\nimport { uuid } from '@telia-ace/widget-utilities';\nimport { Container } from '@webprovisions/platform';\nimport { CustomMessageTypes, MessageGroup, MessageGroupItem, ServerEntry } from './types';\n\nconst convertLegacySymbol = (symbol?: { type: string; content: string }): Symbol | undefined => {\n if (symbol) {\n const { type, content } = symbol;\n if (type && content) {\n return { type, content };\n }\n }\n};\n\nexport const createGroup = ({\n isUser,\n items = [],\n meta = {},\n}: {\n isUser: boolean;\n items?: Partial<MessageGroupItem>[];\n meta?: MessageGroup['meta'];\n}) => {\n const groupId = uuid();\n\n const group = {\n id: groupId,\n isUser,\n items: items.map((i) => {\n return {\n id: i.id || uuid(),\n isUser: isUser,\n groupId: groupId,\n message: i.message || [],\n };\n }),\n meta,\n } as MessageGroup;\n\n return group;\n};\n\nexport const contactMethodFromLegacy = (\n {\n id,\n title,\n defaultIcon,\n exits: [exit],\n exitType,\n confirmationText,\n expandFormAutomatically,\n form,\n description,\n }: any,\n options: {\n validation?: any;\n guideId?: string;\n } = {}\n): any => {\n const { adapter } = exit || { Adapter: {} };\n const { clientName = '', settings: adapterSettings = {}, customClientName = '' } = adapter;\n const { validation } = options;\n\n const settings: any = {\n id: id.toString(),\n title: title,\n description: description,\n symbol: convertLegacySymbol(defaultIcon),\n clientName: clientName === 'custom.adapter' ? customClientName : clientName,\n expanded: true,\n inline: true,\n body: {},\n };\n\n if (clientName.indexOf('phone') > -1 || clientName.indexOf('freetext') > -1) {\n const { displayTextBeforeClick, textBeforeClick } = adapterSettings;\n if (displayTextBeforeClick === 'true') {\n settings.expanded = false;\n settings.title = textBeforeClick;\n }\n\n if (clientName.indexOf('phone.text') > -1) {\n settings.body.phoneNumber = adapterSettings.phoneNumber;\n } else {\n settings.body.freetext = adapterSettings.freetext;\n }\n }\n\n if (\n clientName.indexOf('chat.popup') > -1 ||\n clientName.indexOf('link') > -1 ||\n (clientName === 'custom.adapter' && exitType === 'custom')\n ) {\n settings.body = adapterSettings;\n settings.body.confirmationFallback = confirmationText;\n }\n\n if (clientName.indexOf('ace') > -1) {\n settings.body = adapterSettings;\n }\n\n if (form && form.hasValueComponents) {\n if (validation) {\n settings.body.form = FormBuilder.fromLegacyForm(id.toString(), form, validation).get();\n } else {\n settings.body.form = FormBuilder.fromLegacyForm(id.toString(), form).get();\n }\n if (!expandFormAutomatically) {\n settings.expanded = settings.inline = false;\n }\n\n settings.body = updateForm(settings, { submit: 'Submit' });\n }\n\n if (options.guideId) {\n settings.body.guideId = options.guideId;\n }\n\n return settings;\n};\n\nexport const getListType = (entry: ServerEntry) => {\n const { localState: state } = entry;\n\n if (entry.tags.includes('category') && entry.tags.includes('contact')) {\n return ConversationMessageListItemType.ItemList;\n }\n\n if (entry.tags.includes('suggestion')) {\n return ConversationMessageListItemType.LinkList;\n }\n\n if (state?.$type === 'Humany.Matching.Bots.Conversations.GuideListState, Humany.Matching') {\n return ConversationMessageListItemType.LinkList;\n } else if (\n state?.$type ===\n 'Humany.Matching.Bots.Conversations.States.GuideFeedbackState, Humany.Matching'\n ) {\n return CustomMessageTypes.FeedbackList;\n } else if (\n state?.$type === 'Humany.Matching.Bots.Conversations.States.ContactState, Humany.Matching'\n ) {\n return CustomMessageTypes.ContactList;\n } else return ConversationMessageListItemType.ButtonList;\n};\n\nexport const getKnowledgeBotEndpoint = (\n container: Container,\n component: any /*: ComponentNodeController */\n) => {\n const { knowledgeBotEndpoint } = component.properties();\n\n if (knowledgeBotEndpoint) {\n return `${knowledgeBotEndpoint}/conversations`;\n }\n\n const { data } = container.get('$settings');\n\n if (!data || !data.projection) throw new Error('Missing Knowledge Bot endpoint');\n\n return `${data.projection}/conversations`;\n};\n\nexport const updateForm = (\n contactMethod: ContactMethodType,\n {\n submit,\n errors,\n meta,\n }: { submit: string; errors?: { [key: string]: string }; meta?: { [key: string]: string } }\n): any => {\n if (contactMethod?.body?.form) {\n const { body } = contactMethod;\n const builder = new FormBuilder(body.form);\n\n if (!body.form.layout.submit) {\n builder.createComponent(submitButton(submit, 'submit'));\n }\n\n if (errors) {\n builder.setValidationErrors(errors);\n }\n\n if (meta) {\n (builder as any).setMeta(meta);\n }\n\n return {\n ...body,\n form: builder.get(),\n };\n }\n return contactMethod?.body || {};\n};\n\n// since we interacting with knowledge through the /conversations endpoint\n// and not using the service client we sync parameters here\nexport const setServiceClientParameter = async (\n container: Container,\n key: string,\n value: string\n) => {\n const dataClient = await container.getAsync('dataClient');\n const matchingClient = await dataClient.getClient();\n matchingClient.parameters.set(key, value);\n};\n","import { ConversationMessageListItemType } from '@telia-ace/widget-conversation';\nimport { uuid } from '@telia-ace/widget-utilities';\nimport { Container } from '@webprovisions/platform';\nimport {\n ActionItem,\n CustomMessageTypes,\n ListContent,\n MessageGroup,\n MessageGroupItem,\n ServerEntry,\n} from './types';\nimport {\n contactMethodFromLegacy,\n createGroup,\n getListType,\n setServiceClientParameter,\n} from './utils';\n\nconst createGroupItem = ({\n messageId,\n message,\n group,\n}: {\n messageId: string;\n message: MessageGroupItem['message'];\n group: MessageGroup;\n}) => {\n return {\n id: messageId,\n message,\n groupId: group.id,\n isUser: group.isUser,\n };\n};\n\nexport const processEntries = async (\n container: Container,\n entries: ServerEntry[],\n prevGroup?: MessageGroup\n) => {\n const createListContent = (\n listType: string,\n entry: ServerEntry,\n groupId: string,\n listContent: ListContent = {\n actions: [],\n entryId: entry.id,\n groupId,\n }\n ) => {\n const contactMethodIds: string[] = [];\n\n listContent.actions = entry.content.items.map((i: any) => {\n const action = {\n label: i.title,\n actionKey: i.actionKey,\n symbol: !!i.symbol ? i.symbol : undefined,\n description: i.description || undefined,\n } as ActionItem;\n\n if (i.data) {\n const entryAction = entry.actions[i.actionKey];\n if (listType === CustomMessageTypes.ContactList) {\n contactMethodIds.push(i.data.id);\n action.data = contactMethodFromLegacy(i.data, {\n guideId: entryAction?.guideId?.toString(),\n });\n } else {\n action.data = i.data;\n }\n }\n return action;\n });\n\n if (listType === CustomMessageTypes.ContactList) {\n listContent.contactMethodIds = contactMethodIds;\n }\n\n return listContent;\n };\n\n const transform = async (\n entry: ServerEntry,\n group: MessageGroup,\n related: ServerEntry[] = [],\n prevGroup?: MessageGroup\n ) => {\n const messageId = uuid();\n\n if (entry.type !== 'List' && entry.tags.includes('guide') && entry.content.hints?.[0]?.id) {\n await setServiceClientParameter(container, 'LastGuideId', entry.content.hints[0].id);\n }\n\n switch (entry.type) {\n case 'List':\n {\n const { header, items, html } = entry.content;\n\n const result = [];\n\n let listContent = {\n actions: [],\n entryId: entry.id,\n groupId: group.id,\n } as ListContent;\n\n if (header) {\n listContent.header = header;\n }\n\n if (items?.length > 0) {\n const listType = getListType(entry);\n listContent = createListContent(listType, entry, group.id, listContent);\n\n // entry has related entries\n if (!!related.length) {\n const pagingEntry = related.find((e) => e.tags.includes('paging'));\n const fallbackEntry = related.find((e) => e.tags.includes('fallback'));\n\n if (pagingEntry?.content) {\n group.meta.paging = {\n actions: pagingEntry.actions,\n items: pagingEntry.content.items,\n localState: pagingEntry.localState,\n };\n pagingEntry.content.items.forEach((i: any) => {\n listContent.actions.push({\n label: i.title,\n actionKey: i.actionKey,\n data: {\n groupId: !!prevGroup ? prevGroup.id : group.id,\n },\n });\n });\n }\n\n if (fallbackEntry) {\n const fallbackAction = fallbackEntry.content.items.find(\n (i: any) => i.actionKey === 'help'\n );\n if (fallbackAction) {\n result.push(\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.Separator,\n undefined,\n ],\n group,\n })\n );\n result.push(\n createGroupItem({\n messageId,\n message: [\n CustomMessageTypes.NoGoodAlternative,\n { body: fallbackAction.title },\n ],\n group,\n })\n );\n }\n }\n }\n\n result.unshift(\n createGroupItem({\n messageId,\n message: [listType, listContent],\n group,\n })\n );\n }\n\n if (html) {\n result.unshift(\n createGroupItem({\n messageId,\n message: [ConversationMessageListItemType.HTML, { body: html }],\n group,\n })\n );\n }\n\n return result;\n }\n break;\n case 'Text':\n {\n const result = [];\n result.push(\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.HTML,\n { body: entry.content.html },\n ],\n group,\n })\n );\n\n // embedded contact methods\n if (!!related.length) {\n const contactMethodListEntry = related.find(\n (e) =>\n e.type === 'List' &&\n e.localState?.$type ===\n 'Humany.Matching.Bots.Conversations.States.ContactState, Humany.Matching'\n );\n\n const dialogListEntry = related.find((e) => e.tags.includes('dialog'));\n const feedbackEntry = related.find((e) => e.tags.includes('feedback'));\n const contactMethodEntry = related.find(\n (e) => e.tags.includes('contact') && e.type === 'Contact'\n );\n\n if (contactMethodEntry) {\n result.push(\n createGroupItem({\n messageId,\n message: [\n CustomMessageTypes.ContactMethod,\n {\n contactMethodId: contactMethodEntry.content.id,\n groupId: group.id,\n guideId: contactMethodEntry.content.guideId,\n },\n ],\n group,\n })\n );\n }\n\n if (dialogListEntry) {\n result.push(\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.ButtonList,\n {\n actions: dialogListEntry.content.items.map((i: any) => {\n return {\n label: i.title,\n actionKey: i.actionKey,\n data: i.data,\n };\n }),\n },\n ],\n group,\n })\n );\n }\n\n if (contactMethodListEntry) {\n const listContent = createListContent(\n CustomMessageTypes.ContactList,\n contactMethodListEntry,\n group.id\n );\n\n result.push(\n createGroupItem({\n messageId,\n message: [ConversationMessageListItemType.Separator, undefined],\n group,\n })\n );\n\n result.push(\n createGroupItem({\n messageId,\n message: [CustomMessageTypes.ContactList, listContent],\n group,\n })\n );\n }\n\n if (feedbackEntry) {\n if (feedbackEntry.content.html) {\n result.push(\n createGroupItem({\n messageId,\n group,\n message: [\n ConversationMessageListItemType.HTML,\n {\n body: feedbackEntry.content.html,\n },\n ],\n })\n );\n }\n result.push(\n createGroupItem({\n messageId,\n group,\n message: [\n CustomMessageTypes.FeedbackList,\n {\n actions: feedbackEntry.content.items.map((i: any) => {\n return {\n actionKey: i.actionKey,\n label: i.title,\n };\n }),\n },\n ],\n })\n );\n }\n }\n return result;\n }\n break;\n case 'Contact': {\n return [\n createGroupItem({\n messageId,\n message: [\n CustomMessageTypes.ContactMethod,\n {\n contactMethodId: entry.content.id,\n groupId: group.id,\n guideId: entry.content.guideId,\n },\n ],\n group,\n }),\n ];\n }\n case 'CategorizedNoticeList': {\n const result = [\n createGroupItem({\n messageId,\n message: [\n CustomMessageTypes.NotificationList,\n {\n id: entry.content.item.id.toString(),\n header: entry.content.item.title,\n items: entry.content.item.listNotices,\n symbol: entry.content.item.defaultIcon,\n },\n ],\n group,\n }),\n ];\n\n (entry.content.notices || []).forEach((notice: any) => {\n result.push(\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.HTML,\n {\n body: notice.body,\n },\n ],\n group,\n })\n );\n });\n\n return result;\n }\n case 'footerNotice': {\n return [\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.HTML,\n {\n body: entry.content.item.body,\n },\n ],\n group,\n }),\n ];\n }\n case 'Error': {\n return [\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.HTML,\n {\n body: entry.content.message || 'Something went wrong.',\n },\n ],\n group,\n }),\n ];\n }\n\n default:\n return [];\n }\n };\n\n const splitEntry = (entry: ServerEntry): ServerEntry | ServerEntry[] => {\n if (['CategorizedNoticeList', 'NoticeList'].includes(entry.type)) {\n return (entry.content.items || []).reduce((acc: any, item: any) => {\n if (!entry.content.isInitialNotices) {\n return acc;\n }\n acc.push({\n ...entry,\n id: uuid(),\n type: item.type || entry.type,\n content: {\n $type: entry.content.$type,\n isInitialNotices: entry.content.isInitialNotices,\n notices: item.notices,\n item,\n },\n });\n return acc;\n }, []);\n }\n return entry;\n };\n\n // map of in which order the messages should be displayed\n // lower numbers will be displayed above higher\n const sortMap = new Map<string, number>([\n ['Text', 1],\n ['List', 2],\n ['Contact', 3],\n ['CategorizedNoticeList', 10],\n ]);\n\n const result: MessageGroup[] = [];\n const filteredEntries = entries\n .sort((item, other) => {\n // sort the entries based on it's types sort value\n const defaultSortValue = 20;\n\n var sortValue = sortMap.get(item.type) || defaultSortValue;\n var sortValueOther = sortMap.get(other.type) || defaultSortValue;\n return sortValue - sortValueOther;\n })\n .filter((entry) => !entry.relation) // remove any \"relation entries\"\n .reduce<ServerEntry[]>((acc, entry) => {\n // some entries needs to be splitted into seperate groups\n return acc.concat(splitEntry(entry));\n }, []);\n\n // we dont want to display this type of entry\n // as we dont support it, and it was not supported in v4 either\n const isNonVisibleRelatedEntry = (e: ServerEntry) => {\n return typeof e.actions['selector'] !== 'undefined';\n };\n\n for (const entry of filteredEntries) {\n const relatedEntries = entries.filter(\n (other) => other.relation === entry.id && !isNonVisibleRelatedEntry(other)\n );\n const group = createGroup({ isUser: false });\n\n const items = await transform(entry, group, relatedEntries, prevGroup);\n items.forEach((item) => {\n group.items.push(item);\n });\n\n if (group.items.length) {\n result.push(group);\n }\n }\n return result;\n};\n","import { uuid } from '@telia-ace/widget-utilities';\nimport { Container, EventManager } from '@webprovisions/platform';\nimport { processEntries } from './entry-handler';\nimport Store from './store';\nimport { ClientEnvelope, MessageGroup, ServerEntry, ServerEnvelope } from './types';\n\nclass HttpClient {\n private globalState: any;\n private localState: ServerEntry['localState'];\n private clientId: string;\n private entries: ServerEntry[];\n\n constructor(\n private endpoint: string,\n private events: EventManager,\n private store: Store,\n private container: Container\n ) {\n this.clientId = uuid();\n this.entries = [];\n }\n\n async start({ silent }: { silent: boolean }) {\n const storedGlobalState = await this.store.read('globalState');\n const storedLocalState = await this.store.read('localState');\n const storedEntries = await this.store.read('entries');\n\n // if there is state stored we need to set it\n this.globalState = storedGlobalState || this.globalState;\n this.localState = storedLocalState || this.localState;\n this.entries = storedEntries || this.entries;\n\n // dont create initial envelope if the client should just\n // set local and global state and then start silently\n if (silent) {\n return;\n }\n\n const envelope = this.createInitialEnvelope();\n const initialResponse = await this.postEnvelope(envelope);\n return initialResponse;\n }\n\n async sendMessage(message: string) {\n const envelope = {\n command: { phrase: message },\n globalState: this.globalState,\n clientId: this.clientId,\n };\n\n const result = await this.postEnvelope(envelope);\n return result;\n }\n\n async helpAction() {\n return this.postEnvelope({\n action: {\n key: 'help',\n content: {\n $type: 'Humany.Matching.Bots.Conversations.Actions.Help, Humany.Matching',\n },\n },\n globalState: this.globalState,\n clientId: this.clientId,\n });\n }\n\n async nextAction(group: MessageGroup) {\n const { paging } = group.meta;\n if (!paging.actions?.next) {\n return;\n }\n return this.postEnvelope(\n {\n action: {\n key: 'next',\n content: paging.actions.next,\n },\n localState: paging.localState,\n globalState: this.globalState,\n clientId: this.clientId,\n },\n group\n ).then((response) => {\n const listItemIndex = group.items.findIndex((item) => item.message[0] === 'link-list');\n if (listItemIndex === -1 || !response) {\n return group;\n }\n\n return {\n ...group,\n meta: {\n ...group.meta,\n ...response[0].meta,\n },\n items: [\n ...group.items.slice(0, listItemIndex),\n {\n ...group.items[listItemIndex],\n message: [\n response[0].items[0].message[0],\n {\n ...group.items[listItemIndex].message[1],\n ...response[0].items[0].message[1],\n },\n ],\n },\n ...group.items.slice(listItemIndex + 1),\n ],\n };\n });\n }\n\n async showContactMethodAction(data: {\n contactMethod: any;\n actionKey: string;\n entryId: string;\n }) {\n const entry = this.entries.find((e) => e.id === data.entryId);\n const actionItem = entry?.actions[data.actionKey];\n\n if (!actionItem) {\n return;\n }\n\n return this.postEnvelope({\n action: {\n key: data.actionKey,\n content: actionItem,\n },\n localState: entry.localState,\n globalState: this.globalState,\n clientId: this.clientId,\n });\n }\n\n async defaultAction(action: string) {\n const entry = this.getEntryOfAction(action);\n\n if (!entry) {\n return;\n }\n\n return this.postEnvelope({\n action: {\n key: action,\n content: entry.actions[action],\n },\n localState: entry.localState,\n globalState: this.globalState,\n clientId: this.clientId,\n });\n }\n\n private createInitialEnvelope(): ClientEnvelope {\n return {\n command: { site: this.endpoint },\n clientId: this.clientId,\n globalState: {},\n funnel: this.container.get('$widget').name,\n };\n }\n\n private async postEnvelope(envelope: ClientEnvelope, prevGroup?: MessageGroup) {\n try {\n const response = await fetch(this.endpoint, this.getHttpOptions(envelope));\n\n if (!response.ok) {\n throw response;\n }\n\n const data = await response.json();\n\n return this.handleResponse(data, prevGroup);\n } catch (error: any) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Something went wrong when posting the envelope.');\n }\n let message = 'Something went wrong';\n if (\n error.message === 'Failed to fetch' ||\n error.message === 'NetworkError when attempting to fetch resource.'\n ) {\n message = 'Lost connection... Please try again.';\n }\n return this.handleResponse({\n entries: [\n {\n id: uuid(),\n type: 'Error',\n timestamp: new Date().toISOString(),\n content: {\n message,\n },\n actions: {},\n tags: [],\n },\n ],\n });\n }\n }\n\n private async handleResponse(data: ServerEnvelope, prevGroup?: MessageGroup) {\n this.entries = this.entries.concat(data.entries);\n this.store.write(this.entries, 'entries');\n\n const widgetEntry = data.entries.find((e) => e.type === 'Widget');\n\n if (widgetEntry) {\n this.events.dispatch('provider:widget-entry', widgetEntry.content);\n }\n\n if (data.globalState) {\n this.globalState = data.globalState;\n this.store.write(data.globalState, 'globalState');\n }\n\n this.localState = data.entries.reduce<ServerEntry['localState']>((acc, entry) => {\n if (entry.localState) {\n return entry.localState;\n }\n return acc;\n }, undefined);\n this.store.write(this.localState, 'localState');\n\n const groups = await processEntries(this.container, data.entries, prevGroup);\n return groups;\n }\n\n private getHttpOptions(envelope: ClientEnvelope) {\n const fetchOptions = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n };\n envelope.funnel = this.container.get('$widget').name;\n envelope.localState = envelope.localState || this.localState;\n return Object.assign({}, fetchOptions, {\n body: JSON.stringify(envelope),\n credentials: 'same-origin' as RequestCredentials,\n });\n }\n\n private getEntryOfAction(action: string) {\n return this.entries.find((entry) => !!entry.actions[action]);\n }\n}\n\nexport default HttpClient;\n","import { createStorageWriter, readStorage, StorageCategory } from '@telia-ace/widget-services';\nimport { Container } from '@webprovisions/platform';\nimport { GlobalState, LooseObject, ServerEntry } from './types';\n\ntype MetaData = {\n agent: {\n name: string;\n avatar?: string;\n };\n};\n\ntype StorageTypes = 'localState' | 'globalState' | 'entries' | 'meta';\n\nclass Store {\n private enabled = true; // set whether or not to store data\n private botProviderGlobalStateKey = 'bot-provider-global-state';\n private botProviderLocalStateKey = 'bot-provider-local-state';\n private botProviderEntriesKey = 'bot-provider-entries';\n private botProviderMetaStateKey = 'bot-provider-conversation-meta';\n\n constructor(private container: Container) {}\n\n private getKey(type: StorageTypes) {\n let key;\n switch (type) {\n case 'localState':\n key = this.botProviderLocalStateKey;\n break;\n case 'globalState':\n key = this.botProviderGlobalStateKey;\n break;\n case 'entries':\n key = this.botProviderEntriesKey;\n break;\n case 'meta':\n key = this.botProviderMetaStateKey;\n break;\n\n default:\n break;\n }\n return key;\n }\n\n async read(type: 'localState'): Promise<LooseObject | undefined>;\n async read(type: 'meta'): Promise<MetaData | undefined>;\n async read(type: 'entries'): Promise<ServerEntry[] | undefined>;\n async read(type: 'globalState'): Promise<GlobalState | undefined>;\n async read(type: StorageTypes): Promise<any | undefined> {\n const key = this.getKey(type);\n if (!this.enabled || !key) {\n return;\n }\n\n return readStorage(this.container, key);\n }\n\n async write(data: any, type: StorageTypes) {\n const key = this.getKey(type);\n if (!this.enabled || !key) {\n return;\n }\n\n const write = await createStorageWriter(this.container, key, StorageCategory.Necessary);\n write(data);\n }\n}\n\nexport default Store;\n","import { ComponentNodeController } from '@telia-ace/knowledge-widget-core';\nimport { ConversationMessageListItemType } from '@telia-ace/widget-conversation';\nimport { createStorageWriter, StorageCategory } from '@telia-ace/widget-services';\nimport { uuid } from '@telia-ace/widget-utilities';\nimport { Container, EventManager, Widget } from '@webprovisions/platform';\nimport HttpClient from './http-client';\nimport Store from './store';\nimport { MessageGroup, ServerEntry } from './types';\nimport { createGroup, getKnowledgeBotEndpoint, setServiceClientParameter } from './utils';\n\nclass KnowledgeBotProvider {\n private agent: any;\n private user: any;\n private httpClient: HttpClient;\n private events: EventManager;\n private groups: MessageGroup[] = [];\n private store: Store;\n\n constructor(\n private container: Container,\n private conversation: any,\n component: ComponentNodeController\n ) {\n const { events } = this.container.get('$widget') as Widget;\n this.events = events;\n this.store = new Store(container);\n this.agent = conversation.createAgent({\n id: 'knowledge-bot-agent', // we need to specify an ID here to allow rehydration to work\n name: '',\n avatar: undefined,\n });\n this.user = conversation.user;\n const endpoint = getKnowledgeBotEndpoint(container, component);\n this.httpClient = new HttpClient(endpoint, events, this.store, this.container);\n\n this.events.subscribe('provider:widget-entry', (_event, data: ServerEntry['content']) => {\n this.onWidgetEntryReceived(data);\n });\n\n this.events.subscribe(\n 'provider:open-contact-method',\n async (_event, data: { contactMethod: any; entryId: string; actionKey: string }) => {\n const response = await this.httpClient.showContactMethodAction(data);\n\n if (response) {\n if (!!data.contactMethod.title) this.printUserMessage(data.contactMethod.title);\n this.onMessagesReceived(response);\n }\n }\n );\n }\n\n async initialize() {\n const loader = this.conversation.loading();\n\n const storedMeta = await this.store.read('meta');\n if (storedMeta?.agent) {\n this.agent.update({\n name: storedMeta.agent.name,\n avatar: storedMeta.agent.avatar,\n });\n }\n\n const rehydrated = await this.conversation.isRehydrated();\n\n const response = await this.httpClient.start({\n silent: this.conversation.options?.silent || rehydrated,\n });\n if (response) {\n this.onMessagesReceived(response);\n }\n\n loader();\n }\n\n async onMessagesReceived(groups: MessageGroup[]) {\n this.groups = this.groups.concat(groups);\n groups.forEach((group) => {\n const items = group.items.map((item) => item.message);\n if (group.isUser) {\n group.writer = this.user.print(items);\n } else {\n group.writer = this.agent.print(items);\n }\n });\n }\n\n async onInput(action: string | { [key: string]: any; actionKey: string; label?: string }) {\n const actionKey = typeof action === 'string' ? action : action.actionKey;\n\n switch (actionKey) {\n case 'next':\n {\n if (typeof action === 'string') {\n return;\n }\n const group = this.groups.find((other) => other.id === action.data?.groupId);\n\n if (group) {\n const response = await this.httpClient.nextAction(group);\n if (response) {\n const combined = response.items.map((item) => item.message);\n group.meta.paging = response?.meta.paging;\n group.writer.update(combined);\n }\n }\n }\n break;\n case 'help':\n {\n const loader = this.conversation.loading();\n\n const response = await this.httpClient.helpAction();\n loader();\n if (response) {\n this.onMessagesReceived(response);\n }\n }\n break;\n default:\n {\n if (typeof action !== 'string' && action.label) {\n this.printUserMessage(action.label);\n }\n const loader = this.conversation.loading();\n const response = await this.httpClient.defaultAction(actionKey);\n if (response) {\n this.onMessagesReceived(response);\n }\n loader();\n }\n break;\n }\n }\n\n private printUserMessage(message: string) {\n const group = createGroup({\n isUser: true,\n items: [\n {\n id: uuid(),\n isUser: true,\n message: [ConversationMessageListItemType.HTML, { body: message }],\n },\n ],\n });\n this.onMessagesReceived([group]);\n return group;\n }\n\n async onMessageSend(message: string) {\n const loader = this.conversation.loading();\n const response = await this.httpClient.sendMessage(message);\n\n await setServiceClientParameter(this.container, 'phrase', message);\n\n this.printUserMessage(message);\n\n if (response) {\n this.onMessagesReceived(response);\n }\n loader();\n }\n\n private async onWidgetEntryReceived(data: ServerEntry['content']) {\n if (data.agent) {\n const agentSettings = {\n name: data.agent.name,\n avatar: data.agent.avatar,\n };\n this.agent.update(agentSettings);\n const write = await createStorageWriter(\n this.container,\n 'bot-provider-conversation-meta',\n StorageCategory.Necessary\n );\n write({\n agent: agentSettings,\n });\n }\n }\n}\n\nexport default KnowledgeBotProvider;\n","import {\n ConversationPlatform,\n registerCustomMessageComponent,\n} from '@telia-ace/widget-conversation';\nimport { Container, Widget } from '@webprovisions/platform';\nimport KnowledgeBotProvider from './provider';\nimport { CustomMessageTypes } from './types';\n\nconst KnowledgeBotProviderPlugin = async (container: Container) => {\n const platform = await ConversationPlatform.getInstance(container);\n\n registerCustomMessageComponent(\n container,\n CustomMessageTypes.ContactList,\n import('./ui/contact-method-list')\n );\n registerCustomMessageComponent(\n container,\n CustomMessageTypes.ContactMethod,\n import('./ui/contact-method')\n );\n\n registerCustomMessageComponent(\n container,\n CustomMessageTypes.NotificationList,\n import('./ui/notification-list')\n );\n registerCustomMessageComponent(\n container,\n CustomMessageTypes.NoGoodAlternative,\n import('./ui/no-good-alternative')\n );\n registerCustomMessageComponent(\n container,\n CustomMessageTypes.FeedbackList,\n import('./ui/feedback-list')\n );\n\n platform.registerProvider('ace-knowledge-bot', (conversation, component) => {\n const provider = new KnowledgeBotProvider(container, conversation, component);\n provider.initialize();\n\n const subscriptions: any[] = [];\n subscriptions.push(\n component.actions.watch('conversation.user-submit', (input, next) => {\n provider.onMessageSend(input.text);\n })\n );\n\n subscriptions.push(\n component.actions.watch('conversation.action', (input, next) => {\n provider.onInput(input);\n\n return next(input);\n })\n );\n\n subscriptions.push(\n component.actions.create('evaluate', (input) => {\n const { events } = container.get('$widget') as Widget;\n events.dispatch('bot-provider:evaluate', input);\n })\n );\n\n subscriptions.push(\n component.actions.create('submit', (input) => {\n const { events } = container.get('$widget') as Widget;\n events.dispatch('bot-provider:form-submitted', input);\n })\n );\n\n return () => {\n // cleaning up when provider is disposed\n subscriptions.forEach((unsubscribe) => {\n unsubscribe();\n });\n };\n });\n};\n\nexport default KnowledgeBotProviderPlugin;\n"],"names":["CustomMessageTypes","convertLegacySymbol","symbol","type","content","createGroup","isUser","items","meta","groupId","uuid","i","contactMethodFromLegacy","id","title","defaultIcon","exit","exitType","confirmationText","expandFormAutomatically","form","description","options","adapter","clientName","adapterSettings","customClientName","validation","settings","displayTextBeforeClick","textBeforeClick","FormBuilder","updateForm","getListType","entry","state","ConversationMessageListItemType","getKnowledgeBotEndpoint","container","component","knowledgeBotEndpoint","data","contactMethod","submit","errors","_a","body","builder","submitButton","__spreadProps","__spreadValues","setServiceClientParameter","key","value","__async","createGroupItem","messageId","message","group","processEntries","entries","prevGroup","createListContent","listType","listContent","contactMethodIds","action","entryAction","transform","_0","_1","_2","related","_b","header","html","result","pagingEntry","e","fallbackEntry","fallbackAction","contactMethodListEntry","dialogListEntry","feedbackEntry","contactMethodEntry","notice","splitEntry","acc","item","sortMap","filteredEntries","other","sortValue","sortValueOther","isNonVisibleRelatedEntry","relatedEntries","HttpClient","endpoint","events","store","__publicField","silent","storedGlobalState","storedLocalState","storedEntries","envelope","paging","response","listItemIndex","actionItem","error","widgetEntry","fetchOptions","HttpClient$1","Store","readStorage","createStorageWriter","StorageCategory","Store$1","KnowledgeBotProvider","conversation","_event","loader","storedMeta","rehydrated","groups","actionKey","combined","agentSettings","KnowledgeBotProvider$1","KnowledgeBotProviderPlugin","platform","ConversationPlatform","registerCustomMessageComponent","provider","subscriptions","input","next","unsubscribe","KnowledgeBotProviderPlugin$1"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEY,IAAAA,sBAAAA,OACRA,EAAA,gBAAgB,oCAChBA,EAAA,cAAc,kCACdA,EAAA,eAAe,mCACfA,EAAA,mBAAmB,uCACnBA,EAAA,oBAAoB,yCALZA,IAAAA,KAAA,CAAA,CAAA;ACMZ,MAAMC,KAAsB,CAACC,MAAmE;AAC5F,MAAIA,GAAQ;AACF,UAAA,EAAE,MAAAC,GAAM,SAAAC,EAAY,IAAAF;AAC1B,QAAIC,KAAQC;AACD,aAAA,EAAE,MAAAD,GAAM,SAAAC;EAEvB;AACJ,GAEaC,IAAc,CAAC;AAAA,EACxB,QAAAC;AAAA,EACA,OAAAC,IAAQ,CAAC;AAAA,EACT,MAAAC,IAAO,CAAC;AACZ,MAIM;AACF,QAAMC,IAAUC;AAgBT,SAdO;AAAA,IACV,IAAID;AAAA,IACJ,QAAAH;AAAA,IACA,OAAOC,EAAM,IAAI,CAACI,OACP;AAAA,MACH,IAAIA,EAAE,MAAMD,EAAK;AAAA,MACjB,QAAAJ;AAAA,MACA,SAAAG;AAAA,MACA,SAASE,EAAE,WAAW,CAAC;AAAA,IAAA,EAE9B;AAAA,IACD,MAAAH;AAAA,EAAA;AAIR,GAEaI,KAA0B,CACnC;AAAA,EACI,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAO,CAACC,CAAI;AAAA,EACZ,UA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AEK,MAAAD,EAAA,QAAQ,CAACG,MAAgB;AACvB,QAAAA;MAAA,CACf;AAAA,IAAA;AAAA,EACL,CACH;AACL,IAEAC,KAAeT;"}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-bot-provider",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Bot Provider Plugin ACE Knowledge Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@telia-ace/knowledge-data-client": "1.0.
|
|
25
|
-
"@telia-ace/knowledge-widget-adapters": "1.0.
|
|
26
|
-
"@telia-ace/knowledge-widget-ui": "1.0.
|
|
27
|
-
"@telia-ace/widget-conversation": "^1.0.
|
|
28
|
-
"@telia-ace/widget-forms": "^1.0.
|
|
29
|
-
"@telia-ace/widget-services": "^1.0.
|
|
30
|
-
"@telia-ace/widget-utilities": "^1.0.
|
|
24
|
+
"@telia-ace/knowledge-data-client": "1.0.10",
|
|
25
|
+
"@telia-ace/knowledge-widget-adapters": "1.0.53",
|
|
26
|
+
"@telia-ace/knowledge-widget-ui": "1.0.49",
|
|
27
|
+
"@telia-ace/widget-conversation": "^1.0.41",
|
|
28
|
+
"@telia-ace/widget-forms": "^1.0.35",
|
|
29
|
+
"@telia-ace/widget-services": "^1.0.28",
|
|
30
|
+
"@telia-ace/widget-utilities": "^1.0.17",
|
|
31
31
|
"@webprovisions/bootstrapping": "1.0.13"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@emotion/react": "^11.11.1",
|
|
40
40
|
"@emotion/styled": "^11.11.0",
|
|
41
|
-
"@telia-ace/knowledge-widget-core": "1.0.
|
|
42
|
-
"@types/react": "^18.2.
|
|
41
|
+
"@telia-ace/knowledge-widget-core": "1.0.43",
|
|
42
|
+
"@types/react": "^18.2.22",
|
|
43
43
|
"@webprovisions/platform": "^1.1.4",
|
|
44
44
|
"react": "^18.2.0"
|
|
45
45
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.a97894e5.js","sources":["../src/types.ts","../src/utils.ts","../src/entry-handler.ts","../src/http-client.ts","../src/store.ts","../src/provider.ts","../src/plugin.ts"],"sourcesContent":["import { ConversationMessageListItemType } from '@telia-ace/widget-conversation';\n\nexport enum CustomMessageTypes {\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}\n\nexport type LooseObject = { [key: string]: any };\n\nexport interface ActionItem {\n label: string;\n actionKey: string;\n data?: any;\n description?: string;\n}\n\nexport interface MessageGroup {\n id: string;\n isUser: boolean;\n items: MessageGroupItem[];\n writer?: any;\n meta: { [key: string]: any };\n}\n\nexport interface MessageGroupItem {\n id: string;\n groupId: string;\n isUser: boolean;\n message: [ConversationMessageListItemType | CustomMessageTypes, any];\n}\n\nexport interface ClientEnvelope {\n command?: LooseObject;\n action?: {\n key: string;\n content: any;\n };\n globalState?: LooseObject;\n localState?: LooseObject;\n clientId?: string;\n funnel?: string;\n}\n\nexport interface ServerEnvelope {\n clientId?: string | undefined;\n entries: ServerEntry[];\n globalState?: GlobalState;\n resolveCommand?: string;\n clientEnvelope?: ClientEnvelope;\n}\n\nexport interface GlobalState {\n completedInteractionsCount: number;\n lastQuestion?: string;\n lastBotGuide: number;\n lastGuideTitle?: string;\n site: string;\n invincibleParameters: object;\n}\n\nexport interface ServerEntry {\n id: string;\n type: string;\n content: any;\n actions: { [key: string]: any };\n tags: string[];\n relation?: string;\n timestamp: string;\n localState?: { [key: string]: any };\n}\n\nexport interface ListContent {\n header?: string;\n actions: ActionItem[];\n contactMethodIds?: string[];\n entryId: string;\n groupId: string;\n}\n","import { ContactMethodType } from '@telia-ace/knowledge-widget-adapters';\nimport { Symbol } from '@telia-ace/knowledge-widget-ui';\nimport { ConversationMessageListItemType } from '@telia-ace/widget-conversation';\nimport { FormBuilder, submitButton } from '@telia-ace/widget-forms';\nimport { uuid } from '@telia-ace/widget-utilities';\nimport { Container } from '@webprovisions/platform';\nimport { CustomMessageTypes, MessageGroup, MessageGroupItem, ServerEntry } from './types';\n\nconst convertLegacySymbol = (symbol?: { type: string; content: string }): Symbol | undefined => {\n if (symbol) {\n const { type, content } = symbol;\n if (type && content) {\n return { type, content };\n }\n }\n};\n\nexport const createGroup = ({\n isUser,\n items = [],\n meta = {},\n}: {\n isUser: boolean;\n items?: Partial<MessageGroupItem>[];\n meta?: MessageGroup['meta'];\n}) => {\n const groupId = uuid();\n\n const group = {\n id: groupId,\n isUser,\n items: items.map((i) => {\n return {\n id: i.id || uuid(),\n isUser: isUser,\n groupId: groupId,\n message: i.message || [],\n };\n }),\n meta,\n } as MessageGroup;\n\n return group;\n};\n\nexport const contactMethodFromLegacy = (\n {\n id,\n title,\n defaultIcon,\n exits: [exit],\n exitType,\n confirmationText,\n expandFormAutomatically,\n form,\n description,\n }: any,\n options: {\n validation?: any;\n guideId?: string;\n } = {}\n): any => {\n const { adapter } = exit || { Adapter: {} };\n const { clientName = '', settings: adapterSettings = {}, customClientName = '' } = adapter;\n const { validation } = options;\n\n const settings: any = {\n id: id.toString(),\n title: title,\n description: description,\n symbol: convertLegacySymbol(defaultIcon),\n clientName: clientName === 'custom.adapter' ? customClientName : clientName,\n expanded: true,\n inline: true,\n body: {},\n };\n\n if (clientName.indexOf('phone') > -1 || clientName.indexOf('freetext') > -1) {\n const { displayTextBeforeClick, textBeforeClick } = adapterSettings;\n if (displayTextBeforeClick === 'true') {\n settings.expanded = false;\n settings.title = textBeforeClick;\n }\n\n if (clientName.indexOf('phone.text') > -1) {\n settings.body.phoneNumber = adapterSettings.phoneNumber;\n } else {\n settings.body.freetext = adapterSettings.freetext;\n }\n }\n\n if (\n clientName.indexOf('chat.popup') > -1 ||\n clientName.indexOf('link') > -1 ||\n (clientName === 'custom.adapter' && exitType === 'custom')\n ) {\n settings.body = adapterSettings;\n settings.body.confirmationFallback = confirmationText;\n }\n\n if (clientName.indexOf('ace') > -1) {\n settings.body = adapterSettings;\n }\n\n if (form && form.hasValueComponents) {\n if (validation) {\n settings.body.form = FormBuilder.fromLegacyForm(id.toString(), form, validation).get();\n } else {\n settings.body.form = FormBuilder.fromLegacyForm(id.toString(), form).get();\n }\n if (!expandFormAutomatically) {\n settings.expanded = settings.inline = false;\n }\n\n settings.body = updateForm(settings, { submit: 'Submit' });\n }\n\n if (options.guideId) {\n settings.body.guideId = options.guideId;\n }\n\n return settings;\n};\n\nexport const getListType = (entry: ServerEntry) => {\n const { localState: state } = entry;\n\n if (entry.tags.includes('category') && entry.tags.includes('contact')) {\n return ConversationMessageListItemType.ItemList;\n }\n\n if (entry.tags.includes('suggestion')) {\n return ConversationMessageListItemType.LinkList;\n }\n\n if (state?.$type === 'Humany.Matching.Bots.Conversations.GuideListState, Humany.Matching') {\n return ConversationMessageListItemType.LinkList;\n } else if (\n state?.$type ===\n 'Humany.Matching.Bots.Conversations.States.GuideFeedbackState, Humany.Matching'\n ) {\n return CustomMessageTypes.FeedbackList;\n } else if (\n state?.$type === 'Humany.Matching.Bots.Conversations.States.ContactState, Humany.Matching'\n ) {\n return CustomMessageTypes.ContactList;\n } else return ConversationMessageListItemType.ButtonList;\n};\n\nexport const getKnowledgeBotEndpoint = (\n container: Container,\n component: any /*: ComponentNodeController */\n) => {\n const { knowledgeBotEndpoint } = component.properties();\n\n if (knowledgeBotEndpoint) {\n return `${knowledgeBotEndpoint}/conversations`;\n }\n\n const { data } = container.get('$settings');\n\n if (!data || !data.projection) throw new Error('Missing Knowledge Bot endpoint');\n\n return `${data.projection}/conversations`;\n};\n\nexport const updateForm = (\n contactMethod: ContactMethodType,\n {\n submit,\n errors,\n meta,\n }: { submit: string; errors?: { [key: string]: string }; meta?: { [key: string]: string } }\n): any => {\n if (contactMethod?.body?.form) {\n const { body } = contactMethod;\n const builder = new FormBuilder(body.form);\n\n if (!body.form.layout.submit) {\n builder.createComponent(submitButton(submit, 'submit'));\n }\n\n if (errors) {\n builder.setValidationErrors(errors);\n }\n\n if (meta) {\n (builder as any).setMeta(meta);\n }\n\n return {\n ...body,\n form: builder.get(),\n };\n }\n return contactMethod?.body || {};\n};\n\n// since we interacting with knowledge through the /conversations endpoint\n// and not using the service client we sync parameters here\nexport const setServiceClientParameter = async (\n container: Container,\n key: string,\n value: string\n) => {\n const dataClient = await container.getAsync('dataClient');\n const matchingClient = await dataClient.getClient();\n matchingClient.parameters.set(key, value);\n};\n","import { ConversationMessageListItemType } from '@telia-ace/widget-conversation';\nimport { uuid } from '@telia-ace/widget-utilities';\nimport { Container } from '@webprovisions/platform';\nimport {\n ActionItem,\n CustomMessageTypes,\n ListContent,\n MessageGroup,\n MessageGroupItem,\n ServerEntry,\n} from './types';\nimport {\n contactMethodFromLegacy,\n createGroup,\n getListType,\n setServiceClientParameter,\n} from './utils';\n\nconst createGroupItem = ({\n messageId,\n message,\n group,\n}: {\n messageId: string;\n message: MessageGroupItem['message'];\n group: MessageGroup;\n}) => {\n return {\n id: messageId,\n message,\n groupId: group.id,\n isUser: group.isUser,\n };\n};\n\nexport const processEntries = async (\n container: Container,\n entries: ServerEntry[],\n prevGroup?: MessageGroup\n) => {\n const createListContent = (\n listType: string,\n entry: ServerEntry,\n groupId: string,\n listContent: ListContent = {\n actions: [],\n entryId: entry.id,\n groupId,\n }\n ) => {\n const contactMethodIds: string[] = [];\n\n listContent.actions = entry.content.items.map((i: any) => {\n const action = {\n label: i.title,\n actionKey: i.actionKey,\n symbol: !!i.symbol ? i.symbol : undefined,\n description: i.description || undefined,\n } as ActionItem;\n\n if (i.data) {\n const entryAction = entry.actions[i.actionKey];\n if (listType === CustomMessageTypes.ContactList) {\n contactMethodIds.push(i.data.id);\n action.data = contactMethodFromLegacy(i.data, {\n guideId: entryAction?.guideId?.toString(),\n });\n } else {\n action.data = i.data;\n }\n }\n return action;\n });\n\n if (listType === CustomMessageTypes.ContactList) {\n listContent.contactMethodIds = contactMethodIds;\n }\n\n return listContent;\n };\n\n const transform = async (\n entry: ServerEntry,\n group: MessageGroup,\n related: ServerEntry[] = [],\n prevGroup?: MessageGroup\n ) => {\n const messageId = uuid();\n\n if (entry.type !== 'List' && entry.tags.includes('guide') && entry.content.hints?.[0]?.id) {\n await setServiceClientParameter(container, 'LastGuideId', entry.content.hints[0].id);\n }\n\n switch (entry.type) {\n case 'List':\n {\n const { header, items, html } = entry.content;\n\n const result = [];\n\n let listContent = {\n actions: [],\n entryId: entry.id,\n groupId: group.id,\n } as ListContent;\n\n if (header) {\n listContent.header = header;\n }\n\n if (items?.length > 0) {\n const listType = getListType(entry);\n listContent = createListContent(listType, entry, group.id, listContent);\n\n // entry has related entries\n if (!!related.length) {\n const pagingEntry = related.find((e) => e.tags.includes('paging'));\n const fallbackEntry = related.find((e) => e.tags.includes('fallback'));\n\n if (pagingEntry?.content) {\n group.meta.paging = {\n actions: pagingEntry.actions,\n items: pagingEntry.content.items,\n localState: pagingEntry.localState,\n };\n pagingEntry.content.items.forEach((i: any) => {\n listContent.actions.push({\n label: i.title,\n actionKey: i.actionKey,\n data: {\n groupId: !!prevGroup ? prevGroup.id : group.id,\n },\n });\n });\n }\n\n if (fallbackEntry) {\n const fallbackAction = fallbackEntry.content.items.find(\n (i: any) => i.actionKey === 'help'\n );\n if (fallbackAction) {\n result.push(\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.Separator,\n undefined,\n ],\n group,\n })\n );\n result.push(\n createGroupItem({\n messageId,\n message: [\n CustomMessageTypes.NoGoodAlternative,\n { body: fallbackAction.title },\n ],\n group,\n })\n );\n }\n }\n }\n\n result.unshift(\n createGroupItem({\n messageId,\n message: [listType, listContent],\n group,\n })\n );\n }\n\n if (html) {\n result.unshift(\n createGroupItem({\n messageId,\n message: [ConversationMessageListItemType.HTML, { body: html }],\n group,\n })\n );\n }\n\n return result;\n }\n break;\n case 'Text':\n {\n const result = [];\n result.push(\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.HTML,\n { body: entry.content.html },\n ],\n group,\n })\n );\n\n // embedded contact methods\n if (!!related.length) {\n const contactMethodListEntry = related.find(\n (e) =>\n e.type === 'List' &&\n e.localState?.$type ===\n 'Humany.Matching.Bots.Conversations.States.ContactState, Humany.Matching'\n );\n\n const dialogListEntry = related.find((e) => e.tags.includes('dialog'));\n const feedbackEntry = related.find((e) => e.tags.includes('feedback'));\n const contactMethodEntry = related.find(\n (e) => e.tags.includes('contact') && e.type === 'Contact'\n );\n\n if (contactMethodEntry) {\n result.push(\n createGroupItem({\n messageId,\n message: [\n CustomMessageTypes.ContactMethod,\n {\n contactMethodId: contactMethodEntry.content.id,\n groupId: group.id,\n guideId: contactMethodEntry.content.guideId,\n },\n ],\n group,\n })\n );\n }\n\n if (dialogListEntry) {\n result.push(\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.ButtonList,\n {\n actions: dialogListEntry.content.items.map((i: any) => {\n return {\n label: i.title,\n actionKey: i.actionKey,\n };\n }),\n },\n ],\n group,\n })\n );\n }\n\n if (contactMethodListEntry) {\n const listContent = createListContent(\n CustomMessageTypes.ContactList,\n contactMethodListEntry,\n group.id\n );\n\n result.push(\n createGroupItem({\n messageId,\n message: [ConversationMessageListItemType.Separator, undefined],\n group,\n })\n );\n\n result.push(\n createGroupItem({\n messageId,\n message: [CustomMessageTypes.ContactList, listContent],\n group,\n })\n );\n }\n\n if (feedbackEntry) {\n if (feedbackEntry.content.html) {\n result.push(\n createGroupItem({\n messageId,\n group,\n message: [\n ConversationMessageListItemType.HTML,\n {\n body: feedbackEntry.content.html,\n },\n ],\n })\n );\n }\n result.push(\n createGroupItem({\n messageId,\n group,\n message: [\n CustomMessageTypes.FeedbackList,\n {\n actions: feedbackEntry.content.items.map((i: any) => {\n return {\n actionKey: i.actionKey,\n label: i.title,\n };\n }),\n },\n ],\n })\n );\n }\n }\n return result;\n }\n break;\n case 'Contact': {\n return [\n createGroupItem({\n messageId,\n message: [\n CustomMessageTypes.ContactMethod,\n {\n contactMethodId: entry.content.id,\n groupId: group.id,\n guideId: entry.content.guideId,\n },\n ],\n group,\n }),\n ];\n }\n case 'CategorizedNoticeList': {\n const result = [\n createGroupItem({\n messageId,\n message: [\n CustomMessageTypes.NotificationList,\n {\n id: entry.content.item.id.toString(),\n header: entry.content.item.title,\n items: entry.content.item.listNotices,\n symbol: entry.content.item.defaultIcon,\n },\n ],\n group,\n }),\n ];\n\n (entry.content.notices || []).forEach((notice: any) => {\n result.push(\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.HTML,\n {\n body: notice.body,\n },\n ],\n group,\n })\n );\n });\n\n return result;\n }\n case 'footerNotice': {\n return [\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.HTML,\n {\n body: entry.content.item.body,\n },\n ],\n group,\n }),\n ];\n }\n case 'Error': {\n return [\n createGroupItem({\n messageId,\n message: [\n ConversationMessageListItemType.HTML,\n {\n body: entry.content.message || 'Something went wrong.',\n },\n ],\n group,\n }),\n ];\n }\n\n default:\n return [];\n }\n };\n\n const splitEntry = (entry: ServerEntry): ServerEntry | ServerEntry[] => {\n if (['CategorizedNoticeList', 'NoticeList'].includes(entry.type)) {\n return (entry.content.items || []).reduce((acc: any, item: any) => {\n if (!entry.content.isInitialNotices) {\n return acc;\n }\n acc.push({\n ...entry,\n id: uuid(),\n type: item.type || entry.type,\n content: {\n $type: entry.content.$type,\n isInitialNotices: entry.content.isInitialNotices,\n notices: item.notices,\n item,\n },\n });\n return acc;\n }, []);\n }\n return entry;\n };\n\n // map of in which order the messages should be displayed\n // lower numbers will be displayed above higher\n const sortMap = new Map<string, number>([\n ['Text', 1],\n ['List', 2],\n ['Contact', 3],\n ['CategorizedNoticeList', 10],\n ]);\n\n const result: MessageGroup[] = [];\n const filteredEntries = entries\n .sort((item, other) => {\n // sort the entries based on it's types sort value\n const defaultSortValue = 20;\n\n var sortValue = sortMap.get(item.type) || defaultSortValue;\n var sortValueOther = sortMap.get(other.type) || defaultSortValue;\n return sortValue - sortValueOther;\n })\n .filter((entry) => !entry.relation) // remove any \"relation entries\"\n .reduce<ServerEntry[]>((acc, entry) => {\n // some entries needs to be splitted into seperate groups\n return acc.concat(splitEntry(entry));\n }, []);\n\n // we dont want to display this type of entry\n // as we dont support it, and it was not supported in v4 either\n const isNonVisibleRelatedEntry = (e: ServerEntry) => {\n return typeof e.actions['selector'] !== 'undefined';\n };\n\n for (const entry of filteredEntries) {\n const relatedEntries = entries.filter(\n (other) => other.relation === entry.id && !isNonVisibleRelatedEntry(other)\n );\n const group = createGroup({ isUser: false });\n\n const items = await transform(entry, group, relatedEntries, prevGroup);\n items.forEach((item) => {\n group.items.push(item);\n });\n\n if (group.items.length) {\n result.push(group);\n }\n }\n return result;\n};\n","import { uuid } from '@telia-ace/widget-utilities';\nimport { Container, EventManager } from '@webprovisions/platform';\nimport { processEntries } from './entry-handler';\nimport Store from './store';\nimport { ClientEnvelope, MessageGroup, ServerEntry, ServerEnvelope } from './types';\n\nclass HttpClient {\n private globalState: any;\n private localState: ServerEntry['localState'];\n private clientId: string;\n private entries: ServerEntry[];\n\n constructor(\n private endpoint: string,\n private events: EventManager,\n private store: Store,\n private container: Container\n ) {\n this.clientId = uuid();\n this.entries = [];\n }\n\n async start({ silent }: { silent: boolean }) {\n const storedGlobalState = await this.store.read('globalState');\n const storedLocalState = await this.store.read('localState');\n const storedEntries = await this.store.read('entries');\n\n // if there is state stored we need to set it\n this.globalState = storedGlobalState || this.globalState;\n this.localState = storedLocalState || this.localState;\n this.entries = storedEntries || this.entries;\n\n // dont create initial envelope if the client should just\n // set local and global state and then start silently\n if (silent) {\n return;\n }\n\n const envelope = this.createInitialEnvelope();\n const initialResponse = await this.postEnvelope(envelope);\n return initialResponse;\n }\n\n async sendMessage(message: string) {\n const envelope = {\n command: { phrase: message },\n globalState: this.globalState,\n clientId: this.clientId,\n };\n\n const result = await this.postEnvelope(envelope);\n return result;\n }\n\n async helpAction() {\n return this.postEnvelope({\n action: {\n key: 'help',\n content: {\n $type: 'Humany.Matching.Bots.Conversations.Actions.Help, Humany.Matching',\n },\n },\n globalState: this.globalState,\n clientId: this.clientId,\n });\n }\n\n async nextAction(group: MessageGroup) {\n const { paging } = group.meta;\n if (!paging.actions?.next) {\n return;\n }\n return this.postEnvelope(\n {\n action: {\n key: 'next',\n content: paging.actions.next,\n },\n localState: paging.localState,\n globalState: this.globalState,\n clientId: this.clientId,\n },\n group\n ).then((response) => {\n const listItemIndex = group.items.findIndex((item) => item.message[0] === 'link-list');\n if (listItemIndex === -1 || !response) {\n return group;\n }\n\n return {\n ...group,\n meta: {\n ...group.meta,\n ...response[0].meta,\n },\n items: [\n ...group.items.slice(0, listItemIndex),\n {\n ...group.items[listItemIndex],\n message: [\n response[0].items[0].message[0],\n {\n ...group.items[listItemIndex].message[1],\n ...response[0].items[0].message[1],\n },\n ],\n },\n ...group.items.slice(listItemIndex + 1),\n ],\n };\n });\n }\n\n async showContactMethodAction(data: {\n contactMethod: any;\n actionKey: string;\n entryId: string;\n }) {\n const entry = this.entries.find((e) => e.id === data.entryId);\n const actionItem = entry?.actions[data.actionKey];\n\n if (!actionItem) {\n return;\n }\n\n return this.postEnvelope({\n action: {\n key: data.actionKey,\n content: actionItem,\n },\n localState: entry.localState,\n globalState: this.globalState,\n clientId: this.clientId,\n });\n }\n\n async defaultAction(action: string) {\n const entry = this.getEntryOfAction(action);\n\n if (!entry) {\n return;\n }\n\n return this.postEnvelope({\n action: {\n key: action,\n content: entry.actions[action],\n },\n localState: entry.localState,\n globalState: this.globalState,\n clientId: this.clientId,\n });\n }\n\n private createInitialEnvelope(): ClientEnvelope {\n return {\n command: { site: this.endpoint },\n clientId: this.clientId,\n globalState: {},\n funnel: this.container.get('$widget').name,\n };\n }\n\n private async postEnvelope(envelope: ClientEnvelope, prevGroup?: MessageGroup) {\n try {\n const response = await fetch(this.endpoint, this.getHttpOptions(envelope));\n\n if (!response.ok) {\n throw response;\n }\n\n const data = await response.json();\n\n return this.handleResponse(data, prevGroup);\n } catch (error: any) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Something went wrong when posting the envelope.');\n }\n let message = 'Something went wrong';\n if (\n error.message === 'Failed to fetch' ||\n error.message === 'NetworkError when attempting to fetch resource.'\n ) {\n message = 'Lost connection... Please try again.';\n }\n return this.handleResponse({\n entries: [\n {\n id: uuid(),\n type: 'Error',\n timestamp: new Date().toISOString(),\n content: {\n message,\n },\n actions: {},\n tags: [],\n },\n ],\n });\n }\n }\n\n private async handleResponse(data: ServerEnvelope, prevGroup?: MessageGroup) {\n this.entries = this.entries.concat(data.entries);\n this.store.write(this.entries, 'entries');\n\n const widgetEntry = data.entries.find((e) => e.type === 'Widget');\n\n if (widgetEntry) {\n this.events.dispatch('provider:widget-entry', widgetEntry.content);\n }\n\n if (data.globalState) {\n this.globalState = data.globalState;\n this.store.write(data.globalState, 'globalState');\n }\n\n this.localState = data.entries.reduce<ServerEntry['localState']>((acc, entry) => {\n if (entry.localState) {\n return entry.localState;\n }\n return acc;\n }, undefined);\n this.store.write(this.localState, 'localState');\n\n const groups = await processEntries(this.container, data.entries, prevGroup);\n return groups;\n }\n\n private getHttpOptions(envelope: ClientEnvelope) {\n const fetchOptions = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n };\n envelope.funnel = this.container.get('$widget').name;\n envelope.localState = envelope.localState || this.localState;\n return Object.assign({}, fetchOptions, {\n body: JSON.stringify(envelope),\n credentials: 'same-origin' as RequestCredentials,\n });\n }\n\n private getEntryOfAction(action: string) {\n return this.entries.find((entry) => !!entry.actions[action]);\n }\n}\n\nexport default HttpClient;\n","import { createStorageWriter, readStorage, StorageCategory } from '@telia-ace/widget-services';\nimport { Container } from '@webprovisions/platform';\nimport { GlobalState, LooseObject, ServerEntry } from './types';\n\ntype MetaData = {\n agent: {\n name: string;\n avatar?: string;\n };\n};\n\ntype StorageTypes = 'localState' | 'globalState' | 'entries' | 'meta';\n\nclass Store {\n private enabled = true; // set whether or not to store data\n private botProviderGlobalStateKey = 'bot-provider-global-state';\n private botProviderLocalStateKey = 'bot-provider-local-state';\n private botProviderEntriesKey = 'bot-provider-entries';\n private botProviderMetaStateKey = 'bot-provider-conversation-meta';\n\n constructor(private container: Container) {}\n\n private getKey(type: StorageTypes) {\n let key;\n switch (type) {\n case 'localState':\n key = this.botProviderLocalStateKey;\n break;\n case 'globalState':\n key = this.botProviderGlobalStateKey;\n break;\n case 'entries':\n key = this.botProviderEntriesKey;\n break;\n case 'meta':\n key = this.botProviderMetaStateKey;\n break;\n\n default:\n break;\n }\n return key;\n }\n\n async read(type: 'localState'): Promise<LooseObject | undefined>;\n async read(type: 'meta'): Promise<MetaData | undefined>;\n async read(type: 'entries'): Promise<ServerEntry[] | undefined>;\n async read(type: 'globalState'): Promise<GlobalState | undefined>;\n async read(type: StorageTypes): Promise<any | undefined> {\n const key = this.getKey(type);\n if (!this.enabled || !key) {\n return;\n }\n\n return readStorage(this.container, key);\n }\n\n async write(data: any, type: StorageTypes) {\n const key = this.getKey(type);\n if (!this.enabled || !key) {\n return;\n }\n\n const write = await createStorageWriter(this.container, key, StorageCategory.Necessary);\n write(data);\n }\n}\n\nexport default Store;\n","import { ComponentNodeController } from '@telia-ace/knowledge-widget-core';\nimport { ConversationMessageListItemType } from '@telia-ace/widget-conversation';\nimport { createStorageWriter, StorageCategory } from '@telia-ace/widget-services';\nimport { uuid } from '@telia-ace/widget-utilities';\nimport { Container, EventManager, Widget } from '@webprovisions/platform';\nimport HttpClient from './http-client';\nimport Store from './store';\nimport { MessageGroup, ServerEntry } from './types';\nimport { createGroup, getKnowledgeBotEndpoint, setServiceClientParameter } from './utils';\n\nclass KnowledgeBotProvider {\n private agent: any;\n private user: any;\n private httpClient: HttpClient;\n private events: EventManager;\n private groups: MessageGroup[] = [];\n private store: Store;\n\n constructor(\n private container: Container,\n private conversation: any,\n component: ComponentNodeController\n ) {\n const { events } = this.container.get('$widget') as Widget;\n this.events = events;\n this.store = new Store(container);\n this.agent = conversation.createAgent({\n id: 'knowledge-bot-agent', // we need to specify an ID here to allow rehydration to work\n name: '',\n avatar: undefined,\n });\n this.user = conversation.user;\n const endpoint = getKnowledgeBotEndpoint(container, component);\n this.httpClient = new HttpClient(endpoint, events, this.store, this.container);\n\n this.events.subscribe('provider:widget-entry', (_event, data: ServerEntry['content']) => {\n this.onWidgetEntryReceived(data);\n });\n\n this.events.subscribe(\n 'provider:open-contact-method',\n async (_event, data: { contactMethod: any; entryId: string; actionKey: string }) => {\n const response = await this.httpClient.showContactMethodAction(data);\n\n if (response) {\n if (!!data.contactMethod.title) this.printUserMessage(data.contactMethod.title);\n this.onMessagesReceived(response);\n }\n }\n );\n }\n\n async initialize() {\n const loader = this.conversation.loading();\n\n const storedMeta = await this.store.read('meta');\n if (storedMeta?.agent) {\n this.agent.update({\n name: storedMeta.agent.name,\n avatar: storedMeta.agent.avatar,\n });\n }\n\n const rehydrated = await this.conversation.isRehydrated();\n\n const response = await this.httpClient.start({\n silent: this.conversation.options?.silent || rehydrated,\n });\n if (response) {\n this.onMessagesReceived(response);\n }\n\n loader();\n }\n\n async onMessagesReceived(groups: MessageGroup[]) {\n this.groups = this.groups.concat(groups);\n groups.forEach((group) => {\n const items = group.items.map((item) => item.message);\n if (group.isUser) {\n group.writer = this.user.print(items);\n } else {\n group.writer = this.agent.print(items);\n }\n });\n }\n\n async onInput(action: string | { [key: string]: any; actionKey: string; label?: string }) {\n const actionKey = typeof action === 'string' ? action : action.actionKey;\n\n switch (actionKey) {\n case 'next':\n {\n if (typeof action === 'string') {\n return;\n }\n const group = this.groups.find((other) => other.id === action.data?.groupId);\n\n if (group) {\n const response = await this.httpClient.nextAction(group);\n if (response) {\n const combined = response.items.map((item) => item.message);\n group.meta.paging = response?.meta.paging;\n group.writer.update(combined);\n }\n }\n }\n break;\n case 'help':\n {\n const loader = this.conversation.loading();\n\n const response = await this.httpClient.helpAction();\n loader();\n if (response) {\n this.onMessagesReceived(response);\n }\n }\n break;\n default:\n {\n if (typeof action !== 'string' && action.label) {\n this.printUserMessage(action.label);\n }\n const loader = this.conversation.loading();\n const response = await this.httpClient.defaultAction(actionKey);\n if (response) {\n this.onMessagesReceived(response);\n }\n loader();\n }\n break;\n }\n }\n\n private printUserMessage(message: string) {\n const group = createGroup({\n isUser: true,\n items: [\n {\n id: uuid(),\n isUser: true,\n message: [ConversationMessageListItemType.HTML, { body: message }],\n },\n ],\n });\n this.onMessagesReceived([group]);\n return group;\n }\n\n async onMessageSend(message: string) {\n const loader = this.conversation.loading();\n const response = await this.httpClient.sendMessage(message);\n\n await setServiceClientParameter(this.container, 'phrase', message);\n\n this.printUserMessage(message);\n\n if (response) {\n this.onMessagesReceived(response);\n }\n loader();\n }\n\n private async onWidgetEntryReceived(data: ServerEntry['content']) {\n if (data.agent) {\n const agentSettings = {\n name: data.agent.name,\n avatar: data.agent.avatar,\n };\n this.agent.update(agentSettings);\n const write = await createStorageWriter(\n this.container,\n 'bot-provider-conversation-meta',\n StorageCategory.Necessary\n );\n write({\n agent: agentSettings,\n });\n }\n }\n}\n\nexport default KnowledgeBotProvider;\n","import {\n ConversationPlatform,\n registerCustomMessageComponent,\n} from '@telia-ace/widget-conversation';\nimport { Container, Widget } from '@webprovisions/platform';\nimport KnowledgeBotProvider from './provider';\nimport { CustomMessageTypes } from './types';\n\nconst KnowledgeBotProviderPlugin = async (container: Container) => {\n const platform = await ConversationPlatform.getInstance(container);\n\n registerCustomMessageComponent(\n container,\n CustomMessageTypes.ContactList,\n import('./ui/contact-method-list')\n );\n registerCustomMessageComponent(\n container,\n CustomMessageTypes.ContactMethod,\n import('./ui/contact-method')\n );\n\n registerCustomMessageComponent(\n container,\n CustomMessageTypes.NotificationList,\n import('./ui/notification-list')\n );\n registerCustomMessageComponent(\n container,\n CustomMessageTypes.NoGoodAlternative,\n import('./ui/no-good-alternative')\n );\n registerCustomMessageComponent(\n container,\n CustomMessageTypes.FeedbackList,\n import('./ui/feedback-list')\n );\n\n platform.registerProvider('ace-knowledge-bot', (conversation, component) => {\n const provider = new KnowledgeBotProvider(container, conversation, component);\n provider.initialize();\n\n const subscriptions: any[] = [];\n subscriptions.push(\n component.actions.watch('conversation.user-submit', (input, next) => {\n provider.onMessageSend(input.text);\n })\n );\n\n subscriptions.push(\n component.actions.watch('conversation.action', (input, next) => {\n provider.onInput(input);\n\n return next(input);\n })\n );\n\n subscriptions.push(\n component.actions.create('evaluate', (input) => {\n const { events } = container.get('$widget') as Widget;\n events.dispatch('bot-provider:evaluate', input);\n })\n );\n\n subscriptions.push(\n component.actions.create('submit', (input) => {\n const { events } = container.get('$widget') as Widget;\n events.dispatch('bot-provider:form-submitted', input);\n })\n );\n\n return () => {\n // cleaning up when provider is disposed\n subscriptions.forEach((unsubscribe) => {\n unsubscribe();\n });\n };\n });\n};\n\nexport default KnowledgeBotProviderPlugin;\n"],"names":["CustomMessageTypes","convertLegacySymbol","symbol","type","content","createGroup","isUser","items","meta","groupId","uuid","i","contactMethodFromLegacy","id","title","defaultIcon","exit","exitType","confirmationText","expandFormAutomatically","form","description","options","adapter","clientName","adapterSettings","customClientName","validation","settings","displayTextBeforeClick","textBeforeClick","FormBuilder","updateForm","getListType","entry","state","ConversationMessageListItemType","getKnowledgeBotEndpoint","container","component","knowledgeBotEndpoint","data","contactMethod","submit","errors","_a","body","builder","submitButton","__spreadProps","__spreadValues","setServiceClientParameter","key","value","__async","createGroupItem","messageId","message","group","processEntries","entries","prevGroup","createListContent","listType","listContent","contactMethodIds","action","entryAction","transform","_0","_1","_2","related","_b","header","html","result","pagingEntry","e","fallbackEntry","fallbackAction","contactMethodListEntry","dialogListEntry","feedbackEntry","contactMethodEntry","notice","splitEntry","acc","item","sortMap","filteredEntries","other","sortValue","sortValueOther","isNonVisibleRelatedEntry","relatedEntries","HttpClient","endpoint","events","store","__publicField","silent","storedGlobalState","storedLocalState","storedEntries","envelope","paging","response","listItemIndex","actionItem","error","widgetEntry","fetchOptions","HttpClient$1","Store","readStorage","createStorageWriter","StorageCategory","Store$1","KnowledgeBotProvider","conversation","_event","loader","storedMeta","rehydrated","groups","actionKey","combined","agentSettings","KnowledgeBotProvider$1","KnowledgeBotProviderPlugin","platform","ConversationPlatform","registerCustomMessageComponent","provider","subscriptions","input","next","unsubscribe","KnowledgeBotProviderPlugin$1"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEY,IAAAA,sBAAAA,OACRA,EAAA,gBAAgB,oCAChBA,EAAA,cAAc,kCACdA,EAAA,eAAe,mCACfA,EAAA,mBAAmB,uCACnBA,EAAA,oBAAoB,yCALZA,IAAAA,KAAA,CAAA,CAAA;ACMZ,MAAMC,KAAsB,CAACC,MAAmE;AAC5F,MAAIA,GAAQ;AACF,UAAA,EAAE,MAAAC,GAAM,SAAAC,EAAY,IAAAF;AAC1B,QAAIC,KAAQC;AACD,aAAA,EAAE,MAAAD,GAAM,SAAAC;EAEvB;AACJ,GAEaC,IAAc,CAAC;AAAA,EACxB,QAAAC;AAAA,EACA,OAAAC,IAAQ,CAAC;AAAA,EACT,MAAAC,IAAO,CAAC;AACZ,MAIM;AACF,QAAMC,IAAUC;AAgBT,SAdO;AAAA,IACV,IAAID;AAAA,IACJ,QAAAH;AAAA,IACA,OAAOC,EAAM,IAAI,CAACI,OACP;AAAA,MACH,IAAIA,EAAE,MAAMD,EAAK;AAAA,MACjB,QAAAJ;AAAA,MACA,SAAAG;AAAA,MACA,SAASE,EAAE,WAAW,CAAC;AAAA,IAAA,EAE9B;AAAA,IACD,MAAAH;AAAA,EAAA;AAIR,GAEaI,KAA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