@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.
@@ -0,0 +1,128 @@
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 = (e, t, n) => t in e ? k(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, l = (e, t) => {
6
+ for (var n in t || (t = {}))
7
+ L.call(t, n) && M(e, n, t[n]);
8
+ if (x)
9
+ for (var n of x(t))
10
+ j.call(t, n) && M(e, n, t[n]);
11
+ return e;
12
+ }, E = (e, t) => z(e, I(t));
13
+ var $ = (e, t, n) => new Promise((p, r) => {
14
+ var m = (o) => {
15
+ try {
16
+ d(n.next(o));
17
+ } catch (i) {
18
+ r(i);
19
+ }
20
+ }, u = (o) => {
21
+ try {
22
+ d(n.throw(o));
23
+ } catch (i) {
24
+ r(i);
25
+ }
26
+ }, d = (o) => o.done ? p(o.value) : Promise.resolve(o.value).then(m, u);
27
+ d((n = n.apply(e, t)).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 N } from "react";
33
+ import P from "./contact-method.4c64aaa7.js";
34
+ import "@telia-ace/knowledge-data-client";
35
+ import "@telia-ace/widget-forms";
36
+ import "@telia-ace/widget-utilities";
37
+ import "./index.a97894e5.js";
38
+ import "@telia-ace/widget-conversation";
39
+ import "@telia-ace/widget-services";
40
+ const Y = ({ actions: e, entryId: t, groupId: n }) => {
41
+ const p = A(), r = K(), [m, u] = b([]), [d, o] = b([]);
42
+ return N(() => {
43
+ r.getAsync("contactMethods").then((i) => {
44
+ if (!i)
45
+ return;
46
+ const f = e.map((s) => $(void 0, null, function* () {
47
+ var g;
48
+ if (!((g = s.data) != null && g.clientName))
49
+ return null;
50
+ const c = yield i.handleAdapters(s.data);
51
+ return E(l(l({}, c), s.data), {
52
+ description: s.data.description ? s.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([...d, a.id]);
57
+ else {
58
+ const { events: S } = r.get("$widget");
59
+ S.dispatch("provider:open-contact-method", {
60
+ entryId: t,
61
+ contactMethod: a,
62
+ actionKey: s.actionKey
63
+ });
64
+ }
65
+ }
66
+ });
67
+ }));
68
+ Promise.all(f).then((s) => {
69
+ u(s.filter((c) => !!c));
70
+ });
71
+ });
72
+ }, [e, r, t, d]), m.length ? /* @__PURE__ */ h.createElement(
73
+ R,
74
+ {
75
+ className: "humany-bot-contact-list",
76
+ contactMethods: m,
77
+ dispatch: p,
78
+ itemRenderer: (i, f) => (d.includes(i.id) || i.expanded) && i.inline ? /* @__PURE__ */ h.createElement(
79
+ D,
80
+ {
81
+ contactMethodId: i.id,
82
+ groupId: n,
83
+ guideId: i.body.guideId
84
+ }
85
+ ) : /* @__PURE__ */ h.createElement(G, l(l({}, i), f))
86
+ }
87
+ ) : null;
88
+ }, R = y(v)`
89
+ > ul > li {
90
+ a {
91
+ display: flex;
92
+ align-items: center;
93
+ outline-offset: -2px;
94
+ }
95
+
96
+ &:not(:last-child) {
97
+ ${(e) => e.theme.border && `border-bottom: ${e.theme.border};`}
98
+ }
99
+ }
100
+ `, D = y(P)`
101
+ i {
102
+ margin: 0 ${(e) => {
103
+ var t;
104
+ return (t = e.theme.sizes) == null ? void 0 : t.medium;
105
+ }} 0 0;
106
+ display: flex;
107
+ justify-content: center;
108
+ align-items: center;
109
+ }
110
+ `, G = y(w)`
111
+ padding: ${(e) => {
112
+ var t;
113
+ return (t = e.theme.sizes) == null ? void 0 : t.medium;
114
+ }};
115
+ i {
116
+ margin: 0 ${(e) => {
117
+ var t;
118
+ return (t = e.theme.sizes) == null ? void 0 : t.medium;
119
+ }} 0 0;
120
+ display: flex;
121
+ justify-content: center;
122
+ align-items: center;
123
+ }
124
+ `;
125
+ export {
126
+ Y as default
127
+ };
128
+ //# sourceMappingURL=contact-method-list.3e8849ee.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact-method-list.3e8849ee.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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AChCA,EAAG,SAEb,gBAAAQ,EAAA;AAAA,QAACG;AAAA,QAAA;AAAA,UACG,iBAAiBX,EAAG;AAAA,UACpB,SAAAhB;AAAA,UACA,SAASgB,EAAG,KAAK;AAAA,QAAA;AAAA,MAAA,IAIrB,gBAAAQ,EAAA,cAAAI,GAAAV,IAAA,IAA+BF,IAAQU,EAAO;AAAA,IAC1D;AAAA,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;"}
@@ -0,0 +1,136 @@
1
+ var N = Object.defineProperty, T = Object.defineProperties;
2
+ var _ = Object.getOwnPropertyDescriptors;
3
+ var R = Object.getOwnPropertySymbols;
4
+ var k = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
5
+ var x = (e, t, r) => t in e ? N(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, a = (e, t) => {
6
+ for (var r in t || (t = {}))
7
+ k.call(t, r) && x(e, r, t[r]);
8
+ if (R)
9
+ for (var r of R(t))
10
+ G.call(t, r) && x(e, r, t[r]);
11
+ return e;
12
+ }, s = (e, t) => T(e, _(t));
13
+ var p = (e, t, r) => new Promise((h, o) => {
14
+ var i = (n) => {
15
+ try {
16
+ l(r.next(n));
17
+ } catch (u) {
18
+ o(u);
19
+ }
20
+ }, c = (n) => {
21
+ try {
22
+ l(r.throw(n));
23
+ } catch (u) {
24
+ o(u);
25
+ }
26
+ }, l = (n) => n.done ? h(n.value) : Promise.resolve(n.value).then(i, c);
27
+ l((r = r.apply(e, t)).next());
28
+ });
29
+ import I from "@emotion/styled";
30
+ import { DataClient as V, DataType as j } from "@telia-ace/knowledge-data-client";
31
+ import { ContactMethod as q } from "@telia-ace/knowledge-widget-adapters";
32
+ import { useContainer as H, useDispatch as J, useConversation as K } from "@telia-ace/knowledge-widget-ui";
33
+ import { FormBuilder as L } from "@telia-ace/widget-forms";
34
+ import { appendClassNames as O } from "@telia-ace/widget-utilities";
35
+ import P, { useState as Q, useRef as U, useEffect as z, useCallback as W } from "react";
36
+ import { u as A } from "./index.a97894e5.js";
37
+ import "@telia-ace/widget-conversation";
38
+ import "@telia-ace/widget-services";
39
+ const ct = ({ contactMethodId: e, guideId: t, groupId: r, className: h }) => {
40
+ var g, E, S;
41
+ const [o, i] = Q(), c = H(), l = J(), n = U(!0), u = K();
42
+ z(() => {
43
+ const { events: y } = c.get("$widget"), $ = y.subscribe("bot-provider:form-submitted", (C, d) => p(void 0, null, function* () {
44
+ var D;
45
+ if (((D = d.form.meta) == null ? void 0 : D.groupId) !== r || d.id !== o.id)
46
+ return;
47
+ u && (d.form.meta || (d.form.meta = {}), d.form.meta.conversation = u);
48
+ const v = yield c.getAsync("contactMethods"), m = s(a({}, o), {
49
+ body: s(a({}, o.body), {
50
+ form: d.form
51
+ })
52
+ }), { errors: b, valid: M, errorTypes: Y } = yield v.validate(m);
53
+ if (!M) {
54
+ const F = new L(o.body.form);
55
+ i(void 0), F.setValidationErrors(b), m.body = s(a({}, m.body), {
56
+ form: F.get()
57
+ }), i(a({}, m));
58
+ return;
59
+ }
60
+ const B = yield v.submit(m);
61
+ m.confirmation = B, i(m);
62
+ })), f = y.subscribe("bot-provider:evaluate", (C, d) => p(void 0, null, function* () {
63
+ if (d.id != e)
64
+ return;
65
+ const m = yield (yield c.getAsync("contactMethods")).evaluate(o);
66
+ let b = s(a({}, o), {
67
+ body: s(a({}, o.body), {
68
+ form: m
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
+ }), i(b);
79
+ }));
80
+ return () => {
81
+ $(), f();
82
+ };
83
+ }, [c, o, i, u]);
84
+ const w = W(
85
+ (y) => p(void 0, null, function* () {
86
+ const f = yield (yield V.getInstance(c)).fetch(
87
+ j.ContactMethod,
88
+ {
89
+ contactMethodId: y,
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
+ i(f);
101
+ }),
102
+ [n]
103
+ );
104
+ return z(() => (w(e), () => {
105
+ n.current = !1;
106
+ }), [e, w]), o ? /* @__PURE__ */ P.createElement(
107
+ X,
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: l,
121
+ className: O("humany-bot-contact-method", h)
122
+ })
123
+ ) : null;
124
+ }, X = I(q)`
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
+ ct as default
135
+ };
136
+ //# sourceMappingURL=contact-method.4c64aaa7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact-method.4c64aaa7.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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MAAM;;AAAA,UAAA7B,IAAA6B,EAAE,MAAM,UAAR,gBAAA7B,EAAe;AAAA,KAAU,CAAC6B,MAAA;;AAAM,UAAA7B,IAAA6B,EAAE,MAAM,UAAR,gBAAA7B,EAAe;AAAA;AAAA;"}
@@ -1,16 +1,17 @@
1
- import a from "@emotion/styled";
2
- import { useDispatch as n, Icon as i, List as s, list as l, Button as c, buttonCss as m, invertedHoverButton as d } from "@telia-ace/knowledge-widget-ui";
1
+ import r from "@emotion/styled";
2
+ import { useDispatch as n, Icon as s, List as i, list as l, Button as c, buttonCss as m, invertedHoverButton as d } from "@telia-ace/knowledge-widget-ui";
3
3
  import o from "react";
4
- import { m as p } from "./styles.a00306c5.js";
4
+ import { m as f } from "./styles.a00306c5.js";
5
5
  import "@emotion/react";
6
- const g = ({ actions: e }) => {
6
+ const k = ({ actions: e }) => {
7
7
  const t = n();
8
8
  return /* @__PURE__ */ o.createElement(
9
- f,
9
+ p,
10
10
  {
11
+ className: "humany-bot-feedback-list",
11
12
  items: e,
12
13
  "data-direction": "vertical",
13
- renderItem: (r) => /* @__PURE__ */ o.createElement("li", { key: r.actionKey }, /* @__PURE__ */ o.createElement(
14
+ renderItem: (a) => /* @__PURE__ */ o.createElement("li", { key: a.actionKey }, /* @__PURE__ */ o.createElement(
14
15
  u,
15
16
  {
16
17
  className: "humany-feedback-button",
@@ -18,17 +19,17 @@ const g = ({ actions: e }) => {
18
19
  "aria-pressed": !0,
19
20
  "data-selected": !0,
20
21
  onClick: () => {
21
- t("action", r.actionKey);
22
+ t("action", a.actionKey);
22
23
  }
23
24
  },
24
- /* @__PURE__ */ o.createElement(i, { faIcon: r.actionKey == "yes" ? "smile-o" : "frown-o" }),
25
- /* @__PURE__ */ o.createElement("span", null, r.label)
25
+ /* @__PURE__ */ o.createElement(s, { faIcon: a.actionKey == "yes" ? "smile-o" : "frown-o" }),
26
+ /* @__PURE__ */ o.createElement("span", null, a.label)
26
27
  ))
27
28
  }
28
29
  );
29
- }, f = a(s)`
30
+ }, p = r(i)`
30
31
  ${(e) => l(e)}
31
- ${p}
32
+ ${f}
32
33
  display: flex;
33
34
  gap: ${(e) => {
34
35
  var t;
@@ -39,7 +40,7 @@ const g = ({ actions: e }) => {
39
40
  flex: 1;
40
41
  margin: 0;
41
42
  }
42
- `, u = a(c)`
43
+ `, u = r(c)`
43
44
  ${m}
44
45
  font-size: ${(e) => {
45
46
  var t;
@@ -71,6 +72,6 @@ const g = ({ actions: e }) => {
71
72
  }
72
73
  `;
73
74
  export {
74
- g as default
75
+ k as default
75
76
  };
76
- //# sourceMappingURL=feedback-list.73d8aa69.js.map
77
+ //# sourceMappingURL=feedback-list.ff7e22da.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback-list.ff7e22da.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 className=\"humany-bot-feedback-list\"\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,WAAU;AAAA,MACV,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;"}
@@ -743,23 +743,23 @@ const ht = dt, gt = (s) => u(void 0, null, function* () {
743
743
  B(
744
744
  s,
745
745
  p.ContactList,
746
- import("./contact-method-list.e0e6b881.js")
746
+ import("./contact-method-list.3e8849ee.js")
747
747
  ), B(
748
748
  s,
749
749
  p.ContactMethod,
750
- import("./contact-method.20d7a622.js")
750
+ import("./contact-method.4c64aaa7.js")
751
751
  ), B(
752
752
  s,
753
753
  p.NotificationList,
754
- import("./notification-list.c3df3ee1.js")
754
+ import("./notification-list.7fd5ba2b.js")
755
755
  ), B(
756
756
  s,
757
757
  p.NoGoodAlternative,
758
- import("./no-good-alternative.e5e48f22.js")
758
+ import("./no-good-alternative.e9155cb9.js")
759
759
  ), B(
760
760
  s,
761
761
  p.FeedbackList,
762
- import("./feedback-list.73d8aa69.js")
762
+ import("./feedback-list.ff7e22da.js")
763
763
  ), t.registerProvider("ace-knowledge-bot", (e, i) => {
764
764
  const n = new ht(s, e, i);
765
765
  n.initialize();
@@ -791,4 +791,4 @@ export {
791
791
  yt as K,
792
792
  nt as u
793
793
  };
794
- //# sourceMappingURL=index.4cc04b4e.js.map
794
+ //# sourceMappingURL=index.a97894e5.js.map