@linktr.ee/messaging-react 1.8.2 โ 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.css +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +220 -198
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Avatar/index.tsx +9 -6
- package/src/components/ChannelList/CustomChannelPreview.stories.tsx +216 -0
- package/src/components/ChannelList/CustomChannelPreview.tsx +4 -5
- package/src/index.ts +3 -0
- package/src/styles.css +4 -0
- package/src/utils/formatRelativeTime.test.ts +161 -0
- package/src/utils/formatRelativeTime.ts +62 -0
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as d, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import q, { createContext as Ie, useContext as Se, useCallback as
|
|
2
|
+
import D from "classnames";
|
|
3
|
+
import q, { createContext as Ie, useContext as Se, useCallback as P, useState as C, useRef as G, useEffect as H } from "react";
|
|
4
4
|
import { StreamChatService as Re } from "@linktr.ee/messaging-core";
|
|
5
|
-
import { Chat as ke, ChannelList as
|
|
6
|
-
import { XIcon as he, ArrowLeftIcon as
|
|
5
|
+
import { Chat as ke, ChannelList as Te, Channel as De, useChannelStateContext as me, Window as Fe, MessageList as Me, MessageInput as Ue } from "stream-chat-react";
|
|
6
|
+
import { XIcon as he, ArrowLeftIcon as Pe, DotsThreeIcon as Oe, SpinnerGapIcon as ee, SignOutIcon as pe, ProhibitInsetIcon as ie, FlagIcon as Le, MagnifyingGlassIcon as je, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
|
|
7
7
|
const fe = Ie({
|
|
8
8
|
service: null,
|
|
9
9
|
client: null,
|
|
@@ -15,7 +15,7 @@ const fe = Ie({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), se = () => Se(fe),
|
|
18
|
+
}), se = () => Se(fe), is = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
@@ -24,9 +24,9 @@ const fe = Ie({
|
|
|
24
24
|
customization: c = {},
|
|
25
25
|
debug: i = !1
|
|
26
26
|
}) => {
|
|
27
|
-
const l =
|
|
28
|
-
(v, ...
|
|
29
|
-
i && console.log(`๐ฅ [MessagingProvider] ${v}`, ...
|
|
27
|
+
const l = P(
|
|
28
|
+
(v, ...F) => {
|
|
29
|
+
i && console.log(`๐ฅ [MessagingProvider] ${v}`, ...F);
|
|
30
30
|
},
|
|
31
31
|
[i]
|
|
32
32
|
);
|
|
@@ -37,15 +37,15 @@ const fe = Ie({
|
|
|
37
37
|
capabilities: Object.keys(a),
|
|
38
38
|
customization: Object.keys(c)
|
|
39
39
|
});
|
|
40
|
-
const [o, E] = C(null), [b, u] = C(null), [f, I] = C(!1), [x, w] = C(!1), [m, k] = C(null), S =
|
|
40
|
+
const [o, E] = C(null), [b, u] = C(null), [f, I] = C(!1), [x, w] = C(!1), [m, k] = C(null), S = G(!1), y = G({
|
|
41
41
|
userId: s == null ? void 0 : s.id,
|
|
42
42
|
apiKey: r,
|
|
43
43
|
serviceConfig: n,
|
|
44
44
|
capabilities: a,
|
|
45
45
|
customization: c
|
|
46
|
-
}),
|
|
47
|
-
|
|
48
|
-
renderCount:
|
|
46
|
+
}), T = G(0);
|
|
47
|
+
T.current++, l("๐ RENDER INFO", {
|
|
48
|
+
renderCount: T.current,
|
|
49
49
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
|
|
50
50
|
propChanges: {
|
|
51
51
|
userChanged: y.current.userId !== (s == null ? void 0 : s.id),
|
|
@@ -60,8 +60,8 @@ const fe = Ie({
|
|
|
60
60
|
serviceConfig: n,
|
|
61
61
|
capabilities: a,
|
|
62
62
|
customization: c
|
|
63
|
-
},
|
|
64
|
-
const v =
|
|
63
|
+
}, H(() => {
|
|
64
|
+
const v = T.current;
|
|
65
65
|
if (l("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
66
66
|
renderCount: v,
|
|
67
67
|
apiKey: !!r,
|
|
@@ -84,24 +84,24 @@ const fe = Ie({
|
|
|
84
84
|
apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
|
|
85
85
|
serviceConfigChanged: y.current.serviceConfig !== n
|
|
86
86
|
});
|
|
87
|
-
const
|
|
87
|
+
const F = new Re({
|
|
88
88
|
...n,
|
|
89
89
|
apiKey: r,
|
|
90
90
|
debug: i
|
|
91
91
|
});
|
|
92
|
-
return E(
|
|
92
|
+
return E(F), l("โ
SERVICE SET", {
|
|
93
93
|
renderCount: v,
|
|
94
|
-
serviceInstance: !!
|
|
94
|
+
serviceInstance: !!F
|
|
95
95
|
}), () => {
|
|
96
96
|
l("๐งน SERVICE CLEANUP", {
|
|
97
97
|
renderCount: v,
|
|
98
98
|
reason: "Effect cleanup"
|
|
99
|
-
}),
|
|
99
|
+
}), F.disconnectUser().catch(console.error);
|
|
100
100
|
};
|
|
101
101
|
}, [r, n, i, l]);
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
var
|
|
102
|
+
const U = G(null);
|
|
103
|
+
H(() => {
|
|
104
|
+
var F, z;
|
|
105
105
|
if (l("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
106
106
|
hasService: !!o,
|
|
107
107
|
hasUser: !!s,
|
|
@@ -117,7 +117,7 @@ const fe = Ie({
|
|
|
117
117
|
l("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
if (((
|
|
120
|
+
if (((F = U.current) == null ? void 0 : F.serviceId) === o && ((z = U.current) == null ? void 0 : z.userId) === s.id) {
|
|
121
121
|
l(
|
|
122
122
|
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
123
123
|
"Already connected this user with this service"
|
|
@@ -128,13 +128,13 @@ const fe = Ie({
|
|
|
128
128
|
l("๐ STARTING USER CONNECTION", { userId: s.id }), S.current = !0, w(!0), k(null);
|
|
129
129
|
try {
|
|
130
130
|
l("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
131
|
-
const
|
|
132
|
-
u(
|
|
131
|
+
const M = await o.connectUser(s);
|
|
132
|
+
u(M), I(!0), U.current = { serviceId: o, userId: s.id }, l("โ
USER CONNECTION SUCCESS", {
|
|
133
133
|
userId: s.id,
|
|
134
|
-
clientId:
|
|
134
|
+
clientId: M.userID
|
|
135
135
|
});
|
|
136
|
-
} catch (
|
|
137
|
-
const A =
|
|
136
|
+
} catch (M) {
|
|
137
|
+
const A = M instanceof Error ? M.message : "Connection failed";
|
|
138
138
|
k(A), l("โ USER CONNECTION ERROR", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
error: A
|
|
@@ -146,19 +146,19 @@ const fe = Ie({
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
})();
|
|
149
|
-
}, [o, s, l, f]),
|
|
149
|
+
}, [o, s, l, f]), H(() => (l("๐ CLEANUP EFFECT REGISTERED", {
|
|
150
150
|
hasService: !!o,
|
|
151
151
|
isConnected: f
|
|
152
152
|
}), () => {
|
|
153
153
|
o && f ? (l(
|
|
154
154
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
155
155
|
"Cleaning up connection on unmount"
|
|
156
|
-
),
|
|
156
|
+
), U.current = null, o.disconnectUser().catch(console.error)) : l("๐ CLEANUP EFFECT SKIPPED", {
|
|
157
157
|
hasService: !!o,
|
|
158
158
|
isConnected: f
|
|
159
159
|
});
|
|
160
160
|
}), [o, f, l]);
|
|
161
|
-
const h =
|
|
161
|
+
const h = P(async () => {
|
|
162
162
|
if (l("๐ REFRESH CONNECTION CALLED", {
|
|
163
163
|
hasService: !!o,
|
|
164
164
|
hasUser: !!s
|
|
@@ -172,10 +172,10 @@ const fe = Ie({
|
|
|
172
172
|
const v = await o.connectUser(s);
|
|
173
173
|
u(v), I(!0), k(null), l("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
174
174
|
} catch (v) {
|
|
175
|
-
const
|
|
176
|
-
k(
|
|
175
|
+
const F = v instanceof Error ? v.message : "Refresh failed";
|
|
176
|
+
k(F), l("โ CONNECTION REFRESH ERROR", {
|
|
177
177
|
userId: s.id,
|
|
178
|
-
error:
|
|
178
|
+
error: F
|
|
179
179
|
});
|
|
180
180
|
} finally {
|
|
181
181
|
w(!1), l("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
@@ -211,11 +211,31 @@ const fe = Ie({
|
|
|
211
211
|
l
|
|
212
212
|
]);
|
|
213
213
|
return l("๐ RENDER END", {
|
|
214
|
-
renderCount:
|
|
214
|
+
renderCount: T.current,
|
|
215
215
|
willRenderChat: !!(b && f),
|
|
216
216
|
contextValueReady: !!g
|
|
217
217
|
}), /* @__PURE__ */ e(fe.Provider, { value: g, children: b && f ? /* @__PURE__ */ e(ke, { client: b, children: t }) : t });
|
|
218
|
-
}, Be = () => se(),
|
|
218
|
+
}, Be = () => se(), Ae = (t, s) => {
|
|
219
|
+
const n = new Date(
|
|
220
|
+
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
221
|
+
), a = new Date(
|
|
222
|
+
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
223
|
+
).getTime() - n.getTime();
|
|
224
|
+
return Math.floor(a / (1e3 * 60 * 60 * 24));
|
|
225
|
+
}, $e = (t) => {
|
|
226
|
+
const s = /* @__PURE__ */ new Date();
|
|
227
|
+
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
228
|
+
return "Just now";
|
|
229
|
+
const r = Ae(t, s);
|
|
230
|
+
return r === 0 ? t.toLocaleTimeString([], {
|
|
231
|
+
hour: "numeric",
|
|
232
|
+
minute: "2-digit"
|
|
233
|
+
}) : r === 1 ? "Yesterday" : r < 7 ? `${r}d` : r < 28 ? `${Math.floor(r / 7)}w` : t.toLocaleDateString("en-US", {
|
|
234
|
+
month: "numeric",
|
|
235
|
+
day: "numeric",
|
|
236
|
+
year: "2-digit"
|
|
237
|
+
});
|
|
238
|
+
}, de = [
|
|
219
239
|
"๐",
|
|
220
240
|
// Apple
|
|
221
241
|
"๐",
|
|
@@ -243,7 +263,7 @@ const fe = Ie({
|
|
|
243
263
|
"๐"
|
|
244
264
|
// Melon
|
|
245
265
|
];
|
|
246
|
-
function
|
|
266
|
+
function Ge(t) {
|
|
247
267
|
let s = 0;
|
|
248
268
|
for (let n = 0; n < t.length; n++) {
|
|
249
269
|
const r = t.charCodeAt(n);
|
|
@@ -251,25 +271,28 @@ function Ae(t) {
|
|
|
251
271
|
}
|
|
252
272
|
return Math.abs(s);
|
|
253
273
|
}
|
|
254
|
-
function
|
|
255
|
-
const n =
|
|
274
|
+
function He(t) {
|
|
275
|
+
const n = Ge(t) % de.length;
|
|
256
276
|
return de[n];
|
|
257
277
|
}
|
|
258
|
-
const
|
|
278
|
+
const J = ({
|
|
259
279
|
id: t,
|
|
260
280
|
image: s,
|
|
261
281
|
size: n = 40,
|
|
262
282
|
className: r
|
|
263
283
|
}) => {
|
|
264
|
-
const a =
|
|
284
|
+
const a = He(t), i = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg";
|
|
265
285
|
return /* @__PURE__ */ e(
|
|
266
286
|
"div",
|
|
267
287
|
{
|
|
268
|
-
className:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
288
|
+
className: D("flex-shrink-0 overflow-hidden", r),
|
|
289
|
+
style: {
|
|
290
|
+
width: `${n}px`,
|
|
291
|
+
height: `${n}px`,
|
|
292
|
+
borderRadius: "33%",
|
|
293
|
+
// @ts-expect-error - corner-shape is not recognized by react types
|
|
294
|
+
"corner-shape": "superellipse(1.3)"
|
|
295
|
+
},
|
|
273
296
|
children: s ? /* @__PURE__ */ e(
|
|
274
297
|
"img",
|
|
275
298
|
{
|
|
@@ -281,8 +304,8 @@ const Q = ({
|
|
|
281
304
|
"div",
|
|
282
305
|
{
|
|
283
306
|
"aria-hidden": "true",
|
|
284
|
-
className:
|
|
285
|
-
"flex h-full w-full items-center justify-center font-semibold
|
|
307
|
+
className: D(
|
|
308
|
+
"avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
|
|
286
309
|
i
|
|
287
310
|
),
|
|
288
311
|
children: a
|
|
@@ -290,19 +313,16 @@ const Q = ({
|
|
|
290
313
|
)
|
|
291
314
|
}
|
|
292
315
|
);
|
|
293
|
-
},
|
|
294
|
-
var w, m, k, S, y,
|
|
316
|
+
}, _e = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
|
|
317
|
+
var w, m, k, S, y, T;
|
|
295
318
|
const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), i = () => {
|
|
296
319
|
t && n(t);
|
|
297
320
|
}, o = Object.values(((w = t == null ? void 0 : t.state) == null ? void 0 : w.members) || {}).find(
|
|
298
|
-
(
|
|
321
|
+
(U) => {
|
|
299
322
|
var h, g;
|
|
300
|
-
return ((h =
|
|
323
|
+
return ((h = U.user) == null ? void 0 : h.id) && U.user.id !== ((g = t == null ? void 0 : t._client) == null ? void 0 : g.userID);
|
|
301
324
|
}
|
|
302
|
-
), E = ((m = o == null ? void 0 : o.user) == null ? void 0 : m.name) || "Conversation", b = (k = o == null ? void 0 : o.user) == null ? void 0 : k.image, u = (y = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : y[t.state.messages.length - 1], f = (u == null ? void 0 : u.text) || "No messages yet", I = u != null && u.created_at ? new Date(u.created_at)
|
|
303
|
-
hour: "2-digit",
|
|
304
|
-
minute: "2-digit"
|
|
305
|
-
}) : "", x = a ?? 0;
|
|
325
|
+
), E = ((m = o == null ? void 0 : o.user) == null ? void 0 : m.name) || "Conversation", b = (k = o == null ? void 0 : o.user) == null ? void 0 : k.image, u = (y = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : y[t.state.messages.length - 1], f = (u == null ? void 0 : u.text) || "No messages yet", I = u != null && u.created_at ? $e(new Date(u.created_at)) : "", x = a ?? 0;
|
|
306
326
|
return r && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
307
327
|
channelId: t == null ? void 0 : t.id,
|
|
308
328
|
isSelected: c,
|
|
@@ -314,8 +334,8 @@ const Q = ({
|
|
|
314
334
|
{
|
|
315
335
|
type: "button",
|
|
316
336
|
onClick: i,
|
|
317
|
-
className:
|
|
318
|
-
"w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
|
|
337
|
+
className: D(
|
|
338
|
+
"group w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
|
|
319
339
|
{
|
|
320
340
|
"bg-primary-alt/10 border-l-4 border-l-primary": c,
|
|
321
341
|
"hover:bg-sand": !c
|
|
@@ -323,12 +343,13 @@ const Q = ({
|
|
|
323
343
|
),
|
|
324
344
|
children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
|
|
325
345
|
/* @__PURE__ */ e(
|
|
326
|
-
|
|
346
|
+
J,
|
|
327
347
|
{
|
|
328
|
-
id: ((
|
|
348
|
+
id: ((T = o == null ? void 0 : o.user) == null ? void 0 : T.id) || t.id || "unknown",
|
|
329
349
|
name: E,
|
|
330
350
|
image: b,
|
|
331
|
-
size: 44
|
|
351
|
+
size: 44,
|
|
352
|
+
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
332
353
|
}
|
|
333
354
|
),
|
|
334
355
|
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
@@ -336,7 +357,7 @@ const Q = ({
|
|
|
336
357
|
/* @__PURE__ */ e(
|
|
337
358
|
"h3",
|
|
338
359
|
{
|
|
339
|
-
className:
|
|
360
|
+
className: D(
|
|
340
361
|
"text-sm font-medium truncate",
|
|
341
362
|
c ? "text-primary" : "text-charcoal"
|
|
342
363
|
),
|
|
@@ -353,7 +374,7 @@ const Q = ({
|
|
|
353
374
|
] })
|
|
354
375
|
}
|
|
355
376
|
);
|
|
356
|
-
},
|
|
377
|
+
}, Ve = ({
|
|
357
378
|
onChannelSelect: t,
|
|
358
379
|
selectedChannel: s,
|
|
359
380
|
filters: n,
|
|
@@ -369,7 +390,7 @@ const Q = ({
|
|
|
369
390
|
}), /* @__PURE__ */ e(
|
|
370
391
|
"div",
|
|
371
392
|
{
|
|
372
|
-
className:
|
|
393
|
+
className: D(
|
|
373
394
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
374
395
|
r
|
|
375
396
|
),
|
|
@@ -377,7 +398,7 @@ const Q = ({
|
|
|
377
398
|
renderCount: a.current,
|
|
378
399
|
filters: n
|
|
379
400
|
}), /* @__PURE__ */ e(
|
|
380
|
-
|
|
401
|
+
Te,
|
|
381
402
|
{
|
|
382
403
|
filters: n,
|
|
383
404
|
sort: { last_message_at: -1 },
|
|
@@ -389,7 +410,7 @@ const Q = ({
|
|
|
389
410
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
390
411
|
isSelected: (s == null ? void 0 : s.id) === ((o = i.channel) == null ? void 0 : o.id)
|
|
391
412
|
}), /* @__PURE__ */ e(
|
|
392
|
-
|
|
413
|
+
_e,
|
|
393
414
|
{
|
|
394
415
|
...i,
|
|
395
416
|
selectedChannel: s,
|
|
@@ -412,7 +433,7 @@ const Q = ({
|
|
|
412
433
|
"button",
|
|
413
434
|
{
|
|
414
435
|
type: "button",
|
|
415
|
-
className:
|
|
436
|
+
className: D(
|
|
416
437
|
"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",
|
|
417
438
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
418
439
|
s
|
|
@@ -426,7 +447,7 @@ function oe({ label: t, className: s, children: n, ...r }) {
|
|
|
426
447
|
"button",
|
|
427
448
|
{
|
|
428
449
|
type: "button",
|
|
429
|
-
className:
|
|
450
|
+
className: D(
|
|
430
451
|
"rounded-full p-2 transition-colors focus-ring",
|
|
431
452
|
{
|
|
432
453
|
"cursor-not-allowed opacity-50": r.disabled,
|
|
@@ -448,10 +469,10 @@ function ge({ onClick: t }) {
|
|
|
448
469
|
const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
449
470
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet ๐" }),
|
|
450
471
|
/* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
|
|
451
|
-
] }) }),
|
|
472
|
+
] }) }), We = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
452
473
|
t && t(),
|
|
453
|
-
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
454
|
-
] }),
|
|
474
|
+
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(Ue, { focus: !0, maxRows: 4 }) })
|
|
475
|
+
] }), ze = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
|
|
455
476
|
var o, E, b, u;
|
|
456
477
|
const { channel: a } = me(), c = q.useMemo(() => Object.values(a.state.members || {}).find(
|
|
457
478
|
(I) => {
|
|
@@ -468,11 +489,11 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
468
489
|
onClick: t,
|
|
469
490
|
className: "inline-flex items-center justify-center w-8 h-8 rounded-lg hover:bg-sand focus:outline-none focus:ring-2 focus:ring-primary transition-colors lg:hidden",
|
|
470
491
|
"aria-label": "Back to conversations",
|
|
471
|
-
children: /* @__PURE__ */ e(
|
|
492
|
+
children: /* @__PURE__ */ e(Pe, { className: "h-5 w-5 text-stone", weight: "bold" })
|
|
472
493
|
}
|
|
473
494
|
),
|
|
474
495
|
/* @__PURE__ */ e(
|
|
475
|
-
|
|
496
|
+
J,
|
|
476
497
|
{
|
|
477
498
|
id: ((u = c == null ? void 0 : c.user) == null ? void 0 : u.id) || a.id || "unknown",
|
|
478
499
|
name: i,
|
|
@@ -482,9 +503,9 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
482
503
|
),
|
|
483
504
|
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: i }) })
|
|
484
505
|
] }),
|
|
485
|
-
r && n && /* @__PURE__ */ e(oe, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(
|
|
506
|
+
r && n && /* @__PURE__ */ e(oe, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(Oe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
|
|
486
507
|
] });
|
|
487
|
-
},
|
|
508
|
+
}, qe = ({
|
|
488
509
|
isOpen: t,
|
|
489
510
|
onClose: s,
|
|
490
511
|
participant: n,
|
|
@@ -493,20 +514,20 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
493
514
|
onLeaveConversation: c,
|
|
494
515
|
onBlockParticipant: i
|
|
495
516
|
}) => {
|
|
496
|
-
var
|
|
497
|
-
const { service: l, debug: o } = se(), E =
|
|
498
|
-
|
|
517
|
+
var M, A, Y, _, V, Q, W;
|
|
518
|
+
const { service: l, debug: o } = se(), E = G(null), [b, u] = C(!1), [f, I] = C(!1), [x, w] = C(!1);
|
|
519
|
+
H(() => {
|
|
499
520
|
const R = E.current;
|
|
500
521
|
R && (t ? R.showModal() : R.close());
|
|
501
522
|
}, [t]);
|
|
502
|
-
const m =
|
|
523
|
+
const m = P(async () => {
|
|
503
524
|
var R;
|
|
504
525
|
if (!(!l || !((R = n == null ? void 0 : n.user) != null && R.id)))
|
|
505
526
|
try {
|
|
506
527
|
const j = (await l.getBlockedUsers()).some(
|
|
507
528
|
(B) => {
|
|
508
|
-
var
|
|
509
|
-
return B.blocked_user_id === ((
|
|
529
|
+
var X;
|
|
530
|
+
return B.blocked_user_id === ((X = n == null ? void 0 : n.user) == null ? void 0 : X.id);
|
|
510
531
|
}
|
|
511
532
|
);
|
|
512
533
|
u(j);
|
|
@@ -516,8 +537,8 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
516
537
|
p
|
|
517
538
|
);
|
|
518
539
|
}
|
|
519
|
-
}, [l, (
|
|
520
|
-
|
|
540
|
+
}, [l, (M = n == null ? void 0 : n.user) == null ? void 0 : M.id]);
|
|
541
|
+
H(() => {
|
|
521
542
|
t && m();
|
|
522
543
|
}, [t, m]);
|
|
523
544
|
const k = async () => {
|
|
@@ -557,7 +578,7 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
557
578
|
w(!1);
|
|
558
579
|
}
|
|
559
580
|
}
|
|
560
|
-
},
|
|
581
|
+
}, T = () => {
|
|
561
582
|
s(), window.open(
|
|
562
583
|
"https://linktr.ee/s/about/trust-center/report",
|
|
563
584
|
"_blank",
|
|
@@ -565,7 +586,7 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
565
586
|
);
|
|
566
587
|
};
|
|
567
588
|
if (!n) return null;
|
|
568
|
-
const
|
|
589
|
+
const U = ((A = n.user) == null ? void 0 : A.name) || ((Y = n.user) == null ? void 0 : Y.id) || "Unknown member", h = (_ = n.user) == null ? void 0 : _.image, g = (V = n.user) == null ? void 0 : V.email, v = (Q = n.user) == null ? void 0 : Q.username, F = g || (v ? `linktr.ee/${v}` : void 0), z = ((W = n.user) == null ? void 0 : W.id) || "unknown";
|
|
569
590
|
return (
|
|
570
591
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
571
592
|
/* @__PURE__ */ e(
|
|
@@ -590,18 +611,18 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
590
611
|
style: { backgroundColor: "#FBFAF9" },
|
|
591
612
|
children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3 w-full", children: [
|
|
592
613
|
/* @__PURE__ */ e(
|
|
593
|
-
|
|
614
|
+
J,
|
|
594
615
|
{
|
|
595
616
|
id: z,
|
|
596
|
-
name:
|
|
617
|
+
name: U,
|
|
597
618
|
image: h,
|
|
598
619
|
size: 88,
|
|
599
620
|
className: "!rounded-full"
|
|
600
621
|
}
|
|
601
622
|
),
|
|
602
623
|
/* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
603
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
604
|
-
|
|
624
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: U }),
|
|
625
|
+
F && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: F }),
|
|
605
626
|
a && /* @__PURE__ */ e(
|
|
606
627
|
"span",
|
|
607
628
|
{
|
|
@@ -656,7 +677,7 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
656
677
|
]
|
|
657
678
|
}
|
|
658
679
|
) }),
|
|
659
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick:
|
|
680
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick: T, children: [
|
|
660
681
|
/* @__PURE__ */ e(Le, { className: "h-5 w-5" }),
|
|
661
682
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
662
683
|
] }) })
|
|
@@ -666,7 +687,7 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
666
687
|
}
|
|
667
688
|
)
|
|
668
689
|
);
|
|
669
|
-
},
|
|
690
|
+
}, Ye = ({
|
|
670
691
|
onBack: t,
|
|
671
692
|
showBackButton: s,
|
|
672
693
|
renderMessageInputActions: n,
|
|
@@ -688,9 +709,9 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
688
709
|
return x.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
689
710
|
}, [i.data]);
|
|
690
711
|
return /* @__PURE__ */ d(le, { children: [
|
|
691
|
-
/* @__PURE__ */ d(
|
|
712
|
+
/* @__PURE__ */ d(Fe, { children: [
|
|
692
713
|
/* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
|
|
693
|
-
|
|
714
|
+
ze,
|
|
694
715
|
{
|
|
695
716
|
onBack: t,
|
|
696
717
|
showBackButton: s,
|
|
@@ -699,18 +720,18 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
699
720
|
}
|
|
700
721
|
) }),
|
|
701
722
|
/* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
|
|
702
|
-
/* @__PURE__ */ e(
|
|
723
|
+
/* @__PURE__ */ e(Me, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
|
|
703
724
|
!E && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full bg-white", children: /* @__PURE__ */ e(c, {}) })
|
|
704
725
|
] }),
|
|
705
726
|
/* @__PURE__ */ e(
|
|
706
|
-
|
|
727
|
+
We,
|
|
707
728
|
{
|
|
708
729
|
renderActions: () => n == null ? void 0 : n(i)
|
|
709
730
|
}
|
|
710
731
|
)
|
|
711
732
|
] }),
|
|
712
733
|
/* @__PURE__ */ e(
|
|
713
|
-
|
|
734
|
+
qe,
|
|
714
735
|
{
|
|
715
736
|
isOpen: l,
|
|
716
737
|
onClose: () => o(!1),
|
|
@@ -722,7 +743,7 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
722
743
|
}
|
|
723
744
|
)
|
|
724
745
|
] });
|
|
725
|
-
},
|
|
746
|
+
}, Je = ({
|
|
726
747
|
channel: t,
|
|
727
748
|
onBack: s,
|
|
728
749
|
showBackButton: n = !1,
|
|
@@ -734,12 +755,12 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
734
755
|
}) => /* @__PURE__ */ e(
|
|
735
756
|
"div",
|
|
736
757
|
{
|
|
737
|
-
className:
|
|
758
|
+
className: D(
|
|
738
759
|
"messaging-channel-view h-full flex flex-col",
|
|
739
760
|
i
|
|
740
761
|
),
|
|
741
|
-
children: /* @__PURE__ */ e(
|
|
742
|
-
|
|
762
|
+
children: /* @__PURE__ */ e(De, { channel: t, children: /* @__PURE__ */ e(
|
|
763
|
+
Ye,
|
|
743
764
|
{
|
|
744
765
|
onBack: s,
|
|
745
766
|
showBackButton: n,
|
|
@@ -751,12 +772,12 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
|
|
|
751
772
|
) })
|
|
752
773
|
}
|
|
753
774
|
);
|
|
754
|
-
function
|
|
775
|
+
function Qe({
|
|
755
776
|
searchQuery: t,
|
|
756
777
|
setSearchQuery: s,
|
|
757
778
|
placeholder: n
|
|
758
779
|
}) {
|
|
759
|
-
const r =
|
|
780
|
+
const r = G(null);
|
|
760
781
|
return /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
761
782
|
/* @__PURE__ */ e(
|
|
762
783
|
je,
|
|
@@ -790,7 +811,7 @@ function Je({
|
|
|
790
811
|
)
|
|
791
812
|
] });
|
|
792
813
|
}
|
|
793
|
-
const
|
|
814
|
+
const Xe = ({
|
|
794
815
|
participantSource: t,
|
|
795
816
|
onSelectParticipant: s,
|
|
796
817
|
onClose: n,
|
|
@@ -801,8 +822,8 @@ const Qe = ({
|
|
|
801
822
|
}) => {
|
|
802
823
|
const { debug: l } = se(), [o, E] = C(""), [b, u] = C([]), [f, I] = C(!1), [x, w] = C(null), [m, k] = C(
|
|
803
824
|
null
|
|
804
|
-
), S =
|
|
805
|
-
|
|
825
|
+
), S = G(!1);
|
|
826
|
+
H(() => {
|
|
806
827
|
if (t.loading) {
|
|
807
828
|
l && console.log(
|
|
808
829
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
@@ -835,7 +856,7 @@ const Qe = ({
|
|
|
835
856
|
if (!o) return !0;
|
|
836
857
|
const g = o.toLowerCase();
|
|
837
858
|
return h.name.toLowerCase().includes(g) || ((v = h.email) == null ? void 0 : v.toLowerCase().includes(g)) || !1;
|
|
838
|
-
}),
|
|
859
|
+
}), T = P(
|
|
839
860
|
async (h) => {
|
|
840
861
|
if (!m) {
|
|
841
862
|
k(h.id);
|
|
@@ -847,10 +868,10 @@ const Qe = ({
|
|
|
847
868
|
}
|
|
848
869
|
},
|
|
849
870
|
[s, m]
|
|
850
|
-
),
|
|
851
|
-
(h.key === "Enter" || h.key === " ") && (h.preventDefault(),
|
|
871
|
+
), U = (h, g) => {
|
|
872
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), T(g));
|
|
852
873
|
};
|
|
853
|
-
return /* @__PURE__ */ d("div", { className:
|
|
874
|
+
return /* @__PURE__ */ d("div", { className: D("flex flex-col h-full", i), children: [
|
|
854
875
|
/* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
855
876
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
|
|
856
877
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
@@ -865,7 +886,7 @@ const Qe = ({
|
|
|
865
886
|
t.totalCount !== void 0 && ` โข ${t.totalCount} ${a} total`
|
|
866
887
|
] }),
|
|
867
888
|
/* @__PURE__ */ e(
|
|
868
|
-
|
|
889
|
+
Qe,
|
|
869
890
|
{
|
|
870
891
|
searchQuery: o,
|
|
871
892
|
setSearchQuery: E,
|
|
@@ -897,13 +918,13 @@ const Qe = ({
|
|
|
897
918
|
"button",
|
|
898
919
|
{
|
|
899
920
|
type: "button",
|
|
900
|
-
onClick: () =>
|
|
901
|
-
onKeyDown: (
|
|
921
|
+
onClick: () => T(h),
|
|
922
|
+
onKeyDown: (F) => U(F, h),
|
|
902
923
|
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",
|
|
903
924
|
children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
904
925
|
/* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
905
926
|
/* @__PURE__ */ e(
|
|
906
|
-
|
|
927
|
+
J,
|
|
907
928
|
{
|
|
908
929
|
id: h.id,
|
|
909
930
|
name: g,
|
|
@@ -927,7 +948,7 @@ const Qe = ({
|
|
|
927
948
|
] }) })
|
|
928
949
|
] }) })
|
|
929
950
|
] });
|
|
930
|
-
},
|
|
951
|
+
}, Ze = ({ hasChannels: t, onStartConversation: s, participantLabel: n }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
931
952
|
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "๐ฌ" }) }),
|
|
932
953
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
|
|
933
954
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(le, { children: [
|
|
@@ -970,10 +991,10 @@ const Qe = ({
|
|
|
970
991
|
children: "Go Back"
|
|
971
992
|
}
|
|
972
993
|
)
|
|
973
|
-
] }) }),
|
|
994
|
+
] }) }), Ke = ({ className: t, message: s }) => /* @__PURE__ */ d(
|
|
974
995
|
"div",
|
|
975
996
|
{
|
|
976
|
-
className:
|
|
997
|
+
className: D("flex items-center justify-center h-full", t),
|
|
977
998
|
children: [
|
|
978
999
|
/* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
979
1000
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
@@ -1013,10 +1034,10 @@ const Qe = ({
|
|
|
1013
1034
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1014
1035
|
]
|
|
1015
1036
|
}
|
|
1016
|
-
),
|
|
1017
|
-
/* @__PURE__ */ e(
|
|
1037
|
+
), es = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
1038
|
+
/* @__PURE__ */ e(Ke, { className: "w-6 h-6" }),
|
|
1018
1039
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1019
|
-
] }) }),
|
|
1040
|
+
] }) }), cs = ({
|
|
1020
1041
|
capabilities: t = {},
|
|
1021
1042
|
className: s,
|
|
1022
1043
|
renderMessageInputActions: n,
|
|
@@ -1036,8 +1057,8 @@ const Qe = ({
|
|
|
1036
1057
|
error: x,
|
|
1037
1058
|
refreshConnection: w,
|
|
1038
1059
|
debug: m
|
|
1039
|
-
} = Be(), [k, S] = C(null), [y,
|
|
1040
|
-
showStartConversation:
|
|
1060
|
+
} = Be(), [k, S] = C(null), [y, T] = C(!1), [U, h] = C(!1), [g, v] = C(/* @__PURE__ */ new Set()), [F, z] = C(0), [M, A] = C(!1), [Y, _] = C(null), V = G(null), {
|
|
1061
|
+
showStartConversation: Q = !1,
|
|
1041
1062
|
participantSource: W,
|
|
1042
1063
|
participantLabel: R = "participants"
|
|
1043
1064
|
} = t, p = q.useMemo(() => {
|
|
@@ -1053,7 +1074,7 @@ const Qe = ({
|
|
|
1053
1074
|
},
|
|
1054
1075
|
...E
|
|
1055
1076
|
};
|
|
1056
|
-
}, [E, u == null ? void 0 : u.userID]), j =
|
|
1077
|
+
}, [E, u == null ? void 0 : u.userID]), j = G(null), B = P(async () => {
|
|
1057
1078
|
if (!u || !f) return;
|
|
1058
1079
|
const N = u.userID;
|
|
1059
1080
|
if (N)
|
|
@@ -1066,27 +1087,27 @@ const Qe = ({
|
|
|
1066
1087
|
},
|
|
1067
1088
|
{},
|
|
1068
1089
|
{ limit: 100 }
|
|
1069
|
-
),
|
|
1070
|
-
L.forEach((
|
|
1071
|
-
const Ee =
|
|
1090
|
+
), O = /* @__PURE__ */ new Set();
|
|
1091
|
+
L.forEach(($) => {
|
|
1092
|
+
const Ee = $.state.members;
|
|
1072
1093
|
Object.values(Ee).forEach((ye) => {
|
|
1073
1094
|
var ae;
|
|
1074
1095
|
const te = (ae = ye.user) == null ? void 0 : ae.id;
|
|
1075
|
-
te && te !== N &&
|
|
1096
|
+
te && te !== N && O.add(te);
|
|
1076
1097
|
});
|
|
1077
|
-
}), v(
|
|
1098
|
+
}), v(O), T(L.length > 0), j.current = N, m && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1078
1099
|
channelCount: L.length,
|
|
1079
|
-
memberCount:
|
|
1100
|
+
memberCount: O.size
|
|
1080
1101
|
});
|
|
1081
1102
|
} catch (L) {
|
|
1082
1103
|
console.error("[MessagingShell] Failed to sync channels:", L);
|
|
1083
1104
|
}
|
|
1084
1105
|
}, [u, f, m]);
|
|
1085
|
-
|
|
1106
|
+
H(() => {
|
|
1086
1107
|
if (!u || !f) return;
|
|
1087
1108
|
const N = u.userID;
|
|
1088
1109
|
N && j.current !== N && B();
|
|
1089
|
-
}, [u, f, B]),
|
|
1110
|
+
}, [u, f, B]), H(() => {
|
|
1090
1111
|
if (!c || !u || !f) return;
|
|
1091
1112
|
(async () => {
|
|
1092
1113
|
const L = u.userID;
|
|
@@ -1096,7 +1117,7 @@ const Qe = ({
|
|
|
1096
1117
|
"[MessagingShell] Loading initial conversation with:",
|
|
1097
1118
|
c
|
|
1098
1119
|
);
|
|
1099
|
-
const
|
|
1120
|
+
const O = await u.queryChannels(
|
|
1100
1121
|
{
|
|
1101
1122
|
type: "messaging",
|
|
1102
1123
|
members: { $eq: [L, c] }
|
|
@@ -1104,10 +1125,10 @@ const Qe = ({
|
|
|
1104
1125
|
{},
|
|
1105
1126
|
{ limit: 1 }
|
|
1106
1127
|
);
|
|
1107
|
-
if (
|
|
1108
|
-
S(
|
|
1128
|
+
if (O.length > 0)
|
|
1129
|
+
S(O[0]), A(!0), _(null), r && r(O[0]), m && console.log(
|
|
1109
1130
|
"[MessagingShell] Initial conversation loaded:",
|
|
1110
|
-
|
|
1131
|
+
O[0].id
|
|
1111
1132
|
);
|
|
1112
1133
|
else if (i && b) {
|
|
1113
1134
|
m && console.log(
|
|
@@ -1115,20 +1136,20 @@ const Qe = ({
|
|
|
1115
1136
|
i
|
|
1116
1137
|
);
|
|
1117
1138
|
try {
|
|
1118
|
-
const
|
|
1139
|
+
const $ = await b.startChannelWithParticipant({
|
|
1119
1140
|
id: i.id,
|
|
1120
1141
|
name: i.name,
|
|
1121
1142
|
email: i.email,
|
|
1122
1143
|
phone: i.phone
|
|
1123
1144
|
});
|
|
1124
|
-
S(
|
|
1145
|
+
S($), A(!0), _(null), r && r($), m && console.log(
|
|
1125
1146
|
"[MessagingShell] Channel created and loaded:",
|
|
1126
|
-
|
|
1147
|
+
$.id
|
|
1127
1148
|
);
|
|
1128
|
-
} catch (
|
|
1149
|
+
} catch ($) {
|
|
1129
1150
|
console.error(
|
|
1130
1151
|
"[MessagingShell] Failed to create conversation:",
|
|
1131
|
-
|
|
1152
|
+
$
|
|
1132
1153
|
), _("Failed to create conversation");
|
|
1133
1154
|
}
|
|
1134
1155
|
} else
|
|
@@ -1138,10 +1159,10 @@ const Qe = ({
|
|
|
1138
1159
|
"[MessagingShell] No conversation found for:",
|
|
1139
1160
|
c
|
|
1140
1161
|
);
|
|
1141
|
-
} catch (
|
|
1162
|
+
} catch (O) {
|
|
1142
1163
|
console.error(
|
|
1143
1164
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1144
|
-
|
|
1165
|
+
O
|
|
1145
1166
|
), _("Failed to load conversation");
|
|
1146
1167
|
}
|
|
1147
1168
|
})();
|
|
@@ -1154,17 +1175,17 @@ const Qe = ({
|
|
|
1154
1175
|
m,
|
|
1155
1176
|
r
|
|
1156
1177
|
]);
|
|
1157
|
-
const
|
|
1178
|
+
const X = P(
|
|
1158
1179
|
(N) => {
|
|
1159
1180
|
S(N), r == null || r(N);
|
|
1160
1181
|
},
|
|
1161
1182
|
[r]
|
|
1162
|
-
), Ne =
|
|
1163
|
-
|
|
1164
|
-
}, [
|
|
1183
|
+
), Ne = P(() => {
|
|
1184
|
+
M || S(null);
|
|
1185
|
+
}, [M]), be = P(() => {
|
|
1165
1186
|
var N;
|
|
1166
1187
|
W && (z((L) => L + 1), h(!0), (N = V.current) == null || N.showModal());
|
|
1167
|
-
}, [W]), ve =
|
|
1188
|
+
}, [W]), ve = P(
|
|
1168
1189
|
async (N) => {
|
|
1169
1190
|
var L;
|
|
1170
1191
|
if (b)
|
|
@@ -1173,47 +1194,47 @@ const Qe = ({
|
|
|
1173
1194
|
"[MessagingShell] Starting conversation with:",
|
|
1174
1195
|
N.id
|
|
1175
1196
|
);
|
|
1176
|
-
const
|
|
1197
|
+
const O = await b.startChannelWithParticipant({
|
|
1177
1198
|
id: N.id,
|
|
1178
1199
|
name: N.name,
|
|
1179
1200
|
email: N.email,
|
|
1180
1201
|
phone: N.phone
|
|
1181
1202
|
});
|
|
1182
1203
|
try {
|
|
1183
|
-
await
|
|
1184
|
-
} catch (
|
|
1185
|
-
console.warn("[MessagingShell] Failed to unhide channel:",
|
|
1204
|
+
await O.show();
|
|
1205
|
+
} catch ($) {
|
|
1206
|
+
console.warn("[MessagingShell] Failed to unhide channel:", $);
|
|
1186
1207
|
}
|
|
1187
|
-
S(
|
|
1188
|
-
} catch (
|
|
1189
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1208
|
+
S(O), h(!1), (L = V.current) == null || L.close(), a == null || a(N);
|
|
1209
|
+
} catch (O) {
|
|
1210
|
+
console.error("[MessagingShell] Failed to start conversation:", O);
|
|
1190
1211
|
}
|
|
1191
1212
|
},
|
|
1192
1213
|
[b, a, m]
|
|
1193
|
-
), ne =
|
|
1214
|
+
), ne = P(() => {
|
|
1194
1215
|
var N;
|
|
1195
1216
|
h(!1), (N = V.current) == null || N.close();
|
|
1196
|
-
}, []), Ce =
|
|
1217
|
+
}, []), Ce = P(
|
|
1197
1218
|
async (N) => {
|
|
1198
1219
|
m && console.log("[MessagingShell] Leaving conversation:", N.id), S(null), A(!1), j.current = null, await B();
|
|
1199
1220
|
},
|
|
1200
1221
|
[B, m]
|
|
1201
|
-
), we =
|
|
1222
|
+
), we = P(
|
|
1202
1223
|
async (N) => {
|
|
1203
1224
|
m && console.log("[MessagingShell] Blocking participant:", N), S(null), A(!1), j.current = null, await B();
|
|
1204
1225
|
},
|
|
1205
1226
|
[B, m]
|
|
1206
1227
|
), Z = !!k;
|
|
1207
|
-
return I ? /* @__PURE__ */ e("div", { className:
|
|
1228
|
+
return I ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(es, {}) }) : x ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(re, { message: x, onBack: w }) }) : !f || !u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
|
|
1208
1229
|
re,
|
|
1209
1230
|
{
|
|
1210
1231
|
message: "Not connected to messaging service",
|
|
1211
1232
|
onBack: w
|
|
1212
1233
|
}
|
|
1213
|
-
) }) :
|
|
1234
|
+
) }) : Y ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(re, { message: Y }) }) : /* @__PURE__ */ d(
|
|
1214
1235
|
"div",
|
|
1215
1236
|
{
|
|
1216
|
-
className:
|
|
1237
|
+
className: D(
|
|
1217
1238
|
"messaging-shell h-full bg-white overflow-hidden",
|
|
1218
1239
|
s
|
|
1219
1240
|
),
|
|
@@ -1222,21 +1243,21 @@ const Qe = ({
|
|
|
1222
1243
|
/* @__PURE__ */ e(
|
|
1223
1244
|
"div",
|
|
1224
1245
|
{
|
|
1225
|
-
className:
|
|
1246
|
+
className: D(
|
|
1226
1247
|
"messaging-channel-list-sidebar min-h-0 min-w-0 bg-white lg:bg-chalk lg:flex lg:flex-col lg:border-r lg:border-sand",
|
|
1227
1248
|
{
|
|
1228
1249
|
// Explicitly hidden via prop or in direct conversation mode
|
|
1229
|
-
"!hidden": o === !1 ||
|
|
1250
|
+
"!hidden": o === !1 || M,
|
|
1230
1251
|
// Normal mode: hide on mobile when channel selected, show on desktop
|
|
1231
|
-
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": o !== !1 && !
|
|
1252
|
+
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": o !== !1 && !M && Z,
|
|
1232
1253
|
// Normal mode: show when no channel selected
|
|
1233
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": o !== !1 && !
|
|
1254
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": o !== !1 && !M && !Z
|
|
1234
1255
|
}
|
|
1235
1256
|
),
|
|
1236
1257
|
children: /* @__PURE__ */ e(
|
|
1237
|
-
|
|
1258
|
+
Ve,
|
|
1238
1259
|
{
|
|
1239
|
-
onChannelSelect:
|
|
1260
|
+
onChannelSelect: X,
|
|
1240
1261
|
selectedChannel: k || void 0,
|
|
1241
1262
|
filters: p
|
|
1242
1263
|
}
|
|
@@ -1246,21 +1267,21 @@ const Qe = ({
|
|
|
1246
1267
|
/* @__PURE__ */ e(
|
|
1247
1268
|
"div",
|
|
1248
1269
|
{
|
|
1249
|
-
className:
|
|
1270
|
+
className: D(
|
|
1250
1271
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1251
1272
|
{
|
|
1252
1273
|
// In direct conversation mode, always show (full width)
|
|
1253
|
-
flex:
|
|
1274
|
+
flex: M || Z,
|
|
1254
1275
|
// Normal mode: hide on mobile when no channel selected
|
|
1255
|
-
"hidden lg:flex": !
|
|
1276
|
+
"hidden lg:flex": !M && !Z
|
|
1256
1277
|
}
|
|
1257
1278
|
),
|
|
1258
1279
|
children: k ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1259
|
-
|
|
1280
|
+
Je,
|
|
1260
1281
|
{
|
|
1261
1282
|
channel: k,
|
|
1262
1283
|
onBack: Ne,
|
|
1263
|
-
showBackButton: !
|
|
1284
|
+
showBackButton: !M,
|
|
1264
1285
|
renderMessageInputActions: n,
|
|
1265
1286
|
onLeaveConversation: Ce,
|
|
1266
1287
|
onBlockParticipant: we,
|
|
@@ -1268,10 +1289,10 @@ const Qe = ({
|
|
|
1268
1289
|
},
|
|
1269
1290
|
k.id
|
|
1270
1291
|
) }) : /* @__PURE__ */ e(
|
|
1271
|
-
|
|
1292
|
+
Ze,
|
|
1272
1293
|
{
|
|
1273
1294
|
hasChannels: y,
|
|
1274
|
-
onStartConversation:
|
|
1295
|
+
onStartConversation: Q ? be : void 0,
|
|
1275
1296
|
participantLabel: R
|
|
1276
1297
|
}
|
|
1277
1298
|
)
|
|
@@ -1289,7 +1310,7 @@ const Qe = ({
|
|
|
1289
1310
|
},
|
|
1290
1311
|
onClose: ne,
|
|
1291
1312
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1292
|
-
|
|
1313
|
+
Xe,
|
|
1293
1314
|
{
|
|
1294
1315
|
participantSource: W,
|
|
1295
1316
|
onSelectParticipant: ve,
|
|
@@ -1298,14 +1319,14 @@ const Qe = ({
|
|
|
1298
1319
|
participantLabel: R,
|
|
1299
1320
|
searchPlaceholder: `Search ${R}...`
|
|
1300
1321
|
},
|
|
1301
|
-
|
|
1322
|
+
F
|
|
1302
1323
|
) })
|
|
1303
1324
|
}
|
|
1304
1325
|
)
|
|
1305
1326
|
]
|
|
1306
1327
|
}
|
|
1307
1328
|
);
|
|
1308
|
-
},
|
|
1329
|
+
}, ss = ({
|
|
1309
1330
|
question: t,
|
|
1310
1331
|
onClick: s,
|
|
1311
1332
|
loading: n = !1,
|
|
@@ -1317,7 +1338,7 @@ const Qe = ({
|
|
|
1317
1338
|
onClick: s,
|
|
1318
1339
|
disabled: n,
|
|
1319
1340
|
style: { backgroundColor: "#E6E5E3" },
|
|
1320
|
-
className:
|
|
1341
|
+
className: D(
|
|
1321
1342
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1322
1343
|
{
|
|
1323
1344
|
"hover:brightness-95 active:brightness-90": !n,
|
|
@@ -1327,7 +1348,7 @@ const Qe = ({
|
|
|
1327
1348
|
),
|
|
1328
1349
|
children: t
|
|
1329
1350
|
}
|
|
1330
|
-
),
|
|
1351
|
+
), ds = ({
|
|
1331
1352
|
faqs: t,
|
|
1332
1353
|
onFaqClick: s,
|
|
1333
1354
|
loadingFaqId: n,
|
|
@@ -1337,9 +1358,9 @@ const Qe = ({
|
|
|
1337
1358
|
avatarName: i
|
|
1338
1359
|
}) => {
|
|
1339
1360
|
const l = t.filter((o) => o.enabled).sort((o, E) => (o.order ?? 0) - (E.order ?? 0));
|
|
1340
|
-
return l.length === 0 ? null : /* @__PURE__ */ e("div", { className:
|
|
1361
|
+
return l.length === 0 ? null : /* @__PURE__ */ e("div", { className: D("px-4 py-6", a), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
|
|
1341
1362
|
(c || i) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1342
|
-
|
|
1363
|
+
J,
|
|
1343
1364
|
{
|
|
1344
1365
|
id: i || "account",
|
|
1345
1366
|
name: i || "Account",
|
|
@@ -1355,7 +1376,7 @@ const Qe = ({
|
|
|
1355
1376
|
children: [
|
|
1356
1377
|
r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
|
|
1357
1378
|
l.map((o) => /* @__PURE__ */ e(
|
|
1358
|
-
|
|
1379
|
+
ss,
|
|
1359
1380
|
{
|
|
1360
1381
|
question: o.question,
|
|
1361
1382
|
onClick: () => s(o.id),
|
|
@@ -1367,19 +1388,19 @@ const Qe = ({
|
|
|
1367
1388
|
}
|
|
1368
1389
|
)
|
|
1369
1390
|
] }) });
|
|
1370
|
-
},
|
|
1371
|
-
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] = C([]), [i, l] = C(!1), [o, E] = C(null), [b, u] = C(n), [f, I] = C(!0), [x, w] = C(), m =
|
|
1391
|
+
}, us = (t, s = {}) => {
|
|
1392
|
+
const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] = C([]), [i, l] = C(!1), [o, E] = C(null), [b, u] = C(n), [f, I] = C(!0), [x, w] = C(), m = P(async (T = !1, U) => {
|
|
1372
1393
|
if (i) return;
|
|
1373
|
-
const h =
|
|
1394
|
+
const h = U !== void 0 ? U : b;
|
|
1374
1395
|
l(!0), E(null);
|
|
1375
1396
|
try {
|
|
1376
1397
|
const g = await t.loadParticipants({
|
|
1377
1398
|
search: h || void 0,
|
|
1378
1399
|
limit: r,
|
|
1379
|
-
cursor:
|
|
1400
|
+
cursor: T ? void 0 : x
|
|
1380
1401
|
});
|
|
1381
1402
|
c(
|
|
1382
|
-
(v) =>
|
|
1403
|
+
(v) => T ? g.participants : [...v, ...g.participants]
|
|
1383
1404
|
), I(g.hasMore), w(g.nextCursor);
|
|
1384
1405
|
} catch (g) {
|
|
1385
1406
|
const v = g instanceof Error ? g.message : "Failed to load participants";
|
|
@@ -1387,14 +1408,14 @@ const Qe = ({
|
|
|
1387
1408
|
} finally {
|
|
1388
1409
|
l(!1);
|
|
1389
1410
|
}
|
|
1390
|
-
}, [t, b, x, r, i]), k =
|
|
1411
|
+
}, [t, b, x, r, i]), k = P(() => {
|
|
1391
1412
|
f && !i && m(!1);
|
|
1392
|
-
}, [f, i, m]), S =
|
|
1393
|
-
u(
|
|
1394
|
-
}, [m]), y =
|
|
1413
|
+
}, [f, i, m]), S = P((T) => {
|
|
1414
|
+
u(T), w(void 0), m(!0, T);
|
|
1415
|
+
}, [m]), y = P(() => {
|
|
1395
1416
|
w(void 0), m(!0);
|
|
1396
1417
|
}, [m]);
|
|
1397
|
-
return
|
|
1418
|
+
return H(() => {
|
|
1398
1419
|
m(!0);
|
|
1399
1420
|
}, [t.loadParticipants]), {
|
|
1400
1421
|
participants: a,
|
|
@@ -1409,16 +1430,17 @@ const Qe = ({
|
|
|
1409
1430
|
};
|
|
1410
1431
|
};
|
|
1411
1432
|
export {
|
|
1412
|
-
|
|
1433
|
+
J as Avatar,
|
|
1413
1434
|
xe as ChannelEmptyState,
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1435
|
+
Ve as ChannelList,
|
|
1436
|
+
Je as ChannelView,
|
|
1437
|
+
ds as FaqList,
|
|
1438
|
+
ss as FaqListItem,
|
|
1439
|
+
is as MessagingProvider,
|
|
1440
|
+
cs as MessagingShell,
|
|
1441
|
+
Xe as ParticipantPicker,
|
|
1442
|
+
$e as formatRelativeTime,
|
|
1421
1443
|
Be as useMessaging,
|
|
1422
|
-
|
|
1444
|
+
us as useParticipants
|
|
1423
1445
|
};
|
|
1424
1446
|
//# sourceMappingURL=index.js.map
|