@linktr.ee/messaging-react 1.11.2 → 1.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +578 -433
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/CustomChannelPreview.tsx +1 -1
- package/src/components/ChannelView.tsx +3 -3
- package/src/components/MessagingShell/EmptyState.tsx +105 -12
- package/src/components/MessagingShell/index.tsx +2 -2
- package/src/providers/MessagingProvider.tsx +9 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { XIcon as le, ArrowUpIcon as
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as he } from "react/jsx-runtime";
|
|
2
|
+
import p from "classnames";
|
|
3
|
+
import Z, { createContext as Se, useContext as ke, useCallback as F, useState as E, useRef as z, useEffect as G } from "react";
|
|
4
|
+
import { StreamChatService as pe } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as Re, ChannelList as De, useMessageComposer as _e, useStateStore as Me, MessageInput as Fe, useMessageInputContext as Te, useMessageComposerHasSendableData as Pe, SimpleAttachmentSelector as Le, QuotedMessagePreview as Ue, AttachmentPreviewList as Oe, TextareaComposer as je, MessageTimestamp as Ae, Channel as Be, useChannelStateContext as fe, Window as ze, MessageList as Ge } from "stream-chat-react";
|
|
6
|
+
import { XIcon as le, ArrowUpIcon as He, ArrowLeftIcon as oe, DotsThreeIcon as ie, SpinnerGapIcon as ee, SignOutIcon as $e, ProhibitInsetIcon as ce, FlagIcon as Ve, MagnifyingGlassIcon as We, ChatCircleDotsIcon as de } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as ue } from "stream-chat";
|
|
8
8
|
const ge = Se({
|
|
9
9
|
service: null,
|
|
@@ -15,32 +15,32 @@ const ge = Se({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), se = () => ke(ge),
|
|
18
|
+
}), se = () => ke(ge), Is = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
22
|
apiKey: l,
|
|
23
|
-
capabilities:
|
|
24
|
-
debug:
|
|
23
|
+
capabilities: a = {},
|
|
24
|
+
debug: i = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const r =
|
|
26
|
+
const r = F(
|
|
27
27
|
(u, ...N) => {
|
|
28
|
-
|
|
28
|
+
i && console.log(`🔥 [MessagingProvider] ${u}`, ...N);
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[i]
|
|
31
31
|
);
|
|
32
32
|
r("🔄 RENDER START", {
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
34
34
|
apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
|
|
35
35
|
serviceConfig: !!n,
|
|
36
|
-
capabilities: Object.keys(
|
|
36
|
+
capabilities: Object.keys(a)
|
|
37
37
|
});
|
|
38
|
-
const [
|
|
38
|
+
const [c, m] = E(null), [x, k] = E(null), [h, f] = E(!1), [y, g] = E(!1), [v, w] = E(null), b = z(!1), I = z({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: l,
|
|
41
41
|
serviceConfig: n,
|
|
42
|
-
capabilities:
|
|
43
|
-
}), S =
|
|
42
|
+
capabilities: a
|
|
43
|
+
}), S = z(0);
|
|
44
44
|
S.current++, r("📊 RENDER INFO", {
|
|
45
45
|
renderCount: S.current,
|
|
46
46
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
|
|
@@ -48,14 +48,14 @@ const ge = Se({
|
|
|
48
48
|
userChanged: I.current.userId !== (s == null ? void 0 : s.id),
|
|
49
49
|
apiKeyChanged: I.current.apiKey !== l,
|
|
50
50
|
serviceConfigChanged: I.current.serviceConfig !== n,
|
|
51
|
-
capabilitiesChanged: I.current.capabilities !==
|
|
51
|
+
capabilitiesChanged: I.current.capabilities !== a
|
|
52
52
|
}
|
|
53
53
|
}), I.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
55
|
apiKey: l,
|
|
56
56
|
serviceConfig: n,
|
|
57
|
-
capabilities:
|
|
58
|
-
},
|
|
57
|
+
capabilities: a
|
|
58
|
+
}, G(() => {
|
|
59
59
|
const u = S.current;
|
|
60
60
|
if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
61
61
|
renderCount: u,
|
|
@@ -79,10 +79,10 @@ const ge = Se({
|
|
|
79
79
|
apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: I.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const N = new
|
|
82
|
+
const N = new pe({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: l,
|
|
85
|
-
debug:
|
|
85
|
+
debug: i
|
|
86
86
|
});
|
|
87
87
|
return m(N), r("✅ SERVICE SET", {
|
|
88
88
|
renderCount: u,
|
|
@@ -93,26 +93,26 @@ const ge = Se({
|
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
94
|
}), N.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
|
-
}, [l, n,
|
|
97
|
-
const
|
|
98
|
-
|
|
96
|
+
}, [l, n, i, r]);
|
|
97
|
+
const R = z(null);
|
|
98
|
+
G(() => {
|
|
99
99
|
var N, j;
|
|
100
100
|
if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
-
hasService: !!
|
|
101
|
+
hasService: !!c,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
|
-
isConnecting:
|
|
104
|
+
isConnecting: b.current,
|
|
105
105
|
isConnected: h,
|
|
106
|
-
dependencies: { service: !!
|
|
107
|
-
}), !
|
|
106
|
+
dependencies: { service: !!c, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !c || !s) {
|
|
108
108
|
r("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
111
|
+
if (b.current) {
|
|
112
112
|
r("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((N =
|
|
115
|
+
if (((N = R.current) == null ? void 0 : N.serviceId) === c && ((j = R.current) == null ? void 0 : j.userId) === s.id) {
|
|
116
116
|
r(
|
|
117
117
|
"⚠️ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -120,11 +120,11 @@ const ge = Se({
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
r("🚀 STARTING USER CONNECTION", { userId: s.id }),
|
|
123
|
+
r("🚀 STARTING USER CONNECTION", { userId: s.id }), b.current = !0, g(!0), w(null);
|
|
124
124
|
try {
|
|
125
125
|
r("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
-
const A = await
|
|
127
|
-
k(A), f(!0),
|
|
126
|
+
const A = await c.connectUser(s);
|
|
127
|
+
k(A), f(!0), R.current = { serviceId: c, userId: s.id }, r("✅ USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: A.userID
|
|
130
130
|
});
|
|
@@ -135,36 +135,36 @@ const ge = Se({
|
|
|
135
135
|
error: W
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
g(!1),
|
|
138
|
+
g(!1), b.current = !1, r("🔄 USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
isConnected: h
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [
|
|
145
|
-
hasService: !!
|
|
144
|
+
}, [c, s, r, h]), G(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!c,
|
|
146
146
|
isConnected: h
|
|
147
147
|
}), () => {
|
|
148
|
-
|
|
148
|
+
c && h ? (r(
|
|
149
149
|
"🧹 CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
152
|
-
hasService: !!
|
|
151
|
+
), R.current = null, c.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!c,
|
|
153
153
|
isConnected: h
|
|
154
154
|
});
|
|
155
|
-
}), [
|
|
156
|
-
const
|
|
155
|
+
}), [c, h, r]);
|
|
156
|
+
const _ = F(async () => {
|
|
157
157
|
if (r("🔄 REFRESH CONNECTION CALLED", {
|
|
158
|
-
hasService: !!
|
|
158
|
+
hasService: !!c,
|
|
159
159
|
hasUser: !!s
|
|
160
|
-
}), !
|
|
160
|
+
}), !c || !s) {
|
|
161
161
|
r("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
164
|
r("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), g(!0);
|
|
165
165
|
try {
|
|
166
|
-
r("🔌 DISCONNECTING FOR REFRESH"), await
|
|
167
|
-
const u = await
|
|
166
|
+
r("🔌 DISCONNECTING FOR REFRESH"), await c.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
|
|
167
|
+
const u = await c.connectUser(s);
|
|
168
168
|
k(u), f(!0), w(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
169
|
} catch (u) {
|
|
170
170
|
const N = u instanceof Error ? u.message : "Refresh failed";
|
|
@@ -175,50 +175,59 @@ const ge = Se({
|
|
|
175
175
|
} finally {
|
|
176
176
|
g(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [
|
|
179
|
-
hasService: !!
|
|
178
|
+
}, [c, s, r]), d = Z.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!c,
|
|
180
180
|
hasClient: !!x,
|
|
181
181
|
isConnected: h,
|
|
182
182
|
isLoading: y,
|
|
183
|
-
hasError: !!
|
|
184
|
-
capabilitiesKeys: Object.keys(
|
|
183
|
+
hasError: !!v,
|
|
184
|
+
capabilitiesKeys: Object.keys(a)
|
|
185
185
|
}), {
|
|
186
|
-
service:
|
|
186
|
+
service: c,
|
|
187
187
|
client: x,
|
|
188
188
|
isConnected: h,
|
|
189
189
|
isLoading: y,
|
|
190
|
-
error:
|
|
191
|
-
capabilities:
|
|
192
|
-
refreshConnection:
|
|
193
|
-
debug:
|
|
190
|
+
error: v,
|
|
191
|
+
capabilities: a,
|
|
192
|
+
refreshConnection: _,
|
|
193
|
+
debug: i
|
|
194
194
|
}), [
|
|
195
|
-
|
|
195
|
+
c,
|
|
196
196
|
x,
|
|
197
197
|
h,
|
|
198
198
|
y,
|
|
199
|
-
|
|
200
|
-
o,
|
|
201
|
-
T,
|
|
199
|
+
v,
|
|
202
200
|
a,
|
|
201
|
+
_,
|
|
202
|
+
i,
|
|
203
203
|
r
|
|
204
204
|
]);
|
|
205
205
|
return r("🔄 RENDER END", {
|
|
206
206
|
renderCount: S.current,
|
|
207
207
|
willRenderChat: !!(x && h),
|
|
208
208
|
contextValueReady: !!d
|
|
209
|
-
}), /* @__PURE__ */ e(ge.Provider, { value: d, children: x && h ? /* @__PURE__ */ e(
|
|
210
|
-
|
|
209
|
+
}), /* @__PURE__ */ e(ge.Provider, { value: d, children: x && h ? /* @__PURE__ */ e(
|
|
210
|
+
Re,
|
|
211
|
+
{
|
|
212
|
+
client: x,
|
|
213
|
+
customClasses: {
|
|
214
|
+
channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
|
|
215
|
+
},
|
|
216
|
+
children: t
|
|
217
|
+
}
|
|
218
|
+
) : t });
|
|
219
|
+
}, Ze = () => se(), qe = (t, s) => {
|
|
211
220
|
const n = new Date(
|
|
212
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
213
|
-
),
|
|
222
|
+
), a = new Date(
|
|
214
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
215
224
|
).getTime() - n.getTime();
|
|
216
|
-
return Math.floor(
|
|
217
|
-
},
|
|
225
|
+
return Math.floor(a / (1e3 * 60 * 60 * 24));
|
|
226
|
+
}, Ye = (t) => {
|
|
218
227
|
const s = /* @__PURE__ */ new Date();
|
|
219
228
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
220
229
|
return "Just now";
|
|
221
|
-
const l =
|
|
230
|
+
const l = qe(t, s);
|
|
222
231
|
return l === 0 ? t.toLocaleTimeString([], {
|
|
223
232
|
hour: "numeric",
|
|
224
233
|
minute: "2-digit"
|
|
@@ -255,7 +264,7 @@ const ge = Se({
|
|
|
255
264
|
"🍈"
|
|
256
265
|
// Melon
|
|
257
266
|
];
|
|
258
|
-
function
|
|
267
|
+
function Je(t) {
|
|
259
268
|
let s = 0;
|
|
260
269
|
for (let n = 0; n < t.length; n++) {
|
|
261
270
|
const l = t.charCodeAt(n);
|
|
@@ -263,25 +272,25 @@ function Qe(t) {
|
|
|
263
272
|
}
|
|
264
273
|
return Math.abs(s);
|
|
265
274
|
}
|
|
266
|
-
function
|
|
267
|
-
const n =
|
|
275
|
+
function Qe(t) {
|
|
276
|
+
const n = Je(t) % me.length;
|
|
268
277
|
return me[n];
|
|
269
278
|
}
|
|
270
|
-
const
|
|
279
|
+
const q = ({
|
|
271
280
|
id: t,
|
|
272
281
|
image: s,
|
|
273
282
|
size: n = 40,
|
|
274
283
|
className: l,
|
|
275
|
-
shape:
|
|
284
|
+
shape: a = "squircle"
|
|
276
285
|
}) => {
|
|
277
|
-
const
|
|
286
|
+
const i = Qe(t), c = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = a === "circle" ? { borderRadius: "50%" } : {
|
|
278
287
|
borderRadius: "33%",
|
|
279
288
|
"corner-shape": "superellipse(1.3)"
|
|
280
289
|
};
|
|
281
290
|
return /* @__PURE__ */ e(
|
|
282
291
|
"div",
|
|
283
292
|
{
|
|
284
|
-
className:
|
|
293
|
+
className: p("flex-shrink-0 overflow-hidden", l),
|
|
285
294
|
style: {
|
|
286
295
|
width: `${n}px`,
|
|
287
296
|
height: `${n}px`,
|
|
@@ -298,76 +307,76 @@ const Y = ({
|
|
|
298
307
|
"div",
|
|
299
308
|
{
|
|
300
309
|
"aria-hidden": "true",
|
|
301
|
-
className:
|
|
310
|
+
className: p(
|
|
302
311
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
303
|
-
|
|
312
|
+
c
|
|
304
313
|
),
|
|
305
|
-
children:
|
|
314
|
+
children: i
|
|
306
315
|
}
|
|
307
316
|
)
|
|
308
317
|
}
|
|
309
318
|
);
|
|
310
|
-
},
|
|
311
|
-
var w,
|
|
312
|
-
const
|
|
319
|
+
}, Xe = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1, unread: a }) => {
|
|
320
|
+
var w, b, I, S, R, _;
|
|
321
|
+
const i = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), r = () => {
|
|
313
322
|
t && n(t);
|
|
314
323
|
}, m = Object.values(((w = t == null ? void 0 : t.state) == null ? void 0 : w.members) || {}).find(
|
|
315
324
|
(d) => {
|
|
316
325
|
var u, N;
|
|
317
326
|
return ((u = d.user) == null ? void 0 : u.id) && d.user.id !== ((N = t == null ? void 0 : t._client) == null ? void 0 : N.userID);
|
|
318
327
|
}
|
|
319
|
-
), x = ((
|
|
328
|
+
), x = ((b = m == null ? void 0 : m.user) == null ? void 0 : b.name) || "Conversation", k = (I = m == null ? void 0 : m.user) == null ? void 0 : I.image, h = (R = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : R[t.state.messages.length - 1], y = (() => {
|
|
320
329
|
var u;
|
|
321
330
|
if (h != null && h.text) return h.text;
|
|
322
331
|
const d = (u = h == null ? void 0 : h.attachments) == null ? void 0 : u[0];
|
|
323
332
|
return d != null && d.asset_url ? d.asset_url : d != null && d.image_url ? d.image_url : d != null && d.og_scrape_url ? d.og_scrape_url : d != null && d.thumb_url ? d.thumb_url : "No messages yet";
|
|
324
|
-
})(), g = h != null && h.created_at ?
|
|
333
|
+
})(), g = h != null && h.created_at ? Ye(new Date(h.created_at)) : "", v = a ?? 0;
|
|
325
334
|
return l && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
326
335
|
channelId: t == null ? void 0 : t.id,
|
|
327
|
-
isSelected:
|
|
336
|
+
isSelected: i,
|
|
328
337
|
participantName: x,
|
|
329
|
-
unreadCount:
|
|
338
|
+
unreadCount: v,
|
|
330
339
|
hasTimestamp: !!g
|
|
331
340
|
}), /* @__PURE__ */ e(
|
|
332
341
|
"button",
|
|
333
342
|
{
|
|
334
343
|
type: "button",
|
|
335
344
|
onClick: r,
|
|
336
|
-
className:
|
|
337
|
-
"group w-full px-4 py-3 transition-colors
|
|
345
|
+
className: p(
|
|
346
|
+
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
338
347
|
{
|
|
339
|
-
"bg-primary-alt/10 border-l-4 border-l-primary":
|
|
340
|
-
"hover:bg-sand": !
|
|
348
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": i,
|
|
349
|
+
"hover:bg-sand": !i
|
|
341
350
|
}
|
|
342
351
|
),
|
|
343
|
-
children: /* @__PURE__ */
|
|
352
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-start gap-3", children: [
|
|
344
353
|
/* @__PURE__ */ e(
|
|
345
|
-
|
|
354
|
+
q,
|
|
346
355
|
{
|
|
347
|
-
id: ((
|
|
356
|
+
id: ((_ = m == null ? void 0 : m.user) == null ? void 0 : _.id) || t.id || "unknown",
|
|
348
357
|
name: x,
|
|
349
358
|
image: k,
|
|
350
359
|
size: 44,
|
|
351
360
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
352
361
|
}
|
|
353
362
|
),
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ o("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
364
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2", children: [
|
|
356
365
|
/* @__PURE__ */ e(
|
|
357
366
|
"h3",
|
|
358
367
|
{
|
|
359
|
-
className:
|
|
368
|
+
className: p(
|
|
360
369
|
"text-sm font-medium truncate",
|
|
361
|
-
|
|
370
|
+
i ? "text-primary" : "text-charcoal"
|
|
362
371
|
),
|
|
363
372
|
children: x
|
|
364
373
|
}
|
|
365
374
|
),
|
|
366
375
|
g && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: g })
|
|
367
376
|
] }),
|
|
368
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
369
378
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: y }),
|
|
370
|
-
|
|
379
|
+
v > 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: v > 99 ? "99+" : v })
|
|
371
380
|
] })
|
|
372
381
|
] })
|
|
373
382
|
] })
|
|
@@ -378,48 +387,48 @@ const Y = ({
|
|
|
378
387
|
selectedChannel: s,
|
|
379
388
|
filters: n,
|
|
380
389
|
className: l,
|
|
381
|
-
customEmptyStateIndicator:
|
|
390
|
+
customEmptyStateIndicator: a
|
|
382
391
|
}) => {
|
|
383
|
-
const
|
|
384
|
-
|
|
392
|
+
const i = Z.useRef(0);
|
|
393
|
+
i.current++;
|
|
385
394
|
const { debug: r = !1 } = se();
|
|
386
395
|
return r && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
387
|
-
renderCount:
|
|
396
|
+
renderCount: i.current,
|
|
388
397
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
389
398
|
filters: n
|
|
390
399
|
}), /* @__PURE__ */ e(
|
|
391
400
|
"div",
|
|
392
401
|
{
|
|
393
|
-
className:
|
|
402
|
+
className: p(
|
|
394
403
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
395
404
|
l
|
|
396
405
|
),
|
|
397
406
|
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (r && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
|
|
398
|
-
renderCount:
|
|
407
|
+
renderCount: i.current,
|
|
399
408
|
filters: n
|
|
400
409
|
}), /* @__PURE__ */ e(
|
|
401
|
-
|
|
410
|
+
De,
|
|
402
411
|
{
|
|
403
412
|
filters: n,
|
|
404
413
|
sort: { last_message_at: -1 },
|
|
405
414
|
options: { limit: 30 },
|
|
406
|
-
Preview: (
|
|
415
|
+
Preview: (c) => {
|
|
407
416
|
var m, x;
|
|
408
417
|
return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
409
|
-
channelId: (m =
|
|
418
|
+
channelId: (m = c.channel) == null ? void 0 : m.id,
|
|
410
419
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
411
|
-
isSelected: (s == null ? void 0 : s.id) === ((x =
|
|
420
|
+
isSelected: (s == null ? void 0 : s.id) === ((x = c.channel) == null ? void 0 : x.id)
|
|
412
421
|
}), /* @__PURE__ */ e(
|
|
413
|
-
|
|
422
|
+
Xe,
|
|
414
423
|
{
|
|
415
|
-
...
|
|
424
|
+
...c,
|
|
416
425
|
selectedChannel: s,
|
|
417
426
|
onChannelSelect: t,
|
|
418
427
|
debug: r
|
|
419
428
|
}
|
|
420
429
|
);
|
|
421
430
|
},
|
|
422
|
-
EmptyStateIndicator:
|
|
431
|
+
EmptyStateIndicator: a
|
|
423
432
|
},
|
|
424
433
|
JSON.stringify(n)
|
|
425
434
|
)) })
|
|
@@ -434,7 +443,7 @@ const Y = ({
|
|
|
434
443
|
"button",
|
|
435
444
|
{
|
|
436
445
|
type: "button",
|
|
437
|
-
className:
|
|
446
|
+
className: p(
|
|
438
447
|
"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
|
|
439
448
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
440
449
|
s
|
|
@@ -444,11 +453,11 @@ const Y = ({
|
|
|
444
453
|
}
|
|
445
454
|
);
|
|
446
455
|
function xe({ label: t, className: s, children: n, ...l }) {
|
|
447
|
-
return /* @__PURE__ */
|
|
456
|
+
return /* @__PURE__ */ o(
|
|
448
457
|
"button",
|
|
449
458
|
{
|
|
450
459
|
type: "button",
|
|
451
|
-
className:
|
|
460
|
+
className: p(
|
|
452
461
|
"rounded-full p-2 transition-colors focus-ring",
|
|
453
462
|
{
|
|
454
463
|
"cursor-not-allowed opacity-50": l.disabled,
|
|
@@ -475,8 +484,8 @@ const es = (t) => ({
|
|
|
475
484
|
link: t,
|
|
476
485
|
onDismiss: s
|
|
477
486
|
}) => {
|
|
478
|
-
const { og_scrape_url: n, title: l, image_url:
|
|
479
|
-
return /* @__PURE__ */
|
|
487
|
+
const { og_scrape_url: n, title: l, image_url: a } = t;
|
|
488
|
+
return /* @__PURE__ */ o(
|
|
480
489
|
"a",
|
|
481
490
|
{
|
|
482
491
|
href: n,
|
|
@@ -484,10 +493,10 @@ const es = (t) => ({
|
|
|
484
493
|
rel: "noopener noreferrer",
|
|
485
494
|
className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
|
|
486
495
|
children: [
|
|
487
|
-
|
|
496
|
+
a && /* @__PURE__ */ e(
|
|
488
497
|
"img",
|
|
489
498
|
{
|
|
490
|
-
src:
|
|
499
|
+
src: a,
|
|
491
500
|
alt: l || "",
|
|
492
501
|
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
493
502
|
}
|
|
@@ -504,7 +513,7 @@ const es = (t) => ({
|
|
|
504
513
|
children: /* @__PURE__ */ e(le, { className: "size-4 text-black/90" })
|
|
505
514
|
}
|
|
506
515
|
),
|
|
507
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ o("div", { className: "p-2", children: [
|
|
508
517
|
l && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: l }),
|
|
509
518
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
510
519
|
] })
|
|
@@ -512,29 +521,29 @@ const es = (t) => ({
|
|
|
512
521
|
}
|
|
513
522
|
);
|
|
514
523
|
}, ts = () => {
|
|
515
|
-
const { linkPreviewsManager: t } =
|
|
524
|
+
const { linkPreviewsManager: t } = _e(), { linkPreviews: s } = Me(
|
|
516
525
|
t.state,
|
|
517
526
|
es
|
|
518
|
-
), n = (
|
|
519
|
-
t.dismissPreview(
|
|
527
|
+
), n = (a) => {
|
|
528
|
+
t.dismissPreview(a);
|
|
520
529
|
};
|
|
521
|
-
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((
|
|
530
|
+
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((a) => /* @__PURE__ */ e(
|
|
522
531
|
ss,
|
|
523
532
|
{
|
|
524
|
-
link:
|
|
533
|
+
link: a,
|
|
525
534
|
onDismiss: n
|
|
526
535
|
},
|
|
527
|
-
|
|
536
|
+
a.og_scrape_url
|
|
528
537
|
)) }) : null;
|
|
529
538
|
}, ns = () => {
|
|
530
|
-
const { handleSubmit: t } =
|
|
531
|
-
return /* @__PURE__ */
|
|
539
|
+
const { handleSubmit: t } = Te(), s = Pe();
|
|
540
|
+
return /* @__PURE__ */ o(he, { children: [
|
|
532
541
|
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Le, {}) }),
|
|
533
|
-
/* @__PURE__ */
|
|
542
|
+
/* @__PURE__ */ o("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
|
|
534
543
|
/* @__PURE__ */ e(Ue, {}),
|
|
535
544
|
/* @__PURE__ */ e(ts, {}),
|
|
536
545
|
/* @__PURE__ */ e(Oe, {}),
|
|
537
|
-
/* @__PURE__ */
|
|
546
|
+
/* @__PURE__ */ o("div", { className: "flex", children: [
|
|
538
547
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
539
548
|
je,
|
|
540
549
|
{
|
|
@@ -551,7 +560,7 @@ const es = (t) => ({
|
|
|
551
560
|
disabled: !s,
|
|
552
561
|
onClick: t,
|
|
553
562
|
type: "button",
|
|
554
|
-
children: /* @__PURE__ */ e(
|
|
563
|
+
children: /* @__PURE__ */ e(He, { className: "size-4" })
|
|
555
564
|
}
|
|
556
565
|
)
|
|
557
566
|
] })
|
|
@@ -559,51 +568,51 @@ const es = (t) => ({
|
|
|
559
568
|
] });
|
|
560
569
|
}, rs = ({
|
|
561
570
|
renderActions: t
|
|
562
|
-
}) => /* @__PURE__ */
|
|
571
|
+
}) => /* @__PURE__ */ o("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
563
572
|
t && (t == null ? void 0 : t()),
|
|
564
|
-
/* @__PURE__ */ e(
|
|
573
|
+
/* @__PURE__ */ e(Fe, { Input: ns })
|
|
565
574
|
] }), ls = (t) => {
|
|
566
575
|
const s = t.message.hide_date === !0;
|
|
567
|
-
return /* @__PURE__ */
|
|
568
|
-
/* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ o("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
577
|
+
/* @__PURE__ */ o("div", { className: "str-chat__message--system__text", children: [
|
|
569
578
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
570
579
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
571
580
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
572
581
|
] }),
|
|
573
582
|
!s && /* @__PURE__ */ e(Ae, { message: t.message })
|
|
574
583
|
] });
|
|
575
|
-
},
|
|
584
|
+
}, Ce = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ o("div", { className: "text-center max-w-sm", children: [
|
|
576
585
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet 👀" }),
|
|
577
586
|
/* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
|
|
578
|
-
] }) }),
|
|
587
|
+
] }) }), as = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
|
|
579
588
|
var m, x, k, h, f;
|
|
580
|
-
const { channel:
|
|
589
|
+
const { channel: a } = fe(), i = Z.useMemo(() => Object.values(a.state.members || {}).find(
|
|
581
590
|
(g) => {
|
|
582
|
-
var
|
|
583
|
-
return ((
|
|
591
|
+
var v;
|
|
592
|
+
return ((v = g.user) == null ? void 0 : v.id) && g.user.id !== a._client.userID;
|
|
584
593
|
}
|
|
585
|
-
), [
|
|
586
|
-
return /* @__PURE__ */
|
|
587
|
-
/* @__PURE__ */
|
|
594
|
+
), [a._client.userID, a.state.members]), r = ((m = i == null ? void 0 : i.user) == null ? void 0 : m.name) || ((x = i == null ? void 0 : i.user) == null ? void 0 : x.id) || "Unknown member", c = (k = i == null ? void 0 : i.user) == null ? void 0 : k.image;
|
|
595
|
+
return /* @__PURE__ */ o("div", { className: "@container", children: [
|
|
596
|
+
/* @__PURE__ */ o("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
588
597
|
/* @__PURE__ */ e(
|
|
589
598
|
"button",
|
|
590
599
|
{
|
|
591
|
-
className:
|
|
600
|
+
className: p(
|
|
592
601
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
593
602
|
!s && "invisible"
|
|
594
603
|
),
|
|
595
604
|
onClick: t || (() => {
|
|
596
605
|
}),
|
|
597
|
-
children: /* @__PURE__ */ e(
|
|
606
|
+
children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
|
|
598
607
|
}
|
|
599
608
|
),
|
|
600
|
-
/* @__PURE__ */
|
|
609
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
601
610
|
/* @__PURE__ */ e(
|
|
602
|
-
|
|
611
|
+
q,
|
|
603
612
|
{
|
|
604
|
-
id: ((h =
|
|
613
|
+
id: ((h = i == null ? void 0 : i.user) == null ? void 0 : h.id) || a.id || "unknown",
|
|
605
614
|
name: r,
|
|
606
|
-
image:
|
|
615
|
+
image: c,
|
|
607
616
|
size: 40
|
|
608
617
|
}
|
|
609
618
|
),
|
|
@@ -612,7 +621,7 @@ const es = (t) => ({
|
|
|
612
621
|
/* @__PURE__ */ e(
|
|
613
622
|
"button",
|
|
614
623
|
{
|
|
615
|
-
className:
|
|
624
|
+
className: p(
|
|
616
625
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
617
626
|
),
|
|
618
627
|
onClick: n || (() => {
|
|
@@ -621,8 +630,8 @@ const es = (t) => ({
|
|
|
621
630
|
}
|
|
622
631
|
)
|
|
623
632
|
] }),
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
633
|
+
/* @__PURE__ */ o("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
|
|
634
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
626
635
|
s && t && /* @__PURE__ */ e(
|
|
627
636
|
"button",
|
|
628
637
|
{
|
|
@@ -630,15 +639,15 @@ const es = (t) => ({
|
|
|
630
639
|
onClick: t,
|
|
631
640
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
632
641
|
"aria-label": "Back to conversations",
|
|
633
|
-
children: /* @__PURE__ */ e(
|
|
642
|
+
children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
|
|
634
643
|
}
|
|
635
644
|
),
|
|
636
645
|
/* @__PURE__ */ e(
|
|
637
|
-
|
|
646
|
+
q,
|
|
638
647
|
{
|
|
639
|
-
id: ((f =
|
|
648
|
+
id: ((f = i == null ? void 0 : i.user) == null ? void 0 : f.id) || a.id || "unknown",
|
|
640
649
|
name: r,
|
|
641
|
-
image:
|
|
650
|
+
image: c,
|
|
642
651
|
size: 40
|
|
643
652
|
}
|
|
644
653
|
),
|
|
@@ -647,7 +656,7 @@ const es = (t) => ({
|
|
|
647
656
|
l && n && /* @__PURE__ */ e(
|
|
648
657
|
"button",
|
|
649
658
|
{
|
|
650
|
-
className:
|
|
659
|
+
className: p(
|
|
651
660
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
652
661
|
),
|
|
653
662
|
onClick: n,
|
|
@@ -656,80 +665,80 @@ const es = (t) => ({
|
|
|
656
665
|
)
|
|
657
666
|
] })
|
|
658
667
|
] });
|
|
659
|
-
},
|
|
668
|
+
}, os = ({
|
|
660
669
|
isOpen: t,
|
|
661
670
|
onClose: s,
|
|
662
671
|
participant: n,
|
|
663
672
|
channel: l,
|
|
664
|
-
followerStatusLabel:
|
|
665
|
-
onLeaveConversation:
|
|
673
|
+
followerStatusLabel: a,
|
|
674
|
+
onLeaveConversation: i,
|
|
666
675
|
onBlockParticipant: r
|
|
667
676
|
}) => {
|
|
668
|
-
var W, O,
|
|
669
|
-
const { service:
|
|
670
|
-
|
|
671
|
-
const
|
|
672
|
-
|
|
677
|
+
var W, O, $, Y, H, V, J;
|
|
678
|
+
const { service: c, debug: m } = se(), x = z(null), [k, h] = E(!1), [f, y] = E(!1), [g, v] = E(!1);
|
|
679
|
+
G(() => {
|
|
680
|
+
const D = x.current;
|
|
681
|
+
D && (t ? D.showModal() : D.close());
|
|
673
682
|
}, [t]);
|
|
674
|
-
const w =
|
|
675
|
-
var
|
|
676
|
-
if (!(!
|
|
683
|
+
const w = F(async () => {
|
|
684
|
+
var D;
|
|
685
|
+
if (!(!c || !((D = n == null ? void 0 : n.user) != null && D.id)))
|
|
677
686
|
try {
|
|
678
|
-
const P = (await
|
|
687
|
+
const P = (await c.getBlockedUsers()).some(
|
|
679
688
|
(L) => {
|
|
680
|
-
var
|
|
681
|
-
return L.blocked_user_id === ((
|
|
689
|
+
var Q;
|
|
690
|
+
return L.blocked_user_id === ((Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id);
|
|
682
691
|
}
|
|
683
692
|
);
|
|
684
693
|
h(P);
|
|
685
|
-
} catch (
|
|
694
|
+
} catch (T) {
|
|
686
695
|
console.error(
|
|
687
696
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
688
|
-
|
|
697
|
+
T
|
|
689
698
|
);
|
|
690
699
|
}
|
|
691
|
-
}, [
|
|
692
|
-
|
|
700
|
+
}, [c, (W = n == null ? void 0 : n.user) == null ? void 0 : W.id]);
|
|
701
|
+
G(() => {
|
|
693
702
|
t && w();
|
|
694
703
|
}, [t, w]);
|
|
695
|
-
const
|
|
696
|
-
var
|
|
704
|
+
const b = async () => {
|
|
705
|
+
var D;
|
|
697
706
|
if (!f) {
|
|
698
707
|
m && console.log("[ChannelInfoDialog] Leave conversation", l.cid), y(!0);
|
|
699
708
|
try {
|
|
700
|
-
const
|
|
701
|
-
await l.hide(
|
|
702
|
-
} catch (
|
|
703
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
709
|
+
const T = ((D = l._client) == null ? void 0 : D.userID) ?? null;
|
|
710
|
+
await l.hide(T, !1), i && await i(l), s();
|
|
711
|
+
} catch (T) {
|
|
712
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", T);
|
|
704
713
|
} finally {
|
|
705
714
|
y(!1);
|
|
706
715
|
}
|
|
707
716
|
}
|
|
708
717
|
}, I = async () => {
|
|
709
|
-
var
|
|
710
|
-
if (!(g || !
|
|
711
|
-
m && console.log("[ChannelInfoDialog] Block member", (
|
|
718
|
+
var D, T, P;
|
|
719
|
+
if (!(g || !c)) {
|
|
720
|
+
m && console.log("[ChannelInfoDialog] Block member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), v(!0);
|
|
712
721
|
try {
|
|
713
|
-
await
|
|
722
|
+
await c.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), r && await r((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
|
|
714
723
|
} catch (L) {
|
|
715
724
|
console.error("[ChannelInfoDialog] Failed to block member", L);
|
|
716
725
|
} finally {
|
|
717
|
-
|
|
726
|
+
v(!1);
|
|
718
727
|
}
|
|
719
728
|
}
|
|
720
729
|
}, S = async () => {
|
|
721
|
-
var
|
|
722
|
-
if (!(g || !
|
|
723
|
-
m && console.log("[ChannelInfoDialog] Unblock member", (
|
|
730
|
+
var D, T, P;
|
|
731
|
+
if (!(g || !c)) {
|
|
732
|
+
m && console.log("[ChannelInfoDialog] Unblock member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), v(!0);
|
|
724
733
|
try {
|
|
725
|
-
await
|
|
734
|
+
await c.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), r && await r((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
|
|
726
735
|
} catch (L) {
|
|
727
736
|
console.error("[ChannelInfoDialog] Failed to unblock member", L);
|
|
728
737
|
} finally {
|
|
729
|
-
|
|
738
|
+
v(!1);
|
|
730
739
|
}
|
|
731
740
|
}
|
|
732
|
-
},
|
|
741
|
+
}, R = () => {
|
|
733
742
|
s(), window.open(
|
|
734
743
|
"https://linktr.ee/s/about/trust-center/report",
|
|
735
744
|
"_blank",
|
|
@@ -737,75 +746,75 @@ const es = (t) => ({
|
|
|
737
746
|
);
|
|
738
747
|
};
|
|
739
748
|
if (!n) return null;
|
|
740
|
-
const
|
|
749
|
+
const _ = ((O = n.user) == null ? void 0 : O.name) || (($ = n.user) == null ? void 0 : $.id) || "Unknown member", d = (Y = n.user) == null ? void 0 : Y.image, u = (H = n.user) == null ? void 0 : H.email, N = (V = n.user) == null ? void 0 : V.username, j = u || (N ? `linktr.ee/${N}` : void 0), A = ((J = n.user) == null ? void 0 : J.id) || "unknown";
|
|
741
750
|
return (
|
|
742
751
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
743
752
|
/* @__PURE__ */ e(
|
|
744
753
|
"dialog",
|
|
745
754
|
{
|
|
746
755
|
ref: x,
|
|
747
|
-
className: "mes-dialog",
|
|
756
|
+
className: "mes-dialog group",
|
|
748
757
|
onClose: s,
|
|
749
|
-
onClick: (
|
|
750
|
-
|
|
758
|
+
onClick: (D) => {
|
|
759
|
+
D.target === x.current && s();
|
|
751
760
|
},
|
|
752
|
-
children: /* @__PURE__ */
|
|
753
|
-
/* @__PURE__ */
|
|
761
|
+
children: /* @__PURE__ */ o("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
|
|
762
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
754
763
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
755
764
|
/* @__PURE__ */ e(Ne, { onClick: s })
|
|
756
765
|
] }),
|
|
757
|
-
/* @__PURE__ */
|
|
766
|
+
/* @__PURE__ */ o("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
758
767
|
/* @__PURE__ */ e(
|
|
759
768
|
"div",
|
|
760
769
|
{
|
|
761
770
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
762
771
|
style: { backgroundColor: "#FBFAF9" },
|
|
763
|
-
children: /* @__PURE__ */
|
|
772
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-center gap-3 w-full", children: [
|
|
764
773
|
/* @__PURE__ */ e(
|
|
765
|
-
|
|
774
|
+
q,
|
|
766
775
|
{
|
|
767
776
|
id: A,
|
|
768
|
-
name:
|
|
777
|
+
name: _,
|
|
769
778
|
image: d,
|
|
770
779
|
size: 88,
|
|
771
780
|
shape: "circle"
|
|
772
781
|
}
|
|
773
782
|
),
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
783
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
784
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: _ }),
|
|
776
785
|
j && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: j }),
|
|
777
|
-
|
|
786
|
+
a && /* @__PURE__ */ e(
|
|
778
787
|
"span",
|
|
779
788
|
{
|
|
780
789
|
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
781
790
|
style: {
|
|
782
791
|
padding: "4px 8px",
|
|
783
|
-
backgroundColor:
|
|
784
|
-
color:
|
|
792
|
+
backgroundColor: a === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
|
|
793
|
+
color: a === "Subscribed to you" ? "#008236" : "#78716C",
|
|
785
794
|
lineHeight: "133.333%",
|
|
786
795
|
letterSpacing: "0.21px"
|
|
787
796
|
},
|
|
788
|
-
children:
|
|
797
|
+
children: a
|
|
789
798
|
}
|
|
790
799
|
)
|
|
791
800
|
] })
|
|
792
801
|
] })
|
|
793
802
|
}
|
|
794
803
|
),
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
804
|
+
/* @__PURE__ */ o("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
805
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
|
|
797
806
|
K,
|
|
798
807
|
{
|
|
799
|
-
onClick:
|
|
808
|
+
onClick: b,
|
|
800
809
|
disabled: f,
|
|
801
810
|
"aria-busy": f,
|
|
802
811
|
children: [
|
|
803
|
-
f ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(
|
|
812
|
+
f ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e($e, { className: "h-5 w-5" }),
|
|
804
813
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
805
814
|
]
|
|
806
815
|
}
|
|
807
816
|
) }),
|
|
808
|
-
/* @__PURE__ */ e("li", { children: k ? /* @__PURE__ */
|
|
817
|
+
/* @__PURE__ */ e("li", { children: k ? /* @__PURE__ */ o(
|
|
809
818
|
K,
|
|
810
819
|
{
|
|
811
820
|
onClick: S,
|
|
@@ -816,7 +825,7 @@ const es = (t) => ({
|
|
|
816
825
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
817
826
|
]
|
|
818
827
|
}
|
|
819
|
-
) : /* @__PURE__ */
|
|
828
|
+
) : /* @__PURE__ */ o(
|
|
820
829
|
K,
|
|
821
830
|
{
|
|
822
831
|
onClick: I,
|
|
@@ -828,7 +837,7 @@ const es = (t) => ({
|
|
|
828
837
|
]
|
|
829
838
|
}
|
|
830
839
|
) }),
|
|
831
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
840
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(K, { variant: "danger", onClick: R, children: [
|
|
832
841
|
/* @__PURE__ */ e(Ve, { className: "h-5 w-5" }),
|
|
833
842
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
834
843
|
] }) })
|
|
@@ -843,26 +852,26 @@ const es = (t) => ({
|
|
|
843
852
|
showBackButton: s,
|
|
844
853
|
renderMessageInputActions: n,
|
|
845
854
|
onLeaveConversation: l,
|
|
846
|
-
onBlockParticipant:
|
|
847
|
-
CustomChannelEmptyState:
|
|
855
|
+
onBlockParticipant: a,
|
|
856
|
+
CustomChannelEmptyState: i = Ce
|
|
848
857
|
}) => {
|
|
849
858
|
var f, y;
|
|
850
|
-
const { channel: r } = fe(), [
|
|
851
|
-
(
|
|
859
|
+
const { channel: r } = fe(), [c, m] = E(!1), x = (((y = (f = r == null ? void 0 : r.state) == null ? void 0 : f.messages) == null ? void 0 : y.length) ?? 0) > 0, k = Z.useMemo(() => Object.values(r.state.members || {}).find(
|
|
860
|
+
(v) => {
|
|
852
861
|
var w;
|
|
853
|
-
return ((w =
|
|
862
|
+
return ((w = v.user) == null ? void 0 : w.id) && v.user.id !== r._client.userID;
|
|
854
863
|
}
|
|
855
|
-
), [r._client.userID, r.state.members]), h =
|
|
864
|
+
), [r._client.userID, r.state.members]), h = Z.useMemo(() => {
|
|
856
865
|
const g = r.data ?? {};
|
|
857
866
|
if (g.followerStatus)
|
|
858
867
|
return String(g.followerStatus);
|
|
859
868
|
if (g.isFollower !== void 0)
|
|
860
869
|
return g.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
861
870
|
}, [r.data]);
|
|
862
|
-
return /* @__PURE__ */
|
|
863
|
-
/* @__PURE__ */
|
|
871
|
+
return /* @__PURE__ */ o(he, { children: [
|
|
872
|
+
/* @__PURE__ */ o(ze, { children: [
|
|
864
873
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
865
|
-
|
|
874
|
+
as,
|
|
866
875
|
{
|
|
867
876
|
onBack: t,
|
|
868
877
|
showBackButton: s,
|
|
@@ -870,16 +879,16 @@ const es = (t) => ({
|
|
|
870
879
|
canShowInfo: !!k
|
|
871
880
|
}
|
|
872
881
|
) }),
|
|
873
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ o("div", { className: "flex-1 overflow-hidden relative", children: [
|
|
874
883
|
/* @__PURE__ */ e(
|
|
875
|
-
|
|
884
|
+
Ge,
|
|
876
885
|
{
|
|
877
886
|
hideDeletedMessages: !0,
|
|
878
887
|
hideNewMessageSeparator: !1,
|
|
879
888
|
messageActions: []
|
|
880
889
|
}
|
|
881
890
|
),
|
|
882
|
-
!x &&
|
|
891
|
+
!x && i && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(i, {}) })
|
|
883
892
|
] }),
|
|
884
893
|
/* @__PURE__ */ e(
|
|
885
894
|
rs,
|
|
@@ -889,15 +898,15 @@ const es = (t) => ({
|
|
|
889
898
|
)
|
|
890
899
|
] }),
|
|
891
900
|
/* @__PURE__ */ e(
|
|
892
|
-
|
|
901
|
+
os,
|
|
893
902
|
{
|
|
894
|
-
isOpen:
|
|
903
|
+
isOpen: c,
|
|
895
904
|
onClose: () => m(!1),
|
|
896
905
|
participant: k,
|
|
897
906
|
channel: r,
|
|
898
907
|
followerStatusLabel: h,
|
|
899
908
|
onLeaveConversation: l,
|
|
900
|
-
onBlockParticipant:
|
|
909
|
+
onBlockParticipant: a
|
|
901
910
|
}
|
|
902
911
|
)
|
|
903
912
|
] });
|
|
@@ -906,26 +915,26 @@ const es = (t) => ({
|
|
|
906
915
|
onBack: s,
|
|
907
916
|
showBackButton: n = !1,
|
|
908
917
|
renderMessageInputActions: l,
|
|
909
|
-
onLeaveConversation:
|
|
910
|
-
onBlockParticipant:
|
|
918
|
+
onLeaveConversation: a,
|
|
919
|
+
onBlockParticipant: i,
|
|
911
920
|
className: r,
|
|
912
|
-
CustomChannelEmptyState:
|
|
921
|
+
CustomChannelEmptyState: c = Ce
|
|
913
922
|
}) => /* @__PURE__ */ e(
|
|
914
923
|
"div",
|
|
915
924
|
{
|
|
916
|
-
className:
|
|
917
|
-
"messaging-channel-view h-full flex flex-col
|
|
925
|
+
className: p(
|
|
926
|
+
"messaging-channel-view h-full flex flex-col",
|
|
918
927
|
r
|
|
919
928
|
),
|
|
920
|
-
children: /* @__PURE__ */ e(
|
|
929
|
+
children: /* @__PURE__ */ e(Be, { channel: t, MessageSystem: ls, children: /* @__PURE__ */ e(
|
|
921
930
|
is,
|
|
922
931
|
{
|
|
923
932
|
onBack: s,
|
|
924
933
|
showBackButton: n,
|
|
925
934
|
renderMessageInputActions: l,
|
|
926
|
-
onLeaveConversation:
|
|
927
|
-
onBlockParticipant:
|
|
928
|
-
CustomChannelEmptyState:
|
|
935
|
+
onLeaveConversation: a,
|
|
936
|
+
onBlockParticipant: i,
|
|
937
|
+
CustomChannelEmptyState: c
|
|
929
938
|
}
|
|
930
939
|
) })
|
|
931
940
|
}
|
|
@@ -935,8 +944,8 @@ function ds({
|
|
|
935
944
|
setSearchQuery: s,
|
|
936
945
|
placeholder: n
|
|
937
946
|
}) {
|
|
938
|
-
const l =
|
|
939
|
-
return /* @__PURE__ */
|
|
947
|
+
const l = z(null);
|
|
948
|
+
return /* @__PURE__ */ o("div", { className: "relative", children: [
|
|
940
949
|
/* @__PURE__ */ e(
|
|
941
950
|
We,
|
|
942
951
|
{
|
|
@@ -951,7 +960,7 @@ function ds({
|
|
|
951
960
|
type: "text",
|
|
952
961
|
placeholder: n,
|
|
953
962
|
value: t,
|
|
954
|
-
onChange: (
|
|
963
|
+
onChange: (a) => s(a.target.value),
|
|
955
964
|
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"
|
|
956
965
|
}
|
|
957
966
|
),
|
|
@@ -960,8 +969,8 @@ function ds({
|
|
|
960
969
|
{
|
|
961
970
|
label: "Clear search",
|
|
962
971
|
onClick: () => {
|
|
963
|
-
var
|
|
964
|
-
s(""), (
|
|
972
|
+
var a;
|
|
973
|
+
s(""), (a = l.current) == null || a.focus();
|
|
965
974
|
},
|
|
966
975
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
967
976
|
children: /* @__PURE__ */ e(le, { className: "h-4 w-4", weight: "bold" })
|
|
@@ -974,115 +983,115 @@ const us = ({
|
|
|
974
983
|
onSelectParticipant: s,
|
|
975
984
|
onClose: n,
|
|
976
985
|
existingParticipantIds: l = /* @__PURE__ */ new Set(),
|
|
977
|
-
participantLabel:
|
|
978
|
-
searchPlaceholder:
|
|
986
|
+
participantLabel: a = "participants",
|
|
987
|
+
searchPlaceholder: i = "Search participants...",
|
|
979
988
|
className: r
|
|
980
989
|
}) => {
|
|
981
|
-
const { debug:
|
|
990
|
+
const { debug: c } = se(), [m, x] = E(""), [k, h] = E([]), [f, y] = E(!1), [g, v] = E(null), [w, b] = E(
|
|
982
991
|
null
|
|
983
|
-
), I =
|
|
984
|
-
|
|
992
|
+
), I = z(!1);
|
|
993
|
+
G(() => {
|
|
985
994
|
if (t.loading) {
|
|
986
|
-
|
|
995
|
+
c && console.log(
|
|
987
996
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
988
997
|
);
|
|
989
998
|
return;
|
|
990
999
|
}
|
|
991
1000
|
if (I.current) return;
|
|
992
1001
|
(async () => {
|
|
993
|
-
|
|
1002
|
+
c && console.log("[ParticipantPicker] Loading initial participants..."), y(!0), v(null);
|
|
994
1003
|
try {
|
|
995
1004
|
const u = await t.loadParticipants({
|
|
996
1005
|
search: "",
|
|
997
1006
|
// Load all participants initially
|
|
998
1007
|
limit: 100
|
|
999
1008
|
});
|
|
1000
|
-
h(u.participants), I.current = !0,
|
|
1009
|
+
h(u.participants), I.current = !0, c && console.log(
|
|
1001
1010
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1002
1011
|
u.participants.length
|
|
1003
1012
|
);
|
|
1004
1013
|
} catch (u) {
|
|
1005
1014
|
const N = u instanceof Error ? u.message : "Failed to load participants";
|
|
1006
|
-
|
|
1015
|
+
v(N), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
1007
1016
|
} finally {
|
|
1008
1017
|
y(!1);
|
|
1009
1018
|
}
|
|
1010
1019
|
})();
|
|
1011
|
-
}, [t.loading,
|
|
1020
|
+
}, [t.loading, c]);
|
|
1012
1021
|
const S = k.filter((d) => !l.has(d.id)).filter((d) => {
|
|
1013
1022
|
var N;
|
|
1014
1023
|
if (!m) return !0;
|
|
1015
1024
|
const u = m.toLowerCase();
|
|
1016
1025
|
return d.name.toLowerCase().includes(u) || ((N = d.email) == null ? void 0 : N.toLowerCase().includes(u)) || !1;
|
|
1017
|
-
}),
|
|
1026
|
+
}), R = F(
|
|
1018
1027
|
async (d) => {
|
|
1019
1028
|
if (!w) {
|
|
1020
|
-
|
|
1029
|
+
b(d.id);
|
|
1021
1030
|
try {
|
|
1022
1031
|
await s(d);
|
|
1023
1032
|
} catch (u) {
|
|
1024
|
-
console.error("[ParticipantPicker] Failed to start chat:", u),
|
|
1033
|
+
console.error("[ParticipantPicker] Failed to start chat:", u), b(null);
|
|
1025
1034
|
}
|
|
1026
1035
|
}
|
|
1027
1036
|
},
|
|
1028
1037
|
[s, w]
|
|
1029
|
-
),
|
|
1030
|
-
(d.key === "Enter" || d.key === " ") && (d.preventDefault(),
|
|
1038
|
+
), _ = (d, u) => {
|
|
1039
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), R(u));
|
|
1031
1040
|
};
|
|
1032
|
-
return /* @__PURE__ */
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
1041
|
+
return /* @__PURE__ */ o("div", { className: p("flex flex-col h-full", r), children: [
|
|
1042
|
+
/* @__PURE__ */ o("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1043
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1035
1044
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1036
1045
|
/* @__PURE__ */ e(Ne, { onClick: n })
|
|
1037
1046
|
] }),
|
|
1038
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ o("p", { className: "text-xs text-stone mb-3", children: [
|
|
1039
1048
|
"Select a ",
|
|
1040
|
-
|
|
1049
|
+
a.slice(0, -1),
|
|
1041
1050
|
" to start messaging (",
|
|
1042
1051
|
S.length,
|
|
1043
1052
|
" available)",
|
|
1044
|
-
t.totalCount !== void 0 && ` • ${t.totalCount} ${
|
|
1053
|
+
t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
|
|
1045
1054
|
] }),
|
|
1046
1055
|
/* @__PURE__ */ e(
|
|
1047
1056
|
ds,
|
|
1048
1057
|
{
|
|
1049
1058
|
searchQuery: m,
|
|
1050
1059
|
setSearchQuery: x,
|
|
1051
|
-
placeholder:
|
|
1060
|
+
placeholder: i
|
|
1052
1061
|
}
|
|
1053
1062
|
)
|
|
1054
1063
|
] }),
|
|
1055
|
-
g && /* @__PURE__ */
|
|
1064
|
+
g && /* @__PURE__ */ o("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1056
1065
|
"Error loading ",
|
|
1057
|
-
|
|
1066
|
+
a,
|
|
1058
1067
|
": ",
|
|
1059
1068
|
g
|
|
1060
1069
|
] }),
|
|
1061
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */
|
|
1070
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
|
|
1062
1071
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1063
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ o("span", { className: "text-sm text-stone", children: [
|
|
1064
1073
|
"Loading ",
|
|
1065
|
-
|
|
1074
|
+
a,
|
|
1066
1075
|
"..."
|
|
1067
1076
|
] })
|
|
1068
|
-
] }) }) : S.length === 0 ? /* @__PURE__ */
|
|
1077
|
+
] }) }) : S.length === 0 ? /* @__PURE__ */ o("div", { className: "p-6 text-center", children: [
|
|
1069
1078
|
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(de, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1070
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${
|
|
1071
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : k.length > 0 ? `You have existing conversations with all your ${
|
|
1072
|
-
] }) : /* @__PURE__ */
|
|
1079
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${a} found` : k.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
|
|
1080
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : k.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
|
|
1081
|
+
] }) : /* @__PURE__ */ o("ul", { className: "space-y-0", children: [
|
|
1073
1082
|
S.map((d) => {
|
|
1074
1083
|
const u = d.name || d.email || d.id, N = d.email && d.name ? d.email : d.phone;
|
|
1075
1084
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1076
1085
|
"button",
|
|
1077
1086
|
{
|
|
1078
1087
|
type: "button",
|
|
1079
|
-
onClick: () =>
|
|
1080
|
-
onKeyDown: (j) =>
|
|
1088
|
+
onClick: () => R(d),
|
|
1089
|
+
onKeyDown: (j) => _(j, d),
|
|
1081
1090
|
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",
|
|
1082
|
-
children: /* @__PURE__ */
|
|
1083
|
-
/* @__PURE__ */
|
|
1091
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
1092
|
+
/* @__PURE__ */ o("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1084
1093
|
/* @__PURE__ */ e(
|
|
1085
|
-
|
|
1094
|
+
q,
|
|
1086
1095
|
{
|
|
1087
1096
|
id: d.id,
|
|
1088
1097
|
name: u,
|
|
@@ -1090,7 +1099,7 @@ const us = ({
|
|
|
1090
1099
|
size: 40
|
|
1091
1100
|
}
|
|
1092
1101
|
),
|
|
1093
|
-
/* @__PURE__ */
|
|
1102
|
+
/* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
|
|
1094
1103
|
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
|
|
1095
1104
|
N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
|
|
1096
1105
|
] })
|
|
@@ -1100,17 +1109,153 @@ const us = ({
|
|
|
1100
1109
|
}
|
|
1101
1110
|
) }, d.id);
|
|
1102
1111
|
}),
|
|
1103
|
-
f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */
|
|
1112
|
+
f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
|
|
1104
1113
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1105
1114
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1106
1115
|
] }) })
|
|
1107
1116
|
] }) })
|
|
1108
1117
|
] });
|
|
1109
|
-
}, ms = ({
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1118
|
+
}, ms = ({ className: t }) => /* @__PURE__ */ o(
|
|
1119
|
+
"svg",
|
|
1120
|
+
{
|
|
1121
|
+
width: "140",
|
|
1122
|
+
height: "120",
|
|
1123
|
+
viewBox: "44 -2 144 126",
|
|
1124
|
+
fill: "none",
|
|
1125
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1126
|
+
className: t,
|
|
1127
|
+
children: [
|
|
1128
|
+
/* @__PURE__ */ o("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1129
|
+
/* @__PURE__ */ e(
|
|
1130
|
+
"path",
|
|
1131
|
+
{
|
|
1132
|
+
d: "M123.68 82.1932C123.383 103.675 105.839 121 84.2417 121C77.4724 121 71.0986 119.297 65.5327 116.299L52.5873 119.687L53.8036 106.673C48.1776 99.8701 44.7994 91.1453 44.7994 81.6356C44.7994 59.8965 62.4554 42.2754 84.2374 42.2754C89.1328 42.2754 93.8175 43.1633 98.1413 44.789",
|
|
1133
|
+
fill: "#D7D4CE"
|
|
1134
|
+
}
|
|
1135
|
+
),
|
|
1136
|
+
/* @__PURE__ */ e(
|
|
1137
|
+
"path",
|
|
1138
|
+
{
|
|
1139
|
+
d: "M84.2458 86.0364C82.2851 86.0364 80.6957 84.4501 80.6957 82.4933C80.6957 80.5365 82.2851 78.9502 84.2458 78.9502C86.2065 78.9502 87.7959 80.5365 87.7959 82.4933C87.7959 84.4501 86.2065 86.0364 84.2458 86.0364Z",
|
|
1140
|
+
fill: "white"
|
|
1141
|
+
}
|
|
1142
|
+
),
|
|
1143
|
+
/* @__PURE__ */ e(
|
|
1144
|
+
"path",
|
|
1145
|
+
{
|
|
1146
|
+
d: "M68.3044 86.0364C66.3437 86.0364 64.7543 84.4501 64.7543 82.4933C64.7543 80.5365 66.3437 78.9502 68.3044 78.9502C70.2651 78.9502 71.8545 80.5365 71.8545 82.4933C71.8545 84.4501 70.2651 86.0364 68.3044 86.0364Z",
|
|
1147
|
+
fill: "white"
|
|
1148
|
+
}
|
|
1149
|
+
),
|
|
1150
|
+
/* @__PURE__ */ e(
|
|
1151
|
+
"path",
|
|
1152
|
+
{
|
|
1153
|
+
d: "M100.183 86.0364C98.2226 86.0364 96.6332 84.4501 96.6332 82.4933C96.6332 80.5365 98.2226 78.9502 100.183 78.9502C102.144 78.9502 103.733 80.5365 103.733 82.4933C103.733 84.4501 102.144 86.0364 100.183 86.0364Z",
|
|
1154
|
+
fill: "white"
|
|
1155
|
+
}
|
|
1156
|
+
),
|
|
1157
|
+
/* @__PURE__ */ o("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1158
|
+
/* @__PURE__ */ e(
|
|
1159
|
+
"path",
|
|
1160
|
+
{
|
|
1161
|
+
d: "M171.522 68.7154C177.443 61.4539 181 52.1488 181 42C181 18.8027 162.421 0 139.5 0C116.579 0 98 18.8027 98 42C98 65.1973 116.579 84 139.5 84C146.622 84 153.328 82.1857 159.184 78.9829L172.801 82.5993L171.522 68.7154Z",
|
|
1162
|
+
fill: "white"
|
|
1163
|
+
}
|
|
1164
|
+
),
|
|
1165
|
+
/* @__PURE__ */ e(
|
|
1166
|
+
"path",
|
|
1167
|
+
{
|
|
1168
|
+
d: "M171.522 68.7154C177.443 61.4539 181 52.1488 181 42C181 18.8027 162.421 0 139.5 0C116.579 0 98 18.8027 98 42C98 65.1973 116.579 84 139.5 84C146.622 84 153.328 82.1857 159.184 78.9829L172.801 82.5993L171.522 68.7154Z",
|
|
1169
|
+
stroke: "#D7D4CE",
|
|
1170
|
+
strokeWidth: "2",
|
|
1171
|
+
strokeMiterlimit: "10"
|
|
1172
|
+
}
|
|
1173
|
+
)
|
|
1174
|
+
] }),
|
|
1175
|
+
/* @__PURE__ */ e(
|
|
1176
|
+
"path",
|
|
1177
|
+
{
|
|
1178
|
+
d: "M139.502 45.5431C137.541 45.5431 135.952 43.9568 135.952 42C135.952 40.0432 137.541 38.4569 139.502 38.4569C141.462 38.4569 143.052 40.0432 143.052 42C143.052 43.9568 141.462 45.5431 139.502 45.5431Z",
|
|
1179
|
+
fill: "#D7D4CE"
|
|
1180
|
+
}
|
|
1181
|
+
),
|
|
1182
|
+
/* @__PURE__ */ e(
|
|
1183
|
+
"path",
|
|
1184
|
+
{
|
|
1185
|
+
d: "M123.561 45.5431C121.601 45.5431 120.011 43.9568 120.011 42C120.011 40.0432 121.601 38.4569 123.561 38.4569C125.522 38.4569 127.111 40.0432 127.111 42C127.111 43.9568 125.522 45.5431 123.561 45.5431Z",
|
|
1186
|
+
fill: "#D7D4CE"
|
|
1187
|
+
}
|
|
1188
|
+
),
|
|
1189
|
+
/* @__PURE__ */ e(
|
|
1190
|
+
"path",
|
|
1191
|
+
{
|
|
1192
|
+
d: "M155.439 45.5431C153.478 45.5431 151.889 43.9568 151.889 42C151.889 40.0432 153.478 38.4569 155.439 38.4569C157.4 38.4569 158.989 40.0432 158.989 42C158.989 43.9568 157.4 45.5431 155.439 45.5431Z",
|
|
1193
|
+
fill: "#D7D4CE"
|
|
1194
|
+
}
|
|
1195
|
+
)
|
|
1196
|
+
] }),
|
|
1197
|
+
/* @__PURE__ */ o("defs", { children: [
|
|
1198
|
+
/* @__PURE__ */ o(
|
|
1199
|
+
"filter",
|
|
1200
|
+
{
|
|
1201
|
+
id: "filter0_empty_state",
|
|
1202
|
+
x: "97",
|
|
1203
|
+
y: "-1",
|
|
1204
|
+
width: "89",
|
|
1205
|
+
height: "90",
|
|
1206
|
+
filterUnits: "userSpaceOnUse",
|
|
1207
|
+
colorInterpolationFilters: "sRGB",
|
|
1208
|
+
children: [
|
|
1209
|
+
/* @__PURE__ */ e("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
1210
|
+
/* @__PURE__ */ e(
|
|
1211
|
+
"feColorMatrix",
|
|
1212
|
+
{
|
|
1213
|
+
in: "SourceAlpha",
|
|
1214
|
+
type: "matrix",
|
|
1215
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
1216
|
+
result: "hardAlpha"
|
|
1217
|
+
}
|
|
1218
|
+
),
|
|
1219
|
+
/* @__PURE__ */ e("feOffset", { dx: "4", dy: "4" }),
|
|
1220
|
+
/* @__PURE__ */ e("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
1221
|
+
/* @__PURE__ */ e(
|
|
1222
|
+
"feColorMatrix",
|
|
1223
|
+
{
|
|
1224
|
+
type: "matrix",
|
|
1225
|
+
values: "0 0 0 0 0.8428 0 0 0 0 0.830064 0 0 0 0 0.8095 0 0 0 1 0"
|
|
1226
|
+
}
|
|
1227
|
+
),
|
|
1228
|
+
/* @__PURE__ */ e(
|
|
1229
|
+
"feBlend",
|
|
1230
|
+
{
|
|
1231
|
+
mode: "normal",
|
|
1232
|
+
in2: "BackgroundImageFix",
|
|
1233
|
+
result: "effect1_dropShadow"
|
|
1234
|
+
}
|
|
1235
|
+
),
|
|
1236
|
+
/* @__PURE__ */ e(
|
|
1237
|
+
"feBlend",
|
|
1238
|
+
{
|
|
1239
|
+
mode: "normal",
|
|
1240
|
+
in: "SourceGraphic",
|
|
1241
|
+
in2: "effect1_dropShadow",
|
|
1242
|
+
result: "shape"
|
|
1243
|
+
}
|
|
1244
|
+
)
|
|
1245
|
+
]
|
|
1246
|
+
}
|
|
1247
|
+
),
|
|
1248
|
+
/* @__PURE__ */ e("clipPath", { id: "clip0_empty_state", children: /* @__PURE__ */ e("rect", { width: "233", height: "233", fill: "white" }) })
|
|
1249
|
+
] })
|
|
1250
|
+
]
|
|
1251
|
+
}
|
|
1252
|
+
), hs = ({ hasChannels: t }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
1253
|
+
/* @__PURE__ */ e(ms, {}),
|
|
1254
|
+
!t && /* @__PURE__ */ o("div", { className: "mt-8", children: [
|
|
1255
|
+
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1256
|
+
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1257
|
+
] })
|
|
1258
|
+
] }) }), re = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ o("div", { className: "text-center max-w-sm", children: [
|
|
1114
1259
|
/* @__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: "⚠️" }) }),
|
|
1115
1260
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1116
1261
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1123,12 +1268,12 @@ const us = ({
|
|
|
1123
1268
|
children: "Go Back"
|
|
1124
1269
|
}
|
|
1125
1270
|
)
|
|
1126
|
-
] }) }),
|
|
1271
|
+
] }) }), fs = ({ className: t, message: s }) => /* @__PURE__ */ o(
|
|
1127
1272
|
"div",
|
|
1128
1273
|
{
|
|
1129
|
-
className:
|
|
1274
|
+
className: p("flex items-center justify-center h-full", t),
|
|
1130
1275
|
children: [
|
|
1131
|
-
/* @__PURE__ */
|
|
1276
|
+
/* @__PURE__ */ o("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1132
1277
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1133
1278
|
"animateTransform",
|
|
1134
1279
|
{
|
|
@@ -1166,18 +1311,18 @@ const us = ({
|
|
|
1166
1311
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1167
1312
|
]
|
|
1168
1313
|
}
|
|
1169
|
-
),
|
|
1170
|
-
/* @__PURE__ */ e(
|
|
1314
|
+
), gs = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ o("div", { className: "flex items-center", children: [
|
|
1315
|
+
/* @__PURE__ */ e(fs, { className: "w-6 h-6" }),
|
|
1171
1316
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1172
|
-
] }) }),
|
|
1317
|
+
] }) }), Ss = ({
|
|
1173
1318
|
capabilities: t = {},
|
|
1174
1319
|
className: s,
|
|
1175
1320
|
renderMessageInputActions: n,
|
|
1176
1321
|
onChannelSelect: l,
|
|
1177
|
-
onParticipantSelect:
|
|
1178
|
-
initialParticipantFilter:
|
|
1322
|
+
onParticipantSelect: a,
|
|
1323
|
+
initialParticipantFilter: i,
|
|
1179
1324
|
initialParticipantData: r,
|
|
1180
|
-
CustomChannelEmptyState:
|
|
1325
|
+
CustomChannelEmptyState: c,
|
|
1181
1326
|
showChannelList: m = !0,
|
|
1182
1327
|
filters: x,
|
|
1183
1328
|
channelListCustomEmptyStateIndicator: k
|
|
@@ -1187,205 +1332,205 @@ const us = ({
|
|
|
1187
1332
|
client: f,
|
|
1188
1333
|
isConnected: y,
|
|
1189
1334
|
isLoading: g,
|
|
1190
|
-
error:
|
|
1335
|
+
error: v,
|
|
1191
1336
|
refreshConnection: w,
|
|
1192
|
-
debug:
|
|
1193
|
-
} =
|
|
1194
|
-
const
|
|
1337
|
+
debug: b
|
|
1338
|
+
} = Ze(), [I, S] = E(null), [R, _] = E(!1), [d, u] = E(!1), [N, j] = E(/* @__PURE__ */ new Set()), [A, W] = E(0), [O, $] = E(!1), [Y, H] = E(null), V = z(null), { participantSource: J, participantLabel: D = "participants" } = t, T = Z.useMemo(() => {
|
|
1339
|
+
const C = f == null ? void 0 : f.userID;
|
|
1195
1340
|
return {
|
|
1196
1341
|
...{
|
|
1197
1342
|
type: "messaging",
|
|
1198
1343
|
last_message_at: { $exists: !0 },
|
|
1199
|
-
...
|
|
1200
|
-
members: { $in: [
|
|
1344
|
+
...C && {
|
|
1345
|
+
members: { $in: [C] },
|
|
1201
1346
|
hidden: !1
|
|
1202
1347
|
}
|
|
1203
1348
|
},
|
|
1204
1349
|
...x
|
|
1205
1350
|
};
|
|
1206
|
-
}, [x, f == null ? void 0 : f.userID]), P =
|
|
1351
|
+
}, [x, f == null ? void 0 : f.userID]), P = z(null), L = F(async () => {
|
|
1207
1352
|
if (!f || !y) return;
|
|
1208
|
-
const
|
|
1209
|
-
if (
|
|
1353
|
+
const C = f.userID;
|
|
1354
|
+
if (C)
|
|
1210
1355
|
try {
|
|
1211
|
-
|
|
1356
|
+
b && console.log("[MessagingShell] Syncing channels for user:", C);
|
|
1212
1357
|
const U = await f.queryChannels(
|
|
1213
1358
|
{
|
|
1214
1359
|
type: "messaging",
|
|
1215
|
-
members: { $in: [
|
|
1360
|
+
members: { $in: [C] }
|
|
1216
1361
|
},
|
|
1217
1362
|
{},
|
|
1218
1363
|
{ limit: 100 }
|
|
1219
|
-
),
|
|
1220
|
-
U.forEach((
|
|
1221
|
-
const ye =
|
|
1364
|
+
), M = /* @__PURE__ */ new Set();
|
|
1365
|
+
U.forEach((B) => {
|
|
1366
|
+
const ye = B.state.members;
|
|
1222
1367
|
Object.values(ye).forEach((Ie) => {
|
|
1223
|
-
var
|
|
1224
|
-
const ne = (
|
|
1225
|
-
ne && ne !==
|
|
1368
|
+
var ae;
|
|
1369
|
+
const ne = (ae = Ie.user) == null ? void 0 : ae.id;
|
|
1370
|
+
ne && ne !== C && M.add(ne);
|
|
1226
1371
|
});
|
|
1227
|
-
}), j(
|
|
1372
|
+
}), j(M), _(U.length > 0), P.current = C, b && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1228
1373
|
channelCount: U.length,
|
|
1229
|
-
memberCount:
|
|
1374
|
+
memberCount: M.size
|
|
1230
1375
|
});
|
|
1231
1376
|
} catch (U) {
|
|
1232
1377
|
console.error("[MessagingShell] Failed to sync channels:", U);
|
|
1233
1378
|
}
|
|
1234
|
-
}, [f, y,
|
|
1235
|
-
|
|
1379
|
+
}, [f, y, b]);
|
|
1380
|
+
G(() => {
|
|
1236
1381
|
if (!f || !y) return;
|
|
1237
|
-
const
|
|
1238
|
-
|
|
1239
|
-
}, [f, y, L]),
|
|
1240
|
-
if (!
|
|
1382
|
+
const C = f.userID;
|
|
1383
|
+
C && P.current !== C && L();
|
|
1384
|
+
}, [f, y, L]), G(() => {
|
|
1385
|
+
if (!i || !f || !y) return;
|
|
1241
1386
|
(async () => {
|
|
1242
1387
|
const U = f.userID;
|
|
1243
1388
|
if (U)
|
|
1244
1389
|
try {
|
|
1245
|
-
|
|
1390
|
+
b && console.log(
|
|
1246
1391
|
"[MessagingShell] Loading initial conversation with:",
|
|
1247
|
-
|
|
1392
|
+
i
|
|
1248
1393
|
);
|
|
1249
|
-
const
|
|
1394
|
+
const M = await f.queryChannels(
|
|
1250
1395
|
{
|
|
1251
1396
|
type: "messaging",
|
|
1252
|
-
members: { $eq: [U,
|
|
1397
|
+
members: { $eq: [U, i] }
|
|
1253
1398
|
},
|
|
1254
1399
|
{},
|
|
1255
1400
|
{ limit: 1 }
|
|
1256
1401
|
);
|
|
1257
|
-
if (
|
|
1258
|
-
S(
|
|
1402
|
+
if (M.length > 0)
|
|
1403
|
+
S(M[0]), $(!0), H(null), l && l(M[0]), b && console.log(
|
|
1259
1404
|
"[MessagingShell] Initial conversation loaded:",
|
|
1260
|
-
|
|
1405
|
+
M[0].id
|
|
1261
1406
|
);
|
|
1262
1407
|
else if (r && h) {
|
|
1263
|
-
|
|
1408
|
+
b && console.log(
|
|
1264
1409
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1265
1410
|
r
|
|
1266
1411
|
);
|
|
1267
1412
|
try {
|
|
1268
|
-
const
|
|
1413
|
+
const B = await h.startChannelWithParticipant({
|
|
1269
1414
|
id: r.id,
|
|
1270
1415
|
name: r.name,
|
|
1271
1416
|
email: r.email,
|
|
1272
1417
|
phone: r.phone
|
|
1273
1418
|
});
|
|
1274
|
-
S(
|
|
1419
|
+
S(B), $(!0), H(null), l && l(B), b && console.log(
|
|
1275
1420
|
"[MessagingShell] Channel created and loaded:",
|
|
1276
|
-
|
|
1421
|
+
B.id
|
|
1277
1422
|
);
|
|
1278
|
-
} catch (
|
|
1423
|
+
} catch (B) {
|
|
1279
1424
|
console.error(
|
|
1280
1425
|
"[MessagingShell] Failed to create conversation:",
|
|
1281
|
-
|
|
1282
|
-
),
|
|
1426
|
+
B
|
|
1427
|
+
), H("Failed to create conversation");
|
|
1283
1428
|
}
|
|
1284
1429
|
} else
|
|
1285
|
-
|
|
1430
|
+
H(
|
|
1286
1431
|
"No conversation found with this account"
|
|
1287
|
-
),
|
|
1432
|
+
), b && console.log(
|
|
1288
1433
|
"[MessagingShell] No conversation found for:",
|
|
1289
|
-
|
|
1434
|
+
i
|
|
1290
1435
|
);
|
|
1291
|
-
} catch (
|
|
1436
|
+
} catch (M) {
|
|
1292
1437
|
console.error(
|
|
1293
1438
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1294
|
-
|
|
1295
|
-
),
|
|
1439
|
+
M
|
|
1440
|
+
), H("Failed to load conversation");
|
|
1296
1441
|
}
|
|
1297
1442
|
})();
|
|
1298
1443
|
}, [
|
|
1299
|
-
|
|
1444
|
+
i,
|
|
1300
1445
|
r,
|
|
1301
1446
|
f,
|
|
1302
1447
|
y,
|
|
1303
1448
|
h,
|
|
1304
|
-
|
|
1449
|
+
b,
|
|
1305
1450
|
l
|
|
1306
1451
|
]);
|
|
1307
|
-
const
|
|
1308
|
-
(
|
|
1309
|
-
S(
|
|
1452
|
+
const Q = F(
|
|
1453
|
+
(C) => {
|
|
1454
|
+
S(C), l == null || l(C);
|
|
1310
1455
|
},
|
|
1311
1456
|
[l]
|
|
1312
|
-
),
|
|
1457
|
+
), be = F(() => {
|
|
1313
1458
|
O || S(null);
|
|
1314
|
-
}, [O]),
|
|
1315
|
-
async (
|
|
1459
|
+
}, [O]), ve = F(
|
|
1460
|
+
async (C) => {
|
|
1316
1461
|
var U;
|
|
1317
1462
|
if (h)
|
|
1318
1463
|
try {
|
|
1319
|
-
|
|
1464
|
+
b && console.log(
|
|
1320
1465
|
"[MessagingShell] Starting conversation with:",
|
|
1321
|
-
|
|
1466
|
+
C.id
|
|
1322
1467
|
);
|
|
1323
|
-
const
|
|
1324
|
-
id:
|
|
1325
|
-
name:
|
|
1326
|
-
email:
|
|
1327
|
-
phone:
|
|
1468
|
+
const M = await h.startChannelWithParticipant({
|
|
1469
|
+
id: C.id,
|
|
1470
|
+
name: C.name,
|
|
1471
|
+
email: C.email,
|
|
1472
|
+
phone: C.phone
|
|
1328
1473
|
});
|
|
1329
1474
|
try {
|
|
1330
|
-
await
|
|
1331
|
-
} catch (
|
|
1332
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1475
|
+
await M.show();
|
|
1476
|
+
} catch (B) {
|
|
1477
|
+
console.warn("[MessagingShell] Failed to unhide channel:", B);
|
|
1333
1478
|
}
|
|
1334
|
-
S(
|
|
1335
|
-
} catch (
|
|
1336
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1479
|
+
S(M), u(!1), (U = V.current) == null || U.close(), a == null || a(C);
|
|
1480
|
+
} catch (M) {
|
|
1481
|
+
console.error("[MessagingShell] Failed to start conversation:", M);
|
|
1337
1482
|
}
|
|
1338
1483
|
},
|
|
1339
|
-
[h,
|
|
1340
|
-
), te =
|
|
1341
|
-
var
|
|
1342
|
-
u(!1), (
|
|
1343
|
-
}, []), we =
|
|
1344
|
-
async (
|
|
1345
|
-
|
|
1484
|
+
[h, a, b]
|
|
1485
|
+
), te = F(() => {
|
|
1486
|
+
var C;
|
|
1487
|
+
u(!1), (C = V.current) == null || C.close();
|
|
1488
|
+
}, []), we = F(
|
|
1489
|
+
async (C) => {
|
|
1490
|
+
b && console.log("[MessagingShell] Leaving conversation:", C.id), S(null), $(!1), P.current = null, await L();
|
|
1346
1491
|
},
|
|
1347
|
-
[L,
|
|
1348
|
-
), Ee =
|
|
1349
|
-
async (
|
|
1350
|
-
|
|
1492
|
+
[L, b]
|
|
1493
|
+
), Ee = F(
|
|
1494
|
+
async (C) => {
|
|
1495
|
+
b && console.log("[MessagingShell] Blocking participant:", C), S(null), $(!1), P.current = null, await L();
|
|
1351
1496
|
},
|
|
1352
|
-
[L,
|
|
1353
|
-
),
|
|
1354
|
-
return g ? /* @__PURE__ */ e("div", { className:
|
|
1497
|
+
[L, b]
|
|
1498
|
+
), X = !!I;
|
|
1499
|
+
return g ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(gs, {}) }) : v ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(re, { message: v, onBack: w }) }) : !y || !f ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
|
|
1355
1500
|
re,
|
|
1356
1501
|
{
|
|
1357
1502
|
message: "Not connected to messaging service",
|
|
1358
1503
|
onBack: w
|
|
1359
1504
|
}
|
|
1360
|
-
) }) :
|
|
1505
|
+
) }) : Y ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(re, { message: Y }) }) : /* @__PURE__ */ o(
|
|
1361
1506
|
"div",
|
|
1362
1507
|
{
|
|
1363
|
-
className:
|
|
1364
|
-
"messaging-shell h-full bg-
|
|
1508
|
+
className: p(
|
|
1509
|
+
"messaging-shell h-full bg-background-secondary overflow-hidden",
|
|
1365
1510
|
s
|
|
1366
1511
|
),
|
|
1367
1512
|
children: [
|
|
1368
|
-
/* @__PURE__ */
|
|
1513
|
+
/* @__PURE__ */ o("div", { className: "flex h-full min-h-0", children: [
|
|
1369
1514
|
/* @__PURE__ */ e(
|
|
1370
1515
|
"div",
|
|
1371
1516
|
{
|
|
1372
|
-
className:
|
|
1373
|
-
"messaging-channel-list-sidebar min-h-0 min-w-0
|
|
1517
|
+
className: p(
|
|
1518
|
+
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1374
1519
|
{
|
|
1375
1520
|
// Explicitly hidden via prop or in direct conversation mode
|
|
1376
1521
|
"!hidden": m === !1 || O,
|
|
1377
1522
|
// Normal mode: hide on mobile when channel selected, show on desktop
|
|
1378
|
-
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !O &&
|
|
1523
|
+
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !O && X,
|
|
1379
1524
|
// Normal mode: show when no channel selected
|
|
1380
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !O && !
|
|
1525
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !O && !X
|
|
1381
1526
|
}
|
|
1382
1527
|
),
|
|
1383
1528
|
children: /* @__PURE__ */ e(
|
|
1384
1529
|
Ke,
|
|
1385
1530
|
{
|
|
1386
|
-
onChannelSelect:
|
|
1531
|
+
onChannelSelect: Q,
|
|
1387
1532
|
selectedChannel: I || void 0,
|
|
1388
|
-
filters:
|
|
1533
|
+
filters: T,
|
|
1389
1534
|
customEmptyStateIndicator: k
|
|
1390
1535
|
}
|
|
1391
1536
|
)
|
|
@@ -1394,50 +1539,50 @@ const us = ({
|
|
|
1394
1539
|
/* @__PURE__ */ e(
|
|
1395
1540
|
"div",
|
|
1396
1541
|
{
|
|
1397
|
-
className:
|
|
1542
|
+
className: p(
|
|
1398
1543
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1399
1544
|
{
|
|
1400
1545
|
// In direct conversation mode, always show (full width)
|
|
1401
|
-
flex: O ||
|
|
1546
|
+
flex: O || X,
|
|
1402
1547
|
// Normal mode: hide on mobile when no channel selected
|
|
1403
|
-
"hidden lg:flex": !O && !
|
|
1548
|
+
"hidden lg:flex": !O && !X
|
|
1404
1549
|
}
|
|
1405
1550
|
),
|
|
1406
1551
|
children: I ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1407
1552
|
cs,
|
|
1408
1553
|
{
|
|
1409
1554
|
channel: I,
|
|
1410
|
-
onBack:
|
|
1555
|
+
onBack: be,
|
|
1411
1556
|
showBackButton: !O,
|
|
1412
1557
|
renderMessageInputActions: n,
|
|
1413
1558
|
onLeaveConversation: we,
|
|
1414
1559
|
onBlockParticipant: Ee,
|
|
1415
|
-
CustomChannelEmptyState:
|
|
1560
|
+
CustomChannelEmptyState: c
|
|
1416
1561
|
},
|
|
1417
1562
|
I.id
|
|
1418
|
-
) }) : /* @__PURE__ */ e(
|
|
1563
|
+
) }) : /* @__PURE__ */ e(hs, { hasChannels: R })
|
|
1419
1564
|
}
|
|
1420
1565
|
)
|
|
1421
1566
|
] }),
|
|
1422
|
-
|
|
1567
|
+
J && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1423
1568
|
/* @__PURE__ */ e(
|
|
1424
1569
|
"dialog",
|
|
1425
1570
|
{
|
|
1426
1571
|
ref: V,
|
|
1427
1572
|
className: "mes-dialog",
|
|
1428
|
-
onClick: (
|
|
1429
|
-
|
|
1573
|
+
onClick: (C) => {
|
|
1574
|
+
C.target === V.current && te();
|
|
1430
1575
|
},
|
|
1431
1576
|
onClose: te,
|
|
1432
1577
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1433
1578
|
us,
|
|
1434
1579
|
{
|
|
1435
|
-
participantSource:
|
|
1436
|
-
onSelectParticipant:
|
|
1580
|
+
participantSource: J,
|
|
1581
|
+
onSelectParticipant: ve,
|
|
1437
1582
|
onClose: te,
|
|
1438
1583
|
existingParticipantIds: N,
|
|
1439
|
-
participantLabel:
|
|
1440
|
-
searchPlaceholder: `Search ${
|
|
1584
|
+
participantLabel: D,
|
|
1585
|
+
searchPlaceholder: `Search ${D}...`
|
|
1441
1586
|
},
|
|
1442
1587
|
A
|
|
1443
1588
|
) })
|
|
@@ -1446,7 +1591,7 @@ const us = ({
|
|
|
1446
1591
|
]
|
|
1447
1592
|
}
|
|
1448
1593
|
);
|
|
1449
|
-
},
|
|
1594
|
+
}, xs = ({
|
|
1450
1595
|
question: t,
|
|
1451
1596
|
onClick: s,
|
|
1452
1597
|
loading: n = !1,
|
|
@@ -1458,7 +1603,7 @@ const us = ({
|
|
|
1458
1603
|
onClick: s,
|
|
1459
1604
|
disabled: n,
|
|
1460
1605
|
style: { backgroundColor: "#E6E5E3" },
|
|
1461
|
-
className:
|
|
1606
|
+
className: p(
|
|
1462
1607
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1463
1608
|
{
|
|
1464
1609
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1468,36 +1613,36 @@ const us = ({
|
|
|
1468
1613
|
),
|
|
1469
1614
|
children: t
|
|
1470
1615
|
}
|
|
1471
|
-
),
|
|
1616
|
+
), ks = ({
|
|
1472
1617
|
faqs: t,
|
|
1473
1618
|
onFaqClick: s,
|
|
1474
1619
|
loadingFaqId: n,
|
|
1475
1620
|
headerText: l,
|
|
1476
|
-
className:
|
|
1477
|
-
avatarImage:
|
|
1621
|
+
className: a,
|
|
1622
|
+
avatarImage: i,
|
|
1478
1623
|
avatarName: r
|
|
1479
1624
|
}) => {
|
|
1480
|
-
const
|
|
1481
|
-
return
|
|
1482
|
-
(
|
|
1483
|
-
|
|
1625
|
+
const c = t.filter((m) => m.enabled).sort((m, x) => (m.order ?? 0) - (x.order ?? 0));
|
|
1626
|
+
return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ o("div", { className: "flex gap-3 items-end", children: [
|
|
1627
|
+
(i || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1628
|
+
q,
|
|
1484
1629
|
{
|
|
1485
1630
|
id: r || "account",
|
|
1486
1631
|
name: r || "Account",
|
|
1487
|
-
image:
|
|
1632
|
+
image: i,
|
|
1488
1633
|
size: 24,
|
|
1489
1634
|
shape: "circle"
|
|
1490
1635
|
}
|
|
1491
1636
|
) }),
|
|
1492
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ o(
|
|
1493
1638
|
"div",
|
|
1494
1639
|
{
|
|
1495
1640
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
1496
1641
|
style: { backgroundColor: "#F1F0EE" },
|
|
1497
1642
|
children: [
|
|
1498
1643
|
l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
|
|
1499
|
-
|
|
1500
|
-
|
|
1644
|
+
c.map((m) => /* @__PURE__ */ e(
|
|
1645
|
+
xs,
|
|
1501
1646
|
{
|
|
1502
1647
|
question: m.question,
|
|
1503
1648
|
onClick: () => s(m.id),
|
|
@@ -1509,59 +1654,59 @@ const us = ({
|
|
|
1509
1654
|
}
|
|
1510
1655
|
)
|
|
1511
1656
|
] }) });
|
|
1512
|
-
},
|
|
1513
|
-
const { initialSearch: n = "", pageSize: l = 20 } = s, [
|
|
1657
|
+
}, ps = (t, s = {}) => {
|
|
1658
|
+
const { initialSearch: n = "", pageSize: l = 20 } = s, [a, i] = E([]), [r, c] = E(!1), [m, x] = E(null), [k, h] = E(n), [f, y] = E(!0), [g, v] = E(), w = F(async (R = !1, _) => {
|
|
1514
1659
|
if (r) return;
|
|
1515
|
-
const d =
|
|
1516
|
-
|
|
1660
|
+
const d = _ !== void 0 ? _ : k;
|
|
1661
|
+
c(!0), x(null);
|
|
1517
1662
|
try {
|
|
1518
1663
|
const u = await t.loadParticipants({
|
|
1519
1664
|
search: d || void 0,
|
|
1520
1665
|
limit: l,
|
|
1521
|
-
cursor:
|
|
1666
|
+
cursor: R ? void 0 : g
|
|
1522
1667
|
});
|
|
1523
|
-
|
|
1524
|
-
(N) =>
|
|
1525
|
-
), y(u.hasMore),
|
|
1668
|
+
i(
|
|
1669
|
+
(N) => R ? u.participants : [...N, ...u.participants]
|
|
1670
|
+
), y(u.hasMore), v(u.nextCursor);
|
|
1526
1671
|
} catch (u) {
|
|
1527
1672
|
const N = u instanceof Error ? u.message : "Failed to load participants";
|
|
1528
1673
|
x(N), console.error("[useParticipants] Load error:", u);
|
|
1529
1674
|
} finally {
|
|
1530
|
-
|
|
1675
|
+
c(!1);
|
|
1531
1676
|
}
|
|
1532
|
-
}, [t, k, g, l, r]),
|
|
1677
|
+
}, [t, k, g, l, r]), b = F(() => {
|
|
1533
1678
|
f && !r && w(!1);
|
|
1534
|
-
}, [f, r, w]), I =
|
|
1535
|
-
h(
|
|
1536
|
-
}, [w]), S =
|
|
1537
|
-
|
|
1679
|
+
}, [f, r, w]), I = F((R) => {
|
|
1680
|
+
h(R), v(void 0), w(!0, R);
|
|
1681
|
+
}, [w]), S = F(() => {
|
|
1682
|
+
v(void 0), w(!0);
|
|
1538
1683
|
}, [w]);
|
|
1539
|
-
return
|
|
1684
|
+
return G(() => {
|
|
1540
1685
|
w(!0);
|
|
1541
1686
|
}, [t.loadParticipants]), {
|
|
1542
|
-
participants:
|
|
1687
|
+
participants: a,
|
|
1543
1688
|
loading: r,
|
|
1544
1689
|
error: m,
|
|
1545
1690
|
searchQuery: k,
|
|
1546
1691
|
hasMore: f,
|
|
1547
1692
|
totalCount: t.totalCount,
|
|
1548
|
-
loadMore:
|
|
1693
|
+
loadMore: b,
|
|
1549
1694
|
search: I,
|
|
1550
1695
|
refresh: S
|
|
1551
1696
|
};
|
|
1552
1697
|
};
|
|
1553
1698
|
export {
|
|
1554
|
-
|
|
1555
|
-
|
|
1699
|
+
q as Avatar,
|
|
1700
|
+
Ce as ChannelEmptyState,
|
|
1556
1701
|
Ke as ChannelList,
|
|
1557
1702
|
cs as ChannelView,
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1703
|
+
ks as FaqList,
|
|
1704
|
+
xs as FaqListItem,
|
|
1705
|
+
Is as MessagingProvider,
|
|
1706
|
+
Ss as MessagingShell,
|
|
1562
1707
|
us as ParticipantPicker,
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1708
|
+
Ye as formatRelativeTime,
|
|
1709
|
+
Ze as useMessaging,
|
|
1710
|
+
ps as useParticipants
|
|
1566
1711
|
};
|
|
1567
1712
|
//# sourceMappingURL=index.js.map
|