@linktr.ee/messaging-react 1.19.0 โ 1.19.2
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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i, Fragment as he } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import D 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
|
);
|
|
@@ -35,7 +35,7 @@ const Me = We({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(o)
|
|
37
37
|
});
|
|
38
|
-
const [d, x] = S(null), [
|
|
38
|
+
const [d, x] = S(null), [m, C] = S(null), [N, a] = S(!1), [M, I] = S(!1), [_, f] = S(null), p = G(!1), b = G({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: l,
|
|
41
41
|
serviceConfig: n,
|
|
@@ -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 h = 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 = h.current) == null ? void 0 : w.serviceId) === d && ((v = h.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"
|
|
@@ -123,13 +123,13 @@ const Me = We({
|
|
|
123
123
|
r("๐ STARTING USER CONNECTION", { userId: s.id }), p.current = !0, I(!0), f(null);
|
|
124
124
|
try {
|
|
125
125
|
r("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
-
const
|
|
127
|
-
C(
|
|
126
|
+
const T = await d.connectUser(s);
|
|
127
|
+
C(T), a(!0), h.current = { serviceId: d, userId: s.id }, r("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
|
-
clientId:
|
|
129
|
+
clientId: T.userID
|
|
130
130
|
});
|
|
131
|
-
} catch (
|
|
132
|
-
const P =
|
|
131
|
+
} catch (T) {
|
|
132
|
+
const P = T instanceof Error ? T.message : "Connection failed";
|
|
133
133
|
f(P), r("โ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
135
|
error: P
|
|
@@ -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
|
+
), h.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
|
|
@@ -177,14 +177,14 @@ const Me = We({
|
|
|
177
177
|
}
|
|
178
178
|
}, [d, s, r]), g = B.useMemo(() => (r("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!d,
|
|
180
|
-
hasClient: !!
|
|
180
|
+
hasClient: !!m,
|
|
181
181
|
isConnected: N,
|
|
182
182
|
isLoading: M,
|
|
183
183
|
hasError: !!_,
|
|
184
184
|
capabilitiesKeys: Object.keys(o)
|
|
185
185
|
}), {
|
|
186
186
|
service: d,
|
|
187
|
-
client:
|
|
187
|
+
client: m,
|
|
188
188
|
isConnected: N,
|
|
189
189
|
isLoading: M,
|
|
190
190
|
error: _,
|
|
@@ -193,7 +193,7 @@ const Me = We({
|
|
|
193
193
|
debug: c
|
|
194
194
|
}), [
|
|
195
195
|
d,
|
|
196
|
-
|
|
196
|
+
m,
|
|
197
197
|
N,
|
|
198
198
|
M,
|
|
199
199
|
_,
|
|
@@ -204,12 +204,12 @@ const Me = We({
|
|
|
204
204
|
]);
|
|
205
205
|
return r("๐ RENDER END", {
|
|
206
206
|
renderCount: y.current,
|
|
207
|
-
willRenderChat: !!(
|
|
207
|
+
willRenderChat: !!(m && N),
|
|
208
208
|
contextValueReady: !!g
|
|
209
|
-
}), /* @__PURE__ */ e(Me.Provider, { value: g, children:
|
|
209
|
+
}), /* @__PURE__ */ e(Me.Provider, { value: g, children: m && N ? /* @__PURE__ */ e(
|
|
210
210
|
Ye,
|
|
211
211
|
{
|
|
212
|
-
client:
|
|
212
|
+
client: m,
|
|
213
213
|
customClasses: {
|
|
214
214
|
channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
|
|
215
215
|
},
|
|
@@ -291,7 +291,7 @@ const X = ({
|
|
|
291
291
|
return /* @__PURE__ */ e(
|
|
292
292
|
"div",
|
|
293
293
|
{
|
|
294
|
-
className:
|
|
294
|
+
className: D("flex-shrink-0 overflow-hidden", l),
|
|
295
295
|
style: {
|
|
296
296
|
width: `${n}px`,
|
|
297
297
|
height: `${n}px`,
|
|
@@ -308,7 +308,7 @@ const X = ({
|
|
|
308
308
|
"div",
|
|
309
309
|
{
|
|
310
310
|
"aria-hidden": "true",
|
|
311
|
-
className:
|
|
311
|
+
className: D(
|
|
312
312
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
313
313
|
d
|
|
314
314
|
),
|
|
@@ -365,18 +365,18 @@ const X = ({
|
|
|
365
365
|
unread: o,
|
|
366
366
|
renderMessagePreview: c
|
|
367
367
|
}) => {
|
|
368
|
-
var y,
|
|
368
|
+
var y, h, 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
|
+
}, m = Object.values(((y = t == null ? void 0 : t.state) == null ? void 0 : y.members) || {}).find(
|
|
372
372
|
(v) => {
|
|
373
|
-
var
|
|
374
|
-
return ((
|
|
373
|
+
var T, P;
|
|
374
|
+
return ((T = v.user) == null ? void 0 : T.id) && v.user.id !== ((P = t == null ? void 0 : t._client) == null ? void 0 : P.userID);
|
|
375
375
|
}
|
|
376
|
-
), C = ((
|
|
377
|
-
var
|
|
376
|
+
), C = ((h = m == null ? void 0 : m.user) == null ? void 0 : h.name) || "Conversation", N = (k = m == null ? void 0 : m.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
|
+
var T;
|
|
378
378
|
if (a != null && a.text) return a.text;
|
|
379
|
-
const v = (
|
|
379
|
+
const v = (T = a == null ? void 0 : a.attachments) == null ? void 0 : T[0];
|
|
380
380
|
return v ? v.og_scrape_url ? v.og_scrape_url : v.type === "image" ? "๐ท Sent an image" : v.type === "video" ? "๐ฅ Sent a video" : v.type === "audio" ? "๐ต Sent audio" : v.type === "file" ? "๐ Sent a file" : "๐ Sent an attachment" : "No messages yet";
|
|
381
381
|
})(), _ = a != null && a.created_at ? zs(new Date(a.created_at)) : "", f = a ? ke(a) : !1, p = c ? c(a, I) : `${f ? "โจ " : ""}${I}`, b = o ?? 0;
|
|
382
382
|
return l && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
@@ -390,7 +390,7 @@ const X = ({
|
|
|
390
390
|
{
|
|
391
391
|
type: "button",
|
|
392
392
|
onClick: d,
|
|
393
|
-
className:
|
|
393
|
+
className: D(
|
|
394
394
|
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
395
395
|
{
|
|
396
396
|
"bg-primary-alt/10 border-l-4 border-l-primary": r,
|
|
@@ -401,7 +401,7 @@ const X = ({
|
|
|
401
401
|
/* @__PURE__ */ e(
|
|
402
402
|
X,
|
|
403
403
|
{
|
|
404
|
-
id: ((w =
|
|
404
|
+
id: ((w = m == null ? void 0 : m.user) == null ? void 0 : w.id) || t.id || "unknown",
|
|
405
405
|
name: C,
|
|
406
406
|
image: N,
|
|
407
407
|
size: 44,
|
|
@@ -413,7 +413,7 @@ const X = ({
|
|
|
413
413
|
/* @__PURE__ */ e(
|
|
414
414
|
"h3",
|
|
415
415
|
{
|
|
416
|
-
className:
|
|
416
|
+
className: D(
|
|
417
417
|
"text-sm font-medium truncate",
|
|
418
418
|
r ? "text-primary" : "text-charcoal"
|
|
419
419
|
),
|
|
@@ -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
|
] })
|
|
@@ -463,7 +463,7 @@ const Te = B.memo(
|
|
|
463
463
|
return /* @__PURE__ */ e(
|
|
464
464
|
"div",
|
|
465
465
|
{
|
|
466
|
-
className:
|
|
466
|
+
className: D(
|
|
467
467
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
468
468
|
l
|
|
469
469
|
),
|
|
@@ -492,7 +492,7 @@ const le = ({
|
|
|
492
492
|
"button",
|
|
493
493
|
{
|
|
494
494
|
type: "button",
|
|
495
|
-
className:
|
|
495
|
+
className: D(
|
|
496
496
|
"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
|
|
497
497
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
498
498
|
s
|
|
@@ -506,7 +506,7 @@ function Fe({ label: t, className: s, children: n, ...l }) {
|
|
|
506
506
|
"button",
|
|
507
507
|
{
|
|
508
508
|
type: "button",
|
|
509
|
-
className:
|
|
509
|
+
className: D(
|
|
510
510
|
"rounded-full p-2 transition-colors focus-ring",
|
|
511
511
|
{
|
|
512
512
|
"cursor-not-allowed opacity-50": l.disabled,
|
|
@@ -536,7 +536,7 @@ const Ys = (t) => /* @__PURE__ */ e(Qe, { ...t, position: "center" }), Js = (t)
|
|
|
536
536
|
handleAction: r,
|
|
537
537
|
handleOpenThread: d,
|
|
538
538
|
handleRetry: x,
|
|
539
|
-
highlighted:
|
|
539
|
+
highlighted: m,
|
|
540
540
|
isMessageAIGenerated: C,
|
|
541
541
|
isMyMessage: N,
|
|
542
542
|
message: a,
|
|
@@ -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: h = 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
|
-
ReminderNotification:
|
|
553
|
+
ReminderNotification: T = 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,13 +563,13 @@ 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);
|
|
570
|
-
let
|
|
571
|
-
Y ?
|
|
572
|
-
const R =
|
|
570
|
+
let F;
|
|
571
|
+
Y ? F = () => x(a) : J && (F = () => p(!0));
|
|
572
|
+
const R = D(
|
|
573
573
|
"str-chat__message str-chat__message-simple",
|
|
574
574
|
`str-chat__message--${a.type}`,
|
|
575
575
|
`str-chat__message--${a.status}`,
|
|
@@ -577,7 +577,7 @@ const Ys = (t) => /* @__PURE__ */ e(Qe, { ...t, position: "center" }), Js = (t)
|
|
|
577
577
|
a.text ? "str-chat__message--has-text" : "has-no-text",
|
|
578
578
|
{
|
|
579
579
|
"str-chat__message--has-attachment": te,
|
|
580
|
-
"str-chat__message--highlighted":
|
|
580
|
+
"str-chat__message--highlighted": m,
|
|
581
581
|
"str-chat__message--pinned pinned-message": a.pinned,
|
|
582
582
|
"str-chat__message--with-reactions": K,
|
|
583
583
|
"str-chat__message-send-can-be-retried": (a == null ? void 0 : a.status) === "failed" && ((Q = a == null ? void 0 : a.error) == null ? void 0 : Q.status) !== 403,
|
|
@@ -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
|
+
h,
|
|
593
593
|
{
|
|
594
594
|
additionalMessageInputProps: s
|
|
595
595
|
}
|
|
@@ -604,7 +604,7 @@ const Ys = (t) => /* @__PURE__ */ e(Qe, { ...t, position: "center" }), Js = (t)
|
|
|
604
604
|
),
|
|
605
605
|
/* @__PURE__ */ i("div", { className: R, children: [
|
|
606
606
|
q && /* @__PURE__ */ e(q, {}),
|
|
607
|
-
!!b && /* @__PURE__ */ e(
|
|
607
|
+
!!b && /* @__PURE__ */ e(T, { reminder: b }),
|
|
608
608
|
a.user && /* @__PURE__ */ e(
|
|
609
609
|
X,
|
|
610
610
|
{
|
|
@@ -617,14 +617,14 @@ const Ys = (t) => /* @__PURE__ */ e(Qe, { ...t, position: "center" }), Js = (t)
|
|
|
617
617
|
/* @__PURE__ */ e(
|
|
618
618
|
"div",
|
|
619
619
|
{
|
|
620
|
-
className:
|
|
620
|
+
className: D("str-chat__message-inner", {
|
|
621
621
|
"str-chat__simple-message--error-failed": Y || J
|
|
622
622
|
}),
|
|
623
623
|
"data-testid": "message-inner",
|
|
624
|
-
onClick:
|
|
625
|
-
onKeyDown:
|
|
626
|
-
role:
|
|
627
|
-
tabIndex:
|
|
624
|
+
onClick: F,
|
|
625
|
+
onKeyDown: F,
|
|
626
|
+
role: F ? "button" : void 0,
|
|
627
|
+
tabIndex: F ? 0 : void 0,
|
|
628
628
|
style: {
|
|
629
629
|
// Force margins to 0 to prevent hover layout shift
|
|
630
630
|
// Stream Chat CSS sets margin-inline-end/start to 78px, then 0 on hover
|
|
@@ -782,7 +782,7 @@ const Ys = (t) => /* @__PURE__ */ e(Qe, { ...t, position: "center" }), Js = (t)
|
|
|
782
782
|
}, at = () => null, lt = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
783
783
|
"div",
|
|
784
784
|
{
|
|
785
|
-
className:
|
|
785
|
+
className: D("flex items-center justify-center h-full", t),
|
|
786
786
|
children: [
|
|
787
787
|
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
788
788
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
@@ -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 h;
|
|
841
|
+
return ((h = y.user) == null ? void 0 : h.id) && y.user.id !== c._client.userID;
|
|
842
842
|
}
|
|
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, [
|
|
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, [m, C] = S(
|
|
844
844
|
!!((_ = c.state.membership) != null && _.pinned_at)
|
|
845
845
|
);
|
|
846
846
|
H(() => {
|
|
847
847
|
const b = (y) => {
|
|
848
|
-
var
|
|
848
|
+
var h;
|
|
849
849
|
C(
|
|
850
|
-
y != null && y.member ? !!y.member.pinned_at : !!((
|
|
850
|
+
y != null && y.member ? !!y.member.pinned_at : !!((h = c.state.membership) != null && h.pinned_at)
|
|
851
851
|
);
|
|
852
852
|
};
|
|
853
853
|
return c.on("member.updated", b), () => {
|
|
@@ -856,7 +856,7 @@ const ot = ({
|
|
|
856
856
|
}, [c]);
|
|
857
857
|
const N = async () => {
|
|
858
858
|
try {
|
|
859
|
-
|
|
859
|
+
m ? await c.unpin() : await c.pin();
|
|
860
860
|
} catch (b) {
|
|
861
861
|
console.error(
|
|
862
862
|
"[CustomChannelHeader] Failed to update pinned status:",
|
|
@@ -869,7 +869,7 @@ const ot = ({
|
|
|
869
869
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: s && /* @__PURE__ */ e(
|
|
870
870
|
"button",
|
|
871
871
|
{
|
|
872
|
-
className:
|
|
872
|
+
className: D(
|
|
873
873
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
874
874
|
),
|
|
875
875
|
onClick: t || (() => {
|
|
@@ -898,12 +898,15 @@ const ot = ({
|
|
|
898
898
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
899
899
|
onClick: N,
|
|
900
900
|
type: "button",
|
|
901
|
-
"aria-label":
|
|
901
|
+
"aria-label": m ? "Unstar conversation" : "Star conversation",
|
|
902
902
|
children: /* @__PURE__ */ e(
|
|
903
903
|
ve,
|
|
904
904
|
{
|
|
905
|
-
className: "size-5
|
|
906
|
-
|
|
905
|
+
className: D("size-5", {
|
|
906
|
+
"text-yellow-600": m,
|
|
907
|
+
"text-black/90": !m
|
|
908
|
+
}),
|
|
909
|
+
weight: m ? "duotone" : "regular"
|
|
907
910
|
}
|
|
908
911
|
)
|
|
909
912
|
}
|
|
@@ -950,12 +953,15 @@ const ot = ({
|
|
|
950
953
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
951
954
|
onClick: N,
|
|
952
955
|
type: "button",
|
|
953
|
-
"aria-label":
|
|
956
|
+
"aria-label": m ? "Unstar conversation" : "Star conversation",
|
|
954
957
|
children: /* @__PURE__ */ e(
|
|
955
958
|
ve,
|
|
956
959
|
{
|
|
957
|
-
className: "size-5
|
|
958
|
-
|
|
960
|
+
className: D("size-5", {
|
|
961
|
+
"text-yellow-600": m,
|
|
962
|
+
"text-black/90": !m
|
|
963
|
+
}),
|
|
964
|
+
weight: m ? "duotone" : "regular"
|
|
959
965
|
}
|
|
960
966
|
)
|
|
961
967
|
}
|
|
@@ -983,13 +989,13 @@ const ot = ({
|
|
|
983
989
|
onBlockParticipant: r,
|
|
984
990
|
showDeleteConversation: d = !0,
|
|
985
991
|
onDeleteConversationClick: x,
|
|
986
|
-
onBlockParticipantClick:
|
|
992
|
+
onBlockParticipantClick: m,
|
|
987
993
|
onReportParticipantClick: C
|
|
988
994
|
}) => {
|
|
989
995
|
var K, ee, V, W, Z, Y, J;
|
|
990
996
|
const { service: N, debug: a } = de(), [M, I] = S(!1), [_, f] = S(!1), [p, b] = S(!1), y = L(async () => {
|
|
991
|
-
var
|
|
992
|
-
if (!(!N || !((
|
|
997
|
+
var F;
|
|
998
|
+
if (!(!N || !((F = n == null ? void 0 : n.user) != null && F.id)))
|
|
993
999
|
try {
|
|
994
1000
|
const U = (await N.getBlockedUsers()).some(
|
|
995
1001
|
(z) => {
|
|
@@ -1008,12 +1014,12 @@ const ot = ({
|
|
|
1008
1014
|
H(() => {
|
|
1009
1015
|
y();
|
|
1010
1016
|
}, [y]);
|
|
1011
|
-
const
|
|
1012
|
-
var
|
|
1017
|
+
const h = async () => {
|
|
1018
|
+
var F;
|
|
1013
1019
|
if (!_) {
|
|
1014
1020
|
x == null || x(), a && console.log("[ChannelInfoDialog] Leave conversation", l.cid), f(!0);
|
|
1015
1021
|
try {
|
|
1016
|
-
const R = ((
|
|
1022
|
+
const R = ((F = l._client) == null ? void 0 : F.userID) ?? null;
|
|
1017
1023
|
await l.hide(R, !1), c && await c(l), s();
|
|
1018
1024
|
} catch (R) {
|
|
1019
1025
|
console.error("[ChannelInfoDialog] Failed to leave conversation", R);
|
|
@@ -1022,9 +1028,9 @@ const ot = ({
|
|
|
1022
1028
|
}
|
|
1023
1029
|
}
|
|
1024
1030
|
}, k = async () => {
|
|
1025
|
-
var
|
|
1031
|
+
var F, R, U;
|
|
1026
1032
|
if (!(p || !N)) {
|
|
1027
|
-
|
|
1033
|
+
m == null || m(), a && console.log("[ChannelInfoDialog] Block member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), b(!0);
|
|
1028
1034
|
try {
|
|
1029
1035
|
await N.blockUser((R = n == null ? void 0 : n.user) == null ? void 0 : R.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
1030
1036
|
} catch (z) {
|
|
@@ -1034,9 +1040,9 @@ const ot = ({
|
|
|
1034
1040
|
}
|
|
1035
1041
|
}
|
|
1036
1042
|
}, g = async () => {
|
|
1037
|
-
var
|
|
1043
|
+
var F, R, U;
|
|
1038
1044
|
if (!(p || !N)) {
|
|
1039
|
-
|
|
1045
|
+
m == null || m(), a && console.log("[ChannelInfoDialog] Unblock member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), b(!0);
|
|
1040
1046
|
try {
|
|
1041
1047
|
await N.unBlockUser((R = n == null ? void 0 : n.user) == null ? void 0 : R.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
1042
1048
|
} catch (z) {
|
|
@@ -1045,7 +1051,7 @@ const ot = ({
|
|
|
1045
1051
|
b(!1);
|
|
1046
1052
|
}
|
|
1047
1053
|
}
|
|
1048
|
-
},
|
|
1054
|
+
}, u = () => {
|
|
1049
1055
|
C == null || C(), s(), window.open(
|
|
1050
1056
|
"https://linktr.ee/s/about/trust-center/report",
|
|
1051
1057
|
"_blank",
|
|
@@ -1053,7 +1059,7 @@ const ot = ({
|
|
|
1053
1059
|
);
|
|
1054
1060
|
};
|
|
1055
1061
|
if (!n) return null;
|
|
1056
|
-
const w = ((ee = n.user) == null ? void 0 : ee.name) || ((V = n.user) == null ? void 0 : V.id) || "Unknown member", v = (W = n.user) == null ? void 0 : W.image,
|
|
1062
|
+
const w = ((ee = n.user) == null ? void 0 : ee.name) || ((V = n.user) == null ? void 0 : V.id) || "Unknown member", v = (W = n.user) == null ? void 0 : W.image, T = (Z = n.user) == null ? void 0 : Z.email, P = (Y = n.user) == null ? void 0 : Y.username, q = T || (P ? `linktr.ee/${P}` : void 0), te = ((J = n.user) == null ? void 0 : J.id) || "unknown";
|
|
1057
1063
|
return (
|
|
1058
1064
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1059
1065
|
/* @__PURE__ */ e(
|
|
@@ -1062,8 +1068,8 @@ const ot = ({
|
|
|
1062
1068
|
ref: t,
|
|
1063
1069
|
className: "mes-dialog group",
|
|
1064
1070
|
onClose: s,
|
|
1065
|
-
onClick: (
|
|
1066
|
-
|
|
1071
|
+
onClick: (F) => {
|
|
1072
|
+
F.target === t.current && s();
|
|
1067
1073
|
},
|
|
1068
1074
|
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: [
|
|
1069
1075
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
@@ -1112,7 +1118,7 @@ const ot = ({
|
|
|
1112
1118
|
d && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1113
1119
|
le,
|
|
1114
1120
|
{
|
|
1115
|
-
onClick:
|
|
1121
|
+
onClick: h,
|
|
1116
1122
|
disabled: _,
|
|
1117
1123
|
"aria-busy": _,
|
|
1118
1124
|
children: [
|
|
@@ -1144,7 +1150,7 @@ const ot = ({
|
|
|
1144
1150
|
]
|
|
1145
1151
|
}
|
|
1146
1152
|
) }),
|
|
1147
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(le, { variant: "danger", onClick:
|
|
1153
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(le, { variant: "danger", onClick: u, children: [
|
|
1148
1154
|
/* @__PURE__ */ e(Bs, { className: "h-5 w-5" }),
|
|
1149
1155
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
1150
1156
|
] }) })
|
|
@@ -1164,7 +1170,7 @@ const ot = ({
|
|
|
1164
1170
|
onDeleteConversationClick: r,
|
|
1165
1171
|
onBlockParticipantClick: d,
|
|
1166
1172
|
onReportParticipantClick: x,
|
|
1167
|
-
showStarButton:
|
|
1173
|
+
showStarButton: m = !1
|
|
1168
1174
|
}) => {
|
|
1169
1175
|
const { channel: C } = Se(), N = G(null), a = B.useMemo(() => Object.values(C.state.members || {}).find(
|
|
1170
1176
|
(p) => {
|
|
@@ -1199,7 +1205,7 @@ const ot = ({
|
|
|
1199
1205
|
showBackButton: s,
|
|
1200
1206
|
onShowInfo: I,
|
|
1201
1207
|
canShowInfo: !!a,
|
|
1202
|
-
showStarButton:
|
|
1208
|
+
showStarButton: m
|
|
1203
1209
|
}
|
|
1204
1210
|
) }),
|
|
1205
1211
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
@@ -1247,7 +1253,7 @@ const ot = ({
|
|
|
1247
1253
|
className: r,
|
|
1248
1254
|
CustomChannelEmptyState: d = at,
|
|
1249
1255
|
showDeleteConversation: x = !0,
|
|
1250
|
-
onDeleteConversationClick:
|
|
1256
|
+
onDeleteConversationClick: m,
|
|
1251
1257
|
onBlockParticipantClick: C,
|
|
1252
1258
|
onReportParticipantClick: N,
|
|
1253
1259
|
dmAgentEnabled: a,
|
|
@@ -1258,7 +1264,7 @@ const ot = ({
|
|
|
1258
1264
|
const f = L(
|
|
1259
1265
|
async (p, b, y) => {
|
|
1260
1266
|
var v;
|
|
1261
|
-
const
|
|
1267
|
+
const h = ((v = t.data) == null ? void 0 : v.chatbot_paused) === !0, k = a && !h, g = {
|
|
1262
1268
|
...b,
|
|
1263
1269
|
...k && { silent: !0 },
|
|
1264
1270
|
...M && {
|
|
@@ -1267,10 +1273,10 @@ const ot = ({
|
|
|
1267
1273
|
...M
|
|
1268
1274
|
}
|
|
1269
1275
|
}
|
|
1270
|
-
},
|
|
1276
|
+
}, u = {
|
|
1271
1277
|
...y,
|
|
1272
1278
|
...k && { skip_push: !0 }
|
|
1273
|
-
}, w = await t.sendMessage(g,
|
|
1279
|
+
}, w = await t.sendMessage(g, u);
|
|
1274
1280
|
return I == null || I(w), w;
|
|
1275
1281
|
},
|
|
1276
1282
|
[t, a, M, I]
|
|
@@ -1278,7 +1284,7 @@ const ot = ({
|
|
|
1278
1284
|
return /* @__PURE__ */ e(
|
|
1279
1285
|
"div",
|
|
1280
1286
|
{
|
|
1281
|
-
className:
|
|
1287
|
+
className: D(
|
|
1282
1288
|
"messaging-channel-view h-full flex flex-col",
|
|
1283
1289
|
r
|
|
1284
1290
|
),
|
|
@@ -1301,7 +1307,7 @@ const ot = ({
|
|
|
1301
1307
|
onBlockParticipant: c,
|
|
1302
1308
|
CustomChannelEmptyState: d,
|
|
1303
1309
|
showDeleteConversation: x,
|
|
1304
|
-
onDeleteConversationClick:
|
|
1310
|
+
onDeleteConversationClick: m,
|
|
1305
1311
|
onBlockParticipantClick: C,
|
|
1306
1312
|
onReportParticipantClick: N,
|
|
1307
1313
|
showStarButton: _
|
|
@@ -1353,7 +1359,7 @@ function dt({
|
|
|
1353
1359
|
)
|
|
1354
1360
|
] });
|
|
1355
1361
|
}
|
|
1356
|
-
const
|
|
1362
|
+
const ut = ({
|
|
1357
1363
|
participantSource: t,
|
|
1358
1364
|
onSelectParticipant: s,
|
|
1359
1365
|
onClose: n,
|
|
@@ -1362,7 +1368,7 @@ const mt = ({
|
|
|
1362
1368
|
searchPlaceholder: c = "Search participants...",
|
|
1363
1369
|
className: r
|
|
1364
1370
|
}) => {
|
|
1365
|
-
const { debug: d } = de(), [x,
|
|
1371
|
+
const { debug: d } = de(), [x, m] = S(""), [C, N] = S([]), [a, M] = S(!1), [I, _] = S(null), [f, p] = S(
|
|
1366
1372
|
null
|
|
1367
1373
|
), b = G(!1);
|
|
1368
1374
|
H(() => {
|
|
@@ -1376,18 +1382,18 @@ const mt = ({
|
|
|
1376
1382
|
(async () => {
|
|
1377
1383
|
d && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), _(null);
|
|
1378
1384
|
try {
|
|
1379
|
-
const
|
|
1385
|
+
const u = await t.loadParticipants({
|
|
1380
1386
|
search: "",
|
|
1381
1387
|
// Load all participants initially
|
|
1382
1388
|
limit: 100
|
|
1383
1389
|
});
|
|
1384
|
-
N(
|
|
1390
|
+
N(u.participants), b.current = !0, d && console.log(
|
|
1385
1391
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1386
|
-
|
|
1392
|
+
u.participants.length
|
|
1387
1393
|
);
|
|
1388
|
-
} catch (
|
|
1389
|
-
const w =
|
|
1390
|
-
_(w), console.error("[ParticipantPicker] Failed to load participants:",
|
|
1394
|
+
} catch (u) {
|
|
1395
|
+
const w = u instanceof Error ? u.message : "Failed to load participants";
|
|
1396
|
+
_(w), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
1391
1397
|
} finally {
|
|
1392
1398
|
M(!1);
|
|
1393
1399
|
}
|
|
@@ -1396,24 +1402,24 @@ const mt = ({
|
|
|
1396
1402
|
const y = C.filter((g) => !l.has(g.id)).filter((g) => {
|
|
1397
1403
|
var w;
|
|
1398
1404
|
if (!x) return !0;
|
|
1399
|
-
const
|
|
1400
|
-
return g.name.toLowerCase().includes(
|
|
1401
|
-
}),
|
|
1405
|
+
const u = x.toLowerCase();
|
|
1406
|
+
return g.name.toLowerCase().includes(u) || ((w = g.email) == null ? void 0 : w.toLowerCase().includes(u)) || !1;
|
|
1407
|
+
}), h = L(
|
|
1402
1408
|
async (g) => {
|
|
1403
1409
|
if (!f) {
|
|
1404
1410
|
p(g.id);
|
|
1405
1411
|
try {
|
|
1406
1412
|
await s(g);
|
|
1407
|
-
} catch (
|
|
1408
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1413
|
+
} catch (u) {
|
|
1414
|
+
console.error("[ParticipantPicker] Failed to start chat:", u), p(null);
|
|
1409
1415
|
}
|
|
1410
1416
|
}
|
|
1411
1417
|
},
|
|
1412
1418
|
[s, f]
|
|
1413
|
-
), k = (g,
|
|
1414
|
-
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), u
|
|
1419
|
+
), k = (g, u) => {
|
|
1420
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), h(u));
|
|
1415
1421
|
};
|
|
1416
|
-
return /* @__PURE__ */ i("div", { className:
|
|
1422
|
+
return /* @__PURE__ */ i("div", { className: D("flex flex-col h-full", r), children: [
|
|
1417
1423
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1418
1424
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1419
1425
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
@@ -1431,7 +1437,7 @@ const mt = ({
|
|
|
1431
1437
|
dt,
|
|
1432
1438
|
{
|
|
1433
1439
|
searchQuery: x,
|
|
1434
|
-
setSearchQuery:
|
|
1440
|
+
setSearchQuery: m,
|
|
1435
1441
|
placeholder: c
|
|
1436
1442
|
}
|
|
1437
1443
|
)
|
|
@@ -1455,12 +1461,12 @@ const mt = ({
|
|
|
1455
1461
|
/* @__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
1462
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1457
1463
|
y.map((g) => {
|
|
1458
|
-
const
|
|
1464
|
+
const u = g.name || g.email || g.id, w = g.email && g.name ? g.email : g.phone;
|
|
1459
1465
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1460
1466
|
"button",
|
|
1461
1467
|
{
|
|
1462
1468
|
type: "button",
|
|
1463
|
-
onClick: () =>
|
|
1469
|
+
onClick: () => h(g),
|
|
1464
1470
|
onKeyDown: (v) => k(v, g),
|
|
1465
1471
|
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
1472
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
@@ -1469,13 +1475,13 @@ const mt = ({
|
|
|
1469
1475
|
X,
|
|
1470
1476
|
{
|
|
1471
1477
|
id: g.id,
|
|
1472
|
-
name:
|
|
1478
|
+
name: u,
|
|
1473
1479
|
image: g.image,
|
|
1474
1480
|
size: 40
|
|
1475
1481
|
}
|
|
1476
1482
|
),
|
|
1477
1483
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1478
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1484
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
|
|
1479
1485
|
w && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: w })
|
|
1480
1486
|
] })
|
|
1481
1487
|
] }),
|
|
@@ -1490,7 +1496,7 @@ const mt = ({
|
|
|
1490
1496
|
] }) })
|
|
1491
1497
|
] }) })
|
|
1492
1498
|
] });
|
|
1493
|
-
},
|
|
1499
|
+
}, mt = ({ className: t }) => /* @__PURE__ */ i(
|
|
1494
1500
|
"svg",
|
|
1495
1501
|
{
|
|
1496
1502
|
width: "140",
|
|
@@ -1626,7 +1632,7 @@ const mt = ({
|
|
|
1626
1632
|
}
|
|
1627
1633
|
), Oe = B.memo(
|
|
1628
1634
|
({ 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(
|
|
1635
|
+
/* @__PURE__ */ e(mt, {}),
|
|
1630
1636
|
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1631
1637
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1632
1638
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
@@ -1659,7 +1665,7 @@ const yt = ({
|
|
|
1659
1665
|
initialParticipantData: r,
|
|
1660
1666
|
CustomChannelEmptyState: d,
|
|
1661
1667
|
showChannelList: x = !0,
|
|
1662
|
-
filters:
|
|
1668
|
+
filters: m,
|
|
1663
1669
|
channelListCustomEmptyStateIndicator: C,
|
|
1664
1670
|
onDeleteConversationClick: N,
|
|
1665
1671
|
onBlockParticipantClick: a,
|
|
@@ -1672,18 +1678,18 @@ const yt = ({
|
|
|
1672
1678
|
}) => {
|
|
1673
1679
|
const {
|
|
1674
1680
|
service: y,
|
|
1675
|
-
client:
|
|
1681
|
+
client: h,
|
|
1676
1682
|
isConnected: k,
|
|
1677
1683
|
isLoading: g,
|
|
1678
|
-
error:
|
|
1684
|
+
error: u,
|
|
1679
1685
|
refreshConnection: w,
|
|
1680
1686
|
debug: v
|
|
1681
|
-
} = As(), [
|
|
1687
|
+
} = As(), [T, P] = S(null), [q, te] = S(!1), [K, ee] = S(!1), [V, W] = S(!1), [Z, Y] = S(/* @__PURE__ */ new Set()), [J, F] = S(0), [R, U] = S(!1), [z, $] = S(null), Q = G(null), {
|
|
1682
1688
|
participantSource: ge,
|
|
1683
1689
|
participantLabel: xe = "participants",
|
|
1684
1690
|
showDeleteConversation: Ue = !0
|
|
1685
1691
|
} = t, Be = B.useMemo(() => {
|
|
1686
|
-
const E =
|
|
1692
|
+
const E = h == null ? void 0 : h.userID;
|
|
1687
1693
|
return {
|
|
1688
1694
|
...{
|
|
1689
1695
|
type: "messaging",
|
|
@@ -1693,15 +1699,15 @@ const yt = ({
|
|
|
1693
1699
|
hidden: !1
|
|
1694
1700
|
}
|
|
1695
1701
|
},
|
|
1696
|
-
...
|
|
1702
|
+
...m
|
|
1697
1703
|
};
|
|
1698
|
-
}, [
|
|
1699
|
-
if (!
|
|
1700
|
-
const E =
|
|
1704
|
+
}, [m, h == null ? void 0 : h.userID]), ne = G(null), se = L(async () => {
|
|
1705
|
+
if (!h || !k) return;
|
|
1706
|
+
const E = h.userID;
|
|
1701
1707
|
if (E)
|
|
1702
1708
|
try {
|
|
1703
1709
|
v && console.log("[MessagingShell] Syncing channels for user:", E);
|
|
1704
|
-
const A = await
|
|
1710
|
+
const A = await h.queryChannels(
|
|
1705
1711
|
{
|
|
1706
1712
|
type: "messaging",
|
|
1707
1713
|
members: { $in: [E] }
|
|
@@ -1710,35 +1716,35 @@ const yt = ({
|
|
|
1710
1716
|
{ limit: 100 }
|
|
1711
1717
|
), O = /* @__PURE__ */ new Set();
|
|
1712
1718
|
A.forEach((j) => {
|
|
1713
|
-
const
|
|
1714
|
-
Object.values(
|
|
1719
|
+
const ue = j.state.members;
|
|
1720
|
+
Object.values(ue).forEach((Ve) => {
|
|
1715
1721
|
var Ce;
|
|
1716
|
-
const
|
|
1717
|
-
|
|
1722
|
+
const me = (Ce = Ve.user) == null ? void 0 : Ce.id;
|
|
1723
|
+
me && me !== E && O.add(me);
|
|
1718
1724
|
});
|
|
1719
|
-
}), Y((j) => j.size === O.size && [...j].every((
|
|
1725
|
+
}), 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
1726
|
channelCount: A.length,
|
|
1721
1727
|
memberCount: O.size
|
|
1722
1728
|
});
|
|
1723
1729
|
} catch (A) {
|
|
1724
1730
|
console.error("[MessagingShell] Failed to sync channels:", A);
|
|
1725
1731
|
}
|
|
1726
|
-
}, [
|
|
1732
|
+
}, [h, k, v]);
|
|
1727
1733
|
H(() => {
|
|
1728
|
-
if (!
|
|
1729
|
-
const E =
|
|
1734
|
+
if (!h || !k) return;
|
|
1735
|
+
const E = h.userID;
|
|
1730
1736
|
E && ne.current !== E && se();
|
|
1731
|
-
}, [
|
|
1732
|
-
if (!c || !
|
|
1737
|
+
}, [h, k, se]), H(() => {
|
|
1738
|
+
if (!c || !h || !k) return;
|
|
1733
1739
|
(async () => {
|
|
1734
|
-
const A =
|
|
1740
|
+
const A = h.userID;
|
|
1735
1741
|
if (A)
|
|
1736
1742
|
try {
|
|
1737
1743
|
v && console.log(
|
|
1738
1744
|
"[MessagingShell] Loading initial conversation with:",
|
|
1739
1745
|
c
|
|
1740
1746
|
);
|
|
1741
|
-
const O = await
|
|
1747
|
+
const O = await h.queryChannels(
|
|
1742
1748
|
{
|
|
1743
1749
|
type: "messaging",
|
|
1744
1750
|
members: { $eq: [A, c] }
|
|
@@ -1790,7 +1796,7 @@ const yt = ({
|
|
|
1790
1796
|
}, [
|
|
1791
1797
|
c,
|
|
1792
1798
|
r,
|
|
1793
|
-
|
|
1799
|
+
h,
|
|
1794
1800
|
k,
|
|
1795
1801
|
y,
|
|
1796
1802
|
v,
|
|
@@ -1847,17 +1853,17 @@ const yt = ({
|
|
|
1847
1853
|
v && console.log("[MessagingShell] Blocking participant:", E), P(null), U(!1), ne.current = null, await se();
|
|
1848
1854
|
},
|
|
1849
1855
|
[se, v]
|
|
1850
|
-
), ae = !!
|
|
1851
|
-
return g ? /* @__PURE__ */ e("div", { className:
|
|
1856
|
+
), ae = !!T;
|
|
1857
|
+
return g ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(ce, {}) }) : u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(ie, { message: u, onBack: w }) }) : !k || !h ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
|
|
1852
1858
|
ie,
|
|
1853
1859
|
{
|
|
1854
1860
|
message: "Not connected to messaging service",
|
|
1855
1861
|
onBack: w
|
|
1856
1862
|
}
|
|
1857
|
-
) }) : z ? /* @__PURE__ */ e("div", { className:
|
|
1863
|
+
) }) : z ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(ie, { message: z }) }) : /* @__PURE__ */ i(
|
|
1858
1864
|
"div",
|
|
1859
1865
|
{
|
|
1860
|
-
className:
|
|
1866
|
+
className: D(
|
|
1861
1867
|
"messaging-shell h-full bg-background-primary overflow-hidden",
|
|
1862
1868
|
s
|
|
1863
1869
|
),
|
|
@@ -1866,7 +1872,7 @@ const yt = ({
|
|
|
1866
1872
|
/* @__PURE__ */ e(
|
|
1867
1873
|
"div",
|
|
1868
1874
|
{
|
|
1869
|
-
className:
|
|
1875
|
+
className: D(
|
|
1870
1876
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1871
1877
|
{
|
|
1872
1878
|
"!hidden": x === !1 || R,
|
|
@@ -1880,7 +1886,7 @@ const yt = ({
|
|
|
1880
1886
|
Te,
|
|
1881
1887
|
{
|
|
1882
1888
|
onChannelSelect: je,
|
|
1883
|
-
selectedChannel:
|
|
1889
|
+
selectedChannel: T || void 0,
|
|
1884
1890
|
filters: Be,
|
|
1885
1891
|
customEmptyStateIndicator: C,
|
|
1886
1892
|
renderMessagePreview: b
|
|
@@ -1891,7 +1897,7 @@ const yt = ({
|
|
|
1891
1897
|
/* @__PURE__ */ e(
|
|
1892
1898
|
"div",
|
|
1893
1899
|
{
|
|
1894
|
-
className:
|
|
1900
|
+
className: D(
|
|
1895
1901
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1896
1902
|
{
|
|
1897
1903
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
@@ -1900,10 +1906,10 @@ const yt = ({
|
|
|
1900
1906
|
"hidden lg:flex": !R && !ae && !c
|
|
1901
1907
|
}
|
|
1902
1908
|
),
|
|
1903
|
-
children:
|
|
1909
|
+
children: T ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1904
1910
|
Pe,
|
|
1905
1911
|
{
|
|
1906
|
-
channel:
|
|
1912
|
+
channel: T,
|
|
1907
1913
|
onBack: Ae,
|
|
1908
1914
|
showBackButton: !R,
|
|
1909
1915
|
renderMessageInputActions: n,
|
|
@@ -1919,7 +1925,7 @@ const yt = ({
|
|
|
1919
1925
|
onMessageSent: f,
|
|
1920
1926
|
showStarButton: p
|
|
1921
1927
|
},
|
|
1922
|
-
|
|
1928
|
+
T.id
|
|
1923
1929
|
) }) : c ? (
|
|
1924
1930
|
// Show loading while creating/loading direct conversation channel
|
|
1925
1931
|
/* @__PURE__ */ e(ce, {})
|
|
@@ -1942,7 +1948,7 @@ const yt = ({
|
|
|
1942
1948
|
onClick: ze,
|
|
1943
1949
|
onClose: re,
|
|
1944
1950
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1945
|
-
|
|
1951
|
+
ut,
|
|
1946
1952
|
{
|
|
1947
1953
|
participantSource: ge,
|
|
1948
1954
|
onSelectParticipant: $e,
|
|
@@ -1970,7 +1976,7 @@ const yt = ({
|
|
|
1970
1976
|
onClick: s,
|
|
1971
1977
|
disabled: n,
|
|
1972
1978
|
style: { backgroundColor: "#E6E5E3" },
|
|
1973
|
-
className:
|
|
1979
|
+
className: D(
|
|
1974
1980
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1975
1981
|
{
|
|
1976
1982
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1989,7 +1995,7 @@ const yt = ({
|
|
|
1989
1995
|
avatarImage: c,
|
|
1990
1996
|
avatarName: r
|
|
1991
1997
|
}) => {
|
|
1992
|
-
const d = t.filter((x) => x.enabled).sort((x,
|
|
1998
|
+
const d = t.filter((x) => x.enabled).sort((x, m) => (x.order ?? 0) - (m.order ?? 0));
|
|
1993
1999
|
return d.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1994
2000
|
(c || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1995
2001
|
X,
|
|
@@ -2022,29 +2028,29 @@ const yt = ({
|
|
|
2022
2028
|
)
|
|
2023
2029
|
] }) });
|
|
2024
2030
|
}, Et = (t, s = {}) => {
|
|
2025
|
-
const { initialSearch: n = "", pageSize: l = 20 } = s, [o, c] = S([]), [r, d] = S(!1), [x,
|
|
2031
|
+
const { initialSearch: n = "", pageSize: l = 20 } = s, [o, c] = S([]), [r, d] = S(!1), [x, m] = S(null), [C, N] = S(n), [a, M] = S(!0), [I, _] = S(), f = L(async (h = !1, k) => {
|
|
2026
2032
|
if (r) return;
|
|
2027
2033
|
const g = k !== void 0 ? k : C;
|
|
2028
|
-
d(!0),
|
|
2034
|
+
d(!0), m(null);
|
|
2029
2035
|
try {
|
|
2030
|
-
const
|
|
2036
|
+
const u = await t.loadParticipants({
|
|
2031
2037
|
search: g || void 0,
|
|
2032
2038
|
limit: l,
|
|
2033
|
-
cursor:
|
|
2039
|
+
cursor: h ? void 0 : I
|
|
2034
2040
|
});
|
|
2035
2041
|
c(
|
|
2036
|
-
(w) =>
|
|
2037
|
-
), M(
|
|
2038
|
-
} catch (
|
|
2039
|
-
const w =
|
|
2040
|
-
|
|
2042
|
+
(w) => h ? u.participants : [...w, ...u.participants]
|
|
2043
|
+
), M(u.hasMore), _(u.nextCursor);
|
|
2044
|
+
} catch (u) {
|
|
2045
|
+
const w = u instanceof Error ? u.message : "Failed to load participants";
|
|
2046
|
+
m(w), console.error("[useParticipants] Load error:", u);
|
|
2041
2047
|
} finally {
|
|
2042
2048
|
d(!1);
|
|
2043
2049
|
}
|
|
2044
2050
|
}, [t, C, I, l, r]), p = L(() => {
|
|
2045
2051
|
a && !r && f(!1);
|
|
2046
|
-
}, [a, r, f]), b = L((
|
|
2047
|
-
N(
|
|
2052
|
+
}, [a, r, f]), b = L((h) => {
|
|
2053
|
+
N(h), _(void 0), f(!0, h);
|
|
2048
2054
|
}, [f]), y = L(() => {
|
|
2049
2055
|
_(void 0), f(!0);
|
|
2050
2056
|
}, [f]);
|
|
@@ -2071,7 +2077,7 @@ export {
|
|
|
2071
2077
|
ht as FaqListItem,
|
|
2072
2078
|
wt as MessagingProvider,
|
|
2073
2079
|
yt as MessagingShell,
|
|
2074
|
-
|
|
2080
|
+
ut as ParticipantPicker,
|
|
2075
2081
|
zs as formatRelativeTime,
|
|
2076
2082
|
As as useMessaging,
|
|
2077
2083
|
Et as useParticipants
|