@opencx/widget-react 4.0.49 → 4.0.51
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.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as r, jsxs as d, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as he from "@radix-ui/react-popover";
|
|
3
3
|
import * as J from "react";
|
|
4
|
-
import
|
|
5
|
-
import { useWidget 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
|
|
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
|
+
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 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";
|
|
@@ -12,61 +12,61 @@ import { cva as Or } from "class-variance-authority";
|
|
|
12
12
|
import It from "remark-gfm";
|
|
13
13
|
import Ar from "react-markdown";
|
|
14
14
|
import Tt from "rehype-raw";
|
|
15
|
-
import { isExhaustive as
|
|
15
|
+
import { isExhaustive as F, isSupportedLanguage as Fr, getTranslation as Hr } from "@opencx/widget-core";
|
|
16
16
|
import * as ee from "@radix-ui/react-avatar";
|
|
17
17
|
import Mt from "@uiw/react-iframe";
|
|
18
18
|
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
|
|
23
|
-
function
|
|
22
|
+
import { z as ue } from "zod";
|
|
23
|
+
function w(e) {
|
|
24
24
|
return { "data-component": e };
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function h(...e) {
|
|
27
27
|
return Pr(jr(e));
|
|
28
28
|
}
|
|
29
29
|
const K = {
|
|
30
30
|
x: 2,
|
|
31
31
|
y: 2
|
|
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
|
|
41
|
-
const { clientX:
|
|
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
43
|
Math.min(1, R / (v.width / 2))
|
|
44
44
|
), u = Math.max(
|
|
45
45
|
-1,
|
|
46
46
|
Math.min(1, P / (v.height / 2))
|
|
47
|
-
),
|
|
48
|
-
c({ x:
|
|
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
49
|
}, x = () => {
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
"--wobble-x":
|
|
57
|
-
"--wobble-y":
|
|
50
|
+
var b, z;
|
|
51
|
+
a(!0), (z = (b = e.props).onMouseEnter) == null || z.call(b);
|
|
52
|
+
}, m = () => {
|
|
53
|
+
var b, z;
|
|
54
|
+
a(!1), c({ x: 0, y: 0 }), (z = (b = e.props).onMouseLeave) == null || z.call(b);
|
|
55
|
+
}, k = {
|
|
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:
|
|
62
|
+
onMouseMove: f,
|
|
63
63
|
onMouseEnter: x,
|
|
64
|
-
onMouseLeave:
|
|
64
|
+
onMouseLeave: m,
|
|
65
65
|
style: {
|
|
66
|
-
...
|
|
66
|
+
...k,
|
|
67
67
|
...e.props.style
|
|
68
68
|
},
|
|
69
|
-
className:
|
|
69
|
+
className: h(
|
|
70
70
|
"translate-x-[var(--wobble-x)]",
|
|
71
71
|
"translate-y-[var(--wobble-y)]",
|
|
72
72
|
"hover:scale-[var(--scale)] active:hover:scale-[calc(var(--scale)-0.02)]",
|
|
@@ -78,7 +78,7 @@ const K = {
|
|
|
78
78
|
}
|
|
79
79
|
)
|
|
80
80
|
);
|
|
81
|
-
|
|
81
|
+
Y.displayName = "Wobble";
|
|
82
82
|
const $r = 10, Br = (e, o, t) => ({
|
|
83
83
|
initial: { opacity: 0, x: -e, ...o.initial },
|
|
84
84
|
animate: { opacity: 1, x: 0, ...o.animate, transition: { delay: t } },
|
|
@@ -100,23 +100,23 @@ 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",
|
|
121
121
|
"text-sm font-medium whitespace-nowrap",
|
|
122
122
|
"ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
@@ -154,23 +154,23 @@ const Vr = Or(
|
|
|
154
154
|
size: "default"
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
),
|
|
158
|
-
({ className: e, variant: o = "default", size: t, asChild: n = !1, ...s },
|
|
157
|
+
), N = J.forwardRef(
|
|
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"),
|
|
162
162
|
"data-variant": o,
|
|
163
|
-
className:
|
|
163
|
+
className: h(Vr({ variant: o, size: t, className: e })),
|
|
164
164
|
...s
|
|
165
165
|
}
|
|
166
166
|
) })
|
|
167
167
|
);
|
|
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
|
|
@@ -186,7 +186,7 @@ function Gr({ children: e }) {
|
|
|
186
186
|
}
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function me() {
|
|
190
190
|
const e = Jt(Dt);
|
|
191
191
|
return e || (console.error("useDialoger must be used within a DialogerProvider"), {
|
|
192
192
|
open: () => {
|
|
@@ -198,13 +198,13 @@ function he() {
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
function Zr() {
|
|
201
|
-
const { contentIframeRef: e } =
|
|
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 },
|
|
@@ -234,11 +234,11 @@ function Ce({
|
|
|
234
234
|
className: o,
|
|
235
235
|
withClose: t = !1
|
|
236
236
|
}) {
|
|
237
|
-
const { close: n } =
|
|
237
|
+
const { close: n } = me();
|
|
238
238
|
return /* @__PURE__ */ d(
|
|
239
239
|
"div",
|
|
240
240
|
{
|
|
241
|
-
className:
|
|
241
|
+
className: h(
|
|
242
242
|
"fixed left-[50%] top-[50%] z-50 flex flex-col gap-4 w-full max-w-[61.8%] translate-x-[-50%] translate-y-[-50%] border bg-background p-4 rounded-3xl",
|
|
243
243
|
o
|
|
244
244
|
),
|
|
@@ -246,7 +246,7 @@ function Ce({
|
|
|
246
246
|
children: [
|
|
247
247
|
e,
|
|
248
248
|
t && /* @__PURE__ */ d(
|
|
249
|
-
|
|
249
|
+
N,
|
|
250
250
|
{
|
|
251
251
|
size: "fit",
|
|
252
252
|
className: "rounded-full absolute top-4 right-4 opacity-50 hover:opacity-100",
|
|
@@ -267,7 +267,7 @@ const Rt = ({
|
|
|
267
267
|
}) => /* @__PURE__ */ r(
|
|
268
268
|
"div",
|
|
269
269
|
{
|
|
270
|
-
className:
|
|
270
|
+
className: h("flex flex-col gap-2 text-center pt-2", e),
|
|
271
271
|
...o
|
|
272
272
|
}
|
|
273
273
|
);
|
|
@@ -278,7 +278,7 @@ const jt = ({
|
|
|
278
278
|
}) => /* @__PURE__ */ r(
|
|
279
279
|
"div",
|
|
280
280
|
{
|
|
281
|
-
className:
|
|
281
|
+
className: h("flex flex-col gap-2 text-center", e),
|
|
282
282
|
...o
|
|
283
283
|
}
|
|
284
284
|
);
|
|
@@ -286,13 +286,13 @@ jt.displayName = "DialogerBody";
|
|
|
286
286
|
const Pt = ({
|
|
287
287
|
className: e,
|
|
288
288
|
...o
|
|
289
|
-
}) => /* @__PURE__ */ r("div", { className:
|
|
289
|
+
}) => /* @__PURE__ */ r("div", { className: h("flex flex-col gap-2", e), ...o });
|
|
290
290
|
Pt.displayName = "DialogerFooter";
|
|
291
|
-
const Et =
|
|
291
|
+
const Et = L.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
292
292
|
"p",
|
|
293
293
|
{
|
|
294
294
|
ref: t,
|
|
295
|
-
className:
|
|
295
|
+
className: h(
|
|
296
296
|
"text-lg font-semibold leading-none tracking-tight",
|
|
297
297
|
e
|
|
298
298
|
),
|
|
@@ -300,11 +300,11 @@ const Et = W.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
|
300
300
|
}
|
|
301
301
|
));
|
|
302
302
|
Et.displayName = "DialogerTitle";
|
|
303
|
-
const Ot =
|
|
303
|
+
const Ot = L.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
304
304
|
"p",
|
|
305
305
|
{
|
|
306
306
|
ref: t,
|
|
307
|
-
className:
|
|
307
|
+
className: h("text-sm text-muted-foreground", e),
|
|
308
308
|
...o
|
|
309
309
|
}
|
|
310
310
|
));
|
|
@@ -313,17 +313,17 @@ function ze({
|
|
|
313
313
|
children: e,
|
|
314
314
|
trigger: o
|
|
315
315
|
}) {
|
|
316
|
-
const { open: t } =
|
|
316
|
+
const { open: t } = me();
|
|
317
317
|
return vt(o, {
|
|
318
318
|
onClick: () => t(e)
|
|
319
319
|
});
|
|
320
320
|
}
|
|
321
|
-
const pt = 1,
|
|
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,47 +334,47 @@ function At({
|
|
|
334
334
|
src: e,
|
|
335
335
|
alt: o
|
|
336
336
|
}) {
|
|
337
|
-
const [t, n] = D(1), [s,
|
|
338
|
-
n(1),
|
|
339
|
-
}, []),
|
|
340
|
-
n((u) =>
|
|
341
|
-
}, []),
|
|
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
|
+
}, []), z = q(() => {
|
|
340
|
+
n((u) => k(u + le));
|
|
341
|
+
}, []), _ = q(() => {
|
|
342
342
|
n((u) => {
|
|
343
|
-
const
|
|
344
|
-
return
|
|
343
|
+
const I = k(u - le);
|
|
344
|
+
return I <= 1 && i({ x: 0, y: 0 }), I;
|
|
345
345
|
});
|
|
346
346
|
}, []);
|
|
347
347
|
q((u) => {
|
|
348
348
|
u.preventDefault(), u.stopPropagation();
|
|
349
|
-
const
|
|
350
|
-
n((
|
|
351
|
-
const
|
|
352
|
-
return
|
|
349
|
+
const I = u.deltaY > 0 ? -le : le;
|
|
350
|
+
n((j) => {
|
|
351
|
+
const M = k(j + I);
|
|
352
|
+
return M <= 1 && i({ x: 0, y: 0 }), M;
|
|
353
353
|
});
|
|
354
354
|
}, []);
|
|
355
355
|
const v = q(
|
|
356
356
|
(u) => {
|
|
357
|
-
u.preventDefault(),
|
|
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
361
|
(u) => {
|
|
362
|
-
if (!
|
|
363
|
-
const
|
|
364
|
-
if ((Math.abs(
|
|
365
|
-
const
|
|
366
|
-
x: p.current.x +
|
|
367
|
-
y: p.current.y +
|
|
362
|
+
if (!a) return;
|
|
363
|
+
const I = u.clientX - c.current.x, j = u.clientY - c.current.y;
|
|
364
|
+
if ((Math.abs(I) > 3 || Math.abs(j) > 3) && (m.current = !0), t <= 1) return;
|
|
365
|
+
const M = {
|
|
366
|
+
x: p.current.x + I / t,
|
|
367
|
+
y: p.current.y + j / t
|
|
368
368
|
};
|
|
369
|
-
|
|
370
|
-
Qr(
|
|
369
|
+
i(
|
|
370
|
+
Qr(M, t, f.current, x.current)
|
|
371
371
|
);
|
|
372
372
|
},
|
|
373
|
-
[
|
|
373
|
+
[a, t]
|
|
374
374
|
), P = q(() => {
|
|
375
|
-
const u =
|
|
376
|
-
l(!1), !u && n((
|
|
377
|
-
}, []),
|
|
375
|
+
const u = m.current;
|
|
376
|
+
l(!1), !u && n((I) => I > 1 ? (i({ x: 0, y: 0 }), 1) : Kr);
|
|
377
|
+
}, []), E = t > 1;
|
|
378
378
|
return /* @__PURE__ */ d(
|
|
379
379
|
"div",
|
|
380
380
|
{
|
|
@@ -384,17 +384,17 @@ function At({
|
|
|
384
384
|
/* @__PURE__ */ r(
|
|
385
385
|
"div",
|
|
386
386
|
{
|
|
387
|
-
ref:
|
|
388
|
-
className:
|
|
387
|
+
ref: f,
|
|
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
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(
|
|
@@ -416,15 +416,15 @@ function At({
|
|
|
416
416
|
}
|
|
417
417
|
),
|
|
418
418
|
/* @__PURE__ */ d("div", { className: "absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1 bg-black/60 backdrop-blur-sm rounded-full px-1.5 py-1 transition opacity-50 hover:opacity-100", children: [
|
|
419
|
-
/* @__PURE__ */ r(we, { onClick:
|
|
419
|
+
/* @__PURE__ */ r(we, { onClick: _, label: "Zoom out", disabled: t <= pt, children: /* @__PURE__ */ r(nr, { className: "size-3.5" }) }),
|
|
420
420
|
/* @__PURE__ */ d("span", { className: "text-white text-xs font-medium min-w-[3ch] text-center tabular-nums", children: [
|
|
421
421
|
Math.round(t * 100),
|
|
422
422
|
"%"
|
|
423
423
|
] }),
|
|
424
|
-
/* @__PURE__ */ r(we, { onClick:
|
|
425
|
-
|
|
424
|
+
/* @__PURE__ */ r(we, { onClick: z, label: "Zoom in", disabled: t >= ht, children: /* @__PURE__ */ r(sr, { className: "size-3.5" }) }),
|
|
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,17 +449,17 @@ function we({
|
|
|
449
449
|
);
|
|
450
450
|
}
|
|
451
451
|
function Ft({ attachment: e }) {
|
|
452
|
-
const { name: o, size: t, type: n, url: s } = e,
|
|
453
|
-
return l ? /* @__PURE__ */ r(
|
|
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
|
+
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
|
-
trigger: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
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 }) }) }) }),
|
|
463
463
|
children: /* @__PURE__ */ r(
|
|
464
464
|
Ce,
|
|
465
465
|
{
|
|
@@ -469,13 +469,13 @@ function Ft({ attachment: e }) {
|
|
|
469
469
|
}
|
|
470
470
|
)
|
|
471
471
|
}
|
|
472
|
-
) : c ? /* @__PURE__ */ r(
|
|
472
|
+
) : c ? /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ r(
|
|
473
473
|
"a",
|
|
474
474
|
{
|
|
475
475
|
href: s,
|
|
476
476
|
target: "_blank",
|
|
477
477
|
rel: "noopener noreferrer",
|
|
478
|
-
className:
|
|
478
|
+
className: h(
|
|
479
479
|
"block size-fit max-w-[min(100%,16rem)] shrink-0 rounded-2xl border",
|
|
480
480
|
"bg-background/80 transition-colors hover:bg-accent/60",
|
|
481
481
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
@@ -484,7 +484,7 @@ function Ft({ attachment: e }) {
|
|
|
484
484
|
/* @__PURE__ */ r(
|
|
485
485
|
"div",
|
|
486
486
|
{
|
|
487
|
-
className:
|
|
487
|
+
className: h(
|
|
488
488
|
"flex size-10 shrink-0 items-center justify-center rounded-xl",
|
|
489
489
|
"bg-secondary text-muted-foreground"
|
|
490
490
|
),
|
|
@@ -496,7 +496,7 @@ function Ft({ attachment: e }) {
|
|
|
496
496
|
/* @__PURE__ */ r(
|
|
497
497
|
"span",
|
|
498
498
|
{
|
|
499
|
-
className:
|
|
499
|
+
className: h(
|
|
500
500
|
"text-xs font-medium text-foreground line-clamp-1",
|
|
501
501
|
"break-words [word-break:break-word]"
|
|
502
502
|
// `[word-break:break-word]` is deprecated but works in the browser, while `break-words` which is `[overflow-wrap: break-word]` does not work
|
|
@@ -511,14 +511,14 @@ function Ft({ attachment: e }) {
|
|
|
511
511
|
] })
|
|
512
512
|
] })
|
|
513
513
|
}
|
|
514
|
-
) }) : /* @__PURE__ */ r(
|
|
514
|
+
) }) : /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ r("div", { className: "size-fit border shrink-0 rounded-2xl overflow-hidden", children: /* @__PURE__ */ d("div", { className: "flex items-end gap-2 p-2", children: [
|
|
515
515
|
/* @__PURE__ */ r(
|
|
516
516
|
"a",
|
|
517
517
|
{
|
|
518
518
|
href: s,
|
|
519
519
|
target: "_blank",
|
|
520
520
|
rel: "noopener noreferrer",
|
|
521
|
-
className:
|
|
521
|
+
className: h(
|
|
522
522
|
"text-xs text-blue-500 line-clamp-2 underline hover:text-blue-600",
|
|
523
523
|
"break-words [word-break:break-word]"
|
|
524
524
|
// `[word-break:break-word]` is deprecated but works in the browser, while `break-words` which is `[overflow-wrap: break-word]` does not work
|
|
@@ -532,7 +532,7 @@ function Ft({ attachment: e }) {
|
|
|
532
532
|
] })
|
|
533
533
|
] }) }) });
|
|
534
534
|
}
|
|
535
|
-
const Ht =
|
|
535
|
+
const Ht = L.memo(
|
|
536
536
|
Ar,
|
|
537
537
|
(e, o) => e.children === o.children && e.className === o.className
|
|
538
538
|
);
|
|
@@ -541,7 +541,7 @@ function Ne({
|
|
|
541
541
|
messageType: o,
|
|
542
542
|
messageId: t
|
|
543
543
|
}) {
|
|
544
|
-
const { anchorTarget: n } =
|
|
544
|
+
const { anchorTarget: n } = C();
|
|
545
545
|
return /* @__PURE__ */ r(
|
|
546
546
|
Ht,
|
|
547
547
|
{
|
|
@@ -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
|
}
|
|
@@ -581,15 +581,15 @@ function Ne({
|
|
|
581
581
|
function te() {
|
|
582
582
|
const {
|
|
583
583
|
widgetCtx: { org: e }
|
|
584
|
-
} =
|
|
584
|
+
} = O(), {
|
|
585
585
|
sessionState: { session: o }
|
|
586
|
-
} =
|
|
586
|
+
} = U(), t = C(), {
|
|
587
587
|
messagesState: { messages: n }
|
|
588
|
-
} =
|
|
588
|
+
} = A(), {
|
|
589
589
|
routerState: { screen: s }
|
|
590
|
-
} =
|
|
590
|
+
} = H();
|
|
591
591
|
return {
|
|
592
|
-
react:
|
|
592
|
+
react: L,
|
|
593
593
|
org: e,
|
|
594
594
|
session: o,
|
|
595
595
|
config: t,
|
|
@@ -610,34 +610,34 @@ 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
|
{
|
|
624
|
-
...
|
|
625
|
-
className:
|
|
624
|
+
...w((c == null ? void 0 : c.messageContainer) ?? "chat/agent_msg/root"),
|
|
625
|
+
className: h(
|
|
626
626
|
"w-5/6 flex flex-col items-start gap-1",
|
|
627
627
|
p == null ? void 0 : p.messageContainer
|
|
628
628
|
),
|
|
629
629
|
children: [
|
|
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((
|
|
631
|
-
|
|
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
|
+
f.length > 0 && /* @__PURE__ */ d("div", { className: "flex flex-row gap-2", children: [
|
|
632
632
|
/* @__PURE__ */ r(
|
|
633
633
|
"div",
|
|
634
634
|
{
|
|
635
|
-
...
|
|
636
|
-
"data-first":
|
|
637
|
-
"data-last":
|
|
635
|
+
...w((c == null ? void 0 : c.message) ?? "chat/agent_msg/msg"),
|
|
636
|
+
"data-first": i,
|
|
637
|
+
"data-last": a,
|
|
638
638
|
"data-alone": l,
|
|
639
639
|
"data-variant": x,
|
|
640
|
-
className:
|
|
640
|
+
className: h(
|
|
641
641
|
"transition-all",
|
|
642
642
|
"w-fit py-3 px-4 rounded-3xl bg-secondary text-secondary-foreground",
|
|
643
643
|
"leading-snug text-sm prose prose-sm prose-a:decoration-primary prose-a:underline",
|
|
@@ -647,12 +647,12 @@ function fe(e) {
|
|
|
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 })
|
|
@@ -668,7 +668,7 @@ const Se = J.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
|
668
668
|
ee.Root,
|
|
669
669
|
{
|
|
670
670
|
ref: t,
|
|
671
|
-
className:
|
|
671
|
+
className: h(
|
|
672
672
|
"relative flex size-6 aspect-square shrink-0 overflow-hidden rounded-full bg-secondary",
|
|
673
673
|
// 'border',
|
|
674
674
|
e
|
|
@@ -681,7 +681,7 @@ const _e = J.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
|
681
681
|
ee.Image,
|
|
682
682
|
{
|
|
683
683
|
ref: t,
|
|
684
|
-
className:
|
|
684
|
+
className: h("aspect-square h-full w-full", e),
|
|
685
685
|
...o
|
|
686
686
|
}
|
|
687
687
|
));
|
|
@@ -690,7 +690,7 @@ const Ie = J.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ r(
|
|
|
690
690
|
ee.Fallback,
|
|
691
691
|
{
|
|
692
692
|
ref: t,
|
|
693
|
-
className:
|
|
693
|
+
className: h(
|
|
694
694
|
"flex size-full text-xs items-center justify-center rounded-lg",
|
|
695
695
|
e
|
|
696
696
|
),
|
|
@@ -710,17 +710,17 @@ 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",
|
|
717
717
|
children: [
|
|
718
718
|
/* @__PURE__ */ r(xe, { agent: e }),
|
|
719
719
|
/* @__PURE__ */ d(
|
|
720
720
|
"div",
|
|
721
721
|
{
|
|
722
|
-
...
|
|
723
|
-
className:
|
|
722
|
+
...w("chat/bot_loading/bouncing_dots_container"),
|
|
723
|
+
className: h(
|
|
724
724
|
"flex items-center [&_span]:bg-secondary-foreground [&_span]:size-1 gap-1 p-2 rounded-xl bg-secondary"
|
|
725
725
|
// 'border',
|
|
726
726
|
),
|
|
@@ -740,7 +740,7 @@ const Wt = '*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;-
|
|
|
740
740
|
{
|
|
741
741
|
ref: n,
|
|
742
742
|
sideOffset: o,
|
|
743
|
-
className:
|
|
743
|
+
className: h(
|
|
744
744
|
"z-50 overflow-hidden max-w-xs rounded-xl bg-primary border text-primary-foreground p-2 text-center align-middle text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
745
745
|
e
|
|
746
746
|
),
|
|
@@ -754,7 +754,7 @@ function oe({
|
|
|
754
754
|
side: t,
|
|
755
755
|
align: n
|
|
756
756
|
}) {
|
|
757
|
-
const { disableTooltips: s } =
|
|
757
|
+
const { disableTooltips: s } = C();
|
|
758
758
|
return !o || s ? e : /* @__PURE__ */ d(oo, { children: [
|
|
759
759
|
/* @__PURE__ */ r(no, { asChild: !0, children: e }),
|
|
760
760
|
/* @__PURE__ */ r(
|
|
@@ -769,12 +769,12 @@ function oe({
|
|
|
769
769
|
)
|
|
770
770
|
] });
|
|
771
771
|
}
|
|
772
|
-
const
|
|
773
|
-
function
|
|
774
|
-
const [e, o] =
|
|
775
|
-
return
|
|
772
|
+
const mt = 450;
|
|
773
|
+
function $() {
|
|
774
|
+
const [e, o] = L.useState(() => (window.top || window).innerWidth < mt);
|
|
775
|
+
return L.useEffect(() => {
|
|
776
776
|
const t = window.top || window, n = () => {
|
|
777
|
-
o(t.innerWidth <
|
|
777
|
+
o(t.innerWidth < mt);
|
|
778
778
|
};
|
|
779
779
|
return n(), t.addEventListener("resize", n), () => {
|
|
780
780
|
t.removeEventListener("resize", n);
|
|
@@ -786,17 +786,17 @@ const ce = {
|
|
|
786
786
|
transitionDuration: "1000ms"
|
|
787
787
|
};
|
|
788
788
|
function G() {
|
|
789
|
-
var x,
|
|
790
|
-
const { dir: e } = ye(), { isSmallScreen: o } =
|
|
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
791
|
zIndex: ((x = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : x.zIndex) ?? 1e7,
|
|
792
792
|
offset: {
|
|
793
|
-
bottom: ((
|
|
794
|
-
right: ((
|
|
795
|
-
left: ((v = (
|
|
793
|
+
bottom: ((k = (m = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : m.offset) == null ? void 0 : k.bottom) ?? 20,
|
|
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: ((u = (
|
|
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;
|
|
@@ -806,12 +806,12 @@ function G() {
|
|
|
806
806
|
primaryColor: (t == null ? void 0 : t.primaryColor) ?? "hsl(0 0% 9%)",
|
|
807
807
|
widgetTrigger: l,
|
|
808
808
|
widgetContentContainer: {
|
|
809
|
-
borderRadius: o ? "0px" : ((
|
|
810
|
-
zIndex: ((
|
|
811
|
-
outline: ((
|
|
809
|
+
borderRadius: o ? "0px" : ((I = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : I.borderRadius) ?? "32px",
|
|
810
|
+
zIndex: ((j = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : j.zIndex) ?? l.zIndex + 1,
|
|
811
|
+
outline: ((M = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : M.outline) ?? "none",
|
|
812
812
|
// was: '1px solid'
|
|
813
|
-
outlineColor: ((
|
|
814
|
-
boxShadow: ((
|
|
813
|
+
outlineColor: ((g = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : g.outlineColor) ?? "hsl(0 0% 50% / .5)",
|
|
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,
|
|
817
817
|
transitionDuration: ((je = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : je.transitionDuration) ?? ce.transitionDuration,
|
|
@@ -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
|
|
@@ -980,11 +980,11 @@ function $t(e) {
|
|
|
980
980
|
case "slate":
|
|
981
981
|
return s;
|
|
982
982
|
default:
|
|
983
|
-
return
|
|
983
|
+
return F(e, $t.name), o;
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
986
|
function Bt() {
|
|
987
|
-
const { contentIframeRef: e } =
|
|
987
|
+
const { contentIframeRef: e } = O(), { inline: o } = C();
|
|
988
988
|
return {
|
|
989
989
|
setWidth: (t) => {
|
|
990
990
|
var n;
|
|
@@ -1006,12 +1006,12 @@ function Te({
|
|
|
1006
1006
|
width: e,
|
|
1007
1007
|
height: o
|
|
1008
1008
|
}) {
|
|
1009
|
-
const { isSmallScreen: t } =
|
|
1009
|
+
const { isSmallScreen: t } = $(), { setWidth: n, setHeight: s } = Bt();
|
|
1010
1010
|
se(() => {
|
|
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,13 +1031,13 @@ 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
|
-
return hr;
|
|
1039
|
-
case "Minimize2":
|
|
1040
1038
|
return mr;
|
|
1039
|
+
case "Minimize2":
|
|
1040
|
+
return hr;
|
|
1041
1041
|
case "Shrink":
|
|
1042
1042
|
return pr;
|
|
1043
1043
|
case "SquareCheck":
|
|
@@ -1049,12 +1049,12 @@ 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
|
|
1054
|
+
return F(e, ne.name), gt;
|
|
1055
1055
|
}
|
|
1056
1056
|
})();
|
|
1057
|
-
return /* @__PURE__ */ r(t, { className:
|
|
1057
|
+
return /* @__PURE__ */ r(t, { className: h("size-4", o) });
|
|
1058
1058
|
}
|
|
1059
1059
|
function ao() {
|
|
1060
1060
|
var t;
|
|
@@ -1069,20 +1069,20 @@ function io({ fallback: e }) {
|
|
|
1069
1069
|
function Me() {
|
|
1070
1070
|
const {
|
|
1071
1071
|
widgetCtx: { org: e }
|
|
1072
|
-
} =
|
|
1072
|
+
} = O(), {
|
|
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:
|
|
1085
|
-
|
|
1085
|
+
F(o, Me.name);
|
|
1086
1086
|
return;
|
|
1087
1087
|
}
|
|
1088
1088
|
})() ?? e.name ?? "Chat";
|
|
@@ -1090,23 +1090,23 @@ function Me() {
|
|
|
1090
1090
|
function lo(e) {
|
|
1091
1091
|
switch (e) {
|
|
1092
1092
|
case "chat":
|
|
1093
|
-
return
|
|
1093
|
+
return w("chat/header");
|
|
1094
1094
|
case "sessions":
|
|
1095
|
-
return
|
|
1095
|
+
return w("sessions/header");
|
|
1096
1096
|
case "welcome":
|
|
1097
1097
|
return;
|
|
1098
1098
|
default:
|
|
1099
|
-
|
|
1099
|
+
F(e, Me.name);
|
|
1100
1100
|
return;
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
function co() {
|
|
1104
|
-
const { router: e } =
|
|
1104
|
+
const { router: e } = C(), {
|
|
1105
1105
|
routerState: { screen: o },
|
|
1106
1106
|
toSessionsScreen: t
|
|
1107
|
-
} =
|
|
1107
|
+
} = H();
|
|
1108
1108
|
return o !== "chat" || e != null && e.chatScreenOnly ? null : /* @__PURE__ */ r(
|
|
1109
|
-
|
|
1109
|
+
N,
|
|
1110
1110
|
{
|
|
1111
1111
|
variant: "ghost",
|
|
1112
1112
|
size: "fit",
|
|
@@ -1119,9 +1119,9 @@ function co() {
|
|
|
1119
1119
|
function po({
|
|
1120
1120
|
button: e
|
|
1121
1121
|
}) {
|
|
1122
|
-
const { setIsOpen: o } = V(), { isSmallScreen: t } =
|
|
1122
|
+
const { setIsOpen: o } = V(), { isSmallScreen: t } = $();
|
|
1123
1123
|
return t && e.hideOnSmallScreen || !t && e.hideOnLargeScreen ? null : /* @__PURE__ */ r(
|
|
1124
|
-
|
|
1124
|
+
N,
|
|
1125
1125
|
{
|
|
1126
1126
|
variant: "ghost",
|
|
1127
1127
|
size: "fit",
|
|
@@ -1139,39 +1139,39 @@ function ve({
|
|
|
1139
1139
|
}) {
|
|
1140
1140
|
const [o, t] = D(!1), {
|
|
1141
1141
|
routerState: { screen: n }
|
|
1142
|
-
} =
|
|
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
|
|
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
|
|
1160
|
+
return F(n, ve.name), i.screens.chat.width;
|
|
1161
1161
|
}
|
|
1162
|
-
})(),
|
|
1162
|
+
})(), f = () => {
|
|
1163
1163
|
t((x) => {
|
|
1164
|
-
const
|
|
1165
|
-
return l(
|
|
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(
|
|
1169
|
-
|
|
1169
|
+
N,
|
|
1170
1170
|
{
|
|
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
|
{
|
|
@@ -1184,8 +1184,8 @@ function ve({
|
|
|
1184
1184
|
function Yt({
|
|
1185
1185
|
button: e
|
|
1186
1186
|
}) {
|
|
1187
|
-
var
|
|
1188
|
-
const { close: o } =
|
|
1187
|
+
var z, _;
|
|
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
1189
|
const { success: v, error: R } = await s();
|
|
1190
1190
|
if (o(), !v) return console.error(R);
|
|
1191
1191
|
switch (p) {
|
|
@@ -1201,21 +1201,21 @@ function Yt({
|
|
|
1201
1201
|
n(!1), t.resetChat();
|
|
1202
1202
|
break;
|
|
1203
1203
|
default:
|
|
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":
|
|
1213
1213
|
n(!1);
|
|
1214
1214
|
break;
|
|
1215
1215
|
default:
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1216
|
+
F(
|
|
1217
|
+
f,
|
|
1218
|
+
b.name
|
|
1219
1219
|
);
|
|
1220
1220
|
}
|
|
1221
1221
|
if (c)
|
|
@@ -1234,22 +1234,22 @@ function Yt({
|
|
|
1234
1234
|
}, 200);
|
|
1235
1235
|
break;
|
|
1236
1236
|
default:
|
|
1237
|
-
|
|
1237
|
+
F(
|
|
1238
1238
|
x,
|
|
1239
|
-
|
|
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(
|
|
1247
|
-
|
|
1247
|
+
N,
|
|
1248
1248
|
{
|
|
1249
1249
|
variant: "ghost",
|
|
1250
1250
|
size: "fit",
|
|
1251
1251
|
className: "rounded-full",
|
|
1252
|
-
disabled:
|
|
1252
|
+
disabled: m,
|
|
1253
1253
|
children: /* @__PURE__ */ r(ne, { name: e.icon })
|
|
1254
1254
|
}
|
|
1255
1255
|
),
|
|
@@ -1258,20 +1258,20 @@ function Yt({
|
|
|
1258
1258
|
/* @__PURE__ */ r(jt, { children: /* @__PURE__ */ r(Ot, { children: e.confirmation.description || "Are you sure you want to close this conversation?" }) }),
|
|
1259
1259
|
/* @__PURE__ */ d(Pt, { children: [
|
|
1260
1260
|
/* @__PURE__ */ r(
|
|
1261
|
-
|
|
1261
|
+
N,
|
|
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
|
),
|
|
1269
1269
|
/* @__PURE__ */ r(
|
|
1270
|
-
|
|
1270
|
+
N,
|
|
1271
1271
|
{
|
|
1272
1272
|
variant: "destructive",
|
|
1273
|
-
onClick:
|
|
1274
|
-
disabled:
|
|
1273
|
+
onClick: k,
|
|
1274
|
+
disabled: i.isResolvingSession,
|
|
1275
1275
|
children: e.confirmation.confirmButtonText || "Yes"
|
|
1276
1276
|
}
|
|
1277
1277
|
)
|
|
@@ -1279,13 +1279,13 @@ function Yt({
|
|
|
1279
1279
|
] })
|
|
1280
1280
|
}
|
|
1281
1281
|
) : /* @__PURE__ */ r(
|
|
1282
|
-
|
|
1282
|
+
N,
|
|
1283
1283
|
{
|
|
1284
1284
|
variant: "ghost",
|
|
1285
1285
|
size: "fit",
|
|
1286
1286
|
className: "rounded-full",
|
|
1287
|
-
onClick: c || l ?
|
|
1288
|
-
disabled:
|
|
1287
|
+
onClick: c || l ? b : k,
|
|
1288
|
+
disabled: m,
|
|
1289
1289
|
children: /* @__PURE__ */ r(ne, { name: e.icon })
|
|
1290
1290
|
}
|
|
1291
1291
|
);
|
|
@@ -1299,19 +1299,19 @@ function be({ button: e }) {
|
|
|
1299
1299
|
case "resolve-session":
|
|
1300
1300
|
return /* @__PURE__ */ r(Yt, { button: e });
|
|
1301
1301
|
default:
|
|
1302
|
-
return
|
|
1302
|
+
return F(e, be.name), null;
|
|
1303
1303
|
}
|
|
1304
1304
|
}
|
|
1305
|
-
const
|
|
1305
|
+
const ho = {
|
|
1306
1306
|
functionality: "close-widget",
|
|
1307
1307
|
hideOnLargeScreen: !0,
|
|
1308
1308
|
icon: "X"
|
|
1309
1309
|
};
|
|
1310
|
-
function
|
|
1310
|
+
function mo() {
|
|
1311
1311
|
const {
|
|
1312
1312
|
routerState: { screen: e }
|
|
1313
|
-
} =
|
|
1314
|
-
return !t || t.length === 0 ? /* @__PURE__ */ r(be, { button:
|
|
1313
|
+
} = H(), { headerButtons: o } = C(), t = e === "chat" ? o == null ? void 0 : o.chatScreen : e === "sessions" ? o == null ? void 0 : o.sessionsScreen : [];
|
|
1314
|
+
return !t || t.length === 0 ? /* @__PURE__ */ r(be, { button: ho }) : /* @__PURE__ */ r(Q, { children: t.map((n) => /* @__PURE__ */ r(
|
|
1315
1315
|
be,
|
|
1316
1316
|
{
|
|
1317
1317
|
button: n
|
|
@@ -1322,14 +1322,14 @@ function ho() {
|
|
|
1322
1322
|
function Ut() {
|
|
1323
1323
|
const {
|
|
1324
1324
|
routerState: { screen: e }
|
|
1325
|
-
} =
|
|
1325
|
+
} = H(), o = lo(e), t = Me();
|
|
1326
1326
|
return /* @__PURE__ */ d("header", { ...o, className: "py-2 px-4 shrink-0", children: [
|
|
1327
1327
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1328
1328
|
/* @__PURE__ */ r(co, {}),
|
|
1329
1329
|
/* @__PURE__ */ r(
|
|
1330
1330
|
"div",
|
|
1331
1331
|
{
|
|
1332
|
-
className:
|
|
1332
|
+
className: h(
|
|
1333
1333
|
"flex-1 h-8 flex items-center",
|
|
1334
1334
|
e === "sessions" && "ps-2"
|
|
1335
1335
|
),
|
|
@@ -1341,30 +1341,30 @@ function Ut() {
|
|
|
1341
1341
|
)
|
|
1342
1342
|
}
|
|
1343
1343
|
),
|
|
1344
|
-
/* @__PURE__ */ r(
|
|
1344
|
+
/* @__PURE__ */ r(mo, {})
|
|
1345
1345
|
] }),
|
|
1346
1346
|
/* @__PURE__ */ r(ao, {})
|
|
1347
1347
|
] });
|
|
1348
1348
|
}
|
|
1349
1349
|
function Xt({ className: e }) {
|
|
1350
|
-
return /* @__PURE__ */ r(kr, { className:
|
|
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();
|
|
1356
1356
|
return {
|
|
1357
1357
|
isCanvasOpen: !e && !o && !!t && !!n
|
|
1358
1358
|
};
|
|
1359
1359
|
}
|
|
1360
|
-
function
|
|
1361
|
-
const e = te(), { activeMode: o, Component: t } = yt(), { sendMessage: n } =
|
|
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,19 +1374,19 @@ 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
|
}
|
|
1381
|
-
const
|
|
1381
|
+
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,
|
|
1389
|
-
className:
|
|
1389
|
+
className: h("overflow-hidden", e.className),
|
|
1390
1390
|
overrides: {
|
|
1391
1391
|
initial: { height: 0, opacity: 0, ...(t = e.overrides) == null ? void 0 : t.initial },
|
|
1392
1392
|
animate: { height: "auto", opacity: 1, ...(n = e.overrides) == null ? void 0 : n.animate },
|
|
@@ -1396,7 +1396,7 @@ const H = W.forwardRef(
|
|
|
1396
1396
|
);
|
|
1397
1397
|
}
|
|
1398
1398
|
);
|
|
1399
|
-
|
|
1399
|
+
W.displayName = "MotionDiv__VerticalReveal";
|
|
1400
1400
|
const wo = [
|
|
1401
1401
|
{
|
|
1402
1402
|
label: "Terrible",
|
|
@@ -1425,58 +1425,58 @@ const wo = [
|
|
|
1425
1425
|
}
|
|
1426
1426
|
];
|
|
1427
1427
|
function fo() {
|
|
1428
|
-
const { isSmallScreen: e } =
|
|
1428
|
+
const { isSmallScreen: e } = $(), {
|
|
1429
1429
|
submitCsat: o,
|
|
1430
1430
|
isCsatRequested: t,
|
|
1431
1431
|
isCsatSubmitted: n,
|
|
1432
1432
|
submittedScore: s,
|
|
1433
|
-
submittedFeedback:
|
|
1434
|
-
} = kt(), [
|
|
1435
|
-
l((
|
|
1433
|
+
submittedFeedback: i
|
|
1434
|
+
} = kt(), [a, l] = D(null), [c, p] = D(null), f = (m) => {
|
|
1435
|
+
l((k) => k === m ? null : m);
|
|
1436
1436
|
}, x = () => {
|
|
1437
|
-
|
|
1438
|
-
score:
|
|
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
|
{
|
|
1447
|
-
className:
|
|
1447
|
+
className: h(
|
|
1448
1448
|
"flex gap-4 justify-between pt-2 px-2 pb-2",
|
|
1449
1449
|
"transition-all",
|
|
1450
1450
|
n && "gap-0 justify-center"
|
|
1451
1451
|
),
|
|
1452
|
-
children: wo.map((
|
|
1453
|
-
|
|
1452
|
+
children: wo.map((m) => /* @__PURE__ */ r(
|
|
1453
|
+
N,
|
|
1454
1454
|
{
|
|
1455
|
-
variant:
|
|
1455
|
+
variant: m.value === a ? "secondary" : "ghost",
|
|
1456
1456
|
size: "selfless",
|
|
1457
|
-
className:
|
|
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
|
-
|
|
1464
|
-
n &&
|
|
1465
|
-
n &&
|
|
1462
|
+
!a && "opacity-100",
|
|
1463
|
+
m.value === a && "opacity-100",
|
|
1464
|
+
n && m.value !== s && "opacity-0 size-0",
|
|
1465
|
+
n && m.value === s && "opacity-100 size-fit text-4xl"
|
|
1466
1466
|
),
|
|
1467
|
-
onClick: t ? () =>
|
|
1468
|
-
children:
|
|
1467
|
+
onClick: t ? () => f(m.value) : void 0,
|
|
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
|
{
|
|
1478
1478
|
rows: 3,
|
|
1479
|
-
className:
|
|
1479
|
+
className: h(
|
|
1480
1480
|
"transition-all",
|
|
1481
1481
|
"max-h-40 [field-sizing:content]",
|
|
1482
1482
|
"w-full resize-none",
|
|
@@ -1486,19 +1486,19 @@ function fo() {
|
|
|
1486
1486
|
e ? "text-[16px]" : "text-sm",
|
|
1487
1487
|
n && "text-center"
|
|
1488
1488
|
),
|
|
1489
|
-
value: n ?
|
|
1490
|
-
onChange: t ? (
|
|
1489
|
+
value: n ? i || "" : c || "",
|
|
1490
|
+
onChange: t ? (m) => p(m.target.value) : void 0,
|
|
1491
1491
|
readOnly: n,
|
|
1492
1492
|
placeholder: t ? "Tell us more... (optional)" : void 0
|
|
1493
1493
|
}
|
|
1494
1494
|
),
|
|
1495
1495
|
/* @__PURE__ */ r(
|
|
1496
|
-
|
|
1496
|
+
N,
|
|
1497
1497
|
{
|
|
1498
1498
|
size: "fit",
|
|
1499
1499
|
onClick: x,
|
|
1500
|
-
disabled: !
|
|
1501
|
-
className:
|
|
1500
|
+
disabled: !a,
|
|
1501
|
+
className: h(
|
|
1502
1502
|
"transition-all overflow-hidden",
|
|
1503
1503
|
"rounded-full size-8 flex items-center justify-center p-0",
|
|
1504
1504
|
n && "opacity-0 size-0"
|
|
@@ -1507,11 +1507,11 @@ function fo() {
|
|
|
1507
1507
|
}
|
|
1508
1508
|
)
|
|
1509
1509
|
] }) }, "feedback-box") }),
|
|
1510
|
-
/* @__PURE__ */ r("div", { className:
|
|
1510
|
+
/* @__PURE__ */ r("div", { className: h("h-0 transition-[height]", n && "h-4") })
|
|
1511
1511
|
] });
|
|
1512
1512
|
}
|
|
1513
1513
|
function Z() {
|
|
1514
|
-
const { dir: e } = ye(), o =
|
|
1514
|
+
const { dir: e } = ye(), o = C();
|
|
1515
1515
|
return bt(() => {
|
|
1516
1516
|
const t = Fr(o.language) ? o.language : "en";
|
|
1517
1517
|
return {
|
|
@@ -1527,16 +1527,16 @@ function De({
|
|
|
1527
1527
|
className: o,
|
|
1528
1528
|
...t
|
|
1529
1529
|
}) {
|
|
1530
|
-
const { sendMessage: n } =
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1530
|
+
const { sendMessage: n } = A(), s = () => {
|
|
1531
|
+
const i = e.trim();
|
|
1532
|
+
i && n({ content: i });
|
|
1533
1533
|
};
|
|
1534
1534
|
return /* @__PURE__ */ r(
|
|
1535
|
-
|
|
1535
|
+
N,
|
|
1536
1536
|
{
|
|
1537
|
-
...
|
|
1537
|
+
...w("chat/suggested_reply_btn"),
|
|
1538
1538
|
size: "sm",
|
|
1539
|
-
className:
|
|
1539
|
+
className: h("rounded-xl w-fit", o),
|
|
1540
1540
|
...t,
|
|
1541
1541
|
onClick: s,
|
|
1542
1542
|
children: e
|
|
@@ -1548,7 +1548,7 @@ function xo() {
|
|
|
1548
1548
|
return /* @__PURE__ */ r(
|
|
1549
1549
|
"div",
|
|
1550
1550
|
{
|
|
1551
|
-
...
|
|
1551
|
+
...w("chat/might_solve_user_issue_suggested_replies_container"),
|
|
1552
1552
|
className: "flex items-center gap-2 p-2 pb-0 flex-wrap",
|
|
1553
1553
|
children: o.map((t) => /* @__PURE__ */ r(
|
|
1554
1554
|
De,
|
|
@@ -1561,23 +1561,23 @@ function xo() {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
);
|
|
1563
1563
|
}
|
|
1564
|
-
function
|
|
1565
|
-
const { sessionState: e } =
|
|
1566
|
-
return /* @__PURE__ */ r(T, { mode: "wait", children: o == null ? void 0 : o.map((s,
|
|
1564
|
+
function ut() {
|
|
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, 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" });
|
|
@@ -1608,19 +1608,19 @@ function vo({
|
|
|
1608
1608
|
children: /* @__PURE__ */ d(
|
|
1609
1609
|
"div",
|
|
1610
1610
|
{
|
|
1611
|
-
className:
|
|
1611
|
+
className: h(
|
|
1612
1612
|
e === "uploading" && "opacity-50",
|
|
1613
1613
|
"group",
|
|
1614
1614
|
"size-12 border rounded-2xl overflow-hidden relative",
|
|
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
|
{
|
|
1622
1622
|
type: "button",
|
|
1623
|
-
className:
|
|
1623
|
+
className: h(
|
|
1624
1624
|
"absolute bg-black/50 inset-0 size-full z-10 opacity-0",
|
|
1625
1625
|
"flex items-center justify-center",
|
|
1626
1626
|
"opacity-0 group-hover:opacity-100 transition"
|
|
@@ -1637,46 +1637,46 @@ function vo({
|
|
|
1637
1637
|
);
|
|
1638
1638
|
}
|
|
1639
1639
|
function bo() {
|
|
1640
|
-
var
|
|
1641
|
-
const { isSmallScreen: e } =
|
|
1642
|
-
allFiles:
|
|
1643
|
-
emptyTheFiles:
|
|
1644
|
-
handleCancelUpload:
|
|
1645
|
-
appendFiles:
|
|
1646
|
-
isUploading:
|
|
1647
|
-
successFiles:
|
|
1648
|
-
} = er(),
|
|
1649
|
-
|
|
1650
|
-
},
|
|
1651
|
-
if (
|
|
1652
|
-
|
|
1653
|
-
const
|
|
1640
|
+
var M;
|
|
1641
|
+
const { isSmallScreen: e } = $(), o = B(null), { sendMessage: t } = A(), { sessionState: n } = U(), { disableSendingWhenAwaitingAIReply: s } = C(), { t: i } = Z(), [a, l] = D(""), {
|
|
1642
|
+
allFiles: c,
|
|
1643
|
+
emptyTheFiles: p,
|
|
1644
|
+
handleCancelUpload: f,
|
|
1645
|
+
appendFiles: x,
|
|
1646
|
+
isUploading: m,
|
|
1647
|
+
successFiles: k
|
|
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
|
+
if (_ || R) return;
|
|
1652
|
+
m && console.info("please wait for the file(s) to upload");
|
|
1653
|
+
const g = a.trim();
|
|
1654
1654
|
t({
|
|
1655
|
-
content:
|
|
1656
|
-
attachments:
|
|
1657
|
-
(
|
|
1655
|
+
content: g,
|
|
1656
|
+
attachments: k.flatMap(
|
|
1657
|
+
(S) => S.fileUrl ? [
|
|
1658
1658
|
{
|
|
1659
|
-
url:
|
|
1660
|
-
type:
|
|
1661
|
-
name:
|
|
1662
|
-
id:
|
|
1663
|
-
size:
|
|
1659
|
+
url: S.fileUrl,
|
|
1660
|
+
type: S.file.type,
|
|
1661
|
+
name: S.file.name,
|
|
1662
|
+
id: S.id,
|
|
1663
|
+
size: S.file.size
|
|
1664
1664
|
}
|
|
1665
1665
|
] : []
|
|
1666
1666
|
)
|
|
1667
|
-
}),
|
|
1667
|
+
}), l(""), p();
|
|
1668
1668
|
}, {
|
|
1669
|
-
getRootProps:
|
|
1670
|
-
getInputProps:
|
|
1671
|
-
open:
|
|
1669
|
+
getRootProps: E,
|
|
1670
|
+
getInputProps: u,
|
|
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,23 +1687,23 @@ function bo() {
|
|
|
1687
1687
|
"image/webp": [".webp"],
|
|
1688
1688
|
"application/pdf": [".pdf"]
|
|
1689
1689
|
}
|
|
1690
|
-
}),
|
|
1691
|
-
const
|
|
1692
|
-
|
|
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",
|
|
1696
1696
|
{
|
|
1697
|
-
...
|
|
1697
|
+
...w("chat/input_box/root"),
|
|
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
|
{
|
|
1705
|
-
...
|
|
1706
|
-
className:
|
|
1705
|
+
...w("chat/input_box/inner_root"),
|
|
1706
|
+
className: h(
|
|
1707
1707
|
"transition-all",
|
|
1708
1708
|
"bg-white",
|
|
1709
1709
|
// 'border',
|
|
@@ -1714,48 +1714,48 @@ function bo() {
|
|
|
1714
1714
|
/* @__PURE__ */ d(
|
|
1715
1715
|
"div",
|
|
1716
1716
|
{
|
|
1717
|
-
...
|
|
1717
|
+
...w("chat/input_box/textarea_and_attachments_container"),
|
|
1718
1718
|
className: "flex flex-col gap-2",
|
|
1719
1719
|
children: [
|
|
1720
|
-
|
|
1720
|
+
c.length > 0 && /* @__PURE__ */ r(
|
|
1721
1721
|
"div",
|
|
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:
|
|
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(
|
|
1735
1735
|
"textarea",
|
|
1736
1736
|
{
|
|
1737
|
-
...
|
|
1738
|
-
onPaste:
|
|
1737
|
+
...w("chat/input_box/textarea"),
|
|
1738
|
+
onPaste: j,
|
|
1739
1739
|
ref: o,
|
|
1740
1740
|
id: "chat-input",
|
|
1741
1741
|
value: a,
|
|
1742
1742
|
rows: 3,
|
|
1743
|
-
className:
|
|
1743
|
+
className: h(
|
|
1744
1744
|
/** Match the border radius of the container */
|
|
1745
1745
|
// INPUT_CONTAINER_B_RADIUS,
|
|
1746
1746
|
"max-h-16 [field-sizing:content]",
|
|
1747
1747
|
"w-full resize-none px-2",
|
|
1748
|
-
|
|
1748
|
+
c.length === 0 && "pt-1",
|
|
1749
1749
|
"bg-transparent outline-none",
|
|
1750
1750
|
"placeholder:text-muted-foreground",
|
|
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
|
]
|
|
@@ -1769,27 +1769,27 @@ function bo() {
|
|
|
1769
1769
|
align: "start",
|
|
1770
1770
|
content: "attach images or PDF (maximum size 5mb)",
|
|
1771
1771
|
children: /* @__PURE__ */ r(
|
|
1772
|
-
|
|
1772
|
+
N,
|
|
1773
1773
|
{
|
|
1774
|
-
onClick:
|
|
1774
|
+
onClick: I,
|
|
1775
1775
|
size: "fit",
|
|
1776
1776
|
variant: "ghost",
|
|
1777
|
-
className:
|
|
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:
|
|
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
|
}
|
|
1784
1784
|
),
|
|
1785
1785
|
/* @__PURE__ */ r(oe, { content: "send message", side: "top", align: "end", children: /* @__PURE__ */ r(
|
|
1786
|
-
|
|
1786
|
+
N,
|
|
1787
1787
|
{
|
|
1788
1788
|
size: "fit",
|
|
1789
|
-
onClick:
|
|
1790
|
-
disabled:
|
|
1789
|
+
onClick: P,
|
|
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:
|
|
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
|
] })
|
|
@@ -1801,15 +1801,15 @@ function bo() {
|
|
|
1801
1801
|
);
|
|
1802
1802
|
}
|
|
1803
1803
|
function wt() {
|
|
1804
|
-
const { widgetCtx: e } =
|
|
1805
|
-
return /* @__PURE__ */ r(Q, { children: t || o != null && o.chatScreenOnly ? /* @__PURE__ */ r(
|
|
1804
|
+
const { widgetCtx: e } = O(), { router: o } = C(), { canCreateNewSession: t } = U(), { toSessionsScreen: n } = H(), { t: s } = Z();
|
|
1805
|
+
return /* @__PURE__ */ r(Q, { children: t || o != null && o.chatScreenOnly ? /* @__PURE__ */ r(N, { onClick: e.resetChat, className: "rounded-2xl w-full", children: s("new_conversation") }) : /* @__PURE__ */ r(N, { onClick: n, className: "rounded-2xl w-full", children: s("back_to_conversations") }) });
|
|
1806
1806
|
}
|
|
1807
1807
|
function yo() {
|
|
1808
1808
|
const { t: e } = Z(), { isCsatRequested: o, isCsatSubmitted: t } = kt();
|
|
1809
|
-
return /* @__PURE__ */ r("div", { className: "p-2", children: /* @__PURE__ */ r("div", { className: "p-2 bg-muted rounded-3xl", children: /* @__PURE__ */ r(T, { mode: "wait", children: o || t ? /* @__PURE__ */ d(
|
|
1809
|
+
return /* @__PURE__ */ r("div", { className: "p-2", children: /* @__PURE__ */ r("div", { className: "p-2 bg-muted rounded-3xl", children: /* @__PURE__ */ r(T, { mode: "wait", children: o || t ? /* @__PURE__ */ d(W, { children: [
|
|
1810
1810
|
/* @__PURE__ */ r(fo, {}),
|
|
1811
|
-
/* @__PURE__ */ r(T, { mode: "wait", children: t && /* @__PURE__ */ r(
|
|
1812
|
-
] }, "csat") : /* @__PURE__ */ d(
|
|
1811
|
+
/* @__PURE__ */ r(T, { mode: "wait", children: t && /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r(wt, {}) }, "new-conv-or-back-to-convs-button") })
|
|
1812
|
+
] }, "csat") : /* @__PURE__ */ d(W, { children: [
|
|
1813
1813
|
/* @__PURE__ */ d("div", { className: "ps-2 flex items-center gap-1 pb-2", children: [
|
|
1814
1814
|
/* @__PURE__ */ r(St, { className: "size-4 text-emerald-600" }),
|
|
1815
1815
|
/* @__PURE__ */ r("h2", { className: "text-sm font-medium", children: e("your_issue_has_been_resolved") })
|
|
@@ -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 } =
|
|
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(
|
|
1826
|
-
] }, "session-closed") : /* @__PURE__ */ d(
|
|
1825
|
+
/* @__PURE__ */ r(ut, {})
|
|
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({
|
|
@@ -1842,13 +1842,13 @@ function Co({
|
|
|
1842
1842
|
isAloneInGroup: t,
|
|
1843
1843
|
...n
|
|
1844
1844
|
}) {
|
|
1845
|
-
const { componentStore: s } =
|
|
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
|
|
1887
|
-
const { timestamps: n } =
|
|
1888
|
-
if (!((
|
|
1886
|
+
var a, l;
|
|
1887
|
+
const { timestamps: n } = C();
|
|
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,
|
|
@@ -1910,43 +1910,43 @@ function pe({
|
|
|
1910
1910
|
return /* @__PURE__ */ d(
|
|
1911
1911
|
"div",
|
|
1912
1912
|
{
|
|
1913
|
-
...
|
|
1914
|
-
className:
|
|
1913
|
+
...w("chat/agent_msg_group/root"),
|
|
1914
|
+
className: h("flex items-end gap-2"),
|
|
1915
1915
|
children: [
|
|
1916
1916
|
/* @__PURE__ */ r(oe, { content: o == null ? void 0 : o.name, side: "right", align: "end", children: /* @__PURE__ */ r(
|
|
1917
1917
|
xe,
|
|
1918
1918
|
{
|
|
1919
|
-
...
|
|
1919
|
+
...w("chat/agent_msg_group/root/avatar"),
|
|
1920
1920
|
agent: o,
|
|
1921
1921
|
className: "hidden"
|
|
1922
1922
|
}
|
|
1923
1923
|
) }),
|
|
1924
|
-
/* @__PURE__ */ d("div", { className:
|
|
1924
|
+
/* @__PURE__ */ d("div", { className: h("flex-1 flex flex-col gap-1"), children: [
|
|
1925
1925
|
/* @__PURE__ */ d(
|
|
1926
1926
|
"div",
|
|
1927
1927
|
{
|
|
1928
|
-
...
|
|
1929
|
-
className:
|
|
1928
|
+
...w("chat/agent_msg_group/avatar_and_msgs/root"),
|
|
1929
|
+
className: h("flex items-end gap-2"),
|
|
1930
1930
|
children: [
|
|
1931
1931
|
/* @__PURE__ */ r(oe, { content: o == null ? void 0 : o.name, side: "right", align: "end", children: /* @__PURE__ */ r(
|
|
1932
1932
|
xe,
|
|
1933
1933
|
{
|
|
1934
|
-
...
|
|
1934
|
+
...w("chat/agent_msg_group/avatar_and_msgs/avatar"),
|
|
1935
1935
|
agent: o
|
|
1936
1936
|
}
|
|
1937
1937
|
) }),
|
|
1938
1938
|
/* @__PURE__ */ d(
|
|
1939
1939
|
"div",
|
|
1940
1940
|
{
|
|
1941
|
-
...
|
|
1942
|
-
className:
|
|
1941
|
+
...w("chat/agent_msg_group/avatar_and_msgs/msgs"),
|
|
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
|
|
@@ -1961,8 +1961,8 @@ function pe({
|
|
|
1961
1961
|
t && t.length > 0 && /* @__PURE__ */ r(
|
|
1962
1962
|
"div",
|
|
1963
1963
|
{
|
|
1964
|
-
...
|
|
1965
|
-
className:
|
|
1964
|
+
...w("chat/agent_msg_group/suggestions"),
|
|
1965
|
+
className: h("flex flex-col gap-1 ps-8"),
|
|
1966
1966
|
children: t == null ? void 0 : t.map((n, s) => /* @__PURE__ */ r(
|
|
1967
1967
|
De,
|
|
1968
1968
|
{
|
|
@@ -1994,18 +1994,18 @@ function No({
|
|
|
1994
1994
|
return /* @__PURE__ */ d(
|
|
1995
1995
|
"div",
|
|
1996
1996
|
{
|
|
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
|
{
|
|
2004
|
-
...
|
|
2004
|
+
...w("chat/user_msg/msg"),
|
|
2005
2005
|
"data-first": o,
|
|
2006
2006
|
"data-last": t,
|
|
2007
2007
|
"data-alone": n,
|
|
2008
|
-
className:
|
|
2008
|
+
className: h(
|
|
2009
2009
|
"transition-all",
|
|
2010
2010
|
"w-fit py-3 px-4 rounded-3xl text-sm",
|
|
2011
2011
|
"bg-primary text-primary-foreground",
|
|
@@ -2030,8 +2030,8 @@ function So({
|
|
|
2030
2030
|
return /* @__PURE__ */ d(
|
|
2031
2031
|
"div",
|
|
2032
2032
|
{
|
|
2033
|
-
...
|
|
2034
|
-
className:
|
|
2033
|
+
...w("chat/user_msg_group/root"),
|
|
2034
|
+
className: h("group", "flex flex-col gap-1 justify-end items-end"),
|
|
2035
2035
|
children: [
|
|
2036
2036
|
e.map((o, t, n) => /* @__PURE__ */ r(
|
|
2037
2037
|
No,
|
|
@@ -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) {
|
|
@@ -2073,20 +2073,20 @@ function Mo(e) {
|
|
|
2073
2073
|
function Do() {
|
|
2074
2074
|
const {
|
|
2075
2075
|
messagesState: { messages: e }
|
|
2076
|
-
} =
|
|
2076
|
+
} = A(), {
|
|
2077
2077
|
advancedInitialMessages: o = [],
|
|
2078
2078
|
initialQuestionsPosition: t,
|
|
2079
2079
|
initialQuestions: n,
|
|
2080
2080
|
bot: s
|
|
2081
|
-
} =
|
|
2081
|
+
} = C();
|
|
2082
2082
|
return /* @__PURE__ */ r(Q, { children: e.length === 0 && o.length > 0 && /* @__PURE__ */ r(
|
|
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
|
})
|
|
@@ -2099,7 +2099,7 @@ function Do() {
|
|
|
2099
2099
|
function Ro() {
|
|
2100
2100
|
const {
|
|
2101
2101
|
messagesState: { messages: e }
|
|
2102
|
-
} =
|
|
2102
|
+
} = A(), { chatBannerItems: o } = C();
|
|
2103
2103
|
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(
|
|
2104
2104
|
({ message: t, persistent: n }, s) => e.length > 0 && !n ? null : /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Ne, { children: t }) }, `${t}-${s}`)
|
|
2105
2105
|
) });
|
|
@@ -2107,22 +2107,22 @@ function Ro() {
|
|
|
2107
2107
|
function jo() {
|
|
2108
2108
|
const {
|
|
2109
2109
|
messagesState: { messages: e }
|
|
2110
|
-
} =
|
|
2110
|
+
} = A(), o = C(), {
|
|
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,12 +2140,12 @@ function Po() {
|
|
|
2140
2140
|
function Eo() {
|
|
2141
2141
|
const {
|
|
2142
2142
|
messagesState: { messages: e }
|
|
2143
|
-
} =
|
|
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
|
-
), l =
|
|
2148
|
+
), l = B(null);
|
|
2149
2149
|
function c() {
|
|
2150
2150
|
setTimeout(() => {
|
|
2151
2151
|
const p = l.current;
|
|
@@ -2157,32 +2157,32 @@ function Eo() {
|
|
|
2157
2157
|
}, [e]), /* @__PURE__ */ d(
|
|
2158
2158
|
"div",
|
|
2159
2159
|
{
|
|
2160
|
-
...
|
|
2160
|
+
...w("chat/msgs/root"),
|
|
2161
2161
|
ref: l,
|
|
2162
2162
|
className: "max-h-full scroll-smooth relative flex-1 py-2 px-4 flex flex-col gap-2 overflow-auto",
|
|
2163
2163
|
children: [
|
|
2164
2164
|
/* @__PURE__ */ r(Ro, {}),
|
|
2165
2165
|
/* @__PURE__ */ r(Do, {}),
|
|
2166
2166
|
/* @__PURE__ */ r(jo, {}),
|
|
2167
|
-
|
|
2168
|
-
var
|
|
2169
|
-
const x = (
|
|
2170
|
-
if (!x || !
|
|
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
|
-
return /* @__PURE__ */ r(So, { messages: p },
|
|
2172
|
+
return /* @__PURE__ */ r(So, { messages: p }, m);
|
|
2173
2173
|
if (To(p)) {
|
|
2174
|
-
const v =
|
|
2175
|
-
return o && v ? null : ((
|
|
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,
|
|
2179
2179
|
agent: n ? { ...n, isAi: !0, id: null } : void 0
|
|
2180
2180
|
},
|
|
2181
|
-
|
|
2181
|
+
m
|
|
2182
2182
|
));
|
|
2183
2183
|
}
|
|
2184
2184
|
if (Mo(p)) {
|
|
2185
|
-
const v = (
|
|
2185
|
+
const v = (_ = p[0]) == null ? void 0 : _.agent;
|
|
2186
2186
|
return /* @__PURE__ */ r(
|
|
2187
2187
|
pe,
|
|
2188
2188
|
{
|
|
@@ -2198,12 +2198,12 @@ function Eo() {
|
|
|
2198
2198
|
avatarUrl: s.avatarUrl || null
|
|
2199
2199
|
} : void 0
|
|
2200
2200
|
},
|
|
2201
|
-
|
|
2201
|
+
m
|
|
2202
2202
|
);
|
|
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
|
]
|
|
@@ -2213,19 +2213,19 @@ function Eo() {
|
|
|
2213
2213
|
function Oo() {
|
|
2214
2214
|
const {
|
|
2215
2215
|
messagesState: { isInitialFetchLoading: e }
|
|
2216
|
-
} =
|
|
2216
|
+
} = A(), {
|
|
2217
2217
|
sessionState: { session: o }
|
|
2218
|
-
} =
|
|
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
|
|
2222
2222
|
});
|
|
2223
|
-
const s =
|
|
2223
|
+
const s = B((o == null ? void 0 : o.id) || "chat").current;
|
|
2224
2224
|
return /* @__PURE__ */ r(
|
|
2225
2225
|
"div",
|
|
2226
2226
|
{
|
|
2227
|
-
...
|
|
2228
|
-
className:
|
|
2227
|
+
...w("chat/root"),
|
|
2228
|
+
className: h("flex flex-col overflow-hidden"),
|
|
2229
2229
|
style: {
|
|
2230
2230
|
width: "100vw",
|
|
2231
2231
|
// Relative to the iframe
|
|
@@ -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,
|
|
@@ -2254,8 +2254,8 @@ function Oo() {
|
|
|
2254
2254
|
/* @__PURE__ */ d(
|
|
2255
2255
|
"div",
|
|
2256
2256
|
{
|
|
2257
|
-
...
|
|
2258
|
-
className:
|
|
2257
|
+
...w("chat/main/root"),
|
|
2258
|
+
className: h(
|
|
2259
2259
|
"flex flex-col h-full overflow-auto transition-all",
|
|
2260
2260
|
t ? "w-2/5" : "w-full"
|
|
2261
2261
|
),
|
|
@@ -2272,8 +2272,8 @@ function Oo() {
|
|
|
2272
2272
|
/* @__PURE__ */ r(
|
|
2273
2273
|
"div",
|
|
2274
2274
|
{
|
|
2275
|
-
...
|
|
2276
|
-
className:
|
|
2275
|
+
...w("chat/canvas/root"),
|
|
2276
|
+
className: h(
|
|
2277
2277
|
"h-full overflow-auto transition-all",
|
|
2278
2278
|
t ? "w-3/5" : "w-0"
|
|
2279
2279
|
),
|
|
@@ -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
|
]
|
|
@@ -2299,7 +2299,7 @@ function Ao({
|
|
|
2299
2299
|
return /* @__PURE__ */ r(
|
|
2300
2300
|
"div",
|
|
2301
2301
|
{
|
|
2302
|
-
className:
|
|
2302
|
+
className: h("animate-pulse rounded-md bg-secondary", e),
|
|
2303
2303
|
...o
|
|
2304
2304
|
}
|
|
2305
2305
|
);
|
|
@@ -2313,7 +2313,7 @@ function Fo({ className: e }) {
|
|
|
2313
2313
|
viewBox: "0 0 26 32",
|
|
2314
2314
|
fill: "none",
|
|
2315
2315
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2316
|
-
className:
|
|
2316
|
+
className: h("text-primary-foreground", e),
|
|
2317
2317
|
children: /* @__PURE__ */ r(
|
|
2318
2318
|
"path",
|
|
2319
2319
|
{
|
|
@@ -2325,21 +2325,21 @@ function Fo({ className: e }) {
|
|
|
2325
2325
|
);
|
|
2326
2326
|
}
|
|
2327
2327
|
function Vt({ className: e }) {
|
|
2328
|
-
const { token: o } =
|
|
2328
|
+
const { token: o } = C();
|
|
2329
2329
|
return /* @__PURE__ */ r(
|
|
2330
2330
|
"div",
|
|
2331
2331
|
{
|
|
2332
|
-
className:
|
|
2332
|
+
className: h(
|
|
2333
2333
|
"flex items-center justify-center gap-2 p-2 pt-0",
|
|
2334
2334
|
e
|
|
2335
2335
|
),
|
|
2336
|
-
children: /* @__PURE__ */ r(
|
|
2336
|
+
children: /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ d(
|
|
2337
2337
|
"a",
|
|
2338
2338
|
{
|
|
2339
2339
|
href: `https://open.cx/?ref=${o}`,
|
|
2340
2340
|
target: "_blank",
|
|
2341
2341
|
rel: "noreferrer",
|
|
2342
|
-
className:
|
|
2342
|
+
className: h(
|
|
2343
2343
|
"text-[10px] flex items-center",
|
|
2344
2344
|
"text-muted-foreground/70 [&_svg]:text-muted-foreground/70",
|
|
2345
2345
|
"hover:text-primary [&_svg]:hover:text-primary"
|
|
@@ -2364,26 +2364,26 @@ function ft({
|
|
|
2364
2364
|
session: e,
|
|
2365
2365
|
className: o
|
|
2366
2366
|
}) {
|
|
2367
|
-
const { bot: t, humanAgent: n } =
|
|
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
|
{
|
|
2371
2371
|
variant: "ghost",
|
|
2372
2372
|
size: "lg",
|
|
2373
|
-
className:
|
|
2373
|
+
className: h(
|
|
2374
2374
|
"rounded-full p-2 pe-4 flex text-start justify-between w-full whitespace-normal",
|
|
2375
2375
|
o
|
|
2376
2376
|
),
|
|
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" })
|
|
@@ -2400,27 +2400,27 @@ function ft({
|
|
|
2400
2400
|
);
|
|
2401
2401
|
}
|
|
2402
2402
|
function Wo() {
|
|
2403
|
-
const { t: e } = Z(), { toChatScreen: o } =
|
|
2403
|
+
const { t: e } = Z(), { toChatScreen: o } = H(), {
|
|
2404
2404
|
sessionsState: { data: t, isInitialFetchLoading: n },
|
|
2405
2405
|
openSessions: s,
|
|
2406
|
-
closedSessions:
|
|
2407
|
-
canCreateNewSession:
|
|
2408
|
-
} =
|
|
2406
|
+
closedSessions: i,
|
|
2407
|
+
canCreateNewSession: a
|
|
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,10 +2451,10 @@ function Wo() {
|
|
|
2451
2451
|
"closed-sessions"
|
|
2452
2452
|
)
|
|
2453
2453
|
] }),
|
|
2454
|
-
|
|
2455
|
-
|
|
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
|
+
N,
|
|
2456
2456
|
{
|
|
2457
|
-
...
|
|
2457
|
+
...w("sessions/new_conversation_btn"),
|
|
2458
2458
|
size: "lg",
|
|
2459
2459
|
key: "new-session",
|
|
2460
2460
|
className: "w-full",
|
|
@@ -2465,9 +2465,9 @@ function Wo() {
|
|
|
2465
2465
|
] }) : /* @__PURE__ */ d("div", { className: "flex-1 flex flex-col gap-2 items-center", children: [
|
|
2466
2466
|
/* @__PURE__ */ r("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ r("p", { className: "text-muted-foreground", children: e("no_conversations_yet") }) }),
|
|
2467
2467
|
/* @__PURE__ */ lt(
|
|
2468
|
-
|
|
2468
|
+
N,
|
|
2469
2469
|
{
|
|
2470
|
-
...
|
|
2470
|
+
...w("sessions/new_conversation_btn"),
|
|
2471
2471
|
size: "lg",
|
|
2472
2472
|
key: "new-session",
|
|
2473
2473
|
className: "w-full",
|
|
@@ -2488,8 +2488,8 @@ function Lo() {
|
|
|
2488
2488
|
}), /* @__PURE__ */ r(
|
|
2489
2489
|
"div",
|
|
2490
2490
|
{
|
|
2491
|
-
...
|
|
2492
|
-
className:
|
|
2491
|
+
...w("sessions/root"),
|
|
2492
|
+
className: h("flex flex-col overflow-hidden bg-background"),
|
|
2493
2493
|
style: {
|
|
2494
2494
|
width: "100vw",
|
|
2495
2495
|
// Relative to the iframe
|
|
@@ -2510,13 +2510,13 @@ function Lo() {
|
|
|
2510
2510
|
}
|
|
2511
2511
|
const de = J.forwardRef(
|
|
2512
2512
|
({ className: e, type: o, ...t }, n) => {
|
|
2513
|
-
const { isSmallScreen: s } =
|
|
2513
|
+
const { isSmallScreen: s } = $();
|
|
2514
2514
|
return /* @__PURE__ */ r(
|
|
2515
2515
|
"input",
|
|
2516
2516
|
{
|
|
2517
2517
|
ref: n,
|
|
2518
2518
|
type: o,
|
|
2519
|
-
className:
|
|
2519
|
+
className: h(
|
|
2520
2520
|
// 16px on mobiles prevents auto-zoom on the input when focused
|
|
2521
2521
|
s ? "text-[16px]" : "text-sm",
|
|
2522
2522
|
"flex w-full rounded-xl p-2 ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-primary-foreground placeholder:text-muted-foreground/75 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition",
|
|
@@ -2531,14 +2531,14 @@ const de = J.forwardRef(
|
|
|
2531
2531
|
);
|
|
2532
2532
|
de.displayName = "Input";
|
|
2533
2533
|
function $o() {
|
|
2534
|
-
const { contentIframeRef: e } =
|
|
2534
|
+
const { contentIframeRef: e } = O(), { inline: o } = C(), t = B(null);
|
|
2535
2535
|
return se(() => {
|
|
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,41 +2546,41 @@ 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 v, R, P,
|
|
2560
|
+
var v, R, P, E, u, I, j, M;
|
|
2561
2561
|
const {
|
|
2562
2562
|
widgetCtx: { org: e }
|
|
2563
|
-
} =
|
|
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(((v = s.prefillUserData) == null ? void 0 : v.name) || ""), [
|
|
2569
|
-
(
|
|
2570
|
-
), [
|
|
2571
|
-
async (
|
|
2572
|
-
|
|
2573
|
-
const
|
|
2574
|
-
|
|
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
|
+
S.success && await t(
|
|
2575
2575
|
{
|
|
2576
|
-
email:
|
|
2577
|
-
non_verified_name:
|
|
2576
|
+
email: S.data.email,
|
|
2577
|
+
non_verified_name: S.data.name
|
|
2578
2578
|
},
|
|
2579
2579
|
// Only pass extra data if there is any
|
|
2580
|
-
Object.values(
|
|
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",
|
|
@@ -2601,7 +2601,7 @@ function Yo() {
|
|
|
2601
2601
|
"div",
|
|
2602
2602
|
{
|
|
2603
2603
|
ref: l,
|
|
2604
|
-
className:
|
|
2604
|
+
className: h(
|
|
2605
2605
|
"flex flex-col",
|
|
2606
2606
|
n && "h-full",
|
|
2607
2607
|
"bg-[radial-gradient(ellipse_at_top_left,hsl(var(--opencx-primary)),transparent),radial-gradient(ellipse_at_top_right,hsl(var(--opencx-primary)),transparent)]"
|
|
@@ -2610,23 +2610,23 @@ function Yo() {
|
|
|
2610
2610
|
/* @__PURE__ */ d(
|
|
2611
2611
|
"div",
|
|
2612
2612
|
{
|
|
2613
|
-
className:
|
|
2613
|
+
className: h(
|
|
2614
2614
|
"flex-1 flex flex-col px-4 py-12 text-start space-y-4 relative z-10",
|
|
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
|
{
|
|
2622
|
-
src: (
|
|
2622
|
+
src: (E = s.assets) == null ? void 0 : E.organizationLogo,
|
|
2623
2623
|
alt: "Company Logo",
|
|
2624
2624
|
className: "h-8 w-auto object-contain"
|
|
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: ((
|
|
2629
|
-
/* @__PURE__ */ r("p", { className: "text-sm", children: ((
|
|
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
|
}
|
|
@@ -2634,21 +2634,21 @@ function Yo() {
|
|
|
2634
2634
|
/* @__PURE__ */ d(
|
|
2635
2635
|
"div",
|
|
2636
2636
|
{
|
|
2637
|
-
className:
|
|
2637
|
+
className: h(
|
|
2638
2638
|
"z-10 m-2 px-2 pt-2 bp-0 space-y-2",
|
|
2639
2639
|
"bg-[white]",
|
|
2640
2640
|
"border shadow",
|
|
2641
2641
|
"rounded-3xl"
|
|
2642
2642
|
),
|
|
2643
2643
|
children: [
|
|
2644
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
2644
|
+
/* @__PURE__ */ d("form", { onSubmit: _, className: "space-y-2", children: [
|
|
2645
2645
|
/* @__PURE__ */ r(
|
|
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,33 +2656,33 @@ 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
|
-
|
|
2666
|
+
m.map((g) => /* @__PURE__ */ r(
|
|
2667
2667
|
de,
|
|
2668
2668
|
{
|
|
2669
|
-
value:
|
|
2670
|
-
onChange: (
|
|
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,
|
|
2680
2680
|
{
|
|
2681
|
-
disabled:
|
|
2681
|
+
disabled: z.loading,
|
|
2682
2682
|
className: "w-full",
|
|
2683
2683
|
size: "lg",
|
|
2684
2684
|
children: [
|
|
2685
|
-
|
|
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
|
}
|
|
@@ -2701,12 +2701,12 @@ function Yo() {
|
|
|
2701
2701
|
function Gt() {
|
|
2702
2702
|
const {
|
|
2703
2703
|
routerState: { screen: e }
|
|
2704
|
-
} =
|
|
2704
|
+
} = H();
|
|
2705
2705
|
return /* @__PURE__ */ r("div", { className: "relative bg-background size-full", children: /* @__PURE__ */ r(T, { mode: "wait", children: (() => {
|
|
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",
|
|
@@ -2738,11 +2738,11 @@ function Gt() {
|
|
|
2738
2738
|
e
|
|
2739
2739
|
);
|
|
2740
2740
|
default:
|
|
2741
|
-
return
|
|
2741
|
+
return F(e, Gt.name), null;
|
|
2742
2742
|
}
|
|
2743
2743
|
})() }) });
|
|
2744
2744
|
}
|
|
2745
|
-
const Uo = "4.0.
|
|
2745
|
+
const Uo = "4.0.51", 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 } =
|
|
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,11 +2819,11 @@ 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,
|
|
2826
|
-
className:
|
|
2826
|
+
className: h(
|
|
2827
2827
|
"antialiased font-sans size-full overflow-hidden relative text-secondary-foreground isolate"
|
|
2828
2828
|
),
|
|
2829
2829
|
dir: l,
|
|
@@ -2846,7 +2846,7 @@ function Zt() {
|
|
|
2846
2846
|
function qo() {
|
|
2847
2847
|
const { theme: e } = G();
|
|
2848
2848
|
return /* @__PURE__ */ r(
|
|
2849
|
-
|
|
2849
|
+
he.Content,
|
|
2850
2850
|
{
|
|
2851
2851
|
onInteractOutside: (o) => o.preventDefault(),
|
|
2852
2852
|
forceMount: !0,
|
|
@@ -2877,7 +2877,7 @@ function Vo({
|
|
|
2877
2877
|
viewBox: "0 0 32 30",
|
|
2878
2878
|
fill: "none",
|
|
2879
2879
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2880
|
-
className:
|
|
2880
|
+
className: h("text-primary-foreground", e),
|
|
2881
2881
|
style: o,
|
|
2882
2882
|
children: [
|
|
2883
2883
|
/* @__PURE__ */ r(
|
|
@@ -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 } =
|
|
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
|
-
react:
|
|
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",
|
|
@@ -2958,20 +2958,22 @@ function Zo() {
|
|
|
2958
2958
|
justifyContent: "center"
|
|
2959
2959
|
},
|
|
2960
2960
|
children: /* @__PURE__ */ r(
|
|
2961
|
-
|
|
2961
|
+
he.PopoverTrigger,
|
|
2962
2962
|
{
|
|
2963
|
-
|
|
2963
|
+
"aria-label": c,
|
|
2964
|
+
title: c,
|
|
2965
|
+
className: h(
|
|
2964
2966
|
"font-sans flex items-center justify-center rounded-full"
|
|
2965
2967
|
),
|
|
2966
2968
|
style: {
|
|
2967
2969
|
height: a.widgetTrigger.size.button,
|
|
2968
2970
|
width: a.widgetTrigger.size.button
|
|
2969
2971
|
},
|
|
2970
|
-
children: /* @__PURE__ */ r(
|
|
2972
|
+
children: /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ r(
|
|
2971
2973
|
"div",
|
|
2972
2974
|
{
|
|
2973
|
-
...
|
|
2974
|
-
className:
|
|
2975
|
+
...w("trigger/btn"),
|
|
2976
|
+
className: h(
|
|
2975
2977
|
"relative size-full rounded-full",
|
|
2976
2978
|
"flex items-center justify-center",
|
|
2977
2979
|
"overflow-hidden",
|
|
@@ -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,
|
|
@@ -3053,7 +3055,7 @@ function Zo() {
|
|
|
3053
3055
|
function Ko() {
|
|
3054
3056
|
const { dir: e } = ye();
|
|
3055
3057
|
return /* @__PURE__ */ r(
|
|
3056
|
-
|
|
3058
|
+
he.Anchor,
|
|
3057
3059
|
{
|
|
3058
3060
|
style: {
|
|
3059
3061
|
position: "fixed",
|
|
@@ -3067,11 +3069,11 @@ function Ko() {
|
|
|
3067
3069
|
function Qo({
|
|
3068
3070
|
widgetRef: e
|
|
3069
3071
|
}) {
|
|
3070
|
-
const { widgetCtx: o } =
|
|
3071
|
-
toChatScreen:
|
|
3072
|
-
routerState: { screen:
|
|
3073
|
-
} =
|
|
3074
|
-
return
|
|
3072
|
+
const { widgetCtx: o } = O(), { contactState: t } = zt(), { setIsOpen: n, isOpen: s } = V(), {
|
|
3073
|
+
toChatScreen: i,
|
|
3074
|
+
routerState: { screen: a }
|
|
3075
|
+
} = H(), { sendMessage: l } = A();
|
|
3076
|
+
return L.useImperativeHandle(
|
|
3075
3077
|
e,
|
|
3076
3078
|
() => ({
|
|
3077
3079
|
newChat: async (c) => {
|
|
@@ -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,15 +3090,15 @@ 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;
|
|
3096
3098
|
}
|
|
3097
3099
|
function Jo() {
|
|
3098
3100
|
const { isOpen: e, setIsOpen: o } = V();
|
|
3099
|
-
return /* @__PURE__ */ d(
|
|
3101
|
+
return /* @__PURE__ */ d(he.Root, { open: e, onOpenChange: o, children: [
|
|
3100
3102
|
/* @__PURE__ */ r(Ko, {}),
|
|
3101
3103
|
/* @__PURE__ */ r(Zo, {}),
|
|
3102
3104
|
/* @__PURE__ */ r(qo, {})
|
|
@@ -3127,7 +3129,7 @@ const en = [
|
|
|
3127
3129
|
remove: async (e) => {
|
|
3128
3130
|
localStorage.removeItem(e);
|
|
3129
3131
|
}
|
|
3130
|
-
}, rn =
|
|
3132
|
+
}, rn = L.forwardRef(function({ options: o, components: t = [], loadingComponent: n }, s) {
|
|
3131
3133
|
return /* @__PURE__ */ r(
|
|
3132
3134
|
tr,
|
|
3133
3135
|
{
|