@linktr.ee/messaging-react 1.11.5-rc-1765005296 โ 1.11.5-rc-1765086958
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,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as i, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import L, { createContext as
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { XIcon as
|
|
7
|
-
import { LinkPreviewsManager as
|
|
8
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
+
import R from "classnames";
|
|
3
|
+
import L, { createContext as Fe, useContext as Pe, useCallback as _, useState as v, useRef as z, useEffect as G } from "react";
|
|
4
|
+
import { StreamChatService as Te } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as Le, ChannelList as Ue, useMessageComposer as Oe, useStateStore as je, MessageInput as Be, useMessageInputContext as Ae, useMessageComposerHasSendableData as ze, SimpleAttachmentSelector as $e, QuotedMessagePreview as Ge, AttachmentPreviewList as He, TextareaComposer as Ve, MessageTimestamp as We, Channel as Ze, useChannelStateContext as xe, Window as qe, MessageList as Ye } from "stream-chat-react";
|
|
6
|
+
import { XIcon as oe, ArrowUpIcon as Je, ArrowLeftIcon as ce, DotsThreeIcon as de, SpinnerGapIcon as se, SignOutIcon as Qe, ProhibitInsetIcon as ue, FlagIcon as Xe, MagnifyingGlassIcon as Ke, ChatCircleDotsIcon as me } from "@phosphor-icons/react";
|
|
7
|
+
import { LinkPreviewsManager as he } from "stream-chat";
|
|
8
|
+
const Ce = Fe({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,7 +15,7 @@ const xe = De({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), ne = () =>
|
|
18
|
+
}), ne = () => Pe(Ce), Ss = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
@@ -23,9 +23,9 @@ const xe = De({
|
|
|
23
23
|
capabilities: a = {},
|
|
24
24
|
debug: o = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const l =
|
|
27
|
-
(
|
|
28
|
-
o && console.log(`๐ฅ [MessagingProvider] ${
|
|
26
|
+
const l = _(
|
|
27
|
+
(m, ...N) => {
|
|
28
|
+
o && console.log(`๐ฅ [MessagingProvider] ${m}`, ...N);
|
|
29
29
|
},
|
|
30
30
|
[o]
|
|
31
31
|
);
|
|
@@ -35,14 +35,14 @@ const xe = De({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(a)
|
|
37
37
|
});
|
|
38
|
-
const [
|
|
38
|
+
const [d, h] = v(null), [b, k] = v(null), [u, f] = v(!1), [g, w] = v(!1), [y, E] = v(null), C = z(!1), I = z({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
42
42
|
capabilities: a
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
43
|
+
}), p = z(0);
|
|
44
|
+
p.current++, l("๐ RENDER INFO", {
|
|
45
|
+
renderCount: p.current,
|
|
46
46
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
48
|
userChanged: I.current.userId !== (s == null ? void 0 : s.id),
|
|
@@ -56,9 +56,9 @@ const xe = De({
|
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: a
|
|
58
58
|
}, G(() => {
|
|
59
|
-
const
|
|
59
|
+
const m = p.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,50 +69,50 @@ const xe = De({
|
|
|
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
|
-
const
|
|
82
|
+
const N = new Te({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: r,
|
|
85
85
|
debug: o
|
|
86
86
|
});
|
|
87
|
-
return
|
|
88
|
-
renderCount:
|
|
89
|
-
serviceInstance: !!
|
|
87
|
+
return h(N), l("โ
SERVICE SET", {
|
|
88
|
+
renderCount: m,
|
|
89
|
+
serviceInstance: !!N
|
|
90
90
|
}), () => {
|
|
91
91
|
l("๐งน SERVICE CLEANUP", {
|
|
92
|
-
renderCount:
|
|
92
|
+
renderCount: m,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
|
-
}),
|
|
94
|
+
}), N.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
96
|
}, [r, n, o, l]);
|
|
97
|
-
const
|
|
97
|
+
const S = z(null);
|
|
98
98
|
G(() => {
|
|
99
|
-
var
|
|
99
|
+
var N, A;
|
|
100
100
|
if (l("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
-
hasService: !!
|
|
101
|
+
hasService: !!d,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
|
-
isConnecting:
|
|
105
|
-
isConnected:
|
|
106
|
-
dependencies: { service: !!
|
|
107
|
-
}), !
|
|
104
|
+
isConnecting: C.current,
|
|
105
|
+
isConnected: u,
|
|
106
|
+
dependencies: { service: !!d, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !d || !s) {
|
|
108
108
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
111
|
+
if (C.current) {
|
|
112
112
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((
|
|
115
|
+
if (((N = S.current) == null ? void 0 : N.serviceId) === d && ((A = S.current) == null ? void 0 : A.userId) === s.id) {
|
|
116
116
|
l(
|
|
117
117
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -120,114 +120,114 @@ const xe = De({
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
l("๐ STARTING USER CONNECTION", { userId: s.id }),
|
|
123
|
+
l("๐ STARTING USER CONNECTION", { userId: s.id }), C.current = !0, w(!0), E(null);
|
|
124
124
|
try {
|
|
125
125
|
l("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
const j = await d.connectUser(s);
|
|
127
|
+
k(j), f(!0), S.current = { serviceId: d, userId: s.id }, l("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
|
-
clientId:
|
|
129
|
+
clientId: j.userID
|
|
130
130
|
});
|
|
131
|
-
} catch (
|
|
132
|
-
const
|
|
133
|
-
E(
|
|
131
|
+
} catch (j) {
|
|
132
|
+
const H = j instanceof Error ? j.message : "Connection failed";
|
|
133
|
+
E(H), l("โ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
|
-
error:
|
|
135
|
+
error: H
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
w(!1), C.current = !1, l("๐ USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
|
-
isConnected:
|
|
140
|
+
isConnected: u
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [
|
|
145
|
-
hasService: !!
|
|
146
|
-
isConnected:
|
|
144
|
+
}, [d, s, l, u]), G(() => (l("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!d,
|
|
146
|
+
isConnected: u
|
|
147
147
|
}), () => {
|
|
148
|
-
|
|
148
|
+
d && u ? (l(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
152
|
-
hasService: !!
|
|
153
|
-
isConnected:
|
|
151
|
+
), S.current = null, d.disconnectUser().catch(console.error)) : l("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!d,
|
|
153
|
+
isConnected: u
|
|
154
154
|
});
|
|
155
|
-
}), [
|
|
156
|
-
const
|
|
155
|
+
}), [d, u, l]);
|
|
156
|
+
const P = _(async () => {
|
|
157
157
|
if (l("๐ REFRESH CONNECTION CALLED", {
|
|
158
|
-
hasService: !!
|
|
158
|
+
hasService: !!d,
|
|
159
159
|
hasUser: !!s
|
|
160
|
-
}), !
|
|
160
|
+
}), !d || !s) {
|
|
161
161
|
l("โ ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
l("๐ STARTING CONNECTION REFRESH", { userId: s.id }),
|
|
164
|
+
l("๐ STARTING CONNECTION REFRESH", { userId: s.id }), w(!0);
|
|
165
165
|
try {
|
|
166
|
-
l("๐ DISCONNECTING FOR REFRESH"), await
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
} catch (
|
|
170
|
-
const
|
|
171
|
-
E(
|
|
166
|
+
l("๐ DISCONNECTING FOR REFRESH"), await d.disconnectUser(), l("๐ RECONNECTING FOR REFRESH");
|
|
167
|
+
const m = await d.connectUser(s);
|
|
168
|
+
k(m), f(!0), E(null), l("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
|
+
} catch (m) {
|
|
170
|
+
const N = m instanceof Error ? m.message : "Refresh failed";
|
|
171
|
+
E(N), l("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
|
-
error:
|
|
173
|
+
error: N
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
w(!1), l("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [
|
|
179
|
-
hasService: !!
|
|
180
|
-
hasClient: !!
|
|
181
|
-
isConnected:
|
|
182
|
-
isLoading:
|
|
183
|
-
hasError: !!
|
|
178
|
+
}, [d, s, l]), c = L.useMemo(() => (l("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!d,
|
|
180
|
+
hasClient: !!b,
|
|
181
|
+
isConnected: u,
|
|
182
|
+
isLoading: g,
|
|
183
|
+
hasError: !!y,
|
|
184
184
|
capabilitiesKeys: Object.keys(a)
|
|
185
185
|
}), {
|
|
186
|
-
service:
|
|
187
|
-
client:
|
|
188
|
-
isConnected:
|
|
189
|
-
isLoading:
|
|
190
|
-
error:
|
|
186
|
+
service: d,
|
|
187
|
+
client: b,
|
|
188
|
+
isConnected: u,
|
|
189
|
+
isLoading: g,
|
|
190
|
+
error: y,
|
|
191
191
|
capabilities: a,
|
|
192
|
-
refreshConnection:
|
|
192
|
+
refreshConnection: P,
|
|
193
193
|
debug: o
|
|
194
194
|
}), [
|
|
195
|
-
|
|
195
|
+
d,
|
|
196
|
+
b,
|
|
197
|
+
u,
|
|
196
198
|
g,
|
|
197
|
-
|
|
198
|
-
S,
|
|
199
|
-
w,
|
|
199
|
+
y,
|
|
200
200
|
a,
|
|
201
|
-
|
|
201
|
+
P,
|
|
202
202
|
o,
|
|
203
203
|
l
|
|
204
204
|
]);
|
|
205
205
|
return l("๐ RENDER END", {
|
|
206
|
-
renderCount:
|
|
207
|
-
willRenderChat: !!(
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(
|
|
210
|
-
|
|
206
|
+
renderCount: p.current,
|
|
207
|
+
willRenderChat: !!(b && u),
|
|
208
|
+
contextValueReady: !!c
|
|
209
|
+
}), /* @__PURE__ */ e(Ce.Provider, { value: c, children: b && u ? /* @__PURE__ */ e(
|
|
210
|
+
Le,
|
|
211
211
|
{
|
|
212
|
-
client:
|
|
212
|
+
client: b,
|
|
213
213
|
customClasses: {
|
|
214
214
|
channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
|
|
215
215
|
},
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
},
|
|
219
|
+
}, es = () => ne(), ss = (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
|
+
}, ts = (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 = ss(t, s);
|
|
231
231
|
return r === 0 ? t.toLocaleTimeString([], {
|
|
232
232
|
hour: "numeric",
|
|
233
233
|
minute: "2-digit"
|
|
@@ -236,7 +236,7 @@ const xe = De({
|
|
|
236
236
|
day: "numeric",
|
|
237
237
|
year: "2-digit"
|
|
238
238
|
});
|
|
239
|
-
},
|
|
239
|
+
}, fe = [
|
|
240
240
|
"๐",
|
|
241
241
|
// Apple
|
|
242
242
|
"๐",
|
|
@@ -264,7 +264,7 @@ const xe = De({
|
|
|
264
264
|
"๐"
|
|
265
265
|
// Melon
|
|
266
266
|
];
|
|
267
|
-
function
|
|
267
|
+
function ns(t) {
|
|
268
268
|
let s = 0;
|
|
269
269
|
for (let n = 0; n < t.length; n++) {
|
|
270
270
|
const r = t.charCodeAt(n);
|
|
@@ -272,29 +272,29 @@ function ss(t) {
|
|
|
272
272
|
}
|
|
273
273
|
return Math.abs(s);
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
const n =
|
|
277
|
-
return
|
|
275
|
+
function rs(t) {
|
|
276
|
+
const n = ns(t) % fe.length;
|
|
277
|
+
return fe[n];
|
|
278
278
|
}
|
|
279
|
-
const
|
|
279
|
+
const Z = ({
|
|
280
280
|
id: t,
|
|
281
281
|
image: s,
|
|
282
282
|
size: n = 40,
|
|
283
283
|
className: r,
|
|
284
284
|
shape: a = "squircle"
|
|
285
285
|
}) => {
|
|
286
|
-
const o =
|
|
286
|
+
const o = rs(t), d = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = a === "circle" ? { borderRadius: "50%" } : {
|
|
287
287
|
borderRadius: "33%",
|
|
288
288
|
"corner-shape": "superellipse(1.3)"
|
|
289
289
|
};
|
|
290
290
|
return /* @__PURE__ */ e(
|
|
291
291
|
"div",
|
|
292
292
|
{
|
|
293
|
-
className:
|
|
293
|
+
className: R("flex-shrink-0 overflow-hidden", r),
|
|
294
294
|
style: {
|
|
295
295
|
width: `${n}px`,
|
|
296
296
|
height: `${n}px`,
|
|
297
|
-
...
|
|
297
|
+
...h
|
|
298
298
|
},
|
|
299
299
|
children: s ? /* @__PURE__ */ e(
|
|
300
300
|
"img",
|
|
@@ -307,43 +307,43 @@ const q = ({
|
|
|
307
307
|
"div",
|
|
308
308
|
{
|
|
309
309
|
"aria-hidden": "true",
|
|
310
|
-
className:
|
|
310
|
+
className: R(
|
|
311
311
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
312
|
-
|
|
312
|
+
d
|
|
313
313
|
),
|
|
314
314
|
children: o
|
|
315
315
|
}
|
|
316
316
|
)
|
|
317
317
|
}
|
|
318
318
|
);
|
|
319
|
-
},
|
|
319
|
+
}, Ne = L.memo(
|
|
320
320
|
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
|
|
321
|
-
var E,
|
|
321
|
+
var E, C, I, p, S, P;
|
|
322
322
|
const o = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
|
|
323
323
|
t && n(t);
|
|
324
|
-
},
|
|
325
|
-
(
|
|
326
|
-
var
|
|
327
|
-
return ((
|
|
324
|
+
}, h = Object.values(((E = t == null ? void 0 : t.state) == null ? void 0 : E.members) || {}).find(
|
|
325
|
+
(c) => {
|
|
326
|
+
var m, N;
|
|
327
|
+
return ((m = c.user) == null ? void 0 : m.id) && c.user.id !== ((N = t == null ? void 0 : t._client) == null ? void 0 : N.userID);
|
|
328
328
|
}
|
|
329
|
-
),
|
|
330
|
-
var
|
|
331
|
-
if (
|
|
332
|
-
const
|
|
333
|
-
return
|
|
334
|
-
})(),
|
|
329
|
+
), b = ((C = h == null ? void 0 : h.user) == null ? void 0 : C.name) || "Conversation", k = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, u = (S = (p = t == null ? void 0 : t.state) == null ? void 0 : p.messages) == null ? void 0 : S[t.state.messages.length - 1], g = (() => {
|
|
330
|
+
var m;
|
|
331
|
+
if (u != null && u.text) return u.text;
|
|
332
|
+
const c = (m = u == null ? void 0 : u.attachments) == null ? void 0 : m[0];
|
|
333
|
+
return c != null && c.asset_url ? c.asset_url : c != null && c.image_url ? c.image_url : c != null && c.og_scrape_url ? c.og_scrape_url : c != null && c.thumb_url ? c.thumb_url : "No messages yet";
|
|
334
|
+
})(), w = u != null && u.created_at ? ts(new Date(u.created_at)) : "", y = a ?? 0;
|
|
335
335
|
return r && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
336
336
|
channelId: t == null ? void 0 : t.id,
|
|
337
337
|
isSelected: o,
|
|
338
|
-
participantName:
|
|
339
|
-
unreadCount:
|
|
340
|
-
hasTimestamp: !!
|
|
338
|
+
participantName: b,
|
|
339
|
+
unreadCount: y,
|
|
340
|
+
hasTimestamp: !!w
|
|
341
341
|
}), /* @__PURE__ */ e(
|
|
342
342
|
"button",
|
|
343
343
|
{
|
|
344
344
|
type: "button",
|
|
345
345
|
onClick: l,
|
|
346
|
-
className:
|
|
346
|
+
className: R(
|
|
347
347
|
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
348
348
|
{
|
|
349
349
|
"bg-primary-alt/10 border-l-4 border-l-primary": o,
|
|
@@ -352,11 +352,11 @@ const q = ({
|
|
|
352
352
|
),
|
|
353
353
|
children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
354
354
|
/* @__PURE__ */ e(
|
|
355
|
-
|
|
355
|
+
Z,
|
|
356
356
|
{
|
|
357
|
-
id: ((
|
|
358
|
-
name:
|
|
359
|
-
image:
|
|
357
|
+
id: ((P = h == null ? void 0 : h.user) == null ? void 0 : P.id) || t.id || "unknown",
|
|
358
|
+
name: b,
|
|
359
|
+
image: k,
|
|
360
360
|
size: 44,
|
|
361
361
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
362
362
|
}
|
|
@@ -366,18 +366,18 @@ const q = ({
|
|
|
366
366
|
/* @__PURE__ */ e(
|
|
367
367
|
"h3",
|
|
368
368
|
{
|
|
369
|
-
className:
|
|
369
|
+
className: R(
|
|
370
370
|
"text-sm font-medium truncate",
|
|
371
371
|
o ? "text-primary" : "text-charcoal"
|
|
372
372
|
),
|
|
373
|
-
children:
|
|
373
|
+
children: b
|
|
374
374
|
}
|
|
375
375
|
),
|
|
376
|
-
|
|
376
|
+
w && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: w })
|
|
377
377
|
] }),
|
|
378
378
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
379
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children:
|
|
380
|
-
|
|
379
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: g }),
|
|
380
|
+
y > 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: y > 99 ? "99+" : y })
|
|
381
381
|
] })
|
|
382
382
|
] })
|
|
383
383
|
] })
|
|
@@ -385,8 +385,8 @@ const q = ({
|
|
|
385
385
|
);
|
|
386
386
|
}
|
|
387
387
|
);
|
|
388
|
-
|
|
389
|
-
const
|
|
388
|
+
Ne.displayName = "CustomChannelPreview";
|
|
389
|
+
const be = L.memo(
|
|
390
390
|
({
|
|
391
391
|
onChannelSelect: t,
|
|
392
392
|
selectedChannel: s,
|
|
@@ -402,10 +402,10 @@ const Ne = L.memo(
|
|
|
402
402
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
403
403
|
filters: n
|
|
404
404
|
});
|
|
405
|
-
const
|
|
406
|
-
|
|
405
|
+
const d = L.useMemo(() => (b) => /* @__PURE__ */ e(
|
|
406
|
+
Ne,
|
|
407
407
|
{
|
|
408
|
-
...
|
|
408
|
+
...b,
|
|
409
409
|
selectedChannel: s,
|
|
410
410
|
onChannelSelect: t,
|
|
411
411
|
debug: l
|
|
@@ -414,17 +414,17 @@ const Ne = L.memo(
|
|
|
414
414
|
return /* @__PURE__ */ e(
|
|
415
415
|
"div",
|
|
416
416
|
{
|
|
417
|
-
className:
|
|
417
|
+
className: R(
|
|
418
418
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
419
419
|
r
|
|
420
420
|
),
|
|
421
421
|
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
|
|
422
|
-
|
|
422
|
+
Ue,
|
|
423
423
|
{
|
|
424
424
|
filters: n,
|
|
425
425
|
sort: { last_message_at: -1 },
|
|
426
426
|
options: { limit: 30 },
|
|
427
|
-
Preview:
|
|
427
|
+
Preview: d,
|
|
428
428
|
EmptyStateIndicator: a
|
|
429
429
|
},
|
|
430
430
|
JSON.stringify(n)
|
|
@@ -433,7 +433,7 @@ const Ne = L.memo(
|
|
|
433
433
|
);
|
|
434
434
|
}
|
|
435
435
|
);
|
|
436
|
-
|
|
436
|
+
be.displayName = "ChannelList";
|
|
437
437
|
const ee = ({
|
|
438
438
|
variant: t = "default",
|
|
439
439
|
className: s,
|
|
@@ -443,7 +443,7 @@ const ee = ({
|
|
|
443
443
|
"button",
|
|
444
444
|
{
|
|
445
445
|
type: "button",
|
|
446
|
-
className:
|
|
446
|
+
className: R(
|
|
447
447
|
"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",
|
|
448
448
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
449
449
|
s
|
|
@@ -452,12 +452,12 @@ const ee = ({
|
|
|
452
452
|
children: n
|
|
453
453
|
}
|
|
454
454
|
);
|
|
455
|
-
function
|
|
455
|
+
function ve({ label: t, className: s, children: n, ...r }) {
|
|
456
456
|
return /* @__PURE__ */ i(
|
|
457
457
|
"button",
|
|
458
458
|
{
|
|
459
459
|
type: "button",
|
|
460
|
-
className:
|
|
460
|
+
className: R(
|
|
461
461
|
"rounded-full p-2 transition-colors focus-ring",
|
|
462
462
|
{
|
|
463
463
|
"cursor-not-allowed opacity-50": r.disabled,
|
|
@@ -473,14 +473,14 @@ function be({ label: t, className: s, children: n, ...r }) {
|
|
|
473
473
|
}
|
|
474
474
|
);
|
|
475
475
|
}
|
|
476
|
-
function
|
|
477
|
-
return /* @__PURE__ */ e(
|
|
476
|
+
function we({ onClick: t }) {
|
|
477
|
+
return /* @__PURE__ */ e(ve, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(oe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
478
478
|
}
|
|
479
|
-
const
|
|
479
|
+
const ls = (t) => ({
|
|
480
480
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
481
|
-
(s) =>
|
|
481
|
+
(s) => he.previewIsLoaded(s) || he.previewIsLoading(s)
|
|
482
482
|
)
|
|
483
|
-
}),
|
|
483
|
+
}), as = ({
|
|
484
484
|
link: t,
|
|
485
485
|
onDismiss: s
|
|
486
486
|
}) => {
|
|
@@ -510,7 +510,7 @@ const ns = (t) => ({
|
|
|
510
510
|
},
|
|
511
511
|
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",
|
|
512
512
|
"aria-label": "Close link preview",
|
|
513
|
-
children: /* @__PURE__ */ e(
|
|
513
|
+
children: /* @__PURE__ */ e(oe, { className: "size-4 text-black/90" })
|
|
514
514
|
}
|
|
515
515
|
),
|
|
516
516
|
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
@@ -520,32 +520,32 @@ const ns = (t) => ({
|
|
|
520
520
|
]
|
|
521
521
|
}
|
|
522
522
|
);
|
|
523
|
-
},
|
|
524
|
-
const { linkPreviewsManager: t } =
|
|
523
|
+
}, os = () => {
|
|
524
|
+
const { linkPreviewsManager: t } = Oe(), { linkPreviews: s } = je(
|
|
525
525
|
t.state,
|
|
526
|
-
|
|
526
|
+
ls
|
|
527
527
|
), n = (a) => {
|
|
528
528
|
t.dismissPreview(a);
|
|
529
529
|
};
|
|
530
530
|
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(
|
|
531
|
-
|
|
531
|
+
as,
|
|
532
532
|
{
|
|
533
533
|
link: a,
|
|
534
534
|
onDismiss: n
|
|
535
535
|
},
|
|
536
536
|
a.og_scrape_url
|
|
537
537
|
)) }) : null;
|
|
538
|
-
},
|
|
539
|
-
const { handleSubmit: t } =
|
|
540
|
-
return /* @__PURE__ */ i(
|
|
541
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
538
|
+
}, is = () => {
|
|
539
|
+
const { handleSubmit: t } = Ae(), s = ze();
|
|
540
|
+
return /* @__PURE__ */ i(ge, { children: [
|
|
541
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e($e, {}) }),
|
|
542
542
|
/* @__PURE__ */ i("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: [
|
|
543
|
-
/* @__PURE__ */ e(
|
|
544
|
-
/* @__PURE__ */ e(
|
|
545
|
-
/* @__PURE__ */ e(
|
|
543
|
+
/* @__PURE__ */ e(Ge, {}),
|
|
544
|
+
/* @__PURE__ */ e(os, {}),
|
|
545
|
+
/* @__PURE__ */ e(He, {}),
|
|
546
546
|
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
547
547
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
548
|
-
|
|
548
|
+
Ve,
|
|
549
549
|
{
|
|
550
550
|
className: "w-full resize-none outline-none leading-6",
|
|
551
551
|
maxRows: 4
|
|
@@ -560,18 +560,18 @@ const ns = (t) => ({
|
|
|
560
560
|
disabled: !s,
|
|
561
561
|
onClick: t,
|
|
562
562
|
type: "button",
|
|
563
|
-
children: /* @__PURE__ */ e(
|
|
563
|
+
children: /* @__PURE__ */ e(Je, { className: "size-4" })
|
|
564
564
|
}
|
|
565
565
|
)
|
|
566
566
|
] })
|
|
567
567
|
] })
|
|
568
568
|
] });
|
|
569
|
-
},
|
|
569
|
+
}, cs = ({
|
|
570
570
|
renderActions: t
|
|
571
571
|
}) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
572
572
|
t && (t == null ? void 0 : t()),
|
|
573
|
-
/* @__PURE__ */ e(
|
|
574
|
-
] }),
|
|
573
|
+
/* @__PURE__ */ e(Be, { Input: is })
|
|
574
|
+
] }), ds = (t) => {
|
|
575
575
|
const s = t.message.hide_date === !0;
|
|
576
576
|
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
577
577
|
/* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
|
|
@@ -579,37 +579,39 @@ const ns = (t) => ({
|
|
|
579
579
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
580
580
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
581
581
|
] }),
|
|
582
|
-
!s && /* @__PURE__ */ e(
|
|
582
|
+
!s && /* @__PURE__ */ e(We, { message: t.message })
|
|
583
583
|
] });
|
|
584
|
-
},
|
|
585
|
-
var
|
|
586
|
-
const { channel: a } =
|
|
587
|
-
(
|
|
588
|
-
var
|
|
589
|
-
return ((
|
|
584
|
+
}, us = () => null, ms = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
585
|
+
var h, b, k, u, f;
|
|
586
|
+
const { channel: a } = xe(), o = L.useMemo(() => Object.values(a.state.members || {}).find(
|
|
587
|
+
(w) => {
|
|
588
|
+
var y;
|
|
589
|
+
return ((y = w.user) == null ? void 0 : y.id) && w.user.id !== a._client.userID;
|
|
590
590
|
}
|
|
591
|
-
), [a._client.userID, a.state.members]), l = ((
|
|
591
|
+
), [a._client.userID, a.state.members]), l = ((h = o == null ? void 0 : o.user) == null ? void 0 : h.name) || ((b = o == null ? void 0 : o.user) == null ? void 0 : b.id) || "Unknown member", d = (k = o == null ? void 0 : o.user) == null ? void 0 : k.image;
|
|
592
592
|
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
593
593
|
/* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
594
594
|
/* @__PURE__ */ e(
|
|
595
595
|
"button",
|
|
596
596
|
{
|
|
597
|
-
className:
|
|
597
|
+
className: R(
|
|
598
598
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
599
599
|
!s && "invisible"
|
|
600
600
|
),
|
|
601
601
|
onClick: t || (() => {
|
|
602
602
|
}),
|
|
603
|
-
|
|
603
|
+
type: "button",
|
|
604
|
+
"aria-label": "Back to conversations",
|
|
605
|
+
children: /* @__PURE__ */ e(ce, { className: "size-5 text-black/90" })
|
|
604
606
|
}
|
|
605
607
|
),
|
|
606
608
|
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
607
609
|
/* @__PURE__ */ e(
|
|
608
|
-
|
|
610
|
+
Z,
|
|
609
611
|
{
|
|
610
|
-
id: ((
|
|
612
|
+
id: ((u = o == null ? void 0 : o.user) == null ? void 0 : u.id) || a.id || "unknown",
|
|
611
613
|
name: l,
|
|
612
|
-
image:
|
|
614
|
+
image: d,
|
|
613
615
|
size: 40
|
|
614
616
|
}
|
|
615
617
|
),
|
|
@@ -618,12 +620,13 @@ const ns = (t) => ({
|
|
|
618
620
|
/* @__PURE__ */ e(
|
|
619
621
|
"button",
|
|
620
622
|
{
|
|
621
|
-
className:
|
|
623
|
+
className: R(
|
|
622
624
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
623
625
|
),
|
|
624
|
-
onClick: n
|
|
625
|
-
|
|
626
|
-
|
|
626
|
+
onClick: n,
|
|
627
|
+
type: "button",
|
|
628
|
+
"aria-label": "Show info",
|
|
629
|
+
children: /* @__PURE__ */ e(de, { className: "size-5 text-black/90" })
|
|
627
630
|
}
|
|
628
631
|
)
|
|
629
632
|
] }),
|
|
@@ -636,15 +639,15 @@ const ns = (t) => ({
|
|
|
636
639
|
onClick: t,
|
|
637
640
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
638
641
|
"aria-label": "Back to conversations",
|
|
639
|
-
children: /* @__PURE__ */ e(
|
|
642
|
+
children: /* @__PURE__ */ e(ce, { className: "size-5 text-black/90" })
|
|
640
643
|
}
|
|
641
644
|
),
|
|
642
645
|
/* @__PURE__ */ e(
|
|
643
|
-
|
|
646
|
+
Z,
|
|
644
647
|
{
|
|
645
648
|
id: ((f = o == null ? void 0 : o.user) == null ? void 0 : f.id) || a.id || "unknown",
|
|
646
649
|
name: l,
|
|
647
|
-
image:
|
|
650
|
+
image: d,
|
|
648
651
|
size: 40
|
|
649
652
|
}
|
|
650
653
|
),
|
|
@@ -653,17 +656,17 @@ const ns = (t) => ({
|
|
|
653
656
|
r && n && /* @__PURE__ */ e(
|
|
654
657
|
"button",
|
|
655
658
|
{
|
|
656
|
-
className:
|
|
659
|
+
className: R(
|
|
657
660
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
658
661
|
),
|
|
659
662
|
onClick: n,
|
|
660
|
-
children: /* @__PURE__ */ e(
|
|
663
|
+
children: /* @__PURE__ */ e(de, { className: "size-5 text-black/90" })
|
|
661
664
|
}
|
|
662
665
|
)
|
|
663
666
|
] })
|
|
664
667
|
] });
|
|
665
|
-
},
|
|
666
|
-
|
|
668
|
+
}, hs = ({
|
|
669
|
+
dialogRef: t,
|
|
667
670
|
onClose: s,
|
|
668
671
|
participant: n,
|
|
669
672
|
channel: r,
|
|
@@ -671,71 +674,66 @@ const ns = (t) => ({
|
|
|
671
674
|
onLeaveConversation: o,
|
|
672
675
|
onBlockParticipant: l
|
|
673
676
|
}) => {
|
|
674
|
-
var
|
|
675
|
-
const { service:
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
_ && (t ? _.showModal() : _.close());
|
|
679
|
-
}, [t]);
|
|
680
|
-
const E = M(async () => {
|
|
681
|
-
var _;
|
|
682
|
-
if (!(!c || !((_ = n == null ? void 0 : n.user) != null && _.id)))
|
|
677
|
+
var j, H, Y, re, O, V, q;
|
|
678
|
+
const { service: d, debug: h } = ne(), [b, k] = v(!1), [u, f] = v(!1), [g, w] = v(!1), y = _(async () => {
|
|
679
|
+
var D;
|
|
680
|
+
if (!(!d || !((D = n == null ? void 0 : n.user) != null && D.id)))
|
|
683
681
|
try {
|
|
684
|
-
const
|
|
685
|
-
(
|
|
686
|
-
var
|
|
687
|
-
return
|
|
682
|
+
const B = (await d.getBlockedUsers()).some(
|
|
683
|
+
($) => {
|
|
684
|
+
var J;
|
|
685
|
+
return $.blocked_user_id === ((J = n == null ? void 0 : n.user) == null ? void 0 : J.id);
|
|
688
686
|
}
|
|
689
687
|
);
|
|
690
|
-
|
|
691
|
-
} catch (
|
|
688
|
+
k(B);
|
|
689
|
+
} catch (M) {
|
|
692
690
|
console.error(
|
|
693
691
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
694
|
-
|
|
692
|
+
M
|
|
695
693
|
);
|
|
696
694
|
}
|
|
697
|
-
}, [
|
|
695
|
+
}, [d, (j = n == null ? void 0 : n.user) == null ? void 0 : j.id]);
|
|
698
696
|
G(() => {
|
|
699
|
-
|
|
700
|
-
}, [
|
|
701
|
-
const
|
|
702
|
-
var
|
|
703
|
-
if (!
|
|
704
|
-
|
|
697
|
+
y();
|
|
698
|
+
}, [y]);
|
|
699
|
+
const E = async () => {
|
|
700
|
+
var D;
|
|
701
|
+
if (!u) {
|
|
702
|
+
h && console.log("[ChannelInfoDialog] Leave conversation", r.cid), f(!0);
|
|
705
703
|
try {
|
|
706
|
-
const
|
|
707
|
-
await r.hide(
|
|
708
|
-
} catch (
|
|
709
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
704
|
+
const M = ((D = r._client) == null ? void 0 : D.userID) ?? null;
|
|
705
|
+
await r.hide(M, !1), o && await o(r), s();
|
|
706
|
+
} catch (M) {
|
|
707
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", M);
|
|
710
708
|
} finally {
|
|
711
|
-
|
|
709
|
+
f(!1);
|
|
712
710
|
}
|
|
713
711
|
}
|
|
714
|
-
},
|
|
715
|
-
var
|
|
716
|
-
if (!(
|
|
717
|
-
|
|
712
|
+
}, C = async () => {
|
|
713
|
+
var D, M, B;
|
|
714
|
+
if (!(g || !d)) {
|
|
715
|
+
h && console.log("[ChannelInfoDialog] Block member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), w(!0);
|
|
718
716
|
try {
|
|
719
|
-
await
|
|
720
|
-
} catch (
|
|
721
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
717
|
+
await d.blockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), l && await l((B = n == null ? void 0 : n.user) == null ? void 0 : B.id), s();
|
|
718
|
+
} catch ($) {
|
|
719
|
+
console.error("[ChannelInfoDialog] Failed to block member", $);
|
|
722
720
|
} finally {
|
|
723
721
|
w(!1);
|
|
724
722
|
}
|
|
725
723
|
}
|
|
726
|
-
},
|
|
727
|
-
var
|
|
728
|
-
if (!(
|
|
729
|
-
|
|
724
|
+
}, I = async () => {
|
|
725
|
+
var D, M, B;
|
|
726
|
+
if (!(g || !d)) {
|
|
727
|
+
h && console.log("[ChannelInfoDialog] Unblock member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), w(!0);
|
|
730
728
|
try {
|
|
731
|
-
await
|
|
732
|
-
} catch (
|
|
733
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
729
|
+
await d.unBlockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), l && await l((B = n == null ? void 0 : n.user) == null ? void 0 : B.id), s();
|
|
730
|
+
} catch ($) {
|
|
731
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", $);
|
|
734
732
|
} finally {
|
|
735
733
|
w(!1);
|
|
736
734
|
}
|
|
737
735
|
}
|
|
738
|
-
},
|
|
736
|
+
}, p = () => {
|
|
739
737
|
s(), window.open(
|
|
740
738
|
"https://linktr.ee/s/about/trust-center/report",
|
|
741
739
|
"_blank",
|
|
@@ -743,22 +741,22 @@ const ns = (t) => ({
|
|
|
743
741
|
);
|
|
744
742
|
};
|
|
745
743
|
if (!n) return null;
|
|
746
|
-
const
|
|
744
|
+
const S = ((H = n.user) == null ? void 0 : H.name) || ((Y = n.user) == null ? void 0 : Y.id) || "Unknown member", P = (re = n.user) == null ? void 0 : re.image, c = (O = n.user) == null ? void 0 : O.email, m = (V = n.user) == null ? void 0 : V.username, N = c || (m ? `linktr.ee/${m}` : void 0), A = ((q = n.user) == null ? void 0 : q.id) || "unknown";
|
|
747
745
|
return (
|
|
748
746
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
749
747
|
/* @__PURE__ */ e(
|
|
750
748
|
"dialog",
|
|
751
749
|
{
|
|
752
|
-
ref:
|
|
750
|
+
ref: t,
|
|
753
751
|
className: "mes-dialog group",
|
|
754
752
|
onClose: s,
|
|
755
|
-
onClick: (
|
|
756
|
-
|
|
753
|
+
onClick: (D) => {
|
|
754
|
+
D.target === t.current && s();
|
|
757
755
|
},
|
|
758
756
|
children: /* @__PURE__ */ i("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: [
|
|
759
757
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
760
758
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
761
|
-
/* @__PURE__ */ e(
|
|
759
|
+
/* @__PURE__ */ e(we, { onClick: s })
|
|
762
760
|
] }),
|
|
763
761
|
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
764
762
|
/* @__PURE__ */ e(
|
|
@@ -768,18 +766,18 @@ const ns = (t) => ({
|
|
|
768
766
|
style: { backgroundColor: "#FBFAF9" },
|
|
769
767
|
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
770
768
|
/* @__PURE__ */ e(
|
|
771
|
-
|
|
769
|
+
Z,
|
|
772
770
|
{
|
|
773
|
-
id:
|
|
774
|
-
name:
|
|
775
|
-
image:
|
|
771
|
+
id: A,
|
|
772
|
+
name: S,
|
|
773
|
+
image: P,
|
|
776
774
|
size: 88,
|
|
777
775
|
shape: "circle"
|
|
778
776
|
}
|
|
779
777
|
),
|
|
780
778
|
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
781
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
782
|
-
|
|
779
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: S }),
|
|
780
|
+
N && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: N }),
|
|
783
781
|
a && /* @__PURE__ */ e(
|
|
784
782
|
"span",
|
|
785
783
|
{
|
|
@@ -802,40 +800,40 @@ const ns = (t) => ({
|
|
|
802
800
|
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
803
801
|
ee,
|
|
804
802
|
{
|
|
805
|
-
onClick:
|
|
806
|
-
disabled:
|
|
807
|
-
"aria-busy":
|
|
803
|
+
onClick: E,
|
|
804
|
+
disabled: u,
|
|
805
|
+
"aria-busy": u,
|
|
808
806
|
children: [
|
|
809
|
-
|
|
807
|
+
u ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Qe, { className: "h-5 w-5" }),
|
|
810
808
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
811
809
|
]
|
|
812
810
|
}
|
|
813
811
|
) }),
|
|
814
|
-
/* @__PURE__ */ e("li", { children:
|
|
812
|
+
/* @__PURE__ */ e("li", { children: b ? /* @__PURE__ */ i(
|
|
815
813
|
ee,
|
|
816
814
|
{
|
|
817
|
-
onClick:
|
|
818
|
-
disabled:
|
|
819
|
-
"aria-busy":
|
|
815
|
+
onClick: I,
|
|
816
|
+
disabled: g,
|
|
817
|
+
"aria-busy": g,
|
|
820
818
|
children: [
|
|
821
|
-
|
|
819
|
+
g ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ue, { className: "h-5 w-5" }),
|
|
822
820
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
823
821
|
]
|
|
824
822
|
}
|
|
825
823
|
) : /* @__PURE__ */ i(
|
|
826
824
|
ee,
|
|
827
825
|
{
|
|
828
|
-
onClick:
|
|
829
|
-
disabled:
|
|
830
|
-
"aria-busy":
|
|
826
|
+
onClick: C,
|
|
827
|
+
disabled: g,
|
|
828
|
+
"aria-busy": g,
|
|
831
829
|
children: [
|
|
832
|
-
|
|
830
|
+
g ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ue, { className: "h-5 w-5" }),
|
|
833
831
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
834
832
|
]
|
|
835
833
|
}
|
|
836
834
|
) }),
|
|
837
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ee, { variant: "danger", onClick:
|
|
838
|
-
/* @__PURE__ */ e(
|
|
835
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ee, { variant: "danger", onClick: p, children: [
|
|
836
|
+
/* @__PURE__ */ e(Xe, { className: "h-5 w-5" }),
|
|
839
837
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
840
838
|
] }) })
|
|
841
839
|
] })
|
|
@@ -844,38 +842,44 @@ const ns = (t) => ({
|
|
|
844
842
|
}
|
|
845
843
|
)
|
|
846
844
|
);
|
|
847
|
-
},
|
|
845
|
+
}, fs = ({
|
|
848
846
|
onBack: t,
|
|
849
847
|
showBackButton: s,
|
|
850
848
|
renderMessageInputActions: n,
|
|
851
849
|
onLeaveConversation: r,
|
|
852
850
|
onBlockParticipant: a
|
|
853
851
|
}) => {
|
|
854
|
-
const { channel: o } =
|
|
855
|
-
(
|
|
856
|
-
var
|
|
857
|
-
return ((
|
|
852
|
+
const { channel: o } = xe(), l = z(null), d = L.useMemo(() => Object.values(o.state.members || {}).find(
|
|
853
|
+
(f) => {
|
|
854
|
+
var g;
|
|
855
|
+
return ((g = f.user) == null ? void 0 : g.id) && f.user.id !== o._client.userID;
|
|
858
856
|
}
|
|
859
|
-
), [o._client.userID, o.state.members]),
|
|
860
|
-
const
|
|
861
|
-
if (
|
|
862
|
-
return String(
|
|
863
|
-
if (
|
|
864
|
-
return
|
|
865
|
-
}, [o.data])
|
|
866
|
-
|
|
867
|
-
|
|
857
|
+
), [o._client.userID, o.state.members]), h = L.useMemo(() => {
|
|
858
|
+
const u = o.data ?? {};
|
|
859
|
+
if (u.followerStatus)
|
|
860
|
+
return String(u.followerStatus);
|
|
861
|
+
if (u.isFollower !== void 0)
|
|
862
|
+
return u.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
863
|
+
}, [o.data]), b = _(() => {
|
|
864
|
+
var u;
|
|
865
|
+
(u = l.current) == null || u.showModal();
|
|
866
|
+
}, []), k = _(() => {
|
|
867
|
+
var u;
|
|
868
|
+
(u = l.current) == null || u.close();
|
|
869
|
+
}, []);
|
|
870
|
+
return /* @__PURE__ */ i(ge, { children: [
|
|
871
|
+
/* @__PURE__ */ i(qe, { children: [
|
|
868
872
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
869
|
-
|
|
873
|
+
ms,
|
|
870
874
|
{
|
|
871
875
|
onBack: t,
|
|
872
876
|
showBackButton: s,
|
|
873
|
-
onShowInfo:
|
|
874
|
-
canShowInfo: !!
|
|
877
|
+
onShowInfo: b,
|
|
878
|
+
canShowInfo: !!d
|
|
875
879
|
}
|
|
876
880
|
) }),
|
|
877
881
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
878
|
-
|
|
882
|
+
Ye,
|
|
879
883
|
{
|
|
880
884
|
hideDeletedMessages: !0,
|
|
881
885
|
hideNewMessageSeparator: !1,
|
|
@@ -883,26 +887,26 @@ const ns = (t) => ({
|
|
|
883
887
|
}
|
|
884
888
|
) }),
|
|
885
889
|
/* @__PURE__ */ e(
|
|
886
|
-
|
|
890
|
+
cs,
|
|
887
891
|
{
|
|
888
892
|
renderActions: () => n == null ? void 0 : n(o)
|
|
889
893
|
}
|
|
890
894
|
)
|
|
891
895
|
] }),
|
|
892
896
|
/* @__PURE__ */ e(
|
|
893
|
-
|
|
897
|
+
hs,
|
|
894
898
|
{
|
|
895
|
-
|
|
896
|
-
onClose:
|
|
897
|
-
participant:
|
|
899
|
+
dialogRef: l,
|
|
900
|
+
onClose: k,
|
|
901
|
+
participant: d,
|
|
898
902
|
channel: o,
|
|
899
|
-
followerStatusLabel:
|
|
903
|
+
followerStatusLabel: h,
|
|
900
904
|
onLeaveConversation: r,
|
|
901
905
|
onBlockParticipant: a
|
|
902
906
|
}
|
|
903
907
|
)
|
|
904
908
|
] });
|
|
905
|
-
},
|
|
909
|
+
}, ye = L.memo(
|
|
906
910
|
({
|
|
907
911
|
channel: t,
|
|
908
912
|
onBack: s,
|
|
@@ -911,29 +915,29 @@ const ns = (t) => ({
|
|
|
911
915
|
onLeaveConversation: a,
|
|
912
916
|
onBlockParticipant: o,
|
|
913
917
|
className: l,
|
|
914
|
-
CustomChannelEmptyState:
|
|
918
|
+
CustomChannelEmptyState: d = us
|
|
915
919
|
}) => /* @__PURE__ */ e(
|
|
916
920
|
"div",
|
|
917
921
|
{
|
|
918
|
-
className:
|
|
922
|
+
className: R(
|
|
919
923
|
"messaging-channel-view h-full flex flex-col",
|
|
920
924
|
l
|
|
921
925
|
),
|
|
922
926
|
children: /* @__PURE__ */ e(
|
|
923
|
-
|
|
927
|
+
Ze,
|
|
924
928
|
{
|
|
925
929
|
channel: t,
|
|
926
|
-
MessageSystem:
|
|
927
|
-
EmptyStateIndicator:
|
|
930
|
+
MessageSystem: ds,
|
|
931
|
+
EmptyStateIndicator: d,
|
|
928
932
|
children: /* @__PURE__ */ e(
|
|
929
|
-
|
|
933
|
+
fs,
|
|
930
934
|
{
|
|
931
935
|
onBack: s,
|
|
932
936
|
showBackButton: n,
|
|
933
937
|
renderMessageInputActions: r,
|
|
934
938
|
onLeaveConversation: a,
|
|
935
939
|
onBlockParticipant: o,
|
|
936
|
-
CustomChannelEmptyState:
|
|
940
|
+
CustomChannelEmptyState: d
|
|
937
941
|
}
|
|
938
942
|
)
|
|
939
943
|
}
|
|
@@ -941,16 +945,16 @@ const ns = (t) => ({
|
|
|
941
945
|
}
|
|
942
946
|
)
|
|
943
947
|
);
|
|
944
|
-
|
|
945
|
-
function
|
|
948
|
+
ye.displayName = "ChannelView";
|
|
949
|
+
function gs({
|
|
946
950
|
searchQuery: t,
|
|
947
951
|
setSearchQuery: s,
|
|
948
952
|
placeholder: n
|
|
949
953
|
}) {
|
|
950
|
-
const r =
|
|
954
|
+
const r = z(null);
|
|
951
955
|
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
952
956
|
/* @__PURE__ */ e(
|
|
953
|
-
|
|
957
|
+
Ke,
|
|
954
958
|
{
|
|
955
959
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
956
960
|
weight: "bold"
|
|
@@ -968,7 +972,7 @@ function hs({
|
|
|
968
972
|
}
|
|
969
973
|
),
|
|
970
974
|
t && /* @__PURE__ */ e(
|
|
971
|
-
|
|
975
|
+
ve,
|
|
972
976
|
{
|
|
973
977
|
label: "Clear search",
|
|
974
978
|
onClick: () => {
|
|
@@ -976,12 +980,12 @@ function hs({
|
|
|
976
980
|
s(""), (a = r.current) == null || a.focus();
|
|
977
981
|
},
|
|
978
982
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
979
|
-
children: /* @__PURE__ */ e(
|
|
983
|
+
children: /* @__PURE__ */ e(oe, { className: "h-4 w-4", weight: "bold" })
|
|
980
984
|
}
|
|
981
985
|
)
|
|
982
986
|
] });
|
|
983
987
|
}
|
|
984
|
-
const
|
|
988
|
+
const xs = ({
|
|
985
989
|
participantSource: t,
|
|
986
990
|
onSelectParticipant: s,
|
|
987
991
|
onClose: n,
|
|
@@ -990,127 +994,127 @@ const fs = ({
|
|
|
990
994
|
searchPlaceholder: o = "Search participants...",
|
|
991
995
|
className: l
|
|
992
996
|
}) => {
|
|
993
|
-
const { debug:
|
|
997
|
+
const { debug: d } = ne(), [h, b] = v(""), [k, u] = v([]), [f, g] = v(!1), [w, y] = v(null), [E, C] = v(
|
|
994
998
|
null
|
|
995
|
-
), I =
|
|
999
|
+
), I = z(!1);
|
|
996
1000
|
G(() => {
|
|
997
1001
|
if (t.loading) {
|
|
998
|
-
|
|
1002
|
+
d && console.log(
|
|
999
1003
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1000
1004
|
);
|
|
1001
1005
|
return;
|
|
1002
1006
|
}
|
|
1003
1007
|
if (I.current) return;
|
|
1004
1008
|
(async () => {
|
|
1005
|
-
|
|
1009
|
+
d && console.log("[ParticipantPicker] Loading initial participants..."), g(!0), y(null);
|
|
1006
1010
|
try {
|
|
1007
|
-
const
|
|
1011
|
+
const m = await t.loadParticipants({
|
|
1008
1012
|
search: "",
|
|
1009
1013
|
// Load all participants initially
|
|
1010
1014
|
limit: 100
|
|
1011
1015
|
});
|
|
1012
|
-
|
|
1016
|
+
u(m.participants), I.current = !0, d && console.log(
|
|
1013
1017
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1014
|
-
|
|
1018
|
+
m.participants.length
|
|
1015
1019
|
);
|
|
1016
|
-
} catch (
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1020
|
+
} catch (m) {
|
|
1021
|
+
const N = m instanceof Error ? m.message : "Failed to load participants";
|
|
1022
|
+
y(N), console.error("[ParticipantPicker] Failed to load participants:", m);
|
|
1019
1023
|
} finally {
|
|
1020
|
-
|
|
1024
|
+
g(!1);
|
|
1021
1025
|
}
|
|
1022
1026
|
})();
|
|
1023
|
-
}, [t.loading,
|
|
1024
|
-
const
|
|
1025
|
-
var
|
|
1026
|
-
if (!
|
|
1027
|
-
const
|
|
1028
|
-
return
|
|
1029
|
-
}),
|
|
1030
|
-
async (
|
|
1027
|
+
}, [t.loading, d]);
|
|
1028
|
+
const p = k.filter((c) => !r.has(c.id)).filter((c) => {
|
|
1029
|
+
var N;
|
|
1030
|
+
if (!h) return !0;
|
|
1031
|
+
const m = h.toLowerCase();
|
|
1032
|
+
return c.name.toLowerCase().includes(m) || ((N = c.email) == null ? void 0 : N.toLowerCase().includes(m)) || !1;
|
|
1033
|
+
}), S = _(
|
|
1034
|
+
async (c) => {
|
|
1031
1035
|
if (!E) {
|
|
1032
|
-
|
|
1036
|
+
C(c.id);
|
|
1033
1037
|
try {
|
|
1034
|
-
await s(
|
|
1035
|
-
} catch (
|
|
1036
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1038
|
+
await s(c);
|
|
1039
|
+
} catch (m) {
|
|
1040
|
+
console.error("[ParticipantPicker] Failed to start chat:", m), C(null);
|
|
1037
1041
|
}
|
|
1038
1042
|
}
|
|
1039
1043
|
},
|
|
1040
1044
|
[s, E]
|
|
1041
|
-
),
|
|
1042
|
-
(
|
|
1045
|
+
), P = (c, m) => {
|
|
1046
|
+
(c.key === "Enter" || c.key === " ") && (c.preventDefault(), S(m));
|
|
1043
1047
|
};
|
|
1044
|
-
return /* @__PURE__ */ i("div", { className:
|
|
1048
|
+
return /* @__PURE__ */ i("div", { className: R("flex flex-col h-full", l), children: [
|
|
1045
1049
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1046
1050
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1047
1051
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1048
|
-
/* @__PURE__ */ e(
|
|
1052
|
+
/* @__PURE__ */ e(we, { onClick: n })
|
|
1049
1053
|
] }),
|
|
1050
1054
|
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1051
1055
|
"Select a ",
|
|
1052
1056
|
a.slice(0, -1),
|
|
1053
1057
|
" to start messaging (",
|
|
1054
|
-
|
|
1058
|
+
p.length,
|
|
1055
1059
|
" available)",
|
|
1056
1060
|
t.totalCount !== void 0 && ` โข ${t.totalCount} ${a} total`
|
|
1057
1061
|
] }),
|
|
1058
1062
|
/* @__PURE__ */ e(
|
|
1059
|
-
|
|
1063
|
+
gs,
|
|
1060
1064
|
{
|
|
1061
|
-
searchQuery:
|
|
1062
|
-
setSearchQuery:
|
|
1065
|
+
searchQuery: h,
|
|
1066
|
+
setSearchQuery: b,
|
|
1063
1067
|
placeholder: o
|
|
1064
1068
|
}
|
|
1065
1069
|
)
|
|
1066
1070
|
] }),
|
|
1067
|
-
|
|
1071
|
+
w && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1068
1072
|
"Error loading ",
|
|
1069
1073
|
a,
|
|
1070
1074
|
": ",
|
|
1071
|
-
|
|
1075
|
+
w
|
|
1072
1076
|
] }),
|
|
1073
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f &&
|
|
1077
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && p.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1074
1078
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1075
1079
|
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1076
1080
|
"Loading ",
|
|
1077
1081
|
a,
|
|
1078
1082
|
"..."
|
|
1079
1083
|
] })
|
|
1080
|
-
] }) }) :
|
|
1081
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
1082
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children:
|
|
1083
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children:
|
|
1084
|
+
] }) }) : p.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1085
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(me, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1086
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${a} found` : k.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
|
|
1087
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : k.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
|
|
1084
1088
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1085
|
-
|
|
1086
|
-
const
|
|
1089
|
+
p.map((c) => {
|
|
1090
|
+
const m = c.name || c.email || c.id, N = c.email && c.name ? c.email : c.phone;
|
|
1087
1091
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1088
1092
|
"button",
|
|
1089
1093
|
{
|
|
1090
1094
|
type: "button",
|
|
1091
|
-
onClick: () =>
|
|
1092
|
-
onKeyDown: (A) =>
|
|
1095
|
+
onClick: () => S(c),
|
|
1096
|
+
onKeyDown: (A) => P(A, c),
|
|
1093
1097
|
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",
|
|
1094
1098
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1095
1099
|
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1096
1100
|
/* @__PURE__ */ e(
|
|
1097
|
-
|
|
1101
|
+
Z,
|
|
1098
1102
|
{
|
|
1099
|
-
id:
|
|
1100
|
-
name:
|
|
1101
|
-
image:
|
|
1103
|
+
id: c.id,
|
|
1104
|
+
name: m,
|
|
1105
|
+
image: c.image,
|
|
1102
1106
|
size: 40
|
|
1103
1107
|
}
|
|
1104
1108
|
),
|
|
1105
1109
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1106
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1107
|
-
|
|
1110
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: m }),
|
|
1111
|
+
N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
|
|
1108
1112
|
] })
|
|
1109
1113
|
] }),
|
|
1110
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E ===
|
|
1114
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E === c.id ? /* @__PURE__ */ e(se, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(me, { className: "h-5 w-5 text-stone" }) })
|
|
1111
1115
|
] })
|
|
1112
1116
|
}
|
|
1113
|
-
) },
|
|
1117
|
+
) }, c.id);
|
|
1114
1118
|
}),
|
|
1115
1119
|
f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1116
1120
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
@@ -1118,7 +1122,7 @@ const fs = ({
|
|
|
1118
1122
|
] }) })
|
|
1119
1123
|
] }) })
|
|
1120
1124
|
] });
|
|
1121
|
-
},
|
|
1125
|
+
}, Cs = ({ className: t }) => /* @__PURE__ */ i(
|
|
1122
1126
|
"svg",
|
|
1123
1127
|
{
|
|
1124
1128
|
width: "140",
|
|
@@ -1252,16 +1256,16 @@ const fs = ({
|
|
|
1252
1256
|
] })
|
|
1253
1257
|
]
|
|
1254
1258
|
}
|
|
1255
|
-
),
|
|
1256
|
-
({ hasChannels: t }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
1257
|
-
/* @__PURE__ */ e(
|
|
1258
|
-
!t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1259
|
+
), Ee = L.memo(
|
|
1260
|
+
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
1261
|
+
/* @__PURE__ */ e(Cs, {}),
|
|
1262
|
+
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1259
1263
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1260
1264
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1261
1265
|
] })
|
|
1262
1266
|
] }) })
|
|
1263
1267
|
);
|
|
1264
|
-
|
|
1268
|
+
Ee.displayName = "EmptyState";
|
|
1265
1269
|
const te = L.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
|
|
1266
1270
|
/* @__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: "โ ๏ธ" }) }),
|
|
1267
1271
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
@@ -1277,10 +1281,10 @@ const te = L.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1277
1281
|
)
|
|
1278
1282
|
] }) }));
|
|
1279
1283
|
te.displayName = "ErrorState";
|
|
1280
|
-
const
|
|
1284
|
+
const Ns = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
1281
1285
|
"div",
|
|
1282
1286
|
{
|
|
1283
|
-
className:
|
|
1287
|
+
className: R("flex items-center justify-center h-full", t),
|
|
1284
1288
|
children: [
|
|
1285
1289
|
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1286
1290
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
@@ -1320,12 +1324,12 @@ const xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
|
1320
1324
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1321
1325
|
]
|
|
1322
1326
|
}
|
|
1323
|
-
),
|
|
1324
|
-
/* @__PURE__ */ e(
|
|
1327
|
+
), Ie = L.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
1328
|
+
/* @__PURE__ */ e(Ns, { className: "w-6 h-6" }),
|
|
1325
1329
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1326
1330
|
] }) }));
|
|
1327
|
-
|
|
1328
|
-
const
|
|
1331
|
+
Ie.displayName = "LoadingState";
|
|
1332
|
+
const Rs = ({
|
|
1329
1333
|
capabilities: t = {},
|
|
1330
1334
|
className: s,
|
|
1331
1335
|
renderMessageInputActions: n,
|
|
@@ -1333,101 +1337,101 @@ const Ss = ({
|
|
|
1333
1337
|
onParticipantSelect: a,
|
|
1334
1338
|
initialParticipantFilter: o,
|
|
1335
1339
|
initialParticipantData: l,
|
|
1336
|
-
CustomChannelEmptyState:
|
|
1337
|
-
showChannelList:
|
|
1338
|
-
filters:
|
|
1339
|
-
channelListCustomEmptyStateIndicator:
|
|
1340
|
+
CustomChannelEmptyState: d,
|
|
1341
|
+
showChannelList: h = !0,
|
|
1342
|
+
filters: b,
|
|
1343
|
+
channelListCustomEmptyStateIndicator: k
|
|
1340
1344
|
}) => {
|
|
1341
1345
|
const {
|
|
1342
|
-
service:
|
|
1346
|
+
service: u,
|
|
1343
1347
|
client: f,
|
|
1344
|
-
isConnected:
|
|
1345
|
-
isLoading:
|
|
1346
|
-
error:
|
|
1348
|
+
isConnected: g,
|
|
1349
|
+
isLoading: w,
|
|
1350
|
+
error: y,
|
|
1347
1351
|
refreshConnection: E,
|
|
1348
|
-
debug:
|
|
1349
|
-
} =
|
|
1350
|
-
const
|
|
1352
|
+
debug: C
|
|
1353
|
+
} = es(), [I, p] = v(null), [S, P] = v(!1), [c, m] = v(!1), [N, A] = v(!1), [j, H] = v(/* @__PURE__ */ new Set()), [Y, re] = v(0), [O, V] = v(!1), [q, D] = v(null), M = z(null), { participantSource: B, participantLabel: $ = "participants" } = t, J = L.useMemo(() => {
|
|
1354
|
+
const x = f == null ? void 0 : f.userID;
|
|
1351
1355
|
return {
|
|
1352
1356
|
...{
|
|
1353
1357
|
type: "messaging",
|
|
1354
1358
|
last_message_at: { $exists: !0 },
|
|
1355
|
-
...
|
|
1356
|
-
members: { $in: [
|
|
1359
|
+
...x && {
|
|
1360
|
+
members: { $in: [x] },
|
|
1357
1361
|
hidden: !1
|
|
1358
1362
|
}
|
|
1359
1363
|
},
|
|
1360
|
-
...
|
|
1364
|
+
...b
|
|
1361
1365
|
};
|
|
1362
|
-
}, [
|
|
1363
|
-
if (!f || !
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1366
|
+
}, [b, f == null ? void 0 : f.userID]), Q = z(null), W = _(async () => {
|
|
1367
|
+
if (!f || !g) return;
|
|
1368
|
+
const x = f.userID;
|
|
1369
|
+
if (x)
|
|
1366
1370
|
try {
|
|
1367
|
-
|
|
1368
|
-
const
|
|
1371
|
+
C && console.log("[MessagingShell] Syncing channels for user:", x);
|
|
1372
|
+
const U = await f.queryChannels(
|
|
1369
1373
|
{
|
|
1370
1374
|
type: "messaging",
|
|
1371
|
-
members: { $in: [
|
|
1375
|
+
members: { $in: [x] }
|
|
1372
1376
|
},
|
|
1373
1377
|
{},
|
|
1374
1378
|
{ limit: 100 }
|
|
1375
|
-
),
|
|
1376
|
-
|
|
1377
|
-
const
|
|
1378
|
-
Object.values(
|
|
1379
|
-
var
|
|
1380
|
-
const
|
|
1381
|
-
|
|
1379
|
+
), F = /* @__PURE__ */ new Set();
|
|
1380
|
+
U.forEach((T) => {
|
|
1381
|
+
const le = T.state.members;
|
|
1382
|
+
Object.values(le).forEach((Me) => {
|
|
1383
|
+
var ie;
|
|
1384
|
+
const ae = (ie = Me.user) == null ? void 0 : ie.id;
|
|
1385
|
+
ae && ae !== x && F.add(ae);
|
|
1382
1386
|
});
|
|
1383
|
-
}),
|
|
1384
|
-
channelCount:
|
|
1385
|
-
memberCount:
|
|
1387
|
+
}), H((T) => T.size === F.size && [...T].every((le) => F.has(le)) ? T : F), P(U.length > 0), m(!0), Q.current = x, C && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1388
|
+
channelCount: U.length,
|
|
1389
|
+
memberCount: F.size
|
|
1386
1390
|
});
|
|
1387
|
-
} catch (
|
|
1388
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1391
|
+
} catch (U) {
|
|
1392
|
+
console.error("[MessagingShell] Failed to sync channels:", U);
|
|
1389
1393
|
}
|
|
1390
|
-
}, [f,
|
|
1394
|
+
}, [f, g, C]);
|
|
1391
1395
|
G(() => {
|
|
1392
|
-
if (!f || !
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1395
|
-
}, [f,
|
|
1396
|
-
if (!o || !f || !
|
|
1396
|
+
if (!f || !g) return;
|
|
1397
|
+
const x = f.userID;
|
|
1398
|
+
x && Q.current !== x && W();
|
|
1399
|
+
}, [f, g, W]), G(() => {
|
|
1400
|
+
if (!o || !f || !g) return;
|
|
1397
1401
|
(async () => {
|
|
1398
|
-
const
|
|
1399
|
-
if (
|
|
1402
|
+
const U = f.userID;
|
|
1403
|
+
if (U)
|
|
1400
1404
|
try {
|
|
1401
|
-
|
|
1405
|
+
C && console.log(
|
|
1402
1406
|
"[MessagingShell] Loading initial conversation with:",
|
|
1403
1407
|
o
|
|
1404
1408
|
);
|
|
1405
|
-
const
|
|
1409
|
+
const F = await f.queryChannels(
|
|
1406
1410
|
{
|
|
1407
1411
|
type: "messaging",
|
|
1408
|
-
members: { $eq: [
|
|
1412
|
+
members: { $eq: [U, o] }
|
|
1409
1413
|
},
|
|
1410
1414
|
{},
|
|
1411
1415
|
{ limit: 1 }
|
|
1412
1416
|
);
|
|
1413
|
-
if (
|
|
1414
|
-
|
|
1417
|
+
if (F.length > 0)
|
|
1418
|
+
p(F[0]), V(!0), D(null), r && r(F[0]), C && console.log(
|
|
1415
1419
|
"[MessagingShell] Initial conversation loaded:",
|
|
1416
|
-
|
|
1420
|
+
F[0].id
|
|
1417
1421
|
);
|
|
1418
|
-
else if (l &&
|
|
1419
|
-
|
|
1422
|
+
else if (l && u) {
|
|
1423
|
+
C && console.log(
|
|
1420
1424
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1421
1425
|
l
|
|
1422
1426
|
);
|
|
1423
1427
|
try {
|
|
1424
|
-
const T = await
|
|
1428
|
+
const T = await u.startChannelWithParticipant({
|
|
1425
1429
|
id: l.id,
|
|
1426
1430
|
name: l.name,
|
|
1427
1431
|
email: l.email,
|
|
1428
1432
|
phone: l.phone
|
|
1429
1433
|
});
|
|
1430
|
-
|
|
1434
|
+
p(T), V(!0), D(null), r && r(T), C && console.log(
|
|
1431
1435
|
"[MessagingShell] Channel created and loaded:",
|
|
1432
1436
|
T.id
|
|
1433
1437
|
);
|
|
@@ -1435,93 +1439,93 @@ const Ss = ({
|
|
|
1435
1439
|
console.error(
|
|
1436
1440
|
"[MessagingShell] Failed to create conversation:",
|
|
1437
1441
|
T
|
|
1438
|
-
),
|
|
1442
|
+
), D("Failed to create conversation");
|
|
1439
1443
|
}
|
|
1440
1444
|
} else
|
|
1441
|
-
|
|
1445
|
+
D(
|
|
1442
1446
|
"No conversation found with this account"
|
|
1443
|
-
),
|
|
1447
|
+
), C && console.log(
|
|
1444
1448
|
"[MessagingShell] No conversation found for:",
|
|
1445
1449
|
o
|
|
1446
1450
|
);
|
|
1447
|
-
} catch (
|
|
1451
|
+
} catch (F) {
|
|
1448
1452
|
console.error(
|
|
1449
1453
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1450
|
-
|
|
1451
|
-
),
|
|
1454
|
+
F
|
|
1455
|
+
), D("Failed to load conversation");
|
|
1452
1456
|
}
|
|
1453
1457
|
})();
|
|
1454
1458
|
}, [
|
|
1455
1459
|
o,
|
|
1456
1460
|
l,
|
|
1457
1461
|
f,
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1462
|
+
g,
|
|
1463
|
+
u,
|
|
1464
|
+
C,
|
|
1461
1465
|
r
|
|
1462
1466
|
]);
|
|
1463
|
-
const
|
|
1464
|
-
(
|
|
1465
|
-
|
|
1467
|
+
const pe = _(
|
|
1468
|
+
(x) => {
|
|
1469
|
+
p(x), r == null || r(x);
|
|
1466
1470
|
},
|
|
1467
1471
|
[r]
|
|
1468
|
-
),
|
|
1469
|
-
|
|
1470
|
-
}, [
|
|
1471
|
-
async (
|
|
1472
|
-
var
|
|
1473
|
-
if (
|
|
1472
|
+
), ke = _(() => {
|
|
1473
|
+
O || p(null);
|
|
1474
|
+
}, [O]), Se = _(
|
|
1475
|
+
async (x) => {
|
|
1476
|
+
var U;
|
|
1477
|
+
if (u)
|
|
1474
1478
|
try {
|
|
1475
|
-
|
|
1479
|
+
C && console.log(
|
|
1476
1480
|
"[MessagingShell] Starting conversation with:",
|
|
1477
|
-
|
|
1481
|
+
x.id
|
|
1478
1482
|
);
|
|
1479
|
-
const
|
|
1480
|
-
id:
|
|
1481
|
-
name:
|
|
1482
|
-
email:
|
|
1483
|
-
phone:
|
|
1483
|
+
const F = await u.startChannelWithParticipant({
|
|
1484
|
+
id: x.id,
|
|
1485
|
+
name: x.name,
|
|
1486
|
+
email: x.email,
|
|
1487
|
+
phone: x.phone
|
|
1484
1488
|
});
|
|
1485
1489
|
try {
|
|
1486
|
-
await
|
|
1490
|
+
await F.show();
|
|
1487
1491
|
} catch (T) {
|
|
1488
1492
|
console.warn("[MessagingShell] Failed to unhide channel:", T);
|
|
1489
1493
|
}
|
|
1490
|
-
|
|
1491
|
-
} catch (
|
|
1492
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1494
|
+
p(F), A(!1), (U = M.current) == null || U.close(), a == null || a(x);
|
|
1495
|
+
} catch (F) {
|
|
1496
|
+
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
1493
1497
|
}
|
|
1494
1498
|
},
|
|
1495
|
-
[
|
|
1496
|
-
), X =
|
|
1497
|
-
var
|
|
1498
|
-
|
|
1499
|
-
}, []),
|
|
1500
|
-
(
|
|
1501
|
-
|
|
1499
|
+
[u, a, C]
|
|
1500
|
+
), X = _(() => {
|
|
1501
|
+
var x;
|
|
1502
|
+
A(!1), (x = M.current) == null || x.close();
|
|
1503
|
+
}, []), Re = _(
|
|
1504
|
+
(x) => {
|
|
1505
|
+
x.target === M.current && X();
|
|
1502
1506
|
},
|
|
1503
1507
|
[X]
|
|
1504
|
-
),
|
|
1505
|
-
async (
|
|
1506
|
-
|
|
1508
|
+
), De = _(
|
|
1509
|
+
async (x) => {
|
|
1510
|
+
C && console.log("[MessagingShell] Leaving conversation:", x.id), p(null), V(!1), Q.current = null, await W();
|
|
1507
1511
|
},
|
|
1508
|
-
[
|
|
1509
|
-
),
|
|
1510
|
-
async (
|
|
1511
|
-
|
|
1512
|
+
[W, C]
|
|
1513
|
+
), _e = _(
|
|
1514
|
+
async (x) => {
|
|
1515
|
+
C && console.log("[MessagingShell] Blocking participant:", x), p(null), V(!1), Q.current = null, await W();
|
|
1512
1516
|
},
|
|
1513
|
-
[
|
|
1517
|
+
[W, C]
|
|
1514
1518
|
), K = !!I;
|
|
1515
|
-
return
|
|
1519
|
+
return w ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ie, {}) }) : y ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(te, { message: y, onBack: E }) }) : !g || !f ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
|
|
1516
1520
|
te,
|
|
1517
1521
|
{
|
|
1518
1522
|
message: "Not connected to messaging service",
|
|
1519
1523
|
onBack: E
|
|
1520
1524
|
}
|
|
1521
|
-
) }) :
|
|
1525
|
+
) }) : q ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(te, { message: q }) }) : /* @__PURE__ */ i(
|
|
1522
1526
|
"div",
|
|
1523
1527
|
{
|
|
1524
|
-
className:
|
|
1528
|
+
className: R(
|
|
1525
1529
|
"messaging-shell h-full bg-background-secondary overflow-hidden",
|
|
1526
1530
|
s
|
|
1527
1531
|
),
|
|
@@ -1530,24 +1534,24 @@ const Ss = ({
|
|
|
1530
1534
|
/* @__PURE__ */ e(
|
|
1531
1535
|
"div",
|
|
1532
1536
|
{
|
|
1533
|
-
className:
|
|
1537
|
+
className: R(
|
|
1534
1538
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1535
1539
|
{
|
|
1536
1540
|
// Explicitly hidden via prop or in direct conversation mode
|
|
1537
|
-
"!hidden":
|
|
1541
|
+
"!hidden": h === !1 || O,
|
|
1538
1542
|
// Normal mode: hide on mobile when channel selected, show on desktop
|
|
1539
|
-
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]":
|
|
1543
|
+
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !O && K,
|
|
1540
1544
|
// Normal mode: show when no channel selected
|
|
1541
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl":
|
|
1545
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !O && !K
|
|
1542
1546
|
}
|
|
1543
1547
|
),
|
|
1544
1548
|
children: /* @__PURE__ */ e(
|
|
1545
|
-
|
|
1549
|
+
be,
|
|
1546
1550
|
{
|
|
1547
|
-
onChannelSelect:
|
|
1551
|
+
onChannelSelect: pe,
|
|
1548
1552
|
selectedChannel: I || void 0,
|
|
1549
|
-
filters:
|
|
1550
|
-
customEmptyStateIndicator:
|
|
1553
|
+
filters: J,
|
|
1554
|
+
customEmptyStateIndicator: k
|
|
1551
1555
|
}
|
|
1552
1556
|
)
|
|
1553
1557
|
}
|
|
@@ -1555,57 +1559,63 @@ const Ss = ({
|
|
|
1555
1559
|
/* @__PURE__ */ e(
|
|
1556
1560
|
"div",
|
|
1557
1561
|
{
|
|
1558
|
-
className:
|
|
1562
|
+
className: R(
|
|
1559
1563
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1560
1564
|
{
|
|
1561
1565
|
// In direct conversation mode, always show (full width)
|
|
1562
|
-
flex:
|
|
1566
|
+
flex: O || K,
|
|
1563
1567
|
// Normal mode: hide on mobile when no channel selected
|
|
1564
|
-
"hidden lg:flex": !
|
|
1568
|
+
"hidden lg:flex": !O && !K
|
|
1565
1569
|
}
|
|
1566
1570
|
),
|
|
1567
1571
|
children: I ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1568
|
-
|
|
1572
|
+
ye,
|
|
1569
1573
|
{
|
|
1570
1574
|
channel: I,
|
|
1571
|
-
onBack:
|
|
1572
|
-
showBackButton: !
|
|
1575
|
+
onBack: ke,
|
|
1576
|
+
showBackButton: !O,
|
|
1573
1577
|
renderMessageInputActions: n,
|
|
1574
|
-
onLeaveConversation:
|
|
1575
|
-
onBlockParticipant:
|
|
1576
|
-
CustomChannelEmptyState:
|
|
1578
|
+
onLeaveConversation: De,
|
|
1579
|
+
onBlockParticipant: _e,
|
|
1580
|
+
CustomChannelEmptyState: d
|
|
1577
1581
|
},
|
|
1578
1582
|
I.id
|
|
1579
|
-
) }) : /* @__PURE__ */ e(
|
|
1583
|
+
) }) : /* @__PURE__ */ e(
|
|
1584
|
+
Ee,
|
|
1585
|
+
{
|
|
1586
|
+
hasChannels: S,
|
|
1587
|
+
channelsLoaded: c
|
|
1588
|
+
}
|
|
1589
|
+
)
|
|
1580
1590
|
}
|
|
1581
1591
|
)
|
|
1582
1592
|
] }),
|
|
1583
|
-
|
|
1593
|
+
B && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1584
1594
|
/* @__PURE__ */ e(
|
|
1585
1595
|
"dialog",
|
|
1586
1596
|
{
|
|
1587
|
-
ref:
|
|
1597
|
+
ref: M,
|
|
1588
1598
|
className: "mes-dialog",
|
|
1589
|
-
onClick:
|
|
1599
|
+
onClick: Re,
|
|
1590
1600
|
onClose: X,
|
|
1591
1601
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1592
|
-
|
|
1602
|
+
xs,
|
|
1593
1603
|
{
|
|
1594
|
-
participantSource:
|
|
1595
|
-
onSelectParticipant:
|
|
1604
|
+
participantSource: B,
|
|
1605
|
+
onSelectParticipant: Se,
|
|
1596
1606
|
onClose: X,
|
|
1597
|
-
existingParticipantIds:
|
|
1598
|
-
participantLabel:
|
|
1599
|
-
searchPlaceholder: `Search ${
|
|
1607
|
+
existingParticipantIds: j,
|
|
1608
|
+
participantLabel: $,
|
|
1609
|
+
searchPlaceholder: `Search ${$}...`
|
|
1600
1610
|
},
|
|
1601
|
-
|
|
1611
|
+
Y
|
|
1602
1612
|
) })
|
|
1603
1613
|
}
|
|
1604
1614
|
)
|
|
1605
1615
|
]
|
|
1606
1616
|
}
|
|
1607
1617
|
);
|
|
1608
|
-
},
|
|
1618
|
+
}, bs = ({
|
|
1609
1619
|
question: t,
|
|
1610
1620
|
onClick: s,
|
|
1611
1621
|
loading: n = !1,
|
|
@@ -1617,7 +1627,7 @@ const Ss = ({
|
|
|
1617
1627
|
onClick: s,
|
|
1618
1628
|
disabled: n,
|
|
1619
1629
|
style: { backgroundColor: "#E6E5E3" },
|
|
1620
|
-
className:
|
|
1630
|
+
className: R(
|
|
1621
1631
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1622
1632
|
{
|
|
1623
1633
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1627,7 +1637,7 @@ const Ss = ({
|
|
|
1627
1637
|
),
|
|
1628
1638
|
children: t
|
|
1629
1639
|
}
|
|
1630
|
-
),
|
|
1640
|
+
), Ds = ({
|
|
1631
1641
|
faqs: t,
|
|
1632
1642
|
onFaqClick: s,
|
|
1633
1643
|
loadingFaqId: n,
|
|
@@ -1636,10 +1646,10 @@ const Ss = ({
|
|
|
1636
1646
|
avatarImage: o,
|
|
1637
1647
|
avatarName: l
|
|
1638
1648
|
}) => {
|
|
1639
|
-
const
|
|
1640
|
-
return
|
|
1649
|
+
const d = t.filter((h) => h.enabled).sort((h, b) => (h.order ?? 0) - (b.order ?? 0));
|
|
1650
|
+
return d.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1641
1651
|
(o || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1642
|
-
|
|
1652
|
+
Z,
|
|
1643
1653
|
{
|
|
1644
1654
|
id: l || "account",
|
|
1645
1655
|
name: l || "Account",
|
|
@@ -1655,72 +1665,72 @@ const Ss = ({
|
|
|
1655
1665
|
style: { backgroundColor: "#F1F0EE" },
|
|
1656
1666
|
children: [
|
|
1657
1667
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1658
|
-
|
|
1659
|
-
|
|
1668
|
+
d.map((h) => /* @__PURE__ */ e(
|
|
1669
|
+
bs,
|
|
1660
1670
|
{
|
|
1661
|
-
question:
|
|
1662
|
-
onClick: () => s(
|
|
1663
|
-
loading: n ===
|
|
1671
|
+
question: h.question,
|
|
1672
|
+
onClick: () => s(h.id),
|
|
1673
|
+
loading: n === h.id
|
|
1664
1674
|
},
|
|
1665
|
-
|
|
1675
|
+
h.id
|
|
1666
1676
|
))
|
|
1667
1677
|
]
|
|
1668
1678
|
}
|
|
1669
1679
|
)
|
|
1670
1680
|
] }) });
|
|
1671
|
-
},
|
|
1672
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, o] = v([]), [l,
|
|
1681
|
+
}, _s = (t, s = {}) => {
|
|
1682
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, o] = v([]), [l, d] = v(!1), [h, b] = v(null), [k, u] = v(n), [f, g] = v(!0), [w, y] = v(), E = _(async (S = !1, P) => {
|
|
1673
1683
|
if (l) return;
|
|
1674
|
-
const
|
|
1675
|
-
|
|
1684
|
+
const c = P !== void 0 ? P : k;
|
|
1685
|
+
d(!0), b(null);
|
|
1676
1686
|
try {
|
|
1677
|
-
const
|
|
1678
|
-
search:
|
|
1687
|
+
const m = await t.loadParticipants({
|
|
1688
|
+
search: c || void 0,
|
|
1679
1689
|
limit: r,
|
|
1680
|
-
cursor:
|
|
1690
|
+
cursor: S ? void 0 : w
|
|
1681
1691
|
});
|
|
1682
1692
|
o(
|
|
1683
|
-
(
|
|
1684
|
-
),
|
|
1685
|
-
} catch (
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1693
|
+
(N) => S ? m.participants : [...N, ...m.participants]
|
|
1694
|
+
), g(m.hasMore), y(m.nextCursor);
|
|
1695
|
+
} catch (m) {
|
|
1696
|
+
const N = m instanceof Error ? m.message : "Failed to load participants";
|
|
1697
|
+
b(N), console.error("[useParticipants] Load error:", m);
|
|
1688
1698
|
} finally {
|
|
1689
|
-
|
|
1699
|
+
d(!1);
|
|
1690
1700
|
}
|
|
1691
|
-
}, [t,
|
|
1701
|
+
}, [t, k, w, r, l]), C = _(() => {
|
|
1692
1702
|
f && !l && E(!1);
|
|
1693
|
-
}, [f, l, E]), I =
|
|
1694
|
-
|
|
1695
|
-
}, [E]),
|
|
1696
|
-
|
|
1703
|
+
}, [f, l, E]), I = _((S) => {
|
|
1704
|
+
u(S), y(void 0), E(!0, S);
|
|
1705
|
+
}, [E]), p = _(() => {
|
|
1706
|
+
y(void 0), E(!0);
|
|
1697
1707
|
}, [E]);
|
|
1698
1708
|
return G(() => {
|
|
1699
1709
|
E(!0);
|
|
1700
1710
|
}, [t.loadParticipants]), {
|
|
1701
1711
|
participants: a,
|
|
1702
1712
|
loading: l,
|
|
1703
|
-
error:
|
|
1704
|
-
searchQuery:
|
|
1713
|
+
error: h,
|
|
1714
|
+
searchQuery: k,
|
|
1705
1715
|
hasMore: f,
|
|
1706
1716
|
totalCount: t.totalCount,
|
|
1707
|
-
loadMore:
|
|
1717
|
+
loadMore: C,
|
|
1708
1718
|
search: I,
|
|
1709
|
-
refresh:
|
|
1719
|
+
refresh: p
|
|
1710
1720
|
};
|
|
1711
1721
|
};
|
|
1712
1722
|
export {
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1723
|
+
Z as Avatar,
|
|
1724
|
+
us as ChannelEmptyState,
|
|
1725
|
+
be as ChannelList,
|
|
1726
|
+
ye as ChannelView,
|
|
1727
|
+
Ds as FaqList,
|
|
1728
|
+
bs as FaqListItem,
|
|
1729
|
+
Ss as MessagingProvider,
|
|
1730
|
+
Rs as MessagingShell,
|
|
1731
|
+
xs as ParticipantPicker,
|
|
1732
|
+
ts as formatRelativeTime,
|
|
1733
|
+
es as useMessaging,
|
|
1734
|
+
_s as useParticipants
|
|
1725
1735
|
};
|
|
1726
1736
|
//# sourceMappingURL=index.js.map
|