@linktr.ee/messaging-react 1.13.1 → 1.14.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/assets/index.css +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +919 -717
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +34 -23
- package/src/components/CustomMessage/CustomMessage.stories.tsx +208 -0
- package/src/components/CustomMessage/MessageTag.stories.tsx +119 -0
- package/src/components/CustomMessage/MessageTag.tsx +84 -0
- package/src/components/CustomMessage/index.tsx +262 -0
- package/src/components/CustomSystemMessage/index.tsx +1 -0
- package/src/stream-custom-data.ts +11 -0
- package/src/styles.css +45 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { XIcon as
|
|
7
|
-
import { LinkPreviewsManager as
|
|
8
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as Ne } from "react/jsx-runtime";
|
|
2
|
+
import S from "classnames";
|
|
3
|
+
import P, { createContext as $e, useContext as je, useCallback as T, useState as p, useRef as W, useEffect as q, useMemo as we } from "react";
|
|
4
|
+
import { StreamChatService as ze } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as Ge, ChannelList as He, DateSeparator as Ve, areMessageUIPropsEqual as We, useChatContext as Ze, useTranslationContext as qe, useMessageReminder as Ye, useComponentContext as Je, Attachment as Qe, Avatar as Xe, EditMessageModal as Ke, MessageBlocked as es, MessageBouncePrompt as ss, MessageDeleted as ts, MessageIsThreadReplyInChannelButtonIndicator as ns, MessageRepliesCountButton as rs, MessageStatus as as, MessageTimestamp as ke, ReminderNotification as ls, StreamedMessageText as os, messageHasAttachments as is, messageHasReactions as cs, isDateSeparatorMessage as ds, isMessageBlocked as ms, isMessageBounced as us, isMessageEdited as hs, MessageBounceModal as fs, Poll as gs, MessageText as xs, MessageErrorIcon as Cs, MessageEditedTimestamp as Ns, useMessageContext as bs, useMessageComposer as vs, useStateStore as ws, MessageInput as ys, useMessageInputContext as ps, useMessageComposerHasSendableData as Es, SimpleAttachmentSelector as Is, QuotedMessagePreview as _s, AttachmentPreviewList as Ss, TextareaComposer as Ms, Channel as ks, useChannelStateContext as Re, WithComponents as Rs, Window as Ts, MessageList as Ds } from "stream-chat-react";
|
|
6
|
+
import { XIcon as be, GiftIcon as Fs, ArrowUpIcon as Ls, ArrowLeftIcon as ye, DotsThreeIcon as pe, SpinnerGapIcon as de, SignOutIcon as Ps, ProhibitInsetIcon as Ee, FlagIcon as Os, MagnifyingGlassIcon as Us, ChatCircleDotsIcon as Ie } from "@phosphor-icons/react";
|
|
7
|
+
import { LinkPreviewsManager as _e } from "stream-chat";
|
|
8
|
+
const Te = $e({
|
|
9
9
|
service: null,
|
|
10
10
|
client: null,
|
|
11
11
|
isConnected: !1,
|
|
@@ -15,50 +15,50 @@ const ye = Pe({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}),
|
|
18
|
+
}), he = () => je(Te), vt = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
22
|
apiKey: r,
|
|
23
|
-
capabilities:
|
|
24
|
-
debug:
|
|
23
|
+
capabilities: o = {},
|
|
24
|
+
debug: c = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const
|
|
27
|
-
(
|
|
28
|
-
|
|
26
|
+
const a = T(
|
|
27
|
+
(h, ...v) => {
|
|
28
|
+
c && console.log(`🔥 [MessagingProvider] ${h}`, ...v);
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[c]
|
|
31
31
|
);
|
|
32
|
-
|
|
32
|
+
a("🔄 RENDER START", {
|
|
33
33
|
userId: s == null ? void 0 : s.id,
|
|
34
34
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
35
35
|
serviceConfig: !!n,
|
|
36
|
-
capabilities: Object.keys(
|
|
36
|
+
capabilities: Object.keys(o)
|
|
37
37
|
});
|
|
38
|
-
const [
|
|
38
|
+
const [u, g] = p(null), [x, w] = p(null), [f, l] = p(!1), [R, y] = p(!1), [d, N] = p(null), E = W(!1), I = W({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: r,
|
|
41
41
|
serviceConfig: n,
|
|
42
|
-
capabilities:
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
renderCount:
|
|
42
|
+
capabilities: o
|
|
43
|
+
}), _ = W(0);
|
|
44
|
+
_.current++, a("📊 RENDER INFO", {
|
|
45
|
+
renderCount: _.current,
|
|
46
46
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
48
|
userChanged: I.current.userId !== (s == null ? void 0 : s.id),
|
|
49
49
|
apiKeyChanged: I.current.apiKey !== r,
|
|
50
50
|
serviceConfigChanged: I.current.serviceConfig !== n,
|
|
51
|
-
capabilitiesChanged: I.current.capabilities !==
|
|
51
|
+
capabilitiesChanged: I.current.capabilities !== o
|
|
52
52
|
}
|
|
53
53
|
}), I.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
55
|
apiKey: r,
|
|
56
56
|
serviceConfig: n,
|
|
57
|
-
capabilities:
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
renderCount:
|
|
57
|
+
capabilities: o
|
|
58
|
+
}, q(() => {
|
|
59
|
+
const h = _.current;
|
|
60
|
+
if (a("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
61
|
+
renderCount: h,
|
|
62
62
|
apiKey: !!r,
|
|
63
63
|
serviceConfig: !!n,
|
|
64
64
|
dependencies: {
|
|
@@ -68,166 +68,166 @@ const ye = Pe({
|
|
|
68
68
|
apiKeyStable: I.current.apiKey === r
|
|
69
69
|
}
|
|
70
70
|
}), !r || !n) {
|
|
71
|
-
|
|
72
|
-
renderCount:
|
|
71
|
+
a("⚠️ SERVICE INIT SKIPPED", {
|
|
72
|
+
renderCount: h,
|
|
73
73
|
reason: "Missing apiKey or serviceConfig"
|
|
74
74
|
});
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
renderCount:
|
|
77
|
+
a("🚀 CREATING NEW SERVICE", {
|
|
78
|
+
renderCount: h,
|
|
79
79
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
80
80
|
serviceConfigChanged: I.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const v = new ze({
|
|
83
83
|
...n,
|
|
84
84
|
apiKey: r,
|
|
85
|
-
debug:
|
|
85
|
+
debug: c
|
|
86
86
|
});
|
|
87
|
-
return
|
|
88
|
-
renderCount:
|
|
89
|
-
serviceInstance: !!
|
|
87
|
+
return g(v), a("✅ SERVICE SET", {
|
|
88
|
+
renderCount: h,
|
|
89
|
+
serviceInstance: !!v
|
|
90
90
|
}), () => {
|
|
91
|
-
|
|
92
|
-
renderCount:
|
|
91
|
+
a("🧹 SERVICE CLEANUP", {
|
|
92
|
+
renderCount: h,
|
|
93
93
|
reason: "Effect cleanup"
|
|
94
|
-
}),
|
|
94
|
+
}), v.disconnectUser().catch(console.error);
|
|
95
95
|
};
|
|
96
|
-
}, [r, n,
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
if (
|
|
101
|
-
hasService: !!
|
|
96
|
+
}, [r, n, c, a]);
|
|
97
|
+
const C = W(null);
|
|
98
|
+
q(() => {
|
|
99
|
+
var v, G;
|
|
100
|
+
if (a("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
+
hasService: !!u,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
104
|
isConnecting: E.current,
|
|
105
105
|
isConnected: f,
|
|
106
|
-
dependencies: { service: !!
|
|
107
|
-
}), !
|
|
108
|
-
|
|
106
|
+
dependencies: { service: !!u, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !u || !s) {
|
|
108
|
+
a("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
if (E.current) {
|
|
112
|
-
|
|
112
|
+
a("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((
|
|
116
|
-
|
|
115
|
+
if (((v = C.current) == null ? void 0 : v.serviceId) === u && ((G = C.current) == null ? void 0 : G.userId) === s.id) {
|
|
116
|
+
a(
|
|
117
117
|
"⚠️ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
119
119
|
);
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
(async () => {
|
|
123
|
-
|
|
123
|
+
a("🚀 STARTING USER CONNECTION", { userId: s.id }), E.current = !0, y(!0), N(null);
|
|
124
124
|
try {
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
w(
|
|
125
|
+
a("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
+
const A = await u.connectUser(s);
|
|
127
|
+
w(A), l(!0), C.current = { serviceId: u, userId: s.id }, a("✅ USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
|
-
clientId:
|
|
129
|
+
clientId: A.userID
|
|
130
130
|
});
|
|
131
|
-
} catch (
|
|
132
|
-
const
|
|
133
|
-
N(
|
|
131
|
+
} catch (A) {
|
|
132
|
+
const Z = A instanceof Error ? A.message : "Connection failed";
|
|
133
|
+
N(Z), a("❌ USER CONNECTION ERROR", {
|
|
134
134
|
userId: s.id,
|
|
135
|
-
error:
|
|
135
|
+
error: Z
|
|
136
136
|
});
|
|
137
137
|
} finally {
|
|
138
|
-
|
|
138
|
+
y(!1), E.current = !1, a("🔄 USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
isConnected: f
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [
|
|
145
|
-
hasService: !!
|
|
144
|
+
}, [u, s, a, f]), q(() => (a("🔌 CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!u,
|
|
146
146
|
isConnected: f
|
|
147
147
|
}), () => {
|
|
148
|
-
|
|
148
|
+
u && f ? (a(
|
|
149
149
|
"🧹 CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
|
-
),
|
|
152
|
-
hasService: !!
|
|
151
|
+
), C.current = null, u.disconnectUser().catch(console.error)) : a("🔇 CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!u,
|
|
153
153
|
isConnected: f
|
|
154
154
|
});
|
|
155
|
-
}), [
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
hasService: !!
|
|
155
|
+
}), [u, f, a]);
|
|
156
|
+
const M = T(async () => {
|
|
157
|
+
if (a("🔄 REFRESH CONNECTION CALLED", {
|
|
158
|
+
hasService: !!u,
|
|
159
159
|
hasUser: !!s
|
|
160
|
-
}), !
|
|
161
|
-
|
|
160
|
+
}), !u || !s) {
|
|
161
|
+
a("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
a("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), y(!0);
|
|
165
165
|
try {
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
w(
|
|
169
|
-
} catch (
|
|
170
|
-
const
|
|
171
|
-
N(
|
|
166
|
+
a("🔌 DISCONNECTING FOR REFRESH"), await u.disconnectUser(), a("📞 RECONNECTING FOR REFRESH");
|
|
167
|
+
const h = await u.connectUser(s);
|
|
168
|
+
w(h), l(!0), N(null), a("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
|
+
} catch (h) {
|
|
170
|
+
const v = h instanceof Error ? h.message : "Refresh failed";
|
|
171
|
+
N(v), a("❌ CONNECTION REFRESH ERROR", {
|
|
172
172
|
userId: s.id,
|
|
173
|
-
error:
|
|
173
|
+
error: v
|
|
174
174
|
});
|
|
175
175
|
} finally {
|
|
176
|
-
|
|
176
|
+
y(!1), a("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [
|
|
179
|
-
hasService: !!
|
|
180
|
-
hasClient: !!
|
|
178
|
+
}, [u, s, a]), m = P.useMemo(() => (a("💫 CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!u,
|
|
180
|
+
hasClient: !!x,
|
|
181
181
|
isConnected: f,
|
|
182
|
-
isLoading:
|
|
183
|
-
hasError: !!
|
|
184
|
-
capabilitiesKeys: Object.keys(
|
|
182
|
+
isLoading: R,
|
|
183
|
+
hasError: !!d,
|
|
184
|
+
capabilitiesKeys: Object.keys(o)
|
|
185
185
|
}), {
|
|
186
|
-
service:
|
|
187
|
-
client:
|
|
186
|
+
service: u,
|
|
187
|
+
client: x,
|
|
188
188
|
isConnected: f,
|
|
189
|
-
isLoading:
|
|
190
|
-
error:
|
|
191
|
-
capabilities:
|
|
192
|
-
refreshConnection:
|
|
193
|
-
debug:
|
|
189
|
+
isLoading: R,
|
|
190
|
+
error: d,
|
|
191
|
+
capabilities: o,
|
|
192
|
+
refreshConnection: M,
|
|
193
|
+
debug: c
|
|
194
194
|
}), [
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
u,
|
|
196
|
+
x,
|
|
197
197
|
f,
|
|
198
|
-
_,
|
|
199
|
-
c,
|
|
200
|
-
a,
|
|
201
198
|
R,
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
d,
|
|
200
|
+
o,
|
|
201
|
+
M,
|
|
202
|
+
c,
|
|
203
|
+
a
|
|
204
204
|
]);
|
|
205
|
-
return
|
|
206
|
-
renderCount:
|
|
207
|
-
willRenderChat: !!(
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(
|
|
210
|
-
|
|
205
|
+
return a("🔄 RENDER END", {
|
|
206
|
+
renderCount: _.current,
|
|
207
|
+
willRenderChat: !!(x && f),
|
|
208
|
+
contextValueReady: !!m
|
|
209
|
+
}), /* @__PURE__ */ e(Te.Provider, { value: m, children: x && f ? /* @__PURE__ */ e(
|
|
210
|
+
Ge,
|
|
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
|
},
|
|
216
216
|
children: t
|
|
217
217
|
}
|
|
218
218
|
) : t });
|
|
219
|
-
},
|
|
219
|
+
}, Bs = () => he(), As = (t, s) => {
|
|
220
220
|
const n = new Date(
|
|
221
221
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
222
|
-
),
|
|
222
|
+
), o = new Date(
|
|
223
223
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
224
224
|
).getTime() - n.getTime();
|
|
225
|
-
return Math.floor(
|
|
226
|
-
},
|
|
225
|
+
return Math.floor(o / (1e3 * 60 * 60 * 24));
|
|
226
|
+
}, $s = (t) => {
|
|
227
227
|
const s = /* @__PURE__ */ new Date();
|
|
228
228
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
229
229
|
return "Just now";
|
|
230
|
-
const r =
|
|
230
|
+
const r = As(t, s);
|
|
231
231
|
return r === 0 ? t.toLocaleTimeString([], {
|
|
232
232
|
hour: "numeric",
|
|
233
233
|
minute: "2-digit",
|
|
@@ -237,7 +237,7 @@ const ye = Pe({
|
|
|
237
237
|
day: "numeric",
|
|
238
238
|
year: "2-digit"
|
|
239
239
|
});
|
|
240
|
-
},
|
|
240
|
+
}, Se = [
|
|
241
241
|
"🍎",
|
|
242
242
|
// Apple
|
|
243
243
|
"🍌",
|
|
@@ -265,7 +265,7 @@ const ye = Pe({
|
|
|
265
265
|
"🍈"
|
|
266
266
|
// Melon
|
|
267
267
|
];
|
|
268
|
-
function
|
|
268
|
+
function js(t) {
|
|
269
269
|
let s = 0;
|
|
270
270
|
for (let n = 0; n < t.length; n++) {
|
|
271
271
|
const r = t.charCodeAt(n);
|
|
@@ -273,29 +273,29 @@ function is(t) {
|
|
|
273
273
|
}
|
|
274
274
|
return Math.abs(s);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const n =
|
|
278
|
-
return
|
|
276
|
+
function zs(t) {
|
|
277
|
+
const n = js(t) % Se.length;
|
|
278
|
+
return Se[n];
|
|
279
279
|
}
|
|
280
|
-
const
|
|
280
|
+
const te = ({
|
|
281
281
|
id: t,
|
|
282
282
|
image: s,
|
|
283
283
|
size: n = 40,
|
|
284
284
|
className: r,
|
|
285
|
-
shape:
|
|
285
|
+
shape: o = "squircle"
|
|
286
286
|
}) => {
|
|
287
|
-
const
|
|
287
|
+
const c = zs(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", g = o === "circle" ? { borderRadius: "50%" } : {
|
|
288
288
|
borderRadius: "33%",
|
|
289
289
|
"corner-shape": "superellipse(1.3)"
|
|
290
290
|
};
|
|
291
291
|
return /* @__PURE__ */ e(
|
|
292
292
|
"div",
|
|
293
293
|
{
|
|
294
|
-
className:
|
|
294
|
+
className: S("flex-shrink-0 overflow-hidden", r),
|
|
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",
|
|
@@ -308,77 +308,77 @@ const q = ({
|
|
|
308
308
|
"div",
|
|
309
309
|
{
|
|
310
310
|
"aria-hidden": "true",
|
|
311
|
-
className:
|
|
311
|
+
className: S(
|
|
312
312
|
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
313
|
-
|
|
313
|
+
u
|
|
314
314
|
),
|
|
315
|
-
children:
|
|
315
|
+
children: c
|
|
316
316
|
}
|
|
317
317
|
)
|
|
318
318
|
}
|
|
319
319
|
);
|
|
320
|
-
},
|
|
321
|
-
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread:
|
|
322
|
-
var N, E, I,
|
|
323
|
-
const
|
|
320
|
+
}, De = P.memo(
|
|
321
|
+
({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: o }) => {
|
|
322
|
+
var N, E, I, _, C, M;
|
|
323
|
+
const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), a = () => {
|
|
324
324
|
t && n(t);
|
|
325
|
-
},
|
|
326
|
-
(
|
|
327
|
-
var
|
|
328
|
-
return ((
|
|
325
|
+
}, g = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
|
|
326
|
+
(m) => {
|
|
327
|
+
var h, v;
|
|
328
|
+
return ((h = m.user) == null ? void 0 : h.id) && m.user.id !== ((v = t == null ? void 0 : t._client) == null ? void 0 : v.userID);
|
|
329
329
|
}
|
|
330
|
-
),
|
|
331
|
-
var
|
|
330
|
+
), x = ((E = g == null ? void 0 : g.user) == null ? void 0 : E.name) || "Conversation", w = (I = g == null ? void 0 : g.user) == null ? void 0 : I.image, f = (C = (_ = t == null ? void 0 : t.state) == null ? void 0 : _.messages) == null ? void 0 : C[t.state.messages.length - 1], R = (() => {
|
|
331
|
+
var h;
|
|
332
332
|
if (f != null && f.text) return f.text;
|
|
333
|
-
const
|
|
334
|
-
return
|
|
335
|
-
})(),
|
|
333
|
+
const m = (h = f == null ? void 0 : f.attachments) == null ? void 0 : h[0];
|
|
334
|
+
return m ? m.og_scrape_url ? m.og_scrape_url : m.type === "image" ? "📷 Sent an image" : m.type === "video" ? "🎥 Sent a video" : m.type === "audio" ? "🎵 Sent audio" : m.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
|
|
335
|
+
})(), y = f != null && f.created_at ? $s(new Date(f.created_at)) : "", d = o ?? 0;
|
|
336
336
|
return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
337
337
|
channelId: t == null ? void 0 : t.id,
|
|
338
|
-
isSelected:
|
|
339
|
-
participantName:
|
|
340
|
-
unreadCount:
|
|
341
|
-
hasTimestamp: !!
|
|
338
|
+
isSelected: c,
|
|
339
|
+
participantName: x,
|
|
340
|
+
unreadCount: d,
|
|
341
|
+
hasTimestamp: !!y
|
|
342
342
|
}), /* @__PURE__ */ e(
|
|
343
343
|
"button",
|
|
344
344
|
{
|
|
345
345
|
type: "button",
|
|
346
|
-
onClick:
|
|
347
|
-
className:
|
|
346
|
+
onClick: a,
|
|
347
|
+
className: S(
|
|
348
348
|
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
349
349
|
{
|
|
350
|
-
"bg-primary-alt/10 border-l-4 border-l-primary":
|
|
351
|
-
"hover:bg-sand": !
|
|
350
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": c,
|
|
351
|
+
"hover:bg-sand": !c
|
|
352
352
|
}
|
|
353
353
|
),
|
|
354
|
-
children: /* @__PURE__ */
|
|
354
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
355
355
|
/* @__PURE__ */ e(
|
|
356
|
-
|
|
356
|
+
te,
|
|
357
357
|
{
|
|
358
|
-
id: ((
|
|
359
|
-
name:
|
|
358
|
+
id: ((M = g == null ? void 0 : g.user) == null ? void 0 : M.id) || t.id || "unknown",
|
|
359
|
+
name: x,
|
|
360
360
|
image: w,
|
|
361
361
|
size: 44,
|
|
362
362
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
363
363
|
}
|
|
364
364
|
),
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
366
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2", children: [
|
|
367
367
|
/* @__PURE__ */ e(
|
|
368
368
|
"h3",
|
|
369
369
|
{
|
|
370
|
-
className:
|
|
370
|
+
className: S(
|
|
371
371
|
"text-sm font-medium truncate",
|
|
372
|
-
|
|
372
|
+
c ? "text-primary" : "text-charcoal"
|
|
373
373
|
),
|
|
374
|
-
children:
|
|
374
|
+
children: x
|
|
375
375
|
}
|
|
376
376
|
),
|
|
377
|
-
|
|
377
|
+
y && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: y })
|
|
378
378
|
] }),
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children:
|
|
381
|
-
|
|
379
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
380
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: R }),
|
|
381
|
+
d > 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: d > 99 ? "99+" : d })
|
|
382
382
|
] })
|
|
383
383
|
] })
|
|
384
384
|
] })
|
|
@@ -386,47 +386,47 @@ const q = ({
|
|
|
386
386
|
);
|
|
387
387
|
}
|
|
388
388
|
);
|
|
389
|
-
|
|
390
|
-
const
|
|
389
|
+
De.displayName = "CustomChannelPreview";
|
|
390
|
+
const Fe = P.memo(
|
|
391
391
|
({
|
|
392
392
|
onChannelSelect: t,
|
|
393
393
|
selectedChannel: s,
|
|
394
394
|
filters: n,
|
|
395
395
|
className: r,
|
|
396
|
-
customEmptyStateIndicator:
|
|
396
|
+
customEmptyStateIndicator: o
|
|
397
397
|
}) => {
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
const { debug:
|
|
401
|
-
|
|
402
|
-
renderCount:
|
|
398
|
+
const c = P.useRef(0);
|
|
399
|
+
c.current++;
|
|
400
|
+
const { debug: a = !1 } = he();
|
|
401
|
+
a && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
402
|
+
renderCount: c.current,
|
|
403
403
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
404
404
|
filters: n
|
|
405
405
|
});
|
|
406
|
-
const
|
|
407
|
-
|
|
406
|
+
const u = P.useMemo(() => (x) => /* @__PURE__ */ e(
|
|
407
|
+
De,
|
|
408
408
|
{
|
|
409
|
-
...
|
|
409
|
+
...x,
|
|
410
410
|
selectedChannel: s,
|
|
411
411
|
onChannelSelect: t,
|
|
412
|
-
debug:
|
|
412
|
+
debug: a
|
|
413
413
|
}
|
|
414
|
-
), [s, t,
|
|
414
|
+
), [s, t, a]);
|
|
415
415
|
return /* @__PURE__ */ e(
|
|
416
416
|
"div",
|
|
417
417
|
{
|
|
418
|
-
className:
|
|
418
|
+
className: S(
|
|
419
419
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
420
420
|
r
|
|
421
421
|
),
|
|
422
422
|
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
|
|
423
|
-
|
|
423
|
+
He,
|
|
424
424
|
{
|
|
425
425
|
filters: n,
|
|
426
426
|
sort: { last_message_at: -1 },
|
|
427
427
|
options: { limit: 30 },
|
|
428
|
-
Preview:
|
|
429
|
-
EmptyStateIndicator:
|
|
428
|
+
Preview: u,
|
|
429
|
+
EmptyStateIndicator: o
|
|
430
430
|
},
|
|
431
431
|
JSON.stringify(n)
|
|
432
432
|
) })
|
|
@@ -434,8 +434,8 @@ const Ie = U.memo(
|
|
|
434
434
|
);
|
|
435
435
|
}
|
|
436
436
|
);
|
|
437
|
-
|
|
438
|
-
const
|
|
437
|
+
Fe.displayName = "ChannelList";
|
|
438
|
+
const ce = ({
|
|
439
439
|
variant: t = "default",
|
|
440
440
|
className: s,
|
|
441
441
|
children: n,
|
|
@@ -444,7 +444,7 @@ const ne = ({
|
|
|
444
444
|
"button",
|
|
445
445
|
{
|
|
446
446
|
type: "button",
|
|
447
|
-
className:
|
|
447
|
+
className: S(
|
|
448
448
|
"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
|
|
449
449
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
450
450
|
s
|
|
@@ -453,12 +453,12 @@ const ne = ({
|
|
|
453
453
|
children: n
|
|
454
454
|
}
|
|
455
455
|
);
|
|
456
|
-
function
|
|
457
|
-
return /* @__PURE__ */
|
|
456
|
+
function Le({ label: t, className: s, children: n, ...r }) {
|
|
457
|
+
return /* @__PURE__ */ i(
|
|
458
458
|
"button",
|
|
459
459
|
{
|
|
460
460
|
type: "button",
|
|
461
|
-
className:
|
|
461
|
+
className: S(
|
|
462
462
|
"rounded-full p-2 transition-colors focus-ring",
|
|
463
463
|
{
|
|
464
464
|
"cursor-not-allowed opacity-50": r.disabled,
|
|
@@ -474,19 +474,213 @@ function Se({ label: t, className: s, children: n, ...r }) {
|
|
|
474
474
|
}
|
|
475
475
|
);
|
|
476
476
|
}
|
|
477
|
-
function
|
|
478
|
-
return /* @__PURE__ */ e(
|
|
477
|
+
function Pe({ onClick: t }) {
|
|
478
|
+
return /* @__PURE__ */ e(Le, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(be, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
479
479
|
}
|
|
480
|
-
const
|
|
480
|
+
const Gs = (t) => /* @__PURE__ */ e(Ve, { ...t, position: "center" }), Hs = () => /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 10 10", fill: "none", children: /* @__PURE__ */ e(
|
|
481
|
+
"path",
|
|
482
|
+
{
|
|
483
|
+
d: "M10.003 5a.705.705 0 0 1-.469.67L6.7 6.7 5.67 9.535a.715.715 0 0 1-1.34 0L3.3 6.7.466 5.67a.715.715 0 0 1 0-1.34L3.3 3.3 4.33.466a.715.715 0 0 1 1.34 0L6.7 3.3l2.834 1.03a.705.705 0 0 1 .469.67",
|
|
484
|
+
fill: "currentColor"
|
|
485
|
+
}
|
|
486
|
+
) }), Vs = (t) => {
|
|
487
|
+
var s;
|
|
488
|
+
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
|
|
489
|
+
}, Ws = (t) => {
|
|
490
|
+
var s;
|
|
491
|
+
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
|
|
492
|
+
}, Zs = (t) => {
|
|
493
|
+
var s;
|
|
494
|
+
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
|
|
495
|
+
}, Oe = (t) => Vs(t) || Ws(t), qs = (t) => {
|
|
496
|
+
var s;
|
|
497
|
+
return Oe(t) && !((s = t.text) != null && s.trim());
|
|
498
|
+
}, Me = ({
|
|
499
|
+
message: t,
|
|
500
|
+
standalone: s = !1
|
|
501
|
+
}) => {
|
|
502
|
+
var o;
|
|
503
|
+
const n = Oe(t), r = Zs(t);
|
|
504
|
+
if (!n && !r)
|
|
505
|
+
return null;
|
|
506
|
+
if (n) {
|
|
507
|
+
const c = (o = t.metadata) == null ? void 0 : o.amount_text;
|
|
508
|
+
if (!c) return null;
|
|
509
|
+
const a = s ? "message-tip-standalone" : "message-tag message-tag--tip", u = s ? `${c} tip` : `Delivered with ${c} tip`;
|
|
510
|
+
return /* @__PURE__ */ i("div", { className: a, children: [
|
|
511
|
+
/* @__PURE__ */ e(Fs, { size: s ? 14 : 12 }),
|
|
512
|
+
/* @__PURE__ */ e("span", { children: u })
|
|
513
|
+
] });
|
|
514
|
+
}
|
|
515
|
+
return /* @__PURE__ */ i("div", { className: "message-tag message-tag--chatbot", children: [
|
|
516
|
+
/* @__PURE__ */ e("span", { className: "message-tag__icon", style: { marginTop: -1 }, children: /* @__PURE__ */ e(Hs, {}) }),
|
|
517
|
+
/* @__PURE__ */ e("span", { className: "message-tag__label", children: "Chatbot" })
|
|
518
|
+
] });
|
|
519
|
+
}, Ys = (t) => {
|
|
520
|
+
var X, b;
|
|
521
|
+
const {
|
|
522
|
+
additionalMessageInputProps: s,
|
|
523
|
+
editing: n,
|
|
524
|
+
endOfGroup: r,
|
|
525
|
+
firstOfGroup: o,
|
|
526
|
+
groupedByUser: c,
|
|
527
|
+
handleAction: a,
|
|
528
|
+
handleOpenThread: u,
|
|
529
|
+
handleRetry: g,
|
|
530
|
+
highlighted: x,
|
|
531
|
+
isMessageAIGenerated: w,
|
|
532
|
+
isMyMessage: f,
|
|
533
|
+
message: l,
|
|
534
|
+
onUserClick: R,
|
|
535
|
+
onUserHover: y,
|
|
536
|
+
renderText: d,
|
|
537
|
+
threadList: N
|
|
538
|
+
} = t, { client: E } = Ze("CustomMessage"), { t: I } = qe("CustomMessage"), [_, C] = p(!1), [M, m] = p(!1), h = Ye(l.id), {
|
|
539
|
+
Attachment: v = Qe,
|
|
540
|
+
Avatar: G = Xe,
|
|
541
|
+
EditMessageModal: A = Ke,
|
|
542
|
+
MessageBlocked: Z = es,
|
|
543
|
+
MessageBouncePrompt: Y = ss,
|
|
544
|
+
MessageDeleted: ne = ts,
|
|
545
|
+
MessageIsThreadReplyInChannelButtonIndicator: K = ns,
|
|
546
|
+
MessageRepliesCountButton: ee = rs,
|
|
547
|
+
MessageStatus: re = as,
|
|
548
|
+
MessageTimestamp: O = ke,
|
|
549
|
+
ReminderNotification: H = ls,
|
|
550
|
+
StreamedMessageText: J = os,
|
|
551
|
+
PinIndicator: z
|
|
552
|
+
} = Je("CustomMessage"), k = is(l), D = cs(l), U = we(
|
|
553
|
+
() => w == null ? void 0 : w(l),
|
|
554
|
+
[w, l]
|
|
555
|
+
), $ = we(
|
|
556
|
+
() => !l.shared_location && !l.attachments ? [] : l.shared_location ? [l.shared_location, ...l.attachments ?? []] : l.attachments,
|
|
557
|
+
[l]
|
|
558
|
+
);
|
|
559
|
+
if (ds(l))
|
|
560
|
+
return null;
|
|
561
|
+
if (l.deleted_at || l.type === "deleted")
|
|
562
|
+
return /* @__PURE__ */ e(ne, { message: l });
|
|
563
|
+
if (ms(l))
|
|
564
|
+
return /* @__PURE__ */ e(Z, {});
|
|
565
|
+
const se = !c || r, Q = !N && !!l.reply_count, V = !N && l.show_in_channel && l.parent_id, le = l.status === "failed" && ((X = l.error) == null ? void 0 : X.status) !== 403, oe = us(l), ae = hs(l) && !U;
|
|
566
|
+
let j;
|
|
567
|
+
le ? j = () => g(l) : oe ? j = () => C(!0) : ae && (j = () => m((L) => !L));
|
|
568
|
+
const fe = S(
|
|
569
|
+
"str-chat__message str-chat__message-simple",
|
|
570
|
+
`str-chat__message--${l.type}`,
|
|
571
|
+
`str-chat__message--${l.status}`,
|
|
572
|
+
f() ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
573
|
+
l.text ? "str-chat__message--has-text" : "has-no-text",
|
|
574
|
+
{
|
|
575
|
+
"str-chat__message--has-attachment": k,
|
|
576
|
+
"str-chat__message--highlighted": x,
|
|
577
|
+
"str-chat__message--pinned pinned-message": l.pinned,
|
|
578
|
+
"str-chat__message--with-reactions": D,
|
|
579
|
+
"str-chat__message-send-can-be-retried": (l == null ? void 0 : l.status) === "failed" && ((b = l == null ? void 0 : l.error) == null ? void 0 : b.status) !== 403,
|
|
580
|
+
"str-chat__message-with-thread-link": Q || V,
|
|
581
|
+
"str-chat__virtual-message__wrapper--end": r,
|
|
582
|
+
"str-chat__virtual-message__wrapper--first": o,
|
|
583
|
+
"str-chat__virtual-message__wrapper--group": c
|
|
584
|
+
}
|
|
585
|
+
), ie = l.poll_id && E.polls.fromState(l.poll_id), ge = qs(l);
|
|
586
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
587
|
+
n && /* @__PURE__ */ e(
|
|
588
|
+
A,
|
|
589
|
+
{
|
|
590
|
+
additionalMessageInputProps: s
|
|
591
|
+
}
|
|
592
|
+
),
|
|
593
|
+
_ && /* @__PURE__ */ e(
|
|
594
|
+
fs,
|
|
595
|
+
{
|
|
596
|
+
MessageBouncePrompt: Y,
|
|
597
|
+
onClose: () => C(!1),
|
|
598
|
+
open: _
|
|
599
|
+
}
|
|
600
|
+
),
|
|
601
|
+
/* @__PURE__ */ i("div", { className: fe, children: [
|
|
602
|
+
z && /* @__PURE__ */ e(z, {}),
|
|
603
|
+
!!h && /* @__PURE__ */ e(H, { reminder: h }),
|
|
604
|
+
l.user && /* @__PURE__ */ e(
|
|
605
|
+
G,
|
|
606
|
+
{
|
|
607
|
+
image: l.user.image,
|
|
608
|
+
name: l.user.name || l.user.id,
|
|
609
|
+
onClick: R,
|
|
610
|
+
onMouseOver: y,
|
|
611
|
+
user: l.user
|
|
612
|
+
}
|
|
613
|
+
),
|
|
614
|
+
/* @__PURE__ */ e(
|
|
615
|
+
"div",
|
|
616
|
+
{
|
|
617
|
+
className: S("str-chat__message-inner", {
|
|
618
|
+
"str-chat__simple-message--error-failed": le || oe
|
|
619
|
+
}),
|
|
620
|
+
"data-testid": "message-inner",
|
|
621
|
+
onClick: j,
|
|
622
|
+
onKeyDown: j,
|
|
623
|
+
role: j ? "button" : void 0,
|
|
624
|
+
tabIndex: j ? 0 : void 0,
|
|
625
|
+
children: ge ? (
|
|
626
|
+
/* Tip-only messages render as a standalone bubble */
|
|
627
|
+
/* @__PURE__ */ e(Me, { message: l, standalone: !0 })
|
|
628
|
+
) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
629
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
630
|
+
ie && /* @__PURE__ */ e(gs, { poll: ie }),
|
|
631
|
+
$ != null && $.length && !l.quoted_message ? /* @__PURE__ */ e(
|
|
632
|
+
v,
|
|
633
|
+
{
|
|
634
|
+
actionHandler: a,
|
|
635
|
+
attachments: $
|
|
636
|
+
}
|
|
637
|
+
) : null,
|
|
638
|
+
U ? /* @__PURE__ */ e(
|
|
639
|
+
J,
|
|
640
|
+
{
|
|
641
|
+
message: l,
|
|
642
|
+
renderText: d
|
|
643
|
+
}
|
|
644
|
+
) : /* @__PURE__ */ e(xs, { message: l, renderText: d }),
|
|
645
|
+
/* @__PURE__ */ e(Cs, {})
|
|
646
|
+
] }),
|
|
647
|
+
/* @__PURE__ */ e(Me, { message: l })
|
|
648
|
+
] })
|
|
649
|
+
}
|
|
650
|
+
),
|
|
651
|
+
Q && /* @__PURE__ */ e(
|
|
652
|
+
ee,
|
|
653
|
+
{
|
|
654
|
+
onClick: u,
|
|
655
|
+
reply_count: l.reply_count
|
|
656
|
+
}
|
|
657
|
+
),
|
|
658
|
+
V && /* @__PURE__ */ e(K, {}),
|
|
659
|
+
se && /* @__PURE__ */ i("div", { className: "str-chat__message-metadata", children: [
|
|
660
|
+
/* @__PURE__ */ e(re, {}),
|
|
661
|
+
!f() && !!l.user && /* @__PURE__ */ e("span", { className: "str-chat__message-simple-name", children: l.user.name || l.user.id }),
|
|
662
|
+
/* @__PURE__ */ e(O, { customClass: "str-chat__message-simple-timestamp" }),
|
|
663
|
+
ae && /* @__PURE__ */ e("span", { className: "str-chat__mesage-simple-edited", children: I("Edited") }),
|
|
664
|
+
ae && /* @__PURE__ */ e(Ns, { calendar: !0, open: M })
|
|
665
|
+
] })
|
|
666
|
+
] }, l.id)
|
|
667
|
+
] });
|
|
668
|
+
}, Js = P.memo(
|
|
669
|
+
Ys,
|
|
670
|
+
We
|
|
671
|
+
), Qs = (t) => {
|
|
672
|
+
const s = bs("CustomMessage");
|
|
673
|
+
return /* @__PURE__ */ e(Js, { ...s, ...t });
|
|
674
|
+
}, Xs = (t) => ({
|
|
481
675
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
482
|
-
(s) =>
|
|
676
|
+
(s) => _e.previewIsLoaded(s) || _e.previewIsLoading(s)
|
|
483
677
|
)
|
|
484
|
-
}),
|
|
678
|
+
}), Ks = ({
|
|
485
679
|
link: t,
|
|
486
680
|
onDismiss: s
|
|
487
681
|
}) => {
|
|
488
|
-
const { og_scrape_url: n, title: r, image_url:
|
|
489
|
-
return /* @__PURE__ */
|
|
682
|
+
const { og_scrape_url: n, title: r, image_url: o } = t;
|
|
683
|
+
return /* @__PURE__ */ i(
|
|
490
684
|
"a",
|
|
491
685
|
{
|
|
492
686
|
href: n,
|
|
@@ -494,10 +688,10 @@ const ds = (t) => /* @__PURE__ */ e(Be, { ...t, position: "center" }), us = (t)
|
|
|
494
688
|
rel: "noopener noreferrer",
|
|
495
689
|
className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
|
|
496
690
|
children: [
|
|
497
|
-
|
|
691
|
+
o && /* @__PURE__ */ e(
|
|
498
692
|
"img",
|
|
499
693
|
{
|
|
500
|
-
src:
|
|
694
|
+
src: o,
|
|
501
695
|
alt: r || "",
|
|
502
696
|
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
503
697
|
}
|
|
@@ -506,47 +700,47 @@ const ds = (t) => /* @__PURE__ */ e(Be, { ...t, position: "center" }), us = (t)
|
|
|
506
700
|
"button",
|
|
507
701
|
{
|
|
508
702
|
type: "button",
|
|
509
|
-
onClick: (
|
|
510
|
-
|
|
703
|
+
onClick: (a) => {
|
|
704
|
+
a.preventDefault(), s(n);
|
|
511
705
|
},
|
|
512
706
|
className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl",
|
|
513
707
|
"aria-label": "Close link preview",
|
|
514
|
-
children: /* @__PURE__ */ e(
|
|
708
|
+
children: /* @__PURE__ */ e(be, { className: "size-4 text-black/90" })
|
|
515
709
|
}
|
|
516
710
|
),
|
|
517
|
-
/* @__PURE__ */
|
|
711
|
+
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
518
712
|
r && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: r }),
|
|
519
713
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
520
714
|
] })
|
|
521
715
|
]
|
|
522
716
|
}
|
|
523
717
|
);
|
|
524
|
-
},
|
|
525
|
-
const { linkPreviewsManager: t } =
|
|
718
|
+
}, et = () => {
|
|
719
|
+
const { linkPreviewsManager: t } = vs(), { linkPreviews: s } = ws(
|
|
526
720
|
t.state,
|
|
527
|
-
|
|
528
|
-
), n = (
|
|
529
|
-
t.dismissPreview(
|
|
721
|
+
Xs
|
|
722
|
+
), n = (o) => {
|
|
723
|
+
t.dismissPreview(o);
|
|
530
724
|
};
|
|
531
|
-
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((
|
|
532
|
-
|
|
725
|
+
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ e(
|
|
726
|
+
Ks,
|
|
533
727
|
{
|
|
534
|
-
link:
|
|
728
|
+
link: o,
|
|
535
729
|
onDismiss: n
|
|
536
730
|
},
|
|
537
|
-
|
|
731
|
+
o.og_scrape_url
|
|
538
732
|
)) }) : null;
|
|
539
|
-
},
|
|
540
|
-
const { handleSubmit: t } =
|
|
541
|
-
return /* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
-
/* @__PURE__ */ e(
|
|
545
|
-
/* @__PURE__ */ e(
|
|
546
|
-
/* @__PURE__ */ e(
|
|
547
|
-
/* @__PURE__ */
|
|
733
|
+
}, st = () => {
|
|
734
|
+
const { handleSubmit: t } = ps(), s = Es();
|
|
735
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
736
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Is, {}) }),
|
|
737
|
+
/* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
|
|
738
|
+
/* @__PURE__ */ e(_s, {}),
|
|
739
|
+
/* @__PURE__ */ e(et, {}),
|
|
740
|
+
/* @__PURE__ */ e(Ss, {}),
|
|
741
|
+
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
548
742
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
549
|
-
|
|
743
|
+
Ms,
|
|
550
744
|
{
|
|
551
745
|
className: "w-full resize-none outline-none leading-6",
|
|
552
746
|
autoFocus: !0,
|
|
@@ -562,33 +756,33 @@ const ds = (t) => /* @__PURE__ */ e(Be, { ...t, position: "center" }), us = (t)
|
|
|
562
756
|
disabled: !s,
|
|
563
757
|
onClick: t,
|
|
564
758
|
type: "button",
|
|
565
|
-
children: /* @__PURE__ */ e(
|
|
759
|
+
children: /* @__PURE__ */ e(Ls, { className: "size-4" })
|
|
566
760
|
}
|
|
567
761
|
)
|
|
568
762
|
] })
|
|
569
763
|
] })
|
|
570
764
|
] });
|
|
571
|
-
},
|
|
765
|
+
}, tt = ({
|
|
572
766
|
renderActions: t
|
|
573
|
-
}) => /* @__PURE__ */
|
|
767
|
+
}) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
574
768
|
t && (t == null ? void 0 : t()),
|
|
575
|
-
/* @__PURE__ */ e(
|
|
576
|
-
] }),
|
|
769
|
+
/* @__PURE__ */ e(ys, { Input: st })
|
|
770
|
+
] }), nt = (t) => {
|
|
577
771
|
const s = t.message.hide_date === !0;
|
|
578
|
-
return /* @__PURE__ */
|
|
579
|
-
/* @__PURE__ */
|
|
772
|
+
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
773
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
|
|
580
774
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
581
775
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
582
776
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
583
777
|
] }),
|
|
584
|
-
!s && /* @__PURE__ */ e(
|
|
778
|
+
!s && /* @__PURE__ */ e(ke, { message: t.message })
|
|
585
779
|
] });
|
|
586
|
-
},
|
|
780
|
+
}, rt = () => null, at = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
587
781
|
"div",
|
|
588
782
|
{
|
|
589
|
-
className:
|
|
783
|
+
className: S("flex items-center justify-center h-full", t),
|
|
590
784
|
children: [
|
|
591
|
-
/* @__PURE__ */
|
|
785
|
+
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
592
786
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
593
787
|
"animateTransform",
|
|
594
788
|
{
|
|
@@ -626,25 +820,25 @@ const ds = (t) => /* @__PURE__ */ e(Be, { ...t, position: "center" }), us = (t)
|
|
|
626
820
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
627
821
|
]
|
|
628
822
|
}
|
|
629
|
-
),
|
|
630
|
-
/* @__PURE__ */ e(
|
|
823
|
+
), ue = P.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
824
|
+
/* @__PURE__ */ e(at, { className: "w-6 h-6" }),
|
|
631
825
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
632
826
|
] }) }));
|
|
633
|
-
|
|
634
|
-
const
|
|
635
|
-
var
|
|
636
|
-
const { channel:
|
|
637
|
-
(
|
|
638
|
-
var
|
|
639
|
-
return ((
|
|
827
|
+
ue.displayName = "LoadingState";
|
|
828
|
+
const lt = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
829
|
+
var g, x, w, f, l;
|
|
830
|
+
const { channel: o } = Re(), c = P.useMemo(() => Object.values(o.state.members || {}).find(
|
|
831
|
+
(y) => {
|
|
832
|
+
var d;
|
|
833
|
+
return ((d = y.user) == null ? void 0 : d.id) && y.user.id !== o._client.userID;
|
|
640
834
|
}
|
|
641
|
-
), [
|
|
642
|
-
return /* @__PURE__ */
|
|
643
|
-
/* @__PURE__ */
|
|
835
|
+
), [o._client.userID, o.state.members]), a = ((g = c == null ? void 0 : c.user) == null ? void 0 : g.name) || ((x = c == null ? void 0 : c.user) == null ? void 0 : x.id) || "Unknown member", u = (w = c == null ? void 0 : c.user) == null ? void 0 : w.image;
|
|
836
|
+
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
837
|
+
/* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
644
838
|
/* @__PURE__ */ e(
|
|
645
839
|
"button",
|
|
646
840
|
{
|
|
647
|
-
className:
|
|
841
|
+
className: S(
|
|
648
842
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
649
843
|
!s && "invisible"
|
|
650
844
|
),
|
|
@@ -652,36 +846,36 @@ const Cs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
652
846
|
}),
|
|
653
847
|
type: "button",
|
|
654
848
|
"aria-label": "Back to conversations",
|
|
655
|
-
children: /* @__PURE__ */ e(
|
|
849
|
+
children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
|
|
656
850
|
}
|
|
657
851
|
),
|
|
658
|
-
/* @__PURE__ */
|
|
852
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
659
853
|
/* @__PURE__ */ e(
|
|
660
|
-
|
|
854
|
+
te,
|
|
661
855
|
{
|
|
662
|
-
id: ((f =
|
|
663
|
-
name:
|
|
664
|
-
image:
|
|
856
|
+
id: ((f = c == null ? void 0 : c.user) == null ? void 0 : f.id) || o.id || "unknown",
|
|
857
|
+
name: a,
|
|
858
|
+
image: u,
|
|
665
859
|
size: 40
|
|
666
860
|
}
|
|
667
861
|
),
|
|
668
|
-
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children:
|
|
862
|
+
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: a })
|
|
669
863
|
] }),
|
|
670
864
|
/* @__PURE__ */ e(
|
|
671
865
|
"button",
|
|
672
866
|
{
|
|
673
|
-
className:
|
|
867
|
+
className: S(
|
|
674
868
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
675
869
|
),
|
|
676
870
|
onClick: n,
|
|
677
871
|
type: "button",
|
|
678
872
|
"aria-label": "Show info",
|
|
679
|
-
children: /* @__PURE__ */ e(
|
|
873
|
+
children: /* @__PURE__ */ e(pe, { className: "size-5 text-black/90" })
|
|
680
874
|
}
|
|
681
875
|
)
|
|
682
876
|
] }),
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ i("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
|
|
878
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
685
879
|
s && t && /* @__PURE__ */ e(
|
|
686
880
|
"button",
|
|
687
881
|
{
|
|
@@ -689,105 +883,105 @@ const Cs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
689
883
|
onClick: t,
|
|
690
884
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
691
885
|
"aria-label": "Back to conversations",
|
|
692
|
-
children: /* @__PURE__ */ e(
|
|
886
|
+
children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
|
|
693
887
|
}
|
|
694
888
|
),
|
|
695
889
|
/* @__PURE__ */ e(
|
|
696
|
-
|
|
890
|
+
te,
|
|
697
891
|
{
|
|
698
|
-
id: ((
|
|
699
|
-
name:
|
|
700
|
-
image:
|
|
892
|
+
id: ((l = c == null ? void 0 : c.user) == null ? void 0 : l.id) || o.id || "unknown",
|
|
893
|
+
name: a,
|
|
894
|
+
image: u,
|
|
701
895
|
size: 40
|
|
702
896
|
}
|
|
703
897
|
),
|
|
704
|
-
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children:
|
|
898
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: a }) })
|
|
705
899
|
] }),
|
|
706
900
|
r && n && /* @__PURE__ */ e(
|
|
707
901
|
"button",
|
|
708
902
|
{
|
|
709
|
-
className:
|
|
903
|
+
className: S(
|
|
710
904
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
711
905
|
),
|
|
712
906
|
onClick: n,
|
|
713
|
-
children: /* @__PURE__ */ e(
|
|
907
|
+
children: /* @__PURE__ */ e(pe, { className: "size-5 text-black/90" })
|
|
714
908
|
}
|
|
715
909
|
)
|
|
716
910
|
] })
|
|
717
911
|
] });
|
|
718
|
-
},
|
|
912
|
+
}, ot = ({
|
|
719
913
|
dialogRef: t,
|
|
720
914
|
onClose: s,
|
|
721
915
|
participant: n,
|
|
722
916
|
channel: r,
|
|
723
|
-
followerStatusLabel:
|
|
724
|
-
onLeaveConversation:
|
|
725
|
-
onBlockParticipant:
|
|
726
|
-
showDeleteConversation:
|
|
727
|
-
onDeleteConversationClick:
|
|
728
|
-
onBlockParticipantClick:
|
|
917
|
+
followerStatusLabel: o,
|
|
918
|
+
onLeaveConversation: c,
|
|
919
|
+
onBlockParticipant: a,
|
|
920
|
+
showDeleteConversation: u = !0,
|
|
921
|
+
onDeleteConversationClick: g,
|
|
922
|
+
onBlockParticipantClick: x,
|
|
729
923
|
onReportParticipantClick: w
|
|
730
924
|
}) => {
|
|
731
|
-
var
|
|
732
|
-
const { service: f, debug:
|
|
733
|
-
var
|
|
734
|
-
if (!(!f || !((
|
|
925
|
+
var K, ee, re, O, H, J, z;
|
|
926
|
+
const { service: f, debug: l } = he(), [R, y] = p(!1), [d, N] = p(!1), [E, I] = p(!1), _ = T(async () => {
|
|
927
|
+
var k;
|
|
928
|
+
if (!(!f || !((k = n == null ? void 0 : n.user) != null && k.id)))
|
|
735
929
|
try {
|
|
736
|
-
const
|
|
737
|
-
(
|
|
738
|
-
var
|
|
739
|
-
return
|
|
930
|
+
const U = (await f.getBlockedUsers()).some(
|
|
931
|
+
($) => {
|
|
932
|
+
var se;
|
|
933
|
+
return $.blocked_user_id === ((se = n == null ? void 0 : n.user) == null ? void 0 : se.id);
|
|
740
934
|
}
|
|
741
935
|
);
|
|
742
|
-
|
|
743
|
-
} catch (
|
|
936
|
+
y(U);
|
|
937
|
+
} catch (D) {
|
|
744
938
|
console.error(
|
|
745
939
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
746
|
-
|
|
940
|
+
D
|
|
747
941
|
);
|
|
748
942
|
}
|
|
749
|
-
}, [f, (
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}, [
|
|
753
|
-
const
|
|
754
|
-
var
|
|
755
|
-
if (!
|
|
756
|
-
|
|
943
|
+
}, [f, (K = n == null ? void 0 : n.user) == null ? void 0 : K.id]);
|
|
944
|
+
q(() => {
|
|
945
|
+
_();
|
|
946
|
+
}, [_]);
|
|
947
|
+
const C = async () => {
|
|
948
|
+
var k;
|
|
949
|
+
if (!d) {
|
|
950
|
+
g == null || g(), l && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
|
|
757
951
|
try {
|
|
758
|
-
const
|
|
759
|
-
await r.hide(
|
|
760
|
-
} catch (
|
|
761
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
952
|
+
const D = ((k = r._client) == null ? void 0 : k.userID) ?? null;
|
|
953
|
+
await r.hide(D, !1), c && await c(r), s();
|
|
954
|
+
} catch (D) {
|
|
955
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", D);
|
|
762
956
|
} finally {
|
|
763
957
|
N(!1);
|
|
764
958
|
}
|
|
765
959
|
}
|
|
766
|
-
},
|
|
767
|
-
var
|
|
960
|
+
}, M = async () => {
|
|
961
|
+
var k, D, U;
|
|
768
962
|
if (!(E || !f)) {
|
|
769
|
-
|
|
963
|
+
x == null || x(), l && console.log("[ChannelInfoDialog] Block member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), I(!0);
|
|
770
964
|
try {
|
|
771
|
-
await f.blockUser((
|
|
772
|
-
} catch (
|
|
773
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
965
|
+
await f.blockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), a && await a((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
966
|
+
} catch ($) {
|
|
967
|
+
console.error("[ChannelInfoDialog] Failed to block member", $);
|
|
774
968
|
} finally {
|
|
775
969
|
I(!1);
|
|
776
970
|
}
|
|
777
971
|
}
|
|
778
|
-
},
|
|
779
|
-
var
|
|
972
|
+
}, m = async () => {
|
|
973
|
+
var k, D, U;
|
|
780
974
|
if (!(E || !f)) {
|
|
781
|
-
|
|
975
|
+
x == null || x(), l && console.log("[ChannelInfoDialog] Unblock member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), I(!0);
|
|
782
976
|
try {
|
|
783
|
-
await f.unBlockUser((
|
|
784
|
-
} catch (
|
|
785
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
977
|
+
await f.unBlockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), a && await a((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
|
|
978
|
+
} catch ($) {
|
|
979
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", $);
|
|
786
980
|
} finally {
|
|
787
981
|
I(!1);
|
|
788
982
|
}
|
|
789
983
|
}
|
|
790
|
-
},
|
|
984
|
+
}, h = () => {
|
|
791
985
|
w == null || w(), s(), window.open(
|
|
792
986
|
"https://linktr.ee/s/about/trust-center/report",
|
|
793
987
|
"_blank",
|
|
@@ -795,7 +989,7 @@ const Cs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
795
989
|
);
|
|
796
990
|
};
|
|
797
991
|
if (!n) return null;
|
|
798
|
-
const
|
|
992
|
+
const v = ((ee = n.user) == null ? void 0 : ee.name) || ((re = n.user) == null ? void 0 : re.id) || "Unknown member", G = (O = n.user) == null ? void 0 : O.image, A = (H = n.user) == null ? void 0 : H.email, Z = (J = n.user) == null ? void 0 : J.username, Y = A || (Z ? `linktr.ee/${Z}` : void 0), ne = ((z = n.user) == null ? void 0 : z.id) || "unknown";
|
|
799
993
|
return (
|
|
800
994
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
801
995
|
/* @__PURE__ */ e(
|
|
@@ -804,90 +998,90 @@ const Cs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
804
998
|
ref: t,
|
|
805
999
|
className: "mes-dialog group",
|
|
806
1000
|
onClose: s,
|
|
807
|
-
onClick: (
|
|
808
|
-
|
|
1001
|
+
onClick: (k) => {
|
|
1002
|
+
k.target === t.current && s();
|
|
809
1003
|
},
|
|
810
|
-
children: /* @__PURE__ */
|
|
811
|
-
/* @__PURE__ */
|
|
1004
|
+
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: [
|
|
1005
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
812
1006
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
813
|
-
/* @__PURE__ */ e(
|
|
1007
|
+
/* @__PURE__ */ e(Pe, { onClick: s })
|
|
814
1008
|
] }),
|
|
815
|
-
/* @__PURE__ */
|
|
1009
|
+
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
816
1010
|
/* @__PURE__ */ e(
|
|
817
1011
|
"div",
|
|
818
1012
|
{
|
|
819
1013
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
820
1014
|
style: { backgroundColor: "#FBFAF9" },
|
|
821
|
-
children: /* @__PURE__ */
|
|
1015
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
822
1016
|
/* @__PURE__ */ e(
|
|
823
|
-
|
|
1017
|
+
te,
|
|
824
1018
|
{
|
|
825
|
-
id:
|
|
826
|
-
name:
|
|
827
|
-
image:
|
|
1019
|
+
id: ne,
|
|
1020
|
+
name: v,
|
|
1021
|
+
image: G,
|
|
828
1022
|
size: 88,
|
|
829
1023
|
shape: "circle"
|
|
830
1024
|
}
|
|
831
1025
|
),
|
|
832
|
-
/* @__PURE__ */
|
|
833
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
1026
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
1027
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: v }),
|
|
834
1028
|
Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
|
|
835
|
-
|
|
1029
|
+
o && /* @__PURE__ */ e(
|
|
836
1030
|
"span",
|
|
837
1031
|
{
|
|
838
1032
|
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
839
1033
|
style: {
|
|
840
1034
|
padding: "4px 8px",
|
|
841
|
-
backgroundColor:
|
|
842
|
-
color:
|
|
1035
|
+
backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
|
|
1036
|
+
color: o === "Subscribed to you" ? "#008236" : "#78716C",
|
|
843
1037
|
lineHeight: "133.333%",
|
|
844
1038
|
letterSpacing: "0.21px"
|
|
845
1039
|
},
|
|
846
|
-
children:
|
|
1040
|
+
children: o
|
|
847
1041
|
}
|
|
848
1042
|
)
|
|
849
1043
|
] })
|
|
850
1044
|
] })
|
|
851
1045
|
}
|
|
852
1046
|
),
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
|
|
855
|
-
|
|
1047
|
+
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
1048
|
+
u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1049
|
+
ce,
|
|
856
1050
|
{
|
|
857
|
-
onClick:
|
|
858
|
-
disabled:
|
|
859
|
-
"aria-busy":
|
|
1051
|
+
onClick: C,
|
|
1052
|
+
disabled: d,
|
|
1053
|
+
"aria-busy": d,
|
|
860
1054
|
children: [
|
|
861
|
-
|
|
1055
|
+
d ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ps, { className: "h-5 w-5" }),
|
|
862
1056
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
863
1057
|
]
|
|
864
1058
|
}
|
|
865
1059
|
) }),
|
|
866
|
-
/* @__PURE__ */ e("li", { children:
|
|
867
|
-
|
|
1060
|
+
/* @__PURE__ */ e("li", { children: R ? /* @__PURE__ */ i(
|
|
1061
|
+
ce,
|
|
868
1062
|
{
|
|
869
|
-
onClick:
|
|
1063
|
+
onClick: m,
|
|
870
1064
|
disabled: E,
|
|
871
1065
|
"aria-busy": E,
|
|
872
1066
|
children: [
|
|
873
|
-
E ? /* @__PURE__ */ e(
|
|
1067
|
+
E ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ee, { className: "h-5 w-5" }),
|
|
874
1068
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
875
1069
|
]
|
|
876
1070
|
}
|
|
877
|
-
) : /* @__PURE__ */
|
|
878
|
-
|
|
1071
|
+
) : /* @__PURE__ */ i(
|
|
1072
|
+
ce,
|
|
879
1073
|
{
|
|
880
|
-
onClick:
|
|
1074
|
+
onClick: M,
|
|
881
1075
|
disabled: E,
|
|
882
1076
|
"aria-busy": E,
|
|
883
1077
|
children: [
|
|
884
|
-
E ? /* @__PURE__ */ e(
|
|
1078
|
+
E ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ee, { className: "h-5 w-5" }),
|
|
885
1079
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
886
1080
|
]
|
|
887
1081
|
}
|
|
888
1082
|
) }),
|
|
889
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
890
|
-
/* @__PURE__ */ e(
|
|
1083
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ce, { variant: "danger", onClick: h, children: [
|
|
1084
|
+
/* @__PURE__ */ e(Os, { className: "h-5 w-5" }),
|
|
891
1085
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
892
1086
|
] }) })
|
|
893
1087
|
] })
|
|
@@ -896,118 +1090,126 @@ const Cs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
896
1090
|
}
|
|
897
1091
|
)
|
|
898
1092
|
);
|
|
899
|
-
},
|
|
1093
|
+
}, it = ({
|
|
900
1094
|
onBack: t,
|
|
901
1095
|
showBackButton: s,
|
|
902
1096
|
renderMessageInputActions: n,
|
|
903
1097
|
onLeaveConversation: r,
|
|
904
|
-
onBlockParticipant:
|
|
905
|
-
showDeleteConversation:
|
|
906
|
-
onDeleteConversationClick:
|
|
907
|
-
onBlockParticipantClick:
|
|
908
|
-
onReportParticipantClick:
|
|
1098
|
+
onBlockParticipant: o,
|
|
1099
|
+
showDeleteConversation: c = !0,
|
|
1100
|
+
onDeleteConversationClick: a,
|
|
1101
|
+
onBlockParticipantClick: u,
|
|
1102
|
+
onReportParticipantClick: g
|
|
909
1103
|
}) => {
|
|
910
|
-
const { channel:
|
|
1104
|
+
const { channel: x } = Re(), w = W(null), f = P.useMemo(() => Object.values(x.state.members || {}).find(
|
|
911
1105
|
(N) => {
|
|
912
1106
|
var E;
|
|
913
|
-
return ((E = N.user) == null ? void 0 : E.id) && N.user.id !==
|
|
1107
|
+
return ((E = N.user) == null ? void 0 : E.id) && N.user.id !== x._client.userID;
|
|
914
1108
|
}
|
|
915
|
-
), [
|
|
916
|
-
const
|
|
917
|
-
if (
|
|
918
|
-
return String(
|
|
919
|
-
if (
|
|
920
|
-
return
|
|
921
|
-
}, [
|
|
922
|
-
var
|
|
923
|
-
(
|
|
924
|
-
}, []),
|
|
925
|
-
var
|
|
926
|
-
(
|
|
1109
|
+
), [x._client.userID, x.state.members]), l = P.useMemo(() => {
|
|
1110
|
+
const d = x.data ?? {};
|
|
1111
|
+
if (d.followerStatus)
|
|
1112
|
+
return String(d.followerStatus);
|
|
1113
|
+
if (d.isFollower !== void 0)
|
|
1114
|
+
return d.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1115
|
+
}, [x.data]), R = T(() => {
|
|
1116
|
+
var d;
|
|
1117
|
+
(d = w.current) == null || d.showModal();
|
|
1118
|
+
}, []), y = T(() => {
|
|
1119
|
+
var d;
|
|
1120
|
+
(d = w.current) == null || d.close();
|
|
927
1121
|
}, []);
|
|
928
|
-
return /* @__PURE__ */
|
|
929
|
-
/* @__PURE__ */
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
{
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1122
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
1123
|
+
/* @__PURE__ */ e(
|
|
1124
|
+
Rs,
|
|
1125
|
+
{
|
|
1126
|
+
overrides: {
|
|
1127
|
+
Message: (d) => /* @__PURE__ */ e(Qs, { ...d })
|
|
1128
|
+
},
|
|
1129
|
+
children: /* @__PURE__ */ i(Ts, { children: [
|
|
1130
|
+
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
1131
|
+
lt,
|
|
1132
|
+
{
|
|
1133
|
+
onBack: t,
|
|
1134
|
+
showBackButton: s,
|
|
1135
|
+
onShowInfo: R,
|
|
1136
|
+
canShowInfo: !!f
|
|
1137
|
+
}
|
|
1138
|
+
) }),
|
|
1139
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1140
|
+
Ds,
|
|
1141
|
+
{
|
|
1142
|
+
hideDeletedMessages: !0,
|
|
1143
|
+
hideNewMessageSeparator: !1,
|
|
1144
|
+
messageActions: void 0
|
|
1145
|
+
}
|
|
1146
|
+
) }),
|
|
1147
|
+
/* @__PURE__ */ e(
|
|
1148
|
+
tt,
|
|
1149
|
+
{
|
|
1150
|
+
renderActions: () => n == null ? void 0 : n(x)
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
] })
|
|
1154
|
+
}
|
|
1155
|
+
),
|
|
954
1156
|
/* @__PURE__ */ e(
|
|
955
|
-
|
|
1157
|
+
ot,
|
|
956
1158
|
{
|
|
957
1159
|
dialogRef: w,
|
|
958
|
-
onClose:
|
|
1160
|
+
onClose: y,
|
|
959
1161
|
participant: f,
|
|
960
|
-
channel:
|
|
961
|
-
followerStatusLabel:
|
|
1162
|
+
channel: x,
|
|
1163
|
+
followerStatusLabel: l,
|
|
962
1164
|
onLeaveConversation: r,
|
|
963
|
-
onBlockParticipant:
|
|
964
|
-
showDeleteConversation:
|
|
965
|
-
onDeleteConversationClick:
|
|
966
|
-
onBlockParticipantClick:
|
|
967
|
-
onReportParticipantClick:
|
|
1165
|
+
onBlockParticipant: o,
|
|
1166
|
+
showDeleteConversation: c,
|
|
1167
|
+
onDeleteConversationClick: a,
|
|
1168
|
+
onBlockParticipantClick: u,
|
|
1169
|
+
onReportParticipantClick: g
|
|
968
1170
|
}
|
|
969
1171
|
)
|
|
970
1172
|
] });
|
|
971
|
-
},
|
|
1173
|
+
}, Ue = P.memo(
|
|
972
1174
|
({
|
|
973
1175
|
channel: t,
|
|
974
1176
|
onBack: s,
|
|
975
1177
|
showBackButton: n = !1,
|
|
976
1178
|
renderMessageInputActions: r,
|
|
977
|
-
onLeaveConversation:
|
|
978
|
-
onBlockParticipant:
|
|
979
|
-
className:
|
|
980
|
-
CustomChannelEmptyState:
|
|
981
|
-
showDeleteConversation:
|
|
982
|
-
onDeleteConversationClick:
|
|
1179
|
+
onLeaveConversation: o,
|
|
1180
|
+
onBlockParticipant: c,
|
|
1181
|
+
className: a,
|
|
1182
|
+
CustomChannelEmptyState: u = rt,
|
|
1183
|
+
showDeleteConversation: g = !0,
|
|
1184
|
+
onDeleteConversationClick: x,
|
|
983
1185
|
onBlockParticipantClick: w,
|
|
984
1186
|
onReportParticipantClick: f
|
|
985
1187
|
}) => /* @__PURE__ */ e(
|
|
986
1188
|
"div",
|
|
987
1189
|
{
|
|
988
|
-
className:
|
|
1190
|
+
className: S(
|
|
989
1191
|
"messaging-channel-view h-full flex flex-col",
|
|
990
|
-
|
|
1192
|
+
a
|
|
991
1193
|
),
|
|
992
1194
|
children: /* @__PURE__ */ e(
|
|
993
|
-
|
|
1195
|
+
ks,
|
|
994
1196
|
{
|
|
995
1197
|
channel: t,
|
|
996
|
-
MessageSystem:
|
|
997
|
-
EmptyStateIndicator:
|
|
998
|
-
LoadingIndicator:
|
|
999
|
-
DateSeparator:
|
|
1198
|
+
MessageSystem: nt,
|
|
1199
|
+
EmptyStateIndicator: u,
|
|
1200
|
+
LoadingIndicator: ue,
|
|
1201
|
+
DateSeparator: Gs,
|
|
1000
1202
|
children: /* @__PURE__ */ e(
|
|
1001
|
-
|
|
1203
|
+
it,
|
|
1002
1204
|
{
|
|
1003
1205
|
onBack: s,
|
|
1004
1206
|
showBackButton: n,
|
|
1005
1207
|
renderMessageInputActions: r,
|
|
1006
|
-
onLeaveConversation:
|
|
1007
|
-
onBlockParticipant:
|
|
1008
|
-
CustomChannelEmptyState:
|
|
1009
|
-
showDeleteConversation:
|
|
1010
|
-
onDeleteConversationClick:
|
|
1208
|
+
onLeaveConversation: o,
|
|
1209
|
+
onBlockParticipant: c,
|
|
1210
|
+
CustomChannelEmptyState: u,
|
|
1211
|
+
showDeleteConversation: g,
|
|
1212
|
+
onDeleteConversationClick: x,
|
|
1011
1213
|
onBlockParticipantClick: w,
|
|
1012
1214
|
onReportParticipantClick: f
|
|
1013
1215
|
}
|
|
@@ -1017,16 +1219,16 @@ const Cs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1017
1219
|
}
|
|
1018
1220
|
)
|
|
1019
1221
|
);
|
|
1020
|
-
|
|
1021
|
-
function
|
|
1222
|
+
Ue.displayName = "ChannelView";
|
|
1223
|
+
function ct({
|
|
1022
1224
|
searchQuery: t,
|
|
1023
1225
|
setSearchQuery: s,
|
|
1024
1226
|
placeholder: n
|
|
1025
1227
|
}) {
|
|
1026
|
-
const r =
|
|
1027
|
-
return /* @__PURE__ */
|
|
1228
|
+
const r = W(null);
|
|
1229
|
+
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1028
1230
|
/* @__PURE__ */ e(
|
|
1029
|
-
|
|
1231
|
+
Us,
|
|
1030
1232
|
{
|
|
1031
1233
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1032
1234
|
weight: "bold"
|
|
@@ -1039,162 +1241,162 @@ function ys({
|
|
|
1039
1241
|
type: "text",
|
|
1040
1242
|
placeholder: n,
|
|
1041
1243
|
value: t,
|
|
1042
|
-
onChange: (
|
|
1244
|
+
onChange: (o) => s(o.target.value),
|
|
1043
1245
|
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"
|
|
1044
1246
|
}
|
|
1045
1247
|
),
|
|
1046
1248
|
t && /* @__PURE__ */ e(
|
|
1047
|
-
|
|
1249
|
+
Le,
|
|
1048
1250
|
{
|
|
1049
1251
|
label: "Clear search",
|
|
1050
1252
|
onClick: () => {
|
|
1051
|
-
var
|
|
1052
|
-
s(""), (
|
|
1253
|
+
var o;
|
|
1254
|
+
s(""), (o = r.current) == null || o.focus();
|
|
1053
1255
|
},
|
|
1054
1256
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1055
|
-
children: /* @__PURE__ */ e(
|
|
1257
|
+
children: /* @__PURE__ */ e(be, { className: "h-4 w-4", weight: "bold" })
|
|
1056
1258
|
}
|
|
1057
1259
|
)
|
|
1058
1260
|
] });
|
|
1059
1261
|
}
|
|
1060
|
-
const
|
|
1262
|
+
const dt = ({
|
|
1061
1263
|
participantSource: t,
|
|
1062
1264
|
onSelectParticipant: s,
|
|
1063
1265
|
onClose: n,
|
|
1064
1266
|
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
1065
|
-
participantLabel:
|
|
1066
|
-
searchPlaceholder:
|
|
1067
|
-
className:
|
|
1267
|
+
participantLabel: o = "participants",
|
|
1268
|
+
searchPlaceholder: c = "Search participants...",
|
|
1269
|
+
className: a
|
|
1068
1270
|
}) => {
|
|
1069
|
-
const { debug:
|
|
1271
|
+
const { debug: u } = he(), [g, x] = p(""), [w, f] = p([]), [l, R] = p(!1), [y, d] = p(null), [N, E] = p(
|
|
1070
1272
|
null
|
|
1071
|
-
), I =
|
|
1072
|
-
|
|
1273
|
+
), I = W(!1);
|
|
1274
|
+
q(() => {
|
|
1073
1275
|
if (t.loading) {
|
|
1074
|
-
|
|
1276
|
+
u && console.log(
|
|
1075
1277
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1076
1278
|
);
|
|
1077
1279
|
return;
|
|
1078
1280
|
}
|
|
1079
1281
|
if (I.current) return;
|
|
1080
1282
|
(async () => {
|
|
1081
|
-
|
|
1283
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), R(!0), d(null);
|
|
1082
1284
|
try {
|
|
1083
|
-
const
|
|
1285
|
+
const h = await t.loadParticipants({
|
|
1084
1286
|
search: "",
|
|
1085
1287
|
// Load all participants initially
|
|
1086
1288
|
limit: 100
|
|
1087
1289
|
});
|
|
1088
|
-
f(
|
|
1290
|
+
f(h.participants), I.current = !0, u && console.log(
|
|
1089
1291
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1090
|
-
|
|
1292
|
+
h.participants.length
|
|
1091
1293
|
);
|
|
1092
|
-
} catch (
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1294
|
+
} catch (h) {
|
|
1295
|
+
const v = h instanceof Error ? h.message : "Failed to load participants";
|
|
1296
|
+
d(v), console.error("[ParticipantPicker] Failed to load participants:", h);
|
|
1095
1297
|
} finally {
|
|
1096
|
-
|
|
1298
|
+
R(!1);
|
|
1097
1299
|
}
|
|
1098
1300
|
})();
|
|
1099
|
-
}, [t.loading,
|
|
1100
|
-
const
|
|
1101
|
-
var
|
|
1102
|
-
if (!
|
|
1103
|
-
const
|
|
1104
|
-
return
|
|
1105
|
-
}),
|
|
1106
|
-
async (
|
|
1301
|
+
}, [t.loading, u]);
|
|
1302
|
+
const _ = w.filter((m) => !r.has(m.id)).filter((m) => {
|
|
1303
|
+
var v;
|
|
1304
|
+
if (!g) return !0;
|
|
1305
|
+
const h = g.toLowerCase();
|
|
1306
|
+
return m.name.toLowerCase().includes(h) || ((v = m.email) == null ? void 0 : v.toLowerCase().includes(h)) || !1;
|
|
1307
|
+
}), C = T(
|
|
1308
|
+
async (m) => {
|
|
1107
1309
|
if (!N) {
|
|
1108
|
-
E(
|
|
1310
|
+
E(m.id);
|
|
1109
1311
|
try {
|
|
1110
|
-
await s(
|
|
1111
|
-
} catch (
|
|
1112
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1312
|
+
await s(m);
|
|
1313
|
+
} catch (h) {
|
|
1314
|
+
console.error("[ParticipantPicker] Failed to start chat:", h), E(null);
|
|
1113
1315
|
}
|
|
1114
1316
|
}
|
|
1115
1317
|
},
|
|
1116
1318
|
[s, N]
|
|
1117
|
-
),
|
|
1118
|
-
(
|
|
1319
|
+
), M = (m, h) => {
|
|
1320
|
+
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), C(h));
|
|
1119
1321
|
};
|
|
1120
|
-
return /* @__PURE__ */
|
|
1121
|
-
/* @__PURE__ */
|
|
1122
|
-
/* @__PURE__ */
|
|
1322
|
+
return /* @__PURE__ */ i("div", { className: S("flex flex-col h-full", a), children: [
|
|
1323
|
+
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1324
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1123
1325
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1124
|
-
/* @__PURE__ */ e(
|
|
1326
|
+
/* @__PURE__ */ e(Pe, { onClick: n })
|
|
1125
1327
|
] }),
|
|
1126
|
-
/* @__PURE__ */
|
|
1328
|
+
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1127
1329
|
"Select a ",
|
|
1128
|
-
|
|
1330
|
+
o.slice(0, -1),
|
|
1129
1331
|
" to start messaging (",
|
|
1130
|
-
|
|
1332
|
+
_.length,
|
|
1131
1333
|
" available)",
|
|
1132
|
-
t.totalCount !== void 0 && ` • ${t.totalCount} ${
|
|
1334
|
+
t.totalCount !== void 0 && ` • ${t.totalCount} ${o} total`
|
|
1133
1335
|
] }),
|
|
1134
1336
|
/* @__PURE__ */ e(
|
|
1135
|
-
|
|
1337
|
+
ct,
|
|
1136
1338
|
{
|
|
1137
|
-
searchQuery:
|
|
1138
|
-
setSearchQuery:
|
|
1139
|
-
placeholder:
|
|
1339
|
+
searchQuery: g,
|
|
1340
|
+
setSearchQuery: x,
|
|
1341
|
+
placeholder: c
|
|
1140
1342
|
}
|
|
1141
1343
|
)
|
|
1142
1344
|
] }),
|
|
1143
|
-
|
|
1345
|
+
y && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1144
1346
|
"Error loading ",
|
|
1145
|
-
|
|
1347
|
+
o,
|
|
1146
1348
|
": ",
|
|
1147
|
-
|
|
1349
|
+
y
|
|
1148
1350
|
] }),
|
|
1149
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
1351
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: l && _.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: [
|
|
1150
1352
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1151
|
-
/* @__PURE__ */
|
|
1353
|
+
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1152
1354
|
"Loading ",
|
|
1153
|
-
|
|
1355
|
+
o,
|
|
1154
1356
|
"..."
|
|
1155
1357
|
] })
|
|
1156
|
-
] }) }) :
|
|
1157
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
1158
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children:
|
|
1159
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children:
|
|
1160
|
-
] }) : /* @__PURE__ */
|
|
1161
|
-
|
|
1162
|
-
const
|
|
1358
|
+
] }) }) : _.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1359
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Ie, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1360
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: g ? `No ${o} found` : w.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
|
|
1361
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: g ? "Try a different search term" : w.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
|
|
1362
|
+
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1363
|
+
_.map((m) => {
|
|
1364
|
+
const h = m.name || m.email || m.id, v = m.email && m.name ? m.email : m.phone;
|
|
1163
1365
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1164
1366
|
"button",
|
|
1165
1367
|
{
|
|
1166
1368
|
type: "button",
|
|
1167
|
-
onClick: () =>
|
|
1168
|
-
onKeyDown: (
|
|
1369
|
+
onClick: () => C(m),
|
|
1370
|
+
onKeyDown: (G) => M(G, m),
|
|
1169
1371
|
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",
|
|
1170
|
-
children: /* @__PURE__ */
|
|
1171
|
-
/* @__PURE__ */
|
|
1372
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1373
|
+
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1172
1374
|
/* @__PURE__ */ e(
|
|
1173
|
-
|
|
1375
|
+
te,
|
|
1174
1376
|
{
|
|
1175
|
-
id:
|
|
1176
|
-
name:
|
|
1177
|
-
image:
|
|
1377
|
+
id: m.id,
|
|
1378
|
+
name: h,
|
|
1379
|
+
image: m.image,
|
|
1178
1380
|
size: 40
|
|
1179
1381
|
}
|
|
1180
1382
|
),
|
|
1181
|
-
/* @__PURE__ */
|
|
1182
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1183
|
-
|
|
1383
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1384
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: h }),
|
|
1385
|
+
v && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: v })
|
|
1184
1386
|
] })
|
|
1185
1387
|
] }),
|
|
1186
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N ===
|
|
1388
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === m.id ? /* @__PURE__ */ e(de, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ie, { className: "h-5 w-5 text-stone" }) })
|
|
1187
1389
|
] })
|
|
1188
1390
|
}
|
|
1189
|
-
) },
|
|
1391
|
+
) }, m.id);
|
|
1190
1392
|
}),
|
|
1191
|
-
|
|
1393
|
+
l && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1192
1394
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1193
1395
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1194
1396
|
] }) })
|
|
1195
1397
|
] }) })
|
|
1196
1398
|
] });
|
|
1197
|
-
},
|
|
1399
|
+
}, mt = ({ className: t }) => /* @__PURE__ */ i(
|
|
1198
1400
|
"svg",
|
|
1199
1401
|
{
|
|
1200
1402
|
width: "140",
|
|
@@ -1204,7 +1406,7 @@ const Es = ({
|
|
|
1204
1406
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1205
1407
|
className: t,
|
|
1206
1408
|
children: [
|
|
1207
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ i("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1208
1410
|
/* @__PURE__ */ e(
|
|
1209
1411
|
"path",
|
|
1210
1412
|
{
|
|
@@ -1233,7 +1435,7 @@ const Es = ({
|
|
|
1233
1435
|
fill: "white"
|
|
1234
1436
|
}
|
|
1235
1437
|
),
|
|
1236
|
-
/* @__PURE__ */
|
|
1438
|
+
/* @__PURE__ */ i("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1237
1439
|
/* @__PURE__ */ e(
|
|
1238
1440
|
"path",
|
|
1239
1441
|
{
|
|
@@ -1273,8 +1475,8 @@ const Es = ({
|
|
|
1273
1475
|
}
|
|
1274
1476
|
)
|
|
1275
1477
|
] }),
|
|
1276
|
-
/* @__PURE__ */
|
|
1277
|
-
/* @__PURE__ */
|
|
1478
|
+
/* @__PURE__ */ i("defs", { children: [
|
|
1479
|
+
/* @__PURE__ */ i(
|
|
1278
1480
|
"filter",
|
|
1279
1481
|
{
|
|
1280
1482
|
id: "filter0_empty_state",
|
|
@@ -1328,17 +1530,17 @@ const Es = ({
|
|
|
1328
1530
|
] })
|
|
1329
1531
|
]
|
|
1330
1532
|
}
|
|
1331
|
-
),
|
|
1332
|
-
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */
|
|
1333
|
-
/* @__PURE__ */ e(
|
|
1334
|
-
s && !t && /* @__PURE__ */
|
|
1533
|
+
), Be = P.memo(
|
|
1534
|
+
({ 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: [
|
|
1535
|
+
/* @__PURE__ */ e(mt, {}),
|
|
1536
|
+
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1335
1537
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1336
1538
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1337
1539
|
] })
|
|
1338
1540
|
] }) })
|
|
1339
1541
|
);
|
|
1340
|
-
|
|
1341
|
-
const
|
|
1542
|
+
Be.displayName = "EmptyState";
|
|
1543
|
+
const me = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
|
|
1342
1544
|
/* @__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: "⚠️" }) }),
|
|
1343
1545
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1344
1546
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1352,235 +1554,235 @@ const le = U.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1352
1554
|
}
|
|
1353
1555
|
)
|
|
1354
1556
|
] }) }));
|
|
1355
|
-
|
|
1356
|
-
const
|
|
1557
|
+
me.displayName = "ErrorState";
|
|
1558
|
+
const wt = ({
|
|
1357
1559
|
capabilities: t = {},
|
|
1358
1560
|
className: s,
|
|
1359
1561
|
renderMessageInputActions: n,
|
|
1360
1562
|
onChannelSelect: r,
|
|
1361
|
-
onParticipantSelect:
|
|
1362
|
-
initialParticipantFilter:
|
|
1363
|
-
initialParticipantData:
|
|
1364
|
-
CustomChannelEmptyState:
|
|
1365
|
-
showChannelList:
|
|
1366
|
-
filters:
|
|
1563
|
+
onParticipantSelect: o,
|
|
1564
|
+
initialParticipantFilter: c,
|
|
1565
|
+
initialParticipantData: a,
|
|
1566
|
+
CustomChannelEmptyState: u,
|
|
1567
|
+
showChannelList: g = !0,
|
|
1568
|
+
filters: x,
|
|
1367
1569
|
channelListCustomEmptyStateIndicator: w,
|
|
1368
1570
|
onDeleteConversationClick: f,
|
|
1369
|
-
onBlockParticipantClick:
|
|
1370
|
-
onReportParticipantClick:
|
|
1571
|
+
onBlockParticipantClick: l,
|
|
1572
|
+
onReportParticipantClick: R
|
|
1371
1573
|
}) => {
|
|
1372
1574
|
const {
|
|
1373
|
-
service:
|
|
1374
|
-
client:
|
|
1575
|
+
service: y,
|
|
1576
|
+
client: d,
|
|
1375
1577
|
isConnected: N,
|
|
1376
1578
|
isLoading: E,
|
|
1377
1579
|
error: I,
|
|
1378
|
-
refreshConnection:
|
|
1379
|
-
debug:
|
|
1380
|
-
} =
|
|
1381
|
-
participantSource:
|
|
1382
|
-
participantLabel:
|
|
1383
|
-
showDeleteConversation:
|
|
1384
|
-
} = t,
|
|
1385
|
-
const
|
|
1580
|
+
refreshConnection: _,
|
|
1581
|
+
debug: C
|
|
1582
|
+
} = Bs(), [M, m] = p(null), [h, v] = p(!1), [G, A] = p(!1), [Z, Y] = p(!1), [ne, K] = p(/* @__PURE__ */ new Set()), [ee, re] = p(0), [O, H] = p(!1), [J, z] = p(null), k = W(null), {
|
|
1583
|
+
participantSource: D,
|
|
1584
|
+
participantLabel: U = "participants",
|
|
1585
|
+
showDeleteConversation: $ = !0
|
|
1586
|
+
} = t, se = P.useMemo(() => {
|
|
1587
|
+
const b = d == null ? void 0 : d.userID;
|
|
1386
1588
|
return {
|
|
1387
1589
|
...{
|
|
1388
1590
|
type: "messaging",
|
|
1389
1591
|
last_message_at: { $exists: !0 },
|
|
1390
|
-
...
|
|
1391
|
-
members: { $in: [
|
|
1592
|
+
...b && {
|
|
1593
|
+
members: { $in: [b] },
|
|
1392
1594
|
hidden: !1
|
|
1393
1595
|
}
|
|
1394
1596
|
},
|
|
1395
|
-
...
|
|
1597
|
+
...x
|
|
1396
1598
|
};
|
|
1397
|
-
}, [
|
|
1398
|
-
if (!
|
|
1399
|
-
const
|
|
1400
|
-
if (
|
|
1599
|
+
}, [x, d == null ? void 0 : d.userID]), Q = W(null), V = T(async () => {
|
|
1600
|
+
if (!d || !N) return;
|
|
1601
|
+
const b = d.userID;
|
|
1602
|
+
if (b)
|
|
1401
1603
|
try {
|
|
1402
|
-
|
|
1403
|
-
const
|
|
1604
|
+
C && console.log("[MessagingShell] Syncing channels for user:", b);
|
|
1605
|
+
const L = await d.queryChannels(
|
|
1404
1606
|
{
|
|
1405
1607
|
type: "messaging",
|
|
1406
|
-
members: { $in: [
|
|
1608
|
+
members: { $in: [b] }
|
|
1407
1609
|
},
|
|
1408
1610
|
{},
|
|
1409
1611
|
{ limit: 100 }
|
|
1410
1612
|
), F = /* @__PURE__ */ new Set();
|
|
1411
|
-
|
|
1412
|
-
const
|
|
1413
|
-
Object.values(
|
|
1414
|
-
var
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1613
|
+
L.forEach((B) => {
|
|
1614
|
+
const xe = B.state.members;
|
|
1615
|
+
Object.values(xe).forEach((Ae) => {
|
|
1616
|
+
var ve;
|
|
1617
|
+
const Ce = (ve = Ae.user) == null ? void 0 : ve.id;
|
|
1618
|
+
Ce && Ce !== b && F.add(Ce);
|
|
1417
1619
|
});
|
|
1418
|
-
}),
|
|
1419
|
-
channelCount:
|
|
1620
|
+
}), K((B) => B.size === F.size && [...B].every((xe) => F.has(xe)) ? B : F), v(L.length > 0), A(!0), Q.current = b, C && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1621
|
+
channelCount: L.length,
|
|
1420
1622
|
memberCount: F.size
|
|
1421
1623
|
});
|
|
1422
|
-
} catch (
|
|
1423
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1624
|
+
} catch (L) {
|
|
1625
|
+
console.error("[MessagingShell] Failed to sync channels:", L);
|
|
1424
1626
|
}
|
|
1425
|
-
}, [
|
|
1426
|
-
|
|
1427
|
-
if (!
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1430
|
-
}, [
|
|
1431
|
-
if (!
|
|
1627
|
+
}, [d, N, C]);
|
|
1628
|
+
q(() => {
|
|
1629
|
+
if (!d || !N) return;
|
|
1630
|
+
const b = d.userID;
|
|
1631
|
+
b && Q.current !== b && V();
|
|
1632
|
+
}, [d, N, V]), q(() => {
|
|
1633
|
+
if (!c || !d || !N) return;
|
|
1432
1634
|
(async () => {
|
|
1433
|
-
const
|
|
1434
|
-
if (
|
|
1635
|
+
const L = d.userID;
|
|
1636
|
+
if (L)
|
|
1435
1637
|
try {
|
|
1436
|
-
|
|
1638
|
+
C && console.log(
|
|
1437
1639
|
"[MessagingShell] Loading initial conversation with:",
|
|
1438
|
-
|
|
1640
|
+
c
|
|
1439
1641
|
);
|
|
1440
|
-
const F = await
|
|
1642
|
+
const F = await d.queryChannels(
|
|
1441
1643
|
{
|
|
1442
1644
|
type: "messaging",
|
|
1443
|
-
members: { $eq: [
|
|
1645
|
+
members: { $eq: [L, c] }
|
|
1444
1646
|
},
|
|
1445
1647
|
{},
|
|
1446
1648
|
{ limit: 1 }
|
|
1447
1649
|
);
|
|
1448
1650
|
if (F.length > 0)
|
|
1449
|
-
|
|
1651
|
+
m(F[0]), H(!0), z(null), r && r(F[0]), C && console.log(
|
|
1450
1652
|
"[MessagingShell] Initial conversation loaded:",
|
|
1451
1653
|
F[0].id
|
|
1452
1654
|
);
|
|
1453
|
-
else if (
|
|
1454
|
-
|
|
1655
|
+
else if (a && y) {
|
|
1656
|
+
C && console.log(
|
|
1455
1657
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1456
|
-
|
|
1658
|
+
a
|
|
1457
1659
|
);
|
|
1458
1660
|
try {
|
|
1459
|
-
const
|
|
1460
|
-
id:
|
|
1461
|
-
name:
|
|
1462
|
-
email:
|
|
1463
|
-
phone:
|
|
1661
|
+
const B = await y.startChannelWithParticipant({
|
|
1662
|
+
id: a.id,
|
|
1663
|
+
name: a.name,
|
|
1664
|
+
email: a.email,
|
|
1665
|
+
phone: a.phone
|
|
1464
1666
|
});
|
|
1465
|
-
|
|
1667
|
+
m(B), H(!0), z(null), r && r(B), C && console.log(
|
|
1466
1668
|
"[MessagingShell] Channel created and loaded:",
|
|
1467
|
-
|
|
1669
|
+
B.id
|
|
1468
1670
|
);
|
|
1469
|
-
} catch (
|
|
1671
|
+
} catch (B) {
|
|
1470
1672
|
console.error(
|
|
1471
1673
|
"[MessagingShell] Failed to create conversation:",
|
|
1472
|
-
|
|
1473
|
-
),
|
|
1674
|
+
B
|
|
1675
|
+
), z("Failed to create conversation");
|
|
1474
1676
|
}
|
|
1475
1677
|
} else
|
|
1476
|
-
|
|
1678
|
+
z(
|
|
1477
1679
|
"No conversation found with this account"
|
|
1478
|
-
),
|
|
1680
|
+
), C && console.log(
|
|
1479
1681
|
"[MessagingShell] No conversation found for:",
|
|
1480
|
-
|
|
1682
|
+
c
|
|
1481
1683
|
);
|
|
1482
1684
|
} catch (F) {
|
|
1483
1685
|
console.error(
|
|
1484
1686
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1485
1687
|
F
|
|
1486
|
-
),
|
|
1688
|
+
), z("Failed to load conversation");
|
|
1487
1689
|
}
|
|
1488
1690
|
})();
|
|
1489
1691
|
}, [
|
|
1490
|
-
i,
|
|
1491
|
-
l,
|
|
1492
1692
|
c,
|
|
1693
|
+
a,
|
|
1694
|
+
d,
|
|
1493
1695
|
N,
|
|
1494
|
-
|
|
1495
|
-
|
|
1696
|
+
y,
|
|
1697
|
+
C,
|
|
1496
1698
|
r
|
|
1497
1699
|
]);
|
|
1498
|
-
const
|
|
1499
|
-
(
|
|
1500
|
-
|
|
1700
|
+
const le = T(
|
|
1701
|
+
(b) => {
|
|
1702
|
+
m(b), r == null || r(b);
|
|
1501
1703
|
},
|
|
1502
1704
|
[r]
|
|
1503
|
-
),
|
|
1504
|
-
O ||
|
|
1505
|
-
}, [O]),
|
|
1506
|
-
async (
|
|
1507
|
-
var
|
|
1508
|
-
if (
|
|
1705
|
+
), oe = T(() => {
|
|
1706
|
+
O || m(null);
|
|
1707
|
+
}, [O]), ae = T(
|
|
1708
|
+
async (b) => {
|
|
1709
|
+
var L;
|
|
1710
|
+
if (y)
|
|
1509
1711
|
try {
|
|
1510
|
-
|
|
1712
|
+
C && console.log(
|
|
1511
1713
|
"[MessagingShell] Starting conversation with:",
|
|
1512
|
-
|
|
1714
|
+
b.id
|
|
1513
1715
|
);
|
|
1514
|
-
const F = await
|
|
1515
|
-
id:
|
|
1516
|
-
name:
|
|
1517
|
-
email:
|
|
1518
|
-
phone:
|
|
1716
|
+
const F = await y.startChannelWithParticipant({
|
|
1717
|
+
id: b.id,
|
|
1718
|
+
name: b.name,
|
|
1719
|
+
email: b.email,
|
|
1720
|
+
phone: b.phone
|
|
1519
1721
|
});
|
|
1520
1722
|
try {
|
|
1521
1723
|
await F.show();
|
|
1522
|
-
} catch (
|
|
1523
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1724
|
+
} catch (B) {
|
|
1725
|
+
console.warn("[MessagingShell] Failed to unhide channel:", B);
|
|
1524
1726
|
}
|
|
1525
|
-
|
|
1727
|
+
m(F), Y(!1), (L = k.current) == null || L.close(), o == null || o(b);
|
|
1526
1728
|
} catch (F) {
|
|
1527
1729
|
console.error("[MessagingShell] Failed to start conversation:", F);
|
|
1528
1730
|
}
|
|
1529
1731
|
},
|
|
1530
|
-
[
|
|
1531
|
-
),
|
|
1532
|
-
var
|
|
1533
|
-
Y(!1), (
|
|
1534
|
-
}, []),
|
|
1535
|
-
(
|
|
1536
|
-
|
|
1732
|
+
[y, o, C]
|
|
1733
|
+
), j = T(() => {
|
|
1734
|
+
var b;
|
|
1735
|
+
Y(!1), (b = k.current) == null || b.close();
|
|
1736
|
+
}, []), fe = T(
|
|
1737
|
+
(b) => {
|
|
1738
|
+
b.target === k.current && j();
|
|
1537
1739
|
},
|
|
1538
|
-
[
|
|
1539
|
-
),
|
|
1540
|
-
async (
|
|
1541
|
-
|
|
1740
|
+
[j]
|
|
1741
|
+
), ie = T(
|
|
1742
|
+
async (b) => {
|
|
1743
|
+
C && console.log("[MessagingShell] Leaving conversation:", b.id), m(null), H(!1), Q.current = null, await V();
|
|
1542
1744
|
},
|
|
1543
|
-
[
|
|
1544
|
-
),
|
|
1545
|
-
async (
|
|
1546
|
-
|
|
1745
|
+
[V, C]
|
|
1746
|
+
), ge = T(
|
|
1747
|
+
async (b) => {
|
|
1748
|
+
C && console.log("[MessagingShell] Blocking participant:", b), m(null), H(!1), Q.current = null, await V();
|
|
1547
1749
|
},
|
|
1548
|
-
[
|
|
1549
|
-
),
|
|
1550
|
-
return E ? /* @__PURE__ */ e("div", { className:
|
|
1551
|
-
|
|
1750
|
+
[V, C]
|
|
1751
|
+
), X = !!M;
|
|
1752
|
+
return E ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(ue, {}) }) : I ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(me, { message: I, onBack: _ }) }) : !N || !d ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(
|
|
1753
|
+
me,
|
|
1552
1754
|
{
|
|
1553
1755
|
message: "Not connected to messaging service",
|
|
1554
|
-
onBack:
|
|
1756
|
+
onBack: _
|
|
1555
1757
|
}
|
|
1556
|
-
) }) : J ? /* @__PURE__ */ e("div", { className:
|
|
1758
|
+
) }) : J ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(me, { message: J }) }) : /* @__PURE__ */ i(
|
|
1557
1759
|
"div",
|
|
1558
1760
|
{
|
|
1559
|
-
className:
|
|
1761
|
+
className: S(
|
|
1560
1762
|
"messaging-shell h-full bg-background-primary overflow-hidden",
|
|
1561
1763
|
s
|
|
1562
1764
|
),
|
|
1563
1765
|
children: [
|
|
1564
|
-
/* @__PURE__ */
|
|
1766
|
+
/* @__PURE__ */ i("div", { className: "flex h-full min-h-0", children: [
|
|
1565
1767
|
/* @__PURE__ */ e(
|
|
1566
1768
|
"div",
|
|
1567
1769
|
{
|
|
1568
|
-
className:
|
|
1770
|
+
className: S(
|
|
1569
1771
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1570
1772
|
{
|
|
1571
|
-
"!hidden":
|
|
1773
|
+
"!hidden": g === !1 || O,
|
|
1572
1774
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
1573
|
-
"hidden lg:flex lg:flex-1 lg:max-w-2xl":
|
|
1775
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": g !== !1 && !O && X,
|
|
1574
1776
|
// Show on mobile when no channel selected, use same wide width on desktop
|
|
1575
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl":
|
|
1777
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": g !== !1 && !O && !X
|
|
1576
1778
|
}
|
|
1577
1779
|
),
|
|
1578
1780
|
children: /* @__PURE__ */ e(
|
|
1579
|
-
|
|
1781
|
+
Fe,
|
|
1580
1782
|
{
|
|
1581
|
-
onChannelSelect:
|
|
1582
|
-
selectedChannel:
|
|
1583
|
-
filters:
|
|
1783
|
+
onChannelSelect: le,
|
|
1784
|
+
selectedChannel: M || void 0,
|
|
1785
|
+
filters: se,
|
|
1584
1786
|
customEmptyStateIndicator: w
|
|
1585
1787
|
}
|
|
1586
1788
|
)
|
|
@@ -1589,70 +1791,70 @@ const Ls = ({
|
|
|
1589
1791
|
/* @__PURE__ */ e(
|
|
1590
1792
|
"div",
|
|
1591
1793
|
{
|
|
1592
|
-
className:
|
|
1794
|
+
className: S(
|
|
1593
1795
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1594
1796
|
{
|
|
1595
1797
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1596
|
-
flex: O ||
|
|
1798
|
+
flex: O || X || c,
|
|
1597
1799
|
// Normal mode: hide on mobile when no channel selected
|
|
1598
|
-
"hidden lg:flex": !O && !
|
|
1800
|
+
"hidden lg:flex": !O && !X && !c
|
|
1599
1801
|
}
|
|
1600
1802
|
),
|
|
1601
|
-
children:
|
|
1602
|
-
|
|
1803
|
+
children: M ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1804
|
+
Ue,
|
|
1603
1805
|
{
|
|
1604
|
-
channel:
|
|
1605
|
-
onBack:
|
|
1806
|
+
channel: M,
|
|
1807
|
+
onBack: oe,
|
|
1606
1808
|
showBackButton: !O,
|
|
1607
1809
|
renderMessageInputActions: n,
|
|
1608
|
-
onLeaveConversation:
|
|
1609
|
-
onBlockParticipant:
|
|
1610
|
-
CustomChannelEmptyState:
|
|
1611
|
-
showDeleteConversation:
|
|
1810
|
+
onLeaveConversation: ie,
|
|
1811
|
+
onBlockParticipant: ge,
|
|
1812
|
+
CustomChannelEmptyState: u,
|
|
1813
|
+
showDeleteConversation: $,
|
|
1612
1814
|
onDeleteConversationClick: f,
|
|
1613
|
-
onBlockParticipantClick:
|
|
1614
|
-
onReportParticipantClick:
|
|
1815
|
+
onBlockParticipantClick: l,
|
|
1816
|
+
onReportParticipantClick: R
|
|
1615
1817
|
},
|
|
1616
|
-
|
|
1617
|
-
) }) :
|
|
1818
|
+
M.id
|
|
1819
|
+
) }) : c ? (
|
|
1618
1820
|
// Show loading while creating/loading direct conversation channel
|
|
1619
|
-
/* @__PURE__ */ e(
|
|
1821
|
+
/* @__PURE__ */ e(ue, {})
|
|
1620
1822
|
) : /* @__PURE__ */ e(
|
|
1621
|
-
|
|
1823
|
+
Be,
|
|
1622
1824
|
{
|
|
1623
|
-
hasChannels:
|
|
1624
|
-
channelsLoaded:
|
|
1825
|
+
hasChannels: h,
|
|
1826
|
+
channelsLoaded: G
|
|
1625
1827
|
}
|
|
1626
1828
|
)
|
|
1627
1829
|
}
|
|
1628
1830
|
)
|
|
1629
1831
|
] }),
|
|
1630
|
-
|
|
1832
|
+
D && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1631
1833
|
/* @__PURE__ */ e(
|
|
1632
1834
|
"dialog",
|
|
1633
1835
|
{
|
|
1634
|
-
ref:
|
|
1836
|
+
ref: k,
|
|
1635
1837
|
className: "mes-dialog",
|
|
1636
|
-
onClick:
|
|
1637
|
-
onClose:
|
|
1838
|
+
onClick: fe,
|
|
1839
|
+
onClose: j,
|
|
1638
1840
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1639
|
-
|
|
1841
|
+
dt,
|
|
1640
1842
|
{
|
|
1641
|
-
participantSource:
|
|
1642
|
-
onSelectParticipant:
|
|
1643
|
-
onClose:
|
|
1644
|
-
existingParticipantIds:
|
|
1645
|
-
participantLabel:
|
|
1646
|
-
searchPlaceholder: `Search ${
|
|
1843
|
+
participantSource: D,
|
|
1844
|
+
onSelectParticipant: ae,
|
|
1845
|
+
onClose: j,
|
|
1846
|
+
existingParticipantIds: ne,
|
|
1847
|
+
participantLabel: U,
|
|
1848
|
+
searchPlaceholder: `Search ${U}...`
|
|
1647
1849
|
},
|
|
1648
|
-
|
|
1850
|
+
ee
|
|
1649
1851
|
) })
|
|
1650
1852
|
}
|
|
1651
1853
|
)
|
|
1652
1854
|
]
|
|
1653
1855
|
}
|
|
1654
1856
|
);
|
|
1655
|
-
},
|
|
1857
|
+
}, ut = ({
|
|
1656
1858
|
question: t,
|
|
1657
1859
|
onClick: s,
|
|
1658
1860
|
loading: n = !1,
|
|
@@ -1664,7 +1866,7 @@ const Ls = ({
|
|
|
1664
1866
|
onClick: s,
|
|
1665
1867
|
disabled: n,
|
|
1666
1868
|
style: { backgroundColor: "#E6E5E3" },
|
|
1667
|
-
className:
|
|
1869
|
+
className: S(
|
|
1668
1870
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1669
1871
|
{
|
|
1670
1872
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1674,100 +1876,100 @@ const Ls = ({
|
|
|
1674
1876
|
),
|
|
1675
1877
|
children: t
|
|
1676
1878
|
}
|
|
1677
|
-
),
|
|
1879
|
+
), yt = ({
|
|
1678
1880
|
faqs: t,
|
|
1679
1881
|
onFaqClick: s,
|
|
1680
1882
|
loadingFaqId: n,
|
|
1681
1883
|
headerText: r,
|
|
1682
|
-
className:
|
|
1683
|
-
avatarImage:
|
|
1684
|
-
avatarName:
|
|
1884
|
+
className: o,
|
|
1885
|
+
avatarImage: c,
|
|
1886
|
+
avatarName: a
|
|
1685
1887
|
}) => {
|
|
1686
|
-
const
|
|
1687
|
-
return
|
|
1688
|
-
(
|
|
1689
|
-
|
|
1888
|
+
const u = t.filter((g) => g.enabled).sort((g, x) => (g.order ?? 0) - (x.order ?? 0));
|
|
1889
|
+
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1890
|
+
(c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1891
|
+
te,
|
|
1690
1892
|
{
|
|
1691
|
-
id:
|
|
1692
|
-
name:
|
|
1693
|
-
image:
|
|
1893
|
+
id: a || "account",
|
|
1894
|
+
name: a || "Account",
|
|
1895
|
+
image: c,
|
|
1694
1896
|
size: 24,
|
|
1695
1897
|
shape: "circle"
|
|
1696
1898
|
}
|
|
1697
1899
|
) }),
|
|
1698
|
-
/* @__PURE__ */
|
|
1900
|
+
/* @__PURE__ */ i(
|
|
1699
1901
|
"div",
|
|
1700
1902
|
{
|
|
1701
1903
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
1702
1904
|
style: { backgroundColor: "#F1F0EE" },
|
|
1703
1905
|
children: [
|
|
1704
1906
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1705
|
-
|
|
1706
|
-
|
|
1907
|
+
u.map((g) => /* @__PURE__ */ e(
|
|
1908
|
+
ut,
|
|
1707
1909
|
{
|
|
1708
|
-
question:
|
|
1709
|
-
onClick: () => s(
|
|
1710
|
-
loading: n ===
|
|
1910
|
+
question: g.question,
|
|
1911
|
+
onClick: () => s(g.id),
|
|
1912
|
+
loading: n === g.id
|
|
1711
1913
|
},
|
|
1712
|
-
|
|
1914
|
+
g.id
|
|
1713
1915
|
))
|
|
1714
1916
|
]
|
|
1715
1917
|
}
|
|
1716
1918
|
)
|
|
1717
1919
|
] }) });
|
|
1718
|
-
},
|
|
1719
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [
|
|
1720
|
-
if (
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1920
|
+
}, pt = (t, s = {}) => {
|
|
1921
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [o, c] = p([]), [a, u] = p(!1), [g, x] = p(null), [w, f] = p(n), [l, R] = p(!0), [y, d] = p(), N = T(async (C = !1, M) => {
|
|
1922
|
+
if (a) return;
|
|
1923
|
+
const m = M !== void 0 ? M : w;
|
|
1924
|
+
u(!0), x(null);
|
|
1723
1925
|
try {
|
|
1724
|
-
const
|
|
1725
|
-
search:
|
|
1926
|
+
const h = await t.loadParticipants({
|
|
1927
|
+
search: m || void 0,
|
|
1726
1928
|
limit: r,
|
|
1727
|
-
cursor:
|
|
1929
|
+
cursor: C ? void 0 : y
|
|
1728
1930
|
});
|
|
1729
|
-
|
|
1730
|
-
(
|
|
1731
|
-
),
|
|
1732
|
-
} catch (
|
|
1733
|
-
const
|
|
1734
|
-
|
|
1931
|
+
c(
|
|
1932
|
+
(v) => C ? h.participants : [...v, ...h.participants]
|
|
1933
|
+
), R(h.hasMore), d(h.nextCursor);
|
|
1934
|
+
} catch (h) {
|
|
1935
|
+
const v = h instanceof Error ? h.message : "Failed to load participants";
|
|
1936
|
+
x(v), console.error("[useParticipants] Load error:", h);
|
|
1735
1937
|
} finally {
|
|
1736
|
-
|
|
1938
|
+
u(!1);
|
|
1737
1939
|
}
|
|
1738
|
-
}, [t, w,
|
|
1739
|
-
|
|
1740
|
-
}, [
|
|
1741
|
-
f(
|
|
1742
|
-
}, [N]),
|
|
1743
|
-
|
|
1940
|
+
}, [t, w, y, r, a]), E = T(() => {
|
|
1941
|
+
l && !a && N(!1);
|
|
1942
|
+
}, [l, a, N]), I = T((C) => {
|
|
1943
|
+
f(C), d(void 0), N(!0, C);
|
|
1944
|
+
}, [N]), _ = T(() => {
|
|
1945
|
+
d(void 0), N(!0);
|
|
1744
1946
|
}, [N]);
|
|
1745
|
-
return
|
|
1947
|
+
return q(() => {
|
|
1746
1948
|
N(!0);
|
|
1747
1949
|
}, [t.loadParticipants]), {
|
|
1748
|
-
participants:
|
|
1749
|
-
loading:
|
|
1750
|
-
error:
|
|
1950
|
+
participants: o,
|
|
1951
|
+
loading: a,
|
|
1952
|
+
error: g,
|
|
1751
1953
|
searchQuery: w,
|
|
1752
|
-
hasMore:
|
|
1954
|
+
hasMore: l,
|
|
1753
1955
|
totalCount: t.totalCount,
|
|
1754
1956
|
loadMore: E,
|
|
1755
1957
|
search: I,
|
|
1756
|
-
refresh:
|
|
1958
|
+
refresh: _
|
|
1757
1959
|
};
|
|
1758
1960
|
};
|
|
1759
1961
|
export {
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1962
|
+
te as Avatar,
|
|
1963
|
+
rt as ChannelEmptyState,
|
|
1964
|
+
Fe as ChannelList,
|
|
1965
|
+
Ue as ChannelView,
|
|
1966
|
+
yt as FaqList,
|
|
1967
|
+
ut as FaqListItem,
|
|
1968
|
+
vt as MessagingProvider,
|
|
1969
|
+
wt as MessagingShell,
|
|
1970
|
+
dt as ParticipantPicker,
|
|
1971
|
+
$s as formatRelativeTime,
|
|
1972
|
+
Bs as useMessaging,
|
|
1973
|
+
pt as useParticipants
|
|
1772
1974
|
};
|
|
1773
1975
|
//# sourceMappingURL=index.js.map
|