@opencx/widget-react 4.0.50 → 4.0.52
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 +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +319 -317
- package/dist/index.js.map +1 -1
- package/dist/src/WidgetPopoverTrigger.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as he from "@radix-ui/react-popover";
|
|
|
3
3
|
import * as J from "react";
|
|
4
4
|
import L, { memo as Kt, forwardRef as xt, useState as D, cloneElement as vt, createContext as Qt, useEffect as se, useContext as Jt, useRef as B, useCallback as q, useMemo as bt, createElement as lt } from "react";
|
|
5
5
|
import { useWidget as O, useConfig as C, useSessions as U, useMessages as A, useWidgetRouter as H, useDocumentDir as ye, useWidgetTrigger as V, useModes as yt, useCsat as kt, useUploadFiles as er, useIsAwaitingBotReply as Ct, useContact as zt, WidgetProvider as tr, WidgetTriggerProvider as rr } from "@opencx/widget-react-headless";
|
|
6
|
-
import { X as or, ZoomOut as nr, ZoomIn as sr, RotateCcw as ar, FileText as Nt, CircleDashedIcon as ir, XIcon as ke, SquareXIcon as lr, SquareCheckBigIcon as cr, SquareCheckIcon as dr, ShrinkIcon as pr, Minimize2Icon as hr, MinimizeIcon as mr, Maximize2Icon as
|
|
6
|
+
import { X as or, ZoomOut as nr, ZoomIn as sr, RotateCcw as ar, FileText as Nt, CircleDashedIcon as ir, XIcon as ke, SquareXIcon as lr, SquareCheckBigIcon as cr, SquareCheckIcon as dr, ShrinkIcon as pr, Minimize2Icon as hr, MinimizeIcon as mr, Maximize2Icon as gr, MaximizeIcon as ur, ExpandIcon as wr, CircleXIcon as fr, CircleCheckBigIcon as xr, CircleCheckIcon as St, CheckCheckIcon as vr, CheckIcon as br, ChevronLeftIcon as yr, LoaderIcon as kr, ArrowUpIcon as _t, PaperclipIcon as ct, CircleDashed as Cr, AlertCircle as zr, Loader2 as Nr, FileAudio2Icon as Sr, FileVideo2Icon as _r, FileIcon as Ir, UserRoundIcon as Tr, ChevronRightIcon as Mr, SendHorizontal as Dr, ChevronDownIcon as Rr } from "lucide-react";
|
|
7
7
|
import { clsx as jr } from "clsx";
|
|
8
8
|
import { twMerge as Pr } from "tailwind-merge";
|
|
9
9
|
import { motion as re, AnimatePresence as T } from "framer-motion";
|
|
@@ -19,7 +19,7 @@ import * as ae from "@radix-ui/react-tooltip";
|
|
|
19
19
|
import dt from "tinycolor2";
|
|
20
20
|
import { useDropzone as Wr } from "react-dropzone";
|
|
21
21
|
import Lr from "react-use/lib/useAsyncFn";
|
|
22
|
-
import { z as
|
|
22
|
+
import { z as ue } from "zod";
|
|
23
23
|
function w(e) {
|
|
24
24
|
return { "data-component": e };
|
|
25
25
|
}
|
|
@@ -32,35 +32,35 @@ const K = {
|
|
|
32
32
|
}, Y = Kt(
|
|
33
33
|
xt(
|
|
34
34
|
({ children: e, className: o, scale: t = 1.02, off: n = !1 }, s) => {
|
|
35
|
-
const [
|
|
35
|
+
const [i, a] = D(!1), [l, c] = D({ x: 0, y: 0 });
|
|
36
36
|
if (n || /translate/.test(
|
|
37
37
|
e.props.className || ""
|
|
38
38
|
)) return e;
|
|
39
|
-
const
|
|
40
|
-
var M,
|
|
41
|
-
const { clientX: z, clientY: _ } =
|
|
39
|
+
const f = (b) => {
|
|
40
|
+
var M, g;
|
|
41
|
+
const { clientX: z, clientY: _ } = b, v = b.currentTarget.getBoundingClientRect(), R = z - (v.left + v.width / 2), P = _ - (v.top + v.height / 2), E = Math.max(
|
|
42
42
|
-1,
|
|
43
|
-
Math.min(1, R / (
|
|
44
|
-
),
|
|
43
|
+
Math.min(1, R / (v.width / 2))
|
|
44
|
+
), u = Math.max(
|
|
45
45
|
-1,
|
|
46
|
-
Math.min(1, P / (
|
|
47
|
-
), I = E * K.x, j =
|
|
48
|
-
c({ x: I, y: j }), (
|
|
49
|
-
},
|
|
50
|
-
var
|
|
51
|
-
|
|
46
|
+
Math.min(1, P / (v.height / 2))
|
|
47
|
+
), I = E * K.x, j = u * K.y;
|
|
48
|
+
c({ x: I, y: j }), (g = (M = e.props).onMouseMove) == null || g.call(M, b);
|
|
49
|
+
}, x = () => {
|
|
50
|
+
var b, z;
|
|
51
|
+
a(!0), (z = (b = e.props).onMouseEnter) == null || z.call(b);
|
|
52
52
|
}, m = () => {
|
|
53
|
-
var
|
|
54
|
-
|
|
53
|
+
var b, z;
|
|
54
|
+
a(!1), c({ x: 0, y: 0 }), (z = (b = e.props).onMouseLeave) == null || z.call(b);
|
|
55
55
|
}, k = {
|
|
56
|
-
"--wobble-x":
|
|
57
|
-
"--wobble-y":
|
|
56
|
+
"--wobble-x": i ? `${l.x}px` : "0px",
|
|
57
|
+
"--wobble-y": i ? `${l.y}px` : "0px",
|
|
58
58
|
"--scale": 1 - (t - 1)
|
|
59
59
|
};
|
|
60
60
|
return vt(e, {
|
|
61
61
|
ref: s,
|
|
62
|
-
onMouseMove:
|
|
63
|
-
onMouseEnter:
|
|
62
|
+
onMouseMove: f,
|
|
63
|
+
onMouseEnter: x,
|
|
64
64
|
onMouseLeave: m,
|
|
65
65
|
style: {
|
|
66
66
|
...k,
|
|
@@ -100,21 +100,21 @@ const $r = 10, Br = (e, o, t) => ({
|
|
|
100
100
|
left: Yr,
|
|
101
101
|
up: Ur,
|
|
102
102
|
down: Xr
|
|
103
|
-
},
|
|
103
|
+
}, y = xt(
|
|
104
104
|
({
|
|
105
105
|
fadeIn: e = "down",
|
|
106
106
|
distance: o = $r,
|
|
107
107
|
children: t,
|
|
108
108
|
snapExit: n = !1,
|
|
109
109
|
overrides: s = {},
|
|
110
|
-
delay:
|
|
111
|
-
...
|
|
110
|
+
delay: i = 0,
|
|
111
|
+
...a
|
|
112
112
|
}, l) => {
|
|
113
|
-
const c = e ? qr[e](o, s,
|
|
114
|
-
return n && c.exit && typeof c.exit == "object" && !Array.isArray(c.exit) && (c.exit.transition = { duration: 0 }), /* @__PURE__ */ r(re.div, { ref: l, ...
|
|
113
|
+
const c = e ? qr[e](o, s, i) : {};
|
|
114
|
+
return n && c.exit && typeof c.exit == "object" && !Array.isArray(c.exit) && (c.exit.transition = { duration: 0 }), /* @__PURE__ */ r(re.div, { ref: l, ...a, ...c, children: t });
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
|
-
|
|
117
|
+
y.displayName = "MotionDiv";
|
|
118
118
|
const Vr = Or(
|
|
119
119
|
h(
|
|
120
120
|
"inline-flex shrink-0 items-center justify-center gap-2",
|
|
@@ -155,7 +155,7 @@ const Vr = Or(
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
), N = J.forwardRef(
|
|
158
|
-
({ className: e, variant: o = "default", size: t, asChild: n = !1, ...s },
|
|
158
|
+
({ className: e, variant: o = "default", size: t, asChild: n = !1, ...s }, i) => /* @__PURE__ */ r(Y, { ref: i, children: /* @__PURE__ */ r(
|
|
159
159
|
n ? Er : "button",
|
|
160
160
|
{
|
|
161
161
|
...w("ui_lib/btn"),
|
|
@@ -168,9 +168,9 @@ const Vr = Or(
|
|
|
168
168
|
N.displayName = "Button";
|
|
169
169
|
const Dt = Qt(null);
|
|
170
170
|
function Gr({ children: e }) {
|
|
171
|
-
const [o, t] = D(!1), [n, s] = D(null),
|
|
171
|
+
const [o, t] = D(!1), [n, s] = D(null), i = (l) => {
|
|
172
172
|
s(l), t(!0);
|
|
173
|
-
},
|
|
173
|
+
}, a = () => {
|
|
174
174
|
t(!1), setTimeout(() => {
|
|
175
175
|
s(null);
|
|
176
176
|
}, 200);
|
|
@@ -178,7 +178,7 @@ function Gr({ children: e }) {
|
|
|
178
178
|
return /* @__PURE__ */ d(
|
|
179
179
|
Dt.Provider,
|
|
180
180
|
{
|
|
181
|
-
value: { open:
|
|
181
|
+
value: { open: i, close: a, isOpen: o, content: n },
|
|
182
182
|
children: [
|
|
183
183
|
/* @__PURE__ */ r(Zr, {}),
|
|
184
184
|
e
|
|
@@ -200,11 +200,11 @@ function me() {
|
|
|
200
200
|
function Zr() {
|
|
201
201
|
const { contentIframeRef: e } = O(), { isOpen: o, content: t, close: n } = me();
|
|
202
202
|
return se(() => {
|
|
203
|
-
var
|
|
203
|
+
var i, a;
|
|
204
204
|
const s = (l) => {
|
|
205
205
|
l.key === "Escape" && n();
|
|
206
206
|
};
|
|
207
|
-
return (
|
|
207
|
+
return (a = (i = e == null ? void 0 : e.current) == null ? void 0 : i.contentWindow) == null || a.document.addEventListener(
|
|
208
208
|
"keydown",
|
|
209
209
|
s
|
|
210
210
|
), () => {
|
|
@@ -215,7 +215,7 @@ function Zr() {
|
|
|
215
215
|
);
|
|
216
216
|
};
|
|
217
217
|
}, []), /* @__PURE__ */ r(T, { mode: "wait", children: o && t && /* @__PURE__ */ r(
|
|
218
|
-
|
|
218
|
+
y,
|
|
219
219
|
{
|
|
220
220
|
overrides: {
|
|
221
221
|
initial: { y: 0 },
|
|
@@ -321,9 +321,9 @@ function ze({
|
|
|
321
321
|
const pt = 1, ht = 5, le = 0.5, Kr = 2.5;
|
|
322
322
|
function Qr(e, o, t, n) {
|
|
323
323
|
if (!t || !n || o <= 1) return { x: 0, y: 0 };
|
|
324
|
-
const s = t.getBoundingClientRect(),
|
|
324
|
+
const s = t.getBoundingClientRect(), i = n.offsetWidth, a = n.offsetHeight, l = Math.max(0, (i * o - s.width) / (2 * o)), c = Math.max(
|
|
325
325
|
0,
|
|
326
|
-
(
|
|
326
|
+
(a * o - s.height) / (2 * o)
|
|
327
327
|
);
|
|
328
328
|
return {
|
|
329
329
|
x: Math.min(l, Math.max(-l, e.x)),
|
|
@@ -334,73 +334,73 @@ function At({
|
|
|
334
334
|
src: e,
|
|
335
335
|
alt: o
|
|
336
336
|
}) {
|
|
337
|
-
const [t, n] = D(1), [s,
|
|
338
|
-
n(1),
|
|
337
|
+
const [t, n] = D(1), [s, i] = D({ x: 0, y: 0 }), [a, l] = D(!1), c = B({ x: 0, y: 0 }), p = B({ x: 0, y: 0 }), f = B(null), x = B(null), m = B(!1), k = (u) => Math.min(ht, Math.max(pt, u)), b = q(() => {
|
|
338
|
+
n(1), i({ x: 0, y: 0 });
|
|
339
339
|
}, []), z = q(() => {
|
|
340
|
-
n((
|
|
340
|
+
n((u) => k(u + le));
|
|
341
341
|
}, []), _ = q(() => {
|
|
342
|
-
n((
|
|
343
|
-
const I = k(
|
|
344
|
-
return I <= 1 &&
|
|
342
|
+
n((u) => {
|
|
343
|
+
const I = k(u - le);
|
|
344
|
+
return I <= 1 && i({ x: 0, y: 0 }), I;
|
|
345
345
|
});
|
|
346
346
|
}, []);
|
|
347
|
-
q((
|
|
348
|
-
|
|
349
|
-
const I =
|
|
347
|
+
q((u) => {
|
|
348
|
+
u.preventDefault(), u.stopPropagation();
|
|
349
|
+
const I = u.deltaY > 0 ? -le : le;
|
|
350
350
|
n((j) => {
|
|
351
351
|
const M = k(j + I);
|
|
352
|
-
return M <= 1 &&
|
|
352
|
+
return M <= 1 && i({ x: 0, y: 0 }), M;
|
|
353
353
|
});
|
|
354
354
|
}, []);
|
|
355
|
-
const
|
|
356
|
-
(
|
|
357
|
-
|
|
355
|
+
const v = q(
|
|
356
|
+
(u) => {
|
|
357
|
+
u.preventDefault(), m.current = !1, l(!0), c.current = { x: u.clientX, y: u.clientY }, p.current = { ...s }, u.target.setPointerCapture(u.pointerId);
|
|
358
358
|
},
|
|
359
359
|
[s]
|
|
360
360
|
), R = q(
|
|
361
|
-
(
|
|
362
|
-
if (!
|
|
363
|
-
const I =
|
|
361
|
+
(u) => {
|
|
362
|
+
if (!a) return;
|
|
363
|
+
const I = u.clientX - c.current.x, j = u.clientY - c.current.y;
|
|
364
364
|
if ((Math.abs(I) > 3 || Math.abs(j) > 3) && (m.current = !0), t <= 1) return;
|
|
365
365
|
const M = {
|
|
366
366
|
x: p.current.x + I / t,
|
|
367
367
|
y: p.current.y + j / t
|
|
368
368
|
};
|
|
369
|
-
|
|
370
|
-
Qr(M, t,
|
|
369
|
+
i(
|
|
370
|
+
Qr(M, t, f.current, x.current)
|
|
371
371
|
);
|
|
372
372
|
},
|
|
373
|
-
[
|
|
373
|
+
[a, t]
|
|
374
374
|
), P = q(() => {
|
|
375
|
-
const
|
|
376
|
-
l(!1), !
|
|
375
|
+
const u = m.current;
|
|
376
|
+
l(!1), !u && n((I) => I > 1 ? (i({ x: 0, y: 0 }), 1) : Kr);
|
|
377
377
|
}, []), E = t > 1;
|
|
378
378
|
return /* @__PURE__ */ d(
|
|
379
379
|
"div",
|
|
380
380
|
{
|
|
381
381
|
className: "relative size-full flex items-center justify-center select-none",
|
|
382
|
-
onClick: (
|
|
382
|
+
onClick: (u) => u.stopPropagation(),
|
|
383
383
|
children: [
|
|
384
384
|
/* @__PURE__ */ r(
|
|
385
385
|
"div",
|
|
386
386
|
{
|
|
387
|
-
ref:
|
|
387
|
+
ref: f,
|
|
388
388
|
className: h(
|
|
389
389
|
"overflow-hidden max-h-full max-w-full rounded-2xl flex items-center justify-center",
|
|
390
390
|
E && "size-full"
|
|
391
391
|
),
|
|
392
|
-
onPointerDown:
|
|
392
|
+
onPointerDown: v,
|
|
393
393
|
onPointerMove: R,
|
|
394
394
|
onPointerUp: P,
|
|
395
395
|
onPointerCancel: P,
|
|
396
396
|
style: {
|
|
397
|
-
cursor:
|
|
397
|
+
cursor: a ? "grabbing" : E ? "grab" : "zoom-in",
|
|
398
398
|
touchAction: "none"
|
|
399
399
|
},
|
|
400
400
|
children: /* @__PURE__ */ r(
|
|
401
401
|
"img",
|
|
402
402
|
{
|
|
403
|
-
ref:
|
|
403
|
+
ref: x,
|
|
404
404
|
src: e,
|
|
405
405
|
alt: o,
|
|
406
406
|
className: "block max-w-full object-contain pointer-events-none",
|
|
@@ -424,7 +424,7 @@ function At({
|
|
|
424
424
|
/* @__PURE__ */ r(we, { onClick: z, label: "Zoom in", disabled: t >= ht, children: /* @__PURE__ */ r(sr, { className: "size-3.5" }) }),
|
|
425
425
|
E && /* @__PURE__ */ d(Q, { children: [
|
|
426
426
|
/* @__PURE__ */ r("div", { className: "w-px h-4 bg-white/30 mx-0.5" }),
|
|
427
|
-
/* @__PURE__ */ r(we, { onClick:
|
|
427
|
+
/* @__PURE__ */ r(we, { onClick: b, label: "Reset zoom", children: /* @__PURE__ */ r(ar, { className: "size-3.5" }) })
|
|
428
428
|
] })
|
|
429
429
|
] })
|
|
430
430
|
]
|
|
@@ -449,14 +449,14 @@ function we({
|
|
|
449
449
|
);
|
|
450
450
|
}
|
|
451
451
|
function Ft({ attachment: e }) {
|
|
452
|
-
const { name: o, size: t, type: n, url: s } = e,
|
|
452
|
+
const { name: o, size: t, type: n, url: s } = e, i = n.startsWith("image/"), a = n.startsWith("video/"), l = n.startsWith("audio/"), c = n === "application/pdf";
|
|
453
453
|
return l ? /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ r("div", { className: "w-full shrink-0 overflow-hidden", children: /* @__PURE__ */ d("audio", { controls: !0, className: "w-full", children: [
|
|
454
454
|
/* @__PURE__ */ r("source", { src: s, type: n }),
|
|
455
455
|
"Your browser does not support the audio tag."
|
|
456
|
-
] }) }) }) :
|
|
456
|
+
] }) }) }) : a ? /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ r("div", { className: "w-full border shrink-0 rounded-2xl overflow-hidden", children: /* @__PURE__ */ d("video", { controls: !0, children: [
|
|
457
457
|
/* @__PURE__ */ r("source", { src: s, type: n }),
|
|
458
458
|
"Your browser does not support the video tag."
|
|
459
|
-
] }) }) }) :
|
|
459
|
+
] }) }) }) : i ? /* @__PURE__ */ r(
|
|
460
460
|
ze,
|
|
461
461
|
{
|
|
462
462
|
trigger: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ r("div", { className: "size-fit border shrink-0 rounded-2xl overflow-hidden", children: /* @__PURE__ */ r("img", { src: s, className: "object-cover size-16", alt: o }) }) }) }),
|
|
@@ -550,16 +550,16 @@ function Ne({
|
|
|
550
550
|
remarkPlugins: [It],
|
|
551
551
|
rehypePlugins: [Tt],
|
|
552
552
|
components: {
|
|
553
|
-
a: ({ children: s, ...
|
|
554
|
-
img: ({ src: s, alt:
|
|
553
|
+
a: ({ children: s, ...i }) => /* @__PURE__ */ r("a", { target: i.target || n || "_top", ...i, children: s }),
|
|
554
|
+
img: ({ src: s, alt: i, ...a }) => s ? /* @__PURE__ */ r(
|
|
555
555
|
ze,
|
|
556
556
|
{
|
|
557
557
|
trigger: /* @__PURE__ */ r(
|
|
558
558
|
"img",
|
|
559
559
|
{
|
|
560
560
|
src: s,
|
|
561
|
-
alt:
|
|
562
|
-
...
|
|
561
|
+
alt: i,
|
|
562
|
+
...a,
|
|
563
563
|
className: "cursor-pointer rounded-xl"
|
|
564
564
|
}
|
|
565
565
|
),
|
|
@@ -568,11 +568,11 @@ function Ne({
|
|
|
568
568
|
{
|
|
569
569
|
className: "size-full max-w-full rounded-3xl flex items-center justify-center bg-transparent border-none gap-0",
|
|
570
570
|
withClose: !0,
|
|
571
|
-
children: /* @__PURE__ */ r(At, { src: s, alt:
|
|
571
|
+
children: /* @__PURE__ */ r(At, { src: s, alt: i })
|
|
572
572
|
}
|
|
573
573
|
)
|
|
574
574
|
}
|
|
575
|
-
) : /* @__PURE__ */ r("img", { src: s, alt:
|
|
575
|
+
) : /* @__PURE__ */ r("img", { src: s, alt: i, ...a })
|
|
576
576
|
},
|
|
577
577
|
children: e
|
|
578
578
|
}
|
|
@@ -610,14 +610,14 @@ function fe(e) {
|
|
|
610
610
|
id: t,
|
|
611
611
|
type: n,
|
|
612
612
|
attachments: s,
|
|
613
|
-
isFirstInGroup:
|
|
614
|
-
isLastInGroup:
|
|
613
|
+
isFirstInGroup: i,
|
|
614
|
+
isLastInGroup: a,
|
|
615
615
|
isAloneInGroup: l,
|
|
616
616
|
dataComponentNames: c,
|
|
617
617
|
classNames: p
|
|
618
618
|
} = e;
|
|
619
619
|
if (n !== "AI" && n !== "AGENT") return null;
|
|
620
|
-
const { message:
|
|
620
|
+
const { message: f, variant: x = "default" } = o;
|
|
621
621
|
return /* @__PURE__ */ d(
|
|
622
622
|
"div",
|
|
623
623
|
{
|
|
@@ -628,15 +628,15 @@ function fe(e) {
|
|
|
628
628
|
),
|
|
629
629
|
children: [
|
|
630
630
|
s && s.length > 0 && /* @__PURE__ */ r("div", { className: "w-full gap-1 flex flex-row flex-wrap items-center justify-start", children: s == null ? void 0 : s.map((m) => /* @__PURE__ */ r(Ft, { attachment: m }, m.id)) }),
|
|
631
|
-
|
|
631
|
+
f.length > 0 && /* @__PURE__ */ d("div", { className: "flex flex-row gap-2", children: [
|
|
632
632
|
/* @__PURE__ */ r(
|
|
633
633
|
"div",
|
|
634
634
|
{
|
|
635
635
|
...w((c == null ? void 0 : c.message) ?? "chat/agent_msg/msg"),
|
|
636
|
-
"data-first":
|
|
637
|
-
"data-last":
|
|
636
|
+
"data-first": i,
|
|
637
|
+
"data-last": a,
|
|
638
638
|
"data-alone": l,
|
|
639
|
-
"data-variant":
|
|
639
|
+
"data-variant": x,
|
|
640
640
|
className: h(
|
|
641
641
|
"transition-all",
|
|
642
642
|
"w-fit py-3 px-4 rounded-3xl bg-secondary text-secondary-foreground",
|
|
@@ -645,14 +645,14 @@ function fe(e) {
|
|
|
645
645
|
// `[word-break:break-word]` is deprecated but works in the browser, while `break-words` which is `[overflow-wrap: break-word]` does not work
|
|
646
646
|
// No need to add "whitespace-pre-wrap" in the agent or bot message because it is markup and content appear on separate lines as expected
|
|
647
647
|
// Adding "whitespace-pre-wrap" will result in unnecessarily huge line breaks
|
|
648
|
-
|
|
648
|
+
x === "error" && "bg-destructive/15 text-destructive",
|
|
649
649
|
// We're using the booleans directly here, not the data attributes, to make any external styling more specific than this
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
!
|
|
650
|
+
i && !l && "rounded-bl-md",
|
|
651
|
+
a && !l && "rounded-tl-md",
|
|
652
|
+
!i && !a && !l && "rounded-l-md",
|
|
653
653
|
p == null ? void 0 : p.message
|
|
654
654
|
),
|
|
655
|
-
children: /* @__PURE__ */ r(Ne, { messageType: n, messageId: t, children:
|
|
655
|
+
children: /* @__PURE__ */ r(Ne, { messageType: n, messageId: t, children: f })
|
|
656
656
|
}
|
|
657
657
|
),
|
|
658
658
|
/* @__PURE__ */ r(Jr, { currentMessage: e })
|
|
@@ -710,7 +710,7 @@ function xe({
|
|
|
710
710
|
}
|
|
711
711
|
function to({ agent: e }) {
|
|
712
712
|
return /* @__PURE__ */ r(T, { children: /* @__PURE__ */ d(
|
|
713
|
-
|
|
713
|
+
y,
|
|
714
714
|
{
|
|
715
715
|
...w("chat/bot_loading/root"),
|
|
716
716
|
className: "flex flex-row items-end w-full gap-2 animate-pulse",
|
|
@@ -786,17 +786,17 @@ const ce = {
|
|
|
786
786
|
transitionDuration: "1000ms"
|
|
787
787
|
};
|
|
788
788
|
function G() {
|
|
789
|
-
var
|
|
790
|
-
const { dir: e } = ye(), { isSmallScreen: o } = $(), { theme: t, inline: n } = C(), s = (X) => n ? "100%" : X,
|
|
791
|
-
zIndex: ((
|
|
789
|
+
var x, m, k, b, z, _, v, R, P, E, u, I, j, M, g, S, ie, Re, je, Pe, Ee, Oe, Ae, Fe, He, We, Le, $e, Be, Ye, Ue, Xe, qe, Ve, Ge, Ze, Ke, Qe, Je, et, tt, rt, ot, nt, st, at, it;
|
|
790
|
+
const { dir: e } = ye(), { isSmallScreen: o } = $(), { theme: t, inline: n } = C(), s = (X) => n ? "100%" : X, i = (X, ge) => o ? `100dv${X}` : ge, a = (X, ge) => s(i(X, ge)), l = {
|
|
791
|
+
zIndex: ((x = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : x.zIndex) ?? 1e7,
|
|
792
792
|
offset: {
|
|
793
793
|
bottom: ((k = (m = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : m.offset) == null ? void 0 : k.bottom) ?? 20,
|
|
794
|
-
right: ((z = (
|
|
795
|
-
left: ((
|
|
794
|
+
right: ((z = (b = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : b.offset) == null ? void 0 : z.right) ?? (e === "ltr" ? 20 : "initial"),
|
|
795
|
+
left: ((v = (_ = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : _.offset) == null ? void 0 : v.left) ?? (e === "rtl" ? 20 : "initial")
|
|
796
796
|
},
|
|
797
797
|
size: {
|
|
798
798
|
button: ((P = (R = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : R.size) == null ? void 0 : P.button) ?? 48,
|
|
799
|
-
icon: ((
|
|
799
|
+
icon: ((u = (E = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : E.size) == null ? void 0 : u.icon) ?? 24
|
|
800
800
|
}
|
|
801
801
|
}, c = (() => {
|
|
802
802
|
const X = e === "ltr" ? l.offset.right : l.offset.left;
|
|
@@ -810,7 +810,7 @@ function G() {
|
|
|
810
810
|
zIndex: ((j = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : j.zIndex) ?? l.zIndex + 1,
|
|
811
811
|
outline: ((M = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : M.outline) ?? "none",
|
|
812
812
|
// was: '1px solid'
|
|
813
|
-
outlineColor: ((
|
|
813
|
+
outlineColor: ((g = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : g.outlineColor) ?? "hsl(0 0% 50% / .5)",
|
|
814
814
|
boxShadow: ((S = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : S.boxShadow) ?? "0 0px 100px 0px rgb(0 0 0 / 0.25)",
|
|
815
815
|
transitionProperty: ((ie = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : ie.transitionProperty) ?? "all",
|
|
816
816
|
transitionTimingFunction: ((Re = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : Re.transitionTimingFunction) ?? ce.transitionTimingFunction,
|
|
@@ -822,26 +822,26 @@ function G() {
|
|
|
822
822
|
},
|
|
823
823
|
screens: {
|
|
824
824
|
welcome: {
|
|
825
|
-
width:
|
|
825
|
+
width: a("w", ((He = (Fe = t == null ? void 0 : t.screens) == null ? void 0 : Fe.welcome) == null ? void 0 : He.width) ?? "400px"),
|
|
826
826
|
// By setting minHeight to 1px, a nice animation will play from 1px to the dynamic height of the content of the screen
|
|
827
|
-
minHeight:
|
|
827
|
+
minHeight: a(
|
|
828
828
|
"h",
|
|
829
829
|
((Le = (We = t == null ? void 0 : t.screens) == null ? void 0 : We.welcome) == null ? void 0 : Le.minHeight) ?? "1px"
|
|
830
830
|
)
|
|
831
831
|
},
|
|
832
832
|
sessions: {
|
|
833
|
-
width:
|
|
834
|
-
height:
|
|
833
|
+
width: a("w", ((Be = ($e = t == null ? void 0 : t.screens) == null ? void 0 : $e.sessions) == null ? void 0 : Be.width) ?? "450px"),
|
|
834
|
+
height: a("h", ((Ue = (Ye = t == null ? void 0 : t.screens) == null ? void 0 : Ye.sessions) == null ? void 0 : Ue.height) ?? "600px")
|
|
835
835
|
},
|
|
836
836
|
chat: {
|
|
837
|
-
width:
|
|
838
|
-
height:
|
|
837
|
+
width: a("w", ((qe = (Xe = t == null ? void 0 : t.screens) == null ? void 0 : Xe.chat) == null ? void 0 : qe.width) ?? "525px"),
|
|
838
|
+
height: a("h", ((Ge = (Ve = t == null ? void 0 : t.screens) == null ? void 0 : Ve.chat) == null ? void 0 : Ge.height) ?? "700px"),
|
|
839
839
|
withCanvas: {
|
|
840
|
-
width:
|
|
840
|
+
width: a(
|
|
841
841
|
"w",
|
|
842
842
|
((Qe = (Ke = (Ze = t == null ? void 0 : t.screens) == null ? void 0 : Ze.chat) == null ? void 0 : Ke.withCanvas) == null ? void 0 : Qe.width) ?? "min(1050px, 100vw)"
|
|
843
843
|
),
|
|
844
|
-
height:
|
|
844
|
+
height: a(
|
|
845
845
|
"h",
|
|
846
846
|
((tt = (et = (Je = t == null ? void 0 : t.screens) == null ? void 0 : Je.chat) == null ? void 0 : et.withCanvas) == null ? void 0 : tt.height) ?? "min(800px, 100vh)"
|
|
847
847
|
),
|
|
@@ -850,11 +850,11 @@ function G() {
|
|
|
850
850
|
}
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
|
-
},
|
|
853
|
+
}, f = {
|
|
854
854
|
// Subtract the offset.bottom twice so that it adds a bit of padding to the top
|
|
855
855
|
// Subtract the distance between the trigger and the widget content container
|
|
856
856
|
// Subtract the invisible padding of the trigger (for the wobble effect)
|
|
857
|
-
maxHeight:
|
|
857
|
+
maxHeight: a(
|
|
858
858
|
"h",
|
|
859
859
|
`calc(
|
|
860
860
|
100vh
|
|
@@ -864,14 +864,14 @@ function G() {
|
|
|
864
864
|
)`
|
|
865
865
|
),
|
|
866
866
|
// Subtract the offset.right twice so that it adds a bit of padding to the left
|
|
867
|
-
maxWidth:
|
|
867
|
+
maxWidth: a(
|
|
868
868
|
"w",
|
|
869
869
|
`calc(
|
|
870
870
|
100vw
|
|
871
871
|
- ${c * 2}px
|
|
872
872
|
)`
|
|
873
873
|
),
|
|
874
|
-
minHeight:
|
|
874
|
+
minHeight: a(
|
|
875
875
|
"h",
|
|
876
876
|
`min(
|
|
877
877
|
${p.screens.welcome.minHeight},
|
|
@@ -879,7 +879,7 @@ function G() {
|
|
|
879
879
|
${p.screens.chat.height}
|
|
880
880
|
)`
|
|
881
881
|
),
|
|
882
|
-
minWidth:
|
|
882
|
+
minWidth: a(
|
|
883
883
|
"w",
|
|
884
884
|
`min(
|
|
885
885
|
${p.screens.welcome.width},
|
|
@@ -890,7 +890,7 @@ function G() {
|
|
|
890
890
|
};
|
|
891
891
|
return {
|
|
892
892
|
theme: p,
|
|
893
|
-
computed:
|
|
893
|
+
computed: f,
|
|
894
894
|
cssVars: so({
|
|
895
895
|
palette: p.palette,
|
|
896
896
|
primary: p.primaryColor
|
|
@@ -1011,7 +1011,7 @@ function Te({
|
|
|
1011
1011
|
e && n(e), o && s(o);
|
|
1012
1012
|
}, [t, o, e, n, s]);
|
|
1013
1013
|
}
|
|
1014
|
-
const
|
|
1014
|
+
const gt = ir;
|
|
1015
1015
|
function ne({
|
|
1016
1016
|
name: e,
|
|
1017
1017
|
className: o
|
|
@@ -1031,9 +1031,9 @@ function ne({
|
|
|
1031
1031
|
case "Expand":
|
|
1032
1032
|
return wr;
|
|
1033
1033
|
case "Maximize":
|
|
1034
|
-
return gr;
|
|
1035
|
-
case "Maximize2":
|
|
1036
1034
|
return ur;
|
|
1035
|
+
case "Maximize2":
|
|
1036
|
+
return gr;
|
|
1037
1037
|
case "Minimize":
|
|
1038
1038
|
return mr;
|
|
1039
1039
|
case "Minimize2":
|
|
@@ -1049,9 +1049,9 @@ function ne({
|
|
|
1049
1049
|
case "X":
|
|
1050
1050
|
return ke;
|
|
1051
1051
|
case void 0:
|
|
1052
|
-
return
|
|
1052
|
+
return gt;
|
|
1053
1053
|
default:
|
|
1054
|
-
return F(e, ne.name),
|
|
1054
|
+
return F(e, ne.name), gt;
|
|
1055
1055
|
}
|
|
1056
1056
|
})();
|
|
1057
1057
|
return /* @__PURE__ */ r(t, { className: h("size-4", o) });
|
|
@@ -1073,12 +1073,12 @@ function Me() {
|
|
|
1073
1073
|
routerState: { screen: o }
|
|
1074
1074
|
} = H(), { textContent: t } = C();
|
|
1075
1075
|
return (() => {
|
|
1076
|
-
var s,
|
|
1076
|
+
var s, i;
|
|
1077
1077
|
switch (o) {
|
|
1078
1078
|
case "chat":
|
|
1079
1079
|
return (s = t == null ? void 0 : t.chatScreen) == null ? void 0 : s.headerTitle;
|
|
1080
1080
|
case "sessions":
|
|
1081
|
-
return (
|
|
1081
|
+
return (i = t == null ? void 0 : t.sessionsScreen) == null ? void 0 : i.headerTitle;
|
|
1082
1082
|
case "welcome":
|
|
1083
1083
|
return;
|
|
1084
1084
|
default:
|
|
@@ -1139,30 +1139,30 @@ function ve({
|
|
|
1139
1139
|
}) {
|
|
1140
1140
|
const [o, t] = D(!1), {
|
|
1141
1141
|
routerState: { screen: n }
|
|
1142
|
-
} = H(), { isSmallScreen: s } = $(), { theme:
|
|
1142
|
+
} = H(), { isSmallScreen: s } = $(), { theme: i } = G(), { setWidth: a, setHeight: l } = Bt();
|
|
1143
1143
|
if (n !== "chat" && n !== "sessions") return null;
|
|
1144
1144
|
const c = (() => {
|
|
1145
1145
|
switch (n) {
|
|
1146
1146
|
case "chat":
|
|
1147
|
-
return
|
|
1147
|
+
return i.screens.chat.height;
|
|
1148
1148
|
case "sessions":
|
|
1149
|
-
return
|
|
1149
|
+
return i.screens.sessions.height;
|
|
1150
1150
|
default:
|
|
1151
|
-
return F(n, ve.name),
|
|
1151
|
+
return F(n, ve.name), i.screens.chat.height;
|
|
1152
1152
|
}
|
|
1153
1153
|
})(), p = (() => {
|
|
1154
1154
|
switch (n) {
|
|
1155
1155
|
case "chat":
|
|
1156
|
-
return
|
|
1156
|
+
return i.screens.chat.width;
|
|
1157
1157
|
case "sessions":
|
|
1158
|
-
return
|
|
1158
|
+
return i.screens.sessions.width;
|
|
1159
1159
|
default:
|
|
1160
|
-
return F(n, ve.name),
|
|
1160
|
+
return F(n, ve.name), i.screens.chat.width;
|
|
1161
1161
|
}
|
|
1162
|
-
})(),
|
|
1163
|
-
t((
|
|
1164
|
-
const m = !
|
|
1165
|
-
return l(m ? "100vh" : c),
|
|
1162
|
+
})(), f = () => {
|
|
1163
|
+
t((x) => {
|
|
1164
|
+
const m = !x;
|
|
1165
|
+
return l(m ? "100vh" : c), a(m ? `max(40vw, ${p})` : p), m;
|
|
1166
1166
|
});
|
|
1167
1167
|
};
|
|
1168
1168
|
return s && e.hideOnSmallScreen || !s && e.hideOnLargeScreen ? null : /* @__PURE__ */ r(
|
|
@@ -1171,7 +1171,7 @@ function ve({
|
|
|
1171
1171
|
variant: "ghost",
|
|
1172
1172
|
size: "fit",
|
|
1173
1173
|
className: "rounded-full",
|
|
1174
|
-
onClick:
|
|
1174
|
+
onClick: f,
|
|
1175
1175
|
children: /* @__PURE__ */ r(
|
|
1176
1176
|
ne,
|
|
1177
1177
|
{
|
|
@@ -1185,9 +1185,9 @@ function Yt({
|
|
|
1185
1185
|
button: e
|
|
1186
1186
|
}) {
|
|
1187
1187
|
var z, _;
|
|
1188
|
-
const { close: o } = me(), { widgetCtx: t } = O(), { setIsOpen: n } = V(), { resolveSession: s, sessionState:
|
|
1189
|
-
const { success:
|
|
1190
|
-
if (o(), !
|
|
1188
|
+
const { close: o } = me(), { widgetCtx: t } = O(), { setIsOpen: n } = V(), { resolveSession: s, sessionState: i } = U(), { isSmallScreen: a } = $(), l = !i.session, c = ((z = i.session) == null ? void 0 : z.isOpened) === !1, p = e.onResolved || "stay-in-chat", f = e.behaviorBeforeSessionCreation || "disabled", x = e.behaviorIfSessionIsResolved || "disabled", m = !!(i.isResolvingSession || l && f === "disabled" || c && x === "disabled"), k = async () => {
|
|
1189
|
+
const { success: v, error: R } = await s();
|
|
1190
|
+
if (o(), !v) return console.error(R);
|
|
1191
1191
|
switch (p) {
|
|
1192
1192
|
case "stay-in-chat":
|
|
1193
1193
|
return;
|
|
@@ -1204,9 +1204,9 @@ function Yt({
|
|
|
1204
1204
|
F(p, Yt.name);
|
|
1205
1205
|
break;
|
|
1206
1206
|
}
|
|
1207
|
-
},
|
|
1207
|
+
}, b = () => {
|
|
1208
1208
|
if (l)
|
|
1209
|
-
switch (
|
|
1209
|
+
switch (f) {
|
|
1210
1210
|
case "disabled":
|
|
1211
1211
|
return;
|
|
1212
1212
|
case "close-widget":
|
|
@@ -1214,12 +1214,12 @@ function Yt({
|
|
|
1214
1214
|
break;
|
|
1215
1215
|
default:
|
|
1216
1216
|
F(
|
|
1217
|
-
|
|
1218
|
-
|
|
1217
|
+
f,
|
|
1218
|
+
b.name
|
|
1219
1219
|
);
|
|
1220
1220
|
}
|
|
1221
1221
|
if (c)
|
|
1222
|
-
switch (
|
|
1222
|
+
switch (x) {
|
|
1223
1223
|
case "disabled":
|
|
1224
1224
|
return;
|
|
1225
1225
|
case "close-widget":
|
|
@@ -1235,12 +1235,12 @@ function Yt({
|
|
|
1235
1235
|
break;
|
|
1236
1236
|
default:
|
|
1237
1237
|
F(
|
|
1238
|
-
|
|
1239
|
-
|
|
1238
|
+
x,
|
|
1239
|
+
b.name
|
|
1240
1240
|
);
|
|
1241
1241
|
}
|
|
1242
1242
|
};
|
|
1243
|
-
return
|
|
1243
|
+
return a && e.hideOnSmallScreen || !a && e.hideOnLargeScreen ? null : ((_ = e.confirmation) == null ? void 0 : _.type) === "modal" && !c && !l ? /* @__PURE__ */ r(
|
|
1244
1244
|
ze,
|
|
1245
1245
|
{
|
|
1246
1246
|
trigger: /* @__PURE__ */ r(
|
|
@@ -1262,7 +1262,7 @@ function Yt({
|
|
|
1262
1262
|
{
|
|
1263
1263
|
variant: "secondary",
|
|
1264
1264
|
onClick: o,
|
|
1265
|
-
disabled:
|
|
1265
|
+
disabled: i.isResolvingSession,
|
|
1266
1266
|
children: e.confirmation.cancelButtonText || "No"
|
|
1267
1267
|
}
|
|
1268
1268
|
),
|
|
@@ -1271,7 +1271,7 @@ function Yt({
|
|
|
1271
1271
|
{
|
|
1272
1272
|
variant: "destructive",
|
|
1273
1273
|
onClick: k,
|
|
1274
|
-
disabled:
|
|
1274
|
+
disabled: i.isResolvingSession,
|
|
1275
1275
|
children: e.confirmation.confirmButtonText || "Yes"
|
|
1276
1276
|
}
|
|
1277
1277
|
)
|
|
@@ -1284,7 +1284,7 @@ function Yt({
|
|
|
1284
1284
|
variant: "ghost",
|
|
1285
1285
|
size: "fit",
|
|
1286
1286
|
className: "rounded-full",
|
|
1287
|
-
onClick: c || l ?
|
|
1287
|
+
onClick: c || l ? b : k,
|
|
1288
1288
|
disabled: m,
|
|
1289
1289
|
children: /* @__PURE__ */ r(ne, { name: e.icon })
|
|
1290
1290
|
}
|
|
@@ -1349,7 +1349,7 @@ function Ut() {
|
|
|
1349
1349
|
function Xt({ className: e }) {
|
|
1350
1350
|
return /* @__PURE__ */ r(kr, { className: h("size-4 animate-spin", e) });
|
|
1351
1351
|
}
|
|
1352
|
-
function
|
|
1352
|
+
function go() {
|
|
1353
1353
|
const {
|
|
1354
1354
|
messagesState: { isInitialFetchLoading: e }
|
|
1355
1355
|
} = A(), { isSmallScreen: o } = $(), { activeMode: t, Component: n } = yt();
|
|
@@ -1357,14 +1357,14 @@ function uo() {
|
|
|
1357
1357
|
isCanvasOpen: !e && !o && !!t && !!n
|
|
1358
1358
|
};
|
|
1359
1359
|
}
|
|
1360
|
-
function
|
|
1361
|
-
const e = te(), { activeMode: o, Component: t } = yt(), { sendMessage: n } = A(), { createStateCheckpoint: s } = U(), [
|
|
1360
|
+
function uo() {
|
|
1361
|
+
const e = te(), { activeMode: o, Component: t } = yt(), { sendMessage: n } = A(), { createStateCheckpoint: s } = U(), [i, a] = D(!1), l = async (c) => {
|
|
1362
1362
|
try {
|
|
1363
|
-
|
|
1363
|
+
a(!0), await n(c);
|
|
1364
1364
|
} catch (p) {
|
|
1365
1365
|
console.error(p);
|
|
1366
1366
|
} finally {
|
|
1367
|
-
|
|
1367
|
+
a(!1);
|
|
1368
1368
|
}
|
|
1369
1369
|
};
|
|
1370
1370
|
return !o || !t ? null : /* @__PURE__ */ r(
|
|
@@ -1374,7 +1374,7 @@ function go() {
|
|
|
1374
1374
|
mode: o,
|
|
1375
1375
|
createStateCheckpoint: s,
|
|
1376
1376
|
sendMessage: l,
|
|
1377
|
-
isSendingMessage:
|
|
1377
|
+
isSendingMessage: i
|
|
1378
1378
|
}
|
|
1379
1379
|
);
|
|
1380
1380
|
}
|
|
@@ -1382,7 +1382,7 @@ const W = L.forwardRef(
|
|
|
1382
1382
|
(e, o) => {
|
|
1383
1383
|
var t, n, s;
|
|
1384
1384
|
return /* @__PURE__ */ r(
|
|
1385
|
-
|
|
1385
|
+
y,
|
|
1386
1386
|
{
|
|
1387
1387
|
...e,
|
|
1388
1388
|
ref: o,
|
|
@@ -1430,17 +1430,17 @@ function fo() {
|
|
|
1430
1430
|
isCsatRequested: t,
|
|
1431
1431
|
isCsatSubmitted: n,
|
|
1432
1432
|
submittedScore: s,
|
|
1433
|
-
submittedFeedback:
|
|
1434
|
-
} = kt(), [
|
|
1433
|
+
submittedFeedback: i
|
|
1434
|
+
} = kt(), [a, l] = D(null), [c, p] = D(null), f = (m) => {
|
|
1435
1435
|
l((k) => k === m ? null : m);
|
|
1436
|
-
},
|
|
1437
|
-
|
|
1438
|
-
score:
|
|
1436
|
+
}, x = () => {
|
|
1437
|
+
a && o({
|
|
1438
|
+
score: a,
|
|
1439
1439
|
feedback: c || void 0
|
|
1440
1440
|
});
|
|
1441
1441
|
};
|
|
1442
1442
|
return !t && !n ? null : /* @__PURE__ */ d("div", { className: "w-1/2 min-w-80 max-w-96 mx-auto overflow-hidden", children: [
|
|
1443
|
-
/* @__PURE__ */ r(T, { mode: "wait", children: t && !
|
|
1443
|
+
/* @__PURE__ */ r(T, { mode: "wait", children: t && !a ? /* @__PURE__ */ r(W, { 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(W, { children: /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground text-center pt-2", children: "You rated the conversation as" }) }, "csat-submitted-title") : null }),
|
|
1444
1444
|
/* @__PURE__ */ r(
|
|
1445
1445
|
"div",
|
|
1446
1446
|
{
|
|
@@ -1452,26 +1452,26 @@ function fo() {
|
|
|
1452
1452
|
children: wo.map((m) => /* @__PURE__ */ r(
|
|
1453
1453
|
N,
|
|
1454
1454
|
{
|
|
1455
|
-
variant: m.value ===
|
|
1455
|
+
variant: m.value === a ? "secondary" : "ghost",
|
|
1456
1456
|
size: "selfless",
|
|
1457
1457
|
className: h(
|
|
1458
1458
|
"transition-all overflow-hidden",
|
|
1459
1459
|
"text-2xl size-8 rounded-full",
|
|
1460
1460
|
"opacity-35",
|
|
1461
1461
|
"hover:opacity-100",
|
|
1462
|
-
!
|
|
1463
|
-
m.value ===
|
|
1462
|
+
!a && "opacity-100",
|
|
1463
|
+
m.value === a && "opacity-100",
|
|
1464
1464
|
n && m.value !== s && "opacity-0 size-0",
|
|
1465
1465
|
n && m.value === s && "opacity-100 size-fit text-4xl"
|
|
1466
1466
|
),
|
|
1467
|
-
onClick: t ? () =>
|
|
1467
|
+
onClick: t ? () => f(m.value) : void 0,
|
|
1468
1468
|
children: m.emoji
|
|
1469
1469
|
},
|
|
1470
1470
|
m.value
|
|
1471
1471
|
))
|
|
1472
1472
|
}
|
|
1473
1473
|
),
|
|
1474
|
-
/* @__PURE__ */ r(T, { mode: "wait", children: (
|
|
1474
|
+
/* @__PURE__ */ r(T, { mode: "wait", children: (a || s) && /* @__PURE__ */ r(W, { children: /* @__PURE__ */ d("div", { className: "pb-2 px-2 flex items-end", children: [
|
|
1475
1475
|
/* @__PURE__ */ r(
|
|
1476
1476
|
"textarea",
|
|
1477
1477
|
{
|
|
@@ -1486,7 +1486,7 @@ function fo() {
|
|
|
1486
1486
|
e ? "text-[16px]" : "text-sm",
|
|
1487
1487
|
n && "text-center"
|
|
1488
1488
|
),
|
|
1489
|
-
value: n ?
|
|
1489
|
+
value: n ? i || "" : c || "",
|
|
1490
1490
|
onChange: t ? (m) => p(m.target.value) : void 0,
|
|
1491
1491
|
readOnly: n,
|
|
1492
1492
|
placeholder: t ? "Tell us more... (optional)" : void 0
|
|
@@ -1496,8 +1496,8 @@ function fo() {
|
|
|
1496
1496
|
N,
|
|
1497
1497
|
{
|
|
1498
1498
|
size: "fit",
|
|
1499
|
-
onClick:
|
|
1500
|
-
disabled: !
|
|
1499
|
+
onClick: x,
|
|
1500
|
+
disabled: !a,
|
|
1501
1501
|
className: h(
|
|
1502
1502
|
"transition-all overflow-hidden",
|
|
1503
1503
|
"rounded-full size-8 flex items-center justify-center p-0",
|
|
@@ -1528,8 +1528,8 @@ function De({
|
|
|
1528
1528
|
...t
|
|
1529
1529
|
}) {
|
|
1530
1530
|
const { sendMessage: n } = A(), s = () => {
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1531
|
+
const i = e.trim();
|
|
1532
|
+
i && n({ content: i });
|
|
1533
1533
|
};
|
|
1534
1534
|
return /* @__PURE__ */ r(
|
|
1535
1535
|
N,
|
|
@@ -1561,23 +1561,23 @@ function xo() {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
);
|
|
1563
1563
|
}
|
|
1564
|
-
function
|
|
1564
|
+
function ut() {
|
|
1565
1565
|
const { sessionState: e } = U(), { chatFooterItems: o } = C(), t = !!e.session && !e.session.isOpened, n = !t;
|
|
1566
|
-
return /* @__PURE__ */ r(T, { mode: "wait", children: o == null ? void 0 : o.map((s,
|
|
1566
|
+
return /* @__PURE__ */ r(T, { mode: "wait", children: o == null ? void 0 : o.map((s, i) => s.showWhenSessionIsOpen === !1 && n || s.showWhenSessionIsResolved === !1 && t ? null : /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r("div", { className: "pb-2 text-center text-xs", children: /* @__PURE__ */ r(Ne, { children: s.message }) }) }, `${s.message}-${i}`)) });
|
|
1567
1567
|
}
|
|
1568
1568
|
function vo({
|
|
1569
1569
|
file: { status: e, file: o, error: t },
|
|
1570
1570
|
onCancel: n
|
|
1571
1571
|
}) {
|
|
1572
|
-
const [s,
|
|
1572
|
+
const [s, i] = D(
|
|
1573
1573
|
null
|
|
1574
1574
|
);
|
|
1575
1575
|
se(() => {
|
|
1576
1576
|
if (!o.type.startsWith("image/")) return;
|
|
1577
1577
|
const c = new FileReader();
|
|
1578
|
-
return c.onload = () =>
|
|
1578
|
+
return c.onload = () => i(c.result), c.onerror = () => console.error("Error reading file"), c.readAsDataURL(o), () => c.abort();
|
|
1579
1579
|
}, [o]);
|
|
1580
|
-
const
|
|
1580
|
+
const a = () => {
|
|
1581
1581
|
switch (e) {
|
|
1582
1582
|
case "uploading":
|
|
1583
1583
|
return /* @__PURE__ */ r(Nr, { className: "size-4 animate-spin" });
|
|
@@ -1615,7 +1615,7 @@ function vo({
|
|
|
1615
1615
|
"flex items-center justify-center shrink-0"
|
|
1616
1616
|
),
|
|
1617
1617
|
children: [
|
|
1618
|
-
/* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center", children:
|
|
1618
|
+
/* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center", children: a() }),
|
|
1619
1619
|
/* @__PURE__ */ r(
|
|
1620
1620
|
"button",
|
|
1621
1621
|
{
|
|
@@ -1638,21 +1638,21 @@ function vo({
|
|
|
1638
1638
|
}
|
|
1639
1639
|
function bo() {
|
|
1640
1640
|
var M;
|
|
1641
|
-
const { isSmallScreen: e } = $(), o = B(null), { sendMessage: t } = A(), { sessionState: n } = U(), { disableSendingWhenAwaitingAIReply: s } = C(), { t:
|
|
1641
|
+
const { isSmallScreen: e } = $(), o = B(null), { sendMessage: t } = A(), { sessionState: n } = U(), { disableSendingWhenAwaitingAIReply: s } = C(), { t: i } = Z(), [a, l] = D(""), {
|
|
1642
1642
|
allFiles: c,
|
|
1643
1643
|
emptyTheFiles: p,
|
|
1644
|
-
handleCancelUpload:
|
|
1645
|
-
appendFiles:
|
|
1644
|
+
handleCancelUpload: f,
|
|
1645
|
+
appendFiles: x,
|
|
1646
1646
|
isUploading: m,
|
|
1647
1647
|
successFiles: k
|
|
1648
|
-
} = er(),
|
|
1649
|
-
|
|
1650
|
-
}, R = !
|
|
1648
|
+
} = er(), b = !!((M = n.session) != null && M.isHandedOff), { isAwaitingBotReply: z } = Ct(), _ = s !== !1 && z, v = (g) => {
|
|
1649
|
+
x(g);
|
|
1650
|
+
}, R = !a.trim() && k.length === 0, P = async () => {
|
|
1651
1651
|
if (_ || R) return;
|
|
1652
1652
|
m && console.info("please wait for the file(s) to upload");
|
|
1653
|
-
const
|
|
1653
|
+
const g = a.trim();
|
|
1654
1654
|
t({
|
|
1655
|
-
content:
|
|
1655
|
+
content: g,
|
|
1656
1656
|
attachments: k.flatMap(
|
|
1657
1657
|
(S) => S.fileUrl ? [
|
|
1658
1658
|
{
|
|
@@ -1667,16 +1667,16 @@ function bo() {
|
|
|
1667
1667
|
}), l(""), p();
|
|
1668
1668
|
}, {
|
|
1669
1669
|
getRootProps: E,
|
|
1670
|
-
getInputProps:
|
|
1670
|
+
getInputProps: u,
|
|
1671
1671
|
open: I
|
|
1672
1672
|
} = Wr({
|
|
1673
|
-
onDrop:
|
|
1673
|
+
onDrop: v,
|
|
1674
1674
|
noClick: !0,
|
|
1675
1675
|
onDropRejected() {
|
|
1676
1676
|
console.error("unsupported file type, or the file is too large");
|
|
1677
1677
|
},
|
|
1678
1678
|
maxSize: 5 * 1024 * 1024,
|
|
1679
|
-
accept:
|
|
1679
|
+
accept: b ? {
|
|
1680
1680
|
"text/*": [".txt"],
|
|
1681
1681
|
"image/*": [".png", ".jpg", ".jpeg", ".gif"],
|
|
1682
1682
|
"application/pdf": [".pdf"]
|
|
@@ -1687,9 +1687,9 @@ function bo() {
|
|
|
1687
1687
|
"image/webp": [".webp"],
|
|
1688
1688
|
"application/pdf": [".pdf"]
|
|
1689
1689
|
}
|
|
1690
|
-
}), j = (
|
|
1691
|
-
const S =
|
|
1692
|
-
S && S.files.length > 0 &&
|
|
1690
|
+
}), j = (g) => {
|
|
1691
|
+
const S = g.clipboardData;
|
|
1692
|
+
S && S.files.length > 0 && v(Array.from(S.files));
|
|
1693
1693
|
};
|
|
1694
1694
|
return /* @__PURE__ */ d(
|
|
1695
1695
|
"div",
|
|
@@ -1698,7 +1698,7 @@ function bo() {
|
|
|
1698
1698
|
className: "p-2 relative space-y-1",
|
|
1699
1699
|
...E(),
|
|
1700
1700
|
children: [
|
|
1701
|
-
/* @__PURE__ */ r("input", { ...
|
|
1701
|
+
/* @__PURE__ */ r("input", { ...u() }),
|
|
1702
1702
|
/* @__PURE__ */ d(
|
|
1703
1703
|
"div",
|
|
1704
1704
|
{
|
|
@@ -1722,13 +1722,13 @@ function bo() {
|
|
|
1722
1722
|
{
|
|
1723
1723
|
...w("chat/input_box/attachments_container"),
|
|
1724
1724
|
className: "flex items-center gap-1",
|
|
1725
|
-
children: /* @__PURE__ */ r(T, { mode: "popLayout", children: c.map((
|
|
1725
|
+
children: /* @__PURE__ */ r(T, { mode: "popLayout", children: c.map((g) => /* @__PURE__ */ r(y, { snapExit: !0, children: /* @__PURE__ */ r(
|
|
1726
1726
|
vo,
|
|
1727
1727
|
{
|
|
1728
|
-
onCancel: () =>
|
|
1729
|
-
file:
|
|
1728
|
+
onCancel: () => f(g.id),
|
|
1729
|
+
file: g
|
|
1730
1730
|
}
|
|
1731
|
-
) },
|
|
1731
|
+
) }, g.id)) })
|
|
1732
1732
|
}
|
|
1733
1733
|
),
|
|
1734
1734
|
/* @__PURE__ */ r(
|
|
@@ -1738,7 +1738,7 @@ function bo() {
|
|
|
1738
1738
|
onPaste: j,
|
|
1739
1739
|
ref: o,
|
|
1740
1740
|
id: "chat-input",
|
|
1741
|
-
value:
|
|
1741
|
+
value: a,
|
|
1742
1742
|
rows: 3,
|
|
1743
1743
|
className: h(
|
|
1744
1744
|
/** Match the border radius of the container */
|
|
@@ -1751,11 +1751,11 @@ function bo() {
|
|
|
1751
1751
|
// 16px on mobiles prevents auto-zoom on the input when focused
|
|
1752
1752
|
e ? "text-[16px]" : "text-sm"
|
|
1753
1753
|
),
|
|
1754
|
-
onChange: (
|
|
1755
|
-
onKeyDown: async (
|
|
1756
|
-
|
|
1754
|
+
onChange: (g) => l(g.target.value),
|
|
1755
|
+
onKeyDown: async (g) => {
|
|
1756
|
+
g.key === "Enter" && !g.shiftKey && (g.preventDefault(), P());
|
|
1757
1757
|
},
|
|
1758
|
-
placeholder:
|
|
1758
|
+
placeholder: i("write_a_message_placeholder")
|
|
1759
1759
|
}
|
|
1760
1760
|
)
|
|
1761
1761
|
]
|
|
@@ -1777,7 +1777,7 @@ function bo() {
|
|
|
1777
1777
|
className: h(
|
|
1778
1778
|
"rounded-full size-8 flex items-center justify-center p-0 overflow-hidden"
|
|
1779
1779
|
),
|
|
1780
|
-
children: /* @__PURE__ */ r(T, { mode: "wait", children: _ ? /* @__PURE__ */ r(
|
|
1780
|
+
children: /* @__PURE__ */ r(T, { mode: "wait", children: _ ? /* @__PURE__ */ r(y, { children: /* @__PURE__ */ r(ct, { className: "size-4 opacity-50" }) }, "paper-clip-disabled") : /* @__PURE__ */ r(y, { children: /* @__PURE__ */ r(ct, { className: "size-4" }) }, "paper-clip") })
|
|
1781
1781
|
}
|
|
1782
1782
|
)
|
|
1783
1783
|
}
|
|
@@ -1789,7 +1789,7 @@ function bo() {
|
|
|
1789
1789
|
onClick: P,
|
|
1790
1790
|
disabled: _ || m || R,
|
|
1791
1791
|
className: "rounded-full size-8 flex items-center justify-center p-0",
|
|
1792
|
-
children: /* @__PURE__ */ r(T, { mode: "wait", children: _ || m ? /* @__PURE__ */ r(
|
|
1792
|
+
children: /* @__PURE__ */ r(T, { mode: "wait", children: _ || m ? /* @__PURE__ */ r(y, { snapExit: !0, children: /* @__PURE__ */ r(Cr, { className: "size-4 animate-spin animate-iteration-infinite" }) }, "loading") : /* @__PURE__ */ r(y, { snapExit: !0, children: /* @__PURE__ */ r(_t, { className: "size-4" }) }, "send") })
|
|
1793
1793
|
}
|
|
1794
1794
|
) })
|
|
1795
1795
|
] })
|
|
@@ -1818,14 +1818,14 @@ function yo() {
|
|
|
1818
1818
|
] }, "session-closed") }) }) });
|
|
1819
1819
|
}
|
|
1820
1820
|
function ko() {
|
|
1821
|
-
var
|
|
1822
|
-
const { initialQuestions: e, initialQuestionsPosition: o, thisWasHelpfulOrNot: t } = C(), { sessionState: n } = U(), { messagesState: s } = A(),
|
|
1823
|
-
return /* @__PURE__ */ r("footer", { children: /* @__PURE__ */ r(T, { mode: "wait", children: n.session && !((
|
|
1821
|
+
var a;
|
|
1822
|
+
const { initialQuestions: e, initialQuestionsPosition: o, thisWasHelpfulOrNot: t } = C(), { sessionState: n } = U(), { messagesState: s } = A(), i = s.messages.length === 0;
|
|
1823
|
+
return /* @__PURE__ */ r("footer", { children: /* @__PURE__ */ r(T, { mode: "wait", children: n.session && !((a = n.session) != null && a.isOpened) ? /* @__PURE__ */ d(W, { children: [
|
|
1824
1824
|
/* @__PURE__ */ r(yo, {}),
|
|
1825
|
-
/* @__PURE__ */ r(
|
|
1825
|
+
/* @__PURE__ */ r(ut, {})
|
|
1826
1826
|
] }, "session-closed") : /* @__PURE__ */ d(W, { children: [
|
|
1827
1827
|
s.lastAIResMightSolveUserIssue && (t == null ? void 0 : t.enabled) !== !1 && /* @__PURE__ */ r(xo, {}),
|
|
1828
|
-
|
|
1828
|
+
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((l, c) => /* @__PURE__ */ r(
|
|
1829
1829
|
De,
|
|
1830
1830
|
{
|
|
1831
1831
|
suggestion: l
|
|
@@ -1833,7 +1833,7 @@ function ko() {
|
|
|
1833
1833
|
`${l}-${c}`
|
|
1834
1834
|
)) }),
|
|
1835
1835
|
/* @__PURE__ */ r(bo, {}),
|
|
1836
|
-
/* @__PURE__ */ r(
|
|
1836
|
+
/* @__PURE__ */ r(ut, {})
|
|
1837
1837
|
] }, "chat-input") }) });
|
|
1838
1838
|
}
|
|
1839
1839
|
function Co({
|
|
@@ -1845,10 +1845,10 @@ function Co({
|
|
|
1845
1845
|
const { componentStore: s } = O();
|
|
1846
1846
|
if (n.type !== "AGENT" && n.type !== "AI") return null;
|
|
1847
1847
|
if (n.data.action) {
|
|
1848
|
-
const
|
|
1849
|
-
if (
|
|
1848
|
+
const a = s.getComponent(n.data.action.name);
|
|
1849
|
+
if (a)
|
|
1850
1850
|
return /* @__PURE__ */ r(
|
|
1851
|
-
|
|
1851
|
+
a,
|
|
1852
1852
|
{
|
|
1853
1853
|
...n,
|
|
1854
1854
|
id: n.id,
|
|
@@ -1858,9 +1858,9 @@ function Co({
|
|
|
1858
1858
|
}
|
|
1859
1859
|
);
|
|
1860
1860
|
}
|
|
1861
|
-
const
|
|
1862
|
-
return
|
|
1863
|
-
|
|
1861
|
+
const i = s.getComponent(n.component);
|
|
1862
|
+
return i ? /* @__PURE__ */ r(
|
|
1863
|
+
i,
|
|
1864
1864
|
{
|
|
1865
1865
|
...n,
|
|
1866
1866
|
id: n.id,
|
|
@@ -1883,13 +1883,13 @@ function qt({
|
|
|
1883
1883
|
className: o,
|
|
1884
1884
|
containerClassName: t
|
|
1885
1885
|
}) {
|
|
1886
|
-
var
|
|
1886
|
+
var a, l;
|
|
1887
1887
|
const { timestamps: n } = C();
|
|
1888
|
-
if (!((
|
|
1888
|
+
if (!((a = n == null ? void 0 : n.perMessageGroup) != null && a.enabled))
|
|
1889
1889
|
return null;
|
|
1890
1890
|
const s = (l = e[e.length - 1]) == null ? void 0 : l.timestamp;
|
|
1891
1891
|
if (!s) return null;
|
|
1892
|
-
const
|
|
1892
|
+
const i = (() => {
|
|
1893
1893
|
try {
|
|
1894
1894
|
return new Date(s).toLocaleTimeString([], {
|
|
1895
1895
|
hour: "2-digit",
|
|
@@ -1900,7 +1900,7 @@ function qt({
|
|
|
1900
1900
|
return console.error(c), null;
|
|
1901
1901
|
}
|
|
1902
1902
|
})();
|
|
1903
|
-
return
|
|
1903
|
+
return i ? /* @__PURE__ */ r("div", { className: t, children: /* @__PURE__ */ r("span", { className: h("text-xs text-muted-foreground", o), children: i }) }) : null;
|
|
1904
1904
|
}
|
|
1905
1905
|
function pe({
|
|
1906
1906
|
messages: e,
|
|
@@ -1941,12 +1941,12 @@ function pe({
|
|
|
1941
1941
|
...w("chat/agent_msg_group/avatar_and_msgs/msgs"),
|
|
1942
1942
|
className: h("flex-1 flex flex-col gap-1"),
|
|
1943
1943
|
children: [
|
|
1944
|
-
e.map((n, s,
|
|
1944
|
+
e.map((n, s, i) => /* @__PURE__ */ r(
|
|
1945
1945
|
Co,
|
|
1946
1946
|
{
|
|
1947
1947
|
isFirstInGroup: s === 0,
|
|
1948
|
-
isLastInGroup: s ===
|
|
1949
|
-
isAloneInGroup:
|
|
1948
|
+
isLastInGroup: s === i.length - 1,
|
|
1949
|
+
isAloneInGroup: i.length === 1,
|
|
1950
1950
|
...n
|
|
1951
1951
|
},
|
|
1952
1952
|
n.id
|
|
@@ -1997,7 +1997,7 @@ function No({
|
|
|
1997
1997
|
...w("chat/user_msg/root"),
|
|
1998
1998
|
className: "w-5/6 flex flex-col items-end gap-1",
|
|
1999
1999
|
children: [
|
|
2000
|
-
e.attachments && e.attachments.length > 0 && /* @__PURE__ */ r("div", { className: "w-full flex gap-1 flex-wrap justify-end", children: (s = e.attachments) == null ? void 0 : s.map((
|
|
2000
|
+
e.attachments && e.attachments.length > 0 && /* @__PURE__ */ r("div", { className: "w-full flex gap-1 flex-wrap justify-end", children: (s = e.attachments) == null ? void 0 : s.map((i) => /* @__PURE__ */ r(Ft, { attachment: i }, i.id)) }),
|
|
2001
2001
|
e.content.length > 0 && /* @__PURE__ */ r(
|
|
2002
2002
|
"div",
|
|
2003
2003
|
{
|
|
@@ -2052,10 +2052,10 @@ function _o(e) {
|
|
|
2052
2052
|
const o = [];
|
|
2053
2053
|
let t = null;
|
|
2054
2054
|
return e.forEach((n) => {
|
|
2055
|
-
var s,
|
|
2055
|
+
var s, i, a, l, c, p;
|
|
2056
2056
|
// Start a new group if the type changes
|
|
2057
2057
|
(((s = t == null ? void 0 : t[0]) == null ? void 0 : s.type) !== n.type || // Start a new group if the agent changes
|
|
2058
|
-
((
|
|
2058
|
+
((i = t[0]) == null ? void 0 : i.type) === "AGENT" && n.type === "AGENT" && (((a = n.agent) == null ? void 0 : a.id) !== ((l = t[0].agent) == null ? void 0 : l.id) || ((c = n.agent) == null ? void 0 : c.name) !== ((p = t[0].agent) == null ? void 0 : p.name))) && (t = [], o.push(t)), t.push(n);
|
|
2059
2059
|
}), o;
|
|
2060
2060
|
}
|
|
2061
2061
|
function Io(e) {
|
|
@@ -2083,10 +2083,10 @@ function Do() {
|
|
|
2083
2083
|
pe,
|
|
2084
2084
|
{
|
|
2085
2085
|
messages: o.map(
|
|
2086
|
-
({ message:
|
|
2086
|
+
({ message: i }, a) => ({
|
|
2087
2087
|
component: "bot_message",
|
|
2088
|
-
data: { message:
|
|
2089
|
-
id: `${
|
|
2088
|
+
data: { message: i },
|
|
2089
|
+
id: `${a}-${i}`,
|
|
2090
2090
|
type: "AI",
|
|
2091
2091
|
timestamp: null
|
|
2092
2092
|
})
|
|
@@ -2111,18 +2111,18 @@ function jo() {
|
|
|
2111
2111
|
advancedInitialMessages: t = [],
|
|
2112
2112
|
initialQuestions: n,
|
|
2113
2113
|
initialQuestionsPosition: s
|
|
2114
|
-
} = o,
|
|
2115
|
-
var
|
|
2116
|
-
return t.length ? [] : e.length ? [] : (
|
|
2114
|
+
} = o, i = (() => {
|
|
2115
|
+
var a;
|
|
2116
|
+
return t.length ? [] : e.length ? [] : (a = o.initialMessages) != null && a.length ? o.initialMessages : ["Hello, how can I help you?"];
|
|
2117
2117
|
})();
|
|
2118
|
-
return /* @__PURE__ */ r(Q, { children: e.length === 0 &&
|
|
2118
|
+
return /* @__PURE__ */ r(Q, { children: e.length === 0 && i.length > 0 && /* @__PURE__ */ r(
|
|
2119
2119
|
pe,
|
|
2120
2120
|
{
|
|
2121
|
-
messages:
|
|
2122
|
-
(
|
|
2121
|
+
messages: i.map(
|
|
2122
|
+
(a, l) => ({
|
|
2123
2123
|
component: "bot_message",
|
|
2124
|
-
data: { message:
|
|
2125
|
-
id: `${l}-${
|
|
2124
|
+
data: { message: a },
|
|
2125
|
+
id: `${l}-${a}`,
|
|
2126
2126
|
type: "AI",
|
|
2127
2127
|
timestamp: null
|
|
2128
2128
|
})
|
|
@@ -2140,10 +2140,10 @@ function Po() {
|
|
|
2140
2140
|
function Eo() {
|
|
2141
2141
|
const {
|
|
2142
2142
|
messagesState: { messages: e }
|
|
2143
|
-
} = A(), { isAwaitingBotReply: o } = Ct(), { componentStore: t } = O(), { bot: n, humanAgent: s } = C(),
|
|
2143
|
+
} = A(), { isAwaitingBotReply: o } = Ct(), { componentStore: t } = O(), { bot: n, humanAgent: s } = C(), i = bt(
|
|
2144
2144
|
() => _o(e),
|
|
2145
2145
|
[e]
|
|
2146
|
-
),
|
|
2146
|
+
), a = t.getComponent(
|
|
2147
2147
|
"loading"
|
|
2148
2148
|
), l = B(null);
|
|
2149
2149
|
function c() {
|
|
@@ -2164,15 +2164,15 @@ function Eo() {
|
|
|
2164
2164
|
/* @__PURE__ */ r(Ro, {}),
|
|
2165
2165
|
/* @__PURE__ */ r(Do, {}),
|
|
2166
2166
|
/* @__PURE__ */ r(jo, {}),
|
|
2167
|
-
|
|
2168
|
-
var k,
|
|
2169
|
-
const
|
|
2170
|
-
if (!
|
|
2167
|
+
i.map((p, f) => {
|
|
2168
|
+
var k, b, z, _;
|
|
2169
|
+
const x = (k = p == null ? void 0 : p[0]) == null ? void 0 : k.type, m = (b = p[0]) == null ? void 0 : b.id;
|
|
2170
|
+
if (!x || !m) return null;
|
|
2171
2171
|
if (Io(p))
|
|
2172
2172
|
return /* @__PURE__ */ r(So, { messages: p }, m);
|
|
2173
2173
|
if (To(p)) {
|
|
2174
|
-
const
|
|
2175
|
-
return o &&
|
|
2174
|
+
const v = f === i.length - 1;
|
|
2175
|
+
return o && v ? null : ((z = p[0]) == null || z.agent, /* @__PURE__ */ r(
|
|
2176
2176
|
pe,
|
|
2177
2177
|
{
|
|
2178
2178
|
messages: p,
|
|
@@ -2182,15 +2182,15 @@ function Eo() {
|
|
|
2182
2182
|
));
|
|
2183
2183
|
}
|
|
2184
2184
|
if (Mo(p)) {
|
|
2185
|
-
const
|
|
2185
|
+
const v = (_ = p[0]) == null ? void 0 : _.agent;
|
|
2186
2186
|
return /* @__PURE__ */ r(
|
|
2187
2187
|
pe,
|
|
2188
2188
|
{
|
|
2189
2189
|
messages: p,
|
|
2190
|
-
agent:
|
|
2191
|
-
...
|
|
2192
|
-
name: (s == null ? void 0 : s.name) ||
|
|
2193
|
-
avatarUrl: (s == null ? void 0 : s.avatarUrl) ||
|
|
2190
|
+
agent: v ? {
|
|
2191
|
+
...v,
|
|
2192
|
+
name: (s == null ? void 0 : s.name) || v.name || "",
|
|
2193
|
+
avatarUrl: (s == null ? void 0 : s.avatarUrl) || v.avatarUrl || null
|
|
2194
2194
|
} : s ? {
|
|
2195
2195
|
isAi: !1,
|
|
2196
2196
|
id: null,
|
|
@@ -2203,7 +2203,7 @@ function Eo() {
|
|
|
2203
2203
|
}
|
|
2204
2204
|
return null;
|
|
2205
2205
|
}),
|
|
2206
|
-
o &&
|
|
2206
|
+
o && a && /* @__PURE__ */ r(a, { agent: n }),
|
|
2207
2207
|
/* @__PURE__ */ r(Po, {}),
|
|
2208
2208
|
/* @__PURE__ */ r(zo, {})
|
|
2209
2209
|
]
|
|
@@ -2215,7 +2215,7 @@ function Oo() {
|
|
|
2215
2215
|
messagesState: { isInitialFetchLoading: e }
|
|
2216
2216
|
} = A(), {
|
|
2217
2217
|
sessionState: { session: o }
|
|
2218
|
-
} = U(), { isCanvasOpen: t } =
|
|
2218
|
+
} = U(), { isCanvasOpen: t } = go(), { theme: n } = G();
|
|
2219
2219
|
Te({
|
|
2220
2220
|
width: t ? n.screens.chat.withCanvas.width : n.screens.chat.width,
|
|
2221
2221
|
height: t ? n.screens.chat.withCanvas.height : n.screens.chat.height
|
|
@@ -2239,14 +2239,14 @@ function Oo() {
|
|
|
2239
2239
|
children: /* @__PURE__ */ d("div", { className: "size-full justify-between flex flex-col", children: [
|
|
2240
2240
|
/* @__PURE__ */ r(Ut, {}),
|
|
2241
2241
|
/* @__PURE__ */ r(T, { mode: "wait", children: e ? /* @__PURE__ */ r(
|
|
2242
|
-
|
|
2242
|
+
y,
|
|
2243
2243
|
{
|
|
2244
2244
|
className: "flex flex-col items-center justify-center w-full flex-1",
|
|
2245
2245
|
children: /* @__PURE__ */ r(Xt, {})
|
|
2246
2246
|
},
|
|
2247
2247
|
"loading"
|
|
2248
2248
|
) : /* @__PURE__ */ d(
|
|
2249
|
-
|
|
2249
|
+
y,
|
|
2250
2250
|
{
|
|
2251
2251
|
className: "flex items-start h-full flex-1 overflow-auto",
|
|
2252
2252
|
snapExit: !0,
|
|
@@ -2281,7 +2281,7 @@ function Oo() {
|
|
|
2281
2281
|
transitionTimingFunction: n.screens.chat.withCanvas.transitionTimingFunction,
|
|
2282
2282
|
transitionDuration: n.screens.chat.withCanvas.transitionDuration
|
|
2283
2283
|
},
|
|
2284
|
-
children: /* @__PURE__ */ r(
|
|
2284
|
+
children: /* @__PURE__ */ r(uo, {})
|
|
2285
2285
|
}
|
|
2286
2286
|
)
|
|
2287
2287
|
]
|
|
@@ -2364,7 +2364,7 @@ function ft({
|
|
|
2364
2364
|
session: e,
|
|
2365
2365
|
className: o
|
|
2366
2366
|
}) {
|
|
2367
|
-
const { bot: t, humanAgent: n } = C(), { toChatScreen: s } = H(),
|
|
2367
|
+
const { bot: t, humanAgent: n } = C(), { toChatScreen: s } = H(), i = e.assignee.kind === "human" ? (n == null ? void 0 : n.name) || e.assignee.name || "Support Agent" : (t == null ? void 0 : t.name) || "AI Support Agent", a = e.assignee.kind === "human" ? (n == null ? void 0 : n.avatarUrl) || e.assignee.avatarUrl || "" : (t == null ? void 0 : t.avatarUrl) || (t == null ? void 0 : t.avatar) || "";
|
|
2368
2368
|
return /* @__PURE__ */ d(
|
|
2369
2369
|
N,
|
|
2370
2370
|
{
|
|
@@ -2377,13 +2377,13 @@ function ft({
|
|
|
2377
2377
|
onClick: () => s(e.id),
|
|
2378
2378
|
children: [
|
|
2379
2379
|
/* @__PURE__ */ d("div", { className: "flex-1 flex gap-2 items-center", children: [
|
|
2380
|
-
/* @__PURE__ */ r(T, { mode: "wait", children: /* @__PURE__ */ r(
|
|
2381
|
-
/* @__PURE__ */ r(_e, { src:
|
|
2380
|
+
/* @__PURE__ */ r(T, { mode: "wait", children: /* @__PURE__ */ r(y, { snapExit: !0, children: /* @__PURE__ */ d(Se, { className: "size-10", children: [
|
|
2381
|
+
/* @__PURE__ */ r(_e, { src: a, alt: "Agent Icon" }),
|
|
2382
2382
|
/* @__PURE__ */ r(Ie, { children: /* @__PURE__ */ r(Tr, { className: "size-4" }) })
|
|
2383
2383
|
] }) }) }),
|
|
2384
2384
|
/* @__PURE__ */ d("div", { className: "flex-1", children: [
|
|
2385
|
-
/* @__PURE__ */ r(T, { mode: "wait", children: /* @__PURE__ */ r(
|
|
2386
|
-
/* @__PURE__ */ r(T, { mode: "wait", children: e.lastMessage ? /* @__PURE__ */ r(
|
|
2385
|
+
/* @__PURE__ */ r(T, { mode: "wait", children: /* @__PURE__ */ r(y, { snapExit: !0, children: i }, i) }),
|
|
2386
|
+
/* @__PURE__ */ r(T, { mode: "wait", children: e.lastMessage ? /* @__PURE__ */ r(y, { snapExit: !0, children: /* @__PURE__ */ r(
|
|
2387
2387
|
Ht,
|
|
2388
2388
|
{
|
|
2389
2389
|
remarkPlugins: [It],
|
|
@@ -2391,7 +2391,7 @@ function ft({
|
|
|
2391
2391
|
className: "line-clamp-1 overflow-hidden text-ellipsis text-xs text-muted-foreground",
|
|
2392
2392
|
children: e.lastMessage
|
|
2393
2393
|
}
|
|
2394
|
-
) }, e.lastMessage || "content") : /* @__PURE__ */ r(
|
|
2394
|
+
) }, e.lastMessage || "content") : /* @__PURE__ */ r(y, { className: "w-1/2", snapExit: !0, children: /* @__PURE__ */ r(Ao, { className: "h-4 w-full" }) }, "skeleton") })
|
|
2395
2395
|
] })
|
|
2396
2396
|
] }),
|
|
2397
2397
|
/* @__PURE__ */ r(Mr, { className: "size-4 text-muted-foreground shrink-0 rtl:-scale-100" })
|
|
@@ -2403,24 +2403,24 @@ function Wo() {
|
|
|
2403
2403
|
const { t: e } = Z(), { toChatScreen: o } = H(), {
|
|
2404
2404
|
sessionsState: { data: t, isInitialFetchLoading: n },
|
|
2405
2405
|
openSessions: s,
|
|
2406
|
-
closedSessions:
|
|
2407
|
-
canCreateNewSession:
|
|
2406
|
+
closedSessions: i,
|
|
2407
|
+
canCreateNewSession: a
|
|
2408
2408
|
} = U();
|
|
2409
2409
|
return /* @__PURE__ */ r("div", { className: "flex-1 flex flex-col overflow-scroll py-2 px-2", children: /* @__PURE__ */ r(T, { mode: "wait", children: n ? /* @__PURE__ */ r(
|
|
2410
|
-
|
|
2410
|
+
y,
|
|
2411
2411
|
{
|
|
2412
2412
|
className: "flex-1 flex items-center justify-center",
|
|
2413
2413
|
children: /* @__PURE__ */ r(Xt, {})
|
|
2414
2414
|
},
|
|
2415
2415
|
"loading"
|
|
2416
2416
|
) : /* @__PURE__ */ r(
|
|
2417
|
-
|
|
2417
|
+
y,
|
|
2418
2418
|
{
|
|
2419
2419
|
className: "flex-1 flex flex-col gap-2 relative",
|
|
2420
2420
|
children: t.length ? /* @__PURE__ */ d(Q, { children: [
|
|
2421
2421
|
/* @__PURE__ */ d(T, { children: [
|
|
2422
2422
|
s.length > 0 && /* @__PURE__ */ r(
|
|
2423
|
-
|
|
2423
|
+
y,
|
|
2424
2424
|
{
|
|
2425
2425
|
fadeIn: "up",
|
|
2426
2426
|
delay: 0.2,
|
|
@@ -2430,15 +2430,15 @@ function Wo() {
|
|
|
2430
2430
|
},
|
|
2431
2431
|
"open-sessions"
|
|
2432
2432
|
),
|
|
2433
|
-
|
|
2434
|
-
|
|
2433
|
+
i.length > 0 && /* @__PURE__ */ d(
|
|
2434
|
+
y,
|
|
2435
2435
|
{
|
|
2436
2436
|
className: "space-y-2",
|
|
2437
2437
|
delay: 0.2,
|
|
2438
2438
|
snapExit: !0,
|
|
2439
2439
|
children: [
|
|
2440
2440
|
/* @__PURE__ */ r(Ho, { children: e("closed_conversations") }),
|
|
2441
|
-
|
|
2441
|
+
i.map((l) => /* @__PURE__ */ r(
|
|
2442
2442
|
ft,
|
|
2443
2443
|
{
|
|
2444
2444
|
session: l,
|
|
@@ -2451,7 +2451,7 @@ function Wo() {
|
|
|
2451
2451
|
"closed-sessions"
|
|
2452
2452
|
)
|
|
2453
2453
|
] }),
|
|
2454
|
-
|
|
2454
|
+
a && /* @__PURE__ */ r("div", { className: "mt-auto w-full rounded-3xl sticky bottom-0 outline outline-8 outline-background bg-background", children: /* @__PURE__ */ lt(
|
|
2455
2455
|
N,
|
|
2456
2456
|
{
|
|
2457
2457
|
...w("sessions/new_conversation_btn"),
|
|
@@ -2536,9 +2536,9 @@ function $o() {
|
|
|
2536
2536
|
const n = e == null ? void 0 : e.current;
|
|
2537
2537
|
if (n && t.current) {
|
|
2538
2538
|
const s = t.current;
|
|
2539
|
-
let
|
|
2540
|
-
const
|
|
2541
|
-
|
|
2539
|
+
let i;
|
|
2540
|
+
const a = new ResizeObserver(() => {
|
|
2541
|
+
i = requestAnimationFrame(() => {
|
|
2542
2542
|
const l = s.offsetHeight;
|
|
2543
2543
|
n.style.setProperty(
|
|
2544
2544
|
"--opencx-widget-height",
|
|
@@ -2546,31 +2546,31 @@ function $o() {
|
|
|
2546
2546
|
);
|
|
2547
2547
|
});
|
|
2548
2548
|
});
|
|
2549
|
-
return
|
|
2550
|
-
cancelAnimationFrame(
|
|
2549
|
+
return a.observe(s), () => {
|
|
2550
|
+
cancelAnimationFrame(i), a.unobserve(s);
|
|
2551
2551
|
};
|
|
2552
2552
|
}
|
|
2553
2553
|
}, [e, o]), { observedElementRef: t };
|
|
2554
2554
|
}
|
|
2555
|
-
const Bo =
|
|
2556
|
-
name:
|
|
2557
|
-
email:
|
|
2555
|
+
const Bo = ue.object({
|
|
2556
|
+
name: ue.string().min(2),
|
|
2557
|
+
email: ue.string().email()
|
|
2558
2558
|
});
|
|
2559
2559
|
function Yo() {
|
|
2560
|
-
var
|
|
2560
|
+
var v, R, P, E, u, I, j, M;
|
|
2561
2561
|
const {
|
|
2562
2562
|
widgetCtx: { org: e }
|
|
2563
|
-
} = O(), { setIsOpen: o } = V(), { createUnverifiedContact: t } = zt(), { isSmallScreen: n } = $(), s = C(), { theme:
|
|
2563
|
+
} = O(), { setIsOpen: o } = V(), { createUnverifiedContact: t } = zt(), { isSmallScreen: n } = $(), s = C(), { theme: i } = G(), { t: a } = Z(), { observedElementRef: l } = $o();
|
|
2564
2564
|
Te({
|
|
2565
2565
|
height: void 0,
|
|
2566
|
-
width:
|
|
2566
|
+
width: i.screens.welcome.width
|
|
2567
2567
|
});
|
|
2568
|
-
const [c, p] = D(((
|
|
2569
|
-
(
|
|
2570
|
-
), [k,
|
|
2571
|
-
async (
|
|
2572
|
-
|
|
2573
|
-
const S = Bo.safeParse({ name: c, email:
|
|
2568
|
+
const [c, p] = D(((v = s.prefillUserData) == null ? void 0 : v.name) || ""), [f, x] = D(((R = s.prefillUserData) == null ? void 0 : R.email) || ""), m = (s.extraDataCollectionFields || []).filter(
|
|
2569
|
+
(g) => g !== "name" && g !== "email" && !!g
|
|
2570
|
+
), [k, b] = D({}), [z, _] = Lr(
|
|
2571
|
+
async (g) => {
|
|
2572
|
+
g.preventDefault();
|
|
2573
|
+
const S = Bo.safeParse({ name: c, email: f });
|
|
2574
2574
|
S.success && await t(
|
|
2575
2575
|
{
|
|
2576
2576
|
email: S.data.email,
|
|
@@ -2580,7 +2580,7 @@ function Yo() {
|
|
|
2580
2580
|
Object.values(k).filter(Boolean).length ? k : void 0
|
|
2581
2581
|
);
|
|
2582
2582
|
},
|
|
2583
|
-
[c,
|
|
2583
|
+
[c, f, k]
|
|
2584
2584
|
);
|
|
2585
2585
|
return /* @__PURE__ */ r(
|
|
2586
2586
|
"div",
|
|
@@ -2590,7 +2590,7 @@ function Yo() {
|
|
|
2590
2590
|
// Relative to the iframe
|
|
2591
2591
|
maxWidth: "100vw",
|
|
2592
2592
|
// Relative to the iframe
|
|
2593
|
-
minHeight:
|
|
2593
|
+
minHeight: i.screens.welcome.minHeight,
|
|
2594
2594
|
height: "100vh",
|
|
2595
2595
|
// Relative to the iframe
|
|
2596
2596
|
maxHeight: "100vh",
|
|
@@ -2615,7 +2615,7 @@ function Yo() {
|
|
|
2615
2615
|
"text-primary-foreground"
|
|
2616
2616
|
),
|
|
2617
2617
|
children: [
|
|
2618
|
-
n && /* @__PURE__ */ r(
|
|
2618
|
+
n && /* @__PURE__ */ r(y, { className: "absolute top-6 end-6", children: /* @__PURE__ */ r(N, { size: "selfless", onClick: () => o(!1), children: /* @__PURE__ */ r(ke, { className: "size-4" }) }) }),
|
|
2619
2619
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between w-full mb-2", children: (P = s.assets) != null && P.organizationLogo ? /* @__PURE__ */ r(
|
|
2620
2620
|
"img",
|
|
2621
2621
|
{
|
|
@@ -2625,8 +2625,8 @@ function Yo() {
|
|
|
2625
2625
|
}
|
|
2626
2626
|
) : /* @__PURE__ */ r("h2", { className: "font-bold text-sm", children: e.name }) }),
|
|
2627
2627
|
/* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
2628
|
-
/* @__PURE__ */ r("h1", { className: "text-[1.75rem] font-semibold tracking-tight leading-none", children: ((I = (
|
|
2629
|
-
/* @__PURE__ */ r("p", { className: "text-sm", children: ((M = (j = s.textContent) == null ? void 0 : j.welcomeScreen) == null ? void 0 : M.description) ||
|
|
2628
|
+
/* @__PURE__ */ r("h1", { className: "text-[1.75rem] font-semibold tracking-tight leading-none", children: ((I = (u = s.textContent) == null ? void 0 : u.welcomeScreen) == null ? void 0 : I.title) || a("welcome_screen_title") }),
|
|
2629
|
+
/* @__PURE__ */ r("p", { className: "text-sm", children: ((M = (j = s.textContent) == null ? void 0 : j.welcomeScreen) == null ? void 0 : M.description) || a("welcome_screen_description") })
|
|
2630
2630
|
] })
|
|
2631
2631
|
]
|
|
2632
2632
|
}
|
|
@@ -2646,9 +2646,9 @@ function Yo() {
|
|
|
2646
2646
|
de,
|
|
2647
2647
|
{
|
|
2648
2648
|
value: c,
|
|
2649
|
-
onChange: (
|
|
2649
|
+
onChange: (g) => p(g.target.value),
|
|
2650
2650
|
required: !0,
|
|
2651
|
-
placeholder:
|
|
2651
|
+
placeholder: a("your_name_placeholder"),
|
|
2652
2652
|
name: "name"
|
|
2653
2653
|
}
|
|
2654
2654
|
),
|
|
@@ -2656,24 +2656,24 @@ function Yo() {
|
|
|
2656
2656
|
de,
|
|
2657
2657
|
{
|
|
2658
2658
|
required: !0,
|
|
2659
|
-
value:
|
|
2660
|
-
onChange: (
|
|
2659
|
+
value: f,
|
|
2660
|
+
onChange: (g) => x(g.target.value),
|
|
2661
2661
|
type: "email",
|
|
2662
|
-
placeholder:
|
|
2662
|
+
placeholder: a("your_email_placeholder"),
|
|
2663
2663
|
name: "email"
|
|
2664
2664
|
}
|
|
2665
2665
|
),
|
|
2666
|
-
m.map((
|
|
2666
|
+
m.map((g) => /* @__PURE__ */ r(
|
|
2667
2667
|
de,
|
|
2668
2668
|
{
|
|
2669
|
-
value: k[
|
|
2670
|
-
onChange: (S) =>
|
|
2669
|
+
value: k[g],
|
|
2670
|
+
onChange: (S) => b((ie) => ({
|
|
2671
2671
|
...ie,
|
|
2672
|
-
[
|
|
2672
|
+
[g]: S.target.value
|
|
2673
2673
|
})),
|
|
2674
|
-
placeholder: `${
|
|
2674
|
+
placeholder: `${g} (${a("optional")})`
|
|
2675
2675
|
},
|
|
2676
|
-
|
|
2676
|
+
g
|
|
2677
2677
|
)),
|
|
2678
2678
|
/* @__PURE__ */ d(
|
|
2679
2679
|
N,
|
|
@@ -2682,7 +2682,7 @@ function Yo() {
|
|
|
2682
2682
|
className: "w-full",
|
|
2683
2683
|
size: "lg",
|
|
2684
2684
|
children: [
|
|
2685
|
-
z.loading ?
|
|
2685
|
+
z.loading ? a("start_chat_button_loading") : a("start_chat_button"),
|
|
2686
2686
|
/* @__PURE__ */ r(Dr, { className: "size-4 rtl:-scale-100" })
|
|
2687
2687
|
]
|
|
2688
2688
|
}
|
|
@@ -2706,7 +2706,7 @@ function Gt() {
|
|
|
2706
2706
|
switch (e) {
|
|
2707
2707
|
case "welcome":
|
|
2708
2708
|
return /* @__PURE__ */ r(
|
|
2709
|
-
|
|
2709
|
+
y,
|
|
2710
2710
|
{
|
|
2711
2711
|
fadeIn: "right",
|
|
2712
2712
|
className: "size-full",
|
|
@@ -2717,7 +2717,7 @@ function Gt() {
|
|
|
2717
2717
|
);
|
|
2718
2718
|
case "sessions":
|
|
2719
2719
|
return /* @__PURE__ */ r(
|
|
2720
|
-
|
|
2720
|
+
y,
|
|
2721
2721
|
{
|
|
2722
2722
|
fadeIn: "right",
|
|
2723
2723
|
className: "size-full",
|
|
@@ -2728,7 +2728,7 @@ function Gt() {
|
|
|
2728
2728
|
);
|
|
2729
2729
|
case "chat":
|
|
2730
2730
|
return /* @__PURE__ */ r(
|
|
2731
|
-
|
|
2731
|
+
y,
|
|
2732
2732
|
{
|
|
2733
2733
|
fadeIn: "right",
|
|
2734
2734
|
className: "size-full",
|
|
@@ -2742,7 +2742,7 @@ function Gt() {
|
|
|
2742
2742
|
}
|
|
2743
2743
|
})() }) });
|
|
2744
2744
|
}
|
|
2745
|
-
const Uo = "4.0.
|
|
2745
|
+
const Uo = "4.0.52", Xo = `<!DOCTYPE html>
|
|
2746
2746
|
<html>
|
|
2747
2747
|
<head>
|
|
2748
2748
|
<style>
|
|
@@ -2761,7 +2761,7 @@ html, body {
|
|
|
2761
2761
|
</body>
|
|
2762
2762
|
</html>`;
|
|
2763
2763
|
function Zt() {
|
|
2764
|
-
const { isOpen: e } = V(), { contentIframeRef: o } = O(), { cssOverrides: t, inline: n } = C(), { theme: s, cssVars:
|
|
2764
|
+
const { isOpen: e } = V(), { contentIframeRef: o } = O(), { cssOverrides: t, inline: n } = C(), { theme: s, cssVars: i, computed: a } = G(), { dir: l } = Z();
|
|
2765
2765
|
return /* @__PURE__ */ r(
|
|
2766
2766
|
re.div,
|
|
2767
2767
|
{
|
|
@@ -2790,15 +2790,15 @@ function Zt() {
|
|
|
2790
2790
|
title: "OpenCX Live Chat",
|
|
2791
2791
|
style: {
|
|
2792
2792
|
// @ts-expect-error this is a valid css variable
|
|
2793
|
-
"--opencx-widget-width":
|
|
2794
|
-
"--opencx-widget-height":
|
|
2795
|
-
minWidth:
|
|
2793
|
+
"--opencx-widget-width": a.minWidth,
|
|
2794
|
+
"--opencx-widget-height": a.minHeight,
|
|
2795
|
+
minWidth: a.minWidth,
|
|
2796
2796
|
width: "var(--opencx-widget-width)",
|
|
2797
|
-
maxWidth:
|
|
2797
|
+
maxWidth: a.maxWidth,
|
|
2798
2798
|
// Relative to the viewport
|
|
2799
|
-
minHeight:
|
|
2799
|
+
minHeight: a.minHeight,
|
|
2800
2800
|
height: "var(--opencx-widget-height)",
|
|
2801
|
-
maxHeight:
|
|
2801
|
+
maxHeight: a.maxHeight,
|
|
2802
2802
|
// Relative to the viewport
|
|
2803
2803
|
overflow: "hidden",
|
|
2804
2804
|
/** outline is better than border because of box sizing; the outline wouldn't affect the content inside... the border will mess up how the children's border radius sits with the parent */
|
|
@@ -2819,7 +2819,7 @@ function Zt() {
|
|
|
2819
2819
|
"div",
|
|
2820
2820
|
{
|
|
2821
2821
|
style: {
|
|
2822
|
-
...
|
|
2822
|
+
...i,
|
|
2823
2823
|
zIndex: s.widgetContentContainer.zIndex
|
|
2824
2824
|
},
|
|
2825
2825
|
"data-version": Uo,
|
|
@@ -2918,12 +2918,12 @@ html, body {
|
|
|
2918
2918
|
</body>
|
|
2919
2919
|
</html>`;
|
|
2920
2920
|
function Zo() {
|
|
2921
|
-
var
|
|
2922
|
-
const { isOpen: e, setIsOpen: o } = V(), { cssOverrides: t, assets: n, customComponents: s } = C(), { theme: a, cssVars:
|
|
2921
|
+
var p, f, x;
|
|
2922
|
+
const { isOpen: e, setIsOpen: o } = V(), { cssOverrides: t, assets: n, customComponents: s, accessibility: i } = C(), { theme: a, cssVars: l } = G(), c = ((p = i == null ? void 0 : i.widgetTriggerButton) == null ? void 0 : p.label) ?? "Chat with us";
|
|
2923
2923
|
return s != null && s.widgetTrigger ? s.widgetTrigger({
|
|
2924
2924
|
react: L,
|
|
2925
2925
|
isOpen: e,
|
|
2926
|
-
setIsOpen: (
|
|
2926
|
+
setIsOpen: (m) => o(m)
|
|
2927
2927
|
}) : /* @__PURE__ */ d(
|
|
2928
2928
|
Mt,
|
|
2929
2929
|
{
|
|
@@ -2950,7 +2950,7 @@ function Zo() {
|
|
|
2950
2950
|
"div",
|
|
2951
2951
|
{
|
|
2952
2952
|
style: {
|
|
2953
|
-
...
|
|
2953
|
+
...l,
|
|
2954
2954
|
width: "100%",
|
|
2955
2955
|
height: "100%",
|
|
2956
2956
|
display: "flex",
|
|
@@ -2960,6 +2960,8 @@ function Zo() {
|
|
|
2960
2960
|
children: /* @__PURE__ */ r(
|
|
2961
2961
|
he.PopoverTrigger,
|
|
2962
2962
|
{
|
|
2963
|
+
"aria-label": c,
|
|
2964
|
+
title: c,
|
|
2963
2965
|
className: h(
|
|
2964
2966
|
"font-sans flex items-center justify-center rounded-full"
|
|
2965
2967
|
),
|
|
@@ -2980,7 +2982,7 @@ function Zo() {
|
|
|
2980
2982
|
"text-primary-foreground"
|
|
2981
2983
|
),
|
|
2982
2984
|
children: /* @__PURE__ */ r(T, { mode: "wait", children: e ? /* @__PURE__ */ r(
|
|
2983
|
-
|
|
2985
|
+
y,
|
|
2984
2986
|
{
|
|
2985
2987
|
snapExit: !0,
|
|
2986
2988
|
fadeIn: "up",
|
|
@@ -2988,7 +2990,7 @@ function Zo() {
|
|
|
2988
2990
|
initial: { rotate: 45 },
|
|
2989
2991
|
animate: { rotate: 0 }
|
|
2990
2992
|
},
|
|
2991
|
-
children: (
|
|
2993
|
+
children: (f = n == null ? void 0 : n.widgetTrigger) != null && f.closeIcon ? /* @__PURE__ */ r(
|
|
2992
2994
|
"img",
|
|
2993
2995
|
{
|
|
2994
2996
|
src: n.widgetTrigger.closeIcon,
|
|
@@ -3010,14 +3012,14 @@ function Zo() {
|
|
|
3010
3012
|
},
|
|
3011
3013
|
"x-icon"
|
|
3012
3014
|
) : /* @__PURE__ */ r(
|
|
3013
|
-
|
|
3015
|
+
y,
|
|
3014
3016
|
{
|
|
3015
3017
|
snapExit: !0,
|
|
3016
3018
|
overrides: {
|
|
3017
3019
|
initial: { rotate: 45 },
|
|
3018
3020
|
animate: { rotate: 0 }
|
|
3019
3021
|
},
|
|
3020
|
-
children: (
|
|
3022
|
+
children: (x = n == null ? void 0 : n.widgetTrigger) != null && x.openIcon ? /* @__PURE__ */ r(
|
|
3021
3023
|
"img",
|
|
3022
3024
|
{
|
|
3023
3025
|
src: n.widgetTrigger.openIcon,
|
|
@@ -3068,8 +3070,8 @@ function Qo({
|
|
|
3068
3070
|
widgetRef: e
|
|
3069
3071
|
}) {
|
|
3070
3072
|
const { widgetCtx: o } = O(), { contactState: t } = zt(), { setIsOpen: n, isOpen: s } = V(), {
|
|
3071
|
-
toChatScreen:
|
|
3072
|
-
routerState: { screen:
|
|
3073
|
+
toChatScreen: i,
|
|
3074
|
+
routerState: { screen: a }
|
|
3073
3075
|
} = H(), { sendMessage: l } = A();
|
|
3074
3076
|
return L.useImperativeHandle(
|
|
3075
3077
|
e,
|
|
@@ -3080,7 +3082,7 @@ function Qo({
|
|
|
3080
3082
|
console.warn("Cannot start a new chat: contact not yet initialized.");
|
|
3081
3083
|
return;
|
|
3082
3084
|
}
|
|
3083
|
-
console.log({ isOpen: s }), s || n(!0),
|
|
3085
|
+
console.log({ isOpen: s }), s || n(!0), a === "chat" && o.resetChat(), i(), c != null && c.message && l({ content: c.message });
|
|
3084
3086
|
}
|
|
3085
3087
|
}),
|
|
3086
3088
|
[
|
|
@@ -3088,8 +3090,8 @@ function Qo({
|
|
|
3088
3090
|
t,
|
|
3089
3091
|
n,
|
|
3090
3092
|
s,
|
|
3091
|
-
i,
|
|
3092
3093
|
a,
|
|
3094
|
+
i,
|
|
3093
3095
|
l
|
|
3094
3096
|
]
|
|
3095
3097
|
), null;
|