@linktr.ee/messaging-react 1.12.8-rc-1766044049 โ 1.12.8-rc-1766044676
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +374 -370
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CustomMessageInput/index.tsx +15 -15
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as we } from "react/jsx-runtime";
|
|
2
2
|
import k from "classnames";
|
|
3
3
|
import P, { createContext as ye, useContext as Ee, useCallback as _, useState as y, useRef as z, useEffect as G } from "react";
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
4
|
+
import { StreamChatService as $e } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as Ge, ChannelList as He, useMessageComposer as Ie, useStateStore as Ve, MessageInput as We, useMessageInputContext as Ze, useMessageComposerHasSendableData as qe, useChannelStateContext as ue, SimpleAttachmentSelector as Ye, QuotedMessagePreview as Je, AttachmentPreviewList as Qe, TextareaComposer as Xe, MessageTimestamp as Ke, Channel as es, Window as ss, MessageList as ts } from "stream-chat-react";
|
|
6
6
|
import { XIcon as oe, ArrowUpIcon as ns, ArrowLeftIcon as ge, DotsThreeIcon as xe, SpinnerGapIcon as re, SignOutIcon as rs, ProhibitInsetIcon as be, FlagIcon as ls, MagnifyingGlassIcon as as, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
|
|
7
|
-
import { LinkPreviewsManager as
|
|
8
|
-
const
|
|
7
|
+
import { LinkPreviewsManager as Ce } from "stream-chat";
|
|
8
|
+
const Se = ye({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,19 +15,19 @@ const Ie = ye({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), ie = () => Ee(
|
|
18
|
+
}), ie = () => Ee(Se), Ps = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
22
|
apiKey: r,
|
|
23
23
|
capabilities: a = {},
|
|
24
|
-
debug:
|
|
24
|
+
debug: o = !1
|
|
25
25
|
}) => {
|
|
26
26
|
const l = _(
|
|
27
|
-
(
|
|
28
|
-
|
|
27
|
+
(d, ...x) => {
|
|
28
|
+
o && console.log(`๐ฅ [MessagingProvider] ${d}`, ...x);
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[o]
|
|
31
31
|
);
|
|
32
32
|
l("๐ RENDER START", {
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
@@ -35,7 +35,7 @@ const Ie = ye({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(a)
|
|
37
37
|
});
|
|
38
|
-
const [h, f] = y(null), [g,
|
|
38
|
+
const [h, f] = y(null), [g, v] = y(null), [m, E] = y(!1), [R, I] = y(!1), [w, N] = y(null), u = z(!1), b = z({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
@@ -56,9 +56,9 @@ const Ie = ye({
|
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: a
|
|
58
58
|
}, G(() => {
|
|
59
|
-
const
|
|
59
|
+
const d = S.current;
|
|
60
60
|
if (l("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
|
-
renderCount:
|
|
61
|
+
renderCount: d,
|
|
62
62
|
apiKey: !!r,
|
|
63
63
|
serviceConfig: !!n,
|
|
64
64
|
dependencies: {
|
|
@@ -69,31 +69,31 @@ const Ie = ye({
|
|
|
69
69
|
}
|
|
70
70
|
}), !r || !n) {
|
|
71
71
|
l("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
72
|
-
renderCount:
|
|
72
|
+
renderCount: d,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
74
74
|
});
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
l("๐ CREATING NEW SERVICE", {
|
|
78
|
-
renderCount:
|
|
78
|
+
renderCount: d,
|
|
79
79
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: b.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const x = new
|
|
82
|
+
const x = new $e({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: r,
|
|
85
|
-
debug:
|
|
85
|
+
debug: o
|
|
86
86
|
});
|
|
87
87
|
return f(x), l("โ
SERVICE SET", {
|
|
88
|
-
renderCount:
|
|
88
|
+
renderCount: d,
|
|
89
89
|
serviceInstance: !!x
|
|
90
90
|
}), () => {
|
|
91
91
|
l("๐งน SERVICE CLEANUP", {
|
|
92
|
-
renderCount:
|
|
92
|
+
renderCount: d,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
94
|
}), x.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
|
-
}, [r, n,
|
|
96
|
+
}, [r, n, o, l]);
|
|
97
97
|
const p = z(null);
|
|
98
98
|
G(() => {
|
|
99
99
|
var x, B;
|
|
@@ -101,14 +101,14 @@ const Ie = ye({
|
|
|
101
101
|
hasService: !!h,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
|
-
isConnecting:
|
|
105
|
-
isConnected:
|
|
104
|
+
isConnecting: u.current,
|
|
105
|
+
isConnected: m,
|
|
106
106
|
dependencies: { service: !!h, userId: s == null ? void 0 : s.id }
|
|
107
107
|
}), !h || !s) {
|
|
108
108
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
111
|
+
if (u.current) {
|
|
112
112
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
@@ -120,11 +120,11 @@ const Ie = ye({
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
l("๐ STARTING USER CONNECTION", { userId: s.id }),
|
|
123
|
+
l("๐ STARTING USER CONNECTION", { userId: s.id }), u.current = !0, I(!0), N(null);
|
|
124
124
|
try {
|
|
125
125
|
l("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
126
|
const A = await h.connectUser(s);
|
|
127
|
-
|
|
127
|
+
v(A), E(!0), p.current = { serviceId: h, userId: s.id }, l("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: A.userID
|
|
130
130
|
});
|
|
@@ -135,24 +135,24 @@ const Ie = ye({
|
|
|
135
135
|
error: H
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
I(!1),
|
|
138
|
+
I(!1), u.current = !1, l("๐ USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
|
-
isConnected:
|
|
140
|
+
isConnected: m
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [h, s, l,
|
|
144
|
+
}, [h, s, l, m]), G(() => (l("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
145
|
hasService: !!h,
|
|
146
|
-
isConnected:
|
|
146
|
+
isConnected: m
|
|
147
147
|
}), () => {
|
|
148
|
-
h &&
|
|
148
|
+
h && m ? (l(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
151
|
), p.current = null, h.disconnectUser().catch(console.error)) : l("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
152
|
hasService: !!h,
|
|
153
|
-
isConnected:
|
|
153
|
+
isConnected: m
|
|
154
154
|
});
|
|
155
|
-
}), [h,
|
|
155
|
+
}), [h, m, l]);
|
|
156
156
|
const T = _(async () => {
|
|
157
157
|
if (l("๐ REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!h,
|
|
@@ -164,10 +164,10 @@ const Ie = ye({
|
|
|
164
164
|
l("๐ STARTING CONNECTION REFRESH", { userId: s.id }), I(!0);
|
|
165
165
|
try {
|
|
166
166
|
l("๐ DISCONNECTING FOR REFRESH"), await h.disconnectUser(), l("๐ RECONNECTING FOR REFRESH");
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
} catch (
|
|
170
|
-
const x =
|
|
167
|
+
const d = await h.connectUser(s);
|
|
168
|
+
v(d), E(!0), N(null), l("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
|
+
} catch (d) {
|
|
170
|
+
const x = d instanceof Error ? d.message : "Refresh failed";
|
|
171
171
|
N(x), l("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
173
|
error: x
|
|
@@ -175,39 +175,39 @@ const Ie = ye({
|
|
|
175
175
|
} finally {
|
|
176
176
|
I(!1), l("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [h, s, l]),
|
|
178
|
+
}, [h, s, l]), c = P.useMemo(() => (l("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!h,
|
|
180
180
|
hasClient: !!g,
|
|
181
|
-
isConnected:
|
|
181
|
+
isConnected: m,
|
|
182
182
|
isLoading: R,
|
|
183
183
|
hasError: !!w,
|
|
184
184
|
capabilitiesKeys: Object.keys(a)
|
|
185
185
|
}), {
|
|
186
186
|
service: h,
|
|
187
187
|
client: g,
|
|
188
|
-
isConnected:
|
|
188
|
+
isConnected: m,
|
|
189
189
|
isLoading: R,
|
|
190
190
|
error: w,
|
|
191
191
|
capabilities: a,
|
|
192
192
|
refreshConnection: T,
|
|
193
|
-
debug:
|
|
193
|
+
debug: o
|
|
194
194
|
}), [
|
|
195
195
|
h,
|
|
196
196
|
g,
|
|
197
|
-
|
|
197
|
+
m,
|
|
198
198
|
R,
|
|
199
199
|
w,
|
|
200
200
|
a,
|
|
201
201
|
T,
|
|
202
|
-
|
|
202
|
+
o,
|
|
203
203
|
l
|
|
204
204
|
]);
|
|
205
205
|
return l("๐ RENDER END", {
|
|
206
206
|
renderCount: S.current,
|
|
207
|
-
willRenderChat: !!(g &&
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(
|
|
210
|
-
|
|
207
|
+
willRenderChat: !!(g && m),
|
|
208
|
+
contextValueReady: !!c
|
|
209
|
+
}), /* @__PURE__ */ e(Se.Provider, { value: c, children: g && m ? /* @__PURE__ */ e(
|
|
210
|
+
Ge,
|
|
211
211
|
{
|
|
212
212
|
client: g,
|
|
213
213
|
customClasses: {
|
|
@@ -237,7 +237,7 @@ const Ie = ye({
|
|
|
237
237
|
day: "numeric",
|
|
238
238
|
year: "2-digit"
|
|
239
239
|
});
|
|
240
|
-
},
|
|
240
|
+
}, ve = [
|
|
241
241
|
"๐",
|
|
242
242
|
// Apple
|
|
243
243
|
"๐",
|
|
@@ -273,9 +273,9 @@ function ds(t) {
|
|
|
273
273
|
}
|
|
274
274
|
return Math.abs(s);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const n = ds(t) %
|
|
278
|
-
return
|
|
276
|
+
function ms(t) {
|
|
277
|
+
const n = ds(t) % ve.length;
|
|
278
|
+
return ve[n];
|
|
279
279
|
}
|
|
280
280
|
const Z = ({
|
|
281
281
|
id: t,
|
|
@@ -284,7 +284,7 @@ const Z = ({
|
|
|
284
284
|
className: r,
|
|
285
285
|
shape: a = "squircle"
|
|
286
286
|
}) => {
|
|
287
|
-
const
|
|
287
|
+
const o = ms(t), h = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", f = a === "circle" ? { borderRadius: "50%" } : {
|
|
288
288
|
borderRadius: "33%",
|
|
289
289
|
"corner-shape": "superellipse(1.3)"
|
|
290
290
|
};
|
|
@@ -312,30 +312,30 @@ const Z = ({
|
|
|
312
312
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
313
313
|
h
|
|
314
314
|
),
|
|
315
|
-
children:
|
|
315
|
+
children: o
|
|
316
316
|
}
|
|
317
317
|
)
|
|
318
318
|
}
|
|
319
319
|
);
|
|
320
|
-
},
|
|
320
|
+
}, pe = P.memo(
|
|
321
321
|
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
|
|
322
|
-
var N,
|
|
323
|
-
const
|
|
322
|
+
var N, u, b, S, p, T;
|
|
323
|
+
const o = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
|
|
324
324
|
t && n(t);
|
|
325
325
|
}, f = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
|
|
326
|
-
(
|
|
327
|
-
var
|
|
328
|
-
return ((
|
|
326
|
+
(c) => {
|
|
327
|
+
var d, x;
|
|
328
|
+
return ((d = c.user) == null ? void 0 : d.id) && c.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
|
|
329
329
|
}
|
|
330
|
-
), g = ((
|
|
331
|
-
var
|
|
332
|
-
if (
|
|
333
|
-
const
|
|
334
|
-
return
|
|
335
|
-
})(), I =
|
|
330
|
+
), g = ((u = f == null ? void 0 : f.user) == null ? void 0 : u.name) || "Conversation", v = (b = f == null ? void 0 : f.user) == null ? void 0 : b.image, m = (p = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : p[t.state.messages.length - 1], R = (() => {
|
|
331
|
+
var d;
|
|
332
|
+
if (m != null && m.text) return m.text;
|
|
333
|
+
const c = (d = m == null ? void 0 : m.attachments) == null ? void 0 : d[0];
|
|
334
|
+
return c ? c.og_scrape_url ? c.og_scrape_url : c.type === "image" ? "๐ท Sent an image" : c.type === "video" ? "๐ฅ Sent a video" : c.type === "audio" ? "๐ต Sent audio" : c.type === "file" ? "๐ Sent a file" : "๐ Sent an attachment" : "No messages yet";
|
|
335
|
+
})(), I = m != null && m.created_at ? cs(new Date(m.created_at)) : "", w = a ?? 0;
|
|
336
336
|
return r && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
337
337
|
channelId: t == null ? void 0 : t.id,
|
|
338
|
-
isSelected:
|
|
338
|
+
isSelected: o,
|
|
339
339
|
participantName: g,
|
|
340
340
|
unreadCount: w,
|
|
341
341
|
hasTimestamp: !!I
|
|
@@ -347,36 +347,36 @@ const Z = ({
|
|
|
347
347
|
className: k(
|
|
348
348
|
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
349
349
|
{
|
|
350
|
-
"bg-primary-alt/10 border-l-4 border-l-primary":
|
|
351
|
-
"hover:bg-sand": !
|
|
350
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": o,
|
|
351
|
+
"hover:bg-sand": !o
|
|
352
352
|
}
|
|
353
353
|
),
|
|
354
|
-
children: /* @__PURE__ */
|
|
354
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
355
355
|
/* @__PURE__ */ e(
|
|
356
356
|
Z,
|
|
357
357
|
{
|
|
358
358
|
id: ((T = f == null ? void 0 : f.user) == null ? void 0 : T.id) || t.id || "unknown",
|
|
359
359
|
name: g,
|
|
360
|
-
image:
|
|
360
|
+
image: v,
|
|
361
361
|
size: 44,
|
|
362
362
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
363
363
|
}
|
|
364
364
|
),
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
366
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2", children: [
|
|
367
367
|
/* @__PURE__ */ e(
|
|
368
368
|
"h3",
|
|
369
369
|
{
|
|
370
370
|
className: k(
|
|
371
371
|
"text-sm font-medium truncate",
|
|
372
|
-
|
|
372
|
+
o ? "text-primary" : "text-charcoal"
|
|
373
373
|
),
|
|
374
374
|
children: g
|
|
375
375
|
}
|
|
376
376
|
),
|
|
377
377
|
I && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: I })
|
|
378
378
|
] }),
|
|
379
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
380
380
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: R }),
|
|
381
381
|
w > 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: w > 99 ? "99+" : w })
|
|
382
382
|
] })
|
|
@@ -386,8 +386,8 @@ const Z = ({
|
|
|
386
386
|
);
|
|
387
387
|
}
|
|
388
388
|
);
|
|
389
|
-
|
|
390
|
-
const
|
|
389
|
+
pe.displayName = "CustomChannelPreview";
|
|
390
|
+
const ke = P.memo(
|
|
391
391
|
({
|
|
392
392
|
onChannelSelect: t,
|
|
393
393
|
selectedChannel: s,
|
|
@@ -395,16 +395,16 @@ const pe = P.memo(
|
|
|
395
395
|
className: r,
|
|
396
396
|
customEmptyStateIndicator: a
|
|
397
397
|
}) => {
|
|
398
|
-
const
|
|
399
|
-
|
|
398
|
+
const o = P.useRef(0);
|
|
399
|
+
o.current++;
|
|
400
400
|
const { debug: l = !1 } = ie();
|
|
401
401
|
l && console.log("๐บ [ChannelList] ๐ RENDER START", {
|
|
402
|
-
renderCount:
|
|
402
|
+
renderCount: o.current,
|
|
403
403
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
404
404
|
filters: n
|
|
405
405
|
});
|
|
406
406
|
const h = P.useMemo(() => (g) => /* @__PURE__ */ e(
|
|
407
|
-
|
|
407
|
+
pe,
|
|
408
408
|
{
|
|
409
409
|
...g,
|
|
410
410
|
selectedChannel: s,
|
|
@@ -420,7 +420,7 @@ const pe = P.memo(
|
|
|
420
420
|
r
|
|
421
421
|
),
|
|
422
422
|
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
|
|
423
|
-
|
|
423
|
+
He,
|
|
424
424
|
{
|
|
425
425
|
filters: n,
|
|
426
426
|
sort: { last_message_at: -1 },
|
|
@@ -434,7 +434,7 @@ const pe = P.memo(
|
|
|
434
434
|
);
|
|
435
435
|
}
|
|
436
436
|
);
|
|
437
|
-
|
|
437
|
+
ke.displayName = "ChannelList";
|
|
438
438
|
const ne = ({
|
|
439
439
|
variant: t = "default",
|
|
440
440
|
className: s,
|
|
@@ -453,8 +453,8 @@ const ne = ({
|
|
|
453
453
|
children: n
|
|
454
454
|
}
|
|
455
455
|
);
|
|
456
|
-
function
|
|
457
|
-
return /* @__PURE__ */
|
|
456
|
+
function Re({ label: t, className: s, children: n, ...r }) {
|
|
457
|
+
return /* @__PURE__ */ i(
|
|
458
458
|
"button",
|
|
459
459
|
{
|
|
460
460
|
type: "button",
|
|
@@ -474,19 +474,19 @@ function ke({ label: t, className: s, children: n, ...r }) {
|
|
|
474
474
|
}
|
|
475
475
|
);
|
|
476
476
|
}
|
|
477
|
-
function
|
|
478
|
-
return /* @__PURE__ */ e(
|
|
477
|
+
function _e({ onClick: t }) {
|
|
478
|
+
return /* @__PURE__ */ e(Re, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(oe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
479
479
|
}
|
|
480
|
-
const
|
|
480
|
+
const us = (t) => ({
|
|
481
481
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
482
|
-
(s) =>
|
|
482
|
+
(s) => Ce.previewIsLoaded(s) || Ce.previewIsLoading(s)
|
|
483
483
|
)
|
|
484
484
|
}), hs = ({
|
|
485
485
|
link: t,
|
|
486
486
|
onDismiss: s
|
|
487
487
|
}) => {
|
|
488
488
|
const { og_scrape_url: n, title: r, image_url: a } = t;
|
|
489
|
-
return /* @__PURE__ */
|
|
489
|
+
return /* @__PURE__ */ i(
|
|
490
490
|
"a",
|
|
491
491
|
{
|
|
492
492
|
href: n,
|
|
@@ -514,7 +514,7 @@ const ms = (t) => ({
|
|
|
514
514
|
children: /* @__PURE__ */ e(oe, { className: "size-4 text-black/90" })
|
|
515
515
|
}
|
|
516
516
|
),
|
|
517
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
518
518
|
r && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: r }),
|
|
519
519
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
520
520
|
] })
|
|
@@ -522,9 +522,9 @@ const ms = (t) => ({
|
|
|
522
522
|
}
|
|
523
523
|
);
|
|
524
524
|
}, fs = () => {
|
|
525
|
-
const { linkPreviewsManager: t } =
|
|
525
|
+
const { linkPreviewsManager: t } = Ie(), { linkPreviews: s } = Ve(
|
|
526
526
|
t.state,
|
|
527
|
-
|
|
527
|
+
us
|
|
528
528
|
), n = (a) => {
|
|
529
529
|
t.dismissPreview(a);
|
|
530
530
|
};
|
|
@@ -536,9 +536,9 @@ const ms = (t) => ({
|
|
|
536
536
|
},
|
|
537
537
|
a.og_scrape_url
|
|
538
538
|
)) }) : null;
|
|
539
|
-
},
|
|
539
|
+
}, De = ye(
|
|
540
540
|
{}
|
|
541
|
-
), gs = ({ attachment: t, onRemove: s }) => /* @__PURE__ */
|
|
541
|
+
), gs = ({ attachment: t, onRemove: s }) => /* @__PURE__ */ i("div", { className: "relative w-full block rounded-[24px] bg-[#121110] p-2 mb-4", children: [
|
|
542
542
|
t.thumb_url && /* @__PURE__ */ e(
|
|
543
543
|
"img",
|
|
544
544
|
{
|
|
@@ -557,47 +557,51 @@ const ms = (t) => ({
|
|
|
557
557
|
children: /* @__PURE__ */ e(oe, { className: "size-4 text-black/90" })
|
|
558
558
|
}
|
|
559
559
|
),
|
|
560
|
-
/* @__PURE__ */
|
|
560
|
+
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
561
561
|
t.title && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: t.title }),
|
|
562
562
|
t.title_link && /* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55 truncate", children: t.title_link })
|
|
563
563
|
] })
|
|
564
564
|
] }), xs = () => {
|
|
565
|
-
const { handleSubmit: t } = Ze(), s = qe(), { channel: n } =
|
|
566
|
-
|
|
567
|
-
),
|
|
568
|
-
async (
|
|
569
|
-
var
|
|
570
|
-
if (
|
|
571
|
-
const g = document.querySelector(
|
|
572
|
-
".str-chat__textarea textarea"
|
|
573
|
-
), C = ((f = g == null ? void 0 : g.value) == null ? void 0 : f.trim()) || "";
|
|
565
|
+
const { handleSubmit: t } = Ze(), s = qe(), { channel: n } = ue(), r = Ie(), { pendingAttachment: a, onClearPendingAttachment: o } = Ee(
|
|
566
|
+
De
|
|
567
|
+
), l = s || !!a, h = _(
|
|
568
|
+
async (f) => {
|
|
569
|
+
var g;
|
|
570
|
+
if (a && n)
|
|
574
571
|
try {
|
|
572
|
+
const v = ((g = r.textComposer.text) == null ? void 0 : g.trim()) || "";
|
|
575
573
|
await n.sendMessage({
|
|
576
|
-
text:
|
|
577
|
-
attachments: [
|
|
578
|
-
}),
|
|
579
|
-
} catch (
|
|
580
|
-
console.error("Failed to send message with attachment:",
|
|
574
|
+
text: v,
|
|
575
|
+
attachments: [a]
|
|
576
|
+
}), r.textComposer.setText(""), o == null || o();
|
|
577
|
+
} catch (v) {
|
|
578
|
+
console.error("Failed to send message with attachment:", v);
|
|
581
579
|
}
|
|
582
|
-
|
|
583
|
-
await t(
|
|
580
|
+
else
|
|
581
|
+
await t(f);
|
|
584
582
|
},
|
|
585
|
-
[
|
|
583
|
+
[
|
|
584
|
+
n,
|
|
585
|
+
t,
|
|
586
|
+
r.textComposer,
|
|
587
|
+
o,
|
|
588
|
+
a
|
|
589
|
+
]
|
|
586
590
|
);
|
|
587
|
-
return /* @__PURE__ */
|
|
591
|
+
return /* @__PURE__ */ i(we, { children: [
|
|
588
592
|
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ye, {}) }),
|
|
589
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__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: [
|
|
590
594
|
/* @__PURE__ */ e(Je, {}),
|
|
591
595
|
/* @__PURE__ */ e(fs, {}),
|
|
592
596
|
/* @__PURE__ */ e(Qe, {}),
|
|
593
|
-
|
|
597
|
+
a && o && /* @__PURE__ */ e(
|
|
594
598
|
gs,
|
|
595
599
|
{
|
|
596
|
-
attachment:
|
|
597
|
-
onRemove:
|
|
600
|
+
attachment: a,
|
|
601
|
+
onRemove: o
|
|
598
602
|
}
|
|
599
603
|
),
|
|
600
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
601
605
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
602
606
|
Xe,
|
|
603
607
|
{
|
|
@@ -611,8 +615,8 @@ const ms = (t) => ({
|
|
|
611
615
|
"aria-label": "Send",
|
|
612
616
|
className: "str-chat__send-button mt-auto flex justify-center items-center flex-shrink-0 rounded-full size-8 bg-[#121110] disabled:bg-[#F1F0EE] disabled:text-black/20 text-white",
|
|
613
617
|
"data-testid": "send-button",
|
|
614
|
-
disabled: !
|
|
615
|
-
onClick:
|
|
618
|
+
disabled: !l,
|
|
619
|
+
onClick: h,
|
|
616
620
|
type: "button",
|
|
617
621
|
children: /* @__PURE__ */ e(ns, { className: "size-4" })
|
|
618
622
|
}
|
|
@@ -625,30 +629,30 @@ const ms = (t) => ({
|
|
|
625
629
|
pendingAttachment: s,
|
|
626
630
|
onClearPendingAttachment: n
|
|
627
631
|
}) => /* @__PURE__ */ e(
|
|
628
|
-
|
|
632
|
+
De.Provider,
|
|
629
633
|
{
|
|
630
634
|
value: { pendingAttachment: s, onClearPendingAttachment: n },
|
|
631
|
-
children: /* @__PURE__ */
|
|
635
|
+
children: /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
632
636
|
t && (t == null ? void 0 : t()),
|
|
633
637
|
/* @__PURE__ */ e(We, { Input: xs })
|
|
634
638
|
] })
|
|
635
639
|
}
|
|
636
640
|
), Ns = (t) => {
|
|
637
641
|
const s = t.message.hide_date === !0;
|
|
638
|
-
return /* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
642
|
+
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
643
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
|
|
640
644
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
641
645
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
642
646
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
643
647
|
] }),
|
|
644
648
|
!s && /* @__PURE__ */ e(Ke, { message: t.message })
|
|
645
649
|
] });
|
|
646
|
-
},
|
|
650
|
+
}, Cs = () => null, vs = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
647
651
|
"div",
|
|
648
652
|
{
|
|
649
653
|
className: k("flex items-center justify-center h-full", t),
|
|
650
654
|
children: [
|
|
651
|
-
/* @__PURE__ */
|
|
655
|
+
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
652
656
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
653
657
|
"animateTransform",
|
|
654
658
|
{
|
|
@@ -686,21 +690,21 @@ const ms = (t) => ({
|
|
|
686
690
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
687
691
|
]
|
|
688
692
|
}
|
|
689
|
-
), ae = P.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */
|
|
690
|
-
/* @__PURE__ */ e(
|
|
693
|
+
), ae = 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: [
|
|
694
|
+
/* @__PURE__ */ e(vs, { className: "w-6 h-6" }),
|
|
691
695
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
692
696
|
] }) }));
|
|
693
697
|
ae.displayName = "LoadingState";
|
|
694
698
|
const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
695
|
-
var f, g,
|
|
696
|
-
const { channel: a } =
|
|
699
|
+
var f, g, v, m, E;
|
|
700
|
+
const { channel: a } = ue(), o = P.useMemo(() => Object.values(a.state.members || {}).find(
|
|
697
701
|
(I) => {
|
|
698
702
|
var w;
|
|
699
703
|
return ((w = I.user) == null ? void 0 : w.id) && I.user.id !== a._client.userID;
|
|
700
704
|
}
|
|
701
|
-
), [a._client.userID, a.state.members]), l = ((f =
|
|
702
|
-
return /* @__PURE__ */
|
|
703
|
-
/* @__PURE__ */
|
|
705
|
+
), [a._client.userID, a.state.members]), l = ((f = o == null ? void 0 : o.user) == null ? void 0 : f.name) || ((g = o == null ? void 0 : o.user) == null ? void 0 : g.id) || "Unknown member", h = (v = o == null ? void 0 : o.user) == null ? void 0 : v.image;
|
|
706
|
+
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
707
|
+
/* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
704
708
|
/* @__PURE__ */ e(
|
|
705
709
|
"button",
|
|
706
710
|
{
|
|
@@ -715,11 +719,11 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
715
719
|
children: /* @__PURE__ */ e(ge, { className: "size-5 text-black/90" })
|
|
716
720
|
}
|
|
717
721
|
),
|
|
718
|
-
/* @__PURE__ */
|
|
722
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
719
723
|
/* @__PURE__ */ e(
|
|
720
724
|
Z,
|
|
721
725
|
{
|
|
722
|
-
id: ((
|
|
726
|
+
id: ((m = o == null ? void 0 : o.user) == null ? void 0 : m.id) || a.id || "unknown",
|
|
723
727
|
name: l,
|
|
724
728
|
image: h,
|
|
725
729
|
size: 40
|
|
@@ -740,8 +744,8 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
740
744
|
}
|
|
741
745
|
)
|
|
742
746
|
] }),
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
747
|
+
/* @__PURE__ */ i("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
|
|
748
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
745
749
|
s && t && /* @__PURE__ */ e(
|
|
746
750
|
"button",
|
|
747
751
|
{
|
|
@@ -755,7 +759,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
755
759
|
/* @__PURE__ */ e(
|
|
756
760
|
Z,
|
|
757
761
|
{
|
|
758
|
-
id: ((E =
|
|
762
|
+
id: ((E = o == null ? void 0 : o.user) == null ? void 0 : E.id) || a.id || "unknown",
|
|
759
763
|
name: l,
|
|
760
764
|
image: h,
|
|
761
765
|
size: 40
|
|
@@ -781,19 +785,19 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
781
785
|
participant: n,
|
|
782
786
|
channel: r,
|
|
783
787
|
followerStatusLabel: a,
|
|
784
|
-
onLeaveConversation:
|
|
788
|
+
onLeaveConversation: o,
|
|
785
789
|
onBlockParticipant: l,
|
|
786
790
|
showDeleteConversation: h = !0,
|
|
787
791
|
onDeleteConversationClick: f,
|
|
788
792
|
onBlockParticipantClick: g,
|
|
789
|
-
onReportParticipantClick:
|
|
793
|
+
onReportParticipantClick: v
|
|
790
794
|
}) => {
|
|
791
795
|
var q, Q, X, K, ce, j, V;
|
|
792
|
-
const { service:
|
|
796
|
+
const { service: m, debug: E } = ie(), [R, I] = y(!1), [w, N] = y(!1), [u, b] = y(!1), S = _(async () => {
|
|
793
797
|
var F;
|
|
794
|
-
if (!(!
|
|
798
|
+
if (!(!m || !((F = n == null ? void 0 : n.user) != null && F.id)))
|
|
795
799
|
try {
|
|
796
|
-
const U = (await
|
|
800
|
+
const U = (await m.getBlockedUsers()).some(
|
|
797
801
|
($) => {
|
|
798
802
|
var Y;
|
|
799
803
|
return $.blocked_user_id === ((Y = n == null ? void 0 : n.user) == null ? void 0 : Y.id);
|
|
@@ -806,7 +810,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
806
810
|
D
|
|
807
811
|
);
|
|
808
812
|
}
|
|
809
|
-
}, [
|
|
813
|
+
}, [m, (q = n == null ? void 0 : n.user) == null ? void 0 : q.id]);
|
|
810
814
|
G(() => {
|
|
811
815
|
S();
|
|
812
816
|
}, [S]);
|
|
@@ -816,7 +820,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
816
820
|
f == null || f(), E && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
|
|
817
821
|
try {
|
|
818
822
|
const D = ((F = r._client) == null ? void 0 : F.userID) ?? null;
|
|
819
|
-
await r.hide(D, !1),
|
|
823
|
+
await r.hide(D, !1), o && await o(r), s();
|
|
820
824
|
} catch (D) {
|
|
821
825
|
console.error("[ChannelInfoDialog] Failed to leave conversation", D);
|
|
822
826
|
} finally {
|
|
@@ -825,30 +829,30 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
825
829
|
}
|
|
826
830
|
}, T = async () => {
|
|
827
831
|
var F, D, U;
|
|
828
|
-
if (!(
|
|
832
|
+
if (!(u || !m)) {
|
|
829
833
|
g == null || g(), E && console.log("[ChannelInfoDialog] Block member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), b(!0);
|
|
830
834
|
try {
|
|
831
|
-
await
|
|
835
|
+
await m.blockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
832
836
|
} catch ($) {
|
|
833
837
|
console.error("[ChannelInfoDialog] Failed to block member", $);
|
|
834
838
|
} finally {
|
|
835
839
|
b(!1);
|
|
836
840
|
}
|
|
837
841
|
}
|
|
838
|
-
},
|
|
842
|
+
}, c = async () => {
|
|
839
843
|
var F, D, U;
|
|
840
|
-
if (!(
|
|
844
|
+
if (!(u || !m)) {
|
|
841
845
|
g == null || g(), E && console.log("[ChannelInfoDialog] Unblock member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), b(!0);
|
|
842
846
|
try {
|
|
843
|
-
await
|
|
847
|
+
await m.unBlockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
844
848
|
} catch ($) {
|
|
845
849
|
console.error("[ChannelInfoDialog] Failed to unblock member", $);
|
|
846
850
|
} finally {
|
|
847
851
|
b(!1);
|
|
848
852
|
}
|
|
849
853
|
}
|
|
850
|
-
},
|
|
851
|
-
|
|
854
|
+
}, d = () => {
|
|
855
|
+
v == null || v(), s(), window.open(
|
|
852
856
|
"https://linktr.ee/s/about/trust-center/report",
|
|
853
857
|
"_blank",
|
|
854
858
|
"noopener,noreferrer"
|
|
@@ -867,18 +871,18 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
867
871
|
onClick: (F) => {
|
|
868
872
|
F.target === t.current && s();
|
|
869
873
|
},
|
|
870
|
-
children: /* @__PURE__ */
|
|
871
|
-
/* @__PURE__ */
|
|
874
|
+
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: [
|
|
875
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
872
876
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
873
|
-
/* @__PURE__ */ e(
|
|
877
|
+
/* @__PURE__ */ e(_e, { onClick: s })
|
|
874
878
|
] }),
|
|
875
|
-
/* @__PURE__ */
|
|
879
|
+
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
876
880
|
/* @__PURE__ */ e(
|
|
877
881
|
"div",
|
|
878
882
|
{
|
|
879
883
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
880
884
|
style: { backgroundColor: "#FBFAF9" },
|
|
881
|
-
children: /* @__PURE__ */
|
|
885
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
882
886
|
/* @__PURE__ */ e(
|
|
883
887
|
Z,
|
|
884
888
|
{
|
|
@@ -889,7 +893,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
889
893
|
shape: "circle"
|
|
890
894
|
}
|
|
891
895
|
),
|
|
892
|
-
/* @__PURE__ */
|
|
896
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
893
897
|
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: x }),
|
|
894
898
|
J && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: J }),
|
|
895
899
|
a && /* @__PURE__ */ e(
|
|
@@ -910,8 +914,8 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
910
914
|
] })
|
|
911
915
|
}
|
|
912
916
|
),
|
|
913
|
-
/* @__PURE__ */
|
|
914
|
-
h && /* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
917
|
+
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
918
|
+
h && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
915
919
|
ne,
|
|
916
920
|
{
|
|
917
921
|
onClick: p,
|
|
@@ -923,30 +927,30 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
923
927
|
]
|
|
924
928
|
}
|
|
925
929
|
) }),
|
|
926
|
-
/* @__PURE__ */ e("li", { children: R ? /* @__PURE__ */
|
|
930
|
+
/* @__PURE__ */ e("li", { children: R ? /* @__PURE__ */ i(
|
|
927
931
|
ne,
|
|
928
932
|
{
|
|
929
|
-
onClick:
|
|
930
|
-
disabled:
|
|
931
|
-
"aria-busy":
|
|
933
|
+
onClick: c,
|
|
934
|
+
disabled: u,
|
|
935
|
+
"aria-busy": u,
|
|
932
936
|
children: [
|
|
933
|
-
|
|
937
|
+
u ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(be, { className: "h-5 w-5" }),
|
|
934
938
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
935
939
|
]
|
|
936
940
|
}
|
|
937
|
-
) : /* @__PURE__ */
|
|
941
|
+
) : /* @__PURE__ */ i(
|
|
938
942
|
ne,
|
|
939
943
|
{
|
|
940
944
|
onClick: T,
|
|
941
|
-
disabled:
|
|
942
|
-
"aria-busy":
|
|
945
|
+
disabled: u,
|
|
946
|
+
"aria-busy": u,
|
|
943
947
|
children: [
|
|
944
|
-
|
|
948
|
+
u ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(be, { className: "h-5 w-5" }),
|
|
945
949
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
946
950
|
]
|
|
947
951
|
}
|
|
948
952
|
) }),
|
|
949
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
953
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ne, { variant: "danger", onClick: d, children: [
|
|
950
954
|
/* @__PURE__ */ e(ls, { className: "h-5 w-5" }),
|
|
951
955
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
952
956
|
] }) })
|
|
@@ -962,33 +966,33 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
962
966
|
renderMessageInputActions: n,
|
|
963
967
|
onLeaveConversation: r,
|
|
964
968
|
onBlockParticipant: a,
|
|
965
|
-
showDeleteConversation:
|
|
969
|
+
showDeleteConversation: o = !0,
|
|
966
970
|
onDeleteConversationClick: l,
|
|
967
971
|
onBlockParticipantClick: h,
|
|
968
972
|
onReportParticipantClick: f,
|
|
969
973
|
pendingAttachment: g,
|
|
970
|
-
onClearPendingAttachment:
|
|
974
|
+
onClearPendingAttachment: v
|
|
971
975
|
}) => {
|
|
972
|
-
const { channel:
|
|
976
|
+
const { channel: m } = ue(), E = z(null), R = P.useMemo(() => Object.values(m.state.members || {}).find(
|
|
973
977
|
(b) => {
|
|
974
978
|
var S;
|
|
975
|
-
return ((S = b.user) == null ? void 0 : S.id) && b.user.id !==
|
|
979
|
+
return ((S = b.user) == null ? void 0 : S.id) && b.user.id !== m._client.userID;
|
|
976
980
|
}
|
|
977
|
-
), [
|
|
978
|
-
const
|
|
979
|
-
if (
|
|
980
|
-
return String(
|
|
981
|
-
if (
|
|
982
|
-
return
|
|
983
|
-
}, [
|
|
984
|
-
var
|
|
985
|
-
(
|
|
981
|
+
), [m._client.userID, m.state.members]), I = P.useMemo(() => {
|
|
982
|
+
const u = m.data ?? {};
|
|
983
|
+
if (u.followerStatus)
|
|
984
|
+
return String(u.followerStatus);
|
|
985
|
+
if (u.isFollower !== void 0)
|
|
986
|
+
return u.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
987
|
+
}, [m.data]), w = _(() => {
|
|
988
|
+
var u;
|
|
989
|
+
(u = E.current) == null || u.showModal();
|
|
986
990
|
}, []), N = _(() => {
|
|
987
|
-
var
|
|
988
|
-
(
|
|
991
|
+
var u;
|
|
992
|
+
(u = E.current) == null || u.close();
|
|
989
993
|
}, []);
|
|
990
|
-
return /* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
994
|
+
return /* @__PURE__ */ i(we, { children: [
|
|
995
|
+
/* @__PURE__ */ i(ss, { children: [
|
|
992
996
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
993
997
|
ws,
|
|
994
998
|
{
|
|
@@ -1009,9 +1013,9 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1009
1013
|
/* @__PURE__ */ e(
|
|
1010
1014
|
bs,
|
|
1011
1015
|
{
|
|
1012
|
-
renderActions: () => n == null ? void 0 : n(
|
|
1016
|
+
renderActions: () => n == null ? void 0 : n(m),
|
|
1013
1017
|
pendingAttachment: g,
|
|
1014
|
-
onClearPendingAttachment:
|
|
1018
|
+
onClearPendingAttachment: v
|
|
1015
1019
|
}
|
|
1016
1020
|
)
|
|
1017
1021
|
] }),
|
|
@@ -1021,31 +1025,31 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1021
1025
|
dialogRef: E,
|
|
1022
1026
|
onClose: N,
|
|
1023
1027
|
participant: R,
|
|
1024
|
-
channel:
|
|
1028
|
+
channel: m,
|
|
1025
1029
|
followerStatusLabel: I,
|
|
1026
1030
|
onLeaveConversation: r,
|
|
1027
1031
|
onBlockParticipant: a,
|
|
1028
|
-
showDeleteConversation:
|
|
1032
|
+
showDeleteConversation: o,
|
|
1029
1033
|
onDeleteConversationClick: l,
|
|
1030
1034
|
onBlockParticipantClick: h,
|
|
1031
1035
|
onReportParticipantClick: f
|
|
1032
1036
|
}
|
|
1033
1037
|
)
|
|
1034
1038
|
] });
|
|
1035
|
-
},
|
|
1039
|
+
}, Me = P.memo(
|
|
1036
1040
|
({
|
|
1037
1041
|
channel: t,
|
|
1038
1042
|
onBack: s,
|
|
1039
1043
|
showBackButton: n = !1,
|
|
1040
1044
|
renderMessageInputActions: r,
|
|
1041
1045
|
onLeaveConversation: a,
|
|
1042
|
-
onBlockParticipant:
|
|
1046
|
+
onBlockParticipant: o,
|
|
1043
1047
|
className: l,
|
|
1044
|
-
CustomChannelEmptyState: h =
|
|
1048
|
+
CustomChannelEmptyState: h = Cs,
|
|
1045
1049
|
showDeleteConversation: f = !0,
|
|
1046
1050
|
onDeleteConversationClick: g,
|
|
1047
|
-
onBlockParticipantClick:
|
|
1048
|
-
onReportParticipantClick:
|
|
1051
|
+
onBlockParticipantClick: v,
|
|
1052
|
+
onReportParticipantClick: m,
|
|
1049
1053
|
pendingAttachment: E,
|
|
1050
1054
|
onClearPendingAttachment: R
|
|
1051
1055
|
}) => /* @__PURE__ */ e(
|
|
@@ -1069,12 +1073,12 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1069
1073
|
showBackButton: n,
|
|
1070
1074
|
renderMessageInputActions: r,
|
|
1071
1075
|
onLeaveConversation: a,
|
|
1072
|
-
onBlockParticipant:
|
|
1076
|
+
onBlockParticipant: o,
|
|
1073
1077
|
CustomChannelEmptyState: h,
|
|
1074
1078
|
showDeleteConversation: f,
|
|
1075
1079
|
onDeleteConversationClick: g,
|
|
1076
|
-
onBlockParticipantClick:
|
|
1077
|
-
onReportParticipantClick:
|
|
1080
|
+
onBlockParticipantClick: v,
|
|
1081
|
+
onReportParticipantClick: m,
|
|
1078
1082
|
pendingAttachment: E,
|
|
1079
1083
|
onClearPendingAttachment: R
|
|
1080
1084
|
}
|
|
@@ -1084,14 +1088,14 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1084
1088
|
}
|
|
1085
1089
|
)
|
|
1086
1090
|
);
|
|
1087
|
-
|
|
1091
|
+
Me.displayName = "ChannelView";
|
|
1088
1092
|
function Is({
|
|
1089
1093
|
searchQuery: t,
|
|
1090
1094
|
setSearchQuery: s,
|
|
1091
1095
|
placeholder: n
|
|
1092
1096
|
}) {
|
|
1093
1097
|
const r = z(null);
|
|
1094
|
-
return /* @__PURE__ */
|
|
1098
|
+
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1095
1099
|
/* @__PURE__ */ e(
|
|
1096
1100
|
as,
|
|
1097
1101
|
{
|
|
@@ -1111,7 +1115,7 @@ function Is({
|
|
|
1111
1115
|
}
|
|
1112
1116
|
),
|
|
1113
1117
|
t && /* @__PURE__ */ e(
|
|
1114
|
-
|
|
1118
|
+
Re,
|
|
1115
1119
|
{
|
|
1116
1120
|
label: "Clear search",
|
|
1117
1121
|
onClick: () => {
|
|
@@ -1130,10 +1134,10 @@ const Ss = ({
|
|
|
1130
1134
|
onClose: n,
|
|
1131
1135
|
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
1132
1136
|
participantLabel: a = "participants",
|
|
1133
|
-
searchPlaceholder:
|
|
1137
|
+
searchPlaceholder: o = "Search participants...",
|
|
1134
1138
|
className: l
|
|
1135
1139
|
}) => {
|
|
1136
|
-
const { debug: h } = ie(), [f, g] = y(""), [
|
|
1140
|
+
const { debug: h } = ie(), [f, g] = y(""), [v, m] = y([]), [E, R] = y(!1), [I, w] = y(null), [N, u] = y(
|
|
1137
1141
|
null
|
|
1138
1142
|
), b = z(!1);
|
|
1139
1143
|
G(() => {
|
|
@@ -1147,50 +1151,50 @@ const Ss = ({
|
|
|
1147
1151
|
(async () => {
|
|
1148
1152
|
h && console.log("[ParticipantPicker] Loading initial participants..."), R(!0), w(null);
|
|
1149
1153
|
try {
|
|
1150
|
-
const
|
|
1154
|
+
const d = await t.loadParticipants({
|
|
1151
1155
|
search: "",
|
|
1152
1156
|
// Load all participants initially
|
|
1153
1157
|
limit: 100
|
|
1154
1158
|
});
|
|
1155
|
-
d
|
|
1159
|
+
m(d.participants), b.current = !0, h && console.log(
|
|
1156
1160
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1157
|
-
|
|
1161
|
+
d.participants.length
|
|
1158
1162
|
);
|
|
1159
|
-
} catch (
|
|
1160
|
-
const x =
|
|
1161
|
-
w(x), console.error("[ParticipantPicker] Failed to load participants:",
|
|
1163
|
+
} catch (d) {
|
|
1164
|
+
const x = d instanceof Error ? d.message : "Failed to load participants";
|
|
1165
|
+
w(x), console.error("[ParticipantPicker] Failed to load participants:", d);
|
|
1162
1166
|
} finally {
|
|
1163
1167
|
R(!1);
|
|
1164
1168
|
}
|
|
1165
1169
|
})();
|
|
1166
1170
|
}, [t.loading, h]);
|
|
1167
|
-
const S =
|
|
1171
|
+
const S = v.filter((c) => !r.has(c.id)).filter((c) => {
|
|
1168
1172
|
var x;
|
|
1169
1173
|
if (!f) return !0;
|
|
1170
|
-
const
|
|
1171
|
-
return
|
|
1174
|
+
const d = f.toLowerCase();
|
|
1175
|
+
return c.name.toLowerCase().includes(d) || ((x = c.email) == null ? void 0 : x.toLowerCase().includes(d)) || !1;
|
|
1172
1176
|
}), p = _(
|
|
1173
|
-
async (
|
|
1177
|
+
async (c) => {
|
|
1174
1178
|
if (!N) {
|
|
1175
|
-
|
|
1179
|
+
u(c.id);
|
|
1176
1180
|
try {
|
|
1177
|
-
await s(
|
|
1178
|
-
} catch (
|
|
1179
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1181
|
+
await s(c);
|
|
1182
|
+
} catch (d) {
|
|
1183
|
+
console.error("[ParticipantPicker] Failed to start chat:", d), u(null);
|
|
1180
1184
|
}
|
|
1181
1185
|
}
|
|
1182
1186
|
},
|
|
1183
1187
|
[s, N]
|
|
1184
|
-
), T = (
|
|
1185
|
-
(
|
|
1188
|
+
), T = (c, d) => {
|
|
1189
|
+
(c.key === "Enter" || c.key === " ") && (c.preventDefault(), p(d));
|
|
1186
1190
|
};
|
|
1187
|
-
return /* @__PURE__ */
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1191
|
+
return /* @__PURE__ */ i("div", { className: k("flex flex-col h-full", l), children: [
|
|
1192
|
+
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1193
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1190
1194
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1191
|
-
/* @__PURE__ */ e(
|
|
1195
|
+
/* @__PURE__ */ e(_e, { onClick: n })
|
|
1192
1196
|
] }),
|
|
1193
|
-
/* @__PURE__ */
|
|
1197
|
+
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1194
1198
|
"Select a ",
|
|
1195
1199
|
a.slice(0, -1),
|
|
1196
1200
|
" to start messaging (",
|
|
@@ -1203,65 +1207,65 @@ const Ss = ({
|
|
|
1203
1207
|
{
|
|
1204
1208
|
searchQuery: f,
|
|
1205
1209
|
setSearchQuery: g,
|
|
1206
|
-
placeholder:
|
|
1210
|
+
placeholder: o
|
|
1207
1211
|
}
|
|
1208
1212
|
)
|
|
1209
1213
|
] }),
|
|
1210
|
-
I && /* @__PURE__ */
|
|
1214
|
+
I && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1211
1215
|
"Error loading ",
|
|
1212
1216
|
a,
|
|
1213
1217
|
": ",
|
|
1214
1218
|
I
|
|
1215
1219
|
] }),
|
|
1216
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: E && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */
|
|
1220
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: E && S.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: [
|
|
1217
1221
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1218
|
-
/* @__PURE__ */
|
|
1222
|
+
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1219
1223
|
"Loading ",
|
|
1220
1224
|
a,
|
|
1221
1225
|
"..."
|
|
1222
1226
|
] })
|
|
1223
|
-
] }) }) : S.length === 0 ? /* @__PURE__ */
|
|
1227
|
+
] }) }) : S.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1224
1228
|
/* @__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" }) }),
|
|
1225
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: f ? `No ${a} found` :
|
|
1226
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: f ? "Try a different search term" :
|
|
1227
|
-
] }) : /* @__PURE__ */
|
|
1228
|
-
S.map((
|
|
1229
|
-
const
|
|
1229
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: f ? `No ${a} found` : v.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
|
|
1230
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: f ? "Try a different search term" : v.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
|
|
1231
|
+
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1232
|
+
S.map((c) => {
|
|
1233
|
+
const d = c.name || c.email || c.id, x = c.email && c.name ? c.email : c.phone;
|
|
1230
1234
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1231
1235
|
"button",
|
|
1232
1236
|
{
|
|
1233
1237
|
type: "button",
|
|
1234
|
-
onClick: () => p(
|
|
1235
|
-
onKeyDown: (B) => T(B,
|
|
1238
|
+
onClick: () => p(c),
|
|
1239
|
+
onKeyDown: (B) => T(B, c),
|
|
1236
1240
|
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",
|
|
1237
|
-
children: /* @__PURE__ */
|
|
1238
|
-
/* @__PURE__ */
|
|
1241
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1242
|
+
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1239
1243
|
/* @__PURE__ */ e(
|
|
1240
1244
|
Z,
|
|
1241
1245
|
{
|
|
1242
|
-
id:
|
|
1243
|
-
name:
|
|
1244
|
-
image:
|
|
1246
|
+
id: c.id,
|
|
1247
|
+
name: d,
|
|
1248
|
+
image: c.image,
|
|
1245
1249
|
size: 40
|
|
1246
1250
|
}
|
|
1247
1251
|
),
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1252
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1253
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: d }),
|
|
1250
1254
|
x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
|
|
1251
1255
|
] })
|
|
1252
1256
|
] }),
|
|
1253
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N ===
|
|
1257
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === c.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
|
|
1254
1258
|
] })
|
|
1255
1259
|
}
|
|
1256
|
-
) },
|
|
1260
|
+
) }, c.id);
|
|
1257
1261
|
}),
|
|
1258
|
-
E && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */
|
|
1262
|
+
E && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1259
1263
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1260
1264
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1261
1265
|
] }) })
|
|
1262
1266
|
] }) })
|
|
1263
1267
|
] });
|
|
1264
|
-
}, ps = ({ className: t }) => /* @__PURE__ */
|
|
1268
|
+
}, ps = ({ className: t }) => /* @__PURE__ */ i(
|
|
1265
1269
|
"svg",
|
|
1266
1270
|
{
|
|
1267
1271
|
width: "140",
|
|
@@ -1271,7 +1275,7 @@ const Ss = ({
|
|
|
1271
1275
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1272
1276
|
className: t,
|
|
1273
1277
|
children: [
|
|
1274
|
-
/* @__PURE__ */
|
|
1278
|
+
/* @__PURE__ */ i("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1275
1279
|
/* @__PURE__ */ e(
|
|
1276
1280
|
"path",
|
|
1277
1281
|
{
|
|
@@ -1300,7 +1304,7 @@ const Ss = ({
|
|
|
1300
1304
|
fill: "white"
|
|
1301
1305
|
}
|
|
1302
1306
|
),
|
|
1303
|
-
/* @__PURE__ */
|
|
1307
|
+
/* @__PURE__ */ i("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1304
1308
|
/* @__PURE__ */ e(
|
|
1305
1309
|
"path",
|
|
1306
1310
|
{
|
|
@@ -1340,8 +1344,8 @@ const Ss = ({
|
|
|
1340
1344
|
}
|
|
1341
1345
|
)
|
|
1342
1346
|
] }),
|
|
1343
|
-
/* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1347
|
+
/* @__PURE__ */ i("defs", { children: [
|
|
1348
|
+
/* @__PURE__ */ i(
|
|
1345
1349
|
"filter",
|
|
1346
1350
|
{
|
|
1347
1351
|
id: "filter0_empty_state",
|
|
@@ -1395,17 +1399,17 @@ const Ss = ({
|
|
|
1395
1399
|
] })
|
|
1396
1400
|
]
|
|
1397
1401
|
}
|
|
1398
|
-
),
|
|
1399
|
-
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */
|
|
1402
|
+
), Fe = P.memo(
|
|
1403
|
+
({ 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: [
|
|
1400
1404
|
/* @__PURE__ */ e(ps, {}),
|
|
1401
|
-
s && !t && /* @__PURE__ */
|
|
1405
|
+
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1402
1406
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1403
1407
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1404
1408
|
] })
|
|
1405
1409
|
] }) })
|
|
1406
1410
|
);
|
|
1407
|
-
|
|
1408
|
-
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__ */
|
|
1411
|
+
Fe.displayName = "EmptyState";
|
|
1412
|
+
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: [
|
|
1409
1413
|
/* @__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: "โ ๏ธ" }) }),
|
|
1410
1414
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1411
1415
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1426,13 +1430,13 @@ const Us = ({
|
|
|
1426
1430
|
renderMessageInputActions: n,
|
|
1427
1431
|
onChannelSelect: r,
|
|
1428
1432
|
onParticipantSelect: a,
|
|
1429
|
-
initialParticipantFilter:
|
|
1433
|
+
initialParticipantFilter: o,
|
|
1430
1434
|
initialParticipantData: l,
|
|
1431
1435
|
CustomChannelEmptyState: h,
|
|
1432
1436
|
showChannelList: f = !0,
|
|
1433
1437
|
filters: g,
|
|
1434
|
-
channelListCustomEmptyStateIndicator:
|
|
1435
|
-
onDeleteConversationClick:
|
|
1438
|
+
channelListCustomEmptyStateIndicator: v,
|
|
1439
|
+
onDeleteConversationClick: m,
|
|
1436
1440
|
onBlockParticipantClick: E,
|
|
1437
1441
|
onReportParticipantClick: R,
|
|
1438
1442
|
pendingAttachment: I,
|
|
@@ -1440,87 +1444,87 @@ const Us = ({
|
|
|
1440
1444
|
}) => {
|
|
1441
1445
|
const {
|
|
1442
1446
|
service: N,
|
|
1443
|
-
client:
|
|
1447
|
+
client: u,
|
|
1444
1448
|
isConnected: b,
|
|
1445
1449
|
isLoading: S,
|
|
1446
1450
|
error: p,
|
|
1447
1451
|
refreshConnection: T,
|
|
1448
|
-
debug:
|
|
1449
|
-
} = os(), [
|
|
1452
|
+
debug: c
|
|
1453
|
+
} = os(), [d, x] = y(null), [B, A] = y(!1), [H, J] = y(!1), [he, q] = y(!1), [Q, X] = y(/* @__PURE__ */ new Set()), [K, ce] = y(0), [j, V] = y(!1), [F, D] = y(null), U = z(null), {
|
|
1450
1454
|
participantSource: $,
|
|
1451
1455
|
participantLabel: Y = "participants",
|
|
1452
|
-
showDeleteConversation:
|
|
1453
|
-
} = t,
|
|
1454
|
-
const
|
|
1456
|
+
showDeleteConversation: Te = !0
|
|
1457
|
+
} = t, Le = P.useMemo(() => {
|
|
1458
|
+
const C = u == null ? void 0 : u.userID;
|
|
1455
1459
|
return {
|
|
1456
1460
|
...{
|
|
1457
1461
|
type: "messaging",
|
|
1458
1462
|
last_message_at: { $exists: !0 },
|
|
1459
|
-
...
|
|
1460
|
-
members: { $in: [
|
|
1463
|
+
...C && {
|
|
1464
|
+
members: { $in: [C] },
|
|
1461
1465
|
hidden: !1
|
|
1462
1466
|
}
|
|
1463
1467
|
},
|
|
1464
1468
|
...g
|
|
1465
1469
|
};
|
|
1466
|
-
}, [g,
|
|
1467
|
-
if (!
|
|
1468
|
-
const
|
|
1469
|
-
if (
|
|
1470
|
+
}, [g, u == null ? void 0 : u.userID]), ee = z(null), W = _(async () => {
|
|
1471
|
+
if (!u || !b) return;
|
|
1472
|
+
const C = u.userID;
|
|
1473
|
+
if (C)
|
|
1470
1474
|
try {
|
|
1471
|
-
|
|
1472
|
-
const O = await
|
|
1475
|
+
c && console.log("[MessagingShell] Syncing channels for user:", C);
|
|
1476
|
+
const O = await u.queryChannels(
|
|
1473
1477
|
{
|
|
1474
1478
|
type: "messaging",
|
|
1475
|
-
members: { $in: [
|
|
1479
|
+
members: { $in: [C] }
|
|
1476
1480
|
},
|
|
1477
1481
|
{},
|
|
1478
1482
|
{ limit: 100 }
|
|
1479
1483
|
), M = /* @__PURE__ */ new Set();
|
|
1480
1484
|
O.forEach((L) => {
|
|
1481
1485
|
const de = L.state.members;
|
|
1482
|
-
Object.values(de).forEach((
|
|
1486
|
+
Object.values(de).forEach((Be) => {
|
|
1483
1487
|
var fe;
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1488
|
+
const me = (fe = Be.user) == null ? void 0 : fe.id;
|
|
1489
|
+
me && me !== C && M.add(me);
|
|
1486
1490
|
});
|
|
1487
|
-
}), X((L) => L.size === M.size && [...L].every((de) => M.has(de)) ? L : M), A(O.length > 0), J(!0), ee.current =
|
|
1491
|
+
}), X((L) => L.size === M.size && [...L].every((de) => M.has(de)) ? L : M), A(O.length > 0), J(!0), ee.current = C, c && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1488
1492
|
channelCount: O.length,
|
|
1489
1493
|
memberCount: M.size
|
|
1490
1494
|
});
|
|
1491
1495
|
} catch (O) {
|
|
1492
1496
|
console.error("[MessagingShell] Failed to sync channels:", O);
|
|
1493
1497
|
}
|
|
1494
|
-
}, [
|
|
1498
|
+
}, [u, b, c]);
|
|
1495
1499
|
G(() => {
|
|
1496
|
-
if (!
|
|
1497
|
-
const
|
|
1498
|
-
|
|
1499
|
-
}, [
|
|
1500
|
-
if (!
|
|
1500
|
+
if (!u || !b) return;
|
|
1501
|
+
const C = u.userID;
|
|
1502
|
+
C && ee.current !== C && W();
|
|
1503
|
+
}, [u, b, W]), G(() => {
|
|
1504
|
+
if (!o || !u || !b) return;
|
|
1501
1505
|
(async () => {
|
|
1502
|
-
const O =
|
|
1506
|
+
const O = u.userID;
|
|
1503
1507
|
if (O)
|
|
1504
1508
|
try {
|
|
1505
|
-
|
|
1509
|
+
c && console.log(
|
|
1506
1510
|
"[MessagingShell] Loading initial conversation with:",
|
|
1507
|
-
|
|
1511
|
+
o
|
|
1508
1512
|
);
|
|
1509
|
-
const M = await
|
|
1513
|
+
const M = await u.queryChannels(
|
|
1510
1514
|
{
|
|
1511
1515
|
type: "messaging",
|
|
1512
|
-
members: { $eq: [O,
|
|
1516
|
+
members: { $eq: [O, o] }
|
|
1513
1517
|
},
|
|
1514
1518
|
{},
|
|
1515
1519
|
{ limit: 1 }
|
|
1516
1520
|
);
|
|
1517
1521
|
if (M.length > 0)
|
|
1518
|
-
x(M[0]), V(!0), D(null), r && r(M[0]),
|
|
1522
|
+
x(M[0]), V(!0), D(null), r && r(M[0]), c && console.log(
|
|
1519
1523
|
"[MessagingShell] Initial conversation loaded:",
|
|
1520
1524
|
M[0].id
|
|
1521
1525
|
);
|
|
1522
1526
|
else if (l && N) {
|
|
1523
|
-
|
|
1527
|
+
c && console.log(
|
|
1524
1528
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1525
1529
|
l
|
|
1526
1530
|
);
|
|
@@ -1531,7 +1535,7 @@ const Us = ({
|
|
|
1531
1535
|
email: l.email,
|
|
1532
1536
|
phone: l.phone
|
|
1533
1537
|
});
|
|
1534
|
-
x(L), V(!0), D(null), r && r(L),
|
|
1538
|
+
x(L), V(!0), D(null), r && r(L), c && console.log(
|
|
1535
1539
|
"[MessagingShell] Channel created and loaded:",
|
|
1536
1540
|
L.id
|
|
1537
1541
|
);
|
|
@@ -1544,9 +1548,9 @@ const Us = ({
|
|
|
1544
1548
|
} else
|
|
1545
1549
|
D(
|
|
1546
1550
|
"No conversation found with this account"
|
|
1547
|
-
),
|
|
1551
|
+
), c && console.log(
|
|
1548
1552
|
"[MessagingShell] No conversation found for:",
|
|
1549
|
-
|
|
1553
|
+
o
|
|
1550
1554
|
);
|
|
1551
1555
|
} catch (M) {
|
|
1552
1556
|
console.error(
|
|
@@ -1556,73 +1560,73 @@ const Us = ({
|
|
|
1556
1560
|
}
|
|
1557
1561
|
})();
|
|
1558
1562
|
}, [
|
|
1559
|
-
|
|
1563
|
+
o,
|
|
1560
1564
|
l,
|
|
1561
|
-
|
|
1565
|
+
u,
|
|
1562
1566
|
b,
|
|
1563
1567
|
N,
|
|
1564
|
-
|
|
1568
|
+
c,
|
|
1565
1569
|
r
|
|
1566
1570
|
]);
|
|
1567
|
-
const
|
|
1568
|
-
(
|
|
1569
|
-
x(
|
|
1571
|
+
const Pe = _(
|
|
1572
|
+
(C) => {
|
|
1573
|
+
x(C), r == null || r(C);
|
|
1570
1574
|
},
|
|
1571
1575
|
[r]
|
|
1572
|
-
),
|
|
1576
|
+
), Ue = _(() => {
|
|
1573
1577
|
j || x(null);
|
|
1574
|
-
}, [j]),
|
|
1575
|
-
async (
|
|
1578
|
+
}, [j]), Oe = _(
|
|
1579
|
+
async (C) => {
|
|
1576
1580
|
var O;
|
|
1577
1581
|
if (N)
|
|
1578
1582
|
try {
|
|
1579
|
-
|
|
1583
|
+
c && console.log(
|
|
1580
1584
|
"[MessagingShell] Starting conversation with:",
|
|
1581
|
-
|
|
1585
|
+
C.id
|
|
1582
1586
|
);
|
|
1583
1587
|
const M = await N.startChannelWithParticipant({
|
|
1584
|
-
id:
|
|
1585
|
-
name:
|
|
1586
|
-
email:
|
|
1587
|
-
phone:
|
|
1588
|
+
id: C.id,
|
|
1589
|
+
name: C.name,
|
|
1590
|
+
email: C.email,
|
|
1591
|
+
phone: C.phone
|
|
1588
1592
|
});
|
|
1589
1593
|
try {
|
|
1590
1594
|
await M.show();
|
|
1591
1595
|
} catch (L) {
|
|
1592
1596
|
console.warn("[MessagingShell] Failed to unhide channel:", L);
|
|
1593
1597
|
}
|
|
1594
|
-
x(M), q(!1), (O = U.current) == null || O.close(), a == null || a(
|
|
1598
|
+
x(M), q(!1), (O = U.current) == null || O.close(), a == null || a(C);
|
|
1595
1599
|
} catch (M) {
|
|
1596
1600
|
console.error("[MessagingShell] Failed to start conversation:", M);
|
|
1597
1601
|
}
|
|
1598
1602
|
},
|
|
1599
|
-
[N, a,
|
|
1603
|
+
[N, a, c]
|
|
1600
1604
|
), se = _(() => {
|
|
1601
|
-
var
|
|
1602
|
-
q(!1), (
|
|
1603
|
-
}, []),
|
|
1604
|
-
(
|
|
1605
|
-
|
|
1605
|
+
var C;
|
|
1606
|
+
q(!1), (C = U.current) == null || C.close();
|
|
1607
|
+
}, []), je = _(
|
|
1608
|
+
(C) => {
|
|
1609
|
+
C.target === U.current && se();
|
|
1606
1610
|
},
|
|
1607
1611
|
[se]
|
|
1608
|
-
), je = _(
|
|
1609
|
-
async (v) => {
|
|
1610
|
-
i && console.log("[MessagingShell] Leaving conversation:", v.id), x(null), V(!1), ee.current = null, await W();
|
|
1611
|
-
},
|
|
1612
|
-
[W, i]
|
|
1613
1612
|
), Ae = _(
|
|
1614
|
-
async (
|
|
1615
|
-
|
|
1613
|
+
async (C) => {
|
|
1614
|
+
c && console.log("[MessagingShell] Leaving conversation:", C.id), x(null), V(!1), ee.current = null, await W();
|
|
1616
1615
|
},
|
|
1617
|
-
[W,
|
|
1618
|
-
),
|
|
1619
|
-
|
|
1616
|
+
[W, c]
|
|
1617
|
+
), ze = _(
|
|
1618
|
+
async (C) => {
|
|
1619
|
+
c && console.log("[MessagingShell] Blocking participant:", C), x(null), V(!1), ee.current = null, await W();
|
|
1620
|
+
},
|
|
1621
|
+
[W, c]
|
|
1622
|
+
), te = !!d;
|
|
1623
|
+
return S ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(ae, {}) }) : p ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: p, onBack: T }) }) : !b || !u ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(
|
|
1620
1624
|
le,
|
|
1621
1625
|
{
|
|
1622
1626
|
message: "Not connected to messaging service",
|
|
1623
1627
|
onBack: T
|
|
1624
1628
|
}
|
|
1625
|
-
) }) : F ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: F }) }) : /* @__PURE__ */
|
|
1629
|
+
) }) : F ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: F }) }) : /* @__PURE__ */ i(
|
|
1626
1630
|
"div",
|
|
1627
1631
|
{
|
|
1628
1632
|
className: k(
|
|
@@ -1630,7 +1634,7 @@ const Us = ({
|
|
|
1630
1634
|
s
|
|
1631
1635
|
),
|
|
1632
1636
|
children: [
|
|
1633
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ i("div", { className: "flex h-full min-h-0", children: [
|
|
1634
1638
|
/* @__PURE__ */ e(
|
|
1635
1639
|
"div",
|
|
1636
1640
|
{
|
|
@@ -1645,12 +1649,12 @@ const Us = ({
|
|
|
1645
1649
|
}
|
|
1646
1650
|
),
|
|
1647
1651
|
children: /* @__PURE__ */ e(
|
|
1648
|
-
|
|
1652
|
+
ke,
|
|
1649
1653
|
{
|
|
1650
|
-
onChannelSelect:
|
|
1651
|
-
selectedChannel:
|
|
1652
|
-
filters:
|
|
1653
|
-
customEmptyStateIndicator:
|
|
1654
|
+
onChannelSelect: Pe,
|
|
1655
|
+
selectedChannel: d || void 0,
|
|
1656
|
+
filters: Le,
|
|
1657
|
+
customEmptyStateIndicator: v
|
|
1654
1658
|
}
|
|
1655
1659
|
)
|
|
1656
1660
|
}
|
|
@@ -1662,34 +1666,34 @@ const Us = ({
|
|
|
1662
1666
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1663
1667
|
{
|
|
1664
1668
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1665
|
-
flex: j || te ||
|
|
1669
|
+
flex: j || te || o,
|
|
1666
1670
|
// Normal mode: hide on mobile when no channel selected
|
|
1667
|
-
"hidden lg:flex": !j && !te && !
|
|
1671
|
+
"hidden lg:flex": !j && !te && !o
|
|
1668
1672
|
}
|
|
1669
1673
|
),
|
|
1670
|
-
children:
|
|
1671
|
-
|
|
1674
|
+
children: d ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1675
|
+
Me,
|
|
1672
1676
|
{
|
|
1673
|
-
channel:
|
|
1674
|
-
onBack:
|
|
1677
|
+
channel: d,
|
|
1678
|
+
onBack: Ue,
|
|
1675
1679
|
showBackButton: !j,
|
|
1676
1680
|
renderMessageInputActions: n,
|
|
1677
|
-
onLeaveConversation:
|
|
1678
|
-
onBlockParticipant:
|
|
1681
|
+
onLeaveConversation: Ae,
|
|
1682
|
+
onBlockParticipant: ze,
|
|
1679
1683
|
CustomChannelEmptyState: h,
|
|
1680
|
-
showDeleteConversation:
|
|
1681
|
-
onDeleteConversationClick:
|
|
1684
|
+
showDeleteConversation: Te,
|
|
1685
|
+
onDeleteConversationClick: m,
|
|
1682
1686
|
onBlockParticipantClick: E,
|
|
1683
1687
|
onReportParticipantClick: R,
|
|
1684
1688
|
pendingAttachment: I,
|
|
1685
1689
|
onClearPendingAttachment: w
|
|
1686
1690
|
},
|
|
1687
|
-
|
|
1688
|
-
) }) :
|
|
1691
|
+
d.id
|
|
1692
|
+
) }) : o ? (
|
|
1689
1693
|
// Show loading while creating/loading direct conversation channel
|
|
1690
1694
|
/* @__PURE__ */ e(ae, {})
|
|
1691
1695
|
) : /* @__PURE__ */ e(
|
|
1692
|
-
|
|
1696
|
+
Fe,
|
|
1693
1697
|
{
|
|
1694
1698
|
hasChannels: B,
|
|
1695
1699
|
channelsLoaded: H
|
|
@@ -1704,13 +1708,13 @@ const Us = ({
|
|
|
1704
1708
|
{
|
|
1705
1709
|
ref: U,
|
|
1706
1710
|
className: "mes-dialog",
|
|
1707
|
-
onClick:
|
|
1711
|
+
onClick: je,
|
|
1708
1712
|
onClose: se,
|
|
1709
1713
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1710
1714
|
Ss,
|
|
1711
1715
|
{
|
|
1712
1716
|
participantSource: $,
|
|
1713
|
-
onSelectParticipant:
|
|
1717
|
+
onSelectParticipant: Oe,
|
|
1714
1718
|
onClose: se,
|
|
1715
1719
|
existingParticipantIds: Q,
|
|
1716
1720
|
participantLabel: Y,
|
|
@@ -1751,22 +1755,22 @@ const Us = ({
|
|
|
1751
1755
|
loadingFaqId: n,
|
|
1752
1756
|
headerText: r,
|
|
1753
1757
|
className: a,
|
|
1754
|
-
avatarImage:
|
|
1758
|
+
avatarImage: o,
|
|
1755
1759
|
avatarName: l
|
|
1756
1760
|
}) => {
|
|
1757
1761
|
const h = t.filter((f) => f.enabled).sort((f, g) => (f.order ?? 0) - (g.order ?? 0));
|
|
1758
|
-
return h.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */
|
|
1759
|
-
(
|
|
1762
|
+
return h.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1763
|
+
(o || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1760
1764
|
Z,
|
|
1761
1765
|
{
|
|
1762
1766
|
id: l || "account",
|
|
1763
1767
|
name: l || "Account",
|
|
1764
|
-
image:
|
|
1768
|
+
image: o,
|
|
1765
1769
|
size: 24,
|
|
1766
1770
|
shape: "circle"
|
|
1767
1771
|
}
|
|
1768
1772
|
) }),
|
|
1769
|
-
/* @__PURE__ */
|
|
1773
|
+
/* @__PURE__ */ i(
|
|
1770
1774
|
"div",
|
|
1771
1775
|
{
|
|
1772
1776
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
@@ -1787,29 +1791,29 @@ const Us = ({
|
|
|
1787
1791
|
)
|
|
1788
1792
|
] }) });
|
|
1789
1793
|
}, js = (t, s = {}) => {
|
|
1790
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [a,
|
|
1794
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, o] = y([]), [l, h] = y(!1), [f, g] = y(null), [v, m] = y(n), [E, R] = y(!0), [I, w] = y(), N = _(async (p = !1, T) => {
|
|
1791
1795
|
if (l) return;
|
|
1792
|
-
const
|
|
1796
|
+
const c = T !== void 0 ? T : v;
|
|
1793
1797
|
h(!0), g(null);
|
|
1794
1798
|
try {
|
|
1795
|
-
const
|
|
1796
|
-
search:
|
|
1799
|
+
const d = await t.loadParticipants({
|
|
1800
|
+
search: c || void 0,
|
|
1797
1801
|
limit: r,
|
|
1798
1802
|
cursor: p ? void 0 : I
|
|
1799
1803
|
});
|
|
1800
|
-
|
|
1801
|
-
(x) => p ?
|
|
1802
|
-
), R(
|
|
1803
|
-
} catch (
|
|
1804
|
-
const x =
|
|
1805
|
-
g(x), console.error("[useParticipants] Load error:",
|
|
1804
|
+
o(
|
|
1805
|
+
(x) => p ? d.participants : [...x, ...d.participants]
|
|
1806
|
+
), R(d.hasMore), w(d.nextCursor);
|
|
1807
|
+
} catch (d) {
|
|
1808
|
+
const x = d instanceof Error ? d.message : "Failed to load participants";
|
|
1809
|
+
g(x), console.error("[useParticipants] Load error:", d);
|
|
1806
1810
|
} finally {
|
|
1807
1811
|
h(!1);
|
|
1808
1812
|
}
|
|
1809
|
-
}, [t,
|
|
1813
|
+
}, [t, v, I, r, l]), u = _(() => {
|
|
1810
1814
|
E && !l && N(!1);
|
|
1811
1815
|
}, [E, l, N]), b = _((p) => {
|
|
1812
|
-
|
|
1816
|
+
m(p), w(void 0), N(!0, p);
|
|
1813
1817
|
}, [N]), S = _(() => {
|
|
1814
1818
|
w(void 0), N(!0);
|
|
1815
1819
|
}, [N]);
|
|
@@ -1819,19 +1823,19 @@ const Us = ({
|
|
|
1819
1823
|
participants: a,
|
|
1820
1824
|
loading: l,
|
|
1821
1825
|
error: f,
|
|
1822
|
-
searchQuery:
|
|
1826
|
+
searchQuery: v,
|
|
1823
1827
|
hasMore: E,
|
|
1824
1828
|
totalCount: t.totalCount,
|
|
1825
|
-
loadMore:
|
|
1829
|
+
loadMore: u,
|
|
1826
1830
|
search: b,
|
|
1827
1831
|
refresh: S
|
|
1828
1832
|
};
|
|
1829
1833
|
};
|
|
1830
1834
|
export {
|
|
1831
1835
|
Z as Avatar,
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1836
|
+
Cs as ChannelEmptyState,
|
|
1837
|
+
ke as ChannelList,
|
|
1838
|
+
Me as ChannelView,
|
|
1835
1839
|
Os as FaqList,
|
|
1836
1840
|
ks as FaqListItem,
|
|
1837
1841
|
Ps as MessagingProvider,
|