@remit/web-client 0.0.348 → 0.0.349
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.
|
@@ -79,7 +79,7 @@ import { junkDestination } from "../../lib/junk-destination";
|
|
|
79
79
|
import { useMailContext } from "../../lib/mail-context";
|
|
80
80
|
import { useMailFreshness } from "../../lib/mail-freshness";
|
|
81
81
|
import { shouldRequestResultCount } from "../../lib/result-count";
|
|
82
|
-
import { junkMailboxIds } from "../../lib/result-folder";
|
|
82
|
+
import { junkMailboxIds, resolveResultFolder } from "../../lib/result-folder";
|
|
83
83
|
import { rowToSearchResult } from "../../lib/search-result";
|
|
84
84
|
import { showInlineSearchResults } from "../../lib/search-surface";
|
|
85
85
|
import { parseSearchTokens } from "../../lib/search-tokens";
|
|
@@ -377,7 +377,10 @@ export function DailyBrief({ accounts, selectedMessageId, onOpenThread, commands
|
|
|
377
377
|
failed: section.failed,
|
|
378
378
|
rows: narrowRows(section.rows),
|
|
379
379
|
})), [sectionRows, narrowRows]);
|
|
380
|
-
const matchRows = useMemo(() => narrowRows(searchRows)
|
|
380
|
+
const matchRows = useMemo(() => narrowRows(searchRows).map((row) => {
|
|
381
|
+
const { folder } = resolveResultFolder(resultFolderIndex, row.mailboxId ? [row.mailboxId] : []);
|
|
382
|
+
return folder ? { ...row, folder } : row;
|
|
383
|
+
}), [searchRows, narrowRows, resultFolderIndex]);
|
|
381
384
|
// Each section answers for itself, so a retry is that section's own request.
|
|
382
385
|
const retrySection = useCallback((sectionId) => {
|
|
383
386
|
sectionRows.find((section) => section.category === sectionId)?.retry();
|
|
@@ -85,17 +85,27 @@ export function MailSidebarAdapter({ accounts, onMailboxSelect, variant = "deskt
|
|
|
85
85
|
// before its label is known. A failed label list leaves the tree whole.
|
|
86
86
|
const { labels, isPending: labelsPending, isError: labelsFailed, } = useLabelList(accounts[0]?.accountId);
|
|
87
87
|
const labelsSettled = !labelsPending || labelsFailed;
|
|
88
|
-
const navLabels = useMemo(() =>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
const navLabels = useMemo(() => {
|
|
89
|
+
const unseenByMailbox = new Map(mailboxQueries.flatMap((query) => (query.data?.items ?? []).map((mb) => [mb.mailboxId, mb.unseenCount])));
|
|
90
|
+
return labels.map((label) => {
|
|
91
|
+
const unseen = label.folders.reduce((sum, folder) => folder.state === "Missing"
|
|
92
|
+
? sum
|
|
93
|
+
: sum + (unseenByMailbox.get(folder.mailboxId) ?? 0), 0);
|
|
94
|
+
return {
|
|
95
|
+
id: labelNavId(label.labelId),
|
|
96
|
+
name: label.name,
|
|
97
|
+
color: label.color,
|
|
98
|
+
unseen: unseen > 0 ? unseen : undefined,
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
}, [labels, mailboxQueries]);
|
|
93
102
|
const { data: outboxResponse } = useQuery(outboxOperationsListOutboxMessagesOptions());
|
|
94
103
|
const outboxPendingCount = useMemo(() => (outboxResponse?.items ?? []).filter((item) => isOutboxListRow(item.status)).length, [outboxResponse?.items]);
|
|
95
104
|
const navAccounts = useMemo(() => {
|
|
96
105
|
return accounts.map((account, i) => {
|
|
97
106
|
const query = mailboxQueries[i];
|
|
98
|
-
const
|
|
107
|
+
const allMailboxes = query?.data?.items ?? [];
|
|
108
|
+
const mailboxes = withoutLabelFolders(allMailboxes, labels);
|
|
99
109
|
const roleMap = buildMailboxRoleMap(account.folderAppointments);
|
|
100
110
|
const { system, labels: folders } = sortMailboxes(mailboxes, roleMap, translator);
|
|
101
111
|
const status = query?.isError
|
|
@@ -107,6 +117,7 @@ export function MailSidebarAdapter({ accounts, onMailboxSelect, variant = "deskt
|
|
|
107
117
|
id: account.accountId,
|
|
108
118
|
label: account.email,
|
|
109
119
|
email: account.email,
|
|
120
|
+
hierarchyDelimiter: allMailboxes[0]?.hierarchyDelimiter ?? "",
|
|
110
121
|
muted: Boolean(account.muted),
|
|
111
122
|
// Outbox is a shared singleton shown inside each account's section,
|
|
112
123
|
// matching existing sidebar behaviour.
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { provenanceFolderLabel } from "@remit/ui";
|
|
2
2
|
import { buildMailboxRoleMap } from "./folder-roles.js";
|
|
3
3
|
export const EMPTY_RESULT_FOLDER_INDEX = new Map();
|
|
4
|
+
function isLabelFolderPath({ fullPath, hierarchyDelimiter, }) {
|
|
5
|
+
return fullPath
|
|
6
|
+
.split(hierarchyDelimiter)
|
|
7
|
+
.some((segment) => segment.endsWith("_remit"));
|
|
8
|
+
}
|
|
4
9
|
/**
|
|
5
10
|
* The appointments and the mailbox list arrive from two different queries, so
|
|
6
11
|
* the roles are seeded first and the provider paths laid over them. A role on
|
|
@@ -14,6 +19,8 @@ export function buildResultFolderIndex(accounts) {
|
|
|
14
19
|
for (const [mailboxId, role] of roles)
|
|
15
20
|
index.set(mailboxId, { role });
|
|
16
21
|
for (const mailbox of account.mailboxes) {
|
|
22
|
+
if (isLabelFolderPath(mailbox))
|
|
23
|
+
continue;
|
|
17
24
|
const role = roles.get(mailbox.mailboxId);
|
|
18
25
|
const path = {
|
|
19
26
|
providerPath: mailbox.fullPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remit/web-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.349",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Remit web client, published as composable primitives — the app shell, auth shells, and runtime config. A distributor imports what it composes and bundles it.",
|
|
6
6
|
"exports": {
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@hookform/resolvers": "5.4.0",
|
|
94
|
-
"@remit/ui": "0.0.
|
|
94
|
+
"@remit/ui": "0.0.240",
|
|
95
95
|
"@tanstack/react-query": "5.101.2",
|
|
96
96
|
"@tanstack/react-query-devtools": "5.101.2",
|
|
97
97
|
"@tanstack/react-router": "1.170.18",
|