@telia-ace/widget-conversation 1.1.1-rc.1 → 1.1.1-rc.3
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/{conversation-78019545.mjs → conversation-24961686.mjs} +337 -361
- package/{conversation-905bdeb3.js → conversation-7c391689.js} +69 -69
- package/index.js +3 -1
- package/index.mjs +1000 -13
- package/package.json +8 -8
- package/{return-button-f3f52295.mjs → return-button-70a640cb.mjs} +12 -13
- package/{return-button-7560bd06.js → return-button-cdc53d1f.js} +16 -16
- package/index-1180f4a4.js +0 -1212
- package/index-bfc77c45.mjs +0 -11311
- package/use-dispatch-7cf7db21.js +0 -1
- package/use-dispatch-86019505.mjs +0 -24
|
@@ -1,137 +1,113 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
i(d);
|
|
15
|
-
}
|
|
16
|
-
g = f.registerResolver(c, (d) => {
|
|
17
|
-
m.current && i(d);
|
|
18
|
-
});
|
|
19
|
-
}), () => {
|
|
20
|
-
g && g();
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}, [m, c, t, r]), s;
|
|
24
|
-
}, Ie = () => {
|
|
25
|
-
const [e, t] = z(!1);
|
|
26
|
-
return O(() => {
|
|
27
|
-
const o = () => {
|
|
28
|
-
t(!1);
|
|
29
|
-
}, r = (s) => {
|
|
30
|
-
s.keyCode === 9 && t(!0);
|
|
31
|
-
};
|
|
32
|
-
return window.addEventListener("keydown", r), window.addEventListener("click", o), () => {
|
|
33
|
-
window.removeEventListener("keydown", r), window.removeEventListener("click", o);
|
|
34
|
-
};
|
|
35
|
-
}, []), e;
|
|
36
|
-
}, Me = ({ className: e }) => {
|
|
37
|
-
const [t, o] = z(""), [r, s] = z(!1), [i, m] = z(0), [c, g] = z(0), f = Ie(), d = X(), {
|
|
1
|
+
import { jsx as n, jsxs as u, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import s from "@emotion/styled";
|
|
3
|
+
import { Input as te, Button as z, borderTabStyle as f, SymbolBadge as x, useIsTabbing as fe, useDispatch as V, useProperties as I, useScroll as ne, Typography as q, invertedHoverButton as pe, Html as Y, List as re, buttonCss as G, ItemList as K, itemList as j, useComponent as ye, genericHtml as be, headingElement as J, list as $e, WidgetOverlayOutlet as oe, ConversationContext as ve } from "@telia-ace/widget-ui";
|
|
4
|
+
import { appendClassNames as M } from "@telia-ace/widget-utilities";
|
|
5
|
+
import { css as g, keyframes as xe } from "@emotion/react";
|
|
6
|
+
import { useState as T, useEffect as se, forwardRef as Q, Suspense as we, useMemo as ke, useCallback as ae, useRef as Ce } from "react";
|
|
7
|
+
import { FormComponent as Se } from "@telia-ace/widget-forms";
|
|
8
|
+
import { ConversationMessageListItemType as k, ConversationMessageType as W } from "./index.mjs";
|
|
9
|
+
import "@telia-ace/widget-core";
|
|
10
|
+
import "@telia-ace/widget-services";
|
|
11
|
+
import "@telia-ace/widget-plugins";
|
|
12
|
+
const ze = ({ className: e }) => {
|
|
13
|
+
const [t, r] = T(""), [o, a] = T(!1), [i, h] = T(0), [c, p] = T(0), v = fe(), d = V(), {
|
|
38
14
|
inputPlaceholder: l = "Type your message",
|
|
39
|
-
inputHidden:
|
|
15
|
+
inputHidden: $ = !1,
|
|
40
16
|
inputDisabled: S = !1,
|
|
41
|
-
sendButtonLabel:
|
|
17
|
+
sendButtonLabel: L = "Send message",
|
|
42
18
|
inputMultiline: w = !0,
|
|
43
|
-
secondaryAction:
|
|
44
|
-
} =
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
const { lineHeight:
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
|
|
19
|
+
secondaryAction: y
|
|
20
|
+
} = I(), [de, b] = ne(!0);
|
|
21
|
+
se(() => {
|
|
22
|
+
if (b.current) {
|
|
23
|
+
const { lineHeight: m, maxHeight: H } = getComputedStyle(b.current);
|
|
24
|
+
if (m && m.indexOf("px") > -1) {
|
|
25
|
+
const N = m.split("px"), he = parseInt(N[0], 10);
|
|
26
|
+
h(he);
|
|
51
27
|
const ge = H.split("px");
|
|
52
|
-
|
|
28
|
+
p(parseInt(ge[0], 10));
|
|
53
29
|
}
|
|
54
30
|
}
|
|
55
|
-
}, [
|
|
56
|
-
const
|
|
57
|
-
!
|
|
58
|
-
}, me = (
|
|
59
|
-
|
|
60
|
-
actionKey:
|
|
61
|
-
...
|
|
31
|
+
}, [b.current]);
|
|
32
|
+
const O = (m) => {
|
|
33
|
+
!m.shiftKey || !w ? (m.preventDefault(), t && t.length > 0 && (d("user-submit", { text: t }), r(""), D(""))) : t.length < 1 && m.preventDefault();
|
|
34
|
+
}, me = (m) => {
|
|
35
|
+
y && (m.preventDefault(), d("action", {
|
|
36
|
+
actionKey: y.action,
|
|
37
|
+
...y
|
|
62
38
|
}));
|
|
63
|
-
}, ue = (
|
|
64
|
-
if (w &&
|
|
65
|
-
const H =
|
|
39
|
+
}, ue = (m) => {
|
|
40
|
+
if (w && b.current) {
|
|
41
|
+
const H = b.current.scrollHeight;
|
|
66
42
|
if (H > i) {
|
|
67
|
-
|
|
68
|
-
let
|
|
69
|
-
|
|
43
|
+
b.current.style.height = "auto";
|
|
44
|
+
let N = H;
|
|
45
|
+
m.length < 1 && (N = i), b.current.style.height = `${N}px`, N >= c ? b.current.style.overflowY = "scroll" : b.current.style.overflowY = "hidden";
|
|
70
46
|
}
|
|
71
47
|
}
|
|
72
|
-
}, D = (
|
|
73
|
-
ue(
|
|
48
|
+
}, D = (m) => {
|
|
49
|
+
ue(m), r(m), m && m.length > 0 && d("user-typing", { textLength: m.length });
|
|
74
50
|
};
|
|
75
|
-
return
|
|
76
|
-
|
|
51
|
+
return $ ? null : /* @__PURE__ */ u(
|
|
52
|
+
Me,
|
|
77
53
|
{
|
|
78
54
|
grow: w,
|
|
79
|
-
className:
|
|
80
|
-
"data-has-focus":
|
|
55
|
+
className: M("humany-conversation-input", e),
|
|
56
|
+
"data-has-focus": o,
|
|
81
57
|
scrollableCss: de,
|
|
82
|
-
isTabbing:
|
|
58
|
+
isTabbing: v,
|
|
83
59
|
children: [
|
|
84
|
-
|
|
85
|
-
|
|
60
|
+
y && /* @__PURE__ */ n(
|
|
61
|
+
Ie,
|
|
86
62
|
{
|
|
87
63
|
disabled: S,
|
|
88
64
|
onClick: me,
|
|
89
|
-
title:
|
|
90
|
-
"aria-label":
|
|
65
|
+
title: y.label,
|
|
66
|
+
"aria-label": y.label,
|
|
91
67
|
children: /* @__PURE__ */ n(
|
|
92
68
|
x,
|
|
93
69
|
{
|
|
94
70
|
size: 24,
|
|
95
|
-
symbol: { type: "Svg", content:
|
|
71
|
+
symbol: { type: "Svg", content: y.icon || "browse" }
|
|
96
72
|
}
|
|
97
73
|
)
|
|
98
74
|
}
|
|
99
75
|
),
|
|
100
76
|
w ? /* @__PURE__ */ n(
|
|
101
|
-
|
|
77
|
+
Le,
|
|
102
78
|
{
|
|
103
79
|
value: t,
|
|
104
80
|
onChange: D,
|
|
105
|
-
onEnter:
|
|
81
|
+
onEnter: O,
|
|
106
82
|
disabled: S,
|
|
107
83
|
"aria-label": l,
|
|
108
84
|
placeholder: l,
|
|
109
|
-
onFocusChange:
|
|
85
|
+
onFocusChange: a,
|
|
110
86
|
type: "textarea",
|
|
111
87
|
rows: 1,
|
|
112
|
-
ref:
|
|
88
|
+
ref: b
|
|
113
89
|
}
|
|
114
90
|
) : /* @__PURE__ */ n(
|
|
115
|
-
|
|
91
|
+
Ne,
|
|
116
92
|
{
|
|
117
93
|
value: t,
|
|
118
94
|
onChange: D,
|
|
119
|
-
onEnter:
|
|
95
|
+
onEnter: O,
|
|
120
96
|
disabled: S,
|
|
121
97
|
"aria-label": l,
|
|
122
98
|
placeholder: l,
|
|
123
|
-
onFocusChange:
|
|
99
|
+
onFocusChange: a
|
|
124
100
|
}
|
|
125
101
|
),
|
|
126
102
|
/* @__PURE__ */ n(
|
|
127
103
|
ie,
|
|
128
104
|
{
|
|
129
105
|
disabled: S,
|
|
130
|
-
onClick:
|
|
131
|
-
title:
|
|
132
|
-
"aria-label":
|
|
106
|
+
onClick: O,
|
|
107
|
+
title: L,
|
|
108
|
+
"aria-label": L,
|
|
133
109
|
children: /* @__PURE__ */ n(
|
|
134
|
-
|
|
110
|
+
He,
|
|
135
111
|
{
|
|
136
112
|
size: 22,
|
|
137
113
|
symbol: { type: "Svg", content: "send" },
|
|
@@ -143,7 +119,7 @@ const Le = (e, t) => {
|
|
|
143
119
|
]
|
|
144
120
|
}
|
|
145
121
|
);
|
|
146
|
-
},
|
|
122
|
+
}, Le = s(te)`
|
|
147
123
|
resize: none;
|
|
148
124
|
flex: 1;
|
|
149
125
|
flex-shrink: 1;
|
|
@@ -163,7 +139,7 @@ const Le = (e, t) => {
|
|
|
163
139
|
border: none;
|
|
164
140
|
transition: height 200ms linear;
|
|
165
141
|
outline: none;
|
|
166
|
-
`,
|
|
142
|
+
`, Ne = s(te)`
|
|
167
143
|
flex: 1;
|
|
168
144
|
border: none;
|
|
169
145
|
background-color: transparent;
|
|
@@ -189,7 +165,7 @@ const Le = (e, t) => {
|
|
|
189
165
|
}};
|
|
190
166
|
font-style: italic;
|
|
191
167
|
}
|
|
192
|
-
`, ie =
|
|
168
|
+
`, ie = s(z)`
|
|
193
169
|
flex: 0 0 50px;
|
|
194
170
|
align-self: stretch;
|
|
195
171
|
background-color: transparent;
|
|
@@ -199,19 +175,19 @@ const Le = (e, t) => {
|
|
|
199
175
|
border: none;
|
|
200
176
|
color: #a6a6a6;
|
|
201
177
|
&:focus-visible {
|
|
202
|
-
${
|
|
178
|
+
${f};
|
|
203
179
|
}
|
|
204
|
-
`,
|
|
180
|
+
`, Ie = s(ie)`
|
|
205
181
|
border-right: ${(e) => e.theme.border};
|
|
206
182
|
margin: ${(e) => {
|
|
207
183
|
var t;
|
|
208
184
|
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
209
185
|
}} 0;
|
|
210
|
-
`,
|
|
211
|
-
${(e) => e.grow ?
|
|
186
|
+
`, Me = s.div`
|
|
187
|
+
${(e) => e.grow ? g`
|
|
212
188
|
min-height: 50px;
|
|
213
189
|
max-height: 150px;
|
|
214
|
-
` :
|
|
190
|
+
` : g`
|
|
215
191
|
height: 50px;
|
|
216
192
|
`}
|
|
217
193
|
flex: 0 0 auto;
|
|
@@ -222,11 +198,11 @@ const Le = (e, t) => {
|
|
|
222
198
|
return (t = e.theme.colors) == null ? void 0 : t.accent;
|
|
223
199
|
}};
|
|
224
200
|
border-top: ${(e) => e.theme.inputBorder};
|
|
225
|
-
${(e) => e["data-has-focus"] && e.isTabbing &&
|
|
201
|
+
${(e) => e["data-has-focus"] && e.isTabbing && f}
|
|
226
202
|
textarea {
|
|
227
203
|
${(e) => !!e.scrollableCss && e.scrollableCss}
|
|
228
204
|
}
|
|
229
|
-
`,
|
|
205
|
+
`, He = s(
|
|
230
206
|
({
|
|
231
207
|
hasContent: e,
|
|
232
208
|
...t
|
|
@@ -243,7 +219,7 @@ const Le = (e, t) => {
|
|
|
243
219
|
return e.hasContent ? (t = e.theme.colors) == null ? void 0 : t.primary : "#a6a6a6";
|
|
244
220
|
}};
|
|
245
221
|
}
|
|
246
|
-
`,
|
|
222
|
+
`, Te = s.div`
|
|
247
223
|
width: ${(e) => e.avatarSize || "32px"};
|
|
248
224
|
height: ${(e) => e.avatarSize || "32px"};
|
|
249
225
|
border-radius: 50%;
|
|
@@ -290,7 +266,7 @@ const Le = (e, t) => {
|
|
|
290
266
|
}};
|
|
291
267
|
}
|
|
292
268
|
}
|
|
293
|
-
`,
|
|
269
|
+
`, Ae = xe`
|
|
294
270
|
0% {
|
|
295
271
|
opacity: 0;
|
|
296
272
|
}
|
|
@@ -300,7 +276,7 @@ const Le = (e, t) => {
|
|
|
300
276
|
100% {
|
|
301
277
|
opacity: 0;
|
|
302
278
|
}
|
|
303
|
-
`,
|
|
279
|
+
`, Re = s.div`
|
|
304
280
|
display: flex;
|
|
305
281
|
justify-content: center;
|
|
306
282
|
> div {
|
|
@@ -312,7 +288,7 @@ const Le = (e, t) => {
|
|
|
312
288
|
var t;
|
|
313
289
|
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
314
290
|
}};
|
|
315
|
-
animation: ${
|
|
291
|
+
animation: ${Ae} 1s infinite;
|
|
316
292
|
}
|
|
317
293
|
> div:nth-of-type(2) {
|
|
318
294
|
animation-delay: 100ms;
|
|
@@ -320,29 +296,29 @@ const Le = (e, t) => {
|
|
|
320
296
|
> div:nth-of-type(3) {
|
|
321
297
|
animation-delay: 200ms;
|
|
322
298
|
}
|
|
323
|
-
`,
|
|
299
|
+
`, P = s.div`
|
|
324
300
|
grid-area: content;
|
|
325
301
|
max-width: 100%;
|
|
326
302
|
overflow: hidden;
|
|
327
|
-
`,
|
|
303
|
+
`, Be = s(q)`
|
|
328
304
|
font-size: ${(e) => {
|
|
329
305
|
var t;
|
|
330
306
|
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
331
307
|
}};
|
|
332
308
|
font-weight: normal;
|
|
333
309
|
margin: 0;
|
|
334
|
-
`,
|
|
310
|
+
`, U = s.div`
|
|
335
311
|
display: flex;
|
|
336
312
|
${(e) => e.left && "justify-content: start;"};
|
|
337
313
|
${(e) => e.center && "justify-content: center;"};
|
|
338
314
|
${(e) => e.right && "justify-content: end;"};
|
|
339
|
-
`,
|
|
315
|
+
`, _ = s.div`
|
|
340
316
|
${(e) => {
|
|
341
317
|
var t;
|
|
342
318
|
return e.padded && `padding: ${(t = e.theme.sizes) == null ? void 0 : t.medium};`;
|
|
343
319
|
}}
|
|
344
|
-
${(e) => !e.user && e.stacked &&
|
|
345
|
-
${(e) => e.user && e.stacked &&
|
|
320
|
+
${(e) => !e.user && e.stacked && Ke(e.stacked, e.theme)}
|
|
321
|
+
${(e) => e.user && e.stacked && je(e.stacked, e.theme)}
|
|
346
322
|
|
|
347
323
|
display: inline-block;
|
|
348
324
|
margin-top: ${(e) => {
|
|
@@ -358,15 +334,15 @@ const Le = (e, t) => {
|
|
|
358
334
|
}
|
|
359
335
|
max-width: 100%;
|
|
360
336
|
${(e) => e.fullWidth && "width: 100%;"}
|
|
361
|
-
`,
|
|
362
|
-
var
|
|
363
|
-
const
|
|
364
|
-
background-color: ${(
|
|
365
|
-
color: ${(
|
|
337
|
+
`, Ke = (e, t) => {
|
|
338
|
+
var o, a;
|
|
339
|
+
const r = g`
|
|
340
|
+
background-color: ${(o = t.colors) == null ? void 0 : o.accent};
|
|
341
|
+
color: ${(a = t.colors) == null ? void 0 : a.text};
|
|
366
342
|
${t.border && `border: ${t.border};`};
|
|
367
343
|
`;
|
|
368
|
-
return t.borderRadius ?
|
|
369
|
-
${
|
|
344
|
+
return t.borderRadius ? g`
|
|
345
|
+
${r}
|
|
370
346
|
|
|
371
347
|
border-top-right-radius: ${t.borderRadius};
|
|
372
348
|
border-bottom-right-radius: ${t.borderRadius};
|
|
@@ -378,15 +354,15 @@ const Le = (e, t) => {
|
|
|
378
354
|
${e === "last" && `
|
|
379
355
|
border-bottom-left-radius: ${t.borderRadius};
|
|
380
356
|
`}
|
|
381
|
-
` :
|
|
382
|
-
},
|
|
383
|
-
var
|
|
384
|
-
const
|
|
385
|
-
background-color: ${(
|
|
386
|
-
color: ${(
|
|
357
|
+
` : r;
|
|
358
|
+
}, je = (e, t) => {
|
|
359
|
+
var o, a;
|
|
360
|
+
const r = g`
|
|
361
|
+
background-color: ${(o = t.colors) == null ? void 0 : o.primary};
|
|
362
|
+
color: ${(a = t.colors) == null ? void 0 : a.accent};
|
|
387
363
|
`;
|
|
388
|
-
return t.borderRadius ?
|
|
389
|
-
${
|
|
364
|
+
return t.borderRadius ? g`
|
|
365
|
+
${r}
|
|
390
366
|
|
|
391
367
|
border-top-left-radius: ${t.borderRadius};
|
|
392
368
|
border-bottom-left-radius: ${t.borderRadius};
|
|
@@ -398,8 +374,8 @@ const Le = (e, t) => {
|
|
|
398
374
|
${e === "last" && `
|
|
399
375
|
border-bottom-right-radius: ${t.borderRadius};
|
|
400
376
|
`}
|
|
401
|
-
` :
|
|
402
|
-
}, A =
|
|
377
|
+
` : r;
|
|
378
|
+
}, A = s.div`
|
|
403
379
|
margin-bottom: ${(e) => {
|
|
404
380
|
var t;
|
|
405
381
|
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
@@ -408,19 +384,19 @@ const Le = (e, t) => {
|
|
|
408
384
|
margin-bottom: 0;
|
|
409
385
|
}
|
|
410
386
|
`, C = (e) => {
|
|
411
|
-
var t,
|
|
412
|
-
return
|
|
387
|
+
var t, r;
|
|
388
|
+
return g`
|
|
413
389
|
margin: ${(t = e.theme.sizes) == null ? void 0 : t.medium} 0;
|
|
414
|
-
padding: 0 ${(
|
|
390
|
+
padding: 0 ${(r = e.theme.sizes) == null ? void 0 : r.medium};
|
|
415
391
|
`;
|
|
416
|
-
},
|
|
392
|
+
}, Oe = s(Se)`
|
|
417
393
|
& button.humany-form-component-button {
|
|
418
394
|
${(e) => {
|
|
419
|
-
var t,
|
|
420
|
-
return ((t = e.theme.colors) == null ? void 0 : t.primary) && ((
|
|
395
|
+
var t, r, o, a;
|
|
396
|
+
return ((t = e.theme.colors) == null ? void 0 : t.primary) && ((r = e.theme.colors) == null ? void 0 : r.accent) && pe({
|
|
421
397
|
active: !1,
|
|
422
|
-
primaryColor: (
|
|
423
|
-
secondaryColor: (
|
|
398
|
+
primaryColor: (o = e.theme.colors) == null ? void 0 : o.primary,
|
|
399
|
+
secondaryColor: (a = e.theme.colors) == null ? void 0 : a.accent,
|
|
424
400
|
theme: e.theme
|
|
425
401
|
});
|
|
426
402
|
}};
|
|
@@ -441,18 +417,18 @@ const Le = (e, t) => {
|
|
|
441
417
|
}};
|
|
442
418
|
}
|
|
443
419
|
}
|
|
444
|
-
`,
|
|
420
|
+
`, De = s(Y)`
|
|
445
421
|
white-space: pre-wrap;
|
|
446
422
|
a {
|
|
447
423
|
color: ${(e) => e.theme.colors.link};
|
|
448
424
|
&:focus {
|
|
449
425
|
${(e) => {
|
|
450
426
|
var t;
|
|
451
|
-
return ((t = e.theme.accessibility) == null ? void 0 : t.isTabbing) &&
|
|
427
|
+
return ((t = e.theme.accessibility) == null ? void 0 : t.isTabbing) && f;
|
|
452
428
|
}};
|
|
453
429
|
}
|
|
454
430
|
}
|
|
455
|
-
`,
|
|
431
|
+
`, We = s(re)`
|
|
456
432
|
padding: 0;
|
|
457
433
|
list-style: none;
|
|
458
434
|
margin: 0 -${(e) => {
|
|
@@ -465,7 +441,7 @@ const Le = (e, t) => {
|
|
|
465
441
|
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
466
442
|
}};
|
|
467
443
|
}
|
|
468
|
-
`,
|
|
444
|
+
`, Ee = s.button`
|
|
469
445
|
${(e) => G(e)};
|
|
470
446
|
display: block;
|
|
471
447
|
background-color: ${(e) => {
|
|
@@ -475,16 +451,16 @@ const Le = (e, t) => {
|
|
|
475
451
|
width: 100%;
|
|
476
452
|
color: #fff;
|
|
477
453
|
&:focus-visible {
|
|
478
|
-
${
|
|
454
|
+
${f}
|
|
479
455
|
background-color: transparent;
|
|
480
456
|
}
|
|
481
|
-
`,
|
|
482
|
-
({ boxed: e, className: t, agentData:
|
|
457
|
+
`, Z = Q(
|
|
458
|
+
({ boxed: e, className: t, agentData: r }, o) => /* @__PURE__ */ n(P, { ref: o, children: /* @__PURE__ */ n(U, { left: e, center: !e, children: /* @__PURE__ */ n(_, { padded: !!e, stacked: e ? "first" : void 0, children: /* @__PURE__ */ u(Re, { children: [
|
|
483
459
|
/* @__PURE__ */ n("div", {}),
|
|
484
460
|
/* @__PURE__ */ n("div", {}),
|
|
485
461
|
/* @__PURE__ */ n("div", {})
|
|
486
462
|
] }) }) }) })
|
|
487
|
-
),
|
|
463
|
+
), Fe = s.p`
|
|
488
464
|
&& {
|
|
489
465
|
font-size: ${(e) => {
|
|
490
466
|
var t;
|
|
@@ -499,77 +475,77 @@ const Le = (e, t) => {
|
|
|
499
475
|
var t;
|
|
500
476
|
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
501
477
|
}};
|
|
502
|
-
`,
|
|
503
|
-
if (!t && !
|
|
478
|
+
`, ee = (e) => new Date(e).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }), R = ({ className: e, name: t, timestamp: r }) => {
|
|
479
|
+
if (!t && !r)
|
|
504
480
|
return null;
|
|
505
|
-
let
|
|
506
|
-
return t ?
|
|
481
|
+
let o = "";
|
|
482
|
+
return t ? r ? o = `${t}: ${ee(r)}` : o = t : r && (o = ee(r)), /* @__PURE__ */ n(Fe, { children: o });
|
|
507
483
|
}, le = ({
|
|
508
484
|
className: e,
|
|
509
485
|
children: t,
|
|
510
|
-
sender:
|
|
511
|
-
timestamp:
|
|
486
|
+
sender: r,
|
|
487
|
+
timestamp: o
|
|
512
488
|
}) => {
|
|
513
|
-
const { avatar:
|
|
514
|
-
return /* @__PURE__ */
|
|
515
|
-
|
|
489
|
+
const { avatar: a, name: i } = r, { avatarSize: h } = I();
|
|
490
|
+
return /* @__PURE__ */ u(
|
|
491
|
+
Pe,
|
|
516
492
|
{
|
|
517
|
-
hasAvatar: !!
|
|
518
|
-
className:
|
|
493
|
+
hasAvatar: !!a,
|
|
494
|
+
className: M(
|
|
519
495
|
e,
|
|
520
496
|
"humany-conversation-agent-message"
|
|
521
497
|
),
|
|
522
498
|
children: [
|
|
523
|
-
|
|
499
|
+
a && /* @__PURE__ */ n(Te, { avatarSize: h, children: typeof a == "string" ? (
|
|
524
500
|
// eslint-disable-next-line jsx-a11y/alt-text
|
|
525
|
-
/* @__PURE__ */ n("img", { src:
|
|
526
|
-
) : /* @__PURE__ */ n(x, { symbol:
|
|
501
|
+
/* @__PURE__ */ n("img", { src: a })
|
|
502
|
+
) : /* @__PURE__ */ n(x, { symbol: a }) }),
|
|
527
503
|
t,
|
|
528
|
-
/* @__PURE__ */ n(R, { name: i, timestamp:
|
|
504
|
+
/* @__PURE__ */ n(R, { name: i, timestamp: o })
|
|
529
505
|
]
|
|
530
506
|
}
|
|
531
507
|
);
|
|
532
|
-
},
|
|
508
|
+
}, Pe = s.div`
|
|
533
509
|
display: grid;
|
|
534
510
|
margin-right: 10%;
|
|
535
511
|
width: 90%;
|
|
536
|
-
${(e) => e.hasAvatar ?
|
|
512
|
+
${(e) => e.hasAvatar ? g`
|
|
537
513
|
grid-template-columns: auto 1fr;
|
|
538
514
|
grid-template-rows: 1fr auto;
|
|
539
515
|
grid-template-areas:
|
|
540
516
|
'avatar content'
|
|
541
517
|
'. info';
|
|
542
|
-
` :
|
|
518
|
+
` : g`
|
|
543
519
|
grid-template-columns: 1fr;
|
|
544
520
|
grid-template-rows: 1fr auto;
|
|
545
521
|
grid-template-areas:
|
|
546
522
|
'content'
|
|
547
523
|
'info';
|
|
548
524
|
`};
|
|
549
|
-
`,
|
|
550
|
-
({ className: e, children: t, timestamp:
|
|
551
|
-
|
|
525
|
+
`, Ue = Q(
|
|
526
|
+
({ className: e, children: t, timestamp: r, discrete: o, fullWidth: a }, i) => /* @__PURE__ */ n(
|
|
527
|
+
_e,
|
|
552
528
|
{
|
|
553
529
|
ref: i,
|
|
554
|
-
className:
|
|
555
|
-
fullWidth:
|
|
556
|
-
children:
|
|
530
|
+
className: M(e, "humany-conversation-system-message"),
|
|
531
|
+
fullWidth: a,
|
|
532
|
+
children: o ? /* @__PURE__ */ u(Ve, { className: "humany-conversation-discrete-message", children: [
|
|
557
533
|
t,
|
|
558
|
-
/* @__PURE__ */ n(R, { timestamp:
|
|
559
|
-
] }) : /* @__PURE__ */
|
|
534
|
+
/* @__PURE__ */ n(R, { timestamp: r })
|
|
535
|
+
] }) : /* @__PURE__ */ u(B, { children: [
|
|
560
536
|
t,
|
|
561
|
-
/* @__PURE__ */ n(R, { timestamp:
|
|
537
|
+
/* @__PURE__ */ n(R, { timestamp: r })
|
|
562
538
|
] })
|
|
563
539
|
}
|
|
564
540
|
)
|
|
565
|
-
),
|
|
541
|
+
), _e = s.div`
|
|
566
542
|
${(e) => e.fullWidth && "width: 100%"};
|
|
567
543
|
padding: 0 ${(e) => {
|
|
568
544
|
var t;
|
|
569
545
|
return (t = e.theme.sizes) == null ? void 0 : t.large;
|
|
570
546
|
}};
|
|
571
547
|
overflow: auto;
|
|
572
|
-
`,
|
|
548
|
+
`, Ve = s.div`
|
|
573
549
|
text-align: center;
|
|
574
550
|
word-wrap: break-word;
|
|
575
551
|
font-size: ${(e) => {
|
|
@@ -583,49 +559,49 @@ const Le = (e, t) => {
|
|
|
583
559
|
> p {
|
|
584
560
|
margin: 0;
|
|
585
561
|
}
|
|
586
|
-
`,
|
|
587
|
-
const { userLabel:
|
|
588
|
-
return /* @__PURE__ */
|
|
589
|
-
|
|
562
|
+
`, qe = ({ className: e, children: t, timestamp: r }) => {
|
|
563
|
+
const { userLabel: o = "" } = I();
|
|
564
|
+
return /* @__PURE__ */ u(
|
|
565
|
+
Ye,
|
|
590
566
|
{
|
|
591
|
-
className:
|
|
567
|
+
className: M(e, "humany-conversation-user-message"),
|
|
592
568
|
children: [
|
|
593
569
|
t,
|
|
594
|
-
/* @__PURE__ */ n(R, { name:
|
|
570
|
+
/* @__PURE__ */ n(R, { name: o, timestamp: r })
|
|
595
571
|
]
|
|
596
572
|
}
|
|
597
573
|
);
|
|
598
|
-
},
|
|
574
|
+
}, Ye = s.div`
|
|
599
575
|
margin-left: 10%;
|
|
600
576
|
width: 90%;
|
|
601
577
|
display: flex;
|
|
602
578
|
flex-direction: column;
|
|
603
579
|
align-items: flex-end;
|
|
604
|
-
`,
|
|
580
|
+
`, X = (e) => Array.isArray(e) ? e : Object.keys(e).map((t) => ({
|
|
605
581
|
label: e[t],
|
|
606
582
|
actionKey: t
|
|
607
|
-
})),
|
|
608
|
-
|
|
583
|
+
})), Ge = ({ header: e, actions: t, dispatch: r }) => /* @__PURE__ */ n(
|
|
584
|
+
Je,
|
|
609
585
|
{
|
|
610
586
|
className: "humany-conversation-button-list",
|
|
611
587
|
header: e,
|
|
612
|
-
items:
|
|
613
|
-
renderItem: (
|
|
614
|
-
|
|
588
|
+
items: X(t),
|
|
589
|
+
renderItem: (o) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ u(
|
|
590
|
+
Qe,
|
|
615
591
|
{
|
|
616
592
|
onClick: () => {
|
|
617
|
-
|
|
593
|
+
r("action", o);
|
|
618
594
|
},
|
|
619
|
-
"aria-label":
|
|
620
|
-
title:
|
|
595
|
+
"aria-label": o.label,
|
|
596
|
+
title: o.label,
|
|
621
597
|
children: [
|
|
622
|
-
/* @__PURE__ */ n(x, { symbol:
|
|
623
|
-
|
|
598
|
+
/* @__PURE__ */ n(x, { symbol: o.symbol }),
|
|
599
|
+
o.label
|
|
624
600
|
]
|
|
625
601
|
}
|
|
626
|
-
) },
|
|
602
|
+
) }, o.actionKey)
|
|
627
603
|
}
|
|
628
|
-
),
|
|
604
|
+
), Je = s(K)`
|
|
629
605
|
${j}
|
|
630
606
|
> ul {
|
|
631
607
|
display: flex;
|
|
@@ -639,7 +615,7 @@ const Le = (e, t) => {
|
|
|
639
615
|
}
|
|
640
616
|
}
|
|
641
617
|
${C}
|
|
642
|
-
`,
|
|
618
|
+
`, Qe = s(z)`
|
|
643
619
|
${G};
|
|
644
620
|
|
|
645
621
|
display: block;
|
|
@@ -656,7 +632,7 @@ const Le = (e, t) => {
|
|
|
656
632
|
overflow: hidden;
|
|
657
633
|
text-overflow: ellipsis;
|
|
658
634
|
&:focus-visible {
|
|
659
|
-
${
|
|
635
|
+
${f}
|
|
660
636
|
background-color: transparent;
|
|
661
637
|
}
|
|
662
638
|
|
|
@@ -667,57 +643,57 @@ const Le = (e, t) => {
|
|
|
667
643
|
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
668
644
|
}};
|
|
669
645
|
}
|
|
670
|
-
`,
|
|
671
|
-
const
|
|
672
|
-
return !
|
|
673
|
-
},
|
|
674
|
-
${
|
|
646
|
+
`, Xe = ({ type: e, content: t = {} }) => {
|
|
647
|
+
const r = ye(e);
|
|
648
|
+
return !r || !e ? null : /* @__PURE__ */ n(we, { fallback: null, children: /* @__PURE__ */ n(r, { ...t }) });
|
|
649
|
+
}, Ze = ({ body: e }) => /* @__PURE__ */ n(et, { html: e }), et = s(Y)`
|
|
650
|
+
${be}
|
|
675
651
|
color: inherit;
|
|
676
652
|
white-space: pre-wrap;
|
|
677
653
|
${C}
|
|
678
654
|
a {
|
|
679
655
|
color: ${(e) => e.theme.colors.link};
|
|
680
656
|
&:focus-visible {
|
|
681
|
-
${
|
|
657
|
+
${f};
|
|
682
658
|
}
|
|
683
659
|
}
|
|
684
|
-
`,
|
|
685
|
-
|
|
660
|
+
`, tt = ({ header: e, actions: t, dispatch: r }) => /* @__PURE__ */ n(
|
|
661
|
+
nt,
|
|
686
662
|
{
|
|
687
663
|
className: "humany-conversation-item-list",
|
|
688
664
|
header: e,
|
|
689
|
-
items:
|
|
690
|
-
renderItem: (
|
|
691
|
-
var
|
|
692
|
-
return /* @__PURE__ */ n("li", { children: /* @__PURE__ */
|
|
693
|
-
((
|
|
665
|
+
items: X(t),
|
|
666
|
+
renderItem: (o) => {
|
|
667
|
+
var a;
|
|
668
|
+
return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ u(rt, { children: [
|
|
669
|
+
((a = o.symbol) == null ? void 0 : a.content) && /* @__PURE__ */ n("div", { className: "item-icon", children: /* @__PURE__ */ n(
|
|
694
670
|
x,
|
|
695
671
|
{
|
|
696
672
|
size: 22,
|
|
697
673
|
symbol: {
|
|
698
|
-
type:
|
|
699
|
-
content:
|
|
674
|
+
type: o.symbol.type,
|
|
675
|
+
content: o.symbol.content
|
|
700
676
|
}
|
|
701
677
|
}
|
|
702
678
|
) }),
|
|
703
|
-
/* @__PURE__ */
|
|
679
|
+
/* @__PURE__ */ u("div", { className: "item-body", children: [
|
|
704
680
|
/* @__PURE__ */ n(
|
|
705
|
-
|
|
681
|
+
z,
|
|
706
682
|
{
|
|
707
683
|
onClick: () => {
|
|
708
|
-
|
|
684
|
+
r("action", o);
|
|
709
685
|
},
|
|
710
|
-
"aria-label":
|
|
711
|
-
title:
|
|
712
|
-
children:
|
|
686
|
+
"aria-label": o.label,
|
|
687
|
+
title: o.label,
|
|
688
|
+
children: o.label
|
|
713
689
|
}
|
|
714
690
|
),
|
|
715
|
-
|
|
691
|
+
o.description && /* @__PURE__ */ n("p", { children: o.description })
|
|
716
692
|
] })
|
|
717
|
-
] }) },
|
|
693
|
+
] }) }, o.actionKey);
|
|
718
694
|
}
|
|
719
695
|
}
|
|
720
|
-
),
|
|
696
|
+
), nt = s(K)`
|
|
721
697
|
${j}
|
|
722
698
|
|
|
723
699
|
> .humany-paragraph {
|
|
@@ -731,7 +707,7 @@ const Le = (e, t) => {
|
|
|
731
707
|
|
|
732
708
|
${(e) => J(e)(
|
|
733
709
|
"h1",
|
|
734
|
-
|
|
710
|
+
g`
|
|
735
711
|
white-space: normal;
|
|
736
712
|
`
|
|
737
713
|
)}
|
|
@@ -755,7 +731,7 @@ const Le = (e, t) => {
|
|
|
755
731
|
border-bottom: none;
|
|
756
732
|
}
|
|
757
733
|
}
|
|
758
|
-
`,
|
|
734
|
+
`, rt = s.div`
|
|
759
735
|
display: flex;
|
|
760
736
|
gap: ${(e) => {
|
|
761
737
|
var t;
|
|
@@ -794,7 +770,7 @@ const Le = (e, t) => {
|
|
|
794
770
|
margin: 0;
|
|
795
771
|
|
|
796
772
|
&:focus-visible {
|
|
797
|
-
${
|
|
773
|
+
${f}
|
|
798
774
|
span {
|
|
799
775
|
color: ${(e) => {
|
|
800
776
|
var t;
|
|
@@ -804,24 +780,24 @@ const Le = (e, t) => {
|
|
|
804
780
|
}
|
|
805
781
|
}
|
|
806
782
|
}
|
|
807
|
-
`,
|
|
808
|
-
|
|
783
|
+
`, ot = ({ header: e, actions: t, dispatch: r }) => /* @__PURE__ */ n(
|
|
784
|
+
st,
|
|
809
785
|
{
|
|
810
786
|
className: "humany-conversation-link-list",
|
|
811
787
|
header: e,
|
|
812
|
-
items:
|
|
813
|
-
renderItem: (
|
|
814
|
-
|
|
788
|
+
items: X(t),
|
|
789
|
+
renderItem: (o) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ u(
|
|
790
|
+
at,
|
|
815
791
|
{
|
|
816
|
-
help:
|
|
792
|
+
help: o.actionKey === "help",
|
|
817
793
|
onClick: () => {
|
|
818
|
-
|
|
794
|
+
r("action", o);
|
|
819
795
|
},
|
|
820
|
-
"aria-label":
|
|
821
|
-
title:
|
|
796
|
+
"aria-label": o.label,
|
|
797
|
+
title: o.label,
|
|
822
798
|
children: [
|
|
823
|
-
|
|
824
|
-
|
|
799
|
+
o.label,
|
|
800
|
+
o.actionKey === "help" && /* @__PURE__ */ n(
|
|
825
801
|
x,
|
|
826
802
|
{
|
|
827
803
|
size: 14,
|
|
@@ -833,15 +809,15 @@ const Le = (e, t) => {
|
|
|
833
809
|
)
|
|
834
810
|
]
|
|
835
811
|
}
|
|
836
|
-
) },
|
|
812
|
+
) }, o.actionKey)
|
|
837
813
|
}
|
|
838
|
-
),
|
|
814
|
+
), st = s(K)`
|
|
839
815
|
${j}
|
|
840
816
|
${C}
|
|
841
817
|
|
|
842
818
|
${(e) => J(e)(
|
|
843
819
|
"h1",
|
|
844
|
-
|
|
820
|
+
g`
|
|
845
821
|
white-space: normal;
|
|
846
822
|
`
|
|
847
823
|
)}
|
|
@@ -857,7 +833,7 @@ const Le = (e, t) => {
|
|
|
857
833
|
margin: 0;
|
|
858
834
|
}
|
|
859
835
|
}
|
|
860
|
-
`,
|
|
836
|
+
`, at = s(z)`
|
|
861
837
|
display: block;
|
|
862
838
|
text-align: left;
|
|
863
839
|
font-weight: 300;
|
|
@@ -870,20 +846,20 @@ const Le = (e, t) => {
|
|
|
870
846
|
overflow: hidden;
|
|
871
847
|
|
|
872
848
|
${(e) => {
|
|
873
|
-
var t,
|
|
874
|
-
return e.help &&
|
|
849
|
+
var t, r;
|
|
850
|
+
return e.help && g`
|
|
875
851
|
color: ${(t = e.theme.colors) == null ? void 0 : t.text};
|
|
876
852
|
text-decoration: underline;
|
|
877
853
|
|
|
878
854
|
i,
|
|
879
855
|
svg {
|
|
880
|
-
margin-left: ${(
|
|
856
|
+
margin-left: ${(r = e.theme.sizes) == null ? void 0 : r.small};
|
|
881
857
|
}
|
|
882
858
|
`;
|
|
883
859
|
}}
|
|
884
860
|
|
|
885
861
|
&:focus-visible {
|
|
886
|
-
${
|
|
862
|
+
${f}
|
|
887
863
|
span {
|
|
888
864
|
color: ${(e) => {
|
|
889
865
|
var t;
|
|
@@ -892,18 +868,18 @@ const Le = (e, t) => {
|
|
|
892
868
|
text-decoration: underline;
|
|
893
869
|
}
|
|
894
870
|
}
|
|
895
|
-
`,
|
|
871
|
+
`, it = () => /* @__PURE__ */ n(lt, { className: "humany-conversation-separator" }), lt = s.div`
|
|
896
872
|
${(e) => e.theme.border && `border-bottom: ${e.theme.border};`}
|
|
897
873
|
width: 100%;
|
|
898
|
-
`,
|
|
874
|
+
`, ct = ({ text: e }) => /* @__PURE__ */ n(dt, { className: "humany-conversation-text", variant: "span", children: e }), dt = s(q)`
|
|
899
875
|
${C}
|
|
900
|
-
`,
|
|
876
|
+
`, mt = ({
|
|
901
877
|
header: e = "Video call",
|
|
902
878
|
acceptLabel: t = "Accept",
|
|
903
|
-
declineLabel:
|
|
904
|
-
dispatch:
|
|
879
|
+
declineLabel: r = "Decline",
|
|
880
|
+
dispatch: o
|
|
905
881
|
}) => {
|
|
906
|
-
const
|
|
882
|
+
const a = ke(() => [
|
|
907
883
|
{
|
|
908
884
|
label: t,
|
|
909
885
|
actionKey: "accept-video-call",
|
|
@@ -913,38 +889,38 @@ const Le = (e, t) => {
|
|
|
913
889
|
}
|
|
914
890
|
},
|
|
915
891
|
{
|
|
916
|
-
label:
|
|
892
|
+
label: r,
|
|
917
893
|
actionKey: "decline-video-call",
|
|
918
894
|
symbol: {
|
|
919
895
|
type: "Svg",
|
|
920
896
|
content: "close"
|
|
921
897
|
}
|
|
922
898
|
}
|
|
923
|
-
], [t,
|
|
899
|
+
], [t, r]);
|
|
924
900
|
return /* @__PURE__ */ n(
|
|
925
|
-
|
|
901
|
+
ut,
|
|
926
902
|
{
|
|
927
903
|
className: "humany-conversation-video-request",
|
|
928
904
|
header: e,
|
|
929
|
-
items:
|
|
905
|
+
items: a,
|
|
930
906
|
renderItem: (i) => {
|
|
931
|
-
const
|
|
907
|
+
const h = i.actionKey === "accept-video-call" ? "#70c48e" : "#da5c85";
|
|
932
908
|
return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
933
|
-
|
|
909
|
+
ht,
|
|
934
910
|
{
|
|
935
911
|
onClick: () => {
|
|
936
|
-
|
|
912
|
+
o("action", i);
|
|
937
913
|
},
|
|
938
914
|
"aria-label": i.label,
|
|
939
915
|
title: i.label,
|
|
940
|
-
bgColor:
|
|
916
|
+
bgColor: h,
|
|
941
917
|
children: /* @__PURE__ */ n(x, { symbol: i.symbol, size: 25 })
|
|
942
918
|
}
|
|
943
919
|
) }, i.actionKey);
|
|
944
920
|
}
|
|
945
921
|
}
|
|
946
922
|
);
|
|
947
|
-
},
|
|
923
|
+
}, ut = s(K)`
|
|
948
924
|
${(e) => j(e)}
|
|
949
925
|
> ul {
|
|
950
926
|
display: flex;
|
|
@@ -958,7 +934,7 @@ const Le = (e, t) => {
|
|
|
958
934
|
}
|
|
959
935
|
}
|
|
960
936
|
${(e) => C(e)}
|
|
961
|
-
`,
|
|
937
|
+
`, ht = s(z)`
|
|
962
938
|
${G};
|
|
963
939
|
|
|
964
940
|
background-color: ${(e) => e.bgColor};
|
|
@@ -971,7 +947,7 @@ const Le = (e, t) => {
|
|
|
971
947
|
border-radius: 100%;
|
|
972
948
|
|
|
973
949
|
&:focus-visible {
|
|
974
|
-
${
|
|
950
|
+
${f}
|
|
975
951
|
background-color: transparent;
|
|
976
952
|
|
|
977
953
|
i,
|
|
@@ -998,139 +974,139 @@ const Le = (e, t) => {
|
|
|
998
974
|
stroke: #fff;
|
|
999
975
|
}
|
|
1000
976
|
}
|
|
1001
|
-
`,
|
|
1002
|
-
|
|
977
|
+
`, gt = ([e, t]) => ({ type: e, content: t }), ft = ({ items: e, dispatch: t }) => /* @__PURE__ */ n(
|
|
978
|
+
pt,
|
|
1003
979
|
{
|
|
1004
980
|
className: "humany-message-list",
|
|
1005
|
-
items: e.map(
|
|
981
|
+
items: e.map(gt),
|
|
1006
982
|
renderLi: !0,
|
|
1007
|
-
renderItem: (
|
|
1008
|
-
switch (
|
|
983
|
+
renderItem: (r) => {
|
|
984
|
+
switch (r.type) {
|
|
1009
985
|
case k.Text:
|
|
1010
|
-
return /* @__PURE__ */ n(
|
|
986
|
+
return /* @__PURE__ */ n(ct, { text: r.content });
|
|
1011
987
|
case k.HTML:
|
|
1012
|
-
return /* @__PURE__ */ n(
|
|
988
|
+
return /* @__PURE__ */ n(Ze, { ...r.content });
|
|
1013
989
|
case k.Separator:
|
|
1014
|
-
return /* @__PURE__ */ n(
|
|
990
|
+
return /* @__PURE__ */ n(it, { ...r.content });
|
|
1015
991
|
case k.ItemList:
|
|
1016
|
-
return /* @__PURE__ */ n(
|
|
992
|
+
return /* @__PURE__ */ n(tt, { ...r.content, dispatch: t });
|
|
1017
993
|
case k.LinkList:
|
|
1018
|
-
return /* @__PURE__ */ n(
|
|
994
|
+
return /* @__PURE__ */ n(ot, { ...r.content, dispatch: t });
|
|
1019
995
|
case k.ButtonList:
|
|
1020
|
-
return /* @__PURE__ */ n(
|
|
996
|
+
return /* @__PURE__ */ n(Ge, { ...r.content, dispatch: t });
|
|
1021
997
|
case k.VideoRequest:
|
|
1022
|
-
return /* @__PURE__ */ n(
|
|
998
|
+
return /* @__PURE__ */ n(mt, { ...r.content, dispatch: t });
|
|
1023
999
|
default:
|
|
1024
|
-
return /* @__PURE__ */ n(
|
|
1000
|
+
return /* @__PURE__ */ n(Xe, { type: r.type, content: r.content });
|
|
1025
1001
|
}
|
|
1026
1002
|
}
|
|
1027
1003
|
}
|
|
1028
|
-
),
|
|
1029
|
-
${
|
|
1004
|
+
), pt = s(re)`
|
|
1005
|
+
${$e}
|
|
1030
1006
|
|
|
1031
1007
|
> li {
|
|
1032
1008
|
margin: 0;
|
|
1033
1009
|
}
|
|
1034
|
-
`,
|
|
1035
|
-
({ className: e, timestamp: t, sender:
|
|
1036
|
-
const
|
|
1010
|
+
`, yt = Q(
|
|
1011
|
+
({ className: e, timestamp: t, sender: r, type: o, content: a }, i) => {
|
|
1012
|
+
const h = ae(
|
|
1037
1013
|
(d) => {
|
|
1038
1014
|
let l = "first";
|
|
1039
|
-
return
|
|
1015
|
+
return a.length > 1 && (l = d === 0 ? "first" : d + 1 === a.length ? "last" : "middle"), l;
|
|
1040
1016
|
},
|
|
1041
|
-
[
|
|
1042
|
-
), c = () => /* @__PURE__ */ n(B, { children:
|
|
1043
|
-
const { key: l, body:
|
|
1017
|
+
[a]
|
|
1018
|
+
), c = () => /* @__PURE__ */ n(B, { children: a.map((d) => {
|
|
1019
|
+
const { key: l, body: $, title: S, form: L, actions: w } = d, y = !!$ && !S && !L && !w;
|
|
1044
1020
|
return /* @__PURE__ */ n(
|
|
1045
|
-
|
|
1021
|
+
Ue,
|
|
1046
1022
|
{
|
|
1047
1023
|
className: e,
|
|
1048
|
-
discrete:
|
|
1024
|
+
discrete: y,
|
|
1049
1025
|
ref: i,
|
|
1050
1026
|
timestamp: t,
|
|
1051
|
-
fullWidth: !!
|
|
1052
|
-
children:
|
|
1027
|
+
fullWidth: !!L || !!w,
|
|
1028
|
+
children: y && $ ? /* @__PURE__ */ n(Y, { html: $ }) : /* @__PURE__ */ n(E, { isSystem: !0, content: d })
|
|
1053
1029
|
},
|
|
1054
1030
|
l
|
|
1055
1031
|
);
|
|
1056
|
-
}) }),
|
|
1057
|
-
|
|
1032
|
+
}) }), p = () => /* @__PURE__ */ n(le, { sender: r, timestamp: t, className: e, children: /* @__PURE__ */ n(P, { className: "humany-message-content-bundle", children: a.map((d, l) => /* @__PURE__ */ n(
|
|
1033
|
+
U,
|
|
1058
1034
|
{
|
|
1059
1035
|
className: "humany-message-container",
|
|
1060
1036
|
left: !0,
|
|
1061
1037
|
ref: i,
|
|
1062
1038
|
children: /* @__PURE__ */ n(
|
|
1063
|
-
|
|
1039
|
+
E,
|
|
1064
1040
|
{
|
|
1065
1041
|
content: d,
|
|
1066
|
-
stacked:
|
|
1042
|
+
stacked: h(l)
|
|
1067
1043
|
}
|
|
1068
1044
|
)
|
|
1069
1045
|
},
|
|
1070
1046
|
d.key
|
|
1071
|
-
)) }) }),
|
|
1072
|
-
|
|
1047
|
+
)) }) }), v = () => /* @__PURE__ */ n(qe, { timestamp: t, className: e, children: /* @__PURE__ */ n(P, { className: "humany-message-content-bundle", children: a.map((d, l) => /* @__PURE__ */ n(
|
|
1048
|
+
U,
|
|
1073
1049
|
{
|
|
1074
1050
|
className: "humany-message-container",
|
|
1075
1051
|
right: !0,
|
|
1076
1052
|
ref: i,
|
|
1077
1053
|
children: /* @__PURE__ */ n(
|
|
1078
|
-
|
|
1054
|
+
E,
|
|
1079
1055
|
{
|
|
1080
1056
|
isUser: !0,
|
|
1081
1057
|
content: d,
|
|
1082
|
-
stacked:
|
|
1058
|
+
stacked: h(l)
|
|
1083
1059
|
}
|
|
1084
1060
|
)
|
|
1085
1061
|
},
|
|
1086
1062
|
d.key
|
|
1087
1063
|
)) }) });
|
|
1088
|
-
switch (
|
|
1064
|
+
switch (o) {
|
|
1089
1065
|
case W.System:
|
|
1090
1066
|
return c();
|
|
1091
1067
|
case W.Agent:
|
|
1092
|
-
return
|
|
1068
|
+
return p();
|
|
1093
1069
|
case W.User:
|
|
1094
|
-
return
|
|
1070
|
+
return v();
|
|
1095
1071
|
default:
|
|
1096
1072
|
return null;
|
|
1097
1073
|
}
|
|
1098
1074
|
}
|
|
1099
|
-
),
|
|
1100
|
-
const
|
|
1101
|
-
return
|
|
1102
|
-
|
|
1075
|
+
), E = ({ content: e, isUser: t, isSystem: r, stacked: o }) => {
|
|
1076
|
+
const a = V(), { title: i, body: h, actions: c, form: p, items: v } = e;
|
|
1077
|
+
return v ? /* @__PURE__ */ n(_, { className: "humany-message-content", user: !!t, stacked: o, children: /* @__PURE__ */ n(ft, { items: v, dispatch: a }) }) : /* @__PURE__ */ u(
|
|
1078
|
+
_,
|
|
1103
1079
|
{
|
|
1104
1080
|
className: "humany-message-content",
|
|
1105
|
-
padded: !
|
|
1081
|
+
padded: !r,
|
|
1106
1082
|
user: !!t,
|
|
1107
|
-
stacked:
|
|
1108
|
-
fullWidth: !!
|
|
1083
|
+
stacked: o,
|
|
1084
|
+
fullWidth: !!p || !!c,
|
|
1109
1085
|
children: [
|
|
1110
|
-
i && /* @__PURE__ */ n(A, { children: /* @__PURE__ */ n(
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1086
|
+
i && /* @__PURE__ */ n(A, { children: /* @__PURE__ */ n(Be, { variant: "h2", children: i }) }),
|
|
1087
|
+
h && /* @__PURE__ */ n(A, { children: /* @__PURE__ */ n(De, { html: h }) }),
|
|
1088
|
+
p && /* @__PURE__ */ n(A, { children: /* @__PURE__ */ n(
|
|
1089
|
+
Oe,
|
|
1114
1090
|
{
|
|
1115
|
-
...
|
|
1116
|
-
onChange: (l,
|
|
1117
|
-
|
|
1118
|
-
data:
|
|
1119
|
-
formKey:
|
|
1091
|
+
...p,
|
|
1092
|
+
onChange: (l, $) => {
|
|
1093
|
+
a("form", {
|
|
1094
|
+
data: $,
|
|
1095
|
+
formKey: p.schema.id,
|
|
1120
1096
|
actionKey: l
|
|
1121
1097
|
});
|
|
1122
1098
|
}
|
|
1123
1099
|
}
|
|
1124
1100
|
) }),
|
|
1125
1101
|
c && /* @__PURE__ */ n(A, { children: /* @__PURE__ */ n(
|
|
1126
|
-
|
|
1102
|
+
We,
|
|
1127
1103
|
{
|
|
1128
1104
|
items: Object.keys(c).map((l) => ({ label: c[l], actionKey: l })),
|
|
1129
1105
|
renderItem: (l) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
1130
|
-
|
|
1106
|
+
Ee,
|
|
1131
1107
|
{
|
|
1132
1108
|
onClick: () => {
|
|
1133
|
-
|
|
1109
|
+
a("action", l.actionKey);
|
|
1134
1110
|
},
|
|
1135
1111
|
children: l.label
|
|
1136
1112
|
}
|
|
@@ -1148,31 +1124,31 @@ const Le = (e, t) => {
|
|
|
1148
1124
|
behavior: "smooth"
|
|
1149
1125
|
});
|
|
1150
1126
|
}, 250);
|
|
1151
|
-
}, []), [t,
|
|
1152
|
-
messages:
|
|
1153
|
-
loading:
|
|
1127
|
+
}, []), [t, r] = ne(!0), {
|
|
1128
|
+
messages: o,
|
|
1129
|
+
loading: a,
|
|
1154
1130
|
typingActors: i = []
|
|
1155
|
-
} =
|
|
1156
|
-
return /* @__PURE__ */
|
|
1157
|
-
/* @__PURE__ */
|
|
1158
|
-
|
|
1159
|
-
const { type:
|
|
1131
|
+
} = I(), h = () => i && i.length ? i.map((c, p) => /* @__PURE__ */ n(F, { id: `typing_${c.name}`, children: /* @__PURE__ */ n(le, { timestamp: Date.now(), sender: c, children: /* @__PURE__ */ n(Z, { boxed: !0, ref: e }) }) }, `typing_${c.name}`)) : null;
|
|
1132
|
+
return /* @__PURE__ */ u(B, { children: [
|
|
1133
|
+
/* @__PURE__ */ u(bt, { tabIndex: 0, scrollableCss: t, ref: r, children: [
|
|
1134
|
+
o && o.length ? o.map((c, p) => {
|
|
1135
|
+
const { type: v, timestamp: d, sender: l, content: $ } = c;
|
|
1160
1136
|
return /* @__PURE__ */ n(
|
|
1161
|
-
|
|
1137
|
+
F,
|
|
1162
1138
|
{
|
|
1163
1139
|
className: "humany-conversation-entry",
|
|
1164
1140
|
tabIndex: -1,
|
|
1165
|
-
children: /* @__PURE__ */ n(
|
|
1141
|
+
children: /* @__PURE__ */ n(yt, { ...c, ref: e })
|
|
1166
1142
|
},
|
|
1167
|
-
`${
|
|
1143
|
+
`${v}_${l == null ? void 0 : l.name}_${d}_${$[0].key}`
|
|
1168
1144
|
);
|
|
1169
1145
|
}) : null,
|
|
1170
|
-
|
|
1171
|
-
|
|
1146
|
+
h(),
|
|
1147
|
+
a && /* @__PURE__ */ n(F, { children: /* @__PURE__ */ n(Z, { ref: e }) })
|
|
1172
1148
|
] }),
|
|
1173
|
-
/* @__PURE__ */ n(
|
|
1149
|
+
/* @__PURE__ */ n(ze, {})
|
|
1174
1150
|
] });
|
|
1175
|
-
},
|
|
1151
|
+
}, bt = s.div`
|
|
1176
1152
|
display: flex;
|
|
1177
1153
|
flex-direction: column;
|
|
1178
1154
|
align-items: stretch;
|
|
@@ -1183,9 +1159,9 @@ const Le = (e, t) => {
|
|
|
1183
1159
|
}};
|
|
1184
1160
|
${(e) => !!e.scrollableCss && e.scrollableCss};
|
|
1185
1161
|
&:focus-visible {
|
|
1186
|
-
${(e) =>
|
|
1162
|
+
${(e) => f(e)};
|
|
1187
1163
|
}
|
|
1188
|
-
`,
|
|
1164
|
+
`, F = s.div`
|
|
1189
1165
|
margin: 0;
|
|
1190
1166
|
margin-bottom: ${(e) => {
|
|
1191
1167
|
var t;
|
|
@@ -1219,39 +1195,39 @@ const Le = (e, t) => {
|
|
|
1219
1195
|
}
|
|
1220
1196
|
${(e) => J(e)(
|
|
1221
1197
|
"h1",
|
|
1222
|
-
|
|
1198
|
+
g`
|
|
1223
1199
|
font-weight: normal;
|
|
1224
1200
|
`
|
|
1225
1201
|
)}
|
|
1226
|
-
`,
|
|
1227
|
-
const t =
|
|
1228
|
-
return
|
|
1202
|
+
`, $t = ({ dispatch: e }) => {
|
|
1203
|
+
const t = Ce(null);
|
|
1204
|
+
return se(() => {
|
|
1229
1205
|
t.current && t.current.parentNode && e("overlay-mounted", t.current);
|
|
1230
1206
|
}, [t]), /* @__PURE__ */ n(
|
|
1231
|
-
|
|
1207
|
+
oe,
|
|
1232
1208
|
{
|
|
1233
1209
|
portalId: "humany-conversation-overlay-portal",
|
|
1234
1210
|
className: "humany-conversation-overlay-outlet",
|
|
1235
1211
|
ref: t
|
|
1236
1212
|
}
|
|
1237
1213
|
);
|
|
1238
|
-
},
|
|
1214
|
+
}, vt = ({
|
|
1239
1215
|
dispatch: e,
|
|
1240
1216
|
header: t,
|
|
1241
|
-
buttonLabel:
|
|
1242
|
-
}) => /* @__PURE__ */
|
|
1243
|
-
|
|
1217
|
+
buttonLabel: r
|
|
1218
|
+
}) => /* @__PURE__ */ u(
|
|
1219
|
+
xt,
|
|
1244
1220
|
{
|
|
1245
1221
|
portalId: "humany-conversation-portal",
|
|
1246
1222
|
className: "humany-conversation-outlet",
|
|
1247
1223
|
children: [
|
|
1248
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ u(wt, { className: "humany-conversation-outlet-head", children: [
|
|
1249
1225
|
/* @__PURE__ */ n(
|
|
1250
|
-
|
|
1226
|
+
Ct,
|
|
1251
1227
|
{
|
|
1252
1228
|
className: "humany-conversation-outlet-head-button",
|
|
1253
|
-
"aria-label":
|
|
1254
|
-
title:
|
|
1229
|
+
"aria-label": r,
|
|
1230
|
+
title: r,
|
|
1255
1231
|
onClick: () => e("hide-overlay-conversation"),
|
|
1256
1232
|
children: /* @__PURE__ */ n(
|
|
1257
1233
|
x,
|
|
@@ -1266,7 +1242,7 @@ const Le = (e, t) => {
|
|
|
1266
1242
|
}
|
|
1267
1243
|
),
|
|
1268
1244
|
t && /* @__PURE__ */ n(
|
|
1269
|
-
|
|
1245
|
+
kt,
|
|
1270
1246
|
{
|
|
1271
1247
|
className: "humany-conversation-outlet-header",
|
|
1272
1248
|
variant: "h1",
|
|
@@ -1277,7 +1253,7 @@ const Le = (e, t) => {
|
|
|
1277
1253
|
/* @__PURE__ */ n(ce, {})
|
|
1278
1254
|
]
|
|
1279
1255
|
}
|
|
1280
|
-
),
|
|
1256
|
+
), xt = s(oe)`
|
|
1281
1257
|
z-index: 11;
|
|
1282
1258
|
top: auto;
|
|
1283
1259
|
height: 65%;
|
|
@@ -1292,7 +1268,7 @@ const Le = (e, t) => {
|
|
|
1292
1268
|
var t;
|
|
1293
1269
|
return (t = e.theme.sizes) == null ? void 0 : t.large;
|
|
1294
1270
|
}};
|
|
1295
|
-
`,
|
|
1271
|
+
`, wt = s.div`
|
|
1296
1272
|
display: flex;
|
|
1297
1273
|
flex-direction: column;
|
|
1298
1274
|
justify-content: center;
|
|
@@ -1306,7 +1282,7 @@ const Le = (e, t) => {
|
|
|
1306
1282
|
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
1307
1283
|
}};
|
|
1308
1284
|
${(e) => e.theme.border && `border-bottom: ${e.theme.border};`}
|
|
1309
|
-
`,
|
|
1285
|
+
`, kt = s(q)`
|
|
1310
1286
|
font-size: ${(e) => {
|
|
1311
1287
|
var t;
|
|
1312
1288
|
return (t = e.theme.fonts) == null ? void 0 : t.medium;
|
|
@@ -1316,7 +1292,7 @@ const Le = (e, t) => {
|
|
|
1316
1292
|
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
1317
1293
|
}};
|
|
1318
1294
|
margin: 0;
|
|
1319
|
-
`,
|
|
1295
|
+
`, Ct = s(z)`
|
|
1320
1296
|
display: flex;
|
|
1321
1297
|
align-items: center;
|
|
1322
1298
|
justify-content: center;
|
|
@@ -1330,7 +1306,7 @@ const Le = (e, t) => {
|
|
|
1330
1306
|
${(e) => e.theme.borderRadius && `border-radius: ${e.theme.borderRadius};`}
|
|
1331
1307
|
|
|
1332
1308
|
&:focus-visible {
|
|
1333
|
-
${
|
|
1309
|
+
${f};
|
|
1334
1310
|
}
|
|
1335
1311
|
|
|
1336
1312
|
svg line {
|
|
@@ -1339,41 +1315,41 @@ const Le = (e, t) => {
|
|
|
1339
1315
|
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
1340
1316
|
}};
|
|
1341
1317
|
}
|
|
1342
|
-
`,
|
|
1318
|
+
`, jt = ({ className: e, ...t }) => {
|
|
1343
1319
|
const {
|
|
1344
|
-
overlay:
|
|
1345
|
-
overlayConversationHeader:
|
|
1346
|
-
overlayConversationCloseLabel:
|
|
1320
|
+
overlay: r,
|
|
1321
|
+
overlayConversationHeader: o,
|
|
1322
|
+
overlayConversationCloseLabel: a,
|
|
1347
1323
|
conversationControllerId: i
|
|
1348
|
-
} =
|
|
1349
|
-
return /* @__PURE__ */
|
|
1350
|
-
|
|
1324
|
+
} = I(), h = V();
|
|
1325
|
+
return /* @__PURE__ */ u(
|
|
1326
|
+
ve.Provider,
|
|
1351
1327
|
{
|
|
1352
1328
|
value: i ? { id: i } : null,
|
|
1353
1329
|
children: [
|
|
1354
1330
|
/* @__PURE__ */ n(
|
|
1355
|
-
|
|
1331
|
+
St,
|
|
1356
1332
|
{
|
|
1357
1333
|
...t,
|
|
1358
|
-
className:
|
|
1334
|
+
className: M(e, "humany-conversation-component"),
|
|
1359
1335
|
children: /* @__PURE__ */ n(ce, {})
|
|
1360
1336
|
}
|
|
1361
1337
|
),
|
|
1362
|
-
|
|
1363
|
-
/* @__PURE__ */ n(
|
|
1364
|
-
|
|
1365
|
-
|
|
1338
|
+
r && /* @__PURE__ */ u(B, { children: [
|
|
1339
|
+
/* @__PURE__ */ n($t, { dispatch: h }),
|
|
1340
|
+
r.conversation && /* @__PURE__ */ n(
|
|
1341
|
+
vt,
|
|
1366
1342
|
{
|
|
1367
|
-
dispatch:
|
|
1368
|
-
header:
|
|
1369
|
-
buttonLabel:
|
|
1343
|
+
dispatch: h,
|
|
1344
|
+
header: o,
|
|
1345
|
+
buttonLabel: a
|
|
1370
1346
|
}
|
|
1371
1347
|
)
|
|
1372
1348
|
] })
|
|
1373
1349
|
]
|
|
1374
1350
|
}
|
|
1375
1351
|
);
|
|
1376
|
-
},
|
|
1352
|
+
}, St = s.div`
|
|
1377
1353
|
position: absolute;
|
|
1378
1354
|
right: 0;
|
|
1379
1355
|
left: 0;
|
|
@@ -1384,5 +1360,5 @@ const Le = (e, t) => {
|
|
|
1384
1360
|
flex-direction: column;
|
|
1385
1361
|
`;
|
|
1386
1362
|
export {
|
|
1387
|
-
|
|
1363
|
+
jt as default
|
|
1388
1364
|
};
|