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