@telia-ace/widget-conversation 1.3.0 → 1.3.1
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,75 +1,75 @@
|
|
|
1
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
|
|
3
|
+
import { Input as se, borderTabStyle as p, Button as A, SymbolBadge as w, useIsTabbing as ae, useDispatch as G, useProperties as C, useScroll as ie, useContainer as I, Typography as J, invertedHoverButton as xe, Html as Q, List as le, buttonCss as R, 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
4
|
import { appendClassNames as H, htmlParentContains as Ne } from "@telia-ace/widget-utilities";
|
|
5
|
-
import { css as
|
|
5
|
+
import { css as v, keyframes as Me } from "@emotion/react";
|
|
6
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
|
|
8
|
+
import { ConversationMessageListItemType as S, 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,
|
|
14
|
-
inputPlaceholder:
|
|
15
|
-
inputHidden:
|
|
16
|
-
inputDisabled:
|
|
17
|
-
sendButtonLabel:
|
|
18
|
-
inputMultiline:
|
|
13
|
+
const [e, r] = q(""), [s, a] = q(0), [o, d] = q(0), m = ae(), c = G(), {
|
|
14
|
+
inputPlaceholder: f = "Type your message",
|
|
15
|
+
inputHidden: x = !1,
|
|
16
|
+
inputDisabled: l = !1,
|
|
17
|
+
sendButtonLabel: u = "Send message",
|
|
18
|
+
inputMultiline: b = !0,
|
|
19
19
|
secondaryAction: $
|
|
20
|
-
} =
|
|
20
|
+
} = C(), [k, y] = ie(!0), O = I();
|
|
21
21
|
j(() => {
|
|
22
|
-
if (
|
|
23
|
-
const { lineHeight:
|
|
24
|
-
if (
|
|
25
|
-
const T =
|
|
22
|
+
if (y.current) {
|
|
23
|
+
const { lineHeight: g, maxHeight: z } = getComputedStyle(y.current);
|
|
24
|
+
if (g && g.indexOf("px") > -1) {
|
|
25
|
+
const T = g.split("px"), $e = parseInt(T[0], 10);
|
|
26
26
|
a($e);
|
|
27
27
|
const ve = z.split("px");
|
|
28
28
|
d(parseInt(ve[0], 10));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
}, [
|
|
32
|
-
const P = (
|
|
33
|
-
!
|
|
34
|
-
}, pe = (
|
|
31
|
+
}, [y.current]);
|
|
32
|
+
const P = (g) => {
|
|
33
|
+
!g.shiftKey || !b ? (g.preventDefault(), e && e.length > 0 && (c("user-submit", { text: e }), r(""), W(""))) : e.length < 1 && g.preventDefault();
|
|
34
|
+
}, pe = (g) => {
|
|
35
35
|
if (!$)
|
|
36
36
|
return;
|
|
37
|
-
|
|
37
|
+
g.preventDefault(), c("action", {
|
|
38
38
|
actionKey: $.action,
|
|
39
39
|
...$
|
|
40
40
|
});
|
|
41
41
|
const { events: z } = O.get("$widget");
|
|
42
42
|
z.dispatch("tracking:secondary-clicked", {});
|
|
43
|
-
}, be = (
|
|
44
|
-
if (
|
|
45
|
-
const z =
|
|
43
|
+
}, be = (g) => {
|
|
44
|
+
if (b && y.current) {
|
|
45
|
+
const z = y.current.scrollHeight;
|
|
46
46
|
if (z > s) {
|
|
47
|
-
|
|
47
|
+
y.current.style.height = "auto";
|
|
48
48
|
let T = z;
|
|
49
|
-
|
|
49
|
+
g.length < 1 && (T = s), y.current.style.height = `${T}px`, T >= o ? y.current.style.overflowY = "scroll" : y.current.style.overflowY = "hidden";
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
}, W = (
|
|
53
|
-
be(
|
|
52
|
+
}, W = (g) => {
|
|
53
|
+
be(g), r(g), g && g.length > 0 && c("user-typing", { textLength: g.length });
|
|
54
54
|
};
|
|
55
|
-
return
|
|
55
|
+
return x ? null : /* @__PURE__ */ h(
|
|
56
56
|
Ke,
|
|
57
57
|
{
|
|
58
|
-
grow:
|
|
58
|
+
grow: b,
|
|
59
59
|
className: H("humany-conversation-input", t),
|
|
60
|
-
scrollableCss:
|
|
61
|
-
isTabbing:
|
|
60
|
+
scrollableCss: k,
|
|
61
|
+
isTabbing: m,
|
|
62
62
|
children: [
|
|
63
63
|
$ && /* @__PURE__ */ n(
|
|
64
|
-
|
|
64
|
+
Re,
|
|
65
65
|
{
|
|
66
66
|
className: "humany-secondary-button",
|
|
67
|
-
disabled:
|
|
67
|
+
disabled: l,
|
|
68
68
|
onClick: pe,
|
|
69
69
|
title: $.label,
|
|
70
70
|
"aria-label": $.label,
|
|
71
71
|
children: /* @__PURE__ */ n(
|
|
72
|
-
|
|
72
|
+
w,
|
|
73
73
|
{
|
|
74
74
|
size: 24,
|
|
75
75
|
symbol: { type: "Svg", content: $.icon || "browse" }
|
|
@@ -77,28 +77,28 @@ const Oe = ({ className: t }) => {
|
|
|
77
77
|
)
|
|
78
78
|
}
|
|
79
79
|
),
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
b ? /* @__PURE__ */ n(
|
|
81
|
+
Be,
|
|
82
82
|
{
|
|
83
83
|
value: e,
|
|
84
84
|
onChange: W,
|
|
85
85
|
onEnter: P,
|
|
86
|
-
disabled:
|
|
87
|
-
"aria-label":
|
|
88
|
-
placeholder:
|
|
86
|
+
disabled: l,
|
|
87
|
+
"aria-label": f,
|
|
88
|
+
placeholder: f,
|
|
89
89
|
type: "textarea",
|
|
90
90
|
rows: 1,
|
|
91
|
-
ref:
|
|
91
|
+
ref: y
|
|
92
92
|
}
|
|
93
93
|
) : /* @__PURE__ */ n(
|
|
94
|
-
|
|
94
|
+
Ee,
|
|
95
95
|
{
|
|
96
96
|
value: e,
|
|
97
97
|
onChange: W,
|
|
98
98
|
onEnter: P,
|
|
99
|
-
disabled:
|
|
100
|
-
"aria-label":
|
|
101
|
-
placeholder:
|
|
99
|
+
disabled: l,
|
|
100
|
+
"aria-label": f,
|
|
101
|
+
placeholder: f
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
104
|
/* @__PURE__ */ n(
|
|
@@ -107,8 +107,8 @@ const Oe = ({ className: t }) => {
|
|
|
107
107
|
className: "humany-send-button",
|
|
108
108
|
disabled: !1,
|
|
109
109
|
onClick: P,
|
|
110
|
-
title:
|
|
111
|
-
"aria-label":
|
|
110
|
+
title: u,
|
|
111
|
+
"aria-label": u,
|
|
112
112
|
children: /* @__PURE__ */ n(
|
|
113
113
|
De,
|
|
114
114
|
{
|
|
@@ -122,7 +122,7 @@ const Oe = ({ className: t }) => {
|
|
|
122
122
|
]
|
|
123
123
|
}
|
|
124
124
|
);
|
|
125
|
-
},
|
|
125
|
+
}, Be = 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
|
+
${p};
|
|
147
147
|
outline-offset: 12px;
|
|
148
148
|
}
|
|
149
|
-
`,
|
|
149
|
+
`, Ee = i(se)`
|
|
150
150
|
flex: 1;
|
|
151
151
|
border: none;
|
|
152
152
|
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
|
+
${p};
|
|
186
186
|
}
|
|
187
|
-
`,
|
|
187
|
+
`, Re = 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
193
|
`, Ke = i.div`
|
|
194
|
-
${(t) => t.grow ?
|
|
194
|
+
${(t) => t.grow ? v`
|
|
195
195
|
min-height: 50px;
|
|
196
196
|
max-height: 150px;
|
|
197
|
-
` :
|
|
197
|
+
` : v`
|
|
198
198
|
height: 50px;
|
|
199
199
|
`}
|
|
200
200
|
flex: 0 0 auto;
|
|
@@ -205,7 +205,7 @@ 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 && p}
|
|
209
209
|
textarea {
|
|
210
210
|
${(t) => !!t.scrollableCss && t.scrollableCss}
|
|
211
211
|
}
|
|
@@ -213,7 +213,7 @@ const Oe = ({ className: t }) => {
|
|
|
213
213
|
({
|
|
214
214
|
hasContent: t,
|
|
215
215
|
...e
|
|
216
|
-
}) => /* @__PURE__ */ n(
|
|
216
|
+
}) => /* @__PURE__ */ n(w, { ...e })
|
|
217
217
|
)`
|
|
218
218
|
line,
|
|
219
219
|
path {
|
|
@@ -343,13 +343,13 @@ const Oe = ({ className: t }) => {
|
|
|
343
343
|
${(t) => t.fullWidth && "width: 100%;"}
|
|
344
344
|
`, Ue = (t, e) => {
|
|
345
345
|
var s, a;
|
|
346
|
-
const
|
|
346
|
+
const r = v`
|
|
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 ?
|
|
352
|
-
${
|
|
351
|
+
return e.borderRadius ? v`
|
|
352
|
+
${r}
|
|
353
353
|
|
|
354
354
|
border-top-right-radius: ${e.borderRadius};
|
|
355
355
|
border-bottom-right-radius: ${e.borderRadius};
|
|
@@ -361,15 +361,15 @@ const Oe = ({ className: t }) => {
|
|
|
361
361
|
${t === "last" && `
|
|
362
362
|
border-bottom-left-radius: ${e.borderRadius};
|
|
363
363
|
`}
|
|
364
|
-
` :
|
|
364
|
+
` : r;
|
|
365
365
|
}, Ve = (t, e) => {
|
|
366
366
|
var s, a;
|
|
367
|
-
const
|
|
367
|
+
const r = v`
|
|
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 ?
|
|
372
|
-
${
|
|
371
|
+
return e.borderRadius ? v`
|
|
372
|
+
${r}
|
|
373
373
|
|
|
374
374
|
border-top-left-radius: ${e.borderRadius};
|
|
375
375
|
border-bottom-left-radius: ${e.borderRadius};
|
|
@@ -381,8 +381,8 @@ const Oe = ({ className: t }) => {
|
|
|
381
381
|
${t === "last" && `
|
|
382
382
|
border-bottom-right-radius: ${e.borderRadius};
|
|
383
383
|
`}
|
|
384
|
-
` :
|
|
385
|
-
},
|
|
384
|
+
` : r;
|
|
385
|
+
}, B = i.div`
|
|
386
386
|
margin-bottom: ${(t) => {
|
|
387
387
|
var e;
|
|
388
388
|
return (e = t.theme.sizes) == null ? void 0 : e.normal;
|
|
@@ -390,17 +390,17 @@ const Oe = ({ className: t }) => {
|
|
|
390
390
|
&:last-child {
|
|
391
391
|
margin-bottom: 0;
|
|
392
392
|
}
|
|
393
|
-
`,
|
|
394
|
-
var e,
|
|
395
|
-
return
|
|
393
|
+
`, L = (t) => {
|
|
394
|
+
var e, r;
|
|
395
|
+
return v`
|
|
396
396
|
margin: ${(e = t.theme.sizes) == null ? void 0 : e.medium} 0;
|
|
397
|
-
padding: 0 ${(
|
|
397
|
+
padding: 0 ${(r = t.theme.sizes) == null ? void 0 : r.medium};
|
|
398
398
|
`;
|
|
399
399
|
}, _e = i(Te)`
|
|
400
400
|
& button.humany-form-component-button {
|
|
401
401
|
${(t) => {
|
|
402
|
-
var e,
|
|
403
|
-
return ((e = t.theme.colors) == null ? void 0 : e.primary) && ((
|
|
402
|
+
var e, r, s, a;
|
|
403
|
+
return ((e = t.theme.colors) == null ? void 0 : e.primary) && ((r = t.theme.colors) == null ? void 0 : r.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,
|
|
@@ -431,7 +431,7 @@ const Oe = ({ className: t }) => {
|
|
|
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) && p;
|
|
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) => R(t)};
|
|
453
453
|
display: block;
|
|
454
454
|
background-color: ${(t) => {
|
|
455
455
|
var e;
|
|
@@ -458,11 +458,11 @@ const Oe = ({ className: t }) => {
|
|
|
458
458
|
width: 100%;
|
|
459
459
|
color: #fff;
|
|
460
460
|
&:focus-visible {
|
|
461
|
-
${
|
|
461
|
+
${p}
|
|
462
462
|
background-color: transparent;
|
|
463
463
|
}
|
|
464
464
|
`, ne = ee(
|
|
465
|
-
({ boxed: t, className: e, agentData:
|
|
465
|
+
({ boxed: t, className: e, agentData: r }, s) => /* @__PURE__ */ n(F, { ref: s, children: /* @__PURE__ */ n(Y, { left: t, center: !t, children: /* @__PURE__ */ n(
|
|
466
466
|
X,
|
|
467
467
|
{
|
|
468
468
|
padded: !!t,
|
|
@@ -489,27 +489,27 @@ const Oe = ({ className: t }) => {
|
|
|
489
489
|
var e;
|
|
490
490
|
return (e = t.theme.colors) == null ? void 0 : e.text;
|
|
491
491
|
}};
|
|
492
|
-
`,
|
|
492
|
+
`, oe = (t, e) => new Date(t).toLocaleTimeString(e || [], {
|
|
493
493
|
hour: "numeric",
|
|
494
494
|
minute: "2-digit"
|
|
495
495
|
}), M = ({
|
|
496
496
|
className: t,
|
|
497
497
|
name: e,
|
|
498
|
-
timestamp:
|
|
498
|
+
timestamp: r,
|
|
499
499
|
ariaHidden: s = !1
|
|
500
500
|
}) => {
|
|
501
501
|
const a = Ae(ge);
|
|
502
|
-
if (!e && !
|
|
502
|
+
if (!e && !r)
|
|
503
503
|
return null;
|
|
504
|
-
let
|
|
505
|
-
return e ?
|
|
504
|
+
let o = "";
|
|
505
|
+
return e ? r ? o = `${e}: ${oe(r, a)}` : o = e : r && (o = oe(r, a)), /* @__PURE__ */ n(Ge, { "aria-hidden": s, children: o });
|
|
506
506
|
}, fe = ({
|
|
507
507
|
className: t,
|
|
508
508
|
children: e,
|
|
509
|
-
sender:
|
|
509
|
+
sender: r,
|
|
510
510
|
timestamp: s
|
|
511
511
|
}) => {
|
|
512
|
-
const { avatar: a, name:
|
|
512
|
+
const { avatar: a, name: o } = r, { avatarSize: d, avatarLabel: m = "Avatar" } = C();
|
|
513
513
|
return /* @__PURE__ */ h(
|
|
514
514
|
Je,
|
|
515
515
|
{
|
|
@@ -521,13 +521,13 @@ const Oe = ({ className: t }) => {
|
|
|
521
521
|
children: [
|
|
522
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, alt:
|
|
525
|
-
) : /* @__PURE__ */ n(
|
|
524
|
+
/* @__PURE__ */ n("img", { src: a, alt: m })
|
|
525
|
+
) : /* @__PURE__ */ n(w, { symbol: a }) }),
|
|
526
526
|
e,
|
|
527
527
|
/* @__PURE__ */ n(
|
|
528
528
|
M,
|
|
529
529
|
{
|
|
530
|
-
name:
|
|
530
|
+
name: o,
|
|
531
531
|
timestamp: s,
|
|
532
532
|
ariaHidden: !0
|
|
533
533
|
}
|
|
@@ -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 ? v`
|
|
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
|
+
` : v`
|
|
549
549
|
grid-template-columns: 1fr;
|
|
550
550
|
grid-template-rows: 1fr auto;
|
|
551
551
|
grid-template-areas:
|
|
@@ -553,10 +553,10 @@ const Oe = ({ className: t }) => {
|
|
|
553
553
|
'info';
|
|
554
554
|
`};
|
|
555
555
|
`, Qe = ee(
|
|
556
|
-
({ className: t, children: e, timestamp:
|
|
556
|
+
({ className: t, children: e, timestamp: r, discrete: s, fullWidth: a }, o) => /* @__PURE__ */ n(
|
|
557
557
|
Ze,
|
|
558
558
|
{
|
|
559
|
-
ref:
|
|
559
|
+
ref: o,
|
|
560
560
|
className: H(
|
|
561
561
|
t,
|
|
562
562
|
"humany-conversation-system-message"
|
|
@@ -564,10 +564,10 @@ const Oe = ({ className: t }) => {
|
|
|
564
564
|
fullWidth: a,
|
|
565
565
|
children: s ? /* @__PURE__ */ h(et, { className: "humany-conversation-discrete-message", children: [
|
|
566
566
|
e,
|
|
567
|
-
/* @__PURE__ */ n(M, { timestamp:
|
|
567
|
+
/* @__PURE__ */ n(M, { timestamp: r })
|
|
568
568
|
] }) : /* @__PURE__ */ h(N, { children: [
|
|
569
569
|
e,
|
|
570
|
-
/* @__PURE__ */ n(M, { timestamp:
|
|
570
|
+
/* @__PURE__ */ n(M, { timestamp: r })
|
|
571
571
|
] })
|
|
572
572
|
}
|
|
573
573
|
)
|
|
@@ -592,8 +592,8 @@ const Oe = ({ className: t }) => {
|
|
|
592
592
|
> p {
|
|
593
593
|
margin: 0;
|
|
594
594
|
}
|
|
595
|
-
`, tt = ({ className: t, children: e, timestamp:
|
|
596
|
-
const { userLabel: s = "" } =
|
|
595
|
+
`, tt = ({ className: t, children: e, timestamp: r }) => {
|
|
596
|
+
const { userLabel: s = "" } = C();
|
|
597
597
|
return /* @__PURE__ */ h(
|
|
598
598
|
nt,
|
|
599
599
|
{
|
|
@@ -607,7 +607,7 @@ const Oe = ({ className: t }) => {
|
|
|
607
607
|
M,
|
|
608
608
|
{
|
|
609
609
|
name: s,
|
|
610
|
-
timestamp:
|
|
610
|
+
timestamp: r,
|
|
611
611
|
ariaHidden: !0
|
|
612
612
|
}
|
|
613
613
|
)
|
|
@@ -623,47 +623,47 @@ const Oe = ({ className: t }) => {
|
|
|
623
623
|
`, te = (t) => Array.isArray(t) ? t : Object.keys(t).map((e) => ({
|
|
624
624
|
label: t[e],
|
|
625
625
|
actionKey: e
|
|
626
|
-
})),
|
|
626
|
+
})), ot = ({ header: t, actions: e, dispatch: r }) => {
|
|
627
627
|
const s = I(), { events: a } = s.get("$widget");
|
|
628
628
|
return /* @__PURE__ */ n(
|
|
629
|
-
|
|
629
|
+
rt,
|
|
630
630
|
{
|
|
631
631
|
className: "humany-conversation-button-list",
|
|
632
632
|
header: t,
|
|
633
633
|
items: te(e),
|
|
634
|
-
renderItem: (
|
|
635
|
-
var
|
|
636
|
-
const d = !!((
|
|
634
|
+
renderItem: (o) => {
|
|
635
|
+
var m;
|
|
636
|
+
const d = !!((m = o == null ? void 0 : o.data) != null && m.href);
|
|
637
637
|
return /* @__PURE__ */ n("li", { children: d ? /* @__PURE__ */ h(
|
|
638
638
|
st,
|
|
639
639
|
{
|
|
640
|
-
href:
|
|
641
|
-
target:
|
|
642
|
-
"aria-label":
|
|
643
|
-
title:
|
|
640
|
+
href: o.data.href,
|
|
641
|
+
target: o.data.target,
|
|
642
|
+
"aria-label": o.label,
|
|
643
|
+
title: o.label,
|
|
644
644
|
children: [
|
|
645
|
-
/* @__PURE__ */ n(
|
|
646
|
-
|
|
645
|
+
/* @__PURE__ */ n(w, { symbol: o.symbol }),
|
|
646
|
+
o.label
|
|
647
647
|
]
|
|
648
648
|
}
|
|
649
649
|
) : /* @__PURE__ */ h(
|
|
650
650
|
at,
|
|
651
651
|
{
|
|
652
652
|
onClick: () => {
|
|
653
|
-
|
|
653
|
+
r("action", o), a.dispatch("tracking:button-list-item-clicked", o);
|
|
654
654
|
},
|
|
655
|
-
"aria-label":
|
|
656
|
-
title:
|
|
655
|
+
"aria-label": o.label,
|
|
656
|
+
title: o.label,
|
|
657
657
|
children: [
|
|
658
|
-
/* @__PURE__ */ n(
|
|
659
|
-
|
|
658
|
+
/* @__PURE__ */ n(w, { symbol: o.symbol }),
|
|
659
|
+
o.label
|
|
660
660
|
]
|
|
661
661
|
}
|
|
662
|
-
) },
|
|
662
|
+
) }, o.actionKey);
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
);
|
|
666
|
-
},
|
|
666
|
+
}, rt = i(K)`
|
|
667
667
|
${D}
|
|
668
668
|
> ul {
|
|
669
669
|
display: flex;
|
|
@@ -676,9 +676,9 @@ const Oe = ({ className: t }) => {
|
|
|
676
676
|
margin: 0;
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
|
-
${
|
|
679
|
+
${L}
|
|
680
680
|
`, st = i(ke)`
|
|
681
|
-
${
|
|
681
|
+
${R};
|
|
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
|
+
${p}
|
|
698
698
|
background-color: transparent;
|
|
699
699
|
}
|
|
700
700
|
|
|
@@ -706,7 +706,7 @@ const Oe = ({ className: t }) => {
|
|
|
706
706
|
}};
|
|
707
707
|
}
|
|
708
708
|
`, at = i(A)`
|
|
709
|
-
${
|
|
709
|
+
${R};
|
|
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
|
+
${p}
|
|
726
726
|
background-color: transparent;
|
|
727
727
|
}
|
|
728
728
|
|
|
@@ -734,23 +734,23 @@ const Oe = ({ className: t }) => {
|
|
|
734
734
|
}};
|
|
735
735
|
}
|
|
736
736
|
`, it = ({ type: t, content: e = {} }) => {
|
|
737
|
-
const
|
|
738
|
-
return !
|
|
737
|
+
const r = we(t);
|
|
738
|
+
return !r || !t ? null : /* @__PURE__ */ n(Ie, { fallback: null, children: /* @__PURE__ */ n(r, { ...e }) });
|
|
739
739
|
}, lt = ({ body: t }) => /* @__PURE__ */ n(ct, { className: "humany-html", html: t }), ct = i(Q)`
|
|
740
740
|
${Se}
|
|
741
741
|
color: inherit;
|
|
742
742
|
white-space: normal;
|
|
743
|
-
${
|
|
743
|
+
${L}
|
|
744
744
|
a {
|
|
745
745
|
color: ${(t) => t.theme.colors.link};
|
|
746
746
|
&:focus-visible {
|
|
747
|
-
${
|
|
747
|
+
${p};
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
750
|
p {
|
|
751
751
|
word-break: auto-phrase;
|
|
752
752
|
}
|
|
753
|
-
`, dt = ({ header: t, actions: e, dispatch:
|
|
753
|
+
`, dt = ({ header: t, actions: e, dispatch: r }) => /* @__PURE__ */ n(
|
|
754
754
|
mt,
|
|
755
755
|
{
|
|
756
756
|
className: "humany-conversation-item-list",
|
|
@@ -760,7 +760,7 @@ const Oe = ({ className: t }) => {
|
|
|
760
760
|
var a;
|
|
761
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
|
+
w,
|
|
764
764
|
{
|
|
765
765
|
size: 22,
|
|
766
766
|
symbol: {
|
|
@@ -774,7 +774,7 @@ const Oe = ({ className: t }) => {
|
|
|
774
774
|
A,
|
|
775
775
|
{
|
|
776
776
|
onClick: () => {
|
|
777
|
-
|
|
777
|
+
r("action", s);
|
|
778
778
|
},
|
|
779
779
|
"aria-label": s.label,
|
|
780
780
|
title: s.label,
|
|
@@ -790,7 +790,7 @@ const Oe = ({ className: t }) => {
|
|
|
790
790
|
${D}
|
|
791
791
|
|
|
792
792
|
> .humany-paragraph {
|
|
793
|
-
${
|
|
793
|
+
${L}
|
|
794
794
|
margin-bottom: 0;
|
|
795
795
|
|
|
796
796
|
h1 {
|
|
@@ -800,7 +800,7 @@ const Oe = ({ className: t }) => {
|
|
|
800
800
|
|
|
801
801
|
${(t) => Z(t)(
|
|
802
802
|
"h1",
|
|
803
|
-
|
|
803
|
+
v`
|
|
804
804
|
white-space: normal;
|
|
805
805
|
`
|
|
806
806
|
)}
|
|
@@ -830,7 +830,7 @@ const Oe = ({ className: t }) => {
|
|
|
830
830
|
var e;
|
|
831
831
|
return (e = t.theme.sizes) == null ? void 0 : e.medium;
|
|
832
832
|
}};
|
|
833
|
-
${
|
|
833
|
+
${L}
|
|
834
834
|
|
|
835
835
|
.item-icon {
|
|
836
836
|
}
|
|
@@ -863,7 +863,7 @@ const Oe = ({ className: t }) => {
|
|
|
863
863
|
margin: 0;
|
|
864
864
|
|
|
865
865
|
&:focus-visible {
|
|
866
|
-
${
|
|
866
|
+
${p}
|
|
867
867
|
span {
|
|
868
868
|
color: ${(t) => {
|
|
869
869
|
var e;
|
|
@@ -873,32 +873,32 @@ const Oe = ({ className: t }) => {
|
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
}
|
|
876
|
-
`, ht = ({ header: t, actions: e, dispatch:
|
|
877
|
-
const s = Ce(e), a = me(),
|
|
876
|
+
`, ht = ({ header: t, actions: e, dispatch: r }) => {
|
|
877
|
+
const s = Ce(e), a = me(), o = ae(), d = I(), { events: m } = d.get("$widget");
|
|
878
878
|
return j(() => {
|
|
879
879
|
if (s && Array.isArray(e) && Array.isArray(s) && s.length < e.length && a.current) {
|
|
880
|
-
const
|
|
880
|
+
const c = a.current.querySelectorAll(
|
|
881
881
|
".humany-conversation-link-list > ul > li"
|
|
882
|
-
),
|
|
883
|
-
if (
|
|
884
|
-
const
|
|
885
|
-
if (
|
|
886
|
-
const
|
|
882
|
+
), f = c[s.length];
|
|
883
|
+
if (c.length === e.length && s.length) {
|
|
884
|
+
const x = c[s.length - 1];
|
|
885
|
+
if (x) {
|
|
886
|
+
const l = x.querySelector(
|
|
887
887
|
".humany-button"
|
|
888
888
|
);
|
|
889
|
-
|
|
889
|
+
l && l.focus();
|
|
890
890
|
}
|
|
891
891
|
} else
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
if (
|
|
892
|
+
f && new MutationObserver((l, u) => {
|
|
893
|
+
l.forEach((b) => {
|
|
894
|
+
if (b.addedNodes) {
|
|
895
895
|
const $ = Array.from(
|
|
896
|
-
|
|
897
|
-
).find((
|
|
898
|
-
$ && Ne(a.current, document.activeElement) && (
|
|
896
|
+
b.addedNodes
|
|
897
|
+
).find((k) => k.tagName === "BUTTON");
|
|
898
|
+
$ && Ne(a.current, document.activeElement) && (o && $.focus(), u.disconnect());
|
|
899
899
|
}
|
|
900
900
|
});
|
|
901
|
-
}).observe(
|
|
901
|
+
}).observe(f, {
|
|
902
902
|
attributes: !1,
|
|
903
903
|
characterData: !1,
|
|
904
904
|
childList: !0,
|
|
@@ -914,19 +914,19 @@ const Oe = ({ className: t }) => {
|
|
|
914
914
|
className: "humany-conversation-link-list",
|
|
915
915
|
header: t,
|
|
916
916
|
items: te(e),
|
|
917
|
-
renderItem: (
|
|
917
|
+
renderItem: (c) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ h(
|
|
918
918
|
ft,
|
|
919
919
|
{
|
|
920
|
-
help:
|
|
920
|
+
help: c.actionKey === "help",
|
|
921
921
|
onClick: () => {
|
|
922
|
-
|
|
922
|
+
r("action", c), m.dispatch("tracking:link-list-item-clicked", c);
|
|
923
923
|
},
|
|
924
|
-
"aria-label":
|
|
925
|
-
title:
|
|
924
|
+
"aria-label": c.label,
|
|
925
|
+
title: c.label,
|
|
926
926
|
children: [
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
927
|
+
c.label,
|
|
928
|
+
c.actionKey === "help" && /* @__PURE__ */ n(
|
|
929
|
+
w,
|
|
930
930
|
{
|
|
931
931
|
size: 14,
|
|
932
932
|
symbol: {
|
|
@@ -937,16 +937,16 @@ const Oe = ({ className: t }) => {
|
|
|
937
937
|
)
|
|
938
938
|
]
|
|
939
939
|
}
|
|
940
|
-
) },
|
|
940
|
+
) }, c.actionKey)
|
|
941
941
|
}
|
|
942
942
|
);
|
|
943
943
|
}, gt = i(K)`
|
|
944
944
|
${D}
|
|
945
|
-
${
|
|
945
|
+
${L}
|
|
946
946
|
|
|
947
947
|
${(t) => Z(t)(
|
|
948
948
|
"h1",
|
|
949
|
-
|
|
949
|
+
v`
|
|
950
950
|
white-space: normal;
|
|
951
951
|
`
|
|
952
952
|
)}
|
|
@@ -975,20 +975,20 @@ const Oe = ({ className: t }) => {
|
|
|
975
975
|
overflow: hidden;
|
|
976
976
|
|
|
977
977
|
${(t) => {
|
|
978
|
-
var e,
|
|
979
|
-
return t.help &&
|
|
978
|
+
var e, r;
|
|
979
|
+
return t.help && v`
|
|
980
980
|
color: ${(e = t.theme.colors) == null ? void 0 : e.text};
|
|
981
981
|
text-decoration: underline;
|
|
982
982
|
|
|
983
983
|
i,
|
|
984
984
|
svg {
|
|
985
|
-
margin-left: ${(
|
|
985
|
+
margin-left: ${(r = t.theme.sizes) == null ? void 0 : r.small};
|
|
986
986
|
}
|
|
987
987
|
`;
|
|
988
988
|
}}
|
|
989
989
|
|
|
990
990
|
&:focus-visible {
|
|
991
|
-
${
|
|
991
|
+
${p}
|
|
992
992
|
span {
|
|
993
993
|
color: ${(t) => {
|
|
994
994
|
var e;
|
|
@@ -1001,11 +1001,11 @@ const Oe = ({ className: t }) => {
|
|
|
1001
1001
|
${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
|
|
1002
1002
|
width: 100%;
|
|
1003
1003
|
`, bt = ({ text: t }) => /* @__PURE__ */ n($t, { className: "humany-conversation-text", variant: "span", children: t }), $t = i(J)`
|
|
1004
|
-
${
|
|
1004
|
+
${L}
|
|
1005
1005
|
`, vt = ({
|
|
1006
1006
|
header: t = "Video call",
|
|
1007
1007
|
acceptLabel: e = "Accept",
|
|
1008
|
-
declineLabel:
|
|
1008
|
+
declineLabel: r = "Decline",
|
|
1009
1009
|
dispatch: s
|
|
1010
1010
|
}) => {
|
|
1011
1011
|
const a = He(() => [
|
|
@@ -1018,34 +1018,34 @@ const Oe = ({ className: t }) => {
|
|
|
1018
1018
|
}
|
|
1019
1019
|
},
|
|
1020
1020
|
{
|
|
1021
|
-
label:
|
|
1021
|
+
label: r,
|
|
1022
1022
|
actionKey: "decline-video-call",
|
|
1023
1023
|
symbol: {
|
|
1024
1024
|
type: "Svg",
|
|
1025
1025
|
content: "close"
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
|
-
], [e,
|
|
1028
|
+
], [e, r]);
|
|
1029
1029
|
return /* @__PURE__ */ n(
|
|
1030
1030
|
xt,
|
|
1031
1031
|
{
|
|
1032
1032
|
className: "humany-conversation-video-request",
|
|
1033
1033
|
header: t,
|
|
1034
1034
|
items: a,
|
|
1035
|
-
renderItem: (
|
|
1036
|
-
const d =
|
|
1035
|
+
renderItem: (o) => {
|
|
1036
|
+
const d = o.actionKey === "accept-video-call" ? "#70c48e" : "#da5c85";
|
|
1037
1037
|
return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
1038
1038
|
kt,
|
|
1039
1039
|
{
|
|
1040
1040
|
onClick: () => {
|
|
1041
|
-
s("action",
|
|
1041
|
+
s("action", o);
|
|
1042
1042
|
},
|
|
1043
|
-
"aria-label":
|
|
1044
|
-
title:
|
|
1043
|
+
"aria-label": o.label,
|
|
1044
|
+
title: o.label,
|
|
1045
1045
|
bgColor: d,
|
|
1046
|
-
children: /* @__PURE__ */ n(
|
|
1046
|
+
children: /* @__PURE__ */ n(w, { symbol: o.symbol, size: 25 })
|
|
1047
1047
|
}
|
|
1048
|
-
) },
|
|
1048
|
+
) }, o.actionKey);
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
1051
|
);
|
|
@@ -1062,9 +1062,9 @@ const Oe = ({ className: t }) => {
|
|
|
1062
1062
|
margin: 0;
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
|
-
${(t) =>
|
|
1065
|
+
${(t) => L(t)}
|
|
1066
1066
|
`, kt = i(A)`
|
|
1067
|
-
${
|
|
1067
|
+
${R};
|
|
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
|
+
${p}
|
|
1080
1080
|
background-color: transparent;
|
|
1081
1081
|
|
|
1082
1082
|
i,
|
|
@@ -1103,43 +1103,43 @@ const Oe = ({ className: t }) => {
|
|
|
1103
1103
|
stroke: #fff;
|
|
1104
1104
|
}
|
|
1105
1105
|
}
|
|
1106
|
-
`,
|
|
1107
|
-
const
|
|
1108
|
-
return !!t.map(
|
|
1109
|
-
const d =
|
|
1110
|
-
return !!(
|
|
1111
|
-
}).length &&
|
|
1112
|
-
var
|
|
1113
|
-
const d =
|
|
1114
|
-
return !!((
|
|
1115
|
-
}).length &&
|
|
1106
|
+
`, E = ([t, e]) => ({ type: t, content: e }), wt = ({ items: t, dispatch: e }) => {
|
|
1107
|
+
const r = t.map(E).filter((o) => o.type.includes("ace-knowledge")).map((o) => "humany-" + o.type.toString());
|
|
1108
|
+
return !!t.map(E).filter((o) => {
|
|
1109
|
+
const d = o == null ? void 0 : o.content, m = d == null ? void 0 : d.actions;
|
|
1110
|
+
return !!(m != null && m.filter((c) => c.actionKey === "contact").length);
|
|
1111
|
+
}).length && r.push("humany-secondary-action-list"), !!t.map(E).filter((o) => {
|
|
1112
|
+
var m;
|
|
1113
|
+
const d = o == null ? void 0 : o.content;
|
|
1114
|
+
return !!((m = d == null ? void 0 : d.tags) != null && m.includes("category"));
|
|
1115
|
+
}).length && r.push("humany-category-list"), /* @__PURE__ */ n(
|
|
1116
1116
|
St,
|
|
1117
1117
|
{
|
|
1118
1118
|
role: "none",
|
|
1119
1119
|
className: H(
|
|
1120
1120
|
"humany-message-list",
|
|
1121
|
-
|
|
1121
|
+
r.join(" ")
|
|
1122
1122
|
),
|
|
1123
|
-
items: t.map(
|
|
1123
|
+
items: t.map(E),
|
|
1124
1124
|
renderLi: !0,
|
|
1125
|
-
renderItem: (
|
|
1126
|
-
switch (
|
|
1127
|
-
case
|
|
1128
|
-
return /* @__PURE__ */ n(bt, { text:
|
|
1129
|
-
case
|
|
1130
|
-
return /* @__PURE__ */ n(lt, { ...
|
|
1131
|
-
case
|
|
1132
|
-
return /* @__PURE__ */ n(yt, { ...
|
|
1133
|
-
case
|
|
1134
|
-
return /* @__PURE__ */ n(dt, { ...
|
|
1135
|
-
case
|
|
1136
|
-
return /* @__PURE__ */ n(ht, { ...
|
|
1137
|
-
case
|
|
1138
|
-
return /* @__PURE__ */ n(
|
|
1139
|
-
case
|
|
1140
|
-
return /* @__PURE__ */ n(vt, { ...
|
|
1125
|
+
renderItem: (o) => {
|
|
1126
|
+
switch (o.type) {
|
|
1127
|
+
case S.Text:
|
|
1128
|
+
return /* @__PURE__ */ n(bt, { text: o.content });
|
|
1129
|
+
case S.HTML:
|
|
1130
|
+
return /* @__PURE__ */ n(lt, { ...o.content });
|
|
1131
|
+
case S.Separator:
|
|
1132
|
+
return /* @__PURE__ */ n(yt, { ...o.content });
|
|
1133
|
+
case S.ItemList:
|
|
1134
|
+
return /* @__PURE__ */ n(dt, { ...o.content, dispatch: e });
|
|
1135
|
+
case S.LinkList:
|
|
1136
|
+
return /* @__PURE__ */ n(ht, { ...o.content, dispatch: e });
|
|
1137
|
+
case S.ButtonList:
|
|
1138
|
+
return /* @__PURE__ */ n(ot, { ...o.content, dispatch: e });
|
|
1139
|
+
case S.VideoRequest:
|
|
1140
|
+
return /* @__PURE__ */ n(vt, { ...o.content, dispatch: e });
|
|
1141
1141
|
default:
|
|
1142
|
-
return /* @__PURE__ */ n(it, { type:
|
|
1142
|
+
return /* @__PURE__ */ n(it, { type: o.type, content: o.content });
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
@@ -1151,80 +1151,80 @@ const Oe = ({ className: t }) => {
|
|
|
1151
1151
|
margin: 0;
|
|
1152
1152
|
}
|
|
1153
1153
|
`, Ct = ee(
|
|
1154
|
-
({ className: t, timestamp: e, sender:
|
|
1154
|
+
({ className: t, timestamp: e, sender: r, type: s, content: a }, o) => {
|
|
1155
1155
|
const d = ue(
|
|
1156
|
-
(
|
|
1157
|
-
let
|
|
1158
|
-
return a.length > 1 && (
|
|
1156
|
+
(l) => {
|
|
1157
|
+
let u = "first";
|
|
1158
|
+
return a.length > 1 && (u = l === 0 ? "first" : l + 1 === a.length ? "last" : "middle"), u;
|
|
1159
1159
|
},
|
|
1160
1160
|
[a]
|
|
1161
|
-
), { userLabel:
|
|
1162
|
-
const { key:
|
|
1161
|
+
), { userLabel: m = "" } = C(), c = () => /* @__PURE__ */ n(N, { children: a.map((l) => {
|
|
1162
|
+
const { key: u, body: b, title: $, form: k, actions: y } = l, O = !!b && !$ && !k && !y;
|
|
1163
1163
|
return /* @__PURE__ */ n(
|
|
1164
1164
|
Qe,
|
|
1165
1165
|
{
|
|
1166
1166
|
className: t,
|
|
1167
1167
|
discrete: O,
|
|
1168
|
-
ref:
|
|
1168
|
+
ref: o,
|
|
1169
1169
|
timestamp: e,
|
|
1170
|
-
fullWidth: !!
|
|
1171
|
-
children: O &&
|
|
1170
|
+
fullWidth: !!k || !!y,
|
|
1171
|
+
children: O && b ? /* @__PURE__ */ n(Q, { html: b }) : /* @__PURE__ */ n(V, { isSystem: !0, content: l })
|
|
1172
1172
|
},
|
|
1173
|
-
|
|
1173
|
+
u
|
|
1174
1174
|
);
|
|
1175
|
-
}) }),
|
|
1176
|
-
/* @__PURE__ */ n(
|
|
1175
|
+
}) }), f = () => /* @__PURE__ */ h(N, { children: [
|
|
1176
|
+
/* @__PURE__ */ n(re, { className: "humany-sr-only", children: /* @__PURE__ */ n(M, { name: r == null ? void 0 : r.name, timestamp: e }) }),
|
|
1177
1177
|
/* @__PURE__ */ n(
|
|
1178
1178
|
fe,
|
|
1179
1179
|
{
|
|
1180
|
-
sender:
|
|
1180
|
+
sender: r,
|
|
1181
1181
|
timestamp: e,
|
|
1182
1182
|
className: t,
|
|
1183
|
-
children: /* @__PURE__ */ n(F, { className: "humany-message-content-bundle", children: a.map((
|
|
1183
|
+
children: /* @__PURE__ */ n(F, { className: "humany-message-content-bundle", children: a.map((l, u) => /* @__PURE__ */ n(
|
|
1184
1184
|
Y,
|
|
1185
1185
|
{
|
|
1186
1186
|
className: "humany-message-container",
|
|
1187
1187
|
left: !0,
|
|
1188
|
-
ref:
|
|
1188
|
+
ref: o,
|
|
1189
1189
|
children: /* @__PURE__ */ n(
|
|
1190
1190
|
V,
|
|
1191
1191
|
{
|
|
1192
|
-
content:
|
|
1193
|
-
stacked: d(
|
|
1192
|
+
content: l,
|
|
1193
|
+
stacked: d(u)
|
|
1194
1194
|
}
|
|
1195
1195
|
)
|
|
1196
1196
|
},
|
|
1197
|
-
|
|
1197
|
+
l.key
|
|
1198
1198
|
)) })
|
|
1199
1199
|
}
|
|
1200
1200
|
)
|
|
1201
|
-
] }),
|
|
1202
|
-
/* @__PURE__ */ n(
|
|
1203
|
-
/* @__PURE__ */ n(tt, { timestamp: e, className: t, children: /* @__PURE__ */ n(F, { className: "humany-message-content-bundle", children: a.map((
|
|
1201
|
+
] }), x = () => /* @__PURE__ */ h(N, { children: [
|
|
1202
|
+
/* @__PURE__ */ n(re, { className: "humany-sr-only", children: /* @__PURE__ */ n(M, { name: m, timestamp: e }) }),
|
|
1203
|
+
/* @__PURE__ */ n(tt, { timestamp: e, className: t, children: /* @__PURE__ */ n(F, { className: "humany-message-content-bundle", children: a.map((l, u) => /* @__PURE__ */ n(
|
|
1204
1204
|
Y,
|
|
1205
1205
|
{
|
|
1206
1206
|
className: "humany-message-container",
|
|
1207
1207
|
right: !0,
|
|
1208
|
-
ref:
|
|
1208
|
+
ref: o,
|
|
1209
1209
|
children: /* @__PURE__ */ n(
|
|
1210
1210
|
V,
|
|
1211
1211
|
{
|
|
1212
1212
|
isUser: !0,
|
|
1213
|
-
content:
|
|
1214
|
-
stacked: d(
|
|
1213
|
+
content: l,
|
|
1214
|
+
stacked: d(u)
|
|
1215
1215
|
}
|
|
1216
1216
|
)
|
|
1217
1217
|
},
|
|
1218
|
-
|
|
1218
|
+
l.key
|
|
1219
1219
|
)) }) })
|
|
1220
1220
|
] });
|
|
1221
1221
|
switch (s) {
|
|
1222
1222
|
case U.System:
|
|
1223
|
-
return
|
|
1223
|
+
return c();
|
|
1224
1224
|
case U.Agent:
|
|
1225
|
-
return
|
|
1225
|
+
return f();
|
|
1226
1226
|
case U.User:
|
|
1227
|
-
return
|
|
1227
|
+
return x();
|
|
1228
1228
|
default:
|
|
1229
1229
|
return null;
|
|
1230
1230
|
}
|
|
@@ -1232,61 +1232,61 @@ const Oe = ({ className: t }) => {
|
|
|
1232
1232
|
), V = ({
|
|
1233
1233
|
content: t,
|
|
1234
1234
|
isUser: e,
|
|
1235
|
-
isSystem:
|
|
1235
|
+
isSystem: r,
|
|
1236
1236
|
stacked: s
|
|
1237
1237
|
}) => {
|
|
1238
|
-
const a = G(), { title:
|
|
1239
|
-
return
|
|
1238
|
+
const a = G(), { title: o, body: d, actions: m, form: c, items: f } = t;
|
|
1239
|
+
return f ? /* @__PURE__ */ n(
|
|
1240
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: f, dispatch: a })
|
|
1246
1246
|
}
|
|
1247
1247
|
) : /* @__PURE__ */ h(
|
|
1248
1248
|
X,
|
|
1249
1249
|
{
|
|
1250
1250
|
className: "humany-message-content",
|
|
1251
|
-
padded: !
|
|
1251
|
+
padded: !r,
|
|
1252
1252
|
user: !!e,
|
|
1253
1253
|
stacked: s,
|
|
1254
|
-
fullWidth: !!
|
|
1254
|
+
fullWidth: !!c || !!m,
|
|
1255
1255
|
children: [
|
|
1256
|
-
|
|
1257
|
-
d && /* @__PURE__ */ n(
|
|
1258
|
-
|
|
1256
|
+
o && /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(qe, { variant: "h2", children: o }) }),
|
|
1257
|
+
d && /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(Fe, { html: d }) }),
|
|
1258
|
+
c && /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(
|
|
1259
1259
|
_e,
|
|
1260
1260
|
{
|
|
1261
|
-
...
|
|
1262
|
-
onChange: (
|
|
1261
|
+
...c,
|
|
1262
|
+
onChange: (l, u) => {
|
|
1263
1263
|
a("form", {
|
|
1264
|
-
data:
|
|
1265
|
-
formKey:
|
|
1266
|
-
actionKey:
|
|
1264
|
+
data: u,
|
|
1265
|
+
formKey: c.schema.id,
|
|
1266
|
+
actionKey: l
|
|
1267
1267
|
});
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
1270
|
) }),
|
|
1271
|
-
|
|
1271
|
+
m && /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(
|
|
1272
1272
|
Ye,
|
|
1273
1273
|
{
|
|
1274
|
-
items: Object.keys(
|
|
1275
|
-
renderItem: (
|
|
1274
|
+
items: Object.keys(m).map((l) => ({ label: m[l], actionKey: l })),
|
|
1275
|
+
renderItem: (l) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
1276
1276
|
Xe,
|
|
1277
1277
|
{
|
|
1278
1278
|
onClick: () => {
|
|
1279
|
-
a("action",
|
|
1279
|
+
a("action", l.actionKey);
|
|
1280
1280
|
},
|
|
1281
|
-
children:
|
|
1281
|
+
children: l.label
|
|
1282
1282
|
}
|
|
1283
|
-
) },
|
|
1283
|
+
) }, l.actionKey)
|
|
1284
1284
|
}
|
|
1285
1285
|
) })
|
|
1286
1286
|
]
|
|
1287
1287
|
}
|
|
1288
1288
|
);
|
|
1289
|
-
},
|
|
1289
|
+
}, re = i.div`
|
|
1290
1290
|
position: absolute !important;
|
|
1291
1291
|
height: 1px;
|
|
1292
1292
|
width: 1px;
|
|
@@ -1296,7 +1296,7 @@ const Oe = ({ className: t }) => {
|
|
|
1296
1296
|
left: -10000000px;
|
|
1297
1297
|
top: auto;
|
|
1298
1298
|
`, Lt = () => {
|
|
1299
|
-
const { skipToLatestMessageLabel: t = "Skip to latest message" } =
|
|
1299
|
+
const { skipToLatestMessageLabel: t = "Skip to latest message" } = C(), e = I(), r = () => {
|
|
1300
1300
|
const s = e.get("widgetDOMElement");
|
|
1301
1301
|
if (s) {
|
|
1302
1302
|
const a = s.querySelectorAll(
|
|
@@ -1310,9 +1310,9 @@ const Oe = ({ className: t }) => {
|
|
|
1310
1310
|
{
|
|
1311
1311
|
className: "humany-skip-to-latest-message",
|
|
1312
1312
|
onKeyDown: (s) => {
|
|
1313
|
-
(s.key === "Enter" || s.keyCode === 13) &&
|
|
1313
|
+
(s.key === "Enter" || s.keyCode === 13) && r();
|
|
1314
1314
|
},
|
|
1315
|
-
onClick:
|
|
1315
|
+
onClick: r,
|
|
1316
1316
|
children: t
|
|
1317
1317
|
}
|
|
1318
1318
|
);
|
|
@@ -1334,25 +1334,26 @@ const Oe = ({ className: t }) => {
|
|
|
1334
1334
|
&:focus-visible {
|
|
1335
1335
|
left: 50%;
|
|
1336
1336
|
transform: translateX(-50%);
|
|
1337
|
-
${
|
|
1337
|
+
${p};
|
|
1338
1338
|
}
|
|
1339
1339
|
`, ye = () => {
|
|
1340
|
-
const t = I(), e = ue((
|
|
1341
|
-
|
|
1342
|
-
|
|
1340
|
+
const t = I(), e = ue((l) => {
|
|
1341
|
+
l && setTimeout(() => {
|
|
1342
|
+
l.scrollIntoView({
|
|
1343
1343
|
block: "start",
|
|
1344
1344
|
behavior: "smooth"
|
|
1345
1345
|
});
|
|
1346
1346
|
}, 250);
|
|
1347
|
-
}, []), [
|
|
1347
|
+
}, []), [r, s] = ie(!0), {
|
|
1348
1348
|
messages: a,
|
|
1349
|
-
loading:
|
|
1350
|
-
typingActors: d = []
|
|
1351
|
-
|
|
1349
|
+
loading: o,
|
|
1350
|
+
typingActors: d = [],
|
|
1351
|
+
providers: m = []
|
|
1352
|
+
} = C(), c = () => d && d.length ? d.map((l, u) => /* @__PURE__ */ n(
|
|
1352
1353
|
_,
|
|
1353
1354
|
{
|
|
1354
|
-
id: `typing_${
|
|
1355
|
-
children: /* @__PURE__ */ n(fe, { timestamp: Date.now(), sender:
|
|
1355
|
+
id: `typing_${l.name}`,
|
|
1356
|
+
children: /* @__PURE__ */ n(fe, { timestamp: Date.now(), sender: l, children: /* @__PURE__ */ n(
|
|
1356
1357
|
ne,
|
|
1357
1358
|
{
|
|
1358
1359
|
boxed: !0,
|
|
@@ -1360,32 +1361,32 @@ const Oe = ({ className: t }) => {
|
|
|
1360
1361
|
}
|
|
1361
1362
|
) })
|
|
1362
1363
|
},
|
|
1363
|
-
`typing_${
|
|
1364
|
-
)) : null,
|
|
1364
|
+
`typing_${l.name}`
|
|
1365
|
+
)) : null, f = de.useRef((a == null ? void 0 : a.length) || 0), x = m.includes("ace-knowledge-bot");
|
|
1365
1366
|
return j(() => {
|
|
1366
|
-
const
|
|
1367
|
-
if (
|
|
1368
|
-
const
|
|
1367
|
+
const l = t.get("widgetDOMElement");
|
|
1368
|
+
if (l && x) {
|
|
1369
|
+
const u = l.querySelectorAll(
|
|
1369
1370
|
".humany-conversation-entry"
|
|
1370
1371
|
);
|
|
1371
|
-
|
|
1372
|
+
u.length && u.length > f.current && (f.current = u.length, u[u.length - 1].focus());
|
|
1372
1373
|
}
|
|
1373
1374
|
}), /* @__PURE__ */ h(N, { children: [
|
|
1374
|
-
/* @__PURE__ */ h(Nt, { tabIndex: 0, scrollableCss:
|
|
1375
|
-
a && a.length ? a.map((
|
|
1376
|
-
const { type:
|
|
1375
|
+
/* @__PURE__ */ h(Nt, { tabIndex: 0, scrollableCss: r, ref: s, children: [
|
|
1376
|
+
a && a.length ? a.map((l, u) => {
|
|
1377
|
+
const { type: b, timestamp: $, sender: k, content: y } = l;
|
|
1377
1378
|
return /* @__PURE__ */ n(
|
|
1378
1379
|
_,
|
|
1379
1380
|
{
|
|
1380
1381
|
className: "humany-conversation-entry",
|
|
1381
1382
|
tabIndex: -1,
|
|
1382
|
-
children: /* @__PURE__ */ n(Ct, { ...
|
|
1383
|
+
children: /* @__PURE__ */ n(Ct, { ...l, ref: e })
|
|
1383
1384
|
},
|
|
1384
|
-
`${
|
|
1385
|
+
`${b}_${k == null ? void 0 : k.name}_${$}_${y[0].key}`
|
|
1385
1386
|
);
|
|
1386
1387
|
}) : null,
|
|
1387
|
-
|
|
1388
|
-
|
|
1388
|
+
c(),
|
|
1389
|
+
o && /* @__PURE__ */ n(_, { children: /* @__PURE__ */ n(ne, { ref: e }) })
|
|
1389
1390
|
] }),
|
|
1390
1391
|
/* @__PURE__ */ n(Oe, {}),
|
|
1391
1392
|
/* @__PURE__ */ n(Lt, {})
|
|
@@ -1401,7 +1402,7 @@ const Oe = ({ className: t }) => {
|
|
|
1401
1402
|
}};
|
|
1402
1403
|
${(t) => !!t.scrollableCss && t.scrollableCss};
|
|
1403
1404
|
&:focus-visible {
|
|
1404
|
-
${(t) =>
|
|
1405
|
+
${(t) => p(t)};
|
|
1405
1406
|
}
|
|
1406
1407
|
`, _ = i.div`
|
|
1407
1408
|
margin: 0;
|
|
@@ -1437,7 +1438,7 @@ const Oe = ({ className: t }) => {
|
|
|
1437
1438
|
}
|
|
1438
1439
|
|
|
1439
1440
|
&:focus-visible {
|
|
1440
|
-
${
|
|
1441
|
+
${p}
|
|
1441
1442
|
border-radius: ${(t) => {
|
|
1442
1443
|
var e;
|
|
1443
1444
|
return (e = t.theme.sizes) == null ? void 0 : e.small;
|
|
@@ -1445,7 +1446,7 @@ const Oe = ({ className: t }) => {
|
|
|
1445
1446
|
}
|
|
1446
1447
|
${(t) => Z(t)(
|
|
1447
1448
|
"h1",
|
|
1448
|
-
|
|
1449
|
+
v`
|
|
1449
1450
|
font-weight: normal;
|
|
1450
1451
|
`
|
|
1451
1452
|
)}
|
|
@@ -1464,7 +1465,7 @@ const Oe = ({ className: t }) => {
|
|
|
1464
1465
|
}, At = ({
|
|
1465
1466
|
dispatch: t,
|
|
1466
1467
|
header: e,
|
|
1467
|
-
buttonLabel:
|
|
1468
|
+
buttonLabel: r
|
|
1468
1469
|
}) => /* @__PURE__ */ h(
|
|
1469
1470
|
It,
|
|
1470
1471
|
{
|
|
@@ -1476,11 +1477,11 @@ const Oe = ({ className: t }) => {
|
|
|
1476
1477
|
Ot,
|
|
1477
1478
|
{
|
|
1478
1479
|
className: "humany-conversation-outlet-head-button",
|
|
1479
|
-
"aria-label":
|
|
1480
|
-
title:
|
|
1480
|
+
"aria-label": r,
|
|
1481
|
+
title: r,
|
|
1481
1482
|
onClick: () => t("hide-overlay-conversation"),
|
|
1482
1483
|
children: /* @__PURE__ */ n(
|
|
1483
|
-
|
|
1484
|
+
w,
|
|
1484
1485
|
{
|
|
1485
1486
|
symbol: {
|
|
1486
1487
|
type: "Svg",
|
|
@@ -1556,7 +1557,7 @@ const Oe = ({ className: t }) => {
|
|
|
1556
1557
|
${(t) => t.theme.borderRadius && `border-radius: ${t.theme.borderRadius};`}
|
|
1557
1558
|
|
|
1558
1559
|
&:focus-visible {
|
|
1559
|
-
${
|
|
1560
|
+
${p};
|
|
1560
1561
|
}
|
|
1561
1562
|
|
|
1562
1563
|
svg line {
|
|
@@ -1567,18 +1568,18 @@ const Oe = ({ className: t }) => {
|
|
|
1567
1568
|
}
|
|
1568
1569
|
`, Ft = ({ className: t, ...e }) => {
|
|
1569
1570
|
const {
|
|
1570
|
-
overlay:
|
|
1571
|
+
overlay: r,
|
|
1571
1572
|
overlayConversationHeader: s,
|
|
1572
1573
|
overlayConversationCloseLabel: a,
|
|
1573
|
-
conversationControllerId:
|
|
1574
|
-
} =
|
|
1574
|
+
conversationControllerId: o
|
|
1575
|
+
} = C(), d = G(), c = I().get("$settings");
|
|
1575
1576
|
return /* @__PURE__ */ n(
|
|
1576
1577
|
ze.Provider,
|
|
1577
1578
|
{
|
|
1578
|
-
value:
|
|
1579
|
-
children: /* @__PURE__ */ h(ge.Provider, { value:
|
|
1579
|
+
value: o ? { id: o } : null,
|
|
1580
|
+
children: /* @__PURE__ */ h(ge.Provider, { value: c == null ? void 0 : c.language, children: [
|
|
1580
1581
|
/* @__PURE__ */ n(
|
|
1581
|
-
|
|
1582
|
+
Bt,
|
|
1582
1583
|
{
|
|
1583
1584
|
"aria-live": "polite",
|
|
1584
1585
|
...e,
|
|
@@ -1589,9 +1590,9 @@ const Oe = ({ className: t }) => {
|
|
|
1589
1590
|
children: /* @__PURE__ */ n(ye, {})
|
|
1590
1591
|
}
|
|
1591
1592
|
),
|
|
1592
|
-
|
|
1593
|
+
r && /* @__PURE__ */ h(N, { children: [
|
|
1593
1594
|
/* @__PURE__ */ n(Mt, { dispatch: d }),
|
|
1594
|
-
|
|
1595
|
+
r.conversation && /* @__PURE__ */ n(
|
|
1595
1596
|
At,
|
|
1596
1597
|
{
|
|
1597
1598
|
dispatch: d,
|
|
@@ -1603,7 +1604,7 @@ const Oe = ({ className: t }) => {
|
|
|
1603
1604
|
] })
|
|
1604
1605
|
}
|
|
1605
1606
|
);
|
|
1606
|
-
},
|
|
1607
|
+
}, Bt = i.div`
|
|
1607
1608
|
position: absolute;
|
|
1608
1609
|
right: 0;
|
|
1609
1610
|
left: 0;
|