@telia-ace/knowledge-widget-bot-provider 0.0.23-next.4 → 0.0.23-next.6
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 +128 -0
- package/dist/contact-method-list.3e8849ee.js.map +1 -0
- package/dist/contact-method.4c64aaa7.js +136 -0
- package/dist/contact-method.4c64aaa7.js.map +1 -0
- package/dist/{feedback-list.73d8aa69.js → feedback-list.ff7e22da.js} +15 -14
- package/dist/feedback-list.ff7e22da.js.map +1 -0
- package/dist/{index.4cc04b4e.js → index.a97894e5.js} +6 -6
- package/dist/{index.4cc04b4e.js.map → index.a97894e5.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/{no-good-alternative.e5e48f22.js → no-good-alternative.e9155cb9.js} +12 -12
- package/dist/no-good-alternative.e9155cb9.js.map +1 -0
- package/dist/notification-list.7fd5ba2b.js +67 -0
- package/dist/notification-list.7fd5ba2b.js.map +1 -0
- package/package.json +5 -5
- package/dist/contact-method-list.e0e6b881.js +0 -127
- package/dist/contact-method-list.e0e6b881.js.map +0 -1
- package/dist/contact-method.20d7a622.js +0 -136
- package/dist/contact-method.20d7a622.js.map +0 -1
- package/dist/feedback-list.73d8aa69.js.map +0 -1
- package/dist/no-good-alternative.e5e48f22.js.map +0 -1
- package/dist/notification-list.c3df3ee1.js +0 -66
- package/dist/notification-list.c3df3ee1.js.map +0 -1
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
var k = Object.defineProperty, z = Object.defineProperties;
|
|
2
|
-
var I = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var x = Object.getOwnPropertySymbols;
|
|
4
|
-
var L = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var M = (t, e, n) => e in t ? k(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, l = (t, e) => {
|
|
6
|
-
for (var n in e || (e = {}))
|
|
7
|
-
L.call(e, n) && M(t, n, e[n]);
|
|
8
|
-
if (x)
|
|
9
|
-
for (var n of x(e))
|
|
10
|
-
j.call(e, n) && M(t, n, e[n]);
|
|
11
|
-
return t;
|
|
12
|
-
}, E = (t, e) => z(t, I(e));
|
|
13
|
-
var $ = (t, e, n) => new Promise((p, s) => {
|
|
14
|
-
var m = (o) => {
|
|
15
|
-
try {
|
|
16
|
-
r(n.next(o));
|
|
17
|
-
} catch (i) {
|
|
18
|
-
s(i);
|
|
19
|
-
}
|
|
20
|
-
}, u = (o) => {
|
|
21
|
-
try {
|
|
22
|
-
r(n.throw(o));
|
|
23
|
-
} catch (i) {
|
|
24
|
-
s(i);
|
|
25
|
-
}
|
|
26
|
-
}, r = (o) => o.done ? p(o.value) : Promise.resolve(o.value).then(m, u);
|
|
27
|
-
r((n = n.apply(t, e)).next());
|
|
28
|
-
});
|
|
29
|
-
import y from "@emotion/styled";
|
|
30
|
-
import { ContactList as v, ContactMethod as w } from "@telia-ace/knowledge-widget-adapters";
|
|
31
|
-
import { useDispatch as A, useContainer as K } from "@telia-ace/knowledge-widget-ui";
|
|
32
|
-
import h, { useState as b, useEffect as P } from "react";
|
|
33
|
-
import R from "./contact-method.20d7a622.js";
|
|
34
|
-
import "@telia-ace/knowledge-data-client";
|
|
35
|
-
import "@telia-ace/widget-forms";
|
|
36
|
-
import "./index.4cc04b4e.js";
|
|
37
|
-
import "@telia-ace/widget-conversation";
|
|
38
|
-
import "@telia-ace/widget-services";
|
|
39
|
-
import "@telia-ace/widget-utilities";
|
|
40
|
-
const Y = ({ actions: t, entryId: e, groupId: n }) => {
|
|
41
|
-
const p = A(), s = K(), [m, u] = b([]), [r, o] = b([]);
|
|
42
|
-
return P(() => {
|
|
43
|
-
s.getAsync("contactMethods").then((i) => {
|
|
44
|
-
if (!i)
|
|
45
|
-
return;
|
|
46
|
-
const f = t.map((d) => $(void 0, null, function* () {
|
|
47
|
-
var g;
|
|
48
|
-
if (!((g = d.data) != null && g.clientName))
|
|
49
|
-
return null;
|
|
50
|
-
const c = yield i.handleAdapters(d.data);
|
|
51
|
-
return E(l(l({}, c), d.data), {
|
|
52
|
-
description: d.data.description ? d.data.description : c.description,
|
|
53
|
-
onClick: (C, a) => {
|
|
54
|
-
if (typeof c.onClick == "function" && c.onClick(C, a), !C.defaultPrevented)
|
|
55
|
-
if (a.inline && !a.expanded)
|
|
56
|
-
o([...r, a.id]);
|
|
57
|
-
else {
|
|
58
|
-
const { events: S } = s.get("$widget");
|
|
59
|
-
S.dispatch("provider:open-contact-method", {
|
|
60
|
-
entryId: e,
|
|
61
|
-
contactMethod: a,
|
|
62
|
-
actionKey: d.actionKey
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}));
|
|
68
|
-
Promise.all(f).then((d) => {
|
|
69
|
-
u(d.filter((c) => !!c));
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}, [t, s, e, r]), m.length ? /* @__PURE__ */ h.createElement(
|
|
73
|
-
D,
|
|
74
|
-
{
|
|
75
|
-
contactMethods: m,
|
|
76
|
-
dispatch: p,
|
|
77
|
-
itemRenderer: (i, f) => (r.includes(i.id) || i.expanded) && i.inline ? /* @__PURE__ */ h.createElement(
|
|
78
|
-
G,
|
|
79
|
-
{
|
|
80
|
-
contactMethodId: i.id,
|
|
81
|
-
groupId: n,
|
|
82
|
-
guideId: i.body.guideId
|
|
83
|
-
}
|
|
84
|
-
) : /* @__PURE__ */ h.createElement(N, l(l({}, i), f))
|
|
85
|
-
}
|
|
86
|
-
) : null;
|
|
87
|
-
}, D = y(v)`
|
|
88
|
-
> ul > li {
|
|
89
|
-
a {
|
|
90
|
-
display: flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
outline-offset: -2px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&:not(:last-child) {
|
|
96
|
-
${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
`, G = y(R)`
|
|
100
|
-
i {
|
|
101
|
-
margin: 0 ${(t) => {
|
|
102
|
-
var e;
|
|
103
|
-
return (e = t.theme.sizes) == null ? void 0 : e.medium;
|
|
104
|
-
}} 0 0;
|
|
105
|
-
display: flex;
|
|
106
|
-
justify-content: center;
|
|
107
|
-
align-items: center;
|
|
108
|
-
}
|
|
109
|
-
`, N = y(w)`
|
|
110
|
-
padding: ${(t) => {
|
|
111
|
-
var e;
|
|
112
|
-
return (e = t.theme.sizes) == null ? void 0 : e.medium;
|
|
113
|
-
}};
|
|
114
|
-
i {
|
|
115
|
-
margin: 0 ${(t) => {
|
|
116
|
-
var e;
|
|
117
|
-
return (e = t.theme.sizes) == null ? void 0 : e.medium;
|
|
118
|
-
}} 0 0;
|
|
119
|
-
display: flex;
|
|
120
|
-
justify-content: center;
|
|
121
|
-
align-items: center;
|
|
122
|
-
}
|
|
123
|
-
`;
|
|
124
|
-
export {
|
|
125
|
-
Y as default
|
|
126
|
-
};
|
|
127
|
-
//# sourceMappingURL=contact-method-list.e0e6b881.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contact-method-list.e0e6b881.js","sources":["../src/ui/contact-method-list.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport {\n ContactList,\n ContactMethod as GenericContactMethod,\n ContactMethodType,\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 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;AAE7C,eAAAI,EAAAC,IAAA,IACAF,IACAH,EAAO,OAFP;AAAA,UAGH,aAAaA,EAAO,KAAK,cAAcA,EAAO,KAAK,cAAcG,EAAG;AAAA,UACpE,SAAS,CAACG,GAAyBC,MAA4B;AAK3D,gBAJI,OAAOJ,EAAG,WAAY,cACnBA,EAAA,QAAQG,GAAOC,CAAI,GAGtB,CAAAD,EAAM;AAGV,kBAAIC,EAAK,UAAU,CAACA,EAAK;AACrB,gBAAAX,EAAY,CAAC,GAAGD,GAAUY,EAAK,EAAE,CAAC;AAAA,mBAC/B;AACH,sBAAM,EAAE,QAAAC,EAAW,IAAAlB,EAAU,IAAI,SAAS;AAC1C,gBAAAkB,EAAO,SAAS,gCAAgC;AAAA,kBAC5C,SAAAtB;AAAA,kBACA,eAAeqB;AAAA,kBACf,WAAWP,EAAO;AAAA,gBAAA,CACrB;AAAA,cACL;AAAA,UACJ;AAAA,QAAA;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}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
var T = Object.defineProperty, _ = Object.defineProperties;
|
|
2
|
-
var k = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var R = Object.getOwnPropertySymbols;
|
|
4
|
-
var G = Object.prototype.hasOwnProperty, I = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var x = (e, t, r) => t in e ? T(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, a = (e, t) => {
|
|
6
|
-
for (var r in t || (t = {}))
|
|
7
|
-
G.call(t, r) && x(e, r, t[r]);
|
|
8
|
-
if (R)
|
|
9
|
-
for (var r of R(t))
|
|
10
|
-
I.call(t, r) && x(e, r, t[r]);
|
|
11
|
-
return e;
|
|
12
|
-
}, s = (e, t) => _(e, k(t));
|
|
13
|
-
var p = (e, t, r) => new Promise((h, o) => {
|
|
14
|
-
var d = (n) => {
|
|
15
|
-
try {
|
|
16
|
-
y(r.next(n));
|
|
17
|
-
} catch (u) {
|
|
18
|
-
o(u);
|
|
19
|
-
}
|
|
20
|
-
}, c = (n) => {
|
|
21
|
-
try {
|
|
22
|
-
y(r.throw(n));
|
|
23
|
-
} catch (u) {
|
|
24
|
-
o(u);
|
|
25
|
-
}
|
|
26
|
-
}, y = (n) => n.done ? h(n.value) : Promise.resolve(n.value).then(d, c);
|
|
27
|
-
y((r = r.apply(e, t)).next());
|
|
28
|
-
});
|
|
29
|
-
import V from "@emotion/styled";
|
|
30
|
-
import { DataClient as j, DataType as q } from "@telia-ace/knowledge-data-client";
|
|
31
|
-
import { ContactMethod as H } from "@telia-ace/knowledge-widget-adapters";
|
|
32
|
-
import { useContainer as J, useDispatch as K, useConversation as L } from "@telia-ace/knowledge-widget-ui";
|
|
33
|
-
import { FormBuilder as N } from "@telia-ace/widget-forms";
|
|
34
|
-
import O, { useState as P, useRef as Q, useEffect as z, useCallback as U } from "react";
|
|
35
|
-
import { u as A } from "./index.4cc04b4e.js";
|
|
36
|
-
import "@telia-ace/widget-conversation";
|
|
37
|
-
import "@telia-ace/widget-services";
|
|
38
|
-
import "@telia-ace/widget-utilities";
|
|
39
|
-
const mt = ({ contactMethodId: e, guideId: t, groupId: r, className: h }) => {
|
|
40
|
-
var g, E, S;
|
|
41
|
-
const [o, d] = P(), c = J(), y = K(), n = Q(!0), u = L();
|
|
42
|
-
z(() => {
|
|
43
|
-
const { events: l } = c.get("$widget"), $ = l.subscribe("bot-provider:form-submitted", (C, m) => p(void 0, null, function* () {
|
|
44
|
-
var D;
|
|
45
|
-
if (((D = m.form.meta) == null ? void 0 : D.groupId) !== r || m.id !== o.id)
|
|
46
|
-
return;
|
|
47
|
-
u && (m.form.meta || (m.form.meta = {}), m.form.meta.conversation = u);
|
|
48
|
-
const v = yield c.getAsync("contactMethods"), i = s(a({}, o), {
|
|
49
|
-
body: s(a({}, o.body), {
|
|
50
|
-
form: m.form
|
|
51
|
-
})
|
|
52
|
-
}), { errors: b, valid: M, errorTypes: X } = yield v.validate(i);
|
|
53
|
-
if (!M) {
|
|
54
|
-
const F = new N(o.body.form);
|
|
55
|
-
d(void 0), F.setValidationErrors(b), i.body = s(a({}, i.body), {
|
|
56
|
-
form: F.get()
|
|
57
|
-
}), d(a({}, i));
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const B = yield v.submit(i);
|
|
61
|
-
i.confirmation = B, d(i);
|
|
62
|
-
})), f = l.subscribe("bot-provider:evaluate", (C, m) => p(void 0, null, function* () {
|
|
63
|
-
if (m.id != e)
|
|
64
|
-
return;
|
|
65
|
-
const i = yield (yield c.getAsync("contactMethods")).evaluate(o);
|
|
66
|
-
let b = s(a({}, o), {
|
|
67
|
-
body: s(a({}, o.body), {
|
|
68
|
-
form: i
|
|
69
|
-
})
|
|
70
|
-
});
|
|
71
|
-
const M = A(b, {
|
|
72
|
-
submit: "Submit",
|
|
73
|
-
errors: {},
|
|
74
|
-
meta: { groupId: r }
|
|
75
|
-
});
|
|
76
|
-
b = s(a({}, b), {
|
|
77
|
-
body: M
|
|
78
|
-
}), d(b);
|
|
79
|
-
}));
|
|
80
|
-
return () => {
|
|
81
|
-
$(), f();
|
|
82
|
-
};
|
|
83
|
-
}, [c, o, d, u]);
|
|
84
|
-
const w = U(
|
|
85
|
-
(l) => p(void 0, null, function* () {
|
|
86
|
-
const f = yield (yield j.getInstance(c)).fetch(
|
|
87
|
-
q.ContactMethod,
|
|
88
|
-
{
|
|
89
|
-
contactMethodId: l,
|
|
90
|
-
guideId: t
|
|
91
|
-
},
|
|
92
|
-
{ noCache: !0 }
|
|
93
|
-
), C = A(f, {
|
|
94
|
-
submit: "Submit",
|
|
95
|
-
errors: {},
|
|
96
|
-
meta: { groupId: r }
|
|
97
|
-
});
|
|
98
|
-
if (f.body = C, f.body.guideId = t, !n.current)
|
|
99
|
-
return null;
|
|
100
|
-
d(f);
|
|
101
|
-
}),
|
|
102
|
-
[n]
|
|
103
|
-
);
|
|
104
|
-
return z(() => (w(e), () => {
|
|
105
|
-
n.current = !1;
|
|
106
|
-
}), [e, w]), o ? /* @__PURE__ */ O.createElement(
|
|
107
|
-
W,
|
|
108
|
-
s(a({}, o), {
|
|
109
|
-
body: s(a({}, o.body), {
|
|
110
|
-
form: o.body.form ? s(a({}, o.body.form), {
|
|
111
|
-
data: (g = o.body.form) == null ? void 0 : g.data,
|
|
112
|
-
layout: a({}, o.body.form.layout),
|
|
113
|
-
meta: (E = o.body.form) == null ? void 0 : E.meta,
|
|
114
|
-
schema: (S = o.body.form) == null ? void 0 : S.schema
|
|
115
|
-
}) : void 0,
|
|
116
|
-
guideId: o.body.guideId
|
|
117
|
-
}),
|
|
118
|
-
inline: !0,
|
|
119
|
-
expanded: !0,
|
|
120
|
-
dispatch: y,
|
|
121
|
-
className: h
|
|
122
|
-
})
|
|
123
|
-
) : null;
|
|
124
|
-
}, W = V(H)`
|
|
125
|
-
padding: ${(e) => {
|
|
126
|
-
var t;
|
|
127
|
-
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
128
|
-
}} ${(e) => {
|
|
129
|
-
var t;
|
|
130
|
-
return (t = e.theme.sizes) == null ? void 0 : t.medium;
|
|
131
|
-
}};
|
|
132
|
-
`;
|
|
133
|
-
export {
|
|
134
|
-
mt as default
|
|
135
|
-
};
|
|
136
|
-
//# sourceMappingURL=contact-method.20d7a622.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contact-method.20d7a622.js","sources":["../src/ui/contact-method.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { DataClient, DataType } from '@telia-ace/knowledge-data-client';\nimport {\n ContactMethod as GenericContactMethod,\n ContactMethodPlatform,\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 { 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={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","styled","GenericContactMethod","p"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,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,Q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MyC,IAA6BG,EAAOC,CAAoB;AAAA,eAC/C,CAACC,MAAM;;AAAA,UAAA5B,IAAA4B,EAAE,MAAM,UAAR,gBAAA5B,EAAe;AAAA,KAAU,CAAC4B,MAAA;;AAAM,UAAA5B,IAAA4B,EAAE,MAAM,UAAR,gBAAA5B,EAAe;AAAA;AAAA;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"feedback-list.73d8aa69.js","sources":["../src/ui/feedback-list.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport {\n Button,\n buttonCss,\n Icon,\n invertedHoverButton,\n list,\n List,\n useDispatch,\n} from '@telia-ace/knowledge-widget-ui';\nimport React from 'react';\nimport { messageContentPadding } from './styles';\n\ntype Props = {\n actions: { [key: string]: string }[];\n};\nconst FeedbackList: React.FC<Props> = ({ actions }) => {\n const dispatch = useDispatch();\n return (\n <StyledButtonList\n items={actions}\n data-direction={'vertical'}\n renderItem={(item: any) => {\n return (\n <li key={item.actionKey}>\n <FeedbackButton\n className=\"humany-feedback-button\"\n disabled={false}\n aria-pressed={true}\n data-selected={true}\n onClick={() => {\n dispatch('action', item.actionKey);\n }}\n >\n <Icon faIcon={item.actionKey == 'yes' ? 'smile-o' : 'frown-o'} />\n <span>{item.label}</span>\n </FeedbackButton>\n </li>\n );\n }}\n />\n );\n};\n\nexport default FeedbackList;\n\nconst StyledButtonList = styled(List)<{ 'data-direction': 'horizontal' | 'vertical' } & any>`\n ${(p) => list(p)}\n ${messageContentPadding}\n display: flex;\n gap: ${(p) => p.theme.sizes?.normal};\n flex-direction: ${(p) => (p['data-direction'] === 'horizontal' ? 'row' : 'column')};\n > li {\n flex: 1;\n margin: 0;\n }\n`;\n\nconst FeedbackButton = styled(Button)<{\n 'data-selected': boolean;\n}>`\n ${buttonCss}\n font-size: ${(p) => p.theme.fonts?.normal};\n border-color: ${(p) => p.theme.colors?.primary};\n font-weight: 300;\n display: block;\n width: 100%;\n\n ${(p) =>\n invertedHoverButton({\n primaryColor: `${p.theme.colors?.primary}`,\n secondaryColor: '#FFFFFF',\n theme: p.theme,\n })}\n i {\n margin: 0 ${(p) => p.theme.sizes?.small} 0 0;\n }\n span {\n }\n`;\n"],"names":["FeedbackList","actions","dispatch","useDispatch","React","StyledButtonList","item","FeedbackButton","Icon","styled","List","p","list","messageContentPadding","_a","Button","buttonCss","invertedHoverButton"],"mappings":";;;;;AAgBA,MAAMA,IAAgC,CAAC,EAAE,SAAAC,QAAc;AACnD,QAAMC,IAAWC;AAEb,SAAA,gBAAAC,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,OAAOJ;AAAA,MACP,kBAAgB;AAAA,MAChB,YAAY,CAACK,MAEJ,gBAAAF,EAAA,cAAA,MAAA,EAAG,KAAKE,EAAK,aACV,gBAAAF,EAAA;AAAA,QAACG;AAAA,QAAA;AAAA,UACG,WAAU;AAAA,UACV,UAAU;AAAA,UACV,gBAAc;AAAA,UACd,iBAAe;AAAA,UACf,SAAS,MAAM;AACF,YAAAL,EAAA,UAAUI,EAAK,SAAS;AAAA,UACrC;AAAA,QAAA;AAAA,wCAECE,GAAK,EAAA,QAAQF,EAAK,aAAa,QAAQ,YAAY,WAAW;AAAA,QAC/D,gBAAAF,EAAA,cAAC,QAAM,MAAAE,EAAK,KAAM;AAAA,MAAA,CAE1B;AAAA,IAER;AAAA,EAAA;AAGZ,GAIMD,IAAmBI,EAAOC,CAAI;AAAA,MAC9B,CAACC,MAAMC,EAAKD,CAAC;AAAA,MACbE;AAAA;AAAA,WAEK,CAACF,MAAM;;AAAA,UAAAG,IAAAH,EAAE,MAAM,UAAR,gBAAAG,EAAe;AAAA;AAAA,sBACX,CAACH,MAAOA,EAAE,sBAAsB,eAAe,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,GAOvEJ,IAAiBE,EAAOM,CAAM;AAAA,MAG9BC;AAAA,iBACW,CAACL,MAAM;;AAAA,UAAAG,IAAAH,EAAE,MAAM,UAAR,gBAAAG,EAAe;AAAA;AAAA,oBACnB,CAACH,MAAM;;AAAA,UAAAG,IAAAH,EAAE,MAAM,WAAR,gBAAAG,EAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAKrC,CAACH;;AACC,SAAAM,EAAoB;AAAA,IAChB,cAAc,IAAGH,IAAAH,EAAE,MAAM,WAAR,gBAAAG,EAAgB;AAAA,IACjC,gBAAgB;AAAA,IAChB,OAAOH,EAAE;AAAA,EACb,CAAC;AAAA;AAAA;AAAA,oBAEW,CAACA,MAAM;;AAAA,UAAAG,IAAAH,EAAE,MAAM,UAAR,gBAAAG,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-good-alternative.e5e48f22.js","sources":["../src/ui/no-good-alternative.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { borderTabStyle, Button, SymbolBadge, useDispatch } from '@telia-ace/knowledge-widget-ui';\nimport React from 'react';\nimport { messageContentPadding } from './styles';\n\ntype Props = {\n body: string;\n};\nconst NoGoodAlternative: React.FC<Props> = ({ body }) => {\n const dispatch = useDispatch();\n return (\n <Wrapper>\n <StyledButton\n onClick={() => {\n dispatch('action', 'help');\n }}\n aria-label={body}\n title={body}\n >\n <SymbolBadge\n size={14}\n symbol={{\n type: 'FontAwesome',\n content: 'meh-o',\n }}\n />\n <span>{body}</span>\n </StyledButton>\n </Wrapper>\n );\n};\n\nexport default NoGoodAlternative;\n\nconst Wrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n ${messageContentPadding}\n`;\n\nconst StyledButton = styled(Button)`\n > i,\n svg {\n margin-right: ${(p) => p.theme.sizes?.small};\n }\n\n &:focus-visible {\n ${borderTabStyle}\n }\n`;\n"],"names":["NoGoodAlternative","body","dispatch","useDispatch","Wrapper","React","StyledButton","SymbolBadge","styled","messageContentPadding","Button","p","_a","borderTabStyle"],"mappings":";;;;;AAQA,MAAMA,IAAqC,CAAC,EAAE,MAAAC,QAAW;AACrD,QAAMC,IAAWC;AACjB,yCACKC,GACG,MAAA,gBAAAC,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,SAAS,MAAM;AACX,QAAAJ,EAAS,UAAU,MAAM;AAAA,MAC7B;AAAA,MACA,cAAYD;AAAA,MACZ,OAAOA;AAAA,IAAA;AAAA,IAEP,gBAAAI,EAAA;AAAA,MAACE;AAAA,MAAA;AAAA,QACG,MAAM;AAAA,QACN,QAAQ;AAAA,UACJ,MAAM;AAAA,UACN,SAAS;AAAA,QACb;AAAA,MAAA;AAAA,IACJ;AAAA,IACA,gBAAAF,EAAA,cAAC,cAAMJ,CAAK;AAAA,EAAA,CAEpB;AAER,GAIMG,IAAUI,EAAO;AAAA;AAAA;AAAA;AAAA,MAIjBC;AAAA,GAGAH,IAAeE,EAAOE,CAAM;AAAA;AAAA;AAAA,wBAGV,CAACC,MAAM;;AAAA,UAAAC,IAAAD,EAAE,MAAM,UAAR,gBAAAC,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA,UAIpCC;AAAA;AAAA;"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var L = Object.defineProperty;
|
|
2
|
-
var r = Object.getOwnPropertySymbols;
|
|
3
|
-
var l = Object.prototype.hasOwnProperty, f = Object.prototype.propertyIsEnumerable;
|
|
4
|
-
var d = (t, i, o) => i in t ? L(t, i, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[i] = o, m = (t, i) => {
|
|
5
|
-
for (var o in i || (i = {}))
|
|
6
|
-
l.call(i, o) && d(t, o, i[o]);
|
|
7
|
-
if (r)
|
|
8
|
-
for (var o of r(i))
|
|
9
|
-
f.call(i, o) && d(t, o, i[o]);
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
var c = (t, i) => {
|
|
13
|
-
var o = {};
|
|
14
|
-
for (var e in t)
|
|
15
|
-
l.call(t, e) && i.indexOf(e) < 0 && (o[e] = t[e]);
|
|
16
|
-
if (t != null && r)
|
|
17
|
-
for (var e of r(t))
|
|
18
|
-
i.indexOf(e) < 0 && f.call(t, e) && (o[e] = t[e]);
|
|
19
|
-
return o;
|
|
20
|
-
};
|
|
21
|
-
import b from "@emotion/styled";
|
|
22
|
-
import { NotificationList as g } from "@telia-ace/knowledge-widget-ui";
|
|
23
|
-
import y, { useMemo as N } from "react";
|
|
24
|
-
import { m as x } from "./styles.a00306c5.js";
|
|
25
|
-
import "@emotion/react";
|
|
26
|
-
const M = (h) => {
|
|
27
|
-
var a = h, { id: t, header: i, items: o, symbol: e, className: p } = a, u = c(a, ["id", "header", "items", "symbol", "className"]);
|
|
28
|
-
const s = N(() => ({
|
|
29
|
-
id: t,
|
|
30
|
-
title: i,
|
|
31
|
-
symbol: e,
|
|
32
|
-
defaultHeaderOptions: {
|
|
33
|
-
visible: !0
|
|
34
|
-
},
|
|
35
|
-
notifications: o.map((n) => ({
|
|
36
|
-
id: n.id.toString(),
|
|
37
|
-
title: n.title,
|
|
38
|
-
body: n.body,
|
|
39
|
-
modified: n.modified,
|
|
40
|
-
expandable: !0
|
|
41
|
-
}))
|
|
42
|
-
}), [i, o]);
|
|
43
|
-
return s ? /* @__PURE__ */ y.createElement(
|
|
44
|
-
$,
|
|
45
|
-
m({
|
|
46
|
-
className: p,
|
|
47
|
-
showHeader: !0,
|
|
48
|
-
notificationList: s,
|
|
49
|
-
loading: !1
|
|
50
|
-
}, u)
|
|
51
|
-
) : null;
|
|
52
|
-
}, $ = b(g)`
|
|
53
|
-
${x}
|
|
54
|
-
min-width: 10em;
|
|
55
|
-
|
|
56
|
-
span {
|
|
57
|
-
color: ${(t) => {
|
|
58
|
-
var i;
|
|
59
|
-
return (i = t.theme.colors) == null ? void 0 : i.text;
|
|
60
|
-
}};
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
export {
|
|
64
|
-
M as default
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=notification-list.c3df3ee1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notification-list.c3df3ee1.js","sources":["../src/ui/notification-list.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { NotificationList as NotificationListUi, Symbol } from '@telia-ace/knowledge-widget-ui';\nimport React, { useMemo } from 'react';\nimport { messageContentPadding } from './styles';\n\ntype Props = {\n id: string;\n header: string;\n items: any[];\n symbol?: Symbol;\n className?: string;\n};\nconst NotificationList: React.FC<Props> = ({ id, header, items, symbol, className, ...other }) => {\n const list = useMemo(() => {\n return {\n id: id,\n title: header,\n symbol,\n defaultHeaderOptions: {\n visible: true,\n },\n notifications: items.map((item) => ({\n id: item.id.toString(),\n title: item.title,\n body: item.body,\n modified: item.modified,\n expandable: true,\n })),\n };\n }, [header, items]);\n\n if (!list) {\n return null;\n }\n\n return (\n <StyledNotificationListUi\n className={className}\n showHeader={true}\n notificationList={list}\n loading={false}\n {...other}\n />\n );\n};\n\nexport default NotificationList;\n\nconst StyledNotificationListUi = styled(NotificationListUi)`\n ${messageContentPadding}\n min-width: 10em;\n\n span {\n color: ${(p) => p.theme.colors?.text};\n }\n`;\n"],"names":["NotificationList","_a","_b","id","header","items","symbol","className","other","__objRest","list","useMemo","item","React","StyledNotificationListUi","__spreadValues","styled","NotificationListUi","messageContentPadding","p"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAYM,MAAAA,IAAoC,CAACC,MAAuD;AAAvD,MAAAC,IAAAD,GAAE,MAAAE,GAAI,QAAAC,GAAQ,OAAAC,GAAO,QAAAC,GAAQ,WAAAC,MAA7BL,GAA2CM,IAAAC,EAA3CP,GAA2C,CAAzC,MAAI,UAAQ,SAAO,UAAQ;AAC9D,QAAAQ,IAAOC,EAAQ,OACV;AAAA,IACH,IAAAR;AAAA,IACA,OAAOC;AAAA,IACP,QAAAE;AAAA,IACA,sBAAsB;AAAA,MAClB,SAAS;AAAA,IACb;AAAA,IACA,eAAeD,EAAM,IAAI,CAACO,OAAU;AAAA,MAChC,IAAIA,EAAK,GAAG,SAAS;AAAA,MACrB,OAAOA,EAAK;AAAA,MACZ,MAAMA,EAAK;AAAA,MACX,UAAUA,EAAK;AAAA,MACf,YAAY;AAAA,IAAA,EACd;AAAA,EAAA,IAEP,CAACR,GAAQC,CAAK,CAAC;AAElB,SAAKK,IAKD,gBAAAG,EAAA;AAAA,IAACC;AAAA,IAAAC,EAAA;AAAA,MACG,WAAAR;AAAA,MACA,YAAY;AAAA,MACZ,kBAAkBG;AAAA,MAClB,SAAS;AAAA,OACLF;AAAA,EAAA,IATD;AAYf,GAIMM,IAA2BE,EAAOC,CAAkB;AAAA,MACpDC;AAAA;AAAA;AAAA;AAAA,iBAIW,CAACC,MAAM;;AAAA,UAAAlB,IAAAkB,EAAE,MAAM,WAAR,gBAAAlB,EAAgB;AAAA;AAAA;AAAA;"}
|