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