@linktr.ee/messaging-react 1.15.0 โ 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
1
|
import { jsx as e, jsxs as i, Fragment as be } from "react/jsx-runtime";
|
|
2
2
|
import M from "classnames";
|
|
3
|
-
import P, { createContext as
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import {
|
|
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 De =
|
|
8
|
+
const De = ze({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,7 +15,7 @@ const De = $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,
|
|
@@ -24,8 +24,8 @@ const De = $e({
|
|
|
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
|
);
|
|
@@ -35,7 +35,7 @@ const De = $e({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
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,
|
|
@@ -45,74 +45,74 @@ const De = $e({
|
|
|
45
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
57
|
capabilities: l
|
|
58
58
|
}, Z(() => {
|
|
59
|
-
const
|
|
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
97
|
const b = W(null);
|
|
98
98
|
Z(() => {
|
|
99
|
-
var
|
|
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:
|
|
105
|
-
isConnected:
|
|
104
|
+
isConnecting: v.current,
|
|
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,39 +120,39 @@ const De = $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
|
-
y(
|
|
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 q =
|
|
131
|
+
} catch (j) {
|
|
132
|
+
const q = j instanceof Error ? j.message : "Connection failed";
|
|
133
133
|
C(q), a("โ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
135
|
error: q
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
E(!1),
|
|
138
|
+
E(!1), v.current = !1, a("๐ USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
|
-
isConnected:
|
|
140
|
+
isConnected: f
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [u, s, a,
|
|
144
|
+
}, [u, s, a, f]), Z(() => (a("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
145
|
hasService: !!u,
|
|
146
|
-
isConnected:
|
|
146
|
+
isConnected: f
|
|
147
147
|
}), () => {
|
|
148
|
-
u &&
|
|
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
|
-
isConnected:
|
|
153
|
+
isConnected: f
|
|
154
154
|
});
|
|
155
|
-
}), [u,
|
|
155
|
+
}), [u, f, a]);
|
|
156
156
|
const k = T(async () => {
|
|
157
157
|
if (a("๐ REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!u,
|
|
@@ -164,39 +164,39 @@ const De = $e({
|
|
|
164
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
|
-
y(
|
|
169
|
-
} catch (
|
|
170
|
-
const
|
|
171
|
-
C(
|
|
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
|
-
isConnected:
|
|
181
|
+
isConnected: f,
|
|
182
182
|
isLoading: _,
|
|
183
|
-
hasError: !!
|
|
183
|
+
hasError: !!m,
|
|
184
184
|
capabilitiesKeys: Object.keys(l)
|
|
185
185
|
}), {
|
|
186
186
|
service: u,
|
|
187
187
|
client: x,
|
|
188
|
-
isConnected:
|
|
188
|
+
isConnected: f,
|
|
189
189
|
isLoading: _,
|
|
190
|
-
error:
|
|
190
|
+
error: m,
|
|
191
191
|
capabilities: l,
|
|
192
192
|
refreshConnection: k,
|
|
193
193
|
debug: c
|
|
194
194
|
}), [
|
|
195
195
|
u,
|
|
196
196
|
x,
|
|
197
|
-
|
|
197
|
+
f,
|
|
198
198
|
_,
|
|
199
|
-
|
|
199
|
+
m,
|
|
200
200
|
l,
|
|
201
201
|
k,
|
|
202
202
|
c,
|
|
@@ -204,10 +204,10 @@ const De = $e({
|
|
|
204
204
|
]);
|
|
205
205
|
return a("๐ RENDER END", {
|
|
206
206
|
renderCount: S.current,
|
|
207
|
-
willRenderChat: !!(x &&
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(De.Provider, { value:
|
|
210
|
-
|
|
207
|
+
willRenderChat: !!(x && f),
|
|
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 De = $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
225
|
return Math.floor(l / (1e3 * 60 * 60 * 24));
|
|
226
|
-
},
|
|
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",
|
|
@@ -265,7 +265,7 @@ const De = $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,8 +273,8 @@ function zs(t) {
|
|
|
273
273
|
}
|
|
274
274
|
return Math.abs(s);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const n =
|
|
276
|
+
function Hs(t) {
|
|
277
|
+
const n = Gs(t) % Me.length;
|
|
278
278
|
return Me[n];
|
|
279
279
|
}
|
|
280
280
|
const te = ({
|
|
@@ -284,7 +284,7 @@ const te = ({
|
|
|
284
284
|
className: r,
|
|
285
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
|
};
|
|
@@ -295,7 +295,7 @@ const te = ({
|
|
|
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",
|
|
@@ -317,27 +317,66 @@ const te = ({
|
|
|
317
317
|
)
|
|
318
318
|
}
|
|
319
319
|
);
|
|
320
|
-
},
|
|
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(
|
|
321
360
|
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: l }) => {
|
|
322
|
-
var
|
|
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
|
|
332
|
-
if (
|
|
333
|
-
const
|
|
334
|
-
return
|
|
335
|
-
})(), E =
|
|
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;
|
|
371
|
+
if (f != null && f.text) return f.text;
|
|
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:
|
|
379
|
+
unreadCount: C,
|
|
341
380
|
hasTimestamp: !!E
|
|
342
381
|
}), /* @__PURE__ */ e(
|
|
343
382
|
"button",
|
|
@@ -355,7 +394,7 @@ 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
399
|
image: y,
|
|
361
400
|
size: 44,
|
|
@@ -377,8 +416,11 @@ const te = ({
|
|
|
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,8 +428,8 @@ 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,
|
|
@@ -404,7 +446,7 @@ const Le = 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,
|
|
@@ -420,7 +462,7 @@ const Le = P.memo(
|
|
|
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 },
|
|
@@ -434,7 +476,7 @@ const Le = 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,
|
|
@@ -453,7 +495,7 @@ 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
|
{
|
|
@@ -474,50 +516,11 @@ function Pe({ 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
|
-
) }), Ws = (t) => {
|
|
487
|
-
var s;
|
|
488
|
-
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
|
|
489
|
-
}, Zs = (t) => {
|
|
490
|
-
var s;
|
|
491
|
-
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
|
|
492
|
-
}, qs = (t) => {
|
|
493
|
-
var s;
|
|
494
|
-
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
|
|
495
|
-
}, Ue = (t) => Ws(t) || Zs(t), Ys = (t) => {
|
|
496
|
-
var s;
|
|
497
|
-
return Ue(t) && !((s = t.text) != null && s.trim());
|
|
498
|
-
}, ke = ({
|
|
499
|
-
message: t,
|
|
500
|
-
standalone: s = !1
|
|
501
|
-
}) => {
|
|
502
|
-
var l;
|
|
503
|
-
const n = Ue(t), r = qs(t);
|
|
504
|
-
if (!n && !r)
|
|
505
|
-
return null;
|
|
506
|
-
if (n) {
|
|
507
|
-
const c = (l = t.metadata) == null ? void 0 : l.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(Ls, { 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(Vs, {}) }),
|
|
517
|
-
/* @__PURE__ */ e("span", { className: "message-tag__label", children: "Chatbot" })
|
|
518
|
-
] });
|
|
519
|
-
}, Js = (t) => {
|
|
520
|
-
var X, w;
|
|
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,
|
|
@@ -526,72 +529,72 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
526
529
|
groupedByUser: c,
|
|
527
530
|
handleAction: a,
|
|
528
531
|
handleOpenThread: u,
|
|
529
|
-
handleRetry:
|
|
532
|
+
handleRetry: h,
|
|
530
533
|
highlighted: x,
|
|
531
534
|
isMessageAIGenerated: y,
|
|
532
|
-
isMyMessage:
|
|
535
|
+
isMyMessage: f,
|
|
533
536
|
message: o,
|
|
534
537
|
onUserClick: _,
|
|
535
538
|
onUserHover: E,
|
|
536
|
-
renderText:
|
|
539
|
+
renderText: m,
|
|
537
540
|
threadList: C
|
|
538
|
-
} = t, { client:
|
|
539
|
-
Attachment:
|
|
540
|
-
Avatar:
|
|
541
|
-
EditMessageModal:
|
|
542
|
-
MessageBlocked: q =
|
|
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
|
-
} =
|
|
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(
|
|
553
556
|
() => y == null ? void 0 : y(o),
|
|
554
557
|
[y, o]
|
|
555
|
-
),
|
|
558
|
+
), $ = we(
|
|
556
559
|
() => !o.shared_location && !o.attachments ? [] : o.shared_location ? [o.shared_location, ...o.attachments ?? []] : o.attachments,
|
|
557
560
|
[o]
|
|
558
561
|
);
|
|
559
|
-
if (
|
|
562
|
+
if (us(o))
|
|
560
563
|
return null;
|
|
561
564
|
if (o.deleted_at || o.type === "deleted")
|
|
562
565
|
return /* @__PURE__ */ e(ne, { message: o });
|
|
563
|
-
if (
|
|
566
|
+
if (hs(o))
|
|
564
567
|
return /* @__PURE__ */ e(q, {});
|
|
565
|
-
const se = !c || r, Q = !C && !!o.reply_count, V = !C && o.show_in_channel && o.parent_id, le = o.status === "failed" && ((X = o.error) == null ? void 0 : X.status) !== 403, oe =
|
|
566
|
-
let
|
|
567
|
-
le ?
|
|
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));
|
|
568
571
|
const fe = M(
|
|
569
572
|
"str-chat__message str-chat__message-simple",
|
|
570
573
|
`str-chat__message--${o.type}`,
|
|
571
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
578
|
"str-chat__message--has-attachment": R,
|
|
576
579
|
"str-chat__message--highlighted": x,
|
|
577
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": (o == null ? void 0 : o.status) === "failed" && ((
|
|
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
585
|
"str-chat__virtual-message__wrapper--first": l,
|
|
583
586
|
"str-chat__virtual-message__wrapper--group": c
|
|
584
587
|
}
|
|
585
|
-
), ie = o.poll_id &&
|
|
588
|
+
), ie = o.poll_id && v.polls.fromState(o.poll_id), ge = qs(o);
|
|
586
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
596
|
S && /* @__PURE__ */ e(
|
|
594
|
-
|
|
597
|
+
xs,
|
|
595
598
|
{
|
|
596
599
|
MessageBouncePrompt: Y,
|
|
597
600
|
onClose: () => b(!1),
|
|
@@ -599,10 +602,10 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
599
602
|
}
|
|
600
603
|
),
|
|
601
604
|
/* @__PURE__ */ i("div", { className: fe, children: [
|
|
602
|
-
|
|
603
|
-
!!
|
|
605
|
+
G && /* @__PURE__ */ e(G, {}),
|
|
606
|
+
!!d && /* @__PURE__ */ e(H, { reminder: d }),
|
|
604
607
|
o.user && /* @__PURE__ */ e(
|
|
605
|
-
|
|
608
|
+
O,
|
|
606
609
|
{
|
|
607
610
|
image: o.user.image,
|
|
608
611
|
name: o.user.name || o.user.id,
|
|
@@ -618,31 +621,31 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
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
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
|
-
|
|
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
|
-
attachments:
|
|
638
|
+
attachments: $
|
|
636
639
|
}
|
|
637
640
|
) : null,
|
|
638
|
-
|
|
641
|
+
B ? /* @__PURE__ */ e(
|
|
639
642
|
J,
|
|
640
643
|
{
|
|
641
644
|
message: o,
|
|
642
|
-
renderText:
|
|
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
650
|
/* @__PURE__ */ e(ke, { message: o })
|
|
648
651
|
] })
|
|
@@ -658,18 +661,18 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
658
661
|
V && /* @__PURE__ */ e(K, {}),
|
|
659
662
|
se && /* @__PURE__ */ i("div", { className: "str-chat__message-metadata", children: [
|
|
660
663
|
/* @__PURE__ */ e(re, {}),
|
|
661
|
-
!
|
|
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
671
|
}, Qs = P.memo(
|
|
669
672
|
Js,
|
|
670
|
-
|
|
673
|
+
qe
|
|
671
674
|
), Xs = (t) => {
|
|
672
|
-
const s =
|
|
675
|
+
const s = ws("CustomMessage");
|
|
673
676
|
return /* @__PURE__ */ e(Qs, { ...s, ...t });
|
|
674
677
|
}, Ks = (t) => ({
|
|
675
678
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
@@ -716,7 +719,7 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
716
719
|
}
|
|
717
720
|
);
|
|
718
721
|
}, st = () => {
|
|
719
|
-
const { linkPreviewsManager: t } =
|
|
722
|
+
const { linkPreviewsManager: t } = ps(), { linkPreviews: s } = ys(
|
|
720
723
|
t.state,
|
|
721
724
|
Ks
|
|
722
725
|
), n = (l) => {
|
|
@@ -731,16 +734,16 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
731
734
|
l.og_scrape_url
|
|
732
735
|
)) }) : null;
|
|
733
736
|
}, tt = () => {
|
|
734
|
-
const { handleSubmit: t } =
|
|
737
|
+
const { handleSubmit: t } = Is(), s = Ss();
|
|
735
738
|
return /* @__PURE__ */ i(be, { children: [
|
|
736
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
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(_s, {}),
|
|
739
|
-
/* @__PURE__ */ e(st, {}),
|
|
740
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,7 +759,7 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
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
|
] })
|
|
@@ -766,7 +769,7 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
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(
|
|
772
|
+
/* @__PURE__ */ e(Es, { Input: tt })
|
|
770
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: [
|
|
@@ -826,27 +829,27 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
826
829
|
] }) }));
|
|
827
830
|
ue.displayName = "LoadingState";
|
|
828
831
|
const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
829
|
-
var
|
|
832
|
+
var f, o, _, E, m, C;
|
|
830
833
|
const { channel: l } = Te(), c = P.useMemo(() => Object.values(l.state.members || {}).find(
|
|
831
|
-
(
|
|
834
|
+
(w) => {
|
|
832
835
|
var S;
|
|
833
|
-
return ((S =
|
|
836
|
+
return ((S = w.user) == null ? void 0 : S.id) && w.user.id !== l._client.userID;
|
|
834
837
|
}
|
|
835
|
-
), [l._client.userID, l.state.members]), a = ((
|
|
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));
|
|
836
839
|
Z(() => {
|
|
837
|
-
const
|
|
840
|
+
const v = (w) => {
|
|
838
841
|
var S;
|
|
839
|
-
x(
|
|
842
|
+
x(w != null && w.member ? !!w.member.pinned_at : !!((S = l.state.membership) != null && S.pinned_at));
|
|
840
843
|
};
|
|
841
|
-
return l.on("member.updated",
|
|
842
|
-
l.off("member.updated",
|
|
844
|
+
return l.on("member.updated", v), () => {
|
|
845
|
+
l.off("member.updated", v);
|
|
843
846
|
};
|
|
844
847
|
}, [l]);
|
|
845
848
|
const y = async () => {
|
|
846
849
|
try {
|
|
847
|
-
|
|
848
|
-
} catch (
|
|
849
|
-
console.error("[CustomChannelHeader] Failed to update pinned status:",
|
|
850
|
+
h ? await l.unpin() : await l.pin();
|
|
851
|
+
} catch (v) {
|
|
852
|
+
console.error("[CustomChannelHeader] Failed to update pinned status:", v);
|
|
850
853
|
}
|
|
851
854
|
};
|
|
852
855
|
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
@@ -872,7 +875,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
872
875
|
/* @__PURE__ */ e(
|
|
873
876
|
te,
|
|
874
877
|
{
|
|
875
|
-
id: ((
|
|
878
|
+
id: ((m = c == null ? void 0 : c.user) == null ? void 0 : m.id) || l.id || "unknown",
|
|
876
879
|
name: a,
|
|
877
880
|
image: u,
|
|
878
881
|
size: 40
|
|
@@ -887,12 +890,12 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
887
890
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
888
891
|
onClick: y,
|
|
889
892
|
type: "button",
|
|
890
|
-
"aria-label":
|
|
893
|
+
"aria-label": h ? "Unstar conversation" : "Star conversation",
|
|
891
894
|
children: /* @__PURE__ */ e(
|
|
892
895
|
ye,
|
|
893
896
|
{
|
|
894
897
|
className: "size-5 text-black/90",
|
|
895
|
-
weight:
|
|
898
|
+
weight: h ? "fill" : "regular"
|
|
896
899
|
}
|
|
897
900
|
)
|
|
898
901
|
}
|
|
@@ -939,12 +942,12 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
939
942
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
940
943
|
onClick: y,
|
|
941
944
|
type: "button",
|
|
942
|
-
"aria-label":
|
|
945
|
+
"aria-label": h ? "Unstar conversation" : "Star conversation",
|
|
943
946
|
children: /* @__PURE__ */ e(
|
|
944
947
|
ye,
|
|
945
948
|
{
|
|
946
949
|
className: "size-5 text-black/90",
|
|
947
|
-
weight:
|
|
950
|
+
weight: h ? "fill" : "regular"
|
|
948
951
|
}
|
|
949
952
|
)
|
|
950
953
|
}
|
|
@@ -971,36 +974,36 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
971
974
|
onLeaveConversation: c,
|
|
972
975
|
onBlockParticipant: a,
|
|
973
976
|
showDeleteConversation: u = !0,
|
|
974
|
-
onDeleteConversationClick:
|
|
977
|
+
onDeleteConversationClick: h,
|
|
975
978
|
onBlockParticipantClick: x,
|
|
976
979
|
onReportParticipantClick: y
|
|
977
980
|
}) => {
|
|
978
|
-
var K, ee, re,
|
|
979
|
-
const { service:
|
|
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 () => {
|
|
980
983
|
var R;
|
|
981
|
-
if (!(!
|
|
984
|
+
if (!(!f || !((R = n == null ? void 0 : n.user) != null && R.id)))
|
|
982
985
|
try {
|
|
983
|
-
const
|
|
984
|
-
(
|
|
986
|
+
const B = (await f.getBlockedUsers()).some(
|
|
987
|
+
($) => {
|
|
985
988
|
var se;
|
|
986
|
-
return
|
|
989
|
+
return $.blocked_user_id === ((se = n == null ? void 0 : n.user) == null ? void 0 : se.id);
|
|
987
990
|
}
|
|
988
991
|
);
|
|
989
|
-
E(
|
|
992
|
+
E(B);
|
|
990
993
|
} catch (D) {
|
|
991
994
|
console.error(
|
|
992
995
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
993
996
|
D
|
|
994
997
|
);
|
|
995
998
|
}
|
|
996
|
-
}, [
|
|
999
|
+
}, [f, (K = n == null ? void 0 : n.user) == null ? void 0 : K.id]);
|
|
997
1000
|
Z(() => {
|
|
998
1001
|
S();
|
|
999
1002
|
}, [S]);
|
|
1000
1003
|
const b = async () => {
|
|
1001
1004
|
var R;
|
|
1002
|
-
if (!
|
|
1003
|
-
|
|
1005
|
+
if (!m) {
|
|
1006
|
+
h == null || h(), o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), C(!0);
|
|
1004
1007
|
try {
|
|
1005
1008
|
const D = ((R = r._client) == null ? void 0 : R.userID) ?? null;
|
|
1006
1009
|
await r.hide(D, !1), c && await c(r), s();
|
|
@@ -1011,30 +1014,30 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1011
1014
|
}
|
|
1012
1015
|
}
|
|
1013
1016
|
}, k = async () => {
|
|
1014
|
-
var R, D,
|
|
1015
|
-
if (!(
|
|
1016
|
-
x == null || x(), o && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id),
|
|
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);
|
|
1017
1020
|
try {
|
|
1018
|
-
await
|
|
1019
|
-
} catch (
|
|
1020
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
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();
|
|
1022
|
+
} catch ($) {
|
|
1023
|
+
console.error("[ChannelInfoDialog] Failed to block member", $);
|
|
1021
1024
|
} finally {
|
|
1022
|
-
|
|
1025
|
+
w(!1);
|
|
1023
1026
|
}
|
|
1024
1027
|
}
|
|
1025
|
-
},
|
|
1026
|
-
var R, D,
|
|
1027
|
-
if (!(
|
|
1028
|
-
x == null || x(), o && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id),
|
|
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);
|
|
1029
1032
|
try {
|
|
1030
|
-
await
|
|
1031
|
-
} catch (
|
|
1032
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
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();
|
|
1034
|
+
} catch ($) {
|
|
1035
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", $);
|
|
1033
1036
|
} finally {
|
|
1034
|
-
|
|
1037
|
+
w(!1);
|
|
1035
1038
|
}
|
|
1036
1039
|
}
|
|
1037
|
-
},
|
|
1040
|
+
}, d = () => {
|
|
1038
1041
|
y == null || y(), s(), window.open(
|
|
1039
1042
|
"https://linktr.ee/s/about/trust-center/report",
|
|
1040
1043
|
"_blank",
|
|
@@ -1042,7 +1045,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1042
1045
|
);
|
|
1043
1046
|
};
|
|
1044
1047
|
if (!n) return null;
|
|
1045
|
-
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";
|
|
1046
1049
|
return (
|
|
1047
1050
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1048
1051
|
/* @__PURE__ */ e(
|
|
@@ -1057,7 +1060,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1057
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: [
|
|
1058
1061
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
1059
1062
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
1060
|
-
/* @__PURE__ */ e(
|
|
1063
|
+
/* @__PURE__ */ e(Be, { onClick: s })
|
|
1061
1064
|
] }),
|
|
1062
1065
|
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
1063
1066
|
/* @__PURE__ */ e(
|
|
@@ -1070,14 +1073,14 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1070
1073
|
te,
|
|
1071
1074
|
{
|
|
1072
1075
|
id: ne,
|
|
1073
|
-
name:
|
|
1074
|
-
image:
|
|
1076
|
+
name: N,
|
|
1077
|
+
image: O,
|
|
1075
1078
|
size: 88,
|
|
1076
1079
|
shape: "circle"
|
|
1077
1080
|
}
|
|
1078
1081
|
),
|
|
1079
1082
|
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
1080
|
-
/* @__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 }),
|
|
1081
1084
|
Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
|
|
1082
1085
|
l && /* @__PURE__ */ e(
|
|
1083
1086
|
"span",
|
|
@@ -1102,10 +1105,10 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1102
1105
|
ce,
|
|
1103
1106
|
{
|
|
1104
1107
|
onClick: b,
|
|
1105
|
-
disabled:
|
|
1106
|
-
"aria-busy":
|
|
1108
|
+
disabled: m,
|
|
1109
|
+
"aria-busy": m,
|
|
1107
1110
|
children: [
|
|
1108
|
-
|
|
1111
|
+
m ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Us, { className: "h-5 w-5" }),
|
|
1109
1112
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
1110
1113
|
]
|
|
1111
1114
|
}
|
|
@@ -1113,11 +1116,11 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1113
1116
|
/* @__PURE__ */ e("li", { children: _ ? /* @__PURE__ */ i(
|
|
1114
1117
|
ce,
|
|
1115
1118
|
{
|
|
1116
|
-
onClick:
|
|
1117
|
-
disabled:
|
|
1118
|
-
"aria-busy":
|
|
1119
|
+
onClick: g,
|
|
1120
|
+
disabled: v,
|
|
1121
|
+
"aria-busy": v,
|
|
1119
1122
|
children: [
|
|
1120
|
-
|
|
1123
|
+
v ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ie, { className: "h-5 w-5" }),
|
|
1121
1124
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
1122
1125
|
]
|
|
1123
1126
|
}
|
|
@@ -1125,16 +1128,16 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1125
1128
|
ce,
|
|
1126
1129
|
{
|
|
1127
1130
|
onClick: k,
|
|
1128
|
-
disabled:
|
|
1129
|
-
"aria-busy":
|
|
1131
|
+
disabled: v,
|
|
1132
|
+
"aria-busy": v,
|
|
1130
1133
|
children: [
|
|
1131
|
-
|
|
1134
|
+
v ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ie, { className: "h-5 w-5" }),
|
|
1132
1135
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
1133
1136
|
]
|
|
1134
1137
|
}
|
|
1135
1138
|
) }),
|
|
1136
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ce, { variant: "danger", onClick:
|
|
1137
|
-
/* @__PURE__ */ e(
|
|
1139
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ce, { variant: "danger", onClick: d, children: [
|
|
1140
|
+
/* @__PURE__ */ e(Bs, { className: "h-5 w-5" }),
|
|
1138
1141
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
1139
1142
|
] }) })
|
|
1140
1143
|
] })
|
|
@@ -1152,45 +1155,45 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1152
1155
|
showDeleteConversation: c = !0,
|
|
1153
1156
|
onDeleteConversationClick: a,
|
|
1154
1157
|
onBlockParticipantClick: u,
|
|
1155
|
-
onReportParticipantClick:
|
|
1158
|
+
onReportParticipantClick: h
|
|
1156
1159
|
}) => {
|
|
1157
|
-
const { channel: x } = Te(), y = W(null),
|
|
1160
|
+
const { channel: x } = Te(), y = W(null), f = P.useMemo(() => Object.values(x.state.members || {}).find(
|
|
1158
1161
|
(C) => {
|
|
1159
|
-
var
|
|
1160
|
-
return ((
|
|
1162
|
+
var v;
|
|
1163
|
+
return ((v = C.user) == null ? void 0 : v.id) && C.user.id !== x._client.userID;
|
|
1161
1164
|
}
|
|
1162
1165
|
), [x._client.userID, x.state.members]), o = P.useMemo(() => {
|
|
1163
|
-
const
|
|
1164
|
-
if (
|
|
1165
|
-
return String(
|
|
1166
|
-
if (
|
|
1167
|
-
return
|
|
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";
|
|
1168
1171
|
}, [x.data]), _ = T(() => {
|
|
1169
|
-
var
|
|
1170
|
-
(
|
|
1172
|
+
var m;
|
|
1173
|
+
(m = y.current) == null || m.showModal();
|
|
1171
1174
|
}, []), E = T(() => {
|
|
1172
|
-
var
|
|
1173
|
-
(
|
|
1175
|
+
var m;
|
|
1176
|
+
(m = y.current) == null || m.close();
|
|
1174
1177
|
}, []);
|
|
1175
1178
|
return /* @__PURE__ */ i(be, { children: [
|
|
1176
1179
|
/* @__PURE__ */ e(
|
|
1177
|
-
|
|
1180
|
+
Ds,
|
|
1178
1181
|
{
|
|
1179
1182
|
overrides: {
|
|
1180
|
-
Message: (
|
|
1183
|
+
Message: (m) => /* @__PURE__ */ e(Xs, { ...m })
|
|
1181
1184
|
},
|
|
1182
|
-
children: /* @__PURE__ */ i(
|
|
1185
|
+
children: /* @__PURE__ */ i(Fs, { children: [
|
|
1183
1186
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
1184
1187
|
ot,
|
|
1185
1188
|
{
|
|
1186
1189
|
onBack: t,
|
|
1187
1190
|
showBackButton: s,
|
|
1188
1191
|
onShowInfo: _,
|
|
1189
|
-
canShowInfo: !!
|
|
1192
|
+
canShowInfo: !!f
|
|
1190
1193
|
}
|
|
1191
1194
|
) }),
|
|
1192
1195
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1193
|
-
|
|
1196
|
+
Ls,
|
|
1194
1197
|
{
|
|
1195
1198
|
hideDeletedMessages: !0,
|
|
1196
1199
|
hideNewMessageSeparator: !1,
|
|
@@ -1211,7 +1214,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1211
1214
|
{
|
|
1212
1215
|
dialogRef: y,
|
|
1213
1216
|
onClose: E,
|
|
1214
|
-
participant:
|
|
1217
|
+
participant: f,
|
|
1215
1218
|
channel: x,
|
|
1216
1219
|
followerStatusLabel: o,
|
|
1217
1220
|
onLeaveConversation: r,
|
|
@@ -1219,11 +1222,11 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1219
1222
|
showDeleteConversation: c,
|
|
1220
1223
|
onDeleteConversationClick: a,
|
|
1221
1224
|
onBlockParticipantClick: u,
|
|
1222
|
-
onReportParticipantClick:
|
|
1225
|
+
onReportParticipantClick: h
|
|
1223
1226
|
}
|
|
1224
1227
|
)
|
|
1225
1228
|
] });
|
|
1226
|
-
},
|
|
1229
|
+
}, Ae = P.memo(
|
|
1227
1230
|
({
|
|
1228
1231
|
channel: t,
|
|
1229
1232
|
onBack: s,
|
|
@@ -1233,10 +1236,10 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1233
1236
|
onBlockParticipant: c,
|
|
1234
1237
|
className: a,
|
|
1235
1238
|
CustomChannelEmptyState: u = at,
|
|
1236
|
-
showDeleteConversation:
|
|
1239
|
+
showDeleteConversation: h = !0,
|
|
1237
1240
|
onDeleteConversationClick: x,
|
|
1238
1241
|
onBlockParticipantClick: y,
|
|
1239
|
-
onReportParticipantClick:
|
|
1242
|
+
onReportParticipantClick: f
|
|
1240
1243
|
}) => /* @__PURE__ */ e(
|
|
1241
1244
|
"div",
|
|
1242
1245
|
{
|
|
@@ -1245,13 +1248,13 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1245
1248
|
a
|
|
1246
1249
|
),
|
|
1247
1250
|
children: /* @__PURE__ */ e(
|
|
1248
|
-
|
|
1251
|
+
Ts,
|
|
1249
1252
|
{
|
|
1250
1253
|
channel: t,
|
|
1251
1254
|
MessageSystem: rt,
|
|
1252
1255
|
EmptyStateIndicator: u,
|
|
1253
1256
|
LoadingIndicator: ue,
|
|
1254
|
-
DateSeparator:
|
|
1257
|
+
DateSeparator: Ys,
|
|
1255
1258
|
children: /* @__PURE__ */ e(
|
|
1256
1259
|
ct,
|
|
1257
1260
|
{
|
|
@@ -1261,10 +1264,10 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1261
1264
|
onLeaveConversation: l,
|
|
1262
1265
|
onBlockParticipant: c,
|
|
1263
1266
|
CustomChannelEmptyState: u,
|
|
1264
|
-
showDeleteConversation:
|
|
1267
|
+
showDeleteConversation: h,
|
|
1265
1268
|
onDeleteConversationClick: x,
|
|
1266
1269
|
onBlockParticipantClick: y,
|
|
1267
|
-
onReportParticipantClick:
|
|
1270
|
+
onReportParticipantClick: f
|
|
1268
1271
|
}
|
|
1269
1272
|
)
|
|
1270
1273
|
}
|
|
@@ -1272,7 +1275,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1272
1275
|
}
|
|
1273
1276
|
)
|
|
1274
1277
|
);
|
|
1275
|
-
|
|
1278
|
+
Ae.displayName = "ChannelView";
|
|
1276
1279
|
function dt({
|
|
1277
1280
|
searchQuery: t,
|
|
1278
1281
|
setSearchQuery: s,
|
|
@@ -1281,7 +1284,7 @@ function dt({
|
|
|
1281
1284
|
const r = W(null);
|
|
1282
1285
|
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1283
1286
|
/* @__PURE__ */ e(
|
|
1284
|
-
|
|
1287
|
+
As,
|
|
1285
1288
|
{
|
|
1286
1289
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1287
1290
|
weight: "bold"
|
|
@@ -1299,7 +1302,7 @@ function dt({
|
|
|
1299
1302
|
}
|
|
1300
1303
|
),
|
|
1301
1304
|
t && /* @__PURE__ */ e(
|
|
1302
|
-
|
|
1305
|
+
Ue,
|
|
1303
1306
|
{
|
|
1304
1307
|
label: "Clear search",
|
|
1305
1308
|
onClick: () => {
|
|
@@ -1321,9 +1324,9 @@ const mt = ({
|
|
|
1321
1324
|
searchPlaceholder: c = "Search participants...",
|
|
1322
1325
|
className: a
|
|
1323
1326
|
}) => {
|
|
1324
|
-
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(
|
|
1325
1328
|
null
|
|
1326
|
-
),
|
|
1329
|
+
), w = W(!1);
|
|
1327
1330
|
Z(() => {
|
|
1328
1331
|
if (t.loading) {
|
|
1329
1332
|
u && console.log(
|
|
@@ -1331,52 +1334,52 @@ const mt = ({
|
|
|
1331
1334
|
);
|
|
1332
1335
|
return;
|
|
1333
1336
|
}
|
|
1334
|
-
if (
|
|
1337
|
+
if (w.current) return;
|
|
1335
1338
|
(async () => {
|
|
1336
|
-
u && console.log("[ParticipantPicker] Loading initial participants..."), _(!0),
|
|
1339
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), _(!0), m(null);
|
|
1337
1340
|
try {
|
|
1338
|
-
const
|
|
1341
|
+
const d = await t.loadParticipants({
|
|
1339
1342
|
search: "",
|
|
1340
1343
|
// Load all participants initially
|
|
1341
1344
|
limit: 100
|
|
1342
1345
|
});
|
|
1343
|
-
|
|
1346
|
+
f(d.participants), w.current = !0, u && console.log(
|
|
1344
1347
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1345
|
-
|
|
1348
|
+
d.participants.length
|
|
1346
1349
|
);
|
|
1347
|
-
} catch (
|
|
1348
|
-
const
|
|
1349
|
-
|
|
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);
|
|
1350
1353
|
} finally {
|
|
1351
1354
|
_(!1);
|
|
1352
1355
|
}
|
|
1353
1356
|
})();
|
|
1354
1357
|
}, [t.loading, u]);
|
|
1355
|
-
const S = y.filter((
|
|
1356
|
-
var
|
|
1357
|
-
if (!
|
|
1358
|
-
const
|
|
1359
|
-
return
|
|
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;
|
|
1360
1363
|
}), b = T(
|
|
1361
|
-
async (
|
|
1364
|
+
async (g) => {
|
|
1362
1365
|
if (!C) {
|
|
1363
|
-
|
|
1366
|
+
v(g.id);
|
|
1364
1367
|
try {
|
|
1365
|
-
await s(
|
|
1366
|
-
} catch (
|
|
1367
|
-
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);
|
|
1368
1371
|
}
|
|
1369
1372
|
}
|
|
1370
1373
|
},
|
|
1371
1374
|
[s, C]
|
|
1372
|
-
), k = (
|
|
1373
|
-
(
|
|
1375
|
+
), k = (g, d) => {
|
|
1376
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), b(d));
|
|
1374
1377
|
};
|
|
1375
1378
|
return /* @__PURE__ */ i("div", { className: M("flex flex-col h-full", a), children: [
|
|
1376
1379
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1377
1380
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1378
1381
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1379
|
-
/* @__PURE__ */ e(
|
|
1382
|
+
/* @__PURE__ */ e(Be, { onClick: n })
|
|
1380
1383
|
] }),
|
|
1381
1384
|
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1382
1385
|
"Select a ",
|
|
@@ -1389,7 +1392,7 @@ const mt = ({
|
|
|
1389
1392
|
/* @__PURE__ */ e(
|
|
1390
1393
|
dt,
|
|
1391
1394
|
{
|
|
1392
|
-
searchQuery:
|
|
1395
|
+
searchQuery: h,
|
|
1393
1396
|
setSearchQuery: x,
|
|
1394
1397
|
placeholder: c
|
|
1395
1398
|
}
|
|
@@ -1410,38 +1413,38 @@ const mt = ({
|
|
|
1410
1413
|
] })
|
|
1411
1414
|
] }) }) : S.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1412
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" }) }),
|
|
1413
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children:
|
|
1414
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children:
|
|
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` })
|
|
1415
1418
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1416
|
-
S.map((
|
|
1417
|
-
const
|
|
1419
|
+
S.map((g) => {
|
|
1420
|
+
const d = g.name || g.email || g.id, N = g.email && g.name ? g.email : g.phone;
|
|
1418
1421
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1419
1422
|
"button",
|
|
1420
1423
|
{
|
|
1421
1424
|
type: "button",
|
|
1422
|
-
onClick: () => b(
|
|
1423
|
-
onKeyDown: (
|
|
1425
|
+
onClick: () => b(g),
|
|
1426
|
+
onKeyDown: (O) => k(O, g),
|
|
1424
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",
|
|
1425
1428
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1426
1429
|
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1427
1430
|
/* @__PURE__ */ e(
|
|
1428
1431
|
te,
|
|
1429
1432
|
{
|
|
1430
|
-
id:
|
|
1431
|
-
name:
|
|
1432
|
-
image:
|
|
1433
|
+
id: g.id,
|
|
1434
|
+
name: d,
|
|
1435
|
+
image: g.image,
|
|
1433
1436
|
size: 40
|
|
1434
1437
|
}
|
|
1435
1438
|
),
|
|
1436
1439
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1437
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1438
|
-
|
|
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 })
|
|
1439
1442
|
] })
|
|
1440
1443
|
] }),
|
|
1441
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: C ===
|
|
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" }) })
|
|
1442
1445
|
] })
|
|
1443
1446
|
}
|
|
1444
|
-
) },
|
|
1447
|
+
) }, g.id);
|
|
1445
1448
|
}),
|
|
1446
1449
|
o && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1447
1450
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
@@ -1583,7 +1586,7 @@ const mt = ({
|
|
|
1583
1586
|
] })
|
|
1584
1587
|
]
|
|
1585
1588
|
}
|
|
1586
|
-
),
|
|
1589
|
+
), je = P.memo(
|
|
1587
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: [
|
|
1588
1591
|
/* @__PURE__ */ e(ut, {}),
|
|
1589
1592
|
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
@@ -1592,7 +1595,7 @@ const mt = ({
|
|
|
1592
1595
|
] })
|
|
1593
1596
|
] }) })
|
|
1594
1597
|
);
|
|
1595
|
-
|
|
1598
|
+
je.displayName = "EmptyState";
|
|
1596
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: [
|
|
1597
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: "โ ๏ธ" }) }),
|
|
1598
1601
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
@@ -1617,82 +1620,82 @@ const pt = ({
|
|
|
1617
1620
|
initialParticipantFilter: c,
|
|
1618
1621
|
initialParticipantData: a,
|
|
1619
1622
|
CustomChannelEmptyState: u,
|
|
1620
|
-
showChannelList:
|
|
1623
|
+
showChannelList: h = !0,
|
|
1621
1624
|
filters: x,
|
|
1622
1625
|
channelListCustomEmptyStateIndicator: y,
|
|
1623
|
-
onDeleteConversationClick:
|
|
1626
|
+
onDeleteConversationClick: f,
|
|
1624
1627
|
onBlockParticipantClick: o,
|
|
1625
1628
|
onReportParticipantClick: _
|
|
1626
1629
|
}) => {
|
|
1627
1630
|
const {
|
|
1628
1631
|
service: E,
|
|
1629
|
-
client:
|
|
1632
|
+
client: m,
|
|
1630
1633
|
isConnected: C,
|
|
1631
|
-
isLoading:
|
|
1632
|
-
error:
|
|
1634
|
+
isLoading: v,
|
|
1635
|
+
error: w,
|
|
1633
1636
|
refreshConnection: S,
|
|
1634
1637
|
debug: b
|
|
1635
|
-
} =
|
|
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), {
|
|
1636
1639
|
participantSource: D,
|
|
1637
|
-
participantLabel:
|
|
1638
|
-
showDeleteConversation:
|
|
1640
|
+
participantLabel: B = "participants",
|
|
1641
|
+
showDeleteConversation: $ = !0
|
|
1639
1642
|
} = t, se = P.useMemo(() => {
|
|
1640
|
-
const
|
|
1643
|
+
const p = m == null ? void 0 : m.userID;
|
|
1641
1644
|
return {
|
|
1642
1645
|
...{
|
|
1643
1646
|
type: "messaging",
|
|
1644
1647
|
last_message_at: { $exists: !0 },
|
|
1645
|
-
...
|
|
1646
|
-
members: { $in: [
|
|
1648
|
+
...p && {
|
|
1649
|
+
members: { $in: [p] },
|
|
1647
1650
|
hidden: !1
|
|
1648
1651
|
}
|
|
1649
1652
|
},
|
|
1650
1653
|
...x
|
|
1651
1654
|
};
|
|
1652
|
-
}, [x,
|
|
1653
|
-
if (!
|
|
1654
|
-
const
|
|
1655
|
-
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)
|
|
1656
1659
|
try {
|
|
1657
|
-
b && console.log("[MessagingShell] Syncing channels for user:",
|
|
1658
|
-
const L = await
|
|
1660
|
+
b && console.log("[MessagingShell] Syncing channels for user:", p);
|
|
1661
|
+
const L = await m.queryChannels(
|
|
1659
1662
|
{
|
|
1660
1663
|
type: "messaging",
|
|
1661
|
-
members: { $in: [
|
|
1664
|
+
members: { $in: [p] }
|
|
1662
1665
|
},
|
|
1663
1666
|
{},
|
|
1664
1667
|
{ limit: 100 }
|
|
1665
1668
|
), F = /* @__PURE__ */ new Set();
|
|
1666
|
-
L.forEach((
|
|
1667
|
-
const xe =
|
|
1668
|
-
Object.values(xe).forEach((
|
|
1669
|
+
L.forEach((A) => {
|
|
1670
|
+
const xe = A.state.members;
|
|
1671
|
+
Object.values(xe).forEach(($e) => {
|
|
1669
1672
|
var ve;
|
|
1670
|
-
const Ce = (ve =
|
|
1671
|
-
Ce && Ce !==
|
|
1673
|
+
const Ce = (ve = $e.user) == null ? void 0 : ve.id;
|
|
1674
|
+
Ce && Ce !== p && F.add(Ce);
|
|
1672
1675
|
});
|
|
1673
|
-
}), 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:", {
|
|
1674
1677
|
channelCount: L.length,
|
|
1675
1678
|
memberCount: F.size
|
|
1676
1679
|
});
|
|
1677
1680
|
} catch (L) {
|
|
1678
1681
|
console.error("[MessagingShell] Failed to sync channels:", L);
|
|
1679
1682
|
}
|
|
1680
|
-
}, [
|
|
1683
|
+
}, [m, C, b]);
|
|
1681
1684
|
Z(() => {
|
|
1682
|
-
if (!
|
|
1683
|
-
const
|
|
1684
|
-
|
|
1685
|
-
}, [
|
|
1686
|
-
if (!c || !
|
|
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;
|
|
1687
1690
|
(async () => {
|
|
1688
|
-
const L =
|
|
1691
|
+
const L = m.userID;
|
|
1689
1692
|
if (L)
|
|
1690
1693
|
try {
|
|
1691
1694
|
b && console.log(
|
|
1692
1695
|
"[MessagingShell] Loading initial conversation with:",
|
|
1693
1696
|
c
|
|
1694
1697
|
);
|
|
1695
|
-
const F = await
|
|
1698
|
+
const F = await m.queryChannels(
|
|
1696
1699
|
{
|
|
1697
1700
|
type: "messaging",
|
|
1698
1701
|
members: { $eq: [L, c] }
|
|
@@ -1701,7 +1704,7 @@ const pt = ({
|
|
|
1701
1704
|
{ limit: 1 }
|
|
1702
1705
|
);
|
|
1703
1706
|
if (F.length > 0)
|
|
1704
|
-
|
|
1707
|
+
g(F[0]), H(!0), G(null), r && r(F[0]), b && console.log(
|
|
1705
1708
|
"[MessagingShell] Initial conversation loaded:",
|
|
1706
1709
|
F[0].id
|
|
1707
1710
|
);
|
|
@@ -1711,24 +1714,24 @@ const pt = ({
|
|
|
1711
1714
|
a
|
|
1712
1715
|
);
|
|
1713
1716
|
try {
|
|
1714
|
-
const
|
|
1717
|
+
const A = await E.startChannelWithParticipant({
|
|
1715
1718
|
id: a.id,
|
|
1716
1719
|
name: a.name,
|
|
1717
1720
|
email: a.email,
|
|
1718
1721
|
phone: a.phone
|
|
1719
1722
|
});
|
|
1720
|
-
|
|
1723
|
+
g(A), H(!0), G(null), r && r(A), b && console.log(
|
|
1721
1724
|
"[MessagingShell] Channel created and loaded:",
|
|
1722
|
-
|
|
1725
|
+
A.id
|
|
1723
1726
|
);
|
|
1724
|
-
} catch (
|
|
1727
|
+
} catch (A) {
|
|
1725
1728
|
console.error(
|
|
1726
1729
|
"[MessagingShell] Failed to create conversation:",
|
|
1727
|
-
|
|
1728
|
-
),
|
|
1730
|
+
A
|
|
1731
|
+
), G("Failed to create conversation");
|
|
1729
1732
|
}
|
|
1730
1733
|
} else
|
|
1731
|
-
|
|
1734
|
+
G(
|
|
1732
1735
|
"No conversation found with this account"
|
|
1733
1736
|
), b && console.log(
|
|
1734
1737
|
"[MessagingShell] No conversation found for:",
|
|
@@ -1738,71 +1741,71 @@ const pt = ({
|
|
|
1738
1741
|
console.error(
|
|
1739
1742
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1740
1743
|
F
|
|
1741
|
-
),
|
|
1744
|
+
), G("Failed to load conversation");
|
|
1742
1745
|
}
|
|
1743
1746
|
})();
|
|
1744
1747
|
}, [
|
|
1745
1748
|
c,
|
|
1746
1749
|
a,
|
|
1747
|
-
|
|
1750
|
+
m,
|
|
1748
1751
|
C,
|
|
1749
1752
|
E,
|
|
1750
1753
|
b,
|
|
1751
1754
|
r
|
|
1752
1755
|
]);
|
|
1753
1756
|
const le = T(
|
|
1754
|
-
(
|
|
1755
|
-
|
|
1757
|
+
(p) => {
|
|
1758
|
+
g(p), r == null || r(p);
|
|
1756
1759
|
},
|
|
1757
1760
|
[r]
|
|
1758
1761
|
), oe = T(() => {
|
|
1759
|
-
|
|
1760
|
-
}, [
|
|
1761
|
-
async (
|
|
1762
|
+
U || g(null);
|
|
1763
|
+
}, [U]), ae = T(
|
|
1764
|
+
async (p) => {
|
|
1762
1765
|
var L;
|
|
1763
1766
|
if (E)
|
|
1764
1767
|
try {
|
|
1765
1768
|
b && console.log(
|
|
1766
1769
|
"[MessagingShell] Starting conversation with:",
|
|
1767
|
-
|
|
1770
|
+
p.id
|
|
1768
1771
|
);
|
|
1769
1772
|
const F = await E.startChannelWithParticipant({
|
|
1770
|
-
id:
|
|
1771
|
-
name:
|
|
1772
|
-
email:
|
|
1773
|
-
phone:
|
|
1773
|
+
id: p.id,
|
|
1774
|
+
name: p.name,
|
|
1775
|
+
email: p.email,
|
|
1776
|
+
phone: p.phone
|
|
1774
1777
|
});
|
|
1775
1778
|
try {
|
|
1776
1779
|
await F.show();
|
|
1777
|
-
} catch (
|
|
1778
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1780
|
+
} catch (A) {
|
|
1781
|
+
console.warn("[MessagingShell] Failed to unhide channel:", A);
|
|
1779
1782
|
}
|
|
1780
|
-
|
|
1783
|
+
g(F), Y(!1), (L = R.current) == null || L.close(), l == null || l(p);
|
|
1781
1784
|
} catch (F) {
|
|
1782
1785
|
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
1783
1786
|
}
|
|
1784
1787
|
},
|
|
1785
1788
|
[E, l, b]
|
|
1786
|
-
),
|
|
1787
|
-
var
|
|
1788
|
-
Y(!1), (
|
|
1789
|
+
), z = T(() => {
|
|
1790
|
+
var p;
|
|
1791
|
+
Y(!1), (p = R.current) == null || p.close();
|
|
1789
1792
|
}, []), fe = T(
|
|
1790
|
-
(
|
|
1791
|
-
|
|
1793
|
+
(p) => {
|
|
1794
|
+
p.target === R.current && z();
|
|
1792
1795
|
},
|
|
1793
|
-
[
|
|
1796
|
+
[z]
|
|
1794
1797
|
), ie = T(
|
|
1795
|
-
async (
|
|
1796
|
-
b && console.log("[MessagingShell] Leaving conversation:",
|
|
1798
|
+
async (p) => {
|
|
1799
|
+
b && console.log("[MessagingShell] Leaving conversation:", p.id), g(null), H(!1), Q.current = null, await V();
|
|
1797
1800
|
},
|
|
1798
1801
|
[V, b]
|
|
1799
1802
|
), ge = T(
|
|
1800
|
-
async (
|
|
1801
|
-
b && console.log("[MessagingShell] Blocking participant:",
|
|
1803
|
+
async (p) => {
|
|
1804
|
+
b && console.log("[MessagingShell] Blocking participant:", p), g(null), H(!1), Q.current = null, await V();
|
|
1802
1805
|
},
|
|
1803
1806
|
[V, b]
|
|
1804
1807
|
), X = !!k;
|
|
1805
|
-
return
|
|
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(
|
|
1806
1809
|
me,
|
|
1807
1810
|
{
|
|
1808
1811
|
message: "Not connected to messaging service",
|
|
@@ -1823,15 +1826,15 @@ const pt = ({
|
|
|
1823
1826
|
className: M(
|
|
1824
1827
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1825
1828
|
{
|
|
1826
|
-
"!hidden":
|
|
1829
|
+
"!hidden": h === !1 || U,
|
|
1827
1830
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
1828
|
-
"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,
|
|
1829
1832
|
// Show on mobile when no channel selected, use same wide width on desktop
|
|
1830
|
-
"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
|
|
1831
1834
|
}
|
|
1832
1835
|
),
|
|
1833
1836
|
children: /* @__PURE__ */ e(
|
|
1834
|
-
|
|
1837
|
+
Oe,
|
|
1835
1838
|
{
|
|
1836
1839
|
onChannelSelect: le,
|
|
1837
1840
|
selectedChannel: k || void 0,
|
|
@@ -1848,23 +1851,23 @@ const pt = ({
|
|
|
1848
1851
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1849
1852
|
{
|
|
1850
1853
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1851
|
-
flex:
|
|
1854
|
+
flex: U || X || c,
|
|
1852
1855
|
// Normal mode: hide on mobile when no channel selected
|
|
1853
|
-
"hidden lg:flex": !
|
|
1856
|
+
"hidden lg:flex": !U && !X && !c
|
|
1854
1857
|
}
|
|
1855
1858
|
),
|
|
1856
1859
|
children: k ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1857
|
-
|
|
1860
|
+
Ae,
|
|
1858
1861
|
{
|
|
1859
1862
|
channel: k,
|
|
1860
1863
|
onBack: oe,
|
|
1861
|
-
showBackButton: !
|
|
1864
|
+
showBackButton: !U,
|
|
1862
1865
|
renderMessageInputActions: n,
|
|
1863
1866
|
onLeaveConversation: ie,
|
|
1864
1867
|
onBlockParticipant: ge,
|
|
1865
1868
|
CustomChannelEmptyState: u,
|
|
1866
|
-
showDeleteConversation:
|
|
1867
|
-
onDeleteConversationClick:
|
|
1869
|
+
showDeleteConversation: $,
|
|
1870
|
+
onDeleteConversationClick: f,
|
|
1868
1871
|
onBlockParticipantClick: o,
|
|
1869
1872
|
onReportParticipantClick: _
|
|
1870
1873
|
},
|
|
@@ -1873,10 +1876,10 @@ const pt = ({
|
|
|
1873
1876
|
// Show loading while creating/loading direct conversation channel
|
|
1874
1877
|
/* @__PURE__ */ e(ue, {})
|
|
1875
1878
|
) : /* @__PURE__ */ e(
|
|
1876
|
-
|
|
1879
|
+
je,
|
|
1877
1880
|
{
|
|
1878
|
-
hasChannels:
|
|
1879
|
-
channelsLoaded:
|
|
1881
|
+
hasChannels: d,
|
|
1882
|
+
channelsLoaded: O
|
|
1880
1883
|
}
|
|
1881
1884
|
)
|
|
1882
1885
|
}
|
|
@@ -1889,16 +1892,16 @@ const pt = ({
|
|
|
1889
1892
|
ref: R,
|
|
1890
1893
|
className: "mes-dialog",
|
|
1891
1894
|
onClick: fe,
|
|
1892
|
-
onClose:
|
|
1895
|
+
onClose: z,
|
|
1893
1896
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1894
1897
|
mt,
|
|
1895
1898
|
{
|
|
1896
1899
|
participantSource: D,
|
|
1897
1900
|
onSelectParticipant: ae,
|
|
1898
|
-
onClose:
|
|
1901
|
+
onClose: z,
|
|
1899
1902
|
existingParticipantIds: ne,
|
|
1900
|
-
participantLabel:
|
|
1901
|
-
searchPlaceholder: `Search ${
|
|
1903
|
+
participantLabel: B,
|
|
1904
|
+
searchPlaceholder: `Search ${B}...`
|
|
1902
1905
|
},
|
|
1903
1906
|
ee
|
|
1904
1907
|
) })
|
|
@@ -1938,7 +1941,7 @@ const pt = ({
|
|
|
1938
1941
|
avatarImage: c,
|
|
1939
1942
|
avatarName: a
|
|
1940
1943
|
}) => {
|
|
1941
|
-
const u = t.filter((
|
|
1944
|
+
const u = t.filter((h) => h.enabled).sort((h, x) => (h.order ?? 0) - (x.order ?? 0));
|
|
1942
1945
|
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1943
1946
|
(c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1944
1947
|
te,
|
|
@@ -1957,72 +1960,72 @@ const pt = ({
|
|
|
1957
1960
|
style: { backgroundColor: "#F1F0EE" },
|
|
1958
1961
|
children: [
|
|
1959
1962
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1960
|
-
u.map((
|
|
1963
|
+
u.map((h) => /* @__PURE__ */ e(
|
|
1961
1964
|
ht,
|
|
1962
1965
|
{
|
|
1963
|
-
question:
|
|
1964
|
-
onClick: () => s(
|
|
1965
|
-
loading: n ===
|
|
1966
|
+
question: h.question,
|
|
1967
|
+
onClick: () => s(h.id),
|
|
1968
|
+
loading: n === h.id
|
|
1966
1969
|
},
|
|
1967
|
-
|
|
1970
|
+
h.id
|
|
1968
1971
|
))
|
|
1969
1972
|
]
|
|
1970
1973
|
}
|
|
1971
1974
|
)
|
|
1972
1975
|
] }) });
|
|
1973
1976
|
}, Et = (t, s = {}) => {
|
|
1974
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [l, c] = I([]), [a, u] = I(!1), [
|
|
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) => {
|
|
1975
1978
|
if (a) return;
|
|
1976
|
-
const
|
|
1979
|
+
const g = k !== void 0 ? k : y;
|
|
1977
1980
|
u(!0), x(null);
|
|
1978
1981
|
try {
|
|
1979
|
-
const
|
|
1980
|
-
search:
|
|
1982
|
+
const d = await t.loadParticipants({
|
|
1983
|
+
search: g || void 0,
|
|
1981
1984
|
limit: r,
|
|
1982
1985
|
cursor: b ? void 0 : E
|
|
1983
1986
|
});
|
|
1984
1987
|
c(
|
|
1985
|
-
(
|
|
1986
|
-
), _(
|
|
1987
|
-
} catch (
|
|
1988
|
-
const
|
|
1989
|
-
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);
|
|
1990
1993
|
} finally {
|
|
1991
1994
|
u(!1);
|
|
1992
1995
|
}
|
|
1993
|
-
}, [t, y, E, r, a]),
|
|
1996
|
+
}, [t, y, E, r, a]), v = T(() => {
|
|
1994
1997
|
o && !a && C(!1);
|
|
1995
|
-
}, [o, a, C]),
|
|
1996
|
-
|
|
1998
|
+
}, [o, a, C]), w = T((b) => {
|
|
1999
|
+
f(b), m(void 0), C(!0, b);
|
|
1997
2000
|
}, [C]), S = T(() => {
|
|
1998
|
-
|
|
2001
|
+
m(void 0), C(!0);
|
|
1999
2002
|
}, [C]);
|
|
2000
2003
|
return Z(() => {
|
|
2001
2004
|
C(!0);
|
|
2002
2005
|
}, [t.loadParticipants]), {
|
|
2003
2006
|
participants: l,
|
|
2004
2007
|
loading: a,
|
|
2005
|
-
error:
|
|
2008
|
+
error: h,
|
|
2006
2009
|
searchQuery: y,
|
|
2007
2010
|
hasMore: o,
|
|
2008
2011
|
totalCount: t.totalCount,
|
|
2009
|
-
loadMore:
|
|
2010
|
-
search:
|
|
2012
|
+
loadMore: v,
|
|
2013
|
+
search: w,
|
|
2011
2014
|
refresh: S
|
|
2012
2015
|
};
|
|
2013
2016
|
};
|
|
2014
2017
|
export {
|
|
2015
2018
|
te as Avatar,
|
|
2016
2019
|
at as ChannelEmptyState,
|
|
2017
|
-
|
|
2018
|
-
|
|
2020
|
+
Oe as ChannelList,
|
|
2021
|
+
Ae as ChannelView,
|
|
2019
2022
|
yt as FaqList,
|
|
2020
2023
|
ht as FaqListItem,
|
|
2021
2024
|
wt as MessagingProvider,
|
|
2022
2025
|
pt as MessagingShell,
|
|
2023
2026
|
mt as ParticipantPicker,
|
|
2024
|
-
|
|
2025
|
-
|
|
2027
|
+
zs as formatRelativeTime,
|
|
2028
|
+
js as useMessaging,
|
|
2026
2029
|
Et as useParticipants
|
|
2027
2030
|
};
|
|
2028
2031
|
//# sourceMappingURL=index.js.map
|