@linktr.ee/messaging-react 1.12.7 → 1.12.8-rc-1765974383
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/assets/index.css +1 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.js +919 -713
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +34 -23
- package/src/components/CustomMessage/CustomMessage.stories.tsx +220 -0
- package/src/components/CustomMessage/MessageTag.stories.tsx +80 -0
- package/src/components/CustomMessage/MessageTag.tsx +68 -0
- package/src/components/CustomMessage/index.tsx +260 -0
- package/src/components/CustomSystemMessage/index.tsx +10 -1
- package/src/stream-custom-data.ts +20 -0
- package/src/styles.css +34 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { XIcon as
|
|
7
|
-
import { LinkPreviewsManager as
|
|
8
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as Ne } from "react/jsx-runtime";
|
|
2
|
+
import _ from "classnames";
|
|
3
|
+
import P, { createContext as Be, useContext as $e, useCallback as T, useState as p, useRef as W, useEffect as q, useMemo as we } from "react";
|
|
4
|
+
import { StreamChatService as Ae } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as je, ChannelList as ze, areMessageUIPropsEqual as Ge, useChatContext as He, useTranslationContext as Ve, useMessageReminder as We, useComponentContext as Ze, Attachment as qe, Avatar as Ye, EditMessageModal as Je, MessageOptions as Qe, MessageBlocked as Xe, MessageBouncePrompt as Ke, MessageDeleted as es, MessageIsThreadReplyInChannelButtonIndicator as ss, MessageRepliesCountButton as ts, MessageStatus as ns, MessageTimestamp as Me, ReactionsList as rs, ReminderNotification as as, StreamedMessageText as ls, messageHasAttachments as os, messageHasReactions as is, isDateSeparatorMessage as cs, isMessageBlocked as ds, isMessageBounced as ms, isMessageEdited as us, MessageBounceModal as hs, Poll as fs, MessageText as gs, MessageErrorIcon as xs, MessageEditedTimestamp as Cs, useMessageContext as Ns, useMessageComposer as bs, useStateStore as vs, MessageInput as ws, useMessageInputContext as ys, useMessageComposerHasSendableData as ps, SimpleAttachmentSelector as Es, QuotedMessagePreview as Is, AttachmentPreviewList as _s, TextareaComposer as Ss, Channel as Ms, useChannelStateContext as ke, WithComponents as ks, Window as Rs, MessageList as Ds } from "stream-chat-react";
|
|
6
|
+
import { XIcon as be, CoinVerticalIcon as Ts, ArrowUpIcon as Fs, StarFourIcon as Ls, ArrowLeftIcon as ye, DotsThreeIcon as pe, SpinnerGapIcon as me, SignOutIcon as Os, ProhibitInsetIcon as Ee, FlagIcon as Ps, MagnifyingGlassIcon as Us, ChatCircleDotsIcon as Ie } from "@phosphor-icons/react";
|
|
7
|
+
import { LinkPreviewsManager as _e } from "stream-chat";
|
|
8
|
+
const Re = Be({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,49 +15,49 @@ const ye = Pe({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}),
|
|
18
|
+
}), fe = () => $e(Re), Nt = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
22
|
apiKey: r,
|
|
23
|
-
capabilities:
|
|
24
|
-
debug:
|
|
23
|
+
capabilities: o = {},
|
|
24
|
+
debug: c = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const
|
|
27
|
-
(u, ...
|
|
28
|
-
|
|
26
|
+
const a = T(
|
|
27
|
+
(u, ...v) => {
|
|
28
|
+
c && console.log(`🔥 [MessagingProvider] ${u}`, ...v);
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[c]
|
|
31
31
|
);
|
|
32
|
-
|
|
32
|
+
a("🔄 RENDER START", {
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
34
34
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
35
35
|
serviceConfig: !!n,
|
|
36
|
-
capabilities: Object.keys(
|
|
36
|
+
capabilities: Object.keys(o)
|
|
37
37
|
});
|
|
38
|
-
const [
|
|
38
|
+
const [h, g] = p(null), [x, w] = p(null), [f, l] = p(!1), [D, y] = p(!1), [d, N] = p(null), E = W(!1), I = W({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
42
|
-
capabilities:
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
42
|
+
capabilities: o
|
|
43
|
+
}), S = W(0);
|
|
44
|
+
S.current++, a("📊 RENDER INFO", {
|
|
45
|
+
renderCount: S.current,
|
|
46
46
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
48
|
userChanged: I.current.userId !== (s == null ? void 0 : s.id),
|
|
49
49
|
apiKeyChanged: I.current.apiKey !== r,
|
|
50
50
|
serviceConfigChanged: I.current.serviceConfig !== n,
|
|
51
|
-
capabilitiesChanged: I.current.capabilities !==
|
|
51
|
+
capabilitiesChanged: I.current.capabilities !== o
|
|
52
52
|
}
|
|
53
53
|
}), I.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
55
|
apiKey: r,
|
|
56
56
|
serviceConfig: n,
|
|
57
|
-
capabilities:
|
|
58
|
-
},
|
|
59
|
-
const u =
|
|
60
|
-
if (
|
|
57
|
+
capabilities: o
|
|
58
|
+
}, q(() => {
|
|
59
|
+
const u = S.current;
|
|
60
|
+
if (a("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
61
61
|
renderCount: u,
|
|
62
62
|
apiKey: !!r,
|
|
63
63
|
serviceConfig: !!n,
|
|
@@ -68,166 +68,166 @@ const ye = Pe({
|
|
|
68
68
|
apiKeyStable: I.current.apiKey === r
|
|
69
69
|
}
|
|
70
70
|
}), !r || !n) {
|
|
71
|
-
|
|
71
|
+
a("⚠️ SERVICE INIT SKIPPED", {
|
|
72
72
|
renderCount: u,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
74
74
|
});
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
a("🚀 CREATING NEW SERVICE", {
|
|
78
78
|
renderCount: u,
|
|
79
79
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: I.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const v = new Ae({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: r,
|
|
85
|
-
debug:
|
|
85
|
+
debug: c
|
|
86
86
|
});
|
|
87
|
-
return
|
|
87
|
+
return g(v), a("✅ SERVICE SET", {
|
|
88
88
|
renderCount: u,
|
|
89
|
-
serviceInstance: !!
|
|
89
|
+
serviceInstance: !!v
|
|
90
90
|
}), () => {
|
|
91
|
-
|
|
91
|
+
a("🧹 SERVICE CLEANUP", {
|
|
92
92
|
renderCount: u,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
|
-
}),
|
|
94
|
+
}), v.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
|
-
}, [r, n,
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
if (
|
|
101
|
-
hasService: !!
|
|
96
|
+
}, [r, n, c, a]);
|
|
97
|
+
const C = W(null);
|
|
98
|
+
q(() => {
|
|
99
|
+
var v, j;
|
|
100
|
+
if (a("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
+
hasService: !!h,
|
|
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
|
-
}), !
|
|
108
|
-
|
|
106
|
+
dependencies: { service: !!h, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !h || !s) {
|
|
108
|
+
a("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
if (E.current) {
|
|
112
|
-
|
|
112
|
+
a("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((
|
|
116
|
-
|
|
115
|
+
if (((v = C.current) == null ? void 0 : v.serviceId) === h && ((j = C.current) == null ? void 0 : j.userId) === s.id) {
|
|
116
|
+
a(
|
|
117
117
|
"⚠️ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
119
119
|
);
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
|
|
123
|
+
a("🚀 STARTING USER CONNECTION", { userId: s.id }), E.current = !0, y(!0), N(null);
|
|
124
124
|
try {
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
w(
|
|
125
|
+
a("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
+
const $ = await h.connectUser(s);
|
|
127
|
+
w($), l(!0), C.current = { serviceId: h, userId: s.id }, a("✅ USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
|
-
clientId:
|
|
129
|
+
clientId: $.userID
|
|
130
130
|
});
|
|
131
|
-
} catch (
|
|
132
|
-
const
|
|
133
|
-
N(
|
|
131
|
+
} catch ($) {
|
|
132
|
+
const Z = $ instanceof Error ? $.message : "Connection failed";
|
|
133
|
+
N(Z), a("❌ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
|
-
error:
|
|
135
|
+
error: Z
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
y(!1), E.current = !1, a("🔄 USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
isConnected: f
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [
|
|
145
|
-
hasService: !!
|
|
144
|
+
}, [h, s, a, f]), q(() => (a("🔌 CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!h,
|
|
146
146
|
isConnected: f
|
|
147
147
|
}), () => {
|
|
148
|
-
|
|
148
|
+
h && f ? (a(
|
|
149
149
|
"🧹 CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
152
|
-
hasService: !!
|
|
151
|
+
), C.current = null, h.disconnectUser().catch(console.error)) : a("🔇 CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!h,
|
|
153
153
|
isConnected: f
|
|
154
154
|
});
|
|
155
|
-
}), [
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
hasService: !!
|
|
155
|
+
}), [h, f, a]);
|
|
156
|
+
const M = T(async () => {
|
|
157
|
+
if (a("🔄 REFRESH CONNECTION CALLED", {
|
|
158
|
+
hasService: !!h,
|
|
159
159
|
hasUser: !!s
|
|
160
|
-
}), !
|
|
161
|
-
|
|
160
|
+
}), !h || !s) {
|
|
161
|
+
a("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
a("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), y(!0);
|
|
165
165
|
try {
|
|
166
|
-
|
|
167
|
-
const u = await
|
|
168
|
-
w(u),
|
|
166
|
+
a("🔌 DISCONNECTING FOR REFRESH"), await h.disconnectUser(), a("📞 RECONNECTING FOR REFRESH");
|
|
167
|
+
const u = await h.connectUser(s);
|
|
168
|
+
w(u), l(!0), N(null), a("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
169
|
} catch (u) {
|
|
170
|
-
const
|
|
171
|
-
N(
|
|
170
|
+
const v = u instanceof Error ? u.message : "Refresh failed";
|
|
171
|
+
N(v), a("❌ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
|
-
error:
|
|
173
|
+
error: v
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
y(!1), a("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [
|
|
179
|
-
hasService: !!
|
|
180
|
-
hasClient: !!
|
|
178
|
+
}, [h, s, a]), m = P.useMemo(() => (a("💫 CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!h,
|
|
180
|
+
hasClient: !!x,
|
|
181
181
|
isConnected: f,
|
|
182
|
-
isLoading:
|
|
183
|
-
hasError: !!
|
|
184
|
-
capabilitiesKeys: Object.keys(
|
|
182
|
+
isLoading: D,
|
|
183
|
+
hasError: !!d,
|
|
184
|
+
capabilitiesKeys: Object.keys(o)
|
|
185
185
|
}), {
|
|
186
|
-
service:
|
|
187
|
-
client:
|
|
186
|
+
service: h,
|
|
187
|
+
client: x,
|
|
188
188
|
isConnected: f,
|
|
189
|
-
isLoading:
|
|
190
|
-
error:
|
|
191
|
-
capabilities:
|
|
192
|
-
refreshConnection:
|
|
193
|
-
debug:
|
|
189
|
+
isLoading: D,
|
|
190
|
+
error: d,
|
|
191
|
+
capabilities: o,
|
|
192
|
+
refreshConnection: M,
|
|
193
|
+
debug: c
|
|
194
194
|
}), [
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
h,
|
|
196
|
+
x,
|
|
197
197
|
f,
|
|
198
|
-
|
|
198
|
+
D,
|
|
199
|
+
d,
|
|
200
|
+
o,
|
|
201
|
+
M,
|
|
199
202
|
c,
|
|
200
|
-
a
|
|
201
|
-
R,
|
|
202
|
-
i,
|
|
203
|
-
l
|
|
203
|
+
a
|
|
204
204
|
]);
|
|
205
|
-
return
|
|
206
|
-
renderCount:
|
|
207
|
-
willRenderChat: !!(
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(
|
|
210
|
-
|
|
205
|
+
return a("🔄 RENDER END", {
|
|
206
|
+
renderCount: S.current,
|
|
207
|
+
willRenderChat: !!(x && f),
|
|
208
|
+
contextValueReady: !!m
|
|
209
|
+
}), /* @__PURE__ */ e(Re.Provider, { value: m, children: x && f ? /* @__PURE__ */ e(
|
|
210
|
+
je,
|
|
211
211
|
{
|
|
212
|
-
client:
|
|
212
|
+
client: x,
|
|
213
213
|
customClasses: {
|
|
214
214
|
channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
|
|
215
215
|
},
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
},
|
|
219
|
+
}, Bs = () => fe(), $s = (t, s) => {
|
|
220
220
|
const n = new Date(
|
|
221
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
222
|
-
),
|
|
222
|
+
), o = new Date(
|
|
223
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
224
224
|
).getTime() - n.getTime();
|
|
225
|
-
return Math.floor(
|
|
226
|
-
},
|
|
225
|
+
return Math.floor(o / (1e3 * 60 * 60 * 24));
|
|
226
|
+
}, As = (t) => {
|
|
227
227
|
const s = /* @__PURE__ */ new Date();
|
|
228
228
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
229
229
|
return "Just now";
|
|
230
|
-
const r =
|
|
230
|
+
const r = $s(t, s);
|
|
231
231
|
return r === 0 ? t.toLocaleTimeString([], {
|
|
232
232
|
hour: "numeric",
|
|
233
233
|
minute: "2-digit",
|
|
@@ -237,7 +237,7 @@ const ye = Pe({
|
|
|
237
237
|
day: "numeric",
|
|
238
238
|
year: "2-digit"
|
|
239
239
|
});
|
|
240
|
-
},
|
|
240
|
+
}, Se = [
|
|
241
241
|
"🍎",
|
|
242
242
|
// Apple
|
|
243
243
|
"🍌",
|
|
@@ -265,7 +265,7 @@ const ye = Pe({
|
|
|
265
265
|
"🍈"
|
|
266
266
|
// Melon
|
|
267
267
|
];
|
|
268
|
-
function
|
|
268
|
+
function js(t) {
|
|
269
269
|
let s = 0;
|
|
270
270
|
for (let n = 0; n < t.length; n++) {
|
|
271
271
|
const r = t.charCodeAt(n);
|
|
@@ -273,29 +273,29 @@ function os(t) {
|
|
|
273
273
|
}
|
|
274
274
|
return Math.abs(s);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const n =
|
|
278
|
-
return
|
|
276
|
+
function zs(t) {
|
|
277
|
+
const n = js(t) % Se.length;
|
|
278
|
+
return Se[n];
|
|
279
279
|
}
|
|
280
|
-
const
|
|
280
|
+
const ne = ({
|
|
281
281
|
id: t,
|
|
282
282
|
image: s,
|
|
283
283
|
size: n = 40,
|
|
284
284
|
className: r,
|
|
285
|
-
shape:
|
|
285
|
+
shape: o = "squircle"
|
|
286
286
|
}) => {
|
|
287
|
-
const
|
|
287
|
+
const c = zs(t), h = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", g = o === "circle" ? { borderRadius: "50%" } : {
|
|
288
288
|
borderRadius: "33%",
|
|
289
289
|
"corner-shape": "superellipse(1.3)"
|
|
290
290
|
};
|
|
291
291
|
return /* @__PURE__ */ e(
|
|
292
292
|
"div",
|
|
293
293
|
{
|
|
294
|
-
className:
|
|
294
|
+
className: _("flex-shrink-0 overflow-hidden", r),
|
|
295
295
|
style: {
|
|
296
296
|
width: `${n}px`,
|
|
297
297
|
height: `${n}px`,
|
|
298
|
-
...
|
|
298
|
+
...g
|
|
299
299
|
},
|
|
300
300
|
children: s ? /* @__PURE__ */ e(
|
|
301
301
|
"img",
|
|
@@ -308,77 +308,77 @@ const q = ({
|
|
|
308
308
|
"div",
|
|
309
309
|
{
|
|
310
310
|
"aria-hidden": "true",
|
|
311
|
-
className:
|
|
311
|
+
className: _(
|
|
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: c
|
|
316
316
|
}
|
|
317
317
|
)
|
|
318
318
|
}
|
|
319
319
|
);
|
|
320
|
-
},
|
|
321
|
-
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread:
|
|
322
|
-
var N, E, I,
|
|
323
|
-
const
|
|
320
|
+
}, De = P.memo(
|
|
321
|
+
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: o }) => {
|
|
322
|
+
var N, E, I, S, C, M;
|
|
323
|
+
const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), a = () => {
|
|
324
324
|
t && n(t);
|
|
325
|
-
},
|
|
326
|
-
(
|
|
327
|
-
var u,
|
|
328
|
-
return ((u =
|
|
325
|
+
}, g = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
|
|
326
|
+
(m) => {
|
|
327
|
+
var u, v;
|
|
328
|
+
return ((u = m.user) == null ? void 0 : u.id) && m.user.id !== ((v = t == null ? void 0 : t._client) == null ? void 0 : v.userID);
|
|
329
329
|
}
|
|
330
|
-
),
|
|
330
|
+
), x = ((E = g == null ? void 0 : g.user) == null ? void 0 : E.name) || "Conversation", w = (I = g == null ? void 0 : g.user) == null ? void 0 : I.image, f = (C = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : C[t.state.messages.length - 1], D = (() => {
|
|
331
331
|
var u;
|
|
332
332
|
if (f != null && f.text) return f.text;
|
|
333
|
-
const
|
|
334
|
-
return
|
|
335
|
-
})(),
|
|
333
|
+
const m = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
|
|
334
|
+
return m ? m.og_scrape_url ? m.og_scrape_url : m.type === "image" ? "📷 Sent an image" : m.type === "video" ? "🎥 Sent a video" : m.type === "audio" ? "🎵 Sent audio" : m.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
|
|
335
|
+
})(), y = f != null && f.created_at ? As(new Date(f.created_at)) : "", d = o ?? 0;
|
|
336
336
|
return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
337
337
|
channelId: t == null ? void 0 : t.id,
|
|
338
|
-
isSelected:
|
|
339
|
-
participantName:
|
|
340
|
-
unreadCount:
|
|
341
|
-
hasTimestamp: !!
|
|
338
|
+
isSelected: c,
|
|
339
|
+
participantName: x,
|
|
340
|
+
unreadCount: d,
|
|
341
|
+
hasTimestamp: !!y
|
|
342
342
|
}), /* @__PURE__ */ e(
|
|
343
343
|
"button",
|
|
344
344
|
{
|
|
345
345
|
type: "button",
|
|
346
|
-
onClick:
|
|
347
|
-
className:
|
|
346
|
+
onClick: a,
|
|
347
|
+
className: _(
|
|
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": c,
|
|
351
|
+
"hover:bg-sand": !c
|
|
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
|
+
ne,
|
|
357
357
|
{
|
|
358
|
-
id: ((
|
|
359
|
-
name:
|
|
358
|
+
id: ((M = g == null ? void 0 : g.user) == null ? void 0 : M.id) || t.id || "unknown",
|
|
359
|
+
name: x,
|
|
360
360
|
image: w,
|
|
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
|
-
className:
|
|
370
|
+
className: _(
|
|
371
371
|
"text-sm font-medium truncate",
|
|
372
|
-
|
|
372
|
+
c ? "text-primary" : "text-charcoal"
|
|
373
373
|
),
|
|
374
|
-
children:
|
|
374
|
+
children: x
|
|
375
375
|
}
|
|
376
376
|
),
|
|
377
|
-
|
|
377
|
+
y && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: y })
|
|
378
378
|
] }),
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children:
|
|
381
|
-
|
|
379
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
380
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: D }),
|
|
381
|
+
d > 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: d > 99 ? "99+" : d })
|
|
382
382
|
] })
|
|
383
383
|
] })
|
|
384
384
|
] })
|
|
@@ -386,36 +386,36 @@ const q = ({
|
|
|
386
386
|
);
|
|
387
387
|
}
|
|
388
388
|
);
|
|
389
|
-
|
|
390
|
-
const
|
|
389
|
+
De.displayName = "CustomChannelPreview";
|
|
390
|
+
const Te = P.memo(
|
|
391
391
|
({
|
|
392
392
|
onChannelSelect: t,
|
|
393
393
|
selectedChannel: s,
|
|
394
394
|
filters: n,
|
|
395
395
|
className: r,
|
|
396
|
-
customEmptyStateIndicator:
|
|
396
|
+
customEmptyStateIndicator: o
|
|
397
397
|
}) => {
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
const { debug:
|
|
401
|
-
|
|
402
|
-
renderCount:
|
|
398
|
+
const c = P.useRef(0);
|
|
399
|
+
c.current++;
|
|
400
|
+
const { debug: a = !1 } = fe();
|
|
401
|
+
a && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
402
|
+
renderCount: c.current,
|
|
403
403
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
404
404
|
filters: n
|
|
405
405
|
});
|
|
406
|
-
const
|
|
407
|
-
|
|
406
|
+
const h = P.useMemo(() => (x) => /* @__PURE__ */ e(
|
|
407
|
+
De,
|
|
408
408
|
{
|
|
409
|
-
...
|
|
409
|
+
...x,
|
|
410
410
|
selectedChannel: s,
|
|
411
411
|
onChannelSelect: t,
|
|
412
|
-
debug:
|
|
412
|
+
debug: a
|
|
413
413
|
}
|
|
414
|
-
), [s, t,
|
|
414
|
+
), [s, t, a]);
|
|
415
415
|
return /* @__PURE__ */ e(
|
|
416
416
|
"div",
|
|
417
417
|
{
|
|
418
|
-
className:
|
|
418
|
+
className: _(
|
|
419
419
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
420
420
|
r
|
|
421
421
|
),
|
|
@@ -425,8 +425,8 @@ const Ie = U.memo(
|
|
|
425
425
|
filters: n,
|
|
426
426
|
sort: { last_message_at: -1 },
|
|
427
427
|
options: { limit: 30 },
|
|
428
|
-
Preview:
|
|
429
|
-
EmptyStateIndicator:
|
|
428
|
+
Preview: h,
|
|
429
|
+
EmptyStateIndicator: o
|
|
430
430
|
},
|
|
431
431
|
JSON.stringify(n)
|
|
432
432
|
) })
|
|
@@ -434,8 +434,8 @@ const Ie = U.memo(
|
|
|
434
434
|
);
|
|
435
435
|
}
|
|
436
436
|
);
|
|
437
|
-
|
|
438
|
-
const
|
|
437
|
+
Te.displayName = "ChannelList";
|
|
438
|
+
const de = ({
|
|
439
439
|
variant: t = "default",
|
|
440
440
|
className: s,
|
|
441
441
|
children: n,
|
|
@@ -444,7 +444,7 @@ const ne = ({
|
|
|
444
444
|
"button",
|
|
445
445
|
{
|
|
446
446
|
type: "button",
|
|
447
|
-
className:
|
|
447
|
+
className: _(
|
|
448
448
|
"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
|
|
449
449
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
450
450
|
s
|
|
@@ -453,12 +453,12 @@ const ne = ({
|
|
|
453
453
|
children: n
|
|
454
454
|
}
|
|
455
455
|
);
|
|
456
|
-
function
|
|
457
|
-
return /* @__PURE__ */
|
|
456
|
+
function Fe({ label: t, className: s, children: n, ...r }) {
|
|
457
|
+
return /* @__PURE__ */ i(
|
|
458
458
|
"button",
|
|
459
459
|
{
|
|
460
460
|
type: "button",
|
|
461
|
-
className:
|
|
461
|
+
className: _(
|
|
462
462
|
"rounded-full p-2 transition-colors focus-ring",
|
|
463
463
|
{
|
|
464
464
|
"cursor-not-allowed opacity-50": r.disabled,
|
|
@@ -474,19 +474,207 @@ function Se({ label: t, className: s, children: n, ...r }) {
|
|
|
474
474
|
}
|
|
475
475
|
);
|
|
476
476
|
}
|
|
477
|
-
function
|
|
478
|
-
return /* @__PURE__ */ e(
|
|
477
|
+
function Le({ onClick: t }) {
|
|
478
|
+
return /* @__PURE__ */ e(Fe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(be, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
479
479
|
}
|
|
480
|
-
const
|
|
480
|
+
const Gs = () => /* @__PURE__ */ e("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", children: /* @__PURE__ */ e(
|
|
481
|
+
"path",
|
|
482
|
+
{
|
|
483
|
+
d: "M10.003 5a.705.705 0 0 1-.469.67L6.7 6.7 5.67 9.535a.715.715 0 0 1-1.34 0L3.3 6.7.466 5.67a.715.715 0 0 1 0-1.34L3.3 3.3 4.33.466a.715.715 0 0 1 1.34 0L6.7 3.3l2.834 1.03a.705.705 0 0 1 .469.67",
|
|
484
|
+
fill: "currentColor"
|
|
485
|
+
}
|
|
486
|
+
) }), Hs = (t, s) => {
|
|
487
|
+
try {
|
|
488
|
+
const n = t % 1 !== 0;
|
|
489
|
+
return new Intl.NumberFormat(void 0, {
|
|
490
|
+
style: "currency",
|
|
491
|
+
currency: s || "USD",
|
|
492
|
+
minimumFractionDigits: n ? 2 : 0,
|
|
493
|
+
maximumFractionDigits: 2,
|
|
494
|
+
currencyDisplay: "narrowSymbol"
|
|
495
|
+
}).format(t);
|
|
496
|
+
} catch {
|
|
497
|
+
return `${t} ${s}`;
|
|
498
|
+
}
|
|
499
|
+
}, Vs = {
|
|
500
|
+
tip: {
|
|
501
|
+
label: (t, s) => `Sent with ${Hs(t, s)} tip`,
|
|
502
|
+
icon: /* @__PURE__ */ e(Ts, { size: 12 })
|
|
503
|
+
},
|
|
504
|
+
"paid-priority": {
|
|
505
|
+
label: () => "Priority",
|
|
506
|
+
icon: /* @__PURE__ */ e(Gs, {})
|
|
507
|
+
}
|
|
508
|
+
}, Ws = ({ message: t }) => {
|
|
509
|
+
const s = t.tag_type;
|
|
510
|
+
if (!s || s === "tip" && !t.amount)
|
|
511
|
+
return null;
|
|
512
|
+
const n = Vs[s];
|
|
513
|
+
return /* @__PURE__ */ i("div", { className: `message-tag message-tag--${s}`, children: [
|
|
514
|
+
/* @__PURE__ */ e("span", { className: "message-tag__icon", children: n.icon }),
|
|
515
|
+
/* @__PURE__ */ e("span", { className: "message-tag__label", children: n.label(t.amount ?? 0, t.currency ?? "") })
|
|
516
|
+
] });
|
|
517
|
+
}, Zs = (t) => {
|
|
518
|
+
var L, R;
|
|
519
|
+
const {
|
|
520
|
+
additionalMessageInputProps: s,
|
|
521
|
+
editing: n,
|
|
522
|
+
endOfGroup: r,
|
|
523
|
+
firstOfGroup: o,
|
|
524
|
+
groupedByUser: c,
|
|
525
|
+
handleAction: a,
|
|
526
|
+
handleOpenThread: h,
|
|
527
|
+
handleRetry: g,
|
|
528
|
+
highlighted: x,
|
|
529
|
+
isMessageAIGenerated: w,
|
|
530
|
+
isMyMessage: f,
|
|
531
|
+
message: l,
|
|
532
|
+
onUserClick: D,
|
|
533
|
+
onUserHover: y,
|
|
534
|
+
renderText: d,
|
|
535
|
+
threadList: N
|
|
536
|
+
} = t, { client: E } = He("CustomMessage"), { t: I } = Ve("CustomMessage"), [S, C] = p(!1), [M, m] = p(!1), u = We(l.id), {
|
|
537
|
+
Attachment: v = qe,
|
|
538
|
+
Avatar: j = Ye,
|
|
539
|
+
EditMessageModal: $ = Je,
|
|
540
|
+
MessageOptions: Z = Qe,
|
|
541
|
+
MessageActions: Y = Z,
|
|
542
|
+
MessageBlocked: re = Xe,
|
|
543
|
+
MessageBouncePrompt: ee = Ke,
|
|
544
|
+
MessageDeleted: se = es,
|
|
545
|
+
MessageIsThreadReplyInChannelButtonIndicator: ae = ss,
|
|
546
|
+
MessageRepliesCountButton: U = ts,
|
|
547
|
+
MessageStatus: G = ns,
|
|
548
|
+
MessageTimestamp: J = Me,
|
|
549
|
+
ReactionsList: z = rs,
|
|
550
|
+
ReminderNotification: k = as,
|
|
551
|
+
StreamedMessageText: F = ls,
|
|
552
|
+
PinIndicator: B
|
|
553
|
+
} = Ze("CustomMessage"), H = os(l), Q = is(l), X = we(
|
|
554
|
+
() => w == null ? void 0 : w(l),
|
|
555
|
+
[w, l]
|
|
556
|
+
), A = we(
|
|
557
|
+
() => !l.shared_location && !l.attachments ? [] : l.shared_location ? [l.shared_location, ...l.attachments ?? []] : l.attachments,
|
|
558
|
+
[l]
|
|
559
|
+
);
|
|
560
|
+
if (cs(l))
|
|
561
|
+
return null;
|
|
562
|
+
if (l.deleted_at || l.type === "deleted")
|
|
563
|
+
return /* @__PURE__ */ e(se, { message: l });
|
|
564
|
+
if (ds(l))
|
|
565
|
+
return /* @__PURE__ */ e(re, {});
|
|
566
|
+
const ge = !c || r, oe = !N && !!l.reply_count, ie = !N && l.show_in_channel && l.parent_id, K = l.status === "failed" && ((L = l.error) == null ? void 0 : L.status) !== 403, ce = ms(l), le = us(l) && !X;
|
|
567
|
+
let V;
|
|
568
|
+
K ? V = () => g(l) : ce ? V = () => C(!0) : le && (V = () => m((O) => !O));
|
|
569
|
+
const te = _(
|
|
570
|
+
"str-chat__message str-chat__message-simple",
|
|
571
|
+
`str-chat__message--${l.type}`,
|
|
572
|
+
`str-chat__message--${l.status}`,
|
|
573
|
+
f() ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
574
|
+
l.text ? "str-chat__message--has-text" : "has-no-text",
|
|
575
|
+
{
|
|
576
|
+
"str-chat__message--has-attachment": H,
|
|
577
|
+
"str-chat__message--highlighted": x,
|
|
578
|
+
"str-chat__message--pinned pinned-message": l.pinned,
|
|
579
|
+
"str-chat__message--with-reactions": Q,
|
|
580
|
+
"str-chat__message-send-can-be-retried": (l == null ? void 0 : l.status) === "failed" && ((R = l == null ? void 0 : l.error) == null ? void 0 : R.status) !== 403,
|
|
581
|
+
"str-chat__message-with-thread-link": oe || ie,
|
|
582
|
+
"str-chat__virtual-message__wrapper--end": r,
|
|
583
|
+
"str-chat__virtual-message__wrapper--first": o,
|
|
584
|
+
"str-chat__virtual-message__wrapper--group": c
|
|
585
|
+
}
|
|
586
|
+
), b = l.poll_id && E.polls.fromState(l.poll_id);
|
|
587
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
588
|
+
n && /* @__PURE__ */ e(
|
|
589
|
+
$,
|
|
590
|
+
{
|
|
591
|
+
additionalMessageInputProps: s
|
|
592
|
+
}
|
|
593
|
+
),
|
|
594
|
+
S && /* @__PURE__ */ e(
|
|
595
|
+
hs,
|
|
596
|
+
{
|
|
597
|
+
MessageBouncePrompt: ee,
|
|
598
|
+
onClose: () => C(!1),
|
|
599
|
+
open: S
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
/* @__PURE__ */ i("div", { className: te, children: [
|
|
603
|
+
B && /* @__PURE__ */ e(B, {}),
|
|
604
|
+
!!u && /* @__PURE__ */ e(k, { reminder: u }),
|
|
605
|
+
l.user && /* @__PURE__ */ e(
|
|
606
|
+
j,
|
|
607
|
+
{
|
|
608
|
+
image: l.user.image,
|
|
609
|
+
name: l.user.name || l.user.id,
|
|
610
|
+
onClick: D,
|
|
611
|
+
onMouseOver: y,
|
|
612
|
+
user: l.user
|
|
613
|
+
}
|
|
614
|
+
),
|
|
615
|
+
/* @__PURE__ */ i(
|
|
616
|
+
"div",
|
|
617
|
+
{
|
|
618
|
+
className: _("str-chat__message-inner", {
|
|
619
|
+
"str-chat__simple-message--error-failed": K || ce
|
|
620
|
+
}),
|
|
621
|
+
"data-testid": "message-inner",
|
|
622
|
+
onClick: V,
|
|
623
|
+
onKeyDown: V,
|
|
624
|
+
role: V ? "button" : void 0,
|
|
625
|
+
tabIndex: V ? 0 : void 0,
|
|
626
|
+
children: [
|
|
627
|
+
/* @__PURE__ */ e(Y, {}),
|
|
628
|
+
/* @__PURE__ */ e("div", { className: "str-chat__message-reactions-host", children: Q && /* @__PURE__ */ e(z, { reverse: !0 }) }),
|
|
629
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
630
|
+
b && /* @__PURE__ */ e(fs, { poll: b }),
|
|
631
|
+
A != null && A.length && !l.quoted_message ? /* @__PURE__ */ e(
|
|
632
|
+
v,
|
|
633
|
+
{
|
|
634
|
+
actionHandler: a,
|
|
635
|
+
attachments: A
|
|
636
|
+
}
|
|
637
|
+
) : null,
|
|
638
|
+
/* @__PURE__ */ e(Ws, { message: l }),
|
|
639
|
+
X ? /* @__PURE__ */ e(F, { message: l, renderText: d }) : /* @__PURE__ */ e(gs, { message: l, renderText: d }),
|
|
640
|
+
/* @__PURE__ */ e(xs, {})
|
|
641
|
+
] })
|
|
642
|
+
]
|
|
643
|
+
}
|
|
644
|
+
),
|
|
645
|
+
oe && /* @__PURE__ */ e(
|
|
646
|
+
U,
|
|
647
|
+
{
|
|
648
|
+
onClick: h,
|
|
649
|
+
reply_count: l.reply_count
|
|
650
|
+
}
|
|
651
|
+
),
|
|
652
|
+
ie && /* @__PURE__ */ e(ae, {}),
|
|
653
|
+
ge && /* @__PURE__ */ i("div", { className: "str-chat__message-metadata", children: [
|
|
654
|
+
/* @__PURE__ */ e(G, {}),
|
|
655
|
+
!f() && !!l.user && /* @__PURE__ */ e("span", { className: "str-chat__message-simple-name", children: l.user.name || l.user.id }),
|
|
656
|
+
/* @__PURE__ */ e(J, { customClass: "str-chat__message-simple-timestamp" }),
|
|
657
|
+
le && /* @__PURE__ */ e("span", { className: "str-chat__mesage-simple-edited", children: I("Edited") }),
|
|
658
|
+
le && /* @__PURE__ */ e(Cs, { calendar: !0, open: M })
|
|
659
|
+
] })
|
|
660
|
+
] }, l.id)
|
|
661
|
+
] });
|
|
662
|
+
}, qs = P.memo(
|
|
663
|
+
Zs,
|
|
664
|
+
Ge
|
|
665
|
+
), Ys = (t) => {
|
|
666
|
+
const s = Ns("CustomMessage");
|
|
667
|
+
return /* @__PURE__ */ e(qs, { ...s, ...t });
|
|
668
|
+
}, Js = (t) => ({
|
|
481
669
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
482
|
-
(s) =>
|
|
670
|
+
(s) => _e.previewIsLoaded(s) || _e.previewIsLoading(s)
|
|
483
671
|
)
|
|
484
|
-
}),
|
|
672
|
+
}), Qs = ({
|
|
485
673
|
link: t,
|
|
486
674
|
onDismiss: s
|
|
487
675
|
}) => {
|
|
488
|
-
const { og_scrape_url: n, title: r, image_url:
|
|
489
|
-
return /* @__PURE__ */
|
|
676
|
+
const { og_scrape_url: n, title: r, image_url: o } = t;
|
|
677
|
+
return /* @__PURE__ */ i(
|
|
490
678
|
"a",
|
|
491
679
|
{
|
|
492
680
|
href: n,
|
|
@@ -494,10 +682,10 @@ const cs = (t) => ({
|
|
|
494
682
|
rel: "noopener noreferrer",
|
|
495
683
|
className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
|
|
496
684
|
children: [
|
|
497
|
-
|
|
685
|
+
o && /* @__PURE__ */ e(
|
|
498
686
|
"img",
|
|
499
687
|
{
|
|
500
|
-
src:
|
|
688
|
+
src: o,
|
|
501
689
|
alt: r || "",
|
|
502
690
|
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
503
691
|
}
|
|
@@ -506,47 +694,47 @@ const cs = (t) => ({
|
|
|
506
694
|
"button",
|
|
507
695
|
{
|
|
508
696
|
type: "button",
|
|
509
|
-
onClick: (
|
|
510
|
-
|
|
697
|
+
onClick: (a) => {
|
|
698
|
+
a.preventDefault(), s(n);
|
|
511
699
|
},
|
|
512
700
|
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
701
|
"aria-label": "Close link preview",
|
|
514
|
-
children: /* @__PURE__ */ e(
|
|
702
|
+
children: /* @__PURE__ */ e(be, { className: "size-4 text-black/90" })
|
|
515
703
|
}
|
|
516
704
|
),
|
|
517
|
-
/* @__PURE__ */
|
|
705
|
+
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
518
706
|
r && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: r }),
|
|
519
707
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
520
708
|
] })
|
|
521
709
|
]
|
|
522
710
|
}
|
|
523
711
|
);
|
|
524
|
-
},
|
|
525
|
-
const { linkPreviewsManager: t } =
|
|
712
|
+
}, Xs = () => {
|
|
713
|
+
const { linkPreviewsManager: t } = bs(), { linkPreviews: s } = vs(
|
|
526
714
|
t.state,
|
|
527
|
-
|
|
528
|
-
), n = (
|
|
529
|
-
t.dismissPreview(
|
|
715
|
+
Js
|
|
716
|
+
), n = (o) => {
|
|
717
|
+
t.dismissPreview(o);
|
|
530
718
|
};
|
|
531
|
-
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((
|
|
532
|
-
|
|
719
|
+
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ e(
|
|
720
|
+
Qs,
|
|
533
721
|
{
|
|
534
|
-
link:
|
|
722
|
+
link: o,
|
|
535
723
|
onDismiss: n
|
|
536
724
|
},
|
|
537
|
-
|
|
725
|
+
o.og_scrape_url
|
|
538
726
|
)) }) : null;
|
|
539
|
-
},
|
|
540
|
-
const { handleSubmit: t } =
|
|
541
|
-
return /* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
-
/* @__PURE__ */ e(
|
|
545
|
-
/* @__PURE__ */ e(
|
|
546
|
-
/* @__PURE__ */ e(
|
|
547
|
-
/* @__PURE__ */
|
|
727
|
+
}, Ks = () => {
|
|
728
|
+
const { handleSubmit: t } = ys(), s = ps();
|
|
729
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
730
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Es, {}) }),
|
|
731
|
+
/* @__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: [
|
|
732
|
+
/* @__PURE__ */ e(Is, {}),
|
|
733
|
+
/* @__PURE__ */ e(Xs, {}),
|
|
734
|
+
/* @__PURE__ */ e(_s, {}),
|
|
735
|
+
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
548
736
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
549
|
-
|
|
737
|
+
Ss,
|
|
550
738
|
{
|
|
551
739
|
className: "w-full resize-none outline-none leading-6",
|
|
552
740
|
maxRows: 4
|
|
@@ -561,33 +749,43 @@ const cs = (t) => ({
|
|
|
561
749
|
disabled: !s,
|
|
562
750
|
onClick: t,
|
|
563
751
|
type: "button",
|
|
564
|
-
children: /* @__PURE__ */ e(
|
|
752
|
+
children: /* @__PURE__ */ e(Fs, { className: "size-4" })
|
|
565
753
|
}
|
|
566
754
|
)
|
|
567
755
|
] })
|
|
568
756
|
] })
|
|
569
757
|
] });
|
|
570
|
-
},
|
|
758
|
+
}, et = ({
|
|
571
759
|
renderActions: t
|
|
572
|
-
}) => /* @__PURE__ */
|
|
760
|
+
}) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
573
761
|
t && (t == null ? void 0 : t()),
|
|
574
|
-
/* @__PURE__ */ e(
|
|
575
|
-
] }),
|
|
576
|
-
const s = t.message.hide_date === !0;
|
|
577
|
-
return /* @__PURE__ */
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
762
|
+
/* @__PURE__ */ e(ws, { Input: Ks })
|
|
763
|
+
] }), st = (t) => {
|
|
764
|
+
const s = t.message.hide_date === !0, n = t.message.system_type === "priority";
|
|
765
|
+
return /* @__PURE__ */ i(
|
|
766
|
+
"div",
|
|
767
|
+
{
|
|
768
|
+
className: _("str-chat__message--system", {
|
|
769
|
+
"str-chat__message--system--priority": n
|
|
770
|
+
}),
|
|
771
|
+
"data-testid": "message-system",
|
|
772
|
+
children: [
|
|
773
|
+
n && /* @__PURE__ */ e(Ls, { size: 18, className: "mx-auto mb-2 mt-3" }),
|
|
774
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
|
|
775
|
+
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
776
|
+
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
777
|
+
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
778
|
+
] }),
|
|
779
|
+
!s && /* @__PURE__ */ e(Me, { message: t.message })
|
|
780
|
+
]
|
|
781
|
+
}
|
|
782
|
+
);
|
|
783
|
+
}, tt = () => null, nt = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
586
784
|
"div",
|
|
587
785
|
{
|
|
588
|
-
className:
|
|
786
|
+
className: _("flex items-center justify-center h-full", t),
|
|
589
787
|
children: [
|
|
590
|
-
/* @__PURE__ */
|
|
788
|
+
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
591
789
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
592
790
|
"animateTransform",
|
|
593
791
|
{
|
|
@@ -625,25 +823,25 @@ const cs = (t) => ({
|
|
|
625
823
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
626
824
|
]
|
|
627
825
|
}
|
|
628
|
-
),
|
|
629
|
-
/* @__PURE__ */ e(
|
|
826
|
+
), he = 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: [
|
|
827
|
+
/* @__PURE__ */ e(nt, { className: "w-6 h-6" }),
|
|
630
828
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
631
829
|
] }) }));
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
var
|
|
635
|
-
const { channel:
|
|
636
|
-
(
|
|
637
|
-
var
|
|
638
|
-
return ((
|
|
830
|
+
he.displayName = "LoadingState";
|
|
831
|
+
const rt = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
832
|
+
var g, x, w, f, l;
|
|
833
|
+
const { channel: o } = ke(), c = P.useMemo(() => Object.values(o.state.members || {}).find(
|
|
834
|
+
(y) => {
|
|
835
|
+
var d;
|
|
836
|
+
return ((d = y.user) == null ? void 0 : d.id) && y.user.id !== o._client.userID;
|
|
639
837
|
}
|
|
640
|
-
), [
|
|
641
|
-
return /* @__PURE__ */
|
|
642
|
-
/* @__PURE__ */
|
|
838
|
+
), [o._client.userID, o.state.members]), a = ((g = c == null ? void 0 : c.user) == null ? void 0 : g.name) || ((x = c == null ? void 0 : c.user) == null ? void 0 : x.id) || "Unknown member", h = (w = c == null ? void 0 : c.user) == null ? void 0 : w.image;
|
|
839
|
+
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
840
|
+
/* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
643
841
|
/* @__PURE__ */ e(
|
|
644
842
|
"button",
|
|
645
843
|
{
|
|
646
|
-
className:
|
|
844
|
+
className: _(
|
|
647
845
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
648
846
|
!s && "invisible"
|
|
649
847
|
),
|
|
@@ -651,36 +849,36 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
651
849
|
}),
|
|
652
850
|
type: "button",
|
|
653
851
|
"aria-label": "Back to conversations",
|
|
654
|
-
children: /* @__PURE__ */ e(
|
|
852
|
+
children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
|
|
655
853
|
}
|
|
656
854
|
),
|
|
657
|
-
/* @__PURE__ */
|
|
855
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
658
856
|
/* @__PURE__ */ e(
|
|
659
|
-
|
|
857
|
+
ne,
|
|
660
858
|
{
|
|
661
|
-
id: ((f =
|
|
662
|
-
name:
|
|
663
|
-
image:
|
|
859
|
+
id: ((f = c == null ? void 0 : c.user) == null ? void 0 : f.id) || o.id || "unknown",
|
|
860
|
+
name: a,
|
|
861
|
+
image: h,
|
|
664
862
|
size: 40
|
|
665
863
|
}
|
|
666
864
|
),
|
|
667
|
-
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children:
|
|
865
|
+
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: a })
|
|
668
866
|
] }),
|
|
669
867
|
/* @__PURE__ */ e(
|
|
670
868
|
"button",
|
|
671
869
|
{
|
|
672
|
-
className:
|
|
870
|
+
className: _(
|
|
673
871
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
674
872
|
),
|
|
675
873
|
onClick: n,
|
|
676
874
|
type: "button",
|
|
677
875
|
"aria-label": "Show info",
|
|
678
|
-
children: /* @__PURE__ */ e(
|
|
876
|
+
children: /* @__PURE__ */ e(pe, { className: "size-5 text-black/90" })
|
|
679
877
|
}
|
|
680
878
|
)
|
|
681
879
|
] }),
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
880
|
+
/* @__PURE__ */ i("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
|
|
881
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
684
882
|
s && t && /* @__PURE__ */ e(
|
|
685
883
|
"button",
|
|
686
884
|
{
|
|
@@ -688,100 +886,100 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
688
886
|
onClick: t,
|
|
689
887
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
690
888
|
"aria-label": "Back to conversations",
|
|
691
|
-
children: /* @__PURE__ */ e(
|
|
889
|
+
children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
|
|
692
890
|
}
|
|
693
891
|
),
|
|
694
892
|
/* @__PURE__ */ e(
|
|
695
|
-
|
|
893
|
+
ne,
|
|
696
894
|
{
|
|
697
|
-
id: ((
|
|
698
|
-
name:
|
|
699
|
-
image:
|
|
895
|
+
id: ((l = c == null ? void 0 : c.user) == null ? void 0 : l.id) || o.id || "unknown",
|
|
896
|
+
name: a,
|
|
897
|
+
image: h,
|
|
700
898
|
size: 40
|
|
701
899
|
}
|
|
702
900
|
),
|
|
703
|
-
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children:
|
|
901
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: a }) })
|
|
704
902
|
] }),
|
|
705
903
|
r && n && /* @__PURE__ */ e(
|
|
706
904
|
"button",
|
|
707
905
|
{
|
|
708
|
-
className:
|
|
906
|
+
className: _(
|
|
709
907
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
710
908
|
),
|
|
711
909
|
onClick: n,
|
|
712
|
-
children: /* @__PURE__ */ e(
|
|
910
|
+
children: /* @__PURE__ */ e(pe, { className: "size-5 text-black/90" })
|
|
713
911
|
}
|
|
714
912
|
)
|
|
715
913
|
] })
|
|
716
914
|
] });
|
|
717
|
-
},
|
|
915
|
+
}, at = ({
|
|
718
916
|
dialogRef: t,
|
|
719
917
|
onClose: s,
|
|
720
918
|
participant: n,
|
|
721
919
|
channel: r,
|
|
722
|
-
followerStatusLabel:
|
|
723
|
-
onLeaveConversation:
|
|
724
|
-
onBlockParticipant:
|
|
725
|
-
showDeleteConversation:
|
|
726
|
-
onDeleteConversationClick:
|
|
727
|
-
onBlockParticipantClick:
|
|
920
|
+
followerStatusLabel: o,
|
|
921
|
+
onLeaveConversation: c,
|
|
922
|
+
onBlockParticipant: a,
|
|
923
|
+
showDeleteConversation: h = !0,
|
|
924
|
+
onDeleteConversationClick: g,
|
|
925
|
+
onBlockParticipantClick: x,
|
|
728
926
|
onReportParticipantClick: w
|
|
729
927
|
}) => {
|
|
730
|
-
var
|
|
731
|
-
const { service: f, debug:
|
|
732
|
-
var
|
|
733
|
-
if (!(!f || !((
|
|
928
|
+
var ee, se, ae, U, G, J, z;
|
|
929
|
+
const { service: f, debug: l } = fe(), [D, y] = p(!1), [d, N] = p(!1), [E, I] = p(!1), S = T(async () => {
|
|
930
|
+
var k;
|
|
931
|
+
if (!(!f || !((k = n == null ? void 0 : n.user) != null && k.id)))
|
|
734
932
|
try {
|
|
735
|
-
const
|
|
736
|
-
(
|
|
737
|
-
var
|
|
738
|
-
return
|
|
933
|
+
const B = (await f.getBlockedUsers()).some(
|
|
934
|
+
(H) => {
|
|
935
|
+
var Q;
|
|
936
|
+
return H.blocked_user_id === ((Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id);
|
|
739
937
|
}
|
|
740
938
|
);
|
|
741
|
-
|
|
742
|
-
} catch (
|
|
939
|
+
y(B);
|
|
940
|
+
} catch (F) {
|
|
743
941
|
console.error(
|
|
744
942
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
745
|
-
|
|
943
|
+
F
|
|
746
944
|
);
|
|
747
945
|
}
|
|
748
|
-
}, [f, (
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
}, [
|
|
752
|
-
const
|
|
753
|
-
var
|
|
754
|
-
if (!
|
|
755
|
-
|
|
946
|
+
}, [f, (ee = n == null ? void 0 : n.user) == null ? void 0 : ee.id]);
|
|
947
|
+
q(() => {
|
|
948
|
+
S();
|
|
949
|
+
}, [S]);
|
|
950
|
+
const C = async () => {
|
|
951
|
+
var k;
|
|
952
|
+
if (!d) {
|
|
953
|
+
g == null || g(), l && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
|
|
756
954
|
try {
|
|
757
|
-
const
|
|
758
|
-
await r.hide(
|
|
759
|
-
} catch (
|
|
760
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
955
|
+
const F = ((k = r._client) == null ? void 0 : k.userID) ?? null;
|
|
956
|
+
await r.hide(F, !1), c && await c(r), s();
|
|
957
|
+
} catch (F) {
|
|
958
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", F);
|
|
761
959
|
} finally {
|
|
762
960
|
N(!1);
|
|
763
961
|
}
|
|
764
962
|
}
|
|
765
|
-
},
|
|
766
|
-
var
|
|
963
|
+
}, M = async () => {
|
|
964
|
+
var k, F, B;
|
|
767
965
|
if (!(E || !f)) {
|
|
768
|
-
|
|
966
|
+
x == null || x(), l && console.log("[ChannelInfoDialog] Block member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), I(!0);
|
|
769
967
|
try {
|
|
770
|
-
await f.blockUser((
|
|
771
|
-
} catch (
|
|
772
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
968
|
+
await f.blockUser((F = n == null ? void 0 : n.user) == null ? void 0 : F.id), a && await a((B = n == null ? void 0 : n.user) == null ? void 0 : B.id), s();
|
|
969
|
+
} catch (H) {
|
|
970
|
+
console.error("[ChannelInfoDialog] Failed to block member", H);
|
|
773
971
|
} finally {
|
|
774
972
|
I(!1);
|
|
775
973
|
}
|
|
776
974
|
}
|
|
777
|
-
},
|
|
778
|
-
var
|
|
975
|
+
}, m = async () => {
|
|
976
|
+
var k, F, B;
|
|
779
977
|
if (!(E || !f)) {
|
|
780
|
-
|
|
978
|
+
x == null || x(), l && console.log("[ChannelInfoDialog] Unblock member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), I(!0);
|
|
781
979
|
try {
|
|
782
|
-
await f.unBlockUser((
|
|
783
|
-
} catch (
|
|
784
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
980
|
+
await f.unBlockUser((F = n == null ? void 0 : n.user) == null ? void 0 : F.id), a && await a((B = n == null ? void 0 : n.user) == null ? void 0 : B.id), s();
|
|
981
|
+
} catch (H) {
|
|
982
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", H);
|
|
785
983
|
} finally {
|
|
786
984
|
I(!1);
|
|
787
985
|
}
|
|
@@ -794,7 +992,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
794
992
|
);
|
|
795
993
|
};
|
|
796
994
|
if (!n) return null;
|
|
797
|
-
const
|
|
995
|
+
const v = ((se = n.user) == null ? void 0 : se.name) || ((ae = n.user) == null ? void 0 : ae.id) || "Unknown member", j = (U = n.user) == null ? void 0 : U.image, $ = (G = n.user) == null ? void 0 : G.email, Z = (J = n.user) == null ? void 0 : J.username, Y = $ || (Z ? `linktr.ee/${Z}` : void 0), re = ((z = n.user) == null ? void 0 : z.id) || "unknown";
|
|
798
996
|
return (
|
|
799
997
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
800
998
|
/* @__PURE__ */ e(
|
|
@@ -803,90 +1001,90 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
803
1001
|
ref: t,
|
|
804
1002
|
className: "mes-dialog group",
|
|
805
1003
|
onClose: s,
|
|
806
|
-
onClick: (
|
|
807
|
-
|
|
1004
|
+
onClick: (k) => {
|
|
1005
|
+
k.target === t.current && s();
|
|
808
1006
|
},
|
|
809
|
-
children: /* @__PURE__ */
|
|
810
|
-
/* @__PURE__ */
|
|
1007
|
+
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: [
|
|
1008
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
811
1009
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
812
|
-
/* @__PURE__ */ e(
|
|
1010
|
+
/* @__PURE__ */ e(Le, { onClick: s })
|
|
813
1011
|
] }),
|
|
814
|
-
/* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
815
1013
|
/* @__PURE__ */ e(
|
|
816
1014
|
"div",
|
|
817
1015
|
{
|
|
818
1016
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
819
1017
|
style: { backgroundColor: "#FBFAF9" },
|
|
820
|
-
children: /* @__PURE__ */
|
|
1018
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
821
1019
|
/* @__PURE__ */ e(
|
|
822
|
-
|
|
1020
|
+
ne,
|
|
823
1021
|
{
|
|
824
|
-
id:
|
|
825
|
-
name:
|
|
826
|
-
image:
|
|
1022
|
+
id: re,
|
|
1023
|
+
name: v,
|
|
1024
|
+
image: j,
|
|
827
1025
|
size: 88,
|
|
828
1026
|
shape: "circle"
|
|
829
1027
|
}
|
|
830
1028
|
),
|
|
831
|
-
/* @__PURE__ */
|
|
832
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
1029
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
1030
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: v }),
|
|
833
1031
|
Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
|
|
834
|
-
|
|
1032
|
+
o && /* @__PURE__ */ e(
|
|
835
1033
|
"span",
|
|
836
1034
|
{
|
|
837
1035
|
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
838
1036
|
style: {
|
|
839
1037
|
padding: "4px 8px",
|
|
840
|
-
backgroundColor:
|
|
841
|
-
color:
|
|
1038
|
+
backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
|
|
1039
|
+
color: o === "Subscribed to you" ? "#008236" : "#78716C",
|
|
842
1040
|
lineHeight: "133.333%",
|
|
843
1041
|
letterSpacing: "0.21px"
|
|
844
1042
|
},
|
|
845
|
-
children:
|
|
1043
|
+
children: o
|
|
846
1044
|
}
|
|
847
1045
|
)
|
|
848
1046
|
] })
|
|
849
1047
|
] })
|
|
850
1048
|
}
|
|
851
1049
|
),
|
|
852
|
-
/* @__PURE__ */
|
|
853
|
-
|
|
854
|
-
|
|
1050
|
+
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
1051
|
+
h && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1052
|
+
de,
|
|
855
1053
|
{
|
|
856
|
-
onClick:
|
|
857
|
-
disabled:
|
|
858
|
-
"aria-busy":
|
|
1054
|
+
onClick: C,
|
|
1055
|
+
disabled: d,
|
|
1056
|
+
"aria-busy": d,
|
|
859
1057
|
children: [
|
|
860
|
-
|
|
1058
|
+
d ? /* @__PURE__ */ e(me, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Os, { className: "h-5 w-5" }),
|
|
861
1059
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
862
1060
|
]
|
|
863
1061
|
}
|
|
864
1062
|
) }),
|
|
865
|
-
/* @__PURE__ */ e("li", { children:
|
|
866
|
-
|
|
1063
|
+
/* @__PURE__ */ e("li", { children: D ? /* @__PURE__ */ i(
|
|
1064
|
+
de,
|
|
867
1065
|
{
|
|
868
|
-
onClick:
|
|
1066
|
+
onClick: m,
|
|
869
1067
|
disabled: E,
|
|
870
1068
|
"aria-busy": E,
|
|
871
1069
|
children: [
|
|
872
|
-
E ? /* @__PURE__ */ e(
|
|
1070
|
+
E ? /* @__PURE__ */ e(me, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ee, { className: "h-5 w-5" }),
|
|
873
1071
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
874
1072
|
]
|
|
875
1073
|
}
|
|
876
|
-
) : /* @__PURE__ */
|
|
877
|
-
|
|
1074
|
+
) : /* @__PURE__ */ i(
|
|
1075
|
+
de,
|
|
878
1076
|
{
|
|
879
|
-
onClick:
|
|
1077
|
+
onClick: M,
|
|
880
1078
|
disabled: E,
|
|
881
1079
|
"aria-busy": E,
|
|
882
1080
|
children: [
|
|
883
|
-
E ? /* @__PURE__ */ e(
|
|
1081
|
+
E ? /* @__PURE__ */ e(me, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ee, { className: "h-5 w-5" }),
|
|
884
1082
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
885
1083
|
]
|
|
886
1084
|
}
|
|
887
1085
|
) }),
|
|
888
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
889
|
-
/* @__PURE__ */ e(
|
|
1086
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(de, { variant: "danger", onClick: u, children: [
|
|
1087
|
+
/* @__PURE__ */ e(Ps, { className: "h-5 w-5" }),
|
|
890
1088
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
891
1089
|
] }) })
|
|
892
1090
|
] })
|
|
@@ -895,117 +1093,125 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
895
1093
|
}
|
|
896
1094
|
)
|
|
897
1095
|
);
|
|
898
|
-
},
|
|
1096
|
+
}, lt = ({
|
|
899
1097
|
onBack: t,
|
|
900
1098
|
showBackButton: s,
|
|
901
1099
|
renderMessageInputActions: n,
|
|
902
1100
|
onLeaveConversation: r,
|
|
903
|
-
onBlockParticipant:
|
|
904
|
-
showDeleteConversation:
|
|
905
|
-
onDeleteConversationClick:
|
|
906
|
-
onBlockParticipantClick:
|
|
907
|
-
onReportParticipantClick:
|
|
1101
|
+
onBlockParticipant: o,
|
|
1102
|
+
showDeleteConversation: c = !0,
|
|
1103
|
+
onDeleteConversationClick: a,
|
|
1104
|
+
onBlockParticipantClick: h,
|
|
1105
|
+
onReportParticipantClick: g
|
|
908
1106
|
}) => {
|
|
909
|
-
const { channel:
|
|
1107
|
+
const { channel: x } = ke(), w = W(null), f = P.useMemo(() => Object.values(x.state.members || {}).find(
|
|
910
1108
|
(N) => {
|
|
911
1109
|
var E;
|
|
912
|
-
return ((E = N.user) == null ? void 0 : E.id) && N.user.id !==
|
|
1110
|
+
return ((E = N.user) == null ? void 0 : E.id) && N.user.id !== x._client.userID;
|
|
913
1111
|
}
|
|
914
|
-
), [
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
-
return String(
|
|
918
|
-
if (
|
|
919
|
-
return
|
|
920
|
-
}, [
|
|
921
|
-
var
|
|
922
|
-
(
|
|
923
|
-
}, []),
|
|
924
|
-
var
|
|
925
|
-
(
|
|
1112
|
+
), [x._client.userID, x.state.members]), l = P.useMemo(() => {
|
|
1113
|
+
const d = x.data ?? {};
|
|
1114
|
+
if (d.followerStatus)
|
|
1115
|
+
return String(d.followerStatus);
|
|
1116
|
+
if (d.isFollower !== void 0)
|
|
1117
|
+
return d.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1118
|
+
}, [x.data]), D = T(() => {
|
|
1119
|
+
var d;
|
|
1120
|
+
(d = w.current) == null || d.showModal();
|
|
1121
|
+
}, []), y = T(() => {
|
|
1122
|
+
var d;
|
|
1123
|
+
(d = w.current) == null || d.close();
|
|
926
1124
|
}, []);
|
|
927
|
-
return /* @__PURE__ */
|
|
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
|
-
] }),
|
|
1125
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
953
1126
|
/* @__PURE__ */ e(
|
|
954
|
-
|
|
1127
|
+
ks,
|
|
1128
|
+
{
|
|
1129
|
+
overrides: {
|
|
1130
|
+
Message: (d) => /* @__PURE__ */ e(Ys, { ...d })
|
|
1131
|
+
},
|
|
1132
|
+
children: /* @__PURE__ */ i(Rs, { children: [
|
|
1133
|
+
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
1134
|
+
rt,
|
|
1135
|
+
{
|
|
1136
|
+
onBack: t,
|
|
1137
|
+
showBackButton: s,
|
|
1138
|
+
onShowInfo: D,
|
|
1139
|
+
canShowInfo: !!f
|
|
1140
|
+
}
|
|
1141
|
+
) }),
|
|
1142
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1143
|
+
Ds,
|
|
1144
|
+
{
|
|
1145
|
+
hideDeletedMessages: !0,
|
|
1146
|
+
hideNewMessageSeparator: !1,
|
|
1147
|
+
messageActions: void 0
|
|
1148
|
+
}
|
|
1149
|
+
) }),
|
|
1150
|
+
/* @__PURE__ */ e(
|
|
1151
|
+
et,
|
|
1152
|
+
{
|
|
1153
|
+
renderActions: () => n == null ? void 0 : n(x)
|
|
1154
|
+
}
|
|
1155
|
+
)
|
|
1156
|
+
] })
|
|
1157
|
+
}
|
|
1158
|
+
),
|
|
1159
|
+
/* @__PURE__ */ e(
|
|
1160
|
+
at,
|
|
955
1161
|
{
|
|
956
1162
|
dialogRef: w,
|
|
957
|
-
onClose:
|
|
1163
|
+
onClose: y,
|
|
958
1164
|
participant: f,
|
|
959
|
-
channel:
|
|
960
|
-
followerStatusLabel:
|
|
1165
|
+
channel: x,
|
|
1166
|
+
followerStatusLabel: l,
|
|
961
1167
|
onLeaveConversation: r,
|
|
962
|
-
onBlockParticipant:
|
|
963
|
-
showDeleteConversation:
|
|
964
|
-
onDeleteConversationClick:
|
|
965
|
-
onBlockParticipantClick:
|
|
966
|
-
onReportParticipantClick:
|
|
1168
|
+
onBlockParticipant: o,
|
|
1169
|
+
showDeleteConversation: c,
|
|
1170
|
+
onDeleteConversationClick: a,
|
|
1171
|
+
onBlockParticipantClick: h,
|
|
1172
|
+
onReportParticipantClick: g
|
|
967
1173
|
}
|
|
968
1174
|
)
|
|
969
1175
|
] });
|
|
970
|
-
},
|
|
1176
|
+
}, Oe = P.memo(
|
|
971
1177
|
({
|
|
972
1178
|
channel: t,
|
|
973
1179
|
onBack: s,
|
|
974
1180
|
showBackButton: n = !1,
|
|
975
1181
|
renderMessageInputActions: r,
|
|
976
|
-
onLeaveConversation:
|
|
977
|
-
onBlockParticipant:
|
|
978
|
-
className:
|
|
979
|
-
CustomChannelEmptyState:
|
|
980
|
-
showDeleteConversation:
|
|
981
|
-
onDeleteConversationClick:
|
|
1182
|
+
onLeaveConversation: o,
|
|
1183
|
+
onBlockParticipant: c,
|
|
1184
|
+
className: a,
|
|
1185
|
+
CustomChannelEmptyState: h = tt,
|
|
1186
|
+
showDeleteConversation: g = !0,
|
|
1187
|
+
onDeleteConversationClick: x,
|
|
982
1188
|
onBlockParticipantClick: w,
|
|
983
1189
|
onReportParticipantClick: f
|
|
984
1190
|
}) => /* @__PURE__ */ e(
|
|
985
1191
|
"div",
|
|
986
1192
|
{
|
|
987
|
-
className:
|
|
1193
|
+
className: _(
|
|
988
1194
|
"messaging-channel-view h-full flex flex-col",
|
|
989
|
-
|
|
1195
|
+
a
|
|
990
1196
|
),
|
|
991
1197
|
children: /* @__PURE__ */ e(
|
|
992
|
-
|
|
1198
|
+
Ms,
|
|
993
1199
|
{
|
|
994
1200
|
channel: t,
|
|
995
|
-
MessageSystem:
|
|
996
|
-
EmptyStateIndicator:
|
|
997
|
-
LoadingIndicator:
|
|
1201
|
+
MessageSystem: st,
|
|
1202
|
+
EmptyStateIndicator: h,
|
|
1203
|
+
LoadingIndicator: he,
|
|
998
1204
|
children: /* @__PURE__ */ e(
|
|
999
|
-
|
|
1205
|
+
lt,
|
|
1000
1206
|
{
|
|
1001
1207
|
onBack: s,
|
|
1002
1208
|
showBackButton: n,
|
|
1003
1209
|
renderMessageInputActions: r,
|
|
1004
|
-
onLeaveConversation:
|
|
1005
|
-
onBlockParticipant:
|
|
1006
|
-
CustomChannelEmptyState:
|
|
1007
|
-
showDeleteConversation:
|
|
1008
|
-
onDeleteConversationClick:
|
|
1210
|
+
onLeaveConversation: o,
|
|
1211
|
+
onBlockParticipant: c,
|
|
1212
|
+
CustomChannelEmptyState: h,
|
|
1213
|
+
showDeleteConversation: g,
|
|
1214
|
+
onDeleteConversationClick: x,
|
|
1009
1215
|
onBlockParticipantClick: w,
|
|
1010
1216
|
onReportParticipantClick: f
|
|
1011
1217
|
}
|
|
@@ -1015,16 +1221,16 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1015
1221
|
}
|
|
1016
1222
|
)
|
|
1017
1223
|
);
|
|
1018
|
-
|
|
1019
|
-
function
|
|
1224
|
+
Oe.displayName = "ChannelView";
|
|
1225
|
+
function ot({
|
|
1020
1226
|
searchQuery: t,
|
|
1021
1227
|
setSearchQuery: s,
|
|
1022
1228
|
placeholder: n
|
|
1023
1229
|
}) {
|
|
1024
|
-
const r =
|
|
1025
|
-
return /* @__PURE__ */
|
|
1230
|
+
const r = W(null);
|
|
1231
|
+
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1026
1232
|
/* @__PURE__ */ e(
|
|
1027
|
-
|
|
1233
|
+
Us,
|
|
1028
1234
|
{
|
|
1029
1235
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1030
1236
|
weight: "bold"
|
|
@@ -1037,162 +1243,162 @@ function vs({
|
|
|
1037
1243
|
type: "text",
|
|
1038
1244
|
placeholder: n,
|
|
1039
1245
|
value: t,
|
|
1040
|
-
onChange: (
|
|
1246
|
+
onChange: (o) => s(o.target.value),
|
|
1041
1247
|
className: "w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent"
|
|
1042
1248
|
}
|
|
1043
1249
|
),
|
|
1044
1250
|
t && /* @__PURE__ */ e(
|
|
1045
|
-
|
|
1251
|
+
Fe,
|
|
1046
1252
|
{
|
|
1047
1253
|
label: "Clear search",
|
|
1048
1254
|
onClick: () => {
|
|
1049
|
-
var
|
|
1050
|
-
s(""), (
|
|
1255
|
+
var o;
|
|
1256
|
+
s(""), (o = r.current) == null || o.focus();
|
|
1051
1257
|
},
|
|
1052
1258
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1053
|
-
children: /* @__PURE__ */ e(
|
|
1259
|
+
children: /* @__PURE__ */ e(be, { className: "h-4 w-4", weight: "bold" })
|
|
1054
1260
|
}
|
|
1055
1261
|
)
|
|
1056
1262
|
] });
|
|
1057
1263
|
}
|
|
1058
|
-
const
|
|
1264
|
+
const it = ({
|
|
1059
1265
|
participantSource: t,
|
|
1060
1266
|
onSelectParticipant: s,
|
|
1061
1267
|
onClose: n,
|
|
1062
1268
|
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
1063
|
-
participantLabel:
|
|
1064
|
-
searchPlaceholder:
|
|
1065
|
-
className:
|
|
1269
|
+
participantLabel: o = "participants",
|
|
1270
|
+
searchPlaceholder: c = "Search participants...",
|
|
1271
|
+
className: a
|
|
1066
1272
|
}) => {
|
|
1067
|
-
const { debug:
|
|
1273
|
+
const { debug: h } = fe(), [g, x] = p(""), [w, f] = p([]), [l, D] = p(!1), [y, d] = p(null), [N, E] = p(
|
|
1068
1274
|
null
|
|
1069
|
-
), I =
|
|
1070
|
-
|
|
1275
|
+
), I = W(!1);
|
|
1276
|
+
q(() => {
|
|
1071
1277
|
if (t.loading) {
|
|
1072
|
-
|
|
1278
|
+
h && console.log(
|
|
1073
1279
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1074
1280
|
);
|
|
1075
1281
|
return;
|
|
1076
1282
|
}
|
|
1077
1283
|
if (I.current) return;
|
|
1078
1284
|
(async () => {
|
|
1079
|
-
|
|
1285
|
+
h && console.log("[ParticipantPicker] Loading initial participants..."), D(!0), d(null);
|
|
1080
1286
|
try {
|
|
1081
1287
|
const u = await t.loadParticipants({
|
|
1082
1288
|
search: "",
|
|
1083
1289
|
// Load all participants initially
|
|
1084
1290
|
limit: 100
|
|
1085
1291
|
});
|
|
1086
|
-
f(u.participants), I.current = !0,
|
|
1292
|
+
f(u.participants), I.current = !0, h && console.log(
|
|
1087
1293
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1088
1294
|
u.participants.length
|
|
1089
1295
|
);
|
|
1090
1296
|
} catch (u) {
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1297
|
+
const v = u instanceof Error ? u.message : "Failed to load participants";
|
|
1298
|
+
d(v), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
1093
1299
|
} finally {
|
|
1094
|
-
|
|
1300
|
+
D(!1);
|
|
1095
1301
|
}
|
|
1096
1302
|
})();
|
|
1097
|
-
}, [t.loading,
|
|
1098
|
-
const
|
|
1099
|
-
var
|
|
1100
|
-
if (!
|
|
1101
|
-
const u =
|
|
1102
|
-
return
|
|
1103
|
-
}),
|
|
1104
|
-
async (
|
|
1303
|
+
}, [t.loading, h]);
|
|
1304
|
+
const S = w.filter((m) => !r.has(m.id)).filter((m) => {
|
|
1305
|
+
var v;
|
|
1306
|
+
if (!g) return !0;
|
|
1307
|
+
const u = g.toLowerCase();
|
|
1308
|
+
return m.name.toLowerCase().includes(u) || ((v = m.email) == null ? void 0 : v.toLowerCase().includes(u)) || !1;
|
|
1309
|
+
}), C = T(
|
|
1310
|
+
async (m) => {
|
|
1105
1311
|
if (!N) {
|
|
1106
|
-
E(
|
|
1312
|
+
E(m.id);
|
|
1107
1313
|
try {
|
|
1108
|
-
await s(
|
|
1314
|
+
await s(m);
|
|
1109
1315
|
} catch (u) {
|
|
1110
1316
|
console.error("[ParticipantPicker] Failed to start chat:", u), E(null);
|
|
1111
1317
|
}
|
|
1112
1318
|
}
|
|
1113
1319
|
},
|
|
1114
1320
|
[s, N]
|
|
1115
|
-
),
|
|
1116
|
-
(
|
|
1321
|
+
), M = (m, u) => {
|
|
1322
|
+
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), C(u));
|
|
1117
1323
|
};
|
|
1118
|
-
return /* @__PURE__ */
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
/* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ i("div", { className: _("flex flex-col h-full", a), children: [
|
|
1325
|
+
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1326
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1121
1327
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1122
|
-
/* @__PURE__ */ e(
|
|
1328
|
+
/* @__PURE__ */ e(Le, { onClick: n })
|
|
1123
1329
|
] }),
|
|
1124
|
-
/* @__PURE__ */
|
|
1330
|
+
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1125
1331
|
"Select a ",
|
|
1126
|
-
|
|
1332
|
+
o.slice(0, -1),
|
|
1127
1333
|
" to start messaging (",
|
|
1128
|
-
|
|
1334
|
+
S.length,
|
|
1129
1335
|
" available)",
|
|
1130
|
-
t.totalCount !== void 0 && ` • ${t.totalCount} ${
|
|
1336
|
+
t.totalCount !== void 0 && ` • ${t.totalCount} ${o} total`
|
|
1131
1337
|
] }),
|
|
1132
1338
|
/* @__PURE__ */ e(
|
|
1133
|
-
|
|
1339
|
+
ot,
|
|
1134
1340
|
{
|
|
1135
|
-
searchQuery:
|
|
1136
|
-
setSearchQuery:
|
|
1137
|
-
placeholder:
|
|
1341
|
+
searchQuery: g,
|
|
1342
|
+
setSearchQuery: x,
|
|
1343
|
+
placeholder: c
|
|
1138
1344
|
}
|
|
1139
1345
|
)
|
|
1140
1346
|
] }),
|
|
1141
|
-
|
|
1347
|
+
y && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1142
1348
|
"Error loading ",
|
|
1143
|
-
|
|
1349
|
+
o,
|
|
1144
1350
|
": ",
|
|
1145
|
-
|
|
1351
|
+
y
|
|
1146
1352
|
] }),
|
|
1147
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
1353
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: l && 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: [
|
|
1148
1354
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1149
|
-
/* @__PURE__ */
|
|
1355
|
+
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1150
1356
|
"Loading ",
|
|
1151
|
-
|
|
1357
|
+
o,
|
|
1152
1358
|
"..."
|
|
1153
1359
|
] })
|
|
1154
|
-
] }) }) :
|
|
1155
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
1156
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children:
|
|
1157
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children:
|
|
1158
|
-
] }) : /* @__PURE__ */
|
|
1159
|
-
|
|
1160
|
-
const u =
|
|
1360
|
+
] }) }) : S.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1361
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Ie, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1362
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: g ? `No ${o} found` : w.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
|
|
1363
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: g ? "Try a different search term" : w.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
|
|
1364
|
+
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1365
|
+
S.map((m) => {
|
|
1366
|
+
const u = m.name || m.email || m.id, v = m.email && m.name ? m.email : m.phone;
|
|
1161
1367
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1162
1368
|
"button",
|
|
1163
1369
|
{
|
|
1164
1370
|
type: "button",
|
|
1165
|
-
onClick: () =>
|
|
1166
|
-
onKeyDown: (
|
|
1371
|
+
onClick: () => C(m),
|
|
1372
|
+
onKeyDown: (j) => M(j, m),
|
|
1167
1373
|
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",
|
|
1168
|
-
children: /* @__PURE__ */
|
|
1169
|
-
/* @__PURE__ */
|
|
1374
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1375
|
+
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1170
1376
|
/* @__PURE__ */ e(
|
|
1171
|
-
|
|
1377
|
+
ne,
|
|
1172
1378
|
{
|
|
1173
|
-
id:
|
|
1379
|
+
id: m.id,
|
|
1174
1380
|
name: u,
|
|
1175
|
-
image:
|
|
1381
|
+
image: m.image,
|
|
1176
1382
|
size: 40
|
|
1177
1383
|
}
|
|
1178
1384
|
),
|
|
1179
|
-
/* @__PURE__ */
|
|
1385
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1180
1386
|
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
|
|
1181
|
-
|
|
1387
|
+
v && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: v })
|
|
1182
1388
|
] })
|
|
1183
1389
|
] }),
|
|
1184
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N ===
|
|
1390
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === m.id ? /* @__PURE__ */ e(me, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ie, { className: "h-5 w-5 text-stone" }) })
|
|
1185
1391
|
] })
|
|
1186
1392
|
}
|
|
1187
|
-
) },
|
|
1393
|
+
) }, m.id);
|
|
1188
1394
|
}),
|
|
1189
|
-
|
|
1395
|
+
l && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1190
1396
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1191
1397
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1192
1398
|
] }) })
|
|
1193
1399
|
] }) })
|
|
1194
1400
|
] });
|
|
1195
|
-
},
|
|
1401
|
+
}, ct = ({ className: t }) => /* @__PURE__ */ i(
|
|
1196
1402
|
"svg",
|
|
1197
1403
|
{
|
|
1198
1404
|
width: "140",
|
|
@@ -1202,7 +1408,7 @@ const ws = ({
|
|
|
1202
1408
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1203
1409
|
className: t,
|
|
1204
1410
|
children: [
|
|
1205
|
-
/* @__PURE__ */
|
|
1411
|
+
/* @__PURE__ */ i("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1206
1412
|
/* @__PURE__ */ e(
|
|
1207
1413
|
"path",
|
|
1208
1414
|
{
|
|
@@ -1231,7 +1437,7 @@ const ws = ({
|
|
|
1231
1437
|
fill: "white"
|
|
1232
1438
|
}
|
|
1233
1439
|
),
|
|
1234
|
-
/* @__PURE__ */
|
|
1440
|
+
/* @__PURE__ */ i("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1235
1441
|
/* @__PURE__ */ e(
|
|
1236
1442
|
"path",
|
|
1237
1443
|
{
|
|
@@ -1271,8 +1477,8 @@ const ws = ({
|
|
|
1271
1477
|
}
|
|
1272
1478
|
)
|
|
1273
1479
|
] }),
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
/* @__PURE__ */
|
|
1480
|
+
/* @__PURE__ */ i("defs", { children: [
|
|
1481
|
+
/* @__PURE__ */ i(
|
|
1276
1482
|
"filter",
|
|
1277
1483
|
{
|
|
1278
1484
|
id: "filter0_empty_state",
|
|
@@ -1326,17 +1532,17 @@ const ws = ({
|
|
|
1326
1532
|
] })
|
|
1327
1533
|
]
|
|
1328
1534
|
}
|
|
1329
|
-
),
|
|
1330
|
-
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */
|
|
1331
|
-
/* @__PURE__ */ e(
|
|
1332
|
-
s && !t && /* @__PURE__ */
|
|
1535
|
+
), Pe = P.memo(
|
|
1536
|
+
({ 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: [
|
|
1537
|
+
/* @__PURE__ */ e(ct, {}),
|
|
1538
|
+
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1333
1539
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1334
1540
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1335
1541
|
] })
|
|
1336
1542
|
] }) })
|
|
1337
1543
|
);
|
|
1338
|
-
|
|
1339
|
-
const
|
|
1544
|
+
Pe.displayName = "EmptyState";
|
|
1545
|
+
const ue = 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: [
|
|
1340
1546
|
/* @__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: "⚠️" }) }),
|
|
1341
1547
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1342
1548
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1350,235 +1556,235 @@ const le = U.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1350
1556
|
}
|
|
1351
1557
|
)
|
|
1352
1558
|
] }) }));
|
|
1353
|
-
|
|
1354
|
-
const
|
|
1559
|
+
ue.displayName = "ErrorState";
|
|
1560
|
+
const bt = ({
|
|
1355
1561
|
capabilities: t = {},
|
|
1356
1562
|
className: s,
|
|
1357
1563
|
renderMessageInputActions: n,
|
|
1358
1564
|
onChannelSelect: r,
|
|
1359
|
-
onParticipantSelect:
|
|
1360
|
-
initialParticipantFilter:
|
|
1361
|
-
initialParticipantData:
|
|
1362
|
-
CustomChannelEmptyState:
|
|
1363
|
-
showChannelList:
|
|
1364
|
-
filters:
|
|
1565
|
+
onParticipantSelect: o,
|
|
1566
|
+
initialParticipantFilter: c,
|
|
1567
|
+
initialParticipantData: a,
|
|
1568
|
+
CustomChannelEmptyState: h,
|
|
1569
|
+
showChannelList: g = !0,
|
|
1570
|
+
filters: x,
|
|
1365
1571
|
channelListCustomEmptyStateIndicator: w,
|
|
1366
1572
|
onDeleteConversationClick: f,
|
|
1367
|
-
onBlockParticipantClick:
|
|
1368
|
-
onReportParticipantClick:
|
|
1573
|
+
onBlockParticipantClick: l,
|
|
1574
|
+
onReportParticipantClick: D
|
|
1369
1575
|
}) => {
|
|
1370
1576
|
const {
|
|
1371
|
-
service:
|
|
1372
|
-
client:
|
|
1577
|
+
service: y,
|
|
1578
|
+
client: d,
|
|
1373
1579
|
isConnected: N,
|
|
1374
1580
|
isLoading: E,
|
|
1375
1581
|
error: I,
|
|
1376
|
-
refreshConnection:
|
|
1377
|
-
debug:
|
|
1378
|
-
} =
|
|
1379
|
-
participantSource:
|
|
1380
|
-
participantLabel:
|
|
1381
|
-
showDeleteConversation:
|
|
1382
|
-
} = t,
|
|
1383
|
-
const
|
|
1582
|
+
refreshConnection: S,
|
|
1583
|
+
debug: C
|
|
1584
|
+
} = Bs(), [M, m] = p(null), [u, v] = p(!1), [j, $] = p(!1), [Z, Y] = p(!1), [re, ee] = p(/* @__PURE__ */ new Set()), [se, ae] = p(0), [U, G] = p(!1), [J, z] = p(null), k = W(null), {
|
|
1585
|
+
participantSource: F,
|
|
1586
|
+
participantLabel: B = "participants",
|
|
1587
|
+
showDeleteConversation: H = !0
|
|
1588
|
+
} = t, Q = P.useMemo(() => {
|
|
1589
|
+
const b = d == null ? void 0 : d.userID;
|
|
1384
1590
|
return {
|
|
1385
1591
|
...{
|
|
1386
1592
|
type: "messaging",
|
|
1387
1593
|
last_message_at: { $exists: !0 },
|
|
1388
|
-
...
|
|
1389
|
-
members: { $in: [
|
|
1594
|
+
...b && {
|
|
1595
|
+
members: { $in: [b] },
|
|
1390
1596
|
hidden: !1
|
|
1391
1597
|
}
|
|
1392
1598
|
},
|
|
1393
|
-
...
|
|
1599
|
+
...x
|
|
1394
1600
|
};
|
|
1395
|
-
}, [
|
|
1396
|
-
if (!
|
|
1397
|
-
const
|
|
1398
|
-
if (
|
|
1601
|
+
}, [x, d == null ? void 0 : d.userID]), X = W(null), A = T(async () => {
|
|
1602
|
+
if (!d || !N) return;
|
|
1603
|
+
const b = d.userID;
|
|
1604
|
+
if (b)
|
|
1399
1605
|
try {
|
|
1400
|
-
|
|
1401
|
-
const
|
|
1606
|
+
C && console.log("[MessagingShell] Syncing channels for user:", b);
|
|
1607
|
+
const L = await d.queryChannels(
|
|
1402
1608
|
{
|
|
1403
1609
|
type: "messaging",
|
|
1404
|
-
members: { $in: [
|
|
1610
|
+
members: { $in: [b] }
|
|
1405
1611
|
},
|
|
1406
1612
|
{},
|
|
1407
1613
|
{ limit: 100 }
|
|
1408
|
-
),
|
|
1409
|
-
|
|
1410
|
-
const
|
|
1411
|
-
Object.values(
|
|
1412
|
-
var
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1614
|
+
), R = /* @__PURE__ */ new Set();
|
|
1615
|
+
L.forEach((O) => {
|
|
1616
|
+
const xe = O.state.members;
|
|
1617
|
+
Object.values(xe).forEach((Ue) => {
|
|
1618
|
+
var ve;
|
|
1619
|
+
const Ce = (ve = Ue.user) == null ? void 0 : ve.id;
|
|
1620
|
+
Ce && Ce !== b && R.add(Ce);
|
|
1415
1621
|
});
|
|
1416
|
-
}),
|
|
1417
|
-
channelCount:
|
|
1418
|
-
memberCount:
|
|
1622
|
+
}), ee((O) => O.size === R.size && [...O].every((xe) => R.has(xe)) ? O : R), v(L.length > 0), $(!0), X.current = b, C && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1623
|
+
channelCount: L.length,
|
|
1624
|
+
memberCount: R.size
|
|
1419
1625
|
});
|
|
1420
|
-
} catch (
|
|
1421
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1626
|
+
} catch (L) {
|
|
1627
|
+
console.error("[MessagingShell] Failed to sync channels:", L);
|
|
1422
1628
|
}
|
|
1423
|
-
}, [
|
|
1424
|
-
|
|
1425
|
-
if (!
|
|
1426
|
-
const
|
|
1427
|
-
|
|
1428
|
-
}, [
|
|
1429
|
-
if (!
|
|
1629
|
+
}, [d, N, C]);
|
|
1630
|
+
q(() => {
|
|
1631
|
+
if (!d || !N) return;
|
|
1632
|
+
const b = d.userID;
|
|
1633
|
+
b && X.current !== b && A();
|
|
1634
|
+
}, [d, N, A]), q(() => {
|
|
1635
|
+
if (!c || !d || !N) return;
|
|
1430
1636
|
(async () => {
|
|
1431
|
-
const
|
|
1432
|
-
if (
|
|
1637
|
+
const L = d.userID;
|
|
1638
|
+
if (L)
|
|
1433
1639
|
try {
|
|
1434
|
-
|
|
1640
|
+
C && console.log(
|
|
1435
1641
|
"[MessagingShell] Loading initial conversation with:",
|
|
1436
|
-
|
|
1642
|
+
c
|
|
1437
1643
|
);
|
|
1438
|
-
const
|
|
1644
|
+
const R = await d.queryChannels(
|
|
1439
1645
|
{
|
|
1440
1646
|
type: "messaging",
|
|
1441
|
-
members: { $eq: [
|
|
1647
|
+
members: { $eq: [L, c] }
|
|
1442
1648
|
},
|
|
1443
1649
|
{},
|
|
1444
1650
|
{ limit: 1 }
|
|
1445
1651
|
);
|
|
1446
|
-
if (
|
|
1447
|
-
|
|
1652
|
+
if (R.length > 0)
|
|
1653
|
+
m(R[0]), G(!0), z(null), r && r(R[0]), C && console.log(
|
|
1448
1654
|
"[MessagingShell] Initial conversation loaded:",
|
|
1449
|
-
|
|
1655
|
+
R[0].id
|
|
1450
1656
|
);
|
|
1451
|
-
else if (
|
|
1452
|
-
|
|
1657
|
+
else if (a && y) {
|
|
1658
|
+
C && console.log(
|
|
1453
1659
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1454
|
-
|
|
1660
|
+
a
|
|
1455
1661
|
);
|
|
1456
1662
|
try {
|
|
1457
|
-
const
|
|
1458
|
-
id:
|
|
1459
|
-
name:
|
|
1460
|
-
email:
|
|
1461
|
-
phone:
|
|
1663
|
+
const O = await y.startChannelWithParticipant({
|
|
1664
|
+
id: a.id,
|
|
1665
|
+
name: a.name,
|
|
1666
|
+
email: a.email,
|
|
1667
|
+
phone: a.phone
|
|
1462
1668
|
});
|
|
1463
|
-
|
|
1669
|
+
m(O), G(!0), z(null), r && r(O), C && console.log(
|
|
1464
1670
|
"[MessagingShell] Channel created and loaded:",
|
|
1465
|
-
|
|
1671
|
+
O.id
|
|
1466
1672
|
);
|
|
1467
|
-
} catch (
|
|
1673
|
+
} catch (O) {
|
|
1468
1674
|
console.error(
|
|
1469
1675
|
"[MessagingShell] Failed to create conversation:",
|
|
1470
|
-
|
|
1471
|
-
),
|
|
1676
|
+
O
|
|
1677
|
+
), z("Failed to create conversation");
|
|
1472
1678
|
}
|
|
1473
1679
|
} else
|
|
1474
|
-
|
|
1680
|
+
z(
|
|
1475
1681
|
"No conversation found with this account"
|
|
1476
|
-
),
|
|
1682
|
+
), C && console.log(
|
|
1477
1683
|
"[MessagingShell] No conversation found for:",
|
|
1478
|
-
|
|
1684
|
+
c
|
|
1479
1685
|
);
|
|
1480
|
-
} catch (
|
|
1686
|
+
} catch (R) {
|
|
1481
1687
|
console.error(
|
|
1482
1688
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1483
|
-
|
|
1484
|
-
),
|
|
1689
|
+
R
|
|
1690
|
+
), z("Failed to load conversation");
|
|
1485
1691
|
}
|
|
1486
1692
|
})();
|
|
1487
1693
|
}, [
|
|
1488
|
-
i,
|
|
1489
|
-
l,
|
|
1490
1694
|
c,
|
|
1695
|
+
a,
|
|
1696
|
+
d,
|
|
1491
1697
|
N,
|
|
1492
|
-
|
|
1493
|
-
|
|
1698
|
+
y,
|
|
1699
|
+
C,
|
|
1494
1700
|
r
|
|
1495
1701
|
]);
|
|
1496
|
-
const
|
|
1497
|
-
(
|
|
1498
|
-
|
|
1702
|
+
const ge = T(
|
|
1703
|
+
(b) => {
|
|
1704
|
+
m(b), r == null || r(b);
|
|
1499
1705
|
},
|
|
1500
1706
|
[r]
|
|
1501
|
-
),
|
|
1502
|
-
|
|
1503
|
-
}, [
|
|
1504
|
-
async (
|
|
1505
|
-
var
|
|
1506
|
-
if (
|
|
1707
|
+
), oe = T(() => {
|
|
1708
|
+
U || m(null);
|
|
1709
|
+
}, [U]), ie = T(
|
|
1710
|
+
async (b) => {
|
|
1711
|
+
var L;
|
|
1712
|
+
if (y)
|
|
1507
1713
|
try {
|
|
1508
|
-
|
|
1714
|
+
C && console.log(
|
|
1509
1715
|
"[MessagingShell] Starting conversation with:",
|
|
1510
|
-
|
|
1716
|
+
b.id
|
|
1511
1717
|
);
|
|
1512
|
-
const
|
|
1513
|
-
id:
|
|
1514
|
-
name:
|
|
1515
|
-
email:
|
|
1516
|
-
phone:
|
|
1718
|
+
const R = await y.startChannelWithParticipant({
|
|
1719
|
+
id: b.id,
|
|
1720
|
+
name: b.name,
|
|
1721
|
+
email: b.email,
|
|
1722
|
+
phone: b.phone
|
|
1517
1723
|
});
|
|
1518
1724
|
try {
|
|
1519
|
-
await
|
|
1520
|
-
} catch (
|
|
1521
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1725
|
+
await R.show();
|
|
1726
|
+
} catch (O) {
|
|
1727
|
+
console.warn("[MessagingShell] Failed to unhide channel:", O);
|
|
1522
1728
|
}
|
|
1523
|
-
|
|
1524
|
-
} catch (
|
|
1525
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1729
|
+
m(R), Y(!1), (L = k.current) == null || L.close(), o == null || o(b);
|
|
1730
|
+
} catch (R) {
|
|
1731
|
+
console.error("[MessagingShell] Failed to start conversation:", R);
|
|
1526
1732
|
}
|
|
1527
1733
|
},
|
|
1528
|
-
[
|
|
1529
|
-
),
|
|
1530
|
-
var
|
|
1531
|
-
Y(!1), (
|
|
1532
|
-
}, []),
|
|
1533
|
-
(
|
|
1534
|
-
|
|
1734
|
+
[y, o, C]
|
|
1735
|
+
), K = T(() => {
|
|
1736
|
+
var b;
|
|
1737
|
+
Y(!1), (b = k.current) == null || b.close();
|
|
1738
|
+
}, []), ce = T(
|
|
1739
|
+
(b) => {
|
|
1740
|
+
b.target === k.current && K();
|
|
1535
1741
|
},
|
|
1536
|
-
[
|
|
1537
|
-
),
|
|
1538
|
-
async (
|
|
1539
|
-
|
|
1742
|
+
[K]
|
|
1743
|
+
), le = T(
|
|
1744
|
+
async (b) => {
|
|
1745
|
+
C && console.log("[MessagingShell] Leaving conversation:", b.id), m(null), G(!1), X.current = null, await A();
|
|
1540
1746
|
},
|
|
1541
|
-
[
|
|
1542
|
-
),
|
|
1543
|
-
async (
|
|
1544
|
-
|
|
1747
|
+
[A, C]
|
|
1748
|
+
), V = T(
|
|
1749
|
+
async (b) => {
|
|
1750
|
+
C && console.log("[MessagingShell] Blocking participant:", b), m(null), G(!1), X.current = null, await A();
|
|
1545
1751
|
},
|
|
1546
|
-
[
|
|
1547
|
-
), te = !!
|
|
1548
|
-
return E ? /* @__PURE__ */ e("div", { className:
|
|
1549
|
-
|
|
1752
|
+
[A, C]
|
|
1753
|
+
), te = !!M;
|
|
1754
|
+
return E ? /* @__PURE__ */ e("div", { className: _("h-full", s), children: /* @__PURE__ */ e(he, {}) }) : I ? /* @__PURE__ */ e("div", { className: _("h-full", s), children: /* @__PURE__ */ e(ue, { message: I, onBack: S }) }) : !N || !d ? /* @__PURE__ */ e("div", { className: _("h-full", s), children: /* @__PURE__ */ e(
|
|
1755
|
+
ue,
|
|
1550
1756
|
{
|
|
1551
1757
|
message: "Not connected to messaging service",
|
|
1552
|
-
onBack:
|
|
1758
|
+
onBack: S
|
|
1553
1759
|
}
|
|
1554
|
-
) }) : J ? /* @__PURE__ */ e("div", { className:
|
|
1760
|
+
) }) : J ? /* @__PURE__ */ e("div", { className: _("h-full", s), children: /* @__PURE__ */ e(ue, { message: J }) }) : /* @__PURE__ */ i(
|
|
1555
1761
|
"div",
|
|
1556
1762
|
{
|
|
1557
|
-
className:
|
|
1763
|
+
className: _(
|
|
1558
1764
|
"messaging-shell h-full bg-background-primary overflow-hidden",
|
|
1559
1765
|
s
|
|
1560
1766
|
),
|
|
1561
1767
|
children: [
|
|
1562
|
-
/* @__PURE__ */
|
|
1768
|
+
/* @__PURE__ */ i("div", { className: "flex h-full min-h-0", children: [
|
|
1563
1769
|
/* @__PURE__ */ e(
|
|
1564
1770
|
"div",
|
|
1565
1771
|
{
|
|
1566
|
-
className:
|
|
1772
|
+
className: _(
|
|
1567
1773
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1568
1774
|
{
|
|
1569
|
-
"!hidden":
|
|
1775
|
+
"!hidden": g === !1 || U,
|
|
1570
1776
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
1571
|
-
"hidden lg:flex lg:flex-1 lg:max-w-2xl":
|
|
1777
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": g !== !1 && !U && te,
|
|
1572
1778
|
// Show on mobile when no channel selected, use same wide width on desktop
|
|
1573
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl":
|
|
1779
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": g !== !1 && !U && !te
|
|
1574
1780
|
}
|
|
1575
1781
|
),
|
|
1576
1782
|
children: /* @__PURE__ */ e(
|
|
1577
|
-
|
|
1783
|
+
Te,
|
|
1578
1784
|
{
|
|
1579
|
-
onChannelSelect:
|
|
1580
|
-
selectedChannel:
|
|
1581
|
-
filters:
|
|
1785
|
+
onChannelSelect: ge,
|
|
1786
|
+
selectedChannel: M || void 0,
|
|
1787
|
+
filters: Q,
|
|
1582
1788
|
customEmptyStateIndicator: w
|
|
1583
1789
|
}
|
|
1584
1790
|
)
|
|
@@ -1587,70 +1793,70 @@ const Fs = ({
|
|
|
1587
1793
|
/* @__PURE__ */ e(
|
|
1588
1794
|
"div",
|
|
1589
1795
|
{
|
|
1590
|
-
className:
|
|
1796
|
+
className: _(
|
|
1591
1797
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1592
1798
|
{
|
|
1593
1799
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1594
|
-
flex:
|
|
1800
|
+
flex: U || te || c,
|
|
1595
1801
|
// Normal mode: hide on mobile when no channel selected
|
|
1596
|
-
"hidden lg:flex": !
|
|
1802
|
+
"hidden lg:flex": !U && !te && !c
|
|
1597
1803
|
}
|
|
1598
1804
|
),
|
|
1599
|
-
children:
|
|
1600
|
-
|
|
1805
|
+
children: M ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1806
|
+
Oe,
|
|
1601
1807
|
{
|
|
1602
|
-
channel:
|
|
1603
|
-
onBack:
|
|
1604
|
-
showBackButton: !
|
|
1808
|
+
channel: M,
|
|
1809
|
+
onBack: oe,
|
|
1810
|
+
showBackButton: !U,
|
|
1605
1811
|
renderMessageInputActions: n,
|
|
1606
|
-
onLeaveConversation:
|
|
1607
|
-
onBlockParticipant:
|
|
1608
|
-
CustomChannelEmptyState:
|
|
1609
|
-
showDeleteConversation:
|
|
1812
|
+
onLeaveConversation: le,
|
|
1813
|
+
onBlockParticipant: V,
|
|
1814
|
+
CustomChannelEmptyState: h,
|
|
1815
|
+
showDeleteConversation: H,
|
|
1610
1816
|
onDeleteConversationClick: f,
|
|
1611
|
-
onBlockParticipantClick:
|
|
1612
|
-
onReportParticipantClick:
|
|
1817
|
+
onBlockParticipantClick: l,
|
|
1818
|
+
onReportParticipantClick: D
|
|
1613
1819
|
},
|
|
1614
|
-
|
|
1615
|
-
) }) :
|
|
1820
|
+
M.id
|
|
1821
|
+
) }) : c ? (
|
|
1616
1822
|
// Show loading while creating/loading direct conversation channel
|
|
1617
|
-
/* @__PURE__ */ e(
|
|
1823
|
+
/* @__PURE__ */ e(he, {})
|
|
1618
1824
|
) : /* @__PURE__ */ e(
|
|
1619
|
-
|
|
1825
|
+
Pe,
|
|
1620
1826
|
{
|
|
1621
1827
|
hasChannels: u,
|
|
1622
|
-
channelsLoaded:
|
|
1828
|
+
channelsLoaded: j
|
|
1623
1829
|
}
|
|
1624
1830
|
)
|
|
1625
1831
|
}
|
|
1626
1832
|
)
|
|
1627
1833
|
] }),
|
|
1628
|
-
|
|
1834
|
+
F && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1629
1835
|
/* @__PURE__ */ e(
|
|
1630
1836
|
"dialog",
|
|
1631
1837
|
{
|
|
1632
|
-
ref:
|
|
1838
|
+
ref: k,
|
|
1633
1839
|
className: "mes-dialog",
|
|
1634
|
-
onClick:
|
|
1635
|
-
onClose:
|
|
1840
|
+
onClick: ce,
|
|
1841
|
+
onClose: K,
|
|
1636
1842
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1637
|
-
|
|
1843
|
+
it,
|
|
1638
1844
|
{
|
|
1639
|
-
participantSource:
|
|
1640
|
-
onSelectParticipant:
|
|
1641
|
-
onClose:
|
|
1642
|
-
existingParticipantIds:
|
|
1643
|
-
participantLabel:
|
|
1644
|
-
searchPlaceholder: `Search ${
|
|
1845
|
+
participantSource: F,
|
|
1846
|
+
onSelectParticipant: ie,
|
|
1847
|
+
onClose: K,
|
|
1848
|
+
existingParticipantIds: re,
|
|
1849
|
+
participantLabel: B,
|
|
1850
|
+
searchPlaceholder: `Search ${B}...`
|
|
1645
1851
|
},
|
|
1646
|
-
|
|
1852
|
+
se
|
|
1647
1853
|
) })
|
|
1648
1854
|
}
|
|
1649
1855
|
)
|
|
1650
1856
|
]
|
|
1651
1857
|
}
|
|
1652
1858
|
);
|
|
1653
|
-
},
|
|
1859
|
+
}, dt = ({
|
|
1654
1860
|
question: t,
|
|
1655
1861
|
onClick: s,
|
|
1656
1862
|
loading: n = !1,
|
|
@@ -1662,7 +1868,7 @@ const Fs = ({
|
|
|
1662
1868
|
onClick: s,
|
|
1663
1869
|
disabled: n,
|
|
1664
1870
|
style: { backgroundColor: "#E6E5E3" },
|
|
1665
|
-
className:
|
|
1871
|
+
className: _(
|
|
1666
1872
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1667
1873
|
{
|
|
1668
1874
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1672,100 +1878,100 @@ const Fs = ({
|
|
|
1672
1878
|
),
|
|
1673
1879
|
children: t
|
|
1674
1880
|
}
|
|
1675
|
-
),
|
|
1881
|
+
), vt = ({
|
|
1676
1882
|
faqs: t,
|
|
1677
1883
|
onFaqClick: s,
|
|
1678
1884
|
loadingFaqId: n,
|
|
1679
1885
|
headerText: r,
|
|
1680
|
-
className:
|
|
1681
|
-
avatarImage:
|
|
1682
|
-
avatarName:
|
|
1886
|
+
className: o,
|
|
1887
|
+
avatarImage: c,
|
|
1888
|
+
avatarName: a
|
|
1683
1889
|
}) => {
|
|
1684
|
-
const
|
|
1685
|
-
return
|
|
1686
|
-
(
|
|
1687
|
-
|
|
1890
|
+
const h = t.filter((g) => g.enabled).sort((g, x) => (g.order ?? 0) - (x.order ?? 0));
|
|
1891
|
+
return h.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1892
|
+
(c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1893
|
+
ne,
|
|
1688
1894
|
{
|
|
1689
|
-
id:
|
|
1690
|
-
name:
|
|
1691
|
-
image:
|
|
1895
|
+
id: a || "account",
|
|
1896
|
+
name: a || "Account",
|
|
1897
|
+
image: c,
|
|
1692
1898
|
size: 24,
|
|
1693
1899
|
shape: "circle"
|
|
1694
1900
|
}
|
|
1695
1901
|
) }),
|
|
1696
|
-
/* @__PURE__ */
|
|
1902
|
+
/* @__PURE__ */ i(
|
|
1697
1903
|
"div",
|
|
1698
1904
|
{
|
|
1699
1905
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
1700
1906
|
style: { backgroundColor: "#F1F0EE" },
|
|
1701
1907
|
children: [
|
|
1702
1908
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1703
|
-
|
|
1704
|
-
|
|
1909
|
+
h.map((g) => /* @__PURE__ */ e(
|
|
1910
|
+
dt,
|
|
1705
1911
|
{
|
|
1706
|
-
question:
|
|
1707
|
-
onClick: () => s(
|
|
1708
|
-
loading: n ===
|
|
1912
|
+
question: g.question,
|
|
1913
|
+
onClick: () => s(g.id),
|
|
1914
|
+
loading: n === g.id
|
|
1709
1915
|
},
|
|
1710
|
-
|
|
1916
|
+
g.id
|
|
1711
1917
|
))
|
|
1712
1918
|
]
|
|
1713
1919
|
}
|
|
1714
1920
|
)
|
|
1715
1921
|
] }) });
|
|
1716
|
-
},
|
|
1717
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [
|
|
1718
|
-
if (
|
|
1719
|
-
const
|
|
1720
|
-
|
|
1922
|
+
}, wt = (t, s = {}) => {
|
|
1923
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [o, c] = p([]), [a, h] = p(!1), [g, x] = p(null), [w, f] = p(n), [l, D] = p(!0), [y, d] = p(), N = T(async (C = !1, M) => {
|
|
1924
|
+
if (a) return;
|
|
1925
|
+
const m = M !== void 0 ? M : w;
|
|
1926
|
+
h(!0), x(null);
|
|
1721
1927
|
try {
|
|
1722
1928
|
const u = await t.loadParticipants({
|
|
1723
|
-
search:
|
|
1929
|
+
search: m || void 0,
|
|
1724
1930
|
limit: r,
|
|
1725
|
-
cursor:
|
|
1931
|
+
cursor: C ? void 0 : y
|
|
1726
1932
|
});
|
|
1727
|
-
|
|
1728
|
-
(
|
|
1729
|
-
),
|
|
1933
|
+
c(
|
|
1934
|
+
(v) => C ? u.participants : [...v, ...u.participants]
|
|
1935
|
+
), D(u.hasMore), d(u.nextCursor);
|
|
1730
1936
|
} catch (u) {
|
|
1731
|
-
const
|
|
1732
|
-
|
|
1937
|
+
const v = u instanceof Error ? u.message : "Failed to load participants";
|
|
1938
|
+
x(v), console.error("[useParticipants] Load error:", u);
|
|
1733
1939
|
} finally {
|
|
1734
|
-
|
|
1940
|
+
h(!1);
|
|
1735
1941
|
}
|
|
1736
|
-
}, [t, w,
|
|
1737
|
-
|
|
1738
|
-
}, [
|
|
1739
|
-
f(
|
|
1740
|
-
}, [N]),
|
|
1741
|
-
|
|
1942
|
+
}, [t, w, y, r, a]), E = T(() => {
|
|
1943
|
+
l && !a && N(!1);
|
|
1944
|
+
}, [l, a, N]), I = T((C) => {
|
|
1945
|
+
f(C), d(void 0), N(!0, C);
|
|
1946
|
+
}, [N]), S = T(() => {
|
|
1947
|
+
d(void 0), N(!0);
|
|
1742
1948
|
}, [N]);
|
|
1743
|
-
return
|
|
1949
|
+
return q(() => {
|
|
1744
1950
|
N(!0);
|
|
1745
1951
|
}, [t.loadParticipants]), {
|
|
1746
|
-
participants:
|
|
1747
|
-
loading:
|
|
1748
|
-
error:
|
|
1952
|
+
participants: o,
|
|
1953
|
+
loading: a,
|
|
1954
|
+
error: g,
|
|
1749
1955
|
searchQuery: w,
|
|
1750
|
-
hasMore:
|
|
1956
|
+
hasMore: l,
|
|
1751
1957
|
totalCount: t.totalCount,
|
|
1752
1958
|
loadMore: E,
|
|
1753
1959
|
search: I,
|
|
1754
|
-
refresh:
|
|
1960
|
+
refresh: S
|
|
1755
1961
|
};
|
|
1756
1962
|
};
|
|
1757
1963
|
export {
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1964
|
+
ne as Avatar,
|
|
1965
|
+
tt as ChannelEmptyState,
|
|
1966
|
+
Te as ChannelList,
|
|
1967
|
+
Oe as ChannelView,
|
|
1968
|
+
vt as FaqList,
|
|
1969
|
+
dt as FaqListItem,
|
|
1970
|
+
Nt as MessagingProvider,
|
|
1971
|
+
bt as MessagingShell,
|
|
1972
|
+
it as ParticipantPicker,
|
|
1973
|
+
As as formatRelativeTime,
|
|
1974
|
+
Bs as useMessaging,
|
|
1975
|
+
wt as useParticipants
|
|
1770
1976
|
};
|
|
1771
1977
|
//# sourceMappingURL=index.js.map
|