@linktr.ee/messaging-react 1.18.0 โ 1.18.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 +195 -199
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +14 -14
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as o, Fragment as he } from "react/jsx-runtime";
|
|
2
2
|
import k from "classnames";
|
|
3
|
-
import O, { createContext as Ve, useContext as We, useCallback as F, useState as _, useRef as H, useEffect as V, useMemo as
|
|
3
|
+
import O, { createContext as Ve, useContext as We, useCallback as F, useState as _, useRef as H, useEffect as V, useMemo as Ce } from "react";
|
|
4
4
|
import { StreamChatService as qe } from "@linktr.ee/messaging-core";
|
|
5
|
-
import { Chat as Ze, ChannelList as Ye, DateSeparator as Je, areMessageUIPropsEqual as Qe, useChatContext as Xe, useMessageReminder as Ke, useComponentContext as es, Attachment as ss, EditMessageModal as ts, MessageBlocked as ns, MessageBouncePrompt as rs, MessageDeleted as as, MessageIsThreadReplyInChannelButtonIndicator as ls, MessageRepliesCountButton as os, ReminderNotification as is, StreamedMessageText as cs, messageHasAttachments as ds, messageHasReactions as
|
|
6
|
-
import { GiftIcon as Ls, XIcon as fe, ArrowUpIcon as Ps, ArrowLeftIcon as
|
|
5
|
+
import { Chat as Ze, ChannelList as Ye, DateSeparator as Je, areMessageUIPropsEqual as Qe, useChatContext as Xe, useMessageReminder as Ke, useComponentContext as es, Attachment as ss, EditMessageModal as ts, MessageBlocked as ns, MessageBouncePrompt as rs, MessageDeleted as as, MessageIsThreadReplyInChannelButtonIndicator as ls, MessageRepliesCountButton as os, ReminderNotification as is, StreamedMessageText as cs, messageHasAttachments as ds, messageHasReactions as us, isDateSeparatorMessage as ms, isMessageBlocked as hs, isMessageBounced as fs, MessageBounceModal as gs, Poll as xs, MessageText as Cs, MessageErrorIcon as bs, useMessageContext as Ns, 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, MessageTimestamp as ks, Channel as Rs, useChannelStateContext as _e, WithComponents as Ds, Window as Ts, MessageList as Fs } from "stream-chat-react";
|
|
6
|
+
import { GiftIcon as Ls, XIcon as fe, ArrowUpIcon as Ps, ArrowLeftIcon as be, StarIcon as Ne, DotsThreeIcon as ve, SpinnerGapIcon as oe, SignOutIcon as Os, ProhibitInsetIcon as we, FlagIcon as Us, MagnifyingGlassIcon as Bs, ChatCircleDotsIcon as ye } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as pe } from "stream-chat";
|
|
8
8
|
const Se = Ve({
|
|
9
9
|
service: null,
|
|
@@ -24,8 +24,8 @@ const Se = Ve({
|
|
|
24
24
|
debug: c = !1
|
|
25
25
|
}) => {
|
|
26
26
|
const r = F(
|
|
27
|
-
(d, ...
|
|
28
|
-
c && console.log(`๐ฅ [MessagingProvider] ${d}`, ...
|
|
27
|
+
(d, ...m) => {
|
|
28
|
+
c && console.log(`๐ฅ [MessagingProvider] ${d}`, ...m);
|
|
29
29
|
},
|
|
30
30
|
[c]
|
|
31
31
|
);
|
|
@@ -35,7 +35,7 @@ const Se = Ve({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(i)
|
|
37
37
|
});
|
|
38
|
-
const [
|
|
38
|
+
const [u, f] = _(null), [N, v] = _(null), [h, l] = _(!1), [M, p] = _(!1), [S, g] = _(null), y = H(!1), C = H({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: a,
|
|
41
41
|
serviceConfig: n,
|
|
@@ -45,12 +45,12 @@ const Se = Ve({
|
|
|
45
45
|
renderCount: x.current,
|
|
46
46
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (a == null ? void 0 : a.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
|
-
userChanged:
|
|
49
|
-
apiKeyChanged:
|
|
50
|
-
serviceConfigChanged:
|
|
51
|
-
capabilitiesChanged:
|
|
48
|
+
userChanged: C.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
+
apiKeyChanged: C.current.apiKey !== a,
|
|
50
|
+
serviceConfigChanged: C.current.serviceConfig !== n,
|
|
51
|
+
capabilitiesChanged: C.current.capabilities !== i
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
53
|
+
}), C.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
55
|
apiKey: a,
|
|
56
56
|
serviceConfig: n,
|
|
@@ -64,8 +64,8 @@ const Se = Ve({
|
|
|
64
64
|
dependencies: {
|
|
65
65
|
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
66
66
|
serviceConfigRef: n,
|
|
67
|
-
serviceConfigStable:
|
|
68
|
-
apiKeyStable:
|
|
67
|
+
serviceConfigStable: C.current.serviceConfig === n,
|
|
68
|
+
apiKeyStable: C.current.apiKey === a
|
|
69
69
|
}
|
|
70
70
|
}), !a || !n) {
|
|
71
71
|
r("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
@@ -77,34 +77,34 @@ const Se = Ve({
|
|
|
77
77
|
r("๐ CREATING NEW SERVICE", {
|
|
78
78
|
renderCount: d,
|
|
79
79
|
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
80
|
-
serviceConfigChanged:
|
|
80
|
+
serviceConfigChanged: C.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const m = new qe({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: a,
|
|
85
85
|
debug: c
|
|
86
86
|
});
|
|
87
|
-
return f(
|
|
87
|
+
return f(m), r("โ
SERVICE SET", {
|
|
88
88
|
renderCount: d,
|
|
89
|
-
serviceInstance: !!
|
|
89
|
+
serviceInstance: !!m
|
|
90
90
|
}), () => {
|
|
91
91
|
r("๐งน SERVICE CLEANUP", {
|
|
92
92
|
renderCount: d,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
|
-
}),
|
|
94
|
+
}), m.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
96
|
}, [a, n, c, r]);
|
|
97
97
|
const w = H(null);
|
|
98
98
|
V(() => {
|
|
99
|
-
var
|
|
99
|
+
var m, R;
|
|
100
100
|
if (r("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
-
hasService: !!
|
|
101
|
+
hasService: !!u,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
104
|
isConnecting: y.current,
|
|
105
105
|
isConnected: h,
|
|
106
|
-
dependencies: { service: !!
|
|
107
|
-
}), !
|
|
106
|
+
dependencies: { service: !!u, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !u || !s) {
|
|
108
108
|
r("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
@@ -112,7 +112,7 @@ const Se = Ve({
|
|
|
112
112
|
r("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((
|
|
115
|
+
if (((m = w.current) == null ? void 0 : m.serviceId) === u && ((R = w.current) == null ? void 0 : R.userId) === s.id) {
|
|
116
116
|
r(
|
|
117
117
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -123,8 +123,8 @@ const Se = Ve({
|
|
|
123
123
|
r("๐ STARTING USER CONNECTION", { userId: s.id }), y.current = !0, p(!0), g(null);
|
|
124
124
|
try {
|
|
125
125
|
r("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
-
const L = await
|
|
127
|
-
v(L), l(!0), w.current = { serviceId:
|
|
126
|
+
const L = await u.connectUser(s);
|
|
127
|
+
v(L), l(!0), w.current = { serviceId: u, userId: s.id }, r("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: L.userID
|
|
130
130
|
});
|
|
@@ -141,49 +141,49 @@ const Se = Ve({
|
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [
|
|
145
|
-
hasService: !!
|
|
144
|
+
}, [u, s, r, h]), V(() => (r("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!u,
|
|
146
146
|
isConnected: h
|
|
147
147
|
}), () => {
|
|
148
|
-
|
|
148
|
+
u && h ? (r(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
), w.current = null,
|
|
152
|
-
hasService: !!
|
|
151
|
+
), w.current = null, u.disconnectUser().catch(console.error)) : r("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!u,
|
|
153
153
|
isConnected: h
|
|
154
154
|
});
|
|
155
|
-
}), [
|
|
155
|
+
}), [u, h, r]);
|
|
156
156
|
const D = F(async () => {
|
|
157
157
|
if (r("๐ REFRESH CONNECTION CALLED", {
|
|
158
|
-
hasService: !!
|
|
158
|
+
hasService: !!u,
|
|
159
159
|
hasUser: !!s
|
|
160
|
-
}), !
|
|
160
|
+
}), !u || !s) {
|
|
161
161
|
r("โ ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
164
|
r("๐ STARTING CONNECTION REFRESH", { userId: s.id }), p(!0);
|
|
165
165
|
try {
|
|
166
|
-
r("๐ DISCONNECTING FOR REFRESH"), await
|
|
167
|
-
const d = await
|
|
166
|
+
r("๐ DISCONNECTING FOR REFRESH"), await u.disconnectUser(), r("๐ RECONNECTING FOR REFRESH");
|
|
167
|
+
const d = await u.connectUser(s);
|
|
168
168
|
v(d), l(!0), g(null), r("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
169
|
} catch (d) {
|
|
170
|
-
const
|
|
171
|
-
g(
|
|
170
|
+
const m = d instanceof Error ? d.message : "Refresh failed";
|
|
171
|
+
g(m), r("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
|
-
error:
|
|
173
|
+
error: m
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
176
|
p(!1), r("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [
|
|
179
|
-
hasService: !!
|
|
178
|
+
}, [u, s, r]), b = O.useMemo(() => (r("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!u,
|
|
180
180
|
hasClient: !!N,
|
|
181
181
|
isConnected: h,
|
|
182
182
|
isLoading: M,
|
|
183
183
|
hasError: !!S,
|
|
184
184
|
capabilitiesKeys: Object.keys(i)
|
|
185
185
|
}), {
|
|
186
|
-
service:
|
|
186
|
+
service: u,
|
|
187
187
|
client: N,
|
|
188
188
|
isConnected: h,
|
|
189
189
|
isLoading: M,
|
|
@@ -192,7 +192,7 @@ const Se = Ve({
|
|
|
192
192
|
refreshConnection: D,
|
|
193
193
|
debug: c
|
|
194
194
|
}), [
|
|
195
|
-
|
|
195
|
+
u,
|
|
196
196
|
N,
|
|
197
197
|
h,
|
|
198
198
|
M,
|
|
@@ -205,8 +205,8 @@ const Se = Ve({
|
|
|
205
205
|
return r("๐ RENDER END", {
|
|
206
206
|
renderCount: x.current,
|
|
207
207
|
willRenderChat: !!(N && h),
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(Se.Provider, { value:
|
|
208
|
+
contextValueReady: !!b
|
|
209
|
+
}), /* @__PURE__ */ e(Se.Provider, { value: b, children: N && h ? /* @__PURE__ */ e(
|
|
210
210
|
Ze,
|
|
211
211
|
{
|
|
212
212
|
client: N,
|
|
@@ -284,7 +284,7 @@ const J = ({
|
|
|
284
284
|
className: a,
|
|
285
285
|
shape: i = "squircle"
|
|
286
286
|
}) => {
|
|
287
|
-
const c = Gs(t),
|
|
287
|
+
const c = Gs(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", f = i === "circle" ? { borderRadius: "50%" } : {
|
|
288
288
|
borderRadius: "33%",
|
|
289
289
|
"corner-shape": "superellipse(1.3)"
|
|
290
290
|
};
|
|
@@ -310,7 +310,7 @@ const J = ({
|
|
|
310
310
|
"aria-hidden": "true",
|
|
311
311
|
className: k(
|
|
312
312
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
313
|
-
|
|
313
|
+
u
|
|
314
314
|
),
|
|
315
315
|
children: c
|
|
316
316
|
}
|
|
@@ -346,10 +346,10 @@ const J = ({
|
|
|
346
346
|
if (n) {
|
|
347
347
|
const c = (i = t.metadata) == null ? void 0 : i.amount_text;
|
|
348
348
|
if (!c) return null;
|
|
349
|
-
const r = s ? "message-tip-standalone" : "message-tag message-tag--tip",
|
|
349
|
+
const r = s ? "message-tip-standalone" : "message-tag message-tag--tip", u = s ? `${c} tip` : `Delivered with ${c} tip`;
|
|
350
350
|
return /* @__PURE__ */ o("div", { className: r, children: [
|
|
351
351
|
/* @__PURE__ */ e(Ls, { size: s ? 14 : 12 }),
|
|
352
|
-
/* @__PURE__ */ e("span", { children:
|
|
352
|
+
/* @__PURE__ */ e("span", { children: u })
|
|
353
353
|
] });
|
|
354
354
|
}
|
|
355
355
|
return /* @__PURE__ */ o("div", { className: "message-tag message-tag--chatbot", children: [
|
|
@@ -358,18 +358,18 @@ const J = ({
|
|
|
358
358
|
] });
|
|
359
359
|
}, Re = O.memo(
|
|
360
360
|
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: a = !1, unread: i }) => {
|
|
361
|
-
var y,
|
|
361
|
+
var y, C, x, w, D, b;
|
|
362
362
|
const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), r = () => {
|
|
363
363
|
t && n(t);
|
|
364
364
|
}, f = Object.values(((y = t == null ? void 0 : t.state) == null ? void 0 : y.members) || {}).find(
|
|
365
365
|
(d) => {
|
|
366
|
-
var
|
|
367
|
-
return ((
|
|
366
|
+
var m, R;
|
|
367
|
+
return ((m = d.user) == null ? void 0 : m.id) && d.user.id !== ((R = t == null ? void 0 : t._client) == null ? void 0 : R.userID);
|
|
368
368
|
}
|
|
369
|
-
), N = ((
|
|
370
|
-
var
|
|
369
|
+
), N = ((C = f == null ? void 0 : f.user) == null ? void 0 : C.name) || "Conversation", v = (x = f == null ? void 0 : f.user) == null ? void 0 : x.image, h = (D = (w = t == null ? void 0 : t.state) == null ? void 0 : w.messages) == null ? void 0 : D[t.state.messages.length - 1], M = (() => {
|
|
370
|
+
var m;
|
|
371
371
|
if (h != null && h.text) return h.text;
|
|
372
|
-
const d = (
|
|
372
|
+
const d = (m = h == null ? void 0 : h.attachments) == null ? void 0 : m[0];
|
|
373
373
|
return d ? d.og_scrape_url ? d.og_scrape_url : d.type === "image" ? "๐ท Sent an image" : d.type === "video" ? "๐ฅ Sent a video" : d.type === "audio" ? "๐ต Sent audio" : d.type === "file" ? "๐ Sent a file" : "๐ Sent an attachment" : "No messages yet";
|
|
374
374
|
})(), p = h != null && h.created_at ? $s(new Date(h.created_at)) : "", S = h ? Me(h) : !1, g = i ?? 0;
|
|
375
375
|
return a && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
@@ -394,7 +394,7 @@ const J = ({
|
|
|
394
394
|
/* @__PURE__ */ e(
|
|
395
395
|
J,
|
|
396
396
|
{
|
|
397
|
-
id: ((
|
|
397
|
+
id: ((b = f == null ? void 0 : f.user) == null ? void 0 : b.id) || t.id || "unknown",
|
|
398
398
|
name: N,
|
|
399
399
|
image: v,
|
|
400
400
|
size: 44,
|
|
@@ -445,7 +445,7 @@ const De = O.memo(
|
|
|
445
445
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
446
446
|
filters: n
|
|
447
447
|
});
|
|
448
|
-
const
|
|
448
|
+
const u = O.useMemo(() => (N) => /* @__PURE__ */ e(
|
|
449
449
|
Re,
|
|
450
450
|
{
|
|
451
451
|
...N,
|
|
@@ -467,7 +467,7 @@ const De = O.memo(
|
|
|
467
467
|
filters: n,
|
|
468
468
|
sort: { last_message_at: -1 },
|
|
469
469
|
options: { limit: 30 },
|
|
470
|
-
Preview:
|
|
470
|
+
Preview: u,
|
|
471
471
|
EmptyStateIndicator: i
|
|
472
472
|
},
|
|
473
473
|
JSON.stringify(n)
|
|
@@ -528,7 +528,7 @@ const Zs = (t) => /* @__PURE__ */ e(Je, { ...t, position: "center" }), Ys = (t)
|
|
|
528
528
|
firstOfGroup: i,
|
|
529
529
|
groupedByUser: c,
|
|
530
530
|
handleAction: r,
|
|
531
|
-
handleOpenThread:
|
|
531
|
+
handleOpenThread: u,
|
|
532
532
|
handleRetry: f,
|
|
533
533
|
highlighted: N,
|
|
534
534
|
isMessageAIGenerated: v,
|
|
@@ -536,25 +536,25 @@ const Zs = (t) => /* @__PURE__ */ e(Je, { ...t, position: "center" }), Ys = (t)
|
|
|
536
536
|
message: l,
|
|
537
537
|
renderText: M,
|
|
538
538
|
threadList: p
|
|
539
|
-
} = t, { client: S } = Xe("CustomMessage"), [g, y] = _(!1),
|
|
539
|
+
} = t, { client: S } = Xe("CustomMessage"), [g, y] = _(!1), C = Ke(l.id), {
|
|
540
540
|
Attachment: x = ss,
|
|
541
541
|
EditMessageModal: w = ts,
|
|
542
542
|
MessageBlocked: D = ns,
|
|
543
|
-
MessageBouncePrompt:
|
|
543
|
+
MessageBouncePrompt: b = rs,
|
|
544
544
|
MessageDeleted: d = as,
|
|
545
|
-
MessageIsThreadReplyInChannelButtonIndicator:
|
|
545
|
+
MessageIsThreadReplyInChannelButtonIndicator: m = ls,
|
|
546
546
|
MessageRepliesCountButton: R = os,
|
|
547
547
|
ReminderNotification: L = is,
|
|
548
548
|
StreamedMessageText: G = cs,
|
|
549
549
|
PinIndicator: W
|
|
550
|
-
} = es("CustomMessage"), ee = ds(l), Q =
|
|
550
|
+
} = es("CustomMessage"), ee = ds(l), Q = us(l), se = Ce(
|
|
551
551
|
() => v == null ? void 0 : v(l),
|
|
552
552
|
[v, l]
|
|
553
|
-
), $ =
|
|
553
|
+
), $ = Ce(
|
|
554
554
|
() => !l.shared_location && !l.attachments ? [] : l.shared_location ? [l.shared_location, ...l.attachments ?? []] : l.attachments,
|
|
555
555
|
[l]
|
|
556
556
|
);
|
|
557
|
-
if (
|
|
557
|
+
if (ms(l))
|
|
558
558
|
return null;
|
|
559
559
|
if (l.deleted_at || l.type === "deleted")
|
|
560
560
|
return /* @__PURE__ */ e(d, { message: l });
|
|
@@ -591,14 +591,14 @@ const Zs = (t) => /* @__PURE__ */ e(Je, { ...t, position: "center" }), Ys = (t)
|
|
|
591
591
|
g && /* @__PURE__ */ e(
|
|
592
592
|
gs,
|
|
593
593
|
{
|
|
594
|
-
MessageBouncePrompt:
|
|
594
|
+
MessageBouncePrompt: b,
|
|
595
595
|
onClose: () => y(!1),
|
|
596
596
|
open: g
|
|
597
597
|
}
|
|
598
598
|
),
|
|
599
599
|
/* @__PURE__ */ o("div", { className: T, children: [
|
|
600
600
|
W && /* @__PURE__ */ e(W, {}),
|
|
601
|
-
!!
|
|
601
|
+
!!C && /* @__PURE__ */ e(L, { reminder: C }),
|
|
602
602
|
l.user && /* @__PURE__ */ e(
|
|
603
603
|
J,
|
|
604
604
|
{
|
|
@@ -644,8 +644,8 @@ const Zs = (t) => /* @__PURE__ */ e(Je, { ...t, position: "center" }), Ys = (t)
|
|
|
644
644
|
message: l,
|
|
645
645
|
renderText: M
|
|
646
646
|
}
|
|
647
|
-
) : /* @__PURE__ */ e(
|
|
648
|
-
/* @__PURE__ */ e(
|
|
647
|
+
) : /* @__PURE__ */ e(Cs, { message: l, renderText: M }),
|
|
648
|
+
/* @__PURE__ */ e(bs, {})
|
|
649
649
|
] }),
|
|
650
650
|
/* @__PURE__ */ e(Ie, { message: l })
|
|
651
651
|
] })
|
|
@@ -654,11 +654,11 @@ const Zs = (t) => /* @__PURE__ */ e(Je, { ...t, position: "center" }), Ys = (t)
|
|
|
654
654
|
q && /* @__PURE__ */ e(
|
|
655
655
|
R,
|
|
656
656
|
{
|
|
657
|
-
onClick:
|
|
657
|
+
onClick: u,
|
|
658
658
|
reply_count: l.reply_count
|
|
659
659
|
}
|
|
660
660
|
),
|
|
661
|
-
Z && /* @__PURE__ */ e(
|
|
661
|
+
Z && /* @__PURE__ */ e(m, {})
|
|
662
662
|
] }, l.id)
|
|
663
663
|
] });
|
|
664
664
|
}, Js = O.memo(
|
|
@@ -834,62 +834,58 @@ const lt = ({
|
|
|
834
834
|
var w;
|
|
835
835
|
return ((w = x.user) == null ? void 0 : w.id) && x.user.id !== c._client.userID;
|
|
836
836
|
}
|
|
837
|
-
), [c._client.userID, c.state.members]),
|
|
837
|
+
), [c._client.userID, c.state.members]), u = ((l = r == null ? void 0 : r.user) == null ? void 0 : l.name) || ((M = r == null ? void 0 : r.user) == null ? void 0 : M.id) || "Unknown member", f = (p = r == null ? void 0 : r.user) == null ? void 0 : p.image, [N, v] = _(
|
|
838
838
|
!!((S = c.state.membership) != null && S.pinned_at)
|
|
839
839
|
);
|
|
840
840
|
V(() => {
|
|
841
|
-
const
|
|
841
|
+
const C = (x) => {
|
|
842
842
|
var w;
|
|
843
843
|
v(
|
|
844
844
|
x != null && x.member ? !!x.member.pinned_at : !!((w = c.state.membership) != null && w.pinned_at)
|
|
845
845
|
);
|
|
846
846
|
};
|
|
847
|
-
return c.on("member.updated",
|
|
848
|
-
c.off("member.updated",
|
|
847
|
+
return c.on("member.updated", C), () => {
|
|
848
|
+
c.off("member.updated", C);
|
|
849
849
|
};
|
|
850
850
|
}, [c]);
|
|
851
851
|
const h = async () => {
|
|
852
852
|
try {
|
|
853
853
|
N ? await c.unpin() : await c.pin();
|
|
854
|
-
} catch (
|
|
854
|
+
} catch (C) {
|
|
855
855
|
console.error(
|
|
856
856
|
"[CustomChannelHeader] Failed to update pinned status:",
|
|
857
|
-
|
|
857
|
+
C
|
|
858
858
|
);
|
|
859
859
|
}
|
|
860
860
|
};
|
|
861
861
|
return /* @__PURE__ */ o("div", { className: "@container", children: [
|
|
862
|
-
/* @__PURE__ */ o("div", { className: "
|
|
863
|
-
/* @__PURE__ */
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
}
|
|
877
|
-
),
|
|
878
|
-
/* @__PURE__ */ e("div", { className: "size-10" })
|
|
879
|
-
] }),
|
|
862
|
+
/* @__PURE__ */ o("div", { className: "grid grid-cols-[1fr_auto_1fr] w-full items-center @lg:hidden", children: [
|
|
863
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: s && /* @__PURE__ */ e(
|
|
864
|
+
"button",
|
|
865
|
+
{
|
|
866
|
+
className: k(
|
|
867
|
+
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
868
|
+
),
|
|
869
|
+
onClick: t || (() => {
|
|
870
|
+
}),
|
|
871
|
+
type: "button",
|
|
872
|
+
"aria-label": "Back to conversations",
|
|
873
|
+
children: /* @__PURE__ */ e(be, { className: "size-5 text-black/90" })
|
|
874
|
+
}
|
|
875
|
+
) }),
|
|
880
876
|
/* @__PURE__ */ o("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
881
877
|
/* @__PURE__ */ e(
|
|
882
878
|
J,
|
|
883
879
|
{
|
|
884
880
|
id: ((g = r == null ? void 0 : r.user) == null ? void 0 : g.id) || c.id || "unknown",
|
|
885
|
-
name:
|
|
881
|
+
name: u,
|
|
886
882
|
image: f,
|
|
887
883
|
size: 40
|
|
888
884
|
}
|
|
889
885
|
),
|
|
890
|
-
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children:
|
|
886
|
+
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: u })
|
|
891
887
|
] }),
|
|
892
|
-
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
888
|
+
/* @__PURE__ */ o("div", { className: "flex justify-end items-center gap-2", children: [
|
|
893
889
|
i && /* @__PURE__ */ e(
|
|
894
890
|
"button",
|
|
895
891
|
{
|
|
@@ -927,19 +923,19 @@ const lt = ({
|
|
|
927
923
|
onClick: t,
|
|
928
924
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
929
925
|
"aria-label": "Back to conversations",
|
|
930
|
-
children: /* @__PURE__ */ e(
|
|
926
|
+
children: /* @__PURE__ */ e(be, { className: "size-5 text-black/90" })
|
|
931
927
|
}
|
|
932
928
|
),
|
|
933
929
|
/* @__PURE__ */ e(
|
|
934
930
|
J,
|
|
935
931
|
{
|
|
936
932
|
id: ((y = r == null ? void 0 : r.user) == null ? void 0 : y.id) || c.id || "unknown",
|
|
937
|
-
name:
|
|
933
|
+
name: u,
|
|
938
934
|
image: f,
|
|
939
935
|
size: 40
|
|
940
936
|
}
|
|
941
937
|
),
|
|
942
|
-
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children:
|
|
938
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: u }) })
|
|
943
939
|
] }),
|
|
944
940
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
945
941
|
i && /* @__PURE__ */ e(
|
|
@@ -979,13 +975,13 @@ const lt = ({
|
|
|
979
975
|
followerStatusLabel: i,
|
|
980
976
|
onLeaveConversation: c,
|
|
981
977
|
onBlockParticipant: r,
|
|
982
|
-
showDeleteConversation:
|
|
978
|
+
showDeleteConversation: u = !0,
|
|
983
979
|
onDeleteConversationClick: f,
|
|
984
980
|
onBlockParticipantClick: N,
|
|
985
981
|
onReportParticipantClick: v
|
|
986
982
|
}) => {
|
|
987
983
|
var Q, se, $, q, Z, Y, X;
|
|
988
|
-
const { service: h, debug: l } = de(), [M, p] = _(!1), [S, g] = _(!1), [y,
|
|
984
|
+
const { service: h, debug: l } = de(), [M, p] = _(!1), [S, g] = _(!1), [y, C] = _(!1), x = F(async () => {
|
|
989
985
|
var I;
|
|
990
986
|
if (!(!h || !((I = n == null ? void 0 : n.user) != null && I.id)))
|
|
991
987
|
try {
|
|
@@ -1022,25 +1018,25 @@ const lt = ({
|
|
|
1022
1018
|
}, D = async () => {
|
|
1023
1019
|
var I, T, U;
|
|
1024
1020
|
if (!(y || !h)) {
|
|
1025
|
-
N == null || N(), l && console.log("[ChannelInfoDialog] Block member", (I = n == null ? void 0 : n.user) == null ? void 0 : I.id),
|
|
1021
|
+
N == null || N(), l && console.log("[ChannelInfoDialog] Block member", (I = n == null ? void 0 : n.user) == null ? void 0 : I.id), C(!0);
|
|
1026
1022
|
try {
|
|
1027
1023
|
await h.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
1028
1024
|
} catch (B) {
|
|
1029
1025
|
console.error("[ChannelInfoDialog] Failed to block member", B);
|
|
1030
1026
|
} finally {
|
|
1031
|
-
|
|
1027
|
+
C(!1);
|
|
1032
1028
|
}
|
|
1033
1029
|
}
|
|
1034
|
-
},
|
|
1030
|
+
}, b = async () => {
|
|
1035
1031
|
var I, T, U;
|
|
1036
1032
|
if (!(y || !h)) {
|
|
1037
|
-
N == null || N(), l && console.log("[ChannelInfoDialog] Unblock member", (I = n == null ? void 0 : n.user) == null ? void 0 : I.id),
|
|
1033
|
+
N == null || N(), l && console.log("[ChannelInfoDialog] Unblock member", (I = n == null ? void 0 : n.user) == null ? void 0 : I.id), C(!0);
|
|
1038
1034
|
try {
|
|
1039
1035
|
await h.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
1040
1036
|
} catch (B) {
|
|
1041
1037
|
console.error("[ChannelInfoDialog] Failed to unblock member", B);
|
|
1042
1038
|
} finally {
|
|
1043
|
-
|
|
1039
|
+
C(!1);
|
|
1044
1040
|
}
|
|
1045
1041
|
}
|
|
1046
1042
|
}, d = () => {
|
|
@@ -1051,7 +1047,7 @@ const lt = ({
|
|
|
1051
1047
|
);
|
|
1052
1048
|
};
|
|
1053
1049
|
if (!n) return null;
|
|
1054
|
-
const
|
|
1050
|
+
const m = ((se = n.user) == null ? void 0 : se.name) || (($ = n.user) == null ? void 0 : $.id) || "Unknown member", R = (q = n.user) == null ? void 0 : q.image, L = (Z = n.user) == null ? void 0 : Z.email, G = (Y = n.user) == null ? void 0 : Y.username, W = L || (G ? `linktr.ee/${G}` : void 0), ee = ((X = n.user) == null ? void 0 : X.id) || "unknown";
|
|
1055
1051
|
return (
|
|
1056
1052
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1057
1053
|
/* @__PURE__ */ e(
|
|
@@ -1079,14 +1075,14 @@ const lt = ({
|
|
|
1079
1075
|
J,
|
|
1080
1076
|
{
|
|
1081
1077
|
id: ee,
|
|
1082
|
-
name:
|
|
1078
|
+
name: m,
|
|
1083
1079
|
image: R,
|
|
1084
1080
|
size: 88,
|
|
1085
1081
|
shape: "circle"
|
|
1086
1082
|
}
|
|
1087
1083
|
),
|
|
1088
1084
|
/* @__PURE__ */ o("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
1089
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
1085
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: m }),
|
|
1090
1086
|
W && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: W }),
|
|
1091
1087
|
i && /* @__PURE__ */ e(
|
|
1092
1088
|
"span",
|
|
@@ -1107,7 +1103,7 @@ const lt = ({
|
|
|
1107
1103
|
}
|
|
1108
1104
|
),
|
|
1109
1105
|
/* @__PURE__ */ o("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
1110
|
-
|
|
1106
|
+
u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
|
|
1111
1107
|
le,
|
|
1112
1108
|
{
|
|
1113
1109
|
onClick: w,
|
|
@@ -1122,7 +1118,7 @@ const lt = ({
|
|
|
1122
1118
|
/* @__PURE__ */ e("li", { children: M ? /* @__PURE__ */ o(
|
|
1123
1119
|
le,
|
|
1124
1120
|
{
|
|
1125
|
-
onClick:
|
|
1121
|
+
onClick: b,
|
|
1126
1122
|
disabled: y,
|
|
1127
1123
|
"aria-busy": y,
|
|
1128
1124
|
children: [
|
|
@@ -1160,14 +1156,14 @@ const lt = ({
|
|
|
1160
1156
|
onBlockParticipant: i,
|
|
1161
1157
|
showDeleteConversation: c = !0,
|
|
1162
1158
|
onDeleteConversationClick: r,
|
|
1163
|
-
onBlockParticipantClick:
|
|
1159
|
+
onBlockParticipantClick: u,
|
|
1164
1160
|
onReportParticipantClick: f,
|
|
1165
1161
|
showStarButton: N = !1
|
|
1166
1162
|
}) => {
|
|
1167
1163
|
const { channel: v } = _e(), h = H(null), l = O.useMemo(() => Object.values(v.state.members || {}).find(
|
|
1168
1164
|
(y) => {
|
|
1169
|
-
var
|
|
1170
|
-
return ((
|
|
1165
|
+
var C;
|
|
1166
|
+
return ((C = y.user) == null ? void 0 : C.id) && y.user.id !== v._client.userID;
|
|
1171
1167
|
}
|
|
1172
1168
|
), [v._client.userID, v.state.members]), M = O.useMemo(() => {
|
|
1173
1169
|
const g = v.data ?? {};
|
|
@@ -1229,7 +1225,7 @@ const lt = ({
|
|
|
1229
1225
|
onBlockParticipant: i,
|
|
1230
1226
|
showDeleteConversation: c,
|
|
1231
1227
|
onDeleteConversationClick: r,
|
|
1232
|
-
onBlockParticipantClick:
|
|
1228
|
+
onBlockParticipantClick: u,
|
|
1233
1229
|
onReportParticipantClick: f
|
|
1234
1230
|
}
|
|
1235
1231
|
)
|
|
@@ -1243,7 +1239,7 @@ const lt = ({
|
|
|
1243
1239
|
onLeaveConversation: i,
|
|
1244
1240
|
onBlockParticipant: c,
|
|
1245
1241
|
className: r,
|
|
1246
|
-
CustomChannelEmptyState:
|
|
1242
|
+
CustomChannelEmptyState: u = rt,
|
|
1247
1243
|
showDeleteConversation: f = !0,
|
|
1248
1244
|
onDeleteConversationClick: N,
|
|
1249
1245
|
onBlockParticipantClick: v,
|
|
@@ -1254,22 +1250,22 @@ const lt = ({
|
|
|
1254
1250
|
showStarButton: S = !1
|
|
1255
1251
|
}) => {
|
|
1256
1252
|
const g = F(
|
|
1257
|
-
async (y,
|
|
1253
|
+
async (y, C, x) => {
|
|
1258
1254
|
var R;
|
|
1259
|
-
const w = ((R = t.data) == null ? void 0 : R.chatbot_paused) === !0, D = l && !w,
|
|
1260
|
-
...
|
|
1255
|
+
const w = ((R = t.data) == null ? void 0 : R.chatbot_paused) === !0, D = l && !w, b = {
|
|
1256
|
+
...C,
|
|
1261
1257
|
...D && { silent: !0 },
|
|
1262
1258
|
...M && {
|
|
1263
1259
|
metadata: {
|
|
1264
|
-
...
|
|
1260
|
+
...C.metadata ?? {},
|
|
1265
1261
|
...M
|
|
1266
1262
|
}
|
|
1267
1263
|
}
|
|
1268
1264
|
}, d = {
|
|
1269
1265
|
...x,
|
|
1270
1266
|
...D && { skip_push: !0 }
|
|
1271
|
-
},
|
|
1272
|
-
return p == null || p(
|
|
1267
|
+
}, m = await t.sendMessage(b, d);
|
|
1268
|
+
return p == null || p(m), m;
|
|
1273
1269
|
},
|
|
1274
1270
|
[t, l, M, p]
|
|
1275
1271
|
);
|
|
@@ -1285,7 +1281,7 @@ const lt = ({
|
|
|
1285
1281
|
{
|
|
1286
1282
|
channel: t,
|
|
1287
1283
|
MessageSystem: nt,
|
|
1288
|
-
EmptyStateIndicator:
|
|
1284
|
+
EmptyStateIndicator: u,
|
|
1289
1285
|
LoadingIndicator: ce,
|
|
1290
1286
|
DateSeparator: Zs,
|
|
1291
1287
|
doSendMessageRequest: g,
|
|
@@ -1297,7 +1293,7 @@ const lt = ({
|
|
|
1297
1293
|
renderMessageInputActions: a,
|
|
1298
1294
|
onLeaveConversation: i,
|
|
1299
1295
|
onBlockParticipant: c,
|
|
1300
|
-
CustomChannelEmptyState:
|
|
1296
|
+
CustomChannelEmptyState: u,
|
|
1301
1297
|
showDeleteConversation: f,
|
|
1302
1298
|
onDeleteConversationClick: N,
|
|
1303
1299
|
onBlockParticipantClick: v,
|
|
@@ -1360,56 +1356,56 @@ const dt = ({
|
|
|
1360
1356
|
searchPlaceholder: c = "Search participants...",
|
|
1361
1357
|
className: r
|
|
1362
1358
|
}) => {
|
|
1363
|
-
const { debug:
|
|
1359
|
+
const { debug: u } = de(), [f, N] = _(""), [v, h] = _([]), [l, M] = _(!1), [p, S] = _(null), [g, y] = _(
|
|
1364
1360
|
null
|
|
1365
|
-
),
|
|
1361
|
+
), C = H(!1);
|
|
1366
1362
|
V(() => {
|
|
1367
1363
|
if (t.loading) {
|
|
1368
|
-
|
|
1364
|
+
u && console.log(
|
|
1369
1365
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1370
1366
|
);
|
|
1371
1367
|
return;
|
|
1372
1368
|
}
|
|
1373
|
-
if (
|
|
1369
|
+
if (C.current) return;
|
|
1374
1370
|
(async () => {
|
|
1375
|
-
|
|
1371
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), S(null);
|
|
1376
1372
|
try {
|
|
1377
1373
|
const d = await t.loadParticipants({
|
|
1378
1374
|
search: "",
|
|
1379
1375
|
// Load all participants initially
|
|
1380
1376
|
limit: 100
|
|
1381
1377
|
});
|
|
1382
|
-
h(d.participants),
|
|
1378
|
+
h(d.participants), C.current = !0, u && console.log(
|
|
1383
1379
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1384
1380
|
d.participants.length
|
|
1385
1381
|
);
|
|
1386
1382
|
} catch (d) {
|
|
1387
|
-
const
|
|
1388
|
-
S(
|
|
1383
|
+
const m = d instanceof Error ? d.message : "Failed to load participants";
|
|
1384
|
+
S(m), console.error("[ParticipantPicker] Failed to load participants:", d);
|
|
1389
1385
|
} finally {
|
|
1390
1386
|
M(!1);
|
|
1391
1387
|
}
|
|
1392
1388
|
})();
|
|
1393
|
-
}, [t.loading,
|
|
1394
|
-
const x = v.filter((
|
|
1395
|
-
var
|
|
1389
|
+
}, [t.loading, u]);
|
|
1390
|
+
const x = v.filter((b) => !a.has(b.id)).filter((b) => {
|
|
1391
|
+
var m;
|
|
1396
1392
|
if (!f) return !0;
|
|
1397
1393
|
const d = f.toLowerCase();
|
|
1398
|
-
return
|
|
1394
|
+
return b.name.toLowerCase().includes(d) || ((m = b.email) == null ? void 0 : m.toLowerCase().includes(d)) || !1;
|
|
1399
1395
|
}), w = F(
|
|
1400
|
-
async (
|
|
1396
|
+
async (b) => {
|
|
1401
1397
|
if (!g) {
|
|
1402
|
-
y(
|
|
1398
|
+
y(b.id);
|
|
1403
1399
|
try {
|
|
1404
|
-
await s(
|
|
1400
|
+
await s(b);
|
|
1405
1401
|
} catch (d) {
|
|
1406
1402
|
console.error("[ParticipantPicker] Failed to start chat:", d), y(null);
|
|
1407
1403
|
}
|
|
1408
1404
|
}
|
|
1409
1405
|
},
|
|
1410
1406
|
[s, g]
|
|
1411
|
-
), D = (
|
|
1412
|
-
(
|
|
1407
|
+
), D = (b, d) => {
|
|
1408
|
+
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), w(d));
|
|
1413
1409
|
};
|
|
1414
1410
|
return /* @__PURE__ */ o("div", { className: k("flex flex-col h-full", r), children: [
|
|
1415
1411
|
/* @__PURE__ */ o("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
@@ -1452,35 +1448,35 @@ const dt = ({
|
|
|
1452
1448
|
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: f ? `No ${i} found` : v.length > 0 ? `Already chatting with all ${i}` : `No ${i} yet` }),
|
|
1453
1449
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: f ? "Try a different search term" : v.length > 0 ? `You have existing conversations with all your ${i}` : `${i.charAt(0).toUpperCase() + i.slice(1)} will appear here` })
|
|
1454
1450
|
] }) : /* @__PURE__ */ o("ul", { className: "space-y-0", children: [
|
|
1455
|
-
x.map((
|
|
1456
|
-
const d =
|
|
1451
|
+
x.map((b) => {
|
|
1452
|
+
const d = b.name || b.email || b.id, m = b.email && b.name ? b.email : b.phone;
|
|
1457
1453
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1458
1454
|
"button",
|
|
1459
1455
|
{
|
|
1460
1456
|
type: "button",
|
|
1461
|
-
onClick: () => w(
|
|
1462
|
-
onKeyDown: (R) => D(R,
|
|
1457
|
+
onClick: () => w(b),
|
|
1458
|
+
onKeyDown: (R) => D(R, b),
|
|
1463
1459
|
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",
|
|
1464
1460
|
children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
1465
1461
|
/* @__PURE__ */ o("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1466
1462
|
/* @__PURE__ */ e(
|
|
1467
1463
|
J,
|
|
1468
1464
|
{
|
|
1469
|
-
id:
|
|
1465
|
+
id: b.id,
|
|
1470
1466
|
name: d,
|
|
1471
|
-
image:
|
|
1467
|
+
image: b.image,
|
|
1472
1468
|
size: 40
|
|
1473
1469
|
}
|
|
1474
1470
|
),
|
|
1475
1471
|
/* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
|
|
1476
1472
|
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: d }),
|
|
1477
|
-
|
|
1473
|
+
m && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: m })
|
|
1478
1474
|
] })
|
|
1479
1475
|
] }),
|
|
1480
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: g ===
|
|
1476
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: g === b.id ? /* @__PURE__ */ e(oe, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ye, { className: "h-5 w-5 text-stone" }) })
|
|
1481
1477
|
] })
|
|
1482
1478
|
}
|
|
1483
|
-
) },
|
|
1479
|
+
) }, b.id);
|
|
1484
1480
|
}),
|
|
1485
1481
|
l && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
|
|
1486
1482
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
@@ -1488,7 +1484,7 @@ const dt = ({
|
|
|
1488
1484
|
] }) })
|
|
1489
1485
|
] }) })
|
|
1490
1486
|
] });
|
|
1491
|
-
},
|
|
1487
|
+
}, ut = ({ className: t }) => /* @__PURE__ */ o(
|
|
1492
1488
|
"svg",
|
|
1493
1489
|
{
|
|
1494
1490
|
width: "140",
|
|
@@ -1624,7 +1620,7 @@ const dt = ({
|
|
|
1624
1620
|
}
|
|
1625
1621
|
), Pe = O.memo(
|
|
1626
1622
|
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
1627
|
-
/* @__PURE__ */ e(
|
|
1623
|
+
/* @__PURE__ */ e(ut, {}),
|
|
1628
1624
|
s && !t && /* @__PURE__ */ o("div", { className: "mt-8", children: [
|
|
1629
1625
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1630
1626
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
@@ -1655,7 +1651,7 @@ const wt = ({
|
|
|
1655
1651
|
onParticipantSelect: i,
|
|
1656
1652
|
initialParticipantFilter: c,
|
|
1657
1653
|
initialParticipantData: r,
|
|
1658
|
-
CustomChannelEmptyState:
|
|
1654
|
+
CustomChannelEmptyState: u,
|
|
1659
1655
|
showChannelList: f = !0,
|
|
1660
1656
|
filters: N,
|
|
1661
1657
|
channelListCustomEmptyStateIndicator: v,
|
|
@@ -1668,13 +1664,13 @@ const wt = ({
|
|
|
1668
1664
|
showStarButton: y = !1
|
|
1669
1665
|
}) => {
|
|
1670
1666
|
const {
|
|
1671
|
-
service:
|
|
1667
|
+
service: C,
|
|
1672
1668
|
client: x,
|
|
1673
1669
|
isConnected: w,
|
|
1674
1670
|
isLoading: D,
|
|
1675
|
-
error:
|
|
1671
|
+
error: b,
|
|
1676
1672
|
refreshConnection: d,
|
|
1677
|
-
debug:
|
|
1673
|
+
debug: m
|
|
1678
1674
|
} = js(), [R, L] = _(null), [G, W] = _(!1), [ee, Q] = _(!1), [se, $] = _(!1), [q, Z] = _(/* @__PURE__ */ new Set()), [Y, X] = _(0), [I, T] = _(!1), [U, B] = _(null), z = H(null), {
|
|
1679
1675
|
participantSource: te,
|
|
1680
1676
|
participantLabel: ge = "participants",
|
|
@@ -1697,7 +1693,7 @@ const wt = ({
|
|
|
1697
1693
|
const E = x.userID;
|
|
1698
1694
|
if (E)
|
|
1699
1695
|
try {
|
|
1700
|
-
|
|
1696
|
+
m && console.log("[MessagingShell] Syncing channels for user:", E);
|
|
1701
1697
|
const A = await x.queryChannels(
|
|
1702
1698
|
{
|
|
1703
1699
|
type: "messaging",
|
|
@@ -1707,20 +1703,20 @@ const wt = ({
|
|
|
1707
1703
|
{ limit: 100 }
|
|
1708
1704
|
), P = /* @__PURE__ */ new Set();
|
|
1709
1705
|
A.forEach((j) => {
|
|
1710
|
-
const
|
|
1711
|
-
Object.values(
|
|
1706
|
+
const ue = j.state.members;
|
|
1707
|
+
Object.values(ue).forEach((He) => {
|
|
1712
1708
|
var xe;
|
|
1713
|
-
const
|
|
1714
|
-
|
|
1709
|
+
const me = (xe = He.user) == null ? void 0 : xe.id;
|
|
1710
|
+
me && me !== E && P.add(me);
|
|
1715
1711
|
});
|
|
1716
|
-
}), Z((j) => j.size === P.size && [...j].every((
|
|
1712
|
+
}), Z((j) => j.size === P.size && [...j].every((ue) => P.has(ue)) ? j : P), W(A.length > 0), Q(!0), ne.current = E, m && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1717
1713
|
channelCount: A.length,
|
|
1718
1714
|
memberCount: P.size
|
|
1719
1715
|
});
|
|
1720
1716
|
} catch (A) {
|
|
1721
1717
|
console.error("[MessagingShell] Failed to sync channels:", A);
|
|
1722
1718
|
}
|
|
1723
|
-
}, [x, w,
|
|
1719
|
+
}, [x, w, m]);
|
|
1724
1720
|
V(() => {
|
|
1725
1721
|
if (!x || !w) return;
|
|
1726
1722
|
const E = x.userID;
|
|
@@ -1731,7 +1727,7 @@ const wt = ({
|
|
|
1731
1727
|
const A = x.userID;
|
|
1732
1728
|
if (A)
|
|
1733
1729
|
try {
|
|
1734
|
-
|
|
1730
|
+
m && console.log(
|
|
1735
1731
|
"[MessagingShell] Loading initial conversation with:",
|
|
1736
1732
|
c
|
|
1737
1733
|
);
|
|
@@ -1744,23 +1740,23 @@ const wt = ({
|
|
|
1744
1740
|
{ limit: 1 }
|
|
1745
1741
|
);
|
|
1746
1742
|
if (P.length > 0)
|
|
1747
|
-
L(P[0]), T(!0), B(null), a && a(P[0]),
|
|
1743
|
+
L(P[0]), T(!0), B(null), a && a(P[0]), m && console.log(
|
|
1748
1744
|
"[MessagingShell] Initial conversation loaded:",
|
|
1749
1745
|
P[0].id
|
|
1750
1746
|
);
|
|
1751
|
-
else if (r &&
|
|
1752
|
-
|
|
1747
|
+
else if (r && C) {
|
|
1748
|
+
m && console.log(
|
|
1753
1749
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1754
1750
|
r
|
|
1755
1751
|
);
|
|
1756
1752
|
try {
|
|
1757
|
-
const j = await
|
|
1753
|
+
const j = await C.startChannelWithParticipant({
|
|
1758
1754
|
id: r.id,
|
|
1759
1755
|
name: r.name,
|
|
1760
1756
|
email: r.email,
|
|
1761
1757
|
phone: r.phone
|
|
1762
1758
|
});
|
|
1763
|
-
L(j), T(!0), B(null), a && a(j),
|
|
1759
|
+
L(j), T(!0), B(null), a && a(j), m && console.log(
|
|
1764
1760
|
"[MessagingShell] Channel created and loaded:",
|
|
1765
1761
|
j.id
|
|
1766
1762
|
);
|
|
@@ -1773,7 +1769,7 @@ const wt = ({
|
|
|
1773
1769
|
} else
|
|
1774
1770
|
B(
|
|
1775
1771
|
"No conversation found with this account"
|
|
1776
|
-
),
|
|
1772
|
+
), m && console.log(
|
|
1777
1773
|
"[MessagingShell] No conversation found for:",
|
|
1778
1774
|
c
|
|
1779
1775
|
);
|
|
@@ -1789,8 +1785,8 @@ const wt = ({
|
|
|
1789
1785
|
r,
|
|
1790
1786
|
x,
|
|
1791
1787
|
w,
|
|
1792
|
-
|
|
1793
|
-
|
|
1788
|
+
C,
|
|
1789
|
+
m,
|
|
1794
1790
|
a
|
|
1795
1791
|
]);
|
|
1796
1792
|
const Be = F(
|
|
@@ -1803,13 +1799,13 @@ const wt = ({
|
|
|
1803
1799
|
}, [I]), Ae = F(
|
|
1804
1800
|
async (E) => {
|
|
1805
1801
|
var A;
|
|
1806
|
-
if (
|
|
1802
|
+
if (C)
|
|
1807
1803
|
try {
|
|
1808
|
-
|
|
1804
|
+
m && console.log(
|
|
1809
1805
|
"[MessagingShell] Starting conversation with:",
|
|
1810
1806
|
E.id
|
|
1811
1807
|
);
|
|
1812
|
-
const P = await
|
|
1808
|
+
const P = await C.startChannelWithParticipant({
|
|
1813
1809
|
id: E.id,
|
|
1814
1810
|
name: E.name,
|
|
1815
1811
|
email: E.email,
|
|
@@ -1825,7 +1821,7 @@ const wt = ({
|
|
|
1825
1821
|
console.error("[MessagingShell] Failed to start conversation:", P);
|
|
1826
1822
|
}
|
|
1827
1823
|
},
|
|
1828
|
-
[
|
|
1824
|
+
[C, i, m]
|
|
1829
1825
|
), re = F(() => {
|
|
1830
1826
|
var E;
|
|
1831
1827
|
$(!1), (E = z.current) == null || E.close();
|
|
@@ -1836,16 +1832,16 @@ const wt = ({
|
|
|
1836
1832
|
[re]
|
|
1837
1833
|
), ze = F(
|
|
1838
1834
|
async (E) => {
|
|
1839
|
-
|
|
1835
|
+
m && console.log("[MessagingShell] Leaving conversation:", E.id), L(null), T(!1), ne.current = null, await K();
|
|
1840
1836
|
},
|
|
1841
|
-
[K,
|
|
1837
|
+
[K, m]
|
|
1842
1838
|
), Ge = F(
|
|
1843
1839
|
async (E) => {
|
|
1844
|
-
|
|
1840
|
+
m && console.log("[MessagingShell] Blocking participant:", E), L(null), T(!1), ne.current = null, await K();
|
|
1845
1841
|
},
|
|
1846
|
-
[K,
|
|
1842
|
+
[K, m]
|
|
1847
1843
|
), ae = !!R;
|
|
1848
|
-
return D ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(ce, {}) }) :
|
|
1844
|
+
return D ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(ce, {}) }) : b ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(ie, { message: b, onBack: d }) }) : !w || !x ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(
|
|
1849
1845
|
ie,
|
|
1850
1846
|
{
|
|
1851
1847
|
message: "Not connected to messaging service",
|
|
@@ -1905,7 +1901,7 @@ const wt = ({
|
|
|
1905
1901
|
renderMessageInputActions: n,
|
|
1906
1902
|
onLeaveConversation: ze,
|
|
1907
1903
|
onBlockParticipant: Ge,
|
|
1908
|
-
CustomChannelEmptyState:
|
|
1904
|
+
CustomChannelEmptyState: u,
|
|
1909
1905
|
showDeleteConversation: Oe,
|
|
1910
1906
|
onDeleteConversationClick: h,
|
|
1911
1907
|
onBlockParticipantClick: l,
|
|
@@ -1954,7 +1950,7 @@ const wt = ({
|
|
|
1954
1950
|
]
|
|
1955
1951
|
}
|
|
1956
1952
|
);
|
|
1957
|
-
},
|
|
1953
|
+
}, mt = ({
|
|
1958
1954
|
question: t,
|
|
1959
1955
|
onClick: s,
|
|
1960
1956
|
loading: n = !1,
|
|
@@ -1985,8 +1981,8 @@ const wt = ({
|
|
|
1985
1981
|
avatarImage: c,
|
|
1986
1982
|
avatarName: r
|
|
1987
1983
|
}) => {
|
|
1988
|
-
const
|
|
1989
|
-
return
|
|
1984
|
+
const u = t.filter((f) => f.enabled).sort((f, N) => (f.order ?? 0) - (N.order ?? 0));
|
|
1985
|
+
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: i, children: /* @__PURE__ */ o("div", { className: "flex gap-3 items-end", children: [
|
|
1990
1986
|
(c || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1991
1987
|
J,
|
|
1992
1988
|
{
|
|
@@ -2004,8 +2000,8 @@ const wt = ({
|
|
|
2004
2000
|
style: { backgroundColor: "#F1F0EE" },
|
|
2005
2001
|
children: [
|
|
2006
2002
|
a && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: a }),
|
|
2007
|
-
|
|
2008
|
-
|
|
2003
|
+
u.map((f) => /* @__PURE__ */ e(
|
|
2004
|
+
mt,
|
|
2009
2005
|
{
|
|
2010
2006
|
question: f.question,
|
|
2011
2007
|
onClick: () => s(f.id),
|
|
@@ -2018,28 +2014,28 @@ const wt = ({
|
|
|
2018
2014
|
)
|
|
2019
2015
|
] }) });
|
|
2020
2016
|
}, pt = (t, s = {}) => {
|
|
2021
|
-
const { initialSearch: n = "", pageSize: a = 20 } = s, [i, c] = _([]), [r,
|
|
2017
|
+
const { initialSearch: n = "", pageSize: a = 20 } = s, [i, c] = _([]), [r, u] = _(!1), [f, N] = _(null), [v, h] = _(n), [l, M] = _(!0), [p, S] = _(), g = F(async (w = !1, D) => {
|
|
2022
2018
|
if (r) return;
|
|
2023
|
-
const
|
|
2024
|
-
|
|
2019
|
+
const b = D !== void 0 ? D : v;
|
|
2020
|
+
u(!0), N(null);
|
|
2025
2021
|
try {
|
|
2026
2022
|
const d = await t.loadParticipants({
|
|
2027
|
-
search:
|
|
2023
|
+
search: b || void 0,
|
|
2028
2024
|
limit: a,
|
|
2029
2025
|
cursor: w ? void 0 : p
|
|
2030
2026
|
});
|
|
2031
2027
|
c(
|
|
2032
|
-
(
|
|
2028
|
+
(m) => w ? d.participants : [...m, ...d.participants]
|
|
2033
2029
|
), M(d.hasMore), S(d.nextCursor);
|
|
2034
2030
|
} catch (d) {
|
|
2035
|
-
const
|
|
2036
|
-
N(
|
|
2031
|
+
const m = d instanceof Error ? d.message : "Failed to load participants";
|
|
2032
|
+
N(m), console.error("[useParticipants] Load error:", d);
|
|
2037
2033
|
} finally {
|
|
2038
|
-
|
|
2034
|
+
u(!1);
|
|
2039
2035
|
}
|
|
2040
2036
|
}, [t, v, p, a, r]), y = F(() => {
|
|
2041
2037
|
l && !r && g(!1);
|
|
2042
|
-
}, [l, r, g]),
|
|
2038
|
+
}, [l, r, g]), C = F((w) => {
|
|
2043
2039
|
h(w), S(void 0), g(!0, w);
|
|
2044
2040
|
}, [g]), x = F(() => {
|
|
2045
2041
|
S(void 0), g(!0);
|
|
@@ -2054,7 +2050,7 @@ const wt = ({
|
|
|
2054
2050
|
hasMore: l,
|
|
2055
2051
|
totalCount: t.totalCount,
|
|
2056
2052
|
loadMore: y,
|
|
2057
|
-
search:
|
|
2053
|
+
search: C,
|
|
2058
2054
|
refresh: x
|
|
2059
2055
|
};
|
|
2060
2056
|
};
|
|
@@ -2064,7 +2060,7 @@ export {
|
|
|
2064
2060
|
De as ChannelList,
|
|
2065
2061
|
Le as ChannelView,
|
|
2066
2062
|
yt as FaqList,
|
|
2067
|
-
|
|
2063
|
+
mt as FaqListItem,
|
|
2068
2064
|
vt as MessagingProvider,
|
|
2069
2065
|
wt as MessagingShell,
|
|
2070
2066
|
dt as ParticipantPicker,
|