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