@ethora/chat-component 26.9.5 → 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 +45 -1
- package/dist/{ChatProfileModal-Pr4--RdW.js → ChatProfileModal-3UH0H5Ec.js} +725 -714
- package/dist/{FilePreviewModal-CYHlKzRc.js → FilePreviewModal-Cgj1iHry.js} +161 -161
- package/dist/{ManageDataModal-BE1eGlYh.js → ManageDataModal-BblTuE9g.js} +14 -14
- package/dist/{MarkdownBody-G0_J0NL6.js → MarkdownBody-RMEx8yW2.js} +1 -1
- package/dist/MessageSearchModal-CrYR2EH8.js +381 -0
- package/dist/PublicChatsModal-Bi5r4mrV.js +202 -0
- package/dist/{SideDrawer-BG2m7Bcm.js → SideDrawer-CDAoobvX.js} +34 -34
- package/dist/{UserProfileModal-B2Hp5bAF.js → UserProfileModal-4Frgvam-.js} +3 -3
- package/dist/{UserSettingsModal-D871FDAT.js → UserSettingsModal-C-mb-9cb.js} +2 -2
- package/dist/{VideoCallOverlay-Br0ji0nZ.js → VideoCallOverlay-92dFLb9U.js} +1 -1
- package/dist/{VisibilityModal-DdFBV1_g.js → VisibilityModal-zIAV6dAP.js} +9 -9
- package/dist/assets/icons.d.ts +9 -0
- package/dist/components/InputComponents/MentionDropdown.d.ts +2 -0
- package/dist/components/InputComponents/Search.d.ts +4 -0
- package/dist/components/MainComponents/ArchivedMessageCard.d.ts +11 -0
- package/dist/components/MainComponents/scrollAnchor.d.ts +19 -0
- package/dist/components/MainComponents/useJumpToMessage.d.ts +94 -0
- package/dist/components/MainComponents/useScrollAnchor.d.ts +29 -0
- package/dist/components/MainComponents/useStickToBottom.d.ts +27 -0
- package/dist/components/Modals/MessageSearchModal/MessageHitResults.d.ts +27 -0
- package/dist/components/Modals/MessageSearchModal/MessageSearchModal.d.ts +6 -0
- package/dist/components/Modals/MessageSearchModal/resolveSender.d.ts +33 -0
- package/dist/components/Modals/MessageSearchModal/searchFilters.d.ts +34 -0
- package/dist/components/Modals/MessageSearchModal/snippet.d.ts +14 -0
- package/dist/components/Modals/MessageSearchModal/useMessageSearch.d.ts +22 -0
- package/dist/components/Modals/PublicChatsModal/PublicChatsModal.d.ts +13 -0
- package/dist/components/Modals/styledModalComponents.d.ts +0 -8
- package/dist/components/styled/RoomListComponents/index.d.ts +3 -0
- package/dist/context/ToastContext.d.ts +7 -0
- package/dist/firebase-messaging-sw.js +21 -3
- package/dist/{handleCopyClick-DPjxMoJn.js → handleCopyClick-BtXos0AJ.js} +1 -1
- package/dist/helpers/checkUniqueUsers.d.ts +2 -2
- package/dist/helpers/constants/MODAL_TYPES.d.ts +2 -0
- 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/nanoToMs.d.ts +1 -1
- package/dist/helpers/openRoomAtMessage.d.ts +17 -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/useMessageSearchShortcut.d.ts +14 -0
- package/dist/hooks/usePdfThumbnail.d.ts +2 -1
- package/dist/hooks/useRoomDirectory.d.ts +11 -0
- package/dist/hooks/useRoomState.d.ts +1 -0
- package/dist/{main-BRIZ98KV.js → main-BnLtessp.js} +24764 -21859
- package/dist/main.css +1 -1
- package/dist/main.js +16 -16
- package/dist/networking/api-requests/messageSearch.api.d.ts +56 -0
- package/dist/networking/api-requests/publicChats.api.d.ts +23 -0
- package/dist/networking/api-requests/roomMembers.api.d.ts +18 -0
- package/dist/networking/api-requests/xmppToken.api.d.ts +1 -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 +58 -2
- package/dist/roomStore/Middleware/jumpThreadMiddleware.d.ts +2 -0
- package/dist/roomStore/chatSettingsSlice.d.ts +1 -1
- package/dist/roomStore/index.d.ts +12 -0
- package/dist/roomStore/roomsSlice.d.ts +70 -1
- package/dist/roomStore/safeKey.d.ts +12 -0
- package/dist/roomStore/usersSetCap.d.ts +15 -0
- package/dist/styles/classNames.d.ts +2 -0
- package/dist/types/models/config.model.d.ts +78 -0
- package/dist/types/models/room.model.d.ts +14 -0
- package/dist/types/models/xmpp.model.d.ts +21 -1
- package/dist/utils/notificationUtils.d.ts +12 -0
- package/dist/version.d.ts +1 -1
- package/package.json +2 -1
- package/public/firebase-messaging-sw.js +21 -3
- 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;
|
|
@@ -0,0 +1,381 @@
|
|
|
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
|
+
const e = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t || "");
|
|
7
|
+
if (!e) return;
|
|
8
|
+
const l = new Date(
|
|
9
|
+
Number(e[1]),
|
|
10
|
+
Number(e[2]) - 1,
|
|
11
|
+
Number(e[3]),
|
|
12
|
+
0,
|
|
13
|
+
0,
|
|
14
|
+
0,
|
|
15
|
+
0
|
|
16
|
+
);
|
|
17
|
+
return Number.isNaN(l.getTime()) ? void 0 : l.toISOString();
|
|
18
|
+
}
|
|
19
|
+
function pe(t) {
|
|
20
|
+
const e = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t || "");
|
|
21
|
+
if (!e) return;
|
|
22
|
+
const l = new Date(
|
|
23
|
+
Number(e[1]),
|
|
24
|
+
Number(e[2]) - 1,
|
|
25
|
+
Number(e[3]),
|
|
26
|
+
23,
|
|
27
|
+
59,
|
|
28
|
+
59,
|
|
29
|
+
999
|
|
30
|
+
);
|
|
31
|
+
return Number.isNaN(l.getTime()) ? void 0 : l.toISOString();
|
|
32
|
+
}
|
|
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
|
+
for (const x of t) {
|
|
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
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
return [...p, ...u].slice(0, l);
|
|
46
|
+
}
|
|
47
|
+
const ge = c.div`
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: var(--ethora-space-3, 12px);
|
|
51
|
+
min-height: 0;
|
|
52
|
+
`, xe = c.div`
|
|
53
|
+
display: flex;
|
|
54
|
+
gap: var(--ethora-space-2, 8px);
|
|
55
|
+
`, Q = c.button`
|
|
56
|
+
flex: 1 1 0;
|
|
57
|
+
height: 32px;
|
|
58
|
+
border: 1px solid
|
|
59
|
+
${({ $active: t }) => t ? "var(--ethora-color-primary, #0052cd)" : "var(--ethora-color-border, #e6e8ec)"};
|
|
60
|
+
border-radius: var(--ethora-radius-full, 999px);
|
|
61
|
+
background: ${({ $active: t }) => t ? "var(--ethora-color-primary-soft, #e7edf9)" : "transparent"};
|
|
62
|
+
color: ${({ $active: t }) => t ? "var(--ethora-color-primary-text, #0052cd)" : "var(--ethora-color-text-secondary, #5a5f66)"};
|
|
63
|
+
font: inherit;
|
|
64
|
+
font-size: var(--ethora-font-size-sm, 14px);
|
|
65
|
+
font-weight: var(--ethora-font-weight-medium, 500);
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
transition: background-color var(--ethora-motion-fast, 150ms);
|
|
68
|
+
`, be = c.button`
|
|
69
|
+
align-self: flex-start;
|
|
70
|
+
display: inline-flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
gap: 6px;
|
|
73
|
+
padding: 4px 4px;
|
|
74
|
+
border: none;
|
|
75
|
+
background: transparent;
|
|
76
|
+
color: ${({ $active: t }) => t ? "var(--ethora-color-primary-text, #0052cd)" : "var(--ethora-color-text-secondary, #5a5f66)"};
|
|
77
|
+
font: inherit;
|
|
78
|
+
font-size: var(--ethora-font-size-sm, 14px);
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
|
|
81
|
+
> span {
|
|
82
|
+
min-width: 18px;
|
|
83
|
+
padding: 0 5px;
|
|
84
|
+
border-radius: var(--ethora-radius-full, 999px);
|
|
85
|
+
background: var(--ethora-color-primary, #0052cd);
|
|
86
|
+
color: var(--ethora-color-text-on-primary, #fff);
|
|
87
|
+
font-size: var(--ethora-font-size-xs, 12px);
|
|
88
|
+
text-align: center;
|
|
89
|
+
}
|
|
90
|
+
`, ve = c.div`
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
gap: var(--ethora-space-2, 8px);
|
|
94
|
+
padding: var(--ethora-space-3, 12px);
|
|
95
|
+
border: 1px solid var(--ethora-color-border, #e6e8ec);
|
|
96
|
+
border-radius: var(--ethora-radius-md, 12px);
|
|
97
|
+
`, O = c.label`
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
gap: 4px;
|
|
101
|
+
font-size: var(--ethora-font-size-xs, 12px);
|
|
102
|
+
color: var(--ethora-color-text-muted, #6c6c6c);
|
|
103
|
+
|
|
104
|
+
input {
|
|
105
|
+
height: 36px;
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
padding: 0 10px;
|
|
108
|
+
border: 1px solid var(--ethora-color-border, #e6e8ec);
|
|
109
|
+
border-radius: var(--ethora-radius-sm, 8px);
|
|
110
|
+
background: var(--ethora-color-bg-subtle, #f5f7fa);
|
|
111
|
+
color: var(--ethora-color-text, #141414);
|
|
112
|
+
font: inherit;
|
|
113
|
+
font-size: var(--ethora-font-size-sm, 14px);
|
|
114
|
+
}
|
|
115
|
+
`, ye = c.div`
|
|
116
|
+
display: grid;
|
|
117
|
+
grid-template-columns: 1fr 1fr;
|
|
118
|
+
gap: var(--ethora-space-2, 8px);
|
|
119
|
+
`, Se = c.ul`
|
|
120
|
+
list-style: none;
|
|
121
|
+
margin: 0;
|
|
122
|
+
padding: 4px;
|
|
123
|
+
border: 1px solid var(--ethora-color-border, #e6e8ec);
|
|
124
|
+
border-radius: var(--ethora-radius-sm, 8px);
|
|
125
|
+
background: var(--ethora-color-bg, #fff);
|
|
126
|
+
|
|
127
|
+
button {
|
|
128
|
+
width: 100%;
|
|
129
|
+
padding: 6px 8px;
|
|
130
|
+
border: none;
|
|
131
|
+
border-radius: 6px;
|
|
132
|
+
background: transparent;
|
|
133
|
+
color: var(--ethora-color-text, #141414);
|
|
134
|
+
font: inherit;
|
|
135
|
+
font-size: var(--ethora-font-size-sm, 14px);
|
|
136
|
+
text-align: start;
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
}
|
|
139
|
+
button:hover,
|
|
140
|
+
button:focus-visible {
|
|
141
|
+
background: var(--ethora-color-bg-hover, #f0f2f5);
|
|
142
|
+
}
|
|
143
|
+
`, ke = c.span`
|
|
144
|
+
display: inline-flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: 6px;
|
|
147
|
+
align-self: flex-start;
|
|
148
|
+
padding: 3px 4px 3px 10px;
|
|
149
|
+
border-radius: var(--ethora-radius-full, 999px);
|
|
150
|
+
background: var(--ethora-color-primary-soft, #e7edf9);
|
|
151
|
+
color: var(--ethora-color-primary-text, #0052cd);
|
|
152
|
+
font-size: var(--ethora-font-size-sm, 14px);
|
|
153
|
+
|
|
154
|
+
button {
|
|
155
|
+
border: none;
|
|
156
|
+
background: transparent;
|
|
157
|
+
color: inherit;
|
|
158
|
+
font: inherit;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
padding: 0 6px;
|
|
161
|
+
}
|
|
162
|
+
`, Ce = c.button`
|
|
163
|
+
align-self: flex-start;
|
|
164
|
+
border: none;
|
|
165
|
+
background: transparent;
|
|
166
|
+
color: var(--ethora-color-text-secondary, #5a5f66);
|
|
167
|
+
font: inherit;
|
|
168
|
+
font-size: var(--ethora-font-size-xs, 12px);
|
|
169
|
+
text-decoration: underline;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
padding: 0;
|
|
172
|
+
`, we = c.div`
|
|
173
|
+
font-size: var(--ethora-font-size-xs, 12px);
|
|
174
|
+
color: var(--ethora-color-text-muted, #6c6c6c);
|
|
175
|
+
`, Re = ({
|
|
176
|
+
handleCloseModal: t
|
|
177
|
+
}) => {
|
|
178
|
+
const e = Y(), l = K(), k = W(767), p = J(null), u = z((r) => r.rooms.rooms), n = z(
|
|
179
|
+
(r) => r.rooms.activeRoomJID
|
|
180
|
+
), x = z((r) => r.rooms.usersSet);
|
|
181
|
+
z(
|
|
182
|
+
(r) => r.chatSettingStore.user?.xmppUsername
|
|
183
|
+
);
|
|
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(
|
|
187
|
+
null
|
|
188
|
+
), [v, N] = h(""), y = ue(m, f), j = I(
|
|
189
|
+
() => ({
|
|
190
|
+
fromUserId: g?.id,
|
|
191
|
+
since: y ? void 0 : he(m),
|
|
192
|
+
until: y ? void 0 : pe(f)
|
|
193
|
+
}),
|
|
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,
|
|
211
|
+
s,
|
|
212
|
+
F,
|
|
213
|
+
j
|
|
214
|
+
);
|
|
215
|
+
V(() => {
|
|
216
|
+
p.current?.focus();
|
|
217
|
+
}, []);
|
|
218
|
+
const { open: q } = te(), _ = (r) => {
|
|
219
|
+
q(r) && k && l(ie(void 0));
|
|
220
|
+
}, R = I(() => o.items, [o.items]), B = d.trim();
|
|
221
|
+
return /* @__PURE__ */ a(
|
|
222
|
+
ce,
|
|
223
|
+
{
|
|
224
|
+
title: e("search.messages.title"),
|
|
225
|
+
onClose: t,
|
|
226
|
+
backLabel: e("action.close"),
|
|
227
|
+
children: /* @__PURE__ */ i(ge, { children: [
|
|
228
|
+
/* @__PURE__ */ i(le, { children: [
|
|
229
|
+
/* @__PURE__ */ a(ae, {}),
|
|
230
|
+
/* @__PURE__ */ a(
|
|
231
|
+
de,
|
|
232
|
+
{
|
|
233
|
+
ref: p,
|
|
234
|
+
"data-autofocus": !0,
|
|
235
|
+
type: "search",
|
|
236
|
+
value: d,
|
|
237
|
+
onChange: (r) => b(r.target.value),
|
|
238
|
+
placeholder: e(
|
|
239
|
+
s === "chat" ? "search.messages.placeholderChat" : "search.messages.placeholderAll"
|
|
240
|
+
),
|
|
241
|
+
"aria-label": e("search.messages.title")
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] }),
|
|
245
|
+
/* @__PURE__ */ i(xe, { role: "group", "aria-label": e("search.messages.scope"), children: [
|
|
246
|
+
/* @__PURE__ */ a(
|
|
247
|
+
Q,
|
|
248
|
+
{
|
|
249
|
+
type: "button",
|
|
250
|
+
$active: s === "chat",
|
|
251
|
+
"aria-pressed": s === "chat",
|
|
252
|
+
disabled: !F,
|
|
253
|
+
onClick: () => $("chat"),
|
|
254
|
+
children: e("search.messages.scopeChat")
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
/* @__PURE__ */ a(
|
|
258
|
+
Q,
|
|
259
|
+
{
|
|
260
|
+
type: "button",
|
|
261
|
+
$active: s === "all",
|
|
262
|
+
"aria-pressed": s === "all",
|
|
263
|
+
onClick: () => $("all"),
|
|
264
|
+
children: e("search.messages.scopeAll")
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
] }),
|
|
268
|
+
/* @__PURE__ */ i(
|
|
269
|
+
be,
|
|
270
|
+
{
|
|
271
|
+
type: "button",
|
|
272
|
+
$active: C || w > 0,
|
|
273
|
+
"aria-expanded": C,
|
|
274
|
+
onClick: () => U((r) => !r),
|
|
275
|
+
children: [
|
|
276
|
+
e("search.messages.filters"),
|
|
277
|
+
w > 0 && /* @__PURE__ */ a("span", { children: w })
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
C && /* @__PURE__ */ i(ve, { children: [
|
|
282
|
+
/* @__PURE__ */ i(O, { children: [
|
|
283
|
+
e("search.messages.filterSender"),
|
|
284
|
+
g ? /* @__PURE__ */ i(ke, { children: [
|
|
285
|
+
g.name,
|
|
286
|
+
/* @__PURE__ */ a(
|
|
287
|
+
"button",
|
|
288
|
+
{
|
|
289
|
+
type: "button",
|
|
290
|
+
"aria-label": e("search.messages.filterClear"),
|
|
291
|
+
onClick: () => M(null),
|
|
292
|
+
children: "×"
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
] }) : /* @__PURE__ */ a(
|
|
296
|
+
"input",
|
|
297
|
+
{
|
|
298
|
+
type: "search",
|
|
299
|
+
value: v,
|
|
300
|
+
onChange: (r) => N(r.target.value),
|
|
301
|
+
placeholder: e("search.messages.filterSenderPlaceholder")
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
] }),
|
|
305
|
+
!g && A.length > 0 && /* @__PURE__ */ a(Se, { role: "listbox", children: A.map((r) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
306
|
+
"button",
|
|
307
|
+
{
|
|
308
|
+
type: "button",
|
|
309
|
+
role: "option",
|
|
310
|
+
"aria-selected": !1,
|
|
311
|
+
onClick: () => {
|
|
312
|
+
M(r), N("");
|
|
313
|
+
},
|
|
314
|
+
children: r.name
|
|
315
|
+
}
|
|
316
|
+
) }, r.id)) }),
|
|
317
|
+
/* @__PURE__ */ i(ye, { children: [
|
|
318
|
+
/* @__PURE__ */ i(O, { children: [
|
|
319
|
+
e("search.messages.filterSince"),
|
|
320
|
+
/* @__PURE__ */ a(
|
|
321
|
+
"input",
|
|
322
|
+
{
|
|
323
|
+
type: "date",
|
|
324
|
+
value: m,
|
|
325
|
+
max: f || void 0,
|
|
326
|
+
onChange: (r) => T(r.target.value)
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
] }),
|
|
330
|
+
/* @__PURE__ */ i(O, { children: [
|
|
331
|
+
e("search.messages.filterUntil"),
|
|
332
|
+
/* @__PURE__ */ a(
|
|
333
|
+
"input",
|
|
334
|
+
{
|
|
335
|
+
type: "date",
|
|
336
|
+
value: f,
|
|
337
|
+
min: m || void 0,
|
|
338
|
+
onChange: (r) => L(r.target.value)
|
|
339
|
+
}
|
|
340
|
+
)
|
|
341
|
+
] })
|
|
342
|
+
] }),
|
|
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") })
|
|
345
|
+
] }),
|
|
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: [
|
|
349
|
+
e("search.messages.error"),
|
|
350
|
+
" ",
|
|
351
|
+
/* @__PURE__ */ a("button", { type: "button", onClick: o.retry, children: e("search.messages.retry") })
|
|
352
|
+
] }),
|
|
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 }) }),
|
|
356
|
+
/* @__PURE__ */ a(
|
|
357
|
+
se,
|
|
358
|
+
{
|
|
359
|
+
hits: R,
|
|
360
|
+
query: B,
|
|
361
|
+
showRoom: s === "all",
|
|
362
|
+
onOpen: _
|
|
363
|
+
}
|
|
364
|
+
),
|
|
365
|
+
o.hasMore && /* @__PURE__ */ a(
|
|
366
|
+
ne,
|
|
367
|
+
{
|
|
368
|
+
type: "button",
|
|
369
|
+
onClick: o.loadMore,
|
|
370
|
+
disabled: o.status === "loadingMore",
|
|
371
|
+
children: o.status === "loadingMore" ? e("search.messages.searching") : e("search.messages.loadMore")
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
] })
|
|
375
|
+
] })
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
};
|
|
379
|
+
export {
|
|
380
|
+
Re as default
|
|
381
|
+
};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { jsxs as d, jsx as a } from "react/jsx-runtime";
|
|
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
|
+
const I = 50;
|
|
6
|
+
async function Q({
|
|
7
|
+
offset: r = 0,
|
|
8
|
+
limit: t = I,
|
|
9
|
+
signal: u
|
|
10
|
+
} = {}) {
|
|
11
|
+
const x = U.getState().chatSettingStore.user?.token || "", s = (await E.get("/v1/chats/public", {
|
|
12
|
+
params: { limit: Math.min(t, I), offset: r },
|
|
13
|
+
headers: { Authorization: x },
|
|
14
|
+
signal: u
|
|
15
|
+
}))?.data || {}, l = Array.isArray(s.items) ? s.items : [];
|
|
16
|
+
return {
|
|
17
|
+
// A chat that has been reported is not one to advertise in a directory.
|
|
18
|
+
items: l.filter((i) => i.name && !i.reported).map((i) => ({
|
|
19
|
+
name: String(i.name),
|
|
20
|
+
title: String(i.title || "").trim(),
|
|
21
|
+
description: String(i.description || "").trim(),
|
|
22
|
+
picture: String(i.picture || ""),
|
|
23
|
+
e2ee: !!i.e2ee
|
|
24
|
+
})),
|
|
25
|
+
total: Number(s.total) || 0,
|
|
26
|
+
offset: Number(s.offset) || r,
|
|
27
|
+
limit: Number(s.limit) || t,
|
|
28
|
+
nextOffset: r + l.length
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const W = c.ul`
|
|
32
|
+
list-style: none;
|
|
33
|
+
margin: 0;
|
|
34
|
+
padding: 0;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
`, X = c.li`
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: var(--ethora-space-3, 12px);
|
|
41
|
+
padding: var(--ethora-space-2, 8px) var(--ethora-space-1, 4px);
|
|
42
|
+
`, Y = c.div`
|
|
43
|
+
flex: 0 0 auto;
|
|
44
|
+
width: 40px;
|
|
45
|
+
height: 40px;
|
|
46
|
+
border-radius: var(--ethora-radius-full, 999px);
|
|
47
|
+
background: ${({ $src: r }) => r ? `center / cover no-repeat url("${r.replace(/["\\]/g, (t) => encodeURIComponent(t))}")` : "var(--ethora-color-primary-soft, #e7edf9)"};
|
|
48
|
+
color: var(--ethora-color-primary-text, #0052cd);
|
|
49
|
+
font-weight: var(--ethora-font-weight-semibold, 600);
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
`, ee = c.div`
|
|
54
|
+
flex: 1 1 auto;
|
|
55
|
+
min-width: 0;
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: 2px;
|
|
59
|
+
text-align: start;
|
|
60
|
+
|
|
61
|
+
> strong {
|
|
62
|
+
font-size: var(--ethora-font-size-sm, 14px);
|
|
63
|
+
font-weight: var(--ethora-font-weight-medium, 500);
|
|
64
|
+
color: var(--ethora-color-text, #141414);
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
text-overflow: ellipsis;
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
}
|
|
69
|
+
> span {
|
|
70
|
+
font-size: var(--ethora-font-size-xs, 12px);
|
|
71
|
+
color: var(--ethora-color-text-muted, #6c6c6c);
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
text-overflow: ellipsis;
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
}
|
|
76
|
+
`, te = c.button`
|
|
77
|
+
flex: 0 0 auto;
|
|
78
|
+
padding: 6px 14px;
|
|
79
|
+
border-radius: var(--ethora-radius-full, 999px);
|
|
80
|
+
border: 1px solid var(--ethora-color-primary, #0052cd);
|
|
81
|
+
background: ${({ $open: r }) => r ? "transparent" : "var(--ethora-color-primary, #0052cd)"};
|
|
82
|
+
color: ${({ $open: r }) => r ? "var(--ethora-color-primary-text, #0052cd)" : "var(--ethora-color-text-on-primary, #fff)"};
|
|
83
|
+
font: inherit;
|
|
84
|
+
font-size: var(--ethora-font-size-sm, 14px);
|
|
85
|
+
font-weight: var(--ethora-font-weight-medium, 500);
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
`, re = c.button`
|
|
88
|
+
align-self: center;
|
|
89
|
+
margin-top: var(--ethora-space-2, 8px);
|
|
90
|
+
padding: 6px 14px;
|
|
91
|
+
border: 1px solid var(--ethora-color-border, #e6e8ec);
|
|
92
|
+
border-radius: var(--ethora-radius-full, 999px);
|
|
93
|
+
background: transparent;
|
|
94
|
+
color: var(--ethora-color-text-secondary, #5a5f66);
|
|
95
|
+
font: inherit;
|
|
96
|
+
font-size: var(--ethora-font-size-sm, 14px);
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
|
|
99
|
+
&:disabled {
|
|
100
|
+
opacity: 0.6;
|
|
101
|
+
cursor: default;
|
|
102
|
+
}
|
|
103
|
+
`, oe = (r) => (r.title || r.name).trim().charAt(0).toUpperCase() || "#", le = ({
|
|
104
|
+
handleCloseModal: r
|
|
105
|
+
}) => {
|
|
106
|
+
const t = _(), u = q(), x = F(767), b = A((e) => e.rooms.rooms), s = A(
|
|
107
|
+
(e) => e.chatSettingStore.config?.xmppSettings?.conference
|
|
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
|
+
const o = ++m.current;
|
|
110
|
+
w(e ? "loadingMore" : "loading");
|
|
111
|
+
try {
|
|
112
|
+
const g = await Q({ offset: e });
|
|
113
|
+
if (o !== m.current) return;
|
|
114
|
+
i((k) => {
|
|
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
|
+
} catch {
|
|
119
|
+
o === m.current && w("error");
|
|
120
|
+
}
|
|
121
|
+
}, []);
|
|
122
|
+
T(() => (f(0), () => {
|
|
123
|
+
m.current += 1;
|
|
124
|
+
}), [f]);
|
|
125
|
+
const L = z(
|
|
126
|
+
() => new Set(Object.keys(b).map((e) => e.split("@")[0])),
|
|
127
|
+
[b]
|
|
128
|
+
), y = z(() => {
|
|
129
|
+
const e = h.trim().toLowerCase();
|
|
130
|
+
return e ? l.filter(
|
|
131
|
+
(o) => o.title.toLowerCase().includes(e) || o.description.toLowerCase().includes(e)
|
|
132
|
+
) : l;
|
|
133
|
+
}, [l, h]), R = (e) => {
|
|
134
|
+
const o = (s || "").trim();
|
|
135
|
+
o && (u(J({ roomJID: `${e.name}@${o}` })), x && u(G(void 0)));
|
|
136
|
+
}, M = v < j;
|
|
137
|
+
return /* @__PURE__ */ d(
|
|
138
|
+
V,
|
|
139
|
+
{
|
|
140
|
+
title: t("publicChats.title"),
|
|
141
|
+
onClose: r,
|
|
142
|
+
backLabel: t("action.close"),
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ d(Z, { children: [
|
|
145
|
+
/* @__PURE__ */ a(H, {}),
|
|
146
|
+
/* @__PURE__ */ a(
|
|
147
|
+
K,
|
|
148
|
+
{
|
|
149
|
+
type: "search",
|
|
150
|
+
value: h,
|
|
151
|
+
onChange: (e) => D(e.target.value),
|
|
152
|
+
placeholder: t("publicChats.filter"),
|
|
153
|
+
"aria-label": t("publicChats.filter")
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
] }),
|
|
157
|
+
n === "loading" && /* @__PURE__ */ a(S, { role: "status", children: t("publicChats.loading") }),
|
|
158
|
+
n === "error" && /* @__PURE__ */ d(S, { role: "alert", children: [
|
|
159
|
+
t("publicChats.error"),
|
|
160
|
+
" ",
|
|
161
|
+
/* @__PURE__ */ a("button", { type: "button", onClick: () => {
|
|
162
|
+
f(v);
|
|
163
|
+
}, children: t("search.messages.retry") })
|
|
164
|
+
] }),
|
|
165
|
+
n !== "loading" && n !== "error" && y.length === 0 && /* @__PURE__ */ a(S, { children: h.trim() && M ? t("publicChats.emptyFilterMore") : t("publicChats.empty") }),
|
|
166
|
+
y.length > 0 && /* @__PURE__ */ a(W, { children: y.map((e) => {
|
|
167
|
+
const o = L.has(e.name);
|
|
168
|
+
return /* @__PURE__ */ d(X, { children: [
|
|
169
|
+
/* @__PURE__ */ a(Y, { $src: e.picture, "aria-hidden": "true", children: !e.picture && oe(e) }),
|
|
170
|
+
/* @__PURE__ */ d(ee, { children: [
|
|
171
|
+
/* @__PURE__ */ a("strong", { children: e.title || t("search.messages.chat") }),
|
|
172
|
+
e.description && /* @__PURE__ */ a("span", { children: e.description })
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ a(
|
|
175
|
+
te,
|
|
176
|
+
{
|
|
177
|
+
type: "button",
|
|
178
|
+
$open: o,
|
|
179
|
+
onClick: () => R(e),
|
|
180
|
+
children: t(o ? "publicChats.open" : "publicChats.join")
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
] }, e.name);
|
|
184
|
+
}) }),
|
|
185
|
+
M && n !== "loading" && n !== "error" && /* @__PURE__ */ a(
|
|
186
|
+
re,
|
|
187
|
+
{
|
|
188
|
+
type: "button",
|
|
189
|
+
disabled: n === "loadingMore",
|
|
190
|
+
onClick: () => {
|
|
191
|
+
f(v);
|
|
192
|
+
},
|
|
193
|
+
children: t(n === "loadingMore" ? "search.messages.searching" : "search.messages.loadMore")
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
export {
|
|
201
|
+
le as default
|
|
202
|
+
};
|