@linktr.ee/messaging-react 1.29.0-rc-1776320021 → 1.29.0-rc-1776325810
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 +415 -418
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/index.test.tsx +14 -4
- package/src/components/ChannelList/index.tsx +17 -1
- package/src/components/ChannelView.tsx +5 -8
- package/src/components/CustomMessage/CustomMessage.stories.tsx +11 -6
- package/src/components/CustomMessage/index.tsx +1 -1
- package/src/components/LockedAttachment/LockedAttachment.stories.tsx +18 -48
- package/src/hooks/useRestorePendingMessages.test.ts +15 -47
- package/src/hooks/useRestorePendingMessages.ts +8 -25
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i, Fragment as he } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import F, { createContext as ft, useContext as gt, useCallback as U, useState as k, useRef as
|
|
2
|
+
import A from "classnames";
|
|
3
|
+
import F, { createContext as ft, useContext as gt, useCallback as U, useState as k, useRef as Q, useEffect as X, useMemo as Le, Suspense as je } from "react";
|
|
4
4
|
import { StreamChatService as xt } from "@linktr.ee/messaging-core";
|
|
5
5
|
import { Chat as bt, ChannelList as Ct, DateSeparator as Nt, useChannelStateContext as Ie, useChatContext as Ke, areMessageUIPropsEqual as pt, useMessageReminder as yt, useComponentContext as vt, Attachment as wt, EditMessageModal as _t, MessageBlocked as Et, MessageBouncePrompt as St, MessageDeleted as It, MessageIsThreadReplyInChannelButtonIndicator as Mt, MessageRepliesCountButton as kt, ReminderNotification as Tt, StreamedMessageText as Dt, messageHasAttachments as Rt, messageHasReactions as At, isDateSeparatorMessage as Lt, isMessageBlocked as Ut, isMessageBounced as Pt, MessageBounceModal as Ft, MessageText as ze, Poll as Ot, MessageErrorIcon as Bt, useMessageContext as Qe, useMessageComposer as Gt, useStateStore as $t, MessageInput as jt, useMessageInputContext as zt, useMessageComposerHasSendableData as Ht, SimpleAttachmentSelector as Vt, QuotedMessagePreview as Yt, AttachmentPreviewList as Wt, TextareaComposer as qt, MessageTimestamp as De, Channel as Zt, WithComponents as Jt, Window as Xt, MessageList as Kt } from "stream-chat-react";
|
|
6
6
|
import { StarIcon as Ue, GiftIcon as Qt, XIcon as Oe, SpinnerGapIcon as _e, SignOutIcon as es, ProhibitInsetIcon as He, FlagIcon as ts, ArrowUpIcon as ss, SparkleIcon as ns, ProhibitIcon as as, ArrowLeftIcon as Ve, DotsThreeIcon as Ye, MagnifyingGlassIcon as rs, ChatCircleDotsIcon as We } from "@phosphor-icons/react";
|
|
@@ -19,7 +19,7 @@ const et = ft({
|
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
|
-
apiKey:
|
|
22
|
+
apiKey: o,
|
|
23
23
|
capabilities: l = {},
|
|
24
24
|
debug: d = !1
|
|
25
25
|
}) => {
|
|
@@ -31,43 +31,43 @@ const et = ft({
|
|
|
31
31
|
);
|
|
32
32
|
a("🔄 RENDER START", {
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
34
|
-
apiKey: (
|
|
34
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(l)
|
|
37
37
|
});
|
|
38
|
-
const [c, g] = k(null), [h, b] = k(null), [C,
|
|
38
|
+
const [c, g] = k(null), [h, b] = k(null), [C, S] = k(!1), [m, v] = k(!1), [r, p] = k(null), M = Q(!1), N = Q({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
|
-
apiKey:
|
|
40
|
+
apiKey: o,
|
|
41
41
|
serviceConfig: n,
|
|
42
42
|
capabilities: l
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
46
|
-
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (
|
|
43
|
+
}), w = Q(0);
|
|
44
|
+
w.current++, a("📊 RENDER INFO", {
|
|
45
|
+
renderCount: w.current,
|
|
46
|
+
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (o == null ? void 0 : o.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
48
|
userChanged: N.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
-
apiKeyChanged: N.current.apiKey !==
|
|
49
|
+
apiKeyChanged: N.current.apiKey !== o,
|
|
50
50
|
serviceConfigChanged: N.current.serviceConfig !== n,
|
|
51
51
|
capabilitiesChanged: N.current.capabilities !== l
|
|
52
52
|
}
|
|
53
53
|
}), N.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
|
-
apiKey:
|
|
55
|
+
apiKey: o,
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: l
|
|
58
|
-
},
|
|
59
|
-
const u =
|
|
58
|
+
}, X(() => {
|
|
59
|
+
const u = w.current;
|
|
60
60
|
if (a("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
61
61
|
renderCount: u,
|
|
62
|
-
apiKey: !!
|
|
62
|
+
apiKey: !!o,
|
|
63
63
|
serviceConfig: !!n,
|
|
64
64
|
dependencies: {
|
|
65
|
-
apiKey: (
|
|
65
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
66
66
|
serviceConfigRef: n,
|
|
67
67
|
serviceConfigStable: N.current.serviceConfig === n,
|
|
68
|
-
apiKeyStable: N.current.apiKey ===
|
|
68
|
+
apiKeyStable: N.current.apiKey === o
|
|
69
69
|
}
|
|
70
|
-
}), !
|
|
70
|
+
}), !o || !n) {
|
|
71
71
|
a("⚠️ SERVICE INIT SKIPPED", {
|
|
72
72
|
renderCount: u,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
@@ -76,12 +76,12 @@ const et = ft({
|
|
|
76
76
|
}
|
|
77
77
|
a("🚀 CREATING NEW SERVICE", {
|
|
78
78
|
renderCount: u,
|
|
79
|
-
apiKey: (
|
|
79
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: N.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
82
|
const f = new xt({
|
|
83
83
|
...n,
|
|
84
|
-
apiKey:
|
|
84
|
+
apiKey: o,
|
|
85
85
|
debug: d
|
|
86
86
|
});
|
|
87
87
|
return g(f), a("✅ SERVICE SET", {
|
|
@@ -93,10 +93,10 @@ const et = ft({
|
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
94
|
}), f.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
|
-
}, [
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
var f,
|
|
96
|
+
}, [o, n, d, a]);
|
|
97
|
+
const _ = Q(null);
|
|
98
|
+
X(() => {
|
|
99
|
+
var f, E;
|
|
100
100
|
if (a("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
101
101
|
hasService: !!c,
|
|
102
102
|
hasUser: !!s,
|
|
@@ -112,7 +112,7 @@ const et = ft({
|
|
|
112
112
|
a("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((f =
|
|
115
|
+
if (((f = _.current) == null ? void 0 : f.serviceId) === c && ((E = _.current) == null ? void 0 : E.userId) === s.id) {
|
|
116
116
|
a(
|
|
117
117
|
"⚠️ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -120,40 +120,40 @@ const et = ft({
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
a("🚀 STARTING USER CONNECTION", { userId: s.id }), M.current = !0,
|
|
123
|
+
a("🚀 STARTING USER CONNECTION", { userId: s.id }), M.current = !0, v(!0), p(null);
|
|
124
124
|
try {
|
|
125
125
|
a("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
-
const
|
|
127
|
-
b(
|
|
126
|
+
const y = await c.connectUser(s);
|
|
127
|
+
b(y), S(!0), _.current = { serviceId: c, userId: s.id }, a("✅ USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
|
-
clientId:
|
|
129
|
+
clientId: y.userID
|
|
130
130
|
});
|
|
131
|
-
} catch (
|
|
132
|
-
const D =
|
|
133
|
-
|
|
131
|
+
} catch (y) {
|
|
132
|
+
const D = y instanceof Error ? y.message : "Connection failed";
|
|
133
|
+
p(D), a("❌ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
135
|
error: D
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
v(!1), M.current = !1, a("🔄 USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
isConnected: C
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [c, s, a, C]),
|
|
144
|
+
}, [c, s, a, C]), X(() => (a("🔌 CLEANUP EFFECT REGISTERED", {
|
|
145
145
|
hasService: !!c,
|
|
146
146
|
isConnected: C
|
|
147
147
|
}), () => {
|
|
148
148
|
c && C ? (a(
|
|
149
149
|
"🧹 CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
151
|
+
), _.current = null, c.disconnectUser().catch(console.error)) : a("🔇 CLEANUP EFFECT SKIPPED", {
|
|
152
152
|
hasService: !!c,
|
|
153
153
|
isConnected: C
|
|
154
154
|
});
|
|
155
155
|
}), [c, C, a]);
|
|
156
|
-
const
|
|
156
|
+
const L = U(async () => {
|
|
157
157
|
if (a("🔄 REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!c,
|
|
159
159
|
hasUser: !!s
|
|
@@ -161,49 +161,49 @@ const et = ft({
|
|
|
161
161
|
a("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
a("🚀 STARTING CONNECTION REFRESH", { userId: s.id }),
|
|
164
|
+
a("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), v(!0);
|
|
165
165
|
try {
|
|
166
166
|
a("🔌 DISCONNECTING FOR REFRESH"), await c.disconnectUser(), a("📞 RECONNECTING FOR REFRESH");
|
|
167
167
|
const u = await c.connectUser(s);
|
|
168
|
-
b(u),
|
|
168
|
+
b(u), S(!0), p(null), a("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
169
|
} catch (u) {
|
|
170
170
|
const f = u instanceof Error ? u.message : "Refresh failed";
|
|
171
|
-
|
|
171
|
+
p(f), a("❌ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
173
|
error: f
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
v(!1), a("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
178
|
}, [c, s, a]), x = F.useMemo(() => (a("💫 CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!c,
|
|
180
180
|
hasClient: !!h,
|
|
181
181
|
isConnected: C,
|
|
182
182
|
isLoading: m,
|
|
183
|
-
hasError: !!
|
|
183
|
+
hasError: !!r,
|
|
184
184
|
capabilitiesKeys: Object.keys(l)
|
|
185
185
|
}), {
|
|
186
186
|
service: c,
|
|
187
187
|
client: h,
|
|
188
188
|
isConnected: C,
|
|
189
189
|
isLoading: m,
|
|
190
|
-
error:
|
|
190
|
+
error: r,
|
|
191
191
|
capabilities: l,
|
|
192
|
-
refreshConnection:
|
|
192
|
+
refreshConnection: L,
|
|
193
193
|
debug: d
|
|
194
194
|
}), [
|
|
195
195
|
c,
|
|
196
196
|
h,
|
|
197
197
|
C,
|
|
198
198
|
m,
|
|
199
|
-
|
|
199
|
+
r,
|
|
200
200
|
l,
|
|
201
|
-
|
|
201
|
+
L,
|
|
202
202
|
d,
|
|
203
203
|
a
|
|
204
204
|
]);
|
|
205
205
|
return a("🔄 RENDER END", {
|
|
206
|
-
renderCount:
|
|
206
|
+
renderCount: w.current,
|
|
207
207
|
willRenderChat: !!(h && C),
|
|
208
208
|
contextValueReady: !!x
|
|
209
209
|
}), /* @__PURE__ */ e(et.Provider, { value: x, children: h && C ? /* @__PURE__ */ e(
|
|
@@ -216,18 +216,25 @@ const et = ft({
|
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
}, os = () => Me()
|
|
219
|
+
}, os = () => Me();
|
|
220
|
+
function ls(t) {
|
|
221
|
+
const s = t.state.pending_messages;
|
|
222
|
+
if (s != null && s.length)
|
|
223
|
+
for (const n of s)
|
|
224
|
+
t.state.addMessageSorted(n.message);
|
|
225
|
+
}
|
|
226
|
+
const tt = F.createContext({
|
|
220
227
|
selectedChannel: void 0,
|
|
221
228
|
onChannelSelect: () => {
|
|
222
229
|
},
|
|
223
230
|
debug: !1,
|
|
224
231
|
renderMessagePreview: void 0
|
|
225
|
-
}),
|
|
226
|
-
var
|
|
232
|
+
}), is = tt.Provider, cs = () => F.useContext(tt), st = (t) => {
|
|
233
|
+
var o, l;
|
|
227
234
|
const [s, n] = k(
|
|
228
|
-
!!((l = (
|
|
235
|
+
!!((l = (o = t == null ? void 0 : t.state) == null ? void 0 : o.membership) != null && l.pinned_at)
|
|
229
236
|
);
|
|
230
|
-
return
|
|
237
|
+
return X(() => {
|
|
231
238
|
var a;
|
|
232
239
|
if (!t) {
|
|
233
240
|
n(!1);
|
|
@@ -244,23 +251,23 @@ const et = ft({
|
|
|
244
251
|
t.off("member.updated", d);
|
|
245
252
|
};
|
|
246
253
|
}, [t]), s;
|
|
247
|
-
},
|
|
254
|
+
}, ds = (t, s) => {
|
|
248
255
|
const n = new Date(
|
|
249
256
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
250
257
|
), l = new Date(
|
|
251
258
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
252
259
|
).getTime() - n.getTime();
|
|
253
260
|
return Math.floor(l / (1e3 * 60 * 60 * 24));
|
|
254
|
-
},
|
|
261
|
+
}, ms = (t) => {
|
|
255
262
|
const s = /* @__PURE__ */ new Date();
|
|
256
263
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
257
264
|
return "Just now";
|
|
258
|
-
const
|
|
259
|
-
return
|
|
265
|
+
const o = ds(t, s);
|
|
266
|
+
return o === 0 ? t.toLocaleTimeString([], {
|
|
260
267
|
hour: "numeric",
|
|
261
268
|
minute: "2-digit",
|
|
262
269
|
hour12: !0
|
|
263
|
-
}) :
|
|
270
|
+
}) : o === 1 ? "Yesterday" : o < 7 ? `${o}d` : o < 28 ? `${Math.floor(o / 7)}w` : t.toLocaleDateString("en-US", {
|
|
264
271
|
month: "numeric",
|
|
265
272
|
day: "numeric",
|
|
266
273
|
year: "2-digit"
|
|
@@ -293,34 +300,34 @@ const et = ft({
|
|
|
293
300
|
"🍈"
|
|
294
301
|
// Melon
|
|
295
302
|
];
|
|
296
|
-
function
|
|
303
|
+
function us(t) {
|
|
297
304
|
let s = 0;
|
|
298
305
|
for (let n = 0; n < t.length; n++) {
|
|
299
|
-
const
|
|
300
|
-
s = (s << 5) - s +
|
|
306
|
+
const o = t.charCodeAt(n);
|
|
307
|
+
s = (s << 5) - s + o, s = s & s;
|
|
301
308
|
}
|
|
302
309
|
return Math.abs(s);
|
|
303
310
|
}
|
|
304
|
-
function
|
|
305
|
-
const n =
|
|
311
|
+
function hs(t) {
|
|
312
|
+
const n = us(t) % Ze.length;
|
|
306
313
|
return Ze[n];
|
|
307
314
|
}
|
|
308
|
-
const
|
|
315
|
+
const ie = ({
|
|
309
316
|
id: t,
|
|
310
317
|
image: s,
|
|
311
318
|
size: n = 40,
|
|
312
|
-
className:
|
|
319
|
+
className: o,
|
|
313
320
|
starred: l = !1,
|
|
314
321
|
shape: d = "squircle"
|
|
315
322
|
}) => {
|
|
316
|
-
const a =
|
|
323
|
+
const a = hs(t), g = n < 32 ? "text-xs" : n < 56 ? "text-sm" : n < 120 ? "text-lg" : "text-4xl", h = d === "circle" ? { borderRadius: "50%" } : {
|
|
317
324
|
borderRadius: "33%",
|
|
318
325
|
"corner-shape": "superellipse(1.3)"
|
|
319
326
|
};
|
|
320
327
|
return /* @__PURE__ */ i(
|
|
321
328
|
"div",
|
|
322
329
|
{
|
|
323
|
-
className:
|
|
330
|
+
className: A("relative flex-shrink-0", o),
|
|
324
331
|
style: {
|
|
325
332
|
width: `${n}px`,
|
|
326
333
|
height: `${n}px`
|
|
@@ -345,7 +352,7 @@ const le = ({
|
|
|
345
352
|
"div",
|
|
346
353
|
{
|
|
347
354
|
"aria-hidden": "true",
|
|
348
|
-
className:
|
|
355
|
+
className: A(
|
|
349
356
|
"avatar-fallback flex h-full w-full items-center justify-center bg-[#E6E5E3] font-semibold select-none transition-colors",
|
|
350
357
|
g
|
|
351
358
|
),
|
|
@@ -355,7 +362,7 @@ const le = ({
|
|
|
355
362
|
]
|
|
356
363
|
}
|
|
357
364
|
);
|
|
358
|
-
},
|
|
365
|
+
}, fs = ({ size: t = 15 }) => /* @__PURE__ */ e(
|
|
359
366
|
"svg",
|
|
360
367
|
{
|
|
361
368
|
width: t,
|
|
@@ -372,45 +379,45 @@ const le = ({
|
|
|
372
379
|
}
|
|
373
380
|
)
|
|
374
381
|
}
|
|
375
|
-
),
|
|
382
|
+
), gs = (t) => {
|
|
376
383
|
var s;
|
|
377
384
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
|
|
378
|
-
},
|
|
385
|
+
}, xs = (t) => {
|
|
379
386
|
var s;
|
|
380
387
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
|
|
381
388
|
}, Be = (t) => {
|
|
382
389
|
var s;
|
|
383
390
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
|
|
384
|
-
},
|
|
391
|
+
}, bs = (t) => {
|
|
385
392
|
var s;
|
|
386
393
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_ATTACHMENT";
|
|
387
|
-
}, nt = (t) =>
|
|
394
|
+
}, nt = (t) => gs(t) || xs(t), Cs = (t) => {
|
|
388
395
|
var s;
|
|
389
396
|
return nt(t) && !((s = t.text) != null && s.trim());
|
|
390
397
|
}, Re = ({
|
|
391
398
|
message: t,
|
|
392
399
|
standalone: s = !1,
|
|
393
400
|
isMyMessage: n = !1,
|
|
394
|
-
hasAttachment:
|
|
401
|
+
hasAttachment: o = !1
|
|
395
402
|
}) => {
|
|
396
403
|
var C;
|
|
397
404
|
const l = nt(t), d = Be(t);
|
|
398
405
|
if (!l && !d)
|
|
399
406
|
return null;
|
|
400
407
|
if (l) {
|
|
401
|
-
const
|
|
402
|
-
if (!
|
|
403
|
-
const m = s ? "message-tip-standalone" : "message-tag message-tag--tip",
|
|
408
|
+
const S = (C = t.metadata) == null ? void 0 : C.amount_text;
|
|
409
|
+
if (!S) return null;
|
|
410
|
+
const m = s ? "message-tip-standalone" : "message-tag message-tag--tip", v = s ? `${S} tip` : `Delivered with ${S} tip`;
|
|
404
411
|
return /* @__PURE__ */ i("div", { className: m, children: [
|
|
405
412
|
/* @__PURE__ */ e(Qt, { size: s ? 14 : 12 }),
|
|
406
|
-
/* @__PURE__ */ e("span", { children:
|
|
413
|
+
/* @__PURE__ */ e("span", { children: v })
|
|
407
414
|
] });
|
|
408
415
|
}
|
|
409
|
-
const a = n &&
|
|
416
|
+
const a = n && o, c = a ? "Sent with AI" : "Sent with DM Agent", g = [
|
|
410
417
|
"message-chatbot-indicator",
|
|
411
418
|
n ? "message-chatbot-indicator--sender" : "message-chatbot-indicator--receiver",
|
|
412
419
|
a ? "message-chatbot-indicator--attachment" : "message-chatbot-indicator--text"
|
|
413
|
-
].join(" "), h = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__label", children: c }), b = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__icon", children: /* @__PURE__ */ e(
|
|
420
|
+
].join(" "), h = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__label", children: c }), b = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__icon", children: /* @__PURE__ */ e(fs, { size: a ? 12 : 15 }) });
|
|
414
421
|
return /* @__PURE__ */ e("div", { className: g, "data-testid": "message-chatbot-indicator", children: n && !a ? /* @__PURE__ */ i(he, { children: [
|
|
415
422
|
h,
|
|
416
423
|
b
|
|
@@ -420,37 +427,37 @@ const le = ({
|
|
|
420
427
|
] }) });
|
|
421
428
|
}, at = F.memo(
|
|
422
429
|
({ channel: t, unread: s }) => {
|
|
423
|
-
var
|
|
424
|
-
const { selectedChannel: n, onChannelSelect:
|
|
425
|
-
t &&
|
|
426
|
-
}, g = (
|
|
427
|
-
const
|
|
428
|
-
!
|
|
429
|
-
}, b = Object.values(((
|
|
430
|
-
(
|
|
431
|
-
var
|
|
432
|
-
return ((
|
|
430
|
+
var L, x, u, f;
|
|
431
|
+
const { selectedChannel: n, onChannelSelect: o, debug: l, renderMessagePreview: d } = cs(), a = (n == null ? void 0 : n.id) === (t == null ? void 0 : t.id), c = () => {
|
|
432
|
+
t && o(t);
|
|
433
|
+
}, g = (E) => {
|
|
434
|
+
const y = E.key === "Enter" || E.key === " ", D = E.repeat;
|
|
435
|
+
!y || D || (E.preventDefault(), c());
|
|
436
|
+
}, b = Object.values(((L = t == null ? void 0 : t.state) == null ? void 0 : L.members) || {}).find(
|
|
437
|
+
(E) => {
|
|
438
|
+
var y, D;
|
|
439
|
+
return ((y = E.user) == null ? void 0 : y.id) && E.user.id !== ((D = t == null ? void 0 : t._client) == null ? void 0 : D.userID);
|
|
433
440
|
}
|
|
434
|
-
), C = ((x = b == null ? void 0 : b.user) == null ? void 0 : x.name) || "Conversation",
|
|
435
|
-
var
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
438
|
-
for (let D =
|
|
439
|
-
if (
|
|
441
|
+
), C = ((x = b == null ? void 0 : b.user) == null ? void 0 : x.name) || "Conversation", S = (u = b == null ? void 0 : b.user) == null ? void 0 : u.image, m = (() => {
|
|
442
|
+
var y;
|
|
443
|
+
const E = (y = t == null ? void 0 : t.state) == null ? void 0 : y.messages;
|
|
444
|
+
if (E != null && E.length) {
|
|
445
|
+
for (let D = E.length - 1; D >= 0; D--)
|
|
446
|
+
if (E[D].type !== "system") return E[D];
|
|
440
447
|
}
|
|
441
|
-
})(),
|
|
448
|
+
})(), r = (() => {
|
|
442
449
|
var D, G;
|
|
443
450
|
if (m != null && m.text) return m.text;
|
|
444
451
|
if (((D = m == null ? void 0 : m.metadata) == null ? void 0 : D.custom_type) === "MESSAGE_TIP") return "💵 Sent a tip";
|
|
445
|
-
const
|
|
446
|
-
return
|
|
447
|
-
})(),
|
|
452
|
+
const y = (G = m == null ? void 0 : m.attachments) == null ? void 0 : G[0];
|
|
453
|
+
return y ? y.og_scrape_url ? y.og_scrape_url : y.type === "image" ? "📷 Sent an image" : y.type === "video" ? "🎥 Sent a video" : y.type === "audio" ? "🎵 Sent audio" : y.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
|
|
454
|
+
})(), p = m != null && m.created_at ? ms(new Date(m.created_at)) : "", M = m ? Be(m) : !1, N = d ? d(m, r) : `${M ? "✨ " : ""}${r}`, w = st(t), _ = s ?? 0;
|
|
448
455
|
return l && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
449
456
|
channelId: t == null ? void 0 : t.id,
|
|
450
457
|
isSelected: a,
|
|
451
458
|
participantName: C,
|
|
452
|
-
unreadCount:
|
|
453
|
-
hasTimestamp: !!
|
|
459
|
+
unreadCount: _,
|
|
460
|
+
hasTimestamp: !!p
|
|
454
461
|
}), /* @__PURE__ */ e(
|
|
455
462
|
"div",
|
|
456
463
|
{
|
|
@@ -458,7 +465,7 @@ const le = ({
|
|
|
458
465
|
tabIndex: 0,
|
|
459
466
|
onClick: c,
|
|
460
467
|
onKeyDown: g,
|
|
461
|
-
className:
|
|
468
|
+
className: A(
|
|
462
469
|
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
463
470
|
{
|
|
464
471
|
"bg-primary-alt/10 border-l-4 border-l-primary": a,
|
|
@@ -467,13 +474,13 @@ const le = ({
|
|
|
467
474
|
),
|
|
468
475
|
children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
469
476
|
/* @__PURE__ */ e(
|
|
470
|
-
|
|
477
|
+
ie,
|
|
471
478
|
{
|
|
472
479
|
id: ((f = b == null ? void 0 : b.user) == null ? void 0 : f.id) || t.id || "unknown",
|
|
473
480
|
name: C,
|
|
474
|
-
image:
|
|
481
|
+
image: S,
|
|
475
482
|
size: 44,
|
|
476
|
-
starred:
|
|
483
|
+
starred: w,
|
|
477
484
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
478
485
|
}
|
|
479
486
|
),
|
|
@@ -482,21 +489,21 @@ const le = ({
|
|
|
482
489
|
/* @__PURE__ */ i(
|
|
483
490
|
"h3",
|
|
484
491
|
{
|
|
485
|
-
className:
|
|
492
|
+
className: A(
|
|
486
493
|
"text-sm font-medium truncate",
|
|
487
494
|
a ? "text-primary" : "text-charcoal"
|
|
488
495
|
),
|
|
489
496
|
children: [
|
|
490
|
-
|
|
497
|
+
w && /* @__PURE__ */ e("span", { className: "sr-only", children: "Starred conversation. " }),
|
|
491
498
|
C
|
|
492
499
|
]
|
|
493
500
|
}
|
|
494
501
|
),
|
|
495
|
-
|
|
502
|
+
p && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: p })
|
|
496
503
|
] }),
|
|
497
504
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
498
505
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children: N }),
|
|
499
|
-
|
|
506
|
+
_ > 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: _ > 99 ? "99+" : _ })
|
|
500
507
|
] })
|
|
501
508
|
] })
|
|
502
509
|
] })
|
|
@@ -505,54 +512,61 @@ const le = ({
|
|
|
505
512
|
}
|
|
506
513
|
);
|
|
507
514
|
at.displayName = "CustomChannelPreview";
|
|
508
|
-
const
|
|
515
|
+
const Ns = { last_message_at: -1 }, rt = F.memo(
|
|
509
516
|
({
|
|
510
517
|
onChannelSelect: t,
|
|
511
518
|
selectedChannel: s,
|
|
512
519
|
filters: n,
|
|
513
|
-
allowNewMessagesFromUnfilteredChannels:
|
|
520
|
+
allowNewMessagesFromUnfilteredChannels: o = !1,
|
|
514
521
|
onMessageNew: l,
|
|
515
522
|
onAddedToChannel: d,
|
|
516
523
|
channelRenderFilterFn: a,
|
|
517
|
-
sort: c =
|
|
524
|
+
sort: c = Ns,
|
|
518
525
|
className: g,
|
|
519
526
|
customEmptyStateIndicator: h,
|
|
520
527
|
renderMessagePreview: b
|
|
521
528
|
}) => {
|
|
522
529
|
const C = F.useRef(0);
|
|
523
530
|
C.current++;
|
|
524
|
-
const { debug:
|
|
525
|
-
|
|
531
|
+
const { debug: S = !1 } = Me(), m = F.useCallback(
|
|
532
|
+
(r) => {
|
|
533
|
+
for (const p of r)
|
|
534
|
+
ls(p);
|
|
535
|
+
return a ? a(r) : r;
|
|
536
|
+
},
|
|
537
|
+
[a]
|
|
538
|
+
);
|
|
539
|
+
S && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
526
540
|
renderCount: C.current,
|
|
527
541
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
528
542
|
filters: n
|
|
529
543
|
});
|
|
530
|
-
const
|
|
544
|
+
const v = F.useMemo(
|
|
531
545
|
() => ({
|
|
532
546
|
selectedChannel: s,
|
|
533
547
|
onChannelSelect: t,
|
|
534
|
-
debug:
|
|
548
|
+
debug: S,
|
|
535
549
|
renderMessagePreview: b
|
|
536
550
|
}),
|
|
537
|
-
[s, t,
|
|
551
|
+
[s, t, S, b]
|
|
538
552
|
);
|
|
539
553
|
return /* @__PURE__ */ e(
|
|
540
554
|
"div",
|
|
541
555
|
{
|
|
542
|
-
className:
|
|
556
|
+
className: A(
|
|
543
557
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
544
558
|
g
|
|
545
559
|
),
|
|
546
|
-
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
|
|
560
|
+
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(is, { value: v, children: /* @__PURE__ */ e(
|
|
547
561
|
Ct,
|
|
548
562
|
{
|
|
549
563
|
filters: n,
|
|
550
564
|
sort: c,
|
|
551
565
|
options: { limit: 30 },
|
|
552
|
-
allowNewMessagesFromUnfilteredChannels:
|
|
566
|
+
allowNewMessagesFromUnfilteredChannels: o,
|
|
553
567
|
onMessageNew: l,
|
|
554
568
|
onAddedToChannel: d,
|
|
555
|
-
channelRenderFilterFn:
|
|
569
|
+
channelRenderFilterFn: m,
|
|
556
570
|
Preview: at,
|
|
557
571
|
EmptyStateIndicator: h
|
|
558
572
|
},
|
|
@@ -563,53 +577,38 @@ const Cs = { last_message_at: -1 }, rt = F.memo(
|
|
|
563
577
|
}
|
|
564
578
|
);
|
|
565
579
|
rt.displayName = "ChannelList";
|
|
566
|
-
function Ns(t) {
|
|
567
|
-
const s = K(null);
|
|
568
|
-
Z(() => {
|
|
569
|
-
const n = t.cid;
|
|
570
|
-
if (!n || s.current === n) return;
|
|
571
|
-
const r = t.state.pending_messages;
|
|
572
|
-
if (!(r != null && r.length)) {
|
|
573
|
-
s.current = n;
|
|
574
|
-
return;
|
|
575
|
-
}
|
|
576
|
-
for (const l of r)
|
|
577
|
-
t.state.addMessageSorted(l.message);
|
|
578
|
-
s.current = n;
|
|
579
|
-
}, [t]);
|
|
580
|
-
}
|
|
581
580
|
const we = ({
|
|
582
581
|
variant: t = "default",
|
|
583
582
|
className: s,
|
|
584
583
|
children: n,
|
|
585
|
-
...
|
|
584
|
+
...o
|
|
586
585
|
}) => /* @__PURE__ */ e(
|
|
587
586
|
"button",
|
|
588
587
|
{
|
|
589
588
|
type: "button",
|
|
590
|
-
className:
|
|
589
|
+
className: A(
|
|
591
590
|
"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",
|
|
592
591
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
593
592
|
s
|
|
594
593
|
),
|
|
595
|
-
...
|
|
594
|
+
...o,
|
|
596
595
|
children: n
|
|
597
596
|
}
|
|
598
597
|
);
|
|
599
|
-
function ot({ label: t, className: s, children: n, ...
|
|
598
|
+
function ot({ label: t, className: s, children: n, ...o }) {
|
|
600
599
|
return /* @__PURE__ */ i(
|
|
601
600
|
"button",
|
|
602
601
|
{
|
|
603
602
|
type: "button",
|
|
604
|
-
className:
|
|
603
|
+
className: A(
|
|
605
604
|
"rounded-full p-2 transition-colors focus-ring",
|
|
606
605
|
{
|
|
607
|
-
"cursor-not-allowed opacity-50":
|
|
608
|
-
"hover:bg-sand": !
|
|
606
|
+
"cursor-not-allowed opacity-50": o.disabled,
|
|
607
|
+
"hover:bg-sand": !o.disabled
|
|
609
608
|
},
|
|
610
609
|
s
|
|
611
610
|
),
|
|
612
|
-
...
|
|
611
|
+
...o,
|
|
613
612
|
children: [
|
|
614
613
|
/* @__PURE__ */ e("span", { className: "sr-only", children: t }),
|
|
615
614
|
n
|
|
@@ -624,7 +623,7 @@ const ps = ({
|
|
|
624
623
|
dialogRef: t,
|
|
625
624
|
onClose: s,
|
|
626
625
|
participant: n,
|
|
627
|
-
channel:
|
|
626
|
+
channel: o,
|
|
628
627
|
followerStatusLabel: l,
|
|
629
628
|
onLeaveConversation: d,
|
|
630
629
|
onBlockParticipant: a,
|
|
@@ -633,10 +632,10 @@ const ps = ({
|
|
|
633
632
|
onBlockParticipantClick: h,
|
|
634
633
|
onReportParticipantClick: b,
|
|
635
634
|
customProfileContent: C,
|
|
636
|
-
customChannelActions:
|
|
635
|
+
customChannelActions: S
|
|
637
636
|
}) => {
|
|
638
|
-
var
|
|
639
|
-
const { service: m, debug:
|
|
637
|
+
var Z, J, P, V, z, ce, de;
|
|
638
|
+
const { service: m, debug: v } = Me(), [r, p] = k(!1), [M, N] = k(!1), [w, _] = k(!1), L = U(async () => {
|
|
640
639
|
var R;
|
|
641
640
|
if (!(!m || !((R = n == null ? void 0 : n.user) != null && R.id)))
|
|
642
641
|
try {
|
|
@@ -646,24 +645,24 @@ const ps = ({
|
|
|
646
645
|
return W.blocked_user_id === ((ne = n == null ? void 0 : n.user) == null ? void 0 : ne.id);
|
|
647
646
|
}
|
|
648
647
|
);
|
|
649
|
-
|
|
648
|
+
p(Y);
|
|
650
649
|
} catch (O) {
|
|
651
650
|
console.error(
|
|
652
651
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
653
652
|
O
|
|
654
653
|
);
|
|
655
654
|
}
|
|
656
|
-
}, [m, (
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}, [
|
|
655
|
+
}, [m, (Z = n == null ? void 0 : n.user) == null ? void 0 : Z.id]);
|
|
656
|
+
X(() => {
|
|
657
|
+
L();
|
|
658
|
+
}, [L]);
|
|
660
659
|
const x = async () => {
|
|
661
660
|
var R;
|
|
662
661
|
if (!M) {
|
|
663
|
-
g == null || g(),
|
|
662
|
+
g == null || g(), v && console.log("[ChannelInfoDialog] Leave conversation", o.cid), N(!0);
|
|
664
663
|
try {
|
|
665
|
-
const O = ((R =
|
|
666
|
-
await
|
|
664
|
+
const O = ((R = o._client) == null ? void 0 : R.userID) ?? null;
|
|
665
|
+
await o.hide(O, !1), d && await d(o), s();
|
|
667
666
|
} catch (O) {
|
|
668
667
|
console.error("[ChannelInfoDialog] Failed to leave conversation", O);
|
|
669
668
|
} finally {
|
|
@@ -672,29 +671,29 @@ const ps = ({
|
|
|
672
671
|
}
|
|
673
672
|
}, u = async () => {
|
|
674
673
|
var R, O, Y;
|
|
675
|
-
if (!(
|
|
676
|
-
h == null || h(),
|
|
674
|
+
if (!(w || !m)) {
|
|
675
|
+
h == null || h(), v && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), _(!0);
|
|
677
676
|
try {
|
|
678
677
|
await m.blockUser((O = n == null ? void 0 : n.user) == null ? void 0 : O.id), a && await a((Y = n == null ? void 0 : n.user) == null ? void 0 : Y.id), s();
|
|
679
678
|
} catch (W) {
|
|
680
679
|
console.error("[ChannelInfoDialog] Failed to block member", W);
|
|
681
680
|
} finally {
|
|
682
|
-
|
|
681
|
+
_(!1);
|
|
683
682
|
}
|
|
684
683
|
}
|
|
685
684
|
}, f = async () => {
|
|
686
685
|
var R, O, Y;
|
|
687
|
-
if (!(
|
|
688
|
-
h == null || h(),
|
|
686
|
+
if (!(w || !m)) {
|
|
687
|
+
h == null || h(), v && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), _(!0);
|
|
689
688
|
try {
|
|
690
689
|
await m.unBlockUser((O = n == null ? void 0 : n.user) == null ? void 0 : O.id), a && await a((Y = n == null ? void 0 : n.user) == null ? void 0 : Y.id), s();
|
|
691
690
|
} catch (W) {
|
|
692
691
|
console.error("[ChannelInfoDialog] Failed to unblock member", W);
|
|
693
692
|
} finally {
|
|
694
|
-
|
|
693
|
+
_(!1);
|
|
695
694
|
}
|
|
696
695
|
}
|
|
697
|
-
},
|
|
696
|
+
}, E = () => {
|
|
698
697
|
b == null || b(), s(), window.open(
|
|
699
698
|
"https://linktr.ee/s/about/trust-center/report",
|
|
700
699
|
"_blank",
|
|
@@ -702,7 +701,7 @@ const ps = ({
|
|
|
702
701
|
);
|
|
703
702
|
};
|
|
704
703
|
if (!n) return null;
|
|
705
|
-
const
|
|
704
|
+
const y = ((J = n.user) == null ? void 0 : J.name) || ((P = n.user) == null ? void 0 : P.id) || "Unknown member", D = (V = n.user) == null ? void 0 : V.image, G = (z = n.user) == null ? void 0 : z.email, T = (ce = n.user) == null ? void 0 : ce.username, $ = G || (T ? `linktr.ee/${T}` : void 0), se = ((de = n.user) == null ? void 0 : de.id) || "unknown";
|
|
706
705
|
return (
|
|
707
706
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
708
707
|
/* @__PURE__ */ e(
|
|
@@ -727,17 +726,17 @@ const ps = ({
|
|
|
727
726
|
style: { backgroundColor: "#FBFAF9" },
|
|
728
727
|
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
729
728
|
/* @__PURE__ */ e(
|
|
730
|
-
|
|
729
|
+
ie,
|
|
731
730
|
{
|
|
732
731
|
id: se,
|
|
733
|
-
name:
|
|
732
|
+
name: y,
|
|
734
733
|
image: D,
|
|
735
734
|
size: 88,
|
|
736
735
|
shape: "circle"
|
|
737
736
|
}
|
|
738
737
|
),
|
|
739
738
|
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
740
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
739
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: y }),
|
|
741
740
|
$ && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: $ }),
|
|
742
741
|
l && !C && /* @__PURE__ */ e(
|
|
743
742
|
"span",
|
|
@@ -771,14 +770,14 @@ const ps = ({
|
|
|
771
770
|
]
|
|
772
771
|
}
|
|
773
772
|
) }),
|
|
774
|
-
/* @__PURE__ */ e("li", { children:
|
|
773
|
+
/* @__PURE__ */ e("li", { children: r ? /* @__PURE__ */ i(
|
|
775
774
|
we,
|
|
776
775
|
{
|
|
777
776
|
onClick: f,
|
|
778
|
-
disabled:
|
|
779
|
-
"aria-busy":
|
|
777
|
+
disabled: w,
|
|
778
|
+
"aria-busy": w,
|
|
780
779
|
children: [
|
|
781
|
-
|
|
780
|
+
w ? /* @__PURE__ */ e(_e, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(He, { className: "h-5 w-5" }),
|
|
782
781
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
783
782
|
]
|
|
784
783
|
}
|
|
@@ -786,19 +785,19 @@ const ps = ({
|
|
|
786
785
|
we,
|
|
787
786
|
{
|
|
788
787
|
onClick: u,
|
|
789
|
-
disabled:
|
|
790
|
-
"aria-busy":
|
|
788
|
+
disabled: w,
|
|
789
|
+
"aria-busy": w,
|
|
791
790
|
children: [
|
|
792
|
-
|
|
791
|
+
w ? /* @__PURE__ */ e(_e, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(He, { className: "h-5 w-5" }),
|
|
793
792
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
794
793
|
]
|
|
795
794
|
}
|
|
796
795
|
) }),
|
|
797
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(we, { variant: "danger", onClick:
|
|
796
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(we, { variant: "danger", onClick: E, children: [
|
|
798
797
|
/* @__PURE__ */ e(ts, { className: "h-5 w-5" }),
|
|
799
798
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
800
799
|
] }) }),
|
|
801
|
-
|
|
800
|
+
S
|
|
802
801
|
] })
|
|
803
802
|
] })
|
|
804
803
|
] })
|
|
@@ -810,31 +809,31 @@ function vs(t) {
|
|
|
810
809
|
return t != null && t.length ? t.some((s) => s.type === Fe) ? "down" : t.some((s) => s.type === Pe) ? "up" : null : null;
|
|
811
810
|
}
|
|
812
811
|
function ws(t) {
|
|
813
|
-
const { channel: s } = Ie(), { client: n } = Ke("useMessageVote"),
|
|
812
|
+
const { channel: s } = Ie(), { client: n } = Ke("useMessageVote"), o = Le(
|
|
814
813
|
() => vs(t.own_reactions),
|
|
815
814
|
[t.own_reactions]
|
|
816
815
|
), l = U(async () => {
|
|
817
816
|
if (n != null && n.userID)
|
|
818
817
|
try {
|
|
819
|
-
|
|
818
|
+
o === "up" ? await s.deleteReaction(t.id, Pe) : await s.sendReaction(
|
|
820
819
|
t.id,
|
|
821
820
|
{ type: Pe },
|
|
822
821
|
{ enforce_unique: !0, skip_push: !0 }
|
|
823
822
|
);
|
|
824
823
|
} catch {
|
|
825
824
|
}
|
|
826
|
-
}, [s, n == null ? void 0 : n.userID, t.id,
|
|
825
|
+
}, [s, n == null ? void 0 : n.userID, t.id, o]), d = U(async () => {
|
|
827
826
|
if (n != null && n.userID)
|
|
828
827
|
try {
|
|
829
|
-
|
|
828
|
+
o === "down" ? await s.deleteReaction(t.id, Fe) : await s.sendReaction(
|
|
830
829
|
t.id,
|
|
831
830
|
{ type: Fe },
|
|
832
831
|
{ enforce_unique: !0, skip_push: !0 }
|
|
833
832
|
);
|
|
834
833
|
} catch {
|
|
835
834
|
}
|
|
836
|
-
}, [s, n == null ? void 0 : n.userID, t.id,
|
|
837
|
-
return { selected:
|
|
835
|
+
}, [s, n == null ? void 0 : n.userID, t.id, o]);
|
|
836
|
+
return { selected: o, voteUp: l, voteDown: d };
|
|
838
837
|
}
|
|
839
838
|
const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => import("./Visitor-C4WqnN8H.js")), Je = () => /* @__PURE__ */ e(
|
|
840
839
|
"div",
|
|
@@ -890,11 +889,11 @@ const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => impo
|
|
|
890
889
|
}
|
|
891
890
|
)
|
|
892
891
|
] }), Ts = (t) => {
|
|
893
|
-
var ge, xe, be,
|
|
892
|
+
var ge, xe, be, le, K, Ce, Ne, pe;
|
|
894
893
|
const {
|
|
895
894
|
additionalMessageInputProps: s,
|
|
896
895
|
chatbotVotingEnabled: n,
|
|
897
|
-
onAttachmentUnlock:
|
|
896
|
+
onAttachmentUnlock: o,
|
|
898
897
|
onAttachmentDownload: l,
|
|
899
898
|
editing: d,
|
|
900
899
|
endOfGroup: a,
|
|
@@ -903,57 +902,57 @@ const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => impo
|
|
|
903
902
|
handleAction: h,
|
|
904
903
|
handleOpenThread: b,
|
|
905
904
|
handleRetry: C,
|
|
906
|
-
highlighted:
|
|
905
|
+
highlighted: S,
|
|
907
906
|
isMessageAIGenerated: m,
|
|
908
|
-
isMyMessage:
|
|
909
|
-
message:
|
|
910
|
-
renderText:
|
|
907
|
+
isMyMessage: v,
|
|
908
|
+
message: r,
|
|
909
|
+
renderText: p,
|
|
911
910
|
threadList: M
|
|
912
|
-
} = t, { client: N } = Ke("CustomMessage"), { channel:
|
|
913
|
-
Attachment:
|
|
911
|
+
} = t, { client: N } = Ke("CustomMessage"), { channel: w } = Ie("CustomMessage"), [_, L] = k(!1), x = yt(r.id), { selected: u, voteUp: f, voteDown: E } = ws(r), {
|
|
912
|
+
Attachment: y = wt,
|
|
914
913
|
EditMessageModal: D = _t,
|
|
915
914
|
MessageBlocked: G = Et,
|
|
916
915
|
MessageBouncePrompt: T = St,
|
|
917
916
|
MessageDeleted: $ = It,
|
|
918
917
|
MessageIsThreadReplyInChannelButtonIndicator: se = Mt,
|
|
919
|
-
MessageRepliesCountButton:
|
|
920
|
-
ReminderNotification:
|
|
918
|
+
MessageRepliesCountButton: Z = kt,
|
|
919
|
+
ReminderNotification: J = Tt,
|
|
921
920
|
StreamedMessageText: P = Dt,
|
|
922
921
|
PinIndicator: V
|
|
923
|
-
} = vt("CustomMessage"), z = Rt(
|
|
924
|
-
() => m == null ? void 0 : m(
|
|
925
|
-
[m,
|
|
922
|
+
} = vt("CustomMessage"), z = Rt(r), ce = At(r), de = Le(
|
|
923
|
+
() => m == null ? void 0 : m(r),
|
|
924
|
+
[m, r]
|
|
926
925
|
), R = Le(
|
|
927
|
-
() => !
|
|
928
|
-
[
|
|
926
|
+
() => !r.shared_location && !r.attachments ? [] : r.shared_location ? [r.shared_location, ...r.attachments ?? []] : r.attachments,
|
|
927
|
+
[r]
|
|
929
928
|
);
|
|
930
|
-
if (Lt(
|
|
929
|
+
if (Lt(r))
|
|
931
930
|
return null;
|
|
932
|
-
if (
|
|
933
|
-
return /* @__PURE__ */ e($, { message:
|
|
934
|
-
if (Ut(
|
|
931
|
+
if (r.deleted_at || r.type === "deleted")
|
|
932
|
+
return /* @__PURE__ */ e($, { message: r });
|
|
933
|
+
if (Ut(r))
|
|
935
934
|
return /* @__PURE__ */ e(G, {});
|
|
936
|
-
const O = !M && !!
|
|
935
|
+
const O = !M && !!r.reply_count, Y = !M && r.show_in_channel && r.parent_id, W = r.status === "failed" && ((ge = r.error) == null ? void 0 : ge.status) !== 403, ne = Pt(r);
|
|
937
936
|
let ee;
|
|
938
|
-
W ? ee = () => C(
|
|
939
|
-
const
|
|
937
|
+
W ? ee = () => C(r) : ne && (ee = () => L(!0));
|
|
938
|
+
const ae = v(), Ge = A(
|
|
940
939
|
"str-chat__message str-chat__message-simple",
|
|
941
|
-
`str-chat__message--${
|
|
942
|
-
`str-chat__message--${
|
|
943
|
-
|
|
944
|
-
|
|
940
|
+
`str-chat__message--${r.type}`,
|
|
941
|
+
`str-chat__message--${r.status}`,
|
|
942
|
+
ae ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
943
|
+
r.text ? "str-chat__message--has-text" : "has-no-text",
|
|
945
944
|
{
|
|
946
945
|
"str-chat__message--has-attachment": z,
|
|
947
|
-
"str-chat__message--highlighted":
|
|
948
|
-
"str-chat__message--pinned pinned-message":
|
|
949
|
-
"str-chat__message--with-reactions":
|
|
950
|
-
"str-chat__message-send-can-be-retried": (
|
|
946
|
+
"str-chat__message--highlighted": S,
|
|
947
|
+
"str-chat__message--pinned pinned-message": r.pinned,
|
|
948
|
+
"str-chat__message--with-reactions": ce,
|
|
949
|
+
"str-chat__message-send-can-be-retried": (r == null ? void 0 : r.status) === "failed" && ((xe = r == null ? void 0 : r.error) == null ? void 0 : xe.status) !== 403,
|
|
951
950
|
"str-chat__message-with-thread-link": O || Y,
|
|
952
951
|
"str-chat__virtual-message__wrapper--end": a,
|
|
953
952
|
"str-chat__virtual-message__wrapper--first": c,
|
|
954
953
|
"str-chat__virtual-message__wrapper--group": g
|
|
955
954
|
}
|
|
956
|
-
), q =
|
|
955
|
+
), q = r.poll_id && N.polls.fromState(r.poll_id), me = Cs(r), re = Be(r), oe = bs(r), te = !!(R != null && R.length && !r.quoted_message), fe = re && ae && te;
|
|
957
956
|
return /* @__PURE__ */ i(he, { children: [
|
|
958
957
|
d && /* @__PURE__ */ e(
|
|
959
958
|
D,
|
|
@@ -961,30 +960,30 @@ const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => impo
|
|
|
961
960
|
additionalMessageInputProps: s
|
|
962
961
|
}
|
|
963
962
|
),
|
|
964
|
-
|
|
963
|
+
_ && /* @__PURE__ */ e(
|
|
965
964
|
Ft,
|
|
966
965
|
{
|
|
967
966
|
MessageBouncePrompt: T,
|
|
968
|
-
onClose: () =>
|
|
969
|
-
open:
|
|
967
|
+
onClose: () => L(!1),
|
|
968
|
+
open: _
|
|
970
969
|
}
|
|
971
970
|
),
|
|
972
971
|
/* @__PURE__ */ i("div", { className: Ge, children: [
|
|
973
972
|
V && /* @__PURE__ */ e(V, {}),
|
|
974
|
-
!!x && /* @__PURE__ */ e(
|
|
975
|
-
|
|
976
|
-
|
|
973
|
+
!!x && /* @__PURE__ */ e(J, { reminder: x }),
|
|
974
|
+
r.user && /* @__PURE__ */ e(
|
|
975
|
+
ie,
|
|
977
976
|
{
|
|
978
977
|
className: "str-chat__avatar str-chat__message-sender-avatar",
|
|
979
|
-
id:
|
|
980
|
-
image:
|
|
981
|
-
name:
|
|
978
|
+
id: r.user.id,
|
|
979
|
+
image: r.user.image,
|
|
980
|
+
name: r.user.name || r.user.id
|
|
982
981
|
}
|
|
983
982
|
),
|
|
984
983
|
/* @__PURE__ */ e(
|
|
985
984
|
"div",
|
|
986
985
|
{
|
|
987
|
-
className:
|
|
986
|
+
className: A("str-chat__message-inner", {
|
|
988
987
|
"str-chat__simple-message--error-failed": W || ne
|
|
989
988
|
}),
|
|
990
989
|
"data-testid": "message-inner",
|
|
@@ -998,79 +997,79 @@ const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => impo
|
|
|
998
997
|
marginInlineEnd: 0,
|
|
999
998
|
marginInlineStart: 0
|
|
1000
999
|
},
|
|
1001
|
-
children:
|
|
1000
|
+
children: oe ? /* @__PURE__ */ i("div", { className: A("flex flex-col gap-1", ae ? "items-end" : "items-start"), children: [
|
|
1002
1001
|
/* @__PURE__ */ e(
|
|
1003
1002
|
Ss,
|
|
1004
1003
|
{
|
|
1005
|
-
title: (be =
|
|
1006
|
-
mimeType: (
|
|
1007
|
-
thumbnail: (
|
|
1008
|
-
amountText: (Ce =
|
|
1009
|
-
detail: (Ne =
|
|
1010
|
-
paymentStatus: (pe =
|
|
1011
|
-
onUnlock:
|
|
1012
|
-
onDownload: l ? () => l(
|
|
1004
|
+
title: (be = r.metadata) == null ? void 0 : be.attachment_title,
|
|
1005
|
+
mimeType: (le = r.metadata) == null ? void 0 : le.attachment_mime_type,
|
|
1006
|
+
thumbnail: (K = r.metadata) == null ? void 0 : K.attachment_thumbnail,
|
|
1007
|
+
amountText: (Ce = r.metadata) == null ? void 0 : Ce.amount_text,
|
|
1008
|
+
detail: (Ne = r.metadata) == null ? void 0 : Ne.attachment_detail,
|
|
1009
|
+
paymentStatus: (pe = r.metadata) == null ? void 0 : pe.payment_status,
|
|
1010
|
+
onUnlock: o ? () => o(r, w) : void 0,
|
|
1011
|
+
onDownload: l ? () => l(r, w) : void 0
|
|
1013
1012
|
}
|
|
1014
1013
|
),
|
|
1015
|
-
|
|
1014
|
+
r.text && /* @__PURE__ */ e("div", { className: "str-chat__message-bubble-wrapper", children: /* @__PURE__ */ e("div", { className: "str-chat__message-bubble", children: /* @__PURE__ */ e(ze, { message: r, renderText: p }) }) })
|
|
1016
1015
|
] }) : me ? (
|
|
1017
1016
|
/* Tip-only messages render as a standalone bubble */
|
|
1018
|
-
/* @__PURE__ */ e(Re, { message:
|
|
1017
|
+
/* @__PURE__ */ e(Re, { message: r, standalone: !0 })
|
|
1019
1018
|
) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
1020
1019
|
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
1021
|
-
|
|
1020
|
+
re && !fe && /* @__PURE__ */ e(
|
|
1022
1021
|
Re,
|
|
1023
1022
|
{
|
|
1024
|
-
message:
|
|
1023
|
+
message: r,
|
|
1025
1024
|
hasAttachment: te,
|
|
1026
|
-
isMyMessage:
|
|
1025
|
+
isMyMessage: ae
|
|
1027
1026
|
}
|
|
1028
1027
|
),
|
|
1029
1028
|
q && /* @__PURE__ */ e(Ot, { poll: q }),
|
|
1030
|
-
R != null && R.length && !
|
|
1031
|
-
|
|
1029
|
+
R != null && R.length && !r.quoted_message ? /* @__PURE__ */ e(
|
|
1030
|
+
y,
|
|
1032
1031
|
{
|
|
1033
1032
|
actionHandler: h,
|
|
1034
1033
|
attachments: R
|
|
1035
1034
|
}
|
|
1036
1035
|
) : null,
|
|
1037
|
-
|
|
1036
|
+
de ? /* @__PURE__ */ e(
|
|
1038
1037
|
P,
|
|
1039
1038
|
{
|
|
1040
|
-
message:
|
|
1041
|
-
renderText:
|
|
1039
|
+
message: r,
|
|
1040
|
+
renderText: p
|
|
1042
1041
|
}
|
|
1043
|
-
) : /* @__PURE__ */ e(ze, { message:
|
|
1042
|
+
) : /* @__PURE__ */ e(ze, { message: r, renderText: p }),
|
|
1044
1043
|
/* @__PURE__ */ e(Bt, {})
|
|
1045
1044
|
] }),
|
|
1046
|
-
(!
|
|
1045
|
+
(!re || fe) && /* @__PURE__ */ e(
|
|
1047
1046
|
Re,
|
|
1048
1047
|
{
|
|
1049
|
-
message:
|
|
1048
|
+
message: r,
|
|
1050
1049
|
hasAttachment: te,
|
|
1051
|
-
isMyMessage:
|
|
1050
|
+
isMyMessage: ae
|
|
1052
1051
|
}
|
|
1053
1052
|
),
|
|
1054
|
-
n &&
|
|
1053
|
+
n && re && /* @__PURE__ */ e(
|
|
1055
1054
|
ks,
|
|
1056
1055
|
{
|
|
1057
1056
|
selected: u,
|
|
1058
1057
|
onVoteUp: f,
|
|
1059
|
-
onVoteDown:
|
|
1058
|
+
onVoteDown: E
|
|
1060
1059
|
}
|
|
1061
1060
|
)
|
|
1062
1061
|
] })
|
|
1063
1062
|
}
|
|
1064
1063
|
),
|
|
1065
1064
|
O && /* @__PURE__ */ e(
|
|
1066
|
-
|
|
1065
|
+
Z,
|
|
1067
1066
|
{
|
|
1068
1067
|
onClick: b,
|
|
1069
|
-
reply_count:
|
|
1068
|
+
reply_count: r.reply_count
|
|
1070
1069
|
}
|
|
1071
1070
|
),
|
|
1072
1071
|
Y && /* @__PURE__ */ e(se, {})
|
|
1073
|
-
] },
|
|
1072
|
+
] }, r.id)
|
|
1074
1073
|
] });
|
|
1075
1074
|
}, Ds = F.memo(
|
|
1076
1075
|
Ts,
|
|
@@ -1086,7 +1085,7 @@ const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => impo
|
|
|
1086
1085
|
link: t,
|
|
1087
1086
|
onDismiss: s
|
|
1088
1087
|
}) => {
|
|
1089
|
-
const { og_scrape_url: n, title:
|
|
1088
|
+
const { og_scrape_url: n, title: o, image_url: l } = t;
|
|
1090
1089
|
return /* @__PURE__ */ i(
|
|
1091
1090
|
"a",
|
|
1092
1091
|
{
|
|
@@ -1099,7 +1098,7 @@ const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => impo
|
|
|
1099
1098
|
"img",
|
|
1100
1099
|
{
|
|
1101
1100
|
src: l,
|
|
1102
|
-
alt:
|
|
1101
|
+
alt: o || "",
|
|
1103
1102
|
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
1104
1103
|
}
|
|
1105
1104
|
),
|
|
@@ -1116,7 +1115,7 @@ const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => impo
|
|
|
1116
1115
|
}
|
|
1117
1116
|
),
|
|
1118
1117
|
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
1119
|
-
|
|
1118
|
+
o && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: o }),
|
|
1120
1119
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
1121
1120
|
] })
|
|
1122
1121
|
]
|
|
@@ -1185,8 +1184,8 @@ const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => impo
|
|
|
1185
1184
|
], $s = {
|
|
1186
1185
|
SYSTEM_AGE_SAFETY_BLOCKED: "This user isn’t able to reply because they don’t meet our age safety guidelines."
|
|
1187
1186
|
}, Ae = "age safety guidelines.", js = "https://linktr.ee/s/about/contact", Xe = (t) => Os.includes(t), zs = (t) => Gs.includes(t), Hs = (t) => {
|
|
1188
|
-
var
|
|
1189
|
-
const s = (
|
|
1187
|
+
var o;
|
|
1188
|
+
const s = (o = t.metadata) == null ? void 0 : o.custom_type;
|
|
1190
1189
|
if (Xe(s))
|
|
1191
1190
|
return {
|
|
1192
1191
|
kind: "dm-agent",
|
|
@@ -1223,12 +1222,12 @@ const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => impo
|
|
|
1223
1222
|
t.slice(n)
|
|
1224
1223
|
] });
|
|
1225
1224
|
}, Ys = (t) => {
|
|
1226
|
-
var
|
|
1225
|
+
var o, l;
|
|
1227
1226
|
const s = t.message.hide_date === !0, n = Hs(
|
|
1228
1227
|
t.message
|
|
1229
1228
|
);
|
|
1230
1229
|
if ((n == null ? void 0 : n.kind) === "dm-agent") {
|
|
1231
|
-
const d = ((
|
|
1230
|
+
const d = ((o = t.message.text) == null ? void 0 : o.trim()) || Bs[n.type];
|
|
1232
1231
|
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
1233
1232
|
/* @__PURE__ */ i(
|
|
1234
1233
|
"div",
|
|
@@ -1291,7 +1290,7 @@ const _s = F.lazy(() => import("./Creator-VyMyIk2b.js")), Es = F.lazy(() => impo
|
|
|
1291
1290
|
}, Ws = () => null, qs = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
1292
1291
|
"div",
|
|
1293
1292
|
{
|
|
1294
|
-
className:
|
|
1293
|
+
className: A("flex items-center justify-center h-full", t),
|
|
1295
1294
|
children: [
|
|
1296
1295
|
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1297
1296
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
@@ -1340,22 +1339,22 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1340
1339
|
onBack: t,
|
|
1341
1340
|
showBackButton: s,
|
|
1342
1341
|
onShowInfo: n,
|
|
1343
|
-
canShowInfo:
|
|
1342
|
+
canShowInfo: o,
|
|
1344
1343
|
showStarButton: l = !1
|
|
1345
1344
|
}) => {
|
|
1346
|
-
var C,
|
|
1345
|
+
var C, S, m, v, r;
|
|
1347
1346
|
const { channel: d } = Ie(), a = F.useMemo(() => Object.values(d.state.members || {}).find(
|
|
1348
1347
|
(M) => {
|
|
1349
1348
|
var N;
|
|
1350
1349
|
return ((N = M.user) == null ? void 0 : N.id) && M.user.id !== d._client.userID;
|
|
1351
1350
|
}
|
|
1352
|
-
), [d._client.userID, d.state.members]), c = ((C = a == null ? void 0 : a.user) == null ? void 0 : C.name) || ((
|
|
1351
|
+
), [d._client.userID, d.state.members]), c = ((C = a == null ? void 0 : a.user) == null ? void 0 : C.name) || ((S = a == null ? void 0 : a.user) == null ? void 0 : S.id) || "Unknown member", g = (m = a == null ? void 0 : a.user) == null ? void 0 : m.image, h = st(d), b = async () => {
|
|
1353
1352
|
try {
|
|
1354
1353
|
h ? await d.unpin() : await d.pin();
|
|
1355
|
-
} catch (
|
|
1354
|
+
} catch (p) {
|
|
1356
1355
|
console.error(
|
|
1357
1356
|
"[CustomChannelHeader] Failed to update pinned status:",
|
|
1358
|
-
|
|
1357
|
+
p
|
|
1359
1358
|
);
|
|
1360
1359
|
}
|
|
1361
1360
|
};
|
|
@@ -1374,9 +1373,9 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1374
1373
|
) }),
|
|
1375
1374
|
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
1376
1375
|
/* @__PURE__ */ e(
|
|
1377
|
-
|
|
1376
|
+
ie,
|
|
1378
1377
|
{
|
|
1379
|
-
id: ((
|
|
1378
|
+
id: ((v = a == null ? void 0 : a.user) == null ? void 0 : v.id) || d.id || "unknown",
|
|
1380
1379
|
name: c,
|
|
1381
1380
|
image: g,
|
|
1382
1381
|
starred: l && h,
|
|
@@ -1396,7 +1395,7 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1396
1395
|
children: /* @__PURE__ */ e(
|
|
1397
1396
|
Ue,
|
|
1398
1397
|
{
|
|
1399
|
-
className:
|
|
1398
|
+
className: A("size-5", {
|
|
1400
1399
|
"text-yellow-600": h,
|
|
1401
1400
|
"text-black/90": !h
|
|
1402
1401
|
}),
|
|
@@ -1430,9 +1429,9 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1430
1429
|
}
|
|
1431
1430
|
),
|
|
1432
1431
|
/* @__PURE__ */ e(
|
|
1433
|
-
|
|
1432
|
+
ie,
|
|
1434
1433
|
{
|
|
1435
|
-
id: ((
|
|
1434
|
+
id: ((r = a == null ? void 0 : a.user) == null ? void 0 : r.id) || d.id || "unknown",
|
|
1436
1435
|
name: c,
|
|
1437
1436
|
image: g,
|
|
1438
1437
|
starred: l && h,
|
|
@@ -1452,7 +1451,7 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1452
1451
|
children: /* @__PURE__ */ e(
|
|
1453
1452
|
Ue,
|
|
1454
1453
|
{
|
|
1455
|
-
className:
|
|
1454
|
+
className: A("size-5", {
|
|
1456
1455
|
"text-yellow-600": h,
|
|
1457
1456
|
"text-black/90": !h
|
|
1458
1457
|
}),
|
|
@@ -1461,7 +1460,7 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1461
1460
|
)
|
|
1462
1461
|
}
|
|
1463
1462
|
),
|
|
1464
|
-
|
|
1463
|
+
o && n && /* @__PURE__ */ e(
|
|
1465
1464
|
"button",
|
|
1466
1465
|
{
|
|
1467
1466
|
className: ue,
|
|
@@ -1478,7 +1477,7 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1478
1477
|
onBack: t,
|
|
1479
1478
|
showBackButton: s,
|
|
1480
1479
|
renderMessageInputActions: n,
|
|
1481
|
-
renderConversationFooter:
|
|
1480
|
+
renderConversationFooter: o,
|
|
1482
1481
|
onLeaveConversation: l,
|
|
1483
1482
|
onBlockParticipant: d,
|
|
1484
1483
|
showDeleteConversation: a = !0,
|
|
@@ -1487,21 +1486,19 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1487
1486
|
onReportParticipantClick: h,
|
|
1488
1487
|
showStarButton: b = !1,
|
|
1489
1488
|
chatbotVotingEnabled: C = !1,
|
|
1490
|
-
onAttachmentUnlock:
|
|
1489
|
+
onAttachmentUnlock: S,
|
|
1491
1490
|
onAttachmentDownload: m,
|
|
1492
|
-
renderChannelBanner:
|
|
1493
|
-
customProfileContent:
|
|
1494
|
-
customChannelActions:
|
|
1491
|
+
renderChannelBanner: v,
|
|
1492
|
+
customProfileContent: r,
|
|
1493
|
+
customChannelActions: p,
|
|
1495
1494
|
renderMessage: M
|
|
1496
1495
|
}) => {
|
|
1497
|
-
const { channel: N } = Ie()
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
var p;
|
|
1502
|
-
return ((p = _.user) == null ? void 0 : p.id) && _.user.id !== N._client.userID;
|
|
1496
|
+
const { channel: N } = Ie(), w = Q(null), _ = F.useMemo(() => Object.values(N.state.members || {}).find(
|
|
1497
|
+
(E) => {
|
|
1498
|
+
var y;
|
|
1499
|
+
return ((y = E.user) == null ? void 0 : y.id) && E.user.id !== N._client.userID;
|
|
1503
1500
|
}
|
|
1504
|
-
), [N._client.userID, N.state.members]),
|
|
1501
|
+
), [N._client.userID, N.state.members]), L = F.useMemo(() => {
|
|
1505
1502
|
const f = N.data ?? {};
|
|
1506
1503
|
if (f.followerStatus)
|
|
1507
1504
|
return String(f.followerStatus);
|
|
@@ -1509,10 +1506,10 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1509
1506
|
return f.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1510
1507
|
}, [N.data]), x = U(() => {
|
|
1511
1508
|
var f;
|
|
1512
|
-
(f =
|
|
1509
|
+
(f = w.current) == null || f.showModal();
|
|
1513
1510
|
}, []), u = U(() => {
|
|
1514
1511
|
var f;
|
|
1515
|
-
(f =
|
|
1512
|
+
(f = w.current) == null || f.close();
|
|
1516
1513
|
}, []);
|
|
1517
1514
|
return /* @__PURE__ */ i(he, { children: [
|
|
1518
1515
|
/* @__PURE__ */ e(
|
|
@@ -1520,16 +1517,16 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1520
1517
|
{
|
|
1521
1518
|
overrides: {
|
|
1522
1519
|
Message: (f) => {
|
|
1523
|
-
const { message:
|
|
1520
|
+
const { message: E } = Qe("ChannelView"), y = /* @__PURE__ */ e(
|
|
1524
1521
|
Rs,
|
|
1525
1522
|
{
|
|
1526
1523
|
...f,
|
|
1527
1524
|
chatbotVotingEnabled: C,
|
|
1528
|
-
onAttachmentUnlock:
|
|
1525
|
+
onAttachmentUnlock: S,
|
|
1529
1526
|
onAttachmentDownload: m
|
|
1530
1527
|
}
|
|
1531
1528
|
);
|
|
1532
|
-
return !M || !
|
|
1529
|
+
return !M || !E ? y : M(y, E);
|
|
1533
1530
|
}
|
|
1534
1531
|
},
|
|
1535
1532
|
children: /* @__PURE__ */ i(Xt, { children: [
|
|
@@ -1539,11 +1536,11 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1539
1536
|
onBack: t,
|
|
1540
1537
|
showBackButton: s,
|
|
1541
1538
|
onShowInfo: x,
|
|
1542
|
-
canShowInfo: !!
|
|
1539
|
+
canShowInfo: !!_,
|
|
1543
1540
|
showStarButton: b
|
|
1544
1541
|
}
|
|
1545
1542
|
) }),
|
|
1546
|
-
|
|
1543
|
+
v == null ? void 0 : v(),
|
|
1547
1544
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1548
1545
|
Kt,
|
|
1549
1546
|
{
|
|
@@ -1552,7 +1549,7 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1552
1549
|
messageActions: void 0
|
|
1553
1550
|
}
|
|
1554
1551
|
) }),
|
|
1555
|
-
|
|
1552
|
+
o == null ? void 0 : o(N),
|
|
1556
1553
|
/* @__PURE__ */ e(
|
|
1557
1554
|
Fs,
|
|
1558
1555
|
{
|
|
@@ -1565,19 +1562,19 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1565
1562
|
/* @__PURE__ */ e(
|
|
1566
1563
|
ps,
|
|
1567
1564
|
{
|
|
1568
|
-
dialogRef:
|
|
1565
|
+
dialogRef: w,
|
|
1569
1566
|
onClose: u,
|
|
1570
|
-
participant:
|
|
1567
|
+
participant: _,
|
|
1571
1568
|
channel: N,
|
|
1572
|
-
followerStatusLabel:
|
|
1569
|
+
followerStatusLabel: L,
|
|
1573
1570
|
onLeaveConversation: l,
|
|
1574
1571
|
onBlockParticipant: d,
|
|
1575
1572
|
showDeleteConversation: a,
|
|
1576
1573
|
onDeleteConversationClick: c,
|
|
1577
1574
|
onBlockParticipantClick: g,
|
|
1578
1575
|
onReportParticipantClick: h,
|
|
1579
|
-
customProfileContent:
|
|
1580
|
-
customChannelActions:
|
|
1576
|
+
customProfileContent: r,
|
|
1577
|
+
customChannelActions: p
|
|
1581
1578
|
}
|
|
1582
1579
|
)
|
|
1583
1580
|
] });
|
|
@@ -1586,7 +1583,7 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1586
1583
|
channel: t,
|
|
1587
1584
|
onBack: s,
|
|
1588
1585
|
showBackButton: n = !1,
|
|
1589
|
-
renderMessageInputActions:
|
|
1586
|
+
renderMessageInputActions: o,
|
|
1590
1587
|
renderConversationFooter: l,
|
|
1591
1588
|
onLeaveConversation: d,
|
|
1592
1589
|
onBlockParticipant: a,
|
|
@@ -1595,43 +1592,43 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1595
1592
|
showDeleteConversation: h = !0,
|
|
1596
1593
|
onDeleteConversationClick: b,
|
|
1597
1594
|
onBlockParticipantClick: C,
|
|
1598
|
-
onReportParticipantClick:
|
|
1595
|
+
onReportParticipantClick: S,
|
|
1599
1596
|
dmAgentEnabled: m,
|
|
1600
|
-
messageMetadata:
|
|
1601
|
-
onMessageSent:
|
|
1602
|
-
showStarButton:
|
|
1597
|
+
messageMetadata: v,
|
|
1598
|
+
onMessageSent: r,
|
|
1599
|
+
showStarButton: p = !1,
|
|
1603
1600
|
chatbotVotingEnabled: M = !1,
|
|
1604
1601
|
onAttachmentUnlock: N,
|
|
1605
|
-
onAttachmentDownload:
|
|
1606
|
-
renderChannelBanner:
|
|
1607
|
-
customProfileContent:
|
|
1602
|
+
onAttachmentDownload: w,
|
|
1603
|
+
renderChannelBanner: _,
|
|
1604
|
+
customProfileContent: L,
|
|
1608
1605
|
customChannelActions: x,
|
|
1609
1606
|
renderMessage: u
|
|
1610
1607
|
}) => {
|
|
1611
1608
|
const f = U(
|
|
1612
|
-
async (
|
|
1613
|
-
var
|
|
1614
|
-
const G = ((
|
|
1615
|
-
...
|
|
1609
|
+
async (E, y, D) => {
|
|
1610
|
+
var J;
|
|
1611
|
+
const G = ((J = t.data) == null ? void 0 : J.chatbot_paused) === !0, T = m && !G, $ = {
|
|
1612
|
+
...y,
|
|
1616
1613
|
...T && { silent: !0 },
|
|
1617
|
-
...
|
|
1614
|
+
...v && {
|
|
1618
1615
|
metadata: {
|
|
1619
|
-
...
|
|
1620
|
-
...
|
|
1616
|
+
...y.metadata ?? {},
|
|
1617
|
+
...v
|
|
1621
1618
|
}
|
|
1622
1619
|
}
|
|
1623
1620
|
}, se = {
|
|
1624
1621
|
...D,
|
|
1625
1622
|
...T && { skip_push: !0 }
|
|
1626
|
-
},
|
|
1627
|
-
return
|
|
1623
|
+
}, Z = await t.sendMessage($, se);
|
|
1624
|
+
return r == null || r(Z), Z;
|
|
1628
1625
|
},
|
|
1629
|
-
[t, m,
|
|
1626
|
+
[t, m, v, r]
|
|
1630
1627
|
);
|
|
1631
1628
|
return /* @__PURE__ */ e(
|
|
1632
1629
|
"div",
|
|
1633
1630
|
{
|
|
1634
|
-
className:
|
|
1631
|
+
className: A(
|
|
1635
1632
|
"messaging-channel-view h-full flex flex-col",
|
|
1636
1633
|
c
|
|
1637
1634
|
),
|
|
@@ -1649,7 +1646,7 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1649
1646
|
{
|
|
1650
1647
|
onBack: s,
|
|
1651
1648
|
showBackButton: n,
|
|
1652
|
-
renderMessageInputActions:
|
|
1649
|
+
renderMessageInputActions: o,
|
|
1653
1650
|
renderConversationFooter: l,
|
|
1654
1651
|
onLeaveConversation: d,
|
|
1655
1652
|
onBlockParticipant: a,
|
|
@@ -1657,13 +1654,13 @@ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1657
1654
|
showDeleteConversation: h,
|
|
1658
1655
|
onDeleteConversationClick: b,
|
|
1659
1656
|
onBlockParticipantClick: C,
|
|
1660
|
-
onReportParticipantClick:
|
|
1661
|
-
showStarButton:
|
|
1657
|
+
onReportParticipantClick: S,
|
|
1658
|
+
showStarButton: p,
|
|
1662
1659
|
chatbotVotingEnabled: M,
|
|
1663
1660
|
onAttachmentUnlock: N,
|
|
1664
|
-
onAttachmentDownload:
|
|
1665
|
-
renderChannelBanner:
|
|
1666
|
-
customProfileContent:
|
|
1661
|
+
onAttachmentDownload: w,
|
|
1662
|
+
renderChannelBanner: _,
|
|
1663
|
+
customProfileContent: L,
|
|
1667
1664
|
customChannelActions: x,
|
|
1668
1665
|
renderMessage: u
|
|
1669
1666
|
}
|
|
@@ -1680,7 +1677,7 @@ function Xs({
|
|
|
1680
1677
|
setSearchQuery: s,
|
|
1681
1678
|
placeholder: n
|
|
1682
1679
|
}) {
|
|
1683
|
-
const
|
|
1680
|
+
const o = Q(null);
|
|
1684
1681
|
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1685
1682
|
/* @__PURE__ */ e(
|
|
1686
1683
|
rs,
|
|
@@ -1692,7 +1689,7 @@ function Xs({
|
|
|
1692
1689
|
/* @__PURE__ */ e(
|
|
1693
1690
|
"input",
|
|
1694
1691
|
{
|
|
1695
|
-
ref:
|
|
1692
|
+
ref: o,
|
|
1696
1693
|
type: "text",
|
|
1697
1694
|
placeholder: n,
|
|
1698
1695
|
value: t,
|
|
@@ -1706,7 +1703,7 @@ function Xs({
|
|
|
1706
1703
|
label: "Clear search",
|
|
1707
1704
|
onClick: () => {
|
|
1708
1705
|
var l;
|
|
1709
|
-
s(""), (l =
|
|
1706
|
+
s(""), (l = o.current) == null || l.focus();
|
|
1710
1707
|
},
|
|
1711
1708
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1712
1709
|
children: /* @__PURE__ */ e(Oe, { className: "h-4 w-4", weight: "bold" })
|
|
@@ -1718,17 +1715,17 @@ const Ks = ({
|
|
|
1718
1715
|
participantSource: t,
|
|
1719
1716
|
onSelectParticipant: s,
|
|
1720
1717
|
onClose: n,
|
|
1721
|
-
existingParticipantIds:
|
|
1718
|
+
existingParticipantIds: o = /* @__PURE__ */ new Set(),
|
|
1722
1719
|
participantLabel: l = "participants",
|
|
1723
1720
|
searchPlaceholder: d = "Search participants...",
|
|
1724
1721
|
className: a
|
|
1725
1722
|
}) => {
|
|
1726
|
-
const { debug: c } = Me(), [g, h] = k(""), [b, C] = k([]), [
|
|
1723
|
+
const { debug: c } = Me(), [g, h] = k(""), [b, C] = k([]), [S, m] = k(!1), [v, r] = k(null), [p, M] = k(
|
|
1727
1724
|
null
|
|
1728
|
-
), N =
|
|
1729
|
-
|
|
1725
|
+
), N = Q(!1);
|
|
1726
|
+
X(() => {
|
|
1730
1727
|
N.current = !1;
|
|
1731
|
-
}, [t]),
|
|
1728
|
+
}, [t]), X(() => {
|
|
1732
1729
|
if (t.loading) {
|
|
1733
1730
|
c && console.log(
|
|
1734
1731
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
@@ -1737,7 +1734,7 @@ const Ks = ({
|
|
|
1737
1734
|
}
|
|
1738
1735
|
if (N.current) return;
|
|
1739
1736
|
(async () => {
|
|
1740
|
-
c && console.log("[ParticipantPicker] Loading initial participants..."), m(!0),
|
|
1737
|
+
c && console.log("[ParticipantPicker] Loading initial participants..."), m(!0), r(null);
|
|
1741
1738
|
try {
|
|
1742
1739
|
const u = await t.loadParticipants({
|
|
1743
1740
|
search: "",
|
|
@@ -1750,20 +1747,20 @@ const Ks = ({
|
|
|
1750
1747
|
);
|
|
1751
1748
|
} catch (u) {
|
|
1752
1749
|
const f = u instanceof Error ? u.message : "Failed to load participants";
|
|
1753
|
-
|
|
1750
|
+
r(f), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
1754
1751
|
} finally {
|
|
1755
1752
|
m(!1);
|
|
1756
1753
|
}
|
|
1757
1754
|
})();
|
|
1758
1755
|
}, [t, c]);
|
|
1759
|
-
const
|
|
1756
|
+
const w = b.filter((x) => !o.has(x.id)).filter((x) => {
|
|
1760
1757
|
var f;
|
|
1761
1758
|
if (!g) return !0;
|
|
1762
1759
|
const u = g.toLowerCase();
|
|
1763
1760
|
return x.name.toLowerCase().includes(u) || ((f = x.email) == null ? void 0 : f.toLowerCase().includes(u)) || !1;
|
|
1764
|
-
}),
|
|
1761
|
+
}), _ = U(
|
|
1765
1762
|
async (x) => {
|
|
1766
|
-
if (!
|
|
1763
|
+
if (!p) {
|
|
1767
1764
|
M(x.id);
|
|
1768
1765
|
try {
|
|
1769
1766
|
await s(x);
|
|
@@ -1772,11 +1769,11 @@ const Ks = ({
|
|
|
1772
1769
|
}
|
|
1773
1770
|
}
|
|
1774
1771
|
},
|
|
1775
|
-
[s,
|
|
1776
|
-
),
|
|
1777
|
-
(x.key === "Enter" || x.key === " ") && (x.preventDefault(),
|
|
1772
|
+
[s, p]
|
|
1773
|
+
), L = (x, u) => {
|
|
1774
|
+
(x.key === "Enter" || x.key === " ") && (x.preventDefault(), _(u));
|
|
1778
1775
|
};
|
|
1779
|
-
return /* @__PURE__ */ i("div", { className:
|
|
1776
|
+
return /* @__PURE__ */ i("div", { className: A("flex flex-col h-full", a), children: [
|
|
1780
1777
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1781
1778
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1782
1779
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
@@ -1786,7 +1783,7 @@ const Ks = ({
|
|
|
1786
1783
|
"Select a ",
|
|
1787
1784
|
l.slice(0, -1),
|
|
1788
1785
|
" to start messaging (",
|
|
1789
|
-
|
|
1786
|
+
w.length,
|
|
1790
1787
|
" available)",
|
|
1791
1788
|
t.totalCount !== void 0 && ` • ${t.totalCount} ${l} total`
|
|
1792
1789
|
] }),
|
|
@@ -1799,37 +1796,37 @@ const Ks = ({
|
|
|
1799
1796
|
}
|
|
1800
1797
|
)
|
|
1801
1798
|
] }),
|
|
1802
|
-
|
|
1799
|
+
v && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1803
1800
|
"Error loading ",
|
|
1804
1801
|
l,
|
|
1805
1802
|
": ",
|
|
1806
|
-
|
|
1803
|
+
v
|
|
1807
1804
|
] }),
|
|
1808
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
1805
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S && w.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1809
1806
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1810
1807
|
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1811
1808
|
"Loading ",
|
|
1812
1809
|
l,
|
|
1813
1810
|
"..."
|
|
1814
1811
|
] })
|
|
1815
|
-
] }) }) :
|
|
1812
|
+
] }) }) : w.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1816
1813
|
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(We, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1817
1814
|
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: g ? `No ${l} found` : b.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
|
|
1818
1815
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: g ? "Try a different search term" : b.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
|
|
1819
1816
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1820
|
-
|
|
1817
|
+
w.map((x) => {
|
|
1821
1818
|
const u = x.name || x.email || x.id, f = x.email && x.name ? x.email : x.phone;
|
|
1822
1819
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1823
1820
|
"button",
|
|
1824
1821
|
{
|
|
1825
1822
|
type: "button",
|
|
1826
|
-
onClick: () =>
|
|
1827
|
-
onKeyDown: (
|
|
1823
|
+
onClick: () => _(x),
|
|
1824
|
+
onKeyDown: (E) => L(E, x),
|
|
1828
1825
|
className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus-ring",
|
|
1829
1826
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1830
1827
|
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1831
1828
|
/* @__PURE__ */ e(
|
|
1832
|
-
|
|
1829
|
+
ie,
|
|
1833
1830
|
{
|
|
1834
1831
|
id: x.id,
|
|
1835
1832
|
name: u,
|
|
@@ -1842,12 +1839,12 @@ const Ks = ({
|
|
|
1842
1839
|
f && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: f })
|
|
1843
1840
|
] })
|
|
1844
1841
|
] }),
|
|
1845
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children:
|
|
1842
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: p === x.id ? /* @__PURE__ */ e(_e, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(We, { className: "h-5 w-5 text-stone" }) })
|
|
1846
1843
|
] })
|
|
1847
1844
|
}
|
|
1848
1845
|
) }, x.id);
|
|
1849
1846
|
}),
|
|
1850
|
-
|
|
1847
|
+
S && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1851
1848
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1852
1849
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1853
1850
|
] }) })
|
|
@@ -2016,7 +2013,7 @@ const dn = ({
|
|
|
2016
2013
|
capabilities: t = {},
|
|
2017
2014
|
className: s,
|
|
2018
2015
|
renderMessageInputActions: n,
|
|
2019
|
-
renderConversationFooter:
|
|
2016
|
+
renderConversationFooter: o,
|
|
2020
2017
|
onChannelSelect: l,
|
|
2021
2018
|
onParticipantSelect: d,
|
|
2022
2019
|
initialParticipantFilter: a,
|
|
@@ -2025,21 +2022,21 @@ const dn = ({
|
|
|
2025
2022
|
showChannelList: h = !0,
|
|
2026
2023
|
filters: b,
|
|
2027
2024
|
channelRenderFilterFn: C,
|
|
2028
|
-
channelListCustomEmptyStateIndicator:
|
|
2025
|
+
channelListCustomEmptyStateIndicator: S,
|
|
2029
2026
|
onDeleteConversationClick: m,
|
|
2030
|
-
onBlockParticipantClick:
|
|
2031
|
-
onReportParticipantClick:
|
|
2032
|
-
dmAgentEnabled:
|
|
2027
|
+
onBlockParticipantClick: v,
|
|
2028
|
+
onReportParticipantClick: r,
|
|
2029
|
+
dmAgentEnabled: p,
|
|
2033
2030
|
messageMetadata: M,
|
|
2034
2031
|
onMessageSent: N,
|
|
2035
|
-
showStarButton:
|
|
2036
|
-
chatbotVotingEnabled:
|
|
2037
|
-
renderMessagePreview:
|
|
2032
|
+
showStarButton: w = !1,
|
|
2033
|
+
chatbotVotingEnabled: _ = !1,
|
|
2034
|
+
renderMessagePreview: L,
|
|
2038
2035
|
renderChannelBanner: x,
|
|
2039
2036
|
customProfileContent: u,
|
|
2040
2037
|
customChannelActions: f,
|
|
2041
|
-
renderMessage:
|
|
2042
|
-
onAttachmentUnlock:
|
|
2038
|
+
renderMessage: E,
|
|
2039
|
+
onAttachmentUnlock: y,
|
|
2043
2040
|
onAttachmentDownload: D
|
|
2044
2041
|
}) => {
|
|
2045
2042
|
const {
|
|
@@ -2047,10 +2044,10 @@ const dn = ({
|
|
|
2047
2044
|
client: T,
|
|
2048
2045
|
isConnected: $,
|
|
2049
2046
|
isLoading: se,
|
|
2050
|
-
error:
|
|
2051
|
-
refreshConnection:
|
|
2047
|
+
error: Z,
|
|
2048
|
+
refreshConnection: J,
|
|
2052
2049
|
debug: P
|
|
2053
|
-
} = os(), [V, z] = k(null), [
|
|
2050
|
+
} = os(), [V, z] = k(null), [ce, de] = k(!1), [R, O] = k(!1), [Y, W] = k(!1), [ne, ee] = k(/* @__PURE__ */ new Set()), [ae, Ge] = k(0), [q, me] = k(!1), [re, oe] = k(null), te = Q(null), {
|
|
2054
2051
|
participantSource: fe,
|
|
2055
2052
|
participantLabel: ge = "participants",
|
|
2056
2053
|
showDeleteConversation: xe = !0
|
|
@@ -2067,7 +2064,7 @@ const dn = ({
|
|
|
2067
2064
|
},
|
|
2068
2065
|
...b
|
|
2069
2066
|
};
|
|
2070
|
-
}, [b, T == null ? void 0 : T.userID]),
|
|
2067
|
+
}, [b, T == null ? void 0 : T.userID]), le = Q(null), K = U(async () => {
|
|
2071
2068
|
if (!T || !$) return;
|
|
2072
2069
|
const I = T.userID;
|
|
2073
2070
|
if (I)
|
|
@@ -2088,7 +2085,7 @@ const dn = ({
|
|
|
2088
2085
|
const Te = ($e = ht.user) == null ? void 0 : $e.id;
|
|
2089
2086
|
Te && Te !== I && B.add(Te);
|
|
2090
2087
|
});
|
|
2091
|
-
}), ee((j) => j.size === B.size && [...j].every((ke) => B.has(ke)) ? j : B),
|
|
2088
|
+
}), ee((j) => j.size === B.size && [...j].every((ke) => B.has(ke)) ? j : B), de(H.length > 0), O(!0), le.current = I, P && console.log("[MessagingShell] Channels synced successfully:", {
|
|
2092
2089
|
channelCount: H.length,
|
|
2093
2090
|
memberCount: B.size
|
|
2094
2091
|
});
|
|
@@ -2096,11 +2093,11 @@ const dn = ({
|
|
|
2096
2093
|
console.error("[MessagingShell] Failed to sync channels:", H);
|
|
2097
2094
|
}
|
|
2098
2095
|
}, [T, $, P]);
|
|
2099
|
-
|
|
2096
|
+
X(() => {
|
|
2100
2097
|
if (!T || !$) return;
|
|
2101
2098
|
const I = T.userID;
|
|
2102
|
-
I &&
|
|
2103
|
-
}, [T, $,
|
|
2099
|
+
I && le.current !== I && K();
|
|
2100
|
+
}, [T, $, K]), X(() => {
|
|
2104
2101
|
if (!a || !T || !$) return;
|
|
2105
2102
|
(async () => {
|
|
2106
2103
|
const H = T.userID;
|
|
@@ -2119,7 +2116,7 @@ const dn = ({
|
|
|
2119
2116
|
{ limit: 1 }
|
|
2120
2117
|
);
|
|
2121
2118
|
if (B.length > 0)
|
|
2122
|
-
z(B[0]), me(!0),
|
|
2119
|
+
z(B[0]), me(!0), oe(null), l && l(B[0]), P && console.log(
|
|
2123
2120
|
"[MessagingShell] Initial conversation loaded:",
|
|
2124
2121
|
B[0].id
|
|
2125
2122
|
);
|
|
@@ -2135,7 +2132,7 @@ const dn = ({
|
|
|
2135
2132
|
email: c.email,
|
|
2136
2133
|
phone: c.phone
|
|
2137
2134
|
});
|
|
2138
|
-
z(j), me(!0),
|
|
2135
|
+
z(j), me(!0), oe(null), l && l(j), P && console.log(
|
|
2139
2136
|
"[MessagingShell] Channel created and loaded:",
|
|
2140
2137
|
j.id
|
|
2141
2138
|
);
|
|
@@ -2143,10 +2140,10 @@ const dn = ({
|
|
|
2143
2140
|
console.error(
|
|
2144
2141
|
"[MessagingShell] Failed to create conversation:",
|
|
2145
2142
|
j
|
|
2146
|
-
),
|
|
2143
|
+
), oe("Failed to create conversation");
|
|
2147
2144
|
}
|
|
2148
2145
|
} else
|
|
2149
|
-
|
|
2146
|
+
oe(
|
|
2150
2147
|
"No conversation found with this account"
|
|
2151
2148
|
), P && console.log(
|
|
2152
2149
|
"[MessagingShell] No conversation found for:",
|
|
@@ -2156,7 +2153,7 @@ const dn = ({
|
|
|
2156
2153
|
console.error(
|
|
2157
2154
|
"[MessagingShell] Failed to load initial conversation:",
|
|
2158
2155
|
B
|
|
2159
|
-
),
|
|
2156
|
+
), oe("Failed to load conversation");
|
|
2160
2157
|
}
|
|
2161
2158
|
})();
|
|
2162
2159
|
}, [
|
|
@@ -2211,25 +2208,25 @@ const dn = ({
|
|
|
2211
2208
|
[ye]
|
|
2212
2209
|
), mt = U(
|
|
2213
2210
|
async (I) => {
|
|
2214
|
-
P && console.log("[MessagingShell] Leaving conversation:", I.id), z(null), me(!1),
|
|
2211
|
+
P && console.log("[MessagingShell] Leaving conversation:", I.id), z(null), me(!1), le.current = null, await K();
|
|
2215
2212
|
},
|
|
2216
|
-
[
|
|
2213
|
+
[K, P]
|
|
2217
2214
|
), ut = U(
|
|
2218
2215
|
async (I) => {
|
|
2219
|
-
P && console.log("[MessagingShell] Blocking participant:", I), z(null), me(!1),
|
|
2216
|
+
P && console.log("[MessagingShell] Blocking participant:", I), z(null), me(!1), le.current = null, await K();
|
|
2220
2217
|
},
|
|
2221
|
-
[
|
|
2218
|
+
[K, P]
|
|
2222
2219
|
), ve = !!V;
|
|
2223
|
-
return se ? /* @__PURE__ */ e("div", { className:
|
|
2220
|
+
return se ? /* @__PURE__ */ e("div", { className: A("h-full", s), children: /* @__PURE__ */ e(Se, {}) }) : Z ? /* @__PURE__ */ e("div", { className: A("h-full", s), children: /* @__PURE__ */ e(Ee, { message: Z, onBack: J }) }) : !$ || !T ? /* @__PURE__ */ e("div", { className: A("h-full", s), children: /* @__PURE__ */ e(
|
|
2224
2221
|
Ee,
|
|
2225
2222
|
{
|
|
2226
2223
|
message: "Not connected to messaging service",
|
|
2227
|
-
onBack:
|
|
2224
|
+
onBack: J
|
|
2228
2225
|
}
|
|
2229
|
-
) }) :
|
|
2226
|
+
) }) : re ? /* @__PURE__ */ e("div", { className: A("h-full", s), children: /* @__PURE__ */ e(Ee, { message: re }) }) : /* @__PURE__ */ i(
|
|
2230
2227
|
"div",
|
|
2231
2228
|
{
|
|
2232
|
-
className:
|
|
2229
|
+
className: A(
|
|
2233
2230
|
"messaging-shell h-full bg-background-primary overflow-hidden",
|
|
2234
2231
|
s
|
|
2235
2232
|
),
|
|
@@ -2238,7 +2235,7 @@ const dn = ({
|
|
|
2238
2235
|
/* @__PURE__ */ e(
|
|
2239
2236
|
"div",
|
|
2240
2237
|
{
|
|
2241
|
-
className:
|
|
2238
|
+
className: A(
|
|
2242
2239
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
2243
2240
|
{
|
|
2244
2241
|
"!hidden": h === !1 || q,
|
|
@@ -2255,8 +2252,8 @@ const dn = ({
|
|
|
2255
2252
|
selectedChannel: V || void 0,
|
|
2256
2253
|
filters: be,
|
|
2257
2254
|
channelRenderFilterFn: C,
|
|
2258
|
-
customEmptyStateIndicator:
|
|
2259
|
-
renderMessagePreview:
|
|
2255
|
+
customEmptyStateIndicator: S,
|
|
2256
|
+
renderMessagePreview: L
|
|
2260
2257
|
}
|
|
2261
2258
|
)
|
|
2262
2259
|
}
|
|
@@ -2264,7 +2261,7 @@ const dn = ({
|
|
|
2264
2261
|
/* @__PURE__ */ e(
|
|
2265
2262
|
"div",
|
|
2266
2263
|
{
|
|
2267
|
-
className:
|
|
2264
|
+
className: A(
|
|
2268
2265
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
2269
2266
|
{
|
|
2270
2267
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
@@ -2280,24 +2277,24 @@ const dn = ({
|
|
|
2280
2277
|
onBack: Ne,
|
|
2281
2278
|
showBackButton: !q,
|
|
2282
2279
|
renderMessageInputActions: n,
|
|
2283
|
-
renderConversationFooter:
|
|
2280
|
+
renderConversationFooter: o,
|
|
2284
2281
|
renderChannelBanner: x,
|
|
2285
2282
|
onLeaveConversation: mt,
|
|
2286
2283
|
onBlockParticipant: ut,
|
|
2287
2284
|
CustomChannelEmptyState: g,
|
|
2288
2285
|
showDeleteConversation: xe,
|
|
2289
2286
|
onDeleteConversationClick: m,
|
|
2290
|
-
onBlockParticipantClick:
|
|
2291
|
-
onReportParticipantClick:
|
|
2292
|
-
dmAgentEnabled:
|
|
2287
|
+
onBlockParticipantClick: v,
|
|
2288
|
+
onReportParticipantClick: r,
|
|
2289
|
+
dmAgentEnabled: p,
|
|
2293
2290
|
messageMetadata: M,
|
|
2294
2291
|
onMessageSent: N,
|
|
2295
|
-
showStarButton:
|
|
2296
|
-
chatbotVotingEnabled:
|
|
2292
|
+
showStarButton: w,
|
|
2293
|
+
chatbotVotingEnabled: _,
|
|
2297
2294
|
customProfileContent: u,
|
|
2298
2295
|
customChannelActions: f,
|
|
2299
|
-
renderMessage:
|
|
2300
|
-
onAttachmentUnlock:
|
|
2296
|
+
renderMessage: E,
|
|
2297
|
+
onAttachmentUnlock: y,
|
|
2301
2298
|
onAttachmentDownload: D
|
|
2302
2299
|
},
|
|
2303
2300
|
V.id
|
|
@@ -2307,7 +2304,7 @@ const dn = ({
|
|
|
2307
2304
|
) : /* @__PURE__ */ e(
|
|
2308
2305
|
ct,
|
|
2309
2306
|
{
|
|
2310
|
-
hasChannels:
|
|
2307
|
+
hasChannels: ce,
|
|
2311
2308
|
channelsLoaded: R
|
|
2312
2309
|
}
|
|
2313
2310
|
)
|
|
@@ -2332,7 +2329,7 @@ const dn = ({
|
|
|
2332
2329
|
participantLabel: ge,
|
|
2333
2330
|
searchPlaceholder: `Search ${ge}...`
|
|
2334
2331
|
},
|
|
2335
|
-
|
|
2332
|
+
ae
|
|
2336
2333
|
) })
|
|
2337
2334
|
}
|
|
2338
2335
|
)
|
|
@@ -2343,7 +2340,7 @@ const dn = ({
|
|
|
2343
2340
|
question: t,
|
|
2344
2341
|
onClick: s,
|
|
2345
2342
|
loading: n = !1,
|
|
2346
|
-
className:
|
|
2343
|
+
className: o
|
|
2347
2344
|
}) => /* @__PURE__ */ e(
|
|
2348
2345
|
"button",
|
|
2349
2346
|
{
|
|
@@ -2351,13 +2348,13 @@ const dn = ({
|
|
|
2351
2348
|
onClick: s,
|
|
2352
2349
|
disabled: n,
|
|
2353
2350
|
style: { backgroundColor: "#E6E5E3" },
|
|
2354
|
-
className:
|
|
2351
|
+
className: A(
|
|
2355
2352
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors focus-ring",
|
|
2356
2353
|
{
|
|
2357
2354
|
"hover:brightness-95 active:brightness-90": !n,
|
|
2358
2355
|
"opacity-50 cursor-not-allowed": n
|
|
2359
2356
|
},
|
|
2360
|
-
|
|
2357
|
+
o
|
|
2361
2358
|
),
|
|
2362
2359
|
children: t
|
|
2363
2360
|
}
|
|
@@ -2365,7 +2362,7 @@ const dn = ({
|
|
|
2365
2362
|
faqs: t,
|
|
2366
2363
|
onFaqClick: s,
|
|
2367
2364
|
loadingFaqId: n,
|
|
2368
|
-
headerText:
|
|
2365
|
+
headerText: o,
|
|
2369
2366
|
className: l,
|
|
2370
2367
|
avatarImage: d,
|
|
2371
2368
|
avatarName: a
|
|
@@ -2373,7 +2370,7 @@ const dn = ({
|
|
|
2373
2370
|
const c = t.filter((g) => g.enabled).sort((g, h) => (g.order ?? 0) - (h.order ?? 0));
|
|
2374
2371
|
return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
2375
2372
|
(d || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
2376
|
-
|
|
2373
|
+
ie,
|
|
2377
2374
|
{
|
|
2378
2375
|
id: a || "account",
|
|
2379
2376
|
name: a || "Account",
|
|
@@ -2388,7 +2385,7 @@ const dn = ({
|
|
|
2388
2385
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
2389
2386
|
style: { backgroundColor: "#F1F0EE" },
|
|
2390
2387
|
children: [
|
|
2391
|
-
|
|
2388
|
+
o && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: o }),
|
|
2392
2389
|
c.map((g) => /* @__PURE__ */ e(
|
|
2393
2390
|
en,
|
|
2394
2391
|
{
|
|
@@ -2403,49 +2400,49 @@ const dn = ({
|
|
|
2403
2400
|
)
|
|
2404
2401
|
] }) });
|
|
2405
2402
|
}, un = (t, s = {}) => {
|
|
2406
|
-
const { initialSearch: n = "", pageSize:
|
|
2403
|
+
const { initialSearch: n = "", pageSize: o = 20 } = s, [l, d] = k([]), [a, c] = k(!1), [g, h] = k(null), [b, C] = k(n), [S, m] = k(!0), [v, r] = k(), p = U(async (_ = !1, L) => {
|
|
2407
2404
|
if (a) return;
|
|
2408
|
-
const x =
|
|
2405
|
+
const x = L !== void 0 ? L : b;
|
|
2409
2406
|
c(!0), h(null);
|
|
2410
2407
|
try {
|
|
2411
2408
|
const u = await t.loadParticipants({
|
|
2412
2409
|
search: x || void 0,
|
|
2413
|
-
limit:
|
|
2414
|
-
cursor:
|
|
2410
|
+
limit: o,
|
|
2411
|
+
cursor: _ ? void 0 : v
|
|
2415
2412
|
});
|
|
2416
2413
|
d(
|
|
2417
|
-
(f) =>
|
|
2418
|
-
), m(u.hasMore),
|
|
2414
|
+
(f) => _ ? u.participants : [...f, ...u.participants]
|
|
2415
|
+
), m(u.hasMore), r(u.nextCursor);
|
|
2419
2416
|
} catch (u) {
|
|
2420
2417
|
const f = u instanceof Error ? u.message : "Failed to load participants";
|
|
2421
2418
|
h(f), console.error("[useParticipants] Load error:", u);
|
|
2422
2419
|
} finally {
|
|
2423
2420
|
c(!1);
|
|
2424
2421
|
}
|
|
2425
|
-
}, [t, b,
|
|
2426
|
-
|
|
2427
|
-
}, [
|
|
2428
|
-
C(
|
|
2429
|
-
}, [
|
|
2430
|
-
|
|
2431
|
-
}, [
|
|
2432
|
-
return
|
|
2433
|
-
|
|
2422
|
+
}, [t, b, v, o, a]), M = U(() => {
|
|
2423
|
+
S && !a && p(!1);
|
|
2424
|
+
}, [S, a, p]), N = U((_) => {
|
|
2425
|
+
C(_), r(void 0), p(!0, _);
|
|
2426
|
+
}, [p]), w = U(() => {
|
|
2427
|
+
r(void 0), p(!0);
|
|
2428
|
+
}, [p]);
|
|
2429
|
+
return X(() => {
|
|
2430
|
+
p(!0);
|
|
2434
2431
|
}, [t.loadParticipants]), {
|
|
2435
2432
|
participants: l,
|
|
2436
2433
|
loading: a,
|
|
2437
2434
|
error: g,
|
|
2438
2435
|
searchQuery: b,
|
|
2439
|
-
hasMore:
|
|
2436
|
+
hasMore: S,
|
|
2440
2437
|
totalCount: t.totalCount,
|
|
2441
2438
|
loadMore: M,
|
|
2442
2439
|
search: N,
|
|
2443
|
-
refresh:
|
|
2440
|
+
refresh: w
|
|
2444
2441
|
};
|
|
2445
2442
|
};
|
|
2446
2443
|
export {
|
|
2447
2444
|
we as ActionButton,
|
|
2448
|
-
|
|
2445
|
+
ie as Avatar,
|
|
2449
2446
|
Ws as ChannelEmptyState,
|
|
2450
2447
|
rt as ChannelList,
|
|
2451
2448
|
it as ChannelView,
|
|
@@ -2456,7 +2453,7 @@ export {
|
|
|
2456
2453
|
cn as MessagingProvider,
|
|
2457
2454
|
dn as MessagingShell,
|
|
2458
2455
|
Ks as ParticipantPicker,
|
|
2459
|
-
|
|
2456
|
+
ms as formatRelativeTime,
|
|
2460
2457
|
ws as useMessageVote,
|
|
2461
2458
|
os as useMessaging,
|
|
2462
2459
|
un as useParticipants
|