@remit/web-client 0.0.346 → 0.0.348
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/src/components/mail/BriefPane.js +3 -3
- package/dist/src/components/mail/CheckAgainProvider.d.ts +30 -0
- package/dist/src/components/mail/CheckAgainProvider.js +194 -0
- package/dist/src/components/mail/{FlaggedList.d.ts → CollectionList.d.ts} +7 -3
- package/dist/src/components/mail/{FlaggedList.js → CollectionList.js} +29 -24
- package/dist/src/components/mail/CollectionPane.d.ts +32 -0
- package/dist/src/components/mail/{FlaggedPane.js → CollectionPane.js} +35 -33
- package/dist/src/components/mail/ConversationView.d.ts +7 -8
- package/dist/src/components/mail/ConversationView.js +4 -4
- package/dist/src/components/mail/DailyBrief.js +6 -4
- package/dist/src/components/mail/IntelligencePane.d.ts +2 -2
- package/dist/src/components/mail/IntelligencePane.js +33 -4
- package/dist/src/components/mail/MailSidebarAdapter.js +29 -7
- package/dist/src/components/mail/MailboxPane.js +10 -12
- package/dist/src/components/mail/MessageActionMenu.d.ts +3 -1
- package/dist/src/components/mail/MessageActionMenu.js +3 -3
- package/dist/src/components/mail/MessageCard.js +9 -1
- package/dist/src/components/mail/MessageList.js +11 -2
- package/dist/src/components/mail/MessageListItem.d.ts +4 -2
- package/dist/src/components/mail/MessageListItem.js +4 -6
- package/dist/src/components/mail/SpamBannerSlot.d.ts +10 -0
- package/dist/src/components/mail/SpamBannerSlot.js +56 -0
- package/dist/src/components/mail/SwipeableMessageRow.d.ts +3 -2
- package/dist/src/components/mail/SwipeableMessageRow.js +6 -6
- package/dist/src/components/mail/ThreadListInteraction.d.ts +2 -0
- package/dist/src/components/mail/ThreadListInteraction.js +12 -2
- package/dist/src/components/settings/classification/FailureBanner.js +3 -4
- package/dist/src/components/settings/spam/SpamSettingsPanel.d.ts +6 -0
- package/dist/src/components/settings/spam/SpamSettingsPanel.js +176 -0
- package/dist/src/hooks/{useStarredThreads.d.ts → useCollectionThreads.d.ts} +10 -8
- package/dist/src/hooks/{useStarredThreads.js → useCollectionThreads.js} +16 -14
- package/dist/src/hooks/useCurrentMailboxName.d.ts +1 -0
- package/dist/src/hooks/useCurrentMailboxName.js +6 -1
- package/dist/src/hooks/useIntelligenceData.d.ts +2 -4
- package/dist/src/hooks/useIntelligenceData.js +1 -127
- package/dist/src/hooks/useJunkMailboxIds.d.ts +2 -0
- package/dist/src/hooks/useJunkMailboxIds.js +17 -0
- package/dist/src/hooks/useLabels.d.ts +10 -9
- package/dist/src/hooks/useLabels.js +25 -6
- package/dist/src/lib/brief.d.ts +1 -1
- package/dist/src/lib/brief.js +3 -3
- package/dist/src/lib/check-again.d.ts +33 -0
- package/dist/src/lib/check-again.js +66 -0
- package/dist/src/lib/{flagged-criteria.d.ts → collection-criteria.d.ts} +18 -6
- package/dist/src/lib/{flagged-criteria.js → collection-criteria.js} +4 -3
- package/dist/src/lib/conversation-target.d.ts +3 -2
- package/dist/src/lib/label-folders.d.ts +6 -0
- package/dist/src/lib/label-folders.js +10 -0
- package/dist/src/lib/mail-route.d.ts +10 -5
- package/dist/src/lib/mail-route.js +9 -1
- package/dist/src/lib/mail-search.d.ts +11 -0
- package/dist/src/lib/mail-search.js +4 -0
- package/dist/src/lib/search-scope.d.ts +2 -2
- package/dist/src/lib/search-scope.js +4 -4
- package/dist/src/lib/search-tokens.d.ts +1 -1
- package/dist/src/lib/search-tokens.js +2 -2
- package/dist/src/lib/spam-overview.d.ts +23 -0
- package/dist/src/lib/spam-overview.js +44 -0
- package/dist/src/lib/spam.d.ts +32 -0
- package/dist/src/lib/spam.js +38 -0
- package/dist/src/lib/thread-search-tokens.js +3 -1
- package/dist/src/routeTree.gen.d.ts +312 -5
- package/dist/src/routeTree.gen.js +72 -0
- package/dist/src/routes/__root.js +2 -1
- package/dist/src/routes/mail/flagged/$threadId/$messageId.js +2 -2
- package/dist/src/routes/mail/flagged/$threadId/index.js +2 -2
- package/dist/src/routes/mail/flagged/index.js +2 -2
- package/dist/src/routes/mail/flagged.js +3 -2
- package/dist/src/routes/mail/label/$labelId/$threadId/$messageId/$mode.{-$outboxMessageId}.d.ts +18 -0
- package/dist/src/routes/mail/label/$labelId/$threadId/$messageId/$mode.{-$outboxMessageId}.js +8 -0
- package/dist/src/routes/mail/label/$labelId/$threadId/$messageId.d.ts +15 -0
- package/dist/src/routes/mail/label/$labelId/$threadId/$messageId.js +14 -0
- package/dist/src/routes/mail/label/$labelId/$threadId/index.d.ts +15 -0
- package/dist/src/routes/mail/label/$labelId/$threadId/index.js +9 -0
- package/dist/src/routes/mail/label/$labelId/$threadId.d.ts +15 -0
- package/dist/src/routes/mail/label/$labelId/$threadId.js +8 -0
- package/dist/src/routes/mail/label/$labelId/compose.{-$outboxMessageId}.d.ts +15 -0
- package/dist/src/routes/mail/label/$labelId/compose.{-$outboxMessageId}.js +10 -0
- package/dist/src/routes/mail/label/$labelId/index.d.ts +15 -0
- package/dist/src/routes/mail/label/$labelId/index.js +9 -0
- package/dist/src/routes/mail/label/$labelId.d.ts +15 -0
- package/dist/src/routes/mail/label/$labelId.js +30 -0
- package/dist/src/routes/mail/label/index.d.ts +29 -0
- package/dist/src/routes/mail/label/index.js +18 -0
- package/dist/src/routes/settings/filters.d.ts +6 -2
- package/dist/src/routes/settings/filters.js +10 -3
- package/dist/src/routes/settings/senders.d.ts +14 -2
- package/dist/src/routes/settings/senders.js +32 -15
- package/dist/src/routes/settings/spam.d.ts +1 -0
- package/dist/src/routes/settings/spam.js +15 -0
- package/dist/src/routes/settings.js +6 -1
- package/dist/src/routing/browsed-list.d.ts +1 -1
- package/dist/src/routing/browsed-list.js +15 -4
- package/dist/src/routing/compose.js +10 -6
- package/dist/src/routing/index.d.ts +1 -1
- package/dist/src/routing/index.js +1 -1
- package/dist/src/routing/nav-selection.d.ts +5 -0
- package/dist/src/routing/nav-selection.js +15 -0
- package/dist/src/routing/open-thread.js +23 -3
- package/dist/src/routing/reply.js +28 -11
- package/dist/src/routing/search-mirror.d.ts +5 -0
- package/dist/src/routing/search-mirror.js +20 -2
- package/dist/src/routing/spam-link.d.ts +3 -0
- package/dist/src/routing/spam-link.js +12 -0
- package/package.json +2 -2
- package/dist/src/components/mail/AuthenticityBanner.d.ts +0 -14
- package/dist/src/components/mail/AuthenticityBanner.js +0 -18
- package/dist/src/components/mail/FlaggedPane.d.ts +0 -29
|
@@ -29,8 +29,8 @@ export function routeMailboxId(browsed) {
|
|
|
29
29
|
/**
|
|
30
30
|
* The scope of the active route.
|
|
31
31
|
*
|
|
32
|
-
* `mailboxName` is the sidebar's own
|
|
33
|
-
* `useCurrentMailboxName`). Until it resolves the scope is `pending`: no chip,
|
|
32
|
+
* `mailboxName` is the sidebar's own name for the mailbox or label route
|
|
33
|
+
* (resolved by `useCurrentMailboxName`). Until it resolves the scope is `pending`: no chip,
|
|
34
34
|
* because a chip reading a raw uuid is worse than none, but not `global`
|
|
35
35
|
* either, because the list underneath is already narrowed.
|
|
36
36
|
*/
|
|
@@ -47,7 +47,7 @@ export function searchScopeForRoute(browsed, mailboxName) {
|
|
|
47
47
|
chip: { id: SEARCH_SCOPE_CHIP_ID, label: "in:outbox" },
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
if (browsed.list === "mailbox") {
|
|
50
|
+
if (browsed.list === "mailbox" || browsed.list === "label") {
|
|
51
51
|
if (!mailboxName)
|
|
52
52
|
return { kind: "pending" };
|
|
53
53
|
return {
|
|
@@ -80,7 +80,7 @@ export function searchScopeForRoute(browsed, mailboxName) {
|
|
|
80
80
|
export function resultsScopeForRoute(browsed, state, role) {
|
|
81
81
|
if (state.kind === "global")
|
|
82
82
|
return { kind: "global" };
|
|
83
|
-
if (browsed.list === "flagged")
|
|
83
|
+
if (browsed.list === "flagged" || browsed.list === "label")
|
|
84
84
|
return { kind: "collection" };
|
|
85
85
|
return { kind: "folder", ...(role ? { role } : {}) };
|
|
86
86
|
}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
*
|
|
36
36
|
* Pure functions only: no React, no fetch — the name index is injected, not
|
|
37
37
|
* fetched here. `MailListHeader` renders the chips and the callers that issue
|
|
38
|
-
* search requests (`MailboxPane`, `DailyBrief`, `
|
|
38
|
+
* search requests (`MailboxPane`, `DailyBrief`, `CollectionList`) apply the
|
|
39
39
|
* parsed tokens to the params each engine's API actually supports.
|
|
40
40
|
*/
|
|
41
41
|
import type { RemitImapMessageCategory } from "@remit/api-http-client/types.gen.ts";
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
*
|
|
36
36
|
* Pure functions only: no React, no fetch — the name index is injected, not
|
|
37
37
|
* fetched here. `MailListHeader` renders the chips and the callers that issue
|
|
38
|
-
* search requests (`MailboxPane`, `DailyBrief`, `
|
|
38
|
+
* search requests (`MailboxPane`, `DailyBrief`, `CollectionList`) apply the
|
|
39
39
|
* parsed tokens to the params each engine's API actually supports.
|
|
40
40
|
*/
|
|
41
41
|
import { MessageCategory } from "@remit/domain-enums";
|
|
@@ -98,7 +98,7 @@ export function resolveCategory(value) {
|
|
|
98
98
|
const alias = CATEGORY_ALIASES[lower];
|
|
99
99
|
if (alias)
|
|
100
100
|
return alias;
|
|
101
|
-
const known = Object.values(MessageCategory).find((c) => c === lower);
|
|
101
|
+
const known = Object.values(MessageCategory).find((c) => c.toLowerCase() === lower);
|
|
102
102
|
return known;
|
|
103
103
|
}
|
|
104
104
|
function parseStateToken(raw, value) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RemitImapClassifierStats } from "@remit/api-http-client/types.gen.ts";
|
|
2
|
+
import type { SpamDay } from "@remit/ui";
|
|
3
|
+
export declare const SPAM_OVERVIEW_DAYS = 30;
|
|
4
|
+
/**
|
|
5
|
+
* Local midnight `days - 1` days before `now`, as an ISO 8601 date-time with
|
|
6
|
+
* the reader's zone offset: the stats bucket arrival days in the zone of
|
|
7
|
+
* `since`, so the chart's days are the reader's days.
|
|
8
|
+
*/
|
|
9
|
+
export declare const spamOverviewSince: (now: Date, days?: number) => string;
|
|
10
|
+
/** Every day of the window, oldest first, as the stats name them. */
|
|
11
|
+
export declare const overviewDays: (now: Date, days?: number) => string[];
|
|
12
|
+
export interface SpamOverview {
|
|
13
|
+
checkedAny: boolean;
|
|
14
|
+
moved: number;
|
|
15
|
+
warned: number;
|
|
16
|
+
spam: SpamDay[];
|
|
17
|
+
phishing: SpamDay[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One bar per day for each kind. A day the stats leave out had no verdicts,
|
|
21
|
+
* so it draws as an empty bar rather than closing the gap.
|
|
22
|
+
*/
|
|
23
|
+
export declare const buildSpamOverview: (stats: Pick<RemitImapClassifierStats, "spamByDay" | "spamScoreBands">, days: readonly string[]) => SpamOverview;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const SPAM_OVERVIEW_DAYS = 30;
|
|
2
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
3
|
+
const localDay = (date) => `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
4
|
+
const zoneOffset = (date) => {
|
|
5
|
+
const minutes = -date.getTimezoneOffset();
|
|
6
|
+
const sign = minutes >= 0 ? "+" : "-";
|
|
7
|
+
const abs = Math.abs(minutes);
|
|
8
|
+
return `${sign}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Local midnight `days - 1` days before `now`, as an ISO 8601 date-time with
|
|
12
|
+
* the reader's zone offset: the stats bucket arrival days in the zone of
|
|
13
|
+
* `since`, so the chart's days are the reader's days.
|
|
14
|
+
*/
|
|
15
|
+
export const spamOverviewSince = (now, days = SPAM_OVERVIEW_DAYS) => {
|
|
16
|
+
const start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - (days - 1));
|
|
17
|
+
return `${localDay(start)}T00:00:00${zoneOffset(start)}`;
|
|
18
|
+
};
|
|
19
|
+
/** Every day of the window, oldest first, as the stats name them. */
|
|
20
|
+
export const overviewDays = (now, days = SPAM_OVERVIEW_DAYS) => Array.from({ length: days }, (_, i) => localDay(new Date(now.getFullYear(), now.getMonth(), now.getDate() - (days - 1 - i))));
|
|
21
|
+
/**
|
|
22
|
+
* One bar per day for each kind. A day the stats leave out had no verdicts,
|
|
23
|
+
* so it draws as an empty bar rather than closing the gap.
|
|
24
|
+
*/
|
|
25
|
+
export const buildSpamOverview = (stats, days) => {
|
|
26
|
+
const daysOf = (kind) => days.map((date) => {
|
|
27
|
+
const count = (action) => stats.spamByDay
|
|
28
|
+
.filter((entry) => entry.date === date &&
|
|
29
|
+
entry.kind === kind &&
|
|
30
|
+
entry.action === action)
|
|
31
|
+
.reduce((sum, entry) => sum + entry.count, 0);
|
|
32
|
+
return { date, moved: count("Junk"), warned: count("Warn") };
|
|
33
|
+
});
|
|
34
|
+
const spam = daysOf("Spam");
|
|
35
|
+
const phishing = daysOf("Phishing");
|
|
36
|
+
const total = (pick) => [...spam, ...phishing].reduce((sum, day) => sum + pick(day), 0);
|
|
37
|
+
return {
|
|
38
|
+
checkedAny: stats.spamScoreBands.some((band) => band.count > 0),
|
|
39
|
+
moved: total((day) => day.moved),
|
|
40
|
+
warned: total((day) => day.warned),
|
|
41
|
+
spam,
|
|
42
|
+
phishing,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { RemitImapLabelSummaryResponse, RemitImapMessageSpamVerdict, RemitImapSpamChecked } from "@remit/api-http-client/types.gen.ts";
|
|
2
|
+
import type { ThreadRowSpam } from "@remit/ui";
|
|
3
|
+
/**
|
|
4
|
+
* The Remit Spam or Phishing label the message carries, found by name. The
|
|
5
|
+
* label, not the verdict, says Remit flagged the message: Not spam removes it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const remitSpamLabel: (labels: readonly RemitImapLabelSummaryResponse[] | undefined) => RemitImapLabelSummaryResponse | undefined;
|
|
8
|
+
/** A checked verdict that warned about the message or sent it to Spam. */
|
|
9
|
+
export declare const flaggedVerdict: (verdict: RemitImapMessageSpamVerdict) => (RemitImapSpamChecked & {
|
|
10
|
+
action: "Warn" | "Junk";
|
|
11
|
+
}) | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The row's one spam mark: the Remit label it carries, suspected while the
|
|
14
|
+
* message sits outside a Spam folder. A message the reader cleared carries none.
|
|
15
|
+
*/
|
|
16
|
+
export declare const spamRowMark: (row: {
|
|
17
|
+
mailboxId: string;
|
|
18
|
+
spamCleared: boolean;
|
|
19
|
+
labels?: RemitImapLabelSummaryResponse[];
|
|
20
|
+
}, junkMailboxIds: ReadonlySet<string>) => ThreadRowSpam | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the message view raises the spam banner and the rail for it: a
|
|
23
|
+
* failed check, or a Remit label on a message outside Spam, unless the reader
|
|
24
|
+
* cleared it with Not spam.
|
|
25
|
+
*/
|
|
26
|
+
export declare const raisesSpamWarning: (row: {
|
|
27
|
+
spamVerdict: RemitImapMessageSpamVerdict;
|
|
28
|
+
spamCleared: boolean;
|
|
29
|
+
labels?: RemitImapLabelSummaryResponse[];
|
|
30
|
+
}, inSpamFolder: boolean) => boolean;
|
|
31
|
+
export declare const spamReportHref: (title: string, detail: string) => string;
|
|
32
|
+
export declare const unknownReasonReportHref: (symbol: string) => string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { buildBugReportContext, buildGitHubIssueUrl } from "./bug-report";
|
|
2
|
+
const SPAM_KINDS = ["Phishing", "Spam"];
|
|
3
|
+
/**
|
|
4
|
+
* The Remit Spam or Phishing label the message carries, found by name. The
|
|
5
|
+
* label, not the verdict, says Remit flagged the message: Not spam removes it.
|
|
6
|
+
*/
|
|
7
|
+
export const remitSpamLabel = (labels) => SPAM_KINDS.flatMap((kind) => labels?.filter((label) => label.name === kind) ?? [])[0];
|
|
8
|
+
/** A checked verdict that warned about the message or sent it to Spam. */
|
|
9
|
+
export const flaggedVerdict = (verdict) => verdict.state === "Checked" && verdict.action !== "None"
|
|
10
|
+
? { ...verdict, action: verdict.action }
|
|
11
|
+
: undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The row's one spam mark: the Remit label it carries, suspected while the
|
|
14
|
+
* message sits outside a Spam folder. A message the reader cleared carries none.
|
|
15
|
+
*/
|
|
16
|
+
export const spamRowMark = (row, junkMailboxIds) => {
|
|
17
|
+
if (row.spamCleared)
|
|
18
|
+
return undefined;
|
|
19
|
+
const label = remitSpamLabel(row.labels);
|
|
20
|
+
if (!label)
|
|
21
|
+
return undefined;
|
|
22
|
+
return { label, suspected: !junkMailboxIds.has(row.mailboxId) };
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Whether the message view raises the spam banner and the rail for it: a
|
|
26
|
+
* failed check, or a Remit label on a message outside Spam, unless the reader
|
|
27
|
+
* cleared it with Not spam.
|
|
28
|
+
*/
|
|
29
|
+
export const raisesSpamWarning = (row, inSpamFolder) => !row.spamCleared &&
|
|
30
|
+
(row.spamVerdict.state === "Failed" ||
|
|
31
|
+
(remitSpamLabel(row.labels) !== undefined &&
|
|
32
|
+
row.spamVerdict.state === "Checked" &&
|
|
33
|
+
!inSpamFolder));
|
|
34
|
+
export const spamReportHref = (title, detail) => buildGitHubIssueUrl(buildBugReportContext({
|
|
35
|
+
title: `Spam check: ${title}`,
|
|
36
|
+
errorMessage: `${title}. ${detail}`,
|
|
37
|
+
}));
|
|
38
|
+
export const unknownReasonReportHref = (symbol) => spamReportHref(`Unknown spam reason ${symbol}`, `The spam check named ${symbol}, which this version has no sentence for.`);
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
* nothing — which is the honest answer to a contradiction).
|
|
23
23
|
*/
|
|
24
24
|
import { matchesSearchTokens, toThreadRowData } from "./brief.js";
|
|
25
|
+
/** Search tokens read no spam mark, so the row needs no Spam folders. */
|
|
26
|
+
const NO_SPAM_FOLDERS = new Set();
|
|
25
27
|
/**
|
|
26
28
|
* Every parameter `searchThreads` takes, the default set.
|
|
27
29
|
*
|
|
@@ -110,7 +112,7 @@ export function applyResidualTokens(threads, residual, accountId) {
|
|
|
110
112
|
return threads;
|
|
111
113
|
const tokens = [...residual];
|
|
112
114
|
return threads.filter((thread) => {
|
|
113
|
-
const row = toThreadRowData(thread);
|
|
115
|
+
const row = toThreadRowData(thread, NO_SPAM_FOLDERS);
|
|
114
116
|
return matchesSearchTokens({ ...row, accountId: row.accountId ?? accountId }, tokens);
|
|
115
117
|
});
|
|
116
118
|
}
|