@linktr.ee/messaging-react 1.12.7 โ 1.12.8-rc-1765966726
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +218 -210
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +34 -23
- package/src/components/CustomMessage/index.tsx +9 -0
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as o, Fragment as ve } from "react/jsx-runtime";
|
|
2
2
|
import p from "classnames";
|
|
3
|
-
import U, { createContext as Pe, useContext as Oe, useCallback as
|
|
3
|
+
import U, { createContext as Pe, useContext as Oe, useCallback as D, useState as y, useRef as z, useEffect as G } from "react";
|
|
4
4
|
import { StreamChatService as je } from "@linktr.ee/messaging-core";
|
|
5
|
-
import { Chat as Ae, ChannelList as ze,
|
|
6
|
-
import { XIcon as
|
|
5
|
+
import { Chat as Ae, ChannelList as ze, MessageSimple as Be, useMessageComposer as $e, useStateStore as Ge, MessageInput as He, useMessageInputContext as Ve, useMessageComposerHasSendableData as We, SimpleAttachmentSelector as Ze, QuotedMessagePreview as qe, AttachmentPreviewList as Ye, TextareaComposer as Je, MessageTimestamp as Qe, Channel as Xe, useChannelStateContext as we, WithComponents as Ke, Window as es, MessageList as ss } from "stream-chat-react";
|
|
6
|
+
import { XIcon as ue, ArrowUpIcon as ts, ArrowLeftIcon as fe, DotsThreeIcon as ge, SpinnerGapIcon as re, SignOutIcon as ns, ProhibitInsetIcon as xe, FlagIcon as rs, MagnifyingGlassIcon as ls, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as be } from "stream-chat";
|
|
8
8
|
const ye = Pe({
|
|
9
9
|
service: null,
|
|
@@ -15,7 +15,7 @@ const ye = Pe({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), oe = () => Oe(ye),
|
|
18
|
+
}), oe = () => Oe(ye), Ls = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
@@ -23,9 +23,9 @@ const ye = Pe({
|
|
|
23
23
|
capabilities: a = {},
|
|
24
24
|
debug: i = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const l =
|
|
27
|
-
(
|
|
28
|
-
i && console.log(`๐ฅ [MessagingProvider] ${
|
|
26
|
+
const l = D(
|
|
27
|
+
(m, ...b) => {
|
|
28
|
+
i && console.log(`๐ฅ [MessagingProvider] ${m}`, ...b);
|
|
29
29
|
},
|
|
30
30
|
[i]
|
|
31
31
|
);
|
|
@@ -35,7 +35,7 @@ const ye = Pe({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(a)
|
|
37
37
|
});
|
|
38
|
-
const [
|
|
38
|
+
const [u, h] = y(null), [g, w] = y(null), [f, S] = y(!1), [_, v] = y(!1), [c, N] = y(null), E = z(!1), I = z({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
@@ -56,9 +56,9 @@ const ye = Pe({
|
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: a
|
|
58
58
|
}, G(() => {
|
|
59
|
-
const
|
|
59
|
+
const m = k.current;
|
|
60
60
|
if (l("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
|
-
renderCount:
|
|
61
|
+
renderCount: m,
|
|
62
62
|
apiKey: !!r,
|
|
63
63
|
serviceConfig: !!n,
|
|
64
64
|
dependencies: {
|
|
@@ -69,13 +69,13 @@ const ye = Pe({
|
|
|
69
69
|
}
|
|
70
70
|
}), !r || !n) {
|
|
71
71
|
l("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
72
|
-
renderCount:
|
|
72
|
+
renderCount: m,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
74
74
|
});
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
l("๐ CREATING NEW SERVICE", {
|
|
78
|
-
renderCount:
|
|
78
|
+
renderCount: m,
|
|
79
79
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: I.current.serviceConfig !== n
|
|
81
81
|
});
|
|
@@ -85,11 +85,11 @@ const ye = Pe({
|
|
|
85
85
|
debug: i
|
|
86
86
|
});
|
|
87
87
|
return h(b), l("โ
SERVICE SET", {
|
|
88
|
-
renderCount:
|
|
88
|
+
renderCount: m,
|
|
89
89
|
serviceInstance: !!b
|
|
90
90
|
}), () => {
|
|
91
91
|
l("๐งน SERVICE CLEANUP", {
|
|
92
|
-
renderCount:
|
|
92
|
+
renderCount: m,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
94
|
}), b.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
@@ -98,13 +98,13 @@ const ye = Pe({
|
|
|
98
98
|
G(() => {
|
|
99
99
|
var b, B;
|
|
100
100
|
if (l("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
-
hasService: !!
|
|
101
|
+
hasService: !!u,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
104
|
isConnecting: E.current,
|
|
105
105
|
isConnected: f,
|
|
106
|
-
dependencies: { service: !!
|
|
107
|
-
}), !
|
|
106
|
+
dependencies: { service: !!u, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !u || !s) {
|
|
108
108
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
@@ -112,7 +112,7 @@ const ye = Pe({
|
|
|
112
112
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((b = x.current) == null ? void 0 : b.serviceId) ===
|
|
115
|
+
if (((b = x.current) == null ? void 0 : b.serviceId) === u && ((B = x.current) == null ? void 0 : B.userId) === s.id) {
|
|
116
116
|
l(
|
|
117
117
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -123,8 +123,8 @@ const ye = Pe({
|
|
|
123
123
|
l("๐ STARTING USER CONNECTION", { userId: s.id }), E.current = !0, v(!0), N(null);
|
|
124
124
|
try {
|
|
125
125
|
l("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
-
const j = await
|
|
127
|
-
w(j), S(!0), x.current = { serviceId:
|
|
126
|
+
const j = await u.connectUser(s);
|
|
127
|
+
w(j), S(!0), x.current = { serviceId: u, userId: s.id }, l("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: j.userID
|
|
130
130
|
});
|
|
@@ -141,33 +141,33 @@ const ye = Pe({
|
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [
|
|
145
|
-
hasService: !!
|
|
144
|
+
}, [u, s, l, f]), G(() => (l("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!u,
|
|
146
146
|
isConnected: f
|
|
147
147
|
}), () => {
|
|
148
|
-
|
|
148
|
+
u && f ? (l(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
), x.current = null,
|
|
152
|
-
hasService: !!
|
|
151
|
+
), x.current = null, u.disconnectUser().catch(console.error)) : l("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!u,
|
|
153
153
|
isConnected: f
|
|
154
154
|
});
|
|
155
|
-
}), [
|
|
156
|
-
const R =
|
|
155
|
+
}), [u, f, l]);
|
|
156
|
+
const R = D(async () => {
|
|
157
157
|
if (l("๐ REFRESH CONNECTION CALLED", {
|
|
158
|
-
hasService: !!
|
|
158
|
+
hasService: !!u,
|
|
159
159
|
hasUser: !!s
|
|
160
|
-
}), !
|
|
160
|
+
}), !u || !s) {
|
|
161
161
|
l("โ ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
164
|
l("๐ STARTING CONNECTION REFRESH", { userId: s.id }), v(!0);
|
|
165
165
|
try {
|
|
166
|
-
l("๐ DISCONNECTING FOR REFRESH"), await
|
|
167
|
-
const
|
|
168
|
-
w(
|
|
169
|
-
} catch (
|
|
170
|
-
const b =
|
|
166
|
+
l("๐ DISCONNECTING FOR REFRESH"), await u.disconnectUser(), l("๐ RECONNECTING FOR REFRESH");
|
|
167
|
+
const m = await u.connectUser(s);
|
|
168
|
+
w(m), S(!0), N(null), l("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
|
+
} catch (m) {
|
|
170
|
+
const b = m instanceof Error ? m.message : "Refresh failed";
|
|
171
171
|
N(b), l("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
173
|
error: b
|
|
@@ -175,15 +175,15 @@ const ye = Pe({
|
|
|
175
175
|
} finally {
|
|
176
176
|
v(!1), l("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [
|
|
179
|
-
hasService: !!
|
|
178
|
+
}, [u, s, l]), d = U.useMemo(() => (l("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!u,
|
|
180
180
|
hasClient: !!g,
|
|
181
181
|
isConnected: f,
|
|
182
182
|
isLoading: _,
|
|
183
183
|
hasError: !!c,
|
|
184
184
|
capabilitiesKeys: Object.keys(a)
|
|
185
185
|
}), {
|
|
186
|
-
service:
|
|
186
|
+
service: u,
|
|
187
187
|
client: g,
|
|
188
188
|
isConnected: f,
|
|
189
189
|
isLoading: _,
|
|
@@ -192,7 +192,7 @@ const ye = Pe({
|
|
|
192
192
|
refreshConnection: R,
|
|
193
193
|
debug: i
|
|
194
194
|
}), [
|
|
195
|
-
|
|
195
|
+
u,
|
|
196
196
|
g,
|
|
197
197
|
f,
|
|
198
198
|
_,
|
|
@@ -216,18 +216,18 @@ const ye = Pe({
|
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
},
|
|
219
|
+
}, as = () => oe(), os = (t, s) => {
|
|
220
220
|
const n = new Date(
|
|
221
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
222
222
|
), a = new Date(
|
|
223
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
224
224
|
).getTime() - n.getTime();
|
|
225
225
|
return Math.floor(a / (1e3 * 60 * 60 * 24));
|
|
226
|
-
},
|
|
226
|
+
}, is = (t) => {
|
|
227
227
|
const s = /* @__PURE__ */ new Date();
|
|
228
228
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
229
229
|
return "Just now";
|
|
230
|
-
const r =
|
|
230
|
+
const r = os(t, s);
|
|
231
231
|
return r === 0 ? t.toLocaleTimeString([], {
|
|
232
232
|
hour: "numeric",
|
|
233
233
|
minute: "2-digit",
|
|
@@ -265,7 +265,7 @@ const ye = Pe({
|
|
|
265
265
|
"๐"
|
|
266
266
|
// Melon
|
|
267
267
|
];
|
|
268
|
-
function
|
|
268
|
+
function cs(t) {
|
|
269
269
|
let s = 0;
|
|
270
270
|
for (let n = 0; n < t.length; n++) {
|
|
271
271
|
const r = t.charCodeAt(n);
|
|
@@ -273,8 +273,8 @@ function os(t) {
|
|
|
273
273
|
}
|
|
274
274
|
return Math.abs(s);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const n =
|
|
276
|
+
function ds(t) {
|
|
277
|
+
const n = cs(t) % Ce.length;
|
|
278
278
|
return Ce[n];
|
|
279
279
|
}
|
|
280
280
|
const q = ({
|
|
@@ -284,7 +284,7 @@ const q = ({
|
|
|
284
284
|
className: r,
|
|
285
285
|
shape: a = "squircle"
|
|
286
286
|
}) => {
|
|
287
|
-
const i =
|
|
287
|
+
const i = ds(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = a === "circle" ? { borderRadius: "50%" } : {
|
|
288
288
|
borderRadius: "33%",
|
|
289
289
|
"corner-shape": "superellipse(1.3)"
|
|
290
290
|
};
|
|
@@ -310,7 +310,7 @@ const q = ({
|
|
|
310
310
|
"aria-hidden": "true",
|
|
311
311
|
className: p(
|
|
312
312
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
313
|
-
|
|
313
|
+
u
|
|
314
314
|
),
|
|
315
315
|
children: i
|
|
316
316
|
}
|
|
@@ -324,15 +324,15 @@ const q = ({
|
|
|
324
324
|
t && n(t);
|
|
325
325
|
}, h = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
|
|
326
326
|
(d) => {
|
|
327
|
-
var
|
|
328
|
-
return ((
|
|
327
|
+
var m, b;
|
|
328
|
+
return ((m = d.user) == null ? void 0 : m.id) && d.user.id !== ((b = t == null ? void 0 : t._client) == null ? void 0 : b.userID);
|
|
329
329
|
}
|
|
330
330
|
), g = ((E = h == null ? void 0 : h.user) == null ? void 0 : E.name) || "Conversation", w = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, f = (x = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : x[t.state.messages.length - 1], _ = (() => {
|
|
331
|
-
var
|
|
331
|
+
var m;
|
|
332
332
|
if (f != null && f.text) return f.text;
|
|
333
|
-
const d = (
|
|
333
|
+
const d = (m = f == null ? void 0 : f.attachments) == null ? void 0 : m[0];
|
|
334
334
|
return d ? d.og_scrape_url ? d.og_scrape_url : d.type === "image" ? "๐ท Sent an image" : d.type === "video" ? "๐ฅ Sent a video" : d.type === "audio" ? "๐ต Sent audio" : d.type === "file" ? "๐ Sent a file" : "๐ Sent an attachment" : "No messages yet";
|
|
335
|
-
})(), v = f != null && f.created_at ?
|
|
335
|
+
})(), v = f != null && f.created_at ? is(new Date(f.created_at)) : "", c = a ?? 0;
|
|
336
336
|
return r && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
337
337
|
channelId: t == null ? void 0 : t.id,
|
|
338
338
|
isSelected: i,
|
|
@@ -403,7 +403,7 @@ const Ie = U.memo(
|
|
|
403
403
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
404
404
|
filters: n
|
|
405
405
|
});
|
|
406
|
-
const
|
|
406
|
+
const u = U.useMemo(() => (g) => /* @__PURE__ */ e(
|
|
407
407
|
Ee,
|
|
408
408
|
{
|
|
409
409
|
...g,
|
|
@@ -425,7 +425,7 @@ const Ie = U.memo(
|
|
|
425
425
|
filters: n,
|
|
426
426
|
sort: { last_message_at: -1 },
|
|
427
427
|
options: { limit: 30 },
|
|
428
|
-
Preview:
|
|
428
|
+
Preview: u,
|
|
429
429
|
EmptyStateIndicator: a
|
|
430
430
|
},
|
|
431
431
|
JSON.stringify(n)
|
|
@@ -475,13 +475,13 @@ function Se({ label: t, className: s, children: n, ...r }) {
|
|
|
475
475
|
);
|
|
476
476
|
}
|
|
477
477
|
function pe({ onClick: t }) {
|
|
478
|
-
return /* @__PURE__ */ e(Se, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(
|
|
478
|
+
return /* @__PURE__ */ e(Se, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
479
479
|
}
|
|
480
|
-
const
|
|
480
|
+
const ms = (t) => /* @__PURE__ */ e("div", { className: "custom-message", children: /* @__PURE__ */ e(Be, { ...t }) }), us = (t) => ({
|
|
481
481
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
482
482
|
(s) => be.previewIsLoaded(s) || be.previewIsLoading(s)
|
|
483
483
|
)
|
|
484
|
-
}),
|
|
484
|
+
}), hs = ({
|
|
485
485
|
link: t,
|
|
486
486
|
onDismiss: s
|
|
487
487
|
}) => {
|
|
@@ -511,7 +511,7 @@ const cs = (t) => ({
|
|
|
511
511
|
},
|
|
512
512
|
className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl",
|
|
513
513
|
"aria-label": "Close link preview",
|
|
514
|
-
children: /* @__PURE__ */ e(
|
|
514
|
+
children: /* @__PURE__ */ e(ue, { className: "size-4 text-black/90" })
|
|
515
515
|
}
|
|
516
516
|
),
|
|
517
517
|
/* @__PURE__ */ o("div", { className: "p-2", children: [
|
|
@@ -521,32 +521,32 @@ const cs = (t) => ({
|
|
|
521
521
|
]
|
|
522
522
|
}
|
|
523
523
|
);
|
|
524
|
-
},
|
|
525
|
-
const { linkPreviewsManager: t } =
|
|
524
|
+
}, fs = () => {
|
|
525
|
+
const { linkPreviewsManager: t } = $e(), { linkPreviews: s } = Ge(
|
|
526
526
|
t.state,
|
|
527
|
-
|
|
527
|
+
us
|
|
528
528
|
), n = (a) => {
|
|
529
529
|
t.dismissPreview(a);
|
|
530
530
|
};
|
|
531
531
|
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((a) => /* @__PURE__ */ e(
|
|
532
|
-
|
|
532
|
+
hs,
|
|
533
533
|
{
|
|
534
534
|
link: a,
|
|
535
535
|
onDismiss: n
|
|
536
536
|
},
|
|
537
537
|
a.og_scrape_url
|
|
538
538
|
)) }) : null;
|
|
539
|
-
},
|
|
540
|
-
const { handleSubmit: t } =
|
|
539
|
+
}, gs = () => {
|
|
540
|
+
const { handleSubmit: t } = Ve(), s = We();
|
|
541
541
|
return /* @__PURE__ */ o(ve, { children: [
|
|
542
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
542
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ze, {}) }),
|
|
543
543
|
/* @__PURE__ */ o("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
|
|
544
|
-
/* @__PURE__ */ e(Ze, {}),
|
|
545
|
-
/* @__PURE__ */ e(us, {}),
|
|
546
544
|
/* @__PURE__ */ e(qe, {}),
|
|
545
|
+
/* @__PURE__ */ e(fs, {}),
|
|
546
|
+
/* @__PURE__ */ e(Ye, {}),
|
|
547
547
|
/* @__PURE__ */ o("div", { className: "flex", children: [
|
|
548
548
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
549
|
-
|
|
549
|
+
Je,
|
|
550
550
|
{
|
|
551
551
|
className: "w-full resize-none outline-none leading-6",
|
|
552
552
|
maxRows: 4
|
|
@@ -561,18 +561,18 @@ const cs = (t) => ({
|
|
|
561
561
|
disabled: !s,
|
|
562
562
|
onClick: t,
|
|
563
563
|
type: "button",
|
|
564
|
-
children: /* @__PURE__ */ e(
|
|
564
|
+
children: /* @__PURE__ */ e(ts, { className: "size-4" })
|
|
565
565
|
}
|
|
566
566
|
)
|
|
567
567
|
] })
|
|
568
568
|
] })
|
|
569
569
|
] });
|
|
570
|
-
},
|
|
570
|
+
}, xs = ({
|
|
571
571
|
renderActions: t
|
|
572
572
|
}) => /* @__PURE__ */ o("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
573
573
|
t && (t == null ? void 0 : t()),
|
|
574
|
-
/* @__PURE__ */ e(
|
|
575
|
-
] }),
|
|
574
|
+
/* @__PURE__ */ e(He, { Input: gs })
|
|
575
|
+
] }), Ns = (t) => {
|
|
576
576
|
const s = t.message.hide_date === !0;
|
|
577
577
|
return /* @__PURE__ */ o("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
578
578
|
/* @__PURE__ */ o("div", { className: "str-chat__message--system__text", children: [
|
|
@@ -580,9 +580,9 @@ const cs = (t) => ({
|
|
|
580
580
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
581
581
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
582
582
|
] }),
|
|
583
|
-
!s && /* @__PURE__ */ e(
|
|
583
|
+
!s && /* @__PURE__ */ e(Qe, { message: t.message })
|
|
584
584
|
] });
|
|
585
|
-
},
|
|
585
|
+
}, bs = () => null, Cs = ({ className: t, message: s }) => /* @__PURE__ */ o(
|
|
586
586
|
"div",
|
|
587
587
|
{
|
|
588
588
|
className: p("flex items-center justify-center h-full", t),
|
|
@@ -626,18 +626,18 @@ const cs = (t) => ({
|
|
|
626
626
|
]
|
|
627
627
|
}
|
|
628
628
|
), ae = U.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ o("div", { className: "flex items-center", children: [
|
|
629
|
-
/* @__PURE__ */ e(
|
|
629
|
+
/* @__PURE__ */ e(Cs, { className: "w-6 h-6" }),
|
|
630
630
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
631
631
|
] }) }));
|
|
632
632
|
ae.displayName = "LoadingState";
|
|
633
|
-
const
|
|
633
|
+
const vs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
634
634
|
var h, g, w, f, S;
|
|
635
635
|
const { channel: a } = we(), i = U.useMemo(() => Object.values(a.state.members || {}).find(
|
|
636
636
|
(v) => {
|
|
637
637
|
var c;
|
|
638
638
|
return ((c = v.user) == null ? void 0 : c.id) && v.user.id !== a._client.userID;
|
|
639
639
|
}
|
|
640
|
-
), [a._client.userID, a.state.members]), l = ((h = i == null ? void 0 : i.user) == null ? void 0 : h.name) || ((g = i == null ? void 0 : i.user) == null ? void 0 : g.id) || "Unknown member",
|
|
640
|
+
), [a._client.userID, a.state.members]), l = ((h = i == null ? void 0 : i.user) == null ? void 0 : h.name) || ((g = i == null ? void 0 : i.user) == null ? void 0 : g.id) || "Unknown member", u = (w = i == null ? void 0 : i.user) == null ? void 0 : w.image;
|
|
641
641
|
return /* @__PURE__ */ o("div", { className: "@container", children: [
|
|
642
642
|
/* @__PURE__ */ o("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
643
643
|
/* @__PURE__ */ e(
|
|
@@ -660,7 +660,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
660
660
|
{
|
|
661
661
|
id: ((f = i == null ? void 0 : i.user) == null ? void 0 : f.id) || a.id || "unknown",
|
|
662
662
|
name: l,
|
|
663
|
-
image:
|
|
663
|
+
image: u,
|
|
664
664
|
size: 40
|
|
665
665
|
}
|
|
666
666
|
),
|
|
@@ -696,7 +696,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
696
696
|
{
|
|
697
697
|
id: ((S = i == null ? void 0 : i.user) == null ? void 0 : S.id) || a.id || "unknown",
|
|
698
698
|
name: l,
|
|
699
|
-
image:
|
|
699
|
+
image: u,
|
|
700
700
|
size: 40
|
|
701
701
|
}
|
|
702
702
|
),
|
|
@@ -714,7 +714,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
714
714
|
)
|
|
715
715
|
] })
|
|
716
716
|
] });
|
|
717
|
-
},
|
|
717
|
+
}, ws = ({
|
|
718
718
|
dialogRef: t,
|
|
719
719
|
onClose: s,
|
|
720
720
|
participant: n,
|
|
@@ -722,15 +722,15 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
722
722
|
followerStatusLabel: a,
|
|
723
723
|
onLeaveConversation: i,
|
|
724
724
|
onBlockParticipant: l,
|
|
725
|
-
showDeleteConversation:
|
|
725
|
+
showDeleteConversation: u = !0,
|
|
726
726
|
onDeleteConversationClick: h,
|
|
727
727
|
onBlockParticipantClick: g,
|
|
728
728
|
onReportParticipantClick: w
|
|
729
729
|
}) => {
|
|
730
730
|
var Q, X, ce, O, H, J, $;
|
|
731
|
-
const { service: f, debug: S } = oe(), [_, v] = y(!1), [c, N] = y(!1), [E, I] = y(!1), k =
|
|
732
|
-
var
|
|
733
|
-
if (!(!f || !((
|
|
731
|
+
const { service: f, debug: S } = oe(), [_, v] = y(!1), [c, N] = y(!1), [E, I] = y(!1), k = D(async () => {
|
|
732
|
+
var M;
|
|
733
|
+
if (!(!f || !((M = n == null ? void 0 : n.user) != null && M.id)))
|
|
734
734
|
try {
|
|
735
735
|
const A = (await f.getBlockedUsers()).some(
|
|
736
736
|
(V) => {
|
|
@@ -750,11 +750,11 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
750
750
|
k();
|
|
751
751
|
}, [k]);
|
|
752
752
|
const x = async () => {
|
|
753
|
-
var
|
|
753
|
+
var M;
|
|
754
754
|
if (!c) {
|
|
755
755
|
h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
|
|
756
756
|
try {
|
|
757
|
-
const T = ((
|
|
757
|
+
const T = ((M = r._client) == null ? void 0 : M.userID) ?? null;
|
|
758
758
|
await r.hide(T, !1), i && await i(r), s();
|
|
759
759
|
} catch (T) {
|
|
760
760
|
console.error("[ChannelInfoDialog] Failed to leave conversation", T);
|
|
@@ -763,9 +763,9 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
765
|
}, R = async () => {
|
|
766
|
-
var
|
|
766
|
+
var M, T, A;
|
|
767
767
|
if (!(E || !f)) {
|
|
768
|
-
g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (
|
|
768
|
+
g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (M = n == null ? void 0 : n.user) == null ? void 0 : M.id), I(!0);
|
|
769
769
|
try {
|
|
770
770
|
await f.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
771
771
|
} catch (V) {
|
|
@@ -775,9 +775,9 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
777
|
}, d = async () => {
|
|
778
|
-
var
|
|
778
|
+
var M, T, A;
|
|
779
779
|
if (!(E || !f)) {
|
|
780
|
-
g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (
|
|
780
|
+
g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (M = n == null ? void 0 : n.user) == null ? void 0 : M.id), I(!0);
|
|
781
781
|
try {
|
|
782
782
|
await f.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
783
783
|
} catch (V) {
|
|
@@ -786,7 +786,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
786
786
|
I(!1);
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
},
|
|
789
|
+
}, m = () => {
|
|
790
790
|
w == null || w(), s(), window.open(
|
|
791
791
|
"https://linktr.ee/s/about/trust-center/report",
|
|
792
792
|
"_blank",
|
|
@@ -803,8 +803,8 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
803
803
|
ref: t,
|
|
804
804
|
className: "mes-dialog group",
|
|
805
805
|
onClose: s,
|
|
806
|
-
onClick: (
|
|
807
|
-
|
|
806
|
+
onClick: (M) => {
|
|
807
|
+
M.target === t.current && s();
|
|
808
808
|
},
|
|
809
809
|
children: /* @__PURE__ */ o("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
|
|
810
810
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
@@ -850,14 +850,14 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
850
850
|
}
|
|
851
851
|
),
|
|
852
852
|
/* @__PURE__ */ o("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
853
|
-
|
|
853
|
+
u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
|
|
854
854
|
ne,
|
|
855
855
|
{
|
|
856
856
|
onClick: x,
|
|
857
857
|
disabled: c,
|
|
858
858
|
"aria-busy": c,
|
|
859
859
|
children: [
|
|
860
|
-
c ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(
|
|
860
|
+
c ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ns, { className: "h-5 w-5" }),
|
|
861
861
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
862
862
|
]
|
|
863
863
|
}
|
|
@@ -885,8 +885,8 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
885
885
|
]
|
|
886
886
|
}
|
|
887
887
|
) }),
|
|
888
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(ne, { variant: "danger", onClick:
|
|
889
|
-
/* @__PURE__ */ e(
|
|
888
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(ne, { variant: "danger", onClick: m, children: [
|
|
889
|
+
/* @__PURE__ */ e(rs, { className: "h-5 w-5" }),
|
|
890
890
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
891
891
|
] }) })
|
|
892
892
|
] })
|
|
@@ -895,7 +895,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
895
895
|
}
|
|
896
896
|
)
|
|
897
897
|
);
|
|
898
|
-
},
|
|
898
|
+
}, ys = ({
|
|
899
899
|
onBack: t,
|
|
900
900
|
showBackButton: s,
|
|
901
901
|
renderMessageInputActions: n,
|
|
@@ -903,7 +903,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
903
903
|
onBlockParticipant: a,
|
|
904
904
|
showDeleteConversation: i = !0,
|
|
905
905
|
onDeleteConversationClick: l,
|
|
906
|
-
onBlockParticipantClick:
|
|
906
|
+
onBlockParticipantClick: u,
|
|
907
907
|
onReportParticipantClick: h
|
|
908
908
|
}) => {
|
|
909
909
|
const { channel: g } = we(), w = z(null), f = U.useMemo(() => Object.values(g.state.members || {}).find(
|
|
@@ -917,41 +917,49 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
917
917
|
return String(c.followerStatus);
|
|
918
918
|
if (c.isFollower !== void 0)
|
|
919
919
|
return c.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
920
|
-
}, [g.data]), _ =
|
|
920
|
+
}, [g.data]), _ = D(() => {
|
|
921
921
|
var c;
|
|
922
922
|
(c = w.current) == null || c.showModal();
|
|
923
|
-
}, []), v =
|
|
923
|
+
}, []), v = D(() => {
|
|
924
924
|
var c;
|
|
925
925
|
(c = w.current) == null || c.close();
|
|
926
926
|
}, []);
|
|
927
927
|
return /* @__PURE__ */ o(ve, { children: [
|
|
928
|
-
/* @__PURE__ */ o(Xe, { children: [
|
|
929
|
-
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
930
|
-
Ns,
|
|
931
|
-
{
|
|
932
|
-
onBack: t,
|
|
933
|
-
showBackButton: s,
|
|
934
|
-
onShowInfo: _,
|
|
935
|
-
canShowInfo: !!f
|
|
936
|
-
}
|
|
937
|
-
) }),
|
|
938
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
939
|
-
Ke,
|
|
940
|
-
{
|
|
941
|
-
hideDeletedMessages: !0,
|
|
942
|
-
hideNewMessageSeparator: !1,
|
|
943
|
-
messageActions: []
|
|
944
|
-
}
|
|
945
|
-
) }),
|
|
946
|
-
/* @__PURE__ */ e(
|
|
947
|
-
hs,
|
|
948
|
-
{
|
|
949
|
-
renderActions: () => n == null ? void 0 : n(g)
|
|
950
|
-
}
|
|
951
|
-
)
|
|
952
|
-
] }),
|
|
953
928
|
/* @__PURE__ */ e(
|
|
954
|
-
|
|
929
|
+
Ke,
|
|
930
|
+
{
|
|
931
|
+
overrides: {
|
|
932
|
+
Message: (c) => /* @__PURE__ */ e(ms, { ...c })
|
|
933
|
+
},
|
|
934
|
+
children: /* @__PURE__ */ o(es, { children: [
|
|
935
|
+
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
936
|
+
vs,
|
|
937
|
+
{
|
|
938
|
+
onBack: t,
|
|
939
|
+
showBackButton: s,
|
|
940
|
+
onShowInfo: _,
|
|
941
|
+
canShowInfo: !!f
|
|
942
|
+
}
|
|
943
|
+
) }),
|
|
944
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
945
|
+
ss,
|
|
946
|
+
{
|
|
947
|
+
hideDeletedMessages: !0,
|
|
948
|
+
hideNewMessageSeparator: !1,
|
|
949
|
+
messageActions: void 0
|
|
950
|
+
}
|
|
951
|
+
) }),
|
|
952
|
+
/* @__PURE__ */ e(
|
|
953
|
+
xs,
|
|
954
|
+
{
|
|
955
|
+
renderActions: () => n == null ? void 0 : n(g)
|
|
956
|
+
}
|
|
957
|
+
)
|
|
958
|
+
] })
|
|
959
|
+
}
|
|
960
|
+
),
|
|
961
|
+
/* @__PURE__ */ e(
|
|
962
|
+
ws,
|
|
955
963
|
{
|
|
956
964
|
dialogRef: w,
|
|
957
965
|
onClose: v,
|
|
@@ -962,7 +970,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
962
970
|
onBlockParticipant: a,
|
|
963
971
|
showDeleteConversation: i,
|
|
964
972
|
onDeleteConversationClick: l,
|
|
965
|
-
onBlockParticipantClick:
|
|
973
|
+
onBlockParticipantClick: u,
|
|
966
974
|
onReportParticipantClick: h
|
|
967
975
|
}
|
|
968
976
|
)
|
|
@@ -976,7 +984,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
976
984
|
onLeaveConversation: a,
|
|
977
985
|
onBlockParticipant: i,
|
|
978
986
|
className: l,
|
|
979
|
-
CustomChannelEmptyState:
|
|
987
|
+
CustomChannelEmptyState: u = bs,
|
|
980
988
|
showDeleteConversation: h = !0,
|
|
981
989
|
onDeleteConversationClick: g,
|
|
982
990
|
onBlockParticipantClick: w,
|
|
@@ -989,21 +997,21 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
989
997
|
l
|
|
990
998
|
),
|
|
991
999
|
children: /* @__PURE__ */ e(
|
|
992
|
-
|
|
1000
|
+
Xe,
|
|
993
1001
|
{
|
|
994
1002
|
channel: t,
|
|
995
|
-
MessageSystem:
|
|
996
|
-
EmptyStateIndicator:
|
|
1003
|
+
MessageSystem: Ns,
|
|
1004
|
+
EmptyStateIndicator: u,
|
|
997
1005
|
LoadingIndicator: ae,
|
|
998
1006
|
children: /* @__PURE__ */ e(
|
|
999
|
-
|
|
1007
|
+
ys,
|
|
1000
1008
|
{
|
|
1001
1009
|
onBack: s,
|
|
1002
1010
|
showBackButton: n,
|
|
1003
1011
|
renderMessageInputActions: r,
|
|
1004
1012
|
onLeaveConversation: a,
|
|
1005
1013
|
onBlockParticipant: i,
|
|
1006
|
-
CustomChannelEmptyState:
|
|
1014
|
+
CustomChannelEmptyState: u,
|
|
1007
1015
|
showDeleteConversation: h,
|
|
1008
1016
|
onDeleteConversationClick: g,
|
|
1009
1017
|
onBlockParticipantClick: w,
|
|
@@ -1016,7 +1024,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1016
1024
|
)
|
|
1017
1025
|
);
|
|
1018
1026
|
ke.displayName = "ChannelView";
|
|
1019
|
-
function
|
|
1027
|
+
function Es({
|
|
1020
1028
|
searchQuery: t,
|
|
1021
1029
|
setSearchQuery: s,
|
|
1022
1030
|
placeholder: n
|
|
@@ -1024,7 +1032,7 @@ function vs({
|
|
|
1024
1032
|
const r = z(null);
|
|
1025
1033
|
return /* @__PURE__ */ o("div", { className: "relative", children: [
|
|
1026
1034
|
/* @__PURE__ */ e(
|
|
1027
|
-
|
|
1035
|
+
ls,
|
|
1028
1036
|
{
|
|
1029
1037
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1030
1038
|
weight: "bold"
|
|
@@ -1050,12 +1058,12 @@ function vs({
|
|
|
1050
1058
|
s(""), (a = r.current) == null || a.focus();
|
|
1051
1059
|
},
|
|
1052
1060
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1053
|
-
children: /* @__PURE__ */ e(
|
|
1061
|
+
children: /* @__PURE__ */ e(ue, { className: "h-4 w-4", weight: "bold" })
|
|
1054
1062
|
}
|
|
1055
1063
|
)
|
|
1056
1064
|
] });
|
|
1057
1065
|
}
|
|
1058
|
-
const
|
|
1066
|
+
const Is = ({
|
|
1059
1067
|
participantSource: t,
|
|
1060
1068
|
onSelectParticipant: s,
|
|
1061
1069
|
onClose: n,
|
|
@@ -1064,56 +1072,56 @@ const ws = ({
|
|
|
1064
1072
|
searchPlaceholder: i = "Search participants...",
|
|
1065
1073
|
className: l
|
|
1066
1074
|
}) => {
|
|
1067
|
-
const { debug:
|
|
1075
|
+
const { debug: u } = oe(), [h, g] = y(""), [w, f] = y([]), [S, _] = y(!1), [v, c] = y(null), [N, E] = y(
|
|
1068
1076
|
null
|
|
1069
1077
|
), I = z(!1);
|
|
1070
1078
|
G(() => {
|
|
1071
1079
|
if (t.loading) {
|
|
1072
|
-
|
|
1080
|
+
u && console.log(
|
|
1073
1081
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1074
1082
|
);
|
|
1075
1083
|
return;
|
|
1076
1084
|
}
|
|
1077
1085
|
if (I.current) return;
|
|
1078
1086
|
(async () => {
|
|
1079
|
-
|
|
1087
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), _(!0), c(null);
|
|
1080
1088
|
try {
|
|
1081
|
-
const
|
|
1089
|
+
const m = await t.loadParticipants({
|
|
1082
1090
|
search: "",
|
|
1083
1091
|
// Load all participants initially
|
|
1084
1092
|
limit: 100
|
|
1085
1093
|
});
|
|
1086
|
-
f(
|
|
1094
|
+
f(m.participants), I.current = !0, u && console.log(
|
|
1087
1095
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1088
|
-
|
|
1096
|
+
m.participants.length
|
|
1089
1097
|
);
|
|
1090
|
-
} catch (
|
|
1091
|
-
const b =
|
|
1092
|
-
c(b), console.error("[ParticipantPicker] Failed to load participants:",
|
|
1098
|
+
} catch (m) {
|
|
1099
|
+
const b = m instanceof Error ? m.message : "Failed to load participants";
|
|
1100
|
+
c(b), console.error("[ParticipantPicker] Failed to load participants:", m);
|
|
1093
1101
|
} finally {
|
|
1094
1102
|
_(!1);
|
|
1095
1103
|
}
|
|
1096
1104
|
})();
|
|
1097
|
-
}, [t.loading,
|
|
1105
|
+
}, [t.loading, u]);
|
|
1098
1106
|
const k = w.filter((d) => !r.has(d.id)).filter((d) => {
|
|
1099
1107
|
var b;
|
|
1100
1108
|
if (!h) return !0;
|
|
1101
|
-
const
|
|
1102
|
-
return d.name.toLowerCase().includes(
|
|
1103
|
-
}), x =
|
|
1109
|
+
const m = h.toLowerCase();
|
|
1110
|
+
return d.name.toLowerCase().includes(m) || ((b = d.email) == null ? void 0 : b.toLowerCase().includes(m)) || !1;
|
|
1111
|
+
}), x = D(
|
|
1104
1112
|
async (d) => {
|
|
1105
1113
|
if (!N) {
|
|
1106
1114
|
E(d.id);
|
|
1107
1115
|
try {
|
|
1108
1116
|
await s(d);
|
|
1109
|
-
} catch (
|
|
1110
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1117
|
+
} catch (m) {
|
|
1118
|
+
console.error("[ParticipantPicker] Failed to start chat:", m), E(null);
|
|
1111
1119
|
}
|
|
1112
1120
|
}
|
|
1113
1121
|
},
|
|
1114
1122
|
[s, N]
|
|
1115
|
-
), R = (d,
|
|
1116
|
-
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), x(
|
|
1123
|
+
), R = (d, m) => {
|
|
1124
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), x(m));
|
|
1117
1125
|
};
|
|
1118
1126
|
return /* @__PURE__ */ o("div", { className: p("flex flex-col h-full", l), children: [
|
|
1119
1127
|
/* @__PURE__ */ o("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
@@ -1130,7 +1138,7 @@ const ws = ({
|
|
|
1130
1138
|
t.totalCount !== void 0 && ` โข ${t.totalCount} ${a} total`
|
|
1131
1139
|
] }),
|
|
1132
1140
|
/* @__PURE__ */ e(
|
|
1133
|
-
|
|
1141
|
+
Es,
|
|
1134
1142
|
{
|
|
1135
1143
|
searchQuery: h,
|
|
1136
1144
|
setSearchQuery: g,
|
|
@@ -1157,7 +1165,7 @@ const ws = ({
|
|
|
1157
1165
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : w.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
|
|
1158
1166
|
] }) : /* @__PURE__ */ o("ul", { className: "space-y-0", children: [
|
|
1159
1167
|
k.map((d) => {
|
|
1160
|
-
const
|
|
1168
|
+
const m = d.name || d.email || d.id, b = d.email && d.name ? d.email : d.phone;
|
|
1161
1169
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1162
1170
|
"button",
|
|
1163
1171
|
{
|
|
@@ -1171,13 +1179,13 @@ const ws = ({
|
|
|
1171
1179
|
q,
|
|
1172
1180
|
{
|
|
1173
1181
|
id: d.id,
|
|
1174
|
-
name:
|
|
1182
|
+
name: m,
|
|
1175
1183
|
image: d.image,
|
|
1176
1184
|
size: 40
|
|
1177
1185
|
}
|
|
1178
1186
|
),
|
|
1179
1187
|
/* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
|
|
1180
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1188
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: m }),
|
|
1181
1189
|
b && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: b })
|
|
1182
1190
|
] })
|
|
1183
1191
|
] }),
|
|
@@ -1192,7 +1200,7 @@ const ws = ({
|
|
|
1192
1200
|
] }) })
|
|
1193
1201
|
] }) })
|
|
1194
1202
|
] });
|
|
1195
|
-
},
|
|
1203
|
+
}, Ss = ({ className: t }) => /* @__PURE__ */ o(
|
|
1196
1204
|
"svg",
|
|
1197
1205
|
{
|
|
1198
1206
|
width: "140",
|
|
@@ -1328,7 +1336,7 @@ const ws = ({
|
|
|
1328
1336
|
}
|
|
1329
1337
|
), Re = U.memo(
|
|
1330
1338
|
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
1331
|
-
/* @__PURE__ */ e(
|
|
1339
|
+
/* @__PURE__ */ e(Ss, {}),
|
|
1332
1340
|
s && !t && /* @__PURE__ */ o("div", { className: "mt-8", children: [
|
|
1333
1341
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1334
1342
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
@@ -1351,7 +1359,7 @@ const le = U.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1351
1359
|
)
|
|
1352
1360
|
] }) }));
|
|
1353
1361
|
le.displayName = "ErrorState";
|
|
1354
|
-
const
|
|
1362
|
+
const Us = ({
|
|
1355
1363
|
capabilities: t = {},
|
|
1356
1364
|
className: s,
|
|
1357
1365
|
renderMessageInputActions: n,
|
|
@@ -1359,7 +1367,7 @@ const Fs = ({
|
|
|
1359
1367
|
onParticipantSelect: a,
|
|
1360
1368
|
initialParticipantFilter: i,
|
|
1361
1369
|
initialParticipantData: l,
|
|
1362
|
-
CustomChannelEmptyState:
|
|
1370
|
+
CustomChannelEmptyState: u,
|
|
1363
1371
|
showChannelList: h = !0,
|
|
1364
1372
|
filters: g,
|
|
1365
1373
|
channelListCustomEmptyStateIndicator: w,
|
|
@@ -1375,7 +1383,7 @@ const Fs = ({
|
|
|
1375
1383
|
error: I,
|
|
1376
1384
|
refreshConnection: k,
|
|
1377
1385
|
debug: x
|
|
1378
|
-
} =
|
|
1386
|
+
} = as(), [R, d] = y(null), [m, b] = y(!1), [B, j] = y(!1), [W, Y] = y(!1), [ie, Q] = y(/* @__PURE__ */ new Set()), [X, ce] = y(0), [O, H] = y(!1), [J, $] = y(null), M = z(null), {
|
|
1379
1387
|
participantSource: T,
|
|
1380
1388
|
participantLabel: A = "participants",
|
|
1381
1389
|
showDeleteConversation: V = !0
|
|
@@ -1392,7 +1400,7 @@ const Fs = ({
|
|
|
1392
1400
|
},
|
|
1393
1401
|
...g
|
|
1394
1402
|
};
|
|
1395
|
-
}, [g, c == null ? void 0 : c.userID]), ee = z(null), Z =
|
|
1403
|
+
}, [g, c == null ? void 0 : c.userID]), ee = z(null), Z = D(async () => {
|
|
1396
1404
|
if (!c || !N) return;
|
|
1397
1405
|
const C = c.userID;
|
|
1398
1406
|
if (C)
|
|
@@ -1410,8 +1418,8 @@ const Fs = ({
|
|
|
1410
1418
|
const de = L.state.members;
|
|
1411
1419
|
Object.values(de).forEach((Ue) => {
|
|
1412
1420
|
var he;
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1421
|
+
const me = (he = Ue.user) == null ? void 0 : he.id;
|
|
1422
|
+
me && me !== C && F.add(me);
|
|
1415
1423
|
});
|
|
1416
1424
|
}), Q((L) => L.size === F.size && [...L].every((de) => F.has(de)) ? L : F), b(P.length > 0), j(!0), ee.current = C, x && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1417
1425
|
channelCount: P.length,
|
|
@@ -1493,14 +1501,14 @@ const Fs = ({
|
|
|
1493
1501
|
x,
|
|
1494
1502
|
r
|
|
1495
1503
|
]);
|
|
1496
|
-
const
|
|
1504
|
+
const Me = D(
|
|
1497
1505
|
(C) => {
|
|
1498
1506
|
d(C), r == null || r(C);
|
|
1499
1507
|
},
|
|
1500
1508
|
[r]
|
|
1501
|
-
),
|
|
1509
|
+
), De = D(() => {
|
|
1502
1510
|
O || d(null);
|
|
1503
|
-
}, [O]), _e =
|
|
1511
|
+
}, [O]), _e = D(
|
|
1504
1512
|
async (C) => {
|
|
1505
1513
|
var P;
|
|
1506
1514
|
if (v)
|
|
@@ -1520,26 +1528,26 @@ const Fs = ({
|
|
|
1520
1528
|
} catch (L) {
|
|
1521
1529
|
console.warn("[MessagingShell] Failed to unhide channel:", L);
|
|
1522
1530
|
}
|
|
1523
|
-
d(F), Y(!1), (P =
|
|
1531
|
+
d(F), Y(!1), (P = M.current) == null || P.close(), a == null || a(C);
|
|
1524
1532
|
} catch (F) {
|
|
1525
1533
|
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
1526
1534
|
}
|
|
1527
1535
|
},
|
|
1528
1536
|
[v, a, x]
|
|
1529
|
-
), se =
|
|
1537
|
+
), se = D(() => {
|
|
1530
1538
|
var C;
|
|
1531
|
-
Y(!1), (C =
|
|
1532
|
-
}, []), Fe =
|
|
1539
|
+
Y(!1), (C = M.current) == null || C.close();
|
|
1540
|
+
}, []), Fe = D(
|
|
1533
1541
|
(C) => {
|
|
1534
|
-
C.target ===
|
|
1542
|
+
C.target === M.current && se();
|
|
1535
1543
|
},
|
|
1536
1544
|
[se]
|
|
1537
|
-
), Te =
|
|
1545
|
+
), Te = D(
|
|
1538
1546
|
async (C) => {
|
|
1539
1547
|
x && console.log("[MessagingShell] Leaving conversation:", C.id), d(null), H(!1), ee.current = null, await Z();
|
|
1540
1548
|
},
|
|
1541
1549
|
[Z, x]
|
|
1542
|
-
), Le =
|
|
1550
|
+
), Le = D(
|
|
1543
1551
|
async (C) => {
|
|
1544
1552
|
x && console.log("[MessagingShell] Blocking participant:", C), d(null), H(!1), ee.current = null, await Z();
|
|
1545
1553
|
},
|
|
@@ -1576,7 +1584,7 @@ const Fs = ({
|
|
|
1576
1584
|
children: /* @__PURE__ */ e(
|
|
1577
1585
|
Ie,
|
|
1578
1586
|
{
|
|
1579
|
-
onChannelSelect:
|
|
1587
|
+
onChannelSelect: Me,
|
|
1580
1588
|
selectedChannel: R || void 0,
|
|
1581
1589
|
filters: K,
|
|
1582
1590
|
customEmptyStateIndicator: w
|
|
@@ -1600,12 +1608,12 @@ const Fs = ({
|
|
|
1600
1608
|
ke,
|
|
1601
1609
|
{
|
|
1602
1610
|
channel: R,
|
|
1603
|
-
onBack:
|
|
1611
|
+
onBack: De,
|
|
1604
1612
|
showBackButton: !O,
|
|
1605
1613
|
renderMessageInputActions: n,
|
|
1606
1614
|
onLeaveConversation: Te,
|
|
1607
1615
|
onBlockParticipant: Le,
|
|
1608
|
-
CustomChannelEmptyState:
|
|
1616
|
+
CustomChannelEmptyState: u,
|
|
1609
1617
|
showDeleteConversation: V,
|
|
1610
1618
|
onDeleteConversationClick: f,
|
|
1611
1619
|
onBlockParticipantClick: S,
|
|
@@ -1618,7 +1626,7 @@ const Fs = ({
|
|
|
1618
1626
|
) : /* @__PURE__ */ e(
|
|
1619
1627
|
Re,
|
|
1620
1628
|
{
|
|
1621
|
-
hasChannels:
|
|
1629
|
+
hasChannels: m,
|
|
1622
1630
|
channelsLoaded: B
|
|
1623
1631
|
}
|
|
1624
1632
|
)
|
|
@@ -1629,12 +1637,12 @@ const Fs = ({
|
|
|
1629
1637
|
/* @__PURE__ */ e(
|
|
1630
1638
|
"dialog",
|
|
1631
1639
|
{
|
|
1632
|
-
ref:
|
|
1640
|
+
ref: M,
|
|
1633
1641
|
className: "mes-dialog",
|
|
1634
1642
|
onClick: Fe,
|
|
1635
1643
|
onClose: se,
|
|
1636
1644
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1637
|
-
|
|
1645
|
+
Is,
|
|
1638
1646
|
{
|
|
1639
1647
|
participantSource: T,
|
|
1640
1648
|
onSelectParticipant: _e,
|
|
@@ -1650,7 +1658,7 @@ const Fs = ({
|
|
|
1650
1658
|
]
|
|
1651
1659
|
}
|
|
1652
1660
|
);
|
|
1653
|
-
},
|
|
1661
|
+
}, ps = ({
|
|
1654
1662
|
question: t,
|
|
1655
1663
|
onClick: s,
|
|
1656
1664
|
loading: n = !1,
|
|
@@ -1672,7 +1680,7 @@ const Fs = ({
|
|
|
1672
1680
|
),
|
|
1673
1681
|
children: t
|
|
1674
1682
|
}
|
|
1675
|
-
),
|
|
1683
|
+
), Ps = ({
|
|
1676
1684
|
faqs: t,
|
|
1677
1685
|
onFaqClick: s,
|
|
1678
1686
|
loadingFaqId: n,
|
|
@@ -1681,8 +1689,8 @@ const Fs = ({
|
|
|
1681
1689
|
avatarImage: i,
|
|
1682
1690
|
avatarName: l
|
|
1683
1691
|
}) => {
|
|
1684
|
-
const
|
|
1685
|
-
return
|
|
1692
|
+
const u = t.filter((h) => h.enabled).sort((h, g) => (h.order ?? 0) - (g.order ?? 0));
|
|
1693
|
+
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ o("div", { className: "flex gap-3 items-end", children: [
|
|
1686
1694
|
(i || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1687
1695
|
q,
|
|
1688
1696
|
{
|
|
@@ -1700,8 +1708,8 @@ const Fs = ({
|
|
|
1700
1708
|
style: { backgroundColor: "#F1F0EE" },
|
|
1701
1709
|
children: [
|
|
1702
1710
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1703
|
-
|
|
1704
|
-
|
|
1711
|
+
u.map((h) => /* @__PURE__ */ e(
|
|
1712
|
+
ps,
|
|
1705
1713
|
{
|
|
1706
1714
|
question: h.question,
|
|
1707
1715
|
onClick: () => s(h.id),
|
|
@@ -1713,31 +1721,31 @@ const Fs = ({
|
|
|
1713
1721
|
}
|
|
1714
1722
|
)
|
|
1715
1723
|
] }) });
|
|
1716
|
-
},
|
|
1717
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, i] = y([]), [l,
|
|
1724
|
+
}, Os = (t, s = {}) => {
|
|
1725
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, i] = y([]), [l, u] = y(!1), [h, g] = y(null), [w, f] = y(n), [S, _] = y(!0), [v, c] = y(), N = D(async (x = !1, R) => {
|
|
1718
1726
|
if (l) return;
|
|
1719
1727
|
const d = R !== void 0 ? R : w;
|
|
1720
|
-
|
|
1728
|
+
u(!0), g(null);
|
|
1721
1729
|
try {
|
|
1722
|
-
const
|
|
1730
|
+
const m = await t.loadParticipants({
|
|
1723
1731
|
search: d || void 0,
|
|
1724
1732
|
limit: r,
|
|
1725
1733
|
cursor: x ? void 0 : v
|
|
1726
1734
|
});
|
|
1727
1735
|
i(
|
|
1728
|
-
(b) => x ?
|
|
1729
|
-
), _(
|
|
1730
|
-
} catch (
|
|
1731
|
-
const b =
|
|
1732
|
-
g(b), console.error("[useParticipants] Load error:",
|
|
1736
|
+
(b) => x ? m.participants : [...b, ...m.participants]
|
|
1737
|
+
), _(m.hasMore), c(m.nextCursor);
|
|
1738
|
+
} catch (m) {
|
|
1739
|
+
const b = m instanceof Error ? m.message : "Failed to load participants";
|
|
1740
|
+
g(b), console.error("[useParticipants] Load error:", m);
|
|
1733
1741
|
} finally {
|
|
1734
|
-
|
|
1742
|
+
u(!1);
|
|
1735
1743
|
}
|
|
1736
|
-
}, [t, w, v, r, l]), E =
|
|
1744
|
+
}, [t, w, v, r, l]), E = D(() => {
|
|
1737
1745
|
S && !l && N(!1);
|
|
1738
|
-
}, [S, l, N]), I =
|
|
1746
|
+
}, [S, l, N]), I = D((x) => {
|
|
1739
1747
|
f(x), c(void 0), N(!0, x);
|
|
1740
|
-
}, [N]), k =
|
|
1748
|
+
}, [N]), k = D(() => {
|
|
1741
1749
|
c(void 0), N(!0);
|
|
1742
1750
|
}, [N]);
|
|
1743
1751
|
return G(() => {
|
|
@@ -1756,16 +1764,16 @@ const Fs = ({
|
|
|
1756
1764
|
};
|
|
1757
1765
|
export {
|
|
1758
1766
|
q as Avatar,
|
|
1759
|
-
|
|
1767
|
+
bs as ChannelEmptyState,
|
|
1760
1768
|
Ie as ChannelList,
|
|
1761
1769
|
ke as ChannelView,
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
+
Ps as FaqList,
|
|
1771
|
+
ps as FaqListItem,
|
|
1772
|
+
Ls as MessagingProvider,
|
|
1773
|
+
Us as MessagingShell,
|
|
1774
|
+
Is as ParticipantPicker,
|
|
1775
|
+
is as formatRelativeTime,
|
|
1776
|
+
as as useMessaging,
|
|
1777
|
+
Os as useParticipants
|
|
1770
1778
|
};
|
|
1771
1779
|
//# sourceMappingURL=index.js.map
|