@linktr.ee/messaging-react 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.css +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +931 -721
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +36 -23
- package/src/components/CustomDateSeparator/index.tsx +5 -0
- package/src/components/CustomLinkPreviewList/index.tsx +1 -1
- 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 +271 -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 D, useState as y, 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, MessageOptions as es, MessageBlocked as ss, MessageBouncePrompt as ts, MessageDeleted as ns, MessageIsThreadReplyInChannelButtonIndicator as rs, MessageRepliesCountButton as as, MessageStatus as ls, MessageTimestamp as ke, ReactionsList as os, ReminderNotification as is, StreamedMessageText as cs, messageHasAttachments as ds, messageHasReactions as ms, isDateSeparatorMessage as us, isMessageBlocked as hs, isMessageBounced as fs, isMessageEdited as gs, MessageBounceModal as xs, Poll as Cs, MessageText as Ns, MessageErrorIcon as bs, MessageEditedTimestamp as vs, useMessageContext as ws, useMessageComposer as ps, useStateStore as ys, MessageInput as Es, useMessageInputContext as Is, useMessageComposerHasSendableData as _s, SimpleAttachmentSelector as Ss, QuotedMessagePreview as Ms, AttachmentPreviewList as ks, TextareaComposer as Rs, Channel as Ts, useChannelStateContext as Re, WithComponents as Ds, Window as Fs, MessageList as Ls } from "stream-chat-react";
|
|
6
|
+
import { XIcon as be, GiftIcon as Os, ArrowUpIcon as Ps, ArrowLeftIcon as pe, DotsThreeIcon as ye, SpinnerGapIcon as ue, SignOutIcon as Us, ProhibitInsetIcon as Ee, FlagIcon as Bs, MagnifyingGlassIcon as As, 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
|
+
}), ge = () => je(Te), pt = ({
|
|
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 = D(
|
|
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] = y(null), [x, w] = y(null), [f, l] = y(!1), [T, p] = y(!1), [d, N] = y(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, j;
|
|
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 && ((j = C.current) == null ? void 0 : j.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, p(!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
|
+
p(!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 = D(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 }), p(!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
|
+
p(!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: T,
|
|
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: T,
|
|
190
|
+
error: d,
|
|
191
|
+
capabilities: o,
|
|
192
|
+
refreshConnection: M,
|
|
193
|
+
debug: c
|
|
194
194
|
}), [
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
u,
|
|
196
|
+
x,
|
|
197
197
|
f,
|
|
198
|
-
|
|
198
|
+
T,
|
|
199
|
+
d,
|
|
200
|
+
o,
|
|
201
|
+
M,
|
|
199
202
|
c,
|
|
200
|
-
a
|
|
201
|
-
R,
|
|
202
|
-
i,
|
|
203
|
-
l
|
|
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
|
+
}, $s = () => ge(), js = (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
|
+
}, zs = (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 = js(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 Gs(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 os(t) {
|
|
|
273
273
|
}
|
|
274
274
|
return Math.abs(s);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const n =
|
|
278
|
-
return
|
|
276
|
+
function Hs(t) {
|
|
277
|
+
const n = Gs(t) % Se.length;
|
|
278
|
+
return Se[n];
|
|
279
279
|
}
|
|
280
|
-
const
|
|
280
|
+
const ne = ({
|
|
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 = Hs(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], T = (() => {
|
|
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
|
+
})(), p = f != null && f.created_at ? zs(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: !!p
|
|
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
|
+
ne,
|
|
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
|
+
p && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: p })
|
|
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: T }),
|
|
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 } = ge();
|
|
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 me = ({
|
|
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,220 @@ function Se({ label: t, className: s, children: n, ...r }) {
|
|
|
474
474
|
}
|
|
475
475
|
);
|
|
476
476
|
}
|
|
477
|
-
function
|
|
478
|
-
return /* @__PURE__ */ e(
|
|
477
|
+
function Oe({ 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 Vs = (t) => /* @__PURE__ */ e(Ve, { ...t, position: "center" }), Ws = () => /* @__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
|
+
) }), Zs = (t) => {
|
|
487
|
+
var s;
|
|
488
|
+
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
|
|
489
|
+
}, qs = (t) => {
|
|
490
|
+
var s;
|
|
491
|
+
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
|
|
492
|
+
}, Ys = (t) => {
|
|
493
|
+
var s;
|
|
494
|
+
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
|
|
495
|
+
}, Pe = (t) => Zs(t) || qs(t), Js = (t) => {
|
|
496
|
+
var s;
|
|
497
|
+
return Pe(t) && !((s = t.text) != null && s.trim());
|
|
498
|
+
}, Me = ({
|
|
499
|
+
message: t,
|
|
500
|
+
standalone: s = !1
|
|
501
|
+
}) => {
|
|
502
|
+
var o;
|
|
503
|
+
const n = Pe(t), r = Ys(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(Os, { 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(Ws, {}) }),
|
|
517
|
+
/* @__PURE__ */ e("span", { className: "message-tag__label", children: "Chatbot" })
|
|
518
|
+
] });
|
|
519
|
+
}, Qs = (t) => {
|
|
520
|
+
var R, L;
|
|
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: T,
|
|
535
|
+
onUserHover: p,
|
|
536
|
+
renderText: d,
|
|
537
|
+
threadList: N
|
|
538
|
+
} = t, { client: E } = Ze("CustomMessage"), { t: I } = qe("CustomMessage"), [_, C] = y(!1), [M, m] = y(!1), h = Ye(l.id), {
|
|
539
|
+
Attachment: v = Qe,
|
|
540
|
+
Avatar: j = Xe,
|
|
541
|
+
EditMessageModal: A = Ke,
|
|
542
|
+
MessageOptions: Z = es,
|
|
543
|
+
MessageActions: Y = Z,
|
|
544
|
+
MessageBlocked: re = ss,
|
|
545
|
+
MessageBouncePrompt: ee = ts,
|
|
546
|
+
MessageDeleted: se = ns,
|
|
547
|
+
MessageIsThreadReplyInChannelButtonIndicator: ae = rs,
|
|
548
|
+
MessageRepliesCountButton: U = as,
|
|
549
|
+
MessageStatus: G = ls,
|
|
550
|
+
MessageTimestamp: J = ke,
|
|
551
|
+
ReactionsList: z = os,
|
|
552
|
+
ReminderNotification: k = is,
|
|
553
|
+
StreamedMessageText: F = cs,
|
|
554
|
+
PinIndicator: B
|
|
555
|
+
} = Je("CustomMessage"), H = ds(l), Q = ms(l), X = we(
|
|
556
|
+
() => w == null ? void 0 : w(l),
|
|
557
|
+
[w, l]
|
|
558
|
+
), $ = we(
|
|
559
|
+
() => !l.shared_location && !l.attachments ? [] : l.shared_location ? [l.shared_location, ...l.attachments ?? []] : l.attachments,
|
|
560
|
+
[l]
|
|
561
|
+
);
|
|
562
|
+
if (us(l))
|
|
563
|
+
return null;
|
|
564
|
+
if (l.deleted_at || l.type === "deleted")
|
|
565
|
+
return /* @__PURE__ */ e(se, { message: l });
|
|
566
|
+
if (hs(l))
|
|
567
|
+
return /* @__PURE__ */ e(re, {});
|
|
568
|
+
const xe = !c || r, ie = !N && !!l.reply_count, ce = !N && l.show_in_channel && l.parent_id, K = l.status === "failed" && ((R = l.error) == null ? void 0 : R.status) !== 403, de = fs(l), le = gs(l) && !X;
|
|
569
|
+
let V;
|
|
570
|
+
K ? V = () => g(l) : de ? V = () => C(!0) : le && (V = () => m((oe) => !oe));
|
|
571
|
+
const te = S(
|
|
572
|
+
"str-chat__message str-chat__message-simple",
|
|
573
|
+
`str-chat__message--${l.type}`,
|
|
574
|
+
`str-chat__message--${l.status}`,
|
|
575
|
+
f() ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
576
|
+
l.text ? "str-chat__message--has-text" : "has-no-text",
|
|
577
|
+
{
|
|
578
|
+
"str-chat__message--has-attachment": H,
|
|
579
|
+
"str-chat__message--highlighted": x,
|
|
580
|
+
"str-chat__message--pinned pinned-message": l.pinned,
|
|
581
|
+
"str-chat__message--with-reactions": Q,
|
|
582
|
+
"str-chat__message-send-can-be-retried": (l == null ? void 0 : l.status) === "failed" && ((L = l == null ? void 0 : l.error) == null ? void 0 : L.status) !== 403,
|
|
583
|
+
"str-chat__message-with-thread-link": ie || ce,
|
|
584
|
+
"str-chat__virtual-message__wrapper--end": r,
|
|
585
|
+
"str-chat__virtual-message__wrapper--first": o,
|
|
586
|
+
"str-chat__virtual-message__wrapper--group": c
|
|
587
|
+
}
|
|
588
|
+
), b = l.poll_id && E.polls.fromState(l.poll_id), O = Js(l);
|
|
589
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
590
|
+
n && /* @__PURE__ */ e(
|
|
591
|
+
A,
|
|
592
|
+
{
|
|
593
|
+
additionalMessageInputProps: s
|
|
594
|
+
}
|
|
595
|
+
),
|
|
596
|
+
_ && /* @__PURE__ */ e(
|
|
597
|
+
xs,
|
|
598
|
+
{
|
|
599
|
+
MessageBouncePrompt: ee,
|
|
600
|
+
onClose: () => C(!1),
|
|
601
|
+
open: _
|
|
602
|
+
}
|
|
603
|
+
),
|
|
604
|
+
/* @__PURE__ */ i("div", { className: te, children: [
|
|
605
|
+
B && /* @__PURE__ */ e(B, {}),
|
|
606
|
+
!!h && /* @__PURE__ */ e(k, { reminder: h }),
|
|
607
|
+
l.user && /* @__PURE__ */ e(
|
|
608
|
+
j,
|
|
609
|
+
{
|
|
610
|
+
image: l.user.image,
|
|
611
|
+
name: l.user.name || l.user.id,
|
|
612
|
+
onClick: T,
|
|
613
|
+
onMouseOver: p,
|
|
614
|
+
user: l.user
|
|
615
|
+
}
|
|
616
|
+
),
|
|
617
|
+
/* @__PURE__ */ i(
|
|
618
|
+
"div",
|
|
619
|
+
{
|
|
620
|
+
className: S("str-chat__message-inner", {
|
|
621
|
+
"str-chat__simple-message--error-failed": K || de
|
|
622
|
+
}),
|
|
623
|
+
"data-testid": "message-inner",
|
|
624
|
+
onClick: V,
|
|
625
|
+
onKeyDown: V,
|
|
626
|
+
role: V ? "button" : void 0,
|
|
627
|
+
tabIndex: V ? 0 : void 0,
|
|
628
|
+
children: [
|
|
629
|
+
/* @__PURE__ */ e(Y, {}),
|
|
630
|
+
/* @__PURE__ */ e("div", { className: "str-chat__message-reactions-host", children: Q && /* @__PURE__ */ e(z, { reverse: !0 }) }),
|
|
631
|
+
O ? (
|
|
632
|
+
/* Tip-only messages render as a standalone bubble */
|
|
633
|
+
/* @__PURE__ */ e(Me, { message: l, standalone: !0 })
|
|
634
|
+
) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
635
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
636
|
+
b && /* @__PURE__ */ e(Cs, { poll: b }),
|
|
637
|
+
$ != null && $.length && !l.quoted_message ? /* @__PURE__ */ e(
|
|
638
|
+
v,
|
|
639
|
+
{
|
|
640
|
+
actionHandler: a,
|
|
641
|
+
attachments: $
|
|
642
|
+
}
|
|
643
|
+
) : null,
|
|
644
|
+
X ? /* @__PURE__ */ e(
|
|
645
|
+
F,
|
|
646
|
+
{
|
|
647
|
+
message: l,
|
|
648
|
+
renderText: d
|
|
649
|
+
}
|
|
650
|
+
) : /* @__PURE__ */ e(Ns, { message: l, renderText: d }),
|
|
651
|
+
/* @__PURE__ */ e(bs, {})
|
|
652
|
+
] }),
|
|
653
|
+
/* @__PURE__ */ e(Me, { message: l })
|
|
654
|
+
] })
|
|
655
|
+
]
|
|
656
|
+
}
|
|
657
|
+
),
|
|
658
|
+
ie && /* @__PURE__ */ e(
|
|
659
|
+
U,
|
|
660
|
+
{
|
|
661
|
+
onClick: u,
|
|
662
|
+
reply_count: l.reply_count
|
|
663
|
+
}
|
|
664
|
+
),
|
|
665
|
+
ce && /* @__PURE__ */ e(ae, {}),
|
|
666
|
+
xe && /* @__PURE__ */ i("div", { className: "str-chat__message-metadata", children: [
|
|
667
|
+
/* @__PURE__ */ e(G, {}),
|
|
668
|
+
!f() && !!l.user && /* @__PURE__ */ e("span", { className: "str-chat__message-simple-name", children: l.user.name || l.user.id }),
|
|
669
|
+
/* @__PURE__ */ e(J, { customClass: "str-chat__message-simple-timestamp" }),
|
|
670
|
+
le && /* @__PURE__ */ e("span", { className: "str-chat__mesage-simple-edited", children: I("Edited") }),
|
|
671
|
+
le && /* @__PURE__ */ e(vs, { calendar: !0, open: M })
|
|
672
|
+
] })
|
|
673
|
+
] }, l.id)
|
|
674
|
+
] });
|
|
675
|
+
}, Xs = P.memo(
|
|
676
|
+
Qs,
|
|
677
|
+
We
|
|
678
|
+
), Ks = (t) => {
|
|
679
|
+
const s = ws("CustomMessage");
|
|
680
|
+
return /* @__PURE__ */ e(Xs, { ...s, ...t });
|
|
681
|
+
}, et = (t) => ({
|
|
481
682
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
482
|
-
(s) =>
|
|
683
|
+
(s) => _e.previewIsLoaded(s) || _e.previewIsLoading(s)
|
|
483
684
|
)
|
|
484
|
-
}),
|
|
685
|
+
}), st = ({
|
|
485
686
|
link: t,
|
|
486
687
|
onDismiss: s
|
|
487
688
|
}) => {
|
|
488
|
-
const { og_scrape_url: n, title: r, image_url:
|
|
489
|
-
return /* @__PURE__ */
|
|
689
|
+
const { og_scrape_url: n, title: r, image_url: o } = t;
|
|
690
|
+
return /* @__PURE__ */ i(
|
|
490
691
|
"a",
|
|
491
692
|
{
|
|
492
693
|
href: n,
|
|
@@ -494,10 +695,10 @@ const cs = (t) => ({
|
|
|
494
695
|
rel: "noopener noreferrer",
|
|
495
696
|
className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
|
|
496
697
|
children: [
|
|
497
|
-
|
|
698
|
+
o && /* @__PURE__ */ e(
|
|
498
699
|
"img",
|
|
499
700
|
{
|
|
500
|
-
src:
|
|
701
|
+
src: o,
|
|
501
702
|
alt: r || "",
|
|
502
703
|
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
503
704
|
}
|
|
@@ -506,47 +707,47 @@ const cs = (t) => ({
|
|
|
506
707
|
"button",
|
|
507
708
|
{
|
|
508
709
|
type: "button",
|
|
509
|
-
onClick: (
|
|
510
|
-
|
|
710
|
+
onClick: (a) => {
|
|
711
|
+
a.preventDefault(), s(n);
|
|
511
712
|
},
|
|
512
713
|
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
714
|
"aria-label": "Close link preview",
|
|
514
|
-
children: /* @__PURE__ */ e(
|
|
715
|
+
children: /* @__PURE__ */ e(be, { className: "size-4 text-black/90" })
|
|
515
716
|
}
|
|
516
717
|
),
|
|
517
|
-
/* @__PURE__ */
|
|
718
|
+
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
518
719
|
r && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: r }),
|
|
519
720
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
520
721
|
] })
|
|
521
722
|
]
|
|
522
723
|
}
|
|
523
724
|
);
|
|
524
|
-
},
|
|
525
|
-
const { linkPreviewsManager: t } =
|
|
725
|
+
}, tt = () => {
|
|
726
|
+
const { linkPreviewsManager: t } = ps(), { linkPreviews: s } = ys(
|
|
526
727
|
t.state,
|
|
527
|
-
|
|
528
|
-
), n = (
|
|
529
|
-
t.dismissPreview(
|
|
728
|
+
et
|
|
729
|
+
), n = (o) => {
|
|
730
|
+
t.dismissPreview(o);
|
|
530
731
|
};
|
|
531
|
-
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "
|
|
532
|
-
|
|
732
|
+
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(
|
|
733
|
+
st,
|
|
533
734
|
{
|
|
534
|
-
link:
|
|
735
|
+
link: o,
|
|
535
736
|
onDismiss: n
|
|
536
737
|
},
|
|
537
|
-
|
|
738
|
+
o.og_scrape_url
|
|
538
739
|
)) }) : 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__ */
|
|
740
|
+
}, nt = () => {
|
|
741
|
+
const { handleSubmit: t } = Is(), s = _s();
|
|
742
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
743
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ss, {}) }),
|
|
744
|
+
/* @__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: [
|
|
745
|
+
/* @__PURE__ */ e(Ms, {}),
|
|
746
|
+
/* @__PURE__ */ e(tt, {}),
|
|
747
|
+
/* @__PURE__ */ e(ks, {}),
|
|
748
|
+
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
548
749
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
549
|
-
|
|
750
|
+
Rs,
|
|
550
751
|
{
|
|
551
752
|
className: "w-full resize-none outline-none leading-6",
|
|
552
753
|
autoFocus: !0,
|
|
@@ -562,33 +763,33 @@ const cs = (t) => ({
|
|
|
562
763
|
disabled: !s,
|
|
563
764
|
onClick: t,
|
|
564
765
|
type: "button",
|
|
565
|
-
children: /* @__PURE__ */ e(
|
|
766
|
+
children: /* @__PURE__ */ e(Ps, { className: "size-4" })
|
|
566
767
|
}
|
|
567
768
|
)
|
|
568
769
|
] })
|
|
569
770
|
] })
|
|
570
771
|
] });
|
|
571
|
-
},
|
|
772
|
+
}, rt = ({
|
|
572
773
|
renderActions: t
|
|
573
|
-
}) => /* @__PURE__ */
|
|
774
|
+
}) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
574
775
|
t && (t == null ? void 0 : t()),
|
|
575
|
-
/* @__PURE__ */ e(
|
|
576
|
-
] }),
|
|
776
|
+
/* @__PURE__ */ e(Es, { Input: nt })
|
|
777
|
+
] }), at = (t) => {
|
|
577
778
|
const s = t.message.hide_date === !0;
|
|
578
|
-
return /* @__PURE__ */
|
|
579
|
-
/* @__PURE__ */
|
|
779
|
+
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
780
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
|
|
580
781
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
581
782
|
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
582
783
|
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
583
784
|
] }),
|
|
584
|
-
!s && /* @__PURE__ */ e(
|
|
785
|
+
!s && /* @__PURE__ */ e(ke, { message: t.message })
|
|
585
786
|
] });
|
|
586
|
-
},
|
|
787
|
+
}, lt = () => null, ot = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
587
788
|
"div",
|
|
588
789
|
{
|
|
589
|
-
className:
|
|
790
|
+
className: S("flex items-center justify-center h-full", t),
|
|
590
791
|
children: [
|
|
591
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
592
793
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
593
794
|
"animateTransform",
|
|
594
795
|
{
|
|
@@ -626,25 +827,25 @@ const cs = (t) => ({
|
|
|
626
827
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
627
828
|
]
|
|
628
829
|
}
|
|
629
|
-
),
|
|
630
|
-
/* @__PURE__ */ e(
|
|
830
|
+
), fe = 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: [
|
|
831
|
+
/* @__PURE__ */ e(ot, { className: "w-6 h-6" }),
|
|
631
832
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
632
833
|
] }) }));
|
|
633
|
-
|
|
634
|
-
const
|
|
635
|
-
var
|
|
636
|
-
const { channel:
|
|
637
|
-
(
|
|
638
|
-
var
|
|
639
|
-
return ((
|
|
834
|
+
fe.displayName = "LoadingState";
|
|
835
|
+
const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
836
|
+
var g, x, w, f, l;
|
|
837
|
+
const { channel: o } = Re(), c = P.useMemo(() => Object.values(o.state.members || {}).find(
|
|
838
|
+
(p) => {
|
|
839
|
+
var d;
|
|
840
|
+
return ((d = p.user) == null ? void 0 : d.id) && p.user.id !== o._client.userID;
|
|
640
841
|
}
|
|
641
|
-
), [
|
|
642
|
-
return /* @__PURE__ */
|
|
643
|
-
/* @__PURE__ */
|
|
842
|
+
), [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;
|
|
843
|
+
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
844
|
+
/* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
|
|
644
845
|
/* @__PURE__ */ e(
|
|
645
846
|
"button",
|
|
646
847
|
{
|
|
647
|
-
className:
|
|
848
|
+
className: S(
|
|
648
849
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
649
850
|
!s && "invisible"
|
|
650
851
|
),
|
|
@@ -652,36 +853,36 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
652
853
|
}),
|
|
653
854
|
type: "button",
|
|
654
855
|
"aria-label": "Back to conversations",
|
|
655
|
-
children: /* @__PURE__ */ e(
|
|
856
|
+
children: /* @__PURE__ */ e(pe, { className: "size-5 text-black/90" })
|
|
656
857
|
}
|
|
657
858
|
),
|
|
658
|
-
/* @__PURE__ */
|
|
859
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
659
860
|
/* @__PURE__ */ e(
|
|
660
|
-
|
|
861
|
+
ne,
|
|
661
862
|
{
|
|
662
|
-
id: ((f =
|
|
663
|
-
name:
|
|
664
|
-
image:
|
|
863
|
+
id: ((f = c == null ? void 0 : c.user) == null ? void 0 : f.id) || o.id || "unknown",
|
|
864
|
+
name: a,
|
|
865
|
+
image: u,
|
|
665
866
|
size: 40
|
|
666
867
|
}
|
|
667
868
|
),
|
|
668
|
-
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children:
|
|
869
|
+
/* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: a })
|
|
669
870
|
] }),
|
|
670
871
|
/* @__PURE__ */ e(
|
|
671
872
|
"button",
|
|
672
873
|
{
|
|
673
|
-
className:
|
|
874
|
+
className: S(
|
|
674
875
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
675
876
|
),
|
|
676
877
|
onClick: n,
|
|
677
878
|
type: "button",
|
|
678
879
|
"aria-label": "Show info",
|
|
679
|
-
children: /* @__PURE__ */ e(
|
|
880
|
+
children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
|
|
680
881
|
}
|
|
681
882
|
)
|
|
682
883
|
] }),
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
884
|
+
/* @__PURE__ */ i("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
|
|
885
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
685
886
|
s && t && /* @__PURE__ */ e(
|
|
686
887
|
"button",
|
|
687
888
|
{
|
|
@@ -689,105 +890,105 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
689
890
|
onClick: t,
|
|
690
891
|
className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
|
|
691
892
|
"aria-label": "Back to conversations",
|
|
692
|
-
children: /* @__PURE__ */ e(
|
|
893
|
+
children: /* @__PURE__ */ e(pe, { className: "size-5 text-black/90" })
|
|
693
894
|
}
|
|
694
895
|
),
|
|
695
896
|
/* @__PURE__ */ e(
|
|
696
|
-
|
|
897
|
+
ne,
|
|
697
898
|
{
|
|
698
|
-
id: ((
|
|
699
|
-
name:
|
|
700
|
-
image:
|
|
899
|
+
id: ((l = c == null ? void 0 : c.user) == null ? void 0 : l.id) || o.id || "unknown",
|
|
900
|
+
name: a,
|
|
901
|
+
image: u,
|
|
701
902
|
size: 40
|
|
702
903
|
}
|
|
703
904
|
),
|
|
704
|
-
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children:
|
|
905
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: a }) })
|
|
705
906
|
] }),
|
|
706
907
|
r && n && /* @__PURE__ */ e(
|
|
707
908
|
"button",
|
|
708
909
|
{
|
|
709
|
-
className:
|
|
910
|
+
className: S(
|
|
710
911
|
"size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
|
|
711
912
|
),
|
|
712
913
|
onClick: n,
|
|
713
|
-
children: /* @__PURE__ */ e(
|
|
914
|
+
children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
|
|
714
915
|
}
|
|
715
916
|
)
|
|
716
917
|
] })
|
|
717
918
|
] });
|
|
718
|
-
},
|
|
919
|
+
}, ct = ({
|
|
719
920
|
dialogRef: t,
|
|
720
921
|
onClose: s,
|
|
721
922
|
participant: n,
|
|
722
923
|
channel: r,
|
|
723
|
-
followerStatusLabel:
|
|
724
|
-
onLeaveConversation:
|
|
725
|
-
onBlockParticipant:
|
|
726
|
-
showDeleteConversation:
|
|
727
|
-
onDeleteConversationClick:
|
|
728
|
-
onBlockParticipantClick:
|
|
924
|
+
followerStatusLabel: o,
|
|
925
|
+
onLeaveConversation: c,
|
|
926
|
+
onBlockParticipant: a,
|
|
927
|
+
showDeleteConversation: u = !0,
|
|
928
|
+
onDeleteConversationClick: g,
|
|
929
|
+
onBlockParticipantClick: x,
|
|
729
930
|
onReportParticipantClick: w
|
|
730
931
|
}) => {
|
|
731
|
-
var
|
|
732
|
-
const { service: f, debug:
|
|
733
|
-
var
|
|
734
|
-
if (!(!f || !((
|
|
932
|
+
var ee, se, ae, U, G, J, z;
|
|
933
|
+
const { service: f, debug: l } = ge(), [T, p] = y(!1), [d, N] = y(!1), [E, I] = y(!1), _ = D(async () => {
|
|
934
|
+
var k;
|
|
935
|
+
if (!(!f || !((k = n == null ? void 0 : n.user) != null && k.id)))
|
|
735
936
|
try {
|
|
736
|
-
const
|
|
737
|
-
(
|
|
738
|
-
var
|
|
739
|
-
return
|
|
937
|
+
const B = (await f.getBlockedUsers()).some(
|
|
938
|
+
(H) => {
|
|
939
|
+
var Q;
|
|
940
|
+
return H.blocked_user_id === ((Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id);
|
|
740
941
|
}
|
|
741
942
|
);
|
|
742
|
-
|
|
743
|
-
} catch (
|
|
943
|
+
p(B);
|
|
944
|
+
} catch (F) {
|
|
744
945
|
console.error(
|
|
745
946
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
746
|
-
|
|
947
|
+
F
|
|
747
948
|
);
|
|
748
949
|
}
|
|
749
|
-
}, [f, (
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}, [
|
|
753
|
-
const
|
|
754
|
-
var
|
|
755
|
-
if (!
|
|
756
|
-
|
|
950
|
+
}, [f, (ee = n == null ? void 0 : n.user) == null ? void 0 : ee.id]);
|
|
951
|
+
q(() => {
|
|
952
|
+
_();
|
|
953
|
+
}, [_]);
|
|
954
|
+
const C = async () => {
|
|
955
|
+
var k;
|
|
956
|
+
if (!d) {
|
|
957
|
+
g == null || g(), l && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
|
|
757
958
|
try {
|
|
758
|
-
const
|
|
759
|
-
await r.hide(
|
|
760
|
-
} catch (
|
|
761
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
959
|
+
const F = ((k = r._client) == null ? void 0 : k.userID) ?? null;
|
|
960
|
+
await r.hide(F, !1), c && await c(r), s();
|
|
961
|
+
} catch (F) {
|
|
962
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", F);
|
|
762
963
|
} finally {
|
|
763
964
|
N(!1);
|
|
764
965
|
}
|
|
765
966
|
}
|
|
766
|
-
},
|
|
767
|
-
var
|
|
967
|
+
}, M = async () => {
|
|
968
|
+
var k, F, B;
|
|
768
969
|
if (!(E || !f)) {
|
|
769
|
-
|
|
970
|
+
x == null || x(), l && console.log("[ChannelInfoDialog] Block member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), I(!0);
|
|
770
971
|
try {
|
|
771
|
-
await f.blockUser((
|
|
772
|
-
} catch (
|
|
773
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
972
|
+
await f.blockUser((F = n == null ? void 0 : n.user) == null ? void 0 : F.id), a && await a((B = n == null ? void 0 : n.user) == null ? void 0 : B.id), s();
|
|
973
|
+
} catch (H) {
|
|
974
|
+
console.error("[ChannelInfoDialog] Failed to block member", H);
|
|
774
975
|
} finally {
|
|
775
976
|
I(!1);
|
|
776
977
|
}
|
|
777
978
|
}
|
|
778
|
-
},
|
|
779
|
-
var
|
|
979
|
+
}, m = async () => {
|
|
980
|
+
var k, F, B;
|
|
780
981
|
if (!(E || !f)) {
|
|
781
|
-
|
|
982
|
+
x == null || x(), l && console.log("[ChannelInfoDialog] Unblock member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), I(!0);
|
|
782
983
|
try {
|
|
783
|
-
await f.unBlockUser((
|
|
784
|
-
} catch (
|
|
785
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
984
|
+
await f.unBlockUser((F = n == null ? void 0 : n.user) == null ? void 0 : F.id), a && await a((B = n == null ? void 0 : n.user) == null ? void 0 : B.id), s();
|
|
985
|
+
} catch (H) {
|
|
986
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", H);
|
|
786
987
|
} finally {
|
|
787
988
|
I(!1);
|
|
788
989
|
}
|
|
789
990
|
}
|
|
790
|
-
},
|
|
991
|
+
}, h = () => {
|
|
791
992
|
w == null || w(), s(), window.open(
|
|
792
993
|
"https://linktr.ee/s/about/trust-center/report",
|
|
793
994
|
"_blank",
|
|
@@ -795,7 +996,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
795
996
|
);
|
|
796
997
|
};
|
|
797
998
|
if (!n) return null;
|
|
798
|
-
const
|
|
999
|
+
const v = ((se = n.user) == null ? void 0 : se.name) || ((ae = n.user) == null ? void 0 : ae.id) || "Unknown member", j = (U = n.user) == null ? void 0 : U.image, A = (G = n.user) == null ? void 0 : G.email, Z = (J = n.user) == null ? void 0 : J.username, Y = A || (Z ? `linktr.ee/${Z}` : void 0), re = ((z = n.user) == null ? void 0 : z.id) || "unknown";
|
|
799
1000
|
return (
|
|
800
1001
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
801
1002
|
/* @__PURE__ */ e(
|
|
@@ -804,90 +1005,90 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
804
1005
|
ref: t,
|
|
805
1006
|
className: "mes-dialog group",
|
|
806
1007
|
onClose: s,
|
|
807
|
-
onClick: (
|
|
808
|
-
|
|
1008
|
+
onClick: (k) => {
|
|
1009
|
+
k.target === t.current && s();
|
|
809
1010
|
},
|
|
810
|
-
children: /* @__PURE__ */
|
|
811
|
-
/* @__PURE__ */
|
|
1011
|
+
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: [
|
|
1012
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
812
1013
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
813
|
-
/* @__PURE__ */ e(
|
|
1014
|
+
/* @__PURE__ */ e(Oe, { onClick: s })
|
|
814
1015
|
] }),
|
|
815
|
-
/* @__PURE__ */
|
|
1016
|
+
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
816
1017
|
/* @__PURE__ */ e(
|
|
817
1018
|
"div",
|
|
818
1019
|
{
|
|
819
1020
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
820
1021
|
style: { backgroundColor: "#FBFAF9" },
|
|
821
|
-
children: /* @__PURE__ */
|
|
1022
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
822
1023
|
/* @__PURE__ */ e(
|
|
823
|
-
|
|
1024
|
+
ne,
|
|
824
1025
|
{
|
|
825
|
-
id:
|
|
826
|
-
name:
|
|
827
|
-
image:
|
|
1026
|
+
id: re,
|
|
1027
|
+
name: v,
|
|
1028
|
+
image: j,
|
|
828
1029
|
size: 88,
|
|
829
1030
|
shape: "circle"
|
|
830
1031
|
}
|
|
831
1032
|
),
|
|
832
|
-
/* @__PURE__ */
|
|
833
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
1033
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
1034
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: v }),
|
|
834
1035
|
Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
|
|
835
|
-
|
|
1036
|
+
o && /* @__PURE__ */ e(
|
|
836
1037
|
"span",
|
|
837
1038
|
{
|
|
838
1039
|
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
839
1040
|
style: {
|
|
840
1041
|
padding: "4px 8px",
|
|
841
|
-
backgroundColor:
|
|
842
|
-
color:
|
|
1042
|
+
backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
|
|
1043
|
+
color: o === "Subscribed to you" ? "#008236" : "#78716C",
|
|
843
1044
|
lineHeight: "133.333%",
|
|
844
1045
|
letterSpacing: "0.21px"
|
|
845
1046
|
},
|
|
846
|
-
children:
|
|
1047
|
+
children: o
|
|
847
1048
|
}
|
|
848
1049
|
)
|
|
849
1050
|
] })
|
|
850
1051
|
] })
|
|
851
1052
|
}
|
|
852
1053
|
),
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
|
|
855
|
-
|
|
1054
|
+
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
1055
|
+
u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
1056
|
+
me,
|
|
856
1057
|
{
|
|
857
|
-
onClick:
|
|
858
|
-
disabled:
|
|
859
|
-
"aria-busy":
|
|
1058
|
+
onClick: C,
|
|
1059
|
+
disabled: d,
|
|
1060
|
+
"aria-busy": d,
|
|
860
1061
|
children: [
|
|
861
|
-
|
|
1062
|
+
d ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Us, { className: "h-5 w-5" }),
|
|
862
1063
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
863
1064
|
]
|
|
864
1065
|
}
|
|
865
1066
|
) }),
|
|
866
|
-
/* @__PURE__ */ e("li", { children:
|
|
867
|
-
|
|
1067
|
+
/* @__PURE__ */ e("li", { children: T ? /* @__PURE__ */ i(
|
|
1068
|
+
me,
|
|
868
1069
|
{
|
|
869
|
-
onClick:
|
|
1070
|
+
onClick: m,
|
|
870
1071
|
disabled: E,
|
|
871
1072
|
"aria-busy": E,
|
|
872
1073
|
children: [
|
|
873
|
-
E ? /* @__PURE__ */ e(
|
|
1074
|
+
E ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ee, { className: "h-5 w-5" }),
|
|
874
1075
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
875
1076
|
]
|
|
876
1077
|
}
|
|
877
|
-
) : /* @__PURE__ */
|
|
878
|
-
|
|
1078
|
+
) : /* @__PURE__ */ i(
|
|
1079
|
+
me,
|
|
879
1080
|
{
|
|
880
|
-
onClick:
|
|
1081
|
+
onClick: M,
|
|
881
1082
|
disabled: E,
|
|
882
1083
|
"aria-busy": E,
|
|
883
1084
|
children: [
|
|
884
|
-
E ? /* @__PURE__ */ e(
|
|
1085
|
+
E ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ee, { className: "h-5 w-5" }),
|
|
885
1086
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
886
1087
|
]
|
|
887
1088
|
}
|
|
888
1089
|
) }),
|
|
889
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
890
|
-
/* @__PURE__ */ e(
|
|
1090
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(me, { variant: "danger", onClick: h, children: [
|
|
1091
|
+
/* @__PURE__ */ e(Bs, { className: "h-5 w-5" }),
|
|
891
1092
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
892
1093
|
] }) })
|
|
893
1094
|
] })
|
|
@@ -896,117 +1097,126 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
896
1097
|
}
|
|
897
1098
|
)
|
|
898
1099
|
);
|
|
899
|
-
},
|
|
1100
|
+
}, dt = ({
|
|
900
1101
|
onBack: t,
|
|
901
1102
|
showBackButton: s,
|
|
902
1103
|
renderMessageInputActions: n,
|
|
903
1104
|
onLeaveConversation: r,
|
|
904
|
-
onBlockParticipant:
|
|
905
|
-
showDeleteConversation:
|
|
906
|
-
onDeleteConversationClick:
|
|
907
|
-
onBlockParticipantClick:
|
|
908
|
-
onReportParticipantClick:
|
|
1105
|
+
onBlockParticipant: o,
|
|
1106
|
+
showDeleteConversation: c = !0,
|
|
1107
|
+
onDeleteConversationClick: a,
|
|
1108
|
+
onBlockParticipantClick: u,
|
|
1109
|
+
onReportParticipantClick: g
|
|
909
1110
|
}) => {
|
|
910
|
-
const { channel:
|
|
1111
|
+
const { channel: x } = Re(), w = W(null), f = P.useMemo(() => Object.values(x.state.members || {}).find(
|
|
911
1112
|
(N) => {
|
|
912
1113
|
var E;
|
|
913
|
-
return ((E = N.user) == null ? void 0 : E.id) && N.user.id !==
|
|
1114
|
+
return ((E = N.user) == null ? void 0 : E.id) && N.user.id !== x._client.userID;
|
|
914
1115
|
}
|
|
915
|
-
), [
|
|
916
|
-
const
|
|
917
|
-
if (
|
|
918
|
-
return String(
|
|
919
|
-
if (
|
|
920
|
-
return
|
|
921
|
-
}, [
|
|
922
|
-
var
|
|
923
|
-
(
|
|
924
|
-
}, []),
|
|
925
|
-
var
|
|
926
|
-
(
|
|
1116
|
+
), [x._client.userID, x.state.members]), l = P.useMemo(() => {
|
|
1117
|
+
const d = x.data ?? {};
|
|
1118
|
+
if (d.followerStatus)
|
|
1119
|
+
return String(d.followerStatus);
|
|
1120
|
+
if (d.isFollower !== void 0)
|
|
1121
|
+
return d.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1122
|
+
}, [x.data]), T = D(() => {
|
|
1123
|
+
var d;
|
|
1124
|
+
(d = w.current) == null || d.showModal();
|
|
1125
|
+
}, []), p = D(() => {
|
|
1126
|
+
var d;
|
|
1127
|
+
(d = w.current) == null || d.close();
|
|
927
1128
|
}, []);
|
|
928
|
-
return /* @__PURE__ */
|
|
929
|
-
/* @__PURE__ */ o(Xe, { children: [
|
|
930
|
-
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
931
|
-
Ns,
|
|
932
|
-
{
|
|
933
|
-
onBack: t,
|
|
934
|
-
showBackButton: s,
|
|
935
|
-
onShowInfo: _,
|
|
936
|
-
canShowInfo: !!f
|
|
937
|
-
}
|
|
938
|
-
) }),
|
|
939
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
940
|
-
Ke,
|
|
941
|
-
{
|
|
942
|
-
hideDeletedMessages: !0,
|
|
943
|
-
hideNewMessageSeparator: !1,
|
|
944
|
-
messageActions: []
|
|
945
|
-
}
|
|
946
|
-
) }),
|
|
947
|
-
/* @__PURE__ */ e(
|
|
948
|
-
hs,
|
|
949
|
-
{
|
|
950
|
-
renderActions: () => n == null ? void 0 : n(g)
|
|
951
|
-
}
|
|
952
|
-
)
|
|
953
|
-
] }),
|
|
1129
|
+
return /* @__PURE__ */ i(Ne, { children: [
|
|
954
1130
|
/* @__PURE__ */ e(
|
|
955
|
-
|
|
1131
|
+
Ds,
|
|
1132
|
+
{
|
|
1133
|
+
overrides: {
|
|
1134
|
+
Message: (d) => /* @__PURE__ */ e(Ks, { ...d })
|
|
1135
|
+
},
|
|
1136
|
+
children: /* @__PURE__ */ i(Fs, { children: [
|
|
1137
|
+
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
1138
|
+
it,
|
|
1139
|
+
{
|
|
1140
|
+
onBack: t,
|
|
1141
|
+
showBackButton: s,
|
|
1142
|
+
onShowInfo: T,
|
|
1143
|
+
canShowInfo: !!f
|
|
1144
|
+
}
|
|
1145
|
+
) }),
|
|
1146
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1147
|
+
Ls,
|
|
1148
|
+
{
|
|
1149
|
+
hideDeletedMessages: !0,
|
|
1150
|
+
hideNewMessageSeparator: !1,
|
|
1151
|
+
messageActions: void 0
|
|
1152
|
+
}
|
|
1153
|
+
) }),
|
|
1154
|
+
/* @__PURE__ */ e(
|
|
1155
|
+
rt,
|
|
1156
|
+
{
|
|
1157
|
+
renderActions: () => n == null ? void 0 : n(x)
|
|
1158
|
+
}
|
|
1159
|
+
)
|
|
1160
|
+
] })
|
|
1161
|
+
}
|
|
1162
|
+
),
|
|
1163
|
+
/* @__PURE__ */ e(
|
|
1164
|
+
ct,
|
|
956
1165
|
{
|
|
957
1166
|
dialogRef: w,
|
|
958
|
-
onClose:
|
|
1167
|
+
onClose: p,
|
|
959
1168
|
participant: f,
|
|
960
|
-
channel:
|
|
961
|
-
followerStatusLabel:
|
|
1169
|
+
channel: x,
|
|
1170
|
+
followerStatusLabel: l,
|
|
962
1171
|
onLeaveConversation: r,
|
|
963
|
-
onBlockParticipant:
|
|
964
|
-
showDeleteConversation:
|
|
965
|
-
onDeleteConversationClick:
|
|
966
|
-
onBlockParticipantClick:
|
|
967
|
-
onReportParticipantClick:
|
|
1172
|
+
onBlockParticipant: o,
|
|
1173
|
+
showDeleteConversation: c,
|
|
1174
|
+
onDeleteConversationClick: a,
|
|
1175
|
+
onBlockParticipantClick: u,
|
|
1176
|
+
onReportParticipantClick: g
|
|
968
1177
|
}
|
|
969
1178
|
)
|
|
970
1179
|
] });
|
|
971
|
-
},
|
|
1180
|
+
}, Ue = P.memo(
|
|
972
1181
|
({
|
|
973
1182
|
channel: t,
|
|
974
1183
|
onBack: s,
|
|
975
1184
|
showBackButton: n = !1,
|
|
976
1185
|
renderMessageInputActions: r,
|
|
977
|
-
onLeaveConversation:
|
|
978
|
-
onBlockParticipant:
|
|
979
|
-
className:
|
|
980
|
-
CustomChannelEmptyState:
|
|
981
|
-
showDeleteConversation:
|
|
982
|
-
onDeleteConversationClick:
|
|
1186
|
+
onLeaveConversation: o,
|
|
1187
|
+
onBlockParticipant: c,
|
|
1188
|
+
className: a,
|
|
1189
|
+
CustomChannelEmptyState: u = lt,
|
|
1190
|
+
showDeleteConversation: g = !0,
|
|
1191
|
+
onDeleteConversationClick: x,
|
|
983
1192
|
onBlockParticipantClick: w,
|
|
984
1193
|
onReportParticipantClick: f
|
|
985
1194
|
}) => /* @__PURE__ */ e(
|
|
986
1195
|
"div",
|
|
987
1196
|
{
|
|
988
|
-
className:
|
|
1197
|
+
className: S(
|
|
989
1198
|
"messaging-channel-view h-full flex flex-col",
|
|
990
|
-
|
|
1199
|
+
a
|
|
991
1200
|
),
|
|
992
1201
|
children: /* @__PURE__ */ e(
|
|
993
|
-
|
|
1202
|
+
Ts,
|
|
994
1203
|
{
|
|
995
1204
|
channel: t,
|
|
996
|
-
MessageSystem:
|
|
997
|
-
EmptyStateIndicator:
|
|
998
|
-
LoadingIndicator:
|
|
1205
|
+
MessageSystem: at,
|
|
1206
|
+
EmptyStateIndicator: u,
|
|
1207
|
+
LoadingIndicator: fe,
|
|
1208
|
+
DateSeparator: Vs,
|
|
999
1209
|
children: /* @__PURE__ */ e(
|
|
1000
|
-
|
|
1210
|
+
dt,
|
|
1001
1211
|
{
|
|
1002
1212
|
onBack: s,
|
|
1003
1213
|
showBackButton: n,
|
|
1004
1214
|
renderMessageInputActions: r,
|
|
1005
|
-
onLeaveConversation:
|
|
1006
|
-
onBlockParticipant:
|
|
1007
|
-
CustomChannelEmptyState:
|
|
1008
|
-
showDeleteConversation:
|
|
1009
|
-
onDeleteConversationClick:
|
|
1215
|
+
onLeaveConversation: o,
|
|
1216
|
+
onBlockParticipant: c,
|
|
1217
|
+
CustomChannelEmptyState: u,
|
|
1218
|
+
showDeleteConversation: g,
|
|
1219
|
+
onDeleteConversationClick: x,
|
|
1010
1220
|
onBlockParticipantClick: w,
|
|
1011
1221
|
onReportParticipantClick: f
|
|
1012
1222
|
}
|
|
@@ -1016,16 +1226,16 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1016
1226
|
}
|
|
1017
1227
|
)
|
|
1018
1228
|
);
|
|
1019
|
-
|
|
1020
|
-
function
|
|
1229
|
+
Ue.displayName = "ChannelView";
|
|
1230
|
+
function mt({
|
|
1021
1231
|
searchQuery: t,
|
|
1022
1232
|
setSearchQuery: s,
|
|
1023
1233
|
placeholder: n
|
|
1024
1234
|
}) {
|
|
1025
|
-
const r =
|
|
1026
|
-
return /* @__PURE__ */
|
|
1235
|
+
const r = W(null);
|
|
1236
|
+
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1027
1237
|
/* @__PURE__ */ e(
|
|
1028
|
-
|
|
1238
|
+
As,
|
|
1029
1239
|
{
|
|
1030
1240
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1031
1241
|
weight: "bold"
|
|
@@ -1038,162 +1248,162 @@ function vs({
|
|
|
1038
1248
|
type: "text",
|
|
1039
1249
|
placeholder: n,
|
|
1040
1250
|
value: t,
|
|
1041
|
-
onChange: (
|
|
1251
|
+
onChange: (o) => s(o.target.value),
|
|
1042
1252
|
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"
|
|
1043
1253
|
}
|
|
1044
1254
|
),
|
|
1045
1255
|
t && /* @__PURE__ */ e(
|
|
1046
|
-
|
|
1256
|
+
Le,
|
|
1047
1257
|
{
|
|
1048
1258
|
label: "Clear search",
|
|
1049
1259
|
onClick: () => {
|
|
1050
|
-
var
|
|
1051
|
-
s(""), (
|
|
1260
|
+
var o;
|
|
1261
|
+
s(""), (o = r.current) == null || o.focus();
|
|
1052
1262
|
},
|
|
1053
1263
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1054
|
-
children: /* @__PURE__ */ e(
|
|
1264
|
+
children: /* @__PURE__ */ e(be, { className: "h-4 w-4", weight: "bold" })
|
|
1055
1265
|
}
|
|
1056
1266
|
)
|
|
1057
1267
|
] });
|
|
1058
1268
|
}
|
|
1059
|
-
const
|
|
1269
|
+
const ut = ({
|
|
1060
1270
|
participantSource: t,
|
|
1061
1271
|
onSelectParticipant: s,
|
|
1062
1272
|
onClose: n,
|
|
1063
1273
|
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
1064
|
-
participantLabel:
|
|
1065
|
-
searchPlaceholder:
|
|
1066
|
-
className:
|
|
1274
|
+
participantLabel: o = "participants",
|
|
1275
|
+
searchPlaceholder: c = "Search participants...",
|
|
1276
|
+
className: a
|
|
1067
1277
|
}) => {
|
|
1068
|
-
const { debug:
|
|
1278
|
+
const { debug: u } = ge(), [g, x] = y(""), [w, f] = y([]), [l, T] = y(!1), [p, d] = y(null), [N, E] = y(
|
|
1069
1279
|
null
|
|
1070
|
-
), I =
|
|
1071
|
-
|
|
1280
|
+
), I = W(!1);
|
|
1281
|
+
q(() => {
|
|
1072
1282
|
if (t.loading) {
|
|
1073
|
-
|
|
1283
|
+
u && console.log(
|
|
1074
1284
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1075
1285
|
);
|
|
1076
1286
|
return;
|
|
1077
1287
|
}
|
|
1078
1288
|
if (I.current) return;
|
|
1079
1289
|
(async () => {
|
|
1080
|
-
|
|
1290
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), T(!0), d(null);
|
|
1081
1291
|
try {
|
|
1082
|
-
const
|
|
1292
|
+
const h = await t.loadParticipants({
|
|
1083
1293
|
search: "",
|
|
1084
1294
|
// Load all participants initially
|
|
1085
1295
|
limit: 100
|
|
1086
1296
|
});
|
|
1087
|
-
f(
|
|
1297
|
+
f(h.participants), I.current = !0, u && console.log(
|
|
1088
1298
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1089
|
-
|
|
1299
|
+
h.participants.length
|
|
1090
1300
|
);
|
|
1091
|
-
} catch (
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1301
|
+
} catch (h) {
|
|
1302
|
+
const v = h instanceof Error ? h.message : "Failed to load participants";
|
|
1303
|
+
d(v), console.error("[ParticipantPicker] Failed to load participants:", h);
|
|
1094
1304
|
} finally {
|
|
1095
|
-
|
|
1305
|
+
T(!1);
|
|
1096
1306
|
}
|
|
1097
1307
|
})();
|
|
1098
|
-
}, [t.loading,
|
|
1099
|
-
const
|
|
1100
|
-
var
|
|
1101
|
-
if (!
|
|
1102
|
-
const
|
|
1103
|
-
return
|
|
1104
|
-
}),
|
|
1105
|
-
async (
|
|
1308
|
+
}, [t.loading, u]);
|
|
1309
|
+
const _ = w.filter((m) => !r.has(m.id)).filter((m) => {
|
|
1310
|
+
var v;
|
|
1311
|
+
if (!g) return !0;
|
|
1312
|
+
const h = g.toLowerCase();
|
|
1313
|
+
return m.name.toLowerCase().includes(h) || ((v = m.email) == null ? void 0 : v.toLowerCase().includes(h)) || !1;
|
|
1314
|
+
}), C = D(
|
|
1315
|
+
async (m) => {
|
|
1106
1316
|
if (!N) {
|
|
1107
|
-
E(
|
|
1317
|
+
E(m.id);
|
|
1108
1318
|
try {
|
|
1109
|
-
await s(
|
|
1110
|
-
} catch (
|
|
1111
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1319
|
+
await s(m);
|
|
1320
|
+
} catch (h) {
|
|
1321
|
+
console.error("[ParticipantPicker] Failed to start chat:", h), E(null);
|
|
1112
1322
|
}
|
|
1113
1323
|
}
|
|
1114
1324
|
},
|
|
1115
1325
|
[s, N]
|
|
1116
|
-
),
|
|
1117
|
-
(
|
|
1326
|
+
), M = (m, h) => {
|
|
1327
|
+
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), C(h));
|
|
1118
1328
|
};
|
|
1119
|
-
return /* @__PURE__ */
|
|
1120
|
-
/* @__PURE__ */
|
|
1121
|
-
/* @__PURE__ */
|
|
1329
|
+
return /* @__PURE__ */ i("div", { className: S("flex flex-col h-full", a), children: [
|
|
1330
|
+
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1331
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1122
1332
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1123
|
-
/* @__PURE__ */ e(
|
|
1333
|
+
/* @__PURE__ */ e(Oe, { onClick: n })
|
|
1124
1334
|
] }),
|
|
1125
|
-
/* @__PURE__ */
|
|
1335
|
+
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1126
1336
|
"Select a ",
|
|
1127
|
-
|
|
1337
|
+
o.slice(0, -1),
|
|
1128
1338
|
" to start messaging (",
|
|
1129
|
-
|
|
1339
|
+
_.length,
|
|
1130
1340
|
" available)",
|
|
1131
|
-
t.totalCount !== void 0 && ` • ${t.totalCount} ${
|
|
1341
|
+
t.totalCount !== void 0 && ` • ${t.totalCount} ${o} total`
|
|
1132
1342
|
] }),
|
|
1133
1343
|
/* @__PURE__ */ e(
|
|
1134
|
-
|
|
1344
|
+
mt,
|
|
1135
1345
|
{
|
|
1136
|
-
searchQuery:
|
|
1137
|
-
setSearchQuery:
|
|
1138
|
-
placeholder:
|
|
1346
|
+
searchQuery: g,
|
|
1347
|
+
setSearchQuery: x,
|
|
1348
|
+
placeholder: c
|
|
1139
1349
|
}
|
|
1140
1350
|
)
|
|
1141
1351
|
] }),
|
|
1142
|
-
|
|
1352
|
+
p && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1143
1353
|
"Error loading ",
|
|
1144
|
-
|
|
1354
|
+
o,
|
|
1145
1355
|
": ",
|
|
1146
|
-
|
|
1356
|
+
p
|
|
1147
1357
|
] }),
|
|
1148
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
1358
|
+
/* @__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: [
|
|
1149
1359
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1150
|
-
/* @__PURE__ */
|
|
1360
|
+
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1151
1361
|
"Loading ",
|
|
1152
|
-
|
|
1362
|
+
o,
|
|
1153
1363
|
"..."
|
|
1154
1364
|
] })
|
|
1155
|
-
] }) }) :
|
|
1156
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
1157
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children:
|
|
1158
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children:
|
|
1159
|
-
] }) : /* @__PURE__ */
|
|
1160
|
-
|
|
1161
|
-
const
|
|
1365
|
+
] }) }) : _.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1366
|
+
/* @__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" }) }),
|
|
1367
|
+
/* @__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` }),
|
|
1368
|
+
/* @__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` })
|
|
1369
|
+
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1370
|
+
_.map((m) => {
|
|
1371
|
+
const h = m.name || m.email || m.id, v = m.email && m.name ? m.email : m.phone;
|
|
1162
1372
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1163
1373
|
"button",
|
|
1164
1374
|
{
|
|
1165
1375
|
type: "button",
|
|
1166
|
-
onClick: () =>
|
|
1167
|
-
onKeyDown: (
|
|
1376
|
+
onClick: () => C(m),
|
|
1377
|
+
onKeyDown: (j) => M(j, m),
|
|
1168
1378
|
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",
|
|
1169
|
-
children: /* @__PURE__ */
|
|
1170
|
-
/* @__PURE__ */
|
|
1379
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1380
|
+
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1171
1381
|
/* @__PURE__ */ e(
|
|
1172
|
-
|
|
1382
|
+
ne,
|
|
1173
1383
|
{
|
|
1174
|
-
id:
|
|
1175
|
-
name:
|
|
1176
|
-
image:
|
|
1384
|
+
id: m.id,
|
|
1385
|
+
name: h,
|
|
1386
|
+
image: m.image,
|
|
1177
1387
|
size: 40
|
|
1178
1388
|
}
|
|
1179
1389
|
),
|
|
1180
|
-
/* @__PURE__ */
|
|
1181
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1182
|
-
|
|
1390
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1391
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: h }),
|
|
1392
|
+
v && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: v })
|
|
1183
1393
|
] })
|
|
1184
1394
|
] }),
|
|
1185
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N ===
|
|
1395
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === m.id ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ie, { className: "h-5 w-5 text-stone" }) })
|
|
1186
1396
|
] })
|
|
1187
1397
|
}
|
|
1188
|
-
) },
|
|
1398
|
+
) }, m.id);
|
|
1189
1399
|
}),
|
|
1190
|
-
|
|
1400
|
+
l && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1191
1401
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1192
1402
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1193
1403
|
] }) })
|
|
1194
1404
|
] }) })
|
|
1195
1405
|
] });
|
|
1196
|
-
},
|
|
1406
|
+
}, ht = ({ className: t }) => /* @__PURE__ */ i(
|
|
1197
1407
|
"svg",
|
|
1198
1408
|
{
|
|
1199
1409
|
width: "140",
|
|
@@ -1203,7 +1413,7 @@ const ws = ({
|
|
|
1203
1413
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1204
1414
|
className: t,
|
|
1205
1415
|
children: [
|
|
1206
|
-
/* @__PURE__ */
|
|
1416
|
+
/* @__PURE__ */ i("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1207
1417
|
/* @__PURE__ */ e(
|
|
1208
1418
|
"path",
|
|
1209
1419
|
{
|
|
@@ -1232,7 +1442,7 @@ const ws = ({
|
|
|
1232
1442
|
fill: "white"
|
|
1233
1443
|
}
|
|
1234
1444
|
),
|
|
1235
|
-
/* @__PURE__ */
|
|
1445
|
+
/* @__PURE__ */ i("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1236
1446
|
/* @__PURE__ */ e(
|
|
1237
1447
|
"path",
|
|
1238
1448
|
{
|
|
@@ -1272,8 +1482,8 @@ const ws = ({
|
|
|
1272
1482
|
}
|
|
1273
1483
|
)
|
|
1274
1484
|
] }),
|
|
1275
|
-
/* @__PURE__ */
|
|
1276
|
-
/* @__PURE__ */
|
|
1485
|
+
/* @__PURE__ */ i("defs", { children: [
|
|
1486
|
+
/* @__PURE__ */ i(
|
|
1277
1487
|
"filter",
|
|
1278
1488
|
{
|
|
1279
1489
|
id: "filter0_empty_state",
|
|
@@ -1327,17 +1537,17 @@ const ws = ({
|
|
|
1327
1537
|
] })
|
|
1328
1538
|
]
|
|
1329
1539
|
}
|
|
1330
|
-
),
|
|
1331
|
-
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */
|
|
1332
|
-
/* @__PURE__ */ e(
|
|
1333
|
-
s && !t && /* @__PURE__ */
|
|
1540
|
+
), Be = P.memo(
|
|
1541
|
+
({ 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: [
|
|
1542
|
+
/* @__PURE__ */ e(ht, {}),
|
|
1543
|
+
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
1334
1544
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1335
1545
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1336
1546
|
] })
|
|
1337
1547
|
] }) })
|
|
1338
1548
|
);
|
|
1339
|
-
|
|
1340
|
-
const
|
|
1549
|
+
Be.displayName = "EmptyState";
|
|
1550
|
+
const he = 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: [
|
|
1341
1551
|
/* @__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: "⚠️" }) }),
|
|
1342
1552
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1343
1553
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1351,117 +1561,117 @@ const le = U.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1351
1561
|
}
|
|
1352
1562
|
)
|
|
1353
1563
|
] }) }));
|
|
1354
|
-
|
|
1355
|
-
const
|
|
1564
|
+
he.displayName = "ErrorState";
|
|
1565
|
+
const yt = ({
|
|
1356
1566
|
capabilities: t = {},
|
|
1357
1567
|
className: s,
|
|
1358
1568
|
renderMessageInputActions: n,
|
|
1359
1569
|
onChannelSelect: r,
|
|
1360
|
-
onParticipantSelect:
|
|
1361
|
-
initialParticipantFilter:
|
|
1362
|
-
initialParticipantData:
|
|
1363
|
-
CustomChannelEmptyState:
|
|
1364
|
-
showChannelList:
|
|
1365
|
-
filters:
|
|
1570
|
+
onParticipantSelect: o,
|
|
1571
|
+
initialParticipantFilter: c,
|
|
1572
|
+
initialParticipantData: a,
|
|
1573
|
+
CustomChannelEmptyState: u,
|
|
1574
|
+
showChannelList: g = !0,
|
|
1575
|
+
filters: x,
|
|
1366
1576
|
channelListCustomEmptyStateIndicator: w,
|
|
1367
1577
|
onDeleteConversationClick: f,
|
|
1368
|
-
onBlockParticipantClick:
|
|
1369
|
-
onReportParticipantClick:
|
|
1578
|
+
onBlockParticipantClick: l,
|
|
1579
|
+
onReportParticipantClick: T
|
|
1370
1580
|
}) => {
|
|
1371
1581
|
const {
|
|
1372
|
-
service:
|
|
1373
|
-
client:
|
|
1582
|
+
service: p,
|
|
1583
|
+
client: d,
|
|
1374
1584
|
isConnected: N,
|
|
1375
1585
|
isLoading: E,
|
|
1376
1586
|
error: I,
|
|
1377
|
-
refreshConnection:
|
|
1378
|
-
debug:
|
|
1379
|
-
} =
|
|
1380
|
-
participantSource:
|
|
1381
|
-
participantLabel:
|
|
1382
|
-
showDeleteConversation:
|
|
1383
|
-
} = t,
|
|
1384
|
-
const
|
|
1587
|
+
refreshConnection: _,
|
|
1588
|
+
debug: C
|
|
1589
|
+
} = $s(), [M, m] = y(null), [h, v] = y(!1), [j, A] = y(!1), [Z, Y] = y(!1), [re, ee] = y(/* @__PURE__ */ new Set()), [se, ae] = y(0), [U, G] = y(!1), [J, z] = y(null), k = W(null), {
|
|
1590
|
+
participantSource: F,
|
|
1591
|
+
participantLabel: B = "participants",
|
|
1592
|
+
showDeleteConversation: H = !0
|
|
1593
|
+
} = t, Q = P.useMemo(() => {
|
|
1594
|
+
const b = d == null ? void 0 : d.userID;
|
|
1385
1595
|
return {
|
|
1386
1596
|
...{
|
|
1387
1597
|
type: "messaging",
|
|
1388
1598
|
last_message_at: { $exists: !0 },
|
|
1389
|
-
...
|
|
1390
|
-
members: { $in: [
|
|
1599
|
+
...b && {
|
|
1600
|
+
members: { $in: [b] },
|
|
1391
1601
|
hidden: !1
|
|
1392
1602
|
}
|
|
1393
1603
|
},
|
|
1394
|
-
...
|
|
1604
|
+
...x
|
|
1395
1605
|
};
|
|
1396
|
-
}, [
|
|
1397
|
-
if (!
|
|
1398
|
-
const
|
|
1399
|
-
if (
|
|
1606
|
+
}, [x, d == null ? void 0 : d.userID]), X = W(null), $ = D(async () => {
|
|
1607
|
+
if (!d || !N) return;
|
|
1608
|
+
const b = d.userID;
|
|
1609
|
+
if (b)
|
|
1400
1610
|
try {
|
|
1401
|
-
|
|
1402
|
-
const
|
|
1611
|
+
C && console.log("[MessagingShell] Syncing channels for user:", b);
|
|
1612
|
+
const O = await d.queryChannels(
|
|
1403
1613
|
{
|
|
1404
1614
|
type: "messaging",
|
|
1405
|
-
members: { $in: [
|
|
1615
|
+
members: { $in: [b] }
|
|
1406
1616
|
},
|
|
1407
1617
|
{},
|
|
1408
1618
|
{ limit: 100 }
|
|
1409
|
-
),
|
|
1410
|
-
|
|
1411
|
-
const
|
|
1412
|
-
Object.values(
|
|
1413
|
-
var
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1619
|
+
), R = /* @__PURE__ */ new Set();
|
|
1620
|
+
O.forEach((L) => {
|
|
1621
|
+
const oe = L.state.members;
|
|
1622
|
+
Object.values(oe).forEach((Ae) => {
|
|
1623
|
+
var ve;
|
|
1624
|
+
const Ce = (ve = Ae.user) == null ? void 0 : ve.id;
|
|
1625
|
+
Ce && Ce !== b && R.add(Ce);
|
|
1416
1626
|
});
|
|
1417
|
-
}),
|
|
1418
|
-
channelCount:
|
|
1419
|
-
memberCount:
|
|
1627
|
+
}), ee((L) => L.size === R.size && [...L].every((oe) => R.has(oe)) ? L : R), v(O.length > 0), A(!0), X.current = b, C && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1628
|
+
channelCount: O.length,
|
|
1629
|
+
memberCount: R.size
|
|
1420
1630
|
});
|
|
1421
|
-
} catch (
|
|
1422
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1631
|
+
} catch (O) {
|
|
1632
|
+
console.error("[MessagingShell] Failed to sync channels:", O);
|
|
1423
1633
|
}
|
|
1424
|
-
}, [
|
|
1425
|
-
|
|
1426
|
-
if (!
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1429
|
-
}, [
|
|
1430
|
-
if (!
|
|
1634
|
+
}, [d, N, C]);
|
|
1635
|
+
q(() => {
|
|
1636
|
+
if (!d || !N) return;
|
|
1637
|
+
const b = d.userID;
|
|
1638
|
+
b && X.current !== b && $();
|
|
1639
|
+
}, [d, N, $]), q(() => {
|
|
1640
|
+
if (!c || !d || !N) return;
|
|
1431
1641
|
(async () => {
|
|
1432
|
-
const
|
|
1433
|
-
if (
|
|
1642
|
+
const O = d.userID;
|
|
1643
|
+
if (O)
|
|
1434
1644
|
try {
|
|
1435
|
-
|
|
1645
|
+
C && console.log(
|
|
1436
1646
|
"[MessagingShell] Loading initial conversation with:",
|
|
1437
|
-
|
|
1647
|
+
c
|
|
1438
1648
|
);
|
|
1439
|
-
const
|
|
1649
|
+
const R = await d.queryChannels(
|
|
1440
1650
|
{
|
|
1441
1651
|
type: "messaging",
|
|
1442
|
-
members: { $eq: [
|
|
1652
|
+
members: { $eq: [O, c] }
|
|
1443
1653
|
},
|
|
1444
1654
|
{},
|
|
1445
1655
|
{ limit: 1 }
|
|
1446
1656
|
);
|
|
1447
|
-
if (
|
|
1448
|
-
|
|
1657
|
+
if (R.length > 0)
|
|
1658
|
+
m(R[0]), G(!0), z(null), r && r(R[0]), C && console.log(
|
|
1449
1659
|
"[MessagingShell] Initial conversation loaded:",
|
|
1450
|
-
|
|
1660
|
+
R[0].id
|
|
1451
1661
|
);
|
|
1452
|
-
else if (
|
|
1453
|
-
|
|
1662
|
+
else if (a && p) {
|
|
1663
|
+
C && console.log(
|
|
1454
1664
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1455
|
-
|
|
1665
|
+
a
|
|
1456
1666
|
);
|
|
1457
1667
|
try {
|
|
1458
|
-
const L = await
|
|
1459
|
-
id:
|
|
1460
|
-
name:
|
|
1461
|
-
email:
|
|
1462
|
-
phone:
|
|
1668
|
+
const L = await p.startChannelWithParticipant({
|
|
1669
|
+
id: a.id,
|
|
1670
|
+
name: a.name,
|
|
1671
|
+
email: a.email,
|
|
1672
|
+
phone: a.phone
|
|
1463
1673
|
});
|
|
1464
|
-
|
|
1674
|
+
m(L), G(!0), z(null), r && r(L), C && console.log(
|
|
1465
1675
|
"[MessagingShell] Channel created and loaded:",
|
|
1466
1676
|
L.id
|
|
1467
1677
|
);
|
|
@@ -1469,117 +1679,117 @@ const Fs = ({
|
|
|
1469
1679
|
console.error(
|
|
1470
1680
|
"[MessagingShell] Failed to create conversation:",
|
|
1471
1681
|
L
|
|
1472
|
-
),
|
|
1682
|
+
), z("Failed to create conversation");
|
|
1473
1683
|
}
|
|
1474
1684
|
} else
|
|
1475
|
-
|
|
1685
|
+
z(
|
|
1476
1686
|
"No conversation found with this account"
|
|
1477
|
-
),
|
|
1687
|
+
), C && console.log(
|
|
1478
1688
|
"[MessagingShell] No conversation found for:",
|
|
1479
|
-
|
|
1689
|
+
c
|
|
1480
1690
|
);
|
|
1481
|
-
} catch (
|
|
1691
|
+
} catch (R) {
|
|
1482
1692
|
console.error(
|
|
1483
1693
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1484
|
-
|
|
1485
|
-
),
|
|
1694
|
+
R
|
|
1695
|
+
), z("Failed to load conversation");
|
|
1486
1696
|
}
|
|
1487
1697
|
})();
|
|
1488
1698
|
}, [
|
|
1489
|
-
i,
|
|
1490
|
-
l,
|
|
1491
1699
|
c,
|
|
1700
|
+
a,
|
|
1701
|
+
d,
|
|
1492
1702
|
N,
|
|
1493
|
-
|
|
1494
|
-
|
|
1703
|
+
p,
|
|
1704
|
+
C,
|
|
1495
1705
|
r
|
|
1496
1706
|
]);
|
|
1497
|
-
const
|
|
1498
|
-
(
|
|
1499
|
-
|
|
1707
|
+
const xe = D(
|
|
1708
|
+
(b) => {
|
|
1709
|
+
m(b), r == null || r(b);
|
|
1500
1710
|
},
|
|
1501
1711
|
[r]
|
|
1502
|
-
),
|
|
1503
|
-
|
|
1504
|
-
}, [
|
|
1505
|
-
async (
|
|
1506
|
-
var
|
|
1507
|
-
if (
|
|
1712
|
+
), ie = D(() => {
|
|
1713
|
+
U || m(null);
|
|
1714
|
+
}, [U]), ce = D(
|
|
1715
|
+
async (b) => {
|
|
1716
|
+
var O;
|
|
1717
|
+
if (p)
|
|
1508
1718
|
try {
|
|
1509
|
-
|
|
1719
|
+
C && console.log(
|
|
1510
1720
|
"[MessagingShell] Starting conversation with:",
|
|
1511
|
-
|
|
1721
|
+
b.id
|
|
1512
1722
|
);
|
|
1513
|
-
const
|
|
1514
|
-
id:
|
|
1515
|
-
name:
|
|
1516
|
-
email:
|
|
1517
|
-
phone:
|
|
1723
|
+
const R = await p.startChannelWithParticipant({
|
|
1724
|
+
id: b.id,
|
|
1725
|
+
name: b.name,
|
|
1726
|
+
email: b.email,
|
|
1727
|
+
phone: b.phone
|
|
1518
1728
|
});
|
|
1519
1729
|
try {
|
|
1520
|
-
await
|
|
1730
|
+
await R.show();
|
|
1521
1731
|
} catch (L) {
|
|
1522
1732
|
console.warn("[MessagingShell] Failed to unhide channel:", L);
|
|
1523
1733
|
}
|
|
1524
|
-
|
|
1525
|
-
} catch (
|
|
1526
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1734
|
+
m(R), Y(!1), (O = k.current) == null || O.close(), o == null || o(b);
|
|
1735
|
+
} catch (R) {
|
|
1736
|
+
console.error("[MessagingShell] Failed to start conversation:", R);
|
|
1527
1737
|
}
|
|
1528
1738
|
},
|
|
1529
|
-
[
|
|
1530
|
-
),
|
|
1531
|
-
var
|
|
1532
|
-
Y(!1), (
|
|
1533
|
-
}, []),
|
|
1534
|
-
(
|
|
1535
|
-
|
|
1739
|
+
[p, o, C]
|
|
1740
|
+
), K = D(() => {
|
|
1741
|
+
var b;
|
|
1742
|
+
Y(!1), (b = k.current) == null || b.close();
|
|
1743
|
+
}, []), de = D(
|
|
1744
|
+
(b) => {
|
|
1745
|
+
b.target === k.current && K();
|
|
1536
1746
|
},
|
|
1537
|
-
[
|
|
1538
|
-
),
|
|
1539
|
-
async (
|
|
1540
|
-
|
|
1747
|
+
[K]
|
|
1748
|
+
), le = D(
|
|
1749
|
+
async (b) => {
|
|
1750
|
+
C && console.log("[MessagingShell] Leaving conversation:", b.id), m(null), G(!1), X.current = null, await $();
|
|
1541
1751
|
},
|
|
1542
|
-
[
|
|
1543
|
-
),
|
|
1544
|
-
async (
|
|
1545
|
-
|
|
1752
|
+
[$, C]
|
|
1753
|
+
), V = D(
|
|
1754
|
+
async (b) => {
|
|
1755
|
+
C && console.log("[MessagingShell] Blocking participant:", b), m(null), G(!1), X.current = null, await $();
|
|
1546
1756
|
},
|
|
1547
|
-
[
|
|
1548
|
-
), te = !!
|
|
1549
|
-
return E ? /* @__PURE__ */ e("div", { className:
|
|
1550
|
-
|
|
1757
|
+
[$, C]
|
|
1758
|
+
), te = !!M;
|
|
1759
|
+
return E ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(fe, {}) }) : I ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(he, { message: I, onBack: _ }) }) : !N || !d ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(
|
|
1760
|
+
he,
|
|
1551
1761
|
{
|
|
1552
1762
|
message: "Not connected to messaging service",
|
|
1553
|
-
onBack:
|
|
1763
|
+
onBack: _
|
|
1554
1764
|
}
|
|
1555
|
-
) }) : J ? /* @__PURE__ */ e("div", { className:
|
|
1765
|
+
) }) : J ? /* @__PURE__ */ e("div", { className: S("h-full", s), children: /* @__PURE__ */ e(he, { message: J }) }) : /* @__PURE__ */ i(
|
|
1556
1766
|
"div",
|
|
1557
1767
|
{
|
|
1558
|
-
className:
|
|
1768
|
+
className: S(
|
|
1559
1769
|
"messaging-shell h-full bg-background-primary overflow-hidden",
|
|
1560
1770
|
s
|
|
1561
1771
|
),
|
|
1562
1772
|
children: [
|
|
1563
|
-
/* @__PURE__ */
|
|
1773
|
+
/* @__PURE__ */ i("div", { className: "flex h-full min-h-0", children: [
|
|
1564
1774
|
/* @__PURE__ */ e(
|
|
1565
1775
|
"div",
|
|
1566
1776
|
{
|
|
1567
|
-
className:
|
|
1777
|
+
className: S(
|
|
1568
1778
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1569
1779
|
{
|
|
1570
|
-
"!hidden":
|
|
1780
|
+
"!hidden": g === !1 || U,
|
|
1571
1781
|
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
1572
|
-
"hidden lg:flex lg:flex-1 lg:max-w-2xl":
|
|
1782
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": g !== !1 && !U && te,
|
|
1573
1783
|
// Show on mobile when no channel selected, use same wide width on desktop
|
|
1574
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl":
|
|
1784
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": g !== !1 && !U && !te
|
|
1575
1785
|
}
|
|
1576
1786
|
),
|
|
1577
1787
|
children: /* @__PURE__ */ e(
|
|
1578
|
-
|
|
1788
|
+
Fe,
|
|
1579
1789
|
{
|
|
1580
|
-
onChannelSelect:
|
|
1581
|
-
selectedChannel:
|
|
1582
|
-
filters:
|
|
1790
|
+
onChannelSelect: xe,
|
|
1791
|
+
selectedChannel: M || void 0,
|
|
1792
|
+
filters: Q,
|
|
1583
1793
|
customEmptyStateIndicator: w
|
|
1584
1794
|
}
|
|
1585
1795
|
)
|
|
@@ -1588,70 +1798,70 @@ const Fs = ({
|
|
|
1588
1798
|
/* @__PURE__ */ e(
|
|
1589
1799
|
"div",
|
|
1590
1800
|
{
|
|
1591
|
-
className:
|
|
1801
|
+
className: S(
|
|
1592
1802
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1593
1803
|
{
|
|
1594
1804
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1595
|
-
flex:
|
|
1805
|
+
flex: U || te || c,
|
|
1596
1806
|
// Normal mode: hide on mobile when no channel selected
|
|
1597
|
-
"hidden lg:flex": !
|
|
1807
|
+
"hidden lg:flex": !U && !te && !c
|
|
1598
1808
|
}
|
|
1599
1809
|
),
|
|
1600
|
-
children:
|
|
1601
|
-
|
|
1810
|
+
children: M ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1811
|
+
Ue,
|
|
1602
1812
|
{
|
|
1603
|
-
channel:
|
|
1604
|
-
onBack:
|
|
1605
|
-
showBackButton: !
|
|
1813
|
+
channel: M,
|
|
1814
|
+
onBack: ie,
|
|
1815
|
+
showBackButton: !U,
|
|
1606
1816
|
renderMessageInputActions: n,
|
|
1607
|
-
onLeaveConversation:
|
|
1608
|
-
onBlockParticipant:
|
|
1609
|
-
CustomChannelEmptyState:
|
|
1610
|
-
showDeleteConversation:
|
|
1817
|
+
onLeaveConversation: le,
|
|
1818
|
+
onBlockParticipant: V,
|
|
1819
|
+
CustomChannelEmptyState: u,
|
|
1820
|
+
showDeleteConversation: H,
|
|
1611
1821
|
onDeleteConversationClick: f,
|
|
1612
|
-
onBlockParticipantClick:
|
|
1613
|
-
onReportParticipantClick:
|
|
1822
|
+
onBlockParticipantClick: l,
|
|
1823
|
+
onReportParticipantClick: T
|
|
1614
1824
|
},
|
|
1615
|
-
|
|
1616
|
-
) }) :
|
|
1825
|
+
M.id
|
|
1826
|
+
) }) : c ? (
|
|
1617
1827
|
// Show loading while creating/loading direct conversation channel
|
|
1618
|
-
/* @__PURE__ */ e(
|
|
1828
|
+
/* @__PURE__ */ e(fe, {})
|
|
1619
1829
|
) : /* @__PURE__ */ e(
|
|
1620
|
-
|
|
1830
|
+
Be,
|
|
1621
1831
|
{
|
|
1622
|
-
hasChannels:
|
|
1623
|
-
channelsLoaded:
|
|
1832
|
+
hasChannels: h,
|
|
1833
|
+
channelsLoaded: j
|
|
1624
1834
|
}
|
|
1625
1835
|
)
|
|
1626
1836
|
}
|
|
1627
1837
|
)
|
|
1628
1838
|
] }),
|
|
1629
|
-
|
|
1839
|
+
F && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1630
1840
|
/* @__PURE__ */ e(
|
|
1631
1841
|
"dialog",
|
|
1632
1842
|
{
|
|
1633
|
-
ref:
|
|
1843
|
+
ref: k,
|
|
1634
1844
|
className: "mes-dialog",
|
|
1635
|
-
onClick:
|
|
1636
|
-
onClose:
|
|
1845
|
+
onClick: de,
|
|
1846
|
+
onClose: K,
|
|
1637
1847
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1638
|
-
|
|
1848
|
+
ut,
|
|
1639
1849
|
{
|
|
1640
|
-
participantSource:
|
|
1641
|
-
onSelectParticipant:
|
|
1642
|
-
onClose:
|
|
1643
|
-
existingParticipantIds:
|
|
1644
|
-
participantLabel:
|
|
1645
|
-
searchPlaceholder: `Search ${
|
|
1850
|
+
participantSource: F,
|
|
1851
|
+
onSelectParticipant: ce,
|
|
1852
|
+
onClose: K,
|
|
1853
|
+
existingParticipantIds: re,
|
|
1854
|
+
participantLabel: B,
|
|
1855
|
+
searchPlaceholder: `Search ${B}...`
|
|
1646
1856
|
},
|
|
1647
|
-
|
|
1857
|
+
se
|
|
1648
1858
|
) })
|
|
1649
1859
|
}
|
|
1650
1860
|
)
|
|
1651
1861
|
]
|
|
1652
1862
|
}
|
|
1653
1863
|
);
|
|
1654
|
-
},
|
|
1864
|
+
}, ft = ({
|
|
1655
1865
|
question: t,
|
|
1656
1866
|
onClick: s,
|
|
1657
1867
|
loading: n = !1,
|
|
@@ -1663,7 +1873,7 @@ const Fs = ({
|
|
|
1663
1873
|
onClick: s,
|
|
1664
1874
|
disabled: n,
|
|
1665
1875
|
style: { backgroundColor: "#E6E5E3" },
|
|
1666
|
-
className:
|
|
1876
|
+
className: S(
|
|
1667
1877
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1668
1878
|
{
|
|
1669
1879
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1673,100 +1883,100 @@ const Fs = ({
|
|
|
1673
1883
|
),
|
|
1674
1884
|
children: t
|
|
1675
1885
|
}
|
|
1676
|
-
),
|
|
1886
|
+
), Et = ({
|
|
1677
1887
|
faqs: t,
|
|
1678
1888
|
onFaqClick: s,
|
|
1679
1889
|
loadingFaqId: n,
|
|
1680
1890
|
headerText: r,
|
|
1681
|
-
className:
|
|
1682
|
-
avatarImage:
|
|
1683
|
-
avatarName:
|
|
1891
|
+
className: o,
|
|
1892
|
+
avatarImage: c,
|
|
1893
|
+
avatarName: a
|
|
1684
1894
|
}) => {
|
|
1685
|
-
const
|
|
1686
|
-
return
|
|
1687
|
-
(
|
|
1688
|
-
|
|
1895
|
+
const u = t.filter((g) => g.enabled).sort((g, x) => (g.order ?? 0) - (x.order ?? 0));
|
|
1896
|
+
return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
1897
|
+
(c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1898
|
+
ne,
|
|
1689
1899
|
{
|
|
1690
|
-
id:
|
|
1691
|
-
name:
|
|
1692
|
-
image:
|
|
1900
|
+
id: a || "account",
|
|
1901
|
+
name: a || "Account",
|
|
1902
|
+
image: c,
|
|
1693
1903
|
size: 24,
|
|
1694
1904
|
shape: "circle"
|
|
1695
1905
|
}
|
|
1696
1906
|
) }),
|
|
1697
|
-
/* @__PURE__ */
|
|
1907
|
+
/* @__PURE__ */ i(
|
|
1698
1908
|
"div",
|
|
1699
1909
|
{
|
|
1700
1910
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
1701
1911
|
style: { backgroundColor: "#F1F0EE" },
|
|
1702
1912
|
children: [
|
|
1703
1913
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1704
|
-
|
|
1705
|
-
|
|
1914
|
+
u.map((g) => /* @__PURE__ */ e(
|
|
1915
|
+
ft,
|
|
1706
1916
|
{
|
|
1707
|
-
question:
|
|
1708
|
-
onClick: () => s(
|
|
1709
|
-
loading: n ===
|
|
1917
|
+
question: g.question,
|
|
1918
|
+
onClick: () => s(g.id),
|
|
1919
|
+
loading: n === g.id
|
|
1710
1920
|
},
|
|
1711
|
-
|
|
1921
|
+
g.id
|
|
1712
1922
|
))
|
|
1713
1923
|
]
|
|
1714
1924
|
}
|
|
1715
1925
|
)
|
|
1716
1926
|
] }) });
|
|
1717
|
-
},
|
|
1718
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [
|
|
1719
|
-
if (
|
|
1720
|
-
const
|
|
1721
|
-
|
|
1927
|
+
}, It = (t, s = {}) => {
|
|
1928
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [o, c] = y([]), [a, u] = y(!1), [g, x] = y(null), [w, f] = y(n), [l, T] = y(!0), [p, d] = y(), N = D(async (C = !1, M) => {
|
|
1929
|
+
if (a) return;
|
|
1930
|
+
const m = M !== void 0 ? M : w;
|
|
1931
|
+
u(!0), x(null);
|
|
1722
1932
|
try {
|
|
1723
|
-
const
|
|
1724
|
-
search:
|
|
1933
|
+
const h = await t.loadParticipants({
|
|
1934
|
+
search: m || void 0,
|
|
1725
1935
|
limit: r,
|
|
1726
|
-
cursor:
|
|
1936
|
+
cursor: C ? void 0 : p
|
|
1727
1937
|
});
|
|
1728
|
-
|
|
1729
|
-
(
|
|
1730
|
-
),
|
|
1731
|
-
} catch (
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1938
|
+
c(
|
|
1939
|
+
(v) => C ? h.participants : [...v, ...h.participants]
|
|
1940
|
+
), T(h.hasMore), d(h.nextCursor);
|
|
1941
|
+
} catch (h) {
|
|
1942
|
+
const v = h instanceof Error ? h.message : "Failed to load participants";
|
|
1943
|
+
x(v), console.error("[useParticipants] Load error:", h);
|
|
1734
1944
|
} finally {
|
|
1735
|
-
|
|
1945
|
+
u(!1);
|
|
1736
1946
|
}
|
|
1737
|
-
}, [t, w,
|
|
1738
|
-
|
|
1739
|
-
}, [
|
|
1740
|
-
f(
|
|
1741
|
-
}, [N]),
|
|
1742
|
-
|
|
1947
|
+
}, [t, w, p, r, a]), E = D(() => {
|
|
1948
|
+
l && !a && N(!1);
|
|
1949
|
+
}, [l, a, N]), I = D((C) => {
|
|
1950
|
+
f(C), d(void 0), N(!0, C);
|
|
1951
|
+
}, [N]), _ = D(() => {
|
|
1952
|
+
d(void 0), N(!0);
|
|
1743
1953
|
}, [N]);
|
|
1744
|
-
return
|
|
1954
|
+
return q(() => {
|
|
1745
1955
|
N(!0);
|
|
1746
1956
|
}, [t.loadParticipants]), {
|
|
1747
|
-
participants:
|
|
1748
|
-
loading:
|
|
1749
|
-
error:
|
|
1957
|
+
participants: o,
|
|
1958
|
+
loading: a,
|
|
1959
|
+
error: g,
|
|
1750
1960
|
searchQuery: w,
|
|
1751
|
-
hasMore:
|
|
1961
|
+
hasMore: l,
|
|
1752
1962
|
totalCount: t.totalCount,
|
|
1753
1963
|
loadMore: E,
|
|
1754
1964
|
search: I,
|
|
1755
|
-
refresh:
|
|
1965
|
+
refresh: _
|
|
1756
1966
|
};
|
|
1757
1967
|
};
|
|
1758
1968
|
export {
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1969
|
+
ne as Avatar,
|
|
1970
|
+
lt as ChannelEmptyState,
|
|
1971
|
+
Fe as ChannelList,
|
|
1972
|
+
Ue as ChannelView,
|
|
1973
|
+
Et as FaqList,
|
|
1974
|
+
ft as FaqListItem,
|
|
1975
|
+
pt as MessagingProvider,
|
|
1976
|
+
yt as MessagingShell,
|
|
1977
|
+
ut as ParticipantPicker,
|
|
1978
|
+
zs as formatRelativeTime,
|
|
1979
|
+
$s as useMessaging,
|
|
1980
|
+
It as useParticipants
|
|
1771
1981
|
};
|
|
1772
1982
|
//# sourceMappingURL=index.js.map
|