@opencx/widget-react 4.0.24 → 4.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +272 -257
- package/dist/index.js.map +1 -1
- package/dist/src/hooks/useTranslation.d.ts +1 -1
- package/dist/src/screens/chat/ChatMain.d.ts.map +1 -1
- package/dist/src/utils/group-messages-by-type.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as r, jsxs as d, Fragment as te } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as le from "@radix-ui/react-popover";
|
|
3
3
|
import * as G from "react";
|
|
4
|
-
import q, { memo as Bt, forwardRef as ct, useState as
|
|
5
|
-
import { useWidget as R, useConfig as
|
|
4
|
+
import q, { memo as Bt, forwardRef as ct, useState as T, cloneElement as dt, createContext as Lt, useEffect as re, useContext as Yt, useMemo as pt, useRef as ce, createElement as rt } from "react";
|
|
5
|
+
import { useWidget as R, useConfig as x, useDocumentDir as fe, useWidgetRouter as $, useWidgetTrigger as K, useSessions as B, useMessages as j, useModes as ht, useCsat as mt, useUploadFiles as qt, useIsAwaitingBotReply as gt, useContact as Xt, WidgetProvider as Ut, WidgetTriggerProvider as Vt } from "@opencx/widget-react-headless";
|
|
6
6
|
import { clsx as Gt } from "clsx";
|
|
7
7
|
import { twMerge as Kt } from "tailwind-merge";
|
|
8
|
-
import { motion as Z, AnimatePresence as
|
|
8
|
+
import { motion as Z, AnimatePresence as _ } from "framer-motion";
|
|
9
9
|
import { Slot as Qt } from "@radix-ui/react-slot";
|
|
10
10
|
import { cva as Zt } from "class-variance-authority";
|
|
11
|
-
import { X as Jt, CircleDashedIcon as er, XIcon as
|
|
11
|
+
import { X as Jt, CircleDashedIcon as er, XIcon as ve, SquareXIcon as tr, SquareCheckBigIcon as rr, SquareCheckIcon as or, ShrinkIcon as nr, Minimize2Icon as sr, MinimizeIcon as ir, Maximize2Icon as ar, MaximizeIcon as lr, ExpandIcon as cr, CircleXIcon as dr, CircleCheckBigIcon as pr, CircleCheckIcon as wt, CheckCheckIcon as hr, CheckIcon as mr, ChevronLeftIcon as gr, LoaderIcon as wr, ArrowUpIcon as ut, PaperclipIcon as ur, ImageIcon as fr, CircleDashed as vr, AlertCircle as xr, Loader2 as br, FileAudio2Icon as yr, FileVideo2Icon as kr, FileIcon as Cr, UserRoundIcon as zr, ChevronRightIcon as Nr, SendHorizontal as Sr, ChevronDownIcon as _r } from "lucide-react";
|
|
12
12
|
import ft from "remark-gfm";
|
|
13
13
|
import Ir from "react-markdown";
|
|
14
14
|
import vt from "rehype-raw";
|
|
@@ -19,7 +19,7 @@ import * as oe from "@radix-ui/react-tooltip";
|
|
|
19
19
|
import ot from "tinycolor2";
|
|
20
20
|
import { useDropzone as Dr } from "react-dropzone";
|
|
21
21
|
import Rr from "react-use/lib/useAsyncFn";
|
|
22
|
-
import { z as
|
|
22
|
+
import { z as he } from "zod";
|
|
23
23
|
function g(e) {
|
|
24
24
|
return { "data-component": e };
|
|
25
25
|
}
|
|
@@ -32,38 +32,38 @@ const V = {
|
|
|
32
32
|
}, W = Bt(
|
|
33
33
|
ct(
|
|
34
34
|
({ children: e, className: o, scale: t = 1.02, off: n = !1 }, s) => {
|
|
35
|
-
const [i, a] =
|
|
35
|
+
const [i, a] = T(!1), [c, l] = T({ x: 0, y: 0 });
|
|
36
36
|
if (n || /translate/.test(
|
|
37
37
|
e.props.className || ""
|
|
38
38
|
)) return e;
|
|
39
|
-
const
|
|
40
|
-
var
|
|
41
|
-
const { clientX:
|
|
39
|
+
const y = (u) => {
|
|
40
|
+
var z, N;
|
|
41
|
+
const { clientX: b, clientY: I } = u, S = u.currentTarget.getBoundingClientRect(), M = b - (S.left + S.width / 2), A = I - (S.top + S.height / 2), F = Math.max(
|
|
42
42
|
-1,
|
|
43
|
-
Math.min(1, M / (
|
|
43
|
+
Math.min(1, M / (S.width / 2))
|
|
44
44
|
), H = Math.max(
|
|
45
45
|
-1,
|
|
46
|
-
Math.min(1, A / (
|
|
46
|
+
Math.min(1, A / (S.height / 2))
|
|
47
47
|
), E = F * V.x, v = H * V.y;
|
|
48
|
-
l({ x: E, y: v }), (
|
|
49
|
-
},
|
|
50
|
-
var
|
|
51
|
-
a(!0), (
|
|
48
|
+
l({ x: E, y: v }), (N = (z = e.props).onMouseMove) == null || N.call(z, u);
|
|
49
|
+
}, w = () => {
|
|
50
|
+
var u, b;
|
|
51
|
+
a(!0), (b = (u = e.props).onMouseEnter) == null || b.call(u);
|
|
52
52
|
}, m = () => {
|
|
53
|
-
var
|
|
54
|
-
a(!1), l({ x: 0, y: 0 }), (
|
|
55
|
-
},
|
|
53
|
+
var u, b;
|
|
54
|
+
a(!1), l({ x: 0, y: 0 }), (b = (u = e.props).onMouseLeave) == null || b.call(u);
|
|
55
|
+
}, C = {
|
|
56
56
|
"--wobble-x": i ? `${c.x}px` : "0px",
|
|
57
57
|
"--wobble-y": i ? `${c.y}px` : "0px",
|
|
58
58
|
"--scale": 1 - (t - 1)
|
|
59
59
|
};
|
|
60
60
|
return dt(e, {
|
|
61
61
|
ref: s,
|
|
62
|
-
onMouseMove:
|
|
63
|
-
onMouseEnter:
|
|
62
|
+
onMouseMove: y,
|
|
63
|
+
onMouseEnter: w,
|
|
64
64
|
onMouseLeave: m,
|
|
65
65
|
style: {
|
|
66
|
-
...
|
|
66
|
+
...C,
|
|
67
67
|
...e.props.style
|
|
68
68
|
},
|
|
69
69
|
className: p(
|
|
@@ -100,7 +100,7 @@ const jr = 10, Er = (e, o, t) => ({
|
|
|
100
100
|
left: Or,
|
|
101
101
|
up: Pr,
|
|
102
102
|
down: Ar
|
|
103
|
-
},
|
|
103
|
+
}, f = ct(
|
|
104
104
|
({
|
|
105
105
|
fadeIn: e = "down",
|
|
106
106
|
distance: o = jr,
|
|
@@ -114,7 +114,7 @@ const jr = 10, Er = (e, o, t) => ({
|
|
|
114
114
|
return n && l.exit && typeof l.exit == "object" && !Array.isArray(l.exit) && (l.exit.transition = { duration: 0 }), /* @__PURE__ */ r(Z.div, { ref: c, ...a, ...l, children: t });
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
|
-
|
|
117
|
+
f.displayName = "MotionDiv";
|
|
118
118
|
const Hr = Zt(
|
|
119
119
|
p(
|
|
120
120
|
"inline-flex shrink-0 items-center justify-center gap-2",
|
|
@@ -154,7 +154,7 @@ const Hr = Zt(
|
|
|
154
154
|
size: "default"
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
),
|
|
157
|
+
), k = G.forwardRef(
|
|
158
158
|
({ className: e, variant: o = "default", size: t, asChild: n = !1, ...s }, i) => /* @__PURE__ */ r(W, { ref: i, children: /* @__PURE__ */ r(
|
|
159
159
|
n ? Qt : "button",
|
|
160
160
|
{
|
|
@@ -165,10 +165,10 @@ const Hr = Zt(
|
|
|
165
165
|
}
|
|
166
166
|
) })
|
|
167
167
|
);
|
|
168
|
-
|
|
168
|
+
k.displayName = "Button";
|
|
169
169
|
const bt = Lt(null);
|
|
170
170
|
function Wr({ children: e }) {
|
|
171
|
-
const [o, t] =
|
|
171
|
+
const [o, t] = T(!1), [n, s] = T(null), i = (c) => {
|
|
172
172
|
s(c), t(!0);
|
|
173
173
|
}, a = () => {
|
|
174
174
|
t(!1), setTimeout(() => {
|
|
@@ -186,7 +186,7 @@ function Wr({ children: e }) {
|
|
|
186
186
|
}
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function de() {
|
|
190
190
|
const e = Yt(bt);
|
|
191
191
|
return e || (console.error("useDialoger must be used within a DialogerProvider"), {
|
|
192
192
|
open: () => {
|
|
@@ -198,7 +198,7 @@ function ce() {
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
function $r() {
|
|
201
|
-
const { contentIframeRef: e } = R(), { isOpen: o, content: t, close: n } =
|
|
201
|
+
const { contentIframeRef: e } = R(), { isOpen: o, content: t, close: n } = de();
|
|
202
202
|
return re(() => {
|
|
203
203
|
var i, a;
|
|
204
204
|
const s = (c) => {
|
|
@@ -214,8 +214,8 @@ function $r() {
|
|
|
214
214
|
s
|
|
215
215
|
);
|
|
216
216
|
};
|
|
217
|
-
}, []), /* @__PURE__ */ r(
|
|
218
|
-
|
|
217
|
+
}, []), /* @__PURE__ */ r(_, { mode: "wait", children: o && t && /* @__PURE__ */ r(
|
|
218
|
+
f,
|
|
219
219
|
{
|
|
220
220
|
overrides: {
|
|
221
221
|
initial: { y: 0 },
|
|
@@ -234,7 +234,7 @@ function yt({
|
|
|
234
234
|
className: o,
|
|
235
235
|
withClose: t = !1
|
|
236
236
|
}) {
|
|
237
|
-
const { close: n } =
|
|
237
|
+
const { close: n } = de();
|
|
238
238
|
return /* @__PURE__ */ d(
|
|
239
239
|
"div",
|
|
240
240
|
{
|
|
@@ -246,7 +246,7 @@ function yt({
|
|
|
246
246
|
children: [
|
|
247
247
|
e,
|
|
248
248
|
t && /* @__PURE__ */ d(
|
|
249
|
-
|
|
249
|
+
k,
|
|
250
250
|
{
|
|
251
251
|
size: "fit",
|
|
252
252
|
className: "rounded-full absolute top-4 right-4",
|
|
@@ -314,7 +314,7 @@ function _t({
|
|
|
314
314
|
children: e,
|
|
315
315
|
trigger: o
|
|
316
316
|
}) {
|
|
317
|
-
const { open: t } =
|
|
317
|
+
const { open: t } = de();
|
|
318
318
|
return dt(o, {
|
|
319
319
|
onClick: () => t(e)
|
|
320
320
|
});
|
|
@@ -365,12 +365,12 @@ const Tt = q.memo(
|
|
|
365
365
|
Ir,
|
|
366
366
|
(e, o) => e.children === o.children && e.className === o.className
|
|
367
367
|
);
|
|
368
|
-
function
|
|
368
|
+
function xe({
|
|
369
369
|
children: e,
|
|
370
370
|
messageType: o,
|
|
371
371
|
messageId: t
|
|
372
372
|
}) {
|
|
373
|
-
const { anchorTarget: n } =
|
|
373
|
+
const { anchorTarget: n } = x();
|
|
374
374
|
return /* @__PURE__ */ r(
|
|
375
375
|
Tt,
|
|
376
376
|
{
|
|
@@ -385,7 +385,7 @@ function ve({
|
|
|
385
385
|
}
|
|
386
386
|
);
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function me({
|
|
389
389
|
data: e,
|
|
390
390
|
id: o,
|
|
391
391
|
type: t,
|
|
@@ -397,8 +397,8 @@ function he({
|
|
|
397
397
|
classNames: l
|
|
398
398
|
}) {
|
|
399
399
|
if (t !== "AI" && t !== "AGENT") return null;
|
|
400
|
-
const { message: h, variant:
|
|
401
|
-
return
|
|
400
|
+
const { message: h, variant: y = "default" } = e;
|
|
401
|
+
return y === "error" ? /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r("div", { className: "flex flex-row flex-wrap items-center justify-start", children: /* @__PURE__ */ r("div", { className: "leading-snug text-sm text-destructive", children: h }) }) }) : /* @__PURE__ */ d(
|
|
402
402
|
"div",
|
|
403
403
|
{
|
|
404
404
|
...g((c == null ? void 0 : c.messageContainer) ?? "chat/agent_msg/root"),
|
|
@@ -407,7 +407,7 @@ function he({
|
|
|
407
407
|
l == null ? void 0 : l.messageContainer
|
|
408
408
|
),
|
|
409
409
|
children: [
|
|
410
|
-
n && n.length > 0 && /* @__PURE__ */ r("div", { className: "w-full gap-1 flex flex-row flex-wrap items-center justify-start", children: n == null ? void 0 : n.map((
|
|
410
|
+
n && n.length > 0 && /* @__PURE__ */ r("div", { className: "w-full gap-1 flex flex-row flex-wrap items-center justify-start", children: n == null ? void 0 : n.map((w) => /* @__PURE__ */ r(It, { attachment: w }, w.id)) }),
|
|
411
411
|
h.length > 0 && /* @__PURE__ */ r(
|
|
412
412
|
"div",
|
|
413
413
|
{
|
|
@@ -429,7 +429,7 @@ function he({
|
|
|
429
429
|
!s && !i && !a && "rounded-l-md",
|
|
430
430
|
l == null ? void 0 : l.message
|
|
431
431
|
),
|
|
432
|
-
children: /* @__PURE__ */ r(
|
|
432
|
+
children: /* @__PURE__ */ r(xe, { messageType: t, messageId: o, children: h })
|
|
433
433
|
}
|
|
434
434
|
)
|
|
435
435
|
]
|
|
@@ -439,7 +439,7 @@ function he({
|
|
|
439
439
|
function Br(e) {
|
|
440
440
|
return /* @__PURE__ */ r("div", { className: "w-full max-w-full overflow-auto shrink-0", children: /* @__PURE__ */ r("pre", { className: "text-xs leading-tight whitespace-pre-wrap break-word", children: JSON.stringify(e, null, 1) }) });
|
|
441
441
|
}
|
|
442
|
-
const
|
|
442
|
+
const be = G.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
443
443
|
Q.Root,
|
|
444
444
|
{
|
|
445
445
|
ref: t,
|
|
@@ -451,8 +451,8 @@ const xe = G.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
|
451
451
|
...o
|
|
452
452
|
}
|
|
453
453
|
));
|
|
454
|
-
|
|
455
|
-
const
|
|
454
|
+
be.displayName = Q.Root.displayName;
|
|
455
|
+
const ye = G.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
456
456
|
Q.Image,
|
|
457
457
|
{
|
|
458
458
|
ref: t,
|
|
@@ -460,8 +460,8 @@ const be = G.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
|
460
460
|
...o
|
|
461
461
|
}
|
|
462
462
|
));
|
|
463
|
-
|
|
464
|
-
const
|
|
463
|
+
ye.displayName = Q.Image.displayName;
|
|
464
|
+
const ke = G.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
465
465
|
Q.Fallback,
|
|
466
466
|
{
|
|
467
467
|
ref: t,
|
|
@@ -472,25 +472,25 @@ const ye = G.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
|
472
472
|
...o
|
|
473
473
|
}
|
|
474
474
|
));
|
|
475
|
-
|
|
476
|
-
function
|
|
475
|
+
ke.displayName = Q.Fallback.displayName;
|
|
476
|
+
function ge({
|
|
477
477
|
agent: e,
|
|
478
478
|
...o
|
|
479
479
|
}) {
|
|
480
480
|
var t, n;
|
|
481
|
-
return /* @__PURE__ */ d(
|
|
482
|
-
/* @__PURE__ */ r(
|
|
483
|
-
(e == null ? void 0 : e.name) && /* @__PURE__ */ r(
|
|
481
|
+
return /* @__PURE__ */ d(be, { ...o, children: [
|
|
482
|
+
/* @__PURE__ */ r(ye, { src: (e == null ? void 0 : e.avatar) ?? "", alt: "Agent Icon" }),
|
|
483
|
+
(e == null ? void 0 : e.name) && /* @__PURE__ */ r(ke, { children: (n = (t = e == null ? void 0 : e.name) == null ? void 0 : t.slice(0, 1)) == null ? void 0 : n.toUpperCase() })
|
|
484
484
|
] });
|
|
485
485
|
}
|
|
486
486
|
function Lr({ agent: e }) {
|
|
487
|
-
return /* @__PURE__ */ r(
|
|
488
|
-
|
|
487
|
+
return /* @__PURE__ */ r(_, { children: /* @__PURE__ */ d(
|
|
488
|
+
f,
|
|
489
489
|
{
|
|
490
490
|
...g("chat/bot_loading/root"),
|
|
491
491
|
className: "flex flex-row items-end w-full gap-2 animate-pulse",
|
|
492
492
|
children: [
|
|
493
|
-
/* @__PURE__ */ r(
|
|
493
|
+
/* @__PURE__ */ r(ge, { agent: e }),
|
|
494
494
|
/* @__PURE__ */ d(
|
|
495
495
|
"div",
|
|
496
496
|
{
|
|
@@ -529,7 +529,7 @@ function J({
|
|
|
529
529
|
side: t,
|
|
530
530
|
align: n
|
|
531
531
|
}) {
|
|
532
|
-
const { disableTooltips: s } =
|
|
532
|
+
const { disableTooltips: s } = x();
|
|
533
533
|
return !o || s ? e : /* @__PURE__ */ d(qr, { children: [
|
|
534
534
|
/* @__PURE__ */ r(Xr, { asChild: !0, children: e }),
|
|
535
535
|
/* @__PURE__ */ r(
|
|
@@ -561,13 +561,13 @@ const se = {
|
|
|
561
561
|
transitionDuration: "1000ms"
|
|
562
562
|
};
|
|
563
563
|
function X() {
|
|
564
|
-
var
|
|
565
|
-
const { dir: e } =
|
|
566
|
-
zIndex: ((
|
|
564
|
+
var w, m, C, u, b, I, S, M, A, F, H, E, v, z, N, L, ne, Se, _e, Ie, Te, Me, De, Re, je, Ee, Oe, Pe, Ae, Fe, He, We, $e, Be, Le, Ye, qe, Xe, Ue, Ve, Ge, Ke, Qe, Ze, Je, et, tt;
|
|
565
|
+
const { dir: e } = fe(), { isSmallScreen: o } = P(), { theme: t, inline: n } = x(), s = (Y) => n ? "100%" : Y, i = (Y, pe) => o ? `100dv${Y}` : pe, a = (Y, pe) => s(i(Y, pe)), c = {
|
|
566
|
+
zIndex: ((w = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : w.zIndex) ?? 1e7,
|
|
567
567
|
offset: {
|
|
568
|
-
bottom: ((
|
|
569
|
-
right: ((
|
|
570
|
-
left: ((
|
|
568
|
+
bottom: ((C = (m = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : m.offset) == null ? void 0 : C.bottom) ?? 20,
|
|
569
|
+
right: ((b = (u = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : u.offset) == null ? void 0 : b.right) ?? (e === "ltr" ? 20 : "initial"),
|
|
570
|
+
left: ((S = (I = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : I.offset) == null ? void 0 : S.left) ?? (e === "rtl" ? 20 : "initial")
|
|
571
571
|
},
|
|
572
572
|
size: {
|
|
573
573
|
button: ((A = (M = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : M.size) == null ? void 0 : A.button) ?? 48,
|
|
@@ -583,9 +583,9 @@ function X() {
|
|
|
583
583
|
widgetContentContainer: {
|
|
584
584
|
borderRadius: o ? "0px" : ((E = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : E.borderRadius) ?? "32px",
|
|
585
585
|
zIndex: ((v = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : v.zIndex) ?? c.zIndex + 1,
|
|
586
|
-
outline: ((
|
|
586
|
+
outline: ((z = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : z.outline) ?? "none",
|
|
587
587
|
// was: '1px solid'
|
|
588
|
-
outlineColor: ((
|
|
588
|
+
outlineColor: ((N = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : N.outlineColor) ?? "hsl(0 0% 50% / .5)",
|
|
589
589
|
boxShadow: ((L = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : L.boxShadow) ?? "0 0px 100px 0px rgb(0 0 0 / 0.25)",
|
|
590
590
|
transitionProperty: ((ne = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : ne.transitionProperty) ?? "all",
|
|
591
591
|
transitionTimingFunction: ((Se = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : Se.transitionTimingFunction) ?? se.transitionTimingFunction,
|
|
@@ -625,7 +625,7 @@ function X() {
|
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
},
|
|
628
|
+
}, y = {
|
|
629
629
|
// Subtract the offset.bottom twice so that it adds a bit of padding to the top
|
|
630
630
|
// Subtract the distance between the trigger and the widget content container
|
|
631
631
|
// Subtract the invisible padding of the trigger (for the wobble effect)
|
|
@@ -665,7 +665,7 @@ function X() {
|
|
|
665
665
|
};
|
|
666
666
|
return {
|
|
667
667
|
theme: h,
|
|
668
|
-
computed:
|
|
668
|
+
computed: y,
|
|
669
669
|
cssVars: Ur({
|
|
670
670
|
palette: h.palette,
|
|
671
671
|
primary: h.primaryColor
|
|
@@ -759,7 +759,7 @@ function Rt(e) {
|
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
761
|
function jt() {
|
|
762
|
-
const { contentIframeRef: e } = R(), { inline: o } =
|
|
762
|
+
const { contentIframeRef: e } = R(), { inline: o } = x();
|
|
763
763
|
return {
|
|
764
764
|
setWidth: (t) => {
|
|
765
765
|
var n;
|
|
@@ -777,7 +777,7 @@ function jt() {
|
|
|
777
777
|
}
|
|
778
778
|
};
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function Ce({
|
|
781
781
|
width: e,
|
|
782
782
|
height: o
|
|
783
783
|
}) {
|
|
@@ -822,7 +822,7 @@ function ee({
|
|
|
822
822
|
case "SquareX":
|
|
823
823
|
return tr;
|
|
824
824
|
case "X":
|
|
825
|
-
return
|
|
825
|
+
return ve;
|
|
826
826
|
case void 0:
|
|
827
827
|
return st;
|
|
828
828
|
default:
|
|
@@ -831,10 +831,10 @@ function ee({
|
|
|
831
831
|
})();
|
|
832
832
|
return /* @__PURE__ */ r(t, { className: p("size-4", o) });
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function ze() {
|
|
835
835
|
const { widgetCtx: { org: e } } = R(), {
|
|
836
836
|
routerState: { screen: o }
|
|
837
|
-
} = $(), { textContent: t } =
|
|
837
|
+
} = $(), { textContent: t } = x();
|
|
838
838
|
return (() => {
|
|
839
839
|
var s, i;
|
|
840
840
|
switch (o) {
|
|
@@ -845,7 +845,7 @@ function Ce() {
|
|
|
845
845
|
case "welcome":
|
|
846
846
|
return;
|
|
847
847
|
default:
|
|
848
|
-
D(o,
|
|
848
|
+
D(o, ze.name);
|
|
849
849
|
return;
|
|
850
850
|
}
|
|
851
851
|
})() ?? e.name ?? "Chat";
|
|
@@ -859,17 +859,17 @@ function Vr(e) {
|
|
|
859
859
|
case "welcome":
|
|
860
860
|
return;
|
|
861
861
|
default:
|
|
862
|
-
D(e,
|
|
862
|
+
D(e, ze.name);
|
|
863
863
|
return;
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
866
|
function Gr() {
|
|
867
|
-
const { router: e } =
|
|
867
|
+
const { router: e } = x(), {
|
|
868
868
|
routerState: { screen: o },
|
|
869
869
|
toSessionsScreen: t
|
|
870
870
|
} = $();
|
|
871
871
|
return o !== "chat" || e != null && e.chatScreenOnly ? null : /* @__PURE__ */ r(
|
|
872
|
-
|
|
872
|
+
k,
|
|
873
873
|
{
|
|
874
874
|
variant: "ghost",
|
|
875
875
|
size: "fit",
|
|
@@ -884,7 +884,7 @@ function Kr({
|
|
|
884
884
|
}) {
|
|
885
885
|
const { setIsOpen: o } = K(), { isSmallScreen: t } = P();
|
|
886
886
|
return t && e.hideOnSmallScreen || !t && e.hideOnLargeScreen ? null : /* @__PURE__ */ r(
|
|
887
|
-
|
|
887
|
+
k,
|
|
888
888
|
{
|
|
889
889
|
variant: "ghost",
|
|
890
890
|
size: "fit",
|
|
@@ -897,10 +897,10 @@ function Kr({
|
|
|
897
897
|
}
|
|
898
898
|
);
|
|
899
899
|
}
|
|
900
|
-
function
|
|
900
|
+
function we({
|
|
901
901
|
button: e
|
|
902
902
|
}) {
|
|
903
|
-
const [o, t] =
|
|
903
|
+
const [o, t] = T(!1), {
|
|
904
904
|
routerState: { screen: n }
|
|
905
905
|
} = $(), { isSmallScreen: s } = P(), { theme: i } = X(), { setWidth: a, setHeight: c } = jt();
|
|
906
906
|
if (n !== "chat" && n !== "sessions") return null;
|
|
@@ -911,7 +911,7 @@ function ge({
|
|
|
911
911
|
case "sessions":
|
|
912
912
|
return i.screens.sessions.height;
|
|
913
913
|
default:
|
|
914
|
-
return D(n,
|
|
914
|
+
return D(n, we.name), i.screens.chat.height;
|
|
915
915
|
}
|
|
916
916
|
})(), h = (() => {
|
|
917
917
|
switch (n) {
|
|
@@ -920,21 +920,21 @@ function ge({
|
|
|
920
920
|
case "sessions":
|
|
921
921
|
return i.screens.sessions.width;
|
|
922
922
|
default:
|
|
923
|
-
return D(n,
|
|
923
|
+
return D(n, we.name), i.screens.chat.width;
|
|
924
924
|
}
|
|
925
|
-
})(),
|
|
926
|
-
t((
|
|
927
|
-
const m = !
|
|
925
|
+
})(), y = () => {
|
|
926
|
+
t((w) => {
|
|
927
|
+
const m = !w;
|
|
928
928
|
return c(m ? "100vh" : l), a(m ? `max(40vw, ${h})` : h), m;
|
|
929
929
|
});
|
|
930
930
|
};
|
|
931
931
|
return s && e.hideOnSmallScreen || !s && e.hideOnLargeScreen ? null : /* @__PURE__ */ r(
|
|
932
|
-
|
|
932
|
+
k,
|
|
933
933
|
{
|
|
934
934
|
variant: "ghost",
|
|
935
935
|
size: "fit",
|
|
936
936
|
className: "rounded-full",
|
|
937
|
-
onClick:
|
|
937
|
+
onClick: y,
|
|
938
938
|
children: /* @__PURE__ */ r(
|
|
939
939
|
ee,
|
|
940
940
|
{
|
|
@@ -947,10 +947,10 @@ function ge({
|
|
|
947
947
|
function Et({
|
|
948
948
|
button: e
|
|
949
949
|
}) {
|
|
950
|
-
var
|
|
951
|
-
const { close: o } =
|
|
952
|
-
const { success:
|
|
953
|
-
if (o(), !
|
|
950
|
+
var b, I;
|
|
951
|
+
const { close: o } = de(), { widgetCtx: t } = R(), { setIsOpen: n } = K(), { resolveSession: s, sessionState: i } = B(), { isSmallScreen: a } = P(), c = !i.session, l = ((b = i.session) == null ? void 0 : b.isOpened) === !1, h = e.onResolved || "stay-in-chat", y = e.behaviorBeforeSessionCreation || "disabled", w = e.behaviorIfSessionIsResolved || "disabled", m = !!(i.isResolvingSession || c && y === "disabled" || l && w === "disabled"), C = async () => {
|
|
952
|
+
const { success: S, error: M } = await s();
|
|
953
|
+
if (o(), !S) return console.error(M);
|
|
954
954
|
switch (h) {
|
|
955
955
|
case "stay-in-chat":
|
|
956
956
|
return;
|
|
@@ -967,9 +967,9 @@ function Et({
|
|
|
967
967
|
D(h, Et.name);
|
|
968
968
|
break;
|
|
969
969
|
}
|
|
970
|
-
},
|
|
970
|
+
}, u = () => {
|
|
971
971
|
if (c)
|
|
972
|
-
switch (
|
|
972
|
+
switch (y) {
|
|
973
973
|
case "disabled":
|
|
974
974
|
return;
|
|
975
975
|
case "close-widget":
|
|
@@ -977,12 +977,12 @@ function Et({
|
|
|
977
977
|
break;
|
|
978
978
|
default:
|
|
979
979
|
D(
|
|
980
|
-
|
|
981
|
-
|
|
980
|
+
y,
|
|
981
|
+
u.name
|
|
982
982
|
);
|
|
983
983
|
}
|
|
984
984
|
if (l)
|
|
985
|
-
switch (
|
|
985
|
+
switch (w) {
|
|
986
986
|
case "disabled":
|
|
987
987
|
return;
|
|
988
988
|
case "close-widget":
|
|
@@ -998,16 +998,16 @@ function Et({
|
|
|
998
998
|
break;
|
|
999
999
|
default:
|
|
1000
1000
|
D(
|
|
1001
|
-
|
|
1002
|
-
|
|
1001
|
+
w,
|
|
1002
|
+
u.name
|
|
1003
1003
|
);
|
|
1004
1004
|
}
|
|
1005
1005
|
};
|
|
1006
|
-
return a && e.hideOnSmallScreen || !a && e.hideOnLargeScreen ? null : ((
|
|
1006
|
+
return a && e.hideOnSmallScreen || !a && e.hideOnLargeScreen ? null : ((I = e.confirmation) == null ? void 0 : I.type) === "modal" && !l && !c ? /* @__PURE__ */ r(
|
|
1007
1007
|
_t,
|
|
1008
1008
|
{
|
|
1009
1009
|
trigger: /* @__PURE__ */ r(
|
|
1010
|
-
|
|
1010
|
+
k,
|
|
1011
1011
|
{
|
|
1012
1012
|
variant: "ghost",
|
|
1013
1013
|
size: "fit",
|
|
@@ -1021,7 +1021,7 @@ function Et({
|
|
|
1021
1021
|
/* @__PURE__ */ r(Ct, { children: /* @__PURE__ */ r(St, { children: e.confirmation.description || "Are you sure you want to close this conversation?" }) }),
|
|
1022
1022
|
/* @__PURE__ */ d(zt, { children: [
|
|
1023
1023
|
/* @__PURE__ */ r(
|
|
1024
|
-
|
|
1024
|
+
k,
|
|
1025
1025
|
{
|
|
1026
1026
|
variant: "secondary",
|
|
1027
1027
|
onClick: o,
|
|
@@ -1030,10 +1030,10 @@ function Et({
|
|
|
1030
1030
|
}
|
|
1031
1031
|
),
|
|
1032
1032
|
/* @__PURE__ */ r(
|
|
1033
|
-
|
|
1033
|
+
k,
|
|
1034
1034
|
{
|
|
1035
1035
|
variant: "destructive",
|
|
1036
|
-
onClick:
|
|
1036
|
+
onClick: C,
|
|
1037
1037
|
disabled: i.isResolvingSession,
|
|
1038
1038
|
children: e.confirmation.confirmButtonText || "Yes"
|
|
1039
1039
|
}
|
|
@@ -1042,27 +1042,27 @@ function Et({
|
|
|
1042
1042
|
] })
|
|
1043
1043
|
}
|
|
1044
1044
|
) : /* @__PURE__ */ r(
|
|
1045
|
-
|
|
1045
|
+
k,
|
|
1046
1046
|
{
|
|
1047
1047
|
variant: "ghost",
|
|
1048
1048
|
size: "fit",
|
|
1049
1049
|
className: "rounded-full",
|
|
1050
|
-
onClick: l || c ?
|
|
1050
|
+
onClick: l || c ? u : C,
|
|
1051
1051
|
disabled: m,
|
|
1052
1052
|
children: /* @__PURE__ */ r(ee, { name: e.icon })
|
|
1053
1053
|
}
|
|
1054
1054
|
);
|
|
1055
1055
|
}
|
|
1056
|
-
function
|
|
1056
|
+
function ue({ button: e }) {
|
|
1057
1057
|
switch (e.functionality) {
|
|
1058
1058
|
case "close-widget":
|
|
1059
1059
|
return /* @__PURE__ */ r(Kr, { button: e });
|
|
1060
1060
|
case "expand-shrink":
|
|
1061
|
-
return /* @__PURE__ */ r(
|
|
1061
|
+
return /* @__PURE__ */ r(we, { button: e });
|
|
1062
1062
|
case "resolve-session":
|
|
1063
1063
|
return /* @__PURE__ */ r(Et, { button: e });
|
|
1064
1064
|
default:
|
|
1065
|
-
return D(e,
|
|
1065
|
+
return D(e, ue.name), null;
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
1068
|
const Qr = {
|
|
@@ -1073,9 +1073,9 @@ const Qr = {
|
|
|
1073
1073
|
function Zr() {
|
|
1074
1074
|
const {
|
|
1075
1075
|
routerState: { screen: e }
|
|
1076
|
-
} = $(), { headerButtons: o } =
|
|
1077
|
-
return !t || t.length === 0 ? /* @__PURE__ */ r(
|
|
1078
|
-
|
|
1076
|
+
} = $(), { headerButtons: o } = x(), t = e === "chat" ? o == null ? void 0 : o.chatScreen : e === "sessions" ? o == null ? void 0 : o.sessionsScreen : [];
|
|
1077
|
+
return !t || t.length === 0 ? /* @__PURE__ */ r(ue, { button: Qr }) : /* @__PURE__ */ r(te, { children: t.map((n) => /* @__PURE__ */ r(
|
|
1078
|
+
ue,
|
|
1079
1079
|
{
|
|
1080
1080
|
button: n
|
|
1081
1081
|
},
|
|
@@ -1085,7 +1085,7 @@ function Zr() {
|
|
|
1085
1085
|
function Ot() {
|
|
1086
1086
|
const {
|
|
1087
1087
|
routerState: { screen: e }
|
|
1088
|
-
} = $(), o = Vr(e), t =
|
|
1088
|
+
} = $(), o = Vr(e), t = ze();
|
|
1089
1089
|
return /* @__PURE__ */ r("header", { ...o, className: "py-2 px-4 shrink-0", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1090
1090
|
/* @__PURE__ */ r(Gr, {}),
|
|
1091
1091
|
/* @__PURE__ */ r(
|
|
@@ -1113,7 +1113,7 @@ function Jr() {
|
|
|
1113
1113
|
};
|
|
1114
1114
|
}
|
|
1115
1115
|
function eo() {
|
|
1116
|
-
const { activeMode: e, Component: o } = ht(), { sendMessage: t } = j(), { createStateCheckpoint: n } = B(), [s, i] =
|
|
1116
|
+
const { activeMode: e, Component: o } = ht(), { sendMessage: t } = j(), { createStateCheckpoint: n } = B(), [s, i] = T(!1), a = async (c) => {
|
|
1117
1117
|
try {
|
|
1118
1118
|
i(!0), await t(c);
|
|
1119
1119
|
} catch (l) {
|
|
@@ -1137,7 +1137,7 @@ const O = q.forwardRef(
|
|
|
1137
1137
|
(e, o) => {
|
|
1138
1138
|
var t, n, s;
|
|
1139
1139
|
return /* @__PURE__ */ r(
|
|
1140
|
-
|
|
1140
|
+
f,
|
|
1141
1141
|
{
|
|
1142
1142
|
...e,
|
|
1143
1143
|
ref: o,
|
|
@@ -1186,16 +1186,16 @@ function ro() {
|
|
|
1186
1186
|
isCsatSubmitted: n,
|
|
1187
1187
|
submittedScore: s,
|
|
1188
1188
|
submittedFeedback: i
|
|
1189
|
-
} = mt(), [a, c] =
|
|
1190
|
-
c((
|
|
1191
|
-
},
|
|
1189
|
+
} = mt(), [a, c] = T(null), [l, h] = T(null), y = (m) => {
|
|
1190
|
+
c((C) => C === m ? null : m);
|
|
1191
|
+
}, w = () => {
|
|
1192
1192
|
a && o({
|
|
1193
1193
|
score: a,
|
|
1194
1194
|
feedback: l || void 0
|
|
1195
1195
|
});
|
|
1196
1196
|
};
|
|
1197
1197
|
return !t && !n ? null : /* @__PURE__ */ d("div", { className: "w-1/2 min-w-80 max-w-96 mx-auto overflow-hidden", children: [
|
|
1198
|
-
/* @__PURE__ */ r(
|
|
1198
|
+
/* @__PURE__ */ r(_, { mode: "wait", children: t && !a ? /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground text-center pt-2", children: "How was your conversation?" }) }, "csat-requested-title") : n ? /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground text-center pt-2", children: "You rated the conversation as" }) }, "csat-submitted-title") : null }),
|
|
1199
1199
|
/* @__PURE__ */ r(
|
|
1200
1200
|
"div",
|
|
1201
1201
|
{
|
|
@@ -1205,7 +1205,7 @@ function ro() {
|
|
|
1205
1205
|
n && "gap-0 justify-center"
|
|
1206
1206
|
),
|
|
1207
1207
|
children: to.map((m) => /* @__PURE__ */ r(
|
|
1208
|
-
|
|
1208
|
+
k,
|
|
1209
1209
|
{
|
|
1210
1210
|
variant: m.value === a ? "secondary" : "ghost",
|
|
1211
1211
|
size: "selfless",
|
|
@@ -1219,14 +1219,14 @@ function ro() {
|
|
|
1219
1219
|
n && m.value !== s && "opacity-0 size-0",
|
|
1220
1220
|
n && m.value === s && "opacity-100 size-fit text-4xl"
|
|
1221
1221
|
),
|
|
1222
|
-
onClick: t ? () =>
|
|
1222
|
+
onClick: t ? () => y(m.value) : void 0,
|
|
1223
1223
|
children: m.emoji
|
|
1224
1224
|
},
|
|
1225
1225
|
m.value
|
|
1226
1226
|
))
|
|
1227
1227
|
}
|
|
1228
1228
|
),
|
|
1229
|
-
/* @__PURE__ */ r(
|
|
1229
|
+
/* @__PURE__ */ r(_, { mode: "wait", children: (a || s) && /* @__PURE__ */ r(O, { children: /* @__PURE__ */ d("div", { className: "pb-2 px-2 flex items-end", children: [
|
|
1230
1230
|
/* @__PURE__ */ r(
|
|
1231
1231
|
"textarea",
|
|
1232
1232
|
{
|
|
@@ -1248,10 +1248,10 @@ function ro() {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
),
|
|
1250
1250
|
/* @__PURE__ */ r(
|
|
1251
|
-
|
|
1251
|
+
k,
|
|
1252
1252
|
{
|
|
1253
1253
|
size: "fit",
|
|
1254
|
-
onClick:
|
|
1254
|
+
onClick: w,
|
|
1255
1255
|
disabled: !a,
|
|
1256
1256
|
className: p(
|
|
1257
1257
|
"transition-all overflow-hidden",
|
|
@@ -1266,7 +1266,7 @@ function ro() {
|
|
|
1266
1266
|
] });
|
|
1267
1267
|
}
|
|
1268
1268
|
function U() {
|
|
1269
|
-
const { dir: e } =
|
|
1269
|
+
const { dir: e } = fe(), o = x();
|
|
1270
1270
|
return pt(() => {
|
|
1271
1271
|
const t = Tr(o.language) ? o.language : "en";
|
|
1272
1272
|
return {
|
|
@@ -1277,7 +1277,7 @@ function U() {
|
|
|
1277
1277
|
};
|
|
1278
1278
|
}, [o.language, e]);
|
|
1279
1279
|
}
|
|
1280
|
-
function
|
|
1280
|
+
function Ne({
|
|
1281
1281
|
suggestion: e,
|
|
1282
1282
|
className: o,
|
|
1283
1283
|
...t
|
|
@@ -1287,7 +1287,7 @@ function ze({
|
|
|
1287
1287
|
i && n({ content: i });
|
|
1288
1288
|
};
|
|
1289
1289
|
return /* @__PURE__ */ r(
|
|
1290
|
-
|
|
1290
|
+
k,
|
|
1291
1291
|
{
|
|
1292
1292
|
...g("chat/suggested_reply_btn"),
|
|
1293
1293
|
size: "sm",
|
|
@@ -1306,7 +1306,7 @@ function oo() {
|
|
|
1306
1306
|
...g("chat/might_solve_user_issue_suggested_replies_container"),
|
|
1307
1307
|
className: "flex items-center gap-2 p-2 pb-0 flex-wrap",
|
|
1308
1308
|
children: o.map((t) => /* @__PURE__ */ r(
|
|
1309
|
-
|
|
1309
|
+
Ne,
|
|
1310
1310
|
{
|
|
1311
1311
|
suggestion: t,
|
|
1312
1312
|
className: "flex-1"
|
|
@@ -1317,14 +1317,14 @@ function oo() {
|
|
|
1317
1317
|
);
|
|
1318
1318
|
}
|
|
1319
1319
|
function it() {
|
|
1320
|
-
const { sessionState: e } = B(), { chatFooterItems: o } =
|
|
1321
|
-
return /* @__PURE__ */ r(
|
|
1320
|
+
const { sessionState: e } = B(), { chatFooterItems: o } = x(), t = !!e.session && !e.session.isOpened, n = !t;
|
|
1321
|
+
return /* @__PURE__ */ r(_, { mode: "wait", children: o == null ? void 0 : o.map((s, i) => s.showWhenSessionIsOpen === !1 && n || s.showWhenSessionIsResolved === !1 && t ? null : /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r("div", { className: "pb-2 text-center text-xs", children: /* @__PURE__ */ r(xe, { children: s.message }) }) }, `${s.message}-${i}`)) });
|
|
1322
1322
|
}
|
|
1323
1323
|
function no({
|
|
1324
1324
|
file: { status: e, file: o, error: t },
|
|
1325
1325
|
onCancel: n
|
|
1326
1326
|
}) {
|
|
1327
|
-
const [s, i] =
|
|
1327
|
+
const [s, i] = T(
|
|
1328
1328
|
null
|
|
1329
1329
|
);
|
|
1330
1330
|
re(() => {
|
|
@@ -1381,7 +1381,7 @@ function no({
|
|
|
1381
1381
|
"opacity-0 group-hover:opacity-100 transition"
|
|
1382
1382
|
),
|
|
1383
1383
|
onClick: n,
|
|
1384
|
-
children: /* @__PURE__ */ r(
|
|
1384
|
+
children: /* @__PURE__ */ r(ve, { className: "size-4 text-primary-foreground" })
|
|
1385
1385
|
}
|
|
1386
1386
|
),
|
|
1387
1387
|
/* @__PURE__ */ r(c, {})
|
|
@@ -1393,29 +1393,29 @@ function no({
|
|
|
1393
1393
|
}
|
|
1394
1394
|
function so() {
|
|
1395
1395
|
var E;
|
|
1396
|
-
const { isSmallScreen: e } = P(), o =
|
|
1396
|
+
const { isSmallScreen: e } = P(), o = ce(null), { sendMessage: t } = j(), { sessionState: n } = B(), { t: s } = U(), [i, a] = T(""), {
|
|
1397
1397
|
allFiles: c,
|
|
1398
1398
|
emptyTheFiles: l,
|
|
1399
1399
|
handleCancelUpload: h,
|
|
1400
|
-
appendFiles:
|
|
1401
|
-
isUploading:
|
|
1400
|
+
appendFiles: y,
|
|
1401
|
+
isUploading: w,
|
|
1402
1402
|
successFiles: m
|
|
1403
|
-
} = qt(),
|
|
1404
|
-
|
|
1405
|
-
},
|
|
1406
|
-
if (
|
|
1407
|
-
|
|
1403
|
+
} = qt(), C = !!((E = n.session) != null && E.isHandedOff), { isAwaitingBotReply: u } = gt(), b = (v) => {
|
|
1404
|
+
y(v);
|
|
1405
|
+
}, I = !i.trim() && m.length === 0, S = async () => {
|
|
1406
|
+
if (u || I) return;
|
|
1407
|
+
w && console.info("please wait for the file(s) to upload");
|
|
1408
1408
|
const v = i.trim();
|
|
1409
1409
|
t({
|
|
1410
1410
|
content: v,
|
|
1411
1411
|
attachments: m.flatMap(
|
|
1412
|
-
(
|
|
1412
|
+
(z) => z.fileUrl ? [
|
|
1413
1413
|
{
|
|
1414
|
-
url:
|
|
1415
|
-
type:
|
|
1416
|
-
name:
|
|
1417
|
-
id:
|
|
1418
|
-
size:
|
|
1414
|
+
url: z.fileUrl,
|
|
1415
|
+
type: z.file.type,
|
|
1416
|
+
name: z.file.name,
|
|
1417
|
+
id: z.id,
|
|
1418
|
+
size: z.file.size
|
|
1419
1419
|
}
|
|
1420
1420
|
] : []
|
|
1421
1421
|
)
|
|
@@ -1425,13 +1425,13 @@ function so() {
|
|
|
1425
1425
|
getInputProps: A,
|
|
1426
1426
|
open: F
|
|
1427
1427
|
} = Dr({
|
|
1428
|
-
onDrop:
|
|
1428
|
+
onDrop: b,
|
|
1429
1429
|
noClick: !0,
|
|
1430
1430
|
onDropRejected() {
|
|
1431
1431
|
console.error("unsupported file type, or the file is too large");
|
|
1432
1432
|
},
|
|
1433
1433
|
maxSize: 5 * 1024 * 1024,
|
|
1434
|
-
accept:
|
|
1434
|
+
accept: C ? {
|
|
1435
1435
|
"text/*": [".txt"],
|
|
1436
1436
|
"image/*": [".png", ".jpg", ".jpeg", ".gif"],
|
|
1437
1437
|
"application/pdf": [".pdf"]
|
|
@@ -1442,8 +1442,8 @@ function so() {
|
|
|
1442
1442
|
"image/webp": [".webp"]
|
|
1443
1443
|
}
|
|
1444
1444
|
}), H = (v) => {
|
|
1445
|
-
const
|
|
1446
|
-
|
|
1445
|
+
const z = v.clipboardData;
|
|
1446
|
+
z && z.files.length > 0 && b(Array.from(z.files));
|
|
1447
1447
|
};
|
|
1448
1448
|
return /* @__PURE__ */ d(
|
|
1449
1449
|
"div",
|
|
@@ -1476,7 +1476,7 @@ function so() {
|
|
|
1476
1476
|
{
|
|
1477
1477
|
...g("chat/input_box/attachments_container"),
|
|
1478
1478
|
className: "flex items-center gap-1",
|
|
1479
|
-
children: /* @__PURE__ */ r(
|
|
1479
|
+
children: /* @__PURE__ */ r(_, { mode: "popLayout", children: c.map((v) => /* @__PURE__ */ r(f, { snapExit: !0, children: /* @__PURE__ */ r(
|
|
1480
1480
|
no,
|
|
1481
1481
|
{
|
|
1482
1482
|
onCancel: () => h(v.id),
|
|
@@ -1507,7 +1507,7 @@ function so() {
|
|
|
1507
1507
|
),
|
|
1508
1508
|
onChange: (v) => a(v.target.value),
|
|
1509
1509
|
onKeyDown: async (v) => {
|
|
1510
|
-
v.key === "Enter" && !v.shiftKey && (v.preventDefault(),
|
|
1510
|
+
v.key === "Enter" && !v.shiftKey && (v.preventDefault(), S());
|
|
1511
1511
|
},
|
|
1512
1512
|
placeholder: s("write_a_message_placeholder")
|
|
1513
1513
|
}
|
|
@@ -1523,7 +1523,7 @@ function so() {
|
|
|
1523
1523
|
align: "start",
|
|
1524
1524
|
content: "attach files, (maximum size 5mb)",
|
|
1525
1525
|
children: /* @__PURE__ */ r(
|
|
1526
|
-
|
|
1526
|
+
k,
|
|
1527
1527
|
{
|
|
1528
1528
|
onClick: F,
|
|
1529
1529
|
size: "fit",
|
|
@@ -1531,19 +1531,19 @@ function so() {
|
|
|
1531
1531
|
className: p(
|
|
1532
1532
|
"rounded-full size-8 flex items-center justify-center p-0 overflow-hidden"
|
|
1533
1533
|
),
|
|
1534
|
-
children: /* @__PURE__ */ r(
|
|
1534
|
+
children: /* @__PURE__ */ r(_, { mode: "wait", children: C && !u ? /* @__PURE__ */ r(f, { children: /* @__PURE__ */ r(ur, { className: "size-4" }) }, "paper-clip") : /* @__PURE__ */ r(f, { children: /* @__PURE__ */ r(fr, { className: "size-4" }) }, "image-icon") })
|
|
1535
1535
|
}
|
|
1536
1536
|
)
|
|
1537
1537
|
}
|
|
1538
1538
|
),
|
|
1539
1539
|
/* @__PURE__ */ r(J, { content: "send message", side: "top", align: "end", children: /* @__PURE__ */ r(
|
|
1540
|
-
|
|
1540
|
+
k,
|
|
1541
1541
|
{
|
|
1542
1542
|
size: "fit",
|
|
1543
|
-
onClick:
|
|
1544
|
-
disabled:
|
|
1543
|
+
onClick: S,
|
|
1544
|
+
disabled: u || w || I,
|
|
1545
1545
|
className: "rounded-full size-8 flex items-center justify-center p-0",
|
|
1546
|
-
children: /* @__PURE__ */ r(
|
|
1546
|
+
children: /* @__PURE__ */ r(_, { mode: "wait", children: u || w ? /* @__PURE__ */ r(f, { snapExit: !0, children: /* @__PURE__ */ r(vr, { className: "size-4 animate-spin animate-iteration-infinite" }) }, "loading") : /* @__PURE__ */ r(f, { snapExit: !0, children: /* @__PURE__ */ r(ut, { className: "size-4" }) }, "send") })
|
|
1547
1547
|
}
|
|
1548
1548
|
) })
|
|
1549
1549
|
] })
|
|
@@ -1555,14 +1555,14 @@ function so() {
|
|
|
1555
1555
|
);
|
|
1556
1556
|
}
|
|
1557
1557
|
function at() {
|
|
1558
|
-
const { widgetCtx: e } = R(), { router: o } =
|
|
1559
|
-
return /* @__PURE__ */ r(te, { children: t || o != null && o.chatScreenOnly ? /* @__PURE__ */ r(
|
|
1558
|
+
const { widgetCtx: e } = R(), { router: o } = x(), { canCreateNewSession: t } = B(), { toSessionsScreen: n } = $(), { t: s } = U();
|
|
1559
|
+
return /* @__PURE__ */ r(te, { children: t || o != null && o.chatScreenOnly ? /* @__PURE__ */ r(k, { onClick: e.resetChat, className: "rounded-2xl w-full", children: s("new_conversation") }) : /* @__PURE__ */ r(k, { onClick: n, className: "rounded-2xl w-full", children: s("back_to_conversations") }) });
|
|
1560
1560
|
}
|
|
1561
1561
|
function io() {
|
|
1562
1562
|
const { t: e } = U(), { isCsatRequested: o, isCsatSubmitted: t } = mt();
|
|
1563
|
-
return /* @__PURE__ */ r("div", { className: "p-2", children: /* @__PURE__ */ r("div", { className: "p-2 bg-muted rounded-3xl", children: /* @__PURE__ */ r(
|
|
1563
|
+
return /* @__PURE__ */ r("div", { className: "p-2", children: /* @__PURE__ */ r("div", { className: "p-2 bg-muted rounded-3xl", children: /* @__PURE__ */ r(_, { mode: "wait", children: o || t ? /* @__PURE__ */ d(O, { children: [
|
|
1564
1564
|
/* @__PURE__ */ r(ro, {}),
|
|
1565
|
-
/* @__PURE__ */ r(
|
|
1565
|
+
/* @__PURE__ */ r(_, { mode: "wait", children: t && /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(at, {}) }, "new-conv-or-back-to-convs-button") })
|
|
1566
1566
|
] }, "csat") : /* @__PURE__ */ d(O, { children: [
|
|
1567
1567
|
/* @__PURE__ */ d("div", { className: "ps-2 flex items-center gap-1 pb-2", children: [
|
|
1568
1568
|
/* @__PURE__ */ r(wt, { className: "size-4 text-emerald-600" }),
|
|
@@ -1573,14 +1573,14 @@ function io() {
|
|
|
1573
1573
|
}
|
|
1574
1574
|
function ao() {
|
|
1575
1575
|
var a;
|
|
1576
|
-
const { initialQuestions: e, initialQuestionsPosition: o, thisWasHelpfulOrNot: t } =
|
|
1577
|
-
return /* @__PURE__ */ r("footer", { children: /* @__PURE__ */ r(
|
|
1576
|
+
const { initialQuestions: e, initialQuestionsPosition: o, thisWasHelpfulOrNot: t } = x(), { sessionState: n } = B(), { messagesState: s } = j(), i = s.messages.length === 0;
|
|
1577
|
+
return /* @__PURE__ */ r("footer", { children: /* @__PURE__ */ r(_, { mode: "wait", children: n.session && !((a = n.session) != null && a.isOpened) ? /* @__PURE__ */ d(O, { children: [
|
|
1578
1578
|
/* @__PURE__ */ r(io, {}),
|
|
1579
1579
|
/* @__PURE__ */ r(it, {})
|
|
1580
1580
|
] }, "session-closed") : /* @__PURE__ */ d(O, { children: [
|
|
1581
1581
|
s.lastAIResMightSolveUserIssue && (t == null ? void 0 : t.enabled) !== !1 && /* @__PURE__ */ r(oo, {}),
|
|
1582
1582
|
i && e && o !== "below-initial-messages" && /* @__PURE__ */ r("div", { className: "flex items-center flex-row justify-end gap-2 flex-wrap px-2", children: e == null ? void 0 : e.map((c, l) => /* @__PURE__ */ r(
|
|
1583
|
-
|
|
1583
|
+
Ne,
|
|
1584
1584
|
{
|
|
1585
1585
|
suggestion: c
|
|
1586
1586
|
},
|
|
@@ -1623,7 +1623,7 @@ function lo({
|
|
|
1623
1623
|
isAloneInGroup: t
|
|
1624
1624
|
}
|
|
1625
1625
|
) : /* @__PURE__ */ r(
|
|
1626
|
-
|
|
1626
|
+
me,
|
|
1627
1627
|
{
|
|
1628
1628
|
...n,
|
|
1629
1629
|
isFirstInGroup: e,
|
|
@@ -1638,7 +1638,7 @@ function At({
|
|
|
1638
1638
|
containerClassName: t
|
|
1639
1639
|
}) {
|
|
1640
1640
|
var a, c;
|
|
1641
|
-
const { timestamps: n } =
|
|
1641
|
+
const { timestamps: n } = x();
|
|
1642
1642
|
if (!((a = n == null ? void 0 : n.perMessageGroup) != null && a.enabled))
|
|
1643
1643
|
return null;
|
|
1644
1644
|
const s = (c = e[e.length - 1]) == null ? void 0 : c.timestamp;
|
|
@@ -1656,7 +1656,7 @@ function At({
|
|
|
1656
1656
|
})();
|
|
1657
1657
|
return i ? /* @__PURE__ */ r("div", { className: t, children: /* @__PURE__ */ r("span", { className: p("text-xs text-muted-foreground", o), children: i }) }) : null;
|
|
1658
1658
|
}
|
|
1659
|
-
function
|
|
1659
|
+
function ae({
|
|
1660
1660
|
messages: e,
|
|
1661
1661
|
agent: o,
|
|
1662
1662
|
suggestedReplies: t
|
|
@@ -1668,7 +1668,7 @@ function Ne({
|
|
|
1668
1668
|
className: p("flex items-end gap-2"),
|
|
1669
1669
|
children: [
|
|
1670
1670
|
/* @__PURE__ */ r(J, { content: o == null ? void 0 : o.name, side: "right", align: "end", children: /* @__PURE__ */ r(
|
|
1671
|
-
|
|
1671
|
+
ge,
|
|
1672
1672
|
{
|
|
1673
1673
|
...g("chat/agent_msg_group/root/avatar"),
|
|
1674
1674
|
agent: o,
|
|
@@ -1683,7 +1683,7 @@ function Ne({
|
|
|
1683
1683
|
className: p("flex items-end gap-2"),
|
|
1684
1684
|
children: [
|
|
1685
1685
|
/* @__PURE__ */ r(J, { content: o == null ? void 0 : o.name, side: "right", align: "end", children: /* @__PURE__ */ r(
|
|
1686
|
-
|
|
1686
|
+
ge,
|
|
1687
1687
|
{
|
|
1688
1688
|
...g("chat/agent_msg_group/avatar_and_msgs/avatar"),
|
|
1689
1689
|
agent: o
|
|
@@ -1718,7 +1718,7 @@ function Ne({
|
|
|
1718
1718
|
...g("chat/agent_msg_group/suggestions"),
|
|
1719
1719
|
className: p("flex flex-col gap-1 ps-8"),
|
|
1720
1720
|
children: t == null ? void 0 : t.map((n, s) => /* @__PURE__ */ r(
|
|
1721
|
-
|
|
1721
|
+
Ne,
|
|
1722
1722
|
{
|
|
1723
1723
|
suggestion: n
|
|
1724
1724
|
},
|
|
@@ -1736,7 +1736,7 @@ function Ft() {
|
|
|
1736
1736
|
widgetCtx: { org: e }
|
|
1737
1737
|
} = R(), {
|
|
1738
1738
|
sessionState: { session: o }
|
|
1739
|
-
} = B(), t =
|
|
1739
|
+
} = B(), t = x(), {
|
|
1740
1740
|
messagesState: { messages: n }
|
|
1741
1741
|
} = j();
|
|
1742
1742
|
return {
|
|
@@ -1825,7 +1825,9 @@ function mo(e) {
|
|
|
1825
1825
|
let t = null;
|
|
1826
1826
|
return e.forEach((n) => {
|
|
1827
1827
|
var s, i, a, c, l, h;
|
|
1828
|
-
|
|
1828
|
+
// Start a new group if the type changes
|
|
1829
|
+
(((s = t == null ? void 0 : t[0]) == null ? void 0 : s.type) !== n.type || // Start a new group if the agent changes
|
|
1830
|
+
((i = t[0]) == null ? void 0 : i.type) === "AGENT" && n.type === "AGENT" && (((a = n.agent) == null ? void 0 : a.id) !== ((c = t[0].agent) == null ? void 0 : c.id) || ((l = n.agent) == null ? void 0 : l.name) !== ((h = t[0].agent) == null ? void 0 : h.name))) && (t = [], o.push(t)), t.push(n);
|
|
1829
1831
|
}), o;
|
|
1830
1832
|
}
|
|
1831
1833
|
function go(e) {
|
|
@@ -1848,9 +1850,9 @@ function fo() {
|
|
|
1848
1850
|
initialQuestionsPosition: t,
|
|
1849
1851
|
initialQuestions: n,
|
|
1850
1852
|
bot: s
|
|
1851
|
-
} =
|
|
1853
|
+
} = x();
|
|
1852
1854
|
return /* @__PURE__ */ r(te, { children: e.length === 0 && o.length > 0 && /* @__PURE__ */ r(
|
|
1853
|
-
|
|
1855
|
+
ae,
|
|
1854
1856
|
{
|
|
1855
1857
|
messages: o.map(
|
|
1856
1858
|
({ message: i }, a) => ({
|
|
@@ -1869,15 +1871,15 @@ function fo() {
|
|
|
1869
1871
|
function vo() {
|
|
1870
1872
|
const {
|
|
1871
1873
|
messagesState: { messages: e }
|
|
1872
|
-
} = j(), { chatBannerItems: o } =
|
|
1874
|
+
} = j(), { chatBannerItems: o } = x();
|
|
1873
1875
|
return !(o != null && o.length) || e.length > 0 && o.every((t) => !t.persistent) ? null : /* @__PURE__ */ r("div", { className: "w-full text-center text-xs", children: o.map(
|
|
1874
|
-
({ message: t, persistent: n }, s) => e.length > 0 && !n ? null : /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
1876
|
+
({ message: t, persistent: n }, s) => e.length > 0 && !n ? null : /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(xe, { children: t }) }, `${t}-${s}`)
|
|
1875
1877
|
) });
|
|
1876
1878
|
}
|
|
1877
1879
|
function xo() {
|
|
1878
1880
|
const {
|
|
1879
1881
|
messagesState: { messages: e }
|
|
1880
|
-
} = j(), o =
|
|
1882
|
+
} = j(), o = x(), {
|
|
1881
1883
|
advancedInitialMessages: t = [],
|
|
1882
1884
|
initialQuestions: n,
|
|
1883
1885
|
initialQuestionsPosition: s
|
|
@@ -1886,7 +1888,7 @@ function xo() {
|
|
|
1886
1888
|
return t.length ? [] : e.length ? [] : (a = o.initialMessages) != null && a.length ? o.initialMessages : ["Hello, how can I help you?"];
|
|
1887
1889
|
})();
|
|
1888
1890
|
return /* @__PURE__ */ r(te, { children: e.length === 0 && i.length > 0 && /* @__PURE__ */ r(
|
|
1889
|
-
|
|
1891
|
+
ae,
|
|
1890
1892
|
{
|
|
1891
1893
|
messages: i.map(
|
|
1892
1894
|
(a, c) => ({
|
|
@@ -1910,12 +1912,12 @@ function bo() {
|
|
|
1910
1912
|
function yo() {
|
|
1911
1913
|
const {
|
|
1912
1914
|
messagesState: { messages: e }
|
|
1913
|
-
} = j(), { isAwaitingBotReply: o } = gt(), { componentStore: t } = R(), n =
|
|
1915
|
+
} = j(), { isAwaitingBotReply: o } = gt(), { componentStore: t } = R(), n = x(), s = pt(
|
|
1914
1916
|
() => mo(e),
|
|
1915
1917
|
[e]
|
|
1916
1918
|
), i = t.getComponent(
|
|
1917
1919
|
"loading"
|
|
1918
|
-
), a =
|
|
1920
|
+
), a = ce(null);
|
|
1919
1921
|
function c() {
|
|
1920
1922
|
setTimeout(() => {
|
|
1921
1923
|
const l = a.current;
|
|
@@ -1934,21 +1936,34 @@ function yo() {
|
|
|
1934
1936
|
/* @__PURE__ */ r(vo, {}),
|
|
1935
1937
|
/* @__PURE__ */ r(fo, {}),
|
|
1936
1938
|
/* @__PURE__ */ r(xo, {}),
|
|
1937
|
-
s.map((l) => {
|
|
1938
|
-
var
|
|
1939
|
-
const
|
|
1940
|
-
if (!
|
|
1939
|
+
s.map((l, h) => {
|
|
1940
|
+
var m, C, u, b;
|
|
1941
|
+
const y = (m = l == null ? void 0 : l[0]) == null ? void 0 : m.type, w = (C = l[0]) == null ? void 0 : C.id;
|
|
1942
|
+
if (!y || !w) return null;
|
|
1941
1943
|
if (go(l))
|
|
1942
|
-
return /* @__PURE__ */ r(ho, { messages: l },
|
|
1943
|
-
if (wo(l)
|
|
1944
|
-
const
|
|
1944
|
+
return /* @__PURE__ */ r(ho, { messages: l }, w);
|
|
1945
|
+
if (wo(l)) {
|
|
1946
|
+
const I = h === s.length - 1;
|
|
1947
|
+
if (o && I) return null;
|
|
1948
|
+
const S = (u = l[0]) == null ? void 0 : u.agent;
|
|
1949
|
+
return /* @__PURE__ */ r(
|
|
1950
|
+
ae,
|
|
1951
|
+
{
|
|
1952
|
+
messages: l,
|
|
1953
|
+
agent: S
|
|
1954
|
+
},
|
|
1955
|
+
w
|
|
1956
|
+
);
|
|
1957
|
+
}
|
|
1958
|
+
if (uo(l)) {
|
|
1959
|
+
const I = (b = l[0]) == null ? void 0 : b.agent;
|
|
1945
1960
|
return /* @__PURE__ */ r(
|
|
1946
|
-
|
|
1961
|
+
ae,
|
|
1947
1962
|
{
|
|
1948
1963
|
messages: l,
|
|
1949
|
-
agent:
|
|
1964
|
+
agent: I
|
|
1950
1965
|
},
|
|
1951
|
-
|
|
1966
|
+
w
|
|
1952
1967
|
);
|
|
1953
1968
|
}
|
|
1954
1969
|
return null;
|
|
@@ -1966,11 +1981,11 @@ function ko() {
|
|
|
1966
1981
|
} = j(), {
|
|
1967
1982
|
sessionState: { session: o }
|
|
1968
1983
|
} = B(), { isCanvasOpen: t } = Jr(), { theme: n } = X();
|
|
1969
|
-
|
|
1984
|
+
Ce({
|
|
1970
1985
|
width: t ? n.screens.chat.withCanvas.width : n.screens.chat.width,
|
|
1971
1986
|
height: t ? n.screens.chat.withCanvas.height : n.screens.chat.height
|
|
1972
1987
|
});
|
|
1973
|
-
const s =
|
|
1988
|
+
const s = ce((o == null ? void 0 : o.id) || "chat").current;
|
|
1974
1989
|
return /* @__PURE__ */ r(
|
|
1975
1990
|
"div",
|
|
1976
1991
|
{
|
|
@@ -1988,15 +2003,15 @@ function ko() {
|
|
|
1988
2003
|
},
|
|
1989
2004
|
children: /* @__PURE__ */ d("div", { className: "size-full justify-between flex flex-col", children: [
|
|
1990
2005
|
/* @__PURE__ */ r(Ot, {}),
|
|
1991
|
-
/* @__PURE__ */ r(
|
|
1992
|
-
|
|
2006
|
+
/* @__PURE__ */ r(_, { mode: "wait", children: e ? /* @__PURE__ */ r(
|
|
2007
|
+
f,
|
|
1993
2008
|
{
|
|
1994
2009
|
className: "flex flex-col items-center justify-center w-full flex-1",
|
|
1995
2010
|
children: /* @__PURE__ */ r(Pt, {})
|
|
1996
2011
|
},
|
|
1997
2012
|
"loading"
|
|
1998
2013
|
) : /* @__PURE__ */ d(
|
|
1999
|
-
|
|
2014
|
+
f,
|
|
2000
2015
|
{
|
|
2001
2016
|
className: "flex items-start h-full flex-1 overflow-auto",
|
|
2002
2017
|
snapExit: !0,
|
|
@@ -2075,7 +2090,7 @@ function zo({ className: e }) {
|
|
|
2075
2090
|
);
|
|
2076
2091
|
}
|
|
2077
2092
|
function Ht({ className: e }) {
|
|
2078
|
-
const { token: o } =
|
|
2093
|
+
const { token: o } = x();
|
|
2079
2094
|
return /* @__PURE__ */ r(
|
|
2080
2095
|
"div",
|
|
2081
2096
|
{
|
|
@@ -2114,9 +2129,9 @@ function lt({
|
|
|
2114
2129
|
session: e,
|
|
2115
2130
|
className: o
|
|
2116
2131
|
}) {
|
|
2117
|
-
const { bot: t } =
|
|
2132
|
+
const { bot: t } = x(), { toChatScreen: n } = $(), s = e.assignee.kind === "human" ? e.assignee.name || "Support Agent" : (t == null ? void 0 : t.name) || "AI Support Agent", i = e.assignee.kind === "human" ? e.assignee.avatarUrl || "" : (t == null ? void 0 : t.avatar) || "";
|
|
2118
2133
|
return /* @__PURE__ */ d(
|
|
2119
|
-
|
|
2134
|
+
k,
|
|
2120
2135
|
{
|
|
2121
2136
|
variant: "ghost",
|
|
2122
2137
|
size: "lg",
|
|
@@ -2127,13 +2142,13 @@ function lt({
|
|
|
2127
2142
|
onClick: () => n(e.id),
|
|
2128
2143
|
children: [
|
|
2129
2144
|
/* @__PURE__ */ d("div", { className: "flex-1 flex gap-2 items-center", children: [
|
|
2130
|
-
/* @__PURE__ */ r(
|
|
2131
|
-
/* @__PURE__ */ r(
|
|
2132
|
-
/* @__PURE__ */ r(
|
|
2145
|
+
/* @__PURE__ */ r(_, { mode: "wait", children: /* @__PURE__ */ r(f, { snapExit: !0, children: /* @__PURE__ */ d(be, { className: "size-10", children: [
|
|
2146
|
+
/* @__PURE__ */ r(ye, { src: i, alt: "Agent Icon" }),
|
|
2147
|
+
/* @__PURE__ */ r(ke, { children: /* @__PURE__ */ r(zr, { className: "size-4" }) })
|
|
2133
2148
|
] }) }) }),
|
|
2134
2149
|
/* @__PURE__ */ d("div", { className: "flex-1", children: [
|
|
2135
|
-
/* @__PURE__ */ r(
|
|
2136
|
-
/* @__PURE__ */ r(
|
|
2150
|
+
/* @__PURE__ */ r(_, { mode: "wait", children: /* @__PURE__ */ r(f, { snapExit: !0, children: s }, s) }),
|
|
2151
|
+
/* @__PURE__ */ r(_, { mode: "wait", children: e.lastMessage ? /* @__PURE__ */ r(f, { snapExit: !0, children: /* @__PURE__ */ r(
|
|
2137
2152
|
Tt,
|
|
2138
2153
|
{
|
|
2139
2154
|
remarkPlugins: [ft],
|
|
@@ -2141,7 +2156,7 @@ function lt({
|
|
|
2141
2156
|
className: "line-clamp-1 overflow-hidden text-ellipsis text-xs text-muted-foreground",
|
|
2142
2157
|
children: e.lastMessage
|
|
2143
2158
|
}
|
|
2144
|
-
) }, e.lastMessage || "content") : /* @__PURE__ */ r(
|
|
2159
|
+
) }, e.lastMessage || "content") : /* @__PURE__ */ r(f, { className: "w-1/2", snapExit: !0, children: /* @__PURE__ */ r(Co, { className: "h-4 w-full" }) }, "skeleton") })
|
|
2145
2160
|
] })
|
|
2146
2161
|
] }),
|
|
2147
2162
|
/* @__PURE__ */ r(Nr, { className: "size-4 text-muted-foreground shrink-0 rtl:-scale-100" })
|
|
@@ -2156,21 +2171,21 @@ function So() {
|
|
|
2156
2171
|
closedSessions: i,
|
|
2157
2172
|
canCreateNewSession: a
|
|
2158
2173
|
} = B();
|
|
2159
|
-
return /* @__PURE__ */ r("div", { className: "flex-1 flex flex-col overflow-scroll py-2 px-2", children: /* @__PURE__ */ r(
|
|
2160
|
-
|
|
2174
|
+
return /* @__PURE__ */ r("div", { className: "flex-1 flex flex-col overflow-scroll py-2 px-2", children: /* @__PURE__ */ r(_, { mode: "wait", children: n ? /* @__PURE__ */ r(
|
|
2175
|
+
f,
|
|
2161
2176
|
{
|
|
2162
2177
|
className: "flex-1 flex items-center justify-center",
|
|
2163
2178
|
children: /* @__PURE__ */ r(Pt, {})
|
|
2164
2179
|
},
|
|
2165
2180
|
"loading"
|
|
2166
2181
|
) : /* @__PURE__ */ r(
|
|
2167
|
-
|
|
2182
|
+
f,
|
|
2168
2183
|
{
|
|
2169
2184
|
className: "flex-1 flex flex-col gap-2 relative",
|
|
2170
2185
|
children: t.length ? /* @__PURE__ */ d(te, { children: [
|
|
2171
|
-
/* @__PURE__ */ d(
|
|
2186
|
+
/* @__PURE__ */ d(_, { children: [
|
|
2172
2187
|
s.length > 0 && /* @__PURE__ */ r(
|
|
2173
|
-
|
|
2188
|
+
f,
|
|
2174
2189
|
{
|
|
2175
2190
|
fadeIn: "up",
|
|
2176
2191
|
delay: 0.2,
|
|
@@ -2181,7 +2196,7 @@ function So() {
|
|
|
2181
2196
|
"open-sessions"
|
|
2182
2197
|
),
|
|
2183
2198
|
i.length > 0 && /* @__PURE__ */ d(
|
|
2184
|
-
|
|
2199
|
+
f,
|
|
2185
2200
|
{
|
|
2186
2201
|
className: "space-y-2",
|
|
2187
2202
|
delay: 0.2,
|
|
@@ -2202,7 +2217,7 @@ function So() {
|
|
|
2202
2217
|
)
|
|
2203
2218
|
] }),
|
|
2204
2219
|
a && /* @__PURE__ */ r("div", { className: "mt-auto w-full rounded-3xl sticky bottom-0 outline outline-8 outline-background bg-background", children: /* @__PURE__ */ rt(
|
|
2205
|
-
|
|
2220
|
+
k,
|
|
2206
2221
|
{
|
|
2207
2222
|
...g("sessions/new_conversation_btn"),
|
|
2208
2223
|
size: "lg",
|
|
@@ -2215,7 +2230,7 @@ function So() {
|
|
|
2215
2230
|
] }) : /* @__PURE__ */ d("div", { className: "flex-1 flex flex-col gap-2 items-center", children: [
|
|
2216
2231
|
/* @__PURE__ */ r("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ r("p", { className: "text-muted-foreground", children: e("no_conversations_yet") }) }),
|
|
2217
2232
|
/* @__PURE__ */ rt(
|
|
2218
|
-
|
|
2233
|
+
k,
|
|
2219
2234
|
{
|
|
2220
2235
|
...g("sessions/new_conversation_btn"),
|
|
2221
2236
|
size: "lg",
|
|
@@ -2232,7 +2247,7 @@ function So() {
|
|
|
2232
2247
|
}
|
|
2233
2248
|
function _o() {
|
|
2234
2249
|
const { theme: e } = X();
|
|
2235
|
-
return
|
|
2250
|
+
return Ce({
|
|
2236
2251
|
width: e.screens.sessions.width,
|
|
2237
2252
|
height: e.screens.sessions.height
|
|
2238
2253
|
}), /* @__PURE__ */ r(
|
|
@@ -2280,7 +2295,7 @@ const ie = G.forwardRef(
|
|
|
2280
2295
|
);
|
|
2281
2296
|
ie.displayName = "Input";
|
|
2282
2297
|
function Io() {
|
|
2283
|
-
const { contentIframeRef: e } = R(), { inline: o } =
|
|
2298
|
+
const { contentIframeRef: e } = R(), { inline: o } = x(), t = ce(null);
|
|
2284
2299
|
return re(() => {
|
|
2285
2300
|
const n = e == null ? void 0 : e.current;
|
|
2286
2301
|
if (n && t.current) {
|
|
@@ -2301,35 +2316,35 @@ function Io() {
|
|
|
2301
2316
|
}
|
|
2302
2317
|
}, [e, o]), { observedElementRef: t };
|
|
2303
2318
|
}
|
|
2304
|
-
const To =
|
|
2305
|
-
name:
|
|
2306
|
-
email:
|
|
2319
|
+
const To = he.object({
|
|
2320
|
+
name: he.string().min(2),
|
|
2321
|
+
email: he.string().email()
|
|
2307
2322
|
});
|
|
2308
2323
|
function Mo() {
|
|
2309
|
-
var
|
|
2324
|
+
var S, M, A, F, H, E, v, z;
|
|
2310
2325
|
const {
|
|
2311
2326
|
widgetCtx: { org: e }
|
|
2312
|
-
} = R(), { setIsOpen: o } = K(), { createUnverifiedContact: t } = Xt(), { isSmallScreen: n } = P(), s =
|
|
2313
|
-
|
|
2327
|
+
} = R(), { setIsOpen: o } = K(), { createUnverifiedContact: t } = Xt(), { isSmallScreen: n } = P(), s = x(), { theme: i } = X(), { t: a } = U(), { observedElementRef: c } = Io();
|
|
2328
|
+
Ce({
|
|
2314
2329
|
height: void 0,
|
|
2315
2330
|
width: i.screens.welcome.width
|
|
2316
2331
|
});
|
|
2317
|
-
const [l, h] =
|
|
2318
|
-
(
|
|
2319
|
-
), [
|
|
2320
|
-
async (
|
|
2321
|
-
|
|
2322
|
-
const L = To.safeParse({ name: l, email:
|
|
2332
|
+
const [l, h] = T(((S = s.prefillUserData) == null ? void 0 : S.name) || ""), [y, w] = T(((M = s.prefillUserData) == null ? void 0 : M.email) || ""), m = (s.extraDataCollectionFields || []).filter(
|
|
2333
|
+
(N) => N !== "name" && N !== "email" && !!N
|
|
2334
|
+
), [C, u] = T({}), [b, I] = Rr(
|
|
2335
|
+
async (N) => {
|
|
2336
|
+
N.preventDefault();
|
|
2337
|
+
const L = To.safeParse({ name: l, email: y });
|
|
2323
2338
|
L.success && await t(
|
|
2324
2339
|
{
|
|
2325
2340
|
email: L.data.email,
|
|
2326
2341
|
non_verified_name: L.data.name
|
|
2327
2342
|
},
|
|
2328
2343
|
// Only pass extra data if there is any
|
|
2329
|
-
Object.values(
|
|
2344
|
+
Object.values(C).filter(Boolean).length ? C : void 0
|
|
2330
2345
|
);
|
|
2331
2346
|
},
|
|
2332
|
-
[l,
|
|
2347
|
+
[l, y, C]
|
|
2333
2348
|
);
|
|
2334
2349
|
return /* @__PURE__ */ r(
|
|
2335
2350
|
"div",
|
|
@@ -2364,7 +2379,7 @@ function Mo() {
|
|
|
2364
2379
|
"text-primary-foreground"
|
|
2365
2380
|
),
|
|
2366
2381
|
children: [
|
|
2367
|
-
n && /* @__PURE__ */ r(
|
|
2382
|
+
n && /* @__PURE__ */ r(f, { className: "absolute top-6 end-6", children: /* @__PURE__ */ r(k, { size: "selfless", onClick: () => o(!1), children: /* @__PURE__ */ r(ve, { className: "size-4" }) }) }),
|
|
2368
2383
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between w-full mb-2", children: (A = s.assets) != null && A.organizationLogo ? /* @__PURE__ */ r(
|
|
2369
2384
|
"img",
|
|
2370
2385
|
{
|
|
@@ -2375,7 +2390,7 @@ function Mo() {
|
|
|
2375
2390
|
) : /* @__PURE__ */ r("h2", { className: "font-bold text-sm", children: e.name }) }),
|
|
2376
2391
|
/* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
2377
2392
|
/* @__PURE__ */ r("h1", { className: "text-[1.75rem] font-semibold tracking-tight leading-none", children: ((E = (H = s.textContent) == null ? void 0 : H.welcomeScreen) == null ? void 0 : E.title) || a("welcome_screen_title") }),
|
|
2378
|
-
/* @__PURE__ */ r("p", { className: "text-sm", children: ((
|
|
2393
|
+
/* @__PURE__ */ r("p", { className: "text-sm", children: ((z = (v = s.textContent) == null ? void 0 : v.welcomeScreen) == null ? void 0 : z.description) || a("welcome_screen_description") })
|
|
2379
2394
|
] })
|
|
2380
2395
|
]
|
|
2381
2396
|
}
|
|
@@ -2390,12 +2405,12 @@ function Mo() {
|
|
|
2390
2405
|
"rounded-3xl"
|
|
2391
2406
|
),
|
|
2392
2407
|
children: [
|
|
2393
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
2408
|
+
/* @__PURE__ */ d("form", { onSubmit: I, className: "space-y-2", children: [
|
|
2394
2409
|
/* @__PURE__ */ r(
|
|
2395
2410
|
ie,
|
|
2396
2411
|
{
|
|
2397
2412
|
value: l,
|
|
2398
|
-
onChange: (
|
|
2413
|
+
onChange: (N) => h(N.target.value),
|
|
2399
2414
|
required: !0,
|
|
2400
2415
|
placeholder: a("your_name_placeholder"),
|
|
2401
2416
|
name: "name"
|
|
@@ -2405,33 +2420,33 @@ function Mo() {
|
|
|
2405
2420
|
ie,
|
|
2406
2421
|
{
|
|
2407
2422
|
required: !0,
|
|
2408
|
-
value:
|
|
2409
|
-
onChange: (
|
|
2423
|
+
value: y,
|
|
2424
|
+
onChange: (N) => w(N.target.value),
|
|
2410
2425
|
type: "email",
|
|
2411
2426
|
placeholder: a("your_email_placeholder"),
|
|
2412
2427
|
name: "email"
|
|
2413
2428
|
}
|
|
2414
2429
|
),
|
|
2415
|
-
m.map((
|
|
2430
|
+
m.map((N) => /* @__PURE__ */ r(
|
|
2416
2431
|
ie,
|
|
2417
2432
|
{
|
|
2418
|
-
value:
|
|
2419
|
-
onChange: (L) =>
|
|
2433
|
+
value: C[N],
|
|
2434
|
+
onChange: (L) => u((ne) => ({
|
|
2420
2435
|
...ne,
|
|
2421
|
-
[
|
|
2436
|
+
[N]: L.target.value
|
|
2422
2437
|
})),
|
|
2423
|
-
placeholder: `${
|
|
2438
|
+
placeholder: `${N} (${a("optional")})`
|
|
2424
2439
|
},
|
|
2425
|
-
|
|
2440
|
+
N
|
|
2426
2441
|
)),
|
|
2427
2442
|
/* @__PURE__ */ d(
|
|
2428
|
-
|
|
2443
|
+
k,
|
|
2429
2444
|
{
|
|
2430
|
-
disabled:
|
|
2445
|
+
disabled: b.loading,
|
|
2431
2446
|
className: "w-full",
|
|
2432
2447
|
size: "lg",
|
|
2433
2448
|
children: [
|
|
2434
|
-
|
|
2449
|
+
b.loading ? a("start_chat_button_loading") : a("start_chat_button"),
|
|
2435
2450
|
/* @__PURE__ */ r(Sr, { className: "size-4 rtl:-scale-100" })
|
|
2436
2451
|
]
|
|
2437
2452
|
}
|
|
@@ -2451,11 +2466,11 @@ function Wt() {
|
|
|
2451
2466
|
const {
|
|
2452
2467
|
routerState: { screen: e }
|
|
2453
2468
|
} = $();
|
|
2454
|
-
return /* @__PURE__ */ r("div", { className: "relative bg-background size-full", children: /* @__PURE__ */ r(
|
|
2469
|
+
return /* @__PURE__ */ r("div", { className: "relative bg-background size-full", children: /* @__PURE__ */ r(_, { mode: "wait", children: (() => {
|
|
2455
2470
|
switch (e) {
|
|
2456
2471
|
case "welcome":
|
|
2457
2472
|
return /* @__PURE__ */ r(
|
|
2458
|
-
|
|
2473
|
+
f,
|
|
2459
2474
|
{
|
|
2460
2475
|
fadeIn: "right",
|
|
2461
2476
|
className: "size-full",
|
|
@@ -2466,7 +2481,7 @@ function Wt() {
|
|
|
2466
2481
|
);
|
|
2467
2482
|
case "sessions":
|
|
2468
2483
|
return /* @__PURE__ */ r(
|
|
2469
|
-
|
|
2484
|
+
f,
|
|
2470
2485
|
{
|
|
2471
2486
|
fadeIn: "right",
|
|
2472
2487
|
className: "size-full",
|
|
@@ -2477,7 +2492,7 @@ function Wt() {
|
|
|
2477
2492
|
);
|
|
2478
2493
|
case "chat":
|
|
2479
2494
|
return /* @__PURE__ */ r(
|
|
2480
|
-
|
|
2495
|
+
f,
|
|
2481
2496
|
{
|
|
2482
2497
|
fadeIn: "right",
|
|
2483
2498
|
className: "size-full",
|
|
@@ -2491,7 +2506,7 @@ function Wt() {
|
|
|
2491
2506
|
}
|
|
2492
2507
|
})() }) });
|
|
2493
2508
|
}
|
|
2494
|
-
const Do = "4.0.
|
|
2509
|
+
const Do = "4.0.27", Ro = `<!DOCTYPE html>
|
|
2495
2510
|
<html>
|
|
2496
2511
|
<head>
|
|
2497
2512
|
<style>
|
|
@@ -2510,7 +2525,7 @@ html, body {
|
|
|
2510
2525
|
</body>
|
|
2511
2526
|
</html>`;
|
|
2512
2527
|
function $t() {
|
|
2513
|
-
const { isOpen: e } = K(), { contentIframeRef: o } = R(), { cssOverrides: t, inline: n } =
|
|
2528
|
+
const { isOpen: e } = K(), { contentIframeRef: o } = R(), { cssOverrides: t, inline: n } = x(), { theme: s, cssVars: i, computed: a } = X(), { dir: c } = U();
|
|
2514
2529
|
return /* @__PURE__ */ r(
|
|
2515
2530
|
Z.div,
|
|
2516
2531
|
{
|
|
@@ -2595,7 +2610,7 @@ function $t() {
|
|
|
2595
2610
|
function jo() {
|
|
2596
2611
|
const { theme: e } = X();
|
|
2597
2612
|
return /* @__PURE__ */ r(
|
|
2598
|
-
|
|
2613
|
+
le.Content,
|
|
2599
2614
|
{
|
|
2600
2615
|
onInteractOutside: (o) => o.preventDefault(),
|
|
2601
2616
|
forceMount: !0,
|
|
@@ -2666,7 +2681,7 @@ html, body {
|
|
|
2666
2681
|
</html>`;
|
|
2667
2682
|
function Po() {
|
|
2668
2683
|
var i, a;
|
|
2669
|
-
const { isOpen: e } = K(), { cssOverrides: o, assets: t } =
|
|
2684
|
+
const { isOpen: e } = K(), { cssOverrides: o, assets: t } = x(), { theme: n, cssVars: s } = X();
|
|
2670
2685
|
return /* @__PURE__ */ d(
|
|
2671
2686
|
xt,
|
|
2672
2687
|
{
|
|
@@ -2700,7 +2715,7 @@ function Po() {
|
|
|
2700
2715
|
justifyContent: "center"
|
|
2701
2716
|
},
|
|
2702
2717
|
children: /* @__PURE__ */ r(
|
|
2703
|
-
|
|
2718
|
+
le.PopoverTrigger,
|
|
2704
2719
|
{
|
|
2705
2720
|
className: p(
|
|
2706
2721
|
"font-sans flex items-center justify-center rounded-full"
|
|
@@ -2721,8 +2736,8 @@ function Po() {
|
|
|
2721
2736
|
"bg-primary",
|
|
2722
2737
|
"text-primary-foreground"
|
|
2723
2738
|
),
|
|
2724
|
-
children: /* @__PURE__ */ r(
|
|
2725
|
-
|
|
2739
|
+
children: /* @__PURE__ */ r(_, { mode: "wait", children: e ? /* @__PURE__ */ r(
|
|
2740
|
+
f,
|
|
2726
2741
|
{
|
|
2727
2742
|
snapExit: !0,
|
|
2728
2743
|
fadeIn: "up",
|
|
@@ -2752,7 +2767,7 @@ function Po() {
|
|
|
2752
2767
|
},
|
|
2753
2768
|
"x-icon"
|
|
2754
2769
|
) : /* @__PURE__ */ r(
|
|
2755
|
-
|
|
2770
|
+
f,
|
|
2756
2771
|
{
|
|
2757
2772
|
snapExit: !0,
|
|
2758
2773
|
overrides: {
|
|
@@ -2793,9 +2808,9 @@ function Po() {
|
|
|
2793
2808
|
);
|
|
2794
2809
|
}
|
|
2795
2810
|
function Ao() {
|
|
2796
|
-
const { dir: e } =
|
|
2811
|
+
const { dir: e } = fe();
|
|
2797
2812
|
return /* @__PURE__ */ r(
|
|
2798
|
-
|
|
2813
|
+
le.Anchor,
|
|
2799
2814
|
{
|
|
2800
2815
|
style: {
|
|
2801
2816
|
position: "fixed",
|
|
@@ -2808,7 +2823,7 @@ function Ao() {
|
|
|
2808
2823
|
}
|
|
2809
2824
|
function Fo() {
|
|
2810
2825
|
const { isOpen: e, setIsOpen: o } = K();
|
|
2811
|
-
return /* @__PURE__ */ d(
|
|
2826
|
+
return /* @__PURE__ */ d(le.Root, { open: e, onOpenChange: o, children: [
|
|
2812
2827
|
/* @__PURE__ */ r(Ao, {}),
|
|
2813
2828
|
/* @__PURE__ */ r(Po, {}),
|
|
2814
2829
|
/* @__PURE__ */ r(jo, {})
|
|
@@ -2825,11 +2840,11 @@ const Ho = [
|
|
|
2825
2840
|
},
|
|
2826
2841
|
{
|
|
2827
2842
|
key: "bot_message",
|
|
2828
|
-
component:
|
|
2843
|
+
component: me
|
|
2829
2844
|
},
|
|
2830
2845
|
{
|
|
2831
2846
|
key: "agent_message",
|
|
2832
|
-
component:
|
|
2847
|
+
component: me
|
|
2833
2848
|
}
|
|
2834
2849
|
], Wo = {
|
|
2835
2850
|
get: async (e) => localStorage.getItem(e),
|