@linktr.ee/messaging-react 1.21.0 โ 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i, Fragment as ve } from "react/jsx-runtime";
|
|
2
2
|
import D from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import A, { createContext as Qe, useContext as Xe, useCallback as T, useState as k, useRef as W, useEffect as q, useMemo as be } from "react";
|
|
4
4
|
import { StreamChatService as Ke } from "@linktr.ee/messaging-core";
|
|
5
|
-
import { Chat as es, ChannelList as ss, DateSeparator as ts, useChannelStateContext as we, useChatContext as Fe, areMessageUIPropsEqual as ns, useMessageReminder as rs, useComponentContext as as, Attachment as
|
|
5
|
+
import { Chat as es, ChannelList as ss, DateSeparator as ts, useChannelStateContext as we, useChatContext as Fe, areMessageUIPropsEqual as ns, useMessageReminder as rs, useComponentContext as as, Attachment as os, EditMessageModal as ls, MessageBlocked as is, MessageBouncePrompt as cs, MessageDeleted as ds, MessageIsThreadReplyInChannelButtonIndicator as us, MessageRepliesCountButton as ms, ReminderNotification as hs, StreamedMessageText as fs, messageHasAttachments as gs, messageHasReactions as xs, isDateSeparatorMessage as bs, isMessageBlocked as Cs, isMessageBounced as Ns, MessageBounceModal as vs, Poll as ws, MessageText as ps, MessageErrorIcon as ys, useMessageContext as Es, useMessageComposer as Is, useStateStore as _s, MessageInput as Ss, useMessageInputContext as Ms, useMessageComposerHasSendableData as ks, SimpleAttachmentSelector as Rs, QuotedMessagePreview as Ds, AttachmentPreviewList as Ts, TextareaComposer as Fs, MessageTimestamp as Ls, Channel as Ps, WithComponents as Os, Window as Us, MessageList as Bs } from "stream-chat-react";
|
|
6
6
|
import { GiftIcon as js, XIcon as pe, ArrowUpIcon as As, ArrowLeftIcon as Ie, StarIcon as _e, DotsThreeIcon as Se, SpinnerGapIcon as ue, SignOutIcon as $s, ProhibitInsetIcon as Me, FlagIcon as zs, MagnifyingGlassIcon as Hs, ChatCircleDotsIcon as ke } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as Re } from "stream-chat";
|
|
8
8
|
const Le = Qe({
|
|
@@ -20,12 +20,12 @@ const Le = Qe({
|
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
22
|
apiKey: a,
|
|
23
|
-
capabilities:
|
|
23
|
+
capabilities: l = {},
|
|
24
24
|
debug: c = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const r =
|
|
27
|
-
(m, ...
|
|
28
|
-
c && console.log(`๐ฅ [MessagingProvider] ${m}`, ...
|
|
26
|
+
const r = T(
|
|
27
|
+
(m, ...N) => {
|
|
28
|
+
c && console.log(`๐ฅ [MessagingProvider] ${m}`, ...N);
|
|
29
29
|
},
|
|
30
30
|
[c]
|
|
31
31
|
);
|
|
@@ -33,30 +33,30 @@ const Le = Qe({
|
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
34
34
|
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
35
35
|
serviceConfig: !!n,
|
|
36
|
-
capabilities: Object.keys(
|
|
36
|
+
capabilities: Object.keys(l)
|
|
37
37
|
});
|
|
38
|
-
const [u,
|
|
38
|
+
const [u, g] = k(null), [x, b] = k(null), [f, v] = k(!1), [o, M] = k(!1), [S, w] = k(null), E = W(!1), h = W({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: a,
|
|
41
41
|
serviceConfig: n,
|
|
42
|
-
capabilities:
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
42
|
+
capabilities: l
|
|
43
|
+
}), C = W(0);
|
|
44
|
+
C.current++, r("๐ RENDER INFO", {
|
|
45
|
+
renderCount: C.current,
|
|
46
46
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (a == null ? void 0 : a.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
|
-
userChanged:
|
|
49
|
-
apiKeyChanged:
|
|
50
|
-
serviceConfigChanged:
|
|
51
|
-
capabilitiesChanged:
|
|
48
|
+
userChanged: h.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
+
apiKeyChanged: h.current.apiKey !== a,
|
|
50
|
+
serviceConfigChanged: h.current.serviceConfig !== n,
|
|
51
|
+
capabilitiesChanged: h.current.capabilities !== l
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
53
|
+
}), h.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
55
|
apiKey: a,
|
|
56
56
|
serviceConfig: n,
|
|
57
|
-
capabilities:
|
|
57
|
+
capabilities: l
|
|
58
58
|
}, q(() => {
|
|
59
|
-
const m =
|
|
59
|
+
const m = C.current;
|
|
60
60
|
if (r("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
61
|
renderCount: m,
|
|
62
62
|
apiKey: !!a,
|
|
@@ -64,8 +64,8 @@ const Le = Qe({
|
|
|
64
64
|
dependencies: {
|
|
65
65
|
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
66
66
|
serviceConfigRef: n,
|
|
67
|
-
serviceConfigStable:
|
|
68
|
-
apiKeyStable:
|
|
67
|
+
serviceConfigStable: h.current.serviceConfig === n,
|
|
68
|
+
apiKeyStable: h.current.apiKey === a
|
|
69
69
|
}
|
|
70
70
|
}), !a || !n) {
|
|
71
71
|
r("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
@@ -77,42 +77,42 @@ const Le = Qe({
|
|
|
77
77
|
r("๐ CREATING NEW SERVICE", {
|
|
78
78
|
renderCount: m,
|
|
79
79
|
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
80
|
-
serviceConfigChanged:
|
|
80
|
+
serviceConfigChanged: h.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const N = new Ke({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: a,
|
|
85
85
|
debug: c
|
|
86
86
|
});
|
|
87
|
-
return
|
|
87
|
+
return g(N), r("โ
SERVICE SET", {
|
|
88
88
|
renderCount: m,
|
|
89
|
-
serviceInstance: !!
|
|
89
|
+
serviceInstance: !!N
|
|
90
90
|
}), () => {
|
|
91
91
|
r("๐งน SERVICE CLEANUP", {
|
|
92
92
|
renderCount: m,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
|
-
}),
|
|
94
|
+
}), N.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
96
|
}, [a, n, c, r]);
|
|
97
|
-
const
|
|
97
|
+
const p = W(null);
|
|
98
98
|
q(() => {
|
|
99
|
-
var
|
|
99
|
+
var N, U;
|
|
100
100
|
if (r("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
101
|
hasService: !!u,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
|
-
isConnecting:
|
|
105
|
-
isConnected:
|
|
104
|
+
isConnecting: E.current,
|
|
105
|
+
isConnected: f,
|
|
106
106
|
dependencies: { service: !!u, userId: s == null ? void 0 : s.id }
|
|
107
107
|
}), !u || !s) {
|
|
108
108
|
r("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
111
|
+
if (E.current) {
|
|
112
112
|
r("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((
|
|
115
|
+
if (((N = p.current) == null ? void 0 : N.serviceId) === u && ((U = p.current) == null ? void 0 : U.userId) === s.id) {
|
|
116
116
|
r(
|
|
117
117
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -120,40 +120,40 @@ const Le = Qe({
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
r("๐ STARTING USER CONNECTION", { userId: s.id }),
|
|
123
|
+
r("๐ STARTING USER CONNECTION", { userId: s.id }), E.current = !0, M(!0), w(null);
|
|
124
124
|
try {
|
|
125
125
|
r("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
const I = await u.connectUser(s);
|
|
127
|
+
b(I), v(!0), p.current = { serviceId: u, userId: s.id }, r("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
|
-
clientId:
|
|
129
|
+
clientId: I.userID
|
|
130
130
|
});
|
|
131
|
-
} catch (
|
|
132
|
-
const
|
|
133
|
-
w(
|
|
131
|
+
} catch (I) {
|
|
132
|
+
const y = I instanceof Error ? I.message : "Connection failed";
|
|
133
|
+
w(y), r("โ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
|
-
error:
|
|
135
|
+
error: y
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
M(!1), E.current = !1, r("๐ USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
|
-
isConnected:
|
|
140
|
+
isConnected: f
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [u, s, r,
|
|
144
|
+
}, [u, s, r, f]), q(() => (r("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
145
|
hasService: !!u,
|
|
146
|
-
isConnected:
|
|
146
|
+
isConnected: f
|
|
147
147
|
}), () => {
|
|
148
|
-
u &&
|
|
148
|
+
u && f ? (r(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
151
|
+
), p.current = null, u.disconnectUser().catch(console.error)) : r("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
152
|
hasService: !!u,
|
|
153
|
-
isConnected:
|
|
153
|
+
isConnected: f
|
|
154
154
|
});
|
|
155
|
-
}), [u,
|
|
156
|
-
const R =
|
|
155
|
+
}), [u, f, r]);
|
|
156
|
+
const R = T(async () => {
|
|
157
157
|
if (r("๐ REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!u,
|
|
159
159
|
hasUser: !!s
|
|
@@ -161,55 +161,55 @@ const Le = Qe({
|
|
|
161
161
|
r("โ ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
r("๐ STARTING CONNECTION REFRESH", { userId: s.id }),
|
|
164
|
+
r("๐ STARTING CONNECTION REFRESH", { userId: s.id }), M(!0);
|
|
165
165
|
try {
|
|
166
166
|
r("๐ DISCONNECTING FOR REFRESH"), await u.disconnectUser(), r("๐ RECONNECTING FOR REFRESH");
|
|
167
167
|
const m = await u.connectUser(s);
|
|
168
|
-
|
|
168
|
+
b(m), v(!0), w(null), r("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
169
|
} catch (m) {
|
|
170
|
-
const
|
|
171
|
-
w(
|
|
170
|
+
const N = m instanceof Error ? m.message : "Refresh failed";
|
|
171
|
+
w(N), r("โ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
|
-
error:
|
|
173
|
+
error: N
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
M(!1), r("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [u, s, r]), d =
|
|
178
|
+
}, [u, s, r]), d = A.useMemo(() => (r("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!u,
|
|
180
|
-
hasClient: !!
|
|
181
|
-
isConnected:
|
|
182
|
-
isLoading:
|
|
183
|
-
hasError: !!
|
|
184
|
-
capabilitiesKeys: Object.keys(
|
|
180
|
+
hasClient: !!x,
|
|
181
|
+
isConnected: f,
|
|
182
|
+
isLoading: o,
|
|
183
|
+
hasError: !!S,
|
|
184
|
+
capabilitiesKeys: Object.keys(l)
|
|
185
185
|
}), {
|
|
186
186
|
service: u,
|
|
187
|
-
client:
|
|
188
|
-
isConnected:
|
|
189
|
-
isLoading:
|
|
190
|
-
error:
|
|
191
|
-
capabilities:
|
|
187
|
+
client: x,
|
|
188
|
+
isConnected: f,
|
|
189
|
+
isLoading: o,
|
|
190
|
+
error: S,
|
|
191
|
+
capabilities: l,
|
|
192
192
|
refreshConnection: R,
|
|
193
193
|
debug: c
|
|
194
194
|
}), [
|
|
195
195
|
u,
|
|
196
|
-
h,
|
|
197
196
|
x,
|
|
198
|
-
|
|
199
|
-
E,
|
|
197
|
+
f,
|
|
200
198
|
o,
|
|
199
|
+
S,
|
|
200
|
+
l,
|
|
201
201
|
R,
|
|
202
202
|
c,
|
|
203
203
|
r
|
|
204
204
|
]);
|
|
205
205
|
return r("๐ RENDER END", {
|
|
206
|
-
renderCount:
|
|
207
|
-
willRenderChat: !!(
|
|
206
|
+
renderCount: C.current,
|
|
207
|
+
willRenderChat: !!(x && f),
|
|
208
208
|
contextValueReady: !!d
|
|
209
|
-
}), /* @__PURE__ */ e(Le.Provider, { value: d, children:
|
|
209
|
+
}), /* @__PURE__ */ e(Le.Provider, { value: d, children: x && f ? /* @__PURE__ */ e(
|
|
210
210
|
es,
|
|
211
211
|
{
|
|
212
|
-
client:
|
|
212
|
+
client: x,
|
|
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
|
},
|
|
@@ -219,10 +219,10 @@ const Le = Qe({
|
|
|
219
219
|
}, Gs = () => fe(), Vs = (t, s) => {
|
|
220
220
|
const n = new Date(
|
|
221
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
222
|
-
),
|
|
222
|
+
), l = new Date(
|
|
223
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
224
224
|
).getTime() - n.getTime();
|
|
225
|
-
return Math.floor(
|
|
225
|
+
return Math.floor(l / (1e3 * 60 * 60 * 24));
|
|
226
226
|
}, Ws = (t) => {
|
|
227
227
|
const s = /* @__PURE__ */ new Date();
|
|
228
228
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
@@ -282,9 +282,9 @@ const Q = ({
|
|
|
282
282
|
image: s,
|
|
283
283
|
size: n = 40,
|
|
284
284
|
className: a,
|
|
285
|
-
shape:
|
|
285
|
+
shape: l = "squircle"
|
|
286
286
|
}) => {
|
|
287
|
-
const c = Zs(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : n < 120 ? "text-lg" : "text-4xl",
|
|
287
|
+
const c = Zs(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
|
};
|
|
@@ -295,7 +295,7 @@ const Q = ({
|
|
|
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",
|
|
@@ -339,12 +339,12 @@ const Q = ({
|
|
|
339
339
|
message: t,
|
|
340
340
|
standalone: s = !1
|
|
341
341
|
}) => {
|
|
342
|
-
var
|
|
342
|
+
var l;
|
|
343
343
|
const n = Pe(t), a = ye(t);
|
|
344
344
|
if (!n && !a)
|
|
345
345
|
return null;
|
|
346
346
|
if (n) {
|
|
347
|
-
const c = (
|
|
347
|
+
const c = (l = t.metadata) == null ? void 0 : l.amount_text;
|
|
348
348
|
if (!c) return null;
|
|
349
349
|
const r = s ? "message-tip-standalone" : "message-tag message-tag--tip", u = s ? `${c} tip` : `Delivered with ${c} tip`;
|
|
350
350
|
return /* @__PURE__ */ i("div", { className: r, children: [
|
|
@@ -356,40 +356,45 @@ const Q = ({
|
|
|
356
356
|
/* @__PURE__ */ e("span", { className: "message-tag__icon", style: { marginTop: -1 }, children: /* @__PURE__ */ e(Ys, {}) }),
|
|
357
357
|
/* @__PURE__ */ e("span", { className: "message-tag__label", children: "Chatbot" })
|
|
358
358
|
] });
|
|
359
|
-
}, Oe =
|
|
359
|
+
}, Oe = A.memo(
|
|
360
360
|
({
|
|
361
361
|
channel: t,
|
|
362
362
|
selectedChannel: s,
|
|
363
363
|
onChannelSelect: n,
|
|
364
364
|
debug: a = !1,
|
|
365
|
-
unread:
|
|
365
|
+
unread: l,
|
|
366
366
|
renderMessagePreview: c
|
|
367
367
|
}) => {
|
|
368
|
-
var
|
|
368
|
+
var p, R, d, m, N, U;
|
|
369
369
|
const r = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), u = () => {
|
|
370
370
|
t && n(t);
|
|
371
|
-
},
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
371
|
+
}, g = (I) => {
|
|
372
|
+
const y = I.key === "Enter" || I.key === " ", B = I.repeat;
|
|
373
|
+
!y || B || (I.preventDefault(), u());
|
|
374
|
+
}, b = Object.values(((p = t == null ? void 0 : t.state) == null ? void 0 : p.members) || {}).find(
|
|
375
|
+
(I) => {
|
|
376
|
+
var y, B;
|
|
377
|
+
return ((y = I.user) == null ? void 0 : y.id) && I.user.id !== ((B = t == null ? void 0 : t._client) == null ? void 0 : B.userID);
|
|
375
378
|
}
|
|
376
|
-
),
|
|
377
|
-
var
|
|
378
|
-
if (
|
|
379
|
-
const
|
|
380
|
-
return
|
|
381
|
-
})(),
|
|
379
|
+
), f = ((R = b == null ? void 0 : b.user) == null ? void 0 : R.name) || "Conversation", v = (d = b == null ? void 0 : b.user) == null ? void 0 : d.image, o = (N = (m = t == null ? void 0 : t.state) == null ? void 0 : m.messages) == null ? void 0 : N[t.state.messages.length - 1], S = (() => {
|
|
380
|
+
var y;
|
|
381
|
+
if (o != null && o.text) return o.text;
|
|
382
|
+
const I = (y = o == null ? void 0 : o.attachments) == null ? void 0 : y[0];
|
|
383
|
+
return I ? I.og_scrape_url ? I.og_scrape_url : I.type === "image" ? "๐ท Sent an image" : I.type === "video" ? "๐ฅ Sent a video" : I.type === "audio" ? "๐ต Sent audio" : I.type === "file" ? "๐ Sent a file" : "๐ Sent an attachment" : "No messages yet";
|
|
384
|
+
})(), w = o != null && o.created_at ? Ws(new Date(o.created_at)) : "", E = o ? ye(o) : !1, h = c ? c(o, S) : `${E ? "โจ " : ""}${S}`, C = l ?? 0;
|
|
382
385
|
return a && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
383
386
|
channelId: t == null ? void 0 : t.id,
|
|
384
387
|
isSelected: r,
|
|
385
|
-
participantName:
|
|
386
|
-
unreadCount:
|
|
387
|
-
hasTimestamp: !!
|
|
388
|
+
participantName: f,
|
|
389
|
+
unreadCount: C,
|
|
390
|
+
hasTimestamp: !!w
|
|
388
391
|
}), /* @__PURE__ */ e(
|
|
389
|
-
"
|
|
392
|
+
"div",
|
|
390
393
|
{
|
|
391
|
-
|
|
394
|
+
role: "button",
|
|
395
|
+
tabIndex: 0,
|
|
392
396
|
onClick: u,
|
|
397
|
+
onKeyDown: g,
|
|
393
398
|
className: D(
|
|
394
399
|
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
395
400
|
{
|
|
@@ -401,9 +406,9 @@ const Q = ({
|
|
|
401
406
|
/* @__PURE__ */ e(
|
|
402
407
|
Q,
|
|
403
408
|
{
|
|
404
|
-
id: ((
|
|
405
|
-
name:
|
|
406
|
-
image:
|
|
409
|
+
id: ((U = b == null ? void 0 : b.user) == null ? void 0 : U.id) || t.id || "unknown",
|
|
410
|
+
name: f,
|
|
411
|
+
image: v,
|
|
407
412
|
size: 44,
|
|
408
413
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
409
414
|
}
|
|
@@ -417,14 +422,14 @@ const Q = ({
|
|
|
417
422
|
"text-sm font-medium truncate",
|
|
418
423
|
r ? "text-primary" : "text-charcoal"
|
|
419
424
|
),
|
|
420
|
-
children:
|
|
425
|
+
children: f
|
|
421
426
|
}
|
|
422
427
|
),
|
|
423
|
-
|
|
428
|
+
w && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: w })
|
|
424
429
|
] }),
|
|
425
430
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
426
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children:
|
|
427
|
-
|
|
431
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children: h }),
|
|
432
|
+
C > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: C > 99 ? "99+" : C })
|
|
428
433
|
] })
|
|
429
434
|
] })
|
|
430
435
|
] })
|
|
@@ -433,16 +438,16 @@ const Q = ({
|
|
|
433
438
|
}
|
|
434
439
|
);
|
|
435
440
|
Oe.displayName = "CustomChannelPreview";
|
|
436
|
-
const Ue =
|
|
441
|
+
const Ue = A.memo(
|
|
437
442
|
({
|
|
438
443
|
onChannelSelect: t,
|
|
439
444
|
selectedChannel: s,
|
|
440
445
|
filters: n,
|
|
441
446
|
className: a,
|
|
442
|
-
customEmptyStateIndicator:
|
|
447
|
+
customEmptyStateIndicator: l,
|
|
443
448
|
renderMessagePreview: c
|
|
444
449
|
}) => {
|
|
445
|
-
const r =
|
|
450
|
+
const r = A.useRef(0);
|
|
446
451
|
r.current++;
|
|
447
452
|
const { debug: u = !1 } = fe();
|
|
448
453
|
u && console.log("๐บ [ChannelList] ๐ RENDER START", {
|
|
@@ -450,10 +455,10 @@ const Ue = j.memo(
|
|
|
450
455
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
451
456
|
filters: n
|
|
452
457
|
});
|
|
453
|
-
const
|
|
458
|
+
const g = A.useMemo(() => (b) => /* @__PURE__ */ e(
|
|
454
459
|
Oe,
|
|
455
460
|
{
|
|
456
|
-
...
|
|
461
|
+
...b,
|
|
457
462
|
selectedChannel: s,
|
|
458
463
|
onChannelSelect: t,
|
|
459
464
|
debug: u,
|
|
@@ -473,8 +478,8 @@ const Ue = j.memo(
|
|
|
473
478
|
filters: n,
|
|
474
479
|
sort: { last_message_at: -1 },
|
|
475
480
|
options: { limit: 30 },
|
|
476
|
-
Preview:
|
|
477
|
-
EmptyStateIndicator:
|
|
481
|
+
Preview: g,
|
|
482
|
+
EmptyStateIndicator: l
|
|
478
483
|
},
|
|
479
484
|
JSON.stringify(n)
|
|
480
485
|
) })
|
|
@@ -533,7 +538,7 @@ function st(t) {
|
|
|
533
538
|
const { channel: s } = we(), { client: n } = Fe("useMessageVote"), a = be(
|
|
534
539
|
() => et(t.own_reactions),
|
|
535
540
|
[t.own_reactions]
|
|
536
|
-
),
|
|
541
|
+
), l = T(async () => {
|
|
537
542
|
if (n != null && n.userID)
|
|
538
543
|
try {
|
|
539
544
|
a === "up" ? await s.deleteReaction(t.id, Ce) : await s.sendReaction(
|
|
@@ -543,7 +548,7 @@ function st(t) {
|
|
|
543
548
|
);
|
|
544
549
|
} catch {
|
|
545
550
|
}
|
|
546
|
-
}, [s, n == null ? void 0 : n.userID, t.id, a]), c =
|
|
551
|
+
}, [s, n == null ? void 0 : n.userID, t.id, a]), c = T(async () => {
|
|
547
552
|
if (n != null && n.userID)
|
|
548
553
|
try {
|
|
549
554
|
a === "down" ? await s.deleteReaction(t.id, Ne) : await s.sendReaction(
|
|
@@ -554,7 +559,7 @@ function st(t) {
|
|
|
554
559
|
} catch {
|
|
555
560
|
}
|
|
556
561
|
}, [s, n == null ? void 0 : n.userID, t.id, a]);
|
|
557
|
-
return { selected: a, voteUp:
|
|
562
|
+
return { selected: a, voteUp: l, voteDown: c };
|
|
558
563
|
}
|
|
559
564
|
const tt = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
|
|
560
565
|
"path",
|
|
@@ -609,101 +614,101 @@ const tt = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
609
614
|
additionalMessageInputProps: s,
|
|
610
615
|
chatbotVotingEnabled: n,
|
|
611
616
|
editing: a,
|
|
612
|
-
endOfGroup:
|
|
617
|
+
endOfGroup: l,
|
|
613
618
|
firstOfGroup: c,
|
|
614
619
|
groupedByUser: r,
|
|
615
620
|
handleAction: u,
|
|
616
|
-
handleOpenThread:
|
|
617
|
-
handleRetry:
|
|
618
|
-
highlighted:
|
|
619
|
-
isMessageAIGenerated:
|
|
620
|
-
isMyMessage:
|
|
621
|
-
message:
|
|
622
|
-
renderText:
|
|
623
|
-
threadList:
|
|
624
|
-
} = t, { client: w } = Fe("CustomMessage"), [
|
|
625
|
-
Attachment: m =
|
|
626
|
-
EditMessageModal:
|
|
627
|
-
MessageBlocked:
|
|
628
|
-
MessageBouncePrompt:
|
|
629
|
-
MessageDeleted:
|
|
630
|
-
MessageIsThreadReplyInChannelButtonIndicator:
|
|
631
|
-
MessageRepliesCountButton:
|
|
621
|
+
handleOpenThread: g,
|
|
622
|
+
handleRetry: x,
|
|
623
|
+
highlighted: b,
|
|
624
|
+
isMessageAIGenerated: f,
|
|
625
|
+
isMyMessage: v,
|
|
626
|
+
message: o,
|
|
627
|
+
renderText: M,
|
|
628
|
+
threadList: S
|
|
629
|
+
} = t, { client: w } = Fe("CustomMessage"), [E, h] = k(!1), C = rs(o.id), { selected: p, voteUp: R, voteDown: d } = st(o), {
|
|
630
|
+
Attachment: m = os,
|
|
631
|
+
EditMessageModal: N = ls,
|
|
632
|
+
MessageBlocked: U = is,
|
|
633
|
+
MessageBouncePrompt: I = cs,
|
|
634
|
+
MessageDeleted: y = ds,
|
|
635
|
+
MessageIsThreadReplyInChannelButtonIndicator: B = us,
|
|
636
|
+
MessageRepliesCountButton: H = ms,
|
|
632
637
|
ReminderNotification: X = hs,
|
|
633
638
|
StreamedMessageText: K = fs,
|
|
634
639
|
PinIndicator: Y
|
|
635
|
-
} = as("CustomMessage"), ee = gs(
|
|
636
|
-
() =>
|
|
637
|
-
[
|
|
640
|
+
} = as("CustomMessage"), ee = gs(o), ne = xs(o), J = be(
|
|
641
|
+
() => f == null ? void 0 : f(o),
|
|
642
|
+
[f, o]
|
|
638
643
|
), V = be(
|
|
639
|
-
() => !
|
|
640
|
-
[
|
|
644
|
+
() => !o.shared_location && !o.attachments ? [] : o.shared_location ? [o.shared_location, ...o.attachments ?? []] : o.attachments,
|
|
645
|
+
[o]
|
|
641
646
|
);
|
|
642
|
-
if (bs(
|
|
647
|
+
if (bs(o))
|
|
643
648
|
return null;
|
|
644
|
-
if (
|
|
645
|
-
return /* @__PURE__ */ e(
|
|
646
|
-
if (Cs(
|
|
647
|
-
return /* @__PURE__ */ e(
|
|
648
|
-
const
|
|
649
|
-
let
|
|
650
|
-
|
|
651
|
-
const
|
|
649
|
+
if (o.deleted_at || o.type === "deleted")
|
|
650
|
+
return /* @__PURE__ */ e(y, { message: o });
|
|
651
|
+
if (Cs(o))
|
|
652
|
+
return /* @__PURE__ */ e(U, {});
|
|
653
|
+
const F = !S && !!o.reply_count, L = !S && o.show_in_channel && o.parent_id, G = o.status === "failed" && ((re = o.error) == null ? void 0 : re.status) !== 403, P = Ns(o);
|
|
654
|
+
let j;
|
|
655
|
+
G ? j = () => x(o) : P && (j = () => h(!0));
|
|
656
|
+
const oe = D(
|
|
652
657
|
"str-chat__message str-chat__message-simple",
|
|
653
|
-
`str-chat__message--${
|
|
654
|
-
`str-chat__message--${
|
|
655
|
-
|
|
656
|
-
|
|
658
|
+
`str-chat__message--${o.type}`,
|
|
659
|
+
`str-chat__message--${o.status}`,
|
|
660
|
+
v() ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
661
|
+
o.text ? "str-chat__message--has-text" : "has-no-text",
|
|
657
662
|
{
|
|
658
663
|
"str-chat__message--has-attachment": ee,
|
|
659
|
-
"str-chat__message--highlighted":
|
|
660
|
-
"str-chat__message--pinned pinned-message":
|
|
664
|
+
"str-chat__message--highlighted": b,
|
|
665
|
+
"str-chat__message--pinned pinned-message": o.pinned,
|
|
661
666
|
"str-chat__message--with-reactions": ne,
|
|
662
|
-
"str-chat__message-send-can-be-retried": (
|
|
663
|
-
"str-chat__message-with-thread-link":
|
|
664
|
-
"str-chat__virtual-message__wrapper--end":
|
|
667
|
+
"str-chat__message-send-can-be-retried": (o == null ? void 0 : o.status) === "failed" && ((ae = o == null ? void 0 : o.error) == null ? void 0 : ae.status) !== 403,
|
|
668
|
+
"str-chat__message-with-thread-link": F || L,
|
|
669
|
+
"str-chat__virtual-message__wrapper--end": l,
|
|
665
670
|
"str-chat__virtual-message__wrapper--first": c,
|
|
666
671
|
"str-chat__virtual-message__wrapper--group": r
|
|
667
672
|
}
|
|
668
|
-
), Z =
|
|
673
|
+
), Z = o.poll_id && w.polls.fromState(o.poll_id), se = Xs(o);
|
|
669
674
|
return /* @__PURE__ */ i(ve, { children: [
|
|
670
675
|
a && /* @__PURE__ */ e(
|
|
671
|
-
|
|
676
|
+
N,
|
|
672
677
|
{
|
|
673
678
|
additionalMessageInputProps: s
|
|
674
679
|
}
|
|
675
680
|
),
|
|
676
|
-
|
|
681
|
+
E && /* @__PURE__ */ e(
|
|
677
682
|
vs,
|
|
678
683
|
{
|
|
679
|
-
MessageBouncePrompt:
|
|
680
|
-
onClose: () =>
|
|
681
|
-
open:
|
|
684
|
+
MessageBouncePrompt: I,
|
|
685
|
+
onClose: () => h(!1),
|
|
686
|
+
open: E
|
|
682
687
|
}
|
|
683
688
|
),
|
|
684
|
-
/* @__PURE__ */ i("div", { className:
|
|
689
|
+
/* @__PURE__ */ i("div", { className: oe, children: [
|
|
685
690
|
Y && /* @__PURE__ */ e(Y, {}),
|
|
686
|
-
!!
|
|
687
|
-
|
|
691
|
+
!!C && /* @__PURE__ */ e(X, { reminder: C }),
|
|
692
|
+
o.user && /* @__PURE__ */ e(
|
|
688
693
|
Q,
|
|
689
694
|
{
|
|
690
695
|
className: "str-chat__avatar str-chat__message-sender-avatar",
|
|
691
|
-
id:
|
|
692
|
-
image:
|
|
693
|
-
name:
|
|
696
|
+
id: o.user.id,
|
|
697
|
+
image: o.user.image,
|
|
698
|
+
name: o.user.name || o.user.id
|
|
694
699
|
}
|
|
695
700
|
),
|
|
696
701
|
/* @__PURE__ */ e(
|
|
697
702
|
"div",
|
|
698
703
|
{
|
|
699
704
|
className: D("str-chat__message-inner", {
|
|
700
|
-
"str-chat__simple-message--error-failed":
|
|
705
|
+
"str-chat__simple-message--error-failed": G || P
|
|
701
706
|
}),
|
|
702
707
|
"data-testid": "message-inner",
|
|
703
|
-
onClick:
|
|
704
|
-
onKeyDown:
|
|
705
|
-
role:
|
|
706
|
-
tabIndex:
|
|
708
|
+
onClick: j,
|
|
709
|
+
onKeyDown: j,
|
|
710
|
+
role: j ? "button" : void 0,
|
|
711
|
+
tabIndex: j ? 0 : void 0,
|
|
707
712
|
style: {
|
|
708
713
|
// Force margins to 0 to prevent hover layout shift
|
|
709
714
|
// Stream Chat CSS sets margin-inline-end/start to 78px, then 0 on hover
|
|
@@ -712,11 +717,11 @@ const tt = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
712
717
|
},
|
|
713
718
|
children: se ? (
|
|
714
719
|
/* Tip-only messages render as a standalone bubble */
|
|
715
|
-
/* @__PURE__ */ e(Te, { message:
|
|
720
|
+
/* @__PURE__ */ e(Te, { message: o, standalone: !0 })
|
|
716
721
|
) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
717
722
|
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
718
723
|
Z && /* @__PURE__ */ e(ws, { poll: Z }),
|
|
719
|
-
V != null && V.length && !
|
|
724
|
+
V != null && V.length && !o.quoted_message ? /* @__PURE__ */ e(
|
|
720
725
|
m,
|
|
721
726
|
{
|
|
722
727
|
actionHandler: u,
|
|
@@ -726,17 +731,17 @@ const tt = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
726
731
|
J ? /* @__PURE__ */ e(
|
|
727
732
|
K,
|
|
728
733
|
{
|
|
729
|
-
message:
|
|
730
|
-
renderText:
|
|
734
|
+
message: o,
|
|
735
|
+
renderText: M
|
|
731
736
|
}
|
|
732
|
-
) : /* @__PURE__ */ e(ps, { message:
|
|
737
|
+
) : /* @__PURE__ */ e(ps, { message: o, renderText: M }),
|
|
733
738
|
/* @__PURE__ */ e(ys, {})
|
|
734
739
|
] }),
|
|
735
|
-
/* @__PURE__ */ e(Te, { message:
|
|
736
|
-
n && ye(
|
|
740
|
+
/* @__PURE__ */ e(Te, { message: o }),
|
|
741
|
+
n && ye(o) && /* @__PURE__ */ e(
|
|
737
742
|
rt,
|
|
738
743
|
{
|
|
739
|
-
selected:
|
|
744
|
+
selected: p,
|
|
740
745
|
onVoteUp: R,
|
|
741
746
|
onVoteDown: d
|
|
742
747
|
}
|
|
@@ -744,22 +749,22 @@ const tt = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
744
749
|
] })
|
|
745
750
|
}
|
|
746
751
|
),
|
|
747
|
-
|
|
748
|
-
|
|
752
|
+
F && /* @__PURE__ */ e(
|
|
753
|
+
H,
|
|
749
754
|
{
|
|
750
|
-
onClick:
|
|
751
|
-
reply_count:
|
|
755
|
+
onClick: g,
|
|
756
|
+
reply_count: o.reply_count
|
|
752
757
|
}
|
|
753
758
|
),
|
|
754
|
-
|
|
755
|
-
] },
|
|
759
|
+
L && /* @__PURE__ */ e(B, {})
|
|
760
|
+
] }, o.id)
|
|
756
761
|
] });
|
|
757
|
-
},
|
|
762
|
+
}, ot = A.memo(
|
|
758
763
|
at,
|
|
759
764
|
ns
|
|
760
|
-
),
|
|
765
|
+
), lt = (t) => {
|
|
761
766
|
const s = Es("CustomMessage");
|
|
762
|
-
return /* @__PURE__ */ e(
|
|
767
|
+
return /* @__PURE__ */ e(ot, { ...s, ...t });
|
|
763
768
|
}, it = (t) => ({
|
|
764
769
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
765
770
|
(s) => Re.previewIsLoaded(s) || Re.previewIsLoading(s)
|
|
@@ -768,7 +773,7 @@ const tt = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
768
773
|
link: t,
|
|
769
774
|
onDismiss: s
|
|
770
775
|
}) => {
|
|
771
|
-
const { og_scrape_url: n, title: a, image_url:
|
|
776
|
+
const { og_scrape_url: n, title: a, image_url: l } = t;
|
|
772
777
|
return /* @__PURE__ */ i(
|
|
773
778
|
"a",
|
|
774
779
|
{
|
|
@@ -777,10 +782,10 @@ const tt = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
777
782
|
rel: "noopener noreferrer",
|
|
778
783
|
className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
|
|
779
784
|
children: [
|
|
780
|
-
|
|
785
|
+
l && /* @__PURE__ */ e(
|
|
781
786
|
"img",
|
|
782
787
|
{
|
|
783
|
-
src:
|
|
788
|
+
src: l,
|
|
784
789
|
alt: a || "",
|
|
785
790
|
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
786
791
|
}
|
|
@@ -808,16 +813,16 @@ const tt = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
808
813
|
const { linkPreviewsManager: t } = Is(), { linkPreviews: s } = _s(
|
|
809
814
|
t.state,
|
|
810
815
|
it
|
|
811
|
-
), n = (
|
|
812
|
-
t.dismissPreview(
|
|
816
|
+
), n = (l) => {
|
|
817
|
+
t.dismissPreview(l);
|
|
813
818
|
};
|
|
814
|
-
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((
|
|
819
|
+
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(
|
|
815
820
|
ct,
|
|
816
821
|
{
|
|
817
|
-
link:
|
|
822
|
+
link: l,
|
|
818
823
|
onDismiss: n
|
|
819
824
|
},
|
|
820
|
-
|
|
825
|
+
l.og_scrape_url
|
|
821
826
|
)) }) : null;
|
|
822
827
|
}, ut = () => {
|
|
823
828
|
const { handleSubmit: t } = Ms(), s = ks();
|
|
@@ -909,7 +914,7 @@ const tt = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
909
914
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
910
915
|
]
|
|
911
916
|
}
|
|
912
|
-
), he =
|
|
917
|
+
), he = A.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
913
918
|
/* @__PURE__ */ e(gt, { className: "w-6 h-6" }),
|
|
914
919
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
915
920
|
] }) }));
|
|
@@ -919,35 +924,35 @@ const xt = ({
|
|
|
919
924
|
showBackButton: s,
|
|
920
925
|
onShowInfo: n,
|
|
921
926
|
canShowInfo: a,
|
|
922
|
-
showStarButton:
|
|
927
|
+
showStarButton: l = !1
|
|
923
928
|
}) => {
|
|
924
|
-
var
|
|
925
|
-
const { channel: c } = we(), r =
|
|
926
|
-
(
|
|
927
|
-
var
|
|
928
|
-
return ((
|
|
929
|
+
var v, o, M, S, w, E;
|
|
930
|
+
const { channel: c } = we(), r = A.useMemo(() => Object.values(c.state.members || {}).find(
|
|
931
|
+
(C) => {
|
|
932
|
+
var p;
|
|
933
|
+
return ((p = C.user) == null ? void 0 : p.id) && C.user.id !== c._client.userID;
|
|
929
934
|
}
|
|
930
|
-
), [c._client.userID, c.state.members]), u = ((
|
|
931
|
-
!!((
|
|
935
|
+
), [c._client.userID, c.state.members]), u = ((v = r == null ? void 0 : r.user) == null ? void 0 : v.name) || ((o = r == null ? void 0 : r.user) == null ? void 0 : o.id) || "Unknown member", g = (M = r == null ? void 0 : r.user) == null ? void 0 : M.image, [x, b] = k(
|
|
936
|
+
!!((S = c.state.membership) != null && S.pinned_at)
|
|
932
937
|
);
|
|
933
938
|
q(() => {
|
|
934
|
-
const
|
|
935
|
-
var
|
|
936
|
-
|
|
937
|
-
|
|
939
|
+
const h = (C) => {
|
|
940
|
+
var p;
|
|
941
|
+
b(
|
|
942
|
+
C != null && C.member ? !!C.member.pinned_at : !!((p = c.state.membership) != null && p.pinned_at)
|
|
938
943
|
);
|
|
939
944
|
};
|
|
940
|
-
return c.on("member.updated",
|
|
941
|
-
c.off("member.updated",
|
|
945
|
+
return c.on("member.updated", h), () => {
|
|
946
|
+
c.off("member.updated", h);
|
|
942
947
|
};
|
|
943
948
|
}, [c]);
|
|
944
|
-
const
|
|
949
|
+
const f = async () => {
|
|
945
950
|
try {
|
|
946
|
-
|
|
947
|
-
} catch (
|
|
951
|
+
x ? await c.unpin() : await c.pin();
|
|
952
|
+
} catch (h) {
|
|
948
953
|
console.error(
|
|
949
954
|
"[CustomChannelHeader] Failed to update pinned status:",
|
|
950
|
-
|
|
955
|
+
h
|
|
951
956
|
);
|
|
952
957
|
}
|
|
953
958
|
};
|
|
@@ -972,28 +977,28 @@ const xt = ({
|
|
|
972
977
|
{
|
|
973
978
|
id: ((w = r == null ? void 0 : r.user) == null ? void 0 : w.id) || c.id || "unknown",
|
|
974
979
|
name: u,
|
|
975
|
-
image:
|
|
980
|
+
image: g,
|
|
976
981
|
size: 40
|
|
977
982
|
}
|
|
978
983
|
),
|
|
979
984
|
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: u })
|
|
980
985
|
] }),
|
|
981
986
|
/* @__PURE__ */ i("div", { className: "flex justify-end items-center gap-2", children: [
|
|
982
|
-
|
|
987
|
+
l && /* @__PURE__ */ e(
|
|
983
988
|
"button",
|
|
984
989
|
{
|
|
985
990
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
986
|
-
onClick:
|
|
991
|
+
onClick: f,
|
|
987
992
|
type: "button",
|
|
988
|
-
"aria-label":
|
|
993
|
+
"aria-label": x ? "Unstar conversation" : "Star conversation",
|
|
989
994
|
children: /* @__PURE__ */ e(
|
|
990
995
|
_e,
|
|
991
996
|
{
|
|
992
997
|
className: D("size-5", {
|
|
993
|
-
"text-yellow-600":
|
|
994
|
-
"text-black/90": !
|
|
998
|
+
"text-yellow-600": x,
|
|
999
|
+
"text-black/90": !x
|
|
995
1000
|
}),
|
|
996
|
-
weight:
|
|
1001
|
+
weight: x ? "duotone" : "regular"
|
|
997
1002
|
}
|
|
998
1003
|
)
|
|
999
1004
|
}
|
|
@@ -1025,30 +1030,30 @@ const xt = ({
|
|
|
1025
1030
|
/* @__PURE__ */ e(
|
|
1026
1031
|
Q,
|
|
1027
1032
|
{
|
|
1028
|
-
id: ((
|
|
1033
|
+
id: ((E = r == null ? void 0 : r.user) == null ? void 0 : E.id) || c.id || "unknown",
|
|
1029
1034
|
name: u,
|
|
1030
|
-
image:
|
|
1035
|
+
image: g,
|
|
1031
1036
|
size: 40
|
|
1032
1037
|
}
|
|
1033
1038
|
),
|
|
1034
1039
|
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: u }) })
|
|
1035
1040
|
] }),
|
|
1036
1041
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1037
|
-
|
|
1042
|
+
l && /* @__PURE__ */ e(
|
|
1038
1043
|
"button",
|
|
1039
1044
|
{
|
|
1040
1045
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
1041
|
-
onClick:
|
|
1046
|
+
onClick: f,
|
|
1042
1047
|
type: "button",
|
|
1043
|
-
"aria-label":
|
|
1048
|
+
"aria-label": x ? "Unstar conversation" : "Star conversation",
|
|
1044
1049
|
children: /* @__PURE__ */ e(
|
|
1045
1050
|
_e,
|
|
1046
1051
|
{
|
|
1047
1052
|
className: D("size-5", {
|
|
1048
|
-
"text-yellow-600":
|
|
1049
|
-
"text-black/90": !
|
|
1053
|
+
"text-yellow-600": x,
|
|
1054
|
+
"text-black/90": !x
|
|
1050
1055
|
}),
|
|
1051
|
-
weight:
|
|
1056
|
+
weight: x ? "duotone" : "regular"
|
|
1052
1057
|
}
|
|
1053
1058
|
)
|
|
1054
1059
|
}
|
|
@@ -1071,82 +1076,82 @@ const xt = ({
|
|
|
1071
1076
|
onClose: s,
|
|
1072
1077
|
participant: n,
|
|
1073
1078
|
channel: a,
|
|
1074
|
-
followerStatusLabel:
|
|
1079
|
+
followerStatusLabel: l,
|
|
1075
1080
|
onLeaveConversation: c,
|
|
1076
1081
|
onBlockParticipant: r,
|
|
1077
1082
|
showDeleteConversation: u = !0,
|
|
1078
|
-
onDeleteConversationClick:
|
|
1079
|
-
onBlockParticipantClick:
|
|
1080
|
-
onReportParticipantClick:
|
|
1083
|
+
onDeleteConversationClick: g,
|
|
1084
|
+
onBlockParticipantClick: x,
|
|
1085
|
+
onReportParticipantClick: b
|
|
1081
1086
|
}) => {
|
|
1082
1087
|
var X, K, Y, ee, ne, J, V;
|
|
1083
|
-
const { service:
|
|
1084
|
-
var
|
|
1085
|
-
if (!(!
|
|
1088
|
+
const { service: f, debug: v } = fe(), [o, M] = k(!1), [S, w] = k(!1), [E, h] = k(!1), C = T(async () => {
|
|
1089
|
+
var F;
|
|
1090
|
+
if (!(!f || !((F = n == null ? void 0 : n.user) != null && F.id)))
|
|
1086
1091
|
try {
|
|
1087
|
-
const
|
|
1088
|
-
(
|
|
1089
|
-
var
|
|
1090
|
-
return
|
|
1092
|
+
const G = (await f.getBlockedUsers()).some(
|
|
1093
|
+
(P) => {
|
|
1094
|
+
var j;
|
|
1095
|
+
return P.blocked_user_id === ((j = n == null ? void 0 : n.user) == null ? void 0 : j.id);
|
|
1091
1096
|
}
|
|
1092
1097
|
);
|
|
1093
|
-
|
|
1094
|
-
} catch (
|
|
1098
|
+
M(G);
|
|
1099
|
+
} catch (L) {
|
|
1095
1100
|
console.error(
|
|
1096
1101
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
1097
|
-
|
|
1102
|
+
L
|
|
1098
1103
|
);
|
|
1099
1104
|
}
|
|
1100
|
-
}, [
|
|
1105
|
+
}, [f, (X = n == null ? void 0 : n.user) == null ? void 0 : X.id]);
|
|
1101
1106
|
q(() => {
|
|
1102
|
-
|
|
1103
|
-
}, [
|
|
1104
|
-
const
|
|
1105
|
-
var
|
|
1106
|
-
if (!
|
|
1107
|
-
|
|
1107
|
+
C();
|
|
1108
|
+
}, [C]);
|
|
1109
|
+
const p = async () => {
|
|
1110
|
+
var F;
|
|
1111
|
+
if (!S) {
|
|
1112
|
+
g == null || g(), v && console.log("[ChannelInfoDialog] Leave conversation", a.cid), w(!0);
|
|
1108
1113
|
try {
|
|
1109
|
-
const
|
|
1110
|
-
await a.hide(
|
|
1111
|
-
} catch (
|
|
1112
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
1114
|
+
const L = ((F = a._client) == null ? void 0 : F.userID) ?? null;
|
|
1115
|
+
await a.hide(L, !1), c && await c(a), s();
|
|
1116
|
+
} catch (L) {
|
|
1117
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", L);
|
|
1113
1118
|
} finally {
|
|
1114
1119
|
w(!1);
|
|
1115
1120
|
}
|
|
1116
1121
|
}
|
|
1117
1122
|
}, R = async () => {
|
|
1118
|
-
var
|
|
1119
|
-
if (!(
|
|
1120
|
-
|
|
1123
|
+
var F, L, G;
|
|
1124
|
+
if (!(E || !f)) {
|
|
1125
|
+
x == null || x(), v && console.log("[ChannelInfoDialog] Block member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), h(!0);
|
|
1121
1126
|
try {
|
|
1122
|
-
await
|
|
1123
|
-
} catch (
|
|
1124
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
1127
|
+
await f.blockUser((L = n == null ? void 0 : n.user) == null ? void 0 : L.id), r && await r((G = n == null ? void 0 : n.user) == null ? void 0 : G.id), s();
|
|
1128
|
+
} catch (P) {
|
|
1129
|
+
console.error("[ChannelInfoDialog] Failed to block member", P);
|
|
1125
1130
|
} finally {
|
|
1126
|
-
|
|
1131
|
+
h(!1);
|
|
1127
1132
|
}
|
|
1128
1133
|
}
|
|
1129
1134
|
}, d = async () => {
|
|
1130
|
-
var
|
|
1131
|
-
if (!(
|
|
1132
|
-
|
|
1135
|
+
var F, L, G;
|
|
1136
|
+
if (!(E || !f)) {
|
|
1137
|
+
x == null || x(), v && console.log("[ChannelInfoDialog] Unblock member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), h(!0);
|
|
1133
1138
|
try {
|
|
1134
|
-
await
|
|
1135
|
-
} catch (
|
|
1136
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
1139
|
+
await f.unBlockUser((L = n == null ? void 0 : n.user) == null ? void 0 : L.id), r && await r((G = n == null ? void 0 : n.user) == null ? void 0 : G.id), s();
|
|
1140
|
+
} catch (P) {
|
|
1141
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", P);
|
|
1137
1142
|
} finally {
|
|
1138
|
-
|
|
1143
|
+
h(!1);
|
|
1139
1144
|
}
|
|
1140
1145
|
}
|
|
1141
1146
|
}, m = () => {
|
|
1142
|
-
|
|
1147
|
+
b == null || b(), s(), window.open(
|
|
1143
1148
|
"https://linktr.ee/s/about/trust-center/report",
|
|
1144
1149
|
"_blank",
|
|
1145
1150
|
"noopener,noreferrer"
|
|
1146
1151
|
);
|
|
1147
1152
|
};
|
|
1148
1153
|
if (!n) return null;
|
|
1149
|
-
const
|
|
1154
|
+
const N = ((K = n.user) == null ? void 0 : K.name) || ((Y = n.user) == null ? void 0 : Y.id) || "Unknown member", U = (ee = n.user) == null ? void 0 : ee.image, I = (ne = n.user) == null ? void 0 : ne.email, y = (J = n.user) == null ? void 0 : J.username, B = I || (y ? `linktr.ee/${y}` : void 0), H = ((V = n.user) == null ? void 0 : V.id) || "unknown";
|
|
1150
1155
|
return (
|
|
1151
1156
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1152
1157
|
/* @__PURE__ */ e(
|
|
@@ -1155,8 +1160,8 @@ const xt = ({
|
|
|
1155
1160
|
ref: t,
|
|
1156
1161
|
className: "mes-dialog group",
|
|
1157
1162
|
onClose: s,
|
|
1158
|
-
onClick: (
|
|
1159
|
-
|
|
1163
|
+
onClick: (F) => {
|
|
1164
|
+
F.target === t.current && s();
|
|
1160
1165
|
},
|
|
1161
1166
|
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: [
|
|
1162
1167
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
@@ -1173,28 +1178,28 @@ const xt = ({
|
|
|
1173
1178
|
/* @__PURE__ */ e(
|
|
1174
1179
|
Q,
|
|
1175
1180
|
{
|
|
1176
|
-
id:
|
|
1177
|
-
name:
|
|
1178
|
-
image:
|
|
1181
|
+
id: H,
|
|
1182
|
+
name: N,
|
|
1183
|
+
image: U,
|
|
1179
1184
|
size: 88,
|
|
1180
1185
|
shape: "circle"
|
|
1181
1186
|
}
|
|
1182
1187
|
),
|
|
1183
1188
|
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
1184
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
1185
|
-
|
|
1186
|
-
|
|
1189
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: N }),
|
|
1190
|
+
B && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: B }),
|
|
1191
|
+
l && /* @__PURE__ */ e(
|
|
1187
1192
|
"span",
|
|
1188
1193
|
{
|
|
1189
1194
|
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
1190
1195
|
style: {
|
|
1191
1196
|
padding: "4px 8px",
|
|
1192
|
-
backgroundColor:
|
|
1193
|
-
color:
|
|
1197
|
+
backgroundColor: l === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
|
|
1198
|
+
color: l === "Subscribed to you" ? "#008236" : "#78716C",
|
|
1194
1199
|
lineHeight: "133.333%",
|
|
1195
1200
|
letterSpacing: "0.21px"
|
|
1196
1201
|
},
|
|
1197
|
-
children:
|
|
1202
|
+
children: l
|
|
1198
1203
|
}
|
|
1199
1204
|
)
|
|
1200
1205
|
] })
|
|
@@ -1205,23 +1210,23 @@ const xt = ({
|
|
|
1205
1210
|
u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1206
1211
|
de,
|
|
1207
1212
|
{
|
|
1208
|
-
onClick:
|
|
1209
|
-
disabled:
|
|
1210
|
-
"aria-busy":
|
|
1213
|
+
onClick: p,
|
|
1214
|
+
disabled: S,
|
|
1215
|
+
"aria-busy": S,
|
|
1211
1216
|
children: [
|
|
1212
|
-
|
|
1217
|
+
S ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e($s, { className: "h-5 w-5" }),
|
|
1213
1218
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
1214
1219
|
]
|
|
1215
1220
|
}
|
|
1216
1221
|
) }),
|
|
1217
|
-
/* @__PURE__ */ e("li", { children:
|
|
1222
|
+
/* @__PURE__ */ e("li", { children: o ? /* @__PURE__ */ i(
|
|
1218
1223
|
de,
|
|
1219
1224
|
{
|
|
1220
1225
|
onClick: d,
|
|
1221
|
-
disabled:
|
|
1222
|
-
"aria-busy":
|
|
1226
|
+
disabled: E,
|
|
1227
|
+
"aria-busy": E,
|
|
1223
1228
|
children: [
|
|
1224
|
-
|
|
1229
|
+
E ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Me, { className: "h-5 w-5" }),
|
|
1225
1230
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
1226
1231
|
]
|
|
1227
1232
|
}
|
|
@@ -1229,10 +1234,10 @@ const xt = ({
|
|
|
1229
1234
|
de,
|
|
1230
1235
|
{
|
|
1231
1236
|
onClick: R,
|
|
1232
|
-
disabled:
|
|
1233
|
-
"aria-busy":
|
|
1237
|
+
disabled: E,
|
|
1238
|
+
"aria-busy": E,
|
|
1234
1239
|
children: [
|
|
1235
|
-
|
|
1240
|
+
E ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Me, { className: "h-5 w-5" }),
|
|
1236
1241
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
1237
1242
|
]
|
|
1238
1243
|
}
|
|
@@ -1252,39 +1257,39 @@ const xt = ({
|
|
|
1252
1257
|
showBackButton: s,
|
|
1253
1258
|
renderMessageInputActions: n,
|
|
1254
1259
|
onLeaveConversation: a,
|
|
1255
|
-
onBlockParticipant:
|
|
1260
|
+
onBlockParticipant: l,
|
|
1256
1261
|
showDeleteConversation: c = !0,
|
|
1257
1262
|
onDeleteConversationClick: r,
|
|
1258
1263
|
onBlockParticipantClick: u,
|
|
1259
|
-
onReportParticipantClick:
|
|
1260
|
-
showStarButton:
|
|
1261
|
-
chatbotVotingEnabled:
|
|
1262
|
-
renderChannelBanner:
|
|
1264
|
+
onReportParticipantClick: g,
|
|
1265
|
+
showStarButton: x = !1,
|
|
1266
|
+
chatbotVotingEnabled: b = !1,
|
|
1267
|
+
renderChannelBanner: f
|
|
1263
1268
|
}) => {
|
|
1264
|
-
const { channel:
|
|
1265
|
-
(
|
|
1266
|
-
var
|
|
1267
|
-
return ((
|
|
1269
|
+
const { channel: v } = we(), o = W(null), M = A.useMemo(() => Object.values(v.state.members || {}).find(
|
|
1270
|
+
(C) => {
|
|
1271
|
+
var p;
|
|
1272
|
+
return ((p = C.user) == null ? void 0 : p.id) && C.user.id !== v._client.userID;
|
|
1268
1273
|
}
|
|
1269
|
-
), [
|
|
1270
|
-
const
|
|
1271
|
-
if (
|
|
1272
|
-
return String(
|
|
1273
|
-
if (
|
|
1274
|
-
return
|
|
1275
|
-
}, [
|
|
1276
|
-
var
|
|
1277
|
-
(
|
|
1278
|
-
}, []),
|
|
1279
|
-
var
|
|
1280
|
-
(
|
|
1274
|
+
), [v._client.userID, v.state.members]), S = A.useMemo(() => {
|
|
1275
|
+
const h = v.data ?? {};
|
|
1276
|
+
if (h.followerStatus)
|
|
1277
|
+
return String(h.followerStatus);
|
|
1278
|
+
if (h.isFollower !== void 0)
|
|
1279
|
+
return h.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1280
|
+
}, [v.data]), w = T(() => {
|
|
1281
|
+
var h;
|
|
1282
|
+
(h = o.current) == null || h.showModal();
|
|
1283
|
+
}, []), E = T(() => {
|
|
1284
|
+
var h;
|
|
1285
|
+
(h = o.current) == null || h.close();
|
|
1281
1286
|
}, []);
|
|
1282
1287
|
return /* @__PURE__ */ i(ve, { children: [
|
|
1283
1288
|
/* @__PURE__ */ e(
|
|
1284
1289
|
Os,
|
|
1285
1290
|
{
|
|
1286
1291
|
overrides: {
|
|
1287
|
-
Message: (
|
|
1292
|
+
Message: (h) => /* @__PURE__ */ e(lt, { ...h, chatbotVotingEnabled: b })
|
|
1288
1293
|
},
|
|
1289
1294
|
children: /* @__PURE__ */ i(Us, { children: [
|
|
1290
1295
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
@@ -1293,11 +1298,11 @@ const xt = ({
|
|
|
1293
1298
|
onBack: t,
|
|
1294
1299
|
showBackButton: s,
|
|
1295
1300
|
onShowInfo: w,
|
|
1296
|
-
canShowInfo: !!
|
|
1297
|
-
showStarButton:
|
|
1301
|
+
canShowInfo: !!M,
|
|
1302
|
+
showStarButton: x
|
|
1298
1303
|
}
|
|
1299
1304
|
) }),
|
|
1300
|
-
|
|
1305
|
+
f == null ? void 0 : f(),
|
|
1301
1306
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1302
1307
|
Bs,
|
|
1303
1308
|
{
|
|
@@ -1309,7 +1314,7 @@ const xt = ({
|
|
|
1309
1314
|
/* @__PURE__ */ e(
|
|
1310
1315
|
mt,
|
|
1311
1316
|
{
|
|
1312
|
-
renderActions: () => n == null ? void 0 : n(
|
|
1317
|
+
renderActions: () => n == null ? void 0 : n(v)
|
|
1313
1318
|
}
|
|
1314
1319
|
)
|
|
1315
1320
|
] })
|
|
@@ -1318,60 +1323,60 @@ const xt = ({
|
|
|
1318
1323
|
/* @__PURE__ */ e(
|
|
1319
1324
|
bt,
|
|
1320
1325
|
{
|
|
1321
|
-
dialogRef:
|
|
1322
|
-
onClose:
|
|
1323
|
-
participant:
|
|
1324
|
-
channel:
|
|
1325
|
-
followerStatusLabel:
|
|
1326
|
+
dialogRef: o,
|
|
1327
|
+
onClose: E,
|
|
1328
|
+
participant: M,
|
|
1329
|
+
channel: v,
|
|
1330
|
+
followerStatusLabel: S,
|
|
1326
1331
|
onLeaveConversation: a,
|
|
1327
|
-
onBlockParticipant:
|
|
1332
|
+
onBlockParticipant: l,
|
|
1328
1333
|
showDeleteConversation: c,
|
|
1329
1334
|
onDeleteConversationClick: r,
|
|
1330
1335
|
onBlockParticipantClick: u,
|
|
1331
|
-
onReportParticipantClick:
|
|
1336
|
+
onReportParticipantClick: g
|
|
1332
1337
|
}
|
|
1333
1338
|
)
|
|
1334
1339
|
] });
|
|
1335
|
-
}, Ae =
|
|
1340
|
+
}, Ae = A.memo(
|
|
1336
1341
|
({
|
|
1337
1342
|
channel: t,
|
|
1338
1343
|
onBack: s,
|
|
1339
1344
|
showBackButton: n = !1,
|
|
1340
1345
|
renderMessageInputActions: a,
|
|
1341
|
-
onLeaveConversation:
|
|
1346
|
+
onLeaveConversation: l,
|
|
1342
1347
|
onBlockParticipant: c,
|
|
1343
1348
|
className: r,
|
|
1344
1349
|
CustomChannelEmptyState: u = ft,
|
|
1345
|
-
showDeleteConversation:
|
|
1346
|
-
onDeleteConversationClick:
|
|
1347
|
-
onBlockParticipantClick:
|
|
1348
|
-
onReportParticipantClick:
|
|
1349
|
-
dmAgentEnabled:
|
|
1350
|
-
messageMetadata:
|
|
1351
|
-
onMessageSent:
|
|
1352
|
-
showStarButton:
|
|
1350
|
+
showDeleteConversation: g = !0,
|
|
1351
|
+
onDeleteConversationClick: x,
|
|
1352
|
+
onBlockParticipantClick: b,
|
|
1353
|
+
onReportParticipantClick: f,
|
|
1354
|
+
dmAgentEnabled: v,
|
|
1355
|
+
messageMetadata: o,
|
|
1356
|
+
onMessageSent: M,
|
|
1357
|
+
showStarButton: S = !1,
|
|
1353
1358
|
chatbotVotingEnabled: w = !1,
|
|
1354
|
-
renderChannelBanner:
|
|
1359
|
+
renderChannelBanner: E
|
|
1355
1360
|
}) => {
|
|
1356
|
-
const
|
|
1357
|
-
async (
|
|
1358
|
-
var
|
|
1359
|
-
const d = ((
|
|
1360
|
-
...
|
|
1361
|
+
const h = T(
|
|
1362
|
+
async (C, p, R) => {
|
|
1363
|
+
var y;
|
|
1364
|
+
const d = ((y = t.data) == null ? void 0 : y.chatbot_paused) === !0, m = v && !d, N = {
|
|
1365
|
+
...p,
|
|
1361
1366
|
...m && { silent: !0 },
|
|
1362
|
-
...
|
|
1367
|
+
...o && {
|
|
1363
1368
|
metadata: {
|
|
1364
|
-
...
|
|
1365
|
-
...
|
|
1369
|
+
...p.metadata ?? {},
|
|
1370
|
+
...o
|
|
1366
1371
|
}
|
|
1367
1372
|
}
|
|
1368
|
-
},
|
|
1373
|
+
}, U = {
|
|
1369
1374
|
...R,
|
|
1370
1375
|
...m && { skip_push: !0 }
|
|
1371
|
-
},
|
|
1372
|
-
return
|
|
1376
|
+
}, I = await t.sendMessage(N, U);
|
|
1377
|
+
return M == null || M(I), I;
|
|
1373
1378
|
},
|
|
1374
|
-
[t,
|
|
1379
|
+
[t, v, o, M]
|
|
1375
1380
|
);
|
|
1376
1381
|
return /* @__PURE__ */ e(
|
|
1377
1382
|
"div",
|
|
@@ -1388,23 +1393,23 @@ const xt = ({
|
|
|
1388
1393
|
EmptyStateIndicator: u,
|
|
1389
1394
|
LoadingIndicator: he,
|
|
1390
1395
|
DateSeparator: Ks,
|
|
1391
|
-
doSendMessageRequest:
|
|
1396
|
+
doSendMessageRequest: h,
|
|
1392
1397
|
children: /* @__PURE__ */ e(
|
|
1393
1398
|
Ct,
|
|
1394
1399
|
{
|
|
1395
1400
|
onBack: s,
|
|
1396
1401
|
showBackButton: n,
|
|
1397
1402
|
renderMessageInputActions: a,
|
|
1398
|
-
onLeaveConversation:
|
|
1403
|
+
onLeaveConversation: l,
|
|
1399
1404
|
onBlockParticipant: c,
|
|
1400
1405
|
CustomChannelEmptyState: u,
|
|
1401
|
-
showDeleteConversation:
|
|
1402
|
-
onDeleteConversationClick:
|
|
1403
|
-
onBlockParticipantClick:
|
|
1404
|
-
onReportParticipantClick:
|
|
1405
|
-
showStarButton:
|
|
1406
|
+
showDeleteConversation: g,
|
|
1407
|
+
onDeleteConversationClick: x,
|
|
1408
|
+
onBlockParticipantClick: b,
|
|
1409
|
+
onReportParticipantClick: f,
|
|
1410
|
+
showStarButton: S,
|
|
1406
1411
|
chatbotVotingEnabled: w,
|
|
1407
|
-
renderChannelBanner:
|
|
1412
|
+
renderChannelBanner: E
|
|
1408
1413
|
}
|
|
1409
1414
|
)
|
|
1410
1415
|
}
|
|
@@ -1435,7 +1440,7 @@ function Nt({
|
|
|
1435
1440
|
type: "text",
|
|
1436
1441
|
placeholder: n,
|
|
1437
1442
|
value: t,
|
|
1438
|
-
onChange: (
|
|
1443
|
+
onChange: (l) => s(l.target.value),
|
|
1439
1444
|
className: "w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent"
|
|
1440
1445
|
}
|
|
1441
1446
|
),
|
|
@@ -1444,8 +1449,8 @@ function Nt({
|
|
|
1444
1449
|
{
|
|
1445
1450
|
label: "Clear search",
|
|
1446
1451
|
onClick: () => {
|
|
1447
|
-
var
|
|
1448
|
-
s(""), (
|
|
1452
|
+
var l;
|
|
1453
|
+
s(""), (l = a.current) == null || l.focus();
|
|
1449
1454
|
},
|
|
1450
1455
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1451
1456
|
children: /* @__PURE__ */ e(pe, { className: "h-4 w-4", weight: "bold" })
|
|
@@ -1458,13 +1463,13 @@ const vt = ({
|
|
|
1458
1463
|
onSelectParticipant: s,
|
|
1459
1464
|
onClose: n,
|
|
1460
1465
|
existingParticipantIds: a = /* @__PURE__ */ new Set(),
|
|
1461
|
-
participantLabel:
|
|
1466
|
+
participantLabel: l = "participants",
|
|
1462
1467
|
searchPlaceholder: c = "Search participants...",
|
|
1463
1468
|
className: r
|
|
1464
1469
|
}) => {
|
|
1465
|
-
const { debug: u } = fe(), [
|
|
1470
|
+
const { debug: u } = fe(), [g, x] = k(""), [b, f] = k([]), [v, o] = k(!1), [M, S] = k(null), [w, E] = k(
|
|
1466
1471
|
null
|
|
1467
|
-
),
|
|
1472
|
+
), h = W(!1);
|
|
1468
1473
|
q(() => {
|
|
1469
1474
|
if (t.loading) {
|
|
1470
1475
|
u && console.log(
|
|
@@ -1472,46 +1477,46 @@ const vt = ({
|
|
|
1472
1477
|
);
|
|
1473
1478
|
return;
|
|
1474
1479
|
}
|
|
1475
|
-
if (
|
|
1480
|
+
if (h.current) return;
|
|
1476
1481
|
(async () => {
|
|
1477
|
-
u && console.log("[ParticipantPicker] Loading initial participants..."),
|
|
1482
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), o(!0), S(null);
|
|
1478
1483
|
try {
|
|
1479
1484
|
const m = await t.loadParticipants({
|
|
1480
1485
|
search: "",
|
|
1481
1486
|
// Load all participants initially
|
|
1482
1487
|
limit: 100
|
|
1483
1488
|
});
|
|
1484
|
-
|
|
1489
|
+
f(m.participants), h.current = !0, u && console.log(
|
|
1485
1490
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1486
1491
|
m.participants.length
|
|
1487
1492
|
);
|
|
1488
1493
|
} catch (m) {
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1494
|
+
const N = m instanceof Error ? m.message : "Failed to load participants";
|
|
1495
|
+
S(N), console.error("[ParticipantPicker] Failed to load participants:", m);
|
|
1491
1496
|
} finally {
|
|
1492
|
-
|
|
1497
|
+
o(!1);
|
|
1493
1498
|
}
|
|
1494
1499
|
})();
|
|
1495
1500
|
}, [t.loading, u]);
|
|
1496
|
-
const
|
|
1497
|
-
var
|
|
1498
|
-
if (!
|
|
1499
|
-
const m =
|
|
1500
|
-
return d.name.toLowerCase().includes(m) || ((
|
|
1501
|
-
}),
|
|
1501
|
+
const C = b.filter((d) => !a.has(d.id)).filter((d) => {
|
|
1502
|
+
var N;
|
|
1503
|
+
if (!g) return !0;
|
|
1504
|
+
const m = g.toLowerCase();
|
|
1505
|
+
return d.name.toLowerCase().includes(m) || ((N = d.email) == null ? void 0 : N.toLowerCase().includes(m)) || !1;
|
|
1506
|
+
}), p = T(
|
|
1502
1507
|
async (d) => {
|
|
1503
1508
|
if (!w) {
|
|
1504
|
-
|
|
1509
|
+
E(d.id);
|
|
1505
1510
|
try {
|
|
1506
1511
|
await s(d);
|
|
1507
1512
|
} catch (m) {
|
|
1508
|
-
console.error("[ParticipantPicker] Failed to start chat:", m),
|
|
1513
|
+
console.error("[ParticipantPicker] Failed to start chat:", m), E(null);
|
|
1509
1514
|
}
|
|
1510
1515
|
}
|
|
1511
1516
|
},
|
|
1512
1517
|
[s, w]
|
|
1513
1518
|
), R = (d, m) => {
|
|
1514
|
-
(d.key === "Enter" || d.key === " ") && (d.preventDefault(),
|
|
1519
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), p(m));
|
|
1515
1520
|
};
|
|
1516
1521
|
return /* @__PURE__ */ i("div", { className: D("flex flex-col h-full", r), children: [
|
|
1517
1522
|
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
@@ -1521,47 +1526,47 @@ const vt = ({
|
|
|
1521
1526
|
] }),
|
|
1522
1527
|
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1523
1528
|
"Select a ",
|
|
1524
|
-
|
|
1529
|
+
l.slice(0, -1),
|
|
1525
1530
|
" to start messaging (",
|
|
1526
|
-
|
|
1531
|
+
C.length,
|
|
1527
1532
|
" available)",
|
|
1528
|
-
t.totalCount !== void 0 && ` โข ${t.totalCount} ${
|
|
1533
|
+
t.totalCount !== void 0 && ` โข ${t.totalCount} ${l} total`
|
|
1529
1534
|
] }),
|
|
1530
1535
|
/* @__PURE__ */ e(
|
|
1531
1536
|
Nt,
|
|
1532
1537
|
{
|
|
1533
|
-
searchQuery:
|
|
1534
|
-
setSearchQuery:
|
|
1538
|
+
searchQuery: g,
|
|
1539
|
+
setSearchQuery: x,
|
|
1535
1540
|
placeholder: c
|
|
1536
1541
|
}
|
|
1537
1542
|
)
|
|
1538
1543
|
] }),
|
|
1539
|
-
|
|
1544
|
+
M && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1540
1545
|
"Error loading ",
|
|
1541
|
-
|
|
1546
|
+
l,
|
|
1542
1547
|
": ",
|
|
1543
|
-
|
|
1548
|
+
M
|
|
1544
1549
|
] }),
|
|
1545
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
1550
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: v && C.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: [
|
|
1546
1551
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1547
1552
|
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1548
1553
|
"Loading ",
|
|
1549
|
-
|
|
1554
|
+
l,
|
|
1550
1555
|
"..."
|
|
1551
1556
|
] })
|
|
1552
|
-
] }) }) :
|
|
1557
|
+
] }) }) : C.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1553
1558
|
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(ke, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1554
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children:
|
|
1555
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children:
|
|
1559
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: g ? `No ${l} found` : b.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
|
|
1560
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: g ? "Try a different search term" : b.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
|
|
1556
1561
|
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1557
|
-
|
|
1558
|
-
const m = d.name || d.email || d.id,
|
|
1562
|
+
C.map((d) => {
|
|
1563
|
+
const m = d.name || d.email || d.id, N = d.email && d.name ? d.email : d.phone;
|
|
1559
1564
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1560
1565
|
"button",
|
|
1561
1566
|
{
|
|
1562
1567
|
type: "button",
|
|
1563
|
-
onClick: () =>
|
|
1564
|
-
onKeyDown: (
|
|
1568
|
+
onClick: () => p(d),
|
|
1569
|
+
onKeyDown: (U) => R(U, d),
|
|
1565
1570
|
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",
|
|
1566
1571
|
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1567
1572
|
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
@@ -1576,7 +1581,7 @@ const vt = ({
|
|
|
1576
1581
|
),
|
|
1577
1582
|
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1578
1583
|
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: m }),
|
|
1579
|
-
|
|
1584
|
+
N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
|
|
1580
1585
|
] })
|
|
1581
1586
|
] }),
|
|
1582
1587
|
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: w === d.id ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ke, { className: "h-5 w-5 text-stone" }) })
|
|
@@ -1584,7 +1589,7 @@ const vt = ({
|
|
|
1584
1589
|
}
|
|
1585
1590
|
) }, d.id);
|
|
1586
1591
|
}),
|
|
1587
|
-
|
|
1592
|
+
v && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1588
1593
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1589
1594
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1590
1595
|
] }) })
|
|
@@ -1724,7 +1729,7 @@ const vt = ({
|
|
|
1724
1729
|
] })
|
|
1725
1730
|
]
|
|
1726
1731
|
}
|
|
1727
|
-
), $e =
|
|
1732
|
+
), $e = A.memo(
|
|
1728
1733
|
({ 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: [
|
|
1729
1734
|
/* @__PURE__ */ e(wt, {}),
|
|
1730
1735
|
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
@@ -1734,7 +1739,7 @@ const vt = ({
|
|
|
1734
1739
|
] }) })
|
|
1735
1740
|
);
|
|
1736
1741
|
$e.displayName = "EmptyState";
|
|
1737
|
-
const me =
|
|
1742
|
+
const me = A.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: [
|
|
1738
1743
|
/* @__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: "โ ๏ธ" }) }),
|
|
1739
1744
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1740
1745
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1754,138 +1759,138 @@ const Dt = ({
|
|
|
1754
1759
|
className: s,
|
|
1755
1760
|
renderMessageInputActions: n,
|
|
1756
1761
|
onChannelSelect: a,
|
|
1757
|
-
onParticipantSelect:
|
|
1762
|
+
onParticipantSelect: l,
|
|
1758
1763
|
initialParticipantFilter: c,
|
|
1759
1764
|
initialParticipantData: r,
|
|
1760
1765
|
CustomChannelEmptyState: u,
|
|
1761
|
-
showChannelList:
|
|
1762
|
-
filters:
|
|
1763
|
-
channelListCustomEmptyStateIndicator:
|
|
1764
|
-
onDeleteConversationClick:
|
|
1765
|
-
onBlockParticipantClick:
|
|
1766
|
-
onReportParticipantClick:
|
|
1767
|
-
dmAgentEnabled:
|
|
1768
|
-
messageMetadata:
|
|
1766
|
+
showChannelList: g = !0,
|
|
1767
|
+
filters: x,
|
|
1768
|
+
channelListCustomEmptyStateIndicator: b,
|
|
1769
|
+
onDeleteConversationClick: f,
|
|
1770
|
+
onBlockParticipantClick: v,
|
|
1771
|
+
onReportParticipantClick: o,
|
|
1772
|
+
dmAgentEnabled: M,
|
|
1773
|
+
messageMetadata: S,
|
|
1769
1774
|
onMessageSent: w,
|
|
1770
|
-
showStarButton:
|
|
1771
|
-
chatbotVotingEnabled:
|
|
1772
|
-
renderMessagePreview:
|
|
1773
|
-
renderChannelBanner:
|
|
1775
|
+
showStarButton: E = !1,
|
|
1776
|
+
chatbotVotingEnabled: h = !1,
|
|
1777
|
+
renderMessagePreview: C,
|
|
1778
|
+
renderChannelBanner: p
|
|
1774
1779
|
}) => {
|
|
1775
1780
|
const {
|
|
1776
1781
|
service: R,
|
|
1777
1782
|
client: d,
|
|
1778
1783
|
isConnected: m,
|
|
1779
|
-
isLoading:
|
|
1780
|
-
error:
|
|
1781
|
-
refreshConnection:
|
|
1782
|
-
debug:
|
|
1783
|
-
} = Gs(), [
|
|
1784
|
+
isLoading: N,
|
|
1785
|
+
error: U,
|
|
1786
|
+
refreshConnection: I,
|
|
1787
|
+
debug: y
|
|
1788
|
+
} = Gs(), [B, H] = k(null), [X, K] = k(!1), [Y, ee] = k(!1), [ne, J] = k(!1), [V, F] = k(/* @__PURE__ */ new Set()), [L, G] = k(0), [P, j] = k(!1), [oe, Z] = k(null), se = W(null), {
|
|
1784
1789
|
participantSource: re,
|
|
1785
1790
|
participantLabel: ae = "participants",
|
|
1786
1791
|
showDeleteConversation: ze = !0
|
|
1787
|
-
} = t, He =
|
|
1788
|
-
const
|
|
1792
|
+
} = t, He = A.useMemo(() => {
|
|
1793
|
+
const _ = d == null ? void 0 : d.userID;
|
|
1789
1794
|
return {
|
|
1790
1795
|
...{
|
|
1791
1796
|
type: "messaging",
|
|
1792
1797
|
last_message_at: { $exists: !0 },
|
|
1793
|
-
...
|
|
1794
|
-
members: { $in: [
|
|
1798
|
+
..._ && {
|
|
1799
|
+
members: { $in: [_] },
|
|
1795
1800
|
hidden: !1
|
|
1796
1801
|
}
|
|
1797
1802
|
},
|
|
1798
|
-
...
|
|
1803
|
+
...x
|
|
1799
1804
|
};
|
|
1800
|
-
}, [
|
|
1805
|
+
}, [x, d == null ? void 0 : d.userID]), le = W(null), te = T(async () => {
|
|
1801
1806
|
if (!d || !m) return;
|
|
1802
|
-
const
|
|
1803
|
-
if (
|
|
1807
|
+
const _ = d.userID;
|
|
1808
|
+
if (_)
|
|
1804
1809
|
try {
|
|
1805
|
-
|
|
1806
|
-
const
|
|
1810
|
+
y && console.log("[MessagingShell] Syncing channels for user:", _);
|
|
1811
|
+
const z = await d.queryChannels(
|
|
1807
1812
|
{
|
|
1808
1813
|
type: "messaging",
|
|
1809
|
-
members: { $in: [
|
|
1814
|
+
members: { $in: [_] }
|
|
1810
1815
|
},
|
|
1811
1816
|
{},
|
|
1812
1817
|
{ limit: 100 }
|
|
1813
|
-
),
|
|
1814
|
-
|
|
1815
|
-
const ge =
|
|
1818
|
+
), O = /* @__PURE__ */ new Set();
|
|
1819
|
+
z.forEach(($) => {
|
|
1820
|
+
const ge = $.state.members;
|
|
1816
1821
|
Object.values(ge).forEach((Je) => {
|
|
1817
1822
|
var Ee;
|
|
1818
1823
|
const xe = (Ee = Je.user) == null ? void 0 : Ee.id;
|
|
1819
|
-
xe && xe !==
|
|
1824
|
+
xe && xe !== _ && O.add(xe);
|
|
1820
1825
|
});
|
|
1821
|
-
}),
|
|
1822
|
-
channelCount:
|
|
1823
|
-
memberCount:
|
|
1826
|
+
}), F(($) => $.size === O.size && [...$].every((ge) => O.has(ge)) ? $ : O), K(z.length > 0), ee(!0), le.current = _, y && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1827
|
+
channelCount: z.length,
|
|
1828
|
+
memberCount: O.size
|
|
1824
1829
|
});
|
|
1825
|
-
} catch (
|
|
1826
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1830
|
+
} catch (z) {
|
|
1831
|
+
console.error("[MessagingShell] Failed to sync channels:", z);
|
|
1827
1832
|
}
|
|
1828
|
-
}, [d, m,
|
|
1833
|
+
}, [d, m, y]);
|
|
1829
1834
|
q(() => {
|
|
1830
1835
|
if (!d || !m) return;
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1836
|
+
const _ = d.userID;
|
|
1837
|
+
_ && le.current !== _ && te();
|
|
1833
1838
|
}, [d, m, te]), q(() => {
|
|
1834
1839
|
if (!c || !d || !m) return;
|
|
1835
1840
|
(async () => {
|
|
1836
|
-
const
|
|
1837
|
-
if (
|
|
1841
|
+
const z = d.userID;
|
|
1842
|
+
if (z)
|
|
1838
1843
|
try {
|
|
1839
|
-
|
|
1844
|
+
y && console.log(
|
|
1840
1845
|
"[MessagingShell] Loading initial conversation with:",
|
|
1841
1846
|
c
|
|
1842
1847
|
);
|
|
1843
|
-
const
|
|
1848
|
+
const O = await d.queryChannels(
|
|
1844
1849
|
{
|
|
1845
1850
|
type: "messaging",
|
|
1846
|
-
members: { $eq: [
|
|
1851
|
+
members: { $eq: [z, c] }
|
|
1847
1852
|
},
|
|
1848
1853
|
{},
|
|
1849
1854
|
{ limit: 1 }
|
|
1850
1855
|
);
|
|
1851
|
-
if (
|
|
1852
|
-
|
|
1856
|
+
if (O.length > 0)
|
|
1857
|
+
H(O[0]), j(!0), Z(null), a && a(O[0]), y && console.log(
|
|
1853
1858
|
"[MessagingShell] Initial conversation loaded:",
|
|
1854
|
-
|
|
1859
|
+
O[0].id
|
|
1855
1860
|
);
|
|
1856
1861
|
else if (r && R) {
|
|
1857
|
-
|
|
1862
|
+
y && console.log(
|
|
1858
1863
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1859
1864
|
r
|
|
1860
1865
|
);
|
|
1861
1866
|
try {
|
|
1862
|
-
const
|
|
1867
|
+
const $ = await R.startChannelWithParticipant({
|
|
1863
1868
|
id: r.id,
|
|
1864
1869
|
name: r.name,
|
|
1865
1870
|
email: r.email,
|
|
1866
1871
|
phone: r.phone
|
|
1867
1872
|
});
|
|
1868
|
-
|
|
1873
|
+
H($), j(!0), Z(null), a && a($), y && console.log(
|
|
1869
1874
|
"[MessagingShell] Channel created and loaded:",
|
|
1870
|
-
|
|
1875
|
+
$.id
|
|
1871
1876
|
);
|
|
1872
|
-
} catch (
|
|
1877
|
+
} catch ($) {
|
|
1873
1878
|
console.error(
|
|
1874
1879
|
"[MessagingShell] Failed to create conversation:",
|
|
1875
|
-
|
|
1880
|
+
$
|
|
1876
1881
|
), Z("Failed to create conversation");
|
|
1877
1882
|
}
|
|
1878
1883
|
} else
|
|
1879
1884
|
Z(
|
|
1880
1885
|
"No conversation found with this account"
|
|
1881
|
-
),
|
|
1886
|
+
), y && console.log(
|
|
1882
1887
|
"[MessagingShell] No conversation found for:",
|
|
1883
1888
|
c
|
|
1884
1889
|
);
|
|
1885
|
-
} catch (
|
|
1890
|
+
} catch (O) {
|
|
1886
1891
|
console.error(
|
|
1887
1892
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1888
|
-
|
|
1893
|
+
O
|
|
1889
1894
|
), Z("Failed to load conversation");
|
|
1890
1895
|
}
|
|
1891
1896
|
})();
|
|
@@ -1895,68 +1900,68 @@ const Dt = ({
|
|
|
1895
1900
|
d,
|
|
1896
1901
|
m,
|
|
1897
1902
|
R,
|
|
1898
|
-
|
|
1903
|
+
y,
|
|
1899
1904
|
a
|
|
1900
1905
|
]);
|
|
1901
|
-
const Ge =
|
|
1902
|
-
(
|
|
1903
|
-
|
|
1906
|
+
const Ge = T(
|
|
1907
|
+
(_) => {
|
|
1908
|
+
H(_), a == null || a(_);
|
|
1904
1909
|
},
|
|
1905
1910
|
[a]
|
|
1906
|
-
), Ve =
|
|
1907
|
-
|
|
1908
|
-
}, [
|
|
1909
|
-
async (
|
|
1910
|
-
var
|
|
1911
|
+
), Ve = T(() => {
|
|
1912
|
+
P || H(null);
|
|
1913
|
+
}, [P]), We = T(
|
|
1914
|
+
async (_) => {
|
|
1915
|
+
var z;
|
|
1911
1916
|
if (R)
|
|
1912
1917
|
try {
|
|
1913
|
-
|
|
1918
|
+
y && console.log(
|
|
1914
1919
|
"[MessagingShell] Starting conversation with:",
|
|
1915
|
-
|
|
1920
|
+
_.id
|
|
1916
1921
|
);
|
|
1917
|
-
const
|
|
1918
|
-
id:
|
|
1919
|
-
name:
|
|
1920
|
-
email:
|
|
1921
|
-
phone:
|
|
1922
|
+
const O = await R.startChannelWithParticipant({
|
|
1923
|
+
id: _.id,
|
|
1924
|
+
name: _.name,
|
|
1925
|
+
email: _.email,
|
|
1926
|
+
phone: _.phone
|
|
1922
1927
|
});
|
|
1923
1928
|
try {
|
|
1924
|
-
await
|
|
1925
|
-
} catch (
|
|
1926
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1929
|
+
await O.show();
|
|
1930
|
+
} catch ($) {
|
|
1931
|
+
console.warn("[MessagingShell] Failed to unhide channel:", $);
|
|
1927
1932
|
}
|
|
1928
|
-
|
|
1929
|
-
} catch (
|
|
1930
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1933
|
+
H(O), J(!1), (z = se.current) == null || z.close(), l == null || l(_);
|
|
1934
|
+
} catch (O) {
|
|
1935
|
+
console.error("[MessagingShell] Failed to start conversation:", O);
|
|
1931
1936
|
}
|
|
1932
1937
|
},
|
|
1933
|
-
[R,
|
|
1934
|
-
), ie =
|
|
1935
|
-
var
|
|
1936
|
-
J(!1), (
|
|
1937
|
-
}, []), qe =
|
|
1938
|
-
(
|
|
1939
|
-
|
|
1938
|
+
[R, l, y]
|
|
1939
|
+
), ie = T(() => {
|
|
1940
|
+
var _;
|
|
1941
|
+
J(!1), (_ = se.current) == null || _.close();
|
|
1942
|
+
}, []), qe = T(
|
|
1943
|
+
(_) => {
|
|
1944
|
+
_.target === se.current && ie();
|
|
1940
1945
|
},
|
|
1941
1946
|
[ie]
|
|
1942
|
-
), Ze =
|
|
1943
|
-
async (
|
|
1944
|
-
|
|
1947
|
+
), Ze = T(
|
|
1948
|
+
async (_) => {
|
|
1949
|
+
y && console.log("[MessagingShell] Leaving conversation:", _.id), H(null), j(!1), le.current = null, await te();
|
|
1945
1950
|
},
|
|
1946
|
-
[te,
|
|
1947
|
-
), Ye =
|
|
1948
|
-
async (
|
|
1949
|
-
|
|
1951
|
+
[te, y]
|
|
1952
|
+
), Ye = T(
|
|
1953
|
+
async (_) => {
|
|
1954
|
+
y && console.log("[MessagingShell] Blocking participant:", _), H(null), j(!1), le.current = null, await te();
|
|
1950
1955
|
},
|
|
1951
|
-
[te,
|
|
1952
|
-
), ce = !!
|
|
1953
|
-
return
|
|
1956
|
+
[te, y]
|
|
1957
|
+
), ce = !!B;
|
|
1958
|
+
return N ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(he, {}) }) : U ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(me, { message: U, onBack: I }) }) : !m || !d ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
|
|
1954
1959
|
me,
|
|
1955
1960
|
{
|
|
1956
1961
|
message: "Not connected to messaging service",
|
|
1957
|
-
onBack:
|
|
1962
|
+
onBack: I
|
|
1958
1963
|
}
|
|
1959
|
-
) }) :
|
|
1964
|
+
) }) : oe ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(me, { message: oe }) }) : /* @__PURE__ */ i(
|
|
1960
1965
|
"div",
|
|
1961
1966
|
{
|
|
1962
1967
|
className: D(
|
|
@@ -1971,21 +1976,21 @@ const Dt = ({
|
|
|
1971
1976
|
className: D(
|
|
1972
1977
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1973
1978
|
{
|
|
1974
|
-
"!hidden":
|
|
1979
|
+
"!hidden": g === !1 || P,
|
|
1975
1980
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
1976
|
-
"hidden lg:flex lg:flex-1 lg:max-w-2xl":
|
|
1981
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": g !== !1 && !P && ce,
|
|
1977
1982
|
// Show on mobile when no channel selected, use same wide width on desktop
|
|
1978
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl":
|
|
1983
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": g !== !1 && !P && !ce
|
|
1979
1984
|
}
|
|
1980
1985
|
),
|
|
1981
1986
|
children: /* @__PURE__ */ e(
|
|
1982
1987
|
Ue,
|
|
1983
1988
|
{
|
|
1984
1989
|
onChannelSelect: Ge,
|
|
1985
|
-
selectedChannel:
|
|
1990
|
+
selectedChannel: B || void 0,
|
|
1986
1991
|
filters: He,
|
|
1987
|
-
customEmptyStateIndicator:
|
|
1988
|
-
renderMessagePreview:
|
|
1992
|
+
customEmptyStateIndicator: b,
|
|
1993
|
+
renderMessagePreview: C
|
|
1989
1994
|
}
|
|
1990
1995
|
)
|
|
1991
1996
|
}
|
|
@@ -1997,33 +2002,33 @@ const Dt = ({
|
|
|
1997
2002
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1998
2003
|
{
|
|
1999
2004
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
2000
|
-
flex:
|
|
2005
|
+
flex: P || ce || c,
|
|
2001
2006
|
// Normal mode: hide on mobile when no channel selected
|
|
2002
|
-
"hidden lg:flex": !
|
|
2007
|
+
"hidden lg:flex": !P && !ce && !c
|
|
2003
2008
|
}
|
|
2004
2009
|
),
|
|
2005
|
-
children:
|
|
2010
|
+
children: B ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
2006
2011
|
Ae,
|
|
2007
2012
|
{
|
|
2008
|
-
channel:
|
|
2013
|
+
channel: B,
|
|
2009
2014
|
onBack: Ve,
|
|
2010
|
-
showBackButton: !
|
|
2015
|
+
showBackButton: !P,
|
|
2011
2016
|
renderMessageInputActions: n,
|
|
2012
|
-
renderChannelBanner:
|
|
2017
|
+
renderChannelBanner: p,
|
|
2013
2018
|
onLeaveConversation: Ze,
|
|
2014
2019
|
onBlockParticipant: Ye,
|
|
2015
2020
|
CustomChannelEmptyState: u,
|
|
2016
2021
|
showDeleteConversation: ze,
|
|
2017
|
-
onDeleteConversationClick:
|
|
2018
|
-
onBlockParticipantClick:
|
|
2019
|
-
onReportParticipantClick:
|
|
2020
|
-
dmAgentEnabled:
|
|
2021
|
-
messageMetadata:
|
|
2022
|
+
onDeleteConversationClick: f,
|
|
2023
|
+
onBlockParticipantClick: v,
|
|
2024
|
+
onReportParticipantClick: o,
|
|
2025
|
+
dmAgentEnabled: M,
|
|
2026
|
+
messageMetadata: S,
|
|
2022
2027
|
onMessageSent: w,
|
|
2023
|
-
showStarButton:
|
|
2024
|
-
chatbotVotingEnabled:
|
|
2028
|
+
showStarButton: E,
|
|
2029
|
+
chatbotVotingEnabled: h
|
|
2025
2030
|
},
|
|
2026
|
-
|
|
2031
|
+
B.id
|
|
2027
2032
|
) }) : c ? (
|
|
2028
2033
|
// Show loading while creating/loading direct conversation channel
|
|
2029
2034
|
/* @__PURE__ */ e(he, {})
|
|
@@ -2055,7 +2060,7 @@ const Dt = ({
|
|
|
2055
2060
|
participantLabel: ae,
|
|
2056
2061
|
searchPlaceholder: `Search ${ae}...`
|
|
2057
2062
|
},
|
|
2058
|
-
|
|
2063
|
+
L
|
|
2059
2064
|
) })
|
|
2060
2065
|
}
|
|
2061
2066
|
)
|
|
@@ -2089,12 +2094,12 @@ const Dt = ({
|
|
|
2089
2094
|
onFaqClick: s,
|
|
2090
2095
|
loadingFaqId: n,
|
|
2091
2096
|
headerText: a,
|
|
2092
|
-
className:
|
|
2097
|
+
className: l,
|
|
2093
2098
|
avatarImage: c,
|
|
2094
2099
|
avatarName: r
|
|
2095
2100
|
}) => {
|
|
2096
|
-
const u = t.filter((
|
|
2097
|
-
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className:
|
|
2101
|
+
const u = t.filter((g) => g.enabled).sort((g, x) => (g.order ?? 0) - (x.order ?? 0));
|
|
2102
|
+
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
2098
2103
|
(c || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
2099
2104
|
Q,
|
|
2100
2105
|
{
|
|
@@ -2112,58 +2117,58 @@ const Dt = ({
|
|
|
2112
2117
|
style: { backgroundColor: "#F1F0EE" },
|
|
2113
2118
|
children: [
|
|
2114
2119
|
a && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: a }),
|
|
2115
|
-
u.map((
|
|
2120
|
+
u.map((g) => /* @__PURE__ */ e(
|
|
2116
2121
|
pt,
|
|
2117
2122
|
{
|
|
2118
|
-
question:
|
|
2119
|
-
onClick: () => s(
|
|
2120
|
-
loading: n ===
|
|
2123
|
+
question: g.question,
|
|
2124
|
+
onClick: () => s(g.id),
|
|
2125
|
+
loading: n === g.id
|
|
2121
2126
|
},
|
|
2122
|
-
|
|
2127
|
+
g.id
|
|
2123
2128
|
))
|
|
2124
2129
|
]
|
|
2125
2130
|
}
|
|
2126
2131
|
)
|
|
2127
2132
|
] }) });
|
|
2128
2133
|
}, Ft = (t, s = {}) => {
|
|
2129
|
-
const { initialSearch: n = "", pageSize: a = 20 } = s, [
|
|
2134
|
+
const { initialSearch: n = "", pageSize: a = 20 } = s, [l, c] = k([]), [r, u] = k(!1), [g, x] = k(null), [b, f] = k(n), [v, o] = k(!0), [M, S] = k(), w = T(async (p = !1, R) => {
|
|
2130
2135
|
if (r) return;
|
|
2131
|
-
const d = R !== void 0 ? R :
|
|
2132
|
-
u(!0),
|
|
2136
|
+
const d = R !== void 0 ? R : b;
|
|
2137
|
+
u(!0), x(null);
|
|
2133
2138
|
try {
|
|
2134
2139
|
const m = await t.loadParticipants({
|
|
2135
2140
|
search: d || void 0,
|
|
2136
2141
|
limit: a,
|
|
2137
|
-
cursor:
|
|
2142
|
+
cursor: p ? void 0 : M
|
|
2138
2143
|
});
|
|
2139
2144
|
c(
|
|
2140
|
-
(
|
|
2141
|
-
),
|
|
2145
|
+
(N) => p ? m.participants : [...N, ...m.participants]
|
|
2146
|
+
), o(m.hasMore), S(m.nextCursor);
|
|
2142
2147
|
} catch (m) {
|
|
2143
|
-
const
|
|
2144
|
-
|
|
2148
|
+
const N = m instanceof Error ? m.message : "Failed to load participants";
|
|
2149
|
+
x(N), console.error("[useParticipants] Load error:", m);
|
|
2145
2150
|
} finally {
|
|
2146
2151
|
u(!1);
|
|
2147
2152
|
}
|
|
2148
|
-
}, [t,
|
|
2149
|
-
|
|
2150
|
-
}, [
|
|
2151
|
-
|
|
2152
|
-
}, [w]),
|
|
2153
|
-
|
|
2153
|
+
}, [t, b, M, a, r]), E = T(() => {
|
|
2154
|
+
v && !r && w(!1);
|
|
2155
|
+
}, [v, r, w]), h = T((p) => {
|
|
2156
|
+
f(p), S(void 0), w(!0, p);
|
|
2157
|
+
}, [w]), C = T(() => {
|
|
2158
|
+
S(void 0), w(!0);
|
|
2154
2159
|
}, [w]);
|
|
2155
2160
|
return q(() => {
|
|
2156
2161
|
w(!0);
|
|
2157
2162
|
}, [t.loadParticipants]), {
|
|
2158
|
-
participants:
|
|
2163
|
+
participants: l,
|
|
2159
2164
|
loading: r,
|
|
2160
|
-
error:
|
|
2161
|
-
searchQuery:
|
|
2162
|
-
hasMore:
|
|
2165
|
+
error: g,
|
|
2166
|
+
searchQuery: b,
|
|
2167
|
+
hasMore: v,
|
|
2163
2168
|
totalCount: t.totalCount,
|
|
2164
|
-
loadMore:
|
|
2165
|
-
search:
|
|
2166
|
-
refresh:
|
|
2169
|
+
loadMore: E,
|
|
2170
|
+
search: h,
|
|
2171
|
+
refresh: C
|
|
2167
2172
|
};
|
|
2168
2173
|
};
|
|
2169
2174
|
export {
|