@sendbird/ai-agent-messenger-react 1.1.1 → 1.1.3
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/{Hose4Xqt.cjs → Bt3lecGZ.cjs} +1 -1
- package/dist/cjs/{CVXXGvT2.cjs → CKx6wVaW.cjs} +1 -1
- package/dist/cjs/DWvpgvvZ.cjs +207 -0
- package/dist/cjs/{56s3GVJ_.cjs → Dglv1NCD.cjs} +1 -1
- package/dist/cjs/{C2iVxqfU.cjs → GKu9FYkI.cjs} +1 -1
- package/dist/cjs/{DZu-bitL.cjs → jZaK4QJl.cjs} +1 -1
- package/dist/es/{D_jG_XZn.js → BiDHCPQ4.js} +1 -1
- package/dist/es/{Dde5r6cu.js → CKiHeXpb.js} +1 -1
- package/dist/es/{XE_dyn7i.js → CNYupg9n.js} +1 -1
- package/dist/es/DQVTDao9.js +4090 -0
- package/dist/es/{CSc2-BOs.js → DuIMnVIa.js} +1 -1
- package/dist/es/{DeR_25I_.js → yjU33qf_.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +287 -12
- package/dist/index.js +1 -1
- package/package.json +8 -8
- package/dist/cjs/4USOA6cB.cjs +0 -196
- package/dist/es/BovngiOZ.js +0 -3698
package/dist/es/BovngiOZ.js
DELETED
|
@@ -1,3698 +0,0 @@
|
|
|
1
|
-
import * as r from "react";
|
|
2
|
-
import { createContext as ye, useContext as J, useEffect as R, useState as T, useId as mn, useRef as D, useCallback as P, useLayoutEffect as ge, lazy as C, Suspense as $e, useMemo as Ie, Component as mr, Fragment as Rt, useReducer as gr, forwardRef as pr, Children as hr } from "react";
|
|
3
|
-
import fr, { SendbirdProduct as br, DeviceOsPlatform as Nt, SendbirdPlatform as xr, ConnectionHandler as ut, SendbirdError as Er, SessionHandler as vr, LogLevel as gn, ConnectionState as yr } from "@sendbird/chat";
|
|
4
|
-
import c, { css as k, ThemeProvider as Cr, useTheme as mt, createGlobalStyle as Tr, StyleSheetManager as _r, keyframes as pn } from "styled-components";
|
|
5
|
-
import { format as hn, isSameMinute as Dt, isSameDay as Sr } from "date-fns";
|
|
6
|
-
import { enUS as wr } from "date-fns/locale/en-US";
|
|
7
|
-
import { AIAgentModule as kr, ConversationStatus as z, ConversationListOrder as Ar, ConversationType as Ir } from "@sendbird/chat/aiAgent";
|
|
8
|
-
import { useGroupChannelMessages as $r, useGroupChannelHandler as fn, useForceUpdate as Mr } from "@sendbird/uikit-tools";
|
|
9
|
-
import { GroupChannelModule as Or } from "@sendbird/chat/groupChannel";
|
|
10
|
-
import { MessageMetaArray as Lr, SendingStatus as Rr } from "@sendbird/chat/message";
|
|
11
|
-
import { isSameDay as Nr } from "date-fns/isSameDay";
|
|
12
|
-
import { renderer as Dr, parser as Br, MessageProvider as Pr } from "@sendbird/react-uikit-message-template-view";
|
|
13
|
-
import { createMessageTemplate as Fr } from "@sendbird/uikit-message-template";
|
|
14
|
-
import bn from "dompurify";
|
|
15
|
-
import { createPortal as Hr } from "react-dom";
|
|
16
|
-
import Ur from "@emotion/is-prop-valid";
|
|
17
|
-
const W = (e, t) => {
|
|
18
|
-
const n = ye(null), o = ({ children: s, value: l }) => /* @__PURE__ */ r.createElement(n.Provider, { value: l }, typeof s == "function" ? s(l) : s), i = ({ children: s }) => /* @__PURE__ */ r.createElement(n.Consumer, null, (l) => l ? typeof s == "function" ? s(l) : s : null), a = () => {
|
|
19
|
-
const s = J(n);
|
|
20
|
-
if (!s)
|
|
21
|
-
throw new Error(`use${e}Context must be used within a ${e}Provider`);
|
|
22
|
-
return s;
|
|
23
|
-
};
|
|
24
|
-
return n.displayName = `${e}Context`, o.displayName = `${e}Provider`, i.displayName = `${e}Consumer`, a.displayName = `use${e}Context`, { Context: n, Provider: o, Consumer: i, useContext: a };
|
|
25
|
-
};
|
|
26
|
-
function Ce(e) {
|
|
27
|
-
const t = ye({
|
|
28
|
-
Template: e.template,
|
|
29
|
-
updateTemplate: () => {
|
|
30
|
-
},
|
|
31
|
-
components: e.components,
|
|
32
|
-
updateComponent: () => {
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
function n({ children: a }) {
|
|
36
|
-
const [s, l] = T(() => e.template), [d, g] = T(e.components), m = {
|
|
37
|
-
Template: s,
|
|
38
|
-
updateTemplate: (p) => l(() => p),
|
|
39
|
-
components: d,
|
|
40
|
-
updateComponent: (p, h) => g((b) => ({ ...b, [p]: h }))
|
|
41
|
-
};
|
|
42
|
-
return /* @__PURE__ */ r.createElement(t.Provider, { value: m }, a);
|
|
43
|
-
}
|
|
44
|
-
function o({ template: a, children: s }) {
|
|
45
|
-
const { updateTemplate: l } = J(t);
|
|
46
|
-
return R(() => {
|
|
47
|
-
a && l(a);
|
|
48
|
-
}, [a]), /* @__PURE__ */ r.createElement(r.Fragment, null, s);
|
|
49
|
-
}
|
|
50
|
-
function i({ children: a }) {
|
|
51
|
-
return /* @__PURE__ */ r.createElement(n, null, a);
|
|
52
|
-
}
|
|
53
|
-
return i.defaults = e, i.useContext = () => J(t), i.Context = t, i.Template = o, Object.keys(e.components).forEach((a) => {
|
|
54
|
-
i[a] = function({
|
|
55
|
-
component: l
|
|
56
|
-
}) {
|
|
57
|
-
const { updateComponent: d } = J(t);
|
|
58
|
-
return R(() => {
|
|
59
|
-
l && d(a, l);
|
|
60
|
-
}, [l]), null;
|
|
61
|
-
};
|
|
62
|
-
}), i;
|
|
63
|
-
}
|
|
64
|
-
function zr(...e) {
|
|
65
|
-
return function({ children: n }) {
|
|
66
|
-
return e.reduce((o, i) => /* @__PURE__ */ r.createElement(i, null, o), n);
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function ot() {
|
|
70
|
-
}
|
|
71
|
-
function Wr() {
|
|
72
|
-
const e = /iPad|iPhone|iPod/.test(navigator.userAgent), t = /Android/.test(navigator.userAgent);
|
|
73
|
-
return e || t;
|
|
74
|
-
}
|
|
75
|
-
class xn {
|
|
76
|
-
constructor(t) {
|
|
77
|
-
this.logger = t, this.subscribers = {};
|
|
78
|
-
}
|
|
79
|
-
async send(t) {
|
|
80
|
-
const n = Vr(), o = this.subscribers[t.type];
|
|
81
|
-
if (o) {
|
|
82
|
-
this.logger.debug(`messenger.dispatcher: dispatching command: ${t.type}`, t.payload);
|
|
83
|
-
const i = o.map((a) => a(t.payload));
|
|
84
|
-
await Promise.all(i).catch((a) => {
|
|
85
|
-
this.logger.error(`messenger.dispatcher: error in callback for command: ${t.type}`, a);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return n.resolve(), n.promise;
|
|
89
|
-
}
|
|
90
|
-
subscribe(t, n) {
|
|
91
|
-
this.subscribers[t] || (this.subscribers[t] = []), this.subscribers[t].push(n);
|
|
92
|
-
}
|
|
93
|
-
unsubscribe(t, n) {
|
|
94
|
-
this.subscribers[t] && (this.subscribers[t] = this.subscribers[t].filter((o) => o !== n));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
const Vr = () => {
|
|
98
|
-
let e = ot, t = ot;
|
|
99
|
-
return { promise: new Promise((o, i) => {
|
|
100
|
-
e = o, t = i;
|
|
101
|
-
}), resolve: e, reject: t };
|
|
102
|
-
}, Gr = "1.1.0", ke = "sb-agent", jr = Gr;
|
|
103
|
-
var En = /* @__PURE__ */ ((e) => (e[e.VERBOSE = 0] = "VERBOSE", e[e.DEBUG = 1] = "DEBUG", e[e.INFO = 2] = "INFO", e[e.WARN = 3] = "WARN", e[e.ERROR = 4] = "ERROR", e[e.NONE = 5] = "NONE", e))(En || {});
|
|
104
|
-
class vn {
|
|
105
|
-
constructor(t) {
|
|
106
|
-
this.level = t;
|
|
107
|
-
}
|
|
108
|
-
verbose(...t) {
|
|
109
|
-
this.level <= 0 && console.log(`[${ke}/verbose]`, ...t);
|
|
110
|
-
}
|
|
111
|
-
debug(...t) {
|
|
112
|
-
this.level <= 1 && console.log(`[${ke}/debug]`, ...t);
|
|
113
|
-
}
|
|
114
|
-
info(...t) {
|
|
115
|
-
this.level <= 2 && console.log(`[${ke}/info]`, ...t);
|
|
116
|
-
}
|
|
117
|
-
warn(...t) {
|
|
118
|
-
this.level <= 3 && console.warn(`[${ke}/warn]`, ...t);
|
|
119
|
-
}
|
|
120
|
-
error(...t) {
|
|
121
|
-
this.level <= 4 && console.error(`[${ke}/error]`, ...t);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function Bt(e, t, n) {
|
|
125
|
-
const o = fr.init({
|
|
126
|
-
appId: e,
|
|
127
|
-
modules: [new Or(), new kr()],
|
|
128
|
-
localCacheEnabled: !0,
|
|
129
|
-
...n
|
|
130
|
-
});
|
|
131
|
-
return o.addSendbirdExtensions(
|
|
132
|
-
[{ version: jr, product: br.AI_AGENT, platform: t.platform }],
|
|
133
|
-
{ platform: t.deviceOSPlatform, version: t.deviceOSVersion },
|
|
134
|
-
t.customData
|
|
135
|
-
) || console.warn("Invalid Sendbird Extensions", t), o;
|
|
136
|
-
}
|
|
137
|
-
const {
|
|
138
|
-
Provider: Kr,
|
|
139
|
-
useContext: Ze
|
|
140
|
-
} = W("AIAgent");
|
|
141
|
-
function Zr({
|
|
142
|
-
appId: e,
|
|
143
|
-
aiAgentId: t,
|
|
144
|
-
language: n,
|
|
145
|
-
countryCode: o,
|
|
146
|
-
context: i,
|
|
147
|
-
chatSDK: a,
|
|
148
|
-
chatParams: s,
|
|
149
|
-
dispatcher: l,
|
|
150
|
-
logger: d,
|
|
151
|
-
children: g,
|
|
152
|
-
extensions: m = {
|
|
153
|
-
platform: xr.JS,
|
|
154
|
-
deviceOSPlatform: Wr() ? Nt.MOBILE_WEB : Nt.WEB
|
|
155
|
-
}
|
|
156
|
-
}) {
|
|
157
|
-
const [p, h] = T(() => {
|
|
158
|
-
const b = d ?? new vn(En.WARN), x = l ?? new xn(b);
|
|
159
|
-
return {
|
|
160
|
-
appId: e,
|
|
161
|
-
aiAgentId: t,
|
|
162
|
-
language: n,
|
|
163
|
-
countryCode: o,
|
|
164
|
-
context: i,
|
|
165
|
-
chatSDK: a ?? Bt(e, m, s),
|
|
166
|
-
logger: b,
|
|
167
|
-
dispatcher: x
|
|
168
|
-
};
|
|
169
|
-
});
|
|
170
|
-
return (n !== p.language || o !== p.countryCode) && h((b) => ({ ...b, language: n, countryCode: o, context: i })), a && a !== p.chatSDK ? h((b) => ({ ...b, aiAgentId: t, chatSDK: a })) : !a && p.chatSDK.appId !== e && h((b) => ({
|
|
171
|
-
...b,
|
|
172
|
-
aiAgentId: t,
|
|
173
|
-
chatSDK: Bt(e, m, { newInstance: !0, ...s })
|
|
174
|
-
})), R(() => () => {
|
|
175
|
-
p.chatSDK.disconnectWebSocket();
|
|
176
|
-
}, [p.chatSDK]), /* @__PURE__ */ r.createElement(Kr, { value: p }, g);
|
|
177
|
-
}
|
|
178
|
-
const Yr = (e, t, n) => $r(e, t, { ...n, strictStreamingOrder: !0 });
|
|
179
|
-
var it = /* @__PURE__ */ ((e) => (e.ConversationClose = "conv.close", e))(it || {});
|
|
180
|
-
class qr {
|
|
181
|
-
constructor(t = {}) {
|
|
182
|
-
this.payload = t;
|
|
183
|
-
}
|
|
184
|
-
toJSON() {
|
|
185
|
-
return JSON.stringify({ type: this.type, payload: this.payload });
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
class Jr extends qr {
|
|
189
|
-
constructor() {
|
|
190
|
-
super(...arguments), this.type = "conv.close";
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
const Xr = {
|
|
194
|
-
CloseConversation: () => new Jr()
|
|
195
|
-
}, {
|
|
196
|
-
Provider: Qr
|
|
197
|
-
} = W("AIAgentConversation");
|
|
198
|
-
function eo({
|
|
199
|
-
children: e,
|
|
200
|
-
channelUrl: t,
|
|
201
|
-
onChannelDeleted: n,
|
|
202
|
-
onMessagesUpdated: o,
|
|
203
|
-
onConversationClosedViaDispatcher: i,
|
|
204
|
-
onBeforeSendMessage: a,
|
|
205
|
-
onAfterSendMessage: s = ot
|
|
206
|
-
}) {
|
|
207
|
-
var v;
|
|
208
|
-
const { chatSDK: l, logger: d, dispatcher: g } = Ze(), { channel: m, channelFetchError: p, fetchChannel: h } = to(t), b = Yr(l, m, {
|
|
209
|
-
shouldCountNewMessages: () => !1,
|
|
210
|
-
onChannelDeleted: n,
|
|
211
|
-
onMessagesReceived: o,
|
|
212
|
-
onMessagesUpdated: o,
|
|
213
|
-
logger: d
|
|
214
|
-
});
|
|
215
|
-
R(() => {
|
|
216
|
-
const f = async () => {
|
|
217
|
-
d.debug("conversation.dispatcher: try to close conversation", m), m != null && m.conversation && m.conversation.status === z.OPEN && (await m.closeConversation(), i == null || i());
|
|
218
|
-
};
|
|
219
|
-
return g.subscribe(it.ConversationClose, f), () => {
|
|
220
|
-
g.unsubscribe(it.ConversationClose, f);
|
|
221
|
-
};
|
|
222
|
-
}, [g, (v = m == null ? void 0 : m.conversation) == null ? void 0 : v.status, i]);
|
|
223
|
-
const x = {
|
|
224
|
-
conversation: (m == null ? void 0 : m.conversation) ?? void 0,
|
|
225
|
-
channelSource: {
|
|
226
|
-
channel: m,
|
|
227
|
-
error: p,
|
|
228
|
-
refetch: () => h()
|
|
229
|
-
},
|
|
230
|
-
messageSource: {
|
|
231
|
-
messages: b.messages,
|
|
232
|
-
initialized: b.initialized,
|
|
233
|
-
loadPrevious: () => b.loadPrevious(),
|
|
234
|
-
loadNext: () => b.loadNext(),
|
|
235
|
-
sendUserMessage: async (f) => {
|
|
236
|
-
a && (f = await a(f));
|
|
237
|
-
const y = await b.sendUserMessage(f, s);
|
|
238
|
-
return s == null || s(y), y;
|
|
239
|
-
},
|
|
240
|
-
sendFileMessage: async (f) => {
|
|
241
|
-
a && (f = await a(f));
|
|
242
|
-
const y = await b.sendFileMessage(f, s);
|
|
243
|
-
return s == null || s(y), y;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
return /* @__PURE__ */ r.createElement(Qr, { value: x }, e);
|
|
248
|
-
}
|
|
249
|
-
function to(e) {
|
|
250
|
-
const { chatSDK: t, logger: n } = Ze(), [o, i] = T(void 0), [a, s] = T(void 0);
|
|
251
|
-
async function l() {
|
|
252
|
-
if (n.debug("conversation.fetchChannel: start"), i(void 0), s(void 0), e)
|
|
253
|
-
try {
|
|
254
|
-
n.debug("conversation.fetchChannel: get channel", e);
|
|
255
|
-
const d = await t.groupChannel.getChannel(e);
|
|
256
|
-
i(d);
|
|
257
|
-
const g = new ut({ onReconnectSucceeded: () => d.refresh() });
|
|
258
|
-
t.addConnectionHandler("sba-refresh", g), n.debug("conversation.fetchChannel: fetched channel", d);
|
|
259
|
-
} catch (d) {
|
|
260
|
-
d instanceof Er && s(d), n.error("conversation.fetchChannel: error", d);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return R(() => {
|
|
264
|
-
l();
|
|
265
|
-
}, [e, t]), {
|
|
266
|
-
channel: o,
|
|
267
|
-
channelFetchError: a,
|
|
268
|
-
fetchChannel: l
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
const no = (e, t) => {
|
|
272
|
-
const n = mn(), [o, i] = T(!1), [a, s] = T(null), [l, d] = T([]), [g, m] = T(null), p = D(!1), h = P(async () => {
|
|
273
|
-
if (!p.current && e.currentUser) {
|
|
274
|
-
p.current = !0, i(!1), s(null), d([]);
|
|
275
|
-
try {
|
|
276
|
-
const x = e.aiAgent.createConversationListQuery(t), v = await x.next();
|
|
277
|
-
d(v), m(x), s(null);
|
|
278
|
-
} catch (x) {
|
|
279
|
-
m(null), s(x);
|
|
280
|
-
} finally {
|
|
281
|
-
i(!0), p.current = !1;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}, [e, t.aiAgentId, t.status, t.limit, t.order, t.reverse]), b = P(async () => {
|
|
285
|
-
g && g.next().then((x) => {
|
|
286
|
-
d((v) => [...v, ...x]);
|
|
287
|
-
}).catch(() => {
|
|
288
|
-
});
|
|
289
|
-
}, [g]);
|
|
290
|
-
return R(() => (e.addConnectionHandler(n, new ut({ onConnected: () => h() })), () => e.removeConnectionHandler(n)), [e, n, h]), R(() => {
|
|
291
|
-
h();
|
|
292
|
-
}, [h]), {
|
|
293
|
-
initialized: o,
|
|
294
|
-
error: a,
|
|
295
|
-
conversations: l,
|
|
296
|
-
loadMore: b
|
|
297
|
-
};
|
|
298
|
-
}, {
|
|
299
|
-
Provider: ro
|
|
300
|
-
} = W("AIAgentConversationList");
|
|
301
|
-
function oo({ children: e }) {
|
|
302
|
-
const { chatSDK: t, aiAgentId: n } = Ze(), o = no(t, {
|
|
303
|
-
aiAgentId: n,
|
|
304
|
-
status: z.CLOSED,
|
|
305
|
-
order: Ar.UPDATED_AT,
|
|
306
|
-
reverse: !0
|
|
307
|
-
}), i = {
|
|
308
|
-
listSource: {
|
|
309
|
-
initialized: o.initialized,
|
|
310
|
-
error: o.error ?? void 0,
|
|
311
|
-
conversations: o.conversations,
|
|
312
|
-
loadMore: () => o.loadMore()
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
return /* @__PURE__ */ r.createElement(ro, { value: i }, e);
|
|
316
|
-
}
|
|
317
|
-
const st = {
|
|
318
|
-
DEFAULT_BOT_MSG_BG: "#eeeeee",
|
|
319
|
-
WHITE: "#ffffff",
|
|
320
|
-
BLACK: "#000000"
|
|
321
|
-
};
|
|
322
|
-
function yn(e) {
|
|
323
|
-
return e.length === 4 ? `#${[...e.slice(1)].map((t) => t + t).join("")}` : e;
|
|
324
|
-
}
|
|
325
|
-
function io(e) {
|
|
326
|
-
const t = yn(e);
|
|
327
|
-
return [
|
|
328
|
-
parseInt(t.slice(1, 3), 16),
|
|
329
|
-
// r
|
|
330
|
-
parseInt(t.slice(3, 5), 16),
|
|
331
|
-
// g
|
|
332
|
-
parseInt(t.slice(5, 7), 16)
|
|
333
|
-
// b
|
|
334
|
-
];
|
|
335
|
-
}
|
|
336
|
-
function so(e) {
|
|
337
|
-
return `#${e.map((t) => t.toString(16).padStart(2, "0")).join("")}`;
|
|
338
|
-
}
|
|
339
|
-
function ao(e, t, n) {
|
|
340
|
-
e /= 255, t /= 255, n /= 255;
|
|
341
|
-
const o = Math.max(e, t, n), i = Math.min(e, t, n), a = o - i;
|
|
342
|
-
let s = 0, l = 0;
|
|
343
|
-
const d = (o + i) / 2;
|
|
344
|
-
return o !== i && (l = d > 0.5 ? a / (2 - o - i) : a / (o + i)), o === e ? s = (t - n) / a + (t < n ? 6 : 0) : o === t ? s = (n - e) / a + 2 : o === n && (s = (e - t) / a + 4), s /= 6, [s, l, d];
|
|
345
|
-
}
|
|
346
|
-
function lo(e, t, n) {
|
|
347
|
-
let o, i, a;
|
|
348
|
-
if (t === 0)
|
|
349
|
-
o = i = a = n;
|
|
350
|
-
else {
|
|
351
|
-
const s = function(m, p, h) {
|
|
352
|
-
return h < 0 && (h += 1), h > 1 && (h -= 1), h < 0.16666666666666666 ? m + (p - m) * 6 * h : h < 0.5 ? p : h < 0.6666666666666666 ? m + (p - m) * (0.6666666666666666 - h) * 6 : m;
|
|
353
|
-
}, l = n < 0.5 ? n * (1 + t) : n + t - n * t, d = 2 * n - l;
|
|
354
|
-
o = s(d, l, e + 1 / 3), i = s(d, l, e), a = s(d, l, e - 1 / 3);
|
|
355
|
-
}
|
|
356
|
-
return [Math.round(o * 255), Math.round(i * 255), Math.round(a * 255)];
|
|
357
|
-
}
|
|
358
|
-
function De(e, t, n) {
|
|
359
|
-
const [o, i, a] = io(e), [s, l, d] = ao(o, i, a), g = Math.max(0, Math.min(1, d * t)), m = Math.max(0, Math.min(1, l * n)), [p, h, b] = lo(s, m, g);
|
|
360
|
-
return so([Math.round(p), Math.round(h), Math.round(b)]);
|
|
361
|
-
}
|
|
362
|
-
function co(e, t = "light") {
|
|
363
|
-
return {
|
|
364
|
-
extraDark: De(e, 0.6, 1.2),
|
|
365
|
-
dark: De(e, 0.85, 1.1),
|
|
366
|
-
main: e,
|
|
367
|
-
light: De(e, t === "dark" ? 1.1 : 1.5, t === "dark" ? 0.95 : 0.9),
|
|
368
|
-
extraLight: De(e, t === "dark" ? 1.2 : 1.75, t === "dark" ? 0.9 : 0.8)
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
function at(e) {
|
|
372
|
-
const t = yn(e), n = 149, o = +`0x${t[1]}${t[2]}`, i = +`0x${t[3]}${t[4]}`, a = +`0x${t[5]}${t[6]}`;
|
|
373
|
-
return o * 0.299 + i * 0.587 + a * 0.114 > n ? st.BLACK : st.WHITE;
|
|
374
|
-
}
|
|
375
|
-
function uo(e, t, n, o, i) {
|
|
376
|
-
return {
|
|
377
|
-
base: {
|
|
378
|
-
primary: t,
|
|
379
|
-
primaryContrastContent: n,
|
|
380
|
-
background: e.background50,
|
|
381
|
-
headerBackground: e.background50,
|
|
382
|
-
modalContentBackground: e.background50
|
|
383
|
-
},
|
|
384
|
-
metadata: {
|
|
385
|
-
errorContent: e.ondark.textHighEmphasis,
|
|
386
|
-
placeholderText: e.onlight.textLowEmphasis
|
|
387
|
-
},
|
|
388
|
-
messageInput: {
|
|
389
|
-
background: e.background100
|
|
390
|
-
},
|
|
391
|
-
messageIncoming: {
|
|
392
|
-
text: i,
|
|
393
|
-
background: o
|
|
394
|
-
},
|
|
395
|
-
messageOutgoing: {
|
|
396
|
-
text: n,
|
|
397
|
-
background: t
|
|
398
|
-
},
|
|
399
|
-
csat: {
|
|
400
|
-
background: e.background100
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
const mo = (e, t, n, o, i) => ({
|
|
405
|
-
base: {
|
|
406
|
-
primary: t,
|
|
407
|
-
primaryContrastContent: n,
|
|
408
|
-
background: e.background600,
|
|
409
|
-
headerBackground: e.background500,
|
|
410
|
-
modalContentBackground: e.background500
|
|
411
|
-
},
|
|
412
|
-
metadata: {
|
|
413
|
-
errorContent: e.ondark.textHighEmphasis,
|
|
414
|
-
placeholderText: e.ondark.textLowEmphasis
|
|
415
|
-
},
|
|
416
|
-
messageInput: {
|
|
417
|
-
background: e.background400
|
|
418
|
-
},
|
|
419
|
-
messageIncoming: {
|
|
420
|
-
text: i,
|
|
421
|
-
background: o
|
|
422
|
-
},
|
|
423
|
-
messageOutgoing: {
|
|
424
|
-
text: n,
|
|
425
|
-
background: t
|
|
426
|
-
},
|
|
427
|
-
csat: {
|
|
428
|
-
background: e.background400
|
|
429
|
-
}
|
|
430
|
-
}), Be = {
|
|
431
|
-
primary: {
|
|
432
|
-
extraDark: "#491389",
|
|
433
|
-
dark: "#6211c8",
|
|
434
|
-
main: "#742ddd",
|
|
435
|
-
light: "#c2a9fa",
|
|
436
|
-
extraLight: "#dbd1ff"
|
|
437
|
-
},
|
|
438
|
-
secondary: {
|
|
439
|
-
extraDark: "#066858",
|
|
440
|
-
dark: "#027d69",
|
|
441
|
-
main: "#259c72",
|
|
442
|
-
light: "#69c085",
|
|
443
|
-
extraLight: "#a8e2ab"
|
|
444
|
-
},
|
|
445
|
-
error: {
|
|
446
|
-
extraDark: "#9d091e",
|
|
447
|
-
dark: "#bf0711",
|
|
448
|
-
main: "#de360b",
|
|
449
|
-
light: "#f66161",
|
|
450
|
-
extraLight: "#fdaaaa"
|
|
451
|
-
},
|
|
452
|
-
information: {
|
|
453
|
-
extraDark: "#241389",
|
|
454
|
-
dark: "#362ca9",
|
|
455
|
-
main: "#4a48cd",
|
|
456
|
-
light: "#a9bbfa",
|
|
457
|
-
extraLight: "#d1dbff"
|
|
458
|
-
},
|
|
459
|
-
background700: "#000000",
|
|
460
|
-
background600: "#161616",
|
|
461
|
-
background500: "#2c2c2c",
|
|
462
|
-
background400: "#393939",
|
|
463
|
-
background300: "#bdbdbd",
|
|
464
|
-
background200: "#e0e0e0",
|
|
465
|
-
background100: "#eeeeee",
|
|
466
|
-
background50: "#ffffff",
|
|
467
|
-
onlight: {
|
|
468
|
-
textHighEmphasis: "rgba(0, 0, 0, 0.88)",
|
|
469
|
-
textMidEmphasis: "rgba(0, 0, 0, 0.5)",
|
|
470
|
-
textLowEmphasis: "rgba(0, 0, 0, 0.38)",
|
|
471
|
-
textDisabled: "rgba(0, 0, 0, 0.12)"
|
|
472
|
-
},
|
|
473
|
-
ondark: {
|
|
474
|
-
textHighEmphasis: "rgba(255, 255, 255, 0.88)",
|
|
475
|
-
textMidEmphasis: "rgba(255, 255, 255, 0.5)",
|
|
476
|
-
textLowEmphasis: "rgba(255, 255, 255, 0.38)",
|
|
477
|
-
textDisabled: "rgba(255, 255, 255, 0.12)"
|
|
478
|
-
},
|
|
479
|
-
overlay: {
|
|
480
|
-
dark: "rgba(0, 0, 0, 0.55)",
|
|
481
|
-
light: "rgba(22, 22, 22, 0.32)"
|
|
482
|
-
}
|
|
483
|
-
}, Qe = {
|
|
484
|
-
h1: { fontSize: 18, fontWeight: 700 },
|
|
485
|
-
h2: { fontSize: 16, fontWeight: 700 },
|
|
486
|
-
subtitle1: { fontSize: 16, fontWeight: 500 },
|
|
487
|
-
subtitle2: { fontSize: 16, fontWeight: 400 },
|
|
488
|
-
body1: { fontSize: 16, fontWeight: 400 },
|
|
489
|
-
body2: { fontSize: 14, fontWeight: 500 },
|
|
490
|
-
body3: { fontSize: 14, fontWeight: 400 },
|
|
491
|
-
button: { fontSize: 14, fontWeight: 700 },
|
|
492
|
-
caption1: { fontSize: 12, fontWeight: 700 },
|
|
493
|
-
caption2: { fontSize: 12, fontWeight: 400 },
|
|
494
|
-
caption3: { fontSize: 11, fontWeight: 700 },
|
|
495
|
-
caption4: { fontSize: 11, fontWeight: 400 }
|
|
496
|
-
};
|
|
497
|
-
function Pt(e) {
|
|
498
|
-
const t = go(e), { colors: n, aiAgentColorVariables: o } = po(e, t), i = fo(e);
|
|
499
|
-
return {
|
|
500
|
-
selectedTheme: e.selectedTheme,
|
|
501
|
-
palette: t,
|
|
502
|
-
colors: n,
|
|
503
|
-
aiAgentColorVariables: o,
|
|
504
|
-
typography: i
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
function go({ selectedTheme: e, palette: t, primary: n }) {
|
|
508
|
-
const o = t != null && t.primary ? t.primary : n ? n === Be.primary.main ? Be.primary : co(n, e) : Be.primary;
|
|
509
|
-
return {
|
|
510
|
-
...Be,
|
|
511
|
-
primary: o,
|
|
512
|
-
...t
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
function po({ selectedTheme: e, primaryContrast: t, botMessageBackground: n, botMessageBackgroundContrast: o }, i) {
|
|
516
|
-
const a = i.primary.main, s = t ?? at(a), l = n ?? st.DEFAULT_BOT_MSG_BG, d = o ?? at(l);
|
|
517
|
-
return {
|
|
518
|
-
colors: (e === "light" ? uo : mo)(
|
|
519
|
-
i,
|
|
520
|
-
a,
|
|
521
|
-
s,
|
|
522
|
-
l,
|
|
523
|
-
d
|
|
524
|
-
),
|
|
525
|
-
aiAgentColorVariables: {
|
|
526
|
-
primary_color: a,
|
|
527
|
-
bot_message_bg_color: l,
|
|
528
|
-
primary_contrast_color: s,
|
|
529
|
-
bot_message_bg_contrast_color: d
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
function ho(e, t, n) {
|
|
534
|
-
const o = { ...e };
|
|
535
|
-
return n.forEach((i) => {
|
|
536
|
-
const a = t[i];
|
|
537
|
-
a != null && (o[i] = a);
|
|
538
|
-
}), o;
|
|
539
|
-
}
|
|
540
|
-
function fo({ typography: e }) {
|
|
541
|
-
if (!e)
|
|
542
|
-
return Qe;
|
|
543
|
-
const t = { ...Qe };
|
|
544
|
-
return Object.keys(e).forEach((n) => {
|
|
545
|
-
const o = e[n];
|
|
546
|
-
if (o && typeof o == "object") {
|
|
547
|
-
const i = Qe[n], a = ["fontSize", "fontWeight", "fontFamily", "lineHeight"];
|
|
548
|
-
t[n] = ho(i, o, a);
|
|
549
|
-
}
|
|
550
|
-
}), t;
|
|
551
|
-
}
|
|
552
|
-
const {
|
|
553
|
-
Provider: bo,
|
|
554
|
-
useContext: Cn
|
|
555
|
-
} = W("AIAgentTheme");
|
|
556
|
-
function xo({ logger: e, palette: t, typography: n, appearance: o, children: i }) {
|
|
557
|
-
const [a, s] = T(
|
|
558
|
-
() => Pt({
|
|
559
|
-
selectedTheme: (o == null ? void 0 : o.theme) ?? "light",
|
|
560
|
-
palette: t,
|
|
561
|
-
typography: n,
|
|
562
|
-
primary: o == null ? void 0 : o.primaryColor,
|
|
563
|
-
botMessageBackground: o == null ? void 0 : o.botMessageBackgroundColor
|
|
564
|
-
})
|
|
565
|
-
), l = P(
|
|
566
|
-
(d, g) => {
|
|
567
|
-
const m = (o == null ? void 0 : o.theme) ?? d, p = g == null ? void 0 : g(m), h = {
|
|
568
|
-
primary: o == null ? void 0 : o.primaryColor,
|
|
569
|
-
primaryContrast: void 0,
|
|
570
|
-
botMessageBackground: o == null ? void 0 : o.botMessageBackgroundColor,
|
|
571
|
-
botMessageBackgroundContrast: void 0
|
|
572
|
-
};
|
|
573
|
-
!h.primary && (p != null && p.primaryColor) && (h.primary = p.primaryColor, h.primaryContrast = p.primaryContrastColor), !h.botMessageBackground && (p != null && p.botMessageBackgroundColor) && (h.botMessageBackground = p.botMessageBackgroundColor, h.botMessageBackgroundContrast = p.botMessageBackgroundContrastColor);
|
|
574
|
-
const b = Pt({ selectedTheme: m, palette: t, typography: n, ...h });
|
|
575
|
-
s(b), e == null || e.info("theme.update:", m);
|
|
576
|
-
},
|
|
577
|
-
[o == null ? void 0 : o.theme, o == null ? void 0 : o.primaryColor, o == null ? void 0 : o.botMessageBackgroundColor, t, n, e]
|
|
578
|
-
);
|
|
579
|
-
return R(() => {
|
|
580
|
-
(o != null && o.theme || o != null && o.primaryColor || o != null && o.botMessageBackgroundColor) && l(a.selectedTheme);
|
|
581
|
-
}, [o == null ? void 0 : o.theme, o == null ? void 0 : o.primaryColor, o == null ? void 0 : o.botMessageBackgroundColor]), /* @__PURE__ */ r.createElement(bo, { value: { theme: a, updateTheme: l } }, i);
|
|
582
|
-
}
|
|
583
|
-
const Tn = (e) => {
|
|
584
|
-
try {
|
|
585
|
-
const t = JSON.parse(e);
|
|
586
|
-
return typeof t == "string" ? JSON.stringify(t).slice(1, -1) : e.trim();
|
|
587
|
-
} catch {
|
|
588
|
-
return JSON.stringify(e).slice(1, -1);
|
|
589
|
-
}
|
|
590
|
-
}, Me = (e) => JSON.parse(e), Ye = (e) => JSON.parse(e);
|
|
591
|
-
function Eo(e, t) {
|
|
592
|
-
const [n, o] = t.split(",").map((i) => i.trim());
|
|
593
|
-
return e === "dark" && o || n;
|
|
594
|
-
}
|
|
595
|
-
function vo(e) {
|
|
596
|
-
const t = {};
|
|
597
|
-
function n(o, i = "") {
|
|
598
|
-
for (const [a, s] of Object.entries(o)) {
|
|
599
|
-
const l = i ? `${i}.${a}` : a;
|
|
600
|
-
s && typeof s == "object" && !Array.isArray(s) ? n(s, l) : t[l] = s;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
return n(e), t;
|
|
604
|
-
}
|
|
605
|
-
function gt({
|
|
606
|
-
template: e,
|
|
607
|
-
variables: t,
|
|
608
|
-
variableKeyPattern: n,
|
|
609
|
-
variableValueTransformer: o
|
|
610
|
-
}) {
|
|
611
|
-
return Object.entries(t).reduce((i, [a, s]) => {
|
|
612
|
-
if (!o && !["number", "boolean", "string"].includes(typeof s))
|
|
613
|
-
throw new Error("If transformer is not provided, value must be a {string, number, or boolean}");
|
|
614
|
-
const l = o ? o(s) : String(s), d = n(a);
|
|
615
|
-
return i.replace(d, Tn(l));
|
|
616
|
-
}, e);
|
|
617
|
-
}
|
|
618
|
-
async function yo({
|
|
619
|
-
template: e,
|
|
620
|
-
variables: t,
|
|
621
|
-
variableKeyPattern: n,
|
|
622
|
-
variableValueTransformer: o
|
|
623
|
-
}) {
|
|
624
|
-
return (await Promise.all(
|
|
625
|
-
Object.entries(t).map(async ([a, s]) => {
|
|
626
|
-
const l = await o(s);
|
|
627
|
-
return { regex: n(a), transformedValue: l };
|
|
628
|
-
})
|
|
629
|
-
)).reduce((a, { regex: s, transformedValue: l }) => a.replace(s, Tn(l)), e);
|
|
630
|
-
}
|
|
631
|
-
const Co = (e) => ({
|
|
632
|
-
setTemplate: (t, n) => e.onSetTemplate(t, n),
|
|
633
|
-
getTemplate: (t) => e.onGetTemplate(t),
|
|
634
|
-
setCachedToken: (t) => e.onSetCachedToken(t),
|
|
635
|
-
getCachedToken: () => e.onGetCachedToken(),
|
|
636
|
-
clear: () => e.onClear()
|
|
637
|
-
}), {
|
|
638
|
-
Provider: To,
|
|
639
|
-
useContext: _n
|
|
640
|
-
} = W("MessageCacheTemplate");
|
|
641
|
-
function _o({ logger: e, storage: t, children: n }) {
|
|
642
|
-
const o = P(
|
|
643
|
-
(s) => {
|
|
644
|
-
var g, m;
|
|
645
|
-
const l = (m = (g = s.appInfo) == null ? void 0 : g.aiAgentInfo) == null ? void 0 : m.templateListToken;
|
|
646
|
-
if (!l) return !1;
|
|
647
|
-
const d = t.getCachedToken();
|
|
648
|
-
return d ? l !== d : !0;
|
|
649
|
-
},
|
|
650
|
-
[t]
|
|
651
|
-
), i = P(
|
|
652
|
-
async (s) => {
|
|
653
|
-
try {
|
|
654
|
-
const { templates: l, token: d } = await s.aiAgent.getMessageTemplates({ limit: 20 });
|
|
655
|
-
for (const { template: g } of l) {
|
|
656
|
-
const { key: m } = Me(g);
|
|
657
|
-
t.setTemplate(m, g);
|
|
658
|
-
}
|
|
659
|
-
t.setCachedToken(d);
|
|
660
|
-
} catch (l) {
|
|
661
|
-
e == null || e.error("messageTemplateContext.syncCachedTemplates: error:", l);
|
|
662
|
-
}
|
|
663
|
-
},
|
|
664
|
-
[t, e]
|
|
665
|
-
), a = P(() => {
|
|
666
|
-
t.clear();
|
|
667
|
-
}, [t]);
|
|
668
|
-
return /* @__PURE__ */ r.createElement(To, { value: { shouldSyncCachedTemplate: o, syncCachedTemplates: i, clearCachedTemplates: a, storage: t } }, n);
|
|
669
|
-
}
|
|
670
|
-
function So(e) {
|
|
671
|
-
let t = "pending", n = e.then((o) => {
|
|
672
|
-
t = "resolved", n = o;
|
|
673
|
-
}).catch((o) => {
|
|
674
|
-
t = "rejected", n = o;
|
|
675
|
-
});
|
|
676
|
-
return {
|
|
677
|
-
get value() {
|
|
678
|
-
if (t === "resolved")
|
|
679
|
-
return n;
|
|
680
|
-
throw n;
|
|
681
|
-
}
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
const {
|
|
685
|
-
Provider: wo,
|
|
686
|
-
useContext: Sn
|
|
687
|
-
} = W("MessageTemplateFetching");
|
|
688
|
-
function ko({ children: e, internalVariables: t }) {
|
|
689
|
-
const n = D({}), o = D({}), [i, a] = T({}), s = P((g, m) => {
|
|
690
|
-
a((p) => ({
|
|
691
|
-
...p,
|
|
692
|
-
[g]: { fetching: !1, error: !1, ...p[g], ...m }
|
|
693
|
-
}));
|
|
694
|
-
}, []), l = P(
|
|
695
|
-
async ({
|
|
696
|
-
onRequestTemplate: g,
|
|
697
|
-
onGetCachedTemplate: m,
|
|
698
|
-
templateKey: p,
|
|
699
|
-
suspense: h = !1
|
|
700
|
-
}) => {
|
|
701
|
-
const b = m(p);
|
|
702
|
-
if (b) return b;
|
|
703
|
-
const x = o.current[p];
|
|
704
|
-
if (x) return x;
|
|
705
|
-
h || s(p, { fetching: !0 });
|
|
706
|
-
const v = g(p).catch((f) => {
|
|
707
|
-
throw h || s(p, { error: !0 }), f;
|
|
708
|
-
}).finally(() => {
|
|
709
|
-
h || s(p, { fetching: !1 }), delete o.current[p];
|
|
710
|
-
});
|
|
711
|
-
return o.current[p] = v, v;
|
|
712
|
-
},
|
|
713
|
-
[s]
|
|
714
|
-
), d = {
|
|
715
|
-
internalVariables: t,
|
|
716
|
-
fetchTemplate: l,
|
|
717
|
-
suspend: (g, m) => {
|
|
718
|
-
if (n.current[g])
|
|
719
|
-
return n.current[g];
|
|
720
|
-
const p = So(m());
|
|
721
|
-
return n.current[g] = p, p;
|
|
722
|
-
},
|
|
723
|
-
getIsFetching: (g) => {
|
|
724
|
-
var m;
|
|
725
|
-
return ((m = i[g]) == null ? void 0 : m.fetching) ?? !1;
|
|
726
|
-
},
|
|
727
|
-
getHasError: (g) => {
|
|
728
|
-
var m;
|
|
729
|
-
return ((m = i[g]) == null ? void 0 : m.error) ?? !1;
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
return /* @__PURE__ */ r.createElement(wo, { value: d }, e);
|
|
733
|
-
}
|
|
734
|
-
const qe = {
|
|
735
|
-
VARIABLE: (e) => new RegExp(`\\{${e}\\}`, "g"),
|
|
736
|
-
VIEW_VARIABLE: (e) => new RegExp(`"{@${e}}"`, "g")
|
|
737
|
-
};
|
|
738
|
-
function oe({ uiTemplateString: e, variables: t = {} }) {
|
|
739
|
-
const n = vo(t);
|
|
740
|
-
return gt({
|
|
741
|
-
template: e,
|
|
742
|
-
variables: n,
|
|
743
|
-
variableKeyPattern: (o) => qe.VARIABLE(o)
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
function ie({
|
|
747
|
-
theme: e,
|
|
748
|
-
uiTemplateString: t,
|
|
749
|
-
colorVariables: n = {}
|
|
750
|
-
}) {
|
|
751
|
-
return gt({
|
|
752
|
-
template: t,
|
|
753
|
-
variables: n,
|
|
754
|
-
variableKeyPattern: (o) => qe.VARIABLE(o),
|
|
755
|
-
variableValueTransformer: (o) => Eo(e, o)
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
function Ao({
|
|
759
|
-
theme: e,
|
|
760
|
-
uiTemplateString: t,
|
|
761
|
-
viewVariables: n = {},
|
|
762
|
-
aiAgentColorVariables: o,
|
|
763
|
-
internalVariables: i,
|
|
764
|
-
onRequestTemplate: a
|
|
765
|
-
}) {
|
|
766
|
-
const l = Object.values(n).flat().map((g) => g.key);
|
|
767
|
-
return [...new Set(l)].some((g) => !a(g)) ? null : gt({
|
|
768
|
-
template: t,
|
|
769
|
-
variables: n,
|
|
770
|
-
variableKeyPattern: (g) => qe.VIEW_VARIABLE(g),
|
|
771
|
-
variableValueTransformer: (g) => {
|
|
772
|
-
const m = g.map(({ key: p, variables: h }) => {
|
|
773
|
-
const b = a(p), { ui_template: x, color_variables: v } = Me(b);
|
|
774
|
-
let f = JSON.stringify(x);
|
|
775
|
-
return f = oe({
|
|
776
|
-
uiTemplateString: f,
|
|
777
|
-
variables: i
|
|
778
|
-
}), f = ie({
|
|
779
|
-
theme: e,
|
|
780
|
-
uiTemplateString: f,
|
|
781
|
-
colorVariables: v
|
|
782
|
-
}), f = ie({
|
|
783
|
-
theme: e,
|
|
784
|
-
uiTemplateString: f,
|
|
785
|
-
colorVariables: o
|
|
786
|
-
}), f = oe({
|
|
787
|
-
uiTemplateString: f,
|
|
788
|
-
variables: h
|
|
789
|
-
}), Ye(f);
|
|
790
|
-
});
|
|
791
|
-
return JSON.stringify(m);
|
|
792
|
-
}
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
async function Io({
|
|
796
|
-
theme: e,
|
|
797
|
-
uiTemplateString: t,
|
|
798
|
-
viewVariables: n = {},
|
|
799
|
-
aiAgentColorVariables: o,
|
|
800
|
-
internalVariables: i,
|
|
801
|
-
onRequestTemplate: a
|
|
802
|
-
}) {
|
|
803
|
-
return yo({
|
|
804
|
-
template: t,
|
|
805
|
-
variables: n,
|
|
806
|
-
variableKeyPattern: (s) => qe.VIEW_VARIABLE(s),
|
|
807
|
-
variableValueTransformer: async (s) => {
|
|
808
|
-
const l = s.map(async ({ key: g, variables: m }) => {
|
|
809
|
-
const p = await a(g), { ui_template: h, color_variables: b } = Me(p);
|
|
810
|
-
let x = JSON.stringify(h);
|
|
811
|
-
return x = oe({
|
|
812
|
-
uiTemplateString: x,
|
|
813
|
-
variables: i
|
|
814
|
-
}), x = ie({
|
|
815
|
-
theme: e,
|
|
816
|
-
uiTemplateString: x,
|
|
817
|
-
colorVariables: b
|
|
818
|
-
}), x = ie({
|
|
819
|
-
theme: e,
|
|
820
|
-
uiTemplateString: x,
|
|
821
|
-
colorVariables: o
|
|
822
|
-
}), x = oe({
|
|
823
|
-
uiTemplateString: x,
|
|
824
|
-
variables: m
|
|
825
|
-
}), Ye(x);
|
|
826
|
-
}), d = await Promise.all(l);
|
|
827
|
-
return JSON.stringify(d);
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
|
-
const $o = ({
|
|
832
|
-
rawTemplate: e,
|
|
833
|
-
aiAgentColorVariables: t,
|
|
834
|
-
internalVariables: n,
|
|
835
|
-
...o
|
|
836
|
-
}) => {
|
|
837
|
-
const { ui_template: i, color_variables: a } = Me(e);
|
|
838
|
-
let s = JSON.stringify(i);
|
|
839
|
-
if (Object.keys(o.viewVariables ?? {}).length > 0) {
|
|
840
|
-
const d = Ao({
|
|
841
|
-
...o,
|
|
842
|
-
uiTemplateString: s,
|
|
843
|
-
aiAgentColorVariables: t,
|
|
844
|
-
internalVariables: n
|
|
845
|
-
});
|
|
846
|
-
if (d === null) return null;
|
|
847
|
-
s = d;
|
|
848
|
-
}
|
|
849
|
-
return s = oe({ ...o, uiTemplateString: s, variables: n }), s = ie({ ...o, uiTemplateString: s, colorVariables: a }), s = ie({ ...o, uiTemplateString: s, colorVariables: t }), s = oe({ ...o, uiTemplateString: s }), Ye(s);
|
|
850
|
-
}, Mo = async ({
|
|
851
|
-
rawTemplate: e,
|
|
852
|
-
aiAgentColorVariables: t,
|
|
853
|
-
internalVariables: n,
|
|
854
|
-
...o
|
|
855
|
-
}) => {
|
|
856
|
-
const { ui_template: i, color_variables: a } = Me(e);
|
|
857
|
-
let s = JSON.stringify(i);
|
|
858
|
-
return Object.keys(o.viewVariables ?? {}).length > 0 && (s = await Io({
|
|
859
|
-
...o,
|
|
860
|
-
uiTemplateString: s,
|
|
861
|
-
aiAgentColorVariables: t,
|
|
862
|
-
internalVariables: n
|
|
863
|
-
})), s = oe({ ...o, uiTemplateString: s, variables: n }), s = ie({ ...o, uiTemplateString: s, colorVariables: a }), s = ie({ ...o, uiTemplateString: s, colorVariables: t }), s = oe({ ...o, uiTemplateString: s }), Ye(s);
|
|
864
|
-
}, Oo = (e) => {
|
|
865
|
-
const { aiAgentColorVariables: t = {} } = e, { internalVariables: n } = Sn();
|
|
866
|
-
return T(() => {
|
|
867
|
-
const o = e.onGetCachedTemplate(e.templateKey);
|
|
868
|
-
return o ? $o({
|
|
869
|
-
...e,
|
|
870
|
-
rawTemplate: o,
|
|
871
|
-
aiAgentColorVariables: t,
|
|
872
|
-
internalVariables: n,
|
|
873
|
-
onRequestTemplate: e.onGetCachedTemplate
|
|
874
|
-
}) : null;
|
|
875
|
-
});
|
|
876
|
-
}, Lo = (e) => {
|
|
877
|
-
const [t] = Oo(e);
|
|
878
|
-
if (t) return t;
|
|
879
|
-
const { aiAgentColorVariables: n = {} } = e, { internalVariables: o, fetchTemplate: i, suspend: a } = Sn();
|
|
880
|
-
return a(e.templateKey, async () => {
|
|
881
|
-
const l = await i({ ...e, suspense: !0 });
|
|
882
|
-
return await Mo({
|
|
883
|
-
...e,
|
|
884
|
-
rawTemplate: l,
|
|
885
|
-
aiAgentColorVariables: n,
|
|
886
|
-
internalVariables: o
|
|
887
|
-
});
|
|
888
|
-
}).value;
|
|
889
|
-
}, Ro = '@import"https://fonts.googleapis.com/css?family=Roboto:400,500,600,700&display=swap";.sb-message-template__border{position:relative}.sb-message-template__border:after{content:"";position:absolute;top:0;bottom:0;left:0;right:0;z-index:1;box-shadow:inset 0 0 0 var(--border-width) var(--border-color);border-radius:var(--border-radius);pointer-events:none}.sb-message-template__action{cursor:pointer}.sb-message-template__parent{font-family:Roboto,serif}.sb-message-template__text{font-family:inherit;font-size:14px;font-weight:400;font-stretch:normal;font-style:normal;letter-spacing:normal;text-align:left}.sb-message-template__text-button{font-family:inherit;background-color:#e0e0e0;text-align:center;padding:10px;border-radius:6px;font-size:14px;font-weight:600;font-stretch:normal;font-style:normal;letter-spacing:normal}.sendbird-theme--light .sb-message-template__text-button{color:#742ddd}.sendbird-theme--dark .sb-message-template__text-button{color:#c2a9fa}.sb-message-template__text-button:hover{opacity:1;box-shadow:#0000001a 0 1px 3px,#0000000f 0 1px 2px}.sb-message-template__text-button,.sb-message-template__image-button{cursor:pointer;border-style:none}.sb-message-template__parent{border-radius:unset;background-color:transparent;overflow:hidden}.sb-message-template__parent *{box-sizing:border-box;line-height:1.3}.sb-message-template__carousel{display:flex;width:100%;box-sizing:border-box;touch-action:pan-y}', Oe = "en", No = /* @__PURE__ */ new Set([
|
|
890
|
-
Oe,
|
|
891
|
-
"ko",
|
|
892
|
-
"es",
|
|
893
|
-
"pt",
|
|
894
|
-
"fr",
|
|
895
|
-
"hi",
|
|
896
|
-
"it",
|
|
897
|
-
"de",
|
|
898
|
-
"tr",
|
|
899
|
-
"ja"
|
|
900
|
-
]), Do = (e, t, n) => {
|
|
901
|
-
const o = e[t];
|
|
902
|
-
return o ? typeof o == "function" ? o() : Promise.resolve(o) : new Promise((i, a) => {
|
|
903
|
-
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
904
|
-
a.bind(
|
|
905
|
-
null,
|
|
906
|
-
new Error(
|
|
907
|
-
"Unknown variable dynamic import: " + t + (t.split("/").length !== n ? ". Note that variables only represent file names one level deep." : "")
|
|
908
|
-
)
|
|
909
|
-
)
|
|
910
|
-
);
|
|
911
|
-
});
|
|
912
|
-
}, Bo = wr, Po = {
|
|
913
|
-
// Channel - Common
|
|
914
|
-
CHANNEL_FROZEN: "Channel frozen",
|
|
915
|
-
PLACE_HOLDER__WRONG: "Something went wrong",
|
|
916
|
-
PLACE_HOLDER__NO_MESSAGES: "No messages",
|
|
917
|
-
UNKNOWN__UNKNOWN_MESSAGE_TYPE: "(Unknown message type)",
|
|
918
|
-
// Channel - Header
|
|
919
|
-
HEADER_BUTTON__AGENT_HANDOFF: "Connect with an agent",
|
|
920
|
-
// Message Input
|
|
921
|
-
MESSAGE_INPUT__PLACE_HOLDER: "Ask a question",
|
|
922
|
-
MESSAGE_INPUT__PLACE_HOLDER__WAIT_AI_AGENT_RESPONSE: "Waiting for the agent’s reply…",
|
|
923
|
-
MESSAGE_INPUT__PLACE_HOLDER__DISABLED: "Chat is unavailable in this channel",
|
|
924
|
-
// Common UI
|
|
925
|
-
BUTTON__CANCEL: "Cancel",
|
|
926
|
-
BUTTON__SAVE: "Save",
|
|
927
|
-
BUTTON__OK: "OK",
|
|
928
|
-
NO_NAME: "(No name)",
|
|
929
|
-
RETRY: "Retry",
|
|
930
|
-
// Date format
|
|
931
|
-
DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR: "MMMM dd, yyyy",
|
|
932
|
-
DATE_FORMAT__MESSAGE_TIMESTAMP: "p",
|
|
933
|
-
// File Upload
|
|
934
|
-
FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT: "You can't upload more than one image",
|
|
935
|
-
FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT: "The maximum size per file is %d MB.",
|
|
936
|
-
// File Viewer
|
|
937
|
-
FILE_VIEWER__UNSUPPORT: "Unsupported message",
|
|
938
|
-
// CSAT
|
|
939
|
-
CSAT_TITLE_UNSUBMITTED: "Your feedback matters to us",
|
|
940
|
-
CSAT_TITLE_SUBMITTED: "Successfully submitted!",
|
|
941
|
-
CSAT_CRE_TITLE: "Was your issue resolved?",
|
|
942
|
-
CSAT_CRE_SOLVED: "Yes, thank you! 👍",
|
|
943
|
-
CSAT_CRE_NOT_SOLVED: "No, that didn’t help.",
|
|
944
|
-
CSAT_REASON_PLACEHOLDER: "Share your feedback",
|
|
945
|
-
CSAT_RATING_TITLE: "How would you rate your experience?",
|
|
946
|
-
CSAT5_RATING_SCORE_1: "Terrible",
|
|
947
|
-
CSAT5_RATING_SCORE_2: "Bad",
|
|
948
|
-
CSAT5_RATING_SCORE_3: "Okay",
|
|
949
|
-
CSAT5_RATING_SCORE_4: "Good",
|
|
950
|
-
CSAT5_RATING_SCORE_5: "Great",
|
|
951
|
-
CSAT_SUBMIT_LABEL: "Submit",
|
|
952
|
-
CSAT_SUBMISSION_EXPIRED: "We’re sorry, the survey period has ended.",
|
|
953
|
-
POWERED_BY: "Powered by",
|
|
954
|
-
// Conversation list
|
|
955
|
-
CONVERSATION_CLOSED_FOOTER_LABEL: "Your conversation has ended",
|
|
956
|
-
START_NEW_CONVERSATION: "💬 Start a new conversation",
|
|
957
|
-
RETURN_TO_CONVERSATION: "💬 Return to conversation",
|
|
958
|
-
CONVERSATION_LIST__HEADER_TITLE: "Conversation history",
|
|
959
|
-
CONVERSATION_LIST__TOPICS_FALLBACK: "No category",
|
|
960
|
-
CONVERSATION_LIST__NO_CONVERSATIONS: "No conversations yet",
|
|
961
|
-
DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE: "MM/dd/yyyy",
|
|
962
|
-
DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION: "h:mma"
|
|
963
|
-
}, pt = { language: "en", dateLocale: Bo, stringSet: Po }, Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
964
|
-
__proto__: null,
|
|
965
|
-
default: pt
|
|
966
|
-
}, Symbol.toStringTag, { value: "Module" })), We = /* @__PURE__ */ new Map([[Oe, pt]]);
|
|
967
|
-
async function Ho(e) {
|
|
968
|
-
if (We.has(e))
|
|
969
|
-
return We.get(e);
|
|
970
|
-
const t = No.has(e) ? e : Oe;
|
|
971
|
-
try {
|
|
972
|
-
const { default: n } = await Do(/* @__PURE__ */ Object.assign({ "./languages/de.ts": () => import("./DvjrAXLD.js"), "./languages/en.ts": () => Promise.resolve().then(() => Fo), "./languages/es.ts": () => import("./zI14HLvP.js"), "./languages/fr.ts": () => import("./B9V0T5ZP.js"), "./languages/hi.ts": () => import("./YRQ0vk5Q.js"), "./languages/it.ts": () => import("./BQWJPfGp.js"), "./languages/ja.ts": () => import("./sl-YrKkN.js"), "./languages/ko.ts": () => import("./B8c_rqvH.js"), "./languages/pt.ts": () => import("./BSz49qaD.js"), "./languages/tr.ts": () => import("./D_eZyIAR.js") }), `./languages/${t}.ts`, 3);
|
|
973
|
-
return We.set(e, n), n;
|
|
974
|
-
} catch {
|
|
975
|
-
return pt;
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
const {
|
|
979
|
-
Provider: Uo,
|
|
980
|
-
useContext: M
|
|
981
|
-
} = W("Localization");
|
|
982
|
-
function zo(e) {
|
|
983
|
-
var t;
|
|
984
|
-
return ((t = e.split("-")) == null ? void 0 : t[0]) ?? Oe;
|
|
985
|
-
}
|
|
986
|
-
function Wo({
|
|
987
|
-
language: e = navigator.language,
|
|
988
|
-
logger: t,
|
|
989
|
-
stringSet: n,
|
|
990
|
-
children: o
|
|
991
|
-
}) {
|
|
992
|
-
const [i, a] = T(We.get(Oe));
|
|
993
|
-
return R(() => {
|
|
994
|
-
const s = zo(e);
|
|
995
|
-
i.language !== s && (t == null || t.debug("localization.useEffect: update language", `${i.language} -> ${s}`), Ho(s).then(a));
|
|
996
|
-
}, [e]), /* @__PURE__ */ r.createElement(
|
|
997
|
-
Uo,
|
|
998
|
-
{
|
|
999
|
-
value: {
|
|
1000
|
-
language: i.language,
|
|
1001
|
-
stringSet: { ...i.stringSet, ...n },
|
|
1002
|
-
dateLocale: i.dateLocale,
|
|
1003
|
-
format: (s, l, d) => hn(s, l, { locale: i.dateLocale, ...d })
|
|
1004
|
-
}
|
|
1005
|
-
},
|
|
1006
|
-
o
|
|
1007
|
-
);
|
|
1008
|
-
}
|
|
1009
|
-
const Ve = "data-sb-agent-theme", Ft = (e) => (t, ...n) => {
|
|
1010
|
-
let o = "";
|
|
1011
|
-
return t.forEach((i, a) => {
|
|
1012
|
-
o += i + (n[a] ?? "");
|
|
1013
|
-
}), `[${Ve}='${e}'] & { ${o} }`;
|
|
1014
|
-
}, B = {
|
|
1015
|
-
light: Ft("light"),
|
|
1016
|
-
dark: Ft("dark")
|
|
1017
|
-
}, Vo = k(({ theme: e }) => {
|
|
1018
|
-
const { palette: t } = e;
|
|
1019
|
-
return `
|
|
1020
|
-
:root,
|
|
1021
|
-
:host {
|
|
1022
|
-
--sendbird-primary-extra-dark: ${t.primary.extraDark};
|
|
1023
|
-
--sendbird-primary-dark: ${t.primary.dark};
|
|
1024
|
-
--sendbird-primary-main: ${t.primary.main};
|
|
1025
|
-
--sendbird-primary-light: ${t.primary.light};
|
|
1026
|
-
--sendbird-primary-extra-light: ${t.primary.extraLight};
|
|
1027
|
-
|
|
1028
|
-
--sendbird-secondary-extra-dark: ${t.secondary.extraDark};
|
|
1029
|
-
--sendbird-secondary-dark: ${t.secondary.dark};
|
|
1030
|
-
--sendbird-secondary-main: ${t.secondary.main};
|
|
1031
|
-
--sendbird-secondary-light: ${t.secondary.light};
|
|
1032
|
-
--sendbird-secondary-extra-light: ${t.secondary.extraLight};
|
|
1033
|
-
|
|
1034
|
-
--sendbird-information-extra-dark: ${t.information.extraDark};
|
|
1035
|
-
--sendbird-information-dark: ${t.information.dark};
|
|
1036
|
-
--sendbird-information-main: ${t.information.main};
|
|
1037
|
-
--sendbird-information-light: ${t.information.light};
|
|
1038
|
-
--sendbird-information-extra-light: ${t.information.extraLight};
|
|
1039
|
-
|
|
1040
|
-
--sendbird-error-extra-dark: ${t.error.extraDark};
|
|
1041
|
-
--sendbird-error-dark: ${t.error.dark};
|
|
1042
|
-
--sendbird-error-main: ${t.error.main};
|
|
1043
|
-
--sendbird-error-light: ${t.error.light};
|
|
1044
|
-
--sendbird-error-extra-light: ${t.error.extraLight};
|
|
1045
|
-
|
|
1046
|
-
--sendbird-background-700: ${t.background700};
|
|
1047
|
-
--sendbird-background-600: ${t.background600};
|
|
1048
|
-
--sendbird-background-500: ${t.background500};
|
|
1049
|
-
--sendbird-background-400: ${t.background400};
|
|
1050
|
-
--sendbird-background-300: ${t.background300};
|
|
1051
|
-
--sendbird-background-200: ${t.background200};
|
|
1052
|
-
--sendbird-background-100: ${t.background100};
|
|
1053
|
-
--sendbird-background-50: ${t.background50};
|
|
1054
|
-
|
|
1055
|
-
--sendbird-onlight-text-high-emphasis: ${t.onlight.textHighEmphasis};
|
|
1056
|
-
--sendbird-onlight-text-mid-emphasis: ${t.onlight.textMidEmphasis};
|
|
1057
|
-
--sendbird-onlight-text-low-emphasis: ${t.onlight.textLowEmphasis};
|
|
1058
|
-
--sendbird-onlight-text-disabled: ${t.onlight.textDisabled};
|
|
1059
|
-
|
|
1060
|
-
--sendbird-ondark-text-high-emphasis: ${t.ondark.textHighEmphasis};
|
|
1061
|
-
--sendbird-ondark-text-mid-emphasis: ${t.ondark.textMidEmphasis};
|
|
1062
|
-
--sendbird-ondark-text-low-emphasis: ${t.ondark.textLowEmphasis};
|
|
1063
|
-
--sendbird-ondark-text-disabled: ${t.ondark.textDisabled};
|
|
1064
|
-
|
|
1065
|
-
--sendbird-overlay-dark: ${t.overlay.dark};
|
|
1066
|
-
--sendbird-overlay-light: ${t.overlay.light};
|
|
1067
|
-
}
|
|
1068
|
-
`;
|
|
1069
|
-
}), Go = k`[${Ve}='light'] &{--sb-text-high-emphasis:var(--sendbird-onlight-text-high-emphasis);--sb-text-mid-emphasis:var(--sendbird-onlight-text-mid-emphasis);--sb-text-low-emphasis:var(--sendbird-onlight-text-low-emphasis);--sb-text-disabled:var(--sendbird-onlight-text-disabled);--sb-text-high-emphasis-inverse:var(--sendbird-ondark-text-high-emphasis);--sb-text-mid-emphasis-inverse:var(--sendbird-ondark-text-mid-emphasis);--sb-text-low-emphasis-inverse:var(--sendbird-ondark-text-low-emphasis);--sb-text-disabled-inverse:var(--sendbird-ondark-text-disabled);--sb-bg-50-600:var(--sendbird-background-50);--sb-bg-100-500:var(--sendbird-background-100);--sb-bg-200-400:var(--sendbird-background-200);--sb-primary:var(--sendbird-primary-main);--sb-secondary:var(--sendbird-secondary-main);--sb-error:var(--sendbird-error-main);--sb-information:var(--sendbird-information-light);}[${Ve}='dark'] &{--sb-text-high-emphasis:var(--sendbird-ondark-text-high-emphasis);--sb-text-mid-emphasis:var(--sendbird-ondark-text-mid-emphasis);--sb-text-low-emphasis:var(--sendbird-ondark-text-low-emphasis);--sb-text-disabled:var(--sendbird-ondark-text-disabled);--sb-text-high-emphasis-inverse:var(--sendbird-onlight-text-high-emphasis);--sb-text-mid-emphasis-inverse:var(--sendbird-onlight-text-mid-emphasis);--sb-text-low-emphasis-inverse:var(--sendbird-onlight-text-low-emphasis);--sb-text-disabled-inverse:var(--sendbird-onlight-text-disabled);--sb-bg-50-600:var(--sendbird-background-600);--sb-bg-100-500:var(--sendbird-background-500);--sb-bg-200-400:var(--sendbird-background-400);--sb-primary:var(--sendbird-primary-light);--sb-secondary:var(--sendbird-secondary-light);--sb-error:var(--sendbird-error-light);--sb-information:var(--sendbird-information-light);}`, u = {
|
|
1070
|
-
color: {
|
|
1071
|
-
primary: {
|
|
1072
|
-
dark: "var(--sendbird-primary-dark)",
|
|
1073
|
-
main: "var(--sendbird-primary-main)"
|
|
1074
|
-
},
|
|
1075
|
-
error: {
|
|
1076
|
-
extraDark: "var(--sendbird-error-extra-dark)",
|
|
1077
|
-
dark: "var(--sendbird-error-dark)"
|
|
1078
|
-
},
|
|
1079
|
-
information: {
|
|
1080
|
-
main: "var(--sendbird-information-main)",
|
|
1081
|
-
light: "var(--sendbird-information-light)"
|
|
1082
|
-
},
|
|
1083
|
-
background700: "var(--sendbird-background-700)",
|
|
1084
|
-
background500: "var(--sendbird-background-500)",
|
|
1085
|
-
background400: "var(--sendbird-background-400)",
|
|
1086
|
-
background200: "var(--sendbird-background-200)",
|
|
1087
|
-
background100: "var(--sendbird-background-100)",
|
|
1088
|
-
background50: "var(--sendbird-background-50)",
|
|
1089
|
-
ondark: {
|
|
1090
|
-
textMidEmphasis: "var(--sendbird-ondark-text-mid-emphasis)",
|
|
1091
|
-
textLowEmphasis: "var(--sendbird-ondark-text-low-emphasis)",
|
|
1092
|
-
textDisabled: "var(--sendbird-ondark-text-disabled)"
|
|
1093
|
-
},
|
|
1094
|
-
overlay: {
|
|
1095
|
-
dark: "var(--sendbird-overlay-dark)"
|
|
1096
|
-
}
|
|
1097
|
-
},
|
|
1098
|
-
themedColor: {
|
|
1099
|
-
textHighEmphasis: "var(--sb-text-high-emphasis)",
|
|
1100
|
-
textMidEmphasis: "var(--sb-text-mid-emphasis)",
|
|
1101
|
-
textLowEmphasis: "var(--sb-text-low-emphasis)",
|
|
1102
|
-
textDisabled: "var(--sb-text-disabled)",
|
|
1103
|
-
textHighEmphasisInverse: "var(--sb-text-high-emphasis-inverse)",
|
|
1104
|
-
bg_50_600: "var(--sb-bg-50-600)",
|
|
1105
|
-
bg_100_500: "var(--sb-bg-100-500)",
|
|
1106
|
-
bg_200_400: "var(--sb-bg-200-400)",
|
|
1107
|
-
error: "var(--sb-error)"
|
|
1108
|
-
}
|
|
1109
|
-
}, {
|
|
1110
|
-
Provider: jo,
|
|
1111
|
-
useContext: Ko
|
|
1112
|
-
} = W("AIAgentTheme");
|
|
1113
|
-
function Zo(e) {
|
|
1114
|
-
const { theme: t, appearance: n, logger: o } = e;
|
|
1115
|
-
return /* @__PURE__ */ r.createElement(
|
|
1116
|
-
xo,
|
|
1117
|
-
{
|
|
1118
|
-
appearance: n,
|
|
1119
|
-
palette: t == null ? void 0 : t.palette,
|
|
1120
|
-
typography: t == null ? void 0 : t.typography,
|
|
1121
|
-
logger: o
|
|
1122
|
-
},
|
|
1123
|
-
/* @__PURE__ */ r.createElement(Yo, { ...e })
|
|
1124
|
-
);
|
|
1125
|
-
}
|
|
1126
|
-
function Yo({ rootElement: e = document.body, children: t }) {
|
|
1127
|
-
const { theme: n, updateTheme: o } = Cn();
|
|
1128
|
-
return ge(() => {
|
|
1129
|
-
e.setAttribute(Ve, n.selectedTheme);
|
|
1130
|
-
}, [e, n.selectedTheme]), /* @__PURE__ */ r.createElement(Cr, { theme: n }, /* @__PURE__ */ r.createElement(jo, { value: { theme: n, updateTheme: o } }, t));
|
|
1131
|
-
}
|
|
1132
|
-
function pe(e, t) {
|
|
1133
|
-
const n = e.getRootNode({ composed: t });
|
|
1134
|
-
return n instanceof ShadowRoot || n instanceof Document ? n : document;
|
|
1135
|
-
}
|
|
1136
|
-
const qo = (e, t) => {
|
|
1137
|
-
R(() => {
|
|
1138
|
-
const n = pe(t) instanceof ShadowRoot, o = pe(t, !0);
|
|
1139
|
-
if (!(n ? t : o).querySelector(`link[href*='${e}']`)) {
|
|
1140
|
-
const a = o.createElement("link");
|
|
1141
|
-
a.rel = "stylesheet", a.href = e, (n ? t : o.head).appendChild(a);
|
|
1142
|
-
}
|
|
1143
|
-
}, [e, t]);
|
|
1144
|
-
}, Jo = (e, t = document.body) => {
|
|
1145
|
-
R(() => {
|
|
1146
|
-
const n = pe(t), i = n instanceof ShadowRoot ? t : n.head;
|
|
1147
|
-
if (!i) return;
|
|
1148
|
-
const a = `sba-${btoa(e).slice(0, 10)}`;
|
|
1149
|
-
let s = i.querySelector(`style#${a}`);
|
|
1150
|
-
s ? s.textContent !== e && (s.textContent = e) : (s = i.ownerDocument.createElement("style"), s.id = a, s.textContent = e, i.appendChild(s));
|
|
1151
|
-
}, [e, t]);
|
|
1152
|
-
}, ht = /iPad|iPhone|iPod/.test(navigator.userAgent), Xo = /Android/.test(navigator.userAgent), Le = (e) => ht || Xo, Z = "sb-agent", X = {
|
|
1153
|
-
ENTRY: `${Z}-entry`,
|
|
1154
|
-
MODAL_ROOT: `${Z}-modal-root`,
|
|
1155
|
-
WINDOW: `${Z}-window`,
|
|
1156
|
-
LAUNCHER: `${Z}-launcher`
|
|
1157
|
-
}, Pe = 2147483647, he = {
|
|
1158
|
-
MODAL: Pe - 1,
|
|
1159
|
-
// FIXME: need to cover the case where the tooltip is on the top of the modal
|
|
1160
|
-
TOOLTIP: Pe - 2,
|
|
1161
|
-
WINDOW: Pe - 3,
|
|
1162
|
-
LAUNCHER: Pe - 4
|
|
1163
|
-
}, wn = {
|
|
1164
|
-
SESSION: `@${Z}-session`,
|
|
1165
|
-
USER_DATA: `@${Z}-udata`
|
|
1166
|
-
}, kn = {
|
|
1167
|
-
DEFAULT_PRIMARY: "#742ddd",
|
|
1168
|
-
WHITE: "#ffffff"
|
|
1169
|
-
}, An = 36, Qo = 100, ei = 25 * 1024 * 1024, In = ["application/pdf", "image/jpeg", "image/jpg", "image/png"], ft = "noopener noreferrer nofollow", Fe = {}, q = {
|
|
1170
|
-
getItem: (e) => {
|
|
1171
|
-
try {
|
|
1172
|
-
return localStorage.getItem(e);
|
|
1173
|
-
} catch {
|
|
1174
|
-
return Fe[e] ?? null;
|
|
1175
|
-
}
|
|
1176
|
-
},
|
|
1177
|
-
setItem: (e, t) => {
|
|
1178
|
-
try {
|
|
1179
|
-
localStorage.setItem(e, t);
|
|
1180
|
-
} catch {
|
|
1181
|
-
Fe[e] = t;
|
|
1182
|
-
}
|
|
1183
|
-
},
|
|
1184
|
-
deleteItem: (e) => {
|
|
1185
|
-
try {
|
|
1186
|
-
localStorage.removeItem(e);
|
|
1187
|
-
} catch {
|
|
1188
|
-
delete Fe[e];
|
|
1189
|
-
}
|
|
1190
|
-
},
|
|
1191
|
-
getKeys: (e) => {
|
|
1192
|
-
try {
|
|
1193
|
-
const t = [];
|
|
1194
|
-
for (let n = 0; n < localStorage.length; n++) {
|
|
1195
|
-
const o = localStorage.key(n);
|
|
1196
|
-
o && o.startsWith(e) && t.push(o);
|
|
1197
|
-
}
|
|
1198
|
-
return t;
|
|
1199
|
-
} catch {
|
|
1200
|
-
return Object.keys(Fe).filter((t) => t.startsWith(e));
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
};
|
|
1204
|
-
function $n(e) {
|
|
1205
|
-
const { keyGenerator: t, keyParamsValidator: n } = e;
|
|
1206
|
-
function o(s) {
|
|
1207
|
-
try {
|
|
1208
|
-
n && n(s);
|
|
1209
|
-
const l = t(s), d = q.getItem(l);
|
|
1210
|
-
return d ? JSON.parse(d) : null;
|
|
1211
|
-
} catch {
|
|
1212
|
-
return null;
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
function i(s, l) {
|
|
1216
|
-
try {
|
|
1217
|
-
n && n(s);
|
|
1218
|
-
const d = t(s), g = JSON.stringify(l);
|
|
1219
|
-
q.setItem(d, g);
|
|
1220
|
-
} catch {
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
function a(s) {
|
|
1224
|
-
try {
|
|
1225
|
-
n && n(s);
|
|
1226
|
-
const l = t(s);
|
|
1227
|
-
q.deleteItem(l);
|
|
1228
|
-
} catch {
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
return { get: o, set: i, clear: a };
|
|
1232
|
-
}
|
|
1233
|
-
const et = $n({
|
|
1234
|
-
keyGenerator: ({ appId: e, aiAgentId: t, userId: n }) => {
|
|
1235
|
-
const o = ti(`${e}/${t}/${n}`);
|
|
1236
|
-
return `${wn.USER_DATA}/${o}`;
|
|
1237
|
-
},
|
|
1238
|
-
keyParamsValidator: ({ appId: e, aiAgentId: t, userId: n }) => {
|
|
1239
|
-
if (!e || !t || !n)
|
|
1240
|
-
throw new Error("Invalid parameters for user data cache");
|
|
1241
|
-
}
|
|
1242
|
-
});
|
|
1243
|
-
function ti(e) {
|
|
1244
|
-
let t = 0;
|
|
1245
|
-
for (let n = 0; n < e.length; n++)
|
|
1246
|
-
t = (t << 5) - t + e.charCodeAt(n), t |= 0;
|
|
1247
|
-
return t.toString(16);
|
|
1248
|
-
}
|
|
1249
|
-
const tt = $n({
|
|
1250
|
-
keyGenerator: ({ appId: e, aiAgentId: t }) => `${wn.SESSION}/${e}/${t}`
|
|
1251
|
-
}), {
|
|
1252
|
-
Provider: ni,
|
|
1253
|
-
Consumer: Mn,
|
|
1254
|
-
useContext: N
|
|
1255
|
-
} = W("Agent");
|
|
1256
|
-
function ri({
|
|
1257
|
-
children: e,
|
|
1258
|
-
state: t,
|
|
1259
|
-
enableCloseConversationButton: n = !1,
|
|
1260
|
-
enableExpandButton: o = !0,
|
|
1261
|
-
enableAutoDisconnectInLauncher: i = !0,
|
|
1262
|
-
...a
|
|
1263
|
-
}) {
|
|
1264
|
-
const s = Ze(), [l, d] = T(!1), [g, m] = T(!1), p = {
|
|
1265
|
-
opened: (t == null ? void 0 : t.opened) ?? l,
|
|
1266
|
-
setOpened: (t == null ? void 0 : t.setOpened) ?? d,
|
|
1267
|
-
expanded: (t == null ? void 0 : t.expanded) ?? g,
|
|
1268
|
-
setExpanded: (t == null ? void 0 : t.setExpanded) ?? m
|
|
1269
|
-
};
|
|
1270
|
-
return /* @__PURE__ */ r.createElement(
|
|
1271
|
-
ni,
|
|
1272
|
-
{
|
|
1273
|
-
value: {
|
|
1274
|
-
...a,
|
|
1275
|
-
...s,
|
|
1276
|
-
state: p,
|
|
1277
|
-
enableCloseConversationButton: n,
|
|
1278
|
-
enableExpandButton: o,
|
|
1279
|
-
enableAutoDisconnectInLauncher: i
|
|
1280
|
-
}
|
|
1281
|
-
},
|
|
1282
|
-
e
|
|
1283
|
-
);
|
|
1284
|
-
}
|
|
1285
|
-
function oi() {
|
|
1286
|
-
const { chatSDK: e, logger: t } = N(), { shouldSyncCachedTemplate: n, syncCachedTemplates: o, clearCachedTemplates: i } = _n(), a = P(
|
|
1287
|
-
async (l, d) => {
|
|
1288
|
-
t.debug("authManager.authenticate: session:", l.userId), d && e.setSessionHandler(new vr(d)), await e.connect(l.userId, l.authToken), t.debug("authManager.authenticate: user:", e.currentUser), n(e) && await o(e);
|
|
1289
|
-
},
|
|
1290
|
-
[e, t, n, o]
|
|
1291
|
-
), s = P(async () => {
|
|
1292
|
-
t.debug("authManager.deauthenticate: disconnect"), await e.disconnect(), i();
|
|
1293
|
-
}, [e, t, i]);
|
|
1294
|
-
return {
|
|
1295
|
-
authenticate: a,
|
|
1296
|
-
deauthenticate: s
|
|
1297
|
-
};
|
|
1298
|
-
}
|
|
1299
|
-
const ii = 24 * 60 * 60 * 1e3, {
|
|
1300
|
-
Provider: si,
|
|
1301
|
-
useContext: F
|
|
1302
|
-
} = W("MessengerSession");
|
|
1303
|
-
function ai({
|
|
1304
|
-
userSessionInfo: e,
|
|
1305
|
-
children: t
|
|
1306
|
-
}) {
|
|
1307
|
-
const { appId: n, aiAgentId: o, chatSDK: i, agentPreviewConfigs: a, state: s, logger: l, language: d, countryCode: g, context: m, handlers: p } = N(), { updateTheme: h } = Cn(), { authenticate: b, deauthenticate: x } = oi(), [v, f] = T(
|
|
1308
|
-
void 0
|
|
1309
|
-
), [y, _] = T(void 0), [w, O] = T(null), [ee, H] = T(null), [le, _e] = T(null), E = a == null ? void 0 : a.forceCreateChannel;
|
|
1310
|
-
function U() {
|
|
1311
|
-
if (e) {
|
|
1312
|
-
l.debug("messengerSession.initialize: manual session info detected");
|
|
1313
|
-
const A = ["userId", "authToken", "sessionHandler"].filter((L) => !(L in e));
|
|
1314
|
-
return A.length > 0 && l.error(
|
|
1315
|
-
`messengerSession.initialize: missing required keys in userSessionInfo: ${A.join(", ")}`
|
|
1316
|
-
), e;
|
|
1317
|
-
}
|
|
1318
|
-
const I = tt.get({ appId: n, aiAgentId: o });
|
|
1319
|
-
return I ? I.expireAt - ii <= Date.now() ? (l.debug("messengerSession.initialize: auto session expired, clear cache"), tt.clear({ appId: n, aiAgentId: o }), et.clear({ appId: n, aiAgentId: o, userId: I.userId }), null) : (l.debug("messengerSession.initialize: auto session info detected"), I) : null;
|
|
1320
|
-
}
|
|
1321
|
-
const te = P(
|
|
1322
|
-
(I, A) => {
|
|
1323
|
-
et.set({ appId: n, aiAgentId: o, userId: I }, { knownActiveChannelUrl: A });
|
|
1324
|
-
},
|
|
1325
|
-
[n, o]
|
|
1326
|
-
), G = P(
|
|
1327
|
-
(I) => {
|
|
1328
|
-
const A = et.get({ appId: n, aiAgentId: o, userId: I });
|
|
1329
|
-
return A == null ? void 0 : A.knownActiveChannelUrl;
|
|
1330
|
-
},
|
|
1331
|
-
[n, o]
|
|
1332
|
-
), Xe = P(async () => {
|
|
1333
|
-
if (w) {
|
|
1334
|
-
l.debug("messengerSession.refreshActiveChannel: try to refresh active channel"), f(void 0);
|
|
1335
|
-
const I = await i.aiAgent.requestMessengerSettings({
|
|
1336
|
-
aiAgentId: o,
|
|
1337
|
-
userId: w.userId,
|
|
1338
|
-
language: d,
|
|
1339
|
-
country: g,
|
|
1340
|
-
context: m,
|
|
1341
|
-
forceCreateChannel: E,
|
|
1342
|
-
knownActiveChannelUrl: G(w.userId)
|
|
1343
|
-
});
|
|
1344
|
-
return te(w.userId, I.active_channel.channel_url), f({ url: I.active_channel.channel_url, status: z.OPEN }), l.info(
|
|
1345
|
-
"messengerSession.refreshActiveChannel: refreshed active channel",
|
|
1346
|
-
I.active_channel.channel_url
|
|
1347
|
-
), I.active_channel.channel_url;
|
|
1348
|
-
} else
|
|
1349
|
-
throw l.error("messengerSession.refreshActiveChannel: userSession is not ready"), new Error("userSession is not ready");
|
|
1350
|
-
}, [
|
|
1351
|
-
i,
|
|
1352
|
-
n,
|
|
1353
|
-
o,
|
|
1354
|
-
w == null ? void 0 : w.userId,
|
|
1355
|
-
d,
|
|
1356
|
-
g,
|
|
1357
|
-
m,
|
|
1358
|
-
E,
|
|
1359
|
-
G,
|
|
1360
|
-
te
|
|
1361
|
-
]);
|
|
1362
|
-
return fn(i, {
|
|
1363
|
-
onChannelChanged: (I) => {
|
|
1364
|
-
var A;
|
|
1365
|
-
I.isGroupChannel() && I.url === (v == null ? void 0 : v.url) && (l.info("messengerSession.channelChanged: channel.conversation", I.conversation), f({ url: I.url, status: ((A = I.conversation) == null ? void 0 : A.status) ?? z.OPEN }));
|
|
1366
|
-
},
|
|
1367
|
-
async onUserJoined(I, A) {
|
|
1368
|
-
var j, fe;
|
|
1369
|
-
if (I.conversation && I.conversation.type === Ir.PROACTIVE && A.userId === ((j = i.currentUser) == null ? void 0 : j.userId)) {
|
|
1370
|
-
l.info("messengerSession.onUserJoined: proactive channel joined", I.url);
|
|
1371
|
-
const Se = ((fe = I.conversation) == null ? void 0 : fe.status) ?? z.OPEN;
|
|
1372
|
-
f({ url: I.url, status: Se }), s.setOpened(!0), li({
|
|
1373
|
-
sound: document.hidden || !s.opened
|
|
1374
|
-
});
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
}), R(() => {
|
|
1378
|
-
async function I() {
|
|
1379
|
-
l.debug("messengerSession.initialize: start");
|
|
1380
|
-
const A = U(), L = await i.aiAgent.requestMessengerSettings({
|
|
1381
|
-
aiAgentId: o,
|
|
1382
|
-
userId: A == null ? void 0 : A.userId,
|
|
1383
|
-
language: d,
|
|
1384
|
-
country: g,
|
|
1385
|
-
context: m,
|
|
1386
|
-
forceCreateChannel: E,
|
|
1387
|
-
knownActiveChannelUrl: G(A == null ? void 0 : A.userId)
|
|
1388
|
-
});
|
|
1389
|
-
l.debug("messengerSession.initialize: messenger settings response", L);
|
|
1390
|
-
let j = null;
|
|
1391
|
-
if (L.auto_created_user) {
|
|
1392
|
-
const { user_id: K, session_token: ne, expire_at: we } = L.auto_created_user;
|
|
1393
|
-
tt.set({ appId: n, aiAgentId: o }, { userId: K, authToken: ne, expireAt: we }), j = { userId: K, authToken: ne };
|
|
1394
|
-
} else
|
|
1395
|
-
j = {
|
|
1396
|
-
userId: (A == null ? void 0 : A.userId) ?? "",
|
|
1397
|
-
authToken: (A == null ? void 0 : A.authToken) ?? ""
|
|
1398
|
-
};
|
|
1399
|
-
te(j.userId, L.active_channel.channel_url);
|
|
1400
|
-
function fe() {
|
|
1401
|
-
const K = L.appearance.selected_theme;
|
|
1402
|
-
h(K, (we) => {
|
|
1403
|
-
const ce = L.appearance.themes[we];
|
|
1404
|
-
return {
|
|
1405
|
-
primaryColor: ce.primary_color,
|
|
1406
|
-
botMessageBackgroundColor: ce.bot_message_bg_color,
|
|
1407
|
-
primaryContrastColor: ce.primary_contrast_color,
|
|
1408
|
-
botMessageBackgroundContrastColor: ce.bot_message_bg_contrast_color
|
|
1409
|
-
};
|
|
1410
|
-
}), _(void 0), O(j), H({
|
|
1411
|
-
userId: L.bot.bot_userid,
|
|
1412
|
-
profileUrl: L.bot.bot_profile_url,
|
|
1413
|
-
nickname: L.bot.bot_nickname,
|
|
1414
|
-
replyToFile: L.bot.reply_to_file,
|
|
1415
|
-
specialNotice: L.bot.special_notice,
|
|
1416
|
-
specialNoticeEnabled: L.bot.is_special_notice_enabled,
|
|
1417
|
-
showHandoffButton: L.bot.show_handoff_button ?? !0
|
|
1418
|
-
}), _e({
|
|
1419
|
-
type: L.launcher.image_type || "default_icon",
|
|
1420
|
-
imageUrl: L.launcher.image_url
|
|
1421
|
-
}), L.launcher.auto_open && !Le() && setTimeout(() => s.setOpened(!0), 500);
|
|
1422
|
-
}
|
|
1423
|
-
function Se() {
|
|
1424
|
-
f({ url: L.active_channel.channel_url, status: z.OPEN });
|
|
1425
|
-
}
|
|
1426
|
-
try {
|
|
1427
|
-
fe(), await b(j, e == null ? void 0 : e.sessionHandler), Se();
|
|
1428
|
-
} catch (K) {
|
|
1429
|
-
K instanceof Error && (l.error("messengerSession.initialize: failed to connect", K), _(K));
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
I().catch((A) => {
|
|
1433
|
-
l.error("messengerSession: failed to initialize", A);
|
|
1434
|
-
});
|
|
1435
|
-
}, [i, n, o, e == null ? void 0 : e.userId, e == null ? void 0 : e.authToken]), R(() => {
|
|
1436
|
-
p != null && p.onRegisterDeauthenticateHandler && (l.debug("messengerSession: registering deauthenticate handler"), p.onRegisterDeauthenticateHandler(x));
|
|
1437
|
-
}, [p == null ? void 0 : p.onRegisterDeauthenticateHandler, x]), !w || !ee || !le ? null : /* @__PURE__ */ r.createElement(
|
|
1438
|
-
si,
|
|
1439
|
-
{
|
|
1440
|
-
value: {
|
|
1441
|
-
userSession: w,
|
|
1442
|
-
activeChannel: v,
|
|
1443
|
-
refreshActiveChannel: Xe,
|
|
1444
|
-
connectionError: y,
|
|
1445
|
-
aiAgentInfo: { ...ee, ...a == null ? void 0 : a.bot },
|
|
1446
|
-
launcherInfo: { ...le, ...a == null ? void 0 : a.launcher }
|
|
1447
|
-
}
|
|
1448
|
-
},
|
|
1449
|
-
t
|
|
1450
|
-
);
|
|
1451
|
-
}
|
|
1452
|
-
function li({ sound: e }) {
|
|
1453
|
-
const t = "🔔You have received a new message", n = document.title, o = setInterval(() => {
|
|
1454
|
-
document.title = document.title === t ? n : t;
|
|
1455
|
-
}, 750);
|
|
1456
|
-
setTimeout(() => clearInterval(o), 5e3), e && import("./DP0MwObA.js").then((i) => {
|
|
1457
|
-
new Audio(i.default).play();
|
|
1458
|
-
});
|
|
1459
|
-
}
|
|
1460
|
-
const ci = ({ publishSynchronous: e = !1 }) => {
|
|
1461
|
-
const t = /* @__PURE__ */ new Set();
|
|
1462
|
-
return {
|
|
1463
|
-
publish: (n) => {
|
|
1464
|
-
t.forEach((o) => {
|
|
1465
|
-
e ? o(n) : setTimeout(() => o(n), 0);
|
|
1466
|
-
});
|
|
1467
|
-
},
|
|
1468
|
-
subscribe: (n) => (t.add(n), () => t.delete(n))
|
|
1469
|
-
};
|
|
1470
|
-
};
|
|
1471
|
-
function di(e, t = []) {
|
|
1472
|
-
const n = D(null), o = D(0), i = D(0), [a] = T(() => ci({ publishSynchronous: !0 })), [s, l] = T(!0);
|
|
1473
|
-
return ge(() => {
|
|
1474
|
-
o.current = 0, i.current = 0, l(!0), n.current && (n.current.scrollTop = n.current.scrollHeight);
|
|
1475
|
-
}, t), ge(() => a.subscribe(({ type: d, data: g }) => {
|
|
1476
|
-
const { resolve: m, animated: p } = g ?? {};
|
|
1477
|
-
if (!n.current) return m == null ? void 0 : m();
|
|
1478
|
-
if (d === "scrollToBottom" && (n.current.scroll ? n.current.scroll({
|
|
1479
|
-
top: n.current.scrollHeight,
|
|
1480
|
-
behavior: Ht(e, p)
|
|
1481
|
-
}) : n.current.scrollTop = n.current.scrollHeight, i.current = 0, l(!0), m == null || m()), d === "scroll") {
|
|
1482
|
-
const h = g == null ? void 0 : g.top, { scrollTop: b, scrollHeight: x, clientHeight: v } = n.current;
|
|
1483
|
-
n.current.scroll ? n.current.scroll({ top: h, behavior: Ht(e, p) }) : typeof h == "number" && (n.current.scrollTop = h), i.current = Math.max(0, x - b - v), l(i.current === 0), m == null || m();
|
|
1484
|
-
}
|
|
1485
|
-
}), [e]), {
|
|
1486
|
-
scrollRef: n,
|
|
1487
|
-
scrollPubSub: a,
|
|
1488
|
-
isScrollBottomReached: s,
|
|
1489
|
-
setIsScrollBottomReached: l,
|
|
1490
|
-
scrollDistanceFromBottomRef: i,
|
|
1491
|
-
scrollPositionRef: o
|
|
1492
|
-
};
|
|
1493
|
-
}
|
|
1494
|
-
function Ht(e, t) {
|
|
1495
|
-
return typeof t == "boolean" ? t ? "smooth" : "auto" : e;
|
|
1496
|
-
}
|
|
1497
|
-
function ui(e) {
|
|
1498
|
-
return new Promise((t) => {
|
|
1499
|
-
const n = new Image();
|
|
1500
|
-
n.onload = function() {
|
|
1501
|
-
const o = String(n.width), i = String(n.height);
|
|
1502
|
-
URL.revokeObjectURL(n.src), t({ width: o, height: i });
|
|
1503
|
-
}, n.src = URL.createObjectURL(e);
|
|
1504
|
-
});
|
|
1505
|
-
}
|
|
1506
|
-
async function mi(e) {
|
|
1507
|
-
if ("file" in e && e.file instanceof File && e.file.type.startsWith("image/")) {
|
|
1508
|
-
const { width: t, height: n } = await ui(e.file);
|
|
1509
|
-
return new Lr({
|
|
1510
|
-
key: On,
|
|
1511
|
-
value: [t, n]
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
const On = "KEY_IMG_ASPECT_RATIO", gi = ({ onScroll: e }) => {
|
|
1516
|
-
const { agentPreviewConfigs: t, handlers: n } = N(), o = D(t == null ? void 0 : t.agentAttributes);
|
|
1517
|
-
return o.current = t == null ? void 0 : t.agentAttributes, {
|
|
1518
|
-
onBeforeSendMessage: async (i) => {
|
|
1519
|
-
const a = await mi(i), s = {
|
|
1520
|
-
...i,
|
|
1521
|
-
metaArrays: a ? [a] : void 0
|
|
1522
|
-
}, l = pi(o.current);
|
|
1523
|
-
return l ? { ...s, data: JSON.stringify(l) } : s;
|
|
1524
|
-
},
|
|
1525
|
-
onAfterSendMessage: (i) => {
|
|
1526
|
-
var a;
|
|
1527
|
-
e(), (a = n == null ? void 0 : n.onMessageSend) == null || a.call(n, i.message);
|
|
1528
|
-
}
|
|
1529
|
-
};
|
|
1530
|
-
}, pi = (e) => {
|
|
1531
|
-
if (!e) return null;
|
|
1532
|
-
const t = {};
|
|
1533
|
-
return e.ai && Object.keys(e.ai).length > 0 && (t.ai_attrs = e.ai), e.safeguard && Object.keys(e.safeguard).length > 0 && (t.safeguard_attrs = e.safeguard), typeof e.use_prompt_cache == "boolean" && (t.use_prompt_cache = e.use_prompt_cache), Object.keys(t).length > 0 ? t : null;
|
|
1534
|
-
}, {
|
|
1535
|
-
Provider: hi,
|
|
1536
|
-
useContext: Y
|
|
1537
|
-
} = W("Conversation"), fi = ({
|
|
1538
|
-
closedChannelUrl: e,
|
|
1539
|
-
onClearClosedChannelUrl: t,
|
|
1540
|
-
onNavigateToConversationList: n,
|
|
1541
|
-
children: o
|
|
1542
|
-
}) => {
|
|
1543
|
-
const { activeChannel: i, refreshActiveChannel: a } = F(), s = di("smooth"), l = () => {
|
|
1544
|
-
setTimeout(() => s.scrollPubSub.publish({ type: "scrollToBottom" }), 25);
|
|
1545
|
-
}, { onBeforeSendMessage: d, onAfterSendMessage: g } = gi({ onScroll: l }), m = P(async () => {
|
|
1546
|
-
await a(), e && (t == null || t());
|
|
1547
|
-
}, [a, e, t]);
|
|
1548
|
-
return /* @__PURE__ */ r.createElement(
|
|
1549
|
-
eo,
|
|
1550
|
-
{
|
|
1551
|
-
channelUrl: e || (i == null ? void 0 : i.url),
|
|
1552
|
-
onBeforeSendMessage: d,
|
|
1553
|
-
onAfterSendMessage: g,
|
|
1554
|
-
onMessagesUpdated: l,
|
|
1555
|
-
onChannelDeleted: m,
|
|
1556
|
-
onConversationClosedViaDispatcher: m
|
|
1557
|
-
},
|
|
1558
|
-
(p) => /* @__PURE__ */ r.createElement(
|
|
1559
|
-
hi,
|
|
1560
|
-
{
|
|
1561
|
-
value: { ...p, scrollSource: s, goToActiveConversation: m, onNavigateToConversationList: n }
|
|
1562
|
-
},
|
|
1563
|
-
o
|
|
1564
|
-
)
|
|
1565
|
-
);
|
|
1566
|
-
};
|
|
1567
|
-
function Ge() {
|
|
1568
|
-
}
|
|
1569
|
-
async function Ln(e) {
|
|
1570
|
-
let t = e;
|
|
1571
|
-
t && (!t.startsWith("http://") && !t.startsWith("https://") && (t = "https://" + t), window.open(t, "_blank", "noopener,noreferrer"));
|
|
1572
|
-
}
|
|
1573
|
-
function Ut(e) {
|
|
1574
|
-
try {
|
|
1575
|
-
return JSON.parse(e === "" ? "{}" : e);
|
|
1576
|
-
} catch {
|
|
1577
|
-
return {};
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
function Rn(e) {
|
|
1581
|
-
return !e || !e.conversation ? !1 : e.conversation.status === z.CLOSED;
|
|
1582
|
-
}
|
|
1583
|
-
function Nn(e) {
|
|
1584
|
-
return !e || !e.conversation ? !1 : e.conversation.status === z.OPEN;
|
|
1585
|
-
}
|
|
1586
|
-
function bi(e) {
|
|
1587
|
-
var o;
|
|
1588
|
-
const t = (o = e == null ? void 0 : e.conversation) == null ? void 0 : o.handoff, n = !!(t != null && t.timestamp);
|
|
1589
|
-
return Nn(e) && !n;
|
|
1590
|
-
}
|
|
1591
|
-
const bt = ye({
|
|
1592
|
-
onDrop: Ge,
|
|
1593
|
-
subscribe: () => Ge
|
|
1594
|
-
}), lt = ({ children: e }) => {
|
|
1595
|
-
const t = D(/* @__PURE__ */ new Set());
|
|
1596
|
-
return /* @__PURE__ */ r.createElement(
|
|
1597
|
-
bt.Provider,
|
|
1598
|
-
{
|
|
1599
|
-
value: {
|
|
1600
|
-
onDrop: (n) => {
|
|
1601
|
-
var o;
|
|
1602
|
-
if (n.preventDefault(), (o = n.dataTransfer) != null && o.files) {
|
|
1603
|
-
const i = Array.from(n.dataTransfer.files);
|
|
1604
|
-
i.length > 0 && t.current.forEach((a) => a(i));
|
|
1605
|
-
}
|
|
1606
|
-
},
|
|
1607
|
-
subscribe: (n) => (t.current.add(n), () => t.current.delete(n))
|
|
1608
|
-
}
|
|
1609
|
-
},
|
|
1610
|
-
e
|
|
1611
|
-
);
|
|
1612
|
-
}, xi = ({ onDropFiles: e }) => {
|
|
1613
|
-
const { subscribe: t } = J(bt);
|
|
1614
|
-
R(() => t(e), [e]);
|
|
1615
|
-
};
|
|
1616
|
-
lt.Consumer = ({ children: e }) => {
|
|
1617
|
-
const { onDrop: t } = J(bt);
|
|
1618
|
-
return e({ onDrop: t, onDragOver: (i) => i.preventDefault() });
|
|
1619
|
-
};
|
|
1620
|
-
const se = (e) => {
|
|
1621
|
-
const t = e;
|
|
1622
|
-
return typeof t == "number" ? `${t}px` : t;
|
|
1623
|
-
}, Ei = /* @__PURE__ */ new Set(["send", "chat", "message", "chevron-right"]), vi = {
|
|
1624
|
-
spinner: C(() => import("./BcUGcaq2.js")),
|
|
1625
|
-
chat: C(() => import("./DcFCGVBm.js")),
|
|
1626
|
-
message: C(() => import("./DsGXnanX.js")),
|
|
1627
|
-
error: C(() => import("./B6fvrWGq.js")),
|
|
1628
|
-
info: C(() => import("./CAIYsKDy.js")),
|
|
1629
|
-
refresh: C(() => import("./B6xd54zt.js")),
|
|
1630
|
-
"chevron-down": C(() => import("./BsimU71m.js")),
|
|
1631
|
-
"chevron-right": C(() => import("./NmJl7zv3.js")),
|
|
1632
|
-
done: C(() => import("./D_q6g3Dd.js")),
|
|
1633
|
-
user: C(() => import("./CvqfQEhO.js")),
|
|
1634
|
-
"file-document": C(() => import("./BAr50pfO.js")),
|
|
1635
|
-
download: C(() => import("./B2CtcWp3.js")),
|
|
1636
|
-
attach: C(() => import("./DY2ULcTX.js")),
|
|
1637
|
-
delete: C(() => import("./DMruRpOm.js")),
|
|
1638
|
-
close: C(() => import("./CuaBI7kd.js")),
|
|
1639
|
-
"close-filled": C(() => import("./CxQFWLnW.js")),
|
|
1640
|
-
send: C(() => import("./DZJyDpNp.js")),
|
|
1641
|
-
menu: C(() => import("./BUYabNz7.js")),
|
|
1642
|
-
expand: C(() => import("./wBtIAuNm.js")),
|
|
1643
|
-
collapse: C(() => import("./C0RFfifL.js")),
|
|
1644
|
-
agent: C(() => import("./Cc7XmLN1.js")),
|
|
1645
|
-
question: C(() => import("./dqwvRBog.js")),
|
|
1646
|
-
actionbook: C(() => import("./CrjNuryZ.js")),
|
|
1647
|
-
function: C(() => import("./CvdSjw1c.js")),
|
|
1648
|
-
"radio-on": C(() => import("./nmdo2Fbj.js")),
|
|
1649
|
-
"radio-off": C(() => import("./BnZcRFmS.js")),
|
|
1650
|
-
confluence: C(() => import("./BOnlh2zd.js")),
|
|
1651
|
-
zendesk: C(() => import("./BAJ6LEKc.js")),
|
|
1652
|
-
salesforce: C(() => import("./CT2kv4lr.js")),
|
|
1653
|
-
sprinklr: C(() => import("./m2INcyV2.js")),
|
|
1654
|
-
website: C(() => import("./BgGVGNdg.js")),
|
|
1655
|
-
snippet: C(() => import("./BFcXPuf5.js")),
|
|
1656
|
-
template: C(() => import("./awO7aBCv.js"))
|
|
1657
|
-
}, $ = ({ type: e, size: t = 24, className: n, color: o }) => {
|
|
1658
|
-
const i = vi[e];
|
|
1659
|
-
return /* @__PURE__ */ r.createElement(
|
|
1660
|
-
Ci,
|
|
1661
|
-
{
|
|
1662
|
-
className: n,
|
|
1663
|
-
$rtlFlip: Ei.has(e),
|
|
1664
|
-
$size: t,
|
|
1665
|
-
$color: o ?? u.color.primary.main
|
|
1666
|
-
},
|
|
1667
|
-
/* @__PURE__ */ r.createElement($e, { fallback: null }, /* @__PURE__ */ r.createElement(i, null))
|
|
1668
|
-
);
|
|
1669
|
-
}, yi = k`[dir='rtl'] &{transform:scaleX(-1);}`, Ci = c.div`width:${({ $size: e }) => se(e)};height:${({ $size: e }) => se(e)};display:inline-block;&:focus{outline:none;}svg{display:block;}[class*='fill']{fill:${({ $color: e }) => e};}[class*='stroke']{stroke:${({ $color: e }) => e};stroke-width:2px;stroke-linejoin:round;}${({ $rtlFlip: e }) => e && yi};`, S = ({
|
|
1670
|
-
as: e,
|
|
1671
|
-
variant: t = "body1",
|
|
1672
|
-
color: n,
|
|
1673
|
-
className: o,
|
|
1674
|
-
...i
|
|
1675
|
-
}) => /* @__PURE__ */ r.createElement(_i, { as: e, $variant: t, className: o, $color: n, ...i }), zt = /* @__PURE__ */ new WeakMap(), Ti = (e, t) => {
|
|
1676
|
-
let n = zt.get(t);
|
|
1677
|
-
n || (n = /* @__PURE__ */ new Map(), zt.set(t, n));
|
|
1678
|
-
const o = n.get(e);
|
|
1679
|
-
if (o) return o;
|
|
1680
|
-
const i = t[e] ?? t.body1, a = k`font-size:${se(i.fontSize)};font-weight:${i.fontWeight};${i.fontFamily ? `font-family: ${i.fontFamily};` : ""}
|
|
1681
|
-
${i.lineHeight ? `line-height: ${i.lineHeight};` : "line-height: 100%;"}
|
|
1682
|
-
`;
|
|
1683
|
-
return n.set(e, a), a;
|
|
1684
|
-
}, _i = c.span`font-stretch:normal;font-style:normal;letter-spacing:normal;${({ $variant: e, theme: t }) => Ti(e, t.typography)}color:${({ $color: e }) => e};`, Od = ({ iconSize: e = 64, icon: t, className: n, label: o, children: i }) => /* @__PURE__ */ r.createElement(wi, { className: n }, /* @__PURE__ */ r.createElement($, { type: t, size: e, color: u.themedColor.textLowEmphasis }), /* @__PURE__ */ r.createElement(S, { variant: "body1", color: u.themedColor.textMidEmphasis }, o), i), Si = c.div`position:relative;display:flex;justify-content:center;align-items:center;width:100%;height:100%;`, wi = c.div`display:flex;flex-direction:column;min-height:104px;align-items:center;gap:20px;text-align:center;`, ki = {
|
|
1685
|
-
loading: C(() => import("./D_jG_XZn.js")),
|
|
1686
|
-
error: C(() => import("./CSc2-BOs.js")),
|
|
1687
|
-
noChannels: C(() => import("./DeR_25I_.js")),
|
|
1688
|
-
noMessages: C(() => import("./XE_dyn7i.js"))
|
|
1689
|
-
}, Ee = ({ className: e, type: t = "loading", ...n }) => {
|
|
1690
|
-
const o = ki[t];
|
|
1691
|
-
return /* @__PURE__ */ r.createElement(Si, { className: e }, /* @__PURE__ */ r.createElement($e, { fallback: null }, /* @__PURE__ */ r.createElement(o, { ...n })));
|
|
1692
|
-
}, Re = 244, Dn = 640, je = 26, Bn = 4, Q = 12, Te = 2, Ai = 16, ae = `${Z}-incoming-msg`, Ii = `${Z}-marked-text`;
|
|
1693
|
-
function xt(e) {
|
|
1694
|
-
switch (e) {
|
|
1695
|
-
case "top":
|
|
1696
|
-
case "middle":
|
|
1697
|
-
return Te;
|
|
1698
|
-
default:
|
|
1699
|
-
return Ai;
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
function Et(e, t) {
|
|
1703
|
-
if (t) {
|
|
1704
|
-
const [, n] = t.split("/");
|
|
1705
|
-
if (n)
|
|
1706
|
-
return n.toUpperCase();
|
|
1707
|
-
}
|
|
1708
|
-
if (e && !e.startsWith(".")) {
|
|
1709
|
-
const n = e.split(".").pop();
|
|
1710
|
-
if (n && n !== e)
|
|
1711
|
-
return n.toUpperCase();
|
|
1712
|
-
}
|
|
1713
|
-
return "FILE";
|
|
1714
|
-
}
|
|
1715
|
-
function Pn(e) {
|
|
1716
|
-
return e.messageType === "file" ? e.message.length > 0 && e.file.name !== e.message : e.message.length > 0;
|
|
1717
|
-
}
|
|
1718
|
-
function vt({
|
|
1719
|
-
name: e,
|
|
1720
|
-
type: t = "FILE",
|
|
1721
|
-
iconColor: n,
|
|
1722
|
-
iconBackgroundColor: o,
|
|
1723
|
-
onClick: i
|
|
1724
|
-
}) {
|
|
1725
|
-
const { colors: a } = mt();
|
|
1726
|
-
return /* @__PURE__ */ r.createElement($i, { onClick: i, $clickable: !!i }, /* @__PURE__ */ r.createElement(Oi, { $bgColor: o ?? a.base.primary }, /* @__PURE__ */ r.createElement($, { type: "file-document", size: 24, color: n ?? a.base.primaryContrastContent })), /* @__PURE__ */ r.createElement(Li, null, /* @__PURE__ */ r.createElement(Ri, { variant: "button", color: u.themedColor.textHighEmphasis }, e), /* @__PURE__ */ r.createElement(S, { color: u.themedColor.textMidEmphasis, variant: "caption3" }, t)));
|
|
1727
|
-
}
|
|
1728
|
-
const $i = c.div`border-radius:12px;gap:8px;width:${Re}px;height:64px;display:flex;align-items:center;padding:12px;box-sizing:border-box;border:1px solid ${u.themedColor.textDisabled};background-color:${u.themedColor.bg_50_600};${({ $clickable: e }) => e && Mi}`, Mi = k`cursor:pointer;&:hover{background-color:${u.themedColor.bg_100_500};}`, Oi = c.div`border-radius:8px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;background-color:${({ $bgColor: e }) => e};`, Li = c.div`display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;`, Ri = c(S)`text-overflow:ellipsis;white-space:nowrap;overflow:hidden;`;
|
|
1729
|
-
function Ni({ file: e, children: t, onClickFile: n }) {
|
|
1730
|
-
return /* @__PURE__ */ r.createElement(Di, null, /* @__PURE__ */ r.createElement(
|
|
1731
|
-
vt,
|
|
1732
|
-
{
|
|
1733
|
-
name: e.name,
|
|
1734
|
-
type: Et(e.name, e.type),
|
|
1735
|
-
onClick: n && (() => n == null ? void 0 : n(e))
|
|
1736
|
-
}
|
|
1737
|
-
), t);
|
|
1738
|
-
}
|
|
1739
|
-
const Di = c.div`display:flex;flex-direction:column;align-items:flex-start;gap:${Te}px;`;
|
|
1740
|
-
function Bi({ file: e, onClickMedia: t, children: n }) {
|
|
1741
|
-
const o = () => e.type.startsWith("image") ? /* @__PURE__ */ r.createElement(Hi, { src: e.url, alt: "image-message" }) : e.type.startsWith("video") ? /* @__PURE__ */ r.createElement(Ui, { controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: e.url }), /* @__PURE__ */ r.createElement("track", { kind: "captions" })) : null;
|
|
1742
|
-
if (o) {
|
|
1743
|
-
const i = {
|
|
1744
|
-
id: `${ae}-media-body`,
|
|
1745
|
-
onClick: () => t == null ? void 0 : t(e)
|
|
1746
|
-
};
|
|
1747
|
-
return /* @__PURE__ */ r.createElement(Pi, null, /* @__PURE__ */ r.createElement(Fi, { ...i }, o()), n);
|
|
1748
|
-
}
|
|
1749
|
-
return null;
|
|
1750
|
-
}
|
|
1751
|
-
const Pi = c.div`display:flex;flex-direction:column;align-items:flex-start;gap:${Te}px;`, Fi = c.div`width:${Re}px;height:160px;border-radius:12px;overflow:hidden;cursor:pointer;${B.light`
|
|
1752
|
-
background-color: ${u.color.background100};
|
|
1753
|
-
`}
|
|
1754
|
-
${B.dark`
|
|
1755
|
-
background-color: ${u.color.background400};
|
|
1756
|
-
`}
|
|
1757
|
-
`, Hi = c.img`width:100%;height:100%;object-fit:cover;`, Ui = c.video`width:100%;height:100%;object-fit:cover;`, zi = "✱";
|
|
1758
|
-
function Fn(e) {
|
|
1759
|
-
const t = new RegExp(`${zi}+`, "g");
|
|
1760
|
-
return e.replace(t, (n) => `<span id=${Ii} aria-label="masked-text">${n}</span>`);
|
|
1761
|
-
}
|
|
1762
|
-
function Wi(e) {
|
|
1763
|
-
const t = /```(\w+)?\n([\s\S]*?)```/g, n = [];
|
|
1764
|
-
let o = 0;
|
|
1765
|
-
return e.replace(t, (i, ...a) => {
|
|
1766
|
-
const [s, l, d] = a;
|
|
1767
|
-
return o < d && n.push({
|
|
1768
|
-
type: "text",
|
|
1769
|
-
value: e.slice(o, d).trim()
|
|
1770
|
-
}), n.push({
|
|
1771
|
-
type: "code",
|
|
1772
|
-
value: l.trim(),
|
|
1773
|
-
language: s ? s.trim() : "plaintext"
|
|
1774
|
-
}), o = d + i.length, i;
|
|
1775
|
-
}), o < e.length && n.push({
|
|
1776
|
-
type: "text",
|
|
1777
|
-
value: e.slice(o).trim()
|
|
1778
|
-
}), n.map((i) => i.type !== "text" ? i : { ...i, value: Fn(i.value) });
|
|
1779
|
-
}
|
|
1780
|
-
const Vi = C(async () => ({ default: (await import("./Dde5r6cu.js")).MarkdownText })), Gi = C(async () => ({ default: (await import("./DH2PekOm.js")).CodeBlock }));
|
|
1781
|
-
function Wt(e) {
|
|
1782
|
-
var i, a;
|
|
1783
|
-
const t = e.maxBodyWidth ?? Re, n = Ie(() => Wi(e.message), [e.message]), o = {
|
|
1784
|
-
id: `${ae}-text-body`,
|
|
1785
|
-
$maxWidth: t,
|
|
1786
|
-
$color: (i = e.customStyle) == null ? void 0 : i.bubbleContentColor,
|
|
1787
|
-
$bgColor: (a = e.customStyle) == null ? void 0 : a.bubbleBackgroundColor
|
|
1788
|
-
};
|
|
1789
|
-
return n.length === 0 ? e.children ? /* @__PURE__ */ r.createElement(Vt, { ...o }, e.children) : null : /* @__PURE__ */ r.createElement(Vt, { ...o }, n.map((s, l) => s.type === "text" ? /* @__PURE__ */ r.createElement(Gt, { key: l, variant: "body3" }, /* @__PURE__ */ r.createElement($e, { fallback: s.value }, /* @__PURE__ */ r.createElement(Vi, null, s.value))) : s.type === "code" ? /* @__PURE__ */ r.createElement($e, { key: l, fallback: /* @__PURE__ */ r.createElement(Gt, { variant: "body3" }, s.value) }, /* @__PURE__ */ r.createElement(Gi, { code: s.value, language: s.language })) : null), e.children);
|
|
1790
|
-
}
|
|
1791
|
-
const Vt = c.div`display:flex;flex-direction:column;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e, $color: t, $bgColor: n }) => k`
|
|
1792
|
-
color: ${t || e.colors.messageIncoming.text};
|
|
1793
|
-
background-color: ${n || e.colors.messageIncoming.background};
|
|
1794
|
-
`}
|
|
1795
|
-
padding: 12px 0;
|
|
1796
|
-
transition: max-width 0.3s;
|
|
1797
|
-
overflow-wrap: break-word;
|
|
1798
|
-
`, Gt = c(S)`align-items:flex-start;line-height:140%;white-space:pre-wrap;padding:0 12px;`;
|
|
1799
|
-
function ji(e) {
|
|
1800
|
-
const { stringSet: t } = M(), n = Pn(e) ? /* @__PURE__ */ r.createElement(Wt, { ...e }) : null;
|
|
1801
|
-
if (e.messageType === "user")
|
|
1802
|
-
return n;
|
|
1803
|
-
if (e.messageType === "file") {
|
|
1804
|
-
const o = e.file;
|
|
1805
|
-
return o.type.startsWith("image") || o.type.startsWith("video") ? /* @__PURE__ */ r.createElement(Bi, { ...e }, n) : /* @__PURE__ */ r.createElement(Ni, { ...e }, n);
|
|
1806
|
-
}
|
|
1807
|
-
return /* @__PURE__ */ r.createElement(Wt, { ...e, message: t.UNKNOWN__UNKNOWN_MESSAGE_TYPE });
|
|
1808
|
-
}
|
|
1809
|
-
const yt = (e) => /* @__PURE__ */ r.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.0008 0.973633C10.6172 0.973633 9.49558 2.09527 9.49558 3.47888C9.49558 4.50705 10.115 5.39055 11.0009 5.77664V7.47887H13.0009V5.77653C13.8868 5.3904 14.5061 4.50696 14.5061 3.47888C14.5061 2.09527 13.3844 0.973633 12.0008 0.973633ZM0.250977 16.5788L0.250977 10.5789H2.25098L2.25098 16.5788H0.250977ZM21.7511 10.5789V16.5788H23.7511V10.5789H21.7511ZM18.251 7.47888H3.25097V18.9789C3.25097 20.3596 4.37026 21.4789 5.75097 21.4789H18.251C19.6317 21.4789 20.751 20.3596 20.751 18.9789V9.97887C20.751 8.59816 19.6317 7.47888 18.251 7.47888ZM9.78434 11.9539V15.2038C9.78434 15.7561 9.33663 16.2038 8.78434 16.2038C8.23206 16.2038 7.78434 15.7561 7.78434 15.2038V11.9539C7.78434 11.4016 8.23206 10.9539 8.78434 10.9539C9.33663 10.9539 9.78434 11.4016 9.78434 11.9539ZM16.2677 11.9539V15.2038C16.2677 15.7561 15.82 16.2038 15.2677 16.2038C14.7154 16.2038 14.2677 15.7561 14.2677 15.2038V11.9539C14.2677 11.4016 14.7154 10.9539 15.2677 10.9539C15.82 10.9539 16.2677 11.4016 16.2677 11.9539Z", fill: "#0D0D0D" }));
|
|
1810
|
-
function Ct({ id: e, src: t, size: n = 56, onClick: o, style: i }) {
|
|
1811
|
-
return /* @__PURE__ */ r.createElement(Ki, { id: e, tabIndex: 0, onClick: o, $size: se(n), style: i }, t ? /* @__PURE__ */ r.createElement(Zi, { src: t }) : /* @__PURE__ */ r.createElement($, { type: "user", size: n }));
|
|
1812
|
-
}
|
|
1813
|
-
const Ki = c.div`border-radius:50%;display:inline-block;overflow:hidden;position:relative;flex-shrink:0;height:${(e) => e.$size};width:${(e) => e.$size};background-color:${u.themedColor.bg_100_500};&:focus{outline:none;}`, Zi = c.img`object-fit:cover;width:100%;height:100%;position:absolute;`;
|
|
1814
|
-
function Yi({ sender: e, isBotMessage: t }) {
|
|
1815
|
-
const n = `${ae}-sender-avatar`;
|
|
1816
|
-
return !e.profileUrl && t ? /* @__PURE__ */ r.createElement(qi, { id: n }, /* @__PURE__ */ r.createElement(yt, null)) : /* @__PURE__ */ r.createElement(Ct, { id: n, size: je, src: e.profileUrl });
|
|
1817
|
-
}
|
|
1818
|
-
const qi = c.div`flex-shrink:0;width:${je}px;height:${je}px;box-sizing:border-box;padding:6px;border-radius:50%;display:flex;justify-content:center;align-items:center;background-color:${({ theme: e }) => e.colors.base.primary};path{fill:${({ theme: e }) => e.colors.base.primaryContrastContent};}}`;
|
|
1819
|
-
function Ji({ sender: e }) {
|
|
1820
|
-
return /* @__PURE__ */ r.createElement(Xi, { id: `${ae}-sender-name`, variant: "caption1", color: u.themedColor.textMidEmphasis }, e.nickname);
|
|
1821
|
-
}
|
|
1822
|
-
const Xi = c(S)`text-align:start;width:100%;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:5px;padding-inline:0 7px;`;
|
|
1823
|
-
function Qi({ createdAt: e }) {
|
|
1824
|
-
const { stringSet: t, format: n } = M();
|
|
1825
|
-
return e ? /* @__PURE__ */ r.createElement(S, { id: `${ae}-sent-time`, variant: "caption4", color: u.themedColor.textLowEmphasis }, n(e, t.DATE_FORMAT__MESSAGE_TIMESTAMP)) : null;
|
|
1826
|
-
}
|
|
1827
|
-
function es({ customStyle: e }) {
|
|
1828
|
-
return /* @__PURE__ */ r.createElement(ts, { $bgColor: e == null ? void 0 : e.bubbleBackgroundColor }, [0, 1, 2].map((t) => /* @__PURE__ */ r.createElement(ns, { key: t, $color: e == null ? void 0 : e.bubbleContentColor })));
|
|
1829
|
-
}
|
|
1830
|
-
const ts = c.div`align-items:center;border-radius:12px;display:flex;gap:6px;justify-content:center;padding:16px 12px;background-color:${({ theme: e, $bgColor: t }) => t || e.colors.messageIncoming.background};`, ns = c.span`animation:blink 1.4s infinite;animation-fill-mode:both;border-radius:50%;height:8px;width:8px;background:${({ theme: e, $color: t }) => t || e.colors.messageIncoming.text};@keyframes blink{0%{opacity:0.12;transform:scale(1);}21.43%{opacity:0.38;transform:scale(1.2);}42.86%{opacity:0.12;transform:scale(1);}100%{opacity:0.12;transform:scale(1);}}&:nth-child(1){animation-delay:0.4s;}&:nth-child(2){animation-delay:0.6s;}&:nth-child(3){animation-delay:0.8s;}`;
|
|
1831
|
-
function rs({
|
|
1832
|
-
extendedMessagePayload: e,
|
|
1833
|
-
onClickCTA: t = ({ url: n }) => Ln(n)
|
|
1834
|
-
}) {
|
|
1835
|
-
const n = e == null ? void 0 : e.cta_button;
|
|
1836
|
-
return n ? /* @__PURE__ */ r.createElement(os, { id: `${ae}-ext-cta-button`, role: "button", onClick: () => t(n) }, /* @__PURE__ */ r.createElement(is, { variant: "button" }, n.label)) : null;
|
|
1837
|
-
}
|
|
1838
|
-
const os = c.div`display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:6px;padding:8px;background-color:${u.color.primary.main};color:${({ theme: e }) => e.colors.base.primaryContrastContent};&:hover{background-color:${u.color.primary.dark};}`, is = c(S)`overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`;
|
|
1839
|
-
function ss(e) {
|
|
1840
|
-
return /* @__PURE__ */ r.createElement(r.Fragment, null);
|
|
1841
|
-
}
|
|
1842
|
-
class as extends mr {
|
|
1843
|
-
constructor(t) {
|
|
1844
|
-
super(t), this.state = {
|
|
1845
|
-
hasError: !1
|
|
1846
|
-
};
|
|
1847
|
-
}
|
|
1848
|
-
static getDerivedStateFromError() {
|
|
1849
|
-
return { hasError: !0 };
|
|
1850
|
-
}
|
|
1851
|
-
render() {
|
|
1852
|
-
return this.state.hasError ? this.props.errorFallback : /* @__PURE__ */ r.createElement($e, { fallback: this.props.loadingFallback }, this.props.children);
|
|
1853
|
-
}
|
|
1854
|
-
}
|
|
1855
|
-
const ls = /* @__PURE__ */ new Set(["default"]), { MessageTemplate: cs } = Fr({
|
|
1856
|
-
parser: Br,
|
|
1857
|
-
renderer: Dr,
|
|
1858
|
-
Container: (e) => /* @__PURE__ */ r.createElement("div", { ...e })
|
|
1859
|
-
});
|
|
1860
|
-
function ds(e) {
|
|
1861
|
-
return /* @__PURE__ */ r.createElement(
|
|
1862
|
-
as,
|
|
1863
|
-
{
|
|
1864
|
-
errorFallback: e.messageTemplateErrorFallback,
|
|
1865
|
-
loadingFallback: e.messageTemplateLoadingFallback
|
|
1866
|
-
},
|
|
1867
|
-
/* @__PURE__ */ r.createElement(us, { ...e })
|
|
1868
|
-
);
|
|
1869
|
-
}
|
|
1870
|
-
const us = ({
|
|
1871
|
-
extendedMessagePayload: e,
|
|
1872
|
-
onGetCachedMessageTemplate: t = () => null,
|
|
1873
|
-
onRequestMessageTemplate: n
|
|
1874
|
-
}) => {
|
|
1875
|
-
const o = e == null ? void 0 : e.message_template;
|
|
1876
|
-
if (!ls.has((o == null ? void 0 : o.type) ?? "default")) throw new Error("Unsupported template type");
|
|
1877
|
-
if (!n) throw new Error("onRequestMessageTemplate is required");
|
|
1878
|
-
const { theme: a } = Ko(), s = Lo({
|
|
1879
|
-
onRequestTemplate: n,
|
|
1880
|
-
onGetCachedTemplate: t,
|
|
1881
|
-
theme: a.selectedTheme,
|
|
1882
|
-
templateKey: (o == null ? void 0 : o.key) ?? "invalid",
|
|
1883
|
-
variables: o == null ? void 0 : o.variables,
|
|
1884
|
-
viewVariables: o == null ? void 0 : o.view_variables,
|
|
1885
|
-
aiAgentColorVariables: a.aiAgentColorVariables
|
|
1886
|
-
});
|
|
1887
|
-
return /* @__PURE__ */ r.createElement(ms, { id: `${ae}-ext-message-template` }, /* @__PURE__ */ r.createElement(Pr, { message: {} }, /* @__PURE__ */ r.createElement(cs, { templateItems: s.body.items, templateVersion: s.version })));
|
|
1888
|
-
}, ms = c.div`box-sizing:border-box;overflow:hidden;width:100%;`;
|
|
1889
|
-
function gs({
|
|
1890
|
-
extendedMessagePayload: e,
|
|
1891
|
-
onClickSuggestedReply: t,
|
|
1892
|
-
suggestedRepliesDirection: n = "vertical"
|
|
1893
|
-
}) {
|
|
1894
|
-
const [o, i] = T(!1), a = (e == null ? void 0 : e.suggested_replies) ?? [];
|
|
1895
|
-
return a.length === 0 || o ? null : /* @__PURE__ */ r.createElement(ps, { id: `${ae}-ext-suggested-replies`, $type: n }, a.map((s, l) => /* @__PURE__ */ r.createElement(
|
|
1896
|
-
hs,
|
|
1897
|
-
{
|
|
1898
|
-
key: l,
|
|
1899
|
-
$type: n,
|
|
1900
|
-
variant: "body3",
|
|
1901
|
-
onClick: () => {
|
|
1902
|
-
t && (t == null || t({ reply: s }), i(!0));
|
|
1903
|
-
}
|
|
1904
|
-
},
|
|
1905
|
-
s
|
|
1906
|
-
)));
|
|
1907
|
-
}
|
|
1908
|
-
const ps = c.div`margin:16px 0;padding:0 ${Q}px;position:relative;display:flex;gap:8px;${({ $type: e }) => e === "vertical" ? fs : bs};`, hs = c(S)`box-sizing:border-box;padding:8px 12px;display:flex;align-items:center;border-radius:20px / clamp(20px,5%,100px);cursor:pointer;word-break:break-word;color:${u.color.primary.main};border:1px solid ${u.color.primary.main};background-color:${u.themedColor.bg_50_600};&:hover{background-color:${u.themedColor.bg_100_500};}${({ $type: e, theme: t }) => k`
|
|
1909
|
-
${e === "vertical" ? xs : Es};
|
|
1910
|
-
&:active {
|
|
1911
|
-
background-color: ${t.colors.base.primary};
|
|
1912
|
-
color: ${t.colors.base.primaryContrastContent};
|
|
1913
|
-
}
|
|
1914
|
-
`}
|
|
1915
|
-
`, fs = k`flex-direction:column;align-items:flex-end;`, bs = k`flex-direction:row;overflow-x:scroll;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}`, xs = k`max-width:calc(100% - 70px);white-space:pre-wrap;`, Es = k`white-space:nowrap;`;
|
|
1916
|
-
function Tt(e) {
|
|
1917
|
-
return e();
|
|
1918
|
-
}
|
|
1919
|
-
const ve = Ce({
|
|
1920
|
-
template: vs,
|
|
1921
|
-
components: {
|
|
1922
|
-
SenderName: Ji,
|
|
1923
|
-
SenderAvatar: Yi,
|
|
1924
|
-
SentTime: Qi,
|
|
1925
|
-
MessageBody: ji,
|
|
1926
|
-
TypingIndicator: es,
|
|
1927
|
-
SuggestedReplies: gs,
|
|
1928
|
-
MessageTemplate: ds,
|
|
1929
|
-
CTAButton: rs,
|
|
1930
|
-
MessageLogs: ss
|
|
1931
|
-
}
|
|
1932
|
-
});
|
|
1933
|
-
function vs(e) {
|
|
1934
|
-
return /* @__PURE__ */ r.createElement(Hn, { ...e, testerMode: !1 });
|
|
1935
|
-
}
|
|
1936
|
-
function Hn(e) {
|
|
1937
|
-
var p, h, b, x;
|
|
1938
|
-
const { components: t } = ve.useContext(), n = !!e.isTyping, o = e.testerMode, i = !!((p = e.extendedMessagePayload) != null && p.message_template), a = !!((h = e.extendedMessagePayload) != null && h.cta_button), s = !!e.createdAt, l = Tt(() => e.messageType === "user" ? e.message.length > 0 : !0), d = e.groupType === "top" || e.groupType === "single", g = e.groupType === "bottom" || e.groupType === "single", m = o ? 0 : je;
|
|
1939
|
-
return /* @__PURE__ */ r.createElement(ys, { $marginBottom: n ? 0 : xt(e.groupType) }, d && /* @__PURE__ */ r.createElement(Cs, null, !o && /* @__PURE__ */ r.createElement(t.SenderAvatar, { ...e }), /* @__PURE__ */ r.createElement(t.SenderName, { ...e })), /* @__PURE__ */ r.createElement(Rt, null, /* @__PURE__ */ r.createElement(nt, { $extraStartPadding: m }, n && /* @__PURE__ */ r.createElement(t.TypingIndicator, { ...e }), /* @__PURE__ */ r.createElement(t.MessageBody, { ...e }, a && /* @__PURE__ */ r.createElement("div", { style: { marginTop: 12, marginInline: 12 } }, /* @__PURE__ */ r.createElement(t.CTAButton, { ...e })))), i && /* @__PURE__ */ r.createElement(jt, { $startPadding: 0, $endPadding: 0, style: { marginTop: l ? Te : 0 } }, /* @__PURE__ */ r.createElement(
|
|
1940
|
-
t.MessageTemplate,
|
|
1941
|
-
{
|
|
1942
|
-
...e,
|
|
1943
|
-
messageTemplateErrorFallback: e.messageTemplateErrorFallback ?? /* @__PURE__ */ r.createElement(nt, { $extraStartPadding: m }, /* @__PURE__ */ r.createElement(
|
|
1944
|
-
t.MessageBody,
|
|
1945
|
-
{
|
|
1946
|
-
...e,
|
|
1947
|
-
messageType: "user",
|
|
1948
|
-
message: ((x = (b = e.extendedMessagePayload) == null ? void 0 : b.message_template) == null ? void 0 : x.fallback_message) ?? "Cannot read this template."
|
|
1949
|
-
}
|
|
1950
|
-
)),
|
|
1951
|
-
messageTemplateLoadingFallback: e.messageTemplateLoadingFallback ?? /* @__PURE__ */ r.createElement(nt, { $extraStartPadding: m }, /* @__PURE__ */ r.createElement(t.TypingIndicator, { ...e }))
|
|
1952
|
-
}
|
|
1953
|
-
))), g && s && /* @__PURE__ */ r.createElement(Ts, { $extraStartPadding: m + 8 }, /* @__PURE__ */ r.createElement(t.SentTime, { ...e })), /* @__PURE__ */ r.createElement(Rt, null, e.suggestedRepliesVisible && /* @__PURE__ */ r.createElement(jt, null, /* @__PURE__ */ r.createElement(t.SuggestedReplies, { ...e })), /* @__PURE__ */ r.createElement(t.MessageLogs, { ...e })));
|
|
1954
|
-
}
|
|
1955
|
-
const ys = c.div`display:flex;flex-direction:column;align-items:flex-start;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
|
|
1956
|
-
`, Je = c.div`display:flex;align-self:stretch;justify-content:flex-start;${({ $startPadding: e = Q, $endPadding: t = Q, $extraStartPadding: n = 0 }) => `
|
|
1957
|
-
padding-inline: ${e + n}px ${t}px;
|
|
1958
|
-
`}
|
|
1959
|
-
`, Cs = c(Je)`display:flex;flex-direction:row;align-items:center;gap:8px;`, nt = c(Je)`display:flex;`, Ts = c(Je)`margin-top:${Bn}px;display:flex;align-items:flex-start;justify-content:flex-start;`, jt = c(Je)`display:flex;flex-direction:column;${({ $startPadding: e = Q, $endPadding: t = Q, $extraStartPadding: n = 0 }) => `
|
|
1960
|
-
padding-inline: ${e + n}px ${t}px;
|
|
1961
|
-
`}
|
|
1962
|
-
`;
|
|
1963
|
-
function _s({ file: e, children: t, onClickFile: n }) {
|
|
1964
|
-
return /* @__PURE__ */ r.createElement(Ss, null, /* @__PURE__ */ r.createElement(
|
|
1965
|
-
vt,
|
|
1966
|
-
{
|
|
1967
|
-
name: e.name,
|
|
1968
|
-
type: Et(e.name, e.type),
|
|
1969
|
-
onClick: n && (() => n == null ? void 0 : n(e))
|
|
1970
|
-
}
|
|
1971
|
-
), t);
|
|
1972
|
-
}
|
|
1973
|
-
const Ss = c.div`display:flex;flex-direction:column;align-items:flex-end;gap:${Te}px;`, Un = ({ className: e, children: t, size: n = 26 }) => /* @__PURE__ */ r.createElement(ws, { className: e, $size: n }, t ?? /* @__PURE__ */ r.createElement($, { type: "spinner", size: n })), ws = c.div`display:flex;align-items:center;justify-content:center;width:${({ $size: e }) => se(e)};height:${({ $size: e }) => se(e)};animation:1s infinite linear;animation-name:rotate;@keyframes rotate{from{transform:rotate(0);}to{transform:rotate(360deg);}}`;
|
|
1974
|
-
function ks({ file: e, metadata: t, onClickMedia: n, children: o }) {
|
|
1975
|
-
const { aspectRatio: i, localFile: a } = t, [s] = T(() => a instanceof File ? URL.createObjectURL(a) : e.url), [l, d] = T(!1), g = {
|
|
1976
|
-
onClick: () => n == null ? void 0 : n(e),
|
|
1977
|
-
$ratio: i
|
|
1978
|
-
};
|
|
1979
|
-
return /* @__PURE__ */ r.createElement(As, null, /* @__PURE__ */ r.createElement(Is, { ...g }, !l && /* @__PURE__ */ r.createElement(Un, { size: 26 }, /* @__PURE__ */ r.createElement($, { type: "spinner", color: "textLowEmphasis", size: 26 })), /* @__PURE__ */ r.createElement($s, { $loaded: l, src: s, alt: "image-message", onLoad: () => d(!0) })), o);
|
|
1980
|
-
}
|
|
1981
|
-
const As = c.div`display:flex;flex-direction:column;align-items:flex-end;gap:${Te}px;`, Is = c.div`width:${Re}px;border-radius:12px;overflow:hidden;cursor:pointer;height:auto;aspect-ratio:${(e) => e.$ratio};position:relative;display:flex;align-items:center;justify-content:center;${B.light`
|
|
1982
|
-
background-color: ${u.color.background100};
|
|
1983
|
-
`}
|
|
1984
|
-
${B.dark`
|
|
1985
|
-
background-color: ${u.color.background400};
|
|
1986
|
-
`}
|
|
1987
|
-
`, $s = c.img`position:absolute;width:100%;height:100%;inset-block-start:0;inset-inline-start:0;object-fit:cover;opacity:${(e) => e.$loaded ? 1 : 0};transition:opacity 0.5s ease;`;
|
|
1988
|
-
function Kt(e) {
|
|
1989
|
-
var n, o;
|
|
1990
|
-
const t = Ie(() => bn.sanitize(Fn(e.message)), [e.message]);
|
|
1991
|
-
return /* @__PURE__ */ r.createElement(
|
|
1992
|
-
Ms,
|
|
1993
|
-
{
|
|
1994
|
-
$maxWidth: e.maxBodyWidth ?? Re,
|
|
1995
|
-
$color: (n = e.customStyle) == null ? void 0 : n.bubbleContentColor,
|
|
1996
|
-
$bgColor: (o = e.customStyle) == null ? void 0 : o.bubbleBackgroundColor
|
|
1997
|
-
},
|
|
1998
|
-
/* @__PURE__ */ r.createElement(Os, { variant: "body3", dangerouslySetInnerHTML: { __html: t } })
|
|
1999
|
-
);
|
|
2000
|
-
}
|
|
2001
|
-
const Ms = c.div`display:flex;flex-direction:column;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e, $color: t, $bgColor: n }) => k`
|
|
2002
|
-
color: ${t || e.colors.messageOutgoing.text};
|
|
2003
|
-
background-color: ${n || e.colors.messageOutgoing.background};
|
|
2004
|
-
`}
|
|
2005
|
-
padding: 12px 0;
|
|
2006
|
-
transition: max-width 0.3s;
|
|
2007
|
-
overflow-wrap: break-word;
|
|
2008
|
-
`, Os = c(S)`align-items:flex-start;line-height:140%;white-space:pre-wrap;padding:0 12px;`;
|
|
2009
|
-
function Ls(e) {
|
|
2010
|
-
const { stringSet: t } = M(), n = Pn(e) ? /* @__PURE__ */ r.createElement(Kt, { ...e }) : null;
|
|
2011
|
-
return e.messageType === "user" ? n : e.messageType === "file" ? e.file.type.startsWith("image") ? /* @__PURE__ */ r.createElement(ks, { ...e }, n) : /* @__PURE__ */ r.createElement(_s, { ...e }, n) : /* @__PURE__ */ r.createElement(Kt, { ...e, message: t.UNKNOWN__UNKNOWN_MESSAGE_TYPE });
|
|
2012
|
-
}
|
|
2013
|
-
function Rs({ sendingStatus: e }) {
|
|
2014
|
-
const t = mt();
|
|
2015
|
-
switch (e) {
|
|
2016
|
-
case "pending":
|
|
2017
|
-
return /* @__PURE__ */ r.createElement(Ns, { size: 16 }, /* @__PURE__ */ r.createElement($, { type: "spinner", color: t.colors.messageOutgoing.background, size: 16 }));
|
|
2018
|
-
case "failed":
|
|
2019
|
-
return /* @__PURE__ */ r.createElement("div", { style: { marginBottom: 2 } }, /* @__PURE__ */ r.createElement($, { type: "error", color: u.themedColor.error, size: 16 }));
|
|
2020
|
-
case "scheduled":
|
|
2021
|
-
case "canceled":
|
|
2022
|
-
return null;
|
|
2023
|
-
default:
|
|
2024
|
-
return /* @__PURE__ */ r.createElement("div", null, /* @__PURE__ */ r.createElement($, { type: "chevron-down" }));
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
const Ns = c(Un)`margin-bottom:2px;width:16px;height:16px;`;
|
|
2028
|
-
function Ds({ createdAt: e }) {
|
|
2029
|
-
const { stringSet: t, format: n } = M();
|
|
2030
|
-
return e ? /* @__PURE__ */ r.createElement(S, { variant: "caption4", color: u.themedColor.textLowEmphasis }, n(e, t.DATE_FORMAT__MESSAGE_TIMESTAMP)) : null;
|
|
2031
|
-
}
|
|
2032
|
-
const _t = Ce({
|
|
2033
|
-
template: Bs,
|
|
2034
|
-
components: {
|
|
2035
|
-
SendingStatus: Rs,
|
|
2036
|
-
SentTime: Ds,
|
|
2037
|
-
MessageBody: Ls
|
|
2038
|
-
}
|
|
2039
|
-
});
|
|
2040
|
-
function Bs(e) {
|
|
2041
|
-
const { components: t } = _t.useContext(), n = e.sendingStatus === "succeeded", o = e.groupType === "bottom" || e.groupType === "single";
|
|
2042
|
-
return /* @__PURE__ */ r.createElement(Ps, { $marginBottom: xt(e.groupType) }, /* @__PURE__ */ r.createElement(Fs, null, /* @__PURE__ */ r.createElement(t.MessageBody, { ...e })), o && /* @__PURE__ */ r.createElement(Hs, { $extraEndPadding: 8 }, n ? /* @__PURE__ */ r.createElement(t.SentTime, { ...e }) : /* @__PURE__ */ r.createElement(t.SendingStatus, { ...e })));
|
|
2043
|
-
}
|
|
2044
|
-
const Ps = c.div`display:flex;flex:1;flex-direction:column;align-items:flex-end;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
|
|
2045
|
-
`, zn = c.div`display:flex;align-self:stretch;justify-content:flex-end;${({ $startPadding: e = Q, $endPadding: t = Q, $extraEndPadding: n = 0 }) => `padding-inline: ${e}px ${t + n}px;`};
|
|
2046
|
-
`, Fs = c(zn)``, Hs = c(zn)`margin-top:${Bn}px;`;
|
|
2047
|
-
function Us(e) {
|
|
2048
|
-
return e.messageType !== "admin" ? null : /* @__PURE__ */ r.createElement(zs, null, /* @__PURE__ */ r.createElement(S, { variant: "caption2", color: u.themedColor.textMidEmphasis }, Ws(bn.sanitize(e.message))));
|
|
2049
|
-
}
|
|
2050
|
-
const zs = c.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color:inherit;}`, Ws = (e) => {
|
|
2051
|
-
const t = /\[([^\]]+)\]\((https?:\/\/[^\s]+)\)/g, n = [];
|
|
2052
|
-
let o = 0;
|
|
2053
|
-
return e.replace(t, (i, a, s, l) => (n.push(e.slice(o, l)), n.push(
|
|
2054
|
-
/* @__PURE__ */ r.createElement("a", { key: s, href: s, target: "_blank", rel: ft }, a)
|
|
2055
|
-
), o = l + i.length, i)), n.push(e.slice(o)), n;
|
|
2056
|
-
}, Vs = ({ submitted: e, defaultValue: t, value: n, onChange: o }) => {
|
|
2057
|
-
const { stringSet: i } = M();
|
|
2058
|
-
return R(() => {
|
|
2059
|
-
typeof n > "u" && typeof t == "boolean" && (o == null || o(t));
|
|
2060
|
-
}, [n, t]), /* @__PURE__ */ r.createElement(Gs, null, /* @__PURE__ */ r.createElement(S, { variant: "caption2", color: u.themedColor.textMidEmphasis }, i.CSAT_CRE_TITLE), /* @__PURE__ */ r.createElement("div", null, /* @__PURE__ */ r.createElement(
|
|
2061
|
-
Zt,
|
|
2062
|
-
{
|
|
2063
|
-
checked: n === !0,
|
|
2064
|
-
label: i.CSAT_CRE_SOLVED,
|
|
2065
|
-
disabled: e,
|
|
2066
|
-
onClick: () => o == null ? void 0 : o(!0)
|
|
2067
|
-
}
|
|
2068
|
-
), /* @__PURE__ */ r.createElement(
|
|
2069
|
-
Zt,
|
|
2070
|
-
{
|
|
2071
|
-
checked: n === !1,
|
|
2072
|
-
label: i.CSAT_CRE_NOT_SOLVED,
|
|
2073
|
-
disabled: e,
|
|
2074
|
-
onClick: () => o == null ? void 0 : o(!1)
|
|
2075
|
-
}
|
|
2076
|
-
)));
|
|
2077
|
-
}, Zt = ({ onClick: e, checked: t, label: n, disabled: o }) => {
|
|
2078
|
-
const i = t ? u.color.primary.main : o ? u.themedColor.textDisabled : u.themedColor.textLowEmphasis, a = t ? u.themedColor.textHighEmphasis : o ? u.themedColor.textLowEmphasis : u.themedColor.textHighEmphasis;
|
|
2079
|
-
return /* @__PURE__ */ r.createElement(js, { onClick: e, disabled: o }, /* @__PURE__ */ r.createElement($, { size: 24, type: t ? "radio-on" : "radio-off", color: i }), /* @__PURE__ */ r.createElement(S, { variant: "caption2", color: a }, n));
|
|
2080
|
-
}, Gs = c.div`display:flex;flex-direction:column;gap:8px;`, js = c.button`all:unset;display:flex;align-items:center;justify-content:flex-start;gap:2px;span{line-height:initial;}&:enabled{cursor:pointer;}`, Ks = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", id: "csat1", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.08301 20C2.08301 10.1049 10.1046 2.08334 19.9997 2.08334C29.8948 2.08334 37.9163 10.1049 37.9163 20C37.9163 29.8952 29.8948 37.9167 19.9997 37.9167C10.1046 37.9167 2.08301 29.8952 2.08301 20Z", fill: "#E0E0E0" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.5824 29.3328C13.1344 29.7473 13.918 29.636 14.3326 29.084C15.6269 27.3607 17.6835 26.25 19.9997 26.25C22.316 26.25 24.3727 27.3607 25.6668 29.084C26.0815 29.636 26.865 29.7473 27.4172 29.3328C27.9692 28.9182 28.0805 28.1347 27.6658 27.5825C25.9198 25.2577 23.1357 23.75 19.9997 23.75C16.8638 23.75 14.0797 25.2577 12.3336 27.5825C11.919 28.1347 12.0304 28.9182 12.5824 29.3328Z", fill: "black", fillOpacity: 0.12 }), /* @__PURE__ */ r.createElement("path", { d: "M28.4449 13.7707C29.1324 13.8328 29.64 14.4406 29.578 15.1281C29.516 15.8153 28.909 16.3221 28.2219 16.2608C28.2219 16.2608 28.0282 16.2502 27.9267 16.2487C27.7224 16.2457 27.4382 16.2509 27.1224 16.2833C26.7864 16.3177 26.4644 16.3782 26.1799 16.4662L26.304 16.86C26.7792 18.3675 25.5094 19.5813 24.2057 19.5813C23.504 19.5813 22.8319 19.2617 22.4295 18.6857C22.0025 18.0745 21.9417 17.241 22.4075 16.5344C22.7505 16.0143 23.2444 15.3831 23.8959 14.8657C24.8355 14.1195 26.0435 13.8809 26.867 13.7963C27.3024 13.7517 28.0149 13.7319 28.4449 13.7707Z", fill: "black", fillOpacity: 0.12 }), /* @__PURE__ */ r.createElement("path", { d: "M11.5553 13.7707C10.8677 13.8328 10.3601 14.4406 10.4221 15.1281C10.4842 15.8153 11.0912 16.3221 11.7782 16.2608C11.7782 16.2608 11.972 16.2502 12.0734 16.2487C12.2778 16.2457 12.562 16.2509 12.8778 16.2833C13.2137 16.3177 13.5357 16.3782 13.8203 16.4662L13.6962 16.86C13.2209 18.3675 14.4907 19.5813 15.7944 19.5813C16.4962 19.5813 17.1683 19.2617 17.5707 18.6857C17.9975 18.0745 18.0585 17.241 17.5925 16.5344C17.2497 16.0143 16.7557 15.3831 16.1043 14.8657C15.1646 14.1195 13.9566 13.8809 13.1331 13.7963C12.6978 13.7517 11.9853 13.7319 11.5553 13.7707Z", fill: "black", fillOpacity: 0.12 })), Zs = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.08337 19.9999C2.08337 10.1048 10.1049 2.08325 20 2.08325C29.8952 2.08325 37.9167 10.1048 37.9167 19.9999C37.9167 29.8951 29.8952 37.9166 20 37.9166C10.1049 37.9166 2.08337 29.8951 2.08337 19.9999Z", fill: "url(#paint0_linear_159_173206)" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.5828 29.3328C13.1348 29.7473 13.9184 29.636 14.3329 29.084C15.6272 27.3607 17.6839 26.25 20 26.25C22.3164 26.25 24.373 27.3607 25.6672 29.084C26.0819 29.636 26.8654 29.7473 27.4175 29.3328C27.9695 28.9182 28.0809 28.1347 27.6662 27.5825C25.9202 25.2577 23.136 23.75 20 23.75C16.8642 23.75 14.0801 25.2577 12.334 27.5825C11.9194 28.1347 12.0308 28.9182 12.5828 29.3328Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { d: "M28.4454 13.7707C29.1329 13.8328 29.6405 14.4406 29.5785 15.1281C29.5165 15.8153 28.9095 16.3221 28.2224 16.2608C28.2224 16.2608 28.0287 16.2502 27.9272 16.2487C27.7229 16.2457 27.4387 16.2509 27.1229 16.2833C26.7869 16.3177 26.4649 16.3782 26.1804 16.4662L26.3045 16.86C26.7797 18.3675 25.5099 19.5813 24.2062 19.5813C23.5045 19.5813 22.8324 19.2617 22.43 18.6857C22.003 18.0745 21.9422 17.241 22.408 16.5344C22.751 16.0143 23.2449 15.3831 23.8964 14.8657C24.836 14.1195 26.044 13.8809 26.8675 13.7963C27.3029 13.7517 28.0154 13.7319 28.4454 13.7707Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { d: "M11.5549 13.7707C10.8674 13.8328 10.3597 14.4406 10.4218 15.1281C10.4838 15.8153 11.0908 16.3221 11.7779 16.2608C11.7779 16.2608 11.9716 16.2502 12.073 16.2487C12.2774 16.2457 12.5616 16.2509 12.8774 16.2833C13.2134 16.3177 13.5353 16.3782 13.8199 16.4662L13.6958 16.86C13.2205 18.3675 14.4904 19.5813 15.794 19.5813C16.4958 19.5813 17.168 19.2617 17.5703 18.6857C17.9971 18.0745 18.0581 17.241 17.5921 16.5344C17.2493 16.0143 16.7553 15.3831 16.1039 14.8657C15.1643 14.1195 13.9562 13.8809 13.1327 13.7963C12.6974 13.7517 11.9849 13.7319 11.5549 13.7707Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("defs", null, /* @__PURE__ */ r.createElement("linearGradient", { id: "paint0_linear_159_173206", x1: 20, y1: 2.08325, x2: 20, y2: 37.9166, gradientUnits: "userSpaceOnUse" }, /* @__PURE__ */ r.createElement("stop", { stopColor: "#FF2D1D" }), /* @__PURE__ */ r.createElement("stop", { offset: 1, stopColor: "#FFA540" })))), Ys = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ r.createElement("path", { d: "M15 28.333C16.3927 27.2867 18.124 26.6667 20 26.6667C21.876 26.6667 23.6073 27.2867 25 28.333", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ r.createElement("path", { d: "M11.667 13.3511C11.667 13.3511 14.0161 13.139 15.3268 14.18M15.3268 14.18L14.8882 15.5711C14.7153 16.1199 15.1675 16.6667 15.7943 16.6667C16.4531 16.6667 16.8882 16.0723 16.549 15.5579C16.2483 15.102 15.8388 14.5866 15.3268 14.18ZM23.3337 13.3511C23.3337 13.3511 25.6827 13.139 26.9935 14.18M26.9935 14.18L26.555 15.5711C26.382 16.1199 26.8342 16.6667 27.461 16.6667C28.1198 16.6667 28.5548 16.0723 28.2157 15.5579C27.915 15.102 27.5055 14.5866 26.9935 14.18Z", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), qs = (e) => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ r.createElement("path", { d: "M14.249 27.334C15.851 26.13 17.844 25.417 20 25.417c2.156 0 4.149.714 5.751 1.917.553.415.664 1.199.25 1.751-.415.552-1.199.664-1.751.25-1.183-.889-2.652-1.416-4.25-1.416s-3.067.527-4.25 1.416c-.553.414-1.336.302-1.751-.25-.415-.552-.303-1.336.249-1.751Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { d: "M23.445 14.596c-.687.062-1.294-.445-1.356-1.132-.062-.687.445-1.295 1.132-1.357.082-.005.342-.02.482-.022.277-.004.662.002 1.097.047.823.085 2.031.323 2.97 1.07.652.518 1.146 1.15 1.489 1.67.466.706.405 1.54-.022 2.15-.402.576-1.074.896-1.775.896-1.304 0-2.573-1.214-2.098-2.722l.125-.394c-.285-.088-.607-.148-.942-.182-.316-.033-.6-.038-.804-.035-.101.002-.242.01-.294.013Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { d: "M11.779 14.596c-.687.062-1.294-.445-1.356-1.132-.062-.687.445-1.295 1.132-1.357.082-.005.342-.02.482-.022.277-.004.662.002 1.097.047.823.085 2.031.323 2.97 1.07.652.518 1.146 1.15 1.489 1.67.466.706.405 1.54-.022 2.15-.402.576-1.074.896-1.775.896-1.304 0-2.573-1.214-2.098-2.722l.124-.394c-.284-.088-.606-.148-.941-.182-.316-.033-.6-.038-.804-.035-.101.002-.243.01-.294.013Z", fill: "#141B34" })), Js = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ r.createElement("path", { d: "M13.348 15H13.333M26.6663 15H26.6513", stroke: "black", strokeOpacity: 0.12, strokeWidth: 3.33333, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ r.createElement("path", { d: "M15 26.6667H25", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), Xs = (e) => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.25 15c0-1.151.933-2.083 2.083-2.083h.015c1.151 0 2.084.933 2.084 2.083 0 1.151-.933 2.083-2.084 2.083h-.015c-1.15 0-2.083-.933-2.083-2.083ZM24.568 15c0-1.151.933-2.083 2.084-2.083h.015c1.151 0 2.083.933 2.083 2.083 0 1.151-.932 2.083-2.083 2.083h-.015c-1.151 0-2.084-.933-2.084-2.083Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M13.75 26.667c0-.691.56-1.25 1.25-1.25h10c.69 0 1.25.559 1.25 1.25 0 .691-.56 1.25-1.25 1.25h-10c-.69 0-1.25-.559-1.25-1.25Z", fill: "#141B34" })), Qs = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ r.createElement("path", { d: "M13.333 25C14.8532 27.024 17.2735 28.3333 19.9997 28.3333C22.7258 28.3333 25.1462 27.024 26.6663 25", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ r.createElement("path", { d: "M13.348 15H13.333M26.6663 15H26.6513", stroke: "black", strokeOpacity: 0.12, strokeWidth: 3.33333, strokeLinecap: "round", strokeLinejoin: "round" })), ea = (e) => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.583 24.001c.552-.414 1.335-.302 1.75.25 1.294 1.723 3.35 2.834 5.667 2.834s4.373-1.11 5.667-2.834c.415-.552 1.199-.664 1.751-.25.552.415.664 1.199.25 1.751C25.92 28.076 23.136 29.584 20 29.584s-5.92-1.508-7.666-3.832c-.415-.552-.303-1.336.249-1.751Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.25 15c0-1.151.933-2.083 2.083-2.083h.015c1.151 0 2.084.933 2.084 2.083 0 1.151-.933 2.083-2.084 2.083h-.015c-1.15 0-2.083-.933-2.083-2.083ZM24.568 15c0-1.151.933-2.083 2.084-2.083h.015c1.151 0 2.083.933 2.083 2.083 0 1.151-.932 2.083-2.083 2.083h-.015c-1.151 0-2.084-.933-2.084-2.083Z", fill: "#141B34" })), ta = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M19.9997 36.6663C29.2044 36.6663 36.6663 29.2044 36.6663 19.9997C36.6663 10.7949 29.2044 3.33301 19.9997 3.33301C10.7949 3.33301 3.33301 10.7949 3.33301 19.9997C3.33301 29.2044 10.7949 36.6663 19.9997 36.6663Z", fill: "#E0E0E0" }), /* @__PURE__ */ r.createElement("path", { d: "M19.9997 30C23.16 30 25.8145 27.867 26.56 24.9832C26.9068 23.6413 26.4033 23.3333 25.0765 23.3333H14.9228C13.5959 23.3333 13.0925 23.6413 13.4393 24.9832C14.1848 27.867 16.8393 30 19.9997 30Z", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ r.createElement("path", { d: "M11.667 15.8333C11.667 14.4526 12.7863 13.3333 14.167 13.3333C15.5477 13.3333 16.667 14.4526 16.667 15.8333M23.3337 15.8333C23.3337 14.4526 24.453 13.3333 25.8337 13.3333C27.2143 13.3333 28.3337 14.4526 28.3337 15.8333", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), na = (e) => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ r.createElement("g", { clipPath: "url(#clip0_159_173224)" }, /* @__PURE__ */ r.createElement("g", { clipPath: "url(#clip1_159_173224)" }, /* @__PURE__ */ r.createElement("path", { d: "M20 30.624c3.752 0 6.904-2.532 7.789-5.956.412-1.593-.185-1.959-1.76-1.959H13.973c-1.575 0-2.173.366-1.761 1.959.885 3.424 4.037 5.956 7.788 5.956Z", fill: "#141B34" })), /* @__PURE__ */ r.createElement("mask", { id: "mask0_159_173224", style: {
|
|
2081
|
-
maskType: "alpha"
|
|
2082
|
-
}, maskUnits: "userSpaceOnUse", x: 12, y: 22, width: 16, height: 9 }, /* @__PURE__ */ r.createElement("path", { d: "M20 30.624c3.752 0 6.904-2.532 7.789-5.956.412-1.593-.185-1.959-1.76-1.959H13.973c-1.575 0-2.173.366-1.761 1.959.885 3.424 4.037 5.956 7.788 5.956Z", fill: "#141B34" })), /* @__PURE__ */ r.createElement("g", { mask: "url(#mask0_159_173224)" }, /* @__PURE__ */ r.createElement("path", { d: "M20 32.998c3.278 0 5.936-1.594 5.936-3.561 0-1.968-2.658-3.562-5.936-3.562-3.278 0-5.936 1.594-5.936 3.562 0 1.967 2.658 3.561 5.936 3.561Z", fill: "#FF493B" }))), /* @__PURE__ */ r.createElement("path", { d: "M11.667 15.833c0-1.381 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5M23.333 15.833c0-1.381 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5", stroke: "#141B34", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ r.createElement("defs", null, /* @__PURE__ */ r.createElement("clipPath", { id: "clip0_159_173224" }, /* @__PURE__ */ r.createElement("rect", { width: 15.83, height: 7.915, fill: "white", transform: "translate(12.085 22.709)" })), /* @__PURE__ */ r.createElement("clipPath", { id: "clip1_159_173224" }, /* @__PURE__ */ r.createElement("rect", { width: 15.83, height: 7.915, fill: "white", transform: "translate(12.085 22.709)" })))), ra = [
|
|
2083
|
-
{
|
|
2084
|
-
value: 1,
|
|
2085
|
-
Icon: {
|
|
2086
|
-
Active: Zs,
|
|
2087
|
-
Inactive: Ks
|
|
2088
|
-
},
|
|
2089
|
-
isActive: (e) => e <= 1,
|
|
2090
|
-
getTooltip: (e) => e.CSAT5_RATING_SCORE_1
|
|
2091
|
-
},
|
|
2092
|
-
{
|
|
2093
|
-
value: 2,
|
|
2094
|
-
Icon: {
|
|
2095
|
-
Active: qs,
|
|
2096
|
-
Inactive: Ys
|
|
2097
|
-
},
|
|
2098
|
-
isActive: (e) => e === 2,
|
|
2099
|
-
getTooltip: (e) => e.CSAT5_RATING_SCORE_2
|
|
2100
|
-
},
|
|
2101
|
-
{
|
|
2102
|
-
value: 3,
|
|
2103
|
-
Icon: {
|
|
2104
|
-
Active: Xs,
|
|
2105
|
-
Inactive: Js
|
|
2106
|
-
},
|
|
2107
|
-
isActive: (e) => e === 3,
|
|
2108
|
-
getTooltip: (e) => e.CSAT5_RATING_SCORE_3
|
|
2109
|
-
},
|
|
2110
|
-
{
|
|
2111
|
-
value: 4,
|
|
2112
|
-
Icon: {
|
|
2113
|
-
Active: ea,
|
|
2114
|
-
Inactive: Qs
|
|
2115
|
-
},
|
|
2116
|
-
isActive: (e) => e === 4,
|
|
2117
|
-
getTooltip: (e) => e.CSAT5_RATING_SCORE_4
|
|
2118
|
-
},
|
|
2119
|
-
{
|
|
2120
|
-
value: 5,
|
|
2121
|
-
Icon: {
|
|
2122
|
-
Active: na,
|
|
2123
|
-
Inactive: ta
|
|
2124
|
-
},
|
|
2125
|
-
isActive: (e) => 5 <= e,
|
|
2126
|
-
getTooltip: (e) => e.CSAT5_RATING_SCORE_5
|
|
2127
|
-
}
|
|
2128
|
-
], oa = () => ra, Wn = ({ label: e, children: t, position: n = "top", disabled: o }) => o ? t : /* @__PURE__ */ r.createElement(ct, null, t, /* @__PURE__ */ r.createElement(aa, { $position: n }, /* @__PURE__ */ r.createElement(la, { variant: "caption1" }, e), /* @__PURE__ */ r.createElement(ia, { $position: n }))), ia = ({ $position: e }) => /* @__PURE__ */ r.createElement(
|
|
2129
|
-
"svg",
|
|
2130
|
-
{
|
|
2131
|
-
style: { transform: e === "top" ? "rotate(0)" : "rotate(180deg)" },
|
|
2132
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2133
|
-
width: "12",
|
|
2134
|
-
height: "6",
|
|
2135
|
-
viewBox: "0 0 12 6",
|
|
2136
|
-
fill: "none"
|
|
2137
|
-
},
|
|
2138
|
-
/* @__PURE__ */ r.createElement("path", { d: "M6 6L0 0h12L6 6Z", fill: u.themedColor.textHighEmphasis })
|
|
2139
|
-
), sa = {
|
|
2140
|
-
top: k`flex-direction:column;top:0;transform:translate(-50%,-100%);`,
|
|
2141
|
-
bottom: k`flex-direction:column-reverse;bottom:0;transform:translate(-50%,100%);`
|
|
2142
|
-
}, ct = c.div`position:relative;`, aa = c.div`display:flex;align-items:center;position:absolute;left:50%;z-index:${he.TOOLTIP};${({ $position: e }) => sa[e]}opacity:0;transition:opacity 0.2s ease-in-out;pointer-events:none;${ct}:hover &,${ct}:focus-within &{opacity:1;}`, la = c(S)`padding:6px 8px;background:${u.themedColor.textHighEmphasis};color:${u.themedColor.textHighEmphasisInverse};border-radius:4px;font-size:12px;white-space:nowrap;`, ca = ({ submitted: e, value: t, onChange: n }) => {
|
|
2143
|
-
const { stringSet: o } = M(), i = oa(), a = typeof t == "number";
|
|
2144
|
-
return /* @__PURE__ */ r.createElement(da, null, /* @__PURE__ */ r.createElement(S, { variant: "caption2", color: u.themedColor.textMidEmphasis }, o.CSAT_RATING_TITLE), /* @__PURE__ */ r.createElement(ua, null, i.map((s) => /* @__PURE__ */ r.createElement(Wn, { disabled: e, key: s.value, label: s.getTooltip(o) }, /* @__PURE__ */ r.createElement(
|
|
2145
|
-
ma,
|
|
2146
|
-
{
|
|
2147
|
-
disabled: e,
|
|
2148
|
-
onClick: () => n(s.value),
|
|
2149
|
-
$inactive: a && !s.isActive(t)
|
|
2150
|
-
},
|
|
2151
|
-
a ? s.isActive(t) ? /* @__PURE__ */ r.createElement(s.Icon.Active, null) : /* @__PURE__ */ r.createElement(s.Icon.Inactive, null) : /* @__PURE__ */ r.createElement(s.Icon.Active, null)
|
|
2152
|
-
)))));
|
|
2153
|
-
}, da = c.div`display:flex;flex-direction:column;gap:8px;`, ua = c.div`display:flex;justify-content:space-between;width:100%;max-width:320px;`, ma = c.button`background-color:transparent;border:none;border-radius:4px;padding:0;display:flex;align-items:center;justify-content:center;box-sizing:border-box;&:enabled:hover{cursor:pointer;background-color:${u.color.background200};${B.dark`
|
|
2154
|
-
background-color: ${u.color.background500};
|
|
2155
|
-
`}
|
|
2156
|
-
}
|
|
2157
|
-
|
|
2158
|
-
${({ $inactive: e, theme: t }) => e && t.selectedTheme === "dark" && ga};
|
|
2159
|
-
`, ga = k`[fill]{fill:white;fill-opacity:0.12;}[stroke]{stroke:white;stroke-opacity:0.12;}`, pa = ({ submitted: e, value: t = "", onChange: n }) => {
|
|
2160
|
-
const { stringSet: o } = M();
|
|
2161
|
-
return e && !t ? null : /* @__PURE__ */ r.createElement(
|
|
2162
|
-
ha,
|
|
2163
|
-
{
|
|
2164
|
-
disabled: e,
|
|
2165
|
-
maxLength: 255,
|
|
2166
|
-
value: t,
|
|
2167
|
-
onChange: (i) => n(i.target.value),
|
|
2168
|
-
placeholder: o.CSAT_REASON_PLACEHOLDER
|
|
2169
|
-
}
|
|
2170
|
-
);
|
|
2171
|
-
}, ha = c.input`box-sizing:border-box;width:100%;border-radius:4px;padding:10px 16px;font-size:14px;font-weight:400;font-style:normal;border:unset;&:focus{outline:none;}color:${u.themedColor.textHighEmphasis};&::placeholder{color:${u.themedColor.textLowEmphasis};}background-color:${u.color.background50};${B.dark`
|
|
2172
|
-
background-color: ${u.themedColor.textDisabled};
|
|
2173
|
-
`}
|
|
2174
|
-
|
|
2175
|
-
&:disabled {
|
|
2176
|
-
cursor: not-allowed;
|
|
2177
|
-
color: ${u.themedColor.textLowEmphasis};
|
|
2178
|
-
background-color: ${u.color.background200};
|
|
2179
|
-
${B.dark`
|
|
2180
|
-
color: ${u.color.ondark.textDisabled};
|
|
2181
|
-
background-color: ${u.themedColor.textDisabled};
|
|
2182
|
-
`}
|
|
2183
|
-
}
|
|
2184
|
-
`, fa = ({ submitted: e }) => {
|
|
2185
|
-
const { stringSet: t } = M();
|
|
2186
|
-
return e ? /* @__PURE__ */ r.createElement(S, { variant: "h2", color: u.themedColor.textHighEmphasis }, t.CSAT_TITLE_SUBMITTED) : /* @__PURE__ */ r.createElement(S, { variant: "h2", color: u.themedColor.textHighEmphasis }, t.CSAT_TITLE_UNSUBMITTED);
|
|
2187
|
-
};
|
|
2188
|
-
var me = /* @__PURE__ */ ((e) => (e.AI_AGENT_CSAT_5 = "AI_AGENT_CSAT_5", e.AI_AGENT_CSAT_5_WITH_CRE = "AI_AGENT_CSAT_5_WITH_CRE", e))(me || {});
|
|
2189
|
-
const ba = (e) => gr((t, n) => ({ ...t, ...n }), e), Yt = ({
|
|
2190
|
-
type: e,
|
|
2191
|
-
renderSubmitButton: t,
|
|
2192
|
-
initialCsat: n,
|
|
2193
|
-
initialCsatReason: o,
|
|
2194
|
-
initialIsResolved: i
|
|
2195
|
-
}) => {
|
|
2196
|
-
const [a, s] = ba({
|
|
2197
|
-
csatType: e,
|
|
2198
|
-
csat: n,
|
|
2199
|
-
csatReason: o,
|
|
2200
|
-
isResolved: i
|
|
2201
|
-
}), l = typeof n == "number" ? "submitted" : e === me.AI_AGENT_CSAT_5 && typeof a.csat == "number" || e === me.AI_AGENT_CSAT_5_WITH_CRE && typeof a.csat == "number" && typeof a.isResolved == "boolean" ? "submittable" : "unsubmittable", d = { state: l, submitted: l === "submitted" };
|
|
2202
|
-
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(xa, null, /* @__PURE__ */ r.createElement(fa, { ...d }), e === me.AI_AGENT_CSAT_5_WITH_CRE && /* @__PURE__ */ r.createElement(
|
|
2203
|
-
Vs,
|
|
2204
|
-
{
|
|
2205
|
-
...d,
|
|
2206
|
-
defaultValue: i,
|
|
2207
|
-
value: a.isResolved,
|
|
2208
|
-
onChange: (g) => s({ isResolved: g })
|
|
2209
|
-
}
|
|
2210
|
-
), /* @__PURE__ */ r.createElement(ca, { ...d, value: a.csat, onChange: (g) => s({ csat: g }) }), a.csat && /* @__PURE__ */ r.createElement(
|
|
2211
|
-
pa,
|
|
2212
|
-
{
|
|
2213
|
-
...d,
|
|
2214
|
-
value: a.csatReason,
|
|
2215
|
-
onChange: (g) => s({ csatReason: g })
|
|
2216
|
-
}
|
|
2217
|
-
)), l !== "submitted" && t({ state: l, params: a }));
|
|
2218
|
-
}, xa = c.div`display:flex;flex-direction:column;gap:12px;`, Ea = () => {
|
|
2219
|
-
const { stringSet: e } = M();
|
|
2220
|
-
return /* @__PURE__ */ r.createElement(S, { variant: "body2", color: u.themedColor.textMidEmphasis, style: { textAlign: "center" } }, e.CSAT_SUBMISSION_EXPIRED);
|
|
2221
|
-
}, va = (e) => {
|
|
2222
|
-
if (e.messageType !== "admin.csat")
|
|
2223
|
-
throw new Error("Invalid message type");
|
|
2224
|
-
const t = Mr(), { stringSet: n } = M(), { extendedMessagePayload: o, csat: i, csatReason: a, csatExpireAt: s, isResolvedWhenDeterminedByUser: l, onSubmitCSAT: d } = e, { visibility: g, type: m } = (o == null ? void 0 : o.csat) ?? {};
|
|
2225
|
-
if (!g || !m || !me[m]) return null;
|
|
2226
|
-
const p = m === me.AI_AGENT_CSAT_5 || m === me.AI_AGENT_CSAT_5_WITH_CRE ? Yt : () => null, h = (b) => {
|
|
2227
|
-
b.csat && !qt(s) ? d({
|
|
2228
|
-
csatType: b.csatType,
|
|
2229
|
-
csat: b.csat,
|
|
2230
|
-
csatReason: b.csatReason,
|
|
2231
|
-
isResolved: b.isResolved
|
|
2232
|
-
}) : t();
|
|
2233
|
-
};
|
|
2234
|
-
return /* @__PURE__ */ r.createElement(ya, null, !i && qt(s) ? /* @__PURE__ */ r.createElement(Ea, null) : /* @__PURE__ */ r.createElement(
|
|
2235
|
-
p,
|
|
2236
|
-
{
|
|
2237
|
-
type: m,
|
|
2238
|
-
initialCsat: i,
|
|
2239
|
-
initialCsatReason: a,
|
|
2240
|
-
initialIsResolved: l,
|
|
2241
|
-
renderSubmitButton: ({ state: b, params: x }) => /* @__PURE__ */ r.createElement(Ca, { disabled: b !== "submittable", onClick: () => h(x) }, /* @__PURE__ */ r.createElement(S, { variant: "button" }, n.CSAT_SUBMIT_LABEL))
|
|
2242
|
-
}
|
|
2243
|
-
));
|
|
2244
|
-
}, ya = c.div`display:flex;flex-direction:column;background-color:${({ theme: e }) => e.colors.csat.background};border-radius:16px;gap:16px;padding:24px;`, Ca = c.button`all:unset;background-color:${({ theme: e }) => e.colors.base.primary};color:${({ theme: e }) => e.colors.base.primaryContrastContent};border-radius:6px;padding:10px 20px;display:flex;align-items:center;justify-content:center;cursor:pointer;&:hover{background-color:${u.color.primary.dark};}&:disabled{color:${u.color.ondark.textLowEmphasis};background-color:${u.themedColor.textDisabled};cursor:not-allowed;}`;
|
|
2245
|
-
function qt(e) {
|
|
2246
|
-
return !!e && e < Date.now();
|
|
2247
|
-
}
|
|
2248
|
-
const St = Ce({
|
|
2249
|
-
template: Ta,
|
|
2250
|
-
components: {
|
|
2251
|
-
AdminMessage: Us,
|
|
2252
|
-
CSATMessage: va
|
|
2253
|
-
}
|
|
2254
|
-
});
|
|
2255
|
-
function Ta(e) {
|
|
2256
|
-
const { components: t } = St.useContext(), n = Tt(() => e.messageType === "admin" ? /* @__PURE__ */ r.createElement(t.AdminMessage, { ...e }) : e.messageType === "admin.csat" ? /* @__PURE__ */ r.createElement(t.CSATMessage, { ...e }) : null);
|
|
2257
|
-
return /* @__PURE__ */ r.createElement(_a, { $marginBottom: xt(e.groupType) }, n);
|
|
2258
|
-
}
|
|
2259
|
-
const _a = c.div`padding-inline:${Q}px;margin-bottom:${({ $marginBottom: e }) => e}px;`, Jt = {
|
|
2260
|
-
file: "attach",
|
|
2261
|
-
snippet: "snippet",
|
|
2262
|
-
site: "website",
|
|
2263
|
-
sb_sprinklr: "sprinklr",
|
|
2264
|
-
sb_salesforce: "salesforce",
|
|
2265
|
-
sb_confluence: "confluence",
|
|
2266
|
-
sb_zendesk: "zendesk",
|
|
2267
|
-
sb_desk: "snippet"
|
|
2268
|
-
// TODO: request icon
|
|
2269
|
-
}, Sa = ({
|
|
2270
|
-
actionbook: e,
|
|
2271
|
-
functionCalls: t,
|
|
2272
|
-
groundedness: n,
|
|
2273
|
-
agentMessageTemplates: o,
|
|
2274
|
-
onClickActionbook: i,
|
|
2275
|
-
onClickFunctionCall: a,
|
|
2276
|
-
onClickFunctionCallDetail: s,
|
|
2277
|
-
onClickGroundedness: l,
|
|
2278
|
-
onClickAgentMessageTemplate: d,
|
|
2279
|
-
bottomContent: g,
|
|
2280
|
-
renderCustomGroundednessIcon: m = (h) => h.default,
|
|
2281
|
-
style: p = {}
|
|
2282
|
-
}) => {
|
|
2283
|
-
const {
|
|
2284
|
-
// Note: This component is used with the dashboard, so cssVars should not be used.
|
|
2285
|
-
iconColor: h = "#000000",
|
|
2286
|
-
textColor: b = "#000000",
|
|
2287
|
-
highlightColor: x = kn.DEFAULT_PRIMARY
|
|
2288
|
-
} = p;
|
|
2289
|
-
return /* @__PURE__ */ r.createElement(Xt, null, e && /* @__PURE__ */ r.createElement(Xt, null, /* @__PURE__ */ r.createElement(Ke, null, /* @__PURE__ */ r.createElement(Ue, null, /* @__PURE__ */ r.createElement($, { size: 16, type: "actionbook", color: h })), /* @__PURE__ */ r.createElement(
|
|
2290
|
-
He,
|
|
2291
|
-
{
|
|
2292
|
-
$clickable: !!i,
|
|
2293
|
-
$highlightColor: x,
|
|
2294
|
-
variant: "body2",
|
|
2295
|
-
color: b,
|
|
2296
|
-
onClick: () => i == null ? void 0 : i(e)
|
|
2297
|
-
},
|
|
2298
|
-
e.name
|
|
2299
|
-
))), t == null ? void 0 : t.map((v) => /* @__PURE__ */ r.createElement(rt, { key: v.key }, /* @__PURE__ */ r.createElement(Ue, null, /* @__PURE__ */ r.createElement($, { size: 16, type: "function", color: h })), /* @__PURE__ */ r.createElement(Ke, null, /* @__PURE__ */ r.createElement(
|
|
2300
|
-
He,
|
|
2301
|
-
{
|
|
2302
|
-
$clickable: !!i,
|
|
2303
|
-
$highlightColor: x,
|
|
2304
|
-
variant: "body2",
|
|
2305
|
-
color: b,
|
|
2306
|
-
onClick: () => a == null ? void 0 : a(v)
|
|
2307
|
-
},
|
|
2308
|
-
v.name
|
|
2309
|
-
), /* @__PURE__ */ r.createElement(ka, { role: "button", onClick: () => s == null ? void 0 : s(v) }, /* @__PURE__ */ r.createElement(S, { variant: "body2", color: x }, "View details"), /* @__PURE__ */ r.createElement($, { type: "chevron-right", size: 16, color: x }))))), n == null ? void 0 : n.map((v) => /* @__PURE__ */ r.createElement(rt, { key: v.id }, /* @__PURE__ */ r.createElement(Ue, null, m({
|
|
2310
|
-
default: /* @__PURE__ */ r.createElement($, { size: 16, type: Jt[v.source_type] ?? Jt.snippet, color: h }),
|
|
2311
|
-
sourceType: v.source_type
|
|
2312
|
-
})), /* @__PURE__ */ r.createElement(
|
|
2313
|
-
He,
|
|
2314
|
-
{
|
|
2315
|
-
$clickable: !!l,
|
|
2316
|
-
$highlightColor: x,
|
|
2317
|
-
variant: "body2",
|
|
2318
|
-
color: b,
|
|
2319
|
-
onClick: () => l == null ? void 0 : l(v)
|
|
2320
|
-
},
|
|
2321
|
-
v.preview_title
|
|
2322
|
-
))), o == null ? void 0 : o.map((v) => /* @__PURE__ */ r.createElement(rt, { key: v.key }, /* @__PURE__ */ r.createElement(Ue, null, /* @__PURE__ */ r.createElement($, { size: 16, type: "template", color: h })), /* @__PURE__ */ r.createElement(
|
|
2323
|
-
He,
|
|
2324
|
-
{
|
|
2325
|
-
$clickable: !!d,
|
|
2326
|
-
$highlightColor: x,
|
|
2327
|
-
variant: "body2",
|
|
2328
|
-
color: b,
|
|
2329
|
-
onClick: () => d == null ? void 0 : d(v)
|
|
2330
|
-
},
|
|
2331
|
-
v.name
|
|
2332
|
-
))), g);
|
|
2333
|
-
}, wa = c(S)`font-weight:400;`, He = c(wa)`${({ $clickable: e, $highlightColor: t }) => e && k`
|
|
2334
|
-
cursor: pointer;
|
|
2335
|
-
text-decoration: underline;
|
|
2336
|
-
&:hover {
|
|
2337
|
-
color: ${t};
|
|
2338
|
-
}
|
|
2339
|
-
`}
|
|
2340
|
-
`, Ue = c.div`display:flex;align-items:center;justify-content:center;flex-shrink:0;`, Ke = c.div`display:flex;gap:8px;align-items:center;`, ka = c(Ke)`cursor:pointer;gap:4px;`, rt = c(Ke)`flex-direction:row;align-items:center;`, Xt = c.div`display:flex;gap:4px;flex-direction:column;align-items:flex-start;`, Vn = ye(
|
|
2341
|
-
null
|
|
2342
|
-
);
|
|
2343
|
-
function Aa({
|
|
2344
|
-
isDashboardActionbookTester: e = !1,
|
|
2345
|
-
children: t
|
|
2346
|
-
}) {
|
|
2347
|
-
return /* @__PURE__ */ r.createElement(Vn.Provider, { value: { isDashboardActionbookTester: e } }, e && /* @__PURE__ */ r.createElement(Ia, null), t);
|
|
2348
|
-
}
|
|
2349
|
-
const wt = () => {
|
|
2350
|
-
const e = J(Vn);
|
|
2351
|
-
if (!e) throw new Error("_UNSAFE_INTERNAL_DashboardActionbookTesterProvider not found");
|
|
2352
|
-
return e;
|
|
2353
|
-
}, Ia = () => /* @__PURE__ */ r.createElement(ve.Template, { template: $a }, /* @__PURE__ */ r.createElement(ve.MessageLogs, { component: Ma })), $a = (e) => /* @__PURE__ */ r.createElement(Hn, { ...e, testerMode: !0, maxBodyWidth: Dn }), Ma = ({ extendedMessagePayload: e = {} }) => {
|
|
2354
|
-
const { handlers: t } = N(), { manual: n, groundedness: o, function_calls: i, agent_message_templates: a, is_thinking: s } = e;
|
|
2355
|
-
return s || !n && !(o != null && o.length) && !(i != null && i.length) && !(a != null && a.length) ? /* @__PURE__ */ r.createElement(r.Fragment, null) : /* @__PURE__ */ r.createElement(Oa, null, /* @__PURE__ */ r.createElement(La, { width: 4 }), /* @__PURE__ */ r.createElement(
|
|
2356
|
-
Sa,
|
|
2357
|
-
{
|
|
2358
|
-
actionbook: n,
|
|
2359
|
-
functionCalls: i,
|
|
2360
|
-
groundedness: o,
|
|
2361
|
-
agentMessageTemplates: a,
|
|
2362
|
-
onClickFunctionCallDetail: t == null ? void 0 : t.onFunctionCallDetailClick,
|
|
2363
|
-
style: {
|
|
2364
|
-
iconColor: u.themedColor.textHighEmphasis,
|
|
2365
|
-
textColor: u.themedColor.textHighEmphasis,
|
|
2366
|
-
barColor: u.themedColor.textDisabled
|
|
2367
|
-
},
|
|
2368
|
-
bottomContent: /* @__PURE__ */ r.createElement(Ra, { variant: "caption2", color: u.themedColor.textLowEmphasis }, "Only visible in the tester")
|
|
2369
|
-
}
|
|
2370
|
-
));
|
|
2371
|
-
}, Oa = c.div`display:flex;gap:16px;margin:16px ${Q}px 0;align-self:stretch;`, La = c.div`width:${({ width: e }) => e}px;background-color:${u.themedColor.textDisabled};border-radius:100px;flex-shrink:0;`, Ra = c(S)`margin-top:5px;`, kt = {
|
|
2372
|
-
isStreaming(e) {
|
|
2373
|
-
const t = Ut(e.data);
|
|
2374
|
-
return typeof t == "object" ? !!t.stream : !1;
|
|
2375
|
-
},
|
|
2376
|
-
isWelcomeMessage(e, t) {
|
|
2377
|
-
var n;
|
|
2378
|
-
if (((n = e.extendedMessagePayload) == null ? void 0 : n.bot_message_type) === "welcome")
|
|
2379
|
-
return !0;
|
|
2380
|
-
if ((e.isUserMessage() || e.isFileMessage()) && e.sender.userId === t) {
|
|
2381
|
-
const o = Ut(e.data);
|
|
2382
|
-
return !(o != null && o.respond_mesg_id) && !(o != null && o.stream);
|
|
2383
|
-
}
|
|
2384
|
-
return !1;
|
|
2385
|
-
}
|
|
2386
|
-
};
|
|
2387
|
-
function Na(e) {
|
|
2388
|
-
return "sendingStatus" in e ? e.sendingStatus === "succeeded" ? String(e.messageId) : e.reqId : String(e.messageId);
|
|
2389
|
-
}
|
|
2390
|
-
const Da = (e, t, n, o = !0) => {
|
|
2391
|
-
if (!o || !e.isUserMessage() && !e.isFileMessage())
|
|
2392
|
-
return "single";
|
|
2393
|
-
const i = () => {
|
|
2394
|
-
if (!t || !t.isUserMessage() && !t.isFileMessage()) return !1;
|
|
2395
|
-
const d = t.sender.userId === e.sender.userId, g = Dt(t.createdAt, e.createdAt);
|
|
2396
|
-
return d && g;
|
|
2397
|
-
}, a = () => {
|
|
2398
|
-
if (!n || !n.isUserMessage() && !n.isFileMessage()) return !1;
|
|
2399
|
-
const d = n.sender.userId === e.sender.userId, g = Dt(n.createdAt, e.createdAt);
|
|
2400
|
-
return d && g;
|
|
2401
|
-
}, s = i(), l = a();
|
|
2402
|
-
return s && l ? "middle" : s ? "bottom" : l ? "top" : "single";
|
|
2403
|
-
};
|
|
2404
|
-
function Ba(e, t) {
|
|
2405
|
-
return e.filter((n) => kt.isWelcomeMessage(n, t));
|
|
2406
|
-
}
|
|
2407
|
-
function Gn(e, t) {
|
|
2408
|
-
return Pa(e) === t;
|
|
2409
|
-
}
|
|
2410
|
-
function Pa(e) {
|
|
2411
|
-
var t;
|
|
2412
|
-
if (e)
|
|
2413
|
-
return e.isUserMessage() || e.isFileMessage() || e.isMultipleFilesMessage() ? e.sender.userId : ((t = e == null ? void 0 : e.sender) == null ? void 0 : t.userId) ?? void 0;
|
|
2414
|
-
}
|
|
2415
|
-
function Fa(e) {
|
|
2416
|
-
return e.isAdminMessage() ? e.message === "The channel's custom_type was updated." : !1;
|
|
2417
|
-
}
|
|
2418
|
-
const Qt = (e) => !!e && "sender" in e, jn = (e) => e.startsWith("image/"), Kn = (e) => e.startsWith("video/"), en = (e) => jn(e) || Kn(e), ze = {
|
|
2419
|
-
isAdmin: (e) => e.isAdminMessage(),
|
|
2420
|
-
isCSAT: (e) => {
|
|
2421
|
-
var t;
|
|
2422
|
-
return e.isAdminMessage() && !!((t = e.extendedMessagePayload) != null && t.csat);
|
|
2423
|
-
},
|
|
2424
|
-
isIncoming: (e, t) => Qt(e) && e.sender.userId !== t,
|
|
2425
|
-
isOutgoing: (e, t) => Qt(e) && (e.sender.userId === t || e.sendingStatus === Rr.PENDING)
|
|
2426
|
-
}, Zn = ({ rootElementId: e, visible: t, onClose: n, children: o }) => {
|
|
2427
|
-
if (!t) return null;
|
|
2428
|
-
const { rootElement: i } = N(), a = pe(i), s = pe(i, !0);
|
|
2429
|
-
return Hr(
|
|
2430
|
-
/* @__PURE__ */ r.createElement(Ha, { onClick: n }, /* @__PURE__ */ r.createElement(Ua, { onClick: (l) => l.stopPropagation() }, o)),
|
|
2431
|
-
a.getElementById(e) ?? a.getElementById(X.MODAL_ROOT) ?? s.body
|
|
2432
|
-
);
|
|
2433
|
-
}, Ha = c.div`position:fixed;top:0;left:0;width:100%;height:100%;background:${u.color.overlay.dark};display:flex;justify-content:center;align-items:center;z-index:${he.MODAL};`, Ua = c.div`border-radius:4px;overflow:hidden;box-shadow:0 16px 24px 2px rgba(13,13,13,0.12),0 6px 30px 5px rgba(13,13,13,0.08),0 6px 10px -5px rgba(13,13,13,0.04);z-index:${he.MODAL};`, za = c.div`flex-shrink:0;width:${({ $size: e }) => se(e)};height:${({ $size: e }) => se(e)};background-color:${({ theme: e }) => e.colors.base.primary};box-sizing:border-box;padding:6px;border-radius:50%;display:flex;justify-content:center;align-items:center;}`, Wa = c(yt)`path{fill:${({ theme: e }) => e.colors.base.primaryContrastContent};}`;
|
|
2434
|
-
function Yn({ size: e }) {
|
|
2435
|
-
const { aiAgentInfo: t } = F();
|
|
2436
|
-
return t.profileUrl ? /* @__PURE__ */ r.createElement(Ct, { size: e, src: t.profileUrl }) : /* @__PURE__ */ r.createElement(za, { $size: e }, /* @__PURE__ */ r.createElement(Wa, null));
|
|
2437
|
-
}
|
|
2438
|
-
const Va = c.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none;`, Ga = c.div`height:64px;min-height:64px;box-sizing:border-box;display:flex;justify-content:space-between;border-bottom:1px solid ${u.themedColor.textDisabled};background-color:${u.themedColor.bg_50_600};@media screen and (max-width:768px){position:relative;}`, ja = c.div`box-sizing:border-box;display:flex;flex-direction:row;align-items:center;height:64px;padding:16px 20px;width:calc(100% - 128px);`, Ka = c.div`margin-inline-end:8px;`, Za = c.div`max-width:500px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block;@media screen and (max-width:768px){position:absolute;inset-inline-start:64px;top:10px;display:block;max-width:calc(100vw - 240px);}`, Ya = c.div`display:inline-block;margin-inline-start:8px;padding-top:5px;@media screen and (max-width:768px){position:absolute;inset-inline-start:56px;top:24px;}`, qa = c.div`display:flex;width:160px;justify-content:flex-end;`, Ja = c.div`inset-inline-end:0;display:flex;flex-direction:row;`, dt = c.div`width:64px;padding:21px;box-sizing:border-box;cursor:${(e) => e.disabled ? "not-allowed" : "pointer"};`, Xa = c(dt)`border-inline-start:1px solid ${u.themedColor.textDisabled};`, Qa = c.div`width:100%;height:100%;display:flex;align-items:center;justify-content:center;`, el = c.video`max-width:100%;max-height:100%;user-select:none;-webkit-user-drag:none;`, tl = c.img`max-width:90%;max-height:90%;user-select:none;-webkit-user-drag:none;`, nl = c.div`max-width:100%;max-height:100%;display:flex;justify-content:center;align-items:center;`, rl = ({ message: e, onClose: t, onDownloadClick: n }) => {
|
|
2439
|
-
const { sender: o, type: i, url: a, name: s = "", threadInfo: l } = e, { profileUrl: d, nickname: g, userId: m } = o, { userSession: p, aiAgentInfo: h } = F();
|
|
2440
|
-
return /* @__PURE__ */ r.createElement(
|
|
2441
|
-
il,
|
|
2442
|
-
{
|
|
2443
|
-
profileUrl: d,
|
|
2444
|
-
nickname: g,
|
|
2445
|
-
type: i,
|
|
2446
|
-
url: a,
|
|
2447
|
-
name: s,
|
|
2448
|
-
onClose: t,
|
|
2449
|
-
isBotMessage: m === h.userId,
|
|
2450
|
-
isByMe: p.userId === m,
|
|
2451
|
-
disableDelete: l != null && l.replyCount ? l.replyCount > 0 : !1,
|
|
2452
|
-
onDownloadClick: n
|
|
2453
|
-
}
|
|
2454
|
-
);
|
|
2455
|
-
}, ol = ({ profileUrl: e, isBotMessage: t }) => !e && t ? /* @__PURE__ */ r.createElement(Yn, { size: 32 }) : /* @__PURE__ */ r.createElement(Ct, { size: 32, src: e }), il = ({
|
|
2456
|
-
profileUrl: e,
|
|
2457
|
-
isBotMessage: t,
|
|
2458
|
-
nickname: n,
|
|
2459
|
-
name: o,
|
|
2460
|
-
type: i,
|
|
2461
|
-
url: a,
|
|
2462
|
-
isByMe: s,
|
|
2463
|
-
onClose: l,
|
|
2464
|
-
onDelete: d,
|
|
2465
|
-
disableDelete: g,
|
|
2466
|
-
onDownloadClick: m
|
|
2467
|
-
}) => {
|
|
2468
|
-
const { stringSet: p } = M();
|
|
2469
|
-
return /* @__PURE__ */ r.createElement(Zn, { onClose: l, visible: !0, rootElementId: X.MODAL_ROOT }, /* @__PURE__ */ r.createElement(Va, null, /* @__PURE__ */ r.createElement(Ga, null, /* @__PURE__ */ r.createElement(ja, null, /* @__PURE__ */ r.createElement(Ka, null, /* @__PURE__ */ r.createElement(ol, { profileUrl: e, isBotMessage: t })), /* @__PURE__ */ r.createElement(Za, null, /* @__PURE__ */ r.createElement(S, { variant: "h2", color: u.themedColor.textHighEmphasis }, o)), /* @__PURE__ */ r.createElement(Ya, null, /* @__PURE__ */ r.createElement(S, { variant: "body1", color: u.color.ondark.textMidEmphasis }, n))), /* @__PURE__ */ r.createElement(qa, null, en(i) && /* @__PURE__ */ r.createElement(Ja, null, /* @__PURE__ */ r.createElement(dt, { as: "a", href: a, target: "_blank", rel: ft, onClick: m }, /* @__PURE__ */ r.createElement($, { type: "download", color: u.themedColor.textHighEmphasis, size: 24 })), d && s && /* @__PURE__ */ r.createElement(
|
|
2470
|
-
dt,
|
|
2471
|
-
{
|
|
2472
|
-
disabled: g,
|
|
2473
|
-
onClick: () => {
|
|
2474
|
-
g || d();
|
|
2475
|
-
}
|
|
2476
|
-
},
|
|
2477
|
-
/* @__PURE__ */ r.createElement(
|
|
2478
|
-
$,
|
|
2479
|
-
{
|
|
2480
|
-
type: "delete",
|
|
2481
|
-
color: g ? "gray" : u.themedColor.textHighEmphasis,
|
|
2482
|
-
size: 24
|
|
2483
|
-
}
|
|
2484
|
-
)
|
|
2485
|
-
)), /* @__PURE__ */ r.createElement(Xa, { onClick: l }, /* @__PURE__ */ r.createElement($, { type: "close", color: u.themedColor.textHighEmphasis, size: 24 })))), /* @__PURE__ */ r.createElement(Qa, { onClick: (h) => h.currentTarget === h.target && l() }, Kn(i) && /* @__PURE__ */ r.createElement(el, { controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: a, type: i })), jn(i) && /* @__PURE__ */ r.createElement(tl, { src: a, alt: o }), !en(i) && /* @__PURE__ */ r.createElement(nl, null, /* @__PURE__ */ r.createElement(S, { variant: "h1", color: u.themedColor.textHighEmphasis }, p.FILE_VIEWER__UNSUPPORT)))));
|
|
2486
|
-
}, qn = ({
|
|
2487
|
-
className: e,
|
|
2488
|
-
locale: t,
|
|
2489
|
-
date: n = Date.now(),
|
|
2490
|
-
formatString: o = "MMMM dd, yyyy",
|
|
2491
|
-
style: i
|
|
2492
|
-
}) => /* @__PURE__ */ r.createElement(sl, { style: i, className: e }, /* @__PURE__ */ r.createElement(S, { variant: "caption4", color: u.themedColor.textMidEmphasis }, hn(n, o, { locale: t }))), sl = c.div`display:flex;justify-content:center;align-items:center;`, al = pr(function(t, n) {
|
|
2493
|
-
const {
|
|
2494
|
-
messages: o,
|
|
2495
|
-
renderMessage: i,
|
|
2496
|
-
messageTopArea: a,
|
|
2497
|
-
messageBottomArea: s,
|
|
2498
|
-
overlayArea: l,
|
|
2499
|
-
onLoadPrev: d,
|
|
2500
|
-
onLoadNext: g,
|
|
2501
|
-
loadThreshold: m = 0.05,
|
|
2502
|
-
onScrollPosition: p = Ge,
|
|
2503
|
-
depsForResetScrollPositionToBottom: h,
|
|
2504
|
-
scrollPositionRef: b,
|
|
2505
|
-
scrollDistanceFromBottomRef: x,
|
|
2506
|
-
stackDirection: v = "top"
|
|
2507
|
-
} = t, f = n && "current" in n ? n : { current: null }, y = D(!1), _ = D(void 0), w = D(0), O = D(0), ee = D(0), H = b ?? O, le = x ?? ee;
|
|
2508
|
-
ge(() => {
|
|
2509
|
-
f.current && (f.current.scrollTop = f.current.scrollHeight);
|
|
2510
|
-
}, h), ge(() => {
|
|
2511
|
-
f.current && (_.current === "top" && (f.current.scrollTop = f.current.scrollHeight - H.current), _.current === "bottom" && (f.current.scrollTop = w.current), _.current = void 0);
|
|
2512
|
-
}, [f.current, o.length]);
|
|
2513
|
-
const _e = async () => {
|
|
2514
|
-
if (!f.current) return;
|
|
2515
|
-
const E = f.current;
|
|
2516
|
-
if (p(ll(E)), H.current = E.scrollHeight - E.scrollTop, le.current = H.current - E.clientHeight, w.current = E.scrollTop, y.current) return;
|
|
2517
|
-
const U = E.clientHeight * Math.min(Math.max(0, m), 1);
|
|
2518
|
-
E.scrollTop <= U ? (y.current = !0, _.current = "top", await d(), y.current = !1) : E.scrollHeight - E.scrollTop - E.clientHeight <= U ? (y.current = !0, _.current = "bottom", await g(), y.current = !1) : _.current = void 0;
|
|
2519
|
-
};
|
|
2520
|
-
return /* @__PURE__ */ r.createElement(cl, { id: "infinite-list-container" }, /* @__PURE__ */ r.createElement(dl, { id: "infinite-list-inner", ref: f, onScroll: _e }, v === "bottom" && /* @__PURE__ */ r.createElement("div", { style: { flexGrow: 1 } }), a, o.map((E, U) => i({ message: E, index: U })), s), /* @__PURE__ */ r.createElement(ul, { id: "infinite-list-overlay-container" }, /* @__PURE__ */ r.createElement(ml, { id: "infinite-list-overlay" }, l)));
|
|
2521
|
-
});
|
|
2522
|
-
function ll(e) {
|
|
2523
|
-
return e.scrollTop <= 10 ? "top" : e.scrollHeight - (e.scrollTop + e.clientHeight) <= 10 ? "bottom" : "middle";
|
|
2524
|
-
}
|
|
2525
|
-
const cl = c.div`display:flex;position:relative;flex:1;overflow:hidden;`, dl = c.div`display:flex;flex:1;flex-direction:column;overflow-y:auto;scrollbar-color:${u.themedColor.textLowEmphasis}transparent;&::-webkit-scrollbar-thumb:hover{background-color:transparent;}`, ul = c.div`position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;`, ml = c.div`pointer-events:auto;`, gl = ({ className: e, onClick: t }) => /* @__PURE__ */ r.createElement(pl, { className: e, onClick: t, tabIndex: 0 }, /* @__PURE__ */ r.createElement($, { size: 24, type: "chevron-down", color: u.color.primary.main })), pl = c.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:24px;box-shadow:0 2px 8px 0 rgba(0,0,0,0.08),0 4px 6px 0 rgba(0,0,0,0.12);${B.light`
|
|
2526
|
-
background-color: ${u.color.background50};
|
|
2527
|
-
&:hover {
|
|
2528
|
-
background-color: ${u.color.background100};
|
|
2529
|
-
}
|
|
2530
|
-
&:active {
|
|
2531
|
-
background-color: ${u.color.background200};
|
|
2532
|
-
}
|
|
2533
|
-
`}
|
|
2534
|
-
${B.dark`
|
|
2535
|
-
background-color: ${u.color.background400};
|
|
2536
|
-
&:hover {
|
|
2537
|
-
background-color: ${u.color.background500};
|
|
2538
|
-
}
|
|
2539
|
-
&:active {
|
|
2540
|
-
background-color: ${u.color.background700};
|
|
2541
|
-
}
|
|
2542
|
-
`}
|
|
2543
|
-
|
|
2544
|
-
&:focus {
|
|
2545
|
-
outline: none;
|
|
2546
|
-
}
|
|
2547
|
-
`, Jn = () => {
|
|
2548
|
-
const { chatSDK: e } = N(), { channelSource: t } = Y(), [n, o] = T([]);
|
|
2549
|
-
return fn(e, {
|
|
2550
|
-
onTypingStatusUpdated(i) {
|
|
2551
|
-
var a;
|
|
2552
|
-
if (i.url === ((a = t.channel) == null ? void 0 : a.url)) {
|
|
2553
|
-
const s = i.getTypingUsers();
|
|
2554
|
-
o(s);
|
|
2555
|
-
}
|
|
2556
|
-
}
|
|
2557
|
-
}), n;
|
|
2558
|
-
}, hl = () => {
|
|
2559
|
-
const { agentPreviewConfigs: e = {}, aiAgentId: t } = N(), { aiAgentInfo: n } = F(), { stringSet: o, dateLocale: i } = M(), { messageSource: a } = Y(), { Template: s } = ve.useContext(), l = e.welcomeMessages ?? [], d = a.messages, g = Ba(d, t), m = d[g.length + 1], p = g[0] ?? m;
|
|
2560
|
-
return {
|
|
2561
|
-
/**
|
|
2562
|
-
* Returns a list of messages filtered according to business requirements.
|
|
2563
|
-
*/
|
|
2564
|
-
filteredMessages: d.filter((h) => Fa(h) ? !1 : l.length > 0 ? !kt.isWelcomeMessage(h, t) : !0),
|
|
2565
|
-
/**
|
|
2566
|
-
* Determines whether to display the DateSeparator in the data list by comparing it with the welcome messages from Bot Studio.
|
|
2567
|
-
*/
|
|
2568
|
-
shouldShowOriginalDate: (h) => h > 0 || l.length === 0 ? !0 : m && !Sr(m.createdAt, (p == null ? void 0 : p.createdAt) ?? 0),
|
|
2569
|
-
/**
|
|
2570
|
-
* Renders the list of welcome messages from Bot Studio.
|
|
2571
|
-
*/
|
|
2572
|
-
renderAgentPreviewWelcomeMessages: () => l.length === 0 ? null : /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
2573
|
-
qn,
|
|
2574
|
-
{
|
|
2575
|
-
style: { margin: "16px 0" },
|
|
2576
|
-
date: p == null ? void 0 : p.createdAt,
|
|
2577
|
-
locale: i,
|
|
2578
|
-
formatString: o.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR
|
|
2579
|
-
}
|
|
2580
|
-
), l.map((h, b) => {
|
|
2581
|
-
const x = b === l.length - 1, v = g.length !== d.length, f = l.length === 1 ? "single" : b === 0 ? "top" : x || v ? "bottom" : "middle";
|
|
2582
|
-
return /* @__PURE__ */ r.createElement(
|
|
2583
|
-
s,
|
|
2584
|
-
{
|
|
2585
|
-
messageType: "user",
|
|
2586
|
-
message: h.message,
|
|
2587
|
-
sender: n,
|
|
2588
|
-
groupType: f,
|
|
2589
|
-
createdAt: (p == null ? void 0 : p.createdAt) ?? Date.now(),
|
|
2590
|
-
extendedMessagePayload: { suggested_replies: h.suggestedReplies },
|
|
2591
|
-
suggestedRepliesDirection: e.suggestedRepliesDirection,
|
|
2592
|
-
suggestedRepliesVisible: x && !v,
|
|
2593
|
-
isBotMessage: !0,
|
|
2594
|
-
onClickSuggestedReply: async ({ reply: y }) => {
|
|
2595
|
-
a.sendUserMessage({ message: y });
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
|
-
);
|
|
2599
|
-
}))
|
|
2600
|
-
};
|
|
2601
|
-
}, fl = (e) => c(e).withConfig({ shouldForwardProp: Ur });
|
|
2602
|
-
function bl(e) {
|
|
2603
|
-
var o;
|
|
2604
|
-
const t = "remove_powered_by", n = (o = e == null ? void 0 : e.appInfo) == null ? void 0 : o.applicationAttributes;
|
|
2605
|
-
return Array.isArray(n) && n.includes(t);
|
|
2606
|
-
}
|
|
2607
|
-
const xl = ({ style: e }) => {
|
|
2608
|
-
const { stringSet: t } = M(), { chatSDK: n } = N(), { isDashboardActionbookTester: o } = wt();
|
|
2609
|
-
return bl(n) || o ? null : /* @__PURE__ */ r.createElement(El, { variant: "caption2", style: e }, t.POWERED_BY + " ", /* @__PURE__ */ r.createElement(
|
|
2610
|
-
vl,
|
|
2611
|
-
{
|
|
2612
|
-
variant: "caption2",
|
|
2613
|
-
as: "a",
|
|
2614
|
-
href: "https://sendbird.com?utm_medium=product&utm_source=aiagent&utm_campaign=fy26-glbl-ai-agent-poweredby",
|
|
2615
|
-
"aria-label": "Learn more about Sendbird",
|
|
2616
|
-
rel: ft,
|
|
2617
|
-
target: "_blank"
|
|
2618
|
-
},
|
|
2619
|
-
"Sendbird"
|
|
2620
|
-
));
|
|
2621
|
-
}, El = c(S)`color:${u.themedColor.textLowEmphasis};text-align:center;`, vl = fl(S)`
|
|
2622
|
-
color: ${u.themedColor.textLowEmphasis};
|
|
2623
|
-
cursor: pointer;
|
|
2624
|
-
text-decoration: none;
|
|
2625
|
-
`, yl = () => {
|
|
2626
|
-
var d;
|
|
2627
|
-
const { stringSet: e } = M(), { activeChannel: t } = F(), { channelSource: n, goToActiveConversation: o, scrollSource: i } = Y(), a = Rn(n.channel), l = t && ((d = n.channel) == null ? void 0 : d.url) === (t == null ? void 0 : t.url) && a;
|
|
2628
|
-
return ge(() => {
|
|
2629
|
-
l && i.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !0 } });
|
|
2630
|
-
}, [l]), l ? /* @__PURE__ */ r.createElement(Cl, null, /* @__PURE__ */ r.createElement(
|
|
2631
|
-
Tl,
|
|
2632
|
-
{
|
|
2633
|
-
variant: "button",
|
|
2634
|
-
role: "button",
|
|
2635
|
-
color: u.themedColor.textHighEmphasis,
|
|
2636
|
-
onClick: () => o()
|
|
2637
|
-
},
|
|
2638
|
-
e.START_NEW_CONVERSATION
|
|
2639
|
-
)) : null;
|
|
2640
|
-
}, Cl = c.div`display:flex;justify-content:center;margin:16px 0;`, Tl = c(S)`border-radius:6px;box-sizing:border-box;padding:10px 20px;border:1px solid ${u.themedColor.textDisabled};cursor:pointer;user-select:none;`, _l = !0, Sl = () => {
|
|
2641
|
-
const { Template: e } = _t.useContext(), { Template: t } = ve.useContext(), { Template: n } = St.useContext(), [o, i] = T(null), { userSession: a, aiAgentInfo: s } = F(), { agentPreviewConfigs: l, chatSDK: d, state: g } = N(), { stringSet: m, dateLocale: p } = M(), { conversation: h, channelSource: b, messageSource: x, scrollSource: v } = Y(), { isDashboardActionbookTester: f } = wt(), { filteredMessages: y, shouldShowOriginalDate: _, renderAgentPreviewWelcomeMessages: w } = hl(), { storage: O } = _n(), ee = Jn(), H = Tt(() => {
|
|
2642
|
-
const E = ee[0];
|
|
2643
|
-
return E ? E.userId === s.userId ? s : E : null;
|
|
2644
|
-
});
|
|
2645
|
-
R(() => {
|
|
2646
|
-
H && setTimeout(() => v.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !0 } }), 25);
|
|
2647
|
-
}, [!!H, v]);
|
|
2648
|
-
const le = (E, U = !1) => {
|
|
2649
|
-
var te;
|
|
2650
|
-
return U ? s : ((te = b.channel) == null ? void 0 : te.members.find((G) => G.userId === E.sender.userId)) ?? E.sender;
|
|
2651
|
-
}, _e = () => {
|
|
2652
|
-
if (!x.initialized)
|
|
2653
|
-
return /* @__PURE__ */ r.createElement(Ee, { type: "loading" });
|
|
2654
|
-
if (x.messages.length === 0) {
|
|
2655
|
-
const E = w();
|
|
2656
|
-
return E ? /* @__PURE__ */ r.createElement("div", { style: { width: "100%" } }, E) : /* @__PURE__ */ r.createElement(Ee, { type: "noMessages", label: m.PLACE_HOLDER__NO_MESSAGES });
|
|
2657
|
-
}
|
|
2658
|
-
return /* @__PURE__ */ r.createElement(
|
|
2659
|
-
al,
|
|
2660
|
-
{
|
|
2661
|
-
ref: v.scrollRef,
|
|
2662
|
-
scrollPositionRef: v.scrollPositionRef,
|
|
2663
|
-
scrollDistanceFromBottomRef: v.scrollDistanceFromBottomRef,
|
|
2664
|
-
onScrollPosition: (E) => v.setIsScrollBottomReached(E === "bottom"),
|
|
2665
|
-
stackDirection: l == null ? void 0 : l.messageStackDirection,
|
|
2666
|
-
messages: y,
|
|
2667
|
-
onLoadPrev: x.loadPrevious,
|
|
2668
|
-
onLoadNext: x.loadNext,
|
|
2669
|
-
depsForResetScrollPositionToBottom: [x.initialized, x.messages.length !== 0],
|
|
2670
|
-
messageTopArea: /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(xl, { style: { marginTop: 16 } }), w()),
|
|
2671
|
-
messageBottomArea: /* @__PURE__ */ r.createElement(r.Fragment, null, H && /* @__PURE__ */ r.createElement(
|
|
2672
|
-
t,
|
|
2673
|
-
{
|
|
2674
|
-
isTyping: !0,
|
|
2675
|
-
sender: H,
|
|
2676
|
-
messageType: "user",
|
|
2677
|
-
groupType: "single",
|
|
2678
|
-
message: ""
|
|
2679
|
-
}
|
|
2680
|
-
), /* @__PURE__ */ r.createElement(yl, null)),
|
|
2681
|
-
overlayArea: /* @__PURE__ */ r.createElement(r.Fragment, null, !v.isScrollBottomReached && /* @__PURE__ */ r.createElement(kl, { onClick: () => v.scrollPubSub.publish({ type: "scrollToBottom" }) })),
|
|
2682
|
-
renderMessage: ({ message: E, index: U }) => {
|
|
2683
|
-
const te = Na(E), G = y[U - 1], Xe = y[U + 1], I = y[y.length - 1], A = E === I, L = Da(E, G, Xe, _l), j = !Nr((G == null ? void 0 : G.createdAt) ?? 0, E.createdAt) && _(U) && !f, fe = () => {
|
|
2684
|
-
E.isFileMessage() && i(E);
|
|
2685
|
-
}, Se = () => {
|
|
2686
|
-
E.isFileMessage() && Ln(E.url);
|
|
2687
|
-
}, K = j ? /* @__PURE__ */ r.createElement(
|
|
2688
|
-
qn,
|
|
2689
|
-
{
|
|
2690
|
-
style: { margin: "16px 0" },
|
|
2691
|
-
date: E.createdAt,
|
|
2692
|
-
locale: p,
|
|
2693
|
-
formatString: m.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR
|
|
2694
|
-
}
|
|
2695
|
-
) : null, ne = {
|
|
2696
|
-
maxBodyWidth: g.expanded ? Dn : void 0,
|
|
2697
|
-
extendedMessagePayload: E.extendedMessagePayload,
|
|
2698
|
-
createdAt: E.createdAt,
|
|
2699
|
-
groupType: L,
|
|
2700
|
-
onClickMedia: fe,
|
|
2701
|
-
onClickFile: Se
|
|
2702
|
-
}, we = (() => {
|
|
2703
|
-
var ce, Ot;
|
|
2704
|
-
if (ze.isAdmin(E))
|
|
2705
|
-
return ze.isCSAT(E) ? h ? /* @__PURE__ */ r.createElement(
|
|
2706
|
-
n,
|
|
2707
|
-
{
|
|
2708
|
-
...ne,
|
|
2709
|
-
...h,
|
|
2710
|
-
isResolvedWhenDeterminedByUser: Al(h),
|
|
2711
|
-
messageType: "admin.csat",
|
|
2712
|
-
onSubmitCSAT: ({ csat: re, csatType: de, csatReason: V, isResolved: be }) => {
|
|
2713
|
-
var Lt;
|
|
2714
|
-
re && ((Lt = b.channel) == null || Lt.submitCSAT({ csat: re, csatType: de, csatReason: V, isResolved: be }));
|
|
2715
|
-
}
|
|
2716
|
-
}
|
|
2717
|
-
) : null : /* @__PURE__ */ r.createElement(n, { ...ne, messageType: "admin", message: E.message });
|
|
2718
|
-
if (ze.isOutgoing(E, a.userId)) {
|
|
2719
|
-
const re = {
|
|
2720
|
-
...ne,
|
|
2721
|
-
message: E.message,
|
|
2722
|
-
sender: le(E),
|
|
2723
|
-
sendingStatus: E.sendingStatus
|
|
2724
|
-
};
|
|
2725
|
-
if (E.isUserMessage())
|
|
2726
|
-
return /* @__PURE__ */ r.createElement(e, { messageType: "user", ...re });
|
|
2727
|
-
if (E.isFileMessage()) {
|
|
2728
|
-
const [de, V] = ((ce = E.metaArrays.find((be) => be.key === On)) == null ? void 0 : ce.value) ?? [];
|
|
2729
|
-
return /* @__PURE__ */ r.createElement(
|
|
2730
|
-
e,
|
|
2731
|
-
{
|
|
2732
|
-
messageType: "file",
|
|
2733
|
-
file: E,
|
|
2734
|
-
metadata: {
|
|
2735
|
-
aspectRatio: de && V ? `${de}/${V}` : "1/1",
|
|
2736
|
-
localFile: (Ot = E.messageParams) == null ? void 0 : Ot.file
|
|
2737
|
-
},
|
|
2738
|
-
...re
|
|
2739
|
-
}
|
|
2740
|
-
);
|
|
2741
|
-
}
|
|
2742
|
-
}
|
|
2743
|
-
if (ze.isIncoming(E, a.userId)) {
|
|
2744
|
-
const re = E.sender.userId === s.userId, de = {
|
|
2745
|
-
...ne,
|
|
2746
|
-
sender: le(E, re),
|
|
2747
|
-
message: E.message,
|
|
2748
|
-
suggestedRepliesVisible: A,
|
|
2749
|
-
suggestedRepliesDirection: l == null ? void 0 : l.suggestedRepliesDirection,
|
|
2750
|
-
isBotMessage: re,
|
|
2751
|
-
onClickSuggestedReply: async ({ reply: V }) => {
|
|
2752
|
-
x.sendUserMessage({ message: V });
|
|
2753
|
-
},
|
|
2754
|
-
onRequestMessageTemplate: async (V) => {
|
|
2755
|
-
const { template: be } = await d.aiAgent.getMessageTemplate(V);
|
|
2756
|
-
return O.setTemplate(V, be), be;
|
|
2757
|
-
},
|
|
2758
|
-
onGetCachedMessageTemplate: (V) => O.getTemplate(V)
|
|
2759
|
-
};
|
|
2760
|
-
if (E.isUserMessage())
|
|
2761
|
-
return /* @__PURE__ */ r.createElement(t, { messageType: "user", ...de });
|
|
2762
|
-
if (E.isFileMessage())
|
|
2763
|
-
return /* @__PURE__ */ r.createElement(t, { messageType: "file", file: E, ...de });
|
|
2764
|
-
}
|
|
2765
|
-
})();
|
|
2766
|
-
return /* @__PURE__ */ r.createElement("div", { key: te, id: `${Z}-message-item` }, K, we);
|
|
2767
|
-
}
|
|
2768
|
-
}
|
|
2769
|
-
);
|
|
2770
|
-
};
|
|
2771
|
-
return /* @__PURE__ */ r.createElement(wl, { id: `${Z}-message-list` }, _e(), o && /* @__PURE__ */ r.createElement(rl, { onClose: () => i(null), message: o }));
|
|
2772
|
-
}, wl = c.div`overflow-y:hidden;display:flex;flex:1;position:relative;`, kl = c(gl)`position:absolute;bottom:20px;inset-inline-end:20px;`;
|
|
2773
|
-
function Al(e) {
|
|
2774
|
-
var t;
|
|
2775
|
-
if (((t = e == null ? void 0 : e.resolution) == null ? void 0 : t.determinedBy) === "user")
|
|
2776
|
-
return e.resolution.isResolved;
|
|
2777
|
-
}
|
|
2778
|
-
const Il = () => {
|
|
2779
|
-
const { stringSet: e } = M(), { connectionError: t } = F(), { channelSource: n } = Y(), o = t || n.error;
|
|
2780
|
-
if (o) {
|
|
2781
|
-
const i = t ? void 0 : { label: e.RETRY, onClick: () => n.refetch() };
|
|
2782
|
-
return /* @__PURE__ */ r.createElement(Ee, { type: "error", label: o.message, action: i });
|
|
2783
|
-
}
|
|
2784
|
-
return n.channel ? /* @__PURE__ */ r.createElement(Sl, null) : /* @__PURE__ */ r.createElement(Ee, { type: "loading" });
|
|
2785
|
-
}, Xn = () => {
|
|
2786
|
-
const { stringSet: e } = M(), { activeChannel: t } = F(), [n] = T(() => (t == null ? void 0 : t.status) === z.OPEN);
|
|
2787
|
-
return n ? e.RETURN_TO_CONVERSATION : e.START_NEW_CONVERSATION;
|
|
2788
|
-
}, $l = () => {
|
|
2789
|
-
const { stringSet: e } = M(), { goToActiveConversation: t } = Y(), n = Xn();
|
|
2790
|
-
return /* @__PURE__ */ r.createElement(Ml, null, /* @__PURE__ */ r.createElement(S, { variant: "body1", color: u.themedColor.textMidEmphasis }, e.CONVERSATION_CLOSED_FOOTER_LABEL), /* @__PURE__ */ r.createElement(Ol, { onClick: t }, /* @__PURE__ */ r.createElement(S, { variant: "button", color: u.themedColor.textHighEmphasis }, n)));
|
|
2791
|
-
}, Ml = c.div`display:flex;flex-direction:column;align-items:center;justify-content:center;padding:32px 0;gap:14px;${B.light`
|
|
2792
|
-
background-color: ${u.color.background100};
|
|
2793
|
-
`}
|
|
2794
|
-
${B.dark`
|
|
2795
|
-
background-color: ${u.color.background500};
|
|
2796
|
-
`}
|
|
2797
|
-
`, Ol = c.button`all:unset;padding:10px 20px;border-radius:6px;border:1px solid ${u.themedColor.textDisabled};cursor:pointer;${B.light`
|
|
2798
|
-
background-color: ${u.color.background50};
|
|
2799
|
-
`}
|
|
2800
|
-
${B.dark`
|
|
2801
|
-
background-color: ${u.color.background700};
|
|
2802
|
-
`}
|
|
2803
|
-
`, Qn = ye(void 0), Ll = ({ children: e }) => {
|
|
2804
|
-
const { stringSet: t } = M(), { aiAgentInfo: n } = F(), [o, i] = T([]), [a, s] = T({
|
|
2805
|
-
visible: !1,
|
|
2806
|
-
title: "",
|
|
2807
|
-
buttonText: t.BUTTON__OK
|
|
2808
|
-
}), l = n == null ? void 0 : n.replyToFile, d = (p) => {
|
|
2809
|
-
if (!l) return;
|
|
2810
|
-
const h = p.filter((b) => In.includes(b.type));
|
|
2811
|
-
if (h.length !== 0) {
|
|
2812
|
-
if (h.some((b) => b.size > ei)) {
|
|
2813
|
-
s((b) => ({
|
|
2814
|
-
...b,
|
|
2815
|
-
visible: !0,
|
|
2816
|
-
title: t.FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT.replace("%d", "25")
|
|
2817
|
-
}));
|
|
2818
|
-
return;
|
|
2819
|
-
}
|
|
2820
|
-
if (h.length > 1 || h.length > 0 && o.length > 0) {
|
|
2821
|
-
s((b) => ({
|
|
2822
|
-
...b,
|
|
2823
|
-
visible: !0,
|
|
2824
|
-
title: t.FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT
|
|
2825
|
-
}));
|
|
2826
|
-
return;
|
|
2827
|
-
}
|
|
2828
|
-
i((b) => [
|
|
2829
|
-
...b,
|
|
2830
|
-
...h.map((x) => ({
|
|
2831
|
-
file: x,
|
|
2832
|
-
preview: { url: URL.createObjectURL(x), type: x.type, name: x.name }
|
|
2833
|
-
}))
|
|
2834
|
-
]);
|
|
2835
|
-
}
|
|
2836
|
-
}, g = (p) => {
|
|
2837
|
-
i((h) => {
|
|
2838
|
-
var x;
|
|
2839
|
-
const b = (x = h[p]) == null ? void 0 : x.preview;
|
|
2840
|
-
return b && URL.revokeObjectURL(b.url), h.filter((v, f) => f !== p);
|
|
2841
|
-
});
|
|
2842
|
-
}, m = () => {
|
|
2843
|
-
i((p) => (p.forEach((h) => URL.revokeObjectURL(h.preview.url)), []));
|
|
2844
|
-
};
|
|
2845
|
-
return /* @__PURE__ */ r.createElement(
|
|
2846
|
-
Qn.Provider,
|
|
2847
|
-
{
|
|
2848
|
-
value: {
|
|
2849
|
-
files: o,
|
|
2850
|
-
addFiles: d,
|
|
2851
|
-
removeFile: g,
|
|
2852
|
-
clearFiles: m,
|
|
2853
|
-
isFileUploadEnabled: l
|
|
2854
|
-
}
|
|
2855
|
-
},
|
|
2856
|
-
e,
|
|
2857
|
-
/* @__PURE__ */ r.createElement(Rl, { ...a, onClose: () => s((p) => ({ ...p, visible: !1, title: "" })) })
|
|
2858
|
-
);
|
|
2859
|
-
}, At = () => {
|
|
2860
|
-
const e = J(Qn);
|
|
2861
|
-
if (!e)
|
|
2862
|
-
throw new Error("useFileUpload must be used within FileUploadProvider");
|
|
2863
|
-
return e;
|
|
2864
|
-
}, Rl = ({
|
|
2865
|
-
title: e,
|
|
2866
|
-
buttonText: t,
|
|
2867
|
-
visible: n,
|
|
2868
|
-
onClose: o
|
|
2869
|
-
}) => /* @__PURE__ */ r.createElement(Zn, { rootElementId: X.WINDOW, visible: n, onClose: o }, /* @__PURE__ */ r.createElement(Nl, null, /* @__PURE__ */ r.createElement(Bl, null, /* @__PURE__ */ r.createElement(S, { variant: "h1", color: u.themedColor.textHighEmphasis }, e)), /* @__PURE__ */ r.createElement(Dl, null, /* @__PURE__ */ r.createElement(Pl, { onClick: o }, /* @__PURE__ */ r.createElement(S, { variant: "button", color: u.themedColor.textHighEmphasisInverse }, t))))), Nl = c.div`width:100%;height:auto;padding-block:18px 24px;padding-inline:24px;margin:0 auto;border-radius:4px;box-sizing:border-box;background-color:${({ theme: e }) => e.colors.base.modalContentBackground};`, Dl = c.div`display:flex;flex-direction:row;justify-content:flex-end;`, Bl = c.div`margin-bottom:16px;`, Pl = c.button`display:flex;justify-content:center;align-items:center;border-radius:4px;cursor:pointer;background-color:${u.themedColor.error};border:1px solid ${u.themedColor.error};padding:10px 16px;&:hover{background-color:${u.color.error.dark};border-color:${u.color.error.dark};}&:active{background-color:${u.color.error.extraDark};}`;
|
|
2870
|
-
function Fl({ blurred: e, elementRef: t, document: n = window.document }) {
|
|
2871
|
-
const o = D(!1);
|
|
2872
|
-
e && t.current && n.activeElement === t.current && (o.current = !0), ge(() => {
|
|
2873
|
-
var i;
|
|
2874
|
-
!e && o.current && ((i = t.current) == null || i.focus(), o.current = !1);
|
|
2875
|
-
}, [e]);
|
|
2876
|
-
}
|
|
2877
|
-
const Hl = c.div`&::-webkit-scrollbar{display:none;}overflow-x:auto;display:flex;flex-direction:row;gap:10px;padding:8px 16px;background-color:transparent;`, Ul = c.div`display:flex;flex-shrink:0;position:relative;margin-block-start:8px;border-radius:12px;height:64px;img{border-radius:12px;object-fit:cover;width:64px;-webkit-user-drag:none;}`, zl = c.div`display:flex;align-items:center;justify-content:center;position:absolute;inset-inline-end:-8px;inset-block-start:-8px;cursor:pointer;border-radius:50%;${B.light`
|
|
2878
|
-
background-color: ${u.color.background50};
|
|
2879
|
-
`}
|
|
2880
|
-
${B.dark`
|
|
2881
|
-
background-color: ${u.color.background500};
|
|
2882
|
-
`}
|
|
2883
|
-
path {
|
|
2884
|
-
fill: ${u.themedColor.textMidEmphasis};
|
|
2885
|
-
}
|
|
2886
|
-
|
|
2887
|
-
&:hover {
|
|
2888
|
-
path {
|
|
2889
|
-
fill: ${u.themedColor.textHighEmphasis};
|
|
2890
|
-
}
|
|
2891
|
-
}
|
|
2892
|
-
|
|
2893
|
-
circle {
|
|
2894
|
-
stroke: ${u.themedColor.bg_50_600};
|
|
2895
|
-
}
|
|
2896
|
-
`, Wl = () => {
|
|
2897
|
-
const e = Le(), [t, n] = T(), { files: o, removeFile: i, isFileUploadEnabled: a } = At();
|
|
2898
|
-
return !a || o.length === 0 ? null : /* @__PURE__ */ r.createElement(Hl, null, o.map(({ preview: { type: s, name: l, url: d } }, g) => /* @__PURE__ */ r.createElement(Ul, { key: d, onMouseOver: () => n(g), onMouseLeave: () => n(void 0) }, (e || t === g) && /* @__PURE__ */ r.createElement(zl, { title: "Remove file", onClick: () => i(g) }, /* @__PURE__ */ r.createElement($, { type: "close-filled", color: u.themedColor.textMidEmphasis })), s.startsWith("image/") ? /* @__PURE__ */ r.createElement("img", { alt: "file-image", src: d }) : /* @__PURE__ */ r.createElement(vt, { name: l, type: Et(l, s) }))));
|
|
2899
|
-
}, Vl = ({ channel: e, messages: t }) => {
|
|
2900
|
-
const { stringSet: n } = M(), { aiAgentInfo: o } = F(), i = Gl(), a = jl({
|
|
2901
|
-
lastMessage: t[t.length - 1],
|
|
2902
|
-
aiAgentUserId: o.userId
|
|
2903
|
-
});
|
|
2904
|
-
return !e || !i || Rn(e) ? [!0, n.MESSAGE_INPUT__PLACE_HOLDER__DISABLED] : a ? [!0, n.MESSAGE_INPUT__PLACE_HOLDER__WAIT_AI_AGENT_RESPONSE] : [!1, n.MESSAGE_INPUT__PLACE_HOLDER];
|
|
2905
|
-
}, Gl = () => {
|
|
2906
|
-
const e = mn(), { chatSDK: t } = N(), [n, o] = T(!0);
|
|
2907
|
-
return R(() => {
|
|
2908
|
-
const i = new ut({
|
|
2909
|
-
onDisconnected: () => o(!1),
|
|
2910
|
-
onConnected: () => o(!0),
|
|
2911
|
-
onReconnectSucceeded: () => o(!0)
|
|
2912
|
-
});
|
|
2913
|
-
return t.addConnectionHandler(e, i), () => {
|
|
2914
|
-
t.removeConnectionHandler(e);
|
|
2915
|
-
};
|
|
2916
|
-
}, [t]), n;
|
|
2917
|
-
}, jl = ({
|
|
2918
|
-
lastMessage: e,
|
|
2919
|
-
aiAgentUserId: t
|
|
2920
|
-
}) => {
|
|
2921
|
-
const [n, o] = T(!1), i = Jn();
|
|
2922
|
-
return R(() => {
|
|
2923
|
-
if (!e) return;
|
|
2924
|
-
const a = i.some((l) => l.userId === t), s = Gn(e, t) && kt.isStreaming(e);
|
|
2925
|
-
o(!!(s || a));
|
|
2926
|
-
}, [i, e, t]), n;
|
|
2927
|
-
}, er = {
|
|
2928
|
-
textArea: k`min-height:40px;height:40px;font-size:16px;line-height:24px;`,
|
|
2929
|
-
attachIcon: k`margin-bottom:4px;`
|
|
2930
|
-
}, tr = c.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:32px;height:32px;`, Kl = c(tr)`flex-shrink:0;margin-inline-end:12px;margin-bottom:2px;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover{path{fill:${u.themedColor.textHighEmphasis};}}&:active{border-radius:4px;background-color:${u.themedColor.bg_200_400};}}${ht && er.attachIcon};`, Zl = c.input`display:none;`, tn = c.div`width:100%;position:relative;background-color:${u.themedColor.bg_100_500};border-radius:20px;`, nn = c.div`display:flex;flex-direction:row;align-items:flex-end;position:relative;`, rn = c.textarea`all:unset;display:block;flex:1;min-width:0;padding-top:8px;padding-bottom:8px;padding-inline-start:16px;padding-inline-end:12px;box-sizing:border-box;font-size:14px;line-height:20px;color:${u.themedColor.textHighEmphasis};resize:none;width:100%;height:${An}px;overflow-wrap:break-word;white-space:pre-wrap;overflow-x:hidden;${ht && er.textArea};&::placeholder{color:${u.themedColor.textLowEmphasis};}&:disabled{cursor:not-allowed;&::placeholder{color:${u.themedColor.textDisabled};}}`, on = c.div`padding:12px 16px;position:relative;display:flex;align-items:center;`, sn = ({ disabled: e }) => {
|
|
2931
|
-
const t = D(null), { addFiles: n, clearFiles: o, files: i, isFileUploadEnabled: a } = At();
|
|
2932
|
-
return !a || i.length > 0 ? null : /* @__PURE__ */ r.createElement(
|
|
2933
|
-
Kl,
|
|
2934
|
-
{
|
|
2935
|
-
disabled: e,
|
|
2936
|
-
onClick: () => {
|
|
2937
|
-
var s;
|
|
2938
|
-
o(), (s = t.current) == null || s.click();
|
|
2939
|
-
}
|
|
2940
|
-
},
|
|
2941
|
-
/* @__PURE__ */ r.createElement(
|
|
2942
|
-
$,
|
|
2943
|
-
{
|
|
2944
|
-
type: "attach",
|
|
2945
|
-
color: e ? u.themedColor.textDisabled : u.themedColor.textMidEmphasis,
|
|
2946
|
-
size: 16
|
|
2947
|
-
}
|
|
2948
|
-
),
|
|
2949
|
-
/* @__PURE__ */ r.createElement(
|
|
2950
|
-
Zl,
|
|
2951
|
-
{
|
|
2952
|
-
type: "file",
|
|
2953
|
-
ref: t,
|
|
2954
|
-
onChange: (s) => {
|
|
2955
|
-
const l = s.currentTarget.files;
|
|
2956
|
-
l && n(Array.from(l)), s.target.value = "";
|
|
2957
|
-
},
|
|
2958
|
-
accept: In.join(",")
|
|
2959
|
-
}
|
|
2960
|
-
)
|
|
2961
|
-
);
|
|
2962
|
-
}, Yl = () => {
|
|
2963
|
-
const e = D(null), [t, n] = T(""), { rootElement: o } = N(), { channelSource: i, messageSource: a } = Y(), [s, l] = Vl({
|
|
2964
|
-
channel: i.channel,
|
|
2965
|
-
messages: a.messages
|
|
2966
|
-
}), { files: d, addFiles: g, clearFiles: m } = At();
|
|
2967
|
-
xi({ onDropFiles: g }), Fl({ blurred: s, elementRef: e, document: pe(o) });
|
|
2968
|
-
const p = t.trim().length > 0, h = d.length > 0, b = !s && (p || h), x = () => {
|
|
2969
|
-
e.current && (e.current.value = "", e.current.style.height = ""), m(), n("");
|
|
2970
|
-
}, v = async () => {
|
|
2971
|
-
const w = t.trim(), O = { message: w };
|
|
2972
|
-
if (!(!w && !d.length)) {
|
|
2973
|
-
if (d.length > 0) {
|
|
2974
|
-
const ee = d[0].file, H = { ...O, file: ee };
|
|
2975
|
-
a.sendFileMessage(H), x();
|
|
2976
|
-
return;
|
|
2977
|
-
}
|
|
2978
|
-
a.sendUserMessage(O), x();
|
|
2979
|
-
}
|
|
2980
|
-
}, f = (w) => {
|
|
2981
|
-
const O = Array.from(w.clipboardData.files);
|
|
2982
|
-
O.length > 0 && (w.preventDefault(), g(O));
|
|
2983
|
-
}, y = (w) => {
|
|
2984
|
-
w.key !== "Enter" || w.nativeEvent.isComposing || w.shiftKey || (w.preventDefault(), v());
|
|
2985
|
-
}, _ = (w) => {
|
|
2986
|
-
if (e.current) {
|
|
2987
|
-
e.current.style.height = "";
|
|
2988
|
-
const O = Math.min(Qo, e.current.scrollHeight);
|
|
2989
|
-
An < O && (e.current.style.height = `${O}px`);
|
|
2990
|
-
}
|
|
2991
|
-
n(w.target.value);
|
|
2992
|
-
};
|
|
2993
|
-
return s ? /* @__PURE__ */ r.createElement(on, null, /* @__PURE__ */ r.createElement(tn, null, /* @__PURE__ */ r.createElement(nn, null, /* @__PURE__ */ r.createElement(rn, { disabled: !0, placeholder: l }), /* @__PURE__ */ r.createElement(sn, { disabled: !0 })))) : /* @__PURE__ */ r.createElement(on, null, /* @__PURE__ */ r.createElement(tn, null, /* @__PURE__ */ r.createElement(Wl, null), /* @__PURE__ */ r.createElement(nn, null, /* @__PURE__ */ r.createElement(
|
|
2994
|
-
rn,
|
|
2995
|
-
{
|
|
2996
|
-
ref: e,
|
|
2997
|
-
role: "textbox",
|
|
2998
|
-
"aria-label": "Text Input",
|
|
2999
|
-
placeholder: l,
|
|
3000
|
-
maxLength: 5e3,
|
|
3001
|
-
onKeyDown: y,
|
|
3002
|
-
onChange: _,
|
|
3003
|
-
onPaste: f
|
|
3004
|
-
}
|
|
3005
|
-
), /* @__PURE__ */ r.createElement(sn, null))), b && /* @__PURE__ */ r.createElement(tr, { onClick: () => v() }, /* @__PURE__ */ r.createElement($, { type: "send", color: u.color.primary.main, size: 20 })));
|
|
3006
|
-
}, ql = c.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:${u.themedColor.textLowEmphasis};&& a{font-weight:700;text-decoration:none;${B.light`
|
|
3007
|
-
color: ${u.color.information.light};
|
|
3008
|
-
`};
|
|
3009
|
-
${B.dark`
|
|
3010
|
-
color: ${u.color.information.main};
|
|
3011
|
-
`};
|
|
3012
|
-
}
|
|
3013
|
-
`, Jl = C(() => import("./Dde5r6cu.js").then((e) => ({ default: e.MarkdownText }))), Xl = () => {
|
|
3014
|
-
const { aiAgentInfo: e } = F(), { messageSource: t } = Y(), { userSession: n } = F();
|
|
3015
|
-
return !e.specialNoticeEnabled || !e.specialNotice || !(t.initialized && !t.messages.some((i) => Gn(i, n.userId))) ? null : /* @__PURE__ */ r.createElement(ql, null, /* @__PURE__ */ r.createElement(Jl, null, e.specialNotice));
|
|
3016
|
-
}, Ql = () => /* @__PURE__ */ r.createElement(ec, null, /* @__PURE__ */ r.createElement(Xl, null), /* @__PURE__ */ r.createElement(Ll, null, /* @__PURE__ */ r.createElement(Yl, null))), ec = c.div`z-index:0;border:none;width:100%;`, tc = () => {
|
|
3017
|
-
var a, s, l;
|
|
3018
|
-
const { activeChannel: e } = F(), { channelSource: t } = Y(), n = ((s = (a = t.channel) == null ? void 0 : a.conversation) == null ? void 0 : s.status) === z.CLOSED;
|
|
3019
|
-
return !(((l = t.channel) == null ? void 0 : l.url) === (e == null ? void 0 : e.url)) && n ? /* @__PURE__ */ r.createElement($l, null) : /* @__PURE__ */ r.createElement(Ql, null);
|
|
3020
|
-
}, nc = () => {
|
|
3021
|
-
var _;
|
|
3022
|
-
const { state: e, logger: t, enableCloseConversationButton: n, enableExpandButton: o, dispatcher: i } = N(), { stringSet: a } = M(), { aiAgentInfo: s, activeChannel: l } = F(), { channelSource: d, onNavigateToConversationList: g } = Y(), m = d.channel, h = Le() ? 24 : 16, b = () => {
|
|
3023
|
-
e.setOpened(!1);
|
|
3024
|
-
}, x = async () => {
|
|
3025
|
-
try {
|
|
3026
|
-
const w = await (m == null ? void 0 : m.markConversationAsHandoff());
|
|
3027
|
-
t.info("conversation.handleAgentHandoff: success", w);
|
|
3028
|
-
} catch (w) {
|
|
3029
|
-
t.error("conversation.handleAgentHandoff: error", w);
|
|
3030
|
-
}
|
|
3031
|
-
}, v = async () => {
|
|
3032
|
-
m && await i.send(Xr.CloseConversation());
|
|
3033
|
-
}, f = l && (m == null ? void 0 : m.url) === l.url, y = s.showHandoffButton && !!((_ = m == null ? void 0 : m.conversation) != null && _.handoff) && f;
|
|
3034
|
-
return /* @__PURE__ */ r.createElement(ac, null, /* @__PURE__ */ r.createElement(lc, null, g && /* @__PURE__ */ r.createElement(Ne, { onClick: () => g() }, /* @__PURE__ */ r.createElement($, { type: "menu", size: 24, color: u.themedColor.textHighEmphasis })), f && /* @__PURE__ */ r.createElement(Yn, { size: 34 }), /* @__PURE__ */ r.createElement(dc, { variant: "h2", color: u.themedColor.textHighEmphasis }, s.nickname || (m == null ? void 0 : m.name))), /* @__PURE__ */ r.createElement(cc, null, y && /* @__PURE__ */ r.createElement(
|
|
3035
|
-
sc,
|
|
3036
|
-
{
|
|
3037
|
-
tooltipLabel: a.HEADER_BUTTON__AGENT_HANDOFF,
|
|
3038
|
-
disabled: !bi(m),
|
|
3039
|
-
size: h,
|
|
3040
|
-
onClick: x
|
|
3041
|
-
}
|
|
3042
|
-
), n && /* @__PURE__ */ r.createElement(
|
|
3043
|
-
ic,
|
|
3044
|
-
{
|
|
3045
|
-
disabled: !Nn(m),
|
|
3046
|
-
size: h,
|
|
3047
|
-
onClick: v
|
|
3048
|
-
}
|
|
3049
|
-
), o && /* @__PURE__ */ r.createElement(rc, { size: h }), /* @__PURE__ */ r.createElement(oc, { size: h, onClick: b })));
|
|
3050
|
-
}, rc = ({ size: e, disabled: t }) => {
|
|
3051
|
-
const { state: n } = N();
|
|
3052
|
-
return /* @__PURE__ */ r.createElement(Ne, { "aria-label": "expand", onClick: () => n.setExpanded(!n.expanded), disabled: t }, /* @__PURE__ */ r.createElement($, { type: n.expanded ? "collapse" : "expand", size: e, color: u.themedColor.textHighEmphasis }));
|
|
3053
|
-
}, oc = ({ size: e, disabled: t, onClick: n }) => /* @__PURE__ */ r.createElement(Ne, { "aria-label": "close messenger", onClick: n, disabled: t }, /* @__PURE__ */ r.createElement($, { type: "close", size: e, color: u.themedColor.textHighEmphasis })), ic = ({ size: e, disabled: t, onClick: n }) => /* @__PURE__ */ r.createElement(Ne, { "aria-label": "close conversation", onClick: n, disabled: t }, /* @__PURE__ */ r.createElement(
|
|
3054
|
-
$,
|
|
3055
|
-
{
|
|
3056
|
-
type: "refresh",
|
|
3057
|
-
size: e,
|
|
3058
|
-
color: t ? u.themedColor.textDisabled : u.themedColor.textHighEmphasis
|
|
3059
|
-
}
|
|
3060
|
-
)), sc = ({ size: e, onClick: t, disabled: n, tooltipLabel: o }) => /* @__PURE__ */ r.createElement(Wn, { label: o, position: "bottom", disabled: n }, /* @__PURE__ */ r.createElement(Ne, { "aria-label": "agent", onClick: t, disabled: n }, /* @__PURE__ */ r.createElement(
|
|
3061
|
-
$,
|
|
3062
|
-
{
|
|
3063
|
-
type: "agent",
|
|
3064
|
-
size: e,
|
|
3065
|
-
color: n ? u.themedColor.textDisabled : u.themedColor.textHighEmphasis
|
|
3066
|
-
}
|
|
3067
|
-
))), ac = c.div`height:56px;box-sizing:border-box;display:flex;align-items:center;padding:11px 12px;border-bottom:1px solid ${u.themedColor.textDisabled};background-color:${({ theme: e }) => e.colors.base.headerBackground};`, lc = c.div`display:flex;flex:1;flex-direction:row;align-items:center;gap:6px;overflow:hidden;`, cc = c.div`display:flex;gap:10px;align-items:center;justify-content:center;`, dc = c(S)`text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:2px 0;`, Ne = c.button`all:unset;padding:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;&:disabled{cursor:not-allowed;}`, uc = () => {
|
|
3068
|
-
const { isDashboardActionbookTester: e } = wt();
|
|
3069
|
-
return e ? null : /* @__PURE__ */ r.createElement(nc, null);
|
|
3070
|
-
}, an = ({
|
|
3071
|
-
children: e,
|
|
3072
|
-
onNavigateToConversationList: t,
|
|
3073
|
-
closedChannelUrl: n,
|
|
3074
|
-
onClearClosedChannelUrl: o
|
|
3075
|
-
}) => {
|
|
3076
|
-
const { Template: i } = It.useContext();
|
|
3077
|
-
return /* @__PURE__ */ r.createElement(
|
|
3078
|
-
fi,
|
|
3079
|
-
{
|
|
3080
|
-
onNavigateToConversationList: t,
|
|
3081
|
-
closedChannelUrl: n,
|
|
3082
|
-
onClearClosedChannelUrl: o
|
|
3083
|
-
},
|
|
3084
|
-
/* @__PURE__ */ r.createElement(lt, null, /* @__PURE__ */ r.createElement(lt.Consumer, null, (a) => /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(gc, { ...a }, /* @__PURE__ */ r.createElement(i, null)), e)))
|
|
3085
|
-
);
|
|
3086
|
-
}, It = Ce({
|
|
3087
|
-
template: mc,
|
|
3088
|
-
components: {
|
|
3089
|
-
Header: uc,
|
|
3090
|
-
Body: Il,
|
|
3091
|
-
Footer: tc
|
|
3092
|
-
}
|
|
3093
|
-
});
|
|
3094
|
-
function mc() {
|
|
3095
|
-
const { components: e } = It.useContext();
|
|
3096
|
-
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(e.Header, null), /* @__PURE__ */ r.createElement(e.Body, null), /* @__PURE__ */ r.createElement(e.Footer, null));
|
|
3097
|
-
}
|
|
3098
|
-
const gc = c.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, {
|
|
3099
|
-
Provider: pc,
|
|
3100
|
-
useContext: nr
|
|
3101
|
-
} = W("ConversationList");
|
|
3102
|
-
function hc({
|
|
3103
|
-
onOpenConversationView: e = Ge,
|
|
3104
|
-
children: t
|
|
3105
|
-
}) {
|
|
3106
|
-
return /* @__PURE__ */ r.createElement(oo, null, (n) => /* @__PURE__ */ r.createElement(pc, { value: { ...n, onOpenConversationView: e } }, t));
|
|
3107
|
-
}
|
|
3108
|
-
const rr = Ce({
|
|
3109
|
-
template: fc,
|
|
3110
|
-
// Note: 리스트 변경되면 디자인 변경 가능성이 있어서 일단 컴포넌트는 비워둠
|
|
3111
|
-
components: {}
|
|
3112
|
-
});
|
|
3113
|
-
function fc({
|
|
3114
|
-
title: e = "",
|
|
3115
|
-
lastMessageTimestamp: t = Date.now(),
|
|
3116
|
-
onClick: n
|
|
3117
|
-
}) {
|
|
3118
|
-
const { stringSet: o, format: i } = M();
|
|
3119
|
-
return /* @__PURE__ */ r.createElement(bc, { role: "button", onClick: () => n == null ? void 0 : n() }, /* @__PURE__ */ r.createElement(Ec, null, /* @__PURE__ */ r.createElement(vc, null, /* @__PURE__ */ r.createElement(S, { variant: "subtitle1", color: u.themedColor.textHighEmphasis }, i(t, o.DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE)), /* @__PURE__ */ r.createElement(S, { variant: "caption2", color: u.themedColor.textLowEmphasis }, i(t, o.DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION))), /* @__PURE__ */ r.createElement(S, { variant: "body3", color: u.themedColor.textMidEmphasis }, e || o.CONVERSATION_LIST__TOPICS_FALLBACK)), /* @__PURE__ */ r.createElement($, { type: "chevron-right", size: 16, color: u.themedColor.textHighEmphasis }), /* @__PURE__ */ r.createElement(xc, null));
|
|
3120
|
-
}
|
|
3121
|
-
const bc = c.div`display:flex;flex-direction:row;align-items:center;position:relative;width:100%;padding:14px 16px;box-sizing:border-box;gap:4px;cursor:pointer;`, xc = c.div`position:absolute;bottom:0;height:1px;width:calc(100% - 32px);background-color:${u.themedColor.textDisabled};`, Ec = c.div`gap:4px;display:flex;flex-direction:column;flex:1;`, vc = c.div`display:flex;justify-content:flex-start;align-items:center;gap:6px;`, yc = ({ items: e, renderItem: t, onEndReached: n }) => {
|
|
3122
|
-
const o = (i) => {
|
|
3123
|
-
const a = i.target;
|
|
3124
|
-
a.scrollHeight - a.scrollTop === a.clientHeight && (n == null || n());
|
|
3125
|
-
};
|
|
3126
|
-
return /* @__PURE__ */ r.createElement(Cc, { onScroll: (i) => o(i) }, e.map((i, a) => t(i, a)));
|
|
3127
|
-
}, Cc = c.div`width:100%;height:100%;display:flex;flex-direction:column;flex:1;overflow:auto;`, Tc = () => {
|
|
3128
|
-
const { stringSet: e } = M(), { listSource: t, onOpenConversationView: n } = nr(), { Template: o } = rr.useContext();
|
|
3129
|
-
return t.initialized ? t.conversations.length === 0 ? /* @__PURE__ */ r.createElement(Ee, { type: "noChannels", label: e.CONVERSATION_LIST__NO_CONVERSATIONS }) : /* @__PURE__ */ r.createElement(
|
|
3130
|
-
yc,
|
|
3131
|
-
{
|
|
3132
|
-
items: t.conversations,
|
|
3133
|
-
renderItem: (i, a) => {
|
|
3134
|
-
var s;
|
|
3135
|
-
return /* @__PURE__ */ r.createElement(
|
|
3136
|
-
o,
|
|
3137
|
-
{
|
|
3138
|
-
key: a,
|
|
3139
|
-
channelUrl: i.channelInfo.url,
|
|
3140
|
-
title: (s = i.topics) == null ? void 0 : s.join(", "),
|
|
3141
|
-
lastMessageTimestamp: i.channelInfo.lastMessageTs,
|
|
3142
|
-
onClick: () => n(i.channelInfo.url, z.CLOSED)
|
|
3143
|
-
}
|
|
3144
|
-
);
|
|
3145
|
-
},
|
|
3146
|
-
onEndReached: () => {
|
|
3147
|
-
t.loadMore();
|
|
3148
|
-
}
|
|
3149
|
-
}
|
|
3150
|
-
) : /* @__PURE__ */ r.createElement(Ee, { type: "loading" });
|
|
3151
|
-
}, _c = () => {
|
|
3152
|
-
const { refreshActiveChannel: e } = F(), { onOpenConversationView: t } = nr(), n = Xn();
|
|
3153
|
-
return /* @__PURE__ */ r.createElement(
|
|
3154
|
-
Sc,
|
|
3155
|
-
{
|
|
3156
|
-
role: "button",
|
|
3157
|
-
onClick: async () => {
|
|
3158
|
-
const o = await e();
|
|
3159
|
-
t(o, z.OPEN);
|
|
3160
|
-
}
|
|
3161
|
-
},
|
|
3162
|
-
/* @__PURE__ */ r.createElement(wc, { variant: "h1" }, n)
|
|
3163
|
-
);
|
|
3164
|
-
}, Sc = c.div`background-color:${({ theme: e }) => e.colors.base.primary};display:flex;align-items:center;justify-content:center;padding:16px;cursor:pointer;`, wc = c(S)`color:${({ theme: e }) => e.colors.base.primaryContrastContent};overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`, kc = () => {
|
|
3165
|
-
const { stringSet: e } = M();
|
|
3166
|
-
return /* @__PURE__ */ r.createElement(Ac, null, /* @__PURE__ */ r.createElement(Ic, { variant: "h2", color: u.themedColor.textHighEmphasis }, e.CONVERSATION_LIST__HEADER_TITLE), /* @__PURE__ */ r.createElement($c, null));
|
|
3167
|
-
}, Ac = c.div`display:flex;flex-direction:column;align-items:flex-start;justify-content:center;width:100%;flex-shrink:0;height:56px;position:relative;background-color:${({ theme: e }) => e.colors.base.headerBackground};`, Ic = c(S)`padding:0 12px;width:100%;box-sizing:border-box;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;`, $c = c.div`position:absolute;bottom:0;width:100%;height:1px;background-color:${u.themedColor.textDisabled};`, Mc = ({ children: e, onOpenConversationView: t }) => {
|
|
3168
|
-
const { Template: n } = $t.useContext();
|
|
3169
|
-
return /* @__PURE__ */ r.createElement(hc, { onOpenConversationView: t }, /* @__PURE__ */ r.createElement(Lc, null, /* @__PURE__ */ r.createElement(n, null)), e);
|
|
3170
|
-
}, $t = Ce({
|
|
3171
|
-
template: Oc,
|
|
3172
|
-
components: {
|
|
3173
|
-
Header: kc,
|
|
3174
|
-
Body: Tc,
|
|
3175
|
-
Footer: _c
|
|
3176
|
-
}
|
|
3177
|
-
});
|
|
3178
|
-
function Oc() {
|
|
3179
|
-
const { components: e } = $t.useContext();
|
|
3180
|
-
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(e.Header, null), /* @__PURE__ */ r.createElement(e.Body, null), /* @__PURE__ */ r.createElement(e.Footer, null));
|
|
3181
|
-
}
|
|
3182
|
-
const Lc = c.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, Rc = k`:where(#${X.ENTRY}) :not(code *){font-family:'Roboto',sans-serif;box-sizing:border-box;}`, Nc = [Rc, Vo, Go], Dc = (e, ...t) => Tr(e, ...Nc, ...t), Bc = Dc``, Pc = zr(
|
|
3183
|
-
It,
|
|
3184
|
-
ve,
|
|
3185
|
-
_t,
|
|
3186
|
-
St,
|
|
3187
|
-
$t,
|
|
3188
|
-
rr
|
|
3189
|
-
);
|
|
3190
|
-
function Fc({
|
|
3191
|
-
appearance: e,
|
|
3192
|
-
rootElement: t,
|
|
3193
|
-
logger: n,
|
|
3194
|
-
language: o,
|
|
3195
|
-
stringSet: i,
|
|
3196
|
-
children: a,
|
|
3197
|
-
messageTemplate: s,
|
|
3198
|
-
theme: l
|
|
3199
|
-
}) {
|
|
3200
|
-
return Jo(Ro, t), /* @__PURE__ */ r.createElement(_r, { target: t }, /* @__PURE__ */ r.createElement(Zo, { rootElement: t, logger: n, appearance: e, theme: l }, /* @__PURE__ */ r.createElement(ko, { internalVariables: s == null ? void 0 : s.__internalVariables }, /* @__PURE__ */ r.createElement(Wo, { stringSet: i, logger: n, language: o }, /* @__PURE__ */ r.createElement(Pc, null, a, /* @__PURE__ */ r.createElement(Bc, null))))));
|
|
3201
|
-
}
|
|
3202
|
-
const ln = {
|
|
3203
|
-
key_payment_plan_container: {
|
|
3204
|
-
color_variables: {},
|
|
3205
|
-
created_at: 1232,
|
|
3206
|
-
updated_at: 4563,
|
|
3207
|
-
key: "key_payment_plan_container",
|
|
3208
|
-
ui_template: {
|
|
3209
|
-
body: {
|
|
3210
|
-
items: [
|
|
3211
|
-
{
|
|
3212
|
-
carouselStyle: { maxChildWidth: 265, spacing: 10 },
|
|
3213
|
-
items: "{@templates}",
|
|
3214
|
-
type: "carouselView",
|
|
3215
|
-
viewStyle: { padding: { top: 0, bottom: 0, left: 50, right: 16 } }
|
|
3216
|
-
}
|
|
3217
|
-
]
|
|
3218
|
-
},
|
|
3219
|
-
version: 2
|
|
3220
|
-
}
|
|
3221
|
-
},
|
|
3222
|
-
key_payment_plan: {
|
|
3223
|
-
color_variables: {},
|
|
3224
|
-
created_at: 123,
|
|
3225
|
-
updated_at: 456,
|
|
3226
|
-
key: "key_payment_plan",
|
|
3227
|
-
ui_template: {
|
|
3228
|
-
version: 1,
|
|
3229
|
-
body: {
|
|
3230
|
-
items: [
|
|
3231
|
-
{
|
|
3232
|
-
viewStyle: { radius: 16, backgroundColor: "#FFFFFF", borderWidth: "1", borderColor: "#E0E0E0" },
|
|
3233
|
-
width: { type: "fixed", value: "264" },
|
|
3234
|
-
height: { type: "fixed", value: "275" },
|
|
3235
|
-
type: "box",
|
|
3236
|
-
layout: "column",
|
|
3237
|
-
items: [
|
|
3238
|
-
{
|
|
3239
|
-
viewStyle: {
|
|
3240
|
-
padding: { left: 16, right: 16, top: 16, bottom: 16 },
|
|
3241
|
-
backgroundImageUrl: "https://storage-66w.pages.dev/carousel-bg.png"
|
|
3242
|
-
},
|
|
3243
|
-
action: { type: "web", data: "{action_url}" },
|
|
3244
|
-
type: "box",
|
|
3245
|
-
layout: "column",
|
|
3246
|
-
items: [
|
|
3247
|
-
{
|
|
3248
|
-
type: "text",
|
|
3249
|
-
text: "{header_plan}",
|
|
3250
|
-
textStyle: { size: 14, weight: "bold", color: "#FFFFFF" }
|
|
3251
|
-
},
|
|
3252
|
-
{ type: "text", text: "{header_desc}", textStyle: { size: 12, color: "#FFFFFF" } }
|
|
3253
|
-
]
|
|
3254
|
-
},
|
|
3255
|
-
{
|
|
3256
|
-
viewStyle: { padding: { left: 16, right: 16, top: 16, bottom: 16 } },
|
|
3257
|
-
action: { type: "web", data: "{action_url}" },
|
|
3258
|
-
type: "box",
|
|
3259
|
-
layout: "column",
|
|
3260
|
-
items: [
|
|
3261
|
-
{ type: "text", text: "{price}", textStyle: { size: 20, weight: "bold" } },
|
|
3262
|
-
{
|
|
3263
|
-
viewStyle: { padding: { left: 0, right: 0, top: 16, bottom: 16 } },
|
|
3264
|
-
type: "box",
|
|
3265
|
-
layout: "column",
|
|
3266
|
-
items: [
|
|
3267
|
-
{
|
|
3268
|
-
viewStyle: { backgroundColor: "#E0E0E0" },
|
|
3269
|
-
width: { type: "flex", value: 0 },
|
|
3270
|
-
height: { type: "fixed", value: "1" },
|
|
3271
|
-
type: "box",
|
|
3272
|
-
layout: "column"
|
|
3273
|
-
}
|
|
3274
|
-
]
|
|
3275
|
-
},
|
|
3276
|
-
{
|
|
3277
|
-
viewStyle: { margin: { bottom: 8, top: 0, left: 0, right: 0 } },
|
|
3278
|
-
type: "text",
|
|
3279
|
-
text: "{description}",
|
|
3280
|
-
textStyle: { size: 14, weight: "normal", color: "#7F7F7F" }
|
|
3281
|
-
}
|
|
3282
|
-
]
|
|
3283
|
-
}
|
|
3284
|
-
]
|
|
3285
|
-
}
|
|
3286
|
-
]
|
|
3287
|
-
}
|
|
3288
|
-
}
|
|
3289
|
-
},
|
|
3290
|
-
key_content_preview: {
|
|
3291
|
-
color_variables: {},
|
|
3292
|
-
created_at: 1232,
|
|
3293
|
-
updated_at: 4563,
|
|
3294
|
-
key: "key_content_preview",
|
|
3295
|
-
ui_template: {
|
|
3296
|
-
version: 1,
|
|
3297
|
-
body: {
|
|
3298
|
-
items: [
|
|
3299
|
-
{
|
|
3300
|
-
viewStyle: {
|
|
3301
|
-
radius: 16,
|
|
3302
|
-
borderWidth: 1,
|
|
3303
|
-
borderColor: "#1F000000",
|
|
3304
|
-
backgroundColor: "#FFFFFF"
|
|
3305
|
-
},
|
|
3306
|
-
width: {
|
|
3307
|
-
type: "fixed",
|
|
3308
|
-
value: 264
|
|
3309
|
-
},
|
|
3310
|
-
action: { type: "web", data: "{action_url}" },
|
|
3311
|
-
type: "box",
|
|
3312
|
-
layout: "column",
|
|
3313
|
-
items: [
|
|
3314
|
-
{
|
|
3315
|
-
action: { type: "web", data: "{action_url}" },
|
|
3316
|
-
width: {
|
|
3317
|
-
type: "flex",
|
|
3318
|
-
value: 0
|
|
3319
|
-
},
|
|
3320
|
-
height: {
|
|
3321
|
-
type: "fixed",
|
|
3322
|
-
value: 200
|
|
3323
|
-
},
|
|
3324
|
-
type: "image",
|
|
3325
|
-
imageUrl: "{image}",
|
|
3326
|
-
imageStyle: {
|
|
3327
|
-
contentMode: "aspectFill"
|
|
3328
|
-
}
|
|
3329
|
-
},
|
|
3330
|
-
{
|
|
3331
|
-
action: { type: "web", data: "{action_url}" },
|
|
3332
|
-
viewStyle: {
|
|
3333
|
-
padding: {
|
|
3334
|
-
left: 16,
|
|
3335
|
-
right: 16,
|
|
3336
|
-
top: 16,
|
|
3337
|
-
bottom: 16
|
|
3338
|
-
}
|
|
3339
|
-
},
|
|
3340
|
-
type: "box",
|
|
3341
|
-
layout: "column",
|
|
3342
|
-
items: [
|
|
3343
|
-
{
|
|
3344
|
-
viewStyle: {
|
|
3345
|
-
margin: {
|
|
3346
|
-
bottom: 4,
|
|
3347
|
-
top: 0,
|
|
3348
|
-
left: 0,
|
|
3349
|
-
right: 0
|
|
3350
|
-
}
|
|
3351
|
-
},
|
|
3352
|
-
height: {
|
|
3353
|
-
type: "fixed",
|
|
3354
|
-
value: 16
|
|
3355
|
-
},
|
|
3356
|
-
type: "text",
|
|
3357
|
-
text: "{title}",
|
|
3358
|
-
maxTextLines: 1,
|
|
3359
|
-
textStyle: {
|
|
3360
|
-
size: 14,
|
|
3361
|
-
weight: "bold",
|
|
3362
|
-
color: "#000000"
|
|
3363
|
-
}
|
|
3364
|
-
},
|
|
3365
|
-
{
|
|
3366
|
-
height: {
|
|
3367
|
-
type: "fixed",
|
|
3368
|
-
value: 16
|
|
3369
|
-
},
|
|
3370
|
-
type: "text",
|
|
3371
|
-
text: "{release_date}",
|
|
3372
|
-
maxTextLines: 1,
|
|
3373
|
-
textStyle: {
|
|
3374
|
-
size: 14,
|
|
3375
|
-
weight: "normal",
|
|
3376
|
-
color: "#80000000"
|
|
3377
|
-
}
|
|
3378
|
-
}
|
|
3379
|
-
]
|
|
3380
|
-
}
|
|
3381
|
-
]
|
|
3382
|
-
}
|
|
3383
|
-
]
|
|
3384
|
-
}
|
|
3385
|
-
}
|
|
3386
|
-
}
|
|
3387
|
-
};
|
|
3388
|
-
function or({
|
|
3389
|
-
rootElement: e = document.body,
|
|
3390
|
-
logLevel: t = gn.WARN,
|
|
3391
|
-
language: n = navigator.language,
|
|
3392
|
-
userSessionInfo: o,
|
|
3393
|
-
children: i,
|
|
3394
|
-
...a
|
|
3395
|
-
}) {
|
|
3396
|
-
var s;
|
|
3397
|
-
return xe.level !== t && (xe.level = t), qo("https://fonts.googleapis.com/css2?family=Roboto&display=swap", e), /* @__PURE__ */ r.createElement("div", { id: X.ENTRY, style: { width: "fit-content", height: "fit-content" } }, /* @__PURE__ */ r.createElement(_o, { logger: xe, storage: Uc }, /* @__PURE__ */ r.createElement(
|
|
3398
|
-
Fc,
|
|
3399
|
-
{
|
|
3400
|
-
logger: xe,
|
|
3401
|
-
rootElement: e,
|
|
3402
|
-
appearance: (s = a.agentPreviewConfigs) == null ? void 0 : s.appearance,
|
|
3403
|
-
stringSet: a.stringSet,
|
|
3404
|
-
language: n,
|
|
3405
|
-
messageTemplate: a.messageTemplate,
|
|
3406
|
-
theme: a.theme
|
|
3407
|
-
},
|
|
3408
|
-
/* @__PURE__ */ r.createElement(
|
|
3409
|
-
Zr,
|
|
3410
|
-
{
|
|
3411
|
-
appId: a.appId,
|
|
3412
|
-
aiAgentId: a.aiAgentId,
|
|
3413
|
-
language: n,
|
|
3414
|
-
countryCode: a.countryCode,
|
|
3415
|
-
context: a.context,
|
|
3416
|
-
logger: xe,
|
|
3417
|
-
dispatcher: Hc,
|
|
3418
|
-
chatParams: { customApiHost: a.customApiHost, customWebSocketHost: a.customWebSocketHost }
|
|
3419
|
-
},
|
|
3420
|
-
/* @__PURE__ */ r.createElement(ri, { rootElement: e, ...a }, /* @__PURE__ */ r.createElement(ai, { userSessionInfo: o }, /* @__PURE__ */ r.createElement(
|
|
3421
|
-
Aa,
|
|
3422
|
-
{
|
|
3423
|
-
isDashboardActionbookTester: a._UNSAFE_INTERNAL_isActionbookTester
|
|
3424
|
-
},
|
|
3425
|
-
i,
|
|
3426
|
-
/* @__PURE__ */ r.createElement("div", { id: X.MODAL_ROOT })
|
|
3427
|
-
)))
|
|
3428
|
-
)
|
|
3429
|
-
)));
|
|
3430
|
-
}
|
|
3431
|
-
const xe = new vn(gn.WARN), Hc = new xn(xe), Mt = "@sba/message-template", cn = (e) => `${Mt}/templates/${e}`, dn = () => `${Mt}/token`, Uc = Co({
|
|
3432
|
-
onSetTemplate: (e, t) => {
|
|
3433
|
-
ln[e] || q.setItem(cn(e), t);
|
|
3434
|
-
},
|
|
3435
|
-
onGetTemplate: (e) => {
|
|
3436
|
-
const t = ln[e];
|
|
3437
|
-
return t ? JSON.stringify(t) : q.getItem(cn(e));
|
|
3438
|
-
},
|
|
3439
|
-
onSetCachedToken(e) {
|
|
3440
|
-
q.setItem(dn(), e);
|
|
3441
|
-
},
|
|
3442
|
-
onGetCachedToken() {
|
|
3443
|
-
return q.getItem(dn());
|
|
3444
|
-
},
|
|
3445
|
-
onClear: () => {
|
|
3446
|
-
q.getKeys(Mt).forEach(q.deleteItem);
|
|
3447
|
-
}
|
|
3448
|
-
}), ir = ({ children: e, isOpened: t }) => {
|
|
3449
|
-
const { dir: n, rootElement: o } = N(), i = pe(o, !0);
|
|
3450
|
-
return R(() => {
|
|
3451
|
-
const a = "sb-agent-block-scroll";
|
|
3452
|
-
return t ? i.body.classList.add(a) : i.body.classList.remove(a), () => {
|
|
3453
|
-
i.body.classList.remove(a);
|
|
3454
|
-
};
|
|
3455
|
-
}, [i, t]), /* @__PURE__ */ r.createElement(zc, { dir: n, $visible: t }, e);
|
|
3456
|
-
}, zc = c.div`width:100%;height:100%;position:fixed;top:0;left:0;z-index:${he.WINDOW};visibility:${({ $visible: e }) => e ? "visible" : "hidden"};`;
|
|
3457
|
-
function Wc({
|
|
3458
|
-
className: e,
|
|
3459
|
-
isOpened: t,
|
|
3460
|
-
onClick: n,
|
|
3461
|
-
type: o,
|
|
3462
|
-
imageUrl: i,
|
|
3463
|
-
dir: a,
|
|
3464
|
-
animated: s = !0,
|
|
3465
|
-
backgroundColor: l
|
|
3466
|
-
}) {
|
|
3467
|
-
const d = at(l);
|
|
3468
|
-
return /* @__PURE__ */ r.createElement(
|
|
3469
|
-
jc,
|
|
3470
|
-
{
|
|
3471
|
-
dir: a,
|
|
3472
|
-
id: X.LAUNCHER,
|
|
3473
|
-
className: e,
|
|
3474
|
-
"aria-label": "Sendbird AIAgent Launcher",
|
|
3475
|
-
onClick: n,
|
|
3476
|
-
$animated: s,
|
|
3477
|
-
$backgroundColor: l
|
|
3478
|
-
},
|
|
3479
|
-
/* @__PURE__ */ r.createElement(Kc, { $isOpened: t, $animated: s, $fillColor: d }, /* @__PURE__ */ r.createElement(un.Open, { url: i, isDefaultIcon: o === "default_icon" })),
|
|
3480
|
-
/* @__PURE__ */ r.createElement(Zc, { $isOpened: t, $animated: s, $fillColor: d }, /* @__PURE__ */ r.createElement(un.Close, null))
|
|
3481
|
-
);
|
|
3482
|
-
}
|
|
3483
|
-
const Vc = k`&:hover{transition:transform 250ms cubic-bezier(0.33,0,0,1);transform:scale(1.1);}&:active{transform:scale(0.8);}`, Gc = k`img{width:100%;height:100%;object-fit:cover;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-drag:none;&[data-default-icon='true']{width:32px;height:32px;filter:${({ $fillColor: e }) => e === kn.WHITE ? "grayscale(100%) brightness(2000%)" : "grayscale(100%) invert(100%) saturate(0%) brightness(0%) contrast(1000%)"};}}`, sr = k`svg{width:32px;height:32px;${({ $fillColor: e }) => k`
|
|
3484
|
-
path {
|
|
3485
|
-
fill: ${e};
|
|
3486
|
-
}
|
|
3487
|
-
[class*='fill'] {
|
|
3488
|
-
fill: ${e};
|
|
3489
|
-
}
|
|
3490
|
-
`}
|
|
3491
|
-
}
|
|
3492
|
-
`, jc = c.button`position:relative;padding:0;width:48px;height:48px;background:${({ $backgroundColor: e }) => e};border-radius:50%;transition:all 0.3s cubic-bezier(0.31,-0.105,0.43,1.4);border:none;display:flex;justify-content:center;align-items:center;box-shadow:0 16px 24px 2px rgba(33,33,33,0.12),0 6px 30px 5px rgba(33,33,33,0.08),0 6px 10px -5px rgba(33,33,33,0.04);${({ $animated: e }) => e && Vc}`, ar = c.span`position:absolute;width:100%;height:100%;border-radius:50%;overflow:hidden;transition:transform 0.16s linear,opacity 0.08s linear,scale 0.16s linear;user-select:none;display:flex;justify-content:center;align-items:center;`, Kc = c(ar)`opacity:${({ $isOpened: e }) => e ? 0 : 1};transform:${({ $animated: e, $isOpened: t }) => e && (t ? "rotate(-90deg) scale(0)" : "rotate(0deg)")};${Gc}${sr}`, Zc = c(ar)`scale:${({ $isOpened: e }) => e ? 1 : 0};transform:${({ $animated: e, $isOpened: t }) => e && (t ? "rotate(0deg)" : "rotate(-90deg)")};${sr}`, un = {
|
|
3493
|
-
Open: (e) => e.url ? /* @__PURE__ */ r.createElement("img", { src: e.url, alt: "launcher-img", "data-default-icon": e.isDefaultIcon }) : /* @__PURE__ */ r.createElement(yt, null),
|
|
3494
|
-
Close: () => /* @__PURE__ */ r.createElement($, { size: 32, type: "chevron-down" })
|
|
3495
|
-
};
|
|
3496
|
-
function lr({ className: e }) {
|
|
3497
|
-
const { colors: t } = mt(), { dir: n, state: o } = N(), { launcherInfo: i } = F();
|
|
3498
|
-
return qc(), /* @__PURE__ */ r.createElement(
|
|
3499
|
-
Wc,
|
|
3500
|
-
{
|
|
3501
|
-
dir: n,
|
|
3502
|
-
className: e,
|
|
3503
|
-
isOpened: o.opened,
|
|
3504
|
-
onClick: () => o.setOpened(!o.opened),
|
|
3505
|
-
type: i.type,
|
|
3506
|
-
imageUrl: i.imageUrl,
|
|
3507
|
-
backgroundColor: t.base.primary
|
|
3508
|
-
}
|
|
3509
|
-
);
|
|
3510
|
-
}
|
|
3511
|
-
const Yc = 1e3 * 60;
|
|
3512
|
-
function qc() {
|
|
3513
|
-
const { chatSDK: e, state: t, logger: n, enableAutoDisconnectInLauncher: o } = N(), i = D(null);
|
|
3514
|
-
R(() => {
|
|
3515
|
-
if (!o) return;
|
|
3516
|
-
function a() {
|
|
3517
|
-
i.current && (clearTimeout(i.current), i.current = null);
|
|
3518
|
-
}
|
|
3519
|
-
function s() {
|
|
3520
|
-
e.connectionState === yr.CLOSED && (e.reconnect(), n.debug("useSDKInactivityTimeout: reconnected")), a(), n.debug("useSDKInactivityTimeout: clear disconnect schedule");
|
|
3521
|
-
}
|
|
3522
|
-
function l() {
|
|
3523
|
-
a(), i.current = setTimeout(async () => {
|
|
3524
|
-
await e.disconnectWebSocket(), n.debug("useSDKInactivityTimeout: disconnected");
|
|
3525
|
-
}, Yc);
|
|
3526
|
-
}
|
|
3527
|
-
t.opened ? s() : (l(), n.debug("useSDKInactivityTimeout: schedule disconnect"));
|
|
3528
|
-
}, [o, e, t.opened]);
|
|
3529
|
-
}
|
|
3530
|
-
const cr = ye(null);
|
|
3531
|
-
function Jc() {
|
|
3532
|
-
const e = J(cr);
|
|
3533
|
-
if (!e)
|
|
3534
|
-
throw new Error("useNavigator() must be used within <Navigator />");
|
|
3535
|
-
return e;
|
|
3536
|
-
}
|
|
3537
|
-
function dr({ children: e }) {
|
|
3538
|
-
const t = Jc();
|
|
3539
|
-
return typeof e == "function" ? e(t) : /* @__PURE__ */ r.createElement(r.Fragment, null, e);
|
|
3540
|
-
}
|
|
3541
|
-
const Xc = pn`0%{transform:translateY(40px);opacity:0;}100%{transform:translateY(0px);opacity:1;}`, Qc = pn`0%{transform:translateY(0px);opacity:1;}100%{transform:translateY(40px);opacity:0;}`, ed = k`animation-name:${Xc};animation-duration:0.3s;animation-fill-mode:forwards;`, td = k``, nd = k`animation-name:${Qc};animation-duration:0.3s;animation-fill-mode:forwards;`, rd = k`visibility:hidden;`, od = c.div`position:absolute;top:0;left:0;width:100%;height:100%;${({ $transitionState: e }) => {
|
|
3542
|
-
switch (e) {
|
|
3543
|
-
case "entering":
|
|
3544
|
-
return ed;
|
|
3545
|
-
case "entered":
|
|
3546
|
-
return td;
|
|
3547
|
-
case "exiting":
|
|
3548
|
-
return nd;
|
|
3549
|
-
case "exited":
|
|
3550
|
-
return rd;
|
|
3551
|
-
default:
|
|
3552
|
-
return "";
|
|
3553
|
-
}
|
|
3554
|
-
}}${({ $active: e }) => e ? k`
|
|
3555
|
-
z-index: 999;
|
|
3556
|
-
` : k`z-index:1;pointer-events:none;`}
|
|
3557
|
-
`;
|
|
3558
|
-
function Ae({ initialId: e, children: t }) {
|
|
3559
|
-
const n = P((f, y) => {
|
|
3560
|
-
d((_) => [..._, f]), m((_) => ({ ..._, [f]: !0 })), y != null && y.reset && x((_) => ({
|
|
3561
|
-
..._,
|
|
3562
|
-
[f]: (_[f] || 0) + 1
|
|
3563
|
-
})), h((_) => ({
|
|
3564
|
-
..._,
|
|
3565
|
-
[f]: "entering"
|
|
3566
|
-
})), setTimeout(() => {
|
|
3567
|
-
h((_) => ({
|
|
3568
|
-
..._,
|
|
3569
|
-
[f]: "entered"
|
|
3570
|
-
}));
|
|
3571
|
-
}, 300);
|
|
3572
|
-
}, []), o = P(() => {
|
|
3573
|
-
d((f) => {
|
|
3574
|
-
if (f.length <= 1) return f;
|
|
3575
|
-
const y = f[f.length - 1];
|
|
3576
|
-
return h((_) => ({
|
|
3577
|
-
..._,
|
|
3578
|
-
[y]: "exiting"
|
|
3579
|
-
})), setTimeout(() => {
|
|
3580
|
-
h((_) => ({
|
|
3581
|
-
..._,
|
|
3582
|
-
[y]: "exited"
|
|
3583
|
-
})), d((_) => _.slice(0, -1));
|
|
3584
|
-
}, 300), f;
|
|
3585
|
-
});
|
|
3586
|
-
}, []), i = Ie(() => ({
|
|
3587
|
-
navigation: {
|
|
3588
|
-
navigate: n,
|
|
3589
|
-
pop: o
|
|
3590
|
-
}
|
|
3591
|
-
}), [n, o]), a = Ie(() => hr.toArray(t).filter(
|
|
3592
|
-
(f) => f.type === dr
|
|
3593
|
-
), [t]), s = Ie(() => {
|
|
3594
|
-
const f = {};
|
|
3595
|
-
return a.forEach((y) => {
|
|
3596
|
-
const { id: _, lazy: w, children: O } = y.props;
|
|
3597
|
-
f[_] = { lazy: w, element: typeof O == "function" ? O(i) : O };
|
|
3598
|
-
}), f;
|
|
3599
|
-
}, [a]), [l, d] = T([e]), [g, m] = T(() => {
|
|
3600
|
-
const f = {};
|
|
3601
|
-
return Object.entries(s).forEach(([y, { lazy: _ }]) => {
|
|
3602
|
-
_ === !1 && (f[y] = !0);
|
|
3603
|
-
}), f[e] = !0, f;
|
|
3604
|
-
}), [p, h] = T(() => {
|
|
3605
|
-
const f = {};
|
|
3606
|
-
return Object.keys(s).forEach((y) => {
|
|
3607
|
-
y === e ? f[y] = "entered" : f[y] = "exited";
|
|
3608
|
-
}), f;
|
|
3609
|
-
}), [b, x] = T({}), v = l[l.length - 1];
|
|
3610
|
-
return /* @__PURE__ */ r.createElement(cr.Provider, { value: i }, /* @__PURE__ */ r.createElement(id, null, Object.keys(s).map((f) => {
|
|
3611
|
-
var O;
|
|
3612
|
-
if (!g[f]) return null;
|
|
3613
|
-
const y = p[f] || "exited", _ = f === v, w = `${f}-${b[f] || 0}`;
|
|
3614
|
-
return /* @__PURE__ */ r.createElement(od, { key: w, $transitionState: y, $active: _ }, (O = s[f]) == null ? void 0 : O.element);
|
|
3615
|
-
})));
|
|
3616
|
-
}
|
|
3617
|
-
const id = c.div`position:relative;width:100%;height:100%;`;
|
|
3618
|
-
Ae.Screen = dr;
|
|
3619
|
-
const ue = {
|
|
3620
|
-
activeConv: "active-conv",
|
|
3621
|
-
closedConv: "closed-conv",
|
|
3622
|
-
convList: "conv-list"
|
|
3623
|
-
}, ur = ({ setClosedChannelUrl: e, closedChannelUrl: t }) => /* @__PURE__ */ r.createElement(Ae, { initialId: ue.activeConv }, /* @__PURE__ */ r.createElement(Ae.Screen, { id: ue.activeConv }, ({ navigation: n }) => /* @__PURE__ */ r.createElement(an, { onNavigateToConversationList: () => n.navigate(ue.convList, { reset: !0 }) })), /* @__PURE__ */ r.createElement(Ae.Screen, { id: ue.closedConv }, ({ navigation: n }) => /* @__PURE__ */ r.createElement(
|
|
3624
|
-
an,
|
|
3625
|
-
{
|
|
3626
|
-
onNavigateToConversationList: () => n.pop(),
|
|
3627
|
-
closedChannelUrl: t,
|
|
3628
|
-
onClearClosedChannelUrl: () => e(void 0)
|
|
3629
|
-
}
|
|
3630
|
-
)), /* @__PURE__ */ r.createElement(Ae.Screen, { id: ue.convList, lazy: !0 }, ({ navigation: n }) => /* @__PURE__ */ r.createElement(
|
|
3631
|
-
Mc,
|
|
3632
|
-
{
|
|
3633
|
-
onOpenConversationView: (o, i) => {
|
|
3634
|
-
i === "closed" ? (e(o), n.navigate(ue.closedConv, { reset: !0 })) : n.navigate(ue.activeConv);
|
|
3635
|
-
}
|
|
3636
|
-
}
|
|
3637
|
-
)));
|
|
3638
|
-
function sd({ isExpanded: e, isOpened: t, children: n, launcher: o }) {
|
|
3639
|
-
const { dir: i } = N();
|
|
3640
|
-
return /* @__PURE__ */ r.createElement(ad, null, /* @__PURE__ */ r.createElement(ld, { dir: i, id: X.WINDOW, $isExpanded: e, $isOpened: t }, n), o);
|
|
3641
|
-
}
|
|
3642
|
-
const ad = c.div`display:flex;flex-direction:column;gap:8px;align-items:flex-end;`, ld = c.div`background:${({ theme: e }) => e.colors.base.background};display:flex;overscroll-behavior:none;-webkit-overflow-scrolling:auto;height:640px;min-height:80px;width:400px;max-width:80vw;max-height:80vh;box-shadow:0px 16px 24px 2px rgba(33,33,33,0.12),0px 6px 30px 5px rgba(33,33,33,0.08),0px 6px 10px -5px rgba(33,33,33,0.04);border-radius:16px;overflow:hidden;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 150ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;transform:scale(0.15);opacity:0;transform-origin:right bottom;[dir='rtl'] &:not([dir='ltr']),&[dir='rtl']{transform-origin:left bottom;}${({ $isOpened: e }) => e && dd};${({ $isExpanded: e }) => e && cd};`, cd = k`width:743px;height:723px;`, dd = k`z-index:${he.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;`, Ld = ({ children: e, ...t }) => {
|
|
3643
|
-
const n = Le(), [o, i] = T(), a = n ? ir : sd;
|
|
3644
|
-
return /* @__PURE__ */ r.createElement(or, { enableExpandButton: !n, ...t }, /* @__PURE__ */ r.createElement(Mn, null, ({ state: s }) => /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(a, { isExpanded: s.expanded, isOpened: s.opened, launcher: /* @__PURE__ */ r.createElement(lr, null) }, /* @__PURE__ */ r.createElement(
|
|
3645
|
-
ur,
|
|
3646
|
-
{
|
|
3647
|
-
closedChannelUrl: o,
|
|
3648
|
-
setClosedChannelUrl: i
|
|
3649
|
-
}
|
|
3650
|
-
)), e)));
|
|
3651
|
-
};
|
|
3652
|
-
function ud(e) {
|
|
3653
|
-
return /* @__PURE__ */ r.createElement(md, { ...e });
|
|
3654
|
-
}
|
|
3655
|
-
const md = c(lr)`position:fixed;z-index:${he.LAUNCHER};bottom:24px;inset-inline-end:24px;`;
|
|
3656
|
-
function gd({ isExpanded: e, isOpened: t, children: n }) {
|
|
3657
|
-
const { dir: o } = N();
|
|
3658
|
-
return /* @__PURE__ */ r.createElement(pd, { dir: o, id: X.WINDOW, $isExpanded: e, $isOpened: t }, n);
|
|
3659
|
-
}
|
|
3660
|
-
const pd = c.div`background:${({ theme: e }) => e.colors.base.background};display:flex;overscroll-behavior:none;-webkit-overflow-scrolling:auto;position:fixed;bottom:84px;inset-inline-end:20px;height:640px;min-height:80px;width:400px;max-width:80vw;max-height:80vh;box-shadow:0px 16px 24px 2px rgba(33,33,33,0.12),0px 6px 30px 5px rgba(33,33,33,0.08),0px 6px 10px -5px rgba(33,33,33,0.04);border-radius:16px;overflow:hidden;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 150ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;transform:scale(0.15);opacity:0;transform-origin:right bottom;[dir='rtl'] &:not([dir='ltr']),&[dir='rtl']{transform-origin:left bottom;}${({ $isOpened: e }) => e && fd};${({ $isExpanded: e }) => e && hd};`, hd = k`width:743px;height:723px;`, fd = k`z-index:${he.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;`, Rd = ({ children: e, ...t }) => {
|
|
3661
|
-
const n = Le(), [o, i] = T(), a = n ? ir : gd;
|
|
3662
|
-
return /* @__PURE__ */ r.createElement(or, { enableExpandButton: !n, ...t }, /* @__PURE__ */ r.createElement(Mn, null, ({ state: s }) => /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(a, { isExpanded: s.expanded, isOpened: s.opened }, /* @__PURE__ */ r.createElement(
|
|
3663
|
-
ur,
|
|
3664
|
-
{
|
|
3665
|
-
closedChannelUrl: o,
|
|
3666
|
-
setClosedChannelUrl: i
|
|
3667
|
-
}
|
|
3668
|
-
)), /* @__PURE__ */ r.createElement(ud, null), e)));
|
|
3669
|
-
};
|
|
3670
|
-
export {
|
|
3671
|
-
ft as A,
|
|
3672
|
-
Xr as C,
|
|
3673
|
-
Ld as D,
|
|
3674
|
-
Rd as F,
|
|
3675
|
-
$ as I,
|
|
3676
|
-
Un as L,
|
|
3677
|
-
Sa as M,
|
|
3678
|
-
_t as O,
|
|
3679
|
-
Od as P,
|
|
3680
|
-
St as S,
|
|
3681
|
-
S as a,
|
|
3682
|
-
or as b,
|
|
3683
|
-
u as c,
|
|
3684
|
-
Fc as d,
|
|
3685
|
-
F as e,
|
|
3686
|
-
M as f,
|
|
3687
|
-
Wc as g,
|
|
3688
|
-
ve as h,
|
|
3689
|
-
me as i,
|
|
3690
|
-
rr as j,
|
|
3691
|
-
an as k,
|
|
3692
|
-
It as l,
|
|
3693
|
-
Hc as m,
|
|
3694
|
-
Mc as n,
|
|
3695
|
-
$t as o,
|
|
3696
|
-
En as p,
|
|
3697
|
-
N as u
|
|
3698
|
-
};
|