@linktr.ee/messaging-react 1.14.0 → 1.14.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 +339 -346
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CustomMessage/index.tsx +0 -9
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i, Fragment as Ne } from "react/jsx-runtime";
|
|
2
2
|
import S from "classnames";
|
|
3
|
-
import P, { createContext as $e, useContext as je, useCallback as
|
|
3
|
+
import P, { createContext as $e, useContext as je, useCallback as T, useState as p, useRef as W, useEffect as q, useMemo as we } from "react";
|
|
4
4
|
import { StreamChatService as ze } from "@linktr.ee/messaging-core";
|
|
5
|
-
import { Chat as Ge, ChannelList as He, DateSeparator as Ve, areMessageUIPropsEqual as We, useChatContext as Ze, useTranslationContext as qe, useMessageReminder as Ye, useComponentContext as Je, Attachment as Qe, Avatar as Xe, EditMessageModal as Ke,
|
|
6
|
-
import { XIcon as be, GiftIcon as
|
|
5
|
+
import { Chat as Ge, ChannelList as He, DateSeparator as Ve, areMessageUIPropsEqual as We, useChatContext as Ze, useTranslationContext as qe, useMessageReminder as Ye, useComponentContext as Je, Attachment as Qe, Avatar as Xe, EditMessageModal as Ke, MessageBlocked as es, MessageBouncePrompt as ss, MessageDeleted as ts, MessageIsThreadReplyInChannelButtonIndicator as ns, MessageRepliesCountButton as rs, MessageStatus as as, MessageTimestamp as ke, ReminderNotification as ls, StreamedMessageText as os, messageHasAttachments as is, messageHasReactions as cs, isDateSeparatorMessage as ds, isMessageBlocked as ms, isMessageBounced as us, isMessageEdited as hs, MessageBounceModal as fs, Poll as gs, MessageText as xs, MessageErrorIcon as Cs, MessageEditedTimestamp as Ns, useMessageContext as bs, useMessageComposer as vs, useStateStore as ws, MessageInput as ys, useMessageInputContext as ps, useMessageComposerHasSendableData as Es, SimpleAttachmentSelector as Is, QuotedMessagePreview as _s, AttachmentPreviewList as Ss, TextareaComposer as Ms, Channel as ks, useChannelStateContext as Re, WithComponents as Rs, Window as Ts, MessageList as Ds } from "stream-chat-react";
|
|
6
|
+
import { XIcon as be, GiftIcon as Fs, ArrowUpIcon as Ls, ArrowLeftIcon as ye, DotsThreeIcon as pe, SpinnerGapIcon as de, SignOutIcon as Ps, ProhibitInsetIcon as Ee, FlagIcon as Os, MagnifyingGlassIcon as Us, ChatCircleDotsIcon as Ie } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as _e } from "stream-chat";
|
|
8
8
|
const Te = $e({
|
|
9
9
|
service: null,
|
|
@@ -15,7 +15,7 @@ const Te = $e({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}),
|
|
18
|
+
}), he = () => je(Te), vt = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
@@ -23,7 +23,7 @@ const Te = $e({
|
|
|
23
23
|
capabilities: o = {},
|
|
24
24
|
debug: c = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const a =
|
|
26
|
+
const a = T(
|
|
27
27
|
(h, ...v) => {
|
|
28
28
|
c && console.log(`🔥 [MessagingProvider] ${h}`, ...v);
|
|
29
29
|
},
|
|
@@ -35,7 +35,7 @@ const Te = $e({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(o)
|
|
37
37
|
});
|
|
38
|
-
const [u, g] =
|
|
38
|
+
const [u, g] = p(null), [x, w] = p(null), [f, l] = p(!1), [R, y] = p(!1), [d, N] = p(null), E = W(!1), I = W({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
@@ -96,7 +96,7 @@ const Te = $e({
|
|
|
96
96
|
}, [r, n, c, a]);
|
|
97
97
|
const C = W(null);
|
|
98
98
|
q(() => {
|
|
99
|
-
var v,
|
|
99
|
+
var v, G;
|
|
100
100
|
if (a("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
101
101
|
hasService: !!u,
|
|
102
102
|
hasUser: !!s,
|
|
@@ -112,7 +112,7 @@ const Te = $e({
|
|
|
112
112
|
a("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((v = C.current) == null ? void 0 : v.serviceId) === u && ((
|
|
115
|
+
if (((v = C.current) == null ? void 0 : v.serviceId) === u && ((G = C.current) == null ? void 0 : G.userId) === s.id) {
|
|
116
116
|
a(
|
|
117
117
|
"⚠️ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -120,7 +120,7 @@ const Te = $e({
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
a("🚀 STARTING USER CONNECTION", { userId: s.id }), E.current = !0,
|
|
123
|
+
a("🚀 STARTING USER CONNECTION", { userId: s.id }), E.current = !0, y(!0), N(null);
|
|
124
124
|
try {
|
|
125
125
|
a("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
126
|
const A = await u.connectUser(s);
|
|
@@ -135,7 +135,7 @@ const Te = $e({
|
|
|
135
135
|
error: Z
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
y(!1), E.current = !1, a("🔄 USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
isConnected: f
|
|
141
141
|
});
|
|
@@ -153,7 +153,7 @@ const Te = $e({
|
|
|
153
153
|
isConnected: f
|
|
154
154
|
});
|
|
155
155
|
}), [u, f, a]);
|
|
156
|
-
const M =
|
|
156
|
+
const M = T(async () => {
|
|
157
157
|
if (a("🔄 REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!u,
|
|
159
159
|
hasUser: !!s
|
|
@@ -161,7 +161,7 @@ const Te = $e({
|
|
|
161
161
|
a("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
a("🚀 STARTING CONNECTION REFRESH", { userId: s.id }),
|
|
164
|
+
a("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), y(!0);
|
|
165
165
|
try {
|
|
166
166
|
a("🔌 DISCONNECTING FOR REFRESH"), await u.disconnectUser(), a("📞 RECONNECTING FOR REFRESH");
|
|
167
167
|
const h = await u.connectUser(s);
|
|
@@ -173,20 +173,20 @@ const Te = $e({
|
|
|
173
173
|
error: v
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
y(!1), a("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
178
|
}, [u, s, a]), m = P.useMemo(() => (a("💫 CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!u,
|
|
180
180
|
hasClient: !!x,
|
|
181
181
|
isConnected: f,
|
|
182
|
-
isLoading:
|
|
182
|
+
isLoading: R,
|
|
183
183
|
hasError: !!d,
|
|
184
184
|
capabilitiesKeys: Object.keys(o)
|
|
185
185
|
}), {
|
|
186
186
|
service: u,
|
|
187
187
|
client: x,
|
|
188
188
|
isConnected: f,
|
|
189
|
-
isLoading:
|
|
189
|
+
isLoading: R,
|
|
190
190
|
error: d,
|
|
191
191
|
capabilities: o,
|
|
192
192
|
refreshConnection: M,
|
|
@@ -195,7 +195,7 @@ const Te = $e({
|
|
|
195
195
|
u,
|
|
196
196
|
x,
|
|
197
197
|
f,
|
|
198
|
-
|
|
198
|
+
R,
|
|
199
199
|
d,
|
|
200
200
|
o,
|
|
201
201
|
M,
|
|
@@ -216,18 +216,18 @@ const Te = $e({
|
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
},
|
|
219
|
+
}, Bs = () => he(), As = (t, s) => {
|
|
220
220
|
const n = new Date(
|
|
221
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
222
222
|
), o = new Date(
|
|
223
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
224
224
|
).getTime() - n.getTime();
|
|
225
225
|
return Math.floor(o / (1e3 * 60 * 60 * 24));
|
|
226
|
-
},
|
|
226
|
+
}, $s = (t) => {
|
|
227
227
|
const s = /* @__PURE__ */ new Date();
|
|
228
228
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
229
229
|
return "Just now";
|
|
230
|
-
const r =
|
|
230
|
+
const r = As(t, s);
|
|
231
231
|
return r === 0 ? t.toLocaleTimeString([], {
|
|
232
232
|
hour: "numeric",
|
|
233
233
|
minute: "2-digit",
|
|
@@ -265,7 +265,7 @@ const Te = $e({
|
|
|
265
265
|
"🍈"
|
|
266
266
|
// Melon
|
|
267
267
|
];
|
|
268
|
-
function
|
|
268
|
+
function js(t) {
|
|
269
269
|
let s = 0;
|
|
270
270
|
for (let n = 0; n < t.length; n++) {
|
|
271
271
|
const r = t.charCodeAt(n);
|
|
@@ -273,18 +273,18 @@ function Gs(t) {
|
|
|
273
273
|
}
|
|
274
274
|
return Math.abs(s);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const n =
|
|
276
|
+
function zs(t) {
|
|
277
|
+
const n = js(t) % Se.length;
|
|
278
278
|
return Se[n];
|
|
279
279
|
}
|
|
280
|
-
const
|
|
280
|
+
const te = ({
|
|
281
281
|
id: t,
|
|
282
282
|
image: s,
|
|
283
283
|
size: n = 40,
|
|
284
284
|
className: r,
|
|
285
285
|
shape: o = "squircle"
|
|
286
286
|
}) => {
|
|
287
|
-
const c =
|
|
287
|
+
const c = zs(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", g = o === "circle" ? { borderRadius: "50%" } : {
|
|
288
288
|
borderRadius: "33%",
|
|
289
289
|
"corner-shape": "superellipse(1.3)"
|
|
290
290
|
};
|
|
@@ -327,18 +327,18 @@ const ne = ({
|
|
|
327
327
|
var h, v;
|
|
328
328
|
return ((h = m.user) == null ? void 0 : h.id) && m.user.id !== ((v = t == null ? void 0 : t._client) == null ? void 0 : v.userID);
|
|
329
329
|
}
|
|
330
|
-
), x = ((E = g == null ? void 0 : g.user) == null ? void 0 : E.name) || "Conversation", w = (I = g == null ? void 0 : g.user) == null ? void 0 : I.image, f = (C = (_ = t == null ? void 0 : t.state) == null ? void 0 : _.messages) == null ? void 0 : C[t.state.messages.length - 1],
|
|
330
|
+
), x = ((E = g == null ? void 0 : g.user) == null ? void 0 : E.name) || "Conversation", w = (I = g == null ? void 0 : g.user) == null ? void 0 : I.image, f = (C = (_ = t == null ? void 0 : t.state) == null ? void 0 : _.messages) == null ? void 0 : C[t.state.messages.length - 1], R = (() => {
|
|
331
331
|
var h;
|
|
332
332
|
if (f != null && f.text) return f.text;
|
|
333
333
|
const m = (h = f == null ? void 0 : f.attachments) == null ? void 0 : h[0];
|
|
334
334
|
return m ? m.og_scrape_url ? m.og_scrape_url : m.type === "image" ? "📷 Sent an image" : m.type === "video" ? "🎥 Sent a video" : m.type === "audio" ? "🎵 Sent audio" : m.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
|
|
335
|
-
})(),
|
|
335
|
+
})(), y = f != null && f.created_at ? $s(new Date(f.created_at)) : "", d = o ?? 0;
|
|
336
336
|
return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
337
337
|
channelId: t == null ? void 0 : t.id,
|
|
338
338
|
isSelected: c,
|
|
339
339
|
participantName: x,
|
|
340
340
|
unreadCount: d,
|
|
341
|
-
hasTimestamp: !!
|
|
341
|
+
hasTimestamp: !!y
|
|
342
342
|
}), /* @__PURE__ */ e(
|
|
343
343
|
"button",
|
|
344
344
|
{
|
|
@@ -353,7 +353,7 @@ const ne = ({
|
|
|
353
353
|
),
|
|
354
354
|
children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
355
355
|
/* @__PURE__ */ e(
|
|
356
|
-
|
|
356
|
+
te,
|
|
357
357
|
{
|
|
358
358
|
id: ((M = g == null ? void 0 : g.user) == null ? void 0 : M.id) || t.id || "unknown",
|
|
359
359
|
name: x,
|
|
@@ -374,10 +374,10 @@ const ne = ({
|
|
|
374
374
|
children: x
|
|
375
375
|
}
|
|
376
376
|
),
|
|
377
|
-
|
|
377
|
+
y && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: y })
|
|
378
378
|
] }),
|
|
379
379
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
380
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children:
|
|
380
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: R }),
|
|
381
381
|
d > 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: d > 99 ? "99+" : d })
|
|
382
382
|
] })
|
|
383
383
|
] })
|
|
@@ -397,7 +397,7 @@ const Fe = P.memo(
|
|
|
397
397
|
}) => {
|
|
398
398
|
const c = P.useRef(0);
|
|
399
399
|
c.current++;
|
|
400
|
-
const { debug: a = !1 } =
|
|
400
|
+
const { debug: a = !1 } = he();
|
|
401
401
|
a && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
402
402
|
renderCount: c.current,
|
|
403
403
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
@@ -435,7 +435,7 @@ const Fe = P.memo(
|
|
|
435
435
|
}
|
|
436
436
|
);
|
|
437
437
|
Fe.displayName = "ChannelList";
|
|
438
|
-
const
|
|
438
|
+
const ce = ({
|
|
439
439
|
variant: t = "default",
|
|
440
440
|
className: s,
|
|
441
441
|
children: n,
|
|
@@ -474,33 +474,33 @@ function Le({ label: t, className: s, children: n, ...r }) {
|
|
|
474
474
|
}
|
|
475
475
|
);
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function Pe({ onClick: t }) {
|
|
478
478
|
return /* @__PURE__ */ e(Le, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(be, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
479
479
|
}
|
|
480
|
-
const
|
|
480
|
+
const Gs = (t) => /* @__PURE__ */ e(Ve, { ...t, position: "center" }), Hs = () => /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 10 10", fill: "none", children: /* @__PURE__ */ e(
|
|
481
481
|
"path",
|
|
482
482
|
{
|
|
483
483
|
d: "M10.003 5a.705.705 0 0 1-.469.67L6.7 6.7 5.67 9.535a.715.715 0 0 1-1.34 0L3.3 6.7.466 5.67a.715.715 0 0 1 0-1.34L3.3 3.3 4.33.466a.715.715 0 0 1 1.34 0L6.7 3.3l2.834 1.03a.705.705 0 0 1 .469.67",
|
|
484
484
|
fill: "currentColor"
|
|
485
485
|
}
|
|
486
|
-
) }),
|
|
486
|
+
) }), Vs = (t) => {
|
|
487
487
|
var s;
|
|
488
488
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
|
|
489
|
-
},
|
|
489
|
+
}, Ws = (t) => {
|
|
490
490
|
var s;
|
|
491
491
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
|
|
492
|
-
},
|
|
492
|
+
}, Zs = (t) => {
|
|
493
493
|
var s;
|
|
494
494
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
|
|
495
|
-
},
|
|
495
|
+
}, Oe = (t) => Vs(t) || Ws(t), qs = (t) => {
|
|
496
496
|
var s;
|
|
497
|
-
return
|
|
497
|
+
return Oe(t) && !((s = t.text) != null && s.trim());
|
|
498
498
|
}, Me = ({
|
|
499
499
|
message: t,
|
|
500
500
|
standalone: s = !1
|
|
501
501
|
}) => {
|
|
502
502
|
var o;
|
|
503
|
-
const n =
|
|
503
|
+
const n = Oe(t), r = Zs(t);
|
|
504
504
|
if (!n && !r)
|
|
505
505
|
return null;
|
|
506
506
|
if (n) {
|
|
@@ -508,16 +508,16 @@ const Vs = (t) => /* @__PURE__ */ e(Ve, { ...t, position: "center" }), Ws = () =
|
|
|
508
508
|
if (!c) return null;
|
|
509
509
|
const a = s ? "message-tip-standalone" : "message-tag message-tag--tip", u = s ? `${c} tip` : `Delivered with ${c} tip`;
|
|
510
510
|
return /* @__PURE__ */ i("div", { className: a, children: [
|
|
511
|
-
/* @__PURE__ */ e(
|
|
511
|
+
/* @__PURE__ */ e(Fs, { size: s ? 14 : 12 }),
|
|
512
512
|
/* @__PURE__ */ e("span", { children: u })
|
|
513
513
|
] });
|
|
514
514
|
}
|
|
515
515
|
return /* @__PURE__ */ i("div", { className: "message-tag message-tag--chatbot", children: [
|
|
516
|
-
/* @__PURE__ */ e("span", { className: "message-tag__icon", style: { marginTop: -1 }, children: /* @__PURE__ */ e(
|
|
516
|
+
/* @__PURE__ */ e("span", { className: "message-tag__icon", style: { marginTop: -1 }, children: /* @__PURE__ */ e(Hs, {}) }),
|
|
517
517
|
/* @__PURE__ */ e("span", { className: "message-tag__label", children: "Chatbot" })
|
|
518
518
|
] });
|
|
519
|
-
},
|
|
520
|
-
var
|
|
519
|
+
}, Ys = (t) => {
|
|
520
|
+
var X, b;
|
|
521
521
|
const {
|
|
522
522
|
additionalMessageInputProps: s,
|
|
523
523
|
editing: n,
|
|
@@ -531,61 +531,58 @@ const Vs = (t) => /* @__PURE__ */ e(Ve, { ...t, position: "center" }), Ws = () =
|
|
|
531
531
|
isMessageAIGenerated: w,
|
|
532
532
|
isMyMessage: f,
|
|
533
533
|
message: l,
|
|
534
|
-
onUserClick:
|
|
535
|
-
onUserHover:
|
|
534
|
+
onUserClick: R,
|
|
535
|
+
onUserHover: y,
|
|
536
536
|
renderText: d,
|
|
537
537
|
threadList: N
|
|
538
|
-
} = t, { client: E } = Ze("CustomMessage"), { t: I } = qe("CustomMessage"), [_, C] =
|
|
538
|
+
} = t, { client: E } = Ze("CustomMessage"), { t: I } = qe("CustomMessage"), [_, C] = p(!1), [M, m] = p(!1), h = Ye(l.id), {
|
|
539
539
|
Attachment: v = Qe,
|
|
540
|
-
Avatar:
|
|
540
|
+
Avatar: G = Xe,
|
|
541
541
|
EditMessageModal: A = Ke,
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
StreamedMessageText: F = cs,
|
|
554
|
-
PinIndicator: B
|
|
555
|
-
} = Je("CustomMessage"), H = ds(l), Q = ms(l), X = we(
|
|
542
|
+
MessageBlocked: Z = es,
|
|
543
|
+
MessageBouncePrompt: Y = ss,
|
|
544
|
+
MessageDeleted: ne = ts,
|
|
545
|
+
MessageIsThreadReplyInChannelButtonIndicator: K = ns,
|
|
546
|
+
MessageRepliesCountButton: ee = rs,
|
|
547
|
+
MessageStatus: re = as,
|
|
548
|
+
MessageTimestamp: O = ke,
|
|
549
|
+
ReminderNotification: H = ls,
|
|
550
|
+
StreamedMessageText: J = os,
|
|
551
|
+
PinIndicator: z
|
|
552
|
+
} = Je("CustomMessage"), k = is(l), D = cs(l), U = we(
|
|
556
553
|
() => w == null ? void 0 : w(l),
|
|
557
554
|
[w, l]
|
|
558
555
|
), $ = we(
|
|
559
556
|
() => !l.shared_location && !l.attachments ? [] : l.shared_location ? [l.shared_location, ...l.attachments ?? []] : l.attachments,
|
|
560
557
|
[l]
|
|
561
558
|
);
|
|
562
|
-
if (
|
|
559
|
+
if (ds(l))
|
|
563
560
|
return null;
|
|
564
561
|
if (l.deleted_at || l.type === "deleted")
|
|
565
|
-
return /* @__PURE__ */ e(
|
|
566
|
-
if (
|
|
567
|
-
return /* @__PURE__ */ e(
|
|
568
|
-
const
|
|
569
|
-
let
|
|
570
|
-
|
|
571
|
-
const
|
|
562
|
+
return /* @__PURE__ */ e(ne, { message: l });
|
|
563
|
+
if (ms(l))
|
|
564
|
+
return /* @__PURE__ */ e(Z, {});
|
|
565
|
+
const se = !c || r, Q = !N && !!l.reply_count, V = !N && l.show_in_channel && l.parent_id, le = l.status === "failed" && ((X = l.error) == null ? void 0 : X.status) !== 403, oe = us(l), ae = hs(l) && !U;
|
|
566
|
+
let j;
|
|
567
|
+
le ? j = () => g(l) : oe ? j = () => C(!0) : ae && (j = () => m((L) => !L));
|
|
568
|
+
const fe = S(
|
|
572
569
|
"str-chat__message str-chat__message-simple",
|
|
573
570
|
`str-chat__message--${l.type}`,
|
|
574
571
|
`str-chat__message--${l.status}`,
|
|
575
572
|
f() ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
576
573
|
l.text ? "str-chat__message--has-text" : "has-no-text",
|
|
577
574
|
{
|
|
578
|
-
"str-chat__message--has-attachment":
|
|
575
|
+
"str-chat__message--has-attachment": k,
|
|
579
576
|
"str-chat__message--highlighted": x,
|
|
580
577
|
"str-chat__message--pinned pinned-message": l.pinned,
|
|
581
|
-
"str-chat__message--with-reactions":
|
|
582
|
-
"str-chat__message-send-can-be-retried": (l == null ? void 0 : l.status) === "failed" && ((
|
|
583
|
-
"str-chat__message-with-thread-link":
|
|
578
|
+
"str-chat__message--with-reactions": D,
|
|
579
|
+
"str-chat__message-send-can-be-retried": (l == null ? void 0 : l.status) === "failed" && ((b = l == null ? void 0 : l.error) == null ? void 0 : b.status) !== 403,
|
|
580
|
+
"str-chat__message-with-thread-link": Q || V,
|
|
584
581
|
"str-chat__virtual-message__wrapper--end": r,
|
|
585
582
|
"str-chat__virtual-message__wrapper--first": o,
|
|
586
583
|
"str-chat__virtual-message__wrapper--group": c
|
|
587
584
|
}
|
|
588
|
-
),
|
|
585
|
+
), ie = l.poll_id && E.polls.fromState(l.poll_id), ge = qs(l);
|
|
589
586
|
return /* @__PURE__ */ i(Ne, { children: [
|
|
590
587
|
n && /* @__PURE__ */ e(
|
|
591
588
|
A,
|
|
@@ -594,95 +591,91 @@ const Vs = (t) => /* @__PURE__ */ e(Ve, { ...t, position: "center" }), Ws = () =
|
|
|
594
591
|
}
|
|
595
592
|
),
|
|
596
593
|
_ && /* @__PURE__ */ e(
|
|
597
|
-
|
|
594
|
+
fs,
|
|
598
595
|
{
|
|
599
|
-
MessageBouncePrompt:
|
|
596
|
+
MessageBouncePrompt: Y,
|
|
600
597
|
onClose: () => C(!1),
|
|
601
598
|
open: _
|
|
602
599
|
}
|
|
603
600
|
),
|
|
604
|
-
/* @__PURE__ */ i("div", { className:
|
|
605
|
-
|
|
606
|
-
!!h && /* @__PURE__ */ e(
|
|
601
|
+
/* @__PURE__ */ i("div", { className: fe, children: [
|
|
602
|
+
z && /* @__PURE__ */ e(z, {}),
|
|
603
|
+
!!h && /* @__PURE__ */ e(H, { reminder: h }),
|
|
607
604
|
l.user && /* @__PURE__ */ e(
|
|
608
|
-
|
|
605
|
+
G,
|
|
609
606
|
{
|
|
610
607
|
image: l.user.image,
|
|
611
608
|
name: l.user.name || l.user.id,
|
|
612
|
-
onClick:
|
|
613
|
-
onMouseOver:
|
|
609
|
+
onClick: R,
|
|
610
|
+
onMouseOver: y,
|
|
614
611
|
user: l.user
|
|
615
612
|
}
|
|
616
613
|
),
|
|
617
|
-
/* @__PURE__ */
|
|
614
|
+
/* @__PURE__ */ e(
|
|
618
615
|
"div",
|
|
619
616
|
{
|
|
620
617
|
className: S("str-chat__message-inner", {
|
|
621
|
-
"str-chat__simple-message--error-failed":
|
|
618
|
+
"str-chat__simple-message--error-failed": le || oe
|
|
622
619
|
}),
|
|
623
620
|
"data-testid": "message-inner",
|
|
624
|
-
onClick:
|
|
625
|
-
onKeyDown:
|
|
626
|
-
role:
|
|
627
|
-
tabIndex:
|
|
628
|
-
children:
|
|
629
|
-
/*
|
|
630
|
-
/* @__PURE__ */ e(
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
/* @__PURE__ */ e(
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
] }),
|
|
653
|
-
/* @__PURE__ */ e(Me, { message: l })
|
|
654
|
-
] })
|
|
655
|
-
]
|
|
621
|
+
onClick: j,
|
|
622
|
+
onKeyDown: j,
|
|
623
|
+
role: j ? "button" : void 0,
|
|
624
|
+
tabIndex: j ? 0 : void 0,
|
|
625
|
+
children: ge ? (
|
|
626
|
+
/* Tip-only messages render as a standalone bubble */
|
|
627
|
+
/* @__PURE__ */ e(Me, { message: l, standalone: !0 })
|
|
628
|
+
) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
629
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
630
|
+
ie && /* @__PURE__ */ e(gs, { poll: ie }),
|
|
631
|
+
$ != null && $.length && !l.quoted_message ? /* @__PURE__ */ e(
|
|
632
|
+
v,
|
|
633
|
+
{
|
|
634
|
+
actionHandler: a,
|
|
635
|
+
attachments: $
|
|
636
|
+
}
|
|
637
|
+
) : null,
|
|
638
|
+
U ? /* @__PURE__ */ e(
|
|
639
|
+
J,
|
|
640
|
+
{
|
|
641
|
+
message: l,
|
|
642
|
+
renderText: d
|
|
643
|
+
}
|
|
644
|
+
) : /* @__PURE__ */ e(xs, { message: l, renderText: d }),
|
|
645
|
+
/* @__PURE__ */ e(Cs, {})
|
|
646
|
+
] }),
|
|
647
|
+
/* @__PURE__ */ e(Me, { message: l })
|
|
648
|
+
] })
|
|
656
649
|
}
|
|
657
650
|
),
|
|
658
|
-
|
|
659
|
-
|
|
651
|
+
Q && /* @__PURE__ */ e(
|
|
652
|
+
ee,
|
|
660
653
|
{
|
|
661
654
|
onClick: u,
|
|
662
655
|
reply_count: l.reply_count
|
|
663
656
|
}
|
|
664
657
|
),
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
/* @__PURE__ */ e(
|
|
658
|
+
V && /* @__PURE__ */ e(K, {}),
|
|
659
|
+
se && /* @__PURE__ */ i("div", { className: "str-chat__message-metadata", children: [
|
|
660
|
+
/* @__PURE__ */ e(re, {}),
|
|
668
661
|
!f() && !!l.user && /* @__PURE__ */ e("span", { className: "str-chat__message-simple-name", children: l.user.name || l.user.id }),
|
|
669
|
-
/* @__PURE__ */ e(
|
|
670
|
-
|
|
671
|
-
|
|
662
|
+
/* @__PURE__ */ e(O, { customClass: "str-chat__message-simple-timestamp" }),
|
|
663
|
+
ae && /* @__PURE__ */ e("span", { className: "str-chat__mesage-simple-edited", children: I("Edited") }),
|
|
664
|
+
ae && /* @__PURE__ */ e(Ns, { calendar: !0, open: M })
|
|
672
665
|
] })
|
|
673
666
|
] }, l.id)
|
|
674
667
|
] });
|
|
675
|
-
},
|
|
676
|
-
|
|
668
|
+
}, Js = P.memo(
|
|
669
|
+
Ys,
|
|
677
670
|
We
|
|
678
|
-
),
|
|
679
|
-
const s =
|
|
680
|
-
return /* @__PURE__ */ e(
|
|
681
|
-
},
|
|
671
|
+
), Qs = (t) => {
|
|
672
|
+
const s = bs("CustomMessage");
|
|
673
|
+
return /* @__PURE__ */ e(Js, { ...s, ...t });
|
|
674
|
+
}, Xs = (t) => ({
|
|
682
675
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
683
676
|
(s) => _e.previewIsLoaded(s) || _e.previewIsLoading(s)
|
|
684
677
|
)
|
|
685
|
-
}),
|
|
678
|
+
}), Ks = ({
|
|
686
679
|
link: t,
|
|
687
680
|
onDismiss: s
|
|
688
681
|
}) => {
|
|
@@ -722,32 +715,32 @@ const Vs = (t) => /* @__PURE__ */ e(Ve, { ...t, position: "center" }), Ws = () =
|
|
|
722
715
|
]
|
|
723
716
|
}
|
|
724
717
|
);
|
|
725
|
-
},
|
|
726
|
-
const { linkPreviewsManager: t } =
|
|
718
|
+
}, et = () => {
|
|
719
|
+
const { linkPreviewsManager: t } = vs(), { linkPreviews: s } = ws(
|
|
727
720
|
t.state,
|
|
728
|
-
|
|
721
|
+
Xs
|
|
729
722
|
), n = (o) => {
|
|
730
723
|
t.dismissPreview(o);
|
|
731
724
|
};
|
|
732
725
|
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ e(
|
|
733
|
-
|
|
726
|
+
Ks,
|
|
734
727
|
{
|
|
735
728
|
link: o,
|
|
736
729
|
onDismiss: n
|
|
737
730
|
},
|
|
738
731
|
o.og_scrape_url
|
|
739
732
|
)) }) : null;
|
|
740
|
-
},
|
|
741
|
-
const { handleSubmit: t } =
|
|
733
|
+
}, st = () => {
|
|
734
|
+
const { handleSubmit: t } = ps(), s = Es();
|
|
742
735
|
return /* @__PURE__ */ i(Ne, { children: [
|
|
743
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
736
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Is, {}) }),
|
|
744
737
|
/* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] 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: [
|
|
745
|
-
/* @__PURE__ */ e(
|
|
746
|
-
/* @__PURE__ */ e(
|
|
747
|
-
/* @__PURE__ */ e(
|
|
738
|
+
/* @__PURE__ */ e(_s, {}),
|
|
739
|
+
/* @__PURE__ */ e(et, {}),
|
|
740
|
+
/* @__PURE__ */ e(Ss, {}),
|
|
748
741
|
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
749
742
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
750
|
-
|
|
743
|
+
Ms,
|
|
751
744
|
{
|
|
752
745
|
className: "w-full resize-none outline-none leading-6",
|
|
753
746
|
autoFocus: !0,
|
|
@@ -763,18 +756,18 @@ const Vs = (t) => /* @__PURE__ */ e(Ve, { ...t, position: "center" }), Ws = () =
|
|
|
763
756
|
disabled: !s,
|
|
764
757
|
onClick: t,
|
|
765
758
|
type: "button",
|
|
766
|
-
children: /* @__PURE__ */ e(
|
|
759
|
+
children: /* @__PURE__ */ e(Ls, { className: "size-4" })
|
|
767
760
|
}
|
|
768
761
|
)
|
|
769
762
|
] })
|
|
770
763
|
] })
|
|
771
764
|
] });
|
|
772
|
-
},
|
|
765
|
+
}, tt = ({
|
|
773
766
|
renderActions: t
|
|
774
767
|
}) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
775
768
|
t && (t == null ? void 0 : t()),
|
|
776
|
-
/* @__PURE__ */ e(
|
|
777
|
-
] }),
|
|
769
|
+
/* @__PURE__ */ e(ys, { Input: st })
|
|
770
|
+
] }), nt = (t) => {
|
|
778
771
|
const s = t.message.hide_date === !0;
|
|
779
772
|
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
780
773
|
/* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
|
|
@@ -784,7 +777,7 @@ const Vs = (t) => /* @__PURE__ */ e(Ve, { ...t, position: "center" }), Ws = () =
|
|
|
784
777
|
] }),
|
|
785
778
|
!s && /* @__PURE__ */ e(ke, { message: t.message })
|
|
786
779
|
] });
|
|
787
|
-
},
|
|
780
|
+
}, rt = () => null, at = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
788
781
|
"div",
|
|
789
782
|
{
|
|
790
783
|
className: S("flex items-center justify-center h-full", t),
|
|
@@ -827,17 +820,17 @@ const Vs = (t) => /* @__PURE__ */ e(Ve, { ...t, position: "center" }), Ws = () =
|
|
|
827
820
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
828
821
|
]
|
|
829
822
|
}
|
|
830
|
-
),
|
|
831
|
-
/* @__PURE__ */ e(
|
|
823
|
+
), ue = P.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
824
|
+
/* @__PURE__ */ e(at, { className: "w-6 h-6" }),
|
|
832
825
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
833
826
|
] }) }));
|
|
834
|
-
|
|
835
|
-
const
|
|
827
|
+
ue.displayName = "LoadingState";
|
|
828
|
+
const lt = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
836
829
|
var g, x, w, f, l;
|
|
837
830
|
const { channel: o } = Re(), c = P.useMemo(() => Object.values(o.state.members || {}).find(
|
|
838
|
-
(
|
|
831
|
+
(y) => {
|
|
839
832
|
var d;
|
|
840
|
-
return ((d =
|
|
833
|
+
return ((d = y.user) == null ? void 0 : d.id) && y.user.id !== o._client.userID;
|
|
841
834
|
}
|
|
842
835
|
), [o._client.userID, o.state.members]), a = ((g = c == null ? void 0 : c.user) == null ? void 0 : g.name) || ((x = c == null ? void 0 : c.user) == null ? void 0 : x.id) || "Unknown member", u = (w = c == null ? void 0 : c.user) == null ? void 0 : w.image;
|
|
843
836
|
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
@@ -853,12 +846,12 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
853
846
|
}),
|
|
854
847
|
type: "button",
|
|
855
848
|
"aria-label": "Back to conversations",
|
|
856
|
-
children: /* @__PURE__ */ e(
|
|
849
|
+
children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
|
|
857
850
|
}
|
|
858
851
|
),
|
|
859
852
|
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
860
853
|
/* @__PURE__ */ e(
|
|
861
|
-
|
|
854
|
+
te,
|
|
862
855
|
{
|
|
863
856
|
id: ((f = c == null ? void 0 : c.user) == null ? void 0 : f.id) || o.id || "unknown",
|
|
864
857
|
name: a,
|
|
@@ -877,7 +870,7 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
877
870
|
onClick: n,
|
|
878
871
|
type: "button",
|
|
879
872
|
"aria-label": "Show info",
|
|
880
|
-
children: /* @__PURE__ */ e(
|
|
873
|
+
children: /* @__PURE__ */ e(pe, { className: "size-5 text-black/90" })
|
|
881
874
|
}
|
|
882
875
|
)
|
|
883
876
|
] }),
|
|
@@ -890,11 +883,11 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
890
883
|
onClick: t,
|
|
891
884
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
892
885
|
"aria-label": "Back to conversations",
|
|
893
|
-
children: /* @__PURE__ */ e(
|
|
886
|
+
children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
|
|
894
887
|
}
|
|
895
888
|
),
|
|
896
889
|
/* @__PURE__ */ e(
|
|
897
|
-
|
|
890
|
+
te,
|
|
898
891
|
{
|
|
899
892
|
id: ((l = c == null ? void 0 : c.user) == null ? void 0 : l.id) || o.id || "unknown",
|
|
900
893
|
name: a,
|
|
@@ -911,12 +904,12 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
911
904
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
912
905
|
),
|
|
913
906
|
onClick: n,
|
|
914
|
-
children: /* @__PURE__ */ e(
|
|
907
|
+
children: /* @__PURE__ */ e(pe, { className: "size-5 text-black/90" })
|
|
915
908
|
}
|
|
916
909
|
)
|
|
917
910
|
] })
|
|
918
911
|
] });
|
|
919
|
-
},
|
|
912
|
+
}, ot = ({
|
|
920
913
|
dialogRef: t,
|
|
921
914
|
onClose: s,
|
|
922
915
|
participant: n,
|
|
@@ -929,25 +922,25 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
929
922
|
onBlockParticipantClick: x,
|
|
930
923
|
onReportParticipantClick: w
|
|
931
924
|
}) => {
|
|
932
|
-
var
|
|
933
|
-
const { service: f, debug: l } =
|
|
925
|
+
var K, ee, re, O, H, J, z;
|
|
926
|
+
const { service: f, debug: l } = he(), [R, y] = p(!1), [d, N] = p(!1), [E, I] = p(!1), _ = T(async () => {
|
|
934
927
|
var k;
|
|
935
928
|
if (!(!f || !((k = n == null ? void 0 : n.user) != null && k.id)))
|
|
936
929
|
try {
|
|
937
|
-
const
|
|
938
|
-
(
|
|
939
|
-
var
|
|
940
|
-
return
|
|
930
|
+
const U = (await f.getBlockedUsers()).some(
|
|
931
|
+
($) => {
|
|
932
|
+
var se;
|
|
933
|
+
return $.blocked_user_id === ((se = n == null ? void 0 : n.user) == null ? void 0 : se.id);
|
|
941
934
|
}
|
|
942
935
|
);
|
|
943
|
-
|
|
944
|
-
} catch (
|
|
936
|
+
y(U);
|
|
937
|
+
} catch (D) {
|
|
945
938
|
console.error(
|
|
946
939
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
947
|
-
|
|
940
|
+
D
|
|
948
941
|
);
|
|
949
942
|
}
|
|
950
|
-
}, [f, (
|
|
943
|
+
}, [f, (K = n == null ? void 0 : n.user) == null ? void 0 : K.id]);
|
|
951
944
|
q(() => {
|
|
952
945
|
_();
|
|
953
946
|
}, [_]);
|
|
@@ -956,34 +949,34 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
956
949
|
if (!d) {
|
|
957
950
|
g == null || g(), l && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
|
|
958
951
|
try {
|
|
959
|
-
const
|
|
960
|
-
await r.hide(
|
|
961
|
-
} catch (
|
|
962
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
952
|
+
const D = ((k = r._client) == null ? void 0 : k.userID) ?? null;
|
|
953
|
+
await r.hide(D, !1), c && await c(r), s();
|
|
954
|
+
} catch (D) {
|
|
955
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", D);
|
|
963
956
|
} finally {
|
|
964
957
|
N(!1);
|
|
965
958
|
}
|
|
966
959
|
}
|
|
967
960
|
}, M = async () => {
|
|
968
|
-
var k,
|
|
961
|
+
var k, D, U;
|
|
969
962
|
if (!(E || !f)) {
|
|
970
963
|
x == null || x(), l && console.log("[ChannelInfoDialog] Block member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), I(!0);
|
|
971
964
|
try {
|
|
972
|
-
await f.blockUser((
|
|
973
|
-
} catch (
|
|
974
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
965
|
+
await f.blockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), a && await a((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
966
|
+
} catch ($) {
|
|
967
|
+
console.error("[ChannelInfoDialog] Failed to block member", $);
|
|
975
968
|
} finally {
|
|
976
969
|
I(!1);
|
|
977
970
|
}
|
|
978
971
|
}
|
|
979
972
|
}, m = async () => {
|
|
980
|
-
var k,
|
|
973
|
+
var k, D, U;
|
|
981
974
|
if (!(E || !f)) {
|
|
982
975
|
x == null || x(), l && console.log("[ChannelInfoDialog] Unblock member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), I(!0);
|
|
983
976
|
try {
|
|
984
|
-
await f.unBlockUser((
|
|
985
|
-
} catch (
|
|
986
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
977
|
+
await f.unBlockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), a && await a((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
978
|
+
} catch ($) {
|
|
979
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", $);
|
|
987
980
|
} finally {
|
|
988
981
|
I(!1);
|
|
989
982
|
}
|
|
@@ -996,7 +989,7 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
996
989
|
);
|
|
997
990
|
};
|
|
998
991
|
if (!n) return null;
|
|
999
|
-
const v = ((
|
|
992
|
+
const v = ((ee = n.user) == null ? void 0 : ee.name) || ((re = n.user) == null ? void 0 : re.id) || "Unknown member", G = (O = n.user) == null ? void 0 : O.image, A = (H = n.user) == null ? void 0 : H.email, Z = (J = n.user) == null ? void 0 : J.username, Y = A || (Z ? `linktr.ee/${Z}` : void 0), ne = ((z = n.user) == null ? void 0 : z.id) || "unknown";
|
|
1000
993
|
return (
|
|
1001
994
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1002
995
|
/* @__PURE__ */ e(
|
|
@@ -1011,7 +1004,7 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1011
1004
|
children: /* @__PURE__ */ i("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
|
|
1012
1005
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
1013
1006
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
1014
|
-
/* @__PURE__ */ e(
|
|
1007
|
+
/* @__PURE__ */ e(Pe, { onClick: s })
|
|
1015
1008
|
] }),
|
|
1016
1009
|
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
1017
1010
|
/* @__PURE__ */ e(
|
|
@@ -1021,11 +1014,11 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1021
1014
|
style: { backgroundColor: "#FBFAF9" },
|
|
1022
1015
|
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
1023
1016
|
/* @__PURE__ */ e(
|
|
1024
|
-
|
|
1017
|
+
te,
|
|
1025
1018
|
{
|
|
1026
|
-
id:
|
|
1019
|
+
id: ne,
|
|
1027
1020
|
name: v,
|
|
1028
|
-
image:
|
|
1021
|
+
image: G,
|
|
1029
1022
|
size: 88,
|
|
1030
1023
|
shape: "circle"
|
|
1031
1024
|
}
|
|
@@ -1053,42 +1046,42 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1053
1046
|
),
|
|
1054
1047
|
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
1055
1048
|
u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1056
|
-
|
|
1049
|
+
ce,
|
|
1057
1050
|
{
|
|
1058
1051
|
onClick: C,
|
|
1059
1052
|
disabled: d,
|
|
1060
1053
|
"aria-busy": d,
|
|
1061
1054
|
children: [
|
|
1062
|
-
d ? /* @__PURE__ */ e(
|
|
1055
|
+
d ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ps, { className: "h-5 w-5" }),
|
|
1063
1056
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
1064
1057
|
]
|
|
1065
1058
|
}
|
|
1066
1059
|
) }),
|
|
1067
|
-
/* @__PURE__ */ e("li", { children:
|
|
1068
|
-
|
|
1060
|
+
/* @__PURE__ */ e("li", { children: R ? /* @__PURE__ */ i(
|
|
1061
|
+
ce,
|
|
1069
1062
|
{
|
|
1070
1063
|
onClick: m,
|
|
1071
1064
|
disabled: E,
|
|
1072
1065
|
"aria-busy": E,
|
|
1073
1066
|
children: [
|
|
1074
|
-
E ? /* @__PURE__ */ e(
|
|
1067
|
+
E ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ee, { className: "h-5 w-5" }),
|
|
1075
1068
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
1076
1069
|
]
|
|
1077
1070
|
}
|
|
1078
1071
|
) : /* @__PURE__ */ i(
|
|
1079
|
-
|
|
1072
|
+
ce,
|
|
1080
1073
|
{
|
|
1081
1074
|
onClick: M,
|
|
1082
1075
|
disabled: E,
|
|
1083
1076
|
"aria-busy": E,
|
|
1084
1077
|
children: [
|
|
1085
|
-
E ? /* @__PURE__ */ e(
|
|
1078
|
+
E ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ee, { className: "h-5 w-5" }),
|
|
1086
1079
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
1087
1080
|
]
|
|
1088
1081
|
}
|
|
1089
1082
|
) }),
|
|
1090
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1091
|
-
/* @__PURE__ */ e(
|
|
1083
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ce, { variant: "danger", onClick: h, children: [
|
|
1084
|
+
/* @__PURE__ */ e(Os, { className: "h-5 w-5" }),
|
|
1092
1085
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
1093
1086
|
] }) })
|
|
1094
1087
|
] })
|
|
@@ -1097,7 +1090,7 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1097
1090
|
}
|
|
1098
1091
|
)
|
|
1099
1092
|
);
|
|
1100
|
-
},
|
|
1093
|
+
}, it = ({
|
|
1101
1094
|
onBack: t,
|
|
1102
1095
|
showBackButton: s,
|
|
1103
1096
|
renderMessageInputActions: n,
|
|
@@ -1119,32 +1112,32 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1119
1112
|
return String(d.followerStatus);
|
|
1120
1113
|
if (d.isFollower !== void 0)
|
|
1121
1114
|
return d.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1122
|
-
}, [x.data]),
|
|
1115
|
+
}, [x.data]), R = T(() => {
|
|
1123
1116
|
var d;
|
|
1124
1117
|
(d = w.current) == null || d.showModal();
|
|
1125
|
-
}, []),
|
|
1118
|
+
}, []), y = T(() => {
|
|
1126
1119
|
var d;
|
|
1127
1120
|
(d = w.current) == null || d.close();
|
|
1128
1121
|
}, []);
|
|
1129
1122
|
return /* @__PURE__ */ i(Ne, { children: [
|
|
1130
1123
|
/* @__PURE__ */ e(
|
|
1131
|
-
|
|
1124
|
+
Rs,
|
|
1132
1125
|
{
|
|
1133
1126
|
overrides: {
|
|
1134
|
-
Message: (d) => /* @__PURE__ */ e(
|
|
1127
|
+
Message: (d) => /* @__PURE__ */ e(Qs, { ...d })
|
|
1135
1128
|
},
|
|
1136
|
-
children: /* @__PURE__ */ i(
|
|
1129
|
+
children: /* @__PURE__ */ i(Ts, { children: [
|
|
1137
1130
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
1138
|
-
|
|
1131
|
+
lt,
|
|
1139
1132
|
{
|
|
1140
1133
|
onBack: t,
|
|
1141
1134
|
showBackButton: s,
|
|
1142
|
-
onShowInfo:
|
|
1135
|
+
onShowInfo: R,
|
|
1143
1136
|
canShowInfo: !!f
|
|
1144
1137
|
}
|
|
1145
1138
|
) }),
|
|
1146
1139
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1147
|
-
|
|
1140
|
+
Ds,
|
|
1148
1141
|
{
|
|
1149
1142
|
hideDeletedMessages: !0,
|
|
1150
1143
|
hideNewMessageSeparator: !1,
|
|
@@ -1152,7 +1145,7 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1152
1145
|
}
|
|
1153
1146
|
) }),
|
|
1154
1147
|
/* @__PURE__ */ e(
|
|
1155
|
-
|
|
1148
|
+
tt,
|
|
1156
1149
|
{
|
|
1157
1150
|
renderActions: () => n == null ? void 0 : n(x)
|
|
1158
1151
|
}
|
|
@@ -1161,10 +1154,10 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1161
1154
|
}
|
|
1162
1155
|
),
|
|
1163
1156
|
/* @__PURE__ */ e(
|
|
1164
|
-
|
|
1157
|
+
ot,
|
|
1165
1158
|
{
|
|
1166
1159
|
dialogRef: w,
|
|
1167
|
-
onClose:
|
|
1160
|
+
onClose: y,
|
|
1168
1161
|
participant: f,
|
|
1169
1162
|
channel: x,
|
|
1170
1163
|
followerStatusLabel: l,
|
|
@@ -1186,7 +1179,7 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1186
1179
|
onLeaveConversation: o,
|
|
1187
1180
|
onBlockParticipant: c,
|
|
1188
1181
|
className: a,
|
|
1189
|
-
CustomChannelEmptyState: u =
|
|
1182
|
+
CustomChannelEmptyState: u = rt,
|
|
1190
1183
|
showDeleteConversation: g = !0,
|
|
1191
1184
|
onDeleteConversationClick: x,
|
|
1192
1185
|
onBlockParticipantClick: w,
|
|
@@ -1199,15 +1192,15 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1199
1192
|
a
|
|
1200
1193
|
),
|
|
1201
1194
|
children: /* @__PURE__ */ e(
|
|
1202
|
-
|
|
1195
|
+
ks,
|
|
1203
1196
|
{
|
|
1204
1197
|
channel: t,
|
|
1205
|
-
MessageSystem:
|
|
1198
|
+
MessageSystem: nt,
|
|
1206
1199
|
EmptyStateIndicator: u,
|
|
1207
|
-
LoadingIndicator:
|
|
1208
|
-
DateSeparator:
|
|
1200
|
+
LoadingIndicator: ue,
|
|
1201
|
+
DateSeparator: Gs,
|
|
1209
1202
|
children: /* @__PURE__ */ e(
|
|
1210
|
-
|
|
1203
|
+
it,
|
|
1211
1204
|
{
|
|
1212
1205
|
onBack: s,
|
|
1213
1206
|
showBackButton: n,
|
|
@@ -1227,7 +1220,7 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1227
1220
|
)
|
|
1228
1221
|
);
|
|
1229
1222
|
Ue.displayName = "ChannelView";
|
|
1230
|
-
function
|
|
1223
|
+
function ct({
|
|
1231
1224
|
searchQuery: t,
|
|
1232
1225
|
setSearchQuery: s,
|
|
1233
1226
|
placeholder: n
|
|
@@ -1235,7 +1228,7 @@ function mt({
|
|
|
1235
1228
|
const r = W(null);
|
|
1236
1229
|
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1237
1230
|
/* @__PURE__ */ e(
|
|
1238
|
-
|
|
1231
|
+
Us,
|
|
1239
1232
|
{
|
|
1240
1233
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1241
1234
|
weight: "bold"
|
|
@@ -1266,7 +1259,7 @@ function mt({
|
|
|
1266
1259
|
)
|
|
1267
1260
|
] });
|
|
1268
1261
|
}
|
|
1269
|
-
const
|
|
1262
|
+
const dt = ({
|
|
1270
1263
|
participantSource: t,
|
|
1271
1264
|
onSelectParticipant: s,
|
|
1272
1265
|
onClose: n,
|
|
@@ -1275,7 +1268,7 @@ const ut = ({
|
|
|
1275
1268
|
searchPlaceholder: c = "Search participants...",
|
|
1276
1269
|
className: a
|
|
1277
1270
|
}) => {
|
|
1278
|
-
const { debug: u } =
|
|
1271
|
+
const { debug: u } = he(), [g, x] = p(""), [w, f] = p([]), [l, R] = p(!1), [y, d] = p(null), [N, E] = p(
|
|
1279
1272
|
null
|
|
1280
1273
|
), I = W(!1);
|
|
1281
1274
|
q(() => {
|
|
@@ -1287,7 +1280,7 @@ const ut = ({
|
|
|
1287
1280
|
}
|
|
1288
1281
|
if (I.current) return;
|
|
1289
1282
|
(async () => {
|
|
1290
|
-
u && console.log("[ParticipantPicker] Loading initial participants..."),
|
|
1283
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), R(!0), d(null);
|
|
1291
1284
|
try {
|
|
1292
1285
|
const h = await t.loadParticipants({
|
|
1293
1286
|
search: "",
|
|
@@ -1302,7 +1295,7 @@ const ut = ({
|
|
|
1302
1295
|
const v = h instanceof Error ? h.message : "Failed to load participants";
|
|
1303
1296
|
d(v), console.error("[ParticipantPicker] Failed to load participants:", h);
|
|
1304
1297
|
} finally {
|
|
1305
|
-
|
|
1298
|
+
R(!1);
|
|
1306
1299
|
}
|
|
1307
1300
|
})();
|
|
1308
1301
|
}, [t.loading, u]);
|
|
@@ -1311,7 +1304,7 @@ const ut = ({
|
|
|
1311
1304
|
if (!g) return !0;
|
|
1312
1305
|
const h = g.toLowerCase();
|
|
1313
1306
|
return m.name.toLowerCase().includes(h) || ((v = m.email) == null ? void 0 : v.toLowerCase().includes(h)) || !1;
|
|
1314
|
-
}), C =
|
|
1307
|
+
}), C = T(
|
|
1315
1308
|
async (m) => {
|
|
1316
1309
|
if (!N) {
|
|
1317
1310
|
E(m.id);
|
|
@@ -1330,7 +1323,7 @@ const ut = ({
|
|
|
1330
1323
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1331
1324
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1332
1325
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1333
|
-
/* @__PURE__ */ e(
|
|
1326
|
+
/* @__PURE__ */ e(Pe, { onClick: n })
|
|
1334
1327
|
] }),
|
|
1335
1328
|
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1336
1329
|
"Select a ",
|
|
@@ -1341,7 +1334,7 @@ const ut = ({
|
|
|
1341
1334
|
t.totalCount !== void 0 && ` • ${t.totalCount} ${o} total`
|
|
1342
1335
|
] }),
|
|
1343
1336
|
/* @__PURE__ */ e(
|
|
1344
|
-
|
|
1337
|
+
ct,
|
|
1345
1338
|
{
|
|
1346
1339
|
searchQuery: g,
|
|
1347
1340
|
setSearchQuery: x,
|
|
@@ -1349,11 +1342,11 @@ const ut = ({
|
|
|
1349
1342
|
}
|
|
1350
1343
|
)
|
|
1351
1344
|
] }),
|
|
1352
|
-
|
|
1345
|
+
y && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1353
1346
|
"Error loading ",
|
|
1354
1347
|
o,
|
|
1355
1348
|
": ",
|
|
1356
|
-
|
|
1349
|
+
y
|
|
1357
1350
|
] }),
|
|
1358
1351
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: l && _.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1359
1352
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
@@ -1374,12 +1367,12 @@ const ut = ({
|
|
|
1374
1367
|
{
|
|
1375
1368
|
type: "button",
|
|
1376
1369
|
onClick: () => C(m),
|
|
1377
|
-
onKeyDown: (
|
|
1370
|
+
onKeyDown: (G) => M(G, m),
|
|
1378
1371
|
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",
|
|
1379
1372
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1380
1373
|
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1381
1374
|
/* @__PURE__ */ e(
|
|
1382
|
-
|
|
1375
|
+
te,
|
|
1383
1376
|
{
|
|
1384
1377
|
id: m.id,
|
|
1385
1378
|
name: h,
|
|
@@ -1392,7 +1385,7 @@ const ut = ({
|
|
|
1392
1385
|
v && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: v })
|
|
1393
1386
|
] })
|
|
1394
1387
|
] }),
|
|
1395
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === m.id ? /* @__PURE__ */ e(
|
|
1388
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === m.id ? /* @__PURE__ */ e(de, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ie, { className: "h-5 w-5 text-stone" }) })
|
|
1396
1389
|
] })
|
|
1397
1390
|
}
|
|
1398
1391
|
) }, m.id);
|
|
@@ -1403,7 +1396,7 @@ const ut = ({
|
|
|
1403
1396
|
] }) })
|
|
1404
1397
|
] }) })
|
|
1405
1398
|
] });
|
|
1406
|
-
},
|
|
1399
|
+
}, mt = ({ className: t }) => /* @__PURE__ */ i(
|
|
1407
1400
|
"svg",
|
|
1408
1401
|
{
|
|
1409
1402
|
width: "140",
|
|
@@ -1539,7 +1532,7 @@ const ut = ({
|
|
|
1539
1532
|
}
|
|
1540
1533
|
), Be = P.memo(
|
|
1541
1534
|
({ 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: [
|
|
1542
|
-
/* @__PURE__ */ e(
|
|
1535
|
+
/* @__PURE__ */ e(mt, {}),
|
|
1543
1536
|
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1544
1537
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1545
1538
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
@@ -1547,7 +1540,7 @@ const ut = ({
|
|
|
1547
1540
|
] }) })
|
|
1548
1541
|
);
|
|
1549
1542
|
Be.displayName = "EmptyState";
|
|
1550
|
-
const
|
|
1543
|
+
const me = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
|
|
1551
1544
|
/* @__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: "⚠️" }) }),
|
|
1552
1545
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1553
1546
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1561,8 +1554,8 @@ const he = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1561
1554
|
}
|
|
1562
1555
|
)
|
|
1563
1556
|
] }) }));
|
|
1564
|
-
|
|
1565
|
-
const
|
|
1557
|
+
me.displayName = "ErrorState";
|
|
1558
|
+
const wt = ({
|
|
1566
1559
|
capabilities: t = {},
|
|
1567
1560
|
className: s,
|
|
1568
1561
|
renderMessageInputActions: n,
|
|
@@ -1576,21 +1569,21 @@ const yt = ({
|
|
|
1576
1569
|
channelListCustomEmptyStateIndicator: w,
|
|
1577
1570
|
onDeleteConversationClick: f,
|
|
1578
1571
|
onBlockParticipantClick: l,
|
|
1579
|
-
onReportParticipantClick:
|
|
1572
|
+
onReportParticipantClick: R
|
|
1580
1573
|
}) => {
|
|
1581
1574
|
const {
|
|
1582
|
-
service:
|
|
1575
|
+
service: y,
|
|
1583
1576
|
client: d,
|
|
1584
1577
|
isConnected: N,
|
|
1585
1578
|
isLoading: E,
|
|
1586
1579
|
error: I,
|
|
1587
1580
|
refreshConnection: _,
|
|
1588
1581
|
debug: C
|
|
1589
|
-
} =
|
|
1590
|
-
participantSource:
|
|
1591
|
-
participantLabel:
|
|
1592
|
-
showDeleteConversation:
|
|
1593
|
-
} = t,
|
|
1582
|
+
} = Bs(), [M, m] = p(null), [h, v] = p(!1), [G, A] = p(!1), [Z, Y] = p(!1), [ne, K] = p(/* @__PURE__ */ new Set()), [ee, re] = p(0), [O, H] = p(!1), [J, z] = p(null), k = W(null), {
|
|
1583
|
+
participantSource: D,
|
|
1584
|
+
participantLabel: U = "participants",
|
|
1585
|
+
showDeleteConversation: $ = !0
|
|
1586
|
+
} = t, se = P.useMemo(() => {
|
|
1594
1587
|
const b = d == null ? void 0 : d.userID;
|
|
1595
1588
|
return {
|
|
1596
1589
|
...{
|
|
@@ -1603,82 +1596,82 @@ const yt = ({
|
|
|
1603
1596
|
},
|
|
1604
1597
|
...x
|
|
1605
1598
|
};
|
|
1606
|
-
}, [x, d == null ? void 0 : d.userID]),
|
|
1599
|
+
}, [x, d == null ? void 0 : d.userID]), Q = W(null), V = T(async () => {
|
|
1607
1600
|
if (!d || !N) return;
|
|
1608
1601
|
const b = d.userID;
|
|
1609
1602
|
if (b)
|
|
1610
1603
|
try {
|
|
1611
1604
|
C && console.log("[MessagingShell] Syncing channels for user:", b);
|
|
1612
|
-
const
|
|
1605
|
+
const L = await d.queryChannels(
|
|
1613
1606
|
{
|
|
1614
1607
|
type: "messaging",
|
|
1615
1608
|
members: { $in: [b] }
|
|
1616
1609
|
},
|
|
1617
1610
|
{},
|
|
1618
1611
|
{ limit: 100 }
|
|
1619
|
-
),
|
|
1620
|
-
|
|
1621
|
-
const
|
|
1622
|
-
Object.values(
|
|
1612
|
+
), F = /* @__PURE__ */ new Set();
|
|
1613
|
+
L.forEach((B) => {
|
|
1614
|
+
const xe = B.state.members;
|
|
1615
|
+
Object.values(xe).forEach((Ae) => {
|
|
1623
1616
|
var ve;
|
|
1624
1617
|
const Ce = (ve = Ae.user) == null ? void 0 : ve.id;
|
|
1625
|
-
Ce && Ce !== b &&
|
|
1618
|
+
Ce && Ce !== b && F.add(Ce);
|
|
1626
1619
|
});
|
|
1627
|
-
}),
|
|
1628
|
-
channelCount:
|
|
1629
|
-
memberCount:
|
|
1620
|
+
}), K((B) => B.size === F.size && [...B].every((xe) => F.has(xe)) ? B : F), v(L.length > 0), A(!0), Q.current = b, C && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1621
|
+
channelCount: L.length,
|
|
1622
|
+
memberCount: F.size
|
|
1630
1623
|
});
|
|
1631
|
-
} catch (
|
|
1632
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1624
|
+
} catch (L) {
|
|
1625
|
+
console.error("[MessagingShell] Failed to sync channels:", L);
|
|
1633
1626
|
}
|
|
1634
1627
|
}, [d, N, C]);
|
|
1635
1628
|
q(() => {
|
|
1636
1629
|
if (!d || !N) return;
|
|
1637
1630
|
const b = d.userID;
|
|
1638
|
-
b &&
|
|
1639
|
-
}, [d, N,
|
|
1631
|
+
b && Q.current !== b && V();
|
|
1632
|
+
}, [d, N, V]), q(() => {
|
|
1640
1633
|
if (!c || !d || !N) return;
|
|
1641
1634
|
(async () => {
|
|
1642
|
-
const
|
|
1643
|
-
if (
|
|
1635
|
+
const L = d.userID;
|
|
1636
|
+
if (L)
|
|
1644
1637
|
try {
|
|
1645
1638
|
C && console.log(
|
|
1646
1639
|
"[MessagingShell] Loading initial conversation with:",
|
|
1647
1640
|
c
|
|
1648
1641
|
);
|
|
1649
|
-
const
|
|
1642
|
+
const F = await d.queryChannels(
|
|
1650
1643
|
{
|
|
1651
1644
|
type: "messaging",
|
|
1652
|
-
members: { $eq: [
|
|
1645
|
+
members: { $eq: [L, c] }
|
|
1653
1646
|
},
|
|
1654
1647
|
{},
|
|
1655
1648
|
{ limit: 1 }
|
|
1656
1649
|
);
|
|
1657
|
-
if (
|
|
1658
|
-
m(
|
|
1650
|
+
if (F.length > 0)
|
|
1651
|
+
m(F[0]), H(!0), z(null), r && r(F[0]), C && console.log(
|
|
1659
1652
|
"[MessagingShell] Initial conversation loaded:",
|
|
1660
|
-
|
|
1653
|
+
F[0].id
|
|
1661
1654
|
);
|
|
1662
|
-
else if (a &&
|
|
1655
|
+
else if (a && y) {
|
|
1663
1656
|
C && console.log(
|
|
1664
1657
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1665
1658
|
a
|
|
1666
1659
|
);
|
|
1667
1660
|
try {
|
|
1668
|
-
const
|
|
1661
|
+
const B = await y.startChannelWithParticipant({
|
|
1669
1662
|
id: a.id,
|
|
1670
1663
|
name: a.name,
|
|
1671
1664
|
email: a.email,
|
|
1672
1665
|
phone: a.phone
|
|
1673
1666
|
});
|
|
1674
|
-
m(
|
|
1667
|
+
m(B), H(!0), z(null), r && r(B), C && console.log(
|
|
1675
1668
|
"[MessagingShell] Channel created and loaded:",
|
|
1676
|
-
|
|
1669
|
+
B.id
|
|
1677
1670
|
);
|
|
1678
|
-
} catch (
|
|
1671
|
+
} catch (B) {
|
|
1679
1672
|
console.error(
|
|
1680
1673
|
"[MessagingShell] Failed to create conversation:",
|
|
1681
|
-
|
|
1674
|
+
B
|
|
1682
1675
|
), z("Failed to create conversation");
|
|
1683
1676
|
}
|
|
1684
1677
|
} else
|
|
@@ -1688,10 +1681,10 @@ const yt = ({
|
|
|
1688
1681
|
"[MessagingShell] No conversation found for:",
|
|
1689
1682
|
c
|
|
1690
1683
|
);
|
|
1691
|
-
} catch (
|
|
1684
|
+
} catch (F) {
|
|
1692
1685
|
console.error(
|
|
1693
1686
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1694
|
-
|
|
1687
|
+
F
|
|
1695
1688
|
), z("Failed to load conversation");
|
|
1696
1689
|
}
|
|
1697
1690
|
})();
|
|
@@ -1700,69 +1693,69 @@ const yt = ({
|
|
|
1700
1693
|
a,
|
|
1701
1694
|
d,
|
|
1702
1695
|
N,
|
|
1703
|
-
|
|
1696
|
+
y,
|
|
1704
1697
|
C,
|
|
1705
1698
|
r
|
|
1706
1699
|
]);
|
|
1707
|
-
const
|
|
1700
|
+
const le = T(
|
|
1708
1701
|
(b) => {
|
|
1709
1702
|
m(b), r == null || r(b);
|
|
1710
1703
|
},
|
|
1711
1704
|
[r]
|
|
1712
|
-
),
|
|
1713
|
-
|
|
1714
|
-
}, [
|
|
1705
|
+
), oe = T(() => {
|
|
1706
|
+
O || m(null);
|
|
1707
|
+
}, [O]), ae = T(
|
|
1715
1708
|
async (b) => {
|
|
1716
|
-
var
|
|
1717
|
-
if (
|
|
1709
|
+
var L;
|
|
1710
|
+
if (y)
|
|
1718
1711
|
try {
|
|
1719
1712
|
C && console.log(
|
|
1720
1713
|
"[MessagingShell] Starting conversation with:",
|
|
1721
1714
|
b.id
|
|
1722
1715
|
);
|
|
1723
|
-
const
|
|
1716
|
+
const F = await y.startChannelWithParticipant({
|
|
1724
1717
|
id: b.id,
|
|
1725
1718
|
name: b.name,
|
|
1726
1719
|
email: b.email,
|
|
1727
1720
|
phone: b.phone
|
|
1728
1721
|
});
|
|
1729
1722
|
try {
|
|
1730
|
-
await
|
|
1731
|
-
} catch (
|
|
1732
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1723
|
+
await F.show();
|
|
1724
|
+
} catch (B) {
|
|
1725
|
+
console.warn("[MessagingShell] Failed to unhide channel:", B);
|
|
1733
1726
|
}
|
|
1734
|
-
m(
|
|
1735
|
-
} catch (
|
|
1736
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1727
|
+
m(F), Y(!1), (L = k.current) == null || L.close(), o == null || o(b);
|
|
1728
|
+
} catch (F) {
|
|
1729
|
+
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
1737
1730
|
}
|
|
1738
1731
|
},
|
|
1739
|
-
[
|
|
1740
|
-
),
|
|
1732
|
+
[y, o, C]
|
|
1733
|
+
), j = T(() => {
|
|
1741
1734
|
var b;
|
|
1742
1735
|
Y(!1), (b = k.current) == null || b.close();
|
|
1743
|
-
}, []),
|
|
1736
|
+
}, []), fe = T(
|
|
1744
1737
|
(b) => {
|
|
1745
|
-
b.target === k.current &&
|
|
1738
|
+
b.target === k.current && j();
|
|
1746
1739
|
},
|
|
1747
|
-
[
|
|
1748
|
-
),
|
|
1740
|
+
[j]
|
|
1741
|
+
), ie = T(
|
|
1749
1742
|
async (b) => {
|
|
1750
|
-
C && console.log("[MessagingShell] Leaving conversation:", b.id), m(null),
|
|
1743
|
+
C && console.log("[MessagingShell] Leaving conversation:", b.id), m(null), H(!1), Q.current = null, await V();
|
|
1751
1744
|
},
|
|
1752
|
-
[
|
|
1753
|
-
),
|
|
1745
|
+
[V, C]
|
|
1746
|
+
), ge = T(
|
|
1754
1747
|
async (b) => {
|
|
1755
|
-
C && console.log("[MessagingShell] Blocking participant:", b), m(null),
|
|
1748
|
+
C && console.log("[MessagingShell] Blocking participant:", b), m(null), H(!1), Q.current = null, await V();
|
|
1756
1749
|
},
|
|
1757
|
-
[
|
|
1758
|
-
),
|
|
1759
|
-
return E ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(
|
|
1760
|
-
|
|
1750
|
+
[V, C]
|
|
1751
|
+
), X = !!M;
|
|
1752
|
+
return E ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(ue, {}) }) : I ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(me, { message: I, onBack: _ }) }) : !N || !d ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(
|
|
1753
|
+
me,
|
|
1761
1754
|
{
|
|
1762
1755
|
message: "Not connected to messaging service",
|
|
1763
1756
|
onBack: _
|
|
1764
1757
|
}
|
|
1765
|
-
) }) : J ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(
|
|
1758
|
+
) }) : J ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(me, { message: J }) }) : /* @__PURE__ */ i(
|
|
1766
1759
|
"div",
|
|
1767
1760
|
{
|
|
1768
1761
|
className: S(
|
|
@@ -1777,19 +1770,19 @@ const yt = ({
|
|
|
1777
1770
|
className: S(
|
|
1778
1771
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1779
1772
|
{
|
|
1780
|
-
"!hidden": g === !1 ||
|
|
1773
|
+
"!hidden": g === !1 || O,
|
|
1781
1774
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
1782
|
-
"hidden lg:flex lg:flex-1 lg:max-w-2xl": g !== !1 && !
|
|
1775
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": g !== !1 && !O && X,
|
|
1783
1776
|
// Show on mobile when no channel selected, use same wide width on desktop
|
|
1784
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": g !== !1 && !
|
|
1777
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": g !== !1 && !O && !X
|
|
1785
1778
|
}
|
|
1786
1779
|
),
|
|
1787
1780
|
children: /* @__PURE__ */ e(
|
|
1788
1781
|
Fe,
|
|
1789
1782
|
{
|
|
1790
|
-
onChannelSelect:
|
|
1783
|
+
onChannelSelect: le,
|
|
1791
1784
|
selectedChannel: M || void 0,
|
|
1792
|
-
filters:
|
|
1785
|
+
filters: se,
|
|
1793
1786
|
customEmptyStateIndicator: w
|
|
1794
1787
|
}
|
|
1795
1788
|
)
|
|
@@ -1802,66 +1795,66 @@ const yt = ({
|
|
|
1802
1795
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1803
1796
|
{
|
|
1804
1797
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1805
|
-
flex:
|
|
1798
|
+
flex: O || X || c,
|
|
1806
1799
|
// Normal mode: hide on mobile when no channel selected
|
|
1807
|
-
"hidden lg:flex": !
|
|
1800
|
+
"hidden lg:flex": !O && !X && !c
|
|
1808
1801
|
}
|
|
1809
1802
|
),
|
|
1810
1803
|
children: M ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1811
1804
|
Ue,
|
|
1812
1805
|
{
|
|
1813
1806
|
channel: M,
|
|
1814
|
-
onBack:
|
|
1815
|
-
showBackButton: !
|
|
1807
|
+
onBack: oe,
|
|
1808
|
+
showBackButton: !O,
|
|
1816
1809
|
renderMessageInputActions: n,
|
|
1817
|
-
onLeaveConversation:
|
|
1818
|
-
onBlockParticipant:
|
|
1810
|
+
onLeaveConversation: ie,
|
|
1811
|
+
onBlockParticipant: ge,
|
|
1819
1812
|
CustomChannelEmptyState: u,
|
|
1820
|
-
showDeleteConversation:
|
|
1813
|
+
showDeleteConversation: $,
|
|
1821
1814
|
onDeleteConversationClick: f,
|
|
1822
1815
|
onBlockParticipantClick: l,
|
|
1823
|
-
onReportParticipantClick:
|
|
1816
|
+
onReportParticipantClick: R
|
|
1824
1817
|
},
|
|
1825
1818
|
M.id
|
|
1826
1819
|
) }) : c ? (
|
|
1827
1820
|
// Show loading while creating/loading direct conversation channel
|
|
1828
|
-
/* @__PURE__ */ e(
|
|
1821
|
+
/* @__PURE__ */ e(ue, {})
|
|
1829
1822
|
) : /* @__PURE__ */ e(
|
|
1830
1823
|
Be,
|
|
1831
1824
|
{
|
|
1832
1825
|
hasChannels: h,
|
|
1833
|
-
channelsLoaded:
|
|
1826
|
+
channelsLoaded: G
|
|
1834
1827
|
}
|
|
1835
1828
|
)
|
|
1836
1829
|
}
|
|
1837
1830
|
)
|
|
1838
1831
|
] }),
|
|
1839
|
-
|
|
1832
|
+
D && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1840
1833
|
/* @__PURE__ */ e(
|
|
1841
1834
|
"dialog",
|
|
1842
1835
|
{
|
|
1843
1836
|
ref: k,
|
|
1844
1837
|
className: "mes-dialog",
|
|
1845
|
-
onClick:
|
|
1846
|
-
onClose:
|
|
1838
|
+
onClick: fe,
|
|
1839
|
+
onClose: j,
|
|
1847
1840
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1848
|
-
|
|
1841
|
+
dt,
|
|
1849
1842
|
{
|
|
1850
|
-
participantSource:
|
|
1851
|
-
onSelectParticipant:
|
|
1852
|
-
onClose:
|
|
1853
|
-
existingParticipantIds:
|
|
1854
|
-
participantLabel:
|
|
1855
|
-
searchPlaceholder: `Search ${
|
|
1843
|
+
participantSource: D,
|
|
1844
|
+
onSelectParticipant: ae,
|
|
1845
|
+
onClose: j,
|
|
1846
|
+
existingParticipantIds: ne,
|
|
1847
|
+
participantLabel: U,
|
|
1848
|
+
searchPlaceholder: `Search ${U}...`
|
|
1856
1849
|
},
|
|
1857
|
-
|
|
1850
|
+
ee
|
|
1858
1851
|
) })
|
|
1859
1852
|
}
|
|
1860
1853
|
)
|
|
1861
1854
|
]
|
|
1862
1855
|
}
|
|
1863
1856
|
);
|
|
1864
|
-
},
|
|
1857
|
+
}, ut = ({
|
|
1865
1858
|
question: t,
|
|
1866
1859
|
onClick: s,
|
|
1867
1860
|
loading: n = !1,
|
|
@@ -1883,7 +1876,7 @@ const yt = ({
|
|
|
1883
1876
|
),
|
|
1884
1877
|
children: t
|
|
1885
1878
|
}
|
|
1886
|
-
),
|
|
1879
|
+
), yt = ({
|
|
1887
1880
|
faqs: t,
|
|
1888
1881
|
onFaqClick: s,
|
|
1889
1882
|
loadingFaqId: n,
|
|
@@ -1895,7 +1888,7 @@ const yt = ({
|
|
|
1895
1888
|
const u = t.filter((g) => g.enabled).sort((g, x) => (g.order ?? 0) - (x.order ?? 0));
|
|
1896
1889
|
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1897
1890
|
(c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1898
|
-
|
|
1891
|
+
te,
|
|
1899
1892
|
{
|
|
1900
1893
|
id: a || "account",
|
|
1901
1894
|
name: a || "Account",
|
|
@@ -1912,7 +1905,7 @@ const yt = ({
|
|
|
1912
1905
|
children: [
|
|
1913
1906
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1914
1907
|
u.map((g) => /* @__PURE__ */ e(
|
|
1915
|
-
|
|
1908
|
+
ut,
|
|
1916
1909
|
{
|
|
1917
1910
|
question: g.question,
|
|
1918
1911
|
onClick: () => s(g.id),
|
|
@@ -1924,8 +1917,8 @@ const yt = ({
|
|
|
1924
1917
|
}
|
|
1925
1918
|
)
|
|
1926
1919
|
] }) });
|
|
1927
|
-
},
|
|
1928
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [o, c] =
|
|
1920
|
+
}, pt = (t, s = {}) => {
|
|
1921
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [o, c] = p([]), [a, u] = p(!1), [g, x] = p(null), [w, f] = p(n), [l, R] = p(!0), [y, d] = p(), N = T(async (C = !1, M) => {
|
|
1929
1922
|
if (a) return;
|
|
1930
1923
|
const m = M !== void 0 ? M : w;
|
|
1931
1924
|
u(!0), x(null);
|
|
@@ -1933,22 +1926,22 @@ const yt = ({
|
|
|
1933
1926
|
const h = await t.loadParticipants({
|
|
1934
1927
|
search: m || void 0,
|
|
1935
1928
|
limit: r,
|
|
1936
|
-
cursor: C ? void 0 :
|
|
1929
|
+
cursor: C ? void 0 : y
|
|
1937
1930
|
});
|
|
1938
1931
|
c(
|
|
1939
1932
|
(v) => C ? h.participants : [...v, ...h.participants]
|
|
1940
|
-
),
|
|
1933
|
+
), R(h.hasMore), d(h.nextCursor);
|
|
1941
1934
|
} catch (h) {
|
|
1942
1935
|
const v = h instanceof Error ? h.message : "Failed to load participants";
|
|
1943
1936
|
x(v), console.error("[useParticipants] Load error:", h);
|
|
1944
1937
|
} finally {
|
|
1945
1938
|
u(!1);
|
|
1946
1939
|
}
|
|
1947
|
-
}, [t, w,
|
|
1940
|
+
}, [t, w, y, r, a]), E = T(() => {
|
|
1948
1941
|
l && !a && N(!1);
|
|
1949
|
-
}, [l, a, N]), I =
|
|
1942
|
+
}, [l, a, N]), I = T((C) => {
|
|
1950
1943
|
f(C), d(void 0), N(!0, C);
|
|
1951
|
-
}, [N]), _ =
|
|
1944
|
+
}, [N]), _ = T(() => {
|
|
1952
1945
|
d(void 0), N(!0);
|
|
1953
1946
|
}, [N]);
|
|
1954
1947
|
return q(() => {
|
|
@@ -1966,17 +1959,17 @@ const yt = ({
|
|
|
1966
1959
|
};
|
|
1967
1960
|
};
|
|
1968
1961
|
export {
|
|
1969
|
-
|
|
1970
|
-
|
|
1962
|
+
te as Avatar,
|
|
1963
|
+
rt as ChannelEmptyState,
|
|
1971
1964
|
Fe as ChannelList,
|
|
1972
1965
|
Ue as ChannelView,
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1966
|
+
yt as FaqList,
|
|
1967
|
+
ut as FaqListItem,
|
|
1968
|
+
vt as MessagingProvider,
|
|
1969
|
+
wt as MessagingShell,
|
|
1970
|
+
dt as ParticipantPicker,
|
|
1971
|
+
$s as formatRelativeTime,
|
|
1972
|
+
Bs as useMessaging,
|
|
1973
|
+
pt as useParticipants
|
|
1981
1974
|
};
|
|
1982
1975
|
//# sourceMappingURL=index.js.map
|