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