@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RemitImapThreadMessageResponse } from "@remit/api-http-client/types.gen.ts";
|
|
2
2
|
interface ConversationViewProps {
|
|
3
3
|
threadId: string;
|
|
4
4
|
mailboxId: string;
|
|
@@ -10,14 +10,13 @@ interface ConversationViewProps {
|
|
|
10
10
|
*/
|
|
11
11
|
selectedMessageId?: string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* body with a "Why?" link that opens the intelligence sidebar.
|
|
13
|
+
* The row the reader opened. Its spam verdict decides the banner between
|
|
14
|
+
* the header and the body.
|
|
16
15
|
*/
|
|
17
|
-
|
|
16
|
+
spamRow?: RemitImapThreadMessageResponse;
|
|
18
17
|
/**
|
|
19
|
-
* Callback for
|
|
20
|
-
*
|
|
18
|
+
* Callback for Why on the spam banner — opens / focuses the intelligence
|
|
19
|
+
* sidebar.
|
|
21
20
|
*/
|
|
22
21
|
onOpenIntelligence?: () => void;
|
|
23
22
|
/**
|
|
@@ -48,5 +47,5 @@ interface ConversationViewProps {
|
|
|
48
47
|
*/
|
|
49
48
|
listOnScreen?: boolean;
|
|
50
49
|
}
|
|
51
|
-
export declare const ConversationView: ({ threadId, mailboxId, subject, selectedMessageId,
|
|
50
|
+
export declare const ConversationView: ({ threadId, mailboxId, subject, selectedMessageId, spamRow, onOpenIntelligence, onBack, onSwipeNext, onSwipePrevious, mobileIntelligenceOpen, listOnScreen, }: ConversationViewProps) => import("react").JSX.Element;
|
|
52
51
|
export {};
|
|
@@ -10,12 +10,12 @@ import { useIsDesktop } from "../../hooks/useMediaQuery";
|
|
|
10
10
|
import { useToggleStar } from "../../hooks/useToggleStar";
|
|
11
11
|
import { useOpenReply, useReplySurface } from "../../routing";
|
|
12
12
|
import { ConversationCompose } from "../compose/ConversationCompose";
|
|
13
|
-
import { AuthenticityBanner } from "./AuthenticityBanner";
|
|
14
13
|
import { MessageCard } from "./MessageCard";
|
|
14
|
+
import { SpamBannerSlot } from "./SpamBannerSlot";
|
|
15
15
|
const LoadingSkeleton = () => (_jsxs("div", { className: "animate-pulse p-4", children: [_jsx("div", { className: "h-6 bg-surface-sunken rounded w-3/4 mb-5" }), _jsx("div", { className: "space-y-4", children: Array.from({ length: 2 }).map((_, i) => (
|
|
16
16
|
// biome-ignore lint/suspicious/noArrayIndexKey: list is static, no stable id
|
|
17
17
|
_jsxs("div", { className: "flex gap-3 py-3", children: [_jsx("div", { className: "size-10 bg-surface-sunken rounded-full shrink-0" }), _jsxs("div", { className: "flex-1", children: [_jsx("div", { className: "h-4 bg-surface-sunken rounded w-32 mb-2" }), _jsx("div", { className: "h-3 bg-surface-sunken rounded w-48" })] })] }, i))) })] }));
|
|
18
|
-
export const ConversationView = ({ threadId, mailboxId, subject, selectedMessageId,
|
|
18
|
+
export const ConversationView = ({ threadId, mailboxId, subject, selectedMessageId, spamRow, onOpenIntelligence, onBack, onSwipeNext, onSwipePrevious, mobileIntelligenceOpen, listOnScreen = false, }) => {
|
|
19
19
|
const isDesktop = useIsDesktop();
|
|
20
20
|
const { accountId: mailboxAccountId } = useMailboxAccount(mailboxId);
|
|
21
21
|
const { data: messagesResponse, isLoading, isError, error, refetch, } = useQuery({
|
|
@@ -273,7 +273,7 @@ export const ConversationView = ({ threadId, mailboxId, subject, selectedMessage
|
|
|
273
273
|
// drawer). Each expanded card owns its per-message action bar; there is no
|
|
274
274
|
// thread-level reply footer. The phishing warning leads the scroll content.
|
|
275
275
|
if (!isDesktop) {
|
|
276
|
-
return (_jsxs(MobileReadingPane, { thread: { subject: displaySubject, messages: [] }, onBack: onBack ?? (() => undefined), intelligenceOpen: mobileIntelligenceOpen, onToggleIntelligence: onOpenIntelligence, onSwipeNext: onSwipeNext, onSwipePrevious: onSwipePrevious, children: [
|
|
276
|
+
return (_jsxs(MobileReadingPane, { thread: { subject: displaySubject, messages: [] }, onBack: onBack ?? (() => undefined), intelligenceOpen: mobileIntelligenceOpen, onToggleIntelligence: onOpenIntelligence, onSwipeNext: onSwipeNext, onSwipePrevious: onSwipePrevious, children: [spamRow && (_jsx(SpamBannerSlot, { row: spamRow, onOpenIntelligence: onOpenIntelligence })), compose, renderMessages(true)] }));
|
|
277
277
|
}
|
|
278
|
-
return (_jsxs("article", { className: "h-full flex flex-col", children: [header,
|
|
278
|
+
return (_jsxs("article", { className: "h-full flex flex-col", children: [header, spamRow && (_jsx(SpamBannerSlot, { row: spamRow, onOpenIntelligence: onOpenIntelligence })), _jsxs("div", { className: "min-h-0 flex-1 overflow-auto", children: [compose, renderMessages(false)] })] }));
|
|
279
279
|
};
|
|
@@ -64,6 +64,7 @@ import { useCallback, useMemo, useState, } from "react";
|
|
|
64
64
|
import { useJunkMailbox } from "../../hooks/useArchiveMailbox";
|
|
65
65
|
import { useBriefSearchRows, useBriefSections, } from "../../hooks/useBriefSections";
|
|
66
66
|
import { isSyncingPhase, useInitialSyncProgress, } from "../../hooks/useInitialSyncProgress";
|
|
67
|
+
import { useJunkMailboxIds } from "../../hooks/useJunkMailboxIds";
|
|
67
68
|
import { useLabelList } from "../../hooks/useLabels";
|
|
68
69
|
import { useLayoutTier } from "../../hooks/useLayoutTier";
|
|
69
70
|
import { useIsDesktop } from "../../hooks/useMediaQuery";
|
|
@@ -151,7 +152,7 @@ export const resolveBriefSelectionScope = (rows, selectedIds) => {
|
|
|
151
152
|
* `ThreadListInteraction`, so the brief and the mailbox list run one model.
|
|
152
153
|
*/
|
|
153
154
|
function BriefSelectionChrome({ header, rows, wizard, children, }) {
|
|
154
|
-
const { selectedIds, selectedCount, exitSelection, orderedIds, allSelected, toggleAllLoaded, } = useThreadListSelection();
|
|
155
|
+
const { selectedIds, selectedCount, exitSelection, orderedIds, allSelected, toggleAllLoaded, checkAgainSelection, } = useThreadListSelection();
|
|
155
156
|
const scope = useMemo(() => resolveBriefSelectionScope(rows, selectedIds), [rows, selectedIds]);
|
|
156
157
|
const { junkMailboxId } = useJunkMailbox(scope.accountId);
|
|
157
158
|
const { labels } = useLabelList(scope.accountId);
|
|
@@ -175,7 +176,7 @@ function BriefSelectionChrome({ header, rows, wizard, children, }) {
|
|
|
175
176
|
const notice = scope.moveDisabledHint
|
|
176
177
|
? { tone: "warning", text: scope.moveDisabledHint }
|
|
177
178
|
: undefined;
|
|
178
|
-
const selectionBar = (chrome) => (_jsx(SelectionTopBar, { title: chrome.title, navSlot: chrome.navSlot, titleMeta: chrome.titleMeta, searchSlot: chrome.searchSlot, searchField: chrome.searchField, idleSlot: chrome.makeFilterSlot, count: selectedCount, onCancel: exitSelection, onDelete: () => wizard.start("delete"), onMove: () => wizard.start("move"), onOrganize: () => wizard.start("organize"), onJunk: junkDestinationId ? () => wizard.start("junk") : undefined, onMarkRead: () => wizard.start("markRead"), overflowSlot: scope.accountId &&
|
|
179
|
+
const selectionBar = (chrome) => (_jsx(SelectionTopBar, { title: chrome.title, navSlot: chrome.navSlot, titleMeta: chrome.titleMeta, searchSlot: chrome.searchSlot, searchField: chrome.searchField, idleSlot: chrome.makeFilterSlot, count: selectedCount, onCancel: exitSelection, onDelete: () => wizard.start("delete"), onMove: () => wizard.start("move"), onOrganize: () => wizard.start("organize"), onJunk: junkDestinationId ? () => wizard.start("junk") : undefined, onMarkRead: () => wizard.start("markRead"), onCheckAgain: checkAgainSelection, overflowSlot: scope.accountId &&
|
|
179
180
|
scope.mailboxId &&
|
|
180
181
|
selectedCount > 0 &&
|
|
181
182
|
labels.length > 0 ? (_jsx(LabelApplyTrigger, { accountId: scope.accountId, mailboxId: scope.mailboxId, messageIds: selectedMessageIds })) : undefined, selectAll: selectAll, notice: notice }));
|
|
@@ -357,6 +358,7 @@ export function DailyBrief({ accounts, selectedMessageId, onOpenThread, commands
|
|
|
357
358
|
// pill, mute, the free text, `from:` and `subject:` — was answered over the
|
|
358
359
|
// whole scope by the request itself, and the order the rows arrived in is
|
|
359
360
|
// kept: narrowing never re-sorts.
|
|
361
|
+
const spamFolderIds = useJunkMailboxIds();
|
|
360
362
|
const clientOnlyFilters = useMemo(() => briefClientOnlyFilters(requestFilters), [requestFilters]);
|
|
361
363
|
const narrowRows = useCallback((rows) =>
|
|
362
364
|
// One row per conversation, because that is what the server counted:
|
|
@@ -364,9 +366,9 @@ export function DailyBrief({ accounts, selectedMessageId, onOpenThread, commands
|
|
|
364
366
|
// rows under a header reading one. Collapsed before anything reads a
|
|
365
367
|
// length, so the rows and the number are the same unit.
|
|
366
368
|
dedupeByThread(rows)
|
|
367
|
-
.map(toThreadRowData)
|
|
369
|
+
.map((thread) => toThreadRowData(thread, spamFolderIds))
|
|
368
370
|
.filter((t) => matchesBriefFilters(t, clientOnlyFilters) &&
|
|
369
|
-
matchesSearchTokens(t, residualTokens)), [clientOnlyFilters, residualTokens]);
|
|
371
|
+
matchesSearchTokens(t, residualTokens)), [clientOnlyFilters, residualTokens, spamFolderIds]);
|
|
370
372
|
const briefRows = useMemo(() => sectionRows.map((section) => ({
|
|
371
373
|
category: section.category,
|
|
372
374
|
total: section.total,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RemitImapThreadMessageResponse } from "@remit/api-http-client/types.gen.ts";
|
|
2
|
-
import { type
|
|
2
|
+
import { type SpamQuickAction } from "@remit/ui";
|
|
3
3
|
import type { OpenThreadTarget } from "../../routing";
|
|
4
4
|
import type { ReplyWithText } from "../compose/reply-with-times";
|
|
5
5
|
export interface IntelligencePaneProps {
|
|
@@ -45,7 +45,7 @@ export interface IntelligencePaneProps {
|
|
|
45
45
|
*/
|
|
46
46
|
export declare const resolveSpamAction: (thread: {
|
|
47
47
|
spamReport?: unknown;
|
|
48
|
-
}, inJunk: boolean) =>
|
|
48
|
+
}, inJunk: boolean) => SpamQuickAction;
|
|
49
49
|
/**
|
|
50
50
|
* Pane 4 of the 4-pane shell: the intelligence sidebar. Wired to real data via
|
|
51
51
|
* `useIntelligenceData`; renders the `IntelligencePanel` from `@remit/ui`.
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { threadDetailOperationsListThreadMessagesOptions } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
|
|
3
|
-
import { CATEGORY_PRESENTATION, categoryLabels, DialogBackdrop, IntelligencePanel, useModalFocus, } from "@remit/ui";
|
|
2
|
+
import { threadDetailOperationsListThreadMessagesOptions, userSettingsOperationsGetUserSettingsOptions, } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
|
|
3
|
+
import { CATEGORY_PRESENTATION, categoryLabels, DialogBackdrop, IntelligencePanel, SpamVerdictPanel, useModalFocus, } from "@remit/ui";
|
|
4
4
|
import { Sparkles } from "@remit/ui/icons";
|
|
5
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { useJunkMailbox } from "../../hooks/useArchiveMailbox";
|
|
8
|
+
import { useFilterList } from "../../hooks/useFilters";
|
|
8
9
|
import { useIntelligenceCalendar } from "../../hooks/useIntelligenceCalendar";
|
|
9
10
|
import { useIntelligenceData } from "../../hooks/useIntelligenceData";
|
|
10
11
|
import { useReportSpam } from "../../hooks/useReportSpam";
|
|
11
12
|
import { useUpdateAddressFlags } from "../../hooks/useUpdateAddressFlags";
|
|
13
|
+
import { softErrorStatuses } from "../../lib/error-classifier";
|
|
12
14
|
import { isRescueCandidate } from "../../lib/rescue-candidates";
|
|
13
15
|
import { recordRescueSentToJunk } from "../../lib/rescue-telemetry";
|
|
16
|
+
import { remitSpamLabel, unknownReasonReportHref } from "../../lib/spam";
|
|
14
17
|
import { useTelemetry } from "../../lib/telemetry-context";
|
|
18
|
+
import { SpamVerdictLink } from "../../routing/spam-link";
|
|
15
19
|
const isCategoryOverride = (category) => category !== "uncategorized";
|
|
16
20
|
const CATEGORY_OVERRIDES = CATEGORY_PRESENTATION.map((entry) => entry.category).filter(isCategoryOverride);
|
|
17
21
|
/**
|
|
@@ -50,6 +54,31 @@ function ReclassifyDialog({ isOpen, current, hasOverride, onSelect, onClear, onC
|
|
|
50
54
|
return null;
|
|
51
55
|
return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [_jsx(DialogBackdrop, { label: "Dismiss reclassify sender", onDismiss: onCancel, className: "backdrop-blur-sm" }), _jsxs("div", { ref: dialogRef, role: "dialog", "aria-modal": "true", "aria-label": "Reclassify sender", tabIndex: -1, className: "relative z-10 w-full max-w-sm rounded-sm border border-line bg-surface p-6 shadow-lg", children: [_jsx("h2", { className: "text-lg font-semibold", children: "Reclassify this sender" }), _jsx("p", { className: "mt-2 text-sm text-fg-muted", children: "Set a category override for future messages from this sender." }), _jsxs("div", { className: "mt-4 flex flex-col gap-1", children: [CATEGORY_OVERRIDES.map((cat) => (_jsxs("button", { type: "button", onClick: () => onSelect(cat), className: `flex min-h-11 items-center justify-between rounded px-3 text-left text-sm transition-colors hover:bg-surface-raised ${cat === current ? "font-semibold text-accent" : "text-fg"}`, children: [categoryLabels[cat], cat === current && (_jsx("span", { className: "text-2xs text-fg-subtle", children: "current" }))] }, cat))), hasOverride && (_jsx("button", { type: "button", onClick: onClear, className: "mt-1 flex min-h-11 items-center rounded border-t border-line px-3 text-left text-sm text-fg transition-colors hover:bg-surface-raised", children: "Remove override \u2014 classify automatically again" }))] }), _jsx("div", { className: "mt-6 flex justify-end", children: _jsx("button", { type: "button", onClick: onCancel, className: "inline-flex min-h-11 items-center justify-center rounded border border-line px-4 text-sm font-medium transition-colors hover:bg-surface-raised", children: "Cancel" }) })] })] }));
|
|
52
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The rail's Spam check section: the verdict the message carries, or the
|
|
59
|
+
* one a Check again just returned, against the thresholds in effect.
|
|
60
|
+
*/
|
|
61
|
+
function SpamCheckSection({ thread, accountId, onNotSpam, }) {
|
|
62
|
+
const verdict = thread.spamVerdict;
|
|
63
|
+
if (verdict.state === "NotChecked")
|
|
64
|
+
return null;
|
|
65
|
+
return (_jsx(SpamVerdictSection, { thread: thread, verdict: verdict, accountId: accountId, onNotSpam: onNotSpam }));
|
|
66
|
+
}
|
|
67
|
+
function SpamVerdictSection({ thread, verdict, accountId, onNotSpam, }) {
|
|
68
|
+
const settings = useQuery({
|
|
69
|
+
...userSettingsOperationsGetUserSettingsOptions(),
|
|
70
|
+
meta: softErrorStatuses(403),
|
|
71
|
+
});
|
|
72
|
+
const filterId = verdict.state === "ScreenedOut" && verdict.screen.rule === "Filter"
|
|
73
|
+
? verdict.screen.filterId
|
|
74
|
+
: undefined;
|
|
75
|
+
const { filters } = useFilterList(filterId ? accountId : undefined);
|
|
76
|
+
if (!settings.data)
|
|
77
|
+
return null;
|
|
78
|
+
const { spam } = settings.data;
|
|
79
|
+
const kind = verdict.state === "Checked" ? verdict.kind : "Spam";
|
|
80
|
+
return (_jsx(SpamVerdictPanel, { verdict: verdict, label: remitSpamLabel(thread.labels), thresholds: spam.thresholds, placement: kind === "Phishing" ? spam.phishingPlacement : spam.spamPlacement, filterName: filters.find((filter) => filter.filterId === filterId)?.name, linkComponent: SpamVerdictLink, reportIssueHref: unknownReasonReportHref, onNotSpam: onNotSpam }));
|
|
81
|
+
}
|
|
53
82
|
/**
|
|
54
83
|
* Inner panel that resolves intelligence data and wires quick-action mutations.
|
|
55
84
|
*/
|
|
@@ -138,7 +167,7 @@ function WiredPanel({ thread, onClose, accountId, hideCloseButton, onAfterOptimi
|
|
|
138
167
|
if (!data) {
|
|
139
168
|
return _jsx(IntelligenceSkeleton, {});
|
|
140
169
|
}
|
|
141
|
-
return (_jsxs(_Fragment, { children: [_jsx(IntelligencePanel, { data: data, calendar: calendar.surface, tab: calendar.tab, onTabChange: calendar.onTabChange, onClose: onClose, hideCloseButton: hideCloseButton, actions: actions, reportSpamPending: isReporting, notSpamPending: isRestoring,
|
|
170
|
+
return (_jsxs(_Fragment, { children: [_jsx(IntelligencePanel, { data: data, calendar: calendar.surface, tab: calendar.tab, onTabChange: calendar.onTabChange, onClose: onClose, hideCloseButton: hideCloseButton, actions: actions, reportSpamPending: isReporting, notSpamPending: isRestoring, spamCheck: _jsx(SpamCheckSection, { thread: thread, accountId: accountId, onNotSpam: handleNotSpam }),
|
|
142
171
|
// No left border: the ResizableHandle to our left already draws the
|
|
143
172
|
// hairline seam. The remit-ui IntelligencePanel default `border-l`
|
|
144
173
|
// would double it to 2px.
|
|
@@ -4,11 +4,13 @@ import { NavSidebar } from "@remit/ui";
|
|
|
4
4
|
import { useQueries, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { useCallback, useMemo } from "react";
|
|
6
6
|
import { useTranslation } from "react-i18next";
|
|
7
|
+
import { useLabelList } from "../../hooks/useLabels";
|
|
7
8
|
import { folderFailure } from "../../lib/folder-failure";
|
|
8
9
|
import { buildMailboxRoleMap, labelForMailbox, shouldShowUnreadBadgeForRole, } from "../../lib/folder-roles";
|
|
10
|
+
import { withoutLabelFolders } from "../../lib/label-folders";
|
|
9
11
|
import { useMailContext } from "../../lib/mail-context";
|
|
10
12
|
import { isOutboxListRow } from "../../lib/outbox-status";
|
|
11
|
-
import { NavLink, useSelectedNavId } from "../../routing";
|
|
13
|
+
import { labelIdOfNavId, labelNavId, NavLink, useSelectedNavId, } from "../../routing";
|
|
12
14
|
const startsWithDigit = (str) => /^\d/.test(str);
|
|
13
15
|
const compareLabelNames = (a, b) => {
|
|
14
16
|
const aStartsWithDigit = startsWithDigit(a);
|
|
@@ -79,17 +81,26 @@ export function MailSidebarAdapter({ accounts, onMailboxSelect, variant = "deskt
|
|
|
79
81
|
staleTime: Infinity,
|
|
80
82
|
})),
|
|
81
83
|
});
|
|
84
|
+
// The folder tree waits for the labels, so a label folder never shows in it
|
|
85
|
+
// before its label is known. A failed label list leaves the tree whole.
|
|
86
|
+
const { labels, isPending: labelsPending, isError: labelsFailed, } = useLabelList(accounts[0]?.accountId);
|
|
87
|
+
const labelsSettled = !labelsPending || labelsFailed;
|
|
88
|
+
const navLabels = useMemo(() => labels.map((label) => ({
|
|
89
|
+
id: labelNavId(label.labelId),
|
|
90
|
+
name: label.name,
|
|
91
|
+
color: label.color,
|
|
92
|
+
})), [labels]);
|
|
82
93
|
const { data: outboxResponse } = useQuery(outboxOperationsListOutboxMessagesOptions());
|
|
83
94
|
const outboxPendingCount = useMemo(() => (outboxResponse?.items ?? []).filter((item) => isOutboxListRow(item.status)).length, [outboxResponse?.items]);
|
|
84
95
|
const navAccounts = useMemo(() => {
|
|
85
96
|
return accounts.map((account, i) => {
|
|
86
97
|
const query = mailboxQueries[i];
|
|
87
|
-
const mailboxes = query?.data?.items ?? [];
|
|
98
|
+
const mailboxes = withoutLabelFolders(query?.data?.items ?? [], labels);
|
|
88
99
|
const roleMap = buildMailboxRoleMap(account.folderAppointments);
|
|
89
|
-
const { system, labels } = sortMailboxes(mailboxes, roleMap, translator);
|
|
100
|
+
const { system, labels: folders } = sortMailboxes(mailboxes, roleMap, translator);
|
|
90
101
|
const status = query?.isError
|
|
91
102
|
? "error"
|
|
92
|
-
: query?.isLoading
|
|
103
|
+
: query?.isLoading || !labelsSettled
|
|
93
104
|
? "loading"
|
|
94
105
|
: "ready";
|
|
95
106
|
return {
|
|
@@ -102,10 +113,17 @@ export function MailSidebarAdapter({ accounts, onMailboxSelect, variant = "deskt
|
|
|
102
113
|
outboxPending: outboxPendingCount,
|
|
103
114
|
status,
|
|
104
115
|
onRetry: () => query?.refetch(),
|
|
105
|
-
mailboxes: [...system, ...
|
|
116
|
+
mailboxes: [...system, ...folders].map((mb) => toNavMailbox(mb, roleMap.get(mb.mailboxId), translator)),
|
|
106
117
|
};
|
|
107
118
|
});
|
|
108
|
-
}, [
|
|
119
|
+
}, [
|
|
120
|
+
accounts,
|
|
121
|
+
mailboxQueries,
|
|
122
|
+
outboxPendingCount,
|
|
123
|
+
translator,
|
|
124
|
+
labels,
|
|
125
|
+
labelsSettled,
|
|
126
|
+
]);
|
|
109
127
|
// Invalidate a mailbox's thread list on navigation so a re-visit always
|
|
110
128
|
// fetches fresh data (mirrors the retired MailboxItem behaviour).
|
|
111
129
|
const invalidateMailboxThreads = (mailboxId) => {
|
|
@@ -132,6 +150,10 @@ export function MailSidebarAdapter({ accounts, onMailboxSelect, variant = "deskt
|
|
|
132
150
|
if (navId === "flagged") {
|
|
133
151
|
return (_jsx(NavLink, { to: "/mail/flagged", search: { q: undefined }, onClick: () => onClick?.(), className: className, "aria-label": ariaLabel, title: title, children: children }));
|
|
134
152
|
}
|
|
153
|
+
const labelId = labelIdOfNavId(navId);
|
|
154
|
+
if (labelId) {
|
|
155
|
+
return (_jsx(NavLink, { to: "/mail/label/$labelId", params: { labelId }, search: { q: undefined }, onClick: () => onClick?.(), className: className, "aria-label": ariaLabel, title: title, children: children }));
|
|
156
|
+
}
|
|
135
157
|
if (navId === "settings") {
|
|
136
158
|
return (_jsx(NavLink, { to: "/settings/accounts", onClick: () => onClick?.(), className: className, "aria-label": ariaLabel, title: title, children: children }));
|
|
137
159
|
}
|
|
@@ -157,5 +179,5 @@ export function MailSidebarAdapter({ accounts, onMailboxSelect, variant = "deskt
|
|
|
157
179
|
onSearchChange("");
|
|
158
180
|
onMailboxSelect?.();
|
|
159
181
|
};
|
|
160
|
-
return (_jsx(NavSidebar, { accounts: navAccounts, selectedNavId: selectedNavId, onSelectNav: handleSelectNav, linkComponent: linkComponent, variant: variant }));
|
|
182
|
+
return (_jsx(NavSidebar, { accounts: navAccounts, labels: navLabels, selectedNavId: selectedNavId, onSelectNav: handleSelectNav, linkComponent: linkComponent, variant: variant }));
|
|
161
183
|
}
|
|
@@ -54,6 +54,7 @@ import { shouldRequestResultCount } from "../../lib/result-count";
|
|
|
54
54
|
import { normalizeSearchQuery } from "../../lib/search-query";
|
|
55
55
|
import { threadToSearchResult } from "../../lib/search-result";
|
|
56
56
|
import { parseSearchTokens } from "../../lib/search-tokens";
|
|
57
|
+
import { raisesSpamWarning } from "../../lib/spam";
|
|
57
58
|
import { useTelemetry } from "../../lib/telemetry-context";
|
|
58
59
|
import { applyResidualTokens, threadSearchTokens, } from "../../lib/thread-search-tokens";
|
|
59
60
|
import { replyToThread, useCloseThread, useGoToSection, useIsComposing, useIsReplying, useOpenCompose, useOpenReply, useOpenThread, } from "../../routing";
|
|
@@ -246,7 +247,7 @@ function MailboxPaneProvider({ mailboxId, thread, children, }) {
|
|
|
246
247
|
mailboxId: selectedThread?.mailboxId ?? mailboxId,
|
|
247
248
|
subject: selectedThread?.subject,
|
|
248
249
|
messageId: selectedMessageId,
|
|
249
|
-
|
|
250
|
+
row: selectedThread,
|
|
250
251
|
};
|
|
251
252
|
}, [threadId, selectedThread, selectedMessageId, mailboxId]);
|
|
252
253
|
// Esc unwinds one step at a time: an active selection first (handled by the
|
|
@@ -621,17 +622,19 @@ function MailboxList() {
|
|
|
621
622
|
*/
|
|
622
623
|
function MailboxReading() {
|
|
623
624
|
const replyWithText = useReplyWithText();
|
|
624
|
-
const { mailboxId, mailboxAccountId, mailboxAccountLoading, selectedThread, conversation, onReply, onToolbarDelete, onToolbarStar, isStarred, onToolbarMove, handleDeselectIfRemoved, intelligenceRef, onOpenThread, } = useMailboxPane();
|
|
625
|
+
const { mailboxId, mailboxAccountId, mailboxAccountLoading, selectedThread, conversation, onReply, onToolbarDelete, onToolbarStar, isStarred, onToolbarMove, handleDeselectIfRemoved, intelligenceRef, onOpenThread, isSpamFolder, } = useMailboxPane();
|
|
625
626
|
const hasThread = Boolean(conversation);
|
|
626
627
|
const intelligence = useIntelligenceSurface(conversation?.threadId);
|
|
627
628
|
usePublishIntelligenceCommands(intelligenceRef, intelligence);
|
|
628
|
-
// The rail opens itself on a
|
|
629
|
+
// The rail opens itself on a message the spam banner warns about. It lives here, behind the rail's
|
|
629
630
|
// own width gate, because raising it writes `#intelligence` into the address
|
|
630
631
|
// — and a panel the address names with no renderer behind it is a panel that
|
|
631
632
|
// opens nothing (`docs/architecture/url-state.md`, R6). Below this width the
|
|
632
633
|
// banner is the announcement and its "Why?" is the way in.
|
|
633
634
|
const autoOpenedForRef = useRef(null);
|
|
634
635
|
const { railFits, openRail } = intelligence;
|
|
636
|
+
const warned = selectedThread !== undefined &&
|
|
637
|
+
raisesSpamWarning(selectedThread, isSpamFolder);
|
|
635
638
|
useEffect(() => {
|
|
636
639
|
if (!railFits)
|
|
637
640
|
return;
|
|
@@ -640,17 +643,12 @@ function MailboxReading() {
|
|
|
640
643
|
return;
|
|
641
644
|
if (autoOpenedForRef.current === id)
|
|
642
645
|
return;
|
|
643
|
-
if (!
|
|
646
|
+
if (!warned)
|
|
644
647
|
return;
|
|
645
648
|
autoOpenedForRef.current = id;
|
|
646
649
|
openRail();
|
|
647
|
-
}, [
|
|
648
|
-
|
|
649
|
-
openRail,
|
|
650
|
-
selectedThread?.messageId,
|
|
651
|
-
selectedThread?.authenticity?.dkimMismatch,
|
|
652
|
-
]);
|
|
653
|
-
const detailPane = conversation ? (_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, authenticity: conversation.authenticity, onOpenIntelligence: intelligence.open, listOnScreen: true })) : (_jsx(ReadingPaneEmpty, {}));
|
|
650
|
+
}, [railFits, openRail, selectedThread?.messageId, warned]);
|
|
651
|
+
const detailPane = conversation ? (_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, spamRow: conversation.row, onOpenIntelligence: intelligence.open, listOnScreen: true })) : (_jsx(ReadingPaneEmpty, {}));
|
|
654
652
|
return (_jsxs(_Fragment, { children: [_jsxs("section", { className: "flex h-full w-full min-w-0 flex-col bg-canvas", children: [_jsx(MessageToolbar, { hasThread: hasThread, messageId: conversation?.messageId, intelligenceOpen: intelligence.isShowing, canToggleIntelligence: intelligence.canToggle, onToggleIntelligence: intelligence.toggle, onReply: onReply ? () => onReply("reply") : undefined, onReplyAll: onReply ? () => onReply("reply-all") : undefined, onForward: onReply ? () => onReply("forward") : undefined, onDelete: hasThread ? onToolbarDelete : undefined, onToggleStar: hasThread ? onToolbarStar : undefined, isStarred: isStarred, moveContext: hasThread && mailboxAccountId
|
|
655
653
|
? {
|
|
656
654
|
accountId: mailboxAccountId,
|
|
@@ -682,7 +680,7 @@ function MailboxPhone() {
|
|
|
682
680
|
const drawer = useIntelligenceDrawer(conversation?.threadId ?? null);
|
|
683
681
|
usePublishIntelligenceCommands(intelligenceRef, drawer);
|
|
684
682
|
if (conversation) {
|
|
685
|
-
return (_jsxs(_Fragment, { children: [_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId,
|
|
683
|
+
return (_jsxs(_Fragment, { children: [_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, spamRow: conversation.row, onBack: onBack, onOpenIntelligence: drawer.toggle, onSwipeNext: nextThread ? () => onOpenThread(nextThread) : undefined, onSwipePrevious: previousThread ? () => onOpenThread(previousThread) : undefined, mobileIntelligenceOpen: drawer.isOpen }), _jsx(IntelligenceDrawer, { isOpen: drawer.isOpen, onClose: drawer.close, thread: selectedThread, accountId: mailboxAccountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
|
|
686
684
|
}
|
|
687
685
|
return _jsx(MailboxList, {});
|
|
688
686
|
}
|
|
@@ -31,6 +31,8 @@ interface MessageActionMenuProps {
|
|
|
31
31
|
* parent card so the body area and this menu stay in sync.
|
|
32
32
|
*/
|
|
33
33
|
onToggleRaw?: () => void;
|
|
34
|
+
/** Runs the spam check on this message again. */
|
|
35
|
+
onCheckAgain?: () => void;
|
|
34
36
|
}
|
|
35
|
-
export declare const MessageActionMenu: ({ messageId, threadId, mailboxId, isRead, accountId, fromAddressId, isTrusted, showRaw, onToggleRaw, }: MessageActionMenuProps) => import("react").JSX.Element;
|
|
37
|
+
export declare const MessageActionMenu: ({ messageId, threadId, mailboxId, isRead, accountId, fromAddressId, isTrusted, showRaw, onToggleRaw, onCheckAgain, }: MessageActionMenuProps) => import("react").JSX.Element;
|
|
36
38
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { messageBulkOperationsUpdateFlagsMutation, threadDetailOperationsListThreadMessagesQueryKey, } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
|
|
3
3
|
import { DropdownMenu, DropdownMenuItem, DropdownMenuSeparator, ErrorState, } from "@remit/ui";
|
|
4
|
-
import { BadgeCheck, Check, Code, EllipsisVertical, MailOpen, Trash, } from "@remit/ui/icons";
|
|
4
|
+
import { BadgeCheck, Check, Code, EllipsisVertical, MailOpen, RefreshCw, Trash, } from "@remit/ui/icons";
|
|
5
5
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { useCallback } from "react";
|
|
7
7
|
import { useDeleteMessages } from "../../hooks/useDeleteMessages";
|
|
@@ -13,7 +13,7 @@ import { useCloseThread, useOpenThreadPath } from "../../routing";
|
|
|
13
13
|
import { useErrorBanners } from "../ui/error-banner-context";
|
|
14
14
|
import { formatErrorDetail } from "../ui/error-banners";
|
|
15
15
|
import { MoveToTrigger } from "./MoveToTrigger";
|
|
16
|
-
export const MessageActionMenu = ({ messageId, threadId, mailboxId, isRead, accountId, fromAddressId, isTrusted = false, showRaw = false, onToggleRaw, }) => {
|
|
16
|
+
export const MessageActionMenu = ({ messageId, threadId, mailboxId, isRead, accountId, fromAddressId, isTrusted = false, showRaw = false, onToggleRaw, onCheckAgain, }) => {
|
|
17
17
|
const queryClient = useQueryClient();
|
|
18
18
|
const closeThread = useCloseThread();
|
|
19
19
|
const { pushError } = useErrorBanners();
|
|
@@ -122,7 +122,7 @@ export const MessageActionMenu = ({ messageId, threadId, mailboxId, isRead, acco
|
|
|
122
122
|
const trustedItemTitle = !fromAddressId
|
|
123
123
|
? "Sender has no parseable address"
|
|
124
124
|
: undefined;
|
|
125
|
-
return (_jsxs("div", { className: "flex flex-col items-end gap-1", children: [_jsxs("div", { className: "flex items-center gap-1", children: [accountId && (_jsx(MoveToTrigger, { accountId: accountId, currentMailboxId: mailboxId, onMove: handleMove, disabled: isDisabled, label: "Move this message" })), _jsxs(DropdownMenu, { trigger: _jsx(EllipsisVertical, { className: "size-4" }), children: [_jsxs(DropdownMenuItem, { onClick: handleToggleTrusted, disabled: trustedItemDisabled, children: [isTrusted ? (_jsx(BadgeCheck, { className: "size-4 text-positive" })) : (_jsx(Check, { className: "size-4 opacity-0" })), _jsx("span", { title: trustedItemTitle, children: "Trusted sender" })] }), isRead && (_jsxs(DropdownMenuItem, { onClick: handleMarkAsUnread, disabled: isDisabled, children: [_jsx(MailOpen, { className: "size-4" }), "Mark as unread"] })), onToggleRaw && (_jsxs(DropdownMenuItem, { onClick: onToggleRaw, children: [_jsx(Code, { className: "size-4" }), showRaw ? "Show formatted" : "Show raw email"] })), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: handleDelete, disabled: isDisabled, destructive: true, children: [_jsx(Trash, { className: "size-4" }), "Delete"] })] })] }), trustedError && (_jsx("div", { className: "w-64", children: _jsx(ErrorState, { variant: "inline", title: "Couldn't update trust", error: trustedError, onRetry: () => {
|
|
125
|
+
return (_jsxs("div", { className: "flex flex-col items-end gap-1", children: [_jsxs("div", { className: "flex items-center gap-1", children: [accountId && (_jsx(MoveToTrigger, { accountId: accountId, currentMailboxId: mailboxId, onMove: handleMove, disabled: isDisabled, label: "Move this message" })), _jsxs(DropdownMenu, { trigger: _jsx(EllipsisVertical, { className: "size-4" }), children: [_jsxs(DropdownMenuItem, { onClick: handleToggleTrusted, disabled: trustedItemDisabled, children: [isTrusted ? (_jsx(BadgeCheck, { className: "size-4 text-positive" })) : (_jsx(Check, { className: "size-4 opacity-0" })), _jsx("span", { title: trustedItemTitle, children: "Trusted sender" })] }), isRead && (_jsxs(DropdownMenuItem, { onClick: handleMarkAsUnread, disabled: isDisabled, children: [_jsx(MailOpen, { className: "size-4" }), "Mark as unread"] })), onCheckAgain && (_jsxs(DropdownMenuItem, { onClick: onCheckAgain, disabled: isDisabled, children: [_jsx(RefreshCw, { className: "size-4" }), "Check again"] })), onToggleRaw && (_jsxs(DropdownMenuItem, { onClick: onToggleRaw, children: [_jsx(Code, { className: "size-4" }), showRaw ? "Show formatted" : "Show raw email"] })), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: handleDelete, disabled: isDisabled, destructive: true, children: [_jsx(Trash, { className: "size-4" }), "Delete"] })] })] }), trustedError && (_jsx("div", { className: "w-64", children: _jsx(ErrorState, { variant: "inline", title: "Couldn't update trust", error: trustedError, onRetry: () => {
|
|
126
126
|
resetTrustedError();
|
|
127
127
|
handleToggleTrusted();
|
|
128
128
|
} }) }))] }));
|
|
@@ -4,10 +4,12 @@ import { AddressList, CollapsedMessage, cn, EmptyState, ErrorState, ExpandedMess
|
|
|
4
4
|
import { BadgeCheck, Paperclip, Star } from "@remit/ui/icons";
|
|
5
5
|
import { useQuery } from "@tanstack/react-query";
|
|
6
6
|
import { useState } from "react";
|
|
7
|
+
import { useJunkMailboxIds } from "../../hooks/useJunkMailboxIds";
|
|
7
8
|
import { toDisplayCategory } from "../../lib/display-category";
|
|
8
9
|
import { formatDatePreset } from "../../lib/format";
|
|
9
10
|
import { isMessageGoneFromServerError, isMessageNotFoundError, } from "../ui/error-banners";
|
|
10
11
|
import { AutoMovedIndicator } from "./AutoMovedIndicator";
|
|
12
|
+
import { checkAgainRequestOfThread, useCheckAgain } from "./CheckAgainProvider";
|
|
11
13
|
import { MessageActionMenu } from "./MessageActionMenu";
|
|
12
14
|
import { MessageAttachments } from "./MessageAttachments";
|
|
13
15
|
import { MessageBody } from "./MessageBody";
|
|
@@ -43,6 +45,8 @@ const CollapsedCard = ({ threadMessage, isFocused, onToggle, onToggleStar, isSta
|
|
|
43
45
|
return (_jsx(CollapsedMessage, { message: message, onClick: onToggle, isFocused: isFocused, isUnread: !threadMessage.isRead, trailing: _jsxs(_Fragment, { children: [threadMessage.hasAttachment && (_jsx(Paperclip, { className: "size-3 shrink-0 text-fg-subtle", role: "img", "aria-label": "Has an attachment" })), _jsx(StarButton, { isStarred: threadMessage.hasStars, onToggleStar: onToggleStar, isStarPending: isStarPending, hoverReveal: true }), _jsx("span", { "data-testid": "message-date", className: "shrink-0 text-2xs text-fg-subtle tabular-nums", children: date })] }) }));
|
|
44
46
|
};
|
|
45
47
|
const ExpandedCard = ({ threadMessage, messageData, isLoading, isError, error, onRetry, isFocused, onToggle, onToggleStar, isStarPending, accountId, showRaw, onToggleRaw, mobile, onReply, onReplyAll, onForward, }) => {
|
|
48
|
+
const checkAgain = useCheckAgain();
|
|
49
|
+
const junkMailboxIds = useJunkMailboxIds();
|
|
46
50
|
const date = formatDatePreset(threadMessage.sentDate, "long");
|
|
47
51
|
const isUnread = !threadMessage.isRead;
|
|
48
52
|
const isTrusted = messageData?.envelope.from[0]?.flags?.trusted?.value === true;
|
|
@@ -56,7 +60,11 @@ const ExpandedCard = ({ threadMessage, messageData, isLoading, isError, error, o
|
|
|
56
60
|
const autoMovedNode = threadMessage.autoMoved || threadMessage.spamReport ? (_jsx(AutoMovedIndicator, { accountId: accountId, messageId: threadMessage.messageId, threadId: threadMessage.threadId, mailboxId: threadMessage.mailboxId, autoMoved: threadMessage.autoMoved, spamReport: threadMessage.spamReport })) : null;
|
|
57
61
|
return (_jsx(ExpandedMessage, { message: message, isFocused: mobile ? false : isFocused, onHeaderClick: onToggle, senderBadge: isTrusted && !isBlocked ? _jsx(TrustedSenderBadge, {}) : undefined, trailing: _jsx("span", { "data-testid": "message-date", className: "text-2xs text-fg-subtle", children: date }), to: messageData ? (_jsx(AddressList, { label: "To", addresses: messageData.envelope.to })) : null, indicators: autoMovedNode || !mobile ? (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5 mt-0.5", children: [autoMovedNode, !mobile && (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex items-center justify-end gap-1", children: _jsx(StarButton, { isStarred: threadMessage.hasStars, onToggleStar: onToggleStar, isStarPending: isStarPending }) }), isUnread && (
|
|
58
62
|
// biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-label on decorative indicator provides useful context for assistive tech
|
|
59
|
-
_jsx("span", { className: "size-1.5 rounded-full bg-accent", "aria-label": "Unread" }))] }))] })) : undefined, actionMenu: mobile ? undefined : (_jsx(MessageActionMenu, { messageId: threadMessage.messageId, threadId: threadMessage.threadId, mailboxId: threadMessage.mailboxId, isRead: threadMessage.isRead, accountId: accountId, fromAddressId: fromAddressId, isTrusted: isTrusted, showRaw: showRaw, onToggleRaw: onToggleRaw
|
|
63
|
+
_jsx("span", { className: "size-1.5 rounded-full bg-accent", "aria-label": "Unread" }))] }))] })) : undefined, actionMenu: mobile ? undefined : (_jsx(MessageActionMenu, { messageId: threadMessage.messageId, threadId: threadMessage.threadId, mailboxId: threadMessage.mailboxId, isRead: threadMessage.isRead, accountId: accountId, fromAddressId: fromAddressId, isTrusted: isTrusted, showRaw: showRaw, onToggleRaw: onToggleRaw, onCheckAgain: checkAgain
|
|
64
|
+
? () => checkAgain.checkAgain([
|
|
65
|
+
checkAgainRequestOfThread(threadMessage, junkMailboxIds),
|
|
66
|
+
], { panel: false })
|
|
67
|
+
: undefined })), actionBar: mobile ? (_jsx(MobileMessageBar, { messageId: threadMessage.messageId, threadId: threadMessage.threadId, mailboxId: threadMessage.mailboxId, accountId: accountId, isRead: threadMessage.isRead, isStarred: threadMessage.hasStars, onToggleStar: onToggleStar, fromAddressId: fromAddressId, isTrusted: isTrusted, showRaw: showRaw, onToggleRaw: onToggleRaw, onReply: onReply, onReplyAll: onReplyAll, onForward: onForward })) : undefined, body: _jsxs(_Fragment, { children: [_jsx(MessageSettlementAlert, { threadMessage: threadMessage, accountId: accountId, className: "mt-3" }), isLoading ? (_jsxs("div", { className: "mt-3 animate-pulse space-y-2", children: [_jsx("div", { className: "h-4 bg-surface-sunken rounded w-full" }), _jsx("div", { className: "h-4 bg-surface-sunken rounded w-3/4" }), _jsx("div", { className: "h-4 bg-surface-sunken rounded w-1/2" })] })) : isError && isMessageGoneFromServerError(error) ? (_jsx("div", { className: "mt-3", children: _jsx(EmptyState, { message: "This message is no longer on the mail server. It was moved or deleted in another mail app." }) })) : isError && isMessageNotFoundError(error) ? (_jsx("div", { className: "mt-3", children: _jsx(EmptyState, { message: "This message has been deleted" }) })) : isError ? (_jsx("div", { className: "mt-3", children: _jsx(ErrorState, { variant: "inline", title: "Couldn't load this message", error: error, onRetry: onRetry }) })) : showRaw ? (_jsx("div", { className: "mt-3", children: _jsx(RawMessageView, { messageId: threadMessage.messageId }) })) : (_jsxs("div", { className: "mt-3", children: [_jsx(MessageBody, { bodyParts: messageData?.bodyParts, messageId: threadMessage.messageId, fromAddressId: messageData?.envelope.from[0]?.addressId, isTrusted: isTrusted, isBlocked: isBlocked, category: toDisplayCategory(threadMessage.category) }), _jsx(MessageAttachments, { messageId: threadMessage.messageId, bodyParts: messageData?.bodyParts, hasAttachment: threadMessage.hasAttachment, className: "mt-4" })] }))] }) }));
|
|
60
68
|
};
|
|
61
69
|
export const MessageCard = ({ threadMessage, isExpanded, isFocused, onToggle, onToggleStar, isStarPending, accountId, mobile, onReply, onReplyAll, onForward, }) => {
|
|
62
70
|
const [showRaw, setShowRaw] = useState(false);
|
|
@@ -7,6 +7,7 @@ import { useJunkMailbox } from "../../hooks/useArchiveMailbox";
|
|
|
7
7
|
import { useDeleteOutcome } from "../../hooks/useDeleteOutcome";
|
|
8
8
|
import { useEscalatedActions, } from "../../hooks/useEscalatedActions";
|
|
9
9
|
import { useFollowFocusOpen } from "../../hooks/useFollowFocusOpen";
|
|
10
|
+
import { useJunkMailboxIds } from "../../hooks/useJunkMailboxIds";
|
|
10
11
|
import { useLabelList } from "../../hooks/useLabels";
|
|
11
12
|
import { useToggleReadFor } from "../../hooks/useMarkAsRead";
|
|
12
13
|
import { useIsDesktop } from "../../hooks/useMediaQuery";
|
|
@@ -22,6 +23,7 @@ import { resolveSelectionAccountScope } from "../../lib/selection-account-scope"
|
|
|
22
23
|
import { shouldExitSelectionOnNavigate } from "../../lib/selection-mode";
|
|
23
24
|
import { useOpenThread, useSelectionWizard, useWizardStepValue, } from "../../routing";
|
|
24
25
|
import { useErrorBanners } from "../ui/error-banner-context";
|
|
26
|
+
import { checkAgainRequestOfThread, useCheckAgain } from "./CheckAgainProvider";
|
|
25
27
|
import { DeleteConfirmDialog } from "./DeleteConfirmDialog";
|
|
26
28
|
import { LabelApplyTrigger } from "./LabelApplyTrigger";
|
|
27
29
|
import { SelectionWizardHost, } from "./SelectionWizardHost";
|
|
@@ -268,6 +270,13 @@ export const MessageList = ({ mailboxId, threads, selectedMessageId, isLoading,
|
|
|
268
270
|
}
|
|
269
271
|
return rows;
|
|
270
272
|
}, [threads, selectedIds, accountId]);
|
|
273
|
+
const checkAgain = useCheckAgain();
|
|
274
|
+
const junkMailboxIds = useJunkMailboxIds();
|
|
275
|
+
const checkAgainSelection = checkAgain
|
|
276
|
+
? () => checkAgain.checkAgain(threads
|
|
277
|
+
.filter((thread) => selectedIds.has(thread.messageId))
|
|
278
|
+
.map((thread) => checkAgainRequestOfThread(thread, junkMailboxIds)), { panel: true })
|
|
279
|
+
: undefined;
|
|
271
280
|
const handleRowSelect = useCallback((messageId, modifiers) => {
|
|
272
281
|
if (modifiers.shiftKey) {
|
|
273
282
|
// The open/focused row is the fallback origin when the stored anchor
|
|
@@ -860,7 +869,7 @@ export const MessageList = ({ mailboxId, threads, selectedMessageId, isLoading,
|
|
|
860
869
|
// title's place, and the escalation states (issue #212) — the offer,
|
|
861
870
|
// counting, the escalated predicate, a chunked run's progress — ride on the
|
|
862
871
|
// same bar rather than a second one.
|
|
863
|
-
const activeSelectionBar = (_jsx(SelectionTopBar, { title: listHeaderChrome.title || listTitle, navSlot: listHeaderChrome.navSlot, titleMeta: listHeaderChrome.titleMeta, searchSlot: listHeaderChrome.searchSlot, searchField: listHeaderChrome.searchField, idleSlot: listHeaderChrome.makeFilterSlot, count: selectionCount, onCancel: handleSelectionCancel, onDelete: () => startWizard("delete"), onMove: () => startWizard("move"), onOrganize: organizeSelection, onJunk: junkDestinationId ? () => startWizard("junk") : undefined, onMarkRead: () => startWizard("markRead"), overflowSlot: accountId && mailboxId && selectedCount > 0 && labels.length > 0 ? (_jsx(LabelApplyTrigger, { accountId: accountId, mailboxId: mailboxId, messageIds: Array.from(selectedIds) })) : undefined, isBusy: selectionIsBusy, isCounting: escalation.phase.kind === "counting", selectAll: selectionSelectAll, statusLabel: selectionStatusLabel, progress: selectionProgress, notice: selectionNotice }));
|
|
872
|
+
const activeSelectionBar = (_jsx(SelectionTopBar, { title: listHeaderChrome.title || listTitle, navSlot: listHeaderChrome.navSlot, titleMeta: listHeaderChrome.titleMeta, searchSlot: listHeaderChrome.searchSlot, searchField: listHeaderChrome.searchField, idleSlot: listHeaderChrome.makeFilterSlot, count: selectionCount, onCancel: handleSelectionCancel, onDelete: () => startWizard("delete"), onMove: () => startWizard("move"), onOrganize: organizeSelection, onJunk: junkDestinationId ? () => startWizard("junk") : undefined, onMarkRead: () => startWizard("markRead"), onCheckAgain: checkAgainSelection, overflowSlot: accountId && mailboxId && selectedCount > 0 && labels.length > 0 ? (_jsx(LabelApplyTrigger, { accountId: accountId, mailboxId: mailboxId, messageIds: Array.from(selectedIds) })) : undefined, isBusy: selectionIsBusy, isCounting: escalation.phase.kind === "counting", selectAll: selectionSelectAll, statusLabel: selectionStatusLabel, progress: selectionProgress, notice: selectionNotice }));
|
|
864
873
|
// Roving tabindex: exactly one row is in the tab order, so Tab moves focus
|
|
865
874
|
// into the list at the cursor and Shift+Tab moves back out to the side panel
|
|
866
875
|
// instead of walking every row (#43).
|
|
@@ -883,7 +892,7 @@ export const MessageList = ({ mailboxId, threads, selectedMessageId, isLoading,
|
|
|
883
892
|
// #92) — the number in the bar and the rows underneath
|
|
884
893
|
// have to agree something is happening, and a row mid
|
|
885
894
|
// -delete must not be openable.
|
|
886
|
-
escalation.isRunning && "pointer-events-none opacity-50"), style: { transform: `translateY(${virtualRow.start}px)` }, children: _jsx(SwipeableMessageRow, { thread: thread, mailboxId: mailboxId, isSelected: selectedMessageId === thread.messageId, isFocused: focusedMessageId === thread.messageId, isTabStop: tabStopMessageId === thread.messageId, onFocusRow: handleRowFocus, isChecked: isChecked(thread.messageId), onToggleCheck: toggleCheck, onRowSelect: handleRowSelect, isMultiSelectMode: isMultiSelectMode, onLongPress: handleLongPress, isDesktop: isDesktop, onDelete: handleSwipeDelete, onToggleRead: handleSwipeToggleRead, density: density }) }, virtualRow.key));
|
|
895
|
+
escalation.isRunning && "pointer-events-none opacity-50"), style: { transform: `translateY(${virtualRow.start}px)` }, children: _jsx(SwipeableMessageRow, { thread: thread, mailboxId: mailboxId, junkMailboxIds: junkMailboxIds, isSelected: selectedMessageId === thread.messageId, isFocused: focusedMessageId === thread.messageId, isTabStop: tabStopMessageId === thread.messageId, onFocusRow: handleRowFocus, isChecked: isChecked(thread.messageId), onToggleCheck: toggleCheck, onRowSelect: handleRowSelect, isMultiSelectMode: isMultiSelectMode, onLongPress: handleLongPress, isDesktop: isDesktop, onDelete: handleSwipeDelete, onToggleRead: handleSwipeToggleRead, density: density }) }, virtualRow.key));
|
|
887
896
|
}) }), isLoadingMore && _jsx(MessageListLoadingMore, {})] })] }));
|
|
888
897
|
return (_jsxs(_Fragment, { children: [completionBanner && !isDesktop && (_jsx(Banner, { tone: "success", variant: "soft", className: "m-2 rounded-md", onDismiss: () => setCompletionBanner(null), children: completionBanner })), _jsx(MessageListPane, { listTitle: listTitle, listMeta: listMeta, sections: sections, flatList: true,
|
|
889
898
|
// The results panel is a body, not a list state: it stands in for the
|
|
@@ -10,6 +10,8 @@ import type { Density, SelectionModifiers, ThreadRowData } from "@remit/ui";
|
|
|
10
10
|
interface MessageListItemProps {
|
|
11
11
|
thread: RemitImapThreadMessageResponse;
|
|
12
12
|
mailboxId: string;
|
|
13
|
+
/** Every account's Spam folder, which tells a moved row from a suspected one. */
|
|
14
|
+
junkMailboxIds: ReadonlySet<string>;
|
|
13
15
|
isSelected: boolean;
|
|
14
16
|
isFocused?: boolean;
|
|
15
17
|
isTabStop?: boolean;
|
|
@@ -27,6 +29,6 @@ interface MessageListItemProps {
|
|
|
27
29
|
* Map a RemitImapThreadMessageResponse to the ThreadRowData shape the shared
|
|
28
30
|
* row renders.
|
|
29
31
|
*/
|
|
30
|
-
export declare const threadToRowData: (thread: RemitImapThreadMessageResponse, messageCount?: number) => ThreadRowData;
|
|
31
|
-
export declare const MessageListItem: import("react").MemoExoticComponent<({ thread, mailboxId, isSelected, isFocused, isTabStop, onFocusRow, isChecked, onToggleCheck, onRowSelect, messageCount, isMultiSelectMode, onLongPress, isDesktop, density, }: MessageListItemProps) => import("react").JSX.Element>;
|
|
32
|
+
export declare const threadToRowData: (thread: RemitImapThreadMessageResponse, junkMailboxIds: ReadonlySet<string>, messageCount?: number) => ThreadRowData;
|
|
33
|
+
export declare const MessageListItem: import("react").MemoExoticComponent<({ thread, mailboxId, junkMailboxIds, isSelected, isFocused, isTabStop, onFocusRow, isChecked, onToggleCheck, onRowSelect, messageCount, isMultiSelectMode, onLongPress, isDesktop, density, }: MessageListItemProps) => import("react").JSX.Element>;
|
|
32
34
|
export {};
|
|
@@ -3,12 +3,13 @@ import { memo } from "react";
|
|
|
3
3
|
import { toDisplayCategory } from "../../lib/display-category";
|
|
4
4
|
import { formatEmailDate } from "../../lib/format";
|
|
5
5
|
import { rowSettlement } from "../../lib/row-settlement";
|
|
6
|
+
import { spamRowMark } from "../../lib/spam";
|
|
6
7
|
import { MessageRow } from "./MessageRow";
|
|
7
8
|
/**
|
|
8
9
|
* Map a RemitImapThreadMessageResponse to the ThreadRowData shape the shared
|
|
9
10
|
* row renders.
|
|
10
11
|
*/
|
|
11
|
-
export const threadToRowData = (thread, messageCount) => ({
|
|
12
|
+
export const threadToRowData = (thread, junkMailboxIds, messageCount) => ({
|
|
12
13
|
id: thread.messageId,
|
|
13
14
|
accountId: thread.accountId,
|
|
14
15
|
mailboxId: thread.mailboxId,
|
|
@@ -24,14 +25,11 @@ export const threadToRowData = (thread, messageCount) => ({
|
|
|
24
25
|
trust: thread.senderTrust,
|
|
25
26
|
category: toDisplayCategory(thread.category),
|
|
26
27
|
messageCount,
|
|
27
|
-
|
|
28
|
-
// for the multi-signature / alignment semantics a single string compare
|
|
29
|
-
// misses.
|
|
30
|
-
suspicious: thread.authenticity?.dkimMismatch === true,
|
|
28
|
+
spam: spamRowMark(thread, junkMailboxIds),
|
|
31
29
|
labels: thread.labels,
|
|
32
30
|
...rowSettlement(thread),
|
|
33
31
|
});
|
|
34
|
-
const MessageListItemComponent = ({ thread, mailboxId, isSelected, isFocused, isTabStop, onFocusRow, isChecked, onToggleCheck, onRowSelect, messageCount, isMultiSelectMode, onLongPress, isDesktop, density, }) => (_jsx(MessageRow, { thread: threadToRowData(thread, messageCount), link: { mailboxId, threadId: thread.threadId }, inListbox: true, active: isSelected, focused: isFocused, isTabStop: isTabStop, density: density, isDesktop: isDesktop, onFocusRow: onFocusRow, selection: {
|
|
32
|
+
const MessageListItemComponent = ({ thread, mailboxId, junkMailboxIds, isSelected, isFocused, isTabStop, onFocusRow, isChecked, onToggleCheck, onRowSelect, messageCount, isMultiSelectMode, onLongPress, isDesktop, density, }) => (_jsx(MessageRow, { thread: threadToRowData(thread, junkMailboxIds, messageCount), link: { mailboxId, threadId: thread.threadId }, inListbox: true, active: isSelected, focused: isFocused, isTabStop: isTabStop, density: density, isDesktop: isDesktop, onFocusRow: onFocusRow, selection: {
|
|
35
33
|
isChecked,
|
|
36
34
|
onToggleCheck,
|
|
37
35
|
onRowSelect,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RemitImapThreadMessageResponse } from "@remit/api-http-client/types.gen.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The message view's one banner slot, between the header and the body. It
|
|
4
|
+
* warns while the message carries a Remit Spam or Phishing label outside Spam,
|
|
5
|
+
* or when the check failed, and goes when the label goes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SpamBannerSlot({ row, onOpenIntelligence, }: {
|
|
8
|
+
row: RemitImapThreadMessageResponse;
|
|
9
|
+
onOpenIntelligence?: () => void;
|
|
10
|
+
}): import("react").JSX.Element | null;
|