@ethora/chat-component 26.9.6 → 26.9.8
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/README.md +44 -2
- package/dist/{ChatProfileModal-DKuxJsdM.js → ChatProfileModal-3UH0H5Ec.js} +571 -567
- package/dist/{FilePreviewModal-BcaSoO3-.js → FilePreviewModal-Cgj1iHry.js} +168 -168
- package/dist/{ManageDataModal-Dw4dCQll.js → ManageDataModal-BblTuE9g.js} +14 -14
- package/dist/{MarkdownBody-xtKDMR0h.js → MarkdownBody-RMEx8yW2.js} +1 -1
- package/dist/{MessageSearchModal-BVKU6H3v.js → MessageSearchModal-CrYR2EH8.js} +105 -113
- package/dist/{PublicChatsModal-CscOnVaQ.js → PublicChatsModal-Bi5r4mrV.js} +13 -13
- package/dist/{SideDrawer-WneDrrWG.js → SideDrawer-CDAoobvX.js} +16 -16
- package/dist/{UserProfileModal-CMHFq1I9.js → UserProfileModal-4Frgvam-.js} +3 -3
- package/dist/{UserSettingsModal-BoZXZ0oR.js → UserSettingsModal-C-mb-9cb.js} +2 -2
- package/dist/{VideoCallOverlay-CQNi7wp5.js → VideoCallOverlay-92dFLb9U.js} +1 -1
- package/dist/{VisibilityModal-BPsNiMzJ.js → VisibilityModal-zIAV6dAP.js} +9 -9
- package/dist/components/InputComponents/MentionDropdown.d.ts +2 -0
- package/dist/components/MainComponents/scrollAnchor.d.ts +19 -0
- package/dist/components/MainComponents/useJumpToMessage.d.ts +42 -11
- package/dist/components/MainComponents/useScrollAnchor.d.ts +29 -0
- package/dist/components/Modals/MessageSearchModal/MessageHitResults.d.ts +5 -0
- package/dist/components/Modals/styledModalComponents.d.ts +0 -8
- package/dist/{handleCopyClick-B70vLjJD.js → handleCopyClick-BtXos0AJ.js} +1 -1
- package/dist/helpers/checkUniqueUsers.d.ts +2 -2
- package/dist/helpers/dedupeMembers.d.ts +10 -0
- package/dist/helpers/historyPreloadConfig.d.ts +25 -0
- package/dist/helpers/historyPreloadScheduler.d.ts +3 -0
- package/dist/helpers/insertMessageWithDelimiter.d.ts +1 -0
- package/dist/helpers/isMessageSearchEnabled.d.ts +9 -0
- package/dist/helpers/jumpThread.d.ts +56 -0
- package/dist/helpers/jumpWindow.d.ts +73 -0
- package/dist/helpers/openThreadForJump.d.ts +26 -0
- package/dist/helpers/pdf/loadPdfjs.d.ts +8 -1
- package/dist/helpers/roomUserCount.d.ts +19 -0
- package/dist/helpers/userResolver.d.ts +57 -0
- package/dist/helpers/xmppIdShape.d.ts +1 -1
- package/dist/hooks/useChatWrapperInit.d.ts +6 -0
- package/dist/hooks/usePdfThumbnail.d.ts +2 -1
- package/dist/hooks/useRoomDirectory.d.ts +11 -0
- package/dist/{main-rJpE4hh-.js → main-BnLtessp.js} +22850 -21155
- package/dist/main.css +1 -1
- package/dist/main.js +11 -11
- package/dist/networking/api-requests/roomMembers.api.d.ts +18 -0
- package/dist/networking/ethoraEvents.d.ts +44 -0
- package/dist/networking/stanzaHandlers.d.ts +2 -2
- package/dist/networking/xmpp/allRoomPresences.xmpp.d.ts +18 -1
- package/dist/networking/xmpp/presenceInRoom.xmpp.d.ts +1 -1
- package/dist/networking/xmppClient.d.ts +56 -2
- package/dist/roomStore/Middleware/jumpThreadMiddleware.d.ts +2 -0
- package/dist/roomStore/index.d.ts +12 -0
- package/dist/roomStore/roomsSlice.d.ts +33 -1
- package/dist/roomStore/safeKey.d.ts +12 -0
- package/dist/roomStore/usersSetCap.d.ts +15 -0
- package/dist/types/models/config.model.d.ts +70 -3
- package/dist/types/models/room.model.d.ts +14 -0
- package/dist/types/models/xmpp.model.d.ts +21 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -1
- package/dist/components/MainComponents/computeAnchoredScrollTop.d.ts +0 -9
- package/dist/components/Modals/NewChatModal/UpdNewChatModal.d.ts +0 -3
- package/dist/components/SortDropDown/index.d.ts +0 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as o, Fragment as T, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { useState as m, useCallback as M } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { S as
|
|
5
|
-
t(
|
|
3
|
+
import { aE as I, x as t, aF as j, aG as w, B, u as E, p as F, J as z, aH as R, L as U, w as x, aI as $, aJ as A, aK as H, aL as J } from "./main-BnLtessp.js";
|
|
4
|
+
import { S as O, D as f, a as u, b as D, e as v, f as b } from "./SideDrawer-CDAoobvX.js";
|
|
5
|
+
t(j)`
|
|
6
6
|
display: flex;
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
align-items: flex-start;
|
|
@@ -36,7 +36,7 @@ t(w)`
|
|
|
36
36
|
text-align: start;
|
|
37
37
|
color: var(--ethora-color-text-muted, #8c8c8c);
|
|
38
38
|
`;
|
|
39
|
-
const y = t(
|
|
39
|
+
const y = t(B)`
|
|
40
40
|
min-height: 44px;
|
|
41
41
|
display: flex;
|
|
42
42
|
flex-direction: column;
|
|
@@ -65,15 +65,15 @@ const y = t(j)`
|
|
|
65
65
|
box-shadow: var(--ethora-shadow-sm, 0 1px 2px rgba(16, 24, 40, 0.06));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
${
|
|
69
|
-
`,
|
|
68
|
+
${I}
|
|
69
|
+
`, G = t.div`
|
|
70
70
|
display: flex;
|
|
71
71
|
align-items: flex-start;
|
|
72
72
|
background-color: ${({ bgColor: r }) => r};
|
|
73
73
|
padding: var(--ethora-space-4, 16px);
|
|
74
74
|
border-radius: var(--ethora-radius-md, 12px);
|
|
75
75
|
gap: var(--ethora-space-2, 8px);
|
|
76
|
-
`,
|
|
76
|
+
`, K = t.div`
|
|
77
77
|
font-size: var(--ethora-font-size-xs, 12px);
|
|
78
78
|
line-height: var(--ethora-line-height-normal, 1.5);
|
|
79
79
|
color: var(--ethora-color-text, #141414);
|
|
@@ -82,8 +82,8 @@ const y = t(j)`
|
|
|
82
82
|
`, Q = ({
|
|
83
83
|
handleCloseModal: r
|
|
84
84
|
}) => {
|
|
85
|
-
const { config: l } =
|
|
86
|
-
const p = (await
|
|
85
|
+
const { config: l } = E((s) => s.chatSettingStore), e = F(), { showToast: d } = z(), [C, c] = m(!1), [i, g] = m(!1), S = async () => {
|
|
86
|
+
const p = (await J()).data;
|
|
87
87
|
x.log(p);
|
|
88
88
|
const L = new Blob([p], { type: "text/plain" }), h = URL.createObjectURL(L), n = document.createElement("a");
|
|
89
89
|
n.href = h, n.download = "mydata.json", document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(h);
|
|
@@ -105,7 +105,7 @@ const y = t(j)`
|
|
|
105
105
|
}, [i, d, e]);
|
|
106
106
|
return /* @__PURE__ */ o(T, { children: [
|
|
107
107
|
/* @__PURE__ */ o(
|
|
108
|
-
|
|
108
|
+
O,
|
|
109
109
|
{
|
|
110
110
|
title: e("settings.manageData.title"),
|
|
111
111
|
onClose: r,
|
|
@@ -131,13 +131,13 @@ const y = t(j)`
|
|
|
131
131
|
/* @__PURE__ */ a(D, { children: /* @__PURE__ */ o(v, { children: [
|
|
132
132
|
/* @__PURE__ */ a(b, { children: e("settings.manageData.deleteDescription") }),
|
|
133
133
|
/* @__PURE__ */ o(
|
|
134
|
-
|
|
134
|
+
G,
|
|
135
135
|
{
|
|
136
136
|
bgColor: l?.colors?.secondary || "var(--ethora-color-primary-soft, #E7EDF9)",
|
|
137
137
|
style: { marginTop: "var(--ethora-space-2, 8px)" },
|
|
138
138
|
children: [
|
|
139
|
-
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
140
|
-
/* @__PURE__ */ a(
|
|
139
|
+
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a($, { color: A(l) }) }),
|
|
140
|
+
/* @__PURE__ */ a(K, { children: e("settings.manageData.deleteDisclosure") })
|
|
141
141
|
]
|
|
142
142
|
}
|
|
143
143
|
),
|
|
@@ -159,7 +159,7 @@ const y = t(j)`
|
|
|
159
159
|
}
|
|
160
160
|
),
|
|
161
161
|
C && /* @__PURE__ */ a(
|
|
162
|
-
|
|
162
|
+
H,
|
|
163
163
|
{
|
|
164
164
|
title: e("settings.manageData.deleteConfirmTitle"),
|
|
165
165
|
description: e("settings.manageData.deleteConfirmDescription"),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as fs, jsx as ie, Fragment as hs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { o as ei } from "./main-
|
|
3
|
+
import { o as ei } from "./main-BnLtessp.js";
|
|
4
4
|
function zr(e) {
|
|
5
5
|
const t = [], n = String(e || "");
|
|
6
6
|
let r = n.indexOf(","), u = 0, i = !1;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import { useRef as J, useState as h, useMemo as I, useEffect as
|
|
3
|
-
import { p as
|
|
4
|
-
import { S as
|
|
5
|
-
function
|
|
1
|
+
import { jsx as a, jsxs as i, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as J, useState as h, useMemo as I, useEffect as V } from "react";
|
|
3
|
+
import { p as Y, a as K, aO as W, u as z, ao as X, an as Z, ap as ee, aP as re, aQ as te, aw as ae, aR as oe, aS as se, aT as ne, x as c, q as ie } from "./main-BnLtessp.js";
|
|
4
|
+
import { S as ce, i as le, j as de, f as S } from "./SideDrawer-CDAoobvX.js";
|
|
5
|
+
function he(t) {
|
|
6
6
|
const e = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t || "");
|
|
7
7
|
if (!e) return;
|
|
8
|
-
const
|
|
8
|
+
const l = new Date(
|
|
9
9
|
Number(e[1]),
|
|
10
10
|
Number(e[2]) - 1,
|
|
11
11
|
Number(e[3]),
|
|
@@ -14,12 +14,12 @@ function oe(t) {
|
|
|
14
14
|
0,
|
|
15
15
|
0
|
|
16
16
|
);
|
|
17
|
-
return Number.isNaN(
|
|
17
|
+
return Number.isNaN(l.getTime()) ? void 0 : l.toISOString();
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function pe(t) {
|
|
20
20
|
const e = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t || "");
|
|
21
21
|
if (!e) return;
|
|
22
|
-
const
|
|
22
|
+
const l = new Date(
|
|
23
23
|
Number(e[1]),
|
|
24
24
|
Number(e[2]) - 1,
|
|
25
25
|
Number(e[3]),
|
|
@@ -28,31 +28,31 @@ function se(t) {
|
|
|
28
28
|
59,
|
|
29
29
|
999
|
|
30
30
|
);
|
|
31
|
-
return Number.isNaN(
|
|
31
|
+
return Number.isNaN(l.getTime()) ? void 0 : l.toISOString();
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
const p = [],
|
|
33
|
+
const ue = (t, e) => !!(t && e && t > e), me = (t) => `${t.firstName || ""} ${t.lastName || ""}`.trim() || t.name || "";
|
|
34
|
+
function fe(t, e, l = 8) {
|
|
35
|
+
const k = e.trim().toLowerCase();
|
|
36
|
+
if (!k) return [];
|
|
37
|
+
const p = [], u = [], n = /* @__PURE__ */ new Set();
|
|
38
38
|
for (const x of t) {
|
|
39
|
-
const d = x._id, b =
|
|
40
|
-
if (!d || !b ||
|
|
41
|
-
const s = b.toLowerCase().indexOf(
|
|
42
|
-
if (s !== -1 && (
|
|
39
|
+
const d = x._id, b = me(x);
|
|
40
|
+
if (!d || !b || n.has(d)) continue;
|
|
41
|
+
const s = b.toLowerCase().indexOf(k);
|
|
42
|
+
if (s !== -1 && (n.add(d), (s === 0 ? p : u).push({ id: d, name: b }), p.length >= l))
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
|
-
return [...p, ...
|
|
45
|
+
return [...p, ...u].slice(0, l);
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const ge = c.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex-direction: column;
|
|
50
50
|
gap: var(--ethora-space-3, 12px);
|
|
51
51
|
min-height: 0;
|
|
52
|
-
`,
|
|
52
|
+
`, xe = c.div`
|
|
53
53
|
display: flex;
|
|
54
54
|
gap: var(--ethora-space-2, 8px);
|
|
55
|
-
`,
|
|
55
|
+
`, Q = c.button`
|
|
56
56
|
flex: 1 1 0;
|
|
57
57
|
height: 32px;
|
|
58
58
|
border: 1px solid
|
|
@@ -65,7 +65,7 @@ const le = i.div`
|
|
|
65
65
|
font-weight: var(--ethora-font-weight-medium, 500);
|
|
66
66
|
cursor: pointer;
|
|
67
67
|
transition: background-color var(--ethora-motion-fast, 150ms);
|
|
68
|
-
`,
|
|
68
|
+
`, be = c.button`
|
|
69
69
|
align-self: flex-start;
|
|
70
70
|
display: inline-flex;
|
|
71
71
|
align-items: center;
|
|
@@ -87,14 +87,14 @@ const le = i.div`
|
|
|
87
87
|
font-size: var(--ethora-font-size-xs, 12px);
|
|
88
88
|
text-align: center;
|
|
89
89
|
}
|
|
90
|
-
`,
|
|
90
|
+
`, ve = c.div`
|
|
91
91
|
display: flex;
|
|
92
92
|
flex-direction: column;
|
|
93
93
|
gap: var(--ethora-space-2, 8px);
|
|
94
94
|
padding: var(--ethora-space-3, 12px);
|
|
95
95
|
border: 1px solid var(--ethora-color-border, #e6e8ec);
|
|
96
96
|
border-radius: var(--ethora-radius-md, 12px);
|
|
97
|
-
`,
|
|
97
|
+
`, O = c.label`
|
|
98
98
|
display: flex;
|
|
99
99
|
flex-direction: column;
|
|
100
100
|
gap: 4px;
|
|
@@ -112,11 +112,11 @@ const le = i.div`
|
|
|
112
112
|
font: inherit;
|
|
113
113
|
font-size: var(--ethora-font-size-sm, 14px);
|
|
114
114
|
}
|
|
115
|
-
`,
|
|
115
|
+
`, ye = c.div`
|
|
116
116
|
display: grid;
|
|
117
117
|
grid-template-columns: 1fr 1fr;
|
|
118
118
|
gap: var(--ethora-space-2, 8px);
|
|
119
|
-
`,
|
|
119
|
+
`, Se = c.ul`
|
|
120
120
|
list-style: none;
|
|
121
121
|
margin: 0;
|
|
122
122
|
padding: 4px;
|
|
@@ -140,7 +140,7 @@ const le = i.div`
|
|
|
140
140
|
button:focus-visible {
|
|
141
141
|
background: var(--ethora-color-bg-hover, #f0f2f5);
|
|
142
142
|
}
|
|
143
|
-
`,
|
|
143
|
+
`, ke = c.span`
|
|
144
144
|
display: inline-flex;
|
|
145
145
|
align-items: center;
|
|
146
146
|
gap: 6px;
|
|
@@ -159,7 +159,7 @@ const le = i.div`
|
|
|
159
159
|
cursor: pointer;
|
|
160
160
|
padding: 0 6px;
|
|
161
161
|
}
|
|
162
|
-
`,
|
|
162
|
+
`, Ce = c.button`
|
|
163
163
|
align-self: flex-start;
|
|
164
164
|
border: none;
|
|
165
165
|
background: transparent;
|
|
@@ -169,74 +169,66 @@ const le = i.div`
|
|
|
169
169
|
text-decoration: underline;
|
|
170
170
|
cursor: pointer;
|
|
171
171
|
padding: 0;
|
|
172
|
-
`,
|
|
172
|
+
`, we = c.div`
|
|
173
173
|
font-size: var(--ethora-font-size-xs, 12px);
|
|
174
174
|
color: var(--ethora-color-text-muted, #6c6c6c);
|
|
175
|
-
`,
|
|
176
|
-
align-self: center;
|
|
177
|
-
margin-top: var(--ethora-space-2, 8px);
|
|
178
|
-
padding: 6px 14px;
|
|
179
|
-
border: 1px solid var(--ethora-color-border, #e6e8ec);
|
|
180
|
-
border-radius: var(--ethora-radius-full, 999px);
|
|
181
|
-
background: transparent;
|
|
182
|
-
color: var(--ethora-color-text-secondary, #5a5f66);
|
|
183
|
-
font: inherit;
|
|
184
|
-
font-size: var(--ethora-font-size-sm, 14px);
|
|
185
|
-
cursor: pointer;
|
|
186
|
-
|
|
187
|
-
&:disabled {
|
|
188
|
-
opacity: 0.6;
|
|
189
|
-
cursor: default;
|
|
190
|
-
}
|
|
191
|
-
`, Ce = ({
|
|
175
|
+
`, Re = ({
|
|
192
176
|
handleCloseModal: t
|
|
193
177
|
}) => {
|
|
194
|
-
const e =
|
|
178
|
+
const e = Y(), l = K(), k = W(767), p = J(null), u = z((r) => r.rooms.rooms), n = z(
|
|
195
179
|
(r) => r.rooms.activeRoomJID
|
|
196
180
|
), x = z((r) => r.rooms.usersSet);
|
|
197
181
|
z(
|
|
198
182
|
(r) => r.chatSettingStore.user?.xmppUsername
|
|
199
183
|
);
|
|
200
|
-
const [d, b] = h(""), [s,
|
|
201
|
-
|
|
202
|
-
),
|
|
184
|
+
const [d, b] = h(""), [s, $] = h(
|
|
185
|
+
n ? "chat" : "all"
|
|
186
|
+
), F = n ? n.split("@")[0] : void 0, [C, U] = h(!1), [m, T] = h(""), [f, L] = h(""), [g, M] = h(
|
|
203
187
|
null
|
|
204
|
-
), [
|
|
188
|
+
), [v, N] = h(""), y = ue(m, f), j = I(
|
|
205
189
|
() => ({
|
|
206
|
-
fromUserId:
|
|
207
|
-
since:
|
|
208
|
-
until:
|
|
190
|
+
fromUserId: g?.id,
|
|
191
|
+
since: y ? void 0 : he(m),
|
|
192
|
+
until: y ? void 0 : pe(f)
|
|
209
193
|
}),
|
|
210
|
-
[
|
|
211
|
-
),
|
|
212
|
-
M(null), N(""),
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
194
|
+
[g?.id, m, f, y]
|
|
195
|
+
), w = (g ? 1 : 0) + (m ? 1 : 0) + (f ? 1 : 0), E = () => {
|
|
196
|
+
M(null), N(""), T(""), L("");
|
|
197
|
+
}, P = n ? u[n] : void 0, { members: D } = X(
|
|
198
|
+
n || void 0,
|
|
199
|
+
s === "chat" && Z(P) && (C || v.trim() !== "")
|
|
200
|
+
), A = I(() => {
|
|
201
|
+
if (!v.trim()) return [];
|
|
202
|
+
let r;
|
|
203
|
+
if (s === "chat") {
|
|
204
|
+
const H = n && u[n]?.members || [];
|
|
205
|
+
D.length > 0 ? r = ee([...H, ...D]) : r = H;
|
|
206
|
+
} else
|
|
207
|
+
r = Object.values(x || {});
|
|
208
|
+
return fe(r, v);
|
|
209
|
+
}, [v, s, u, n, x, D]), o = re(
|
|
210
|
+
y ? "" : d,
|
|
219
211
|
s,
|
|
220
|
-
|
|
221
|
-
|
|
212
|
+
F,
|
|
213
|
+
j
|
|
222
214
|
);
|
|
223
|
-
|
|
215
|
+
V(() => {
|
|
224
216
|
p.current?.focus();
|
|
225
217
|
}, []);
|
|
226
|
-
const { open:
|
|
227
|
-
|
|
228
|
-
},
|
|
218
|
+
const { open: q } = te(), _ = (r) => {
|
|
219
|
+
q(r) && k && l(ie(void 0));
|
|
220
|
+
}, R = I(() => o.items, [o.items]), B = d.trim();
|
|
229
221
|
return /* @__PURE__ */ a(
|
|
230
|
-
|
|
222
|
+
ce,
|
|
231
223
|
{
|
|
232
224
|
title: e("search.messages.title"),
|
|
233
225
|
onClose: t,
|
|
234
226
|
backLabel: e("action.close"),
|
|
235
|
-
children: /* @__PURE__ */
|
|
236
|
-
/* @__PURE__ */
|
|
237
|
-
/* @__PURE__ */ a(
|
|
227
|
+
children: /* @__PURE__ */ i(ge, { children: [
|
|
228
|
+
/* @__PURE__ */ i(le, { children: [
|
|
229
|
+
/* @__PURE__ */ a(ae, {}),
|
|
238
230
|
/* @__PURE__ */ a(
|
|
239
|
-
|
|
231
|
+
de,
|
|
240
232
|
{
|
|
241
233
|
ref: p,
|
|
242
234
|
"data-autofocus": !0,
|
|
@@ -250,47 +242,47 @@ const le = i.div`
|
|
|
250
242
|
}
|
|
251
243
|
)
|
|
252
244
|
] }),
|
|
253
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ i(xe, { role: "group", "aria-label": e("search.messages.scope"), children: [
|
|
254
246
|
/* @__PURE__ */ a(
|
|
255
|
-
|
|
247
|
+
Q,
|
|
256
248
|
{
|
|
257
249
|
type: "button",
|
|
258
250
|
$active: s === "chat",
|
|
259
251
|
"aria-pressed": s === "chat",
|
|
260
|
-
disabled: !
|
|
261
|
-
onClick: () =>
|
|
252
|
+
disabled: !F,
|
|
253
|
+
onClick: () => $("chat"),
|
|
262
254
|
children: e("search.messages.scopeChat")
|
|
263
255
|
}
|
|
264
256
|
),
|
|
265
257
|
/* @__PURE__ */ a(
|
|
266
|
-
|
|
258
|
+
Q,
|
|
267
259
|
{
|
|
268
260
|
type: "button",
|
|
269
261
|
$active: s === "all",
|
|
270
262
|
"aria-pressed": s === "all",
|
|
271
|
-
onClick: () =>
|
|
263
|
+
onClick: () => $("all"),
|
|
272
264
|
children: e("search.messages.scopeAll")
|
|
273
265
|
}
|
|
274
266
|
)
|
|
275
267
|
] }),
|
|
276
|
-
/* @__PURE__ */
|
|
277
|
-
|
|
268
|
+
/* @__PURE__ */ i(
|
|
269
|
+
be,
|
|
278
270
|
{
|
|
279
271
|
type: "button",
|
|
280
|
-
$active:
|
|
281
|
-
"aria-expanded":
|
|
282
|
-
onClick: () =>
|
|
272
|
+
$active: C || w > 0,
|
|
273
|
+
"aria-expanded": C,
|
|
274
|
+
onClick: () => U((r) => !r),
|
|
283
275
|
children: [
|
|
284
276
|
e("search.messages.filters"),
|
|
285
|
-
|
|
277
|
+
w > 0 && /* @__PURE__ */ a("span", { children: w })
|
|
286
278
|
]
|
|
287
279
|
}
|
|
288
280
|
),
|
|
289
|
-
|
|
290
|
-
/* @__PURE__ */
|
|
281
|
+
C && /* @__PURE__ */ i(ve, { children: [
|
|
282
|
+
/* @__PURE__ */ i(O, { children: [
|
|
291
283
|
e("search.messages.filterSender"),
|
|
292
|
-
|
|
293
|
-
|
|
284
|
+
g ? /* @__PURE__ */ i(ke, { children: [
|
|
285
|
+
g.name,
|
|
294
286
|
/* @__PURE__ */ a(
|
|
295
287
|
"button",
|
|
296
288
|
{
|
|
@@ -304,13 +296,13 @@ const le = i.div`
|
|
|
304
296
|
"input",
|
|
305
297
|
{
|
|
306
298
|
type: "search",
|
|
307
|
-
value:
|
|
299
|
+
value: v,
|
|
308
300
|
onChange: (r) => N(r.target.value),
|
|
309
301
|
placeholder: e("search.messages.filterSenderPlaceholder")
|
|
310
302
|
}
|
|
311
303
|
)
|
|
312
304
|
] }),
|
|
313
|
-
!
|
|
305
|
+
!g && A.length > 0 && /* @__PURE__ */ a(Se, { role: "listbox", children: A.map((r) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
314
306
|
"button",
|
|
315
307
|
{
|
|
316
308
|
type: "button",
|
|
@@ -322,56 +314,56 @@ const le = i.div`
|
|
|
322
314
|
children: r.name
|
|
323
315
|
}
|
|
324
316
|
) }, r.id)) }),
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
/* @__PURE__ */
|
|
317
|
+
/* @__PURE__ */ i(ye, { children: [
|
|
318
|
+
/* @__PURE__ */ i(O, { children: [
|
|
327
319
|
e("search.messages.filterSince"),
|
|
328
320
|
/* @__PURE__ */ a(
|
|
329
321
|
"input",
|
|
330
322
|
{
|
|
331
323
|
type: "date",
|
|
332
|
-
value:
|
|
324
|
+
value: m,
|
|
333
325
|
max: f || void 0,
|
|
334
|
-
onChange: (r) =>
|
|
326
|
+
onChange: (r) => T(r.target.value)
|
|
335
327
|
}
|
|
336
328
|
)
|
|
337
329
|
] }),
|
|
338
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ i(O, { children: [
|
|
339
331
|
e("search.messages.filterUntil"),
|
|
340
332
|
/* @__PURE__ */ a(
|
|
341
333
|
"input",
|
|
342
334
|
{
|
|
343
335
|
type: "date",
|
|
344
336
|
value: f,
|
|
345
|
-
min:
|
|
337
|
+
min: m || void 0,
|
|
346
338
|
onChange: (r) => L(r.target.value)
|
|
347
339
|
}
|
|
348
340
|
)
|
|
349
341
|
] })
|
|
350
342
|
] }),
|
|
351
|
-
|
|
352
|
-
|
|
343
|
+
y && /* @__PURE__ */ a(S, { role: "alert", children: e("search.messages.dateOrder") }),
|
|
344
|
+
w > 0 && /* @__PURE__ */ a(Ce, { type: "button", onClick: E, children: e("search.messages.filterClearAll") })
|
|
353
345
|
] }),
|
|
354
|
-
!o.searchable && /* @__PURE__ */ a(
|
|
355
|
-
o.searchable && o.status === "loading" && /* @__PURE__ */ a(
|
|
356
|
-
o.status === "error" && /* @__PURE__ */
|
|
346
|
+
!o.searchable && /* @__PURE__ */ a(S, { children: B ? e("search.messages.tooShort", { count: oe }) : e("search.messages.hint") }),
|
|
347
|
+
o.searchable && o.status === "loading" && /* @__PURE__ */ a(S, { role: "status", children: e("search.messages.searching") }),
|
|
348
|
+
o.status === "error" && /* @__PURE__ */ i(S, { role: "alert", children: [
|
|
357
349
|
e("search.messages.error"),
|
|
358
350
|
" ",
|
|
359
351
|
/* @__PURE__ */ a("button", { type: "button", onClick: o.retry, children: e("search.messages.retry") })
|
|
360
352
|
] }),
|
|
361
|
-
o.searchable && o.status === "done" &&
|
|
362
|
-
|
|
363
|
-
/* @__PURE__ */ a(
|
|
353
|
+
o.searchable && o.status === "done" && R.length === 0 && /* @__PURE__ */ a(S, { children: e("search.messages.empty") }),
|
|
354
|
+
R.length > 0 && /* @__PURE__ */ i(G, { children: [
|
|
355
|
+
/* @__PURE__ */ a(we, { role: "status", children: e("search.messages.count", { count: o.total }) }),
|
|
364
356
|
/* @__PURE__ */ a(
|
|
365
|
-
|
|
357
|
+
se,
|
|
366
358
|
{
|
|
367
|
-
hits:
|
|
359
|
+
hits: R,
|
|
368
360
|
query: B,
|
|
369
361
|
showRoom: s === "all",
|
|
370
|
-
onOpen:
|
|
362
|
+
onOpen: _
|
|
371
363
|
}
|
|
372
364
|
),
|
|
373
365
|
o.hasMore && /* @__PURE__ */ a(
|
|
374
|
-
|
|
366
|
+
ne,
|
|
375
367
|
{
|
|
376
368
|
type: "button",
|
|
377
369
|
onClick: o.loadMore,
|
|
@@ -385,5 +377,5 @@ const le = i.div`
|
|
|
385
377
|
);
|
|
386
378
|
};
|
|
387
379
|
export {
|
|
388
|
-
|
|
380
|
+
Re as default
|
|
389
381
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as d, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { useState as p, useRef as
|
|
3
|
-
import { g as
|
|
4
|
-
import { S as V, i as Z, j as K, f as S } from "./SideDrawer-
|
|
2
|
+
import { useState as p, useRef as N, useCallback as P, useEffect as T, useMemo as z } from "react";
|
|
3
|
+
import { g as U, aU as E, p as _, a as q, aO as F, u as A, aw as H, x as c, a2 as J, q as G } from "./main-BnLtessp.js";
|
|
4
|
+
import { S as V, i as Z, j as K, f as S } from "./SideDrawer-CDAoobvX.js";
|
|
5
5
|
const I = 50;
|
|
6
6
|
async function Q({
|
|
7
7
|
offset: r = 0,
|
|
8
8
|
limit: t = I,
|
|
9
9
|
signal: u
|
|
10
10
|
} = {}) {
|
|
11
|
-
const x =
|
|
11
|
+
const x = U.getState().chatSettingStore.user?.token || "", s = (await E.get("/v1/chats/public", {
|
|
12
12
|
params: { limit: Math.min(t, I), offset: r },
|
|
13
13
|
headers: { Authorization: x },
|
|
14
14
|
signal: u
|
|
@@ -105,16 +105,16 @@ const W = c.ul`
|
|
|
105
105
|
}) => {
|
|
106
106
|
const t = _(), u = q(), x = F(767), b = A((e) => e.rooms.rooms), s = A(
|
|
107
107
|
(e) => e.chatSettingStore.config?.xmppSettings?.conference
|
|
108
|
-
), [l, i] = p([]), [j,
|
|
108
|
+
), [l, i] = p([]), [j, O] = p(0), [v, $] = p(0), [n, w] = p("loading"), [h, D] = p(""), m = N(0), f = P(async (e) => {
|
|
109
109
|
const o = ++m.current;
|
|
110
110
|
w(e ? "loadingMore" : "loading");
|
|
111
111
|
try {
|
|
112
112
|
const g = await Q({ offset: e });
|
|
113
113
|
if (o !== m.current) return;
|
|
114
114
|
i((k) => {
|
|
115
|
-
const
|
|
116
|
-
return e ? [...k, ...g.items.filter((C) => !
|
|
117
|
-
}),
|
|
115
|
+
const B = new Set(k.map((C) => C.name));
|
|
116
|
+
return e ? [...k, ...g.items.filter((C) => !B.has(C.name))] : g.items;
|
|
117
|
+
}), O(g.total), $(g.nextOffset), w("done");
|
|
118
118
|
} catch {
|
|
119
119
|
o === m.current && w("error");
|
|
120
120
|
}
|
|
@@ -122,7 +122,7 @@ const W = c.ul`
|
|
|
122
122
|
T(() => (f(0), () => {
|
|
123
123
|
m.current += 1;
|
|
124
124
|
}), [f]);
|
|
125
|
-
const
|
|
125
|
+
const L = z(
|
|
126
126
|
() => new Set(Object.keys(b).map((e) => e.split("@")[0])),
|
|
127
127
|
[b]
|
|
128
128
|
), y = z(() => {
|
|
@@ -130,7 +130,7 @@ const W = c.ul`
|
|
|
130
130
|
return e ? l.filter(
|
|
131
131
|
(o) => o.title.toLowerCase().includes(e) || o.description.toLowerCase().includes(e)
|
|
132
132
|
) : l;
|
|
133
|
-
}, [l, h]),
|
|
133
|
+
}, [l, h]), R = (e) => {
|
|
134
134
|
const o = (s || "").trim();
|
|
135
135
|
o && (u(J({ roomJID: `${e.name}@${o}` })), x && u(G(void 0)));
|
|
136
136
|
}, M = v < j;
|
|
@@ -148,7 +148,7 @@ const W = c.ul`
|
|
|
148
148
|
{
|
|
149
149
|
type: "search",
|
|
150
150
|
value: h,
|
|
151
|
-
onChange: (e) =>
|
|
151
|
+
onChange: (e) => D(e.target.value),
|
|
152
152
|
placeholder: t("publicChats.filter"),
|
|
153
153
|
"aria-label": t("publicChats.filter")
|
|
154
154
|
}
|
|
@@ -164,7 +164,7 @@ const W = c.ul`
|
|
|
164
164
|
] }),
|
|
165
165
|
n !== "loading" && n !== "error" && y.length === 0 && /* @__PURE__ */ a(S, { children: h.trim() && M ? t("publicChats.emptyFilterMore") : t("publicChats.empty") }),
|
|
166
166
|
y.length > 0 && /* @__PURE__ */ a(W, { children: y.map((e) => {
|
|
167
|
-
const o =
|
|
167
|
+
const o = L.has(e.name);
|
|
168
168
|
return /* @__PURE__ */ d(X, { children: [
|
|
169
169
|
/* @__PURE__ */ a(Y, { $src: e.picture, "aria-hidden": "true", children: !e.picture && oe(e) }),
|
|
170
170
|
/* @__PURE__ */ d(ee, { children: [
|
|
@@ -176,7 +176,7 @@ const W = c.ul`
|
|
|
176
176
|
{
|
|
177
177
|
type: "button",
|
|
178
178
|
$open: o,
|
|
179
|
-
onClick: () =>
|
|
179
|
+
onClick: () => R(e),
|
|
180
180
|
children: t(o ? "publicChats.open" : "publicChats.join")
|
|
181
181
|
}
|
|
182
182
|
)
|