@linktr.ee/messaging-react 1.15.2 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +14 -22
- package/dist/index.js +619 -595
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +42 -4
- package/src/components/MessagingShell/index.tsx +2 -0
- package/src/types.ts +68 -71
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as i, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { GiftIcon as
|
|
7
|
-
import { LinkPreviewsManager as
|
|
8
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as Ne } from "react/jsx-runtime";
|
|
2
|
+
import R from "classnames";
|
|
3
|
+
import L, { createContext as Ge, useContext as He, useCallback as D, useState as I, useRef as W, useEffect as q, useMemo as pe } from "react";
|
|
4
|
+
import { StreamChatService as Ve } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as We, ChannelList as qe, DateSeparator as Ze, areMessageUIPropsEqual as Ye, useChatContext as Je, useTranslationContext as Qe, useMessageReminder as Xe, useComponentContext as Ke, Attachment as es, Avatar as ss, EditMessageModal as ts, MessageBlocked as ns, MessageBouncePrompt as rs, MessageDeleted as as, MessageIsThreadReplyInChannelButtonIndicator as ls, MessageRepliesCountButton as os, MessageStatus as is, MessageTimestamp as Te, ReminderNotification as cs, StreamedMessageText as ds, messageHasAttachments as ms, messageHasReactions as us, isDateSeparatorMessage as hs, isMessageBlocked as fs, isMessageBounced as gs, isMessageEdited as xs, MessageBounceModal as Cs, Poll as bs, MessageText as Ns, MessageErrorIcon as vs, MessageEditedTimestamp as ws, useMessageContext as ps, useMessageComposer as ys, useStateStore as Es, MessageInput as Is, useMessageInputContext as Ss, useMessageComposerHasSendableData as _s, SimpleAttachmentSelector as Ms, QuotedMessagePreview as ks, AttachmentPreviewList as Rs, TextareaComposer as Ts, Channel as Ds, useChannelStateContext as De, WithComponents as Fs, Window as Ls, MessageList as Ps } from "stream-chat-react";
|
|
6
|
+
import { GiftIcon as Os, XIcon as ve, ArrowUpIcon as Us, ArrowLeftIcon as ye, StarIcon as Ee, DotsThreeIcon as Ie, SpinnerGapIcon as ue, SignOutIcon as Bs, ProhibitInsetIcon as Se, FlagIcon as As, MagnifyingGlassIcon as js, ChatCircleDotsIcon as _e } from "@phosphor-icons/react";
|
|
7
|
+
import { LinkPreviewsManager as Me } from "stream-chat";
|
|
8
|
+
const Fe = Ge({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,7 +15,7 @@ const De = ze({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}),
|
|
18
|
+
}), ge = () => He(Fe), pt = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
@@ -23,7 +23,7 @@ const De = ze({
|
|
|
23
23
|
capabilities: l = {},
|
|
24
24
|
debug: c = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const a =
|
|
26
|
+
const a = D(
|
|
27
27
|
(d, ...N) => {
|
|
28
28
|
c && console.log(`🔥 [MessagingProvider] ${d}`, ...N);
|
|
29
29
|
},
|
|
@@ -35,28 +35,28 @@ const De = ze({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(l)
|
|
37
37
|
});
|
|
38
|
-
const [u, h] = I(null), [x,
|
|
38
|
+
const [u, h] = I(null), [x, p] = I(null), [f, o] = I(!1), [M, S] = I(!1), [g, m] = I(null), b = W(!1), v = W({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
42
42
|
capabilities: l
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
43
|
+
}), y = W(0);
|
|
44
|
+
y.current++, a("📊 RENDER INFO", {
|
|
45
|
+
renderCount: y.current,
|
|
46
46
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
|
-
userChanged:
|
|
49
|
-
apiKeyChanged:
|
|
50
|
-
serviceConfigChanged:
|
|
51
|
-
capabilitiesChanged:
|
|
48
|
+
userChanged: v.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
+
apiKeyChanged: v.current.apiKey !== r,
|
|
50
|
+
serviceConfigChanged: v.current.serviceConfig !== n,
|
|
51
|
+
capabilitiesChanged: v.current.capabilities !== l
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
53
|
+
}), v.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
55
|
apiKey: r,
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: l
|
|
58
|
-
},
|
|
59
|
-
const d =
|
|
58
|
+
}, q(() => {
|
|
59
|
+
const d = y.current;
|
|
60
60
|
if (a("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
61
61
|
renderCount: d,
|
|
62
62
|
apiKey: !!r,
|
|
@@ -64,8 +64,8 @@ const De = ze({
|
|
|
64
64
|
dependencies: {
|
|
65
65
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
66
66
|
serviceConfigRef: n,
|
|
67
|
-
serviceConfigStable:
|
|
68
|
-
apiKeyStable:
|
|
67
|
+
serviceConfigStable: v.current.serviceConfig === n,
|
|
68
|
+
apiKeyStable: v.current.apiKey === r
|
|
69
69
|
}
|
|
70
70
|
}), !r || !n) {
|
|
71
71
|
a("⚠️ SERVICE INIT SKIPPED", {
|
|
@@ -77,9 +77,9 @@ const De = ze({
|
|
|
77
77
|
a("🚀 CREATING NEW SERVICE", {
|
|
78
78
|
renderCount: d,
|
|
79
79
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
80
|
-
serviceConfigChanged:
|
|
80
|
+
serviceConfigChanged: v.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const N = new
|
|
82
|
+
const N = new Ve({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: r,
|
|
85
85
|
debug: c
|
|
@@ -94,25 +94,25 @@ const De = ze({
|
|
|
94
94
|
}), N.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
96
|
}, [r, n, c, a]);
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
var N,
|
|
97
|
+
const _ = W(null);
|
|
98
|
+
q(() => {
|
|
99
|
+
var N, P;
|
|
100
100
|
if (a("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
101
101
|
hasService: !!u,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
|
-
isConnecting:
|
|
104
|
+
isConnecting: b.current,
|
|
105
105
|
isConnected: f,
|
|
106
106
|
dependencies: { service: !!u, userId: s == null ? void 0 : s.id }
|
|
107
107
|
}), !u || !s) {
|
|
108
108
|
a("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
111
|
+
if (b.current) {
|
|
112
112
|
a("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((N =
|
|
115
|
+
if (((N = _.current) == null ? void 0 : N.serviceId) === u && ((P = _.current) == null ? void 0 : P.userId) === s.id) {
|
|
116
116
|
a(
|
|
117
117
|
"⚠️ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -120,40 +120,40 @@ const De = ze({
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
a("🚀 STARTING USER CONNECTION", { userId: s.id }),
|
|
123
|
+
a("🚀 STARTING USER CONNECTION", { userId: s.id }), b.current = !0, S(!0), m(null);
|
|
124
124
|
try {
|
|
125
125
|
a("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
126
|
const j = await u.connectUser(s);
|
|
127
|
-
|
|
127
|
+
p(j), o(!0), _.current = { serviceId: u, userId: s.id }, a("✅ USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: j.userID
|
|
130
130
|
});
|
|
131
131
|
} catch (j) {
|
|
132
|
-
const
|
|
133
|
-
|
|
132
|
+
const z = j instanceof Error ? j.message : "Connection failed";
|
|
133
|
+
m(z), a("❌ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
|
-
error:
|
|
135
|
+
error: z
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
S(!1), b.current = !1, a("🔄 USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
isConnected: f
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [u, s, a, f]),
|
|
144
|
+
}, [u, s, a, f]), q(() => (a("🔌 CLEANUP EFFECT REGISTERED", {
|
|
145
145
|
hasService: !!u,
|
|
146
146
|
isConnected: f
|
|
147
147
|
}), () => {
|
|
148
148
|
u && f ? (a(
|
|
149
149
|
"🧹 CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
151
|
+
), _.current = null, u.disconnectUser().catch(console.error)) : a("🔇 CLEANUP EFFECT SKIPPED", {
|
|
152
152
|
hasService: !!u,
|
|
153
153
|
isConnected: f
|
|
154
154
|
});
|
|
155
155
|
}), [u, f, a]);
|
|
156
|
-
const
|
|
156
|
+
const E = D(async () => {
|
|
157
157
|
if (a("🔄 REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!u,
|
|
159
159
|
hasUser: !!s
|
|
@@ -161,53 +161,53 @@ const De = ze({
|
|
|
161
161
|
a("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
a("🚀 STARTING CONNECTION REFRESH", { userId: s.id }),
|
|
164
|
+
a("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), S(!0);
|
|
165
165
|
try {
|
|
166
166
|
a("🔌 DISCONNECTING FOR REFRESH"), await u.disconnectUser(), a("📞 RECONNECTING FOR REFRESH");
|
|
167
167
|
const d = await u.connectUser(s);
|
|
168
|
-
|
|
168
|
+
p(d), o(!0), m(null), a("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
169
|
} catch (d) {
|
|
170
170
|
const N = d instanceof Error ? d.message : "Refresh failed";
|
|
171
|
-
|
|
171
|
+
m(N), a("❌ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
173
|
error: N
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
S(!1), a("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [u, s, a]),
|
|
178
|
+
}, [u, s, a]), C = L.useMemo(() => (a("💫 CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!u,
|
|
180
180
|
hasClient: !!x,
|
|
181
181
|
isConnected: f,
|
|
182
|
-
isLoading:
|
|
183
|
-
hasError: !!
|
|
182
|
+
isLoading: M,
|
|
183
|
+
hasError: !!g,
|
|
184
184
|
capabilitiesKeys: Object.keys(l)
|
|
185
185
|
}), {
|
|
186
186
|
service: u,
|
|
187
187
|
client: x,
|
|
188
188
|
isConnected: f,
|
|
189
|
-
isLoading:
|
|
190
|
-
error:
|
|
189
|
+
isLoading: M,
|
|
190
|
+
error: g,
|
|
191
191
|
capabilities: l,
|
|
192
|
-
refreshConnection:
|
|
192
|
+
refreshConnection: E,
|
|
193
193
|
debug: c
|
|
194
194
|
}), [
|
|
195
195
|
u,
|
|
196
196
|
x,
|
|
197
197
|
f,
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
M,
|
|
199
|
+
g,
|
|
200
200
|
l,
|
|
201
|
-
|
|
201
|
+
E,
|
|
202
202
|
c,
|
|
203
203
|
a
|
|
204
204
|
]);
|
|
205
205
|
return a("🔄 RENDER END", {
|
|
206
|
-
renderCount:
|
|
206
|
+
renderCount: y.current,
|
|
207
207
|
willRenderChat: !!(x && f),
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(
|
|
210
|
-
|
|
208
|
+
contextValueReady: !!C
|
|
209
|
+
}), /* @__PURE__ */ e(Fe.Provider, { value: C, children: x && f ? /* @__PURE__ */ e(
|
|
210
|
+
We,
|
|
211
211
|
{
|
|
212
212
|
client: x,
|
|
213
213
|
customClasses: {
|
|
@@ -216,18 +216,18 @@ const De = ze({
|
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
},
|
|
219
|
+
}, $s = () => ge(), zs = (t, s) => {
|
|
220
220
|
const n = new Date(
|
|
221
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
222
222
|
), l = new Date(
|
|
223
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
224
224
|
).getTime() - n.getTime();
|
|
225
225
|
return Math.floor(l / (1e3 * 60 * 60 * 24));
|
|
226
|
-
},
|
|
226
|
+
}, Gs = (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 = zs(t, s);
|
|
231
231
|
return r === 0 ? t.toLocaleTimeString([], {
|
|
232
232
|
hour: "numeric",
|
|
233
233
|
minute: "2-digit",
|
|
@@ -237,7 +237,7 @@ const De = ze({
|
|
|
237
237
|
day: "numeric",
|
|
238
238
|
year: "2-digit"
|
|
239
239
|
});
|
|
240
|
-
},
|
|
240
|
+
}, ke = [
|
|
241
241
|
"🍎",
|
|
242
242
|
// Apple
|
|
243
243
|
"🍌",
|
|
@@ -265,7 +265,7 @@ const De = ze({
|
|
|
265
265
|
"🍈"
|
|
266
266
|
// Melon
|
|
267
267
|
];
|
|
268
|
-
function
|
|
268
|
+
function Hs(t) {
|
|
269
269
|
let s = 0;
|
|
270
270
|
for (let n = 0; n < t.length; n++) {
|
|
271
271
|
const r = t.charCodeAt(n);
|
|
@@ -273,25 +273,25 @@ function Gs(t) {
|
|
|
273
273
|
}
|
|
274
274
|
return Math.abs(s);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const n =
|
|
278
|
-
return
|
|
276
|
+
function Vs(t) {
|
|
277
|
+
const n = Hs(t) % ke.length;
|
|
278
|
+
return ke[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
285
|
shape: l = "squircle"
|
|
286
286
|
}) => {
|
|
287
|
-
const c =
|
|
287
|
+
const c = Vs(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = l === "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: R("flex-shrink-0 overflow-hidden", r),
|
|
295
295
|
style: {
|
|
296
296
|
width: `${n}px`,
|
|
297
297
|
height: `${n}px`,
|
|
@@ -308,7 +308,7 @@ const te = ({
|
|
|
308
308
|
"div",
|
|
309
309
|
{
|
|
310
310
|
"aria-hidden": "true",
|
|
311
|
-
className:
|
|
311
|
+
className: R(
|
|
312
312
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
313
313
|
u
|
|
314
314
|
),
|
|
@@ -317,30 +317,30 @@ const te = ({
|
|
|
317
317
|
)
|
|
318
318
|
}
|
|
319
319
|
);
|
|
320
|
-
},
|
|
320
|
+
}, Ws = () => /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 10 10", fill: "none", children: /* @__PURE__ */ e(
|
|
321
321
|
"path",
|
|
322
322
|
{
|
|
323
323
|
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",
|
|
324
324
|
fill: "currentColor"
|
|
325
325
|
}
|
|
326
|
-
) }),
|
|
326
|
+
) }), qs = (t) => {
|
|
327
327
|
var s;
|
|
328
328
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
|
|
329
329
|
}, Zs = (t) => {
|
|
330
330
|
var s;
|
|
331
331
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
|
|
332
|
-
},
|
|
332
|
+
}, Le = (t) => {
|
|
333
333
|
var s;
|
|
334
334
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
|
|
335
|
-
},
|
|
335
|
+
}, Pe = (t) => qs(t) || Zs(t), Ys = (t) => {
|
|
336
336
|
var s;
|
|
337
|
-
return
|
|
338
|
-
},
|
|
337
|
+
return Pe(t) && !((s = t.text) != null && s.trim());
|
|
338
|
+
}, Re = ({
|
|
339
339
|
message: t,
|
|
340
340
|
standalone: s = !1
|
|
341
341
|
}) => {
|
|
342
342
|
var l;
|
|
343
|
-
const n =
|
|
343
|
+
const n = Pe(t), r = Le(t);
|
|
344
344
|
if (!n && !r)
|
|
345
345
|
return null;
|
|
346
346
|
if (n) {
|
|
@@ -348,42 +348,42 @@ const te = ({
|
|
|
348
348
|
if (!c) return null;
|
|
349
349
|
const a = s ? "message-tip-standalone" : "message-tag message-tag--tip", u = s ? `${c} tip` : `Delivered with ${c} tip`;
|
|
350
350
|
return /* @__PURE__ */ i("div", { className: a, children: [
|
|
351
|
-
/* @__PURE__ */ e(
|
|
351
|
+
/* @__PURE__ */ e(Os, { size: s ? 14 : 12 }),
|
|
352
352
|
/* @__PURE__ */ e("span", { children: u })
|
|
353
353
|
] });
|
|
354
354
|
}
|
|
355
355
|
return /* @__PURE__ */ i("div", { className: "message-tag message-tag--chatbot", children: [
|
|
356
|
-
/* @__PURE__ */ e("span", { className: "message-tag__icon", style: { marginTop: -1 }, children: /* @__PURE__ */ e(
|
|
356
|
+
/* @__PURE__ */ e("span", { className: "message-tag__icon", style: { marginTop: -1 }, children: /* @__PURE__ */ e(Ws, {}) }),
|
|
357
357
|
/* @__PURE__ */ e("span", { className: "message-tag__label", children: "Chatbot" })
|
|
358
358
|
] });
|
|
359
|
-
},
|
|
359
|
+
}, Oe = L.memo(
|
|
360
360
|
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: l }) => {
|
|
361
|
-
var
|
|
361
|
+
var b, v, y, _, E, C;
|
|
362
362
|
const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), a = () => {
|
|
363
363
|
t && n(t);
|
|
364
|
-
}, h = Object.values(((
|
|
364
|
+
}, h = Object.values(((b = t == null ? void 0 : t.state) == null ? void 0 : b.members) || {}).find(
|
|
365
365
|
(d) => {
|
|
366
|
-
var N,
|
|
367
|
-
return ((N = d.user) == null ? void 0 : N.id) && d.user.id !== ((
|
|
366
|
+
var N, P;
|
|
367
|
+
return ((N = d.user) == null ? void 0 : N.id) && d.user.id !== ((P = t == null ? void 0 : t._client) == null ? void 0 : P.userID);
|
|
368
368
|
}
|
|
369
|
-
), x = ((
|
|
369
|
+
), x = ((v = h == null ? void 0 : h.user) == null ? void 0 : v.name) || "Conversation", p = (y = h == null ? void 0 : h.user) == null ? void 0 : y.image, f = (E = (_ = t == null ? void 0 : t.state) == null ? void 0 : _.messages) == null ? void 0 : E[t.state.messages.length - 1], M = (() => {
|
|
370
370
|
var N;
|
|
371
371
|
if (f != null && f.text) return f.text;
|
|
372
372
|
const d = (N = f == null ? void 0 : f.attachments) == null ? void 0 : N[0];
|
|
373
373
|
return d ? d.og_scrape_url ? d.og_scrape_url : d.type === "image" ? "📷 Sent an image" : d.type === "video" ? "🎥 Sent a video" : d.type === "audio" ? "🎵 Sent audio" : d.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
|
|
374
|
-
})(),
|
|
374
|
+
})(), S = f != null && f.created_at ? Gs(new Date(f.created_at)) : "", g = f ? Le(f) : !1, m = l ?? 0;
|
|
375
375
|
return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
376
376
|
channelId: t == null ? void 0 : t.id,
|
|
377
377
|
isSelected: c,
|
|
378
378
|
participantName: x,
|
|
379
|
-
unreadCount:
|
|
380
|
-
hasTimestamp: !!
|
|
379
|
+
unreadCount: m,
|
|
380
|
+
hasTimestamp: !!S
|
|
381
381
|
}), /* @__PURE__ */ e(
|
|
382
382
|
"button",
|
|
383
383
|
{
|
|
384
384
|
type: "button",
|
|
385
385
|
onClick: a,
|
|
386
|
-
className:
|
|
386
|
+
className: R(
|
|
387
387
|
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
388
388
|
{
|
|
389
389
|
"bg-primary-alt/10 border-l-4 border-l-primary": c,
|
|
@@ -392,11 +392,11 @@ const te = ({
|
|
|
392
392
|
),
|
|
393
393
|
children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
394
394
|
/* @__PURE__ */ e(
|
|
395
|
-
|
|
395
|
+
ne,
|
|
396
396
|
{
|
|
397
|
-
id: ((
|
|
397
|
+
id: ((C = h == null ? void 0 : h.user) == null ? void 0 : C.id) || t.id || "unknown",
|
|
398
398
|
name: x,
|
|
399
|
-
image:
|
|
399
|
+
image: p,
|
|
400
400
|
size: 44,
|
|
401
401
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
402
402
|
}
|
|
@@ -406,21 +406,21 @@ const te = ({
|
|
|
406
406
|
/* @__PURE__ */ e(
|
|
407
407
|
"h3",
|
|
408
408
|
{
|
|
409
|
-
className:
|
|
409
|
+
className: R(
|
|
410
410
|
"text-sm font-medium truncate",
|
|
411
411
|
c ? "text-primary" : "text-charcoal"
|
|
412
412
|
),
|
|
413
413
|
children: x
|
|
414
414
|
}
|
|
415
415
|
),
|
|
416
|
-
|
|
416
|
+
S && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: S })
|
|
417
417
|
] }),
|
|
418
418
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
419
419
|
/* @__PURE__ */ i("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: [
|
|
420
|
-
|
|
421
|
-
|
|
420
|
+
g && "✨ ",
|
|
421
|
+
M
|
|
422
422
|
] }),
|
|
423
|
-
|
|
423
|
+
m > 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: m > 99 ? "99+" : m })
|
|
424
424
|
] })
|
|
425
425
|
] })
|
|
426
426
|
] })
|
|
@@ -428,8 +428,8 @@ const te = ({
|
|
|
428
428
|
);
|
|
429
429
|
}
|
|
430
430
|
);
|
|
431
|
-
|
|
432
|
-
const
|
|
431
|
+
Oe.displayName = "CustomChannelPreview";
|
|
432
|
+
const Ue = L.memo(
|
|
433
433
|
({
|
|
434
434
|
onChannelSelect: t,
|
|
435
435
|
selectedChannel: s,
|
|
@@ -437,16 +437,16 @@ const Oe = P.memo(
|
|
|
437
437
|
className: r,
|
|
438
438
|
customEmptyStateIndicator: l
|
|
439
439
|
}) => {
|
|
440
|
-
const c =
|
|
440
|
+
const c = L.useRef(0);
|
|
441
441
|
c.current++;
|
|
442
|
-
const { debug: a = !1 } =
|
|
442
|
+
const { debug: a = !1 } = ge();
|
|
443
443
|
a && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
444
444
|
renderCount: c.current,
|
|
445
445
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
446
446
|
filters: n
|
|
447
447
|
});
|
|
448
|
-
const u =
|
|
449
|
-
|
|
448
|
+
const u = L.useMemo(() => (x) => /* @__PURE__ */ e(
|
|
449
|
+
Oe,
|
|
450
450
|
{
|
|
451
451
|
...x,
|
|
452
452
|
selectedChannel: s,
|
|
@@ -457,12 +457,12 @@ const Oe = P.memo(
|
|
|
457
457
|
return /* @__PURE__ */ e(
|
|
458
458
|
"div",
|
|
459
459
|
{
|
|
460
|
-
className:
|
|
460
|
+
className: R(
|
|
461
461
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
462
462
|
r
|
|
463
463
|
),
|
|
464
464
|
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
|
|
465
|
-
|
|
465
|
+
qe,
|
|
466
466
|
{
|
|
467
467
|
filters: n,
|
|
468
468
|
sort: { last_message_at: -1 },
|
|
@@ -476,8 +476,8 @@ const Oe = P.memo(
|
|
|
476
476
|
);
|
|
477
477
|
}
|
|
478
478
|
);
|
|
479
|
-
|
|
480
|
-
const
|
|
479
|
+
Ue.displayName = "ChannelList";
|
|
480
|
+
const me = ({
|
|
481
481
|
variant: t = "default",
|
|
482
482
|
className: s,
|
|
483
483
|
children: n,
|
|
@@ -486,7 +486,7 @@ const ce = ({
|
|
|
486
486
|
"button",
|
|
487
487
|
{
|
|
488
488
|
type: "button",
|
|
489
|
-
className:
|
|
489
|
+
className: R(
|
|
490
490
|
"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",
|
|
491
491
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
492
492
|
s
|
|
@@ -495,12 +495,12 @@ const ce = ({
|
|
|
495
495
|
children: n
|
|
496
496
|
}
|
|
497
497
|
);
|
|
498
|
-
function
|
|
498
|
+
function Be({ label: t, className: s, children: n, ...r }) {
|
|
499
499
|
return /* @__PURE__ */ i(
|
|
500
500
|
"button",
|
|
501
501
|
{
|
|
502
502
|
type: "button",
|
|
503
|
-
className:
|
|
503
|
+
className: R(
|
|
504
504
|
"rounded-full p-2 transition-colors focus-ring",
|
|
505
505
|
{
|
|
506
506
|
"cursor-not-allowed opacity-50": r.disabled,
|
|
@@ -516,11 +516,11 @@ function Ue({ label: t, className: s, children: n, ...r }) {
|
|
|
516
516
|
}
|
|
517
517
|
);
|
|
518
518
|
}
|
|
519
|
-
function
|
|
520
|
-
return /* @__PURE__ */ e(
|
|
519
|
+
function Ae({ onClick: t }) {
|
|
520
|
+
return /* @__PURE__ */ e(Be, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ve, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
521
521
|
}
|
|
522
|
-
const
|
|
523
|
-
var
|
|
522
|
+
const Js = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Qs = (t) => {
|
|
523
|
+
var de, J;
|
|
524
524
|
const {
|
|
525
525
|
additionalMessageInputProps: s,
|
|
526
526
|
editing: n,
|
|
@@ -531,160 +531,160 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
|
|
|
531
531
|
handleOpenThread: u,
|
|
532
532
|
handleRetry: h,
|
|
533
533
|
highlighted: x,
|
|
534
|
-
isMessageAIGenerated:
|
|
534
|
+
isMessageAIGenerated: p,
|
|
535
535
|
isMyMessage: f,
|
|
536
536
|
message: o,
|
|
537
|
-
onUserClick:
|
|
538
|
-
onUserHover:
|
|
539
|
-
renderText:
|
|
540
|
-
threadList:
|
|
541
|
-
} = t, { client:
|
|
542
|
-
Attachment: N =
|
|
543
|
-
Avatar:
|
|
544
|
-
EditMessageModal: j =
|
|
545
|
-
MessageBlocked:
|
|
546
|
-
MessageBouncePrompt:
|
|
547
|
-
MessageDeleted:
|
|
548
|
-
MessageIsThreadReplyInChannelButtonIndicator:
|
|
549
|
-
MessageRepliesCountButton:
|
|
550
|
-
MessageStatus:
|
|
551
|
-
MessageTimestamp:
|
|
552
|
-
ReminderNotification:
|
|
553
|
-
StreamedMessageText:
|
|
554
|
-
PinIndicator:
|
|
555
|
-
} =
|
|
556
|
-
() =>
|
|
557
|
-
[
|
|
558
|
-
),
|
|
537
|
+
onUserClick: M,
|
|
538
|
+
onUserHover: S,
|
|
539
|
+
renderText: g,
|
|
540
|
+
threadList: m
|
|
541
|
+
} = t, { client: b } = Je("CustomMessage"), { t: v } = Qe("CustomMessage"), [y, _] = I(!1), [E, C] = I(!1), d = Xe(o.id), {
|
|
542
|
+
Attachment: N = es,
|
|
543
|
+
Avatar: P = ss,
|
|
544
|
+
EditMessageModal: j = ts,
|
|
545
|
+
MessageBlocked: z = ns,
|
|
546
|
+
MessageBouncePrompt: re = rs,
|
|
547
|
+
MessageDeleted: Q = as,
|
|
548
|
+
MessageIsThreadReplyInChannelButtonIndicator: X = ls,
|
|
549
|
+
MessageRepliesCountButton: K = os,
|
|
550
|
+
MessageStatus: ee = is,
|
|
551
|
+
MessageTimestamp: ae = Te,
|
|
552
|
+
ReminderNotification: O = cs,
|
|
553
|
+
StreamedMessageText: G = ds,
|
|
554
|
+
PinIndicator: Z
|
|
555
|
+
} = Ke("CustomMessage"), k = ms(o), T = us(o), U = pe(
|
|
556
|
+
() => p == null ? void 0 : p(o),
|
|
557
|
+
[p, o]
|
|
558
|
+
), B = pe(
|
|
559
559
|
() => !o.shared_location && !o.attachments ? [] : o.shared_location ? [o.shared_location, ...o.attachments ?? []] : o.attachments,
|
|
560
560
|
[o]
|
|
561
561
|
);
|
|
562
|
-
if (
|
|
562
|
+
if (hs(o))
|
|
563
563
|
return null;
|
|
564
564
|
if (o.deleted_at || o.type === "deleted")
|
|
565
|
-
return /* @__PURE__ */ e(
|
|
566
|
-
if (
|
|
567
|
-
return /* @__PURE__ */ e(
|
|
568
|
-
const se = !c || r,
|
|
569
|
-
let
|
|
570
|
-
|
|
571
|
-
const
|
|
565
|
+
return /* @__PURE__ */ e(Q, { message: o });
|
|
566
|
+
if (fs(o))
|
|
567
|
+
return /* @__PURE__ */ e(z, {});
|
|
568
|
+
const se = !c || r, oe = !m && !!o.reply_count, Y = !m && o.show_in_channel && o.parent_id, H = o.status === "failed" && ((de = o.error) == null ? void 0 : de.status) !== 403, ie = gs(o), le = xs(o) && !U;
|
|
569
|
+
let V;
|
|
570
|
+
H ? V = () => h(o) : ie ? V = () => _(!0) : le && (V = () => C((w) => !w));
|
|
571
|
+
const te = R(
|
|
572
572
|
"str-chat__message str-chat__message-simple",
|
|
573
573
|
`str-chat__message--${o.type}`,
|
|
574
574
|
`str-chat__message--${o.status}`,
|
|
575
575
|
f() ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
576
576
|
o.text ? "str-chat__message--has-text" : "has-no-text",
|
|
577
577
|
{
|
|
578
|
-
"str-chat__message--has-attachment":
|
|
578
|
+
"str-chat__message--has-attachment": k,
|
|
579
579
|
"str-chat__message--highlighted": x,
|
|
580
580
|
"str-chat__message--pinned pinned-message": o.pinned,
|
|
581
|
-
"str-chat__message--with-reactions":
|
|
582
|
-
"str-chat__message-send-can-be-retried": (o == null ? void 0 : o.status) === "failed" && ((
|
|
583
|
-
"str-chat__message-with-thread-link":
|
|
581
|
+
"str-chat__message--with-reactions": T,
|
|
582
|
+
"str-chat__message-send-can-be-retried": (o == null ? void 0 : o.status) === "failed" && ((J = o == null ? void 0 : o.error) == null ? void 0 : J.status) !== 403,
|
|
583
|
+
"str-chat__message-with-thread-link": oe || Y,
|
|
584
584
|
"str-chat__virtual-message__wrapper--end": r,
|
|
585
585
|
"str-chat__virtual-message__wrapper--first": l,
|
|
586
586
|
"str-chat__virtual-message__wrapper--group": c
|
|
587
587
|
}
|
|
588
|
-
),
|
|
589
|
-
return /* @__PURE__ */ i(
|
|
588
|
+
), ce = o.poll_id && b.polls.fromState(o.poll_id), xe = Ys(o);
|
|
589
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
590
590
|
n && /* @__PURE__ */ e(
|
|
591
591
|
j,
|
|
592
592
|
{
|
|
593
593
|
additionalMessageInputProps: s
|
|
594
594
|
}
|
|
595
595
|
),
|
|
596
|
-
|
|
597
|
-
|
|
596
|
+
y && /* @__PURE__ */ e(
|
|
597
|
+
Cs,
|
|
598
598
|
{
|
|
599
|
-
MessageBouncePrompt:
|
|
600
|
-
onClose: () =>
|
|
601
|
-
open:
|
|
599
|
+
MessageBouncePrompt: re,
|
|
600
|
+
onClose: () => _(!1),
|
|
601
|
+
open: y
|
|
602
602
|
}
|
|
603
603
|
),
|
|
604
|
-
/* @__PURE__ */ i("div", { className:
|
|
605
|
-
|
|
606
|
-
!!d && /* @__PURE__ */ e(
|
|
604
|
+
/* @__PURE__ */ i("div", { className: te, children: [
|
|
605
|
+
Z && /* @__PURE__ */ e(Z, {}),
|
|
606
|
+
!!d && /* @__PURE__ */ e(O, { reminder: d }),
|
|
607
607
|
o.user && /* @__PURE__ */ e(
|
|
608
|
-
|
|
608
|
+
P,
|
|
609
609
|
{
|
|
610
610
|
image: o.user.image,
|
|
611
611
|
name: o.user.name || o.user.id,
|
|
612
|
-
onClick:
|
|
613
|
-
onMouseOver:
|
|
612
|
+
onClick: M,
|
|
613
|
+
onMouseOver: S,
|
|
614
614
|
user: o.user
|
|
615
615
|
}
|
|
616
616
|
),
|
|
617
617
|
/* @__PURE__ */ e(
|
|
618
618
|
"div",
|
|
619
619
|
{
|
|
620
|
-
className:
|
|
621
|
-
"str-chat__simple-message--error-failed":
|
|
620
|
+
className: R("str-chat__message-inner", {
|
|
621
|
+
"str-chat__simple-message--error-failed": H || ie
|
|
622
622
|
}),
|
|
623
623
|
"data-testid": "message-inner",
|
|
624
|
-
onClick:
|
|
625
|
-
onKeyDown:
|
|
626
|
-
role:
|
|
627
|
-
tabIndex:
|
|
624
|
+
onClick: V,
|
|
625
|
+
onKeyDown: V,
|
|
626
|
+
role: V ? "button" : void 0,
|
|
627
|
+
tabIndex: V ? 0 : void 0,
|
|
628
628
|
style: {
|
|
629
629
|
// Force margins to 0 to prevent hover layout shift
|
|
630
630
|
// Stream Chat CSS sets margin-inline-end/start to 78px, then 0 on hover
|
|
631
631
|
marginInlineEnd: 0,
|
|
632
632
|
marginInlineStart: 0
|
|
633
633
|
},
|
|
634
|
-
children:
|
|
634
|
+
children: xe ? (
|
|
635
635
|
/* Tip-only messages render as a standalone bubble */
|
|
636
|
-
/* @__PURE__ */ e(
|
|
636
|
+
/* @__PURE__ */ e(Re, { message: o, standalone: !0 })
|
|
637
637
|
) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
638
638
|
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
639
|
-
|
|
640
|
-
|
|
639
|
+
ce && /* @__PURE__ */ e(bs, { poll: ce }),
|
|
640
|
+
B != null && B.length && !o.quoted_message ? /* @__PURE__ */ e(
|
|
641
641
|
N,
|
|
642
642
|
{
|
|
643
643
|
actionHandler: a,
|
|
644
|
-
attachments:
|
|
644
|
+
attachments: B
|
|
645
645
|
}
|
|
646
646
|
) : null,
|
|
647
|
-
|
|
648
|
-
|
|
647
|
+
U ? /* @__PURE__ */ e(
|
|
648
|
+
G,
|
|
649
649
|
{
|
|
650
650
|
message: o,
|
|
651
|
-
renderText:
|
|
651
|
+
renderText: g
|
|
652
652
|
}
|
|
653
|
-
) : /* @__PURE__ */ e(
|
|
654
|
-
/* @__PURE__ */ e(
|
|
653
|
+
) : /* @__PURE__ */ e(Ns, { message: o, renderText: g }),
|
|
654
|
+
/* @__PURE__ */ e(vs, {})
|
|
655
655
|
] }),
|
|
656
|
-
/* @__PURE__ */ e(
|
|
656
|
+
/* @__PURE__ */ e(Re, { message: o })
|
|
657
657
|
] })
|
|
658
658
|
}
|
|
659
659
|
),
|
|
660
|
-
|
|
661
|
-
|
|
660
|
+
oe && /* @__PURE__ */ e(
|
|
661
|
+
K,
|
|
662
662
|
{
|
|
663
663
|
onClick: u,
|
|
664
664
|
reply_count: o.reply_count
|
|
665
665
|
}
|
|
666
666
|
),
|
|
667
|
-
|
|
667
|
+
Y && /* @__PURE__ */ e(X, {}),
|
|
668
668
|
se && /* @__PURE__ */ i("div", { className: "str-chat__message-metadata", children: [
|
|
669
|
-
/* @__PURE__ */ e(
|
|
669
|
+
/* @__PURE__ */ e(ee, {}),
|
|
670
670
|
!f() && !!o.user && /* @__PURE__ */ e("span", { className: "str-chat__message-simple-name", children: o.user.name || o.user.id }),
|
|
671
|
-
/* @__PURE__ */ e(
|
|
672
|
-
|
|
673
|
-
|
|
671
|
+
/* @__PURE__ */ e(ae, { customClass: "str-chat__message-simple-timestamp" }),
|
|
672
|
+
le && /* @__PURE__ */ e("span", { className: "str-chat__mesage-simple-edited", children: v("Edited") }),
|
|
673
|
+
le && /* @__PURE__ */ e(ws, { calendar: !0, open: E })
|
|
674
674
|
] })
|
|
675
675
|
] }, o.id)
|
|
676
676
|
] });
|
|
677
|
-
},
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
),
|
|
681
|
-
const s =
|
|
682
|
-
return /* @__PURE__ */ e(
|
|
683
|
-
},
|
|
677
|
+
}, Xs = L.memo(
|
|
678
|
+
Qs,
|
|
679
|
+
Ye
|
|
680
|
+
), Ks = (t) => {
|
|
681
|
+
const s = ps("CustomMessage");
|
|
682
|
+
return /* @__PURE__ */ e(Xs, { ...s, ...t });
|
|
683
|
+
}, et = (t) => ({
|
|
684
684
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
685
|
-
(s) =>
|
|
685
|
+
(s) => Me.previewIsLoaded(s) || Me.previewIsLoading(s)
|
|
686
686
|
)
|
|
687
|
-
}),
|
|
687
|
+
}), st = ({
|
|
688
688
|
link: t,
|
|
689
689
|
onDismiss: s
|
|
690
690
|
}) => {
|
|
@@ -714,7 +714,7 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
|
|
|
714
714
|
},
|
|
715
715
|
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",
|
|
716
716
|
"aria-label": "Close link preview",
|
|
717
|
-
children: /* @__PURE__ */ e(
|
|
717
|
+
children: /* @__PURE__ */ e(ve, { className: "size-4 text-black/90" })
|
|
718
718
|
}
|
|
719
719
|
),
|
|
720
720
|
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
@@ -724,32 +724,32 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
|
|
|
724
724
|
]
|
|
725
725
|
}
|
|
726
726
|
);
|
|
727
|
-
},
|
|
728
|
-
const { linkPreviewsManager: t } =
|
|
727
|
+
}, tt = () => {
|
|
728
|
+
const { linkPreviewsManager: t } = ys(), { linkPreviews: s } = Es(
|
|
729
729
|
t.state,
|
|
730
|
-
|
|
730
|
+
et
|
|
731
731
|
), n = (l) => {
|
|
732
732
|
t.dismissPreview(l);
|
|
733
733
|
};
|
|
734
734
|
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((l) => /* @__PURE__ */ e(
|
|
735
|
-
|
|
735
|
+
st,
|
|
736
736
|
{
|
|
737
737
|
link: l,
|
|
738
738
|
onDismiss: n
|
|
739
739
|
},
|
|
740
740
|
l.og_scrape_url
|
|
741
741
|
)) }) : null;
|
|
742
|
-
},
|
|
743
|
-
const { handleSubmit: t } =
|
|
744
|
-
return /* @__PURE__ */ i(
|
|
745
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
742
|
+
}, nt = () => {
|
|
743
|
+
const { handleSubmit: t } = Ss(), s = _s();
|
|
744
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
745
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ms, {}) }),
|
|
746
746
|
/* @__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: [
|
|
747
|
-
/* @__PURE__ */ e(Ms, {}),
|
|
748
|
-
/* @__PURE__ */ e(st, {}),
|
|
749
747
|
/* @__PURE__ */ e(ks, {}),
|
|
748
|
+
/* @__PURE__ */ e(tt, {}),
|
|
749
|
+
/* @__PURE__ */ e(Rs, {}),
|
|
750
750
|
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
751
751
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
752
|
-
|
|
752
|
+
Ts,
|
|
753
753
|
{
|
|
754
754
|
className: "w-full resize-none outline-none leading-6",
|
|
755
755
|
autoFocus: !0,
|
|
@@ -765,18 +765,18 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
|
|
|
765
765
|
disabled: !s,
|
|
766
766
|
onClick: t,
|
|
767
767
|
type: "button",
|
|
768
|
-
children: /* @__PURE__ */ e(
|
|
768
|
+
children: /* @__PURE__ */ e(Us, { className: "size-4" })
|
|
769
769
|
}
|
|
770
770
|
)
|
|
771
771
|
] })
|
|
772
772
|
] })
|
|
773
773
|
] });
|
|
774
|
-
},
|
|
774
|
+
}, rt = ({
|
|
775
775
|
renderActions: t
|
|
776
776
|
}) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
777
777
|
t && (t == null ? void 0 : t()),
|
|
778
|
-
/* @__PURE__ */ e(
|
|
779
|
-
] }),
|
|
778
|
+
/* @__PURE__ */ e(Is, { Input: nt })
|
|
779
|
+
] }), at = (t) => {
|
|
780
780
|
const s = t.message.hide_date === !0;
|
|
781
781
|
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
782
782
|
/* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
|
|
@@ -784,12 +784,12 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
|
|
|
784
784
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
785
785
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
786
786
|
] }),
|
|
787
|
-
!s && /* @__PURE__ */ e(
|
|
787
|
+
!s && /* @__PURE__ */ e(Te, { message: t.message })
|
|
788
788
|
] });
|
|
789
|
-
},
|
|
789
|
+
}, lt = () => null, ot = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
790
790
|
"div",
|
|
791
791
|
{
|
|
792
|
-
className:
|
|
792
|
+
className: R("flex items-center justify-center h-full", t),
|
|
793
793
|
children: [
|
|
794
794
|
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
795
795
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
@@ -829,33 +829,40 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
|
|
|
829
829
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
830
830
|
]
|
|
831
831
|
}
|
|
832
|
-
),
|
|
833
|
-
/* @__PURE__ */ e(
|
|
832
|
+
), fe = L.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
833
|
+
/* @__PURE__ */ e(ot, { className: "w-6 h-6" }),
|
|
834
834
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
835
835
|
] }) }));
|
|
836
|
-
|
|
837
|
-
const
|
|
838
|
-
var f, o,
|
|
839
|
-
const { channel: l } =
|
|
840
|
-
(
|
|
841
|
-
var
|
|
842
|
-
return ((
|
|
836
|
+
fe.displayName = "LoadingState";
|
|
837
|
+
const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
838
|
+
var f, o, M, S, g, m;
|
|
839
|
+
const { channel: l } = De(), c = L.useMemo(() => Object.values(l.state.members || {}).find(
|
|
840
|
+
(v) => {
|
|
841
|
+
var y;
|
|
842
|
+
return ((y = v.user) == null ? void 0 : y.id) && v.user.id !== l._client.userID;
|
|
843
843
|
}
|
|
844
|
-
), [l._client.userID, l.state.members]), a = ((f = c == null ? void 0 : c.user) == null ? void 0 : f.name) || ((o = c == null ? void 0 : c.user) == null ? void 0 : o.id) || "Unknown member", u = (
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
844
|
+
), [l._client.userID, l.state.members]), a = ((f = c == null ? void 0 : c.user) == null ? void 0 : f.name) || ((o = c == null ? void 0 : c.user) == null ? void 0 : o.id) || "Unknown member", u = (M = c == null ? void 0 : c.user) == null ? void 0 : M.image, [h, x] = I(
|
|
845
|
+
!!((S = l.state.membership) != null && S.pinned_at)
|
|
846
|
+
);
|
|
847
|
+
q(() => {
|
|
848
|
+
const b = (v) => {
|
|
849
|
+
var y;
|
|
850
|
+
x(
|
|
851
|
+
v != null && v.member ? !!v.member.pinned_at : !!((y = l.state.membership) != null && y.pinned_at)
|
|
852
|
+
);
|
|
849
853
|
};
|
|
850
|
-
return l.on("member.updated",
|
|
851
|
-
l.off("member.updated",
|
|
854
|
+
return l.on("member.updated", b), () => {
|
|
855
|
+
l.off("member.updated", b);
|
|
852
856
|
};
|
|
853
857
|
}, [l]);
|
|
854
|
-
const
|
|
858
|
+
const p = async () => {
|
|
855
859
|
try {
|
|
856
860
|
h ? await l.unpin() : await l.pin();
|
|
857
|
-
} catch (
|
|
858
|
-
console.error(
|
|
861
|
+
} catch (b) {
|
|
862
|
+
console.error(
|
|
863
|
+
"[CustomChannelHeader] Failed to update pinned status:",
|
|
864
|
+
b
|
|
865
|
+
);
|
|
859
866
|
}
|
|
860
867
|
};
|
|
861
868
|
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
@@ -864,7 +871,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
864
871
|
/* @__PURE__ */ e(
|
|
865
872
|
"button",
|
|
866
873
|
{
|
|
867
|
-
className:
|
|
874
|
+
className: R(
|
|
868
875
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
869
876
|
!s && "invisible"
|
|
870
877
|
),
|
|
@@ -872,16 +879,16 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
872
879
|
}),
|
|
873
880
|
type: "button",
|
|
874
881
|
"aria-label": "Back to conversations",
|
|
875
|
-
children: /* @__PURE__ */ e(
|
|
882
|
+
children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
|
|
876
883
|
}
|
|
877
884
|
),
|
|
878
885
|
/* @__PURE__ */ e("div", { className: "size-10" })
|
|
879
886
|
] }),
|
|
880
887
|
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
881
888
|
/* @__PURE__ */ e(
|
|
882
|
-
|
|
889
|
+
ne,
|
|
883
890
|
{
|
|
884
|
-
id: ((
|
|
891
|
+
id: ((g = c == null ? void 0 : c.user) == null ? void 0 : g.id) || l.id || "unknown",
|
|
885
892
|
name: a,
|
|
886
893
|
image: u,
|
|
887
894
|
size: 40
|
|
@@ -894,11 +901,11 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
894
901
|
"button",
|
|
895
902
|
{
|
|
896
903
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
897
|
-
onClick:
|
|
904
|
+
onClick: p,
|
|
898
905
|
type: "button",
|
|
899
906
|
"aria-label": h ? "Unstar conversation" : "Star conversation",
|
|
900
907
|
children: /* @__PURE__ */ e(
|
|
901
|
-
|
|
908
|
+
Ee,
|
|
902
909
|
{
|
|
903
910
|
className: "size-5 text-black/90",
|
|
904
911
|
weight: h ? "fill" : "regular"
|
|
@@ -913,7 +920,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
913
920
|
onClick: n,
|
|
914
921
|
type: "button",
|
|
915
922
|
"aria-label": "Show info",
|
|
916
|
-
children: /* @__PURE__ */ e(
|
|
923
|
+
children: /* @__PURE__ */ e(Ie, { className: "size-5 text-black/90" })
|
|
917
924
|
}
|
|
918
925
|
)
|
|
919
926
|
] })
|
|
@@ -927,13 +934,13 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
927
934
|
onClick: t,
|
|
928
935
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
929
936
|
"aria-label": "Back to conversations",
|
|
930
|
-
children: /* @__PURE__ */ e(
|
|
937
|
+
children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
|
|
931
938
|
}
|
|
932
939
|
),
|
|
933
940
|
/* @__PURE__ */ e(
|
|
934
|
-
|
|
941
|
+
ne,
|
|
935
942
|
{
|
|
936
|
-
id: ((
|
|
943
|
+
id: ((m = c == null ? void 0 : c.user) == null ? void 0 : m.id) || l.id || "unknown",
|
|
937
944
|
name: a,
|
|
938
945
|
image: u,
|
|
939
946
|
size: 40
|
|
@@ -946,11 +953,11 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
946
953
|
"button",
|
|
947
954
|
{
|
|
948
955
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
949
|
-
onClick:
|
|
956
|
+
onClick: p,
|
|
950
957
|
type: "button",
|
|
951
958
|
"aria-label": h ? "Unstar conversation" : "Star conversation",
|
|
952
959
|
children: /* @__PURE__ */ e(
|
|
953
|
-
|
|
960
|
+
Ee,
|
|
954
961
|
{
|
|
955
962
|
className: "size-5 text-black/90",
|
|
956
963
|
weight: h ? "fill" : "regular"
|
|
@@ -965,13 +972,13 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
965
972
|
onClick: n,
|
|
966
973
|
type: "button",
|
|
967
974
|
"aria-label": "Show info",
|
|
968
|
-
children: /* @__PURE__ */ e(
|
|
975
|
+
children: /* @__PURE__ */ e(Ie, { className: "size-5 text-black/90" })
|
|
969
976
|
}
|
|
970
977
|
)
|
|
971
978
|
] })
|
|
972
979
|
] })
|
|
973
980
|
] });
|
|
974
|
-
},
|
|
981
|
+
}, ct = ({
|
|
975
982
|
dialogRef: t,
|
|
976
983
|
onClose: s,
|
|
977
984
|
participant: n,
|
|
@@ -982,76 +989,76 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
982
989
|
showDeleteConversation: u = !0,
|
|
983
990
|
onDeleteConversationClick: h,
|
|
984
991
|
onBlockParticipantClick: x,
|
|
985
|
-
onReportParticipantClick:
|
|
992
|
+
onReportParticipantClick: p
|
|
986
993
|
}) => {
|
|
987
|
-
var K, ee,
|
|
988
|
-
const { service: f, debug: o } =
|
|
989
|
-
var
|
|
990
|
-
if (!(!f || !((
|
|
994
|
+
var X, K, ee, ae, O, G, Z;
|
|
995
|
+
const { service: f, debug: o } = ge(), [M, S] = I(!1), [g, m] = I(!1), [b, v] = I(!1), y = D(async () => {
|
|
996
|
+
var k;
|
|
997
|
+
if (!(!f || !((k = n == null ? void 0 : n.user) != null && k.id)))
|
|
991
998
|
try {
|
|
992
|
-
const
|
|
993
|
-
(
|
|
999
|
+
const U = (await f.getBlockedUsers()).some(
|
|
1000
|
+
(B) => {
|
|
994
1001
|
var se;
|
|
995
|
-
return
|
|
1002
|
+
return B.blocked_user_id === ((se = n == null ? void 0 : n.user) == null ? void 0 : se.id);
|
|
996
1003
|
}
|
|
997
1004
|
);
|
|
998
|
-
|
|
999
|
-
} catch (
|
|
1005
|
+
S(U);
|
|
1006
|
+
} catch (T) {
|
|
1000
1007
|
console.error(
|
|
1001
1008
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
1002
|
-
|
|
1009
|
+
T
|
|
1003
1010
|
);
|
|
1004
1011
|
}
|
|
1005
|
-
}, [f, (
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
}, [
|
|
1009
|
-
const
|
|
1010
|
-
var
|
|
1011
|
-
if (!
|
|
1012
|
-
h == null || h(), o && console.log("[ChannelInfoDialog] Leave conversation", r.cid),
|
|
1012
|
+
}, [f, (X = n == null ? void 0 : n.user) == null ? void 0 : X.id]);
|
|
1013
|
+
q(() => {
|
|
1014
|
+
y();
|
|
1015
|
+
}, [y]);
|
|
1016
|
+
const _ = async () => {
|
|
1017
|
+
var k;
|
|
1018
|
+
if (!g) {
|
|
1019
|
+
h == null || h(), o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), m(!0);
|
|
1013
1020
|
try {
|
|
1014
|
-
const
|
|
1015
|
-
await r.hide(
|
|
1016
|
-
} catch (
|
|
1017
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
1021
|
+
const T = ((k = r._client) == null ? void 0 : k.userID) ?? null;
|
|
1022
|
+
await r.hide(T, !1), c && await c(r), s();
|
|
1023
|
+
} catch (T) {
|
|
1024
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", T);
|
|
1018
1025
|
} finally {
|
|
1019
|
-
|
|
1026
|
+
m(!1);
|
|
1020
1027
|
}
|
|
1021
1028
|
}
|
|
1022
|
-
},
|
|
1023
|
-
var
|
|
1024
|
-
if (!(
|
|
1025
|
-
x == null || x(), o && console.log("[ChannelInfoDialog] Block member", (
|
|
1029
|
+
}, E = async () => {
|
|
1030
|
+
var k, T, U;
|
|
1031
|
+
if (!(b || !f)) {
|
|
1032
|
+
x == null || x(), o && console.log("[ChannelInfoDialog] Block member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), v(!0);
|
|
1026
1033
|
try {
|
|
1027
|
-
await f.blockUser((
|
|
1028
|
-
} catch (
|
|
1029
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
1034
|
+
await f.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), a && await a((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
1035
|
+
} catch (B) {
|
|
1036
|
+
console.error("[ChannelInfoDialog] Failed to block member", B);
|
|
1030
1037
|
} finally {
|
|
1031
|
-
|
|
1038
|
+
v(!1);
|
|
1032
1039
|
}
|
|
1033
1040
|
}
|
|
1034
|
-
},
|
|
1035
|
-
var
|
|
1036
|
-
if (!(
|
|
1037
|
-
x == null || x(), o && console.log("[ChannelInfoDialog] Unblock member", (
|
|
1041
|
+
}, C = async () => {
|
|
1042
|
+
var k, T, U;
|
|
1043
|
+
if (!(b || !f)) {
|
|
1044
|
+
x == null || x(), o && console.log("[ChannelInfoDialog] Unblock member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), v(!0);
|
|
1038
1045
|
try {
|
|
1039
|
-
await f.unBlockUser((
|
|
1040
|
-
} catch (
|
|
1041
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
1046
|
+
await f.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), a && await a((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
1047
|
+
} catch (B) {
|
|
1048
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", B);
|
|
1042
1049
|
} finally {
|
|
1043
|
-
|
|
1050
|
+
v(!1);
|
|
1044
1051
|
}
|
|
1045
1052
|
}
|
|
1046
1053
|
}, d = () => {
|
|
1047
|
-
|
|
1054
|
+
p == null || p(), s(), window.open(
|
|
1048
1055
|
"https://linktr.ee/s/about/trust-center/report",
|
|
1049
1056
|
"_blank",
|
|
1050
1057
|
"noopener,noreferrer"
|
|
1051
1058
|
);
|
|
1052
1059
|
};
|
|
1053
1060
|
if (!n) return null;
|
|
1054
|
-
const N = ((
|
|
1061
|
+
const N = ((K = n.user) == null ? void 0 : K.name) || ((ee = n.user) == null ? void 0 : ee.id) || "Unknown member", P = (ae = n.user) == null ? void 0 : ae.image, j = (O = n.user) == null ? void 0 : O.email, z = (G = n.user) == null ? void 0 : G.username, re = j || (z ? `linktr.ee/${z}` : void 0), Q = ((Z = n.user) == null ? void 0 : Z.id) || "unknown";
|
|
1055
1062
|
return (
|
|
1056
1063
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1057
1064
|
/* @__PURE__ */ e(
|
|
@@ -1060,13 +1067,13 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1060
1067
|
ref: t,
|
|
1061
1068
|
className: "mes-dialog group",
|
|
1062
1069
|
onClose: s,
|
|
1063
|
-
onClick: (
|
|
1064
|
-
|
|
1070
|
+
onClick: (k) => {
|
|
1071
|
+
k.target === t.current && s();
|
|
1065
1072
|
},
|
|
1066
1073
|
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: [
|
|
1067
1074
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
1068
1075
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
1069
|
-
/* @__PURE__ */ e(
|
|
1076
|
+
/* @__PURE__ */ e(Ae, { onClick: s })
|
|
1070
1077
|
] }),
|
|
1071
1078
|
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
1072
1079
|
/* @__PURE__ */ e(
|
|
@@ -1076,18 +1083,18 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1076
1083
|
style: { backgroundColor: "#FBFAF9" },
|
|
1077
1084
|
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
1078
1085
|
/* @__PURE__ */ e(
|
|
1079
|
-
|
|
1086
|
+
ne,
|
|
1080
1087
|
{
|
|
1081
|
-
id:
|
|
1088
|
+
id: Q,
|
|
1082
1089
|
name: N,
|
|
1083
|
-
image:
|
|
1090
|
+
image: P,
|
|
1084
1091
|
size: 88,
|
|
1085
1092
|
shape: "circle"
|
|
1086
1093
|
}
|
|
1087
1094
|
),
|
|
1088
1095
|
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
1089
1096
|
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: N }),
|
|
1090
|
-
|
|
1097
|
+
re && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: re }),
|
|
1091
1098
|
l && /* @__PURE__ */ e(
|
|
1092
1099
|
"span",
|
|
1093
1100
|
{
|
|
@@ -1108,42 +1115,42 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1108
1115
|
),
|
|
1109
1116
|
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
1110
1117
|
u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1111
|
-
|
|
1118
|
+
me,
|
|
1112
1119
|
{
|
|
1113
|
-
onClick:
|
|
1114
|
-
disabled:
|
|
1115
|
-
"aria-busy":
|
|
1120
|
+
onClick: _,
|
|
1121
|
+
disabled: g,
|
|
1122
|
+
"aria-busy": g,
|
|
1116
1123
|
children: [
|
|
1117
|
-
|
|
1124
|
+
g ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Bs, { className: "h-5 w-5" }),
|
|
1118
1125
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
1119
1126
|
]
|
|
1120
1127
|
}
|
|
1121
1128
|
) }),
|
|
1122
|
-
/* @__PURE__ */ e("li", { children:
|
|
1123
|
-
|
|
1129
|
+
/* @__PURE__ */ e("li", { children: M ? /* @__PURE__ */ i(
|
|
1130
|
+
me,
|
|
1124
1131
|
{
|
|
1125
|
-
onClick:
|
|
1126
|
-
disabled:
|
|
1127
|
-
"aria-busy":
|
|
1132
|
+
onClick: C,
|
|
1133
|
+
disabled: b,
|
|
1134
|
+
"aria-busy": b,
|
|
1128
1135
|
children: [
|
|
1129
|
-
|
|
1136
|
+
b ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Se, { className: "h-5 w-5" }),
|
|
1130
1137
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
1131
1138
|
]
|
|
1132
1139
|
}
|
|
1133
1140
|
) : /* @__PURE__ */ i(
|
|
1134
|
-
|
|
1141
|
+
me,
|
|
1135
1142
|
{
|
|
1136
|
-
onClick:
|
|
1137
|
-
disabled:
|
|
1138
|
-
"aria-busy":
|
|
1143
|
+
onClick: E,
|
|
1144
|
+
disabled: b,
|
|
1145
|
+
"aria-busy": b,
|
|
1139
1146
|
children: [
|
|
1140
|
-
|
|
1147
|
+
b ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Se, { className: "h-5 w-5" }),
|
|
1141
1148
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
1142
1149
|
]
|
|
1143
1150
|
}
|
|
1144
1151
|
) }),
|
|
1145
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1146
|
-
/* @__PURE__ */ e(
|
|
1152
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(me, { variant: "danger", onClick: d, children: [
|
|
1153
|
+
/* @__PURE__ */ e(As, { className: "h-5 w-5" }),
|
|
1147
1154
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
1148
1155
|
] }) })
|
|
1149
1156
|
] })
|
|
@@ -1152,7 +1159,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1152
1159
|
}
|
|
1153
1160
|
)
|
|
1154
1161
|
);
|
|
1155
|
-
},
|
|
1162
|
+
}, dt = ({
|
|
1156
1163
|
onBack: t,
|
|
1157
1164
|
showBackButton: s,
|
|
1158
1165
|
renderMessageInputActions: n,
|
|
@@ -1163,43 +1170,43 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1163
1170
|
onBlockParticipantClick: u,
|
|
1164
1171
|
onReportParticipantClick: h
|
|
1165
1172
|
}) => {
|
|
1166
|
-
const { channel: x } =
|
|
1167
|
-
(
|
|
1168
|
-
var
|
|
1169
|
-
return ((
|
|
1173
|
+
const { channel: x } = De(), p = W(null), f = L.useMemo(() => Object.values(x.state.members || {}).find(
|
|
1174
|
+
(m) => {
|
|
1175
|
+
var b;
|
|
1176
|
+
return ((b = m.user) == null ? void 0 : b.id) && m.user.id !== x._client.userID;
|
|
1170
1177
|
}
|
|
1171
|
-
), [x._client.userID, x.state.members]), o =
|
|
1172
|
-
const
|
|
1173
|
-
if (
|
|
1174
|
-
return String(
|
|
1175
|
-
if (
|
|
1176
|
-
return
|
|
1177
|
-
}, [x.data]),
|
|
1178
|
-
var
|
|
1179
|
-
(
|
|
1180
|
-
}, []),
|
|
1181
|
-
var
|
|
1182
|
-
(
|
|
1178
|
+
), [x._client.userID, x.state.members]), o = L.useMemo(() => {
|
|
1179
|
+
const g = x.data ?? {};
|
|
1180
|
+
if (g.followerStatus)
|
|
1181
|
+
return String(g.followerStatus);
|
|
1182
|
+
if (g.isFollower !== void 0)
|
|
1183
|
+
return g.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1184
|
+
}, [x.data]), M = D(() => {
|
|
1185
|
+
var g;
|
|
1186
|
+
(g = p.current) == null || g.showModal();
|
|
1187
|
+
}, []), S = D(() => {
|
|
1188
|
+
var g;
|
|
1189
|
+
(g = p.current) == null || g.close();
|
|
1183
1190
|
}, []);
|
|
1184
|
-
return /* @__PURE__ */ i(
|
|
1191
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
1185
1192
|
/* @__PURE__ */ e(
|
|
1186
|
-
|
|
1193
|
+
Fs,
|
|
1187
1194
|
{
|
|
1188
1195
|
overrides: {
|
|
1189
|
-
Message: (
|
|
1196
|
+
Message: (g) => /* @__PURE__ */ e(Ks, { ...g })
|
|
1190
1197
|
},
|
|
1191
|
-
children: /* @__PURE__ */ i(
|
|
1198
|
+
children: /* @__PURE__ */ i(Ls, { children: [
|
|
1192
1199
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
1193
|
-
|
|
1200
|
+
it,
|
|
1194
1201
|
{
|
|
1195
1202
|
onBack: t,
|
|
1196
1203
|
showBackButton: s,
|
|
1197
|
-
onShowInfo:
|
|
1204
|
+
onShowInfo: M,
|
|
1198
1205
|
canShowInfo: !!f
|
|
1199
1206
|
}
|
|
1200
1207
|
) }),
|
|
1201
1208
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1202
|
-
|
|
1209
|
+
Ps,
|
|
1203
1210
|
{
|
|
1204
1211
|
hideDeletedMessages: !0,
|
|
1205
1212
|
hideNewMessageSeparator: !1,
|
|
@@ -1207,7 +1214,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1207
1214
|
}
|
|
1208
1215
|
) }),
|
|
1209
1216
|
/* @__PURE__ */ e(
|
|
1210
|
-
|
|
1217
|
+
rt,
|
|
1211
1218
|
{
|
|
1212
1219
|
renderActions: () => n == null ? void 0 : n(x)
|
|
1213
1220
|
}
|
|
@@ -1216,10 +1223,10 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1216
1223
|
}
|
|
1217
1224
|
),
|
|
1218
1225
|
/* @__PURE__ */ e(
|
|
1219
|
-
|
|
1226
|
+
ct,
|
|
1220
1227
|
{
|
|
1221
|
-
dialogRef:
|
|
1222
|
-
onClose:
|
|
1228
|
+
dialogRef: p,
|
|
1229
|
+
onClose: S,
|
|
1223
1230
|
participant: f,
|
|
1224
1231
|
channel: x,
|
|
1225
1232
|
followerStatusLabel: o,
|
|
@@ -1232,7 +1239,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1232
1239
|
}
|
|
1233
1240
|
)
|
|
1234
1241
|
] });
|
|
1235
|
-
},
|
|
1242
|
+
}, je = L.memo(
|
|
1236
1243
|
({
|
|
1237
1244
|
channel: t,
|
|
1238
1245
|
onBack: s,
|
|
@@ -1241,48 +1248,63 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1241
1248
|
onLeaveConversation: l,
|
|
1242
1249
|
onBlockParticipant: c,
|
|
1243
1250
|
className: a,
|
|
1244
|
-
CustomChannelEmptyState: u =
|
|
1251
|
+
CustomChannelEmptyState: u = lt,
|
|
1245
1252
|
showDeleteConversation: h = !0,
|
|
1246
1253
|
onDeleteConversationClick: x,
|
|
1247
|
-
onBlockParticipantClick:
|
|
1248
|
-
onReportParticipantClick: f
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1254
|
+
onBlockParticipantClick: p,
|
|
1255
|
+
onReportParticipantClick: f,
|
|
1256
|
+
dmAgentEnabled: o
|
|
1257
|
+
}) => {
|
|
1258
|
+
const M = D(
|
|
1259
|
+
async (S, g, m) => {
|
|
1260
|
+
var y;
|
|
1261
|
+
const b = ((y = t.data) == null ? void 0 : y.chatbot_paused) === !0;
|
|
1262
|
+
return o && !b ? t.sendMessage(
|
|
1263
|
+
{ ...g, silent: !0 },
|
|
1264
|
+
{ ...m, skip_push: !0 }
|
|
1265
|
+
) : t.sendMessage(g, m);
|
|
1266
|
+
},
|
|
1267
|
+
[t, o]
|
|
1268
|
+
);
|
|
1269
|
+
return /* @__PURE__ */ e(
|
|
1270
|
+
"div",
|
|
1271
|
+
{
|
|
1272
|
+
className: R(
|
|
1273
|
+
"messaging-channel-view h-full flex flex-col",
|
|
1274
|
+
a
|
|
1275
|
+
),
|
|
1276
|
+
children: /* @__PURE__ */ e(
|
|
1277
|
+
Ds,
|
|
1278
|
+
{
|
|
1279
|
+
channel: t,
|
|
1280
|
+
MessageSystem: at,
|
|
1281
|
+
EmptyStateIndicator: u,
|
|
1282
|
+
LoadingIndicator: fe,
|
|
1283
|
+
DateSeparator: Js,
|
|
1284
|
+
doSendMessageRequest: M,
|
|
1285
|
+
children: /* @__PURE__ */ e(
|
|
1286
|
+
dt,
|
|
1287
|
+
{
|
|
1288
|
+
onBack: s,
|
|
1289
|
+
showBackButton: n,
|
|
1290
|
+
renderMessageInputActions: r,
|
|
1291
|
+
onLeaveConversation: l,
|
|
1292
|
+
onBlockParticipant: c,
|
|
1293
|
+
CustomChannelEmptyState: u,
|
|
1294
|
+
showDeleteConversation: h,
|
|
1295
|
+
onDeleteConversationClick: x,
|
|
1296
|
+
onBlockParticipantClick: p,
|
|
1297
|
+
onReportParticipantClick: f
|
|
1298
|
+
}
|
|
1299
|
+
)
|
|
1300
|
+
}
|
|
1301
|
+
)
|
|
1302
|
+
}
|
|
1303
|
+
);
|
|
1304
|
+
}
|
|
1283
1305
|
);
|
|
1284
|
-
|
|
1285
|
-
function
|
|
1306
|
+
je.displayName = "ChannelView";
|
|
1307
|
+
function mt({
|
|
1286
1308
|
searchQuery: t,
|
|
1287
1309
|
setSearchQuery: s,
|
|
1288
1310
|
placeholder: n
|
|
@@ -1290,7 +1312,7 @@ function dt({
|
|
|
1290
1312
|
const r = W(null);
|
|
1291
1313
|
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1292
1314
|
/* @__PURE__ */ e(
|
|
1293
|
-
|
|
1315
|
+
js,
|
|
1294
1316
|
{
|
|
1295
1317
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1296
1318
|
weight: "bold"
|
|
@@ -1308,7 +1330,7 @@ function dt({
|
|
|
1308
1330
|
}
|
|
1309
1331
|
),
|
|
1310
1332
|
t && /* @__PURE__ */ e(
|
|
1311
|
-
|
|
1333
|
+
Be,
|
|
1312
1334
|
{
|
|
1313
1335
|
label: "Clear search",
|
|
1314
1336
|
onClick: () => {
|
|
@@ -1316,12 +1338,12 @@ function dt({
|
|
|
1316
1338
|
s(""), (l = r.current) == null || l.focus();
|
|
1317
1339
|
},
|
|
1318
1340
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1319
|
-
children: /* @__PURE__ */ e(
|
|
1341
|
+
children: /* @__PURE__ */ e(ve, { className: "h-4 w-4", weight: "bold" })
|
|
1320
1342
|
}
|
|
1321
1343
|
)
|
|
1322
1344
|
] });
|
|
1323
1345
|
}
|
|
1324
|
-
const
|
|
1346
|
+
const ut = ({
|
|
1325
1347
|
participantSource: t,
|
|
1326
1348
|
onSelectParticipant: s,
|
|
1327
1349
|
onClose: n,
|
|
@@ -1330,73 +1352,73 @@ const mt = ({
|
|
|
1330
1352
|
searchPlaceholder: c = "Search participants...",
|
|
1331
1353
|
className: a
|
|
1332
1354
|
}) => {
|
|
1333
|
-
const { debug: u } =
|
|
1355
|
+
const { debug: u } = ge(), [h, x] = I(""), [p, f] = I([]), [o, M] = I(!1), [S, g] = I(null), [m, b] = I(
|
|
1334
1356
|
null
|
|
1335
|
-
),
|
|
1336
|
-
|
|
1357
|
+
), v = W(!1);
|
|
1358
|
+
q(() => {
|
|
1337
1359
|
if (t.loading) {
|
|
1338
1360
|
u && console.log(
|
|
1339
1361
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1340
1362
|
);
|
|
1341
1363
|
return;
|
|
1342
1364
|
}
|
|
1343
|
-
if (
|
|
1365
|
+
if (v.current) return;
|
|
1344
1366
|
(async () => {
|
|
1345
|
-
u && console.log("[ParticipantPicker] Loading initial participants..."),
|
|
1367
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), g(null);
|
|
1346
1368
|
try {
|
|
1347
1369
|
const d = await t.loadParticipants({
|
|
1348
1370
|
search: "",
|
|
1349
1371
|
// Load all participants initially
|
|
1350
1372
|
limit: 100
|
|
1351
1373
|
});
|
|
1352
|
-
f(d.participants),
|
|
1374
|
+
f(d.participants), v.current = !0, u && console.log(
|
|
1353
1375
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1354
1376
|
d.participants.length
|
|
1355
1377
|
);
|
|
1356
1378
|
} catch (d) {
|
|
1357
1379
|
const N = d instanceof Error ? d.message : "Failed to load participants";
|
|
1358
|
-
|
|
1380
|
+
g(N), console.error("[ParticipantPicker] Failed to load participants:", d);
|
|
1359
1381
|
} finally {
|
|
1360
|
-
|
|
1382
|
+
M(!1);
|
|
1361
1383
|
}
|
|
1362
1384
|
})();
|
|
1363
1385
|
}, [t.loading, u]);
|
|
1364
|
-
const
|
|
1386
|
+
const y = p.filter((C) => !r.has(C.id)).filter((C) => {
|
|
1365
1387
|
var N;
|
|
1366
1388
|
if (!h) return !0;
|
|
1367
1389
|
const d = h.toLowerCase();
|
|
1368
|
-
return
|
|
1369
|
-
}),
|
|
1370
|
-
async (
|
|
1371
|
-
if (!
|
|
1372
|
-
|
|
1390
|
+
return C.name.toLowerCase().includes(d) || ((N = C.email) == null ? void 0 : N.toLowerCase().includes(d)) || !1;
|
|
1391
|
+
}), _ = D(
|
|
1392
|
+
async (C) => {
|
|
1393
|
+
if (!m) {
|
|
1394
|
+
b(C.id);
|
|
1373
1395
|
try {
|
|
1374
|
-
await s(
|
|
1396
|
+
await s(C);
|
|
1375
1397
|
} catch (d) {
|
|
1376
|
-
console.error("[ParticipantPicker] Failed to start chat:", d),
|
|
1398
|
+
console.error("[ParticipantPicker] Failed to start chat:", d), b(null);
|
|
1377
1399
|
}
|
|
1378
1400
|
}
|
|
1379
1401
|
},
|
|
1380
|
-
[s,
|
|
1381
|
-
),
|
|
1382
|
-
(
|
|
1402
|
+
[s, m]
|
|
1403
|
+
), E = (C, d) => {
|
|
1404
|
+
(C.key === "Enter" || C.key === " ") && (C.preventDefault(), _(d));
|
|
1383
1405
|
};
|
|
1384
|
-
return /* @__PURE__ */ i("div", { className:
|
|
1406
|
+
return /* @__PURE__ */ i("div", { className: R("flex flex-col h-full", a), children: [
|
|
1385
1407
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1386
1408
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1387
1409
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1388
|
-
/* @__PURE__ */ e(
|
|
1410
|
+
/* @__PURE__ */ e(Ae, { onClick: n })
|
|
1389
1411
|
] }),
|
|
1390
1412
|
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1391
1413
|
"Select a ",
|
|
1392
1414
|
l.slice(0, -1),
|
|
1393
1415
|
" to start messaging (",
|
|
1394
|
-
|
|
1416
|
+
y.length,
|
|
1395
1417
|
" available)",
|
|
1396
1418
|
t.totalCount !== void 0 && ` • ${t.totalCount} ${l} total`
|
|
1397
1419
|
] }),
|
|
1398
1420
|
/* @__PURE__ */ e(
|
|
1399
|
-
|
|
1421
|
+
mt,
|
|
1400
1422
|
{
|
|
1401
1423
|
searchQuery: h,
|
|
1402
1424
|
setSearchQuery: x,
|
|
@@ -1404,41 +1426,41 @@ const mt = ({
|
|
|
1404
1426
|
}
|
|
1405
1427
|
)
|
|
1406
1428
|
] }),
|
|
1407
|
-
|
|
1429
|
+
S && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1408
1430
|
"Error loading ",
|
|
1409
1431
|
l,
|
|
1410
1432
|
": ",
|
|
1411
|
-
|
|
1433
|
+
S
|
|
1412
1434
|
] }),
|
|
1413
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: o &&
|
|
1435
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: o && y.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: [
|
|
1414
1436
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1415
1437
|
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1416
1438
|
"Loading ",
|
|
1417
1439
|
l,
|
|
1418
1440
|
"..."
|
|
1419
1441
|
] })
|
|
1420
|
-
] }) }) :
|
|
1421
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
1422
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${l} found` :
|
|
1423
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" :
|
|
1442
|
+
] }) }) : y.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1443
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(_e, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1444
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${l} found` : p.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
|
|
1445
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : p.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
|
|
1424
1446
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1425
|
-
|
|
1426
|
-
const d =
|
|
1447
|
+
y.map((C) => {
|
|
1448
|
+
const d = C.name || C.email || C.id, N = C.email && C.name ? C.email : C.phone;
|
|
1427
1449
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1428
1450
|
"button",
|
|
1429
1451
|
{
|
|
1430
1452
|
type: "button",
|
|
1431
|
-
onClick: () =>
|
|
1432
|
-
onKeyDown: (
|
|
1453
|
+
onClick: () => _(C),
|
|
1454
|
+
onKeyDown: (P) => E(P, C),
|
|
1433
1455
|
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",
|
|
1434
1456
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1435
1457
|
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1436
1458
|
/* @__PURE__ */ e(
|
|
1437
|
-
|
|
1459
|
+
ne,
|
|
1438
1460
|
{
|
|
1439
|
-
id:
|
|
1461
|
+
id: C.id,
|
|
1440
1462
|
name: d,
|
|
1441
|
-
image:
|
|
1463
|
+
image: C.image,
|
|
1442
1464
|
size: 40
|
|
1443
1465
|
}
|
|
1444
1466
|
),
|
|
@@ -1447,10 +1469,10 @@ const mt = ({
|
|
|
1447
1469
|
N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
|
|
1448
1470
|
] })
|
|
1449
1471
|
] }),
|
|
1450
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children:
|
|
1472
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: m === C.id ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(_e, { className: "h-5 w-5 text-stone" }) })
|
|
1451
1473
|
] })
|
|
1452
1474
|
}
|
|
1453
|
-
) },
|
|
1475
|
+
) }, C.id);
|
|
1454
1476
|
}),
|
|
1455
1477
|
o && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1456
1478
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
@@ -1458,7 +1480,7 @@ const mt = ({
|
|
|
1458
1480
|
] }) })
|
|
1459
1481
|
] }) })
|
|
1460
1482
|
] });
|
|
1461
|
-
},
|
|
1483
|
+
}, ht = ({ className: t }) => /* @__PURE__ */ i(
|
|
1462
1484
|
"svg",
|
|
1463
1485
|
{
|
|
1464
1486
|
width: "140",
|
|
@@ -1592,17 +1614,17 @@ const mt = ({
|
|
|
1592
1614
|
] })
|
|
1593
1615
|
]
|
|
1594
1616
|
}
|
|
1595
|
-
),
|
|
1617
|
+
), $e = L.memo(
|
|
1596
1618
|
({ 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: [
|
|
1597
|
-
/* @__PURE__ */ e(
|
|
1619
|
+
/* @__PURE__ */ e(ht, {}),
|
|
1598
1620
|
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1599
1621
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1600
1622
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1601
1623
|
] })
|
|
1602
1624
|
] }) })
|
|
1603
1625
|
);
|
|
1604
|
-
|
|
1605
|
-
const
|
|
1626
|
+
$e.displayName = "EmptyState";
|
|
1627
|
+
const he = L.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: [
|
|
1606
1628
|
/* @__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: "⚠️" }) }),
|
|
1607
1629
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1608
1630
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1616,8 +1638,8 @@ const me = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1616
1638
|
}
|
|
1617
1639
|
)
|
|
1618
1640
|
] }) }));
|
|
1619
|
-
|
|
1620
|
-
const
|
|
1641
|
+
he.displayName = "ErrorState";
|
|
1642
|
+
const yt = ({
|
|
1621
1643
|
capabilities: t = {},
|
|
1622
1644
|
className: s,
|
|
1623
1645
|
renderMessageInputActions: n,
|
|
@@ -1628,105 +1650,106 @@ const pt = ({
|
|
|
1628
1650
|
CustomChannelEmptyState: u,
|
|
1629
1651
|
showChannelList: h = !0,
|
|
1630
1652
|
filters: x,
|
|
1631
|
-
channelListCustomEmptyStateIndicator:
|
|
1653
|
+
channelListCustomEmptyStateIndicator: p,
|
|
1632
1654
|
onDeleteConversationClick: f,
|
|
1633
1655
|
onBlockParticipantClick: o,
|
|
1634
|
-
onReportParticipantClick:
|
|
1656
|
+
onReportParticipantClick: M,
|
|
1657
|
+
dmAgentEnabled: S
|
|
1635
1658
|
}) => {
|
|
1636
1659
|
const {
|
|
1637
|
-
service:
|
|
1660
|
+
service: g,
|
|
1638
1661
|
client: m,
|
|
1639
|
-
isConnected:
|
|
1662
|
+
isConnected: b,
|
|
1640
1663
|
isLoading: v,
|
|
1641
|
-
error:
|
|
1642
|
-
refreshConnection:
|
|
1643
|
-
debug:
|
|
1644
|
-
} =
|
|
1645
|
-
participantSource:
|
|
1664
|
+
error: y,
|
|
1665
|
+
refreshConnection: _,
|
|
1666
|
+
debug: E
|
|
1667
|
+
} = $s(), [C, d] = I(null), [N, P] = I(!1), [j, z] = I(!1), [re, Q] = I(!1), [X, K] = I(/* @__PURE__ */ new Set()), [ee, ae] = I(0), [O, G] = I(!1), [Z, k] = I(null), T = W(null), {
|
|
1668
|
+
participantSource: U,
|
|
1646
1669
|
participantLabel: B = "participants",
|
|
1647
|
-
showDeleteConversation:
|
|
1648
|
-
} = t,
|
|
1649
|
-
const
|
|
1670
|
+
showDeleteConversation: se = !0
|
|
1671
|
+
} = t, oe = L.useMemo(() => {
|
|
1672
|
+
const w = m == null ? void 0 : m.userID;
|
|
1650
1673
|
return {
|
|
1651
1674
|
...{
|
|
1652
1675
|
type: "messaging",
|
|
1653
1676
|
last_message_at: { $exists: !0 },
|
|
1654
|
-
...
|
|
1655
|
-
members: { $in: [
|
|
1677
|
+
...w && {
|
|
1678
|
+
members: { $in: [w] },
|
|
1656
1679
|
hidden: !1
|
|
1657
1680
|
}
|
|
1658
1681
|
},
|
|
1659
1682
|
...x
|
|
1660
1683
|
};
|
|
1661
|
-
}, [x, m == null ? void 0 : m.userID]),
|
|
1662
|
-
if (!m || !
|
|
1663
|
-
const
|
|
1664
|
-
if (
|
|
1684
|
+
}, [x, m == null ? void 0 : m.userID]), Y = W(null), H = D(async () => {
|
|
1685
|
+
if (!m || !b) return;
|
|
1686
|
+
const w = m.userID;
|
|
1687
|
+
if (w)
|
|
1665
1688
|
try {
|
|
1666
|
-
|
|
1667
|
-
const
|
|
1689
|
+
E && console.log("[MessagingShell] Syncing channels for user:", w);
|
|
1690
|
+
const $ = await m.queryChannels(
|
|
1668
1691
|
{
|
|
1669
1692
|
type: "messaging",
|
|
1670
|
-
members: { $in: [
|
|
1693
|
+
members: { $in: [w] }
|
|
1671
1694
|
},
|
|
1672
1695
|
{},
|
|
1673
1696
|
{ limit: 100 }
|
|
1674
1697
|
), F = /* @__PURE__ */ new Set();
|
|
1675
|
-
|
|
1676
|
-
const
|
|
1677
|
-
Object.values(
|
|
1678
|
-
var
|
|
1679
|
-
const
|
|
1680
|
-
|
|
1698
|
+
$.forEach((A) => {
|
|
1699
|
+
const Ce = A.state.members;
|
|
1700
|
+
Object.values(Ce).forEach((ze) => {
|
|
1701
|
+
var we;
|
|
1702
|
+
const be = (we = ze.user) == null ? void 0 : we.id;
|
|
1703
|
+
be && be !== w && F.add(be);
|
|
1681
1704
|
});
|
|
1682
|
-
}), K((A) => A.size === F.size && [...A].every((
|
|
1683
|
-
channelCount:
|
|
1705
|
+
}), K((A) => A.size === F.size && [...A].every((Ce) => F.has(Ce)) ? A : F), P($.length > 0), z(!0), Y.current = w, E && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1706
|
+
channelCount: $.length,
|
|
1684
1707
|
memberCount: F.size
|
|
1685
1708
|
});
|
|
1686
|
-
} catch (
|
|
1687
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1709
|
+
} catch ($) {
|
|
1710
|
+
console.error("[MessagingShell] Failed to sync channels:", $);
|
|
1688
1711
|
}
|
|
1689
|
-
}, [m,
|
|
1690
|
-
|
|
1691
|
-
if (!m || !
|
|
1692
|
-
const
|
|
1693
|
-
|
|
1694
|
-
}, [m,
|
|
1695
|
-
if (!c || !m || !
|
|
1712
|
+
}, [m, b, E]);
|
|
1713
|
+
q(() => {
|
|
1714
|
+
if (!m || !b) return;
|
|
1715
|
+
const w = m.userID;
|
|
1716
|
+
w && Y.current !== w && H();
|
|
1717
|
+
}, [m, b, H]), q(() => {
|
|
1718
|
+
if (!c || !m || !b) return;
|
|
1696
1719
|
(async () => {
|
|
1697
|
-
const
|
|
1698
|
-
if (
|
|
1720
|
+
const $ = m.userID;
|
|
1721
|
+
if ($)
|
|
1699
1722
|
try {
|
|
1700
|
-
|
|
1723
|
+
E && console.log(
|
|
1701
1724
|
"[MessagingShell] Loading initial conversation with:",
|
|
1702
1725
|
c
|
|
1703
1726
|
);
|
|
1704
1727
|
const F = await m.queryChannels(
|
|
1705
1728
|
{
|
|
1706
1729
|
type: "messaging",
|
|
1707
|
-
members: { $eq: [
|
|
1730
|
+
members: { $eq: [$, c] }
|
|
1708
1731
|
},
|
|
1709
1732
|
{},
|
|
1710
1733
|
{ limit: 1 }
|
|
1711
1734
|
);
|
|
1712
1735
|
if (F.length > 0)
|
|
1713
|
-
|
|
1736
|
+
d(F[0]), G(!0), k(null), r && r(F[0]), E && console.log(
|
|
1714
1737
|
"[MessagingShell] Initial conversation loaded:",
|
|
1715
1738
|
F[0].id
|
|
1716
1739
|
);
|
|
1717
|
-
else if (a &&
|
|
1718
|
-
|
|
1740
|
+
else if (a && g) {
|
|
1741
|
+
E && console.log(
|
|
1719
1742
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1720
1743
|
a
|
|
1721
1744
|
);
|
|
1722
1745
|
try {
|
|
1723
|
-
const A = await
|
|
1746
|
+
const A = await g.startChannelWithParticipant({
|
|
1724
1747
|
id: a.id,
|
|
1725
1748
|
name: a.name,
|
|
1726
1749
|
email: a.email,
|
|
1727
1750
|
phone: a.phone
|
|
1728
1751
|
});
|
|
1729
|
-
|
|
1752
|
+
d(A), G(!0), k(null), r && r(A), E && console.log(
|
|
1730
1753
|
"[MessagingShell] Channel created and loaded:",
|
|
1731
1754
|
A.id
|
|
1732
1755
|
);
|
|
@@ -1734,12 +1757,12 @@ const pt = ({
|
|
|
1734
1757
|
console.error(
|
|
1735
1758
|
"[MessagingShell] Failed to create conversation:",
|
|
1736
1759
|
A
|
|
1737
|
-
),
|
|
1760
|
+
), k("Failed to create conversation");
|
|
1738
1761
|
}
|
|
1739
1762
|
} else
|
|
1740
|
-
|
|
1763
|
+
k(
|
|
1741
1764
|
"No conversation found with this account"
|
|
1742
|
-
),
|
|
1765
|
+
), E && console.log(
|
|
1743
1766
|
"[MessagingShell] No conversation found for:",
|
|
1744
1767
|
c
|
|
1745
1768
|
);
|
|
@@ -1747,80 +1770,80 @@ const pt = ({
|
|
|
1747
1770
|
console.error(
|
|
1748
1771
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1749
1772
|
F
|
|
1750
|
-
),
|
|
1773
|
+
), k("Failed to load conversation");
|
|
1751
1774
|
}
|
|
1752
1775
|
})();
|
|
1753
1776
|
}, [
|
|
1754
1777
|
c,
|
|
1755
1778
|
a,
|
|
1756
1779
|
m,
|
|
1757
|
-
C,
|
|
1758
|
-
E,
|
|
1759
1780
|
b,
|
|
1781
|
+
g,
|
|
1782
|
+
E,
|
|
1760
1783
|
r
|
|
1761
1784
|
]);
|
|
1762
|
-
const
|
|
1763
|
-
(
|
|
1764
|
-
|
|
1785
|
+
const ie = D(
|
|
1786
|
+
(w) => {
|
|
1787
|
+
d(w), r == null || r(w);
|
|
1765
1788
|
},
|
|
1766
1789
|
[r]
|
|
1767
|
-
),
|
|
1768
|
-
|
|
1769
|
-
}, [
|
|
1770
|
-
async (
|
|
1771
|
-
var
|
|
1772
|
-
if (
|
|
1790
|
+
), le = D(() => {
|
|
1791
|
+
O || d(null);
|
|
1792
|
+
}, [O]), V = D(
|
|
1793
|
+
async (w) => {
|
|
1794
|
+
var $;
|
|
1795
|
+
if (g)
|
|
1773
1796
|
try {
|
|
1774
|
-
|
|
1797
|
+
E && console.log(
|
|
1775
1798
|
"[MessagingShell] Starting conversation with:",
|
|
1776
|
-
|
|
1799
|
+
w.id
|
|
1777
1800
|
);
|
|
1778
|
-
const F = await
|
|
1779
|
-
id:
|
|
1780
|
-
name:
|
|
1781
|
-
email:
|
|
1782
|
-
phone:
|
|
1801
|
+
const F = await g.startChannelWithParticipant({
|
|
1802
|
+
id: w.id,
|
|
1803
|
+
name: w.name,
|
|
1804
|
+
email: w.email,
|
|
1805
|
+
phone: w.phone
|
|
1783
1806
|
});
|
|
1784
1807
|
try {
|
|
1785
1808
|
await F.show();
|
|
1786
1809
|
} catch (A) {
|
|
1787
1810
|
console.warn("[MessagingShell] Failed to unhide channel:", A);
|
|
1788
1811
|
}
|
|
1789
|
-
|
|
1812
|
+
d(F), Q(!1), ($ = T.current) == null || $.close(), l == null || l(w);
|
|
1790
1813
|
} catch (F) {
|
|
1791
1814
|
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
1792
1815
|
}
|
|
1793
1816
|
},
|
|
1794
|
-
[
|
|
1795
|
-
),
|
|
1796
|
-
var
|
|
1797
|
-
|
|
1798
|
-
}, []),
|
|
1799
|
-
(
|
|
1800
|
-
|
|
1817
|
+
[g, l, E]
|
|
1818
|
+
), te = D(() => {
|
|
1819
|
+
var w;
|
|
1820
|
+
Q(!1), (w = T.current) == null || w.close();
|
|
1821
|
+
}, []), ce = D(
|
|
1822
|
+
(w) => {
|
|
1823
|
+
w.target === T.current && te();
|
|
1801
1824
|
},
|
|
1802
|
-
[
|
|
1803
|
-
),
|
|
1804
|
-
async (
|
|
1805
|
-
|
|
1825
|
+
[te]
|
|
1826
|
+
), xe = D(
|
|
1827
|
+
async (w) => {
|
|
1828
|
+
E && console.log("[MessagingShell] Leaving conversation:", w.id), d(null), G(!1), Y.current = null, await H();
|
|
1806
1829
|
},
|
|
1807
|
-
[
|
|
1808
|
-
),
|
|
1809
|
-
async (
|
|
1810
|
-
|
|
1830
|
+
[H, E]
|
|
1831
|
+
), de = D(
|
|
1832
|
+
async (w) => {
|
|
1833
|
+
E && console.log("[MessagingShell] Blocking participant:", w), d(null), G(!1), Y.current = null, await H();
|
|
1811
1834
|
},
|
|
1812
|
-
[
|
|
1813
|
-
),
|
|
1814
|
-
return v ? /* @__PURE__ */ e("div", { className:
|
|
1815
|
-
|
|
1835
|
+
[H, E]
|
|
1836
|
+
), J = !!C;
|
|
1837
|
+
return v ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(fe, {}) }) : y ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(he, { message: y, onBack: _ }) }) : !b || !m ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
|
|
1838
|
+
he,
|
|
1816
1839
|
{
|
|
1817
1840
|
message: "Not connected to messaging service",
|
|
1818
|
-
onBack:
|
|
1841
|
+
onBack: _
|
|
1819
1842
|
}
|
|
1820
|
-
) }) :
|
|
1843
|
+
) }) : Z ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(he, { message: Z }) }) : /* @__PURE__ */ i(
|
|
1821
1844
|
"div",
|
|
1822
1845
|
{
|
|
1823
|
-
className:
|
|
1846
|
+
className: R(
|
|
1824
1847
|
"messaging-shell h-full bg-background-primary overflow-hidden",
|
|
1825
1848
|
s
|
|
1826
1849
|
),
|
|
@@ -1829,23 +1852,23 @@ const pt = ({
|
|
|
1829
1852
|
/* @__PURE__ */ e(
|
|
1830
1853
|
"div",
|
|
1831
1854
|
{
|
|
1832
|
-
className:
|
|
1855
|
+
className: R(
|
|
1833
1856
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1834
1857
|
{
|
|
1835
|
-
"!hidden": h === !1 ||
|
|
1858
|
+
"!hidden": h === !1 || O,
|
|
1836
1859
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
1837
|
-
"hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !
|
|
1860
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !O && J,
|
|
1838
1861
|
// Show on mobile when no channel selected, use same wide width on desktop
|
|
1839
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !
|
|
1862
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !O && !J
|
|
1840
1863
|
}
|
|
1841
1864
|
),
|
|
1842
1865
|
children: /* @__PURE__ */ e(
|
|
1843
|
-
|
|
1866
|
+
Ue,
|
|
1844
1867
|
{
|
|
1845
|
-
onChannelSelect:
|
|
1846
|
-
selectedChannel:
|
|
1847
|
-
filters:
|
|
1848
|
-
customEmptyStateIndicator:
|
|
1868
|
+
onChannelSelect: ie,
|
|
1869
|
+
selectedChannel: C || void 0,
|
|
1870
|
+
filters: oe,
|
|
1871
|
+
customEmptyStateIndicator: p
|
|
1849
1872
|
}
|
|
1850
1873
|
)
|
|
1851
1874
|
}
|
|
@@ -1853,59 +1876,60 @@ const pt = ({
|
|
|
1853
1876
|
/* @__PURE__ */ e(
|
|
1854
1877
|
"div",
|
|
1855
1878
|
{
|
|
1856
|
-
className:
|
|
1879
|
+
className: R(
|
|
1857
1880
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1858
1881
|
{
|
|
1859
1882
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1860
|
-
flex:
|
|
1883
|
+
flex: O || J || c,
|
|
1861
1884
|
// Normal mode: hide on mobile when no channel selected
|
|
1862
|
-
"hidden lg:flex": !
|
|
1885
|
+
"hidden lg:flex": !O && !J && !c
|
|
1863
1886
|
}
|
|
1864
1887
|
),
|
|
1865
|
-
children:
|
|
1866
|
-
|
|
1888
|
+
children: C ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1889
|
+
je,
|
|
1867
1890
|
{
|
|
1868
|
-
channel:
|
|
1869
|
-
onBack:
|
|
1870
|
-
showBackButton: !
|
|
1891
|
+
channel: C,
|
|
1892
|
+
onBack: le,
|
|
1893
|
+
showBackButton: !O,
|
|
1871
1894
|
renderMessageInputActions: n,
|
|
1872
|
-
onLeaveConversation:
|
|
1873
|
-
onBlockParticipant:
|
|
1895
|
+
onLeaveConversation: xe,
|
|
1896
|
+
onBlockParticipant: de,
|
|
1874
1897
|
CustomChannelEmptyState: u,
|
|
1875
|
-
showDeleteConversation:
|
|
1898
|
+
showDeleteConversation: se,
|
|
1876
1899
|
onDeleteConversationClick: f,
|
|
1877
1900
|
onBlockParticipantClick: o,
|
|
1878
|
-
onReportParticipantClick:
|
|
1901
|
+
onReportParticipantClick: M,
|
|
1902
|
+
dmAgentEnabled: S
|
|
1879
1903
|
},
|
|
1880
|
-
|
|
1904
|
+
C.id
|
|
1881
1905
|
) }) : c ? (
|
|
1882
1906
|
// Show loading while creating/loading direct conversation channel
|
|
1883
|
-
/* @__PURE__ */ e(
|
|
1907
|
+
/* @__PURE__ */ e(fe, {})
|
|
1884
1908
|
) : /* @__PURE__ */ e(
|
|
1885
|
-
|
|
1909
|
+
$e,
|
|
1886
1910
|
{
|
|
1887
|
-
hasChannels:
|
|
1888
|
-
channelsLoaded:
|
|
1911
|
+
hasChannels: N,
|
|
1912
|
+
channelsLoaded: j
|
|
1889
1913
|
}
|
|
1890
1914
|
)
|
|
1891
1915
|
}
|
|
1892
1916
|
)
|
|
1893
1917
|
] }),
|
|
1894
|
-
|
|
1918
|
+
U && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1895
1919
|
/* @__PURE__ */ e(
|
|
1896
1920
|
"dialog",
|
|
1897
1921
|
{
|
|
1898
|
-
ref:
|
|
1922
|
+
ref: T,
|
|
1899
1923
|
className: "mes-dialog",
|
|
1900
|
-
onClick:
|
|
1901
|
-
onClose:
|
|
1924
|
+
onClick: ce,
|
|
1925
|
+
onClose: te,
|
|
1902
1926
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1903
|
-
|
|
1927
|
+
ut,
|
|
1904
1928
|
{
|
|
1905
|
-
participantSource:
|
|
1906
|
-
onSelectParticipant:
|
|
1907
|
-
onClose:
|
|
1908
|
-
existingParticipantIds:
|
|
1929
|
+
participantSource: U,
|
|
1930
|
+
onSelectParticipant: V,
|
|
1931
|
+
onClose: te,
|
|
1932
|
+
existingParticipantIds: X,
|
|
1909
1933
|
participantLabel: B,
|
|
1910
1934
|
searchPlaceholder: `Search ${B}...`
|
|
1911
1935
|
},
|
|
@@ -1916,7 +1940,7 @@ const pt = ({
|
|
|
1916
1940
|
]
|
|
1917
1941
|
}
|
|
1918
1942
|
);
|
|
1919
|
-
},
|
|
1943
|
+
}, ft = ({
|
|
1920
1944
|
question: t,
|
|
1921
1945
|
onClick: s,
|
|
1922
1946
|
loading: n = !1,
|
|
@@ -1928,7 +1952,7 @@ const pt = ({
|
|
|
1928
1952
|
onClick: s,
|
|
1929
1953
|
disabled: n,
|
|
1930
1954
|
style: { backgroundColor: "#E6E5E3" },
|
|
1931
|
-
className:
|
|
1955
|
+
className: R(
|
|
1932
1956
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1933
1957
|
{
|
|
1934
1958
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1938,7 +1962,7 @@ const pt = ({
|
|
|
1938
1962
|
),
|
|
1939
1963
|
children: t
|
|
1940
1964
|
}
|
|
1941
|
-
),
|
|
1965
|
+
), Et = ({
|
|
1942
1966
|
faqs: t,
|
|
1943
1967
|
onFaqClick: s,
|
|
1944
1968
|
loadingFaqId: n,
|
|
@@ -1950,7 +1974,7 @@ const pt = ({
|
|
|
1950
1974
|
const u = t.filter((h) => h.enabled).sort((h, x) => (h.order ?? 0) - (x.order ?? 0));
|
|
1951
1975
|
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1952
1976
|
(c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1953
|
-
|
|
1977
|
+
ne,
|
|
1954
1978
|
{
|
|
1955
1979
|
id: a || "account",
|
|
1956
1980
|
name: a || "Account",
|
|
@@ -1967,7 +1991,7 @@ const pt = ({
|
|
|
1967
1991
|
children: [
|
|
1968
1992
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1969
1993
|
u.map((h) => /* @__PURE__ */ e(
|
|
1970
|
-
|
|
1994
|
+
ft,
|
|
1971
1995
|
{
|
|
1972
1996
|
question: h.question,
|
|
1973
1997
|
onClick: () => s(h.id),
|
|
@@ -1979,59 +2003,59 @@ const pt = ({
|
|
|
1979
2003
|
}
|
|
1980
2004
|
)
|
|
1981
2005
|
] }) });
|
|
1982
|
-
},
|
|
1983
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [l, c] = I([]), [a, u] = I(!1), [h, x] = I(null), [
|
|
2006
|
+
}, It = (t, s = {}) => {
|
|
2007
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [l, c] = I([]), [a, u] = I(!1), [h, x] = I(null), [p, f] = I(n), [o, M] = I(!0), [S, g] = I(), m = D(async (_ = !1, E) => {
|
|
1984
2008
|
if (a) return;
|
|
1985
|
-
const
|
|
2009
|
+
const C = E !== void 0 ? E : p;
|
|
1986
2010
|
u(!0), x(null);
|
|
1987
2011
|
try {
|
|
1988
2012
|
const d = await t.loadParticipants({
|
|
1989
|
-
search:
|
|
2013
|
+
search: C || void 0,
|
|
1990
2014
|
limit: r,
|
|
1991
|
-
cursor:
|
|
2015
|
+
cursor: _ ? void 0 : S
|
|
1992
2016
|
});
|
|
1993
2017
|
c(
|
|
1994
|
-
(N) =>
|
|
1995
|
-
),
|
|
2018
|
+
(N) => _ ? d.participants : [...N, ...d.participants]
|
|
2019
|
+
), M(d.hasMore), g(d.nextCursor);
|
|
1996
2020
|
} catch (d) {
|
|
1997
2021
|
const N = d instanceof Error ? d.message : "Failed to load participants";
|
|
1998
2022
|
x(N), console.error("[useParticipants] Load error:", d);
|
|
1999
2023
|
} finally {
|
|
2000
2024
|
u(!1);
|
|
2001
2025
|
}
|
|
2002
|
-
}, [t,
|
|
2003
|
-
o && !a &&
|
|
2004
|
-
}, [o, a,
|
|
2005
|
-
f(
|
|
2006
|
-
}, [
|
|
2007
|
-
|
|
2008
|
-
}, [
|
|
2009
|
-
return
|
|
2010
|
-
|
|
2026
|
+
}, [t, p, S, r, a]), b = D(() => {
|
|
2027
|
+
o && !a && m(!1);
|
|
2028
|
+
}, [o, a, m]), v = D((_) => {
|
|
2029
|
+
f(_), g(void 0), m(!0, _);
|
|
2030
|
+
}, [m]), y = D(() => {
|
|
2031
|
+
g(void 0), m(!0);
|
|
2032
|
+
}, [m]);
|
|
2033
|
+
return q(() => {
|
|
2034
|
+
m(!0);
|
|
2011
2035
|
}, [t.loadParticipants]), {
|
|
2012
2036
|
participants: l,
|
|
2013
2037
|
loading: a,
|
|
2014
2038
|
error: h,
|
|
2015
|
-
searchQuery:
|
|
2039
|
+
searchQuery: p,
|
|
2016
2040
|
hasMore: o,
|
|
2017
2041
|
totalCount: t.totalCount,
|
|
2018
|
-
loadMore:
|
|
2019
|
-
search:
|
|
2020
|
-
refresh:
|
|
2042
|
+
loadMore: b,
|
|
2043
|
+
search: v,
|
|
2044
|
+
refresh: y
|
|
2021
2045
|
};
|
|
2022
2046
|
};
|
|
2023
2047
|
export {
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2048
|
+
ne as Avatar,
|
|
2049
|
+
lt as ChannelEmptyState,
|
|
2050
|
+
Ue as ChannelList,
|
|
2051
|
+
je as ChannelView,
|
|
2052
|
+
Et as FaqList,
|
|
2053
|
+
ft as FaqListItem,
|
|
2054
|
+
pt as MessagingProvider,
|
|
2055
|
+
yt as MessagingShell,
|
|
2056
|
+
ut as ParticipantPicker,
|
|
2057
|
+
Gs as formatRelativeTime,
|
|
2058
|
+
$s as useMessaging,
|
|
2059
|
+
It as useParticipants
|
|
2036
2060
|
};
|
|
2037
2061
|
//# sourceMappingURL=index.js.map
|