@sendbird/ai-agent-messenger-react 1.13.0 → 1.13.1
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/cjs/{Ci7Su9OO.cjs → BKGMHnw9.cjs} +1 -1
- package/dist/cjs/{DUJ7QCV9.cjs → BPwCUUtB.cjs} +1 -1
- package/dist/cjs/{DkIeZWe9.cjs → BdwWrAAp.cjs} +1 -1
- package/dist/cjs/{B75_RK1b.cjs → C0ghQ00S.cjs} +1 -1
- package/dist/cjs/{FPcgniHk.cjs → C6epASKA.cjs} +1 -1
- package/dist/cjs/{BR_bOr-Y.cjs → Cfl_OFPL.cjs} +1 -1
- package/dist/cjs/{DUDXGnqg.cjs → CgKaFsNM.cjs} +1 -1
- package/dist/cjs/{D3sz6O-l.cjs → DEtHXyvH.cjs} +1 -1
- package/dist/cjs/{B1EyhD-2.cjs → DHKyBmS2.cjs} +1 -1
- package/dist/cjs/{DteMrIDa.cjs → DwrHbIrU.cjs} +22 -22
- package/dist/cjs/{D0ZzpfdW.cjs → PZ2du4si.cjs} +1 -1
- package/dist/es/{D7zRQ3VS.js → -WWqhsdP.js} +1 -1
- package/dist/es/{kx5oY12W.js → 7nVEVfxl.js} +1 -1
- package/dist/es/{DsASYf2Y.js → BDvtEnu9.js} +1 -1
- package/dist/es/{D5KHmygq.js → Bsb8urZu.js} +1 -1
- package/dist/es/{DQFii4-w.js → By2XFBR_.js} +564 -569
- package/dist/es/{Dur4PKN0.js → C3PP_RTM.js} +1 -1
- package/dist/es/{BxWKGsN8.js → CFFZNjOj.js} +1 -1
- package/dist/es/{BGcty2ek.js → DIrWtn8H.js} +1 -1
- package/dist/es/{mtnNHynw.js → YUOGDsml.js} +1 -1
- package/dist/es/{4_6hq4x3.js → nGzMJZzZ.js} +1 -1
- package/dist/es/{C9VMhstH.js → yBEMlNSs.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
|
@@ -2,13 +2,13 @@ var lo = Object.defineProperty;
|
|
|
2
2
|
var co = (e, t, n) => t in e ? lo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var z = (e, t, n) => co(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import * as o from "react";
|
|
5
|
-
import { createContext as Ge, useContext as xe, useLayoutEffect as
|
|
5
|
+
import { createContext as Ge, useContext as xe, useLayoutEffect as oe, useState as C, useEffect as P, useRef as B, useCallback as L, useMemo as ie, forwardRef as We, useImperativeHandle as uo, useId as Wt, useReducer as mo, PureComponent as go, Suspense as ho, lazy as D, Fragment as rr, Children as po } from "react";
|
|
6
6
|
import fo, { SendbirdChatOptions as bo, SendbirdProduct as Eo, DeviceOsPlatform as xn, SendbirdPlatform as xo, SessionHandler as vo, ConnectionHandler as xt, SendbirdError as _o, LogLevel as or, ConnectionState as yo } from "@sendbird/chat";
|
|
7
7
|
import h, { css as I, ThemeProvider as Co, useTheme as Je, createGlobalStyle as So, StyleSheetManager as To, keyframes as sr } from "styled-components";
|
|
8
8
|
import { differenceInMinutes as Ao, isToday as wo, differenceInHours as Io, isSameMinute as vn, format as ir, isSameDay as ko } from "date-fns";
|
|
9
9
|
import { enUS as $o } from "date-fns/locale/en-US";
|
|
10
10
|
import { SendingStatus as Pe, ReplyType as Mo, MessageMetaArray as Lo } from "@sendbird/chat/message";
|
|
11
|
-
import { ConversationStatus as
|
|
11
|
+
import { ConversationStatus as Q, AIAgentModule as Oo, AIAgentMessageFeedbackRating as _n, ConversationType as Do } from "@sendbird/chat/aiAgent";
|
|
12
12
|
import { GroupChannelModule as Ro, GroupChannelListOrder as ar, GroupChannelHandler as No } from "@sendbird/chat/groupChannel";
|
|
13
13
|
import { createPortal as Bo } from "react-dom";
|
|
14
14
|
import { renderer as Fo, parser as Po, MessageProvider as Uo } from "@sendbird/react-uikit-message-template-view";
|
|
@@ -17,7 +17,7 @@ import { useGroupChannelMessages as Vo, useGroupChannelHandler as vt, useForceUp
|
|
|
17
17
|
import lr from "dompurify";
|
|
18
18
|
import { isSameDay as Go } from "date-fns/isSameDay";
|
|
19
19
|
import Wo from "@emotion/is-prop-valid";
|
|
20
|
-
const
|
|
20
|
+
const ee = (e, t) => {
|
|
21
21
|
const n = Ge(null), r = ({ children: a, value: l }) => /* @__PURE__ */ o.createElement(n.Provider, { value: l }, typeof a == "function" ? a(l) : a), s = ({ children: a }) => /* @__PURE__ */ o.createElement(n.Consumer, null, (l) => l ? typeof a == "function" ? a(l) : a : null), i = () => {
|
|
22
22
|
const a = xe(n);
|
|
23
23
|
if (!a)
|
|
@@ -38,15 +38,15 @@ function ye(e) {
|
|
|
38
38
|
function n({ children: i }) {
|
|
39
39
|
const [a, l] = C(() => e.template), [c, d] = C(e.components), g = {
|
|
40
40
|
Template: a,
|
|
41
|
-
updateTemplate: (
|
|
41
|
+
updateTemplate: (f) => l(() => f),
|
|
42
42
|
components: c,
|
|
43
|
-
updateComponent: (
|
|
43
|
+
updateComponent: (f, b) => d((v) => ({ ...v, [f]: b }))
|
|
44
44
|
};
|
|
45
45
|
return /* @__PURE__ */ o.createElement(t.Provider, { value: g }, i);
|
|
46
46
|
}
|
|
47
47
|
function r({ template: i, children: a }) {
|
|
48
48
|
const { updateTemplate: l } = xe(t);
|
|
49
|
-
return
|
|
49
|
+
return oe(() => {
|
|
50
50
|
i && l(i);
|
|
51
51
|
}, [i]), /* @__PURE__ */ o.createElement(o.Fragment, null, a);
|
|
52
52
|
}
|
|
@@ -58,7 +58,7 @@ function ye(e) {
|
|
|
58
58
|
component: l
|
|
59
59
|
}) {
|
|
60
60
|
const { updateComponent: c } = xe(t);
|
|
61
|
-
return
|
|
61
|
+
return oe(() => {
|
|
62
62
|
l && c(i, l);
|
|
63
63
|
}, [l]), null;
|
|
64
64
|
};
|
|
@@ -69,12 +69,12 @@ function jo(...e) {
|
|
|
69
69
|
return e.reduce((r, s) => /* @__PURE__ */ o.createElement(s, null, r), n);
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const ke = (e) => {
|
|
73
73
|
var t, n;
|
|
74
|
-
return !!(e != null && e.isAIAgent && ((t = e == null ? void 0 : e.conversation) == null ? void 0 : t.status) ===
|
|
74
|
+
return !!(e != null && e.isAIAgent && ((t = e == null ? void 0 : e.conversation) == null ? void 0 : t.status) === Q.CLOSED || e != null && e.isDesk && ((n = e == null ? void 0 : e.helpdeskInfo) == null ? void 0 : n.ticketStatus) === "closed");
|
|
75
75
|
}, jt = (e) => {
|
|
76
76
|
var t, n;
|
|
77
|
-
return !!(e != null && e.isAIAgent && ((t = e == null ? void 0 : e.conversation) == null ? void 0 : t.status) ===
|
|
77
|
+
return !!(e != null && e.isAIAgent && ((t = e == null ? void 0 : e.conversation) == null ? void 0 : t.status) === Q.OPEN || e != null && e.isDesk && ((n = e == null ? void 0 : e.helpdeskInfo) == null ? void 0 : n.ticketStatus) === "open");
|
|
78
78
|
};
|
|
79
79
|
function He(e) {
|
|
80
80
|
var n, r, s;
|
|
@@ -240,7 +240,7 @@ const Dt = (e) => {
|
|
|
240
240
|
} catch {
|
|
241
241
|
return {};
|
|
242
242
|
}
|
|
243
|
-
},
|
|
243
|
+
}, Ie = {
|
|
244
244
|
isStreaming(e) {
|
|
245
245
|
const t = Dt(e.data);
|
|
246
246
|
return typeof t == "object" && !!t.stream;
|
|
@@ -399,7 +399,7 @@ function cs(e) {
|
|
|
399
399
|
};
|
|
400
400
|
typeof e.groupChannel != "object" && t("GroupChannelModule"), typeof e.aiAgent != "object" && t("AIAgentModule");
|
|
401
401
|
}
|
|
402
|
-
const
|
|
402
|
+
const we = {
|
|
403
403
|
conversation: {
|
|
404
404
|
isTalkToAgentViewEnabled: !0,
|
|
405
405
|
scrollMode: "auto",
|
|
@@ -422,39 +422,39 @@ const Ie = {
|
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
}, ds = (e) => {
|
|
425
|
-
var t, n, r, s, i, a, l, c, d, g,
|
|
425
|
+
var t, n, r, s, i, a, l, c, d, g, f, b, v, _;
|
|
426
426
|
return e ? {
|
|
427
|
-
...
|
|
427
|
+
...we,
|
|
428
428
|
...e,
|
|
429
429
|
conversation: {
|
|
430
|
-
...
|
|
430
|
+
...we.conversation,
|
|
431
431
|
...e == null ? void 0 : e.conversation,
|
|
432
432
|
header: {
|
|
433
|
-
...(t =
|
|
433
|
+
...(t = we.conversation) == null ? void 0 : t.header,
|
|
434
434
|
...(n = e == null ? void 0 : e.conversation) == null ? void 0 : n.header
|
|
435
435
|
},
|
|
436
436
|
input: {
|
|
437
|
-
...(r =
|
|
437
|
+
...(r = we.conversation) == null ? void 0 : r.input,
|
|
438
438
|
...(s = e == null ? void 0 : e.conversation) == null ? void 0 : s.input,
|
|
439
439
|
camera: {
|
|
440
|
-
...(a = (i =
|
|
440
|
+
...(a = (i = we.conversation) == null ? void 0 : i.input) == null ? void 0 : a.camera,
|
|
441
441
|
...(c = (l = e == null ? void 0 : e.conversation) == null ? void 0 : l.input) == null ? void 0 : c.camera
|
|
442
442
|
},
|
|
443
443
|
gallery: {
|
|
444
|
-
...(g = (d =
|
|
445
|
-
...(b = (
|
|
444
|
+
...(g = (d = we.conversation) == null ? void 0 : d.input) == null ? void 0 : g.gallery,
|
|
445
|
+
...(b = (f = e == null ? void 0 : e.conversation) == null ? void 0 : f.input) == null ? void 0 : b.gallery
|
|
446
446
|
}
|
|
447
447
|
},
|
|
448
448
|
fileViewer: {
|
|
449
|
-
...(
|
|
450
|
-
...(
|
|
449
|
+
...(v = we.conversation) == null ? void 0 : v.fileViewer,
|
|
450
|
+
...(_ = e == null ? void 0 : e.conversation) == null ? void 0 : _.fileViewer
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
} :
|
|
453
|
+
} : we;
|
|
454
454
|
}, {
|
|
455
455
|
Provider: us,
|
|
456
456
|
useContext: X
|
|
457
|
-
} =
|
|
457
|
+
} = ee("AIAgent");
|
|
458
458
|
function ms({
|
|
459
459
|
appId: e,
|
|
460
460
|
aiAgentId: t,
|
|
@@ -467,28 +467,28 @@ function ms({
|
|
|
467
467
|
config: c,
|
|
468
468
|
chatSDK: d,
|
|
469
469
|
chatParams: g,
|
|
470
|
-
children:
|
|
470
|
+
children: f,
|
|
471
471
|
logger: b,
|
|
472
|
-
dispatcher:
|
|
473
|
-
messengerVersion:
|
|
472
|
+
dispatcher: v,
|
|
473
|
+
messengerVersion: _,
|
|
474
474
|
extensions: E = {
|
|
475
475
|
platform: xo.JS,
|
|
476
476
|
deviceOSPlatform: is() ? xn.MOBILE_WEB : xn.WEB
|
|
477
477
|
}
|
|
478
478
|
}) {
|
|
479
|
-
const [u,
|
|
480
|
-
const x = b ?? new pr(hr.WARN), y =
|
|
479
|
+
const [u, p] = C(() => {
|
|
480
|
+
const x = b ?? new pr(hr.WARN), y = v ?? new gr(x);
|
|
481
481
|
return {
|
|
482
482
|
logger: x,
|
|
483
483
|
dispatcher: y,
|
|
484
|
-
chatSDK: d ?? Tn(e, E,
|
|
484
|
+
chatSDK: d ?? Tn(e, E, _, g),
|
|
485
485
|
cache: Sn({ appId: e, aiAgentId: t, storage: n })
|
|
486
486
|
};
|
|
487
487
|
});
|
|
488
488
|
return P(() => {
|
|
489
|
-
|
|
489
|
+
p((x) => {
|
|
490
490
|
let y = x.logger, k = x.dispatcher, S = x.chatSDK;
|
|
491
|
-
return b && b !== x.logger && (y = b),
|
|
491
|
+
return b && b !== x.logger && (y = b), v && v !== x.dispatcher && (k = v), d && d !== x.chatSDK ? S = d : !d && x.chatSDK.appId !== e && (S = Tn(e, E, _, { newInstance: !0, ...g })), {
|
|
492
492
|
...x,
|
|
493
493
|
logger: y,
|
|
494
494
|
dispatcher: k,
|
|
@@ -496,7 +496,7 @@ function ms({
|
|
|
496
496
|
cache: Sn({ appId: e, aiAgentId: t, storage: n })
|
|
497
497
|
};
|
|
498
498
|
});
|
|
499
|
-
}, [e, t, b,
|
|
499
|
+
}, [e, t, b, v, d, n]), P(() => () => {
|
|
500
500
|
u.chatSDK.disconnectWebSocket();
|
|
501
501
|
}, [u.chatSDK]), cs(u.chatSDK), /* @__PURE__ */ o.createElement(
|
|
502
502
|
us,
|
|
@@ -513,7 +513,7 @@ function ms({
|
|
|
513
513
|
networkStateAdapter: r
|
|
514
514
|
}
|
|
515
515
|
},
|
|
516
|
-
|
|
516
|
+
f
|
|
517
517
|
);
|
|
518
518
|
}
|
|
519
519
|
const gs = (e, t, n) => Vo(e, t, { ...n, strictStreamingOrder: !0 });
|
|
@@ -543,10 +543,10 @@ const fr = (e, t, n = {}) => {
|
|
|
543
543
|
if (i === null || g - i >= t)
|
|
544
544
|
a ? (e(...d), i = g) : (s = d, i = g);
|
|
545
545
|
else if (s = d, l && !r) {
|
|
546
|
-
const
|
|
546
|
+
const f = t - (g - i);
|
|
547
547
|
r = setTimeout(() => {
|
|
548
548
|
s && l && (e(...s), i = Date.now()), r = null, s = null;
|
|
549
|
-
},
|
|
549
|
+
}, f);
|
|
550
550
|
}
|
|
551
551
|
};
|
|
552
552
|
return c.cancel = () => {
|
|
@@ -587,16 +587,16 @@ function vs(e, t, n) {
|
|
|
587
587
|
if (t === 0)
|
|
588
588
|
r = s = i = n;
|
|
589
589
|
else {
|
|
590
|
-
const a = function(g,
|
|
591
|
-
return b < 0 && (b += 1), b > 1 && (b -= 1), b < 0.16666666666666666 ? g + (
|
|
590
|
+
const a = function(g, f, b) {
|
|
591
|
+
return b < 0 && (b += 1), b > 1 && (b -= 1), b < 0.16666666666666666 ? g + (f - g) * 6 * b : b < 0.5 ? f : b < 0.6666666666666666 ? g + (f - g) * (0.6666666666666666 - b) * 6 : g;
|
|
592
592
|
}, l = n < 0.5 ? n * (1 + t) : n + t - n * t, c = 2 * n - l;
|
|
593
593
|
r = a(c, l, e + 1 / 3), s = a(c, l, e), i = a(c, l, e - 1 / 3);
|
|
594
594
|
}
|
|
595
595
|
return [Math.round(r * 255), Math.round(s * 255), Math.round(i * 255)];
|
|
596
596
|
}
|
|
597
597
|
function it(e, t, n) {
|
|
598
|
-
const [r, s, i] = bs(e), [a, l, c] = xs(r, s, i), d = Math.max(0, Math.min(1, c * t)), g = Math.max(0, Math.min(1, l * n)), [
|
|
599
|
-
return Es([Math.round(
|
|
598
|
+
const [r, s, i] = bs(e), [a, l, c] = xs(r, s, i), d = Math.max(0, Math.min(1, c * t)), g = Math.max(0, Math.min(1, l * n)), [f, b, v] = vs(a, g, d);
|
|
599
|
+
return Es([Math.round(f), Math.round(b), Math.round(v)]);
|
|
600
600
|
}
|
|
601
601
|
function _s(e, t = "light") {
|
|
602
602
|
return {
|
|
@@ -793,7 +793,7 @@ function ws({ typography: e }) {
|
|
|
793
793
|
const {
|
|
794
794
|
Provider: Is,
|
|
795
795
|
useContext: Yt
|
|
796
|
-
} =
|
|
796
|
+
} = ee("AIAgentTheme");
|
|
797
797
|
function ks({ logger: e, palette: t, typography: n, appearance: r, children: s }) {
|
|
798
798
|
const i = B(null), [a, l] = C(
|
|
799
799
|
() => An({
|
|
@@ -806,15 +806,15 @@ function ks({ logger: e, palette: t, typography: n, appearance: r, children: s }
|
|
|
806
806
|
), c = L(
|
|
807
807
|
(d, g) => {
|
|
808
808
|
g && (i.current = g);
|
|
809
|
-
const
|
|
809
|
+
const f = (r == null ? void 0 : r.theme) ?? d, b = i.current ? i.current.themes[f] : null, v = {
|
|
810
810
|
primary: r == null ? void 0 : r.primaryColor,
|
|
811
811
|
primaryContrast: void 0,
|
|
812
812
|
botMessageBackground: r == null ? void 0 : r.botMessageBackgroundColor,
|
|
813
813
|
botMessageBackgroundContrast: void 0
|
|
814
814
|
};
|
|
815
|
-
!
|
|
816
|
-
const
|
|
817
|
-
l(
|
|
815
|
+
!v.primary && (b != null && b.primary_color) && (v.primary = b.primary_color, v.primaryContrast = b.primary_contrast_color), !v.botMessageBackground && (b != null && b.bot_message_bg_color) && (v.botMessageBackground = b.bot_message_bg_color, v.botMessageBackgroundContrast = b.bot_message_bg_contrast_color);
|
|
816
|
+
const _ = An({ selectedTheme: f, palette: t, typography: n, ...v });
|
|
817
|
+
l(_), e == null || e.info("theme.update:", f);
|
|
818
818
|
},
|
|
819
819
|
[r == null ? void 0 : r.theme, r == null ? void 0 : r.primaryColor, r == null ? void 0 : r.botMessageBackgroundColor, t, n, e]
|
|
820
820
|
);
|
|
@@ -856,8 +856,8 @@ const wn = 25 * 1024 * 1024, $s = {
|
|
|
856
856
|
const { channel: i, uploadSizeLimit: a = wn } = s, l = (d = !0) => i != null && i.isAIAgent ? d ? He(i) : !1 : !0, c = (d) => {
|
|
857
857
|
if (l())
|
|
858
858
|
return e.defaultUploadSizeLimit ?? a;
|
|
859
|
-
const g = e.defaultUploadSizeLimit ?? a,
|
|
860
|
-
return Math.min(g,
|
|
859
|
+
const g = e.defaultUploadSizeLimit ?? a, f = e.uploadSizeLimitPerType.get(d) ?? g;
|
|
860
|
+
return Math.min(g, f);
|
|
861
861
|
};
|
|
862
862
|
return {
|
|
863
863
|
maxAttachmentCount: e.maxAttachmentCount,
|
|
@@ -994,16 +994,16 @@ function Ps({
|
|
|
994
994
|
onPostDeauth: a,
|
|
995
995
|
forceCreateChannel: l
|
|
996
996
|
}) {
|
|
997
|
-
const { aiAgentId: c, language: d, context: g, countryCode:
|
|
997
|
+
const { aiAgentId: c, language: d, context: g, countryCode: f, logger: b, cache: v } = X(), { connect: _, disconnect: E } = Ls(), { type: u, userSessionCandidate: p } = Fs(e), x = Er(), y = L(async () => {
|
|
998
998
|
var M;
|
|
999
999
|
b.debug("useAuthentication.authenticate: start");
|
|
1000
|
-
const S =
|
|
1000
|
+
const S = p != null && p.userId ? v.messenger.getSettings(p.userId) : null;
|
|
1001
1001
|
S != null && S.bot && (t(S), b.debug("useAuthentication.authenticate: cached messenger settings", S));
|
|
1002
1002
|
const O = await x({
|
|
1003
1003
|
aiAgentId: c,
|
|
1004
|
-
userId:
|
|
1004
|
+
userId: p == null ? void 0 : p.userId,
|
|
1005
1005
|
language: d,
|
|
1006
|
-
country:
|
|
1006
|
+
country: f,
|
|
1007
1007
|
context: g,
|
|
1008
1008
|
forceCreateChannel: l,
|
|
1009
1009
|
knownActiveChannelUrl: (M = S == null ? void 0 : S.active_channel) == null ? void 0 : M.channel_url
|
|
@@ -1012,38 +1012,38 @@ function Ps({
|
|
|
1012
1012
|
let $ = null;
|
|
1013
1013
|
if (O.auto_created_user)
|
|
1014
1014
|
if (u === "manual")
|
|
1015
|
-
b.warn("Received auto created user info but current session is manual. Ignoring auto created user info."), $ = { userId:
|
|
1015
|
+
b.warn("Received auto created user info but current session is manual. Ignoring auto created user info."), $ = { userId: p.userId, authToken: p.authToken };
|
|
1016
1016
|
else {
|
|
1017
|
-
const { user_id: N, session_token:
|
|
1018
|
-
|
|
1017
|
+
const { user_id: N, session_token: j, expire_at: K } = O.auto_created_user;
|
|
1018
|
+
v.messenger.setAnonUser({ userId: N, authToken: j, expireAt: K }), $ = { userId: N, authToken: j };
|
|
1019
1019
|
}
|
|
1020
1020
|
else
|
|
1021
1021
|
$ = {
|
|
1022
|
-
userId: (
|
|
1023
|
-
authToken: (
|
|
1022
|
+
userId: (p == null ? void 0 : p.userId) ?? "",
|
|
1023
|
+
authToken: (p == null ? void 0 : p.authToken) ?? ""
|
|
1024
1024
|
};
|
|
1025
|
-
|
|
1025
|
+
v.messenger.setSettings($.userId, O), t(O);
|
|
1026
1026
|
try {
|
|
1027
|
-
await n(O, $), await
|
|
1027
|
+
await n(O, $), await _($, p == null ? void 0 : p.sessionHandler, i), await r(O, $);
|
|
1028
1028
|
} catch (N) {
|
|
1029
1029
|
throw N instanceof Error && (s(N), b.error("useAuthentication.authenticate: failed to connect", N)), N;
|
|
1030
1030
|
}
|
|
1031
1031
|
return O;
|
|
1032
1032
|
}, [
|
|
1033
1033
|
x,
|
|
1034
|
-
|
|
1034
|
+
_,
|
|
1035
1035
|
u,
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1036
|
+
p == null ? void 0 : p.userId,
|
|
1037
|
+
p == null ? void 0 : p.sessionHandler,
|
|
1038
|
+
p == null ? void 0 : p.authToken,
|
|
1039
1039
|
c,
|
|
1040
1040
|
d,
|
|
1041
1041
|
g,
|
|
1042
|
-
|
|
1042
|
+
f,
|
|
1043
1043
|
l,
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1044
|
+
v.messenger.setAnonUser,
|
|
1045
|
+
v.messenger.getSettings,
|
|
1046
|
+
v.messenger.setSettings,
|
|
1047
1047
|
t,
|
|
1048
1048
|
n,
|
|
1049
1049
|
r,
|
|
@@ -1055,7 +1055,7 @@ function Ps({
|
|
|
1055
1055
|
return {
|
|
1056
1056
|
authenticate: y,
|
|
1057
1057
|
deauthenticate: k,
|
|
1058
|
-
userSessionCandidate:
|
|
1058
|
+
userSessionCandidate: p
|
|
1059
1059
|
};
|
|
1060
1060
|
}
|
|
1061
1061
|
const xr = (e) => {
|
|
@@ -1132,16 +1132,16 @@ const zs = () => {
|
|
|
1132
1132
|
}, {
|
|
1133
1133
|
Provider: Gs,
|
|
1134
1134
|
useContext: yt
|
|
1135
|
-
} =
|
|
1135
|
+
} = ee("AIAgentMessengerSession"), Ws = We(
|
|
1136
1136
|
function({ userSessionInfo: e, forceCreateChannel: t, children: n }, r) {
|
|
1137
|
-
const { appId: s, aiAgentId: i, chatSDK: a, language: l, countryCode: c, context: d, cache: g, logger:
|
|
1137
|
+
const { appId: s, aiAgentId: i, chatSDK: a, language: l, countryCode: c, context: d, cache: g, logger: f } = X(), { updateTheme: b } = Yt(), [v, _] = C(void 0), [E, u] = C(
|
|
1138
1138
|
void 0
|
|
1139
|
-
), [
|
|
1139
|
+
), [p, x] = C(null), [y, k] = C(null), [S, O] = C(null), [$, M] = C(null), { updateBaseAttachmentRules: N, createAttachmentRules: j } = Ms(), { shouldSyncCachedTemplate: K, syncCachedTemplates: Se } = zs(), Te = Er(), { authenticate: Oe, deauthenticate: Z } = Ps({
|
|
1140
1140
|
userSessionInfo: e,
|
|
1141
1141
|
forceCreateChannel: t,
|
|
1142
1142
|
onUpdateMessengerSettings: L(
|
|
1143
1143
|
(U) => {
|
|
1144
|
-
const { appearance: T, bot: R, launcher:
|
|
1144
|
+
const { appearance: T, bot: R, launcher: q } = U;
|
|
1145
1145
|
b(T.selected_theme, T), O({
|
|
1146
1146
|
userId: R.bot_userid,
|
|
1147
1147
|
profileUrl: R.bot_profile_url,
|
|
@@ -1154,23 +1154,23 @@ const zs = () => {
|
|
|
1154
1154
|
isUserFeedbackEnabled: U.bot.is_user_feedback_enabled ?? !1,
|
|
1155
1155
|
isUserFeedbackCommentOptionEnabled: U.bot.is_user_feedback_comment_option_enabled ?? !1
|
|
1156
1156
|
}), M({
|
|
1157
|
-
type:
|
|
1158
|
-
imageUrl:
|
|
1157
|
+
type: q.image_type || "default_icon",
|
|
1158
|
+
imageUrl: q.image_url
|
|
1159
1159
|
}), N(U);
|
|
1160
1160
|
},
|
|
1161
1161
|
[b]
|
|
1162
1162
|
),
|
|
1163
1163
|
onPreAuth: L((U, T) => {
|
|
1164
|
-
|
|
1164
|
+
_(void 0), k(T);
|
|
1165
1165
|
}, []),
|
|
1166
1166
|
onPostAuth: L(
|
|
1167
1167
|
async (U) => {
|
|
1168
|
-
x(a.currentUser), K() && await Se(), u({ url: U.active_channel.channel_url, status:
|
|
1168
|
+
x(a.currentUser), K() && await Se(), u({ url: U.active_channel.channel_url, status: Q.OPEN });
|
|
1169
1169
|
},
|
|
1170
1170
|
[a, K, Se]
|
|
1171
1171
|
),
|
|
1172
1172
|
onErrorAuth: L((U) => {
|
|
1173
|
-
|
|
1173
|
+
_(U);
|
|
1174
1174
|
}, []),
|
|
1175
1175
|
onAuthTokenRefreshed: L((U) => {
|
|
1176
1176
|
k((T) => T ? { ...T, authToken: U } : null);
|
|
@@ -1181,7 +1181,7 @@ const zs = () => {
|
|
|
1181
1181
|
}), ae = L(async () => {
|
|
1182
1182
|
var U;
|
|
1183
1183
|
if (y) {
|
|
1184
|
-
|
|
1184
|
+
f.debug("agentMessengerSession.refreshActiveChannel: try to refresh active channel"), u(void 0);
|
|
1185
1185
|
const T = await Te({
|
|
1186
1186
|
aiAgentId: i,
|
|
1187
1187
|
userId: y.userId,
|
|
@@ -1191,12 +1191,12 @@ const zs = () => {
|
|
|
1191
1191
|
forceCreateChannel: t,
|
|
1192
1192
|
knownActiveChannelUrl: (U = g.messenger.getSettings(y.userId)) == null ? void 0 : U.active_channel.channel_url
|
|
1193
1193
|
});
|
|
1194
|
-
return g.messenger.setSettings(y.userId, T), u({ url: T.active_channel.channel_url, status:
|
|
1194
|
+
return g.messenger.setSettings(y.userId, T), u({ url: T.active_channel.channel_url, status: Q.OPEN }), f.info(
|
|
1195
1195
|
"agentMessengerSession.refreshActiveChannel: refreshed active channel",
|
|
1196
1196
|
T.active_channel.channel_url
|
|
1197
1197
|
), T.active_channel.channel_url;
|
|
1198
1198
|
} else
|
|
1199
|
-
throw
|
|
1199
|
+
throw f.error("agentMessengerSession.refreshActiveChannel: userSession is not ready"), new Error("userSession is not ready");
|
|
1200
1200
|
}, [
|
|
1201
1201
|
Te,
|
|
1202
1202
|
s,
|
|
@@ -1224,7 +1224,7 @@ const zs = () => {
|
|
|
1224
1224
|
() => fr(
|
|
1225
1225
|
(U) => {
|
|
1226
1226
|
var T;
|
|
1227
|
-
|
|
1227
|
+
f.info("agentMessengerSession.channelChanged: channel.conversation", U.conversation), u({ url: U.url, status: ((T = U.conversation) == null ? void 0 : T.status) ?? Q.OPEN });
|
|
1228
1228
|
},
|
|
1229
1229
|
250,
|
|
1230
1230
|
{ trailing: !1, leading: !0 }
|
|
@@ -1244,38 +1244,38 @@ const zs = () => {
|
|
|
1244
1244
|
return {
|
|
1245
1245
|
activeChannel: E,
|
|
1246
1246
|
chatSDK: a,
|
|
1247
|
-
authenticate:
|
|
1247
|
+
authenticate: Oe,
|
|
1248
1248
|
deauthenticate: Z,
|
|
1249
1249
|
updateContext: async (T) => {
|
|
1250
|
-
const
|
|
1251
|
-
return { ...
|
|
1250
|
+
const q = await (await U()).updateContext(i, T);
|
|
1251
|
+
return { ...q, context: q.context ?? {} };
|
|
1252
1252
|
},
|
|
1253
1253
|
patchContext: async (T) => {
|
|
1254
|
-
const
|
|
1255
|
-
return { ...
|
|
1254
|
+
const q = await (await U()).patchContext(i, T);
|
|
1255
|
+
return { ...q, context: q.context ?? {} };
|
|
1256
1256
|
},
|
|
1257
1257
|
getContextObject: async () => {
|
|
1258
1258
|
const R = await (await U()).getContextObject(i);
|
|
1259
1259
|
return { ...R, context: R.context ?? {} };
|
|
1260
1260
|
}
|
|
1261
1261
|
};
|
|
1262
|
-
}, [
|
|
1262
|
+
}, [Oe, Z, E, a, i, f]), /* @__PURE__ */ o.createElement(
|
|
1263
1263
|
Gs,
|
|
1264
1264
|
{
|
|
1265
1265
|
value: {
|
|
1266
|
-
sdkUser:
|
|
1266
|
+
sdkUser: p,
|
|
1267
1267
|
userSessionInfo: e,
|
|
1268
1268
|
userSession: y,
|
|
1269
1269
|
activeChannel: E,
|
|
1270
1270
|
setActiveChannel: u,
|
|
1271
1271
|
refreshActiveChannel: ae,
|
|
1272
1272
|
createConversation: Ae,
|
|
1273
|
-
connectionError:
|
|
1273
|
+
connectionError: v,
|
|
1274
1274
|
aiAgentInfo: S,
|
|
1275
1275
|
launcherInfo: $,
|
|
1276
|
-
authenticate:
|
|
1276
|
+
authenticate: Oe,
|
|
1277
1277
|
deauthenticate: Z,
|
|
1278
|
-
createAttachmentRules:
|
|
1278
|
+
createAttachmentRules: j
|
|
1279
1279
|
}
|
|
1280
1280
|
},
|
|
1281
1281
|
n
|
|
@@ -1327,7 +1327,7 @@ const zs = () => {
|
|
|
1327
1327
|
return { disabled: !0, disabledBy: "unavailable" };
|
|
1328
1328
|
if (i === "reconnecting")
|
|
1329
1329
|
return { disabled: !0, disabledBy: "reconnecting" };
|
|
1330
|
-
if (
|
|
1330
|
+
if (ke(e))
|
|
1331
1331
|
return { disabled: !0, disabledBy: "conversation_closed" };
|
|
1332
1332
|
if (Ys(e))
|
|
1333
1333
|
return { disabled: !0, disabledBy: "form_active" };
|
|
@@ -1342,7 +1342,7 @@ const zs = () => {
|
|
|
1342
1342
|
const [s, i] = C(!1), a = vr(e);
|
|
1343
1343
|
return P(() => {
|
|
1344
1344
|
if (!t) return;
|
|
1345
|
-
const l = a.some((d) => d.userId === n), c = Qe(t, n) && (
|
|
1345
|
+
const l = a.some((d) => d.userId === n), c = Qe(t, n) && (Ie.isStreaming(t) || r);
|
|
1346
1346
|
i(!!(c || l));
|
|
1347
1347
|
}, [a, t, n, r]), s;
|
|
1348
1348
|
}, Ys = (e) => {
|
|
@@ -1368,8 +1368,8 @@ const zs = () => {
|
|
|
1368
1368
|
a.current && clearTimeout(a.current), i(!0), a.current = setTimeout(() => {
|
|
1369
1369
|
i(!1), a.current = null;
|
|
1370
1370
|
}, b);
|
|
1371
|
-
}, g = Date.now() - l,
|
|
1372
|
-
return n ||
|
|
1371
|
+
}, g = Date.now() - l, f = Xs - g;
|
|
1372
|
+
return n || f <= 0 ? c() : d(f), () => {
|
|
1373
1373
|
a.current && clearTimeout(a.current);
|
|
1374
1374
|
};
|
|
1375
1375
|
}, [n, l]), s && e;
|
|
@@ -1394,7 +1394,7 @@ const zs = () => {
|
|
|
1394
1394
|
};
|
|
1395
1395
|
}, {
|
|
1396
1396
|
Provider: ei
|
|
1397
|
-
} =
|
|
1397
|
+
} = ee("AIAgentConversation");
|
|
1398
1398
|
function ti({
|
|
1399
1399
|
children: e,
|
|
1400
1400
|
channelUrl: t,
|
|
@@ -1407,18 +1407,18 @@ function ti({
|
|
|
1407
1407
|
onAfterSendMessage: c = _e,
|
|
1408
1408
|
shouldMarkAsRead: d = !0,
|
|
1409
1409
|
shouldCountNewMessages: g = () => !1,
|
|
1410
|
-
sortComparator:
|
|
1410
|
+
sortComparator: f
|
|
1411
1411
|
}) {
|
|
1412
1412
|
var M;
|
|
1413
|
-
const b = () => d && (u == null ? void 0 : u.markAsRead()), { chatSDK:
|
|
1413
|
+
const b = () => d && (u == null ? void 0 : u.markAsRead()), { chatSDK: v, logger: _, dispatcher: E } = X(), { channel: u, channelFetchError: p, fetchChannel: x } = ni(t), y = gs(v, u, {
|
|
1414
1414
|
replyType: Mo.ONLY_REPLY_TO_CHANNEL,
|
|
1415
1415
|
shouldCountNewMessages: g,
|
|
1416
1416
|
onChannelDeleted: n,
|
|
1417
1417
|
onMessagesReceived: (N) => r == null ? void 0 : r(N),
|
|
1418
1418
|
onMessagesUpdated: (N) => s == null ? void 0 : s(N),
|
|
1419
|
-
logger:
|
|
1419
|
+
logger: _,
|
|
1420
1420
|
markAsRead: b,
|
|
1421
|
-
sortComparator:
|
|
1421
|
+
sortComparator: f
|
|
1422
1422
|
}), k = Qs(), S = qs({
|
|
1423
1423
|
channel: u,
|
|
1424
1424
|
messages: y.messages,
|
|
@@ -1427,13 +1427,13 @@ function ti({
|
|
|
1427
1427
|
P(() => {
|
|
1428
1428
|
b();
|
|
1429
1429
|
}, [d]);
|
|
1430
|
-
const O =
|
|
1430
|
+
const O = ke(u);
|
|
1431
1431
|
P(() => {
|
|
1432
1432
|
i == null || i(O);
|
|
1433
1433
|
}, [O, i]), P(() => {
|
|
1434
|
-
const N = async (
|
|
1435
|
-
const K = typeof (
|
|
1436
|
-
u && K &&
|
|
1434
|
+
const N = async (j) => {
|
|
1435
|
+
const K = typeof (j == null ? void 0 : j.channelUrl) == "string";
|
|
1436
|
+
u && K && j.channelUrl !== u.url || (_.debug("conversation.dispatcher: try to close conversation", u), u != null && u.conversation && u.conversation.status === Q.OPEN && (await u.closeConversation(), a == null || a()));
|
|
1437
1437
|
};
|
|
1438
1438
|
return E.subscribe(Rt.ConversationClose, N), () => {
|
|
1439
1439
|
E.unsubscribe(Rt.ConversationClose, N);
|
|
@@ -1443,10 +1443,10 @@ function ti({
|
|
|
1443
1443
|
conversation: (u == null ? void 0 : u.conversation) ?? void 0,
|
|
1444
1444
|
channelSource: {
|
|
1445
1445
|
channel: u,
|
|
1446
|
-
error:
|
|
1446
|
+
error: p,
|
|
1447
1447
|
refetch: () => x(),
|
|
1448
1448
|
closeConversation: async () => {
|
|
1449
|
-
|
|
1449
|
+
ke(u) || await (u == null ? void 0 : u.closeConversation());
|
|
1450
1450
|
}
|
|
1451
1451
|
},
|
|
1452
1452
|
messageSource: {
|
|
@@ -1460,19 +1460,19 @@ function ti({
|
|
|
1460
1460
|
resetNewMessages: () => y.resetNewMessages(),
|
|
1461
1461
|
sendUserMessage: async (N) => {
|
|
1462
1462
|
var K;
|
|
1463
|
-
if (((K = u == null ? void 0 : u.conversation) == null ? void 0 : K.status) ===
|
|
1463
|
+
if (((K = u == null ? void 0 : u.conversation) == null ? void 0 : K.status) === Q.CLOSED)
|
|
1464
1464
|
throw new Error("Conversation is closed");
|
|
1465
1465
|
l && (N = await l(N));
|
|
1466
|
-
const
|
|
1467
|
-
return c == null || c(
|
|
1466
|
+
const j = await y.sendUserMessage(N, c);
|
|
1467
|
+
return c == null || c(j), j;
|
|
1468
1468
|
},
|
|
1469
1469
|
sendFileMessage: async (N) => {
|
|
1470
1470
|
var K;
|
|
1471
|
-
if (((K = u == null ? void 0 : u.conversation) == null ? void 0 : K.status) ===
|
|
1471
|
+
if (((K = u == null ? void 0 : u.conversation) == null ? void 0 : K.status) === Q.CLOSED)
|
|
1472
1472
|
throw new Error("Conversation is closed");
|
|
1473
1473
|
l && (N = await l(N));
|
|
1474
|
-
const
|
|
1475
|
-
return c == null || c(
|
|
1474
|
+
const j = await y.sendFileMessage(N, c);
|
|
1475
|
+
return c == null || c(j), j;
|
|
1476
1476
|
}
|
|
1477
1477
|
},
|
|
1478
1478
|
state: {
|
|
@@ -1516,7 +1516,7 @@ function ri(e) {
|
|
|
1516
1516
|
const a = await e.refresh();
|
|
1517
1517
|
a.url === n.url && r({
|
|
1518
1518
|
url: a.url,
|
|
1519
|
-
status: ((l = a.conversation) == null ? void 0 : l.status) ??
|
|
1519
|
+
status: ((l = a.conversation) == null ? void 0 : l.status) ?? Q.OPEN
|
|
1520
1520
|
});
|
|
1521
1521
|
}
|
|
1522
1522
|
});
|
|
@@ -1560,15 +1560,15 @@ class oi {
|
|
|
1560
1560
|
copilotSupportChannelUrl: (g = this.filter) == null ? void 0 : g.copilotSupportChannelUrl,
|
|
1561
1561
|
limit: this._limit
|
|
1562
1562
|
}), this._token = "", this._timestamp = Number.MAX_SAFE_INTEGER, this._isSyncing = !1, this._throttledOnChannelChanged = fr(
|
|
1563
|
-
(
|
|
1564
|
-
|
|
1563
|
+
(f) => {
|
|
1564
|
+
f.isGroupChannel() && (this._query.belongsTo(f) ? this._addChannelsToView([f], !1) : this._removeChannelsFromView([f.url]));
|
|
1565
1565
|
},
|
|
1566
1566
|
250,
|
|
1567
1567
|
{ trailing: !1, leading: !0 }
|
|
1568
1568
|
), this._channelHandler = new No({
|
|
1569
1569
|
onChannelChanged: this._throttledOnChannelChanged,
|
|
1570
|
-
onChannelDeleted: (
|
|
1571
|
-
this._removeChannelsFromView([
|
|
1570
|
+
onChannelDeleted: (f) => {
|
|
1571
|
+
this._removeChannelsFromView([f]);
|
|
1572
1572
|
}
|
|
1573
1573
|
}), this._connectionHandler = new xt({
|
|
1574
1574
|
onReconnectSucceeded: () => {
|
|
@@ -1627,8 +1627,8 @@ class oi {
|
|
|
1627
1627
|
if (d === void 0) continue;
|
|
1628
1628
|
const g = Bt(this._pinnedChannels, c);
|
|
1629
1629
|
g >= 0 ? (this._pinnedChannels.splice(g, 1), i.push(c)) : s.push(c);
|
|
1630
|
-
const b = this._pinnedChannels.findIndex((
|
|
1631
|
-
this._pinnedChannels.splice(
|
|
1630
|
+
const b = this._pinnedChannels.findIndex((_) => (r.get(_.url) ?? 1 / 0) > d), v = b === -1 ? this._pinnedChannels.length : b;
|
|
1631
|
+
this._pinnedChannels.splice(v, 0, c);
|
|
1632
1632
|
}
|
|
1633
1633
|
return { addedChannels: s, updatedChannels: i, unmatchedChannelUrls: a };
|
|
1634
1634
|
}
|
|
@@ -1647,8 +1647,8 @@ class oi {
|
|
|
1647
1647
|
}
|
|
1648
1648
|
const l = Bt(this._channels, a), c = l < 0;
|
|
1649
1649
|
!c && this._channels.splice(l, 1);
|
|
1650
|
-
const g = si(this._channels, a, this._order).place,
|
|
1651
|
-
c ?
|
|
1650
|
+
const g = si(this._channels, a, this._order).place, f = g === this._channels.length;
|
|
1651
|
+
c ? f ? (n || !this.hasMore) && (this._channels.push(a), s.push(a)) : (this._channels.splice(g, 0, a), s.push(a)) : (this._channels.splice(g, 0, a), i.push(a));
|
|
1652
1652
|
}
|
|
1653
1653
|
return { addedChannels: s, updatedChannels: i, unmatchedChannelUrls: r };
|
|
1654
1654
|
}
|
|
@@ -1658,12 +1658,12 @@ class oi {
|
|
|
1658
1658
|
* @param forceAppend - Whether to force append channels at the end
|
|
1659
1659
|
*/
|
|
1660
1660
|
_addChannelsToView(t, n = !1) {
|
|
1661
|
-
var
|
|
1662
|
-
const r = new Set(((
|
|
1661
|
+
var f, b, v, _, E;
|
|
1662
|
+
const r = new Set(((f = this.filter) == null ? void 0 : f.pinnedChannelUrls) ?? []), s = [], i = [];
|
|
1663
1663
|
for (const u of t)
|
|
1664
1664
|
r.has(u.url) ? s.push(u) : i.push(u);
|
|
1665
1665
|
const a = this._upsertPinnedChannelsToArray(s), l = this._upsertRegularChannelsToArray(i, n), c = a.addedChannels.concat(l.addedChannels), d = a.updatedChannels.concat(l.updatedChannels), g = a.unmatchedChannelUrls.concat(l.unmatchedChannelUrls);
|
|
1666
|
-
c.length > 0 && ((
|
|
1666
|
+
c.length > 0 && ((v = (b = this._collectionEventHandler) == null ? void 0 : b.onChannelsAdded) == null || v.call(b, {}, c)), d.length > 0 && ((E = (_ = this._collectionEventHandler) == null ? void 0 : _.onChannelsUpdated) == null || E.call(_, {}, d)), g.length > 0 && this._removeChannelsFromView(g);
|
|
1667
1667
|
}
|
|
1668
1668
|
/**
|
|
1669
1669
|
* Removes channels from the collection by their URLs.
|
|
@@ -1752,10 +1752,10 @@ const Bt = (e, t) => e.findIndex((n) => n.isIdentical(t)), si = (e, t, n) => {
|
|
|
1752
1752
|
}
|
|
1753
1753
|
};
|
|
1754
1754
|
function ii(e, t) {
|
|
1755
|
-
var
|
|
1756
|
-
const n = Wt(), [r, s] = C(!1), [i, a] = C(null), [l, c] = C([]), [d, g] = C(null),
|
|
1757
|
-
if (!
|
|
1758
|
-
|
|
1755
|
+
var _, E, u, p, x, y, k, S, O, $;
|
|
1756
|
+
const n = Wt(), [r, s] = C(!1), [i, a] = C(null), [l, c] = C([]), [d, g] = C(null), f = B(!1), b = L(async () => {
|
|
1757
|
+
if (!f.current && e.currentUser) {
|
|
1758
|
+
f.current = !0, s(!1), a(null), c([]);
|
|
1759
1759
|
try {
|
|
1760
1760
|
d == null || d.dispose();
|
|
1761
1761
|
const M = new oi(e, t);
|
|
@@ -1773,21 +1773,21 @@ function ii(e, t) {
|
|
|
1773
1773
|
} catch (M) {
|
|
1774
1774
|
g(null), a(M);
|
|
1775
1775
|
} finally {
|
|
1776
|
-
s(!0),
|
|
1776
|
+
s(!0), f.current = !1;
|
|
1777
1777
|
}
|
|
1778
1778
|
}
|
|
1779
1779
|
}, [
|
|
1780
1780
|
e,
|
|
1781
1781
|
e.currentUser,
|
|
1782
|
-
(
|
|
1782
|
+
(_ = t.filter) == null ? void 0 : _.aiAgentChannelFilter,
|
|
1783
1783
|
(u = (E = t.filter) == null ? void 0 : E.aiAgentConversationStatusFilter) == null ? void 0 : u.join(),
|
|
1784
|
-
(x = (
|
|
1784
|
+
(x = (p = t.filter) == null ? void 0 : p.aiAgentIds) == null ? void 0 : x.join(),
|
|
1785
1785
|
(y = t.filter) == null ? void 0 : y.deskChannelFilter,
|
|
1786
1786
|
(S = (k = t.filter) == null ? void 0 : k.pinnedChannelUrls) == null ? void 0 : S.join(),
|
|
1787
1787
|
(O = t.filter) == null ? void 0 : O.copilotConversationOnly,
|
|
1788
1788
|
($ = t.filter) == null ? void 0 : $.copilotSupportChannelUrl,
|
|
1789
1789
|
t.limit
|
|
1790
|
-
]),
|
|
1790
|
+
]), v = L(async () => {
|
|
1791
1791
|
if (d)
|
|
1792
1792
|
try {
|
|
1793
1793
|
await d.loadMore();
|
|
@@ -1798,27 +1798,27 @@ function ii(e, t) {
|
|
|
1798
1798
|
return P(() => (e.addConnectionHandler(n, new xt({ onConnected: () => b() })), () => e.removeConnectionHandler(n)), [e, n, b]), P(() => {
|
|
1799
1799
|
b();
|
|
1800
1800
|
}, [b]), P(() => () => {
|
|
1801
|
-
|
|
1801
|
+
f.current = !1, d == null || d.dispose();
|
|
1802
1802
|
}, [d]), {
|
|
1803
1803
|
initialized: r,
|
|
1804
1804
|
error: i,
|
|
1805
1805
|
channels: l,
|
|
1806
|
-
loadMore:
|
|
1806
|
+
loadMore: v
|
|
1807
1807
|
};
|
|
1808
1808
|
}
|
|
1809
1809
|
const {
|
|
1810
1810
|
Provider: ai
|
|
1811
|
-
} =
|
|
1811
|
+
} = ee("AIAgentConversationList");
|
|
1812
1812
|
function li({
|
|
1813
1813
|
conversationListLimit: e,
|
|
1814
1814
|
conversationListFilter: t,
|
|
1815
1815
|
children: n
|
|
1816
1816
|
}) {
|
|
1817
|
-
var
|
|
1817
|
+
var f, b;
|
|
1818
1818
|
const { chatSDK: r, aiAgentId: s, queryParams: i } = X(), a = {
|
|
1819
1819
|
aiAgentIds: [s],
|
|
1820
|
-
aiAgentConversationStatusFilter: [
|
|
1821
|
-
}, l = e ?? ((
|
|
1820
|
+
aiAgentConversationStatusFilter: [Q.CLOSED, Q.OPEN]
|
|
1821
|
+
}, l = e ?? ((f = i == null ? void 0 : i.conversationListParams) == null ? void 0 : f.limit), c = {
|
|
1822
1822
|
...a,
|
|
1823
1823
|
...(b = i == null ? void 0 : i.conversationListParams) == null ? void 0 : b.filter,
|
|
1824
1824
|
...t
|
|
@@ -1849,31 +1849,31 @@ function ci(e) {
|
|
|
1849
1849
|
const {
|
|
1850
1850
|
Provider: di,
|
|
1851
1851
|
useContext: _r
|
|
1852
|
-
} =
|
|
1852
|
+
} = ee("MessageTemplateFetching");
|
|
1853
1853
|
function ui({ children: e, internalVariables: t }) {
|
|
1854
1854
|
const n = B({}), r = B({}), [s, i] = C({}), a = L((d, g) => {
|
|
1855
|
-
i((
|
|
1856
|
-
...
|
|
1857
|
-
[d]: { fetching: !1, error: !1, ...
|
|
1855
|
+
i((f) => ({
|
|
1856
|
+
...f,
|
|
1857
|
+
[d]: { fetching: !1, error: !1, ...f[d], ...g }
|
|
1858
1858
|
}));
|
|
1859
1859
|
}, []), l = L(
|
|
1860
1860
|
async ({
|
|
1861
1861
|
onRequestTemplate: d,
|
|
1862
1862
|
onGetCachedTemplate: g,
|
|
1863
|
-
templateKey:
|
|
1863
|
+
templateKey: f,
|
|
1864
1864
|
suspense: b = !1
|
|
1865
1865
|
}) => {
|
|
1866
|
-
const
|
|
1867
|
-
if (_) return _;
|
|
1868
|
-
const v = r.current[p];
|
|
1866
|
+
const v = g(f);
|
|
1869
1867
|
if (v) return v;
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1868
|
+
const _ = r.current[f];
|
|
1869
|
+
if (_) return _;
|
|
1870
|
+
b || a(f, { fetching: !0 });
|
|
1871
|
+
const E = d(f).catch((u) => {
|
|
1872
|
+
throw b || a(f, { error: !0 }), u;
|
|
1873
1873
|
}).finally(() => {
|
|
1874
|
-
b || a(
|
|
1874
|
+
b || a(f, { fetching: !1 }), delete r.current[f];
|
|
1875
1875
|
});
|
|
1876
|
-
return r.current[
|
|
1876
|
+
return r.current[f] = E, E;
|
|
1877
1877
|
},
|
|
1878
1878
|
[a]
|
|
1879
1879
|
), c = {
|
|
@@ -1882,8 +1882,8 @@ function ui({ children: e, internalVariables: t }) {
|
|
|
1882
1882
|
suspend: (d, g) => {
|
|
1883
1883
|
if (n.current[d])
|
|
1884
1884
|
return n.current[d];
|
|
1885
|
-
const
|
|
1886
|
-
return n.current[d] =
|
|
1885
|
+
const f = ci(g());
|
|
1886
|
+
return n.current[d] = f, f;
|
|
1887
1887
|
},
|
|
1888
1888
|
getIsFetching: (d) => {
|
|
1889
1889
|
var g;
|
|
@@ -1900,7 +1900,7 @@ const Ct = {
|
|
|
1900
1900
|
VARIABLE: (e) => new RegExp(`\\{${e}\\}`, "g"),
|
|
1901
1901
|
VIEW_VARIABLE: (e) => new RegExp(`"{@${e}}"`, "g")
|
|
1902
1902
|
};
|
|
1903
|
-
function
|
|
1903
|
+
function $e({ uiTemplateString: e, variables: t = {} }) {
|
|
1904
1904
|
const n = Hs(t);
|
|
1905
1905
|
return Zt({
|
|
1906
1906
|
template: e,
|
|
@@ -1908,7 +1908,7 @@ function Me({ uiTemplateString: e, variables: t = {} }) {
|
|
|
1908
1908
|
variableKeyPattern: (r) => Ct.VARIABLE(r)
|
|
1909
1909
|
});
|
|
1910
1910
|
}
|
|
1911
|
-
function
|
|
1911
|
+
function Me({
|
|
1912
1912
|
theme: e,
|
|
1913
1913
|
uiTemplateString: t,
|
|
1914
1914
|
colorVariables: n = {}
|
|
@@ -1934,21 +1934,21 @@ function mi({
|
|
|
1934
1934
|
variables: n,
|
|
1935
1935
|
variableKeyPattern: (d) => Ct.VIEW_VARIABLE(d),
|
|
1936
1936
|
variableValueTransformer: (d) => {
|
|
1937
|
-
const g = d.map(({ key:
|
|
1938
|
-
const
|
|
1939
|
-
let u = JSON.stringify(
|
|
1940
|
-
return u =
|
|
1937
|
+
const g = d.map(({ key: f, variables: b }) => {
|
|
1938
|
+
const v = i(f), { ui_template: _, color_variables: E } = et(v);
|
|
1939
|
+
let u = JSON.stringify(_);
|
|
1940
|
+
return u = $e({
|
|
1941
1941
|
uiTemplateString: u,
|
|
1942
1942
|
variables: s
|
|
1943
|
-
}), u =
|
|
1943
|
+
}), u = Me({
|
|
1944
1944
|
theme: e,
|
|
1945
1945
|
uiTemplateString: u,
|
|
1946
1946
|
colorVariables: E
|
|
1947
|
-
}), u =
|
|
1947
|
+
}), u = Me({
|
|
1948
1948
|
theme: e,
|
|
1949
1949
|
uiTemplateString: u,
|
|
1950
1950
|
colorVariables: r
|
|
1951
|
-
}), u =
|
|
1951
|
+
}), u = $e({
|
|
1952
1952
|
uiTemplateString: u,
|
|
1953
1953
|
variables: b
|
|
1954
1954
|
}), _t(u);
|
|
@@ -1971,23 +1971,23 @@ async function gi({
|
|
|
1971
1971
|
variableKeyPattern: (a) => Ct.VIEW_VARIABLE(a),
|
|
1972
1972
|
variableValueTransformer: async (a) => {
|
|
1973
1973
|
const l = a.map(async ({ key: d, variables: g }) => {
|
|
1974
|
-
const
|
|
1975
|
-
let
|
|
1976
|
-
return
|
|
1977
|
-
uiTemplateString:
|
|
1974
|
+
const f = await i(d), { ui_template: b, color_variables: v } = et(f);
|
|
1975
|
+
let _ = JSON.stringify(b);
|
|
1976
|
+
return _ = $e({
|
|
1977
|
+
uiTemplateString: _,
|
|
1978
1978
|
variables: s
|
|
1979
|
-
}),
|
|
1979
|
+
}), _ = Me({
|
|
1980
1980
|
theme: e,
|
|
1981
|
-
uiTemplateString:
|
|
1982
|
-
colorVariables:
|
|
1983
|
-
}),
|
|
1981
|
+
uiTemplateString: _,
|
|
1982
|
+
colorVariables: v
|
|
1983
|
+
}), _ = Me({
|
|
1984
1984
|
theme: e,
|
|
1985
|
-
uiTemplateString:
|
|
1985
|
+
uiTemplateString: _,
|
|
1986
1986
|
colorVariables: r
|
|
1987
|
-
}),
|
|
1988
|
-
uiTemplateString:
|
|
1987
|
+
}), _ = $e({
|
|
1988
|
+
uiTemplateString: _,
|
|
1989
1989
|
variables: g
|
|
1990
|
-
}), _t(
|
|
1990
|
+
}), _t(_);
|
|
1991
1991
|
}), c = await Promise.all(l);
|
|
1992
1992
|
return JSON.stringify(c);
|
|
1993
1993
|
}
|
|
@@ -2011,7 +2011,7 @@ const hi = ({
|
|
|
2011
2011
|
if (c === null) return null;
|
|
2012
2012
|
a = c;
|
|
2013
2013
|
}
|
|
2014
|
-
return a =
|
|
2014
|
+
return a = $e({ ...r, uiTemplateString: a, variables: n }), a = Me({ ...r, uiTemplateString: a, colorVariables: i }), a = Me({ ...r, uiTemplateString: a, colorVariables: t }), a = $e({ ...r, uiTemplateString: a }), _t(a);
|
|
2015
2015
|
}, pi = async ({
|
|
2016
2016
|
rawTemplate: e,
|
|
2017
2017
|
aiAgentColorVariables: t,
|
|
@@ -2025,7 +2025,7 @@ const hi = ({
|
|
|
2025
2025
|
uiTemplateString: a,
|
|
2026
2026
|
aiAgentColorVariables: t,
|
|
2027
2027
|
internalVariables: n
|
|
2028
|
-
})), a =
|
|
2028
|
+
})), a = $e({ ...r, uiTemplateString: a, variables: n }), a = Me({ ...r, uiTemplateString: a, colorVariables: i }), a = Me({ ...r, uiTemplateString: a, colorVariables: t }), a = $e({ ...r, uiTemplateString: a }), _t(a);
|
|
2029
2029
|
}, fi = (e) => {
|
|
2030
2030
|
const { aiAgentColorVariables: t = {} } = e, { internalVariables: n } = _r();
|
|
2031
2031
|
return C(() => {
|
|
@@ -2205,68 +2205,68 @@ const wi = (e, t = {}) => {
|
|
|
2205
2205
|
if (d === "submitted" || d === "canceled") {
|
|
2206
2206
|
const E = {};
|
|
2207
2207
|
let u = !1;
|
|
2208
|
-
e.fields.forEach((
|
|
2209
|
-
const x = $n(
|
|
2210
|
-
JSON.stringify(l[
|
|
2208
|
+
e.fields.forEach((p) => {
|
|
2209
|
+
const x = $n(p);
|
|
2210
|
+
JSON.stringify(l[p.key]) !== JSON.stringify(x) && (u = !0), E[p.key] = x;
|
|
2211
2211
|
}), u && c(E);
|
|
2212
2212
|
}
|
|
2213
2213
|
}, [d]);
|
|
2214
2214
|
const g = (E, u) => {
|
|
2215
|
-
c((
|
|
2216
|
-
},
|
|
2215
|
+
c((p) => ({ ...p, [E]: u })), a((p) => ({ ...p, [E]: void 0 }));
|
|
2216
|
+
}, f = e.fields.map((E) => {
|
|
2217
2217
|
var x, y, k;
|
|
2218
|
-
const u = l[E.key] ?? null,
|
|
2218
|
+
const u = l[E.key] ?? null, p = {
|
|
2219
2219
|
key: E.key,
|
|
2220
2220
|
label: E.label,
|
|
2221
2221
|
error: i[E.key],
|
|
2222
2222
|
required: E.required
|
|
2223
2223
|
};
|
|
2224
2224
|
return E.type === "text" ? {
|
|
2225
|
-
...
|
|
2225
|
+
...p,
|
|
2226
2226
|
type: "text",
|
|
2227
2227
|
layout: E.layout,
|
|
2228
2228
|
value: u,
|
|
2229
2229
|
...E.placeholder && { placeholder: E.placeholder },
|
|
2230
2230
|
...((x = E.rules) == null ? void 0 : x.max_length) && { maxLength: E.rules.max_length }
|
|
2231
2231
|
} : E.type === "number" ? {
|
|
2232
|
-
...
|
|
2232
|
+
...p,
|
|
2233
2233
|
type: "number",
|
|
2234
2234
|
layout: E.layout,
|
|
2235
2235
|
value: u,
|
|
2236
2236
|
...E.placeholder && { placeholder: E.placeholder },
|
|
2237
2237
|
...((y = E.rules) == null ? void 0 : y.max) && { max: E.rules.max }
|
|
2238
2238
|
} : E.type === "single-select" ? {
|
|
2239
|
-
...
|
|
2239
|
+
...p,
|
|
2240
2240
|
type: "single-select",
|
|
2241
2241
|
layout: E.layout,
|
|
2242
2242
|
value: u,
|
|
2243
2243
|
options: E.options
|
|
2244
2244
|
} : E.type === "multi-select" ? {
|
|
2245
|
-
...
|
|
2245
|
+
...p,
|
|
2246
2246
|
type: "multi-select",
|
|
2247
2247
|
layout: E.layout,
|
|
2248
2248
|
value: u,
|
|
2249
2249
|
options: E.options,
|
|
2250
2250
|
...((k = E.rules) == null ? void 0 : k.max_select) && { maxSelect: E.rules.max_select }
|
|
2251
|
-
} : { ...
|
|
2251
|
+
} : { ...p, type: "unknown", layout: "default", value: null };
|
|
2252
2252
|
});
|
|
2253
2253
|
return {
|
|
2254
2254
|
state: d,
|
|
2255
|
-
fields:
|
|
2256
|
-
getField: (E) =>
|
|
2255
|
+
fields: f,
|
|
2256
|
+
getField: (E) => f.find((u) => u.key === E),
|
|
2257
2257
|
updateFieldValue: g,
|
|
2258
2258
|
submit: async () => {
|
|
2259
2259
|
const E = {};
|
|
2260
2260
|
let u = !1;
|
|
2261
|
-
for (const
|
|
2262
|
-
const x = l[
|
|
2263
|
-
y.isValid || (E[
|
|
2261
|
+
for (const p of e.fields) {
|
|
2262
|
+
const x = l[p.key] ?? null, y = Ai(p, x, n);
|
|
2263
|
+
y.isValid || (E[p.key] = y.error, u = !0);
|
|
2264
2264
|
}
|
|
2265
2265
|
if (a(E), !u && r) {
|
|
2266
|
-
const
|
|
2266
|
+
const p = {};
|
|
2267
2267
|
e.fields.forEach((x) => {
|
|
2268
|
-
|
|
2269
|
-
}), await r(
|
|
2268
|
+
p[x.key] = l[x.key] ?? null;
|
|
2269
|
+
}), await r(p);
|
|
2270
2270
|
}
|
|
2271
2271
|
},
|
|
2272
2272
|
cancel: async () => {
|
|
@@ -2301,24 +2301,24 @@ const Ii = /* @__PURE__ */ new Set(["free_text", "single_choice"]), ki = ({ csat
|
|
|
2301
2301
|
isResolved: s
|
|
2302
2302
|
}), [l, c] = Mn({ followUpItem: !1 }), d = ie(() => {
|
|
2303
2303
|
var E;
|
|
2304
|
-
const
|
|
2305
|
-
if (typeof
|
|
2306
|
-
const
|
|
2307
|
-
(u) => u.scores.includes(
|
|
2304
|
+
const v = i.csat;
|
|
2305
|
+
if (typeof v != "number") return;
|
|
2306
|
+
const _ = (E = e.follow_up) == null ? void 0 : E.find(
|
|
2307
|
+
(u) => u.scores.includes(v)
|
|
2308
2308
|
);
|
|
2309
|
-
if (Ii.has(
|
|
2309
|
+
if (Ii.has(_ == null ? void 0 : _.response_type)) return _;
|
|
2310
2310
|
}, [i.csat, e.follow_up]), g = (() => {
|
|
2311
|
-
var
|
|
2311
|
+
var v;
|
|
2312
2312
|
if (typeof n == "number")
|
|
2313
2313
|
return "submitted";
|
|
2314
2314
|
if ((t === Ee.AI_AGENT_CSAT_5 || t === Ee.HELPDESK_CSAT_5) && typeof i.csat == "number")
|
|
2315
2315
|
return "submittable";
|
|
2316
2316
|
if (t === Ee.AI_AGENT_CSAT_5_WITH_CRE) {
|
|
2317
|
-
const
|
|
2318
|
-
if (
|
|
2317
|
+
const _ = typeof i.csat == "number", E = !((v = e.cre) != null && v.required) || typeof i.isResolved == "boolean";
|
|
2318
|
+
if (_ && E) return "submittable";
|
|
2319
2319
|
}
|
|
2320
2320
|
return "unsubmittable";
|
|
2321
|
-
})(),
|
|
2321
|
+
})(), f = L(() => typeof i.csat > "u" ? !1 : d != null && d.required && !i.csatReason ? (c({ followUpItem: !0 }), !1) : !0, [i, d, c]);
|
|
2322
2322
|
return P(() => {
|
|
2323
2323
|
r || (a({ csatReason: "" }), c({ followUpItem: !1 }));
|
|
2324
2324
|
}, [r, d, a, c]), {
|
|
@@ -2328,7 +2328,7 @@ const Ii = /* @__PURE__ */ new Set(["free_text", "single_choice"]), ki = ({ csat
|
|
|
2328
2328
|
setError: c,
|
|
2329
2329
|
followUpItem: d,
|
|
2330
2330
|
state: g,
|
|
2331
|
-
validateParams:
|
|
2331
|
+
validateParams: f,
|
|
2332
2332
|
itemProps: {
|
|
2333
2333
|
csatPayload: e,
|
|
2334
2334
|
state: g,
|
|
@@ -2344,36 +2344,36 @@ const Ii = /* @__PURE__ */ new Set(["free_text", "single_choice"]), ki = ({ csat
|
|
|
2344
2344
|
onStart: r,
|
|
2345
2345
|
onProgress: s,
|
|
2346
2346
|
onComplete: i
|
|
2347
|
-
}).current,
|
|
2347
|
+
}).current, f = B({
|
|
2348
2348
|
startCalled: !1,
|
|
2349
2349
|
completeCalled: !1
|
|
2350
2350
|
}).current, b = B({
|
|
2351
2351
|
initialEnabled: n,
|
|
2352
2352
|
textLength: t.length,
|
|
2353
2353
|
enabled: n
|
|
2354
|
-
}).current,
|
|
2355
|
-
return
|
|
2354
|
+
}).current, v = n, _ = a < t.length, E = b.initialEnabled && (v || _);
|
|
2355
|
+
return oe(() => {
|
|
2356
2356
|
g.onStart = r, g.onProgress = s, g.onComplete = i, b.textLength = t.length, b.enabled = n;
|
|
2357
|
-
}),
|
|
2357
|
+
}), oe(() => {
|
|
2358
2358
|
var u;
|
|
2359
|
-
b.initialEnabled && (
|
|
2359
|
+
b.initialEnabled && (f.startCalled || (f.startCalled = !0, (u = g.onStart) == null || u.call(g)), l((p) => t.length < p ? t.length : p));
|
|
2360
2360
|
}, [t]), P(() => {
|
|
2361
2361
|
if (!b.initialEnabled) return;
|
|
2362
2362
|
let u = Ln(t.length);
|
|
2363
2363
|
d.lastUpdate = 0, d.startTime = 0, d.lastProgressCall = 0;
|
|
2364
|
-
const
|
|
2365
|
-
var
|
|
2364
|
+
const p = (x) => {
|
|
2365
|
+
var j;
|
|
2366
2366
|
d.lastUpdate === 0 && (d.lastUpdate = x, d.startTime = x, d.lastProgressCall = x);
|
|
2367
2367
|
const y = b.textLength, k = x - d.lastUpdate, S = x - d.startTime, { speed: O, chunkSize: $ } = Li(S), M = O * $;
|
|
2368
|
-
k >= M && u < y && (u = Math.min(u + $, y), l(u), d.lastUpdate = x), x - d.lastProgressCall >= $i && (d.lastProgressCall = x, (
|
|
2368
|
+
k >= M && u < y && (u = Math.min(u + $, y), l(u), d.lastUpdate = x), x - d.lastProgressCall >= $i && (d.lastProgressCall = x, (j = g.onProgress) == null || j.call(g)), (u < y || b.enabled) && (c.current = requestAnimationFrame(p));
|
|
2369
2369
|
};
|
|
2370
|
-
return c.current = requestAnimationFrame(
|
|
2370
|
+
return c.current = requestAnimationFrame(p), () => {
|
|
2371
2371
|
c.current && cancelAnimationFrame(c.current);
|
|
2372
2372
|
};
|
|
2373
2373
|
}, []), P(() => {
|
|
2374
2374
|
var y;
|
|
2375
|
-
const u = b.initialEnabled &&
|
|
2376
|
-
u &&
|
|
2375
|
+
const u = b.initialEnabled && f.startCalled, p = !n, x = a >= t.length && t.length > 0;
|
|
2376
|
+
u && p && x && !f.completeCalled && (f.completeCalled = !0, (y = g.onComplete) == null || y.call(g));
|
|
2377
2377
|
}, [n, a, t.length]), {
|
|
2378
2378
|
streamText: b.initialEnabled ? t.slice(0, a) : t,
|
|
2379
2379
|
isAnimating: E
|
|
@@ -2593,7 +2593,7 @@ async function Vi(e) {
|
|
|
2593
2593
|
if (t) return t;
|
|
2594
2594
|
try {
|
|
2595
2595
|
if (Fi.has(e)) {
|
|
2596
|
-
const { default: n } = await Pi(/* @__PURE__ */ Object.assign({ "./languages/de.ts": () => import("./
|
|
2596
|
+
const { default: n } = await Pi(/* @__PURE__ */ Object.assign({ "./languages/de.ts": () => import("./YUOGDsml.js"), "./languages/en.ts": () => Promise.resolve().then(() => Hi), "./languages/es.ts": () => import("./CFFZNjOj.js"), "./languages/fr.ts": () => import("./-WWqhsdP.js"), "./languages/hi.ts": () => import("./Bsb8urZu.js"), "./languages/it.ts": () => import("./C3PP_RTM.js"), "./languages/ja.ts": () => import("./yBEMlNSs.js"), "./languages/ko.ts": () => import("./BDvtEnu9.js"), "./languages/pt.ts": () => import("./nGzMJZzZ.js"), "./languages/tr.ts": () => import("./DIrWtn8H.js") }), `./languages/${e}.ts`, 3);
|
|
2597
2597
|
return Pt.set(e, n), n;
|
|
2598
2598
|
}
|
|
2599
2599
|
return pt;
|
|
@@ -2604,7 +2604,7 @@ async function Vi(e) {
|
|
|
2604
2604
|
const {
|
|
2605
2605
|
Provider: zi,
|
|
2606
2606
|
useContext: G
|
|
2607
|
-
} =
|
|
2607
|
+
} = ee("Localization"), Gi = ({
|
|
2608
2608
|
language: e = navigator.language,
|
|
2609
2609
|
logger: t,
|
|
2610
2610
|
stringSet: n,
|
|
@@ -2732,7 +2732,7 @@ const {
|
|
|
2732
2732
|
}, {
|
|
2733
2733
|
Provider: qi,
|
|
2734
2734
|
useContext: Sr
|
|
2735
|
-
} =
|
|
2735
|
+
} = ee("MessengerTheme");
|
|
2736
2736
|
function Ki(e) {
|
|
2737
2737
|
const { theme: t, appearance: n, logger: r } = e;
|
|
2738
2738
|
return /* @__PURE__ */ o.createElement(
|
|
@@ -2748,7 +2748,7 @@ function Ki(e) {
|
|
|
2748
2748
|
}
|
|
2749
2749
|
function Yi({ rootElement: e = document.body, children: t }) {
|
|
2750
2750
|
const { theme: n, updateTheme: r } = Yt();
|
|
2751
|
-
return
|
|
2751
|
+
return oe(() => {
|
|
2752
2752
|
e.setAttribute(ft, n.selectedTheme);
|
|
2753
2753
|
}, [e, n.selectedTheme]), /* @__PURE__ */ o.createElement(Co, { theme: n }, /* @__PURE__ */ o.createElement(qi, { value: { theme: n, updateTheme: r, rootElement: e } }, t));
|
|
2754
2754
|
}
|
|
@@ -2776,7 +2776,7 @@ const Zi = (e, t) => {
|
|
|
2776
2776
|
Provider: Ji,
|
|
2777
2777
|
Consumer: Tr,
|
|
2778
2778
|
useContext: Y
|
|
2779
|
-
} =
|
|
2779
|
+
} = ee("Messenger");
|
|
2780
2780
|
function Qi({
|
|
2781
2781
|
children: e,
|
|
2782
2782
|
state: t,
|
|
@@ -2791,12 +2791,12 @@ function Qi({
|
|
|
2791
2791
|
expanded: (t == null ? void 0 : t.expanded) ?? c,
|
|
2792
2792
|
setExpanded: (t == null ? void 0 : t.setExpanded) ?? d
|
|
2793
2793
|
};
|
|
2794
|
-
return /* @__PURE__ */ o.createElement(ms, { ...i }, (
|
|
2794
|
+
return /* @__PURE__ */ o.createElement(ms, { ...i }, (f) => /* @__PURE__ */ o.createElement(
|
|
2795
2795
|
Ji,
|
|
2796
2796
|
{
|
|
2797
2797
|
value: {
|
|
2798
2798
|
...i,
|
|
2799
|
-
...
|
|
2799
|
+
...f,
|
|
2800
2800
|
state: g,
|
|
2801
2801
|
enableCloseConversationButton: n,
|
|
2802
2802
|
enableExpandButton: r,
|
|
@@ -2938,7 +2938,7 @@ function Ea({ file: e, children: t, onClickFile: n }) {
|
|
|
2938
2938
|
}
|
|
2939
2939
|
), t);
|
|
2940
2940
|
}
|
|
2941
|
-
const xa = h.div`display:flex;flex-direction:column;align-items:flex-start;gap:${V.GAP_GROUPED}px;`, va = "1.13.
|
|
2941
|
+
const xa = h.div`display:flex;flex-direction:column;align-items:flex-start;gap:${V.GAP_GROUPED}px;`, va = "1.13.1", ce = "sb-agent", de = {
|
|
2942
2942
|
ENTRY: `${ce}-entry`,
|
|
2943
2943
|
MODAL_ROOT: `${ce}-modal-root`,
|
|
2944
2944
|
WINDOW: `${ce}-window`,
|
|
@@ -2970,7 +2970,7 @@ const Ta = h.div`display:flex;flex-direction:column;align-items:flex-start;gap:$
|
|
|
2970
2970
|
`, wa = h.img`width:100%;height:100%;object-fit:cover;`, Ia = h.video`width:100%;height:100%;object-fit:cover;`, ka = "✱", Ir = (e) => {
|
|
2971
2971
|
const t = new RegExp(`(\`+)([^\`]+?)\\1|(${ka}+)`, "g");
|
|
2972
2972
|
return e.replace(t, (n, r, s, i) => r ? n : i ? `<span id=${Ca} aria-label="masked-text">${i}</span>` : n);
|
|
2973
|
-
}, $a = (e) => e.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>"), Ma = D(async () => ({ default: (await import("./
|
|
2973
|
+
}, $a = (e) => e.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>"), Ma = D(async () => ({ default: (await import("./7nVEVfxl.js")).MarkdownText })), La = D(async () => ({ default: (await import("./Ch_6OPTz.js")).CodeBlock }));
|
|
2974
2974
|
function Nn(e) {
|
|
2975
2975
|
var s, i;
|
|
2976
2976
|
const t = e.maxBodyWidth ?? V.BODY_MAX_WIDTH, n = ie(() => ts(e.message, Ir), [e.message]), r = {
|
|
@@ -3086,38 +3086,38 @@ const Tt = ({ style: e, rootElementId: t, visible: n, onClose: r, children: s })
|
|
|
3086
3086
|
onSubmit: i,
|
|
3087
3087
|
isCommentEnabled: a = !1
|
|
3088
3088
|
}) => {
|
|
3089
|
-
const { stringSet: l } = G(), [c, d] = C(r), [g,
|
|
3090
|
-
|
|
3091
|
-
e ? (d(r),
|
|
3089
|
+
const { stringSet: l } = G(), [c, d] = C(r), [g, f] = C(s);
|
|
3090
|
+
oe(() => {
|
|
3091
|
+
e ? (d(r), f(s)) : (d(void 0), f(""));
|
|
3092
3092
|
}, [e, r, s]);
|
|
3093
3093
|
const b = () => {
|
|
3094
3094
|
c && (i({ rating: c, comment: g.trim() || void 0 }), t());
|
|
3095
|
-
},
|
|
3095
|
+
}, v = () => {
|
|
3096
3096
|
t();
|
|
3097
3097
|
};
|
|
3098
|
-
return e ? /* @__PURE__ */ o.createElement(Tt, { rootElementId: de.WINDOW, visible: e, onClose:
|
|
3099
|
-
const E = c ===
|
|
3098
|
+
return e ? /* @__PURE__ */ o.createElement(Tt, { rootElementId: de.WINDOW, visible: e, onClose: v }, /* @__PURE__ */ o.createElement(cl, null, /* @__PURE__ */ o.createElement(dl, null, /* @__PURE__ */ o.createElement(w, { variant: "h2", color: m.themedColor.textHighEmphasis }, l.FEEDBACK_TITLE)), /* @__PURE__ */ o.createElement(ul, null, /* @__PURE__ */ o.createElement(ml, null, ["good", "bad"].map((_) => {
|
|
3099
|
+
const E = c === _, u = _ === "good" ? l.FEEDBACK_GOOD : l.FEEDBACK_BAD;
|
|
3100
3100
|
return /* @__PURE__ */ o.createElement(
|
|
3101
3101
|
gl,
|
|
3102
3102
|
{
|
|
3103
|
-
key:
|
|
3103
|
+
key: _,
|
|
3104
3104
|
$selected: E,
|
|
3105
|
-
$rating:
|
|
3106
|
-
onClick: () => d(
|
|
3105
|
+
$rating: _,
|
|
3106
|
+
onClick: () => d(_)
|
|
3107
3107
|
},
|
|
3108
3108
|
/* @__PURE__ */ o.createElement(
|
|
3109
3109
|
H,
|
|
3110
3110
|
{
|
|
3111
|
-
type: E ? Ut(
|
|
3111
|
+
type: E ? Ut(_) : _,
|
|
3112
3112
|
size: 24,
|
|
3113
|
-
color: E ? Pn[
|
|
3113
|
+
color: E ? Pn[_] : m.themedColor.textLowEmphasis
|
|
3114
3114
|
}
|
|
3115
3115
|
),
|
|
3116
3116
|
/* @__PURE__ */ o.createElement(
|
|
3117
3117
|
w,
|
|
3118
3118
|
{
|
|
3119
3119
|
variant: "caption1",
|
|
3120
|
-
color: E ? Pn[
|
|
3120
|
+
color: E ? Pn[_] : m.themedColor.textLowEmphasis
|
|
3121
3121
|
},
|
|
3122
3122
|
u
|
|
3123
3123
|
)
|
|
@@ -3127,10 +3127,10 @@ const Tt = ({ style: e, rootElementId: t, visible: n, onClose: r, children: s })
|
|
|
3127
3127
|
{
|
|
3128
3128
|
placeholder: l.FEEDBACK_COMMENT_PLACEHOLDER,
|
|
3129
3129
|
value: g,
|
|
3130
|
-
onChange: (
|
|
3130
|
+
onChange: (_) => f(_.target.value),
|
|
3131
3131
|
maxLength: 100
|
|
3132
3132
|
}
|
|
3133
|
-
))), /* @__PURE__ */ o.createElement(fl, null, /* @__PURE__ */ o.createElement(bl, { onClick:
|
|
3133
|
+
))), /* @__PURE__ */ o.createElement(fl, null, /* @__PURE__ */ o.createElement(bl, { onClick: v }, /* @__PURE__ */ o.createElement(w, { variant: "button", color: m.themedColor.textHighEmphasis }, l.FEEDBACK_CANCEL)), /* @__PURE__ */ o.createElement(El, { onClick: b, disabled: !c }, /* @__PURE__ */ o.createElement(w, { variant: "button" }, n ? l.FEEDBACK_SAVE : l.FEEDBACK_SUBMIT))))) : null;
|
|
3134
3134
|
}, cl = h.div`width:280px;background-color:${({ theme: e }) => e.colors.base.modalContentBackground};border-radius:12px;overflow:hidden;`, dl = h.div`padding:24px;`, ul = h.div`padding-inline:24px;display:flex;flex-direction:column;gap:24px;`, ml = h.div`display:flex;gap:4px;`, gl = h.button`width:114px;height:64px;border-radius:12px;border:1px solid ${m.themedColor.textDisabled};box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0;gap:0;transition:background-color 0.2s;background-color:${({ $selected: e }) => e ? m.color.background100 : "transparent"};${({ $selected: e }) => F.dark`
|
|
3135
3135
|
background-color: ${e ? m.color.background600 : "transparent"};
|
|
3136
3136
|
`}
|
|
@@ -3155,19 +3155,19 @@ function xl({
|
|
|
3155
3155
|
extendedMessagePayload: i,
|
|
3156
3156
|
onFeedbackUpdate: a
|
|
3157
3157
|
}) {
|
|
3158
|
-
const { stringSet: l } = G(), [c, d] = C(!1), [g,
|
|
3159
|
-
if (
|
|
3158
|
+
const { stringSet: l } = G(), [c, d] = C(!1), [g, f] = C(!1), [b, v] = C(void 0), [_, E] = C(""), u = i == null ? void 0 : i.feedback, p = (u == null ? void 0 : u.rating) ?? "none";
|
|
3159
|
+
if (p !== "none" ? !1 : !!(n || !e || !r || (i == null ? void 0 : i.bot_message_type) !== "generated" || t)) return null;
|
|
3160
3160
|
const y = ($) => {
|
|
3161
|
-
|
|
3161
|
+
p === "none" ? (v($), E(""), d(!0)) : f(!0);
|
|
3162
3162
|
}, k = () => {
|
|
3163
|
-
a == null || a(null),
|
|
3163
|
+
a == null || a(null), f(!1);
|
|
3164
3164
|
}, S = () => {
|
|
3165
|
-
|
|
3165
|
+
f(!1), v(u == null ? void 0 : u.rating), E((u == null ? void 0 : u.comment) ?? ""), d(!0);
|
|
3166
3166
|
}, O = ($) => {
|
|
3167
3167
|
a == null || a($);
|
|
3168
3168
|
};
|
|
3169
|
-
return t &&
|
|
3170
|
-
const M =
|
|
3169
|
+
return t && p !== "none" ? /* @__PURE__ */ o.createElement(Hn, { $horizontal: !0 }, /* @__PURE__ */ o.createElement(vl, null, /* @__PURE__ */ o.createElement(H, { type: Ut(p), size: 12, color: Un[p] })), (u == null ? void 0 : u.comment) && /* @__PURE__ */ o.createElement(Vn, { variant: "caption2", style: { lineHeight: "16px" } }, u.comment)) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(Hn, null, /* @__PURE__ */ o.createElement(_l, null, ["good", "bad"].map(($) => {
|
|
3170
|
+
const M = p === $;
|
|
3171
3171
|
return /* @__PURE__ */ o.createElement(
|
|
3172
3172
|
yl,
|
|
3173
3173
|
{
|
|
@@ -3185,14 +3185,14 @@ function xl({
|
|
|
3185
3185
|
}
|
|
3186
3186
|
)
|
|
3187
3187
|
);
|
|
3188
|
-
})),
|
|
3188
|
+
})), p !== "none" && (u == null ? void 0 : u.comment) && /* @__PURE__ */ o.createElement(Vn, { variant: "caption2" }, u.comment)), /* @__PURE__ */ o.createElement(Ue, { visible: g, onClose: () => f(!1) }, /* @__PURE__ */ o.createElement(Ue.ActionItem, { onClick: S }, l.FEEDBACK_EDIT), /* @__PURE__ */ o.createElement(Ue.ActionItem, { onClick: k, destructive: !0 }, l.FEEDBACK_REMOVE)), /* @__PURE__ */ o.createElement(
|
|
3189
3189
|
ll,
|
|
3190
3190
|
{
|
|
3191
3191
|
visible: c,
|
|
3192
3192
|
onClose: () => d(!1),
|
|
3193
|
-
isEdit:
|
|
3193
|
+
isEdit: p !== "none",
|
|
3194
3194
|
initialRating: b,
|
|
3195
|
-
initialComment:
|
|
3195
|
+
initialComment: _,
|
|
3196
3196
|
onSubmit: O,
|
|
3197
3197
|
isCommentEnabled: s
|
|
3198
3198
|
}
|
|
@@ -3268,7 +3268,7 @@ const Hn = h.div`display:flex;flex-direction:${({ $horizontal: e }) => e ? "row"
|
|
|
3268
3268
|
max: l
|
|
3269
3269
|
}) => {
|
|
3270
3270
|
const c = (g) => {
|
|
3271
|
-
const b = g.target.value.replace(/[^0-9.-]/g, ""),
|
|
3271
|
+
const b = g.target.value.replace(/[^0-9.-]/g, ""), v = b.split("."), E = v.length > 1 ? v[0] + "." + v.slice(1).join("").replace(/\./g, "") : b;
|
|
3272
3272
|
if (g.target.value = E, E === "" || E === "-")
|
|
3273
3273
|
t == null || t(null);
|
|
3274
3274
|
else {
|
|
@@ -3416,8 +3416,8 @@ const Hn = h.div`display:flex;flex-direction:${({ $horizontal: e }) => e ? "row"
|
|
|
3416
3416
|
}) => {
|
|
3417
3417
|
const g = {
|
|
3418
3418
|
value: e,
|
|
3419
|
-
onChange: (
|
|
3420
|
-
const b =
|
|
3419
|
+
onChange: (f) => {
|
|
3420
|
+
const b = f.target.value;
|
|
3421
3421
|
c && b.length > c || t == null || t(b);
|
|
3422
3422
|
},
|
|
3423
3423
|
placeholder: n,
|
|
@@ -3470,7 +3470,7 @@ const Hn = h.div`display:flex;flex-direction:${({ $horizontal: e }) => e ? "row"
|
|
|
3470
3470
|
if (!t) throw new Error("Form is not provided");
|
|
3471
3471
|
const { stringSet: n } = G(), [r, s] = C({ submitting: !1, canceling: !1 }), [i, a] = C({
|
|
3472
3472
|
visible: !1
|
|
3473
|
-
}), { state: l, fields: c, submit: d, cancel: g, updateFieldValue:
|
|
3473
|
+
}), { state: l, fields: c, submit: d, cancel: g, updateFieldValue: f } = wi(t, {
|
|
3474
3474
|
labels: {
|
|
3475
3475
|
required: n.FORM_VALIDATION_REQUIRED,
|
|
3476
3476
|
regex: n.FORM_VALIDATION_REGEX_FAILED,
|
|
@@ -3481,87 +3481,87 @@ const Hn = h.div`display:flex;flex-direction:${({ $horizontal: e }) => e ? "row"
|
|
|
3481
3481
|
minSelect: n.FORM_VALIDATION_MIN_SELECT,
|
|
3482
3482
|
maxSelect: n.FORM_VALIDATION_MAX_SELECT
|
|
3483
3483
|
},
|
|
3484
|
-
onSubmit: (
|
|
3484
|
+
onSubmit: (p) => {
|
|
3485
3485
|
var x;
|
|
3486
|
-
return (x = e.onSubmitForm) == null ? void 0 : x.call(e, { key: t.key, data:
|
|
3486
|
+
return (x = e.onSubmitForm) == null ? void 0 : x.call(e, { key: t.key, data: p });
|
|
3487
3487
|
},
|
|
3488
3488
|
onCancel: () => {
|
|
3489
|
-
var
|
|
3490
|
-
return (
|
|
3489
|
+
var p;
|
|
3490
|
+
return (p = e.onCancelForm) == null ? void 0 : p.call(e, { key: t.key });
|
|
3491
3491
|
}
|
|
3492
|
-
}), b = l === "submitted",
|
|
3493
|
-
s((
|
|
3492
|
+
}), b = l === "submitted", v = async () => {
|
|
3493
|
+
s((p) => ({ ...p, submitting: !0 }));
|
|
3494
3494
|
try {
|
|
3495
3495
|
await d();
|
|
3496
|
-
} catch (
|
|
3496
|
+
} catch (p) {
|
|
3497
3497
|
a({
|
|
3498
3498
|
visible: !0,
|
|
3499
|
-
description:
|
|
3499
|
+
description: p instanceof Error ? p.message : n.TRY_AGAIN
|
|
3500
3500
|
});
|
|
3501
3501
|
} finally {
|
|
3502
|
-
s((
|
|
3502
|
+
s((p) => ({ ...p, submitting: !1 }));
|
|
3503
3503
|
}
|
|
3504
|
-
},
|
|
3505
|
-
s((
|
|
3504
|
+
}, _ = async () => {
|
|
3505
|
+
s((p) => ({ ...p, canceling: !0 }));
|
|
3506
3506
|
try {
|
|
3507
3507
|
await g();
|
|
3508
|
-
} catch (
|
|
3508
|
+
} catch (p) {
|
|
3509
3509
|
a({
|
|
3510
3510
|
visible: !0,
|
|
3511
|
-
description:
|
|
3511
|
+
description: p instanceof Error ? p.message : n.TRY_AGAIN
|
|
3512
3512
|
});
|
|
3513
3513
|
} finally {
|
|
3514
|
-
s((
|
|
3514
|
+
s((p) => ({ ...p, canceling: !1 }));
|
|
3515
3515
|
}
|
|
3516
3516
|
}, E = ie(() => {
|
|
3517
|
-
const
|
|
3518
|
-
return
|
|
3517
|
+
const p = () => t.version > sc, x = () => t.fields.some((y) => !ic.has(y.type));
|
|
3518
|
+
return p() || x() ? { visible: !1, cancelable: !0, reason: n.FORM_NOT_SUPPORTED } : l === "draft" && (e.isHandedOff || e.isConversationClosed) ? { visible: !1, cancelable: !1, reason: n.FORM_UNAVAILABLE } : { visible: !0, cancelable: !0, reason: "" };
|
|
3519
3519
|
}, [t.version, t.fields, l, e.isHandedOff, e.isConversationClosed]);
|
|
3520
|
-
return l === "canceled" ? null : E.visible ? /* @__PURE__ */ o.createElement(rr, null, /* @__PURE__ */ o.createElement(Gn, { $maxWidth: e.maxBodyWidth ?? V.BODY_MAX_WIDTH }, /* @__PURE__ */ o.createElement(J.Title, null, t.title), /* @__PURE__ */ o.createElement(lc, null, c.map((
|
|
3520
|
+
return l === "canceled" ? null : E.visible ? /* @__PURE__ */ o.createElement(rr, null, /* @__PURE__ */ o.createElement(Gn, { $maxWidth: e.maxBodyWidth ?? V.BODY_MAX_WIDTH }, /* @__PURE__ */ o.createElement(J.Title, null, t.title), /* @__PURE__ */ o.createElement(lc, null, c.map((p) => /* @__PURE__ */ o.createElement(cc, { key: p.key }, /* @__PURE__ */ o.createElement(J.Label, { style: { marginBottom: "6px" }, required: p.required }, p.label), p.type === "text" && /* @__PURE__ */ o.createElement(
|
|
3521
3521
|
J.TextInput,
|
|
3522
3522
|
{
|
|
3523
|
-
value:
|
|
3524
|
-
placeholder:
|
|
3525
|
-
onChange: (x) => p
|
|
3523
|
+
value: p.value || "",
|
|
3524
|
+
placeholder: p.placeholder,
|
|
3525
|
+
onChange: (x) => f(p.key, x),
|
|
3526
3526
|
disabled: b,
|
|
3527
|
-
error: !!
|
|
3527
|
+
error: !!p.error,
|
|
3528
3528
|
submitted: b,
|
|
3529
|
-
variant:
|
|
3530
|
-
maxLength:
|
|
3529
|
+
variant: p.layout === "multiline" ? "multi-line" : "single-line",
|
|
3530
|
+
maxLength: p.maxLength
|
|
3531
3531
|
}
|
|
3532
|
-
),
|
|
3532
|
+
), p.type === "number" && /* @__PURE__ */ o.createElement(
|
|
3533
3533
|
J.NumberInput,
|
|
3534
3534
|
{
|
|
3535
|
-
value:
|
|
3536
|
-
placeholder:
|
|
3537
|
-
onChange: (x) => p
|
|
3535
|
+
value: p.value || null,
|
|
3536
|
+
placeholder: p.placeholder,
|
|
3537
|
+
onChange: (x) => f(p.key, x),
|
|
3538
3538
|
disabled: b,
|
|
3539
|
-
error: !!
|
|
3539
|
+
error: !!p.error,
|
|
3540
3540
|
submitted: b,
|
|
3541
|
-
max:
|
|
3541
|
+
max: p.max
|
|
3542
3542
|
}
|
|
3543
|
-
),
|
|
3543
|
+
), p.type === "single-select" && /* @__PURE__ */ o.createElement(
|
|
3544
3544
|
J.SingleSelect,
|
|
3545
3545
|
{
|
|
3546
|
-
options:
|
|
3547
|
-
value:
|
|
3548
|
-
onChange: (x) => p
|
|
3546
|
+
options: p.options.map((x) => ({ label: x, value: x })),
|
|
3547
|
+
value: p.value || "",
|
|
3548
|
+
onChange: (x) => f(p.key, x),
|
|
3549
3549
|
submitted: b
|
|
3550
3550
|
}
|
|
3551
|
-
),
|
|
3551
|
+
), p.type === "multi-select" && /* @__PURE__ */ o.createElement(
|
|
3552
3552
|
J.MultiSelect,
|
|
3553
3553
|
{
|
|
3554
|
-
options:
|
|
3555
|
-
value:
|
|
3556
|
-
onChange: (x) => p
|
|
3554
|
+
options: p.options.map((x) => ({ label: x, value: x })),
|
|
3555
|
+
value: p.value || [],
|
|
3556
|
+
onChange: (x) => f(p.key, x),
|
|
3557
3557
|
submitted: b,
|
|
3558
|
-
maxSelect:
|
|
3558
|
+
maxSelect: p.maxSelect
|
|
3559
3559
|
}
|
|
3560
|
-
),
|
|
3560
|
+
), p.error && /* @__PURE__ */ o.createElement(J.ErrorLabel, { style: { marginTop: "4px" } }, p.error)))), /* @__PURE__ */ o.createElement(J.Separator, null), /* @__PURE__ */ o.createElement(dc, null, /* @__PURE__ */ o.createElement(
|
|
3561
3561
|
J.Button,
|
|
3562
3562
|
{
|
|
3563
3563
|
variant: b ? "clear" : "primary",
|
|
3564
|
-
onClick:
|
|
3564
|
+
onClick: v,
|
|
3565
3565
|
disabled: b || r.canceling,
|
|
3566
3566
|
loading: r.submitting
|
|
3567
3567
|
},
|
|
@@ -3570,12 +3570,12 @@ const Hn = h.div`display:flex;flex-direction:${({ $horizontal: e }) => e ? "row"
|
|
|
3570
3570
|
J.Button,
|
|
3571
3571
|
{
|
|
3572
3572
|
variant: "secondary",
|
|
3573
|
-
onClick:
|
|
3573
|
+
onClick: _,
|
|
3574
3574
|
disabled: r.submitting,
|
|
3575
3575
|
loading: r.canceling
|
|
3576
3576
|
},
|
|
3577
3577
|
n.BUTTON__CANCEL
|
|
3578
|
-
))), /* @__PURE__ */ o.createElement(tn, { ...i, onClose: () => a({ visible: !1, title: "" }) })) : /* @__PURE__ */ o.createElement(Gn, { $maxWidth: e.maxBodyWidth ?? V.BODY_MAX_WIDTH }, /* @__PURE__ */ o.createElement(w, { variant: "body3" }, E.reason), E.cancelable && /* @__PURE__ */ o.createElement(J.Button, { variant: "primary", onClick:
|
|
3578
|
+
))), /* @__PURE__ */ o.createElement(tn, { ...i, onClose: () => a({ visible: !1, title: "" }) })) : /* @__PURE__ */ o.createElement(Gn, { $maxWidth: e.maxBodyWidth ?? V.BODY_MAX_WIDTH }, /* @__PURE__ */ o.createElement(w, { variant: "body3" }, E.reason), E.cancelable && /* @__PURE__ */ o.createElement(J.Button, { variant: "primary", onClick: _, loading: r.canceling }, n.BUTTON__CANCEL));
|
|
3579
3579
|
}, Gn = h.div`display:flex;flex-direction:column;gap:12px;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e }) => I`
|
|
3580
3580
|
color: ${e.colors.messageIncoming.text};
|
|
3581
3581
|
background-color: ${e.colors.messageIncoming.background};
|
|
@@ -3678,7 +3678,7 @@ function Sc(e) {
|
|
|
3678
3678
|
return /* @__PURE__ */ o.createElement(Nr, { ...e, testerMode: !1 });
|
|
3679
3679
|
}
|
|
3680
3680
|
function Nr(e) {
|
|
3681
|
-
var u,
|
|
3681
|
+
var u, p, x, y, k, S, O;
|
|
3682
3682
|
const { components: t } = Ve.useContext(), { streamText: n, isAnimating: r } = Oi({
|
|
3683
3683
|
text: e.message,
|
|
3684
3684
|
enabled: e.isStreaming,
|
|
@@ -3689,8 +3689,8 @@ function Nr(e) {
|
|
|
3689
3689
|
...e,
|
|
3690
3690
|
message: n,
|
|
3691
3691
|
extendedMessagePayload: r ? {} : e.extendedMessagePayload
|
|
3692
|
-
}, i = !!s.isTyping, a = s.testerMode, l = !!s.isSenderAvatarVisible, c = !!((u = s.extendedMessagePayload) != null && u.form) && !((
|
|
3693
|
-
return /* @__PURE__ */ o.createElement(Tc, { $marginBottom: i ? 0 : Kt(s.groupType) },
|
|
3692
|
+
}, i = !!s.isTyping, a = s.testerMode, l = !!s.isSenderAvatarVisible, c = !!((u = s.extendedMessagePayload) != null && u.form) && !((p = s.extendedMessagePayload) != null && p.form.canceled_at), d = !!((x = s.extendedMessagePayload) != null && x.message_template), g = !!((y = s.extendedMessagePayload) != null && y.cta_button), f = !!((k = s.extendedMessagePayload) != null && k.citations) && s.extendedMessagePayload.citations.length > 0, b = !!s.createdAt, v = s.groupType === "top" || s.groupType === "single", _ = s.groupType === "bottom" || s.groupType === "single", E = a || !l ? 0 : V.AVATAR_SIZE;
|
|
3693
|
+
return /* @__PURE__ */ o.createElement(Tc, { $marginBottom: i ? 0 : Kt(s.groupType) }, v && /* @__PURE__ */ o.createElement(Ac, null, !a && l && /* @__PURE__ */ o.createElement(t.SenderAvatar, { ...s }), /* @__PURE__ */ o.createElement(t.SenderName, { ...s })), /* @__PURE__ */ o.createElement(Ic, null, /* @__PURE__ */ o.createElement($t, { $extraStartPadding: E }, i ? /* @__PURE__ */ o.createElement(t.TypingIndicator, { ...s }) : /* @__PURE__ */ o.createElement(t.MessageBody, { ...s }, g && /* @__PURE__ */ o.createElement("div", { style: { marginTop: 12, marginInline: 12 } }, /* @__PURE__ */ o.createElement(t.CTAButton, { ...s })), f && /* @__PURE__ */ o.createElement(t.Citation, { ...s }))), d && /* @__PURE__ */ o.createElement(Wn, { $startPadding: 0, $endPadding: 0 }, /* @__PURE__ */ o.createElement(
|
|
3694
3694
|
t.MessageTemplate,
|
|
3695
3695
|
{
|
|
3696
3696
|
...s,
|
|
@@ -3704,7 +3704,7 @@ function Nr(e) {
|
|
|
3704
3704
|
)),
|
|
3705
3705
|
messageTemplateLoadingFallback: s.messageTemplateLoadingFallback ?? /* @__PURE__ */ o.createElement($t, { $extraStartPadding: E }, /* @__PURE__ */ o.createElement(t.TypingIndicator, { ...s }))
|
|
3706
3706
|
}
|
|
3707
|
-
)), /* @__PURE__ */ o.createElement(t.CustomMessageTemplate, { ...s }), c && /* @__PURE__ */ o.createElement(Wn, { $extraStartPadding: E }, /* @__PURE__ */ o.createElement(t.Form, { ...s }))),
|
|
3707
|
+
)), /* @__PURE__ */ o.createElement(t.CustomMessageTemplate, { ...s }), c && /* @__PURE__ */ o.createElement(Wn, { $extraStartPadding: E }, /* @__PURE__ */ o.createElement(t.Form, { ...s }))), _ && b && /* @__PURE__ */ o.createElement(wc, { $extraStartPadding: E + 8 }, /* @__PURE__ */ o.createElement(t.SentTime, { ...s })), /* @__PURE__ */ o.createElement(rr, null, !i && /* @__PURE__ */ o.createElement(tt, { $extraStartPadding: E + 8 }, /* @__PURE__ */ o.createElement(t.Feedback, { ...s })), s.suggestedRepliesVisible && /* @__PURE__ */ o.createElement(t.SuggestedReplies, { ...s }), /* @__PURE__ */ o.createElement(t.MessageLogs, { ...s })));
|
|
3708
3708
|
}
|
|
3709
3709
|
const Tc = h.div`display:flex;flex-direction:column;align-items:flex-start;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
|
|
3710
3710
|
`, tt = h.div`display:flex;align-self:stretch;justify-content:flex-start;${({ $startPadding: e = V.HORIZONTAL_PADDING, $endPadding: t = V.HORIZONTAL_PADDING, $extraStartPadding: n = 0 }) => `
|
|
@@ -3732,12 +3732,12 @@ function Lc({
|
|
|
3732
3732
|
const { aspectRatio: i, localFile: a } = n, [l] = C(() => a instanceof Blob ? URL.createObjectURL(a) : t.url), [c, d] = C(!1), g = (() => {
|
|
3733
3733
|
if (!(!r || e === "failed"))
|
|
3734
3734
|
return () => r == null ? void 0 : r({ ...t, url: l });
|
|
3735
|
-
})(),
|
|
3735
|
+
})(), f = {
|
|
3736
3736
|
onClick: g,
|
|
3737
3737
|
$ratio: i,
|
|
3738
3738
|
$clickable: !!g
|
|
3739
3739
|
};
|
|
3740
|
-
return /* @__PURE__ */ o.createElement(Oc, null, /* @__PURE__ */ o.createElement(Dc, { ...
|
|
3740
|
+
return /* @__PURE__ */ o.createElement(Oc, null, /* @__PURE__ */ o.createElement(Dc, { ...f }, !c && /* @__PURE__ */ o.createElement(rn, { size: 26 }, /* @__PURE__ */ o.createElement(H, { type: "spinner", color: "textLowEmphasis", size: 26 })), /* @__PURE__ */ o.createElement(Rc, { $loaded: c, src: l, alt: "image-message", onLoad: () => d(!0) })), s);
|
|
3741
3741
|
}
|
|
3742
3742
|
const Oc = h.div`display:flex;flex-direction:column;align-items:flex-end;gap:${V.GAP_GROUPED}px;`, Dc = h.div`width:${V.BODY_MAX_WIDTH}px;border-radius:12px;overflow:hidden;cursor:${(e) => e.$clickable ? "pointer" : "default"};height:auto;aspect-ratio:${(e) => e.$ratio};position:relative;display:flex;align-items:center;justify-content:center;${F.light`
|
|
3743
3743
|
background-color: ${m.color.background100};
|
|
@@ -3837,13 +3837,13 @@ const qc = h.div`text-align:center;text-wrap:pretty;word-break:break-word;paddin
|
|
|
3837
3837
|
const s = n.match(/\[([^\]]+)\]\((https?:\/\/[^\s]+)\)/), i = n.match(/\*\*([^*]+)\*\*/), a = [
|
|
3838
3838
|
s && { match: s, type: "link" },
|
|
3839
3839
|
i && { match: i, type: "bold" }
|
|
3840
|
-
].filter((
|
|
3840
|
+
].filter((f) => !!f);
|
|
3841
3841
|
if (!a.length) {
|
|
3842
3842
|
t.push(n);
|
|
3843
3843
|
break;
|
|
3844
3844
|
}
|
|
3845
3845
|
const l = a.reduce(
|
|
3846
|
-
(
|
|
3846
|
+
(f, b) => b.match.index < f.match.index ? b : f
|
|
3847
3847
|
), { match: c, type: d } = l, g = c.index;
|
|
3848
3848
|
g > 0 && t.push(n.slice(0, g)), d === "link" ? t.push(
|
|
3849
3849
|
/* @__PURE__ */ o.createElement("a", { key: r++, href: c[2], target: "_blank", rel: wr }, c[1])
|
|
@@ -4090,33 +4090,33 @@ const qc = h.div`text-align:center;text-wrap:pretty;word-break:break-word;paddin
|
|
|
4090
4090
|
initialCsatReason: s,
|
|
4091
4091
|
initialIsResolved: i
|
|
4092
4092
|
}) => {
|
|
4093
|
-
const { params: a, setParams: l, error: c, setError: d, followUpItem: g, state:
|
|
4093
|
+
const { params: a, setParams: l, error: c, setError: d, followUpItem: g, state: f, validateParams: b, itemProps: v } = ki({
|
|
4094
4094
|
csatPayload: e,
|
|
4095
4095
|
type: t,
|
|
4096
4096
|
initialCsat: r,
|
|
4097
4097
|
initialCsatReason: s,
|
|
4098
4098
|
initialIsResolved: i
|
|
4099
4099
|
});
|
|
4100
|
-
return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(pd, null, /* @__PURE__ */ o.createElement(hd, { ...
|
|
4100
|
+
return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(pd, null, /* @__PURE__ */ o.createElement(hd, { ...v }), t === Ee.AI_AGENT_CSAT_5_WITH_CRE && /* @__PURE__ */ o.createElement(
|
|
4101
4101
|
Jc,
|
|
4102
4102
|
{
|
|
4103
|
-
...
|
|
4103
|
+
...v,
|
|
4104
4104
|
defaultValue: i,
|
|
4105
4105
|
value: a.isResolved,
|
|
4106
|
-
onChange: (
|
|
4106
|
+
onChange: (_) => l({ isResolved: _ })
|
|
4107
4107
|
}
|
|
4108
|
-
), /* @__PURE__ */ o.createElement(ad, { ...
|
|
4108
|
+
), /* @__PURE__ */ o.createElement(ad, { ...v, value: a.csat, onChange: (_) => l({ csat: _ }) }), g && /* @__PURE__ */ o.createElement(
|
|
4109
4109
|
td,
|
|
4110
4110
|
{
|
|
4111
|
-
...
|
|
4111
|
+
...v,
|
|
4112
4112
|
followUpItem: g,
|
|
4113
4113
|
value: a.csatReason,
|
|
4114
|
-
onChange: (
|
|
4115
|
-
l({ csatReason:
|
|
4114
|
+
onChange: (_) => {
|
|
4115
|
+
l({ csatReason: _ }), d({ followUpItem: !1 });
|
|
4116
4116
|
},
|
|
4117
4117
|
hasError: c.followUpItem
|
|
4118
4118
|
}
|
|
4119
|
-
)),
|
|
4119
|
+
)), f !== "unsubmittable" && /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(J.Separator, null), n({ state: f, params: a, validateParams: b })));
|
|
4120
4120
|
}, pd = h.div`display:flex;flex-direction:column;gap:12px;`, fd = (e) => {
|
|
4121
4121
|
const { stringSet: t } = G();
|
|
4122
4122
|
return Yo(e, {
|
|
@@ -4139,34 +4139,29 @@ const qc = h.div`text-align:center;text-wrap:pretty;word-break:break-word;paddin
|
|
|
4139
4139
|
}, Ed = (e) => {
|
|
4140
4140
|
if (e.messageType !== "admin.csat")
|
|
4141
4141
|
throw new Error("Invalid message type");
|
|
4142
|
-
const { extendedMessagePayload: t, onSubmitCSAT: n } = e, { csat: r, csatReason: s, csatExpireAt: i, isResolvedWhenDeterminedByUser: a } = e, l = zo(), c = fd(t == null ? void 0 : t.csat);
|
|
4142
|
+
const { extendedMessagePayload: t, onSubmitCSAT: n } = e, { csat: r, csatReason: s, csatExpireAt: i, isResolvedWhenDeterminedByUser: a } = e, l = zo(), c = fd(t == null ? void 0 : t.csat), d = B(!1);
|
|
4143
4143
|
if (!c || !c.visibility || !Ee[c.type]) return null;
|
|
4144
|
-
const
|
|
4144
|
+
const g = c.type === Ee.AI_AGENT_CSAT_5 || c.type === Ee.AI_AGENT_CSAT_5_WITH_CRE || c.type === Ee.HELPDESK_CSAT_5 ? Mt : () => null;
|
|
4145
4145
|
return /* @__PURE__ */ o.createElement(xd, null, !r && yn(i) ? /* @__PURE__ */ o.createElement(bd, null) : /* @__PURE__ */ o.createElement(
|
|
4146
|
-
|
|
4146
|
+
g,
|
|
4147
4147
|
{
|
|
4148
4148
|
csatPayload: c,
|
|
4149
4149
|
type: c.type,
|
|
4150
4150
|
initialCsat: r,
|
|
4151
4151
|
initialCsatReason: s,
|
|
4152
4152
|
initialIsResolved: a,
|
|
4153
|
-
renderSubmitButton: ({ state:
|
|
4153
|
+
renderSubmitButton: ({ state: f, params: b, validateParams: v }) => /* @__PURE__ */ o.createElement(
|
|
4154
4154
|
vd,
|
|
4155
4155
|
{
|
|
4156
|
-
$state:
|
|
4157
|
-
disabled:
|
|
4156
|
+
$state: f,
|
|
4157
|
+
disabled: f === "submitted",
|
|
4158
4158
|
onClick: async () => {
|
|
4159
|
-
!yn(i) &&
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
csatReason: p.csatReason,
|
|
4163
|
-
isResolved: p.isResolved,
|
|
4164
|
-
csatStartedAt: p.csatStartedAt,
|
|
4165
|
-
resolutionScore: p.resolutionScore
|
|
4166
|
-
}) : l();
|
|
4159
|
+
d.current || (!yn(i) && v() ? (d.current = !0, await n(b).finally(() => {
|
|
4160
|
+
d.current = !1;
|
|
4161
|
+
})) : l());
|
|
4167
4162
|
}
|
|
4168
4163
|
},
|
|
4169
|
-
/* @__PURE__ */ o.createElement(w, { variant: "button" },
|
|
4164
|
+
/* @__PURE__ */ o.createElement(w, { variant: "button" }, f === "submitted" ? c.csat_submitted_label : c.csat_submit_label)
|
|
4170
4165
|
)
|
|
4171
4166
|
}
|
|
4172
4167
|
));
|
|
@@ -4203,21 +4198,21 @@ const yd = h.div`padding-inline:${V.HORIZONTAL_PADDING}px;margin-bottom:${({ $ma
|
|
|
4203
4198
|
onClickAgentMessageTemplate: c,
|
|
4204
4199
|
bottomContent: d,
|
|
4205
4200
|
renderCustomGroundednessIcon: g = (b) => b.default,
|
|
4206
|
-
style:
|
|
4201
|
+
style: f = {}
|
|
4207
4202
|
}) => {
|
|
4208
4203
|
const {
|
|
4209
4204
|
// Note: This component is used with the dashboard, so cssVars should not be used.
|
|
4210
4205
|
iconColor: b = "#000000",
|
|
4211
|
-
textColor:
|
|
4212
|
-
highlightColor:
|
|
4213
|
-
} =
|
|
4206
|
+
textColor: v = "#000000",
|
|
4207
|
+
highlightColor: _ = Xe.DEFAULT_PRIMARY
|
|
4208
|
+
} = f;
|
|
4214
4209
|
return /* @__PURE__ */ o.createElement(Kn, null, e && /* @__PURE__ */ o.createElement(Kn, null, /* @__PURE__ */ o.createElement(Et, null, /* @__PURE__ */ o.createElement(dt, null, /* @__PURE__ */ o.createElement(H, { size: 16, type: "actionbook", color: b })), /* @__PURE__ */ o.createElement(
|
|
4215
4210
|
ct,
|
|
4216
4211
|
{
|
|
4217
4212
|
$clickable: !!s,
|
|
4218
|
-
$highlightColor:
|
|
4213
|
+
$highlightColor: _,
|
|
4219
4214
|
variant: "body2",
|
|
4220
|
-
color:
|
|
4215
|
+
color: v,
|
|
4221
4216
|
onClick: () => s == null ? void 0 : s(e),
|
|
4222
4217
|
maxTextLines: 1
|
|
4223
4218
|
},
|
|
@@ -4226,23 +4221,23 @@ const yd = h.div`padding-inline:${V.HORIZONTAL_PADDING}px;margin-bottom:${({ $ma
|
|
|
4226
4221
|
ct,
|
|
4227
4222
|
{
|
|
4228
4223
|
$clickable: !!i,
|
|
4229
|
-
$highlightColor:
|
|
4224
|
+
$highlightColor: _,
|
|
4230
4225
|
variant: "body2",
|
|
4231
|
-
color:
|
|
4226
|
+
color: v,
|
|
4232
4227
|
onClick: () => i == null ? void 0 : i(E),
|
|
4233
4228
|
maxTextLines: 1
|
|
4234
4229
|
},
|
|
4235
4230
|
E.name
|
|
4236
|
-
), a && /* @__PURE__ */ o.createElement(Td, { role: "button", onClick: () => a == null ? void 0 : a(E) }, /* @__PURE__ */ o.createElement(w, { variant: "body2", color:
|
|
4231
|
+
), a && /* @__PURE__ */ o.createElement(Td, { role: "button", onClick: () => a == null ? void 0 : a(E) }, /* @__PURE__ */ o.createElement(w, { variant: "body2", color: _ }, "View details"), /* @__PURE__ */ o.createElement(H, { type: "chevron-right", size: 16, color: _ }))))), n == null ? void 0 : n.map((E) => /* @__PURE__ */ o.createElement(Lt, { key: E.id }, /* @__PURE__ */ o.createElement(dt, null, g({
|
|
4237
4232
|
default: /* @__PURE__ */ o.createElement(H, { size: 16, type: qn[E.source_type] ?? qn.snippet, color: b }),
|
|
4238
4233
|
sourceType: E.source_type
|
|
4239
4234
|
})), /* @__PURE__ */ o.createElement(
|
|
4240
4235
|
ct,
|
|
4241
4236
|
{
|
|
4242
4237
|
$clickable: !!l,
|
|
4243
|
-
$highlightColor:
|
|
4238
|
+
$highlightColor: _,
|
|
4244
4239
|
variant: "body2",
|
|
4245
|
-
color:
|
|
4240
|
+
color: v,
|
|
4246
4241
|
onClick: () => l == null ? void 0 : l(E),
|
|
4247
4242
|
maxTextLines: 1
|
|
4248
4243
|
},
|
|
@@ -4251,9 +4246,9 @@ const yd = h.div`padding-inline:${V.HORIZONTAL_PADDING}px;margin-bottom:${({ $ma
|
|
|
4251
4246
|
ct,
|
|
4252
4247
|
{
|
|
4253
4248
|
$clickable: !!c,
|
|
4254
|
-
$highlightColor:
|
|
4249
|
+
$highlightColor: _,
|
|
4255
4250
|
variant: "body2",
|
|
4256
|
-
color:
|
|
4251
|
+
color: v,
|
|
4257
4252
|
onClick: () => c == null ? void 0 : c(E),
|
|
4258
4253
|
maxTextLines: 1
|
|
4259
4254
|
},
|
|
@@ -4308,10 +4303,10 @@ const je = () => {
|
|
|
4308
4303
|
));
|
|
4309
4304
|
}, $d = h.div`display:flex;gap:16px;margin:16px ${V.HORIZONTAL_PADDING}px 0;align-self:stretch;`, Md = h.div`width:${({ width: e }) => e}px;background-color:${m.themedColor.textDisabled};border-radius:100px;flex-shrink:0;`, Ld = h(w)`margin-top:5px;`, an = ({ start: e, title: t, titleAlign: n = "start", end: r }) => {
|
|
4310
4305
|
const s = B(null), i = B(null), [a, l] = C(0), [c, d] = C(0);
|
|
4311
|
-
return
|
|
4306
|
+
return oe(() => {
|
|
4312
4307
|
s.current && l(s.current.offsetWidth), i.current && d(i.current.offsetWidth);
|
|
4313
4308
|
}, [e, r]), /* @__PURE__ */ o.createElement(Od, null, /* @__PURE__ */ o.createElement(Dd, null, n === "center" && t && /* @__PURE__ */ o.createElement(Rd, { $sideWidth: Math.max(a, c) }, /* @__PURE__ */ o.createElement(Nd, null, t)), /* @__PURE__ */ o.createElement(Bd, null, /* @__PURE__ */ o.createElement(Fd, { ref: s }, e), (n === "start" || n === "end") && t && /* @__PURE__ */ o.createElement(Ud, { $align: n, $hasStart: !!e, $hasEnd: !!r }, t), /* @__PURE__ */ o.createElement(Pd, { ref: i }, r))));
|
|
4314
|
-
}, Od = h.div`position:relative;width:100%;background-color:${({ theme: e }) => e.colors.base.headerBackground};border-bottom:1px solid ${m.themedColor.textDisabled};`, Dd = h.div`position:relative;height:56px;padding:11px 12px;`, Rd = h.div`position:absolute;left:${({ $sideWidth: e }) => e}px;right:${({ $sideWidth: e }) => e}px;top:0;bottom:0;display:flex;align-items:center;justify-content:center;`, Nd = h.div`max-width:100%;overflow:hidden;`, Bd = h.div`display:flex;flex-direction:row;align-items:center;justify-content:space-between;height:100%;z-index:1;`, Fd = h.div`flex-shrink:0;display:flex;align-items:center;`, Pd = h.div`flex-shrink:0;display:flex;align-items:center;`, Ud = h.div`flex:1;overflow:hidden;display:flex;align-items:${({ $align: e }) => e === "start" ? "flex-start" : "flex-end"};margin-left:${({ $hasStart: e }) => e ? 8 : 0}px;margin-right:${({ $hasEnd: e }) => e ? 8 : 0}px;`,
|
|
4309
|
+
}, Od = h.div`position:relative;width:100%;background-color:${({ theme: e }) => e.colors.base.headerBackground};border-bottom:1px solid ${m.themedColor.textDisabled};`, Dd = h.div`position:relative;height:56px;padding:11px 12px;`, Rd = h.div`position:absolute;left:${({ $sideWidth: e }) => e}px;right:${({ $sideWidth: e }) => e}px;top:0;bottom:0;display:flex;align-items:center;justify-content:center;`, Nd = h.div`max-width:100%;overflow:hidden;`, Bd = h.div`display:flex;flex-direction:row;align-items:center;justify-content:space-between;height:100%;z-index:1;`, Fd = h.div`flex-shrink:0;display:flex;align-items:center;`, Pd = h.div`flex-shrink:0;display:flex;align-items:center;`, Ud = h.div`flex:1;overflow:hidden;display:flex;align-items:${({ $align: e }) => e === "start" ? "flex-start" : "flex-end"};margin-left:${({ $hasStart: e }) => e ? 8 : 0}px;margin-right:${({ $hasEnd: e }) => e ? 8 : 0}px;`, Le = ({
|
|
4315
4310
|
as: e,
|
|
4316
4311
|
type: t,
|
|
4317
4312
|
size: n = 16,
|
|
@@ -4325,38 +4320,38 @@ const je = () => {
|
|
|
4325
4320
|
const { state: e } = Y(), t = qe(), n = () => {
|
|
4326
4321
|
e.setOpened(!1);
|
|
4327
4322
|
};
|
|
4328
|
-
return /* @__PURE__ */ o.createElement(
|
|
4323
|
+
return /* @__PURE__ */ o.createElement(Le, { "aria-label": "close messenger", type: "close", size: t, onClick: n });
|
|
4329
4324
|
}, {
|
|
4330
4325
|
Provider: Gd,
|
|
4331
|
-
useContext:
|
|
4332
|
-
} =
|
|
4326
|
+
useContext: ne
|
|
4327
|
+
} = ee("MessengerSession"), Wd = We(function({ children: e, ...t }, n) {
|
|
4333
4328
|
return /* @__PURE__ */ o.createElement(Ws, { ref: n, ...t }, (r) => /* @__PURE__ */ o.createElement(jd, { ...r }, e));
|
|
4334
4329
|
}), jd = ({ children: e, ...t }) => {
|
|
4335
|
-
const { chatSDK: n, logger: r, appId: s, aiAgentId: i, agentPreviewConfigs: a, state: l, handlers: c } = Y(), { userSessionInfo: d, authenticate: g, setActiveChannel:
|
|
4330
|
+
const { chatSDK: n, logger: r, appId: s, aiAgentId: i, agentPreviewConfigs: a, state: l, handlers: c } = Y(), { userSessionInfo: d, authenticate: g, setActiveChannel: f, userSession: b, aiAgentInfo: v, launcherInfo: _ } = t, E = B(null);
|
|
4336
4331
|
return vt(n, {
|
|
4337
|
-
async onUserJoined(u,
|
|
4332
|
+
async onUserJoined(u, p) {
|
|
4338
4333
|
var y, k, S;
|
|
4339
|
-
if (u.conversation && u.conversation.type === Do.PROACTIVE &&
|
|
4334
|
+
if (u.conversation && u.conversation.type === Do.PROACTIVE && p.userId === ((y = n.currentUser) == null ? void 0 : y.userId)) {
|
|
4340
4335
|
r.info("messengerSession.onUserJoined: proactive channel joined", u.url);
|
|
4341
|
-
const O = ((k = u.conversation) == null ? void 0 : k.status) ??
|
|
4342
|
-
|
|
4336
|
+
const O = ((k = u.conversation) == null ? void 0 : k.status) ?? Q.OPEN;
|
|
4337
|
+
f({ url: u.url, status: O }), l.setOpened(!0), qd({ sound: document.hidden || !l.opened }), (S = E.current) == null || S.call(E, { channel: u });
|
|
4343
4338
|
}
|
|
4344
4339
|
}
|
|
4345
4340
|
}), P(() => {
|
|
4346
4341
|
g().then(({ launcher: u }) => {
|
|
4347
4342
|
u.auto_open && !nt() && setTimeout(() => l.setOpened(!0), 500);
|
|
4348
4343
|
}).catch((u) => {
|
|
4349
|
-
var
|
|
4350
|
-
r.error("messengerSession: failed to initialize", u), (
|
|
4344
|
+
var p;
|
|
4345
|
+
r.error("messengerSession: failed to initialize", u), (p = c == null ? void 0 : c.onInitializeFailed) == null || p.call(c, u);
|
|
4351
4346
|
});
|
|
4352
|
-
}, [n, s, i, d == null ? void 0 : d.userId]), !b || !
|
|
4347
|
+
}, [n, s, i, d == null ? void 0 : d.userId]), !b || !v || !_ ? null : /* @__PURE__ */ o.createElement(
|
|
4353
4348
|
Gd,
|
|
4354
4349
|
{
|
|
4355
4350
|
value: {
|
|
4356
4351
|
...t,
|
|
4357
4352
|
userSession: b,
|
|
4358
|
-
aiAgentInfo: { ...
|
|
4359
|
-
launcherInfo: { ...
|
|
4353
|
+
aiAgentInfo: { ...v, ...a == null ? void 0 : a.bot },
|
|
4354
|
+
launcherInfo: { ..._, ...a == null ? void 0 : a.launcher },
|
|
4360
4355
|
registerOnJoinedProactiveConversation: (u) => E.current = u
|
|
4361
4356
|
}
|
|
4362
4357
|
},
|
|
@@ -4372,19 +4367,19 @@ function qd({ sound: e }) {
|
|
|
4372
4367
|
});
|
|
4373
4368
|
}
|
|
4374
4369
|
const Kd = (e) => {
|
|
4375
|
-
const { chatSDK: t, handlers: n, logger: r } = Y(), { aiAgentInfo: s } =
|
|
4370
|
+
const { chatSDK: t, handlers: n, logger: r } = Y(), { aiAgentInfo: s } = ne(), i = B(/* @__PURE__ */ new Set()), a = (g) => {
|
|
4376
4371
|
if (!(n != null && n.onCustomEvent)) return;
|
|
4377
|
-
ve(g) && g.sender.userId === s.userId && !
|
|
4372
|
+
ve(g) && g.sender.userId === s.userId && !Ie.isStreaming(g) && !i.current.has(g.messageId) && (r.debug("useCustomEventForMessageReceive: bot-message-received", g), n.onCustomEvent({ type: "bot-message-received", data: { message: g } }), i.current.add(g.messageId));
|
|
4378
4373
|
}, l = (g) => {
|
|
4379
4374
|
if (n != null && n.onCustomEvent && g.isAdminMessage() && g.customType === "user_action_required" && !i.current.has(g.messageId)) {
|
|
4380
|
-
const
|
|
4381
|
-
Array.isArray(
|
|
4375
|
+
const f = Dt(g.data);
|
|
4376
|
+
Array.isArray(f.history) && f.history.length === 0 && (r.debug("useCustomEventForMessageReceive: user_action_required", f), n.onCustomEvent({
|
|
4382
4377
|
type: "user-action-requested",
|
|
4383
|
-
data:
|
|
4378
|
+
data: f
|
|
4384
4379
|
}), i.current.add(g.messageId));
|
|
4385
4380
|
}
|
|
4386
|
-
}, c = (g,
|
|
4387
|
-
g.url === e && (a(
|
|
4381
|
+
}, c = (g, f) => {
|
|
4382
|
+
g.url === e && (a(f), l(f));
|
|
4388
4383
|
}, d = (g) => {
|
|
4389
4384
|
l(g);
|
|
4390
4385
|
};
|
|
@@ -4435,7 +4430,7 @@ const Xd = ({ onScrollAfterSendMessage: e }) => {
|
|
|
4435
4430
|
}, gt = 50, Ot = gt - 40, {
|
|
4436
4431
|
Provider: Qd,
|
|
4437
4432
|
useContext: eu
|
|
4438
|
-
} =
|
|
4433
|
+
} = ee("ConversationScroll"), Yn = {
|
|
4439
4434
|
viewport: 0,
|
|
4440
4435
|
contentHeight: 0,
|
|
4441
4436
|
contentSnapshotHeight: 0,
|
|
@@ -4443,39 +4438,39 @@ const Xd = ({ onScrollAfterSendMessage: e }) => {
|
|
|
4443
4438
|
shouldUpdate: !1
|
|
4444
4439
|
};
|
|
4445
4440
|
function tu({ scrollMode: e, children: t }) {
|
|
4446
|
-
const n = B(null), r = B(null), s = B(Yn), i = B(!1), a = B(null), l = B(0), c = B(0), d = B(!1), [g,
|
|
4447
|
-
() =>
|
|
4448
|
-
[
|
|
4441
|
+
const n = B(null), r = B(null), s = B(Yn), i = B(!1), a = B(null), l = B(0), c = B(0), d = B(!1), [g, f] = C(0), [b, v] = C(0), [_, E] = C(!1), [u, p] = C(!1), x = ie(
|
|
4442
|
+
() => _ ? "auto" : e,
|
|
4443
|
+
[_, e]
|
|
4449
4444
|
), y = () => {
|
|
4450
4445
|
s.current.contentSnapshotHeight = s.current.contentHeight, s.current.shouldUpdate = !0, s.current.shouldRecalc = !0;
|
|
4451
4446
|
}, k = () => {
|
|
4452
4447
|
const T = n.current;
|
|
4453
|
-
!T || !s.current.shouldUpdate ||
|
|
4448
|
+
!T || !s.current.shouldUpdate || f((R) => {
|
|
4454
4449
|
s.current.shouldUpdate = !1;
|
|
4455
|
-
const { contentHeight:
|
|
4456
|
-
if (he >
|
|
4450
|
+
const { contentHeight: q, contentSnapshotHeight: he, shouldRecalc: le } = s.current, te = T.clientHeight;
|
|
4451
|
+
if (he > q)
|
|
4457
4452
|
return R;
|
|
4458
4453
|
const pe = S(T, { messageType: "outgoing" });
|
|
4459
4454
|
let ue = 0;
|
|
4460
4455
|
if (pe) {
|
|
4461
|
-
const me = pe.message.offsetTop - Ot +
|
|
4462
|
-
ue = Math.max(0, me -
|
|
4456
|
+
const me = pe.message.offsetTop - Ot + te;
|
|
4457
|
+
ue = Math.max(0, me - q);
|
|
4463
4458
|
} else {
|
|
4464
|
-
const me =
|
|
4459
|
+
const me = q - he, Ye = te - Ot;
|
|
4465
4460
|
ue = Math.max(0, me - Ye);
|
|
4466
4461
|
}
|
|
4467
4462
|
return R === 0 || ue !== R || le ? (s.current.shouldRecalc = !1, ue) : R;
|
|
4468
4463
|
});
|
|
4469
4464
|
}, S = L(
|
|
4470
4465
|
(T, R) => {
|
|
4471
|
-
const { messageType:
|
|
4466
|
+
const { messageType: q = "all" } = R ?? {}, he = Array.from(T.querySelectorAll(`#${ce}-message-item`));
|
|
4472
4467
|
let le = he;
|
|
4473
|
-
|
|
4474
|
-
const
|
|
4475
|
-
if (!
|
|
4476
|
-
const pe = T.getBoundingClientRect(), ue =
|
|
4468
|
+
q === "outgoing" && (le = he.filter((At) => At.getAttribute("data-layout-id") === "outgoingmessage"));
|
|
4469
|
+
const te = le[le.length - 1];
|
|
4470
|
+
if (!te) return null;
|
|
4471
|
+
const pe = T.getBoundingClientRect(), ue = te.getBoundingClientRect(), me = T.scrollTop + (ue.top - pe.top), Ye = me + te.offsetHeight;
|
|
4477
4472
|
return {
|
|
4478
|
-
message:
|
|
4473
|
+
message: te,
|
|
4479
4474
|
scrollTop: me,
|
|
4480
4475
|
lastMessageBottom: Ye
|
|
4481
4476
|
};
|
|
@@ -4486,10 +4481,10 @@ function tu({ scrollMode: e, children: t }) {
|
|
|
4486
4481
|
if (!T || x !== "fixed") return;
|
|
4487
4482
|
const R = S(T);
|
|
4488
4483
|
s.current.contentHeight = (R == null ? void 0 : R.lastMessageBottom) ?? T.scrollHeight, !i.current && s.current.contentSnapshotHeight > 0 && y();
|
|
4489
|
-
const
|
|
4490
|
-
|
|
4484
|
+
const q = Math.max(0, T.scrollHeight - T.scrollTop - T.clientHeight);
|
|
4485
|
+
v(q), k();
|
|
4491
4486
|
}, [x, S]), $ = L(() => {
|
|
4492
|
-
r.current && (r.current.disconnect(), r.current = null), s.current = Yn,
|
|
4487
|
+
r.current && (r.current.disconnect(), r.current = null), s.current = Yn, f(0), v(0);
|
|
4493
4488
|
}, []), M = L((T = !0) => {
|
|
4494
4489
|
d.current = !1, Ga(() => {
|
|
4495
4490
|
const R = n.current;
|
|
@@ -4508,7 +4503,7 @@ function tu({ scrollMode: e, children: t }) {
|
|
|
4508
4503
|
})));
|
|
4509
4504
|
},
|
|
4510
4505
|
[x, O, $]
|
|
4511
|
-
),
|
|
4506
|
+
), j = L(() => {
|
|
4512
4507
|
const T = n.current;
|
|
4513
4508
|
if (!T) return;
|
|
4514
4509
|
const R = S(T, { messageType: "outgoing" });
|
|
@@ -4516,22 +4511,22 @@ function tu({ scrollMode: e, children: t }) {
|
|
|
4516
4511
|
top: R.message.offsetTop - Ot,
|
|
4517
4512
|
behavior: "smooth"
|
|
4518
4513
|
}), a.current && clearTimeout(a.current), a.current = setTimeout(() => {
|
|
4519
|
-
|
|
4514
|
+
p(!1);
|
|
4520
4515
|
}, 500));
|
|
4521
4516
|
}, [S]), K = (T) => {
|
|
4522
|
-
const { scrollHeight: R, scrollTop:
|
|
4523
|
-
ue && !pe && (d.current = !0), me && pe && (d.current = !1), c.current =
|
|
4517
|
+
const { scrollHeight: R, scrollTop: q, clientHeight: he } = T.currentTarget, le = Math.max(0, R - q - he), te = c.current, pe = le <= gt, ue = q < te, me = q > te;
|
|
4518
|
+
ue && !pe && (d.current = !0), me && pe && (d.current = !1), c.current = q, l.current = le, v(le);
|
|
4524
4519
|
}, Se = L(() => {
|
|
4525
|
-
x === "fixed" && (
|
|
4520
|
+
x === "fixed" && (p(!0), y());
|
|
4526
4521
|
}, [x]), Te = L(() => {
|
|
4527
|
-
x === "fixed" ? setTimeout(() =>
|
|
4528
|
-
}, [x,
|
|
4522
|
+
x === "fixed" ? setTimeout(() => j(), 300) : M();
|
|
4523
|
+
}, [x, j]), Oe = L(
|
|
4529
4524
|
(T) => {
|
|
4530
4525
|
i.current = T, x === "fixed" ? y() : d.current || M();
|
|
4531
4526
|
},
|
|
4532
4527
|
[x, M]
|
|
4533
4528
|
), Z = L((T) => {
|
|
4534
|
-
E(T), T && (
|
|
4529
|
+
E(T), T && (f(0), r.current && (r.current.disconnect(), r.current = null));
|
|
4535
4530
|
}, []), ae = L(
|
|
4536
4531
|
(T) => {
|
|
4537
4532
|
x === "auto" && T && !d.current && M();
|
|
@@ -4555,7 +4550,7 @@ function tu({ scrollMode: e, children: t }) {
|
|
|
4555
4550
|
scrollToBottom: M,
|
|
4556
4551
|
onBeforeMessageSend: Se,
|
|
4557
4552
|
onAfterMessageSend: Te,
|
|
4558
|
-
onStreamingUpdate:
|
|
4553
|
+
onStreamingUpdate: Oe,
|
|
4559
4554
|
onConversationClosed: Z,
|
|
4560
4555
|
onTypingIndicatorUpdate: ae
|
|
4561
4556
|
}
|
|
@@ -4567,10 +4562,10 @@ function tu({ scrollMode: e, children: t }) {
|
|
|
4567
4562
|
const {
|
|
4568
4563
|
Provider: nu,
|
|
4569
4564
|
Context: xh,
|
|
4570
|
-
useContext:
|
|
4571
|
-
} =
|
|
4565
|
+
useContext: re
|
|
4566
|
+
} = ee("Conversation"), ru = ({ children: e }) => {
|
|
4572
4567
|
var s;
|
|
4573
|
-
const { channelSource: t } =
|
|
4568
|
+
const { channelSource: t } = re(), n = (s = t.channel) == null ? void 0 : s.url, { checkForUserActionRequired: r } = Kd(n);
|
|
4574
4569
|
return P(() => {
|
|
4575
4570
|
var a;
|
|
4576
4571
|
const i = (a = t.channel) == null ? void 0 : a.lastMessage;
|
|
@@ -4583,20 +4578,20 @@ const {
|
|
|
4583
4578
|
shouldMarkAsRead: r,
|
|
4584
4579
|
children: s
|
|
4585
4580
|
}) => {
|
|
4586
|
-
const { activeChannel: i, refreshActiveChannel: a } =
|
|
4581
|
+
const { activeChannel: i, refreshActiveChannel: a } = ne(), l = eu(), { onBeforeSendMessage: c, onAfterSendMessage: d } = Xd({
|
|
4587
4582
|
onScrollAfterSendMessage: () => {
|
|
4588
4583
|
l.actions.onAfterMessageSend();
|
|
4589
4584
|
}
|
|
4590
|
-
}), g = e || (i == null ? void 0 : i.url),
|
|
4591
|
-
(
|
|
4585
|
+
}), g = e || (i == null ? void 0 : i.url), f = L(
|
|
4586
|
+
(_) => (l.actions.onBeforeMessageSend(), c(_)),
|
|
4592
4587
|
[l.actions, c]
|
|
4593
4588
|
), b = L(
|
|
4594
|
-
(
|
|
4595
|
-
const E =
|
|
4589
|
+
(_) => {
|
|
4590
|
+
const E = _.some((u) => Ie.isStreaming(u));
|
|
4596
4591
|
l.actions.onStreamingUpdate(E);
|
|
4597
4592
|
},
|
|
4598
4593
|
[l.actions.onStreamingUpdate]
|
|
4599
|
-
),
|
|
4594
|
+
), v = L(async () => {
|
|
4600
4595
|
await a(), e && (t == null || t());
|
|
4601
4596
|
}, [a, e, t]);
|
|
4602
4597
|
return /* @__PURE__ */ o.createElement(
|
|
@@ -4604,19 +4599,19 @@ const {
|
|
|
4604
4599
|
{
|
|
4605
4600
|
key: g,
|
|
4606
4601
|
channelUrl: g,
|
|
4607
|
-
onBeforeSendMessage:
|
|
4602
|
+
onBeforeSendMessage: f,
|
|
4608
4603
|
onAfterSendMessage: d,
|
|
4609
4604
|
onMessagesUpdated: b,
|
|
4610
4605
|
onMessagesReceived: b,
|
|
4611
|
-
onChannelDeleted:
|
|
4606
|
+
onChannelDeleted: v,
|
|
4612
4607
|
onConversationClosedStatusChanged: l.actions.onConversationClosed,
|
|
4613
4608
|
shouldMarkAsRead: r,
|
|
4614
4609
|
shouldCountNewMessages: l.state.shouldCountNewMessages
|
|
4615
4610
|
},
|
|
4616
|
-
(
|
|
4611
|
+
(_) => /* @__PURE__ */ o.createElement(
|
|
4617
4612
|
nu,
|
|
4618
4613
|
{
|
|
4619
|
-
value: { ...
|
|
4614
|
+
value: { ..._, scrollSource: l, goToActiveConversation: v, onNavigateToConversationList: n }
|
|
4620
4615
|
},
|
|
4621
4616
|
/* @__PURE__ */ o.createElement(ru, null, s)
|
|
4622
4617
|
)
|
|
@@ -4626,16 +4621,16 @@ const {
|
|
|
4626
4621
|
const { config: n } = X(), r = ((s = n == null ? void 0 : n.conversation) == null ? void 0 : s.scrollMode) ?? "auto";
|
|
4627
4622
|
return /* @__PURE__ */ o.createElement(tu, { scrollMode: r }, /* @__PURE__ */ o.createElement(ou, { ...t }, e));
|
|
4628
4623
|
}, iu = () => {
|
|
4629
|
-
const { enableCloseConversationButton: e, dispatcher: t } = Y(), { channelSource: n } =
|
|
4624
|
+
const { enableCloseConversationButton: e, dispatcher: t } = Y(), { channelSource: n } = re(), r = n.channel, s = qe(), i = (r == null ? void 0 : r.isAIAgent) && e, a = !jt(r);
|
|
4630
4625
|
if (!i) return null;
|
|
4631
4626
|
const l = async () => {
|
|
4632
4627
|
r && await t.send(ps.CloseConversation({ channelUrl: r.url }));
|
|
4633
4628
|
};
|
|
4634
|
-
return /* @__PURE__ */ o.createElement(
|
|
4629
|
+
return /* @__PURE__ */ o.createElement(Le, { "aria-label": "close conversation", type: "mute", size: s, disabled: a, onClick: l });
|
|
4635
4630
|
}, au = () => {
|
|
4636
4631
|
const { state: e, enableExpandButton: t } = Y(), n = qe();
|
|
4637
4632
|
return t ? /* @__PURE__ */ o.createElement(
|
|
4638
|
-
|
|
4633
|
+
Le,
|
|
4639
4634
|
{
|
|
4640
4635
|
"aria-label": "expand",
|
|
4641
4636
|
type: e.expanded ? "collapse" : "expand",
|
|
@@ -4658,7 +4653,7 @@ const {
|
|
|
4658
4653
|
top: I`flex-direction:column;top:0;transform:translate(-50%,-100%);`,
|
|
4659
4654
|
bottom: I`flex-direction:column-reverse;bottom:0;transform:translate(-50%,100%);`
|
|
4660
4655
|
}, Ht = h.div`position:relative;`, uu = h.div`display:flex;align-items:center;position:absolute;left:50%;z-index:${Ne.TOOLTIP};${({ $position: e }) => du[e]}opacity:0;transition:opacity 0.2s ease-in-out;pointer-events:none;${Ht}:hover &,${Ht}:focus-within &{opacity:1;}`, mu = h(w)`padding:6px 8px;background:${m.themedColor.textHighEmphasis};color:${m.themedColor.textHighEmphasisInverse};border-radius:4px;font-size:12px;white-space:nowrap;`, gu = () => {
|
|
4661
|
-
const { logger: e } = Y(), { stringSet: t } = G(), { channelSource: n } =
|
|
4656
|
+
const { logger: e } = Y(), { stringSet: t } = G(), { channelSource: n } = re(), r = n.channel, s = qe(), i = Xt("handoff-button", r), a = !jt(r) || He(r), l = async () => {
|
|
4662
4657
|
try {
|
|
4663
4658
|
const c = await (r == null ? void 0 : r.markConversationAsHandoff());
|
|
4664
4659
|
e.info("conversation.handleAgentHandoff: success", c);
|
|
@@ -4666,11 +4661,11 @@ const {
|
|
|
4666
4661
|
e.error("conversation.handleAgentHandoff: error", c);
|
|
4667
4662
|
}
|
|
4668
4663
|
};
|
|
4669
|
-
return i ? /* @__PURE__ */ o.createElement(lu, { label: t.HEADER_BUTTON__AGENT_HANDOFF, position: "bottom", disabled: a }, /* @__PURE__ */ o.createElement(
|
|
4664
|
+
return i ? /* @__PURE__ */ o.createElement(lu, { label: t.HEADER_BUTTON__AGENT_HANDOFF, position: "bottom", disabled: a }, /* @__PURE__ */ o.createElement(Le, { "aria-label": "request handoff", type: "agent", size: s, disabled: a, onClick: l })) : null;
|
|
4670
4665
|
}, hu = () => {
|
|
4671
|
-
const { stringSet: e } = G(), { onNavigateToConversationList: t } =
|
|
4666
|
+
const { stringSet: e } = G(), { onNavigateToConversationList: t } = re();
|
|
4672
4667
|
return t ? /* @__PURE__ */ o.createElement(
|
|
4673
|
-
|
|
4668
|
+
Le,
|
|
4674
4669
|
{
|
|
4675
4670
|
type: "menu",
|
|
4676
4671
|
size: 24,
|
|
@@ -4679,11 +4674,11 @@ const {
|
|
|
4679
4674
|
}
|
|
4680
4675
|
) : null;
|
|
4681
4676
|
}, Ur = ({ channel: e, size: t = 40 }) => {
|
|
4682
|
-
const { userSession: n, aiAgentInfo: r } =
|
|
4677
|
+
const { userSession: n, aiAgentInfo: r } = ne(), { fallbackIcon: s, url: i } = Cr({ channel: e, aiAgentInfo: r, userSession: n }), a = Je();
|
|
4683
4678
|
return i ? /* @__PURE__ */ o.createElement(Qt, { src: i, size: t }) : /* @__PURE__ */ o.createElement(pu, { $size: t, $bgColor: a.colors.base.primary }, /* @__PURE__ */ o.createElement(H, { type: s, size: t * 0.55, color: a.colors.base.primaryContrastContent }));
|
|
4684
4679
|
}, pu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;border-radius:50%;background-color:${({ $bgColor: e }) => e};display:flex;align-items:center;justify-content:center;flex-shrink:0;`, fu = () => {
|
|
4685
4680
|
var l, c;
|
|
4686
|
-
const { channelSource: e } =
|
|
4681
|
+
const { channelSource: e } = re(), { aiAgentInfo: t, userSession: n } = ne(), { config: r } = X(), s = e.channel, i = Cr({ channel: s, userSession: n, aiAgentInfo: t }), a = (c = (l = r == null ? void 0 : r.conversation) == null ? void 0 : l.header) == null ? void 0 : c.avatarEnabled;
|
|
4687
4682
|
return /* @__PURE__ */ o.createElement(bu, null, a && /* @__PURE__ */ o.createElement(Ur, { channel: s, size: 34 }), /* @__PURE__ */ o.createElement(Eu, { variant: "h2", color: m.themedColor.textHighEmphasis }, i.title));
|
|
4688
4683
|
}, bu = h.div`display:flex;flex-direction:row;align-items:center;gap:6px;overflow:hidden;`, Eu = h(w)`text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:2px 0;`, xu = (e) => {
|
|
4689
4684
|
const { components: t } = Ke.useContext();
|
|
@@ -4778,10 +4773,10 @@ function Ru(e) {
|
|
|
4778
4773
|
return e.isAdminMessage() ? e.message === "The channel's custom_type was updated." : !1;
|
|
4779
4774
|
}
|
|
4780
4775
|
function Nu(e, t) {
|
|
4781
|
-
return e.filter((n) =>
|
|
4776
|
+
return e.filter((n) => Ie.isWelcomeMessage(n, t));
|
|
4782
4777
|
}
|
|
4783
4778
|
const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;border-radius:50%;display:flex;align-items:center;justify-content:center;background-color:${({ theme: e }) => e.colors.base.primary}!important;ellipse,path{fill:${({ theme: e }) => e.colors.base.primaryContrastContent}!important;}`, Fu = h.div`position:fixed;inset:0;outline:none;display:flex;flex-direction:column;`, Pu = h.div`display:flex;gap:10px;align-items:center;`, Uu = h.div`flex:1;min-height:0;display:flex;align-items:center;justify-content:center;`, Hu = h.video`max-width:100%;max-height:100%;user-select:none;-webkit-user-drag:none;`, Vu = h.img`max-width:100%;max-height:100%;padding:40px;box-sizing:border-box;object-fit:contain;user-select:none;-webkit-user-drag:none;`, zu = h.div`max-width:100%;max-height:100%;display:flex;justify-content:center;align-items:center;`, Gu = ({ file: e, sender: t = {}, onClose: n }) => {
|
|
4784
|
-
const { type: r, url: s, name: i = "" } = e, { profileUrl: a, userId: l } = t, { aiAgentInfo: c } =
|
|
4779
|
+
const { type: r, url: s, name: i = "" } = e, { profileUrl: a, userId: l } = t, { aiAgentInfo: c } = ne();
|
|
4785
4780
|
return /* @__PURE__ */ o.createElement(
|
|
4786
4781
|
Wu,
|
|
4787
4782
|
{
|
|
@@ -4802,7 +4797,7 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
4802
4797
|
start: /* @__PURE__ */ o.createElement(ju, { profileUrl: e, isBotMessage: t }),
|
|
4803
4798
|
title: /* @__PURE__ */ o.createElement(w, { variant: "h2", color: m.themedColor.textHighEmphasis, maxTextLines: 1 }, n),
|
|
4804
4799
|
end: /* @__PURE__ */ o.createElement(Pu, null, Zn(r) && ((g = (d = c == null ? void 0 : c.conversation) == null ? void 0 : d.fileViewer) == null ? void 0 : g.downloadEnabled) && /* @__PURE__ */ o.createElement(
|
|
4805
|
-
|
|
4800
|
+
Le,
|
|
4806
4801
|
{
|
|
4807
4802
|
as: "a",
|
|
4808
4803
|
href: s,
|
|
@@ -4811,9 +4806,9 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
4811
4806
|
type: "download",
|
|
4812
4807
|
size: l
|
|
4813
4808
|
}
|
|
4814
|
-
), /* @__PURE__ */ o.createElement(
|
|
4809
|
+
), /* @__PURE__ */ o.createElement(Le, { "aria-label": "close file viewer", type: "close", size: l, onClick: i }))
|
|
4815
4810
|
}
|
|
4816
|
-
), /* @__PURE__ */ o.createElement(Uu, { onClick: (
|
|
4811
|
+
), /* @__PURE__ */ o.createElement(Uu, { onClick: (f) => f.currentTarget === f.target && i() }, ur(r) && /* @__PURE__ */ o.createElement(Hu, { controls: !0 }, /* @__PURE__ */ o.createElement("source", { src: s, type: r })), dr(r) && /* @__PURE__ */ o.createElement(Vu, { src: s, alt: n }), !Zn(r) && /* @__PURE__ */ o.createElement(zu, null, /* @__PURE__ */ o.createElement(w, { variant: "h1", color: m.themedColor.textHighEmphasis }, a.FILE_VIEWER__UNSUPPORT)))));
|
|
4817
4812
|
}, ju = ({ profileUrl: e, isBotMessage: t }) => t && !e ? /* @__PURE__ */ o.createElement(Bu, { $size: 32 }, /* @__PURE__ */ o.createElement(H, { type: "delight", size: 20 })) : /* @__PURE__ */ o.createElement(Qt, { size: 32, src: e }), Hr = ({
|
|
4818
4813
|
className: e,
|
|
4819
4814
|
locale: t,
|
|
@@ -4830,24 +4825,24 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
4830
4825
|
onLoadPrev: c,
|
|
4831
4826
|
onLoadNext: d,
|
|
4832
4827
|
loadThreshold: g = 0.05,
|
|
4833
|
-
onScroll:
|
|
4828
|
+
onScroll: f = _e,
|
|
4834
4829
|
depsForResetScrollPositionToBottom: b,
|
|
4835
|
-
stackDirection:
|
|
4836
|
-
bottomSpacerHeight:
|
|
4830
|
+
stackDirection: v = "top",
|
|
4831
|
+
bottomSpacerHeight: _ = 0,
|
|
4837
4832
|
ariaLabel: E
|
|
4838
|
-
} = t, u = B(null),
|
|
4833
|
+
} = t, u = B(null), p = L(
|
|
4839
4834
|
($) => {
|
|
4840
4835
|
u.current = $, n && (typeof n == "function" ? n($) : n.current = $);
|
|
4841
4836
|
},
|
|
4842
4837
|
[n]
|
|
4843
4838
|
), x = B(!1), y = B(void 0), k = B(0), S = B(0);
|
|
4844
|
-
|
|
4839
|
+
oe(() => {
|
|
4845
4840
|
u.current && (u.current.scrollTop = u.current.scrollHeight);
|
|
4846
|
-
}, b),
|
|
4841
|
+
}, b), oe(() => {
|
|
4847
4842
|
u.current && (y.current === "top" && (u.current.scrollTop = u.current.scrollHeight - S.current), y.current === "bottom" && (u.current.scrollTop = k.current), y.current = void 0);
|
|
4848
4843
|
}, [u.current, r.length]);
|
|
4849
4844
|
const O = async ($) => {
|
|
4850
|
-
if (
|
|
4845
|
+
if (f == null || f($), !u.current) return;
|
|
4851
4846
|
const M = u.current;
|
|
4852
4847
|
if (S.current = M.scrollHeight - M.scrollTop, k.current = M.scrollTop, x.current) return;
|
|
4853
4848
|
const N = M.clientHeight * Math.min(Math.max(0, g), 1);
|
|
@@ -4857,16 +4852,16 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
4857
4852
|
Zu,
|
|
4858
4853
|
{
|
|
4859
4854
|
id: "infinite-list-inner",
|
|
4860
|
-
ref:
|
|
4855
|
+
ref: p,
|
|
4861
4856
|
onScroll: O,
|
|
4862
4857
|
role: "list",
|
|
4863
4858
|
"aria-label": E
|
|
4864
4859
|
},
|
|
4865
|
-
|
|
4860
|
+
v === "bottom" && /* @__PURE__ */ o.createElement("div", { style: { flexGrow: 1 } }),
|
|
4866
4861
|
i,
|
|
4867
4862
|
r.map(($, M) => s({ message: $, index: M })),
|
|
4868
4863
|
a,
|
|
4869
|
-
|
|
4864
|
+
_ > 0 && /* @__PURE__ */ o.createElement("div", { style: { minHeight: _ } })
|
|
4870
4865
|
), /* @__PURE__ */ o.createElement(Xu, { id: "infinite-list-overlay-container" }, /* @__PURE__ */ o.createElement(Ju, { id: "infinite-list-overlay" }, l)));
|
|
4871
4866
|
}), Yu = h.div`display:flex;position:relative;flex:1;overflow:hidden;`, Zu = h.div`display:flex;flex:1;flex-direction:column;overflow-y:auto;overscroll-behavior:contain;scrollbar-color:${m.themedColor.textLowEmphasis}transparent;&::-webkit-scrollbar-thumb:hover{background-color:transparent;}`, Xu = h.div`position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;`, Ju = h.div`pointer-events:auto;`, Qu = ({ className: e, label: t, ariaLabel: n, onClick: r }) => {
|
|
4872
4867
|
const { colors: s } = Je();
|
|
@@ -4894,16 +4889,16 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
4894
4889
|
outline: none;
|
|
4895
4890
|
}
|
|
4896
4891
|
`, rm = () => {
|
|
4897
|
-
const { agentPreviewConfigs: e = {}, aiAgentId: t } = Y(), { aiAgentInfo: n } =
|
|
4892
|
+
const { agentPreviewConfigs: e = {}, aiAgentId: t } = Y(), { aiAgentInfo: n } = ne(), { stringSet: r, dateLocale: s } = G(), { messageSource: i } = re(), { Template: a } = Ve.useContext(), l = e.welcomeMessages ?? [], c = i.messages, d = Nu(c, t), g = c[d.length + 1], f = d[0] ?? g;
|
|
4898
4893
|
return {
|
|
4899
4894
|
/**
|
|
4900
4895
|
* Returns a list of messages filtered according to business requirements.
|
|
4901
4896
|
*/
|
|
4902
|
-
filteredMessages: c.filter((b) => Ru(b) ? !1 : l.length > 0 ? !
|
|
4897
|
+
filteredMessages: c.filter((b) => Ru(b) ? !1 : l.length > 0 ? !Ie.isWelcomeMessage(b, t) : !0),
|
|
4903
4898
|
/**
|
|
4904
4899
|
* Determines whether to display the DateSeparator in the data list by comparing it with the welcome messages from Bot Studio.
|
|
4905
4900
|
*/
|
|
4906
|
-
shouldShowOriginalDate: (b) => b > 0 || l.length === 0 ? !0 : g && !ko(g.createdAt, (
|
|
4901
|
+
shouldShowOriginalDate: (b) => b > 0 || l.length === 0 ? !0 : g && !ko(g.createdAt, (f == null ? void 0 : f.createdAt) ?? 0),
|
|
4907
4902
|
/**
|
|
4908
4903
|
* Renders the list of welcome messages from Bot Studio.
|
|
4909
4904
|
*/
|
|
@@ -4911,12 +4906,12 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
4911
4906
|
Hr,
|
|
4912
4907
|
{
|
|
4913
4908
|
style: { margin: "16px 0" },
|
|
4914
|
-
date:
|
|
4909
|
+
date: f == null ? void 0 : f.createdAt,
|
|
4915
4910
|
locale: s,
|
|
4916
4911
|
formatString: r.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR
|
|
4917
4912
|
}
|
|
4918
|
-
), l.map((b,
|
|
4919
|
-
const
|
|
4913
|
+
), l.map((b, v) => {
|
|
4914
|
+
const _ = v === l.length - 1, E = d.length !== c.length, u = l.length === 1 ? "single" : v === 0 ? "top" : _ || E ? "bottom" : "middle";
|
|
4920
4915
|
return /* @__PURE__ */ o.createElement(
|
|
4921
4916
|
a,
|
|
4922
4917
|
{
|
|
@@ -4924,13 +4919,13 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
4924
4919
|
message: b.message,
|
|
4925
4920
|
sender: n,
|
|
4926
4921
|
groupType: u,
|
|
4927
|
-
createdAt: (
|
|
4922
|
+
createdAt: (f == null ? void 0 : f.createdAt) ?? Date.now(),
|
|
4928
4923
|
extendedMessagePayload: { suggested_replies: b.suggestedReplies },
|
|
4929
4924
|
suggestedRepliesDirection: e.suggestedRepliesDirection,
|
|
4930
|
-
suggestedRepliesVisible:
|
|
4925
|
+
suggestedRepliesVisible: _ && !E,
|
|
4931
4926
|
isBotMessage: !0,
|
|
4932
|
-
onClickSuggestedReply: async ({ reply:
|
|
4933
|
-
i.sendUserMessage({ message:
|
|
4927
|
+
onClickSuggestedReply: async ({ reply: p }) => {
|
|
4928
|
+
i.sendUserMessage({ message: p });
|
|
4934
4929
|
}
|
|
4935
4930
|
}
|
|
4936
4931
|
);
|
|
@@ -4956,7 +4951,7 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
4956
4951
|
text-decoration: none;
|
|
4957
4952
|
`, lm = () => {
|
|
4958
4953
|
var a;
|
|
4959
|
-
const { stringSet: e } = G(), { channelSource: t, goToActiveConversation: n, scrollSource: r } =
|
|
4954
|
+
const { stringSet: e } = G(), { channelSource: t, goToActiveConversation: n, scrollSource: r } = re(), s = ke(t.channel), i = B(s);
|
|
4960
4955
|
return P(() => {
|
|
4961
4956
|
if (!i.current && s) {
|
|
4962
4957
|
const d = setTimeout(() => {
|
|
@@ -4976,14 +4971,14 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
4976
4971
|
e.TALK_TO_AGENT
|
|
4977
4972
|
));
|
|
4978
4973
|
}, cm = h.div`display:flex;justify-content:center;margin-bottom:16px;`, dm = h(w)`border-radius:6px;box-sizing:border-box;padding:10px 20px;border:1px solid ${m.themedColor.textDisabled};cursor:pointer;user-select:none;`, um = () => {
|
|
4979
|
-
const { Template: e } = on.useContext(), { Template: t } = Ve.useContext(), { Template: n } = sn.useContext(), [r, s] = C(null), [i, a] = C(null), { userSession: l, aiAgentInfo: c } =
|
|
4974
|
+
const { Template: e } = on.useContext(), { Template: t } = Ve.useContext(), { Template: n } = sn.useContext(), [r, s] = C(null), [i, a] = C(null), { userSession: l, aiAgentInfo: c } = ne(), { cache: d, agentPreviewConfigs: g, chatSDK: f, state: b } = Y(), { config: v } = X(), { stringSet: _, dateLocale: E } = G(), {
|
|
4980
4975
|
conversation: u,
|
|
4981
|
-
channelSource:
|
|
4976
|
+
channelSource: p,
|
|
4982
4977
|
messageSource: x,
|
|
4983
4978
|
scrollSource: y,
|
|
4984
4979
|
state: { input: k, streamAnimation: S }
|
|
4985
|
-
} =
|
|
4986
|
-
const Z =
|
|
4980
|
+
} = re(), { isActionbookTester: O } = je(), { filteredMessages: $, shouldShowOriginalDate: M, renderAgentPreviewWelcomeMessages: N } = rm(), j = vr(p.channel), K = (() => {
|
|
4981
|
+
const Z = j[0];
|
|
4987
4982
|
if (!Z) return null;
|
|
4988
4983
|
const ae = Z.userId === c.userId;
|
|
4989
4984
|
return { user: ae ? c : Z, isBot: ae };
|
|
@@ -4995,17 +4990,17 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
4995
4990
|
}, [y.state.isAwayFromBottom]);
|
|
4996
4991
|
const Se = (Z, ae = !1) => {
|
|
4997
4992
|
var Ae;
|
|
4998
|
-
return ae ? c : ((Ae =
|
|
4993
|
+
return ae ? c : ((Ae = p.channel) == null ? void 0 : Ae.members.find((A) => A.userId === Z.sender.userId)) ?? Z.sender;
|
|
4999
4994
|
}, Te = (Z) => {
|
|
5000
4995
|
if (Z.sendingStatus === "failed" && !k.disabled)
|
|
5001
4996
|
return () => a(Z);
|
|
5002
|
-
},
|
|
4997
|
+
}, Oe = () => {
|
|
5003
4998
|
var Z, ae, Ae;
|
|
5004
4999
|
if (!x.initialized)
|
|
5005
5000
|
return /* @__PURE__ */ o.createElement(ze, { type: "loading" });
|
|
5006
5001
|
if (x.messages.length === 0) {
|
|
5007
5002
|
const A = N();
|
|
5008
|
-
return A ? /* @__PURE__ */ o.createElement("div", { style: { width: "100%" } }, A) : /* @__PURE__ */ o.createElement(ze, { type: "noMessages", label:
|
|
5003
|
+
return A ? /* @__PURE__ */ o.createElement("div", { style: { width: "100%" } }, A) : /* @__PURE__ */ o.createElement(ze, { type: "noMessages", label: _.PLACE_HOLDER__NO_MESSAGES });
|
|
5009
5004
|
}
|
|
5010
5005
|
return /* @__PURE__ */ o.createElement(
|
|
5011
5006
|
Ku,
|
|
@@ -5018,7 +5013,7 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5018
5013
|
onLoadNext: x.loadNext,
|
|
5019
5014
|
depsForResetScrollPositionToBottom: [x.initialized, x.messages.length !== 0],
|
|
5020
5015
|
bottomSpacerHeight: y.state.bottomSpace,
|
|
5021
|
-
ariaLabel:
|
|
5016
|
+
ariaLabel: _.A11Y_MESSAGE_LIST,
|
|
5022
5017
|
messageTopArea: /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(sm, { style: { marginTop: 16 } }), N()),
|
|
5023
5018
|
messageBottomArea: /* @__PURE__ */ o.createElement(o.Fragment, null, K && /* @__PURE__ */ o.createElement("div", { id: `${ce}-message-item`, role: "listitem" }, /* @__PURE__ */ o.createElement(
|
|
5024
5019
|
t,
|
|
@@ -5029,25 +5024,25 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5029
5024
|
messageType: "user",
|
|
5030
5025
|
groupType: "single",
|
|
5031
5026
|
message: "",
|
|
5032
|
-
isSenderAvatarVisible: (Z =
|
|
5027
|
+
isSenderAvatarVisible: (Z = v == null ? void 0 : v.conversation) == null ? void 0 : Z.senderAvatarEnabled
|
|
5033
5028
|
}
|
|
5034
|
-
)), ((ae =
|
|
5035
|
-
overlayArea: /* @__PURE__ */ o.createElement(o.Fragment, null, ((Ae =
|
|
5029
|
+
)), ((ae = v == null ? void 0 : v.conversation) == null ? void 0 : ae.isTalkToAgentViewEnabled) && /* @__PURE__ */ o.createElement(lm, null)),
|
|
5030
|
+
overlayArea: /* @__PURE__ */ o.createElement(o.Fragment, null, ((Ae = v == null ? void 0 : v.conversation) == null ? void 0 : Ae.newMessageIndicatorEnabled) && y.state.isAwayFromBottom && x.newMessages.length > 0 && /* @__PURE__ */ o.createElement(
|
|
5036
5031
|
hm,
|
|
5037
5032
|
{
|
|
5038
|
-
label:
|
|
5039
|
-
ariaLabel:
|
|
5033
|
+
label: _.SCROLL_TO_NEW_MESSAGES_LABEL(x.newMessages),
|
|
5034
|
+
ariaLabel: _.A11Y_SCROLL_TO_NEW_MESSAGES,
|
|
5040
5035
|
onClick: () => y.actions.scrollToBottom()
|
|
5041
5036
|
}
|
|
5042
5037
|
), y.state.isAwayFromBottom && x.newMessages.length === 0 && !K && /* @__PURE__ */ o.createElement(
|
|
5043
5038
|
gm,
|
|
5044
5039
|
{
|
|
5045
|
-
ariaLabel:
|
|
5040
|
+
ariaLabel: _.A11Y_SCROLL_TO_BOTTOM,
|
|
5046
5041
|
onClick: () => y.actions.scrollToBottom()
|
|
5047
5042
|
}
|
|
5048
5043
|
)),
|
|
5049
5044
|
renderMessage: ({ message: A, index: U }) => {
|
|
5050
|
-
const T = Qo(A), R = $[U - 1],
|
|
5045
|
+
const T = Qo(A), R = $[U - 1], q = $[U + 1], he = $[$.length - 1], le = A === he, te = Qe(A, c.userId), pe = !(c.isUserFeedbackEnabled && te && !Ie.isWelcomeMessage(A)), ue = es(A, R, q, pe), me = !Go((R == null ? void 0 : R.createdAt) ?? 0, A.createdAt) && M(U) && !O, Ye = (st) => {
|
|
5051
5046
|
(A.isFileMessage() || A.isUserMessage()) && s({ file: st, sender: Se(A, A.sender.userId === c.userId) });
|
|
5052
5047
|
}, At = () => {
|
|
5053
5048
|
A.isFileMessage() && en(A.url);
|
|
@@ -5057,7 +5052,7 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5057
5052
|
style: { margin: "16px 0" },
|
|
5058
5053
|
date: A.createdAt,
|
|
5059
5054
|
locale: E,
|
|
5060
|
-
formatString:
|
|
5055
|
+
formatString: _.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR
|
|
5061
5056
|
}
|
|
5062
5057
|
) : null, ot = {
|
|
5063
5058
|
data: A.data,
|
|
@@ -5082,14 +5077,14 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5082
5077
|
...u,
|
|
5083
5078
|
isResolvedWhenDeterminedByUser: qo(u),
|
|
5084
5079
|
messageType: "admin.csat",
|
|
5085
|
-
onSubmitCSAT: async (
|
|
5086
|
-
var
|
|
5087
|
-
|
|
5080
|
+
onSubmitCSAT: async (De) => {
|
|
5081
|
+
var W;
|
|
5082
|
+
await ((W = p.channel) == null ? void 0 : W.submitCSAT(De));
|
|
5088
5083
|
}
|
|
5089
5084
|
}
|
|
5090
5085
|
) : null : /* @__PURE__ */ o.createElement(n, { ...ot, messageType: "admin", message: A.message });
|
|
5091
5086
|
if (Be.isOutgoing(A, l.userId)) {
|
|
5092
|
-
const
|
|
5087
|
+
const De = {
|
|
5093
5088
|
...ot,
|
|
5094
5089
|
message: A.message,
|
|
5095
5090
|
sender: Se(A),
|
|
@@ -5097,71 +5092,71 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5097
5092
|
onClickFailedMessage: Te(A)
|
|
5098
5093
|
};
|
|
5099
5094
|
if (A.isUserMessage())
|
|
5100
|
-
return /* @__PURE__ */ o.createElement(e, { messageType: "user", ...
|
|
5095
|
+
return /* @__PURE__ */ o.createElement(e, { messageType: "user", ...De });
|
|
5101
5096
|
if (A.isFileMessage()) {
|
|
5102
|
-
const [
|
|
5097
|
+
const [W, se] = ((st = A.metaArrays.find((fe) => fe.key === cr)) == null ? void 0 : st.value) ?? [];
|
|
5103
5098
|
return /* @__PURE__ */ o.createElement(
|
|
5104
5099
|
e,
|
|
5105
5100
|
{
|
|
5106
5101
|
messageType: "file",
|
|
5107
5102
|
file: A,
|
|
5108
5103
|
metadata: {
|
|
5109
|
-
aspectRatio:
|
|
5104
|
+
aspectRatio: W && se ? `${W}/${se}` : "1/1",
|
|
5110
5105
|
localFile: (bn = A.messageParams) == null ? void 0 : bn.file
|
|
5111
5106
|
},
|
|
5112
|
-
...
|
|
5107
|
+
...De
|
|
5113
5108
|
}
|
|
5114
5109
|
);
|
|
5115
5110
|
}
|
|
5116
5111
|
}
|
|
5117
5112
|
if (Be.isIncoming(A, l.userId)) {
|
|
5118
|
-
const
|
|
5113
|
+
const De = {
|
|
5119
5114
|
...ot,
|
|
5120
|
-
sender: Se(A,
|
|
5115
|
+
sender: Se(A, te),
|
|
5121
5116
|
message: A.message,
|
|
5122
5117
|
suggestedRepliesVisible: le,
|
|
5123
5118
|
suggestedRepliesDirection: g == null ? void 0 : g.suggestedRepliesDirection,
|
|
5124
|
-
isBotMessage:
|
|
5125
|
-
isStreaming:
|
|
5126
|
-
isHandedOff: He(
|
|
5127
|
-
isConversationClosed:
|
|
5119
|
+
isBotMessage: te,
|
|
5120
|
+
isStreaming: Ie.isStreaming(A),
|
|
5121
|
+
isHandedOff: He(p.channel),
|
|
5122
|
+
isConversationClosed: ke(p.channel),
|
|
5128
5123
|
isFeedbackEnabled: c.isUserFeedbackEnabled,
|
|
5129
5124
|
isFeedbackCommentEnabled: c.isUserFeedbackCommentOptionEnabled,
|
|
5130
|
-
isSenderAvatarVisible: (En =
|
|
5131
|
-
onClickSuggestedReply: async ({ reply:
|
|
5132
|
-
x.sendUserMessage({ message:
|
|
5125
|
+
isSenderAvatarVisible: (En = v == null ? void 0 : v.conversation) == null ? void 0 : En.senderAvatarEnabled,
|
|
5126
|
+
onClickSuggestedReply: async ({ reply: W }) => {
|
|
5127
|
+
x.sendUserMessage({ message: W });
|
|
5133
5128
|
},
|
|
5134
|
-
onRequestMessageTemplate: async (
|
|
5135
|
-
const { template:
|
|
5136
|
-
return d.template.set(
|
|
5129
|
+
onRequestMessageTemplate: async (W) => {
|
|
5130
|
+
const { template: se } = await f.aiAgent.getMessageTemplate(W);
|
|
5131
|
+
return d.template.set(W, se), se;
|
|
5137
5132
|
},
|
|
5138
|
-
onGetCachedMessageTemplate: (
|
|
5139
|
-
onHandleTemplateInternalAction: (
|
|
5140
|
-
if (
|
|
5141
|
-
const { method:
|
|
5142
|
-
|
|
5133
|
+
onGetCachedMessageTemplate: (W) => d.template.get(W),
|
|
5134
|
+
onHandleTemplateInternalAction: (W) => {
|
|
5135
|
+
if (W.type === "internal" && W.internalData) {
|
|
5136
|
+
const { method: se, payload: fe } = W.internalData;
|
|
5137
|
+
se === "message.send" && (fe != null && fe.message) && x.sendUserMessage({ message: fe.message });
|
|
5143
5138
|
}
|
|
5144
5139
|
},
|
|
5145
|
-
onFeedbackUpdate: (
|
|
5146
|
-
const
|
|
5140
|
+
onFeedbackUpdate: (W) => {
|
|
5141
|
+
const se = {
|
|
5147
5142
|
messageId: A.messageId,
|
|
5148
5143
|
channelUrl: A.channelUrl
|
|
5149
5144
|
};
|
|
5150
|
-
if (!
|
|
5151
|
-
return
|
|
5152
|
-
const fe = { ...
|
|
5153
|
-
return
|
|
5145
|
+
if (!W)
|
|
5146
|
+
return f.aiAgent.deleteMessageFeedback(se);
|
|
5147
|
+
const fe = { ...se, rating: al(W.rating), comment: W.comment };
|
|
5148
|
+
return Ie.hasFeedback(A) ? f.aiAgent.updateMessageFeedback(fe) : f.aiAgent.createMessageFeedback(fe);
|
|
5154
5149
|
},
|
|
5155
|
-
onSubmitForm: ({ key:
|
|
5150
|
+
onSubmitForm: ({ key: W, data: se }) => f.aiAgent.submitForm({
|
|
5156
5151
|
messageId: A.messageId,
|
|
5157
5152
|
channelUrl: A.channelUrl,
|
|
5158
|
-
formKey:
|
|
5159
|
-
formData:
|
|
5153
|
+
formKey: W,
|
|
5154
|
+
formData: se
|
|
5160
5155
|
}),
|
|
5161
|
-
onCancelForm: ({ key:
|
|
5156
|
+
onCancelForm: ({ key: W }) => f.aiAgent.cancelForm({
|
|
5162
5157
|
messageId: A.messageId,
|
|
5163
5158
|
channelUrl: A.channelUrl,
|
|
5164
|
-
formKey:
|
|
5159
|
+
formKey: W
|
|
5165
5160
|
}),
|
|
5166
5161
|
onStreamAnimationStart: () => {
|
|
5167
5162
|
S.start(A.messageId);
|
|
@@ -5174,9 +5169,9 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5174
5169
|
}
|
|
5175
5170
|
};
|
|
5176
5171
|
if (A.isUserMessage())
|
|
5177
|
-
return /* @__PURE__ */ o.createElement(t, { messageType: "user", ...
|
|
5172
|
+
return /* @__PURE__ */ o.createElement(t, { messageType: "user", ...De });
|
|
5178
5173
|
if (A.isFileMessage())
|
|
5179
|
-
return /* @__PURE__ */ o.createElement(t, { messageType: "file", file: A, ...
|
|
5174
|
+
return /* @__PURE__ */ o.createElement(t, { messageType: "file", file: A, ...De });
|
|
5180
5175
|
}
|
|
5181
5176
|
})();
|
|
5182
5177
|
return /* @__PURE__ */ o.createElement("div", { key: T, id: `${ce}-message-item`, role: "listitem", "data-layout-id": io() }, so, ao);
|
|
@@ -5184,14 +5179,14 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5184
5179
|
}
|
|
5185
5180
|
);
|
|
5186
5181
|
};
|
|
5187
|
-
return /* @__PURE__ */ o.createElement(mm, { id: `${ce}-message-list` },
|
|
5182
|
+
return /* @__PURE__ */ o.createElement(mm, { id: `${ce}-message-list` }, Oe(), r && /* @__PURE__ */ o.createElement(Gu, { onClose: () => s(null), sender: r.sender, file: r.file }), i && /* @__PURE__ */ o.createElement(Ue, { visible: !0, onClose: () => a(null) }, /* @__PURE__ */ o.createElement(
|
|
5188
5183
|
Ue.ActionItem,
|
|
5189
5184
|
{
|
|
5190
5185
|
onClick: () => {
|
|
5191
5186
|
x.resendMessage(i), a(null);
|
|
5192
5187
|
}
|
|
5193
5188
|
},
|
|
5194
|
-
|
|
5189
|
+
_.FAILED_MESSAGE_RESEND
|
|
5195
5190
|
), /* @__PURE__ */ o.createElement(
|
|
5196
5191
|
Ue.ActionItem,
|
|
5197
5192
|
{
|
|
@@ -5200,10 +5195,10 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5200
5195
|
x.deleteMessage(i), a(null);
|
|
5201
5196
|
}
|
|
5202
5197
|
},
|
|
5203
|
-
|
|
5198
|
+
_.FAILED_MESSAGE_REMOVE
|
|
5204
5199
|
)));
|
|
5205
5200
|
}, mm = h.div`overflow-y:hidden;display:flex;flex:1;position:relative;`, gm = h(tm)`position:absolute;bottom:12px;inset-inline-end:16px;`, hm = h(Qu)`position:absolute;bottom:12px;left:50%;transform:translateX(-50%);`, pm = () => {
|
|
5206
|
-
const { stringSet: e } = G(), { connectionError: t } =
|
|
5201
|
+
const { stringSet: e } = G(), { connectionError: t } = ne(), { channelSource: n } = re(), r = t || n.error;
|
|
5207
5202
|
if (r) {
|
|
5208
5203
|
const s = t ? void 0 : { label: e.RETRY, onClick: () => n.refetch() };
|
|
5209
5204
|
return /* @__PURE__ */ o.createElement(ze, { type: "error", label: r.message, action: s });
|
|
@@ -5211,7 +5206,7 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5211
5206
|
return n.channel ? /* @__PURE__ */ o.createElement(um, null) : /* @__PURE__ */ o.createElement(ze, { type: "loading" });
|
|
5212
5207
|
}, fm = () => {
|
|
5213
5208
|
var s;
|
|
5214
|
-
const { origin: e } = je(), { appId: t, aiAgentId: n } = X(), { channelSource: r } =
|
|
5209
|
+
const { origin: e } = je(), { appId: t, aiAgentId: n } = X(), { channelSource: r } = re();
|
|
5215
5210
|
return (s = r.channel) != null && s.conversation ? /* @__PURE__ */ o.createElement(bm, null, /* @__PURE__ */ o.createElement(zt, { style: { gap: 4 } }, /* @__PURE__ */ o.createElement(H, { color: m.themedColor.textLowEmphasis, size: 12, type: "show" }), /* @__PURE__ */ o.createElement(w, { as: "i", color: m.themedColor.textLowEmphasis, variant: "caption2" }, "Only visible in the tester")), /* @__PURE__ */ o.createElement(
|
|
5216
5211
|
zt,
|
|
5217
5212
|
{
|
|
@@ -5228,20 +5223,20 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5228
5223
|
)) : null;
|
|
5229
5224
|
}, zt = h.div`display:flex;justify-content:center;align-items:center;`, bm = h(zt)`flex-direction:column;padding-block:16px;background-color:${m.themedColor.bg_100_500};gap:8px;`, Vr = Ge(void 0), Em = ({ children: e }) => {
|
|
5230
5225
|
var E;
|
|
5231
|
-
const { chatSDK: t } = Y(), { createAttachmentRules: n } =
|
|
5226
|
+
const { chatSDK: t } = Y(), { createAttachmentRules: n } = ne(), { stringSet: r } = G(), { channelSource: s } = re(), [i, a] = C([]), [l, c] = C({
|
|
5232
5227
|
visible: !1,
|
|
5233
5228
|
title: ""
|
|
5234
5229
|
}), d = n({
|
|
5235
5230
|
channel: s.channel,
|
|
5236
5231
|
uploadSizeLimit: (E = t.appInfo) == null ? void 0 : E.uploadSizeLimit
|
|
5237
|
-
}), g = d.isEnabled(),
|
|
5238
|
-
const
|
|
5239
|
-
return u.size >
|
|
5232
|
+
}), g = d.isEnabled(), f = (u) => {
|
|
5233
|
+
const p = d.getUploadSizeLimit(u.type);
|
|
5234
|
+
return u.size > p;
|
|
5240
5235
|
}, b = (u) => {
|
|
5241
5236
|
if (!g) return;
|
|
5242
|
-
const
|
|
5243
|
-
if (
|
|
5244
|
-
const x =
|
|
5237
|
+
const p = u.filter((k) => d.isSupportedMimeType(k.type));
|
|
5238
|
+
if (p.length === 0) return;
|
|
5239
|
+
const x = p.find((k) => f(k));
|
|
5245
5240
|
if (x) {
|
|
5246
5241
|
const k = d.getUploadSizeLimitInMB(x.type);
|
|
5247
5242
|
c({
|
|
@@ -5250,7 +5245,7 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5250
5245
|
});
|
|
5251
5246
|
return;
|
|
5252
5247
|
}
|
|
5253
|
-
if (i.length +
|
|
5248
|
+
if (i.length + p.length > d.maxAttachmentCount) {
|
|
5254
5249
|
c({
|
|
5255
5250
|
visible: !0,
|
|
5256
5251
|
title: r.FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT
|
|
@@ -5259,19 +5254,19 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5259
5254
|
}
|
|
5260
5255
|
a((k) => [
|
|
5261
5256
|
...k,
|
|
5262
|
-
...
|
|
5257
|
+
...p.map((S) => ({
|
|
5263
5258
|
file: S,
|
|
5264
5259
|
preview: { url: URL.createObjectURL(S), type: S.type, name: S.name }
|
|
5265
5260
|
}))
|
|
5266
5261
|
]);
|
|
5267
|
-
},
|
|
5268
|
-
a((
|
|
5262
|
+
}, v = (u) => {
|
|
5263
|
+
a((p) => {
|
|
5269
5264
|
var y;
|
|
5270
|
-
const x = (y =
|
|
5271
|
-
return x && URL.revokeObjectURL(x.url),
|
|
5265
|
+
const x = (y = p[u]) == null ? void 0 : y.preview;
|
|
5266
|
+
return x && URL.revokeObjectURL(x.url), p.filter((k, S) => S !== u);
|
|
5272
5267
|
});
|
|
5273
|
-
},
|
|
5274
|
-
a((u) => (u.forEach((
|
|
5268
|
+
}, _ = () => {
|
|
5269
|
+
a((u) => (u.forEach((p) => URL.revokeObjectURL(p.preview.url)), []));
|
|
5275
5270
|
};
|
|
5276
5271
|
return /* @__PURE__ */ o.createElement(
|
|
5277
5272
|
Vr.Provider,
|
|
@@ -5279,8 +5274,8 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5279
5274
|
value: {
|
|
5280
5275
|
files: i,
|
|
5281
5276
|
addFiles: b,
|
|
5282
|
-
removeFile:
|
|
5283
|
-
clearFiles:
|
|
5277
|
+
removeFile: v,
|
|
5278
|
+
clearFiles: _,
|
|
5284
5279
|
isFileUploadEnabled: g,
|
|
5285
5280
|
acceptableMimeTypes: d.supportedMimeTypes
|
|
5286
5281
|
}
|
|
@@ -5296,7 +5291,7 @@ const Bu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
|
|
|
5296
5291
|
};
|
|
5297
5292
|
function xm({ blurred: e, elementRef: t, document: n = window.document }) {
|
|
5298
5293
|
const r = B(!1);
|
|
5299
|
-
e && t.current && n.activeElement === t.current && (r.current = !0),
|
|
5294
|
+
e && t.current && n.activeElement === t.current && (r.current = !0), oe(() => {
|
|
5300
5295
|
var s;
|
|
5301
5296
|
!e && r.current && ((s = t.current) == null || s.focus(), r.current = !1);
|
|
5302
5297
|
}, [e]);
|
|
@@ -5357,8 +5352,8 @@ const vm = (e, t) => {
|
|
|
5357
5352
|
type: "file",
|
|
5358
5353
|
ref: n,
|
|
5359
5354
|
onChange: (g) => {
|
|
5360
|
-
const
|
|
5361
|
-
|
|
5355
|
+
const f = g.currentTarget.files;
|
|
5356
|
+
f && i(Array.from(f)), g.target.value = "";
|
|
5362
5357
|
},
|
|
5363
5358
|
accept: d.join(",")
|
|
5364
5359
|
}
|
|
@@ -5373,8 +5368,8 @@ const vm = (e, t) => {
|
|
|
5373
5368
|
)
|
|
5374
5369
|
);
|
|
5375
5370
|
}, wm = () => {
|
|
5376
|
-
const e = B(null), [t, n] = C(""), { stringSet: r } = G(), { rootElement: s } = Y(), { channelSource: i, messageSource: a, state: l } =
|
|
5377
|
-
if (!
|
|
5371
|
+
const e = B(null), [t, n] = C(""), { stringSet: r } = G(), { rootElement: s } = Y(), { channelSource: i, messageSource: a, state: l } = re(), { files: c, addFiles: d, clearFiles: g } = mn(), f = l.input.disabled, b = (() => {
|
|
5372
|
+
if (!f) return r.MESSAGE_INPUT__PLACE_HOLDER;
|
|
5378
5373
|
switch (l.input.disabledBy) {
|
|
5379
5374
|
case "form_active":
|
|
5380
5375
|
return r.FORM_PLACEHOLDER;
|
|
@@ -5390,10 +5385,10 @@ const vm = (e, t) => {
|
|
|
5390
5385
|
return r.MESSAGE_INPUT__PLACE_HOLDER__DISABLED;
|
|
5391
5386
|
}
|
|
5392
5387
|
})();
|
|
5393
|
-
Tu({ onDropFiles: d }), xm({ blurred:
|
|
5394
|
-
const
|
|
5388
|
+
Tu({ onDropFiles: d }), xm({ blurred: f, elementRef: e, document: Re(s) }), vm(i.channel, t);
|
|
5389
|
+
const v = t.trim().length > 0, _ = c.length > 0, E = !f && (v || _), u = () => {
|
|
5395
5390
|
e.current && (e.current.value = "", e.current.style.height = ""), g(), n("");
|
|
5396
|
-
},
|
|
5391
|
+
}, p = async () => {
|
|
5397
5392
|
const S = t.trim(), O = { message: S };
|
|
5398
5393
|
if (!(!S && !c.length)) {
|
|
5399
5394
|
if (c.length > 0) {
|
|
@@ -5407,7 +5402,7 @@ const vm = (e, t) => {
|
|
|
5407
5402
|
const O = Array.from(S.clipboardData.files);
|
|
5408
5403
|
O.length > 0 && (S.preventDefault(), d(O));
|
|
5409
5404
|
}, y = (S) => {
|
|
5410
|
-
S.key !== "Enter" || S.nativeEvent.isComposing || S.shiftKey || (S.preventDefault(),
|
|
5405
|
+
S.key !== "Enter" || S.nativeEvent.isComposing || S.shiftKey || (S.preventDefault(), p());
|
|
5411
5406
|
}, k = (S) => {
|
|
5412
5407
|
if (e.current) {
|
|
5413
5408
|
e.current.style.height = "";
|
|
@@ -5416,7 +5411,7 @@ const vm = (e, t) => {
|
|
|
5416
5411
|
}
|
|
5417
5412
|
n(S.target.value);
|
|
5418
5413
|
};
|
|
5419
|
-
return
|
|
5414
|
+
return f ? /* @__PURE__ */ o.createElement(er, null, /* @__PURE__ */ o.createElement(Xn, null, /* @__PURE__ */ o.createElement(Jn, null, /* @__PURE__ */ o.createElement(Qn, { disabled: !0, placeholder: b }), /* @__PURE__ */ o.createElement(tr, { disabled: !0 })))) : /* @__PURE__ */ o.createElement(er, null, /* @__PURE__ */ o.createElement(Xn, null, /* @__PURE__ */ o.createElement(Sm, null), /* @__PURE__ */ o.createElement(Jn, null, /* @__PURE__ */ o.createElement(
|
|
5420
5415
|
Qn,
|
|
5421
5416
|
{
|
|
5422
5417
|
ref: e,
|
|
@@ -5428,7 +5423,7 @@ const vm = (e, t) => {
|
|
|
5428
5423
|
onChange: k,
|
|
5429
5424
|
onPaste: x
|
|
5430
5425
|
}
|
|
5431
|
-
), /* @__PURE__ */ o.createElement(tr, null))), E && /* @__PURE__ */ o.createElement(Gr, { onClick: () =>
|
|
5426
|
+
), /* @__PURE__ */ o.createElement(tr, null))), E && /* @__PURE__ */ o.createElement(Gr, { onClick: () => p() }, /* @__PURE__ */ o.createElement(H, { type: "send", color: m.color.primary.main, size: 20 })));
|
|
5432
5427
|
}, Im = h.div`padding:8px 16px;text-align:center;word-break:break-word;white-space:pre-wrap;line-height:1.43;letter-spacing:-0.2px;font-size:14px;font-weight:400;color:${m.themedColor.textLowEmphasis};&& a{font-weight:700;text-decoration:none;${F.light`
|
|
5433
5428
|
color: ${m.color.information.light};
|
|
5434
5429
|
`};
|
|
@@ -5436,14 +5431,14 @@ const vm = (e, t) => {
|
|
|
5436
5431
|
color: ${m.color.information.main};
|
|
5437
5432
|
`};
|
|
5438
5433
|
}
|
|
5439
|
-
`, km = D(() => import("./
|
|
5440
|
-
const { aiAgentInfo: e, userSession: t } =
|
|
5434
|
+
`, km = D(() => import("./7nVEVfxl.js").then((e) => ({ default: e.MarkdownText }))), $m = () => {
|
|
5435
|
+
const { aiAgentInfo: e, userSession: t } = ne(), { messageSource: n, channelSource: r } = re(), [s, i] = C(null), a = Xt("special-notice", r.channel), l = L(() => r.channel ? a ? n.messages.some((c) => Qe(c, (t == null ? void 0 : t.userId) ?? "")) : !0 : null, [r.channel, a, n.messages, t == null ? void 0 : t.userId]);
|
|
5441
5436
|
return P(() => {
|
|
5442
5437
|
s || i(l());
|
|
5443
5438
|
}, [l, s]), s || !e.specialNotice ? null : /* @__PURE__ */ o.createElement(Im, null, /* @__PURE__ */ o.createElement(km, null, e.specialNotice));
|
|
5444
5439
|
}, Mm = () => /* @__PURE__ */ o.createElement(Lm, null, /* @__PURE__ */ o.createElement($m, null), /* @__PURE__ */ o.createElement(Em, null, /* @__PURE__ */ o.createElement(wm, null))), Lm = h.div`z-index:0;border:none;width:100%;`, Om = () => {
|
|
5445
5440
|
var s;
|
|
5446
|
-
const { testerType: e } = je(), { channelSource: t } =
|
|
5441
|
+
const { testerType: e } = je(), { channelSource: t } = re(), n = ke(t.channel), r = !!e && ((s = t.channel) == null ? void 0 : s.isAIAgent);
|
|
5447
5442
|
return n && r ? /* @__PURE__ */ o.createElement(fm, null) : /* @__PURE__ */ o.createElement(Mm, null);
|
|
5448
5443
|
}, Dm = ({
|
|
5449
5444
|
children: e,
|
|
@@ -5481,7 +5476,7 @@ const Nm = h.div`height:100%;width:100%;display:flex;flex-direction:column;flex:
|
|
|
5481
5476
|
Provider: Bm,
|
|
5482
5477
|
Context: vh,
|
|
5483
5478
|
useContext: Wr
|
|
5484
|
-
} =
|
|
5479
|
+
} = ee("ConversationList");
|
|
5485
5480
|
function Fm({
|
|
5486
5481
|
conversationListLimit: e,
|
|
5487
5482
|
conversationListFilter: t,
|
|
@@ -5509,7 +5504,7 @@ function Um(e) {
|
|
|
5509
5504
|
hoursAgo: r.DATE_FORMAT__HOURS_AGO,
|
|
5510
5505
|
dateShortFormat: r.DATE_FORMAT__DATE_SHORT
|
|
5511
5506
|
}), l = t.unreadMessageCount;
|
|
5512
|
-
return /* @__PURE__ */ o.createElement(Hm, { role: "button", onClick: () => n == null ? void 0 : n() }, /* @__PURE__ */ o.createElement(Vm, null, /* @__PURE__ */ o.createElement(Pm, { ...e })), /* @__PURE__ */ o.createElement(zm, null, /* @__PURE__ */ o.createElement(Gm, null, /* @__PURE__ */ o.createElement(w, { variant: "subtitle1", color: m.themedColor.textHighEmphasis, maxTextLines: 1 }, i), /* @__PURE__ */ o.createElement(Wm, null,
|
|
5507
|
+
return /* @__PURE__ */ o.createElement(Hm, { role: "button", onClick: () => n == null ? void 0 : n() }, /* @__PURE__ */ o.createElement(Vm, null, /* @__PURE__ */ o.createElement(Pm, { ...e })), /* @__PURE__ */ o.createElement(zm, null, /* @__PURE__ */ o.createElement(Gm, null, /* @__PURE__ */ o.createElement(w, { variant: "subtitle1", color: m.themedColor.textHighEmphasis, maxTextLines: 1 }, i), /* @__PURE__ */ o.createElement(Wm, null, ke(t) && /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(w, { variant: "caption1", color: m.themedColor.textMidEmphasis, maxTextLines: 1 }, r.CONVERSATION_LIST__ENDED), /* @__PURE__ */ o.createElement(jm, null)), /* @__PURE__ */ o.createElement(w, { variant: "caption2", color: m.themedColor.textLowEmphasis, maxTextLines: 1 }, a))), l > 0 && /* @__PURE__ */ o.createElement(qm, { $count: l }, /* @__PURE__ */ o.createElement(w, { variant: "caption3", color: m.themedColor.textHighEmphasisInverse }, l <= Gt ? l : `${Gt}+`))));
|
|
5513
5508
|
}
|
|
5514
5509
|
const Hm = h.div`display:flex;flex-shrink:0;flex-direction:row;align-items:center;position:relative;width:100%;height:72px;box-sizing:border-box;gap:16px;cursor:pointer;`, Vm = h.div`display:flex;align-items:center;justify-content:center;padding-inline-start:16px;`, zm = h.div`display:flex;flex-direction:row;align-items:center;flex:1;padding-inline-end:16px;height:100%;gap:8px;border-bottom:1px solid ${m.themedColor.textDisabled};`, Gm = h.div`display:flex;flex-direction:column;justify-content:center;flex:1;gap:4px;word-break:break-word;overflow-wrap:break-word;`, Wm = h.div`display:flex;align-items:center;gap:6px;`, jm = h.div`width:2px;height:2px;border-radius:1px;background-color:${m.themedColor.textLowEmphasis};`, qm = h.div`display:flex;align-items:center;justify-content:center;height:20px;padding:4px;border-radius:10px;background-color:${m.themedColor.error};${({ $count: e }) => e <= Gt && I`
|
|
5515
5510
|
width: 20px;
|
|
@@ -5533,7 +5528,7 @@ const Hm = h.div`display:flex;flex-shrink:0;flex-direction:row;align-items:cente
|
|
|
5533
5528
|
{
|
|
5534
5529
|
key: s.url,
|
|
5535
5530
|
channel: s,
|
|
5536
|
-
onClick: () => n(s.url,
|
|
5531
|
+
onClick: () => n(s.url, ke(s) ? "closed" : "open"),
|
|
5537
5532
|
channelUrl: s.url,
|
|
5538
5533
|
title: (a = (i = s.conversation) == null ? void 0 : i.topics) == null ? void 0 : a.join(", "),
|
|
5539
5534
|
lastMessageTimestamp: (l = s.lastMessage) == null ? void 0 : l.createdAt
|
|
@@ -5546,7 +5541,7 @@ const Hm = h.div`display:flex;flex-shrink:0;flex-direction:row;align-items:cente
|
|
|
5546
5541
|
}
|
|
5547
5542
|
) : /* @__PURE__ */ o.createElement(ze, { type: "loading" });
|
|
5548
5543
|
}, Xm = () => {
|
|
5549
|
-
const { stringSet: e } = G(), { language: t, countryCode: n, context: r } = Y(), { aiAgentInfo: s, refreshActiveChannel: i, createConversation: a, setActiveChannel: l } =
|
|
5544
|
+
const { stringSet: e } = G(), { language: t, countryCode: n, context: r } = Y(), { aiAgentInfo: s, refreshActiveChannel: i, createConversation: a, setActiveChannel: l } = ne(), { onOpenConversationView: c } = Wr();
|
|
5550
5545
|
return /* @__PURE__ */ o.createElement(
|
|
5551
5546
|
Jm,
|
|
5552
5547
|
{
|
|
@@ -5559,10 +5554,10 @@ const Hm = h.div`display:flex;flex-shrink:0;flex-direction:row;align-items:cente
|
|
|
5559
5554
|
country: n,
|
|
5560
5555
|
context: r
|
|
5561
5556
|
});
|
|
5562
|
-
l({ url: d, status:
|
|
5557
|
+
l({ url: d, status: Q.OPEN }), c(d, Q.OPEN);
|
|
5563
5558
|
} else {
|
|
5564
5559
|
const d = await i();
|
|
5565
|
-
c(d,
|
|
5560
|
+
c(d, Q.OPEN);
|
|
5566
5561
|
}
|
|
5567
5562
|
}
|
|
5568
5563
|
},
|
|
@@ -5572,7 +5567,7 @@ const Hm = h.div`display:flex;flex-shrink:0;flex-direction:row;align-items:cente
|
|
|
5572
5567
|
const { state: e } = Y(), t = qe(), n = () => {
|
|
5573
5568
|
e.setOpened(!1);
|
|
5574
5569
|
};
|
|
5575
|
-
return /* @__PURE__ */ o.createElement(
|
|
5570
|
+
return /* @__PURE__ */ o.createElement(Le, { "aria-label": "close messenger", type: "close", size: t, onClick: n });
|
|
5576
5571
|
}, tg = () => {
|
|
5577
5572
|
const { stringSet: e } = G();
|
|
5578
5573
|
return /* @__PURE__ */ o.createElement(ng, { variant: "h2", color: m.themedColor.textHighEmphasis }, e.CONVERSATION_LIST__HEADER_TITLE);
|
|
@@ -5759,7 +5754,7 @@ const bg = {
|
|
|
5759
5754
|
}), Ze = new pr(or.WARN), Eg = new gr(Ze), {
|
|
5760
5755
|
Provider: xg,
|
|
5761
5756
|
useContext: pn
|
|
5762
|
-
} =
|
|
5757
|
+
} = ee("PageChildren"), Kr = ({ children: e }) => {
|
|
5763
5758
|
const [t, n] = C(null), [r, s] = C(null);
|
|
5764
5759
|
return /* @__PURE__ */ o.createElement(
|
|
5765
5760
|
xg,
|
|
@@ -5825,7 +5820,7 @@ const Sg = I`&:hover{transition:transform 250ms cubic-bezier(0.33,0,0,1);transfo
|
|
|
5825
5820
|
Close: ({ size: e }) => /* @__PURE__ */ o.createElement(H, { size: e, type: "chevron-down" })
|
|
5826
5821
|
};
|
|
5827
5822
|
function Jr({ className: e, size: t }) {
|
|
5828
|
-
const { colors: n } = Je(), { dir: r, state: s } = Y(), { launcherInfo: i } =
|
|
5823
|
+
const { colors: n } = Je(), { dir: r, state: s } = Y(), { launcherInfo: i } = ne();
|
|
5829
5824
|
return $g(), /* @__PURE__ */ o.createElement(
|
|
5830
5825
|
Cg,
|
|
5831
5826
|
{
|
|
@@ -5888,15 +5883,15 @@ const Mg = sr`0%{transform:translateY(40px);opacity:0;}100%{transform:translateY
|
|
|
5888
5883
|
` : I`z-index:1;pointer-events:none;`}
|
|
5889
5884
|
`;
|
|
5890
5885
|
function ht({ initialId: e, children: t }) {
|
|
5891
|
-
const [n, r] = C([e]), s = n[n.length - 1], i = L((u,
|
|
5892
|
-
r((x) => [...x, u]),
|
|
5886
|
+
const [n, r] = C([e]), s = n[n.length - 1], i = L((u, p) => {
|
|
5887
|
+
r((x) => [...x, u]), f((x) => ({ ...x, [u]: !0 })), p != null && p.reset && E((x) => ({
|
|
5893
5888
|
...x,
|
|
5894
5889
|
[u]: (x[u] || 0) + 1
|
|
5895
|
-
})),
|
|
5890
|
+
})), v((x) => ({
|
|
5896
5891
|
...x,
|
|
5897
5892
|
[u]: "entering"
|
|
5898
5893
|
})), setTimeout(() => {
|
|
5899
|
-
|
|
5894
|
+
v((x) => ({
|
|
5900
5895
|
...x,
|
|
5901
5896
|
[u]: "entered"
|
|
5902
5897
|
}));
|
|
@@ -5904,14 +5899,14 @@ function ht({ initialId: e, children: t }) {
|
|
|
5904
5899
|
}, []), a = L(() => {
|
|
5905
5900
|
r((u) => {
|
|
5906
5901
|
if (u.length <= 1) return u;
|
|
5907
|
-
const
|
|
5908
|
-
return
|
|
5902
|
+
const p = u[u.length - 1];
|
|
5903
|
+
return v((x) => ({
|
|
5909
5904
|
...x,
|
|
5910
|
-
[
|
|
5905
|
+
[p]: "exiting"
|
|
5911
5906
|
})), setTimeout(() => {
|
|
5912
|
-
|
|
5907
|
+
v((x) => ({
|
|
5913
5908
|
...x,
|
|
5914
|
-
[
|
|
5909
|
+
[p]: "exited"
|
|
5915
5910
|
})), r((x) => x.slice(0, -1));
|
|
5916
5911
|
}, 300), u;
|
|
5917
5912
|
});
|
|
@@ -5925,26 +5920,26 @@ function ht({ initialId: e, children: t }) {
|
|
|
5925
5920
|
(u) => u.type === to
|
|
5926
5921
|
), [t]), d = ie(() => {
|
|
5927
5922
|
const u = {};
|
|
5928
|
-
return c.forEach((
|
|
5929
|
-
const { id: x, lazy: y, children: k } =
|
|
5923
|
+
return c.forEach((p) => {
|
|
5924
|
+
const { id: x, lazy: y, children: k } = p.props;
|
|
5930
5925
|
u[x] = { lazy: y, element: typeof k == "function" ? k(l) : k };
|
|
5931
5926
|
}), u;
|
|
5932
|
-
}, [c, l]), [g,
|
|
5927
|
+
}, [c, l]), [g, f] = C(() => {
|
|
5933
5928
|
const u = {};
|
|
5934
|
-
return Object.entries(d).forEach(([
|
|
5935
|
-
x === !1 && (u[
|
|
5929
|
+
return Object.entries(d).forEach(([p, { lazy: x }]) => {
|
|
5930
|
+
x === !1 && (u[p] = !0);
|
|
5936
5931
|
}), u[e] = !0, u;
|
|
5937
|
-
}), [b,
|
|
5932
|
+
}), [b, v] = C(() => {
|
|
5938
5933
|
const u = {};
|
|
5939
|
-
return Object.keys(d).forEach((
|
|
5940
|
-
|
|
5934
|
+
return Object.keys(d).forEach((p) => {
|
|
5935
|
+
p === e ? u[p] = "entered" : u[p] = "exited";
|
|
5941
5936
|
}), u;
|
|
5942
|
-
}), [
|
|
5937
|
+
}), [_, E] = C({});
|
|
5943
5938
|
return /* @__PURE__ */ o.createElement(Qr.Provider, { value: l }, /* @__PURE__ */ o.createElement(Fg, null, Object.keys(d).map((u) => {
|
|
5944
5939
|
var k;
|
|
5945
5940
|
if (!g[u]) return null;
|
|
5946
|
-
const
|
|
5947
|
-
return /* @__PURE__ */ o.createElement(Bg, { key: y, $transitionState:
|
|
5941
|
+
const p = b[u] || "exited", x = u === s, y = `${u}-${_[u] || 0}`;
|
|
5942
|
+
return /* @__PURE__ */ o.createElement(Bg, { key: y, $transitionState: p, $active: x }, (k = d[u]) == null ? void 0 : k.element);
|
|
5948
5943
|
})));
|
|
5949
5944
|
}
|
|
5950
5945
|
const Fg = h.div`position:relative;width:100%;height:100%;`;
|
|
@@ -5985,7 +5980,7 @@ const be = {
|
|
|
5985
5980
|
i
|
|
5986
5981
|
)));
|
|
5987
5982
|
}, Pg = ({ onOpenConversationView: e }) => {
|
|
5988
|
-
const { registerOnJoinedProactiveConversation: t } =
|
|
5983
|
+
const { registerOnJoinedProactiveConversation: t } = ne(), { navigation: n } = eo();
|
|
5989
5984
|
return t(({ channel: r }) => {
|
|
5990
5985
|
e(r.url), n.navigate(be.conv);
|
|
5991
5986
|
}), null;
|
|
@@ -6008,7 +6003,7 @@ const Hg = h.div`display:flex;flex-direction:column;gap:8px;align-items:flex-end
|
|
|
6008
6003
|
}), {
|
|
6009
6004
|
Provider: Wg,
|
|
6010
6005
|
useContext: fn
|
|
6011
|
-
} =
|
|
6006
|
+
} = ee("FixedMessengerStyle");
|
|
6012
6007
|
function ro(e, t, n, r = 0) {
|
|
6013
6008
|
const { top: s, bottom: i, start: a, end: l } = n;
|
|
6014
6009
|
let c = "", d = "";
|
|
@@ -6061,16 +6056,16 @@ const Yg = h.div`background:${({ theme: e }) => e.colors.base.background};displa
|
|
|
6061
6056
|
${({ $isOpened: e }) => e && Xg};
|
|
6062
6057
|
${({ $isExpanded: e }) => e && Zg};
|
|
6063
6058
|
`, Zg = I`width:743px;height:723px;`, Xg = I`z-index:${Ne.WINDOW};pointer-events:all;transform:scale(1);opacity:1;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 300ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;`, oo = { top: 24, bottom: 24, start: 24, end: 24 }, Jg = We(function({ children: e, initialChannelUrl: t, ...n }, r) {
|
|
6064
|
-
const [s, i] = C(t), [a, l] = C("end-bottom"), [c, d] = C(oo), [g,
|
|
6065
|
-
const [u,
|
|
6066
|
-
return { horizontal: u === "start" ? "start" : "end", vertical:
|
|
6059
|
+
const [s, i] = C(t), [a, l] = C("end-bottom"), [c, d] = C(oo), [g, f] = C(48), b = nt(), v = b ? Yr : Kg, { horizontal: _, vertical: E } = ie(() => {
|
|
6060
|
+
const [u, p] = a.split("-");
|
|
6061
|
+
return { horizontal: u === "start" ? "start" : "end", vertical: p === "top" ? "top" : "bottom" };
|
|
6067
6062
|
}, [a]);
|
|
6068
6063
|
return /* @__PURE__ */ o.createElement(qr, { enableExpandButton: !b, ref: r, ...n }, /* @__PURE__ */ o.createElement(Tr, null, ({ state: u }) => /* @__PURE__ */ o.createElement(
|
|
6069
6064
|
Wg,
|
|
6070
6065
|
{
|
|
6071
|
-
value: { horizontal:
|
|
6066
|
+
value: { horizontal: _, vertical: E, margin: c, launcherSize: g, setPosition: l, setMargin: d, setLauncherSize: f }
|
|
6072
6067
|
},
|
|
6073
|
-
/* @__PURE__ */ o.createElement(Kr, null, /* @__PURE__ */ o.createElement(
|
|
6068
|
+
/* @__PURE__ */ o.createElement(Kr, null, /* @__PURE__ */ o.createElement(v, { isExpanded: u.expanded, isOpened: u.opened }, /* @__PURE__ */ o.createElement(
|
|
6074
6069
|
no,
|
|
6075
6070
|
{
|
|
6076
6071
|
isOpened: u.opened,
|
|
@@ -6083,7 +6078,7 @@ const Yg = h.div`background:${({ theme: e }) => e.colors.base.background};displa
|
|
|
6083
6078
|
}), Qg = (e) => {
|
|
6084
6079
|
var s, i, a, l;
|
|
6085
6080
|
const { setPosition: t, setMargin: n, setLauncherSize: r } = fn();
|
|
6086
|
-
return
|
|
6081
|
+
return oe(() => {
|
|
6087
6082
|
e.position && t(e.position), e.margin && n({ ...oo, ...e.margin }), e.launcherSize && r(e.launcherSize);
|
|
6088
6083
|
}, [
|
|
6089
6084
|
e.position,
|
|
@@ -6095,16 +6090,16 @@ const Yg = h.div`background:${({ theme: e }) => e.colors.base.background};displa
|
|
|
6095
6090
|
]), null;
|
|
6096
6091
|
}, eh = ({ children: e }) => {
|
|
6097
6092
|
const { setConversationChildren: t } = pn();
|
|
6098
|
-
return
|
|
6093
|
+
return oe(() => (t(e), () => t(null)), [e]), null;
|
|
6099
6094
|
}, th = ({ children: e }) => {
|
|
6100
6095
|
const { setConversationListChildren: t } = pn();
|
|
6101
|
-
return
|
|
6096
|
+
return oe(() => (t(e), () => t(null)), [e]), null;
|
|
6102
6097
|
}, yh = Object.assign(Jg, {
|
|
6103
6098
|
Style: Qg,
|
|
6104
6099
|
ConversationChildren: eh,
|
|
6105
6100
|
ConversationListChildren: th
|
|
6106
6101
|
}), Ch = (e) => {
|
|
6107
|
-
const { refreshActiveChannel: t } =
|
|
6102
|
+
const { refreshActiveChannel: t } = ne(), [n, r] = C(!1), s = B(null), i = B(null);
|
|
6108
6103
|
return P(() => {
|
|
6109
6104
|
n && t().then(() => {
|
|
6110
6105
|
var a;
|
|
@@ -6132,7 +6127,7 @@ export {
|
|
|
6132
6127
|
qr as a,
|
|
6133
6128
|
fg as b,
|
|
6134
6129
|
m as c,
|
|
6135
|
-
|
|
6130
|
+
ne as d,
|
|
6136
6131
|
Eh as e,
|
|
6137
6132
|
G as f,
|
|
6138
6133
|
Eg as g,
|
|
@@ -6144,7 +6139,7 @@ export {
|
|
|
6144
6139
|
Ni as m,
|
|
6145
6140
|
xh as n,
|
|
6146
6141
|
su as o,
|
|
6147
|
-
|
|
6142
|
+
re as p,
|
|
6148
6143
|
lg as q,
|
|
6149
6144
|
hn as r,
|
|
6150
6145
|
rt as s,
|