@botonic/webchat-react 2.24.0 โ 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/index.js +1 -1
- package/lib/components/webchat-app/webchat-app.d.ts +9 -1
- package/lib/components/webchat-input/icons/attachment-icon.d.ts +1 -0
- package/lib/components/webchat-input/icons/emoji-icon.d.ts +1 -0
- package/lib/components/webchat-input/icons/microphone-icon.d.ts +1 -0
- package/lib/components/webchat-input/icons/send-icon.d.ts +1 -0
- package/lib/components/webchat-input/icons/svg-attrs.d.ts +7 -0
- package/lib/components/webchat-input/use-webchat-input.d.ts +10 -3
- package/lib/components/webchat-messages/use-custom-scrollbar.d.ts +11 -0
- package/lib/types/webchat-props.d.ts +16 -0
- package/package.json +3 -3
- package/styles.css +49 -5
- package/trigger.js +2 -2
- package/webchat-app-CLGvs-LL.js +2518 -0
- package/webchat-app-CtAHJapU.js +0 -2285
|
@@ -0,0 +1,2518 @@
|
|
|
1
|
+
import { jsx as t, jsxs as g, Fragment as ve } from "react/jsx-runtime";
|
|
2
|
+
import Ce, { useState as B, useMemo as se, useEffect as P, forwardRef as $, useContext as ye, createContext as we, useRef as T, useCallback as h } from "react";
|
|
3
|
+
import { cx as k, cva as A } from "class-variance-authority";
|
|
4
|
+
import { WebchatController as Te, setupGlobalWebchatAPI as ke, isCloseWebviewMessage as Se, isWebviewPostMessage as Pe, WEBVIEW_MESSAGE_TYPES as J } from "@botonic/webchat-core";
|
|
5
|
+
import { useSelector as E } from "@xstate/react";
|
|
6
|
+
import { WebchatMessageFactory as $e, MessageSentBy as oe } from "@botonic/shared";
|
|
7
|
+
function Le(e) {
|
|
8
|
+
const [n, s] = B(""), a = se(() => {
|
|
9
|
+
console.log("๐๏ธ Creating WebchatController with config:", e);
|
|
10
|
+
const i = new Te(e);
|
|
11
|
+
return i.initialize().catch((b) => {
|
|
12
|
+
console.error("โ Failed to initialize webchat:", b);
|
|
13
|
+
}), i;
|
|
14
|
+
}, [e.appId]), l = E(
|
|
15
|
+
a.machine,
|
|
16
|
+
(i) => {
|
|
17
|
+
const b = i.context.messageActors;
|
|
18
|
+
return b ? Array.from(b.values()) : [];
|
|
19
|
+
}
|
|
20
|
+
), u = E(
|
|
21
|
+
a.machine,
|
|
22
|
+
(i) => i.context.isOpen || !1
|
|
23
|
+
), o = E(
|
|
24
|
+
a.machine,
|
|
25
|
+
(i) => i.matches("operational")
|
|
26
|
+
), d = E(
|
|
27
|
+
a.machine,
|
|
28
|
+
(i) => i.matches("connectionFailed")
|
|
29
|
+
), r = E(
|
|
30
|
+
a.machine,
|
|
31
|
+
(i) => i.context.connectionStatus || "disconnected"
|
|
32
|
+
), m = E(
|
|
33
|
+
a.machine,
|
|
34
|
+
(i) => i.context.overlayActor
|
|
35
|
+
), c = E(
|
|
36
|
+
m,
|
|
37
|
+
(i) => i.context.overlayState
|
|
38
|
+
);
|
|
39
|
+
return P(() => (ke(a), () => {
|
|
40
|
+
console.log("๐งน Cleaning up webchat controller"), a.destroy();
|
|
41
|
+
}), [a]), {
|
|
42
|
+
// Framework-agnostic controller - all webchat functionality
|
|
43
|
+
controller: a,
|
|
44
|
+
// React-specific UI state (minimal)
|
|
45
|
+
inputValue: n,
|
|
46
|
+
setInputValue: s,
|
|
47
|
+
// XState machine state (direct from machine via useSelector)
|
|
48
|
+
isOpen: u,
|
|
49
|
+
isInitialized: o,
|
|
50
|
+
initializationError: d,
|
|
51
|
+
messageActors: l,
|
|
52
|
+
connectionStatus: r,
|
|
53
|
+
// Overlay state (webview or cover component)
|
|
54
|
+
overlayState: c,
|
|
55
|
+
// Configuration
|
|
56
|
+
avatarConfig: e.avatarConfig,
|
|
57
|
+
// Custom messages
|
|
58
|
+
customMessages: e.customMessages
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const Ne = we(null), Ee = $(({ children: e, ...n }, s) => {
|
|
62
|
+
const a = Le(n);
|
|
63
|
+
Ce.useImperativeHandle(s, () => a.controller, [a.controller]);
|
|
64
|
+
const l = {
|
|
65
|
+
state: a,
|
|
66
|
+
controller: a.controller
|
|
67
|
+
// Direct access to controller
|
|
68
|
+
};
|
|
69
|
+
return /* @__PURE__ */ t(Ne.Provider, { value: l, children: e });
|
|
70
|
+
});
|
|
71
|
+
function ee() {
|
|
72
|
+
const e = ye(Ne);
|
|
73
|
+
if (!e)
|
|
74
|
+
throw new Error("useWebchatContext must be used within a WebchatProvider");
|
|
75
|
+
return e;
|
|
76
|
+
}
|
|
77
|
+
const De = "button-component-module__buttonComponent___KMwSR", Ae = "button-component-module__secondary___TTpBp", ze = "button-component-module__primary___bD2jQ", ue = {
|
|
78
|
+
buttonComponent: De,
|
|
79
|
+
secondary: Ae,
|
|
80
|
+
primary: ze
|
|
81
|
+
}, ie = $(
|
|
82
|
+
({
|
|
83
|
+
text: e,
|
|
84
|
+
disabled: n = !1,
|
|
85
|
+
onClick: s,
|
|
86
|
+
button: a,
|
|
87
|
+
className: l,
|
|
88
|
+
variant: u = "secondary"
|
|
89
|
+
}, o) => /* @__PURE__ */ t(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
ref: o,
|
|
93
|
+
disabled: n,
|
|
94
|
+
onClick: (r) => {
|
|
95
|
+
r.preventDefault(), r.stopPropagation(), s?.(a);
|
|
96
|
+
},
|
|
97
|
+
className: k(
|
|
98
|
+
ue.buttonComponent,
|
|
99
|
+
u === "primary" && ue.primary,
|
|
100
|
+
u === "secondary" && ue.secondary,
|
|
101
|
+
l
|
|
102
|
+
),
|
|
103
|
+
type: "button",
|
|
104
|
+
children: e
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
), Re = "confirm-modal-module__overlay___rRE3G", Oe = "confirm-modal-module__modal___AliW3", Ve = "confirm-modal-module__title___nOVLU", We = "confirm-modal-module__message___NiTmg", He = "confirm-modal-module__buttons___T9sSa", te = {
|
|
108
|
+
overlay: Re,
|
|
109
|
+
modal: Oe,
|
|
110
|
+
title: Ve,
|
|
111
|
+
message: We,
|
|
112
|
+
buttons: He
|
|
113
|
+
};
|
|
114
|
+
function je(e) {
|
|
115
|
+
return e === !1 || e === void 0 ? null : e === !0 ? {
|
|
116
|
+
message: "Are you sure you want to close?"
|
|
117
|
+
} : typeof e == "string" ? {
|
|
118
|
+
message: e
|
|
119
|
+
} : e;
|
|
120
|
+
}
|
|
121
|
+
const Fe = ({
|
|
122
|
+
config: e,
|
|
123
|
+
onConfirm: n,
|
|
124
|
+
onCancel: s
|
|
125
|
+
}) => {
|
|
126
|
+
const a = T(null), l = T(null), u = je(e);
|
|
127
|
+
P(() => {
|
|
128
|
+
a.current?.focus();
|
|
129
|
+
}, []), P(() => {
|
|
130
|
+
const c = (i) => {
|
|
131
|
+
i.key === "Escape" && (i.stopPropagation(), s());
|
|
132
|
+
};
|
|
133
|
+
return window.addEventListener("keydown", c, !0), () => {
|
|
134
|
+
window.removeEventListener("keydown", c, !0);
|
|
135
|
+
};
|
|
136
|
+
}, [s]);
|
|
137
|
+
const o = h((c) => {
|
|
138
|
+
if (c.key === "Tab") {
|
|
139
|
+
const i = l.current?.querySelectorAll(
|
|
140
|
+
"button:not([disabled])"
|
|
141
|
+
);
|
|
142
|
+
if (!i?.length) return;
|
|
143
|
+
const b = i[0], C = i[i.length - 1];
|
|
144
|
+
c.shiftKey ? document.activeElement === b && (c.preventDefault(), C.focus()) : document.activeElement === C && (c.preventDefault(), b.focus());
|
|
145
|
+
}
|
|
146
|
+
}, []);
|
|
147
|
+
if (!u)
|
|
148
|
+
return null;
|
|
149
|
+
const d = u.title || "Close?", r = u.confirmText || "Close", m = u.cancelText || "Cancel";
|
|
150
|
+
return /* @__PURE__ */ t(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
className: te.overlay,
|
|
154
|
+
role: "alertdialog",
|
|
155
|
+
"aria-modal": "true",
|
|
156
|
+
"aria-labelledby": "confirm-close-title",
|
|
157
|
+
"aria-describedby": "confirm-close-message",
|
|
158
|
+
onClick: s,
|
|
159
|
+
children: /* @__PURE__ */ g(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
ref: l,
|
|
163
|
+
className: te.modal,
|
|
164
|
+
onClick: (c) => c.stopPropagation(),
|
|
165
|
+
onKeyDown: o,
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ t("h3", { id: "confirm-close-title", className: te.title, children: d }),
|
|
168
|
+
/* @__PURE__ */ t("p", { id: "confirm-close-message", className: te.message, children: u.message }),
|
|
169
|
+
/* @__PURE__ */ g("div", { className: te.buttons, children: [
|
|
170
|
+
/* @__PURE__ */ t(
|
|
171
|
+
ie,
|
|
172
|
+
{
|
|
173
|
+
text: m,
|
|
174
|
+
button: { text: "cancel", value: "cancel" },
|
|
175
|
+
onClick: s,
|
|
176
|
+
variant: "secondary"
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
/* @__PURE__ */ t(
|
|
180
|
+
ie,
|
|
181
|
+
{
|
|
182
|
+
ref: a,
|
|
183
|
+
text: r,
|
|
184
|
+
button: { text: "confirm", value: "confirm" },
|
|
185
|
+
onClick: n,
|
|
186
|
+
variant: "primary"
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] })
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}, Me = we(null);
|
|
196
|
+
function le() {
|
|
197
|
+
const e = ye(Me);
|
|
198
|
+
if (!e)
|
|
199
|
+
throw new Error("useOverlayContext must be used within an Overlay");
|
|
200
|
+
return e;
|
|
201
|
+
}
|
|
202
|
+
const Ue = "cover-frame-module__base___e38vU", Ye = "cover-frame-module__errorContainer___o19mQ", Ke = "cover-frame-module__errorText___ltF9m", de = {
|
|
203
|
+
base: Ue,
|
|
204
|
+
errorContainer: Ye,
|
|
205
|
+
errorText: Ke
|
|
206
|
+
}, he = A(de.base);
|
|
207
|
+
function Xe({ className: e }) {
|
|
208
|
+
const { overlayState: n, coverRegistry: s, setIsLoading: a } = le();
|
|
209
|
+
if (P(() => {
|
|
210
|
+
n?.type === "cover" && a(!1);
|
|
211
|
+
}, [n?.type, a]), !n || n.type !== "cover")
|
|
212
|
+
return null;
|
|
213
|
+
const l = n, u = s?.[l.componentId];
|
|
214
|
+
return u ? /* @__PURE__ */ t("div", { className: he({ className: e }), "data-overlay-cover-frame": !0, children: /* @__PURE__ */ t(u, { ...l.props || {} }) }) : (console.warn(
|
|
215
|
+
`[OverlayCoverFrame] Component "${l.componentId}" not found in registry. Available components: ${Object.keys(s || {}).join(", ") || "none"}`
|
|
216
|
+
), /* @__PURE__ */ t("div", { className: he({ className: e }), "data-overlay-cover-frame": !0, children: /* @__PURE__ */ t("div", { className: de.errorContainer, children: /* @__PURE__ */ g("p", { className: de.errorText, children: [
|
|
217
|
+
'Component "',
|
|
218
|
+
l.componentId,
|
|
219
|
+
'" not found'
|
|
220
|
+
] }) }) }));
|
|
221
|
+
}
|
|
222
|
+
const qe = "webview-frame-module__base___u5SZG", Ge = "webview-frame-module__loadingContainer___eqQ-L", Qe = "webview-frame-module__spinner___5gsaP", Ze = "webview-frame-module__iframe___XewWc", re = {
|
|
223
|
+
base: qe,
|
|
224
|
+
loadingContainer: Ge,
|
|
225
|
+
spinner: Qe,
|
|
226
|
+
iframe: Ze
|
|
227
|
+
}, Je = A(re.base);
|
|
228
|
+
function et({ className: e }) {
|
|
229
|
+
const { overlayState: n, sandboxPermissions: s, isLoading: a, setIsLoading: l } = le(), u = h(() => {
|
|
230
|
+
l(!1);
|
|
231
|
+
}, [l]);
|
|
232
|
+
if (!n || n.type !== "webview")
|
|
233
|
+
return null;
|
|
234
|
+
const o = n;
|
|
235
|
+
return /* @__PURE__ */ g("div", { className: Je({ className: e }), "data-overlay-webview-frame": !0, children: [
|
|
236
|
+
a && /* @__PURE__ */ t("div", { className: re.loadingContainer, children: /* @__PURE__ */ t("div", { className: re.spinner, "aria-label": "Loading webview" }) }),
|
|
237
|
+
/* @__PURE__ */ t(
|
|
238
|
+
"iframe",
|
|
239
|
+
{
|
|
240
|
+
src: o.url,
|
|
241
|
+
className: re.iframe,
|
|
242
|
+
sandbox: s,
|
|
243
|
+
title: o.title || "Webview",
|
|
244
|
+
onLoad: u,
|
|
245
|
+
style: { opacity: a ? 0 : 1 }
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
] });
|
|
249
|
+
}
|
|
250
|
+
function tt({ className: e }) {
|
|
251
|
+
const { overlayState: n } = le();
|
|
252
|
+
if (!n)
|
|
253
|
+
return null;
|
|
254
|
+
switch (n.type) {
|
|
255
|
+
case "webview":
|
|
256
|
+
return /* @__PURE__ */ t(et, { className: e });
|
|
257
|
+
case "cover":
|
|
258
|
+
return /* @__PURE__ */ t(Xe, { className: e });
|
|
259
|
+
default:
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const nt = "header-module__base___WYM0o", st = "header-module__minimal___6nq5w", at = "header-module__titleContainer___56hi4", ot = "header-module__icon___BCSbe", rt = "header-module__title___0c-LL", it = "header-module__closeButton___wOwC8", Q = {
|
|
264
|
+
base: nt,
|
|
265
|
+
default: "header-module__default___z7D3c",
|
|
266
|
+
minimal: st,
|
|
267
|
+
titleContainer: at,
|
|
268
|
+
icon: ot,
|
|
269
|
+
title: rt,
|
|
270
|
+
closeButton: it
|
|
271
|
+
};
|
|
272
|
+
function lt(e, n) {
|
|
273
|
+
const s = n?.title || "Overlay", a = n?.icon, l = n?.allowClose !== !1;
|
|
274
|
+
return {
|
|
275
|
+
title: s,
|
|
276
|
+
icon: a,
|
|
277
|
+
showClose: l,
|
|
278
|
+
variants: {
|
|
279
|
+
variant: e.variant || "default"
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
const ct = A(Q.base, {
|
|
284
|
+
variants: {
|
|
285
|
+
variant: {
|
|
286
|
+
default: Q.default,
|
|
287
|
+
minimal: Q.minimal
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
defaultVariants: {
|
|
291
|
+
variant: "default"
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
function ut(e) {
|
|
295
|
+
const { overlayState: n, attemptClose: s } = le(), { showClose: a, title: l, icon: u, variants: o } = lt(
|
|
296
|
+
e,
|
|
297
|
+
n
|
|
298
|
+
);
|
|
299
|
+
return /* @__PURE__ */ g("header", { className: ct(o), "data-overlay-header": !0, children: [
|
|
300
|
+
/* @__PURE__ */ g("div", { className: Q.titleContainer, children: [
|
|
301
|
+
u && /* @__PURE__ */ t("span", { className: Q.icon, children: u }),
|
|
302
|
+
/* @__PURE__ */ t("h4", { className: Q.title, children: l })
|
|
303
|
+
] }),
|
|
304
|
+
a && /* @__PURE__ */ t(
|
|
305
|
+
"button",
|
|
306
|
+
{
|
|
307
|
+
type: "button",
|
|
308
|
+
className: Q.closeButton,
|
|
309
|
+
onClick: s,
|
|
310
|
+
"aria-label": "Close overlay",
|
|
311
|
+
children: "ร"
|
|
312
|
+
}
|
|
313
|
+
)
|
|
314
|
+
] });
|
|
315
|
+
}
|
|
316
|
+
const dt = "overlay-module__base___qm4j7", mt = "overlay-module__loading___8U4v9", be = {
|
|
317
|
+
base: dt,
|
|
318
|
+
loading: mt
|
|
319
|
+
};
|
|
320
|
+
function _t(e, n) {
|
|
321
|
+
const [s, a] = B(!0), [l, u] = B(!1), o = h(() => {
|
|
322
|
+
e?.confirmClose ? u(!0) : n.onClose();
|
|
323
|
+
}, [n, e?.confirmClose]), d = h(() => {
|
|
324
|
+
u(!1), n.onClose();
|
|
325
|
+
}, [n]), r = h(() => {
|
|
326
|
+
u(!1);
|
|
327
|
+
}, []);
|
|
328
|
+
return P(() => {
|
|
329
|
+
e?.isOpen && e?.type === "webview" && a(!0);
|
|
330
|
+
}, [e?.isOpen, e?.type]), P(() => {
|
|
331
|
+
e?.type === "webview" && a(!0);
|
|
332
|
+
}, [e?.type === "webview" ? e.url : null]), P(() => {
|
|
333
|
+
if (e?.type !== "webview")
|
|
334
|
+
return;
|
|
335
|
+
const m = (c) => {
|
|
336
|
+
if (Se(c.data)) {
|
|
337
|
+
o();
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (Pe(c.data)) {
|
|
341
|
+
const i = c.data;
|
|
342
|
+
switch (i.type) {
|
|
343
|
+
case J.SET_TITLE:
|
|
344
|
+
n.onSetTitle(i.title);
|
|
345
|
+
break;
|
|
346
|
+
case J.SET_ICON:
|
|
347
|
+
n.onSetIcon(i.icon);
|
|
348
|
+
break;
|
|
349
|
+
case J.SET_ALLOW_CLOSE:
|
|
350
|
+
n.onSetAllowClose(i.allow);
|
|
351
|
+
break;
|
|
352
|
+
case J.SET_CONFIRM_CLOSE:
|
|
353
|
+
n.onSetConfirmClose(i.config);
|
|
354
|
+
break;
|
|
355
|
+
case J.SEND_PAYLOAD:
|
|
356
|
+
n.onSendPayload(i.payload);
|
|
357
|
+
break;
|
|
358
|
+
case J.NAVIGATE:
|
|
359
|
+
n.onNavigate(i.url);
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
return window.addEventListener("message", m), () => {
|
|
365
|
+
window.removeEventListener("message", m);
|
|
366
|
+
};
|
|
367
|
+
}, [n, o, e?.type]), P(() => {
|
|
368
|
+
if (l) return;
|
|
369
|
+
const m = (c) => {
|
|
370
|
+
c.key === "Escape" && e?.isOpen && e?.allowClose !== !1 && o();
|
|
371
|
+
};
|
|
372
|
+
return window.addEventListener("keydown", m), () => {
|
|
373
|
+
window.removeEventListener("keydown", m);
|
|
374
|
+
};
|
|
375
|
+
}, [
|
|
376
|
+
o,
|
|
377
|
+
l,
|
|
378
|
+
e?.isOpen,
|
|
379
|
+
e?.allowClose
|
|
380
|
+
]), {
|
|
381
|
+
isLoading: s,
|
|
382
|
+
setIsLoading: a,
|
|
383
|
+
showConfirmModal: l,
|
|
384
|
+
setShowConfirmModal: u,
|
|
385
|
+
attemptClose: o,
|
|
386
|
+
handleConfirmClose: d,
|
|
387
|
+
handleCancelClose: r,
|
|
388
|
+
variants: { isLoading: s }
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
const gt = "allow-scripts allow-forms allow-same-origin allow-popups", ht = A(be.base, {
|
|
392
|
+
variants: {
|
|
393
|
+
isLoading: {
|
|
394
|
+
true: be.loading
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
function bt({
|
|
399
|
+
overlayState: e,
|
|
400
|
+
onClose: n,
|
|
401
|
+
onSetTitle: s,
|
|
402
|
+
onSetIcon: a,
|
|
403
|
+
onSetAllowClose: l,
|
|
404
|
+
onSetConfirmClose: u,
|
|
405
|
+
onSendPayload: o,
|
|
406
|
+
onNavigate: d,
|
|
407
|
+
coverRegistry: r,
|
|
408
|
+
children: m
|
|
409
|
+
}) {
|
|
410
|
+
const c = {
|
|
411
|
+
onClose: n,
|
|
412
|
+
onSetTitle: s,
|
|
413
|
+
onSetIcon: a,
|
|
414
|
+
onSetAllowClose: l,
|
|
415
|
+
onSetConfirmClose: u,
|
|
416
|
+
onSendPayload: o,
|
|
417
|
+
onNavigate: d
|
|
418
|
+
}, {
|
|
419
|
+
isLoading: i,
|
|
420
|
+
setIsLoading: b,
|
|
421
|
+
showConfirmModal: C,
|
|
422
|
+
setShowConfirmModal: _,
|
|
423
|
+
attemptClose: f,
|
|
424
|
+
handleConfirmClose: v,
|
|
425
|
+
handleCancelClose: p,
|
|
426
|
+
variants: w
|
|
427
|
+
} = _t(e, c);
|
|
428
|
+
if (!e?.isOpen)
|
|
429
|
+
return null;
|
|
430
|
+
const M = {
|
|
431
|
+
overlayState: e,
|
|
432
|
+
...c,
|
|
433
|
+
sandboxPermissions: gt,
|
|
434
|
+
isLoading: i,
|
|
435
|
+
setIsLoading: b,
|
|
436
|
+
attemptClose: f,
|
|
437
|
+
showConfirmModal: C,
|
|
438
|
+
setShowConfirmModal: _,
|
|
439
|
+
coverRegistry: r
|
|
440
|
+
};
|
|
441
|
+
return /* @__PURE__ */ t(Me.Provider, { value: M, children: /* @__PURE__ */ g("div", { className: ht(w), "data-overlay": !0, children: [
|
|
442
|
+
m || /* @__PURE__ */ g(ve, { children: [
|
|
443
|
+
/* @__PURE__ */ t(ut, {}),
|
|
444
|
+
/* @__PURE__ */ t(tt, {})
|
|
445
|
+
] }),
|
|
446
|
+
C && e.confirmClose && /* @__PURE__ */ t(
|
|
447
|
+
Fe,
|
|
448
|
+
{
|
|
449
|
+
config: e.confirmClose,
|
|
450
|
+
onConfirm: v,
|
|
451
|
+
onCancel: p
|
|
452
|
+
}
|
|
453
|
+
)
|
|
454
|
+
] }) });
|
|
455
|
+
}
|
|
456
|
+
function ft(e, n, s) {
|
|
457
|
+
const {
|
|
458
|
+
layout: a = "default",
|
|
459
|
+
size: l = "normal",
|
|
460
|
+
position: u = "bottom-right",
|
|
461
|
+
"aria-label": o = "Webchat interface",
|
|
462
|
+
className: d,
|
|
463
|
+
coverRegistry: r,
|
|
464
|
+
// Exclude from DOM props
|
|
465
|
+
...m
|
|
466
|
+
} = e, c = E(n.controller.machine, (p) => p.context.isOpen || !1), [i, b] = B(null), [C, _] = B(!1), f = T(!1), v = h(
|
|
467
|
+
(p) => {
|
|
468
|
+
p.target === p.currentTarget && i !== null && (i === "closing" && _(!1), b(null));
|
|
469
|
+
},
|
|
470
|
+
[i]
|
|
471
|
+
);
|
|
472
|
+
return P(() => {
|
|
473
|
+
const p = f.current;
|
|
474
|
+
f.current = c, p === !1 && c ? (_(!0), b("opening")) : p === !0 && !c && b("closing");
|
|
475
|
+
}, [c]), {
|
|
476
|
+
// Component visibility - stays true during close animation
|
|
477
|
+
shouldRender: C,
|
|
478
|
+
// Container element props
|
|
479
|
+
containerProps: {
|
|
480
|
+
ref: s,
|
|
481
|
+
role: "dialog",
|
|
482
|
+
"aria-label": o,
|
|
483
|
+
"aria-live": "polite",
|
|
484
|
+
"data-testid": "webchat-container",
|
|
485
|
+
"data-layout": a,
|
|
486
|
+
"data-size": l,
|
|
487
|
+
tabIndex: -1,
|
|
488
|
+
onAnimationEnd: v,
|
|
489
|
+
...m
|
|
490
|
+
},
|
|
491
|
+
// CSS class variants
|
|
492
|
+
variants: {
|
|
493
|
+
layout: a,
|
|
494
|
+
size: l,
|
|
495
|
+
position: u,
|
|
496
|
+
isOpen: c,
|
|
497
|
+
isOpening: i === "opening",
|
|
498
|
+
isClosing: i === "closing",
|
|
499
|
+
className: d
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
const pt = "webchat-container-module__base___-nEHI", V = {
|
|
504
|
+
base: pt,
|
|
505
|
+
"is-open": "webchat-container-module__is-open___y7UjX",
|
|
506
|
+
default: "webchat-container-module__default___Zl33C",
|
|
507
|
+
"position-bottom-right": "webchat-container-module__position-bottom-right___NIW0p",
|
|
508
|
+
"position-bottom-left": "webchat-container-module__position-bottom-left___gatKC",
|
|
509
|
+
"position-top-right": "webchat-container-module__position-top-right___DKI8J",
|
|
510
|
+
"position-top-left": "webchat-container-module__position-top-left___ehR4d",
|
|
511
|
+
"is-opening": "webchat-container-module__is-opening___5Ot9W",
|
|
512
|
+
"is-closing": "webchat-container-module__is-closing___o0hqs"
|
|
513
|
+
}, vt = A(V.base, {
|
|
514
|
+
variants: {
|
|
515
|
+
layout: {
|
|
516
|
+
default: V.default
|
|
517
|
+
},
|
|
518
|
+
position: {
|
|
519
|
+
"bottom-right": V["position-bottom-right"],
|
|
520
|
+
"bottom-left": V["position-bottom-left"],
|
|
521
|
+
"top-right": V["position-top-right"],
|
|
522
|
+
"top-left": V["position-top-left"]
|
|
523
|
+
},
|
|
524
|
+
isOpen: {
|
|
525
|
+
true: V["is-open"]
|
|
526
|
+
},
|
|
527
|
+
isOpening: {
|
|
528
|
+
true: V["is-opening"]
|
|
529
|
+
},
|
|
530
|
+
isClosing: {
|
|
531
|
+
true: V["is-closing"]
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
defaultVariants: {
|
|
535
|
+
layout: "default",
|
|
536
|
+
position: "bottom-right"
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
function Ct(e) {
|
|
540
|
+
const { state: n, controller: s } = ee(), a = T(null), { shouldRender: l, containerProps: u, variants: o } = ft(
|
|
541
|
+
e,
|
|
542
|
+
n,
|
|
543
|
+
a
|
|
544
|
+
), {
|
|
545
|
+
children: d,
|
|
546
|
+
coverRegistry: r,
|
|
547
|
+
layout: m,
|
|
548
|
+
size: c,
|
|
549
|
+
position: i,
|
|
550
|
+
...b
|
|
551
|
+
} = e, C = h(
|
|
552
|
+
() => s.overlay.close(),
|
|
553
|
+
[s]
|
|
554
|
+
), _ = h(
|
|
555
|
+
(y) => s.overlay.setTitle(y),
|
|
556
|
+
[s]
|
|
557
|
+
), f = h(
|
|
558
|
+
(y) => s.overlay.setIcon(y),
|
|
559
|
+
[s]
|
|
560
|
+
), v = h(
|
|
561
|
+
(y) => s.overlay.setAllowClose(y),
|
|
562
|
+
[s]
|
|
563
|
+
), p = h(
|
|
564
|
+
(y) => s.overlay.setConfirmClose(y),
|
|
565
|
+
[s]
|
|
566
|
+
), w = h(
|
|
567
|
+
(y) => s.overlay.sendPayload(y),
|
|
568
|
+
[s]
|
|
569
|
+
), M = h(
|
|
570
|
+
(y) => s.overlay.navigate(y),
|
|
571
|
+
[s]
|
|
572
|
+
);
|
|
573
|
+
return l ? /* @__PURE__ */ g(
|
|
574
|
+
"div",
|
|
575
|
+
{
|
|
576
|
+
...u,
|
|
577
|
+
...b,
|
|
578
|
+
className: vt(o),
|
|
579
|
+
"data-testid": "webchat-container",
|
|
580
|
+
children: [
|
|
581
|
+
d,
|
|
582
|
+
/* @__PURE__ */ t(
|
|
583
|
+
bt,
|
|
584
|
+
{
|
|
585
|
+
overlayState: n.overlayState,
|
|
586
|
+
onClose: C,
|
|
587
|
+
onSetTitle: _,
|
|
588
|
+
onSetIcon: f,
|
|
589
|
+
onSetAllowClose: v,
|
|
590
|
+
onSetConfirmClose: p,
|
|
591
|
+
onSendPayload: w,
|
|
592
|
+
onNavigate: M,
|
|
593
|
+
coverRegistry: r
|
|
594
|
+
}
|
|
595
|
+
)
|
|
596
|
+
]
|
|
597
|
+
}
|
|
598
|
+
) : null;
|
|
599
|
+
}
|
|
600
|
+
function yt(e, n, s) {
|
|
601
|
+
const {
|
|
602
|
+
title: a = "Chat",
|
|
603
|
+
showStatus: l = !0,
|
|
604
|
+
showClose: u = !0,
|
|
605
|
+
onClose: o,
|
|
606
|
+
variant: d = "default",
|
|
607
|
+
"aria-label": r,
|
|
608
|
+
className: m,
|
|
609
|
+
...c
|
|
610
|
+
} = e, i = E(
|
|
611
|
+
n.controller.machine,
|
|
612
|
+
(f) => f.context.connectionStatus || "disconnected"
|
|
613
|
+
), b = h(() => {
|
|
614
|
+
o ? o() : n.controller.close();
|
|
615
|
+
}, [o, n.controller]), C = h((f) => {
|
|
616
|
+
switch (f) {
|
|
617
|
+
case "connected":
|
|
618
|
+
return "Online";
|
|
619
|
+
case "connecting":
|
|
620
|
+
return "Connecting...";
|
|
621
|
+
case "disconnected":
|
|
622
|
+
return "Offline";
|
|
623
|
+
case "unavailable":
|
|
624
|
+
return "Connection unstable";
|
|
625
|
+
case "error":
|
|
626
|
+
return "Connection error";
|
|
627
|
+
default:
|
|
628
|
+
return "Offline";
|
|
629
|
+
}
|
|
630
|
+
}, []), _ = l ? C(i) : void 0;
|
|
631
|
+
return {
|
|
632
|
+
// Header element props
|
|
633
|
+
headerProps: {
|
|
634
|
+
...c,
|
|
635
|
+
ref: s,
|
|
636
|
+
"aria-label": r || `${a} header`
|
|
637
|
+
},
|
|
638
|
+
// Header content
|
|
639
|
+
title: a,
|
|
640
|
+
showStatus: l,
|
|
641
|
+
statusText: _,
|
|
642
|
+
showClose: u,
|
|
643
|
+
onClose: b,
|
|
644
|
+
connectionStatus: i,
|
|
645
|
+
// CSS class variants
|
|
646
|
+
variants: {
|
|
647
|
+
variant: d,
|
|
648
|
+
className: m
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
const wt = "webchat-header-module__base___VbIWd", Nt = "webchat-header-module__minimal___rloXK", O = {
|
|
653
|
+
base: wt,
|
|
654
|
+
"header-content": "webchat-header-module__header-content___bPP9l",
|
|
655
|
+
"header-text": "webchat-header-module__header-text___64Yj9",
|
|
656
|
+
"header-title": "webchat-header-module__header-title___QHcHi",
|
|
657
|
+
"status-section": "webchat-header-module__status-section___TlGf-",
|
|
658
|
+
"status-text": "webchat-header-module__status-text___fTZvQ",
|
|
659
|
+
"status-dot": "webchat-header-module__status-dot___rjbA2",
|
|
660
|
+
"close-button": "webchat-header-module__close-button___ggJh9",
|
|
661
|
+
minimal: Nt
|
|
662
|
+
}, Mt = A(O.base, {
|
|
663
|
+
variants: {
|
|
664
|
+
variant: {
|
|
665
|
+
default: O.default,
|
|
666
|
+
minimal: O.minimal
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
defaultVariants: {
|
|
670
|
+
variant: "default"
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
function xt(e) {
|
|
674
|
+
const { state: n } = ee(), s = T(null), {
|
|
675
|
+
headerProps: a,
|
|
676
|
+
title: l,
|
|
677
|
+
showStatus: u,
|
|
678
|
+
statusText: o,
|
|
679
|
+
showClose: d,
|
|
680
|
+
onClose: r,
|
|
681
|
+
connectionStatus: m,
|
|
682
|
+
variants: c
|
|
683
|
+
} = yt(e, n, s), { ...i } = e;
|
|
684
|
+
return /* @__PURE__ */ t(
|
|
685
|
+
"header",
|
|
686
|
+
{
|
|
687
|
+
...a,
|
|
688
|
+
...i,
|
|
689
|
+
className: Mt(c),
|
|
690
|
+
"data-webchat-header": !0,
|
|
691
|
+
children: /* @__PURE__ */ g("div", { className: O["header-content"], children: [
|
|
692
|
+
/* @__PURE__ */ g("div", { className: O["header-text"], children: [
|
|
693
|
+
/* @__PURE__ */ t("h3", { className: O["header-title"], children: l }),
|
|
694
|
+
u && /* @__PURE__ */ g("div", { className: O["status-section"], children: [
|
|
695
|
+
/* @__PURE__ */ t(
|
|
696
|
+
"div",
|
|
697
|
+
{
|
|
698
|
+
className: O["status-dot"],
|
|
699
|
+
"data-status": m,
|
|
700
|
+
"aria-hidden": "true"
|
|
701
|
+
}
|
|
702
|
+
),
|
|
703
|
+
/* @__PURE__ */ t("span", { className: O["status-text"], children: o })
|
|
704
|
+
] })
|
|
705
|
+
] }),
|
|
706
|
+
d && /* @__PURE__ */ t(
|
|
707
|
+
"button",
|
|
708
|
+
{
|
|
709
|
+
type: "button",
|
|
710
|
+
onClick: r,
|
|
711
|
+
className: O["close-button"],
|
|
712
|
+
"aria-label": "Close chat",
|
|
713
|
+
children: "ร"
|
|
714
|
+
}
|
|
715
|
+
)
|
|
716
|
+
] })
|
|
717
|
+
}
|
|
718
|
+
);
|
|
719
|
+
}
|
|
720
|
+
const me = {
|
|
721
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
722
|
+
viewBox: "0 0 512 512",
|
|
723
|
+
fill: "currentColor",
|
|
724
|
+
role: "img",
|
|
725
|
+
"aria-hidden": !0
|
|
726
|
+
};
|
|
727
|
+
function It() {
|
|
728
|
+
return /* @__PURE__ */ t("svg", { ...me, viewBox: "0 0 448 512", children: /* @__PURE__ */ t("path", { d: "M364.2 83.8c-24.4-24.4-64-24.4-88.4 0l-184 184c-42.1 42.1-42.1 110.3 0 152.4s110.3 42.1 152.4 0l152-152c10.9-10.9 28.7-10.9 39.6 0s10.9 28.7 0 39.6l-152 152c-64 64-167.6 64-231.6 0s-64-167.6 0-231.6l184-184c46.3-46.3 121.3-46.3 167.6 0s46.3 121.3 0 167.6l-176 176c-28.6 28.6-75 28.6-103.6 0s-28.6-75 0-103.6l144-144c10.9-10.9 28.7-10.9 39.6 0s10.9 28.7 0 39.6l-144 144c-6.7 6.7-6.7 17.7 0 24.4s17.7 6.7 24.4 0l176-176c24.4-24.4 24.4-64 0-88.4z" }) });
|
|
729
|
+
}
|
|
730
|
+
function Bt() {
|
|
731
|
+
return /* @__PURE__ */ t("svg", { ...me, children: /* @__PURE__ */ t("path", { d: "M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm177.6 62.1C192.8 334.5 218.8 352 256 352s63.2-17.5 78.4-33.9c9-9.7 24.2-10.4 33.9-1.4s10.4 24.2 1.4 33.9c-22 23.8-60 49.4-113.6 49.4s-91.7-25.5-113.6-49.4c-9-9.7-8.4-24.9 1.4-33.9s24.9-8.4 33.9 1.4zM144.4 208a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm192-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64z" }) });
|
|
732
|
+
}
|
|
733
|
+
function Tt() {
|
|
734
|
+
return /* @__PURE__ */ t(
|
|
735
|
+
"svg",
|
|
736
|
+
{
|
|
737
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
738
|
+
viewBox: "0 0 24 24",
|
|
739
|
+
fill: "none",
|
|
740
|
+
stroke: "currentColor",
|
|
741
|
+
strokeWidth: 2,
|
|
742
|
+
strokeLinecap: "round",
|
|
743
|
+
strokeLinejoin: "round",
|
|
744
|
+
role: "img",
|
|
745
|
+
"aria-hidden": !0,
|
|
746
|
+
children: /* @__PURE__ */ t("path", { d: "M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z" })
|
|
747
|
+
}
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
function kt() {
|
|
751
|
+
return /* @__PURE__ */ t("svg", { ...me, children: /* @__PURE__ */ t("path", { d: "M57.6 35.8C23.1 20.6-11.3 57.4 6.1 90.9l63 121.2c4.4 8.4 12.6 14.1 22 15.3L266 249.3c3.4 .4 6 3.3 6 6.7s-2.6 6.3-6 6.7L91.1 284.6c-9.4 1.2-17.6 6.9-22 15.3L6.1 421.1c-17.4 33.5 17 70.2 51.6 55.1L492.9 285.3c25.5-11.2 25.5-47.4 0-58.6L57.6 35.8z" }) });
|
|
752
|
+
}
|
|
753
|
+
function St(e, n, s) {
|
|
754
|
+
const { controller: a } = ee(), {
|
|
755
|
+
placeholder: l = "Message...",
|
|
756
|
+
disabled: u,
|
|
757
|
+
variant: o = "default",
|
|
758
|
+
showBranding: d = !0,
|
|
759
|
+
"aria-label": r,
|
|
760
|
+
className: m,
|
|
761
|
+
onEmojiClick: c,
|
|
762
|
+
onAttachmentClick: i,
|
|
763
|
+
onMicrophoneClick: b,
|
|
764
|
+
...C
|
|
765
|
+
} = e, [_, f] = B(""), v = T(""), p = _.trim().length > 0, w = h(() => {
|
|
766
|
+
const N = v.current.trim();
|
|
767
|
+
if (N) {
|
|
768
|
+
const D = $e.createText({
|
|
769
|
+
text: N,
|
|
770
|
+
metadata: {
|
|
771
|
+
sent_by: oe.User
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
a.sendMessage(D), v.current = "", f("");
|
|
775
|
+
}
|
|
776
|
+
}, [a]), M = h(
|
|
777
|
+
(N) => {
|
|
778
|
+
N.preventDefault(), w();
|
|
779
|
+
},
|
|
780
|
+
[w]
|
|
781
|
+
), y = h(
|
|
782
|
+
(N) => {
|
|
783
|
+
const D = N.target.value;
|
|
784
|
+
v.current = D, f(D);
|
|
785
|
+
},
|
|
786
|
+
[]
|
|
787
|
+
), z = h(
|
|
788
|
+
(N) => {
|
|
789
|
+
N.key === "Enter" && !N.shiftKey && (N.preventDefault(), w());
|
|
790
|
+
},
|
|
791
|
+
[w]
|
|
792
|
+
);
|
|
793
|
+
return {
|
|
794
|
+
// Input wrapper props
|
|
795
|
+
inputProps: {
|
|
796
|
+
...C,
|
|
797
|
+
ref: s,
|
|
798
|
+
"aria-label": r || l,
|
|
799
|
+
"data-webchat-input": ""
|
|
800
|
+
},
|
|
801
|
+
// Form state and handlers
|
|
802
|
+
inputValue: _,
|
|
803
|
+
hasText: p,
|
|
804
|
+
handleSubmit: M,
|
|
805
|
+
handleInputChange: y,
|
|
806
|
+
handleKeyDown: z,
|
|
807
|
+
onEmojiClick: c,
|
|
808
|
+
onAttachmentClick: i,
|
|
809
|
+
onMicrophoneClick: b,
|
|
810
|
+
// Input field props
|
|
811
|
+
fieldProps: {
|
|
812
|
+
value: _,
|
|
813
|
+
onChange: y,
|
|
814
|
+
onKeyDown: z,
|
|
815
|
+
placeholder: l,
|
|
816
|
+
disabled: u,
|
|
817
|
+
rows: 1
|
|
818
|
+
},
|
|
819
|
+
// Single primary-action button: submit when text exists, mic otherwise
|
|
820
|
+
primaryActionProps: {
|
|
821
|
+
type: p ? "submit" : "button",
|
|
822
|
+
disabled: !!u,
|
|
823
|
+
"aria-label": p ? "Send message" : "Record voice message"
|
|
824
|
+
},
|
|
825
|
+
// CSS class variants
|
|
826
|
+
variants: {
|
|
827
|
+
variant: o,
|
|
828
|
+
className: m
|
|
829
|
+
},
|
|
830
|
+
isInputDisabled: u,
|
|
831
|
+
showBranding: d
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
const Pt = "webchat-input-module__base___TZXU7", $t = "webchat-input-module__branding___ReLzJ", I = {
|
|
835
|
+
default: "webchat-input-module__default___tHS5e",
|
|
836
|
+
base: Pt,
|
|
837
|
+
"input-form": "webchat-input-module__input-form___GnKc7",
|
|
838
|
+
branding: $t,
|
|
839
|
+
"input-field": "webchat-input-module__input-field___c4r26",
|
|
840
|
+
"primary-action-base": "webchat-input-module__primary-action-base___UfC2U",
|
|
841
|
+
"primary-action-send": "webchat-input-module__primary-action-send___3ZCtv",
|
|
842
|
+
"primary-action-mic": "webchat-input-module__primary-action-mic___cB0BZ",
|
|
843
|
+
"icon-slot": "webchat-input-module__icon-slot___VBqqX",
|
|
844
|
+
"icon-face": "webchat-input-module__icon-face___9gNV-",
|
|
845
|
+
"icon-send": "webchat-input-module__icon-send___iTZQ1",
|
|
846
|
+
"action-button": "webchat-input-module__action-button___QnDXK",
|
|
847
|
+
"icon-mic": "webchat-input-module__icon-mic___m8zbn",
|
|
848
|
+
"input-container": "webchat-input-module__input-container___N2B7J",
|
|
849
|
+
"action-bar": "webchat-input-module__action-bar___gEuJH"
|
|
850
|
+
}, Lt = A(I.base, {
|
|
851
|
+
variants: {
|
|
852
|
+
variant: {
|
|
853
|
+
default: I.default
|
|
854
|
+
}
|
|
855
|
+
},
|
|
856
|
+
defaultVariants: {
|
|
857
|
+
variant: "default"
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
function Et(e) {
|
|
861
|
+
const { state: n } = ee(), s = T(null), {
|
|
862
|
+
inputProps: a,
|
|
863
|
+
handleSubmit: l,
|
|
864
|
+
fieldProps: u,
|
|
865
|
+
primaryActionProps: o,
|
|
866
|
+
variants: d,
|
|
867
|
+
showBranding: r,
|
|
868
|
+
hasText: m,
|
|
869
|
+
onEmojiClick: c,
|
|
870
|
+
onAttachmentClick: i,
|
|
871
|
+
onMicrophoneClick: b,
|
|
872
|
+
isInputDisabled: C
|
|
873
|
+
} = St(e, n, s), { icons: _ } = e;
|
|
874
|
+
return /* @__PURE__ */ g(
|
|
875
|
+
"div",
|
|
876
|
+
{
|
|
877
|
+
...a,
|
|
878
|
+
className: Lt(d),
|
|
879
|
+
"data-webchat-input": !0,
|
|
880
|
+
children: [
|
|
881
|
+
/* @__PURE__ */ t("div", { className: I["input-container"], children: /* @__PURE__ */ g("form", { onSubmit: l, className: I["input-form"], children: [
|
|
882
|
+
/* @__PURE__ */ t("textarea", { ...u, className: I["input-field"] }),
|
|
883
|
+
/* @__PURE__ */ g(
|
|
884
|
+
"div",
|
|
885
|
+
{
|
|
886
|
+
className: I["action-bar"],
|
|
887
|
+
role: "group",
|
|
888
|
+
"aria-label": "Message actions",
|
|
889
|
+
children: [
|
|
890
|
+
/* @__PURE__ */ t(
|
|
891
|
+
"button",
|
|
892
|
+
{
|
|
893
|
+
type: "button",
|
|
894
|
+
className: I["action-button"],
|
|
895
|
+
"aria-label": "Emoji",
|
|
896
|
+
disabled: C,
|
|
897
|
+
onClick: c,
|
|
898
|
+
children: _?.emoji ?? /* @__PURE__ */ t(Bt, {})
|
|
899
|
+
}
|
|
900
|
+
),
|
|
901
|
+
/* @__PURE__ */ t(
|
|
902
|
+
"button",
|
|
903
|
+
{
|
|
904
|
+
type: "button",
|
|
905
|
+
className: I["action-button"],
|
|
906
|
+
"aria-label": "Attach file",
|
|
907
|
+
disabled: C,
|
|
908
|
+
onClick: i,
|
|
909
|
+
children: _?.attachment ?? /* @__PURE__ */ t(It, {})
|
|
910
|
+
}
|
|
911
|
+
),
|
|
912
|
+
/* @__PURE__ */ t(
|
|
913
|
+
"button",
|
|
914
|
+
{
|
|
915
|
+
...o,
|
|
916
|
+
className: k(
|
|
917
|
+
I["primary-action-base"],
|
|
918
|
+
m ? I["primary-action-send"] : I["primary-action-mic"]
|
|
919
|
+
),
|
|
920
|
+
"aria-label": m ? "Send message" : "Record voice message",
|
|
921
|
+
onClick: m ? void 0 : b,
|
|
922
|
+
children: /* @__PURE__ */ g("span", { className: I["icon-slot"], children: [
|
|
923
|
+
/* @__PURE__ */ t(
|
|
924
|
+
"span",
|
|
925
|
+
{
|
|
926
|
+
"aria-hidden": !0,
|
|
927
|
+
className: k(I["icon-face"], I["icon-mic"]),
|
|
928
|
+
"data-visible": m ? "false" : "true",
|
|
929
|
+
children: _?.microphone ?? /* @__PURE__ */ t(Tt, {})
|
|
930
|
+
}
|
|
931
|
+
),
|
|
932
|
+
/* @__PURE__ */ t(
|
|
933
|
+
"span",
|
|
934
|
+
{
|
|
935
|
+
"aria-hidden": !0,
|
|
936
|
+
className: k(I["icon-face"], I["icon-send"]),
|
|
937
|
+
"data-visible": m ? "true" : "false",
|
|
938
|
+
children: _?.send ?? /* @__PURE__ */ t(kt, {})
|
|
939
|
+
}
|
|
940
|
+
)
|
|
941
|
+
] })
|
|
942
|
+
}
|
|
943
|
+
)
|
|
944
|
+
]
|
|
945
|
+
}
|
|
946
|
+
)
|
|
947
|
+
] }) }),
|
|
948
|
+
r ? /* @__PURE__ */ t("p", { className: I.branding, children: "Powered by Hubtype" }) : void 0
|
|
949
|
+
]
|
|
950
|
+
}
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
const Dt = "message-avatar-module__container___-EX1c", At = "message-avatar-module__base___RPKhe", zt = "message-avatar-module__image___rxwYA", Rt = "message-avatar-module__svg___eMikf", Ot = "message-avatar-module__fallback___2Xa-W", Vt = "message-avatar-module__name___L20Ht", Wt = "message-avatar-module__small___gBALc", Ht = "message-avatar-module__medium___WSeE1", jt = "message-avatar-module__large___a-hNp", Ft = "message-avatar-module__bot___2Bh0Y", Ut = "message-avatar-module__agent___MemVD", L = {
|
|
954
|
+
container: Dt,
|
|
955
|
+
base: At,
|
|
956
|
+
image: zt,
|
|
957
|
+
svg: Rt,
|
|
958
|
+
fallback: Ot,
|
|
959
|
+
name: Vt,
|
|
960
|
+
small: Wt,
|
|
961
|
+
medium: Ht,
|
|
962
|
+
large: jt,
|
|
963
|
+
bot: Ft,
|
|
964
|
+
agent: Ut
|
|
965
|
+
}, Yt = A(L.base, {
|
|
966
|
+
variants: {
|
|
967
|
+
variant: {
|
|
968
|
+
user: L.user,
|
|
969
|
+
bot: L.bot,
|
|
970
|
+
system: L.system,
|
|
971
|
+
agent: L.agent
|
|
972
|
+
},
|
|
973
|
+
size: {
|
|
974
|
+
small: L.small,
|
|
975
|
+
medium: L.medium,
|
|
976
|
+
large: L.large
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
defaultVariants: { variant: "bot", size: "medium" }
|
|
980
|
+
}), _e = $(
|
|
981
|
+
({
|
|
982
|
+
variant: e = "bot",
|
|
983
|
+
size: n = "medium",
|
|
984
|
+
src: s,
|
|
985
|
+
alt: a,
|
|
986
|
+
svg: l,
|
|
987
|
+
showName: u = !1,
|
|
988
|
+
name: o,
|
|
989
|
+
fallback: d,
|
|
990
|
+
className: r
|
|
991
|
+
}, m) => /* @__PURE__ */ g(
|
|
992
|
+
"div",
|
|
993
|
+
{
|
|
994
|
+
ref: m,
|
|
995
|
+
className: L.container,
|
|
996
|
+
"data-webchat-message-avatar": !0,
|
|
997
|
+
children: [
|
|
998
|
+
/* @__PURE__ */ t(
|
|
999
|
+
"div",
|
|
1000
|
+
{
|
|
1001
|
+
className: Yt({
|
|
1002
|
+
variant: e,
|
|
1003
|
+
size: n,
|
|
1004
|
+
className: r
|
|
1005
|
+
}),
|
|
1006
|
+
children: l ? /* @__PURE__ */ t(
|
|
1007
|
+
"div",
|
|
1008
|
+
{
|
|
1009
|
+
className: L.svg,
|
|
1010
|
+
dangerouslySetInnerHTML: { __html: l },
|
|
1011
|
+
role: "img",
|
|
1012
|
+
"aria-label": a || `${e} avatar`
|
|
1013
|
+
}
|
|
1014
|
+
) : s ? /* @__PURE__ */ t(
|
|
1015
|
+
"img",
|
|
1016
|
+
{
|
|
1017
|
+
src: s,
|
|
1018
|
+
alt: a || `${e} avatar`,
|
|
1019
|
+
className: L.image
|
|
1020
|
+
}
|
|
1021
|
+
) : /* @__PURE__ */ t("div", { className: L.fallback, children: d || (e === "bot" ? "๐ค" : e === "agent" ? "๐จโ๐ผ" : "๐ค") })
|
|
1022
|
+
}
|
|
1023
|
+
),
|
|
1024
|
+
u && o && /* @__PURE__ */ t("div", { className: L.name, children: o })
|
|
1025
|
+
]
|
|
1026
|
+
}
|
|
1027
|
+
)
|
|
1028
|
+
), Kt = "message-bubble-module__base___WzTAP", Xt = "message-bubble-module__bot___PcXmL", qt = "message-bubble-module__agent___WGfzX", Gt = "message-bubble-module__user___lFMMm", Qt = "message-bubble-module__system___e8-FD", Zt = "message-bubble-module__sending___P9nK-", Jt = "message-bubble-module__error___mine7", Y = {
|
|
1029
|
+
base: Kt,
|
|
1030
|
+
bot: Xt,
|
|
1031
|
+
agent: qt,
|
|
1032
|
+
user: Gt,
|
|
1033
|
+
system: Qt,
|
|
1034
|
+
sending: Zt,
|
|
1035
|
+
error: Jt
|
|
1036
|
+
}, en = A(Y.base, {
|
|
1037
|
+
variants: {
|
|
1038
|
+
variant: {
|
|
1039
|
+
user: Y.user,
|
|
1040
|
+
bot: Y.bot,
|
|
1041
|
+
system: Y.system,
|
|
1042
|
+
agent: Y.agent
|
|
1043
|
+
},
|
|
1044
|
+
status: {
|
|
1045
|
+
sending: Y.sending,
|
|
1046
|
+
sent: Y.sent,
|
|
1047
|
+
error: Y.error
|
|
1048
|
+
}
|
|
1049
|
+
},
|
|
1050
|
+
defaultVariants: { variant: "bot", status: "sent" }
|
|
1051
|
+
}), tn = $(
|
|
1052
|
+
({ variant: e = "bot", status: n = "sent", avatarProps: s, children: a, className: l }, u) => /* @__PURE__ */ g(
|
|
1053
|
+
"div",
|
|
1054
|
+
{
|
|
1055
|
+
ref: u,
|
|
1056
|
+
className: en({
|
|
1057
|
+
variant: e,
|
|
1058
|
+
status: n,
|
|
1059
|
+
className: l
|
|
1060
|
+
}),
|
|
1061
|
+
"data-webchat-message-bubble": !0,
|
|
1062
|
+
children: [
|
|
1063
|
+
s && /* @__PURE__ */ t(_e, { ...s }),
|
|
1064
|
+
a
|
|
1065
|
+
]
|
|
1066
|
+
}
|
|
1067
|
+
)
|
|
1068
|
+
), nn = "message-info-module__base___yO0Cd", sn = "message-info-module__timestamp___xwDsF", an = "message-info-module__status___jPwtz", on = "message-info-module__top___NK5CY", rn = "message-info-module__bottom___NE4Rs", ln = "message-info-module__bot___xlQbg", cn = "message-info-module__agent___ckeYQ", un = "message-info-module__user___bgEi-", dn = "message-info-module__system___MF1CS", H = {
|
|
1069
|
+
base: nn,
|
|
1070
|
+
timestamp: sn,
|
|
1071
|
+
status: an,
|
|
1072
|
+
top: on,
|
|
1073
|
+
bottom: rn,
|
|
1074
|
+
bot: ln,
|
|
1075
|
+
agent: cn,
|
|
1076
|
+
user: un,
|
|
1077
|
+
system: dn
|
|
1078
|
+
}, mn = A(H.base, {
|
|
1079
|
+
variants: {
|
|
1080
|
+
variant: {
|
|
1081
|
+
user: H.user,
|
|
1082
|
+
bot: H.bot,
|
|
1083
|
+
system: H.system,
|
|
1084
|
+
agent: H.agent
|
|
1085
|
+
},
|
|
1086
|
+
position: {
|
|
1087
|
+
top: H.top,
|
|
1088
|
+
bottom: H.bottom
|
|
1089
|
+
}
|
|
1090
|
+
},
|
|
1091
|
+
defaultVariants: { variant: "bot", position: "bottom" }
|
|
1092
|
+
}), _n = $(
|
|
1093
|
+
({
|
|
1094
|
+
variant: e = "bot",
|
|
1095
|
+
position: n = "bottom",
|
|
1096
|
+
showTimestamp: s = !0,
|
|
1097
|
+
timestamp: a,
|
|
1098
|
+
showStatus: l = !1,
|
|
1099
|
+
status: u,
|
|
1100
|
+
avatarProps: o,
|
|
1101
|
+
className: d,
|
|
1102
|
+
children: r
|
|
1103
|
+
}, m) => {
|
|
1104
|
+
const c = (C) => C ? typeof C == "string" ? C : C.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : (/* @__PURE__ */ new Date()).toLocaleTimeString([], {
|
|
1105
|
+
hour: "2-digit",
|
|
1106
|
+
minute: "2-digit"
|
|
1107
|
+
}), i = (C) => {
|
|
1108
|
+
switch (C) {
|
|
1109
|
+
case "sending":
|
|
1110
|
+
return "Sending...";
|
|
1111
|
+
case "sent":
|
|
1112
|
+
return "Sent";
|
|
1113
|
+
case "error":
|
|
1114
|
+
return "Failed to send";
|
|
1115
|
+
default:
|
|
1116
|
+
return "";
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
return s || l || r || o ? /* @__PURE__ */ g(
|
|
1120
|
+
"div",
|
|
1121
|
+
{
|
|
1122
|
+
ref: m,
|
|
1123
|
+
className: mn({
|
|
1124
|
+
variant: e,
|
|
1125
|
+
position: n,
|
|
1126
|
+
className: d
|
|
1127
|
+
}),
|
|
1128
|
+
"data-webchat-message-info": !0,
|
|
1129
|
+
children: [
|
|
1130
|
+
o && /* @__PURE__ */ t(_e, { ...o }),
|
|
1131
|
+
s && /* @__PURE__ */ t("span", { className: H.timestamp, children: c(a) }),
|
|
1132
|
+
l && u && /* @__PURE__ */ t("span", { className: H.status, "data-status": u, children: i(u) })
|
|
1133
|
+
]
|
|
1134
|
+
}
|
|
1135
|
+
) : null;
|
|
1136
|
+
}
|
|
1137
|
+
), gn = "message-module__base___Ki7QB", hn = "message-module__bot___vw-E6", bn = "message-module__agent___2wXra", fn = "message-module__user___BSpcY", pn = "message-module__system___-jvsr", K = {
|
|
1138
|
+
base: gn,
|
|
1139
|
+
bot: hn,
|
|
1140
|
+
agent: bn,
|
|
1141
|
+
user: fn,
|
|
1142
|
+
system: pn
|
|
1143
|
+
}, vn = A(K.base, {
|
|
1144
|
+
variants: {
|
|
1145
|
+
variant: {
|
|
1146
|
+
user: K.user,
|
|
1147
|
+
bot: K.bot,
|
|
1148
|
+
system: K.system,
|
|
1149
|
+
agent: K.agent
|
|
1150
|
+
},
|
|
1151
|
+
status: {
|
|
1152
|
+
sending: K.sending,
|
|
1153
|
+
sent: K.sent,
|
|
1154
|
+
error: K.error
|
|
1155
|
+
}
|
|
1156
|
+
},
|
|
1157
|
+
defaultVariants: { variant: "bot", status: "sent" }
|
|
1158
|
+
});
|
|
1159
|
+
function Cn(e) {
|
|
1160
|
+
const {
|
|
1161
|
+
variant: n = "bot",
|
|
1162
|
+
status: s = "sent",
|
|
1163
|
+
showTimestamp: a = !0,
|
|
1164
|
+
showStatus: l = !1,
|
|
1165
|
+
avatarConfig: u,
|
|
1166
|
+
className: o,
|
|
1167
|
+
...d
|
|
1168
|
+
} = e;
|
|
1169
|
+
return se(() => {
|
|
1170
|
+
const r = vn({
|
|
1171
|
+
variant: n,
|
|
1172
|
+
status: s,
|
|
1173
|
+
className: o
|
|
1174
|
+
});
|
|
1175
|
+
if (!u)
|
|
1176
|
+
return {
|
|
1177
|
+
messageClasses: r,
|
|
1178
|
+
bubbleProps: {
|
|
1179
|
+
variant: n,
|
|
1180
|
+
status: s,
|
|
1181
|
+
...d
|
|
1182
|
+
},
|
|
1183
|
+
infoProps: {
|
|
1184
|
+
variant: n,
|
|
1185
|
+
showTimestamp: a,
|
|
1186
|
+
showStatus: l,
|
|
1187
|
+
...d
|
|
1188
|
+
},
|
|
1189
|
+
standaloneAvatarProps: null
|
|
1190
|
+
};
|
|
1191
|
+
const { placement: m, avatarProps: c } = u;
|
|
1192
|
+
switch (m) {
|
|
1193
|
+
case "bubble":
|
|
1194
|
+
return {
|
|
1195
|
+
messageClasses: r,
|
|
1196
|
+
bubbleProps: {
|
|
1197
|
+
variant: n,
|
|
1198
|
+
status: s,
|
|
1199
|
+
avatarProps: c,
|
|
1200
|
+
...d
|
|
1201
|
+
},
|
|
1202
|
+
infoProps: {
|
|
1203
|
+
variant: n,
|
|
1204
|
+
showTimestamp: a,
|
|
1205
|
+
showStatus: l,
|
|
1206
|
+
...d
|
|
1207
|
+
},
|
|
1208
|
+
standaloneAvatarProps: null
|
|
1209
|
+
};
|
|
1210
|
+
case "info":
|
|
1211
|
+
return {
|
|
1212
|
+
messageClasses: r,
|
|
1213
|
+
bubbleProps: {
|
|
1214
|
+
variant: n,
|
|
1215
|
+
status: s,
|
|
1216
|
+
...d
|
|
1217
|
+
},
|
|
1218
|
+
infoProps: {
|
|
1219
|
+
variant: n,
|
|
1220
|
+
showTimestamp: a,
|
|
1221
|
+
showStatus: l,
|
|
1222
|
+
avatarProps: c,
|
|
1223
|
+
...d
|
|
1224
|
+
},
|
|
1225
|
+
standaloneAvatarProps: null
|
|
1226
|
+
};
|
|
1227
|
+
case "standalone":
|
|
1228
|
+
return {
|
|
1229
|
+
messageClasses: r,
|
|
1230
|
+
bubbleProps: {
|
|
1231
|
+
variant: n,
|
|
1232
|
+
status: s,
|
|
1233
|
+
...d
|
|
1234
|
+
},
|
|
1235
|
+
infoProps: {
|
|
1236
|
+
variant: n,
|
|
1237
|
+
showTimestamp: a,
|
|
1238
|
+
showStatus: l,
|
|
1239
|
+
...d
|
|
1240
|
+
},
|
|
1241
|
+
standaloneAvatarProps: c
|
|
1242
|
+
};
|
|
1243
|
+
default:
|
|
1244
|
+
return {
|
|
1245
|
+
messageClasses: r,
|
|
1246
|
+
bubbleProps: {
|
|
1247
|
+
variant: n,
|
|
1248
|
+
status: s,
|
|
1249
|
+
...d
|
|
1250
|
+
},
|
|
1251
|
+
infoProps: {
|
|
1252
|
+
variant: n,
|
|
1253
|
+
showTimestamp: a,
|
|
1254
|
+
showStatus: l,
|
|
1255
|
+
...d
|
|
1256
|
+
},
|
|
1257
|
+
standaloneAvatarProps: null
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
}, [
|
|
1261
|
+
n,
|
|
1262
|
+
s,
|
|
1263
|
+
a,
|
|
1264
|
+
l,
|
|
1265
|
+
u,
|
|
1266
|
+
o,
|
|
1267
|
+
d
|
|
1268
|
+
]);
|
|
1269
|
+
}
|
|
1270
|
+
const q = $(
|
|
1271
|
+
(e, n) => {
|
|
1272
|
+
const { messageClasses: s, bubbleProps: a, infoProps: l, standaloneAvatarProps: u } = Cn(e);
|
|
1273
|
+
return /* @__PURE__ */ g(
|
|
1274
|
+
"div",
|
|
1275
|
+
{
|
|
1276
|
+
ref: n,
|
|
1277
|
+
className: s,
|
|
1278
|
+
"data-testid": `webchat-message-${e.variant || "bot"}`,
|
|
1279
|
+
children: [
|
|
1280
|
+
u && /* @__PURE__ */ t(_e, { ...u }),
|
|
1281
|
+
/* @__PURE__ */ t(tn, { ...a, children: e.children }),
|
|
1282
|
+
/* @__PURE__ */ t(_n, { ...l })
|
|
1283
|
+
]
|
|
1284
|
+
}
|
|
1285
|
+
);
|
|
1286
|
+
}
|
|
1287
|
+
), yn = "audio-message-module__audioMessageBase___Xye8T", wn = "audio-message-module__audioContainer___7ehUa", Nn = "audio-message-module__audioControls___bPgRS", Mn = "audio-message-module__playButton___zFi0C", xn = "audio-message-module__isPlaying___WQu2R", In = "audio-message-module__playIcon___X2gd4", Bn = "audio-message-module__audioInfo___YeYsJ", Tn = "audio-message-module__timeDisplay___zhXjk", kn = "audio-message-module__progressContainer___4gzGk", Sn = "audio-message-module__progressBar___TwMvE", R = {
|
|
1288
|
+
audioMessageBase: yn,
|
|
1289
|
+
audioContainer: wn,
|
|
1290
|
+
audioControls: Nn,
|
|
1291
|
+
playButton: Mn,
|
|
1292
|
+
isPlaying: xn,
|
|
1293
|
+
playIcon: In,
|
|
1294
|
+
audioInfo: Bn,
|
|
1295
|
+
timeDisplay: Tn,
|
|
1296
|
+
progressContainer: kn,
|
|
1297
|
+
progressBar: Sn
|
|
1298
|
+
}, Pn = $(
|
|
1299
|
+
({
|
|
1300
|
+
src: e,
|
|
1301
|
+
alt: n = "Audio message",
|
|
1302
|
+
onAudioLoad: s,
|
|
1303
|
+
onPlay: a,
|
|
1304
|
+
onPause: l,
|
|
1305
|
+
onEnded: u,
|
|
1306
|
+
className: o,
|
|
1307
|
+
...d
|
|
1308
|
+
}, r) => {
|
|
1309
|
+
const m = T(null), [c, i] = B(!1), [b, C] = B(null), [_, f] = B(0), v = h(() => {
|
|
1310
|
+
m.current && (C(m.current.duration), s?.());
|
|
1311
|
+
}, [s]), p = h(() => {
|
|
1312
|
+
m.current && f(m.current.currentTime);
|
|
1313
|
+
}, []), w = h(() => {
|
|
1314
|
+
i(!0), a?.();
|
|
1315
|
+
}, [a]), M = h(() => {
|
|
1316
|
+
i(!1), l?.();
|
|
1317
|
+
}, [l]), y = h(() => {
|
|
1318
|
+
i(!1), f(0), u?.();
|
|
1319
|
+
}, [u]), z = h(() => {
|
|
1320
|
+
m.current && (c ? m.current.pause() : m.current.play());
|
|
1321
|
+
}, [c]), N = h(
|
|
1322
|
+
(F) => {
|
|
1323
|
+
const Z = parseFloat(F.target.value);
|
|
1324
|
+
m.current && (m.current.currentTime = Z, f(Z));
|
|
1325
|
+
},
|
|
1326
|
+
[]
|
|
1327
|
+
), D = h((F) => {
|
|
1328
|
+
const Z = Math.floor(F / 60), ce = Math.floor(F % 60);
|
|
1329
|
+
return `${Z}:${ce.toString().padStart(2, "0")}`;
|
|
1330
|
+
}, []);
|
|
1331
|
+
return /* @__PURE__ */ t(
|
|
1332
|
+
q,
|
|
1333
|
+
{
|
|
1334
|
+
ref: r,
|
|
1335
|
+
className: k(R.audioMessageBase, o),
|
|
1336
|
+
...d,
|
|
1337
|
+
children: /* @__PURE__ */ g("div", { className: R.audioContainer, children: [
|
|
1338
|
+
/* @__PURE__ */ t(
|
|
1339
|
+
"audio",
|
|
1340
|
+
{
|
|
1341
|
+
ref: m,
|
|
1342
|
+
src: e,
|
|
1343
|
+
onLoadedMetadata: v,
|
|
1344
|
+
onTimeUpdate: p,
|
|
1345
|
+
onPlay: w,
|
|
1346
|
+
onPause: M,
|
|
1347
|
+
onEnded: y,
|
|
1348
|
+
preload: "metadata"
|
|
1349
|
+
}
|
|
1350
|
+
),
|
|
1351
|
+
/* @__PURE__ */ g("div", { className: R.audioControls, children: [
|
|
1352
|
+
/* @__PURE__ */ t(
|
|
1353
|
+
"button",
|
|
1354
|
+
{
|
|
1355
|
+
type: "button",
|
|
1356
|
+
className: k(R.playButton, c && R.isPlaying),
|
|
1357
|
+
onClick: z,
|
|
1358
|
+
"aria-label": c ? "Pause audio" : "Play audio",
|
|
1359
|
+
children: c ? /* @__PURE__ */ g(
|
|
1360
|
+
"svg",
|
|
1361
|
+
{
|
|
1362
|
+
className: R.playIcon,
|
|
1363
|
+
viewBox: "0 0 24 24",
|
|
1364
|
+
fill: "currentColor",
|
|
1365
|
+
children: [
|
|
1366
|
+
/* @__PURE__ */ t("rect", { x: "6", y: "4", width: "4", height: "16" }),
|
|
1367
|
+
/* @__PURE__ */ t("rect", { x: "14", y: "4", width: "4", height: "16" })
|
|
1368
|
+
]
|
|
1369
|
+
}
|
|
1370
|
+
) : /* @__PURE__ */ t(
|
|
1371
|
+
"svg",
|
|
1372
|
+
{
|
|
1373
|
+
className: R.playIcon,
|
|
1374
|
+
viewBox: "0 0 24 24",
|
|
1375
|
+
fill: "currentColor",
|
|
1376
|
+
children: /* @__PURE__ */ t("polygon", { points: "5,3 19,12 5,21" })
|
|
1377
|
+
}
|
|
1378
|
+
)
|
|
1379
|
+
}
|
|
1380
|
+
),
|
|
1381
|
+
/* @__PURE__ */ g("div", { className: R.audioInfo, children: [
|
|
1382
|
+
/* @__PURE__ */ g("div", { className: R.timeDisplay, children: [
|
|
1383
|
+
D(_),
|
|
1384
|
+
" /",
|
|
1385
|
+
" ",
|
|
1386
|
+
b ? D(b) : "--:--"
|
|
1387
|
+
] }),
|
|
1388
|
+
/* @__PURE__ */ t("div", { className: R.progressContainer, children: /* @__PURE__ */ t(
|
|
1389
|
+
"input",
|
|
1390
|
+
{
|
|
1391
|
+
type: "range",
|
|
1392
|
+
min: "0",
|
|
1393
|
+
max: b || 0,
|
|
1394
|
+
value: _,
|
|
1395
|
+
onChange: N,
|
|
1396
|
+
className: R.progressBar,
|
|
1397
|
+
disabled: !b
|
|
1398
|
+
}
|
|
1399
|
+
) })
|
|
1400
|
+
] })
|
|
1401
|
+
] })
|
|
1402
|
+
] })
|
|
1403
|
+
}
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1406
|
+
), $n = "button-message-module__buttonMessageBase___ZYxyt", Ln = "button-message-module__buttonMessageContainer___HZsQh", En = "button-message-module__buttonGrid___KQjrj", Dn = "button-message-module__buttonText___8-9nw", ae = {
|
|
1407
|
+
buttonMessageBase: $n,
|
|
1408
|
+
buttonMessageContainer: Ln,
|
|
1409
|
+
buttonGrid: En,
|
|
1410
|
+
buttonText: Dn
|
|
1411
|
+
}, An = $(
|
|
1412
|
+
({ text: e, buttons: n, buttonsPerRow: s = 2, className: a, ...l }, u) => {
|
|
1413
|
+
const o = Math.min(s, n.length), d = (r) => {
|
|
1414
|
+
"value" in r && n.find(
|
|
1415
|
+
(c) => c.text === r.text && c.value === r.value
|
|
1416
|
+
)?.onClick?.(r.value);
|
|
1417
|
+
};
|
|
1418
|
+
return /* @__PURE__ */ t(
|
|
1419
|
+
q,
|
|
1420
|
+
{
|
|
1421
|
+
ref: u,
|
|
1422
|
+
className: k(ae.buttonMessageBase, a),
|
|
1423
|
+
...l,
|
|
1424
|
+
children: /* @__PURE__ */ g("div", { className: ae.buttonMessageContainer, children: [
|
|
1425
|
+
e && /* @__PURE__ */ t("div", { className: ae.buttonText, children: e }),
|
|
1426
|
+
/* @__PURE__ */ t(
|
|
1427
|
+
"div",
|
|
1428
|
+
{
|
|
1429
|
+
className: ae.buttonGrid,
|
|
1430
|
+
style: {
|
|
1431
|
+
gridTemplateColumns: `repeat(${o}, 1fr)`
|
|
1432
|
+
},
|
|
1433
|
+
children: n.map((r, m) => /* @__PURE__ */ t(
|
|
1434
|
+
ie,
|
|
1435
|
+
{
|
|
1436
|
+
text: r.text,
|
|
1437
|
+
disabled: r.disabled,
|
|
1438
|
+
button: { text: r.text, value: r.value },
|
|
1439
|
+
onClick: d,
|
|
1440
|
+
variant: "secondary"
|
|
1441
|
+
},
|
|
1442
|
+
m
|
|
1443
|
+
))
|
|
1444
|
+
}
|
|
1445
|
+
)
|
|
1446
|
+
] })
|
|
1447
|
+
}
|
|
1448
|
+
);
|
|
1449
|
+
}
|
|
1450
|
+
), zn = "carousel-message-module__carouselMessageBase___yV-Nd", Rn = "carousel-message-module__carouselContainer___32NGN", On = "carousel-message-module__carouselElement___6Cucf", Vn = "carousel-message-module__imageContainer___-NYcV", Wn = "carousel-message-module__elementImage___TEjVf", Hn = "carousel-message-module__elementContent___fQqqZ", jn = "carousel-message-module__elementTitle___sUPzb", Fn = "carousel-message-module__elementSubtitle___7yW9w", Un = "carousel-message-module__buttonContainer___lPydV", W = {
|
|
1451
|
+
carouselMessageBase: zn,
|
|
1452
|
+
carouselContainer: Rn,
|
|
1453
|
+
carouselElement: On,
|
|
1454
|
+
imageContainer: Vn,
|
|
1455
|
+
elementImage: Wn,
|
|
1456
|
+
elementContent: Hn,
|
|
1457
|
+
elementTitle: jn,
|
|
1458
|
+
elementSubtitle: Fn,
|
|
1459
|
+
buttonContainer: Un
|
|
1460
|
+
}, Yn = $(
|
|
1461
|
+
({ elements: e, onButtonClick: n, onElementImageLoad: s, className: a, ...l }, u) => {
|
|
1462
|
+
const o = h(
|
|
1463
|
+
(r) => {
|
|
1464
|
+
"type" in r && n?.(r);
|
|
1465
|
+
},
|
|
1466
|
+
[n]
|
|
1467
|
+
), d = h(
|
|
1468
|
+
(r) => {
|
|
1469
|
+
s?.(r);
|
|
1470
|
+
},
|
|
1471
|
+
[s]
|
|
1472
|
+
);
|
|
1473
|
+
return /* @__PURE__ */ t(
|
|
1474
|
+
q,
|
|
1475
|
+
{
|
|
1476
|
+
ref: u,
|
|
1477
|
+
className: k(W.carouselMessageBase, a),
|
|
1478
|
+
...l,
|
|
1479
|
+
children: /* @__PURE__ */ t("div", { className: W.carouselContainer, children: e.map((r, m) => /* @__PURE__ */ g(
|
|
1480
|
+
"div",
|
|
1481
|
+
{
|
|
1482
|
+
className: W.carouselElement,
|
|
1483
|
+
children: [
|
|
1484
|
+
/* @__PURE__ */ t("div", { className: W.imageContainer, children: /* @__PURE__ */ t(
|
|
1485
|
+
"img",
|
|
1486
|
+
{
|
|
1487
|
+
src: r.image,
|
|
1488
|
+
alt: r.title,
|
|
1489
|
+
className: W.elementImage,
|
|
1490
|
+
onLoad: () => d(m)
|
|
1491
|
+
}
|
|
1492
|
+
) }),
|
|
1493
|
+
/* @__PURE__ */ g("div", { className: W.elementContent, children: [
|
|
1494
|
+
/* @__PURE__ */ t("h3", { className: W.elementTitle, children: r.title }),
|
|
1495
|
+
r.subtitle && /* @__PURE__ */ t("p", { className: W.elementSubtitle, children: r.subtitle }),
|
|
1496
|
+
r.buttons.map((c, i) => /* @__PURE__ */ t(
|
|
1497
|
+
"div",
|
|
1498
|
+
{
|
|
1499
|
+
className: W.buttonContainer,
|
|
1500
|
+
children: /* @__PURE__ */ t(
|
|
1501
|
+
ie,
|
|
1502
|
+
{
|
|
1503
|
+
text: c.title,
|
|
1504
|
+
button: c,
|
|
1505
|
+
onClick: o,
|
|
1506
|
+
variant: "secondary"
|
|
1507
|
+
}
|
|
1508
|
+
)
|
|
1509
|
+
},
|
|
1510
|
+
`${r.title}-${r.subtitle || ""}-${c.title}-${i}`
|
|
1511
|
+
))
|
|
1512
|
+
] })
|
|
1513
|
+
]
|
|
1514
|
+
},
|
|
1515
|
+
`${r.title}-${r.subtitle || ""}-${m}`
|
|
1516
|
+
)) })
|
|
1517
|
+
}
|
|
1518
|
+
);
|
|
1519
|
+
}
|
|
1520
|
+
), Kn = "document-message-module__documentMessageBase___hqh5-", Xn = "document-message-module__documentContainer___AYtOi", qn = "document-message-module__documentInfo___UiSqy", Gn = "document-message-module__documentIcon___Ti2QJ", Qn = "document-message-module__documentDetails___XDlt9", Zn = "document-message-module__documentName___UsAgR", Jn = "document-message-module__documentMeta___5QVnf", es = "document-message-module__fileSize___qOdcA", ts = "document-message-module__fileType___7EdaH", ns = "document-message-module__documentActions___7m0QP", ss = "document-message-module__previewButton___gluoY", as = "document-message-module__downloadButton___J6HuC", os = "document-message-module__previewIcon___7HMaf", rs = "document-message-module__downloadIcon___Hg4tV", S = {
|
|
1521
|
+
documentMessageBase: Kn,
|
|
1522
|
+
documentContainer: Xn,
|
|
1523
|
+
documentInfo: qn,
|
|
1524
|
+
documentIcon: Gn,
|
|
1525
|
+
documentDetails: Qn,
|
|
1526
|
+
documentName: Zn,
|
|
1527
|
+
documentMeta: Jn,
|
|
1528
|
+
fileSize: es,
|
|
1529
|
+
fileType: ts,
|
|
1530
|
+
documentActions: ns,
|
|
1531
|
+
previewButton: ss,
|
|
1532
|
+
downloadButton: as,
|
|
1533
|
+
previewIcon: os,
|
|
1534
|
+
downloadIcon: rs
|
|
1535
|
+
}, is = $(
|
|
1536
|
+
({
|
|
1537
|
+
src: e,
|
|
1538
|
+
filename: n,
|
|
1539
|
+
mimeType: s,
|
|
1540
|
+
size: a,
|
|
1541
|
+
alt: l = "Document",
|
|
1542
|
+
onDocumentLoad: u,
|
|
1543
|
+
onDownload: o,
|
|
1544
|
+
className: d,
|
|
1545
|
+
...r
|
|
1546
|
+
}, m) => {
|
|
1547
|
+
const c = h(() => {
|
|
1548
|
+
u?.();
|
|
1549
|
+
}, [u]), i = h(() => {
|
|
1550
|
+
const _ = document.createElement("a");
|
|
1551
|
+
_.href = e, _.download = n || "document", _.target = "_blank", _.rel = "noopener noreferrer", document.body.appendChild(_), _.click(), document.body.removeChild(_), o?.();
|
|
1552
|
+
}, [e, n, o]), b = h((_) => {
|
|
1553
|
+
if (!_) return "Unknown size";
|
|
1554
|
+
const f = ["B", "KB", "MB", "GB"];
|
|
1555
|
+
let v = _, p = 0;
|
|
1556
|
+
for (; v >= 1024 && p < f.length - 1; )
|
|
1557
|
+
v /= 1024, p++;
|
|
1558
|
+
return `${v.toFixed(1)} ${f[p]}`;
|
|
1559
|
+
}, []), C = h((_) => _ ? _.startsWith("image/") ? "๐ผ๏ธ" : _.startsWith("video/") ? "๐ฅ" : _.startsWith("audio/") ? "๐ต" : _.includes("pdf") ? "๐" : _.includes("word") || _.includes("document") ? "๐" : _.includes("excel") || _.includes("spreadsheet") ? "๐" : _.includes("powerpoint") || _.includes("presentation") ? "๐" : _.includes("zip") || _.includes("archive") ? "๐ฆ" : (_.includes("text/"), "๐") : "๐", []);
|
|
1560
|
+
return /* @__PURE__ */ t(
|
|
1561
|
+
q,
|
|
1562
|
+
{
|
|
1563
|
+
ref: m,
|
|
1564
|
+
className: k(S.documentMessageBase, d),
|
|
1565
|
+
...r,
|
|
1566
|
+
children: /* @__PURE__ */ g("div", { className: S.documentContainer, children: [
|
|
1567
|
+
/* @__PURE__ */ g("div", { className: S.documentInfo, children: [
|
|
1568
|
+
/* @__PURE__ */ t("div", { className: S.documentIcon, children: C(s) }),
|
|
1569
|
+
/* @__PURE__ */ g("div", { className: S.documentDetails, children: [
|
|
1570
|
+
/* @__PURE__ */ t("div", { className: S.documentName, children: n || "Document" }),
|
|
1571
|
+
/* @__PURE__ */ g("div", { className: S.documentMeta, children: [
|
|
1572
|
+
/* @__PURE__ */ t("span", { className: S.fileSize, children: b(a) }),
|
|
1573
|
+
s && /* @__PURE__ */ t("span", { className: S.fileType, children: s.split("/")[1]?.toUpperCase() || s })
|
|
1574
|
+
] })
|
|
1575
|
+
] })
|
|
1576
|
+
] }),
|
|
1577
|
+
/* @__PURE__ */ g("div", { className: S.documentActions, children: [
|
|
1578
|
+
/* @__PURE__ */ g(
|
|
1579
|
+
"button",
|
|
1580
|
+
{
|
|
1581
|
+
type: "button",
|
|
1582
|
+
className: S.previewButton,
|
|
1583
|
+
onClick: c,
|
|
1584
|
+
"aria-label": "Preview document",
|
|
1585
|
+
children: [
|
|
1586
|
+
/* @__PURE__ */ t(
|
|
1587
|
+
"svg",
|
|
1588
|
+
{
|
|
1589
|
+
className: S.previewIcon,
|
|
1590
|
+
viewBox: "0 0 24 24",
|
|
1591
|
+
fill: "currentColor",
|
|
1592
|
+
children: /* @__PURE__ */ t("path", { d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z" })
|
|
1593
|
+
}
|
|
1594
|
+
),
|
|
1595
|
+
"Preview"
|
|
1596
|
+
]
|
|
1597
|
+
}
|
|
1598
|
+
),
|
|
1599
|
+
/* @__PURE__ */ g(
|
|
1600
|
+
"button",
|
|
1601
|
+
{
|
|
1602
|
+
type: "button",
|
|
1603
|
+
className: S.downloadButton,
|
|
1604
|
+
onClick: i,
|
|
1605
|
+
"aria-label": "Download document",
|
|
1606
|
+
children: [
|
|
1607
|
+
/* @__PURE__ */ t(
|
|
1608
|
+
"svg",
|
|
1609
|
+
{
|
|
1610
|
+
className: S.downloadIcon,
|
|
1611
|
+
viewBox: "0 0 24 24",
|
|
1612
|
+
fill: "currentColor",
|
|
1613
|
+
children: /* @__PURE__ */ t("path", { d: "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z" })
|
|
1614
|
+
}
|
|
1615
|
+
),
|
|
1616
|
+
"Download"
|
|
1617
|
+
]
|
|
1618
|
+
}
|
|
1619
|
+
)
|
|
1620
|
+
] })
|
|
1621
|
+
] })
|
|
1622
|
+
}
|
|
1623
|
+
);
|
|
1624
|
+
}
|
|
1625
|
+
), ls = "image-message-module__imageMessageBase___FDwNN", cs = "image-message-module__messageImage___JnXFb", fe = {
|
|
1626
|
+
imageMessageBase: ls,
|
|
1627
|
+
messageImage: cs
|
|
1628
|
+
}, us = $(
|
|
1629
|
+
({ src: e, alt: n = "Attached image", onImageLoad: s, className: a, ...l }, u) => {
|
|
1630
|
+
const o = h(() => {
|
|
1631
|
+
s?.();
|
|
1632
|
+
}, [s]), d = h(() => {
|
|
1633
|
+
s?.();
|
|
1634
|
+
}, [s]);
|
|
1635
|
+
return /* @__PURE__ */ t(
|
|
1636
|
+
q,
|
|
1637
|
+
{
|
|
1638
|
+
ref: u,
|
|
1639
|
+
className: k(fe.imageMessageBase, a),
|
|
1640
|
+
...l,
|
|
1641
|
+
children: /* @__PURE__ */ t(
|
|
1642
|
+
"img",
|
|
1643
|
+
{
|
|
1644
|
+
src: e,
|
|
1645
|
+
alt: n,
|
|
1646
|
+
className: fe.messageImage,
|
|
1647
|
+
onLoad: o,
|
|
1648
|
+
onError: d
|
|
1649
|
+
}
|
|
1650
|
+
)
|
|
1651
|
+
}
|
|
1652
|
+
);
|
|
1653
|
+
}
|
|
1654
|
+
), ds = "location-message-module__locationMessageBase___rY3d-", ms = "location-message-module__locationContainer___9Rukw", _s = "location-message-module__locationContent___2BRdV", gs = "location-message-module__locationIcon___rjObu", hs = "location-message-module__locationInfo___NqVsR", bs = "location-message-module__locationTitle___RpUjH", fs = "location-message-module__locationCoordinates___lLfuf", ps = "location-message-module__locationLink___Zq2I2", X = {
|
|
1655
|
+
locationMessageBase: ds,
|
|
1656
|
+
locationContainer: ms,
|
|
1657
|
+
locationContent: _s,
|
|
1658
|
+
locationIcon: gs,
|
|
1659
|
+
locationInfo: hs,
|
|
1660
|
+
locationTitle: bs,
|
|
1661
|
+
locationCoordinates: fs,
|
|
1662
|
+
locationLink: ps
|
|
1663
|
+
}, vs = $(
|
|
1664
|
+
({
|
|
1665
|
+
latitude: e,
|
|
1666
|
+
longitude: n,
|
|
1667
|
+
alt: s = "Location coordinates",
|
|
1668
|
+
onLocationLoad: a,
|
|
1669
|
+
className: l,
|
|
1670
|
+
...u
|
|
1671
|
+
}, o) => {
|
|
1672
|
+
const d = h(() => {
|
|
1673
|
+
a?.();
|
|
1674
|
+
}, [a]), r = `https://www.google.com/maps?q=${e},${n}`;
|
|
1675
|
+
return /* @__PURE__ */ t(
|
|
1676
|
+
q,
|
|
1677
|
+
{
|
|
1678
|
+
ref: o,
|
|
1679
|
+
className: k(X.locationMessageBase, l),
|
|
1680
|
+
...u,
|
|
1681
|
+
children: /* @__PURE__ */ g("div", { className: X.locationContainer, children: [
|
|
1682
|
+
/* @__PURE__ */ g("div", { className: X.locationContent, children: [
|
|
1683
|
+
/* @__PURE__ */ t("div", { className: X.locationIcon, children: /* @__PURE__ */ t(
|
|
1684
|
+
"svg",
|
|
1685
|
+
{
|
|
1686
|
+
width: "24",
|
|
1687
|
+
height: "24",
|
|
1688
|
+
viewBox: "0 0 24 24",
|
|
1689
|
+
fill: "none",
|
|
1690
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1691
|
+
"aria-hidden": "true",
|
|
1692
|
+
children: /* @__PURE__ */ t(
|
|
1693
|
+
"path",
|
|
1694
|
+
{
|
|
1695
|
+
d: "M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",
|
|
1696
|
+
fill: "currentColor"
|
|
1697
|
+
}
|
|
1698
|
+
)
|
|
1699
|
+
}
|
|
1700
|
+
) }),
|
|
1701
|
+
/* @__PURE__ */ g("div", { className: X.locationInfo, children: [
|
|
1702
|
+
/* @__PURE__ */ t("div", { className: X.locationTitle, children: "Location" }),
|
|
1703
|
+
/* @__PURE__ */ g("div", { className: X.locationCoordinates, children: [
|
|
1704
|
+
e.toFixed(6),
|
|
1705
|
+
", ",
|
|
1706
|
+
n.toFixed(6)
|
|
1707
|
+
] })
|
|
1708
|
+
] })
|
|
1709
|
+
] }),
|
|
1710
|
+
/* @__PURE__ */ g(
|
|
1711
|
+
"a",
|
|
1712
|
+
{
|
|
1713
|
+
href: r,
|
|
1714
|
+
target: "_blank",
|
|
1715
|
+
rel: "noopener noreferrer",
|
|
1716
|
+
className: X.locationLink,
|
|
1717
|
+
onClick: d,
|
|
1718
|
+
"aria-label": `Open location in Google Maps: ${e}, ${n}`,
|
|
1719
|
+
children: [
|
|
1720
|
+
/* @__PURE__ */ t("span", { children: "View on Map" }),
|
|
1721
|
+
/* @__PURE__ */ t(
|
|
1722
|
+
"svg",
|
|
1723
|
+
{
|
|
1724
|
+
width: "16",
|
|
1725
|
+
height: "16",
|
|
1726
|
+
viewBox: "0 0 24 24",
|
|
1727
|
+
fill: "none",
|
|
1728
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1729
|
+
"aria-hidden": "true",
|
|
1730
|
+
children: /* @__PURE__ */ t(
|
|
1731
|
+
"path",
|
|
1732
|
+
{
|
|
1733
|
+
d: "M7 17L17 7M17 7H7M17 7V17",
|
|
1734
|
+
stroke: "currentColor",
|
|
1735
|
+
strokeWidth: "2",
|
|
1736
|
+
strokeLinecap: "round",
|
|
1737
|
+
strokeLinejoin: "round"
|
|
1738
|
+
}
|
|
1739
|
+
)
|
|
1740
|
+
}
|
|
1741
|
+
)
|
|
1742
|
+
]
|
|
1743
|
+
}
|
|
1744
|
+
)
|
|
1745
|
+
] })
|
|
1746
|
+
}
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
), Cs = "text-message-module__textMessageBase___p4r-t", ys = "text-message-module__textContent___yRb8d", pe = {
|
|
1750
|
+
textMessageBase: Cs,
|
|
1751
|
+
textContent: ys
|
|
1752
|
+
}, ws = $(
|
|
1753
|
+
({ text: e, className: n, ...s }, a) => /* @__PURE__ */ t(
|
|
1754
|
+
q,
|
|
1755
|
+
{
|
|
1756
|
+
ref: a,
|
|
1757
|
+
className: k(pe.textMessageBase, n),
|
|
1758
|
+
...s,
|
|
1759
|
+
children: /* @__PURE__ */ t("div", { className: pe.textContent, children: e })
|
|
1760
|
+
}
|
|
1761
|
+
)
|
|
1762
|
+
), Ns = "video-message-module__videoMessageBase___RX3Qk", Ms = "video-message-module__videoContainer___ctZrR", xs = "video-message-module__videoElement___dYbDh", Is = "video-message-module__videoControls___K4Xdt", Bs = "video-message-module__controlsTop___6NCn9", Ts = "video-message-module__controlsBottom___E3II8", ks = "video-message-module__controlsLeft___feB6m", Ss = "video-message-module__controlsRight___9Wtf-", Ps = "video-message-module__playButton___8LVrt", $s = "video-message-module__isPlaying___z4Tf5", Ls = "video-message-module__playIcon___ert2Q", Es = "video-message-module__timeDisplay___Rzmtn", Ds = "video-message-module__progressContainer___U81jI", As = "video-message-module__progressBar___vX-3m", zs = "video-message-module__volumeContainer___-mIlN", Rs = "video-message-module__volumeIcon___x18vs", Os = "video-message-module__volumeSlider___jAwcn", x = {
|
|
1763
|
+
videoMessageBase: Ns,
|
|
1764
|
+
videoContainer: Ms,
|
|
1765
|
+
videoElement: xs,
|
|
1766
|
+
videoControls: Is,
|
|
1767
|
+
controlsTop: Bs,
|
|
1768
|
+
controlsBottom: Ts,
|
|
1769
|
+
controlsLeft: ks,
|
|
1770
|
+
controlsRight: Ss,
|
|
1771
|
+
playButton: Ps,
|
|
1772
|
+
isPlaying: $s,
|
|
1773
|
+
playIcon: Ls,
|
|
1774
|
+
timeDisplay: Es,
|
|
1775
|
+
progressContainer: Ds,
|
|
1776
|
+
progressBar: As,
|
|
1777
|
+
volumeContainer: zs,
|
|
1778
|
+
volumeIcon: Rs,
|
|
1779
|
+
volumeSlider: Os
|
|
1780
|
+
}, Vs = $(
|
|
1781
|
+
({
|
|
1782
|
+
src: e,
|
|
1783
|
+
alt: n = "Video message",
|
|
1784
|
+
onVideoLoad: s,
|
|
1785
|
+
onPlay: a,
|
|
1786
|
+
onPause: l,
|
|
1787
|
+
onEnded: u,
|
|
1788
|
+
className: o,
|
|
1789
|
+
...d
|
|
1790
|
+
}, r) => {
|
|
1791
|
+
const m = T(null), [c, i] = B(!1), [b, C] = B(null), [_, f] = B(0), [v, p] = B(1), [w, M] = B(!1), y = h(() => {
|
|
1792
|
+
m.current && (C(m.current.duration), s?.());
|
|
1793
|
+
}, [s]), z = h(() => {
|
|
1794
|
+
m.current && f(m.current.currentTime);
|
|
1795
|
+
}, []), N = h(() => {
|
|
1796
|
+
i(!0), a?.();
|
|
1797
|
+
}, [a]), D = h(() => {
|
|
1798
|
+
i(!1), l?.();
|
|
1799
|
+
}, [l]), F = h(() => {
|
|
1800
|
+
i(!1), f(0), u?.();
|
|
1801
|
+
}, [u]), Z = h(() => {
|
|
1802
|
+
m.current && (c ? m.current.pause() : m.current.play());
|
|
1803
|
+
}, [c]), ce = h(
|
|
1804
|
+
(U) => {
|
|
1805
|
+
const G = parseFloat(U.target.value);
|
|
1806
|
+
m.current && (m.current.currentTime = G, f(G));
|
|
1807
|
+
},
|
|
1808
|
+
[]
|
|
1809
|
+
), xe = h(
|
|
1810
|
+
(U) => {
|
|
1811
|
+
const G = parseFloat(U.target.value);
|
|
1812
|
+
m.current && (m.current.volume = G, p(G));
|
|
1813
|
+
},
|
|
1814
|
+
[]
|
|
1815
|
+
), Ie = h(() => {
|
|
1816
|
+
M((U) => !U);
|
|
1817
|
+
}, []), ge = h((U) => {
|
|
1818
|
+
const G = Math.floor(U / 60), Be = Math.floor(U % 60);
|
|
1819
|
+
return `${G}:${Be.toString().padStart(2, "0")}`;
|
|
1820
|
+
}, []);
|
|
1821
|
+
return /* @__PURE__ */ t(
|
|
1822
|
+
q,
|
|
1823
|
+
{
|
|
1824
|
+
ref: r,
|
|
1825
|
+
className: k(x.videoMessageBase, o),
|
|
1826
|
+
...d,
|
|
1827
|
+
children: /* @__PURE__ */ g("div", { className: x.videoContainer, children: [
|
|
1828
|
+
/* @__PURE__ */ t(
|
|
1829
|
+
"video",
|
|
1830
|
+
{
|
|
1831
|
+
ref: m,
|
|
1832
|
+
src: e,
|
|
1833
|
+
onLoadedMetadata: y,
|
|
1834
|
+
onTimeUpdate: z,
|
|
1835
|
+
onPlay: N,
|
|
1836
|
+
onPause: D,
|
|
1837
|
+
onEnded: F,
|
|
1838
|
+
onClick: Ie,
|
|
1839
|
+
className: x.videoElement,
|
|
1840
|
+
preload: "metadata",
|
|
1841
|
+
poster: ""
|
|
1842
|
+
}
|
|
1843
|
+
),
|
|
1844
|
+
w && /* @__PURE__ */ g("div", { className: x.videoControls, children: [
|
|
1845
|
+
/* @__PURE__ */ t("div", { className: x.controlsTop, children: /* @__PURE__ */ t("div", { className: x.progressContainer, children: /* @__PURE__ */ t(
|
|
1846
|
+
"input",
|
|
1847
|
+
{
|
|
1848
|
+
type: "range",
|
|
1849
|
+
min: "0",
|
|
1850
|
+
max: b || 0,
|
|
1851
|
+
value: _,
|
|
1852
|
+
onChange: ce,
|
|
1853
|
+
className: x.progressBar,
|
|
1854
|
+
disabled: !b
|
|
1855
|
+
}
|
|
1856
|
+
) }) }),
|
|
1857
|
+
/* @__PURE__ */ g("div", { className: x.controlsBottom, children: [
|
|
1858
|
+
/* @__PURE__ */ g("div", { className: x.controlsLeft, children: [
|
|
1859
|
+
/* @__PURE__ */ t(
|
|
1860
|
+
"button",
|
|
1861
|
+
{
|
|
1862
|
+
type: "button",
|
|
1863
|
+
className: k(
|
|
1864
|
+
x.playButton,
|
|
1865
|
+
c && x.isPlaying
|
|
1866
|
+
),
|
|
1867
|
+
onClick: Z,
|
|
1868
|
+
"aria-label": c ? "Pause video" : "Play video",
|
|
1869
|
+
children: c ? /* @__PURE__ */ g(
|
|
1870
|
+
"svg",
|
|
1871
|
+
{
|
|
1872
|
+
className: x.playIcon,
|
|
1873
|
+
viewBox: "0 0 24 24",
|
|
1874
|
+
fill: "currentColor",
|
|
1875
|
+
children: [
|
|
1876
|
+
/* @__PURE__ */ t("rect", { x: "6", y: "4", width: "4", height: "16" }),
|
|
1877
|
+
/* @__PURE__ */ t("rect", { x: "14", y: "4", width: "4", height: "16" })
|
|
1878
|
+
]
|
|
1879
|
+
}
|
|
1880
|
+
) : /* @__PURE__ */ t(
|
|
1881
|
+
"svg",
|
|
1882
|
+
{
|
|
1883
|
+
className: x.playIcon,
|
|
1884
|
+
viewBox: "0 0 24 24",
|
|
1885
|
+
fill: "currentColor",
|
|
1886
|
+
children: /* @__PURE__ */ t("polygon", { points: "5,3 19,12 5,21" })
|
|
1887
|
+
}
|
|
1888
|
+
)
|
|
1889
|
+
}
|
|
1890
|
+
),
|
|
1891
|
+
/* @__PURE__ */ g("div", { className: x.timeDisplay, children: [
|
|
1892
|
+
ge(_),
|
|
1893
|
+
" /",
|
|
1894
|
+
" ",
|
|
1895
|
+
b ? ge(b) : "--:--"
|
|
1896
|
+
] })
|
|
1897
|
+
] }),
|
|
1898
|
+
/* @__PURE__ */ t("div", { className: x.controlsRight, children: /* @__PURE__ */ g("div", { className: x.volumeContainer, children: [
|
|
1899
|
+
/* @__PURE__ */ t(
|
|
1900
|
+
"svg",
|
|
1901
|
+
{
|
|
1902
|
+
className: x.volumeIcon,
|
|
1903
|
+
viewBox: "0 0 24 24",
|
|
1904
|
+
fill: "currentColor",
|
|
1905
|
+
children: v === 0 ? /* @__PURE__ */ t("path", { d: "M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z" }) : v < 0.5 ? /* @__PURE__ */ t("path", { d: "M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z" }) : /* @__PURE__ */ t("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z" })
|
|
1906
|
+
}
|
|
1907
|
+
),
|
|
1908
|
+
/* @__PURE__ */ t(
|
|
1909
|
+
"input",
|
|
1910
|
+
{
|
|
1911
|
+
type: "range",
|
|
1912
|
+
min: "0",
|
|
1913
|
+
max: "1",
|
|
1914
|
+
step: "0.1",
|
|
1915
|
+
value: v,
|
|
1916
|
+
onChange: xe,
|
|
1917
|
+
className: x.volumeSlider
|
|
1918
|
+
}
|
|
1919
|
+
)
|
|
1920
|
+
] }) })
|
|
1921
|
+
] })
|
|
1922
|
+
] })
|
|
1923
|
+
] })
|
|
1924
|
+
}
|
|
1925
|
+
);
|
|
1926
|
+
}
|
|
1927
|
+
);
|
|
1928
|
+
function Ws({
|
|
1929
|
+
messageActor: e,
|
|
1930
|
+
baseProps: n = {}
|
|
1931
|
+
}) {
|
|
1932
|
+
const { message: s, status: a } = E(e, (d) => ({
|
|
1933
|
+
message: d.context?.message,
|
|
1934
|
+
status: d.context?.status
|
|
1935
|
+
})), l = E(
|
|
1936
|
+
e,
|
|
1937
|
+
(d) => d.can?.({ type: "RETRY" }) ?? !1
|
|
1938
|
+
), u = se(() => {
|
|
1939
|
+
if (!s)
|
|
1940
|
+
return {
|
|
1941
|
+
...n,
|
|
1942
|
+
variant: "bot",
|
|
1943
|
+
status: "sent",
|
|
1944
|
+
showTimestamp: !0,
|
|
1945
|
+
isClickable: !1
|
|
1946
|
+
};
|
|
1947
|
+
const d = (() => {
|
|
1948
|
+
switch (a) {
|
|
1949
|
+
case "unsent":
|
|
1950
|
+
return "sending";
|
|
1951
|
+
case "sent":
|
|
1952
|
+
return "sent";
|
|
1953
|
+
case "failed":
|
|
1954
|
+
return "error";
|
|
1955
|
+
default:
|
|
1956
|
+
return "sent";
|
|
1957
|
+
}
|
|
1958
|
+
})(), r = (() => {
|
|
1959
|
+
switch (s.sent_by) {
|
|
1960
|
+
case oe.User:
|
|
1961
|
+
return "user";
|
|
1962
|
+
case oe.Bot:
|
|
1963
|
+
return "bot";
|
|
1964
|
+
case oe.Agent:
|
|
1965
|
+
return "agent";
|
|
1966
|
+
default:
|
|
1967
|
+
return "user";
|
|
1968
|
+
}
|
|
1969
|
+
})(), m = l ? () => e.send({ type: "RETRY" }) : void 0, c = r === "bot" ? n.botAvatarConfig ?? void 0 : r === "agent" ? n.agentAvatarConfig ?? void 0 : void 0;
|
|
1970
|
+
return {
|
|
1971
|
+
...n,
|
|
1972
|
+
variant: r,
|
|
1973
|
+
status: d,
|
|
1974
|
+
// timestamp: message.timestamp ? new Date(message.timestamp) : undefined,
|
|
1975
|
+
showTimestamp: !0,
|
|
1976
|
+
isClickable: l,
|
|
1977
|
+
onPress: m,
|
|
1978
|
+
avatarConfig: c
|
|
1979
|
+
// Pre-computed, just pass it through
|
|
1980
|
+
};
|
|
1981
|
+
}, [s, a, l, e, n]), o = se(
|
|
1982
|
+
() => (d) => {
|
|
1983
|
+
e.send({
|
|
1984
|
+
type: "BUTTON_CLICKED",
|
|
1985
|
+
button: d
|
|
1986
|
+
});
|
|
1987
|
+
},
|
|
1988
|
+
[e]
|
|
1989
|
+
);
|
|
1990
|
+
return {
|
|
1991
|
+
message: s,
|
|
1992
|
+
status: a,
|
|
1993
|
+
canRetry: l,
|
|
1994
|
+
messageProps: u,
|
|
1995
|
+
handleButtonClick: o
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
const Hs = ({
|
|
1999
|
+
messageActor: e,
|
|
2000
|
+
customMessageRenderer: n,
|
|
2001
|
+
baseProps: s = {
|
|
2002
|
+
customMessages: {}
|
|
2003
|
+
},
|
|
2004
|
+
onContentLoad: a,
|
|
2005
|
+
onImageLoadStart: l,
|
|
2006
|
+
onImageLoadComplete: u
|
|
2007
|
+
}) => {
|
|
2008
|
+
const { message: o, messageProps: d, handleButtonClick: r } = Ws({
|
|
2009
|
+
messageActor: e,
|
|
2010
|
+
baseProps: s
|
|
2011
|
+
});
|
|
2012
|
+
return P(() => {
|
|
2013
|
+
if (o && o.type === "image") {
|
|
2014
|
+
const c = `img-${o.id}-${o.data}`;
|
|
2015
|
+
l?.(c);
|
|
2016
|
+
}
|
|
2017
|
+
}, [o, l]), o ? /* @__PURE__ */ t(ve, { children: (() => {
|
|
2018
|
+
const { id: c } = o;
|
|
2019
|
+
if (o.isText())
|
|
2020
|
+
return /* @__PURE__ */ t(ws, { ...d, text: o.data.text }, c);
|
|
2021
|
+
if (o.isAudio())
|
|
2022
|
+
return /* @__PURE__ */ t(
|
|
2023
|
+
Pn,
|
|
2024
|
+
{
|
|
2025
|
+
...d,
|
|
2026
|
+
src: o.data.attachment_url ?? ""
|
|
2027
|
+
},
|
|
2028
|
+
c
|
|
2029
|
+
);
|
|
2030
|
+
if (o.isVideo())
|
|
2031
|
+
return /* @__PURE__ */ t(
|
|
2032
|
+
Vs,
|
|
2033
|
+
{
|
|
2034
|
+
...d,
|
|
2035
|
+
src: o.data.attachment_url ?? "",
|
|
2036
|
+
alt: "Video",
|
|
2037
|
+
onVideoLoad: () => {
|
|
2038
|
+
a?.();
|
|
2039
|
+
}
|
|
2040
|
+
},
|
|
2041
|
+
c
|
|
2042
|
+
);
|
|
2043
|
+
if (o.isDocument())
|
|
2044
|
+
return /* @__PURE__ */ t(
|
|
2045
|
+
is,
|
|
2046
|
+
{
|
|
2047
|
+
...d,
|
|
2048
|
+
src: o.data.attachment_url ?? "",
|
|
2049
|
+
alt: "Document",
|
|
2050
|
+
onDocumentLoad: () => {
|
|
2051
|
+
a?.();
|
|
2052
|
+
}
|
|
2053
|
+
},
|
|
2054
|
+
c
|
|
2055
|
+
);
|
|
2056
|
+
if (o.isLocation())
|
|
2057
|
+
return /* @__PURE__ */ t(
|
|
2058
|
+
vs,
|
|
2059
|
+
{
|
|
2060
|
+
...d,
|
|
2061
|
+
latitude: o.data.latitude,
|
|
2062
|
+
longitude: o.data.longitude,
|
|
2063
|
+
alt: "Location coordinates",
|
|
2064
|
+
onLocationLoad: () => {
|
|
2065
|
+
a?.();
|
|
2066
|
+
}
|
|
2067
|
+
},
|
|
2068
|
+
c
|
|
2069
|
+
);
|
|
2070
|
+
if (o.isImage()) {
|
|
2071
|
+
const i = `img-${c}-${o.data.attachment_url ?? ""}`;
|
|
2072
|
+
return /* @__PURE__ */ t(
|
|
2073
|
+
us,
|
|
2074
|
+
{
|
|
2075
|
+
...d,
|
|
2076
|
+
src: o.data.attachment_url ?? "",
|
|
2077
|
+
alt: "Image",
|
|
2078
|
+
onImageLoad: () => {
|
|
2079
|
+
a?.(), u?.(i);
|
|
2080
|
+
}
|
|
2081
|
+
},
|
|
2082
|
+
c
|
|
2083
|
+
);
|
|
2084
|
+
}
|
|
2085
|
+
return o.isButtonMessage() ? /* @__PURE__ */ t(
|
|
2086
|
+
An,
|
|
2087
|
+
{
|
|
2088
|
+
...d,
|
|
2089
|
+
text: o.data.text,
|
|
2090
|
+
buttons: o.data.buttons?.map(
|
|
2091
|
+
(i) => ({
|
|
2092
|
+
text: i.title,
|
|
2093
|
+
value: i.payload || i.title,
|
|
2094
|
+
disabled: !1,
|
|
2095
|
+
onClick: () => {
|
|
2096
|
+
r(i);
|
|
2097
|
+
}
|
|
2098
|
+
})
|
|
2099
|
+
)
|
|
2100
|
+
},
|
|
2101
|
+
c
|
|
2102
|
+
) : o.isCarousel() ? /* @__PURE__ */ t(
|
|
2103
|
+
Yn,
|
|
2104
|
+
{
|
|
2105
|
+
...d,
|
|
2106
|
+
elements: o.data.elements.map((i, b) => ({
|
|
2107
|
+
id: `${c}-${b}`,
|
|
2108
|
+
title: i.title,
|
|
2109
|
+
subtitle: i.subtitle,
|
|
2110
|
+
image: i.image,
|
|
2111
|
+
buttons: i.buttons
|
|
2112
|
+
})),
|
|
2113
|
+
onButtonClick: (i) => {
|
|
2114
|
+
r(i);
|
|
2115
|
+
},
|
|
2116
|
+
onElementImageLoad: () => {
|
|
2117
|
+
a?.();
|
|
2118
|
+
}
|
|
2119
|
+
},
|
|
2120
|
+
c
|
|
2121
|
+
) : o.isCustom() ? n ? n(o, o.data, r) : (console.warn(
|
|
2122
|
+
`Custom message renderer not provided for message type: ${o.type}`
|
|
2123
|
+
), null) : (console.warn(`Unknown message type: ${o.type}`), null);
|
|
2124
|
+
})() }) : null;
|
|
2125
|
+
}, js = "typing-indicator-module__typingIndicator___2hMSH", Fs = "typing-indicator-module__typingDots___Sy7xC", Us = "typing-indicator-module__typingDot___SdRIv", ne = {
|
|
2126
|
+
typingIndicator: js,
|
|
2127
|
+
typingDots: Fs,
|
|
2128
|
+
typingDot: Us
|
|
2129
|
+
}, Ys = ({
|
|
2130
|
+
isVisible: e = !1,
|
|
2131
|
+
className: n
|
|
2132
|
+
}) => e ? /* @__PURE__ */ t(
|
|
2133
|
+
"div",
|
|
2134
|
+
{
|
|
2135
|
+
"data-testid": "typing-indicator",
|
|
2136
|
+
className: `${ne.typingIndicator} ${n || ""}`,
|
|
2137
|
+
children: /* @__PURE__ */ g("div", { className: ne.typingDots, children: [
|
|
2138
|
+
/* @__PURE__ */ t("div", { className: ne.typingDot }),
|
|
2139
|
+
/* @__PURE__ */ t("div", { className: ne.typingDot }),
|
|
2140
|
+
/* @__PURE__ */ t("div", { className: ne.typingDot })
|
|
2141
|
+
] })
|
|
2142
|
+
}
|
|
2143
|
+
) : null, Ks = 24;
|
|
2144
|
+
function Xs(e) {
|
|
2145
|
+
const n = T(null), s = T(null), [a, l] = B(0), [u, o] = B(0), [d, r] = B(!1), m = T(), c = T(), i = h(() => {
|
|
2146
|
+
const _ = e.current, f = n.current;
|
|
2147
|
+
if (!_ || !f) return;
|
|
2148
|
+
const { scrollHeight: v, clientHeight: p, scrollTop: w } = _;
|
|
2149
|
+
if (v <= p) {
|
|
2150
|
+
r(!1);
|
|
2151
|
+
return;
|
|
2152
|
+
}
|
|
2153
|
+
const M = f.clientHeight, y = p / v, z = Math.max(y * M, Ks), N = v - p, D = N > 0 ? w / N * (M - z) : 0;
|
|
2154
|
+
l(z), o(D), r(!0), clearTimeout(m.current), m.current = setTimeout(() => r(!1), 1200);
|
|
2155
|
+
}, [e]);
|
|
2156
|
+
P(() => {
|
|
2157
|
+
const _ = e.current;
|
|
2158
|
+
if (!_) return;
|
|
2159
|
+
const f = () => i();
|
|
2160
|
+
_.addEventListener("scroll", f, { passive: !0 });
|
|
2161
|
+
const v = new ResizeObserver(() => i());
|
|
2162
|
+
v.observe(_);
|
|
2163
|
+
const p = new MutationObserver(() => i());
|
|
2164
|
+
return p.observe(_, { childList: !0, subtree: !0 }), i(), () => {
|
|
2165
|
+
_.removeEventListener("scroll", f), v.disconnect(), p.disconnect(), clearTimeout(m.current);
|
|
2166
|
+
};
|
|
2167
|
+
}, [e, i]);
|
|
2168
|
+
const b = h(
|
|
2169
|
+
(_) => {
|
|
2170
|
+
_.preventDefault(), _.stopPropagation();
|
|
2171
|
+
const f = e.current;
|
|
2172
|
+
if (!f) return;
|
|
2173
|
+
c.current = { startY: _.clientY, startScrollTop: f.scrollTop };
|
|
2174
|
+
const v = (w) => {
|
|
2175
|
+
const M = c.current, y = n.current;
|
|
2176
|
+
if (!M || !f || !y) return;
|
|
2177
|
+
const z = w.clientY - M.startY, N = y.clientHeight, F = (f.scrollHeight - f.clientHeight) / (N - a);
|
|
2178
|
+
f.scrollTop = M.startScrollTop + z * F;
|
|
2179
|
+
}, p = () => {
|
|
2180
|
+
c.current = void 0, document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", p);
|
|
2181
|
+
};
|
|
2182
|
+
document.addEventListener("mousemove", v), document.addEventListener("mouseup", p);
|
|
2183
|
+
},
|
|
2184
|
+
[e, a]
|
|
2185
|
+
), C = h(
|
|
2186
|
+
(_) => {
|
|
2187
|
+
_.preventDefault();
|
|
2188
|
+
const f = e.current, v = n.current;
|
|
2189
|
+
if (!f || !v) return;
|
|
2190
|
+
const p = v.getBoundingClientRect(), w = _.clientY - p.top, M = v.clientHeight, y = w / M;
|
|
2191
|
+
f.scrollTop = y * (f.scrollHeight - f.clientHeight);
|
|
2192
|
+
},
|
|
2193
|
+
[e]
|
|
2194
|
+
);
|
|
2195
|
+
return {
|
|
2196
|
+
thumbHeight: a,
|
|
2197
|
+
thumbTop: u,
|
|
2198
|
+
isVisible: d,
|
|
2199
|
+
trackRef: n,
|
|
2200
|
+
thumbRef: s,
|
|
2201
|
+
onTrackMouseDown: C,
|
|
2202
|
+
onThumbMouseDown: b
|
|
2203
|
+
};
|
|
2204
|
+
}
|
|
2205
|
+
function qs(e) {
|
|
2206
|
+
return se(() => {
|
|
2207
|
+
if (!e)
|
|
2208
|
+
return { bot: null, agent: null };
|
|
2209
|
+
const n = (s, a) => {
|
|
2210
|
+
if (!s) return null;
|
|
2211
|
+
const l = {
|
|
2212
|
+
variant: a,
|
|
2213
|
+
src: s.src,
|
|
2214
|
+
alt: s.alt,
|
|
2215
|
+
svg: s.svg,
|
|
2216
|
+
showName: s.showName,
|
|
2217
|
+
name: s.name
|
|
2218
|
+
};
|
|
2219
|
+
return {
|
|
2220
|
+
placement: s.placement,
|
|
2221
|
+
avatarProps: l
|
|
2222
|
+
};
|
|
2223
|
+
};
|
|
2224
|
+
return {
|
|
2225
|
+
bot: n(e.bot, "bot"),
|
|
2226
|
+
agent: n(e.agent, "agent")
|
|
2227
|
+
};
|
|
2228
|
+
}, [e]);
|
|
2229
|
+
}
|
|
2230
|
+
function Gs(e, n, s) {
|
|
2231
|
+
const {
|
|
2232
|
+
variant: a = "default",
|
|
2233
|
+
"aria-label": l,
|
|
2234
|
+
className: u,
|
|
2235
|
+
...o
|
|
2236
|
+
} = e, d = E(
|
|
2237
|
+
n.controller.machine,
|
|
2238
|
+
(c) => {
|
|
2239
|
+
const i = c.context.messageActors;
|
|
2240
|
+
return i ? Array.from(i.values()) : [];
|
|
2241
|
+
},
|
|
2242
|
+
(c, i) => c.length === i.length
|
|
2243
|
+
), r = qs(n.avatarConfig), m = E(
|
|
2244
|
+
n.controller.machine,
|
|
2245
|
+
(c) => c.context.isTypingOn,
|
|
2246
|
+
(c, i) => c === i
|
|
2247
|
+
);
|
|
2248
|
+
return {
|
|
2249
|
+
// Props to spread on wrapper element
|
|
2250
|
+
messagesProps: {
|
|
2251
|
+
...o,
|
|
2252
|
+
ref: s,
|
|
2253
|
+
"aria-label": l || `Chat messages, ${d.length} messages`,
|
|
2254
|
+
"aria-live": "polite",
|
|
2255
|
+
"data-webchat-messages": ""
|
|
2256
|
+
},
|
|
2257
|
+
// Props for MessagesList component (using XState message actors)
|
|
2258
|
+
messageListProps: {
|
|
2259
|
+
messageActors: d,
|
|
2260
|
+
// From XState selector
|
|
2261
|
+
isTyping: m,
|
|
2262
|
+
// From XState selector
|
|
2263
|
+
customMessageRenderer: void 0,
|
|
2264
|
+
// TODO: Add custom message renderer support
|
|
2265
|
+
// Pre-computed avatar configs (performance optimization)
|
|
2266
|
+
botAvatarConfig: r.bot,
|
|
2267
|
+
agentAvatarConfig: r.agent
|
|
2268
|
+
},
|
|
2269
|
+
// CSS class variants
|
|
2270
|
+
variants: {
|
|
2271
|
+
variant: a,
|
|
2272
|
+
className: u
|
|
2273
|
+
}
|
|
2274
|
+
};
|
|
2275
|
+
}
|
|
2276
|
+
const Qs = "webchat-messages-module__base___V7acY", j = {
|
|
2277
|
+
base: Qs,
|
|
2278
|
+
"scroll-fade-bottom": "webchat-messages-module__scroll-fade-bottom___WoP9u",
|
|
2279
|
+
"messages-container": "webchat-messages-module__messages-container___Ew2gS",
|
|
2280
|
+
"typing-indicator-container": "webchat-messages-module__typing-indicator-container___v3bpq",
|
|
2281
|
+
"scrollbar-track": "webchat-messages-module__scrollbar-track___WLz0l",
|
|
2282
|
+
"scrollbar-track-visible": "webchat-messages-module__scrollbar-track-visible___LyCn8",
|
|
2283
|
+
"scrollbar-thumb": "webchat-messages-module__scrollbar-thumb___AVatG",
|
|
2284
|
+
default: "webchat-messages-module__default___3C2qm"
|
|
2285
|
+
}, Zs = A(j.base, {
|
|
2286
|
+
variants: {
|
|
2287
|
+
variant: {
|
|
2288
|
+
default: j.default
|
|
2289
|
+
}
|
|
2290
|
+
},
|
|
2291
|
+
defaultVariants: {
|
|
2292
|
+
variant: "default"
|
|
2293
|
+
}
|
|
2294
|
+
});
|
|
2295
|
+
function Js({
|
|
2296
|
+
messageActors: e,
|
|
2297
|
+
isTyping: n,
|
|
2298
|
+
customMessages: s,
|
|
2299
|
+
botAvatarConfig: a,
|
|
2300
|
+
agentAvatarConfig: l,
|
|
2301
|
+
scrollRef: u
|
|
2302
|
+
}) {
|
|
2303
|
+
const o = u;
|
|
2304
|
+
P(() => {
|
|
2305
|
+
if (o.current) {
|
|
2306
|
+
const r = o.current;
|
|
2307
|
+
requestAnimationFrame(() => {
|
|
2308
|
+
r.scrollTo({
|
|
2309
|
+
top: r.scrollHeight,
|
|
2310
|
+
behavior: "smooth"
|
|
2311
|
+
});
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
}, [e.length, n]);
|
|
2315
|
+
const d = Ce.useCallback(
|
|
2316
|
+
(r, m, c) => {
|
|
2317
|
+
const i = r;
|
|
2318
|
+
if (i.type === "custom" && i.data && s) {
|
|
2319
|
+
const b = s[i.data.name];
|
|
2320
|
+
if (b && typeof b == "function")
|
|
2321
|
+
return b({
|
|
2322
|
+
...i.data.props,
|
|
2323
|
+
onButtonClick: c
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
return null;
|
|
2327
|
+
},
|
|
2328
|
+
[s]
|
|
2329
|
+
);
|
|
2330
|
+
return /* @__PURE__ */ g(
|
|
2331
|
+
"div",
|
|
2332
|
+
{
|
|
2333
|
+
ref: o,
|
|
2334
|
+
className: j["messages-container"],
|
|
2335
|
+
"data-testid": "webchat-messages-list",
|
|
2336
|
+
children: [
|
|
2337
|
+
e && e.length > 0 && e.map((r) => /* @__PURE__ */ t(
|
|
2338
|
+
Hs,
|
|
2339
|
+
{
|
|
2340
|
+
messageActor: r,
|
|
2341
|
+
customMessageRenderer: d,
|
|
2342
|
+
baseProps: {
|
|
2343
|
+
className: j.message,
|
|
2344
|
+
// Pre-computed avatar configs (performance optimization)
|
|
2345
|
+
botAvatarConfig: a,
|
|
2346
|
+
agentAvatarConfig: l
|
|
2347
|
+
}
|
|
2348
|
+
},
|
|
2349
|
+
r.id
|
|
2350
|
+
)),
|
|
2351
|
+
n && /* @__PURE__ */ t("div", { className: j["typing-indicator-container"], children: /* @__PURE__ */ t(Ys, { isVisible: n }) })
|
|
2352
|
+
]
|
|
2353
|
+
}
|
|
2354
|
+
);
|
|
2355
|
+
}
|
|
2356
|
+
function ea(e) {
|
|
2357
|
+
const { state: n } = ee(), s = T(null), a = T(null), { messagesProps: l, messageListProps: u, variants: o } = Gs(
|
|
2358
|
+
e,
|
|
2359
|
+
n,
|
|
2360
|
+
s
|
|
2361
|
+
), d = Xs(a);
|
|
2362
|
+
return /* @__PURE__ */ g(
|
|
2363
|
+
"div",
|
|
2364
|
+
{
|
|
2365
|
+
...l,
|
|
2366
|
+
className: Zs(o),
|
|
2367
|
+
"data-webchat-messages": !0,
|
|
2368
|
+
children: [
|
|
2369
|
+
/* @__PURE__ */ t(
|
|
2370
|
+
Js,
|
|
2371
|
+
{
|
|
2372
|
+
...u,
|
|
2373
|
+
customMessages: n.customMessages,
|
|
2374
|
+
scrollRef: a
|
|
2375
|
+
}
|
|
2376
|
+
),
|
|
2377
|
+
/* @__PURE__ */ t(
|
|
2378
|
+
"div",
|
|
2379
|
+
{
|
|
2380
|
+
className: j["scroll-fade-bottom"],
|
|
2381
|
+
"aria-hidden": !0,
|
|
2382
|
+
"data-testid": "webchat-messages-bottom-fade"
|
|
2383
|
+
}
|
|
2384
|
+
),
|
|
2385
|
+
/* @__PURE__ */ t(
|
|
2386
|
+
"div",
|
|
2387
|
+
{
|
|
2388
|
+
ref: d.trackRef,
|
|
2389
|
+
className: k(
|
|
2390
|
+
j["scrollbar-track"],
|
|
2391
|
+
d.isVisible && j["scrollbar-track-visible"]
|
|
2392
|
+
),
|
|
2393
|
+
onMouseDown: d.onTrackMouseDown,
|
|
2394
|
+
"aria-hidden": !0,
|
|
2395
|
+
"data-testid": "webchat-custom-scrollbar",
|
|
2396
|
+
children: /* @__PURE__ */ t(
|
|
2397
|
+
"div",
|
|
2398
|
+
{
|
|
2399
|
+
ref: d.thumbRef,
|
|
2400
|
+
className: j["scrollbar-thumb"],
|
|
2401
|
+
style: {
|
|
2402
|
+
height: d.thumbHeight,
|
|
2403
|
+
top: d.thumbTop
|
|
2404
|
+
},
|
|
2405
|
+
onMouseDown: d.onThumbMouseDown
|
|
2406
|
+
}
|
|
2407
|
+
)
|
|
2408
|
+
}
|
|
2409
|
+
)
|
|
2410
|
+
]
|
|
2411
|
+
}
|
|
2412
|
+
);
|
|
2413
|
+
}
|
|
2414
|
+
function ta({
|
|
2415
|
+
isOpen: e,
|
|
2416
|
+
onClose: n,
|
|
2417
|
+
onControllerReady: s,
|
|
2418
|
+
title: a = "Chat",
|
|
2419
|
+
placeholder: l = "Type a message...",
|
|
2420
|
+
showBranding: u = !0,
|
|
2421
|
+
coverRegistry: o,
|
|
2422
|
+
icons: d
|
|
2423
|
+
}) {
|
|
2424
|
+
const { controller: r } = ee(), m = T(!1);
|
|
2425
|
+
return P(() => {
|
|
2426
|
+
r && !m.current && (m.current = !0, s?.(r));
|
|
2427
|
+
}, [r, s]), P(() => {
|
|
2428
|
+
if (!r) return;
|
|
2429
|
+
const b = r.machine.getSnapshot().context.isOpen ?? !1;
|
|
2430
|
+
e && !b ? r.open() : !e && b && r.close();
|
|
2431
|
+
}, [e, r]), /* @__PURE__ */ g(Ct, { layout: "default", coverRegistry: o, children: [
|
|
2432
|
+
/* @__PURE__ */ t(xt, { title: a, onClose: () => {
|
|
2433
|
+
r?.close(), n?.();
|
|
2434
|
+
} }),
|
|
2435
|
+
/* @__PURE__ */ t(ea, { variant: "default" }),
|
|
2436
|
+
/* @__PURE__ */ t(
|
|
2437
|
+
Et,
|
|
2438
|
+
{
|
|
2439
|
+
placeholder: l,
|
|
2440
|
+
showBranding: u,
|
|
2441
|
+
variant: "default",
|
|
2442
|
+
icons: d
|
|
2443
|
+
}
|
|
2444
|
+
)
|
|
2445
|
+
] });
|
|
2446
|
+
}
|
|
2447
|
+
function na({
|
|
2448
|
+
appId: e,
|
|
2449
|
+
isOpen: n,
|
|
2450
|
+
onClose: s,
|
|
2451
|
+
onControllerReady: a,
|
|
2452
|
+
title: l,
|
|
2453
|
+
placeholder: u,
|
|
2454
|
+
showBranding: o = !0,
|
|
2455
|
+
customMessages: d = {},
|
|
2456
|
+
avatarConfig: r,
|
|
2457
|
+
coverRegistry: m,
|
|
2458
|
+
icons: c,
|
|
2459
|
+
// Note: showTrigger is accepted but not implemented yet (reserved for future use)
|
|
2460
|
+
...i
|
|
2461
|
+
}) {
|
|
2462
|
+
return /* @__PURE__ */ t(
|
|
2463
|
+
Ee,
|
|
2464
|
+
{
|
|
2465
|
+
appId: e,
|
|
2466
|
+
customMessages: d,
|
|
2467
|
+
avatarConfig: r,
|
|
2468
|
+
...i,
|
|
2469
|
+
children: /* @__PURE__ */ t(
|
|
2470
|
+
ta,
|
|
2471
|
+
{
|
|
2472
|
+
isOpen: n,
|
|
2473
|
+
onClose: s,
|
|
2474
|
+
onControllerReady: a,
|
|
2475
|
+
title: l,
|
|
2476
|
+
placeholder: u,
|
|
2477
|
+
showBranding: o,
|
|
2478
|
+
coverRegistry: m,
|
|
2479
|
+
icons: c
|
|
2480
|
+
}
|
|
2481
|
+
)
|
|
2482
|
+
}
|
|
2483
|
+
);
|
|
2484
|
+
}
|
|
2485
|
+
const ca = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2486
|
+
__proto__: null,
|
|
2487
|
+
WebchatApp: na
|
|
2488
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2489
|
+
export {
|
|
2490
|
+
ie as B,
|
|
2491
|
+
q as M,
|
|
2492
|
+
bt as O,
|
|
2493
|
+
Ys as T,
|
|
2494
|
+
na as W,
|
|
2495
|
+
tn as a,
|
|
2496
|
+
Hs as b,
|
|
2497
|
+
Fe as c,
|
|
2498
|
+
tt as d,
|
|
2499
|
+
Me as e,
|
|
2500
|
+
Xe as f,
|
|
2501
|
+
ut as g,
|
|
2502
|
+
et as h,
|
|
2503
|
+
Ct as i,
|
|
2504
|
+
xt as j,
|
|
2505
|
+
Et as k,
|
|
2506
|
+
ea as l,
|
|
2507
|
+
Ee as m,
|
|
2508
|
+
le as n,
|
|
2509
|
+
lt as o,
|
|
2510
|
+
ft as p,
|
|
2511
|
+
ee as q,
|
|
2512
|
+
yt as r,
|
|
2513
|
+
St as s,
|
|
2514
|
+
Gs as t,
|
|
2515
|
+
_t as u,
|
|
2516
|
+
Le as v,
|
|
2517
|
+
ca as w
|
|
2518
|
+
};
|