@linktr.ee/messaging-react 1.12.2-rc-1765320995 โ 1.12.2-rc-1765340127
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.d.ts +1 -0
- package/dist/index.js +513 -501
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +7 -8
- package/src/components/MessagingShell/ChannelEmptyState.tsx +5 -1
- package/src/components/MessagingShell/LoadingState.tsx +10 -7
- package/src/components/MessagingShell/index.tsx +15 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as i, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as we } from "react/jsx-runtime";
|
|
2
|
+
import k from "classnames";
|
|
3
|
+
import O, { createContext as Ue, useContext as Pe, useCallback as _, useState as E, useRef as z, useEffect as $ } from "react";
|
|
4
4
|
import { StreamChatService as je } from "@linktr.ee/messaging-core";
|
|
5
|
-
import { Chat as Ae, ChannelList as ze, useMessageComposer as Be, useStateStore as
|
|
6
|
-
import { XIcon as ue, ArrowUpIcon as es,
|
|
7
|
-
import { LinkPreviewsManager as
|
|
8
|
-
const
|
|
5
|
+
import { Chat as Ae, ChannelList as ze, useMessageComposer as Be, useStateStore as Ge, MessageInput as $e, useMessageInputContext as He, useMessageComposerHasSendableData as Ve, SimpleAttachmentSelector as We, QuotedMessagePreview as Ze, AttachmentPreviewList as qe, TextareaComposer as Ye, MessageTimestamp as Je, Channel as Qe, useChannelStateContext as ve, Window as Xe, MessageList as Ke } from "stream-chat-react";
|
|
6
|
+
import { XIcon as ue, ArrowUpIcon as es, ArrowLeftIcon as fe, DotsThreeIcon as ge, SpinnerGapIcon as re, SignOutIcon as ss, ProhibitInsetIcon as xe, FlagIcon as ts, MagnifyingGlassIcon as ns, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
|
|
7
|
+
import { LinkPreviewsManager as Ce } from "stream-chat";
|
|
8
|
+
const ye = Ue({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,17 +15,17 @@ const we = Ue({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}),
|
|
18
|
+
}), oe = () => Pe(ye), _s = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
22
|
apiKey: r,
|
|
23
|
-
capabilities:
|
|
23
|
+
capabilities: o = {},
|
|
24
24
|
debug: d = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const l =
|
|
27
|
-
(u, ...
|
|
28
|
-
d && console.log(`๐ฅ [MessagingProvider] ${u}`, ...
|
|
26
|
+
const l = _(
|
|
27
|
+
(u, ...C) => {
|
|
28
|
+
d && console.log(`๐ฅ [MessagingProvider] ${u}`, ...C);
|
|
29
29
|
},
|
|
30
30
|
[d]
|
|
31
31
|
);
|
|
@@ -33,30 +33,30 @@ const we = Ue({
|
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
34
34
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
35
35
|
serviceConfig: !!n,
|
|
36
|
-
capabilities: Object.keys(
|
|
36
|
+
capabilities: Object.keys(o)
|
|
37
37
|
});
|
|
38
|
-
const [m, h] =
|
|
38
|
+
const [m, h] = E(null), [g, v] = E(null), [f, S] = E(!1), [R, w] = E(!1), [c, x] = E(null), y = z(!1), I = z({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
42
|
-
capabilities:
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
42
|
+
capabilities: o
|
|
43
|
+
}), M = z(0);
|
|
44
|
+
M.current++, l("๐ RENDER INFO", {
|
|
45
|
+
renderCount: M.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),
|
|
49
49
|
apiKeyChanged: I.current.apiKey !== r,
|
|
50
50
|
serviceConfigChanged: I.current.serviceConfig !== n,
|
|
51
|
-
capabilitiesChanged: I.current.capabilities !==
|
|
51
|
+
capabilitiesChanged: I.current.capabilities !== o
|
|
52
52
|
}
|
|
53
53
|
}), I.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
55
|
apiKey: r,
|
|
56
56
|
serviceConfig: n,
|
|
57
|
-
capabilities:
|
|
58
|
-
},
|
|
59
|
-
const u =
|
|
57
|
+
capabilities: o
|
|
58
|
+
}, $(() => {
|
|
59
|
+
const u = M.current;
|
|
60
60
|
if (l("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
61
|
renderCount: u,
|
|
62
62
|
apiKey: !!r,
|
|
@@ -79,40 +79,40 @@ const we = Ue({
|
|
|
79
79
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: I.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const C = new je({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: r,
|
|
85
85
|
debug: d
|
|
86
86
|
});
|
|
87
|
-
return h(
|
|
87
|
+
return h(C), l("โ
SERVICE SET", {
|
|
88
88
|
renderCount: u,
|
|
89
|
-
serviceInstance: !!
|
|
89
|
+
serviceInstance: !!C
|
|
90
90
|
}), () => {
|
|
91
91
|
l("๐งน SERVICE CLEANUP", {
|
|
92
92
|
renderCount: u,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
|
-
}),
|
|
94
|
+
}), C.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
96
|
}, [r, n, d, l]);
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
var
|
|
97
|
+
const N = z(null);
|
|
98
|
+
$(() => {
|
|
99
|
+
var C, B;
|
|
100
100
|
if (l("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
101
|
hasService: !!m,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
|
-
isConnecting:
|
|
104
|
+
isConnecting: y.current,
|
|
105
105
|
isConnected: f,
|
|
106
106
|
dependencies: { service: !!m, userId: s == null ? void 0 : s.id }
|
|
107
107
|
}), !m || !s) {
|
|
108
108
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
111
|
+
if (y.current) {
|
|
112
112
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((
|
|
115
|
+
if (((C = N.current) == null ? void 0 : C.serviceId) === m && ((B = N.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"
|
|
@@ -120,40 +120,40 @@ const we = Ue({
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
l("๐ STARTING USER CONNECTION", { userId: s.id }),
|
|
123
|
+
l("๐ STARTING USER CONNECTION", { userId: s.id }), y.current = !0, w(!0), x(null);
|
|
124
124
|
try {
|
|
125
125
|
l("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
126
|
const j = await m.connectUser(s);
|
|
127
|
-
|
|
127
|
+
v(j), S(!0), N.current = { serviceId: m, userId: s.id }, l("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: j.userID
|
|
130
130
|
});
|
|
131
131
|
} catch (j) {
|
|
132
|
-
const
|
|
133
|
-
|
|
132
|
+
const Z = j instanceof Error ? j.message : "Connection failed";
|
|
133
|
+
x(Z), l("โ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
|
-
error:
|
|
135
|
+
error: Z
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
w(!1), y.current = !1, l("๐ USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
isConnected: f
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [m, s, l, f]),
|
|
144
|
+
}, [m, s, l, f]), $(() => (l("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
145
|
hasService: !!m,
|
|
146
146
|
isConnected: f
|
|
147
147
|
}), () => {
|
|
148
148
|
m && f ? (l(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
151
|
+
), N.current = null, m.disconnectUser().catch(console.error)) : l("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
152
|
hasService: !!m,
|
|
153
153
|
isConnected: f
|
|
154
154
|
});
|
|
155
155
|
}), [m, f, l]);
|
|
156
|
-
const
|
|
156
|
+
const p = _(async () => {
|
|
157
157
|
if (l("๐ REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!m,
|
|
159
159
|
hasUser: !!s
|
|
@@ -161,52 +161,52 @@ const we = Ue({
|
|
|
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
166
|
l("๐ DISCONNECTING FOR REFRESH"), await m.disconnectUser(), l("๐ RECONNECTING FOR REFRESH");
|
|
167
167
|
const u = await m.connectUser(s);
|
|
168
|
-
|
|
168
|
+
v(u), S(!0), x(null), l("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
169
|
} catch (u) {
|
|
170
|
-
const
|
|
171
|
-
|
|
170
|
+
const C = u instanceof Error ? u.message : "Refresh failed";
|
|
171
|
+
x(C), l("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
|
-
error:
|
|
173
|
+
error: C
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
w(!1), l("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [m, s, l]),
|
|
178
|
+
}, [m, s, l]), a = O.useMemo(() => (l("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!m,
|
|
180
180
|
hasClient: !!g,
|
|
181
181
|
isConnected: f,
|
|
182
|
-
isLoading:
|
|
182
|
+
isLoading: R,
|
|
183
183
|
hasError: !!c,
|
|
184
|
-
capabilitiesKeys: Object.keys(
|
|
184
|
+
capabilitiesKeys: Object.keys(o)
|
|
185
185
|
}), {
|
|
186
186
|
service: m,
|
|
187
187
|
client: g,
|
|
188
188
|
isConnected: f,
|
|
189
|
-
isLoading:
|
|
189
|
+
isLoading: R,
|
|
190
190
|
error: c,
|
|
191
|
-
capabilities:
|
|
192
|
-
refreshConnection:
|
|
191
|
+
capabilities: o,
|
|
192
|
+
refreshConnection: p,
|
|
193
193
|
debug: d
|
|
194
194
|
}), [
|
|
195
195
|
m,
|
|
196
196
|
g,
|
|
197
197
|
f,
|
|
198
|
-
M,
|
|
199
|
-
c,
|
|
200
|
-
a,
|
|
201
198
|
R,
|
|
199
|
+
c,
|
|
200
|
+
o,
|
|
201
|
+
p,
|
|
202
202
|
d,
|
|
203
203
|
l
|
|
204
204
|
]);
|
|
205
205
|
return l("๐ RENDER END", {
|
|
206
|
-
renderCount:
|
|
206
|
+
renderCount: M.current,
|
|
207
207
|
willRenderChat: !!(g && f),
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(
|
|
208
|
+
contextValueReady: !!a
|
|
209
|
+
}), /* @__PURE__ */ e(ye.Provider, { value: a, children: g && f ? /* @__PURE__ */ e(
|
|
210
210
|
Ae,
|
|
211
211
|
{
|
|
212
212
|
client: g,
|
|
@@ -216,14 +216,14 @@ const we = Ue({
|
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
}, rs = () =>
|
|
219
|
+
}, rs = () => oe(), ls = (t, s) => {
|
|
220
220
|
const n = new Date(
|
|
221
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
222
|
-
),
|
|
222
|
+
), o = new Date(
|
|
223
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
224
224
|
).getTime() - n.getTime();
|
|
225
|
-
return Math.floor(
|
|
226
|
-
},
|
|
225
|
+
return Math.floor(o / (1e3 * 60 * 60 * 24));
|
|
226
|
+
}, os = (t) => {
|
|
227
227
|
const s = /* @__PURE__ */ new Date();
|
|
228
228
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
229
229
|
return "Just now";
|
|
@@ -264,7 +264,7 @@ const we = Ue({
|
|
|
264
264
|
"๐"
|
|
265
265
|
// Melon
|
|
266
266
|
];
|
|
267
|
-
function
|
|
267
|
+
function as(t) {
|
|
268
268
|
let s = 0;
|
|
269
269
|
for (let n = 0; n < t.length; n++) {
|
|
270
270
|
const r = t.charCodeAt(n);
|
|
@@ -273,24 +273,24 @@ function os(t) {
|
|
|
273
273
|
return Math.abs(s);
|
|
274
274
|
}
|
|
275
275
|
function is(t) {
|
|
276
|
-
const n =
|
|
276
|
+
const n = as(t) % be.length;
|
|
277
277
|
return be[n];
|
|
278
278
|
}
|
|
279
|
-
const
|
|
279
|
+
const Y = ({
|
|
280
280
|
id: t,
|
|
281
281
|
image: s,
|
|
282
282
|
size: n = 40,
|
|
283
283
|
className: r,
|
|
284
|
-
shape:
|
|
284
|
+
shape: o = "squircle"
|
|
285
285
|
}) => {
|
|
286
|
-
const d = is(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h =
|
|
286
|
+
const d = is(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = o === "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: k("flex-shrink-0 overflow-hidden", r),
|
|
294
294
|
style: {
|
|
295
295
|
width: `${n}px`,
|
|
296
296
|
height: `${n}px`,
|
|
@@ -307,7 +307,7 @@ const q = ({
|
|
|
307
307
|
"div",
|
|
308
308
|
{
|
|
309
309
|
"aria-hidden": "true",
|
|
310
|
-
className:
|
|
310
|
+
className: k(
|
|
311
311
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
312
312
|
m
|
|
313
313
|
),
|
|
@@ -316,34 +316,34 @@ const q = ({
|
|
|
316
316
|
)
|
|
317
317
|
}
|
|
318
318
|
);
|
|
319
|
-
},
|
|
320
|
-
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread:
|
|
321
|
-
var
|
|
319
|
+
}, Ee = O.memo(
|
|
320
|
+
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: o }) => {
|
|
321
|
+
var x, y, I, M, N, p;
|
|
322
322
|
const d = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
|
|
323
323
|
t && n(t);
|
|
324
|
-
}, h = Object.values(((
|
|
325
|
-
(
|
|
326
|
-
var u,
|
|
327
|
-
return ((u =
|
|
324
|
+
}, h = Object.values(((x = t == null ? void 0 : t.state) == null ? void 0 : x.members) || {}).find(
|
|
325
|
+
(a) => {
|
|
326
|
+
var u, C;
|
|
327
|
+
return ((u = a.user) == null ? void 0 : u.id) && a.user.id !== ((C = t == null ? void 0 : t._client) == null ? void 0 : C.userID);
|
|
328
328
|
}
|
|
329
|
-
), g = ((
|
|
329
|
+
), g = ((y = h == null ? void 0 : h.user) == null ? void 0 : y.name) || "Conversation", v = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, f = (N = (M = t == null ? void 0 : t.state) == null ? void 0 : M.messages) == null ? void 0 : N[t.state.messages.length - 1], R = (() => {
|
|
330
330
|
var u;
|
|
331
331
|
if (f != null && f.text) return f.text;
|
|
332
|
-
const
|
|
333
|
-
return
|
|
334
|
-
})(),
|
|
332
|
+
const a = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
|
|
333
|
+
return a != null && a.asset_url ? a.asset_url : a != null && a.image_url ? a.image_url : a != null && a.og_scrape_url ? a.og_scrape_url : a != null && a.thumb_url ? a.thumb_url : "No messages yet";
|
|
334
|
+
})(), w = f != null && f.created_at ? os(new Date(f.created_at)) : "", c = o ?? 0;
|
|
335
335
|
return r && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
336
336
|
channelId: t == null ? void 0 : t.id,
|
|
337
337
|
isSelected: d,
|
|
338
338
|
participantName: g,
|
|
339
339
|
unreadCount: c,
|
|
340
|
-
hasTimestamp: !!
|
|
340
|
+
hasTimestamp: !!w
|
|
341
341
|
}), /* @__PURE__ */ e(
|
|
342
342
|
"button",
|
|
343
343
|
{
|
|
344
344
|
type: "button",
|
|
345
345
|
onClick: l,
|
|
346
|
-
className:
|
|
346
|
+
className: k(
|
|
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": d,
|
|
@@ -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
|
+
Y,
|
|
356
356
|
{
|
|
357
|
-
id: ((
|
|
357
|
+
id: ((p = h == null ? void 0 : h.user) == null ? void 0 : p.id) || t.id || "unknown",
|
|
358
358
|
name: g,
|
|
359
|
-
image:
|
|
359
|
+
image: v,
|
|
360
360
|
size: 44,
|
|
361
361
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
362
362
|
}
|
|
@@ -366,17 +366,17 @@ const q = ({
|
|
|
366
366
|
/* @__PURE__ */ e(
|
|
367
367
|
"h3",
|
|
368
368
|
{
|
|
369
|
-
className:
|
|
369
|
+
className: k(
|
|
370
370
|
"text-sm font-medium truncate",
|
|
371
371
|
d ? "text-primary" : "text-charcoal"
|
|
372
372
|
),
|
|
373
373
|
children: g
|
|
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:
|
|
379
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: R }),
|
|
380
380
|
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 })
|
|
381
381
|
] })
|
|
382
382
|
] })
|
|
@@ -385,25 +385,25 @@ const q = ({
|
|
|
385
385
|
);
|
|
386
386
|
}
|
|
387
387
|
);
|
|
388
|
-
|
|
389
|
-
const
|
|
388
|
+
Ee.displayName = "CustomChannelPreview";
|
|
389
|
+
const Ie = O.memo(
|
|
390
390
|
({
|
|
391
391
|
onChannelSelect: t,
|
|
392
392
|
selectedChannel: s,
|
|
393
393
|
filters: n,
|
|
394
394
|
className: r,
|
|
395
|
-
customEmptyStateIndicator:
|
|
395
|
+
customEmptyStateIndicator: o
|
|
396
396
|
}) => {
|
|
397
|
-
const d =
|
|
397
|
+
const d = O.useRef(0);
|
|
398
398
|
d.current++;
|
|
399
|
-
const { debug: l = !1 } =
|
|
399
|
+
const { debug: l = !1 } = oe();
|
|
400
400
|
l && console.log("๐บ [ChannelList] ๐ RENDER START", {
|
|
401
401
|
renderCount: d.current,
|
|
402
402
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
403
403
|
filters: n
|
|
404
404
|
});
|
|
405
|
-
const m =
|
|
406
|
-
|
|
405
|
+
const m = O.useMemo(() => (g) => /* @__PURE__ */ e(
|
|
406
|
+
Ee,
|
|
407
407
|
{
|
|
408
408
|
...g,
|
|
409
409
|
selectedChannel: s,
|
|
@@ -414,7 +414,7 @@ const Ee = P.memo(
|
|
|
414
414
|
return /* @__PURE__ */ e(
|
|
415
415
|
"div",
|
|
416
416
|
{
|
|
417
|
-
className:
|
|
417
|
+
className: k(
|
|
418
418
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
419
419
|
r
|
|
420
420
|
),
|
|
@@ -425,7 +425,7 @@ const Ee = P.memo(
|
|
|
425
425
|
sort: { last_message_at: -1 },
|
|
426
426
|
options: { limit: 30 },
|
|
427
427
|
Preview: m,
|
|
428
|
-
EmptyStateIndicator:
|
|
428
|
+
EmptyStateIndicator: o
|
|
429
429
|
},
|
|
430
430
|
JSON.stringify(n)
|
|
431
431
|
) })
|
|
@@ -433,8 +433,8 @@ const Ee = P.memo(
|
|
|
433
433
|
);
|
|
434
434
|
}
|
|
435
435
|
);
|
|
436
|
-
|
|
437
|
-
const
|
|
436
|
+
Ie.displayName = "ChannelList";
|
|
437
|
+
const ne = ({
|
|
438
438
|
variant: t = "default",
|
|
439
439
|
className: s,
|
|
440
440
|
children: n,
|
|
@@ -443,7 +443,7 @@ const re = ({
|
|
|
443
443
|
"button",
|
|
444
444
|
{
|
|
445
445
|
type: "button",
|
|
446
|
-
className:
|
|
446
|
+
className: k(
|
|
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 re = ({
|
|
|
452
452
|
children: n
|
|
453
453
|
}
|
|
454
454
|
);
|
|
455
|
-
function
|
|
455
|
+
function Se({ 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: k(
|
|
461
461
|
"rounded-full p-2 transition-colors focus-ring",
|
|
462
462
|
{
|
|
463
463
|
"cursor-not-allowed opacity-50": r.disabled,
|
|
@@ -473,18 +473,18 @@ function Ie({ label: t, className: s, children: n, ...r }) {
|
|
|
473
473
|
}
|
|
474
474
|
);
|
|
475
475
|
}
|
|
476
|
-
function
|
|
477
|
-
return /* @__PURE__ */ e(
|
|
476
|
+
function pe({ onClick: t }) {
|
|
477
|
+
return /* @__PURE__ */ e(Se, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
478
478
|
}
|
|
479
479
|
const cs = (t) => ({
|
|
480
480
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
481
|
-
(s) =>
|
|
481
|
+
(s) => Ce.previewIsLoaded(s) || Ce.previewIsLoading(s)
|
|
482
482
|
)
|
|
483
483
|
}), ds = ({
|
|
484
484
|
link: t,
|
|
485
485
|
onDismiss: s
|
|
486
486
|
}) => {
|
|
487
|
-
const { og_scrape_url: n, title: r, image_url:
|
|
487
|
+
const { og_scrape_url: n, title: r, image_url: o } = t;
|
|
488
488
|
return /* @__PURE__ */ i(
|
|
489
489
|
"a",
|
|
490
490
|
{
|
|
@@ -493,10 +493,10 @@ const cs = (t) => ({
|
|
|
493
493
|
rel: "noopener noreferrer",
|
|
494
494
|
className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
|
|
495
495
|
children: [
|
|
496
|
-
|
|
496
|
+
o && /* @__PURE__ */ e(
|
|
497
497
|
"img",
|
|
498
498
|
{
|
|
499
|
-
src:
|
|
499
|
+
src: o,
|
|
500
500
|
alt: r || "",
|
|
501
501
|
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
502
502
|
}
|
|
@@ -521,23 +521,23 @@ const cs = (t) => ({
|
|
|
521
521
|
}
|
|
522
522
|
);
|
|
523
523
|
}, us = () => {
|
|
524
|
-
const { linkPreviewsManager: t } = Be(), { linkPreviews: s } =
|
|
524
|
+
const { linkPreviewsManager: t } = Be(), { linkPreviews: s } = Ge(
|
|
525
525
|
t.state,
|
|
526
526
|
cs
|
|
527
|
-
), n = (
|
|
528
|
-
t.dismissPreview(
|
|
527
|
+
), n = (o) => {
|
|
528
|
+
t.dismissPreview(o);
|
|
529
529
|
};
|
|
530
|
-
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((
|
|
530
|
+
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ e(
|
|
531
531
|
ds,
|
|
532
532
|
{
|
|
533
|
-
link:
|
|
533
|
+
link: o,
|
|
534
534
|
onDismiss: n
|
|
535
535
|
},
|
|
536
|
-
|
|
536
|
+
o.og_scrape_url
|
|
537
537
|
)) }) : null;
|
|
538
538
|
}, ms = () => {
|
|
539
539
|
const { handleSubmit: t } = He(), s = Ve();
|
|
540
|
-
return /* @__PURE__ */ i(
|
|
540
|
+
return /* @__PURE__ */ i(we, { children: [
|
|
541
541
|
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(We, {}) }),
|
|
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
543
|
/* @__PURE__ */ e(Ze, {}),
|
|
@@ -570,7 +570,7 @@ const cs = (t) => ({
|
|
|
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(
|
|
573
|
+
/* @__PURE__ */ e($e, { Input: ms })
|
|
574
574
|
] }), fs = (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: [
|
|
@@ -581,20 +581,68 @@ const cs = (t) => ({
|
|
|
581
581
|
] }),
|
|
582
582
|
!s && /* @__PURE__ */ e(Je, { message: t.message })
|
|
583
583
|
] });
|
|
584
|
-
}, gs = () => null, xs = ({
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
(
|
|
584
|
+
}, gs = () => (console.log("[ChannelEmptyState] render - returning NULL"), null), xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
585
|
+
"div",
|
|
586
|
+
{
|
|
587
|
+
className: k("flex items-center justify-center h-full", t),
|
|
588
|
+
children: [
|
|
589
|
+
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
590
|
+
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
591
|
+
"animateTransform",
|
|
592
|
+
{
|
|
593
|
+
attributeName: "transform",
|
|
594
|
+
dur: "1s",
|
|
595
|
+
type: "translate",
|
|
596
|
+
values: "0 15 ; 0 -15; 0 15",
|
|
597
|
+
repeatCount: "indefinite",
|
|
598
|
+
begin: "0.1"
|
|
599
|
+
}
|
|
600
|
+
) }),
|
|
601
|
+
/* @__PURE__ */ e("circle", { cx: "30", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
602
|
+
"animateTransform",
|
|
603
|
+
{
|
|
604
|
+
attributeName: "transform",
|
|
605
|
+
dur: "1s",
|
|
606
|
+
type: "translate",
|
|
607
|
+
values: "0 10 ; 0 -10; 0 10",
|
|
608
|
+
repeatCount: "indefinite",
|
|
609
|
+
begin: "0.2"
|
|
610
|
+
}
|
|
611
|
+
) }),
|
|
612
|
+
/* @__PURE__ */ e("circle", { cx: "54", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
613
|
+
"animateTransform",
|
|
614
|
+
{
|
|
615
|
+
attributeName: "transform",
|
|
616
|
+
dur: "1s",
|
|
617
|
+
type: "translate",
|
|
618
|
+
values: "0 5 ; 0 -5; 0 5",
|
|
619
|
+
repeatCount: "indefinite",
|
|
620
|
+
begin: "0.3"
|
|
621
|
+
}
|
|
622
|
+
) })
|
|
623
|
+
] }),
|
|
624
|
+
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
625
|
+
]
|
|
626
|
+
}
|
|
627
|
+
), me = O.memo(() => (console.log("[LoadingState] render - showing loading spinner"), /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
628
|
+
/* @__PURE__ */ e(xs, { className: "w-6 h-6" }),
|
|
629
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
630
|
+
] }) })));
|
|
631
|
+
me.displayName = "LoadingState";
|
|
632
|
+
const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
633
|
+
var h, g, v, f, S;
|
|
634
|
+
const { channel: o } = ve(), d = O.useMemo(() => Object.values(o.state.members || {}).find(
|
|
635
|
+
(w) => {
|
|
588
636
|
var c;
|
|
589
|
-
return ((c =
|
|
637
|
+
return ((c = w.user) == null ? void 0 : c.id) && w.user.id !== o._client.userID;
|
|
590
638
|
}
|
|
591
|
-
), [
|
|
639
|
+
), [o._client.userID, o.state.members]), l = ((h = d == null ? void 0 : d.user) == null ? void 0 : h.name) || ((g = d == null ? void 0 : d.user) == null ? void 0 : g.id) || "Unknown member", m = (v = d == null ? void 0 : d.user) == null ? void 0 : v.image;
|
|
592
640
|
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
593
641
|
/* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
594
642
|
/* @__PURE__ */ e(
|
|
595
643
|
"button",
|
|
596
644
|
{
|
|
597
|
-
className:
|
|
645
|
+
className: k(
|
|
598
646
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
599
647
|
!s && "invisible"
|
|
600
648
|
),
|
|
@@ -602,14 +650,14 @@ const cs = (t) => ({
|
|
|
602
650
|
}),
|
|
603
651
|
type: "button",
|
|
604
652
|
"aria-label": "Back to conversations",
|
|
605
|
-
children: /* @__PURE__ */ e(
|
|
653
|
+
children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
|
|
606
654
|
}
|
|
607
655
|
),
|
|
608
656
|
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
609
657
|
/* @__PURE__ */ e(
|
|
610
|
-
|
|
658
|
+
Y,
|
|
611
659
|
{
|
|
612
|
-
id: ((f = d == null ? void 0 : d.user) == null ? void 0 : f.id) ||
|
|
660
|
+
id: ((f = d == null ? void 0 : d.user) == null ? void 0 : f.id) || o.id || "unknown",
|
|
613
661
|
name: l,
|
|
614
662
|
image: m,
|
|
615
663
|
size: 40
|
|
@@ -620,13 +668,13 @@ const cs = (t) => ({
|
|
|
620
668
|
/* @__PURE__ */ e(
|
|
621
669
|
"button",
|
|
622
670
|
{
|
|
623
|
-
className:
|
|
671
|
+
className: k(
|
|
624
672
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
625
673
|
),
|
|
626
674
|
onClick: n,
|
|
627
675
|
type: "button",
|
|
628
676
|
"aria-label": "Show info",
|
|
629
|
-
children: /* @__PURE__ */ e(
|
|
677
|
+
children: /* @__PURE__ */ e(ge, { className: "size-5 text-black/90" })
|
|
630
678
|
}
|
|
631
679
|
)
|
|
632
680
|
] }),
|
|
@@ -639,13 +687,13 @@ const cs = (t) => ({
|
|
|
639
687
|
onClick: t,
|
|
640
688
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
641
689
|
"aria-label": "Back to conversations",
|
|
642
|
-
children: /* @__PURE__ */ e(
|
|
690
|
+
children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
|
|
643
691
|
}
|
|
644
692
|
),
|
|
645
693
|
/* @__PURE__ */ e(
|
|
646
|
-
|
|
694
|
+
Y,
|
|
647
695
|
{
|
|
648
|
-
id: ((S = d == null ? void 0 : d.user) == null ? void 0 : S.id) ||
|
|
696
|
+
id: ((S = d == null ? void 0 : d.user) == null ? void 0 : S.id) || o.id || "unknown",
|
|
649
697
|
name: l,
|
|
650
698
|
image: m,
|
|
651
699
|
size: 40
|
|
@@ -656,96 +704,96 @@ const cs = (t) => ({
|
|
|
656
704
|
r && n && /* @__PURE__ */ e(
|
|
657
705
|
"button",
|
|
658
706
|
{
|
|
659
|
-
className:
|
|
707
|
+
className: k(
|
|
660
708
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
661
709
|
),
|
|
662
710
|
onClick: n,
|
|
663
|
-
children: /* @__PURE__ */ e(
|
|
711
|
+
children: /* @__PURE__ */ e(ge, { className: "size-5 text-black/90" })
|
|
664
712
|
}
|
|
665
713
|
)
|
|
666
714
|
] })
|
|
667
715
|
] });
|
|
668
|
-
},
|
|
716
|
+
}, Cs = ({
|
|
669
717
|
dialogRef: t,
|
|
670
718
|
onClose: s,
|
|
671
719
|
participant: n,
|
|
672
720
|
channel: r,
|
|
673
|
-
followerStatusLabel:
|
|
721
|
+
followerStatusLabel: o,
|
|
674
722
|
onLeaveConversation: d,
|
|
675
723
|
onBlockParticipant: l,
|
|
676
724
|
showDeleteConversation: m = !0,
|
|
677
725
|
onDeleteConversationClick: h,
|
|
678
726
|
onBlockParticipantClick: g,
|
|
679
|
-
onReportParticipantClick:
|
|
727
|
+
onReportParticipantClick: v
|
|
680
728
|
}) => {
|
|
681
|
-
var
|
|
682
|
-
const { service: f, debug: S } =
|
|
683
|
-
var
|
|
684
|
-
if (!(!f || !((
|
|
729
|
+
var Q, X, ie, U, H, V, G;
|
|
730
|
+
const { service: f, debug: S } = oe(), [R, w] = E(!1), [c, x] = E(!1), [y, I] = E(!1), M = _(async () => {
|
|
731
|
+
var D;
|
|
732
|
+
if (!(!f || !((D = n == null ? void 0 : n.user) != null && D.id)))
|
|
685
733
|
try {
|
|
686
734
|
const A = (await f.getBlockedUsers()).some(
|
|
687
|
-
(
|
|
688
|
-
var
|
|
689
|
-
return
|
|
735
|
+
(W) => {
|
|
736
|
+
var K;
|
|
737
|
+
return W.blocked_user_id === ((K = n == null ? void 0 : n.user) == null ? void 0 : K.id);
|
|
690
738
|
}
|
|
691
739
|
);
|
|
692
|
-
|
|
740
|
+
w(A);
|
|
693
741
|
} catch (T) {
|
|
694
742
|
console.error(
|
|
695
743
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
696
744
|
T
|
|
697
745
|
);
|
|
698
746
|
}
|
|
699
|
-
}, [f, (
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
}, [
|
|
703
|
-
const
|
|
704
|
-
var
|
|
747
|
+
}, [f, (Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id]);
|
|
748
|
+
$(() => {
|
|
749
|
+
M();
|
|
750
|
+
}, [M]);
|
|
751
|
+
const N = async () => {
|
|
752
|
+
var D;
|
|
705
753
|
if (!c) {
|
|
706
|
-
h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid),
|
|
754
|
+
h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), x(!0);
|
|
707
755
|
try {
|
|
708
|
-
const T = ((
|
|
756
|
+
const T = ((D = r._client) == null ? void 0 : D.userID) ?? null;
|
|
709
757
|
await r.hide(T, !1), d && await d(r), s();
|
|
710
758
|
} catch (T) {
|
|
711
759
|
console.error("[ChannelInfoDialog] Failed to leave conversation", T);
|
|
712
760
|
} finally {
|
|
713
|
-
|
|
761
|
+
x(!1);
|
|
714
762
|
}
|
|
715
763
|
}
|
|
716
|
-
},
|
|
717
|
-
var
|
|
718
|
-
if (!(
|
|
719
|
-
g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (
|
|
764
|
+
}, p = async () => {
|
|
765
|
+
var D, T, A;
|
|
766
|
+
if (!(y || !f)) {
|
|
767
|
+
g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), I(!0);
|
|
720
768
|
try {
|
|
721
769
|
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();
|
|
722
|
-
} catch (
|
|
723
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
770
|
+
} catch (W) {
|
|
771
|
+
console.error("[ChannelInfoDialog] Failed to block member", W);
|
|
724
772
|
} finally {
|
|
725
773
|
I(!1);
|
|
726
774
|
}
|
|
727
775
|
}
|
|
728
|
-
},
|
|
729
|
-
var
|
|
730
|
-
if (!(
|
|
731
|
-
g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (
|
|
776
|
+
}, a = async () => {
|
|
777
|
+
var D, T, A;
|
|
778
|
+
if (!(y || !f)) {
|
|
779
|
+
g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), I(!0);
|
|
732
780
|
try {
|
|
733
781
|
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();
|
|
734
|
-
} catch (
|
|
735
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
782
|
+
} catch (W) {
|
|
783
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", W);
|
|
736
784
|
} finally {
|
|
737
785
|
I(!1);
|
|
738
786
|
}
|
|
739
787
|
}
|
|
740
788
|
}, u = () => {
|
|
741
|
-
|
|
789
|
+
v == null || v(), s(), window.open(
|
|
742
790
|
"https://linktr.ee/s/about/trust-center/report",
|
|
743
791
|
"_blank",
|
|
744
792
|
"noopener,noreferrer"
|
|
745
793
|
);
|
|
746
794
|
};
|
|
747
795
|
if (!n) return null;
|
|
748
|
-
const
|
|
796
|
+
const C = ((X = n.user) == null ? void 0 : X.name) || ((ie = n.user) == null ? void 0 : ie.id) || "Unknown member", B = (U = n.user) == null ? void 0 : U.image, j = (H = n.user) == null ? void 0 : H.email, Z = (V = n.user) == null ? void 0 : V.username, J = j || (Z ? `linktr.ee/${Z}` : void 0), ae = ((G = n.user) == null ? void 0 : G.id) || "unknown";
|
|
749
797
|
return (
|
|
750
798
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
751
799
|
/* @__PURE__ */ e(
|
|
@@ -754,13 +802,13 @@ const cs = (t) => ({
|
|
|
754
802
|
ref: t,
|
|
755
803
|
className: "mes-dialog group",
|
|
756
804
|
onClose: s,
|
|
757
|
-
onClick: (
|
|
758
|
-
|
|
805
|
+
onClick: (D) => {
|
|
806
|
+
D.target === t.current && s();
|
|
759
807
|
},
|
|
760
808
|
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: [
|
|
761
809
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
762
810
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
763
|
-
/* @__PURE__ */ e(
|
|
811
|
+
/* @__PURE__ */ e(pe, { onClick: s })
|
|
764
812
|
] }),
|
|
765
813
|
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
766
814
|
/* @__PURE__ */ e(
|
|
@@ -770,30 +818,30 @@ const cs = (t) => ({
|
|
|
770
818
|
style: { backgroundColor: "#FBFAF9" },
|
|
771
819
|
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
772
820
|
/* @__PURE__ */ e(
|
|
773
|
-
|
|
821
|
+
Y,
|
|
774
822
|
{
|
|
775
|
-
id:
|
|
776
|
-
name:
|
|
823
|
+
id: ae,
|
|
824
|
+
name: C,
|
|
777
825
|
image: B,
|
|
778
826
|
size: 88,
|
|
779
827
|
shape: "circle"
|
|
780
828
|
}
|
|
781
829
|
),
|
|
782
830
|
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
783
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
784
|
-
|
|
785
|
-
|
|
831
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: C }),
|
|
832
|
+
J && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: J }),
|
|
833
|
+
o && /* @__PURE__ */ e(
|
|
786
834
|
"span",
|
|
787
835
|
{
|
|
788
836
|
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
789
837
|
style: {
|
|
790
838
|
padding: "4px 8px",
|
|
791
|
-
backgroundColor:
|
|
792
|
-
color:
|
|
839
|
+
backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
|
|
840
|
+
color: o === "Subscribed to you" ? "#008236" : "#78716C",
|
|
793
841
|
lineHeight: "133.333%",
|
|
794
842
|
letterSpacing: "0.21px"
|
|
795
843
|
},
|
|
796
|
-
children:
|
|
844
|
+
children: o
|
|
797
845
|
}
|
|
798
846
|
)
|
|
799
847
|
] })
|
|
@@ -802,41 +850,41 @@ const cs = (t) => ({
|
|
|
802
850
|
),
|
|
803
851
|
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
804
852
|
m && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
805
|
-
|
|
853
|
+
ne,
|
|
806
854
|
{
|
|
807
|
-
onClick:
|
|
855
|
+
onClick: N,
|
|
808
856
|
disabled: c,
|
|
809
857
|
"aria-busy": c,
|
|
810
858
|
children: [
|
|
811
|
-
c ? /* @__PURE__ */ e(
|
|
859
|
+
c ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ss, { className: "h-5 w-5" }),
|
|
812
860
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
813
861
|
]
|
|
814
862
|
}
|
|
815
863
|
) }),
|
|
816
|
-
/* @__PURE__ */ e("li", { children:
|
|
817
|
-
|
|
864
|
+
/* @__PURE__ */ e("li", { children: R ? /* @__PURE__ */ i(
|
|
865
|
+
ne,
|
|
818
866
|
{
|
|
819
|
-
onClick:
|
|
820
|
-
disabled:
|
|
821
|
-
"aria-busy":
|
|
867
|
+
onClick: a,
|
|
868
|
+
disabled: y,
|
|
869
|
+
"aria-busy": y,
|
|
822
870
|
children: [
|
|
823
|
-
|
|
871
|
+
y ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
|
|
824
872
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
825
873
|
]
|
|
826
874
|
}
|
|
827
875
|
) : /* @__PURE__ */ i(
|
|
828
|
-
|
|
876
|
+
ne,
|
|
829
877
|
{
|
|
830
|
-
onClick:
|
|
831
|
-
disabled:
|
|
832
|
-
"aria-busy":
|
|
878
|
+
onClick: p,
|
|
879
|
+
disabled: y,
|
|
880
|
+
"aria-busy": y,
|
|
833
881
|
children: [
|
|
834
|
-
|
|
882
|
+
y ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
|
|
835
883
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
836
884
|
]
|
|
837
885
|
}
|
|
838
886
|
) }),
|
|
839
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
887
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ne, { variant: "danger", onClick: u, children: [
|
|
840
888
|
/* @__PURE__ */ e(ts, { className: "h-5 w-5" }),
|
|
841
889
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
842
890
|
] }) })
|
|
@@ -851,38 +899,38 @@ const cs = (t) => ({
|
|
|
851
899
|
showBackButton: s,
|
|
852
900
|
renderMessageInputActions: n,
|
|
853
901
|
onLeaveConversation: r,
|
|
854
|
-
onBlockParticipant:
|
|
902
|
+
onBlockParticipant: o,
|
|
855
903
|
showDeleteConversation: d = !0,
|
|
856
904
|
onDeleteConversationClick: l,
|
|
857
905
|
onBlockParticipantClick: m,
|
|
858
906
|
onReportParticipantClick: h
|
|
859
907
|
}) => {
|
|
860
|
-
const { channel: g } = ve(),
|
|
861
|
-
(
|
|
862
|
-
var
|
|
863
|
-
return ((
|
|
908
|
+
const { channel: g } = ve(), v = z(null), f = O.useMemo(() => Object.values(g.state.members || {}).find(
|
|
909
|
+
(x) => {
|
|
910
|
+
var y;
|
|
911
|
+
return ((y = x.user) == null ? void 0 : y.id) && x.user.id !== g._client.userID;
|
|
864
912
|
}
|
|
865
|
-
), [g._client.userID, g.state.members]), S =
|
|
913
|
+
), [g._client.userID, g.state.members]), S = O.useMemo(() => {
|
|
866
914
|
const c = g.data ?? {};
|
|
867
915
|
if (c.followerStatus)
|
|
868
916
|
return String(c.followerStatus);
|
|
869
917
|
if (c.isFollower !== void 0)
|
|
870
918
|
return c.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
871
|
-
}, [g.data]),
|
|
919
|
+
}, [g.data]), R = _(() => {
|
|
872
920
|
var c;
|
|
873
|
-
(c =
|
|
874
|
-
}, []),
|
|
921
|
+
(c = v.current) == null || c.showModal();
|
|
922
|
+
}, []), w = _(() => {
|
|
875
923
|
var c;
|
|
876
|
-
(c =
|
|
924
|
+
(c = v.current) == null || c.close();
|
|
877
925
|
}, []);
|
|
878
|
-
return /* @__PURE__ */ i(
|
|
926
|
+
return /* @__PURE__ */ i(we, { children: [
|
|
879
927
|
/* @__PURE__ */ i(Xe, { children: [
|
|
880
928
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
881
|
-
|
|
929
|
+
Ns,
|
|
882
930
|
{
|
|
883
931
|
onBack: t,
|
|
884
932
|
showBackButton: s,
|
|
885
|
-
onShowInfo:
|
|
933
|
+
onShowInfo: R,
|
|
886
934
|
canShowInfo: !!f
|
|
887
935
|
}
|
|
888
936
|
) }),
|
|
@@ -902,15 +950,15 @@ const cs = (t) => ({
|
|
|
902
950
|
)
|
|
903
951
|
] }),
|
|
904
952
|
/* @__PURE__ */ e(
|
|
905
|
-
|
|
953
|
+
Cs,
|
|
906
954
|
{
|
|
907
|
-
dialogRef:
|
|
908
|
-
onClose:
|
|
955
|
+
dialogRef: v,
|
|
956
|
+
onClose: w,
|
|
909
957
|
participant: f,
|
|
910
958
|
channel: g,
|
|
911
959
|
followerStatusLabel: S,
|
|
912
960
|
onLeaveConversation: r,
|
|
913
|
-
onBlockParticipant:
|
|
961
|
+
onBlockParticipant: o,
|
|
914
962
|
showDeleteConversation: d,
|
|
915
963
|
onDeleteConversationClick: l,
|
|
916
964
|
onBlockParticipantClick: m,
|
|
@@ -918,59 +966,63 @@ const cs = (t) => ({
|
|
|
918
966
|
}
|
|
919
967
|
)
|
|
920
968
|
] });
|
|
921
|
-
},
|
|
969
|
+
}, ke = O.memo(
|
|
922
970
|
({
|
|
923
971
|
channel: t,
|
|
924
972
|
onBack: s,
|
|
925
973
|
showBackButton: n = !1,
|
|
926
974
|
renderMessageInputActions: r,
|
|
927
|
-
onLeaveConversation:
|
|
975
|
+
onLeaveConversation: o,
|
|
928
976
|
onBlockParticipant: d,
|
|
929
977
|
className: l,
|
|
930
978
|
CustomChannelEmptyState: m = gs,
|
|
931
979
|
showDeleteConversation: h = !0,
|
|
932
980
|
onDeleteConversationClick: g,
|
|
933
|
-
onBlockParticipantClick:
|
|
981
|
+
onBlockParticipantClick: v,
|
|
934
982
|
onReportParticipantClick: f
|
|
935
|
-
}) =>
|
|
936
|
-
|
|
937
|
-
{
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
channel
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
983
|
+
}) => {
|
|
984
|
+
var S, R;
|
|
985
|
+
return console.log("[ChannelView] render", {
|
|
986
|
+
channelId: t.id,
|
|
987
|
+
channelInitialized: t.initialized,
|
|
988
|
+
messageCount: (R = (S = t.state) == null ? void 0 : S.messages) == null ? void 0 : R.length
|
|
989
|
+
}), /* @__PURE__ */ e(
|
|
990
|
+
"div",
|
|
991
|
+
{
|
|
992
|
+
className: k(
|
|
993
|
+
"messaging-channel-view h-full flex flex-col",
|
|
994
|
+
l
|
|
995
|
+
),
|
|
996
|
+
children: /* @__PURE__ */ e(
|
|
997
|
+
Qe,
|
|
998
|
+
{
|
|
999
|
+
channel: t,
|
|
1000
|
+
MessageSystem: fs,
|
|
1001
|
+
EmptyStateIndicator: m,
|
|
1002
|
+
LoadingIndicator: me,
|
|
1003
|
+
children: /* @__PURE__ */ e(
|
|
1004
|
+
bs,
|
|
1005
|
+
{
|
|
1006
|
+
onBack: s,
|
|
1007
|
+
showBackButton: n,
|
|
1008
|
+
renderMessageInputActions: r,
|
|
1009
|
+
onLeaveConversation: o,
|
|
1010
|
+
onBlockParticipant: d,
|
|
1011
|
+
CustomChannelEmptyState: m,
|
|
1012
|
+
showDeleteConversation: h,
|
|
1013
|
+
onDeleteConversationClick: g,
|
|
1014
|
+
onBlockParticipantClick: v,
|
|
1015
|
+
onReportParticipantClick: f
|
|
1016
|
+
}
|
|
1017
|
+
)
|
|
1018
|
+
}
|
|
1019
|
+
)
|
|
1020
|
+
}
|
|
1021
|
+
);
|
|
1022
|
+
}
|
|
971
1023
|
);
|
|
972
|
-
|
|
973
|
-
function
|
|
1024
|
+
ke.displayName = "ChannelView";
|
|
1025
|
+
function ws({
|
|
974
1026
|
searchQuery: t,
|
|
975
1027
|
setSearchQuery: s,
|
|
976
1028
|
placeholder: n
|
|
@@ -991,17 +1043,17 @@ function Cs({
|
|
|
991
1043
|
type: "text",
|
|
992
1044
|
placeholder: n,
|
|
993
1045
|
value: t,
|
|
994
|
-
onChange: (
|
|
1046
|
+
onChange: (o) => s(o.target.value),
|
|
995
1047
|
className: "w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent"
|
|
996
1048
|
}
|
|
997
1049
|
),
|
|
998
1050
|
t && /* @__PURE__ */ e(
|
|
999
|
-
|
|
1051
|
+
Se,
|
|
1000
1052
|
{
|
|
1001
1053
|
label: "Clear search",
|
|
1002
1054
|
onClick: () => {
|
|
1003
|
-
var
|
|
1004
|
-
s(""), (
|
|
1055
|
+
var o;
|
|
1056
|
+
s(""), (o = r.current) == null || o.focus();
|
|
1005
1057
|
},
|
|
1006
1058
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1007
1059
|
children: /* @__PURE__ */ e(ue, { className: "h-4 w-4", weight: "bold" })
|
|
@@ -1014,14 +1066,14 @@ const vs = ({
|
|
|
1014
1066
|
onSelectParticipant: s,
|
|
1015
1067
|
onClose: n,
|
|
1016
1068
|
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
1017
|
-
participantLabel:
|
|
1069
|
+
participantLabel: o = "participants",
|
|
1018
1070
|
searchPlaceholder: d = "Search participants...",
|
|
1019
1071
|
className: l
|
|
1020
1072
|
}) => {
|
|
1021
|
-
const { debug: m } =
|
|
1073
|
+
const { debug: m } = oe(), [h, g] = E(""), [v, f] = E([]), [S, R] = E(!1), [w, c] = E(null), [x, y] = E(
|
|
1022
1074
|
null
|
|
1023
1075
|
), I = z(!1);
|
|
1024
|
-
|
|
1076
|
+
$(() => {
|
|
1025
1077
|
if (t.loading) {
|
|
1026
1078
|
m && console.log(
|
|
1027
1079
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
@@ -1030,7 +1082,7 @@ const vs = ({
|
|
|
1030
1082
|
}
|
|
1031
1083
|
if (I.current) return;
|
|
1032
1084
|
(async () => {
|
|
1033
|
-
m && console.log("[ParticipantPicker] Loading initial participants..."),
|
|
1085
|
+
m && console.log("[ParticipantPicker] Loading initial participants..."), R(!0), c(null);
|
|
1034
1086
|
try {
|
|
1035
1087
|
const u = await t.loadParticipants({
|
|
1036
1088
|
search: "",
|
|
@@ -1042,49 +1094,49 @@ const vs = ({
|
|
|
1042
1094
|
u.participants.length
|
|
1043
1095
|
);
|
|
1044
1096
|
} catch (u) {
|
|
1045
|
-
const
|
|
1046
|
-
c(
|
|
1097
|
+
const C = u instanceof Error ? u.message : "Failed to load participants";
|
|
1098
|
+
c(C), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
1047
1099
|
} finally {
|
|
1048
|
-
|
|
1100
|
+
R(!1);
|
|
1049
1101
|
}
|
|
1050
1102
|
})();
|
|
1051
1103
|
}, [t.loading, m]);
|
|
1052
|
-
const
|
|
1053
|
-
var
|
|
1104
|
+
const M = v.filter((a) => !r.has(a.id)).filter((a) => {
|
|
1105
|
+
var C;
|
|
1054
1106
|
if (!h) return !0;
|
|
1055
1107
|
const u = h.toLowerCase();
|
|
1056
|
-
return
|
|
1057
|
-
}),
|
|
1058
|
-
async (
|
|
1059
|
-
if (!
|
|
1060
|
-
|
|
1108
|
+
return a.name.toLowerCase().includes(u) || ((C = a.email) == null ? void 0 : C.toLowerCase().includes(u)) || !1;
|
|
1109
|
+
}), N = _(
|
|
1110
|
+
async (a) => {
|
|
1111
|
+
if (!x) {
|
|
1112
|
+
y(a.id);
|
|
1061
1113
|
try {
|
|
1062
|
-
await s(
|
|
1114
|
+
await s(a);
|
|
1063
1115
|
} catch (u) {
|
|
1064
|
-
console.error("[ParticipantPicker] Failed to start chat:", u),
|
|
1116
|
+
console.error("[ParticipantPicker] Failed to start chat:", u), y(null);
|
|
1065
1117
|
}
|
|
1066
1118
|
}
|
|
1067
1119
|
},
|
|
1068
|
-
[s,
|
|
1069
|
-
),
|
|
1070
|
-
(
|
|
1120
|
+
[s, x]
|
|
1121
|
+
), p = (a, u) => {
|
|
1122
|
+
(a.key === "Enter" || a.key === " ") && (a.preventDefault(), N(u));
|
|
1071
1123
|
};
|
|
1072
|
-
return /* @__PURE__ */ i("div", { className:
|
|
1124
|
+
return /* @__PURE__ */ i("div", { className: k("flex flex-col h-full", l), children: [
|
|
1073
1125
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1074
1126
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1075
1127
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1076
|
-
/* @__PURE__ */ e(
|
|
1128
|
+
/* @__PURE__ */ e(pe, { onClick: n })
|
|
1077
1129
|
] }),
|
|
1078
1130
|
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1079
1131
|
"Select a ",
|
|
1080
|
-
|
|
1132
|
+
o.slice(0, -1),
|
|
1081
1133
|
" to start messaging (",
|
|
1082
|
-
|
|
1134
|
+
M.length,
|
|
1083
1135
|
" available)",
|
|
1084
|
-
t.totalCount !== void 0 && ` โข ${t.totalCount} ${
|
|
1136
|
+
t.totalCount !== void 0 && ` โข ${t.totalCount} ${o} total`
|
|
1085
1137
|
] }),
|
|
1086
1138
|
/* @__PURE__ */ e(
|
|
1087
|
-
|
|
1139
|
+
ws,
|
|
1088
1140
|
{
|
|
1089
1141
|
searchQuery: h,
|
|
1090
1142
|
setSearchQuery: g,
|
|
@@ -1092,53 +1144,53 @@ const vs = ({
|
|
|
1092
1144
|
}
|
|
1093
1145
|
)
|
|
1094
1146
|
] }),
|
|
1095
|
-
|
|
1147
|
+
w && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1096
1148
|
"Error loading ",
|
|
1097
|
-
|
|
1149
|
+
o,
|
|
1098
1150
|
": ",
|
|
1099
|
-
|
|
1151
|
+
w
|
|
1100
1152
|
] }),
|
|
1101
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S &&
|
|
1153
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S && M.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: [
|
|
1102
1154
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1103
1155
|
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1104
1156
|
"Loading ",
|
|
1105
|
-
|
|
1157
|
+
o,
|
|
1106
1158
|
"..."
|
|
1107
1159
|
] })
|
|
1108
|
-
] }) }) :
|
|
1109
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
1110
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${
|
|
1111
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" :
|
|
1160
|
+
] }) }) : M.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1161
|
+
/* @__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" }) }),
|
|
1162
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${o} found` : v.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
|
|
1163
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : v.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
|
|
1112
1164
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1113
|
-
|
|
1114
|
-
const u =
|
|
1165
|
+
M.map((a) => {
|
|
1166
|
+
const u = a.name || a.email || a.id, C = a.email && a.name ? a.email : a.phone;
|
|
1115
1167
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1116
1168
|
"button",
|
|
1117
1169
|
{
|
|
1118
1170
|
type: "button",
|
|
1119
|
-
onClick: () =>
|
|
1120
|
-
onKeyDown: (B) =>
|
|
1171
|
+
onClick: () => N(a),
|
|
1172
|
+
onKeyDown: (B) => p(B, a),
|
|
1121
1173
|
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",
|
|
1122
1174
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1123
1175
|
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1124
1176
|
/* @__PURE__ */ e(
|
|
1125
|
-
|
|
1177
|
+
Y,
|
|
1126
1178
|
{
|
|
1127
|
-
id:
|
|
1179
|
+
id: a.id,
|
|
1128
1180
|
name: u,
|
|
1129
|
-
image:
|
|
1181
|
+
image: a.image,
|
|
1130
1182
|
size: 40
|
|
1131
1183
|
}
|
|
1132
1184
|
),
|
|
1133
1185
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1134
1186
|
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
|
|
1135
|
-
|
|
1187
|
+
C && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: C })
|
|
1136
1188
|
] })
|
|
1137
1189
|
] }),
|
|
1138
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children:
|
|
1190
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: x === a.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
|
|
1139
1191
|
] })
|
|
1140
1192
|
}
|
|
1141
|
-
) },
|
|
1193
|
+
) }, a.id);
|
|
1142
1194
|
}),
|
|
1143
1195
|
S && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1144
1196
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
@@ -1146,7 +1198,7 @@ const vs = ({
|
|
|
1146
1198
|
] }) })
|
|
1147
1199
|
] }) })
|
|
1148
1200
|
] });
|
|
1149
|
-
},
|
|
1201
|
+
}, ys = ({ className: t }) => /* @__PURE__ */ i(
|
|
1150
1202
|
"svg",
|
|
1151
1203
|
{
|
|
1152
1204
|
width: "140",
|
|
@@ -1280,17 +1332,17 @@ const vs = ({
|
|
|
1280
1332
|
] })
|
|
1281
1333
|
]
|
|
1282
1334
|
}
|
|
1283
|
-
),
|
|
1335
|
+
), Re = O.memo(
|
|
1284
1336
|
({ 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: [
|
|
1285
|
-
/* @__PURE__ */ e(
|
|
1337
|
+
/* @__PURE__ */ e(ys, {}),
|
|
1286
1338
|
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1287
1339
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1288
1340
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1289
1341
|
] })
|
|
1290
1342
|
] }) })
|
|
1291
1343
|
);
|
|
1292
|
-
|
|
1293
|
-
const le =
|
|
1344
|
+
Re.displayName = "EmptyState";
|
|
1345
|
+
const le = O.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: [
|
|
1294
1346
|
/* @__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: "โ ๏ธ" }) }),
|
|
1295
1347
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1296
1348
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1305,164 +1357,116 @@ const le = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1305
1357
|
)
|
|
1306
1358
|
] }) }));
|
|
1307
1359
|
le.displayName = "ErrorState";
|
|
1308
|
-
const ys = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
1309
|
-
"div",
|
|
1310
|
-
{
|
|
1311
|
-
className: p("flex items-center justify-center h-full", t),
|
|
1312
|
-
children: [
|
|
1313
|
-
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1314
|
-
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1315
|
-
"animateTransform",
|
|
1316
|
-
{
|
|
1317
|
-
attributeName: "transform",
|
|
1318
|
-
dur: "1s",
|
|
1319
|
-
type: "translate",
|
|
1320
|
-
values: "0 15 ; 0 -15; 0 15",
|
|
1321
|
-
repeatCount: "indefinite",
|
|
1322
|
-
begin: "0.1"
|
|
1323
|
-
}
|
|
1324
|
-
) }),
|
|
1325
|
-
/* @__PURE__ */ e("circle", { cx: "30", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1326
|
-
"animateTransform",
|
|
1327
|
-
{
|
|
1328
|
-
attributeName: "transform",
|
|
1329
|
-
dur: "1s",
|
|
1330
|
-
type: "translate",
|
|
1331
|
-
values: "0 10 ; 0 -10; 0 10",
|
|
1332
|
-
repeatCount: "indefinite",
|
|
1333
|
-
begin: "0.2"
|
|
1334
|
-
}
|
|
1335
|
-
) }),
|
|
1336
|
-
/* @__PURE__ */ e("circle", { cx: "54", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1337
|
-
"animateTransform",
|
|
1338
|
-
{
|
|
1339
|
-
attributeName: "transform",
|
|
1340
|
-
dur: "1s",
|
|
1341
|
-
type: "translate",
|
|
1342
|
-
values: "0 5 ; 0 -5; 0 5",
|
|
1343
|
-
repeatCount: "indefinite",
|
|
1344
|
-
begin: "0.3"
|
|
1345
|
-
}
|
|
1346
|
-
) })
|
|
1347
|
-
] }),
|
|
1348
|
-
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1349
|
-
]
|
|
1350
|
-
}
|
|
1351
|
-
), Re = P.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
1352
|
-
/* @__PURE__ */ e(ys, { className: "w-6 h-6" }),
|
|
1353
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1354
|
-
] }) }));
|
|
1355
|
-
Re.displayName = "LoadingState";
|
|
1356
1360
|
const Fs = ({
|
|
1357
1361
|
capabilities: t = {},
|
|
1358
1362
|
className: s,
|
|
1359
1363
|
renderMessageInputActions: n,
|
|
1360
1364
|
onChannelSelect: r,
|
|
1361
|
-
onParticipantSelect:
|
|
1365
|
+
onParticipantSelect: o,
|
|
1362
1366
|
initialParticipantFilter: d,
|
|
1363
1367
|
initialParticipantData: l,
|
|
1364
1368
|
CustomChannelEmptyState: m,
|
|
1365
1369
|
showChannelList: h = !0,
|
|
1366
1370
|
filters: g,
|
|
1367
|
-
channelListCustomEmptyStateIndicator:
|
|
1371
|
+
channelListCustomEmptyStateIndicator: v,
|
|
1368
1372
|
onDeleteConversationClick: f,
|
|
1369
1373
|
onBlockParticipantClick: S,
|
|
1370
|
-
onReportParticipantClick:
|
|
1374
|
+
onReportParticipantClick: R
|
|
1371
1375
|
}) => {
|
|
1372
1376
|
const {
|
|
1373
|
-
service:
|
|
1377
|
+
service: w,
|
|
1374
1378
|
client: c,
|
|
1375
|
-
isConnected:
|
|
1376
|
-
isLoading:
|
|
1379
|
+
isConnected: x,
|
|
1380
|
+
isLoading: y,
|
|
1377
1381
|
error: I,
|
|
1378
|
-
refreshConnection:
|
|
1379
|
-
debug:
|
|
1380
|
-
} = rs(), [
|
|
1382
|
+
refreshConnection: M,
|
|
1383
|
+
debug: N
|
|
1384
|
+
} = rs(), [p, a] = E(null), [u, C] = E(!1), [B, j] = E(!1), [Z, J] = E(!1), [ae, Q] = E(/* @__PURE__ */ new Set()), [X, ie] = E(0), [U, H] = E(!1), [V, G] = E(null), D = z(null), {
|
|
1381
1385
|
participantSource: T,
|
|
1382
1386
|
participantLabel: A = "participants",
|
|
1383
|
-
showDeleteConversation:
|
|
1384
|
-
} = t,
|
|
1385
|
-
const
|
|
1387
|
+
showDeleteConversation: W = !0
|
|
1388
|
+
} = t, K = O.useMemo(() => {
|
|
1389
|
+
const b = c == null ? void 0 : c.userID;
|
|
1386
1390
|
return {
|
|
1387
1391
|
...{
|
|
1388
1392
|
type: "messaging",
|
|
1389
1393
|
last_message_at: { $exists: !0 },
|
|
1390
|
-
...
|
|
1391
|
-
members: { $in: [
|
|
1394
|
+
...b && {
|
|
1395
|
+
members: { $in: [b] },
|
|
1392
1396
|
hidden: !1
|
|
1393
1397
|
}
|
|
1394
1398
|
},
|
|
1395
1399
|
...g
|
|
1396
1400
|
};
|
|
1397
|
-
}, [g, c == null ? void 0 : c.userID]),
|
|
1398
|
-
if (!c || !
|
|
1399
|
-
const
|
|
1400
|
-
if (
|
|
1401
|
+
}, [g, c == null ? void 0 : c.userID]), ee = z(null), q = _(async () => {
|
|
1402
|
+
if (!c || !x) return;
|
|
1403
|
+
const b = c.userID;
|
|
1404
|
+
if (b)
|
|
1401
1405
|
try {
|
|
1402
|
-
|
|
1403
|
-
const
|
|
1406
|
+
N && console.log("[MessagingShell] Syncing channels for user:", b);
|
|
1407
|
+
const P = await c.queryChannels(
|
|
1404
1408
|
{
|
|
1405
1409
|
type: "messaging",
|
|
1406
|
-
members: { $in: [
|
|
1410
|
+
members: { $in: [b] }
|
|
1407
1411
|
},
|
|
1408
1412
|
{},
|
|
1409
1413
|
{ limit: 100 }
|
|
1410
1414
|
), F = /* @__PURE__ */ new Set();
|
|
1411
|
-
|
|
1415
|
+
P.forEach((L) => {
|
|
1412
1416
|
const ce = L.state.members;
|
|
1413
|
-
Object.values(ce).forEach((
|
|
1414
|
-
var
|
|
1415
|
-
const de = (
|
|
1416
|
-
de && de !==
|
|
1417
|
+
Object.values(ce).forEach((Oe) => {
|
|
1418
|
+
var he;
|
|
1419
|
+
const de = (he = Oe.user) == null ? void 0 : he.id;
|
|
1420
|
+
de && de !== b && F.add(de);
|
|
1417
1421
|
});
|
|
1418
|
-
}),
|
|
1419
|
-
channelCount:
|
|
1422
|
+
}), Q((L) => L.size === F.size && [...L].every((ce) => F.has(ce)) ? L : F), C(P.length > 0), j(!0), ee.current = b, N && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1423
|
+
channelCount: P.length,
|
|
1420
1424
|
memberCount: F.size
|
|
1421
1425
|
});
|
|
1422
|
-
} catch (
|
|
1423
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1426
|
+
} catch (P) {
|
|
1427
|
+
console.error("[MessagingShell] Failed to sync channels:", P);
|
|
1424
1428
|
}
|
|
1425
|
-
}, [c,
|
|
1426
|
-
|
|
1427
|
-
if (!c || !
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1430
|
-
}, [c,
|
|
1431
|
-
if (!d || !c || !
|
|
1429
|
+
}, [c, x, N]);
|
|
1430
|
+
$(() => {
|
|
1431
|
+
if (!c || !x) return;
|
|
1432
|
+
const b = c.userID;
|
|
1433
|
+
b && ee.current !== b && q();
|
|
1434
|
+
}, [c, x, q]), $(() => {
|
|
1435
|
+
if (!d || !c || !x) return;
|
|
1432
1436
|
(async () => {
|
|
1433
|
-
const
|
|
1434
|
-
if (
|
|
1437
|
+
const P = c.userID;
|
|
1438
|
+
if (P)
|
|
1435
1439
|
try {
|
|
1436
|
-
|
|
1440
|
+
N && console.log(
|
|
1437
1441
|
"[MessagingShell] Loading initial conversation with:",
|
|
1438
1442
|
d
|
|
1439
1443
|
);
|
|
1440
1444
|
const F = await c.queryChannels(
|
|
1441
1445
|
{
|
|
1442
1446
|
type: "messaging",
|
|
1443
|
-
members: { $eq: [
|
|
1447
|
+
members: { $eq: [P, d] }
|
|
1444
1448
|
},
|
|
1445
1449
|
{},
|
|
1446
1450
|
{ limit: 1 }
|
|
1447
1451
|
);
|
|
1448
1452
|
if (F.length > 0)
|
|
1449
|
-
|
|
1453
|
+
a(F[0]), H(!0), G(null), r && r(F[0]), N && console.log(
|
|
1450
1454
|
"[MessagingShell] Initial conversation loaded:",
|
|
1451
1455
|
F[0].id
|
|
1452
1456
|
);
|
|
1453
|
-
else if (l &&
|
|
1454
|
-
|
|
1457
|
+
else if (l && w) {
|
|
1458
|
+
N && console.log(
|
|
1455
1459
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1456
1460
|
l
|
|
1457
1461
|
);
|
|
1458
1462
|
try {
|
|
1459
|
-
const L = await
|
|
1463
|
+
const L = await w.startChannelWithParticipant({
|
|
1460
1464
|
id: l.id,
|
|
1461
1465
|
name: l.name,
|
|
1462
1466
|
email: l.email,
|
|
1463
1467
|
phone: l.phone
|
|
1464
1468
|
});
|
|
1465
|
-
|
|
1469
|
+
a(L), H(!0), G(null), r && r(L), N && console.log(
|
|
1466
1470
|
"[MessagingShell] Channel created and loaded:",
|
|
1467
1471
|
L.id
|
|
1468
1472
|
);
|
|
@@ -1470,12 +1474,12 @@ const Fs = ({
|
|
|
1470
1474
|
console.error(
|
|
1471
1475
|
"[MessagingShell] Failed to create conversation:",
|
|
1472
1476
|
L
|
|
1473
|
-
),
|
|
1477
|
+
), G("Failed to create conversation");
|
|
1474
1478
|
}
|
|
1475
1479
|
} else
|
|
1476
|
-
|
|
1480
|
+
G(
|
|
1477
1481
|
"No conversation found with this account"
|
|
1478
|
-
),
|
|
1482
|
+
), N && console.log(
|
|
1479
1483
|
"[MessagingShell] No conversation found for:",
|
|
1480
1484
|
d
|
|
1481
1485
|
);
|
|
@@ -1483,80 +1487,88 @@ const Fs = ({
|
|
|
1483
1487
|
console.error(
|
|
1484
1488
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1485
1489
|
F
|
|
1486
|
-
),
|
|
1490
|
+
), G("Failed to load conversation");
|
|
1487
1491
|
}
|
|
1488
1492
|
})();
|
|
1489
1493
|
}, [
|
|
1490
1494
|
d,
|
|
1491
1495
|
l,
|
|
1492
1496
|
c,
|
|
1493
|
-
N,
|
|
1494
|
-
v,
|
|
1495
1497
|
x,
|
|
1498
|
+
w,
|
|
1499
|
+
N,
|
|
1496
1500
|
r
|
|
1497
1501
|
]);
|
|
1498
|
-
const
|
|
1499
|
-
(
|
|
1500
|
-
|
|
1502
|
+
const Me = _(
|
|
1503
|
+
(b) => {
|
|
1504
|
+
a(b), r == null || r(b);
|
|
1501
1505
|
},
|
|
1502
1506
|
[r]
|
|
1503
|
-
), De =
|
|
1504
|
-
|
|
1505
|
-
}, [
|
|
1506
|
-
async (
|
|
1507
|
-
var
|
|
1508
|
-
if (
|
|
1507
|
+
), De = _(() => {
|
|
1508
|
+
U || a(null);
|
|
1509
|
+
}, [U]), _e = _(
|
|
1510
|
+
async (b) => {
|
|
1511
|
+
var P;
|
|
1512
|
+
if (w)
|
|
1509
1513
|
try {
|
|
1510
|
-
|
|
1514
|
+
N && console.log(
|
|
1511
1515
|
"[MessagingShell] Starting conversation with:",
|
|
1512
|
-
|
|
1516
|
+
b.id
|
|
1513
1517
|
);
|
|
1514
|
-
const F = await
|
|
1515
|
-
id:
|
|
1516
|
-
name:
|
|
1517
|
-
email:
|
|
1518
|
-
phone:
|
|
1518
|
+
const F = await w.startChannelWithParticipant({
|
|
1519
|
+
id: b.id,
|
|
1520
|
+
name: b.name,
|
|
1521
|
+
email: b.email,
|
|
1522
|
+
phone: b.phone
|
|
1519
1523
|
});
|
|
1520
1524
|
try {
|
|
1521
1525
|
await F.show();
|
|
1522
1526
|
} catch (L) {
|
|
1523
1527
|
console.warn("[MessagingShell] Failed to unhide channel:", L);
|
|
1524
1528
|
}
|
|
1525
|
-
|
|
1529
|
+
a(F), J(!1), (P = D.current) == null || P.close(), o == null || o(b);
|
|
1526
1530
|
} catch (F) {
|
|
1527
1531
|
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
1528
1532
|
}
|
|
1529
1533
|
},
|
|
1530
|
-
[
|
|
1531
|
-
),
|
|
1532
|
-
var
|
|
1533
|
-
|
|
1534
|
-
}, []), Fe =
|
|
1535
|
-
(
|
|
1536
|
-
|
|
1534
|
+
[w, o, N]
|
|
1535
|
+
), se = _(() => {
|
|
1536
|
+
var b;
|
|
1537
|
+
J(!1), (b = D.current) == null || b.close();
|
|
1538
|
+
}, []), Fe = _(
|
|
1539
|
+
(b) => {
|
|
1540
|
+
b.target === D.current && se();
|
|
1537
1541
|
},
|
|
1538
|
-
[
|
|
1539
|
-
), Te =
|
|
1540
|
-
async (
|
|
1541
|
-
|
|
1542
|
+
[se]
|
|
1543
|
+
), Te = _(
|
|
1544
|
+
async (b) => {
|
|
1545
|
+
N && console.log("[MessagingShell] Leaving conversation:", b.id), a(null), H(!1), ee.current = null, await q();
|
|
1542
1546
|
},
|
|
1543
|
-
[
|
|
1544
|
-
), Le =
|
|
1545
|
-
async (
|
|
1546
|
-
|
|
1547
|
+
[q, N]
|
|
1548
|
+
), Le = _(
|
|
1549
|
+
async (b) => {
|
|
1550
|
+
N && console.log("[MessagingShell] Blocking participant:", b), a(null), H(!1), ee.current = null, await q();
|
|
1547
1551
|
},
|
|
1548
|
-
[
|
|
1549
|
-
),
|
|
1550
|
-
return
|
|
1552
|
+
[q, N]
|
|
1553
|
+
), te = !!p;
|
|
1554
|
+
return console.log("[MessagingShell] render", {
|
|
1555
|
+
isLoading: y,
|
|
1556
|
+
error: I,
|
|
1557
|
+
isConnected: x,
|
|
1558
|
+
hasClient: !!c,
|
|
1559
|
+
directConversationError: V,
|
|
1560
|
+
selectedChannelId: p == null ? void 0 : p.id,
|
|
1561
|
+
directConversationMode: U
|
|
1562
|
+
}), y ? (console.log("[MessagingShell] showing LOADING state"), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(me, {}) })) : I ? (console.log("[MessagingShell] showing ERROR state:", I), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: M }) })) : !x || !c ? (console.log("[MessagingShell] showing NOT CONNECTED state"), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(
|
|
1551
1563
|
le,
|
|
1552
1564
|
{
|
|
1553
1565
|
message: "Not connected to messaging service",
|
|
1554
|
-
onBack:
|
|
1566
|
+
onBack: M
|
|
1555
1567
|
}
|
|
1556
|
-
) }) :
|
|
1568
|
+
) })) : V ? (console.log("[MessagingShell] showing DIRECT CONVERSATION ERROR:", V), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: V }) })) : (console.log("[MessagingShell] rendering main UI with ChannelView"), /* @__PURE__ */ i(
|
|
1557
1569
|
"div",
|
|
1558
1570
|
{
|
|
1559
|
-
className:
|
|
1571
|
+
className: k(
|
|
1560
1572
|
"messaging-shell h-full bg-background-secondary overflow-hidden",
|
|
1561
1573
|
s
|
|
1562
1574
|
),
|
|
@@ -1565,23 +1577,23 @@ const Fs = ({
|
|
|
1565
1577
|
/* @__PURE__ */ e(
|
|
1566
1578
|
"div",
|
|
1567
1579
|
{
|
|
1568
|
-
className:
|
|
1580
|
+
className: k(
|
|
1569
1581
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1570
1582
|
{
|
|
1571
|
-
"!hidden": h === !1 ||
|
|
1583
|
+
"!hidden": h === !1 || U,
|
|
1572
1584
|
// Hide on mobile when channel selected, show on desktop with consistent narrow width
|
|
1573
|
-
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !
|
|
1585
|
+
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !U && te,
|
|
1574
1586
|
// Show on mobile when no channel selected, use same narrow width on desktop
|
|
1575
|
-
"flex flex-col w-full lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !
|
|
1587
|
+
"flex flex-col w-full lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !U && !te
|
|
1576
1588
|
}
|
|
1577
1589
|
),
|
|
1578
1590
|
children: /* @__PURE__ */ e(
|
|
1579
|
-
|
|
1591
|
+
Ie,
|
|
1580
1592
|
{
|
|
1581
|
-
onChannelSelect:
|
|
1582
|
-
selectedChannel:
|
|
1583
|
-
filters:
|
|
1584
|
-
customEmptyStateIndicator:
|
|
1593
|
+
onChannelSelect: Me,
|
|
1594
|
+
selectedChannel: p || void 0,
|
|
1595
|
+
filters: K,
|
|
1596
|
+
customEmptyStateIndicator: v
|
|
1585
1597
|
}
|
|
1586
1598
|
)
|
|
1587
1599
|
}
|
|
@@ -1589,33 +1601,33 @@ const Fs = ({
|
|
|
1589
1601
|
/* @__PURE__ */ e(
|
|
1590
1602
|
"div",
|
|
1591
1603
|
{
|
|
1592
|
-
className:
|
|
1604
|
+
className: k(
|
|
1593
1605
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1594
1606
|
{
|
|
1595
1607
|
// In direct conversation mode, always show (full width)
|
|
1596
|
-
flex:
|
|
1608
|
+
flex: U || te,
|
|
1597
1609
|
// Normal mode: hide on mobile when no channel selected
|
|
1598
|
-
"hidden lg:flex": !
|
|
1610
|
+
"hidden lg:flex": !U && !te
|
|
1599
1611
|
}
|
|
1600
1612
|
),
|
|
1601
|
-
children:
|
|
1602
|
-
|
|
1613
|
+
children: p ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1614
|
+
ke,
|
|
1603
1615
|
{
|
|
1604
|
-
channel:
|
|
1616
|
+
channel: p,
|
|
1605
1617
|
onBack: De,
|
|
1606
|
-
showBackButton: !
|
|
1618
|
+
showBackButton: !U,
|
|
1607
1619
|
renderMessageInputActions: n,
|
|
1608
1620
|
onLeaveConversation: Te,
|
|
1609
1621
|
onBlockParticipant: Le,
|
|
1610
1622
|
CustomChannelEmptyState: m,
|
|
1611
|
-
showDeleteConversation:
|
|
1623
|
+
showDeleteConversation: W,
|
|
1612
1624
|
onDeleteConversationClick: f,
|
|
1613
1625
|
onBlockParticipantClick: S,
|
|
1614
|
-
onReportParticipantClick:
|
|
1626
|
+
onReportParticipantClick: R
|
|
1615
1627
|
},
|
|
1616
|
-
|
|
1628
|
+
p.id
|
|
1617
1629
|
) }) : /* @__PURE__ */ e(
|
|
1618
|
-
|
|
1630
|
+
Re,
|
|
1619
1631
|
{
|
|
1620
1632
|
hasChannels: u,
|
|
1621
1633
|
channelsLoaded: B
|
|
@@ -1628,27 +1640,27 @@ const Fs = ({
|
|
|
1628
1640
|
/* @__PURE__ */ e(
|
|
1629
1641
|
"dialog",
|
|
1630
1642
|
{
|
|
1631
|
-
ref:
|
|
1643
|
+
ref: D,
|
|
1632
1644
|
className: "mes-dialog",
|
|
1633
1645
|
onClick: Fe,
|
|
1634
|
-
onClose:
|
|
1646
|
+
onClose: se,
|
|
1635
1647
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1636
1648
|
vs,
|
|
1637
1649
|
{
|
|
1638
1650
|
participantSource: T,
|
|
1639
|
-
onSelectParticipant:
|
|
1640
|
-
onClose:
|
|
1641
|
-
existingParticipantIds:
|
|
1651
|
+
onSelectParticipant: _e,
|
|
1652
|
+
onClose: se,
|
|
1653
|
+
existingParticipantIds: ae,
|
|
1642
1654
|
participantLabel: A,
|
|
1643
1655
|
searchPlaceholder: `Search ${A}...`
|
|
1644
1656
|
},
|
|
1645
|
-
|
|
1657
|
+
X
|
|
1646
1658
|
) })
|
|
1647
1659
|
}
|
|
1648
1660
|
)
|
|
1649
1661
|
]
|
|
1650
1662
|
}
|
|
1651
|
-
);
|
|
1663
|
+
));
|
|
1652
1664
|
}, Es = ({
|
|
1653
1665
|
question: t,
|
|
1654
1666
|
onClick: s,
|
|
@@ -1661,7 +1673,7 @@ const Fs = ({
|
|
|
1661
1673
|
onClick: s,
|
|
1662
1674
|
disabled: n,
|
|
1663
1675
|
style: { backgroundColor: "#E6E5E3" },
|
|
1664
|
-
className:
|
|
1676
|
+
className: k(
|
|
1665
1677
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1666
1678
|
{
|
|
1667
1679
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1676,14 +1688,14 @@ const Fs = ({
|
|
|
1676
1688
|
onFaqClick: s,
|
|
1677
1689
|
loadingFaqId: n,
|
|
1678
1690
|
headerText: r,
|
|
1679
|
-
className:
|
|
1691
|
+
className: o,
|
|
1680
1692
|
avatarImage: d,
|
|
1681
1693
|
avatarName: l
|
|
1682
1694
|
}) => {
|
|
1683
1695
|
const m = t.filter((h) => h.enabled).sort((h, g) => (h.order ?? 0) - (g.order ?? 0));
|
|
1684
|
-
return m.length === 0 ? null : /* @__PURE__ */ e("div", { className:
|
|
1696
|
+
return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1685
1697
|
(d || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1686
|
-
|
|
1698
|
+
Y,
|
|
1687
1699
|
{
|
|
1688
1700
|
id: l || "account",
|
|
1689
1701
|
name: l || "Account",
|
|
@@ -1713,57 +1725,57 @@ const Fs = ({
|
|
|
1713
1725
|
)
|
|
1714
1726
|
] }) });
|
|
1715
1727
|
}, Ls = (t, s = {}) => {
|
|
1716
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [
|
|
1728
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [o, d] = E([]), [l, m] = E(!1), [h, g] = E(null), [v, f] = E(n), [S, R] = E(!0), [w, c] = E(), x = _(async (N = !1, p) => {
|
|
1717
1729
|
if (l) return;
|
|
1718
|
-
const
|
|
1730
|
+
const a = p !== void 0 ? p : v;
|
|
1719
1731
|
m(!0), g(null);
|
|
1720
1732
|
try {
|
|
1721
1733
|
const u = await t.loadParticipants({
|
|
1722
|
-
search:
|
|
1734
|
+
search: a || void 0,
|
|
1723
1735
|
limit: r,
|
|
1724
|
-
cursor:
|
|
1736
|
+
cursor: N ? void 0 : w
|
|
1725
1737
|
});
|
|
1726
1738
|
d(
|
|
1727
|
-
(
|
|
1728
|
-
),
|
|
1739
|
+
(C) => N ? u.participants : [...C, ...u.participants]
|
|
1740
|
+
), R(u.hasMore), c(u.nextCursor);
|
|
1729
1741
|
} catch (u) {
|
|
1730
|
-
const
|
|
1731
|
-
g(
|
|
1742
|
+
const C = u instanceof Error ? u.message : "Failed to load participants";
|
|
1743
|
+
g(C), console.error("[useParticipants] Load error:", u);
|
|
1732
1744
|
} finally {
|
|
1733
1745
|
m(!1);
|
|
1734
1746
|
}
|
|
1735
|
-
}, [t,
|
|
1736
|
-
S && !l &&
|
|
1737
|
-
}, [S, l,
|
|
1738
|
-
f(
|
|
1739
|
-
}, [
|
|
1740
|
-
c(void 0),
|
|
1741
|
-
}, [
|
|
1742
|
-
return
|
|
1743
|
-
|
|
1747
|
+
}, [t, v, w, r, l]), y = _(() => {
|
|
1748
|
+
S && !l && x(!1);
|
|
1749
|
+
}, [S, l, x]), I = _((N) => {
|
|
1750
|
+
f(N), c(void 0), x(!0, N);
|
|
1751
|
+
}, [x]), M = _(() => {
|
|
1752
|
+
c(void 0), x(!0);
|
|
1753
|
+
}, [x]);
|
|
1754
|
+
return $(() => {
|
|
1755
|
+
x(!0);
|
|
1744
1756
|
}, [t.loadParticipants]), {
|
|
1745
|
-
participants:
|
|
1757
|
+
participants: o,
|
|
1746
1758
|
loading: l,
|
|
1747
1759
|
error: h,
|
|
1748
|
-
searchQuery:
|
|
1760
|
+
searchQuery: v,
|
|
1749
1761
|
hasMore: S,
|
|
1750
1762
|
totalCount: t.totalCount,
|
|
1751
|
-
loadMore:
|
|
1763
|
+
loadMore: y,
|
|
1752
1764
|
search: I,
|
|
1753
|
-
refresh:
|
|
1765
|
+
refresh: M
|
|
1754
1766
|
};
|
|
1755
1767
|
};
|
|
1756
1768
|
export {
|
|
1757
|
-
|
|
1769
|
+
Y as Avatar,
|
|
1758
1770
|
gs as ChannelEmptyState,
|
|
1759
|
-
|
|
1760
|
-
|
|
1771
|
+
Ie as ChannelList,
|
|
1772
|
+
ke as ChannelView,
|
|
1761
1773
|
Ts as FaqList,
|
|
1762
1774
|
Es as FaqListItem,
|
|
1763
|
-
|
|
1775
|
+
_s as MessagingProvider,
|
|
1764
1776
|
Fs as MessagingShell,
|
|
1765
1777
|
vs as ParticipantPicker,
|
|
1766
|
-
|
|
1778
|
+
os as formatRelativeTime,
|
|
1767
1779
|
rs as useMessaging,
|
|
1768
1780
|
Ls as useParticipants
|
|
1769
1781
|
};
|