@linktr.ee/messaging-react 1.9.1-rc-1764214654 โ 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { XIcon as
|
|
7
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as d, Fragment as se } from "react/jsx-runtime";
|
|
2
|
+
import R from "classnames";
|
|
3
|
+
import Y, { createContext as Re, useContext as Fe, useCallback as P, useState as y, useRef as $, useEffect as H } from "react";
|
|
4
|
+
import { StreamChatService as Te } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as De, ChannelList as pe, MessageInput as Me, useMessageInputContext as Pe, useMessageComposerHasSendableData as Ue, SimpleAttachmentSelector as Oe, QuotedMessagePreview as Le, LinkPreviewList as _e, AttachmentPreviewList as je, TextareaComposer as Ae, Channel as Be, useChannelStateContext as fe, Window as ze, MessageList as $e } from "stream-chat-react";
|
|
6
|
+
import { XIcon as he, ArrowUpIcon as He, ArrowLeftIcon as ae, DotsThreeIcon as ie, SpinnerGapIcon as ee, SignOutIcon as Ge, ProhibitInsetIcon as ce, FlagIcon as Ve, MagnifyingGlassIcon as We, ChatCircleDotsIcon as de } from "@phosphor-icons/react";
|
|
7
|
+
const ge = Re({
|
|
8
8
|
service: null,
|
|
9
9
|
client: null,
|
|
10
10
|
isConnected: !1,
|
|
@@ -15,7 +15,7 @@ const he = ye({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}),
|
|
18
|
+
}), ne = () => Fe(ge), bs = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
@@ -25,8 +25,8 @@ const he = ye({
|
|
|
25
25
|
debug: i = !1
|
|
26
26
|
}) => {
|
|
27
27
|
const l = P(
|
|
28
|
-
(
|
|
29
|
-
i && console.log(`๐ฅ [MessagingProvider] ${
|
|
28
|
+
(x, ...D) => {
|
|
29
|
+
i && console.log(`๐ฅ [MessagingProvider] ${x}`, ...D);
|
|
30
30
|
},
|
|
31
31
|
[i]
|
|
32
32
|
);
|
|
@@ -37,15 +37,15 @@ const he = ye({
|
|
|
37
37
|
capabilities: Object.keys(a),
|
|
38
38
|
customization: Object.keys(c)
|
|
39
39
|
});
|
|
40
|
-
const [o, w] =
|
|
40
|
+
const [o, w] = y(null), [I, N] = y(null), [m, S] = y(!1), [g, b] = y(!1), [E, v] = y(null), F = $(!1), C = $({
|
|
41
41
|
userId: s == null ? void 0 : s.id,
|
|
42
42
|
apiKey: r,
|
|
43
43
|
serviceConfig: n,
|
|
44
44
|
capabilities: a,
|
|
45
45
|
customization: c
|
|
46
|
-
}),
|
|
47
|
-
|
|
48
|
-
renderCount:
|
|
46
|
+
}), T = $(0);
|
|
47
|
+
T.current++, l("๐ RENDER INFO", {
|
|
48
|
+
renderCount: T.current,
|
|
49
49
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
|
|
50
50
|
propChanges: {
|
|
51
51
|
userChanged: C.current.userId !== (s == null ? void 0 : s.id),
|
|
@@ -60,10 +60,10 @@ const he = ye({
|
|
|
60
60
|
serviceConfig: n,
|
|
61
61
|
capabilities: a,
|
|
62
62
|
customization: c
|
|
63
|
-
},
|
|
64
|
-
const
|
|
63
|
+
}, H(() => {
|
|
64
|
+
const x = T.current;
|
|
65
65
|
if (l("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
66
|
-
renderCount:
|
|
66
|
+
renderCount: x,
|
|
67
67
|
apiKey: !!r,
|
|
68
68
|
serviceConfig: !!n,
|
|
69
69
|
dependencies: {
|
|
@@ -74,50 +74,50 @@ const he = ye({
|
|
|
74
74
|
}
|
|
75
75
|
}), !r || !n) {
|
|
76
76
|
l("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
77
|
-
renderCount:
|
|
77
|
+
renderCount: x,
|
|
78
78
|
reason: "Missing apiKey or serviceConfig"
|
|
79
79
|
});
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
l("๐ CREATING NEW SERVICE", {
|
|
83
|
-
renderCount:
|
|
83
|
+
renderCount: x,
|
|
84
84
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
85
85
|
serviceConfigChanged: C.current.serviceConfig !== n
|
|
86
86
|
});
|
|
87
|
-
const D = new
|
|
87
|
+
const D = new Te({
|
|
88
88
|
...n,
|
|
89
89
|
apiKey: r,
|
|
90
90
|
debug: i
|
|
91
91
|
});
|
|
92
92
|
return w(D), l("โ
SERVICE SET", {
|
|
93
|
-
renderCount:
|
|
93
|
+
renderCount: x,
|
|
94
94
|
serviceInstance: !!D
|
|
95
95
|
}), () => {
|
|
96
96
|
l("๐งน SERVICE CLEANUP", {
|
|
97
|
-
renderCount:
|
|
97
|
+
renderCount: x,
|
|
98
98
|
reason: "Effect cleanup"
|
|
99
99
|
}), D.disconnectUser().catch(console.error);
|
|
100
100
|
};
|
|
101
101
|
}, [r, n, i, l]);
|
|
102
|
-
const p =
|
|
103
|
-
|
|
104
|
-
var D,
|
|
102
|
+
const p = $(null);
|
|
103
|
+
H(() => {
|
|
104
|
+
var D, q;
|
|
105
105
|
if (l("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
106
106
|
hasService: !!o,
|
|
107
107
|
hasUser: !!s,
|
|
108
108
|
userId: s == null ? void 0 : s.id,
|
|
109
|
-
isConnecting:
|
|
109
|
+
isConnecting: F.current,
|
|
110
110
|
isConnected: m,
|
|
111
111
|
dependencies: { service: !!o, userId: s == null ? void 0 : s.id }
|
|
112
112
|
}), !o || !s) {
|
|
113
113
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
if (
|
|
116
|
+
if (F.current) {
|
|
117
117
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
if (((D = p.current) == null ? void 0 : D.serviceId) === o && ((
|
|
120
|
+
if (((D = p.current) == null ? void 0 : D.serviceId) === o && ((q = p.current) == null ? void 0 : q.userId) === s.id) {
|
|
121
121
|
l(
|
|
122
122
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
123
123
|
"Already connected this user with this service"
|
|
@@ -125,28 +125,28 @@ const he = ye({
|
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
(async () => {
|
|
128
|
-
l("๐ STARTING USER CONNECTION", { userId: s.id }),
|
|
128
|
+
l("๐ STARTING USER CONNECTION", { userId: s.id }), F.current = !0, b(!0), v(null);
|
|
129
129
|
try {
|
|
130
130
|
l("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
131
|
-
const
|
|
132
|
-
|
|
131
|
+
const _ = await o.connectUser(s);
|
|
132
|
+
N(_), S(!0), p.current = { serviceId: o, userId: s.id }, l("โ
USER CONNECTION SUCCESS", {
|
|
133
133
|
userId: s.id,
|
|
134
|
-
clientId:
|
|
134
|
+
clientId: _.userID
|
|
135
135
|
});
|
|
136
|
-
} catch (
|
|
137
|
-
const
|
|
138
|
-
v(
|
|
136
|
+
} catch (_) {
|
|
137
|
+
const O = _ instanceof Error ? _.message : "Connection failed";
|
|
138
|
+
v(O), l("โ USER CONNECTION ERROR", {
|
|
139
139
|
userId: s.id,
|
|
140
|
-
error:
|
|
140
|
+
error: O
|
|
141
141
|
});
|
|
142
142
|
} finally {
|
|
143
|
-
b(!1),
|
|
143
|
+
b(!1), F.current = !1, l("๐ USER CONNECTION FINISHED", {
|
|
144
144
|
userId: s.id,
|
|
145
145
|
isConnected: m
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
})();
|
|
149
|
-
}, [o, s, l, m]),
|
|
149
|
+
}, [o, s, l, m]), H(() => (l("๐ CLEANUP EFFECT REGISTERED", {
|
|
150
150
|
hasService: !!o,
|
|
151
151
|
isConnected: m
|
|
152
152
|
}), () => {
|
|
@@ -158,7 +158,7 @@ const he = ye({
|
|
|
158
158
|
isConnected: m
|
|
159
159
|
});
|
|
160
160
|
}), [o, m, l]);
|
|
161
|
-
const
|
|
161
|
+
const u = P(async () => {
|
|
162
162
|
if (l("๐ REFRESH CONNECTION CALLED", {
|
|
163
163
|
hasService: !!o,
|
|
164
164
|
hasUser: !!s
|
|
@@ -169,10 +169,10 @@ const he = ye({
|
|
|
169
169
|
l("๐ STARTING CONNECTION REFRESH", { userId: s.id }), b(!0);
|
|
170
170
|
try {
|
|
171
171
|
l("๐ DISCONNECTING FOR REFRESH"), await o.disconnectUser(), l("๐ RECONNECTING FOR REFRESH");
|
|
172
|
-
const
|
|
173
|
-
x
|
|
174
|
-
} catch (
|
|
175
|
-
const D =
|
|
172
|
+
const x = await o.connectUser(s);
|
|
173
|
+
N(x), S(!0), v(null), l("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
174
|
+
} catch (x) {
|
|
175
|
+
const D = x instanceof Error ? x.message : "Refresh failed";
|
|
176
176
|
v(D), l("โ CONNECTION REFRESH ERROR", {
|
|
177
177
|
userId: s.id,
|
|
178
178
|
error: D
|
|
@@ -180,53 +180,53 @@ const he = ye({
|
|
|
180
180
|
} finally {
|
|
181
181
|
b(!1), l("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
182
182
|
}
|
|
183
|
-
}, [o, s, l]), f =
|
|
183
|
+
}, [o, s, l]), f = Y.useMemo(() => (l("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
184
184
|
hasService: !!o,
|
|
185
|
-
hasClient: !!
|
|
185
|
+
hasClient: !!I,
|
|
186
186
|
isConnected: m,
|
|
187
|
-
isLoading:
|
|
187
|
+
isLoading: g,
|
|
188
188
|
hasError: !!E,
|
|
189
189
|
capabilitiesKeys: Object.keys(a),
|
|
190
190
|
customizationKeys: Object.keys(c)
|
|
191
191
|
}), {
|
|
192
192
|
service: o,
|
|
193
|
-
client:
|
|
193
|
+
client: I,
|
|
194
194
|
isConnected: m,
|
|
195
|
-
isLoading:
|
|
195
|
+
isLoading: g,
|
|
196
196
|
error: E,
|
|
197
197
|
capabilities: a,
|
|
198
198
|
customization: c,
|
|
199
|
-
refreshConnection:
|
|
199
|
+
refreshConnection: u,
|
|
200
200
|
debug: i
|
|
201
201
|
}), [
|
|
202
202
|
o,
|
|
203
|
-
|
|
203
|
+
I,
|
|
204
204
|
m,
|
|
205
|
-
|
|
205
|
+
g,
|
|
206
206
|
E,
|
|
207
207
|
a,
|
|
208
208
|
c,
|
|
209
|
-
|
|
209
|
+
u,
|
|
210
210
|
i,
|
|
211
211
|
l
|
|
212
212
|
]);
|
|
213
213
|
return l("๐ RENDER END", {
|
|
214
|
-
renderCount:
|
|
215
|
-
willRenderChat: !!(
|
|
214
|
+
renderCount: T.current,
|
|
215
|
+
willRenderChat: !!(I && m),
|
|
216
216
|
contextValueReady: !!f
|
|
217
|
-
}), /* @__PURE__ */ e(
|
|
218
|
-
},
|
|
217
|
+
}), /* @__PURE__ */ e(ge.Provider, { value: f, children: I && m ? /* @__PURE__ */ e(De, { client: I, children: t }) : t });
|
|
218
|
+
}, qe = () => ne(), Ye = (t, s) => {
|
|
219
219
|
const n = new Date(
|
|
220
220
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
221
221
|
), a = new Date(
|
|
222
222
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
223
223
|
).getTime() - n.getTime();
|
|
224
224
|
return Math.floor(a / (1e3 * 60 * 60 * 24));
|
|
225
|
-
},
|
|
225
|
+
}, Je = (t) => {
|
|
226
226
|
const s = /* @__PURE__ */ new Date();
|
|
227
227
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
228
228
|
return "Just now";
|
|
229
|
-
const r =
|
|
229
|
+
const r = Ye(t, s);
|
|
230
230
|
return r === 0 ? t.toLocaleTimeString([], {
|
|
231
231
|
hour: "numeric",
|
|
232
232
|
minute: "2-digit"
|
|
@@ -235,7 +235,7 @@ const he = ye({
|
|
|
235
235
|
day: "numeric",
|
|
236
236
|
year: "2-digit"
|
|
237
237
|
});
|
|
238
|
-
},
|
|
238
|
+
}, ue = [
|
|
239
239
|
"๐",
|
|
240
240
|
// Apple
|
|
241
241
|
"๐",
|
|
@@ -263,7 +263,7 @@ const he = ye({
|
|
|
263
263
|
"๐"
|
|
264
264
|
// Melon
|
|
265
265
|
];
|
|
266
|
-
function
|
|
266
|
+
function Qe(t) {
|
|
267
267
|
let s = 0;
|
|
268
268
|
for (let n = 0; n < t.length; n++) {
|
|
269
269
|
const r = t.charCodeAt(n);
|
|
@@ -271,25 +271,25 @@ function qe(t) {
|
|
|
271
271
|
}
|
|
272
272
|
return Math.abs(s);
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
const n =
|
|
276
|
-
return
|
|
274
|
+
function Xe(t) {
|
|
275
|
+
const n = Qe(t) % ue.length;
|
|
276
|
+
return ue[n];
|
|
277
277
|
}
|
|
278
|
-
const
|
|
278
|
+
const J = ({
|
|
279
279
|
id: t,
|
|
280
280
|
image: s,
|
|
281
281
|
size: n = 40,
|
|
282
282
|
className: r,
|
|
283
283
|
shape: a = "squircle"
|
|
284
284
|
}) => {
|
|
285
|
-
const c =
|
|
285
|
+
const c = Xe(t), l = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", o = a === "circle" ? { borderRadius: "50%" } : {
|
|
286
286
|
borderRadius: "33%",
|
|
287
287
|
"corner-shape": "superellipse(1.3)"
|
|
288
288
|
};
|
|
289
289
|
return /* @__PURE__ */ e(
|
|
290
290
|
"div",
|
|
291
291
|
{
|
|
292
|
-
className:
|
|
292
|
+
className: R("flex-shrink-0 overflow-hidden", r),
|
|
293
293
|
style: {
|
|
294
294
|
width: `${n}px`,
|
|
295
295
|
height: `${n}px`,
|
|
@@ -306,7 +306,7 @@ const Y = ({
|
|
|
306
306
|
"div",
|
|
307
307
|
{
|
|
308
308
|
"aria-hidden": "true",
|
|
309
|
-
className:
|
|
309
|
+
className: R(
|
|
310
310
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
311
311
|
l
|
|
312
312
|
),
|
|
@@ -315,65 +315,65 @@ const Y = ({
|
|
|
315
315
|
)
|
|
316
316
|
}
|
|
317
317
|
);
|
|
318
|
-
},
|
|
319
|
-
var E, v,
|
|
318
|
+
}, Ze = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
|
|
319
|
+
var E, v, F, C, T, p;
|
|
320
320
|
const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), i = () => {
|
|
321
321
|
t && n(t);
|
|
322
322
|
}, o = Object.values(((E = t == null ? void 0 : t.state) == null ? void 0 : E.members) || {}).find(
|
|
323
|
-
(
|
|
324
|
-
var f,
|
|
325
|
-
return ((f =
|
|
323
|
+
(u) => {
|
|
324
|
+
var f, x;
|
|
325
|
+
return ((f = u.user) == null ? void 0 : f.id) && u.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
|
|
326
326
|
}
|
|
327
|
-
), w = ((v = o == null ? void 0 : o.user) == null ? void 0 : v.name) || "Conversation",
|
|
327
|
+
), w = ((v = o == null ? void 0 : o.user) == null ? void 0 : v.name) || "Conversation", I = (F = o == null ? void 0 : o.user) == null ? void 0 : F.image, N = (T = (C = t == null ? void 0 : t.state) == null ? void 0 : C.messages) == null ? void 0 : T[t.state.messages.length - 1], S = (() => {
|
|
328
328
|
var f;
|
|
329
|
-
if (
|
|
330
|
-
const
|
|
331
|
-
return
|
|
332
|
-
})(),
|
|
329
|
+
if (N != null && N.text) return N.text;
|
|
330
|
+
const u = (f = N == null ? void 0 : N.attachments) == null ? void 0 : f[0];
|
|
331
|
+
return u != null && u.asset_url ? u.asset_url : u != null && u.image_url ? u.image_url : u != null && u.og_scrape_url ? u.og_scrape_url : u != null && u.thumb_url ? u.thumb_url : "No messages yet";
|
|
332
|
+
})(), g = N != null && N.created_at ? Je(new Date(N.created_at)) : "", b = a ?? 0;
|
|
333
333
|
return r && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
334
334
|
channelId: t == null ? void 0 : t.id,
|
|
335
335
|
isSelected: c,
|
|
336
336
|
participantName: w,
|
|
337
337
|
unreadCount: b,
|
|
338
|
-
hasTimestamp: !!
|
|
338
|
+
hasTimestamp: !!g
|
|
339
339
|
}), /* @__PURE__ */ e(
|
|
340
340
|
"button",
|
|
341
341
|
{
|
|
342
342
|
type: "button",
|
|
343
343
|
onClick: i,
|
|
344
|
-
className:
|
|
344
|
+
className: R(
|
|
345
345
|
"group w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
|
|
346
346
|
{
|
|
347
347
|
"bg-primary-alt/10 border-l-4 border-l-primary": c,
|
|
348
348
|
"hover:bg-sand": !c
|
|
349
349
|
}
|
|
350
350
|
),
|
|
351
|
-
children: /* @__PURE__ */
|
|
351
|
+
children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
|
|
352
352
|
/* @__PURE__ */ e(
|
|
353
|
-
|
|
353
|
+
J,
|
|
354
354
|
{
|
|
355
355
|
id: ((p = o == null ? void 0 : o.user) == null ? void 0 : p.id) || t.id || "unknown",
|
|
356
356
|
name: w,
|
|
357
|
-
image:
|
|
357
|
+
image: I,
|
|
358
358
|
size: 44,
|
|
359
359
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
360
360
|
}
|
|
361
361
|
),
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
363
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
|
|
364
364
|
/* @__PURE__ */ e(
|
|
365
365
|
"h3",
|
|
366
366
|
{
|
|
367
|
-
className:
|
|
367
|
+
className: R(
|
|
368
368
|
"text-sm font-medium truncate",
|
|
369
369
|
c ? "text-primary" : "text-charcoal"
|
|
370
370
|
),
|
|
371
371
|
children: w
|
|
372
372
|
}
|
|
373
373
|
),
|
|
374
|
-
|
|
374
|
+
g && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: g })
|
|
375
375
|
] }),
|
|
376
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
377
377
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: S }),
|
|
378
378
|
b > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: b > 99 ? "99+" : b })
|
|
379
379
|
] })
|
|
@@ -381,16 +381,16 @@ const Y = ({
|
|
|
381
381
|
] })
|
|
382
382
|
}
|
|
383
383
|
);
|
|
384
|
-
},
|
|
384
|
+
}, Ke = ({
|
|
385
385
|
onChannelSelect: t,
|
|
386
386
|
selectedChannel: s,
|
|
387
387
|
filters: n,
|
|
388
388
|
className: r,
|
|
389
389
|
customEmptyStateIndicator: a
|
|
390
390
|
}) => {
|
|
391
|
-
const c =
|
|
391
|
+
const c = Y.useRef(0);
|
|
392
392
|
c.current++;
|
|
393
|
-
const { debug: i = !1 } =
|
|
393
|
+
const { debug: i = !1 } = ne();
|
|
394
394
|
return i && console.log("๐บ [ChannelList] ๐ RENDER START", {
|
|
395
395
|
renderCount: c.current,
|
|
396
396
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
@@ -398,7 +398,7 @@ const Y = ({
|
|
|
398
398
|
}), /* @__PURE__ */ e(
|
|
399
399
|
"div",
|
|
400
400
|
{
|
|
401
|
-
className:
|
|
401
|
+
className: R(
|
|
402
402
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
403
403
|
r
|
|
404
404
|
),
|
|
@@ -406,7 +406,7 @@ const Y = ({
|
|
|
406
406
|
renderCount: c.current,
|
|
407
407
|
filters: n
|
|
408
408
|
}), /* @__PURE__ */ e(
|
|
409
|
-
|
|
409
|
+
pe,
|
|
410
410
|
{
|
|
411
411
|
filters: n,
|
|
412
412
|
sort: { last_message_at: -1 },
|
|
@@ -418,7 +418,7 @@ const Y = ({
|
|
|
418
418
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
419
419
|
isSelected: (s == null ? void 0 : s.id) === ((w = l.channel) == null ? void 0 : w.id)
|
|
420
420
|
}), /* @__PURE__ */ e(
|
|
421
|
-
|
|
421
|
+
Ze,
|
|
422
422
|
{
|
|
423
423
|
...l,
|
|
424
424
|
selectedChannel: s,
|
|
@@ -442,7 +442,7 @@ const Y = ({
|
|
|
442
442
|
"button",
|
|
443
443
|
{
|
|
444
444
|
type: "button",
|
|
445
|
-
className:
|
|
445
|
+
className: R(
|
|
446
446
|
"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",
|
|
447
447
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
448
448
|
s
|
|
@@ -451,12 +451,12 @@ const Y = ({
|
|
|
451
451
|
children: n
|
|
452
452
|
}
|
|
453
453
|
);
|
|
454
|
-
function
|
|
455
|
-
return /* @__PURE__ */
|
|
454
|
+
function xe({ label: t, className: s, children: n, ...r }) {
|
|
455
|
+
return /* @__PURE__ */ d(
|
|
456
456
|
"button",
|
|
457
457
|
{
|
|
458
458
|
type: "button",
|
|
459
|
-
className:
|
|
459
|
+
className: R(
|
|
460
460
|
"rounded-full p-2 transition-colors focus-ring",
|
|
461
461
|
{
|
|
462
462
|
"cursor-not-allowed opacity-50": r.disabled,
|
|
@@ -472,20 +472,20 @@ function ge({ label: t, className: s, children: n, ...r }) {
|
|
|
472
472
|
}
|
|
473
473
|
);
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
return /* @__PURE__ */ e(
|
|
475
|
+
function Ne({ onClick: t }) {
|
|
476
|
+
return /* @__PURE__ */ e(xe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(he, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
477
477
|
}
|
|
478
|
-
const
|
|
479
|
-
const { handleSubmit: t } =
|
|
480
|
-
return /* @__PURE__ */
|
|
481
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
/* @__PURE__ */ e(
|
|
484
|
-
/* @__PURE__ */ e(
|
|
485
|
-
/* @__PURE__ */ e(
|
|
486
|
-
/* @__PURE__ */
|
|
478
|
+
const es = () => {
|
|
479
|
+
const { handleSubmit: t } = Pe(), s = Ue();
|
|
480
|
+
return /* @__PURE__ */ d(se, { children: [
|
|
481
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Oe, {}) }),
|
|
482
|
+
/* @__PURE__ */ d("div", { className: "central-container w-full p-2 bg-white rounded-lg shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
|
|
483
|
+
/* @__PURE__ */ e(Le, {}),
|
|
484
|
+
/* @__PURE__ */ e(_e, {}),
|
|
485
|
+
/* @__PURE__ */ e(je, {}),
|
|
486
|
+
/* @__PURE__ */ d("div", { className: "flex", children: [
|
|
487
487
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4", children: /* @__PURE__ */ e(
|
|
488
|
-
|
|
488
|
+
Ae,
|
|
489
489
|
{
|
|
490
490
|
className: "align-middle w-full resize-none outline-none",
|
|
491
491
|
maxRows: 4
|
|
@@ -500,47 +500,47 @@ const Xe = () => {
|
|
|
500
500
|
disabled: !s,
|
|
501
501
|
onClick: t,
|
|
502
502
|
type: "button",
|
|
503
|
-
children: /* @__PURE__ */ e(
|
|
503
|
+
children: /* @__PURE__ */ e(He, { className: "size-4" })
|
|
504
504
|
}
|
|
505
505
|
)
|
|
506
506
|
] })
|
|
507
507
|
] })
|
|
508
508
|
] });
|
|
509
|
-
},
|
|
509
|
+
}, ss = ({
|
|
510
510
|
renderActions: t
|
|
511
|
-
}) => /* @__PURE__ */
|
|
511
|
+
}) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
512
512
|
t && (t == null ? void 0 : t()),
|
|
513
|
-
/* @__PURE__ */ e(
|
|
514
|
-
] }),
|
|
513
|
+
/* @__PURE__ */ e(Me, { Input: es })
|
|
514
|
+
] }), be = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
515
515
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet ๐" }),
|
|
516
516
|
/* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
|
|
517
|
-
] }) }),
|
|
518
|
-
var o, w,
|
|
519
|
-
const { channel: a } =
|
|
520
|
-
(
|
|
517
|
+
] }) }), ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
518
|
+
var o, w, I, N, m;
|
|
519
|
+
const { channel: a } = fe(), c = Y.useMemo(() => Object.values(a.state.members || {}).find(
|
|
520
|
+
(g) => {
|
|
521
521
|
var b;
|
|
522
|
-
return ((b =
|
|
522
|
+
return ((b = g.user) == null ? void 0 : b.id) && g.user.id !== a._client.userID;
|
|
523
523
|
}
|
|
524
|
-
), [a._client.userID, a.state.members]), i = ((o = c == null ? void 0 : c.user) == null ? void 0 : o.name) || ((w = c == null ? void 0 : c.user) == null ? void 0 : w.id) || "Unknown member", l = (
|
|
525
|
-
return /* @__PURE__ */
|
|
526
|
-
/* @__PURE__ */
|
|
524
|
+
), [a._client.userID, a.state.members]), i = ((o = c == null ? void 0 : c.user) == null ? void 0 : o.name) || ((w = c == null ? void 0 : c.user) == null ? void 0 : w.id) || "Unknown member", l = (I = c == null ? void 0 : c.user) == null ? void 0 : I.image;
|
|
525
|
+
return /* @__PURE__ */ d("div", { className: "@container", children: [
|
|
526
|
+
/* @__PURE__ */ d("div", { className: "flex justify-between items-center @md:hidden", children: [
|
|
527
527
|
/* @__PURE__ */ e(
|
|
528
528
|
"button",
|
|
529
529
|
{
|
|
530
|
-
className:
|
|
530
|
+
className: R(
|
|
531
531
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
532
532
|
!s && "invisible"
|
|
533
533
|
),
|
|
534
534
|
onClick: t || (() => {
|
|
535
535
|
}),
|
|
536
|
-
children: /* @__PURE__ */ e(
|
|
536
|
+
children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
|
|
537
537
|
}
|
|
538
538
|
),
|
|
539
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
540
540
|
/* @__PURE__ */ e(
|
|
541
|
-
|
|
541
|
+
J,
|
|
542
542
|
{
|
|
543
|
-
id: ((
|
|
543
|
+
id: ((N = c == null ? void 0 : c.user) == null ? void 0 : N.id) || a.id || "unknown",
|
|
544
544
|
name: i,
|
|
545
545
|
image: l,
|
|
546
546
|
size: 40
|
|
@@ -551,17 +551,17 @@ const Xe = () => {
|
|
|
551
551
|
/* @__PURE__ */ e(
|
|
552
552
|
"button",
|
|
553
553
|
{
|
|
554
|
-
className:
|
|
554
|
+
className: R(
|
|
555
555
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
556
556
|
),
|
|
557
557
|
onClick: n || (() => {
|
|
558
558
|
}),
|
|
559
|
-
children: /* @__PURE__ */ e(
|
|
559
|
+
children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
|
|
560
560
|
}
|
|
561
561
|
)
|
|
562
562
|
] }),
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ d("div", { className: "hidden @md:flex items-center justify-between gap-3 min-h-12", children: [
|
|
564
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
565
565
|
s && t && /* @__PURE__ */ e(
|
|
566
566
|
"button",
|
|
567
567
|
{
|
|
@@ -569,11 +569,11 @@ const Xe = () => {
|
|
|
569
569
|
onClick: t,
|
|
570
570
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
571
571
|
"aria-label": "Back to conversations",
|
|
572
|
-
children: /* @__PURE__ */ e(
|
|
572
|
+
children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
|
|
573
573
|
}
|
|
574
574
|
),
|
|
575
575
|
/* @__PURE__ */ e(
|
|
576
|
-
|
|
576
|
+
J,
|
|
577
577
|
{
|
|
578
578
|
id: ((m = c == null ? void 0 : c.user) == null ? void 0 : m.id) || a.id || "unknown",
|
|
579
579
|
name: i,
|
|
@@ -586,16 +586,16 @@ const Xe = () => {
|
|
|
586
586
|
r && n && /* @__PURE__ */ e(
|
|
587
587
|
"button",
|
|
588
588
|
{
|
|
589
|
-
className:
|
|
589
|
+
className: R(
|
|
590
590
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
591
591
|
),
|
|
592
592
|
onClick: n,
|
|
593
|
-
children: /* @__PURE__ */ e(
|
|
593
|
+
children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
|
|
594
594
|
}
|
|
595
595
|
)
|
|
596
596
|
] })
|
|
597
597
|
] });
|
|
598
|
-
},
|
|
598
|
+
}, ts = ({
|
|
599
599
|
isOpen: t,
|
|
600
600
|
onClose: s,
|
|
601
601
|
participant: n,
|
|
@@ -604,71 +604,71 @@ const Xe = () => {
|
|
|
604
604
|
onLeaveConversation: c,
|
|
605
605
|
onBlockParticipant: i
|
|
606
606
|
}) => {
|
|
607
|
-
var
|
|
608
|
-
const { service: l, debug: o } =
|
|
609
|
-
|
|
610
|
-
const
|
|
611
|
-
|
|
607
|
+
var _, O, W, Q, G, V, X;
|
|
608
|
+
const { service: l, debug: o } = ne(), w = $(null), [I, N] = y(!1), [m, S] = y(!1), [g, b] = y(!1);
|
|
609
|
+
H(() => {
|
|
610
|
+
const k = w.current;
|
|
611
|
+
k && (t ? k.showModal() : k.close());
|
|
612
612
|
}, [t]);
|
|
613
613
|
const E = P(async () => {
|
|
614
|
-
var
|
|
615
|
-
if (!(!l || !((
|
|
614
|
+
var k;
|
|
615
|
+
if (!(!l || !((k = n == null ? void 0 : n.user) != null && k.id)))
|
|
616
616
|
try {
|
|
617
|
-
const
|
|
618
|
-
(
|
|
619
|
-
var
|
|
620
|
-
return
|
|
617
|
+
const A = (await l.getBlockedUsers()).some(
|
|
618
|
+
(j) => {
|
|
619
|
+
var B;
|
|
620
|
+
return j.blocked_user_id === ((B = n == null ? void 0 : n.user) == null ? void 0 : B.id);
|
|
621
621
|
}
|
|
622
622
|
);
|
|
623
|
-
|
|
624
|
-
} catch (
|
|
623
|
+
N(A);
|
|
624
|
+
} catch (M) {
|
|
625
625
|
console.error(
|
|
626
626
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
627
|
-
|
|
627
|
+
M
|
|
628
628
|
);
|
|
629
629
|
}
|
|
630
|
-
}, [l, (
|
|
631
|
-
|
|
630
|
+
}, [l, (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id]);
|
|
631
|
+
H(() => {
|
|
632
632
|
t && E();
|
|
633
633
|
}, [t, E]);
|
|
634
634
|
const v = async () => {
|
|
635
|
-
var
|
|
635
|
+
var k;
|
|
636
636
|
if (!m) {
|
|
637
637
|
o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), S(!0);
|
|
638
638
|
try {
|
|
639
|
-
const
|
|
640
|
-
await r.hide(
|
|
641
|
-
} catch (
|
|
642
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
639
|
+
const M = ((k = r._client) == null ? void 0 : k.userID) ?? null;
|
|
640
|
+
await r.hide(M, !1), c && await c(r), s();
|
|
641
|
+
} catch (M) {
|
|
642
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", M);
|
|
643
643
|
} finally {
|
|
644
644
|
S(!1);
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
|
-
},
|
|
648
|
-
var
|
|
649
|
-
if (!(
|
|
650
|
-
o && console.log("[ChannelInfoDialog] Block member", (
|
|
647
|
+
}, F = async () => {
|
|
648
|
+
var k, M, A;
|
|
649
|
+
if (!(g || !l)) {
|
|
650
|
+
o && console.log("[ChannelInfoDialog] Block member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), b(!0);
|
|
651
651
|
try {
|
|
652
|
-
await l.blockUser((
|
|
653
|
-
} catch (
|
|
654
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
652
|
+
await l.blockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
653
|
+
} catch (j) {
|
|
654
|
+
console.error("[ChannelInfoDialog] Failed to block member", j);
|
|
655
655
|
} finally {
|
|
656
656
|
b(!1);
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
659
|
}, C = async () => {
|
|
660
|
-
var
|
|
661
|
-
if (!(
|
|
662
|
-
o && console.log("[ChannelInfoDialog] Unblock member", (
|
|
660
|
+
var k, M, A;
|
|
661
|
+
if (!(g || !l)) {
|
|
662
|
+
o && console.log("[ChannelInfoDialog] Unblock member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), b(!0);
|
|
663
663
|
try {
|
|
664
|
-
await l.unBlockUser((
|
|
665
|
-
} catch (
|
|
666
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
664
|
+
await l.unBlockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
665
|
+
} catch (j) {
|
|
666
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", j);
|
|
667
667
|
} finally {
|
|
668
668
|
b(!1);
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
|
-
},
|
|
671
|
+
}, T = () => {
|
|
672
672
|
s(), window.open(
|
|
673
673
|
"https://linktr.ee/s/about/trust-center/report",
|
|
674
674
|
"_blank",
|
|
@@ -676,7 +676,7 @@ const Xe = () => {
|
|
|
676
676
|
);
|
|
677
677
|
};
|
|
678
678
|
if (!n) return null;
|
|
679
|
-
const p = ((
|
|
679
|
+
const p = ((O = n.user) == null ? void 0 : O.name) || ((W = n.user) == null ? void 0 : W.id) || "Unknown member", u = (Q = n.user) == null ? void 0 : Q.image, f = (G = n.user) == null ? void 0 : G.email, x = (V = n.user) == null ? void 0 : V.username, D = f || (x ? `linktr.ee/${x}` : void 0), q = ((X = n.user) == null ? void 0 : X.id) || "unknown";
|
|
680
680
|
return (
|
|
681
681
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
682
682
|
/* @__PURE__ */ e(
|
|
@@ -685,32 +685,32 @@ const Xe = () => {
|
|
|
685
685
|
ref: w,
|
|
686
686
|
className: "mes-dialog",
|
|
687
687
|
onClose: s,
|
|
688
|
-
onClick: (
|
|
689
|
-
|
|
688
|
+
onClick: (k) => {
|
|
689
|
+
k.target === w.current && s();
|
|
690
690
|
},
|
|
691
|
-
children: /* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
691
|
+
children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
|
|
692
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
693
693
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
694
|
-
/* @__PURE__ */ e(
|
|
694
|
+
/* @__PURE__ */ e(Ne, { onClick: s })
|
|
695
695
|
] }),
|
|
696
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ d("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
697
697
|
/* @__PURE__ */ e(
|
|
698
698
|
"div",
|
|
699
699
|
{
|
|
700
700
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
701
701
|
style: { backgroundColor: "#FBFAF9" },
|
|
702
|
-
children: /* @__PURE__ */
|
|
702
|
+
children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3 w-full", children: [
|
|
703
703
|
/* @__PURE__ */ e(
|
|
704
|
-
|
|
704
|
+
J,
|
|
705
705
|
{
|
|
706
|
-
id:
|
|
706
|
+
id: q,
|
|
707
707
|
name: p,
|
|
708
|
-
image:
|
|
708
|
+
image: u,
|
|
709
709
|
size: 88,
|
|
710
710
|
shape: "circle"
|
|
711
711
|
}
|
|
712
712
|
),
|
|
713
|
-
/* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
714
714
|
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: p }),
|
|
715
715
|
D && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: D }),
|
|
716
716
|
a && /* @__PURE__ */ e(
|
|
@@ -731,44 +731,44 @@ const Xe = () => {
|
|
|
731
731
|
] })
|
|
732
732
|
}
|
|
733
733
|
),
|
|
734
|
-
/* @__PURE__ */
|
|
735
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
734
|
+
/* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
735
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
|
|
736
736
|
K,
|
|
737
737
|
{
|
|
738
738
|
onClick: v,
|
|
739
739
|
disabled: m,
|
|
740
740
|
"aria-busy": m,
|
|
741
741
|
children: [
|
|
742
|
-
m ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(
|
|
742
|
+
m ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ge, { className: "h-5 w-5" }),
|
|
743
743
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
744
744
|
]
|
|
745
745
|
}
|
|
746
746
|
) }),
|
|
747
|
-
/* @__PURE__ */ e("li", { children:
|
|
747
|
+
/* @__PURE__ */ e("li", { children: I ? /* @__PURE__ */ d(
|
|
748
748
|
K,
|
|
749
749
|
{
|
|
750
750
|
onClick: C,
|
|
751
|
-
disabled:
|
|
752
|
-
"aria-busy":
|
|
751
|
+
disabled: g,
|
|
752
|
+
"aria-busy": g,
|
|
753
753
|
children: [
|
|
754
|
-
|
|
754
|
+
g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
|
|
755
755
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
756
756
|
]
|
|
757
757
|
}
|
|
758
|
-
) : /* @__PURE__ */
|
|
758
|
+
) : /* @__PURE__ */ d(
|
|
759
759
|
K,
|
|
760
760
|
{
|
|
761
|
-
onClick:
|
|
762
|
-
disabled:
|
|
763
|
-
"aria-busy":
|
|
761
|
+
onClick: F,
|
|
762
|
+
disabled: g,
|
|
763
|
+
"aria-busy": g,
|
|
764
764
|
children: [
|
|
765
|
-
|
|
765
|
+
g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
|
|
766
766
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
767
767
|
]
|
|
768
768
|
}
|
|
769
769
|
) }),
|
|
770
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
771
|
-
/* @__PURE__ */ e(
|
|
770
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick: T, children: [
|
|
771
|
+
/* @__PURE__ */ e(Ve, { className: "h-5 w-5" }),
|
|
772
772
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
773
773
|
] }) })
|
|
774
774
|
] })
|
|
@@ -777,41 +777,41 @@ const Xe = () => {
|
|
|
777
777
|
}
|
|
778
778
|
)
|
|
779
779
|
);
|
|
780
|
-
},
|
|
780
|
+
}, rs = ({
|
|
781
781
|
onBack: t,
|
|
782
782
|
showBackButton: s,
|
|
783
783
|
renderMessageInputActions: n,
|
|
784
784
|
onLeaveConversation: r,
|
|
785
785
|
onBlockParticipant: a,
|
|
786
|
-
CustomChannelEmptyState: c =
|
|
786
|
+
CustomChannelEmptyState: c = be
|
|
787
787
|
}) => {
|
|
788
788
|
var m, S;
|
|
789
|
-
const { channel: i } =
|
|
789
|
+
const { channel: i } = fe(), [l, o] = y(!1), w = (((S = (m = i == null ? void 0 : i.state) == null ? void 0 : m.messages) == null ? void 0 : S.length) ?? 0) > 0, I = Y.useMemo(() => Object.values(i.state.members || {}).find(
|
|
790
790
|
(b) => {
|
|
791
791
|
var E;
|
|
792
792
|
return ((E = b.user) == null ? void 0 : E.id) && b.user.id !== i._client.userID;
|
|
793
793
|
}
|
|
794
|
-
), [i._client.userID, i.state.members]),
|
|
795
|
-
const
|
|
796
|
-
if (
|
|
797
|
-
return String(
|
|
798
|
-
if (
|
|
799
|
-
return
|
|
794
|
+
), [i._client.userID, i.state.members]), N = Y.useMemo(() => {
|
|
795
|
+
const g = i.data ?? {};
|
|
796
|
+
if (g.followerStatus)
|
|
797
|
+
return String(g.followerStatus);
|
|
798
|
+
if (g.isFollower !== void 0)
|
|
799
|
+
return g.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
800
800
|
}, [i.data]);
|
|
801
|
-
return /* @__PURE__ */
|
|
802
|
-
/* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ d(se, { children: [
|
|
802
|
+
/* @__PURE__ */ d(ze, { children: [
|
|
803
803
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
804
|
-
|
|
804
|
+
ns,
|
|
805
805
|
{
|
|
806
806
|
onBack: t,
|
|
807
807
|
showBackButton: s,
|
|
808
808
|
onShowInfo: () => o(!0),
|
|
809
|
-
canShowInfo: !!
|
|
809
|
+
canShowInfo: !!I
|
|
810
810
|
}
|
|
811
811
|
) }),
|
|
812
|
-
/* @__PURE__ */
|
|
812
|
+
/* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
|
|
813
813
|
/* @__PURE__ */ e(
|
|
814
|
-
|
|
814
|
+
$e,
|
|
815
815
|
{
|
|
816
816
|
hideDeletedMessages: !0,
|
|
817
817
|
hideNewMessageSeparator: !1,
|
|
@@ -821,26 +821,26 @@ const Xe = () => {
|
|
|
821
821
|
!w && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(c, {}) })
|
|
822
822
|
] }),
|
|
823
823
|
/* @__PURE__ */ e(
|
|
824
|
-
|
|
824
|
+
ss,
|
|
825
825
|
{
|
|
826
826
|
renderActions: () => n == null ? void 0 : n(i)
|
|
827
827
|
}
|
|
828
828
|
)
|
|
829
829
|
] }),
|
|
830
830
|
/* @__PURE__ */ e(
|
|
831
|
-
|
|
831
|
+
ts,
|
|
832
832
|
{
|
|
833
833
|
isOpen: l,
|
|
834
834
|
onClose: () => o(!1),
|
|
835
|
-
participant:
|
|
835
|
+
participant: I,
|
|
836
836
|
channel: i,
|
|
837
|
-
followerStatusLabel:
|
|
837
|
+
followerStatusLabel: N,
|
|
838
838
|
onLeaveConversation: r,
|
|
839
839
|
onBlockParticipant: a
|
|
840
840
|
}
|
|
841
841
|
)
|
|
842
842
|
] });
|
|
843
|
-
},
|
|
843
|
+
}, ls = ({
|
|
844
844
|
channel: t,
|
|
845
845
|
onBack: s,
|
|
846
846
|
showBackButton: n = !1,
|
|
@@ -848,16 +848,16 @@ const Xe = () => {
|
|
|
848
848
|
onLeaveConversation: a,
|
|
849
849
|
onBlockParticipant: c,
|
|
850
850
|
className: i,
|
|
851
|
-
CustomChannelEmptyState: l =
|
|
851
|
+
CustomChannelEmptyState: l = be
|
|
852
852
|
}) => /* @__PURE__ */ e(
|
|
853
853
|
"div",
|
|
854
854
|
{
|
|
855
|
-
className:
|
|
855
|
+
className: R(
|
|
856
856
|
"messaging-channel-view h-full flex flex-col bg-[#FBFAF9]",
|
|
857
857
|
i
|
|
858
858
|
),
|
|
859
|
-
children: /* @__PURE__ */ e(
|
|
860
|
-
|
|
859
|
+
children: /* @__PURE__ */ e(Be, { channel: t, children: /* @__PURE__ */ e(
|
|
860
|
+
rs,
|
|
861
861
|
{
|
|
862
862
|
onBack: s,
|
|
863
863
|
showBackButton: n,
|
|
@@ -869,15 +869,15 @@ const Xe = () => {
|
|
|
869
869
|
) })
|
|
870
870
|
}
|
|
871
871
|
);
|
|
872
|
-
function
|
|
872
|
+
function os({
|
|
873
873
|
searchQuery: t,
|
|
874
874
|
setSearchQuery: s,
|
|
875
875
|
placeholder: n
|
|
876
876
|
}) {
|
|
877
|
-
const r =
|
|
878
|
-
return /* @__PURE__ */
|
|
877
|
+
const r = $(null);
|
|
878
|
+
return /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
879
879
|
/* @__PURE__ */ e(
|
|
880
|
-
|
|
880
|
+
We,
|
|
881
881
|
{
|
|
882
882
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
883
883
|
weight: "bold"
|
|
@@ -895,7 +895,7 @@ function ts({
|
|
|
895
895
|
}
|
|
896
896
|
),
|
|
897
897
|
t && /* @__PURE__ */ e(
|
|
898
|
-
|
|
898
|
+
xe,
|
|
899
899
|
{
|
|
900
900
|
label: "Clear search",
|
|
901
901
|
onClick: () => {
|
|
@@ -903,12 +903,12 @@ function ts({
|
|
|
903
903
|
s(""), (a = r.current) == null || a.focus();
|
|
904
904
|
},
|
|
905
905
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
906
|
-
children: /* @__PURE__ */ e(
|
|
906
|
+
children: /* @__PURE__ */ e(he, { className: "h-4 w-4", weight: "bold" })
|
|
907
907
|
}
|
|
908
908
|
)
|
|
909
909
|
] });
|
|
910
910
|
}
|
|
911
|
-
const
|
|
911
|
+
const as = ({
|
|
912
912
|
participantSource: t,
|
|
913
913
|
onSelectParticipant: s,
|
|
914
914
|
onClose: n,
|
|
@@ -917,17 +917,17 @@ const rs = ({
|
|
|
917
917
|
searchPlaceholder: c = "Search participants...",
|
|
918
918
|
className: i
|
|
919
919
|
}) => {
|
|
920
|
-
const { debug: l } =
|
|
920
|
+
const { debug: l } = ne(), [o, w] = y(""), [I, N] = y([]), [m, S] = y(!1), [g, b] = y(null), [E, v] = y(
|
|
921
921
|
null
|
|
922
|
-
),
|
|
923
|
-
|
|
922
|
+
), F = $(!1);
|
|
923
|
+
H(() => {
|
|
924
924
|
if (t.loading) {
|
|
925
925
|
l && console.log(
|
|
926
926
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
927
927
|
);
|
|
928
928
|
return;
|
|
929
929
|
}
|
|
930
|
-
if (
|
|
930
|
+
if (F.current) return;
|
|
931
931
|
(async () => {
|
|
932
932
|
l && console.log("[ParticipantPicker] Loading initial participants..."), S(!0), b(null);
|
|
933
933
|
try {
|
|
@@ -936,45 +936,45 @@ const rs = ({
|
|
|
936
936
|
// Load all participants initially
|
|
937
937
|
limit: 100
|
|
938
938
|
});
|
|
939
|
-
|
|
939
|
+
N(f.participants), F.current = !0, l && console.log(
|
|
940
940
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
941
941
|
f.participants.length
|
|
942
942
|
);
|
|
943
943
|
} catch (f) {
|
|
944
|
-
const
|
|
945
|
-
b(
|
|
944
|
+
const x = f instanceof Error ? f.message : "Failed to load participants";
|
|
945
|
+
b(x), console.error("[ParticipantPicker] Failed to load participants:", f);
|
|
946
946
|
} finally {
|
|
947
947
|
S(!1);
|
|
948
948
|
}
|
|
949
949
|
})();
|
|
950
950
|
}, [t.loading, l]);
|
|
951
|
-
const C =
|
|
952
|
-
var
|
|
951
|
+
const C = I.filter((u) => !r.has(u.id)).filter((u) => {
|
|
952
|
+
var x;
|
|
953
953
|
if (!o) return !0;
|
|
954
954
|
const f = o.toLowerCase();
|
|
955
|
-
return
|
|
956
|
-
}),
|
|
957
|
-
async (
|
|
955
|
+
return u.name.toLowerCase().includes(f) || ((x = u.email) == null ? void 0 : x.toLowerCase().includes(f)) || !1;
|
|
956
|
+
}), T = P(
|
|
957
|
+
async (u) => {
|
|
958
958
|
if (!E) {
|
|
959
|
-
v(
|
|
959
|
+
v(u.id);
|
|
960
960
|
try {
|
|
961
|
-
await s(
|
|
961
|
+
await s(u);
|
|
962
962
|
} catch (f) {
|
|
963
963
|
console.error("[ParticipantPicker] Failed to start chat:", f), v(null);
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
966
|
},
|
|
967
967
|
[s, E]
|
|
968
|
-
), p = (
|
|
969
|
-
(
|
|
968
|
+
), p = (u, f) => {
|
|
969
|
+
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), T(f));
|
|
970
970
|
};
|
|
971
|
-
return /* @__PURE__ */
|
|
972
|
-
/* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
971
|
+
return /* @__PURE__ */ d("div", { className: R("flex flex-col h-full", i), children: [
|
|
972
|
+
/* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
973
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
|
|
974
974
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
975
|
-
/* @__PURE__ */ e(
|
|
975
|
+
/* @__PURE__ */ e(Ne, { onClick: n })
|
|
976
976
|
] }),
|
|
977
|
-
/* @__PURE__ */
|
|
977
|
+
/* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
|
|
978
978
|
"Select a ",
|
|
979
979
|
a.slice(0, -1),
|
|
980
980
|
" to start messaging (",
|
|
@@ -983,7 +983,7 @@ const rs = ({
|
|
|
983
983
|
t.totalCount !== void 0 && ` โข ${t.totalCount} ${a} total`
|
|
984
984
|
] }),
|
|
985
985
|
/* @__PURE__ */ e(
|
|
986
|
-
|
|
986
|
+
os,
|
|
987
987
|
{
|
|
988
988
|
searchQuery: o,
|
|
989
989
|
setSearchQuery: w,
|
|
@@ -991,65 +991,91 @@ const rs = ({
|
|
|
991
991
|
}
|
|
992
992
|
)
|
|
993
993
|
] }),
|
|
994
|
-
|
|
994
|
+
g && /* @__PURE__ */ d("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
995
995
|
"Error loading ",
|
|
996
996
|
a,
|
|
997
997
|
": ",
|
|
998
|
-
|
|
998
|
+
g
|
|
999
999
|
] }),
|
|
1000
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && C.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */
|
|
1000
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && C.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
|
|
1001
1001
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1002
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
|
|
1003
1003
|
"Loading ",
|
|
1004
1004
|
a,
|
|
1005
1005
|
"..."
|
|
1006
1006
|
] })
|
|
1007
|
-
] }) }) : C.length === 0 ? /* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
1009
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${a} found` :
|
|
1010
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" :
|
|
1011
|
-
] }) : /* @__PURE__ */
|
|
1012
|
-
C.map((
|
|
1013
|
-
const f =
|
|
1007
|
+
] }) }) : C.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
|
|
1008
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(de, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1009
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${a} found` : I.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
|
|
1010
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : I.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
|
|
1011
|
+
] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
|
|
1012
|
+
C.map((u) => {
|
|
1013
|
+
const f = u.name || u.email || u.id, x = u.email && u.name ? u.email : u.phone;
|
|
1014
1014
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1015
1015
|
"button",
|
|
1016
1016
|
{
|
|
1017
1017
|
type: "button",
|
|
1018
|
-
onClick: () =>
|
|
1019
|
-
onKeyDown: (D) => p(D,
|
|
1018
|
+
onClick: () => T(u),
|
|
1019
|
+
onKeyDown: (D) => p(D, u),
|
|
1020
1020
|
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",
|
|
1021
|
-
children: /* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1021
|
+
children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
1022
|
+
/* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1023
1023
|
/* @__PURE__ */ e(
|
|
1024
|
-
|
|
1024
|
+
J,
|
|
1025
1025
|
{
|
|
1026
|
-
id:
|
|
1026
|
+
id: u.id,
|
|
1027
1027
|
name: f,
|
|
1028
|
-
image:
|
|
1028
|
+
image: u.image,
|
|
1029
1029
|
size: 40
|
|
1030
1030
|
}
|
|
1031
1031
|
),
|
|
1032
|
-
/* @__PURE__ */
|
|
1032
|
+
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
|
|
1033
1033
|
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: f }),
|
|
1034
|
-
|
|
1034
|
+
x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
|
|
1035
1035
|
] })
|
|
1036
1036
|
] }),
|
|
1037
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E ===
|
|
1037
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E === u.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5 text-stone" }) })
|
|
1038
1038
|
] })
|
|
1039
1039
|
}
|
|
1040
|
-
) },
|
|
1040
|
+
) }, u.id);
|
|
1041
1041
|
}),
|
|
1042
|
-
m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */
|
|
1042
|
+
m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
|
|
1043
1043
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1044
1044
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1045
1045
|
] }) })
|
|
1046
1046
|
] }) })
|
|
1047
1047
|
] });
|
|
1048
|
-
},
|
|
1048
|
+
}, is = ({ hasChannels: t, onStartConversation: s, participantLabel: n }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
1049
1049
|
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "๐ฌ" }) }),
|
|
1050
1050
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
|
|
1051
|
-
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ?
|
|
1052
|
-
|
|
1051
|
+
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(se, { children: [
|
|
1052
|
+
"Choose a conversation from the list or",
|
|
1053
|
+
" ",
|
|
1054
|
+
s && /* @__PURE__ */ d(me, { onClick: s, children: [
|
|
1055
|
+
"start a new conversation with a ",
|
|
1056
|
+
n.slice(0, -1),
|
|
1057
|
+
"."
|
|
1058
|
+
] })
|
|
1059
|
+
] }) : s && /* @__PURE__ */ d(se, { children: [
|
|
1060
|
+
/* @__PURE__ */ d(me, { onClick: s, children: [
|
|
1061
|
+
"Start a new conversation with one of your ",
|
|
1062
|
+
n
|
|
1063
|
+
] }),
|
|
1064
|
+
" ",
|
|
1065
|
+
"to begin messaging."
|
|
1066
|
+
] }) })
|
|
1067
|
+
] }) }), me = ({
|
|
1068
|
+
onClick: t,
|
|
1069
|
+
children: s
|
|
1070
|
+
}) => /* @__PURE__ */ e(
|
|
1071
|
+
"button",
|
|
1072
|
+
{
|
|
1073
|
+
type: "button",
|
|
1074
|
+
onClick: t,
|
|
1075
|
+
className: "inline-flex items-center gap-1 text-sm font-medium text-primary hover:text-primary-alt focus:outline-none focus:ring-2 focus:ring-primary",
|
|
1076
|
+
children: s
|
|
1077
|
+
}
|
|
1078
|
+
), le = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
1053
1079
|
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "โ ๏ธ" }) }),
|
|
1054
1080
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1055
1081
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1062,12 +1088,12 @@ const rs = ({
|
|
|
1062
1088
|
children: "Go Back"
|
|
1063
1089
|
}
|
|
1064
1090
|
)
|
|
1065
|
-
] }) }),
|
|
1091
|
+
] }) }), cs = ({ className: t, message: s }) => /* @__PURE__ */ d(
|
|
1066
1092
|
"div",
|
|
1067
1093
|
{
|
|
1068
|
-
className:
|
|
1094
|
+
className: R("flex items-center justify-center h-full", t),
|
|
1069
1095
|
children: [
|
|
1070
|
-
/* @__PURE__ */
|
|
1096
|
+
/* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1071
1097
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1072
1098
|
"animateTransform",
|
|
1073
1099
|
{
|
|
@@ -1105,10 +1131,10 @@ const rs = ({
|
|
|
1105
1131
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1106
1132
|
]
|
|
1107
1133
|
}
|
|
1108
|
-
),
|
|
1109
|
-
/* @__PURE__ */ e(
|
|
1134
|
+
), ds = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
1135
|
+
/* @__PURE__ */ e(cs, { className: "w-6 h-6" }),
|
|
1110
1136
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1111
|
-
] }) }),
|
|
1137
|
+
] }) }), vs = ({
|
|
1112
1138
|
capabilities: t = {},
|
|
1113
1139
|
className: s,
|
|
1114
1140
|
renderMessageInputActions: n,
|
|
@@ -1119,119 +1145,123 @@ const rs = ({
|
|
|
1119
1145
|
CustomChannelEmptyState: l,
|
|
1120
1146
|
showChannelList: o = !0,
|
|
1121
1147
|
filters: w,
|
|
1122
|
-
channelListCustomEmptyStateIndicator:
|
|
1148
|
+
channelListCustomEmptyStateIndicator: I
|
|
1123
1149
|
}) => {
|
|
1124
1150
|
const {
|
|
1125
|
-
service:
|
|
1151
|
+
service: N,
|
|
1126
1152
|
client: m,
|
|
1127
1153
|
isConnected: S,
|
|
1128
|
-
isLoading:
|
|
1154
|
+
isLoading: g,
|
|
1129
1155
|
error: b,
|
|
1130
1156
|
refreshConnection: E,
|
|
1131
1157
|
debug: v
|
|
1132
|
-
} =
|
|
1133
|
-
|
|
1158
|
+
} = qe(), [F, C] = y(null), [T, p] = y(!1), [u, f] = y(!1), [x, D] = y(/* @__PURE__ */ new Set()), [q, _] = y(0), [O, W] = y(!1), [Q, G] = y(null), V = $(null), {
|
|
1159
|
+
showStartConversation: X = !1,
|
|
1160
|
+
participantSource: k,
|
|
1161
|
+
participantLabel: M = "participants"
|
|
1162
|
+
} = t, A = Y.useMemo(() => {
|
|
1163
|
+
const h = m == null ? void 0 : m.userID;
|
|
1134
1164
|
return {
|
|
1135
1165
|
...{
|
|
1136
1166
|
type: "messaging",
|
|
1137
1167
|
last_message_at: { $exists: !0 },
|
|
1138
|
-
...
|
|
1139
|
-
members: { $in: [
|
|
1168
|
+
...h && {
|
|
1169
|
+
members: { $in: [h] },
|
|
1140
1170
|
hidden: !1
|
|
1141
1171
|
}
|
|
1142
1172
|
},
|
|
1143
1173
|
...w
|
|
1144
1174
|
};
|
|
1145
|
-
}, [w, m == null ? void 0 : m.userID]),
|
|
1175
|
+
}, [w, m == null ? void 0 : m.userID]), j = $(null), B = P(async () => {
|
|
1146
1176
|
if (!m || !S) return;
|
|
1147
|
-
const
|
|
1148
|
-
if (
|
|
1177
|
+
const h = m.userID;
|
|
1178
|
+
if (h)
|
|
1149
1179
|
try {
|
|
1150
|
-
v && console.log("[MessagingShell] Syncing channels for user:",
|
|
1151
|
-
const
|
|
1180
|
+
v && console.log("[MessagingShell] Syncing channels for user:", h);
|
|
1181
|
+
const L = await m.queryChannels(
|
|
1152
1182
|
{
|
|
1153
1183
|
type: "messaging",
|
|
1154
|
-
members: { $in: [
|
|
1184
|
+
members: { $in: [h] }
|
|
1155
1185
|
},
|
|
1156
1186
|
{},
|
|
1157
1187
|
{ limit: 100 }
|
|
1158
|
-
),
|
|
1159
|
-
|
|
1160
|
-
const
|
|
1161
|
-
Object.values(
|
|
1162
|
-
var
|
|
1163
|
-
const
|
|
1164
|
-
|
|
1188
|
+
), U = /* @__PURE__ */ new Set();
|
|
1189
|
+
L.forEach((z) => {
|
|
1190
|
+
const Se = z.state.members;
|
|
1191
|
+
Object.values(Se).forEach((ke) => {
|
|
1192
|
+
var oe;
|
|
1193
|
+
const re = (oe = ke.user) == null ? void 0 : oe.id;
|
|
1194
|
+
re && re !== h && U.add(re);
|
|
1165
1195
|
});
|
|
1166
|
-
}), D(
|
|
1167
|
-
channelCount:
|
|
1168
|
-
memberCount:
|
|
1196
|
+
}), D(U), p(L.length > 0), j.current = h, v && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1197
|
+
channelCount: L.length,
|
|
1198
|
+
memberCount: U.size
|
|
1169
1199
|
});
|
|
1170
|
-
} catch (
|
|
1171
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1200
|
+
} catch (L) {
|
|
1201
|
+
console.error("[MessagingShell] Failed to sync channels:", L);
|
|
1172
1202
|
}
|
|
1173
1203
|
}, [m, S, v]);
|
|
1174
|
-
|
|
1204
|
+
H(() => {
|
|
1175
1205
|
if (!m || !S) return;
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1178
|
-
}, [m, S,
|
|
1206
|
+
const h = m.userID;
|
|
1207
|
+
h && j.current !== h && B();
|
|
1208
|
+
}, [m, S, B]), H(() => {
|
|
1179
1209
|
if (!c || !m || !S) return;
|
|
1180
1210
|
(async () => {
|
|
1181
|
-
const
|
|
1182
|
-
if (
|
|
1211
|
+
const L = m.userID;
|
|
1212
|
+
if (L)
|
|
1183
1213
|
try {
|
|
1184
1214
|
v && console.log(
|
|
1185
1215
|
"[MessagingShell] Loading initial conversation with:",
|
|
1186
1216
|
c
|
|
1187
1217
|
);
|
|
1188
|
-
const
|
|
1218
|
+
const U = await m.queryChannels(
|
|
1189
1219
|
{
|
|
1190
1220
|
type: "messaging",
|
|
1191
|
-
members: { $eq: [
|
|
1221
|
+
members: { $eq: [L, c] }
|
|
1192
1222
|
},
|
|
1193
1223
|
{},
|
|
1194
1224
|
{ limit: 1 }
|
|
1195
1225
|
);
|
|
1196
|
-
if (
|
|
1197
|
-
C(
|
|
1226
|
+
if (U.length > 0)
|
|
1227
|
+
C(U[0]), W(!0), G(null), r && r(U[0]), v && console.log(
|
|
1198
1228
|
"[MessagingShell] Initial conversation loaded:",
|
|
1199
|
-
|
|
1229
|
+
U[0].id
|
|
1200
1230
|
);
|
|
1201
|
-
else if (i &&
|
|
1231
|
+
else if (i && N) {
|
|
1202
1232
|
v && console.log(
|
|
1203
1233
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1204
1234
|
i
|
|
1205
1235
|
);
|
|
1206
1236
|
try {
|
|
1207
|
-
const
|
|
1237
|
+
const z = await N.startChannelWithParticipant({
|
|
1208
1238
|
id: i.id,
|
|
1209
1239
|
name: i.name,
|
|
1210
1240
|
email: i.email,
|
|
1211
1241
|
phone: i.phone
|
|
1212
1242
|
});
|
|
1213
|
-
C(
|
|
1243
|
+
C(z), W(!0), G(null), r && r(z), v && console.log(
|
|
1214
1244
|
"[MessagingShell] Channel created and loaded:",
|
|
1215
|
-
|
|
1245
|
+
z.id
|
|
1216
1246
|
);
|
|
1217
|
-
} catch (
|
|
1247
|
+
} catch (z) {
|
|
1218
1248
|
console.error(
|
|
1219
1249
|
"[MessagingShell] Failed to create conversation:",
|
|
1220
|
-
|
|
1221
|
-
),
|
|
1250
|
+
z
|
|
1251
|
+
), G("Failed to create conversation");
|
|
1222
1252
|
}
|
|
1223
1253
|
} else
|
|
1224
|
-
|
|
1254
|
+
G(
|
|
1225
1255
|
"No conversation found with this account"
|
|
1226
1256
|
), v && console.log(
|
|
1227
1257
|
"[MessagingShell] No conversation found for:",
|
|
1228
1258
|
c
|
|
1229
1259
|
);
|
|
1230
|
-
} catch (
|
|
1260
|
+
} catch (U) {
|
|
1231
1261
|
console.error(
|
|
1232
1262
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1233
|
-
|
|
1234
|
-
),
|
|
1263
|
+
U
|
|
1264
|
+
), G("Failed to load conversation");
|
|
1235
1265
|
}
|
|
1236
1266
|
})();
|
|
1237
1267
|
}, [
|
|
@@ -1239,93 +1269,96 @@ const rs = ({
|
|
|
1239
1269
|
i,
|
|
1240
1270
|
m,
|
|
1241
1271
|
S,
|
|
1242
|
-
|
|
1272
|
+
N,
|
|
1243
1273
|
v,
|
|
1244
1274
|
r
|
|
1245
1275
|
]);
|
|
1246
|
-
const
|
|
1247
|
-
(
|
|
1248
|
-
C(
|
|
1276
|
+
const ve = P(
|
|
1277
|
+
(h) => {
|
|
1278
|
+
C(h), r == null || r(h);
|
|
1249
1279
|
},
|
|
1250
1280
|
[r]
|
|
1251
|
-
),
|
|
1252
|
-
|
|
1253
|
-
}, [
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1281
|
+
), Ce = P(() => {
|
|
1282
|
+
O || C(null);
|
|
1283
|
+
}, [O]), we = P(() => {
|
|
1284
|
+
var h;
|
|
1285
|
+
k && (_((L) => L + 1), f(!0), (h = V.current) == null || h.showModal());
|
|
1286
|
+
}, [k]), Ee = P(
|
|
1287
|
+
async (h) => {
|
|
1288
|
+
var L;
|
|
1289
|
+
if (N)
|
|
1257
1290
|
try {
|
|
1258
1291
|
v && console.log(
|
|
1259
1292
|
"[MessagingShell] Starting conversation with:",
|
|
1260
|
-
|
|
1293
|
+
h.id
|
|
1261
1294
|
);
|
|
1262
|
-
const
|
|
1263
|
-
id:
|
|
1264
|
-
name:
|
|
1265
|
-
email:
|
|
1266
|
-
phone:
|
|
1295
|
+
const U = await N.startChannelWithParticipant({
|
|
1296
|
+
id: h.id,
|
|
1297
|
+
name: h.name,
|
|
1298
|
+
email: h.email,
|
|
1299
|
+
phone: h.phone
|
|
1267
1300
|
});
|
|
1268
1301
|
try {
|
|
1269
|
-
await
|
|
1270
|
-
} catch (
|
|
1271
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1302
|
+
await U.show();
|
|
1303
|
+
} catch (z) {
|
|
1304
|
+
console.warn("[MessagingShell] Failed to unhide channel:", z);
|
|
1272
1305
|
}
|
|
1273
|
-
C(
|
|
1274
|
-
} catch (
|
|
1275
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1306
|
+
C(U), f(!1), (L = V.current) == null || L.close(), a == null || a(h);
|
|
1307
|
+
} catch (U) {
|
|
1308
|
+
console.error("[MessagingShell] Failed to start conversation:", U);
|
|
1276
1309
|
}
|
|
1277
1310
|
},
|
|
1278
|
-
[
|
|
1279
|
-
),
|
|
1280
|
-
var
|
|
1281
|
-
f(!1), (
|
|
1282
|
-
}, []),
|
|
1283
|
-
async (
|
|
1284
|
-
v && console.log("[MessagingShell] Leaving conversation:",
|
|
1311
|
+
[N, a, v]
|
|
1312
|
+
), te = P(() => {
|
|
1313
|
+
var h;
|
|
1314
|
+
f(!1), (h = V.current) == null || h.close();
|
|
1315
|
+
}, []), ye = P(
|
|
1316
|
+
async (h) => {
|
|
1317
|
+
v && console.log("[MessagingShell] Leaving conversation:", h.id), C(null), W(!1), j.current = null, await B();
|
|
1285
1318
|
},
|
|
1286
|
-
[
|
|
1287
|
-
),
|
|
1288
|
-
async (
|
|
1289
|
-
v && console.log("[MessagingShell] Blocking participant:",
|
|
1319
|
+
[B, v]
|
|
1320
|
+
), Ie = P(
|
|
1321
|
+
async (h) => {
|
|
1322
|
+
v && console.log("[MessagingShell] Blocking participant:", h), C(null), W(!1), j.current = null, await B();
|
|
1290
1323
|
},
|
|
1291
|
-
[
|
|
1292
|
-
), Z = !!
|
|
1293
|
-
return
|
|
1294
|
-
|
|
1324
|
+
[B, v]
|
|
1325
|
+
), Z = !!F;
|
|
1326
|
+
return g ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(ds, {}) }) : b ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: b, onBack: E }) }) : !S || !m ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
|
|
1327
|
+
le,
|
|
1295
1328
|
{
|
|
1296
1329
|
message: "Not connected to messaging service",
|
|
1297
1330
|
onBack: E
|
|
1298
1331
|
}
|
|
1299
|
-
) }) :
|
|
1332
|
+
) }) : Q ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: Q }) }) : /* @__PURE__ */ d(
|
|
1300
1333
|
"div",
|
|
1301
1334
|
{
|
|
1302
|
-
className:
|
|
1335
|
+
className: R(
|
|
1303
1336
|
"messaging-shell h-full bg-white overflow-hidden",
|
|
1304
1337
|
s
|
|
1305
1338
|
),
|
|
1306
1339
|
children: [
|
|
1307
|
-
/* @__PURE__ */
|
|
1340
|
+
/* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
|
|
1308
1341
|
/* @__PURE__ */ e(
|
|
1309
1342
|
"div",
|
|
1310
1343
|
{
|
|
1311
|
-
className:
|
|
1344
|
+
className: R(
|
|
1312
1345
|
"messaging-channel-list-sidebar min-h-0 min-w-0 bg-white lg:bg-chalk lg:flex lg:flex-col lg:border-r lg:border-sand",
|
|
1313
1346
|
{
|
|
1314
1347
|
// Explicitly hidden via prop or in direct conversation mode
|
|
1315
|
-
"!hidden": o === !1 ||
|
|
1348
|
+
"!hidden": o === !1 || O,
|
|
1316
1349
|
// Normal mode: hide on mobile when channel selected, show on desktop
|
|
1317
|
-
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": o !== !1 && !
|
|
1350
|
+
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": o !== !1 && !O && Z,
|
|
1318
1351
|
// Normal mode: show when no channel selected
|
|
1319
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": o !== !1 && !
|
|
1352
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": o !== !1 && !O && !Z
|
|
1320
1353
|
}
|
|
1321
1354
|
),
|
|
1322
1355
|
children: /* @__PURE__ */ e(
|
|
1323
|
-
|
|
1356
|
+
Ke,
|
|
1324
1357
|
{
|
|
1325
|
-
onChannelSelect:
|
|
1326
|
-
selectedChannel:
|
|
1327
|
-
filters:
|
|
1328
|
-
customEmptyStateIndicator:
|
|
1358
|
+
onChannelSelect: ve,
|
|
1359
|
+
selectedChannel: F || void 0,
|
|
1360
|
+
filters: A,
|
|
1361
|
+
customEmptyStateIndicator: I
|
|
1329
1362
|
}
|
|
1330
1363
|
)
|
|
1331
1364
|
}
|
|
@@ -1333,59 +1366,66 @@ const rs = ({
|
|
|
1333
1366
|
/* @__PURE__ */ e(
|
|
1334
1367
|
"div",
|
|
1335
1368
|
{
|
|
1336
|
-
className:
|
|
1369
|
+
className: R(
|
|
1337
1370
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1338
1371
|
{
|
|
1339
1372
|
// In direct conversation mode, always show (full width)
|
|
1340
|
-
flex:
|
|
1373
|
+
flex: O || Z,
|
|
1341
1374
|
// Normal mode: hide on mobile when no channel selected
|
|
1342
|
-
"hidden lg:flex": !
|
|
1375
|
+
"hidden lg:flex": !O && !Z
|
|
1343
1376
|
}
|
|
1344
1377
|
),
|
|
1345
|
-
children:
|
|
1346
|
-
|
|
1378
|
+
children: F ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1379
|
+
ls,
|
|
1347
1380
|
{
|
|
1348
|
-
channel:
|
|
1349
|
-
onBack:
|
|
1350
|
-
showBackButton: !
|
|
1381
|
+
channel: F,
|
|
1382
|
+
onBack: Ce,
|
|
1383
|
+
showBackButton: !O,
|
|
1351
1384
|
renderMessageInputActions: n,
|
|
1352
|
-
onLeaveConversation:
|
|
1353
|
-
onBlockParticipant:
|
|
1385
|
+
onLeaveConversation: ye,
|
|
1386
|
+
onBlockParticipant: Ie,
|
|
1354
1387
|
CustomChannelEmptyState: l
|
|
1355
1388
|
},
|
|
1356
|
-
|
|
1357
|
-
) }) : /* @__PURE__ */ e(
|
|
1389
|
+
F.id
|
|
1390
|
+
) }) : /* @__PURE__ */ e(
|
|
1391
|
+
is,
|
|
1392
|
+
{
|
|
1393
|
+
hasChannels: T,
|
|
1394
|
+
onStartConversation: X ? we : void 0,
|
|
1395
|
+
participantLabel: M
|
|
1396
|
+
}
|
|
1397
|
+
)
|
|
1358
1398
|
}
|
|
1359
1399
|
)
|
|
1360
1400
|
] }),
|
|
1361
|
-
|
|
1401
|
+
k && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1362
1402
|
/* @__PURE__ */ e(
|
|
1363
1403
|
"dialog",
|
|
1364
1404
|
{
|
|
1365
1405
|
ref: V,
|
|
1366
1406
|
className: "mes-dialog",
|
|
1367
|
-
onClick: (
|
|
1368
|
-
|
|
1407
|
+
onClick: (h) => {
|
|
1408
|
+
h.target === V.current && te();
|
|
1369
1409
|
},
|
|
1370
|
-
onClose:
|
|
1410
|
+
onClose: te,
|
|
1371
1411
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1372
|
-
|
|
1412
|
+
as,
|
|
1373
1413
|
{
|
|
1374
|
-
participantSource:
|
|
1375
|
-
onSelectParticipant:
|
|
1376
|
-
onClose:
|
|
1377
|
-
existingParticipantIds:
|
|
1378
|
-
participantLabel:
|
|
1379
|
-
searchPlaceholder: `Search ${
|
|
1414
|
+
participantSource: k,
|
|
1415
|
+
onSelectParticipant: Ee,
|
|
1416
|
+
onClose: te,
|
|
1417
|
+
existingParticipantIds: x,
|
|
1418
|
+
participantLabel: M,
|
|
1419
|
+
searchPlaceholder: `Search ${M}...`
|
|
1380
1420
|
},
|
|
1381
|
-
|
|
1421
|
+
q
|
|
1382
1422
|
) })
|
|
1383
1423
|
}
|
|
1384
1424
|
)
|
|
1385
1425
|
]
|
|
1386
1426
|
}
|
|
1387
1427
|
);
|
|
1388
|
-
},
|
|
1428
|
+
}, us = ({
|
|
1389
1429
|
question: t,
|
|
1390
1430
|
onClick: s,
|
|
1391
1431
|
loading: n = !1,
|
|
@@ -1397,7 +1437,7 @@ const rs = ({
|
|
|
1397
1437
|
onClick: s,
|
|
1398
1438
|
disabled: n,
|
|
1399
1439
|
style: { backgroundColor: "#E6E5E3" },
|
|
1400
|
-
className:
|
|
1440
|
+
className: R(
|
|
1401
1441
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1402
1442
|
{
|
|
1403
1443
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1407,7 +1447,7 @@ const rs = ({
|
|
|
1407
1447
|
),
|
|
1408
1448
|
children: t
|
|
1409
1449
|
}
|
|
1410
|
-
),
|
|
1450
|
+
), Cs = ({
|
|
1411
1451
|
faqs: t,
|
|
1412
1452
|
onFaqClick: s,
|
|
1413
1453
|
loadingFaqId: n,
|
|
@@ -1417,9 +1457,9 @@ const rs = ({
|
|
|
1417
1457
|
avatarName: i
|
|
1418
1458
|
}) => {
|
|
1419
1459
|
const l = t.filter((o) => o.enabled).sort((o, w) => (o.order ?? 0) - (w.order ?? 0));
|
|
1420
|
-
return l.length === 0 ? null : /* @__PURE__ */ e("div", { className:
|
|
1460
|
+
return l.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6", a), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
|
|
1421
1461
|
(c || i) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1422
|
-
|
|
1462
|
+
J,
|
|
1423
1463
|
{
|
|
1424
1464
|
id: i || "account",
|
|
1425
1465
|
name: i || "Account",
|
|
@@ -1428,7 +1468,7 @@ const rs = ({
|
|
|
1428
1468
|
shape: "circle"
|
|
1429
1469
|
}
|
|
1430
1470
|
) }),
|
|
1431
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ d(
|
|
1432
1472
|
"div",
|
|
1433
1473
|
{
|
|
1434
1474
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
@@ -1436,7 +1476,7 @@ const rs = ({
|
|
|
1436
1476
|
children: [
|
|
1437
1477
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1438
1478
|
l.map((o) => /* @__PURE__ */ e(
|
|
1439
|
-
|
|
1479
|
+
us,
|
|
1440
1480
|
{
|
|
1441
1481
|
question: o.question,
|
|
1442
1482
|
onClick: () => s(o.id),
|
|
@@ -1448,59 +1488,59 @@ const rs = ({
|
|
|
1448
1488
|
}
|
|
1449
1489
|
)
|
|
1450
1490
|
] }) });
|
|
1451
|
-
},
|
|
1452
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] =
|
|
1491
|
+
}, ws = (t, s = {}) => {
|
|
1492
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] = y([]), [i, l] = y(!1), [o, w] = y(null), [I, N] = y(n), [m, S] = y(!0), [g, b] = y(), E = P(async (T = !1, p) => {
|
|
1453
1493
|
if (i) return;
|
|
1454
|
-
const
|
|
1494
|
+
const u = p !== void 0 ? p : I;
|
|
1455
1495
|
l(!0), w(null);
|
|
1456
1496
|
try {
|
|
1457
1497
|
const f = await t.loadParticipants({
|
|
1458
|
-
search:
|
|
1498
|
+
search: u || void 0,
|
|
1459
1499
|
limit: r,
|
|
1460
|
-
cursor:
|
|
1500
|
+
cursor: T ? void 0 : g
|
|
1461
1501
|
});
|
|
1462
1502
|
c(
|
|
1463
|
-
(
|
|
1503
|
+
(x) => T ? f.participants : [...x, ...f.participants]
|
|
1464
1504
|
), S(f.hasMore), b(f.nextCursor);
|
|
1465
1505
|
} catch (f) {
|
|
1466
|
-
const
|
|
1467
|
-
w(
|
|
1506
|
+
const x = f instanceof Error ? f.message : "Failed to load participants";
|
|
1507
|
+
w(x), console.error("[useParticipants] Load error:", f);
|
|
1468
1508
|
} finally {
|
|
1469
1509
|
l(!1);
|
|
1470
1510
|
}
|
|
1471
|
-
}, [t,
|
|
1511
|
+
}, [t, I, g, r, i]), v = P(() => {
|
|
1472
1512
|
m && !i && E(!1);
|
|
1473
|
-
}, [m, i, E]),
|
|
1474
|
-
|
|
1513
|
+
}, [m, i, E]), F = P((T) => {
|
|
1514
|
+
N(T), b(void 0), E(!0, T);
|
|
1475
1515
|
}, [E]), C = P(() => {
|
|
1476
1516
|
b(void 0), E(!0);
|
|
1477
1517
|
}, [E]);
|
|
1478
|
-
return
|
|
1518
|
+
return H(() => {
|
|
1479
1519
|
E(!0);
|
|
1480
1520
|
}, [t.loadParticipants]), {
|
|
1481
1521
|
participants: a,
|
|
1482
1522
|
loading: i,
|
|
1483
1523
|
error: o,
|
|
1484
|
-
searchQuery:
|
|
1524
|
+
searchQuery: I,
|
|
1485
1525
|
hasMore: m,
|
|
1486
1526
|
totalCount: t.totalCount,
|
|
1487
1527
|
loadMore: v,
|
|
1488
|
-
search:
|
|
1528
|
+
search: F,
|
|
1489
1529
|
refresh: C
|
|
1490
1530
|
};
|
|
1491
1531
|
};
|
|
1492
1532
|
export {
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1533
|
+
J as Avatar,
|
|
1534
|
+
be as ChannelEmptyState,
|
|
1535
|
+
Ke as ChannelList,
|
|
1536
|
+
ls as ChannelView,
|
|
1537
|
+
Cs as FaqList,
|
|
1538
|
+
us as FaqListItem,
|
|
1539
|
+
bs as MessagingProvider,
|
|
1540
|
+
vs as MessagingShell,
|
|
1541
|
+
as as ParticipantPicker,
|
|
1542
|
+
Je as formatRelativeTime,
|
|
1543
|
+
qe as useMessaging,
|
|
1544
|
+
ws as useParticipants
|
|
1505
1545
|
};
|
|
1506
1546
|
//# sourceMappingURL=index.js.map
|