@linktr.ee/messaging-react 1.25.0-rc-1774238116 โ 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +696 -686
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/CustomChannelPreview.test.tsx +57 -5
- package/src/components/ChannelList/CustomChannelPreview.tsx +4 -3
- package/src/components/ChannelView.tsx +6 -22
- package/src/hooks/useChannelStar.ts +31 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i, Fragment as me } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { StarIcon as Ee, GiftIcon as
|
|
2
|
+
import R from "classnames";
|
|
3
|
+
import B, { createContext as lt, useContext as it, useCallback as P, useState as T, useRef as Q, useEffect as X, useMemo as _e } from "react";
|
|
4
|
+
import { StreamChatService as ct } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as dt, ChannelList as ut, DateSeparator as mt, useChannelStateContext as Me, useChatContext as $e, areMessageUIPropsEqual as ht, useMessageReminder as ft, useComponentContext as gt, Attachment as xt, EditMessageModal as bt, MessageBlocked as Ct, MessageBouncePrompt as Nt, MessageDeleted as vt, MessageIsThreadReplyInChannelButtonIndicator as wt, MessageRepliesCountButton as pt, ReminderNotification as yt, StreamedMessageText as _t, messageHasAttachments as Et, messageHasReactions as St, isDateSeparatorMessage as It, isMessageBlocked as Mt, isMessageBounced as kt, MessageBounceModal as Tt, Poll as Dt, MessageText as Rt, MessageErrorIcon as Lt, useMessageContext as je, useMessageComposer as Pt, useStateStore as Ut, MessageInput as Ot, useMessageInputContext as Ft, useMessageComposerHasSendableData as At, SimpleAttachmentSelector as Bt, QuotedMessagePreview as $t, AttachmentPreviewList as jt, TextareaComposer as Gt, MessageTimestamp as Re, Channel as zt, WithComponents as Vt, Window as Ht, MessageList as Wt } from "stream-chat-react";
|
|
6
|
+
import { StarIcon as Ee, GiftIcon as qt, XIcon as ke, SpinnerGapIcon as be, SignOutIcon as Yt, ProhibitInsetIcon as Le, FlagIcon as Zt, ArrowUpIcon as Jt, SparkleIcon as Qt, ArrowLeftIcon as Pe, DotsThreeIcon as Ue, MagnifyingGlassIcon as Xt, ChatCircleDotsIcon as Oe } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as Fe } from "stream-chat";
|
|
8
|
-
const Ge =
|
|
8
|
+
const Ge = lt({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,7 +15,7 @@ const Ge = ot({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), ve = () =>
|
|
18
|
+
}), ve = () => it(Ge), Hs = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
@@ -23,191 +23,191 @@ const Ge = ot({
|
|
|
23
23
|
capabilities: l = {},
|
|
24
24
|
debug: m = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const
|
|
26
|
+
const a = P(
|
|
27
27
|
(u, ...N) => {
|
|
28
28
|
m && console.log(`๐ฅ [MessagingProvider] ${u}`, ...N);
|
|
29
29
|
},
|
|
30
30
|
[m]
|
|
31
31
|
);
|
|
32
|
-
|
|
32
|
+
a("๐ RENDER START", {
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
34
34
|
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(l)
|
|
37
37
|
});
|
|
38
|
-
const [c,
|
|
38
|
+
const [c, g] = T(null), [h, b] = T(null), [x, w] = T(!1), [r, y] = T(!1), [_, C] = T(null), M = Q(!1), E = Q({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: o,
|
|
41
41
|
serviceConfig: n,
|
|
42
42
|
capabilities: l
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
43
|
+
}), p = Q(0);
|
|
44
|
+
p.current++, a("๐ RENDER INFO", {
|
|
45
|
+
renderCount: p.current,
|
|
46
46
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (o == null ? void 0 : o.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
|
-
userChanged:
|
|
49
|
-
apiKeyChanged:
|
|
50
|
-
serviceConfigChanged:
|
|
51
|
-
capabilitiesChanged:
|
|
48
|
+
userChanged: E.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
+
apiKeyChanged: E.current.apiKey !== o,
|
|
50
|
+
serviceConfigChanged: E.current.serviceConfig !== n,
|
|
51
|
+
capabilitiesChanged: E.current.capabilities !== l
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
53
|
+
}), E.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
55
|
apiKey: o,
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: l
|
|
58
58
|
}, X(() => {
|
|
59
|
-
const u =
|
|
60
|
-
if (
|
|
59
|
+
const u = p.current;
|
|
60
|
+
if (a("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
61
|
renderCount: u,
|
|
62
62
|
apiKey: !!o,
|
|
63
63
|
serviceConfig: !!n,
|
|
64
64
|
dependencies: {
|
|
65
65
|
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
66
66
|
serviceConfigRef: n,
|
|
67
|
-
serviceConfigStable:
|
|
68
|
-
apiKeyStable:
|
|
67
|
+
serviceConfigStable: E.current.serviceConfig === n,
|
|
68
|
+
apiKeyStable: E.current.apiKey === o
|
|
69
69
|
}
|
|
70
70
|
}), !o || !n) {
|
|
71
|
-
|
|
71
|
+
a("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
72
72
|
renderCount: u,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
74
74
|
});
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
a("๐ CREATING NEW SERVICE", {
|
|
78
78
|
renderCount: u,
|
|
79
79
|
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
80
|
-
serviceConfigChanged:
|
|
80
|
+
serviceConfigChanged: E.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const N = new
|
|
82
|
+
const N = new ct({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: o,
|
|
85
85
|
debug: m
|
|
86
86
|
});
|
|
87
|
-
return
|
|
87
|
+
return g(N), a("โ
SERVICE SET", {
|
|
88
88
|
renderCount: u,
|
|
89
89
|
serviceInstance: !!N
|
|
90
90
|
}), () => {
|
|
91
|
-
|
|
91
|
+
a("๐งน SERVICE CLEANUP", {
|
|
92
92
|
renderCount: u,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
94
|
}), N.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
|
-
}, [o, n, m,
|
|
97
|
-
const
|
|
96
|
+
}, [o, n, m, a]);
|
|
97
|
+
const S = Q(null);
|
|
98
98
|
X(() => {
|
|
99
|
-
var N,
|
|
100
|
-
if (
|
|
99
|
+
var N, v;
|
|
100
|
+
if (a("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
101
|
hasService: !!c,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
104
|
isConnecting: M.current,
|
|
105
|
-
isConnected:
|
|
105
|
+
isConnected: x,
|
|
106
106
|
dependencies: { service: !!c, userId: s == null ? void 0 : s.id }
|
|
107
107
|
}), !c || !s) {
|
|
108
|
-
|
|
108
|
+
a("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
if (M.current) {
|
|
112
|
-
|
|
112
|
+
a("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((N =
|
|
116
|
-
|
|
115
|
+
if (((N = S.current) == null ? void 0 : N.serviceId) === c && ((v = S.current) == null ? void 0 : v.userId) === s.id) {
|
|
116
|
+
a(
|
|
117
117
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
119
119
|
);
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
|
|
123
|
+
a("๐ STARTING USER CONNECTION", { userId: s.id }), M.current = !0, y(!0), C(null);
|
|
124
124
|
try {
|
|
125
|
-
|
|
125
|
+
a("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
126
|
const f = await c.connectUser(s);
|
|
127
|
-
b(f),
|
|
127
|
+
b(f), w(!0), S.current = { serviceId: c, userId: s.id }, a("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: f.userID
|
|
130
130
|
});
|
|
131
131
|
} catch (f) {
|
|
132
|
-
const
|
|
133
|
-
C(
|
|
132
|
+
const k = f instanceof Error ? f.message : "Connection failed";
|
|
133
|
+
C(k), a("โ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
|
-
error:
|
|
135
|
+
error: k
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
y(!1), M.current = !1, a("๐ USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
|
-
isConnected:
|
|
140
|
+
isConnected: x
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [c, s,
|
|
144
|
+
}, [c, s, a, x]), X(() => (a("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
145
|
hasService: !!c,
|
|
146
|
-
isConnected:
|
|
146
|
+
isConnected: x
|
|
147
147
|
}), () => {
|
|
148
|
-
c &&
|
|
148
|
+
c && x ? (a(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
151
|
+
), S.current = null, c.disconnectUser().catch(console.error)) : a("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
152
|
hasService: !!c,
|
|
153
|
-
isConnected:
|
|
153
|
+
isConnected: x
|
|
154
154
|
});
|
|
155
|
-
}), [c,
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
155
|
+
}), [c, x, a]);
|
|
156
|
+
const L = P(async () => {
|
|
157
|
+
if (a("๐ REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!c,
|
|
159
159
|
hasUser: !!s
|
|
160
160
|
}), !c || !s) {
|
|
161
|
-
|
|
161
|
+
a("โ ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
a("๐ STARTING CONNECTION REFRESH", { userId: s.id }), y(!0);
|
|
165
165
|
try {
|
|
166
|
-
|
|
166
|
+
a("๐ DISCONNECTING FOR REFRESH"), await c.disconnectUser(), a("๐ RECONNECTING FOR REFRESH");
|
|
167
167
|
const u = await c.connectUser(s);
|
|
168
|
-
b(u),
|
|
168
|
+
b(u), w(!0), C(null), a("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
169
|
} catch (u) {
|
|
170
170
|
const N = u instanceof Error ? u.message : "Refresh failed";
|
|
171
|
-
C(N),
|
|
171
|
+
C(N), a("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
173
|
error: N
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
y(!1), a("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [c, s,
|
|
178
|
+
}, [c, s, a]), d = B.useMemo(() => (a("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!c,
|
|
180
180
|
hasClient: !!h,
|
|
181
|
-
isConnected:
|
|
182
|
-
isLoading:
|
|
183
|
-
hasError: !!
|
|
181
|
+
isConnected: x,
|
|
182
|
+
isLoading: r,
|
|
183
|
+
hasError: !!_,
|
|
184
184
|
capabilitiesKeys: Object.keys(l)
|
|
185
185
|
}), {
|
|
186
186
|
service: c,
|
|
187
187
|
client: h,
|
|
188
|
-
isConnected:
|
|
189
|
-
isLoading:
|
|
190
|
-
error:
|
|
188
|
+
isConnected: x,
|
|
189
|
+
isLoading: r,
|
|
190
|
+
error: _,
|
|
191
191
|
capabilities: l,
|
|
192
|
-
refreshConnection:
|
|
192
|
+
refreshConnection: L,
|
|
193
193
|
debug: m
|
|
194
194
|
}), [
|
|
195
195
|
c,
|
|
196
196
|
h,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
x,
|
|
198
|
+
r,
|
|
199
|
+
_,
|
|
200
200
|
l,
|
|
201
|
-
|
|
201
|
+
L,
|
|
202
202
|
m,
|
|
203
|
-
|
|
203
|
+
a
|
|
204
204
|
]);
|
|
205
|
-
return
|
|
206
|
-
renderCount:
|
|
207
|
-
willRenderChat: !!(h &&
|
|
205
|
+
return a("๐ RENDER END", {
|
|
206
|
+
renderCount: p.current,
|
|
207
|
+
willRenderChat: !!(h && x),
|
|
208
208
|
contextValueReady: !!d
|
|
209
|
-
}), /* @__PURE__ */ e(Ge.Provider, { value: d, children: h &&
|
|
210
|
-
|
|
209
|
+
}), /* @__PURE__ */ e(Ge.Provider, { value: d, children: h && x ? /* @__PURE__ */ e(
|
|
210
|
+
dt,
|
|
211
211
|
{
|
|
212
212
|
client: h,
|
|
213
213
|
customClasses: {
|
|
@@ -216,24 +216,46 @@ const Ge = ot({
|
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
},
|
|
219
|
+
}, Kt = () => ve(), ze = B.createContext({
|
|
220
220
|
selectedChannel: void 0,
|
|
221
221
|
onChannelSelect: () => {
|
|
222
222
|
},
|
|
223
223
|
debug: !1,
|
|
224
224
|
renderMessagePreview: void 0
|
|
225
|
-
}),
|
|
225
|
+
}), es = ze.Provider, ts = () => B.useContext(ze), Ve = (t) => {
|
|
226
|
+
var o, l;
|
|
227
|
+
const [s, n] = T(
|
|
228
|
+
!!((l = (o = t == null ? void 0 : t.state) == null ? void 0 : o.membership) != null && l.pinned_at)
|
|
229
|
+
);
|
|
230
|
+
return X(() => {
|
|
231
|
+
var a;
|
|
232
|
+
if (!t) {
|
|
233
|
+
n(!1);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
n(!!((a = t.state.membership) != null && a.pinned_at));
|
|
237
|
+
const m = (c) => {
|
|
238
|
+
var g;
|
|
239
|
+
n(
|
|
240
|
+
c != null && c.member ? !!c.member.pinned_at : !!((g = t.state.membership) != null && g.pinned_at)
|
|
241
|
+
);
|
|
242
|
+
};
|
|
243
|
+
return t.on("member.updated", m), () => {
|
|
244
|
+
t.off("member.updated", m);
|
|
245
|
+
};
|
|
246
|
+
}, [t]), s;
|
|
247
|
+
}, ss = (t, s) => {
|
|
226
248
|
const n = new Date(
|
|
227
249
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
228
250
|
), l = new Date(
|
|
229
251
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
230
252
|
).getTime() - n.getTime();
|
|
231
253
|
return Math.floor(l / (1e3 * 60 * 60 * 24));
|
|
232
|
-
},
|
|
254
|
+
}, ns = (t) => {
|
|
233
255
|
const s = /* @__PURE__ */ new Date();
|
|
234
256
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
235
257
|
return "Just now";
|
|
236
|
-
const o =
|
|
258
|
+
const o = ss(t, s);
|
|
237
259
|
return o === 0 ? t.toLocaleTimeString([], {
|
|
238
260
|
hour: "numeric",
|
|
239
261
|
minute: "2-digit",
|
|
@@ -271,7 +293,7 @@ const Ge = ot({
|
|
|
271
293
|
"๐"
|
|
272
294
|
// Melon
|
|
273
295
|
];
|
|
274
|
-
function
|
|
296
|
+
function as(t) {
|
|
275
297
|
let s = 0;
|
|
276
298
|
for (let n = 0; n < t.length; n++) {
|
|
277
299
|
const o = t.charCodeAt(n);
|
|
@@ -279,8 +301,8 @@ function ns(t) {
|
|
|
279
301
|
}
|
|
280
302
|
return Math.abs(s);
|
|
281
303
|
}
|
|
282
|
-
function
|
|
283
|
-
const n =
|
|
304
|
+
function rs(t) {
|
|
305
|
+
const n = as(t) % Ae.length;
|
|
284
306
|
return Ae[n];
|
|
285
307
|
}
|
|
286
308
|
const se = ({
|
|
@@ -291,14 +313,14 @@ const se = ({
|
|
|
291
313
|
starred: l = !1,
|
|
292
314
|
shape: m = "squircle"
|
|
293
315
|
}) => {
|
|
294
|
-
const
|
|
316
|
+
const a = rs(t), g = n < 32 ? "text-xs" : n < 56 ? "text-sm" : n < 120 ? "text-lg" : "text-4xl", h = m === "circle" ? { borderRadius: "50%" } : {
|
|
295
317
|
borderRadius: "33%",
|
|
296
318
|
"corner-shape": "superellipse(1.3)"
|
|
297
319
|
};
|
|
298
320
|
return /* @__PURE__ */ i(
|
|
299
321
|
"div",
|
|
300
322
|
{
|
|
301
|
-
className:
|
|
323
|
+
className: R("relative flex-shrink-0", o),
|
|
302
324
|
style: {
|
|
303
325
|
width: `${n}px`,
|
|
304
326
|
height: `${n}px`
|
|
@@ -323,17 +345,17 @@ const se = ({
|
|
|
323
345
|
"div",
|
|
324
346
|
{
|
|
325
347
|
"aria-hidden": "true",
|
|
326
|
-
className:
|
|
348
|
+
className: R(
|
|
327
349
|
"avatar-fallback flex h-full w-full items-center justify-center bg-[#E6E5E3] font-semibold select-none transition-colors",
|
|
328
|
-
|
|
350
|
+
g
|
|
329
351
|
),
|
|
330
|
-
children:
|
|
352
|
+
children: a
|
|
331
353
|
}
|
|
332
354
|
) })
|
|
333
355
|
]
|
|
334
356
|
}
|
|
335
357
|
);
|
|
336
|
-
},
|
|
358
|
+
}, os = ({ size: t = 15 }) => /* @__PURE__ */ e(
|
|
337
359
|
"svg",
|
|
338
360
|
{
|
|
339
361
|
width: t,
|
|
@@ -350,81 +372,81 @@ const se = ({
|
|
|
350
372
|
}
|
|
351
373
|
)
|
|
352
374
|
}
|
|
353
|
-
),
|
|
375
|
+
), ls = (t) => {
|
|
354
376
|
var s;
|
|
355
377
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
|
|
356
|
-
},
|
|
378
|
+
}, is = (t) => {
|
|
357
379
|
var s;
|
|
358
380
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
|
|
359
381
|
}, Te = (t) => {
|
|
360
382
|
var s;
|
|
361
383
|
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
|
|
362
|
-
},
|
|
384
|
+
}, He = (t) => ls(t) || is(t), cs = (t) => {
|
|
363
385
|
var s;
|
|
364
|
-
return
|
|
386
|
+
return He(t) && !((s = t.text) != null && s.trim());
|
|
365
387
|
}, ye = ({
|
|
366
388
|
message: t,
|
|
367
389
|
standalone: s = !1,
|
|
368
390
|
isMyMessage: n = !1,
|
|
369
391
|
hasAttachment: o = !1
|
|
370
392
|
}) => {
|
|
371
|
-
var
|
|
372
|
-
const l =
|
|
393
|
+
var x;
|
|
394
|
+
const l = He(t), m = Te(t);
|
|
373
395
|
if (!l && !m)
|
|
374
396
|
return null;
|
|
375
397
|
if (l) {
|
|
376
|
-
const
|
|
377
|
-
if (!
|
|
378
|
-
const
|
|
379
|
-
return /* @__PURE__ */ i("div", { className:
|
|
380
|
-
/* @__PURE__ */ e(
|
|
381
|
-
/* @__PURE__ */ e("span", { children:
|
|
398
|
+
const w = (x = t.metadata) == null ? void 0 : x.amount_text;
|
|
399
|
+
if (!w) return null;
|
|
400
|
+
const r = s ? "message-tip-standalone" : "message-tag message-tag--tip", y = s ? `${w} tip` : `Delivered with ${w} tip`;
|
|
401
|
+
return /* @__PURE__ */ i("div", { className: r, children: [
|
|
402
|
+
/* @__PURE__ */ e(qt, { size: s ? 14 : 12 }),
|
|
403
|
+
/* @__PURE__ */ e("span", { children: y })
|
|
382
404
|
] });
|
|
383
405
|
}
|
|
384
|
-
const
|
|
406
|
+
const a = n && o, c = a ? "Sent with AI" : "Sent with DM Agent", g = [
|
|
385
407
|
"message-chatbot-indicator",
|
|
386
408
|
n ? "message-chatbot-indicator--sender" : "message-chatbot-indicator--receiver",
|
|
387
|
-
|
|
388
|
-
].join(" "), h = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__label", children: c }), b = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__icon", children: /* @__PURE__ */ e(
|
|
389
|
-
return /* @__PURE__ */ e("div", { className:
|
|
409
|
+
a ? "message-chatbot-indicator--attachment" : "message-chatbot-indicator--text"
|
|
410
|
+
].join(" "), h = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__label", children: c }), b = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__icon", children: /* @__PURE__ */ e(os, { size: a ? 12 : 15 }) });
|
|
411
|
+
return /* @__PURE__ */ e("div", { className: g, "data-testid": "message-chatbot-indicator", children: n && !a ? /* @__PURE__ */ i(me, { children: [
|
|
390
412
|
h,
|
|
391
413
|
b
|
|
392
414
|
] }) : /* @__PURE__ */ i(me, { children: [
|
|
393
415
|
b,
|
|
394
416
|
h
|
|
395
417
|
] }) });
|
|
396
|
-
},
|
|
418
|
+
}, We = B.memo(
|
|
397
419
|
({ channel: t, unread: s }) => {
|
|
398
|
-
var
|
|
399
|
-
const { selectedChannel: n, onChannelSelect: o, debug: l, renderMessagePreview: m } =
|
|
420
|
+
var L, d, u, N;
|
|
421
|
+
const { selectedChannel: n, onChannelSelect: o, debug: l, renderMessagePreview: m } = ts(), a = (n == null ? void 0 : n.id) === (t == null ? void 0 : t.id), c = () => {
|
|
400
422
|
t && o(t);
|
|
401
|
-
},
|
|
402
|
-
const
|
|
403
|
-
!
|
|
404
|
-
}, b = Object.values(((
|
|
405
|
-
(
|
|
406
|
-
var
|
|
407
|
-
return ((
|
|
423
|
+
}, g = (v) => {
|
|
424
|
+
const f = v.key === "Enter" || v.key === " ", k = v.repeat;
|
|
425
|
+
!f || k || (v.preventDefault(), c());
|
|
426
|
+
}, b = Object.values(((L = t == null ? void 0 : t.state) == null ? void 0 : L.members) || {}).find(
|
|
427
|
+
(v) => {
|
|
428
|
+
var f, k;
|
|
429
|
+
return ((f = v.user) == null ? void 0 : f.id) && v.user.id !== ((k = t == null ? void 0 : t._client) == null ? void 0 : k.userID);
|
|
408
430
|
}
|
|
409
|
-
),
|
|
410
|
-
var
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
for (let
|
|
414
|
-
if (
|
|
431
|
+
), x = ((d = b == null ? void 0 : b.user) == null ? void 0 : d.name) || "Conversation", w = (u = b == null ? void 0 : b.user) == null ? void 0 : u.image, r = (() => {
|
|
432
|
+
var f;
|
|
433
|
+
const v = (f = t == null ? void 0 : t.state) == null ? void 0 : f.messages;
|
|
434
|
+
if (v != null && v.length) {
|
|
435
|
+
for (let k = v.length - 1; k >= 0; k--)
|
|
436
|
+
if (v[k].type !== "system") return v[k];
|
|
415
437
|
}
|
|
416
|
-
})(),
|
|
417
|
-
var
|
|
418
|
-
if (
|
|
419
|
-
if (((
|
|
420
|
-
const
|
|
421
|
-
return
|
|
422
|
-
})(), C =
|
|
438
|
+
})(), _ = (() => {
|
|
439
|
+
var k, H;
|
|
440
|
+
if (r != null && r.text) return r.text;
|
|
441
|
+
if (((k = r == null ? void 0 : r.metadata) == null ? void 0 : k.custom_type) === "MESSAGE_TIP") return "๐ต Sent a tip";
|
|
442
|
+
const f = (H = r == null ? void 0 : r.attachments) == null ? void 0 : H[0];
|
|
443
|
+
return f ? f.og_scrape_url ? f.og_scrape_url : f.type === "image" ? "๐ท Sent an image" : f.type === "video" ? "๐ฅ Sent a video" : f.type === "audio" ? "๐ต Sent audio" : f.type === "file" ? "๐ Sent a file" : "๐ Sent an attachment" : "No messages yet";
|
|
444
|
+
})(), C = r != null && r.created_at ? ns(new Date(r.created_at)) : "", M = r ? Te(r) : !1, E = m ? m(r, _) : `${M ? "โจ " : ""}${_}`, p = Ve(t), S = s ?? 0;
|
|
423
445
|
return l && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
424
446
|
channelId: t == null ? void 0 : t.id,
|
|
425
|
-
isSelected:
|
|
426
|
-
participantName:
|
|
427
|
-
unreadCount:
|
|
447
|
+
isSelected: a,
|
|
448
|
+
participantName: x,
|
|
449
|
+
unreadCount: S,
|
|
428
450
|
hasTimestamp: !!C
|
|
429
451
|
}), /* @__PURE__ */ e(
|
|
430
452
|
"div",
|
|
@@ -432,23 +454,23 @@ const se = ({
|
|
|
432
454
|
role: "button",
|
|
433
455
|
tabIndex: 0,
|
|
434
456
|
onClick: c,
|
|
435
|
-
onKeyDown:
|
|
436
|
-
className:
|
|
457
|
+
onKeyDown: g,
|
|
458
|
+
className: R(
|
|
437
459
|
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
438
460
|
{
|
|
439
|
-
"bg-primary-alt/10 border-l-4 border-l-primary":
|
|
440
|
-
"hover:bg-sand": !
|
|
461
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": a,
|
|
462
|
+
"hover:bg-sand": !a
|
|
441
463
|
}
|
|
442
464
|
),
|
|
443
465
|
children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
444
466
|
/* @__PURE__ */ e(
|
|
445
467
|
se,
|
|
446
468
|
{
|
|
447
|
-
id: ((
|
|
448
|
-
name:
|
|
449
|
-
image:
|
|
469
|
+
id: ((N = b == null ? void 0 : b.user) == null ? void 0 : N.id) || t.id || "unknown",
|
|
470
|
+
name: x,
|
|
471
|
+
image: w,
|
|
450
472
|
size: 44,
|
|
451
|
-
starred:
|
|
473
|
+
starred: p,
|
|
452
474
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
453
475
|
}
|
|
454
476
|
),
|
|
@@ -457,21 +479,21 @@ const se = ({
|
|
|
457
479
|
/* @__PURE__ */ i(
|
|
458
480
|
"h3",
|
|
459
481
|
{
|
|
460
|
-
className:
|
|
482
|
+
className: R(
|
|
461
483
|
"text-sm font-medium truncate",
|
|
462
|
-
|
|
484
|
+
a ? "text-primary" : "text-charcoal"
|
|
463
485
|
),
|
|
464
486
|
children: [
|
|
465
|
-
|
|
466
|
-
|
|
487
|
+
p && /* @__PURE__ */ e("span", { className: "sr-only", children: "Starred conversation. " }),
|
|
488
|
+
x
|
|
467
489
|
]
|
|
468
490
|
}
|
|
469
491
|
),
|
|
470
492
|
C && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: C })
|
|
471
493
|
] }),
|
|
472
494
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
473
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children:
|
|
474
|
-
|
|
495
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children: E }),
|
|
496
|
+
S > 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: S > 99 ? "99+" : S })
|
|
475
497
|
] })
|
|
476
498
|
] })
|
|
477
499
|
] })
|
|
@@ -479,8 +501,8 @@ const se = ({
|
|
|
479
501
|
);
|
|
480
502
|
}
|
|
481
503
|
);
|
|
482
|
-
|
|
483
|
-
const
|
|
504
|
+
We.displayName = "CustomChannelPreview";
|
|
505
|
+
const ds = { last_message_at: -1 }, qe = B.memo(
|
|
484
506
|
({
|
|
485
507
|
onChannelSelect: t,
|
|
486
508
|
selectedChannel: s,
|
|
@@ -488,54 +510,54 @@ const cs = { last_message_at: -1 }, We = $.memo(
|
|
|
488
510
|
allowNewMessagesFromUnfilteredChannels: o = !1,
|
|
489
511
|
onMessageNew: l,
|
|
490
512
|
onAddedToChannel: m,
|
|
491
|
-
sort:
|
|
513
|
+
sort: a = ds,
|
|
492
514
|
className: c,
|
|
493
|
-
customEmptyStateIndicator:
|
|
515
|
+
customEmptyStateIndicator: g,
|
|
494
516
|
renderMessagePreview: h
|
|
495
517
|
}) => {
|
|
496
|
-
const b =
|
|
518
|
+
const b = B.useRef(0);
|
|
497
519
|
b.current++;
|
|
498
|
-
const { debug:
|
|
499
|
-
|
|
520
|
+
const { debug: x = !1 } = ve();
|
|
521
|
+
x && console.log("๐บ [ChannelList] ๐ RENDER START", {
|
|
500
522
|
renderCount: b.current,
|
|
501
523
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
502
524
|
filters: n
|
|
503
525
|
});
|
|
504
|
-
const
|
|
526
|
+
const w = B.useMemo(
|
|
505
527
|
() => ({
|
|
506
528
|
selectedChannel: s,
|
|
507
529
|
onChannelSelect: t,
|
|
508
|
-
debug:
|
|
530
|
+
debug: x,
|
|
509
531
|
renderMessagePreview: h
|
|
510
532
|
}),
|
|
511
|
-
[s, t,
|
|
533
|
+
[s, t, x, h]
|
|
512
534
|
);
|
|
513
535
|
return /* @__PURE__ */ e(
|
|
514
536
|
"div",
|
|
515
537
|
{
|
|
516
|
-
className:
|
|
538
|
+
className: R(
|
|
517
539
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
518
540
|
c
|
|
519
541
|
),
|
|
520
|
-
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
|
|
521
|
-
|
|
542
|
+
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(es, { value: w, children: /* @__PURE__ */ e(
|
|
543
|
+
ut,
|
|
522
544
|
{
|
|
523
545
|
filters: n,
|
|
524
|
-
sort:
|
|
546
|
+
sort: a,
|
|
525
547
|
options: { limit: 30 },
|
|
526
548
|
allowNewMessagesFromUnfilteredChannels: o,
|
|
527
549
|
onMessageNew: l,
|
|
528
550
|
onAddedToChannel: m,
|
|
529
|
-
Preview:
|
|
530
|
-
EmptyStateIndicator:
|
|
551
|
+
Preview: We,
|
|
552
|
+
EmptyStateIndicator: g
|
|
531
553
|
},
|
|
532
|
-
`${JSON.stringify(n)}:${JSON.stringify(
|
|
554
|
+
`${JSON.stringify(n)}:${JSON.stringify(a)}`
|
|
533
555
|
) }) })
|
|
534
556
|
}
|
|
535
557
|
);
|
|
536
558
|
}
|
|
537
559
|
);
|
|
538
|
-
|
|
560
|
+
qe.displayName = "ChannelList";
|
|
539
561
|
const xe = ({
|
|
540
562
|
variant: t = "default",
|
|
541
563
|
className: s,
|
|
@@ -545,7 +567,7 @@ const xe = ({
|
|
|
545
567
|
"button",
|
|
546
568
|
{
|
|
547
569
|
type: "button",
|
|
548
|
-
className:
|
|
570
|
+
className: R(
|
|
549
571
|
"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
|
|
550
572
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
551
573
|
s
|
|
@@ -554,12 +576,12 @@ const xe = ({
|
|
|
554
576
|
children: n
|
|
555
577
|
}
|
|
556
578
|
);
|
|
557
|
-
function
|
|
579
|
+
function Ye({ label: t, className: s, children: n, ...o }) {
|
|
558
580
|
return /* @__PURE__ */ i(
|
|
559
581
|
"button",
|
|
560
582
|
{
|
|
561
583
|
type: "button",
|
|
562
|
-
className:
|
|
584
|
+
className: R(
|
|
563
585
|
"rounded-full p-2 transition-colors focus-ring",
|
|
564
586
|
{
|
|
565
587
|
"cursor-not-allowed opacity-50": o.disabled,
|
|
@@ -575,84 +597,84 @@ function qe({ label: t, className: s, children: n, ...o }) {
|
|
|
575
597
|
}
|
|
576
598
|
);
|
|
577
599
|
}
|
|
578
|
-
function
|
|
579
|
-
return /* @__PURE__ */ e(
|
|
600
|
+
function Ze({ onClick: t }) {
|
|
601
|
+
return /* @__PURE__ */ e(Ye, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ke, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
580
602
|
}
|
|
581
|
-
const
|
|
603
|
+
const us = ({
|
|
582
604
|
dialogRef: t,
|
|
583
605
|
onClose: s,
|
|
584
606
|
participant: n,
|
|
585
607
|
channel: o,
|
|
586
608
|
followerStatusLabel: l,
|
|
587
609
|
onLeaveConversation: m,
|
|
588
|
-
onBlockParticipant:
|
|
610
|
+
onBlockParticipant: a,
|
|
589
611
|
showDeleteConversation: c = !0,
|
|
590
|
-
onDeleteConversationClick:
|
|
612
|
+
onDeleteConversationClick: g,
|
|
591
613
|
onBlockParticipantClick: h,
|
|
592
614
|
onReportParticipantClick: b,
|
|
593
|
-
customProfileContent:
|
|
594
|
-
customChannelActions:
|
|
615
|
+
customProfileContent: x,
|
|
616
|
+
customChannelActions: w
|
|
595
617
|
}) => {
|
|
596
|
-
var
|
|
597
|
-
const { service:
|
|
598
|
-
var
|
|
599
|
-
if (!(!
|
|
618
|
+
var W, j, ne, ae, G, K, re;
|
|
619
|
+
const { service: r, debug: y } = ve(), [_, C] = T(!1), [M, E] = T(!1), [p, S] = T(!1), L = P(async () => {
|
|
620
|
+
var U;
|
|
621
|
+
if (!(!r || !((U = n == null ? void 0 : n.user) != null && U.id)))
|
|
600
622
|
try {
|
|
601
|
-
const
|
|
602
|
-
(
|
|
623
|
+
const A = (await r.getBlockedUsers()).some(
|
|
624
|
+
(z) => {
|
|
603
625
|
var ce;
|
|
604
|
-
return
|
|
626
|
+
return z.blocked_user_id === ((ce = n == null ? void 0 : n.user) == null ? void 0 : ce.id);
|
|
605
627
|
}
|
|
606
628
|
);
|
|
607
|
-
C(
|
|
608
|
-
} catch (
|
|
629
|
+
C(A);
|
|
630
|
+
} catch (O) {
|
|
609
631
|
console.error(
|
|
610
632
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
611
|
-
|
|
633
|
+
O
|
|
612
634
|
);
|
|
613
635
|
}
|
|
614
|
-
}, [
|
|
636
|
+
}, [r, (W = n == null ? void 0 : n.user) == null ? void 0 : W.id]);
|
|
615
637
|
X(() => {
|
|
616
|
-
|
|
617
|
-
}, [
|
|
638
|
+
L();
|
|
639
|
+
}, [L]);
|
|
618
640
|
const d = async () => {
|
|
619
|
-
var
|
|
641
|
+
var U;
|
|
620
642
|
if (!M) {
|
|
621
|
-
|
|
643
|
+
g == null || g(), y && console.log("[ChannelInfoDialog] Leave conversation", o.cid), E(!0);
|
|
622
644
|
try {
|
|
623
|
-
const
|
|
624
|
-
await o.hide(
|
|
625
|
-
} catch (
|
|
626
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
645
|
+
const O = ((U = o._client) == null ? void 0 : U.userID) ?? null;
|
|
646
|
+
await o.hide(O, !1), m && await m(o), s();
|
|
647
|
+
} catch (O) {
|
|
648
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", O);
|
|
627
649
|
} finally {
|
|
628
|
-
|
|
650
|
+
E(!1);
|
|
629
651
|
}
|
|
630
652
|
}
|
|
631
653
|
}, u = async () => {
|
|
632
|
-
var
|
|
633
|
-
if (!(
|
|
634
|
-
h == null || h(),
|
|
654
|
+
var U, O, A;
|
|
655
|
+
if (!(p || !r)) {
|
|
656
|
+
h == null || h(), y && console.log("[ChannelInfoDialog] Block member", (U = n == null ? void 0 : n.user) == null ? void 0 : U.id), S(!0);
|
|
635
657
|
try {
|
|
636
|
-
await
|
|
637
|
-
} catch (
|
|
638
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
658
|
+
await r.blockUser((O = n == null ? void 0 : n.user) == null ? void 0 : O.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
659
|
+
} catch (z) {
|
|
660
|
+
console.error("[ChannelInfoDialog] Failed to block member", z);
|
|
639
661
|
} finally {
|
|
640
|
-
|
|
662
|
+
S(!1);
|
|
641
663
|
}
|
|
642
664
|
}
|
|
643
665
|
}, N = async () => {
|
|
644
|
-
var
|
|
645
|
-
if (!(
|
|
646
|
-
h == null || h(),
|
|
666
|
+
var U, O, A;
|
|
667
|
+
if (!(p || !r)) {
|
|
668
|
+
h == null || h(), y && console.log("[ChannelInfoDialog] Unblock member", (U = n == null ? void 0 : n.user) == null ? void 0 : U.id), S(!0);
|
|
647
669
|
try {
|
|
648
|
-
await
|
|
649
|
-
} catch (
|
|
650
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
670
|
+
await r.unBlockUser((O = n == null ? void 0 : n.user) == null ? void 0 : O.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
|
|
671
|
+
} catch (z) {
|
|
672
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", z);
|
|
651
673
|
} finally {
|
|
652
|
-
|
|
674
|
+
S(!1);
|
|
653
675
|
}
|
|
654
676
|
}
|
|
655
|
-
},
|
|
677
|
+
}, v = () => {
|
|
656
678
|
b == null || b(), s(), window.open(
|
|
657
679
|
"https://linktr.ee/s/about/trust-center/report",
|
|
658
680
|
"_blank",
|
|
@@ -660,7 +682,7 @@ const ds = ({
|
|
|
660
682
|
);
|
|
661
683
|
};
|
|
662
684
|
if (!n) return null;
|
|
663
|
-
const f = ((
|
|
685
|
+
const f = ((j = n.user) == null ? void 0 : j.name) || ((ne = n.user) == null ? void 0 : ne.id) || "Unknown member", k = (ae = n.user) == null ? void 0 : ae.image, H = (G = n.user) == null ? void 0 : G.email, Z = (K = n.user) == null ? void 0 : K.username, Y = H || (Z ? `linktr.ee/${Z}` : void 0), D = ((re = n.user) == null ? void 0 : re.id) || "unknown";
|
|
664
686
|
return (
|
|
665
687
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
666
688
|
/* @__PURE__ */ e(
|
|
@@ -669,13 +691,13 @@ const ds = ({
|
|
|
669
691
|
ref: t,
|
|
670
692
|
className: "mes-dialog group",
|
|
671
693
|
onClose: s,
|
|
672
|
-
onClick: (
|
|
673
|
-
|
|
694
|
+
onClick: (U) => {
|
|
695
|
+
U.target === t.current && s();
|
|
674
696
|
},
|
|
675
697
|
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: [
|
|
676
698
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
677
699
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
678
|
-
/* @__PURE__ */ e(
|
|
700
|
+
/* @__PURE__ */ e(Ze, { onClick: s })
|
|
679
701
|
] }),
|
|
680
702
|
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
681
703
|
/* @__PURE__ */ e(
|
|
@@ -687,17 +709,17 @@ const ds = ({
|
|
|
687
709
|
/* @__PURE__ */ e(
|
|
688
710
|
se,
|
|
689
711
|
{
|
|
690
|
-
id:
|
|
712
|
+
id: D,
|
|
691
713
|
name: f,
|
|
692
|
-
image:
|
|
714
|
+
image: k,
|
|
693
715
|
size: 88,
|
|
694
716
|
shape: "circle"
|
|
695
717
|
}
|
|
696
718
|
),
|
|
697
719
|
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
698
720
|
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: f }),
|
|
699
|
-
|
|
700
|
-
l && !
|
|
721
|
+
Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
|
|
722
|
+
l && !x && /* @__PURE__ */ e(
|
|
701
723
|
"span",
|
|
702
724
|
{
|
|
703
725
|
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
@@ -711,7 +733,7 @@ const ds = ({
|
|
|
711
733
|
children: l
|
|
712
734
|
}
|
|
713
735
|
),
|
|
714
|
-
|
|
736
|
+
x
|
|
715
737
|
] })
|
|
716
738
|
] })
|
|
717
739
|
}
|
|
@@ -724,19 +746,19 @@ const ds = ({
|
|
|
724
746
|
disabled: M,
|
|
725
747
|
"aria-busy": M,
|
|
726
748
|
children: [
|
|
727
|
-
M ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(
|
|
749
|
+
M ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Yt, { className: "h-5 w-5" }),
|
|
728
750
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
729
751
|
]
|
|
730
752
|
}
|
|
731
753
|
) }),
|
|
732
|
-
/* @__PURE__ */ e("li", { children:
|
|
754
|
+
/* @__PURE__ */ e("li", { children: _ ? /* @__PURE__ */ i(
|
|
733
755
|
xe,
|
|
734
756
|
{
|
|
735
757
|
onClick: N,
|
|
736
|
-
disabled:
|
|
737
|
-
"aria-busy":
|
|
758
|
+
disabled: p,
|
|
759
|
+
"aria-busy": p,
|
|
738
760
|
children: [
|
|
739
|
-
|
|
761
|
+
p ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Le, { className: "h-5 w-5" }),
|
|
740
762
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
741
763
|
]
|
|
742
764
|
}
|
|
@@ -744,39 +766,39 @@ const ds = ({
|
|
|
744
766
|
xe,
|
|
745
767
|
{
|
|
746
768
|
onClick: u,
|
|
747
|
-
disabled:
|
|
748
|
-
"aria-busy":
|
|
769
|
+
disabled: p,
|
|
770
|
+
"aria-busy": p,
|
|
749
771
|
children: [
|
|
750
|
-
|
|
772
|
+
p ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Le, { className: "h-5 w-5" }),
|
|
751
773
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
752
774
|
]
|
|
753
775
|
}
|
|
754
776
|
) }),
|
|
755
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(xe, { variant: "danger", onClick:
|
|
756
|
-
/* @__PURE__ */ e(
|
|
777
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(xe, { variant: "danger", onClick: v, children: [
|
|
778
|
+
/* @__PURE__ */ e(Zt, { className: "h-5 w-5" }),
|
|
757
779
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
758
780
|
] }) }),
|
|
759
|
-
|
|
781
|
+
w
|
|
760
782
|
] })
|
|
761
783
|
] })
|
|
762
784
|
] })
|
|
763
785
|
}
|
|
764
786
|
)
|
|
765
787
|
);
|
|
766
|
-
},
|
|
767
|
-
function ms(t) {
|
|
768
|
-
return t != null && t.length ? t.some((s) => s.type === Se) ? "down" : t.some((s) => s.type === Ie) ? "up" : null : null;
|
|
769
|
-
}
|
|
788
|
+
}, ms = (t) => /* @__PURE__ */ e(mt, { ...t, position: "center" }), Se = "vote_up", Ie = "vote_down";
|
|
770
789
|
function hs(t) {
|
|
790
|
+
return t != null && t.length ? t.some((s) => s.type === Ie) ? "down" : t.some((s) => s.type === Se) ? "up" : null : null;
|
|
791
|
+
}
|
|
792
|
+
function fs(t) {
|
|
771
793
|
const { channel: s } = Me(), { client: n } = $e("useMessageVote"), o = _e(
|
|
772
|
-
() =>
|
|
794
|
+
() => hs(t.own_reactions),
|
|
773
795
|
[t.own_reactions]
|
|
774
796
|
), l = P(async () => {
|
|
775
797
|
if (n != null && n.userID)
|
|
776
798
|
try {
|
|
777
|
-
o === "up" ? await s.deleteReaction(t.id,
|
|
799
|
+
o === "up" ? await s.deleteReaction(t.id, Se) : await s.sendReaction(
|
|
778
800
|
t.id,
|
|
779
|
-
{ type:
|
|
801
|
+
{ type: Se },
|
|
780
802
|
{ enforce_unique: !0, skip_push: !0 }
|
|
781
803
|
);
|
|
782
804
|
} catch {
|
|
@@ -784,9 +806,9 @@ function hs(t) {
|
|
|
784
806
|
}, [s, n == null ? void 0 : n.userID, t.id, o]), m = P(async () => {
|
|
785
807
|
if (n != null && n.userID)
|
|
786
808
|
try {
|
|
787
|
-
o === "down" ? await s.deleteReaction(t.id,
|
|
809
|
+
o === "down" ? await s.deleteReaction(t.id, Ie) : await s.sendReaction(
|
|
788
810
|
t.id,
|
|
789
|
-
{ type:
|
|
811
|
+
{ type: Ie },
|
|
790
812
|
{ enforce_unique: !0, skip_push: !0 }
|
|
791
813
|
);
|
|
792
814
|
} catch {
|
|
@@ -794,7 +816,7 @@ function hs(t) {
|
|
|
794
816
|
}, [s, n == null ? void 0 : n.userID, t.id, o]);
|
|
795
817
|
return { selected: o, voteUp: l, voteDown: m };
|
|
796
818
|
}
|
|
797
|
-
const
|
|
819
|
+
const gs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
|
|
798
820
|
"path",
|
|
799
821
|
{
|
|
800
822
|
d: "M4.667 7.333l2.666-6A1.333 1.333 0 018.667 2v2.667a.667.667 0 00.666.666h3.764a1.334 1.334 0 011.192 1.93l-2.333 4.666a1.333 1.333 0 01-1.193.738H4.667m0-5.334v5.334m0-5.334H2.667a1.333 1.333 0 00-1.334 1.334v2.666a1.333 1.333 0 001.334 1.334h2",
|
|
@@ -804,7 +826,7 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
804
826
|
strokeLinejoin: "round",
|
|
805
827
|
fill: t ? "currentColor" : "none"
|
|
806
828
|
}
|
|
807
|
-
) }),
|
|
829
|
+
) }), xs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
|
|
808
830
|
"path",
|
|
809
831
|
{
|
|
810
832
|
d: "M11.333 8.667l-2.666 6A1.333 1.333 0 017.333 14v-2.667a.667.667 0 00-.666-.666H2.903a1.334 1.334 0 01-1.192-1.93l2.333-4.666a1.333 1.333 0 011.193-.738h6.096m0 5.334V3.333m0 5.334h2a1.333 1.333 0 001.334-1.334V4.667a1.333 1.333 0 00-1.334-1.334h-2",
|
|
@@ -814,7 +836,7 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
814
836
|
strokeLinejoin: "round",
|
|
815
837
|
fill: t ? "currentColor" : "none"
|
|
816
838
|
}
|
|
817
|
-
) }),
|
|
839
|
+
) }), bs = ({
|
|
818
840
|
selected: t,
|
|
819
841
|
onVoteUp: s,
|
|
820
842
|
onVoteDown: n
|
|
@@ -827,7 +849,7 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
827
849
|
onClick: s,
|
|
828
850
|
"aria-label": "Helpful",
|
|
829
851
|
"aria-pressed": t === "up",
|
|
830
|
-
children: /* @__PURE__ */ e(
|
|
852
|
+
children: /* @__PURE__ */ e(gs, { filled: t === "up" })
|
|
831
853
|
}
|
|
832
854
|
),
|
|
833
855
|
/* @__PURE__ */ e(
|
|
@@ -838,10 +860,10 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
838
860
|
onClick: n,
|
|
839
861
|
"aria-label": "Not helpful",
|
|
840
862
|
"aria-pressed": t === "down",
|
|
841
|
-
children: /* @__PURE__ */ e(
|
|
863
|
+
children: /* @__PURE__ */ e(xs, { filled: t === "down" })
|
|
842
864
|
}
|
|
843
865
|
)
|
|
844
|
-
] }),
|
|
866
|
+
] }), Cs = (t) => {
|
|
845
867
|
var de, ue;
|
|
846
868
|
const {
|
|
847
869
|
additionalMessageInputProps: s,
|
|
@@ -849,61 +871,61 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
849
871
|
editing: o,
|
|
850
872
|
endOfGroup: l,
|
|
851
873
|
firstOfGroup: m,
|
|
852
|
-
groupedByUser:
|
|
874
|
+
groupedByUser: a,
|
|
853
875
|
handleAction: c,
|
|
854
|
-
handleOpenThread:
|
|
876
|
+
handleOpenThread: g,
|
|
855
877
|
handleRetry: h,
|
|
856
878
|
highlighted: b,
|
|
857
|
-
isMessageAIGenerated:
|
|
858
|
-
isMyMessage:
|
|
859
|
-
message:
|
|
860
|
-
renderText:
|
|
861
|
-
threadList:
|
|
862
|
-
} = t, { client: C } = $e("CustomMessage"), [M,
|
|
863
|
-
Attachment: u =
|
|
864
|
-
EditMessageModal: N =
|
|
865
|
-
MessageBlocked:
|
|
866
|
-
MessageBouncePrompt: f =
|
|
867
|
-
MessageDeleted:
|
|
868
|
-
MessageIsThreadReplyInChannelButtonIndicator:
|
|
869
|
-
MessageRepliesCountButton:
|
|
870
|
-
ReminderNotification:
|
|
871
|
-
StreamedMessageText:
|
|
872
|
-
PinIndicator:
|
|
873
|
-
} =
|
|
874
|
-
() =>
|
|
875
|
-
[
|
|
876
|
-
),
|
|
877
|
-
() => !
|
|
878
|
-
[
|
|
879
|
+
isMessageAIGenerated: x,
|
|
880
|
+
isMyMessage: w,
|
|
881
|
+
message: r,
|
|
882
|
+
renderText: y,
|
|
883
|
+
threadList: _
|
|
884
|
+
} = t, { client: C } = $e("CustomMessage"), [M, E] = T(!1), p = ft(r.id), { selected: S, voteUp: L, voteDown: d } = fs(r), {
|
|
885
|
+
Attachment: u = xt,
|
|
886
|
+
EditMessageModal: N = bt,
|
|
887
|
+
MessageBlocked: v = Ct,
|
|
888
|
+
MessageBouncePrompt: f = Nt,
|
|
889
|
+
MessageDeleted: k = vt,
|
|
890
|
+
MessageIsThreadReplyInChannelButtonIndicator: H = wt,
|
|
891
|
+
MessageRepliesCountButton: Z = pt,
|
|
892
|
+
ReminderNotification: Y = yt,
|
|
893
|
+
StreamedMessageText: D = _t,
|
|
894
|
+
PinIndicator: W
|
|
895
|
+
} = gt("CustomMessage"), j = Et(r), ne = St(r), ae = _e(
|
|
896
|
+
() => x == null ? void 0 : x(r),
|
|
897
|
+
[x, r]
|
|
898
|
+
), G = _e(
|
|
899
|
+
() => !r.shared_location && !r.attachments ? [] : r.shared_location ? [r.shared_location, ...r.attachments ?? []] : r.attachments,
|
|
900
|
+
[r]
|
|
879
901
|
);
|
|
880
|
-
if (It(
|
|
902
|
+
if (It(r))
|
|
881
903
|
return null;
|
|
882
|
-
if (
|
|
883
|
-
return /* @__PURE__ */ e(
|
|
884
|
-
if (
|
|
885
|
-
return /* @__PURE__ */ e(
|
|
886
|
-
const K = !
|
|
887
|
-
let
|
|
888
|
-
|
|
889
|
-
const
|
|
904
|
+
if (r.deleted_at || r.type === "deleted")
|
|
905
|
+
return /* @__PURE__ */ e(k, { message: r });
|
|
906
|
+
if (Mt(r))
|
|
907
|
+
return /* @__PURE__ */ e(v, {});
|
|
908
|
+
const K = !_ && !!r.reply_count, re = !_ && r.show_in_channel && r.parent_id, U = r.status === "failed" && ((de = r.error) == null ? void 0 : de.status) !== 403, O = kt(r);
|
|
909
|
+
let A;
|
|
910
|
+
U ? A = () => h(r) : O && (A = () => E(!0));
|
|
911
|
+
const z = w(), ce = R(
|
|
890
912
|
"str-chat__message str-chat__message-simple",
|
|
891
|
-
`str-chat__message--${
|
|
892
|
-
`str-chat__message--${
|
|
893
|
-
|
|
894
|
-
|
|
913
|
+
`str-chat__message--${r.type}`,
|
|
914
|
+
`str-chat__message--${r.status}`,
|
|
915
|
+
z ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
916
|
+
r.text ? "str-chat__message--has-text" : "has-no-text",
|
|
895
917
|
{
|
|
896
|
-
"str-chat__message--has-attachment":
|
|
918
|
+
"str-chat__message--has-attachment": j,
|
|
897
919
|
"str-chat__message--highlighted": b,
|
|
898
|
-
"str-chat__message--pinned pinned-message":
|
|
920
|
+
"str-chat__message--pinned pinned-message": r.pinned,
|
|
899
921
|
"str-chat__message--with-reactions": ne,
|
|
900
|
-
"str-chat__message-send-can-be-retried": (
|
|
922
|
+
"str-chat__message-send-can-be-retried": (r == null ? void 0 : r.status) === "failed" && ((ue = r == null ? void 0 : r.error) == null ? void 0 : ue.status) !== 403,
|
|
901
923
|
"str-chat__message-with-thread-link": K || re,
|
|
902
924
|
"str-chat__virtual-message__wrapper--end": l,
|
|
903
925
|
"str-chat__virtual-message__wrapper--first": m,
|
|
904
|
-
"str-chat__virtual-message__wrapper--group":
|
|
926
|
+
"str-chat__virtual-message__wrapper--group": a
|
|
905
927
|
}
|
|
906
|
-
),
|
|
928
|
+
), q = r.poll_id && C.polls.fromState(r.poll_id), oe = cs(r), ee = Te(r), J = !!(G != null && G.length && !r.quoted_message), te = ee && z && J;
|
|
907
929
|
return /* @__PURE__ */ i(me, { children: [
|
|
908
930
|
o && /* @__PURE__ */ e(
|
|
909
931
|
N,
|
|
@@ -912,36 +934,36 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
912
934
|
}
|
|
913
935
|
),
|
|
914
936
|
M && /* @__PURE__ */ e(
|
|
915
|
-
|
|
937
|
+
Tt,
|
|
916
938
|
{
|
|
917
939
|
MessageBouncePrompt: f,
|
|
918
|
-
onClose: () =>
|
|
940
|
+
onClose: () => E(!1),
|
|
919
941
|
open: M
|
|
920
942
|
}
|
|
921
943
|
),
|
|
922
944
|
/* @__PURE__ */ i("div", { className: ce, children: [
|
|
923
|
-
|
|
924
|
-
!!
|
|
925
|
-
|
|
945
|
+
W && /* @__PURE__ */ e(W, {}),
|
|
946
|
+
!!p && /* @__PURE__ */ e(Y, { reminder: p }),
|
|
947
|
+
r.user && /* @__PURE__ */ e(
|
|
926
948
|
se,
|
|
927
949
|
{
|
|
928
950
|
className: "str-chat__avatar str-chat__message-sender-avatar",
|
|
929
|
-
id:
|
|
930
|
-
image:
|
|
931
|
-
name:
|
|
951
|
+
id: r.user.id,
|
|
952
|
+
image: r.user.image,
|
|
953
|
+
name: r.user.name || r.user.id
|
|
932
954
|
}
|
|
933
955
|
),
|
|
934
956
|
/* @__PURE__ */ e(
|
|
935
957
|
"div",
|
|
936
958
|
{
|
|
937
|
-
className:
|
|
938
|
-
"str-chat__simple-message--error-failed":
|
|
959
|
+
className: R("str-chat__message-inner", {
|
|
960
|
+
"str-chat__simple-message--error-failed": U || O
|
|
939
961
|
}),
|
|
940
962
|
"data-testid": "message-inner",
|
|
941
|
-
onClick:
|
|
942
|
-
onKeyDown:
|
|
943
|
-
role:
|
|
944
|
-
tabIndex:
|
|
963
|
+
onClick: A,
|
|
964
|
+
onKeyDown: A,
|
|
965
|
+
role: A ? "button" : void 0,
|
|
966
|
+
tabIndex: A ? 0 : void 0,
|
|
945
967
|
style: {
|
|
946
968
|
// Force margins to 0 to prevent hover layout shift
|
|
947
969
|
// Stream Chat CSS sets margin-inline-end/start to 78px, then 0 on hover
|
|
@@ -950,47 +972,47 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
950
972
|
},
|
|
951
973
|
children: oe ? (
|
|
952
974
|
/* Tip-only messages render as a standalone bubble */
|
|
953
|
-
/* @__PURE__ */ e(ye, { message:
|
|
975
|
+
/* @__PURE__ */ e(ye, { message: r, standalone: !0 })
|
|
954
976
|
) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
955
977
|
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
956
978
|
ee && !te && /* @__PURE__ */ e(
|
|
957
979
|
ye,
|
|
958
980
|
{
|
|
959
|
-
message:
|
|
981
|
+
message: r,
|
|
960
982
|
hasAttachment: J,
|
|
961
|
-
isMyMessage:
|
|
983
|
+
isMyMessage: z
|
|
962
984
|
}
|
|
963
985
|
),
|
|
964
|
-
|
|
965
|
-
|
|
986
|
+
q && /* @__PURE__ */ e(Dt, { poll: q }),
|
|
987
|
+
G != null && G.length && !r.quoted_message ? /* @__PURE__ */ e(
|
|
966
988
|
u,
|
|
967
989
|
{
|
|
968
990
|
actionHandler: c,
|
|
969
|
-
attachments:
|
|
991
|
+
attachments: G
|
|
970
992
|
}
|
|
971
993
|
) : null,
|
|
972
994
|
ae ? /* @__PURE__ */ e(
|
|
973
|
-
|
|
995
|
+
D,
|
|
974
996
|
{
|
|
975
|
-
message:
|
|
976
|
-
renderText:
|
|
997
|
+
message: r,
|
|
998
|
+
renderText: y
|
|
977
999
|
}
|
|
978
|
-
) : /* @__PURE__ */ e(
|
|
979
|
-
/* @__PURE__ */ e(
|
|
1000
|
+
) : /* @__PURE__ */ e(Rt, { message: r, renderText: y }),
|
|
1001
|
+
/* @__PURE__ */ e(Lt, {})
|
|
980
1002
|
] }),
|
|
981
1003
|
(!ee || te) && /* @__PURE__ */ e(
|
|
982
1004
|
ye,
|
|
983
1005
|
{
|
|
984
|
-
message:
|
|
1006
|
+
message: r,
|
|
985
1007
|
hasAttachment: J,
|
|
986
|
-
isMyMessage:
|
|
1008
|
+
isMyMessage: z
|
|
987
1009
|
}
|
|
988
1010
|
),
|
|
989
1011
|
n && ee && /* @__PURE__ */ e(
|
|
990
|
-
|
|
1012
|
+
bs,
|
|
991
1013
|
{
|
|
992
|
-
selected:
|
|
993
|
-
onVoteUp:
|
|
1014
|
+
selected: S,
|
|
1015
|
+
onVoteUp: L,
|
|
994
1016
|
onVoteDown: d
|
|
995
1017
|
}
|
|
996
1018
|
)
|
|
@@ -998,26 +1020,26 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
998
1020
|
}
|
|
999
1021
|
),
|
|
1000
1022
|
K && /* @__PURE__ */ e(
|
|
1001
|
-
|
|
1023
|
+
Z,
|
|
1002
1024
|
{
|
|
1003
|
-
onClick:
|
|
1004
|
-
reply_count:
|
|
1025
|
+
onClick: g,
|
|
1026
|
+
reply_count: r.reply_count
|
|
1005
1027
|
}
|
|
1006
1028
|
),
|
|
1007
|
-
re && /* @__PURE__ */ e(
|
|
1008
|
-
] },
|
|
1029
|
+
re && /* @__PURE__ */ e(H, {})
|
|
1030
|
+
] }, r.id)
|
|
1009
1031
|
] });
|
|
1010
|
-
},
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
),
|
|
1032
|
+
}, Ns = B.memo(
|
|
1033
|
+
Cs,
|
|
1034
|
+
ht
|
|
1035
|
+
), vs = (t) => {
|
|
1014
1036
|
const s = je("CustomMessage");
|
|
1015
|
-
return /* @__PURE__ */ e(
|
|
1016
|
-
},
|
|
1037
|
+
return /* @__PURE__ */ e(Ns, { ...s, ...t });
|
|
1038
|
+
}, ws = (t) => ({
|
|
1017
1039
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
1018
1040
|
(s) => Fe.previewIsLoaded(s) || Fe.previewIsLoading(s)
|
|
1019
1041
|
)
|
|
1020
|
-
}),
|
|
1042
|
+
}), ps = ({
|
|
1021
1043
|
link: t,
|
|
1022
1044
|
onDismiss: s
|
|
1023
1045
|
}) => {
|
|
@@ -1042,8 +1064,8 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
1042
1064
|
"button",
|
|
1043
1065
|
{
|
|
1044
1066
|
type: "button",
|
|
1045
|
-
onClick: (
|
|
1046
|
-
|
|
1067
|
+
onClick: (a) => {
|
|
1068
|
+
a.preventDefault(), s(n);
|
|
1047
1069
|
},
|
|
1048
1070
|
className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl focus-ring",
|
|
1049
1071
|
"aria-label": "Close link preview",
|
|
@@ -1057,32 +1079,32 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
1057
1079
|
]
|
|
1058
1080
|
}
|
|
1059
1081
|
);
|
|
1060
|
-
},
|
|
1061
|
-
const { linkPreviewsManager: t } =
|
|
1082
|
+
}, ys = () => {
|
|
1083
|
+
const { linkPreviewsManager: t } = Pt(), { linkPreviews: s } = Ut(
|
|
1062
1084
|
t.state,
|
|
1063
|
-
|
|
1085
|
+
ws
|
|
1064
1086
|
), n = (l) => {
|
|
1065
1087
|
t.dismissPreview(l);
|
|
1066
1088
|
};
|
|
1067
1089
|
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((l) => /* @__PURE__ */ e(
|
|
1068
|
-
|
|
1090
|
+
ps,
|
|
1069
1091
|
{
|
|
1070
1092
|
link: l,
|
|
1071
1093
|
onDismiss: n
|
|
1072
1094
|
},
|
|
1073
1095
|
l.og_scrape_url
|
|
1074
1096
|
)) }) : null;
|
|
1075
|
-
},
|
|
1076
|
-
const { handleSubmit: t } =
|
|
1097
|
+
}, _s = () => {
|
|
1098
|
+
const { handleSubmit: t } = Ft(), s = At();
|
|
1077
1099
|
return /* @__PURE__ */ i(me, { children: [
|
|
1078
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
1100
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Bt, {}) }),
|
|
1079
1101
|
/* @__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: [
|
|
1080
|
-
/* @__PURE__ */ e(Bt, {}),
|
|
1081
|
-
/* @__PURE__ */ e(ps, {}),
|
|
1082
1102
|
/* @__PURE__ */ e($t, {}),
|
|
1103
|
+
/* @__PURE__ */ e(ys, {}),
|
|
1104
|
+
/* @__PURE__ */ e(jt, {}),
|
|
1083
1105
|
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
1084
1106
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
1085
|
-
|
|
1107
|
+
Gt,
|
|
1086
1108
|
{
|
|
1087
1109
|
className: "w-full resize-none outline-none leading-6",
|
|
1088
1110
|
autoFocus: !0,
|
|
@@ -1098,24 +1120,24 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
1098
1120
|
disabled: !s,
|
|
1099
1121
|
onClick: t,
|
|
1100
1122
|
type: "button",
|
|
1101
|
-
children: /* @__PURE__ */ e(
|
|
1123
|
+
children: /* @__PURE__ */ e(Jt, { className: "size-4" })
|
|
1102
1124
|
}
|
|
1103
1125
|
)
|
|
1104
1126
|
] })
|
|
1105
1127
|
] })
|
|
1106
1128
|
] });
|
|
1107
|
-
},
|
|
1129
|
+
}, Es = ({
|
|
1108
1130
|
renderActions: t
|
|
1109
1131
|
}) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
1110
1132
|
t && (t == null ? void 0 : t()),
|
|
1111
|
-
/* @__PURE__ */ e(
|
|
1112
|
-
] }),
|
|
1133
|
+
/* @__PURE__ */ e(Ot, { Input: _s })
|
|
1134
|
+
] }), Ss = [
|
|
1113
1135
|
"SYSTEM_DM_AGENT_PAUSED",
|
|
1114
1136
|
"SYSTEM_DM_AGENT_RESUMED"
|
|
1115
1137
|
], Is = {
|
|
1116
1138
|
SYSTEM_DM_AGENT_PAUSED: "DM Agent has left the conversation",
|
|
1117
1139
|
SYSTEM_DM_AGENT_RESUMED: "DM Agent has rejoined the conversation"
|
|
1118
|
-
}, Be = (t) =>
|
|
1140
|
+
}, Be = (t) => Ss.includes(t), Ms = (t) => {
|
|
1119
1141
|
var o;
|
|
1120
1142
|
const s = (o = t.metadata) == null ? void 0 : o.custom_type;
|
|
1121
1143
|
if (Be(s))
|
|
@@ -1123,9 +1145,9 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
1123
1145
|
const n = t.dm_agent_system_type;
|
|
1124
1146
|
if (Be(n))
|
|
1125
1147
|
return n;
|
|
1126
|
-
},
|
|
1148
|
+
}, ks = (t) => {
|
|
1127
1149
|
var o;
|
|
1128
|
-
const s = t.message.hide_date === !0, n =
|
|
1150
|
+
const s = t.message.hide_date === !0, n = Ms(t.message);
|
|
1129
1151
|
if (n) {
|
|
1130
1152
|
const l = ((o = t.message.text) == null ? void 0 : o.trim()) || Is[n];
|
|
1131
1153
|
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
@@ -1137,7 +1159,7 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
1137
1159
|
"data-dm-agent-system-type": n,
|
|
1138
1160
|
children: [
|
|
1139
1161
|
/* @__PURE__ */ e(
|
|
1140
|
-
|
|
1162
|
+
Qt,
|
|
1141
1163
|
{
|
|
1142
1164
|
size: 16,
|
|
1143
1165
|
weight: "regular",
|
|
@@ -1160,10 +1182,10 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
1160
1182
|
] }),
|
|
1161
1183
|
!s && /* @__PURE__ */ e(Re, { message: t.message })
|
|
1162
1184
|
] });
|
|
1163
|
-
},
|
|
1185
|
+
}, Ts = () => null, Ds = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
1164
1186
|
"div",
|
|
1165
1187
|
{
|
|
1166
|
-
className:
|
|
1188
|
+
className: R("flex items-center justify-center h-full", t),
|
|
1167
1189
|
children: [
|
|
1168
1190
|
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1169
1191
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
@@ -1203,45 +1225,31 @@ const fs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
1203
1225
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1204
1226
|
]
|
|
1205
1227
|
}
|
|
1206
|
-
), Ne =
|
|
1207
|
-
/* @__PURE__ */ e(
|
|
1228
|
+
), Ne = B.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
1229
|
+
/* @__PURE__ */ e(Ds, { className: "w-6 h-6" }),
|
|
1208
1230
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1209
1231
|
] }) }));
|
|
1210
1232
|
Ne.displayName = "LoadingState";
|
|
1211
|
-
const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150 focus-ring",
|
|
1233
|
+
const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150 focus-ring", Rs = ({
|
|
1212
1234
|
onBack: t,
|
|
1213
1235
|
showBackButton: s,
|
|
1214
1236
|
onShowInfo: n,
|
|
1215
1237
|
canShowInfo: o,
|
|
1216
1238
|
showStarButton: l = !1
|
|
1217
1239
|
}) => {
|
|
1218
|
-
var
|
|
1219
|
-
const { channel: m } = Me(),
|
|
1220
|
-
(
|
|
1221
|
-
var
|
|
1222
|
-
return ((
|
|
1240
|
+
var x, w, r, y, _;
|
|
1241
|
+
const { channel: m } = Me(), a = B.useMemo(() => Object.values(m.state.members || {}).find(
|
|
1242
|
+
(M) => {
|
|
1243
|
+
var E;
|
|
1244
|
+
return ((E = M.user) == null ? void 0 : E.id) && M.user.id !== m._client.userID;
|
|
1223
1245
|
}
|
|
1224
|
-
), [m._client.userID, m.state.members]), c = ((
|
|
1225
|
-
!!((I = m.state.membership) != null && I.pinned_at)
|
|
1226
|
-
);
|
|
1227
|
-
X(() => {
|
|
1228
|
-
const p = (v) => {
|
|
1229
|
-
var w;
|
|
1230
|
-
b(
|
|
1231
|
-
v != null && v.member ? !!v.member.pinned_at : !!((w = m.state.membership) != null && w.pinned_at)
|
|
1232
|
-
);
|
|
1233
|
-
};
|
|
1234
|
-
return m.on("member.updated", p), () => {
|
|
1235
|
-
m.off("member.updated", p);
|
|
1236
|
-
};
|
|
1237
|
-
}, [m]);
|
|
1238
|
-
const g = async () => {
|
|
1246
|
+
), [m._client.userID, m.state.members]), c = ((x = a == null ? void 0 : a.user) == null ? void 0 : x.name) || ((w = a == null ? void 0 : a.user) == null ? void 0 : w.id) || "Unknown member", g = (r = a == null ? void 0 : a.user) == null ? void 0 : r.image, h = Ve(m), b = async () => {
|
|
1239
1247
|
try {
|
|
1240
1248
|
h ? await m.unpin() : await m.pin();
|
|
1241
|
-
} catch (
|
|
1249
|
+
} catch (C) {
|
|
1242
1250
|
console.error(
|
|
1243
1251
|
"[CustomChannelHeader] Failed to update pinned status:",
|
|
1244
|
-
|
|
1252
|
+
C
|
|
1245
1253
|
);
|
|
1246
1254
|
}
|
|
1247
1255
|
};
|
|
@@ -1262,9 +1270,10 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1262
1270
|
/* @__PURE__ */ e(
|
|
1263
1271
|
se,
|
|
1264
1272
|
{
|
|
1265
|
-
id: ((
|
|
1273
|
+
id: ((y = a == null ? void 0 : a.user) == null ? void 0 : y.id) || m.id || "unknown",
|
|
1266
1274
|
name: c,
|
|
1267
|
-
image:
|
|
1275
|
+
image: g,
|
|
1276
|
+
starred: h,
|
|
1268
1277
|
size: 40
|
|
1269
1278
|
}
|
|
1270
1279
|
),
|
|
@@ -1275,13 +1284,13 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1275
1284
|
"button",
|
|
1276
1285
|
{
|
|
1277
1286
|
className: ie,
|
|
1278
|
-
onClick:
|
|
1287
|
+
onClick: b,
|
|
1279
1288
|
type: "button",
|
|
1280
1289
|
"aria-label": h ? "Unstar conversation" : "Star conversation",
|
|
1281
1290
|
children: /* @__PURE__ */ e(
|
|
1282
1291
|
Ee,
|
|
1283
1292
|
{
|
|
1284
|
-
className:
|
|
1293
|
+
className: R("size-5", {
|
|
1285
1294
|
"text-yellow-600": h,
|
|
1286
1295
|
"text-black/90": !h
|
|
1287
1296
|
}),
|
|
@@ -1317,9 +1326,10 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1317
1326
|
/* @__PURE__ */ e(
|
|
1318
1327
|
se,
|
|
1319
1328
|
{
|
|
1320
|
-
id: ((
|
|
1329
|
+
id: ((_ = a == null ? void 0 : a.user) == null ? void 0 : _.id) || m.id || "unknown",
|
|
1321
1330
|
name: c,
|
|
1322
|
-
image:
|
|
1331
|
+
image: g,
|
|
1332
|
+
starred: h,
|
|
1323
1333
|
size: 40
|
|
1324
1334
|
}
|
|
1325
1335
|
),
|
|
@@ -1330,13 +1340,13 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1330
1340
|
"button",
|
|
1331
1341
|
{
|
|
1332
1342
|
className: ie,
|
|
1333
|
-
onClick:
|
|
1343
|
+
onClick: b,
|
|
1334
1344
|
type: "button",
|
|
1335
1345
|
"aria-label": h ? "Unstar conversation" : "Star conversation",
|
|
1336
1346
|
children: /* @__PURE__ */ e(
|
|
1337
1347
|
Ee,
|
|
1338
1348
|
{
|
|
1339
|
-
className:
|
|
1349
|
+
className: R("size-5", {
|
|
1340
1350
|
"text-yellow-600": h,
|
|
1341
1351
|
"text-black/90": !h
|
|
1342
1352
|
}),
|
|
@@ -1358,72 +1368,72 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1358
1368
|
] })
|
|
1359
1369
|
] })
|
|
1360
1370
|
] });
|
|
1361
|
-
},
|
|
1371
|
+
}, Ls = ({
|
|
1362
1372
|
onBack: t,
|
|
1363
1373
|
showBackButton: s,
|
|
1364
1374
|
renderMessageInputActions: n,
|
|
1365
1375
|
renderConversationFooter: o,
|
|
1366
1376
|
onLeaveConversation: l,
|
|
1367
1377
|
onBlockParticipant: m,
|
|
1368
|
-
showDeleteConversation:
|
|
1378
|
+
showDeleteConversation: a = !0,
|
|
1369
1379
|
onDeleteConversationClick: c,
|
|
1370
|
-
onBlockParticipantClick:
|
|
1380
|
+
onBlockParticipantClick: g,
|
|
1371
1381
|
onReportParticipantClick: h,
|
|
1372
1382
|
showStarButton: b = !1,
|
|
1373
|
-
chatbotVotingEnabled:
|
|
1374
|
-
renderChannelBanner:
|
|
1375
|
-
customProfileContent:
|
|
1376
|
-
customChannelActions:
|
|
1377
|
-
renderMessage:
|
|
1383
|
+
chatbotVotingEnabled: x = !1,
|
|
1384
|
+
renderChannelBanner: w,
|
|
1385
|
+
customProfileContent: r,
|
|
1386
|
+
customChannelActions: y,
|
|
1387
|
+
renderMessage: _
|
|
1378
1388
|
}) => {
|
|
1379
|
-
const { channel: C } = Me(), M = Q(null),
|
|
1389
|
+
const { channel: C } = Me(), M = Q(null), E = B.useMemo(() => Object.values(C.state.members || {}).find(
|
|
1380
1390
|
(u) => {
|
|
1381
1391
|
var N;
|
|
1382
1392
|
return ((N = u.user) == null ? void 0 : N.id) && u.user.id !== C._client.userID;
|
|
1383
1393
|
}
|
|
1384
|
-
), [C._client.userID, C.state.members]),
|
|
1394
|
+
), [C._client.userID, C.state.members]), p = B.useMemo(() => {
|
|
1385
1395
|
const d = C.data ?? {};
|
|
1386
1396
|
if (d.followerStatus)
|
|
1387
1397
|
return String(d.followerStatus);
|
|
1388
1398
|
if (d.isFollower !== void 0)
|
|
1389
1399
|
return d.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1390
|
-
}, [C.data]),
|
|
1400
|
+
}, [C.data]), S = P(() => {
|
|
1391
1401
|
var d;
|
|
1392
1402
|
(d = M.current) == null || d.showModal();
|
|
1393
|
-
}, []),
|
|
1403
|
+
}, []), L = P(() => {
|
|
1394
1404
|
var d;
|
|
1395
1405
|
(d = M.current) == null || d.close();
|
|
1396
1406
|
}, []);
|
|
1397
1407
|
return /* @__PURE__ */ i(me, { children: [
|
|
1398
1408
|
/* @__PURE__ */ e(
|
|
1399
|
-
|
|
1409
|
+
Vt,
|
|
1400
1410
|
{
|
|
1401
1411
|
overrides: {
|
|
1402
1412
|
Message: (d) => {
|
|
1403
1413
|
const { message: u } = je("ChannelView"), N = /* @__PURE__ */ e(
|
|
1404
|
-
|
|
1414
|
+
vs,
|
|
1405
1415
|
{
|
|
1406
1416
|
...d,
|
|
1407
|
-
chatbotVotingEnabled:
|
|
1417
|
+
chatbotVotingEnabled: x
|
|
1408
1418
|
}
|
|
1409
1419
|
);
|
|
1410
|
-
return !
|
|
1420
|
+
return !_ || !u ? N : _(N, u);
|
|
1411
1421
|
}
|
|
1412
1422
|
},
|
|
1413
|
-
children: /* @__PURE__ */ i(
|
|
1423
|
+
children: /* @__PURE__ */ i(Ht, { children: [
|
|
1414
1424
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
1415
|
-
|
|
1425
|
+
Rs,
|
|
1416
1426
|
{
|
|
1417
1427
|
onBack: t,
|
|
1418
1428
|
showBackButton: s,
|
|
1419
|
-
onShowInfo:
|
|
1420
|
-
canShowInfo: !!
|
|
1429
|
+
onShowInfo: S,
|
|
1430
|
+
canShowInfo: !!E,
|
|
1421
1431
|
showStarButton: b
|
|
1422
1432
|
}
|
|
1423
1433
|
) }),
|
|
1424
|
-
|
|
1434
|
+
w == null ? void 0 : w(),
|
|
1425
1435
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1426
|
-
|
|
1436
|
+
Wt,
|
|
1427
1437
|
{
|
|
1428
1438
|
hideDeletedMessages: !0,
|
|
1429
1439
|
hideNewMessageSeparator: !1,
|
|
@@ -1432,7 +1442,7 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1432
1442
|
) }),
|
|
1433
1443
|
o == null ? void 0 : o(C),
|
|
1434
1444
|
/* @__PURE__ */ e(
|
|
1435
|
-
|
|
1445
|
+
Es,
|
|
1436
1446
|
{
|
|
1437
1447
|
renderActions: () => n == null ? void 0 : n(C)
|
|
1438
1448
|
}
|
|
@@ -1441,25 +1451,25 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1441
1451
|
}
|
|
1442
1452
|
),
|
|
1443
1453
|
/* @__PURE__ */ e(
|
|
1444
|
-
|
|
1454
|
+
us,
|
|
1445
1455
|
{
|
|
1446
1456
|
dialogRef: M,
|
|
1447
|
-
onClose:
|
|
1448
|
-
participant:
|
|
1457
|
+
onClose: L,
|
|
1458
|
+
participant: E,
|
|
1449
1459
|
channel: C,
|
|
1450
|
-
followerStatusLabel:
|
|
1460
|
+
followerStatusLabel: p,
|
|
1451
1461
|
onLeaveConversation: l,
|
|
1452
1462
|
onBlockParticipant: m,
|
|
1453
|
-
showDeleteConversation:
|
|
1463
|
+
showDeleteConversation: a,
|
|
1454
1464
|
onDeleteConversationClick: c,
|
|
1455
|
-
onBlockParticipantClick:
|
|
1465
|
+
onBlockParticipantClick: g,
|
|
1456
1466
|
onReportParticipantClick: h,
|
|
1457
|
-
customProfileContent:
|
|
1458
|
-
customChannelActions:
|
|
1467
|
+
customProfileContent: r,
|
|
1468
|
+
customChannelActions: y
|
|
1459
1469
|
}
|
|
1460
1470
|
)
|
|
1461
1471
|
] });
|
|
1462
|
-
},
|
|
1472
|
+
}, Je = B.memo(
|
|
1463
1473
|
({
|
|
1464
1474
|
channel: t,
|
|
1465
1475
|
onBack: s,
|
|
@@ -1467,79 +1477,79 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1467
1477
|
renderMessageInputActions: o,
|
|
1468
1478
|
renderConversationFooter: l,
|
|
1469
1479
|
onLeaveConversation: m,
|
|
1470
|
-
onBlockParticipant:
|
|
1480
|
+
onBlockParticipant: a,
|
|
1471
1481
|
className: c,
|
|
1472
|
-
CustomChannelEmptyState:
|
|
1482
|
+
CustomChannelEmptyState: g = Ts,
|
|
1473
1483
|
showDeleteConversation: h = !0,
|
|
1474
1484
|
onDeleteConversationClick: b,
|
|
1475
|
-
onBlockParticipantClick:
|
|
1476
|
-
onReportParticipantClick:
|
|
1477
|
-
dmAgentEnabled:
|
|
1478
|
-
messageMetadata:
|
|
1479
|
-
onMessageSent:
|
|
1485
|
+
onBlockParticipantClick: x,
|
|
1486
|
+
onReportParticipantClick: w,
|
|
1487
|
+
dmAgentEnabled: r,
|
|
1488
|
+
messageMetadata: y,
|
|
1489
|
+
onMessageSent: _,
|
|
1480
1490
|
showStarButton: C = !1,
|
|
1481
1491
|
chatbotVotingEnabled: M = !1,
|
|
1482
|
-
renderChannelBanner:
|
|
1483
|
-
customProfileContent:
|
|
1484
|
-
customChannelActions:
|
|
1485
|
-
renderMessage:
|
|
1492
|
+
renderChannelBanner: E,
|
|
1493
|
+
customProfileContent: p,
|
|
1494
|
+
customChannelActions: S,
|
|
1495
|
+
renderMessage: L
|
|
1486
1496
|
}) => {
|
|
1487
1497
|
const d = P(
|
|
1488
|
-
async (u, N,
|
|
1489
|
-
var
|
|
1490
|
-
const f = ((
|
|
1498
|
+
async (u, N, v) => {
|
|
1499
|
+
var D;
|
|
1500
|
+
const f = ((D = t.data) == null ? void 0 : D.chatbot_paused) === !0, k = r && !f, H = {
|
|
1491
1501
|
...N,
|
|
1492
|
-
...
|
|
1493
|
-
...
|
|
1502
|
+
...k && { silent: !0 },
|
|
1503
|
+
...y && {
|
|
1494
1504
|
metadata: {
|
|
1495
1505
|
...N.metadata ?? {},
|
|
1496
|
-
...
|
|
1506
|
+
...y
|
|
1497
1507
|
}
|
|
1498
1508
|
}
|
|
1499
|
-
},
|
|
1500
|
-
...
|
|
1501
|
-
...
|
|
1502
|
-
},
|
|
1503
|
-
return
|
|
1509
|
+
}, Z = {
|
|
1510
|
+
...v,
|
|
1511
|
+
...k && { skip_push: !0 }
|
|
1512
|
+
}, Y = await t.sendMessage(H, Z);
|
|
1513
|
+
return _ == null || _(Y), Y;
|
|
1504
1514
|
},
|
|
1505
|
-
[t,
|
|
1515
|
+
[t, r, y, _]
|
|
1506
1516
|
);
|
|
1507
1517
|
return /* @__PURE__ */ e(
|
|
1508
1518
|
"div",
|
|
1509
1519
|
{
|
|
1510
|
-
className:
|
|
1520
|
+
className: R(
|
|
1511
1521
|
"messaging-channel-view h-full flex flex-col",
|
|
1512
1522
|
c
|
|
1513
1523
|
),
|
|
1514
1524
|
children: /* @__PURE__ */ e(
|
|
1515
|
-
|
|
1525
|
+
zt,
|
|
1516
1526
|
{
|
|
1517
1527
|
channel: t,
|
|
1518
|
-
MessageSystem:
|
|
1519
|
-
EmptyStateIndicator:
|
|
1528
|
+
MessageSystem: ks,
|
|
1529
|
+
EmptyStateIndicator: g,
|
|
1520
1530
|
LoadingIndicator: Ne,
|
|
1521
|
-
DateSeparator:
|
|
1531
|
+
DateSeparator: ms,
|
|
1522
1532
|
doSendMessageRequest: d,
|
|
1523
1533
|
children: /* @__PURE__ */ e(
|
|
1524
|
-
|
|
1534
|
+
Ls,
|
|
1525
1535
|
{
|
|
1526
1536
|
onBack: s,
|
|
1527
1537
|
showBackButton: n,
|
|
1528
1538
|
renderMessageInputActions: o,
|
|
1529
1539
|
renderConversationFooter: l,
|
|
1530
1540
|
onLeaveConversation: m,
|
|
1531
|
-
onBlockParticipant:
|
|
1532
|
-
CustomChannelEmptyState:
|
|
1541
|
+
onBlockParticipant: a,
|
|
1542
|
+
CustomChannelEmptyState: g,
|
|
1533
1543
|
showDeleteConversation: h,
|
|
1534
1544
|
onDeleteConversationClick: b,
|
|
1535
|
-
onBlockParticipantClick:
|
|
1536
|
-
onReportParticipantClick:
|
|
1545
|
+
onBlockParticipantClick: x,
|
|
1546
|
+
onReportParticipantClick: w,
|
|
1537
1547
|
showStarButton: C,
|
|
1538
1548
|
chatbotVotingEnabled: M,
|
|
1539
|
-
renderChannelBanner:
|
|
1540
|
-
customProfileContent:
|
|
1541
|
-
customChannelActions:
|
|
1542
|
-
renderMessage:
|
|
1549
|
+
renderChannelBanner: E,
|
|
1550
|
+
customProfileContent: p,
|
|
1551
|
+
customChannelActions: S,
|
|
1552
|
+
renderMessage: L
|
|
1543
1553
|
}
|
|
1544
1554
|
)
|
|
1545
1555
|
}
|
|
@@ -1548,8 +1558,8 @@ const ie = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1548
1558
|
);
|
|
1549
1559
|
}
|
|
1550
1560
|
);
|
|
1551
|
-
|
|
1552
|
-
function
|
|
1561
|
+
Je.displayName = "ChannelView";
|
|
1562
|
+
function Ps({
|
|
1553
1563
|
searchQuery: t,
|
|
1554
1564
|
setSearchQuery: s,
|
|
1555
1565
|
placeholder: n
|
|
@@ -1557,7 +1567,7 @@ function Ls({
|
|
|
1557
1567
|
const o = Q(null);
|
|
1558
1568
|
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1559
1569
|
/* @__PURE__ */ e(
|
|
1560
|
-
|
|
1570
|
+
Xt,
|
|
1561
1571
|
{
|
|
1562
1572
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1563
1573
|
weight: "bold"
|
|
@@ -1575,7 +1585,7 @@ function Ls({
|
|
|
1575
1585
|
}
|
|
1576
1586
|
),
|
|
1577
1587
|
t && /* @__PURE__ */ e(
|
|
1578
|
-
|
|
1588
|
+
Ye,
|
|
1579
1589
|
{
|
|
1580
1590
|
label: "Clear search",
|
|
1581
1591
|
onClick: () => {
|
|
@@ -1588,18 +1598,18 @@ function Ls({
|
|
|
1588
1598
|
)
|
|
1589
1599
|
] });
|
|
1590
1600
|
}
|
|
1591
|
-
const
|
|
1601
|
+
const Us = ({
|
|
1592
1602
|
participantSource: t,
|
|
1593
1603
|
onSelectParticipant: s,
|
|
1594
1604
|
onClose: n,
|
|
1595
1605
|
existingParticipantIds: o = /* @__PURE__ */ new Set(),
|
|
1596
1606
|
participantLabel: l = "participants",
|
|
1597
1607
|
searchPlaceholder: m = "Search participants...",
|
|
1598
|
-
className:
|
|
1608
|
+
className: a
|
|
1599
1609
|
}) => {
|
|
1600
|
-
const { debug: c } = ve(), [
|
|
1610
|
+
const { debug: c } = ve(), [g, h] = T(""), [b, x] = T([]), [w, r] = T(!1), [y, _] = T(null), [C, M] = T(
|
|
1601
1611
|
null
|
|
1602
|
-
),
|
|
1612
|
+
), E = Q(!1);
|
|
1603
1613
|
X(() => {
|
|
1604
1614
|
if (t.loading) {
|
|
1605
1615
|
c && console.log(
|
|
@@ -1607,33 +1617,33 @@ const Ps = ({
|
|
|
1607
1617
|
);
|
|
1608
1618
|
return;
|
|
1609
1619
|
}
|
|
1610
|
-
if (
|
|
1620
|
+
if (E.current) return;
|
|
1611
1621
|
(async () => {
|
|
1612
|
-
c && console.log("[ParticipantPicker] Loading initial participants..."),
|
|
1622
|
+
c && console.log("[ParticipantPicker] Loading initial participants..."), r(!0), _(null);
|
|
1613
1623
|
try {
|
|
1614
1624
|
const u = await t.loadParticipants({
|
|
1615
1625
|
search: "",
|
|
1616
1626
|
// Load all participants initially
|
|
1617
1627
|
limit: 100
|
|
1618
1628
|
});
|
|
1619
|
-
|
|
1629
|
+
x(u.participants), E.current = !0, c && console.log(
|
|
1620
1630
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1621
1631
|
u.participants.length
|
|
1622
1632
|
);
|
|
1623
1633
|
} catch (u) {
|
|
1624
1634
|
const N = u instanceof Error ? u.message : "Failed to load participants";
|
|
1625
|
-
|
|
1635
|
+
_(N), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
1626
1636
|
} finally {
|
|
1627
|
-
|
|
1637
|
+
r(!1);
|
|
1628
1638
|
}
|
|
1629
1639
|
})();
|
|
1630
1640
|
}, [t.loading, c]);
|
|
1631
|
-
const
|
|
1641
|
+
const p = b.filter((d) => !o.has(d.id)).filter((d) => {
|
|
1632
1642
|
var N;
|
|
1633
|
-
if (!
|
|
1634
|
-
const u =
|
|
1643
|
+
if (!g) return !0;
|
|
1644
|
+
const u = g.toLowerCase();
|
|
1635
1645
|
return d.name.toLowerCase().includes(u) || ((N = d.email) == null ? void 0 : N.toLowerCase().includes(u)) || !1;
|
|
1636
|
-
}),
|
|
1646
|
+
}), S = P(
|
|
1637
1647
|
async (d) => {
|
|
1638
1648
|
if (!C) {
|
|
1639
1649
|
M(d.id);
|
|
@@ -1645,58 +1655,58 @@ const Ps = ({
|
|
|
1645
1655
|
}
|
|
1646
1656
|
},
|
|
1647
1657
|
[s, C]
|
|
1648
|
-
),
|
|
1649
|
-
(d.key === "Enter" || d.key === " ") && (d.preventDefault(),
|
|
1658
|
+
), L = (d, u) => {
|
|
1659
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), S(u));
|
|
1650
1660
|
};
|
|
1651
|
-
return /* @__PURE__ */ i("div", { className:
|
|
1661
|
+
return /* @__PURE__ */ i("div", { className: R("flex flex-col h-full", a), children: [
|
|
1652
1662
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1653
1663
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1654
1664
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1655
|
-
/* @__PURE__ */ e(
|
|
1665
|
+
/* @__PURE__ */ e(Ze, { onClick: n })
|
|
1656
1666
|
] }),
|
|
1657
1667
|
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1658
1668
|
"Select a ",
|
|
1659
1669
|
l.slice(0, -1),
|
|
1660
1670
|
" to start messaging (",
|
|
1661
|
-
|
|
1671
|
+
p.length,
|
|
1662
1672
|
" available)",
|
|
1663
1673
|
t.totalCount !== void 0 && ` โข ${t.totalCount} ${l} total`
|
|
1664
1674
|
] }),
|
|
1665
1675
|
/* @__PURE__ */ e(
|
|
1666
|
-
|
|
1676
|
+
Ps,
|
|
1667
1677
|
{
|
|
1668
|
-
searchQuery:
|
|
1678
|
+
searchQuery: g,
|
|
1669
1679
|
setSearchQuery: h,
|
|
1670
1680
|
placeholder: m
|
|
1671
1681
|
}
|
|
1672
1682
|
)
|
|
1673
1683
|
] }),
|
|
1674
|
-
|
|
1684
|
+
y && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1675
1685
|
"Error loading ",
|
|
1676
1686
|
l,
|
|
1677
1687
|
": ",
|
|
1678
|
-
|
|
1688
|
+
y
|
|
1679
1689
|
] }),
|
|
1680
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
1690
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: w && p.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1681
1691
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1682
1692
|
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1683
1693
|
"Loading ",
|
|
1684
1694
|
l,
|
|
1685
1695
|
"..."
|
|
1686
1696
|
] })
|
|
1687
|
-
] }) }) :
|
|
1697
|
+
] }) }) : p.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1688
1698
|
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Oe, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1689
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children:
|
|
1690
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children:
|
|
1699
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: g ? `No ${l} found` : b.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
|
|
1700
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: g ? "Try a different search term" : b.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
|
|
1691
1701
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1692
|
-
|
|
1702
|
+
p.map((d) => {
|
|
1693
1703
|
const u = d.name || d.email || d.id, N = d.email && d.name ? d.email : d.phone;
|
|
1694
1704
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1695
1705
|
"button",
|
|
1696
1706
|
{
|
|
1697
1707
|
type: "button",
|
|
1698
|
-
onClick: () =>
|
|
1699
|
-
onKeyDown: (
|
|
1708
|
+
onClick: () => S(d),
|
|
1709
|
+
onKeyDown: (v) => L(v, d),
|
|
1700
1710
|
className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus-ring",
|
|
1701
1711
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1702
1712
|
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
@@ -1719,13 +1729,13 @@ const Ps = ({
|
|
|
1719
1729
|
}
|
|
1720
1730
|
) }, d.id);
|
|
1721
1731
|
}),
|
|
1722
|
-
|
|
1732
|
+
w && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1723
1733
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1724
1734
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1725
1735
|
] }) })
|
|
1726
1736
|
] }) })
|
|
1727
1737
|
] });
|
|
1728
|
-
},
|
|
1738
|
+
}, Os = ({ className: t }) => /* @__PURE__ */ i(
|
|
1729
1739
|
"svg",
|
|
1730
1740
|
{
|
|
1731
1741
|
width: "140",
|
|
@@ -1859,17 +1869,17 @@ const Ps = ({
|
|
|
1859
1869
|
] })
|
|
1860
1870
|
]
|
|
1861
1871
|
}
|
|
1862
|
-
),
|
|
1872
|
+
), Qe = B.memo(
|
|
1863
1873
|
({ 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: [
|
|
1864
|
-
/* @__PURE__ */ e(
|
|
1874
|
+
/* @__PURE__ */ e(Os, {}),
|
|
1865
1875
|
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1866
1876
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1867
1877
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1868
1878
|
] })
|
|
1869
1879
|
] }) })
|
|
1870
1880
|
);
|
|
1871
|
-
|
|
1872
|
-
const Ce =
|
|
1881
|
+
Qe.displayName = "EmptyState";
|
|
1882
|
+
const Ce = B.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: [
|
|
1873
1883
|
/* @__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: "โ ๏ธ" }) }),
|
|
1874
1884
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1875
1885
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1884,221 +1894,221 @@ const Ce = $.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1884
1894
|
)
|
|
1885
1895
|
] }) }));
|
|
1886
1896
|
Ce.displayName = "ErrorState";
|
|
1887
|
-
const
|
|
1897
|
+
const Ws = ({
|
|
1888
1898
|
capabilities: t = {},
|
|
1889
1899
|
className: s,
|
|
1890
1900
|
renderMessageInputActions: n,
|
|
1891
1901
|
renderConversationFooter: o,
|
|
1892
1902
|
onChannelSelect: l,
|
|
1893
1903
|
onParticipantSelect: m,
|
|
1894
|
-
initialParticipantFilter:
|
|
1904
|
+
initialParticipantFilter: a,
|
|
1895
1905
|
initialParticipantData: c,
|
|
1896
|
-
CustomChannelEmptyState:
|
|
1906
|
+
CustomChannelEmptyState: g,
|
|
1897
1907
|
showChannelList: h = !0,
|
|
1898
1908
|
filters: b,
|
|
1899
|
-
channelListCustomEmptyStateIndicator:
|
|
1900
|
-
onDeleteConversationClick:
|
|
1901
|
-
onBlockParticipantClick:
|
|
1902
|
-
onReportParticipantClick:
|
|
1903
|
-
dmAgentEnabled:
|
|
1909
|
+
channelListCustomEmptyStateIndicator: x,
|
|
1910
|
+
onDeleteConversationClick: w,
|
|
1911
|
+
onBlockParticipantClick: r,
|
|
1912
|
+
onReportParticipantClick: y,
|
|
1913
|
+
dmAgentEnabled: _,
|
|
1904
1914
|
messageMetadata: C,
|
|
1905
1915
|
onMessageSent: M,
|
|
1906
|
-
showStarButton:
|
|
1907
|
-
chatbotVotingEnabled:
|
|
1908
|
-
renderMessagePreview:
|
|
1909
|
-
renderChannelBanner:
|
|
1916
|
+
showStarButton: E = !1,
|
|
1917
|
+
chatbotVotingEnabled: p = !1,
|
|
1918
|
+
renderMessagePreview: S,
|
|
1919
|
+
renderChannelBanner: L,
|
|
1910
1920
|
customProfileContent: d,
|
|
1911
1921
|
customChannelActions: u,
|
|
1912
1922
|
renderMessage: N
|
|
1913
1923
|
}) => {
|
|
1914
1924
|
const {
|
|
1915
|
-
service:
|
|
1925
|
+
service: v,
|
|
1916
1926
|
client: f,
|
|
1917
|
-
isConnected:
|
|
1918
|
-
isLoading:
|
|
1919
|
-
error:
|
|
1920
|
-
refreshConnection:
|
|
1921
|
-
debug:
|
|
1922
|
-
} =
|
|
1927
|
+
isConnected: k,
|
|
1928
|
+
isLoading: H,
|
|
1929
|
+
error: Z,
|
|
1930
|
+
refreshConnection: Y,
|
|
1931
|
+
debug: D
|
|
1932
|
+
} = Kt(), [W, j] = T(null), [ne, ae] = T(!1), [G, K] = T(!1), [re, U] = T(!1), [O, A] = T(/* @__PURE__ */ new Set()), [z, ce] = T(0), [q, oe] = T(!1), [ee, J] = T(null), te = Q(null), {
|
|
1923
1933
|
participantSource: de,
|
|
1924
1934
|
participantLabel: ue = "participants",
|
|
1925
|
-
showDeleteConversation:
|
|
1926
|
-
} = t,
|
|
1927
|
-
const
|
|
1935
|
+
showDeleteConversation: Xe = !0
|
|
1936
|
+
} = t, Ke = B.useMemo(() => {
|
|
1937
|
+
const I = f == null ? void 0 : f.userID;
|
|
1928
1938
|
return {
|
|
1929
1939
|
...{
|
|
1930
1940
|
type: "messaging",
|
|
1931
1941
|
last_message_at: { $exists: !0 },
|
|
1932
|
-
...
|
|
1933
|
-
members: { $in: [
|
|
1942
|
+
...I && {
|
|
1943
|
+
members: { $in: [I] },
|
|
1934
1944
|
hidden: !1
|
|
1935
1945
|
}
|
|
1936
1946
|
},
|
|
1937
1947
|
...b
|
|
1938
1948
|
};
|
|
1939
1949
|
}, [b, f == null ? void 0 : f.userID]), he = Q(null), le = P(async () => {
|
|
1940
|
-
if (!f || !
|
|
1941
|
-
const
|
|
1942
|
-
if (
|
|
1950
|
+
if (!f || !k) return;
|
|
1951
|
+
const I = f.userID;
|
|
1952
|
+
if (I)
|
|
1943
1953
|
try {
|
|
1944
|
-
|
|
1945
|
-
const
|
|
1954
|
+
D && console.log("[MessagingShell] Syncing channels for user:", I);
|
|
1955
|
+
const V = await f.queryChannels(
|
|
1946
1956
|
{
|
|
1947
1957
|
type: "messaging",
|
|
1948
|
-
members: { $in: [
|
|
1958
|
+
members: { $in: [I] }
|
|
1949
1959
|
},
|
|
1950
1960
|
{},
|
|
1951
1961
|
{ limit: 100 }
|
|
1952
|
-
),
|
|
1953
|
-
|
|
1954
|
-
const we =
|
|
1955
|
-
Object.values(we).forEach((
|
|
1962
|
+
), F = /* @__PURE__ */ new Set();
|
|
1963
|
+
V.forEach(($) => {
|
|
1964
|
+
const we = $.state.members;
|
|
1965
|
+
Object.values(we).forEach((ot) => {
|
|
1956
1966
|
var De;
|
|
1957
|
-
const pe = (De =
|
|
1958
|
-
pe && pe !==
|
|
1967
|
+
const pe = (De = ot.user) == null ? void 0 : De.id;
|
|
1968
|
+
pe && pe !== I && F.add(pe);
|
|
1959
1969
|
});
|
|
1960
|
-
}),
|
|
1961
|
-
channelCount:
|
|
1962
|
-
memberCount:
|
|
1970
|
+
}), A(($) => $.size === F.size && [...$].every((we) => F.has(we)) ? $ : F), ae(V.length > 0), K(!0), he.current = I, D && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1971
|
+
channelCount: V.length,
|
|
1972
|
+
memberCount: F.size
|
|
1963
1973
|
});
|
|
1964
|
-
} catch (
|
|
1965
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1974
|
+
} catch (V) {
|
|
1975
|
+
console.error("[MessagingShell] Failed to sync channels:", V);
|
|
1966
1976
|
}
|
|
1967
|
-
}, [f,
|
|
1977
|
+
}, [f, k, D]);
|
|
1968
1978
|
X(() => {
|
|
1969
|
-
if (!f || !
|
|
1970
|
-
const
|
|
1971
|
-
|
|
1972
|
-
}, [f,
|
|
1973
|
-
if (!
|
|
1979
|
+
if (!f || !k) return;
|
|
1980
|
+
const I = f.userID;
|
|
1981
|
+
I && he.current !== I && le();
|
|
1982
|
+
}, [f, k, le]), X(() => {
|
|
1983
|
+
if (!a || !f || !k) return;
|
|
1974
1984
|
(async () => {
|
|
1975
|
-
const
|
|
1976
|
-
if (
|
|
1985
|
+
const V = f.userID;
|
|
1986
|
+
if (V)
|
|
1977
1987
|
try {
|
|
1978
|
-
|
|
1988
|
+
D && console.log(
|
|
1979
1989
|
"[MessagingShell] Loading initial conversation with:",
|
|
1980
|
-
|
|
1990
|
+
a
|
|
1981
1991
|
);
|
|
1982
|
-
const
|
|
1992
|
+
const F = await f.queryChannels(
|
|
1983
1993
|
{
|
|
1984
1994
|
type: "messaging",
|
|
1985
|
-
members: { $eq: [
|
|
1995
|
+
members: { $eq: [V, a] }
|
|
1986
1996
|
},
|
|
1987
1997
|
{},
|
|
1988
1998
|
{ limit: 1 }
|
|
1989
1999
|
);
|
|
1990
|
-
if (
|
|
1991
|
-
|
|
2000
|
+
if (F.length > 0)
|
|
2001
|
+
j(F[0]), oe(!0), J(null), l && l(F[0]), D && console.log(
|
|
1992
2002
|
"[MessagingShell] Initial conversation loaded:",
|
|
1993
|
-
|
|
2003
|
+
F[0].id
|
|
1994
2004
|
);
|
|
1995
|
-
else if (c &&
|
|
1996
|
-
|
|
2005
|
+
else if (c && v) {
|
|
2006
|
+
D && console.log(
|
|
1997
2007
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1998
2008
|
c
|
|
1999
2009
|
);
|
|
2000
2010
|
try {
|
|
2001
|
-
const
|
|
2011
|
+
const $ = await v.startChannelWithParticipant({
|
|
2002
2012
|
id: c.id,
|
|
2003
2013
|
name: c.name,
|
|
2004
2014
|
email: c.email,
|
|
2005
2015
|
phone: c.phone
|
|
2006
2016
|
});
|
|
2007
|
-
|
|
2017
|
+
j($), oe(!0), J(null), l && l($), D && console.log(
|
|
2008
2018
|
"[MessagingShell] Channel created and loaded:",
|
|
2009
|
-
|
|
2019
|
+
$.id
|
|
2010
2020
|
);
|
|
2011
|
-
} catch (
|
|
2021
|
+
} catch ($) {
|
|
2012
2022
|
console.error(
|
|
2013
2023
|
"[MessagingShell] Failed to create conversation:",
|
|
2014
|
-
|
|
2024
|
+
$
|
|
2015
2025
|
), J("Failed to create conversation");
|
|
2016
2026
|
}
|
|
2017
2027
|
} else
|
|
2018
2028
|
J(
|
|
2019
2029
|
"No conversation found with this account"
|
|
2020
|
-
),
|
|
2030
|
+
), D && console.log(
|
|
2021
2031
|
"[MessagingShell] No conversation found for:",
|
|
2022
|
-
|
|
2032
|
+
a
|
|
2023
2033
|
);
|
|
2024
|
-
} catch (
|
|
2034
|
+
} catch (F) {
|
|
2025
2035
|
console.error(
|
|
2026
2036
|
"[MessagingShell] Failed to load initial conversation:",
|
|
2027
|
-
|
|
2037
|
+
F
|
|
2028
2038
|
), J("Failed to load conversation");
|
|
2029
2039
|
}
|
|
2030
2040
|
})();
|
|
2031
2041
|
}, [
|
|
2032
|
-
|
|
2042
|
+
a,
|
|
2033
2043
|
c,
|
|
2034
2044
|
f,
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2045
|
+
k,
|
|
2046
|
+
v,
|
|
2047
|
+
D,
|
|
2038
2048
|
l
|
|
2039
2049
|
]);
|
|
2040
|
-
const
|
|
2041
|
-
(
|
|
2042
|
-
|
|
2050
|
+
const et = P(
|
|
2051
|
+
(I) => {
|
|
2052
|
+
j(I), l == null || l(I);
|
|
2043
2053
|
},
|
|
2044
2054
|
[l]
|
|
2045
|
-
),
|
|
2046
|
-
|
|
2047
|
-
}, [
|
|
2048
|
-
async (
|
|
2049
|
-
var
|
|
2050
|
-
if (
|
|
2055
|
+
), tt = P(() => {
|
|
2056
|
+
q || j(null);
|
|
2057
|
+
}, [q]), st = P(
|
|
2058
|
+
async (I) => {
|
|
2059
|
+
var V;
|
|
2060
|
+
if (v)
|
|
2051
2061
|
try {
|
|
2052
|
-
|
|
2062
|
+
D && console.log(
|
|
2053
2063
|
"[MessagingShell] Starting conversation with:",
|
|
2054
|
-
|
|
2064
|
+
I.id
|
|
2055
2065
|
);
|
|
2056
|
-
const
|
|
2057
|
-
id:
|
|
2058
|
-
name:
|
|
2059
|
-
email:
|
|
2060
|
-
phone:
|
|
2066
|
+
const F = await v.startChannelWithParticipant({
|
|
2067
|
+
id: I.id,
|
|
2068
|
+
name: I.name,
|
|
2069
|
+
email: I.email,
|
|
2070
|
+
phone: I.phone
|
|
2061
2071
|
});
|
|
2062
2072
|
try {
|
|
2063
|
-
await
|
|
2064
|
-
} catch (
|
|
2065
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
2073
|
+
await F.show();
|
|
2074
|
+
} catch ($) {
|
|
2075
|
+
console.warn("[MessagingShell] Failed to unhide channel:", $);
|
|
2066
2076
|
}
|
|
2067
|
-
|
|
2068
|
-
} catch (
|
|
2069
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
2077
|
+
j(F), U(!1), (V = te.current) == null || V.close(), m == null || m(I);
|
|
2078
|
+
} catch (F) {
|
|
2079
|
+
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
2070
2080
|
}
|
|
2071
2081
|
},
|
|
2072
|
-
[
|
|
2082
|
+
[v, m, D]
|
|
2073
2083
|
), fe = P(() => {
|
|
2074
|
-
var
|
|
2075
|
-
|
|
2076
|
-
}, []),
|
|
2077
|
-
(
|
|
2078
|
-
|
|
2084
|
+
var I;
|
|
2085
|
+
U(!1), (I = te.current) == null || I.close();
|
|
2086
|
+
}, []), nt = P(
|
|
2087
|
+
(I) => {
|
|
2088
|
+
I.target === te.current && fe();
|
|
2079
2089
|
},
|
|
2080
2090
|
[fe]
|
|
2081
|
-
), nt = P(
|
|
2082
|
-
async (S) => {
|
|
2083
|
-
T && console.log("[MessagingShell] Leaving conversation:", S.id), z(null), oe(!1), he.current = null, await le();
|
|
2084
|
-
},
|
|
2085
|
-
[le, T]
|
|
2086
2091
|
), at = P(
|
|
2087
|
-
async (
|
|
2088
|
-
|
|
2092
|
+
async (I) => {
|
|
2093
|
+
D && console.log("[MessagingShell] Leaving conversation:", I.id), j(null), oe(!1), he.current = null, await le();
|
|
2094
|
+
},
|
|
2095
|
+
[le, D]
|
|
2096
|
+
), rt = P(
|
|
2097
|
+
async (I) => {
|
|
2098
|
+
D && console.log("[MessagingShell] Blocking participant:", I), j(null), oe(!1), he.current = null, await le();
|
|
2089
2099
|
},
|
|
2090
|
-
[le,
|
|
2091
|
-
), ge = !!
|
|
2092
|
-
return
|
|
2100
|
+
[le, D]
|
|
2101
|
+
), ge = !!W;
|
|
2102
|
+
return H ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ne, {}) }) : Z ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ce, { message: Z, onBack: Y }) }) : !k || !f ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
|
|
2093
2103
|
Ce,
|
|
2094
2104
|
{
|
|
2095
2105
|
message: "Not connected to messaging service",
|
|
2096
|
-
onBack:
|
|
2106
|
+
onBack: Y
|
|
2097
2107
|
}
|
|
2098
|
-
) }) : ee ? /* @__PURE__ */ e("div", { className:
|
|
2108
|
+
) }) : ee ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ce, { message: ee }) }) : /* @__PURE__ */ i(
|
|
2099
2109
|
"div",
|
|
2100
2110
|
{
|
|
2101
|
-
className:
|
|
2111
|
+
className: R(
|
|
2102
2112
|
"messaging-shell h-full bg-background-primary overflow-hidden",
|
|
2103
2113
|
s
|
|
2104
2114
|
),
|
|
@@ -2107,24 +2117,24 @@ const Hs = ({
|
|
|
2107
2117
|
/* @__PURE__ */ e(
|
|
2108
2118
|
"div",
|
|
2109
2119
|
{
|
|
2110
|
-
className:
|
|
2120
|
+
className: R(
|
|
2111
2121
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
2112
2122
|
{
|
|
2113
|
-
"!hidden": h === !1 ||
|
|
2123
|
+
"!hidden": h === !1 || q,
|
|
2114
2124
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
2115
|
-
"hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !
|
|
2125
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !q && ge,
|
|
2116
2126
|
// Show on mobile when no channel selected, use same wide width on desktop
|
|
2117
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !
|
|
2127
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !q && !ge
|
|
2118
2128
|
}
|
|
2119
2129
|
),
|
|
2120
2130
|
children: /* @__PURE__ */ e(
|
|
2121
|
-
|
|
2131
|
+
qe,
|
|
2122
2132
|
{
|
|
2123
|
-
onChannelSelect:
|
|
2124
|
-
selectedChannel:
|
|
2125
|
-
filters:
|
|
2126
|
-
customEmptyStateIndicator:
|
|
2127
|
-
renderMessagePreview:
|
|
2133
|
+
onChannelSelect: et,
|
|
2134
|
+
selectedChannel: W || void 0,
|
|
2135
|
+
filters: Ke,
|
|
2136
|
+
customEmptyStateIndicator: x,
|
|
2137
|
+
renderMessagePreview: S
|
|
2128
2138
|
}
|
|
2129
2139
|
)
|
|
2130
2140
|
}
|
|
@@ -2132,49 +2142,49 @@ const Hs = ({
|
|
|
2132
2142
|
/* @__PURE__ */ e(
|
|
2133
2143
|
"div",
|
|
2134
2144
|
{
|
|
2135
|
-
className:
|
|
2145
|
+
className: R(
|
|
2136
2146
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
2137
2147
|
{
|
|
2138
2148
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
2139
|
-
flex:
|
|
2149
|
+
flex: q || ge || a,
|
|
2140
2150
|
// Normal mode: hide on mobile when no channel selected
|
|
2141
|
-
"hidden lg:flex": !
|
|
2151
|
+
"hidden lg:flex": !q && !ge && !a
|
|
2142
2152
|
}
|
|
2143
2153
|
),
|
|
2144
|
-
children:
|
|
2145
|
-
|
|
2154
|
+
children: W ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
2155
|
+
Je,
|
|
2146
2156
|
{
|
|
2147
|
-
channel:
|
|
2148
|
-
onBack:
|
|
2149
|
-
showBackButton: !
|
|
2157
|
+
channel: W,
|
|
2158
|
+
onBack: tt,
|
|
2159
|
+
showBackButton: !q,
|
|
2150
2160
|
renderMessageInputActions: n,
|
|
2151
2161
|
renderConversationFooter: o,
|
|
2152
|
-
renderChannelBanner:
|
|
2153
|
-
onLeaveConversation:
|
|
2154
|
-
onBlockParticipant:
|
|
2155
|
-
CustomChannelEmptyState:
|
|
2156
|
-
showDeleteConversation:
|
|
2157
|
-
onDeleteConversationClick:
|
|
2158
|
-
onBlockParticipantClick:
|
|
2159
|
-
onReportParticipantClick:
|
|
2160
|
-
dmAgentEnabled:
|
|
2162
|
+
renderChannelBanner: L,
|
|
2163
|
+
onLeaveConversation: at,
|
|
2164
|
+
onBlockParticipant: rt,
|
|
2165
|
+
CustomChannelEmptyState: g,
|
|
2166
|
+
showDeleteConversation: Xe,
|
|
2167
|
+
onDeleteConversationClick: w,
|
|
2168
|
+
onBlockParticipantClick: r,
|
|
2169
|
+
onReportParticipantClick: y,
|
|
2170
|
+
dmAgentEnabled: _,
|
|
2161
2171
|
messageMetadata: C,
|
|
2162
2172
|
onMessageSent: M,
|
|
2163
|
-
showStarButton:
|
|
2164
|
-
chatbotVotingEnabled:
|
|
2173
|
+
showStarButton: E,
|
|
2174
|
+
chatbotVotingEnabled: p,
|
|
2165
2175
|
customProfileContent: d,
|
|
2166
2176
|
customChannelActions: u,
|
|
2167
2177
|
renderMessage: N
|
|
2168
2178
|
},
|
|
2169
|
-
|
|
2170
|
-
) }) :
|
|
2179
|
+
W.id
|
|
2180
|
+
) }) : a ? (
|
|
2171
2181
|
// Show loading while creating/loading direct conversation channel
|
|
2172
2182
|
/* @__PURE__ */ e(Ne, {})
|
|
2173
2183
|
) : /* @__PURE__ */ e(
|
|
2174
|
-
|
|
2184
|
+
Qe,
|
|
2175
2185
|
{
|
|
2176
2186
|
hasChannels: ne,
|
|
2177
|
-
channelsLoaded:
|
|
2187
|
+
channelsLoaded: G
|
|
2178
2188
|
}
|
|
2179
2189
|
)
|
|
2180
2190
|
}
|
|
@@ -2186,26 +2196,26 @@ const Hs = ({
|
|
|
2186
2196
|
{
|
|
2187
2197
|
ref: te,
|
|
2188
2198
|
className: "mes-dialog",
|
|
2189
|
-
onClick:
|
|
2199
|
+
onClick: nt,
|
|
2190
2200
|
onClose: fe,
|
|
2191
2201
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
2192
|
-
|
|
2202
|
+
Us,
|
|
2193
2203
|
{
|
|
2194
2204
|
participantSource: de,
|
|
2195
|
-
onSelectParticipant:
|
|
2205
|
+
onSelectParticipant: st,
|
|
2196
2206
|
onClose: fe,
|
|
2197
|
-
existingParticipantIds:
|
|
2207
|
+
existingParticipantIds: O,
|
|
2198
2208
|
participantLabel: ue,
|
|
2199
2209
|
searchPlaceholder: `Search ${ue}...`
|
|
2200
2210
|
},
|
|
2201
|
-
|
|
2211
|
+
z
|
|
2202
2212
|
) })
|
|
2203
2213
|
}
|
|
2204
2214
|
)
|
|
2205
2215
|
]
|
|
2206
2216
|
}
|
|
2207
2217
|
);
|
|
2208
|
-
},
|
|
2218
|
+
}, Fs = ({
|
|
2209
2219
|
question: t,
|
|
2210
2220
|
onClick: s,
|
|
2211
2221
|
loading: n = !1,
|
|
@@ -2217,7 +2227,7 @@ const Hs = ({
|
|
|
2217
2227
|
onClick: s,
|
|
2218
2228
|
disabled: n,
|
|
2219
2229
|
style: { backgroundColor: "#E6E5E3" },
|
|
2220
|
-
className:
|
|
2230
|
+
className: R(
|
|
2221
2231
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors focus-ring",
|
|
2222
2232
|
{
|
|
2223
2233
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -2227,22 +2237,22 @@ const Hs = ({
|
|
|
2227
2237
|
),
|
|
2228
2238
|
children: t
|
|
2229
2239
|
}
|
|
2230
|
-
),
|
|
2240
|
+
), qs = ({
|
|
2231
2241
|
faqs: t,
|
|
2232
2242
|
onFaqClick: s,
|
|
2233
2243
|
loadingFaqId: n,
|
|
2234
2244
|
headerText: o,
|
|
2235
2245
|
className: l,
|
|
2236
2246
|
avatarImage: m,
|
|
2237
|
-
avatarName:
|
|
2247
|
+
avatarName: a
|
|
2238
2248
|
}) => {
|
|
2239
|
-
const c = t.filter((
|
|
2249
|
+
const c = t.filter((g) => g.enabled).sort((g, h) => (g.order ?? 0) - (h.order ?? 0));
|
|
2240
2250
|
return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
2241
|
-
(m ||
|
|
2251
|
+
(m || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
2242
2252
|
se,
|
|
2243
2253
|
{
|
|
2244
|
-
id:
|
|
2245
|
-
name:
|
|
2254
|
+
id: a || "account",
|
|
2255
|
+
name: a || "Account",
|
|
2246
2256
|
image: m,
|
|
2247
2257
|
size: 24,
|
|
2248
2258
|
shape: "circle"
|
|
@@ -2255,75 +2265,75 @@ const Hs = ({
|
|
|
2255
2265
|
style: { backgroundColor: "#F1F0EE" },
|
|
2256
2266
|
children: [
|
|
2257
2267
|
o && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: o }),
|
|
2258
|
-
c.map((
|
|
2259
|
-
|
|
2268
|
+
c.map((g) => /* @__PURE__ */ e(
|
|
2269
|
+
Fs,
|
|
2260
2270
|
{
|
|
2261
|
-
question:
|
|
2262
|
-
onClick: () => s(
|
|
2263
|
-
loading: n ===
|
|
2271
|
+
question: g.question,
|
|
2272
|
+
onClick: () => s(g.id),
|
|
2273
|
+
loading: n === g.id
|
|
2264
2274
|
},
|
|
2265
|
-
|
|
2275
|
+
g.id
|
|
2266
2276
|
))
|
|
2267
2277
|
]
|
|
2268
2278
|
}
|
|
2269
2279
|
)
|
|
2270
2280
|
] }) });
|
|
2271
|
-
},
|
|
2272
|
-
const { initialSearch: n = "", pageSize: o = 20 } = s, [l, m] =
|
|
2273
|
-
if (
|
|
2274
|
-
const d =
|
|
2281
|
+
}, Ys = (t, s = {}) => {
|
|
2282
|
+
const { initialSearch: n = "", pageSize: o = 20 } = s, [l, m] = T([]), [a, c] = T(!1), [g, h] = T(null), [b, x] = T(n), [w, r] = T(!0), [y, _] = T(), C = P(async (S = !1, L) => {
|
|
2283
|
+
if (a) return;
|
|
2284
|
+
const d = L !== void 0 ? L : b;
|
|
2275
2285
|
c(!0), h(null);
|
|
2276
2286
|
try {
|
|
2277
2287
|
const u = await t.loadParticipants({
|
|
2278
2288
|
search: d || void 0,
|
|
2279
2289
|
limit: o,
|
|
2280
|
-
cursor:
|
|
2290
|
+
cursor: S ? void 0 : y
|
|
2281
2291
|
});
|
|
2282
2292
|
m(
|
|
2283
|
-
(N) =>
|
|
2284
|
-
),
|
|
2293
|
+
(N) => S ? u.participants : [...N, ...u.participants]
|
|
2294
|
+
), r(u.hasMore), _(u.nextCursor);
|
|
2285
2295
|
} catch (u) {
|
|
2286
2296
|
const N = u instanceof Error ? u.message : "Failed to load participants";
|
|
2287
2297
|
h(N), console.error("[useParticipants] Load error:", u);
|
|
2288
2298
|
} finally {
|
|
2289
2299
|
c(!1);
|
|
2290
2300
|
}
|
|
2291
|
-
}, [t, b,
|
|
2292
|
-
|
|
2293
|
-
}, [
|
|
2294
|
-
|
|
2295
|
-
}, [C]),
|
|
2296
|
-
|
|
2301
|
+
}, [t, b, y, o, a]), M = P(() => {
|
|
2302
|
+
w && !a && C(!1);
|
|
2303
|
+
}, [w, a, C]), E = P((S) => {
|
|
2304
|
+
x(S), _(void 0), C(!0, S);
|
|
2305
|
+
}, [C]), p = P(() => {
|
|
2306
|
+
_(void 0), C(!0);
|
|
2297
2307
|
}, [C]);
|
|
2298
2308
|
return X(() => {
|
|
2299
2309
|
C(!0);
|
|
2300
2310
|
}, [t.loadParticipants]), {
|
|
2301
2311
|
participants: l,
|
|
2302
|
-
loading:
|
|
2303
|
-
error:
|
|
2312
|
+
loading: a,
|
|
2313
|
+
error: g,
|
|
2304
2314
|
searchQuery: b,
|
|
2305
|
-
hasMore:
|
|
2315
|
+
hasMore: w,
|
|
2306
2316
|
totalCount: t.totalCount,
|
|
2307
2317
|
loadMore: M,
|
|
2308
|
-
search:
|
|
2309
|
-
refresh:
|
|
2318
|
+
search: E,
|
|
2319
|
+
refresh: p
|
|
2310
2320
|
};
|
|
2311
2321
|
};
|
|
2312
2322
|
export {
|
|
2313
2323
|
xe as ActionButton,
|
|
2314
2324
|
se as Avatar,
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2325
|
+
Ts as ChannelEmptyState,
|
|
2326
|
+
qe as ChannelList,
|
|
2327
|
+
Je as ChannelView,
|
|
2328
|
+
qs as FaqList,
|
|
2329
|
+
Fs as FaqListItem,
|
|
2330
|
+
bs as MessageVoteButtons,
|
|
2331
|
+
Hs as MessagingProvider,
|
|
2332
|
+
Ws as MessagingShell,
|
|
2333
|
+
Us as ParticipantPicker,
|
|
2334
|
+
ns as formatRelativeTime,
|
|
2335
|
+
fs as useMessageVote,
|
|
2336
|
+
Kt as useMessaging,
|
|
2337
|
+
Ys as useParticipants
|
|
2328
2338
|
};
|
|
2329
2339
|
//# sourceMappingURL=index.js.map
|