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