@telia-ace/knowledge-widget-bot-provider 0.0.1-next.5 → 0.0.1-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{contact-method-list.4ee58573.js → contact-method-list.8a9dd3ec.js} +4 -4
- package/dist/contact-method-list.8a9dd3ec.js.map +1 -0
- package/dist/{contact-method.37f0020e.js → contact-method.baf5a019.js} +14 -14
- package/dist/contact-method.baf5a019.js.map +1 -0
- package/dist/feedback-list.a7f7ec9c.js +72 -0
- package/dist/feedback-list.a7f7ec9c.js.map +1 -0
- package/dist/{index.e647892d.js → index.721ac1d1.js} +122 -120
- package/dist/{index.e647892d.js.map → index.721ac1d1.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/{no-good-alternative.45aa0387.js → no-good-alternative.502e792b.js} +11 -10
- package/dist/no-good-alternative.502e792b.js.map +1 -0
- package/dist/{notification-list.cae1df51.js → notification-list.adec2988.js} +14 -13
- package/dist/notification-list.adec2988.js.map +1 -0
- package/dist/styles.a00306c5.js +12 -0
- package/dist/styles.a00306c5.js.map +1 -0
- package/dist/ui/styles.d.ts +4 -1
- package/package.json +11 -9
- package/dist/contact-method-list.4ee58573.js.map +0 -1
- package/dist/contact-method.37f0020e.js.map +0 -1
- package/dist/feedback-list.29c075b4.js +0 -70
- package/dist/feedback-list.29c075b4.js.map +0 -1
- package/dist/no-good-alternative.45aa0387.js.map +0 -1
- package/dist/notification-list.cae1df51.js.map +0 -1
- package/dist/styles.6c010dfc.js +0 -15
- package/dist/styles.6c010dfc.js.map +0 -1
|
@@ -10,14 +10,14 @@ var u = (t, e, n) => e in t ? y(t, e, { enumerable: !0, configurable: !0, writab
|
|
|
10
10
|
E.call(e, n) && u(t, n, e[n]);
|
|
11
11
|
return t;
|
|
12
12
|
}, h = (t, e) => C(t, M(e));
|
|
13
|
+
import c from "@emotion/styled";
|
|
13
14
|
import { ContactList as b, ContactMethod as S } from "@telia-ace/knowledge-widget-adapters";
|
|
14
15
|
import { useDispatch as v, useContainer as z } from "@telia-ace/knowledge-widget-ui";
|
|
15
16
|
import s, { useState as L, useMemo as j } from "react";
|
|
16
|
-
import
|
|
17
|
-
import I from "./contact-method.37f0020e.js";
|
|
17
|
+
import I from "./contact-method.baf5a019.js";
|
|
18
18
|
import "@telia-ace/knowledge-widget-types-grid";
|
|
19
19
|
import "@telia-ace/widget-forms";
|
|
20
|
-
import "./index.
|
|
20
|
+
import "./index.721ac1d1.js";
|
|
21
21
|
import "@telia-ace/widget-conversation";
|
|
22
22
|
import "@telia-ace/widget-services";
|
|
23
23
|
import "@telia-ace/widget-utilities";
|
|
@@ -85,4 +85,4 @@ const P = ({ actions: t, entryId: e, groupId: n }) => {
|
|
|
85
85
|
export {
|
|
86
86
|
P as default
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=contact-method-list.
|
|
88
|
+
//# sourceMappingURL=contact-method-list.8a9dd3ec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-method-list.8a9dd3ec.js","sources":["../src/ui/contact-method-list.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport {\n ContactList,\n ContactMethod as GenericContactMethod,\n} from '@telia-ace/knowledge-widget-adapters';\nimport { useContainer, useDispatch } from '@telia-ace/knowledge-widget-ui';\nimport React, { useMemo, 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 [expanded, setExpanded] = useState<string[]>([]);\n\n const items = useMemo<any[]>(() => {\n return actions.map((action) => {\n return {\n ...action.data,\n onClick: (_event: any, data: any) => {\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 }, [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","expanded","setExpanded","useState","items","useMemo","action","__spreadProps","__spreadValues","_event","data","events","React","StyledContactList","cm","props","StyledContactMethod","StyledGenericContactMethod","styled","ContactList","p","ContactMethod","_a","GenericContactMethod"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,IAAqC,CAAC,EAAE,SAAAC,GAAS,SAAAC,GAAS,SAAAC,QAAc;AAC1E,QAAMC,IAAWC,KACXC,IAAYC,KACZ,CAACC,GAAUC,CAAW,IAAIC,EAAmB,CAAE,CAAA,GAE/CC,IAAQC,EAAe,MAClBX,EAAQ,IAAI,CAACY,MACTC,EAAAC,EAAA,IACAF,EAAO,OADP;AAAA,IAEH,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AAA;AAAA,oBAEjB,CAACF,MAAM;;AAAA,UAAAE,IAAAF,EAAE,MAAM,UAAR,gBAAAE,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -26,18 +26,18 @@ var y = (e, t, o) => new Promise((h, r) => {
|
|
|
26
26
|
}, l = (n) => n.done ? h(n.value) : Promise.resolve(n.value).then(i, d);
|
|
27
27
|
l((o = o.apply(e, t)).next());
|
|
28
28
|
});
|
|
29
|
-
import
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import
|
|
34
|
-
import O from "
|
|
35
|
-
import { u as R } from "./index.
|
|
29
|
+
import k from "@emotion/styled";
|
|
30
|
+
import { ContactMethod as G } from "@telia-ace/knowledge-widget-adapters";
|
|
31
|
+
import { DataType as V } from "@telia-ace/knowledge-widget-types-grid";
|
|
32
|
+
import { useContainer as j, useDispatch as q, useConversation as H } from "@telia-ace/knowledge-widget-ui";
|
|
33
|
+
import { FormBuilder as J } from "@telia-ace/widget-forms";
|
|
34
|
+
import K, { useState as L, useRef as N, useEffect as F, useCallback as O } from "react";
|
|
35
|
+
import { u as R } from "./index.721ac1d1.js";
|
|
36
36
|
import "@telia-ace/widget-conversation";
|
|
37
37
|
import "@telia-ace/widget-services";
|
|
38
38
|
import "@telia-ace/widget-utilities";
|
|
39
39
|
const st = ({ contactMethodId: e, guideId: t, groupId: o, className: h }) => {
|
|
40
|
-
const [r, i] =
|
|
40
|
+
const [r, i] = L(), d = j(), l = q(), n = N(!0), u = H();
|
|
41
41
|
F(() => {
|
|
42
42
|
const { events: p } = d.get("$widget"), g = p.subscribe("bot-provider:form-submitted", (C, c) => y(void 0, null, function* () {
|
|
43
43
|
var E;
|
|
@@ -50,7 +50,7 @@ const st = ({ contactMethodId: e, guideId: t, groupId: o, className: h }) => {
|
|
|
50
50
|
})
|
|
51
51
|
}), { errors: b, valid: M, errorTypes: Q } = yield v.validate(s);
|
|
52
52
|
if (!M) {
|
|
53
|
-
const S = new
|
|
53
|
+
const S = new J(r.body.form);
|
|
54
54
|
i(void 0), S.setValidationErrors(b), s.body = m(a({}, s.body), {
|
|
55
55
|
form: S.get()
|
|
56
56
|
}), i(a({}, s));
|
|
@@ -80,9 +80,9 @@ const st = ({ contactMethodId: e, guideId: t, groupId: o, className: h }) => {
|
|
|
80
80
|
g(), f();
|
|
81
81
|
};
|
|
82
82
|
}, [d, r, i, u]);
|
|
83
|
-
const w =
|
|
83
|
+
const w = O(
|
|
84
84
|
(p) => y(void 0, null, function* () {
|
|
85
|
-
const f = yield (yield d.getAsync("dataClient")).fetch(
|
|
85
|
+
const f = yield (yield d.getAsync("dataClient")).fetch(V.ContactMethod, {
|
|
86
86
|
contactMethodId: p,
|
|
87
87
|
guideId: t
|
|
88
88
|
}), C = R(f, {
|
|
@@ -98,14 +98,14 @@ const st = ({ contactMethodId: e, guideId: t, groupId: o, className: h }) => {
|
|
|
98
98
|
);
|
|
99
99
|
return F(() => (w(e), () => {
|
|
100
100
|
n.current = !1;
|
|
101
|
-
}), [e, w]), r ? /* @__PURE__ */
|
|
101
|
+
}), [e, w]), r ? /* @__PURE__ */ K.createElement(P, m(a({}, r), {
|
|
102
102
|
body: r.body,
|
|
103
103
|
inline: !0,
|
|
104
104
|
expanded: !0,
|
|
105
105
|
dispatch: l,
|
|
106
106
|
className: h
|
|
107
107
|
})) : null;
|
|
108
|
-
}, P =
|
|
108
|
+
}, P = k(G)`
|
|
109
109
|
padding: ${(e) => {
|
|
110
110
|
var t;
|
|
111
111
|
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
@@ -117,4 +117,4 @@ const st = ({ contactMethodId: e, guideId: t, groupId: o, className: h }) => {
|
|
|
117
117
|
export {
|
|
118
118
|
st as default
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=contact-method.
|
|
120
|
+
//# sourceMappingURL=contact-method.baf5a019.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-method.baf5a019.js","sources":["../src/ui/contact-method.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport {\n ContactMethod as GenericContactMethod,\n ContactMethodPlatform,\n} from '@telia-ace/knowledge-widget-adapters';\nimport { DataType } from '@telia-ace/knowledge-widget-types-grid';\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 container.getAsync('dataClient');\n\n const cm = await dataClient.fetch(DataType.ContactMethod, {\n contactMethodId: id,\n guideId,\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={contactMethod.body}\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","DataType","body","React","StyledGenericContactMethod","styled","GenericContactMethod","p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Ae,GAC3B,MAAM;AACT,IAAAW,EAAW,UAAU;AAAA,EAAA,IAE1B,CAACX,GAAiBoC,CAAkB,CAAC,GAEnChC,IAIA,gBAAAsC,EAAA,cAAAC,GAAAnB,EAAAC,EAAA,IACOrB,IADP;AAAA,IAEG,MAAMA,EAAc;AAAA,IACpB,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,UAAAK;AAAA,IACA,WAAAN;AAAA,EAAA,EACJ,IAVO;AAYf,GAIMwC,IAA6BC,EAAOC,CAAoB;AAAA,eAC/C,CAACC,MAAM;;AAAA,UAAAzB,IAAAyB,EAAE,MAAM,UAAR,gBAAAzB,EAAe;AAAA,KAAU,CAACyB,MAAA;;AAAM,UAAAzB,IAAAyB,EAAE,MAAM,UAAR,gBAAAzB,EAAe;AAAA;AAAA;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
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";
|
|
3
|
+
import o from "react";
|
|
4
|
+
import { m as p } from "./styles.a00306c5.js";
|
|
5
|
+
import "@emotion/react";
|
|
6
|
+
const g = ({ actions: e }) => {
|
|
7
|
+
const t = n();
|
|
8
|
+
return /* @__PURE__ */ o.createElement(f, {
|
|
9
|
+
items: e,
|
|
10
|
+
"data-direction": "vertical",
|
|
11
|
+
renderItem: (r) => /* @__PURE__ */ o.createElement("li", {
|
|
12
|
+
key: r.actionKey
|
|
13
|
+
}, /* @__PURE__ */ o.createElement(u, {
|
|
14
|
+
className: "humany-feedback-button",
|
|
15
|
+
disabled: !1,
|
|
16
|
+
"aria-pressed": !0,
|
|
17
|
+
"data-selected": !0,
|
|
18
|
+
onClick: () => {
|
|
19
|
+
t("action", r.actionKey);
|
|
20
|
+
}
|
|
21
|
+
}, /* @__PURE__ */ o.createElement(i, {
|
|
22
|
+
faIcon: r.actionKey == "yes" ? "smile-o" : "frown-o"
|
|
23
|
+
}), /* @__PURE__ */ o.createElement("span", null, r.label)))
|
|
24
|
+
});
|
|
25
|
+
}, f = a(s)`
|
|
26
|
+
${(e) => l(e)}
|
|
27
|
+
${p}
|
|
28
|
+
display: flex;
|
|
29
|
+
gap: ${(e) => {
|
|
30
|
+
var t;
|
|
31
|
+
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
32
|
+
}};
|
|
33
|
+
flex-direction: ${(e) => e["data-direction"] === "horizontal" ? "row" : "column"};
|
|
34
|
+
> li {
|
|
35
|
+
flex: 1;
|
|
36
|
+
margin: 0;
|
|
37
|
+
}
|
|
38
|
+
`, u = a(c)`
|
|
39
|
+
${m}
|
|
40
|
+
font-size: ${(e) => {
|
|
41
|
+
var t;
|
|
42
|
+
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
43
|
+
}};
|
|
44
|
+
border-color: ${(e) => {
|
|
45
|
+
var t;
|
|
46
|
+
return (t = e.theme.colors) == null ? void 0 : t.primary;
|
|
47
|
+
}};
|
|
48
|
+
font-weight: 300;
|
|
49
|
+
display: block;
|
|
50
|
+
width: 100%;
|
|
51
|
+
|
|
52
|
+
${(e) => {
|
|
53
|
+
var t;
|
|
54
|
+
return d({
|
|
55
|
+
primaryColor: `${(t = e.theme.colors) == null ? void 0 : t.primary}`,
|
|
56
|
+
secondaryColor: "#FFFFFF",
|
|
57
|
+
theme: e.theme
|
|
58
|
+
});
|
|
59
|
+
}}
|
|
60
|
+
i {
|
|
61
|
+
margin: 0 ${(e) => {
|
|
62
|
+
var t;
|
|
63
|
+
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
64
|
+
}} 0 0;
|
|
65
|
+
}
|
|
66
|
+
span {
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
export {
|
|
70
|
+
g as default
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=feedback-list.a7f7ec9c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback-list.a7f7ec9c.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,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