@linktr.ee/messaging-react 1.16.1 → 1.17.0-rc-1769690110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +34 -8
- package/dist/index.js +740 -725
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +32 -9
- package/src/components/MessagingShell/index.tsx +4 -0
- package/src/index.ts +1 -0
- package/src/stream-custom-data.ts +13 -10
- 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,76 +35,76 @@ 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), [N, v] = I(null), b = 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
104
|
isConnecting: b.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
|
}
|
|
@@ -112,7 +112,7 @@ const Fe = Ge({
|
|
|
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 }), b.current = !0,
|
|
123
|
+
a("🚀 STARTING USER CONNECTION", { userId: s.id }), b.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), b.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: !!N,
|
|
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: N,
|
|
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
|
+
N,
|
|
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 b,
|
|
362
|
-
const
|
|
361
|
+
var b, 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
364
|
}, h = Object.values(((b = t == null ? void 0 : t.state) == null ? void 0 : b.members) || {}).find(
|
|
365
|
-
(
|
|
366
|
-
var
|
|
367
|
-
return ((
|
|
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)) : "", N = 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
|
+
N && "✨ ",
|
|
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: b } =
|
|
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: N,
|
|
540
|
+
threadList: v
|
|
541
|
+
} = t, { client: b } = 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 && b.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: N
|
|
652
652
|
}
|
|
653
|
-
) : /* @__PURE__ */ e(
|
|
654
|
-
/* @__PURE__ */ e(
|
|
653
|
+
) : /* @__PURE__ */ e(ws, { message: o, renderText: N }),
|
|
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,26 +829,26 @@ 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, N, 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 b = (
|
|
849
|
-
var
|
|
850
|
-
|
|
851
|
-
|
|
847
|
+
W(() => {
|
|
848
|
+
const b = (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
854
|
return l.on("member.updated", b), () => {
|
|
@@ -865,13 +865,13 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
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: ((N = d == null ? void 0 : d.user) == null ? void 0 : N.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), [N, v] = I(!1), [b, 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 (!N) {
|
|
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,
|
|
1029
|
+
}, R = async () => {
|
|
1030
|
+
var k, F, P;
|
|
1031
1031
|
if (!(b || !f)) {
|
|
1032
|
-
|
|
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,
|
|
1041
|
+
}, x = async () => {
|
|
1042
|
+
var k, F, P;
|
|
1043
1043
|
if (!(b || !f)) {
|
|
1044
|
-
|
|
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: N,
|
|
1122
|
+
"aria-busy": N,
|
|
1123
1123
|
children: [
|
|
1124
|
-
|
|
1124
|
+
N ? /* @__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:
|
|
1132
|
+
onClick: x,
|
|
1133
1133
|
disabled: b,
|
|
1134
1134
|
"aria-busy": b,
|
|
1135
1135
|
children: [
|
|
1136
|
-
b ? /* @__PURE__ */ e(
|
|
1136
|
+
b ? /* @__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:
|
|
1143
|
+
onClick: R,
|
|
1144
1144
|
disabled: b,
|
|
1145
1145
|
"aria-busy": b,
|
|
1146
1146
|
children: [
|
|
1147
|
-
b ? /* @__PURE__ */ e(
|
|
1147
|
+
b ? /* @__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
|
-
(
|
|
1173
|
+
const { channel: g } = Le(), p = V(null), f = B.useMemo(() => Object.values(g.state.members || {}).find(
|
|
1174
|
+
(v) => {
|
|
1175
1175
|
var b;
|
|
1176
|
-
return ((b =
|
|
1176
|
+
return ((b = v.user) == null ? void 0 : b.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 N = g.data ?? {};
|
|
1180
|
+
if (N.followerStatus)
|
|
1181
|
+
return String(N.followerStatus);
|
|
1182
|
+
if (N.isFollower !== void 0)
|
|
1183
|
+
return N.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1184
|
+
}, [g.data]), S = D(() => {
|
|
1185
|
+
var N;
|
|
1186
|
+
(N = p.current) == null || N.showModal();
|
|
1187
|
+
}, []), E = D(() => {
|
|
1188
|
+
var N;
|
|
1189
|
+
(N = p.current) == null || N.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: (N) => /* @__PURE__ */ e(st, { ...N })
|
|
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,96 @@ 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 N = D(
|
|
1261
|
+
async (v, b, u) => {
|
|
1262
|
+
var C;
|
|
1263
|
+
const w = ((C = t.data) == null ? void 0 : C.chatbot_paused) === !0, _ = o && !w, R = {
|
|
1264
|
+
...b,
|
|
1265
|
+
..._ && { silent: !0 },
|
|
1266
|
+
...S && {
|
|
1267
|
+
metadata: {
|
|
1268
|
+
...b.metadata ?? {},
|
|
1269
|
+
...S
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}, x = {
|
|
1273
|
+
...u,
|
|
1274
|
+
..._ && { skip_push: !0 }
|
|
1275
|
+
}, i = await t.sendMessage(R, x);
|
|
1276
|
+
return E == null || E(i), i;
|
|
1266
1277
|
},
|
|
1267
|
-
[t, o]
|
|
1278
|
+
[t, o, S, E]
|
|
1268
1279
|
);
|
|
1269
1280
|
return /* @__PURE__ */ e(
|
|
1270
1281
|
"div",
|
|
1271
1282
|
{
|
|
1272
|
-
className:
|
|
1283
|
+
className: M(
|
|
1273
1284
|
"messaging-channel-view h-full flex flex-col",
|
|
1274
1285
|
a
|
|
1275
1286
|
),
|
|
1276
1287
|
children: /* @__PURE__ */ e(
|
|
1277
|
-
|
|
1288
|
+
Ls,
|
|
1278
1289
|
{
|
|
1279
1290
|
channel: t,
|
|
1280
|
-
MessageSystem:
|
|
1281
|
-
EmptyStateIndicator:
|
|
1282
|
-
LoadingIndicator:
|
|
1283
|
-
DateSeparator:
|
|
1284
|
-
doSendMessageRequest:
|
|
1291
|
+
MessageSystem: ot,
|
|
1292
|
+
EmptyStateIndicator: m,
|
|
1293
|
+
LoadingIndicator: ge,
|
|
1294
|
+
DateSeparator: Xs,
|
|
1295
|
+
doSendMessageRequest: N,
|
|
1285
1296
|
children: /* @__PURE__ */ e(
|
|
1286
|
-
|
|
1297
|
+
ut,
|
|
1287
1298
|
{
|
|
1288
1299
|
onBack: s,
|
|
1289
1300
|
showBackButton: n,
|
|
1290
1301
|
renderMessageInputActions: r,
|
|
1291
1302
|
onLeaveConversation: l,
|
|
1292
|
-
onBlockParticipant:
|
|
1293
|
-
CustomChannelEmptyState:
|
|
1303
|
+
onBlockParticipant: d,
|
|
1304
|
+
CustomChannelEmptyState: m,
|
|
1294
1305
|
showDeleteConversation: h,
|
|
1295
|
-
onDeleteConversationClick:
|
|
1306
|
+
onDeleteConversationClick: g,
|
|
1296
1307
|
onBlockParticipantClick: p,
|
|
1297
1308
|
onReportParticipantClick: f
|
|
1298
1309
|
}
|
|
@@ -1303,16 +1314,16 @@ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
|
|
|
1303
1314
|
);
|
|
1304
1315
|
}
|
|
1305
1316
|
);
|
|
1306
|
-
|
|
1307
|
-
function
|
|
1317
|
+
ze.displayName = "ChannelView";
|
|
1318
|
+
function ht({
|
|
1308
1319
|
searchQuery: t,
|
|
1309
1320
|
setSearchQuery: s,
|
|
1310
1321
|
placeholder: n
|
|
1311
1322
|
}) {
|
|
1312
|
-
const r =
|
|
1313
|
-
return /* @__PURE__ */
|
|
1323
|
+
const r = V(null);
|
|
1324
|
+
return /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
1314
1325
|
/* @__PURE__ */ e(
|
|
1315
|
-
|
|
1326
|
+
zs,
|
|
1316
1327
|
{
|
|
1317
1328
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1318
1329
|
weight: "bold"
|
|
@@ -1330,7 +1341,7 @@ function mt({
|
|
|
1330
1341
|
}
|
|
1331
1342
|
),
|
|
1332
1343
|
t && /* @__PURE__ */ e(
|
|
1333
|
-
|
|
1344
|
+
je,
|
|
1334
1345
|
{
|
|
1335
1346
|
label: "Clear search",
|
|
1336
1347
|
onClick: () => {
|
|
@@ -1338,149 +1349,149 @@ function mt({
|
|
|
1338
1349
|
s(""), (l = r.current) == null || l.focus();
|
|
1339
1350
|
},
|
|
1340
1351
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1341
|
-
children: /* @__PURE__ */ e(
|
|
1352
|
+
children: /* @__PURE__ */ e(pe, { className: "h-4 w-4", weight: "bold" })
|
|
1342
1353
|
}
|
|
1343
1354
|
)
|
|
1344
1355
|
] });
|
|
1345
1356
|
}
|
|
1346
|
-
const
|
|
1357
|
+
const ft = ({
|
|
1347
1358
|
participantSource: t,
|
|
1348
1359
|
onSelectParticipant: s,
|
|
1349
1360
|
onClose: n,
|
|
1350
1361
|
existingParticipantIds: r = /* @__PURE__ */ new Set(),
|
|
1351
1362
|
participantLabel: l = "participants",
|
|
1352
|
-
searchPlaceholder:
|
|
1363
|
+
searchPlaceholder: d = "Search participants...",
|
|
1353
1364
|
className: a
|
|
1354
1365
|
}) => {
|
|
1355
|
-
const { debug:
|
|
1366
|
+
const { debug: m } = xe(), [h, g] = I(""), [p, f] = I([]), [o, S] = I(!1), [E, N] = I(null), [v, b] = I(
|
|
1356
1367
|
null
|
|
1357
|
-
),
|
|
1358
|
-
|
|
1368
|
+
), u = V(!1);
|
|
1369
|
+
W(() => {
|
|
1359
1370
|
if (t.loading) {
|
|
1360
|
-
|
|
1371
|
+
m && console.log(
|
|
1361
1372
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1362
1373
|
);
|
|
1363
1374
|
return;
|
|
1364
1375
|
}
|
|
1365
|
-
if (
|
|
1376
|
+
if (u.current) return;
|
|
1366
1377
|
(async () => {
|
|
1367
|
-
|
|
1378
|
+
m && console.log("[ParticipantPicker] Loading initial participants..."), S(!0), N(null);
|
|
1368
1379
|
try {
|
|
1369
|
-
const
|
|
1380
|
+
const i = await t.loadParticipants({
|
|
1370
1381
|
search: "",
|
|
1371
1382
|
// Load all participants initially
|
|
1372
1383
|
limit: 100
|
|
1373
1384
|
});
|
|
1374
|
-
f(
|
|
1385
|
+
f(i.participants), u.current = !0, m && console.log(
|
|
1375
1386
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
1376
|
-
|
|
1387
|
+
i.participants.length
|
|
1377
1388
|
);
|
|
1378
|
-
} catch (
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1389
|
+
} catch (i) {
|
|
1390
|
+
const C = i instanceof Error ? i.message : "Failed to load participants";
|
|
1391
|
+
N(C), console.error("[ParticipantPicker] Failed to load participants:", i);
|
|
1381
1392
|
} finally {
|
|
1382
|
-
|
|
1393
|
+
S(!1);
|
|
1383
1394
|
}
|
|
1384
1395
|
})();
|
|
1385
|
-
}, [t.loading,
|
|
1386
|
-
const
|
|
1387
|
-
var
|
|
1396
|
+
}, [t.loading, m]);
|
|
1397
|
+
const w = p.filter((x) => !r.has(x.id)).filter((x) => {
|
|
1398
|
+
var C;
|
|
1388
1399
|
if (!h) return !0;
|
|
1389
|
-
const
|
|
1390
|
-
return
|
|
1400
|
+
const i = h.toLowerCase();
|
|
1401
|
+
return x.name.toLowerCase().includes(i) || ((C = x.email) == null ? void 0 : C.toLowerCase().includes(i)) || !1;
|
|
1391
1402
|
}), _ = D(
|
|
1392
|
-
async (
|
|
1393
|
-
if (!
|
|
1394
|
-
b(
|
|
1403
|
+
async (x) => {
|
|
1404
|
+
if (!v) {
|
|
1405
|
+
b(x.id);
|
|
1395
1406
|
try {
|
|
1396
|
-
await s(
|
|
1397
|
-
} catch (
|
|
1398
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1407
|
+
await s(x);
|
|
1408
|
+
} catch (i) {
|
|
1409
|
+
console.error("[ParticipantPicker] Failed to start chat:", i), b(null);
|
|
1399
1410
|
}
|
|
1400
1411
|
}
|
|
1401
1412
|
},
|
|
1402
|
-
[s,
|
|
1403
|
-
),
|
|
1404
|
-
(
|
|
1413
|
+
[s, v]
|
|
1414
|
+
), R = (x, i) => {
|
|
1415
|
+
(x.key === "Enter" || x.key === " ") && (x.preventDefault(), _(i));
|
|
1405
1416
|
};
|
|
1406
|
-
return /* @__PURE__ */
|
|
1407
|
-
/* @__PURE__ */
|
|
1408
|
-
/* @__PURE__ */
|
|
1417
|
+
return /* @__PURE__ */ c("div", { className: M("flex flex-col h-full", a), children: [
|
|
1418
|
+
/* @__PURE__ */ c("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1419
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1409
1420
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1410
|
-
/* @__PURE__ */ e(
|
|
1421
|
+
/* @__PURE__ */ e($e, { onClick: n })
|
|
1411
1422
|
] }),
|
|
1412
|
-
/* @__PURE__ */
|
|
1423
|
+
/* @__PURE__ */ c("p", { className: "text-xs text-stone mb-3", children: [
|
|
1413
1424
|
"Select a ",
|
|
1414
1425
|
l.slice(0, -1),
|
|
1415
1426
|
" to start messaging (",
|
|
1416
|
-
|
|
1427
|
+
w.length,
|
|
1417
1428
|
" available)",
|
|
1418
1429
|
t.totalCount !== void 0 && ` • ${t.totalCount} ${l} total`
|
|
1419
1430
|
] }),
|
|
1420
1431
|
/* @__PURE__ */ e(
|
|
1421
|
-
|
|
1432
|
+
ht,
|
|
1422
1433
|
{
|
|
1423
1434
|
searchQuery: h,
|
|
1424
|
-
setSearchQuery:
|
|
1425
|
-
placeholder:
|
|
1435
|
+
setSearchQuery: g,
|
|
1436
|
+
placeholder: d
|
|
1426
1437
|
}
|
|
1427
1438
|
)
|
|
1428
1439
|
] }),
|
|
1429
|
-
|
|
1440
|
+
E && /* @__PURE__ */ c("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1430
1441
|
"Error loading ",
|
|
1431
1442
|
l,
|
|
1432
1443
|
": ",
|
|
1433
|
-
|
|
1444
|
+
E
|
|
1434
1445
|
] }),
|
|
1435
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: o &&
|
|
1446
|
+
/* @__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
1447
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1437
|
-
/* @__PURE__ */
|
|
1448
|
+
/* @__PURE__ */ c("span", { className: "text-sm text-stone", children: [
|
|
1438
1449
|
"Loading ",
|
|
1439
1450
|
l,
|
|
1440
1451
|
"..."
|
|
1441
1452
|
] })
|
|
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(
|
|
1453
|
+
] }) }) : w.length === 0 ? /* @__PURE__ */ c("div", { className: "p-6 text-center", children: [
|
|
1454
|
+
/* @__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
1455
|
/* @__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
1456
|
/* @__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
|
|
1457
|
+
] }) : /* @__PURE__ */ c("ul", { className: "space-y-0", children: [
|
|
1458
|
+
w.map((x) => {
|
|
1459
|
+
const i = x.name || x.email || x.id, C = x.email && x.name ? x.email : x.phone;
|
|
1449
1460
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1450
1461
|
"button",
|
|
1451
1462
|
{
|
|
1452
1463
|
type: "button",
|
|
1453
|
-
onClick: () => _(
|
|
1454
|
-
onKeyDown: (
|
|
1464
|
+
onClick: () => _(x),
|
|
1465
|
+
onKeyDown: (T) => R(T, x),
|
|
1455
1466
|
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__ */
|
|
1467
|
+
children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
|
|
1468
|
+
/* @__PURE__ */ c("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1458
1469
|
/* @__PURE__ */ e(
|
|
1459
|
-
|
|
1470
|
+
se,
|
|
1460
1471
|
{
|
|
1461
|
-
id:
|
|
1462
|
-
name:
|
|
1463
|
-
image:
|
|
1472
|
+
id: x.id,
|
|
1473
|
+
name: i,
|
|
1474
|
+
image: x.image,
|
|
1464
1475
|
size: 40
|
|
1465
1476
|
}
|
|
1466
1477
|
),
|
|
1467
|
-
/* @__PURE__ */
|
|
1468
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
1469
|
-
|
|
1478
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
1479
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: i }),
|
|
1480
|
+
C && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: C })
|
|
1470
1481
|
] })
|
|
1471
1482
|
] }),
|
|
1472
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children:
|
|
1483
|
+
/* @__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
1484
|
] })
|
|
1474
1485
|
}
|
|
1475
|
-
) },
|
|
1486
|
+
) }, x.id);
|
|
1476
1487
|
}),
|
|
1477
|
-
o && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */
|
|
1488
|
+
o && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
|
|
1478
1489
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1479
1490
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1480
1491
|
] }) })
|
|
1481
1492
|
] }) })
|
|
1482
1493
|
] });
|
|
1483
|
-
},
|
|
1494
|
+
}, gt = ({ className: t }) => /* @__PURE__ */ c(
|
|
1484
1495
|
"svg",
|
|
1485
1496
|
{
|
|
1486
1497
|
width: "140",
|
|
@@ -1490,7 +1501,7 @@ const ut = ({
|
|
|
1490
1501
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1491
1502
|
className: t,
|
|
1492
1503
|
children: [
|
|
1493
|
-
/* @__PURE__ */
|
|
1504
|
+
/* @__PURE__ */ c("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1494
1505
|
/* @__PURE__ */ e(
|
|
1495
1506
|
"path",
|
|
1496
1507
|
{
|
|
@@ -1519,7 +1530,7 @@ const ut = ({
|
|
|
1519
1530
|
fill: "white"
|
|
1520
1531
|
}
|
|
1521
1532
|
),
|
|
1522
|
-
/* @__PURE__ */
|
|
1533
|
+
/* @__PURE__ */ c("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1523
1534
|
/* @__PURE__ */ e(
|
|
1524
1535
|
"path",
|
|
1525
1536
|
{
|
|
@@ -1559,8 +1570,8 @@ const ut = ({
|
|
|
1559
1570
|
}
|
|
1560
1571
|
)
|
|
1561
1572
|
] }),
|
|
1562
|
-
/* @__PURE__ */
|
|
1563
|
-
/* @__PURE__ */
|
|
1573
|
+
/* @__PURE__ */ c("defs", { children: [
|
|
1574
|
+
/* @__PURE__ */ c(
|
|
1564
1575
|
"filter",
|
|
1565
1576
|
{
|
|
1566
1577
|
id: "filter0_empty_state",
|
|
@@ -1614,17 +1625,17 @@ const ut = ({
|
|
|
1614
1625
|
] })
|
|
1615
1626
|
]
|
|
1616
1627
|
}
|
|
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__ */
|
|
1628
|
+
), Ge = B.memo(
|
|
1629
|
+
({ 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: [
|
|
1630
|
+
/* @__PURE__ */ e(gt, {}),
|
|
1631
|
+
s && !t && /* @__PURE__ */ c("div", { className: "mt-8", children: [
|
|
1621
1632
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1622
1633
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
1623
1634
|
] })
|
|
1624
1635
|
] }) })
|
|
1625
1636
|
);
|
|
1626
|
-
|
|
1627
|
-
const
|
|
1637
|
+
Ge.displayName = "EmptyState";
|
|
1638
|
+
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
1639
|
/* @__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
1640
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1630
1641
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1638,118 +1649,120 @@ const he = L.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1638
1649
|
}
|
|
1639
1650
|
)
|
|
1640
1651
|
] }) }));
|
|
1641
|
-
|
|
1642
|
-
const
|
|
1652
|
+
fe.displayName = "ErrorState";
|
|
1653
|
+
const It = ({
|
|
1643
1654
|
capabilities: t = {},
|
|
1644
1655
|
className: s,
|
|
1645
1656
|
renderMessageInputActions: n,
|
|
1646
1657
|
onChannelSelect: r,
|
|
1647
1658
|
onParticipantSelect: l,
|
|
1648
|
-
initialParticipantFilter:
|
|
1659
|
+
initialParticipantFilter: d,
|
|
1649
1660
|
initialParticipantData: a,
|
|
1650
|
-
CustomChannelEmptyState:
|
|
1661
|
+
CustomChannelEmptyState: m,
|
|
1651
1662
|
showChannelList: h = !0,
|
|
1652
|
-
filters:
|
|
1663
|
+
filters: g,
|
|
1653
1664
|
channelListCustomEmptyStateIndicator: p,
|
|
1654
1665
|
onDeleteConversationClick: f,
|
|
1655
1666
|
onBlockParticipantClick: o,
|
|
1656
|
-
onReportParticipantClick:
|
|
1657
|
-
dmAgentEnabled:
|
|
1667
|
+
onReportParticipantClick: S,
|
|
1668
|
+
dmAgentEnabled: E,
|
|
1669
|
+
messageMetadata: N,
|
|
1670
|
+
onMessageSent: v
|
|
1658
1671
|
}) => {
|
|
1659
1672
|
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
|
|
1673
|
+
service: b,
|
|
1674
|
+
client: u,
|
|
1675
|
+
isConnected: w,
|
|
1676
|
+
isLoading: _,
|
|
1677
|
+
error: R,
|
|
1678
|
+
refreshConnection: x,
|
|
1679
|
+
debug: i
|
|
1680
|
+
} = 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), {
|
|
1681
|
+
participantSource: Z,
|
|
1682
|
+
participantLabel: ae = "participants",
|
|
1683
|
+
showDeleteConversation: le = !0
|
|
1684
|
+
} = t, oe = B.useMemo(() => {
|
|
1685
|
+
const y = u == null ? void 0 : u.userID;
|
|
1673
1686
|
return {
|
|
1674
1687
|
...{
|
|
1675
1688
|
type: "messaging",
|
|
1676
1689
|
last_message_at: { $exists: !0 },
|
|
1677
|
-
...
|
|
1678
|
-
members: { $in: [
|
|
1690
|
+
...y && {
|
|
1691
|
+
members: { $in: [y] },
|
|
1679
1692
|
hidden: !1
|
|
1680
1693
|
}
|
|
1681
1694
|
},
|
|
1682
|
-
...
|
|
1695
|
+
...g
|
|
1683
1696
|
};
|
|
1684
|
-
}, [
|
|
1685
|
-
if (!
|
|
1686
|
-
const
|
|
1687
|
-
if (
|
|
1697
|
+
}, [g, u == null ? void 0 : u.userID]), Y = V(null), z = D(async () => {
|
|
1698
|
+
if (!u || !w) return;
|
|
1699
|
+
const y = u.userID;
|
|
1700
|
+
if (y)
|
|
1688
1701
|
try {
|
|
1689
|
-
|
|
1690
|
-
const $ = await
|
|
1702
|
+
i && console.log("[MessagingShell] Syncing channels for user:", y);
|
|
1703
|
+
const $ = await u.queryChannels(
|
|
1691
1704
|
{
|
|
1692
1705
|
type: "messaging",
|
|
1693
|
-
members: { $in: [
|
|
1706
|
+
members: { $in: [y] }
|
|
1694
1707
|
},
|
|
1695
1708
|
{},
|
|
1696
1709
|
{ limit: 100 }
|
|
1697
|
-
),
|
|
1710
|
+
), L = /* @__PURE__ */ new Set();
|
|
1698
1711
|
$.forEach((A) => {
|
|
1699
|
-
const
|
|
1700
|
-
Object.values(
|
|
1701
|
-
var
|
|
1702
|
-
const
|
|
1703
|
-
|
|
1712
|
+
const Ne = A.state.members;
|
|
1713
|
+
Object.values(Ne).forEach((He) => {
|
|
1714
|
+
var ye;
|
|
1715
|
+
const ve = (ye = He.user) == null ? void 0 : ye.id;
|
|
1716
|
+
ve && ve !== y && L.add(ve);
|
|
1704
1717
|
});
|
|
1705
|
-
}),
|
|
1718
|
+
}), 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
1719
|
channelCount: $.length,
|
|
1707
|
-
memberCount:
|
|
1720
|
+
memberCount: L.size
|
|
1708
1721
|
});
|
|
1709
1722
|
} catch ($) {
|
|
1710
1723
|
console.error("[MessagingShell] Failed to sync channels:", $);
|
|
1711
1724
|
}
|
|
1712
|
-
}, [
|
|
1713
|
-
|
|
1714
|
-
if (!
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
}, [
|
|
1718
|
-
if (!
|
|
1725
|
+
}, [u, w, i]);
|
|
1726
|
+
W(() => {
|
|
1727
|
+
if (!u || !w) return;
|
|
1728
|
+
const y = u.userID;
|
|
1729
|
+
y && Y.current !== y && z();
|
|
1730
|
+
}, [u, w, z]), W(() => {
|
|
1731
|
+
if (!d || !u || !w) return;
|
|
1719
1732
|
(async () => {
|
|
1720
|
-
const $ =
|
|
1733
|
+
const $ = u.userID;
|
|
1721
1734
|
if ($)
|
|
1722
1735
|
try {
|
|
1723
|
-
|
|
1736
|
+
i && console.log(
|
|
1724
1737
|
"[MessagingShell] Loading initial conversation with:",
|
|
1725
|
-
|
|
1738
|
+
d
|
|
1726
1739
|
);
|
|
1727
|
-
const
|
|
1740
|
+
const L = await u.queryChannels(
|
|
1728
1741
|
{
|
|
1729
1742
|
type: "messaging",
|
|
1730
|
-
members: { $eq: [$,
|
|
1743
|
+
members: { $eq: [$, d] }
|
|
1731
1744
|
},
|
|
1732
1745
|
{},
|
|
1733
1746
|
{ limit: 1 }
|
|
1734
1747
|
);
|
|
1735
|
-
if (
|
|
1736
|
-
|
|
1748
|
+
if (L.length > 0)
|
|
1749
|
+
T(L[0]), k(!0), P(null), r && r(L[0]), i && console.log(
|
|
1737
1750
|
"[MessagingShell] Initial conversation loaded:",
|
|
1738
|
-
|
|
1751
|
+
L[0].id
|
|
1739
1752
|
);
|
|
1740
|
-
else if (a &&
|
|
1741
|
-
|
|
1753
|
+
else if (a && b) {
|
|
1754
|
+
i && console.log(
|
|
1742
1755
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1743
1756
|
a
|
|
1744
1757
|
);
|
|
1745
1758
|
try {
|
|
1746
|
-
const A = await
|
|
1759
|
+
const A = await b.startChannelWithParticipant({
|
|
1747
1760
|
id: a.id,
|
|
1748
1761
|
name: a.name,
|
|
1749
1762
|
email: a.email,
|
|
1750
1763
|
phone: a.phone
|
|
1751
1764
|
});
|
|
1752
|
-
|
|
1765
|
+
T(A), k(!0), P(null), r && r(A), i && console.log(
|
|
1753
1766
|
"[MessagingShell] Channel created and loaded:",
|
|
1754
1767
|
A.id
|
|
1755
1768
|
);
|
|
@@ -1757,115 +1770,115 @@ const yt = ({
|
|
|
1757
1770
|
console.error(
|
|
1758
1771
|
"[MessagingShell] Failed to create conversation:",
|
|
1759
1772
|
A
|
|
1760
|
-
),
|
|
1773
|
+
), P("Failed to create conversation");
|
|
1761
1774
|
}
|
|
1762
1775
|
} else
|
|
1763
|
-
|
|
1776
|
+
P(
|
|
1764
1777
|
"No conversation found with this account"
|
|
1765
|
-
),
|
|
1778
|
+
), i && console.log(
|
|
1766
1779
|
"[MessagingShell] No conversation found for:",
|
|
1767
|
-
|
|
1780
|
+
d
|
|
1768
1781
|
);
|
|
1769
|
-
} catch (
|
|
1782
|
+
} catch (L) {
|
|
1770
1783
|
console.error(
|
|
1771
1784
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1772
|
-
|
|
1773
|
-
),
|
|
1785
|
+
L
|
|
1786
|
+
), P("Failed to load conversation");
|
|
1774
1787
|
}
|
|
1775
1788
|
})();
|
|
1776
1789
|
}, [
|
|
1777
|
-
|
|
1790
|
+
d,
|
|
1778
1791
|
a,
|
|
1779
|
-
|
|
1792
|
+
u,
|
|
1793
|
+
w,
|
|
1780
1794
|
b,
|
|
1781
|
-
|
|
1782
|
-
E,
|
|
1795
|
+
i,
|
|
1783
1796
|
r
|
|
1784
1797
|
]);
|
|
1785
|
-
const
|
|
1786
|
-
(
|
|
1787
|
-
|
|
1798
|
+
const H = D(
|
|
1799
|
+
(y) => {
|
|
1800
|
+
T(y), r == null || r(y);
|
|
1788
1801
|
},
|
|
1789
1802
|
[r]
|
|
1790
|
-
),
|
|
1791
|
-
|
|
1792
|
-
}, [
|
|
1793
|
-
async (
|
|
1803
|
+
), Ce = D(() => {
|
|
1804
|
+
U || T(null);
|
|
1805
|
+
}, [U]), ie = D(
|
|
1806
|
+
async (y) => {
|
|
1794
1807
|
var $;
|
|
1795
|
-
if (
|
|
1808
|
+
if (b)
|
|
1796
1809
|
try {
|
|
1797
|
-
|
|
1810
|
+
i && console.log(
|
|
1798
1811
|
"[MessagingShell] Starting conversation with:",
|
|
1799
|
-
|
|
1812
|
+
y.id
|
|
1800
1813
|
);
|
|
1801
|
-
const
|
|
1802
|
-
id:
|
|
1803
|
-
name:
|
|
1804
|
-
email:
|
|
1805
|
-
phone:
|
|
1814
|
+
const L = await b.startChannelWithParticipant({
|
|
1815
|
+
id: y.id,
|
|
1816
|
+
name: y.name,
|
|
1817
|
+
email: y.email,
|
|
1818
|
+
phone: y.phone
|
|
1806
1819
|
});
|
|
1807
1820
|
try {
|
|
1808
|
-
await
|
|
1821
|
+
await L.show();
|
|
1809
1822
|
} catch (A) {
|
|
1810
1823
|
console.warn("[MessagingShell] Failed to unhide channel:", A);
|
|
1811
1824
|
}
|
|
1812
|
-
|
|
1813
|
-
} catch (
|
|
1814
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1825
|
+
T(L), q(!1), ($ = O.current) == null || $.close(), l == null || l(y);
|
|
1826
|
+
} catch (L) {
|
|
1827
|
+
console.error("[MessagingShell] Failed to start conversation:", L);
|
|
1815
1828
|
}
|
|
1816
1829
|
},
|
|
1817
|
-
[
|
|
1818
|
-
),
|
|
1819
|
-
var
|
|
1820
|
-
|
|
1830
|
+
[b, l, i]
|
|
1831
|
+
), ee = D(() => {
|
|
1832
|
+
var y;
|
|
1833
|
+
q(!1), (y = O.current) == null || y.close();
|
|
1821
1834
|
}, []), ce = D(
|
|
1822
|
-
(
|
|
1823
|
-
|
|
1835
|
+
(y) => {
|
|
1836
|
+
y.target === O.current && ee();
|
|
1824
1837
|
},
|
|
1825
|
-
[
|
|
1826
|
-
), xe = D(
|
|
1827
|
-
async (w) => {
|
|
1828
|
-
E && console.log("[MessagingShell] Leaving conversation:", w.id), d(null), G(!1), Y.current = null, await H();
|
|
1829
|
-
},
|
|
1830
|
-
[H, E]
|
|
1838
|
+
[ee]
|
|
1831
1839
|
), de = D(
|
|
1832
|
-
async (
|
|
1833
|
-
|
|
1840
|
+
async (y) => {
|
|
1841
|
+
i && console.log("[MessagingShell] Leaving conversation:", y.id), T(null), k(!1), Y.current = null, await z();
|
|
1842
|
+
},
|
|
1843
|
+
[z, i]
|
|
1844
|
+
), be = D(
|
|
1845
|
+
async (y) => {
|
|
1846
|
+
i && console.log("[MessagingShell] Blocking participant:", y), T(null), k(!1), Y.current = null, await z();
|
|
1834
1847
|
},
|
|
1835
|
-
[
|
|
1836
|
-
),
|
|
1837
|
-
return
|
|
1838
|
-
|
|
1848
|
+
[z, i]
|
|
1849
|
+
), me = !!C;
|
|
1850
|
+
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(
|
|
1851
|
+
fe,
|
|
1839
1852
|
{
|
|
1840
1853
|
message: "Not connected to messaging service",
|
|
1841
|
-
onBack:
|
|
1854
|
+
onBack: x
|
|
1842
1855
|
}
|
|
1843
|
-
) }) :
|
|
1856
|
+
) }) : F ? /* @__PURE__ */ e("div", { className: M("h-full", s), children: /* @__PURE__ */ e(fe, { message: F }) }) : /* @__PURE__ */ c(
|
|
1844
1857
|
"div",
|
|
1845
1858
|
{
|
|
1846
|
-
className:
|
|
1859
|
+
className: M(
|
|
1847
1860
|
"messaging-shell h-full bg-background-primary overflow-hidden",
|
|
1848
1861
|
s
|
|
1849
1862
|
),
|
|
1850
1863
|
children: [
|
|
1851
|
-
/* @__PURE__ */
|
|
1864
|
+
/* @__PURE__ */ c("div", { className: "flex h-full min-h-0", children: [
|
|
1852
1865
|
/* @__PURE__ */ e(
|
|
1853
1866
|
"div",
|
|
1854
1867
|
{
|
|
1855
|
-
className:
|
|
1868
|
+
className: M(
|
|
1856
1869
|
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
1857
1870
|
{
|
|
1858
|
-
"!hidden": h === !1 ||
|
|
1871
|
+
"!hidden": h === !1 || U,
|
|
1859
1872
|
// 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 && !
|
|
1873
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !U && me,
|
|
1861
1874
|
// 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 && !
|
|
1875
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !U && !me
|
|
1863
1876
|
}
|
|
1864
1877
|
),
|
|
1865
1878
|
children: /* @__PURE__ */ e(
|
|
1866
|
-
|
|
1879
|
+
Ae,
|
|
1867
1880
|
{
|
|
1868
|
-
onChannelSelect:
|
|
1881
|
+
onChannelSelect: H,
|
|
1869
1882
|
selectedChannel: C || void 0,
|
|
1870
1883
|
filters: oe,
|
|
1871
1884
|
customEmptyStateIndicator: p
|
|
@@ -1876,71 +1889,73 @@ const yt = ({
|
|
|
1876
1889
|
/* @__PURE__ */ e(
|
|
1877
1890
|
"div",
|
|
1878
1891
|
{
|
|
1879
|
-
className:
|
|
1892
|
+
className: M(
|
|
1880
1893
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1881
1894
|
{
|
|
1882
1895
|
// In direct conversation mode (or waiting for it), always show (full width)
|
|
1883
|
-
flex:
|
|
1896
|
+
flex: U || me || d,
|
|
1884
1897
|
// Normal mode: hide on mobile when no channel selected
|
|
1885
|
-
"hidden lg:flex": !
|
|
1898
|
+
"hidden lg:flex": !U && !me && !d
|
|
1886
1899
|
}
|
|
1887
1900
|
),
|
|
1888
1901
|
children: C ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1889
|
-
|
|
1902
|
+
ze,
|
|
1890
1903
|
{
|
|
1891
1904
|
channel: C,
|
|
1892
|
-
onBack:
|
|
1893
|
-
showBackButton: !
|
|
1905
|
+
onBack: Ce,
|
|
1906
|
+
showBackButton: !U,
|
|
1894
1907
|
renderMessageInputActions: n,
|
|
1895
|
-
onLeaveConversation:
|
|
1896
|
-
onBlockParticipant:
|
|
1897
|
-
CustomChannelEmptyState:
|
|
1898
|
-
showDeleteConversation:
|
|
1908
|
+
onLeaveConversation: de,
|
|
1909
|
+
onBlockParticipant: be,
|
|
1910
|
+
CustomChannelEmptyState: m,
|
|
1911
|
+
showDeleteConversation: le,
|
|
1899
1912
|
onDeleteConversationClick: f,
|
|
1900
1913
|
onBlockParticipantClick: o,
|
|
1901
|
-
onReportParticipantClick:
|
|
1902
|
-
dmAgentEnabled:
|
|
1914
|
+
onReportParticipantClick: S,
|
|
1915
|
+
dmAgentEnabled: E,
|
|
1916
|
+
messageMetadata: N,
|
|
1917
|
+
onMessageSent: v
|
|
1903
1918
|
},
|
|
1904
1919
|
C.id
|
|
1905
|
-
) }) :
|
|
1920
|
+
) }) : d ? (
|
|
1906
1921
|
// Show loading while creating/loading direct conversation channel
|
|
1907
|
-
/* @__PURE__ */ e(
|
|
1922
|
+
/* @__PURE__ */ e(ge, {})
|
|
1908
1923
|
) : /* @__PURE__ */ e(
|
|
1909
|
-
|
|
1924
|
+
Ge,
|
|
1910
1925
|
{
|
|
1911
|
-
hasChannels:
|
|
1912
|
-
channelsLoaded:
|
|
1926
|
+
hasChannels: j,
|
|
1927
|
+
channelsLoaded: J
|
|
1913
1928
|
}
|
|
1914
1929
|
)
|
|
1915
1930
|
}
|
|
1916
1931
|
)
|
|
1917
1932
|
] }),
|
|
1918
|
-
|
|
1933
|
+
Z && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1919
1934
|
/* @__PURE__ */ e(
|
|
1920
1935
|
"dialog",
|
|
1921
1936
|
{
|
|
1922
|
-
ref:
|
|
1937
|
+
ref: O,
|
|
1923
1938
|
className: "mes-dialog",
|
|
1924
1939
|
onClick: ce,
|
|
1925
|
-
onClose:
|
|
1940
|
+
onClose: ee,
|
|
1926
1941
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1927
|
-
|
|
1942
|
+
ft,
|
|
1928
1943
|
{
|
|
1929
|
-
participantSource:
|
|
1930
|
-
onSelectParticipant:
|
|
1931
|
-
onClose:
|
|
1932
|
-
existingParticipantIds:
|
|
1933
|
-
participantLabel:
|
|
1934
|
-
searchPlaceholder: `Search ${
|
|
1944
|
+
participantSource: Z,
|
|
1945
|
+
onSelectParticipant: ie,
|
|
1946
|
+
onClose: ee,
|
|
1947
|
+
existingParticipantIds: Q,
|
|
1948
|
+
participantLabel: ae,
|
|
1949
|
+
searchPlaceholder: `Search ${ae}...`
|
|
1935
1950
|
},
|
|
1936
|
-
|
|
1951
|
+
K
|
|
1937
1952
|
) })
|
|
1938
1953
|
}
|
|
1939
1954
|
)
|
|
1940
1955
|
]
|
|
1941
1956
|
}
|
|
1942
1957
|
);
|
|
1943
|
-
},
|
|
1958
|
+
}, xt = ({
|
|
1944
1959
|
question: t,
|
|
1945
1960
|
onClick: s,
|
|
1946
1961
|
loading: n = !1,
|
|
@@ -1952,7 +1967,7 @@ const yt = ({
|
|
|
1952
1967
|
onClick: s,
|
|
1953
1968
|
disabled: n,
|
|
1954
1969
|
style: { backgroundColor: "#E6E5E3" },
|
|
1955
|
-
className:
|
|
1970
|
+
className: M(
|
|
1956
1971
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1957
1972
|
{
|
|
1958
1973
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1962,36 +1977,36 @@ const yt = ({
|
|
|
1962
1977
|
),
|
|
1963
1978
|
children: t
|
|
1964
1979
|
}
|
|
1965
|
-
),
|
|
1980
|
+
), _t = ({
|
|
1966
1981
|
faqs: t,
|
|
1967
1982
|
onFaqClick: s,
|
|
1968
1983
|
loadingFaqId: n,
|
|
1969
1984
|
headerText: r,
|
|
1970
1985
|
className: l,
|
|
1971
|
-
avatarImage:
|
|
1986
|
+
avatarImage: d,
|
|
1972
1987
|
avatarName: a
|
|
1973
1988
|
}) => {
|
|
1974
|
-
const
|
|
1975
|
-
return
|
|
1976
|
-
(
|
|
1977
|
-
|
|
1989
|
+
const m = t.filter((h) => h.enabled).sort((h, g) => (h.order ?? 0) - (g.order ?? 0));
|
|
1990
|
+
return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ c("div", { className: "flex gap-3 items-end", children: [
|
|
1991
|
+
(d || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1992
|
+
se,
|
|
1978
1993
|
{
|
|
1979
1994
|
id: a || "account",
|
|
1980
1995
|
name: a || "Account",
|
|
1981
|
-
image:
|
|
1996
|
+
image: d,
|
|
1982
1997
|
size: 24,
|
|
1983
1998
|
shape: "circle"
|
|
1984
1999
|
}
|
|
1985
2000
|
) }),
|
|
1986
|
-
/* @__PURE__ */
|
|
2001
|
+
/* @__PURE__ */ c(
|
|
1987
2002
|
"div",
|
|
1988
2003
|
{
|
|
1989
2004
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
1990
2005
|
style: { backgroundColor: "#F1F0EE" },
|
|
1991
2006
|
children: [
|
|
1992
2007
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1993
|
-
|
|
1994
|
-
|
|
2008
|
+
m.map((h) => /* @__PURE__ */ e(
|
|
2009
|
+
xt,
|
|
1995
2010
|
{
|
|
1996
2011
|
question: h.question,
|
|
1997
2012
|
onClick: () => s(h.id),
|
|
@@ -2003,35 +2018,35 @@ const yt = ({
|
|
|
2003
2018
|
}
|
|
2004
2019
|
)
|
|
2005
2020
|
] }) });
|
|
2006
|
-
},
|
|
2007
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [l,
|
|
2021
|
+
}, St = (t, s = {}) => {
|
|
2022
|
+
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, N] = I(), v = D(async (_ = !1, R) => {
|
|
2008
2023
|
if (a) return;
|
|
2009
|
-
const
|
|
2010
|
-
|
|
2024
|
+
const x = R !== void 0 ? R : p;
|
|
2025
|
+
m(!0), g(null);
|
|
2011
2026
|
try {
|
|
2012
|
-
const
|
|
2013
|
-
search:
|
|
2027
|
+
const i = await t.loadParticipants({
|
|
2028
|
+
search: x || void 0,
|
|
2014
2029
|
limit: r,
|
|
2015
|
-
cursor: _ ? void 0 :
|
|
2030
|
+
cursor: _ ? void 0 : E
|
|
2016
2031
|
});
|
|
2017
|
-
|
|
2018
|
-
(
|
|
2019
|
-
),
|
|
2020
|
-
} catch (
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2032
|
+
d(
|
|
2033
|
+
(C) => _ ? i.participants : [...C, ...i.participants]
|
|
2034
|
+
), S(i.hasMore), N(i.nextCursor);
|
|
2035
|
+
} catch (i) {
|
|
2036
|
+
const C = i instanceof Error ? i.message : "Failed to load participants";
|
|
2037
|
+
g(C), console.error("[useParticipants] Load error:", i);
|
|
2023
2038
|
} finally {
|
|
2024
|
-
|
|
2039
|
+
m(!1);
|
|
2025
2040
|
}
|
|
2026
|
-
}, [t, p,
|
|
2027
|
-
o && !a &&
|
|
2028
|
-
}, [o, a,
|
|
2029
|
-
f(_),
|
|
2030
|
-
}, [
|
|
2031
|
-
|
|
2032
|
-
}, [
|
|
2033
|
-
return
|
|
2034
|
-
|
|
2041
|
+
}, [t, p, E, r, a]), b = D(() => {
|
|
2042
|
+
o && !a && v(!1);
|
|
2043
|
+
}, [o, a, v]), u = D((_) => {
|
|
2044
|
+
f(_), N(void 0), v(!0, _);
|
|
2045
|
+
}, [v]), w = D(() => {
|
|
2046
|
+
N(void 0), v(!0);
|
|
2047
|
+
}, [v]);
|
|
2048
|
+
return W(() => {
|
|
2049
|
+
v(!0);
|
|
2035
2050
|
}, [t.loadParticipants]), {
|
|
2036
2051
|
participants: l,
|
|
2037
2052
|
loading: a,
|
|
@@ -2040,22 +2055,22 @@ const yt = ({
|
|
|
2040
2055
|
hasMore: o,
|
|
2041
2056
|
totalCount: t.totalCount,
|
|
2042
2057
|
loadMore: b,
|
|
2043
|
-
search:
|
|
2044
|
-
refresh:
|
|
2058
|
+
search: u,
|
|
2059
|
+
refresh: w
|
|
2045
2060
|
};
|
|
2046
2061
|
};
|
|
2047
2062
|
export {
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2063
|
+
se as Avatar,
|
|
2064
|
+
it as ChannelEmptyState,
|
|
2065
|
+
Ae as ChannelList,
|
|
2066
|
+
ze as ChannelView,
|
|
2067
|
+
_t as FaqList,
|
|
2068
|
+
xt as FaqListItem,
|
|
2069
|
+
Et as MessagingProvider,
|
|
2070
|
+
It as MessagingShell,
|
|
2071
|
+
ft as ParticipantPicker,
|
|
2072
|
+
Vs as formatRelativeTime,
|
|
2073
|
+
Gs as useMessaging,
|
|
2074
|
+
St as useParticipants
|
|
2060
2075
|
};
|
|
2061
2076
|
//# sourceMappingURL=index.js.map
|