@linktr.ee/messaging-react 1.24.1 → 1.24.2-rc-1773179473
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.js +186 -177
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/index.tsx +1 -0
- package/src/components/MessagingShell/channelFilters.test.ts +67 -0
- package/src/components/MessagingShell/channelFilters.ts +24 -0
- package/src/components/MessagingShell/index.tsx +5 -21
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as c, Fragment as de } from "react/jsx-runtime";
|
|
2
2
|
import R from "classnames";
|
|
3
|
-
import A, { createContext as at, useContext as rt, useCallback as L, useState as
|
|
3
|
+
import A, { createContext as at, useContext as rt, useCallback as L, useState as I, useRef as Z, useEffect as J, useMemo as _e } from "react";
|
|
4
4
|
import { StreamChatService as ot } from "@linktr.ee/messaging-core";
|
|
5
|
-
import { Chat as lt, ChannelList as it, DateSeparator as ct, useChannelStateContext as Se, useChatContext as $e, areMessageUIPropsEqual as dt, useMessageReminder as ut, useComponentContext as mt, Attachment as ht, EditMessageModal as ft, MessageBlocked as gt, MessageBouncePrompt as xt, MessageDeleted as bt, MessageIsThreadReplyInChannelButtonIndicator as Ct, MessageRepliesCountButton as Nt, ReminderNotification as vt, StreamedMessageText as wt, messageHasAttachments as pt, messageHasReactions as yt, isDateSeparatorMessage as
|
|
6
|
-
import { GiftIcon as Ht, XIcon as Me, ArrowUpIcon as zt, SparkleIcon as Wt, ArrowLeftIcon as Re, StarIcon as Le, DotsThreeIcon as
|
|
5
|
+
import { Chat as lt, ChannelList as it, DateSeparator as ct, useChannelStateContext as Se, useChatContext as $e, areMessageUIPropsEqual as dt, useMessageReminder as ut, useComponentContext as mt, Attachment as ht, EditMessageModal as ft, MessageBlocked as gt, MessageBouncePrompt as xt, MessageDeleted as bt, MessageIsThreadReplyInChannelButtonIndicator as Ct, MessageRepliesCountButton as Nt, ReminderNotification as vt, StreamedMessageText as wt, messageHasAttachments as pt, messageHasReactions as yt, isDateSeparatorMessage as _t, isMessageBlocked as Et, isMessageBounced as It, MessageBounceModal as St, Poll as Mt, MessageText as kt, MessageErrorIcon as Dt, useMessageContext as je, useMessageComposer as Tt, useStateStore as Rt, MessageInput as Lt, useMessageInputContext as Ft, useMessageComposerHasSendableData as Pt, SimpleAttachmentSelector as Ut, QuotedMessagePreview as Ot, AttachmentPreviewList as At, TextareaComposer as Bt, MessageTimestamp as Te, Channel as $t, WithComponents as jt, Window as Gt, MessageList as Vt } from "stream-chat-react";
|
|
6
|
+
import { GiftIcon as Ht, XIcon as Me, ArrowUpIcon as zt, SparkleIcon as Wt, ArrowLeftIcon as Re, StarIcon as Le, DotsThreeIcon as Fe, SpinnerGapIcon as be, SignOutIcon as qt, ProhibitInsetIcon as Pe, FlagIcon as Yt, MagnifyingGlassIcon as Zt, ChatCircleDotsIcon as Ue } from "@phosphor-icons/react";
|
|
7
7
|
import { LinkPreviewsManager as Oe } from "stream-chat";
|
|
8
8
|
const Ge = at({
|
|
9
9
|
service: null,
|
|
@@ -15,7 +15,7 @@ const Ge = at({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}), ve = () => rt(Ge),
|
|
18
|
+
}), ve = () => rt(Ge), Vs = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
@@ -35,7 +35,7 @@ const Ge = at({
|
|
|
35
35
|
serviceConfig: !!n,
|
|
36
36
|
capabilities: Object.keys(l)
|
|
37
37
|
});
|
|
38
|
-
const [u, f] =
|
|
38
|
+
const [u, f] = I(null), [g, v] = I(null), [b, y] = I(!1), [o, w] = I(!1), [E, p] = I(null), M = Z(!1), C = Z({
|
|
39
39
|
userId: s == null ? void 0 : s.id,
|
|
40
40
|
apiKey: a,
|
|
41
41
|
serviceConfig: n,
|
|
@@ -96,7 +96,7 @@ const Ge = at({
|
|
|
96
96
|
}, [a, n, d, r]);
|
|
97
97
|
const x = Z(null);
|
|
98
98
|
J(() => {
|
|
99
|
-
var i,
|
|
99
|
+
var i, _;
|
|
100
100
|
if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
101
101
|
hasService: !!u,
|
|
102
102
|
hasUser: !!s,
|
|
@@ -112,7 +112,7 @@ const Ge = at({
|
|
|
112
112
|
r("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
if (((i = x.current) == null ? void 0 : i.serviceId) === u && ((
|
|
115
|
+
if (((i = x.current) == null ? void 0 : i.serviceId) === u && ((_ = x.current) == null ? void 0 : _.userId) === s.id) {
|
|
116
116
|
r(
|
|
117
117
|
"⚠️ USER CONNECTION SKIPPED",
|
|
118
118
|
"Already connected this user with this service"
|
|
@@ -180,14 +180,14 @@ const Ge = at({
|
|
|
180
180
|
hasClient: !!g,
|
|
181
181
|
isConnected: b,
|
|
182
182
|
isLoading: o,
|
|
183
|
-
hasError: !!
|
|
183
|
+
hasError: !!E,
|
|
184
184
|
capabilitiesKeys: Object.keys(l)
|
|
185
185
|
}), {
|
|
186
186
|
service: u,
|
|
187
187
|
client: g,
|
|
188
188
|
isConnected: b,
|
|
189
189
|
isLoading: o,
|
|
190
|
-
error:
|
|
190
|
+
error: E,
|
|
191
191
|
capabilities: l,
|
|
192
192
|
refreshConnection: k,
|
|
193
193
|
debug: d
|
|
@@ -196,7 +196,7 @@ const Ge = at({
|
|
|
196
196
|
g,
|
|
197
197
|
b,
|
|
198
198
|
o,
|
|
199
|
-
|
|
199
|
+
E,
|
|
200
200
|
l,
|
|
201
201
|
k,
|
|
202
202
|
d,
|
|
@@ -389,26 +389,26 @@ const ee = ({
|
|
|
389
389
|
const { selectedChannel: n, onChannelSelect: a, debug: l, renderMessagePreview: d } = Xt(), r = (n == null ? void 0 : n.id) === (t == null ? void 0 : t.id), u = () => {
|
|
390
390
|
t && a(t);
|
|
391
391
|
}, f = (i) => {
|
|
392
|
-
const
|
|
393
|
-
!
|
|
392
|
+
const _ = i.key === "Enter" || i.key === " ", D = i.repeat;
|
|
393
|
+
!_ || D || (i.preventDefault(), u());
|
|
394
394
|
}, v = Object.values(((x = t == null ? void 0 : t.state) == null ? void 0 : x.members) || {}).find(
|
|
395
395
|
(i) => {
|
|
396
|
-
var
|
|
397
|
-
return ((
|
|
396
|
+
var _, D;
|
|
397
|
+
return ((_ = i.user) == null ? void 0 : _.id) && i.user.id !== ((D = t == null ? void 0 : t._client) == null ? void 0 : D.userID);
|
|
398
398
|
}
|
|
399
399
|
), b = ((k = v == null ? void 0 : v.user) == null ? void 0 : k.name) || "Conversation", y = (h = v == null ? void 0 : v.user) == null ? void 0 : h.image, o = (() => {
|
|
400
|
-
var
|
|
401
|
-
const i = (
|
|
400
|
+
var _;
|
|
401
|
+
const i = (_ = t == null ? void 0 : t.state) == null ? void 0 : _.messages;
|
|
402
402
|
if (i != null && i.length) {
|
|
403
403
|
for (let D = i.length - 1; D >= 0; D--)
|
|
404
404
|
if (i[D].type !== "system") return i[D];
|
|
405
405
|
}
|
|
406
|
-
})(),
|
|
407
|
-
var
|
|
406
|
+
})(), E = (() => {
|
|
407
|
+
var _;
|
|
408
408
|
if (o != null && o.text) return o.text;
|
|
409
|
-
const i = (
|
|
409
|
+
const i = (_ = o == null ? void 0 : o.attachments) == null ? void 0 : _[0];
|
|
410
410
|
return i ? i.og_scrape_url ? i.og_scrape_url : i.type === "image" ? "📷 Sent an image" : i.type === "video" ? "🎥 Sent a video" : i.type === "audio" ? "🎵 Sent audio" : i.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
|
|
411
|
-
})(), p = o != null && o.created_at ? es(new Date(o.created_at)) : "", M = o ? ke(o) : !1, C = d ? d(o,
|
|
411
|
+
})(), p = o != null && o.created_at ? es(new Date(o.created_at)) : "", M = o ? ke(o) : !1, C = d ? d(o, E) : `${M ? "✨ " : ""}${E}`, N = s ?? 0;
|
|
412
412
|
return l && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
413
413
|
channelId: t == null ? void 0 : t.id,
|
|
414
414
|
isSelected: r,
|
|
@@ -505,6 +505,7 @@ const ls = { last_message_at: -1 }, We = A.memo(
|
|
|
505
505
|
filters: n,
|
|
506
506
|
sort: a,
|
|
507
507
|
options: { limit: 30 },
|
|
508
|
+
allowNewMessagesFromUnfilteredChannels: !1,
|
|
508
509
|
Preview: ze,
|
|
509
510
|
EmptyStateIndicator: d
|
|
510
511
|
},
|
|
@@ -557,20 +558,20 @@ function qe({ label: t, className: s, children: n, ...a }) {
|
|
|
557
558
|
function Ye({ onClick: t }) {
|
|
558
559
|
return /* @__PURE__ */ e(qe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(Me, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
559
560
|
}
|
|
560
|
-
const is = (t) => /* @__PURE__ */ e(ct, { ...t, position: "center" }),
|
|
561
|
+
const is = (t) => /* @__PURE__ */ e(ct, { ...t, position: "center" }), Ee = "vote_up", Ie = "vote_down";
|
|
561
562
|
function cs(t) {
|
|
562
|
-
return t != null && t.length ? t.some((s) => s.type === Ie) ? "down" : t.some((s) => s.type ===
|
|
563
|
+
return t != null && t.length ? t.some((s) => s.type === Ie) ? "down" : t.some((s) => s.type === Ee) ? "up" : null : null;
|
|
563
564
|
}
|
|
564
565
|
function ds(t) {
|
|
565
|
-
const { channel: s } = Se(), { client: n } = $e("useMessageVote"), a =
|
|
566
|
+
const { channel: s } = Se(), { client: n } = $e("useMessageVote"), a = _e(
|
|
566
567
|
() => cs(t.own_reactions),
|
|
567
568
|
[t.own_reactions]
|
|
568
569
|
), l = L(async () => {
|
|
569
570
|
if (n != null && n.userID)
|
|
570
571
|
try {
|
|
571
|
-
a === "up" ? await s.deleteReaction(t.id,
|
|
572
|
+
a === "up" ? await s.deleteReaction(t.id, Ee) : await s.sendReaction(
|
|
572
573
|
t.id,
|
|
573
|
-
{ type:
|
|
574
|
+
{ type: Ee },
|
|
574
575
|
{ enforce_unique: !0, skip_push: !0 }
|
|
575
576
|
);
|
|
576
577
|
} catch {
|
|
@@ -652,11 +653,11 @@ const us = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
652
653
|
isMyMessage: y,
|
|
653
654
|
message: o,
|
|
654
655
|
renderText: w,
|
|
655
|
-
threadList:
|
|
656
|
-
} = t, { client: p } = $e("CustomMessage"), [M, C] =
|
|
656
|
+
threadList: E
|
|
657
|
+
} = t, { client: p } = $e("CustomMessage"), [M, C] = I(!1), N = ut(o.id), { selected: x, voteUp: k, voteDown: h } = ds(o), {
|
|
657
658
|
Attachment: m = ht,
|
|
658
659
|
EditMessageModal: i = ft,
|
|
659
|
-
MessageBlocked:
|
|
660
|
+
MessageBlocked: _ = gt,
|
|
660
661
|
MessageBouncePrompt: D = xt,
|
|
661
662
|
MessageDeleted: j = bt,
|
|
662
663
|
MessageIsThreadReplyInChannelButtonIndicator: W = Ct,
|
|
@@ -664,22 +665,22 @@ const us = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
664
665
|
ReminderNotification: q = vt,
|
|
665
666
|
StreamedMessageText: G = wt,
|
|
666
667
|
PinIndicator: X
|
|
667
|
-
} = mt("CustomMessage"), te = pt(o), se = yt(o), ne =
|
|
668
|
+
} = mt("CustomMessage"), te = pt(o), se = yt(o), ne = _e(
|
|
668
669
|
() => b == null ? void 0 : b(o),
|
|
669
670
|
[b, o]
|
|
670
|
-
),
|
|
671
|
+
), H = _e(
|
|
671
672
|
() => !o.shared_location && !o.attachments ? [] : o.shared_location ? [o.shared_location, ...o.attachments ?? []] : o.attachments,
|
|
672
673
|
[o]
|
|
673
674
|
);
|
|
674
|
-
if (
|
|
675
|
+
if (_t(o))
|
|
675
676
|
return null;
|
|
676
677
|
if (o.deleted_at || o.type === "deleted")
|
|
677
678
|
return /* @__PURE__ */ e(j, { message: o });
|
|
678
|
-
if (
|
|
679
|
-
return /* @__PURE__ */ e(
|
|
680
|
-
const Q = !
|
|
679
|
+
if (Et(o))
|
|
680
|
+
return /* @__PURE__ */ e(_, {});
|
|
681
|
+
const Q = !E && !!o.reply_count, F = !E && o.show_in_channel && o.parent_id, P = o.status === "failed" && ((ue = o.error) == null ? void 0 : ue.status) !== 403, V = It(o);
|
|
681
682
|
let B;
|
|
682
|
-
|
|
683
|
+
P ? B = () => g(o) : V && (B = () => C(!0));
|
|
683
684
|
const O = y(), ae = R(
|
|
684
685
|
"str-chat__message str-chat__message-simple",
|
|
685
686
|
`str-chat__message--${o.type}`,
|
|
@@ -692,12 +693,12 @@ const us = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
692
693
|
"str-chat__message--pinned pinned-message": o.pinned,
|
|
693
694
|
"str-chat__message--with-reactions": se,
|
|
694
695
|
"str-chat__message-send-can-be-retried": (o == null ? void 0 : o.status) === "failed" && ((me = o == null ? void 0 : o.error) == null ? void 0 : me.status) !== 403,
|
|
695
|
-
"str-chat__message-with-thread-link": Q ||
|
|
696
|
+
"str-chat__message-with-thread-link": Q || F,
|
|
696
697
|
"str-chat__virtual-message__wrapper--end": l,
|
|
697
698
|
"str-chat__virtual-message__wrapper--first": d,
|
|
698
699
|
"str-chat__virtual-message__wrapper--group": r
|
|
699
700
|
}
|
|
700
|
-
), ie = o.poll_id && p.polls.fromState(o.poll_id), K = os(o), Y = ke(o), re = !!(
|
|
701
|
+
), ie = o.poll_id && p.polls.fromState(o.poll_id), K = os(o), Y = ke(o), re = !!(H != null && H.length && !o.quoted_message), ce = Y && O && re;
|
|
701
702
|
return /* @__PURE__ */ c(de, { children: [
|
|
702
703
|
a && /* @__PURE__ */ e(
|
|
703
704
|
i,
|
|
@@ -729,7 +730,7 @@ const us = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
729
730
|
"div",
|
|
730
731
|
{
|
|
731
732
|
className: R("str-chat__message-inner", {
|
|
732
|
-
"str-chat__simple-message--error-failed":
|
|
733
|
+
"str-chat__simple-message--error-failed": P || V
|
|
733
734
|
}),
|
|
734
735
|
"data-testid": "message-inner",
|
|
735
736
|
onClick: B,
|
|
@@ -756,11 +757,11 @@ const us = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
756
757
|
}
|
|
757
758
|
),
|
|
758
759
|
ie && /* @__PURE__ */ e(Mt, { poll: ie }),
|
|
759
|
-
|
|
760
|
+
H != null && H.length && !o.quoted_message ? /* @__PURE__ */ e(
|
|
760
761
|
m,
|
|
761
762
|
{
|
|
762
763
|
actionHandler: u,
|
|
763
|
-
attachments:
|
|
764
|
+
attachments: H
|
|
764
765
|
}
|
|
765
766
|
) : null,
|
|
766
767
|
ne ? /* @__PURE__ */ e(
|
|
@@ -798,7 +799,7 @@ const us = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
798
799
|
reply_count: o.reply_count
|
|
799
800
|
}
|
|
800
801
|
),
|
|
801
|
-
|
|
802
|
+
F && /* @__PURE__ */ e(W, {})
|
|
802
803
|
] }, o.id)
|
|
803
804
|
] });
|
|
804
805
|
}, gs = A.memo(
|
|
@@ -867,9 +868,9 @@ const us = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
867
868
|
l.og_scrape_url
|
|
868
869
|
)) }) : null;
|
|
869
870
|
}, vs = () => {
|
|
870
|
-
const { handleSubmit: t } =
|
|
871
|
+
const { handleSubmit: t } = Ft(), s = Pt();
|
|
871
872
|
return /* @__PURE__ */ c(de, { children: [
|
|
872
|
-
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(
|
|
873
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ut, {}) }),
|
|
873
874
|
/* @__PURE__ */ c("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
|
|
874
875
|
/* @__PURE__ */ e(Ot, {}),
|
|
875
876
|
/* @__PURE__ */ e(Ns, {}),
|
|
@@ -909,7 +910,7 @@ const us = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
909
910
|
], ys = {
|
|
910
911
|
SYSTEM_DM_AGENT_PAUSED: "DM Agent has left the conversation",
|
|
911
912
|
SYSTEM_DM_AGENT_RESUMED: "DM Agent has rejoined the conversation"
|
|
912
|
-
}, Be = (t) => ps.includes(t),
|
|
913
|
+
}, Be = (t) => ps.includes(t), _s = (t) => {
|
|
913
914
|
var a;
|
|
914
915
|
const s = (a = t.metadata) == null ? void 0 : a.custom_type;
|
|
915
916
|
if (Be(s))
|
|
@@ -917,9 +918,9 @@ const us = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
|
|
|
917
918
|
const n = t.dm_agent_system_type;
|
|
918
919
|
if (Be(n))
|
|
919
920
|
return n;
|
|
920
|
-
},
|
|
921
|
+
}, Es = (t) => {
|
|
921
922
|
var a;
|
|
922
|
-
const s = t.message.hide_date === !0, n =
|
|
923
|
+
const s = t.message.hide_date === !0, n = _s(t.message);
|
|
923
924
|
if (n) {
|
|
924
925
|
const l = ((a = t.message.text) == null ? void 0 : a.trim()) || ys[n];
|
|
925
926
|
return /* @__PURE__ */ c("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
@@ -1009,14 +1010,14 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1009
1010
|
canShowInfo: a,
|
|
1010
1011
|
showStarButton: l = !1
|
|
1011
1012
|
}) => {
|
|
1012
|
-
var y, o, w,
|
|
1013
|
+
var y, o, w, E, p, M;
|
|
1013
1014
|
const { channel: d } = Se(), r = A.useMemo(() => Object.values(d.state.members || {}).find(
|
|
1014
1015
|
(N) => {
|
|
1015
1016
|
var x;
|
|
1016
1017
|
return ((x = N.user) == null ? void 0 : x.id) && N.user.id !== d._client.userID;
|
|
1017
1018
|
}
|
|
1018
|
-
), [d._client.userID, d.state.members]), u = ((y = r == null ? void 0 : r.user) == null ? void 0 : y.name) || ((o = r == null ? void 0 : r.user) == null ? void 0 : o.id) || "Unknown member", f = (w = r == null ? void 0 : r.user) == null ? void 0 : w.image, [g, v] =
|
|
1019
|
-
!!((
|
|
1019
|
+
), [d._client.userID, d.state.members]), u = ((y = r == null ? void 0 : r.user) == null ? void 0 : y.name) || ((o = r == null ? void 0 : r.user) == null ? void 0 : o.id) || "Unknown member", f = (w = r == null ? void 0 : r.user) == null ? void 0 : w.image, [g, v] = I(
|
|
1020
|
+
!!((E = d.state.membership) != null && E.pinned_at)
|
|
1020
1021
|
);
|
|
1021
1022
|
J(() => {
|
|
1022
1023
|
const C = (N) => {
|
|
@@ -1091,7 +1092,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1091
1092
|
onClick: n,
|
|
1092
1093
|
type: "button",
|
|
1093
1094
|
"aria-label": "Show info",
|
|
1094
|
-
children: /* @__PURE__ */ e(
|
|
1095
|
+
children: /* @__PURE__ */ e(Fe, { className: "size-5 text-black/90" })
|
|
1095
1096
|
}
|
|
1096
1097
|
)
|
|
1097
1098
|
] })
|
|
@@ -1146,7 +1147,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1146
1147
|
onClick: n,
|
|
1147
1148
|
type: "button",
|
|
1148
1149
|
"aria-label": "Show info",
|
|
1149
|
-
children: /* @__PURE__ */ e(
|
|
1150
|
+
children: /* @__PURE__ */ e(Fe, { className: "size-5 text-black/90" })
|
|
1150
1151
|
}
|
|
1151
1152
|
)
|
|
1152
1153
|
] })
|
|
@@ -1166,10 +1167,10 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1166
1167
|
onReportParticipantClick: v,
|
|
1167
1168
|
customChannelActions: b
|
|
1168
1169
|
}) => {
|
|
1169
|
-
var G, X, te, se, ne,
|
|
1170
|
-
const { service: y, debug: o } = ve(), [w,
|
|
1171
|
-
var
|
|
1172
|
-
if (!(!y || !((
|
|
1170
|
+
var G, X, te, se, ne, H, Q;
|
|
1171
|
+
const { service: y, debug: o } = ve(), [w, E] = I(!1), [p, M] = I(!1), [C, N] = I(!1), x = L(async () => {
|
|
1172
|
+
var F;
|
|
1173
|
+
if (!(!y || !((F = n == null ? void 0 : n.user) != null && F.id)))
|
|
1173
1174
|
try {
|
|
1174
1175
|
const V = (await y.getBlockedUsers()).some(
|
|
1175
1176
|
(B) => {
|
|
@@ -1177,11 +1178,11 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1177
1178
|
return B.blocked_user_id === ((O = n == null ? void 0 : n.user) == null ? void 0 : O.id);
|
|
1178
1179
|
}
|
|
1179
1180
|
);
|
|
1180
|
-
|
|
1181
|
-
} catch (
|
|
1181
|
+
E(V);
|
|
1182
|
+
} catch (P) {
|
|
1182
1183
|
console.error(
|
|
1183
1184
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
1184
|
-
|
|
1185
|
+
P
|
|
1185
1186
|
);
|
|
1186
1187
|
}
|
|
1187
1188
|
}, [y, (G = n == null ? void 0 : n.user) == null ? void 0 : G.id]);
|
|
@@ -1189,24 +1190,24 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1189
1190
|
x();
|
|
1190
1191
|
}, [x]);
|
|
1191
1192
|
const k = async () => {
|
|
1192
|
-
var
|
|
1193
|
+
var F;
|
|
1193
1194
|
if (!p) {
|
|
1194
1195
|
f == null || f(), o && console.log("[ChannelInfoDialog] Leave conversation", a.cid), M(!0);
|
|
1195
1196
|
try {
|
|
1196
|
-
const
|
|
1197
|
-
await a.hide(
|
|
1198
|
-
} catch (
|
|
1199
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
1197
|
+
const P = ((F = a._client) == null ? void 0 : F.userID) ?? null;
|
|
1198
|
+
await a.hide(P, !1), d && await d(a), s();
|
|
1199
|
+
} catch (P) {
|
|
1200
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", P);
|
|
1200
1201
|
} finally {
|
|
1201
1202
|
M(!1);
|
|
1202
1203
|
}
|
|
1203
1204
|
}
|
|
1204
1205
|
}, h = async () => {
|
|
1205
|
-
var
|
|
1206
|
+
var F, P, V;
|
|
1206
1207
|
if (!(C || !y)) {
|
|
1207
|
-
g == null || g(), o && console.log("[ChannelInfoDialog] Block member", (
|
|
1208
|
+
g == null || g(), o && console.log("[ChannelInfoDialog] Block member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), N(!0);
|
|
1208
1209
|
try {
|
|
1209
|
-
await y.blockUser((
|
|
1210
|
+
await y.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), r && await r((V = n == null ? void 0 : n.user) == null ? void 0 : V.id), s();
|
|
1210
1211
|
} catch (B) {
|
|
1211
1212
|
console.error("[ChannelInfoDialog] Failed to block member", B);
|
|
1212
1213
|
} finally {
|
|
@@ -1214,11 +1215,11 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1214
1215
|
}
|
|
1215
1216
|
}
|
|
1216
1217
|
}, m = async () => {
|
|
1217
|
-
var
|
|
1218
|
+
var F, P, V;
|
|
1218
1219
|
if (!(C || !y)) {
|
|
1219
|
-
g == null || g(), o && console.log("[ChannelInfoDialog] Unblock member", (
|
|
1220
|
+
g == null || g(), o && console.log("[ChannelInfoDialog] Unblock member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), N(!0);
|
|
1220
1221
|
try {
|
|
1221
|
-
await y.unBlockUser((
|
|
1222
|
+
await y.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), r && await r((V = n == null ? void 0 : n.user) == null ? void 0 : V.id), s();
|
|
1222
1223
|
} catch (B) {
|
|
1223
1224
|
console.error("[ChannelInfoDialog] Failed to unblock member", B);
|
|
1224
1225
|
} finally {
|
|
@@ -1233,7 +1234,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1233
1234
|
);
|
|
1234
1235
|
};
|
|
1235
1236
|
if (!n) return null;
|
|
1236
|
-
const
|
|
1237
|
+
const _ = ((X = n.user) == null ? void 0 : X.name) || ((te = n.user) == null ? void 0 : te.id) || "Unknown member", D = (se = n.user) == null ? void 0 : se.image, j = (ne = n.user) == null ? void 0 : ne.email, W = (H = n.user) == null ? void 0 : H.username, T = j || (W ? `linktr.ee/${W}` : void 0), q = ((Q = n.user) == null ? void 0 : Q.id) || "unknown";
|
|
1237
1238
|
return (
|
|
1238
1239
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1239
1240
|
/* @__PURE__ */ e(
|
|
@@ -1242,8 +1243,8 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1242
1243
|
ref: t,
|
|
1243
1244
|
className: "mes-dialog group",
|
|
1244
1245
|
onClose: s,
|
|
1245
|
-
onClick: (
|
|
1246
|
-
|
|
1246
|
+
onClick: (F) => {
|
|
1247
|
+
F.target === t.current && s();
|
|
1247
1248
|
},
|
|
1248
1249
|
children: /* @__PURE__ */ c("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
|
|
1249
1250
|
/* @__PURE__ */ c("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
@@ -1261,14 +1262,14 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1261
1262
|
ee,
|
|
1262
1263
|
{
|
|
1263
1264
|
id: q,
|
|
1264
|
-
name:
|
|
1265
|
+
name: _,
|
|
1265
1266
|
image: D,
|
|
1266
1267
|
size: 88,
|
|
1267
1268
|
shape: "circle"
|
|
1268
1269
|
}
|
|
1269
1270
|
),
|
|
1270
1271
|
/* @__PURE__ */ c("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
1271
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
1272
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: _ }),
|
|
1272
1273
|
T && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: T }),
|
|
1273
1274
|
l && /* @__PURE__ */ e(
|
|
1274
1275
|
"span",
|
|
@@ -1308,7 +1309,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1308
1309
|
disabled: C,
|
|
1309
1310
|
"aria-busy": C,
|
|
1310
1311
|
children: [
|
|
1311
|
-
C ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(
|
|
1312
|
+
C ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Pe, { className: "h-5 w-5" }),
|
|
1312
1313
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
1313
1314
|
]
|
|
1314
1315
|
}
|
|
@@ -1319,7 +1320,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1319
1320
|
disabled: C,
|
|
1320
1321
|
"aria-busy": C,
|
|
1321
1322
|
children: [
|
|
1322
|
-
C ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(
|
|
1323
|
+
C ? /* @__PURE__ */ e(be, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Pe, { className: "h-5 w-5" }),
|
|
1323
1324
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
1324
1325
|
]
|
|
1325
1326
|
}
|
|
@@ -1351,7 +1352,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1351
1352
|
customChannelActions: y,
|
|
1352
1353
|
renderMessage: o
|
|
1353
1354
|
}) => {
|
|
1354
|
-
const { channel: w } = Se(),
|
|
1355
|
+
const { channel: w } = Se(), E = Z(null), p = A.useMemo(() => Object.values(w.state.members || {}).find(
|
|
1355
1356
|
(k) => {
|
|
1356
1357
|
var h;
|
|
1357
1358
|
return ((h = k.user) == null ? void 0 : h.id) && k.user.id !== w._client.userID;
|
|
@@ -1364,10 +1365,10 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1364
1365
|
return x.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1365
1366
|
}, [w.data]), C = L(() => {
|
|
1366
1367
|
var x;
|
|
1367
|
-
(x =
|
|
1368
|
+
(x = E.current) == null || x.showModal();
|
|
1368
1369
|
}, []), N = L(() => {
|
|
1369
1370
|
var x;
|
|
1370
|
-
(x =
|
|
1371
|
+
(x = E.current) == null || x.close();
|
|
1371
1372
|
}, []);
|
|
1372
1373
|
return /* @__PURE__ */ c(de, { children: [
|
|
1373
1374
|
/* @__PURE__ */ e(
|
|
@@ -1417,7 +1418,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1417
1418
|
/* @__PURE__ */ e(
|
|
1418
1419
|
ks,
|
|
1419
1420
|
{
|
|
1420
|
-
dialogRef:
|
|
1421
|
+
dialogRef: E,
|
|
1421
1422
|
onClose: N,
|
|
1422
1423
|
participant: p,
|
|
1423
1424
|
channel: w,
|
|
@@ -1449,7 +1450,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1449
1450
|
dmAgentEnabled: y,
|
|
1450
1451
|
messageMetadata: o,
|
|
1451
1452
|
onMessageSent: w,
|
|
1452
|
-
showStarButton:
|
|
1453
|
+
showStarButton: E = !1,
|
|
1453
1454
|
chatbotVotingEnabled: p = !1,
|
|
1454
1455
|
renderChannelBanner: M,
|
|
1455
1456
|
customChannelActions: C,
|
|
@@ -1458,9 +1459,9 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1458
1459
|
const x = L(
|
|
1459
1460
|
async (k, h, m) => {
|
|
1460
1461
|
var T;
|
|
1461
|
-
const i = ((T = t.data) == null ? void 0 : T.chatbot_paused) === !0,
|
|
1462
|
+
const i = ((T = t.data) == null ? void 0 : T.chatbot_paused) === !0, _ = y && !i, D = {
|
|
1462
1463
|
...h,
|
|
1463
|
-
...
|
|
1464
|
+
..._ && { silent: !0 },
|
|
1464
1465
|
...o && {
|
|
1465
1466
|
metadata: {
|
|
1466
1467
|
...h.metadata ?? {},
|
|
@@ -1469,7 +1470,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1469
1470
|
}
|
|
1470
1471
|
}, j = {
|
|
1471
1472
|
...m,
|
|
1472
|
-
...
|
|
1473
|
+
..._ && { skip_push: !0 }
|
|
1473
1474
|
}, W = await t.sendMessage(D, j);
|
|
1474
1475
|
return w == null || w(W), W;
|
|
1475
1476
|
},
|
|
@@ -1486,7 +1487,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1486
1487
|
$t,
|
|
1487
1488
|
{
|
|
1488
1489
|
channel: t,
|
|
1489
|
-
MessageSystem:
|
|
1490
|
+
MessageSystem: Es,
|
|
1490
1491
|
EmptyStateIndicator: u,
|
|
1491
1492
|
LoadingIndicator: Ne,
|
|
1492
1493
|
DateSeparator: is,
|
|
@@ -1504,7 +1505,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
|
|
|
1504
1505
|
onDeleteConversationClick: g,
|
|
1505
1506
|
onBlockParticipantClick: v,
|
|
1506
1507
|
onReportParticipantClick: b,
|
|
1507
|
-
showStarButton:
|
|
1508
|
+
showStarButton: E,
|
|
1508
1509
|
chatbotVotingEnabled: p,
|
|
1509
1510
|
renderChannelBanner: M,
|
|
1510
1511
|
customChannelActions: C,
|
|
@@ -1566,7 +1567,7 @@ const Rs = ({
|
|
|
1566
1567
|
searchPlaceholder: d = "Search participants...",
|
|
1567
1568
|
className: r
|
|
1568
1569
|
}) => {
|
|
1569
|
-
const { debug: u } = ve(), [f, g] =
|
|
1570
|
+
const { debug: u } = ve(), [f, g] = I(""), [v, b] = I([]), [y, o] = I(!1), [w, E] = I(null), [p, M] = I(
|
|
1570
1571
|
null
|
|
1571
1572
|
), C = Z(!1);
|
|
1572
1573
|
J(() => {
|
|
@@ -1578,7 +1579,7 @@ const Rs = ({
|
|
|
1578
1579
|
}
|
|
1579
1580
|
if (C.current) return;
|
|
1580
1581
|
(async () => {
|
|
1581
|
-
u && console.log("[ParticipantPicker] Loading initial participants..."), o(!0),
|
|
1582
|
+
u && console.log("[ParticipantPicker] Loading initial participants..."), o(!0), E(null);
|
|
1582
1583
|
try {
|
|
1583
1584
|
const m = await t.loadParticipants({
|
|
1584
1585
|
search: "",
|
|
@@ -1591,7 +1592,7 @@ const Rs = ({
|
|
|
1591
1592
|
);
|
|
1592
1593
|
} catch (m) {
|
|
1593
1594
|
const i = m instanceof Error ? m.message : "Failed to load participants";
|
|
1594
|
-
|
|
1595
|
+
E(i), console.error("[ParticipantPicker] Failed to load participants:", m);
|
|
1595
1596
|
} finally {
|
|
1596
1597
|
o(!1);
|
|
1597
1598
|
}
|
|
@@ -1654,7 +1655,7 @@ const Rs = ({
|
|
|
1654
1655
|
"..."
|
|
1655
1656
|
] })
|
|
1656
1657
|
] }) }) : N.length === 0 ? /* @__PURE__ */ c("div", { className: "p-6 text-center", children: [
|
|
1657
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
1658
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Ue, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1658
1659
|
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: f ? `No ${l} found` : v.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
|
|
1659
1660
|
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: f ? "Try a different search term" : v.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
|
|
1660
1661
|
] }) : /* @__PURE__ */ c("ul", { className: "space-y-0", children: [
|
|
@@ -1665,7 +1666,7 @@ const Rs = ({
|
|
|
1665
1666
|
{
|
|
1666
1667
|
type: "button",
|
|
1667
1668
|
onClick: () => x(h),
|
|
1668
|
-
onKeyDown: (
|
|
1669
|
+
onKeyDown: (_) => k(_, h),
|
|
1669
1670
|
className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus-ring",
|
|
1670
1671
|
children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
|
|
1671
1672
|
/* @__PURE__ */ c("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
@@ -1683,7 +1684,7 @@ const Rs = ({
|
|
|
1683
1684
|
i && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: i })
|
|
1684
1685
|
] })
|
|
1685
1686
|
] }),
|
|
1686
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: p === h.id ? /* @__PURE__ */ e(be, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(
|
|
1687
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: p === h.id ? /* @__PURE__ */ e(be, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ue, { className: "h-5 w-5 text-stone" }) })
|
|
1687
1688
|
] })
|
|
1688
1689
|
}
|
|
1689
1690
|
) }, h.id);
|
|
@@ -1694,7 +1695,25 @@ const Rs = ({
|
|
|
1694
1695
|
] }) })
|
|
1695
1696
|
] }) })
|
|
1696
1697
|
] });
|
|
1697
|
-
}
|
|
1698
|
+
};
|
|
1699
|
+
function Ls(t, s) {
|
|
1700
|
+
return {
|
|
1701
|
+
...{
|
|
1702
|
+
type: "messaging",
|
|
1703
|
+
last_message_at: { $exists: !0 },
|
|
1704
|
+
...t && {
|
|
1705
|
+
members: { $in: [t] },
|
|
1706
|
+
hidden: !1
|
|
1707
|
+
},
|
|
1708
|
+
$or: [
|
|
1709
|
+
{ has_visitor_message: !0 },
|
|
1710
|
+
{ has_visitor_message: { $exists: !1 } }
|
|
1711
|
+
]
|
|
1712
|
+
},
|
|
1713
|
+
...s
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
const Fs = ({ className: t }) => /* @__PURE__ */ c(
|
|
1698
1717
|
"svg",
|
|
1699
1718
|
{
|
|
1700
1719
|
width: "140",
|
|
@@ -1830,7 +1849,7 @@ const Rs = ({
|
|
|
1830
1849
|
}
|
|
1831
1850
|
), Je = A.memo(
|
|
1832
1851
|
({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ c("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
1833
|
-
/* @__PURE__ */ e(
|
|
1852
|
+
/* @__PURE__ */ e(Fs, {}),
|
|
1834
1853
|
s && !t && /* @__PURE__ */ c("div", { className: "mt-8", children: [
|
|
1835
1854
|
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
1836
1855
|
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
@@ -1853,7 +1872,7 @@ const Ce = A.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
|
|
|
1853
1872
|
)
|
|
1854
1873
|
] }) }));
|
|
1855
1874
|
Ce.displayName = "ErrorState";
|
|
1856
|
-
const
|
|
1875
|
+
const Hs = ({
|
|
1857
1876
|
capabilities: t = {},
|
|
1858
1877
|
className: s,
|
|
1859
1878
|
renderMessageInputActions: n,
|
|
@@ -1869,7 +1888,7 @@ const Vs = ({
|
|
|
1869
1888
|
onBlockParticipantClick: y,
|
|
1870
1889
|
onReportParticipantClick: o,
|
|
1871
1890
|
dmAgentEnabled: w,
|
|
1872
|
-
messageMetadata:
|
|
1891
|
+
messageMetadata: E,
|
|
1873
1892
|
onMessageSent: p,
|
|
1874
1893
|
showStarButton: M = !1,
|
|
1875
1894
|
chatbotVotingEnabled: C = !1,
|
|
@@ -1881,83 +1900,73 @@ const Vs = ({
|
|
|
1881
1900
|
const {
|
|
1882
1901
|
service: m,
|
|
1883
1902
|
client: i,
|
|
1884
|
-
isConnected:
|
|
1903
|
+
isConnected: _,
|
|
1885
1904
|
isLoading: D,
|
|
1886
1905
|
error: j,
|
|
1887
1906
|
refreshConnection: W,
|
|
1888
1907
|
debug: T
|
|
1889
|
-
} = Jt(), [q, G] =
|
|
1908
|
+
} = Jt(), [q, G] = I(null), [X, te] = I(!1), [se, ne] = I(!1), [H, Q] = I(!1), [F, P] = I(/* @__PURE__ */ new Set()), [V, B] = I(0), [O, ae] = I(!1), [ie, K] = I(null), Y = Z(null), {
|
|
1890
1909
|
participantSource: re,
|
|
1891
1910
|
participantLabel: ce = "participants",
|
|
1892
1911
|
showDeleteConversation: ue = !0
|
|
1893
|
-
} = t, me = A.useMemo(
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
members: { $in: [_] },
|
|
1901
|
-
hidden: !1
|
|
1902
|
-
}
|
|
1903
|
-
},
|
|
1904
|
-
...g
|
|
1905
|
-
};
|
|
1906
|
-
}, [g, i == null ? void 0 : i.userID]), he = Z(null), oe = L(async () => {
|
|
1907
|
-
if (!i || !E) return;
|
|
1908
|
-
const _ = i.userID;
|
|
1909
|
-
if (_)
|
|
1912
|
+
} = t, me = A.useMemo(
|
|
1913
|
+
() => Ls(i == null ? void 0 : i.userID, g),
|
|
1914
|
+
[g, i == null ? void 0 : i.userID]
|
|
1915
|
+
), he = Z(null), oe = L(async () => {
|
|
1916
|
+
if (!i || !_) return;
|
|
1917
|
+
const S = i.userID;
|
|
1918
|
+
if (S)
|
|
1910
1919
|
try {
|
|
1911
|
-
T && console.log("[MessagingShell] Syncing channels for user:",
|
|
1912
|
-
const
|
|
1920
|
+
T && console.log("[MessagingShell] Syncing channels for user:", S);
|
|
1921
|
+
const z = await i.queryChannels(
|
|
1913
1922
|
{
|
|
1914
1923
|
type: "messaging",
|
|
1915
|
-
members: { $in: [
|
|
1924
|
+
members: { $in: [S] }
|
|
1916
1925
|
},
|
|
1917
1926
|
{},
|
|
1918
1927
|
{ limit: 100 }
|
|
1919
|
-
),
|
|
1920
|
-
|
|
1928
|
+
), U = /* @__PURE__ */ new Set();
|
|
1929
|
+
z.forEach(($) => {
|
|
1921
1930
|
const we = $.state.members;
|
|
1922
1931
|
Object.values(we).forEach((nt) => {
|
|
1923
1932
|
var De;
|
|
1924
1933
|
const pe = (De = nt.user) == null ? void 0 : De.id;
|
|
1925
|
-
pe && pe !==
|
|
1934
|
+
pe && pe !== S && U.add(pe);
|
|
1926
1935
|
});
|
|
1927
|
-
}),
|
|
1928
|
-
channelCount:
|
|
1929
|
-
memberCount:
|
|
1936
|
+
}), P(($) => $.size === U.size && [...$].every((we) => U.has(we)) ? $ : U), te(z.length > 0), ne(!0), he.current = S, T && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1937
|
+
channelCount: z.length,
|
|
1938
|
+
memberCount: U.size
|
|
1930
1939
|
});
|
|
1931
|
-
} catch (
|
|
1932
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1940
|
+
} catch (z) {
|
|
1941
|
+
console.error("[MessagingShell] Failed to sync channels:", z);
|
|
1933
1942
|
}
|
|
1934
|
-
}, [i,
|
|
1943
|
+
}, [i, _, T]);
|
|
1935
1944
|
J(() => {
|
|
1936
|
-
if (!i || !
|
|
1937
|
-
const
|
|
1938
|
-
|
|
1939
|
-
}, [i,
|
|
1940
|
-
if (!d || !i || !
|
|
1945
|
+
if (!i || !_) return;
|
|
1946
|
+
const S = i.userID;
|
|
1947
|
+
S && he.current !== S && oe();
|
|
1948
|
+
}, [i, _, oe]), J(() => {
|
|
1949
|
+
if (!d || !i || !_) return;
|
|
1941
1950
|
(async () => {
|
|
1942
|
-
const
|
|
1943
|
-
if (
|
|
1951
|
+
const z = i.userID;
|
|
1952
|
+
if (z)
|
|
1944
1953
|
try {
|
|
1945
1954
|
T && console.log(
|
|
1946
1955
|
"[MessagingShell] Loading initial conversation with:",
|
|
1947
1956
|
d
|
|
1948
1957
|
);
|
|
1949
|
-
const
|
|
1958
|
+
const U = await i.queryChannels(
|
|
1950
1959
|
{
|
|
1951
1960
|
type: "messaging",
|
|
1952
|
-
members: { $eq: [
|
|
1961
|
+
members: { $eq: [z, d] }
|
|
1953
1962
|
},
|
|
1954
1963
|
{},
|
|
1955
1964
|
{ limit: 1 }
|
|
1956
1965
|
);
|
|
1957
|
-
if (
|
|
1958
|
-
G(
|
|
1966
|
+
if (U.length > 0)
|
|
1967
|
+
G(U[0]), ae(!0), K(null), a && a(U[0]), T && console.log(
|
|
1959
1968
|
"[MessagingShell] Initial conversation loaded:",
|
|
1960
|
-
|
|
1969
|
+
U[0].id
|
|
1961
1970
|
);
|
|
1962
1971
|
else if (r && m) {
|
|
1963
1972
|
T && console.log(
|
|
@@ -1988,10 +1997,10 @@ const Vs = ({
|
|
|
1988
1997
|
"[MessagingShell] No conversation found for:",
|
|
1989
1998
|
d
|
|
1990
1999
|
);
|
|
1991
|
-
} catch (
|
|
2000
|
+
} catch (U) {
|
|
1992
2001
|
console.error(
|
|
1993
2002
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1994
|
-
|
|
2003
|
+
U
|
|
1995
2004
|
), K("Failed to load conversation");
|
|
1996
2005
|
}
|
|
1997
2006
|
})();
|
|
@@ -1999,64 +2008,64 @@ const Vs = ({
|
|
|
1999
2008
|
d,
|
|
2000
2009
|
r,
|
|
2001
2010
|
i,
|
|
2002
|
-
|
|
2011
|
+
_,
|
|
2003
2012
|
m,
|
|
2004
2013
|
T,
|
|
2005
2014
|
a
|
|
2006
2015
|
]);
|
|
2007
2016
|
const Qe = L(
|
|
2008
|
-
(
|
|
2009
|
-
G(
|
|
2017
|
+
(S) => {
|
|
2018
|
+
G(S), a == null || a(S);
|
|
2010
2019
|
},
|
|
2011
2020
|
[a]
|
|
2012
2021
|
), Xe = L(() => {
|
|
2013
2022
|
O || G(null);
|
|
2014
2023
|
}, [O]), Ke = L(
|
|
2015
|
-
async (
|
|
2016
|
-
var
|
|
2024
|
+
async (S) => {
|
|
2025
|
+
var z;
|
|
2017
2026
|
if (m)
|
|
2018
2027
|
try {
|
|
2019
2028
|
T && console.log(
|
|
2020
2029
|
"[MessagingShell] Starting conversation with:",
|
|
2021
|
-
|
|
2030
|
+
S.id
|
|
2022
2031
|
);
|
|
2023
|
-
const
|
|
2024
|
-
id:
|
|
2025
|
-
name:
|
|
2026
|
-
email:
|
|
2027
|
-
phone:
|
|
2032
|
+
const U = await m.startChannelWithParticipant({
|
|
2033
|
+
id: S.id,
|
|
2034
|
+
name: S.name,
|
|
2035
|
+
email: S.email,
|
|
2036
|
+
phone: S.phone
|
|
2028
2037
|
});
|
|
2029
2038
|
try {
|
|
2030
|
-
await
|
|
2039
|
+
await U.show();
|
|
2031
2040
|
} catch ($) {
|
|
2032
2041
|
console.warn("[MessagingShell] Failed to unhide channel:", $);
|
|
2033
2042
|
}
|
|
2034
|
-
G(
|
|
2035
|
-
} catch (
|
|
2036
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
2043
|
+
G(U), Q(!1), (z = Y.current) == null || z.close(), l == null || l(S);
|
|
2044
|
+
} catch (U) {
|
|
2045
|
+
console.error("[MessagingShell] Failed to start conversation:", U);
|
|
2037
2046
|
}
|
|
2038
2047
|
},
|
|
2039
2048
|
[m, l, T]
|
|
2040
2049
|
), fe = L(() => {
|
|
2041
|
-
var
|
|
2042
|
-
Q(!1), (
|
|
2050
|
+
var S;
|
|
2051
|
+
Q(!1), (S = Y.current) == null || S.close();
|
|
2043
2052
|
}, []), et = L(
|
|
2044
|
-
(
|
|
2045
|
-
|
|
2053
|
+
(S) => {
|
|
2054
|
+
S.target === Y.current && fe();
|
|
2046
2055
|
},
|
|
2047
2056
|
[fe]
|
|
2048
2057
|
), tt = L(
|
|
2049
|
-
async (
|
|
2050
|
-
T && console.log("[MessagingShell] Leaving conversation:",
|
|
2058
|
+
async (S) => {
|
|
2059
|
+
T && console.log("[MessagingShell] Leaving conversation:", S.id), G(null), ae(!1), he.current = null, await oe();
|
|
2051
2060
|
},
|
|
2052
2061
|
[oe, T]
|
|
2053
2062
|
), st = L(
|
|
2054
|
-
async (
|
|
2055
|
-
T && console.log("[MessagingShell] Blocking participant:",
|
|
2063
|
+
async (S) => {
|
|
2064
|
+
T && console.log("[MessagingShell] Blocking participant:", S), G(null), ae(!1), he.current = null, await oe();
|
|
2056
2065
|
},
|
|
2057
2066
|
[oe, T]
|
|
2058
2067
|
), ge = !!q;
|
|
2059
|
-
return D ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ne, {}) }) : j ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ce, { message: j, onBack: W }) }) : !
|
|
2068
|
+
return D ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ne, {}) }) : j ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ce, { message: j, onBack: W }) }) : !_ || !i ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
|
|
2060
2069
|
Ce,
|
|
2061
2070
|
{
|
|
2062
2071
|
message: "Not connected to messaging service",
|
|
@@ -2124,7 +2133,7 @@ const Vs = ({
|
|
|
2124
2133
|
onBlockParticipantClick: y,
|
|
2125
2134
|
onReportParticipantClick: o,
|
|
2126
2135
|
dmAgentEnabled: w,
|
|
2127
|
-
messageMetadata:
|
|
2136
|
+
messageMetadata: E,
|
|
2128
2137
|
onMessageSent: p,
|
|
2129
2138
|
showStarButton: M,
|
|
2130
2139
|
chatbotVotingEnabled: C,
|
|
@@ -2159,7 +2168,7 @@ const Vs = ({
|
|
|
2159
2168
|
participantSource: re,
|
|
2160
2169
|
onSelectParticipant: Ke,
|
|
2161
2170
|
onClose: fe,
|
|
2162
|
-
existingParticipantIds:
|
|
2171
|
+
existingParticipantIds: F,
|
|
2163
2172
|
participantLabel: ce,
|
|
2164
2173
|
searchPlaceholder: `Search ${ce}...`
|
|
2165
2174
|
},
|
|
@@ -2192,7 +2201,7 @@ const Vs = ({
|
|
|
2192
2201
|
),
|
|
2193
2202
|
children: t
|
|
2194
2203
|
}
|
|
2195
|
-
),
|
|
2204
|
+
), zs = ({
|
|
2196
2205
|
faqs: t,
|
|
2197
2206
|
onFaqClick: s,
|
|
2198
2207
|
loadingFaqId: n,
|
|
@@ -2233,8 +2242,8 @@ const Vs = ({
|
|
|
2233
2242
|
}
|
|
2234
2243
|
)
|
|
2235
2244
|
] }) });
|
|
2236
|
-
},
|
|
2237
|
-
const { initialSearch: n = "", pageSize: a = 20 } = s, [l, d] =
|
|
2245
|
+
}, Ws = (t, s = {}) => {
|
|
2246
|
+
const { initialSearch: n = "", pageSize: a = 20 } = s, [l, d] = I([]), [r, u] = I(!1), [f, g] = I(null), [v, b] = I(n), [y, o] = I(!0), [w, E] = I(), p = L(async (x = !1, k) => {
|
|
2238
2247
|
if (r) return;
|
|
2239
2248
|
const h = k !== void 0 ? k : v;
|
|
2240
2249
|
u(!0), g(null);
|
|
@@ -2246,7 +2255,7 @@ const Vs = ({
|
|
|
2246
2255
|
});
|
|
2247
2256
|
d(
|
|
2248
2257
|
(i) => x ? m.participants : [...i, ...m.participants]
|
|
2249
|
-
), o(m.hasMore),
|
|
2258
|
+
), o(m.hasMore), E(m.nextCursor);
|
|
2250
2259
|
} catch (m) {
|
|
2251
2260
|
const i = m instanceof Error ? m.message : "Failed to load participants";
|
|
2252
2261
|
g(i), console.error("[useParticipants] Load error:", m);
|
|
@@ -2256,9 +2265,9 @@ const Vs = ({
|
|
|
2256
2265
|
}, [t, v, w, a, r]), M = L(() => {
|
|
2257
2266
|
y && !r && p(!1);
|
|
2258
2267
|
}, [y, r, p]), C = L((x) => {
|
|
2259
|
-
b(x),
|
|
2268
|
+
b(x), E(void 0), p(!0, x);
|
|
2260
2269
|
}, [p]), N = L(() => {
|
|
2261
|
-
|
|
2270
|
+
E(void 0), p(!0);
|
|
2262
2271
|
}, [p]);
|
|
2263
2272
|
return J(() => {
|
|
2264
2273
|
p(!0);
|
|
@@ -2280,15 +2289,15 @@ export {
|
|
|
2280
2289
|
Is as ChannelEmptyState,
|
|
2281
2290
|
We as ChannelList,
|
|
2282
2291
|
Ze as ChannelView,
|
|
2283
|
-
|
|
2292
|
+
zs as FaqList,
|
|
2284
2293
|
Ps as FaqListItem,
|
|
2285
2294
|
hs as MessageVoteButtons,
|
|
2286
|
-
|
|
2287
|
-
|
|
2295
|
+
Vs as MessagingProvider,
|
|
2296
|
+
Hs as MessagingShell,
|
|
2288
2297
|
Rs as ParticipantPicker,
|
|
2289
2298
|
es as formatRelativeTime,
|
|
2290
2299
|
ds as useMessageVote,
|
|
2291
2300
|
Jt as useMessaging,
|
|
2292
|
-
|
|
2301
|
+
Ws as useParticipants
|
|
2293
2302
|
};
|
|
2294
2303
|
//# sourceMappingURL=index.js.map
|