@linktr.ee/messaging-react 1.19.0 โ 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as i, Fragment as he } from "react/jsx-runtime";
|
|
|
2
2
|
import F from "classnames";
|
|
3
3
|
import B, { createContext as We, useContext as qe, useCallback as L, useState as S, useRef as G, useEffect as H, useMemo as be } from "react";
|
|
4
4
|
import { StreamChatService as Ze } from "@linktr.ee/messaging-core";
|
|
5
|
-
import { Chat as Ye, ChannelList as Je, DateSeparator as Qe, areMessageUIPropsEqual as Xe, useChatContext as Ke, useMessageReminder as es, useComponentContext as ss, Attachment as ts, EditMessageModal as ns, MessageBlocked as rs, MessageBouncePrompt as as, MessageDeleted as ls, MessageIsThreadReplyInChannelButtonIndicator as os, MessageRepliesCountButton as is, ReminderNotification as cs, StreamedMessageText as ds, messageHasAttachments as
|
|
5
|
+
import { Chat as Ye, ChannelList as Je, DateSeparator as Qe, areMessageUIPropsEqual as Xe, useChatContext as Ke, useMessageReminder as es, useComponentContext as ss, Attachment as ts, EditMessageModal as ns, MessageBlocked as rs, MessageBouncePrompt as as, MessageDeleted as ls, MessageIsThreadReplyInChannelButtonIndicator as os, MessageRepliesCountButton as is, ReminderNotification as cs, StreamedMessageText as ds, messageHasAttachments as us, messageHasReactions as ms, isDateSeparatorMessage as hs, isMessageBlocked as fs, isMessageBounced as gs, MessageBounceModal as xs, Poll as Cs, MessageText as bs, MessageErrorIcon as Ns, useMessageContext as vs, useMessageComposer as ws, useStateStore as ys, MessageInput as ps, useMessageInputContext as Es, useMessageComposerHasSendableData as Is, SimpleAttachmentSelector as _s, QuotedMessagePreview as Ss, AttachmentPreviewList as Ms, TextareaComposer as ks, MessageTimestamp as Rs, Channel as Ds, useChannelStateContext as Se, WithComponents as Ts, Window as Fs, MessageList as Ls } from "stream-chat-react";
|
|
6
6
|
import { GiftIcon as Ps, XIcon as fe, ArrowUpIcon as Os, ArrowLeftIcon as Ne, StarIcon as ve, DotsThreeIcon as we, SpinnerGapIcon as oe, SignOutIcon as Us, ProhibitInsetIcon as ye, FlagIcon as Bs, MagnifyingGlassIcon as js, ChatCircleDotsIcon as pe } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as Ee } from "stream-chat";
|
|
8
8
|
const Me = We({
|
|
@@ -24,8 +24,8 @@ const Me = We({
|
|
|
24
24
|
debug: c = !1
|
|
25
25
|
}) => {
|
|
26
26
|
const r = L(
|
|
27
|
-
(
|
|
28
|
-
c && console.log(`๐ฅ [MessagingProvider] ${
|
|
27
|
+
(u, ...w) => {
|
|
28
|
+
c && console.log(`๐ฅ [MessagingProvider] ${u}`, ...w);
|
|
29
29
|
},
|
|
30
30
|
[c]
|
|
31
31
|
);
|
|
@@ -56,9 +56,9 @@ const Me = We({
|
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: o
|
|
58
58
|
}, H(() => {
|
|
59
|
-
const
|
|
59
|
+
const u = y.current;
|
|
60
60
|
if (r("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
|
-
renderCount:
|
|
61
|
+
renderCount: u,
|
|
62
62
|
apiKey: !!l,
|
|
63
63
|
serviceConfig: !!n,
|
|
64
64
|
dependencies: {
|
|
@@ -69,13 +69,13 @@ const Me = We({
|
|
|
69
69
|
}
|
|
70
70
|
}), !l || !n) {
|
|
71
71
|
r("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
72
|
-
renderCount:
|
|
72
|
+
renderCount: u,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
74
74
|
});
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
r("๐ CREATING NEW SERVICE", {
|
|
78
|
-
renderCount:
|
|
78
|
+
renderCount: u,
|
|
79
79
|
apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: b.current.serviceConfig !== n
|
|
81
81
|
});
|
|
@@ -85,16 +85,16 @@ const Me = We({
|
|
|
85
85
|
debug: c
|
|
86
86
|
});
|
|
87
87
|
return x(w), r("โ
SERVICE SET", {
|
|
88
|
-
renderCount:
|
|
88
|
+
renderCount: u,
|
|
89
89
|
serviceInstance: !!w
|
|
90
90
|
}), () => {
|
|
91
91
|
r("๐งน SERVICE CLEANUP", {
|
|
92
|
-
renderCount:
|
|
92
|
+
renderCount: u,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
94
|
}), w.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
96
|
}, [l, n, c, r]);
|
|
97
|
-
const
|
|
97
|
+
const m = G(null);
|
|
98
98
|
H(() => {
|
|
99
99
|
var w, v;
|
|
100
100
|
if (r("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
@@ -112,7 +112,7 @@ const Me = We({
|
|
|
112
112
|
r("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((w =
|
|
115
|
+
if (((w = m.current) == null ? void 0 : w.serviceId) === d && ((v = m.current) == null ? void 0 : v.userId) === s.id) {
|
|
116
116
|
r(
|
|
117
117
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -124,7 +124,7 @@ const Me = We({
|
|
|
124
124
|
try {
|
|
125
125
|
r("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
126
|
const D = await d.connectUser(s);
|
|
127
|
-
C(D), a(!0),
|
|
127
|
+
C(D), a(!0), m.current = { serviceId: d, userId: s.id }, r("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: D.userID
|
|
130
130
|
});
|
|
@@ -148,7 +148,7 @@ const Me = We({
|
|
|
148
148
|
d && N ? (r(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
151
|
+
), m.current = null, d.disconnectUser().catch(console.error)) : r("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
152
|
hasService: !!d,
|
|
153
153
|
isConnected: N
|
|
154
154
|
});
|
|
@@ -164,10 +164,10 @@ const Me = We({
|
|
|
164
164
|
r("๐ STARTING CONNECTION REFRESH", { userId: s.id }), I(!0);
|
|
165
165
|
try {
|
|
166
166
|
r("๐ DISCONNECTING FOR REFRESH"), await d.disconnectUser(), r("๐ RECONNECTING FOR REFRESH");
|
|
167
|
-
const
|
|
168
|
-
C(
|
|
169
|
-
} catch (
|
|
170
|
-
const w =
|
|
167
|
+
const u = await d.connectUser(s);
|
|
168
|
+
C(u), a(!0), f(null), r("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
|
+
} catch (u) {
|
|
170
|
+
const w = u instanceof Error ? u.message : "Refresh failed";
|
|
171
171
|
f(w), r("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
173
|
error: w
|
|
@@ -365,7 +365,7 @@ const X = ({
|
|
|
365
365
|
unread: o,
|
|
366
366
|
renderMessagePreview: c
|
|
367
367
|
}) => {
|
|
368
|
-
var y,
|
|
368
|
+
var y, m, k, g, u, w;
|
|
369
369
|
const r = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), d = () => {
|
|
370
370
|
t && n(t);
|
|
371
371
|
}, h = Object.values(((y = t == null ? void 0 : t.state) == null ? void 0 : y.members) || {}).find(
|
|
@@ -373,7 +373,7 @@ const X = ({
|
|
|
373
373
|
var D, P;
|
|
374
374
|
return ((D = v.user) == null ? void 0 : D.id) && v.user.id !== ((P = t == null ? void 0 : t._client) == null ? void 0 : P.userID);
|
|
375
375
|
}
|
|
376
|
-
), C = ((
|
|
376
|
+
), C = ((m = h == null ? void 0 : h.user) == null ? void 0 : m.name) || "Conversation", N = (k = h == null ? void 0 : h.user) == null ? void 0 : k.image, a = (u = (g = t == null ? void 0 : t.state) == null ? void 0 : g.messages) == null ? void 0 : u[t.state.messages.length - 1], I = (() => {
|
|
377
377
|
var D;
|
|
378
378
|
if (a != null && a.text) return a.text;
|
|
379
379
|
const v = (D = a == null ? void 0 : a.attachments) == null ? void 0 : D[0];
|
|
@@ -423,7 +423,7 @@ const X = ({
|
|
|
423
423
|
_ && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: _ })
|
|
424
424
|
] }),
|
|
425
425
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
426
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone
|
|
426
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children: p }),
|
|
427
427
|
b > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: b > 99 ? "99+" : b })
|
|
428
428
|
] })
|
|
429
429
|
] })
|
|
@@ -544,16 +544,16 @@ const Ys = (t) => /* @__PURE__ */ e(Qe, { ...t, position: "center" }), Js = (t)
|
|
|
544
544
|
threadList: I
|
|
545
545
|
} = t, { client: _ } = Ke("CustomMessage"), [f, p] = S(!1), b = es(a.id), {
|
|
546
546
|
Attachment: y = ts,
|
|
547
|
-
EditMessageModal:
|
|
547
|
+
EditMessageModal: m = ns,
|
|
548
548
|
MessageBlocked: k = rs,
|
|
549
549
|
MessageBouncePrompt: g = as,
|
|
550
|
-
MessageDeleted:
|
|
550
|
+
MessageDeleted: u = ls,
|
|
551
551
|
MessageIsThreadReplyInChannelButtonIndicator: w = os,
|
|
552
552
|
MessageRepliesCountButton: v = is,
|
|
553
553
|
ReminderNotification: D = cs,
|
|
554
554
|
StreamedMessageText: P = ds,
|
|
555
555
|
PinIndicator: q
|
|
556
|
-
} = ss("CustomMessage"), te =
|
|
556
|
+
} = ss("CustomMessage"), te = us(a), K = ms(a), ee = be(
|
|
557
557
|
() => C == null ? void 0 : C(a),
|
|
558
558
|
[C, a]
|
|
559
559
|
), V = be(
|
|
@@ -563,7 +563,7 @@ const Ys = (t) => /* @__PURE__ */ e(Qe, { ...t, position: "center" }), Js = (t)
|
|
|
563
563
|
if (hs(a))
|
|
564
564
|
return null;
|
|
565
565
|
if (a.deleted_at || a.type === "deleted")
|
|
566
|
-
return /* @__PURE__ */ e(
|
|
566
|
+
return /* @__PURE__ */ e(u, { message: a });
|
|
567
567
|
if (fs(a))
|
|
568
568
|
return /* @__PURE__ */ e(k, {});
|
|
569
569
|
const W = !I && !!a.reply_count, Z = !I && a.show_in_channel && a.parent_id, Y = a.status === "failed" && (($ = a.error) == null ? void 0 : $.status) !== 403, J = gs(a);
|
|
@@ -589,7 +589,7 @@ const Ys = (t) => /* @__PURE__ */ e(Qe, { ...t, position: "center" }), Js = (t)
|
|
|
589
589
|
), U = a.poll_id && _.polls.fromState(a.poll_id), z = Zs(a);
|
|
590
590
|
return /* @__PURE__ */ i(he, { children: [
|
|
591
591
|
n && /* @__PURE__ */ e(
|
|
592
|
-
|
|
592
|
+
m,
|
|
593
593
|
{
|
|
594
594
|
additionalMessageInputProps: s
|
|
595
595
|
}
|
|
@@ -837,17 +837,17 @@ const ot = ({
|
|
|
837
837
|
var a, M, I, _, f, p;
|
|
838
838
|
const { channel: c } = Se(), r = B.useMemo(() => Object.values(c.state.members || {}).find(
|
|
839
839
|
(y) => {
|
|
840
|
-
var
|
|
841
|
-
return ((
|
|
840
|
+
var m;
|
|
841
|
+
return ((m = y.user) == null ? void 0 : m.id) && y.user.id !== c._client.userID;
|
|
842
842
|
}
|
|
843
843
|
), [c._client.userID, c.state.members]), d = ((a = r == null ? void 0 : r.user) == null ? void 0 : a.name) || ((M = r == null ? void 0 : r.user) == null ? void 0 : M.id) || "Unknown member", x = (I = r == null ? void 0 : r.user) == null ? void 0 : I.image, [h, C] = S(
|
|
844
844
|
!!((_ = c.state.membership) != null && _.pinned_at)
|
|
845
845
|
);
|
|
846
846
|
H(() => {
|
|
847
847
|
const b = (y) => {
|
|
848
|
-
var
|
|
848
|
+
var m;
|
|
849
849
|
C(
|
|
850
|
-
y != null && y.member ? !!y.member.pinned_at : !!((
|
|
850
|
+
y != null && y.member ? !!y.member.pinned_at : !!((m = c.state.membership) != null && m.pinned_at)
|
|
851
851
|
);
|
|
852
852
|
};
|
|
853
853
|
return c.on("member.updated", b), () => {
|
|
@@ -1008,7 +1008,7 @@ const ot = ({
|
|
|
1008
1008
|
H(() => {
|
|
1009
1009
|
y();
|
|
1010
1010
|
}, [y]);
|
|
1011
|
-
const
|
|
1011
|
+
const m = async () => {
|
|
1012
1012
|
var T;
|
|
1013
1013
|
if (!_) {
|
|
1014
1014
|
x == null || x(), a && console.log("[ChannelInfoDialog] Leave conversation", l.cid), f(!0);
|
|
@@ -1045,7 +1045,7 @@ const ot = ({
|
|
|
1045
1045
|
b(!1);
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
|
-
},
|
|
1048
|
+
}, u = () => {
|
|
1049
1049
|
C == null || C(), s(), window.open(
|
|
1050
1050
|
"https://linktr.ee/s/about/trust-center/report",
|
|
1051
1051
|
"_blank",
|
|
@@ -1112,7 +1112,7 @@ const ot = ({
|
|
|
1112
1112
|
d && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1113
1113
|
le,
|
|
1114
1114
|
{
|
|
1115
|
-
onClick:
|
|
1115
|
+
onClick: m,
|
|
1116
1116
|
disabled: _,
|
|
1117
1117
|
"aria-busy": _,
|
|
1118
1118
|
children: [
|
|
@@ -1144,7 +1144,7 @@ const ot = ({
|
|
|
1144
1144
|
]
|
|
1145
1145
|
}
|
|
1146
1146
|
) }),
|
|
1147
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(le, { variant: "danger", onClick:
|
|
1147
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(le, { variant: "danger", onClick: u, children: [
|
|
1148
1148
|
/* @__PURE__ */ e(Bs, { className: "h-5 w-5" }),
|
|
1149
1149
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
1150
1150
|
] }) })
|
|
@@ -1258,7 +1258,7 @@ const ot = ({
|
|
|
1258
1258
|
const f = L(
|
|
1259
1259
|
async (p, b, y) => {
|
|
1260
1260
|
var v;
|
|
1261
|
-
const
|
|
1261
|
+
const m = ((v = t.data) == null ? void 0 : v.chatbot_paused) === !0, k = a && !m, g = {
|
|
1262
1262
|
...b,
|
|
1263
1263
|
...k && { silent: !0 },
|
|
1264
1264
|
...M && {
|
|
@@ -1267,10 +1267,10 @@ const ot = ({
|
|
|
1267
1267
|
...M
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
|
-
},
|
|
1270
|
+
}, u = {
|
|
1271
1271
|
...y,
|
|
1272
1272
|
...k && { skip_push: !0 }
|
|
1273
|
-
}, w = await t.sendMessage(g,
|
|
1273
|
+
}, w = await t.sendMessage(g, u);
|
|
1274
1274
|
return I == null || I(w), w;
|
|
1275
1275
|
},
|
|
1276
1276
|
[t, a, M, I]
|
|
@@ -1353,7 +1353,7 @@ function dt({
|
|
|
1353
1353
|
)
|
|
1354
1354
|
] });
|
|
1355
1355
|
}
|
|
1356
|
-
const
|
|
1356
|
+
const ut = ({
|
|
1357
1357
|
participantSource: t,
|
|
1358
1358
|
onSelectParticipant: s,
|
|
1359
1359
|
onClose: n,
|
|
@@ -1376,18 +1376,18 @@ const mt = ({
|
|
|
1376
1376
|
(async () => {
|
|
1377
1377
|
d && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), _(null);
|
|
1378
1378
|
try {
|
|
1379
|
-
const
|
|
1379
|
+
const u = await t.loadParticipants({
|
|
1380
1380
|
search: "",
|
|
1381
1381
|
// Load all participants initially
|
|
1382
1382
|
limit: 100
|
|
1383
1383
|
});
|
|
1384
|
-
N(
|
|
1384
|
+
N(u.participants), b.current = !0, d && console.log(
|
|
1385
1385
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1386
|
-
|
|
1386
|
+
u.participants.length
|
|
1387
1387
|
);
|
|
1388
|
-
} catch (
|
|
1389
|
-
const w =
|
|
1390
|
-
_(w), console.error("[ParticipantPicker] Failed to load participants:",
|
|
1388
|
+
} catch (u) {
|
|
1389
|
+
const w = u instanceof Error ? u.message : "Failed to load participants";
|
|
1390
|
+
_(w), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
1391
1391
|
} finally {
|
|
1392
1392
|
M(!1);
|
|
1393
1393
|
}
|
|
@@ -1396,22 +1396,22 @@ const mt = ({
|
|
|
1396
1396
|
const y = C.filter((g) => !l.has(g.id)).filter((g) => {
|
|
1397
1397
|
var w;
|
|
1398
1398
|
if (!x) return !0;
|
|
1399
|
-
const
|
|
1400
|
-
return g.name.toLowerCase().includes(
|
|
1401
|
-
}),
|
|
1399
|
+
const u = x.toLowerCase();
|
|
1400
|
+
return g.name.toLowerCase().includes(u) || ((w = g.email) == null ? void 0 : w.toLowerCase().includes(u)) || !1;
|
|
1401
|
+
}), m = L(
|
|
1402
1402
|
async (g) => {
|
|
1403
1403
|
if (!f) {
|
|
1404
1404
|
p(g.id);
|
|
1405
1405
|
try {
|
|
1406
1406
|
await s(g);
|
|
1407
|
-
} catch (
|
|
1408
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1407
|
+
} catch (u) {
|
|
1408
|
+
console.error("[ParticipantPicker] Failed to start chat:", u), p(null);
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
1411
|
},
|
|
1412
1412
|
[s, f]
|
|
1413
|
-
), k = (g,
|
|
1414
|
-
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), u
|
|
1413
|
+
), k = (g, u) => {
|
|
1414
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), m(u));
|
|
1415
1415
|
};
|
|
1416
1416
|
return /* @__PURE__ */ i("div", { className: F("flex flex-col h-full", r), children: [
|
|
1417
1417
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
@@ -1455,12 +1455,12 @@ const mt = ({
|
|
|
1455
1455
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: x ? "Try a different search term" : C.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
|
|
1456
1456
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1457
1457
|
y.map((g) => {
|
|
1458
|
-
const
|
|
1458
|
+
const u = g.name || g.email || g.id, w = g.email && g.name ? g.email : g.phone;
|
|
1459
1459
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1460
1460
|
"button",
|
|
1461
1461
|
{
|
|
1462
1462
|
type: "button",
|
|
1463
|
-
onClick: () =>
|
|
1463
|
+
onClick: () => m(g),
|
|
1464
1464
|
onKeyDown: (v) => k(v, g),
|
|
1465
1465
|
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",
|
|
1466
1466
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
@@ -1469,13 +1469,13 @@ const mt = ({
|
|
|
1469
1469
|
X,
|
|
1470
1470
|
{
|
|
1471
1471
|
id: g.id,
|
|
1472
|
-
name:
|
|
1472
|
+
name: u,
|
|
1473
1473
|
image: g.image,
|
|
1474
1474
|
size: 40
|
|
1475
1475
|
}
|
|
1476
1476
|
),
|
|
1477
1477
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1478
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1478
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
|
|
1479
1479
|
w && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: w })
|
|
1480
1480
|
] })
|
|
1481
1481
|
] }),
|
|
@@ -1490,7 +1490,7 @@ const mt = ({
|
|
|
1490
1490
|
] }) })
|
|
1491
1491
|
] }) })
|
|
1492
1492
|
] });
|
|
1493
|
-
},
|
|
1493
|
+
}, mt = ({ className: t }) => /* @__PURE__ */ i(
|
|
1494
1494
|
"svg",
|
|
1495
1495
|
{
|
|
1496
1496
|
width: "140",
|
|
@@ -1626,7 +1626,7 @@ const mt = ({
|
|
|
1626
1626
|
}
|
|
1627
1627
|
), Oe = B.memo(
|
|
1628
1628
|
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
1629
|
-
/* @__PURE__ */ e(
|
|
1629
|
+
/* @__PURE__ */ e(mt, {}),
|
|
1630
1630
|
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1631
1631
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1632
1632
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
@@ -1672,10 +1672,10 @@ const yt = ({
|
|
|
1672
1672
|
}) => {
|
|
1673
1673
|
const {
|
|
1674
1674
|
service: y,
|
|
1675
|
-
client:
|
|
1675
|
+
client: m,
|
|
1676
1676
|
isConnected: k,
|
|
1677
1677
|
isLoading: g,
|
|
1678
|
-
error:
|
|
1678
|
+
error: u,
|
|
1679
1679
|
refreshConnection: w,
|
|
1680
1680
|
debug: v
|
|
1681
1681
|
} = As(), [D, P] = S(null), [q, te] = S(!1), [K, ee] = S(!1), [V, W] = S(!1), [Z, Y] = S(/* @__PURE__ */ new Set()), [J, T] = S(0), [R, U] = S(!1), [z, $] = S(null), Q = G(null), {
|
|
@@ -1683,7 +1683,7 @@ const yt = ({
|
|
|
1683
1683
|
participantLabel: xe = "participants",
|
|
1684
1684
|
showDeleteConversation: Ue = !0
|
|
1685
1685
|
} = t, Be = B.useMemo(() => {
|
|
1686
|
-
const E =
|
|
1686
|
+
const E = m == null ? void 0 : m.userID;
|
|
1687
1687
|
return {
|
|
1688
1688
|
...{
|
|
1689
1689
|
type: "messaging",
|
|
@@ -1695,13 +1695,13 @@ const yt = ({
|
|
|
1695
1695
|
},
|
|
1696
1696
|
...h
|
|
1697
1697
|
};
|
|
1698
|
-
}, [h,
|
|
1699
|
-
if (!
|
|
1700
|
-
const E =
|
|
1698
|
+
}, [h, m == null ? void 0 : m.userID]), ne = G(null), se = L(async () => {
|
|
1699
|
+
if (!m || !k) return;
|
|
1700
|
+
const E = m.userID;
|
|
1701
1701
|
if (E)
|
|
1702
1702
|
try {
|
|
1703
1703
|
v && console.log("[MessagingShell] Syncing channels for user:", E);
|
|
1704
|
-
const A = await
|
|
1704
|
+
const A = await m.queryChannels(
|
|
1705
1705
|
{
|
|
1706
1706
|
type: "messaging",
|
|
1707
1707
|
members: { $in: [E] }
|
|
@@ -1710,35 +1710,35 @@ const yt = ({
|
|
|
1710
1710
|
{ limit: 100 }
|
|
1711
1711
|
), O = /* @__PURE__ */ new Set();
|
|
1712
1712
|
A.forEach((j) => {
|
|
1713
|
-
const
|
|
1714
|
-
Object.values(
|
|
1713
|
+
const ue = j.state.members;
|
|
1714
|
+
Object.values(ue).forEach((Ve) => {
|
|
1715
1715
|
var Ce;
|
|
1716
|
-
const
|
|
1717
|
-
|
|
1716
|
+
const me = (Ce = Ve.user) == null ? void 0 : Ce.id;
|
|
1717
|
+
me && me !== E && O.add(me);
|
|
1718
1718
|
});
|
|
1719
|
-
}), Y((j) => j.size === O.size && [...j].every((
|
|
1719
|
+
}), Y((j) => j.size === O.size && [...j].every((ue) => O.has(ue)) ? j : O), te(A.length > 0), ee(!0), ne.current = E, v && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1720
1720
|
channelCount: A.length,
|
|
1721
1721
|
memberCount: O.size
|
|
1722
1722
|
});
|
|
1723
1723
|
} catch (A) {
|
|
1724
1724
|
console.error("[MessagingShell] Failed to sync channels:", A);
|
|
1725
1725
|
}
|
|
1726
|
-
}, [
|
|
1726
|
+
}, [m, k, v]);
|
|
1727
1727
|
H(() => {
|
|
1728
|
-
if (!
|
|
1729
|
-
const E =
|
|
1728
|
+
if (!m || !k) return;
|
|
1729
|
+
const E = m.userID;
|
|
1730
1730
|
E && ne.current !== E && se();
|
|
1731
|
-
}, [
|
|
1732
|
-
if (!c || !
|
|
1731
|
+
}, [m, k, se]), H(() => {
|
|
1732
|
+
if (!c || !m || !k) return;
|
|
1733
1733
|
(async () => {
|
|
1734
|
-
const A =
|
|
1734
|
+
const A = m.userID;
|
|
1735
1735
|
if (A)
|
|
1736
1736
|
try {
|
|
1737
1737
|
v && console.log(
|
|
1738
1738
|
"[MessagingShell] Loading initial conversation with:",
|
|
1739
1739
|
c
|
|
1740
1740
|
);
|
|
1741
|
-
const O = await
|
|
1741
|
+
const O = await m.queryChannels(
|
|
1742
1742
|
{
|
|
1743
1743
|
type: "messaging",
|
|
1744
1744
|
members: { $eq: [A, c] }
|
|
@@ -1790,7 +1790,7 @@ const yt = ({
|
|
|
1790
1790
|
}, [
|
|
1791
1791
|
c,
|
|
1792
1792
|
r,
|
|
1793
|
-
|
|
1793
|
+
m,
|
|
1794
1794
|
k,
|
|
1795
1795
|
y,
|
|
1796
1796
|
v,
|
|
@@ -1848,7 +1848,7 @@ const yt = ({
|
|
|
1848
1848
|
},
|
|
1849
1849
|
[se, v]
|
|
1850
1850
|
), ae = !!D;
|
|
1851
|
-
return g ? /* @__PURE__ */ e("div", { className: F("h-full", s), children: /* @__PURE__ */ e(ce, {}) }) :
|
|
1851
|
+
return g ? /* @__PURE__ */ e("div", { className: F("h-full", s), children: /* @__PURE__ */ e(ce, {}) }) : u ? /* @__PURE__ */ e("div", { className: F("h-full", s), children: /* @__PURE__ */ e(ie, { message: u, onBack: w }) }) : !k || !m ? /* @__PURE__ */ e("div", { className: F("h-full", s), children: /* @__PURE__ */ e(
|
|
1852
1852
|
ie,
|
|
1853
1853
|
{
|
|
1854
1854
|
message: "Not connected to messaging service",
|
|
@@ -1942,7 +1942,7 @@ const yt = ({
|
|
|
1942
1942
|
onClick: ze,
|
|
1943
1943
|
onClose: re,
|
|
1944
1944
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1945
|
-
|
|
1945
|
+
ut,
|
|
1946
1946
|
{
|
|
1947
1947
|
participantSource: ge,
|
|
1948
1948
|
onSelectParticipant: $e,
|
|
@@ -2022,29 +2022,29 @@ const yt = ({
|
|
|
2022
2022
|
)
|
|
2023
2023
|
] }) });
|
|
2024
2024
|
}, Et = (t, s = {}) => {
|
|
2025
|
-
const { initialSearch: n = "", pageSize: l = 20 } = s, [o, c] = S([]), [r, d] = S(!1), [x, h] = S(null), [C, N] = S(n), [a, M] = S(!0), [I, _] = S(), f = L(async (
|
|
2025
|
+
const { initialSearch: n = "", pageSize: l = 20 } = s, [o, c] = S([]), [r, d] = S(!1), [x, h] = S(null), [C, N] = S(n), [a, M] = S(!0), [I, _] = S(), f = L(async (m = !1, k) => {
|
|
2026
2026
|
if (r) return;
|
|
2027
2027
|
const g = k !== void 0 ? k : C;
|
|
2028
2028
|
d(!0), h(null);
|
|
2029
2029
|
try {
|
|
2030
|
-
const
|
|
2030
|
+
const u = await t.loadParticipants({
|
|
2031
2031
|
search: g || void 0,
|
|
2032
2032
|
limit: l,
|
|
2033
|
-
cursor:
|
|
2033
|
+
cursor: m ? void 0 : I
|
|
2034
2034
|
});
|
|
2035
2035
|
c(
|
|
2036
|
-
(w) =>
|
|
2037
|
-
), M(
|
|
2038
|
-
} catch (
|
|
2039
|
-
const w =
|
|
2040
|
-
h(w), console.error("[useParticipants] Load error:",
|
|
2036
|
+
(w) => m ? u.participants : [...w, ...u.participants]
|
|
2037
|
+
), M(u.hasMore), _(u.nextCursor);
|
|
2038
|
+
} catch (u) {
|
|
2039
|
+
const w = u instanceof Error ? u.message : "Failed to load participants";
|
|
2040
|
+
h(w), console.error("[useParticipants] Load error:", u);
|
|
2041
2041
|
} finally {
|
|
2042
2042
|
d(!1);
|
|
2043
2043
|
}
|
|
2044
2044
|
}, [t, C, I, l, r]), p = L(() => {
|
|
2045
2045
|
a && !r && f(!1);
|
|
2046
|
-
}, [a, r, f]), b = L((
|
|
2047
|
-
N(
|
|
2046
|
+
}, [a, r, f]), b = L((m) => {
|
|
2047
|
+
N(m), _(void 0), f(!0, m);
|
|
2048
2048
|
}, [f]), y = L(() => {
|
|
2049
2049
|
_(void 0), f(!0);
|
|
2050
2050
|
}, [f]);
|
|
@@ -2071,7 +2071,7 @@ export {
|
|
|
2071
2071
|
ht as FaqListItem,
|
|
2072
2072
|
wt as MessagingProvider,
|
|
2073
2073
|
yt as MessagingShell,
|
|
2074
|
-
|
|
2074
|
+
ut as ParticipantPicker,
|
|
2075
2075
|
zs as formatRelativeTime,
|
|
2076
2076
|
As as useMessaging,
|
|
2077
2077
|
Et as useParticipants
|