@codingfactory/messenger-client 0.4.11 → 0.4.13
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 +197 -181
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1117,13 +1117,24 @@ const Gt = ur("messaging", {
|
|
|
1117
1117
|
throw this.error = Ke(i), i;
|
|
1118
1118
|
},
|
|
1119
1119
|
async sendTyping(e, t = "start") {
|
|
1120
|
+
const n = {
|
|
1121
|
+
_messengerSuppressAuthInvalidation: !0
|
|
1122
|
+
};
|
|
1120
1123
|
try {
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1124
|
+
const i = await Fe().post(
|
|
1125
|
+
`/v1/messaging/conversations/${e}/typing`,
|
|
1126
|
+
{ state: t },
|
|
1127
|
+
n
|
|
1128
|
+
);
|
|
1129
|
+
if (t !== "start" || !Vo(i.data))
|
|
1123
1130
|
return;
|
|
1124
|
-
await Si(Bo), await Fe().post(
|
|
1125
|
-
|
|
1126
|
-
|
|
1131
|
+
await Si(Bo), await Fe().post(
|
|
1132
|
+
`/v1/messaging/conversations/${e}/typing`,
|
|
1133
|
+
{ state: t },
|
|
1134
|
+
n
|
|
1135
|
+
);
|
|
1136
|
+
} catch (i) {
|
|
1137
|
+
console.warn("Failed to send typing indicator:", i);
|
|
1127
1138
|
}
|
|
1128
1139
|
},
|
|
1129
1140
|
async muteConversation(e, t) {
|
|
@@ -1869,7 +1880,7 @@ function Cl(e) {
|
|
|
1869
1880
|
function kl() {
|
|
1870
1881
|
Ks = Nr;
|
|
1871
1882
|
}
|
|
1872
|
-
const rn = Xs()("GlobalMessaging"), Sl = 25, Tl =
|
|
1883
|
+
const rn = Xs()("GlobalMessaging"), Sl = 25, Tl = 3e4, Ml = (e) => e.replace(/\/+$/, ""), xl = (e) => Ml(window.location.pathname) === `/messages/${e}`, El = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1873
1884
|
function Ig() {
|
|
1874
1885
|
const e = Gt(), t = It()(), n = wl(), i = js(), o = dr(), l = Ds(), { conversations: u, requestConversations: p } = no(e), h = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map();
|
|
1875
1886
|
let y = !1;
|
|
@@ -4243,7 +4254,7 @@ function Mc() {
|
|
|
4243
4254
|
for (var d = 0; d < a.length; d++)
|
|
4244
4255
|
s.call(r || window, a[d], d, a);
|
|
4245
4256
|
}
|
|
4246
|
-
function
|
|
4257
|
+
function ee(a, s) {
|
|
4247
4258
|
for (var r = [], d = 0; d < a.length; d++)
|
|
4248
4259
|
r.push(s(a[d], d, a, r));
|
|
4249
4260
|
return r;
|
|
@@ -4294,7 +4305,7 @@ function Mc() {
|
|
|
4294
4305
|
function Ie(a) {
|
|
4295
4306
|
var s = we(a, function(d) {
|
|
4296
4307
|
return d !== void 0;
|
|
4297
|
-
}), r =
|
|
4308
|
+
}), r = ee(Pe(z(s)), Se.method("join", "=")).join("&");
|
|
4298
4309
|
return r;
|
|
4299
4310
|
}
|
|
4300
4311
|
function Ne(a) {
|
|
@@ -4509,7 +4520,7 @@ function Mc() {
|
|
|
4509
4520
|
return this;
|
|
4510
4521
|
}
|
|
4511
4522
|
}
|
|
4512
|
-
class
|
|
4523
|
+
class te extends se {
|
|
4513
4524
|
constructor(s, r, d, g, W) {
|
|
4514
4525
|
super(), this.initialize = De.transportConnectionInitializer, this.hooks = s, this.name = r, this.priority = d, this.key = g, this.options = W, this.state = "new", this.timeline = W.timeline, this.activityTimeout = W.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
4515
4526
|
}
|
|
@@ -4596,7 +4607,7 @@ function Mc() {
|
|
|
4596
4607
|
return this.hooks.isSupported(s);
|
|
4597
4608
|
}
|
|
4598
4609
|
createConnection(s, r, d, g) {
|
|
4599
|
-
return new
|
|
4610
|
+
return new te(this.hooks, s, r, d, g);
|
|
4600
4611
|
}
|
|
4601
4612
|
}
|
|
4602
4613
|
var Qe = new je({
|
|
@@ -5435,7 +5446,7 @@ function Mc() {
|
|
|
5435
5446
|
}
|
|
5436
5447
|
}
|
|
5437
5448
|
function yn(a, s, r) {
|
|
5438
|
-
var d =
|
|
5449
|
+
var d = ee(a, function(g, W, fe, Me) {
|
|
5439
5450
|
return g.connect(s, r(W, Me));
|
|
5440
5451
|
});
|
|
5441
5452
|
return {
|
|
@@ -6599,18 +6610,18 @@ function Fg(e) {
|
|
|
6599
6610
|
const t = e.initializedEvent ?? "messenger-client:echo-initialized", n = e.bootstrapEndpoint ?? Ac, i = e.bootstrapRefreshSkewMs ?? $c, o = e.presenceFreshnessTtlMs ?? Pc, l = (e.createLogger ?? Xs())("MessengerEcho");
|
|
6600
6611
|
typeof window < "u" && (window.Pusher = Ec);
|
|
6601
6612
|
let u = null, p = null, h = null, w = null, y = "disconnected", k = "available", x = null, M = null, $ = !1;
|
|
6602
|
-
const R = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Map(), L = (
|
|
6603
|
-
y =
|
|
6613
|
+
const R = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Map(), L = (ee) => {
|
|
6614
|
+
y = ee;
|
|
6604
6615
|
for (const J of R)
|
|
6605
|
-
J(
|
|
6606
|
-
}, ae = (
|
|
6607
|
-
k =
|
|
6616
|
+
J(ee);
|
|
6617
|
+
}, ae = (ee) => {
|
|
6618
|
+
k = ee;
|
|
6608
6619
|
for (const J of A)
|
|
6609
|
-
J(
|
|
6620
|
+
J(ee);
|
|
6610
6621
|
}, de = () => {
|
|
6611
6622
|
M !== null && (clearTimeout(M), M = null);
|
|
6612
|
-
}, E = (
|
|
6613
|
-
h !== null && (h.disconnect(), h = null), w = null,
|
|
6623
|
+
}, E = (ee = !0) => {
|
|
6624
|
+
h !== null && (h.disconnect(), h = null), w = null, ee && L("disconnected");
|
|
6614
6625
|
}, O = () => {
|
|
6615
6626
|
de(), u = null, p = null, x = null, ae("available"), E(), I.clear();
|
|
6616
6627
|
};
|
|
@@ -6625,43 +6636,43 @@ function Fg(e) {
|
|
|
6625
6636
|
}
|
|
6626
6637
|
if (typeof window > "u")
|
|
6627
6638
|
return;
|
|
6628
|
-
const
|
|
6629
|
-
typeof
|
|
6639
|
+
const ee = e.buildLoginRedirectUrl?.();
|
|
6640
|
+
typeof ee == "string" && ee.trim() !== "" && window.location.assign(ee);
|
|
6630
6641
|
}
|
|
6631
6642
|
const ie = () => {
|
|
6632
6643
|
if (!e.getSourceToken)
|
|
6633
6644
|
return null;
|
|
6634
|
-
const
|
|
6635
|
-
return
|
|
6636
|
-
}, q = (
|
|
6637
|
-
if (zc(
|
|
6645
|
+
const ee = e.getSourceToken();
|
|
6646
|
+
return ee === null ? (x !== null || u !== null ? ne() : O(), null) : (x !== null && x !== ee && ($ = !1, de(), u = null, p = null, ae("available"), E()), x = ee, ee);
|
|
6647
|
+
}, q = (ee) => {
|
|
6648
|
+
if (zc(ee.service.apiBaseUrl)) {
|
|
6638
6649
|
const J = ie();
|
|
6639
6650
|
if (J !== null)
|
|
6640
6651
|
return J;
|
|
6641
6652
|
}
|
|
6642
|
-
return
|
|
6643
|
-
}, K = (
|
|
6644
|
-
if (
|
|
6653
|
+
return ee.auth.token;
|
|
6654
|
+
}, K = (ee) => {
|
|
6655
|
+
if (ee === null)
|
|
6645
6656
|
return !1;
|
|
6646
|
-
if (
|
|
6647
|
-
return
|
|
6648
|
-
const J = Date.parse(
|
|
6657
|
+
if (ee.auth.expiresAt === null)
|
|
6658
|
+
return ee.auth.token !== "";
|
|
6659
|
+
const J = Date.parse(ee.auth.expiresAt);
|
|
6649
6660
|
return Number.isNaN(J) ? !1 : J - Date.now() > i;
|
|
6650
|
-
}, ve = (
|
|
6651
|
-
if (de(),
|
|
6661
|
+
}, ve = (ee) => {
|
|
6662
|
+
if (de(), ee.auth.expiresAt === null)
|
|
6652
6663
|
return;
|
|
6653
|
-
const J = Date.parse(
|
|
6664
|
+
const J = Date.parse(ee.auth.expiresAt);
|
|
6654
6665
|
if (Number.isNaN(J))
|
|
6655
6666
|
return;
|
|
6656
6667
|
const he = Math.max(0, J - Date.now() - i);
|
|
6657
6668
|
M = setTimeout(() => {
|
|
6658
6669
|
U();
|
|
6659
6670
|
}, he);
|
|
6660
|
-
}, ce = async (
|
|
6671
|
+
}, ce = async (ee = !1) => e.getSourceToken && ie() === null || !ee && k === "account_suspended" ? null : !ee && K(u) ? u : !ee && p !== null ? await p : (p = (async () => {
|
|
6661
6672
|
try {
|
|
6662
6673
|
const he = await e.bootstrapClient.get(
|
|
6663
6674
|
n,
|
|
6664
|
-
|
|
6675
|
+
ee ? { params: { refresh: 1 } } : void 0
|
|
6665
6676
|
), we = Dc(he.data);
|
|
6666
6677
|
return $ = !1, u = we, ae("available"), ve(we), we;
|
|
6667
6678
|
} catch (he) {
|
|
@@ -6674,16 +6685,16 @@ function Fg(e) {
|
|
|
6674
6685
|
})().finally(() => {
|
|
6675
6686
|
p = null;
|
|
6676
6687
|
}), await p), U = async () => {
|
|
6677
|
-
const
|
|
6688
|
+
const ee = h !== null;
|
|
6678
6689
|
try {
|
|
6679
|
-
if (await ce(!0), !
|
|
6690
|
+
if (await ce(!0), !ee)
|
|
6680
6691
|
return;
|
|
6681
6692
|
E(!1), await ge(!0);
|
|
6682
6693
|
} catch (J) {
|
|
6683
6694
|
l.warn("Failed to refresh messenger bootstrap", J);
|
|
6684
6695
|
}
|
|
6685
|
-
}, H = (
|
|
6686
|
-
const J =
|
|
6696
|
+
}, H = (ee) => {
|
|
6697
|
+
const J = ee.connector?.pusher?.connection;
|
|
6687
6698
|
if (!J) {
|
|
6688
6699
|
l.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6689
6700
|
return;
|
|
@@ -6710,8 +6721,8 @@ function Fg(e) {
|
|
|
6710
6721
|
}
|
|
6711
6722
|
(we === "unavailable" || we === "failed" || we === "disconnected") && L("disconnected");
|
|
6712
6723
|
}), J.state === "connected" && L("connected");
|
|
6713
|
-
}, ge = async (
|
|
6714
|
-
const he = await ce(
|
|
6724
|
+
}, ge = async (ee = !1) => !ee && h !== null && K(u) ? h : !ee && w !== null ? await w : (w = (async () => {
|
|
6725
|
+
const he = await ce(ee);
|
|
6715
6726
|
if (he === null)
|
|
6716
6727
|
return null;
|
|
6717
6728
|
h !== null && E(!1);
|
|
@@ -6744,33 +6755,38 @@ function Fg(e) {
|
|
|
6744
6755
|
"X-Requested-With": "XMLHttpRequest"
|
|
6745
6756
|
}
|
|
6746
6757
|
});
|
|
6747
|
-
pe.interceptors.request.use(async (
|
|
6758
|
+
pe.interceptors.request.use(async (ee) => {
|
|
6748
6759
|
const J = await ce();
|
|
6749
6760
|
if (J === null)
|
|
6750
6761
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6751
|
-
return
|
|
6762
|
+
return ee.baseURL = J.service.apiBaseUrl, qi(ee, q(J)), ee;
|
|
6752
6763
|
}), pe.interceptors.response.use(
|
|
6753
|
-
(
|
|
6754
|
-
async (
|
|
6755
|
-
const J =
|
|
6756
|
-
if (
|
|
6764
|
+
(ee) => ee,
|
|
6765
|
+
async (ee) => {
|
|
6766
|
+
const J = ee.config;
|
|
6767
|
+
if (ee.response?.status === 401 && J && J._messengerRetry !== !0) {
|
|
6757
6768
|
J._messengerRetry = !0;
|
|
6758
6769
|
const he = await ce(!0);
|
|
6759
6770
|
if (he !== null)
|
|
6760
6771
|
return J.baseURL = he.service.apiBaseUrl, qi(J, q(he)), await pe(J);
|
|
6761
6772
|
}
|
|
6762
|
-
|
|
6773
|
+
if (ee.response?.status === 401) {
|
|
6774
|
+
if (J?._messengerSuppressAuthInvalidation === !0)
|
|
6775
|
+
return Promise.reject(ee);
|
|
6776
|
+
ne();
|
|
6777
|
+
}
|
|
6778
|
+
return Promise.reject(ee);
|
|
6763
6779
|
}
|
|
6764
6780
|
);
|
|
6765
|
-
const V = () => k === "account_suspended" ? null : h, G = (
|
|
6766
|
-
R.delete(
|
|
6767
|
-
}), P = (
|
|
6768
|
-
A.delete(
|
|
6769
|
-
}), v = () => u?.auth.tenantId ?? "global", f = (
|
|
6770
|
-
const J = Ps(
|
|
6781
|
+
const V = () => k === "account_suspended" ? null : h, G = (ee) => (R.add(ee), ee(y), () => {
|
|
6782
|
+
R.delete(ee);
|
|
6783
|
+
}), P = (ee) => (A.add(ee), ee(k), () => {
|
|
6784
|
+
A.delete(ee);
|
|
6785
|
+
}), v = () => u?.auth.tenantId ?? "global", f = (ee) => {
|
|
6786
|
+
const J = Ps(ee.ts)?.getTime() ?? Ps(ee.last_seen_at)?.getTime() ?? null;
|
|
6771
6787
|
if (J === null)
|
|
6772
6788
|
return !0;
|
|
6773
|
-
const he = `${
|
|
6789
|
+
const he = `${ee.tenant_scope ?? "global"}:${ee.user_id}`, we = I.get(he);
|
|
6774
6790
|
if (we && J < we.timestampMs)
|
|
6775
6791
|
return !1;
|
|
6776
6792
|
const Pe = Date.now();
|
|
@@ -6781,7 +6797,7 @@ function Fg(e) {
|
|
|
6781
6797
|
for (const [X, j] of I.entries())
|
|
6782
6798
|
Pe - j.seenAt > o && I.delete(X);
|
|
6783
6799
|
return !0;
|
|
6784
|
-
}, T = (
|
|
6800
|
+
}, T = (ee) => {
|
|
6785
6801
|
const J = V();
|
|
6786
6802
|
if (!J || typeof J.join != "function")
|
|
6787
6803
|
return;
|
|
@@ -6798,12 +6814,12 @@ function Fg(e) {
|
|
|
6798
6814
|
for (const Pe of we)
|
|
6799
6815
|
he.listen(Pe, (X) => {
|
|
6800
6816
|
const j = Bc(X, v());
|
|
6801
|
-
!j || !f(j) ||
|
|
6817
|
+
!j || !f(j) || ee(j);
|
|
6802
6818
|
});
|
|
6803
6819
|
}, re = () => {
|
|
6804
6820
|
h?.leave(`online-users.${v()}`);
|
|
6805
6821
|
};
|
|
6806
|
-
function Ce(
|
|
6822
|
+
function Ce(ee, J) {
|
|
6807
6823
|
const he = [];
|
|
6808
6824
|
function we(Pe, X, j) {
|
|
6809
6825
|
if (!j)
|
|
@@ -6811,19 +6827,19 @@ function Fg(e) {
|
|
|
6811
6827
|
const z = (Ie) => {
|
|
6812
6828
|
X(Ie) && j(Ie);
|
|
6813
6829
|
};
|
|
6814
|
-
|
|
6830
|
+
ee.bind(Pe, z), he.push({ event: Pe, handler: z });
|
|
6815
6831
|
}
|
|
6816
6832
|
return we("ConversationMessageSent", Vi, J.onMessageSent), we("ConversationMessageRead", Wi, J.onMessageRead), we("ConversationMessageEdited", Gi, J.onMessageEdited), we("ConversationMessageDeleted", Xi, J.onMessageDeleted), we("MessageReactionToggled", Ki, J.onReactionToggled), we("ConversationRequestAccepted", Yi, J.onRequestAccepted), we("ConversationParticipantRemoved", Ji, J.onParticipantRemoved), () => {
|
|
6817
6833
|
for (const Pe of he)
|
|
6818
|
-
|
|
6834
|
+
ee.unbind(Pe.event, Pe.handler);
|
|
6819
6835
|
};
|
|
6820
6836
|
}
|
|
6821
|
-
const Se = (
|
|
6837
|
+
const Se = (ee, J) => {
|
|
6822
6838
|
const he = V();
|
|
6823
6839
|
if (!he)
|
|
6824
6840
|
return () => {
|
|
6825
6841
|
};
|
|
6826
|
-
const we = he.private(`conversation.${
|
|
6842
|
+
const we = he.private(`conversation.${ee}`), Pe = we.subscription;
|
|
6827
6843
|
if (Pe)
|
|
6828
6844
|
return Ce(Pe, J);
|
|
6829
6845
|
const X = [];
|
|
@@ -6853,18 +6869,18 @@ function Fg(e) {
|
|
|
6853
6869
|
for (const j of X)
|
|
6854
6870
|
we.stopListening(j.event, j.handler);
|
|
6855
6871
|
};
|
|
6856
|
-
}, ye = (
|
|
6857
|
-
h?.leave(`conversation.${
|
|
6858
|
-
}, ft = (
|
|
6872
|
+
}, ye = (ee) => {
|
|
6873
|
+
h?.leave(`conversation.${ee}`);
|
|
6874
|
+
}, ft = (ee, J, he) => {
|
|
6859
6875
|
if (J.subscription)
|
|
6860
6876
|
return J.subscription;
|
|
6861
|
-
const we =
|
|
6877
|
+
const we = ee.connector?.pusher;
|
|
6862
6878
|
if (!we || typeof we.channel != "function")
|
|
6863
6879
|
return null;
|
|
6864
6880
|
const Pe = he.startsWith("private-") ? he : `private-${he}`;
|
|
6865
6881
|
return we.channel(Pe) ?? null;
|
|
6866
|
-
}, nt = (
|
|
6867
|
-
const we = `typing-conversation.${J}`, Pe =
|
|
6882
|
+
}, nt = (ee, J, he) => {
|
|
6883
|
+
const we = `typing-conversation.${J}`, Pe = ee.private(we), X = /* @__PURE__ */ new Set(["start", "typing"]), j = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), z = ft(ee, Pe, we);
|
|
6868
6884
|
if (z) {
|
|
6869
6885
|
const _e = (Re) => {
|
|
6870
6886
|
const Te = Hi(Re);
|
|
@@ -6919,13 +6935,13 @@ function Fg(e) {
|
|
|
6919
6935
|
for (const _e of Ie)
|
|
6920
6936
|
Pe.stopListening(_e.event, _e.handler);
|
|
6921
6937
|
};
|
|
6922
|
-
}, Ye = (
|
|
6938
|
+
}, Ye = (ee, J) => {
|
|
6923
6939
|
const he = V();
|
|
6924
6940
|
if (he)
|
|
6925
|
-
return nt(he,
|
|
6941
|
+
return nt(he, ee, J);
|
|
6926
6942
|
let we = !1, Pe = null;
|
|
6927
6943
|
const X = (z) => {
|
|
6928
|
-
we || z && (Pe = nt(z,
|
|
6944
|
+
we || z && (Pe = nt(z, ee, J), typeof window < "u" && window.removeEventListener(t, j));
|
|
6929
6945
|
}, j = () => {
|
|
6930
6946
|
X(V());
|
|
6931
6947
|
};
|
|
@@ -6934,8 +6950,8 @@ function Fg(e) {
|
|
|
6934
6950
|
}), () => {
|
|
6935
6951
|
we = !0, typeof window < "u" && window.removeEventListener(t, j), Pe?.();
|
|
6936
6952
|
};
|
|
6937
|
-
}, mt = (
|
|
6938
|
-
h?.leave(`typing-conversation.${
|
|
6953
|
+
}, mt = (ee) => {
|
|
6954
|
+
h?.leave(`typing-conversation.${ee}`);
|
|
6939
6955
|
}, dt = async () => {
|
|
6940
6956
|
ae("available"), E(), await ge(!0);
|
|
6941
6957
|
}, Ze = async () => k === "account_suspended" ? null : await ge();
|
|
@@ -8333,7 +8349,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8333
8349
|
}), mt = C(() => {
|
|
8334
8350
|
const S = Kn(n.message.created_at);
|
|
8335
8351
|
return cn(S, "EEEE, MMM d, yyyy h:mm a");
|
|
8336
|
-
}), dt = C(() => x.value && !n.isLastInGroup && !n.message.is_deleted), Ze = C(() => n.message.id.startsWith("temp-") ? "sending" : n.isReadByOther ? "read" : "sent"),
|
|
8352
|
+
}), dt = C(() => x.value && !n.isLastInGroup && !n.message.is_deleted), Ze = C(() => n.message.id.startsWith("temp-") ? "sending" : n.isReadByOther ? "read" : "sent"), ee = C(() => {
|
|
8337
8353
|
if (!n.isOwnMessage || n.message.is_deleted) return !1;
|
|
8338
8354
|
const S = Date.now() - new Date(n.message.created_at).getTime(), Z = 900 * 1e3;
|
|
8339
8355
|
return S < Z;
|
|
@@ -8404,14 +8420,14 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8404
8420
|
clearTimeout(O);
|
|
8405
8421
|
}, se = () => {
|
|
8406
8422
|
ie = null, q = 0, K = 0;
|
|
8407
|
-
},
|
|
8423
|
+
}, te = (S, Z, Ae) => {
|
|
8408
8424
|
ue(), ie = Ae, q = S, K = Z, O = setTimeout(() => {
|
|
8409
8425
|
se(), ve = !0, me();
|
|
8410
8426
|
}, Yd);
|
|
8411
8427
|
}, je = () => {
|
|
8412
8428
|
ue(), se();
|
|
8413
8429
|
}, Qe = (S, Z) => Math.hypot(S - q, Z - K) > Jd, st = (S) => {
|
|
8414
|
-
S.pointerType === "mouse" || jt(S.target) ||
|
|
8430
|
+
S.pointerType === "mouse" || jt(S.target) || te(S.clientX, S.clientY, S.pointerId);
|
|
8415
8431
|
}, $t = (S) => {
|
|
8416
8432
|
S.pointerId === ie && Qe(S.clientX, S.clientY) && je();
|
|
8417
8433
|
}, Rt = (S) => {
|
|
@@ -8532,7 +8548,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8532
8548
|
se();
|
|
8533
8549
|
return;
|
|
8534
8550
|
}
|
|
8535
|
-
|
|
8551
|
+
te(Z.clientX, Z.clientY, null);
|
|
8536
8552
|
}, os = (S) => {
|
|
8537
8553
|
if (S.touches.length !== 1) {
|
|
8538
8554
|
je();
|
|
@@ -8605,7 +8621,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8605
8621
|
handler: () => {
|
|
8606
8622
|
Xt();
|
|
8607
8623
|
}
|
|
8608
|
-
}),
|
|
8624
|
+
}), ee.value && S.push({
|
|
8609
8625
|
text: "Edit",
|
|
8610
8626
|
icon: "createOutline",
|
|
8611
8627
|
handler: () => {
|
|
@@ -9030,7 +9046,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9030
9046
|
class: "w-3.5 h-3.5"
|
|
9031
9047
|
})
|
|
9032
9048
|
], 8, jd)),
|
|
9033
|
-
|
|
9049
|
+
ee.value ? (m(), b("button", {
|
|
9034
9050
|
key: 2,
|
|
9035
9051
|
type: "button",
|
|
9036
9052
|
class: "msg-action-btn",
|
|
@@ -9457,13 +9473,13 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9457
9473
|
U = null, ne.value = !1;
|
|
9458
9474
|
}, 260));
|
|
9459
9475
|
}), We(() => i.disabled, (_) => {
|
|
9460
|
-
_ && (Ge(),
|
|
9476
|
+
_ && (Ge(), ee());
|
|
9461
9477
|
}), We(() => i.replyToMessage, async (_, B) => {
|
|
9462
9478
|
_ !== B && (dt(), !(_ === null || i.disabled || R.value) && (Ge(), await X()));
|
|
9463
9479
|
});
|
|
9464
9480
|
const dt = () => {
|
|
9465
9481
|
L.value = !1, ae.value = "";
|
|
9466
|
-
}, Ze = (_) => _ === null ? !1 : Array.from(_.types).includes("Files"),
|
|
9482
|
+
}, Ze = (_) => _ === null ? !1 : Array.from(_.types).includes("Files"), ee = () => {
|
|
9467
9483
|
H = 0, O.value = !1;
|
|
9468
9484
|
}, J = (_) => {
|
|
9469
9485
|
const B = _.target;
|
|
@@ -9536,12 +9552,12 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9536
9552
|
Ze(_.dataTransfer) && (_.preventDefault(), H = Math.max(0, H - 1), H === 0 && (O.value = !1));
|
|
9537
9553
|
}, zt = async (_) => {
|
|
9538
9554
|
if (i.disabled || R.value || !Ze(_.dataTransfer)) {
|
|
9539
|
-
|
|
9555
|
+
ee();
|
|
9540
9556
|
return;
|
|
9541
9557
|
}
|
|
9542
9558
|
_.preventDefault();
|
|
9543
9559
|
const B = Array.from(_.dataTransfer?.files ?? []);
|
|
9544
|
-
|
|
9560
|
+
ee(), B.length !== 0 && await Pt(B);
|
|
9545
9561
|
}, Ge = () => {
|
|
9546
9562
|
I.value = !1;
|
|
9547
9563
|
}, pt = C(() => {
|
|
@@ -9596,7 +9612,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9596
9612
|
attributeFilter: ["class", "style", "aria-hidden", "hidden"]
|
|
9597
9613
|
}));
|
|
9598
9614
|
}), Us(() => {
|
|
9599
|
-
v(), Ge(), ge(), G(),
|
|
9615
|
+
v(), Ge(), ge(), G(), ee(), p.value?.removeEventListener("dragenter", _e), p.value?.removeEventListener("dragover", Re), p.value?.removeEventListener("dragleave", Te), p.value?.removeEventListener("drop", zt), st && (st.dismiss().catch(() => {
|
|
9600
9616
|
}), st = null), document.removeEventListener("pointerdown", qe, !0), document.removeEventListener("mousedown", qe, !0), document.removeEventListener("touchstart", qe, !0), document.removeEventListener("click", qe, !0), document.removeEventListener("keydown", wt), he?.removeEventListener("input", Ie), he?.removeEventListener("paste", Ne), kt?.disconnect(), kt = null, he = null, q.cleanup();
|
|
9601
9617
|
});
|
|
9602
9618
|
const xt = (_) => {
|
|
@@ -9626,7 +9642,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9626
9642
|
_ - ve > Oh && (l("typing"), ve = _), P(), K = setTimeout(() => {
|
|
9627
9643
|
K = null, l("stop-typing");
|
|
9628
9644
|
}, Dh);
|
|
9629
|
-
},
|
|
9645
|
+
}, te = () => {
|
|
9630
9646
|
R.value || i.disabled || (z(), re.value ? je() : (M.value = "👍", ct(() => {
|
|
9631
9647
|
je();
|
|
9632
9648
|
})));
|
|
@@ -9840,7 +9856,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9840
9856
|
class: "send-failed-retry-btn",
|
|
9841
9857
|
"data-testid": "btn-retry-send",
|
|
9842
9858
|
"aria-label": "Retry sending message",
|
|
9843
|
-
onClick:
|
|
9859
|
+
onClick: te
|
|
9844
9860
|
}, " Retry "),
|
|
9845
9861
|
c("button", {
|
|
9846
9862
|
type: "button",
|
|
@@ -9955,7 +9971,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9955
9971
|
disabled: R.value || e.disabled,
|
|
9956
9972
|
"data-testid": Ye.value,
|
|
9957
9973
|
"aria-label": re.value ? "Send message" : R.value ? "Uploading..." : "Send a like",
|
|
9958
|
-
onClick:
|
|
9974
|
+
onClick: te
|
|
9959
9975
|
}, [
|
|
9960
9976
|
$e(He, {
|
|
9961
9977
|
name: Se.value,
|
|
@@ -10132,7 +10148,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10132
10148
|
}
|
|
10133
10149
|
return be;
|
|
10134
10150
|
}), mt = C(() => n.hasMoreMessages(t.conversationId)), dt = C(() => n.typingUsers[t.conversationId] ?? []), Ze = C(() => o.currentUser?.id), {
|
|
10135
|
-
clearVisibleTypingUsers:
|
|
10151
|
+
clearVisibleTypingUsers: ee,
|
|
10136
10152
|
hasVisibleTypingUsers: J,
|
|
10137
10153
|
visibleTypingUsers: he
|
|
10138
10154
|
} = Ql({
|
|
@@ -10315,17 +10331,17 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10315
10331
|
} : null;
|
|
10316
10332
|
_ && ($.value = null);
|
|
10317
10333
|
try {
|
|
10318
|
-
await n.sendMessage(t.conversationId, be, le, B, me), M.value = "",
|
|
10334
|
+
await n.sendMessage(t.conversationId, be, le, B, me), M.value = "", te(), await ct(), kt(!0), lt();
|
|
10319
10335
|
} catch (Ee) {
|
|
10320
10336
|
throw _ && ($.value = _), Ee;
|
|
10321
10337
|
}
|
|
10322
10338
|
}
|
|
10323
10339
|
function se() {
|
|
10324
10340
|
K || (K = !0, n.sendTyping(t.conversationId, "start")), q && clearTimeout(q), q = setTimeout(() => {
|
|
10325
|
-
|
|
10341
|
+
te();
|
|
10326
10342
|
}, 3e3);
|
|
10327
10343
|
}
|
|
10328
|
-
function
|
|
10344
|
+
function te() {
|
|
10329
10345
|
q && (clearTimeout(q), q = null), K && (n.sendTyping(t.conversationId, "stop"), K = !1);
|
|
10330
10346
|
}
|
|
10331
10347
|
async function je() {
|
|
@@ -10452,7 +10468,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10452
10468
|
), Yt(() => {
|
|
10453
10469
|
Array.isArray(n.messages[t.conversationId]) && X(), l(), u(), Be(), _e.setupInfiniteObserver(), t.minimized || lt();
|
|
10454
10470
|
}), Nt(() => {
|
|
10455
|
-
|
|
10471
|
+
ee(), ae.value = [], te(), p(), _e.destroyInfiniteObserver(), U.cleanup();
|
|
10456
10472
|
}), (D, le) => (m(), b("div", {
|
|
10457
10473
|
class: xe(["chat-window", {
|
|
10458
10474
|
"chat-window--minimized": e.minimized
|
|
@@ -10715,7 +10731,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10715
10731
|
"on-send": ue,
|
|
10716
10732
|
"on-cancel-reply": Pt,
|
|
10717
10733
|
onTyping: se,
|
|
10718
|
-
onStopTyping:
|
|
10734
|
+
onStopTyping: te
|
|
10719
10735
|
}, null, 8, ["message", "conversation-id", "input-test-id", "attach-button-test-id", "send-button-test-id", "reply-to-message", "participant-names"])
|
|
10720
10736
|
], 512)
|
|
10721
10737
|
], 64))
|
|
@@ -11409,7 +11425,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
11409
11425
|
oe ? "Unpin conversation" : "Pin conversation"
|
|
11410
11426
|
),
|
|
11411
11427
|
handler: () => {
|
|
11412
|
-
|
|
11428
|
+
ee();
|
|
11413
11429
|
}
|
|
11414
11430
|
},
|
|
11415
11431
|
{
|
|
@@ -11570,7 +11586,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
11570
11586
|
cssClass: "conversation-folder-sheet"
|
|
11571
11587
|
});
|
|
11572
11588
|
Ce(ke), ye(q), await ke.present();
|
|
11573
|
-
},
|
|
11589
|
+
}, ee = async () => {
|
|
11574
11590
|
try {
|
|
11575
11591
|
await o.pinConversation(n.conversation.id, !n.conversation.is_pinned);
|
|
11576
11592
|
} catch {
|
|
@@ -11755,7 +11771,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
11755
11771
|
}, ue = C(() => {
|
|
11756
11772
|
const F = zt.value;
|
|
11757
11773
|
return At[jt(F) % At.length] ?? rr;
|
|
11758
|
-
}), se = (F) => At[jt(F) % At.length] ?? rr,
|
|
11774
|
+
}), se = (F) => At[jt(F) % At.length] ?? rr, te = C(() => (n.conversation.participants ?? []).filter((oe) => oe.user_id !== u.value?.id).slice(0, 2)), je = C(() => o.getTypingUsers(n.conversation.id)), Qe = C(() => st(je.value)), st = (F) => {
|
|
11759
11775
|
if (F.length === 1) {
|
|
11760
11776
|
const oe = F.at(0)?.name;
|
|
11761
11777
|
return oe ? `${oe} is typing...` : "Someone is typing...";
|
|
@@ -11840,7 +11856,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
11840
11856
|
style: at({ backgroundColor: ue.value })
|
|
11841
11857
|
}, Q(xt.value), 5))
|
|
11842
11858
|
], 64)) : (m(), b("div", Jf, [
|
|
11843
|
-
(m(!0), b(ze, null, ut(
|
|
11859
|
+
(m(!0), b(ze, null, ut(te.value, (ke, Le) => (m(), b(ze, {
|
|
11844
11860
|
key: ke.user_id
|
|
11845
11861
|
}, [
|
|
11846
11862
|
ke.user?.avatar ? (m(), b("img", {
|
|
@@ -12173,8 +12189,8 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12173
12189
|
try {
|
|
12174
12190
|
const se = await Fe().get("/v1/presence/users", {
|
|
12175
12191
|
params: { ids: ue }
|
|
12176
|
-
}),
|
|
12177
|
-
for (const Qe of
|
|
12192
|
+
}), te = se.data?.data?.items ?? se.data?.items ?? [], je = {};
|
|
12193
|
+
for (const Qe of te) {
|
|
12178
12194
|
const st = Zn(Qe);
|
|
12179
12195
|
je[Qe.id] = {
|
|
12180
12196
|
status: st.status ?? "offline",
|
|
@@ -12221,15 +12237,15 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12221
12237
|
const se = ue.user?.handle?.trim();
|
|
12222
12238
|
if (se)
|
|
12223
12239
|
return se;
|
|
12224
|
-
const
|
|
12225
|
-
return
|
|
12240
|
+
const te = ue.user?.id ?? ue.user_id;
|
|
12241
|
+
return te.trim().length > 0 ? te : null;
|
|
12226
12242
|
}), U = C(() => `View ${ve.value?.user?.name ?? "user"}'s profile`), H = C(() => h.value ? n.conversation?.title || "Group Chat" : ve.value?.user?.name || "Unknown User"), ge = async () => {
|
|
12227
12243
|
const ue = ce.value;
|
|
12228
12244
|
ue && (i("close"), await u.push(`/profile/${ue}`));
|
|
12229
12245
|
}, pe = async (ue) => {
|
|
12230
|
-
const
|
|
12231
|
-
!
|
|
12232
|
-
}, V = C(() => [...w.value].sort((se,
|
|
12246
|
+
const te = ue.user?.handle?.trim() || ue.user?.id || ue.user_id;
|
|
12247
|
+
!te || te.trim().length === 0 || (i("close"), await u.push(`/profile/${te}`));
|
|
12248
|
+
}, V = C(() => [...w.value].sort((se, te) => se.user_id === p.value ? -1 : te.user_id === p.value ? 1 : se.role === "admin" && te.role !== "admin" ? -1 : se.role !== "admin" && te.role === "admin" ? 1 : (se.user?.name ?? "").localeCompare(te.user?.name ?? ""))), G = N(null), P = N(null), v = N(""), f = C(() => G.value === "remove-member" ? "Remove Member" : G.value === "delete-conversation" ? "Delete Conversation" : "Leave Group"), T = C(() => G.value === "remove-member" ? `Remove ${v.value || "this member"} from the group?` : G.value === "delete-conversation" ? "Delete this conversation from your inbox? This action cannot be undone." : "Are you sure you want to leave this group? You won't be able to see its messages anymore."), re = C(() => G.value === "remove-member" ? "Remove" : G.value === "delete-conversation" ? "Delete" : "Leave"), Ce = C(() => G.value === "remove-member" ? `Confirm removal of ${v.value || "member"}` : G.value === "delete-conversation" ? "Confirm deleting conversation" : "Confirm leaving group"), Se = () => {
|
|
12233
12249
|
G.value = null, P.value = null, v.value = "";
|
|
12234
12250
|
}, ye = () => {
|
|
12235
12251
|
if (G.value === "remove-member" && P.value) {
|
|
@@ -12265,8 +12281,8 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12265
12281
|
"#6366f1"
|
|
12266
12282
|
], nt = (ue) => {
|
|
12267
12283
|
let se = 0;
|
|
12268
|
-
for (let
|
|
12269
|
-
const je = ue.charCodeAt(
|
|
12284
|
+
for (let te = 0; te < ue.length; te++) {
|
|
12285
|
+
const je = ue.charCodeAt(te);
|
|
12270
12286
|
se = (se << 5) - se + je, se |= 0;
|
|
12271
12287
|
}
|
|
12272
12288
|
return Math.abs(se);
|
|
@@ -12276,19 +12292,19 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12276
12292
|
return se.length >= 2 ? ((se[0]?.[0] ?? "") + (se[se.length - 1]?.[0] ?? "")).toUpperCase() : ue.substring(0, 2).toUpperCase();
|
|
12277
12293
|
}, dt = C(
|
|
12278
12294
|
() => w.value.filter((ue) => ue.user_id !== p.value).slice(0, 3)
|
|
12279
|
-
), Ze = (ue) => ["cim-avatar--first", "cim-avatar--second", "cim-avatar--third"][ue] ?? "",
|
|
12280
|
-
J.value = n.conversation?.title ?? "",
|
|
12295
|
+
), Ze = (ue) => ["cim-avatar--first", "cim-avatar--second", "cim-avatar--third"][ue] ?? "", ee = N(!1), J = N(""), he = N(null), we = () => {
|
|
12296
|
+
J.value = n.conversation?.title ?? "", ee.value = !0, ct(() => {
|
|
12281
12297
|
he.value?.focus(), he.value?.select();
|
|
12282
12298
|
});
|
|
12283
12299
|
}, Pe = () => {
|
|
12284
|
-
|
|
12300
|
+
ee.value = !1;
|
|
12285
12301
|
}, X = async () => {
|
|
12286
12302
|
if (!(!n.conversation || !J.value.trim()))
|
|
12287
12303
|
try {
|
|
12288
12304
|
await o.updateConversationTitle(
|
|
12289
12305
|
n.conversation.id,
|
|
12290
12306
|
J.value.trim()
|
|
12291
|
-
),
|
|
12307
|
+
), ee.value = !1, et("Group name updated", "success");
|
|
12292
12308
|
} catch {
|
|
12293
12309
|
et("Failed to update group name", "error");
|
|
12294
12310
|
}
|
|
@@ -12343,10 +12359,10 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12343
12359
|
});
|
|
12344
12360
|
const Ct = async (ue) => {
|
|
12345
12361
|
try {
|
|
12346
|
-
const
|
|
12362
|
+
const te = (await Fe().get("/v1/search", {
|
|
12347
12363
|
params: { q: ue, type: "user", limit: 20 }
|
|
12348
12364
|
})).data?.data ?? [], je = new Set(w.value.map((Qe) => Qe.user_id));
|
|
12349
|
-
Mt.value =
|
|
12365
|
+
Mt.value = te.map((Qe) => {
|
|
12350
12366
|
const st = Qe.id || "", $t = Qe.doc && !Array.isArray(Qe.doc) ? Qe.doc : null, Rt = Qe.author_name || $t?.name || "Unknown", Pt = Qe.author_handle || $t?.handle, qt = Qe.author_avatar || $t?.avatar, F = { id: st, name: Rt };
|
|
12351
12367
|
return Pt && (F.handle = Pt), qt && (F.avatar = qt), F;
|
|
12352
12368
|
}).filter((Qe) => !je.has(Qe.id) && Qe.id !== p.value);
|
|
@@ -12356,7 +12372,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12356
12372
|
Ut.value = !1;
|
|
12357
12373
|
}
|
|
12358
12374
|
}, kt = (ue) => {
|
|
12359
|
-
const se = qe.value.findIndex((
|
|
12375
|
+
const se = qe.value.findIndex((te) => te.id === ue.id);
|
|
12360
12376
|
se >= 0 ? qe.value.splice(se, 1) : qe.value.push(ue);
|
|
12361
12377
|
}, xt = (ue) => {
|
|
12362
12378
|
qe.value = qe.value.filter((se) => se.id !== ue);
|
|
@@ -12380,7 +12396,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12380
12396
|
}), We(() => n.isOpen, (ue) => {
|
|
12381
12397
|
ue ? (A(), I(), $(), M = setInterval(() => {
|
|
12382
12398
|
I();
|
|
12383
|
-
}, Up)) : (R(), $(),
|
|
12399
|
+
}, Up)) : (R(), $(), ee.value = !1, Ge.value = !1, Se(), pt.value = "", Mt.value = [], qe.value = [], y.value = {});
|
|
12384
12400
|
}, { immediate: !0 }), (ue, se) => (m(), b(ze, null, [
|
|
12385
12401
|
$e(hn, {
|
|
12386
12402
|
"model-value": e.isOpen,
|
|
@@ -12390,27 +12406,27 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12390
12406
|
"show-cancel": !1,
|
|
12391
12407
|
"data-test-id": "modal-conversation-info",
|
|
12392
12408
|
class: "conversation-info-modal",
|
|
12393
|
-
"onUpdate:modelValue": se[2] || (se[2] = (
|
|
12394
|
-
|
|
12409
|
+
"onUpdate:modelValue": se[2] || (se[2] = (te) => {
|
|
12410
|
+
te || ue.$emit("close");
|
|
12395
12411
|
}),
|
|
12396
|
-
onClose: se[3] || (se[3] = (
|
|
12412
|
+
onClose: se[3] || (se[3] = (te) => ue.$emit("close"))
|
|
12397
12413
|
}, {
|
|
12398
12414
|
body: rt(() => [
|
|
12399
12415
|
c("div", Im, [
|
|
12400
12416
|
h.value ? (m(), b("div", Lm, [
|
|
12401
|
-
(m(!0), b(ze, null, ut(dt.value, (
|
|
12402
|
-
key:
|
|
12417
|
+
(m(!0), b(ze, null, ut(dt.value, (te, je) => (m(), b(ze, {
|
|
12418
|
+
key: te.user_id
|
|
12403
12419
|
}, [
|
|
12404
|
-
|
|
12420
|
+
te.user?.avatar ? (m(), b("img", {
|
|
12405
12421
|
key: 0,
|
|
12406
|
-
src:
|
|
12407
|
-
alt:
|
|
12422
|
+
src: te.user.avatar,
|
|
12423
|
+
alt: te.user.name || "User",
|
|
12408
12424
|
class: xe(["cim-profile__avatar-img", Ze(je)])
|
|
12409
12425
|
}, null, 10, Om)) : (m(), b("div", {
|
|
12410
12426
|
key: 1,
|
|
12411
12427
|
class: xe(["cim-profile__avatar-initials", Ze(je)]),
|
|
12412
|
-
style: at({ backgroundColor: Ye(
|
|
12413
|
-
}, Q(mt(
|
|
12428
|
+
style: at({ backgroundColor: Ye(te.user_id) })
|
|
12429
|
+
}, Q(mt(te.user?.name)), 7))
|
|
12414
12430
|
], 64))), 128))
|
|
12415
12431
|
])) : (m(), b("div", Dm, [
|
|
12416
12432
|
ve.value?.user?.avatar ? (m(), b("img", {
|
|
@@ -12425,11 +12441,11 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12425
12441
|
}, Q(mt(ve.value?.user?.name)), 5))
|
|
12426
12442
|
])),
|
|
12427
12443
|
c("div", Fm, [
|
|
12428
|
-
h.value &&
|
|
12444
|
+
h.value && ee.value ? (m(), b(ze, { key: 0 }, [
|
|
12429
12445
|
un(c("input", {
|
|
12430
12446
|
ref_key: "titleInput",
|
|
12431
12447
|
ref: he,
|
|
12432
|
-
"onUpdate:modelValue": se[0] || (se[0] = (
|
|
12448
|
+
"onUpdate:modelValue": se[0] || (se[0] = (te) => J.value = te),
|
|
12433
12449
|
class: "cim-profile__name-input",
|
|
12434
12450
|
"data-testid": "input-edit-group-title",
|
|
12435
12451
|
"aria-label": "Edit group name",
|
|
@@ -12502,7 +12518,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12502
12518
|
class: "cim-add-btn",
|
|
12503
12519
|
"data-testid": "btn-add-members",
|
|
12504
12520
|
"aria-label": "Add members",
|
|
12505
|
-
onClick: se[1] || (se[1] = (
|
|
12521
|
+
onClick: se[1] || (se[1] = (te) => Ge.value = !0)
|
|
12506
12522
|
}, [...se[9] || (se[9] = [
|
|
12507
12523
|
c("svg", {
|
|
12508
12524
|
width: "16",
|
|
@@ -12536,51 +12552,51 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12536
12552
|
])])) : Y("", !0)
|
|
12537
12553
|
]),
|
|
12538
12554
|
c("div", Xm, [
|
|
12539
|
-
(m(!0), b(ze, null, ut(V.value, (
|
|
12540
|
-
key:
|
|
12541
|
-
class: xe(["cim-member", { "cim-member--clickable":
|
|
12542
|
-
"data-testid": `member-${
|
|
12543
|
-
role:
|
|
12544
|
-
tabindex:
|
|
12545
|
-
"aria-label":
|
|
12546
|
-
onClick: (je) =>
|
|
12555
|
+
(m(!0), b(ze, null, ut(V.value, (te) => (m(), b("div", {
|
|
12556
|
+
key: te.user_id,
|
|
12557
|
+
class: xe(["cim-member", { "cim-member--clickable": te.user_id !== p.value }]),
|
|
12558
|
+
"data-testid": `member-${te.user_id}`,
|
|
12559
|
+
role: te.user_id !== p.value ? "button" : void 0,
|
|
12560
|
+
tabindex: te.user_id !== p.value ? 0 : void 0,
|
|
12561
|
+
"aria-label": te.user_id !== p.value ? `View ${te.user?.name || "member"}'s profile` : void 0,
|
|
12562
|
+
onClick: (je) => te.user_id !== p.value ? pe(te) : void 0,
|
|
12547
12563
|
onKeydown: [
|
|
12548
|
-
Dt((je) =>
|
|
12549
|
-
Dt(Ve((je) =>
|
|
12564
|
+
Dt((je) => te.user_id !== p.value ? pe(te) : void 0, ["enter"]),
|
|
12565
|
+
Dt(Ve((je) => te.user_id !== p.value ? pe(te) : void 0, ["prevent"]), ["space"])
|
|
12550
12566
|
]
|
|
12551
12567
|
}, [
|
|
12552
12568
|
c("div", Ym, [
|
|
12553
|
-
|
|
12569
|
+
te.user?.avatar ? (m(), b("img", {
|
|
12554
12570
|
key: 0,
|
|
12555
|
-
src:
|
|
12556
|
-
alt:
|
|
12571
|
+
src: te.user.avatar,
|
|
12572
|
+
alt: te.user.name || "User",
|
|
12557
12573
|
class: "cim-member__avatar-img"
|
|
12558
12574
|
}, null, 8, Jm)) : (m(), b("div", {
|
|
12559
12575
|
key: 1,
|
|
12560
12576
|
class: "cim-member__avatar-initials",
|
|
12561
|
-
style: at({ backgroundColor: Ye(
|
|
12562
|
-
}, Q(mt(
|
|
12563
|
-
L(
|
|
12577
|
+
style: at({ backgroundColor: Ye(te.user_id) })
|
|
12578
|
+
}, Q(mt(te.user?.name)), 5)),
|
|
12579
|
+
L(te.user_id) !== "offline" ? (m(), b("span", {
|
|
12564
12580
|
key: 2,
|
|
12565
|
-
class: xe(["cim-member__presence", `cim-member__presence--${L(
|
|
12566
|
-
"data-testid": `presence-${
|
|
12567
|
-
"aria-label": de(
|
|
12581
|
+
class: xe(["cim-member__presence", `cim-member__presence--${L(te.user_id)}`]),
|
|
12582
|
+
"data-testid": `presence-${te.user_id}`,
|
|
12583
|
+
"aria-label": de(te.user_id)
|
|
12568
12584
|
}, null, 10, Zm)) : Y("", !0)
|
|
12569
12585
|
]),
|
|
12570
12586
|
c("div", Qm, [
|
|
12571
12587
|
c("div", ep, [
|
|
12572
|
-
c("span", tp, Q(
|
|
12573
|
-
|
|
12574
|
-
|
|
12588
|
+
c("span", tp, Q(te.user?.name || "Unknown User"), 1),
|
|
12589
|
+
te.user_id === p.value ? (m(), b("span", np, " You ")) : Y("", !0),
|
|
12590
|
+
te.role === "admin" ? (m(), b("span", sp, " Admin ")) : Y("", !0)
|
|
12575
12591
|
]),
|
|
12576
|
-
|
|
12592
|
+
te.user?.handle ? (m(), b("span", ip, " @" + Q(te.user.handle), 1)) : Y("", !0)
|
|
12577
12593
|
]),
|
|
12578
|
-
K.value &&
|
|
12594
|
+
K.value && te.user_id !== p.value ? (m(), b("button", {
|
|
12579
12595
|
key: 0,
|
|
12580
12596
|
class: "cim-remove-btn",
|
|
12581
|
-
"data-testid": n.isOpen ? `btn-remove-member-${
|
|
12582
|
-
"aria-label": `Remove ${
|
|
12583
|
-
onClick: (je) => j(
|
|
12597
|
+
"data-testid": n.isOpen ? `btn-remove-member-${te.user_id}` : void 0,
|
|
12598
|
+
"aria-label": `Remove ${te.user?.name || "member"}`,
|
|
12599
|
+
onClick: (je) => j(te)
|
|
12584
12600
|
}, [...se[11] || (se[11] = [
|
|
12585
12601
|
c("svg", {
|
|
12586
12602
|
width: "16",
|
|
@@ -12701,13 +12717,13 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12701
12717
|
}, 8, ["model-value", "title"]),
|
|
12702
12718
|
$e(hn, {
|
|
12703
12719
|
modelValue: Ge.value,
|
|
12704
|
-
"onUpdate:modelValue": se[6] || (se[6] = (
|
|
12720
|
+
"onUpdate:modelValue": se[6] || (se[6] = (te) => Ge.value = te),
|
|
12705
12721
|
title: "Add Members",
|
|
12706
12722
|
size: "md",
|
|
12707
12723
|
"show-confirm": !1,
|
|
12708
12724
|
"show-cancel": !1,
|
|
12709
12725
|
"data-test-id": "modal-add-members",
|
|
12710
|
-
onClose: se[7] || (se[7] = (
|
|
12726
|
+
onClose: se[7] || (se[7] = (te) => Ge.value = !1)
|
|
12711
12727
|
}, {
|
|
12712
12728
|
header: rt(() => [
|
|
12713
12729
|
c("div", wp, [
|
|
@@ -12715,7 +12731,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12715
12731
|
class: "cim-header__close",
|
|
12716
12732
|
"data-testid": "btn-close-add-members",
|
|
12717
12733
|
"aria-label": "Close add members",
|
|
12718
|
-
onClick: se[4] || (se[4] = (
|
|
12734
|
+
onClick: se[4] || (se[4] = (te) => Ge.value = !1)
|
|
12719
12735
|
}, [...se[16] || (se[16] = [
|
|
12720
12736
|
c("svg", {
|
|
12721
12737
|
width: "20",
|
|
@@ -12742,7 +12758,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12742
12758
|
body: rt(() => [
|
|
12743
12759
|
c("div", kp, [
|
|
12744
12760
|
un(c("input", {
|
|
12745
|
-
"onUpdate:modelValue": se[5] || (se[5] = (
|
|
12761
|
+
"onUpdate:modelValue": se[5] || (se[5] = (te) => pt.value = te),
|
|
12746
12762
|
type: "text",
|
|
12747
12763
|
class: "cim-search__input",
|
|
12748
12764
|
placeholder: "Search users...",
|
|
@@ -12753,14 +12769,14 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12753
12769
|
])
|
|
12754
12770
|
]),
|
|
12755
12771
|
qe.value.length > 0 ? (m(), b("div", Sp, [
|
|
12756
|
-
(m(!0), b(ze, null, ut(qe.value, (
|
|
12757
|
-
key:
|
|
12772
|
+
(m(!0), b(ze, null, ut(qe.value, (te) => (m(), b("button", {
|
|
12773
|
+
key: te.id,
|
|
12758
12774
|
class: "cim-chip",
|
|
12759
|
-
"data-testid": `chip-new-member-${
|
|
12760
|
-
"aria-label": `Remove ${
|
|
12761
|
-
onClick: (je) => xt(
|
|
12775
|
+
"data-testid": `chip-new-member-${te.id}`,
|
|
12776
|
+
"aria-label": `Remove ${te.name}`,
|
|
12777
|
+
onClick: (je) => xt(te.id)
|
|
12762
12778
|
}, [
|
|
12763
|
-
yt(Q(
|
|
12779
|
+
yt(Q(te.name) + " ", 1),
|
|
12764
12780
|
se[18] || (se[18] = c("svg", {
|
|
12765
12781
|
width: "12",
|
|
12766
12782
|
height: "12",
|
|
@@ -12775,30 +12791,30 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12775
12791
|
], 8, Tp))), 128))
|
|
12776
12792
|
])) : Y("", !0),
|
|
12777
12793
|
Ut.value ? (m(), b("div", Mp, " Searching... ")) : Mt.value.length > 0 ? (m(), b("div", xp, [
|
|
12778
|
-
(m(!0), b(ze, null, ut(Mt.value, (
|
|
12779
|
-
key:
|
|
12794
|
+
(m(!0), b(ze, null, ut(Mt.value, (te) => (m(), b("button", {
|
|
12795
|
+
key: te.id,
|
|
12780
12796
|
class: "cim-result",
|
|
12781
|
-
"data-testid": `item-add-member-${
|
|
12782
|
-
"aria-label": `${At(
|
|
12783
|
-
onClick: (je) => kt(
|
|
12797
|
+
"data-testid": `item-add-member-${te.id}`,
|
|
12798
|
+
"aria-label": `${At(te.id) ? "Deselect" : "Select"} ${te.name}`,
|
|
12799
|
+
onClick: (je) => kt(te)
|
|
12784
12800
|
}, [
|
|
12785
12801
|
c("div", Ap, [
|
|
12786
|
-
|
|
12802
|
+
te.avatar ? (m(), b("img", {
|
|
12787
12803
|
key: 0,
|
|
12788
|
-
src:
|
|
12789
|
-
alt:
|
|
12804
|
+
src: te.avatar,
|
|
12805
|
+
alt: te.name,
|
|
12790
12806
|
class: "cim-result__avatar-img"
|
|
12791
12807
|
}, null, 8, $p)) : (m(), b("div", {
|
|
12792
12808
|
key: 1,
|
|
12793
12809
|
class: "cim-result__avatar-initials",
|
|
12794
|
-
style: at({ backgroundColor: Ye(
|
|
12795
|
-
}, Q(mt(
|
|
12810
|
+
style: at({ backgroundColor: Ye(te.id) })
|
|
12811
|
+
}, Q(mt(te.name)), 5))
|
|
12796
12812
|
]),
|
|
12797
12813
|
c("div", Rp, [
|
|
12798
|
-
c("span", Pp, Q(
|
|
12799
|
-
|
|
12814
|
+
c("span", Pp, Q(te.name), 1),
|
|
12815
|
+
te.handle ? (m(), b("span", Ip, "@" + Q(te.handle), 1)) : Y("", !0)
|
|
12800
12816
|
]),
|
|
12801
|
-
At(
|
|
12817
|
+
At(te.id) ? (m(), b("svg", Lp, [...se[19] || (se[19] = [
|
|
12802
12818
|
c("polyline", { points: "20 6 9 17 4 12" }, null, -1)
|
|
12803
12819
|
])])) : Y("", !0)
|
|
12804
12820
|
], 8, Ep))), 128))
|
|
@@ -13021,7 +13037,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
13021
13037
|
}
|
|
13022
13038
|
}
|
|
13023
13039
|
function nt(X) {
|
|
13024
|
-
J(X) ?
|
|
13040
|
+
J(X) ? ee(X) : Ze(X);
|
|
13025
13041
|
}
|
|
13026
13042
|
function Ye(X, j) {
|
|
13027
13043
|
return j === "nobody" ? "This user has disabled direct messages." : !X && j === "followers" ? "This user only accepts messages from their followers." : null;
|
|
@@ -13066,7 +13082,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
13066
13082
|
} else J(X) || (x.value = [...x.value, X]);
|
|
13067
13083
|
w.value === "group" && o.value?.focus();
|
|
13068
13084
|
}
|
|
13069
|
-
function
|
|
13085
|
+
function ee(X) {
|
|
13070
13086
|
x.value = x.value.filter((j) => j.id !== X.id), w.value === "dm" && (ae.value = null);
|
|
13071
13087
|
}
|
|
13072
13088
|
function J(X) {
|
|
@@ -13244,7 +13260,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
13244
13260
|
class: "ncm-chip",
|
|
13245
13261
|
"data-testid": `chip-selected-user-${z.id}`,
|
|
13246
13262
|
"aria-label": `Remove ${z.name}`,
|
|
13247
|
-
onClick: (Ie) =>
|
|
13263
|
+
onClick: (Ie) => ee(z)
|
|
13248
13264
|
}, [
|
|
13249
13265
|
c("div", {
|
|
13250
13266
|
class: "ncm-chip__avatar",
|
package/package.json
CHANGED