@linktr.ee/messaging-react 1.12.6 โ 1.12.8-rc-1765966726
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,9 +1,9 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as ve } from "react/jsx-runtime";
|
|
2
2
|
import p from "classnames";
|
|
3
3
|
import U, { createContext as Pe, useContext as Oe, useCallback as D, useState as y, useRef as z, useEffect as G } from "react";
|
|
4
4
|
import { StreamChatService as je } from "@linktr.ee/messaging-core";
|
|
5
|
-
import { Chat as Ae, ChannelList as ze,
|
|
6
|
-
import { XIcon as
|
|
5
|
+
import { Chat as Ae, ChannelList as ze, MessageSimple as Be, useMessageComposer as $e, useStateStore as Ge, MessageInput as He, useMessageInputContext as Ve, useMessageComposerHasSendableData as We, SimpleAttachmentSelector as Ze, QuotedMessagePreview as qe, AttachmentPreviewList as Ye, TextareaComposer as Je, MessageTimestamp as Qe, Channel as Xe, useChannelStateContext as we, WithComponents as Ke, Window as es, MessageList as ss } from "stream-chat-react";
|
|
6
|
+
import { XIcon as ue, ArrowUpIcon as ts, ArrowLeftIcon as fe, DotsThreeIcon as ge, SpinnerGapIcon as re, SignOutIcon as ns, ProhibitInsetIcon as xe, FlagIcon as rs, MagnifyingGlassIcon as ls, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as be } from "stream-chat";
|
|
8
8
|
const ye = Pe({
|
|
9
9
|
service: null,
|
|
@@ -15,19 +15,19 @@ const ye = Pe({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), oe = () => Oe(ye),
|
|
18
|
+
}), oe = () => Oe(ye), Ls = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
22
|
apiKey: r,
|
|
23
23
|
capabilities: a = {},
|
|
24
|
-
debug:
|
|
24
|
+
debug: i = !1
|
|
25
25
|
}) => {
|
|
26
26
|
const l = D(
|
|
27
|
-
(
|
|
28
|
-
|
|
27
|
+
(m, ...b) => {
|
|
28
|
+
i && console.log(`๐ฅ [MessagingProvider] ${m}`, ...b);
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[i]
|
|
31
31
|
);
|
|
32
32
|
l("๐ RENDER START", {
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
@@ -35,7 +35,7 @@ const ye = Pe({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(a)
|
|
37
37
|
});
|
|
38
|
-
const [
|
|
38
|
+
const [u, h] = y(null), [g, w] = y(null), [f, S] = y(!1), [_, v] = y(!1), [c, N] = y(null), E = z(!1), I = z({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
@@ -56,9 +56,9 @@ const ye = Pe({
|
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: a
|
|
58
58
|
}, G(() => {
|
|
59
|
-
const
|
|
59
|
+
const m = k.current;
|
|
60
60
|
if (l("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
|
-
renderCount:
|
|
61
|
+
renderCount: m,
|
|
62
62
|
apiKey: !!r,
|
|
63
63
|
serviceConfig: !!n,
|
|
64
64
|
dependencies: {
|
|
@@ -69,42 +69,42 @@ const ye = Pe({
|
|
|
69
69
|
}
|
|
70
70
|
}), !r || !n) {
|
|
71
71
|
l("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
72
|
-
renderCount:
|
|
72
|
+
renderCount: m,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
74
74
|
});
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
l("๐ CREATING NEW SERVICE", {
|
|
78
|
-
renderCount:
|
|
78
|
+
renderCount: m,
|
|
79
79
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: I.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
82
|
const b = new je({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: r,
|
|
85
|
-
debug:
|
|
85
|
+
debug: i
|
|
86
86
|
});
|
|
87
87
|
return h(b), l("โ
SERVICE SET", {
|
|
88
|
-
renderCount:
|
|
88
|
+
renderCount: m,
|
|
89
89
|
serviceInstance: !!b
|
|
90
90
|
}), () => {
|
|
91
91
|
l("๐งน SERVICE CLEANUP", {
|
|
92
|
-
renderCount:
|
|
92
|
+
renderCount: m,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
94
|
}), b.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
|
-
}, [r, n,
|
|
96
|
+
}, [r, n, i, l]);
|
|
97
97
|
const x = z(null);
|
|
98
98
|
G(() => {
|
|
99
99
|
var b, B;
|
|
100
100
|
if (l("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
-
hasService: !!
|
|
101
|
+
hasService: !!u,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
104
|
isConnecting: E.current,
|
|
105
105
|
isConnected: f,
|
|
106
|
-
dependencies: { service: !!
|
|
107
|
-
}), !
|
|
106
|
+
dependencies: { service: !!u, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !u || !s) {
|
|
108
108
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
@@ -112,7 +112,7 @@ const ye = Pe({
|
|
|
112
112
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((b = x.current) == null ? void 0 : b.serviceId) ===
|
|
115
|
+
if (((b = x.current) == null ? void 0 : b.serviceId) === u && ((B = x.current) == null ? void 0 : B.userId) === s.id) {
|
|
116
116
|
l(
|
|
117
117
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -123,8 +123,8 @@ const ye = Pe({
|
|
|
123
123
|
l("๐ STARTING USER CONNECTION", { userId: s.id }), E.current = !0, v(!0), N(null);
|
|
124
124
|
try {
|
|
125
125
|
l("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
-
const j = await
|
|
127
|
-
w(j), S(!0), x.current = { serviceId:
|
|
126
|
+
const j = await u.connectUser(s);
|
|
127
|
+
w(j), S(!0), x.current = { serviceId: u, userId: s.id }, l("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: j.userID
|
|
130
130
|
});
|
|
@@ -141,33 +141,33 @@ const ye = Pe({
|
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [
|
|
145
|
-
hasService: !!
|
|
144
|
+
}, [u, s, l, f]), G(() => (l("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!u,
|
|
146
146
|
isConnected: f
|
|
147
147
|
}), () => {
|
|
148
|
-
|
|
148
|
+
u && f ? (l(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
), x.current = null,
|
|
152
|
-
hasService: !!
|
|
151
|
+
), x.current = null, u.disconnectUser().catch(console.error)) : l("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!u,
|
|
153
153
|
isConnected: f
|
|
154
154
|
});
|
|
155
|
-
}), [
|
|
155
|
+
}), [u, f, l]);
|
|
156
156
|
const R = D(async () => {
|
|
157
157
|
if (l("๐ REFRESH CONNECTION CALLED", {
|
|
158
|
-
hasService: !!
|
|
158
|
+
hasService: !!u,
|
|
159
159
|
hasUser: !!s
|
|
160
|
-
}), !
|
|
160
|
+
}), !u || !s) {
|
|
161
161
|
l("โ ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
164
|
l("๐ STARTING CONNECTION REFRESH", { userId: s.id }), v(!0);
|
|
165
165
|
try {
|
|
166
|
-
l("๐ DISCONNECTING FOR REFRESH"), await
|
|
167
|
-
const
|
|
168
|
-
w(
|
|
169
|
-
} catch (
|
|
170
|
-
const b =
|
|
166
|
+
l("๐ DISCONNECTING FOR REFRESH"), await u.disconnectUser(), l("๐ RECONNECTING FOR REFRESH");
|
|
167
|
+
const m = await u.connectUser(s);
|
|
168
|
+
w(m), S(!0), N(null), l("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
|
+
} catch (m) {
|
|
170
|
+
const b = m instanceof Error ? m.message : "Refresh failed";
|
|
171
171
|
N(b), l("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
173
|
error: b
|
|
@@ -175,38 +175,38 @@ const ye = Pe({
|
|
|
175
175
|
} finally {
|
|
176
176
|
v(!1), l("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [
|
|
179
|
-
hasService: !!
|
|
178
|
+
}, [u, s, l]), d = U.useMemo(() => (l("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!u,
|
|
180
180
|
hasClient: !!g,
|
|
181
181
|
isConnected: f,
|
|
182
|
-
isLoading:
|
|
183
|
-
hasError: !!
|
|
182
|
+
isLoading: _,
|
|
183
|
+
hasError: !!c,
|
|
184
184
|
capabilitiesKeys: Object.keys(a)
|
|
185
185
|
}), {
|
|
186
|
-
service:
|
|
186
|
+
service: u,
|
|
187
187
|
client: g,
|
|
188
188
|
isConnected: f,
|
|
189
|
-
isLoading:
|
|
190
|
-
error:
|
|
189
|
+
isLoading: _,
|
|
190
|
+
error: c,
|
|
191
191
|
capabilities: a,
|
|
192
192
|
refreshConnection: R,
|
|
193
|
-
debug:
|
|
193
|
+
debug: i
|
|
194
194
|
}), [
|
|
195
|
-
|
|
195
|
+
u,
|
|
196
196
|
g,
|
|
197
197
|
f,
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
_,
|
|
199
|
+
c,
|
|
200
200
|
a,
|
|
201
201
|
R,
|
|
202
|
-
|
|
202
|
+
i,
|
|
203
203
|
l
|
|
204
204
|
]);
|
|
205
205
|
return l("๐ RENDER END", {
|
|
206
206
|
renderCount: k.current,
|
|
207
207
|
willRenderChat: !!(g && f),
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(ye.Provider, { value:
|
|
208
|
+
contextValueReady: !!d
|
|
209
|
+
}), /* @__PURE__ */ e(ye.Provider, { value: d, children: g && f ? /* @__PURE__ */ e(
|
|
210
210
|
Ae,
|
|
211
211
|
{
|
|
212
212
|
client: g,
|
|
@@ -216,18 +216,18 @@ const ye = Pe({
|
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
},
|
|
219
|
+
}, as = () => oe(), os = (t, s) => {
|
|
220
220
|
const n = new Date(
|
|
221
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
222
222
|
), a = new Date(
|
|
223
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
224
224
|
).getTime() - n.getTime();
|
|
225
225
|
return Math.floor(a / (1e3 * 60 * 60 * 24));
|
|
226
|
-
},
|
|
226
|
+
}, is = (t) => {
|
|
227
227
|
const s = /* @__PURE__ */ new Date();
|
|
228
228
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
229
229
|
return "Just now";
|
|
230
|
-
const r =
|
|
230
|
+
const r = os(t, s);
|
|
231
231
|
return r === 0 ? t.toLocaleTimeString([], {
|
|
232
232
|
hour: "numeric",
|
|
233
233
|
minute: "2-digit",
|
|
@@ -265,7 +265,7 @@ const ye = Pe({
|
|
|
265
265
|
"๐"
|
|
266
266
|
// Melon
|
|
267
267
|
];
|
|
268
|
-
function
|
|
268
|
+
function cs(t) {
|
|
269
269
|
let s = 0;
|
|
270
270
|
for (let n = 0; n < t.length; n++) {
|
|
271
271
|
const r = t.charCodeAt(n);
|
|
@@ -273,8 +273,8 @@ function os(t) {
|
|
|
273
273
|
}
|
|
274
274
|
return Math.abs(s);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const n =
|
|
276
|
+
function ds(t) {
|
|
277
|
+
const n = cs(t) % Ce.length;
|
|
278
278
|
return Ce[n];
|
|
279
279
|
}
|
|
280
280
|
const q = ({
|
|
@@ -284,7 +284,7 @@ const q = ({
|
|
|
284
284
|
className: r,
|
|
285
285
|
shape: a = "squircle"
|
|
286
286
|
}) => {
|
|
287
|
-
const
|
|
287
|
+
const i = ds(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = a === "circle" ? { borderRadius: "50%" } : {
|
|
288
288
|
borderRadius: "33%",
|
|
289
289
|
"corner-shape": "superellipse(1.3)"
|
|
290
290
|
};
|
|
@@ -310,9 +310,9 @@ const q = ({
|
|
|
310
310
|
"aria-hidden": "true",
|
|
311
311
|
className: p(
|
|
312
312
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
313
|
-
|
|
313
|
+
u
|
|
314
314
|
),
|
|
315
|
-
children:
|
|
315
|
+
children: i
|
|
316
316
|
}
|
|
317
317
|
)
|
|
318
318
|
}
|
|
@@ -320,24 +320,24 @@ const q = ({
|
|
|
320
320
|
}, Ee = U.memo(
|
|
321
321
|
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
|
|
322
322
|
var N, E, I, k, x, R;
|
|
323
|
-
const
|
|
323
|
+
const i = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
|
|
324
324
|
t && n(t);
|
|
325
325
|
}, h = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
|
|
326
|
-
(
|
|
327
|
-
var
|
|
328
|
-
return ((
|
|
326
|
+
(d) => {
|
|
327
|
+
var m, b;
|
|
328
|
+
return ((m = d.user) == null ? void 0 : m.id) && d.user.id !== ((b = t == null ? void 0 : t._client) == null ? void 0 : b.userID);
|
|
329
329
|
}
|
|
330
|
-
), g = ((E = h == null ? void 0 : h.user) == null ? void 0 : E.name) || "Conversation", w = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, f = (x = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : x[t.state.messages.length - 1],
|
|
331
|
-
var
|
|
330
|
+
), g = ((E = h == null ? void 0 : h.user) == null ? void 0 : E.name) || "Conversation", w = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, f = (x = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : x[t.state.messages.length - 1], _ = (() => {
|
|
331
|
+
var m;
|
|
332
332
|
if (f != null && f.text) return f.text;
|
|
333
|
-
const
|
|
334
|
-
return
|
|
335
|
-
})(), v = f != null && f.created_at ?
|
|
333
|
+
const d = (m = f == null ? void 0 : f.attachments) == null ? void 0 : m[0];
|
|
334
|
+
return d ? d.og_scrape_url ? d.og_scrape_url : d.type === "image" ? "๐ท Sent an image" : d.type === "video" ? "๐ฅ Sent a video" : d.type === "audio" ? "๐ต Sent audio" : d.type === "file" ? "๐ Sent a file" : "๐ Sent an attachment" : "No messages yet";
|
|
335
|
+
})(), v = f != null && f.created_at ? is(new Date(f.created_at)) : "", c = a ?? 0;
|
|
336
336
|
return r && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
337
337
|
channelId: t == null ? void 0 : t.id,
|
|
338
|
-
isSelected:
|
|
338
|
+
isSelected: i,
|
|
339
339
|
participantName: g,
|
|
340
|
-
unreadCount:
|
|
340
|
+
unreadCount: c,
|
|
341
341
|
hasTimestamp: !!v
|
|
342
342
|
}), /* @__PURE__ */ e(
|
|
343
343
|
"button",
|
|
@@ -347,11 +347,11 @@ const q = ({
|
|
|
347
347
|
className: p(
|
|
348
348
|
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
349
349
|
{
|
|
350
|
-
"bg-primary-alt/10 border-l-4 border-l-primary":
|
|
351
|
-
"hover:bg-sand": !
|
|
350
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": i,
|
|
351
|
+
"hover:bg-sand": !i
|
|
352
352
|
}
|
|
353
353
|
),
|
|
354
|
-
children: /* @__PURE__ */
|
|
354
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-start gap-3", children: [
|
|
355
355
|
/* @__PURE__ */ e(
|
|
356
356
|
q,
|
|
357
357
|
{
|
|
@@ -362,23 +362,23 @@ const q = ({
|
|
|
362
362
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
363
363
|
}
|
|
364
364
|
),
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ o("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
366
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2", children: [
|
|
367
367
|
/* @__PURE__ */ e(
|
|
368
368
|
"h3",
|
|
369
369
|
{
|
|
370
370
|
className: p(
|
|
371
371
|
"text-sm font-medium truncate",
|
|
372
|
-
|
|
372
|
+
i ? "text-primary" : "text-charcoal"
|
|
373
373
|
),
|
|
374
374
|
children: g
|
|
375
375
|
}
|
|
376
376
|
),
|
|
377
377
|
v && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: v })
|
|
378
378
|
] }),
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children:
|
|
381
|
-
|
|
379
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
380
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: _ }),
|
|
381
|
+
c > 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: c > 99 ? "99+" : c })
|
|
382
382
|
] })
|
|
383
383
|
] })
|
|
384
384
|
] })
|
|
@@ -395,15 +395,15 @@ const Ie = U.memo(
|
|
|
395
395
|
className: r,
|
|
396
396
|
customEmptyStateIndicator: a
|
|
397
397
|
}) => {
|
|
398
|
-
const
|
|
399
|
-
|
|
398
|
+
const i = U.useRef(0);
|
|
399
|
+
i.current++;
|
|
400
400
|
const { debug: l = !1 } = oe();
|
|
401
401
|
l && console.log("๐บ [ChannelList] ๐ RENDER START", {
|
|
402
|
-
renderCount:
|
|
402
|
+
renderCount: i.current,
|
|
403
403
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
404
404
|
filters: n
|
|
405
405
|
});
|
|
406
|
-
const
|
|
406
|
+
const u = U.useMemo(() => (g) => /* @__PURE__ */ e(
|
|
407
407
|
Ee,
|
|
408
408
|
{
|
|
409
409
|
...g,
|
|
@@ -425,7 +425,7 @@ const Ie = U.memo(
|
|
|
425
425
|
filters: n,
|
|
426
426
|
sort: { last_message_at: -1 },
|
|
427
427
|
options: { limit: 30 },
|
|
428
|
-
Preview:
|
|
428
|
+
Preview: u,
|
|
429
429
|
EmptyStateIndicator: a
|
|
430
430
|
},
|
|
431
431
|
JSON.stringify(n)
|
|
@@ -454,7 +454,7 @@ const ne = ({
|
|
|
454
454
|
}
|
|
455
455
|
);
|
|
456
456
|
function Se({ label: t, className: s, children: n, ...r }) {
|
|
457
|
-
return /* @__PURE__ */
|
|
457
|
+
return /* @__PURE__ */ o(
|
|
458
458
|
"button",
|
|
459
459
|
{
|
|
460
460
|
type: "button",
|
|
@@ -475,18 +475,18 @@ function Se({ label: t, className: s, children: n, ...r }) {
|
|
|
475
475
|
);
|
|
476
476
|
}
|
|
477
477
|
function pe({ onClick: t }) {
|
|
478
|
-
return /* @__PURE__ */ e(Se, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(
|
|
478
|
+
return /* @__PURE__ */ e(Se, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
479
479
|
}
|
|
480
|
-
const
|
|
480
|
+
const ms = (t) => /* @__PURE__ */ e("div", { className: "custom-message", children: /* @__PURE__ */ e(Be, { ...t }) }), us = (t) => ({
|
|
481
481
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
482
482
|
(s) => be.previewIsLoaded(s) || be.previewIsLoading(s)
|
|
483
483
|
)
|
|
484
|
-
}),
|
|
484
|
+
}), hs = ({
|
|
485
485
|
link: t,
|
|
486
486
|
onDismiss: s
|
|
487
487
|
}) => {
|
|
488
488
|
const { og_scrape_url: n, title: r, image_url: a } = t;
|
|
489
|
-
return /* @__PURE__ */
|
|
489
|
+
return /* @__PURE__ */ o(
|
|
490
490
|
"a",
|
|
491
491
|
{
|
|
492
492
|
href: n,
|
|
@@ -511,42 +511,42 @@ const cs = (t) => ({
|
|
|
511
511
|
},
|
|
512
512
|
className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl",
|
|
513
513
|
"aria-label": "Close link preview",
|
|
514
|
-
children: /* @__PURE__ */ e(
|
|
514
|
+
children: /* @__PURE__ */ e(ue, { className: "size-4 text-black/90" })
|
|
515
515
|
}
|
|
516
516
|
),
|
|
517
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ o("div", { className: "p-2", children: [
|
|
518
518
|
r && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: r }),
|
|
519
519
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
520
520
|
] })
|
|
521
521
|
]
|
|
522
522
|
}
|
|
523
523
|
);
|
|
524
|
-
},
|
|
525
|
-
const { linkPreviewsManager: t } =
|
|
524
|
+
}, fs = () => {
|
|
525
|
+
const { linkPreviewsManager: t } = $e(), { linkPreviews: s } = Ge(
|
|
526
526
|
t.state,
|
|
527
|
-
|
|
527
|
+
us
|
|
528
528
|
), n = (a) => {
|
|
529
529
|
t.dismissPreview(a);
|
|
530
530
|
};
|
|
531
531
|
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((a) => /* @__PURE__ */ e(
|
|
532
|
-
|
|
532
|
+
hs,
|
|
533
533
|
{
|
|
534
534
|
link: a,
|
|
535
535
|
onDismiss: n
|
|
536
536
|
},
|
|
537
537
|
a.og_scrape_url
|
|
538
538
|
)) }) : null;
|
|
539
|
-
},
|
|
540
|
-
const { handleSubmit: t } =
|
|
541
|
-
return /* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
-
/* @__PURE__ */ e(Ze, {}),
|
|
545
|
-
/* @__PURE__ */ e(us, {}),
|
|
539
|
+
}, gs = () => {
|
|
540
|
+
const { handleSubmit: t } = Ve(), s = We();
|
|
541
|
+
return /* @__PURE__ */ o(ve, { children: [
|
|
542
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ze, {}) }),
|
|
543
|
+
/* @__PURE__ */ o("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] 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: [
|
|
546
544
|
/* @__PURE__ */ e(qe, {}),
|
|
547
|
-
/* @__PURE__ */
|
|
545
|
+
/* @__PURE__ */ e(fs, {}),
|
|
546
|
+
/* @__PURE__ */ e(Ye, {}),
|
|
547
|
+
/* @__PURE__ */ o("div", { className: "flex", children: [
|
|
548
548
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
549
|
-
|
|
549
|
+
Je,
|
|
550
550
|
{
|
|
551
551
|
className: "w-full resize-none outline-none leading-6",
|
|
552
552
|
maxRows: 4
|
|
@@ -561,33 +561,33 @@ const cs = (t) => ({
|
|
|
561
561
|
disabled: !s,
|
|
562
562
|
onClick: t,
|
|
563
563
|
type: "button",
|
|
564
|
-
children: /* @__PURE__ */ e(
|
|
564
|
+
children: /* @__PURE__ */ e(ts, { className: "size-4" })
|
|
565
565
|
}
|
|
566
566
|
)
|
|
567
567
|
] })
|
|
568
568
|
] })
|
|
569
569
|
] });
|
|
570
|
-
},
|
|
570
|
+
}, xs = ({
|
|
571
571
|
renderActions: t
|
|
572
|
-
}) => /* @__PURE__ */
|
|
572
|
+
}) => /* @__PURE__ */ o("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
573
573
|
t && (t == null ? void 0 : t()),
|
|
574
|
-
/* @__PURE__ */ e(
|
|
575
|
-
] }),
|
|
574
|
+
/* @__PURE__ */ e(He, { Input: gs })
|
|
575
|
+
] }), Ns = (t) => {
|
|
576
576
|
const s = t.message.hide_date === !0;
|
|
577
|
-
return /* @__PURE__ */
|
|
578
|
-
/* @__PURE__ */
|
|
577
|
+
return /* @__PURE__ */ o("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
578
|
+
/* @__PURE__ */ o("div", { className: "str-chat__message--system__text", children: [
|
|
579
579
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
580
580
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
581
581
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
582
582
|
] }),
|
|
583
|
-
!s && /* @__PURE__ */ e(
|
|
583
|
+
!s && /* @__PURE__ */ e(Qe, { message: t.message })
|
|
584
584
|
] });
|
|
585
|
-
},
|
|
585
|
+
}, bs = () => null, Cs = ({ className: t, message: s }) => /* @__PURE__ */ o(
|
|
586
586
|
"div",
|
|
587
587
|
{
|
|
588
588
|
className: p("flex items-center justify-center h-full", t),
|
|
589
589
|
children: [
|
|
590
|
-
/* @__PURE__ */
|
|
590
|
+
/* @__PURE__ */ o("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
591
591
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
592
592
|
"animateTransform",
|
|
593
593
|
{
|
|
@@ -625,21 +625,21 @@ const cs = (t) => ({
|
|
|
625
625
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
626
626
|
]
|
|
627
627
|
}
|
|
628
|
-
), ae = U.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */
|
|
629
|
-
/* @__PURE__ */ e(
|
|
628
|
+
), ae = U.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ o("div", { className: "flex items-center", children: [
|
|
629
|
+
/* @__PURE__ */ e(Cs, { className: "w-6 h-6" }),
|
|
630
630
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
631
631
|
] }) }));
|
|
632
632
|
ae.displayName = "LoadingState";
|
|
633
|
-
const
|
|
633
|
+
const vs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
634
634
|
var h, g, w, f, S;
|
|
635
|
-
const { channel: a } = we(),
|
|
635
|
+
const { channel: a } = we(), i = U.useMemo(() => Object.values(a.state.members || {}).find(
|
|
636
636
|
(v) => {
|
|
637
|
-
var
|
|
638
|
-
return ((
|
|
637
|
+
var c;
|
|
638
|
+
return ((c = v.user) == null ? void 0 : c.id) && v.user.id !== a._client.userID;
|
|
639
639
|
}
|
|
640
|
-
), [a._client.userID, a.state.members]), l = ((h =
|
|
641
|
-
return /* @__PURE__ */
|
|
642
|
-
/* @__PURE__ */
|
|
640
|
+
), [a._client.userID, a.state.members]), l = ((h = i == null ? void 0 : i.user) == null ? void 0 : h.name) || ((g = i == null ? void 0 : i.user) == null ? void 0 : g.id) || "Unknown member", u = (w = i == null ? void 0 : i.user) == null ? void 0 : w.image;
|
|
641
|
+
return /* @__PURE__ */ o("div", { className: "@container", children: [
|
|
642
|
+
/* @__PURE__ */ o("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
643
643
|
/* @__PURE__ */ e(
|
|
644
644
|
"button",
|
|
645
645
|
{
|
|
@@ -654,13 +654,13 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
654
654
|
children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
|
|
655
655
|
}
|
|
656
656
|
),
|
|
657
|
-
/* @__PURE__ */
|
|
657
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
658
658
|
/* @__PURE__ */ e(
|
|
659
659
|
q,
|
|
660
660
|
{
|
|
661
|
-
id: ((f =
|
|
661
|
+
id: ((f = i == null ? void 0 : i.user) == null ? void 0 : f.id) || a.id || "unknown",
|
|
662
662
|
name: l,
|
|
663
|
-
image:
|
|
663
|
+
image: u,
|
|
664
664
|
size: 40
|
|
665
665
|
}
|
|
666
666
|
),
|
|
@@ -679,8 +679,8 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
679
679
|
}
|
|
680
680
|
)
|
|
681
681
|
] }),
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
682
|
+
/* @__PURE__ */ o("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
|
|
683
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
684
684
|
s && t && /* @__PURE__ */ e(
|
|
685
685
|
"button",
|
|
686
686
|
{
|
|
@@ -694,9 +694,9 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
694
694
|
/* @__PURE__ */ e(
|
|
695
695
|
q,
|
|
696
696
|
{
|
|
697
|
-
id: ((S =
|
|
697
|
+
id: ((S = i == null ? void 0 : i.user) == null ? void 0 : S.id) || a.id || "unknown",
|
|
698
698
|
name: l,
|
|
699
|
-
image:
|
|
699
|
+
image: u,
|
|
700
700
|
size: 40
|
|
701
701
|
}
|
|
702
702
|
),
|
|
@@ -714,23 +714,23 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
714
714
|
)
|
|
715
715
|
] })
|
|
716
716
|
] });
|
|
717
|
-
},
|
|
717
|
+
}, ws = ({
|
|
718
718
|
dialogRef: t,
|
|
719
719
|
onClose: s,
|
|
720
720
|
participant: n,
|
|
721
721
|
channel: r,
|
|
722
722
|
followerStatusLabel: a,
|
|
723
|
-
onLeaveConversation:
|
|
723
|
+
onLeaveConversation: i,
|
|
724
724
|
onBlockParticipant: l,
|
|
725
|
-
showDeleteConversation:
|
|
725
|
+
showDeleteConversation: u = !0,
|
|
726
726
|
onDeleteConversationClick: h,
|
|
727
727
|
onBlockParticipantClick: g,
|
|
728
728
|
onReportParticipantClick: w
|
|
729
729
|
}) => {
|
|
730
730
|
var Q, X, ce, O, H, J, $;
|
|
731
|
-
const { service: f, debug: S } = oe(), [
|
|
732
|
-
var
|
|
733
|
-
if (!(!f || !((
|
|
731
|
+
const { service: f, debug: S } = oe(), [_, v] = y(!1), [c, N] = y(!1), [E, I] = y(!1), k = D(async () => {
|
|
732
|
+
var M;
|
|
733
|
+
if (!(!f || !((M = n == null ? void 0 : n.user) != null && M.id)))
|
|
734
734
|
try {
|
|
735
735
|
const A = (await f.getBlockedUsers()).some(
|
|
736
736
|
(V) => {
|
|
@@ -750,12 +750,12 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
750
750
|
k();
|
|
751
751
|
}, [k]);
|
|
752
752
|
const x = async () => {
|
|
753
|
-
var
|
|
754
|
-
if (!
|
|
753
|
+
var M;
|
|
754
|
+
if (!c) {
|
|
755
755
|
h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
|
|
756
756
|
try {
|
|
757
|
-
const T = ((
|
|
758
|
-
await r.hide(T, !1),
|
|
757
|
+
const T = ((M = r._client) == null ? void 0 : M.userID) ?? null;
|
|
758
|
+
await r.hide(T, !1), i && await i(r), s();
|
|
759
759
|
} catch (T) {
|
|
760
760
|
console.error("[ChannelInfoDialog] Failed to leave conversation", T);
|
|
761
761
|
} finally {
|
|
@@ -763,9 +763,9 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
765
|
}, R = async () => {
|
|
766
|
-
var
|
|
766
|
+
var M, T, A;
|
|
767
767
|
if (!(E || !f)) {
|
|
768
|
-
g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (
|
|
768
|
+
g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (M = n == null ? void 0 : n.user) == null ? void 0 : M.id), I(!0);
|
|
769
769
|
try {
|
|
770
770
|
await f.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
771
771
|
} catch (V) {
|
|
@@ -774,10 +774,10 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
774
774
|
I(!1);
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
|
-
},
|
|
778
|
-
var
|
|
777
|
+
}, d = async () => {
|
|
778
|
+
var M, T, A;
|
|
779
779
|
if (!(E || !f)) {
|
|
780
|
-
g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (
|
|
780
|
+
g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (M = n == null ? void 0 : n.user) == null ? void 0 : M.id), I(!0);
|
|
781
781
|
try {
|
|
782
782
|
await f.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
783
783
|
} catch (V) {
|
|
@@ -786,7 +786,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
786
786
|
I(!1);
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
},
|
|
789
|
+
}, m = () => {
|
|
790
790
|
w == null || w(), s(), window.open(
|
|
791
791
|
"https://linktr.ee/s/about/trust-center/report",
|
|
792
792
|
"_blank",
|
|
@@ -803,21 +803,21 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
803
803
|
ref: t,
|
|
804
804
|
className: "mes-dialog group",
|
|
805
805
|
onClose: s,
|
|
806
|
-
onClick: (
|
|
807
|
-
|
|
806
|
+
onClick: (M) => {
|
|
807
|
+
M.target === t.current && s();
|
|
808
808
|
},
|
|
809
|
-
children: /* @__PURE__ */
|
|
810
|
-
/* @__PURE__ */
|
|
809
|
+
children: /* @__PURE__ */ o("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
|
|
810
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
811
811
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
812
812
|
/* @__PURE__ */ e(pe, { onClick: s })
|
|
813
813
|
] }),
|
|
814
|
-
/* @__PURE__ */
|
|
814
|
+
/* @__PURE__ */ o("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
815
815
|
/* @__PURE__ */ e(
|
|
816
816
|
"div",
|
|
817
817
|
{
|
|
818
818
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
819
819
|
style: { backgroundColor: "#FBFAF9" },
|
|
820
|
-
children: /* @__PURE__ */
|
|
820
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-center gap-3 w-full", children: [
|
|
821
821
|
/* @__PURE__ */ e(
|
|
822
822
|
q,
|
|
823
823
|
{
|
|
@@ -828,7 +828,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
828
828
|
shape: "circle"
|
|
829
829
|
}
|
|
830
830
|
),
|
|
831
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
832
832
|
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: b }),
|
|
833
833
|
Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
|
|
834
834
|
a && /* @__PURE__ */ e(
|
|
@@ -849,23 +849,23 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
849
849
|
] })
|
|
850
850
|
}
|
|
851
851
|
),
|
|
852
|
-
/* @__PURE__ */
|
|
853
|
-
|
|
852
|
+
/* @__PURE__ */ o("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
853
|
+
u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
|
|
854
854
|
ne,
|
|
855
855
|
{
|
|
856
856
|
onClick: x,
|
|
857
|
-
disabled:
|
|
858
|
-
"aria-busy":
|
|
857
|
+
disabled: c,
|
|
858
|
+
"aria-busy": c,
|
|
859
859
|
children: [
|
|
860
|
-
|
|
860
|
+
c ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ns, { className: "h-5 w-5" }),
|
|
861
861
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
862
862
|
]
|
|
863
863
|
}
|
|
864
864
|
) }),
|
|
865
|
-
/* @__PURE__ */ e("li", { children:
|
|
865
|
+
/* @__PURE__ */ e("li", { children: _ ? /* @__PURE__ */ o(
|
|
866
866
|
ne,
|
|
867
867
|
{
|
|
868
|
-
onClick:
|
|
868
|
+
onClick: d,
|
|
869
869
|
disabled: E,
|
|
870
870
|
"aria-busy": E,
|
|
871
871
|
children: [
|
|
@@ -873,7 +873,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
873
873
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
874
874
|
]
|
|
875
875
|
}
|
|
876
|
-
) : /* @__PURE__ */
|
|
876
|
+
) : /* @__PURE__ */ o(
|
|
877
877
|
ne,
|
|
878
878
|
{
|
|
879
879
|
onClick: R,
|
|
@@ -885,8 +885,8 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
885
885
|
]
|
|
886
886
|
}
|
|
887
887
|
) }),
|
|
888
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
889
|
-
/* @__PURE__ */ e(
|
|
888
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(ne, { variant: "danger", onClick: m, children: [
|
|
889
|
+
/* @__PURE__ */ e(rs, { className: "h-5 w-5" }),
|
|
890
890
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
891
891
|
] }) })
|
|
892
892
|
] })
|
|
@@ -895,15 +895,15 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
895
895
|
}
|
|
896
896
|
)
|
|
897
897
|
);
|
|
898
|
-
},
|
|
898
|
+
}, ys = ({
|
|
899
899
|
onBack: t,
|
|
900
900
|
showBackButton: s,
|
|
901
901
|
renderMessageInputActions: n,
|
|
902
902
|
onLeaveConversation: r,
|
|
903
903
|
onBlockParticipant: a,
|
|
904
|
-
showDeleteConversation:
|
|
904
|
+
showDeleteConversation: i = !0,
|
|
905
905
|
onDeleteConversationClick: l,
|
|
906
|
-
onBlockParticipantClick:
|
|
906
|
+
onBlockParticipantClick: u,
|
|
907
907
|
onReportParticipantClick: h
|
|
908
908
|
}) => {
|
|
909
909
|
const { channel: g } = we(), w = z(null), f = U.useMemo(() => Object.values(g.state.members || {}).find(
|
|
@@ -912,46 +912,54 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
912
912
|
return ((E = N.user) == null ? void 0 : E.id) && N.user.id !== g._client.userID;
|
|
913
913
|
}
|
|
914
914
|
), [g._client.userID, g.state.members]), S = U.useMemo(() => {
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
-
return String(
|
|
918
|
-
if (
|
|
919
|
-
return
|
|
920
|
-
}, [g.data]),
|
|
921
|
-
var
|
|
922
|
-
(
|
|
915
|
+
const c = g.data ?? {};
|
|
916
|
+
if (c.followerStatus)
|
|
917
|
+
return String(c.followerStatus);
|
|
918
|
+
if (c.isFollower !== void 0)
|
|
919
|
+
return c.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
920
|
+
}, [g.data]), _ = D(() => {
|
|
921
|
+
var c;
|
|
922
|
+
(c = w.current) == null || c.showModal();
|
|
923
923
|
}, []), v = D(() => {
|
|
924
|
-
var
|
|
925
|
-
(
|
|
924
|
+
var c;
|
|
925
|
+
(c = w.current) == null || c.close();
|
|
926
926
|
}, []);
|
|
927
|
-
return /* @__PURE__ */
|
|
928
|
-
/* @__PURE__ */ i(Xe, { children: [
|
|
929
|
-
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
930
|
-
Ns,
|
|
931
|
-
{
|
|
932
|
-
onBack: t,
|
|
933
|
-
showBackButton: s,
|
|
934
|
-
onShowInfo: M,
|
|
935
|
-
canShowInfo: !!f
|
|
936
|
-
}
|
|
937
|
-
) }),
|
|
938
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
939
|
-
Ke,
|
|
940
|
-
{
|
|
941
|
-
hideDeletedMessages: !0,
|
|
942
|
-
hideNewMessageSeparator: !1,
|
|
943
|
-
messageActions: []
|
|
944
|
-
}
|
|
945
|
-
) }),
|
|
946
|
-
/* @__PURE__ */ e(
|
|
947
|
-
hs,
|
|
948
|
-
{
|
|
949
|
-
renderActions: () => n == null ? void 0 : n(g)
|
|
950
|
-
}
|
|
951
|
-
)
|
|
952
|
-
] }),
|
|
927
|
+
return /* @__PURE__ */ o(ve, { children: [
|
|
953
928
|
/* @__PURE__ */ e(
|
|
954
|
-
|
|
929
|
+
Ke,
|
|
930
|
+
{
|
|
931
|
+
overrides: {
|
|
932
|
+
Message: (c) => /* @__PURE__ */ e(ms, { ...c })
|
|
933
|
+
},
|
|
934
|
+
children: /* @__PURE__ */ o(es, { children: [
|
|
935
|
+
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
936
|
+
vs,
|
|
937
|
+
{
|
|
938
|
+
onBack: t,
|
|
939
|
+
showBackButton: s,
|
|
940
|
+
onShowInfo: _,
|
|
941
|
+
canShowInfo: !!f
|
|
942
|
+
}
|
|
943
|
+
) }),
|
|
944
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
945
|
+
ss,
|
|
946
|
+
{
|
|
947
|
+
hideDeletedMessages: !0,
|
|
948
|
+
hideNewMessageSeparator: !1,
|
|
949
|
+
messageActions: void 0
|
|
950
|
+
}
|
|
951
|
+
) }),
|
|
952
|
+
/* @__PURE__ */ e(
|
|
953
|
+
xs,
|
|
954
|
+
{
|
|
955
|
+
renderActions: () => n == null ? void 0 : n(g)
|
|
956
|
+
}
|
|
957
|
+
)
|
|
958
|
+
] })
|
|
959
|
+
}
|
|
960
|
+
),
|
|
961
|
+
/* @__PURE__ */ e(
|
|
962
|
+
ws,
|
|
955
963
|
{
|
|
956
964
|
dialogRef: w,
|
|
957
965
|
onClose: v,
|
|
@@ -960,9 +968,9 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
960
968
|
followerStatusLabel: S,
|
|
961
969
|
onLeaveConversation: r,
|
|
962
970
|
onBlockParticipant: a,
|
|
963
|
-
showDeleteConversation:
|
|
971
|
+
showDeleteConversation: i,
|
|
964
972
|
onDeleteConversationClick: l,
|
|
965
|
-
onBlockParticipantClick:
|
|
973
|
+
onBlockParticipantClick: u,
|
|
966
974
|
onReportParticipantClick: h
|
|
967
975
|
}
|
|
968
976
|
)
|
|
@@ -974,9 +982,9 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
974
982
|
showBackButton: n = !1,
|
|
975
983
|
renderMessageInputActions: r,
|
|
976
984
|
onLeaveConversation: a,
|
|
977
|
-
onBlockParticipant:
|
|
985
|
+
onBlockParticipant: i,
|
|
978
986
|
className: l,
|
|
979
|
-
CustomChannelEmptyState:
|
|
987
|
+
CustomChannelEmptyState: u = bs,
|
|
980
988
|
showDeleteConversation: h = !0,
|
|
981
989
|
onDeleteConversationClick: g,
|
|
982
990
|
onBlockParticipantClick: w,
|
|
@@ -989,21 +997,21 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
989
997
|
l
|
|
990
998
|
),
|
|
991
999
|
children: /* @__PURE__ */ e(
|
|
992
|
-
|
|
1000
|
+
Xe,
|
|
993
1001
|
{
|
|
994
1002
|
channel: t,
|
|
995
|
-
MessageSystem:
|
|
996
|
-
EmptyStateIndicator:
|
|
1003
|
+
MessageSystem: Ns,
|
|
1004
|
+
EmptyStateIndicator: u,
|
|
997
1005
|
LoadingIndicator: ae,
|
|
998
1006
|
children: /* @__PURE__ */ e(
|
|
999
|
-
|
|
1007
|
+
ys,
|
|
1000
1008
|
{
|
|
1001
1009
|
onBack: s,
|
|
1002
1010
|
showBackButton: n,
|
|
1003
1011
|
renderMessageInputActions: r,
|
|
1004
1012
|
onLeaveConversation: a,
|
|
1005
|
-
onBlockParticipant:
|
|
1006
|
-
CustomChannelEmptyState:
|
|
1013
|
+
onBlockParticipant: i,
|
|
1014
|
+
CustomChannelEmptyState: u,
|
|
1007
1015
|
showDeleteConversation: h,
|
|
1008
1016
|
onDeleteConversationClick: g,
|
|
1009
1017
|
onBlockParticipantClick: w,
|
|
@@ -1016,15 +1024,15 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1016
1024
|
)
|
|
1017
1025
|
);
|
|
1018
1026
|
ke.displayName = "ChannelView";
|
|
1019
|
-
function
|
|
1027
|
+
function Es({
|
|
1020
1028
|
searchQuery: t,
|
|
1021
1029
|
setSearchQuery: s,
|
|
1022
1030
|
placeholder: n
|
|
1023
1031
|
}) {
|
|
1024
1032
|
const r = z(null);
|
|
1025
|
-
return /* @__PURE__ */
|
|
1033
|
+
return /* @__PURE__ */ o("div", { className: "relative", children: [
|
|
1026
1034
|
/* @__PURE__ */ e(
|
|
1027
|
-
|
|
1035
|
+
ls,
|
|
1028
1036
|
{
|
|
1029
1037
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1030
1038
|
weight: "bold"
|
|
@@ -1050,78 +1058,78 @@ function vs({
|
|
|
1050
1058
|
s(""), (a = r.current) == null || a.focus();
|
|
1051
1059
|
},
|
|
1052
1060
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1053
|
-
children: /* @__PURE__ */ e(
|
|
1061
|
+
children: /* @__PURE__ */ e(ue, { className: "h-4 w-4", weight: "bold" })
|
|
1054
1062
|
}
|
|
1055
1063
|
)
|
|
1056
1064
|
] });
|
|
1057
1065
|
}
|
|
1058
|
-
const
|
|
1066
|
+
const Is = ({
|
|
1059
1067
|
participantSource: t,
|
|
1060
1068
|
onSelectParticipant: s,
|
|
1061
1069
|
onClose: n,
|
|
1062
1070
|
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
1063
1071
|
participantLabel: a = "participants",
|
|
1064
|
-
searchPlaceholder:
|
|
1072
|
+
searchPlaceholder: i = "Search participants...",
|
|
1065
1073
|
className: l
|
|
1066
1074
|
}) => {
|
|
1067
|
-
const { debug:
|
|
1075
|
+
const { debug: u } = oe(), [h, g] = y(""), [w, f] = y([]), [S, _] = y(!1), [v, c] = y(null), [N, E] = y(
|
|
1068
1076
|
null
|
|
1069
1077
|
), I = z(!1);
|
|
1070
1078
|
G(() => {
|
|
1071
1079
|
if (t.loading) {
|
|
1072
|
-
|
|
1080
|
+
u && console.log(
|
|
1073
1081
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1074
1082
|
);
|
|
1075
1083
|
return;
|
|
1076
1084
|
}
|
|
1077
1085
|
if (I.current) return;
|
|
1078
1086
|
(async () => {
|
|
1079
|
-
|
|
1087
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), _(!0), c(null);
|
|
1080
1088
|
try {
|
|
1081
|
-
const
|
|
1089
|
+
const m = await t.loadParticipants({
|
|
1082
1090
|
search: "",
|
|
1083
1091
|
// Load all participants initially
|
|
1084
1092
|
limit: 100
|
|
1085
1093
|
});
|
|
1086
|
-
f(
|
|
1094
|
+
f(m.participants), I.current = !0, u && console.log(
|
|
1087
1095
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1088
|
-
|
|
1096
|
+
m.participants.length
|
|
1089
1097
|
);
|
|
1090
|
-
} catch (
|
|
1091
|
-
const b =
|
|
1092
|
-
|
|
1098
|
+
} catch (m) {
|
|
1099
|
+
const b = m instanceof Error ? m.message : "Failed to load participants";
|
|
1100
|
+
c(b), console.error("[ParticipantPicker] Failed to load participants:", m);
|
|
1093
1101
|
} finally {
|
|
1094
|
-
|
|
1102
|
+
_(!1);
|
|
1095
1103
|
}
|
|
1096
1104
|
})();
|
|
1097
|
-
}, [t.loading,
|
|
1098
|
-
const k = w.filter((
|
|
1105
|
+
}, [t.loading, u]);
|
|
1106
|
+
const k = w.filter((d) => !r.has(d.id)).filter((d) => {
|
|
1099
1107
|
var b;
|
|
1100
1108
|
if (!h) return !0;
|
|
1101
|
-
const
|
|
1102
|
-
return
|
|
1109
|
+
const m = h.toLowerCase();
|
|
1110
|
+
return d.name.toLowerCase().includes(m) || ((b = d.email) == null ? void 0 : b.toLowerCase().includes(m)) || !1;
|
|
1103
1111
|
}), x = D(
|
|
1104
|
-
async (
|
|
1112
|
+
async (d) => {
|
|
1105
1113
|
if (!N) {
|
|
1106
|
-
E(
|
|
1114
|
+
E(d.id);
|
|
1107
1115
|
try {
|
|
1108
|
-
await s(
|
|
1109
|
-
} catch (
|
|
1110
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1116
|
+
await s(d);
|
|
1117
|
+
} catch (m) {
|
|
1118
|
+
console.error("[ParticipantPicker] Failed to start chat:", m), E(null);
|
|
1111
1119
|
}
|
|
1112
1120
|
}
|
|
1113
1121
|
},
|
|
1114
1122
|
[s, N]
|
|
1115
|
-
), R = (
|
|
1116
|
-
(
|
|
1123
|
+
), R = (d, m) => {
|
|
1124
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), x(m));
|
|
1117
1125
|
};
|
|
1118
|
-
return /* @__PURE__ */
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
/* @__PURE__ */
|
|
1126
|
+
return /* @__PURE__ */ o("div", { className: p("flex flex-col h-full", l), children: [
|
|
1127
|
+
/* @__PURE__ */ o("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1128
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1121
1129
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1122
1130
|
/* @__PURE__ */ e(pe, { onClick: n })
|
|
1123
1131
|
] }),
|
|
1124
|
-
/* @__PURE__ */
|
|
1132
|
+
/* @__PURE__ */ o("p", { className: "text-xs text-stone mb-3", children: [
|
|
1125
1133
|
"Select a ",
|
|
1126
1134
|
a.slice(0, -1),
|
|
1127
1135
|
" to start messaging (",
|
|
@@ -1130,69 +1138,69 @@ const ws = ({
|
|
|
1130
1138
|
t.totalCount !== void 0 && ` โข ${t.totalCount} ${a} total`
|
|
1131
1139
|
] }),
|
|
1132
1140
|
/* @__PURE__ */ e(
|
|
1133
|
-
|
|
1141
|
+
Es,
|
|
1134
1142
|
{
|
|
1135
1143
|
searchQuery: h,
|
|
1136
1144
|
setSearchQuery: g,
|
|
1137
|
-
placeholder:
|
|
1145
|
+
placeholder: i
|
|
1138
1146
|
}
|
|
1139
1147
|
)
|
|
1140
1148
|
] }),
|
|
1141
|
-
v && /* @__PURE__ */
|
|
1149
|
+
v && /* @__PURE__ */ o("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1142
1150
|
"Error loading ",
|
|
1143
1151
|
a,
|
|
1144
1152
|
": ",
|
|
1145
1153
|
v
|
|
1146
1154
|
] }),
|
|
1147
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S && k.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */
|
|
1155
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S && k.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
|
|
1148
1156
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1149
|
-
/* @__PURE__ */
|
|
1157
|
+
/* @__PURE__ */ o("span", { className: "text-sm text-stone", children: [
|
|
1150
1158
|
"Loading ",
|
|
1151
1159
|
a,
|
|
1152
1160
|
"..."
|
|
1153
1161
|
] })
|
|
1154
|
-
] }) }) : k.length === 0 ? /* @__PURE__ */
|
|
1162
|
+
] }) }) : k.length === 0 ? /* @__PURE__ */ o("div", { className: "p-6 text-center", children: [
|
|
1155
1163
|
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Ne, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1156
1164
|
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${a} found` : w.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
|
|
1157
1165
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : w.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
|
|
1158
|
-
] }) : /* @__PURE__ */
|
|
1159
|
-
k.map((
|
|
1160
|
-
const
|
|
1166
|
+
] }) : /* @__PURE__ */ o("ul", { className: "space-y-0", children: [
|
|
1167
|
+
k.map((d) => {
|
|
1168
|
+
const m = d.name || d.email || d.id, b = d.email && d.name ? d.email : d.phone;
|
|
1161
1169
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1162
1170
|
"button",
|
|
1163
1171
|
{
|
|
1164
1172
|
type: "button",
|
|
1165
|
-
onClick: () => x(
|
|
1166
|
-
onKeyDown: (B) => R(B,
|
|
1173
|
+
onClick: () => x(d),
|
|
1174
|
+
onKeyDown: (B) => R(B, d),
|
|
1167
1175
|
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",
|
|
1168
|
-
children: /* @__PURE__ */
|
|
1169
|
-
/* @__PURE__ */
|
|
1176
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
1177
|
+
/* @__PURE__ */ o("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1170
1178
|
/* @__PURE__ */ e(
|
|
1171
1179
|
q,
|
|
1172
1180
|
{
|
|
1173
|
-
id:
|
|
1174
|
-
name:
|
|
1175
|
-
image:
|
|
1181
|
+
id: d.id,
|
|
1182
|
+
name: m,
|
|
1183
|
+
image: d.image,
|
|
1176
1184
|
size: 40
|
|
1177
1185
|
}
|
|
1178
1186
|
),
|
|
1179
|
-
/* @__PURE__ */
|
|
1180
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1187
|
+
/* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
|
|
1188
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: m }),
|
|
1181
1189
|
b && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: b })
|
|
1182
1190
|
] })
|
|
1183
1191
|
] }),
|
|
1184
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N ===
|
|
1192
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === d.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
|
|
1185
1193
|
] })
|
|
1186
1194
|
}
|
|
1187
|
-
) },
|
|
1195
|
+
) }, d.id);
|
|
1188
1196
|
}),
|
|
1189
|
-
S && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */
|
|
1197
|
+
S && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
|
|
1190
1198
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1191
1199
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1192
1200
|
] }) })
|
|
1193
1201
|
] }) })
|
|
1194
1202
|
] });
|
|
1195
|
-
},
|
|
1203
|
+
}, Ss = ({ className: t }) => /* @__PURE__ */ o(
|
|
1196
1204
|
"svg",
|
|
1197
1205
|
{
|
|
1198
1206
|
width: "140",
|
|
@@ -1202,7 +1210,7 @@ const ws = ({
|
|
|
1202
1210
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1203
1211
|
className: t,
|
|
1204
1212
|
children: [
|
|
1205
|
-
/* @__PURE__ */
|
|
1213
|
+
/* @__PURE__ */ o("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1206
1214
|
/* @__PURE__ */ e(
|
|
1207
1215
|
"path",
|
|
1208
1216
|
{
|
|
@@ -1231,7 +1239,7 @@ const ws = ({
|
|
|
1231
1239
|
fill: "white"
|
|
1232
1240
|
}
|
|
1233
1241
|
),
|
|
1234
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ o("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1235
1243
|
/* @__PURE__ */ e(
|
|
1236
1244
|
"path",
|
|
1237
1245
|
{
|
|
@@ -1271,8 +1279,8 @@ const ws = ({
|
|
|
1271
1279
|
}
|
|
1272
1280
|
)
|
|
1273
1281
|
] }),
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
/* @__PURE__ */
|
|
1282
|
+
/* @__PURE__ */ o("defs", { children: [
|
|
1283
|
+
/* @__PURE__ */ o(
|
|
1276
1284
|
"filter",
|
|
1277
1285
|
{
|
|
1278
1286
|
id: "filter0_empty_state",
|
|
@@ -1327,16 +1335,16 @@ const ws = ({
|
|
|
1327
1335
|
]
|
|
1328
1336
|
}
|
|
1329
1337
|
), Re = U.memo(
|
|
1330
|
-
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */
|
|
1331
|
-
/* @__PURE__ */ e(
|
|
1332
|
-
s && !t && /* @__PURE__ */
|
|
1338
|
+
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
1339
|
+
/* @__PURE__ */ e(Ss, {}),
|
|
1340
|
+
s && !t && /* @__PURE__ */ o("div", { className: "mt-8", children: [
|
|
1333
1341
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1334
1342
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1335
1343
|
] })
|
|
1336
1344
|
] }) })
|
|
1337
1345
|
);
|
|
1338
1346
|
Re.displayName = "EmptyState";
|
|
1339
|
-
const le = U.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */
|
|
1347
|
+
const le = U.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ o("div", { className: "text-center max-w-sm", children: [
|
|
1340
1348
|
/* @__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: "โ ๏ธ" }) }),
|
|
1341
1349
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1342
1350
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1351,36 +1359,36 @@ const le = U.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1351
1359
|
)
|
|
1352
1360
|
] }) }));
|
|
1353
1361
|
le.displayName = "ErrorState";
|
|
1354
|
-
const
|
|
1362
|
+
const Us = ({
|
|
1355
1363
|
capabilities: t = {},
|
|
1356
1364
|
className: s,
|
|
1357
1365
|
renderMessageInputActions: n,
|
|
1358
1366
|
onChannelSelect: r,
|
|
1359
1367
|
onParticipantSelect: a,
|
|
1360
|
-
initialParticipantFilter:
|
|
1368
|
+
initialParticipantFilter: i,
|
|
1361
1369
|
initialParticipantData: l,
|
|
1362
|
-
CustomChannelEmptyState:
|
|
1370
|
+
CustomChannelEmptyState: u,
|
|
1363
1371
|
showChannelList: h = !0,
|
|
1364
1372
|
filters: g,
|
|
1365
1373
|
channelListCustomEmptyStateIndicator: w,
|
|
1366
1374
|
onDeleteConversationClick: f,
|
|
1367
1375
|
onBlockParticipantClick: S,
|
|
1368
|
-
onReportParticipantClick:
|
|
1376
|
+
onReportParticipantClick: _
|
|
1369
1377
|
}) => {
|
|
1370
1378
|
const {
|
|
1371
1379
|
service: v,
|
|
1372
|
-
client:
|
|
1380
|
+
client: c,
|
|
1373
1381
|
isConnected: N,
|
|
1374
1382
|
isLoading: E,
|
|
1375
1383
|
error: I,
|
|
1376
1384
|
refreshConnection: k,
|
|
1377
1385
|
debug: x
|
|
1378
|
-
} =
|
|
1386
|
+
} = as(), [R, d] = y(null), [m, b] = y(!1), [B, j] = y(!1), [W, Y] = y(!1), [ie, Q] = y(/* @__PURE__ */ new Set()), [X, ce] = y(0), [O, H] = y(!1), [J, $] = y(null), M = z(null), {
|
|
1379
1387
|
participantSource: T,
|
|
1380
1388
|
participantLabel: A = "participants",
|
|
1381
1389
|
showDeleteConversation: V = !0
|
|
1382
1390
|
} = t, K = U.useMemo(() => {
|
|
1383
|
-
const C =
|
|
1391
|
+
const C = c == null ? void 0 : c.userID;
|
|
1384
1392
|
return {
|
|
1385
1393
|
...{
|
|
1386
1394
|
type: "messaging",
|
|
@@ -1392,13 +1400,13 @@ const Fs = ({
|
|
|
1392
1400
|
},
|
|
1393
1401
|
...g
|
|
1394
1402
|
};
|
|
1395
|
-
}, [g,
|
|
1396
|
-
if (!
|
|
1397
|
-
const C =
|
|
1403
|
+
}, [g, c == null ? void 0 : c.userID]), ee = z(null), Z = D(async () => {
|
|
1404
|
+
if (!c || !N) return;
|
|
1405
|
+
const C = c.userID;
|
|
1398
1406
|
if (C)
|
|
1399
1407
|
try {
|
|
1400
1408
|
x && console.log("[MessagingShell] Syncing channels for user:", C);
|
|
1401
|
-
const P = await
|
|
1409
|
+
const P = await c.queryChannels(
|
|
1402
1410
|
{
|
|
1403
1411
|
type: "messaging",
|
|
1404
1412
|
members: { $in: [C] }
|
|
@@ -1410,8 +1418,8 @@ const Fs = ({
|
|
|
1410
1418
|
const de = L.state.members;
|
|
1411
1419
|
Object.values(de).forEach((Ue) => {
|
|
1412
1420
|
var he;
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1421
|
+
const me = (he = Ue.user) == null ? void 0 : he.id;
|
|
1422
|
+
me && me !== C && F.add(me);
|
|
1415
1423
|
});
|
|
1416
1424
|
}), Q((L) => L.size === F.size && [...L].every((de) => F.has(de)) ? L : F), b(P.length > 0), j(!0), ee.current = C, x && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1417
1425
|
channelCount: P.length,
|
|
@@ -1420,31 +1428,31 @@ const Fs = ({
|
|
|
1420
1428
|
} catch (P) {
|
|
1421
1429
|
console.error("[MessagingShell] Failed to sync channels:", P);
|
|
1422
1430
|
}
|
|
1423
|
-
}, [
|
|
1431
|
+
}, [c, N, x]);
|
|
1424
1432
|
G(() => {
|
|
1425
|
-
if (!
|
|
1426
|
-
const C =
|
|
1433
|
+
if (!c || !N) return;
|
|
1434
|
+
const C = c.userID;
|
|
1427
1435
|
C && ee.current !== C && Z();
|
|
1428
|
-
}, [
|
|
1429
|
-
if (!
|
|
1436
|
+
}, [c, N, Z]), G(() => {
|
|
1437
|
+
if (!i || !c || !N) return;
|
|
1430
1438
|
(async () => {
|
|
1431
|
-
const P =
|
|
1439
|
+
const P = c.userID;
|
|
1432
1440
|
if (P)
|
|
1433
1441
|
try {
|
|
1434
1442
|
x && console.log(
|
|
1435
1443
|
"[MessagingShell] Loading initial conversation with:",
|
|
1436
|
-
|
|
1444
|
+
i
|
|
1437
1445
|
);
|
|
1438
|
-
const F = await
|
|
1446
|
+
const F = await c.queryChannels(
|
|
1439
1447
|
{
|
|
1440
1448
|
type: "messaging",
|
|
1441
|
-
members: { $eq: [P,
|
|
1449
|
+
members: { $eq: [P, i] }
|
|
1442
1450
|
},
|
|
1443
1451
|
{},
|
|
1444
1452
|
{ limit: 1 }
|
|
1445
1453
|
);
|
|
1446
1454
|
if (F.length > 0)
|
|
1447
|
-
|
|
1455
|
+
d(F[0]), H(!0), $(null), r && r(F[0]), x && console.log(
|
|
1448
1456
|
"[MessagingShell] Initial conversation loaded:",
|
|
1449
1457
|
F[0].id
|
|
1450
1458
|
);
|
|
@@ -1460,7 +1468,7 @@ const Fs = ({
|
|
|
1460
1468
|
email: l.email,
|
|
1461
1469
|
phone: l.phone
|
|
1462
1470
|
});
|
|
1463
|
-
|
|
1471
|
+
d(L), H(!0), $(null), r && r(L), x && console.log(
|
|
1464
1472
|
"[MessagingShell] Channel created and loaded:",
|
|
1465
1473
|
L.id
|
|
1466
1474
|
);
|
|
@@ -1475,7 +1483,7 @@ const Fs = ({
|
|
|
1475
1483
|
"No conversation found with this account"
|
|
1476
1484
|
), x && console.log(
|
|
1477
1485
|
"[MessagingShell] No conversation found for:",
|
|
1478
|
-
|
|
1486
|
+
i
|
|
1479
1487
|
);
|
|
1480
1488
|
} catch (F) {
|
|
1481
1489
|
console.error(
|
|
@@ -1485,22 +1493,22 @@ const Fs = ({
|
|
|
1485
1493
|
}
|
|
1486
1494
|
})();
|
|
1487
1495
|
}, [
|
|
1488
|
-
|
|
1496
|
+
i,
|
|
1489
1497
|
l,
|
|
1490
|
-
|
|
1498
|
+
c,
|
|
1491
1499
|
N,
|
|
1492
1500
|
v,
|
|
1493
1501
|
x,
|
|
1494
1502
|
r
|
|
1495
1503
|
]);
|
|
1496
|
-
const
|
|
1504
|
+
const Me = D(
|
|
1497
1505
|
(C) => {
|
|
1498
|
-
|
|
1506
|
+
d(C), r == null || r(C);
|
|
1499
1507
|
},
|
|
1500
1508
|
[r]
|
|
1501
1509
|
), De = D(() => {
|
|
1502
|
-
O ||
|
|
1503
|
-
}, [O]),
|
|
1510
|
+
O || d(null);
|
|
1511
|
+
}, [O]), _e = D(
|
|
1504
1512
|
async (C) => {
|
|
1505
1513
|
var P;
|
|
1506
1514
|
if (v)
|
|
@@ -1520,7 +1528,7 @@ const Fs = ({
|
|
|
1520
1528
|
} catch (L) {
|
|
1521
1529
|
console.warn("[MessagingShell] Failed to unhide channel:", L);
|
|
1522
1530
|
}
|
|
1523
|
-
|
|
1531
|
+
d(F), Y(!1), (P = M.current) == null || P.close(), a == null || a(C);
|
|
1524
1532
|
} catch (F) {
|
|
1525
1533
|
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
1526
1534
|
}
|
|
@@ -1528,30 +1536,30 @@ const Fs = ({
|
|
|
1528
1536
|
[v, a, x]
|
|
1529
1537
|
), se = D(() => {
|
|
1530
1538
|
var C;
|
|
1531
|
-
Y(!1), (C =
|
|
1539
|
+
Y(!1), (C = M.current) == null || C.close();
|
|
1532
1540
|
}, []), Fe = D(
|
|
1533
1541
|
(C) => {
|
|
1534
|
-
C.target ===
|
|
1542
|
+
C.target === M.current && se();
|
|
1535
1543
|
},
|
|
1536
1544
|
[se]
|
|
1537
1545
|
), Te = D(
|
|
1538
1546
|
async (C) => {
|
|
1539
|
-
x && console.log("[MessagingShell] Leaving conversation:", C.id),
|
|
1547
|
+
x && console.log("[MessagingShell] Leaving conversation:", C.id), d(null), H(!1), ee.current = null, await Z();
|
|
1540
1548
|
},
|
|
1541
1549
|
[Z, x]
|
|
1542
1550
|
), Le = D(
|
|
1543
1551
|
async (C) => {
|
|
1544
|
-
x && console.log("[MessagingShell] Blocking participant:", C),
|
|
1552
|
+
x && console.log("[MessagingShell] Blocking participant:", C), d(null), H(!1), ee.current = null, await Z();
|
|
1545
1553
|
},
|
|
1546
1554
|
[Z, x]
|
|
1547
1555
|
), te = !!R;
|
|
1548
|
-
return E ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(ae, {}) }) : I ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: k }) }) : !N || !
|
|
1556
|
+
return E ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(ae, {}) }) : I ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: k }) }) : !N || !c ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
|
|
1549
1557
|
le,
|
|
1550
1558
|
{
|
|
1551
1559
|
message: "Not connected to messaging service",
|
|
1552
1560
|
onBack: k
|
|
1553
1561
|
}
|
|
1554
|
-
) }) : J ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: J }) }) : /* @__PURE__ */
|
|
1562
|
+
) }) : J ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: J }) }) : /* @__PURE__ */ o(
|
|
1555
1563
|
"div",
|
|
1556
1564
|
{
|
|
1557
1565
|
className: p(
|
|
@@ -1559,7 +1567,7 @@ const Fs = ({
|
|
|
1559
1567
|
s
|
|
1560
1568
|
),
|
|
1561
1569
|
children: [
|
|
1562
|
-
/* @__PURE__ */
|
|
1570
|
+
/* @__PURE__ */ o("div", { className: "flex h-full min-h-0", children: [
|
|
1563
1571
|
/* @__PURE__ */ e(
|
|
1564
1572
|
"div",
|
|
1565
1573
|
{
|
|
@@ -1576,7 +1584,7 @@ const Fs = ({
|
|
|
1576
1584
|
children: /* @__PURE__ */ e(
|
|
1577
1585
|
Ie,
|
|
1578
1586
|
{
|
|
1579
|
-
onChannelSelect:
|
|
1587
|
+
onChannelSelect: Me,
|
|
1580
1588
|
selectedChannel: R || void 0,
|
|
1581
1589
|
filters: K,
|
|
1582
1590
|
customEmptyStateIndicator: w
|
|
@@ -1591,9 +1599,9 @@ const Fs = ({
|
|
|
1591
1599
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1592
1600
|
{
|
|
1593
1601
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1594
|
-
flex: O || te ||
|
|
1602
|
+
flex: O || te || i,
|
|
1595
1603
|
// Normal mode: hide on mobile when no channel selected
|
|
1596
|
-
"hidden lg:flex": !O && !te && !
|
|
1604
|
+
"hidden lg:flex": !O && !te && !i
|
|
1597
1605
|
}
|
|
1598
1606
|
),
|
|
1599
1607
|
children: R ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
@@ -1605,20 +1613,20 @@ const Fs = ({
|
|
|
1605
1613
|
renderMessageInputActions: n,
|
|
1606
1614
|
onLeaveConversation: Te,
|
|
1607
1615
|
onBlockParticipant: Le,
|
|
1608
|
-
CustomChannelEmptyState:
|
|
1616
|
+
CustomChannelEmptyState: u,
|
|
1609
1617
|
showDeleteConversation: V,
|
|
1610
1618
|
onDeleteConversationClick: f,
|
|
1611
1619
|
onBlockParticipantClick: S,
|
|
1612
|
-
onReportParticipantClick:
|
|
1620
|
+
onReportParticipantClick: _
|
|
1613
1621
|
},
|
|
1614
1622
|
R.id
|
|
1615
|
-
) }) :
|
|
1623
|
+
) }) : i ? (
|
|
1616
1624
|
// Show loading while creating/loading direct conversation channel
|
|
1617
1625
|
/* @__PURE__ */ e(ae, {})
|
|
1618
1626
|
) : /* @__PURE__ */ e(
|
|
1619
1627
|
Re,
|
|
1620
1628
|
{
|
|
1621
|
-
hasChannels:
|
|
1629
|
+
hasChannels: m,
|
|
1622
1630
|
channelsLoaded: B
|
|
1623
1631
|
}
|
|
1624
1632
|
)
|
|
@@ -1629,15 +1637,15 @@ const Fs = ({
|
|
|
1629
1637
|
/* @__PURE__ */ e(
|
|
1630
1638
|
"dialog",
|
|
1631
1639
|
{
|
|
1632
|
-
ref:
|
|
1640
|
+
ref: M,
|
|
1633
1641
|
className: "mes-dialog",
|
|
1634
1642
|
onClick: Fe,
|
|
1635
1643
|
onClose: se,
|
|
1636
1644
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1637
|
-
|
|
1645
|
+
Is,
|
|
1638
1646
|
{
|
|
1639
1647
|
participantSource: T,
|
|
1640
|
-
onSelectParticipant:
|
|
1648
|
+
onSelectParticipant: _e,
|
|
1641
1649
|
onClose: se,
|
|
1642
1650
|
existingParticipantIds: ie,
|
|
1643
1651
|
participantLabel: A,
|
|
@@ -1650,7 +1658,7 @@ const Fs = ({
|
|
|
1650
1658
|
]
|
|
1651
1659
|
}
|
|
1652
1660
|
);
|
|
1653
|
-
},
|
|
1661
|
+
}, ps = ({
|
|
1654
1662
|
question: t,
|
|
1655
1663
|
onClick: s,
|
|
1656
1664
|
loading: n = !1,
|
|
@@ -1672,36 +1680,36 @@ const Fs = ({
|
|
|
1672
1680
|
),
|
|
1673
1681
|
children: t
|
|
1674
1682
|
}
|
|
1675
|
-
),
|
|
1683
|
+
), Ps = ({
|
|
1676
1684
|
faqs: t,
|
|
1677
1685
|
onFaqClick: s,
|
|
1678
1686
|
loadingFaqId: n,
|
|
1679
1687
|
headerText: r,
|
|
1680
1688
|
className: a,
|
|
1681
|
-
avatarImage:
|
|
1689
|
+
avatarImage: i,
|
|
1682
1690
|
avatarName: l
|
|
1683
1691
|
}) => {
|
|
1684
|
-
const
|
|
1685
|
-
return
|
|
1686
|
-
(
|
|
1692
|
+
const u = t.filter((h) => h.enabled).sort((h, g) => (h.order ?? 0) - (g.order ?? 0));
|
|
1693
|
+
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ o("div", { className: "flex gap-3 items-end", children: [
|
|
1694
|
+
(i || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1687
1695
|
q,
|
|
1688
1696
|
{
|
|
1689
1697
|
id: l || "account",
|
|
1690
1698
|
name: l || "Account",
|
|
1691
|
-
image:
|
|
1699
|
+
image: i,
|
|
1692
1700
|
size: 24,
|
|
1693
1701
|
shape: "circle"
|
|
1694
1702
|
}
|
|
1695
1703
|
) }),
|
|
1696
|
-
/* @__PURE__ */
|
|
1704
|
+
/* @__PURE__ */ o(
|
|
1697
1705
|
"div",
|
|
1698
1706
|
{
|
|
1699
1707
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
1700
1708
|
style: { backgroundColor: "#F1F0EE" },
|
|
1701
1709
|
children: [
|
|
1702
1710
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1703
|
-
|
|
1704
|
-
|
|
1711
|
+
u.map((h) => /* @__PURE__ */ e(
|
|
1712
|
+
ps,
|
|
1705
1713
|
{
|
|
1706
1714
|
question: h.question,
|
|
1707
1715
|
onClick: () => s(h.id),
|
|
@@ -1713,32 +1721,32 @@ const Fs = ({
|
|
|
1713
1721
|
}
|
|
1714
1722
|
)
|
|
1715
1723
|
] }) });
|
|
1716
|
-
},
|
|
1717
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [a,
|
|
1724
|
+
}, Os = (t, s = {}) => {
|
|
1725
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, i] = y([]), [l, u] = y(!1), [h, g] = y(null), [w, f] = y(n), [S, _] = y(!0), [v, c] = y(), N = D(async (x = !1, R) => {
|
|
1718
1726
|
if (l) return;
|
|
1719
|
-
const
|
|
1720
|
-
|
|
1727
|
+
const d = R !== void 0 ? R : w;
|
|
1728
|
+
u(!0), g(null);
|
|
1721
1729
|
try {
|
|
1722
|
-
const
|
|
1723
|
-
search:
|
|
1730
|
+
const m = await t.loadParticipants({
|
|
1731
|
+
search: d || void 0,
|
|
1724
1732
|
limit: r,
|
|
1725
1733
|
cursor: x ? void 0 : v
|
|
1726
1734
|
});
|
|
1727
|
-
|
|
1728
|
-
(b) => x ?
|
|
1729
|
-
),
|
|
1730
|
-
} catch (
|
|
1731
|
-
const b =
|
|
1732
|
-
g(b), console.error("[useParticipants] Load error:",
|
|
1735
|
+
i(
|
|
1736
|
+
(b) => x ? m.participants : [...b, ...m.participants]
|
|
1737
|
+
), _(m.hasMore), c(m.nextCursor);
|
|
1738
|
+
} catch (m) {
|
|
1739
|
+
const b = m instanceof Error ? m.message : "Failed to load participants";
|
|
1740
|
+
g(b), console.error("[useParticipants] Load error:", m);
|
|
1733
1741
|
} finally {
|
|
1734
|
-
|
|
1742
|
+
u(!1);
|
|
1735
1743
|
}
|
|
1736
1744
|
}, [t, w, v, r, l]), E = D(() => {
|
|
1737
1745
|
S && !l && N(!1);
|
|
1738
1746
|
}, [S, l, N]), I = D((x) => {
|
|
1739
|
-
f(x),
|
|
1747
|
+
f(x), c(void 0), N(!0, x);
|
|
1740
1748
|
}, [N]), k = D(() => {
|
|
1741
|
-
|
|
1749
|
+
c(void 0), N(!0);
|
|
1742
1750
|
}, [N]);
|
|
1743
1751
|
return G(() => {
|
|
1744
1752
|
N(!0);
|
|
@@ -1756,16 +1764,16 @@ const Fs = ({
|
|
|
1756
1764
|
};
|
|
1757
1765
|
export {
|
|
1758
1766
|
q as Avatar,
|
|
1759
|
-
|
|
1767
|
+
bs as ChannelEmptyState,
|
|
1760
1768
|
Ie as ChannelList,
|
|
1761
1769
|
ke as ChannelView,
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
+
Ps as FaqList,
|
|
1771
|
+
ps as FaqListItem,
|
|
1772
|
+
Ls as MessagingProvider,
|
|
1773
|
+
Us as MessagingShell,
|
|
1774
|
+
Is as ParticipantPicker,
|
|
1775
|
+
is as formatRelativeTime,
|
|
1776
|
+
as as useMessaging,
|
|
1777
|
+
Os as useParticipants
|
|
1770
1778
|
};
|
|
1771
1779
|
//# sourceMappingURL=index.js.map
|