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