@channelhub/widget 0.1.8 → 0.1.9
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/ChannelHubInbox.d.ts.map +1 -1
- package/dist/api.d.ts +7 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/index.cjs +37 -27
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1485 -1003
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ChannelHubInbox.tsx +512 -15
- package/src/api.ts +12 -1
- package/src/index.ts +1 -1
- package/src/types.ts +12 -0
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as e, jsxs as n, Fragment as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Pe, createElement as et, createContext as wt, useRef as J, useState as y, useMemo as $e, useEffect as X, useCallback as we, useImperativeHandle as Bt, useContext as tt, Component as Lt } from "react";
|
|
3
|
+
import { createPortal as St } from "react-dom";
|
|
4
4
|
/**
|
|
5
5
|
* @license lucide-react v0.468.0 - ISC
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the ISC license.
|
|
8
8
|
* See the LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const Mt = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Ct = (...t) => t.filter((i, r, o) => !!i && i.trim() !== "" && o.indexOf(i) === r).join(" ").trim();
|
|
11
11
|
/**
|
|
12
12
|
* @license lucide-react v0.468.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
16
|
*/
|
|
17
|
-
var
|
|
17
|
+
var Ht = {
|
|
18
18
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19
19
|
width: 24,
|
|
20
20
|
height: 24,
|
|
@@ -31,31 +31,31 @@ var kt = {
|
|
|
31
31
|
* This source code is licensed under the ISC license.
|
|
32
32
|
* See the LICENSE file in the root directory of this source tree.
|
|
33
33
|
*/
|
|
34
|
-
const
|
|
34
|
+
const At = Pe(
|
|
35
35
|
({
|
|
36
36
|
color: t = "currentColor",
|
|
37
37
|
size: i = 24,
|
|
38
38
|
strokeWidth: r = 2,
|
|
39
39
|
absoluteStrokeWidth: o,
|
|
40
|
-
className:
|
|
41
|
-
children:
|
|
42
|
-
iconNode:
|
|
43
|
-
|
|
44
|
-
},
|
|
40
|
+
className: h = "",
|
|
41
|
+
children: S,
|
|
42
|
+
iconNode: m,
|
|
43
|
+
...M
|
|
44
|
+
}, w) => et(
|
|
45
45
|
"svg",
|
|
46
46
|
{
|
|
47
|
-
ref:
|
|
48
|
-
...
|
|
47
|
+
ref: w,
|
|
48
|
+
...Ht,
|
|
49
49
|
width: i,
|
|
50
50
|
height: i,
|
|
51
51
|
stroke: t,
|
|
52
52
|
strokeWidth: o ? Number(r) * 24 / Number(i) : r,
|
|
53
|
-
className:
|
|
54
|
-
|
|
53
|
+
className: Ct("lucide", h),
|
|
54
|
+
...M
|
|
55
55
|
},
|
|
56
56
|
[
|
|
57
|
-
...
|
|
58
|
-
...Array.isArray(
|
|
57
|
+
...m.map(([v, W]) => et(v, W)),
|
|
58
|
+
...Array.isArray(S) ? S : [S]
|
|
59
59
|
]
|
|
60
60
|
)
|
|
61
61
|
);
|
|
@@ -65,13 +65,13 @@ const wt = Le(
|
|
|
65
65
|
* This source code is licensed under the ISC license.
|
|
66
66
|
* See the LICENSE file in the root directory of this source tree.
|
|
67
67
|
*/
|
|
68
|
-
const
|
|
69
|
-
const r =
|
|
70
|
-
({ className: o, ...
|
|
71
|
-
ref:
|
|
68
|
+
const Y = (t, i) => {
|
|
69
|
+
const r = Pe(
|
|
70
|
+
({ className: o, ...h }, S) => et(At, {
|
|
71
|
+
ref: S,
|
|
72
72
|
iconNode: i,
|
|
73
|
-
className:
|
|
74
|
-
...
|
|
73
|
+
className: Ct(`lucide-${Mt(t)}`, o),
|
|
74
|
+
...h
|
|
75
75
|
})
|
|
76
76
|
);
|
|
77
77
|
return r.displayName = `${t}`, r;
|
|
@@ -82,7 +82,7 @@ const G = (t, i) => {
|
|
|
82
82
|
* This source code is licensed under the ISC license.
|
|
83
83
|
* See the LICENSE file in the root directory of this source tree.
|
|
84
84
|
*/
|
|
85
|
-
const
|
|
85
|
+
const ht = Y("CheckCheck", [
|
|
86
86
|
["path", { d: "M18 6 7 17l-5-5", key: "116fxf" }],
|
|
87
87
|
["path", { d: "m22 10-7.5 7.5L13 16", key: "ke71qq" }]
|
|
88
88
|
]);
|
|
@@ -92,14 +92,14 @@ const Xe = G("CheckCheck", [
|
|
|
92
92
|
* This source code is licensed under the ISC license.
|
|
93
93
|
* See the LICENSE file in the root directory of this source tree.
|
|
94
94
|
*/
|
|
95
|
-
const lt =
|
|
95
|
+
const lt = Y("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
96
96
|
/**
|
|
97
97
|
* @license lucide-react v0.468.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
101
|
*/
|
|
102
|
-
const
|
|
102
|
+
const nt = Y("ChevronDown", [
|
|
103
103
|
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
104
104
|
]);
|
|
105
105
|
/**
|
|
@@ -108,7 +108,7 @@ const St = G("ChevronDown", [
|
|
|
108
108
|
* This source code is licensed under the ISC license.
|
|
109
109
|
* See the LICENSE file in the root directory of this source tree.
|
|
110
110
|
*/
|
|
111
|
-
const
|
|
111
|
+
const jt = Y("ChevronRight", [
|
|
112
112
|
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
113
113
|
]);
|
|
114
114
|
/**
|
|
@@ -117,7 +117,7 @@ const Ct = G("ChevronRight", [
|
|
|
117
117
|
* This source code is licensed under the ISC license.
|
|
118
118
|
* See the LICENSE file in the root directory of this source tree.
|
|
119
119
|
*/
|
|
120
|
-
const
|
|
120
|
+
const Et = Y("CircleAlert", [
|
|
121
121
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
122
122
|
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
123
123
|
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
@@ -128,7 +128,7 @@ const It = G("CircleAlert", [
|
|
|
128
128
|
* This source code is licensed under the ISC license.
|
|
129
129
|
* See the LICENSE file in the root directory of this source tree.
|
|
130
130
|
*/
|
|
131
|
-
const
|
|
131
|
+
const It = Y("Ellipsis", [
|
|
132
132
|
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
133
133
|
["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
|
|
134
134
|
["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
|
|
@@ -139,7 +139,7 @@ const dt = G("Ellipsis", [
|
|
|
139
139
|
* This source code is licensed under the ISC license.
|
|
140
140
|
* See the LICENSE file in the root directory of this source tree.
|
|
141
141
|
*/
|
|
142
|
-
const
|
|
142
|
+
const Ot = Y("Image", [
|
|
143
143
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
144
144
|
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
145
145
|
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
@@ -150,7 +150,7 @@ const zt = G("Image", [
|
|
|
150
150
|
* This source code is licensed under the ISC license.
|
|
151
151
|
* See the LICENSE file in the root directory of this source tree.
|
|
152
152
|
*/
|
|
153
|
-
const
|
|
153
|
+
const Ut = Y("Inbox", [
|
|
154
154
|
["polyline", { points: "22 12 16 12 14 15 10 15 8 12 2 12", key: "o97t9d" }],
|
|
155
155
|
[
|
|
156
156
|
"path",
|
|
@@ -166,7 +166,7 @@ const Tt = G("Inbox", [
|
|
|
166
166
|
* This source code is licensed under the ISC license.
|
|
167
167
|
* See the LICENSE file in the root directory of this source tree.
|
|
168
168
|
*/
|
|
169
|
-
const
|
|
169
|
+
const Dt = Y("Info", [
|
|
170
170
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
171
171
|
["path", { d: "M12 16v-4", key: "1dtifu" }],
|
|
172
172
|
["path", { d: "M12 8h.01", key: "e9boi3" }]
|
|
@@ -177,7 +177,7 @@ const Rt = G("Info", [
|
|
|
177
177
|
* This source code is licensed under the ISC license.
|
|
178
178
|
* See the LICENSE file in the root directory of this source tree.
|
|
179
179
|
*/
|
|
180
|
-
const
|
|
180
|
+
const zt = Y("LoaderCircle", [
|
|
181
181
|
["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
|
|
182
182
|
]);
|
|
183
183
|
/**
|
|
@@ -186,7 +186,7 @@ const ct = G("LoaderCircle", [
|
|
|
186
186
|
* This source code is licensed under the ISC license.
|
|
187
187
|
* See the LICENSE file in the root directory of this source tree.
|
|
188
188
|
*/
|
|
189
|
-
const
|
|
189
|
+
const pt = Y("MessageCircle", [
|
|
190
190
|
["path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z", key: "vv11sd" }]
|
|
191
191
|
]);
|
|
192
192
|
/**
|
|
@@ -195,7 +195,7 @@ const Ye = G("MessageCircle", [
|
|
|
195
195
|
* This source code is licensed under the ISC license.
|
|
196
196
|
* See the LICENSE file in the root directory of this source tree.
|
|
197
197
|
*/
|
|
198
|
-
const
|
|
198
|
+
const Pt = Y("Paperclip", [
|
|
199
199
|
["path", { d: "M13.234 20.252 21 12.3", key: "1cbrk9" }],
|
|
200
200
|
[
|
|
201
201
|
"path",
|
|
@@ -211,7 +211,7 @@ const Wt = G("Paperclip", [
|
|
|
211
211
|
* This source code is licensed under the ISC license.
|
|
212
212
|
* See the LICENSE file in the root directory of this source tree.
|
|
213
213
|
*/
|
|
214
|
-
const
|
|
214
|
+
const Nt = Y("Play", [
|
|
215
215
|
["polygon", { points: "6 3 20 12 6 21 6 3", key: "1oa8hb" }]
|
|
216
216
|
]);
|
|
217
217
|
/**
|
|
@@ -220,7 +220,7 @@ const Bt = G("Play", [
|
|
|
220
220
|
* This source code is licensed under the ISC license.
|
|
221
221
|
* See the LICENSE file in the root directory of this source tree.
|
|
222
222
|
*/
|
|
223
|
-
const
|
|
223
|
+
const ut = Y("Search", [
|
|
224
224
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
225
225
|
["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
|
|
226
226
|
]);
|
|
@@ -230,7 +230,7 @@ const Je = G("Search", [
|
|
|
230
230
|
* This source code is licensed under the ISC license.
|
|
231
231
|
* See the LICENSE file in the root directory of this source tree.
|
|
232
232
|
*/
|
|
233
|
-
const
|
|
233
|
+
const Ft = Y("Send", [
|
|
234
234
|
[
|
|
235
235
|
"path",
|
|
236
236
|
{
|
|
@@ -246,7 +246,7 @@ const $t = G("Send", [
|
|
|
246
246
|
* This source code is licensed under the ISC license.
|
|
247
247
|
* See the LICENSE file in the root directory of this source tree.
|
|
248
248
|
*/
|
|
249
|
-
const
|
|
249
|
+
const Kt = Y("SlidersHorizontal", [
|
|
250
250
|
["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
|
|
251
251
|
["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
|
|
252
252
|
["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
|
|
@@ -263,7 +263,7 @@ const Lt = G("SlidersHorizontal", [
|
|
|
263
263
|
* This source code is licensed under the ISC license.
|
|
264
264
|
* See the LICENSE file in the root directory of this source tree.
|
|
265
265
|
*/
|
|
266
|
-
const
|
|
266
|
+
const qt = Y("Smile", [
|
|
267
267
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
268
268
|
["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
|
|
269
269
|
["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
|
|
@@ -275,7 +275,30 @@ const Mt = G("Smile", [
|
|
|
275
275
|
* This source code is licensed under the ISC license.
|
|
276
276
|
* See the LICENSE file in the root directory of this source tree.
|
|
277
277
|
*/
|
|
278
|
-
const
|
|
278
|
+
const Vt = Y("UserCheck", [
|
|
279
|
+
["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
|
|
280
|
+
["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
|
|
281
|
+
["polyline", { points: "16 11 18 13 22 9", key: "1pwet4" }]
|
|
282
|
+
]);
|
|
283
|
+
/**
|
|
284
|
+
* @license lucide-react v0.468.0 - ISC
|
|
285
|
+
*
|
|
286
|
+
* This source code is licensed under the ISC license.
|
|
287
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
288
|
+
*/
|
|
289
|
+
const ft = Y("UserPlus", [
|
|
290
|
+
["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
|
|
291
|
+
["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
|
|
292
|
+
["line", { x1: "19", x2: "19", y1: "8", y2: "14", key: "1bvyxn" }],
|
|
293
|
+
["line", { x1: "22", x2: "16", y1: "11", y2: "11", key: "1shjgl" }]
|
|
294
|
+
]);
|
|
295
|
+
/**
|
|
296
|
+
* @license lucide-react v0.468.0 - ISC
|
|
297
|
+
*
|
|
298
|
+
* This source code is licensed under the ISC license.
|
|
299
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
+
*/
|
|
301
|
+
const Ue = Y("X", [
|
|
279
302
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
280
303
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
281
304
|
]);
|
|
@@ -285,7 +308,7 @@ const je = G("X", [
|
|
|
285
308
|
* This source code is licensed under the ISC license.
|
|
286
309
|
* See the LICENSE file in the root directory of this source tree.
|
|
287
310
|
*/
|
|
288
|
-
const
|
|
311
|
+
const Gt = Y("Zap", [
|
|
289
312
|
[
|
|
290
313
|
"path",
|
|
291
314
|
{
|
|
@@ -294,21 +317,30 @@ const Ht = G("Zap", [
|
|
|
294
317
|
}
|
|
295
318
|
]
|
|
296
319
|
]);
|
|
297
|
-
class
|
|
320
|
+
class it {
|
|
298
321
|
constructor(i, r) {
|
|
299
322
|
this.apiUrl = i, this.token = r;
|
|
300
323
|
}
|
|
301
324
|
async request(i, r, o) {
|
|
302
|
-
const
|
|
325
|
+
const h = {
|
|
303
326
|
authorization: `Bearer ${this.token}`,
|
|
304
327
|
...o ? {} : { "content-type": "application/json" },
|
|
305
328
|
...r == null ? void 0 : r.headers
|
|
306
|
-
},
|
|
329
|
+
}, S = await fetch(`${this.apiUrl}${i}`, {
|
|
307
330
|
...r,
|
|
308
|
-
headers:
|
|
309
|
-
}),
|
|
310
|
-
if (!
|
|
311
|
-
return
|
|
331
|
+
headers: h
|
|
332
|
+
}), m = await S.json().catch(() => null);
|
|
333
|
+
if (!S.ok) throw new Error((m == null ? void 0 : m.message) ?? `Request failed (${S.status})`);
|
|
334
|
+
return m;
|
|
335
|
+
}
|
|
336
|
+
getSessionMe() {
|
|
337
|
+
return this.request("/v1/auth/session/me");
|
|
338
|
+
}
|
|
339
|
+
assignConversation(i, r) {
|
|
340
|
+
return this.request(`/v1/conversations/${encodeURIComponent(i)}/assignee`, {
|
|
341
|
+
method: "PATCH",
|
|
342
|
+
body: JSON.stringify({ agent: r })
|
|
343
|
+
});
|
|
312
344
|
}
|
|
313
345
|
listConnections() {
|
|
314
346
|
return this.request("/v1/connections");
|
|
@@ -365,38 +397,38 @@ class st {
|
|
|
365
397
|
}
|
|
366
398
|
connectSSE(i) {
|
|
367
399
|
const r = `${this.apiUrl}/v1/events?token=${encodeURIComponent(this.token)}`;
|
|
368
|
-
let o,
|
|
369
|
-
const
|
|
370
|
-
o = new EventSource(r), o.addEventListener("message.new", (
|
|
371
|
-
i("message.new", JSON.parse(
|
|
372
|
-
}), o.addEventListener("conversation.updated", (
|
|
373
|
-
i("conversation.updated", JSON.parse(
|
|
400
|
+
let o, h, S = !1;
|
|
401
|
+
const m = () => {
|
|
402
|
+
o = new EventSource(r), o.addEventListener("message.new", (M) => {
|
|
403
|
+
i("message.new", JSON.parse(M.data));
|
|
404
|
+
}), o.addEventListener("conversation.updated", (M) => {
|
|
405
|
+
i("conversation.updated", JSON.parse(M.data));
|
|
374
406
|
}), o.onerror = () => {
|
|
375
|
-
o.close(),
|
|
407
|
+
o.close(), S || (h = setTimeout(m, 5e3));
|
|
376
408
|
};
|
|
377
409
|
};
|
|
378
|
-
return
|
|
379
|
-
|
|
410
|
+
return m(), () => {
|
|
411
|
+
S = !0, clearTimeout(h), o == null || o.close();
|
|
380
412
|
};
|
|
381
413
|
}
|
|
382
414
|
}
|
|
383
|
-
function
|
|
415
|
+
function dt({ src: t, alt: i = "", fallback: r, style: o }) {
|
|
384
416
|
return t ? /* @__PURE__ */ e("img", { src: t, alt: i, style: { width: 38, height: 38, borderRadius: "50%", objectFit: "cover", ...o } }) : /* @__PURE__ */ e("span", { style: { display: "grid", placeItems: "center", width: 38, height: 38, borderRadius: "50%", ...o }, children: r });
|
|
385
417
|
}
|
|
386
|
-
function
|
|
418
|
+
function Xt({ variant: t = "ghost", style: i, ...r }) {
|
|
387
419
|
return /* @__PURE__ */ e("button", { ...r, style: { display: "inline-flex", alignItems: "center", justifyContent: "center", border: t === "outline" ? "1px solid #e7ebf2" : 0, borderRadius: 8, cursor: "pointer", font: "inherit", background: t === "default" ? "#2563eb" : "transparent", ...i } });
|
|
388
420
|
}
|
|
389
|
-
function
|
|
421
|
+
function Yt({ style: t, ...i }) {
|
|
390
422
|
return /* @__PURE__ */ e("input", { ...i, style: { width: "100%", minWidth: 0, border: 0, outline: 0, background: "transparent", font: "inherit", ...t } });
|
|
391
423
|
}
|
|
392
|
-
const
|
|
424
|
+
const Rt = Pe(
|
|
393
425
|
({ children: t, style: i }, r) => /* @__PURE__ */ e("div", { ref: r, style: { minHeight: 0, overflowY: "auto", overscrollBehavior: "contain", ...i }, children: t })
|
|
394
|
-
),
|
|
426
|
+
), Jt = Pe(
|
|
395
427
|
function({ style: i, ...r }, o) {
|
|
396
428
|
return /* @__PURE__ */ e("textarea", { ref: o, ...r, style: { display: "block", width: "100%", minWidth: 0, boxSizing: "border-box", resize: "vertical", border: 0, outline: 0, background: "transparent", font: "inherit", ...i } });
|
|
397
429
|
}
|
|
398
430
|
);
|
|
399
|
-
function
|
|
431
|
+
function Zt(t) {
|
|
400
432
|
return {
|
|
401
433
|
id: t.contactId ?? t.providerConversationKey,
|
|
402
434
|
name: t.contactName,
|
|
@@ -405,10 +437,10 @@ function Ot(t) {
|
|
|
405
437
|
...t.contactExternalId ? { externalId: t.contactExternalId } : {}
|
|
406
438
|
};
|
|
407
439
|
}
|
|
408
|
-
function
|
|
440
|
+
function Je(t, i) {
|
|
409
441
|
return {
|
|
410
442
|
conversation: t,
|
|
411
|
-
contact:
|
|
443
|
+
contact: Zt(t),
|
|
412
444
|
provider: i == null ? void 0 : i.provider,
|
|
413
445
|
recentMessages: i == null ? void 0 : i.recentMessages,
|
|
414
446
|
linkContact: (i == null ? void 0 : i.linkContact) ?? (async () => {
|
|
@@ -419,7 +451,7 @@ function Ae(t, i) {
|
|
|
419
451
|
})
|
|
420
452
|
};
|
|
421
453
|
}
|
|
422
|
-
class
|
|
454
|
+
class _t extends Lt {
|
|
423
455
|
constructor() {
|
|
424
456
|
super(...arguments), this.state = { caught: !1 };
|
|
425
457
|
}
|
|
@@ -430,33 +462,33 @@ class Dt extends xt {
|
|
|
430
462
|
return this.state.caught ? null : this.props.children;
|
|
431
463
|
}
|
|
432
464
|
}
|
|
433
|
-
const d = { ink: "#172033", muted: "#718096", line: "#e7ebf2", surface: "#f7f9fc", white: "#fff" },
|
|
465
|
+
const d = { ink: "#172033", muted: "#718096", line: "#e7ebf2", surface: "#f7f9fc", white: "#fff" }, gt = [
|
|
434
466
|
{ icon: "😊", emojis: ["😀", "😁", "😂", "🤣", "😊", "😇", "🙂", "😉", "😍", "🥰", "😘", "😋", "😎", "🤩", "😏", "😒", "😔", "😢", "😭", "😤", "😠", "🤯", "😱", "🥳", "😴", "🤔", "🤗", "🫡", "😮", "🤧", "🥺", "😶", "🫠", "🤭", "🤫"] },
|
|
435
467
|
{ icon: "👋", emojis: ["👍", "👎", "👏", "🙏", "🤝", "✌️", "🤞", "🫡", "💪", "🤜", "👊", "✊", "🖐", "👌", "🤌", "🤏", "☝️", "👆", "👇", "👉", "👈", "🤙", "💅", "🫶", "❤️", "🧡", "💛", "💚", "💙", "💜", "🖤", "💔", "❣️", "💕", "💯"] },
|
|
436
468
|
{ icon: "🐱", emojis: ["🐶", "🐱", "🐭", "🐹", "🐰", "🦊", "🐻", "🐼", "🐨", "🐯", "🦁", "🐮", "🐷", "🐸", "🐵", "🙈", "🐔", "🐧", "🐦", "🦆", "🦅", "🦉", "🦋", "🐝", "🐛", "🐢", "🦎", "🐬", "🦈", "🐳", "🐙", "🦑"] },
|
|
437
469
|
{ icon: "🍕", emojis: ["🍎", "🍊", "🍋", "🍇", "🍓", "🍒", "🥝", "🥑", "🍔", "🍕", "🌮", "🍜", "🍣", "🍦", "🎂", "🍰", "🧁", "☕", "🧋", "🥤", "🍺", "🥂", "🍾", "🧃", "🧊"] },
|
|
438
470
|
{ icon: "⚽", emojis: ["⚽", "🏀", "🏈", "⚾", "🎾", "🏐", "🏓", "🎮", "🎲", "🎯", "🎳", "🏆", "🥇", "🎖", "🎁", "🎉", "🎊", "🎈", "🎭", "🎨", "🎬", "🎵", "🎸", "🎹", "🎺", "🪗", "🎻"] },
|
|
439
471
|
{ icon: "🌍", emojis: ["🌍", "🌈", "⭐", "🌙", "☀️", "⛅", "🌊", "🔥", "💧", "🌿", "🌸", "🌺", "🌻", "🍀", "🌴", "🏔", "🏖", "🏕", "🌃", "🏙", "🌅", "🌄", "🌠", "🌌", "🌋", "🏝"] }
|
|
440
|
-
],
|
|
441
|
-
function
|
|
472
|
+
], st = wt(""), Tt = wt("");
|
|
473
|
+
function Qt() {
|
|
442
474
|
try {
|
|
443
475
|
const t = new AudioContext(), i = t.createOscillator(), r = t.createGain();
|
|
444
476
|
i.connect(r), r.connect(t.destination), i.type = "sine", i.frequency.setValueAtTime(880, t.currentTime), i.frequency.exponentialRampToValueAtTime(660, t.currentTime + 0.12), r.gain.setValueAtTime(0.25, t.currentTime), r.gain.exponentialRampToValueAtTime(1e-3, t.currentTime + 0.35), i.start(t.currentTime), i.stop(t.currentTime + 0.35);
|
|
445
477
|
} catch {
|
|
446
478
|
}
|
|
447
479
|
}
|
|
448
|
-
function
|
|
480
|
+
function en(t) {
|
|
449
481
|
if (!(t != null && t.metadata)) return;
|
|
450
482
|
const i = t.metadata, r = i.pageName ?? i.displayName ?? i.username ?? i.name;
|
|
451
483
|
return typeof r == "string" && r ? r : void 0;
|
|
452
484
|
}
|
|
453
|
-
function
|
|
485
|
+
function Wt(t) {
|
|
454
486
|
return t === "facebook" ? "Facebook Messenger" : t === "instagram" ? "Instagram" : t === "telegram" ? "Telegram" : t === "zalo" ? "Zalo OA" : t === "livechat" ? "Live Chat" : "Channel";
|
|
455
487
|
}
|
|
456
|
-
function
|
|
488
|
+
function yt(t) {
|
|
457
489
|
return t === "facebook" ? "Facebook" : t === "instagram" ? "Instagram" : t === "telegram" ? "Telegram" : t === "zalo" ? "Zalo" : t === "livechat" ? "Live Chat" : String(t ?? "");
|
|
458
490
|
}
|
|
459
|
-
const
|
|
491
|
+
const tn = (t) => {
|
|
460
492
|
var r;
|
|
461
493
|
const i = {
|
|
462
494
|
"application/pdf": "PDF",
|
|
@@ -467,85 +499,122 @@ const Nt = (t) => {
|
|
|
467
499
|
};
|
|
468
500
|
return t ? i[t] ?? ((r = t.split("/")[1]) == null ? void 0 : r.toUpperCase()) ?? "Tệp" : "Tệp đính kèm";
|
|
469
501
|
};
|
|
470
|
-
function
|
|
471
|
-
return t === "read" ? /* @__PURE__ */ e(
|
|
502
|
+
function bt({ status: t }) {
|
|
503
|
+
return t === "read" ? /* @__PURE__ */ e(ht, { size: 11, strokeWidth: 2, style: { display: "inline", verticalAlign: "middle" } }) : t === "delivered" ? /* @__PURE__ */ e(ht, { size: 11, strokeWidth: 2, style: { display: "inline", verticalAlign: "middle", opacity: 0.5 } }) : t === "sent" ? /* @__PURE__ */ e(lt, { size: 11, strokeWidth: 2, style: { display: "inline", verticalAlign: "middle" } }) : null;
|
|
504
|
+
}
|
|
505
|
+
function rt(t) {
|
|
506
|
+
const i = t.trim().split(/\s+/).filter(Boolean);
|
|
507
|
+
return i.length <= 2 ? t.trim() : i.slice(-2).join(" ");
|
|
472
508
|
}
|
|
473
|
-
const
|
|
474
|
-
var
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
var
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
509
|
+
const Wn = Pe(function({ apiUrl: i, token: r, theme: o, height: h, defaultConversationId: S, disableAttachments: m, disableNotificationSound: M, hideKeyboardHint: w, locale: v = "vi", extensions: W, currentAgent: T, teamAgents: j, onNewMessage: $, onConversationSelect: C }, D) {
|
|
510
|
+
var k, A, K, U, re;
|
|
511
|
+
const I = J(new it(i, r)), [L, P] = y([]), [q, te] = y([]), [Q, B] = y(), [x, b] = y(), E = J(void 0), [V, ne] = y(""), [de, z] = y("all"), [oe, Z] = y(null), [O, ee] = y({ provider: "all", unreadOnly: !1 }), [se, c] = y(!1), H = J(null), N = J(null), [ae, ce] = y(null), [ye, F] = y(!0), [he, Se] = y(""), [Me, He] = y(() => !!(W != null && W.length)), [Ae, Ce] = y(280), [ve, Ie] = y(!1), [Ne, me] = y(0), _ = (o == null ? void 0 : o.primaryColor) ?? "#2563eb", ue = $e(() => new Map(q.map((l) => [l.id, l])), [q]), ze = J(null), [Fe, je] = y(0), G = T ?? oe ?? null;
|
|
512
|
+
X(() => {
|
|
513
|
+
I.current = new it(i, r), T || I.current.getSessionMe().then((l) => {
|
|
514
|
+
l != null && l.agent && Z(l.agent);
|
|
515
|
+
}).catch(() => {
|
|
516
|
+
});
|
|
517
|
+
}, [i, r, T]);
|
|
518
|
+
const Ke = $e(() => {
|
|
519
|
+
var p;
|
|
520
|
+
const l = /* @__PURE__ */ new Map();
|
|
521
|
+
G != null && G.id && l.set(G.id, G);
|
|
522
|
+
for (const u of j ?? [])
|
|
523
|
+
u != null && u.id && !l.has(u.id) && l.set(u.id, u);
|
|
524
|
+
for (const u of L)
|
|
525
|
+
(p = u.assignedAgent) != null && p.id && !l.has(u.assignedAgent.id) && l.set(u.assignedAgent.id, u.assignedAgent);
|
|
526
|
+
return [...l.values()];
|
|
527
|
+
}, [G, j, L]), qe = we(async (l, p) => {
|
|
528
|
+
P((u) => u.map((R) => R.id === l.id ? { ...R, assignedAgent: p } : R)), b((u) => u && u.id === l.id ? { ...u, assignedAgent: p } : u), me((u) => u + 1);
|
|
529
|
+
try {
|
|
530
|
+
const u = await I.current.assignConversation(l.id, p);
|
|
531
|
+
P((R) => R.map((le) => le.id === l.id ? { ...le, ...u, assignedAgent: u.assignedAgent ?? p } : le)), b((R) => R && R.id === l.id ? { ...R, ...u, assignedAgent: u.assignedAgent ?? p } : R), me((R) => R + 1);
|
|
532
|
+
} catch {
|
|
533
|
+
}
|
|
534
|
+
}, []), ke = we(async (l, p) => {
|
|
535
|
+
l.contactId && await I.current.patchContact(l.contactId, p), P((u) => u.map((R) => R.id === l.id ? { ...R, contactExternalId: p ?? void 0 } : R)), b((u) => u && u.id === l.id ? { ...u, contactExternalId: p ?? void 0 } : u), me((u) => u + 1);
|
|
536
|
+
}, []), fe = we(() => {
|
|
537
|
+
me((l) => l + 1);
|
|
538
|
+
}, []), Ve = $e(() => {
|
|
539
|
+
const l = new Set(q.map((p) => p.provider));
|
|
540
|
+
return ["facebook", "instagram", "telegram", "zalo", "livechat"].filter((p) => l.has(p));
|
|
541
|
+
}, [q]), Ge = $e(() => {
|
|
542
|
+
var p;
|
|
543
|
+
const l = {};
|
|
544
|
+
for (const u of L) {
|
|
545
|
+
const R = ((p = ue.get(u.connectionId)) == null ? void 0 : p.provider) ?? "unknown";
|
|
546
|
+
l[R] = (l[R] ?? 0) + 1;
|
|
488
547
|
}
|
|
489
|
-
return
|
|
490
|
-
}, [
|
|
491
|
-
function
|
|
492
|
-
const
|
|
493
|
-
|
|
494
|
-
function
|
|
495
|
-
const
|
|
496
|
-
|
|
548
|
+
return l;
|
|
549
|
+
}, [L, ue]);
|
|
550
|
+
function Ze(l) {
|
|
551
|
+
const p = l.clientX, u = Ae;
|
|
552
|
+
Ie(!0), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
553
|
+
function R(We) {
|
|
554
|
+
const Ee = Math.max(200, Math.min(480, u + (p - We.clientX)));
|
|
555
|
+
Ce(Ee);
|
|
497
556
|
}
|
|
498
|
-
function
|
|
499
|
-
|
|
557
|
+
function le() {
|
|
558
|
+
Ie(!1), document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", le);
|
|
500
559
|
}
|
|
501
|
-
document.addEventListener("mousemove",
|
|
560
|
+
document.addEventListener("mousemove", R), document.addEventListener("mouseup", le);
|
|
502
561
|
}
|
|
503
|
-
const
|
|
562
|
+
const pe = we(async (l) => {
|
|
504
563
|
try {
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
} catch (
|
|
508
|
-
|
|
564
|
+
const p = await I.current.listConversations(l);
|
|
565
|
+
P((u) => l ? [...u, ...p.items] : p.items), B(p.nextCursor), !l && p.items.length && b((u) => u ?? (S ? p.items.find((R) => R.id === S) ?? p.items[0] : p.items[0])), Se("");
|
|
566
|
+
} catch (p) {
|
|
567
|
+
Se(p instanceof Error ? p.message : "Không tải được hội thoại");
|
|
509
568
|
} finally {
|
|
510
|
-
|
|
569
|
+
F(!1);
|
|
511
570
|
}
|
|
512
|
-
}, [
|
|
513
|
-
|
|
514
|
-
}),
|
|
515
|
-
if (
|
|
516
|
-
if (
|
|
517
|
-
const
|
|
518
|
-
if ((
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
|
|
571
|
+
}, [S]);
|
|
572
|
+
X(() => (I.current.listConnections().then(te).catch(() => {
|
|
573
|
+
}), pe(), I.current.connectSSE((p, u) => {
|
|
574
|
+
if (p === "message.new" || p === "conversation.updated") {
|
|
575
|
+
if (pe(), p === "message.new") {
|
|
576
|
+
const R = typeof u == "object" && u ? u : {}, le = R.conversationId ? String(R.conversationId) : "", We = R.messageId ? String(R.messageId) : "";
|
|
577
|
+
if ((R.direction ? String(R.direction) : "") === "inbound" && !M && Qt(), le && le === E.current && We && ze.current) {
|
|
578
|
+
const Xe = ze.current;
|
|
579
|
+
I.current.getMessage(We).then((Ye) => {
|
|
580
|
+
Xe(Ye);
|
|
522
581
|
}).catch(() => {
|
|
523
582
|
});
|
|
524
583
|
}
|
|
525
|
-
|
|
584
|
+
$ == null || $(le || E.current || "");
|
|
526
585
|
}
|
|
527
|
-
} else
|
|
528
|
-
})), [
|
|
529
|
-
|
|
530
|
-
}, [
|
|
531
|
-
|
|
586
|
+
} else p === "message.status_updated" && je((R) => R + 1);
|
|
587
|
+
})), [pe, $]), X(() => {
|
|
588
|
+
E.current = x == null ? void 0 : x.id;
|
|
589
|
+
}, [x]), X(() => {
|
|
590
|
+
x != null && x.unreadCount && I.current.markRead(x.id).then(() => pe()).catch(() => {
|
|
532
591
|
});
|
|
533
|
-
}, [
|
|
534
|
-
if (!
|
|
535
|
-
function
|
|
536
|
-
var
|
|
537
|
-
(
|
|
592
|
+
}, [x == null ? void 0 : x.id]), X(() => {
|
|
593
|
+
if (!se) return;
|
|
594
|
+
function l(p) {
|
|
595
|
+
var u, R;
|
|
596
|
+
(u = H.current) != null && u.contains(p.target) || (R = N.current) != null && R.contains(p.target) || c(!1);
|
|
538
597
|
}
|
|
539
|
-
return document.addEventListener("mousedown",
|
|
540
|
-
}, [
|
|
541
|
-
const
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
598
|
+
return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
|
|
599
|
+
}, [se]);
|
|
600
|
+
const be = $e(() => {
|
|
601
|
+
const l = G ? L.filter((u) => {
|
|
602
|
+
var R;
|
|
603
|
+
return ((R = u.assignedAgent) == null ? void 0 : R.id) === G.id;
|
|
604
|
+
}).length : 0, p = L.filter((u) => !u.assignedAgent).length;
|
|
605
|
+
return { all: L.length, mine: l, unassigned: p };
|
|
606
|
+
}, [L, G]), Re = $e(() => {
|
|
607
|
+
const l = V.toLowerCase().trim();
|
|
608
|
+
return L.filter((p) => {
|
|
609
|
+
var Ee, Xe, Ye;
|
|
610
|
+
if (de === "mine") {
|
|
611
|
+
if (!G || ((Ee = p.assignedAgent) == null ? void 0 : Ee.id) !== G.id) return !1;
|
|
612
|
+
} else if (de === "unassigned" && p.assignedAgent)
|
|
613
|
+
return !1;
|
|
614
|
+
const u = `${p.contactName ?? ""} ${p.subject ?? ""} ${p.providerConversationKey} ${((Xe = p.assignedAgent) == null ? void 0 : Xe.name) ?? ""}`.toLowerCase(), R = ((Ye = ue.get(p.connectionId)) == null ? void 0 : Ye.provider) ?? "unknown", le = O.provider === "all" || R === O.provider, We = !O.unreadOnly || (p.unreadCount ?? 0) > 0;
|
|
615
|
+
return le && We && (!l || u.includes(l));
|
|
547
616
|
});
|
|
548
|
-
}, [
|
|
617
|
+
}, [L, ue, O, V, de, G]), Te = O.provider !== "all" || O.unreadOnly, a = v === "en" ? {
|
|
549
618
|
today: "TODAY",
|
|
550
619
|
loadOlder: "↑ Load older messages",
|
|
551
620
|
loading: "Loading messages…",
|
|
@@ -566,383 +635,764 @@ const yn = Le(function({ apiUrl: i, token: r, theme: o, height: s, defaultConver
|
|
|
566
635
|
send: "Gửi",
|
|
567
636
|
all: "Tất cả"
|
|
568
637
|
};
|
|
569
|
-
|
|
570
|
-
openConversation: (
|
|
571
|
-
const
|
|
572
|
-
|
|
638
|
+
Bt(D, () => ({
|
|
639
|
+
openConversation: (l) => {
|
|
640
|
+
const p = L.find((u) => u.id === l);
|
|
641
|
+
p && b(p);
|
|
573
642
|
},
|
|
574
|
-
refresh: () => void
|
|
575
|
-
}), [
|
|
576
|
-
const
|
|
577
|
-
...
|
|
578
|
-
height:
|
|
579
|
-
...
|
|
643
|
+
refresh: () => void pe()
|
|
644
|
+
}), [L, pe]);
|
|
645
|
+
const g = {
|
|
646
|
+
...f.frame,
|
|
647
|
+
height: h ?? 620,
|
|
648
|
+
...h ? { maxHeight: "none" } : {},
|
|
580
649
|
fontFamily: (o == null ? void 0 : o.fontFamily) ?? "Inter, ui-sans-serif, system-ui, sans-serif",
|
|
581
650
|
borderRadius: (o == null ? void 0 : o.borderRadius) ?? "16px",
|
|
582
|
-
gridTemplateColumns:
|
|
583
|
-
transition:
|
|
651
|
+
gridTemplateColumns: Me ? `minmax(260px, 300px) minmax(0, 1fr) ${Ae}px` : "minmax(260px, 300px) minmax(0, 1fr)",
|
|
652
|
+
transition: ve ? "none" : "grid-template-columns 220ms ease"
|
|
584
653
|
};
|
|
585
|
-
return
|
|
586
|
-
/* @__PURE__ */ e(
|
|
654
|
+
return ye ? /* @__PURE__ */ n("div", { style: { ...f.state, borderRadius: (o == null ? void 0 : o.borderRadius) ?? "16px" }, children: [
|
|
655
|
+
/* @__PURE__ */ e(ot, {}),
|
|
587
656
|
" Đang tải hộp thư…"
|
|
588
|
-
] }) :
|
|
589
|
-
/* @__PURE__ */ e(
|
|
657
|
+
] }) : he && !L.length ? /* @__PURE__ */ n("div", { style: { ...f.state, color: "#b42318", borderRadius: (o == null ? void 0 : o.borderRadius) ?? "16px" }, children: [
|
|
658
|
+
/* @__PURE__ */ e(Et, { size: 16, strokeWidth: 2 }),
|
|
590
659
|
" ",
|
|
591
|
-
|
|
592
|
-
/* @__PURE__ */ e("button", { style:
|
|
593
|
-
|
|
660
|
+
he,
|
|
661
|
+
/* @__PURE__ */ e("button", { style: f.retry, onClick: () => {
|
|
662
|
+
F(!0), pe();
|
|
594
663
|
}, children: "Thử lại" })
|
|
595
|
-
] }) : /* @__PURE__ */ e(
|
|
596
|
-
const
|
|
664
|
+
] }) : /* @__PURE__ */ e(st.Provider, { value: i, children: /* @__PURE__ */ e(Tt.Provider, { value: r, children: /* @__PURE__ */ n("div", { style: g, onFocusCapture: () => {
|
|
665
|
+
const l = window.scrollY;
|
|
597
666
|
requestAnimationFrame(() => {
|
|
598
|
-
window.scrollY !==
|
|
667
|
+
window.scrollY !== l && window.scrollTo({ top: l, behavior: "instant" });
|
|
599
668
|
});
|
|
600
669
|
}, children: [
|
|
601
|
-
/* @__PURE__ */ n("aside", { style:
|
|
602
|
-
/* @__PURE__ */ n("div", { style:
|
|
603
|
-
/* @__PURE__ */ e("div", { style: { ...
|
|
670
|
+
/* @__PURE__ */ n("aside", { style: f.sidebar, children: [
|
|
671
|
+
/* @__PURE__ */ n("div", { style: f.brand, children: [
|
|
672
|
+
/* @__PURE__ */ e("div", { style: { ...f.brandMark, background: _, overflow: "hidden", padding: 0 }, children: (k = o == null ? void 0 : o.branding) != null && k.logoUrl ? /* @__PURE__ */ e("img", { src: o.branding.logoUrl, alt: "", style: { width: "100%", height: "100%", objectFit: "cover" } }) : ((A = o == null ? void 0 : o.branding) == null ? void 0 : A.mark) ?? "C" }),
|
|
604
673
|
/* @__PURE__ */ n("div", { children: [
|
|
605
|
-
/* @__PURE__ */ e("strong", { children: ((
|
|
606
|
-
!((
|
|
674
|
+
/* @__PURE__ */ e("strong", { children: ((K = o == null ? void 0 : o.branding) == null ? void 0 : K.name) ?? "Hộp thư" }),
|
|
675
|
+
!((U = o == null ? void 0 : o.branding) != null && U.name) && /* @__PURE__ */ e("span", { style: f.eyebrow, children: "CHANNELHUB" })
|
|
607
676
|
] }),
|
|
608
|
-
/* @__PURE__ */ e(
|
|
677
|
+
/* @__PURE__ */ e(Xt, { "aria-label": "Tùy chọn", style: f.iconButton, children: /* @__PURE__ */ e(It, { size: 16, strokeWidth: 2 }) })
|
|
609
678
|
] }),
|
|
610
|
-
/* @__PURE__ */ n("div", { style:
|
|
611
|
-
/* @__PURE__ */ e(
|
|
612
|
-
/* @__PURE__ */ e(
|
|
613
|
-
|
|
679
|
+
/* @__PURE__ */ n("div", { style: f.search, children: [
|
|
680
|
+
/* @__PURE__ */ e(ut, { size: 16, strokeWidth: 2 }),
|
|
681
|
+
/* @__PURE__ */ e(Yt, { "aria-label": a.searchPlaceholder, value: V, onChange: (l) => ne(l.target.value), placeholder: a.searchPlaceholder }),
|
|
682
|
+
V && /* @__PURE__ */ e("button", { style: f.clear, onClick: () => ne(""), "aria-label": "Xóa tìm kiếm", children: "×" })
|
|
614
683
|
] }),
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
684
|
+
/* @__PURE__ */ e(
|
|
685
|
+
"div",
|
|
686
|
+
{
|
|
687
|
+
role: "tablist",
|
|
688
|
+
"aria-label": "Lọc theo người phụ trách",
|
|
689
|
+
style: {
|
|
690
|
+
display: "grid",
|
|
691
|
+
gridTemplateColumns: "repeat(3, 1fr)",
|
|
692
|
+
gap: 2,
|
|
693
|
+
margin: "0 14px 10px",
|
|
694
|
+
padding: 3,
|
|
695
|
+
borderRadius: 9,
|
|
696
|
+
border: `1px solid ${d.line}`,
|
|
697
|
+
background: d.surface
|
|
698
|
+
},
|
|
699
|
+
children: [
|
|
700
|
+
{ key: "all", label: v === "en" ? "All" : "Tất cả", count: be.all },
|
|
701
|
+
{ key: "mine", label: v === "en" ? "Mine" : "Của tôi", count: be.mine },
|
|
702
|
+
{ key: "unassigned", label: v === "en" ? "Unassigned" : "Chưa nhận", count: be.unassigned }
|
|
703
|
+
].map((l) => {
|
|
704
|
+
const p = de === l.key;
|
|
705
|
+
return /* @__PURE__ */ n(
|
|
706
|
+
"button",
|
|
707
|
+
{
|
|
708
|
+
type: "button",
|
|
709
|
+
role: "tab",
|
|
710
|
+
"aria-selected": p,
|
|
711
|
+
onClick: () => z(l.key),
|
|
712
|
+
style: {
|
|
713
|
+
border: 0,
|
|
714
|
+
borderRadius: 6,
|
|
715
|
+
padding: "5px 4px",
|
|
716
|
+
fontSize: 11,
|
|
717
|
+
fontWeight: p ? 700 : 500,
|
|
718
|
+
background: p ? d.white : "transparent",
|
|
719
|
+
color: p ? _ : d.muted,
|
|
720
|
+
boxShadow: p ? "0 1px 3px rgba(23,32,51,.08)" : "none",
|
|
721
|
+
cursor: "pointer",
|
|
722
|
+
whiteSpace: "nowrap",
|
|
723
|
+
overflow: "hidden",
|
|
724
|
+
textOverflow: "ellipsis",
|
|
725
|
+
transition: "all 120ms ease"
|
|
726
|
+
},
|
|
727
|
+
children: [
|
|
728
|
+
l.label,
|
|
729
|
+
" ",
|
|
730
|
+
/* @__PURE__ */ n("span", { style: { opacity: 0.75 }, children: [
|
|
731
|
+
"(",
|
|
732
|
+
l.count,
|
|
733
|
+
")"
|
|
734
|
+
] })
|
|
735
|
+
]
|
|
736
|
+
},
|
|
737
|
+
l.key
|
|
738
|
+
);
|
|
739
|
+
})
|
|
740
|
+
}
|
|
741
|
+
),
|
|
742
|
+
Te && /* @__PURE__ */ n("div", { style: { display: "flex", gap: 4, flexWrap: "wrap", padding: "0 14px 8px" }, children: [
|
|
743
|
+
O.provider !== "all" && /* @__PURE__ */ n("span", { style: { display: "inline-flex", alignItems: "center", gap: 4, background: "#eef2ff", color: _, borderRadius: 6, fontSize: 11, padding: "2px 8px", fontWeight: 500 }, children: [
|
|
744
|
+
/* @__PURE__ */ e(De, { provider: O.provider }),
|
|
745
|
+
yt(O.provider),
|
|
746
|
+
/* @__PURE__ */ e("button", { style: { border: 0, background: "none", cursor: "pointer", color: _, padding: 0, lineHeight: 1, display: "flex" }, onClick: () => ee((l) => ({ ...l, provider: "all" })), "aria-label": "Xóa filter kênh", children: /* @__PURE__ */ e(Ue, { size: 10 }) })
|
|
620
747
|
] }),
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
/* @__PURE__ */ e("button", { style: { border: 0, background: "none", cursor: "pointer", color:
|
|
748
|
+
O.unreadOnly && /* @__PURE__ */ n("span", { style: { display: "inline-flex", alignItems: "center", gap: 4, background: "#eef2ff", color: _, borderRadius: 6, fontSize: 11, padding: "2px 8px", fontWeight: 500 }, children: [
|
|
749
|
+
a.unreadOnly,
|
|
750
|
+
/* @__PURE__ */ e("button", { style: { border: 0, background: "none", cursor: "pointer", color: _, padding: 0, lineHeight: 1, display: "flex" }, onClick: () => ee((l) => ({ ...l, unreadOnly: !1 })), "aria-label": "Xóa filter chưa đọc", children: /* @__PURE__ */ e(Ue, { size: 10 }) })
|
|
624
751
|
] }),
|
|
625
|
-
/* @__PURE__ */ e("button", { style: { border: 0, background: "none", cursor: "pointer", color: d.muted, fontSize: 11, padding: "2px 4px" }, onClick: () =>
|
|
752
|
+
/* @__PURE__ */ e("button", { style: { border: 0, background: "none", cursor: "pointer", color: d.muted, fontSize: 11, padding: "2px 4px" }, onClick: () => ee({ provider: "all", unreadOnly: !1 }), children: "Xóa tất cả" })
|
|
626
753
|
] }),
|
|
627
|
-
/* @__PURE__ */ n("div", { style:
|
|
754
|
+
/* @__PURE__ */ n("div", { style: f.listHeader, children: [
|
|
628
755
|
/* @__PURE__ */ n("span", { children: [
|
|
629
|
-
|
|
756
|
+
Re.length,
|
|
630
757
|
" hội thoại"
|
|
631
758
|
] }),
|
|
632
759
|
/* @__PURE__ */ e(
|
|
633
760
|
"button",
|
|
634
761
|
{
|
|
635
|
-
ref:
|
|
636
|
-
style: { ...
|
|
762
|
+
ref: H,
|
|
763
|
+
style: { ...f.iconButton, background: Te ? `${_}14` : "transparent", color: Te ? _ : d.muted },
|
|
637
764
|
"aria-label": "Bộ lọc",
|
|
638
765
|
onClick: () => {
|
|
639
|
-
var
|
|
640
|
-
if (!
|
|
641
|
-
const
|
|
642
|
-
|
|
766
|
+
var l;
|
|
767
|
+
if (!se) {
|
|
768
|
+
const p = (l = H.current) == null ? void 0 : l.getBoundingClientRect();
|
|
769
|
+
p && ce({ top: p.bottom + 6, left: p.left });
|
|
643
770
|
}
|
|
644
|
-
|
|
771
|
+
c((p) => !p);
|
|
645
772
|
},
|
|
646
|
-
children: /* @__PURE__ */ e(
|
|
773
|
+
children: /* @__PURE__ */ e(Kt, { size: 15, strokeWidth: 2 })
|
|
647
774
|
}
|
|
648
775
|
)
|
|
649
776
|
] }),
|
|
650
|
-
|
|
777
|
+
se && ae && St(
|
|
651
778
|
/* @__PURE__ */ n(
|
|
652
779
|
"div",
|
|
653
780
|
{
|
|
654
|
-
ref:
|
|
655
|
-
style: { position: "fixed", top:
|
|
781
|
+
ref: N,
|
|
782
|
+
style: { position: "fixed", top: ae.top, left: ae.left, zIndex: 9999, background: d.white, border: `1px solid ${d.line}`, borderRadius: 10, padding: "12px 14px", boxShadow: "0 8px 24px rgba(23,32,51,.14)", minWidth: 210, fontFamily: (o == null ? void 0 : o.fontFamily) ?? "Inter, ui-sans-serif, system-ui, sans-serif", fontSize: 13 },
|
|
656
783
|
children: [
|
|
657
784
|
/* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, color: d.muted, letterSpacing: 1, textTransform: "uppercase", marginBottom: 8 }, children: "Kênh" }),
|
|
658
|
-
["all", ...
|
|
659
|
-
/* @__PURE__ */ e("input", { type: "radio", name: "provider-filter", checked:
|
|
660
|
-
|
|
661
|
-
|
|
785
|
+
["all", ...Ve].map((l) => /* @__PURE__ */ n("label", { style: { display: "flex", alignItems: "center", gap: 8, padding: "5px 6px", cursor: "pointer", borderRadius: 6, background: O.provider === l ? `${_}0f` : "transparent" }, children: [
|
|
786
|
+
/* @__PURE__ */ e("input", { type: "radio", name: "provider-filter", checked: O.provider === l, onChange: () => ee((p) => ({ ...p, provider: l })), style: { accentColor: _ } }),
|
|
787
|
+
l === "all" ? /* @__PURE__ */ n("span", { style: { color: d.ink }, children: [
|
|
788
|
+
a.all,
|
|
662
789
|
" (",
|
|
663
|
-
|
|
790
|
+
L.length,
|
|
664
791
|
")"
|
|
665
792
|
] }) : /* @__PURE__ */ n("span", { style: { display: "flex", alignItems: "center", gap: 5, color: d.ink }, children: [
|
|
666
|
-
/* @__PURE__ */ e(
|
|
667
|
-
|
|
793
|
+
/* @__PURE__ */ e(De, { provider: l }),
|
|
794
|
+
yt(l),
|
|
668
795
|
" ",
|
|
669
796
|
/* @__PURE__ */ n("span", { style: { color: d.muted }, children: [
|
|
670
797
|
"(",
|
|
671
|
-
|
|
798
|
+
Ge[l] ?? 0,
|
|
672
799
|
")"
|
|
673
800
|
] })
|
|
674
801
|
] })
|
|
675
|
-
] },
|
|
802
|
+
] }, l)),
|
|
676
803
|
/* @__PURE__ */ e("div", { style: { borderTop: `1px solid ${d.line}`, margin: "8px 0 6px" } }),
|
|
677
|
-
/* @__PURE__ */ n("label", { style: { display: "flex", alignItems: "center", gap: 8, padding: "5px 6px", cursor: "pointer", borderRadius: 6, background:
|
|
678
|
-
/* @__PURE__ */ e("input", { type: "checkbox", checked:
|
|
679
|
-
/* @__PURE__ */ e("span", { style: { color: d.ink }, children:
|
|
804
|
+
/* @__PURE__ */ n("label", { style: { display: "flex", alignItems: "center", gap: 8, padding: "5px 6px", cursor: "pointer", borderRadius: 6, background: O.unreadOnly ? `${_}0f` : "transparent" }, children: [
|
|
805
|
+
/* @__PURE__ */ e("input", { type: "checkbox", checked: O.unreadOnly, onChange: (l) => ee((p) => ({ ...p, unreadOnly: l.target.checked })), style: { accentColor: _ } }),
|
|
806
|
+
/* @__PURE__ */ e("span", { style: { color: d.ink }, children: a.unreadOnly })
|
|
680
807
|
] })
|
|
681
808
|
]
|
|
682
809
|
}
|
|
683
810
|
),
|
|
684
811
|
document.body
|
|
685
812
|
),
|
|
686
|
-
/* @__PURE__ */ n(
|
|
687
|
-
|
|
688
|
-
var
|
|
689
|
-
return /* @__PURE__ */ e(
|
|
690
|
-
|
|
813
|
+
/* @__PURE__ */ n(Rt, { style: f.conversationList, children: [
|
|
814
|
+
Re.map((l) => {
|
|
815
|
+
var p;
|
|
816
|
+
return /* @__PURE__ */ e(nn, { conversation: l, provider: (p = ue.get(l.connectionId)) == null ? void 0 : p.provider, selected: (x == null ? void 0 : x.id) === l.id, primary: _, currentAgent: G, onSelect: () => {
|
|
817
|
+
b(l), C == null || C(l.id), I.current.markRead(l.id).then(() => pe()).catch(() => {
|
|
691
818
|
});
|
|
692
|
-
} },
|
|
819
|
+
} }, l.id);
|
|
693
820
|
}),
|
|
694
|
-
!
|
|
695
|
-
/* @__PURE__ */ e("div", { style:
|
|
821
|
+
!Re.length && /* @__PURE__ */ n("div", { style: f.emptySmall, children: [
|
|
822
|
+
/* @__PURE__ */ e("div", { style: f.emptyIcon, children: /* @__PURE__ */ e(ut, { size: 16, strokeWidth: 2 }) }),
|
|
696
823
|
/* @__PURE__ */ e("strong", { children: "Không tìm thấy" }),
|
|
697
824
|
/* @__PURE__ */ e("span", { children: "Thử từ khóa hoặc bộ lọc khác." })
|
|
698
825
|
] }),
|
|
699
|
-
|
|
826
|
+
Q && /* @__PURE__ */ e("button", { style: f.loadMore, onClick: () => void pe(Q), children: "Xem thêm hội thoại" })
|
|
700
827
|
] })
|
|
701
828
|
] }),
|
|
702
|
-
/* @__PURE__ */ e("main", { style:
|
|
703
|
-
|
|
829
|
+
/* @__PURE__ */ e("main", { style: f.main, children: x ? /* @__PURE__ */ e(
|
|
830
|
+
rn,
|
|
704
831
|
{
|
|
705
|
-
conversation:
|
|
706
|
-
provider: (
|
|
707
|
-
connection:
|
|
708
|
-
client:
|
|
709
|
-
primary:
|
|
710
|
-
error:
|
|
711
|
-
onRegisterAppend: (
|
|
712
|
-
|
|
832
|
+
conversation: x,
|
|
833
|
+
provider: (re = ue.get(x.connectionId)) == null ? void 0 : re.provider,
|
|
834
|
+
connection: ue.get(x.connectionId),
|
|
835
|
+
client: I.current,
|
|
836
|
+
primary: _,
|
|
837
|
+
error: he,
|
|
838
|
+
onRegisterAppend: (l) => {
|
|
839
|
+
ze.current = l;
|
|
713
840
|
},
|
|
714
|
-
refreshKey:
|
|
715
|
-
infoOpen:
|
|
716
|
-
onToggleInfo: () =>
|
|
717
|
-
t:
|
|
718
|
-
disableAttachments:
|
|
719
|
-
hideKeyboardHint:
|
|
720
|
-
extensions:
|
|
721
|
-
|
|
722
|
-
|
|
841
|
+
refreshKey: Fe,
|
|
842
|
+
infoOpen: Me,
|
|
843
|
+
onToggleInfo: () => He((l) => !l),
|
|
844
|
+
t: a,
|
|
845
|
+
disableAttachments: m,
|
|
846
|
+
hideKeyboardHint: w,
|
|
847
|
+
extensions: W,
|
|
848
|
+
currentAgent: G,
|
|
849
|
+
teamAgents: Ke,
|
|
850
|
+
onAssignAgent: (l) => qe(x, l),
|
|
851
|
+
onLinkContact: (l) => ke(x, l),
|
|
852
|
+
onRefreshContactInfo: fe
|
|
723
853
|
},
|
|
724
|
-
|
|
725
|
-
) : /* @__PURE__ */ e(
|
|
726
|
-
|
|
727
|
-
|
|
854
|
+
x.id
|
|
855
|
+
) : /* @__PURE__ */ e(dn, {}) }),
|
|
856
|
+
Me && x && /* @__PURE__ */ e(
|
|
857
|
+
an,
|
|
728
858
|
{
|
|
729
|
-
conversation:
|
|
730
|
-
connection:
|
|
731
|
-
primary:
|
|
732
|
-
onClose: () =>
|
|
733
|
-
client:
|
|
734
|
-
onStartResize:
|
|
735
|
-
extensions:
|
|
736
|
-
extRefreshKey:
|
|
737
|
-
onLinkContact: (
|
|
738
|
-
onRefreshContactInfo:
|
|
859
|
+
conversation: x,
|
|
860
|
+
connection: ue.get(x.connectionId),
|
|
861
|
+
primary: _,
|
|
862
|
+
onClose: () => He(!1),
|
|
863
|
+
client: I.current,
|
|
864
|
+
onStartResize: Ze,
|
|
865
|
+
extensions: W,
|
|
866
|
+
extRefreshKey: Ne,
|
|
867
|
+
onLinkContact: (l) => ke(x, l),
|
|
868
|
+
onRefreshContactInfo: fe
|
|
739
869
|
}
|
|
740
870
|
)
|
|
741
871
|
] }) }) });
|
|
742
872
|
});
|
|
743
|
-
function
|
|
744
|
-
const [
|
|
745
|
-
let
|
|
746
|
-
r ?
|
|
747
|
-
const
|
|
748
|
-
...
|
|
749
|
-
background:
|
|
750
|
-
...r ? { boxShadow: `inset 3px 0 0 ${o}` } :
|
|
873
|
+
function nn({ conversation: t, provider: i, selected: r, primary: o, currentAgent: h, onSelect: S }) {
|
|
874
|
+
const [m, M] = y(!1), w = t.contactName ?? t.subject ?? t.providerConversationKey, v = t.unreadCount ?? 0, W = t.lastMessageText ?? "", T = t.lastMessageDirection === "outbound" ? "Bạn: " : "", j = W.length > 60 ? W.slice(0, 60) + "…" : W, $ = W ? T + j : "", C = t.assignedAgent ?? null, D = !!(C && h && C.id === h.id);
|
|
875
|
+
let I = "transparent";
|
|
876
|
+
r ? I = "#eef2ff" : m ? I = "#f7f9fc" : v > 0 && (I = "#f0f4ff");
|
|
877
|
+
const L = {
|
|
878
|
+
...f.row,
|
|
879
|
+
background: I,
|
|
880
|
+
...r ? { boxShadow: `inset 3px 0 0 ${o}` } : v > 0 && !m ? { boxShadow: `inset 3px 0 0 ${o}` } : {}
|
|
751
881
|
};
|
|
752
882
|
return /* @__PURE__ */ n(
|
|
753
883
|
"button",
|
|
754
884
|
{
|
|
755
|
-
onClick:
|
|
756
|
-
style:
|
|
757
|
-
onMouseEnter: () =>
|
|
758
|
-
onMouseLeave: () =>
|
|
885
|
+
onClick: S,
|
|
886
|
+
style: L,
|
|
887
|
+
onMouseEnter: () => M(!0),
|
|
888
|
+
onMouseLeave: () => M(!1),
|
|
759
889
|
children: [
|
|
760
|
-
/* @__PURE__ */ e(
|
|
761
|
-
/* @__PURE__ */ n("span", { style:
|
|
762
|
-
/* @__PURE__ */ n("span", { style:
|
|
763
|
-
/* @__PURE__ */ e("strong", { style: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", fontWeight:
|
|
890
|
+
/* @__PURE__ */ e($t, { name: w, color: o, image: t.contactPictureUrl, provider: i }),
|
|
891
|
+
/* @__PURE__ */ n("span", { style: f.rowBody, children: [
|
|
892
|
+
/* @__PURE__ */ n("span", { style: f.rowTop, children: [
|
|
893
|
+
/* @__PURE__ */ e("strong", { style: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", fontWeight: v > 0 ? 700 : 500 }, children: w }),
|
|
764
894
|
/* @__PURE__ */ n("span", { style: { display: "flex", alignItems: "center", gap: 4, flexShrink: 0 }, children: [
|
|
765
|
-
/* @__PURE__ */ e("time", { style: { color: d.muted, fontSize: 11, whiteSpace: "nowrap" }, children:
|
|
766
|
-
|
|
895
|
+
/* @__PURE__ */ e("time", { style: { color: d.muted, fontSize: 11, whiteSpace: "nowrap" }, children: at(t.lastMessageAt) }),
|
|
896
|
+
v > 0 && /* @__PURE__ */ e("span", { "aria-label": `${v} tin nhắn chưa đọc`, style: f.unreadBadge, children: v > 99 ? "99+" : v })
|
|
767
897
|
] })
|
|
768
898
|
] }),
|
|
769
|
-
/* @__PURE__ */
|
|
899
|
+
/* @__PURE__ */ n("span", { style: { ...f.rowBottom, justifyContent: "space-between", alignItems: "center", gap: 6, color: v > 0 && !r ? "#4a5568" : d.muted }, children: [
|
|
900
|
+
/* @__PURE__ */ e("span", { style: { flex: 1, minWidth: 0, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: $ || /* @__PURE__ */ e("span", { style: { opacity: 0.5 }, children: "Chưa có tin nhắn" }) }),
|
|
901
|
+
C ? /* @__PURE__ */ n(
|
|
902
|
+
"span",
|
|
903
|
+
{
|
|
904
|
+
title: `Phụ trách: ${C.name}${C.title ? ` (${C.title})` : ""}`,
|
|
905
|
+
style: {
|
|
906
|
+
display: "inline-flex",
|
|
907
|
+
alignItems: "center",
|
|
908
|
+
gap: 4,
|
|
909
|
+
padding: "1px 6px 1px 2px",
|
|
910
|
+
borderRadius: 999,
|
|
911
|
+
fontSize: 10,
|
|
912
|
+
fontWeight: 600,
|
|
913
|
+
flexShrink: 0,
|
|
914
|
+
background: D ? `${o}18` : "#f1f5f9",
|
|
915
|
+
color: D ? o : "#475569",
|
|
916
|
+
border: D ? `1px solid ${o}33` : "1px solid #e2e8f0"
|
|
917
|
+
},
|
|
918
|
+
children: [
|
|
919
|
+
/* @__PURE__ */ e(
|
|
920
|
+
"span",
|
|
921
|
+
{
|
|
922
|
+
style: {
|
|
923
|
+
width: 14,
|
|
924
|
+
height: 14,
|
|
925
|
+
borderRadius: "50%",
|
|
926
|
+
background: D ? o : "#64748b",
|
|
927
|
+
color: "#fff",
|
|
928
|
+
fontSize: 8,
|
|
929
|
+
fontWeight: 700,
|
|
930
|
+
display: "inline-grid",
|
|
931
|
+
placeItems: "center",
|
|
932
|
+
overflow: "hidden",
|
|
933
|
+
flexShrink: 0
|
|
934
|
+
},
|
|
935
|
+
children: C.avatarUrl ? /* @__PURE__ */ e("img", { src: C.avatarUrl, alt: "", style: { width: "100%", height: "100%", objectFit: "cover" } }) : Le(C.name)
|
|
936
|
+
}
|
|
937
|
+
),
|
|
938
|
+
/* @__PURE__ */ e("span", { style: { maxWidth: 68, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: rt(C.name) })
|
|
939
|
+
]
|
|
940
|
+
}
|
|
941
|
+
) : v > 0 ? /* @__PURE__ */ e(
|
|
942
|
+
"span",
|
|
943
|
+
{
|
|
944
|
+
style: {
|
|
945
|
+
display: "inline-flex",
|
|
946
|
+
alignItems: "center",
|
|
947
|
+
padding: "1px 6px",
|
|
948
|
+
borderRadius: 999,
|
|
949
|
+
fontSize: 9.5,
|
|
950
|
+
fontWeight: 600,
|
|
951
|
+
flexShrink: 0,
|
|
952
|
+
background: "#fef3c7",
|
|
953
|
+
color: "#b45309"
|
|
954
|
+
},
|
|
955
|
+
children: "Chưa nhận"
|
|
956
|
+
}
|
|
957
|
+
) : null
|
|
958
|
+
] })
|
|
770
959
|
] })
|
|
771
960
|
]
|
|
772
961
|
}
|
|
773
962
|
);
|
|
774
963
|
}
|
|
775
|
-
function
|
|
776
|
-
var
|
|
777
|
-
const [
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
var v, A;
|
|
784
|
-
(v = we.current) != null && v.contains(m.target) || (A = ye.current) != null && A.contains(m.target) || re(!1);
|
|
964
|
+
function rn({ conversation: t, provider: i, connection: r, client: o, primary: h, error: S, onRegisterAppend: m, refreshKey: M, infoOpen: w, onToggleInfo: v, t: W, disableAttachments: T, hideKeyboardHint: j, extensions: $, currentAgent: C, teamAgents: D, onAssignAgent: I, onLinkContact: L, onRefreshContactInfo: P }) {
|
|
965
|
+
var Re, Te;
|
|
966
|
+
const [q, te] = y([]), [Q, B] = y(), [x, b] = y(""), [E, V] = y(!0), [ne, de] = y(!1), [z, oe] = y(""), Z = J(null), O = t.contactName ?? t.subject ?? t.providerConversationKey, ee = J(null), se = J(null), [c, H] = y(null), [N, ae] = y(!1), [ce, ye] = y(!1), [F, he] = y(!1), [Se, Me] = y(0), He = J(null), Ae = J(null), Ce = J(null), [ve, Ie] = y(!1), [Ne, me] = y(""), [_, ue] = y([]), ze = J(null), Fe = J(null), [je, G] = y(!1), Ke = J(null), qe = J(null);
|
|
967
|
+
X(() => {
|
|
968
|
+
if (!je) return;
|
|
969
|
+
function a(g) {
|
|
970
|
+
var k, A;
|
|
971
|
+
(k = Ke.current) != null && k.contains(g.target) || (A = qe.current) != null && A.contains(g.target) || G(!1);
|
|
785
972
|
}
|
|
786
|
-
return document.addEventListener("mousedown",
|
|
787
|
-
}, [
|
|
788
|
-
|
|
973
|
+
return document.addEventListener("mousedown", a), () => document.removeEventListener("mousedown", a);
|
|
974
|
+
}, [je]), X(() => () => {
|
|
975
|
+
c != null && c.objectUrl && URL.revokeObjectURL(c.objectUrl);
|
|
976
|
+
}, [c == null ? void 0 : c.objectUrl]), X(() => {
|
|
977
|
+
if (!F) return;
|
|
978
|
+
function a(g) {
|
|
979
|
+
var k, A;
|
|
980
|
+
(k = Ae.current) != null && k.contains(g.target) || (A = He.current) != null && A.contains(g.target) || he(!1);
|
|
981
|
+
}
|
|
982
|
+
return document.addEventListener("mousedown", a), () => document.removeEventListener("mousedown", a);
|
|
983
|
+
}, [F]), X(() => {
|
|
984
|
+
o.listCannedResponses().then(ue).catch(() => {
|
|
789
985
|
});
|
|
790
|
-
}, [o]),
|
|
791
|
-
if (!
|
|
792
|
-
function
|
|
793
|
-
var
|
|
794
|
-
(
|
|
986
|
+
}, [o]), X(() => {
|
|
987
|
+
if (!ve) return;
|
|
988
|
+
function a(g) {
|
|
989
|
+
var k, A;
|
|
990
|
+
(k = Fe.current) != null && k.contains(g.target) || (A = ze.current) != null && A.contains(g.target) || Ie(!1);
|
|
795
991
|
}
|
|
796
|
-
return document.addEventListener("mousedown",
|
|
797
|
-
}, [
|
|
798
|
-
const
|
|
799
|
-
|
|
992
|
+
return document.addEventListener("mousedown", a), () => document.removeEventListener("mousedown", a);
|
|
993
|
+
}, [ve]);
|
|
994
|
+
const ke = J(!0), fe = we(async (a, g) => {
|
|
995
|
+
g || (ke.current = !a);
|
|
800
996
|
try {
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
} catch (
|
|
804
|
-
|
|
997
|
+
const k = await o.listMessages(t.id, a);
|
|
998
|
+
te((A) => a ? [...k.items, ...A] : k.items), B(k.nextCursor);
|
|
999
|
+
} catch (k) {
|
|
1000
|
+
oe(k instanceof Error ? k.message : "Không tải được tin nhắn");
|
|
805
1001
|
} finally {
|
|
806
|
-
|
|
1002
|
+
g || V(!1);
|
|
807
1003
|
}
|
|
808
1004
|
}, [o, t.id]);
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
}, [
|
|
812
|
-
|
|
813
|
-
}, [
|
|
814
|
-
|
|
815
|
-
const
|
|
816
|
-
|
|
1005
|
+
X(() => {
|
|
1006
|
+
V(!0), fe();
|
|
1007
|
+
}, [fe]), X(() => {
|
|
1008
|
+
M && fe(void 0, !0);
|
|
1009
|
+
}, [M]), X(() => {
|
|
1010
|
+
ke.current && requestAnimationFrame(() => {
|
|
1011
|
+
const a = Z.current;
|
|
1012
|
+
a && (a.scrollTop = a.scrollHeight);
|
|
817
1013
|
});
|
|
818
|
-
}, [
|
|
819
|
-
|
|
1014
|
+
}, [q]), X(() => (m == null || m((a) => {
|
|
1015
|
+
ke.current = !0, te((g) => g.some((k) => k.id === a.id) ? g : [...g, a]);
|
|
820
1016
|
}), () => {
|
|
821
|
-
|
|
822
|
-
}), [
|
|
823
|
-
async function
|
|
1017
|
+
m == null || m(null);
|
|
1018
|
+
}), [m]);
|
|
1019
|
+
async function Ve(a) {
|
|
824
1020
|
var A;
|
|
825
|
-
const
|
|
826
|
-
if (!
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
|
|
1021
|
+
const g = (A = a.target.files) == null ? void 0 : A[0];
|
|
1022
|
+
if (!g) return;
|
|
1023
|
+
a.target.value = "";
|
|
1024
|
+
const k = URL.createObjectURL(g);
|
|
1025
|
+
H({ file: g, uploading: !0, objectUrl: k });
|
|
830
1026
|
try {
|
|
831
|
-
const
|
|
832
|
-
|
|
1027
|
+
const K = await o.uploadAttachment(g);
|
|
1028
|
+
H({ file: g, uploading: !1, url: K.url, mimeType: K.mimeType, attachmentType: K.attachmentType, objectUrl: k });
|
|
833
1029
|
} catch {
|
|
834
|
-
URL.revokeObjectURL(
|
|
1030
|
+
URL.revokeObjectURL(k), H(null), oe("Không tải lên được tệp đính kèm");
|
|
835
1031
|
}
|
|
836
1032
|
}
|
|
837
|
-
async function
|
|
838
|
-
|
|
839
|
-
const
|
|
840
|
-
if (!
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
1033
|
+
async function Ge(a) {
|
|
1034
|
+
a.preventDefault();
|
|
1035
|
+
const g = x.trim(), k = c != null && c.url ? [{ url: c.url, mimeType: c.mimeType ?? "application/octet-stream", type: c.attachmentType }] : [];
|
|
1036
|
+
if (!g && !k.length || ne) return;
|
|
1037
|
+
de(!0), oe(""), !t.assignedAgent && C && I(C);
|
|
1038
|
+
const A = `optimistic-${Date.now()}`;
|
|
1039
|
+
C && (ke.current = !0, te((K) => [
|
|
1040
|
+
...K,
|
|
1041
|
+
{
|
|
1042
|
+
id: A,
|
|
1043
|
+
direction: "outbound",
|
|
1044
|
+
status: "sending",
|
|
1045
|
+
text: g || void 0,
|
|
1046
|
+
attachments: k.length ? k : void 0,
|
|
1047
|
+
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1048
|
+
senderAgent: C
|
|
848
1049
|
}
|
|
1050
|
+
]));
|
|
1051
|
+
try {
|
|
1052
|
+
await o.sendMessage(t.id, g || void 0, k.length ? k : void 0), c != null && c.objectUrl && URL.revokeObjectURL(c.objectUrl), b(""), H(null), await fe(), C && te((K) => {
|
|
1053
|
+
var l, p;
|
|
1054
|
+
const U = K.filter((u) => u.id !== A), re = U.length - 1;
|
|
1055
|
+
return re >= 0 && ((l = U[re]) == null ? void 0 : l.direction) === "outbound" && !((p = U[re]) != null && p.senderAgent) ? U.map((u, R) => R === re ? { ...u, senderAgent: C } : u) : U;
|
|
1056
|
+
});
|
|
1057
|
+
} catch (K) {
|
|
1058
|
+
te((U) => U.filter((re) => re.id !== A)), oe(K instanceof Error ? K.message : "Không gửi được tin nhắn");
|
|
1059
|
+
} finally {
|
|
1060
|
+
de(!1);
|
|
849
1061
|
}
|
|
850
1062
|
}
|
|
851
|
-
function
|
|
852
|
-
const
|
|
853
|
-
if (!
|
|
854
|
-
|
|
1063
|
+
function Ze(a) {
|
|
1064
|
+
const g = Ce.current;
|
|
1065
|
+
if (!g) {
|
|
1066
|
+
b((U) => U + a), he(!1);
|
|
855
1067
|
return;
|
|
856
1068
|
}
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
|
|
1069
|
+
const k = g.selectionStart ?? x.length, A = g.selectionEnd ?? x.length, K = x.slice(0, k) + a + x.slice(A);
|
|
1070
|
+
b(K), he(!1), requestAnimationFrame(() => {
|
|
1071
|
+
g.focus(), g.selectionStart = g.selectionEnd = k + a.length;
|
|
860
1072
|
});
|
|
861
1073
|
}
|
|
862
|
-
function
|
|
863
|
-
|
|
864
|
-
const
|
|
865
|
-
|
|
1074
|
+
function pe(a) {
|
|
1075
|
+
b(a), Ie(!1), me(""), requestAnimationFrame(() => {
|
|
1076
|
+
const g = Ce.current;
|
|
1077
|
+
g && (g.focus(), g.selectionStart = g.selectionEnd = a.length);
|
|
866
1078
|
});
|
|
867
1079
|
}
|
|
868
|
-
const
|
|
869
|
-
return /* @__PURE__ */ n("section", { style:
|
|
870
|
-
/* @__PURE__ */ n("header", { style:
|
|
871
|
-
/* @__PURE__ */ e(
|
|
872
|
-
/* @__PURE__ */ n("div", { style:
|
|
873
|
-
/* @__PURE__ */ e("strong", { style:
|
|
874
|
-
/* @__PURE__ */ e("span", { style:
|
|
1080
|
+
const be = !ne && (x.trim().length > 0 || (c == null ? void 0 : c.url) != null && !c.uploading);
|
|
1081
|
+
return /* @__PURE__ */ n("section", { style: f.chat, children: [
|
|
1082
|
+
/* @__PURE__ */ n("header", { style: f.chatHeader, children: [
|
|
1083
|
+
/* @__PURE__ */ e($t, { name: O, color: h, image: t.contactPictureUrl, provider: i }),
|
|
1084
|
+
/* @__PURE__ */ n("div", { style: f.contact, children: [
|
|
1085
|
+
/* @__PURE__ */ e("strong", { style: f.contactName, children: O }),
|
|
1086
|
+
/* @__PURE__ */ e("span", { style: f.contactMeta, children: en(r) ?? Wt(i) })
|
|
875
1087
|
] }),
|
|
876
|
-
/* @__PURE__ */ n("div", { style:
|
|
877
|
-
/* @__PURE__ */
|
|
1088
|
+
/* @__PURE__ */ n("div", { style: { ...f.headerActions, alignItems: "center", gap: 6 }, children: [
|
|
1089
|
+
/* @__PURE__ */ n("div", { ref: Ke, style: { position: "relative", display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
1090
|
+
!t.assignedAgent && C ? /* @__PURE__ */ n("div", { style: { display: "inline-flex", alignItems: "center", borderRadius: 999, border: `1px solid ${h}40`, background: `${h}0d`, overflow: "hidden" }, children: [
|
|
1091
|
+
/* @__PURE__ */ n(
|
|
1092
|
+
"button",
|
|
1093
|
+
{
|
|
1094
|
+
type: "button",
|
|
1095
|
+
onClick: () => void I(C),
|
|
1096
|
+
style: {
|
|
1097
|
+
border: 0,
|
|
1098
|
+
background: "transparent",
|
|
1099
|
+
color: h,
|
|
1100
|
+
padding: "4px 9px",
|
|
1101
|
+
fontSize: 11.5,
|
|
1102
|
+
fontWeight: 600,
|
|
1103
|
+
cursor: "pointer",
|
|
1104
|
+
display: "inline-flex",
|
|
1105
|
+
alignItems: "center",
|
|
1106
|
+
gap: 4,
|
|
1107
|
+
whiteSpace: "nowrap"
|
|
1108
|
+
},
|
|
1109
|
+
children: [
|
|
1110
|
+
/* @__PURE__ */ e(ft, { size: 12, strokeWidth: 2.2 }),
|
|
1111
|
+
/* @__PURE__ */ e("span", { children: "+ Nhận phụ trách" })
|
|
1112
|
+
]
|
|
1113
|
+
}
|
|
1114
|
+
),
|
|
1115
|
+
((D == null ? void 0 : D.length) ?? 0) > 1 && /* @__PURE__ */ e(
|
|
1116
|
+
"button",
|
|
1117
|
+
{
|
|
1118
|
+
type: "button",
|
|
1119
|
+
"aria-label": "Chọn nhân viên phụ trách",
|
|
1120
|
+
onClick: () => G((a) => !a),
|
|
1121
|
+
style: {
|
|
1122
|
+
border: 0,
|
|
1123
|
+
borderLeft: `1px solid ${h}30`,
|
|
1124
|
+
background: "transparent",
|
|
1125
|
+
color: h,
|
|
1126
|
+
padding: "4px 6px",
|
|
1127
|
+
cursor: "pointer",
|
|
1128
|
+
display: "inline-flex",
|
|
1129
|
+
alignItems: "center"
|
|
1130
|
+
},
|
|
1131
|
+
children: /* @__PURE__ */ e(nt, { size: 12, strokeWidth: 2.2 })
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1134
|
+
] }) : /* @__PURE__ */ n(
|
|
1135
|
+
"button",
|
|
1136
|
+
{
|
|
1137
|
+
type: "button",
|
|
1138
|
+
onClick: () => G((a) => !a),
|
|
1139
|
+
style: {
|
|
1140
|
+
display: "inline-flex",
|
|
1141
|
+
alignItems: "center",
|
|
1142
|
+
gap: 6,
|
|
1143
|
+
padding: "3px 9px 3px 4px",
|
|
1144
|
+
borderRadius: 999,
|
|
1145
|
+
border: `1px solid ${d.line}`,
|
|
1146
|
+
background: d.surface,
|
|
1147
|
+
color: d.ink,
|
|
1148
|
+
fontSize: 11.5,
|
|
1149
|
+
fontWeight: 600,
|
|
1150
|
+
cursor: "pointer",
|
|
1151
|
+
whiteSpace: "nowrap"
|
|
1152
|
+
},
|
|
1153
|
+
children: [
|
|
1154
|
+
t.assignedAgent ? /* @__PURE__ */ n(ie, { children: [
|
|
1155
|
+
/* @__PURE__ */ e(
|
|
1156
|
+
"span",
|
|
1157
|
+
{
|
|
1158
|
+
style: {
|
|
1159
|
+
width: 18,
|
|
1160
|
+
height: 18,
|
|
1161
|
+
borderRadius: "50%",
|
|
1162
|
+
background: h,
|
|
1163
|
+
color: "#fff",
|
|
1164
|
+
fontSize: 9,
|
|
1165
|
+
fontWeight: 700,
|
|
1166
|
+
display: "inline-grid",
|
|
1167
|
+
placeItems: "center",
|
|
1168
|
+
overflow: "hidden",
|
|
1169
|
+
flexShrink: 0
|
|
1170
|
+
},
|
|
1171
|
+
children: t.assignedAgent.avatarUrl ? /* @__PURE__ */ e("img", { src: t.assignedAgent.avatarUrl, alt: "", style: { width: "100%", height: "100%", objectFit: "cover" } }) : Le(t.assignedAgent.name)
|
|
1172
|
+
}
|
|
1173
|
+
),
|
|
1174
|
+
/* @__PURE__ */ e("span", { style: { color: d.muted, fontWeight: 500 }, children: "Phụ trách:" }),
|
|
1175
|
+
/* @__PURE__ */ e("span", { style: { maxWidth: 110, overflow: "hidden", textOverflow: "ellipsis" }, children: rt(t.assignedAgent.name) })
|
|
1176
|
+
] }) : /* @__PURE__ */ n(ie, { children: [
|
|
1177
|
+
/* @__PURE__ */ e(Vt, { size: 13, color: d.muted }),
|
|
1178
|
+
/* @__PURE__ */ e("span", { style: { color: d.muted }, children: "Chưa phân công" })
|
|
1179
|
+
] }),
|
|
1180
|
+
/* @__PURE__ */ e(nt, { size: 12, color: d.muted })
|
|
1181
|
+
]
|
|
1182
|
+
}
|
|
1183
|
+
),
|
|
1184
|
+
je && /* @__PURE__ */ n(
|
|
1185
|
+
"div",
|
|
1186
|
+
{
|
|
1187
|
+
ref: qe,
|
|
1188
|
+
style: {
|
|
1189
|
+
position: "absolute",
|
|
1190
|
+
top: "calc(100% + 6px)",
|
|
1191
|
+
right: 0,
|
|
1192
|
+
zIndex: 200,
|
|
1193
|
+
minWidth: 230,
|
|
1194
|
+
background: d.white,
|
|
1195
|
+
border: `1px solid ${d.line}`,
|
|
1196
|
+
borderRadius: 11,
|
|
1197
|
+
boxShadow: "0 10px 28px rgba(23,32,51,.15)",
|
|
1198
|
+
padding: 6,
|
|
1199
|
+
fontSize: 12
|
|
1200
|
+
},
|
|
1201
|
+
children: [
|
|
1202
|
+
/* @__PURE__ */ e("div", { style: { padding: "4px 8px 6px", fontSize: 10, fontWeight: 700, color: d.muted, letterSpacing: 0.8, textTransform: "uppercase" }, children: "Người phụ trách hội thoại" }),
|
|
1203
|
+
C && ((Re = t.assignedAgent) == null ? void 0 : Re.id) !== C.id && /* @__PURE__ */ n(
|
|
1204
|
+
"button",
|
|
1205
|
+
{
|
|
1206
|
+
type: "button",
|
|
1207
|
+
onClick: () => {
|
|
1208
|
+
G(!1), I(C);
|
|
1209
|
+
},
|
|
1210
|
+
style: {
|
|
1211
|
+
display: "flex",
|
|
1212
|
+
alignItems: "center",
|
|
1213
|
+
gap: 8,
|
|
1214
|
+
width: "100%",
|
|
1215
|
+
border: 0,
|
|
1216
|
+
borderRadius: 7,
|
|
1217
|
+
background: `${h}10`,
|
|
1218
|
+
color: h,
|
|
1219
|
+
padding: "6px 8px",
|
|
1220
|
+
marginBottom: 4,
|
|
1221
|
+
fontWeight: 600,
|
|
1222
|
+
fontSize: 12,
|
|
1223
|
+
cursor: "pointer",
|
|
1224
|
+
textAlign: "left"
|
|
1225
|
+
},
|
|
1226
|
+
children: [
|
|
1227
|
+
/* @__PURE__ */ e(ft, { size: 13 }),
|
|
1228
|
+
/* @__PURE__ */ n("span", { children: [
|
|
1229
|
+
"Nhận phụ trách cho tôi (",
|
|
1230
|
+
rt(C.name),
|
|
1231
|
+
")"
|
|
1232
|
+
] })
|
|
1233
|
+
]
|
|
1234
|
+
}
|
|
1235
|
+
),
|
|
1236
|
+
/* @__PURE__ */ e("div", { style: { maxHeight: 200, overflowY: "auto" }, children: (D ?? []).map((a) => {
|
|
1237
|
+
var k;
|
|
1238
|
+
const g = ((k = t.assignedAgent) == null ? void 0 : k.id) === a.id;
|
|
1239
|
+
return /* @__PURE__ */ n(
|
|
1240
|
+
"button",
|
|
1241
|
+
{
|
|
1242
|
+
type: "button",
|
|
1243
|
+
onClick: () => {
|
|
1244
|
+
G(!1), I(a);
|
|
1245
|
+
},
|
|
1246
|
+
style: {
|
|
1247
|
+
display: "flex",
|
|
1248
|
+
alignItems: "center",
|
|
1249
|
+
justifyContent: "space-between",
|
|
1250
|
+
gap: 8,
|
|
1251
|
+
width: "100%",
|
|
1252
|
+
border: 0,
|
|
1253
|
+
borderRadius: 7,
|
|
1254
|
+
background: g ? "#f1f5f9" : "transparent",
|
|
1255
|
+
color: d.ink,
|
|
1256
|
+
padding: "6px 8px",
|
|
1257
|
+
cursor: "pointer",
|
|
1258
|
+
textAlign: "left"
|
|
1259
|
+
},
|
|
1260
|
+
children: [
|
|
1261
|
+
/* @__PURE__ */ n("span", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
|
|
1262
|
+
/* @__PURE__ */ e(
|
|
1263
|
+
"span",
|
|
1264
|
+
{
|
|
1265
|
+
style: {
|
|
1266
|
+
width: 22,
|
|
1267
|
+
height: 22,
|
|
1268
|
+
borderRadius: "50%",
|
|
1269
|
+
background: `${h}18`,
|
|
1270
|
+
color: h,
|
|
1271
|
+
fontSize: 10,
|
|
1272
|
+
fontWeight: 700,
|
|
1273
|
+
display: "inline-grid",
|
|
1274
|
+
placeItems: "center",
|
|
1275
|
+
overflow: "hidden",
|
|
1276
|
+
flexShrink: 0
|
|
1277
|
+
},
|
|
1278
|
+
children: a.avatarUrl ? /* @__PURE__ */ e("img", { src: a.avatarUrl, alt: "", style: { width: "100%", height: "100%", objectFit: "cover" } }) : Le(a.name)
|
|
1279
|
+
}
|
|
1280
|
+
),
|
|
1281
|
+
/* @__PURE__ */ n("span", { style: { minWidth: 0 }, children: [
|
|
1282
|
+
/* @__PURE__ */ e("span", { style: { display: "block", fontWeight: 600, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: a.name }),
|
|
1283
|
+
a.title && /* @__PURE__ */ e("span", { style: { display: "block", fontSize: 10.5, color: d.muted }, children: a.title })
|
|
1284
|
+
] })
|
|
1285
|
+
] }),
|
|
1286
|
+
g && /* @__PURE__ */ e(lt, { size: 13, color: h, strokeWidth: 2.5 })
|
|
1287
|
+
]
|
|
1288
|
+
},
|
|
1289
|
+
a.id
|
|
1290
|
+
);
|
|
1291
|
+
}) }),
|
|
1292
|
+
t.assignedAgent && /* @__PURE__ */ n(ie, { children: [
|
|
1293
|
+
/* @__PURE__ */ e("div", { style: { borderTop: `1px solid ${d.line}`, margin: "5px 0" } }),
|
|
1294
|
+
/* @__PURE__ */ n(
|
|
1295
|
+
"button",
|
|
1296
|
+
{
|
|
1297
|
+
type: "button",
|
|
1298
|
+
onClick: () => {
|
|
1299
|
+
G(!1), I(null);
|
|
1300
|
+
},
|
|
1301
|
+
style: {
|
|
1302
|
+
display: "flex",
|
|
1303
|
+
alignItems: "center",
|
|
1304
|
+
gap: 6,
|
|
1305
|
+
width: "100%",
|
|
1306
|
+
border: 0,
|
|
1307
|
+
borderRadius: 7,
|
|
1308
|
+
background: "transparent",
|
|
1309
|
+
color: "#b42318",
|
|
1310
|
+
padding: "6px 8px",
|
|
1311
|
+
fontSize: 11.5,
|
|
1312
|
+
fontWeight: 500,
|
|
1313
|
+
cursor: "pointer",
|
|
1314
|
+
textAlign: "left"
|
|
1315
|
+
},
|
|
1316
|
+
children: [
|
|
1317
|
+
/* @__PURE__ */ e(Ue, { size: 13 }),
|
|
1318
|
+
/* @__PURE__ */ e("span", { children: "Bỏ phân công (Chưa có người nhận)" })
|
|
1319
|
+
]
|
|
1320
|
+
}
|
|
1321
|
+
)
|
|
1322
|
+
] })
|
|
1323
|
+
]
|
|
1324
|
+
}
|
|
1325
|
+
)
|
|
1326
|
+
] }),
|
|
1327
|
+
/* @__PURE__ */ e("button", { style: f.iconButton, "aria-label": "Thêm tùy chọn", children: /* @__PURE__ */ e(It, { size: 16, strokeWidth: 2 }) }),
|
|
878
1328
|
/* @__PURE__ */ e(
|
|
879
1329
|
"button",
|
|
880
1330
|
{
|
|
881
1331
|
style: {
|
|
882
|
-
...
|
|
883
|
-
background:
|
|
884
|
-
color:
|
|
1332
|
+
...f.iconButton,
|
|
1333
|
+
background: w ? `${h}14` : "transparent",
|
|
1334
|
+
color: w ? h : d.muted
|
|
885
1335
|
},
|
|
886
1336
|
"aria-label": "Thông tin liên hệ",
|
|
887
|
-
onClick:
|
|
888
|
-
children: /* @__PURE__ */ e(
|
|
1337
|
+
onClick: v,
|
|
1338
|
+
children: /* @__PURE__ */ e(Dt, { size: 16, strokeWidth: 2 })
|
|
889
1339
|
}
|
|
890
1340
|
)
|
|
891
1341
|
] })
|
|
892
1342
|
] }),
|
|
893
|
-
/* @__PURE__ */ n(
|
|
894
|
-
/* @__PURE__ */ e("div", { style:
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
/* @__PURE__ */ e(
|
|
1343
|
+
/* @__PURE__ */ n(Rt, { ref: Z, style: f.messageArea, children: [
|
|
1344
|
+
/* @__PURE__ */ e("div", { style: f.day, children: W.today }),
|
|
1345
|
+
Q && /* @__PURE__ */ e("button", { onClick: () => void fe(Q), style: f.historyButton, children: W.loadOlder }),
|
|
1346
|
+
E && /* @__PURE__ */ n("div", { style: f.messageHint, children: [
|
|
1347
|
+
/* @__PURE__ */ e(ot, {}),
|
|
898
1348
|
" ",
|
|
899
|
-
|
|
1349
|
+
W.loading
|
|
900
1350
|
] }),
|
|
901
|
-
!
|
|
902
|
-
|
|
903
|
-
const
|
|
1351
|
+
!E && !q.length && /* @__PURE__ */ e("div", { style: f.messageHint, children: W.noMessages }),
|
|
1352
|
+
q.map((a, g) => {
|
|
1353
|
+
const k = ($ == null ? void 0 : $.flatMap((re) => re.messageEnrichments ?? [])) ?? [], A = a.direction === "inbound" && k.length > 0 && g >= q.length - 15, K = A ? Je(t, {
|
|
904
1354
|
provider: i,
|
|
905
|
-
recentMessages:
|
|
906
|
-
linkContact:
|
|
907
|
-
refreshContactInfo:
|
|
908
|
-
sendMessage: async (
|
|
909
|
-
await o.sendMessage(t.id,
|
|
1355
|
+
recentMessages: q.slice(-10),
|
|
1356
|
+
linkContact: L,
|
|
1357
|
+
refreshContactInfo: P,
|
|
1358
|
+
sendMessage: async (re, l) => {
|
|
1359
|
+
await o.sendMessage(t.id, re, l), await fe(void 0, !0);
|
|
910
1360
|
}
|
|
911
|
-
}) : null,
|
|
912
|
-
var
|
|
913
|
-
const
|
|
914
|
-
return
|
|
1361
|
+
}) : null, U = A && K ? k.map((re, l) => {
|
|
1362
|
+
var u;
|
|
1363
|
+
const p = (u = a.text) == null ? void 0 : u.match(re.pattern);
|
|
1364
|
+
return p ? /* @__PURE__ */ e(_t, { children: re.render(p, K, a) }, `${a.id}-${l}`) : null;
|
|
915
1365
|
}).filter(Boolean) : [];
|
|
916
1366
|
return /* @__PURE__ */ n("div", { children: [
|
|
917
|
-
/* @__PURE__ */ e(
|
|
918
|
-
|
|
919
|
-
] },
|
|
1367
|
+
/* @__PURE__ */ e(on, { message: a, primary: h }),
|
|
1368
|
+
U.length > 0 && /* @__PURE__ */ e("div", { style: { maxWidth: "min(70%, 480px)", marginTop: -4, marginBottom: 10, display: "flex", flexDirection: "column", gap: 6 }, children: U })
|
|
1369
|
+
] }, a.id);
|
|
920
1370
|
})
|
|
921
1371
|
] }),
|
|
922
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", gap: 6, flexWrap: "wrap", padding: "6px 14px 2px", borderTop: `1px solid ${d.line}` }, children: ["Cảm ơn bạn đã liên hệ 🙏", "Mình sẽ kiểm tra ngay", "Vui lòng chờ 1-2 phút"].map((
|
|
1372
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", gap: 6, flexWrap: "wrap", padding: "6px 14px 2px", borderTop: `1px solid ${d.line}` }, children: ["Cảm ơn bạn đã liên hệ 🙏", "Mình sẽ kiểm tra ngay", "Vui lòng chờ 1-2 phút"].map((a) => /* @__PURE__ */ e(
|
|
923
1373
|
"button",
|
|
924
1374
|
{
|
|
925
1375
|
type: "button",
|
|
926
|
-
onClick: () =>
|
|
1376
|
+
onClick: () => b(a),
|
|
927
1377
|
style: {
|
|
928
1378
|
fontSize: 11,
|
|
929
1379
|
padding: "3px 10px",
|
|
930
1380
|
borderRadius: 999,
|
|
931
|
-
background: `${
|
|
932
|
-
color:
|
|
933
|
-
border: `1px solid ${
|
|
1381
|
+
background: `${h}0f`,
|
|
1382
|
+
color: h,
|
|
1383
|
+
border: `1px solid ${h}33`,
|
|
934
1384
|
cursor: "pointer",
|
|
935
1385
|
whiteSpace: "nowrap"
|
|
936
1386
|
},
|
|
937
|
-
children:
|
|
1387
|
+
children: a
|
|
938
1388
|
},
|
|
939
|
-
|
|
1389
|
+
a
|
|
940
1390
|
)) }),
|
|
941
|
-
/* @__PURE__ */ n("form", { onSubmit:
|
|
942
|
-
|
|
1391
|
+
/* @__PURE__ */ n("form", { onSubmit: Ge, style: { flex: "0 0 auto", padding: "8px 14px 12px", borderTop: `1px solid ${d.line}`, background: d.white, position: "relative" }, children: [
|
|
1392
|
+
F && /* @__PURE__ */ n(
|
|
943
1393
|
"div",
|
|
944
1394
|
{
|
|
945
|
-
ref:
|
|
1395
|
+
ref: He,
|
|
946
1396
|
style: {
|
|
947
1397
|
position: "absolute",
|
|
948
1398
|
bottom: "calc(100% + 6px)",
|
|
@@ -957,11 +1407,11 @@ function Kt({ conversation: t, provider: i, connection: r, client: o, primary: s
|
|
|
957
1407
|
fontFamily: "inherit"
|
|
958
1408
|
},
|
|
959
1409
|
children: [
|
|
960
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", borderBottom: `1px solid ${d.line}`, background: "#f9fafb" }, children:
|
|
1410
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", borderBottom: `1px solid ${d.line}`, background: "#f9fafb" }, children: gt.map((a, g) => /* @__PURE__ */ e(
|
|
961
1411
|
"button",
|
|
962
1412
|
{
|
|
963
1413
|
type: "button",
|
|
964
|
-
onClick: () =>
|
|
1414
|
+
onClick: () => Me(g),
|
|
965
1415
|
style: {
|
|
966
1416
|
flex: 1,
|
|
967
1417
|
border: 0,
|
|
@@ -970,19 +1420,19 @@ function Kt({ conversation: t, provider: i, connection: r, client: o, primary: s
|
|
|
970
1420
|
fontSize: 16,
|
|
971
1421
|
cursor: "pointer",
|
|
972
1422
|
lineHeight: 1,
|
|
973
|
-
borderBottom:
|
|
974
|
-
opacity:
|
|
1423
|
+
borderBottom: Se === g ? `2px solid ${h}` : "2px solid transparent",
|
|
1424
|
+
opacity: Se === g ? 1 : 0.5,
|
|
975
1425
|
transition: "opacity 100ms ease"
|
|
976
1426
|
},
|
|
977
|
-
children:
|
|
1427
|
+
children: a.icon
|
|
978
1428
|
},
|
|
979
|
-
|
|
1429
|
+
g
|
|
980
1430
|
)) }),
|
|
981
|
-
/* @__PURE__ */ e("div", { style: { display: "grid", gridTemplateColumns: "repeat(8, 1fr)", gap: 2, padding: 8, maxHeight: 180, overflowY: "auto" }, children: (
|
|
1431
|
+
/* @__PURE__ */ e("div", { style: { display: "grid", gridTemplateColumns: "repeat(8, 1fr)", gap: 2, padding: 8, maxHeight: 180, overflowY: "auto" }, children: (Te = gt[Se]) == null ? void 0 : Te.emojis.map((a, g) => /* @__PURE__ */ e(
|
|
982
1432
|
"button",
|
|
983
1433
|
{
|
|
984
1434
|
type: "button",
|
|
985
|
-
onClick: () =>
|
|
1435
|
+
onClick: () => Ze(a),
|
|
986
1436
|
style: {
|
|
987
1437
|
border: 0,
|
|
988
1438
|
background: "transparent",
|
|
@@ -993,23 +1443,23 @@ function Kt({ conversation: t, provider: i, connection: r, client: o, primary: s
|
|
|
993
1443
|
lineHeight: 1,
|
|
994
1444
|
transition: "background 80ms ease"
|
|
995
1445
|
},
|
|
996
|
-
onMouseEnter: (
|
|
997
|
-
|
|
1446
|
+
onMouseEnter: (k) => {
|
|
1447
|
+
k.target.style.background = "#f3f4f6";
|
|
998
1448
|
},
|
|
999
|
-
onMouseLeave: (
|
|
1000
|
-
|
|
1449
|
+
onMouseLeave: (k) => {
|
|
1450
|
+
k.target.style.background = "transparent";
|
|
1001
1451
|
},
|
|
1002
|
-
children:
|
|
1452
|
+
children: a
|
|
1003
1453
|
},
|
|
1004
|
-
|
|
1454
|
+
g
|
|
1005
1455
|
)) })
|
|
1006
1456
|
]
|
|
1007
1457
|
}
|
|
1008
1458
|
),
|
|
1009
|
-
|
|
1459
|
+
ve && /* @__PURE__ */ n(
|
|
1010
1460
|
"div",
|
|
1011
1461
|
{
|
|
1012
|
-
ref:
|
|
1462
|
+
ref: ze,
|
|
1013
1463
|
style: {
|
|
1014
1464
|
position: "absolute",
|
|
1015
1465
|
bottom: "calc(100% + 6px)",
|
|
@@ -1030,18 +1480,18 @@ function Kt({ conversation: t, provider: i, connection: r, client: o, primary: s
|
|
|
1030
1480
|
autoFocus: !0,
|
|
1031
1481
|
type: "text",
|
|
1032
1482
|
placeholder: "Tìm template…",
|
|
1033
|
-
value:
|
|
1034
|
-
onChange: (
|
|
1483
|
+
value: Ne,
|
|
1484
|
+
onChange: (a) => me(a.target.value),
|
|
1035
1485
|
style: { width: "100%", boxSizing: "border-box", border: `1px solid ${d.line}`, borderRadius: 7, padding: "5px 8px", fontSize: 12, outline: "none", fontFamily: "inherit", color: d.ink }
|
|
1036
1486
|
}
|
|
1037
1487
|
) }),
|
|
1038
1488
|
/* @__PURE__ */ e("div", { style: { maxHeight: 220, overflowY: "auto" }, children: (() => {
|
|
1039
|
-
const
|
|
1040
|
-
return
|
|
1489
|
+
const a = Ne.trim().toLowerCase(), g = a ? _.filter((k) => k.title.toLowerCase().includes(a) || k.content.toLowerCase().includes(a) || (k.shortcut ?? "").toLowerCase().includes(a)) : _;
|
|
1490
|
+
return g.length ? g.map((k) => /* @__PURE__ */ n(
|
|
1041
1491
|
"button",
|
|
1042
1492
|
{
|
|
1043
1493
|
type: "button",
|
|
1044
|
-
onClick: () =>
|
|
1494
|
+
onClick: () => pe(k.content),
|
|
1045
1495
|
style: { display: "block", width: "100%", textAlign: "left", border: 0, borderBottom: `1px solid ${d.line}`, background: "transparent", padding: "9px 12px", cursor: "pointer", fontFamily: "inherit" },
|
|
1046
1496
|
onMouseEnter: (A) => {
|
|
1047
1497
|
A.currentTarget.style.background = "#f7f9fc";
|
|
@@ -1051,69 +1501,69 @@ function Kt({ conversation: t, provider: i, connection: r, client: o, primary: s
|
|
|
1051
1501
|
},
|
|
1052
1502
|
children: [
|
|
1053
1503
|
/* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 2 }, children: [
|
|
1054
|
-
/* @__PURE__ */ e("span", { style: { fontSize: 12, fontWeight: 600, color: d.ink }, children:
|
|
1055
|
-
|
|
1504
|
+
/* @__PURE__ */ e("span", { style: { fontSize: 12, fontWeight: 600, color: d.ink }, children: k.title }),
|
|
1505
|
+
k.shortcut && /* @__PURE__ */ e("span", { style: { fontSize: 10, color: h, background: `${h}18`, borderRadius: 4, padding: "1px 5px" }, children: k.shortcut })
|
|
1056
1506
|
] }),
|
|
1057
|
-
/* @__PURE__ */ e("div", { style: { fontSize: 11, color: d.muted, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children:
|
|
1507
|
+
/* @__PURE__ */ e("div", { style: { fontSize: 11, color: d.muted, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: k.content })
|
|
1058
1508
|
]
|
|
1059
1509
|
},
|
|
1060
|
-
|
|
1061
|
-
)) : /* @__PURE__ */ e("div", { style: { padding: "24px 16px", textAlign: "center", color: d.muted, fontSize: 12 }, children:
|
|
1510
|
+
k.id
|
|
1511
|
+
)) : /* @__PURE__ */ e("div", { style: { padding: "24px 16px", textAlign: "center", color: d.muted, fontSize: 12 }, children: _.length === 0 ? "Chưa có template nào" : "Không tìm thấy" });
|
|
1062
1512
|
})() })
|
|
1063
1513
|
]
|
|
1064
1514
|
}
|
|
1065
1515
|
),
|
|
1066
1516
|
/* @__PURE__ */ n("div", { style: { border: `1.5px solid ${d.line}`, borderRadius: 12, background: d.white, overflow: "hidden" }, children: [
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
/* @__PURE__ */ e(
|
|
1517
|
+
c && /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", gap: 8, padding: "8px 12px", borderBottom: `1px solid ${d.line}`, fontSize: 12 }, children: [
|
|
1518
|
+
c.uploading ? /* @__PURE__ */ n(ie, { children: [
|
|
1519
|
+
/* @__PURE__ */ e(ot, {}),
|
|
1070
1520
|
/* @__PURE__ */ e("span", { style: { color: d.muted }, children: "Đang tải lên…" })
|
|
1071
|
-
] }) :
|
|
1521
|
+
] }) : c.attachmentType === "image" && c.objectUrl ? /* @__PURE__ */ e("img", { src: c.objectUrl, alt: "", style: { height: 48, width: 48, objectFit: "cover", borderRadius: 6 } }) : /* @__PURE__ */ n("span", { style: { color: d.muted }, children: [
|
|
1072
1522
|
"📎 ",
|
|
1073
|
-
|
|
1523
|
+
c.file.name,
|
|
1074
1524
|
" (",
|
|
1075
|
-
Math.round(
|
|
1525
|
+
Math.round(c.file.size / 1024),
|
|
1076
1526
|
" KB)"
|
|
1077
1527
|
] }),
|
|
1078
|
-
!
|
|
1079
|
-
|
|
1528
|
+
!c.uploading && /* @__PURE__ */ e("button", { type: "button", onClick: () => {
|
|
1529
|
+
c != null && c.objectUrl && URL.revokeObjectURL(c.objectUrl), H(null);
|
|
1080
1530
|
}, style: { marginLeft: "auto", border: 0, background: "none", color: d.muted, cursor: "pointer", fontSize: 16 }, "aria-label": "Xóa tệp đính kèm", children: "✕" })
|
|
1081
1531
|
] }),
|
|
1082
1532
|
/* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", gap: 2, padding: "4px 8px", borderBottom: "1px solid #f3f4f6" }, children: [
|
|
1083
1533
|
/* @__PURE__ */ e(
|
|
1084
1534
|
"button",
|
|
1085
1535
|
{
|
|
1086
|
-
ref:
|
|
1536
|
+
ref: Ae,
|
|
1087
1537
|
type: "button",
|
|
1088
1538
|
title: "Chèn emoji",
|
|
1089
|
-
onClick: () =>
|
|
1090
|
-
style: { ...
|
|
1091
|
-
children: /* @__PURE__ */ e(
|
|
1539
|
+
onClick: () => he((a) => !a),
|
|
1540
|
+
style: { ...f.toolbarBtn, background: F ? `${h}18` : "transparent", color: F ? h : "#9ca3af" },
|
|
1541
|
+
children: /* @__PURE__ */ e(qt, { size: 13, strokeWidth: 2 })
|
|
1092
1542
|
}
|
|
1093
1543
|
),
|
|
1094
|
-
!
|
|
1095
|
-
var
|
|
1096
|
-
return (
|
|
1097
|
-
}, children: /* @__PURE__ */ e(
|
|
1098
|
-
!
|
|
1099
|
-
var
|
|
1100
|
-
return (
|
|
1101
|
-
}, children: /* @__PURE__ */ e(
|
|
1102
|
-
!
|
|
1103
|
-
/* @__PURE__ */ e("input", { ref:
|
|
1104
|
-
/* @__PURE__ */ e("input", { ref:
|
|
1544
|
+
!T && /* @__PURE__ */ e("button", { type: "button", title: "Gửi ảnh / video", "aria-label": "Gửi ảnh hoặc video", style: f.toolbarBtn, onClick: () => {
|
|
1545
|
+
var a;
|
|
1546
|
+
return (a = ee.current) == null ? void 0 : a.click();
|
|
1547
|
+
}, children: /* @__PURE__ */ e(Ot, { size: 13, strokeWidth: 2 }) }),
|
|
1548
|
+
!T && /* @__PURE__ */ e("button", { type: "button", title: "Gửi tệp đính kèm", "aria-label": "Gửi tệp đính kèm", style: f.toolbarBtn, onClick: () => {
|
|
1549
|
+
var a;
|
|
1550
|
+
return (a = se.current) == null ? void 0 : a.click();
|
|
1551
|
+
}, children: /* @__PURE__ */ e(Pt, { size: 13, strokeWidth: 2 }) }),
|
|
1552
|
+
!T && /* @__PURE__ */ n(ie, { children: [
|
|
1553
|
+
/* @__PURE__ */ e("input", { ref: ee, type: "file", style: { display: "none" }, onChange: Ve, accept: "image/*,video/mp4" }),
|
|
1554
|
+
/* @__PURE__ */ e("input", { ref: se, type: "file", style: { display: "none" }, onChange: Ve, accept: ".pdf,audio/mpeg,audio/ogg,application/octet-stream,application/zip,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document" })
|
|
1105
1555
|
] }),
|
|
1106
1556
|
/* @__PURE__ */ e(
|
|
1107
1557
|
"button",
|
|
1108
1558
|
{
|
|
1109
|
-
ref:
|
|
1559
|
+
ref: Fe,
|
|
1110
1560
|
type: "button",
|
|
1111
1561
|
title: "Template nhanh",
|
|
1112
1562
|
onClick: () => {
|
|
1113
|
-
|
|
1563
|
+
Ie((a) => !a), me("");
|
|
1114
1564
|
},
|
|
1115
|
-
style: { ...
|
|
1116
|
-
children: /* @__PURE__ */ e(
|
|
1565
|
+
style: { ...f.toolbarBtn, background: ve ? `${h}18` : "transparent", color: ve ? h : "#9ca3af" },
|
|
1566
|
+
children: /* @__PURE__ */ e(Gt, { size: 13, strokeWidth: 2 })
|
|
1117
1567
|
}
|
|
1118
1568
|
),
|
|
1119
1569
|
/* @__PURE__ */ e("span", { style: { width: 1, height: 14, background: "#e5e7eb", margin: "0 2px" } }),
|
|
@@ -1122,8 +1572,8 @@ function Kt({ conversation: t, provider: i, connection: r, client: o, primary: s
|
|
|
1122
1572
|
{
|
|
1123
1573
|
type: "button",
|
|
1124
1574
|
title: "In đậm",
|
|
1125
|
-
onClick: () =>
|
|
1126
|
-
style: { ...
|
|
1575
|
+
onClick: () => ae((a) => !a),
|
|
1576
|
+
style: { ...f.toolbarBtn, fontWeight: 700, fontSize: 12, background: N ? `${h}18` : "transparent", color: N ? h : "#9ca3af", border: N ? `1px solid ${h}33` : "1px solid transparent" },
|
|
1127
1577
|
children: "B"
|
|
1128
1578
|
}
|
|
1129
1579
|
),
|
|
@@ -1132,73 +1582,73 @@ function Kt({ conversation: t, provider: i, connection: r, client: o, primary: s
|
|
|
1132
1582
|
{
|
|
1133
1583
|
type: "button",
|
|
1134
1584
|
title: "Nghiêng",
|
|
1135
|
-
onClick: () =>
|
|
1136
|
-
style: { ...
|
|
1585
|
+
onClick: () => ye((a) => !a),
|
|
1586
|
+
style: { ...f.toolbarBtn, fontStyle: "italic", fontSize: 12, background: ce ? `${h}18` : "transparent", color: ce ? h : "#9ca3af", border: ce ? `1px solid ${h}33` : "1px solid transparent" },
|
|
1137
1587
|
children: "I"
|
|
1138
1588
|
}
|
|
1139
1589
|
),
|
|
1140
|
-
!!(
|
|
1141
|
-
var
|
|
1142
|
-
return (((
|
|
1590
|
+
!!($ != null && $.some((a) => {
|
|
1591
|
+
var g;
|
|
1592
|
+
return (((g = a.toolbarActions) == null ? void 0 : g.length) ?? 0) > 0;
|
|
1143
1593
|
})) && /* @__PURE__ */ e("span", { style: { width: 1, height: 14, background: "#e5e7eb", margin: "0 4px" } }),
|
|
1144
|
-
|
|
1594
|
+
$ == null ? void 0 : $.flatMap((a) => a.toolbarActions ?? []).map((a, g) => /* @__PURE__ */ n(
|
|
1145
1595
|
"button",
|
|
1146
1596
|
{
|
|
1147
1597
|
type: "button",
|
|
1148
|
-
title:
|
|
1149
|
-
style:
|
|
1598
|
+
title: a.tooltip,
|
|
1599
|
+
style: a.label ? {
|
|
1150
1600
|
display: "inline-flex",
|
|
1151
1601
|
alignItems: "center",
|
|
1152
1602
|
gap: 5,
|
|
1153
1603
|
padding: "3px 9px",
|
|
1154
1604
|
borderRadius: 999,
|
|
1155
|
-
border: `1px solid ${
|
|
1156
|
-
background: `${
|
|
1157
|
-
color:
|
|
1605
|
+
border: `1px solid ${h}33`,
|
|
1606
|
+
background: `${h}0f`,
|
|
1607
|
+
color: h,
|
|
1158
1608
|
fontSize: 11.5,
|
|
1159
1609
|
fontWeight: 600,
|
|
1160
1610
|
cursor: "pointer",
|
|
1161
1611
|
lineHeight: 1.2,
|
|
1162
1612
|
whiteSpace: "nowrap"
|
|
1163
|
-
} :
|
|
1613
|
+
} : f.toolbarBtn,
|
|
1164
1614
|
onClick: () => {
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1167
|
-
`) ? `${
|
|
1168
|
-
var
|
|
1169
|
-
return (
|
|
1615
|
+
const k = (K) => {
|
|
1616
|
+
b((U) => U && !U.endsWith(" ") && !U.endsWith(`
|
|
1617
|
+
`) ? `${U} ${K}` : `${U}${K}`), requestAnimationFrame(() => {
|
|
1618
|
+
var U;
|
|
1619
|
+
return (U = Ce.current) == null ? void 0 : U.focus();
|
|
1170
1620
|
});
|
|
1171
|
-
}, A =
|
|
1621
|
+
}, A = Je(t, {
|
|
1172
1622
|
provider: i,
|
|
1173
|
-
recentMessages:
|
|
1174
|
-
linkContact:
|
|
1175
|
-
refreshContactInfo:
|
|
1176
|
-
sendMessage: async (
|
|
1177
|
-
await o.sendMessage(t.id,
|
|
1623
|
+
recentMessages: q.slice(-10),
|
|
1624
|
+
linkContact: L,
|
|
1625
|
+
refreshContactInfo: P,
|
|
1626
|
+
sendMessage: async (K, U) => {
|
|
1627
|
+
await o.sendMessage(t.id, K, U), await fe(void 0, !0);
|
|
1178
1628
|
}
|
|
1179
1629
|
});
|
|
1180
|
-
|
|
1630
|
+
a.onClick({ ...A, insertText: k });
|
|
1181
1631
|
},
|
|
1182
1632
|
children: [
|
|
1183
|
-
|
|
1184
|
-
|
|
1633
|
+
a.icon,
|
|
1634
|
+
a.label && /* @__PURE__ */ e("span", { children: a.label })
|
|
1185
1635
|
]
|
|
1186
1636
|
},
|
|
1187
|
-
|
|
1637
|
+
g
|
|
1188
1638
|
))
|
|
1189
1639
|
] }),
|
|
1190
1640
|
/* @__PURE__ */ e(
|
|
1191
|
-
|
|
1641
|
+
Jt,
|
|
1192
1642
|
{
|
|
1193
|
-
ref:
|
|
1643
|
+
ref: Ce,
|
|
1194
1644
|
"aria-label": "Soạn tin nhắn",
|
|
1195
1645
|
rows: 2,
|
|
1196
|
-
value:
|
|
1197
|
-
onChange: (
|
|
1198
|
-
onKeyDown: (
|
|
1199
|
-
|
|
1646
|
+
value: x,
|
|
1647
|
+
onChange: (a) => b(a.target.value),
|
|
1648
|
+
onKeyDown: (a) => {
|
|
1649
|
+
a.key === "Enter" && !a.shiftKey && (a.preventDefault(), Ge(a));
|
|
1200
1650
|
},
|
|
1201
|
-
placeholder:
|
|
1651
|
+
placeholder: W.sendPlaceholder,
|
|
1202
1652
|
style: {
|
|
1203
1653
|
display: "block",
|
|
1204
1654
|
width: "100%",
|
|
@@ -1215,26 +1665,26 @@ function Kt({ conversation: t, provider: i, connection: r, client: o, primary: s
|
|
|
1215
1665
|
font: "inherit",
|
|
1216
1666
|
fontSize: 13,
|
|
1217
1667
|
lineHeight: 1.45,
|
|
1218
|
-
fontStyle:
|
|
1219
|
-
fontWeight:
|
|
1668
|
+
fontStyle: ce ? "italic" : "normal",
|
|
1669
|
+
fontWeight: N ? 700 : 400
|
|
1220
1670
|
}
|
|
1221
1671
|
}
|
|
1222
1672
|
),
|
|
1223
1673
|
/* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "4px 8px 6px 12px" }, children: [
|
|
1224
1674
|
/* @__PURE__ */ n("span", { style: {
|
|
1225
1675
|
fontSize: 11,
|
|
1226
|
-
color:
|
|
1227
|
-
fontWeight:
|
|
1676
|
+
color: x.length > 1e3 ? "#ef4444" : x.length > 900 ? "#f59e0b" : "#9ca3af",
|
|
1677
|
+
fontWeight: x.length > 1e3 ? 600 : 400
|
|
1228
1678
|
}, children: [
|
|
1229
|
-
|
|
1679
|
+
x.length,
|
|
1230
1680
|
"/1000"
|
|
1231
1681
|
] }),
|
|
1232
1682
|
/* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
1233
|
-
!
|
|
1683
|
+
!j && /* @__PURE__ */ e("span", { style: { fontSize: 10, color: "#9ca3af" }, children: "↵ Gửi · ⇧↵ Xuống dòng" }),
|
|
1234
1684
|
/* @__PURE__ */ n(
|
|
1235
1685
|
"button",
|
|
1236
1686
|
{
|
|
1237
|
-
disabled: !
|
|
1687
|
+
disabled: !be,
|
|
1238
1688
|
"aria-label": "Gửi tin nhắn",
|
|
1239
1689
|
style: {
|
|
1240
1690
|
display: "flex",
|
|
@@ -1245,15 +1695,15 @@ function Kt({ conversation: t, provider: i, connection: r, client: o, primary: s
|
|
|
1245
1695
|
borderRadius: 999,
|
|
1246
1696
|
fontSize: 12,
|
|
1247
1697
|
fontWeight: 600,
|
|
1248
|
-
background:
|
|
1249
|
-
color:
|
|
1250
|
-
cursor:
|
|
1251
|
-
boxShadow:
|
|
1698
|
+
background: be ? `linear-gradient(135deg,${h},#0ea5e9)` : "#e5e7eb",
|
|
1699
|
+
color: be ? "#fff" : "#9ca3af",
|
|
1700
|
+
cursor: be ? "pointer" : "not-allowed",
|
|
1701
|
+
boxShadow: be ? "0 2px 8px rgba(37,99,235,0.25)" : "none",
|
|
1252
1702
|
transition: "all 150ms ease"
|
|
1253
1703
|
},
|
|
1254
1704
|
children: [
|
|
1255
|
-
|
|
1256
|
-
|
|
1705
|
+
ne ? /* @__PURE__ */ e(zt, { size: 12, style: { animation: "channelhub-spin .7s linear infinite" } }) : /* @__PURE__ */ e(Ft, { size: 12, strokeWidth: 2 }),
|
|
1706
|
+
W.send
|
|
1257
1707
|
]
|
|
1258
1708
|
}
|
|
1259
1709
|
)
|
|
@@ -1261,185 +1711,217 @@ function Kt({ conversation: t, provider: i, connection: r, client: o, primary: s
|
|
|
1261
1711
|
] })
|
|
1262
1712
|
] })
|
|
1263
1713
|
] }),
|
|
1264
|
-
(
|
|
1714
|
+
(z || S) && /* @__PURE__ */ e("div", { role: "alert", style: f.error, children: z || S })
|
|
1265
1715
|
] });
|
|
1266
1716
|
}
|
|
1267
|
-
function
|
|
1268
|
-
var
|
|
1269
|
-
const r =
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1717
|
+
function on({ message: t, primary: i }) {
|
|
1718
|
+
var q, te, Q, B, x;
|
|
1719
|
+
const r = tt(st), o = tt(Tt), h = (b) => b.startsWith("/v1/media/proxy") ? `${r}${b}&tok=${encodeURIComponent(o)}` : b, S = t.direction === "outbound", m = ((q = t.attachments) == null ? void 0 : q.filter((b) => b.type === "image")) ?? [], M = ((te = t.attachments) == null ? void 0 : te.filter((b) => b.type === "sticker")) ?? [], w = ((Q = t.attachments) == null ? void 0 : Q.filter((b) => b.type === "video")) ?? [], v = ((B = t.attachments) == null ? void 0 : B.filter((b) => b.type === "audio")) ?? [], W = ((x = t.attachments) == null ? void 0 : x.filter((b) => b.type === "file")) ?? [], [T, j] = y(null), $ = S ? "flex-end" : "flex-start", C = S ? t.senderAgent ?? null : null, D = /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", justifyContent: S ? "flex-end" : "flex-start", gap: 5, marginTop: 4, fontSize: 10, opacity: 0.78, letterSpacing: 0.2, userSelect: "none" }, children: [
|
|
1720
|
+
C && /* @__PURE__ */ n(
|
|
1721
|
+
"span",
|
|
1722
|
+
{
|
|
1723
|
+
title: C.title ? `${C.name} (${C.title})` : C.name,
|
|
1724
|
+
style: { display: "inline-flex", alignItems: "center", gap: 3.5, fontWeight: 600 },
|
|
1725
|
+
children: [
|
|
1726
|
+
/* @__PURE__ */ e(
|
|
1727
|
+
"span",
|
|
1728
|
+
{
|
|
1729
|
+
style: {
|
|
1730
|
+
width: 14,
|
|
1731
|
+
height: 14,
|
|
1732
|
+
borderRadius: "50%",
|
|
1733
|
+
background: "rgba(255,255,255,0.22)",
|
|
1734
|
+
color: "#fff",
|
|
1735
|
+
fontSize: 8,
|
|
1736
|
+
fontWeight: 700,
|
|
1737
|
+
display: "inline-grid",
|
|
1738
|
+
placeItems: "center",
|
|
1739
|
+
overflow: "hidden",
|
|
1740
|
+
flexShrink: 0
|
|
1741
|
+
},
|
|
1742
|
+
children: C.avatarUrl ? /* @__PURE__ */ e("img", { src: C.avatarUrl, alt: "", style: { width: "100%", height: "100%", objectFit: "cover" } }) : Le(C.name)
|
|
1743
|
+
}
|
|
1744
|
+
),
|
|
1745
|
+
/* @__PURE__ */ e("span", { children: C.name }),
|
|
1746
|
+
/* @__PURE__ */ e("span", { style: { opacity: 0.6 }, children: "•" })
|
|
1747
|
+
]
|
|
1748
|
+
}
|
|
1749
|
+
),
|
|
1750
|
+
/* @__PURE__ */ n("time", { children: [
|
|
1751
|
+
at(t.occurredAt, !0),
|
|
1752
|
+
S && /* @__PURE__ */ n(ie, { children: [
|
|
1753
|
+
" ",
|
|
1754
|
+
/* @__PURE__ */ e(bt, { status: t.status })
|
|
1755
|
+
] })
|
|
1274
1756
|
] })
|
|
1275
|
-
] }),
|
|
1276
|
-
|
|
1277
|
-
|
|
1757
|
+
] }), I = /* @__PURE__ */ e("div", { style: { position: "absolute", bottom: 6, right: 8 }, children: /* @__PURE__ */ n("time", { style: { fontSize: 10, color: "#fff", textShadow: "0 1px 3px rgba(0,0,0,.5)", letterSpacing: 0.2, userSelect: "none" }, children: [
|
|
1758
|
+
at(t.occurredAt, !0),
|
|
1759
|
+
S && /* @__PURE__ */ n(ie, { children: [
|
|
1278
1760
|
" ",
|
|
1279
|
-
/* @__PURE__ */ e(
|
|
1761
|
+
/* @__PURE__ */ e(bt, { status: t.status })
|
|
1280
1762
|
] })
|
|
1281
|
-
] }) }), L =
|
|
1282
|
-
return /* @__PURE__ */ n("div", { style: { ...
|
|
1283
|
-
|
|
1284
|
-
/* @__PURE__ */ e("img", { src:
|
|
1285
|
-
P &&
|
|
1286
|
-
] }, `s${
|
|
1287
|
-
|
|
1288
|
-
/* @__PURE__ */ e("img", { src:
|
|
1289
|
-
P &&
|
|
1290
|
-
] },
|
|
1291
|
-
|
|
1292
|
-
/* @__PURE__ */ e("video", { src:
|
|
1293
|
-
/* @__PURE__ */ e("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: 12, background: "rgba(0,0,0,.25)" }, children: /* @__PURE__ */ e("div", { style: { width: 40, height: 40, borderRadius: "50%", background: "rgba(255,255,255,.9)", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ e(
|
|
1294
|
-
P &&
|
|
1295
|
-
] },
|
|
1296
|
-
(
|
|
1297
|
-
|
|
1298
|
-
|
|
1763
|
+
] }) }), L = S ? { ...f.bubbleOut, background: i, color: "#fff", border: "1px solid transparent" } : f.bubbleIn, P = !t.text && v.length === 0 && W.length === 0;
|
|
1764
|
+
return /* @__PURE__ */ n("div", { style: { ...f.messageLine, justifyContent: $, flexDirection: "column", alignItems: $ }, children: [
|
|
1765
|
+
M.map((b, E) => /* @__PURE__ */ n("div", { style: { position: "relative", marginBottom: 2 }, children: [
|
|
1766
|
+
/* @__PURE__ */ e("img", { src: h(b.url), alt: "sticker", style: { display: "block", maxWidth: 128, maxHeight: 128, objectFit: "contain" } }),
|
|
1767
|
+
P && m.length === 0 && w.length === 0 && E === M.length - 1 && I
|
|
1768
|
+
] }, `s${E}`)),
|
|
1769
|
+
m.map((b, E) => /* @__PURE__ */ n("div", { style: { position: "relative", marginBottom: 2, cursor: "zoom-in" }, onClick: () => j({ url: h(b.url), kind: "image" }), children: [
|
|
1770
|
+
/* @__PURE__ */ e("img", { src: h(b.url), alt: "", style: { display: "block", maxWidth: 260, maxHeight: 260, borderRadius: 12, objectFit: "cover" } }),
|
|
1771
|
+
P && E === m.length - 1 && w.length === 0 && I
|
|
1772
|
+
] }, E)),
|
|
1773
|
+
w.map((b, E) => /* @__PURE__ */ n("div", { style: { position: "relative", marginBottom: 2, cursor: "pointer" }, onClick: () => j({ url: h(b.url), kind: "video" }), children: [
|
|
1774
|
+
/* @__PURE__ */ e("video", { src: h(b.url), style: { display: "block", maxWidth: 260, maxHeight: 200, borderRadius: 12, objectFit: "cover" } }),
|
|
1775
|
+
/* @__PURE__ */ e("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: 12, background: "rgba(0,0,0,.25)" }, children: /* @__PURE__ */ e("div", { style: { width: 40, height: 40, borderRadius: "50%", background: "rgba(255,255,255,.9)", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ e(Nt, { size: 16, fill: "#172033", color: "#172033", style: { marginLeft: 2 } }) }) }),
|
|
1776
|
+
P && E === w.length - 1 && I
|
|
1777
|
+
] }, E)),
|
|
1778
|
+
(v.length > 0 || W.length > 0 || t.text || !m.length && !w.length && !M.length && !t.text) && /* @__PURE__ */ n("div", { style: L, children: [
|
|
1779
|
+
v.map((b, E) => /* @__PURE__ */ e("audio", { src: h(b.url), controls: !0, style: { display: "block", width: "100%", marginBottom: 4 } }, E)),
|
|
1780
|
+
W.map((b, E) => /* @__PURE__ */ n("a", { href: h(b.url), target: "_blank", rel: "noreferrer", style: { display: "block", fontSize: 12, color: S ? "#fff" : "#2563eb", textDecoration: "underline", marginBottom: 4 }, children: [
|
|
1299
1781
|
"📎 ",
|
|
1300
|
-
|
|
1301
|
-
] },
|
|
1782
|
+
tn(b.mimeType)
|
|
1783
|
+
] }, E)),
|
|
1302
1784
|
t.text && /* @__PURE__ */ e("p", { style: { margin: 0, whiteSpace: "pre-wrap", wordBreak: "break-word" }, children: t.text }),
|
|
1303
|
-
!
|
|
1304
|
-
|
|
1785
|
+
!v.length && !W.length && !t.text && /* @__PURE__ */ e("p", { style: { margin: 0, opacity: 0.5 }, children: "[attachment]" }),
|
|
1786
|
+
D
|
|
1305
1787
|
] }),
|
|
1306
|
-
|
|
1307
|
-
/* @__PURE__ */ n("div", { onClick: () =>
|
|
1308
|
-
|
|
1309
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
1788
|
+
T && St(
|
|
1789
|
+
/* @__PURE__ */ n("div", { onClick: () => j(null), style: { position: "fixed", inset: 0, zIndex: 1e4, background: "rgba(0,0,0,.88)", display: "flex", alignItems: "center", justifyContent: "center", cursor: "zoom-out" }, children: [
|
|
1790
|
+
T.kind === "image" ? /* @__PURE__ */ e("img", { src: T.url, alt: "", style: { maxWidth: "90vw", maxHeight: "90vh", borderRadius: 8, objectFit: "contain", boxShadow: "0 8px 40px rgba(0,0,0,.5)" }, onClick: (b) => b.stopPropagation() }) : /* @__PURE__ */ e("video", { src: T.url, controls: !0, autoPlay: !0, style: { maxWidth: "90vw", maxHeight: "90vh", borderRadius: 8, boxShadow: "0 8px 40px rgba(0,0,0,.5)" }, onClick: (b) => b.stopPropagation() }),
|
|
1791
|
+
/* @__PURE__ */ e("button", { onClick: () => j(null), style: { position: "absolute", top: 16, right: 16, background: "rgba(255,255,255,.15)", border: "none", borderRadius: "50%", width: 36, height: 36, cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center", color: "#fff" }, children: /* @__PURE__ */ e(Ue, { size: 18 }) })
|
|
1310
1792
|
] }),
|
|
1311
1793
|
document.body
|
|
1312
1794
|
)
|
|
1313
1795
|
] });
|
|
1314
1796
|
}
|
|
1315
|
-
function
|
|
1797
|
+
function an({
|
|
1316
1798
|
conversation: t,
|
|
1317
1799
|
connection: i,
|
|
1318
1800
|
primary: r,
|
|
1319
1801
|
onClose: o,
|
|
1320
|
-
client:
|
|
1321
|
-
onStartResize:
|
|
1322
|
-
extensions:
|
|
1323
|
-
extRefreshKey:
|
|
1324
|
-
onLinkContact:
|
|
1325
|
-
onRefreshContactInfo:
|
|
1802
|
+
client: h,
|
|
1803
|
+
onStartResize: S,
|
|
1804
|
+
extensions: m,
|
|
1805
|
+
extRefreshKey: M,
|
|
1806
|
+
onLinkContact: w,
|
|
1807
|
+
onRefreshContactInfo: v
|
|
1326
1808
|
}) {
|
|
1327
|
-
const
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1809
|
+
const W = t.contactName ?? t.subject ?? t.providerConversationKey, T = i == null ? void 0 : i.provider, j = !!(m != null && m.some((z) => z.contactInfoRows)), [$, C] = y({ channel: !0, stats: !1, extra: !0 }), D = (z) => C((oe) => ({ ...oe, [z]: !oe[z] })), [I, L] = y(""), [P, q] = y(!1), [te, Q] = y(!1), [B, x] = y(""), [b, E] = y([]), [V, ne] = y(!1);
|
|
1810
|
+
X(() => {
|
|
1811
|
+
L(""), Q(!1), x(""), h.getNote(t.id).then((z) => {
|
|
1812
|
+
z && L(z.content);
|
|
1331
1813
|
}).catch(() => {
|
|
1332
1814
|
});
|
|
1333
|
-
}, [t.id,
|
|
1334
|
-
if (!
|
|
1335
|
-
let
|
|
1336
|
-
const
|
|
1337
|
-
provider:
|
|
1338
|
-
linkContact:
|
|
1339
|
-
refreshContactInfo:
|
|
1340
|
-
sendMessage: async (
|
|
1341
|
-
await
|
|
1815
|
+
}, [t.id, h]), X(() => {
|
|
1816
|
+
if (!j || !m) return;
|
|
1817
|
+
let z = !1;
|
|
1818
|
+
const oe = Je(t, {
|
|
1819
|
+
provider: T,
|
|
1820
|
+
linkContact: w,
|
|
1821
|
+
refreshContactInfo: v,
|
|
1822
|
+
sendMessage: async (Z, O) => {
|
|
1823
|
+
await h.sendMessage(t.id, Z, O);
|
|
1342
1824
|
}
|
|
1343
1825
|
});
|
|
1344
|
-
return
|
|
1345
|
-
|
|
1346
|
-
).then((
|
|
1347
|
-
if (
|
|
1348
|
-
const
|
|
1349
|
-
|
|
1826
|
+
return ne(!0), Promise.allSettled(
|
|
1827
|
+
m.filter((Z) => Z.contactInfoRows).map((Z) => Z.contactInfoRows(oe))
|
|
1828
|
+
).then((Z) => {
|
|
1829
|
+
if (z) return;
|
|
1830
|
+
const O = Z.filter((ee) => ee.status === "fulfilled").flatMap((ee) => ee.value);
|
|
1831
|
+
E(O), ne(!1);
|
|
1350
1832
|
}), () => {
|
|
1351
|
-
|
|
1833
|
+
z = !0;
|
|
1352
1834
|
};
|
|
1353
|
-
}, [t.id, t.contactExternalId,
|
|
1835
|
+
}, [t.id, t.contactExternalId, m, M, j, T, w, v, h]);
|
|
1354
1836
|
async function de() {
|
|
1355
|
-
if (!(!
|
|
1356
|
-
|
|
1837
|
+
if (!(!I.trim() || P)) {
|
|
1838
|
+
q(!0), x("");
|
|
1357
1839
|
try {
|
|
1358
|
-
await
|
|
1840
|
+
await h.upsertNote(t.id, I.trim()), Q(!0), setTimeout(() => Q(!1), 2e3);
|
|
1359
1841
|
} catch {
|
|
1360
|
-
|
|
1842
|
+
x("Lưu thất bại");
|
|
1361
1843
|
} finally {
|
|
1362
|
-
|
|
1844
|
+
q(!1);
|
|
1363
1845
|
}
|
|
1364
1846
|
}
|
|
1365
1847
|
}
|
|
1366
|
-
return /* @__PURE__ */ n("aside", { style: { ...
|
|
1848
|
+
return /* @__PURE__ */ n("aside", { style: { ...f.infoPanel, position: "relative" }, children: [
|
|
1367
1849
|
/* @__PURE__ */ e(
|
|
1368
1850
|
"div",
|
|
1369
1851
|
{
|
|
1370
|
-
onMouseDown:
|
|
1852
|
+
onMouseDown: S,
|
|
1371
1853
|
style: { position: "absolute", left: 0, top: 0, bottom: 0, width: 4, cursor: "col-resize", zIndex: 1 },
|
|
1372
|
-
onMouseEnter: (
|
|
1373
|
-
|
|
1854
|
+
onMouseEnter: (z) => {
|
|
1855
|
+
z.currentTarget.style.background = "rgba(0,0,0,0.07)";
|
|
1374
1856
|
},
|
|
1375
|
-
onMouseLeave: (
|
|
1376
|
-
|
|
1857
|
+
onMouseLeave: (z) => {
|
|
1858
|
+
z.currentTarget.style.background = "";
|
|
1377
1859
|
}
|
|
1378
1860
|
}
|
|
1379
1861
|
),
|
|
1380
|
-
/* @__PURE__ */ n("div", { style:
|
|
1862
|
+
/* @__PURE__ */ n("div", { style: f.infoPanelHeader, children: [
|
|
1381
1863
|
/* @__PURE__ */ e("span", { style: { fontWeight: 600, fontSize: 13, color: d.ink }, children: "Thông tin liên hệ" }),
|
|
1382
|
-
/* @__PURE__ */ e("button", { style:
|
|
1864
|
+
/* @__PURE__ */ e("button", { style: f.iconButton, onClick: o, "aria-label": "Đóng", children: /* @__PURE__ */ e(Ue, { size: 16, strokeWidth: 2 }) })
|
|
1383
1865
|
] }),
|
|
1384
1866
|
/* @__PURE__ */ n("div", { style: { overflowY: "auto", flex: 1 }, children: [
|
|
1385
|
-
/* @__PURE__ */ n("div", { style:
|
|
1386
|
-
/* @__PURE__ */ n("span", { style: { ...
|
|
1867
|
+
/* @__PURE__ */ n("div", { style: f.infoPanelIdentity, children: [
|
|
1868
|
+
/* @__PURE__ */ n("span", { style: { ...f.avatarWrap, width: 48, height: 48 }, children: [
|
|
1387
1869
|
/* @__PURE__ */ e(
|
|
1388
|
-
|
|
1870
|
+
dt,
|
|
1389
1871
|
{
|
|
1390
1872
|
src: t.contactPictureUrl,
|
|
1391
|
-
fallback:
|
|
1392
|
-
style: { ...
|
|
1873
|
+
fallback: Le(W),
|
|
1874
|
+
style: { ...f.avatar, width: 48, height: 48, fontSize: 16 }
|
|
1393
1875
|
}
|
|
1394
1876
|
),
|
|
1395
|
-
/* @__PURE__ */ e("span", { style: { ...
|
|
1877
|
+
/* @__PURE__ */ e("span", { style: { ...f.providerBadge, width: 20, height: 20 }, children: /* @__PURE__ */ e(De, { provider: T }) })
|
|
1396
1878
|
] }),
|
|
1397
|
-
/* @__PURE__ */ e("strong", { style: { marginTop: 10, fontSize: 15, color: d.ink, textAlign: "center" }, children:
|
|
1879
|
+
/* @__PURE__ */ e("strong", { style: { marginTop: 10, fontSize: 15, color: d.ink, textAlign: "center" }, children: W }),
|
|
1398
1880
|
/* @__PURE__ */ e("span", { style: { fontSize: 11, color: d.muted, fontFamily: "monospace", textAlign: "center" }, children: t.providerConversationKey })
|
|
1399
1881
|
] }),
|
|
1400
|
-
/* @__PURE__ */ n(
|
|
1401
|
-
/* @__PURE__ */ e(
|
|
1402
|
-
/* @__PURE__ */ e(
|
|
1403
|
-
/* @__PURE__ */ e("span", { children:
|
|
1882
|
+
/* @__PURE__ */ n(_e, { label: "KÊNH", sectionKey: "channel", expanded: $.channel, onToggle: () => D("channel"), children: [
|
|
1883
|
+
/* @__PURE__ */ e(ge, { label: "Nền tảng", children: /* @__PURE__ */ n("span", { style: { display: "flex", alignItems: "center", gap: 5 }, children: [
|
|
1884
|
+
/* @__PURE__ */ e(De, { provider: T }),
|
|
1885
|
+
/* @__PURE__ */ e("span", { children: Wt(T) })
|
|
1404
1886
|
] }) }),
|
|
1405
|
-
/* @__PURE__ */ n(
|
|
1887
|
+
/* @__PURE__ */ n(ge, { label: "ID hội thoại", children: [
|
|
1406
1888
|
/* @__PURE__ */ n("span", { style: { fontFamily: "monospace", fontSize: 11 }, children: [
|
|
1407
1889
|
t.id.slice(0, 8),
|
|
1408
1890
|
"…"
|
|
1409
1891
|
] }),
|
|
1410
|
-
/* @__PURE__ */ e(
|
|
1892
|
+
/* @__PURE__ */ e(ln, { value: t.id })
|
|
1411
1893
|
] })
|
|
1412
1894
|
] }),
|
|
1413
|
-
/* @__PURE__ */ n(
|
|
1414
|
-
/* @__PURE__ */ e(
|
|
1415
|
-
(t.unreadCount ?? 0) > 0 && /* @__PURE__ */ e(
|
|
1895
|
+
/* @__PURE__ */ n(_e, { label: "THỐNG KÊ", sectionKey: "stats", expanded: $.stats, onToggle: () => D("stats"), children: [
|
|
1896
|
+
/* @__PURE__ */ e(ge, { label: "Tin nhắn", value: String(t.messageCount ?? 0) }),
|
|
1897
|
+
(t.unreadCount ?? 0) > 0 && /* @__PURE__ */ e(ge, { label: "Chưa đọc", value: String(t.unreadCount), valueColor: "#ef4444" }),
|
|
1416
1898
|
/* @__PURE__ */ e(
|
|
1417
|
-
|
|
1899
|
+
ge,
|
|
1418
1900
|
{
|
|
1419
1901
|
label: "Gần nhất",
|
|
1420
1902
|
value: t.lastMessageAt ? new Date(t.lastMessageAt).toLocaleDateString("vi-VN", { day: "2-digit", month: "2-digit", year: "numeric" }) : "—"
|
|
1421
1903
|
}
|
|
1422
1904
|
),
|
|
1423
|
-
/* @__PURE__ */ e(
|
|
1905
|
+
/* @__PURE__ */ e(ge, { label: "Lần đầu", value: "—" })
|
|
1424
1906
|
] }),
|
|
1425
|
-
/* @__PURE__ */ n(
|
|
1426
|
-
!
|
|
1427
|
-
/* @__PURE__ */ e(
|
|
1428
|
-
/* @__PURE__ */ e(
|
|
1429
|
-
/* @__PURE__ */ e(
|
|
1907
|
+
/* @__PURE__ */ n(_e, { label: "THÔNG TIN BỔ SUNG", sectionKey: "extra", expanded: $.extra, onToggle: () => D("extra"), children: [
|
|
1908
|
+
!j && /* @__PURE__ */ n(ie, { children: [
|
|
1909
|
+
/* @__PURE__ */ e(ge, { label: "Điện thoại", value: "— chưa có", valueMuted: !0 }),
|
|
1910
|
+
/* @__PURE__ */ e(ge, { label: "Email", value: "— chưa có", valueMuted: !0 }),
|
|
1911
|
+
/* @__PURE__ */ e(ge, { label: "Nhãn", value: "— chưa có", valueMuted: !0 })
|
|
1430
1912
|
] }),
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1913
|
+
V && b.length === 0 && /* @__PURE__ */ e("div", { style: { fontSize: 12, color: d.muted, padding: "6px 0" }, children: "Đang tải hồ sơ CRM…" }),
|
|
1914
|
+
b.map((z) => /* @__PURE__ */ e(ge, { label: z.label, children: /* @__PURE__ */ n("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, flexWrap: "wrap", justifyContent: "flex-end" }, children: [
|
|
1915
|
+
z.onClick ? /* @__PURE__ */ e(
|
|
1434
1916
|
"button",
|
|
1435
1917
|
{
|
|
1436
1918
|
type: "button",
|
|
1437
|
-
onClick:
|
|
1919
|
+
onClick: z.onClick,
|
|
1438
1920
|
style: { border: 0, background: "none", padding: 0, color: r, fontSize: 12, fontWeight: 600, cursor: "pointer", textDecoration: "underline" },
|
|
1439
|
-
children:
|
|
1921
|
+
children: z.value
|
|
1440
1922
|
}
|
|
1441
|
-
) :
|
|
1442
|
-
|
|
1923
|
+
) : z.href ? /* @__PURE__ */ e("a", { href: z.href, target: "_blank", rel: "noopener noreferrer", style: { color: r, fontSize: 12, fontWeight: 600 }, children: z.value }) : /* @__PURE__ */ e("span", { style: { fontSize: 12, fontWeight: 500, color: d.ink }, children: z.value }),
|
|
1924
|
+
z.badge && /* @__PURE__ */ e(
|
|
1443
1925
|
"span",
|
|
1444
1926
|
{
|
|
1445
1927
|
style: {
|
|
@@ -1447,49 +1929,49 @@ function Vt({
|
|
|
1447
1929
|
fontWeight: 700,
|
|
1448
1930
|
padding: "1px 7px",
|
|
1449
1931
|
borderRadius: 999,
|
|
1450
|
-
color:
|
|
1451
|
-
background:
|
|
1932
|
+
color: z.badge.color ?? r,
|
|
1933
|
+
background: z.badge.bg ?? `${r}14`
|
|
1452
1934
|
},
|
|
1453
|
-
children:
|
|
1935
|
+
children: z.badge.text
|
|
1454
1936
|
}
|
|
1455
1937
|
)
|
|
1456
|
-
] }) },
|
|
1938
|
+
] }) }, z.label))
|
|
1457
1939
|
] }),
|
|
1458
1940
|
/* @__PURE__ */ n("div", { style: { padding: "12px 16px", display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
1459
|
-
!(
|
|
1460
|
-
|
|
1461
|
-
const
|
|
1941
|
+
!(m != null && m.length) && /* @__PURE__ */ e("button", { style: { ...f.ghostButton, color: r, borderColor: `${r}33` }, children: "Xem lịch sử" }),
|
|
1942
|
+
m == null ? void 0 : m.flatMap((z) => z.sidebarActions ?? []).map((z, oe) => {
|
|
1943
|
+
const Z = z.variant === "primary";
|
|
1462
1944
|
return /* @__PURE__ */ n(
|
|
1463
1945
|
"button",
|
|
1464
1946
|
{
|
|
1465
1947
|
style: {
|
|
1466
|
-
...
|
|
1467
|
-
background:
|
|
1468
|
-
color:
|
|
1469
|
-
borderColor:
|
|
1470
|
-
fontWeight:
|
|
1948
|
+
...f.ghostButton,
|
|
1949
|
+
background: Z ? r : "#fff",
|
|
1950
|
+
color: Z ? "#fff" : d.ink,
|
|
1951
|
+
borderColor: Z ? r : d.line,
|
|
1952
|
+
fontWeight: Z ? 700 : 600,
|
|
1471
1953
|
display: "flex",
|
|
1472
1954
|
alignItems: "center",
|
|
1473
1955
|
justifyContent: "center",
|
|
1474
1956
|
gap: 6
|
|
1475
1957
|
},
|
|
1476
1958
|
onClick: () => {
|
|
1477
|
-
const
|
|
1478
|
-
provider:
|
|
1479
|
-
linkContact:
|
|
1480
|
-
refreshContactInfo:
|
|
1481
|
-
sendMessage: async (
|
|
1482
|
-
await
|
|
1959
|
+
const O = Je(t, {
|
|
1960
|
+
provider: T,
|
|
1961
|
+
linkContact: w,
|
|
1962
|
+
refreshContactInfo: v,
|
|
1963
|
+
sendMessage: async (ee, se) => {
|
|
1964
|
+
await h.sendMessage(t.id, ee, se);
|
|
1483
1965
|
}
|
|
1484
1966
|
});
|
|
1485
|
-
|
|
1967
|
+
z.onClick(O);
|
|
1486
1968
|
},
|
|
1487
1969
|
children: [
|
|
1488
|
-
|
|
1489
|
-
|
|
1970
|
+
z.icon,
|
|
1971
|
+
z.label
|
|
1490
1972
|
]
|
|
1491
1973
|
},
|
|
1492
|
-
|
|
1974
|
+
oe
|
|
1493
1975
|
);
|
|
1494
1976
|
}),
|
|
1495
1977
|
/* @__PURE__ */ n("div", { style: { border: `1px solid ${d.line}`, borderRadius: 10, background: "#fff", overflow: "hidden" }, children: [
|
|
@@ -1497,18 +1979,18 @@ function Vt({
|
|
|
1497
1979
|
/* @__PURE__ */ e(
|
|
1498
1980
|
"textarea",
|
|
1499
1981
|
{
|
|
1500
|
-
value:
|
|
1501
|
-
onChange: (
|
|
1982
|
+
value: I,
|
|
1983
|
+
onChange: (z) => L(z.target.value),
|
|
1502
1984
|
placeholder: "Nhập ghi chú...",
|
|
1503
1985
|
rows: 3,
|
|
1504
1986
|
style: { display: "block", width: "100%", boxSizing: "border-box", border: 0, outline: 0, background: "transparent", resize: "none", padding: "8px 10px", font: "inherit", fontSize: 12, color: d.ink, lineHeight: 1.5 }
|
|
1505
1987
|
}
|
|
1506
1988
|
),
|
|
1507
1989
|
/* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "4px 10px 6px" }, children: [
|
|
1508
|
-
|
|
1990
|
+
te ? /* @__PURE__ */ n("span", { style: { display: "flex", alignItems: "center", gap: 4, fontSize: 11, color: "#16a34a" }, children: [
|
|
1509
1991
|
/* @__PURE__ */ e(lt, { size: 11, strokeWidth: 2.5 }),
|
|
1510
1992
|
" Đã lưu"
|
|
1511
|
-
] }) :
|
|
1993
|
+
] }) : B ? /* @__PURE__ */ e("span", { style: { fontSize: 11, color: "#ef4444" }, children: B }) : /* @__PURE__ */ e("span", {}),
|
|
1512
1994
|
/* @__PURE__ */ e(
|
|
1513
1995
|
"button",
|
|
1514
1996
|
{
|
|
@@ -1516,9 +1998,9 @@ function Vt({
|
|
|
1516
1998
|
onClick: () => {
|
|
1517
1999
|
de();
|
|
1518
2000
|
},
|
|
1519
|
-
disabled: !
|
|
1520
|
-
style: { padding: "4px 12px", border: 0, borderRadius: 7, fontSize: 12, fontWeight: 600, background:
|
|
1521
|
-
children:
|
|
2001
|
+
disabled: !I.trim() || P,
|
|
2002
|
+
style: { padding: "4px 12px", border: 0, borderRadius: 7, fontSize: 12, fontWeight: 600, background: I.trim() && !P ? "linear-gradient(135deg,#f59e0b,#fbbf24)" : "#e5e7eb", color: I.trim() && !P ? "#fff" : "#9ca3af", cursor: I.trim() && !P ? "pointer" : "not-allowed" },
|
|
2003
|
+
children: P ? "Đang lưu…" : "Lưu ghi chú"
|
|
1522
2004
|
}
|
|
1523
2005
|
)
|
|
1524
2006
|
] })
|
|
@@ -1527,30 +2009,30 @@ function Vt({
|
|
|
1527
2009
|
] })
|
|
1528
2010
|
] });
|
|
1529
2011
|
}
|
|
1530
|
-
function
|
|
1531
|
-
const
|
|
2012
|
+
function _e({ label: t, children: i, sectionKey: r, expanded: o, onToggle: h }) {
|
|
2013
|
+
const S = !!h, m = o ?? !0;
|
|
1532
2014
|
return /* @__PURE__ */ n("div", { style: { borderTop: `1px solid ${d.line}` }, children: [
|
|
1533
2015
|
/* @__PURE__ */ n(
|
|
1534
2016
|
"div",
|
|
1535
2017
|
{
|
|
1536
|
-
style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "10px 16px 6px", fontSize: 10, fontWeight: 700, letterSpacing: 1, color: d.muted, textTransform: "uppercase", cursor:
|
|
1537
|
-
onClick:
|
|
2018
|
+
style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "10px 16px 6px", fontSize: 10, fontWeight: 700, letterSpacing: 1, color: d.muted, textTransform: "uppercase", cursor: S ? "pointer" : "default" },
|
|
2019
|
+
onClick: h,
|
|
1538
2020
|
children: [
|
|
1539
2021
|
/* @__PURE__ */ e("span", { children: t }),
|
|
1540
|
-
|
|
2022
|
+
S && (m ? /* @__PURE__ */ e(nt, { size: 12, strokeWidth: 2 }) : /* @__PURE__ */ e(jt, { size: 12, strokeWidth: 2 }))
|
|
1541
2023
|
]
|
|
1542
2024
|
}
|
|
1543
2025
|
),
|
|
1544
|
-
|
|
2026
|
+
m && i
|
|
1545
2027
|
] });
|
|
1546
2028
|
}
|
|
1547
|
-
function
|
|
2029
|
+
function ge({ label: t, value: i, children: r, valueColor: o, valueMuted: h }) {
|
|
1548
2030
|
return /* @__PURE__ */ n("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start", padding: "5px 16px", fontSize: 12, gap: 10 }, children: [
|
|
1549
2031
|
/* @__PURE__ */ e("span", { style: { color: d.muted, flexShrink: 0, lineHeight: 1.4 }, children: t }),
|
|
1550
|
-
/* @__PURE__ */ e("span", { style: { color: o ?? (
|
|
2032
|
+
/* @__PURE__ */ e("span", { style: { color: o ?? (h ? d.muted : d.ink), textAlign: "right", minWidth: 0, display: "flex", alignItems: "center", justifyContent: "flex-end", flexWrap: "wrap", gap: 4, lineHeight: 1.4 }, children: r ?? i })
|
|
1551
2033
|
] });
|
|
1552
2034
|
}
|
|
1553
|
-
function
|
|
2035
|
+
function ln({ value: t }) {
|
|
1554
2036
|
const [i, r] = y(!1);
|
|
1555
2037
|
return /* @__PURE__ */ e(
|
|
1556
2038
|
"button",
|
|
@@ -1567,41 +2049,41 @@ function Gt({ value: t }) {
|
|
|
1567
2049
|
}
|
|
1568
2050
|
);
|
|
1569
2051
|
}
|
|
1570
|
-
function
|
|
1571
|
-
return /* @__PURE__ */ n("div", { style:
|
|
1572
|
-
/* @__PURE__ */ e("div", { style:
|
|
2052
|
+
function dn() {
|
|
2053
|
+
return /* @__PURE__ */ n("div", { style: f.empty, children: [
|
|
2054
|
+
/* @__PURE__ */ e("div", { style: f.emptyHero, children: /* @__PURE__ */ e(Ut, { size: 16, strokeWidth: 2 }) }),
|
|
1573
2055
|
/* @__PURE__ */ e("h2", { children: "Chọn một hội thoại" }),
|
|
1574
2056
|
/* @__PURE__ */ e("p", { children: "Chọn hội thoại bên trái để xem và trả lời tin nhắn." })
|
|
1575
2057
|
] });
|
|
1576
2058
|
}
|
|
1577
|
-
function
|
|
1578
|
-
return /* @__PURE__ */ n("span", { style:
|
|
1579
|
-
/* @__PURE__ */ e(
|
|
1580
|
-
o && /* @__PURE__ */ e("span", { style:
|
|
2059
|
+
function $t({ name: t, color: i, image: r, provider: o }) {
|
|
2060
|
+
return /* @__PURE__ */ n("span", { style: f.avatarWrap, children: [
|
|
2061
|
+
/* @__PURE__ */ e(sn, { name: t, color: i, image: r }),
|
|
2062
|
+
o && /* @__PURE__ */ e("span", { style: f.providerBadge, children: /* @__PURE__ */ e(De, { provider: o }) })
|
|
1581
2063
|
] });
|
|
1582
2064
|
}
|
|
1583
|
-
function
|
|
1584
|
-
return /* @__PURE__ */ e(
|
|
2065
|
+
function sn({ name: t, color: i, image: r }) {
|
|
2066
|
+
return /* @__PURE__ */ e(dt, { src: r, fallback: Le(t), style: { ...f.avatar, background: `${i}18`, color: i } });
|
|
1585
2067
|
}
|
|
1586
|
-
function
|
|
1587
|
-
return /* @__PURE__ */ e(
|
|
2068
|
+
function ot() {
|
|
2069
|
+
return /* @__PURE__ */ e(zt, { size: 14, style: f.spinner, "aria-hidden": "true" });
|
|
1588
2070
|
}
|
|
1589
|
-
function
|
|
2071
|
+
function Le(t) {
|
|
1590
2072
|
return t.split(/\s+/).filter(Boolean).slice(-2).map((i) => i[0]).join("").toUpperCase() || "?";
|
|
1591
2073
|
}
|
|
1592
|
-
const
|
|
1593
|
-
function
|
|
1594
|
-
const i =
|
|
2074
|
+
const cn = { livechat: "web" };
|
|
2075
|
+
function De({ provider: t }) {
|
|
2076
|
+
const i = tt(st), r = 14;
|
|
1595
2077
|
if (!t) return null;
|
|
1596
|
-
const o =
|
|
2078
|
+
const o = cn[t] ?? t;
|
|
1597
2079
|
return /* @__PURE__ */ e("img", { src: `${i}/static/logos/${o}.avif`, alt: t, width: r, height: r, style: { borderRadius: "50%", objectFit: "cover", display: "block" } });
|
|
1598
2080
|
}
|
|
1599
|
-
function
|
|
2081
|
+
function at(t, i = !1) {
|
|
1600
2082
|
if (!t) return "";
|
|
1601
2083
|
const r = new Date(t);
|
|
1602
2084
|
return r.toDateString() === (/* @__PURE__ */ new Date()).toDateString() ? r.toLocaleTimeString("vi-VN", { hour: "2-digit", minute: "2-digit" }) : r.toLocaleDateString("vi-VN", { day: "2-digit", month: "2-digit" });
|
|
1603
2085
|
}
|
|
1604
|
-
const
|
|
2086
|
+
const f = {
|
|
1605
2087
|
frame: { display: "grid", gridTemplateRows: "minmax(0, 1fr)", height: 620, maxHeight: "calc(100dvh - 220px)", minHeight: 0, overflow: "hidden", border: `1px solid ${d.line}`, background: d.white, color: d.ink, boxShadow: "0 18px 50px rgba(31,45,72,.10)" },
|
|
1606
2088
|
sidebar: { display: "flex", flexDirection: "column", minWidth: 0, minHeight: 0, borderRight: `1px solid ${d.line}`, background: d.white },
|
|
1607
2089
|
brand: { display: "flex", alignItems: "center", gap: 10, padding: "20px 18px 16px" },
|
|
@@ -1648,14 +2130,14 @@ const p = {
|
|
|
1648
2130
|
infoPanelHeader: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "16px 16px 12px", borderBottom: `1px solid ${d.line}`, flex: "0 0 auto" },
|
|
1649
2131
|
infoPanelIdentity: { display: "flex", flexDirection: "column", alignItems: "center", padding: "20px 16px 16px", gap: 4 },
|
|
1650
2132
|
ghostButton: { width: "100%", padding: "8px 12px", border: `1px solid ${d.line}`, borderRadius: 8, background: "transparent", fontSize: 12, cursor: "pointer", textAlign: "center" }
|
|
1651
|
-
},
|
|
2133
|
+
}, hn = {
|
|
1652
2134
|
facebook: "#dbeafe",
|
|
1653
2135
|
zalo: "#e0f2fe",
|
|
1654
2136
|
instagram: "#fce7f3",
|
|
1655
2137
|
telegram: "#cffafe",
|
|
1656
2138
|
livechat: "#ede9fe",
|
|
1657
2139
|
whatsapp: "#dcfce7"
|
|
1658
|
-
},
|
|
2140
|
+
}, pn = {
|
|
1659
2141
|
facebook: "facebook",
|
|
1660
2142
|
instagram: "instagram",
|
|
1661
2143
|
telegram: "telegram",
|
|
@@ -1663,8 +2145,8 @@ const p = {
|
|
|
1663
2145
|
livechat: "web",
|
|
1664
2146
|
whatsapp: "web"
|
|
1665
2147
|
};
|
|
1666
|
-
function
|
|
1667
|
-
const o =
|
|
2148
|
+
function xe({ provider: t, apiUrl: i, size: r = 40 }) {
|
|
2149
|
+
const o = hn[t] ?? "#f1f5f9", h = pn[t], S = i.replace(/\/$/, "");
|
|
1668
2150
|
return /* @__PURE__ */ e(
|
|
1669
2151
|
"div",
|
|
1670
2152
|
{
|
|
@@ -1679,10 +2161,10 @@ function ge({ provider: t, apiUrl: i, size: r = 40 }) {
|
|
|
1679
2161
|
flexShrink: 0,
|
|
1680
2162
|
overflow: "hidden"
|
|
1681
2163
|
},
|
|
1682
|
-
children:
|
|
2164
|
+
children: h ? /* @__PURE__ */ e(
|
|
1683
2165
|
"img",
|
|
1684
2166
|
{
|
|
1685
|
-
src: `${
|
|
2167
|
+
src: `${S}/static/logos/${h}.avif`,
|
|
1686
2168
|
alt: t,
|
|
1687
2169
|
width: Math.round(r * 0.65),
|
|
1688
2170
|
height: Math.round(r * 0.65),
|
|
@@ -1692,14 +2174,14 @@ function ge({ provider: t, apiUrl: i, size: r = 40 }) {
|
|
|
1692
2174
|
}
|
|
1693
2175
|
);
|
|
1694
2176
|
}
|
|
1695
|
-
const
|
|
2177
|
+
const Oe = {
|
|
1696
2178
|
facebook: "Facebook",
|
|
1697
2179
|
zalo: "Zalo OA",
|
|
1698
2180
|
instagram: "Instagram",
|
|
1699
2181
|
telegram: "Telegram",
|
|
1700
2182
|
livechat: "Live Chat",
|
|
1701
2183
|
whatsapp: "WhatsApp"
|
|
1702
|
-
},
|
|
2184
|
+
}, un = {
|
|
1703
2185
|
facebook: "#dbeafe",
|
|
1704
2186
|
zalo: "#e0f2fe",
|
|
1705
2187
|
instagram: "#fce7f3",
|
|
@@ -1707,15 +2189,15 @@ const Be = {
|
|
|
1707
2189
|
livechat: "#ede9fe",
|
|
1708
2190
|
whatsapp: "#dcfce7"
|
|
1709
2191
|
};
|
|
1710
|
-
function
|
|
2192
|
+
function ct(t) {
|
|
1711
2193
|
const i = t.metadata;
|
|
1712
2194
|
return String(i.displayName ?? i.pageName ?? i.username ?? i.name ?? t.externalAccountId);
|
|
1713
2195
|
}
|
|
1714
|
-
function
|
|
1715
|
-
const i =
|
|
2196
|
+
function fn(t) {
|
|
2197
|
+
const i = Oe[t.provider] ?? t.provider, r = String(t.metadata.username ?? t.metadata.pageName ?? "");
|
|
1716
2198
|
return r ? `${i} · ${r}` : i;
|
|
1717
2199
|
}
|
|
1718
|
-
const
|
|
2200
|
+
const s = {
|
|
1719
2201
|
root: {
|
|
1720
2202
|
background: "#fff",
|
|
1721
2203
|
borderRadius: 16,
|
|
@@ -1990,272 +2472,272 @@ const a = {
|
|
|
1990
2472
|
fontFamily: "inherit"
|
|
1991
2473
|
}
|
|
1992
2474
|
};
|
|
1993
|
-
function
|
|
2475
|
+
function mt() {
|
|
1994
2476
|
return /* @__PURE__ */ e("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ e("path", { d: "M7 1v12M1 7h12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) });
|
|
1995
2477
|
}
|
|
1996
|
-
function
|
|
2478
|
+
function Be() {
|
|
1997
2479
|
return /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e("path", { d: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1998
2480
|
}
|
|
1999
|
-
function
|
|
2481
|
+
function xt() {
|
|
2000
2482
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: [
|
|
2001
2483
|
/* @__PURE__ */ e("rect", { x: "4", y: "4", width: "7", height: "7", rx: "1.5", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
2002
2484
|
/* @__PURE__ */ e("path", { d: "M2.5 8H2a1 1 0 01-1-1V2a1 1 0 011-1h5a1 1 0 011 1v.5", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })
|
|
2003
2485
|
] });
|
|
2004
2486
|
}
|
|
2005
|
-
function
|
|
2487
|
+
function vt() {
|
|
2006
2488
|
return /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ e("path", { d: "M2 6l3 3 5-5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2007
2489
|
}
|
|
2008
|
-
function
|
|
2490
|
+
function gn() {
|
|
2009
2491
|
return /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", style: { flexShrink: 0 }, children: [
|
|
2010
2492
|
/* @__PURE__ */ e("circle", { cx: "5", cy: "6", r: "3.5", stroke: "#ca8a04", strokeWidth: "1.4" }),
|
|
2011
2493
|
/* @__PURE__ */ e("path", { d: "M8 7.5l4.5 4.5M10.5 10l1.5 1.5", stroke: "#ca8a04", strokeWidth: "1.4", strokeLinecap: "round" })
|
|
2012
2494
|
] });
|
|
2013
2495
|
}
|
|
2014
|
-
function
|
|
2496
|
+
function yn() {
|
|
2015
2497
|
return /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", style: { flexShrink: 0, marginTop: 1 }, children: [
|
|
2016
2498
|
/* @__PURE__ */ e("circle", { cx: "7", cy: "7", r: "6", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
2017
2499
|
/* @__PURE__ */ e("path", { d: "M7 6v5M7 4.5v.01", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
2018
2500
|
] });
|
|
2019
2501
|
}
|
|
2020
|
-
let
|
|
2021
|
-
function
|
|
2022
|
-
if (
|
|
2023
|
-
|
|
2502
|
+
let kt = !1;
|
|
2503
|
+
function bn() {
|
|
2504
|
+
if (kt || typeof document > "u") return;
|
|
2505
|
+
kt = !0;
|
|
2024
2506
|
const t = document.createElement("style");
|
|
2025
2507
|
t.textContent = "@keyframes ch-spin{to{transform:rotate(360deg)}}", document.head.appendChild(t);
|
|
2026
2508
|
}
|
|
2027
|
-
function
|
|
2028
|
-
const o = t.replace(/\/$/, ""), [
|
|
2029
|
-
|
|
2030
|
-
const
|
|
2509
|
+
function $n({ apiUrl: t, token: i, onConnectionChange: r }) {
|
|
2510
|
+
const o = t.replace(/\/$/, ""), [h, S] = y([]), [m, M] = y(!0), [w, v] = y({ name: "list" }), [W, T] = y(null), [j, $] = y(!1), [C, D] = y(""), [I, L] = y(""), [P, q] = y(""), [te, Q] = y(""), [B, x] = y(!1), [b, E] = y(!1), V = J(null);
|
|
2511
|
+
bn();
|
|
2512
|
+
const ne = we(async () => {
|
|
2031
2513
|
try {
|
|
2032
|
-
const
|
|
2514
|
+
const c = await fetch(`${o}/v1/connections`, {
|
|
2033
2515
|
headers: { authorization: `Bearer ${i}` }
|
|
2034
2516
|
});
|
|
2035
|
-
if (!
|
|
2036
|
-
const H = await
|
|
2037
|
-
|
|
2038
|
-
} catch (
|
|
2039
|
-
|
|
2517
|
+
if (!c.ok) throw new Error("Không tải được kênh");
|
|
2518
|
+
const H = await c.json();
|
|
2519
|
+
S(H), r == null || r(H);
|
|
2520
|
+
} catch (c) {
|
|
2521
|
+
T(c instanceof Error ? c.message : "Lỗi tải dữ liệu");
|
|
2040
2522
|
} finally {
|
|
2041
|
-
|
|
2523
|
+
M(!1);
|
|
2042
2524
|
}
|
|
2043
2525
|
}, [o, i, r]);
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
}, [
|
|
2047
|
-
if (!
|
|
2048
|
-
const
|
|
2049
|
-
return () => clearTimeout(
|
|
2050
|
-
}, [
|
|
2051
|
-
|
|
2526
|
+
X(() => {
|
|
2527
|
+
ne();
|
|
2528
|
+
}, [ne]), X(() => {
|
|
2529
|
+
if (!W) return;
|
|
2530
|
+
const c = setTimeout(() => T(null), 5e3);
|
|
2531
|
+
return () => clearTimeout(c);
|
|
2532
|
+
}, [W]), X(() => () => {
|
|
2533
|
+
V.current && window.removeEventListener("message", V.current);
|
|
2052
2534
|
}, []);
|
|
2053
|
-
async function de(
|
|
2535
|
+
async function de(c, H) {
|
|
2054
2536
|
if (confirm(`Bạn chắc chắn muốn ngắt kết nối "${H}"?
|
|
2055
2537
|
|
|
2056
2538
|
Hành động này không thể hoàn tác.`))
|
|
2057
2539
|
try {
|
|
2058
|
-
if (!(await fetch(`${o}/v1/connections/${
|
|
2540
|
+
if (!(await fetch(`${o}/v1/connections/${c}`, {
|
|
2059
2541
|
method: "DELETE",
|
|
2060
2542
|
headers: { authorization: `Bearer ${i}` }
|
|
2061
2543
|
})).ok) throw new Error("Không thể ngắt kết nối");
|
|
2062
|
-
await
|
|
2063
|
-
} catch (
|
|
2064
|
-
|
|
2544
|
+
await ne();
|
|
2545
|
+
} catch (N) {
|
|
2546
|
+
T(N instanceof Error ? N.message : "Lỗi ngắt kết nối");
|
|
2065
2547
|
}
|
|
2066
2548
|
}
|
|
2067
|
-
async function
|
|
2068
|
-
if (!
|
|
2069
|
-
|
|
2549
|
+
async function z() {
|
|
2550
|
+
if (!C.trim()) {
|
|
2551
|
+
T("Vui lòng nhập Bot Token");
|
|
2070
2552
|
return;
|
|
2071
2553
|
}
|
|
2072
|
-
if (!/^\d+:[A-Za-z0-9_-]+$/.test(
|
|
2073
|
-
|
|
2554
|
+
if (!/^\d+:[A-Za-z0-9_-]+$/.test(C.trim())) {
|
|
2555
|
+
T("Token không đúng định dạng");
|
|
2074
2556
|
return;
|
|
2075
2557
|
}
|
|
2076
|
-
|
|
2558
|
+
$(!0), T(null);
|
|
2077
2559
|
try {
|
|
2078
|
-
const
|
|
2560
|
+
const c = await fetch(`${o}/v1/connect/telegram/start`, {
|
|
2079
2561
|
method: "POST",
|
|
2080
2562
|
headers: { authorization: `Bearer ${i}`, "content-type": "application/json" },
|
|
2081
|
-
body: JSON.stringify({ botToken:
|
|
2082
|
-
}), H = await
|
|
2083
|
-
if (!
|
|
2084
|
-
D(""),
|
|
2085
|
-
} catch (
|
|
2086
|
-
|
|
2563
|
+
body: JSON.stringify({ botToken: C.trim(), displayName: I.trim() || void 0 })
|
|
2564
|
+
}), H = await c.json();
|
|
2565
|
+
if (!c.ok || !H.connectionId) throw new Error(H.message ?? "Không thể kết nối Telegram");
|
|
2566
|
+
D(""), L(""), await ne(), v({ name: "list" });
|
|
2567
|
+
} catch (c) {
|
|
2568
|
+
T(c instanceof Error ? c.message : "Lỗi kết nối");
|
|
2087
2569
|
} finally {
|
|
2088
|
-
|
|
2570
|
+
$(!1);
|
|
2089
2571
|
}
|
|
2090
2572
|
}
|
|
2091
|
-
async function
|
|
2092
|
-
if (!
|
|
2093
|
-
|
|
2573
|
+
async function oe() {
|
|
2574
|
+
if (!P.trim()) {
|
|
2575
|
+
T("Vui lòng nhập tên widget");
|
|
2094
2576
|
return;
|
|
2095
2577
|
}
|
|
2096
|
-
|
|
2578
|
+
$(!0), T(null);
|
|
2097
2579
|
try {
|
|
2098
|
-
const
|
|
2580
|
+
const c = te.split(/[\n,]+/).map((ae) => ae.trim()).filter(Boolean), H = await fetch(`${o}/v1/connect/livechat/start`, {
|
|
2099
2581
|
method: "POST",
|
|
2100
2582
|
headers: { authorization: `Bearer ${i}`, "content-type": "application/json" },
|
|
2101
|
-
body: JSON.stringify({ displayName:
|
|
2102
|
-
}),
|
|
2103
|
-
if (!H.ok || !
|
|
2104
|
-
|
|
2583
|
+
body: JSON.stringify({ displayName: P.trim(), allowedDomains: c.length ? c : void 0 })
|
|
2584
|
+
}), N = await H.json();
|
|
2585
|
+
if (!H.ok || !N.connectionId || !N.embedScript) throw new Error(N.message ?? "Không thể tạo widget");
|
|
2586
|
+
q(""), Q(""), await ne(), v({
|
|
2105
2587
|
name: "livechat-result",
|
|
2106
|
-
connectionId:
|
|
2107
|
-
embedScript:
|
|
2108
|
-
identitySecret:
|
|
2109
|
-
allowedDomains:
|
|
2588
|
+
connectionId: N.connectionId,
|
|
2589
|
+
embedScript: N.embedScript,
|
|
2590
|
+
identitySecret: N.identitySecret ?? "",
|
|
2591
|
+
allowedDomains: N.allowedDomains ?? []
|
|
2110
2592
|
});
|
|
2111
|
-
} catch (
|
|
2112
|
-
|
|
2593
|
+
} catch (c) {
|
|
2594
|
+
T(c instanceof Error ? c.message : "Lỗi tạo widget");
|
|
2113
2595
|
} finally {
|
|
2114
|
-
|
|
2596
|
+
$(!1);
|
|
2115
2597
|
}
|
|
2116
2598
|
}
|
|
2117
|
-
async function
|
|
2118
|
-
|
|
2599
|
+
async function Z(c) {
|
|
2600
|
+
T(null);
|
|
2119
2601
|
try {
|
|
2120
|
-
const H = `${o}/static/oauth-popup.html`,
|
|
2602
|
+
const H = `${o}/static/oauth-popup.html`, N = await fetch(`${o}/v1/connect/${c}/start`, {
|
|
2121
2603
|
method: "POST",
|
|
2122
2604
|
headers: { authorization: `Bearer ${i}`, "content-type": "application/json" },
|
|
2123
2605
|
body: JSON.stringify({ callbackUrl: H })
|
|
2124
|
-
}),
|
|
2125
|
-
if (!
|
|
2126
|
-
const
|
|
2127
|
-
|
|
2128
|
-
const
|
|
2129
|
-
if (
|
|
2130
|
-
if (
|
|
2131
|
-
|
|
2606
|
+
}), ae = await N.json();
|
|
2607
|
+
if (!N.ok || !ae.authorizationUrl) throw new Error(ae.message ?? "Không thể bắt đầu kết nối");
|
|
2608
|
+
const ce = window.open(ae.authorizationUrl, "channelhub-oauth", "width=600,height=700,scrollbars=yes,resizable=yes");
|
|
2609
|
+
v({ name: "oauth-waiting", provider: c, popup: ce }), V.current && window.removeEventListener("message", V.current);
|
|
2610
|
+
const ye = (F) => {
|
|
2611
|
+
if (F.data) {
|
|
2612
|
+
if (F.data.type === "channelhub:oauth-select") {
|
|
2613
|
+
v({
|
|
2132
2614
|
name: "oauth-select",
|
|
2133
|
-
provider:
|
|
2134
|
-
sessionId: String(
|
|
2135
|
-
pages:
|
|
2136
|
-
popup:
|
|
2615
|
+
provider: F.data.provider,
|
|
2616
|
+
sessionId: String(F.data.sessionId ?? ""),
|
|
2617
|
+
pages: F.data.pages ?? [],
|
|
2618
|
+
popup: ce
|
|
2137
2619
|
});
|
|
2138
2620
|
return;
|
|
2139
2621
|
}
|
|
2140
|
-
|
|
2622
|
+
F.data.type === "channelhub:oauth" && (window.removeEventListener("message", ye), V.current = null, F.data.status === "active" ? (ne(), v({ name: "list" })) : (T("Kết nối thất bại: " + String(F.data.error ?? "Không xác định")), v({ name: "list" })));
|
|
2141
2623
|
}
|
|
2142
2624
|
};
|
|
2143
|
-
|
|
2625
|
+
V.current = ye, window.addEventListener("message", ye);
|
|
2144
2626
|
} catch (H) {
|
|
2145
|
-
|
|
2627
|
+
T(H instanceof Error ? H.message : "Lỗi kết nối"), v({ name: "list" });
|
|
2146
2628
|
}
|
|
2147
2629
|
}
|
|
2148
|
-
function
|
|
2149
|
-
navigator.clipboard.writeText(
|
|
2150
|
-
H === "script" ? (
|
|
2630
|
+
function O(c, H) {
|
|
2631
|
+
navigator.clipboard.writeText(c).then(() => {
|
|
2632
|
+
H === "script" ? (x(!0), setTimeout(() => x(!1), 2e3)) : (E(!0), setTimeout(() => E(!1), 2e3));
|
|
2151
2633
|
});
|
|
2152
2634
|
}
|
|
2153
|
-
function
|
|
2154
|
-
const
|
|
2155
|
-
if (
|
|
2635
|
+
function ee() {
|
|
2636
|
+
const c = w.name === "oauth-waiting" || w.name === "oauth-select" ? w.popup : null;
|
|
2637
|
+
if (c)
|
|
2156
2638
|
try {
|
|
2157
|
-
|
|
2639
|
+
c.close();
|
|
2158
2640
|
} catch {
|
|
2159
2641
|
}
|
|
2160
|
-
|
|
2642
|
+
V.current && (window.removeEventListener("message", V.current), V.current = null), v({ name: "add" });
|
|
2161
2643
|
}
|
|
2162
|
-
async function
|
|
2163
|
-
if (
|
|
2164
|
-
const { provider: H, sessionId:
|
|
2165
|
-
|
|
2166
|
-
const
|
|
2644
|
+
async function se(c) {
|
|
2645
|
+
if (w.name !== "oauth-select") return;
|
|
2646
|
+
const { provider: H, sessionId: N, popup: ae } = w;
|
|
2647
|
+
$(!0), T(null);
|
|
2648
|
+
const ce = {
|
|
2167
2649
|
facebook: `${o}/v1/connect/facebook/select-page`,
|
|
2168
2650
|
instagram: `${o}/v1/connect/instagram/select-account`,
|
|
2169
2651
|
zalo: `${o}/v1/connect/zalo/select-oa`
|
|
2170
|
-
},
|
|
2652
|
+
}, ye = {
|
|
2171
2653
|
facebook: "pageId",
|
|
2172
2654
|
instagram: "accountId",
|
|
2173
2655
|
zalo: "oaId"
|
|
2174
2656
|
};
|
|
2175
2657
|
try {
|
|
2176
|
-
const
|
|
2658
|
+
const F = await fetch(ce[H] ?? `${o}/v1/connect/${H}/select-page`, {
|
|
2177
2659
|
method: "POST",
|
|
2178
2660
|
headers: { authorization: `Bearer ${i}`, "content-type": "application/json" },
|
|
2179
|
-
body: JSON.stringify({ sessionId:
|
|
2180
|
-
}),
|
|
2181
|
-
if (!
|
|
2182
|
-
if (
|
|
2661
|
+
body: JSON.stringify({ sessionId: N, [ye[H] ?? "pageId"]: c })
|
|
2662
|
+
}), he = await F.json();
|
|
2663
|
+
if (!F.ok || !he.connectionId) throw new Error(he.message ?? "Không thể kết nối");
|
|
2664
|
+
if (ae)
|
|
2183
2665
|
try {
|
|
2184
|
-
|
|
2666
|
+
ae.postMessage({ type: "channelhub:close-popup" }, "*");
|
|
2185
2667
|
} catch {
|
|
2186
2668
|
}
|
|
2187
|
-
|
|
2188
|
-
} catch (
|
|
2189
|
-
|
|
2669
|
+
V.current && (window.removeEventListener("message", V.current), V.current = null), await ne(), v({ name: "list" });
|
|
2670
|
+
} catch (F) {
|
|
2671
|
+
T(F instanceof Error ? F.message : "Lỗi kết nối");
|
|
2190
2672
|
} finally {
|
|
2191
|
-
|
|
2673
|
+
$(!1);
|
|
2192
2674
|
}
|
|
2193
2675
|
}
|
|
2194
|
-
return /* @__PURE__ */ n("div", { style:
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
/* @__PURE__ */ n("div", { style:
|
|
2198
|
-
/* @__PURE__ */ e("div", { style:
|
|
2199
|
-
/* @__PURE__ */ e("div", { style:
|
|
2200
|
-
/* @__PURE__ */ e("div", { style:
|
|
2676
|
+
return /* @__PURE__ */ n("div", { style: s.root, children: [
|
|
2677
|
+
W && /* @__PURE__ */ e("div", { style: s.errorBanner, children: W }),
|
|
2678
|
+
w.name === "list" && /* @__PURE__ */ n(ie, { children: [
|
|
2679
|
+
/* @__PURE__ */ n("div", { style: s.header, children: [
|
|
2680
|
+
/* @__PURE__ */ e("div", { style: s.headerLeft, children: /* @__PURE__ */ n("div", { children: [
|
|
2681
|
+
/* @__PURE__ */ e("div", { style: s.title, children: "Kênh kết nối" }),
|
|
2682
|
+
/* @__PURE__ */ e("div", { style: s.subtitle, children: m ? "Đang tải…" : `${h.filter((c) => c.status === "active").length} kênh đang hoạt động` })
|
|
2201
2683
|
] }) }),
|
|
2202
|
-
/* @__PURE__ */ n("button", { style:
|
|
2203
|
-
/* @__PURE__ */ e(
|
|
2684
|
+
/* @__PURE__ */ n("button", { style: s.addBtn, onClick: () => v({ name: "add" }), children: [
|
|
2685
|
+
/* @__PURE__ */ e(mt, {}),
|
|
2204
2686
|
/* @__PURE__ */ e("span", { children: "Thêm kênh" })
|
|
2205
2687
|
] })
|
|
2206
2688
|
] }),
|
|
2207
|
-
/* @__PURE__ */ e("div", { style:
|
|
2208
|
-
/* @__PURE__ */ e("div", { style:
|
|
2209
|
-
/* @__PURE__ */ e("div", { style: { width: 64, height: 64, borderRadius: 16, background: "#f1f5f9", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ e(
|
|
2210
|
-
/* @__PURE__ */ e("div", { style:
|
|
2211
|
-
/* @__PURE__ */ e("div", { style:
|
|
2212
|
-
/* @__PURE__ */ n("button", { style:
|
|
2213
|
-
/* @__PURE__ */ e(
|
|
2689
|
+
/* @__PURE__ */ e("div", { style: s.divider }),
|
|
2690
|
+
/* @__PURE__ */ e("div", { style: s.body, children: !m && h.length === 0 ? /* @__PURE__ */ n("div", { style: s.empty, children: [
|
|
2691
|
+
/* @__PURE__ */ e("div", { style: { width: 64, height: 64, borderRadius: 16, background: "#f1f5f9", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ e(xe, { provider: "livechat", apiUrl: o, size: 40 }) }),
|
|
2692
|
+
/* @__PURE__ */ e("div", { style: s.emptyTitle, children: "Chưa có kênh nào được kết nối" }),
|
|
2693
|
+
/* @__PURE__ */ e("div", { style: s.emptyDesc, children: "Kết nối Facebook, Zalo OA, Telegram hoặc Live Chat để bắt đầu nhận tin nhắn từ khách hàng." }),
|
|
2694
|
+
/* @__PURE__ */ n("button", { style: s.emptyCta, onClick: () => v({ name: "add" }), children: [
|
|
2695
|
+
/* @__PURE__ */ e(mt, {}),
|
|
2214
2696
|
"Kết nối kênh đầu tiên"
|
|
2215
2697
|
] })
|
|
2216
|
-
] }) : /* @__PURE__ */ e("div", { children:
|
|
2217
|
-
|
|
2698
|
+
] }) : /* @__PURE__ */ e("div", { children: h.map((c) => /* @__PURE__ */ e(
|
|
2699
|
+
vn,
|
|
2218
2700
|
{
|
|
2219
|
-
conn:
|
|
2701
|
+
conn: c,
|
|
2220
2702
|
apiUrl: o,
|
|
2221
|
-
onDisconnect: () => void de(
|
|
2703
|
+
onDisconnect: () => void de(c.id, ct(c))
|
|
2222
2704
|
},
|
|
2223
|
-
|
|
2705
|
+
c.id
|
|
2224
2706
|
)) }) })
|
|
2225
2707
|
] }),
|
|
2226
|
-
|
|
2227
|
-
/* @__PURE__ */ e("div", { style:
|
|
2228
|
-
/* @__PURE__ */ e("button", { style:
|
|
2708
|
+
w.name === "add" && /* @__PURE__ */ n(ie, { children: [
|
|
2709
|
+
/* @__PURE__ */ e("div", { style: s.header, children: /* @__PURE__ */ n("div", { style: s.headerLeft, children: [
|
|
2710
|
+
/* @__PURE__ */ e("button", { style: s.backBtn, onClick: () => v({ name: "list" }), children: /* @__PURE__ */ e(Be, {}) }),
|
|
2229
2711
|
/* @__PURE__ */ n("div", { children: [
|
|
2230
|
-
/* @__PURE__ */ e("div", { style:
|
|
2231
|
-
/* @__PURE__ */ e("div", { style:
|
|
2712
|
+
/* @__PURE__ */ e("div", { style: s.title, children: "Thêm kênh mới" }),
|
|
2713
|
+
/* @__PURE__ */ e("div", { style: s.subtitle, children: "Chọn nền tảng bạn muốn kết nối" })
|
|
2232
2714
|
] })
|
|
2233
2715
|
] }) }),
|
|
2234
|
-
/* @__PURE__ */ e("div", { style:
|
|
2235
|
-
/* @__PURE__ */ e("div", { style:
|
|
2236
|
-
|
|
2716
|
+
/* @__PURE__ */ e("div", { style: s.divider }),
|
|
2717
|
+
/* @__PURE__ */ e("div", { style: s.body, children: /* @__PURE__ */ e("div", { style: s.providerGrid, children: kn.map((c) => /* @__PURE__ */ e(
|
|
2718
|
+
wn,
|
|
2237
2719
|
{
|
|
2238
|
-
provider:
|
|
2720
|
+
provider: c,
|
|
2239
2721
|
apiUrl: o,
|
|
2240
2722
|
onClick: () => {
|
|
2241
|
-
|
|
2723
|
+
c.type === "oauth" ? Z(c.id) : c.id === "telegram" ? v({ name: "connect-telegram" }) : v({ name: "connect-livechat" });
|
|
2242
2724
|
}
|
|
2243
2725
|
},
|
|
2244
|
-
|
|
2726
|
+
c.id
|
|
2245
2727
|
)) }) })
|
|
2246
2728
|
] }),
|
|
2247
|
-
|
|
2248
|
-
/* @__PURE__ */ n("div", { style:
|
|
2249
|
-
/* @__PURE__ */ e("button", { style:
|
|
2250
|
-
/* @__PURE__ */ e(
|
|
2729
|
+
w.name === "connect-telegram" && /* @__PURE__ */ n(ie, { children: [
|
|
2730
|
+
/* @__PURE__ */ n("div", { style: s.connectHeader, children: [
|
|
2731
|
+
/* @__PURE__ */ e("button", { style: s.backBtn, onClick: () => v({ name: "add" }), children: /* @__PURE__ */ e(Be, {}) }),
|
|
2732
|
+
/* @__PURE__ */ e(xe, { provider: "telegram", apiUrl: o, size: 44 }),
|
|
2251
2733
|
/* @__PURE__ */ n("div", { children: [
|
|
2252
|
-
/* @__PURE__ */ e("div", { style:
|
|
2253
|
-
/* @__PURE__ */ e("div", { style:
|
|
2734
|
+
/* @__PURE__ */ e("div", { style: s.connectTitle, children: "Kết nối Telegram Bot" }),
|
|
2735
|
+
/* @__PURE__ */ e("div", { style: s.connectDesc, children: "Nhập Bot Token để bắt đầu nhận tin nhắn" })
|
|
2254
2736
|
] })
|
|
2255
2737
|
] }),
|
|
2256
|
-
/* @__PURE__ */ n("div", { style:
|
|
2257
|
-
/* @__PURE__ */ n("div", { style:
|
|
2258
|
-
/* @__PURE__ */ e(
|
|
2738
|
+
/* @__PURE__ */ n("div", { style: s.form, children: [
|
|
2739
|
+
/* @__PURE__ */ n("div", { style: s.infoBox, children: [
|
|
2740
|
+
/* @__PURE__ */ e(yn, {}),
|
|
2259
2741
|
/* @__PURE__ */ n("div", { children: [
|
|
2260
2742
|
"Tạo bot mới bằng cách nhắn tin cho ",
|
|
2261
2743
|
/* @__PURE__ */ e("strong", { children: "@BotFather" }),
|
|
@@ -2264,113 +2746,113 @@ Hành động này không thể hoàn tác.`))
|
|
|
2264
2746
|
" rồi sao chép token được cấp."
|
|
2265
2747
|
] })
|
|
2266
2748
|
] }),
|
|
2267
|
-
/* @__PURE__ */ n("div", { style:
|
|
2268
|
-
/* @__PURE__ */ n("label", { style:
|
|
2749
|
+
/* @__PURE__ */ n("div", { style: s.field, children: [
|
|
2750
|
+
/* @__PURE__ */ n("label", { style: s.label, children: [
|
|
2269
2751
|
"Bot Token ",
|
|
2270
|
-
/* @__PURE__ */ e("span", { style:
|
|
2752
|
+
/* @__PURE__ */ e("span", { style: s.labelHint, children: "bắt buộc" })
|
|
2271
2753
|
] }),
|
|
2272
2754
|
/* @__PURE__ */ e(
|
|
2273
2755
|
"input",
|
|
2274
2756
|
{
|
|
2275
|
-
style:
|
|
2757
|
+
style: s.input,
|
|
2276
2758
|
type: "text",
|
|
2277
|
-
value:
|
|
2278
|
-
onChange: (
|
|
2759
|
+
value: C,
|
|
2760
|
+
onChange: (c) => D(c.target.value),
|
|
2279
2761
|
placeholder: "1234567890:AAExxxxxxxxxxxxxxxxxxxxxxxx",
|
|
2280
2762
|
autoComplete: "off",
|
|
2281
2763
|
spellCheck: !1
|
|
2282
2764
|
}
|
|
2283
2765
|
),
|
|
2284
|
-
/* @__PURE__ */ n("div", { style:
|
|
2766
|
+
/* @__PURE__ */ n("div", { style: s.inputHint, children: [
|
|
2285
2767
|
"Định dạng: ",
|
|
2286
2768
|
/* @__PURE__ */ e("code", { children: "số:ký_tự" }),
|
|
2287
2769
|
", ví dụ: ",
|
|
2288
2770
|
/* @__PURE__ */ e("code", { children: "1234567890:AAExxxxxxxx" })
|
|
2289
2771
|
] })
|
|
2290
2772
|
] }),
|
|
2291
|
-
/* @__PURE__ */ n("div", { style:
|
|
2292
|
-
/* @__PURE__ */ n("label", { style:
|
|
2773
|
+
/* @__PURE__ */ n("div", { style: s.field, children: [
|
|
2774
|
+
/* @__PURE__ */ n("label", { style: s.label, children: [
|
|
2293
2775
|
"Tên hiển thị ",
|
|
2294
|
-
/* @__PURE__ */ e("span", { style:
|
|
2776
|
+
/* @__PURE__ */ e("span", { style: s.labelHint, children: "tùy chọn" })
|
|
2295
2777
|
] }),
|
|
2296
2778
|
/* @__PURE__ */ e(
|
|
2297
2779
|
"input",
|
|
2298
2780
|
{
|
|
2299
|
-
style:
|
|
2781
|
+
style: s.input,
|
|
2300
2782
|
type: "text",
|
|
2301
|
-
value:
|
|
2302
|
-
onChange: (
|
|
2783
|
+
value: I,
|
|
2784
|
+
onChange: (c) => L(c.target.value),
|
|
2303
2785
|
placeholder: "VD: Bot hỗ trợ cửa hàng"
|
|
2304
2786
|
}
|
|
2305
2787
|
)
|
|
2306
2788
|
] }),
|
|
2307
|
-
/* @__PURE__ */ n("div", { style:
|
|
2308
|
-
/* @__PURE__ */ e("button", { style:
|
|
2309
|
-
/* @__PURE__ */ e("button", { style:
|
|
2789
|
+
/* @__PURE__ */ n("div", { style: s.formActions, children: [
|
|
2790
|
+
/* @__PURE__ */ e("button", { style: s.btnSecondary, onClick: () => v({ name: "add" }), children: "Hủy" }),
|
|
2791
|
+
/* @__PURE__ */ e("button", { style: s.btnPrimary, disabled: j, onClick: () => void z(), children: j ? "Đang kết nối…" : "Kết nối Telegram" })
|
|
2310
2792
|
] })
|
|
2311
2793
|
] })
|
|
2312
2794
|
] }),
|
|
2313
|
-
|
|
2314
|
-
/* @__PURE__ */ n("div", { style:
|
|
2315
|
-
/* @__PURE__ */ e("button", { style:
|
|
2316
|
-
/* @__PURE__ */ e(
|
|
2795
|
+
w.name === "connect-livechat" && /* @__PURE__ */ n(ie, { children: [
|
|
2796
|
+
/* @__PURE__ */ n("div", { style: s.connectHeader, children: [
|
|
2797
|
+
/* @__PURE__ */ e("button", { style: s.backBtn, onClick: () => v({ name: "add" }), children: /* @__PURE__ */ e(Be, {}) }),
|
|
2798
|
+
/* @__PURE__ */ e(xe, { provider: "livechat", apiUrl: o, size: 44 }),
|
|
2317
2799
|
/* @__PURE__ */ n("div", { children: [
|
|
2318
|
-
/* @__PURE__ */ e("div", { style:
|
|
2319
|
-
/* @__PURE__ */ e("div", { style:
|
|
2800
|
+
/* @__PURE__ */ e("div", { style: s.connectTitle, children: "Tạo Live Chat Widget" }),
|
|
2801
|
+
/* @__PURE__ */ e("div", { style: s.connectDesc, children: "Nhúng vào website để nhận tin nhắn từ khách hàng" })
|
|
2320
2802
|
] })
|
|
2321
2803
|
] }),
|
|
2322
|
-
/* @__PURE__ */ n("div", { style:
|
|
2323
|
-
/* @__PURE__ */ n("div", { style:
|
|
2324
|
-
/* @__PURE__ */ n("label", { style:
|
|
2804
|
+
/* @__PURE__ */ n("div", { style: s.form, children: [
|
|
2805
|
+
/* @__PURE__ */ n("div", { style: s.field, children: [
|
|
2806
|
+
/* @__PURE__ */ n("label", { style: s.label, children: [
|
|
2325
2807
|
"Tên widget ",
|
|
2326
|
-
/* @__PURE__ */ e("span", { style:
|
|
2808
|
+
/* @__PURE__ */ e("span", { style: s.labelHint, children: "bắt buộc" })
|
|
2327
2809
|
] }),
|
|
2328
2810
|
/* @__PURE__ */ e(
|
|
2329
2811
|
"input",
|
|
2330
2812
|
{
|
|
2331
|
-
style:
|
|
2813
|
+
style: s.input,
|
|
2332
2814
|
type: "text",
|
|
2333
|
-
value:
|
|
2334
|
-
onChange: (
|
|
2815
|
+
value: P,
|
|
2816
|
+
onChange: (c) => q(c.target.value),
|
|
2335
2817
|
placeholder: "VD: Hỗ trợ website hanashop.vn"
|
|
2336
2818
|
}
|
|
2337
2819
|
)
|
|
2338
2820
|
] }),
|
|
2339
|
-
/* @__PURE__ */ n("div", { style:
|
|
2340
|
-
/* @__PURE__ */ n("label", { style:
|
|
2821
|
+
/* @__PURE__ */ n("div", { style: s.field, children: [
|
|
2822
|
+
/* @__PURE__ */ n("label", { style: s.label, children: [
|
|
2341
2823
|
"Tên miền được phép ",
|
|
2342
|
-
/* @__PURE__ */ e("span", { style:
|
|
2824
|
+
/* @__PURE__ */ e("span", { style: s.labelHint, children: "tùy chọn" })
|
|
2343
2825
|
] }),
|
|
2344
2826
|
/* @__PURE__ */ e(
|
|
2345
2827
|
"textarea",
|
|
2346
2828
|
{
|
|
2347
|
-
style: { ...
|
|
2348
|
-
value:
|
|
2349
|
-
onChange: (
|
|
2829
|
+
style: { ...s.input, resize: "vertical", minHeight: 80, lineHeight: 1.5 },
|
|
2830
|
+
value: te,
|
|
2831
|
+
onChange: (c) => Q(c.target.value),
|
|
2350
2832
|
placeholder: `https://myshop.com
|
|
2351
2833
|
https://www.myshop.com`,
|
|
2352
2834
|
spellCheck: !1
|
|
2353
2835
|
}
|
|
2354
2836
|
),
|
|
2355
|
-
/* @__PURE__ */ e("div", { style:
|
|
2837
|
+
/* @__PURE__ */ e("div", { style: s.inputHint, children: "Mỗi domain một dòng. Để trống để cho phép tất cả." })
|
|
2356
2838
|
] }),
|
|
2357
|
-
/* @__PURE__ */ n("div", { style:
|
|
2358
|
-
/* @__PURE__ */ e("button", { style:
|
|
2359
|
-
/* @__PURE__ */ e("button", { style:
|
|
2839
|
+
/* @__PURE__ */ n("div", { style: s.formActions, children: [
|
|
2840
|
+
/* @__PURE__ */ e("button", { style: s.btnSecondary, onClick: () => v({ name: "add" }), children: "Hủy" }),
|
|
2841
|
+
/* @__PURE__ */ e("button", { style: s.btnPrimary, disabled: j, onClick: () => void oe(), children: j ? "Đang tạo…" : "Tạo widget" })
|
|
2360
2842
|
] })
|
|
2361
2843
|
] })
|
|
2362
2844
|
] }),
|
|
2363
|
-
|
|
2364
|
-
/* @__PURE__ */ n("div", { style:
|
|
2365
|
-
/* @__PURE__ */ e("button", { style:
|
|
2366
|
-
/* @__PURE__ */ e(
|
|
2845
|
+
w.name === "livechat-result" && /* @__PURE__ */ n(ie, { children: [
|
|
2846
|
+
/* @__PURE__ */ n("div", { style: s.connectHeader, children: [
|
|
2847
|
+
/* @__PURE__ */ e("button", { style: s.backBtn, onClick: () => v({ name: "list" }), children: /* @__PURE__ */ e(Be, {}) }),
|
|
2848
|
+
/* @__PURE__ */ e(xe, { provider: "livechat", apiUrl: o, size: 44 }),
|
|
2367
2849
|
/* @__PURE__ */ n("div", { children: [
|
|
2368
|
-
/* @__PURE__ */ e("div", { style:
|
|
2369
|
-
/* @__PURE__ */ e("div", { style:
|
|
2850
|
+
/* @__PURE__ */ e("div", { style: s.connectTitle, children: "Widget đã được tạo!" }),
|
|
2851
|
+
/* @__PURE__ */ e("div", { style: s.connectDesc, children: "Sao chép mã nhúng và dán vào website của bạn" })
|
|
2370
2852
|
] })
|
|
2371
2853
|
] }),
|
|
2372
|
-
/* @__PURE__ */ n("div", { style:
|
|
2373
|
-
/* @__PURE__ */ n("div", { style:
|
|
2854
|
+
/* @__PURE__ */ n("div", { style: s.form, children: [
|
|
2855
|
+
/* @__PURE__ */ n("div", { style: s.resultBanner, children: [
|
|
2374
2856
|
/* @__PURE__ */ e("span", { style: { fontSize: 16, flexShrink: 0 }, children: "✅" }),
|
|
2375
2857
|
/* @__PURE__ */ n("div", { children: [
|
|
2376
2858
|
/* @__PURE__ */ e("strong", { children: "Tạo thành công!" }),
|
|
@@ -2380,58 +2862,58 @@ https://www.myshop.com`,
|
|
|
2380
2862
|
] })
|
|
2381
2863
|
] }),
|
|
2382
2864
|
/* @__PURE__ */ n("div", { children: [
|
|
2383
|
-
/* @__PURE__ */ e("div", { style:
|
|
2384
|
-
/* @__PURE__ */ n("div", { style:
|
|
2385
|
-
/* @__PURE__ */ e("pre", { style:
|
|
2386
|
-
/* @__PURE__ */ e("button", { style: { ...
|
|
2387
|
-
/* @__PURE__ */ e(
|
|
2865
|
+
/* @__PURE__ */ e("div", { style: s.codeLabel, children: "Mã nhúng" }),
|
|
2866
|
+
/* @__PURE__ */ n("div", { style: s.codeBlock, children: [
|
|
2867
|
+
/* @__PURE__ */ e("pre", { style: s.codePre, children: w.embedScript }),
|
|
2868
|
+
/* @__PURE__ */ e("button", { style: { ...s.copyBtn, ...B ? { background: "#166534", borderColor: "#166534", color: "#bbf7d0" } : {} }, onClick: () => O(w.embedScript, "script"), children: B ? /* @__PURE__ */ n(ie, { children: [
|
|
2869
|
+
/* @__PURE__ */ e(vt, {}),
|
|
2388
2870
|
" Đã sao chép"
|
|
2389
|
-
] }) : /* @__PURE__ */ n(
|
|
2390
|
-
/* @__PURE__ */ e(
|
|
2871
|
+
] }) : /* @__PURE__ */ n(ie, { children: [
|
|
2872
|
+
/* @__PURE__ */ e(xt, {}),
|
|
2391
2873
|
" Sao chép"
|
|
2392
2874
|
] }) })
|
|
2393
2875
|
] })
|
|
2394
2876
|
] }),
|
|
2395
|
-
|
|
2396
|
-
/* @__PURE__ */ n("div", { style:
|
|
2877
|
+
w.identitySecret && /* @__PURE__ */ n("div", { children: [
|
|
2878
|
+
/* @__PURE__ */ n("div", { style: s.codeLabel, children: [
|
|
2397
2879
|
"Identity Secret ",
|
|
2398
|
-
/* @__PURE__ */ e("span", { style: { ...
|
|
2880
|
+
/* @__PURE__ */ e("span", { style: { ...s.labelHint, color: "#dc2626", fontWeight: 600 }, children: "Lưu ngay — chỉ hiển thị một lần" })
|
|
2399
2881
|
] }),
|
|
2400
|
-
/* @__PURE__ */ n("div", { style:
|
|
2401
|
-
/* @__PURE__ */ e(
|
|
2402
|
-
/* @__PURE__ */ e("span", { style:
|
|
2403
|
-
/* @__PURE__ */ e("span", { style:
|
|
2882
|
+
/* @__PURE__ */ n("div", { style: s.secretRow, children: [
|
|
2883
|
+
/* @__PURE__ */ e(gn, {}),
|
|
2884
|
+
/* @__PURE__ */ e("span", { style: s.secretLabel, children: "Secret:" }),
|
|
2885
|
+
/* @__PURE__ */ e("span", { style: s.secretValue, children: w.identitySecret }),
|
|
2404
2886
|
/* @__PURE__ */ e(
|
|
2405
2887
|
"button",
|
|
2406
2888
|
{
|
|
2407
|
-
onClick: () => w
|
|
2408
|
-
style: { border: "none", background: "transparent", cursor: "pointer", color:
|
|
2409
|
-
children:
|
|
2889
|
+
onClick: () => O(w.identitySecret, "secret"),
|
|
2890
|
+
style: { border: "none", background: "transparent", cursor: "pointer", color: b ? "#059669" : "#ca8a04", padding: 2, display: "flex", alignItems: "center" },
|
|
2891
|
+
children: b ? /* @__PURE__ */ e(vt, {}) : /* @__PURE__ */ e(xt, {})
|
|
2410
2892
|
}
|
|
2411
2893
|
)
|
|
2412
2894
|
] }),
|
|
2413
|
-
/* @__PURE__ */ e("div", { style: { ...
|
|
2895
|
+
/* @__PURE__ */ e("div", { style: { ...s.inputHint, marginTop: 6 }, children: "Dùng secret này để xác thực danh tính người dùng (HMAC). Giữ bí mật — không chia sẻ nơi công khai." })
|
|
2414
2896
|
] }),
|
|
2415
|
-
/* @__PURE__ */ n("div", { style:
|
|
2416
|
-
/* @__PURE__ */ e("button", { style:
|
|
2417
|
-
/* @__PURE__ */ e("button", { style:
|
|
2897
|
+
/* @__PURE__ */ n("div", { style: s.formActions, children: [
|
|
2898
|
+
/* @__PURE__ */ e("button", { style: s.btnSecondary, onClick: () => v({ name: "list" }), children: "Về danh sách" }),
|
|
2899
|
+
/* @__PURE__ */ e("button", { style: s.btnPrimary, onClick: () => v({ name: "add" }), children: "Thêm kênh khác" })
|
|
2418
2900
|
] })
|
|
2419
2901
|
] })
|
|
2420
2902
|
] }),
|
|
2421
|
-
|
|
2422
|
-
/* @__PURE__ */ e("div", { style:
|
|
2423
|
-
/* @__PURE__ */ e("button", { style:
|
|
2903
|
+
w.name === "oauth-waiting" && /* @__PURE__ */ n(ie, { children: [
|
|
2904
|
+
/* @__PURE__ */ e("div", { style: s.header, children: /* @__PURE__ */ n("div", { style: s.headerLeft, children: [
|
|
2905
|
+
/* @__PURE__ */ e("button", { style: s.backBtn, onClick: ee, children: /* @__PURE__ */ e(Be, {}) }),
|
|
2424
2906
|
/* @__PURE__ */ n("div", { children: [
|
|
2425
|
-
/* @__PURE__ */ n("div", { style:
|
|
2907
|
+
/* @__PURE__ */ n("div", { style: s.title, children: [
|
|
2426
2908
|
"Đang xác thực ",
|
|
2427
|
-
|
|
2909
|
+
Oe[w.provider]
|
|
2428
2910
|
] }),
|
|
2429
|
-
/* @__PURE__ */ e("div", { style:
|
|
2911
|
+
/* @__PURE__ */ e("div", { style: s.subtitle, children: "Vui lòng hoàn thành trong cửa sổ bật lên" })
|
|
2430
2912
|
] })
|
|
2431
2913
|
] }) }),
|
|
2432
|
-
/* @__PURE__ */ n("div", { style:
|
|
2914
|
+
/* @__PURE__ */ n("div", { style: s.oauthWaiting, children: [
|
|
2433
2915
|
/* @__PURE__ */ n("div", { style: { position: "relative", width: 72, height: 72 }, children: [
|
|
2434
|
-
/* @__PURE__ */ e("div", { style: { width: 72, height: 72, borderRadius: 20, background:
|
|
2916
|
+
/* @__PURE__ */ e("div", { style: { width: 72, height: 72, borderRadius: 20, background: un[w.provider] ?? "#f1f5f9", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ e(xe, { provider: w.provider, apiUrl: o, size: 48 }) }),
|
|
2435
2917
|
/* @__PURE__ */ n(
|
|
2436
2918
|
"svg",
|
|
2437
2919
|
{
|
|
@@ -2458,40 +2940,40 @@ https://www.myshop.com`,
|
|
|
2458
2940
|
}
|
|
2459
2941
|
)
|
|
2460
2942
|
] }),
|
|
2461
|
-
/* @__PURE__ */ n("div", { style:
|
|
2943
|
+
/* @__PURE__ */ n("div", { style: s.oauthTitle, children: [
|
|
2462
2944
|
"Đang chờ xác thực với ",
|
|
2463
|
-
|
|
2945
|
+
Oe[w.provider]
|
|
2464
2946
|
] }),
|
|
2465
|
-
/* @__PURE__ */ e("div", { style:
|
|
2947
|
+
/* @__PURE__ */ e("div", { style: s.oauthDesc, children: "Một cửa sổ đăng nhập đã được mở. Vui lòng đăng nhập và cấp quyền truy cập để hoàn tất kết nối." }),
|
|
2466
2948
|
/* @__PURE__ */ n("div", { style: { display: "flex", flexDirection: "column", gap: 8, alignItems: "flex-start", width: "100%", maxWidth: 280 }, children: [
|
|
2467
|
-
/* @__PURE__ */ e(
|
|
2468
|
-
/* @__PURE__ */ e(
|
|
2469
|
-
/* @__PURE__ */ e(
|
|
2949
|
+
/* @__PURE__ */ e(Qe, { done: !0, label: `Đã mở cửa sổ ${Oe[w.provider]}` }),
|
|
2950
|
+
/* @__PURE__ */ e(Qe, { active: !0, label: "Đang chờ bạn đăng nhập & cấp quyền" }),
|
|
2951
|
+
/* @__PURE__ */ e(Qe, { label: "Lưu kết nối & quay về" })
|
|
2470
2952
|
] }),
|
|
2471
|
-
/* @__PURE__ */ e("button", { style:
|
|
2953
|
+
/* @__PURE__ */ e("button", { style: s.oauthCancel, onClick: ee, children: "Hủy và quay lại" })
|
|
2472
2954
|
] })
|
|
2473
2955
|
] }),
|
|
2474
|
-
|
|
2475
|
-
/* @__PURE__ */ n("div", { style:
|
|
2476
|
-
/* @__PURE__ */ e("button", { style:
|
|
2477
|
-
/* @__PURE__ */ e(
|
|
2956
|
+
w.name === "oauth-select" && /* @__PURE__ */ n(ie, { children: [
|
|
2957
|
+
/* @__PURE__ */ n("div", { style: s.connectHeader, children: [
|
|
2958
|
+
/* @__PURE__ */ e("button", { style: s.backBtn, onClick: ee, children: /* @__PURE__ */ e(Be, {}) }),
|
|
2959
|
+
/* @__PURE__ */ e(xe, { provider: w.provider, apiUrl: o, size: 44 }),
|
|
2478
2960
|
/* @__PURE__ */ n("div", { children: [
|
|
2479
|
-
/* @__PURE__ */ n("div", { style:
|
|
2961
|
+
/* @__PURE__ */ n("div", { style: s.connectTitle, children: [
|
|
2480
2962
|
"Chọn ",
|
|
2481
|
-
|
|
2963
|
+
w.provider === "instagram" ? "tài khoản" : "trang"
|
|
2482
2964
|
] }),
|
|
2483
|
-
/* @__PURE__ */ n("div", { style:
|
|
2965
|
+
/* @__PURE__ */ n("div", { style: s.connectDesc, children: [
|
|
2484
2966
|
"Chọn ",
|
|
2485
|
-
|
|
2967
|
+
Oe[w.provider],
|
|
2486
2968
|
" bạn muốn kết nối với ChannelHub"
|
|
2487
2969
|
] })
|
|
2488
2970
|
] })
|
|
2489
2971
|
] }),
|
|
2490
|
-
/* @__PURE__ */ e("div", { style:
|
|
2972
|
+
/* @__PURE__ */ e("div", { style: s.body, children: w.pages.length === 0 ? /* @__PURE__ */ e("div", { style: { textAlign: "center", color: "#94a3b8", fontSize: 13, padding: "24px 0" }, children: "Không tìm thấy trang/tài khoản nào. Hãy thử lại." }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: w.pages.map((c) => /* @__PURE__ */ n(
|
|
2491
2973
|
"button",
|
|
2492
2974
|
{
|
|
2493
|
-
disabled:
|
|
2494
|
-
onClick: () => void
|
|
2975
|
+
disabled: j,
|
|
2976
|
+
onClick: () => void se(c.id),
|
|
2495
2977
|
style: {
|
|
2496
2978
|
display: "flex",
|
|
2497
2979
|
alignItems: "center",
|
|
@@ -2500,26 +2982,26 @@ https://www.myshop.com`,
|
|
|
2500
2982
|
borderRadius: 12,
|
|
2501
2983
|
border: "1.5px solid #e2e8f0",
|
|
2502
2984
|
background: "#fff",
|
|
2503
|
-
cursor:
|
|
2504
|
-
opacity:
|
|
2985
|
+
cursor: j ? "not-allowed" : "pointer",
|
|
2986
|
+
opacity: j ? 0.6 : 1,
|
|
2505
2987
|
textAlign: "left",
|
|
2506
2988
|
fontFamily: "inherit",
|
|
2507
2989
|
transition: "border-color .15s, background .15s"
|
|
2508
2990
|
},
|
|
2509
2991
|
children: [
|
|
2510
2992
|
/* @__PURE__ */ n("div", { children: [
|
|
2511
|
-
/* @__PURE__ */ e("div", { style: { fontSize: 14, fontWeight: 600, color: "#0f172a" }, children:
|
|
2512
|
-
/* @__PURE__ */ e("div", { style: { fontSize: 11, color: "#94a3b8", fontFamily: "monospace", marginTop: 2 }, children:
|
|
2993
|
+
/* @__PURE__ */ e("div", { style: { fontSize: 14, fontWeight: 600, color: "#0f172a" }, children: c.name }),
|
|
2994
|
+
/* @__PURE__ */ e("div", { style: { fontSize: 11, color: "#94a3b8", fontFamily: "monospace", marginTop: 2 }, children: c.id })
|
|
2513
2995
|
] }),
|
|
2514
|
-
/* @__PURE__ */ e("span", { style: { fontSize: 13, color: "#2563eb", fontWeight: 500 }, children:
|
|
2996
|
+
/* @__PURE__ */ e("span", { style: { fontSize: 13, color: "#2563eb", fontWeight: 500 }, children: j ? "Đang kết nối…" : "Chọn →" })
|
|
2515
2997
|
]
|
|
2516
2998
|
},
|
|
2517
|
-
|
|
2999
|
+
c.id
|
|
2518
3000
|
)) }) })
|
|
2519
3001
|
] })
|
|
2520
3002
|
] });
|
|
2521
3003
|
}
|
|
2522
|
-
function
|
|
3004
|
+
function mn(t) {
|
|
2523
3005
|
const i = t.metadata;
|
|
2524
3006
|
if (typeof i.pictureUrl == "string") return i.pictureUrl;
|
|
2525
3007
|
if (t.provider === "facebook")
|
|
@@ -2530,38 +3012,38 @@ function on(t) {
|
|
|
2530
3012
|
}
|
|
2531
3013
|
return null;
|
|
2532
3014
|
}
|
|
2533
|
-
function
|
|
2534
|
-
const [o,
|
|
2535
|
-
return
|
|
3015
|
+
function xn({ conn: t, apiUrl: i, size: r = 40 }) {
|
|
3016
|
+
const [o, h] = y(!1), S = mn(t), m = Math.round(r * 0.28);
|
|
3017
|
+
return S && !o ? /* @__PURE__ */ e(
|
|
2536
3018
|
"img",
|
|
2537
3019
|
{
|
|
2538
|
-
src:
|
|
2539
|
-
alt:
|
|
3020
|
+
src: S,
|
|
3021
|
+
alt: ct(t),
|
|
2540
3022
|
referrerPolicy: "no-referrer",
|
|
2541
|
-
onError: () =>
|
|
2542
|
-
style: { width: r, height: r, borderRadius:
|
|
3023
|
+
onError: () => h(!0),
|
|
3024
|
+
style: { width: r, height: r, borderRadius: m, objectFit: "cover", flexShrink: 0, display: "block" }
|
|
2543
3025
|
}
|
|
2544
|
-
) : /* @__PURE__ */ e(
|
|
3026
|
+
) : /* @__PURE__ */ e(xe, { provider: t.provider, apiUrl: i, size: r });
|
|
2545
3027
|
}
|
|
2546
|
-
function
|
|
2547
|
-
const [o,
|
|
2548
|
-
return /* @__PURE__ */ n("div", { style:
|
|
2549
|
-
/* @__PURE__ */ e(
|
|
2550
|
-
/* @__PURE__ */ n("div", { style:
|
|
2551
|
-
/* @__PURE__ */ e("div", { style:
|
|
2552
|
-
/* @__PURE__ */ e("div", { style:
|
|
3028
|
+
function vn({ conn: t, apiUrl: i, onDisconnect: r }) {
|
|
3029
|
+
const [o, h] = y(!1);
|
|
3030
|
+
return /* @__PURE__ */ n("div", { style: s.channelItem, children: [
|
|
3031
|
+
/* @__PURE__ */ e(xn, { conn: t, apiUrl: i, size: 40 }),
|
|
3032
|
+
/* @__PURE__ */ n("div", { style: s.channelInfo, children: [
|
|
3033
|
+
/* @__PURE__ */ e("div", { style: s.channelName, children: ct(t) }),
|
|
3034
|
+
/* @__PURE__ */ e("div", { style: s.channelMeta, children: fn(t) })
|
|
2553
3035
|
] }),
|
|
2554
|
-
/* @__PURE__ */ n("div", { style:
|
|
2555
|
-
/* @__PURE__ */ e("span", { style: t.status === "active" ?
|
|
3036
|
+
/* @__PURE__ */ n("div", { style: s.channelActions, children: [
|
|
3037
|
+
/* @__PURE__ */ e("span", { style: t.status === "active" ? s.badgeActive : s.badgeInactive, children: t.status === "active" ? "Hoạt động" : t.status }),
|
|
2556
3038
|
/* @__PURE__ */ e(
|
|
2557
3039
|
"button",
|
|
2558
3040
|
{
|
|
2559
3041
|
style: {
|
|
2560
|
-
...
|
|
3042
|
+
...s.disconnectBtn,
|
|
2561
3043
|
...o ? { background: "#fef2f2", borderColor: "#fca5a5", color: "#dc2626" } : {}
|
|
2562
3044
|
},
|
|
2563
|
-
onMouseEnter: () =>
|
|
2564
|
-
onMouseLeave: () =>
|
|
3045
|
+
onMouseEnter: () => h(!0),
|
|
3046
|
+
onMouseLeave: () => h(!1),
|
|
2565
3047
|
onClick: r,
|
|
2566
3048
|
children: "Ngắt kết nối"
|
|
2567
3049
|
}
|
|
@@ -2569,36 +3051,36 @@ function ln({ conn: t, apiUrl: i, onDisconnect: r }) {
|
|
|
2569
3051
|
] })
|
|
2570
3052
|
] });
|
|
2571
3053
|
}
|
|
2572
|
-
const
|
|
3054
|
+
const kn = [
|
|
2573
3055
|
{ id: "facebook", name: "Facebook", desc: "Fanpage & Messenger", type: "oauth" },
|
|
2574
3056
|
{ id: "zalo", name: "Zalo OA", desc: "Official Account", type: "oauth" },
|
|
2575
3057
|
{ id: "instagram", name: "Instagram", desc: "DM & Comments", type: "oauth" },
|
|
2576
3058
|
{ id: "telegram", name: "Telegram", desc: "Bot token", type: "token" },
|
|
2577
3059
|
{ id: "livechat", name: "Live Chat", desc: "Website widget", type: "livechat" }
|
|
2578
3060
|
];
|
|
2579
|
-
function
|
|
2580
|
-
const [o,
|
|
3061
|
+
function wn({ provider: t, apiUrl: i, onClick: r }) {
|
|
3062
|
+
const [o, h] = y(!1);
|
|
2581
3063
|
return /* @__PURE__ */ n(
|
|
2582
3064
|
"div",
|
|
2583
3065
|
{
|
|
2584
3066
|
style: {
|
|
2585
|
-
...
|
|
3067
|
+
...s.providerCard,
|
|
2586
3068
|
...o ? { background: "#fff", borderColor: "#e2e8f0", boxShadow: "0 2px 8px rgba(0,0,0,.07)", transform: "translateY(-1px)" } : {}
|
|
2587
3069
|
},
|
|
2588
3070
|
onClick: r,
|
|
2589
|
-
onMouseEnter: () =>
|
|
2590
|
-
onMouseLeave: () =>
|
|
3071
|
+
onMouseEnter: () => h(!0),
|
|
3072
|
+
onMouseLeave: () => h(!1),
|
|
2591
3073
|
children: [
|
|
2592
|
-
/* @__PURE__ */ e(
|
|
3074
|
+
/* @__PURE__ */ e(xe, { provider: t.id, apiUrl: i, size: 44 }),
|
|
2593
3075
|
/* @__PURE__ */ n("div", { children: [
|
|
2594
|
-
/* @__PURE__ */ e("div", { style:
|
|
2595
|
-
/* @__PURE__ */ e("div", { style:
|
|
3076
|
+
/* @__PURE__ */ e("div", { style: s.providerName, children: t.name }),
|
|
3077
|
+
/* @__PURE__ */ e("div", { style: s.providerDesc, children: t.desc })
|
|
2596
3078
|
] })
|
|
2597
3079
|
]
|
|
2598
3080
|
}
|
|
2599
3081
|
);
|
|
2600
3082
|
}
|
|
2601
|
-
function
|
|
3083
|
+
function Qe({ done: t, active: i, label: r }) {
|
|
2602
3084
|
return /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", gap: 10, fontSize: 13, color: t ? "#059669" : i ? "#0f172a" : "#94a3b8" }, children: [
|
|
2603
3085
|
/* @__PURE__ */ e("div", { style: {
|
|
2604
3086
|
width: 10,
|
|
@@ -2611,57 +3093,57 @@ function Ue({ done: t, active: i, label: r }) {
|
|
|
2611
3093
|
r
|
|
2612
3094
|
] });
|
|
2613
3095
|
}
|
|
2614
|
-
function
|
|
3096
|
+
function Sn(t) {
|
|
2615
3097
|
return t.split(/\s+/).filter(Boolean).slice(-2).map((i) => i[0]).join("").toUpperCase() || "?";
|
|
2616
3098
|
}
|
|
2617
|
-
function
|
|
3099
|
+
function Cn(t) {
|
|
2618
3100
|
if (!t) return "";
|
|
2619
3101
|
const i = new Date(t);
|
|
2620
3102
|
return i.toDateString() === (/* @__PURE__ */ new Date()).toDateString() ? i.toLocaleTimeString("vi-VN", { hour: "2-digit", minute: "2-digit" }) : i.toLocaleDateString("vi-VN", { day: "2-digit", month: "2-digit" });
|
|
2621
3103
|
}
|
|
2622
|
-
function
|
|
3104
|
+
function Bn({
|
|
2623
3105
|
apiUrl: t,
|
|
2624
3106
|
token: i,
|
|
2625
3107
|
theme: r,
|
|
2626
3108
|
locale: o = "vi",
|
|
2627
|
-
icon:
|
|
2628
|
-
onConversationSelect:
|
|
3109
|
+
icon: h,
|
|
3110
|
+
onConversationSelect: S
|
|
2629
3111
|
}) {
|
|
2630
|
-
const
|
|
3112
|
+
const m = (r == null ? void 0 : r.primaryColor) ?? "#2563eb", M = typeof h == "function" ? h({ size: 20, color: "currentColor" }) : h ?? /* @__PURE__ */ e(pt, { size: 20, strokeWidth: 1.8 }), w = J(new it(t, i)), [v, W] = y(!1), [T, j] = y([]), $ = J(null), C = J(null), D = T.filter((B) => (B.unreadCount ?? 0) > 0), I = D.reduce((B, x) => B + (x.unreadCount ?? 0), 0), L = we(async () => {
|
|
2631
3113
|
try {
|
|
2632
|
-
const
|
|
2633
|
-
|
|
3114
|
+
const B = await w.current.listConversations();
|
|
3115
|
+
j(B.items);
|
|
2634
3116
|
} catch {
|
|
2635
3117
|
}
|
|
2636
3118
|
}, []);
|
|
2637
|
-
|
|
2638
|
-
(
|
|
2639
|
-
})), [
|
|
2640
|
-
if (!
|
|
2641
|
-
const
|
|
2642
|
-
var
|
|
2643
|
-
(
|
|
3119
|
+
X(() => (L(), w.current.connectSSE((x) => {
|
|
3120
|
+
(x === "message.new" || x === "conversation.updated") && L();
|
|
3121
|
+
})), [L]), X(() => {
|
|
3122
|
+
if (!v) return;
|
|
3123
|
+
const B = (x) => {
|
|
3124
|
+
var b, E;
|
|
3125
|
+
(b = $.current) != null && b.contains(x.target) || (E = C.current) != null && E.contains(x.target) || W(!1);
|
|
2644
3126
|
};
|
|
2645
|
-
return document.addEventListener("mousedown",
|
|
2646
|
-
}, [
|
|
2647
|
-
const
|
|
2648
|
-
if (
|
|
3127
|
+
return document.addEventListener("mousedown", B), () => document.removeEventListener("mousedown", B);
|
|
3128
|
+
}, [v]);
|
|
3129
|
+
const P = async (B) => {
|
|
3130
|
+
if (W(!1), S == null || S(B.id, B), (B.unreadCount ?? 0) > 0)
|
|
2649
3131
|
try {
|
|
2650
|
-
await
|
|
2651
|
-
(
|
|
3132
|
+
await w.current.markRead(B.id), j(
|
|
3133
|
+
(x) => x.map((b) => b.id === B.id ? { ...b, unreadCount: 0 } : b)
|
|
2652
3134
|
);
|
|
2653
3135
|
} catch {
|
|
2654
3136
|
}
|
|
2655
|
-
},
|
|
3137
|
+
}, q = o === "en" ? `${I} unread message${I !== 1 ? "s" : ""}` : `${I} tin nhắn chưa đọc`, te = o === "en" ? "No unread messages" : "Không có tin nhắn mới", Q = o === "en" ? "Messages" : "Tin nhắn";
|
|
2656
3138
|
return /* @__PURE__ */ n("div", { style: { position: "relative", display: "inline-block", fontFamily: (r == null ? void 0 : r.fontFamily) ?? "Inter, ui-sans-serif, system-ui, sans-serif" }, children: [
|
|
2657
3139
|
/* @__PURE__ */ n(
|
|
2658
3140
|
"button",
|
|
2659
3141
|
{
|
|
2660
|
-
ref:
|
|
2661
|
-
"aria-label":
|
|
3142
|
+
ref: $,
|
|
3143
|
+
"aria-label": q,
|
|
2662
3144
|
"aria-haspopup": "true",
|
|
2663
|
-
"aria-expanded":
|
|
2664
|
-
onClick: () =>
|
|
3145
|
+
"aria-expanded": v,
|
|
3146
|
+
onClick: () => W((B) => !B),
|
|
2665
3147
|
style: {
|
|
2666
3148
|
position: "relative",
|
|
2667
3149
|
display: "inline-grid",
|
|
@@ -2670,14 +3152,14 @@ function mn({
|
|
|
2670
3152
|
height: 40,
|
|
2671
3153
|
border: 0,
|
|
2672
3154
|
borderRadius: "50%",
|
|
2673
|
-
background:
|
|
2674
|
-
color:
|
|
3155
|
+
background: v ? `${m}18` : "transparent",
|
|
3156
|
+
color: v ? m : "#6b7280",
|
|
2675
3157
|
cursor: "pointer",
|
|
2676
3158
|
transition: "background 150ms ease, color 150ms ease"
|
|
2677
3159
|
},
|
|
2678
3160
|
children: [
|
|
2679
|
-
|
|
2680
|
-
|
|
3161
|
+
M,
|
|
3162
|
+
I > 0 && /* @__PURE__ */ e(
|
|
2681
3163
|
"span",
|
|
2682
3164
|
{
|
|
2683
3165
|
"aria-hidden": "true",
|
|
@@ -2698,18 +3180,18 @@ function mn({
|
|
|
2698
3180
|
border: "2px solid #fff",
|
|
2699
3181
|
boxSizing: "border-box"
|
|
2700
3182
|
},
|
|
2701
|
-
children:
|
|
3183
|
+
children: I > 99 ? "99+" : I
|
|
2702
3184
|
}
|
|
2703
3185
|
)
|
|
2704
3186
|
]
|
|
2705
3187
|
}
|
|
2706
3188
|
),
|
|
2707
|
-
|
|
3189
|
+
v && /* @__PURE__ */ n(
|
|
2708
3190
|
"div",
|
|
2709
3191
|
{
|
|
2710
|
-
ref:
|
|
3192
|
+
ref: C,
|
|
2711
3193
|
role: "dialog",
|
|
2712
|
-
"aria-label":
|
|
3194
|
+
"aria-label": Q,
|
|
2713
3195
|
style: {
|
|
2714
3196
|
position: "absolute",
|
|
2715
3197
|
top: "calc(100% + 8px)",
|
|
@@ -2733,16 +3215,16 @@ function mn({
|
|
|
2733
3215
|
padding: "14px 16px 10px",
|
|
2734
3216
|
borderBottom: "1px solid #e7ebf2"
|
|
2735
3217
|
}, children: [
|
|
2736
|
-
/* @__PURE__ */ e("span", { style: { fontSize: 16, fontWeight: 700, color: "#172033" }, children:
|
|
2737
|
-
|
|
3218
|
+
/* @__PURE__ */ e("span", { style: { fontSize: 16, fontWeight: 700, color: "#172033" }, children: Q }),
|
|
3219
|
+
I > 0 && /* @__PURE__ */ n("span", { style: {
|
|
2738
3220
|
fontSize: 11,
|
|
2739
3221
|
fontWeight: 600,
|
|
2740
|
-
background: `${
|
|
2741
|
-
color:
|
|
3222
|
+
background: `${m}14`,
|
|
3223
|
+
color: m,
|
|
2742
3224
|
borderRadius: 999,
|
|
2743
3225
|
padding: "2px 8px"
|
|
2744
3226
|
}, children: [
|
|
2745
|
-
|
|
3227
|
+
I,
|
|
2746
3228
|
" ",
|
|
2747
3229
|
o === "en" ? "unread" : "chưa đọc"
|
|
2748
3230
|
] })
|
|
@@ -2755,36 +3237,36 @@ function mn({
|
|
|
2755
3237
|
padding: "40px 24px",
|
|
2756
3238
|
color: "#9aa5b5"
|
|
2757
3239
|
}, children: [
|
|
2758
|
-
/* @__PURE__ */ e(
|
|
2759
|
-
/* @__PURE__ */ e("span", { style: { fontSize: 13 }, children:
|
|
2760
|
-
] }) : D.map((
|
|
2761
|
-
|
|
3240
|
+
/* @__PURE__ */ e(pt, { size: 28, strokeWidth: 1.5 }),
|
|
3241
|
+
/* @__PURE__ */ e("span", { style: { fontSize: 13 }, children: te })
|
|
3242
|
+
] }) : D.map((B) => /* @__PURE__ */ e(
|
|
3243
|
+
In,
|
|
2762
3244
|
{
|
|
2763
|
-
conversation:
|
|
2764
|
-
primary:
|
|
3245
|
+
conversation: B,
|
|
3246
|
+
primary: m,
|
|
2765
3247
|
apiUrl: t,
|
|
2766
|
-
onSelect:
|
|
3248
|
+
onSelect: P
|
|
2767
3249
|
},
|
|
2768
|
-
|
|
3250
|
+
B.id
|
|
2769
3251
|
)) })
|
|
2770
3252
|
]
|
|
2771
3253
|
}
|
|
2772
3254
|
)
|
|
2773
3255
|
] });
|
|
2774
3256
|
}
|
|
2775
|
-
function
|
|
3257
|
+
function In({
|
|
2776
3258
|
conversation: t,
|
|
2777
3259
|
primary: i,
|
|
2778
3260
|
apiUrl: r,
|
|
2779
3261
|
onSelect: o
|
|
2780
3262
|
}) {
|
|
2781
|
-
const [
|
|
3263
|
+
const [h, S] = y(!1), m = t.contactName ?? t.providerConversationKey, M = t.unreadCount ?? 0;
|
|
2782
3264
|
return /* @__PURE__ */ n(
|
|
2783
3265
|
"button",
|
|
2784
3266
|
{
|
|
2785
3267
|
onClick: () => o(t),
|
|
2786
|
-
onMouseEnter: () =>
|
|
2787
|
-
onMouseLeave: () =>
|
|
3268
|
+
onMouseEnter: () => S(!0),
|
|
3269
|
+
onMouseLeave: () => S(!1),
|
|
2788
3270
|
style: {
|
|
2789
3271
|
display: "flex",
|
|
2790
3272
|
width: "100%",
|
|
@@ -2792,7 +3274,7 @@ function pn({
|
|
|
2792
3274
|
padding: "10px 16px",
|
|
2793
3275
|
border: 0,
|
|
2794
3276
|
borderBottom: "1px solid #f1f5f9",
|
|
2795
|
-
background:
|
|
3277
|
+
background: h ? "#f7f9fc" : M > 0 ? "#f0f4ff" : "#fff",
|
|
2796
3278
|
textAlign: "left",
|
|
2797
3279
|
cursor: "pointer",
|
|
2798
3280
|
transition: "background 100ms ease",
|
|
@@ -2801,10 +3283,10 @@ function pn({
|
|
|
2801
3283
|
children: [
|
|
2802
3284
|
/* @__PURE__ */ n("span", { style: { position: "relative", flex: "0 0 auto", width: 42, height: 42 }, children: [
|
|
2803
3285
|
/* @__PURE__ */ e(
|
|
2804
|
-
|
|
3286
|
+
dt,
|
|
2805
3287
|
{
|
|
2806
3288
|
src: t.contactPictureUrl,
|
|
2807
|
-
fallback:
|
|
3289
|
+
fallback: Sn(m),
|
|
2808
3290
|
style: {
|
|
2809
3291
|
width: 42,
|
|
2810
3292
|
height: 42,
|
|
@@ -2825,15 +3307,15 @@ function pn({
|
|
|
2825
3307
|
/* @__PURE__ */ n("span", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", gap: 6 }, children: [
|
|
2826
3308
|
/* @__PURE__ */ e("span", { style: {
|
|
2827
3309
|
fontSize: 13,
|
|
2828
|
-
fontWeight:
|
|
3310
|
+
fontWeight: M > 0 ? 700 : 500,
|
|
2829
3311
|
color: "#172033",
|
|
2830
3312
|
overflow: "hidden",
|
|
2831
3313
|
textOverflow: "ellipsis",
|
|
2832
3314
|
whiteSpace: "nowrap"
|
|
2833
|
-
}, children:
|
|
3315
|
+
}, children: m }),
|
|
2834
3316
|
/* @__PURE__ */ n("span", { style: { display: "flex", alignItems: "center", gap: 5, flexShrink: 0 }, children: [
|
|
2835
|
-
/* @__PURE__ */ e("time", { style: { fontSize: 11, color: "#9aa5b5", whiteSpace: "nowrap" }, children:
|
|
2836
|
-
|
|
3317
|
+
/* @__PURE__ */ e("time", { style: { fontSize: 11, color: "#9aa5b5", whiteSpace: "nowrap" }, children: Cn(t.lastMessageAt) }),
|
|
3318
|
+
M > 0 && /* @__PURE__ */ e("span", { style: {
|
|
2837
3319
|
display: "inline-grid",
|
|
2838
3320
|
placeItems: "center",
|
|
2839
3321
|
minWidth: 18,
|
|
@@ -2844,15 +3326,15 @@ function pn({
|
|
|
2844
3326
|
fontSize: 10,
|
|
2845
3327
|
fontWeight: 800,
|
|
2846
3328
|
padding: "0 4px"
|
|
2847
|
-
}, children:
|
|
3329
|
+
}, children: M > 99 ? "99+" : M })
|
|
2848
3330
|
] })
|
|
2849
3331
|
] }),
|
|
2850
3332
|
/* @__PURE__ */ n("span", { style: {
|
|
2851
3333
|
display: "block",
|
|
2852
3334
|
marginTop: 2,
|
|
2853
3335
|
fontSize: 12,
|
|
2854
|
-
color:
|
|
2855
|
-
fontWeight:
|
|
3336
|
+
color: M > 0 ? "#374151" : "#9aa5b5",
|
|
3337
|
+
fontWeight: M > 0 ? 500 : 400,
|
|
2856
3338
|
overflow: "hidden",
|
|
2857
3339
|
textOverflow: "ellipsis",
|
|
2858
3340
|
whiteSpace: "nowrap"
|
|
@@ -2865,10 +3347,10 @@ function pn({
|
|
|
2865
3347
|
}
|
|
2866
3348
|
);
|
|
2867
3349
|
}
|
|
2868
|
-
console.log("[ChannelHub] widget v0.1.
|
|
3350
|
+
console.log("[ChannelHub] widget v0.1.9 loaded");
|
|
2869
3351
|
export {
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
3352
|
+
$n as ChannelHubChannels,
|
|
3353
|
+
it as ChannelHubClient,
|
|
3354
|
+
Wn as ChannelHubInbox,
|
|
3355
|
+
Bn as ChannelHubNotificationBell
|
|
2874
3356
|
};
|