@remit/web-client 0.0.347 → 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.
Files changed (55) hide show
  1. package/dist/src/components/mail/BriefPane.js +3 -3
  2. package/dist/src/components/mail/CheckAgainProvider.d.ts +30 -0
  3. package/dist/src/components/mail/CheckAgainProvider.js +194 -0
  4. package/dist/src/components/mail/CollectionList.js +4 -2
  5. package/dist/src/components/mail/CollectionPane.js +3 -3
  6. package/dist/src/components/mail/ConversationView.d.ts +7 -8
  7. package/dist/src/components/mail/ConversationView.js +4 -4
  8. package/dist/src/components/mail/DailyBrief.js +6 -4
  9. package/dist/src/components/mail/IntelligencePane.d.ts +2 -2
  10. package/dist/src/components/mail/IntelligencePane.js +33 -4
  11. package/dist/src/components/mail/MailboxPane.js +10 -12
  12. package/dist/src/components/mail/MessageActionMenu.d.ts +3 -1
  13. package/dist/src/components/mail/MessageActionMenu.js +3 -3
  14. package/dist/src/components/mail/MessageCard.js +9 -1
  15. package/dist/src/components/mail/MessageList.js +11 -2
  16. package/dist/src/components/mail/MessageListItem.d.ts +4 -2
  17. package/dist/src/components/mail/MessageListItem.js +4 -6
  18. package/dist/src/components/mail/SpamBannerSlot.d.ts +10 -0
  19. package/dist/src/components/mail/SpamBannerSlot.js +56 -0
  20. package/dist/src/components/mail/SwipeableMessageRow.d.ts +3 -2
  21. package/dist/src/components/mail/SwipeableMessageRow.js +6 -6
  22. package/dist/src/components/mail/ThreadListInteraction.d.ts +2 -0
  23. package/dist/src/components/mail/ThreadListInteraction.js +12 -2
  24. package/dist/src/components/settings/classification/FailureBanner.js +3 -4
  25. package/dist/src/components/settings/spam/SpamSettingsPanel.d.ts +6 -0
  26. package/dist/src/components/settings/spam/SpamSettingsPanel.js +176 -0
  27. package/dist/src/hooks/useIntelligenceData.d.ts +2 -4
  28. package/dist/src/hooks/useIntelligenceData.js +1 -127
  29. package/dist/src/hooks/useJunkMailboxIds.d.ts +2 -0
  30. package/dist/src/hooks/useJunkMailboxIds.js +17 -0
  31. package/dist/src/lib/brief.d.ts +1 -1
  32. package/dist/src/lib/brief.js +3 -3
  33. package/dist/src/lib/check-again.d.ts +33 -0
  34. package/dist/src/lib/check-again.js +66 -0
  35. package/dist/src/lib/conversation-target.d.ts +3 -2
  36. package/dist/src/lib/spam-overview.d.ts +23 -0
  37. package/dist/src/lib/spam-overview.js +44 -0
  38. package/dist/src/lib/spam.d.ts +32 -0
  39. package/dist/src/lib/spam.js +38 -0
  40. package/dist/src/lib/thread-search-tokens.js +3 -1
  41. package/dist/src/routeTree.gen.d.ts +27 -5
  42. package/dist/src/routeTree.gen.js +7 -0
  43. package/dist/src/routes/__root.js +2 -1
  44. package/dist/src/routes/settings/filters.d.ts +6 -2
  45. package/dist/src/routes/settings/filters.js +10 -3
  46. package/dist/src/routes/settings/senders.d.ts +14 -2
  47. package/dist/src/routes/settings/senders.js +32 -15
  48. package/dist/src/routes/settings/spam.d.ts +1 -0
  49. package/dist/src/routes/settings/spam.js +15 -0
  50. package/dist/src/routes/settings.js +6 -1
  51. package/dist/src/routing/spam-link.d.ts +3 -0
  52. package/dist/src/routing/spam-link.js +12 -0
  53. package/package.json +2 -2
  54. package/dist/src/components/mail/AuthenticityBanner.d.ts +0 -14
  55. package/dist/src/components/mail/AuthenticityBanner.js +0 -18
@@ -73,7 +73,7 @@ function BriefPaneProvider({ thread, children }) {
73
73
  mailboxId: selectedThread?.mailboxId ?? "",
74
74
  subject: selectedThread?.subject,
75
75
  messageId: selectedMessageId,
76
- authenticity: selectedThread?.authenticity,
76
+ row: selectedThread,
77
77
  };
78
78
  }, [threadId, selectedThread, selectedMessageId]);
79
79
  const handleOpenThread = useCallback((target, options) => {
@@ -214,7 +214,7 @@ function BriefReading() {
214
214
  currentMailboxId: actions.mailboxId,
215
215
  onMove: actions.moveThread,
216
216
  }
217
- : undefined }), _jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: 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, {})) })] }), _jsx(IntelligenceDrawer, { isOpen: intelligence.drawerOpen, onClose: intelligence.closeDrawer, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
217
+ : undefined }), _jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: 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, {})) })] }), _jsx(IntelligenceDrawer, { isOpen: intelligence.drawerOpen, onClose: intelligence.closeDrawer, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
218
218
  }
219
219
  /**
220
220
  * Intelligence pane: IntelligencePane for the thread open in the brief.
@@ -234,7 +234,7 @@ function BriefPhone() {
234
234
  const { selectedThread, conversation, onOpenThread, onCloseThread, nextThread, previousThread, handleDeselectIfRemoved, } = useBriefPane();
235
235
  const drawer = useIntelligenceDrawer(conversation?.threadId ?? null);
236
236
  if (conversation) {
237
- return (_jsxs(_Fragment, { children: [_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, authenticity: conversation.authenticity, onBack: onCloseThread, 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: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
237
+ return (_jsxs(_Fragment, { children: [_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, spamRow: conversation.row, onBack: onCloseThread, 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: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
238
238
  }
239
239
  // The same list slot the multi-pane layout mounts, so the phone brief wires
240
240
  // the bulk verbs and the selection bar through `DailyBrief` exactly as the
@@ -0,0 +1,30 @@
1
+ import type { RemitImapRescanFailureCode, RemitImapThreadMessageResponse } from "@remit/api-http-client/types.gen.ts";
2
+ import { type ThreadRowData } from "@remit/ui";
3
+ import { type ReactNode } from "react";
4
+ import { type CheckAgainTarget } from "../../lib/check-again";
5
+ export type CheckAgainRequest = CheckAgainTarget;
6
+ export interface CheckAgainContextValue {
7
+ /**
8
+ * Checks the messages again. A list shows the progress panel; a single
9
+ * message shows its new verdict in its own banner instead.
10
+ */
11
+ checkAgain: (requests: readonly CheckAgainRequest[], options: {
12
+ panel: boolean;
13
+ }) => void;
14
+ /** Ids in the batch in flight. */
15
+ pendingIds: ReadonlySet<string>;
16
+ /** Why the last run left a message unchecked. */
17
+ failures: ReadonlyMap<string, RemitImapRescanFailureCode>;
18
+ }
19
+ /** Absent outside the app shell, where nothing can run a check. */
20
+ export declare const useCheckAgain: () => CheckAgainContextValue | undefined;
21
+ /**
22
+ * Owns every Check again run: it sends ten ids per call, one call at a time,
23
+ * so the panel can count each batch as it lands and Stop can end the run after
24
+ * the batch in flight. The run lives in memory and ends with the page.
25
+ */
26
+ export declare function CheckAgainProvider({ children }: {
27
+ children: ReactNode;
28
+ }): import("react").JSX.Element;
29
+ export declare const checkAgainRequestOfThread: (thread: RemitImapThreadMessageResponse, junkMailboxIds: ReadonlySet<string>) => CheckAgainRequest;
30
+ export declare const checkAgainRequestOfRow: (row: ThreadRowData) => CheckAgainRequest | undefined;
@@ -0,0 +1,194 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { threadDetailOperationsListThreadMessagesQueryKey } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
3
+ import { accountMessageOperationsRescanMessages } from "@remit/api-http-client/sdk.gen.ts";
4
+ import { CHECK_AGAIN_FAILURE_SENTENCES, CheckAgainPanel, } from "@remit/ui";
5
+ import { useQueryClient } from "@tanstack/react-query";
6
+ import { createContext, useCallback, useContext, useMemo, useRef, useState, } from "react";
7
+ import { ApiError } from "../../lib/api";
8
+ import { applyRescanResult, EMPTY_SUMMARY, refusedBatch, rescanBatches, } from "../../lib/check-again";
9
+ import { escalate } from "../../lib/escalate";
10
+ import { reportSignedOut } from "../../lib/signed-out";
11
+ import { spamReportHref, spamRowMark } from "../../lib/spam";
12
+ import { invalidateThreadListQueries, threadListCacheKeys, } from "../../lib/thread-list-cache";
13
+ import { useErrorBanners } from "../ui/error-banner-context";
14
+ const CheckAgainContext = createContext(undefined);
15
+ /** Absent outside the app shell, where nothing can run a check. */
16
+ export const useCheckAgain = () => useContext(CheckAgainContext);
17
+ const sendBatch = async (batch) => {
18
+ const response = await accountMessageOperationsRescanMessages({
19
+ path: { accountId: batch.accountId },
20
+ body: { messageIds: batch.targets.map((target) => target.messageId) },
21
+ });
22
+ if (response.data)
23
+ return response.data;
24
+ if (!response.response)
25
+ throw response.error;
26
+ const status = response.response.status;
27
+ if (status === 401)
28
+ return "SignedOut";
29
+ if (status === 403)
30
+ return refusedBatch(batch, "NotPermitted");
31
+ if (status === 404)
32
+ return refusedBatch(batch, "NotFound");
33
+ throw new ApiError(`Check again failed with ${status}`, status, response.error);
34
+ };
35
+ /**
36
+ * Owns every Check again run: it sends ten ids per call, one call at a time,
37
+ * so the panel can count each batch as it lands and Stop can end the run after
38
+ * the batch in flight. The run lives in memory and ends with the page.
39
+ */
40
+ export function CheckAgainProvider({ children }) {
41
+ const queryClient = useQueryClient();
42
+ const { pushError } = useErrorBanners();
43
+ const [panel, setPanel] = useState(undefined);
44
+ const [pendingIds, setPendingIds] = useState(new Set());
45
+ const [failures, setFailures] = useState(new Map());
46
+ const runningRef = useRef(false);
47
+ const stopRef = useRef(false);
48
+ const settle = useCallback((targets) => {
49
+ invalidateThreadListQueries(queryClient, threadListCacheKeys(targets.map((target) => target.mailboxId)));
50
+ for (const threadId of new Set(targets.map((t) => t.threadId))) {
51
+ if (!threadId)
52
+ continue;
53
+ queryClient.invalidateQueries({
54
+ queryKey: threadDetailOperationsListThreadMessagesQueryKey({
55
+ path: { threadId },
56
+ }),
57
+ });
58
+ }
59
+ }, [queryClient]);
60
+ const run = useCallback(async (targets, showPanel) => {
61
+ const total = targets.length;
62
+ let outcome = {
63
+ summary: EMPTY_SUMMARY,
64
+ failures: [],
65
+ };
66
+ let checked = 0;
67
+ if (showPanel)
68
+ setPanel({ state: "Running", checked, total });
69
+ for (const batch of rescanBatches(targets)) {
70
+ if (stopRef.current)
71
+ break;
72
+ setPendingIds(new Set(batch.targets.map((t) => t.messageId)));
73
+ const result = await sendBatch(batch);
74
+ if (result === "SignedOut") {
75
+ reportSignedOut();
76
+ setPendingIds(new Set());
77
+ return;
78
+ }
79
+ outcome = applyRescanResult(outcome, batch, result);
80
+ checked += batch.targets.length;
81
+ setFailures((current) => {
82
+ const next = new Map(current);
83
+ for (const success of result.successful) {
84
+ next.delete(success.messageId);
85
+ }
86
+ for (const failure of result.failed) {
87
+ next.set(failure.messageId, failure.code);
88
+ }
89
+ return next;
90
+ });
91
+ if (showPanel)
92
+ setPanel({ state: "Running", checked, total });
93
+ }
94
+ setPendingIds(new Set());
95
+ settle(targets);
96
+ if (stopRef.current) {
97
+ setPanel(undefined);
98
+ return;
99
+ }
100
+ if (!showPanel) {
101
+ for (const failure of outcome.failures) {
102
+ pushError({
103
+ title: "Couldn't check this message again",
104
+ detail: `${failure.subject}: ${CHECK_AGAIN_FAILURE_SENTENCES[failure.code]}`,
105
+ });
106
+ }
107
+ return;
108
+ }
109
+ if (outcome.failures.length === 0) {
110
+ setPanel({ state: "Done", total, summary: outcome.summary });
111
+ return;
112
+ }
113
+ const retryIds = new Set(outcome.failures.filter((f) => f.retryable).map((f) => f.messageId));
114
+ setPanel({
115
+ state: "PartialFailure",
116
+ checked,
117
+ total,
118
+ failures: outcome.failures,
119
+ retry: targets.filter((target) => retryIds.has(target.messageId)),
120
+ });
121
+ }, [pushError, settle]);
122
+ const start = useCallback((targets, showPanel) => {
123
+ if (targets.length === 0)
124
+ return;
125
+ if (runningRef.current) {
126
+ pushError({
127
+ severity: "info",
128
+ title: "Check again is already running",
129
+ detail: "Wait for the run in progress to finish, or stop it.",
130
+ });
131
+ return;
132
+ }
133
+ runningRef.current = true;
134
+ stopRef.current = false;
135
+ void run(targets, showPanel)
136
+ .catch((error) => {
137
+ setPendingIds(new Set());
138
+ setPanel(undefined);
139
+ escalate(error);
140
+ })
141
+ .finally(() => {
142
+ runningRef.current = false;
143
+ });
144
+ }, [run, pushError]);
145
+ const checkAgain = useCallback((requests, options) => {
146
+ start([...requests], options.panel);
147
+ }, [start]);
148
+ const value = useMemo(() => ({ checkAgain, pendingIds, failures }), [checkAgain, pendingIds, failures]);
149
+ const panelProps = (() => {
150
+ if (!panel)
151
+ return undefined;
152
+ if (panel.state === "Running") {
153
+ return {
154
+ ...panel,
155
+ onStop: () => {
156
+ stopRef.current = true;
157
+ },
158
+ };
159
+ }
160
+ if (panel.state === "Done") {
161
+ return { ...panel, onDone: () => setPanel(undefined) };
162
+ }
163
+ return {
164
+ state: "PartialFailure",
165
+ checked: panel.checked,
166
+ total: panel.total,
167
+ failures: panel.failures,
168
+ reportIssueHref: spamReportHref("Check again left messages unchecked", panel.failures
169
+ .map((failure) => `${failure.messageId}: ${failure.code}`)
170
+ .join(", ")),
171
+ onRetry: () => start(panel.retry, true),
172
+ onClose: () => setPanel(undefined),
173
+ };
174
+ })();
175
+ return (_jsxs(CheckAgainContext.Provider, { value: value, children: [children, panelProps && (_jsx("div", { className: "pointer-events-none fixed inset-x-3 bottom-3 z-40 flex justify-center", children: _jsx("div", { className: "pointer-events-auto w-full max-w-md", children: _jsx(CheckAgainPanel, { ...panelProps }) }) }))] }));
176
+ }
177
+ export const checkAgainRequestOfThread = (thread, junkMailboxIds) => ({
178
+ messageId: thread.messageId,
179
+ accountId: thread.accountId,
180
+ mailboxId: thread.mailboxId,
181
+ threadId: thread.threadId,
182
+ subject: thread.subject ?? "(No subject)",
183
+ before: spamRowMark(thread, junkMailboxIds),
184
+ });
185
+ export const checkAgainRequestOfRow = (row) => row.mailboxId && row.accountId
186
+ ? {
187
+ messageId: row.id,
188
+ accountId: row.accountId,
189
+ mailboxId: row.mailboxId,
190
+ threadId: row.threadId,
191
+ subject: row.subject,
192
+ before: row.spam,
193
+ }
194
+ : undefined;
@@ -31,6 +31,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
31
31
  import { flaggedFilterConfig, formatErrorMessage, MessageListPane, } from "@remit/ui";
32
32
  import { useCallback, useMemo, useState } from "react";
33
33
  import { useCollectionThreads, useCollectionUnreadCount, } from "../../hooks/useCollectionThreads";
34
+ import { useJunkMailboxIds } from "../../hooks/useJunkMailboxIds";
34
35
  import { useIsDesktop } from "../../hooks/useMediaQuery";
35
36
  import { useSearchTokenContext } from "../../hooks/useSearchTokenContext";
36
37
  import { matchesSearchTokens, toThreadRowData } from "../../lib/brief";
@@ -106,12 +107,13 @@ export function CollectionList({ collection, title, selectedMessageId, onOpenThr
106
107
  // beside it — which is what gives a search the same error state, the same
107
108
  // pagination and the same loading state as the unsearched list.
108
109
  const { threads, isLoading, isError, error, refetch, fetchNextPage, hasNextPage, isFetchingNextPage, } = useCollectionThreads(collection, textCriteria);
110
+ const junkMailboxIds = useJunkMailboxIds();
109
111
  const rows = useMemo(() =>
110
112
  // What is left is what no parameter can carry: `before:`, `after:`,
111
113
  // `in:`, `account:`, and a token the chips overruled.
112
114
  dedupeByThread(threads)
113
- .map(toThreadRowData)
114
- .filter((t) => matchesSearchTokens(t, residualTokens)), [threads, residualTokens]);
115
+ .map((thread) => toThreadRowData(thread, junkMailboxIds))
116
+ .filter((t) => matchesSearchTokens(t, residualTokens)), [threads, residualTokens, junkMailboxIds]);
115
117
  const openRow = useCallback((id, options) => {
116
118
  const threadId = rows.find((row) => row.id === id)?.threadId;
117
119
  if (!threadId)
@@ -53,7 +53,7 @@ function CollectionPaneProvider({ collection, title, thread, children, }) {
53
53
  mailboxId: selectedThread?.mailboxId ?? "",
54
54
  subject: selectedThread?.subject,
55
55
  messageId: selectedMessageId,
56
- authenticity: selectedThread?.authenticity,
56
+ row: selectedThread,
57
57
  };
58
58
  }, [threadId, selectedThread, selectedMessageId]);
59
59
  const handleOpenThread = useCallback((target, options) => {
@@ -193,7 +193,7 @@ function CollectionReading() {
193
193
  currentMailboxId: actions.mailboxId,
194
194
  onMove: actions.moveThread,
195
195
  }
196
- : undefined }), _jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: 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, {})) })] }), _jsx(IntelligenceDrawer, { isOpen: intelligence.drawerOpen, onClose: intelligence.closeDrawer, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
196
+ : undefined }), _jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: 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, {})) })] }), _jsx(IntelligenceDrawer, { isOpen: intelligence.drawerOpen, onClose: intelligence.closeDrawer, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
197
197
  }
198
198
  /**
199
199
  * Intelligence pane: IntelligencePane for the open thread.
@@ -211,7 +211,7 @@ function CollectionPhone() {
211
211
  const { selectedThread, conversation, onCloseThread, onOpenThread, nextThread, previousThread, handleDeselectIfRemoved, } = useCollectionPane();
212
212
  const drawer = useIntelligenceDrawer(conversation?.threadId ?? null);
213
213
  if (conversation) {
214
- return (_jsxs(_Fragment, { children: [_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, authenticity: conversation.authenticity, onBack: onCloseThread, 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: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
214
+ return (_jsxs(_Fragment, { children: [_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, spamRow: conversation.row, onBack: onCloseThread, 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: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
215
215
  }
216
216
  return (_jsx("div", { className: "h-full", children: _jsx(CollectionListSlot, {}) }));
217
217
  }
@@ -1,4 +1,4 @@
1
- import type { RemitImapMessageAuthenticity } from "@remit/api-http-client/types.gen.ts";
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
- * Authenticity signal from the thread row (DKIM mismatch). When present
14
- * and `dkimMismatch` is true, a danger banner renders above the message
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
- authenticity?: RemitImapMessageAuthenticity;
16
+ spamRow?: RemitImapThreadMessageResponse;
18
17
  /**
19
- * Callback for the "Why?" link in the authenticity banner — opens /
20
- * focuses the intelligence sidebar.
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, authenticity, onOpenIntelligence, onBack, onSwipeNext, onSwipePrevious, mobileIntelligenceOpen, listOnScreen, }: ConversationViewProps) => import("react").JSX.Element;
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, authenticity, onOpenIntelligence, onBack, onSwipeNext, onSwipePrevious, mobileIntelligenceOpen, listOnScreen = false, }) => {
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: [authenticity?.dkimMismatch && (_jsx(AuthenticityBanner, { authenticity: authenticity, onOpenIntelligence: onOpenIntelligence })), compose, renderMessages(true)] }));
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, authenticity?.dkimMismatch && (_jsx(AuthenticityBanner, { authenticity: authenticity, onOpenIntelligence: onOpenIntelligence })), _jsxs("div", { className: "min-h-0 flex-1 overflow-auto", children: [compose, renderMessages(false)] })] }));
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 SpamAction } from "@remit/ui";
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) => SpamAction;
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.
@@ -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
- authenticity: selectedThread?.authenticity,
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 DKIM mismatch. It lives here, behind the rail's
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 (!selectedThread?.authenticity?.dkimMismatch)
646
+ if (!warned)
644
647
  return;
645
648
  autoOpenedForRef.current = id;
646
649
  openRail();
647
- }, [
648
- railFits,
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, authenticity: conversation.authenticity, 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 })] }));
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
  } }) }))] }));