@linktr.ee/messaging-react 1.8.8 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +194 -191
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Avatar/index.tsx +11 -3
- package/src/components/ChannelView.tsx +1 -1
- package/src/components/FaqList/index.tsx +2 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as d, Fragment as se } from "react/jsx-runtime";
|
|
2
2
|
import R from "classnames";
|
|
3
3
|
import Y, { createContext as Re, useContext as Fe, useCallback as P, useState as y, useRef as $, useEffect as H } from "react";
|
|
4
4
|
import { StreamChatService as Te } from "@linktr.ee/messaging-core";
|
|
@@ -20,29 +20,29 @@ const ge = Re({
|
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
22
|
apiKey: r,
|
|
23
|
-
capabilities:
|
|
24
|
-
customization:
|
|
25
|
-
debug:
|
|
23
|
+
capabilities: a = {},
|
|
24
|
+
customization: c = {},
|
|
25
|
+
debug: i = !1
|
|
26
26
|
}) => {
|
|
27
27
|
const l = P(
|
|
28
28
|
(x, ...D) => {
|
|
29
|
-
|
|
29
|
+
i && console.log(`🔥 [MessagingProvider] ${x}`, ...D);
|
|
30
30
|
},
|
|
31
|
-
[
|
|
31
|
+
[i]
|
|
32
32
|
);
|
|
33
33
|
l("🔄 RENDER START", {
|
|
34
34
|
userId: s == null ? void 0 : s.id,
|
|
35
35
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
36
36
|
serviceConfig: !!n,
|
|
37
|
-
capabilities: Object.keys(
|
|
38
|
-
customization: Object.keys(
|
|
37
|
+
capabilities: Object.keys(a),
|
|
38
|
+
customization: Object.keys(c)
|
|
39
39
|
});
|
|
40
40
|
const [o, w] = y(null), [I, N] = y(null), [m, S] = y(!1), [g, b] = y(!1), [E, v] = y(null), F = $(!1), C = $({
|
|
41
41
|
userId: s == null ? void 0 : s.id,
|
|
42
42
|
apiKey: r,
|
|
43
43
|
serviceConfig: n,
|
|
44
|
-
capabilities:
|
|
45
|
-
customization:
|
|
44
|
+
capabilities: a,
|
|
45
|
+
customization: c
|
|
46
46
|
}), T = $(0);
|
|
47
47
|
T.current++, l("📊 RENDER INFO", {
|
|
48
48
|
renderCount: T.current,
|
|
@@ -51,15 +51,15 @@ const ge = Re({
|
|
|
51
51
|
userChanged: C.current.userId !== (s == null ? void 0 : s.id),
|
|
52
52
|
apiKeyChanged: C.current.apiKey !== r,
|
|
53
53
|
serviceConfigChanged: C.current.serviceConfig !== n,
|
|
54
|
-
capabilitiesChanged: C.current.capabilities !==
|
|
55
|
-
customizationChanged: C.current.customization !==
|
|
54
|
+
capabilitiesChanged: C.current.capabilities !== a,
|
|
55
|
+
customizationChanged: C.current.customization !== c
|
|
56
56
|
}
|
|
57
57
|
}), C.current = {
|
|
58
58
|
userId: s == null ? void 0 : s.id,
|
|
59
59
|
apiKey: r,
|
|
60
60
|
serviceConfig: n,
|
|
61
|
-
capabilities:
|
|
62
|
-
customization:
|
|
61
|
+
capabilities: a,
|
|
62
|
+
customization: c
|
|
63
63
|
}, H(() => {
|
|
64
64
|
const x = T.current;
|
|
65
65
|
if (l("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
@@ -87,7 +87,7 @@ const ge = Re({
|
|
|
87
87
|
const D = new Te({
|
|
88
88
|
...n,
|
|
89
89
|
apiKey: r,
|
|
90
|
-
debug:
|
|
90
|
+
debug: i
|
|
91
91
|
});
|
|
92
92
|
return w(D), l("✅ SERVICE SET", {
|
|
93
93
|
renderCount: x,
|
|
@@ -98,7 +98,7 @@ const ge = Re({
|
|
|
98
98
|
reason: "Effect cleanup"
|
|
99
99
|
}), D.disconnectUser().catch(console.error);
|
|
100
100
|
};
|
|
101
|
-
}, [r, n,
|
|
101
|
+
}, [r, n, i, l]);
|
|
102
102
|
const p = $(null);
|
|
103
103
|
H(() => {
|
|
104
104
|
var D, q;
|
|
@@ -186,28 +186,28 @@ const ge = Re({
|
|
|
186
186
|
isConnected: m,
|
|
187
187
|
isLoading: g,
|
|
188
188
|
hasError: !!E,
|
|
189
|
-
capabilitiesKeys: Object.keys(
|
|
190
|
-
customizationKeys: Object.keys(
|
|
189
|
+
capabilitiesKeys: Object.keys(a),
|
|
190
|
+
customizationKeys: Object.keys(c)
|
|
191
191
|
}), {
|
|
192
192
|
service: o,
|
|
193
193
|
client: I,
|
|
194
194
|
isConnected: m,
|
|
195
195
|
isLoading: g,
|
|
196
196
|
error: E,
|
|
197
|
-
capabilities:
|
|
198
|
-
customization:
|
|
197
|
+
capabilities: a,
|
|
198
|
+
customization: c,
|
|
199
199
|
refreshConnection: u,
|
|
200
|
-
debug:
|
|
200
|
+
debug: i
|
|
201
201
|
}), [
|
|
202
202
|
o,
|
|
203
203
|
I,
|
|
204
204
|
m,
|
|
205
205
|
g,
|
|
206
206
|
E,
|
|
207
|
-
i,
|
|
208
|
-
d,
|
|
209
|
-
u,
|
|
210
207
|
a,
|
|
208
|
+
c,
|
|
209
|
+
u,
|
|
210
|
+
i,
|
|
211
211
|
l
|
|
212
212
|
]);
|
|
213
213
|
return l("🔄 RENDER END", {
|
|
@@ -218,10 +218,10 @@ const ge = Re({
|
|
|
218
218
|
}, qe = () => ne(), Ye = (t, s) => {
|
|
219
219
|
const n = new Date(
|
|
220
220
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
221
|
-
),
|
|
221
|
+
), a = new Date(
|
|
222
222
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
223
223
|
).getTime() - n.getTime();
|
|
224
|
-
return Math.floor(
|
|
224
|
+
return Math.floor(a / (1e3 * 60 * 60 * 24));
|
|
225
225
|
}, Je = (t) => {
|
|
226
226
|
const s = /* @__PURE__ */ new Date();
|
|
227
227
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
@@ -279,9 +279,13 @@ const J = ({
|
|
|
279
279
|
id: t,
|
|
280
280
|
image: s,
|
|
281
281
|
size: n = 40,
|
|
282
|
-
className: r
|
|
282
|
+
className: r,
|
|
283
|
+
shape: a = "squircle"
|
|
283
284
|
}) => {
|
|
284
|
-
const
|
|
285
|
+
const c = Xe(t), l = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", o = a === "circle" ? { borderRadius: "50%" } : {
|
|
286
|
+
borderRadius: "33%",
|
|
287
|
+
"corner-shape": "superellipse(1.3)"
|
|
288
|
+
};
|
|
285
289
|
return /* @__PURE__ */ e(
|
|
286
290
|
"div",
|
|
287
291
|
{
|
|
@@ -289,9 +293,7 @@ const J = ({
|
|
|
289
293
|
style: {
|
|
290
294
|
width: `${n}px`,
|
|
291
295
|
height: `${n}px`,
|
|
292
|
-
|
|
293
|
-
// @ts-expect-error - corner-shape is not recognized by react types
|
|
294
|
-
"corner-shape": "superellipse(1.3)"
|
|
296
|
+
...o
|
|
295
297
|
},
|
|
296
298
|
children: s ? /* @__PURE__ */ e(
|
|
297
299
|
"img",
|
|
@@ -306,16 +308,16 @@ const J = ({
|
|
|
306
308
|
"aria-hidden": "true",
|
|
307
309
|
className: R(
|
|
308
310
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
309
|
-
|
|
311
|
+
l
|
|
310
312
|
),
|
|
311
|
-
children:
|
|
313
|
+
children: c
|
|
312
314
|
}
|
|
313
315
|
)
|
|
314
316
|
}
|
|
315
317
|
);
|
|
316
|
-
}, Ze = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread:
|
|
318
|
+
}, Ze = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
|
|
317
319
|
var E, v, F, C, T, p;
|
|
318
|
-
const
|
|
320
|
+
const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), i = () => {
|
|
319
321
|
t && n(t);
|
|
320
322
|
}, o = Object.values(((E = t == null ? void 0 : t.state) == null ? void 0 : E.members) || {}).find(
|
|
321
323
|
(u) => {
|
|
@@ -327,10 +329,10 @@ const J = ({
|
|
|
327
329
|
if (N != null && N.text) return N.text;
|
|
328
330
|
const u = (f = N == null ? void 0 : N.attachments) == null ? void 0 : f[0];
|
|
329
331
|
return u != null && u.asset_url ? u.asset_url : u != null && u.image_url ? u.image_url : u != null && u.og_scrape_url ? u.og_scrape_url : u != null && u.thumb_url ? u.thumb_url : "No messages yet";
|
|
330
|
-
})(), g = N != null && N.created_at ? Je(new Date(N.created_at)) : "", b =
|
|
332
|
+
})(), g = N != null && N.created_at ? Je(new Date(N.created_at)) : "", b = a ?? 0;
|
|
331
333
|
return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
332
334
|
channelId: t == null ? void 0 : t.id,
|
|
333
|
-
isSelected:
|
|
335
|
+
isSelected: c,
|
|
334
336
|
participantName: w,
|
|
335
337
|
unreadCount: b,
|
|
336
338
|
hasTimestamp: !!g
|
|
@@ -338,15 +340,15 @@ const J = ({
|
|
|
338
340
|
"button",
|
|
339
341
|
{
|
|
340
342
|
type: "button",
|
|
341
|
-
onClick:
|
|
343
|
+
onClick: i,
|
|
342
344
|
className: R(
|
|
343
345
|
"group w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
|
|
344
346
|
{
|
|
345
|
-
"bg-primary-alt/10 border-l-4 border-l-primary":
|
|
346
|
-
"hover:bg-sand": !
|
|
347
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": c,
|
|
348
|
+
"hover:bg-sand": !c
|
|
347
349
|
}
|
|
348
350
|
),
|
|
349
|
-
children: /* @__PURE__ */
|
|
351
|
+
children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
|
|
350
352
|
/* @__PURE__ */ e(
|
|
351
353
|
J,
|
|
352
354
|
{
|
|
@@ -357,21 +359,21 @@ const J = ({
|
|
|
357
359
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
358
360
|
}
|
|
359
361
|
),
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
363
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
|
|
362
364
|
/* @__PURE__ */ e(
|
|
363
365
|
"h3",
|
|
364
366
|
{
|
|
365
367
|
className: R(
|
|
366
368
|
"text-sm font-medium truncate",
|
|
367
|
-
|
|
369
|
+
c ? "text-primary" : "text-charcoal"
|
|
368
370
|
),
|
|
369
371
|
children: w
|
|
370
372
|
}
|
|
371
373
|
),
|
|
372
374
|
g && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: g })
|
|
373
375
|
] }),
|
|
374
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
375
377
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: S }),
|
|
376
378
|
b > 0 && /* @__PURE__ */ e("span", { className: "bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: b > 99 ? "99+" : b })
|
|
377
379
|
] })
|
|
@@ -384,13 +386,13 @@ const J = ({
|
|
|
384
386
|
selectedChannel: s,
|
|
385
387
|
filters: n,
|
|
386
388
|
className: r,
|
|
387
|
-
customEmptyStateIndicator:
|
|
389
|
+
customEmptyStateIndicator: a
|
|
388
390
|
}) => {
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
const { debug:
|
|
392
|
-
return
|
|
393
|
-
renderCount:
|
|
391
|
+
const c = Y.useRef(0);
|
|
392
|
+
c.current++;
|
|
393
|
+
const { debug: i = !1 } = ne();
|
|
394
|
+
return i && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
395
|
+
renderCount: c.current,
|
|
394
396
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
395
397
|
filters: n
|
|
396
398
|
}), /* @__PURE__ */ e(
|
|
@@ -400,8 +402,8 @@ const J = ({
|
|
|
400
402
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
401
403
|
r
|
|
402
404
|
),
|
|
403
|
-
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (
|
|
404
|
-
renderCount:
|
|
405
|
+
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (i && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
|
|
406
|
+
renderCount: c.current,
|
|
405
407
|
filters: n
|
|
406
408
|
}), /* @__PURE__ */ e(
|
|
407
409
|
pe,
|
|
@@ -411,7 +413,7 @@ const J = ({
|
|
|
411
413
|
options: { limit: 30 },
|
|
412
414
|
Preview: (l) => {
|
|
413
415
|
var o, w;
|
|
414
|
-
return
|
|
416
|
+
return i && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
415
417
|
channelId: (o = l.channel) == null ? void 0 : o.id,
|
|
416
418
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
417
419
|
isSelected: (s == null ? void 0 : s.id) === ((w = l.channel) == null ? void 0 : w.id)
|
|
@@ -421,11 +423,11 @@ const J = ({
|
|
|
421
423
|
...l,
|
|
422
424
|
selectedChannel: s,
|
|
423
425
|
onChannelSelect: t,
|
|
424
|
-
debug:
|
|
426
|
+
debug: i
|
|
425
427
|
}
|
|
426
428
|
);
|
|
427
429
|
},
|
|
428
|
-
EmptyStateIndicator:
|
|
430
|
+
EmptyStateIndicator: a
|
|
429
431
|
},
|
|
430
432
|
JSON.stringify(n)
|
|
431
433
|
)) })
|
|
@@ -450,7 +452,7 @@ const J = ({
|
|
|
450
452
|
}
|
|
451
453
|
);
|
|
452
454
|
function xe({ label: t, className: s, children: n, ...r }) {
|
|
453
|
-
return /* @__PURE__ */
|
|
455
|
+
return /* @__PURE__ */ d(
|
|
454
456
|
"button",
|
|
455
457
|
{
|
|
456
458
|
type: "button",
|
|
@@ -475,13 +477,13 @@ function Ne({ onClick: t }) {
|
|
|
475
477
|
}
|
|
476
478
|
const es = () => {
|
|
477
479
|
const { handleSubmit: t } = Pe(), s = Ue();
|
|
478
|
-
return /* @__PURE__ */
|
|
480
|
+
return /* @__PURE__ */ d(se, { children: [
|
|
479
481
|
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Oe, {}) }),
|
|
480
|
-
/* @__PURE__ */
|
|
482
|
+
/* @__PURE__ */ d("div", { className: "central-container w-full p-2 bg-white rounded-lg shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
|
|
481
483
|
/* @__PURE__ */ e(Le, {}),
|
|
482
484
|
/* @__PURE__ */ e(_e, {}),
|
|
483
485
|
/* @__PURE__ */ e(je, {}),
|
|
484
|
-
/* @__PURE__ */
|
|
486
|
+
/* @__PURE__ */ d("div", { className: "flex", children: [
|
|
485
487
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4", children: /* @__PURE__ */ e(
|
|
486
488
|
Ae,
|
|
487
489
|
{
|
|
@@ -506,22 +508,22 @@ const es = () => {
|
|
|
506
508
|
] });
|
|
507
509
|
}, ss = ({
|
|
508
510
|
renderActions: t
|
|
509
|
-
}) => /* @__PURE__ */
|
|
511
|
+
}) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
510
512
|
t && (t == null ? void 0 : t()),
|
|
511
513
|
/* @__PURE__ */ e(Me, { Input: es })
|
|
512
|
-
] }), be = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */
|
|
514
|
+
] }), be = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
513
515
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet 👀" }),
|
|
514
516
|
/* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
|
|
515
517
|
] }) }), ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
516
518
|
var o, w, I, N, m;
|
|
517
|
-
const { channel:
|
|
519
|
+
const { channel: a } = fe(), c = Y.useMemo(() => Object.values(a.state.members || {}).find(
|
|
518
520
|
(g) => {
|
|
519
521
|
var b;
|
|
520
|
-
return ((b = g.user) == null ? void 0 : b.id) && g.user.id !==
|
|
522
|
+
return ((b = g.user) == null ? void 0 : b.id) && g.user.id !== a._client.userID;
|
|
521
523
|
}
|
|
522
|
-
), [
|
|
523
|
-
return /* @__PURE__ */
|
|
524
|
-
/* @__PURE__ */
|
|
524
|
+
), [a._client.userID, a.state.members]), i = ((o = c == null ? void 0 : c.user) == null ? void 0 : o.name) || ((w = c == null ? void 0 : c.user) == null ? void 0 : w.id) || "Unknown member", l = (I = c == null ? void 0 : c.user) == null ? void 0 : I.image;
|
|
525
|
+
return /* @__PURE__ */ d("div", { className: "@container", children: [
|
|
526
|
+
/* @__PURE__ */ d("div", { className: "flex justify-between items-center @md:hidden", children: [
|
|
525
527
|
/* @__PURE__ */ e(
|
|
526
528
|
"button",
|
|
527
529
|
{
|
|
@@ -534,17 +536,17 @@ const es = () => {
|
|
|
534
536
|
children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
|
|
535
537
|
}
|
|
536
538
|
),
|
|
537
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
538
540
|
/* @__PURE__ */ e(
|
|
539
541
|
J,
|
|
540
542
|
{
|
|
541
|
-
id: ((N =
|
|
542
|
-
name:
|
|
543
|
+
id: ((N = c == null ? void 0 : c.user) == null ? void 0 : N.id) || a.id || "unknown",
|
|
544
|
+
name: i,
|
|
543
545
|
image: l,
|
|
544
546
|
size: 40
|
|
545
547
|
}
|
|
546
548
|
),
|
|
547
|
-
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children:
|
|
549
|
+
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: i })
|
|
548
550
|
] }),
|
|
549
551
|
/* @__PURE__ */ e(
|
|
550
552
|
"button",
|
|
@@ -558,8 +560,8 @@ const es = () => {
|
|
|
558
560
|
}
|
|
559
561
|
)
|
|
560
562
|
] }),
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ d("div", { className: "hidden @md:flex items-center justify-between gap-3 min-h-12", children: [
|
|
564
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
563
565
|
s && t && /* @__PURE__ */ e(
|
|
564
566
|
"button",
|
|
565
567
|
{
|
|
@@ -573,13 +575,13 @@ const es = () => {
|
|
|
573
575
|
/* @__PURE__ */ e(
|
|
574
576
|
J,
|
|
575
577
|
{
|
|
576
|
-
id: ((m =
|
|
577
|
-
name:
|
|
578
|
+
id: ((m = c == null ? void 0 : c.user) == null ? void 0 : m.id) || a.id || "unknown",
|
|
579
|
+
name: i,
|
|
578
580
|
image: l,
|
|
579
581
|
size: 40
|
|
580
582
|
}
|
|
581
583
|
),
|
|
582
|
-
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children:
|
|
584
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: i }) })
|
|
583
585
|
] }),
|
|
584
586
|
r && n && /* @__PURE__ */ e(
|
|
585
587
|
"button",
|
|
@@ -598,9 +600,9 @@ const es = () => {
|
|
|
598
600
|
onClose: s,
|
|
599
601
|
participant: n,
|
|
600
602
|
channel: r,
|
|
601
|
-
followerStatusLabel:
|
|
602
|
-
onLeaveConversation:
|
|
603
|
-
onBlockParticipant:
|
|
603
|
+
followerStatusLabel: a,
|
|
604
|
+
onLeaveConversation: c,
|
|
605
|
+
onBlockParticipant: i
|
|
604
606
|
}) => {
|
|
605
607
|
var _, O, W, Q, G, V, X;
|
|
606
608
|
const { service: l, debug: o } = ne(), w = $(null), [I, N] = y(!1), [m, S] = y(!1), [g, b] = y(!1);
|
|
@@ -635,7 +637,7 @@ const es = () => {
|
|
|
635
637
|
o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), S(!0);
|
|
636
638
|
try {
|
|
637
639
|
const M = ((k = r._client) == null ? void 0 : k.userID) ?? null;
|
|
638
|
-
await r.hide(M, !1),
|
|
640
|
+
await r.hide(M, !1), c && await c(r), s();
|
|
639
641
|
} catch (M) {
|
|
640
642
|
console.error("[ChannelInfoDialog] Failed to leave conversation", M);
|
|
641
643
|
} finally {
|
|
@@ -647,7 +649,7 @@ const es = () => {
|
|
|
647
649
|
if (!(g || !l)) {
|
|
648
650
|
o && console.log("[ChannelInfoDialog] Block member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), b(!0);
|
|
649
651
|
try {
|
|
650
|
-
await l.blockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id),
|
|
652
|
+
await l.blockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
651
653
|
} catch (j) {
|
|
652
654
|
console.error("[ChannelInfoDialog] Failed to block member", j);
|
|
653
655
|
} finally {
|
|
@@ -659,7 +661,7 @@ const es = () => {
|
|
|
659
661
|
if (!(g || !l)) {
|
|
660
662
|
o && console.log("[ChannelInfoDialog] Unblock member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), b(!0);
|
|
661
663
|
try {
|
|
662
|
-
await l.unBlockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id),
|
|
664
|
+
await l.unBlockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
663
665
|
} catch (j) {
|
|
664
666
|
console.error("[ChannelInfoDialog] Failed to unblock member", j);
|
|
665
667
|
} finally {
|
|
@@ -686,18 +688,18 @@ const es = () => {
|
|
|
686
688
|
onClick: (k) => {
|
|
687
689
|
k.target === w.current && s();
|
|
688
690
|
},
|
|
689
|
-
children: /* @__PURE__ */
|
|
690
|
-
/* @__PURE__ */
|
|
691
|
+
children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
|
|
692
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
691
693
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
692
694
|
/* @__PURE__ */ e(Ne, { onClick: s })
|
|
693
695
|
] }),
|
|
694
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ d("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
695
697
|
/* @__PURE__ */ e(
|
|
696
698
|
"div",
|
|
697
699
|
{
|
|
698
700
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
699
701
|
style: { backgroundColor: "#FBFAF9" },
|
|
700
|
-
children: /* @__PURE__ */
|
|
702
|
+
children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3 w-full", children: [
|
|
701
703
|
/* @__PURE__ */ e(
|
|
702
704
|
J,
|
|
703
705
|
{
|
|
@@ -705,32 +707,32 @@ const es = () => {
|
|
|
705
707
|
name: p,
|
|
706
708
|
image: u,
|
|
707
709
|
size: 88,
|
|
708
|
-
|
|
710
|
+
shape: "circle"
|
|
709
711
|
}
|
|
710
712
|
),
|
|
711
|
-
/* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
712
714
|
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: p }),
|
|
713
715
|
D && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: D }),
|
|
714
|
-
|
|
716
|
+
a && /* @__PURE__ */ e(
|
|
715
717
|
"span",
|
|
716
718
|
{
|
|
717
719
|
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
718
720
|
style: {
|
|
719
721
|
padding: "4px 8px",
|
|
720
|
-
backgroundColor:
|
|
721
|
-
color:
|
|
722
|
+
backgroundColor: a === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
|
|
723
|
+
color: a === "Subscribed to you" ? "#008236" : "#78716C",
|
|
722
724
|
lineHeight: "133.333%",
|
|
723
725
|
letterSpacing: "0.21px"
|
|
724
726
|
},
|
|
725
|
-
children:
|
|
727
|
+
children: a
|
|
726
728
|
}
|
|
727
729
|
)
|
|
728
730
|
] })
|
|
729
731
|
] })
|
|
730
732
|
}
|
|
731
733
|
),
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
734
|
+
/* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
735
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
|
|
734
736
|
K,
|
|
735
737
|
{
|
|
736
738
|
onClick: v,
|
|
@@ -742,7 +744,7 @@ const es = () => {
|
|
|
742
744
|
]
|
|
743
745
|
}
|
|
744
746
|
) }),
|
|
745
|
-
/* @__PURE__ */ e("li", { children: I ? /* @__PURE__ */
|
|
747
|
+
/* @__PURE__ */ e("li", { children: I ? /* @__PURE__ */ d(
|
|
746
748
|
K,
|
|
747
749
|
{
|
|
748
750
|
onClick: C,
|
|
@@ -753,7 +755,7 @@ const es = () => {
|
|
|
753
755
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
754
756
|
]
|
|
755
757
|
}
|
|
756
|
-
) : /* @__PURE__ */
|
|
758
|
+
) : /* @__PURE__ */ d(
|
|
757
759
|
K,
|
|
758
760
|
{
|
|
759
761
|
onClick: F,
|
|
@@ -765,7 +767,7 @@ const es = () => {
|
|
|
765
767
|
]
|
|
766
768
|
}
|
|
767
769
|
) }),
|
|
768
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
770
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick: T, children: [
|
|
769
771
|
/* @__PURE__ */ e(Ve, { className: "h-5 w-5" }),
|
|
770
772
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
771
773
|
] }) })
|
|
@@ -780,24 +782,24 @@ const es = () => {
|
|
|
780
782
|
showBackButton: s,
|
|
781
783
|
renderMessageInputActions: n,
|
|
782
784
|
onLeaveConversation: r,
|
|
783
|
-
onBlockParticipant:
|
|
784
|
-
CustomChannelEmptyState:
|
|
785
|
+
onBlockParticipant: a,
|
|
786
|
+
CustomChannelEmptyState: c = be
|
|
785
787
|
}) => {
|
|
786
788
|
var m, S;
|
|
787
|
-
const { channel:
|
|
789
|
+
const { channel: i } = fe(), [l, o] = y(!1), w = (((S = (m = i == null ? void 0 : i.state) == null ? void 0 : m.messages) == null ? void 0 : S.length) ?? 0) > 0, I = Y.useMemo(() => Object.values(i.state.members || {}).find(
|
|
788
790
|
(b) => {
|
|
789
791
|
var E;
|
|
790
|
-
return ((E = b.user) == null ? void 0 : E.id) && b.user.id !==
|
|
792
|
+
return ((E = b.user) == null ? void 0 : E.id) && b.user.id !== i._client.userID;
|
|
791
793
|
}
|
|
792
|
-
), [
|
|
793
|
-
const g =
|
|
794
|
+
), [i._client.userID, i.state.members]), N = Y.useMemo(() => {
|
|
795
|
+
const g = i.data ?? {};
|
|
794
796
|
if (g.followerStatus)
|
|
795
797
|
return String(g.followerStatus);
|
|
796
798
|
if (g.isFollower !== void 0)
|
|
797
799
|
return g.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
798
|
-
}, [
|
|
799
|
-
return /* @__PURE__ */
|
|
800
|
-
/* @__PURE__ */
|
|
800
|
+
}, [i.data]);
|
|
801
|
+
return /* @__PURE__ */ d(se, { children: [
|
|
802
|
+
/* @__PURE__ */ d(ze, { children: [
|
|
801
803
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
802
804
|
ns,
|
|
803
805
|
{
|
|
@@ -807,7 +809,7 @@ const es = () => {
|
|
|
807
809
|
canShowInfo: !!I
|
|
808
810
|
}
|
|
809
811
|
) }),
|
|
810
|
-
/* @__PURE__ */
|
|
812
|
+
/* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
|
|
811
813
|
/* @__PURE__ */ e(
|
|
812
814
|
$e,
|
|
813
815
|
{
|
|
@@ -816,12 +818,12 @@ const es = () => {
|
|
|
816
818
|
messageActions: []
|
|
817
819
|
}
|
|
818
820
|
),
|
|
819
|
-
!w &&
|
|
821
|
+
!w && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(c, {}) })
|
|
820
822
|
] }),
|
|
821
823
|
/* @__PURE__ */ e(
|
|
822
824
|
ss,
|
|
823
825
|
{
|
|
824
|
-
renderActions: () => n == null ? void 0 : n(
|
|
826
|
+
renderActions: () => n == null ? void 0 : n(i)
|
|
825
827
|
}
|
|
826
828
|
)
|
|
827
829
|
] }),
|
|
@@ -831,10 +833,10 @@ const es = () => {
|
|
|
831
833
|
isOpen: l,
|
|
832
834
|
onClose: () => o(!1),
|
|
833
835
|
participant: I,
|
|
834
|
-
channel:
|
|
836
|
+
channel: i,
|
|
835
837
|
followerStatusLabel: N,
|
|
836
838
|
onLeaveConversation: r,
|
|
837
|
-
onBlockParticipant:
|
|
839
|
+
onBlockParticipant: a
|
|
838
840
|
}
|
|
839
841
|
)
|
|
840
842
|
] });
|
|
@@ -843,16 +845,16 @@ const es = () => {
|
|
|
843
845
|
onBack: s,
|
|
844
846
|
showBackButton: n = !1,
|
|
845
847
|
renderMessageInputActions: r,
|
|
846
|
-
onLeaveConversation:
|
|
847
|
-
onBlockParticipant:
|
|
848
|
-
className:
|
|
848
|
+
onLeaveConversation: a,
|
|
849
|
+
onBlockParticipant: c,
|
|
850
|
+
className: i,
|
|
849
851
|
CustomChannelEmptyState: l = be
|
|
850
852
|
}) => /* @__PURE__ */ e(
|
|
851
853
|
"div",
|
|
852
854
|
{
|
|
853
855
|
className: R(
|
|
854
856
|
"messaging-channel-view h-full flex flex-col bg-[#FBFAF9]",
|
|
855
|
-
|
|
857
|
+
i
|
|
856
858
|
),
|
|
857
859
|
children: /* @__PURE__ */ e(Be, { channel: t, children: /* @__PURE__ */ e(
|
|
858
860
|
rs,
|
|
@@ -860,8 +862,8 @@ const es = () => {
|
|
|
860
862
|
onBack: s,
|
|
861
863
|
showBackButton: n,
|
|
862
864
|
renderMessageInputActions: r,
|
|
863
|
-
onLeaveConversation:
|
|
864
|
-
onBlockParticipant:
|
|
865
|
+
onLeaveConversation: a,
|
|
866
|
+
onBlockParticipant: c,
|
|
865
867
|
CustomChannelEmptyState: l
|
|
866
868
|
}
|
|
867
869
|
) })
|
|
@@ -873,7 +875,7 @@ function os({
|
|
|
873
875
|
placeholder: n
|
|
874
876
|
}) {
|
|
875
877
|
const r = $(null);
|
|
876
|
-
return /* @__PURE__ */
|
|
878
|
+
return /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
877
879
|
/* @__PURE__ */ e(
|
|
878
880
|
We,
|
|
879
881
|
{
|
|
@@ -888,7 +890,7 @@ function os({
|
|
|
888
890
|
type: "text",
|
|
889
891
|
placeholder: n,
|
|
890
892
|
value: t,
|
|
891
|
-
onChange: (
|
|
893
|
+
onChange: (a) => s(a.target.value),
|
|
892
894
|
className: "w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent"
|
|
893
895
|
}
|
|
894
896
|
),
|
|
@@ -897,8 +899,8 @@ function os({
|
|
|
897
899
|
{
|
|
898
900
|
label: "Clear search",
|
|
899
901
|
onClick: () => {
|
|
900
|
-
var
|
|
901
|
-
s(""), (
|
|
902
|
+
var a;
|
|
903
|
+
s(""), (a = r.current) == null || a.focus();
|
|
902
904
|
},
|
|
903
905
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
904
906
|
children: /* @__PURE__ */ e(he, { className: "h-4 w-4", weight: "bold" })
|
|
@@ -911,9 +913,9 @@ const as = ({
|
|
|
911
913
|
onSelectParticipant: s,
|
|
912
914
|
onClose: n,
|
|
913
915
|
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
914
|
-
participantLabel:
|
|
915
|
-
searchPlaceholder:
|
|
916
|
-
className:
|
|
916
|
+
participantLabel: a = "participants",
|
|
917
|
+
searchPlaceholder: c = "Search participants...",
|
|
918
|
+
className: i
|
|
917
919
|
}) => {
|
|
918
920
|
const { debug: l } = ne(), [o, w] = y(""), [I, N] = y([]), [m, S] = y(!1), [g, b] = y(null), [E, v] = y(
|
|
919
921
|
null
|
|
@@ -966,47 +968,47 @@ const as = ({
|
|
|
966
968
|
), p = (u, f) => {
|
|
967
969
|
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), T(f));
|
|
968
970
|
};
|
|
969
|
-
return /* @__PURE__ */
|
|
970
|
-
/* @__PURE__ */
|
|
971
|
-
/* @__PURE__ */
|
|
971
|
+
return /* @__PURE__ */ d("div", { className: R("flex flex-col h-full", i), children: [
|
|
972
|
+
/* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
973
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
|
|
972
974
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
973
975
|
/* @__PURE__ */ e(Ne, { onClick: n })
|
|
974
976
|
] }),
|
|
975
|
-
/* @__PURE__ */
|
|
977
|
+
/* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
|
|
976
978
|
"Select a ",
|
|
977
|
-
|
|
979
|
+
a.slice(0, -1),
|
|
978
980
|
" to start messaging (",
|
|
979
981
|
C.length,
|
|
980
982
|
" available)",
|
|
981
|
-
t.totalCount !== void 0 && ` • ${t.totalCount} ${
|
|
983
|
+
t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
|
|
982
984
|
] }),
|
|
983
985
|
/* @__PURE__ */ e(
|
|
984
986
|
os,
|
|
985
987
|
{
|
|
986
988
|
searchQuery: o,
|
|
987
989
|
setSearchQuery: w,
|
|
988
|
-
placeholder:
|
|
990
|
+
placeholder: c
|
|
989
991
|
}
|
|
990
992
|
)
|
|
991
993
|
] }),
|
|
992
|
-
g && /* @__PURE__ */
|
|
994
|
+
g && /* @__PURE__ */ d("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
993
995
|
"Error loading ",
|
|
994
|
-
|
|
996
|
+
a,
|
|
995
997
|
": ",
|
|
996
998
|
g
|
|
997
999
|
] }),
|
|
998
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && C.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */
|
|
1000
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && C.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
|
|
999
1001
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1000
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
|
|
1001
1003
|
"Loading ",
|
|
1002
|
-
|
|
1004
|
+
a,
|
|
1003
1005
|
"..."
|
|
1004
1006
|
] })
|
|
1005
|
-
] }) }) : C.length === 0 ? /* @__PURE__ */
|
|
1007
|
+
] }) }) : C.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
|
|
1006
1008
|
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(de, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1007
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${
|
|
1008
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : I.length > 0 ? `You have existing conversations with all your ${
|
|
1009
|
-
] }) : /* @__PURE__ */
|
|
1009
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${a} found` : I.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
|
|
1010
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : I.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
|
|
1011
|
+
] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
|
|
1010
1012
|
C.map((u) => {
|
|
1011
1013
|
const f = u.name || u.email || u.id, x = u.email && u.name ? u.email : u.phone;
|
|
1012
1014
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
@@ -1016,8 +1018,8 @@ const as = ({
|
|
|
1016
1018
|
onClick: () => T(u),
|
|
1017
1019
|
onKeyDown: (D) => p(D, u),
|
|
1018
1020
|
className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus:outline-none focus:ring-2 focus:ring-black",
|
|
1019
|
-
children: /* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
+
children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
1022
|
+
/* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1021
1023
|
/* @__PURE__ */ e(
|
|
1022
1024
|
J,
|
|
1023
1025
|
{
|
|
@@ -1027,7 +1029,7 @@ const as = ({
|
|
|
1027
1029
|
size: 40
|
|
1028
1030
|
}
|
|
1029
1031
|
),
|
|
1030
|
-
/* @__PURE__ */
|
|
1032
|
+
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
|
|
1031
1033
|
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: f }),
|
|
1032
1034
|
x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
|
|
1033
1035
|
] })
|
|
@@ -1037,25 +1039,25 @@ const as = ({
|
|
|
1037
1039
|
}
|
|
1038
1040
|
) }, u.id);
|
|
1039
1041
|
}),
|
|
1040
|
-
m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */
|
|
1042
|
+
m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
|
|
1041
1043
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1042
1044
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1043
1045
|
] }) })
|
|
1044
1046
|
] }) })
|
|
1045
1047
|
] });
|
|
1046
|
-
}, is = ({ hasChannels: t, onStartConversation: s, participantLabel: n }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */
|
|
1048
|
+
}, is = ({ hasChannels: t, onStartConversation: s, participantLabel: n }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
1047
1049
|
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "💬" }) }),
|
|
1048
1050
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
|
|
1049
|
-
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */
|
|
1051
|
+
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(se, { children: [
|
|
1050
1052
|
"Choose a conversation from the list or",
|
|
1051
1053
|
" ",
|
|
1052
|
-
s && /* @__PURE__ */
|
|
1054
|
+
s && /* @__PURE__ */ d(me, { onClick: s, children: [
|
|
1053
1055
|
"start a new conversation with a ",
|
|
1054
1056
|
n.slice(0, -1),
|
|
1055
1057
|
"."
|
|
1056
1058
|
] })
|
|
1057
|
-
] }) : s && /* @__PURE__ */
|
|
1058
|
-
/* @__PURE__ */
|
|
1059
|
+
] }) : s && /* @__PURE__ */ d(se, { children: [
|
|
1060
|
+
/* @__PURE__ */ d(me, { onClick: s, children: [
|
|
1059
1061
|
"Start a new conversation with one of your ",
|
|
1060
1062
|
n
|
|
1061
1063
|
] }),
|
|
@@ -1073,7 +1075,7 @@ const as = ({
|
|
|
1073
1075
|
className: "inline-flex items-center gap-1 text-sm font-medium text-primary hover:text-primary-alt focus:outline-none focus:ring-2 focus:ring-primary",
|
|
1074
1076
|
children: s
|
|
1075
1077
|
}
|
|
1076
|
-
), le = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */
|
|
1078
|
+
), le = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
1077
1079
|
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "⚠️" }) }),
|
|
1078
1080
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1079
1081
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1086,12 +1088,12 @@ const as = ({
|
|
|
1086
1088
|
children: "Go Back"
|
|
1087
1089
|
}
|
|
1088
1090
|
)
|
|
1089
|
-
] }) }), cs = ({ className: t, message: s }) => /* @__PURE__ */
|
|
1091
|
+
] }) }), cs = ({ className: t, message: s }) => /* @__PURE__ */ d(
|
|
1090
1092
|
"div",
|
|
1091
1093
|
{
|
|
1092
1094
|
className: R("flex items-center justify-center h-full", t),
|
|
1093
1095
|
children: [
|
|
1094
|
-
/* @__PURE__ */
|
|
1096
|
+
/* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1095
1097
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1096
1098
|
"animateTransform",
|
|
1097
1099
|
{
|
|
@@ -1129,7 +1131,7 @@ const as = ({
|
|
|
1129
1131
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1130
1132
|
]
|
|
1131
1133
|
}
|
|
1132
|
-
), ds = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */
|
|
1134
|
+
), ds = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
1133
1135
|
/* @__PURE__ */ e(cs, { className: "w-6 h-6" }),
|
|
1134
1136
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1135
1137
|
] }) }), vs = ({
|
|
@@ -1137,9 +1139,9 @@ const as = ({
|
|
|
1137
1139
|
className: s,
|
|
1138
1140
|
renderMessageInputActions: n,
|
|
1139
1141
|
onChannelSelect: r,
|
|
1140
|
-
onParticipantSelect:
|
|
1141
|
-
initialParticipantFilter:
|
|
1142
|
-
initialParticipantData:
|
|
1142
|
+
onParticipantSelect: a,
|
|
1143
|
+
initialParticipantFilter: c,
|
|
1144
|
+
initialParticipantData: i,
|
|
1143
1145
|
CustomChannelEmptyState: l,
|
|
1144
1146
|
showChannelList: o = !0,
|
|
1145
1147
|
filters: w,
|
|
@@ -1204,19 +1206,19 @@ const as = ({
|
|
|
1204
1206
|
const h = m.userID;
|
|
1205
1207
|
h && j.current !== h && B();
|
|
1206
1208
|
}, [m, S, B]), H(() => {
|
|
1207
|
-
if (!
|
|
1209
|
+
if (!c || !m || !S) return;
|
|
1208
1210
|
(async () => {
|
|
1209
1211
|
const L = m.userID;
|
|
1210
1212
|
if (L)
|
|
1211
1213
|
try {
|
|
1212
1214
|
v && console.log(
|
|
1213
1215
|
"[MessagingShell] Loading initial conversation with:",
|
|
1214
|
-
|
|
1216
|
+
c
|
|
1215
1217
|
);
|
|
1216
1218
|
const U = await m.queryChannels(
|
|
1217
1219
|
{
|
|
1218
1220
|
type: "messaging",
|
|
1219
|
-
members: { $eq: [L,
|
|
1221
|
+
members: { $eq: [L, c] }
|
|
1220
1222
|
},
|
|
1221
1223
|
{},
|
|
1222
1224
|
{ limit: 1 }
|
|
@@ -1226,17 +1228,17 @@ const as = ({
|
|
|
1226
1228
|
"[MessagingShell] Initial conversation loaded:",
|
|
1227
1229
|
U[0].id
|
|
1228
1230
|
);
|
|
1229
|
-
else if (
|
|
1231
|
+
else if (i && N) {
|
|
1230
1232
|
v && console.log(
|
|
1231
1233
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1232
|
-
|
|
1234
|
+
i
|
|
1233
1235
|
);
|
|
1234
1236
|
try {
|
|
1235
1237
|
const z = await N.startChannelWithParticipant({
|
|
1236
|
-
id:
|
|
1237
|
-
name:
|
|
1238
|
-
email:
|
|
1239
|
-
phone:
|
|
1238
|
+
id: i.id,
|
|
1239
|
+
name: i.name,
|
|
1240
|
+
email: i.email,
|
|
1241
|
+
phone: i.phone
|
|
1240
1242
|
});
|
|
1241
1243
|
C(z), W(!0), G(null), r && r(z), v && console.log(
|
|
1242
1244
|
"[MessagingShell] Channel created and loaded:",
|
|
@@ -1253,7 +1255,7 @@ const as = ({
|
|
|
1253
1255
|
"No conversation found with this account"
|
|
1254
1256
|
), v && console.log(
|
|
1255
1257
|
"[MessagingShell] No conversation found for:",
|
|
1256
|
-
|
|
1258
|
+
c
|
|
1257
1259
|
);
|
|
1258
1260
|
} catch (U) {
|
|
1259
1261
|
console.error(
|
|
@@ -1263,8 +1265,8 @@ const as = ({
|
|
|
1263
1265
|
}
|
|
1264
1266
|
})();
|
|
1265
1267
|
}, [
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
+
c,
|
|
1269
|
+
i,
|
|
1268
1270
|
m,
|
|
1269
1271
|
S,
|
|
1270
1272
|
N,
|
|
@@ -1301,12 +1303,12 @@ const as = ({
|
|
|
1301
1303
|
} catch (z) {
|
|
1302
1304
|
console.warn("[MessagingShell] Failed to unhide channel:", z);
|
|
1303
1305
|
}
|
|
1304
|
-
C(U), f(!1), (L = V.current) == null || L.close(),
|
|
1306
|
+
C(U), f(!1), (L = V.current) == null || L.close(), a == null || a(h);
|
|
1305
1307
|
} catch (U) {
|
|
1306
1308
|
console.error("[MessagingShell] Failed to start conversation:", U);
|
|
1307
1309
|
}
|
|
1308
1310
|
},
|
|
1309
|
-
[N,
|
|
1311
|
+
[N, a, v]
|
|
1310
1312
|
), te = P(() => {
|
|
1311
1313
|
var h;
|
|
1312
1314
|
f(!1), (h = V.current) == null || h.close();
|
|
@@ -1327,7 +1329,7 @@ const as = ({
|
|
|
1327
1329
|
message: "Not connected to messaging service",
|
|
1328
1330
|
onBack: E
|
|
1329
1331
|
}
|
|
1330
|
-
) }) : Q ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: Q }) }) : /* @__PURE__ */
|
|
1332
|
+
) }) : Q ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: Q }) }) : /* @__PURE__ */ d(
|
|
1331
1333
|
"div",
|
|
1332
1334
|
{
|
|
1333
1335
|
className: R(
|
|
@@ -1335,7 +1337,7 @@ const as = ({
|
|
|
1335
1337
|
s
|
|
1336
1338
|
),
|
|
1337
1339
|
children: [
|
|
1338
|
-
/* @__PURE__ */
|
|
1340
|
+
/* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
|
|
1339
1341
|
/* @__PURE__ */ e(
|
|
1340
1342
|
"div",
|
|
1341
1343
|
{
|
|
@@ -1450,25 +1452,26 @@ const as = ({
|
|
|
1450
1452
|
onFaqClick: s,
|
|
1451
1453
|
loadingFaqId: n,
|
|
1452
1454
|
headerText: r,
|
|
1453
|
-
className:
|
|
1454
|
-
avatarImage:
|
|
1455
|
-
avatarName:
|
|
1455
|
+
className: a,
|
|
1456
|
+
avatarImage: c,
|
|
1457
|
+
avatarName: i
|
|
1456
1458
|
}) => {
|
|
1457
1459
|
const l = t.filter((o) => o.enabled).sort((o, w) => (o.order ?? 0) - (w.order ?? 0));
|
|
1458
|
-
return l.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6",
|
|
1459
|
-
(
|
|
1460
|
+
return l.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6", a), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
|
|
1461
|
+
(c || i) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1460
1462
|
J,
|
|
1461
1463
|
{
|
|
1462
|
-
id:
|
|
1463
|
-
name:
|
|
1464
|
-
image:
|
|
1465
|
-
size: 24
|
|
1464
|
+
id: i || "account",
|
|
1465
|
+
name: i || "Account",
|
|
1466
|
+
image: c,
|
|
1467
|
+
size: 24,
|
|
1468
|
+
shape: "circle"
|
|
1466
1469
|
}
|
|
1467
1470
|
) }),
|
|
1468
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ d(
|
|
1469
1472
|
"div",
|
|
1470
1473
|
{
|
|
1471
|
-
className: "flex-1 rounded-lg p-4
|
|
1474
|
+
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
1472
1475
|
style: { backgroundColor: "#F1F0EE" },
|
|
1473
1476
|
children: [
|
|
1474
1477
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
@@ -1486,8 +1489,8 @@ const as = ({
|
|
|
1486
1489
|
)
|
|
1487
1490
|
] }) });
|
|
1488
1491
|
}, ws = (t, s = {}) => {
|
|
1489
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [
|
|
1490
|
-
if (
|
|
1492
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] = y([]), [i, l] = y(!1), [o, w] = y(null), [I, N] = y(n), [m, S] = y(!0), [g, b] = y(), E = P(async (T = !1, p) => {
|
|
1493
|
+
if (i) return;
|
|
1491
1494
|
const u = p !== void 0 ? p : I;
|
|
1492
1495
|
l(!0), w(null);
|
|
1493
1496
|
try {
|
|
@@ -1496,7 +1499,7 @@ const as = ({
|
|
|
1496
1499
|
limit: r,
|
|
1497
1500
|
cursor: T ? void 0 : g
|
|
1498
1501
|
});
|
|
1499
|
-
|
|
1502
|
+
c(
|
|
1500
1503
|
(x) => T ? f.participants : [...x, ...f.participants]
|
|
1501
1504
|
), S(f.hasMore), b(f.nextCursor);
|
|
1502
1505
|
} catch (f) {
|
|
@@ -1505,9 +1508,9 @@ const as = ({
|
|
|
1505
1508
|
} finally {
|
|
1506
1509
|
l(!1);
|
|
1507
1510
|
}
|
|
1508
|
-
}, [t, I, g, r,
|
|
1509
|
-
m && !
|
|
1510
|
-
}, [m,
|
|
1511
|
+
}, [t, I, g, r, i]), v = P(() => {
|
|
1512
|
+
m && !i && E(!1);
|
|
1513
|
+
}, [m, i, E]), F = P((T) => {
|
|
1511
1514
|
N(T), b(void 0), E(!0, T);
|
|
1512
1515
|
}, [E]), C = P(() => {
|
|
1513
1516
|
b(void 0), E(!0);
|
|
@@ -1515,8 +1518,8 @@ const as = ({
|
|
|
1515
1518
|
return H(() => {
|
|
1516
1519
|
E(!0);
|
|
1517
1520
|
}, [t.loadParticipants]), {
|
|
1518
|
-
participants:
|
|
1519
|
-
loading:
|
|
1521
|
+
participants: a,
|
|
1522
|
+
loading: i,
|
|
1520
1523
|
error: o,
|
|
1521
1524
|
searchQuery: I,
|
|
1522
1525
|
hasMore: m,
|