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