@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.53 → 0.0.1-alpha.56
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.fa7c8f40.js +88 -0
- package/dist/contact-method-list.fa7c8f40.js.map +1 -0
- package/dist/contact-method.23cd338c.js +116 -0
- package/dist/contact-method.23cd338c.js.map +1 -0
- package/dist/feedback-list.911dcc3c.js +70 -0
- package/dist/feedback-list.911dcc3c.js.map +1 -0
- package/dist/index.1161f855.js +664 -0
- package/dist/index.1161f855.js.map +1 -0
- package/dist/index.js +4 -1
- package/dist/no-good-alternative.ae1f1e39.js +46 -0
- package/dist/no-good-alternative.ae1f1e39.js.map +1 -0
- package/dist/notification-list.976cfcb5.js +62 -0
- package/dist/notification-list.976cfcb5.js.map +1 -0
- package/dist/styles.4d9197a0.js +15 -0
- package/dist/styles.4d9197a0.js.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils.d.ts +1 -1
- package/package.json +13 -9
- package/dist/contact-method-list.js +0 -111
- package/dist/contact-method-list.js.map +0 -1
- package/dist/contact-method.js +0 -154
- package/dist/contact-method.js.map +0 -1
- package/dist/feedback-list.js +0 -72
- package/dist/feedback-list.js.map +0 -1
- package/dist/index2.js +0 -914
- package/dist/index2.js.map +0 -1
- package/dist/no-good-alternative.js +0 -46
- package/dist/no-good-alternative.js.map +0 -1
- package/dist/notification-list.js +0 -74
- package/dist/notification-list.js.map +0 -1
- package/dist/styles.js +0 -13
- package/dist/styles.js.map +0 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var y = Object.defineProperty, C = Object.defineProperties;
|
|
2
|
+
var M = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var p = Object.getOwnPropertySymbols;
|
|
4
|
+
var $ = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var u = (t, e, n) => e in t ? y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, d = (t, e) => {
|
|
6
|
+
for (var n in e || (e = {}))
|
|
7
|
+
$.call(e, n) && u(t, n, e[n]);
|
|
8
|
+
if (p)
|
|
9
|
+
for (var n of p(e))
|
|
10
|
+
E.call(e, n) && u(t, n, e[n]);
|
|
11
|
+
return t;
|
|
12
|
+
}, h = (t, e) => C(t, M(e));
|
|
13
|
+
import { ContactList as b, ContactMethod as S } from "@telia-ace/knowledge-widget-adapters";
|
|
14
|
+
import { useDispatch as v, useContainer as z } from "@telia-ace/knowledge-widget-ui";
|
|
15
|
+
import s, { useState as L, useMemo as j } from "react";
|
|
16
|
+
import c from "styled-components";
|
|
17
|
+
import I from "./contact-method.23cd338c.js";
|
|
18
|
+
import "@telia-ace/knowledge-widget-types-grid";
|
|
19
|
+
import "@telia-ace/widget-forms";
|
|
20
|
+
import "./index.1161f855.js";
|
|
21
|
+
import "@telia-ace/widget-conversation";
|
|
22
|
+
import "@telia-ace/widget-services";
|
|
23
|
+
import "@telia-ace/widget-utilities";
|
|
24
|
+
const P = ({ actions: t, entryId: e, groupId: n }) => {
|
|
25
|
+
const f = v(), a = z(), [r, g] = L([]), m = j(() => t.map((o) => h(d({}, o.data), {
|
|
26
|
+
onClick: (l, i) => {
|
|
27
|
+
if (i.inline && !i.expanded)
|
|
28
|
+
g([...r, i.id]);
|
|
29
|
+
else {
|
|
30
|
+
const { events: x } = a.get("$widget");
|
|
31
|
+
x.dispatch("provider:open-contact-method", {
|
|
32
|
+
entryId: e,
|
|
33
|
+
contactMethod: i,
|
|
34
|
+
actionKey: o.actionKey
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
})), [t, a, e, r]);
|
|
39
|
+
return m.length ? /* @__PURE__ */ s.createElement(K, {
|
|
40
|
+
contactMethods: m,
|
|
41
|
+
dispatch: f,
|
|
42
|
+
itemRenderer: (o, l) => (r.includes(o.id) || o.expanded) && o.inline ? /* @__PURE__ */ s.createElement(R, {
|
|
43
|
+
contactMethodId: o.id,
|
|
44
|
+
groupId: n,
|
|
45
|
+
guideId: o.body.guideId
|
|
46
|
+
}) : /* @__PURE__ */ s.createElement(k, d(d({}, o), l))
|
|
47
|
+
}) : null;
|
|
48
|
+
}, K = c(b)`
|
|
49
|
+
> ul > li {
|
|
50
|
+
a {
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
outline-offset: -2px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:not(:last-child) {
|
|
57
|
+
${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`, R = c(I)`
|
|
61
|
+
i {
|
|
62
|
+
margin: 0 ${(t) => {
|
|
63
|
+
var e;
|
|
64
|
+
return (e = t.theme.sizes) == null ? void 0 : e.medium;
|
|
65
|
+
}} 0 0;
|
|
66
|
+
display: flex;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
}
|
|
70
|
+
`, k = c(S)`
|
|
71
|
+
padding: ${(t) => {
|
|
72
|
+
var e;
|
|
73
|
+
return (e = t.theme.sizes) == null ? void 0 : e.medium;
|
|
74
|
+
}};
|
|
75
|
+
i {
|
|
76
|
+
margin: 0 ${(t) => {
|
|
77
|
+
var e;
|
|
78
|
+
return (e = t.theme.sizes) == null ? void 0 : e.medium;
|
|
79
|
+
}} 0 0;
|
|
80
|
+
display: flex;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
align-items: center;
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
export {
|
|
86
|
+
P as default
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=contact-method-list.fa7c8f40.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-method-list.fa7c8f40.js","sources":["../src/ui/contact-method-list.tsx"],"sourcesContent":["import {\r\n ContactList,\r\n ContactMethod as GenericContactMethod,\r\n} from '@telia-ace/knowledge-widget-adapters';\r\nimport { useContainer, useDispatch } from '@telia-ace/knowledge-widget-ui';\r\nimport React, { useMemo, useState } from 'react';\r\nimport styled from 'styled-components';\r\nimport { ActionItem } from '../types';\r\nimport ContactMethod from './contact-method';\r\n\r\ntype Props = {\r\n actions: ActionItem[];\r\n contactMethodIds?: string[];\r\n entryId: string;\r\n groupId: string;\r\n};\r\nconst ContactMethodList: React.FC<Props> = ({ actions, entryId, groupId }) => {\r\n const dispatch = useDispatch();\r\n const container = useContainer();\r\n const [expanded, setExpanded] = useState<string[]>([]);\r\n\r\n const items = useMemo<any[]>(() => {\r\n return actions.map((action) => {\r\n return {\r\n ...action.data,\r\n onClick: (_event: any, data: any) => {\r\n if (data.inline && !data.expanded) {\r\n setExpanded([...expanded, data.id]);\r\n } else {\r\n const { events } = container.get('$widget');\r\n events.dispatch('provider:open-contact-method', {\r\n entryId,\r\n contactMethod: data,\r\n actionKey: action.actionKey,\r\n });\r\n }\r\n },\r\n };\r\n });\r\n }, [actions, container, entryId, expanded]);\r\n\r\n if (!items.length) {\r\n return null;\r\n }\r\n\r\n return (\r\n <StyledContactList\r\n contactMethods={items}\r\n dispatch={dispatch}\r\n itemRenderer={(cm: any, props: any) => {\r\n const isExpanded = expanded.includes(cm.id) || cm.expanded;\r\n if (isExpanded && cm.inline) {\r\n return (\r\n <StyledContactMethod\r\n contactMethodId={cm.id}\r\n groupId={groupId}\r\n guideId={cm.body.guideId}\r\n />\r\n );\r\n }\r\n return <StyledGenericContactMethod {...cm} {...props} />;\r\n }}\r\n />\r\n );\r\n};\r\n\r\nexport default ContactMethodList;\r\n\r\nconst StyledContactList = styled(ContactList)`\r\n > ul > li {\r\n a {\r\n display: flex;\r\n align-items: center;\r\n outline-offset: -2px;\r\n }\r\n\r\n &:not(:last-child) {\r\n ${(p) => p.theme.border && `border-bottom: ${p.theme.border};`}\r\n }\r\n }\r\n`;\r\n\r\nconst StyledContactMethod = styled(ContactMethod)`\r\n i {\r\n margin: 0 ${(p) => p.theme.sizes?.medium} 0 0;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n`;\r\nconst StyledGenericContactMethod = styled(GenericContactMethod)`\r\n padding: ${(p) => p.theme.sizes?.medium};\r\n i {\r\n margin: 0 ${(p) => p.theme.sizes?.medium} 0 0;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n`;\r\n"],"names":["GenericContactMethod"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,IAAqC,CAAC,EAAE,YAAS,YAAS,iBAAc;AAC1E,QAAM,IAAW,KACX,IAAY,KACZ,CAAC,GAAU,KAAe,EAAmB,CAAE,CAAA,GAE/C,IAAQ,EAAe,MAClB,EAAQ,IAAI,CAAC,MACT,QACA,EAAO,OADP;AAAA,IAEH,SAAS,CAAC,GAAa,MAAc;AACjC,UAAI,EAAK,UAAU,CAAC,EAAK;AACrB,UAAY,CAAC,GAAG,GAAU,EAAK,EAAE,CAAC;AAAA,WAC/B;AACH,cAAM,EAAE,cAAW,EAAU,IAAI,SAAS;AAC1C,UAAO,SAAS,gCAAgC;AAAA,UAC5C;AAAA,UACA,eAAe;AAAA,UACf,WAAW,EAAO;AAAA,QAAA,CACrB;AAAA,MACL;AAAA,IACJ;AAAA,EAAA,EAEP,GACF,CAAC,GAAS,GAAW,GAAS,CAAQ,CAAC;AAEtC,SAAC,EAAM,SAKN,kBAAA,cAAA,GAAA;AAAA,IACG,gBAAgB;AAAA,IAChB;AAAA,IACA,cAAc,CAAC,GAAS,MAEhB,AADe,GAAS,SAAS,EAAG,EAAE,KAAK,EAAG,aAChC,EAAG,SAEZ,kBAAA,cAAA,GAAA;AAAA,MACG,iBAAiB,EAAG;AAAA,MACpB;AAAA,MACA,SAAS,EAAG,KAAK;AAAA,IAAA,CACrB,IAGA,kBAAA,cAAA,GAAA,QAA+B,IAAQ,EAAO;AAAA,EAC1D,CACJ,IApBO;AAsBf,GAIM,IAAoB,EAAO,CAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAS9B,CAAC,MAAM,EAAE,MAAM,UAAU,kBAAkB,EAAE,MAAM;AAAA;AAAA;AAAA,GAK3D,IAAsB,EAAO,CAAa;AAAA;AAAA,oBAE5B,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAMpC,IAA6B,EAAOA,CAAoB;AAAA,eAC/C,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA,oBAEjB,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var x = Object.defineProperty, z = Object.defineProperties;
|
|
2
|
+
var B = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var S = Object.getOwnPropertySymbols;
|
|
4
|
+
var D = Object.prototype.hasOwnProperty, T = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var $ = (e, t, o) => t in e ? x(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, s = (e, t) => {
|
|
6
|
+
for (var o in t || (t = {}))
|
|
7
|
+
D.call(t, o) && $(e, o, t[o]);
|
|
8
|
+
if (S)
|
|
9
|
+
for (var o of S(t))
|
|
10
|
+
T.call(t, o) && $(e, o, t[o]);
|
|
11
|
+
return e;
|
|
12
|
+
}, c = (e, t) => z(e, B(t));
|
|
13
|
+
var y = (e, t, o) => new Promise((h, r) => {
|
|
14
|
+
var i = (a) => {
|
|
15
|
+
try {
|
|
16
|
+
f(o.next(a));
|
|
17
|
+
} catch (m) {
|
|
18
|
+
r(m);
|
|
19
|
+
}
|
|
20
|
+
}, d = (a) => {
|
|
21
|
+
try {
|
|
22
|
+
f(o.throw(a));
|
|
23
|
+
} catch (m) {
|
|
24
|
+
r(m);
|
|
25
|
+
}
|
|
26
|
+
}, f = (a) => a.done ? h(a.value) : Promise.resolve(a.value).then(i, d);
|
|
27
|
+
f((o = o.apply(e, t)).next());
|
|
28
|
+
});
|
|
29
|
+
import { ContactMethod as _ } from "@telia-ace/knowledge-widget-adapters";
|
|
30
|
+
import { DataType as k } from "@telia-ace/knowledge-widget-types-grid";
|
|
31
|
+
import { useContainer as G, useDispatch as V } from "@telia-ace/knowledge-widget-ui";
|
|
32
|
+
import { FormBuilder as j } from "@telia-ace/widget-forms";
|
|
33
|
+
import q, { useState as H, useRef as J, useEffect as A, useCallback as K } from "react";
|
|
34
|
+
import L from "styled-components";
|
|
35
|
+
import { u as F } from "./index.1161f855.js";
|
|
36
|
+
import "@telia-ace/widget-conversation";
|
|
37
|
+
import "@telia-ace/widget-services";
|
|
38
|
+
import "@telia-ace/widget-utilities";
|
|
39
|
+
const rt = ({ contactMethodId: e, guideId: t, groupId: o, className: h }) => {
|
|
40
|
+
const [r, i] = H(), d = G(), f = V(), a = J(!0);
|
|
41
|
+
A(() => {
|
|
42
|
+
const { events: p } = d.get("$widget"), w = p.subscribe("bot-provider:form-submitted", (C, l) => y(void 0, null, function* () {
|
|
43
|
+
var g;
|
|
44
|
+
if (((g = l.form.meta) == null ? void 0 : g.groupId) !== o || l.id !== r.id)
|
|
45
|
+
return;
|
|
46
|
+
const M = yield d.getAsync("contactMethods"), n = c(s({}, r), {
|
|
47
|
+
body: c(s({}, r.body), {
|
|
48
|
+
form: l.form
|
|
49
|
+
})
|
|
50
|
+
}), { errors: b, valid: v, errorTypes: O } = yield M.validate(n);
|
|
51
|
+
if (!v) {
|
|
52
|
+
const E = new j(r.body.form);
|
|
53
|
+
i(void 0), E.setValidationErrors(b), n.body = c(s({}, n.body), {
|
|
54
|
+
form: E.get()
|
|
55
|
+
}), i(s({}, n));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const R = yield M.submit(n);
|
|
59
|
+
n.confirmation = R, i(n);
|
|
60
|
+
})), u = p.subscribe("bot-provider:evaluate", (C, l) => y(void 0, null, function* () {
|
|
61
|
+
if (l.id != e)
|
|
62
|
+
return;
|
|
63
|
+
const n = yield (yield d.getAsync("contactMethods")).evaluate(r);
|
|
64
|
+
let b = c(s({}, r), {
|
|
65
|
+
body: c(s({}, r.body), {
|
|
66
|
+
form: n
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
const v = F(b, {
|
|
70
|
+
submit: "Submit",
|
|
71
|
+
errors: {},
|
|
72
|
+
meta: { groupId: o }
|
|
73
|
+
});
|
|
74
|
+
b = c(s({}, b), {
|
|
75
|
+
body: v
|
|
76
|
+
}), i(b);
|
|
77
|
+
}));
|
|
78
|
+
return () => {
|
|
79
|
+
w(), u();
|
|
80
|
+
};
|
|
81
|
+
}, [d, r, i]);
|
|
82
|
+
const m = K((p) => y(void 0, null, function* () {
|
|
83
|
+
const u = yield (yield d.getAsync("dataClient")).fetch(k.ContactMethod, {
|
|
84
|
+
contactMethodId: p,
|
|
85
|
+
guideId: t
|
|
86
|
+
}), C = F(u, {
|
|
87
|
+
submit: "Submit",
|
|
88
|
+
errors: {},
|
|
89
|
+
meta: { groupId: o }
|
|
90
|
+
});
|
|
91
|
+
if (u.body = C, u.body.guideId = t, !a.current)
|
|
92
|
+
return null;
|
|
93
|
+
i(u);
|
|
94
|
+
}), [a]);
|
|
95
|
+
return A(() => (m(e), () => {
|
|
96
|
+
a.current = !1;
|
|
97
|
+
}), [e, m]), r ? /* @__PURE__ */ q.createElement(N, c(s({}, r), {
|
|
98
|
+
body: r.body,
|
|
99
|
+
inline: !0,
|
|
100
|
+
expanded: !0,
|
|
101
|
+
dispatch: f,
|
|
102
|
+
className: h
|
|
103
|
+
})) : null;
|
|
104
|
+
}, N = L(_)`
|
|
105
|
+
padding: ${(e) => {
|
|
106
|
+
var t;
|
|
107
|
+
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
108
|
+
}} ${(e) => {
|
|
109
|
+
var t;
|
|
110
|
+
return (t = e.theme.sizes) == null ? void 0 : t.medium;
|
|
111
|
+
}};
|
|
112
|
+
`;
|
|
113
|
+
export {
|
|
114
|
+
rt as default
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=contact-method.23cd338c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-method.23cd338c.js","sources":["../src/ui/contact-method.tsx"],"sourcesContent":["import {\r\n ContactMethod as GenericContactMethod,\r\n ContactMethodPlatform,\r\n} from '@telia-ace/knowledge-widget-adapters';\r\nimport { DataType } from '@telia-ace/knowledge-widget-types-grid';\r\nimport { useContainer, useDispatch } from '@telia-ace/knowledge-widget-ui';\r\nimport { FormBuilder } from '@telia-ace/widget-forms';\r\nimport { Widget } from '@webprovisions/platform';\r\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\r\nimport styled from 'styled-components';\r\nimport { updateForm } from '../utils';\r\n\r\ntype Props = {\r\n contactMethodId: string;\r\n groupId: string;\r\n guideId?: string;\r\n className?: string;\r\n};\r\nconst ContactMethod: React.FC<Props> = ({ contactMethodId, guideId, groupId, className }) => {\r\n const [contactMethod, setContactMethod] = useState<any>();\r\n const container = useContainer();\r\n const dispatch = useDispatch();\r\n const mountedRef = useRef<boolean>(true);\r\n\r\n useEffect(() => {\r\n const { events } = container.get('$widget') as Widget;\r\n\r\n const unsubscribe = events.subscribe('bot-provider:form-submitted', async (_, data) => {\r\n // making sure that this is the form that is submitted\r\n if (data.form.meta?.groupId !== groupId || data.id !== contactMethod.id) {\r\n return;\r\n }\r\n\r\n const platform = (await container.getAsync('contactMethods')) as ContactMethodPlatform;\r\n\r\n const updatedMethod = {\r\n ...contactMethod,\r\n body: {\r\n ...contactMethod.body,\r\n form: data.form,\r\n },\r\n };\r\n\r\n const { errors, valid, errorTypes } = await platform.validate(updatedMethod);\r\n\r\n if (!valid) {\r\n const builder = new FormBuilder(contactMethod.body.form);\r\n setContactMethod(undefined);\r\n\r\n builder.setValidationErrors(errors);\r\n\r\n updatedMethod.body = {\r\n ...updatedMethod.body,\r\n form: builder.get(),\r\n };\r\n\r\n setContactMethod({ ...updatedMethod });\r\n return;\r\n }\r\n\r\n const result = await platform.submit(updatedMethod);\r\n\r\n updatedMethod.confirmation = result;\r\n setContactMethod(updatedMethod);\r\n });\r\n\r\n const unsubscribeEvaluate = events.subscribe('bot-provider:evaluate', async (_, data) => {\r\n if (data.id != contactMethodId) {\r\n return;\r\n }\r\n\r\n const platform = (await container.getAsync('contactMethods')) as ContactMethodPlatform;\r\n\r\n const updatedForm = await platform.evaluate(contactMethod);\r\n\r\n let updatedMethod = {\r\n ...contactMethod,\r\n body: {\r\n ...contactMethod.body,\r\n form: updatedForm,\r\n },\r\n };\r\n\r\n const updatedBody = updateForm(updatedMethod, {\r\n submit: 'Submit',\r\n errors: {},\r\n meta: { groupId },\r\n });\r\n\r\n updatedMethod = {\r\n ...updatedMethod,\r\n body: updatedBody,\r\n };\r\n\r\n setContactMethod(updatedMethod);\r\n });\r\n\r\n return () => {\r\n unsubscribe();\r\n unsubscribeEvaluate();\r\n };\r\n }, [container, contactMethod, setContactMethod]);\r\n\r\n const fetchContactMethod = useCallback(\r\n async (id: string) => {\r\n const dataClient = await container.getAsync('dataClient');\r\n\r\n const cm = await dataClient.fetch(DataType.ContactMethod, {\r\n contactMethodId: id,\r\n guideId,\r\n });\r\n\r\n const body = updateForm(cm, {\r\n submit: 'Submit',\r\n errors: {},\r\n meta: { groupId },\r\n });\r\n cm.body = body;\r\n cm.body.guideId = guideId;\r\n\r\n if (!mountedRef.current) {\r\n return null;\r\n }\r\n setContactMethod(cm);\r\n },\r\n [mountedRef]\r\n );\r\n\r\n useEffect(() => {\r\n fetchContactMethod(contactMethodId);\r\n return () => {\r\n mountedRef.current = false; // clean up\r\n };\r\n }, [contactMethodId, fetchContactMethod]);\r\n\r\n if (!contactMethod) {\r\n return null;\r\n }\r\n return (\r\n <StyledGenericContactMethod\r\n {...contactMethod}\r\n body={contactMethod.body}\r\n inline={true}\r\n expanded={true}\r\n dispatch={dispatch}\r\n className={className}\r\n />\r\n );\r\n};\r\n\r\nexport default ContactMethod;\r\n\r\nconst StyledGenericContactMethod = styled(GenericContactMethod)`\r\n padding: ${(p) => p.theme.sizes?.normal} ${(p) => p.theme.sizes?.medium};\r\n`;\r\n"],"names":["GenericContactMethod"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,KAAiC,CAAC,EAAE,oBAAiB,YAAS,YAAS,mBAAgB;AACnF,QAAA,CAAC,GAAe,KAAoB,EAAc,GAClD,IAAY,KACZ,IAAW,KACX,IAAa,EAAgB,EAAI;AAEvC,IAAU,MAAM;AACZ,UAAM,EAAE,cAAW,EAAU,IAAI,SAAS,GAEpC,IAAc,EAAO,UAAU,+BAA+B,CAAO,GAAG,MAAS;;AAE/E,UAAA,QAAK,KAAK,SAAV,kBAAgB,aAAY,KAAW,EAAK,OAAO,EAAc;AACjE;AAGJ,YAAM,IAAY,MAAM,EAAU,SAAS,gBAAgB,GAErD,IAAgB,QACf,IADe;AAAA,QAElB,MAAM,QACC,EAAc,OADf;AAAA,UAEF,MAAM,EAAK;AAAA,QACf;AAAA,MAAA,IAGE,EAAE,WAAQ,UAAO,kBAAe,MAAM,EAAS,SAAS,CAAa;AAE3E,UAAI,CAAC,GAAO;AACR,cAAM,IAAU,IAAI,EAAY,EAAc,KAAK,IAAI;AACvD,UAAiB,MAAS,GAE1B,EAAQ,oBAAoB,CAAM,GAElC,EAAc,OAAO,QACd,EAAc,OADA;AAAA,UAEjB,MAAM,EAAQ,IAAI;AAAA,QAAA,IAGL,EAAA,MAAK,EAAe;AACrC;AAAA,MACJ;AAEA,YAAM,IAAS,MAAM,EAAS,OAAO,CAAa;AAElD,QAAc,eAAe,GAC7B,EAAiB,CAAa;AAAA,IAAA,EACjC,GAEK,IAAsB,EAAO,UAAU,yBAAyB,CAAO,GAAG,MAAS;AACjF,UAAA,EAAK,MAAM;AACX;AAKJ,YAAM,IAAc,MAAM,AAFR,OAAM,EAAU,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;;AAAM,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
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";
|
|
2
|
+
import o from "react";
|
|
3
|
+
import r from "styled-components";
|
|
4
|
+
import { m as p } from "./styles.4d9197a0.js";
|
|
5
|
+
const F = ({ actions: t }) => {
|
|
6
|
+
const e = n();
|
|
7
|
+
return /* @__PURE__ */ o.createElement(f, {
|
|
8
|
+
items: t,
|
|
9
|
+
"data-direction": "vertical",
|
|
10
|
+
renderItem: (a) => /* @__PURE__ */ o.createElement("li", {
|
|
11
|
+
key: a.actionKey
|
|
12
|
+
}, /* @__PURE__ */ o.createElement(u, {
|
|
13
|
+
className: "humany-feedback-button",
|
|
14
|
+
disabled: !1,
|
|
15
|
+
"aria-pressed": !0,
|
|
16
|
+
"data-selected": !0,
|
|
17
|
+
onClick: () => {
|
|
18
|
+
e("action", a.actionKey);
|
|
19
|
+
}
|
|
20
|
+
}, /* @__PURE__ */ o.createElement(s, {
|
|
21
|
+
faIcon: a.actionKey == "yes" ? "smile-o" : "frown-o"
|
|
22
|
+
}), /* @__PURE__ */ o.createElement("span", null, a.label)))
|
|
23
|
+
});
|
|
24
|
+
}, f = r(i)`
|
|
25
|
+
${l}
|
|
26
|
+
${p}
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: ${(t) => {
|
|
29
|
+
var e;
|
|
30
|
+
return (e = t.theme.sizes) == null ? void 0 : e.normal;
|
|
31
|
+
}};
|
|
32
|
+
flex-direction: ${(t) => t["data-direction"] === "horizontal" ? "row" : "column"};
|
|
33
|
+
> li {
|
|
34
|
+
flex: 1;
|
|
35
|
+
margin: 0;
|
|
36
|
+
}
|
|
37
|
+
`, u = r(c)`
|
|
38
|
+
${m}
|
|
39
|
+
font-size: ${(t) => {
|
|
40
|
+
var e;
|
|
41
|
+
return (e = t.theme.fonts) == null ? void 0 : e.normal;
|
|
42
|
+
}};
|
|
43
|
+
border-color: ${(t) => {
|
|
44
|
+
var e;
|
|
45
|
+
return (e = t.theme.colors) == null ? void 0 : e.primary;
|
|
46
|
+
}};
|
|
47
|
+
font-weight: 300;
|
|
48
|
+
display: block;
|
|
49
|
+
width: 100%;
|
|
50
|
+
|
|
51
|
+
${(t) => {
|
|
52
|
+
var e;
|
|
53
|
+
return d({
|
|
54
|
+
primaryColor: `${(e = t.theme.colors) == null ? void 0 : e.primary}`,
|
|
55
|
+
secondaryColor: "#FFFFFF"
|
|
56
|
+
});
|
|
57
|
+
}}
|
|
58
|
+
i {
|
|
59
|
+
margin: 0 ${(t) => {
|
|
60
|
+
var e;
|
|
61
|
+
return (e = t.theme.sizes) == null ? void 0 : e.small;
|
|
62
|
+
}} 0 0;
|
|
63
|
+
}
|
|
64
|
+
span {
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
export {
|
|
68
|
+
F as default
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=feedback-list.911dcc3c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback-list.911dcc3c.js","sources":["../src/ui/feedback-list.tsx"],"sourcesContent":["import {\r\n Button,\r\n buttonCss,\r\n Icon,\r\n invertedHoverButton,\r\n list,\r\n List,\r\n useDispatch,\r\n} from '@telia-ace/knowledge-widget-ui';\r\nimport React from 'react';\r\nimport styled from 'styled-components';\r\nimport { messageContentPadding } from './styles';\r\n\r\ntype Props = {\r\n actions: { [key: string]: string }[];\r\n};\r\nconst FeedbackList: React.FC<Props> = ({ actions }) => {\r\n const dispatch = useDispatch();\r\n return (\r\n <StyledButtonList\r\n items={actions}\r\n data-direction={'vertical'}\r\n renderItem={(item: any) => {\r\n return (\r\n <li key={item.actionKey}>\r\n <FeedbackButton\r\n className=\"humany-feedback-button\"\r\n disabled={false}\r\n aria-pressed={true}\r\n data-selected={true}\r\n onClick={() => {\r\n dispatch('action', item.actionKey);\r\n }}\r\n >\r\n <Icon faIcon={item.actionKey == 'yes' ? 'smile-o' : 'frown-o'} />\r\n <span>{item.label}</span>\r\n </FeedbackButton>\r\n </li>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\n\r\nexport default FeedbackList;\r\n\r\nconst StyledButtonList = styled(List)<{ 'data-direction': 'horizontal' | 'vertical' } & any>`\r\n ${list}\r\n ${messageContentPadding}\r\n display: flex;\r\n gap: ${(p) => p.theme.sizes?.normal};\r\n flex-direction: ${(p) => (p['data-direction'] === 'horizontal' ? 'row' : 'column')};\r\n > li {\r\n flex: 1;\r\n margin: 0;\r\n }\r\n`;\r\n\r\nconst FeedbackButton = styled(Button)<{\r\n 'data-selected': boolean;\r\n}>`\r\n ${buttonCss}\r\n font-size: ${(p) => p.theme.fonts?.normal};\r\n border-color: ${(p) => p.theme.colors?.primary};\r\n font-weight: 300;\r\n display: block;\r\n width: 100%;\r\n\r\n ${(p) =>\r\n invertedHoverButton({\r\n primaryColor: `${p.theme.colors?.primary}`,\r\n secondaryColor: '#FFFFFF',\r\n })}\r\n i {\r\n margin: 0 ${(p) => p.theme.sizes?.small} 0 0;\r\n }\r\n span {\r\n }\r\n`;\r\n"],"names":[],"mappings":";;;;AAgBM,MAAA,IAAgC,CAAC,EAAE,iBAAc;AACnD,QAAM,IAAW;AACjB,SACK,kBAAA,cAAA,GAAA;AAAA,IACG,OAAO;AAAA,IACP,kBAAgB;AAAA,IAChB,YAAY,CAAC,MAEJ,kBAAA,cAAA,MAAA;AAAA,MAAG,KAAK,EAAK;AAAA,IAAA,GACT,kBAAA,cAAA,GAAA;AAAA,MACG,WAAU;AAAA,MACV,UAAU;AAAA,MACV,gBAAc;AAAA,MACd,iBAAe;AAAA,MACf,SAAS,MAAM;AACF,UAAA,UAAU,EAAK,SAAS;AAAA,MACrC;AAAA,IAAA,GAEC,kBAAA,cAAA,GAAA;AAAA,MAAK,QAAQ,EAAK,aAAa,QAAQ,YAAY;AAAA,IAAA,CAAW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