@sendbird/ai-agent-messenger-react 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{BQqygmjw.cjs → BCIx4Qv_.cjs} +1 -1
- package/dist/cjs/{DMxlnbEy.cjs → Cb__vcY_.cjs} +1 -1
- package/dist/cjs/ChFlUdD0.cjs +207 -0
- package/dist/cjs/{8flIqihd.cjs → CrVpYSzZ.cjs} +1 -1
- package/dist/cjs/{B3LqSSG5.cjs → DyfwCarh.cjs} +1 -1
- package/dist/cjs/{BvXE2Myz.cjs → pxYCwAlg.cjs} +1 -1
- package/dist/es/{DNKomW8O.js → BuMtQ0m7.js} +1 -1
- package/dist/es/{CorQ5vL_.js → CKTGU2qP.js} +1 -1
- package/dist/es/{ccfzGnJU.js → CV59hwzK.js} +1 -1
- package/dist/es/{4nxZMIz3.js → CwdCJ7xG.js} +1 -1
- package/dist/es/{3qBdtnlJ.js → D43pgxiz.js} +781 -761
- package/dist/es/{DFlRbX2F.js → DOAkPSN5.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +32 -2
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/dist/cjs/rl6FrW6Y.cjs +0 -207
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as r from "react";
|
|
2
|
-
import { createContext as ve, useContext as
|
|
2
|
+
import { createContext as ve, useContext as Q, useEffect as L, useState as _, useId as bn, useRef as N, useCallback as R, useMemo as ae, forwardRef as ye, useImperativeHandle as Er, useLayoutEffect as le, lazy as T, Suspense as ke, Component as xr, Fragment as Ut, useReducer as Cr, Children as vr } from "react";
|
|
3
3
|
import yr, { SendbirdProduct as _r, DeviceOsPlatform as Ht, SendbirdPlatform as Sr, ConnectionHandler as Je, SendbirdError as Tr, SessionHandler as wr, LogLevel as En, ConnectionState as Ar } from "@sendbird/chat";
|
|
4
4
|
import u, { css as I, ThemeProvider as kr, useTheme as xt, createGlobalStyle as Ir, StyleSheetManager as $r, keyframes as xn } from "styled-components";
|
|
5
5
|
import { format as Cn, isSameMinute as zt, isSameDay as Mr } from "date-fns";
|
|
@@ -15,13 +15,13 @@ import { isSameDay as Wr } from "date-fns/isSameDay";
|
|
|
15
15
|
import { createPortal as Gr } from "react-dom";
|
|
16
16
|
import jr from "@emotion/is-prop-valid";
|
|
17
17
|
const G = (e, t) => {
|
|
18
|
-
const n = ve(null), o = ({ children:
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
18
|
+
const n = ve(null), o = ({ children: a, value: l }) => /* @__PURE__ */ r.createElement(n.Provider, { value: l }, typeof a == "function" ? a(l) : a), s = ({ children: a }) => /* @__PURE__ */ r.createElement(n.Consumer, null, (l) => l ? typeof a == "function" ? a(l) : a : null), i = () => {
|
|
19
|
+
const a = Q(n);
|
|
20
|
+
if (!a)
|
|
21
21
|
throw new Error(`use${e}Context must be used within a ${e}Provider`);
|
|
22
|
-
return
|
|
22
|
+
return a;
|
|
23
23
|
};
|
|
24
|
-
return n.displayName = `${e}Context`, o.displayName = `${e}Provider`, s.displayName = `${e}Consumer`,
|
|
24
|
+
return n.displayName = `${e}Context`, o.displayName = `${e}Provider`, s.displayName = `${e}Consumer`, i.displayName = `use${e}Context`, { Context: n, Provider: o, Consumer: s, useContext: i };
|
|
25
25
|
};
|
|
26
26
|
function _e(e) {
|
|
27
27
|
const t = ve({
|
|
@@ -32,31 +32,31 @@ function _e(e) {
|
|
|
32
32
|
updateComponent: () => {
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
function n({ children:
|
|
36
|
-
const [
|
|
37
|
-
Template:
|
|
38
|
-
updateTemplate: (
|
|
35
|
+
function n({ children: i }) {
|
|
36
|
+
const [a, l] = _(() => e.template), [c, d] = _(e.components), h = {
|
|
37
|
+
Template: a,
|
|
38
|
+
updateTemplate: (m) => l(() => m),
|
|
39
39
|
components: c,
|
|
40
|
-
updateComponent: (
|
|
40
|
+
updateComponent: (m, f) => d((x) => ({ ...x, [m]: f }))
|
|
41
41
|
};
|
|
42
|
-
return /* @__PURE__ */ r.createElement(t.Provider, { value:
|
|
42
|
+
return /* @__PURE__ */ r.createElement(t.Provider, { value: h }, i);
|
|
43
43
|
}
|
|
44
|
-
function o({ template:
|
|
45
|
-
const { updateTemplate: l } =
|
|
44
|
+
function o({ template: i, children: a }) {
|
|
45
|
+
const { updateTemplate: l } = Q(t);
|
|
46
46
|
return L(() => {
|
|
47
|
-
|
|
48
|
-
}, [
|
|
47
|
+
i && l(i);
|
|
48
|
+
}, [i]), /* @__PURE__ */ r.createElement(r.Fragment, null, a);
|
|
49
49
|
}
|
|
50
|
-
function s({ children:
|
|
51
|
-
return /* @__PURE__ */ r.createElement(n, null,
|
|
50
|
+
function s({ children: i }) {
|
|
51
|
+
return /* @__PURE__ */ r.createElement(n, null, i);
|
|
52
52
|
}
|
|
53
|
-
return s.defaults = e, s.useContext = () =>
|
|
54
|
-
s[
|
|
53
|
+
return s.defaults = e, s.useContext = () => Q(t), s.Context = t, s.Template = o, Object.keys(e.components).forEach((i) => {
|
|
54
|
+
s[i] = function({
|
|
55
55
|
component: l
|
|
56
56
|
}) {
|
|
57
|
-
const { updateComponent: c } =
|
|
57
|
+
const { updateComponent: c } = Q(t);
|
|
58
58
|
return L(() => {
|
|
59
|
-
l && c(
|
|
59
|
+
l && c(i, l);
|
|
60
60
|
}, [l]), null;
|
|
61
61
|
};
|
|
62
62
|
}), s;
|
|
@@ -104,15 +104,15 @@ const Vt = (e) => {
|
|
|
104
104
|
return ((t = e.extendedMessagePayload) == null ? void 0 : t.bot_message_type) === "generated";
|
|
105
105
|
},
|
|
106
106
|
checkExtendedFieldPresence(e) {
|
|
107
|
-
const t = e.extendedMessagePayload || {}, n = (
|
|
108
|
-
return { ui: o, trail: s, marking:
|
|
107
|
+
const t = e.extendedMessagePayload || {}, n = (a) => a.some((l) => typeof t[l] < "u"), o = n(ot.ui), s = n(ot.trail), i = n(ot.marking);
|
|
108
|
+
return { ui: o, trail: s, marking: i };
|
|
109
109
|
},
|
|
110
110
|
shouldScrollToBottom(e, t, n = !1) {
|
|
111
111
|
if ((e.isUserMessage() || e.isFileMessage() || e.isMultipleFilesMessage()) && e.sender.userId === t) {
|
|
112
112
|
if (this.isGeneratedMessage(e) && this.isStreaming(e))
|
|
113
113
|
return !0;
|
|
114
|
-
const { ui:
|
|
115
|
-
return
|
|
114
|
+
const { ui: i, trail: a, marking: l } = this.checkExtendedFieldPresence(e);
|
|
115
|
+
return i ? !(!n && l) : !!(n && (a || l));
|
|
116
116
|
}
|
|
117
117
|
return !0;
|
|
118
118
|
}
|
|
@@ -120,20 +120,20 @@ const Vt = (e) => {
|
|
|
120
120
|
ui: ["suggested_replies", "cta_button", "message_template", "csat"],
|
|
121
121
|
trail: ["groundedness", "manual", "function_calls"],
|
|
122
122
|
marking: ["is_hallucination", "is_moderated", "flagged_types"]
|
|
123
|
-
}, qr = "1.3.
|
|
123
|
+
}, qr = "1.3.1", Ee = "sb-agent", Jr = qr, st = `@${Ee}`, Wt = ({ appId: e, aiAgentId: t, storage: n }) => {
|
|
124
124
|
const o = {
|
|
125
125
|
templateBase: `${st}-template`,
|
|
126
126
|
template: (s) => `${o.templateBase}/templates/${s}`,
|
|
127
127
|
templateToken: () => `${o.templateBase}-template/message-template/tokens`,
|
|
128
128
|
messengerSession: (s) => {
|
|
129
|
-
const
|
|
130
|
-
return `${st}-udata/${
|
|
129
|
+
const i = Yr(`${e}/${t}/${s}`);
|
|
130
|
+
return `${st}-udata/${i}`;
|
|
131
131
|
},
|
|
132
132
|
anonUserSession: () => `${st}-session/${e}/${t}`
|
|
133
133
|
};
|
|
134
134
|
return {
|
|
135
135
|
template: {
|
|
136
|
-
set: (s,
|
|
136
|
+
set: (s, i) => n.set(o.template(s), i),
|
|
137
137
|
get: (s) => n.get(o.template(s)),
|
|
138
138
|
setCachedToken: (s) => n.set(o.templateToken(), s),
|
|
139
139
|
getCachedToken: () => n.get(o.templateToken()),
|
|
@@ -144,16 +144,16 @@ const Vt = (e) => {
|
|
|
144
144
|
messenger: {
|
|
145
145
|
getSettings: (s) => {
|
|
146
146
|
try {
|
|
147
|
-
const
|
|
148
|
-
return
|
|
147
|
+
const i = n.get(o.messengerSession(s));
|
|
148
|
+
return i ? JSON.parse(i) : null;
|
|
149
149
|
} catch {
|
|
150
150
|
return null;
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
|
-
setSettings: (s,
|
|
153
|
+
setSettings: (s, i) => {
|
|
154
154
|
try {
|
|
155
|
-
const
|
|
156
|
-
n.set(o.messengerSession(s),
|
|
155
|
+
const a = JSON.stringify(i);
|
|
156
|
+
n.set(o.messengerSession(s), a);
|
|
157
157
|
} catch {
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
@@ -168,8 +168,8 @@ const Vt = (e) => {
|
|
|
168
168
|
},
|
|
169
169
|
setAnonUser: (s) => {
|
|
170
170
|
try {
|
|
171
|
-
const
|
|
172
|
-
n.set(o.anonUserSession(),
|
|
171
|
+
const i = JSON.stringify(s);
|
|
172
|
+
n.set(o.anonUserSession(), i);
|
|
173
173
|
} catch {
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
@@ -192,9 +192,9 @@ class _n {
|
|
|
192
192
|
const n = Xr(), o = this.subscribers[t.type];
|
|
193
193
|
if (o) {
|
|
194
194
|
this.logger.debug(`messenger.dispatcher: dispatching command: ${t.type}`, t.payload);
|
|
195
|
-
const s = o.map((
|
|
196
|
-
await Promise.all(s).catch((
|
|
197
|
-
this.logger.error(`messenger.dispatcher: error in callback for command: ${t.type}`,
|
|
195
|
+
const s = o.map((i) => i(t.payload));
|
|
196
|
+
await Promise.all(s).catch((i) => {
|
|
197
|
+
this.logger.error(`messenger.dispatcher: error in callback for command: ${t.type}`, i);
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
return n.resolve(), n.promise;
|
|
@@ -256,52 +256,55 @@ function eo({
|
|
|
256
256
|
keyValueStorage: n,
|
|
257
257
|
language: o,
|
|
258
258
|
countryCode: s,
|
|
259
|
-
context:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
259
|
+
context: i,
|
|
260
|
+
queryParams: a,
|
|
261
|
+
chatSDK: l,
|
|
262
|
+
chatParams: c,
|
|
263
|
+
children: d,
|
|
264
|
+
logger: h,
|
|
265
|
+
dispatcher: m,
|
|
266
|
+
extensions: f = {
|
|
266
267
|
platform: Sr.JS,
|
|
267
268
|
deviceOSPlatform: Zr() ? Ht.MOBILE_WEB : Ht.WEB
|
|
268
269
|
}
|
|
269
270
|
}) {
|
|
270
|
-
const [
|
|
271
|
-
const b =
|
|
271
|
+
const [x, E] = _(() => {
|
|
272
|
+
const b = h ?? new Tn(Sn.WARN), g = m ?? new _n(b);
|
|
272
273
|
return {
|
|
273
274
|
appId: e,
|
|
274
275
|
aiAgentId: t,
|
|
275
276
|
language: o,
|
|
276
277
|
countryCode: s,
|
|
277
|
-
context:
|
|
278
|
+
context: i,
|
|
279
|
+
queryParams: a,
|
|
278
280
|
keyValueStorage: n,
|
|
279
281
|
logger: b,
|
|
280
|
-
dispatcher:
|
|
281
|
-
chatSDK:
|
|
282
|
+
dispatcher: g,
|
|
283
|
+
chatSDK: l ?? Gt(e, f, c),
|
|
282
284
|
cache: Wt({ appId: e, aiAgentId: t, storage: n })
|
|
283
285
|
};
|
|
284
286
|
});
|
|
285
287
|
return L(() => {
|
|
286
|
-
|
|
287
|
-
let
|
|
288
|
-
return
|
|
288
|
+
E((b) => {
|
|
289
|
+
let g = b.logger, C = b.dispatcher, v = b.chatSDK;
|
|
290
|
+
return h && h !== b.logger && (g = h), m && m !== b.dispatcher && (C = m), l && l !== b.chatSDK ? v = l : !l && b.chatSDK.appId !== e && (v = Gt(e, f, { newInstance: !0, ...c })), {
|
|
289
291
|
...b,
|
|
290
292
|
appId: e,
|
|
291
293
|
aiAgentId: t,
|
|
292
294
|
keyValueStorage: n,
|
|
293
295
|
language: o,
|
|
294
296
|
countryCode: s,
|
|
295
|
-
context:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
context: i,
|
|
298
|
+
queryParams: a,
|
|
299
|
+
logger: g,
|
|
300
|
+
dispatcher: C,
|
|
301
|
+
chatSDK: v,
|
|
299
302
|
cache: Wt({ appId: e, aiAgentId: t, storage: n })
|
|
300
303
|
};
|
|
301
304
|
});
|
|
302
|
-
}, [e, t, o, s,
|
|
303
|
-
|
|
304
|
-
}, [
|
|
305
|
+
}, [e, t, o, s, i, h, m, l]), L(() => () => {
|
|
306
|
+
x.chatSDK.disconnectWebSocket();
|
|
307
|
+
}, [x.chatSDK]), /* @__PURE__ */ r.createElement(Qr, { value: x }, d);
|
|
305
308
|
}
|
|
306
309
|
const to = (e, t, n) => Dr(e, t, { ...n, strictStreamingOrder: !0 });
|
|
307
310
|
var mt = /* @__PURE__ */ ((e) => (e.ConversationClose = "conv.close", e))(mt || {});
|
|
@@ -330,12 +333,12 @@ function io({
|
|
|
330
333
|
onChannelDeleted: n,
|
|
331
334
|
onMessagesReceived: o,
|
|
332
335
|
onMessagesUpdated: s,
|
|
333
|
-
onConversationClosedViaDispatcher:
|
|
334
|
-
onBeforeSendMessage:
|
|
336
|
+
onConversationClosedViaDispatcher: i,
|
|
337
|
+
onBeforeSendMessage: a,
|
|
335
338
|
onAfterSendMessage: l = ut
|
|
336
339
|
}) {
|
|
337
|
-
var
|
|
338
|
-
const { chatSDK: c, logger: d, dispatcher:
|
|
340
|
+
var g;
|
|
341
|
+
const { chatSDK: c, logger: d, dispatcher: h } = ue(), { channel: m, channelFetchError: f, fetchChannel: x } = ao(t), E = to(c, m, {
|
|
339
342
|
shouldCountNewMessages: () => !1,
|
|
340
343
|
onChannelDeleted: n,
|
|
341
344
|
onMessagesReceived: (C) => o == null ? void 0 : o(C),
|
|
@@ -345,48 +348,48 @@ function io({
|
|
|
345
348
|
L(() => {
|
|
346
349
|
const C = async (v) => {
|
|
347
350
|
const S = typeof (v == null ? void 0 : v.channelUrl) == "string";
|
|
348
|
-
|
|
351
|
+
m && S && v.channelUrl !== m.url || (d.debug("conversation.dispatcher: try to close conversation", m), m != null && m.conversation && m.conversation.status === W.OPEN && (await m.closeConversation(), i == null || i()));
|
|
349
352
|
};
|
|
350
|
-
return
|
|
351
|
-
|
|
353
|
+
return h.subscribe(mt.ConversationClose, C), () => {
|
|
354
|
+
h.unsubscribe(mt.ConversationClose, C);
|
|
352
355
|
};
|
|
353
|
-
}, [
|
|
354
|
-
const
|
|
355
|
-
conversation: (
|
|
356
|
+
}, [h, (g = m == null ? void 0 : m.conversation) == null ? void 0 : g.status, i]);
|
|
357
|
+
const b = {
|
|
358
|
+
conversation: (m == null ? void 0 : m.conversation) ?? void 0,
|
|
356
359
|
channelSource: {
|
|
357
|
-
channel:
|
|
360
|
+
channel: m,
|
|
358
361
|
error: f,
|
|
359
362
|
refetch: () => x()
|
|
360
363
|
},
|
|
361
364
|
messageSource: {
|
|
362
|
-
messages:
|
|
363
|
-
initialized:
|
|
364
|
-
loadPrevious: () =>
|
|
365
|
-
loadNext: () =>
|
|
365
|
+
messages: E.messages,
|
|
366
|
+
initialized: E.initialized,
|
|
367
|
+
loadPrevious: () => E.loadPrevious(),
|
|
368
|
+
loadNext: () => E.loadNext(),
|
|
366
369
|
sendUserMessage: async (C) => {
|
|
367
370
|
var S;
|
|
368
|
-
if (((S =
|
|
371
|
+
if (((S = m == null ? void 0 : m.conversation) == null ? void 0 : S.status) === W.CLOSED)
|
|
369
372
|
throw new Error("Conversation is closed");
|
|
370
|
-
|
|
371
|
-
const v = await
|
|
373
|
+
a && (C = await a(C));
|
|
374
|
+
const v = await E.sendUserMessage(C, l);
|
|
372
375
|
return l == null || l(v), v;
|
|
373
376
|
},
|
|
374
377
|
sendFileMessage: async (C) => {
|
|
375
378
|
var S;
|
|
376
|
-
if (((S =
|
|
379
|
+
if (((S = m == null ? void 0 : m.conversation) == null ? void 0 : S.status) === W.CLOSED)
|
|
377
380
|
throw new Error("Conversation is closed");
|
|
378
|
-
|
|
379
|
-
const v = await
|
|
381
|
+
a && (C = await a(C));
|
|
382
|
+
const v = await E.sendFileMessage(C, l);
|
|
380
383
|
return l == null || l(v), v;
|
|
381
384
|
}
|
|
382
385
|
}
|
|
383
386
|
};
|
|
384
|
-
return /* @__PURE__ */ r.createElement(so, { value:
|
|
387
|
+
return /* @__PURE__ */ r.createElement(so, { value: b }, e);
|
|
385
388
|
}
|
|
386
389
|
function ao(e) {
|
|
387
|
-
const { chatSDK: t, logger: n } = ue(), [o, s] = _(void 0), [
|
|
390
|
+
const { chatSDK: t, logger: n } = ue(), [o, s] = _(void 0), [i, a] = _(void 0);
|
|
388
391
|
async function l() {
|
|
389
|
-
if (n.debug("conversation.fetchChannel: start"), s(void 0),
|
|
392
|
+
if (n.debug("conversation.fetchChannel: start"), s(void 0), a(void 0), e)
|
|
390
393
|
try {
|
|
391
394
|
n.debug("conversation.fetchChannel: get channel", e);
|
|
392
395
|
const c = await t.groupChannel.getChannel(e);
|
|
@@ -394,14 +397,14 @@ function ao(e) {
|
|
|
394
397
|
const d = new Je({ onReconnectSucceeded: () => c.refresh() });
|
|
395
398
|
t.addConnectionHandler(`sba-refresh-${e}`, d), n.debug("conversation.fetchChannel: fetched channel", c);
|
|
396
399
|
} catch (c) {
|
|
397
|
-
c instanceof Tr &&
|
|
400
|
+
c instanceof Tr && a(c), n.error("conversation.fetchChannel: error", c);
|
|
398
401
|
}
|
|
399
402
|
}
|
|
400
403
|
return L(() => {
|
|
401
404
|
l();
|
|
402
405
|
}, [e, t]), {
|
|
403
406
|
channel: o,
|
|
404
|
-
channelFetchError:
|
|
407
|
+
channelFetchError: i,
|
|
405
408
|
fetchChannel: l
|
|
406
409
|
};
|
|
407
410
|
}
|
|
@@ -412,11 +415,11 @@ class lo {
|
|
|
412
415
|
* @param params - Configuration parameters for the collection
|
|
413
416
|
*/
|
|
414
417
|
constructor(t, { filter: n, limit: o = 20 }) {
|
|
415
|
-
var s,
|
|
418
|
+
var s, i, a, l, c;
|
|
416
419
|
this._isDisposed = !1, this._handlerId = `handler-id-${Date.now()}`, this._order = vn.LATEST_LAST_MESSAGE, this.filter = n, this._sdk = t, this._pinnedChannels = [], this._channels = [], this._limit = o, this._query = this._sdk.aiAgent.createMyGroupChannelListQuery({
|
|
417
420
|
aiAgentChannelFilter: (s = this.filter) == null ? void 0 : s.aiAgentChannelFilter,
|
|
418
|
-
aiAgentConversationStatusFilter: (
|
|
419
|
-
aiAgentIds: (
|
|
421
|
+
aiAgentConversationStatusFilter: (i = this.filter) == null ? void 0 : i.aiAgentConversationStatusFilter,
|
|
422
|
+
aiAgentIds: (a = this.filter) == null ? void 0 : a.aiAgentIds,
|
|
420
423
|
deskChannelFilter: (l = this.filter) == null ? void 0 : l.deskChannelFilter,
|
|
421
424
|
pinnedChannelUrls: (c = this.filter) == null ? void 0 : c.pinnedChannelUrls,
|
|
422
425
|
limit: this._limit
|
|
@@ -444,10 +447,10 @@ class lo {
|
|
|
444
447
|
* @param channels - Array of channels to analyze
|
|
445
448
|
*/
|
|
446
449
|
_setDefaultChangelogsSyncTimestamp(t) {
|
|
447
|
-
var
|
|
448
|
-
const n = new Set(((
|
|
450
|
+
var i, a;
|
|
451
|
+
const n = new Set(((i = this.filter) == null ? void 0 : i.pinnedChannelUrls) ?? []), o = t.find((l) => !n.has(l.url));
|
|
449
452
|
let s;
|
|
450
|
-
o ? s = ((
|
|
453
|
+
o ? s = ((a = o.lastMessage) == null ? void 0 : a.createdAt) ?? o.createdAt : s = this._query.lastResponseAt, this._timestamp > s && (this._timestamp = s);
|
|
451
454
|
}
|
|
452
455
|
/**
|
|
453
456
|
* Synchronizes channel changelogs to keep the collection up-to-date.
|
|
@@ -474,20 +477,20 @@ class lo {
|
|
|
474
477
|
*/
|
|
475
478
|
_upsertPinnedChannelsToArray(t) {
|
|
476
479
|
var l;
|
|
477
|
-
const n = ((l = this.filter) == null ? void 0 : l.pinnedChannelUrls) ?? [], o = new Map(n.map((c, d) => [c, d])), s = [],
|
|
480
|
+
const n = ((l = this.filter) == null ? void 0 : l.pinnedChannelUrls) ?? [], o = new Map(n.map((c, d) => [c, d])), s = [], i = [], a = [];
|
|
478
481
|
for (const c of t) {
|
|
479
482
|
if (!this._query.belongsTo(c)) {
|
|
480
|
-
|
|
483
|
+
a.push(c.url);
|
|
481
484
|
continue;
|
|
482
485
|
}
|
|
483
486
|
const d = o.get(c.url);
|
|
484
487
|
if (d === void 0) continue;
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
const f = this._pinnedChannels.findIndex((
|
|
488
|
+
const h = gt(this._pinnedChannels, c);
|
|
489
|
+
h >= 0 ? (this._pinnedChannels.splice(h, 1), i.push(c)) : s.push(c);
|
|
490
|
+
const f = this._pinnedChannels.findIndex((E) => (o.get(E.url) ?? 1 / 0) > d), x = f === -1 ? this._pinnedChannels.length : f;
|
|
488
491
|
this._pinnedChannels.splice(x, 0, c);
|
|
489
492
|
}
|
|
490
|
-
return { addedChannels: s, updatedChannels:
|
|
493
|
+
return { addedChannels: s, updatedChannels: i, unmatchedChannelUrls: a };
|
|
491
494
|
}
|
|
492
495
|
/**
|
|
493
496
|
* Upserts regular (non-pinned) channels with time-based sorting.
|
|
@@ -496,18 +499,18 @@ class lo {
|
|
|
496
499
|
* @returns Object containing added, updated channels and unmatched URLs
|
|
497
500
|
*/
|
|
498
501
|
_upsertRegularChannelsToArray(t, n = !1) {
|
|
499
|
-
const o = [], s = [],
|
|
500
|
-
for (const
|
|
501
|
-
if (!this._query.belongsTo(
|
|
502
|
-
o.push(
|
|
502
|
+
const o = [], s = [], i = [];
|
|
503
|
+
for (const a of t) {
|
|
504
|
+
if (!this._query.belongsTo(a)) {
|
|
505
|
+
o.push(a.url);
|
|
503
506
|
continue;
|
|
504
507
|
}
|
|
505
|
-
const l = gt(this._channels,
|
|
508
|
+
const l = gt(this._channels, a), c = l < 0;
|
|
506
509
|
!c && this._channels.splice(l, 1);
|
|
507
|
-
const
|
|
508
|
-
c ?
|
|
510
|
+
const h = co(this._channels, a, this._order).place, m = h === this._channels.length;
|
|
511
|
+
c ? m ? (n || !this.hasMore) && (this._channels.push(a), s.push(a)) : (this._channels.splice(h, 0, a), s.push(a)) : (this._channels.splice(h, 0, a), i.push(a));
|
|
509
512
|
}
|
|
510
|
-
return { addedChannels: s, updatedChannels:
|
|
513
|
+
return { addedChannels: s, updatedChannels: i, unmatchedChannelUrls: o };
|
|
511
514
|
}
|
|
512
515
|
/**
|
|
513
516
|
* Adds or updates channels in the collection, separating pinned and non-pinned channels.
|
|
@@ -515,19 +518,19 @@ class lo {
|
|
|
515
518
|
* @param forceAppend - Whether to force append channels at the end
|
|
516
519
|
*/
|
|
517
520
|
_addChannelsToView(t, n = !1) {
|
|
518
|
-
var
|
|
519
|
-
const o = new Set(((
|
|
520
|
-
for (const
|
|
521
|
-
o.has(
|
|
522
|
-
const
|
|
523
|
-
c.length > 0 && ((x = (f = this._collectionEventHandler) == null ? void 0 : f.onChannelsAdded) == null || x.call(f, {}, c)), d.length > 0 && ((
|
|
521
|
+
var m, f, x, E, b;
|
|
522
|
+
const o = new Set(((m = this.filter) == null ? void 0 : m.pinnedChannelUrls) ?? []), s = [], i = [];
|
|
523
|
+
for (const g of t)
|
|
524
|
+
o.has(g.url) ? s.push(g) : i.push(g);
|
|
525
|
+
const a = this._upsertPinnedChannelsToArray(s), l = this._upsertRegularChannelsToArray(i, n), c = a.addedChannels.concat(l.addedChannels), d = a.updatedChannels.concat(l.updatedChannels), h = a.unmatchedChannelUrls.concat(l.unmatchedChannelUrls);
|
|
526
|
+
c.length > 0 && ((x = (f = this._collectionEventHandler) == null ? void 0 : f.onChannelsAdded) == null || x.call(f, {}, c)), d.length > 0 && ((b = (E = this._collectionEventHandler) == null ? void 0 : E.onChannelsUpdated) == null || b.call(E, {}, d)), h.length > 0 && this._removeChannelsFromView(h);
|
|
524
527
|
}
|
|
525
528
|
/**
|
|
526
529
|
* Removes channels from the collection by their URLs.
|
|
527
530
|
* @param channelUrls - Array of channel URLs to remove
|
|
528
531
|
*/
|
|
529
532
|
_removeChannelsFromView(t) {
|
|
530
|
-
var s,
|
|
533
|
+
var s, i, a;
|
|
531
534
|
const n = new Set(((s = this.filter) == null ? void 0 : s.pinnedChannelUrls) ?? []), o = [];
|
|
532
535
|
for (const l of t)
|
|
533
536
|
if (n.has(l)) {
|
|
@@ -537,7 +540,7 @@ class lo {
|
|
|
537
540
|
const c = this._channels.findIndex((d) => d.url === l);
|
|
538
541
|
c >= 0 && (o.push(l), this._channels.splice(c, 1));
|
|
539
542
|
}
|
|
540
|
-
o.length > 0 && ((
|
|
543
|
+
o.length > 0 && ((a = (i = this._collectionEventHandler) == null ? void 0 : i.onChannelsDeleted) == null || a.call(i, {}, o));
|
|
541
544
|
}
|
|
542
545
|
/**
|
|
543
546
|
* Gets all channels in the collection.
|
|
@@ -584,17 +587,17 @@ class lo {
|
|
|
584
587
|
const gt = (e, t) => e.findIndex((n) => n.isIdentical(t)), co = (e, t, n) => {
|
|
585
588
|
if (e.length > 0) {
|
|
586
589
|
const o = gt(e, t);
|
|
587
|
-
let s = 0,
|
|
588
|
-
for (; s <
|
|
589
|
-
const c = jt(e[
|
|
590
|
+
let s = 0, i = e.length - 1, a = Math.floor((s + i) / 2);
|
|
591
|
+
for (; s < i; ) {
|
|
592
|
+
const c = jt(e[a], t, n);
|
|
590
593
|
if (c > 0)
|
|
591
|
-
|
|
594
|
+
i = a, a = Math.floor((s + i) / 2);
|
|
592
595
|
else if (c < 0)
|
|
593
|
-
s =
|
|
596
|
+
s = a + 1, a = Math.floor((s + i) / 2);
|
|
594
597
|
else
|
|
595
|
-
return { place:
|
|
598
|
+
return { place: a, oldPosition: o };
|
|
596
599
|
}
|
|
597
|
-
return { place: jt(e[
|
|
600
|
+
return { place: jt(e[a], t, n) >= 0 ? a : a + 1, oldPosition: o };
|
|
598
601
|
}
|
|
599
602
|
return { place: e.length, oldPosition: -1 };
|
|
600
603
|
}, jt = (e, t, n) => {
|
|
@@ -609,10 +612,10 @@ const gt = (e, t) => e.findIndex((n) => n.isIdentical(t)), co = (e, t, n) => {
|
|
|
609
612
|
}
|
|
610
613
|
};
|
|
611
614
|
function uo(e, t) {
|
|
612
|
-
var
|
|
613
|
-
const n = bn(), [o, s] = _(!1), [
|
|
614
|
-
if (!
|
|
615
|
-
|
|
615
|
+
var E, b, g, C, v, S, k, F;
|
|
616
|
+
const n = bn(), [o, s] = _(!1), [i, a] = _(null), [l, c] = _([]), [d, h] = _(null), m = N(!1), f = R(async () => {
|
|
617
|
+
if (!m.current && e.currentUser) {
|
|
618
|
+
m.current = !0, s(!1), a(null), c([]);
|
|
616
619
|
try {
|
|
617
620
|
d == null || d.dispose();
|
|
618
621
|
const $ = new lo(e, t);
|
|
@@ -626,17 +629,17 @@ function uo(e, t) {
|
|
|
626
629
|
onChannelsDeleted: () => {
|
|
627
630
|
c($.channels);
|
|
628
631
|
}
|
|
629
|
-
}), await $.loadMore(),
|
|
632
|
+
}), await $.loadMore(), h($), a(null);
|
|
630
633
|
} catch ($) {
|
|
631
|
-
|
|
634
|
+
h(null), a($);
|
|
632
635
|
} finally {
|
|
633
|
-
s(!0),
|
|
636
|
+
s(!0), m.current = !1;
|
|
634
637
|
}
|
|
635
638
|
}
|
|
636
639
|
}, [
|
|
637
640
|
e,
|
|
638
|
-
(
|
|
639
|
-
(
|
|
641
|
+
(E = t.filter) == null ? void 0 : E.aiAgentChannelFilter,
|
|
642
|
+
(g = (b = t.filter) == null ? void 0 : b.aiAgentConversationStatusFilter) == null ? void 0 : g.join(),
|
|
640
643
|
(v = (C = t.filter) == null ? void 0 : C.aiAgentIds) == null ? void 0 : v.join(),
|
|
641
644
|
(S = t.filter) == null ? void 0 : S.deskChannelFilter,
|
|
642
645
|
(F = (k = t.filter) == null ? void 0 : k.pinnedChannelUrls) == null ? void 0 : F.join(),
|
|
@@ -646,16 +649,16 @@ function uo(e, t) {
|
|
|
646
649
|
try {
|
|
647
650
|
await d.loadMore();
|
|
648
651
|
} catch ($) {
|
|
649
|
-
|
|
652
|
+
a($);
|
|
650
653
|
}
|
|
651
654
|
}, [d]);
|
|
652
655
|
return L(() => (e.addConnectionHandler(n, new Je({ onConnected: () => f() })), () => e.removeConnectionHandler(n)), [e, n, f]), L(() => {
|
|
653
656
|
f();
|
|
654
657
|
}, [f]), L(() => () => {
|
|
655
|
-
|
|
658
|
+
m.current = !1, d == null || d.dispose();
|
|
656
659
|
}, [d]), {
|
|
657
660
|
initialized: o,
|
|
658
|
-
error:
|
|
661
|
+
error: i,
|
|
659
662
|
channels: l,
|
|
660
663
|
loadMore: x
|
|
661
664
|
};
|
|
@@ -663,22 +666,25 @@ function uo(e, t) {
|
|
|
663
666
|
const {
|
|
664
667
|
Provider: mo
|
|
665
668
|
} = G("AIAgentConversationList");
|
|
666
|
-
function go({
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
669
|
+
function go({
|
|
670
|
+
conversationListLimit: e,
|
|
671
|
+
conversationListFilter: t,
|
|
672
|
+
children: n
|
|
673
|
+
}) {
|
|
674
|
+
var m, f;
|
|
675
|
+
const { chatSDK: o, aiAgentId: s, queryParams: i } = ue(), a = { aiAgentIds: [s], aiAgentConversationStatusFilter: [W.CLOSED] }, l = e ?? ((m = i == null ? void 0 : i.conversationListParams) == null ? void 0 : m.limit), c = {
|
|
676
|
+
...a,
|
|
677
|
+
...(f = i == null ? void 0 : i.conversationListParams) == null ? void 0 : f.filter,
|
|
678
|
+
...t
|
|
679
|
+
}, d = uo(o, { limit: l, filter: c }), h = {
|
|
674
680
|
listSource: {
|
|
675
|
-
initialized:
|
|
676
|
-
error:
|
|
677
|
-
channels:
|
|
678
|
-
loadMore: () =>
|
|
681
|
+
initialized: d.initialized,
|
|
682
|
+
error: d.error ?? void 0,
|
|
683
|
+
channels: d.channels,
|
|
684
|
+
loadMore: () => d.loadMore()
|
|
679
685
|
}
|
|
680
686
|
};
|
|
681
|
-
return /* @__PURE__ */ r.createElement(mo, { value:
|
|
687
|
+
return /* @__PURE__ */ r.createElement(mo, { value: h }, n);
|
|
682
688
|
}
|
|
683
689
|
const ht = {
|
|
684
690
|
DEFAULT_BOT_MSG_BG: "#eeeeee",
|
|
@@ -704,26 +710,26 @@ function po(e) {
|
|
|
704
710
|
}
|
|
705
711
|
function fo(e, t, n) {
|
|
706
712
|
e /= 255, t /= 255, n /= 255;
|
|
707
|
-
const o = Math.max(e, t, n), s = Math.min(e, t, n),
|
|
708
|
-
let
|
|
713
|
+
const o = Math.max(e, t, n), s = Math.min(e, t, n), i = o - s;
|
|
714
|
+
let a = 0, l = 0;
|
|
709
715
|
const c = (o + s) / 2;
|
|
710
|
-
return o !== s && (l = c > 0.5 ?
|
|
716
|
+
return o !== s && (l = c > 0.5 ? i / (2 - o - s) : i / (o + s)), o === e ? a = (t - n) / i + (t < n ? 6 : 0) : o === t ? a = (n - e) / i + 2 : o === n && (a = (e - t) / i + 4), a /= 6, [a, l, c];
|
|
711
717
|
}
|
|
712
718
|
function bo(e, t, n) {
|
|
713
|
-
let o, s,
|
|
719
|
+
let o, s, i;
|
|
714
720
|
if (t === 0)
|
|
715
|
-
o = s =
|
|
721
|
+
o = s = i = n;
|
|
716
722
|
else {
|
|
717
|
-
const
|
|
718
|
-
return f < 0 && (f += 1), f > 1 && (f -= 1), f < 0.16666666666666666 ?
|
|
723
|
+
const a = function(h, m, f) {
|
|
724
|
+
return f < 0 && (f += 1), f > 1 && (f -= 1), f < 0.16666666666666666 ? h + (m - h) * 6 * f : f < 0.5 ? m : f < 0.6666666666666666 ? h + (m - h) * (0.6666666666666666 - f) * 6 : h;
|
|
719
725
|
}, l = n < 0.5 ? n * (1 + t) : n + t - n * t, c = 2 * n - l;
|
|
720
|
-
o =
|
|
726
|
+
o = a(c, l, e + 1 / 3), s = a(c, l, e), i = a(c, l, e - 1 / 3);
|
|
721
727
|
}
|
|
722
|
-
return [Math.round(o * 255), Math.round(s * 255), Math.round(
|
|
728
|
+
return [Math.round(o * 255), Math.round(s * 255), Math.round(i * 255)];
|
|
723
729
|
}
|
|
724
730
|
function Be(e, t, n) {
|
|
725
|
-
const [o, s,
|
|
726
|
-
return po([Math.round(
|
|
731
|
+
const [o, s, i] = ho(e), [a, l, c] = fo(o, s, i), d = Math.max(0, Math.min(1, c * t)), h = Math.max(0, Math.min(1, l * n)), [m, f, x] = bo(a, h, d);
|
|
732
|
+
return po([Math.round(m), Math.round(f), Math.round(x)]);
|
|
727
733
|
}
|
|
728
734
|
function Eo(e, t = "light") {
|
|
729
735
|
return {
|
|
@@ -735,8 +741,8 @@ function Eo(e, t = "light") {
|
|
|
735
741
|
};
|
|
736
742
|
}
|
|
737
743
|
function pt(e) {
|
|
738
|
-
const t = wn(e), n = 149, o = +`0x${t[1]}${t[2]}`, s = +`0x${t[3]}${t[4]}`,
|
|
739
|
-
return o * 0.299 + s * 0.587 +
|
|
744
|
+
const t = wn(e), n = 149, o = +`0x${t[1]}${t[2]}`, s = +`0x${t[3]}${t[4]}`, i = +`0x${t[5]}${t[6]}`;
|
|
745
|
+
return o * 0.299 + s * 0.587 + i * 0.114 > n ? ht.BLACK : ht.WHITE;
|
|
740
746
|
}
|
|
741
747
|
function xo(e, t, n, o, s) {
|
|
742
748
|
return {
|
|
@@ -879,19 +885,19 @@ function vo({ selectedTheme: e, palette: t, primary: n }) {
|
|
|
879
885
|
};
|
|
880
886
|
}
|
|
881
887
|
function yo({ selectedTheme: e, primaryContrast: t, botMessageBackground: n, botMessageBackgroundContrast: o }, s) {
|
|
882
|
-
const
|
|
888
|
+
const i = s.primary.main, a = t ?? pt(i), l = n ?? ht.DEFAULT_BOT_MSG_BG, c = o ?? pt(l);
|
|
883
889
|
return {
|
|
884
890
|
colors: (e === "light" ? xo : Co)(
|
|
885
891
|
s,
|
|
886
|
-
a,
|
|
887
892
|
i,
|
|
893
|
+
a,
|
|
888
894
|
l,
|
|
889
895
|
c
|
|
890
896
|
),
|
|
891
897
|
aiAgentColorVariables: {
|
|
892
|
-
primary_color:
|
|
898
|
+
primary_color: i,
|
|
893
899
|
bot_message_bg_color: l,
|
|
894
|
-
primary_contrast_color:
|
|
900
|
+
primary_contrast_color: a,
|
|
895
901
|
bot_message_bg_contrast_color: c
|
|
896
902
|
}
|
|
897
903
|
};
|
|
@@ -899,8 +905,8 @@ function yo({ selectedTheme: e, primaryContrast: t, botMessageBackground: n, bot
|
|
|
899
905
|
function _o(e, t, n) {
|
|
900
906
|
const o = { ...e };
|
|
901
907
|
return n.forEach((s) => {
|
|
902
|
-
const
|
|
903
|
-
|
|
908
|
+
const i = t[s];
|
|
909
|
+
i != null && (o[s] = i);
|
|
904
910
|
}), o;
|
|
905
911
|
}
|
|
906
912
|
function So({ typography: e }) {
|
|
@@ -910,8 +916,8 @@ function So({ typography: e }) {
|
|
|
910
916
|
return Object.keys(e).forEach((n) => {
|
|
911
917
|
const o = e[n];
|
|
912
918
|
if (o && typeof o == "object") {
|
|
913
|
-
const s = it[n],
|
|
914
|
-
t[n] = _o(s, o,
|
|
919
|
+
const s = it[n], i = ["fontSize", "fontWeight", "fontFamily", "lineHeight"];
|
|
920
|
+
t[n] = _o(s, o, i);
|
|
915
921
|
}
|
|
916
922
|
}), t;
|
|
917
923
|
}
|
|
@@ -920,7 +926,7 @@ const {
|
|
|
920
926
|
useContext: Ct
|
|
921
927
|
} = G("AIAgentTheme");
|
|
922
928
|
function wo({ logger: e, palette: t, typography: n, appearance: o, children: s }) {
|
|
923
|
-
const [
|
|
929
|
+
const [i, a] = _(
|
|
924
930
|
() => Kt({
|
|
925
931
|
selectedTheme: (o == null ? void 0 : o.theme) ?? "light",
|
|
926
932
|
palette: t,
|
|
@@ -930,29 +936,29 @@ function wo({ logger: e, palette: t, typography: n, appearance: o, children: s }
|
|
|
930
936
|
})
|
|
931
937
|
), l = R(
|
|
932
938
|
(c, d) => {
|
|
933
|
-
const
|
|
939
|
+
const h = (o == null ? void 0 : o.theme) ?? c, m = d == null ? void 0 : d(h), f = {
|
|
934
940
|
primary: o == null ? void 0 : o.primaryColor,
|
|
935
941
|
primaryContrast: void 0,
|
|
936
942
|
botMessageBackground: o == null ? void 0 : o.botMessageBackgroundColor,
|
|
937
943
|
botMessageBackgroundContrast: void 0
|
|
938
944
|
};
|
|
939
|
-
!f.primary && (
|
|
940
|
-
const x = Kt({ selectedTheme:
|
|
941
|
-
|
|
945
|
+
!f.primary && (m != null && m.primaryColor) && (f.primary = m.primaryColor, f.primaryContrast = m.primaryContrastColor), !f.botMessageBackground && (m != null && m.botMessageBackgroundColor) && (f.botMessageBackground = m.botMessageBackgroundColor, f.botMessageBackgroundContrast = m.botMessageBackgroundContrastColor);
|
|
946
|
+
const x = Kt({ selectedTheme: h, palette: t, typography: n, ...f });
|
|
947
|
+
a(x), e == null || e.info("theme.update:", h);
|
|
942
948
|
},
|
|
943
949
|
[o == null ? void 0 : o.theme, o == null ? void 0 : o.primaryColor, o == null ? void 0 : o.botMessageBackgroundColor, t, n, e]
|
|
944
950
|
);
|
|
945
951
|
return L(() => {
|
|
946
|
-
(o != null && o.theme || o != null && o.primaryColor || o != null && o.botMessageBackgroundColor) && l(
|
|
947
|
-
}, [o == null ? void 0 : o.theme, o == null ? void 0 : o.primaryColor, o == null ? void 0 : o.botMessageBackgroundColor]), /* @__PURE__ */ r.createElement(To, { value: { theme:
|
|
952
|
+
(o != null && o.theme || o != null && o.primaryColor || o != null && o.botMessageBackgroundColor) && l(i.selectedTheme);
|
|
953
|
+
}, [o == null ? void 0 : o.theme, o == null ? void 0 : o.primaryColor, o == null ? void 0 : o.botMessageBackgroundColor]), /* @__PURE__ */ r.createElement(To, { value: { theme: i, updateTheme: l } }, s);
|
|
948
954
|
}
|
|
949
955
|
function Ao() {
|
|
950
956
|
const { chatSDK: e, logger: t } = ue(), n = R(
|
|
951
|
-
async (s,
|
|
952
|
-
if (t.debug("useChatConnection.connect: start, session", s.userId),
|
|
957
|
+
async (s, i, a) => {
|
|
958
|
+
if (t.debug("useChatConnection.connect: start, session", s.userId), i) {
|
|
953
959
|
const l = new wr({
|
|
954
|
-
...
|
|
955
|
-
onSessionTokenRequired: ko(
|
|
960
|
+
...i,
|
|
961
|
+
onSessionTokenRequired: ko(i.onSessionTokenRequired, a)
|
|
956
962
|
});
|
|
957
963
|
e.setSessionHandler(l);
|
|
958
964
|
}
|
|
@@ -967,7 +973,7 @@ function Ao() {
|
|
|
967
973
|
function ko(e, t) {
|
|
968
974
|
if (e)
|
|
969
975
|
return async (n, o) => {
|
|
970
|
-
new Promise((s,
|
|
976
|
+
new Promise((s, i) => e == null ? void 0 : e(s, i)).then((s) => {
|
|
971
977
|
s && (t == null || t(s)), n(s);
|
|
972
978
|
}).catch((s) => {
|
|
973
979
|
o(s);
|
|
@@ -983,14 +989,14 @@ class Zt {
|
|
|
983
989
|
}
|
|
984
990
|
const $o = 24 * 60 * 60 * 1e3, Mo = (e) => {
|
|
985
991
|
const { logger: t, cache: n } = ue(), o = () => {
|
|
986
|
-
const
|
|
987
|
-
return
|
|
992
|
+
const i = n.messenger.getAnonUser();
|
|
993
|
+
return i ? i.expireAt - $o <= Date.now() ? (t.debug("useUserSessionCandidate.getAnonymousSessionInfo: auto session expired, clear cache"), n.messenger.clear(i.userId), null) : (t.debug("useUserSessionCandidate.getAnonymousSessionInfo: auto session info detected"), i) : null;
|
|
988
994
|
}, s = () => {
|
|
989
995
|
if (!e || e instanceof Zt)
|
|
990
996
|
throw new Error("userSessionInfo must be an instance of ManualSessionInfo");
|
|
991
|
-
const
|
|
992
|
-
return
|
|
993
|
-
`useUserSessionCandidate.getManualSessionInfo: missing required keys in userSessionInfo: ${
|
|
997
|
+
const i = ["authToken", "sessionHandler"].filter((a) => !(a in e));
|
|
998
|
+
return i.length > 0 && t.error(
|
|
999
|
+
`useUserSessionCandidate.getManualSessionInfo: missing required keys in userSessionInfo: ${i.join(", ")}`
|
|
994
1000
|
), t.debug("useUserSessionCandidate.getManualSessionInfo: manual session info detected"), e;
|
|
995
1001
|
};
|
|
996
1002
|
return ae(() => e instanceof Io ? s() : e instanceof Zt ? o() : e && typeof e == "object" ? (t.warn("Please use ManualSessionInfo instead of the old userSessionInfo format."), s()) : e === void 0 ? (t.warn("Please use AnonymousSessionInfo instead of undefined userSessionInfo."), o()) : null, [
|
|
@@ -1008,46 +1014,46 @@ function Oo({
|
|
|
1008
1014
|
onPostAuth: n,
|
|
1009
1015
|
onErrorAuth: o,
|
|
1010
1016
|
onAuthTokenRefreshed: s,
|
|
1011
|
-
onPostDeauth:
|
|
1012
|
-
forceCreateChannel:
|
|
1017
|
+
onPostDeauth: i,
|
|
1018
|
+
forceCreateChannel: a
|
|
1013
1019
|
}) {
|
|
1014
|
-
const { aiAgentId: l, chatSDK: c, language: d, context:
|
|
1020
|
+
const { aiAgentId: l, chatSDK: c, language: d, context: h, countryCode: m, logger: f, cache: x } = ue(), { connect: E, disconnect: b } = Ao(), g = Mo(e), C = R(async () => {
|
|
1015
1021
|
var $;
|
|
1016
1022
|
f.debug("useAuthentication.authenticate: start");
|
|
1017
|
-
const S = (
|
|
1023
|
+
const S = (g == null ? void 0 : g.userId) && (($ = x.messenger.getSettings(g.userId)) == null ? void 0 : $.knownActiveChannelUrl), k = await c.aiAgent.requestMessengerSettings({
|
|
1018
1024
|
aiAgentId: l,
|
|
1019
|
-
userId:
|
|
1025
|
+
userId: g == null ? void 0 : g.userId,
|
|
1020
1026
|
language: d,
|
|
1021
|
-
country:
|
|
1022
|
-
context:
|
|
1023
|
-
forceCreateChannel:
|
|
1027
|
+
country: m,
|
|
1028
|
+
context: h,
|
|
1029
|
+
forceCreateChannel: a,
|
|
1024
1030
|
knownActiveChannelUrl: S
|
|
1025
1031
|
});
|
|
1026
1032
|
f.debug("useAuthentication.authenticate: messenger settings response", k);
|
|
1027
1033
|
let F = null;
|
|
1028
1034
|
if (k.auto_created_user) {
|
|
1029
|
-
const { user_id: V, session_token:
|
|
1030
|
-
x.messenger.setAnonUser({ userId: V, authToken:
|
|
1035
|
+
const { user_id: V, session_token: re, expire_at: y } = k.auto_created_user;
|
|
1036
|
+
x.messenger.setAnonUser({ userId: V, authToken: re, expireAt: y }), F = { userId: V, authToken: re };
|
|
1031
1037
|
} else
|
|
1032
1038
|
F = {
|
|
1033
|
-
userId: (
|
|
1034
|
-
authToken: (
|
|
1039
|
+
userId: (g == null ? void 0 : g.userId) ?? "",
|
|
1040
|
+
authToken: (g == null ? void 0 : g.authToken) ?? ""
|
|
1035
1041
|
};
|
|
1036
1042
|
x.messenger.setSettings(F.userId, {
|
|
1037
1043
|
knownActiveChannelUrl: k.active_channel.channel_url
|
|
1038
1044
|
});
|
|
1039
1045
|
try {
|
|
1040
|
-
await t(k, F), await
|
|
1046
|
+
await t(k, F), await E(F, g == null ? void 0 : g.sessionHandler, s), await n(k, F);
|
|
1041
1047
|
} catch (V) {
|
|
1042
1048
|
V instanceof Error && (o(V), f.error("useAuthentication.authenticate: failed to connect", V));
|
|
1043
1049
|
}
|
|
1044
1050
|
return k;
|
|
1045
1051
|
}, [
|
|
1046
1052
|
c,
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1053
|
+
E,
|
|
1054
|
+
g == null ? void 0 : g.userId,
|
|
1055
|
+
g == null ? void 0 : g.sessionHandler,
|
|
1056
|
+
g == null ? void 0 : g.authToken,
|
|
1051
1057
|
x.messenger.setAnonUser,
|
|
1052
1058
|
x.messenger.getSettings,
|
|
1053
1059
|
x.messenger.setSettings,
|
|
@@ -1056,12 +1062,12 @@ function Oo({
|
|
|
1056
1062
|
o,
|
|
1057
1063
|
s
|
|
1058
1064
|
]), v = R(async () => {
|
|
1059
|
-
f.debug("useAuthentication.deauthenticate: start"), await
|
|
1060
|
-
}, [
|
|
1065
|
+
f.debug("useAuthentication.deauthenticate: start"), await b(), i(), f.debug("useAuthentication.deauthenticate: completed");
|
|
1066
|
+
}, [b, f, i]);
|
|
1061
1067
|
return {
|
|
1062
1068
|
authenticate: C,
|
|
1063
1069
|
deauthenticate: v,
|
|
1064
|
-
userSessionCandidate:
|
|
1070
|
+
userSessionCandidate: g
|
|
1065
1071
|
};
|
|
1066
1072
|
}
|
|
1067
1073
|
const An = (e) => {
|
|
@@ -1079,9 +1085,9 @@ function Lo(e, t) {
|
|
|
1079
1085
|
function Ro(e) {
|
|
1080
1086
|
const t = {};
|
|
1081
1087
|
function n(o, s = "") {
|
|
1082
|
-
for (const [
|
|
1083
|
-
const l = s ? `${s}.${
|
|
1084
|
-
|
|
1088
|
+
for (const [i, a] of Object.entries(o)) {
|
|
1089
|
+
const l = s ? `${s}.${i}` : i;
|
|
1090
|
+
a && typeof a == "object" && !Array.isArray(a) ? n(a, l) : t[l] = a;
|
|
1085
1091
|
}
|
|
1086
1092
|
}
|
|
1087
1093
|
return n(e), t;
|
|
@@ -1092,10 +1098,10 @@ function vt({
|
|
|
1092
1098
|
variableKeyPattern: n,
|
|
1093
1099
|
variableValueTransformer: o
|
|
1094
1100
|
}) {
|
|
1095
|
-
return Object.entries(t).reduce((s, [
|
|
1096
|
-
if (!o && !["number", "boolean", "string"].includes(typeof
|
|
1097
|
-
throw new Error(`If transformer is not provided, value(${
|
|
1098
|
-
const l = o ? o(
|
|
1101
|
+
return Object.entries(t).reduce((s, [i, a]) => {
|
|
1102
|
+
if (!o && !["number", "boolean", "string"].includes(typeof a))
|
|
1103
|
+
throw new Error(`If transformer is not provided, value(${i}:${a}) must be a {string, number, or boolean}`);
|
|
1104
|
+
const l = o ? o(a) : String(a), c = n(i);
|
|
1099
1105
|
return s.replace(c, An(l));
|
|
1100
1106
|
}, e);
|
|
1101
1107
|
}
|
|
@@ -1106,29 +1112,29 @@ async function Do({
|
|
|
1106
1112
|
variableValueTransformer: o
|
|
1107
1113
|
}) {
|
|
1108
1114
|
return (await Promise.all(
|
|
1109
|
-
Object.entries(t).map(async ([
|
|
1110
|
-
const l = await o(
|
|
1111
|
-
return { regex: n(
|
|
1115
|
+
Object.entries(t).map(async ([i, a]) => {
|
|
1116
|
+
const l = await o(a);
|
|
1117
|
+
return { regex: n(i), transformedValue: l };
|
|
1112
1118
|
})
|
|
1113
|
-
)).reduce((
|
|
1119
|
+
)).reduce((i, { regex: a, transformedValue: l }) => i.replace(a, An(l)), e);
|
|
1114
1120
|
}
|
|
1115
1121
|
const No = () => {
|
|
1116
1122
|
const { chatSDK: e, logger: t, cache: n } = ue(), o = R(() => {
|
|
1117
1123
|
var l, c;
|
|
1118
|
-
const
|
|
1119
|
-
if (!
|
|
1120
|
-
const
|
|
1121
|
-
return
|
|
1124
|
+
const i = (c = (l = e.appInfo) == null ? void 0 : l.aiAgentInfo) == null ? void 0 : c.templateListToken;
|
|
1125
|
+
if (!i) return !1;
|
|
1126
|
+
const a = n.template.getCachedToken();
|
|
1127
|
+
return a ? i !== a : !0;
|
|
1122
1128
|
}, [e, n.template.getCachedToken]), s = R(async () => {
|
|
1123
1129
|
try {
|
|
1124
|
-
const { templates:
|
|
1125
|
-
for (const { template: l } of
|
|
1130
|
+
const { templates: i, token: a } = await e.aiAgent.getMessageTemplates({ limit: 20 });
|
|
1131
|
+
for (const { template: l } of i) {
|
|
1126
1132
|
const { key: c } = $e(l);
|
|
1127
1133
|
n.template.set(c, l);
|
|
1128
1134
|
}
|
|
1129
|
-
n.template.setCachedToken(
|
|
1130
|
-
} catch (
|
|
1131
|
-
t == null || t.error("messageTemplateContext.syncCachedTemplates: error:",
|
|
1135
|
+
n.template.setCachedToken(a);
|
|
1136
|
+
} catch (i) {
|
|
1137
|
+
t == null || t.error("messageTemplateContext.syncCachedTemplates: error:", i);
|
|
1132
1138
|
}
|
|
1133
1139
|
}, [e, t, n.template.set, n.template.setCachedToken]);
|
|
1134
1140
|
return {
|
|
@@ -1146,12 +1152,12 @@ const Po = {
|
|
|
1146
1152
|
Provider: Bo
|
|
1147
1153
|
} = G("AIAgentMessengerSession"), Fo = ye(
|
|
1148
1154
|
function({ userSessionInfo: e, forceCreateChannel: t, children: n }, o) {
|
|
1149
|
-
const { appId: s, aiAgentId:
|
|
1155
|
+
const { appId: s, aiAgentId: i, chatSDK: a, language: l, countryCode: c, context: d, cache: h, logger: m } = ue(), { updateTheme: f } = Ct(), [x, E] = _(void 0), [b, g] = _(
|
|
1150
1156
|
void 0
|
|
1151
|
-
), [C, v] = _(null), [S, k] = _(null), [F, $] = _(null), [V,
|
|
1157
|
+
), [C, v] = _(null), [S, k] = _(null), [F, $] = _(null), [V, re] = _(
|
|
1152
1158
|
"handed_off_only"
|
|
1153
1159
|
/* HANDED_OFF_ONLY */
|
|
1154
|
-
), { shouldSyncCachedTemplate: y, syncCachedTemplates: H } = No(), { authenticate:
|
|
1160
|
+
), { shouldSyncCachedTemplate: y, syncCachedTemplates: H } = No(), { authenticate: oe, deauthenticate: Y } = Oo({
|
|
1155
1161
|
userSessionInfo: e,
|
|
1156
1162
|
forceCreateChannel: t,
|
|
1157
1163
|
onPreAuth: R((A, D) => {
|
|
@@ -1164,7 +1170,7 @@ const Po = {
|
|
|
1164
1170
|
primaryContrastColor: be.primary_contrast_color,
|
|
1165
1171
|
botMessageBackgroundContrastColor: be.bot_message_bg_contrast_color
|
|
1166
1172
|
};
|
|
1167
|
-
}),
|
|
1173
|
+
}), E(void 0), v(D), k({
|
|
1168
1174
|
userId: A.bot.bot_userid,
|
|
1169
1175
|
profileUrl: A.bot.bot_profile_url,
|
|
1170
1176
|
nickname: A.bot.bot_nickname,
|
|
@@ -1175,113 +1181,113 @@ const Po = {
|
|
|
1175
1181
|
}), $({
|
|
1176
1182
|
type: A.launcher.image_type || "default_icon",
|
|
1177
1183
|
imageUrl: A.launcher.image_url
|
|
1178
|
-
}),
|
|
1184
|
+
}), re(
|
|
1179
1185
|
Po[A.active_channel.attachment_mode] ?? "handed_off_only"
|
|
1180
1186
|
/* HANDED_OFF_ONLY */
|
|
1181
1187
|
);
|
|
1182
1188
|
}, []),
|
|
1183
1189
|
onPostAuth: R(
|
|
1184
1190
|
async (A) => {
|
|
1185
|
-
y() && await H(),
|
|
1191
|
+
y() && await H(), g({ url: A.active_channel.channel_url, status: W.OPEN });
|
|
1186
1192
|
},
|
|
1187
1193
|
[y, H]
|
|
1188
1194
|
),
|
|
1189
1195
|
onErrorAuth: R((A) => {
|
|
1190
|
-
|
|
1196
|
+
E(A);
|
|
1191
1197
|
}, []),
|
|
1192
1198
|
onAuthTokenRefreshed: R((A) => {
|
|
1193
1199
|
v((D) => D ? { ...D, authToken: A } : null);
|
|
1194
1200
|
}, []),
|
|
1195
1201
|
onPostDeauth: R(() => {
|
|
1196
|
-
|
|
1197
|
-
}, [
|
|
1202
|
+
h.template.clear(), C != null && C.userId && h.messenger.clear(C.userId), g(void 0), v(null), k(null), $(null);
|
|
1203
|
+
}, [h.template.clear, C])
|
|
1198
1204
|
}), nt = R(async () => {
|
|
1199
1205
|
var A;
|
|
1200
1206
|
if (C) {
|
|
1201
|
-
|
|
1202
|
-
const D = await
|
|
1203
|
-
aiAgentId:
|
|
1207
|
+
m.debug("agentMessengerSession.refreshActiveChannel: try to refresh active channel"), g(void 0);
|
|
1208
|
+
const D = await a.aiAgent.requestMessengerSettings({
|
|
1209
|
+
aiAgentId: i,
|
|
1204
1210
|
userId: C.userId,
|
|
1205
1211
|
language: l,
|
|
1206
1212
|
country: c,
|
|
1207
1213
|
context: d,
|
|
1208
1214
|
forceCreateChannel: t,
|
|
1209
|
-
knownActiveChannelUrl: (A =
|
|
1215
|
+
knownActiveChannelUrl: (A = h.messenger.getSettings(C.userId)) == null ? void 0 : A.knownActiveChannelUrl
|
|
1210
1216
|
});
|
|
1211
|
-
return
|
|
1217
|
+
return h.messenger.setSettings(C.userId, {
|
|
1212
1218
|
knownActiveChannelUrl: D.active_channel.channel_url
|
|
1213
|
-
}),
|
|
1219
|
+
}), g({ url: D.active_channel.channel_url, status: W.OPEN }), m.info(
|
|
1214
1220
|
"agentMessengerSession.refreshActiveChannel: refreshed active channel",
|
|
1215
1221
|
D.active_channel.channel_url
|
|
1216
1222
|
), D.active_channel.channel_url;
|
|
1217
1223
|
} else
|
|
1218
|
-
throw
|
|
1224
|
+
throw m.error("agentMessengerSession.refreshActiveChannel: userSession is not ready"), new Error("userSession is not ready");
|
|
1219
1225
|
}, [
|
|
1220
|
-
i,
|
|
1221
|
-
s,
|
|
1222
1226
|
a,
|
|
1227
|
+
s,
|
|
1228
|
+
i,
|
|
1223
1229
|
C == null ? void 0 : C.userId,
|
|
1224
1230
|
l,
|
|
1225
1231
|
c,
|
|
1226
1232
|
d,
|
|
1227
1233
|
t,
|
|
1228
|
-
|
|
1229
|
-
|
|
1234
|
+
h.messenger.getSettings,
|
|
1235
|
+
h.messenger.setSettings
|
|
1230
1236
|
]), rt = R(
|
|
1231
1237
|
async (A) => {
|
|
1232
1238
|
if (!(C != null && C.userId))
|
|
1233
1239
|
throw new Error("Current user is not authenticated. Please authenticate first.");
|
|
1234
|
-
const K = (await
|
|
1240
|
+
const K = (await a.aiAgent.requestMessengerSettings({
|
|
1235
1241
|
...A,
|
|
1236
1242
|
userId: C.userId,
|
|
1237
1243
|
knownActiveChannelUrl: void 0
|
|
1238
1244
|
})).active_channel.channel_url;
|
|
1239
|
-
return
|
|
1245
|
+
return h.messenger.setSettings(C.userId, { knownActiveChannelUrl: K }), K;
|
|
1240
1246
|
},
|
|
1241
1247
|
[C == null ? void 0 : C.userId]
|
|
1242
1248
|
);
|
|
1243
|
-
return Xe(
|
|
1249
|
+
return Xe(a, {
|
|
1244
1250
|
onChannelChanged: (A) => {
|
|
1245
1251
|
var D;
|
|
1246
|
-
A.isGroupChannel() && A.url === (
|
|
1252
|
+
A.isGroupChannel() && A.url === (b == null ? void 0 : b.url) && (m.info("agentMessengerSession.channelChanged: channel.conversation", A.conversation), g({ url: A.url, status: ((D = A.conversation) == null ? void 0 : D.status) ?? W.OPEN }));
|
|
1247
1253
|
}
|
|
1248
1254
|
}), Er(o, () => {
|
|
1249
1255
|
const A = async () => {
|
|
1250
|
-
if (!
|
|
1251
|
-
return await
|
|
1256
|
+
if (!b) throw new Error("No active conversation. Please start a conversation first.");
|
|
1257
|
+
return await a.groupChannel.getChannel(b.url);
|
|
1252
1258
|
};
|
|
1253
1259
|
return {
|
|
1254
|
-
activeChannel:
|
|
1255
|
-
chatSDK:
|
|
1256
|
-
authenticate:
|
|
1260
|
+
activeChannel: b,
|
|
1261
|
+
chatSDK: a,
|
|
1262
|
+
authenticate: oe,
|
|
1257
1263
|
deauthenticate: Y,
|
|
1258
1264
|
updateContext: async (D) => {
|
|
1259
|
-
const q = await (await A()).updateContext(
|
|
1265
|
+
const q = await (await A()).updateContext(i, D);
|
|
1260
1266
|
return { ...q, context: q.context ?? {} };
|
|
1261
1267
|
},
|
|
1262
1268
|
patchContext: async (D) => {
|
|
1263
|
-
const q = await (await A()).patchContext(
|
|
1269
|
+
const q = await (await A()).patchContext(i, D);
|
|
1264
1270
|
return { ...q, context: q.context ?? {} };
|
|
1265
1271
|
},
|
|
1266
1272
|
getContextObject: async () => {
|
|
1267
|
-
const K = await (await A()).getContextObject(
|
|
1273
|
+
const K = await (await A()).getContextObject(i);
|
|
1268
1274
|
return { ...K, context: K.context ?? {} };
|
|
1269
1275
|
}
|
|
1270
1276
|
};
|
|
1271
|
-
}, [
|
|
1277
|
+
}, [oe, Y, b, a, i, m]), /* @__PURE__ */ r.createElement(
|
|
1272
1278
|
Bo,
|
|
1273
1279
|
{
|
|
1274
1280
|
value: {
|
|
1275
1281
|
userSessionInfo: e,
|
|
1276
1282
|
userSession: C,
|
|
1277
|
-
activeChannel:
|
|
1278
|
-
setActiveChannel:
|
|
1283
|
+
activeChannel: b,
|
|
1284
|
+
setActiveChannel: g,
|
|
1279
1285
|
refreshActiveChannel: nt,
|
|
1280
1286
|
createConversation: rt,
|
|
1281
1287
|
connectionError: x,
|
|
1282
1288
|
aiAgentInfo: S,
|
|
1283
1289
|
launcherInfo: F,
|
|
1284
|
-
authenticate:
|
|
1290
|
+
authenticate: oe,
|
|
1285
1291
|
deauthenticate: Y,
|
|
1286
1292
|
attachmentMode: V
|
|
1287
1293
|
}
|
|
@@ -1309,47 +1315,47 @@ const {
|
|
|
1309
1315
|
useContext: kn
|
|
1310
1316
|
} = G("MessageTemplateFetching");
|
|
1311
1317
|
function zo({ children: e, internalVariables: t }) {
|
|
1312
|
-
const n = N({}), o = N({}), [s,
|
|
1313
|
-
|
|
1314
|
-
...
|
|
1315
|
-
[d]: { fetching: !1, error: !1, ...
|
|
1318
|
+
const n = N({}), o = N({}), [s, i] = _({}), a = R((d, h) => {
|
|
1319
|
+
i((m) => ({
|
|
1320
|
+
...m,
|
|
1321
|
+
[d]: { fetching: !1, error: !1, ...m[d], ...h }
|
|
1316
1322
|
}));
|
|
1317
1323
|
}, []), l = R(
|
|
1318
1324
|
async ({
|
|
1319
1325
|
onRequestTemplate: d,
|
|
1320
|
-
onGetCachedTemplate:
|
|
1321
|
-
templateKey:
|
|
1326
|
+
onGetCachedTemplate: h,
|
|
1327
|
+
templateKey: m,
|
|
1322
1328
|
suspense: f = !1
|
|
1323
1329
|
}) => {
|
|
1324
|
-
const x =
|
|
1330
|
+
const x = h(m);
|
|
1325
1331
|
if (x) return x;
|
|
1326
|
-
const
|
|
1327
|
-
if (
|
|
1328
|
-
f ||
|
|
1329
|
-
const
|
|
1330
|
-
throw f ||
|
|
1332
|
+
const E = o.current[m];
|
|
1333
|
+
if (E) return E;
|
|
1334
|
+
f || a(m, { fetching: !0 });
|
|
1335
|
+
const b = d(m).catch((g) => {
|
|
1336
|
+
throw f || a(m, { error: !0 }), g;
|
|
1331
1337
|
}).finally(() => {
|
|
1332
|
-
f ||
|
|
1338
|
+
f || a(m, { fetching: !1 }), delete o.current[m];
|
|
1333
1339
|
});
|
|
1334
|
-
return o.current[
|
|
1340
|
+
return o.current[m] = b, b;
|
|
1335
1341
|
},
|
|
1336
|
-
[
|
|
1342
|
+
[a]
|
|
1337
1343
|
), c = {
|
|
1338
1344
|
internalVariables: t,
|
|
1339
1345
|
fetchTemplate: l,
|
|
1340
|
-
suspend: (d,
|
|
1346
|
+
suspend: (d, h) => {
|
|
1341
1347
|
if (n.current[d])
|
|
1342
1348
|
return n.current[d];
|
|
1343
|
-
const
|
|
1344
|
-
return n.current[d] =
|
|
1349
|
+
const m = Uo(h());
|
|
1350
|
+
return n.current[d] = m, m;
|
|
1345
1351
|
},
|
|
1346
1352
|
getIsFetching: (d) => {
|
|
1347
|
-
var
|
|
1348
|
-
return ((
|
|
1353
|
+
var h;
|
|
1354
|
+
return ((h = s[d]) == null ? void 0 : h.fetching) ?? !1;
|
|
1349
1355
|
},
|
|
1350
1356
|
getHasError: (d) => {
|
|
1351
|
-
var
|
|
1352
|
-
return ((
|
|
1357
|
+
var h;
|
|
1358
|
+
return ((h = s[d]) == null ? void 0 : h.error) ?? !1;
|
|
1353
1359
|
}
|
|
1354
1360
|
};
|
|
1355
1361
|
return /* @__PURE__ */ r.createElement(Ho, { value: c }, e);
|
|
@@ -1384,34 +1390,34 @@ function Vo({
|
|
|
1384
1390
|
viewVariables: n = {},
|
|
1385
1391
|
aiAgentColorVariables: o,
|
|
1386
1392
|
internalVariables: s,
|
|
1387
|
-
onRequestTemplate:
|
|
1393
|
+
onRequestTemplate: i
|
|
1388
1394
|
}) {
|
|
1389
1395
|
const l = Object.values(n).flat().map((d) => d.key);
|
|
1390
|
-
return [...new Set(l)].some((d) => !
|
|
1396
|
+
return [...new Set(l)].some((d) => !i(d)) ? null : vt({
|
|
1391
1397
|
template: t,
|
|
1392
1398
|
variables: n,
|
|
1393
1399
|
variableKeyPattern: (d) => et.VIEW_VARIABLE(d),
|
|
1394
1400
|
variableValueTransformer: (d) => {
|
|
1395
|
-
const
|
|
1396
|
-
const x =
|
|
1397
|
-
let
|
|
1398
|
-
return
|
|
1399
|
-
uiTemplateString:
|
|
1401
|
+
const h = d.map(({ key: m, variables: f }) => {
|
|
1402
|
+
const x = i(m), { ui_template: E, color_variables: b } = $e(x);
|
|
1403
|
+
let g = JSON.stringify(E);
|
|
1404
|
+
return g = ce({
|
|
1405
|
+
uiTemplateString: g,
|
|
1400
1406
|
variables: s
|
|
1401
|
-
}),
|
|
1407
|
+
}), g = de({
|
|
1402
1408
|
theme: e,
|
|
1403
|
-
uiTemplateString:
|
|
1404
|
-
colorVariables:
|
|
1405
|
-
}),
|
|
1409
|
+
uiTemplateString: g,
|
|
1410
|
+
colorVariables: b
|
|
1411
|
+
}), g = de({
|
|
1406
1412
|
theme: e,
|
|
1407
|
-
uiTemplateString:
|
|
1413
|
+
uiTemplateString: g,
|
|
1408
1414
|
colorVariables: o
|
|
1409
|
-
}),
|
|
1410
|
-
uiTemplateString:
|
|
1415
|
+
}), g = ce({
|
|
1416
|
+
uiTemplateString: g,
|
|
1411
1417
|
variables: f
|
|
1412
|
-
}), Qe(
|
|
1418
|
+
}), Qe(g);
|
|
1413
1419
|
});
|
|
1414
|
-
return JSON.stringify(
|
|
1420
|
+
return JSON.stringify(h);
|
|
1415
1421
|
}
|
|
1416
1422
|
});
|
|
1417
1423
|
}
|
|
@@ -1421,31 +1427,31 @@ async function Wo({
|
|
|
1421
1427
|
viewVariables: n = {},
|
|
1422
1428
|
aiAgentColorVariables: o,
|
|
1423
1429
|
internalVariables: s,
|
|
1424
|
-
onRequestTemplate:
|
|
1430
|
+
onRequestTemplate: i
|
|
1425
1431
|
}) {
|
|
1426
1432
|
return Do({
|
|
1427
1433
|
template: t,
|
|
1428
1434
|
variables: n,
|
|
1429
|
-
variableKeyPattern: (
|
|
1430
|
-
variableValueTransformer: async (
|
|
1431
|
-
const l =
|
|
1432
|
-
const
|
|
1433
|
-
let
|
|
1434
|
-
return
|
|
1435
|
-
uiTemplateString:
|
|
1435
|
+
variableKeyPattern: (a) => et.VIEW_VARIABLE(a),
|
|
1436
|
+
variableValueTransformer: async (a) => {
|
|
1437
|
+
const l = a.map(async ({ key: d, variables: h }) => {
|
|
1438
|
+
const m = await i(d), { ui_template: f, color_variables: x } = $e(m);
|
|
1439
|
+
let E = JSON.stringify(f);
|
|
1440
|
+
return E = ce({
|
|
1441
|
+
uiTemplateString: E,
|
|
1436
1442
|
variables: s
|
|
1437
|
-
}),
|
|
1443
|
+
}), E = de({
|
|
1438
1444
|
theme: e,
|
|
1439
|
-
uiTemplateString:
|
|
1445
|
+
uiTemplateString: E,
|
|
1440
1446
|
colorVariables: x
|
|
1441
|
-
}),
|
|
1447
|
+
}), E = de({
|
|
1442
1448
|
theme: e,
|
|
1443
|
-
uiTemplateString:
|
|
1449
|
+
uiTemplateString: E,
|
|
1444
1450
|
colorVariables: o
|
|
1445
|
-
}),
|
|
1446
|
-
uiTemplateString:
|
|
1447
|
-
variables:
|
|
1448
|
-
}), Qe(
|
|
1451
|
+
}), E = ce({
|
|
1452
|
+
uiTemplateString: E,
|
|
1453
|
+
variables: h
|
|
1454
|
+
}), Qe(E);
|
|
1449
1455
|
}), c = await Promise.all(l);
|
|
1450
1456
|
return JSON.stringify(c);
|
|
1451
1457
|
}
|
|
@@ -1457,33 +1463,33 @@ const Go = ({
|
|
|
1457
1463
|
internalVariables: n,
|
|
1458
1464
|
...o
|
|
1459
1465
|
}) => {
|
|
1460
|
-
const { ui_template: s, color_variables:
|
|
1461
|
-
let
|
|
1466
|
+
const { ui_template: s, color_variables: i } = $e(e);
|
|
1467
|
+
let a = JSON.stringify(s);
|
|
1462
1468
|
if (Object.keys(o.viewVariables ?? {}).length > 0) {
|
|
1463
1469
|
const c = Vo({
|
|
1464
1470
|
...o,
|
|
1465
|
-
uiTemplateString:
|
|
1471
|
+
uiTemplateString: a,
|
|
1466
1472
|
aiAgentColorVariables: t,
|
|
1467
1473
|
internalVariables: n
|
|
1468
1474
|
});
|
|
1469
1475
|
if (c === null) return null;
|
|
1470
|
-
|
|
1476
|
+
a = c;
|
|
1471
1477
|
}
|
|
1472
|
-
return
|
|
1478
|
+
return a = ce({ ...o, uiTemplateString: a, variables: n }), a = de({ ...o, uiTemplateString: a, colorVariables: i }), a = de({ ...o, uiTemplateString: a, colorVariables: t }), a = ce({ ...o, uiTemplateString: a }), Qe(a);
|
|
1473
1479
|
}, jo = async ({
|
|
1474
1480
|
rawTemplate: e,
|
|
1475
1481
|
aiAgentColorVariables: t,
|
|
1476
1482
|
internalVariables: n,
|
|
1477
1483
|
...o
|
|
1478
1484
|
}) => {
|
|
1479
|
-
const { ui_template: s, color_variables:
|
|
1480
|
-
let
|
|
1481
|
-
return Object.keys(o.viewVariables ?? {}).length > 0 && (
|
|
1485
|
+
const { ui_template: s, color_variables: i } = $e(e);
|
|
1486
|
+
let a = JSON.stringify(s);
|
|
1487
|
+
return Object.keys(o.viewVariables ?? {}).length > 0 && (a = await Wo({
|
|
1482
1488
|
...o,
|
|
1483
|
-
uiTemplateString:
|
|
1489
|
+
uiTemplateString: a,
|
|
1484
1490
|
aiAgentColorVariables: t,
|
|
1485
1491
|
internalVariables: n
|
|
1486
|
-
})),
|
|
1492
|
+
})), a = ce({ ...o, uiTemplateString: a, variables: n }), a = de({ ...o, uiTemplateString: a, colorVariables: i }), a = de({ ...o, uiTemplateString: a, colorVariables: t }), a = ce({ ...o, uiTemplateString: a }), Qe(a);
|
|
1487
1493
|
}, Ko = (e) => {
|
|
1488
1494
|
const { aiAgentColorVariables: t = {} } = e, { internalVariables: n } = kn();
|
|
1489
1495
|
return _(() => {
|
|
@@ -1499,8 +1505,8 @@ const Go = ({
|
|
|
1499
1505
|
}, Zo = (e) => {
|
|
1500
1506
|
const [t] = Ko(e);
|
|
1501
1507
|
if (t) return t;
|
|
1502
|
-
const { aiAgentColorVariables: n = {} } = e, { internalVariables: o, fetchTemplate: s, suspend:
|
|
1503
|
-
return
|
|
1508
|
+
const { aiAgentColorVariables: n = {} } = e, { internalVariables: o, fetchTemplate: s, suspend: i } = kn();
|
|
1509
|
+
return i(e.templateKey, async () => {
|
|
1504
1510
|
const l = await s({ ...e, suspense: !0 });
|
|
1505
1511
|
return await jo({
|
|
1506
1512
|
...e,
|
|
@@ -1522,9 +1528,9 @@ const Go = ({
|
|
|
1522
1528
|
"ja"
|
|
1523
1529
|
]), Jo = (e, t, n) => {
|
|
1524
1530
|
const o = e[t];
|
|
1525
|
-
return o ? typeof o == "function" ? o() : Promise.resolve(o) : new Promise((s,
|
|
1531
|
+
return o ? typeof o == "function" ? o() : Promise.resolve(o) : new Promise((s, i) => {
|
|
1526
1532
|
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
1527
|
-
|
|
1533
|
+
i.bind(
|
|
1528
1534
|
null,
|
|
1529
1535
|
new Error(
|
|
1530
1536
|
"Unknown variable dynamic import: " + t + (t.split("/").length !== n ? ". Note that variables only represent file names one level deep." : "")
|
|
@@ -1614,10 +1620,10 @@ function os({
|
|
|
1614
1620
|
stringSet: n,
|
|
1615
1621
|
children: o
|
|
1616
1622
|
}) {
|
|
1617
|
-
const [s,
|
|
1623
|
+
const [s, i] = _(Ke.get(Me));
|
|
1618
1624
|
return L(() => {
|
|
1619
|
-
const
|
|
1620
|
-
s.language !==
|
|
1625
|
+
const a = rs(e);
|
|
1626
|
+
s.language !== a && (t == null || t.debug("localization.useEffect: update language", `${s.language} -> ${a}`), ts(a).then(i));
|
|
1621
1627
|
}, [e]), /* @__PURE__ */ r.createElement(
|
|
1622
1628
|
ns,
|
|
1623
1629
|
{
|
|
@@ -1625,7 +1631,7 @@ function os({
|
|
|
1625
1631
|
language: s.language,
|
|
1626
1632
|
stringSet: { ...s.stringSet, ...n },
|
|
1627
1633
|
dateLocale: s.dateLocale,
|
|
1628
|
-
format: (
|
|
1634
|
+
format: (a, l, c) => Cn(a, l, { locale: s.dateLocale, ...c })
|
|
1629
1635
|
}
|
|
1630
1636
|
},
|
|
1631
1637
|
o
|
|
@@ -1633,8 +1639,8 @@ function os({
|
|
|
1633
1639
|
}
|
|
1634
1640
|
const Ze = "data-sb-agent-theme", Yt = (e) => (t, ...n) => {
|
|
1635
1641
|
let o = "";
|
|
1636
|
-
return t.forEach((s,
|
|
1637
|
-
o += s + (n[
|
|
1642
|
+
return t.forEach((s, i) => {
|
|
1643
|
+
o += s + (n[i] ?? "");
|
|
1638
1644
|
}), `[${Ze}='${e}'] & { ${o} }`;
|
|
1639
1645
|
}, P = {
|
|
1640
1646
|
light: Yt("light"),
|
|
@@ -1762,17 +1768,17 @@ const us = (e, t) => {
|
|
|
1762
1768
|
L(() => {
|
|
1763
1769
|
const n = pe(t) instanceof ShadowRoot, o = pe(t, !0);
|
|
1764
1770
|
if (!(n ? t : o).querySelector(`link[href*='${e}']`)) {
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1771
|
+
const i = o.createElement("link");
|
|
1772
|
+
i.rel = "stylesheet", i.href = e, (n ? t : o.head).appendChild(i);
|
|
1767
1773
|
}
|
|
1768
1774
|
}, [e, t]);
|
|
1769
1775
|
}, ms = (e, t = document.body) => {
|
|
1770
1776
|
L(() => {
|
|
1771
1777
|
const n = pe(t), s = n instanceof ShadowRoot ? t : n.head;
|
|
1772
1778
|
if (!s) return;
|
|
1773
|
-
const
|
|
1774
|
-
let
|
|
1775
|
-
|
|
1779
|
+
const i = `sba-${btoa(e).slice(0, 10)}`;
|
|
1780
|
+
let a = s.querySelector(`style#${i}`);
|
|
1781
|
+
a ? a.textContent !== e && (a.textContent = e) : (a = s.ownerDocument.createElement("style"), a.id = i, a.textContent = e, s.appendChild(a));
|
|
1776
1782
|
}, [e, t]);
|
|
1777
1783
|
}, _t = /iPad|iPhone|iPod/.test(navigator.userAgent), gs = /Android/.test(navigator.userAgent), Oe = (e) => _t || gs, {
|
|
1778
1784
|
Provider: hs,
|
|
@@ -1785,21 +1791,21 @@ function ps({
|
|
|
1785
1791
|
enableCloseConversationButton: n = !1,
|
|
1786
1792
|
enableExpandButton: o = !0,
|
|
1787
1793
|
enableAutoDisconnectInLauncher: s = !0,
|
|
1788
|
-
...
|
|
1794
|
+
...i
|
|
1789
1795
|
}) {
|
|
1790
|
-
const [
|
|
1791
|
-
opened: (t == null ? void 0 : t.opened) ??
|
|
1796
|
+
const [a, l] = _(!1), [c, d] = _(!1), h = {
|
|
1797
|
+
opened: (t == null ? void 0 : t.opened) ?? a,
|
|
1792
1798
|
setOpened: (t == null ? void 0 : t.setOpened) ?? l,
|
|
1793
1799
|
expanded: (t == null ? void 0 : t.expanded) ?? c,
|
|
1794
1800
|
setExpanded: (t == null ? void 0 : t.setExpanded) ?? d
|
|
1795
1801
|
};
|
|
1796
|
-
return /* @__PURE__ */ r.createElement(eo, { ...
|
|
1802
|
+
return /* @__PURE__ */ r.createElement(eo, { ...i }, (m) => /* @__PURE__ */ r.createElement(
|
|
1797
1803
|
hs,
|
|
1798
1804
|
{
|
|
1799
1805
|
value: {
|
|
1800
|
-
...
|
|
1801
|
-
...
|
|
1802
|
-
state:
|
|
1806
|
+
...i,
|
|
1807
|
+
...m,
|
|
1808
|
+
state: h,
|
|
1803
1809
|
enableCloseConversationButton: n,
|
|
1804
1810
|
enableExpandButton: o,
|
|
1805
1811
|
enableAutoDisconnectInLauncher: s
|
|
@@ -1814,30 +1820,30 @@ const {
|
|
|
1814
1820
|
} = G("MessengerSession"), bs = ye(function({ children: e, ...t }, n) {
|
|
1815
1821
|
return /* @__PURE__ */ r.createElement(Fo, { ref: n, ...t }, (o) => /* @__PURE__ */ r.createElement(Es, { ...o }, e));
|
|
1816
1822
|
}), Es = ({ children: e, ...t }) => {
|
|
1817
|
-
const { chatSDK: n, logger: o, appId: s, aiAgentId:
|
|
1823
|
+
const { chatSDK: n, logger: o, appId: s, aiAgentId: i, agentPreviewConfigs: a, state: l } = B(), { userSessionInfo: c, authenticate: d, setActiveChannel: h, userSession: m, aiAgentInfo: f, launcherInfo: x } = t;
|
|
1818
1824
|
return Xe(n, {
|
|
1819
|
-
async onUserJoined(
|
|
1825
|
+
async onUserJoined(E, b) {
|
|
1820
1826
|
var C, v;
|
|
1821
|
-
if (
|
|
1822
|
-
o.info("messengerSession.onUserJoined: proactive channel joined",
|
|
1823
|
-
const S = ((v =
|
|
1824
|
-
|
|
1827
|
+
if (E.conversation && E.conversation.type === Rr.PROACTIVE && b.userId === ((C = n.currentUser) == null ? void 0 : C.userId)) {
|
|
1828
|
+
o.info("messengerSession.onUserJoined: proactive channel joined", E.url);
|
|
1829
|
+
const S = ((v = E.conversation) == null ? void 0 : v.status) ?? W.OPEN;
|
|
1830
|
+
h({ url: E.url, status: S }), l.setOpened(!0), xs({ sound: document.hidden || !l.opened });
|
|
1825
1831
|
}
|
|
1826
1832
|
}
|
|
1827
1833
|
}), L(() => {
|
|
1828
|
-
d().then(({ launcher:
|
|
1829
|
-
|
|
1830
|
-
}).catch((
|
|
1831
|
-
o.error("messengerSession: failed to initialize",
|
|
1834
|
+
d().then(({ launcher: E }) => {
|
|
1835
|
+
E.auto_open && !Oe() && setTimeout(() => l.setOpened(!0), 500);
|
|
1836
|
+
}).catch((E) => {
|
|
1837
|
+
o.error("messengerSession: failed to initialize", E);
|
|
1832
1838
|
});
|
|
1833
|
-
}, [n, s,
|
|
1839
|
+
}, [n, s, i, c == null ? void 0 : c.userId, c == null ? void 0 : c.authToken]), !m || !f || !x ? null : /* @__PURE__ */ r.createElement(
|
|
1834
1840
|
fs,
|
|
1835
1841
|
{
|
|
1836
1842
|
value: {
|
|
1837
1843
|
...t,
|
|
1838
|
-
userSession:
|
|
1839
|
-
aiAgentInfo: { ...f, ...
|
|
1840
|
-
launcherInfo: { ...x, ...
|
|
1844
|
+
userSession: m,
|
|
1845
|
+
aiAgentInfo: { ...f, ...a == null ? void 0 : a.bot },
|
|
1846
|
+
launcherInfo: { ...x, ...a == null ? void 0 : a.launcher }
|
|
1841
1847
|
}
|
|
1842
1848
|
},
|
|
1843
1849
|
e
|
|
@@ -1865,15 +1871,15 @@ const j = (e) => {
|
|
|
1865
1871
|
n || (n = /* @__PURE__ */ new Map(), qt.set(t, n));
|
|
1866
1872
|
const o = n.get(e);
|
|
1867
1873
|
if (o) return o;
|
|
1868
|
-
const s = t[e] ?? t.body1,
|
|
1874
|
+
const s = t[e] ?? t.body1, i = I`font-size:${j(s.fontSize)};font-weight:${s.fontWeight};${s.fontFamily ? `font-family: ${s.fontFamily};` : ""}
|
|
1869
1875
|
${s.lineHeight ? `line-height: ${s.lineHeight};` : "line-height: 100%;"}
|
|
1870
1876
|
`;
|
|
1871
|
-
return n.set(e,
|
|
1872
|
-
}, vs = u.span`font-stretch:normal;font-style:normal;letter-spacing:normal;${({ $variant: e, theme: t }) => Cs(e, t.typography)}color:${({ $color: e }) => e};`,
|
|
1873
|
-
ENTRY: `${
|
|
1874
|
-
MODAL_ROOT: `${
|
|
1875
|
-
WINDOW: `${
|
|
1876
|
-
LAUNCHER: `${
|
|
1877
|
+
return n.set(e, i), i;
|
|
1878
|
+
}, vs = u.span`font-stretch:normal;font-style:normal;letter-spacing:normal;${({ $variant: e, theme: t }) => Cs(e, t.typography)}color:${({ $color: e }) => e};`, J = "sb-agent", ee = {
|
|
1879
|
+
ENTRY: `${J}-entry`,
|
|
1880
|
+
MODAL_ROOT: `${J}-modal-root`,
|
|
1881
|
+
WINDOW: `${J}-window`,
|
|
1882
|
+
LAUNCHER: `${J}-launcher`
|
|
1877
1883
|
}, Ue = 2147483647, fe = {
|
|
1878
1884
|
MODAL: Ue - 1,
|
|
1879
1885
|
// FIXME: need to cover the case where the tooltip is on the top of the modal
|
|
@@ -1883,7 +1889,7 @@ const j = (e) => {
|
|
|
1883
1889
|
}, $n = {
|
|
1884
1890
|
DEFAULT_PRIMARY: "#742ddd",
|
|
1885
1891
|
WHITE: "#ffffff"
|
|
1886
|
-
}, Mn = 36, ys = 100, _s = 25 * 1024 * 1024, On = ["application/pdf", "image/jpeg", "image/jpg", "image/png"], St = "noopener noreferrer nofollow", Le = 244, Ln = 640, Ye = 26, Rn = 4,
|
|
1892
|
+
}, Mn = 36, ys = 100, _s = 25 * 1024 * 1024, On = ["application/pdf", "image/jpeg", "image/jpg", "image/png"], St = "noopener noreferrer nofollow", Le = 244, Ln = 640, Ye = 26, Rn = 4, te = 12, Te = 2, Ss = 16, ne = `${J}-incoming-msg`, Ts = `${J}-marked-text`;
|
|
1887
1893
|
function Tt(e) {
|
|
1888
1894
|
switch (e) {
|
|
1889
1895
|
case "top":
|
|
@@ -1964,8 +1970,8 @@ function At({
|
|
|
1964
1970
|
iconBackgroundColor: o,
|
|
1965
1971
|
onClick: s
|
|
1966
1972
|
}) {
|
|
1967
|
-
const { colors:
|
|
1968
|
-
return /* @__PURE__ */ r.createElement($s, { onClick: s, $clickable: !!s }, /* @__PURE__ */ r.createElement(Os, { $bgColor: o ??
|
|
1973
|
+
const { colors: i } = xt();
|
|
1974
|
+
return /* @__PURE__ */ r.createElement($s, { onClick: s, $clickable: !!s }, /* @__PURE__ */ r.createElement(Os, { $bgColor: o ?? i.base.primary }, /* @__PURE__ */ r.createElement(M, { type: "file-document", size: 24, color: n ?? i.base.primaryContrastContent })), /* @__PURE__ */ r.createElement(Ls, null, /* @__PURE__ */ r.createElement(Rs, { variant: "button", color: p.themedColor.textHighEmphasis }, e), /* @__PURE__ */ r.createElement(w, { color: p.themedColor.textMidEmphasis, variant: "caption3" }, t)));
|
|
1969
1975
|
}
|
|
1970
1976
|
const $s = u.div`border-radius:12px;gap:8px;width:${Le}px;height:64px;display:flex;align-items:center;padding:12px;box-sizing:border-box;border:1px solid ${p.themedColor.textDisabled};background-color:${p.themedColor.bg_50_600};${({ $clickable: e }) => e && Ms}`, Ms = I`cursor:pointer;&:hover{background-color:${p.themedColor.bg_100_500};}`, Os = u.div`border-radius:8px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;background-color:${({ $bgColor: e }) => e};`, Ls = u.div`display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;`, Rs = u(w)`text-overflow:ellipsis;white-space:nowrap;overflow:hidden;`;
|
|
1971
1977
|
function Ds({ file: e, children: t, onClickFile: n }) {
|
|
@@ -1983,7 +1989,7 @@ function Ps({ file: e, onClickMedia: t, children: n }) {
|
|
|
1983
1989
|
const o = () => e.type.startsWith("image") ? /* @__PURE__ */ r.createElement(Us, { src: e.url, alt: "image-message" }) : e.type.startsWith("video") ? /* @__PURE__ */ r.createElement(Hs, { controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: e.url }), /* @__PURE__ */ r.createElement("track", { kind: "captions" })) : null;
|
|
1984
1990
|
if (o) {
|
|
1985
1991
|
const s = {
|
|
1986
|
-
id: `${
|
|
1992
|
+
id: `${ne}-media-body`,
|
|
1987
1993
|
onClick: () => t == null ? void 0 : t(e)
|
|
1988
1994
|
};
|
|
1989
1995
|
return /* @__PURE__ */ r.createElement(Bs, null, /* @__PURE__ */ r.createElement(Fs, { ...s }, o()), n);
|
|
@@ -2007,34 +2013,34 @@ function Vs(e) {
|
|
|
2007
2013
|
function Ws(e) {
|
|
2008
2014
|
const t = /```(\w+)?\n([\s\S]*?)```/g, n = [];
|
|
2009
2015
|
let o = 0;
|
|
2010
|
-
return e.replace(t, (s, ...
|
|
2011
|
-
const [
|
|
2016
|
+
return e.replace(t, (s, ...i) => {
|
|
2017
|
+
const [a, l, c] = i;
|
|
2012
2018
|
return o < c && n.push({
|
|
2013
2019
|
type: "text",
|
|
2014
2020
|
value: e.slice(o, c).trim()
|
|
2015
2021
|
}), n.push({
|
|
2016
2022
|
type: "code",
|
|
2017
2023
|
value: l.trim(),
|
|
2018
|
-
language:
|
|
2024
|
+
language: a ? a.trim() : "plaintext"
|
|
2019
2025
|
}), o = c + s.length, s;
|
|
2020
2026
|
}), o < e.length && n.push({
|
|
2021
2027
|
type: "text",
|
|
2022
2028
|
value: e.slice(o).trim()
|
|
2023
2029
|
}), n.map((s) => s.type !== "text" ? s : { ...s, value: Nn(s.value) });
|
|
2024
2030
|
}
|
|
2025
|
-
const Gs = T(async () => ({ default: (await import("./
|
|
2031
|
+
const Gs = T(async () => ({ default: (await import("./CwdCJ7xG.js")).MarkdownText })), js = T(async () => ({ default: (await import("./Ch_6OPTz.js")).CodeBlock }));
|
|
2026
2032
|
function Jt(e) {
|
|
2027
|
-
var s,
|
|
2033
|
+
var s, i;
|
|
2028
2034
|
const t = e.maxBodyWidth ?? Le, n = ae(() => Ws(e.message), [e.message]), o = {
|
|
2029
|
-
id: `${
|
|
2035
|
+
id: `${ne}-text-body`,
|
|
2030
2036
|
$maxWidth: t,
|
|
2031
2037
|
$color: (s = e.customStyle) == null ? void 0 : s.bubbleContentColor,
|
|
2032
|
-
$bgColor: (
|
|
2038
|
+
$bgColor: (i = e.customStyle) == null ? void 0 : i.bubbleBackgroundColor
|
|
2033
2039
|
};
|
|
2034
|
-
return n.length === 0 ? e.children ? /* @__PURE__ */ r.createElement(Xt, { ...o }, e.children) : null : /* @__PURE__ */ r.createElement(Xt, { ...o }, n.map((
|
|
2040
|
+
return n.length === 0 ? e.children ? /* @__PURE__ */ r.createElement(Xt, { ...o }, e.children) : null : /* @__PURE__ */ r.createElement(Xt, { ...o }, n.map((a, l) => a.type === "text" ? /* @__PURE__ */ r.createElement(Qt, { key: l, variant: "body3" }, /* @__PURE__ */ r.createElement(ke, { fallback: a.value }, /* @__PURE__ */ r.createElement(Gs, { onClickImage: (c) => {
|
|
2035
2041
|
var d;
|
|
2036
2042
|
return (d = e.onClickMedia) == null ? void 0 : d.call(e, { url: c, type: "image/*" });
|
|
2037
|
-
} },
|
|
2043
|
+
} }, a.value))) : a.type === "code" ? /* @__PURE__ */ r.createElement(ke, { key: l, fallback: /* @__PURE__ */ r.createElement(Qt, { variant: "body3" }, a.value) }, /* @__PURE__ */ r.createElement(js, { code: a.value, language: a.language })) : null), e.children);
|
|
2038
2044
|
}
|
|
2039
2045
|
const Xt = u.div`display:flex;flex-direction:column;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e, $color: t, $bgColor: n }) => I`
|
|
2040
2046
|
color: ${t || e.colors.messageIncoming.text};
|
|
@@ -2060,17 +2066,17 @@ function It({ id: e, src: t, size: n = 56, onClick: o, style: s }) {
|
|
|
2060
2066
|
}
|
|
2061
2067
|
const Zs = u.div`border-radius:50%;display:inline-block;overflow:hidden;position:relative;flex-shrink:0;height:${(e) => e.$size};width:${(e) => e.$size};background-color:${p.themedColor.bg_100_500};&:focus{outline:none;}`, Ys = u.img`object-fit:cover;width:100%;height:100%;position:absolute;`;
|
|
2062
2068
|
function qs({ sender: e, isBotMessage: t }) {
|
|
2063
|
-
const n = `${
|
|
2069
|
+
const n = `${ne}-sender-avatar`;
|
|
2064
2070
|
return !e.profileUrl && t ? /* @__PURE__ */ r.createElement(Js, { id: n }, /* @__PURE__ */ r.createElement(kt, null)) : /* @__PURE__ */ r.createElement(It, { id: n, size: Ye, src: e.profileUrl });
|
|
2065
2071
|
}
|
|
2066
2072
|
const Js = u.div`flex-shrink:0;width:${Ye}px;height:${Ye}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};}}`;
|
|
2067
2073
|
function Xs({ sender: e }) {
|
|
2068
|
-
return /* @__PURE__ */ r.createElement(Qs, { id: `${
|
|
2074
|
+
return /* @__PURE__ */ r.createElement(Qs, { id: `${ne}-sender-name`, variant: "caption1", color: p.themedColor.textMidEmphasis }, e.nickname);
|
|
2069
2075
|
}
|
|
2070
2076
|
const Qs = u(w)`text-align:start;width:100%;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:5px;padding-inline:0 7px;`;
|
|
2071
2077
|
function ei({ createdAt: e }) {
|
|
2072
2078
|
const { stringSet: t, format: n } = O();
|
|
2073
|
-
return e ? /* @__PURE__ */ r.createElement(w, { id: `${
|
|
2079
|
+
return e ? /* @__PURE__ */ r.createElement(w, { id: `${ne}-sent-time`, variant: "caption4", color: p.themedColor.textLowEmphasis }, n(e, t.DATE_FORMAT__MESSAGE_TIMESTAMP)) : null;
|
|
2074
2080
|
}
|
|
2075
2081
|
function ti({ customStyle: e }) {
|
|
2076
2082
|
return /* @__PURE__ */ r.createElement(ni, { $bgColor: e == null ? void 0 : e.bubbleBackgroundColor }, [0, 1, 2].map((t) => /* @__PURE__ */ r.createElement(ri, { key: t, $color: e == null ? void 0 : e.bubbleContentColor })));
|
|
@@ -2101,7 +2107,7 @@ function si({
|
|
|
2101
2107
|
onClickCTA: t = ({ url: n }) => $t(n)
|
|
2102
2108
|
}) {
|
|
2103
2109
|
const n = e == null ? void 0 : e.cta_button;
|
|
2104
|
-
return n ? /* @__PURE__ */ r.createElement(ii, { id: `${
|
|
2110
|
+
return n ? /* @__PURE__ */ r.createElement(ii, { id: `${ne}-ext-cta-button`, role: "button", onClick: () => t(n) }, /* @__PURE__ */ r.createElement(ai, { variant: "button" }, n.label)) : null;
|
|
2105
2111
|
}
|
|
2106
2112
|
const ii = u.div`display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:6px;padding:8px;color:${p.themedColor.textHighEmphasis};background-color:${p.color.background50};${P.dark`
|
|
2107
2113
|
background-color: ${p.color.ondark.textDisabled};
|
|
@@ -2112,15 +2118,15 @@ function li({
|
|
|
2112
2118
|
onClickCitation: t = (n) => $t(n.link)
|
|
2113
2119
|
}) {
|
|
2114
2120
|
const { stringSet: n } = O(), { theme: o } = Ct(), s = e == null ? void 0 : e.citations;
|
|
2115
|
-
return !s || s.length === 0 ? null : /* @__PURE__ */ r.createElement(ci, { id: `${
|
|
2121
|
+
return !s || s.length === 0 ? null : /* @__PURE__ */ r.createElement(ci, { id: `${ne}-ext-citation` }, /* @__PURE__ */ r.createElement(di, { variant: "caption1", color: o.colors.messageIncoming.text }, n.CITATION_SOURCE_TITLE), /* @__PURE__ */ r.createElement(ui, null, s.map((i, a) => /* @__PURE__ */ r.createElement(
|
|
2116
2122
|
gi,
|
|
2117
2123
|
{
|
|
2118
|
-
key: `${
|
|
2124
|
+
key: `${i.embedding_id}-${a}`,
|
|
2119
2125
|
role: "button",
|
|
2120
|
-
onClick: () => t(
|
|
2126
|
+
onClick: () => t(i)
|
|
2121
2127
|
},
|
|
2122
2128
|
/* @__PURE__ */ r.createElement(M, { type: "source", size: 16, color: o.colors.messageIncoming.text }),
|
|
2123
|
-
/* @__PURE__ */ r.createElement(mi, { variant: "body3", color: o.colors.messageIncoming.text },
|
|
2129
|
+
/* @__PURE__ */ r.createElement(mi, { variant: "body3", color: o.colors.messageIncoming.text }, i.title)
|
|
2124
2130
|
))));
|
|
2125
2131
|
}
|
|
2126
2132
|
const ci = u.div`display:flex;flex-direction:column;gap:8px;border-radius:8px;padding:8px 12px 6px;`, di = u(w)`opacity:0.5;`, ui = u.div`display:flex;flex-direction:column;gap:8px;`, mi = u(w)`text-decoration:underline;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`, gi = u.div`display:flex;align-items:center;gap:4px;cursor:pointer;&:hover{opacity:0.5;}`;
|
|
@@ -2164,16 +2170,16 @@ const xi = ({
|
|
|
2164
2170
|
const s = e == null ? void 0 : e.message_template;
|
|
2165
2171
|
if (!fi.has((s == null ? void 0 : s.type) ?? "default")) throw new Error("Unsupported template type");
|
|
2166
2172
|
if (!n) throw new Error("onRequestMessageTemplate is required");
|
|
2167
|
-
const { theme:
|
|
2173
|
+
const { theme: a } = ls(), l = Zo({
|
|
2168
2174
|
onRequestTemplate: n,
|
|
2169
2175
|
onGetCachedTemplate: t,
|
|
2170
|
-
theme:
|
|
2176
|
+
theme: a.selectedTheme,
|
|
2171
2177
|
templateKey: (s == null ? void 0 : s.key) ?? "invalid",
|
|
2172
2178
|
variables: s == null ? void 0 : s.variables,
|
|
2173
2179
|
viewVariables: s == null ? void 0 : s.view_variables,
|
|
2174
|
-
aiAgentColorVariables:
|
|
2180
|
+
aiAgentColorVariables: a.aiAgentColorVariables
|
|
2175
2181
|
});
|
|
2176
|
-
return /* @__PURE__ */ r.createElement(Ci, { id: `${
|
|
2182
|
+
return /* @__PURE__ */ r.createElement(Ci, { id: `${ne}-ext-message-template` }, /* @__PURE__ */ r.createElement(
|
|
2177
2183
|
Hr,
|
|
2178
2184
|
{
|
|
2179
2185
|
handleInternalAction: (c, d) => {
|
|
@@ -2188,21 +2194,21 @@ function vi({
|
|
|
2188
2194
|
onClickSuggestedReply: t,
|
|
2189
2195
|
suggestedRepliesDirection: n = "vertical"
|
|
2190
2196
|
}) {
|
|
2191
|
-
const [o, s] = _(!1),
|
|
2192
|
-
return
|
|
2197
|
+
const [o, s] = _(!1), i = (e == null ? void 0 : e.suggested_replies) ?? [];
|
|
2198
|
+
return i.length === 0 || o ? null : /* @__PURE__ */ r.createElement(yi, { id: `${ne}-ext-suggested-replies`, $type: n }, i.map((a, l) => /* @__PURE__ */ r.createElement(
|
|
2193
2199
|
_i,
|
|
2194
2200
|
{
|
|
2195
2201
|
key: l,
|
|
2196
2202
|
$type: n,
|
|
2197
2203
|
variant: "body3",
|
|
2198
2204
|
onClick: () => {
|
|
2199
|
-
t && (t == null || t({ reply:
|
|
2205
|
+
t && (t == null || t({ reply: a }), s(!0));
|
|
2200
2206
|
}
|
|
2201
2207
|
},
|
|
2202
|
-
|
|
2208
|
+
a
|
|
2203
2209
|
)));
|
|
2204
2210
|
}
|
|
2205
|
-
const yi = u.div`margin:16px 0;padding:0 ${
|
|
2211
|
+
const yi = u.div`margin:16px 0;padding:0 ${te}px;position:relative;display:flex;gap:8px;${({ $type: e }) => e === "vertical" ? Si : Ti};`, _i = u(w)`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:${p.color.primary.main};border:1px solid ${p.color.primary.main};background-color:${p.themedColor.bg_50_600};&:hover{background-color:${p.themedColor.bg_100_500};}${({ $type: e, theme: t }) => I`
|
|
2206
2212
|
${e === "vertical" ? wi : Ai};
|
|
2207
2213
|
&:active {
|
|
2208
2214
|
background-color: ${t.colors.base.primary};
|
|
@@ -2232,29 +2238,29 @@ function ki(e) {
|
|
|
2232
2238
|
return /* @__PURE__ */ r.createElement(Un, { ...e, testerMode: !1 });
|
|
2233
2239
|
}
|
|
2234
2240
|
function Un(e) {
|
|
2235
|
-
var f, x,
|
|
2236
|
-
const { components: t } = xe.useContext(), n = !!e.isTyping, o = e.testerMode, s = !!((f = e.extendedMessagePayload) != null && f.message_template),
|
|
2237
|
-
return /* @__PURE__ */ r.createElement(Ii, { $marginBottom: n ? 0 : Tt(e.groupType) }, d && /* @__PURE__ */ r.createElement($i, null, !o && /* @__PURE__ */ r.createElement(t.SenderAvatar, { ...e }), /* @__PURE__ */ r.createElement(t.SenderName, { ...e })), /* @__PURE__ */ r.createElement(Ut, null, /* @__PURE__ */ r.createElement(at, { $extraStartPadding:
|
|
2241
|
+
var f, x, E, b, g;
|
|
2242
|
+
const { components: t } = xe.useContext(), n = !!e.isTyping, o = e.testerMode, s = !!((f = e.extendedMessagePayload) != null && f.message_template), i = !!((x = e.extendedMessagePayload) != null && x.cta_button), a = !!((E = e.extendedMessagePayload) != null && E.citations) && e.extendedMessagePayload.citations.length > 0, l = !!e.createdAt, c = Mt(() => e.messageType === "user" ? e.message.length > 0 : !0), d = e.groupType === "top" || e.groupType === "single", h = e.groupType === "bottom" || e.groupType === "single", m = o ? 0 : Ye;
|
|
2243
|
+
return /* @__PURE__ */ r.createElement(Ii, { $marginBottom: n ? 0 : Tt(e.groupType) }, d && /* @__PURE__ */ r.createElement($i, null, !o && /* @__PURE__ */ r.createElement(t.SenderAvatar, { ...e }), /* @__PURE__ */ r.createElement(t.SenderName, { ...e })), /* @__PURE__ */ r.createElement(Ut, null, /* @__PURE__ */ r.createElement(at, { $extraStartPadding: m }, n && /* @__PURE__ */ r.createElement(t.TypingIndicator, { ...e }), /* @__PURE__ */ r.createElement(t.MessageBody, { ...e }, i && /* @__PURE__ */ r.createElement("div", { style: { marginTop: 12, marginInline: 12 } }, /* @__PURE__ */ r.createElement(t.CTAButton, { ...e })), a && /* @__PURE__ */ r.createElement(t.Citation, { ...e }))), s && /* @__PURE__ */ r.createElement(en, { $startPadding: 0, $endPadding: 0, style: { marginTop: c ? Te : 0 } }, /* @__PURE__ */ r.createElement(
|
|
2238
2244
|
t.MessageTemplate,
|
|
2239
2245
|
{
|
|
2240
2246
|
...e,
|
|
2241
|
-
messageTemplateErrorFallback: e.messageTemplateErrorFallback ?? /* @__PURE__ */ r.createElement(at, { $extraStartPadding:
|
|
2247
|
+
messageTemplateErrorFallback: e.messageTemplateErrorFallback ?? /* @__PURE__ */ r.createElement(at, { $extraStartPadding: m }, /* @__PURE__ */ r.createElement(
|
|
2242
2248
|
t.MessageBody,
|
|
2243
2249
|
{
|
|
2244
2250
|
...e,
|
|
2245
2251
|
messageType: "user",
|
|
2246
|
-
message: ((
|
|
2252
|
+
message: ((g = (b = e.extendedMessagePayload) == null ? void 0 : b.message_template) == null ? void 0 : g.fallback_message) ?? "Cannot read this template."
|
|
2247
2253
|
}
|
|
2248
2254
|
)),
|
|
2249
|
-
messageTemplateLoadingFallback: e.messageTemplateLoadingFallback ?? /* @__PURE__ */ r.createElement(at, { $extraStartPadding:
|
|
2255
|
+
messageTemplateLoadingFallback: e.messageTemplateLoadingFallback ?? /* @__PURE__ */ r.createElement(at, { $extraStartPadding: m }, /* @__PURE__ */ r.createElement(t.TypingIndicator, { ...e }))
|
|
2250
2256
|
}
|
|
2251
|
-
))),
|
|
2257
|
+
))), h && l && /* @__PURE__ */ r.createElement(Mi, { $extraStartPadding: m + 8 }, /* @__PURE__ */ r.createElement(t.SentTime, { ...e })), /* @__PURE__ */ r.createElement(Ut, null, e.suggestedRepliesVisible && /* @__PURE__ */ r.createElement(en, null, /* @__PURE__ */ r.createElement(t.SuggestedReplies, { ...e })), /* @__PURE__ */ r.createElement(t.MessageLogs, { ...e })));
|
|
2252
2258
|
}
|
|
2253
2259
|
const Ii = u.div`display:flex;flex-direction:column;align-items:flex-start;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
|
|
2254
|
-
`, tt = u.div`display:flex;align-self:stretch;justify-content:flex-start;${({ $startPadding: e =
|
|
2260
|
+
`, tt = u.div`display:flex;align-self:stretch;justify-content:flex-start;${({ $startPadding: e = te, $endPadding: t = te, $extraStartPadding: n = 0 }) => `
|
|
2255
2261
|
padding-inline: ${e + n}px ${t}px;
|
|
2256
2262
|
`}
|
|
2257
|
-
`, $i = u(tt)`display:flex;flex-direction:row;align-items:center;gap:8px;`, at = u(tt)`display:flex;`, Mi = u(tt)`margin-top:${Rn}px;display:flex;align-items:flex-start;justify-content:flex-start;`, en = u(tt)`display:flex;flex-direction:column;${({ $startPadding: e =
|
|
2263
|
+
`, $i = u(tt)`display:flex;flex-direction:row;align-items:center;gap:8px;`, at = u(tt)`display:flex;`, Mi = u(tt)`margin-top:${Rn}px;display:flex;align-items:flex-start;justify-content:flex-start;`, en = u(tt)`display:flex;flex-direction:column;${({ $startPadding: e = te, $endPadding: t = te, $extraStartPadding: n = 0 }) => `
|
|
2258
2264
|
padding-inline: ${e + n}px ${t}px;
|
|
2259
2265
|
`}
|
|
2260
2266
|
`;
|
|
@@ -2270,11 +2276,11 @@ function Oi({ file: e, children: t, onClickFile: n }) {
|
|
|
2270
2276
|
}
|
|
2271
2277
|
const Li = u.div`display:flex;flex-direction:column;align-items:flex-end;gap:${Te}px;`, Hn = ({ className: e, children: t, size: n = 26 }) => /* @__PURE__ */ r.createElement(Ri, { className: e, $size: n }, t ?? /* @__PURE__ */ r.createElement(M, { type: "spinner", size: n })), Ri = u.div`display:flex;align-items:center;justify-content:center;width:${({ $size: e }) => j(e)};height:${({ $size: e }) => j(e)};animation:1s infinite linear;animation-name:rotate;@keyframes rotate{from{transform:rotate(0);}to{transform:rotate(360deg);}}`;
|
|
2272
2278
|
function Di({ file: e, metadata: t, onClickMedia: n, children: o }) {
|
|
2273
|
-
const { aspectRatio: s, localFile:
|
|
2279
|
+
const { aspectRatio: s, localFile: i } = t, [a] = _(() => i instanceof File ? URL.createObjectURL(i) : e.url), [l, c] = _(!1), d = {
|
|
2274
2280
|
onClick: () => n == null ? void 0 : n(e),
|
|
2275
2281
|
$ratio: s
|
|
2276
2282
|
};
|
|
2277
|
-
return /* @__PURE__ */ r.createElement(Ni, null, /* @__PURE__ */ r.createElement(Pi, { ...d }, !l && /* @__PURE__ */ r.createElement(Hn, { size: 26 }, /* @__PURE__ */ r.createElement(M, { type: "spinner", color: "textLowEmphasis", size: 26 })), /* @__PURE__ */ r.createElement(Bi, { $loaded: l, src:
|
|
2283
|
+
return /* @__PURE__ */ r.createElement(Ni, null, /* @__PURE__ */ r.createElement(Pi, { ...d }, !l && /* @__PURE__ */ r.createElement(Hn, { size: 26 }, /* @__PURE__ */ r.createElement(M, { type: "spinner", color: "textLowEmphasis", size: 26 })), /* @__PURE__ */ r.createElement(Bi, { $loaded: l, src: a, alt: "image-message", onLoad: () => c(!0) })), o);
|
|
2278
2284
|
}
|
|
2279
2285
|
const Ni = u.div`display:flex;flex-direction:column;align-items:flex-end;gap:${Te}px;`, Pi = u.div`width:${Le}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;${P.light`
|
|
2280
2286
|
background-color: ${p.color.background100};
|
|
@@ -2343,7 +2349,7 @@ function Gi(e) {
|
|
|
2343
2349
|
return /* @__PURE__ */ r.createElement(ji, { $marginBottom: Tt(e.groupType) }, /* @__PURE__ */ r.createElement(Ki, null, /* @__PURE__ */ r.createElement(t.MessageBody, { ...e })), o && /* @__PURE__ */ r.createElement(Zi, { $extraEndPadding: 8 }, n ? /* @__PURE__ */ r.createElement(t.SentTime, { ...e }) : /* @__PURE__ */ r.createElement(t.SendingStatus, { ...e })));
|
|
2344
2350
|
}
|
|
2345
2351
|
const ji = u.div`display:flex;flex:1;flex-direction:column;align-items:flex-end;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
|
|
2346
|
-
`, zn = u.div`display:flex;align-self:stretch;justify-content:flex-end;${({ $startPadding: e =
|
|
2352
|
+
`, zn = u.div`display:flex;align-self:stretch;justify-content:flex-end;${({ $startPadding: e = te, $endPadding: t = te, $extraEndPadding: n = 0 }) => `padding-inline: ${e}px ${t + n}px;`};
|
|
2347
2353
|
`, Ki = u(zn)``, Zi = u(zn)`margin-top:${Rn}px;`;
|
|
2348
2354
|
function Yi(e) {
|
|
2349
2355
|
return e.messageType !== "admin" ? null : /* @__PURE__ */ r.createElement(qi, null, /* @__PURE__ */ r.createElement(w, { variant: "caption2", color: p.themedColor.textMidEmphasis }, Ji(yn.sanitize(e.message))));
|
|
@@ -2351,8 +2357,8 @@ function Yi(e) {
|
|
|
2351
2357
|
const qi = u.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color:inherit;}`, Ji = (e) => {
|
|
2352
2358
|
const t = /\[([^\]]+)\]\((https?:\/\/[^\s]+)\)/g, n = [];
|
|
2353
2359
|
let o = 0;
|
|
2354
|
-
return e.replace(t, (s,
|
|
2355
|
-
/* @__PURE__ */ r.createElement("a", { key:
|
|
2360
|
+
return e.replace(t, (s, i, a, l) => (n.push(e.slice(o, l)), n.push(
|
|
2361
|
+
/* @__PURE__ */ r.createElement("a", { key: a, href: a, target: "_blank", rel: St }, i)
|
|
2356
2362
|
), o = l + s.length, s)), n.push(e.slice(o)), n;
|
|
2357
2363
|
}, Xi = ({ submitted: e, defaultValue: t, value: n, onChange: o }) => {
|
|
2358
2364
|
const { stringSet: s } = O();
|
|
@@ -2376,8 +2382,8 @@ const qi = u.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
|
|
|
2376
2382
|
}
|
|
2377
2383
|
)));
|
|
2378
2384
|
}, nn = ({ onClick: e, checked: t, label: n, disabled: o }) => {
|
|
2379
|
-
const s = t ? p.color.primary.main : o ? p.themedColor.textDisabled : p.themedColor.textLowEmphasis,
|
|
2380
|
-
return /* @__PURE__ */ r.createElement(ea, { onClick: e, disabled: o }, /* @__PURE__ */ r.createElement(M, { size: 24, type: t ? "radio-on" : "radio-off", color: s }), /* @__PURE__ */ r.createElement(w, { variant: "caption2", color:
|
|
2385
|
+
const s = t ? p.color.primary.main : o ? p.themedColor.textDisabled : p.themedColor.textLowEmphasis, i = t ? p.themedColor.textHighEmphasis : o ? p.themedColor.textLowEmphasis : p.themedColor.textHighEmphasis;
|
|
2386
|
+
return /* @__PURE__ */ r.createElement(ea, { onClick: e, disabled: o }, /* @__PURE__ */ r.createElement(M, { size: 24, type: t ? "radio-on" : "radio-off", color: s }), /* @__PURE__ */ r.createElement(w, { variant: "caption2", color: i }, n));
|
|
2381
2387
|
}, Qi = u.div`display:flex;flex-direction:column;gap:8px;`, ea = u.button`all:unset;display:flex;align-items:center;justify-content:flex-start;gap:2px;span{line-height:initial;}&:enabled{cursor:pointer;}`, ta = (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 })), na = (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" })))), ra = (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" })), oa = (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" })), sa = (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" })), ia = (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" })), aa = (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" })), la = (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" })), ca = (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" })), da = (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: {
|
|
2382
2388
|
maskType: "alpha"
|
|
2383
2389
|
}, 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)" })))), ua = [
|
|
@@ -2441,15 +2447,15 @@ const qi = u.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
|
|
|
2441
2447
|
top: I`flex-direction:column;top:0;transform:translate(-50%,-100%);`,
|
|
2442
2448
|
bottom: I`flex-direction:column-reverse;bottom:0;transform:translate(-50%,100%);`
|
|
2443
2449
|
}, ft = u.div`position:relative;`, pa = u.div`display:flex;align-items:center;position:absolute;left:50%;z-index:${fe.TOOLTIP};${({ $position: e }) => ha[e]}opacity:0;transition:opacity 0.2s ease-in-out;pointer-events:none;${ft}:hover &,${ft}:focus-within &{opacity:1;}`, fa = u(w)`padding:6px 8px;background:${p.themedColor.textHighEmphasis};color:${p.themedColor.textHighEmphasisInverse};border-radius:4px;font-size:12px;white-space:nowrap;`, ba = ({ submitted: e, value: t, onChange: n }) => {
|
|
2444
|
-
const { stringSet: o } = O(), s = ma(),
|
|
2445
|
-
return /* @__PURE__ */ r.createElement(Ea, null, /* @__PURE__ */ r.createElement(w, { variant: "caption2", color: p.themedColor.textMidEmphasis }, o.CSAT_RATING_TITLE), /* @__PURE__ */ r.createElement(xa, null, s.map((
|
|
2450
|
+
const { stringSet: o } = O(), s = ma(), i = typeof t == "number";
|
|
2451
|
+
return /* @__PURE__ */ r.createElement(Ea, null, /* @__PURE__ */ r.createElement(w, { variant: "caption2", color: p.themedColor.textMidEmphasis }, o.CSAT_RATING_TITLE), /* @__PURE__ */ r.createElement(xa, null, s.map((a) => /* @__PURE__ */ r.createElement(Vn, { disabled: e, key: a.value, label: a.getTooltip(o) }, /* @__PURE__ */ r.createElement(
|
|
2446
2452
|
Ca,
|
|
2447
2453
|
{
|
|
2448
2454
|
disabled: e,
|
|
2449
|
-
onClick: () => n(
|
|
2450
|
-
$inactive:
|
|
2455
|
+
onClick: () => n(a.value),
|
|
2456
|
+
$inactive: i && !a.isActive(t)
|
|
2451
2457
|
},
|
|
2452
|
-
|
|
2458
|
+
i ? a.isActive(t) ? /* @__PURE__ */ r.createElement(a.Icon.Active, null) : /* @__PURE__ */ r.createElement(a.Icon.Inactive, null) : /* @__PURE__ */ r.createElement(a.Icon.Active, null)
|
|
2453
2459
|
)))));
|
|
2454
2460
|
}, Ea = u.div`display:flex;flex-direction:column;gap:8px;`, xa = u.div`display:flex;justify-content:space-between;width:100%;max-width:320px;`, Ca = u.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:${p.color.background200};${P.dark`
|
|
2455
2461
|
background-color: ${p.color.background500};
|
|
@@ -2486,7 +2492,7 @@ const qi = u.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color
|
|
|
2486
2492
|
const { stringSet: t } = O();
|
|
2487
2493
|
return e ? /* @__PURE__ */ r.createElement(w, { variant: "h2", color: p.themedColor.textHighEmphasis }, t.CSAT_TITLE_SUBMITTED) : /* @__PURE__ */ r.createElement(w, { variant: "h2", color: p.themedColor.textHighEmphasis }, t.CSAT_TITLE_UNSUBMITTED);
|
|
2488
2494
|
};
|
|
2489
|
-
var
|
|
2495
|
+
var X = /* @__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.HELPDESK_CSAT_5 = "HELPDESK_CSAT_5", e))(X || {});
|
|
2490
2496
|
const Ta = (e) => Cr((t, n) => ({ ...t, ...n }), e), lt = ({
|
|
2491
2497
|
type: e,
|
|
2492
2498
|
renderSubmitButton: t,
|
|
@@ -2494,52 +2500,52 @@ const Ta = (e) => Cr((t, n) => ({ ...t, ...n }), e), lt = ({
|
|
|
2494
2500
|
initialCsatReason: o,
|
|
2495
2501
|
initialIsResolved: s
|
|
2496
2502
|
}) => {
|
|
2497
|
-
const [
|
|
2503
|
+
const [i, a] = Ta({
|
|
2498
2504
|
csatType: e,
|
|
2499
2505
|
csat: n,
|
|
2500
2506
|
csatReason: o,
|
|
2501
2507
|
isResolved: s
|
|
2502
|
-
}), l = typeof n == "number" ? "submitted" : (e ===
|
|
2503
|
-
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(wa, null, /* @__PURE__ */ r.createElement(Sa, { ...c }), e ===
|
|
2508
|
+
}), l = typeof n == "number" ? "submitted" : (e === X.AI_AGENT_CSAT_5 || e === X.HELPDESK_CSAT_5) && typeof i.csat == "number" || e === X.AI_AGENT_CSAT_5_WITH_CRE && typeof i.csat == "number" && typeof i.isResolved == "boolean" ? "submittable" : "unsubmittable", c = { state: l, submitted: l === "submitted" };
|
|
2509
|
+
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(wa, null, /* @__PURE__ */ r.createElement(Sa, { ...c }), e === X.AI_AGENT_CSAT_5_WITH_CRE && /* @__PURE__ */ r.createElement(
|
|
2504
2510
|
Xi,
|
|
2505
2511
|
{
|
|
2506
2512
|
...c,
|
|
2507
2513
|
defaultValue: s,
|
|
2508
|
-
value:
|
|
2509
|
-
onChange: (d) =>
|
|
2514
|
+
value: i.isResolved,
|
|
2515
|
+
onChange: (d) => a({ isResolved: d })
|
|
2510
2516
|
}
|
|
2511
|
-
), /* @__PURE__ */ r.createElement(ba, { ...c, value:
|
|
2517
|
+
), /* @__PURE__ */ r.createElement(ba, { ...c, value: i.csat, onChange: (d) => a({ csat: d }) }), i.csat && /* @__PURE__ */ r.createElement(
|
|
2512
2518
|
ya,
|
|
2513
2519
|
{
|
|
2514
2520
|
...c,
|
|
2515
|
-
value:
|
|
2516
|
-
onChange: (d) =>
|
|
2521
|
+
value: i.csatReason,
|
|
2522
|
+
onChange: (d) => a({ csatReason: d })
|
|
2517
2523
|
}
|
|
2518
|
-
)), l !== "submitted" && t({ state: l, params:
|
|
2524
|
+
)), l !== "submitted" && t({ state: l, params: i }));
|
|
2519
2525
|
}, wa = u.div`display:flex;flex-direction:column;gap:12px;`, Aa = () => {
|
|
2520
2526
|
const { stringSet: e } = O();
|
|
2521
2527
|
return /* @__PURE__ */ r.createElement(w, { variant: "body2", color: p.themedColor.textMidEmphasis, style: { textAlign: "center" } }, e.CSAT_SUBMISSION_EXPIRED);
|
|
2522
2528
|
}, ka = (e) => {
|
|
2523
2529
|
if (e.messageType !== "admin.csat")
|
|
2524
2530
|
throw new Error("Invalid message type");
|
|
2525
|
-
const t = Nr(), { stringSet: n } = O(), { extendedMessagePayload: o, csat: s, csatReason:
|
|
2526
|
-
if (!d || !
|
|
2527
|
-
const
|
|
2528
|
-
x.csat && !rn(
|
|
2531
|
+
const t = Nr(), { stringSet: n } = O(), { extendedMessagePayload: o, csat: s, csatReason: i, csatExpireAt: a, isResolvedWhenDeterminedByUser: l, onSubmitCSAT: c } = e, { visibility: d, type: h } = (o == null ? void 0 : o.csat) ?? {};
|
|
2532
|
+
if (!d || !h || !X[h]) return null;
|
|
2533
|
+
const m = h === X.AI_AGENT_CSAT_5 || h === X.AI_AGENT_CSAT_5_WITH_CRE || h === X.HELPDESK_CSAT_5 ? lt : () => null, f = (x) => {
|
|
2534
|
+
x.csat && !rn(a) ? c({
|
|
2529
2535
|
csatType: x.csatType,
|
|
2530
2536
|
csat: x.csat,
|
|
2531
2537
|
csatReason: x.csatReason,
|
|
2532
2538
|
isResolved: x.isResolved
|
|
2533
2539
|
}) : t();
|
|
2534
2540
|
};
|
|
2535
|
-
return /* @__PURE__ */ r.createElement(Ia, null, !s && rn(
|
|
2536
|
-
|
|
2541
|
+
return /* @__PURE__ */ r.createElement(Ia, null, !s && rn(a) ? /* @__PURE__ */ r.createElement(Aa, null) : /* @__PURE__ */ r.createElement(
|
|
2542
|
+
m,
|
|
2537
2543
|
{
|
|
2538
|
-
type:
|
|
2544
|
+
type: h,
|
|
2539
2545
|
initialCsat: s,
|
|
2540
|
-
initialCsatReason:
|
|
2546
|
+
initialCsatReason: i,
|
|
2541
2547
|
initialIsResolved: l,
|
|
2542
|
-
renderSubmitButton: ({ state: x, params:
|
|
2548
|
+
renderSubmitButton: ({ state: x, params: E }) => /* @__PURE__ */ r.createElement($a, { disabled: x !== "submittable", onClick: () => f(E) }, /* @__PURE__ */ r.createElement(w, { variant: "button" }, n.CSAT_SUBMIT_LABEL))
|
|
2543
2549
|
}
|
|
2544
2550
|
));
|
|
2545
2551
|
}, Ia = u.div`display:flex;flex-direction:column;background-color:${({ theme: e }) => e.colors.csat.background};border-radius:16px;gap:16px;padding:24px;`, $a = u.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:${p.color.primary.dark};}&:disabled{color:${p.color.ondark.textLowEmphasis};background-color:${p.themedColor.textDisabled};cursor:not-allowed;}`;
|
|
@@ -2557,7 +2563,7 @@ function Ma(e) {
|
|
|
2557
2563
|
const { components: t } = Lt.useContext(), n = Mt(() => e.messageType === "admin" ? /* @__PURE__ */ r.createElement(t.AdminMessage, { ...e }) : e.messageType === "admin.csat" ? /* @__PURE__ */ r.createElement(t.CSATMessage, { ...e }) : null);
|
|
2558
2564
|
return /* @__PURE__ */ r.createElement(Oa, { $marginBottom: Tt(e.groupType) }, n);
|
|
2559
2565
|
}
|
|
2560
|
-
const Oa = u.div`padding-inline:${
|
|
2566
|
+
const Oa = u.div`padding-inline:${te}px;margin-bottom:${({ $marginBottom: e }) => e}px;`, on = {
|
|
2561
2567
|
file: "attach",
|
|
2562
2568
|
snippet: "snippet",
|
|
2563
2569
|
site: "website",
|
|
@@ -2573,63 +2579,63 @@ const Oa = u.div`padding-inline:${ee}px;margin-bottom:${({ $marginBottom: e }) =
|
|
|
2573
2579
|
groundedness: n,
|
|
2574
2580
|
agentMessageTemplates: o,
|
|
2575
2581
|
onClickActionbook: s,
|
|
2576
|
-
onClickFunctionCall:
|
|
2577
|
-
onClickFunctionCallDetail:
|
|
2582
|
+
onClickFunctionCall: i,
|
|
2583
|
+
onClickFunctionCallDetail: a,
|
|
2578
2584
|
onClickGroundedness: l,
|
|
2579
2585
|
onClickAgentMessageTemplate: c,
|
|
2580
2586
|
bottomContent: d,
|
|
2581
|
-
renderCustomGroundednessIcon:
|
|
2582
|
-
style:
|
|
2587
|
+
renderCustomGroundednessIcon: h = (f) => f.default,
|
|
2588
|
+
style: m = {}
|
|
2583
2589
|
}) => {
|
|
2584
2590
|
const {
|
|
2585
2591
|
// Note: This component is used with the dashboard, so cssVars should not be used.
|
|
2586
2592
|
iconColor: f = "#000000",
|
|
2587
2593
|
textColor: x = "#000000",
|
|
2588
|
-
highlightColor:
|
|
2589
|
-
} =
|
|
2594
|
+
highlightColor: E = $n.DEFAULT_PRIMARY
|
|
2595
|
+
} = m;
|
|
2590
2596
|
return /* @__PURE__ */ r.createElement(sn, null, e && /* @__PURE__ */ r.createElement(sn, null, /* @__PURE__ */ r.createElement(qe, null, /* @__PURE__ */ r.createElement(ze, null, /* @__PURE__ */ r.createElement(M, { size: 16, type: "actionbook", color: f })), /* @__PURE__ */ r.createElement(
|
|
2591
2597
|
He,
|
|
2592
2598
|
{
|
|
2593
2599
|
$clickable: !!s,
|
|
2594
|
-
$highlightColor:
|
|
2600
|
+
$highlightColor: E,
|
|
2595
2601
|
variant: "body2",
|
|
2596
2602
|
color: x,
|
|
2597
2603
|
onClick: () => s == null ? void 0 : s(e)
|
|
2598
2604
|
},
|
|
2599
2605
|
e.name
|
|
2600
|
-
))), t == null ? void 0 : t.map((
|
|
2606
|
+
))), t == null ? void 0 : t.map((b) => /* @__PURE__ */ r.createElement(ct, { key: b.key }, /* @__PURE__ */ r.createElement(ze, null, /* @__PURE__ */ r.createElement(M, { size: 16, type: "function", color: f })), /* @__PURE__ */ r.createElement(qe, null, /* @__PURE__ */ r.createElement(
|
|
2601
2607
|
He,
|
|
2602
2608
|
{
|
|
2603
|
-
$clickable: !!
|
|
2604
|
-
$highlightColor:
|
|
2609
|
+
$clickable: !!i,
|
|
2610
|
+
$highlightColor: E,
|
|
2605
2611
|
variant: "body2",
|
|
2606
2612
|
color: x,
|
|
2607
|
-
onClick: () =>
|
|
2613
|
+
onClick: () => i == null ? void 0 : i(b)
|
|
2608
2614
|
},
|
|
2609
|
-
|
|
2610
|
-
),
|
|
2611
|
-
default: /* @__PURE__ */ r.createElement(M, { size: 16, type: on[
|
|
2612
|
-
sourceType:
|
|
2615
|
+
b.name
|
|
2616
|
+
), a && /* @__PURE__ */ r.createElement(Da, { role: "button", onClick: () => a == null ? void 0 : a(b) }, /* @__PURE__ */ r.createElement(w, { variant: "body2", color: E }, "View details"), /* @__PURE__ */ r.createElement(M, { type: "chevron-right", size: 16, color: E }))))), n == null ? void 0 : n.map((b) => /* @__PURE__ */ r.createElement(ct, { key: b.id }, /* @__PURE__ */ r.createElement(ze, null, h({
|
|
2617
|
+
default: /* @__PURE__ */ r.createElement(M, { size: 16, type: on[b.source_type] ?? on.snippet, color: f }),
|
|
2618
|
+
sourceType: b.source_type
|
|
2613
2619
|
})), /* @__PURE__ */ r.createElement(
|
|
2614
2620
|
He,
|
|
2615
2621
|
{
|
|
2616
2622
|
$clickable: !!l,
|
|
2617
|
-
$highlightColor:
|
|
2623
|
+
$highlightColor: E,
|
|
2618
2624
|
variant: "body2",
|
|
2619
2625
|
color: x,
|
|
2620
|
-
onClick: () => l == null ? void 0 : l(
|
|
2626
|
+
onClick: () => l == null ? void 0 : l(b)
|
|
2621
2627
|
},
|
|
2622
|
-
|
|
2623
|
-
))), o == null ? void 0 : o.map((
|
|
2628
|
+
b.preview_title
|
|
2629
|
+
))), o == null ? void 0 : o.map((b) => /* @__PURE__ */ r.createElement(ct, { key: b.key }, /* @__PURE__ */ r.createElement(ze, null, /* @__PURE__ */ r.createElement(M, { size: 16, type: "template", color: f })), /* @__PURE__ */ r.createElement(
|
|
2624
2630
|
He,
|
|
2625
2631
|
{
|
|
2626
2632
|
$clickable: !!c,
|
|
2627
|
-
$highlightColor:
|
|
2633
|
+
$highlightColor: E,
|
|
2628
2634
|
variant: "body2",
|
|
2629
2635
|
color: x,
|
|
2630
|
-
onClick: () => c == null ? void 0 : c(
|
|
2636
|
+
onClick: () => c == null ? void 0 : c(b)
|
|
2631
2637
|
},
|
|
2632
|
-
|
|
2638
|
+
b.name
|
|
2633
2639
|
))), d);
|
|
2634
2640
|
}, Ra = u(w)`font-weight:400;`, He = u(Ra)`${({ $clickable: e, $highlightColor: t }) => e && I`
|
|
2635
2641
|
cursor: pointer;
|
|
@@ -2650,21 +2656,21 @@ function Na({ testerType: e, children: t }) {
|
|
|
2650
2656
|
);
|
|
2651
2657
|
}
|
|
2652
2658
|
const Re = () => {
|
|
2653
|
-
const e =
|
|
2659
|
+
const e = Q(Wn);
|
|
2654
2660
|
if (!e) throw new Error("_UNSAFE_INTERNAL_DashboardTesterProvider not found");
|
|
2655
2661
|
return e;
|
|
2656
2662
|
}, Pa = () => {
|
|
2657
2663
|
const { isActionbookTester: e } = Re();
|
|
2658
2664
|
return /* @__PURE__ */ r.createElement(xe.Template, { template: e ? Ba : void 0 }, /* @__PURE__ */ r.createElement(xe.MessageLogs, { component: Fa }));
|
|
2659
2665
|
}, Ba = (e) => /* @__PURE__ */ r.createElement(Un, { ...e, testerMode: !0, maxBodyWidth: Ln }), Fa = ({ extendedMessagePayload: e = {} }) => {
|
|
2660
|
-
const { handlers: t } = B(), { manual: n, groundedness: o, function_calls: s, agent_message_templates:
|
|
2661
|
-
return
|
|
2666
|
+
const { handlers: t } = B(), { manual: n, groundedness: o, function_calls: s, agent_message_templates: i, is_thinking: a } = e;
|
|
2667
|
+
return a || !n && !(o != null && o.length) && !(s != null && s.length) && !(i != null && i.length) ? /* @__PURE__ */ r.createElement(r.Fragment, null) : /* @__PURE__ */ r.createElement(Ua, null, /* @__PURE__ */ r.createElement(Ha, { width: 4 }), /* @__PURE__ */ r.createElement(
|
|
2662
2668
|
La,
|
|
2663
2669
|
{
|
|
2664
2670
|
actionbook: n,
|
|
2665
2671
|
functionCalls: s,
|
|
2666
2672
|
groundedness: o,
|
|
2667
|
-
agentMessageTemplates:
|
|
2673
|
+
agentMessageTemplates: i,
|
|
2668
2674
|
onClickFunctionCallDetail: t == null ? void 0 : t.onFunctionCallDetailClick,
|
|
2669
2675
|
style: {
|
|
2670
2676
|
iconColor: p.themedColor.textHighEmphasis,
|
|
@@ -2674,7 +2680,7 @@ const Re = () => {
|
|
|
2674
2680
|
bottomContent: /* @__PURE__ */ r.createElement(za, { variant: "caption2", color: p.themedColor.textLowEmphasis }, "Only visible in the tester")
|
|
2675
2681
|
}
|
|
2676
2682
|
));
|
|
2677
|
-
}, Ua = u.div`display:flex;gap:16px;margin:16px ${
|
|
2683
|
+
}, Ua = u.div`display:flex;gap:16px;margin:16px ${te}px 0;align-self:stretch;`, Ha = u.div`width:${({ width: e }) => e}px;background-color:${p.themedColor.textDisabled};border-radius:100px;flex-shrink:0;`, za = u(w)`margin-top:5px;`;
|
|
2678
2684
|
function Va(e) {
|
|
2679
2685
|
return "sendingStatus" in e ? e.sendingStatus === "succeeded" ? String(e.messageId) : e.reqId : String(e.messageId);
|
|
2680
2686
|
}
|
|
@@ -2685,12 +2691,12 @@ const Wa = (e, t, n, o = !0) => {
|
|
|
2685
2691
|
if (!t || !t.isUserMessage() && !t.isFileMessage()) return !1;
|
|
2686
2692
|
const c = t.sender.userId === e.sender.userId, d = zt(t.createdAt, e.createdAt);
|
|
2687
2693
|
return c && d;
|
|
2688
|
-
},
|
|
2694
|
+
}, i = () => {
|
|
2689
2695
|
if (!n || !n.isUserMessage() && !n.isFileMessage()) return !1;
|
|
2690
2696
|
const c = n.sender.userId === e.sender.userId, d = zt(n.createdAt, e.createdAt);
|
|
2691
2697
|
return c && d;
|
|
2692
|
-
},
|
|
2693
|
-
return
|
|
2698
|
+
}, a = s(), l = i();
|
|
2699
|
+
return a && l ? "middle" : a ? "bottom" : l ? "top" : "single";
|
|
2694
2700
|
};
|
|
2695
2701
|
function Ga(e, t) {
|
|
2696
2702
|
return e.filter((n) => Se.isWelcomeMessage(n, t));
|
|
@@ -2715,13 +2721,13 @@ const bt = (e) => !!e && "sender" in e, jn = (e) => e.startsWith("image/"), Kn =
|
|
|
2715
2721
|
isIncoming: (e, t) => bt(e) && e.sender.userId !== t,
|
|
2716
2722
|
isOutgoing: (e, t) => bt(e) && (e.sender.userId === t || e.sendingStatus === dt.PENDING)
|
|
2717
2723
|
}, Za = (e) => {
|
|
2718
|
-
const { chatSDK: t, handlers: n } = B(), { aiAgentInfo: o } = U(), s = N(/* @__PURE__ */ new Set()),
|
|
2724
|
+
const { chatSDK: t, handlers: n } = B(), { aiAgentInfo: o } = U(), s = N(/* @__PURE__ */ new Set()), i = (a, l) => {
|
|
2719
2725
|
var c;
|
|
2720
|
-
|
|
2726
|
+
a.url === e && bt(l) && l.sender.userId === o.userId && !Se.isStreaming(l) && !s.current.has(l.messageId) && ((c = n == null ? void 0 : n.onCustomEvent) == null || c.call(n, { type: "bot-message-received", data: { message: l } }), s.current.add(l.messageId));
|
|
2721
2727
|
};
|
|
2722
2728
|
Xe(t, {
|
|
2723
|
-
onMessageUpdated:
|
|
2724
|
-
onMessageReceived:
|
|
2729
|
+
onMessageUpdated: i,
|
|
2730
|
+
onMessageReceived: i
|
|
2725
2731
|
});
|
|
2726
2732
|
}, Ya = ({ publishSynchronous: e = !1 }) => {
|
|
2727
2733
|
const t = /* @__PURE__ */ new Set();
|
|
@@ -2735,23 +2741,23 @@ const bt = (e) => !!e && "sender" in e, jn = (e) => e.startsWith("image/"), Kn =
|
|
|
2735
2741
|
};
|
|
2736
2742
|
};
|
|
2737
2743
|
function qa(e, t = []) {
|
|
2738
|
-
const n = N(null), o = N(0), s = N(0), [
|
|
2744
|
+
const n = N(null), o = N(0), s = N(0), [i] = _(() => Ya({ publishSynchronous: !0 })), [a, l] = _(!0);
|
|
2739
2745
|
return le(() => {
|
|
2740
2746
|
o.current = 0, s.current = 0, l(!0), n.current && (n.current.scrollTop = n.current.scrollHeight);
|
|
2741
|
-
}, t), le(() =>
|
|
2742
|
-
const { resolve:
|
|
2743
|
-
if (!n.current) return
|
|
2747
|
+
}, t), le(() => i.subscribe(({ type: c, data: d }) => {
|
|
2748
|
+
const { resolve: h, animated: m } = d ?? {};
|
|
2749
|
+
if (!n.current) return h == null ? void 0 : h();
|
|
2744
2750
|
if (c === "scrollToBottom" && (n.current.scroll ? n.current.scroll({
|
|
2745
2751
|
top: n.current.scrollHeight,
|
|
2746
|
-
behavior: ln(e,
|
|
2747
|
-
}) : n.current.scrollTop = n.current.scrollHeight, s.current = 0, l(!0),
|
|
2748
|
-
const f = d == null ? void 0 : d.top, { scrollTop: x, scrollHeight:
|
|
2749
|
-
n.current.scroll ? n.current.scroll({ top: f, behavior: ln(e,
|
|
2752
|
+
behavior: ln(e, m)
|
|
2753
|
+
}) : n.current.scrollTop = n.current.scrollHeight, s.current = 0, l(!0), h == null || h()), c === "scroll") {
|
|
2754
|
+
const f = d == null ? void 0 : d.top, { scrollTop: x, scrollHeight: E, clientHeight: b } = n.current;
|
|
2755
|
+
n.current.scroll ? n.current.scroll({ top: f, behavior: ln(e, m) }) : typeof f == "number" && (n.current.scrollTop = f), s.current = Math.max(0, E - x - b), l(s.current === 0), h == null || h();
|
|
2750
2756
|
}
|
|
2751
2757
|
}), [e]), {
|
|
2752
2758
|
scrollRef: n,
|
|
2753
|
-
scrollPubSub:
|
|
2754
|
-
isScrollBottomReached:
|
|
2759
|
+
scrollPubSub: i,
|
|
2760
|
+
isScrollBottomReached: a,
|
|
2755
2761
|
setIsScrollBottomReached: l,
|
|
2756
2762
|
scrollDistanceFromBottomRef: s,
|
|
2757
2763
|
scrollPositionRef: o
|
|
@@ -2782,15 +2788,15 @@ const Zn = "KEY_IMG_ASPECT_RATIO", Qa = ({ onScrollAfterSendMessage: e }) => {
|
|
|
2782
2788
|
const { agentPreviewConfigs: t, handlers: n } = B(), o = N(t == null ? void 0 : t.agentAttributes);
|
|
2783
2789
|
return o.current = t == null ? void 0 : t.agentAttributes, {
|
|
2784
2790
|
onBeforeSendMessage: async (s) => {
|
|
2785
|
-
const
|
|
2791
|
+
const i = await Xa(s), a = {
|
|
2786
2792
|
...s,
|
|
2787
|
-
metaArrays:
|
|
2793
|
+
metaArrays: i ? [i] : void 0
|
|
2788
2794
|
}, l = el(o.current);
|
|
2789
|
-
return l ? { ...
|
|
2795
|
+
return l ? { ...a, data: JSON.stringify(l) } : a;
|
|
2790
2796
|
},
|
|
2791
2797
|
onAfterSendMessage: (s) => {
|
|
2792
|
-
var
|
|
2793
|
-
e(), (
|
|
2798
|
+
var i, a, l;
|
|
2799
|
+
e(), (i = n == null ? void 0 : n.onMessageSend) == null || i.call(n, s.message), s.sendingStatus === dt.SUCCEEDED ? (a = n == null ? void 0 : n.onCustomEvent) == null || a.call(n, { type: "message-sent-succeeded", data: { message: s } }) : s.sendingStatus === dt.PENDING && ((l = n == null ? void 0 : n.onCustomEvent) == null || l.call(n, { type: "message-sent-pending", data: { message: s } }));
|
|
2794
2800
|
}
|
|
2795
2801
|
};
|
|
2796
2802
|
}, el = (e) => {
|
|
@@ -2807,33 +2813,33 @@ const Zn = "KEY_IMG_ASPECT_RATIO", Qa = ({ onScrollAfterSendMessage: e }) => {
|
|
|
2807
2813
|
onNavigateToConversationList: n,
|
|
2808
2814
|
children: o
|
|
2809
2815
|
}) => {
|
|
2810
|
-
const { aiAgentInfo: s, activeChannel:
|
|
2816
|
+
const { aiAgentInfo: s, activeChannel: i, refreshActiveChannel: a } = U(), { testerType: l } = Re(), c = qa("smooth"), { onBeforeSendMessage: d, onAfterSendMessage: h } = Qa({
|
|
2811
2817
|
onScrollAfterSendMessage: () => {
|
|
2812
2818
|
c.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !1 } });
|
|
2813
2819
|
}
|
|
2814
|
-
}),
|
|
2815
|
-
Za(
|
|
2816
|
-
const f = (
|
|
2817
|
-
const
|
|
2818
|
-
|
|
2820
|
+
}), m = e || (i == null ? void 0 : i.url);
|
|
2821
|
+
Za(m);
|
|
2822
|
+
const f = (E) => {
|
|
2823
|
+
const b = E[E.length - 1];
|
|
2824
|
+
b && Se.shouldScrollToBottom(b, s.userId, !!l) && setTimeout(() => c.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !0 } }), 100);
|
|
2819
2825
|
}, x = R(async () => {
|
|
2820
|
-
await
|
|
2821
|
-
}, [
|
|
2826
|
+
await a(), e && (t == null || t());
|
|
2827
|
+
}, [a, e, t]);
|
|
2822
2828
|
return /* @__PURE__ */ r.createElement(
|
|
2823
2829
|
io,
|
|
2824
2830
|
{
|
|
2825
|
-
channelUrl:
|
|
2831
|
+
channelUrl: m,
|
|
2826
2832
|
onBeforeSendMessage: d,
|
|
2827
|
-
onAfterSendMessage:
|
|
2833
|
+
onAfterSendMessage: h,
|
|
2828
2834
|
onMessagesUpdated: f,
|
|
2829
2835
|
onMessagesReceived: f,
|
|
2830
2836
|
onChannelDeleted: x,
|
|
2831
2837
|
onConversationClosedViaDispatcher: x
|
|
2832
2838
|
},
|
|
2833
|
-
(
|
|
2839
|
+
(E) => /* @__PURE__ */ r.createElement(
|
|
2834
2840
|
tl,
|
|
2835
2841
|
{
|
|
2836
|
-
value: { ...
|
|
2842
|
+
value: { ...E, scrollSource: c, goToActiveConversation: x, onNavigateToConversationList: n }
|
|
2837
2843
|
},
|
|
2838
2844
|
o
|
|
2839
2845
|
)
|
|
@@ -2851,7 +2857,7 @@ const Zn = "KEY_IMG_ASPECT_RATIO", Qa = ({ onScrollAfterSendMessage: e }) => {
|
|
|
2851
2857
|
var o;
|
|
2852
2858
|
if (n.preventDefault(), (o = n.dataTransfer) != null && o.files) {
|
|
2853
2859
|
const s = Array.from(n.dataTransfer.files);
|
|
2854
|
-
s.length > 0 && t.current.forEach((
|
|
2860
|
+
s.length > 0 && t.current.forEach((i) => i(s));
|
|
2855
2861
|
}
|
|
2856
2862
|
},
|
|
2857
2863
|
subscribe: (n) => (t.current.add(n), () => t.current.delete(n))
|
|
@@ -2860,27 +2866,27 @@ const Zn = "KEY_IMG_ASPECT_RATIO", Qa = ({ onScrollAfterSendMessage: e }) => {
|
|
|
2860
2866
|
e
|
|
2861
2867
|
);
|
|
2862
2868
|
}, rl = ({ onDropFiles: e }) => {
|
|
2863
|
-
const { subscribe: t } =
|
|
2869
|
+
const { subscribe: t } = Q(Rt);
|
|
2864
2870
|
L(() => t(e), [e]);
|
|
2865
2871
|
};
|
|
2866
2872
|
Et.Consumer = ({ children: e }) => {
|
|
2867
|
-
const { onDrop: t } =
|
|
2873
|
+
const { onDrop: t } = Q(Rt);
|
|
2868
2874
|
return e({ onDrop: t, onDragOver: (s) => s.preventDefault() });
|
|
2869
2875
|
};
|
|
2870
2876
|
const su = ({ iconSize: e = 64, icon: t, className: n, label: o, children: s }) => /* @__PURE__ */ r.createElement(sl, { className: n }, /* @__PURE__ */ r.createElement(M, { type: t, size: e, color: p.themedColor.textLowEmphasis }), /* @__PURE__ */ r.createElement(w, { variant: "body1", color: p.themedColor.textMidEmphasis }, o), s), ol = u.div`position:relative;display:flex;justify-content:center;align-items:center;width:100%;height:100%;`, sl = u.div`display:flex;flex-direction:column;min-height:104px;align-items:center;gap:20px;text-align:center;`, il = {
|
|
2871
|
-
loading: T(() => import("./
|
|
2872
|
-
error: T(() => import("./
|
|
2873
|
-
noChannels: T(() => import("./
|
|
2874
|
-
noMessages: T(() => import("./
|
|
2877
|
+
loading: T(() => import("./CKTGU2qP.js")),
|
|
2878
|
+
error: T(() => import("./CV59hwzK.js")),
|
|
2879
|
+
noChannels: T(() => import("./DOAkPSN5.js")),
|
|
2880
|
+
noMessages: T(() => import("./BuMtQ0m7.js"))
|
|
2875
2881
|
}, Ce = ({ className: e, type: t = "loading", ...n }) => {
|
|
2876
2882
|
const o = il[t];
|
|
2877
2883
|
return /* @__PURE__ */ r.createElement(ol, { className: e }, /* @__PURE__ */ r.createElement(ke, { fallback: null }, /* @__PURE__ */ r.createElement(o, { ...n })));
|
|
2878
2884
|
}, Yn = ({ rootElementId: e, visible: t, onClose: n, children: o }) => {
|
|
2879
2885
|
if (!t) return null;
|
|
2880
|
-
const { rootElement: s } = B(),
|
|
2886
|
+
const { rootElement: s } = B(), i = pe(s), a = pe(s, !0);
|
|
2881
2887
|
return Gr(
|
|
2882
2888
|
/* @__PURE__ */ r.createElement(al, { onClick: n }, /* @__PURE__ */ r.createElement(ll, { onClick: (l) => l.stopPropagation() }, o)),
|
|
2883
|
-
|
|
2889
|
+
i.getElementById(e) ?? i.getElementById(ee.MODAL_ROOT) ?? a.body
|
|
2884
2890
|
);
|
|
2885
2891
|
}, al = u.div`position:fixed;top:0;left:0;width:100%;height:100%;background:${p.color.overlay.dark};display:flex;justify-content:center;align-items:center;z-index:${fe.MODAL};`, ll = u.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:${fe.MODAL};`, cl = u.div`flex-shrink:0;width:${({ $size: e }) => j(e)};height:${({ $size: e }) => j(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;}`, dl = u(kt)`path{fill:${({ theme: e }) => e.colors.base.primaryContrastContent};}`;
|
|
2886
2892
|
function qn({ size: e }) {
|
|
@@ -2888,17 +2894,17 @@ function qn({ size: e }) {
|
|
|
2888
2894
|
return t.profileUrl ? /* @__PURE__ */ r.createElement(It, { size: e, src: t.profileUrl }) : /* @__PURE__ */ r.createElement(cl, { $size: e }, /* @__PURE__ */ r.createElement(dl, null));
|
|
2889
2895
|
}
|
|
2890
2896
|
const ul = u.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none;`, ml = u.div`height:64px;min-height:64px;box-sizing:border-box;display:flex;justify-content:space-between;border-bottom:1px solid ${p.themedColor.textDisabled};background-color:${p.themedColor.bg_50_600};@media screen and (max-width:768px){position:relative;}`, gl = u.div`box-sizing:border-box;display:flex;flex-direction:row;align-items:center;height:64px;padding:16px 20px;width:calc(100% - 128px);`, hl = u.div`margin-inline-end:8px;`, pl = u.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);}`, fl = u.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;}`, bl = u.div`display:flex;width:160px;justify-content:flex-end;`, El = u.div`inset-inline-end:0;display:flex;flex-direction:row;`, Jn = u.div`width:64px;padding:21px;box-sizing:border-box;cursor:${(e) => e.disabled ? "not-allowed" : "pointer"};`, xl = u(Jn)`border-inline-start:1px solid ${p.themedColor.textDisabled};`, Cl = u.div`width:100%;height:100%;display:flex;align-items:center;justify-content:center;`, vl = u.video`max-width:100%;max-height:100%;user-select:none;-webkit-user-drag:none;`, yl = u.img`max-width:calc(90% - 60px);max-height:calc(90% - 60px);user-select:none;-webkit-user-drag:none;`, _l = u.div`max-width:100%;max-height:100%;display:flex;justify-content:center;align-items:center;`, Sl = ({ file: e, sender: t = {}, onClose: n, onDownloadClick: o }) => {
|
|
2891
|
-
const { type: s, url:
|
|
2897
|
+
const { type: s, url: i, name: a = "" } = e, { profileUrl: l, nickname: c, userId: d } = t, { aiAgentInfo: h } = U();
|
|
2892
2898
|
return /* @__PURE__ */ r.createElement(
|
|
2893
2899
|
wl,
|
|
2894
2900
|
{
|
|
2895
2901
|
profileUrl: l ?? "",
|
|
2896
2902
|
nickname: c ?? "",
|
|
2897
2903
|
type: s,
|
|
2898
|
-
url:
|
|
2899
|
-
name:
|
|
2904
|
+
url: i,
|
|
2905
|
+
name: a,
|
|
2900
2906
|
onClose: n,
|
|
2901
|
-
isBotMessage: d ===
|
|
2907
|
+
isBotMessage: d === h.userId,
|
|
2902
2908
|
onDownloadClick: o
|
|
2903
2909
|
}
|
|
2904
2910
|
);
|
|
@@ -2908,47 +2914,47 @@ const ul = u.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
|
|
|
2908
2914
|
nickname: n,
|
|
2909
2915
|
name: o,
|
|
2910
2916
|
type: s,
|
|
2911
|
-
url:
|
|
2912
|
-
onClose:
|
|
2917
|
+
url: i,
|
|
2918
|
+
onClose: a,
|
|
2913
2919
|
onDownloadClick: l
|
|
2914
2920
|
}) => {
|
|
2915
2921
|
const { stringSet: c } = O();
|
|
2916
|
-
return /* @__PURE__ */ r.createElement(Yn, { onClose:
|
|
2922
|
+
return /* @__PURE__ */ r.createElement(Yn, { onClose: a, visible: !0, rootElementId: ee.MODAL_ROOT }, /* @__PURE__ */ r.createElement(ul, null, /* @__PURE__ */ r.createElement(ml, null, /* @__PURE__ */ r.createElement(gl, null, /* @__PURE__ */ r.createElement(hl, null, /* @__PURE__ */ r.createElement(Tl, { profileUrl: e, isBotMessage: t })), /* @__PURE__ */ r.createElement(pl, null, /* @__PURE__ */ r.createElement(w, { variant: "h2", color: p.themedColor.textHighEmphasis }, o)), /* @__PURE__ */ r.createElement(fl, null, /* @__PURE__ */ r.createElement(w, { variant: "body1", color: p.color.ondark.textMidEmphasis }, n))), /* @__PURE__ */ r.createElement(bl, null, an(s) && /* @__PURE__ */ r.createElement(El, null, /* @__PURE__ */ r.createElement(Jn, { as: "a", href: i, target: "_blank", rel: St, onClick: l }, /* @__PURE__ */ r.createElement(M, { type: "download", color: p.themedColor.textHighEmphasis, size: 24 }))), /* @__PURE__ */ r.createElement(xl, { onClick: a }, /* @__PURE__ */ r.createElement(M, { type: "close", color: p.themedColor.textHighEmphasis, size: 24 })))), /* @__PURE__ */ r.createElement(Cl, { onClick: (d) => d.currentTarget === d.target && a() }, Kn(s) && /* @__PURE__ */ r.createElement(vl, { controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: i, type: s })), jn(s) && /* @__PURE__ */ r.createElement(yl, { src: i, alt: o }), !an(s) && /* @__PURE__ */ r.createElement(_l, null, /* @__PURE__ */ r.createElement(w, { variant: "h1", color: p.themedColor.textHighEmphasis }, c.FILE_VIEWER__UNSUPPORT)))));
|
|
2917
2923
|
}, Xn = ({
|
|
2918
2924
|
className: e,
|
|
2919
2925
|
locale: t,
|
|
2920
2926
|
date: n = Date.now(),
|
|
2921
2927
|
formatString: o = "MMMM dd, yyyy",
|
|
2922
2928
|
style: s
|
|
2923
|
-
}) => /* @__PURE__ */ r.createElement(Al, { style: s, className: e }, /* @__PURE__ */ r.createElement(w, { variant: "caption4", color: p.themedColor.textMidEmphasis }, Cn(n, o, { locale: t }))), Al = u.div`display:flex;justify-content:center;align-items:center;`, kl = ye(function(t, n) {
|
|
2929
|
+
}) => /* @__PURE__ */ r.createElement(Al, { id: `${J}-date-separator`, style: s, className: e }, /* @__PURE__ */ r.createElement(w, { variant: "caption4", color: p.themedColor.textMidEmphasis }, Cn(n, o, { locale: t }))), Al = u.div`display:flex;justify-content:center;align-items:center;`, kl = ye(function(t, n) {
|
|
2924
2930
|
const {
|
|
2925
2931
|
messages: o,
|
|
2926
2932
|
renderMessage: s,
|
|
2927
|
-
messageTopArea:
|
|
2928
|
-
messageBottomArea:
|
|
2933
|
+
messageTopArea: i,
|
|
2934
|
+
messageBottomArea: a,
|
|
2929
2935
|
overlayArea: l,
|
|
2930
2936
|
onLoadPrev: c,
|
|
2931
2937
|
onLoadNext: d,
|
|
2932
|
-
loadThreshold:
|
|
2933
|
-
onScrollPosition:
|
|
2938
|
+
loadThreshold: h = 0.05,
|
|
2939
|
+
onScrollPosition: m = Ie,
|
|
2934
2940
|
depsForResetScrollPositionToBottom: f,
|
|
2935
2941
|
scrollPositionRef: x,
|
|
2936
|
-
scrollDistanceFromBottomRef:
|
|
2937
|
-
stackDirection:
|
|
2938
|
-
} = t,
|
|
2942
|
+
scrollDistanceFromBottomRef: E,
|
|
2943
|
+
stackDirection: b = "top"
|
|
2944
|
+
} = t, g = n && "current" in n ? n : { current: null }, C = N(!1), v = N(void 0), S = N(0), k = N(0), F = N(0), $ = x ?? k, V = E ?? F;
|
|
2939
2945
|
le(() => {
|
|
2940
|
-
|
|
2946
|
+
g.current && (g.current.scrollTop = g.current.scrollHeight);
|
|
2941
2947
|
}, f), le(() => {
|
|
2942
|
-
|
|
2943
|
-
}, [
|
|
2944
|
-
const
|
|
2945
|
-
if (!
|
|
2946
|
-
const y =
|
|
2947
|
-
if (
|
|
2948
|
-
const H = y.clientHeight * Math.min(Math.max(0,
|
|
2948
|
+
g.current && (v.current === "top" && (g.current.scrollTop = g.current.scrollHeight - $.current), v.current === "bottom" && (g.current.scrollTop = S.current), v.current = void 0);
|
|
2949
|
+
}, [g.current, o.length]);
|
|
2950
|
+
const re = async () => {
|
|
2951
|
+
if (!g.current) return;
|
|
2952
|
+
const y = g.current;
|
|
2953
|
+
if (m(Il(y)), $.current = y.scrollHeight - y.scrollTop, V.current = $.current - y.clientHeight, S.current = y.scrollTop, C.current) return;
|
|
2954
|
+
const H = y.clientHeight * Math.min(Math.max(0, h), 1);
|
|
2949
2955
|
y.scrollTop <= H ? (C.current = !0, v.current = "top", await c(), C.current = !1) : y.scrollHeight - y.scrollTop - y.clientHeight <= H ? (C.current = !0, v.current = "bottom", await d(), C.current = !1) : v.current = void 0;
|
|
2950
2956
|
};
|
|
2951
|
-
return /* @__PURE__ */ r.createElement($l, { id: "infinite-list-container" }, /* @__PURE__ */ r.createElement(Ml, { id: "infinite-list-inner", ref:
|
|
2957
|
+
return /* @__PURE__ */ r.createElement($l, { id: "infinite-list-container" }, /* @__PURE__ */ r.createElement(Ml, { id: "infinite-list-inner", ref: g, onScroll: re }, b === "bottom" && /* @__PURE__ */ r.createElement("div", { style: { flexGrow: 1 } }), i, o.map((y, H) => s({ message: y, index: H })), a), /* @__PURE__ */ r.createElement(Ol, { id: "infinite-list-overlay-container" }, /* @__PURE__ */ r.createElement(Ll, { id: "infinite-list-overlay" }, l)));
|
|
2952
2958
|
}), cn = 50;
|
|
2953
2959
|
function Il(e) {
|
|
2954
2960
|
return e.scrollTop <= cn ? "top" : e.scrollHeight - (e.scrollTop + e.clientHeight) <= cn ? "bottom" : "middle";
|
|
@@ -2979,15 +2985,15 @@ const $l = u.div`display:flex;position:relative;flex:1;overflow:hidden;`, Ml = u
|
|
|
2979
2985
|
const { chatSDK: e } = B(), { channelSource: t } = Z(), [n, o] = _([]);
|
|
2980
2986
|
return Xe(e, {
|
|
2981
2987
|
onTypingStatusUpdated(s) {
|
|
2982
|
-
var
|
|
2983
|
-
if (s.url === ((
|
|
2984
|
-
const
|
|
2985
|
-
o(
|
|
2988
|
+
var i;
|
|
2989
|
+
if (s.url === ((i = t.channel) == null ? void 0 : i.url)) {
|
|
2990
|
+
const a = s.getTypingUsers();
|
|
2991
|
+
o(a);
|
|
2986
2992
|
}
|
|
2987
2993
|
}
|
|
2988
2994
|
}), n;
|
|
2989
2995
|
}, Nl = () => {
|
|
2990
|
-
const { agentPreviewConfigs: e = {}, aiAgentId: t } = B(), { aiAgentInfo: n } = U(), { stringSet: o, dateLocale: s } = O(), { messageSource:
|
|
2996
|
+
const { agentPreviewConfigs: e = {}, aiAgentId: t } = B(), { aiAgentInfo: n } = U(), { stringSet: o, dateLocale: s } = O(), { messageSource: i } = Z(), { Template: a } = xe.useContext(), l = e.welcomeMessages ?? [], c = i.messages, d = Ga(c, t), h = c[d.length + 1], m = d[0] ?? h;
|
|
2991
2997
|
return {
|
|
2992
2998
|
/**
|
|
2993
2999
|
* Returns a list of messages filtered according to business requirements.
|
|
@@ -2996,7 +3002,7 @@ const $l = u.div`display:flex;position:relative;flex:1;overflow:hidden;`, Ml = u
|
|
|
2996
3002
|
/**
|
|
2997
3003
|
* Determines whether to display the DateSeparator in the data list by comparing it with the welcome messages from Bot Studio.
|
|
2998
3004
|
*/
|
|
2999
|
-
shouldShowOriginalDate: (f) => f > 0 || l.length === 0 ? !0 :
|
|
3005
|
+
shouldShowOriginalDate: (f) => f > 0 || l.length === 0 ? !0 : h && !Mr(h.createdAt, (m == null ? void 0 : m.createdAt) ?? 0),
|
|
3000
3006
|
/**
|
|
3001
3007
|
* Renders the list of welcome messages from Bot Studio.
|
|
3002
3008
|
*/
|
|
@@ -3004,26 +3010,26 @@ const $l = u.div`display:flex;position:relative;flex:1;overflow:hidden;`, Ml = u
|
|
|
3004
3010
|
Xn,
|
|
3005
3011
|
{
|
|
3006
3012
|
style: { margin: "16px 0" },
|
|
3007
|
-
date:
|
|
3013
|
+
date: m == null ? void 0 : m.createdAt,
|
|
3008
3014
|
locale: s,
|
|
3009
3015
|
formatString: o.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR
|
|
3010
3016
|
}
|
|
3011
3017
|
), l.map((f, x) => {
|
|
3012
|
-
const
|
|
3018
|
+
const E = x === l.length - 1, b = d.length !== c.length, g = l.length === 1 ? "single" : x === 0 ? "top" : E || b ? "bottom" : "middle";
|
|
3013
3019
|
return /* @__PURE__ */ r.createElement(
|
|
3014
|
-
|
|
3020
|
+
a,
|
|
3015
3021
|
{
|
|
3016
3022
|
messageType: "user",
|
|
3017
3023
|
message: f.message,
|
|
3018
3024
|
sender: n,
|
|
3019
|
-
groupType:
|
|
3020
|
-
createdAt: (
|
|
3025
|
+
groupType: g,
|
|
3026
|
+
createdAt: (m == null ? void 0 : m.createdAt) ?? Date.now(),
|
|
3021
3027
|
extendedMessagePayload: { suggested_replies: f.suggestedReplies },
|
|
3022
3028
|
suggestedRepliesDirection: e.suggestedRepliesDirection,
|
|
3023
|
-
suggestedRepliesVisible:
|
|
3029
|
+
suggestedRepliesVisible: E && !b,
|
|
3024
3030
|
isBotMessage: !0,
|
|
3025
3031
|
onClickSuggestedReply: async ({ reply: C }) => {
|
|
3026
|
-
|
|
3032
|
+
i.sendUserMessage({ message: C });
|
|
3027
3033
|
}
|
|
3028
3034
|
}
|
|
3029
3035
|
);
|
|
@@ -3055,7 +3061,7 @@ const Fl = ({ style: e }) => {
|
|
|
3055
3061
|
text-decoration: none;
|
|
3056
3062
|
`, zl = () => {
|
|
3057
3063
|
var c;
|
|
3058
|
-
const { stringSet: e } = O(), { activeChannel: t } = U(), { channelSource: n, goToActiveConversation: o, scrollSource: s } = Z(),
|
|
3064
|
+
const { stringSet: e } = O(), { activeChannel: t } = U(), { channelSource: n, goToActiveConversation: o, scrollSource: s } = Z(), i = Pn(n.channel), l = t && ((c = n.channel) == null ? void 0 : c.url) === (t == null ? void 0 : t.url) && i;
|
|
3059
3065
|
return le(() => {
|
|
3060
3066
|
l && s.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !0 } });
|
|
3061
3067
|
}, [l]), l ? /* @__PURE__ */ r.createElement(Vl, null, /* @__PURE__ */ r.createElement(
|
|
@@ -3069,37 +3075,37 @@ const Fl = ({ style: e }) => {
|
|
|
3069
3075
|
e.START_NEW_CONVERSATION
|
|
3070
3076
|
)) : null;
|
|
3071
3077
|
}, Vl = u.div`display:flex;justify-content:center;margin:16px 0;`, Wl = u(w)`border-radius:6px;box-sizing:border-box;padding:10px 20px;border:1px solid ${p.themedColor.textDisabled};cursor:pointer;user-select:none;`, Gl = !0, jl = () => {
|
|
3072
|
-
const { Template: e } = Ot.useContext(), { Template: t } = xe.useContext(), { Template: n } = Lt.useContext(), [o, s] = _(null), { userSession:
|
|
3078
|
+
const { Template: e } = Ot.useContext(), { Template: t } = xe.useContext(), { Template: n } = Lt.useContext(), [o, s] = _(null), { userSession: i, aiAgentInfo: a } = U(), { cache: l, agentPreviewConfigs: c, chatSDK: d, state: h } = B(), { stringSet: m, dateLocale: f } = O(), { conversation: x, channelSource: E, messageSource: b, scrollSource: g } = Z(), { isActionbookTester: C } = Re(), { filteredMessages: v, shouldShowOriginalDate: S, renderAgentPreviewWelcomeMessages: k } = Nl(), F = Qn(), $ = Mt(() => {
|
|
3073
3079
|
const y = F[0];
|
|
3074
3080
|
if (!y) return null;
|
|
3075
|
-
const H = y.userId ===
|
|
3076
|
-
return { user: H ?
|
|
3081
|
+
const H = y.userId === a.userId;
|
|
3082
|
+
return { user: H ? a : y, isBot: H };
|
|
3077
3083
|
});
|
|
3078
3084
|
L(() => {
|
|
3079
|
-
$ &&
|
|
3080
|
-
}, [!!$,
|
|
3085
|
+
$ && g.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !0 } });
|
|
3086
|
+
}, [!!$, g.scrollPubSub.publish]);
|
|
3081
3087
|
const V = (y, H = !1) => {
|
|
3082
|
-
var
|
|
3083
|
-
return H ?
|
|
3084
|
-
},
|
|
3085
|
-
if (!
|
|
3088
|
+
var oe;
|
|
3089
|
+
return H ? a : ((oe = E.channel) == null ? void 0 : oe.members.find((Y) => Y.userId === y.sender.userId)) ?? y.sender;
|
|
3090
|
+
}, re = () => {
|
|
3091
|
+
if (!b.initialized)
|
|
3086
3092
|
return /* @__PURE__ */ r.createElement(Ce, { type: "loading" });
|
|
3087
|
-
if (
|
|
3093
|
+
if (b.messages.length === 0) {
|
|
3088
3094
|
const y = k();
|
|
3089
|
-
return y ? /* @__PURE__ */ r.createElement("div", { style: { width: "100%" } }, y) : /* @__PURE__ */ r.createElement(Ce, { type: "noMessages", label:
|
|
3095
|
+
return y ? /* @__PURE__ */ r.createElement("div", { style: { width: "100%" } }, y) : /* @__PURE__ */ r.createElement(Ce, { type: "noMessages", label: m.PLACE_HOLDER__NO_MESSAGES });
|
|
3090
3096
|
}
|
|
3091
3097
|
return /* @__PURE__ */ r.createElement(
|
|
3092
3098
|
kl,
|
|
3093
3099
|
{
|
|
3094
|
-
ref:
|
|
3095
|
-
scrollPositionRef:
|
|
3096
|
-
scrollDistanceFromBottomRef:
|
|
3097
|
-
onScrollPosition: (y) =>
|
|
3100
|
+
ref: g.scrollRef,
|
|
3101
|
+
scrollPositionRef: g.scrollPositionRef,
|
|
3102
|
+
scrollDistanceFromBottomRef: g.scrollDistanceFromBottomRef,
|
|
3103
|
+
onScrollPosition: (y) => g.setIsScrollBottomReached(y === "bottom"),
|
|
3098
3104
|
stackDirection: c == null ? void 0 : c.messageStackDirection,
|
|
3099
3105
|
messages: v,
|
|
3100
|
-
onLoadPrev:
|
|
3101
|
-
onLoadNext:
|
|
3102
|
-
depsForResetScrollPositionToBottom: [
|
|
3106
|
+
onLoadPrev: b.loadPrevious,
|
|
3107
|
+
onLoadNext: b.loadNext,
|
|
3108
|
+
depsForResetScrollPositionToBottom: [b.initialized, b.messages.length !== 0],
|
|
3103
3109
|
messageTopArea: /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(Fl, { style: { marginTop: 16 } }), k()),
|
|
3104
3110
|
messageBottomArea: /* @__PURE__ */ r.createElement(r.Fragment, null, $ && /* @__PURE__ */ r.createElement(
|
|
3105
3111
|
t,
|
|
@@ -3112,10 +3118,10 @@ const Fl = ({ style: e }) => {
|
|
|
3112
3118
|
message: ""
|
|
3113
3119
|
}
|
|
3114
3120
|
), /* @__PURE__ */ r.createElement(zl, null)),
|
|
3115
|
-
overlayArea: /* @__PURE__ */ r.createElement(r.Fragment, null, !
|
|
3121
|
+
overlayArea: /* @__PURE__ */ r.createElement(r.Fragment, null, !g.isScrollBottomReached && /* @__PURE__ */ r.createElement(Zl, { onClick: () => g.scrollPubSub.publish({ type: "scrollToBottom" }) })),
|
|
3116
3122
|
renderMessage: ({ message: y, index: H }) => {
|
|
3117
|
-
const
|
|
3118
|
-
(y.isFileMessage() || y.isUserMessage()) && s({ file: Pe, sender: V(y, y.sender.userId ===
|
|
3123
|
+
const oe = Va(y), Y = v[H - 1], nt = v[H + 1], rt = v[v.length - 1], A = y === rt, D = Wa(y, Y, nt, Gl), K = !Wr((Y == null ? void 0 : Y.createdAt) ?? 0, y.createdAt) && S(H) && !C, q = (Pe) => {
|
|
3124
|
+
(y.isFileMessage() || y.isUserMessage()) && s({ file: Pe, sender: V(y, y.sender.userId === a.userId) });
|
|
3119
3125
|
}, be = () => {
|
|
3120
3126
|
y.isFileMessage() && $t(y.url);
|
|
3121
3127
|
}, fr = K ? /* @__PURE__ */ r.createElement(
|
|
@@ -3124,10 +3130,10 @@ const Fl = ({ style: e }) => {
|
|
|
3124
3130
|
style: { margin: "16px 0" },
|
|
3125
3131
|
date: y.createdAt,
|
|
3126
3132
|
locale: f,
|
|
3127
|
-
formatString:
|
|
3133
|
+
formatString: m.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR
|
|
3128
3134
|
}
|
|
3129
3135
|
) : null, Ne = {
|
|
3130
|
-
maxBodyWidth:
|
|
3136
|
+
maxBodyWidth: h.expanded ? Ln : void 0,
|
|
3131
3137
|
extendedMessagePayload: y.extendedMessagePayload,
|
|
3132
3138
|
createdAt: y.createdAt,
|
|
3133
3139
|
groupType: D,
|
|
@@ -3143,23 +3149,23 @@ const Fl = ({ style: e }) => {
|
|
|
3143
3149
|
...x,
|
|
3144
3150
|
isResolvedWhenDeterminedByUser: Yl(x),
|
|
3145
3151
|
messageType: "admin.csat",
|
|
3146
|
-
onSubmitCSAT: ({ csat:
|
|
3152
|
+
onSubmitCSAT: ({ csat: se, csatType: me, csatReason: z, isResolved: ie }) => {
|
|
3147
3153
|
var ge;
|
|
3148
|
-
|
|
3154
|
+
se && ((ge = E.channel) == null || ge.submitCSAT({ csat: se, csatType: me, csatReason: z, isResolved: ie }));
|
|
3149
3155
|
}
|
|
3150
3156
|
}
|
|
3151
3157
|
) : null : /* @__PURE__ */ r.createElement(n, { ...Ne, messageType: "admin", message: y.message });
|
|
3152
|
-
if (Ve.isOutgoing(y,
|
|
3153
|
-
const
|
|
3158
|
+
if (Ve.isOutgoing(y, i.userId)) {
|
|
3159
|
+
const se = {
|
|
3154
3160
|
...Ne,
|
|
3155
3161
|
message: y.message,
|
|
3156
3162
|
sender: V(y),
|
|
3157
3163
|
sendingStatus: y.sendingStatus
|
|
3158
3164
|
};
|
|
3159
3165
|
if (y.isUserMessage())
|
|
3160
|
-
return /* @__PURE__ */ r.createElement(e, { messageType: "user", ...
|
|
3166
|
+
return /* @__PURE__ */ r.createElement(e, { messageType: "user", ...se });
|
|
3161
3167
|
if (y.isFileMessage()) {
|
|
3162
|
-
const [me, z] = ((Pe = y.metaArrays.find((
|
|
3168
|
+
const [me, z] = ((Pe = y.metaArrays.find((ie) => ie.key === Zn)) == null ? void 0 : Pe.value) ?? [];
|
|
3163
3169
|
return /* @__PURE__ */ r.createElement(
|
|
3164
3170
|
e,
|
|
3165
3171
|
{
|
|
@@ -3169,32 +3175,32 @@ const Fl = ({ style: e }) => {
|
|
|
3169
3175
|
aspectRatio: me && z ? `${me}/${z}` : "1/1",
|
|
3170
3176
|
localFile: (Ft = y.messageParams) == null ? void 0 : Ft.file
|
|
3171
3177
|
},
|
|
3172
|
-
...
|
|
3178
|
+
...se
|
|
3173
3179
|
}
|
|
3174
3180
|
);
|
|
3175
3181
|
}
|
|
3176
3182
|
}
|
|
3177
|
-
if (Ve.isIncoming(y,
|
|
3178
|
-
const
|
|
3183
|
+
if (Ve.isIncoming(y, i.userId)) {
|
|
3184
|
+
const se = y.sender.userId === a.userId, me = {
|
|
3179
3185
|
...Ne,
|
|
3180
|
-
sender: V(y,
|
|
3186
|
+
sender: V(y, se),
|
|
3181
3187
|
message: y.message,
|
|
3182
3188
|
suggestedRepliesVisible: A,
|
|
3183
3189
|
suggestedRepliesDirection: c == null ? void 0 : c.suggestedRepliesDirection,
|
|
3184
|
-
isBotMessage:
|
|
3190
|
+
isBotMessage: se,
|
|
3185
3191
|
isStreaming: Se.isStreaming(y),
|
|
3186
3192
|
onClickSuggestedReply: async ({ reply: z }) => {
|
|
3187
|
-
|
|
3193
|
+
b.sendUserMessage({ message: z });
|
|
3188
3194
|
},
|
|
3189
3195
|
onRequestMessageTemplate: async (z) => {
|
|
3190
|
-
const { template:
|
|
3191
|
-
return l.template.set(z,
|
|
3196
|
+
const { template: ie } = await d.aiAgent.getMessageTemplate(z);
|
|
3197
|
+
return l.template.set(z, ie), ie;
|
|
3192
3198
|
},
|
|
3193
3199
|
onGetCachedMessageTemplate: (z) => l.template.get(z),
|
|
3194
3200
|
onHandleTemplateInternalAction: (z) => {
|
|
3195
3201
|
if (z.type === "internal" && z.internalData) {
|
|
3196
|
-
const { method:
|
|
3197
|
-
|
|
3202
|
+
const { method: ie, payload: ge } = z.internalData;
|
|
3203
|
+
ie === "message.send" && (ge != null && ge.message) && b.sendUserMessage({ message: ge.message });
|
|
3198
3204
|
}
|
|
3199
3205
|
}
|
|
3200
3206
|
};
|
|
@@ -3204,12 +3210,12 @@ const Fl = ({ style: e }) => {
|
|
|
3204
3210
|
return /* @__PURE__ */ r.createElement(t, { messageType: "file", file: y, ...me });
|
|
3205
3211
|
}
|
|
3206
3212
|
})();
|
|
3207
|
-
return /* @__PURE__ */ r.createElement("div", { key:
|
|
3213
|
+
return /* @__PURE__ */ r.createElement("div", { key: oe, id: `${J}-message-item` }, fr, br);
|
|
3208
3214
|
}
|
|
3209
3215
|
}
|
|
3210
3216
|
);
|
|
3211
3217
|
};
|
|
3212
|
-
return /* @__PURE__ */ r.createElement(Kl, { id: `${
|
|
3218
|
+
return /* @__PURE__ */ r.createElement(Kl, { id: `${J}-message-list` }, re(), o && /* @__PURE__ */ r.createElement(Sl, { onClose: () => s(null), sender: o.sender, file: o.file }));
|
|
3213
3219
|
}, Kl = u.div`overflow-y:hidden;display:flex;flex:1;position:relative;`, Zl = u(Rl)`position:absolute;bottom:20px;inset-inline-end:20px;`;
|
|
3214
3220
|
function Yl(e) {
|
|
3215
3221
|
var t;
|
|
@@ -3242,7 +3248,7 @@ const ql = () => {
|
|
|
3242
3248
|
background-color: ${p.color.background700};
|
|
3243
3249
|
`}
|
|
3244
3250
|
`, tr = ve(void 0), ec = ({ children: e }) => {
|
|
3245
|
-
const { stringSet: t } = O(), { attachmentMode: n } = U(), { channelSource: o } = Z(), [s,
|
|
3251
|
+
const { stringSet: t } = O(), { attachmentMode: n } = U(), { channelSource: o } = Z(), [s, i] = _([]), [a, l] = _({
|
|
3246
3252
|
visible: !1,
|
|
3247
3253
|
title: "",
|
|
3248
3254
|
buttonText: t.BUTTON__OK
|
|
@@ -3257,59 +3263,59 @@ const ql = () => {
|
|
|
3257
3263
|
default:
|
|
3258
3264
|
return c;
|
|
3259
3265
|
}
|
|
3260
|
-
}, [n, c]),
|
|
3266
|
+
}, [n, c]), h = (x) => {
|
|
3261
3267
|
if (!d) return;
|
|
3262
|
-
const
|
|
3263
|
-
if (
|
|
3264
|
-
if (
|
|
3265
|
-
l((
|
|
3266
|
-
...
|
|
3268
|
+
const E = x.filter((b) => On.includes(b.type));
|
|
3269
|
+
if (E.length !== 0) {
|
|
3270
|
+
if (E.some((b) => b.size > _s)) {
|
|
3271
|
+
l((b) => ({
|
|
3272
|
+
...b,
|
|
3267
3273
|
visible: !0,
|
|
3268
3274
|
title: t.FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT.replace("%d", "25")
|
|
3269
3275
|
}));
|
|
3270
3276
|
return;
|
|
3271
3277
|
}
|
|
3272
|
-
if (
|
|
3273
|
-
l((
|
|
3274
|
-
...
|
|
3278
|
+
if (E.length > 1 || E.length > 0 && s.length > 0) {
|
|
3279
|
+
l((b) => ({
|
|
3280
|
+
...b,
|
|
3275
3281
|
visible: !0,
|
|
3276
3282
|
title: t.FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT
|
|
3277
3283
|
}));
|
|
3278
3284
|
return;
|
|
3279
3285
|
}
|
|
3280
|
-
|
|
3281
|
-
...
|
|
3282
|
-
...
|
|
3283
|
-
file:
|
|
3284
|
-
preview: { url: URL.createObjectURL(
|
|
3286
|
+
i((b) => [
|
|
3287
|
+
...b,
|
|
3288
|
+
...E.map((g) => ({
|
|
3289
|
+
file: g,
|
|
3290
|
+
preview: { url: URL.createObjectURL(g), type: g.type, name: g.name }
|
|
3285
3291
|
}))
|
|
3286
3292
|
]);
|
|
3287
3293
|
}
|
|
3288
|
-
},
|
|
3289
|
-
|
|
3290
|
-
var
|
|
3291
|
-
const
|
|
3292
|
-
return
|
|
3294
|
+
}, m = (x) => {
|
|
3295
|
+
i((E) => {
|
|
3296
|
+
var g;
|
|
3297
|
+
const b = (g = E[x]) == null ? void 0 : g.preview;
|
|
3298
|
+
return b && URL.revokeObjectURL(b.url), E.filter((C, v) => v !== x);
|
|
3293
3299
|
});
|
|
3294
3300
|
}, f = () => {
|
|
3295
|
-
|
|
3301
|
+
i((x) => (x.forEach((E) => URL.revokeObjectURL(E.preview.url)), []));
|
|
3296
3302
|
};
|
|
3297
3303
|
return /* @__PURE__ */ r.createElement(
|
|
3298
3304
|
tr.Provider,
|
|
3299
3305
|
{
|
|
3300
3306
|
value: {
|
|
3301
3307
|
files: s,
|
|
3302
|
-
addFiles:
|
|
3303
|
-
removeFile:
|
|
3308
|
+
addFiles: h,
|
|
3309
|
+
removeFile: m,
|
|
3304
3310
|
clearFiles: f,
|
|
3305
3311
|
isFileUploadEnabled: d
|
|
3306
3312
|
}
|
|
3307
3313
|
},
|
|
3308
3314
|
e,
|
|
3309
|
-
/* @__PURE__ */ r.createElement(tc, { ...
|
|
3315
|
+
/* @__PURE__ */ r.createElement(tc, { ...a, onClose: () => l((x) => ({ ...x, visible: !1, title: "" })) })
|
|
3310
3316
|
);
|
|
3311
3317
|
}, Dt = () => {
|
|
3312
|
-
const e =
|
|
3318
|
+
const e = Q(tr);
|
|
3313
3319
|
if (!e)
|
|
3314
3320
|
throw new Error("useFileUpload must be used within FileUploadProvider");
|
|
3315
3321
|
return e;
|
|
@@ -3318,7 +3324,7 @@ const ql = () => {
|
|
|
3318
3324
|
buttonText: t,
|
|
3319
3325
|
visible: n,
|
|
3320
3326
|
onClose: o
|
|
3321
|
-
}) => /* @__PURE__ */ r.createElement(Yn, { rootElementId:
|
|
3327
|
+
}) => /* @__PURE__ */ r.createElement(Yn, { rootElementId: ee.WINDOW, visible: n, onClose: o }, /* @__PURE__ */ r.createElement(nc, null, /* @__PURE__ */ r.createElement(oc, null, /* @__PURE__ */ r.createElement(w, { variant: "h1", color: p.themedColor.textHighEmphasis }, e)), /* @__PURE__ */ r.createElement(rc, null, /* @__PURE__ */ r.createElement(sc, { onClick: o }, /* @__PURE__ */ r.createElement(w, { variant: "button", color: p.themedColor.textHighEmphasisInverse }, t))))), nc = u.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};`, rc = u.div`display:flex;flex-direction:row;justify-content:flex-end;`, oc = u.div`margin-bottom:16px;`, sc = u.button`display:flex;justify-content:center;align-items:center;border-radius:4px;cursor:pointer;background-color:${p.themedColor.error};border:1px solid ${p.themedColor.error};padding:10px 16px;&:hover{background-color:${p.color.error.dark};border-color:${p.color.error.dark};}&:active{background-color:${p.color.error.extraDark};}`;
|
|
3322
3328
|
function ic({ blurred: e, elementRef: t, document: n = window.document }) {
|
|
3323
3329
|
const o = N(!1);
|
|
3324
3330
|
e && t.current && n.activeElement === t.current && (o.current = !0), le(() => {
|
|
@@ -3350,14 +3356,14 @@ const ac = (e, t) => {
|
|
|
3350
3356
|
stroke: ${p.themedColor.bg_50_600};
|
|
3351
3357
|
}
|
|
3352
3358
|
`, uc = () => {
|
|
3353
|
-
const e = Oe(), [t, n] = _(), { files: o, removeFile: s, isFileUploadEnabled:
|
|
3354
|
-
return !
|
|
3359
|
+
const e = Oe(), [t, n] = _(), { files: o, removeFile: s, isFileUploadEnabled: i } = Dt();
|
|
3360
|
+
return !i || o.length === 0 ? null : /* @__PURE__ */ r.createElement(lc, null, o.map(({ preview: { type: a, name: l, url: c } }, d) => /* @__PURE__ */ r.createElement(cc, { key: c, onMouseOver: () => n(d), onMouseLeave: () => n(void 0) }, (e || t === d) && /* @__PURE__ */ r.createElement(dc, { title: "Remove file", onClick: () => s(d) }, /* @__PURE__ */ r.createElement(M, { type: "close-filled", color: p.themedColor.textMidEmphasis })), a.startsWith("image/") ? /* @__PURE__ */ r.createElement("img", { alt: "file-image", src: c }) : /* @__PURE__ */ r.createElement(At, { name: l, type: wt(l, a) }))));
|
|
3355
3361
|
}, mc = ({ channel: e, messages: t }) => {
|
|
3356
|
-
const { stringSet: n } = O(), { aiAgentInfo: o } = U(), s = gc(),
|
|
3362
|
+
const { stringSet: n } = O(), { aiAgentInfo: o } = U(), s = gc(), i = hc({
|
|
3357
3363
|
lastMessage: t[t.length - 1],
|
|
3358
3364
|
aiAgentUserId: o.userId
|
|
3359
3365
|
});
|
|
3360
|
-
return !e || !s || Pn(e) ? [!0, n.MESSAGE_INPUT__PLACE_HOLDER__DISABLED] :
|
|
3366
|
+
return !e || !s || Pn(e) ? [!0, n.MESSAGE_INPUT__PLACE_HOLDER__DISABLED] : i ? [!0, n.MESSAGE_INPUT__PLACE_HOLDER__WAIT_AI_AGENT_RESPONSE] : [!1, n.MESSAGE_INPUT__PLACE_HOLDER];
|
|
3361
3367
|
}, gc = () => {
|
|
3362
3368
|
const e = bn(), { chatSDK: t } = B(), [n, o] = _(!0);
|
|
3363
3369
|
return L(() => {
|
|
@@ -3377,21 +3383,21 @@ const ac = (e, t) => {
|
|
|
3377
3383
|
const [n, o] = _(!1), s = Qn();
|
|
3378
3384
|
return L(() => {
|
|
3379
3385
|
if (!e) return;
|
|
3380
|
-
const
|
|
3381
|
-
o(!!(
|
|
3386
|
+
const i = s.some((l) => l.userId === t), a = Gn(e, t) && Se.isStreaming(e);
|
|
3387
|
+
o(!!(a || i));
|
|
3382
3388
|
}, [s, e, t]), n;
|
|
3383
3389
|
}, nr = {
|
|
3384
3390
|
textArea: I`min-height:40px;height:40px;font-size:16px;line-height:24px;`,
|
|
3385
3391
|
attachIcon: I`margin-bottom:4px;`
|
|
3386
3392
|
}, rr = u.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:32px;height:32px;`, pc = u(rr)`flex-shrink:0;margin-inline-end:12px;margin-bottom:2px;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover{path{fill:${p.themedColor.textHighEmphasis};}}&:active{border-radius:4px;background-color:${p.themedColor.bg_200_400};}}${_t && nr.attachIcon};`, fc = u.input`display:none;`, dn = u.div`width:100%;position:relative;background-color:${p.themedColor.bg_100_500};border-radius:20px;`, un = u.div`display:flex;flex-direction:row;align-items:flex-end;position:relative;`, mn = u.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:${p.themedColor.textHighEmphasis};resize:none;width:100%;height:${Mn}px;overflow-wrap:break-word;white-space:pre-wrap;overflow-x:hidden;${_t && nr.textArea};&::placeholder{color:${p.themedColor.textLowEmphasis};}&:disabled{cursor:not-allowed;&::placeholder{color:${p.themedColor.textDisabled};}}`, gn = u.div`padding:12px 16px;position:relative;display:flex;align-items:center;`, hn = ({ disabled: e }) => {
|
|
3387
|
-
const t = N(null), { addFiles: n, clearFiles: o, files: s, isFileUploadEnabled:
|
|
3388
|
-
return !
|
|
3393
|
+
const t = N(null), { addFiles: n, clearFiles: o, files: s, isFileUploadEnabled: i } = Dt();
|
|
3394
|
+
return !i || s.length > 0 ? null : /* @__PURE__ */ r.createElement(
|
|
3389
3395
|
pc,
|
|
3390
3396
|
{
|
|
3391
3397
|
disabled: e,
|
|
3392
3398
|
onClick: () => {
|
|
3393
|
-
var
|
|
3394
|
-
o(), (
|
|
3399
|
+
var a;
|
|
3400
|
+
o(), (a = t.current) == null || a.click();
|
|
3395
3401
|
}
|
|
3396
3402
|
},
|
|
3397
3403
|
/* @__PURE__ */ r.createElement(
|
|
@@ -3407,37 +3413,37 @@ const ac = (e, t) => {
|
|
|
3407
3413
|
{
|
|
3408
3414
|
type: "file",
|
|
3409
3415
|
ref: t,
|
|
3410
|
-
onChange: (
|
|
3411
|
-
const l =
|
|
3412
|
-
l && n(Array.from(l)),
|
|
3416
|
+
onChange: (a) => {
|
|
3417
|
+
const l = a.currentTarget.files;
|
|
3418
|
+
l && n(Array.from(l)), a.target.value = "";
|
|
3413
3419
|
},
|
|
3414
3420
|
accept: On.join(",")
|
|
3415
3421
|
}
|
|
3416
3422
|
)
|
|
3417
3423
|
);
|
|
3418
3424
|
}, bc = () => {
|
|
3419
|
-
const e = N(null), [t, n] = _(""), { rootElement: o } = B(), { channelSource: s, messageSource:
|
|
3425
|
+
const e = N(null), [t, n] = _(""), { rootElement: o } = B(), { channelSource: s, messageSource: i } = Z(), [a, l] = mc({
|
|
3420
3426
|
channel: s.channel,
|
|
3421
|
-
messages:
|
|
3422
|
-
}), { files: c, addFiles: d, clearFiles:
|
|
3423
|
-
rl({ onDropFiles: d }), ic({ blurred:
|
|
3424
|
-
const
|
|
3425
|
-
e.current && (e.current.value = "", e.current.style.height = ""),
|
|
3426
|
-
},
|
|
3427
|
+
messages: i.messages
|
|
3428
|
+
}), { files: c, addFiles: d, clearFiles: h } = Dt();
|
|
3429
|
+
rl({ onDropFiles: d }), ic({ blurred: a, elementRef: e, document: pe(o) }), ac(s.channel, t);
|
|
3430
|
+
const m = t.trim().length > 0, f = c.length > 0, x = !a && (m || f), E = () => {
|
|
3431
|
+
e.current && (e.current.value = "", e.current.style.height = ""), h(), n("");
|
|
3432
|
+
}, b = async () => {
|
|
3427
3433
|
const S = t.trim(), k = { message: S };
|
|
3428
3434
|
if (!(!S && !c.length)) {
|
|
3429
3435
|
if (c.length > 0) {
|
|
3430
3436
|
const F = c[0].file, $ = { ...k, file: F };
|
|
3431
|
-
|
|
3437
|
+
i.sendFileMessage($), E();
|
|
3432
3438
|
return;
|
|
3433
3439
|
}
|
|
3434
|
-
|
|
3440
|
+
i.sendUserMessage(k), E();
|
|
3435
3441
|
}
|
|
3436
|
-
},
|
|
3442
|
+
}, g = (S) => {
|
|
3437
3443
|
const k = Array.from(S.clipboardData.files);
|
|
3438
3444
|
k.length > 0 && (S.preventDefault(), d(k));
|
|
3439
3445
|
}, C = (S) => {
|
|
3440
|
-
S.key !== "Enter" || S.nativeEvent.isComposing || S.shiftKey || (S.preventDefault(),
|
|
3446
|
+
S.key !== "Enter" || S.nativeEvent.isComposing || S.shiftKey || (S.preventDefault(), b());
|
|
3441
3447
|
}, v = (S) => {
|
|
3442
3448
|
if (e.current) {
|
|
3443
3449
|
e.current.style.height = "";
|
|
@@ -3446,7 +3452,7 @@ const ac = (e, t) => {
|
|
|
3446
3452
|
}
|
|
3447
3453
|
n(S.target.value);
|
|
3448
3454
|
};
|
|
3449
|
-
return
|
|
3455
|
+
return a ? /* @__PURE__ */ r.createElement(gn, null, /* @__PURE__ */ r.createElement(dn, null, /* @__PURE__ */ r.createElement(un, null, /* @__PURE__ */ r.createElement(mn, { disabled: !0, placeholder: l }), /* @__PURE__ */ r.createElement(hn, { disabled: !0 })))) : /* @__PURE__ */ r.createElement(gn, null, /* @__PURE__ */ r.createElement(dn, null, /* @__PURE__ */ r.createElement(uc, null), /* @__PURE__ */ r.createElement(un, null, /* @__PURE__ */ r.createElement(
|
|
3450
3456
|
mn,
|
|
3451
3457
|
{
|
|
3452
3458
|
ref: e,
|
|
@@ -3456,9 +3462,9 @@ const ac = (e, t) => {
|
|
|
3456
3462
|
maxLength: 5e3,
|
|
3457
3463
|
onKeyDown: C,
|
|
3458
3464
|
onChange: v,
|
|
3459
|
-
onPaste:
|
|
3465
|
+
onPaste: g
|
|
3460
3466
|
}
|
|
3461
|
-
), /* @__PURE__ */ r.createElement(hn, null))), x && /* @__PURE__ */ r.createElement(rr, { onClick: () =>
|
|
3467
|
+
), /* @__PURE__ */ r.createElement(hn, null))), x && /* @__PURE__ */ r.createElement(rr, { onClick: () => b() }, /* @__PURE__ */ r.createElement(M, { type: "send", color: p.color.primary.main, size: 20 })));
|
|
3462
3468
|
}, Ec = u.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:${p.themedColor.textLowEmphasis};&& a{font-weight:700;text-decoration:none;${P.light`
|
|
3463
3469
|
color: ${p.color.information.light};
|
|
3464
3470
|
`};
|
|
@@ -3466,41 +3472,41 @@ const ac = (e, t) => {
|
|
|
3466
3472
|
color: ${p.color.information.main};
|
|
3467
3473
|
`};
|
|
3468
3474
|
}
|
|
3469
|
-
`, xc = T(() => import("./
|
|
3475
|
+
`, xc = T(() => import("./CwdCJ7xG.js").then((e) => ({ default: e.MarkdownText }))), Cc = () => {
|
|
3470
3476
|
const { aiAgentInfo: e } = U(), { messageSource: t } = Z(), { userSession: n } = U();
|
|
3471
3477
|
return !e.specialNoticeEnabled || !e.specialNotice || !(t.initialized && !t.messages.some((s) => Gn(s, n.userId))) ? null : /* @__PURE__ */ r.createElement(Ec, null, /* @__PURE__ */ r.createElement(xc, null, e.specialNotice));
|
|
3472
3478
|
}, vc = () => /* @__PURE__ */ r.createElement(yc, null, /* @__PURE__ */ r.createElement(Cc, null), /* @__PURE__ */ r.createElement(ec, null, /* @__PURE__ */ r.createElement(bc, null))), yc = u.div`z-index:0;border:none;width:100%;`, _c = () => {
|
|
3473
|
-
var
|
|
3474
|
-
const { activeChannel: e } = U(), { channelSource: t } = Z(), n = ((
|
|
3479
|
+
var i, a, l;
|
|
3480
|
+
const { activeChannel: e } = U(), { channelSource: t } = Z(), n = ((a = (i = t.channel) == null ? void 0 : i.conversation) == null ? void 0 : a.status) === W.CLOSED;
|
|
3475
3481
|
return !(((l = t.channel) == null ? void 0 : l.url) === (e == null ? void 0 : e.url)) && n ? /* @__PURE__ */ r.createElement(Jl, null) : /* @__PURE__ */ r.createElement(vc, null);
|
|
3476
3482
|
}, Sc = () => {
|
|
3477
3483
|
var v;
|
|
3478
|
-
const { state: e, logger: t, enableCloseConversationButton: n, enableExpandButton: o, dispatcher: s } = B(), { stringSet:
|
|
3484
|
+
const { state: e, logger: t, enableCloseConversationButton: n, enableExpandButton: o, dispatcher: s } = B(), { stringSet: i } = O(), { aiAgentInfo: a, activeChannel: l } = U(), { channelSource: c, onNavigateToConversationList: d } = Z(), h = c.channel, f = Oe() ? 24 : 16, x = () => {
|
|
3479
3485
|
e.setOpened(!1);
|
|
3480
|
-
},
|
|
3486
|
+
}, E = async () => {
|
|
3481
3487
|
try {
|
|
3482
|
-
const S = await (
|
|
3488
|
+
const S = await (h == null ? void 0 : h.markConversationAsHandoff());
|
|
3483
3489
|
t.info("conversation.handleAgentHandoff: success", S);
|
|
3484
3490
|
} catch (S) {
|
|
3485
3491
|
t.error("conversation.handleAgentHandoff: error", S);
|
|
3486
3492
|
}
|
|
3487
|
-
},
|
|
3488
|
-
|
|
3489
|
-
},
|
|
3490
|
-
return /* @__PURE__ */ r.createElement(Ic, null, /* @__PURE__ */ r.createElement($c, null, d && /* @__PURE__ */ r.createElement(De, { onClick: () => d() }, /* @__PURE__ */ r.createElement(M, { type: "menu", size: 24, color: p.themedColor.textHighEmphasis })),
|
|
3493
|
+
}, b = async () => {
|
|
3494
|
+
h && await s.send(ro.CloseConversation({ channelUrl: h.url }));
|
|
3495
|
+
}, g = l && (h == null ? void 0 : h.url) === l.url, C = a.showHandoffButton && !!((v = h == null ? void 0 : h.conversation) != null && v.handoff) && g;
|
|
3496
|
+
return /* @__PURE__ */ r.createElement(Ic, null, /* @__PURE__ */ r.createElement($c, null, d && /* @__PURE__ */ r.createElement(De, { onClick: () => d() }, /* @__PURE__ */ r.createElement(M, { type: "menu", size: 24, color: p.themedColor.textHighEmphasis })), g && /* @__PURE__ */ r.createElement(qn, { size: 34 }), /* @__PURE__ */ r.createElement(Oc, { variant: "h2", color: p.themedColor.textHighEmphasis }, a.nickname || (h == null ? void 0 : h.name))), /* @__PURE__ */ r.createElement(Mc, null, C && /* @__PURE__ */ r.createElement(
|
|
3491
3497
|
kc,
|
|
3492
3498
|
{
|
|
3493
|
-
tooltipLabel:
|
|
3494
|
-
disabled: !oi(
|
|
3499
|
+
tooltipLabel: i.HEADER_BUTTON__AGENT_HANDOFF,
|
|
3500
|
+
disabled: !oi(h),
|
|
3495
3501
|
size: f,
|
|
3496
|
-
onClick:
|
|
3502
|
+
onClick: E
|
|
3497
3503
|
}
|
|
3498
3504
|
), n && /* @__PURE__ */ r.createElement(
|
|
3499
3505
|
Ac,
|
|
3500
3506
|
{
|
|
3501
|
-
disabled: !Bn(
|
|
3507
|
+
disabled: !Bn(h),
|
|
3502
3508
|
size: f,
|
|
3503
|
-
onClick:
|
|
3509
|
+
onClick: b
|
|
3504
3510
|
}
|
|
3505
3511
|
), o && /* @__PURE__ */ r.createElement(Tc, { size: f }), /* @__PURE__ */ r.createElement(wc, { size: f, onClick: x })));
|
|
3506
3512
|
}, Tc = ({ size: e, disabled: t }) => {
|
|
@@ -3537,7 +3543,7 @@ const ac = (e, t) => {
|
|
|
3537
3543
|
closedChannelUrl: n,
|
|
3538
3544
|
onClearClosedChannelUrl: o
|
|
3539
3545
|
},
|
|
3540
|
-
/* @__PURE__ */ r.createElement(Et, null, /* @__PURE__ */ r.createElement(Et.Consumer, null, (
|
|
3546
|
+
/* @__PURE__ */ r.createElement(Et, null, /* @__PURE__ */ r.createElement(Et.Consumer, null, (i) => /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(Dc, { ...i }, /* @__PURE__ */ r.createElement(s, null)), e)))
|
|
3541
3547
|
);
|
|
3542
3548
|
}, Nt = _e({
|
|
3543
3549
|
template: Rc,
|
|
@@ -3557,11 +3563,19 @@ const Dc = u.div`height:100%;width:100%;display:flex;flex-direction:column;flex:
|
|
|
3557
3563
|
useContext: or
|
|
3558
3564
|
} = G("ConversationList");
|
|
3559
3565
|
function Pc({
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3566
|
+
conversationListLimit: e,
|
|
3567
|
+
conversationListFilter: t,
|
|
3568
|
+
onOpenConversationView: n = Ie,
|
|
3569
|
+
children: o
|
|
3563
3570
|
}) {
|
|
3564
|
-
return /* @__PURE__ */ r.createElement(
|
|
3571
|
+
return /* @__PURE__ */ r.createElement(
|
|
3572
|
+
go,
|
|
3573
|
+
{
|
|
3574
|
+
conversationListLimit: e,
|
|
3575
|
+
conversationListFilter: t
|
|
3576
|
+
},
|
|
3577
|
+
(s) => /* @__PURE__ */ r.createElement(Nc, { value: { ...s, onOpenConversationView: n } }, o)
|
|
3578
|
+
);
|
|
3565
3579
|
}
|
|
3566
3580
|
const sr = _e({
|
|
3567
3581
|
template: Bc,
|
|
@@ -3578,10 +3592,10 @@ function Bc({
|
|
|
3578
3592
|
}
|
|
3579
3593
|
const Fc = u.div`display:flex;flex-direction:row;align-items:center;position:relative;width:100%;padding:14px 16px;box-sizing:border-box;gap:4px;cursor:pointer;`, Uc = u.div`position:absolute;bottom:0;height:1px;width:calc(100% - 32px);background-color:${p.themedColor.textDisabled};`, Hc = u.div`gap:4px;display:flex;flex-direction:column;flex:1;`, zc = u.div`display:flex;justify-content:flex-start;align-items:center;gap:6px;`, Vc = ({ items: e, renderItem: t, onEndReached: n }) => {
|
|
3580
3594
|
const o = (s) => {
|
|
3581
|
-
const
|
|
3582
|
-
|
|
3595
|
+
const i = s.target;
|
|
3596
|
+
i.scrollHeight - i.scrollTop === i.clientHeight && (n == null || n());
|
|
3583
3597
|
};
|
|
3584
|
-
return /* @__PURE__ */ r.createElement(Wc, { onScroll: (s) => o(s) }, e.map((s,
|
|
3598
|
+
return /* @__PURE__ */ r.createElement(Wc, { onScroll: (s) => o(s) }, e.map((s, i) => t(s, i)));
|
|
3585
3599
|
}, Wc = u.div`width:100%;height:100%;display:flex;flex-direction:column;flex:1;overflow:auto;`, Gc = () => {
|
|
3586
3600
|
const { stringSet: e } = O(), { listSource: t, onOpenConversationView: n } = or(), { Template: o } = sr.useContext();
|
|
3587
3601
|
return t.initialized ? t.channels.length === 0 ? /* @__PURE__ */ r.createElement(Ce, { type: "noChannels", label: e.CONVERSATION_LIST__NO_CONVERSATIONS }) : /* @__PURE__ */ r.createElement(
|
|
@@ -3589,13 +3603,13 @@ const Fc = u.div`display:flex;flex-direction:row;align-items:center;position:rel
|
|
|
3589
3603
|
{
|
|
3590
3604
|
items: t.channels,
|
|
3591
3605
|
renderItem: (s) => {
|
|
3592
|
-
var
|
|
3606
|
+
var i, a, l;
|
|
3593
3607
|
return /* @__PURE__ */ r.createElement(
|
|
3594
3608
|
o,
|
|
3595
3609
|
{
|
|
3596
3610
|
key: s.url,
|
|
3597
3611
|
channelUrl: s.url,
|
|
3598
|
-
title: (
|
|
3612
|
+
title: (a = (i = s.conversation) == null ? void 0 : i.topics) == null ? void 0 : a.join(", "),
|
|
3599
3613
|
lastMessageTimestamp: (l = s.lastMessage) == null ? void 0 : l.createdAt,
|
|
3600
3614
|
onClick: () => n(s.url, W.CLOSED),
|
|
3601
3615
|
channel: s
|
|
@@ -3623,16 +3637,22 @@ const Fc = u.div`display:flex;flex-direction:row;align-items:center;position:rel
|
|
|
3623
3637
|
}, Kc = u.div`background-color:${({ theme: e }) => e.colors.base.primary};display:flex;align-items:center;justify-content:center;padding:16px;cursor:pointer;`, Zc = u(w)`color:${({ theme: e }) => e.colors.base.primaryContrastContent};overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`, Yc = () => {
|
|
3624
3638
|
const { stringSet: e } = O();
|
|
3625
3639
|
return /* @__PURE__ */ r.createElement(qc, null, /* @__PURE__ */ r.createElement(Jc, { variant: "h2", color: p.themedColor.textHighEmphasis }, e.CONVERSATION_LIST__HEADER_TITLE), /* @__PURE__ */ r.createElement(Xc, null));
|
|
3626
|
-
}, qc = u.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};`, Jc = u(w)`padding:0 12px;width:100%;box-sizing:border-box;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;`, Xc = u.div`position:absolute;bottom:0;width:100%;height:1px;background-color:${p.themedColor.textDisabled};`, Qc = ({
|
|
3627
|
-
|
|
3640
|
+
}, qc = u.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};`, Jc = u(w)`padding:0 12px;width:100%;box-sizing:border-box;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;`, Xc = u.div`position:absolute;bottom:0;width:100%;height:1px;background-color:${p.themedColor.textDisabled};`, Qc = ({
|
|
3641
|
+
conversationListLimit: e,
|
|
3642
|
+
conversationListFilter: t,
|
|
3643
|
+
children: n,
|
|
3644
|
+
onOpenConversationView: o
|
|
3645
|
+
}) => {
|
|
3646
|
+
const { Template: s } = Pt.useContext();
|
|
3628
3647
|
return /* @__PURE__ */ r.createElement(
|
|
3629
3648
|
Pc,
|
|
3630
3649
|
{
|
|
3631
|
-
|
|
3632
|
-
|
|
3650
|
+
conversationListLimit: e,
|
|
3651
|
+
conversationListFilter: t,
|
|
3652
|
+
onOpenConversationView: o
|
|
3633
3653
|
},
|
|
3634
|
-
/* @__PURE__ */ r.createElement(td, null, /* @__PURE__ */ r.createElement(
|
|
3635
|
-
|
|
3654
|
+
/* @__PURE__ */ r.createElement(td, null, /* @__PURE__ */ r.createElement(s, null)),
|
|
3655
|
+
n
|
|
3636
3656
|
);
|
|
3637
3657
|
}, Pt = _e({
|
|
3638
3658
|
template: ed,
|
|
@@ -3646,7 +3666,7 @@ function ed() {
|
|
|
3646
3666
|
const { components: e } = Pt.useContext();
|
|
3647
3667
|
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));
|
|
3648
3668
|
}
|
|
3649
|
-
const td = u.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, nd = I`:where(#${
|
|
3669
|
+
const td = u.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, nd = I`:where(#${ee.ENTRY}) :not(code *){font-family:'Roboto',sans-serif;box-sizing:border-box;}`, rd = [nd, ss, is], od = (e, ...t) => Ir(e, ...rd, ...t), sd = od``, id = Kr(
|
|
3650
3670
|
Nt,
|
|
3651
3671
|
xe,
|
|
3652
3672
|
Ot,
|
|
@@ -3660,11 +3680,11 @@ function ad({
|
|
|
3660
3680
|
logger: n,
|
|
3661
3681
|
language: o,
|
|
3662
3682
|
stringSet: s,
|
|
3663
|
-
children:
|
|
3664
|
-
messageTemplate:
|
|
3683
|
+
children: i,
|
|
3684
|
+
messageTemplate: a,
|
|
3665
3685
|
theme: l
|
|
3666
3686
|
}) {
|
|
3667
|
-
return ms(Yo, t), /* @__PURE__ */ r.createElement($r, { target: t }, /* @__PURE__ */ r.createElement(cs, { rootElement: t, logger: n, appearance: e, theme: l }, /* @__PURE__ */ r.createElement(zo, { internalVariables:
|
|
3687
|
+
return ms(Yo, t), /* @__PURE__ */ r.createElement($r, { target: t }, /* @__PURE__ */ r.createElement(cs, { rootElement: t, logger: n, appearance: e, theme: l }, /* @__PURE__ */ r.createElement(zo, { internalVariables: a == null ? void 0 : a.__internalVariables }, /* @__PURE__ */ r.createElement(os, { stringSet: s, logger: n, language: o }, /* @__PURE__ */ r.createElement(id, null, i, /* @__PURE__ */ r.createElement(sd, null))))));
|
|
3668
3688
|
}
|
|
3669
3689
|
const We = {}, Ge = {
|
|
3670
3690
|
getItem: (e) => {
|
|
@@ -3705,20 +3725,20 @@ const We = {}, Ge = {
|
|
|
3705
3725
|
logLevel: n = En.WARN,
|
|
3706
3726
|
language: o = navigator.language,
|
|
3707
3727
|
userSessionInfo: s,
|
|
3708
|
-
children:
|
|
3709
|
-
...
|
|
3728
|
+
children: i,
|
|
3729
|
+
...a
|
|
3710
3730
|
}, l) {
|
|
3711
3731
|
var c, d;
|
|
3712
|
-
return we.level !== n && (we.level = n), us("https://fonts.googleapis.com/css2?family=Roboto&display=swap", t), /* @__PURE__ */ r.createElement("div", { id:
|
|
3732
|
+
return we.level !== n && (we.level = n), us("https://fonts.googleapis.com/css2?family=Roboto&display=swap", t), /* @__PURE__ */ r.createElement("div", { id: ee.ENTRY, style: { width: "fit-content", height: "fit-content", ...a.entryStyle } }, /* @__PURE__ */ r.createElement(
|
|
3713
3733
|
ad,
|
|
3714
3734
|
{
|
|
3715
3735
|
logger: we,
|
|
3716
3736
|
rootElement: t,
|
|
3717
|
-
appearance: (c =
|
|
3718
|
-
stringSet:
|
|
3737
|
+
appearance: (c = a.agentPreviewConfigs) == null ? void 0 : c.appearance,
|
|
3738
|
+
stringSet: a.stringSet,
|
|
3719
3739
|
language: o,
|
|
3720
|
-
messageTemplate:
|
|
3721
|
-
theme:
|
|
3740
|
+
messageTemplate: a.messageTemplate,
|
|
3741
|
+
theme: a.theme
|
|
3722
3742
|
},
|
|
3723
3743
|
/* @__PURE__ */ r.createElement(
|
|
3724
3744
|
ps,
|
|
@@ -3733,26 +3753,26 @@ const We = {}, Ge = {
|
|
|
3733
3753
|
language: o,
|
|
3734
3754
|
logger: we,
|
|
3735
3755
|
dispatcher: ld,
|
|
3736
|
-
chatParams: { customApiHost:
|
|
3737
|
-
...
|
|
3756
|
+
chatParams: { customApiHost: a.customApiHost, customWebSocketHost: a.customWebSocketHost },
|
|
3757
|
+
...a
|
|
3738
3758
|
},
|
|
3739
3759
|
/* @__PURE__ */ r.createElement(
|
|
3740
3760
|
bs,
|
|
3741
3761
|
{
|
|
3742
3762
|
ref: l,
|
|
3743
3763
|
userSessionInfo: s,
|
|
3744
|
-
forceCreateChannel: (d =
|
|
3764
|
+
forceCreateChannel: (d = a.agentPreviewConfigs) == null ? void 0 : d.forceCreateChannel
|
|
3745
3765
|
},
|
|
3746
|
-
/* @__PURE__ */ r.createElement(Na, { ...
|
|
3766
|
+
/* @__PURE__ */ r.createElement(Na, { ...a._UNSAFE_INTERNAL_dashboardTester }, i, /* @__PURE__ */ r.createElement("div", { id: ee.MODAL_ROOT }))
|
|
3747
3767
|
)
|
|
3748
3768
|
)
|
|
3749
3769
|
));
|
|
3750
3770
|
}), we = new Tn(En.WARN), ld = new _n(we), ar = ({ children: e, isOpened: t }) => {
|
|
3751
3771
|
const { dir: n, rootElement: o } = B(), s = pe(o, !0);
|
|
3752
3772
|
return L(() => {
|
|
3753
|
-
const
|
|
3754
|
-
return t ? s.body.classList.add(
|
|
3755
|
-
s.body.classList.remove(
|
|
3773
|
+
const i = "sb-agent-block-scroll";
|
|
3774
|
+
return t ? s.body.classList.add(i) : s.body.classList.remove(i), () => {
|
|
3775
|
+
s.body.classList.remove(i);
|
|
3756
3776
|
};
|
|
3757
3777
|
}, [s, t]), /* @__PURE__ */ r.createElement(cd, { dir: n, $visible: t }, e);
|
|
3758
3778
|
}, cd = u.div`width:100%;height:100%;position:fixed;top:0;left:0;z-index:${fe.WINDOW};visibility:${({ $visible: e }) => e ? "visible" : "hidden"};`, dd = 48, ud = 2 / 3;
|
|
@@ -3762,26 +3782,26 @@ function md({
|
|
|
3762
3782
|
onClick: n,
|
|
3763
3783
|
type: o,
|
|
3764
3784
|
imageUrl: s,
|
|
3765
|
-
dir:
|
|
3766
|
-
animated:
|
|
3785
|
+
dir: i,
|
|
3786
|
+
animated: a = !0,
|
|
3767
3787
|
backgroundColor: l,
|
|
3768
3788
|
size: c = dd
|
|
3769
3789
|
}) {
|
|
3770
|
-
const d = pt(l),
|
|
3790
|
+
const d = pt(l), h = Math.round(c * ud);
|
|
3771
3791
|
return /* @__PURE__ */ r.createElement(
|
|
3772
3792
|
pd,
|
|
3773
3793
|
{
|
|
3774
|
-
dir:
|
|
3775
|
-
id:
|
|
3794
|
+
dir: i,
|
|
3795
|
+
id: ee.LAUNCHER,
|
|
3776
3796
|
className: e,
|
|
3777
3797
|
"aria-label": "Sendbird AIAgent Launcher",
|
|
3778
3798
|
onClick: n,
|
|
3779
|
-
$animated:
|
|
3799
|
+
$animated: a,
|
|
3780
3800
|
$backgroundColor: l,
|
|
3781
3801
|
$size: c
|
|
3782
3802
|
},
|
|
3783
|
-
/* @__PURE__ */ r.createElement(fd, { $isOpened: t, $animated:
|
|
3784
|
-
/* @__PURE__ */ r.createElement(bd, { $isOpened: t, $animated:
|
|
3803
|
+
/* @__PURE__ */ r.createElement(fd, { $isOpened: t, $animated: a, $fillColor: d, $iconSize: h }, /* @__PURE__ */ r.createElement(fn.Open, { url: s, isDefaultIcon: o === "default_icon" })),
|
|
3804
|
+
/* @__PURE__ */ r.createElement(bd, { $isOpened: t, $animated: a, $fillColor: d, $iconSize: h }, /* @__PURE__ */ r.createElement(fn.Close, { size: h }))
|
|
3785
3805
|
);
|
|
3786
3806
|
}
|
|
3787
3807
|
const gd = I`&:hover{transition:transform 250ms cubic-bezier(0.33,0,0,1);transform:scale(1.1);}&:active{transform:scale(0.8);}`, hd = I`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:${({ $iconSize: e }) => e}px;height:${({ $iconSize: e }) => e}px;filter:${({ $fillColor: e }) => e === $n.WHITE ? "grayscale(100%) brightness(2000%)" : "grayscale(100%) invert(100%) saturate(0%) brightness(0%) contrast(1000%)"};}}`, lr = I`svg{width:${({ $iconSize: e }) => e}px;height:${({ $iconSize: e }) => e}px;${({ $fillColor: e }) => I`
|
|
@@ -3798,7 +3818,7 @@ const gd = I`&:hover{transition:transform 250ms cubic-bezier(0.33,0,0,1);transfo
|
|
|
3798
3818
|
Close: ({ size: e }) => /* @__PURE__ */ r.createElement(M, { size: e, type: "chevron-down" })
|
|
3799
3819
|
};
|
|
3800
3820
|
function dr({ className: e, size: t }) {
|
|
3801
|
-
const { colors: n } = xt(), { dir: o, state: s } = B(), { launcherInfo:
|
|
3821
|
+
const { colors: n } = xt(), { dir: o, state: s } = B(), { launcherInfo: i } = U();
|
|
3802
3822
|
return xd(), /* @__PURE__ */ r.createElement(
|
|
3803
3823
|
md,
|
|
3804
3824
|
{
|
|
@@ -3806,8 +3826,8 @@ function dr({ className: e, size: t }) {
|
|
|
3806
3826
|
className: e,
|
|
3807
3827
|
isOpened: s.opened,
|
|
3808
3828
|
onClick: () => s.setOpened(!s.opened),
|
|
3809
|
-
type:
|
|
3810
|
-
imageUrl:
|
|
3829
|
+
type: i.type,
|
|
3830
|
+
imageUrl: i.imageUrl,
|
|
3811
3831
|
backgroundColor: n.base.primary,
|
|
3812
3832
|
size: t
|
|
3813
3833
|
}
|
|
@@ -3818,23 +3838,23 @@ function xd() {
|
|
|
3818
3838
|
const { chatSDK: e, state: t, logger: n, enableAutoDisconnectInLauncher: o } = B(), s = N(null);
|
|
3819
3839
|
L(() => {
|
|
3820
3840
|
if (!o) return;
|
|
3821
|
-
function
|
|
3841
|
+
function i() {
|
|
3822
3842
|
s.current && (clearTimeout(s.current), s.current = null);
|
|
3823
3843
|
}
|
|
3824
|
-
function
|
|
3825
|
-
e.connectionState === Ar.CLOSED && (e.reconnect(), n.debug("useSDKInactivityTimeout: reconnected")),
|
|
3844
|
+
function a() {
|
|
3845
|
+
e.connectionState === Ar.CLOSED && (e.reconnect(), n.debug("useSDKInactivityTimeout: reconnected")), i(), n.debug("useSDKInactivityTimeout: clear disconnect schedule");
|
|
3826
3846
|
}
|
|
3827
3847
|
function l() {
|
|
3828
|
-
|
|
3848
|
+
i(), s.current = setTimeout(async () => {
|
|
3829
3849
|
await e.disconnectWebSocket(), n.debug("useSDKInactivityTimeout: disconnected");
|
|
3830
3850
|
}, Ed);
|
|
3831
3851
|
}
|
|
3832
|
-
t.opened ?
|
|
3852
|
+
t.opened ? a() : (l(), n.debug("useSDKInactivityTimeout: schedule disconnect"));
|
|
3833
3853
|
}, [o, e, t.opened]);
|
|
3834
3854
|
}
|
|
3835
3855
|
const ur = ve(null);
|
|
3836
3856
|
function Cd() {
|
|
3837
|
-
const e =
|
|
3857
|
+
const e = Q(ur);
|
|
3838
3858
|
if (!e)
|
|
3839
3859
|
throw new Error("useNavigator() must be used within <Navigator />");
|
|
3840
3860
|
return e;
|
|
@@ -3861,23 +3881,23 @@ const vd = xn`0%{transform:translateY(40px);opacity:0;}100%{transform:translateY
|
|
|
3861
3881
|
` : I`z-index:1;pointer-events:none;`}
|
|
3862
3882
|
`;
|
|
3863
3883
|
function Ae({ initialId: e, children: t }) {
|
|
3864
|
-
const n = R((
|
|
3865
|
-
c((v) => [...v,
|
|
3884
|
+
const n = R((g, C) => {
|
|
3885
|
+
c((v) => [...v, g]), h((v) => ({ ...v, [g]: !0 })), C != null && C.reset && E((v) => ({
|
|
3866
3886
|
...v,
|
|
3867
|
-
[
|
|
3887
|
+
[g]: (v[g] || 0) + 1
|
|
3868
3888
|
})), f((v) => ({
|
|
3869
3889
|
...v,
|
|
3870
|
-
[
|
|
3890
|
+
[g]: "entering"
|
|
3871
3891
|
})), setTimeout(() => {
|
|
3872
3892
|
f((v) => ({
|
|
3873
3893
|
...v,
|
|
3874
|
-
[
|
|
3894
|
+
[g]: "entered"
|
|
3875
3895
|
}));
|
|
3876
3896
|
}, 300);
|
|
3877
3897
|
}, []), o = R(() => {
|
|
3878
|
-
c((
|
|
3879
|
-
if (
|
|
3880
|
-
const C =
|
|
3898
|
+
c((g) => {
|
|
3899
|
+
if (g.length <= 1) return g;
|
|
3900
|
+
const C = g[g.length - 1];
|
|
3881
3901
|
return f((v) => ({
|
|
3882
3902
|
...v,
|
|
3883
3903
|
[C]: "exiting"
|
|
@@ -3886,37 +3906,37 @@ function Ae({ initialId: e, children: t }) {
|
|
|
3886
3906
|
...v,
|
|
3887
3907
|
[C]: "exited"
|
|
3888
3908
|
})), c((v) => v.slice(0, -1));
|
|
3889
|
-
}, 300),
|
|
3909
|
+
}, 300), g;
|
|
3890
3910
|
});
|
|
3891
3911
|
}, []), s = ae(() => ({
|
|
3892
3912
|
navigation: {
|
|
3893
3913
|
navigate: n,
|
|
3894
3914
|
pop: o
|
|
3895
3915
|
}
|
|
3896
|
-
}), [n, o]),
|
|
3897
|
-
(
|
|
3898
|
-
), [t]),
|
|
3899
|
-
const
|
|
3900
|
-
return
|
|
3916
|
+
}), [n, o]), i = ae(() => vr.toArray(t).filter(
|
|
3917
|
+
(g) => g.type === mr
|
|
3918
|
+
), [t]), a = ae(() => {
|
|
3919
|
+
const g = {};
|
|
3920
|
+
return i.forEach((C) => {
|
|
3901
3921
|
const { id: v, lazy: S, children: k } = C.props;
|
|
3902
|
-
|
|
3903
|
-
}),
|
|
3904
|
-
}, [
|
|
3905
|
-
const
|
|
3906
|
-
return Object.entries(
|
|
3907
|
-
v === !1 && (
|
|
3908
|
-
}),
|
|
3909
|
-
}), [
|
|
3910
|
-
const
|
|
3911
|
-
return Object.keys(
|
|
3912
|
-
C === e ?
|
|
3913
|
-
}),
|
|
3914
|
-
}), [x,
|
|
3915
|
-
return /* @__PURE__ */ r.createElement(ur.Provider, { value: s }, /* @__PURE__ */ r.createElement(kd, null, Object.keys(
|
|
3922
|
+
g[v] = { lazy: S, element: typeof k == "function" ? k(s) : k };
|
|
3923
|
+
}), g;
|
|
3924
|
+
}, [i]), [l, c] = _([e]), [d, h] = _(() => {
|
|
3925
|
+
const g = {};
|
|
3926
|
+
return Object.entries(a).forEach(([C, { lazy: v }]) => {
|
|
3927
|
+
v === !1 && (g[C] = !0);
|
|
3928
|
+
}), g[e] = !0, g;
|
|
3929
|
+
}), [m, f] = _(() => {
|
|
3930
|
+
const g = {};
|
|
3931
|
+
return Object.keys(a).forEach((C) => {
|
|
3932
|
+
C === e ? g[C] = "entered" : g[C] = "exited";
|
|
3933
|
+
}), g;
|
|
3934
|
+
}), [x, E] = _({}), b = l[l.length - 1];
|
|
3935
|
+
return /* @__PURE__ */ r.createElement(ur.Provider, { value: s }, /* @__PURE__ */ r.createElement(kd, null, Object.keys(a).map((g) => {
|
|
3916
3936
|
var k;
|
|
3917
|
-
if (!d[
|
|
3918
|
-
const C =
|
|
3919
|
-
return /* @__PURE__ */ r.createElement(Ad, { key: S, $transitionState: C, $active: v }, (k =
|
|
3937
|
+
if (!d[g]) return null;
|
|
3938
|
+
const C = m[g] || "exited", v = g === b, S = `${g}-${x[g] || 0}`;
|
|
3939
|
+
return /* @__PURE__ */ r.createElement(Ad, { key: S, $transitionState: C, $active: v }, (k = a[g]) == null ? void 0 : k.element);
|
|
3920
3940
|
})));
|
|
3921
3941
|
}
|
|
3922
3942
|
const kd = u.div`position:relative;width:100%;height:100%;`;
|
|
@@ -3942,15 +3962,15 @@ const he = {
|
|
|
3942
3962
|
)));
|
|
3943
3963
|
function Id({ isExpanded: e, isOpened: t, children: n, launcher: o }) {
|
|
3944
3964
|
const { dir: s } = B();
|
|
3945
|
-
return /* @__PURE__ */ r.createElement($d, null, /* @__PURE__ */ r.createElement(Md, { dir: s, id:
|
|
3965
|
+
return /* @__PURE__ */ r.createElement($d, null, /* @__PURE__ */ r.createElement(Md, { dir: s, id: ee.WINDOW, $isExpanded: e, $isOpened: t }, n), o);
|
|
3946
3966
|
}
|
|
3947
3967
|
const $d = u.div`display:flex;flex-direction:column;gap:8px;align-items:flex-end;`, Md = u.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 && Ld};${({ $isExpanded: e }) => e && Od};`, Od = I`width:743px;height:723px;`, Ld = I`z-index:${fe.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;`, au = ye(function({ children: e, ...t }, n) {
|
|
3948
|
-
const o = Oe(), [s,
|
|
3949
|
-
return /* @__PURE__ */ r.createElement(ir, { enableExpandButton: !o, ref: n, ...t }, /* @__PURE__ */ r.createElement(In, null, ({ state: l }) => /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
3968
|
+
const o = Oe(), [s, i] = _(), a = o ? ar : Id;
|
|
3969
|
+
return /* @__PURE__ */ r.createElement(ir, { enableExpandButton: !o, ref: n, ...t }, /* @__PURE__ */ r.createElement(In, null, ({ state: l }) => /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(a, { isExpanded: l.expanded, isOpened: l.opened, launcher: /* @__PURE__ */ r.createElement(dr, null) }, /* @__PURE__ */ r.createElement(
|
|
3950
3970
|
gr,
|
|
3951
3971
|
{
|
|
3952
3972
|
closedChannelUrl: s,
|
|
3953
|
-
setClosedChannelUrl:
|
|
3973
|
+
setClosedChannelUrl: i
|
|
3954
3974
|
}
|
|
3955
3975
|
)), e)));
|
|
3956
3976
|
}), {
|
|
@@ -3958,11 +3978,11 @@ const $d = u.div`display:flex;flex-direction:column;gap:8px;align-items:flex-end
|
|
|
3958
3978
|
useContext: Bt
|
|
3959
3979
|
} = G("FixedMessengerStyle");
|
|
3960
3980
|
function hr(e, t, n, o = 0) {
|
|
3961
|
-
const { top: s, bottom:
|
|
3981
|
+
const { top: s, bottom: i, start: a, end: l } = n;
|
|
3962
3982
|
let c = "", d = "";
|
|
3963
3983
|
switch (e) {
|
|
3964
3984
|
case "start":
|
|
3965
|
-
d = `inset-inline-start: ${j(
|
|
3985
|
+
d = `inset-inline-start: ${j(a)}`;
|
|
3966
3986
|
break;
|
|
3967
3987
|
case "end":
|
|
3968
3988
|
d = `inset-inline-end: ${j(l)}`;
|
|
@@ -3973,7 +3993,7 @@ function hr(e, t, n, o = 0) {
|
|
|
3973
3993
|
c = `top: calc(${j(s)} + ${o}px)`;
|
|
3974
3994
|
break;
|
|
3975
3995
|
case "bottom":
|
|
3976
|
-
c = `bottom: calc(${j(
|
|
3996
|
+
c = `bottom: calc(${j(i)} + ${o}px)`;
|
|
3977
3997
|
break;
|
|
3978
3998
|
}
|
|
3979
3999
|
return I`${c};${d};`;
|
|
@@ -3984,17 +4004,17 @@ function Dd(e) {
|
|
|
3984
4004
|
}
|
|
3985
4005
|
const Nd = u(dr)`position:fixed;z-index:${fe.LAUNCHER};${({ $horizontal: e, $vertical: t, $margin: n }) => hr(e, t, n)};`;
|
|
3986
4006
|
function Pd({ isExpanded: e, isOpened: t, children: n }) {
|
|
3987
|
-
const { dir: o } = B(), { horizontal: s, vertical:
|
|
4007
|
+
const { dir: o } = B(), { horizontal: s, vertical: i, margin: a, launcherSize: l } = Bt();
|
|
3988
4008
|
return /* @__PURE__ */ r.createElement(
|
|
3989
4009
|
Bd,
|
|
3990
4010
|
{
|
|
3991
4011
|
dir: o,
|
|
3992
|
-
id:
|
|
4012
|
+
id: ee.WINDOW,
|
|
3993
4013
|
$isExpanded: e,
|
|
3994
4014
|
$isOpened: t,
|
|
3995
4015
|
$horizontal: s,
|
|
3996
|
-
$vertical:
|
|
3997
|
-
$margin:
|
|
4016
|
+
$vertical: i,
|
|
4017
|
+
$margin: a,
|
|
3998
4018
|
$launcherSize: l
|
|
3999
4019
|
},
|
|
4000
4020
|
n
|
|
@@ -4009,16 +4029,16 @@ const Bd = u.div`background:${({ theme: e }) => e.colors.base.background};displa
|
|
|
4009
4029
|
${({ $isOpened: e }) => e && Ud};
|
|
4010
4030
|
${({ $isExpanded: e }) => e && Fd};
|
|
4011
4031
|
`, Fd = I`width:743px;height:723px;`, Ud = I`z-index:${fe.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;`, pr = { top: 24, bottom: 24, start: 24, end: 24 }, Hd = ye(function({ children: e, ...t }, n) {
|
|
4012
|
-
const [o, s] = _(), [
|
|
4013
|
-
const [
|
|
4014
|
-
return { horizontal:
|
|
4015
|
-
}, [
|
|
4016
|
-
return /* @__PURE__ */ r.createElement(ir, { enableExpandButton: !
|
|
4032
|
+
const [o, s] = _(), [i, a] = _("end-bottom"), [l, c] = _(pr), [d, h] = _(48), m = Oe(), f = m ? ar : Pd, { horizontal: x, vertical: E } = ae(() => {
|
|
4033
|
+
const [b, g] = i.split("-");
|
|
4034
|
+
return { horizontal: b === "start" ? "start" : "end", vertical: g === "top" ? "top" : "bottom" };
|
|
4035
|
+
}, [i]);
|
|
4036
|
+
return /* @__PURE__ */ r.createElement(ir, { enableExpandButton: !m, ref: n, ...t }, /* @__PURE__ */ r.createElement(In, null, ({ state: b }) => /* @__PURE__ */ r.createElement(
|
|
4017
4037
|
Rd,
|
|
4018
4038
|
{
|
|
4019
|
-
value: { horizontal: x, vertical:
|
|
4039
|
+
value: { horizontal: x, vertical: E, margin: l, launcherSize: d, setPosition: a, setMargin: c, setLauncherSize: h }
|
|
4020
4040
|
},
|
|
4021
|
-
/* @__PURE__ */ r.createElement(f, { isExpanded:
|
|
4041
|
+
/* @__PURE__ */ r.createElement(f, { isExpanded: b.expanded, isOpened: b.opened }, /* @__PURE__ */ r.createElement(
|
|
4022
4042
|
gr,
|
|
4023
4043
|
{
|
|
4024
4044
|
closedChannelUrl: o,
|
|
@@ -4029,15 +4049,15 @@ const Bd = u.div`background:${({ theme: e }) => e.colors.base.background};displa
|
|
|
4029
4049
|
e
|
|
4030
4050
|
)));
|
|
4031
4051
|
}), zd = (e) => {
|
|
4032
|
-
var s,
|
|
4052
|
+
var s, i, a, l;
|
|
4033
4053
|
const { setPosition: t, setMargin: n, setLauncherSize: o } = Bt();
|
|
4034
4054
|
return le(() => {
|
|
4035
4055
|
e.position && t(e.position), e.margin && n({ ...pr, ...e.margin }), e.launcherSize && o(e.launcherSize);
|
|
4036
4056
|
}, [
|
|
4037
4057
|
e.position,
|
|
4038
4058
|
(s = e.margin) == null ? void 0 : s.top,
|
|
4039
|
-
(
|
|
4040
|
-
(
|
|
4059
|
+
(i = e.margin) == null ? void 0 : i.bottom,
|
|
4060
|
+
(a = e.margin) == null ? void 0 : a.start,
|
|
4041
4061
|
(l = e.margin) == null ? void 0 : l.end,
|
|
4042
4062
|
e.launcherSize
|
|
4043
4063
|
]), null;
|
|
@@ -4063,7 +4083,7 @@ export {
|
|
|
4063
4083
|
O as f,
|
|
4064
4084
|
md as g,
|
|
4065
4085
|
xe as h,
|
|
4066
|
-
|
|
4086
|
+
X as i,
|
|
4067
4087
|
sr as j,
|
|
4068
4088
|
pn as k,
|
|
4069
4089
|
Nt as l,
|