@linktr.ee/messaging-react 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +149 -140
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/components/ActionButton/ActionButton.stories.tsx +46 -0
- package/src/components/ActionButton/ActionButton.test.tsx +112 -0
- package/src/components/ActionButton/index.tsx +33 -0
- package/src/components/Avatar/Avatar.stories.tsx +144 -0
- package/src/components/Avatar/avatarColors.ts +35 -0
- package/src/components/Avatar/index.tsx +64 -0
- package/src/components/ChannelList/ChannelList.stories.tsx +48 -0
- package/src/components/ChannelList/CustomChannelPreview.stories.tsx +303 -0
- package/src/components/ChannelList/CustomChannelPreview.tsx +121 -0
- package/src/components/ChannelList/index.tsx +129 -0
- package/src/components/ChannelView.tsx +422 -0
- package/src/components/CloseButton/index.tsx +16 -0
- package/src/components/IconButton/IconButton.stories.tsx +40 -0
- package/src/components/IconButton/index.tsx +32 -0
- package/src/components/Loading/Loading.stories.tsx +24 -0
- package/src/components/Loading/index.tsx +50 -0
- package/src/components/MessagingShell/EmptyState.stories.tsx +38 -0
- package/src/components/MessagingShell/EmptyState.tsx +58 -0
- package/src/components/MessagingShell/ErrorState.stories.tsx +42 -0
- package/src/components/MessagingShell/ErrorState.tsx +33 -0
- package/src/components/MessagingShell/LoadingState.stories.tsx +26 -0
- package/src/components/MessagingShell/LoadingState.tsx +15 -0
- package/src/components/MessagingShell/index.tsx +298 -0
- package/src/components/ParticipantPicker/ParticipantItem.stories.tsx +188 -0
- package/src/components/ParticipantPicker/ParticipantItem.tsx +59 -0
- package/src/components/ParticipantPicker/ParticipantPicker.stories.tsx +54 -0
- package/src/components/ParticipantPicker/ParticipantPicker.tsx +196 -0
- package/src/components/ParticipantPicker/index.tsx +234 -0
- package/src/components/SearchInput/SearchInput.stories.tsx +33 -0
- package/src/components/SearchInput/SearchInput.test.tsx +108 -0
- package/src/components/SearchInput/index.tsx +50 -0
- package/src/hooks/useMessaging.ts +9 -0
- package/src/hooks/useParticipants.ts +92 -0
- package/src/index.ts +26 -0
- package/src/providers/MessagingProvider.tsx +282 -0
- package/src/stories/mocks.tsx +157 -0
- package/src/test/setup.ts +30 -0
- package/src/test/utils.tsx +23 -0
- package/src/types.ts +113 -0
package/dist/index.js
CHANGED
|
@@ -21,10 +21,10 @@ const Le = de({
|
|
|
21
21
|
weights: s,
|
|
22
22
|
...w
|
|
23
23
|
} = n, {
|
|
24
|
-
color:
|
|
25
|
-
size:
|
|
24
|
+
color: C = "currentColor",
|
|
25
|
+
size: f,
|
|
26
26
|
weight: i = "regular",
|
|
27
|
-
mirrored:
|
|
27
|
+
mirrored: b = !1,
|
|
28
28
|
...x
|
|
29
29
|
} = e.useContext(Le);
|
|
30
30
|
return /* @__PURE__ */ e.createElement(
|
|
@@ -32,11 +32,11 @@ const Le = de({
|
|
|
32
32
|
{
|
|
33
33
|
ref: a,
|
|
34
34
|
xmlns: "http://www.w3.org/2000/svg",
|
|
35
|
-
width: c ??
|
|
36
|
-
height: c ??
|
|
37
|
-
fill: o ??
|
|
35
|
+
width: c ?? f,
|
|
36
|
+
height: c ?? f,
|
|
37
|
+
fill: o ?? C,
|
|
38
38
|
viewBox: "0 0 256 256",
|
|
39
|
-
transform: u ||
|
|
39
|
+
transform: u || b ? "scale(-1, 1)" : void 0,
|
|
40
40
|
...x,
|
|
41
41
|
...w
|
|
42
42
|
},
|
|
@@ -115,8 +115,8 @@ const he = de({
|
|
|
115
115
|
customization: m = {},
|
|
116
116
|
debug: u = !1
|
|
117
117
|
}) => {
|
|
118
|
-
const r = (
|
|
119
|
-
u && console.log(`🔥 [MessagingProvider] ${
|
|
118
|
+
const r = (N, ...M) => {
|
|
119
|
+
u && console.log(`🔥 [MessagingProvider] ${N}`, ...M);
|
|
120
120
|
};
|
|
121
121
|
r("🔄 RENDER START", {
|
|
122
122
|
userId: a == null ? void 0 : a.id,
|
|
@@ -125,7 +125,7 @@ const he = de({
|
|
|
125
125
|
capabilities: Object.keys(c),
|
|
126
126
|
customization: Object.keys(m)
|
|
127
127
|
});
|
|
128
|
-
const [s, w] = A(null), [
|
|
128
|
+
const [s, w] = A(null), [C, f] = A(null), [i, b] = A(!1), [x, p] = A(!1), [Z, V] = A(null), R = $(!1), v = $({ userId: a == null ? void 0 : a.id, apiKey: o, serviceConfig: l, capabilities: c, customization: m }), y = $(0);
|
|
129
129
|
y.current++, r("📊 RENDER INFO", {
|
|
130
130
|
renderCount: y.current,
|
|
131
131
|
currentProps: { userId: a == null ? void 0 : a.id, apiKey: (o == null ? void 0 : o.substring(0, 8)) + "..." },
|
|
@@ -137,9 +137,9 @@ const he = de({
|
|
|
137
137
|
customizationChanged: v.current.customization !== m
|
|
138
138
|
}
|
|
139
139
|
}), v.current = { userId: a == null ? void 0 : a.id, apiKey: o, serviceConfig: l, capabilities: c, customization: m }, B(() => {
|
|
140
|
-
const
|
|
140
|
+
const N = y.current;
|
|
141
141
|
if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
142
|
-
renderCount:
|
|
142
|
+
renderCount: N,
|
|
143
143
|
apiKey: !!o,
|
|
144
144
|
serviceConfig: !!l,
|
|
145
145
|
dependencies: {
|
|
@@ -149,11 +149,11 @@ const he = de({
|
|
|
149
149
|
apiKeyStable: v.current.apiKey === o
|
|
150
150
|
}
|
|
151
151
|
}), !o || !l) {
|
|
152
|
-
r("⚠️ SERVICE INIT SKIPPED", { renderCount:
|
|
152
|
+
r("⚠️ SERVICE INIT SKIPPED", { renderCount: N, reason: "Missing apiKey or serviceConfig" });
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
155
|
r("🚀 CREATING NEW SERVICE", {
|
|
156
|
-
renderCount:
|
|
156
|
+
renderCount: N,
|
|
157
157
|
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
158
158
|
serviceConfigChanged: v.current.serviceConfig !== l
|
|
159
159
|
});
|
|
@@ -162,8 +162,8 @@ const he = de({
|
|
|
162
162
|
apiKey: o,
|
|
163
163
|
debug: u
|
|
164
164
|
});
|
|
165
|
-
return w(M), r("✅ SERVICE SET", { renderCount:
|
|
166
|
-
r("🧹 SERVICE CLEANUP", { renderCount:
|
|
165
|
+
return w(M), r("✅ SERVICE SET", { renderCount: N, serviceInstance: !!M }), () => {
|
|
166
|
+
r("🧹 SERVICE CLEANUP", { renderCount: N, reason: "Effect cleanup" }), M.disconnectUser().catch(console.error);
|
|
167
167
|
};
|
|
168
168
|
}, [o, l]);
|
|
169
169
|
const F = $(null);
|
|
@@ -193,7 +193,7 @@ const he = de({
|
|
|
193
193
|
try {
|
|
194
194
|
r("📞 CALLING SERVICE.CONNECTUSER", { userId: a.id });
|
|
195
195
|
const k = await s.connectUser(a);
|
|
196
|
-
|
|
196
|
+
f(k), b(!0), F.current = { serviceId: s, userId: a.id }, r("✅ USER CONNECTION SUCCESS", { userId: a.id, clientId: k.userID });
|
|
197
197
|
} catch (k) {
|
|
198
198
|
const P = k instanceof Error ? k.message : "Connection failed";
|
|
199
199
|
V(P), r("❌ USER CONNECTION ERROR", { userId: a.id, error: P });
|
|
@@ -204,7 +204,7 @@ const he = de({
|
|
|
204
204
|
}, [s, a]), B(() => (r("🔌 CLEANUP EFFECT REGISTERED", { hasService: !!s, isConnected: i }), () => {
|
|
205
205
|
s && i ? (r("🧹 CLEANUP EFFECT TRIGGERED", "Cleaning up connection on unmount"), F.current = null, s.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", { hasService: !!s, isConnected: i });
|
|
206
206
|
}), [s, i]);
|
|
207
|
-
const
|
|
207
|
+
const g = H(async () => {
|
|
208
208
|
if (r("🔄 REFRESH CONNECTION CALLED", { hasService: !!s, hasUser: !!a }), !s || !a) {
|
|
209
209
|
r("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
210
210
|
return;
|
|
@@ -212,17 +212,17 @@ const he = de({
|
|
|
212
212
|
r("🚀 STARTING CONNECTION REFRESH", { userId: a.id }), p(!0);
|
|
213
213
|
try {
|
|
214
214
|
r("🔌 DISCONNECTING FOR REFRESH"), await s.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
} catch (
|
|
218
|
-
const M =
|
|
215
|
+
const N = await s.connectUser(a);
|
|
216
|
+
f(N), b(!0), V(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: a.id });
|
|
217
|
+
} catch (N) {
|
|
218
|
+
const M = N instanceof Error ? N.message : "Refresh failed";
|
|
219
219
|
V(M), r("❌ CONNECTION REFRESH ERROR", { userId: a.id, error: M });
|
|
220
220
|
} finally {
|
|
221
221
|
p(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: a.id });
|
|
222
222
|
}
|
|
223
223
|
}, [s, a]), h = _.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
|
|
224
224
|
hasService: !!s,
|
|
225
|
-
hasClient: !!
|
|
225
|
+
hasClient: !!C,
|
|
226
226
|
isConnected: i,
|
|
227
227
|
isLoading: x,
|
|
228
228
|
hasError: !!Z,
|
|
@@ -230,46 +230,46 @@ const he = de({
|
|
|
230
230
|
customizationKeys: Object.keys(m)
|
|
231
231
|
}), {
|
|
232
232
|
service: s,
|
|
233
|
-
client:
|
|
233
|
+
client: C,
|
|
234
234
|
isConnected: i,
|
|
235
235
|
isLoading: x,
|
|
236
236
|
error: Z,
|
|
237
237
|
capabilities: c,
|
|
238
238
|
customization: m,
|
|
239
|
-
refreshConnection:
|
|
239
|
+
refreshConnection: g,
|
|
240
240
|
debug: u
|
|
241
|
-
}), [s,
|
|
241
|
+
}), [s, C, i, x, Z, c, m, g, u]);
|
|
242
242
|
return r("🔄 RENDER END", {
|
|
243
243
|
renderCount: y.current,
|
|
244
|
-
willRenderChat: !!(
|
|
244
|
+
willRenderChat: !!(C && i),
|
|
245
245
|
contextValueReady: !!h
|
|
246
|
-
}), /* @__PURE__ */ t(he.Provider, { value: h, children:
|
|
246
|
+
}), /* @__PURE__ */ t(he.Provider, { value: h, children: C && i ? /* @__PURE__ */ t(Ae, { client: C, children: n }) : n });
|
|
247
247
|
};
|
|
248
248
|
function He(n) {
|
|
249
249
|
const a = [
|
|
250
|
-
{ bgColor: "bg-primary
|
|
250
|
+
{ bgColor: "bg-primary/20", textColor: "text-primary" },
|
|
251
251
|
// #8129D9 - purple
|
|
252
|
-
{ bgColor: "bg-forest
|
|
252
|
+
{ bgColor: "bg-forest/20", textColor: "text-forest" },
|
|
253
253
|
// #254f1a - dark green
|
|
254
|
-
{ bgColor: "bg-iris
|
|
254
|
+
{ bgColor: "bg-iris/20", textColor: "text-iris" },
|
|
255
255
|
// #061492 - dark blue
|
|
256
|
-
{ bgColor: "bg-shade
|
|
256
|
+
{ bgColor: "bg-shade/20", textColor: "text-shade" },
|
|
257
257
|
// #1e2330 - dark blue-gray
|
|
258
|
-
{ bgColor: "bg-dahlia
|
|
258
|
+
{ bgColor: "bg-dahlia/20", textColor: "text-dahlia" },
|
|
259
259
|
// #502274 - dark purple
|
|
260
|
-
{ bgColor: "bg-orchid
|
|
260
|
+
{ bgColor: "bg-orchid/20", textColor: "text-orchid" },
|
|
261
261
|
// #d717e7 - magenta
|
|
262
|
-
{ bgColor: "bg-currant
|
|
262
|
+
{ bgColor: "bg-currant/20", textColor: "text-currant" },
|
|
263
263
|
// #780016 - dark red
|
|
264
|
-
{ bgColor: "bg-apple
|
|
264
|
+
{ bgColor: "bg-apple/20", textColor: "text-apple" },
|
|
265
265
|
// #c41500 - red
|
|
266
|
-
{ bgColor: "bg-rose
|
|
266
|
+
{ bgColor: "bg-rose/20", textColor: "text-rose" },
|
|
267
267
|
// #fc3e4b - pink
|
|
268
|
-
{ bgColor: "bg-root
|
|
268
|
+
{ bgColor: "bg-root/20", textColor: "text-root" },
|
|
269
269
|
// #4c2e05 - brown
|
|
270
|
-
{ bgColor: "bg-poppy
|
|
270
|
+
{ bgColor: "bg-poppy/20", textColor: "text-poppy" },
|
|
271
271
|
// #ff6c02 - orange
|
|
272
|
-
{ bgColor: "bg-moss
|
|
272
|
+
{ bgColor: "bg-moss/20", textColor: "text-moss" }
|
|
273
273
|
// #70764d - olive green
|
|
274
274
|
];
|
|
275
275
|
let l = 0;
|
|
@@ -315,18 +315,24 @@ const ee = ({
|
|
|
315
315
|
)
|
|
316
316
|
}
|
|
317
317
|
);
|
|
318
|
-
}, Se = ({
|
|
318
|
+
}, Se = ({
|
|
319
|
+
channel: n,
|
|
320
|
+
selectedChannel: a,
|
|
321
|
+
onChannelSelect: l,
|
|
322
|
+
debug: o = !1,
|
|
323
|
+
...c
|
|
324
|
+
}) => {
|
|
319
325
|
var p, Z, V, R, v, y, F;
|
|
320
326
|
const m = (a == null ? void 0 : a.id) === (n == null ? void 0 : n.id), u = () => {
|
|
321
327
|
n && l(n);
|
|
322
328
|
}, s = Object.values(((p = n == null ? void 0 : n.state) == null ? void 0 : p.members) || {}).find(
|
|
323
|
-
(
|
|
324
|
-
var h,
|
|
325
|
-
return ((h =
|
|
329
|
+
(g) => {
|
|
330
|
+
var h, N;
|
|
331
|
+
return ((h = g.user) == null ? void 0 : h.id) && g.user.id !== ((N = n == null ? void 0 : n._client) == null ? void 0 : N.userID);
|
|
326
332
|
}
|
|
327
|
-
), w = ((Z = s == null ? void 0 : s.user) == null ? void 0 : Z.name) || "Conversation",
|
|
333
|
+
), w = ((Z = s == null ? void 0 : s.user) == null ? void 0 : Z.name) || "Conversation", C = (V = s == null ? void 0 : s.user) == null ? void 0 : V.image;
|
|
328
334
|
w.charAt(0).toUpperCase();
|
|
329
|
-
const
|
|
335
|
+
const f = (v = (R = n == null ? void 0 : n.state) == null ? void 0 : R.messages) == null ? void 0 : v[n.state.messages.length - 1], i = (f == null ? void 0 : f.text) || "No messages yet", b = f != null && f.created_at ? new Date(f.created_at).toLocaleTimeString([], {
|
|
330
336
|
hour: "2-digit",
|
|
331
337
|
minute: "2-digit"
|
|
332
338
|
}) : "", x = ((y = n == null ? void 0 : n.state) == null ? void 0 : y.unreadCount) || 0;
|
|
@@ -335,7 +341,7 @@ const ee = ({
|
|
|
335
341
|
isSelected: m,
|
|
336
342
|
participantName: w,
|
|
337
343
|
unread: x,
|
|
338
|
-
hasTimestamp: !!
|
|
344
|
+
hasTimestamp: !!b
|
|
339
345
|
}), /* @__PURE__ */ t(
|
|
340
346
|
"button",
|
|
341
347
|
{
|
|
@@ -344,7 +350,7 @@ const ee = ({
|
|
|
344
350
|
className: L(
|
|
345
351
|
"w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
|
|
346
352
|
{
|
|
347
|
-
"bg-primary-alt
|
|
353
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": m,
|
|
348
354
|
"hover:bg-sand": !m
|
|
349
355
|
}
|
|
350
356
|
),
|
|
@@ -354,7 +360,7 @@ const ee = ({
|
|
|
354
360
|
{
|
|
355
361
|
id: ((F = s == null ? void 0 : s.user) == null ? void 0 : F.id) || n.id || "unknown",
|
|
356
362
|
name: w,
|
|
357
|
-
image:
|
|
363
|
+
image: C,
|
|
358
364
|
size: 44
|
|
359
365
|
}
|
|
360
366
|
),
|
|
@@ -370,7 +376,7 @@ const ee = ({
|
|
|
370
376
|
children: w
|
|
371
377
|
}
|
|
372
378
|
),
|
|
373
|
-
|
|
379
|
+
b && /* @__PURE__ */ t("span", { className: "text-xs text-stone flex-shrink-0", children: b })
|
|
374
380
|
] }),
|
|
375
381
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
376
382
|
/* @__PURE__ */ t("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: i }),
|
|
@@ -388,7 +394,7 @@ const ee = ({
|
|
|
388
394
|
participantLabel: c = "participants",
|
|
389
395
|
className: m
|
|
390
396
|
}) => {
|
|
391
|
-
var
|
|
397
|
+
var C;
|
|
392
398
|
const u = _.useRef(0);
|
|
393
399
|
u.current++;
|
|
394
400
|
const { debug: r = !1 } = K();
|
|
@@ -403,13 +409,13 @@ const ee = ({
|
|
|
403
409
|
renderCount: u.current,
|
|
404
410
|
hasClient: !!s,
|
|
405
411
|
clientUserId: s == null ? void 0 : s.userID,
|
|
406
|
-
clientConnected: (
|
|
412
|
+
clientConnected: (C = s == null ? void 0 : s.wsConnection) == null ? void 0 : C.isHealthy
|
|
407
413
|
});
|
|
408
414
|
const w = _.useMemo(() => {
|
|
409
|
-
const
|
|
415
|
+
const f = s.userID, i = f ? { type: "messaging", members: { $in: [f] }, hidden: !1 } : { type: "messaging" };
|
|
410
416
|
return r && console.log("📺 [ChannelList] 🔍 FILTERS MEMOIZED", {
|
|
411
417
|
renderCount: u.current,
|
|
412
|
-
userId:
|
|
418
|
+
userId: f,
|
|
413
419
|
filters: i
|
|
414
420
|
}), i;
|
|
415
421
|
}, [s.userID, r]);
|
|
@@ -437,16 +443,16 @@ const ee = ({
|
|
|
437
443
|
filters: w,
|
|
438
444
|
sort: { last_message_at: -1 },
|
|
439
445
|
options: { limit: 30 },
|
|
440
|
-
Preview: (
|
|
441
|
-
var i,
|
|
446
|
+
Preview: (f) => {
|
|
447
|
+
var i, b;
|
|
442
448
|
return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
443
|
-
channelId: (i =
|
|
449
|
+
channelId: (i = f.channel) == null ? void 0 : i.id,
|
|
444
450
|
selectedChannelId: a == null ? void 0 : a.id,
|
|
445
|
-
isSelected: (a == null ? void 0 : a.id) === ((
|
|
451
|
+
isSelected: (a == null ? void 0 : a.id) === ((b = f.channel) == null ? void 0 : b.id)
|
|
446
452
|
}), /* @__PURE__ */ t(
|
|
447
453
|
Se,
|
|
448
454
|
{
|
|
449
|
-
...
|
|
455
|
+
...f,
|
|
450
456
|
selectedChannel: a,
|
|
451
457
|
onChannelSelect: n,
|
|
452
458
|
debug: r
|
|
@@ -547,8 +553,8 @@ const De = /* @__PURE__ */ new Map([
|
|
|
547
553
|
"thin",
|
|
548
554
|
/* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z" }))
|
|
549
555
|
]
|
|
550
|
-
]),
|
|
551
|
-
|
|
556
|
+
]), fe = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: De }));
|
|
557
|
+
fe.displayName = "SignOutIcon";
|
|
552
558
|
const Oe = /* @__PURE__ */ new Map([
|
|
553
559
|
[
|
|
554
560
|
"bold",
|
|
@@ -601,8 +607,8 @@ const Ue = /* @__PURE__ */ new Map([
|
|
|
601
607
|
"thin",
|
|
602
608
|
/* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z" }))
|
|
603
609
|
]
|
|
604
|
-
]),
|
|
605
|
-
|
|
610
|
+
]), ge = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: Ue }));
|
|
611
|
+
ge.displayName = "ArrowLeftIcon";
|
|
606
612
|
const $e = /* @__PURE__ */ new Map([
|
|
607
613
|
[
|
|
608
614
|
"bold",
|
|
@@ -693,13 +699,13 @@ const Y = ({
|
|
|
693
699
|
n && n(),
|
|
694
700
|
/* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t(Re, { focus: !0, maxRows: 4 }) })
|
|
695
701
|
] }), Ge = ({ onBack: n, showBackButton: a, onShowInfo: l, canShowInfo: o }) => {
|
|
696
|
-
var s, w,
|
|
702
|
+
var s, w, C, f;
|
|
697
703
|
const { channel: c } = Ie(), m = _.useMemo(() => Object.values(c.state.members || {}).find(
|
|
698
|
-
(
|
|
704
|
+
(b) => {
|
|
699
705
|
var x;
|
|
700
|
-
return ((x =
|
|
706
|
+
return ((x = b.user) == null ? void 0 : x.id) && b.user.id !== c._client.userID;
|
|
701
707
|
}
|
|
702
|
-
), [c._client.userID, c.state.members]), u = ((s = m == null ? void 0 : m.user) == null ? void 0 : s.name) || ((w = m == null ? void 0 : m.user) == null ? void 0 : w.id) || "Unknown member", r = (
|
|
708
|
+
), [c._client.userID, c.state.members]), u = ((s = m == null ? void 0 : m.user) == null ? void 0 : s.name) || ((w = m == null ? void 0 : m.user) == null ? void 0 : w.id) || "Unknown member", r = (C = m == null ? void 0 : m.user) == null ? void 0 : C.image;
|
|
703
709
|
return /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
|
|
704
710
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-3 min-w-0", children: [
|
|
705
711
|
a && n && /* @__PURE__ */ t(
|
|
@@ -709,13 +715,13 @@ const Y = ({
|
|
|
709
715
|
onClick: n,
|
|
710
716
|
className: "inline-flex items-center justify-center w-8 h-8 rounded-lg hover:bg-sand focus:outline-none focus:ring-2 focus:ring-primary transition-colors lg:hidden",
|
|
711
717
|
"aria-label": "Back to channel list",
|
|
712
|
-
children: /* @__PURE__ */ t(
|
|
718
|
+
children: /* @__PURE__ */ t(ge, { className: "h-5 w-5 text-stone", weight: "bold" })
|
|
713
719
|
}
|
|
714
720
|
),
|
|
715
721
|
/* @__PURE__ */ t(
|
|
716
722
|
ee,
|
|
717
723
|
{
|
|
718
|
-
id: ((
|
|
724
|
+
id: ((f = m == null ? void 0 : m.user) == null ? void 0 : f.id) || c.id || "unknown",
|
|
719
725
|
name: u,
|
|
720
726
|
image: r,
|
|
721
727
|
size: 40
|
|
@@ -734,7 +740,7 @@ const Y = ({
|
|
|
734
740
|
] });
|
|
735
741
|
}, _e = ({ isOpen: n, onClose: a, participant: l, channel: o, followerStatusLabel: c, onLeaveConversation: m, onBlockParticipant: u }) => {
|
|
736
742
|
var k, P, X, Q, z, q, G;
|
|
737
|
-
const { service: r, debug: s } = K(), w = $(null), [
|
|
743
|
+
const { service: r, debug: s } = K(), w = $(null), [C, f] = A(!1), [i, b] = A(!1), [x, p] = A(!1);
|
|
738
744
|
B(() => {
|
|
739
745
|
const I = w.current;
|
|
740
746
|
I && (n ? I.showModal() : I.close());
|
|
@@ -746,7 +752,7 @@ const Y = ({
|
|
|
746
752
|
const T = (await r.getBlockedUsers()).some(
|
|
747
753
|
(E) => E.blocked_user_id === l.user.id
|
|
748
754
|
);
|
|
749
|
-
|
|
755
|
+
f(T);
|
|
750
756
|
} catch (S) {
|
|
751
757
|
console.error("[ChannelInfoDialog] Failed to check blocked status:", S);
|
|
752
758
|
}
|
|
@@ -757,14 +763,14 @@ const Y = ({
|
|
|
757
763
|
const V = async () => {
|
|
758
764
|
var I;
|
|
759
765
|
if (!i) {
|
|
760
|
-
s && console.log("[ChannelInfoDialog] Leave conversation", o.cid),
|
|
766
|
+
s && console.log("[ChannelInfoDialog] Leave conversation", o.cid), b(!0);
|
|
761
767
|
try {
|
|
762
768
|
const S = ((I = o._client) == null ? void 0 : I.userID) ?? null;
|
|
763
769
|
await o.hide(S, !1), m && await m(o), a();
|
|
764
770
|
} catch (S) {
|
|
765
771
|
console.error("[ChannelInfoDialog] Failed to leave conversation", S);
|
|
766
772
|
} finally {
|
|
767
|
-
|
|
773
|
+
b(!1);
|
|
768
774
|
}
|
|
769
775
|
}
|
|
770
776
|
}, R = async () => {
|
|
@@ -799,7 +805,7 @@ const Y = ({
|
|
|
799
805
|
);
|
|
800
806
|
};
|
|
801
807
|
if (!l) return null;
|
|
802
|
-
const F = ((P = l.user) == null ? void 0 : P.name) || ((X = l.user) == null ? void 0 : X.id) || "Unknown member",
|
|
808
|
+
const F = ((P = l.user) == null ? void 0 : P.name) || ((X = l.user) == null ? void 0 : X.id) || "Unknown member", g = (Q = l.user) == null ? void 0 : Q.image, h = (z = l.user) == null ? void 0 : z.email, N = (q = l.user) == null ? void 0 : q.username, M = h || (N ? `linktr.ee/${N}` : void 0), U = ((G = l.user) == null ? void 0 : G.id) || "unknown";
|
|
803
809
|
return /* @__PURE__ */ t(
|
|
804
810
|
"dialog",
|
|
805
811
|
{
|
|
@@ -821,7 +827,7 @@ const Y = ({
|
|
|
821
827
|
{
|
|
822
828
|
id: U,
|
|
823
829
|
name: F,
|
|
824
|
-
image:
|
|
830
|
+
image: g,
|
|
825
831
|
size: 64
|
|
826
832
|
}
|
|
827
833
|
),
|
|
@@ -839,12 +845,12 @@ const Y = ({
|
|
|
839
845
|
disabled: i,
|
|
840
846
|
"aria-busy": i,
|
|
841
847
|
children: [
|
|
842
|
-
i ? /* @__PURE__ */ t(W, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ t(
|
|
848
|
+
i ? /* @__PURE__ */ t(W, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ t(fe, { className: "h-5 w-5" }),
|
|
843
849
|
/* @__PURE__ */ t("span", { children: "Leave Conversation" })
|
|
844
850
|
]
|
|
845
851
|
}
|
|
846
852
|
) }),
|
|
847
|
-
/* @__PURE__ */ t("li", { children:
|
|
853
|
+
/* @__PURE__ */ t("li", { children: C ? /* @__PURE__ */ d(
|
|
848
854
|
Y,
|
|
849
855
|
{
|
|
850
856
|
onClick: v,
|
|
@@ -887,12 +893,12 @@ const Y = ({
|
|
|
887
893
|
}) => {
|
|
888
894
|
const [r, s] = A(!1), w = _.useMemo(() => Object.values(n.state.members || {}).find(
|
|
889
895
|
(i) => {
|
|
890
|
-
var
|
|
891
|
-
return ((
|
|
896
|
+
var b;
|
|
897
|
+
return ((b = i.user) == null ? void 0 : b.id) && i.user.id !== n._client.userID;
|
|
892
898
|
}
|
|
893
|
-
), [n._client.userID, n.state.members]),
|
|
894
|
-
const
|
|
895
|
-
return
|
|
899
|
+
), [n._client.userID, n.state.members]), C = _.useMemo(() => {
|
|
900
|
+
const f = n.data ?? {};
|
|
901
|
+
return f.followerStatus ? String(f.followerStatus) : f.isFollower ? "Subscribed to you" : void 0;
|
|
896
902
|
}, [n.data]);
|
|
897
903
|
return /* @__PURE__ */ d("div", { className: L("h-full flex flex-col", u), children: [
|
|
898
904
|
/* @__PURE__ */ t(Me, { channel: n, children: /* @__PURE__ */ d(pe, { children: [
|
|
@@ -920,7 +926,7 @@ const Y = ({
|
|
|
920
926
|
onClose: () => s(!1),
|
|
921
927
|
participant: w,
|
|
922
928
|
channel: n,
|
|
923
|
-
followerStatusLabel:
|
|
929
|
+
followerStatusLabel: C,
|
|
924
930
|
onLeaveConversation: c,
|
|
925
931
|
onBlockParticipant: m
|
|
926
932
|
}
|
|
@@ -984,8 +990,8 @@ const Xe = /* @__PURE__ */ new Map([
|
|
|
984
990
|
"thin",
|
|
985
991
|
/* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z" }))
|
|
986
992
|
]
|
|
987
|
-
]),
|
|
988
|
-
|
|
993
|
+
]), Ne = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: Xe }));
|
|
994
|
+
Ne.displayName = "MagnifyingGlassIcon";
|
|
989
995
|
function Qe({
|
|
990
996
|
searchQuery: n,
|
|
991
997
|
setSearchQuery: a,
|
|
@@ -994,7 +1000,7 @@ function Qe({
|
|
|
994
1000
|
const o = $(null);
|
|
995
1001
|
return /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
996
1002
|
/* @__PURE__ */ t(
|
|
997
|
-
|
|
1003
|
+
Ne,
|
|
998
1004
|
{
|
|
999
1005
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1000
1006
|
weight: "bold"
|
|
@@ -1034,7 +1040,7 @@ const qe = ({
|
|
|
1034
1040
|
searchPlaceholder: m = "Search participants...",
|
|
1035
1041
|
className: u
|
|
1036
1042
|
}) => {
|
|
1037
|
-
const { debug: r } = K(), [s, w] = A(""), [
|
|
1043
|
+
const { debug: r } = K(), [s, w] = A(""), [C, f] = A([]), [i, b] = A(!1), [x, p] = A(null), [Z, V] = A(null), R = $(!1);
|
|
1038
1044
|
B(() => {
|
|
1039
1045
|
if (n.loading) {
|
|
1040
1046
|
r && console.log("[ParticipantPicker] Waiting for participant source to finish loading...");
|
|
@@ -1042,38 +1048,38 @@ const qe = ({
|
|
|
1042
1048
|
}
|
|
1043
1049
|
if (R.current) return;
|
|
1044
1050
|
(async () => {
|
|
1045
|
-
r && console.log("[ParticipantPicker] Loading initial participants..."),
|
|
1051
|
+
r && console.log("[ParticipantPicker] Loading initial participants..."), b(!0), p(null);
|
|
1046
1052
|
try {
|
|
1047
1053
|
const h = await n.loadParticipants({
|
|
1048
1054
|
search: "",
|
|
1049
1055
|
// Load all participants initially
|
|
1050
1056
|
limit: 100
|
|
1051
1057
|
});
|
|
1052
|
-
|
|
1058
|
+
f(h.participants), R.current = !0, r && console.log("[ParticipantPicker] Participants loaded successfully:", h.participants.length);
|
|
1053
1059
|
} catch (h) {
|
|
1054
|
-
const
|
|
1055
|
-
p(
|
|
1060
|
+
const N = h instanceof Error ? h.message : "Failed to load participants";
|
|
1061
|
+
p(N), console.error("[ParticipantPicker] Failed to load participants:", h);
|
|
1056
1062
|
} finally {
|
|
1057
|
-
|
|
1063
|
+
b(!1);
|
|
1058
1064
|
}
|
|
1059
1065
|
})();
|
|
1060
1066
|
}, [n.loading, r]);
|
|
1061
|
-
const v =
|
|
1062
|
-
var
|
|
1067
|
+
const v = C.filter((g) => !o.has(g.id)).filter((g) => {
|
|
1068
|
+
var N;
|
|
1063
1069
|
if (!s) return !0;
|
|
1064
1070
|
const h = s.toLowerCase();
|
|
1065
|
-
return
|
|
1066
|
-
}), y = H(async (
|
|
1071
|
+
return g.name.toLowerCase().includes(h) || ((N = g.email) == null ? void 0 : N.toLowerCase().includes(h)) || !1;
|
|
1072
|
+
}), y = H(async (g) => {
|
|
1067
1073
|
if (!Z) {
|
|
1068
|
-
V(
|
|
1074
|
+
V(g.id);
|
|
1069
1075
|
try {
|
|
1070
|
-
await a(
|
|
1076
|
+
await a(g);
|
|
1071
1077
|
} catch (h) {
|
|
1072
1078
|
console.error("[ParticipantPicker] Failed to start chat:", h), V(null);
|
|
1073
1079
|
}
|
|
1074
1080
|
}
|
|
1075
|
-
}, [a, Z]), F = (
|
|
1076
|
-
(
|
|
1081
|
+
}, [a, Z]), F = (g, h) => {
|
|
1082
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), y(h));
|
|
1077
1083
|
};
|
|
1078
1084
|
return /* @__PURE__ */ d("div", { className: L("flex flex-col h-full", u), children: [
|
|
1079
1085
|
/* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
@@ -1113,38 +1119,38 @@ const qe = ({
|
|
|
1113
1119
|
] })
|
|
1114
1120
|
] }) }) : v.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
|
|
1115
1121
|
/* @__PURE__ */ t("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ t(le, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1116
|
-
/* @__PURE__ */ t("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: s ? `No ${c} found` :
|
|
1117
|
-
/* @__PURE__ */ t("p", { className: "text-xs text-stone", children: s ? "Try a different search term" :
|
|
1122
|
+
/* @__PURE__ */ t("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: s ? `No ${c} found` : C.length > 0 ? `Already chatting with all ${c}` : `No ${c} yet` }),
|
|
1123
|
+
/* @__PURE__ */ t("p", { className: "text-xs text-stone", children: s ? "Try a different search term" : C.length > 0 ? `You have existing conversations with all your ${c}` : `${c.charAt(0).toUpperCase() + c.slice(1)} will appear here` })
|
|
1118
1124
|
] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
|
|
1119
|
-
v.map((
|
|
1120
|
-
const h =
|
|
1125
|
+
v.map((g) => {
|
|
1126
|
+
const h = g.name || g.email || g.id, N = g.email && g.name ? g.email : g.phone;
|
|
1121
1127
|
return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
1122
1128
|
"button",
|
|
1123
1129
|
{
|
|
1124
1130
|
type: "button",
|
|
1125
|
-
onClick: () => y(
|
|
1126
|
-
onKeyDown: (M) => F(M,
|
|
1131
|
+
onClick: () => y(g),
|
|
1132
|
+
onKeyDown: (M) => F(M, g),
|
|
1127
1133
|
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",
|
|
1128
1134
|
children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
1129
1135
|
/* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1130
1136
|
/* @__PURE__ */ t(
|
|
1131
1137
|
ee,
|
|
1132
1138
|
{
|
|
1133
|
-
id:
|
|
1139
|
+
id: g.id,
|
|
1134
1140
|
name: h,
|
|
1135
|
-
image:
|
|
1141
|
+
image: g.image,
|
|
1136
1142
|
size: 40
|
|
1137
1143
|
}
|
|
1138
1144
|
),
|
|
1139
1145
|
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
|
|
1140
1146
|
/* @__PURE__ */ t("h4", { className: "text-sm font-medium text-charcoal truncate", children: h }),
|
|
1141
|
-
|
|
1147
|
+
N && /* @__PURE__ */ t("p", { className: "text-xs text-stone truncate", children: N })
|
|
1142
1148
|
] })
|
|
1143
1149
|
] }),
|
|
1144
|
-
/* @__PURE__ */ t("div", { className: "flex-shrink-0", children: Z ===
|
|
1150
|
+
/* @__PURE__ */ t("div", { className: "flex-shrink-0", children: Z === g.id ? /* @__PURE__ */ t(W, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ t(le, { className: "h-5 w-5 text-stone" }) })
|
|
1145
1151
|
] })
|
|
1146
1152
|
}
|
|
1147
|
-
) },
|
|
1153
|
+
) }, g.id);
|
|
1148
1154
|
}),
|
|
1149
1155
|
i && /* @__PURE__ */ t("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
|
|
1150
1156
|
/* @__PURE__ */ t("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
@@ -1153,7 +1159,7 @@ const qe = ({
|
|
|
1153
1159
|
] }) })
|
|
1154
1160
|
] });
|
|
1155
1161
|
}, Ye = () => K(), Je = ({ hasChannels: n, onStartConversation: a, participantLabel: l }) => /* @__PURE__ */ t("div", { className: "flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
1156
|
-
/* @__PURE__ */ t("div", { className: "w-24 h-24 bg-primary-alt
|
|
1162
|
+
/* @__PURE__ */ t("div", { className: "w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ t("span", { className: "text-4xl", children: "💬" }) }),
|
|
1157
1163
|
/* @__PURE__ */ t("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
|
|
1158
1164
|
/* @__PURE__ */ t("p", { className: "text-stone text-sm mb-6", children: n ? /* @__PURE__ */ d(oe, { children: [
|
|
1159
1165
|
"Choose a conversation from the list or",
|
|
@@ -1171,7 +1177,10 @@ const qe = ({
|
|
|
1171
1177
|
" ",
|
|
1172
1178
|
"to begin messaging."
|
|
1173
1179
|
] }) })
|
|
1174
|
-
] }) }), ce = ({
|
|
1180
|
+
] }) }), ce = ({
|
|
1181
|
+
onClick: n,
|
|
1182
|
+
children: a
|
|
1183
|
+
}) => /* @__PURE__ */ t(
|
|
1175
1184
|
"button",
|
|
1176
1185
|
{
|
|
1177
1186
|
type: "button",
|
|
@@ -1251,11 +1260,11 @@ const qe = ({
|
|
|
1251
1260
|
client: r,
|
|
1252
1261
|
isConnected: s,
|
|
1253
1262
|
isLoading: w,
|
|
1254
|
-
error:
|
|
1255
|
-
refreshConnection:
|
|
1263
|
+
error: C,
|
|
1264
|
+
refreshConnection: f,
|
|
1256
1265
|
debug: i
|
|
1257
|
-
} = Ye(), [
|
|
1258
|
-
showStartConversation:
|
|
1266
|
+
} = Ye(), [b, x] = A(null), [p, Z] = A(!1), [V, R] = A(!1), [v, y] = A(/* @__PURE__ */ new Set()), [F, g] = A(0), h = $(null), {
|
|
1267
|
+
showStartConversation: N = !1,
|
|
1259
1268
|
participantSource: M,
|
|
1260
1269
|
participantLabel: U = "participants"
|
|
1261
1270
|
} = n, k = $(null), P = H(async () => {
|
|
@@ -1273,10 +1282,10 @@ const qe = ({
|
|
|
1273
1282
|
{ limit: 100 }
|
|
1274
1283
|
), j = /* @__PURE__ */ new Set();
|
|
1275
1284
|
O.forEach((te) => {
|
|
1276
|
-
const
|
|
1277
|
-
Object.values(
|
|
1285
|
+
const Ce = te.state.members || {};
|
|
1286
|
+
Object.values(Ce).forEach((be) => {
|
|
1278
1287
|
var se;
|
|
1279
|
-
const ae = (se =
|
|
1288
|
+
const ae = (se = be.user) == null ? void 0 : se.id;
|
|
1280
1289
|
ae && ae !== E && j.add(ae);
|
|
1281
1290
|
});
|
|
1282
1291
|
}), y(j), Z(O.length > 0), k.current = E, i && console.log("[MessagingShell] Channels synced successfully:", {
|
|
@@ -1298,7 +1307,7 @@ const qe = ({
|
|
|
1298
1307
|
x(null);
|
|
1299
1308
|
}, []), z = H(() => {
|
|
1300
1309
|
var E;
|
|
1301
|
-
M && (
|
|
1310
|
+
M && (g((O) => O + 1), R(!0), (E = h.current) == null || E.showModal());
|
|
1302
1311
|
}, [M]), q = H(async (E) => {
|
|
1303
1312
|
var O;
|
|
1304
1313
|
if (u)
|
|
@@ -1326,12 +1335,12 @@ const qe = ({
|
|
|
1326
1335
|
i && console.log("[MessagingShell] Leaving conversation:", E.id), x(null), k.current = null, await P();
|
|
1327
1336
|
}, [P, i]), S = H(async (E) => {
|
|
1328
1337
|
i && console.log("[MessagingShell] Blocking participant:", E), x(null), k.current = null, await P();
|
|
1329
|
-
}, [P, i]), T = !!
|
|
1330
|
-
return w ? /* @__PURE__ */ t("div", { className: L("h-full", l), children: /* @__PURE__ */ t(e1, {}) }) :
|
|
1338
|
+
}, [P, i]), T = !!b;
|
|
1339
|
+
return w ? /* @__PURE__ */ t("div", { className: L("h-full", l), children: /* @__PURE__ */ t(e1, {}) }) : C ? /* @__PURE__ */ t("div", { className: L("h-full", l), children: /* @__PURE__ */ t(ie, { error: C, onRetry: f }) }) : !s || !r ? /* @__PURE__ */ t("div", { className: L("h-full", l), children: /* @__PURE__ */ t(
|
|
1331
1340
|
ie,
|
|
1332
1341
|
{
|
|
1333
1342
|
error: "Not connected to messaging service",
|
|
1334
|
-
onRetry:
|
|
1343
|
+
onRetry: f
|
|
1335
1344
|
}
|
|
1336
1345
|
) }) : /* @__PURE__ */ d("div", { className: L("h-full bg-white overflow-hidden", l), children: [
|
|
1337
1346
|
/* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
|
|
@@ -1349,8 +1358,8 @@ const qe = ({
|
|
|
1349
1358
|
ke,
|
|
1350
1359
|
{
|
|
1351
1360
|
onChannelSelect: X,
|
|
1352
|
-
selectedChannel:
|
|
1353
|
-
showStartConversation:
|
|
1361
|
+
selectedChannel: b || void 0,
|
|
1362
|
+
showStartConversation: N && !!M,
|
|
1354
1363
|
onStartConversation: z,
|
|
1355
1364
|
participantLabel: U
|
|
1356
1365
|
}
|
|
@@ -1364,22 +1373,22 @@ const qe = ({
|
|
|
1364
1373
|
"hidden lg:flex": !T,
|
|
1365
1374
|
flex: T
|
|
1366
1375
|
}),
|
|
1367
|
-
children:
|
|
1376
|
+
children: b ? /* @__PURE__ */ t("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ t(
|
|
1368
1377
|
ze,
|
|
1369
1378
|
{
|
|
1370
|
-
channel:
|
|
1379
|
+
channel: b,
|
|
1371
1380
|
onBack: Q,
|
|
1372
1381
|
showBackButton: !0,
|
|
1373
1382
|
renderMessageInputActions: o,
|
|
1374
1383
|
onLeaveConversation: I,
|
|
1375
1384
|
onBlockParticipant: S
|
|
1376
1385
|
},
|
|
1377
|
-
|
|
1386
|
+
b.id
|
|
1378
1387
|
) }) : /* @__PURE__ */ t(
|
|
1379
1388
|
Je,
|
|
1380
1389
|
{
|
|
1381
1390
|
hasChannels: p,
|
|
1382
|
-
onStartConversation:
|
|
1391
|
+
onStartConversation: N ? z : void 0,
|
|
1383
1392
|
participantLabel: U
|
|
1384
1393
|
}
|
|
1385
1394
|
)
|
|
@@ -1411,29 +1420,29 @@ const qe = ({
|
|
|
1411
1420
|
)
|
|
1412
1421
|
] });
|
|
1413
1422
|
}, c1 = (n, a = {}) => {
|
|
1414
|
-
const { initialSearch: l = "", pageSize: o = 20 } = a, [c, m] = A([]), [u, r] = A(!1), [s, w] = A(null), [
|
|
1423
|
+
const { initialSearch: l = "", pageSize: o = 20 } = a, [c, m] = A([]), [u, r] = A(!1), [s, w] = A(null), [C, f] = A(l), [i, b] = A(!0), [x, p] = A(), Z = H(async (y = !1, F) => {
|
|
1415
1424
|
if (u) return;
|
|
1416
|
-
const
|
|
1425
|
+
const g = F !== void 0 ? F : C;
|
|
1417
1426
|
r(!0), w(null);
|
|
1418
1427
|
try {
|
|
1419
1428
|
const h = await n.loadParticipants({
|
|
1420
|
-
search:
|
|
1429
|
+
search: g || void 0,
|
|
1421
1430
|
limit: o,
|
|
1422
1431
|
cursor: y ? void 0 : x
|
|
1423
1432
|
});
|
|
1424
1433
|
m(
|
|
1425
|
-
(
|
|
1426
|
-
),
|
|
1434
|
+
(N) => y ? h.participants : [...N, ...h.participants]
|
|
1435
|
+
), b(h.hasMore), p(h.nextCursor);
|
|
1427
1436
|
} catch (h) {
|
|
1428
|
-
const
|
|
1429
|
-
w(
|
|
1437
|
+
const N = h instanceof Error ? h.message : "Failed to load participants";
|
|
1438
|
+
w(N), console.error("[useParticipants] Load error:", h);
|
|
1430
1439
|
} finally {
|
|
1431
1440
|
r(!1);
|
|
1432
1441
|
}
|
|
1433
|
-
}, [n,
|
|
1442
|
+
}, [n, C, x, o, u]), V = H(() => {
|
|
1434
1443
|
i && !u && Z(!1);
|
|
1435
1444
|
}, [i, u, Z]), R = H((y) => {
|
|
1436
|
-
|
|
1445
|
+
f(y), p(void 0), Z(!0, y);
|
|
1437
1446
|
}, [Z]), v = H(() => {
|
|
1438
1447
|
p(void 0), Z(!0);
|
|
1439
1448
|
}, [Z]);
|
|
@@ -1443,7 +1452,7 @@ const qe = ({
|
|
|
1443
1452
|
participants: c,
|
|
1444
1453
|
loading: u,
|
|
1445
1454
|
error: s,
|
|
1446
|
-
searchQuery:
|
|
1455
|
+
searchQuery: C,
|
|
1447
1456
|
hasMore: i,
|
|
1448
1457
|
totalCount: n.totalCount,
|
|
1449
1458
|
loadMore: V,
|