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