@telia-ace/widget-conversation 1.3.0-rc.8 → 1.3.0
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.
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
1
|
+
import { jsx as n, jsxs as h, Fragment as N } from "react/jsx-runtime";
|
|
2
2
|
import i from "@emotion/styled";
|
|
3
|
-
import { Input as se, borderTabStyle as
|
|
4
|
-
import { appendClassNames as
|
|
5
|
-
import { css as
|
|
6
|
-
import
|
|
3
|
+
import { Input as se, borderTabStyle as b, Button as A, SymbolBadge as k, useIsTabbing as ae, useDispatch as G, useProperties as S, useScroll as ie, useContainer as I, Typography as J, invertedHoverButton as xe, Html as Q, List as le, buttonCss as B, ItemList as K, itemList as D, Link as ke, useComponent as we, genericHtml as Se, headingElement as Z, usePrevious as Ce, list as Le, WidgetOverlayOutlet as ce, ConversationContext as ze } from "@telia-ace/widget-ui";
|
|
4
|
+
import { appendClassNames as H, htmlParentContains as Ne } from "@telia-ace/widget-utilities";
|
|
5
|
+
import { css as x, keyframes as Me } from "@emotion/react";
|
|
6
|
+
import de, { useState as q, useEffect as j, forwardRef as ee, useContext as Ae, Suspense as Ie, useRef as me, useMemo as He, useCallback as ue } from "react";
|
|
7
7
|
import { FormComponent as Te } from "@telia-ace/widget-forms";
|
|
8
|
-
import { ConversationMessageListItemType as w, ConversationMessageType as
|
|
8
|
+
import { ConversationMessageListItemType as w, ConversationMessageType as U } from "./index.mjs";
|
|
9
9
|
import "@telia-ace/widget-core";
|
|
10
10
|
import "@telia-ace/widget-services";
|
|
11
11
|
import "@telia-ace/widget-plugins";
|
|
12
12
|
const Oe = ({ className: t }) => {
|
|
13
|
-
const [e, o] =
|
|
14
|
-
inputPlaceholder:
|
|
15
|
-
inputHidden:
|
|
16
|
-
inputDisabled:
|
|
17
|
-
sendButtonLabel:
|
|
18
|
-
inputMultiline:
|
|
13
|
+
const [e, o] = q(""), [s, a] = q(0), [r, d] = q(0), u = ae(), l = G(), {
|
|
14
|
+
inputPlaceholder: m = "Type your message",
|
|
15
|
+
inputHidden: y = !1,
|
|
16
|
+
inputDisabled: c = !1,
|
|
17
|
+
sendButtonLabel: g = "Send message",
|
|
18
|
+
inputMultiline: p = !0,
|
|
19
19
|
secondaryAction: $
|
|
20
|
-
} = S(), [
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
const { lineHeight:
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
26
|
-
a(
|
|
27
|
-
const
|
|
28
|
-
|
|
20
|
+
} = S(), [L, v] = ie(!0), O = I();
|
|
21
|
+
j(() => {
|
|
22
|
+
if (v.current) {
|
|
23
|
+
const { lineHeight: f, maxHeight: z } = getComputedStyle(v.current);
|
|
24
|
+
if (f && f.indexOf("px") > -1) {
|
|
25
|
+
const T = f.split("px"), $e = parseInt(T[0], 10);
|
|
26
|
+
a($e);
|
|
27
|
+
const ve = z.split("px");
|
|
28
|
+
d(parseInt(ve[0], 10));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
}, [
|
|
32
|
-
const
|
|
33
|
-
!
|
|
34
|
-
},
|
|
31
|
+
}, [v.current]);
|
|
32
|
+
const P = (f) => {
|
|
33
|
+
!f.shiftKey || !p ? (f.preventDefault(), e && e.length > 0 && (l("user-submit", { text: e }), o(""), W(""))) : e.length < 1 && f.preventDefault();
|
|
34
|
+
}, pe = (f) => {
|
|
35
35
|
if (!$)
|
|
36
36
|
return;
|
|
37
|
-
|
|
37
|
+
f.preventDefault(), l("action", {
|
|
38
38
|
actionKey: $.action,
|
|
39
39
|
...$
|
|
40
40
|
});
|
|
41
|
-
const { events:
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
let
|
|
49
|
-
|
|
41
|
+
const { events: z } = O.get("$widget");
|
|
42
|
+
z.dispatch("tracking:secondary-clicked", {});
|
|
43
|
+
}, be = (f) => {
|
|
44
|
+
if (p && v.current) {
|
|
45
|
+
const z = v.current.scrollHeight;
|
|
46
|
+
if (z > s) {
|
|
47
|
+
v.current.style.height = "auto";
|
|
48
|
+
let T = z;
|
|
49
|
+
f.length < 1 && (T = s), v.current.style.height = `${T}px`, T >= r ? v.current.style.overflowY = "scroll" : v.current.style.overflowY = "hidden";
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
},
|
|
53
|
-
|
|
52
|
+
}, W = (f) => {
|
|
53
|
+
be(f), o(f), f && f.length > 0 && l("user-typing", { textLength: f.length });
|
|
54
54
|
};
|
|
55
|
-
return
|
|
56
|
-
|
|
55
|
+
return y ? null : /* @__PURE__ */ h(
|
|
56
|
+
Ke,
|
|
57
57
|
{
|
|
58
|
-
grow:
|
|
59
|
-
className:
|
|
60
|
-
scrollableCss:
|
|
61
|
-
isTabbing:
|
|
58
|
+
grow: p,
|
|
59
|
+
className: H("humany-conversation-input", t),
|
|
60
|
+
scrollableCss: L,
|
|
61
|
+
isTabbing: u,
|
|
62
62
|
children: [
|
|
63
63
|
$ && /* @__PURE__ */ n(
|
|
64
|
-
|
|
64
|
+
Be,
|
|
65
65
|
{
|
|
66
66
|
className: "humany-secondary-button",
|
|
67
|
-
disabled:
|
|
68
|
-
onClick:
|
|
67
|
+
disabled: c,
|
|
68
|
+
onClick: pe,
|
|
69
69
|
title: $.label,
|
|
70
70
|
"aria-label": $.label,
|
|
71
71
|
children: /* @__PURE__ */ n(
|
|
@@ -77,40 +77,40 @@ const Oe = ({ className: t }) => {
|
|
|
77
77
|
)
|
|
78
78
|
}
|
|
79
79
|
),
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
p ? /* @__PURE__ */ n(
|
|
81
|
+
Ee,
|
|
82
82
|
{
|
|
83
83
|
value: e,
|
|
84
|
-
onChange:
|
|
85
|
-
onEnter:
|
|
86
|
-
disabled:
|
|
87
|
-
"aria-label":
|
|
88
|
-
placeholder:
|
|
84
|
+
onChange: W,
|
|
85
|
+
onEnter: P,
|
|
86
|
+
disabled: c,
|
|
87
|
+
"aria-label": m,
|
|
88
|
+
placeholder: m,
|
|
89
89
|
type: "textarea",
|
|
90
90
|
rows: 1,
|
|
91
|
-
ref:
|
|
91
|
+
ref: v
|
|
92
92
|
}
|
|
93
93
|
) : /* @__PURE__ */ n(
|
|
94
|
-
|
|
94
|
+
Re,
|
|
95
95
|
{
|
|
96
96
|
value: e,
|
|
97
|
-
onChange:
|
|
98
|
-
onEnter:
|
|
99
|
-
disabled:
|
|
100
|
-
"aria-label":
|
|
101
|
-
placeholder:
|
|
97
|
+
onChange: W,
|
|
98
|
+
onEnter: P,
|
|
99
|
+
disabled: c,
|
|
100
|
+
"aria-label": m,
|
|
101
|
+
placeholder: m
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
104
|
/* @__PURE__ */ n(
|
|
105
|
-
|
|
105
|
+
he,
|
|
106
106
|
{
|
|
107
107
|
className: "humany-send-button",
|
|
108
108
|
disabled: !1,
|
|
109
|
-
onClick:
|
|
110
|
-
title:
|
|
111
|
-
"aria-label":
|
|
109
|
+
onClick: P,
|
|
110
|
+
title: g,
|
|
111
|
+
"aria-label": g,
|
|
112
112
|
children: /* @__PURE__ */ n(
|
|
113
|
-
|
|
113
|
+
De,
|
|
114
114
|
{
|
|
115
115
|
size: 22,
|
|
116
116
|
symbol: { type: "Svg", content: "send" },
|
|
@@ -122,7 +122,7 @@ const Oe = ({ className: t }) => {
|
|
|
122
122
|
]
|
|
123
123
|
}
|
|
124
124
|
);
|
|
125
|
-
},
|
|
125
|
+
}, Ee = i(se)`
|
|
126
126
|
resize: none;
|
|
127
127
|
flex: 1;
|
|
128
128
|
flex-shrink: 1;
|
|
@@ -143,10 +143,10 @@ const Oe = ({ className: t }) => {
|
|
|
143
143
|
transition: height 200ms linear;
|
|
144
144
|
outline: none;
|
|
145
145
|
&:focus-visible {
|
|
146
|
-
${
|
|
146
|
+
${b};
|
|
147
147
|
outline-offset: 12px;
|
|
148
148
|
}
|
|
149
|
-
`,
|
|
149
|
+
`, Re = i(se)`
|
|
150
150
|
flex: 1;
|
|
151
151
|
border: none;
|
|
152
152
|
background-color: transparent;
|
|
@@ -172,7 +172,7 @@ const Oe = ({ className: t }) => {
|
|
|
172
172
|
}};
|
|
173
173
|
font-style: italic;
|
|
174
174
|
}
|
|
175
|
-
`,
|
|
175
|
+
`, he = i(A)`
|
|
176
176
|
flex: 0 0 50px;
|
|
177
177
|
align-self: stretch;
|
|
178
178
|
background-color: transparent;
|
|
@@ -182,19 +182,19 @@ const Oe = ({ className: t }) => {
|
|
|
182
182
|
border: none;
|
|
183
183
|
color: #a6a6a6;
|
|
184
184
|
&:focus-visible {
|
|
185
|
-
${
|
|
185
|
+
${b};
|
|
186
186
|
}
|
|
187
|
-
`,
|
|
187
|
+
`, Be = i(he)`
|
|
188
188
|
border-right: ${(t) => t.theme.border};
|
|
189
189
|
margin: ${(t) => {
|
|
190
190
|
var e;
|
|
191
191
|
return (e = t.theme.sizes) == null ? void 0 : e.normal;
|
|
192
192
|
}} 0;
|
|
193
|
-
`,
|
|
194
|
-
${(t) => t.grow ?
|
|
193
|
+
`, Ke = i.div`
|
|
194
|
+
${(t) => t.grow ? x`
|
|
195
195
|
min-height: 50px;
|
|
196
196
|
max-height: 150px;
|
|
197
|
-
` :
|
|
197
|
+
` : x`
|
|
198
198
|
height: 50px;
|
|
199
199
|
`}
|
|
200
200
|
flex: 0 0 auto;
|
|
@@ -205,11 +205,11 @@ const Oe = ({ className: t }) => {
|
|
|
205
205
|
return (e = t.theme.colors) == null ? void 0 : e.accent;
|
|
206
206
|
}};
|
|
207
207
|
border-top: ${(t) => t.theme.inputBorder};
|
|
208
|
-
${(t) => t["data-has-focus"] && t.isTabbing &&
|
|
208
|
+
${(t) => t["data-has-focus"] && t.isTabbing && b}
|
|
209
209
|
textarea {
|
|
210
210
|
${(t) => !!t.scrollableCss && t.scrollableCss}
|
|
211
211
|
}
|
|
212
|
-
`,
|
|
212
|
+
`, De = i(
|
|
213
213
|
({
|
|
214
214
|
hasContent: t,
|
|
215
215
|
...e
|
|
@@ -226,7 +226,7 @@ const Oe = ({ className: t }) => {
|
|
|
226
226
|
return t.hasContent ? (e = t.theme.colors) == null ? void 0 : e.primary : "#a6a6a6";
|
|
227
227
|
}};
|
|
228
228
|
}
|
|
229
|
-
`,
|
|
229
|
+
`, je = i.div`
|
|
230
230
|
width: ${(t) => t.avatarSize || "32px"};
|
|
231
231
|
height: ${(t) => t.avatarSize || "32px"};
|
|
232
232
|
border-radius: 50%;
|
|
@@ -273,7 +273,7 @@ const Oe = ({ className: t }) => {
|
|
|
273
273
|
}};
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
`, Pe =
|
|
276
|
+
`, Pe = Me`
|
|
277
277
|
0% {
|
|
278
278
|
opacity: 0;
|
|
279
279
|
}
|
|
@@ -303,23 +303,23 @@ const Oe = ({ className: t }) => {
|
|
|
303
303
|
> div:nth-of-type(3) {
|
|
304
304
|
animation-delay: 200ms;
|
|
305
305
|
}
|
|
306
|
-
`,
|
|
306
|
+
`, F = i.div`
|
|
307
307
|
grid-area: content;
|
|
308
308
|
max-width: 100%;
|
|
309
309
|
overflow: hidden;
|
|
310
|
-
`, qe = i(
|
|
310
|
+
`, qe = i(J)`
|
|
311
311
|
font-size: ${(t) => {
|
|
312
312
|
var e;
|
|
313
313
|
return (e = t.theme.fonts) == null ? void 0 : e.normal;
|
|
314
314
|
}};
|
|
315
315
|
font-weight: normal;
|
|
316
316
|
margin: 0;
|
|
317
|
-
`,
|
|
317
|
+
`, Y = i.div`
|
|
318
318
|
display: flex;
|
|
319
319
|
${(t) => t.left && "justify-content: start;"};
|
|
320
320
|
${(t) => t.center && "justify-content: center;"};
|
|
321
321
|
${(t) => t.right && "justify-content: end;"};
|
|
322
|
-
`,
|
|
322
|
+
`, X = i.div`
|
|
323
323
|
${(t) => {
|
|
324
324
|
var e;
|
|
325
325
|
return t.padded && `padding: ${(e = t.theme.sizes) == null ? void 0 : e.medium};`;
|
|
@@ -343,12 +343,12 @@ const Oe = ({ className: t }) => {
|
|
|
343
343
|
${(t) => t.fullWidth && "width: 100%;"}
|
|
344
344
|
`, Ue = (t, e) => {
|
|
345
345
|
var s, a;
|
|
346
|
-
const o =
|
|
346
|
+
const o = x`
|
|
347
347
|
background-color: ${(s = e.colors) == null ? void 0 : s.accent};
|
|
348
348
|
color: ${(a = e.colors) == null ? void 0 : a.text};
|
|
349
349
|
${e.border && `border: ${e.border};`};
|
|
350
350
|
`;
|
|
351
|
-
return e.borderRadius ?
|
|
351
|
+
return e.borderRadius ? x`
|
|
352
352
|
${o}
|
|
353
353
|
|
|
354
354
|
border-top-right-radius: ${e.borderRadius};
|
|
@@ -364,11 +364,11 @@ const Oe = ({ className: t }) => {
|
|
|
364
364
|
` : o;
|
|
365
365
|
}, Ve = (t, e) => {
|
|
366
366
|
var s, a;
|
|
367
|
-
const o =
|
|
367
|
+
const o = x`
|
|
368
368
|
background-color: ${(s = e.colors) == null ? void 0 : s.primary};
|
|
369
369
|
color: ${(a = e.colors) == null ? void 0 : a.accent};
|
|
370
370
|
`;
|
|
371
|
-
return e.borderRadius ?
|
|
371
|
+
return e.borderRadius ? x`
|
|
372
372
|
${o}
|
|
373
373
|
|
|
374
374
|
border-top-left-radius: ${e.borderRadius};
|
|
@@ -382,7 +382,7 @@ const Oe = ({ className: t }) => {
|
|
|
382
382
|
border-bottom-right-radius: ${e.borderRadius};
|
|
383
383
|
`}
|
|
384
384
|
` : o;
|
|
385
|
-
},
|
|
385
|
+
}, E = i.div`
|
|
386
386
|
margin-bottom: ${(t) => {
|
|
387
387
|
var e;
|
|
388
388
|
return (e = t.theme.sizes) == null ? void 0 : e.normal;
|
|
@@ -392,7 +392,7 @@ const Oe = ({ className: t }) => {
|
|
|
392
392
|
}
|
|
393
393
|
`, C = (t) => {
|
|
394
394
|
var e, o;
|
|
395
|
-
return
|
|
395
|
+
return x`
|
|
396
396
|
margin: ${(e = t.theme.sizes) == null ? void 0 : e.medium} 0;
|
|
397
397
|
padding: 0 ${(o = t.theme.sizes) == null ? void 0 : o.medium};
|
|
398
398
|
`;
|
|
@@ -400,7 +400,7 @@ const Oe = ({ className: t }) => {
|
|
|
400
400
|
& button.humany-form-component-button {
|
|
401
401
|
${(t) => {
|
|
402
402
|
var e, o, s, a;
|
|
403
|
-
return ((e = t.theme.colors) == null ? void 0 : e.primary) && ((o = t.theme.colors) == null ? void 0 : o.accent) &&
|
|
403
|
+
return ((e = t.theme.colors) == null ? void 0 : e.primary) && ((o = t.theme.colors) == null ? void 0 : o.accent) && xe({
|
|
404
404
|
active: !1,
|
|
405
405
|
primaryColor: (s = t.theme.colors) == null ? void 0 : s.primary,
|
|
406
406
|
secondaryColor: (a = t.theme.colors) == null ? void 0 : a.accent,
|
|
@@ -424,14 +424,14 @@ const Oe = ({ className: t }) => {
|
|
|
424
424
|
}};
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
`, Fe = i(
|
|
427
|
+
`, Fe = i(Q)`
|
|
428
428
|
white-space: pre-wrap;
|
|
429
429
|
a {
|
|
430
430
|
color: ${(t) => t.theme.colors.link};
|
|
431
431
|
&:focus {
|
|
432
432
|
${(t) => {
|
|
433
433
|
var e;
|
|
434
|
-
return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) &&
|
|
434
|
+
return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && b;
|
|
435
435
|
}};
|
|
436
436
|
}
|
|
437
437
|
}
|
|
@@ -449,7 +449,7 @@ const Oe = ({ className: t }) => {
|
|
|
449
449
|
}};
|
|
450
450
|
}
|
|
451
451
|
`, Xe = i.button`
|
|
452
|
-
${(t) =>
|
|
452
|
+
${(t) => B(t)};
|
|
453
453
|
display: block;
|
|
454
454
|
background-color: ${(t) => {
|
|
455
455
|
var e;
|
|
@@ -458,23 +458,23 @@ const Oe = ({ className: t }) => {
|
|
|
458
458
|
width: 100%;
|
|
459
459
|
color: #fff;
|
|
460
460
|
&:focus-visible {
|
|
461
|
-
${
|
|
461
|
+
${b}
|
|
462
462
|
background-color: transparent;
|
|
463
463
|
}
|
|
464
464
|
`, ne = ee(
|
|
465
|
-
({ boxed: t, className: e, agentData: o }, s) => /* @__PURE__ */ n(
|
|
466
|
-
|
|
465
|
+
({ boxed: t, className: e, agentData: o }, s) => /* @__PURE__ */ n(F, { ref: s, children: /* @__PURE__ */ n(Y, { left: t, center: !t, children: /* @__PURE__ */ n(
|
|
466
|
+
X,
|
|
467
467
|
{
|
|
468
468
|
padded: !!t,
|
|
469
469
|
stacked: t ? "first" : void 0,
|
|
470
|
-
children: /* @__PURE__ */
|
|
470
|
+
children: /* @__PURE__ */ h(We, { children: [
|
|
471
471
|
/* @__PURE__ */ n("div", {}),
|
|
472
472
|
/* @__PURE__ */ n("div", {}),
|
|
473
473
|
/* @__PURE__ */ n("div", {})
|
|
474
474
|
] })
|
|
475
475
|
}
|
|
476
476
|
) }) })
|
|
477
|
-
),
|
|
477
|
+
), ge = de.createContext(null), Ge = i.p`
|
|
478
478
|
&& {
|
|
479
479
|
font-size: ${(t) => {
|
|
480
480
|
var e;
|
|
@@ -498,30 +498,30 @@ const Oe = ({ className: t }) => {
|
|
|
498
498
|
timestamp: o,
|
|
499
499
|
ariaHidden: s = !1
|
|
500
500
|
}) => {
|
|
501
|
-
const a =
|
|
501
|
+
const a = Ae(ge);
|
|
502
502
|
if (!e && !o)
|
|
503
503
|
return null;
|
|
504
504
|
let r = "";
|
|
505
505
|
return e ? o ? r = `${e}: ${re(o, a)}` : r = e : o && (r = re(o, a)), /* @__PURE__ */ n(Ge, { "aria-hidden": s, children: r });
|
|
506
|
-
},
|
|
506
|
+
}, fe = ({
|
|
507
507
|
className: t,
|
|
508
508
|
children: e,
|
|
509
509
|
sender: o,
|
|
510
510
|
timestamp: s
|
|
511
511
|
}) => {
|
|
512
|
-
const { avatar: a, name: r } = o, { avatarSize:
|
|
513
|
-
return /* @__PURE__ */
|
|
512
|
+
const { avatar: a, name: r } = o, { avatarSize: d, avatarLabel: u = "Avatar" } = S();
|
|
513
|
+
return /* @__PURE__ */ h(
|
|
514
514
|
Je,
|
|
515
515
|
{
|
|
516
516
|
hasAvatar: !!a,
|
|
517
|
-
className:
|
|
517
|
+
className: H(
|
|
518
518
|
t,
|
|
519
519
|
"humany-conversation-agent-message"
|
|
520
520
|
),
|
|
521
521
|
children: [
|
|
522
|
-
a && /* @__PURE__ */ n(
|
|
522
|
+
a && /* @__PURE__ */ n(je, { className: "humany-agent-avatar", avatarSize: d, children: typeof a == "string" ? (
|
|
523
523
|
// eslint-disable-next-line jsx-a11y/alt-text
|
|
524
|
-
/* @__PURE__ */ n("img", { src: a })
|
|
524
|
+
/* @__PURE__ */ n("img", { src: a, alt: u })
|
|
525
525
|
) : /* @__PURE__ */ n(k, { symbol: a }) }),
|
|
526
526
|
e,
|
|
527
527
|
/* @__PURE__ */ n(
|
|
@@ -539,13 +539,13 @@ const Oe = ({ className: t }) => {
|
|
|
539
539
|
display: grid;
|
|
540
540
|
margin-right: 10%;
|
|
541
541
|
width: 90%;
|
|
542
|
-
${(t) => t.hasAvatar ?
|
|
542
|
+
${(t) => t.hasAvatar ? x`
|
|
543
543
|
grid-template-columns: auto 1fr;
|
|
544
544
|
grid-template-rows: 1fr auto;
|
|
545
545
|
grid-template-areas:
|
|
546
546
|
'avatar content'
|
|
547
547
|
'. info';
|
|
548
|
-
` :
|
|
548
|
+
` : x`
|
|
549
549
|
grid-template-columns: 1fr;
|
|
550
550
|
grid-template-rows: 1fr auto;
|
|
551
551
|
grid-template-areas:
|
|
@@ -557,15 +557,15 @@ const Oe = ({ className: t }) => {
|
|
|
557
557
|
Ze,
|
|
558
558
|
{
|
|
559
559
|
ref: r,
|
|
560
|
-
className:
|
|
560
|
+
className: H(
|
|
561
561
|
t,
|
|
562
562
|
"humany-conversation-system-message"
|
|
563
563
|
),
|
|
564
564
|
fullWidth: a,
|
|
565
|
-
children: s ? /* @__PURE__ */
|
|
565
|
+
children: s ? /* @__PURE__ */ h(et, { className: "humany-conversation-discrete-message", children: [
|
|
566
566
|
e,
|
|
567
567
|
/* @__PURE__ */ n(M, { timestamp: o })
|
|
568
|
-
] }) : /* @__PURE__ */
|
|
568
|
+
] }) : /* @__PURE__ */ h(N, { children: [
|
|
569
569
|
e,
|
|
570
570
|
/* @__PURE__ */ n(M, { timestamp: o })
|
|
571
571
|
] })
|
|
@@ -594,10 +594,10 @@ const Oe = ({ className: t }) => {
|
|
|
594
594
|
}
|
|
595
595
|
`, tt = ({ className: t, children: e, timestamp: o }) => {
|
|
596
596
|
const { userLabel: s = "" } = S();
|
|
597
|
-
return /* @__PURE__ */
|
|
597
|
+
return /* @__PURE__ */ h(
|
|
598
598
|
nt,
|
|
599
599
|
{
|
|
600
|
-
className:
|
|
600
|
+
className: H(
|
|
601
601
|
t,
|
|
602
602
|
"humany-conversation-user-message"
|
|
603
603
|
),
|
|
@@ -624,7 +624,7 @@ const Oe = ({ className: t }) => {
|
|
|
624
624
|
label: t[e],
|
|
625
625
|
actionKey: e
|
|
626
626
|
})), rt = ({ header: t, actions: e, dispatch: o }) => {
|
|
627
|
-
const s =
|
|
627
|
+
const s = I(), { events: a } = s.get("$widget");
|
|
628
628
|
return /* @__PURE__ */ n(
|
|
629
629
|
ot,
|
|
630
630
|
{
|
|
@@ -632,9 +632,9 @@ const Oe = ({ className: t }) => {
|
|
|
632
632
|
header: t,
|
|
633
633
|
items: te(e),
|
|
634
634
|
renderItem: (r) => {
|
|
635
|
-
var
|
|
636
|
-
const
|
|
637
|
-
return /* @__PURE__ */ n("li", { children:
|
|
635
|
+
var u;
|
|
636
|
+
const d = !!((u = r == null ? void 0 : r.data) != null && u.href);
|
|
637
|
+
return /* @__PURE__ */ n("li", { children: d ? /* @__PURE__ */ h(
|
|
638
638
|
st,
|
|
639
639
|
{
|
|
640
640
|
href: r.data.href,
|
|
@@ -646,7 +646,7 @@ const Oe = ({ className: t }) => {
|
|
|
646
646
|
r.label
|
|
647
647
|
]
|
|
648
648
|
}
|
|
649
|
-
) : /* @__PURE__ */
|
|
649
|
+
) : /* @__PURE__ */ h(
|
|
650
650
|
at,
|
|
651
651
|
{
|
|
652
652
|
onClick: () => {
|
|
@@ -663,8 +663,8 @@ const Oe = ({ className: t }) => {
|
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
);
|
|
666
|
-
}, ot = i(
|
|
667
|
-
${
|
|
666
|
+
}, ot = i(K)`
|
|
667
|
+
${D}
|
|
668
668
|
> ul {
|
|
669
669
|
display: flex;
|
|
670
670
|
flex-wrap: wrap;
|
|
@@ -677,8 +677,8 @@ const Oe = ({ className: t }) => {
|
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
${C}
|
|
680
|
-
`, st = i(
|
|
681
|
-
${
|
|
680
|
+
`, st = i(ke)`
|
|
681
|
+
${B};
|
|
682
682
|
|
|
683
683
|
display: block;
|
|
684
684
|
padding: ${(t) => {
|
|
@@ -694,7 +694,7 @@ const Oe = ({ className: t }) => {
|
|
|
694
694
|
overflow: hidden;
|
|
695
695
|
text-overflow: ellipsis;
|
|
696
696
|
&:focus-visible {
|
|
697
|
-
${
|
|
697
|
+
${b}
|
|
698
698
|
background-color: transparent;
|
|
699
699
|
}
|
|
700
700
|
|
|
@@ -705,8 +705,8 @@ const Oe = ({ className: t }) => {
|
|
|
705
705
|
return (e = t.theme.sizes) == null ? void 0 : e.small;
|
|
706
706
|
}};
|
|
707
707
|
}
|
|
708
|
-
`, at = i(
|
|
709
|
-
${
|
|
708
|
+
`, at = i(A)`
|
|
709
|
+
${B};
|
|
710
710
|
|
|
711
711
|
display: block;
|
|
712
712
|
padding: ${(t) => {
|
|
@@ -722,7 +722,7 @@ const Oe = ({ className: t }) => {
|
|
|
722
722
|
overflow: hidden;
|
|
723
723
|
text-overflow: ellipsis;
|
|
724
724
|
&:focus-visible {
|
|
725
|
-
${
|
|
725
|
+
${b}
|
|
726
726
|
background-color: transparent;
|
|
727
727
|
}
|
|
728
728
|
|
|
@@ -734,17 +734,17 @@ const Oe = ({ className: t }) => {
|
|
|
734
734
|
}};
|
|
735
735
|
}
|
|
736
736
|
`, it = ({ type: t, content: e = {} }) => {
|
|
737
|
-
const o =
|
|
738
|
-
return !o || !t ? null : /* @__PURE__ */ n(
|
|
739
|
-
}, lt = ({ body: t }) => /* @__PURE__ */ n(ct, { className: "humany-html", html: t }), ct = i(
|
|
740
|
-
${
|
|
737
|
+
const o = we(t);
|
|
738
|
+
return !o || !t ? null : /* @__PURE__ */ n(Ie, { fallback: null, children: /* @__PURE__ */ n(o, { ...e }) });
|
|
739
|
+
}, lt = ({ body: t }) => /* @__PURE__ */ n(ct, { className: "humany-html", html: t }), ct = i(Q)`
|
|
740
|
+
${Se}
|
|
741
741
|
color: inherit;
|
|
742
742
|
white-space: normal;
|
|
743
743
|
${C}
|
|
744
744
|
a {
|
|
745
745
|
color: ${(t) => t.theme.colors.link};
|
|
746
746
|
&:focus-visible {
|
|
747
|
-
${
|
|
747
|
+
${b};
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
750
|
p {
|
|
@@ -758,7 +758,7 @@ const Oe = ({ className: t }) => {
|
|
|
758
758
|
items: te(e),
|
|
759
759
|
renderItem: (s) => {
|
|
760
760
|
var a;
|
|
761
|
-
return /* @__PURE__ */ n("li", { children: /* @__PURE__ */
|
|
761
|
+
return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ h(ut, { children: [
|
|
762
762
|
((a = s.symbol) == null ? void 0 : a.content) && /* @__PURE__ */ n("div", { className: "item-icon", children: /* @__PURE__ */ n(
|
|
763
763
|
k,
|
|
764
764
|
{
|
|
@@ -769,9 +769,9 @@ const Oe = ({ className: t }) => {
|
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
771
|
) }),
|
|
772
|
-
/* @__PURE__ */
|
|
772
|
+
/* @__PURE__ */ h("div", { className: "item-body", children: [
|
|
773
773
|
/* @__PURE__ */ n(
|
|
774
|
-
|
|
774
|
+
A,
|
|
775
775
|
{
|
|
776
776
|
onClick: () => {
|
|
777
777
|
o("action", s);
|
|
@@ -786,8 +786,8 @@ const Oe = ({ className: t }) => {
|
|
|
786
786
|
] }) }, s.actionKey);
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
), mt = i(
|
|
790
|
-
${
|
|
789
|
+
), mt = i(K)`
|
|
790
|
+
${D}
|
|
791
791
|
|
|
792
792
|
> .humany-paragraph {
|
|
793
793
|
${C}
|
|
@@ -798,9 +798,9 @@ const Oe = ({ className: t }) => {
|
|
|
798
798
|
}
|
|
799
799
|
}
|
|
800
800
|
|
|
801
|
-
${(t) =>
|
|
801
|
+
${(t) => Z(t)(
|
|
802
802
|
"h1",
|
|
803
|
-
|
|
803
|
+
x`
|
|
804
804
|
white-space: normal;
|
|
805
805
|
`
|
|
806
806
|
)}
|
|
@@ -863,7 +863,7 @@ const Oe = ({ className: t }) => {
|
|
|
863
863
|
margin: 0;
|
|
864
864
|
|
|
865
865
|
&:focus-visible {
|
|
866
|
-
${
|
|
866
|
+
${b}
|
|
867
867
|
span {
|
|
868
868
|
color: ${(t) => {
|
|
869
869
|
var e;
|
|
@@ -874,31 +874,31 @@ const Oe = ({ className: t }) => {
|
|
|
874
874
|
}
|
|
875
875
|
}
|
|
876
876
|
`, ht = ({ header: t, actions: e, dispatch: o }) => {
|
|
877
|
-
const s =
|
|
878
|
-
return
|
|
877
|
+
const s = Ce(e), a = me(), r = ae(), d = I(), { events: u } = d.get("$widget");
|
|
878
|
+
return j(() => {
|
|
879
879
|
if (s && Array.isArray(e) && Array.isArray(s) && s.length < e.length && a.current) {
|
|
880
|
-
const
|
|
880
|
+
const l = a.current.querySelectorAll(
|
|
881
881
|
".humany-conversation-link-list > ul > li"
|
|
882
|
-
),
|
|
883
|
-
if (
|
|
884
|
-
const
|
|
885
|
-
if (
|
|
886
|
-
const
|
|
882
|
+
), m = l[s.length];
|
|
883
|
+
if (l.length === e.length && s.length) {
|
|
884
|
+
const y = l[s.length - 1];
|
|
885
|
+
if (y) {
|
|
886
|
+
const c = y.querySelector(
|
|
887
887
|
".humany-button"
|
|
888
888
|
);
|
|
889
|
-
|
|
889
|
+
c && c.focus();
|
|
890
890
|
}
|
|
891
891
|
} else
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
if (
|
|
892
|
+
m && new MutationObserver((c, g) => {
|
|
893
|
+
c.forEach((p) => {
|
|
894
|
+
if (p.addedNodes) {
|
|
895
895
|
const $ = Array.from(
|
|
896
|
-
|
|
897
|
-
).find((
|
|
898
|
-
$ &&
|
|
896
|
+
p.addedNodes
|
|
897
|
+
).find((L) => L.tagName === "BUTTON");
|
|
898
|
+
$ && Ne(a.current, document.activeElement) && (r && $.focus(), g.disconnect());
|
|
899
899
|
}
|
|
900
900
|
});
|
|
901
|
-
}).observe(
|
|
901
|
+
}).observe(m, {
|
|
902
902
|
attributes: !1,
|
|
903
903
|
characterData: !1,
|
|
904
904
|
childList: !0,
|
|
@@ -914,18 +914,18 @@ const Oe = ({ className: t }) => {
|
|
|
914
914
|
className: "humany-conversation-link-list",
|
|
915
915
|
header: t,
|
|
916
916
|
items: te(e),
|
|
917
|
-
renderItem: (
|
|
917
|
+
renderItem: (l) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ h(
|
|
918
918
|
ft,
|
|
919
919
|
{
|
|
920
|
-
help:
|
|
920
|
+
help: l.actionKey === "help",
|
|
921
921
|
onClick: () => {
|
|
922
|
-
o("action",
|
|
922
|
+
o("action", l), u.dispatch("tracking:link-list-item-clicked", l);
|
|
923
923
|
},
|
|
924
|
-
"aria-label":
|
|
925
|
-
title:
|
|
924
|
+
"aria-label": l.label,
|
|
925
|
+
title: l.label,
|
|
926
926
|
children: [
|
|
927
|
-
|
|
928
|
-
|
|
927
|
+
l.label,
|
|
928
|
+
l.actionKey === "help" && /* @__PURE__ */ n(
|
|
929
929
|
k,
|
|
930
930
|
{
|
|
931
931
|
size: 14,
|
|
@@ -937,16 +937,16 @@ const Oe = ({ className: t }) => {
|
|
|
937
937
|
)
|
|
938
938
|
]
|
|
939
939
|
}
|
|
940
|
-
) },
|
|
940
|
+
) }, l.actionKey)
|
|
941
941
|
}
|
|
942
942
|
);
|
|
943
|
-
}, gt = i(
|
|
944
|
-
${
|
|
943
|
+
}, gt = i(K)`
|
|
944
|
+
${D}
|
|
945
945
|
${C}
|
|
946
946
|
|
|
947
|
-
${(t) =>
|
|
947
|
+
${(t) => Z(t)(
|
|
948
948
|
"h1",
|
|
949
|
-
|
|
949
|
+
x`
|
|
950
950
|
white-space: normal;
|
|
951
951
|
`
|
|
952
952
|
)}
|
|
@@ -962,7 +962,7 @@ const Oe = ({ className: t }) => {
|
|
|
962
962
|
margin: 0;
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
|
-
`, ft = i(
|
|
965
|
+
`, ft = i(A)`
|
|
966
966
|
display: block;
|
|
967
967
|
text-align: left;
|
|
968
968
|
font-weight: 300;
|
|
@@ -976,7 +976,7 @@ const Oe = ({ className: t }) => {
|
|
|
976
976
|
|
|
977
977
|
${(t) => {
|
|
978
978
|
var e, o;
|
|
979
|
-
return t.help &&
|
|
979
|
+
return t.help && x`
|
|
980
980
|
color: ${(e = t.theme.colors) == null ? void 0 : e.text};
|
|
981
981
|
text-decoration: underline;
|
|
982
982
|
|
|
@@ -988,7 +988,7 @@ const Oe = ({ className: t }) => {
|
|
|
988
988
|
}}
|
|
989
989
|
|
|
990
990
|
&:focus-visible {
|
|
991
|
-
${
|
|
991
|
+
${b}
|
|
992
992
|
span {
|
|
993
993
|
color: ${(t) => {
|
|
994
994
|
var e;
|
|
@@ -1000,7 +1000,7 @@ const Oe = ({ className: t }) => {
|
|
|
1000
1000
|
`, yt = () => /* @__PURE__ */ n(pt, { className: "humany-conversation-separator" }), pt = i.div`
|
|
1001
1001
|
${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
|
|
1002
1002
|
width: 100%;
|
|
1003
|
-
`, bt = ({ text: t }) => /* @__PURE__ */ n($t, { className: "humany-conversation-text", variant: "span", children: t }), $t = i(
|
|
1003
|
+
`, bt = ({ text: t }) => /* @__PURE__ */ n($t, { className: "humany-conversation-text", variant: "span", children: t }), $t = i(J)`
|
|
1004
1004
|
${C}
|
|
1005
1005
|
`, vt = ({
|
|
1006
1006
|
header: t = "Video call",
|
|
@@ -1033,7 +1033,7 @@ const Oe = ({ className: t }) => {
|
|
|
1033
1033
|
header: t,
|
|
1034
1034
|
items: a,
|
|
1035
1035
|
renderItem: (r) => {
|
|
1036
|
-
const
|
|
1036
|
+
const d = r.actionKey === "accept-video-call" ? "#70c48e" : "#da5c85";
|
|
1037
1037
|
return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
1038
1038
|
kt,
|
|
1039
1039
|
{
|
|
@@ -1042,15 +1042,15 @@ const Oe = ({ className: t }) => {
|
|
|
1042
1042
|
},
|
|
1043
1043
|
"aria-label": r.label,
|
|
1044
1044
|
title: r.label,
|
|
1045
|
-
bgColor:
|
|
1045
|
+
bgColor: d,
|
|
1046
1046
|
children: /* @__PURE__ */ n(k, { symbol: r.symbol, size: 25 })
|
|
1047
1047
|
}
|
|
1048
1048
|
) }, r.actionKey);
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
1051
|
);
|
|
1052
|
-
}, xt = i(
|
|
1053
|
-
${(t) =>
|
|
1052
|
+
}, xt = i(K)`
|
|
1053
|
+
${(t) => D(t)}
|
|
1054
1054
|
> ul {
|
|
1055
1055
|
display: flex;
|
|
1056
1056
|
flex-wrap: wrap;
|
|
@@ -1063,8 +1063,8 @@ const Oe = ({ className: t }) => {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
1065
|
${(t) => C(t)}
|
|
1066
|
-
`, kt = i(
|
|
1067
|
-
${
|
|
1066
|
+
`, kt = i(A)`
|
|
1067
|
+
${B};
|
|
1068
1068
|
|
|
1069
1069
|
background-color: ${(t) => t.bgColor};
|
|
1070
1070
|
display: flex;
|
|
@@ -1076,7 +1076,7 @@ const Oe = ({ className: t }) => {
|
|
|
1076
1076
|
border-radius: 100%;
|
|
1077
1077
|
|
|
1078
1078
|
&:focus-visible {
|
|
1079
|
-
${
|
|
1079
|
+
${b}
|
|
1080
1080
|
background-color: transparent;
|
|
1081
1081
|
|
|
1082
1082
|
i,
|
|
@@ -1103,24 +1103,24 @@ const Oe = ({ className: t }) => {
|
|
|
1103
1103
|
stroke: #fff;
|
|
1104
1104
|
}
|
|
1105
1105
|
}
|
|
1106
|
-
`,
|
|
1107
|
-
const o = t.map(
|
|
1108
|
-
return !!t.map(
|
|
1109
|
-
const
|
|
1110
|
-
return !!(
|
|
1111
|
-
}).length && o.push("humany-secondary-action-list"), !!t.map(
|
|
1112
|
-
var
|
|
1113
|
-
const
|
|
1114
|
-
return !!((
|
|
1106
|
+
`, R = ([t, e]) => ({ type: t, content: e }), wt = ({ items: t, dispatch: e }) => {
|
|
1107
|
+
const o = t.map(R).filter((r) => r.type.includes("ace-knowledge")).map((r) => "humany-" + r.type.toString());
|
|
1108
|
+
return !!t.map(R).filter((r) => {
|
|
1109
|
+
const d = r == null ? void 0 : r.content, u = d == null ? void 0 : d.actions;
|
|
1110
|
+
return !!(u != null && u.filter((l) => l.actionKey === "contact").length);
|
|
1111
|
+
}).length && o.push("humany-secondary-action-list"), !!t.map(R).filter((r) => {
|
|
1112
|
+
var u;
|
|
1113
|
+
const d = r == null ? void 0 : r.content;
|
|
1114
|
+
return !!((u = d == null ? void 0 : d.tags) != null && u.includes("category"));
|
|
1115
1115
|
}).length && o.push("humany-category-list"), /* @__PURE__ */ n(
|
|
1116
1116
|
St,
|
|
1117
1117
|
{
|
|
1118
1118
|
role: "none",
|
|
1119
|
-
className:
|
|
1119
|
+
className: H(
|
|
1120
1120
|
"humany-message-list",
|
|
1121
1121
|
o.join(" ")
|
|
1122
1122
|
),
|
|
1123
|
-
items: t.map(
|
|
1123
|
+
items: t.map(R),
|
|
1124
1124
|
renderLi: !0,
|
|
1125
1125
|
renderItem: (r) => {
|
|
1126
1126
|
switch (r.type) {
|
|
@@ -1145,21 +1145,21 @@ const Oe = ({ className: t }) => {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
);
|
|
1147
1147
|
}, St = i(le)`
|
|
1148
|
-
${
|
|
1148
|
+
${Le}
|
|
1149
1149
|
|
|
1150
1150
|
> li {
|
|
1151
1151
|
margin: 0;
|
|
1152
1152
|
}
|
|
1153
1153
|
`, Ct = ee(
|
|
1154
1154
|
({ className: t, timestamp: e, sender: o, type: s, content: a }, r) => {
|
|
1155
|
-
const
|
|
1156
|
-
(
|
|
1157
|
-
let
|
|
1158
|
-
return a.length > 1 && (
|
|
1155
|
+
const d = ue(
|
|
1156
|
+
(c) => {
|
|
1157
|
+
let g = "first";
|
|
1158
|
+
return a.length > 1 && (g = c === 0 ? "first" : c + 1 === a.length ? "last" : "middle"), g;
|
|
1159
1159
|
},
|
|
1160
1160
|
[a]
|
|
1161
|
-
), { userLabel:
|
|
1162
|
-
const { key:
|
|
1161
|
+
), { userLabel: u = "" } = S(), l = () => /* @__PURE__ */ n(N, { children: a.map((c) => {
|
|
1162
|
+
const { key: g, body: p, title: $, form: L, actions: v } = c, O = !!p && !$ && !L && !v;
|
|
1163
1163
|
return /* @__PURE__ */ n(
|
|
1164
1164
|
Qe,
|
|
1165
1165
|
{
|
|
@@ -1167,120 +1167,120 @@ const Oe = ({ className: t }) => {
|
|
|
1167
1167
|
discrete: O,
|
|
1168
1168
|
ref: r,
|
|
1169
1169
|
timestamp: e,
|
|
1170
|
-
fullWidth: !!
|
|
1171
|
-
children: O &&
|
|
1170
|
+
fullWidth: !!L || !!v,
|
|
1171
|
+
children: O && p ? /* @__PURE__ */ n(Q, { html: p }) : /* @__PURE__ */ n(V, { isSystem: !0, content: c })
|
|
1172
1172
|
},
|
|
1173
|
-
|
|
1173
|
+
g
|
|
1174
1174
|
);
|
|
1175
|
-
}) }),
|
|
1175
|
+
}) }), m = () => /* @__PURE__ */ h(N, { children: [
|
|
1176
1176
|
/* @__PURE__ */ n(oe, { className: "humany-sr-only", children: /* @__PURE__ */ n(M, { name: o == null ? void 0 : o.name, timestamp: e }) }),
|
|
1177
1177
|
/* @__PURE__ */ n(
|
|
1178
|
-
|
|
1178
|
+
fe,
|
|
1179
1179
|
{
|
|
1180
1180
|
sender: o,
|
|
1181
1181
|
timestamp: e,
|
|
1182
1182
|
className: t,
|
|
1183
|
-
children: /* @__PURE__ */ n(
|
|
1184
|
-
|
|
1183
|
+
children: /* @__PURE__ */ n(F, { className: "humany-message-content-bundle", children: a.map((c, g) => /* @__PURE__ */ n(
|
|
1184
|
+
Y,
|
|
1185
1185
|
{
|
|
1186
1186
|
className: "humany-message-container",
|
|
1187
1187
|
left: !0,
|
|
1188
1188
|
ref: r,
|
|
1189
1189
|
children: /* @__PURE__ */ n(
|
|
1190
|
-
|
|
1190
|
+
V,
|
|
1191
1191
|
{
|
|
1192
|
-
content:
|
|
1193
|
-
stacked:
|
|
1192
|
+
content: c,
|
|
1193
|
+
stacked: d(g)
|
|
1194
1194
|
}
|
|
1195
1195
|
)
|
|
1196
1196
|
},
|
|
1197
|
-
|
|
1197
|
+
c.key
|
|
1198
1198
|
)) })
|
|
1199
1199
|
}
|
|
1200
1200
|
)
|
|
1201
|
-
] }),
|
|
1202
|
-
/* @__PURE__ */ n(oe, { className: "humany-sr-only", children: /* @__PURE__ */ n(M, { name:
|
|
1203
|
-
/* @__PURE__ */ n(tt, { timestamp: e, className: t, children: /* @__PURE__ */ n(
|
|
1204
|
-
|
|
1201
|
+
] }), y = () => /* @__PURE__ */ h(N, { children: [
|
|
1202
|
+
/* @__PURE__ */ n(oe, { className: "humany-sr-only", children: /* @__PURE__ */ n(M, { name: u, timestamp: e }) }),
|
|
1203
|
+
/* @__PURE__ */ n(tt, { timestamp: e, className: t, children: /* @__PURE__ */ n(F, { className: "humany-message-content-bundle", children: a.map((c, g) => /* @__PURE__ */ n(
|
|
1204
|
+
Y,
|
|
1205
1205
|
{
|
|
1206
1206
|
className: "humany-message-container",
|
|
1207
1207
|
right: !0,
|
|
1208
1208
|
ref: r,
|
|
1209
1209
|
children: /* @__PURE__ */ n(
|
|
1210
|
-
|
|
1210
|
+
V,
|
|
1211
1211
|
{
|
|
1212
1212
|
isUser: !0,
|
|
1213
|
-
content:
|
|
1214
|
-
stacked:
|
|
1213
|
+
content: c,
|
|
1214
|
+
stacked: d(g)
|
|
1215
1215
|
}
|
|
1216
1216
|
)
|
|
1217
1217
|
},
|
|
1218
|
-
|
|
1218
|
+
c.key
|
|
1219
1219
|
)) }) })
|
|
1220
1220
|
] });
|
|
1221
1221
|
switch (s) {
|
|
1222
|
-
case
|
|
1223
|
-
return
|
|
1224
|
-
case
|
|
1222
|
+
case U.System:
|
|
1223
|
+
return l();
|
|
1224
|
+
case U.Agent:
|
|
1225
|
+
return m();
|
|
1226
|
+
case U.User:
|
|
1225
1227
|
return y();
|
|
1226
|
-
case q.User:
|
|
1227
|
-
return x();
|
|
1228
1228
|
default:
|
|
1229
1229
|
return null;
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
1232
|
-
),
|
|
1232
|
+
), V = ({
|
|
1233
1233
|
content: t,
|
|
1234
1234
|
isUser: e,
|
|
1235
1235
|
isSystem: o,
|
|
1236
1236
|
stacked: s
|
|
1237
1237
|
}) => {
|
|
1238
|
-
const a =
|
|
1239
|
-
return
|
|
1240
|
-
|
|
1238
|
+
const a = G(), { title: r, body: d, actions: u, form: l, items: m } = t;
|
|
1239
|
+
return m ? /* @__PURE__ */ n(
|
|
1240
|
+
X,
|
|
1241
1241
|
{
|
|
1242
1242
|
className: "humany-message-content",
|
|
1243
1243
|
user: !!e,
|
|
1244
1244
|
stacked: s,
|
|
1245
|
-
children: /* @__PURE__ */ n(wt, { items:
|
|
1245
|
+
children: /* @__PURE__ */ n(wt, { items: m, dispatch: a })
|
|
1246
1246
|
}
|
|
1247
|
-
) : /* @__PURE__ */
|
|
1248
|
-
|
|
1247
|
+
) : /* @__PURE__ */ h(
|
|
1248
|
+
X,
|
|
1249
1249
|
{
|
|
1250
1250
|
className: "humany-message-content",
|
|
1251
1251
|
padded: !o,
|
|
1252
1252
|
user: !!e,
|
|
1253
1253
|
stacked: s,
|
|
1254
|
-
fullWidth: !!
|
|
1254
|
+
fullWidth: !!l || !!u,
|
|
1255
1255
|
children: [
|
|
1256
|
-
r && /* @__PURE__ */ n(
|
|
1257
|
-
|
|
1258
|
-
|
|
1256
|
+
r && /* @__PURE__ */ n(E, { children: /* @__PURE__ */ n(qe, { variant: "h2", children: r }) }),
|
|
1257
|
+
d && /* @__PURE__ */ n(E, { children: /* @__PURE__ */ n(Fe, { html: d }) }),
|
|
1258
|
+
l && /* @__PURE__ */ n(E, { children: /* @__PURE__ */ n(
|
|
1259
1259
|
_e,
|
|
1260
1260
|
{
|
|
1261
|
-
...
|
|
1262
|
-
onChange: (
|
|
1261
|
+
...l,
|
|
1262
|
+
onChange: (c, g) => {
|
|
1263
1263
|
a("form", {
|
|
1264
|
-
data:
|
|
1265
|
-
formKey:
|
|
1266
|
-
actionKey:
|
|
1264
|
+
data: g,
|
|
1265
|
+
formKey: l.schema.id,
|
|
1266
|
+
actionKey: c
|
|
1267
1267
|
});
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
1270
|
) }),
|
|
1271
|
-
|
|
1271
|
+
u && /* @__PURE__ */ n(E, { children: /* @__PURE__ */ n(
|
|
1272
1272
|
Ye,
|
|
1273
1273
|
{
|
|
1274
|
-
items: Object.keys(
|
|
1275
|
-
renderItem: (
|
|
1274
|
+
items: Object.keys(u).map((c) => ({ label: u[c], actionKey: c })),
|
|
1275
|
+
renderItem: (c) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
1276
1276
|
Xe,
|
|
1277
1277
|
{
|
|
1278
1278
|
onClick: () => {
|
|
1279
|
-
a("action",
|
|
1279
|
+
a("action", c.actionKey);
|
|
1280
1280
|
},
|
|
1281
|
-
children:
|
|
1281
|
+
children: c.label
|
|
1282
1282
|
}
|
|
1283
|
-
) },
|
|
1283
|
+
) }, c.actionKey)
|
|
1284
1284
|
}
|
|
1285
1285
|
) })
|
|
1286
1286
|
]
|
|
@@ -1295,8 +1295,8 @@ const Oe = ({ className: t }) => {
|
|
|
1295
1295
|
clip: rect(1px, 1px, 1px, 1px);
|
|
1296
1296
|
left: -10000000px;
|
|
1297
1297
|
top: auto;
|
|
1298
|
-
`,
|
|
1299
|
-
const { skipToLatestMessageLabel: t = "Skip to latest message" } = S(), e =
|
|
1298
|
+
`, Lt = () => {
|
|
1299
|
+
const { skipToLatestMessageLabel: t = "Skip to latest message" } = S(), e = I(), o = () => {
|
|
1300
1300
|
const s = e.get("widgetDOMElement");
|
|
1301
1301
|
if (s) {
|
|
1302
1302
|
const a = s.querySelectorAll(
|
|
@@ -1306,7 +1306,7 @@ const Oe = ({ className: t }) => {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
};
|
|
1308
1308
|
return /* @__PURE__ */ n(
|
|
1309
|
-
|
|
1309
|
+
zt,
|
|
1310
1310
|
{
|
|
1311
1311
|
className: "humany-skip-to-latest-message",
|
|
1312
1312
|
onKeyDown: (s) => {
|
|
@@ -1316,7 +1316,7 @@ const Oe = ({ className: t }) => {
|
|
|
1316
1316
|
children: t
|
|
1317
1317
|
}
|
|
1318
1318
|
);
|
|
1319
|
-
},
|
|
1319
|
+
}, zt = i.button`
|
|
1320
1320
|
position: absolute;
|
|
1321
1321
|
bottom: 60px;
|
|
1322
1322
|
text-align: center;
|
|
@@ -1334,53 +1334,61 @@ const Oe = ({ className: t }) => {
|
|
|
1334
1334
|
&:focus-visible {
|
|
1335
1335
|
left: 50%;
|
|
1336
1336
|
transform: translateX(-50%);
|
|
1337
|
-
${
|
|
1337
|
+
${b};
|
|
1338
1338
|
}
|
|
1339
|
-
`,
|
|
1340
|
-
const t =
|
|
1341
|
-
|
|
1342
|
-
|
|
1339
|
+
`, ye = () => {
|
|
1340
|
+
const t = I(), e = ue((m) => {
|
|
1341
|
+
m && setTimeout(() => {
|
|
1342
|
+
m.scrollIntoView({
|
|
1343
1343
|
block: "start",
|
|
1344
1344
|
behavior: "smooth"
|
|
1345
1345
|
});
|
|
1346
1346
|
}, 250);
|
|
1347
|
-
}, []), [
|
|
1348
|
-
messages:
|
|
1349
|
-
loading:
|
|
1350
|
-
typingActors:
|
|
1351
|
-
} = S(),
|
|
1352
|
-
|
|
1347
|
+
}, []), [o, s] = ie(!0), {
|
|
1348
|
+
messages: a,
|
|
1349
|
+
loading: r,
|
|
1350
|
+
typingActors: d = []
|
|
1351
|
+
} = S(), u = () => d && d.length ? d.map((m, y) => /* @__PURE__ */ n(
|
|
1352
|
+
_,
|
|
1353
1353
|
{
|
|
1354
|
-
id: `typing_${
|
|
1355
|
-
children: /* @__PURE__ */ n(
|
|
1354
|
+
id: `typing_${m.name}`,
|
|
1355
|
+
children: /* @__PURE__ */ n(fe, { timestamp: Date.now(), sender: m, children: /* @__PURE__ */ n(
|
|
1356
1356
|
ne,
|
|
1357
1357
|
{
|
|
1358
1358
|
boxed: !0,
|
|
1359
|
-
ref:
|
|
1359
|
+
ref: e
|
|
1360
1360
|
}
|
|
1361
1361
|
) })
|
|
1362
1362
|
},
|
|
1363
|
-
`typing_${
|
|
1364
|
-
)) : null;
|
|
1365
|
-
return
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1363
|
+
`typing_${m.name}`
|
|
1364
|
+
)) : null, l = de.useRef((a == null ? void 0 : a.length) || 0);
|
|
1365
|
+
return j(() => {
|
|
1366
|
+
const m = t.get("widgetDOMElement");
|
|
1367
|
+
if (m && m.id === "humany_bot") {
|
|
1368
|
+
const y = m.querySelectorAll(
|
|
1369
|
+
".humany-conversation-entry"
|
|
1370
|
+
);
|
|
1371
|
+
y.length && y.length > l.current && (l.current = y.length, y[y.length - 1].focus());
|
|
1372
|
+
}
|
|
1373
|
+
}), /* @__PURE__ */ h(N, { children: [
|
|
1374
|
+
/* @__PURE__ */ h(Nt, { tabIndex: 0, scrollableCss: o, ref: s, children: [
|
|
1375
|
+
a && a.length ? a.map((m, y) => {
|
|
1376
|
+
const { type: c, timestamp: g, sender: p, content: $ } = m;
|
|
1369
1377
|
return /* @__PURE__ */ n(
|
|
1370
|
-
|
|
1378
|
+
_,
|
|
1371
1379
|
{
|
|
1372
1380
|
className: "humany-conversation-entry",
|
|
1373
1381
|
tabIndex: -1,
|
|
1374
|
-
children: /* @__PURE__ */ n(Ct, { ...
|
|
1382
|
+
children: /* @__PURE__ */ n(Ct, { ...m, ref: e })
|
|
1375
1383
|
},
|
|
1376
|
-
`${
|
|
1384
|
+
`${c}_${p == null ? void 0 : p.name}_${g}_${$[0].key}`
|
|
1377
1385
|
);
|
|
1378
1386
|
}) : null,
|
|
1379
|
-
|
|
1380
|
-
|
|
1387
|
+
u(),
|
|
1388
|
+
r && /* @__PURE__ */ n(_, { children: /* @__PURE__ */ n(ne, { ref: e }) })
|
|
1381
1389
|
] }),
|
|
1382
1390
|
/* @__PURE__ */ n(Oe, {}),
|
|
1383
|
-
/* @__PURE__ */ n(
|
|
1391
|
+
/* @__PURE__ */ n(Lt, {})
|
|
1384
1392
|
] });
|
|
1385
1393
|
}, Nt = i.div`
|
|
1386
1394
|
display: flex;
|
|
@@ -1393,9 +1401,9 @@ const Oe = ({ className: t }) => {
|
|
|
1393
1401
|
}};
|
|
1394
1402
|
${(t) => !!t.scrollableCss && t.scrollableCss};
|
|
1395
1403
|
&:focus-visible {
|
|
1396
|
-
${(t) =>
|
|
1404
|
+
${(t) => b(t)};
|
|
1397
1405
|
}
|
|
1398
|
-
`,
|
|
1406
|
+
`, _ = i.div`
|
|
1399
1407
|
margin: 0;
|
|
1400
1408
|
margin-bottom: ${(t) => {
|
|
1401
1409
|
var e;
|
|
@@ -1429,21 +1437,21 @@ const Oe = ({ className: t }) => {
|
|
|
1429
1437
|
}
|
|
1430
1438
|
|
|
1431
1439
|
&:focus-visible {
|
|
1432
|
-
${
|
|
1440
|
+
${b}
|
|
1433
1441
|
border-radius: ${(t) => {
|
|
1434
1442
|
var e;
|
|
1435
1443
|
return (e = t.theme.sizes) == null ? void 0 : e.small;
|
|
1436
1444
|
}};
|
|
1437
1445
|
}
|
|
1438
|
-
${(t) =>
|
|
1446
|
+
${(t) => Z(t)(
|
|
1439
1447
|
"h1",
|
|
1440
|
-
|
|
1448
|
+
x`
|
|
1441
1449
|
font-weight: normal;
|
|
1442
1450
|
`
|
|
1443
1451
|
)}
|
|
1444
1452
|
`, Mt = ({ dispatch: t }) => {
|
|
1445
|
-
const e =
|
|
1446
|
-
return
|
|
1453
|
+
const e = me(null);
|
|
1454
|
+
return j(() => {
|
|
1447
1455
|
e.current && e.current.parentNode && t("overlay-mounted", e.current);
|
|
1448
1456
|
}, [e]), /* @__PURE__ */ n(
|
|
1449
1457
|
ce,
|
|
@@ -1453,17 +1461,17 @@ const Oe = ({ className: t }) => {
|
|
|
1453
1461
|
ref: e
|
|
1454
1462
|
}
|
|
1455
1463
|
);
|
|
1456
|
-
},
|
|
1464
|
+
}, At = ({
|
|
1457
1465
|
dispatch: t,
|
|
1458
1466
|
header: e,
|
|
1459
1467
|
buttonLabel: o
|
|
1460
|
-
}) => /* @__PURE__ */
|
|
1461
|
-
|
|
1468
|
+
}) => /* @__PURE__ */ h(
|
|
1469
|
+
It,
|
|
1462
1470
|
{
|
|
1463
1471
|
portalId: "humany-conversation-portal",
|
|
1464
1472
|
className: "humany-conversation-outlet",
|
|
1465
1473
|
children: [
|
|
1466
|
-
/* @__PURE__ */
|
|
1474
|
+
/* @__PURE__ */ h(Ht, { className: "humany-conversation-outlet-head", children: [
|
|
1467
1475
|
/* @__PURE__ */ n(
|
|
1468
1476
|
Ot,
|
|
1469
1477
|
{
|
|
@@ -1492,10 +1500,10 @@ const Oe = ({ className: t }) => {
|
|
|
1492
1500
|
}
|
|
1493
1501
|
)
|
|
1494
1502
|
] }),
|
|
1495
|
-
/* @__PURE__ */ n(
|
|
1503
|
+
/* @__PURE__ */ n(ye, {})
|
|
1496
1504
|
]
|
|
1497
1505
|
}
|
|
1498
|
-
),
|
|
1506
|
+
), It = i(ce)`
|
|
1499
1507
|
z-index: 11;
|
|
1500
1508
|
top: auto;
|
|
1501
1509
|
height: 65%;
|
|
@@ -1524,7 +1532,7 @@ const Oe = ({ className: t }) => {
|
|
|
1524
1532
|
return (e = t.theme.sizes) == null ? void 0 : e.normal;
|
|
1525
1533
|
}};
|
|
1526
1534
|
${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
|
|
1527
|
-
`, Tt = i(
|
|
1535
|
+
`, Tt = i(J)`
|
|
1528
1536
|
font-size: ${(t) => {
|
|
1529
1537
|
var e;
|
|
1530
1538
|
return (e = t.theme.fonts) == null ? void 0 : e.medium;
|
|
@@ -1534,7 +1542,7 @@ const Oe = ({ className: t }) => {
|
|
|
1534
1542
|
return (e = t.theme.colors) == null ? void 0 : e.text;
|
|
1535
1543
|
}};
|
|
1536
1544
|
margin: 0;
|
|
1537
|
-
`, Ot = i(
|
|
1545
|
+
`, Ot = i(A)`
|
|
1538
1546
|
display: flex;
|
|
1539
1547
|
align-items: center;
|
|
1540
1548
|
justify-content: center;
|
|
@@ -1548,7 +1556,7 @@ const Oe = ({ className: t }) => {
|
|
|
1548
1556
|
${(t) => t.theme.borderRadius && `border-radius: ${t.theme.borderRadius};`}
|
|
1549
1557
|
|
|
1550
1558
|
&:focus-visible {
|
|
1551
|
-
${
|
|
1559
|
+
${b};
|
|
1552
1560
|
}
|
|
1553
1561
|
|
|
1554
1562
|
svg line {
|
|
@@ -1563,30 +1571,30 @@ const Oe = ({ className: t }) => {
|
|
|
1563
1571
|
overlayConversationHeader: s,
|
|
1564
1572
|
overlayConversationCloseLabel: a,
|
|
1565
1573
|
conversationControllerId: r
|
|
1566
|
-
} = S(),
|
|
1574
|
+
} = S(), d = G(), l = I().get("$settings");
|
|
1567
1575
|
return /* @__PURE__ */ n(
|
|
1568
1576
|
ze.Provider,
|
|
1569
1577
|
{
|
|
1570
1578
|
value: r ? { id: r } : null,
|
|
1571
|
-
children: /* @__PURE__ */
|
|
1579
|
+
children: /* @__PURE__ */ h(ge.Provider, { value: l == null ? void 0 : l.language, children: [
|
|
1572
1580
|
/* @__PURE__ */ n(
|
|
1573
|
-
|
|
1581
|
+
Et,
|
|
1574
1582
|
{
|
|
1575
|
-
"aria-live": "
|
|
1583
|
+
"aria-live": "polite",
|
|
1576
1584
|
...e,
|
|
1577
|
-
className:
|
|
1585
|
+
className: H(
|
|
1578
1586
|
t,
|
|
1579
1587
|
"humany-conversation-component"
|
|
1580
1588
|
),
|
|
1581
|
-
children: /* @__PURE__ */ n(
|
|
1589
|
+
children: /* @__PURE__ */ n(ye, {})
|
|
1582
1590
|
}
|
|
1583
1591
|
),
|
|
1584
|
-
o && /* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */ n(Mt, { dispatch:
|
|
1592
|
+
o && /* @__PURE__ */ h(N, { children: [
|
|
1593
|
+
/* @__PURE__ */ n(Mt, { dispatch: d }),
|
|
1586
1594
|
o.conversation && /* @__PURE__ */ n(
|
|
1587
|
-
|
|
1595
|
+
At,
|
|
1588
1596
|
{
|
|
1589
|
-
dispatch:
|
|
1597
|
+
dispatch: d,
|
|
1590
1598
|
header: s,
|
|
1591
1599
|
buttonLabel: a
|
|
1592
1600
|
}
|
|
@@ -1595,7 +1603,7 @@ const Oe = ({ className: t }) => {
|
|
|
1595
1603
|
] })
|
|
1596
1604
|
}
|
|
1597
1605
|
);
|
|
1598
|
-
},
|
|
1606
|
+
}, Et = i.div`
|
|
1599
1607
|
position: absolute;
|
|
1600
1608
|
right: 0;
|
|
1601
1609
|
left: 0;
|