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