@linktr.ee/messaging-react 1.10.0 โ 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +12 -0
- package/dist/index.js +297 -287
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.tsx +2 -1
- package/src/components/CustomSystemMessage/index.tsx +16 -0
- package/src/stream-custom-data.ts +28 -0
- package/src/types.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as c, Fragment as he } from "react/jsx-runtime";
|
|
2
2
|
import R from "classnames";
|
|
3
|
-
import q, { createContext as Se, useContext as ke, useCallback as
|
|
3
|
+
import q, { createContext as Se, useContext as ke, useCallback as _, useState as E, useRef as B, useEffect as H } from "react";
|
|
4
4
|
import { StreamChatService as Re } from "@linktr.ee/messaging-core";
|
|
5
|
-
import { Chat as pe, ChannelList as Fe, useMessageComposer as Te, useStateStore as De, MessageInput as
|
|
6
|
-
import { XIcon as le, ArrowUpIcon as $e, ArrowLeftIcon as ae, DotsThreeIcon as ie, SpinnerGapIcon as ee, SignOutIcon as
|
|
5
|
+
import { Chat as pe, ChannelList as Fe, useMessageComposer as Te, useStateStore as De, MessageInput as _e, useMessageInputContext as Me, useMessageComposerHasSendableData as Pe, SimpleAttachmentSelector as Le, QuotedMessagePreview as Ue, AttachmentPreviewList as Oe, TextareaComposer as je, MessageTimestamp as Ae, Channel as ze, useChannelStateContext as fe, Window as Be, MessageList as He } from "stream-chat-react";
|
|
6
|
+
import { XIcon as le, ArrowUpIcon as $e, ArrowLeftIcon as ae, DotsThreeIcon as ie, SpinnerGapIcon as ee, SignOutIcon as Ge, ProhibitInsetIcon as ce, FlagIcon as Ve, MagnifyingGlassIcon as We, ChatCircleDotsIcon as de } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as ue } from "stream-chat";
|
|
8
8
|
const ge = Se({
|
|
9
9
|
service: null,
|
|
@@ -15,7 +15,7 @@ const ge = Se({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), se = () => ke(ge),
|
|
18
|
+
}), se = () => ke(ge), ys = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
@@ -23,7 +23,7 @@ const ge = Se({
|
|
|
23
23
|
capabilities: o = {},
|
|
24
24
|
debug: a = !1
|
|
25
25
|
}) => {
|
|
26
|
-
const r =
|
|
26
|
+
const r = _(
|
|
27
27
|
(u, ...N) => {
|
|
28
28
|
a && console.log(`๐ฅ [MessagingProvider] ${u}`, ...N);
|
|
29
29
|
},
|
|
@@ -35,7 +35,7 @@ const ge = Se({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(o)
|
|
37
37
|
});
|
|
38
|
-
const [i, m] = E(null), [x, k] = E(null), [
|
|
38
|
+
const [i, m] = E(null), [x, k] = E(null), [h, f] = E(!1), [y, g] = E(!1), [C, w] = E(null), v = B(!1), I = B({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: l,
|
|
41
41
|
serviceConfig: n,
|
|
@@ -45,17 +45,17 @@ const ge = Se({
|
|
|
45
45
|
renderCount: S.current,
|
|
46
46
|
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
|
|
47
47
|
propChanges: {
|
|
48
|
-
userChanged:
|
|
49
|
-
apiKeyChanged:
|
|
50
|
-
serviceConfigChanged:
|
|
51
|
-
capabilitiesChanged:
|
|
48
|
+
userChanged: I.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
+
apiKeyChanged: I.current.apiKey !== l,
|
|
50
|
+
serviceConfigChanged: I.current.serviceConfig !== n,
|
|
51
|
+
capabilitiesChanged: I.current.capabilities !== o
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
53
|
+
}), I.current = {
|
|
54
54
|
userId: s == null ? void 0 : s.id,
|
|
55
55
|
apiKey: l,
|
|
56
56
|
serviceConfig: n,
|
|
57
57
|
capabilities: o
|
|
58
|
-
},
|
|
58
|
+
}, H(() => {
|
|
59
59
|
const u = S.current;
|
|
60
60
|
if (r("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
61
|
renderCount: u,
|
|
@@ -64,8 +64,8 @@ const ge = Se({
|
|
|
64
64
|
dependencies: {
|
|
65
65
|
apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
|
|
66
66
|
serviceConfigRef: n,
|
|
67
|
-
serviceConfigStable:
|
|
68
|
-
apiKeyStable:
|
|
67
|
+
serviceConfigStable: I.current.serviceConfig === n,
|
|
68
|
+
apiKeyStable: I.current.apiKey === l
|
|
69
69
|
}
|
|
70
70
|
}), !l || !n) {
|
|
71
71
|
r("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
@@ -77,7 +77,7 @@ const ge = Se({
|
|
|
77
77
|
r("๐ CREATING NEW SERVICE", {
|
|
78
78
|
renderCount: u,
|
|
79
79
|
apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
|
|
80
|
-
serviceConfigChanged:
|
|
80
|
+
serviceConfigChanged: I.current.serviceConfig !== n
|
|
81
81
|
});
|
|
82
82
|
const N = new Re({
|
|
83
83
|
...n,
|
|
@@ -95,14 +95,14 @@ const ge = Se({
|
|
|
95
95
|
};
|
|
96
96
|
}, [l, n, a, r]);
|
|
97
97
|
const p = B(null);
|
|
98
|
-
|
|
98
|
+
H(() => {
|
|
99
99
|
var N, j;
|
|
100
100
|
if (r("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
101
|
hasService: !!i,
|
|
102
102
|
hasUser: !!s,
|
|
103
103
|
userId: s == null ? void 0 : s.id,
|
|
104
104
|
isConnecting: v.current,
|
|
105
|
-
isConnected:
|
|
105
|
+
isConnected: h,
|
|
106
106
|
dependencies: { service: !!i, userId: s == null ? void 0 : s.id }
|
|
107
107
|
}), !i || !s) {
|
|
108
108
|
r("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
@@ -124,7 +124,7 @@ const ge = Se({
|
|
|
124
124
|
try {
|
|
125
125
|
r("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
126
|
const A = await i.connectUser(s);
|
|
127
|
-
k(A),
|
|
127
|
+
k(A), f(!0), p.current = { serviceId: i, userId: s.id }, r("โ
USER CONNECTION SUCCESS", {
|
|
128
128
|
userId: s.id,
|
|
129
129
|
clientId: A.userID
|
|
130
130
|
});
|
|
@@ -137,23 +137,23 @@ const ge = Se({
|
|
|
137
137
|
} finally {
|
|
138
138
|
g(!1), v.current = !1, r("๐ USER CONNECTION FINISHED", {
|
|
139
139
|
userId: s.id,
|
|
140
|
-
isConnected:
|
|
140
|
+
isConnected: h
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
})();
|
|
144
|
-
}, [i, s, r,
|
|
144
|
+
}, [i, s, r, h]), H(() => (r("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
145
|
hasService: !!i,
|
|
146
|
-
isConnected:
|
|
146
|
+
isConnected: h
|
|
147
147
|
}), () => {
|
|
148
|
-
i &&
|
|
148
|
+
i && h ? (r(
|
|
149
149
|
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
150
|
"Cleaning up connection on unmount"
|
|
151
151
|
), p.current = null, i.disconnectUser().catch(console.error)) : r("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
152
|
hasService: !!i,
|
|
153
|
-
isConnected:
|
|
153
|
+
isConnected: h
|
|
154
154
|
});
|
|
155
|
-
}), [i,
|
|
156
|
-
const T =
|
|
155
|
+
}), [i, h, r]);
|
|
156
|
+
const T = _(async () => {
|
|
157
157
|
if (r("๐ REFRESH CONNECTION CALLED", {
|
|
158
158
|
hasService: !!i,
|
|
159
159
|
hasUser: !!s
|
|
@@ -165,7 +165,7 @@ const ge = Se({
|
|
|
165
165
|
try {
|
|
166
166
|
r("๐ DISCONNECTING FOR REFRESH"), await i.disconnectUser(), r("๐ RECONNECTING FOR REFRESH");
|
|
167
167
|
const u = await i.connectUser(s);
|
|
168
|
-
k(u),
|
|
168
|
+
k(u), f(!0), w(null), r("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
169
|
} catch (u) {
|
|
170
170
|
const N = u instanceof Error ? u.message : "Refresh failed";
|
|
171
171
|
w(N), r("โ CONNECTION REFRESH ERROR", {
|
|
@@ -175,18 +175,18 @@ const ge = Se({
|
|
|
175
175
|
} finally {
|
|
176
176
|
g(!1), r("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
177
|
}
|
|
178
|
-
}, [i, s, r]),
|
|
178
|
+
}, [i, s, r]), d = q.useMemo(() => (r("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
179
|
hasService: !!i,
|
|
180
180
|
hasClient: !!x,
|
|
181
|
-
isConnected:
|
|
182
|
-
isLoading:
|
|
181
|
+
isConnected: h,
|
|
182
|
+
isLoading: y,
|
|
183
183
|
hasError: !!C,
|
|
184
184
|
capabilitiesKeys: Object.keys(o)
|
|
185
185
|
}), {
|
|
186
186
|
service: i,
|
|
187
187
|
client: x,
|
|
188
|
-
isConnected:
|
|
189
|
-
isLoading:
|
|
188
|
+
isConnected: h,
|
|
189
|
+
isLoading: y,
|
|
190
190
|
error: C,
|
|
191
191
|
capabilities: o,
|
|
192
192
|
refreshConnection: T,
|
|
@@ -194,8 +194,8 @@ const ge = Se({
|
|
|
194
194
|
}), [
|
|
195
195
|
i,
|
|
196
196
|
x,
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
h,
|
|
198
|
+
y,
|
|
199
199
|
C,
|
|
200
200
|
o,
|
|
201
201
|
T,
|
|
@@ -204,21 +204,21 @@ const ge = Se({
|
|
|
204
204
|
]);
|
|
205
205
|
return r("๐ RENDER END", {
|
|
206
206
|
renderCount: S.current,
|
|
207
|
-
willRenderChat: !!(x &&
|
|
208
|
-
contextValueReady: !!
|
|
209
|
-
}), /* @__PURE__ */ e(ge.Provider, { value:
|
|
210
|
-
},
|
|
207
|
+
willRenderChat: !!(x && h),
|
|
208
|
+
contextValueReady: !!d
|
|
209
|
+
}), /* @__PURE__ */ e(ge.Provider, { value: d, children: x && h ? /* @__PURE__ */ e(pe, { client: x, children: t }) : t });
|
|
210
|
+
}, qe = () => se(), Ye = (t, s) => {
|
|
211
211
|
const n = new Date(
|
|
212
212
|
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
213
213
|
), o = new Date(
|
|
214
214
|
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
215
215
|
).getTime() - n.getTime();
|
|
216
216
|
return Math.floor(o / (1e3 * 60 * 60 * 24));
|
|
217
|
-
},
|
|
217
|
+
}, Je = (t) => {
|
|
218
218
|
const s = /* @__PURE__ */ new Date();
|
|
219
219
|
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
220
220
|
return "Just now";
|
|
221
|
-
const l =
|
|
221
|
+
const l = Ye(t, s);
|
|
222
222
|
return l === 0 ? t.toLocaleTimeString([], {
|
|
223
223
|
hour: "numeric",
|
|
224
224
|
minute: "2-digit"
|
|
@@ -255,7 +255,7 @@ const ge = Se({
|
|
|
255
255
|
"๐"
|
|
256
256
|
// Melon
|
|
257
257
|
];
|
|
258
|
-
function
|
|
258
|
+
function Qe(t) {
|
|
259
259
|
let s = 0;
|
|
260
260
|
for (let n = 0; n < t.length; n++) {
|
|
261
261
|
const l = t.charCodeAt(n);
|
|
@@ -263,8 +263,8 @@ function Je(t) {
|
|
|
263
263
|
}
|
|
264
264
|
return Math.abs(s);
|
|
265
265
|
}
|
|
266
|
-
function
|
|
267
|
-
const n =
|
|
266
|
+
function Xe(t) {
|
|
267
|
+
const n = Qe(t) % me.length;
|
|
268
268
|
return me[n];
|
|
269
269
|
}
|
|
270
270
|
const Y = ({
|
|
@@ -274,7 +274,7 @@ const Y = ({
|
|
|
274
274
|
className: l,
|
|
275
275
|
shape: o = "squircle"
|
|
276
276
|
}) => {
|
|
277
|
-
const a =
|
|
277
|
+
const a = Xe(t), i = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = o === "circle" ? { borderRadius: "50%" } : {
|
|
278
278
|
borderRadius: "33%",
|
|
279
279
|
"corner-shape": "superellipse(1.3)"
|
|
280
280
|
};
|
|
@@ -307,21 +307,21 @@ const Y = ({
|
|
|
307
307
|
)
|
|
308
308
|
}
|
|
309
309
|
);
|
|
310
|
-
},
|
|
311
|
-
var w, v,
|
|
310
|
+
}, Ze = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1, unread: o }) => {
|
|
311
|
+
var w, v, I, S, p, T;
|
|
312
312
|
const a = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), r = () => {
|
|
313
313
|
t && n(t);
|
|
314
314
|
}, m = Object.values(((w = t == null ? void 0 : t.state) == null ? void 0 : w.members) || {}).find(
|
|
315
|
-
(
|
|
315
|
+
(d) => {
|
|
316
316
|
var u, N;
|
|
317
|
-
return ((u =
|
|
317
|
+
return ((u = d.user) == null ? void 0 : u.id) && d.user.id !== ((N = t == null ? void 0 : t._client) == null ? void 0 : N.userID);
|
|
318
318
|
}
|
|
319
|
-
), x = ((v = m == null ? void 0 : m.user) == null ? void 0 : v.name) || "Conversation", k = (
|
|
319
|
+
), x = ((v = m == null ? void 0 : m.user) == null ? void 0 : v.name) || "Conversation", k = (I = m == null ? void 0 : m.user) == null ? void 0 : I.image, h = (p = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : p[t.state.messages.length - 1], y = (() => {
|
|
320
320
|
var u;
|
|
321
|
-
if (
|
|
322
|
-
const
|
|
323
|
-
return
|
|
324
|
-
})(), g =
|
|
321
|
+
if (h != null && h.text) return h.text;
|
|
322
|
+
const d = (u = h == null ? void 0 : h.attachments) == null ? void 0 : u[0];
|
|
323
|
+
return d != null && d.asset_url ? d.asset_url : d != null && d.image_url ? d.image_url : d != null && d.og_scrape_url ? d.og_scrape_url : d != null && d.thumb_url ? d.thumb_url : "No messages yet";
|
|
324
|
+
})(), g = h != null && h.created_at ? Je(new Date(h.created_at)) : "", C = o ?? 0;
|
|
325
325
|
return l && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
326
326
|
channelId: t == null ? void 0 : t.id,
|
|
327
327
|
isSelected: a,
|
|
@@ -340,7 +340,7 @@ const Y = ({
|
|
|
340
340
|
"hover:bg-sand": !a
|
|
341
341
|
}
|
|
342
342
|
),
|
|
343
|
-
children: /* @__PURE__ */
|
|
343
|
+
children: /* @__PURE__ */ c("div", { className: "flex items-start gap-3", children: [
|
|
344
344
|
/* @__PURE__ */ e(
|
|
345
345
|
Y,
|
|
346
346
|
{
|
|
@@ -351,8 +351,8 @@ const Y = ({
|
|
|
351
351
|
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
352
352
|
}
|
|
353
353
|
),
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
355
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2", children: [
|
|
356
356
|
/* @__PURE__ */ e(
|
|
357
357
|
"h3",
|
|
358
358
|
{
|
|
@@ -365,15 +365,15 @@ const Y = ({
|
|
|
365
365
|
),
|
|
366
366
|
g && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: g })
|
|
367
367
|
] }),
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children:
|
|
368
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
369
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: y }),
|
|
370
370
|
C > 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: C > 99 ? "99+" : C })
|
|
371
371
|
] })
|
|
372
372
|
] })
|
|
373
373
|
] })
|
|
374
374
|
}
|
|
375
375
|
);
|
|
376
|
-
},
|
|
376
|
+
}, Ke = ({
|
|
377
377
|
onChannelSelect: t,
|
|
378
378
|
selectedChannel: s,
|
|
379
379
|
filters: n,
|
|
@@ -410,7 +410,7 @@ const Y = ({
|
|
|
410
410
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
411
411
|
isSelected: (s == null ? void 0 : s.id) === ((x = i.channel) == null ? void 0 : x.id)
|
|
412
412
|
}), /* @__PURE__ */ e(
|
|
413
|
-
|
|
413
|
+
Ze,
|
|
414
414
|
{
|
|
415
415
|
...i,
|
|
416
416
|
selectedChannel: s,
|
|
@@ -444,7 +444,7 @@ const Y = ({
|
|
|
444
444
|
}
|
|
445
445
|
);
|
|
446
446
|
function xe({ label: t, className: s, children: n, ...l }) {
|
|
447
|
-
return /* @__PURE__ */
|
|
447
|
+
return /* @__PURE__ */ c(
|
|
448
448
|
"button",
|
|
449
449
|
{
|
|
450
450
|
type: "button",
|
|
@@ -467,16 +467,16 @@ function xe({ label: t, className: s, children: n, ...l }) {
|
|
|
467
467
|
function Ne({ onClick: t }) {
|
|
468
468
|
return /* @__PURE__ */ e(xe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(le, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
469
469
|
}
|
|
470
|
-
const
|
|
470
|
+
const es = (t) => ({
|
|
471
471
|
linkPreviews: Array.from(t.previews.values()).filter(
|
|
472
472
|
(s) => ue.previewIsLoaded(s) || ue.previewIsLoading(s)
|
|
473
473
|
)
|
|
474
|
-
}),
|
|
474
|
+
}), ss = ({
|
|
475
475
|
link: t,
|
|
476
476
|
onDismiss: s
|
|
477
477
|
}) => {
|
|
478
478
|
const { og_scrape_url: n, title: l, image_url: o } = t;
|
|
479
|
-
return /* @__PURE__ */
|
|
479
|
+
return /* @__PURE__ */ c(
|
|
480
480
|
"a",
|
|
481
481
|
{
|
|
482
482
|
href: n,
|
|
@@ -504,22 +504,22 @@ const Ke = (t) => ({
|
|
|
504
504
|
children: /* @__PURE__ */ e(le, { className: "size-4 text-black/90" })
|
|
505
505
|
}
|
|
506
506
|
),
|
|
507
|
-
/* @__PURE__ */
|
|
507
|
+
/* @__PURE__ */ c("div", { className: "p-2", children: [
|
|
508
508
|
l && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: l }),
|
|
509
509
|
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
510
510
|
] })
|
|
511
511
|
]
|
|
512
512
|
}
|
|
513
513
|
);
|
|
514
|
-
},
|
|
514
|
+
}, ts = () => {
|
|
515
515
|
const { linkPreviewsManager: t } = Te(), { linkPreviews: s } = De(
|
|
516
516
|
t.state,
|
|
517
|
-
|
|
517
|
+
es
|
|
518
518
|
), n = (o) => {
|
|
519
519
|
t.dismissPreview(o);
|
|
520
520
|
};
|
|
521
521
|
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ e(
|
|
522
|
-
|
|
522
|
+
ss,
|
|
523
523
|
{
|
|
524
524
|
link: o,
|
|
525
525
|
onDismiss: n
|
|
@@ -527,14 +527,14 @@ const Ke = (t) => ({
|
|
|
527
527
|
o.og_scrape_url
|
|
528
528
|
)) }) : null;
|
|
529
529
|
}, ns = () => {
|
|
530
|
-
const { handleSubmit: t } = Me(), s =
|
|
531
|
-
return /* @__PURE__ */
|
|
532
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
/* @__PURE__ */ e(
|
|
535
|
-
/* @__PURE__ */ e(
|
|
530
|
+
const { handleSubmit: t } = Me(), s = Pe();
|
|
531
|
+
return /* @__PURE__ */ c(he, { children: [
|
|
532
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Le, {}) }),
|
|
533
|
+
/* @__PURE__ */ c("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-lg 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: [
|
|
534
|
+
/* @__PURE__ */ e(Ue, {}),
|
|
535
|
+
/* @__PURE__ */ e(ts, {}),
|
|
536
536
|
/* @__PURE__ */ e(Oe, {}),
|
|
537
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ c("div", { className: "flex", children: [
|
|
538
538
|
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4", children: /* @__PURE__ */ e(
|
|
539
539
|
je,
|
|
540
540
|
{
|
|
@@ -557,24 +557,34 @@ const Ke = (t) => ({
|
|
|
557
557
|
] })
|
|
558
558
|
] })
|
|
559
559
|
] });
|
|
560
|
-
},
|
|
560
|
+
}, rs = ({
|
|
561
561
|
renderActions: t
|
|
562
|
-
}) => /* @__PURE__ */
|
|
562
|
+
}) => /* @__PURE__ */ c("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
563
563
|
t && (t == null ? void 0 : t()),
|
|
564
|
-
/* @__PURE__ */ e(
|
|
565
|
-
] }),
|
|
564
|
+
/* @__PURE__ */ e(_e, { Input: ns })
|
|
565
|
+
] }), ls = (t) => {
|
|
566
|
+
const s = t.message.hide_date === !0;
|
|
567
|
+
return /* @__PURE__ */ c("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
568
|
+
/* @__PURE__ */ c("div", { className: "str-chat__message--system__text", children: [
|
|
569
|
+
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
570
|
+
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
571
|
+
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
572
|
+
] }),
|
|
573
|
+
!s && /* @__PURE__ */ e(Ae, { message: t.message })
|
|
574
|
+
] });
|
|
575
|
+
}, be = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ c("div", { className: "text-center max-w-sm", children: [
|
|
566
576
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet ๐" }),
|
|
567
577
|
/* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
|
|
568
|
-
] }) }),
|
|
569
|
-
var m, x, k,
|
|
570
|
-
const { channel: o } =
|
|
578
|
+
] }) }), os = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
|
|
579
|
+
var m, x, k, h, f;
|
|
580
|
+
const { channel: o } = fe(), a = q.useMemo(() => Object.values(o.state.members || {}).find(
|
|
571
581
|
(g) => {
|
|
572
582
|
var C;
|
|
573
583
|
return ((C = g.user) == null ? void 0 : C.id) && g.user.id !== o._client.userID;
|
|
574
584
|
}
|
|
575
585
|
), [o._client.userID, o.state.members]), r = ((m = a == null ? void 0 : a.user) == null ? void 0 : m.name) || ((x = a == null ? void 0 : a.user) == null ? void 0 : x.id) || "Unknown member", i = (k = a == null ? void 0 : a.user) == null ? void 0 : k.image;
|
|
576
|
-
return /* @__PURE__ */
|
|
577
|
-
/* @__PURE__ */
|
|
586
|
+
return /* @__PURE__ */ c("div", { className: "@container", children: [
|
|
587
|
+
/* @__PURE__ */ c("div", { className: "flex justify-between items-center @md:hidden", children: [
|
|
578
588
|
/* @__PURE__ */ e(
|
|
579
589
|
"button",
|
|
580
590
|
{
|
|
@@ -587,11 +597,11 @@ const Ke = (t) => ({
|
|
|
587
597
|
children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
|
|
588
598
|
}
|
|
589
599
|
),
|
|
590
|
-
/* @__PURE__ */
|
|
600
|
+
/* @__PURE__ */ c("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
591
601
|
/* @__PURE__ */ e(
|
|
592
602
|
Y,
|
|
593
603
|
{
|
|
594
|
-
id: ((
|
|
604
|
+
id: ((h = a == null ? void 0 : a.user) == null ? void 0 : h.id) || o.id || "unknown",
|
|
595
605
|
name: r,
|
|
596
606
|
image: i,
|
|
597
607
|
size: 40
|
|
@@ -611,8 +621,8 @@ const Ke = (t) => ({
|
|
|
611
621
|
}
|
|
612
622
|
)
|
|
613
623
|
] }),
|
|
614
|
-
/* @__PURE__ */
|
|
615
|
-
/* @__PURE__ */
|
|
624
|
+
/* @__PURE__ */ c("div", { className: "hidden @md:flex items-center justify-between gap-3 min-h-12", children: [
|
|
625
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
616
626
|
s && t && /* @__PURE__ */ e(
|
|
617
627
|
"button",
|
|
618
628
|
{
|
|
@@ -626,7 +636,7 @@ const Ke = (t) => ({
|
|
|
626
636
|
/* @__PURE__ */ e(
|
|
627
637
|
Y,
|
|
628
638
|
{
|
|
629
|
-
id: ((
|
|
639
|
+
id: ((f = a == null ? void 0 : a.user) == null ? void 0 : f.id) || o.id || "unknown",
|
|
630
640
|
name: r,
|
|
631
641
|
image: i,
|
|
632
642
|
size: 40
|
|
@@ -646,7 +656,7 @@ const Ke = (t) => ({
|
|
|
646
656
|
)
|
|
647
657
|
] })
|
|
648
658
|
] });
|
|
649
|
-
},
|
|
659
|
+
}, as = ({
|
|
650
660
|
isOpen: t,
|
|
651
661
|
onClose: s,
|
|
652
662
|
participant: n,
|
|
@@ -655,23 +665,23 @@ const Ke = (t) => ({
|
|
|
655
665
|
onLeaveConversation: a,
|
|
656
666
|
onBlockParticipant: r
|
|
657
667
|
}) => {
|
|
658
|
-
var W, O, G, J,
|
|
659
|
-
const { service: i, debug: m } = se(), x = B(null), [k,
|
|
660
|
-
|
|
668
|
+
var W, O, G, J, $, V, Q;
|
|
669
|
+
const { service: i, debug: m } = se(), x = B(null), [k, h] = E(!1), [f, y] = E(!1), [g, C] = E(!1);
|
|
670
|
+
H(() => {
|
|
661
671
|
const F = x.current;
|
|
662
672
|
F && (t ? F.showModal() : F.close());
|
|
663
673
|
}, [t]);
|
|
664
|
-
const w =
|
|
674
|
+
const w = _(async () => {
|
|
665
675
|
var F;
|
|
666
676
|
if (!(!i || !((F = n == null ? void 0 : n.user) != null && F.id)))
|
|
667
677
|
try {
|
|
668
|
-
const
|
|
669
|
-
(
|
|
678
|
+
const P = (await i.getBlockedUsers()).some(
|
|
679
|
+
(L) => {
|
|
670
680
|
var X;
|
|
671
|
-
return
|
|
681
|
+
return L.blocked_user_id === ((X = n == null ? void 0 : n.user) == null ? void 0 : X.id);
|
|
672
682
|
}
|
|
673
683
|
);
|
|
674
|
-
|
|
684
|
+
h(P);
|
|
675
685
|
} catch (M) {
|
|
676
686
|
console.error(
|
|
677
687
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
@@ -679,42 +689,42 @@ const Ke = (t) => ({
|
|
|
679
689
|
);
|
|
680
690
|
}
|
|
681
691
|
}, [i, (W = n == null ? void 0 : n.user) == null ? void 0 : W.id]);
|
|
682
|
-
|
|
692
|
+
H(() => {
|
|
683
693
|
t && w();
|
|
684
694
|
}, [t, w]);
|
|
685
695
|
const v = async () => {
|
|
686
696
|
var F;
|
|
687
|
-
if (!
|
|
688
|
-
m && console.log("[ChannelInfoDialog] Leave conversation", l.cid),
|
|
697
|
+
if (!f) {
|
|
698
|
+
m && console.log("[ChannelInfoDialog] Leave conversation", l.cid), y(!0);
|
|
689
699
|
try {
|
|
690
700
|
const M = ((F = l._client) == null ? void 0 : F.userID) ?? null;
|
|
691
701
|
await l.hide(M, !1), a && await a(l), s();
|
|
692
702
|
} catch (M) {
|
|
693
703
|
console.error("[ChannelInfoDialog] Failed to leave conversation", M);
|
|
694
704
|
} finally {
|
|
695
|
-
|
|
705
|
+
y(!1);
|
|
696
706
|
}
|
|
697
707
|
}
|
|
698
|
-
},
|
|
699
|
-
var F, M,
|
|
708
|
+
}, I = async () => {
|
|
709
|
+
var F, M, P;
|
|
700
710
|
if (!(g || !i)) {
|
|
701
711
|
m && console.log("[ChannelInfoDialog] Block member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), C(!0);
|
|
702
712
|
try {
|
|
703
|
-
await i.blockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), r && await r((
|
|
704
|
-
} catch (
|
|
705
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
713
|
+
await i.blockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), r && await r((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
|
|
714
|
+
} catch (L) {
|
|
715
|
+
console.error("[ChannelInfoDialog] Failed to block member", L);
|
|
706
716
|
} finally {
|
|
707
717
|
C(!1);
|
|
708
718
|
}
|
|
709
719
|
}
|
|
710
720
|
}, S = async () => {
|
|
711
|
-
var F, M,
|
|
721
|
+
var F, M, P;
|
|
712
722
|
if (!(g || !i)) {
|
|
713
723
|
m && console.log("[ChannelInfoDialog] Unblock member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), C(!0);
|
|
714
724
|
try {
|
|
715
|
-
await i.unBlockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), r && await r((
|
|
716
|
-
} catch (
|
|
717
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
725
|
+
await i.unBlockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), r && await r((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
|
|
726
|
+
} catch (L) {
|
|
727
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", L);
|
|
718
728
|
} finally {
|
|
719
729
|
C(!1);
|
|
720
730
|
}
|
|
@@ -727,7 +737,7 @@ const Ke = (t) => ({
|
|
|
727
737
|
);
|
|
728
738
|
};
|
|
729
739
|
if (!n) return null;
|
|
730
|
-
const T = ((O = n.user) == null ? void 0 : O.name) || ((G = n.user) == null ? void 0 : G.id) || "Unknown member",
|
|
740
|
+
const T = ((O = n.user) == null ? void 0 : O.name) || ((G = n.user) == null ? void 0 : G.id) || "Unknown member", d = (J = n.user) == null ? void 0 : J.image, u = ($ = n.user) == null ? void 0 : $.email, N = (V = n.user) == null ? void 0 : V.username, j = u || (N ? `linktr.ee/${N}` : void 0), A = ((Q = n.user) == null ? void 0 : Q.id) || "unknown";
|
|
731
741
|
return (
|
|
732
742
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
733
743
|
/* @__PURE__ */ e(
|
|
@@ -739,29 +749,29 @@ const Ke = (t) => ({
|
|
|
739
749
|
onClick: (F) => {
|
|
740
750
|
F.target === x.current && s();
|
|
741
751
|
},
|
|
742
|
-
children: /* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
752
|
+
children: /* @__PURE__ */ c("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
|
|
753
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
744
754
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
745
755
|
/* @__PURE__ */ e(Ne, { onClick: s })
|
|
746
756
|
] }),
|
|
747
|
-
/* @__PURE__ */
|
|
757
|
+
/* @__PURE__ */ c("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
748
758
|
/* @__PURE__ */ e(
|
|
749
759
|
"div",
|
|
750
760
|
{
|
|
751
761
|
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
752
762
|
style: { backgroundColor: "#FBFAF9" },
|
|
753
|
-
children: /* @__PURE__ */
|
|
763
|
+
children: /* @__PURE__ */ c("div", { className: "flex items-center gap-3 w-full", children: [
|
|
754
764
|
/* @__PURE__ */ e(
|
|
755
765
|
Y,
|
|
756
766
|
{
|
|
757
767
|
id: A,
|
|
758
768
|
name: T,
|
|
759
|
-
image:
|
|
769
|
+
image: d,
|
|
760
770
|
size: 88,
|
|
761
771
|
shape: "circle"
|
|
762
772
|
}
|
|
763
773
|
),
|
|
764
|
-
/* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ c("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
765
775
|
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: T }),
|
|
766
776
|
j && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: j }),
|
|
767
777
|
o && /* @__PURE__ */ e(
|
|
@@ -782,20 +792,20 @@ const Ke = (t) => ({
|
|
|
782
792
|
] })
|
|
783
793
|
}
|
|
784
794
|
),
|
|
785
|
-
/* @__PURE__ */
|
|
786
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
795
|
+
/* @__PURE__ */ c("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
796
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
|
|
787
797
|
K,
|
|
788
798
|
{
|
|
789
799
|
onClick: v,
|
|
790
|
-
disabled:
|
|
791
|
-
"aria-busy":
|
|
800
|
+
disabled: f,
|
|
801
|
+
"aria-busy": f,
|
|
792
802
|
children: [
|
|
793
|
-
|
|
803
|
+
f ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ge, { className: "h-5 w-5" }),
|
|
794
804
|
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
795
805
|
]
|
|
796
806
|
}
|
|
797
807
|
) }),
|
|
798
|
-
/* @__PURE__ */ e("li", { children: k ? /* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ e("li", { children: k ? /* @__PURE__ */ c(
|
|
799
809
|
K,
|
|
800
810
|
{
|
|
801
811
|
onClick: S,
|
|
@@ -806,10 +816,10 @@ const Ke = (t) => ({
|
|
|
806
816
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
807
817
|
]
|
|
808
818
|
}
|
|
809
|
-
) : /* @__PURE__ */
|
|
819
|
+
) : /* @__PURE__ */ c(
|
|
810
820
|
K,
|
|
811
821
|
{
|
|
812
|
-
onClick:
|
|
822
|
+
onClick: I,
|
|
813
823
|
disabled: g,
|
|
814
824
|
"aria-busy": g,
|
|
815
825
|
children: [
|
|
@@ -818,8 +828,8 @@ const Ke = (t) => ({
|
|
|
818
828
|
]
|
|
819
829
|
}
|
|
820
830
|
) }),
|
|
821
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
822
|
-
/* @__PURE__ */ e(
|
|
831
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(K, { variant: "danger", onClick: p, children: [
|
|
832
|
+
/* @__PURE__ */ e(Ve, { className: "h-5 w-5" }),
|
|
823
833
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
824
834
|
] }) })
|
|
825
835
|
] })
|
|
@@ -828,7 +838,7 @@ const Ke = (t) => ({
|
|
|
828
838
|
}
|
|
829
839
|
)
|
|
830
840
|
);
|
|
831
|
-
},
|
|
841
|
+
}, is = ({
|
|
832
842
|
onBack: t,
|
|
833
843
|
showBackButton: s,
|
|
834
844
|
renderMessageInputActions: n,
|
|
@@ -836,23 +846,23 @@ const Ke = (t) => ({
|
|
|
836
846
|
onBlockParticipant: o,
|
|
837
847
|
CustomChannelEmptyState: a = be
|
|
838
848
|
}) => {
|
|
839
|
-
var
|
|
840
|
-
const { channel: r } =
|
|
849
|
+
var f, y;
|
|
850
|
+
const { channel: r } = fe(), [i, m] = E(!1), x = (((y = (f = r == null ? void 0 : r.state) == null ? void 0 : f.messages) == null ? void 0 : y.length) ?? 0) > 0, k = q.useMemo(() => Object.values(r.state.members || {}).find(
|
|
841
851
|
(C) => {
|
|
842
852
|
var w;
|
|
843
853
|
return ((w = C.user) == null ? void 0 : w.id) && C.user.id !== r._client.userID;
|
|
844
854
|
}
|
|
845
|
-
), [r._client.userID, r.state.members]),
|
|
855
|
+
), [r._client.userID, r.state.members]), h = q.useMemo(() => {
|
|
846
856
|
const g = r.data ?? {};
|
|
847
857
|
if (g.followerStatus)
|
|
848
858
|
return String(g.followerStatus);
|
|
849
859
|
if (g.isFollower !== void 0)
|
|
850
860
|
return g.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
851
861
|
}, [r.data]);
|
|
852
|
-
return /* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
862
|
+
return /* @__PURE__ */ c(he, { children: [
|
|
863
|
+
/* @__PURE__ */ c(Be, { children: [
|
|
854
864
|
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
855
|
-
|
|
865
|
+
os,
|
|
856
866
|
{
|
|
857
867
|
onBack: t,
|
|
858
868
|
showBackButton: s,
|
|
@@ -860,9 +870,9 @@ const Ke = (t) => ({
|
|
|
860
870
|
canShowInfo: !!k
|
|
861
871
|
}
|
|
862
872
|
) }),
|
|
863
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ c("div", { className: "flex-1 overflow-hidden relative", children: [
|
|
864
874
|
/* @__PURE__ */ e(
|
|
865
|
-
|
|
875
|
+
He,
|
|
866
876
|
{
|
|
867
877
|
hideDeletedMessages: !0,
|
|
868
878
|
hideNewMessageSeparator: !1,
|
|
@@ -872,26 +882,26 @@ const Ke = (t) => ({
|
|
|
872
882
|
!x && a && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(a, {}) })
|
|
873
883
|
] }),
|
|
874
884
|
/* @__PURE__ */ e(
|
|
875
|
-
|
|
885
|
+
rs,
|
|
876
886
|
{
|
|
877
887
|
renderActions: () => n == null ? void 0 : n(r)
|
|
878
888
|
}
|
|
879
889
|
)
|
|
880
890
|
] }),
|
|
881
891
|
/* @__PURE__ */ e(
|
|
882
|
-
|
|
892
|
+
as,
|
|
883
893
|
{
|
|
884
894
|
isOpen: i,
|
|
885
895
|
onClose: () => m(!1),
|
|
886
896
|
participant: k,
|
|
887
897
|
channel: r,
|
|
888
|
-
followerStatusLabel:
|
|
898
|
+
followerStatusLabel: h,
|
|
889
899
|
onLeaveConversation: l,
|
|
890
900
|
onBlockParticipant: o
|
|
891
901
|
}
|
|
892
902
|
)
|
|
893
903
|
] });
|
|
894
|
-
},
|
|
904
|
+
}, cs = ({
|
|
895
905
|
channel: t,
|
|
896
906
|
onBack: s,
|
|
897
907
|
showBackButton: n = !1,
|
|
@@ -907,8 +917,8 @@ const Ke = (t) => ({
|
|
|
907
917
|
"messaging-channel-view h-full flex flex-col bg-[#FBFAF9]",
|
|
908
918
|
r
|
|
909
919
|
),
|
|
910
|
-
children: /* @__PURE__ */ e(
|
|
911
|
-
|
|
920
|
+
children: /* @__PURE__ */ e(ze, { channel: t, MessageSystem: ls, children: /* @__PURE__ */ e(
|
|
921
|
+
is,
|
|
912
922
|
{
|
|
913
923
|
onBack: s,
|
|
914
924
|
showBackButton: n,
|
|
@@ -920,15 +930,15 @@ const Ke = (t) => ({
|
|
|
920
930
|
) })
|
|
921
931
|
}
|
|
922
932
|
);
|
|
923
|
-
function
|
|
933
|
+
function ds({
|
|
924
934
|
searchQuery: t,
|
|
925
935
|
setSearchQuery: s,
|
|
926
936
|
placeholder: n
|
|
927
937
|
}) {
|
|
928
938
|
const l = B(null);
|
|
929
|
-
return /* @__PURE__ */
|
|
939
|
+
return /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
930
940
|
/* @__PURE__ */ e(
|
|
931
|
-
|
|
941
|
+
We,
|
|
932
942
|
{
|
|
933
943
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
934
944
|
weight: "bold"
|
|
@@ -959,7 +969,7 @@ function is({
|
|
|
959
969
|
)
|
|
960
970
|
] });
|
|
961
971
|
}
|
|
962
|
-
const
|
|
972
|
+
const us = ({
|
|
963
973
|
participantSource: t,
|
|
964
974
|
onSelectParticipant: s,
|
|
965
975
|
onClose: n,
|
|
@@ -968,26 +978,26 @@ const cs = ({
|
|
|
968
978
|
searchPlaceholder: a = "Search participants...",
|
|
969
979
|
className: r
|
|
970
980
|
}) => {
|
|
971
|
-
const { debug: i } = se(), [m, x] = E(""), [k,
|
|
981
|
+
const { debug: i } = se(), [m, x] = E(""), [k, h] = E([]), [f, y] = E(!1), [g, C] = E(null), [w, v] = E(
|
|
972
982
|
null
|
|
973
|
-
),
|
|
974
|
-
|
|
983
|
+
), I = B(!1);
|
|
984
|
+
H(() => {
|
|
975
985
|
if (t.loading) {
|
|
976
986
|
i && console.log(
|
|
977
987
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
978
988
|
);
|
|
979
989
|
return;
|
|
980
990
|
}
|
|
981
|
-
if (
|
|
991
|
+
if (I.current) return;
|
|
982
992
|
(async () => {
|
|
983
|
-
i && console.log("[ParticipantPicker] Loading initial participants..."),
|
|
993
|
+
i && console.log("[ParticipantPicker] Loading initial participants..."), y(!0), C(null);
|
|
984
994
|
try {
|
|
985
995
|
const u = await t.loadParticipants({
|
|
986
996
|
search: "",
|
|
987
997
|
// Load all participants initially
|
|
988
998
|
limit: 100
|
|
989
999
|
});
|
|
990
|
-
|
|
1000
|
+
h(u.participants), I.current = !0, i && console.log(
|
|
991
1001
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
992
1002
|
u.participants.length
|
|
993
1003
|
);
|
|
@@ -995,37 +1005,37 @@ const cs = ({
|
|
|
995
1005
|
const N = u instanceof Error ? u.message : "Failed to load participants";
|
|
996
1006
|
C(N), console.error("[ParticipantPicker] Failed to load participants:", u);
|
|
997
1007
|
} finally {
|
|
998
|
-
|
|
1008
|
+
y(!1);
|
|
999
1009
|
}
|
|
1000
1010
|
})();
|
|
1001
1011
|
}, [t.loading, i]);
|
|
1002
|
-
const S = k.filter((
|
|
1012
|
+
const S = k.filter((d) => !l.has(d.id)).filter((d) => {
|
|
1003
1013
|
var N;
|
|
1004
1014
|
if (!m) return !0;
|
|
1005
1015
|
const u = m.toLowerCase();
|
|
1006
|
-
return
|
|
1007
|
-
}), p =
|
|
1008
|
-
async (
|
|
1016
|
+
return d.name.toLowerCase().includes(u) || ((N = d.email) == null ? void 0 : N.toLowerCase().includes(u)) || !1;
|
|
1017
|
+
}), p = _(
|
|
1018
|
+
async (d) => {
|
|
1009
1019
|
if (!w) {
|
|
1010
|
-
v(
|
|
1020
|
+
v(d.id);
|
|
1011
1021
|
try {
|
|
1012
|
-
await s(
|
|
1022
|
+
await s(d);
|
|
1013
1023
|
} catch (u) {
|
|
1014
1024
|
console.error("[ParticipantPicker] Failed to start chat:", u), v(null);
|
|
1015
1025
|
}
|
|
1016
1026
|
}
|
|
1017
1027
|
},
|
|
1018
1028
|
[s, w]
|
|
1019
|
-
), T = (
|
|
1020
|
-
(
|
|
1029
|
+
), T = (d, u) => {
|
|
1030
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), p(u));
|
|
1021
1031
|
};
|
|
1022
|
-
return /* @__PURE__ */
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
/* @__PURE__ */
|
|
1032
|
+
return /* @__PURE__ */ c("div", { className: R("flex flex-col h-full", r), children: [
|
|
1033
|
+
/* @__PURE__ */ c("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1034
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1025
1035
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1026
1036
|
/* @__PURE__ */ e(Ne, { onClick: n })
|
|
1027
1037
|
] }),
|
|
1028
|
-
/* @__PURE__ */
|
|
1038
|
+
/* @__PURE__ */ c("p", { className: "text-xs text-stone mb-3", children: [
|
|
1029
1039
|
"Select a ",
|
|
1030
1040
|
o.slice(0, -1),
|
|
1031
1041
|
" to start messaging (",
|
|
@@ -1034,7 +1044,7 @@ const cs = ({
|
|
|
1034
1044
|
t.totalCount !== void 0 && ` โข ${t.totalCount} ${o} total`
|
|
1035
1045
|
] }),
|
|
1036
1046
|
/* @__PURE__ */ e(
|
|
1037
|
-
|
|
1047
|
+
ds,
|
|
1038
1048
|
{
|
|
1039
1049
|
searchQuery: m,
|
|
1040
1050
|
setSearchQuery: x,
|
|
@@ -1042,65 +1052,65 @@ const cs = ({
|
|
|
1042
1052
|
}
|
|
1043
1053
|
)
|
|
1044
1054
|
] }),
|
|
1045
|
-
g && /* @__PURE__ */
|
|
1055
|
+
g && /* @__PURE__ */ c("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1046
1056
|
"Error loading ",
|
|
1047
1057
|
o,
|
|
1048
1058
|
": ",
|
|
1049
1059
|
g
|
|
1050
1060
|
] }),
|
|
1051
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
1061
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && S.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: [
|
|
1052
1062
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1053
|
-
/* @__PURE__ */
|
|
1063
|
+
/* @__PURE__ */ c("span", { className: "text-sm text-stone", children: [
|
|
1054
1064
|
"Loading ",
|
|
1055
1065
|
o,
|
|
1056
1066
|
"..."
|
|
1057
1067
|
] })
|
|
1058
|
-
] }) }) : S.length === 0 ? /* @__PURE__ */
|
|
1068
|
+
] }) }) : S.length === 0 ? /* @__PURE__ */ c("div", { className: "p-6 text-center", children: [
|
|
1059
1069
|
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(de, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1060
1070
|
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${o} found` : k.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
|
|
1061
1071
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : k.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
|
|
1062
|
-
] }) : /* @__PURE__ */
|
|
1063
|
-
S.map((
|
|
1064
|
-
const u =
|
|
1072
|
+
] }) : /* @__PURE__ */ c("ul", { className: "space-y-0", children: [
|
|
1073
|
+
S.map((d) => {
|
|
1074
|
+
const u = d.name || d.email || d.id, N = d.email && d.name ? d.email : d.phone;
|
|
1065
1075
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1066
1076
|
"button",
|
|
1067
1077
|
{
|
|
1068
1078
|
type: "button",
|
|
1069
|
-
onClick: () => p(
|
|
1070
|
-
onKeyDown: (j) => T(j,
|
|
1079
|
+
onClick: () => p(d),
|
|
1080
|
+
onKeyDown: (j) => T(j, d),
|
|
1071
1081
|
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",
|
|
1072
|
-
children: /* @__PURE__ */
|
|
1073
|
-
/* @__PURE__ */
|
|
1082
|
+
children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
|
|
1083
|
+
/* @__PURE__ */ c("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1074
1084
|
/* @__PURE__ */ e(
|
|
1075
1085
|
Y,
|
|
1076
1086
|
{
|
|
1077
|
-
id:
|
|
1087
|
+
id: d.id,
|
|
1078
1088
|
name: u,
|
|
1079
|
-
image:
|
|
1089
|
+
image: d.image,
|
|
1080
1090
|
size: 40
|
|
1081
1091
|
}
|
|
1082
1092
|
),
|
|
1083
|
-
/* @__PURE__ */
|
|
1093
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
1084
1094
|
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
|
|
1085
1095
|
N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
|
|
1086
1096
|
] })
|
|
1087
1097
|
] }),
|
|
1088
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: w ===
|
|
1098
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: w === d.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5 text-stone" }) })
|
|
1089
1099
|
] })
|
|
1090
1100
|
}
|
|
1091
|
-
) },
|
|
1101
|
+
) }, d.id);
|
|
1092
1102
|
}),
|
|
1093
|
-
|
|
1103
|
+
f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
|
|
1094
1104
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1095
1105
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1096
1106
|
] }) })
|
|
1097
1107
|
] }) })
|
|
1098
1108
|
] });
|
|
1099
|
-
},
|
|
1109
|
+
}, ms = ({ hasChannels: t }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ c("div", { className: "text-center max-w-sm", children: [
|
|
1100
1110
|
/* @__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: "๐ฌ" }) }),
|
|
1101
1111
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
|
|
1102
1112
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? "Choose a conversation from the list." : "No conversations yet." })
|
|
1103
|
-
] }) }), re = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */
|
|
1113
|
+
] }) }), re = ({ 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: [
|
|
1104
1114
|
/* @__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: "โ ๏ธ" }) }),
|
|
1105
1115
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
1106
1116
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -1113,12 +1123,12 @@ const cs = ({
|
|
|
1113
1123
|
children: "Go Back"
|
|
1114
1124
|
}
|
|
1115
1125
|
)
|
|
1116
|
-
] }) }),
|
|
1126
|
+
] }) }), hs = ({ className: t, message: s }) => /* @__PURE__ */ c(
|
|
1117
1127
|
"div",
|
|
1118
1128
|
{
|
|
1119
1129
|
className: R("flex items-center justify-center h-full", t),
|
|
1120
1130
|
children: [
|
|
1121
|
-
/* @__PURE__ */
|
|
1131
|
+
/* @__PURE__ */ c("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1122
1132
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1123
1133
|
"animateTransform",
|
|
1124
1134
|
{
|
|
@@ -1156,10 +1166,10 @@ const cs = ({
|
|
|
1156
1166
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1157
1167
|
]
|
|
1158
1168
|
}
|
|
1159
|
-
),
|
|
1160
|
-
/* @__PURE__ */ e(
|
|
1169
|
+
), fs = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ c("div", { className: "flex items-center", children: [
|
|
1170
|
+
/* @__PURE__ */ e(hs, { className: "w-6 h-6" }),
|
|
1161
1171
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1162
|
-
] }) }),
|
|
1172
|
+
] }) }), Is = ({
|
|
1163
1173
|
capabilities: t = {},
|
|
1164
1174
|
className: s,
|
|
1165
1175
|
renderMessageInputActions: n,
|
|
@@ -1173,15 +1183,15 @@ const cs = ({
|
|
|
1173
1183
|
channelListCustomEmptyStateIndicator: k
|
|
1174
1184
|
}) => {
|
|
1175
1185
|
const {
|
|
1176
|
-
service:
|
|
1177
|
-
client:
|
|
1178
|
-
isConnected:
|
|
1186
|
+
service: h,
|
|
1187
|
+
client: f,
|
|
1188
|
+
isConnected: y,
|
|
1179
1189
|
isLoading: g,
|
|
1180
1190
|
error: C,
|
|
1181
1191
|
refreshConnection: w,
|
|
1182
1192
|
debug: v
|
|
1183
|
-
} =
|
|
1184
|
-
const b =
|
|
1193
|
+
} = qe(), [I, S] = E(null), [p, T] = E(!1), [d, u] = E(!1), [N, j] = E(/* @__PURE__ */ new Set()), [A, W] = E(0), [O, G] = E(!1), [J, $] = E(null), V = B(null), { participantSource: Q, participantLabel: F = "participants" } = t, M = q.useMemo(() => {
|
|
1194
|
+
const b = f == null ? void 0 : f.userID;
|
|
1185
1195
|
return {
|
|
1186
1196
|
...{
|
|
1187
1197
|
type: "messaging",
|
|
@@ -1193,13 +1203,13 @@ const cs = ({
|
|
|
1193
1203
|
},
|
|
1194
1204
|
...x
|
|
1195
1205
|
};
|
|
1196
|
-
}, [x,
|
|
1197
|
-
if (!
|
|
1198
|
-
const b =
|
|
1206
|
+
}, [x, f == null ? void 0 : f.userID]), P = B(null), L = _(async () => {
|
|
1207
|
+
if (!f || !y) return;
|
|
1208
|
+
const b = f.userID;
|
|
1199
1209
|
if (b)
|
|
1200
1210
|
try {
|
|
1201
1211
|
v && console.log("[MessagingShell] Syncing channels for user:", b);
|
|
1202
|
-
const
|
|
1212
|
+
const U = await f.queryChannels(
|
|
1203
1213
|
{
|
|
1204
1214
|
type: "messaging",
|
|
1205
1215
|
members: { $in: [b] }
|
|
@@ -1207,61 +1217,61 @@ const cs = ({
|
|
|
1207
1217
|
{},
|
|
1208
1218
|
{ limit: 100 }
|
|
1209
1219
|
), D = /* @__PURE__ */ new Set();
|
|
1210
|
-
|
|
1211
|
-
const
|
|
1212
|
-
Object.values(
|
|
1220
|
+
U.forEach((z) => {
|
|
1221
|
+
const ye = z.state.members;
|
|
1222
|
+
Object.values(ye).forEach((Ie) => {
|
|
1213
1223
|
var oe;
|
|
1214
|
-
const
|
|
1215
|
-
|
|
1224
|
+
const ne = (oe = Ie.user) == null ? void 0 : oe.id;
|
|
1225
|
+
ne && ne !== b && D.add(ne);
|
|
1216
1226
|
});
|
|
1217
|
-
}), j(D), T(
|
|
1218
|
-
channelCount:
|
|
1227
|
+
}), j(D), T(U.length > 0), P.current = b, v && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1228
|
+
channelCount: U.length,
|
|
1219
1229
|
memberCount: D.size
|
|
1220
1230
|
});
|
|
1221
|
-
} catch (
|
|
1222
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1231
|
+
} catch (U) {
|
|
1232
|
+
console.error("[MessagingShell] Failed to sync channels:", U);
|
|
1223
1233
|
}
|
|
1224
|
-
}, [
|
|
1225
|
-
|
|
1226
|
-
if (!
|
|
1227
|
-
const b =
|
|
1228
|
-
b &&
|
|
1229
|
-
}, [
|
|
1230
|
-
if (!a || !
|
|
1234
|
+
}, [f, y, v]);
|
|
1235
|
+
H(() => {
|
|
1236
|
+
if (!f || !y) return;
|
|
1237
|
+
const b = f.userID;
|
|
1238
|
+
b && P.current !== b && L();
|
|
1239
|
+
}, [f, y, L]), H(() => {
|
|
1240
|
+
if (!a || !f || !y) return;
|
|
1231
1241
|
(async () => {
|
|
1232
|
-
const
|
|
1233
|
-
if (
|
|
1242
|
+
const U = f.userID;
|
|
1243
|
+
if (U)
|
|
1234
1244
|
try {
|
|
1235
1245
|
v && console.log(
|
|
1236
1246
|
"[MessagingShell] Loading initial conversation with:",
|
|
1237
1247
|
a
|
|
1238
1248
|
);
|
|
1239
|
-
const D = await
|
|
1249
|
+
const D = await f.queryChannels(
|
|
1240
1250
|
{
|
|
1241
1251
|
type: "messaging",
|
|
1242
|
-
members: { $eq: [
|
|
1252
|
+
members: { $eq: [U, a] }
|
|
1243
1253
|
},
|
|
1244
1254
|
{},
|
|
1245
1255
|
{ limit: 1 }
|
|
1246
1256
|
);
|
|
1247
1257
|
if (D.length > 0)
|
|
1248
|
-
S(D[0]), G(!0),
|
|
1258
|
+
S(D[0]), G(!0), $(null), l && l(D[0]), v && console.log(
|
|
1249
1259
|
"[MessagingShell] Initial conversation loaded:",
|
|
1250
1260
|
D[0].id
|
|
1251
1261
|
);
|
|
1252
|
-
else if (r &&
|
|
1262
|
+
else if (r && h) {
|
|
1253
1263
|
v && console.log(
|
|
1254
1264
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1255
1265
|
r
|
|
1256
1266
|
);
|
|
1257
1267
|
try {
|
|
1258
|
-
const z = await
|
|
1268
|
+
const z = await h.startChannelWithParticipant({
|
|
1259
1269
|
id: r.id,
|
|
1260
1270
|
name: r.name,
|
|
1261
1271
|
email: r.email,
|
|
1262
1272
|
phone: r.phone
|
|
1263
1273
|
});
|
|
1264
|
-
S(z), G(!0),
|
|
1274
|
+
S(z), G(!0), $(null), l && l(z), v && console.log(
|
|
1265
1275
|
"[MessagingShell] Channel created and loaded:",
|
|
1266
1276
|
z.id
|
|
1267
1277
|
);
|
|
@@ -1269,10 +1279,10 @@ const cs = ({
|
|
|
1269
1279
|
console.error(
|
|
1270
1280
|
"[MessagingShell] Failed to create conversation:",
|
|
1271
1281
|
z
|
|
1272
|
-
),
|
|
1282
|
+
), $("Failed to create conversation");
|
|
1273
1283
|
}
|
|
1274
1284
|
} else
|
|
1275
|
-
|
|
1285
|
+
$(
|
|
1276
1286
|
"No conversation found with this account"
|
|
1277
1287
|
), v && console.log(
|
|
1278
1288
|
"[MessagingShell] No conversation found for:",
|
|
@@ -1282,35 +1292,35 @@ const cs = ({
|
|
|
1282
1292
|
console.error(
|
|
1283
1293
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1284
1294
|
D
|
|
1285
|
-
),
|
|
1295
|
+
), $("Failed to load conversation");
|
|
1286
1296
|
}
|
|
1287
1297
|
})();
|
|
1288
1298
|
}, [
|
|
1289
1299
|
a,
|
|
1290
1300
|
r,
|
|
1291
|
-
h,
|
|
1292
|
-
I,
|
|
1293
1301
|
f,
|
|
1302
|
+
y,
|
|
1303
|
+
h,
|
|
1294
1304
|
v,
|
|
1295
1305
|
l
|
|
1296
1306
|
]);
|
|
1297
|
-
const X =
|
|
1307
|
+
const X = _(
|
|
1298
1308
|
(b) => {
|
|
1299
1309
|
S(b), l == null || l(b);
|
|
1300
1310
|
},
|
|
1301
1311
|
[l]
|
|
1302
|
-
), ve =
|
|
1312
|
+
), ve = _(() => {
|
|
1303
1313
|
O || S(null);
|
|
1304
|
-
}, [O]), Ce =
|
|
1314
|
+
}, [O]), Ce = _(
|
|
1305
1315
|
async (b) => {
|
|
1306
|
-
var
|
|
1307
|
-
if (
|
|
1316
|
+
var U;
|
|
1317
|
+
if (h)
|
|
1308
1318
|
try {
|
|
1309
1319
|
v && console.log(
|
|
1310
1320
|
"[MessagingShell] Starting conversation with:",
|
|
1311
1321
|
b.id
|
|
1312
1322
|
);
|
|
1313
|
-
const D = await
|
|
1323
|
+
const D = await h.startChannelWithParticipant({
|
|
1314
1324
|
id: b.id,
|
|
1315
1325
|
name: b.name,
|
|
1316
1326
|
email: b.email,
|
|
@@ -1321,33 +1331,33 @@ const cs = ({
|
|
|
1321
1331
|
} catch (z) {
|
|
1322
1332
|
console.warn("[MessagingShell] Failed to unhide channel:", z);
|
|
1323
1333
|
}
|
|
1324
|
-
S(D), u(!1), (
|
|
1334
|
+
S(D), u(!1), (U = V.current) == null || U.close(), o == null || o(b);
|
|
1325
1335
|
} catch (D) {
|
|
1326
1336
|
console.error("[MessagingShell] Failed to start conversation:", D);
|
|
1327
1337
|
}
|
|
1328
1338
|
},
|
|
1329
|
-
[
|
|
1330
|
-
),
|
|
1339
|
+
[h, o, v]
|
|
1340
|
+
), te = _(() => {
|
|
1331
1341
|
var b;
|
|
1332
1342
|
u(!1), (b = V.current) == null || b.close();
|
|
1333
|
-
}, []), we =
|
|
1343
|
+
}, []), we = _(
|
|
1334
1344
|
async (b) => {
|
|
1335
|
-
v && console.log("[MessagingShell] Leaving conversation:", b.id), S(null), G(!1),
|
|
1345
|
+
v && console.log("[MessagingShell] Leaving conversation:", b.id), S(null), G(!1), P.current = null, await L();
|
|
1336
1346
|
},
|
|
1337
|
-
[
|
|
1338
|
-
), Ee =
|
|
1347
|
+
[L, v]
|
|
1348
|
+
), Ee = _(
|
|
1339
1349
|
async (b) => {
|
|
1340
|
-
v && console.log("[MessagingShell] Blocking participant:", b), S(null), G(!1),
|
|
1350
|
+
v && console.log("[MessagingShell] Blocking participant:", b), S(null), G(!1), P.current = null, await L();
|
|
1341
1351
|
},
|
|
1342
|
-
[
|
|
1343
|
-
), Z = !!
|
|
1344
|
-
return g ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
|
|
1352
|
+
[L, v]
|
|
1353
|
+
), Z = !!I;
|
|
1354
|
+
return g ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(fs, {}) }) : C ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: C, onBack: w }) }) : !y || !f ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
|
|
1345
1355
|
re,
|
|
1346
1356
|
{
|
|
1347
1357
|
message: "Not connected to messaging service",
|
|
1348
1358
|
onBack: w
|
|
1349
1359
|
}
|
|
1350
|
-
) }) : J ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: J }) }) : /* @__PURE__ */
|
|
1360
|
+
) }) : J ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: J }) }) : /* @__PURE__ */ c(
|
|
1351
1361
|
"div",
|
|
1352
1362
|
{
|
|
1353
1363
|
className: R(
|
|
@@ -1355,7 +1365,7 @@ const cs = ({
|
|
|
1355
1365
|
s
|
|
1356
1366
|
),
|
|
1357
1367
|
children: [
|
|
1358
|
-
/* @__PURE__ */
|
|
1368
|
+
/* @__PURE__ */ c("div", { className: "flex h-full min-h-0", children: [
|
|
1359
1369
|
/* @__PURE__ */ e(
|
|
1360
1370
|
"div",
|
|
1361
1371
|
{
|
|
@@ -1371,10 +1381,10 @@ const cs = ({
|
|
|
1371
1381
|
}
|
|
1372
1382
|
),
|
|
1373
1383
|
children: /* @__PURE__ */ e(
|
|
1374
|
-
|
|
1384
|
+
Ke,
|
|
1375
1385
|
{
|
|
1376
1386
|
onChannelSelect: X,
|
|
1377
|
-
selectedChannel:
|
|
1387
|
+
selectedChannel: I || void 0,
|
|
1378
1388
|
filters: M,
|
|
1379
1389
|
customEmptyStateIndicator: k
|
|
1380
1390
|
}
|
|
@@ -1393,10 +1403,10 @@ const cs = ({
|
|
|
1393
1403
|
"hidden lg:flex": !O && !Z
|
|
1394
1404
|
}
|
|
1395
1405
|
),
|
|
1396
|
-
children:
|
|
1397
|
-
|
|
1406
|
+
children: I ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1407
|
+
cs,
|
|
1398
1408
|
{
|
|
1399
|
-
channel:
|
|
1409
|
+
channel: I,
|
|
1400
1410
|
onBack: ve,
|
|
1401
1411
|
showBackButton: !O,
|
|
1402
1412
|
renderMessageInputActions: n,
|
|
@@ -1404,8 +1414,8 @@ const cs = ({
|
|
|
1404
1414
|
onBlockParticipant: Ee,
|
|
1405
1415
|
CustomChannelEmptyState: i
|
|
1406
1416
|
},
|
|
1407
|
-
|
|
1408
|
-
) }) : /* @__PURE__ */ e(
|
|
1417
|
+
I.id
|
|
1418
|
+
) }) : /* @__PURE__ */ e(ms, { hasChannels: p })
|
|
1409
1419
|
}
|
|
1410
1420
|
)
|
|
1411
1421
|
] }),
|
|
@@ -1416,15 +1426,15 @@ const cs = ({
|
|
|
1416
1426
|
ref: V,
|
|
1417
1427
|
className: "mes-dialog",
|
|
1418
1428
|
onClick: (b) => {
|
|
1419
|
-
b.target === V.current &&
|
|
1429
|
+
b.target === V.current && te();
|
|
1420
1430
|
},
|
|
1421
|
-
onClose:
|
|
1431
|
+
onClose: te,
|
|
1422
1432
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1423
|
-
|
|
1433
|
+
us,
|
|
1424
1434
|
{
|
|
1425
1435
|
participantSource: Q,
|
|
1426
1436
|
onSelectParticipant: Ce,
|
|
1427
|
-
onClose:
|
|
1437
|
+
onClose: te,
|
|
1428
1438
|
existingParticipantIds: N,
|
|
1429
1439
|
participantLabel: F,
|
|
1430
1440
|
searchPlaceholder: `Search ${F}...`
|
|
@@ -1436,7 +1446,7 @@ const cs = ({
|
|
|
1436
1446
|
]
|
|
1437
1447
|
}
|
|
1438
1448
|
);
|
|
1439
|
-
},
|
|
1449
|
+
}, gs = ({
|
|
1440
1450
|
question: t,
|
|
1441
1451
|
onClick: s,
|
|
1442
1452
|
loading: n = !1,
|
|
@@ -1458,7 +1468,7 @@ const cs = ({
|
|
|
1458
1468
|
),
|
|
1459
1469
|
children: t
|
|
1460
1470
|
}
|
|
1461
|
-
),
|
|
1471
|
+
), Ss = ({
|
|
1462
1472
|
faqs: t,
|
|
1463
1473
|
onFaqClick: s,
|
|
1464
1474
|
loadingFaqId: n,
|
|
@@ -1468,7 +1478,7 @@ const cs = ({
|
|
|
1468
1478
|
avatarName: r
|
|
1469
1479
|
}) => {
|
|
1470
1480
|
const i = t.filter((m) => m.enabled).sort((m, x) => (m.order ?? 0) - (x.order ?? 0));
|
|
1471
|
-
return i.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6", o), children: /* @__PURE__ */
|
|
1481
|
+
return i.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6", o), children: /* @__PURE__ */ c("div", { className: "flex gap-3 items-end", children: [
|
|
1472
1482
|
(a || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1473
1483
|
Y,
|
|
1474
1484
|
{
|
|
@@ -1479,7 +1489,7 @@ const cs = ({
|
|
|
1479
1489
|
shape: "circle"
|
|
1480
1490
|
}
|
|
1481
1491
|
) }),
|
|
1482
|
-
/* @__PURE__ */
|
|
1492
|
+
/* @__PURE__ */ c(
|
|
1483
1493
|
"div",
|
|
1484
1494
|
{
|
|
1485
1495
|
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
@@ -1487,7 +1497,7 @@ const cs = ({
|
|
|
1487
1497
|
children: [
|
|
1488
1498
|
l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
|
|
1489
1499
|
i.map((m) => /* @__PURE__ */ e(
|
|
1490
|
-
|
|
1500
|
+
gs,
|
|
1491
1501
|
{
|
|
1492
1502
|
question: m.question,
|
|
1493
1503
|
onClick: () => s(m.id),
|
|
@@ -1499,59 +1509,59 @@ const cs = ({
|
|
|
1499
1509
|
}
|
|
1500
1510
|
)
|
|
1501
1511
|
] }) });
|
|
1502
|
-
},
|
|
1503
|
-
const { initialSearch: n = "", pageSize: l = 20 } = s, [o, a] = E([]), [r, i] = E(!1), [m, x] = E(null), [k,
|
|
1512
|
+
}, ks = (t, s = {}) => {
|
|
1513
|
+
const { initialSearch: n = "", pageSize: l = 20 } = s, [o, a] = E([]), [r, i] = E(!1), [m, x] = E(null), [k, h] = E(n), [f, y] = E(!0), [g, C] = E(), w = _(async (p = !1, T) => {
|
|
1504
1514
|
if (r) return;
|
|
1505
|
-
const
|
|
1515
|
+
const d = T !== void 0 ? T : k;
|
|
1506
1516
|
i(!0), x(null);
|
|
1507
1517
|
try {
|
|
1508
1518
|
const u = await t.loadParticipants({
|
|
1509
|
-
search:
|
|
1519
|
+
search: d || void 0,
|
|
1510
1520
|
limit: l,
|
|
1511
1521
|
cursor: p ? void 0 : g
|
|
1512
1522
|
});
|
|
1513
1523
|
a(
|
|
1514
1524
|
(N) => p ? u.participants : [...N, ...u.participants]
|
|
1515
|
-
),
|
|
1525
|
+
), y(u.hasMore), C(u.nextCursor);
|
|
1516
1526
|
} catch (u) {
|
|
1517
1527
|
const N = u instanceof Error ? u.message : "Failed to load participants";
|
|
1518
1528
|
x(N), console.error("[useParticipants] Load error:", u);
|
|
1519
1529
|
} finally {
|
|
1520
1530
|
i(!1);
|
|
1521
1531
|
}
|
|
1522
|
-
}, [t, k, g, l, r]), v =
|
|
1523
|
-
|
|
1524
|
-
}, [
|
|
1525
|
-
|
|
1526
|
-
}, [w]), S =
|
|
1532
|
+
}, [t, k, g, l, r]), v = _(() => {
|
|
1533
|
+
f && !r && w(!1);
|
|
1534
|
+
}, [f, r, w]), I = _((p) => {
|
|
1535
|
+
h(p), C(void 0), w(!0, p);
|
|
1536
|
+
}, [w]), S = _(() => {
|
|
1527
1537
|
C(void 0), w(!0);
|
|
1528
1538
|
}, [w]);
|
|
1529
|
-
return
|
|
1539
|
+
return H(() => {
|
|
1530
1540
|
w(!0);
|
|
1531
1541
|
}, [t.loadParticipants]), {
|
|
1532
1542
|
participants: o,
|
|
1533
1543
|
loading: r,
|
|
1534
1544
|
error: m,
|
|
1535
1545
|
searchQuery: k,
|
|
1536
|
-
hasMore:
|
|
1546
|
+
hasMore: f,
|
|
1537
1547
|
totalCount: t.totalCount,
|
|
1538
1548
|
loadMore: v,
|
|
1539
|
-
search:
|
|
1549
|
+
search: I,
|
|
1540
1550
|
refresh: S
|
|
1541
1551
|
};
|
|
1542
1552
|
};
|
|
1543
1553
|
export {
|
|
1544
1554
|
Y as Avatar,
|
|
1545
1555
|
be as ChannelEmptyState,
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
+
Ke as ChannelList,
|
|
1557
|
+
cs as ChannelView,
|
|
1558
|
+
Ss as FaqList,
|
|
1559
|
+
gs as FaqListItem,
|
|
1560
|
+
ys as MessagingProvider,
|
|
1561
|
+
Is as MessagingShell,
|
|
1562
|
+
us as ParticipantPicker,
|
|
1563
|
+
Je as formatRelativeTime,
|
|
1564
|
+
qe as useMessaging,
|
|
1565
|
+
ks as useParticipants
|
|
1556
1566
|
};
|
|
1557
1567
|
//# sourceMappingURL=index.js.map
|