@linktr.ee/messaging-react 1.15.0 โ 1.15.2-rc-1769487638
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,37 @@ 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,
|
|
628
|
+
style: {
|
|
629
|
+
// Force margins to 0 to prevent hover layout shift
|
|
630
|
+
// Stream Chat CSS sets margin-inline-end/start to 78px, then 0 on hover
|
|
631
|
+
marginInlineEnd: 0,
|
|
632
|
+
marginInlineStart: 0
|
|
633
|
+
},
|
|
625
634
|
children: ge ? (
|
|
626
635
|
/* Tip-only messages render as a standalone bubble */
|
|
627
636
|
/* @__PURE__ */ e(ke, { message: o, standalone: !0 })
|
|
628
637
|
) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
629
638
|
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
630
|
-
ie && /* @__PURE__ */ e(
|
|
631
|
-
|
|
632
|
-
|
|
639
|
+
ie && /* @__PURE__ */ e(Cs, { poll: ie }),
|
|
640
|
+
$ != null && $.length && !o.quoted_message ? /* @__PURE__ */ e(
|
|
641
|
+
N,
|
|
633
642
|
{
|
|
634
643
|
actionHandler: a,
|
|
635
|
-
attachments:
|
|
644
|
+
attachments: $
|
|
636
645
|
}
|
|
637
646
|
) : null,
|
|
638
|
-
|
|
647
|
+
B ? /* @__PURE__ */ e(
|
|
639
648
|
J,
|
|
640
649
|
{
|
|
641
650
|
message: o,
|
|
642
|
-
renderText:
|
|
651
|
+
renderText: m
|
|
643
652
|
}
|
|
644
|
-
) : /* @__PURE__ */ e(
|
|
645
|
-
/* @__PURE__ */ e(
|
|
653
|
+
) : /* @__PURE__ */ e(bs, { message: o, renderText: m }),
|
|
654
|
+
/* @__PURE__ */ e(Ns, {})
|
|
646
655
|
] }),
|
|
647
656
|
/* @__PURE__ */ e(ke, { message: o })
|
|
648
657
|
] })
|
|
@@ -658,18 +667,18 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
658
667
|
V && /* @__PURE__ */ e(K, {}),
|
|
659
668
|
se && /* @__PURE__ */ i("div", { className: "str-chat__message-metadata", children: [
|
|
660
669
|
/* @__PURE__ */ e(re, {}),
|
|
661
|
-
!
|
|
662
|
-
/* @__PURE__ */ e(
|
|
663
|
-
ae && /* @__PURE__ */ e("span", { className: "str-chat__mesage-simple-edited", children:
|
|
664
|
-
ae && /* @__PURE__ */ e(
|
|
670
|
+
!f() && !!o.user && /* @__PURE__ */ e("span", { className: "str-chat__message-simple-name", children: o.user.name || o.user.id }),
|
|
671
|
+
/* @__PURE__ */ e(U, { customClass: "str-chat__message-simple-timestamp" }),
|
|
672
|
+
ae && /* @__PURE__ */ e("span", { className: "str-chat__mesage-simple-edited", children: w("Edited") }),
|
|
673
|
+
ae && /* @__PURE__ */ e(vs, { calendar: !0, open: k })
|
|
665
674
|
] })
|
|
666
675
|
] }, o.id)
|
|
667
676
|
] });
|
|
668
677
|
}, Qs = P.memo(
|
|
669
678
|
Js,
|
|
670
|
-
|
|
679
|
+
qe
|
|
671
680
|
), Xs = (t) => {
|
|
672
|
-
const s =
|
|
681
|
+
const s = ws("CustomMessage");
|
|
673
682
|
return /* @__PURE__ */ e(Qs, { ...s, ...t });
|
|
674
683
|
}, Ks = (t) => ({
|
|
675
684
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
@@ -716,7 +725,7 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
716
725
|
}
|
|
717
726
|
);
|
|
718
727
|
}, st = () => {
|
|
719
|
-
const { linkPreviewsManager: t } =
|
|
728
|
+
const { linkPreviewsManager: t } = ps(), { linkPreviews: s } = ys(
|
|
720
729
|
t.state,
|
|
721
730
|
Ks
|
|
722
731
|
), n = (l) => {
|
|
@@ -731,16 +740,16 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
731
740
|
l.og_scrape_url
|
|
732
741
|
)) }) : null;
|
|
733
742
|
}, tt = () => {
|
|
734
|
-
const { handleSubmit: t } =
|
|
743
|
+
const { handleSubmit: t } = Is(), s = Ss();
|
|
735
744
|
return /* @__PURE__ */ i(be, { children: [
|
|
736
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
745
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(_s, {}) }),
|
|
737
746
|
/* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
|
|
738
|
-
/* @__PURE__ */ e(_s, {}),
|
|
739
|
-
/* @__PURE__ */ e(st, {}),
|
|
740
747
|
/* @__PURE__ */ e(Ms, {}),
|
|
748
|
+
/* @__PURE__ */ e(st, {}),
|
|
749
|
+
/* @__PURE__ */ e(ks, {}),
|
|
741
750
|
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
742
751
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
743
|
-
|
|
752
|
+
Rs,
|
|
744
753
|
{
|
|
745
754
|
className: "w-full resize-none outline-none leading-6",
|
|
746
755
|
autoFocus: !0,
|
|
@@ -756,7 +765,7 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
756
765
|
disabled: !s,
|
|
757
766
|
onClick: t,
|
|
758
767
|
type: "button",
|
|
759
|
-
children: /* @__PURE__ */ e(
|
|
768
|
+
children: /* @__PURE__ */ e(Os, { className: "size-4" })
|
|
760
769
|
}
|
|
761
770
|
)
|
|
762
771
|
] })
|
|
@@ -766,7 +775,7 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
766
775
|
renderActions: t
|
|
767
776
|
}) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
768
777
|
t && (t == null ? void 0 : t()),
|
|
769
|
-
/* @__PURE__ */ e(
|
|
778
|
+
/* @__PURE__ */ e(Es, { Input: tt })
|
|
770
779
|
] }), rt = (t) => {
|
|
771
780
|
const s = t.message.hide_date === !0;
|
|
772
781
|
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
@@ -826,27 +835,27 @@ const Hs = (t) => /* @__PURE__ */ e(We, { ...t, position: "center" }), Vs = () =
|
|
|
826
835
|
] }) }));
|
|
827
836
|
ue.displayName = "LoadingState";
|
|
828
837
|
const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
829
|
-
var
|
|
838
|
+
var f, o, _, E, m, C;
|
|
830
839
|
const { channel: l } = Te(), c = P.useMemo(() => Object.values(l.state.members || {}).find(
|
|
831
|
-
(
|
|
840
|
+
(w) => {
|
|
832
841
|
var S;
|
|
833
|
-
return ((S =
|
|
842
|
+
return ((S = w.user) == null ? void 0 : S.id) && w.user.id !== l._client.userID;
|
|
834
843
|
}
|
|
835
|
-
), [l._client.userID, l.state.members]), a = ((
|
|
844
|
+
), [l._client.userID, l.state.members]), a = ((f = c == null ? void 0 : c.user) == null ? void 0 : f.name) || ((o = c == null ? void 0 : c.user) == null ? void 0 : o.id) || "Unknown member", u = (_ = c == null ? void 0 : c.user) == null ? void 0 : _.image, [h, x] = I(!!((E = l.state.membership) != null && E.pinned_at));
|
|
836
845
|
Z(() => {
|
|
837
|
-
const
|
|
846
|
+
const v = (w) => {
|
|
838
847
|
var S;
|
|
839
|
-
x(
|
|
848
|
+
x(w != null && w.member ? !!w.member.pinned_at : !!((S = l.state.membership) != null && S.pinned_at));
|
|
840
849
|
};
|
|
841
|
-
return l.on("member.updated",
|
|
842
|
-
l.off("member.updated",
|
|
850
|
+
return l.on("member.updated", v), () => {
|
|
851
|
+
l.off("member.updated", v);
|
|
843
852
|
};
|
|
844
853
|
}, [l]);
|
|
845
854
|
const y = async () => {
|
|
846
855
|
try {
|
|
847
|
-
|
|
848
|
-
} catch (
|
|
849
|
-
console.error("[CustomChannelHeader] Failed to update pinned status:",
|
|
856
|
+
h ? await l.unpin() : await l.pin();
|
|
857
|
+
} catch (v) {
|
|
858
|
+
console.error("[CustomChannelHeader] Failed to update pinned status:", v);
|
|
850
859
|
}
|
|
851
860
|
};
|
|
852
861
|
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
@@ -872,7 +881,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
872
881
|
/* @__PURE__ */ e(
|
|
873
882
|
te,
|
|
874
883
|
{
|
|
875
|
-
id: ((
|
|
884
|
+
id: ((m = c == null ? void 0 : c.user) == null ? void 0 : m.id) || l.id || "unknown",
|
|
876
885
|
name: a,
|
|
877
886
|
image: u,
|
|
878
887
|
size: 40
|
|
@@ -887,12 +896,12 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
887
896
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
888
897
|
onClick: y,
|
|
889
898
|
type: "button",
|
|
890
|
-
"aria-label":
|
|
899
|
+
"aria-label": h ? "Unstar conversation" : "Star conversation",
|
|
891
900
|
children: /* @__PURE__ */ e(
|
|
892
901
|
ye,
|
|
893
902
|
{
|
|
894
903
|
className: "size-5 text-black/90",
|
|
895
|
-
weight:
|
|
904
|
+
weight: h ? "fill" : "regular"
|
|
896
905
|
}
|
|
897
906
|
)
|
|
898
907
|
}
|
|
@@ -939,12 +948,12 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
939
948
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
940
949
|
onClick: y,
|
|
941
950
|
type: "button",
|
|
942
|
-
"aria-label":
|
|
951
|
+
"aria-label": h ? "Unstar conversation" : "Star conversation",
|
|
943
952
|
children: /* @__PURE__ */ e(
|
|
944
953
|
ye,
|
|
945
954
|
{
|
|
946
955
|
className: "size-5 text-black/90",
|
|
947
|
-
weight:
|
|
956
|
+
weight: h ? "fill" : "regular"
|
|
948
957
|
}
|
|
949
958
|
)
|
|
950
959
|
}
|
|
@@ -971,36 +980,36 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
971
980
|
onLeaveConversation: c,
|
|
972
981
|
onBlockParticipant: a,
|
|
973
982
|
showDeleteConversation: u = !0,
|
|
974
|
-
onDeleteConversationClick:
|
|
983
|
+
onDeleteConversationClick: h,
|
|
975
984
|
onBlockParticipantClick: x,
|
|
976
985
|
onReportParticipantClick: y
|
|
977
986
|
}) => {
|
|
978
|
-
var K, ee, re,
|
|
979
|
-
const { service:
|
|
987
|
+
var K, ee, re, U, H, J, G;
|
|
988
|
+
const { service: f, debug: o } = he(), [_, E] = I(!1), [m, C] = I(!1), [v, w] = I(!1), S = T(async () => {
|
|
980
989
|
var R;
|
|
981
|
-
if (!(!
|
|
990
|
+
if (!(!f || !((R = n == null ? void 0 : n.user) != null && R.id)))
|
|
982
991
|
try {
|
|
983
|
-
const
|
|
984
|
-
(
|
|
992
|
+
const B = (await f.getBlockedUsers()).some(
|
|
993
|
+
($) => {
|
|
985
994
|
var se;
|
|
986
|
-
return
|
|
995
|
+
return $.blocked_user_id === ((se = n == null ? void 0 : n.user) == null ? void 0 : se.id);
|
|
987
996
|
}
|
|
988
997
|
);
|
|
989
|
-
E(
|
|
998
|
+
E(B);
|
|
990
999
|
} catch (D) {
|
|
991
1000
|
console.error(
|
|
992
1001
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
993
1002
|
D
|
|
994
1003
|
);
|
|
995
1004
|
}
|
|
996
|
-
}, [
|
|
1005
|
+
}, [f, (K = n == null ? void 0 : n.user) == null ? void 0 : K.id]);
|
|
997
1006
|
Z(() => {
|
|
998
1007
|
S();
|
|
999
1008
|
}, [S]);
|
|
1000
1009
|
const b = async () => {
|
|
1001
1010
|
var R;
|
|
1002
|
-
if (!
|
|
1003
|
-
|
|
1011
|
+
if (!m) {
|
|
1012
|
+
h == null || h(), o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), C(!0);
|
|
1004
1013
|
try {
|
|
1005
1014
|
const D = ((R = r._client) == null ? void 0 : R.userID) ?? null;
|
|
1006
1015
|
await r.hide(D, !1), c && await c(r), s();
|
|
@@ -1011,30 +1020,30 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1011
1020
|
}
|
|
1012
1021
|
}
|
|
1013
1022
|
}, 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),
|
|
1023
|
+
var R, D, B;
|
|
1024
|
+
if (!(v || !f)) {
|
|
1025
|
+
x == null || x(), o && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), w(!0);
|
|
1017
1026
|
try {
|
|
1018
|
-
await
|
|
1019
|
-
} catch (
|
|
1020
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
1027
|
+
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();
|
|
1028
|
+
} catch ($) {
|
|
1029
|
+
console.error("[ChannelInfoDialog] Failed to block member", $);
|
|
1021
1030
|
} finally {
|
|
1022
|
-
|
|
1031
|
+
w(!1);
|
|
1023
1032
|
}
|
|
1024
1033
|
}
|
|
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),
|
|
1034
|
+
}, g = async () => {
|
|
1035
|
+
var R, D, B;
|
|
1036
|
+
if (!(v || !f)) {
|
|
1037
|
+
x == null || x(), o && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), w(!0);
|
|
1029
1038
|
try {
|
|
1030
|
-
await
|
|
1031
|
-
} catch (
|
|
1032
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
1039
|
+
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();
|
|
1040
|
+
} catch ($) {
|
|
1041
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", $);
|
|
1033
1042
|
} finally {
|
|
1034
|
-
|
|
1043
|
+
w(!1);
|
|
1035
1044
|
}
|
|
1036
1045
|
}
|
|
1037
|
-
},
|
|
1046
|
+
}, d = () => {
|
|
1038
1047
|
y == null || y(), s(), window.open(
|
|
1039
1048
|
"https://linktr.ee/s/about/trust-center/report",
|
|
1040
1049
|
"_blank",
|
|
@@ -1042,7 +1051,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1042
1051
|
);
|
|
1043
1052
|
};
|
|
1044
1053
|
if (!n) return null;
|
|
1045
|
-
const
|
|
1054
|
+
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
1055
|
return (
|
|
1047
1056
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1048
1057
|
/* @__PURE__ */ e(
|
|
@@ -1057,7 +1066,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1057
1066
|
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
1067
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
1059
1068
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
1060
|
-
/* @__PURE__ */ e(
|
|
1069
|
+
/* @__PURE__ */ e(Be, { onClick: s })
|
|
1061
1070
|
] }),
|
|
1062
1071
|
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
1063
1072
|
/* @__PURE__ */ e(
|
|
@@ -1070,14 +1079,14 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1070
1079
|
te,
|
|
1071
1080
|
{
|
|
1072
1081
|
id: ne,
|
|
1073
|
-
name:
|
|
1074
|
-
image:
|
|
1082
|
+
name: N,
|
|
1083
|
+
image: O,
|
|
1075
1084
|
size: 88,
|
|
1076
1085
|
shape: "circle"
|
|
1077
1086
|
}
|
|
1078
1087
|
),
|
|
1079
1088
|
/* @__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:
|
|
1089
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: N }),
|
|
1081
1090
|
Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
|
|
1082
1091
|
l && /* @__PURE__ */ e(
|
|
1083
1092
|
"span",
|
|
@@ -1102,10 +1111,10 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1102
1111
|
ce,
|
|
1103
1112
|
{
|
|
1104
1113
|
onClick: b,
|
|
1105
|
-
disabled:
|
|
1106
|
-
"aria-busy":
|
|
1114
|
+
disabled: m,
|
|
1115
|
+
"aria-busy": m,
|
|
1107
1116
|
children: [
|
|
1108
|
-
|
|
1117
|
+
m ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Us, { className: "h-5 w-5" }),
|
|
1109
1118
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
1110
1119
|
]
|
|
1111
1120
|
}
|
|
@@ -1113,11 +1122,11 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1113
1122
|
/* @__PURE__ */ e("li", { children: _ ? /* @__PURE__ */ i(
|
|
1114
1123
|
ce,
|
|
1115
1124
|
{
|
|
1116
|
-
onClick:
|
|
1117
|
-
disabled:
|
|
1118
|
-
"aria-busy":
|
|
1125
|
+
onClick: g,
|
|
1126
|
+
disabled: v,
|
|
1127
|
+
"aria-busy": v,
|
|
1119
1128
|
children: [
|
|
1120
|
-
|
|
1129
|
+
v ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ie, { className: "h-5 w-5" }),
|
|
1121
1130
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
1122
1131
|
]
|
|
1123
1132
|
}
|
|
@@ -1125,16 +1134,16 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1125
1134
|
ce,
|
|
1126
1135
|
{
|
|
1127
1136
|
onClick: k,
|
|
1128
|
-
disabled:
|
|
1129
|
-
"aria-busy":
|
|
1137
|
+
disabled: v,
|
|
1138
|
+
"aria-busy": v,
|
|
1130
1139
|
children: [
|
|
1131
|
-
|
|
1140
|
+
v ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ie, { className: "h-5 w-5" }),
|
|
1132
1141
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
1133
1142
|
]
|
|
1134
1143
|
}
|
|
1135
1144
|
) }),
|
|
1136
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ce, { variant: "danger", onClick:
|
|
1137
|
-
/* @__PURE__ */ e(
|
|
1145
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ce, { variant: "danger", onClick: d, children: [
|
|
1146
|
+
/* @__PURE__ */ e(Bs, { className: "h-5 w-5" }),
|
|
1138
1147
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
1139
1148
|
] }) })
|
|
1140
1149
|
] })
|
|
@@ -1152,45 +1161,45 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1152
1161
|
showDeleteConversation: c = !0,
|
|
1153
1162
|
onDeleteConversationClick: a,
|
|
1154
1163
|
onBlockParticipantClick: u,
|
|
1155
|
-
onReportParticipantClick:
|
|
1164
|
+
onReportParticipantClick: h
|
|
1156
1165
|
}) => {
|
|
1157
|
-
const { channel: x } = Te(), y = W(null),
|
|
1166
|
+
const { channel: x } = Te(), y = W(null), f = P.useMemo(() => Object.values(x.state.members || {}).find(
|
|
1158
1167
|
(C) => {
|
|
1159
|
-
var
|
|
1160
|
-
return ((
|
|
1168
|
+
var v;
|
|
1169
|
+
return ((v = C.user) == null ? void 0 : v.id) && C.user.id !== x._client.userID;
|
|
1161
1170
|
}
|
|
1162
1171
|
), [x._client.userID, x.state.members]), o = P.useMemo(() => {
|
|
1163
|
-
const
|
|
1164
|
-
if (
|
|
1165
|
-
return String(
|
|
1166
|
-
if (
|
|
1167
|
-
return
|
|
1172
|
+
const m = x.data ?? {};
|
|
1173
|
+
if (m.followerStatus)
|
|
1174
|
+
return String(m.followerStatus);
|
|
1175
|
+
if (m.isFollower !== void 0)
|
|
1176
|
+
return m.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1168
1177
|
}, [x.data]), _ = T(() => {
|
|
1169
|
-
var
|
|
1170
|
-
(
|
|
1178
|
+
var m;
|
|
1179
|
+
(m = y.current) == null || m.showModal();
|
|
1171
1180
|
}, []), E = T(() => {
|
|
1172
|
-
var
|
|
1173
|
-
(
|
|
1181
|
+
var m;
|
|
1182
|
+
(m = y.current) == null || m.close();
|
|
1174
1183
|
}, []);
|
|
1175
1184
|
return /* @__PURE__ */ i(be, { children: [
|
|
1176
1185
|
/* @__PURE__ */ e(
|
|
1177
|
-
|
|
1186
|
+
Ds,
|
|
1178
1187
|
{
|
|
1179
1188
|
overrides: {
|
|
1180
|
-
Message: (
|
|
1189
|
+
Message: (m) => /* @__PURE__ */ e(Xs, { ...m })
|
|
1181
1190
|
},
|
|
1182
|
-
children: /* @__PURE__ */ i(
|
|
1191
|
+
children: /* @__PURE__ */ i(Fs, { children: [
|
|
1183
1192
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
1184
1193
|
ot,
|
|
1185
1194
|
{
|
|
1186
1195
|
onBack: t,
|
|
1187
1196
|
showBackButton: s,
|
|
1188
1197
|
onShowInfo: _,
|
|
1189
|
-
canShowInfo: !!
|
|
1198
|
+
canShowInfo: !!f
|
|
1190
1199
|
}
|
|
1191
1200
|
) }),
|
|
1192
1201
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1193
|
-
|
|
1202
|
+
Ls,
|
|
1194
1203
|
{
|
|
1195
1204
|
hideDeletedMessages: !0,
|
|
1196
1205
|
hideNewMessageSeparator: !1,
|
|
@@ -1211,7 +1220,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1211
1220
|
{
|
|
1212
1221
|
dialogRef: y,
|
|
1213
1222
|
onClose: E,
|
|
1214
|
-
participant:
|
|
1223
|
+
participant: f,
|
|
1215
1224
|
channel: x,
|
|
1216
1225
|
followerStatusLabel: o,
|
|
1217
1226
|
onLeaveConversation: r,
|
|
@@ -1219,11 +1228,11 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1219
1228
|
showDeleteConversation: c,
|
|
1220
1229
|
onDeleteConversationClick: a,
|
|
1221
1230
|
onBlockParticipantClick: u,
|
|
1222
|
-
onReportParticipantClick:
|
|
1231
|
+
onReportParticipantClick: h
|
|
1223
1232
|
}
|
|
1224
1233
|
)
|
|
1225
1234
|
] });
|
|
1226
|
-
},
|
|
1235
|
+
}, Ae = P.memo(
|
|
1227
1236
|
({
|
|
1228
1237
|
channel: t,
|
|
1229
1238
|
onBack: s,
|
|
@@ -1233,10 +1242,10 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1233
1242
|
onBlockParticipant: c,
|
|
1234
1243
|
className: a,
|
|
1235
1244
|
CustomChannelEmptyState: u = at,
|
|
1236
|
-
showDeleteConversation:
|
|
1245
|
+
showDeleteConversation: h = !0,
|
|
1237
1246
|
onDeleteConversationClick: x,
|
|
1238
1247
|
onBlockParticipantClick: y,
|
|
1239
|
-
onReportParticipantClick:
|
|
1248
|
+
onReportParticipantClick: f
|
|
1240
1249
|
}) => /* @__PURE__ */ e(
|
|
1241
1250
|
"div",
|
|
1242
1251
|
{
|
|
@@ -1245,13 +1254,13 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1245
1254
|
a
|
|
1246
1255
|
),
|
|
1247
1256
|
children: /* @__PURE__ */ e(
|
|
1248
|
-
|
|
1257
|
+
Ts,
|
|
1249
1258
|
{
|
|
1250
1259
|
channel: t,
|
|
1251
1260
|
MessageSystem: rt,
|
|
1252
1261
|
EmptyStateIndicator: u,
|
|
1253
1262
|
LoadingIndicator: ue,
|
|
1254
|
-
DateSeparator:
|
|
1263
|
+
DateSeparator: Ys,
|
|
1255
1264
|
children: /* @__PURE__ */ e(
|
|
1256
1265
|
ct,
|
|
1257
1266
|
{
|
|
@@ -1261,10 +1270,10 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1261
1270
|
onLeaveConversation: l,
|
|
1262
1271
|
onBlockParticipant: c,
|
|
1263
1272
|
CustomChannelEmptyState: u,
|
|
1264
|
-
showDeleteConversation:
|
|
1273
|
+
showDeleteConversation: h,
|
|
1265
1274
|
onDeleteConversationClick: x,
|
|
1266
1275
|
onBlockParticipantClick: y,
|
|
1267
|
-
onReportParticipantClick:
|
|
1276
|
+
onReportParticipantClick: f
|
|
1268
1277
|
}
|
|
1269
1278
|
)
|
|
1270
1279
|
}
|
|
@@ -1272,7 +1281,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1272
1281
|
}
|
|
1273
1282
|
)
|
|
1274
1283
|
);
|
|
1275
|
-
|
|
1284
|
+
Ae.displayName = "ChannelView";
|
|
1276
1285
|
function dt({
|
|
1277
1286
|
searchQuery: t,
|
|
1278
1287
|
setSearchQuery: s,
|
|
@@ -1281,7 +1290,7 @@ function dt({
|
|
|
1281
1290
|
const r = W(null);
|
|
1282
1291
|
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1283
1292
|
/* @__PURE__ */ e(
|
|
1284
|
-
|
|
1293
|
+
As,
|
|
1285
1294
|
{
|
|
1286
1295
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1287
1296
|
weight: "bold"
|
|
@@ -1299,7 +1308,7 @@ function dt({
|
|
|
1299
1308
|
}
|
|
1300
1309
|
),
|
|
1301
1310
|
t && /* @__PURE__ */ e(
|
|
1302
|
-
|
|
1311
|
+
Ue,
|
|
1303
1312
|
{
|
|
1304
1313
|
label: "Clear search",
|
|
1305
1314
|
onClick: () => {
|
|
@@ -1321,9 +1330,9 @@ const mt = ({
|
|
|
1321
1330
|
searchPlaceholder: c = "Search participants...",
|
|
1322
1331
|
className: a
|
|
1323
1332
|
}) => {
|
|
1324
|
-
const { debug: u } = he(), [
|
|
1333
|
+
const { debug: u } = he(), [h, x] = I(""), [y, f] = I([]), [o, _] = I(!1), [E, m] = I(null), [C, v] = I(
|
|
1325
1334
|
null
|
|
1326
|
-
),
|
|
1335
|
+
), w = W(!1);
|
|
1327
1336
|
Z(() => {
|
|
1328
1337
|
if (t.loading) {
|
|
1329
1338
|
u && console.log(
|
|
@@ -1331,52 +1340,52 @@ const mt = ({
|
|
|
1331
1340
|
);
|
|
1332
1341
|
return;
|
|
1333
1342
|
}
|
|
1334
|
-
if (
|
|
1343
|
+
if (w.current) return;
|
|
1335
1344
|
(async () => {
|
|
1336
|
-
u && console.log("[ParticipantPicker] Loading initial participants..."), _(!0),
|
|
1345
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), _(!0), m(null);
|
|
1337
1346
|
try {
|
|
1338
|
-
const
|
|
1347
|
+
const d = await t.loadParticipants({
|
|
1339
1348
|
search: "",
|
|
1340
1349
|
// Load all participants initially
|
|
1341
1350
|
limit: 100
|
|
1342
1351
|
});
|
|
1343
|
-
|
|
1352
|
+
f(d.participants), w.current = !0, u && console.log(
|
|
1344
1353
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1345
|
-
|
|
1354
|
+
d.participants.length
|
|
1346
1355
|
);
|
|
1347
|
-
} catch (
|
|
1348
|
-
const
|
|
1349
|
-
|
|
1356
|
+
} catch (d) {
|
|
1357
|
+
const N = d instanceof Error ? d.message : "Failed to load participants";
|
|
1358
|
+
m(N), console.error("[ParticipantPicker] Failed to load participants:", d);
|
|
1350
1359
|
} finally {
|
|
1351
1360
|
_(!1);
|
|
1352
1361
|
}
|
|
1353
1362
|
})();
|
|
1354
1363
|
}, [t.loading, u]);
|
|
1355
|
-
const S = y.filter((
|
|
1356
|
-
var
|
|
1357
|
-
if (!
|
|
1358
|
-
const
|
|
1359
|
-
return
|
|
1364
|
+
const S = y.filter((g) => !r.has(g.id)).filter((g) => {
|
|
1365
|
+
var N;
|
|
1366
|
+
if (!h) return !0;
|
|
1367
|
+
const d = h.toLowerCase();
|
|
1368
|
+
return g.name.toLowerCase().includes(d) || ((N = g.email) == null ? void 0 : N.toLowerCase().includes(d)) || !1;
|
|
1360
1369
|
}), b = T(
|
|
1361
|
-
async (
|
|
1370
|
+
async (g) => {
|
|
1362
1371
|
if (!C) {
|
|
1363
|
-
|
|
1372
|
+
v(g.id);
|
|
1364
1373
|
try {
|
|
1365
|
-
await s(
|
|
1366
|
-
} catch (
|
|
1367
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1374
|
+
await s(g);
|
|
1375
|
+
} catch (d) {
|
|
1376
|
+
console.error("[ParticipantPicker] Failed to start chat:", d), v(null);
|
|
1368
1377
|
}
|
|
1369
1378
|
}
|
|
1370
1379
|
},
|
|
1371
1380
|
[s, C]
|
|
1372
|
-
), k = (
|
|
1373
|
-
(
|
|
1381
|
+
), k = (g, d) => {
|
|
1382
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), b(d));
|
|
1374
1383
|
};
|
|
1375
1384
|
return /* @__PURE__ */ i("div", { className: M("flex flex-col h-full", a), children: [
|
|
1376
1385
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1377
1386
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1378
1387
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1379
|
-
/* @__PURE__ */ e(
|
|
1388
|
+
/* @__PURE__ */ e(Be, { onClick: n })
|
|
1380
1389
|
] }),
|
|
1381
1390
|
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1382
1391
|
"Select a ",
|
|
@@ -1389,7 +1398,7 @@ const mt = ({
|
|
|
1389
1398
|
/* @__PURE__ */ e(
|
|
1390
1399
|
dt,
|
|
1391
1400
|
{
|
|
1392
|
-
searchQuery:
|
|
1401
|
+
searchQuery: h,
|
|
1393
1402
|
setSearchQuery: x,
|
|
1394
1403
|
placeholder: c
|
|
1395
1404
|
}
|
|
@@ -1410,38 +1419,38 @@ const mt = ({
|
|
|
1410
1419
|
] })
|
|
1411
1420
|
] }) }) : S.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1412
1421
|
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(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:
|
|
1422
|
+
/* @__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` }),
|
|
1423
|
+
/* @__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
1424
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1416
|
-
S.map((
|
|
1417
|
-
const
|
|
1425
|
+
S.map((g) => {
|
|
1426
|
+
const d = g.name || g.email || g.id, N = g.email && g.name ? g.email : g.phone;
|
|
1418
1427
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1419
1428
|
"button",
|
|
1420
1429
|
{
|
|
1421
1430
|
type: "button",
|
|
1422
|
-
onClick: () => b(
|
|
1423
|
-
onKeyDown: (
|
|
1431
|
+
onClick: () => b(g),
|
|
1432
|
+
onKeyDown: (O) => k(O, g),
|
|
1424
1433
|
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
1434
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1426
1435
|
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1427
1436
|
/* @__PURE__ */ e(
|
|
1428
1437
|
te,
|
|
1429
1438
|
{
|
|
1430
|
-
id:
|
|
1431
|
-
name:
|
|
1432
|
-
image:
|
|
1439
|
+
id: g.id,
|
|
1440
|
+
name: d,
|
|
1441
|
+
image: g.image,
|
|
1433
1442
|
size: 40
|
|
1434
1443
|
}
|
|
1435
1444
|
),
|
|
1436
1445
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1437
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1438
|
-
|
|
1446
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: d }),
|
|
1447
|
+
N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
|
|
1439
1448
|
] })
|
|
1440
1449
|
] }),
|
|
1441
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: C ===
|
|
1450
|
+
/* @__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
1451
|
] })
|
|
1443
1452
|
}
|
|
1444
|
-
) },
|
|
1453
|
+
) }, g.id);
|
|
1445
1454
|
}),
|
|
1446
1455
|
o && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1447
1456
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
@@ -1583,7 +1592,7 @@ const mt = ({
|
|
|
1583
1592
|
] })
|
|
1584
1593
|
]
|
|
1585
1594
|
}
|
|
1586
|
-
),
|
|
1595
|
+
), je = P.memo(
|
|
1587
1596
|
({ 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
1597
|
/* @__PURE__ */ e(ut, {}),
|
|
1589
1598
|
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
@@ -1592,7 +1601,7 @@ const mt = ({
|
|
|
1592
1601
|
] })
|
|
1593
1602
|
] }) })
|
|
1594
1603
|
);
|
|
1595
|
-
|
|
1604
|
+
je.displayName = "EmptyState";
|
|
1596
1605
|
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
1606
|
/* @__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
1607
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
@@ -1617,82 +1626,82 @@ const pt = ({
|
|
|
1617
1626
|
initialParticipantFilter: c,
|
|
1618
1627
|
initialParticipantData: a,
|
|
1619
1628
|
CustomChannelEmptyState: u,
|
|
1620
|
-
showChannelList:
|
|
1629
|
+
showChannelList: h = !0,
|
|
1621
1630
|
filters: x,
|
|
1622
1631
|
channelListCustomEmptyStateIndicator: y,
|
|
1623
|
-
onDeleteConversationClick:
|
|
1632
|
+
onDeleteConversationClick: f,
|
|
1624
1633
|
onBlockParticipantClick: o,
|
|
1625
1634
|
onReportParticipantClick: _
|
|
1626
1635
|
}) => {
|
|
1627
1636
|
const {
|
|
1628
1637
|
service: E,
|
|
1629
|
-
client:
|
|
1638
|
+
client: m,
|
|
1630
1639
|
isConnected: C,
|
|
1631
|
-
isLoading:
|
|
1632
|
-
error:
|
|
1640
|
+
isLoading: v,
|
|
1641
|
+
error: w,
|
|
1633
1642
|
refreshConnection: S,
|
|
1634
1643
|
debug: b
|
|
1635
|
-
} =
|
|
1644
|
+
} = 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
1645
|
participantSource: D,
|
|
1637
|
-
participantLabel:
|
|
1638
|
-
showDeleteConversation:
|
|
1646
|
+
participantLabel: B = "participants",
|
|
1647
|
+
showDeleteConversation: $ = !0
|
|
1639
1648
|
} = t, se = P.useMemo(() => {
|
|
1640
|
-
const
|
|
1649
|
+
const p = m == null ? void 0 : m.userID;
|
|
1641
1650
|
return {
|
|
1642
1651
|
...{
|
|
1643
1652
|
type: "messaging",
|
|
1644
1653
|
last_message_at: { $exists: !0 },
|
|
1645
|
-
...
|
|
1646
|
-
members: { $in: [
|
|
1654
|
+
...p && {
|
|
1655
|
+
members: { $in: [p] },
|
|
1647
1656
|
hidden: !1
|
|
1648
1657
|
}
|
|
1649
1658
|
},
|
|
1650
1659
|
...x
|
|
1651
1660
|
};
|
|
1652
|
-
}, [x,
|
|
1653
|
-
if (!
|
|
1654
|
-
const
|
|
1655
|
-
if (
|
|
1661
|
+
}, [x, m == null ? void 0 : m.userID]), Q = W(null), V = T(async () => {
|
|
1662
|
+
if (!m || !C) return;
|
|
1663
|
+
const p = m.userID;
|
|
1664
|
+
if (p)
|
|
1656
1665
|
try {
|
|
1657
|
-
b && console.log("[MessagingShell] Syncing channels for user:",
|
|
1658
|
-
const L = await
|
|
1666
|
+
b && console.log("[MessagingShell] Syncing channels for user:", p);
|
|
1667
|
+
const L = await m.queryChannels(
|
|
1659
1668
|
{
|
|
1660
1669
|
type: "messaging",
|
|
1661
|
-
members: { $in: [
|
|
1670
|
+
members: { $in: [p] }
|
|
1662
1671
|
},
|
|
1663
1672
|
{},
|
|
1664
1673
|
{ limit: 100 }
|
|
1665
1674
|
), F = /* @__PURE__ */ new Set();
|
|
1666
|
-
L.forEach((
|
|
1667
|
-
const xe =
|
|
1668
|
-
Object.values(xe).forEach((
|
|
1675
|
+
L.forEach((A) => {
|
|
1676
|
+
const xe = A.state.members;
|
|
1677
|
+
Object.values(xe).forEach(($e) => {
|
|
1669
1678
|
var ve;
|
|
1670
|
-
const Ce = (ve =
|
|
1671
|
-
Ce && Ce !==
|
|
1679
|
+
const Ce = (ve = $e.user) == null ? void 0 : ve.id;
|
|
1680
|
+
Ce && Ce !== p && F.add(Ce);
|
|
1672
1681
|
});
|
|
1673
|
-
}), K((
|
|
1682
|
+
}), 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
1683
|
channelCount: L.length,
|
|
1675
1684
|
memberCount: F.size
|
|
1676
1685
|
});
|
|
1677
1686
|
} catch (L) {
|
|
1678
1687
|
console.error("[MessagingShell] Failed to sync channels:", L);
|
|
1679
1688
|
}
|
|
1680
|
-
}, [
|
|
1689
|
+
}, [m, C, b]);
|
|
1681
1690
|
Z(() => {
|
|
1682
|
-
if (!
|
|
1683
|
-
const
|
|
1684
|
-
|
|
1685
|
-
}, [
|
|
1686
|
-
if (!c || !
|
|
1691
|
+
if (!m || !C) return;
|
|
1692
|
+
const p = m.userID;
|
|
1693
|
+
p && Q.current !== p && V();
|
|
1694
|
+
}, [m, C, V]), Z(() => {
|
|
1695
|
+
if (!c || !m || !C) return;
|
|
1687
1696
|
(async () => {
|
|
1688
|
-
const L =
|
|
1697
|
+
const L = m.userID;
|
|
1689
1698
|
if (L)
|
|
1690
1699
|
try {
|
|
1691
1700
|
b && console.log(
|
|
1692
1701
|
"[MessagingShell] Loading initial conversation with:",
|
|
1693
1702
|
c
|
|
1694
1703
|
);
|
|
1695
|
-
const F = await
|
|
1704
|
+
const F = await m.queryChannels(
|
|
1696
1705
|
{
|
|
1697
1706
|
type: "messaging",
|
|
1698
1707
|
members: { $eq: [L, c] }
|
|
@@ -1701,7 +1710,7 @@ const pt = ({
|
|
|
1701
1710
|
{ limit: 1 }
|
|
1702
1711
|
);
|
|
1703
1712
|
if (F.length > 0)
|
|
1704
|
-
|
|
1713
|
+
g(F[0]), H(!0), G(null), r && r(F[0]), b && console.log(
|
|
1705
1714
|
"[MessagingShell] Initial conversation loaded:",
|
|
1706
1715
|
F[0].id
|
|
1707
1716
|
);
|
|
@@ -1711,24 +1720,24 @@ const pt = ({
|
|
|
1711
1720
|
a
|
|
1712
1721
|
);
|
|
1713
1722
|
try {
|
|
1714
|
-
const
|
|
1723
|
+
const A = await E.startChannelWithParticipant({
|
|
1715
1724
|
id: a.id,
|
|
1716
1725
|
name: a.name,
|
|
1717
1726
|
email: a.email,
|
|
1718
1727
|
phone: a.phone
|
|
1719
1728
|
});
|
|
1720
|
-
|
|
1729
|
+
g(A), H(!0), G(null), r && r(A), b && console.log(
|
|
1721
1730
|
"[MessagingShell] Channel created and loaded:",
|
|
1722
|
-
|
|
1731
|
+
A.id
|
|
1723
1732
|
);
|
|
1724
|
-
} catch (
|
|
1733
|
+
} catch (A) {
|
|
1725
1734
|
console.error(
|
|
1726
1735
|
"[MessagingShell] Failed to create conversation:",
|
|
1727
|
-
|
|
1728
|
-
),
|
|
1736
|
+
A
|
|
1737
|
+
), G("Failed to create conversation");
|
|
1729
1738
|
}
|
|
1730
1739
|
} else
|
|
1731
|
-
|
|
1740
|
+
G(
|
|
1732
1741
|
"No conversation found with this account"
|
|
1733
1742
|
), b && console.log(
|
|
1734
1743
|
"[MessagingShell] No conversation found for:",
|
|
@@ -1738,71 +1747,71 @@ const pt = ({
|
|
|
1738
1747
|
console.error(
|
|
1739
1748
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1740
1749
|
F
|
|
1741
|
-
),
|
|
1750
|
+
), G("Failed to load conversation");
|
|
1742
1751
|
}
|
|
1743
1752
|
})();
|
|
1744
1753
|
}, [
|
|
1745
1754
|
c,
|
|
1746
1755
|
a,
|
|
1747
|
-
|
|
1756
|
+
m,
|
|
1748
1757
|
C,
|
|
1749
1758
|
E,
|
|
1750
1759
|
b,
|
|
1751
1760
|
r
|
|
1752
1761
|
]);
|
|
1753
1762
|
const le = T(
|
|
1754
|
-
(
|
|
1755
|
-
|
|
1763
|
+
(p) => {
|
|
1764
|
+
g(p), r == null || r(p);
|
|
1756
1765
|
},
|
|
1757
1766
|
[r]
|
|
1758
1767
|
), oe = T(() => {
|
|
1759
|
-
|
|
1760
|
-
}, [
|
|
1761
|
-
async (
|
|
1768
|
+
U || g(null);
|
|
1769
|
+
}, [U]), ae = T(
|
|
1770
|
+
async (p) => {
|
|
1762
1771
|
var L;
|
|
1763
1772
|
if (E)
|
|
1764
1773
|
try {
|
|
1765
1774
|
b && console.log(
|
|
1766
1775
|
"[MessagingShell] Starting conversation with:",
|
|
1767
|
-
|
|
1776
|
+
p.id
|
|
1768
1777
|
);
|
|
1769
1778
|
const F = await E.startChannelWithParticipant({
|
|
1770
|
-
id:
|
|
1771
|
-
name:
|
|
1772
|
-
email:
|
|
1773
|
-
phone:
|
|
1779
|
+
id: p.id,
|
|
1780
|
+
name: p.name,
|
|
1781
|
+
email: p.email,
|
|
1782
|
+
phone: p.phone
|
|
1774
1783
|
});
|
|
1775
1784
|
try {
|
|
1776
1785
|
await F.show();
|
|
1777
|
-
} catch (
|
|
1778
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1786
|
+
} catch (A) {
|
|
1787
|
+
console.warn("[MessagingShell] Failed to unhide channel:", A);
|
|
1779
1788
|
}
|
|
1780
|
-
|
|
1789
|
+
g(F), Y(!1), (L = R.current) == null || L.close(), l == null || l(p);
|
|
1781
1790
|
} catch (F) {
|
|
1782
1791
|
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
1783
1792
|
}
|
|
1784
1793
|
},
|
|
1785
1794
|
[E, l, b]
|
|
1786
|
-
),
|
|
1787
|
-
var
|
|
1788
|
-
Y(!1), (
|
|
1795
|
+
), z = T(() => {
|
|
1796
|
+
var p;
|
|
1797
|
+
Y(!1), (p = R.current) == null || p.close();
|
|
1789
1798
|
}, []), fe = T(
|
|
1790
|
-
(
|
|
1791
|
-
|
|
1799
|
+
(p) => {
|
|
1800
|
+
p.target === R.current && z();
|
|
1792
1801
|
},
|
|
1793
|
-
[
|
|
1802
|
+
[z]
|
|
1794
1803
|
), ie = T(
|
|
1795
|
-
async (
|
|
1796
|
-
b && console.log("[MessagingShell] Leaving conversation:",
|
|
1804
|
+
async (p) => {
|
|
1805
|
+
b && console.log("[MessagingShell] Leaving conversation:", p.id), g(null), H(!1), Q.current = null, await V();
|
|
1797
1806
|
},
|
|
1798
1807
|
[V, b]
|
|
1799
1808
|
), ge = T(
|
|
1800
|
-
async (
|
|
1801
|
-
b && console.log("[MessagingShell] Blocking participant:",
|
|
1809
|
+
async (p) => {
|
|
1810
|
+
b && console.log("[MessagingShell] Blocking participant:", p), g(null), H(!1), Q.current = null, await V();
|
|
1802
1811
|
},
|
|
1803
1812
|
[V, b]
|
|
1804
1813
|
), X = !!k;
|
|
1805
|
-
return
|
|
1814
|
+
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
1815
|
me,
|
|
1807
1816
|
{
|
|
1808
1817
|
message: "Not connected to messaging service",
|
|
@@ -1823,15 +1832,15 @@ const pt = ({
|
|
|
1823
1832
|
className: M(
|
|
1824
1833
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1825
1834
|
{
|
|
1826
|
-
"!hidden":
|
|
1835
|
+
"!hidden": h === !1 || U,
|
|
1827
1836
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
1828
|
-
"hidden lg:flex lg:flex-1 lg:max-w-2xl":
|
|
1837
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !U && X,
|
|
1829
1838
|
// 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":
|
|
1839
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !U && !X
|
|
1831
1840
|
}
|
|
1832
1841
|
),
|
|
1833
1842
|
children: /* @__PURE__ */ e(
|
|
1834
|
-
|
|
1843
|
+
Oe,
|
|
1835
1844
|
{
|
|
1836
1845
|
onChannelSelect: le,
|
|
1837
1846
|
selectedChannel: k || void 0,
|
|
@@ -1848,23 +1857,23 @@ const pt = ({
|
|
|
1848
1857
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1849
1858
|
{
|
|
1850
1859
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1851
|
-
flex:
|
|
1860
|
+
flex: U || X || c,
|
|
1852
1861
|
// Normal mode: hide on mobile when no channel selected
|
|
1853
|
-
"hidden lg:flex": !
|
|
1862
|
+
"hidden lg:flex": !U && !X && !c
|
|
1854
1863
|
}
|
|
1855
1864
|
),
|
|
1856
1865
|
children: k ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1857
|
-
|
|
1866
|
+
Ae,
|
|
1858
1867
|
{
|
|
1859
1868
|
channel: k,
|
|
1860
1869
|
onBack: oe,
|
|
1861
|
-
showBackButton: !
|
|
1870
|
+
showBackButton: !U,
|
|
1862
1871
|
renderMessageInputActions: n,
|
|
1863
1872
|
onLeaveConversation: ie,
|
|
1864
1873
|
onBlockParticipant: ge,
|
|
1865
1874
|
CustomChannelEmptyState: u,
|
|
1866
|
-
showDeleteConversation:
|
|
1867
|
-
onDeleteConversationClick:
|
|
1875
|
+
showDeleteConversation: $,
|
|
1876
|
+
onDeleteConversationClick: f,
|
|
1868
1877
|
onBlockParticipantClick: o,
|
|
1869
1878
|
onReportParticipantClick: _
|
|
1870
1879
|
},
|
|
@@ -1873,10 +1882,10 @@ const pt = ({
|
|
|
1873
1882
|
// Show loading while creating/loading direct conversation channel
|
|
1874
1883
|
/* @__PURE__ */ e(ue, {})
|
|
1875
1884
|
) : /* @__PURE__ */ e(
|
|
1876
|
-
|
|
1885
|
+
je,
|
|
1877
1886
|
{
|
|
1878
|
-
hasChannels:
|
|
1879
|
-
channelsLoaded:
|
|
1887
|
+
hasChannels: d,
|
|
1888
|
+
channelsLoaded: O
|
|
1880
1889
|
}
|
|
1881
1890
|
)
|
|
1882
1891
|
}
|
|
@@ -1889,16 +1898,16 @@ const pt = ({
|
|
|
1889
1898
|
ref: R,
|
|
1890
1899
|
className: "mes-dialog",
|
|
1891
1900
|
onClick: fe,
|
|
1892
|
-
onClose:
|
|
1901
|
+
onClose: z,
|
|
1893
1902
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1894
1903
|
mt,
|
|
1895
1904
|
{
|
|
1896
1905
|
participantSource: D,
|
|
1897
1906
|
onSelectParticipant: ae,
|
|
1898
|
-
onClose:
|
|
1907
|
+
onClose: z,
|
|
1899
1908
|
existingParticipantIds: ne,
|
|
1900
|
-
participantLabel:
|
|
1901
|
-
searchPlaceholder: `Search ${
|
|
1909
|
+
participantLabel: B,
|
|
1910
|
+
searchPlaceholder: `Search ${B}...`
|
|
1902
1911
|
},
|
|
1903
1912
|
ee
|
|
1904
1913
|
) })
|
|
@@ -1938,7 +1947,7 @@ const pt = ({
|
|
|
1938
1947
|
avatarImage: c,
|
|
1939
1948
|
avatarName: a
|
|
1940
1949
|
}) => {
|
|
1941
|
-
const u = t.filter((
|
|
1950
|
+
const u = t.filter((h) => h.enabled).sort((h, x) => (h.order ?? 0) - (x.order ?? 0));
|
|
1942
1951
|
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1943
1952
|
(c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1944
1953
|
te,
|
|
@@ -1957,72 +1966,72 @@ const pt = ({
|
|
|
1957
1966
|
style: { backgroundColor: "#F1F0EE" },
|
|
1958
1967
|
children: [
|
|
1959
1968
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1960
|
-
u.map((
|
|
1969
|
+
u.map((h) => /* @__PURE__ */ e(
|
|
1961
1970
|
ht,
|
|
1962
1971
|
{
|
|
1963
|
-
question:
|
|
1964
|
-
onClick: () => s(
|
|
1965
|
-
loading: n ===
|
|
1972
|
+
question: h.question,
|
|
1973
|
+
onClick: () => s(h.id),
|
|
1974
|
+
loading: n === h.id
|
|
1966
1975
|
},
|
|
1967
|
-
|
|
1976
|
+
h.id
|
|
1968
1977
|
))
|
|
1969
1978
|
]
|
|
1970
1979
|
}
|
|
1971
1980
|
)
|
|
1972
1981
|
] }) });
|
|
1973
1982
|
}, Et = (t, s = {}) => {
|
|
1974
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [l, c] = I([]), [a, u] = I(!1), [
|
|
1983
|
+
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
1984
|
if (a) return;
|
|
1976
|
-
const
|
|
1985
|
+
const g = k !== void 0 ? k : y;
|
|
1977
1986
|
u(!0), x(null);
|
|
1978
1987
|
try {
|
|
1979
|
-
const
|
|
1980
|
-
search:
|
|
1988
|
+
const d = await t.loadParticipants({
|
|
1989
|
+
search: g || void 0,
|
|
1981
1990
|
limit: r,
|
|
1982
1991
|
cursor: b ? void 0 : E
|
|
1983
1992
|
});
|
|
1984
1993
|
c(
|
|
1985
|
-
(
|
|
1986
|
-
), _(
|
|
1987
|
-
} catch (
|
|
1988
|
-
const
|
|
1989
|
-
x(
|
|
1994
|
+
(N) => b ? d.participants : [...N, ...d.participants]
|
|
1995
|
+
), _(d.hasMore), m(d.nextCursor);
|
|
1996
|
+
} catch (d) {
|
|
1997
|
+
const N = d instanceof Error ? d.message : "Failed to load participants";
|
|
1998
|
+
x(N), console.error("[useParticipants] Load error:", d);
|
|
1990
1999
|
} finally {
|
|
1991
2000
|
u(!1);
|
|
1992
2001
|
}
|
|
1993
|
-
}, [t, y, E, r, a]),
|
|
2002
|
+
}, [t, y, E, r, a]), v = T(() => {
|
|
1994
2003
|
o && !a && C(!1);
|
|
1995
|
-
}, [o, a, C]),
|
|
1996
|
-
|
|
2004
|
+
}, [o, a, C]), w = T((b) => {
|
|
2005
|
+
f(b), m(void 0), C(!0, b);
|
|
1997
2006
|
}, [C]), S = T(() => {
|
|
1998
|
-
|
|
2007
|
+
m(void 0), C(!0);
|
|
1999
2008
|
}, [C]);
|
|
2000
2009
|
return Z(() => {
|
|
2001
2010
|
C(!0);
|
|
2002
2011
|
}, [t.loadParticipants]), {
|
|
2003
2012
|
participants: l,
|
|
2004
2013
|
loading: a,
|
|
2005
|
-
error:
|
|
2014
|
+
error: h,
|
|
2006
2015
|
searchQuery: y,
|
|
2007
2016
|
hasMore: o,
|
|
2008
2017
|
totalCount: t.totalCount,
|
|
2009
|
-
loadMore:
|
|
2010
|
-
search:
|
|
2018
|
+
loadMore: v,
|
|
2019
|
+
search: w,
|
|
2011
2020
|
refresh: S
|
|
2012
2021
|
};
|
|
2013
2022
|
};
|
|
2014
2023
|
export {
|
|
2015
2024
|
te as Avatar,
|
|
2016
2025
|
at as ChannelEmptyState,
|
|
2017
|
-
|
|
2018
|
-
|
|
2026
|
+
Oe as ChannelList,
|
|
2027
|
+
Ae as ChannelView,
|
|
2019
2028
|
yt as FaqList,
|
|
2020
2029
|
ht as FaqListItem,
|
|
2021
2030
|
wt as MessagingProvider,
|
|
2022
2031
|
pt as MessagingShell,
|
|
2023
2032
|
mt as ParticipantPicker,
|
|
2024
|
-
|
|
2025
|
-
|
|
2033
|
+
zs as formatRelativeTime,
|
|
2034
|
+
js as useMessaging,
|
|
2026
2035
|
Et as useParticipants
|
|
2027
2036
|
};
|
|
2028
2037
|
//# sourceMappingURL=index.js.map
|