@remit/web-client 0.0.347 → 0.0.349

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) 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 +11 -6
  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/MailSidebarAdapter.js +17 -6
  12. package/dist/src/components/mail/MailboxPane.js +10 -12
  13. package/dist/src/components/mail/MessageActionMenu.d.ts +3 -1
  14. package/dist/src/components/mail/MessageActionMenu.js +3 -3
  15. package/dist/src/components/mail/MessageCard.js +9 -1
  16. package/dist/src/components/mail/MessageList.js +11 -2
  17. package/dist/src/components/mail/MessageListItem.d.ts +4 -2
  18. package/dist/src/components/mail/MessageListItem.js +4 -6
  19. package/dist/src/components/mail/SpamBannerSlot.d.ts +10 -0
  20. package/dist/src/components/mail/SpamBannerSlot.js +56 -0
  21. package/dist/src/components/mail/SwipeableMessageRow.d.ts +3 -2
  22. package/dist/src/components/mail/SwipeableMessageRow.js +6 -6
  23. package/dist/src/components/mail/ThreadListInteraction.d.ts +2 -0
  24. package/dist/src/components/mail/ThreadListInteraction.js +12 -2
  25. package/dist/src/components/settings/classification/FailureBanner.js +3 -4
  26. package/dist/src/components/settings/spam/SpamSettingsPanel.d.ts +6 -0
  27. package/dist/src/components/settings/spam/SpamSettingsPanel.js +176 -0
  28. package/dist/src/hooks/useIntelligenceData.d.ts +2 -4
  29. package/dist/src/hooks/useIntelligenceData.js +1 -127
  30. package/dist/src/hooks/useJunkMailboxIds.d.ts +2 -0
  31. package/dist/src/hooks/useJunkMailboxIds.js +17 -0
  32. package/dist/src/lib/brief.d.ts +1 -1
  33. package/dist/src/lib/brief.js +3 -3
  34. package/dist/src/lib/check-again.d.ts +33 -0
  35. package/dist/src/lib/check-again.js +66 -0
  36. package/dist/src/lib/conversation-target.d.ts +3 -2
  37. package/dist/src/lib/result-folder.js +7 -0
  38. package/dist/src/lib/spam-overview.d.ts +23 -0
  39. package/dist/src/lib/spam-overview.js +44 -0
  40. package/dist/src/lib/spam.d.ts +32 -0
  41. package/dist/src/lib/spam.js +38 -0
  42. package/dist/src/lib/thread-search-tokens.js +3 -1
  43. package/dist/src/routeTree.gen.d.ts +27 -5
  44. package/dist/src/routeTree.gen.js +7 -0
  45. package/dist/src/routes/__root.js +2 -1
  46. package/dist/src/routes/settings/filters.d.ts +6 -2
  47. package/dist/src/routes/settings/filters.js +10 -3
  48. package/dist/src/routes/settings/senders.d.ts +14 -2
  49. package/dist/src/routes/settings/senders.js +32 -15
  50. package/dist/src/routes/settings/spam.d.ts +1 -0
  51. package/dist/src/routes/settings/spam.js +15 -0
  52. package/dist/src/routes/settings.js +6 -1
  53. package/dist/src/routing/spam-link.d.ts +3 -0
  54. package/dist/src/routing/spam-link.js +12 -0
  55. package/package.json +2 -2
  56. package/dist/src/components/mail/AuthenticityBanner.d.ts +0 -14
  57. package/dist/src/components/mail/AuthenticityBanner.js +0 -18
@@ -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
  } }) }))] }));
@@ -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 })), 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" })] }))] }) }));
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
- // The backend's DKIM-alignment verdict is authoritative: it already accounts
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;
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SpamWarningBanner } from "@remit/ui";
3
+ import { useJunkMailbox } from "../../hooks/useArchiveMailbox";
4
+ import { useMoveMessages } from "../../hooks/useMoveMessages";
5
+ import { useReportSpam } from "../../hooks/useReportSpam";
6
+ import { raisesSpamWarning } from "../../lib/spam";
7
+ import { useErrorBanners } from "../ui/error-banner-context";
8
+ import { checkAgainRequestOfThread, useCheckAgain } from "./CheckAgainProvider";
9
+ /**
10
+ * The message view's one banner slot, between the header and the body. It
11
+ * warns while the message carries a Remit Spam or Phishing label outside Spam,
12
+ * or when the check failed, and goes when the label goes.
13
+ */
14
+ export function SpamBannerSlot({ row, onOpenIntelligence, }) {
15
+ const { accountId } = row;
16
+ const { junkMailboxId } = useJunkMailbox(accountId);
17
+ const checkAgain = useCheckAgain();
18
+ const { pushError } = useErrorBanners();
19
+ const { reportSpam, notSpam, isReporting, isRestoring } = useReportSpam({
20
+ mailboxId: row.mailboxId,
21
+ threadId: row.threadId,
22
+ accountId,
23
+ });
24
+ const { moveMessages, isPending: isMoving } = useMoveMessages({
25
+ mailboxId: row.mailboxId,
26
+ threadId: row.threadId,
27
+ accountId,
28
+ });
29
+ const verdict = row.spamVerdict;
30
+ const inSpamFolder = junkMailboxId !== undefined && row.mailboxId === junkMailboxId;
31
+ if (!raisesSpamWarning(row, inSpamFolder))
32
+ return null;
33
+ if (verdict.state !== "Checked" && verdict.state !== "Failed")
34
+ return null;
35
+ const pending = checkAgain?.pendingIds.has(row.messageId)
36
+ ? "CheckAgain"
37
+ : isReporting
38
+ ? "Report"
39
+ : isRestoring
40
+ ? "NotSpam"
41
+ : isMoving
42
+ ? "Move"
43
+ : undefined;
44
+ return (_jsx(SpamWarningBanner, { verdict: verdict, inSpamFolder: inSpamFolder, pending: pending, checkAgainFailure: checkAgain?.failures.get(row.messageId), onNotSpam: () => notSpam([row.messageId]), onReport: () => reportSpam([row.messageId]), onMove: () => {
45
+ if (junkMailboxId) {
46
+ moveMessages([row.messageId], junkMailboxId);
47
+ return;
48
+ }
49
+ pushError({
50
+ title: "Couldn't move this message to Spam",
51
+ detail: "This account has no Spam folder yet. Choose one in Settings, Folder roles.",
52
+ });
53
+ }, onWhy: () => onOpenIntelligence?.(), onCheckAgain: () => checkAgain?.checkAgain([
54
+ checkAgainRequestOfThread(row, junkMailboxId ? new Set([junkMailboxId]) : new Set()),
55
+ ], { panel: false }) }));
56
+ }
@@ -3,6 +3,7 @@ import { type Density, type SelectionModifiers, type ThreadRowData } from "@remi
3
3
  interface SwipeableMessageRowProps {
4
4
  thread: RemitImapThreadMessageResponse;
5
5
  mailboxId: string;
6
+ junkMailboxIds: ReadonlySet<string>;
6
7
  isSelected: boolean;
7
8
  /** Roving keyboard focus cursor — renders the left accent rail (#429). */
8
9
  isFocused?: boolean;
@@ -26,6 +27,6 @@ interface SwipeableMessageRowProps {
26
27
  * so every row signal has to be repeated here. Exported so a test can hold it
27
28
  * to the same answers as the desktop mapper.
28
29
  */
29
- export declare const swipeableRowData: (thread: RemitImapThreadMessageResponse) => ThreadRowData;
30
- export declare const SwipeableMessageRow: ({ thread, mailboxId, isSelected, isFocused, isTabStop, onFocusRow, isChecked, onToggleCheck, onRowSelect, isMultiSelectMode, onLongPress, isDesktop, onDelete, onToggleRead, density, }: SwipeableMessageRowProps) => import("react").JSX.Element;
30
+ export declare const swipeableRowData: (thread: RemitImapThreadMessageResponse, junkMailboxIds: ReadonlySet<string>) => ThreadRowData;
31
+ export declare const SwipeableMessageRow: ({ thread, mailboxId, junkMailboxIds, isSelected, isFocused, isTabStop, onFocusRow, isChecked, onToggleCheck, onRowSelect, isMultiSelectMode, onLongPress, isDesktop, onDelete, onToggleRead, density, }: SwipeableMessageRowProps) => import("react").JSX.Element;
31
32
  export {};
@@ -4,6 +4,7 @@ import { useCallback, useState } from "react";
4
4
  import { toDisplayCategory } from "../../lib/display-category";
5
5
  import { formatEmailDate } from "../../lib/format";
6
6
  import { rowSettlement } from "../../lib/row-settlement";
7
+ import { spamRowMark } from "../../lib/spam";
7
8
  import { useOpenThread } from "../../routing";
8
9
  import { MessageListItem } from "./MessageListItem";
9
10
  import { useModifierSelect } from "./useModifierSelect";
@@ -13,8 +14,7 @@ import { useModifierSelect } from "./useModifierSelect";
13
14
  * so every row signal has to be repeated here. Exported so a test can hold it
14
15
  * to the same answers as the desktop mapper.
15
16
  */
16
- export const swipeableRowData = (thread) => {
17
- const suspicious = thread.authenticity?.dkimMismatch === true;
17
+ export const swipeableRowData = (thread, junkMailboxIds) => {
18
18
  return {
19
19
  id: thread.messageId,
20
20
  accountId: thread.accountId,
@@ -28,11 +28,11 @@ export const swipeableRowData = (thread) => {
28
28
  starred: thread.hasStars === true,
29
29
  trust: thread.senderTrust,
30
30
  category: toDisplayCategory(thread.category),
31
- suspicious,
31
+ spam: spamRowMark(thread, junkMailboxIds),
32
32
  ...rowSettlement(thread),
33
33
  };
34
34
  };
35
- export const SwipeableMessageRow = ({ thread, mailboxId, isSelected, isFocused, isTabStop, onFocusRow, isChecked, onToggleCheck, onRowSelect, isMultiSelectMode, onLongPress, isDesktop, onDelete, onToggleRead, density, }) => {
35
+ export const SwipeableMessageRow = ({ thread, mailboxId, junkMailboxIds, isSelected, isFocused, isTabStop, onFocusRow, isChecked, onToggleCheck, onRowSelect, isMultiSelectMode, onLongPress, isDesktop, onDelete, onToggleRead, density, }) => {
36
36
  const [peek, setPeek] = useState("none");
37
37
  const openThread = useOpenThread();
38
38
  const handleAct = useCallback((side) => {
@@ -56,7 +56,7 @@ export const SwipeableMessageRow = ({ thread, mailboxId, isSelected, isFocused,
56
56
  }, [openThread, thread.threadId, thread.messageId]);
57
57
  const modifierSelect = useModifierSelect(thread.messageId, onRowSelect);
58
58
  if (isDesktop || isMultiSelectMode) {
59
- return (_jsx(MessageListItem, { thread: thread, mailboxId: mailboxId, isSelected: isSelected, isFocused: isFocused, isTabStop: isTabStop, onFocusRow: onFocusRow, isChecked: isChecked, onToggleCheck: onToggleCheck, onRowSelect: onRowSelect, isMultiSelectMode: isMultiSelectMode, onLongPress: onLongPress, isDesktop: isDesktop, density: density }));
59
+ return (_jsx(MessageListItem, { thread: thread, mailboxId: mailboxId, junkMailboxIds: junkMailboxIds, isSelected: isSelected, isFocused: isFocused, isTabStop: isTabStop, onFocusRow: onFocusRow, isChecked: isChecked, onToggleCheck: onToggleCheck, onRowSelect: onRowSelect, isMultiSelectMode: isMultiSelectMode, onLongPress: onLongPress, isDesktop: isDesktop, density: density }));
60
60
  }
61
61
  // The swipe row reads the press as a pointer gesture, and it opens the message
62
62
  // from the release — a `mousedown` handler on the row would already be behind
@@ -65,5 +65,5 @@ export const SwipeableMessageRow = ({ thread, mailboxId, isSelected, isFocused,
65
65
  // swipe, a long press or an open.
66
66
  return (
67
67
  // biome-ignore lint/a11y/noStaticElementInteractions: the wrapper only intercepts mouse modifiers ahead of the row's own gesture; the row beneath keeps the button semantics and the whole keyboard path
68
- _jsx("div", { role: "presentation", onPointerDownCapture: modifierSelect.onMouseDown, onClickCapture: modifierSelect.claimClick, onContextMenu: modifierSelect.onContextMenu, children: _jsx(SwipeableRow, { thread: swipeableRowData(thread), selectionMode: false, checked: false, active: isSelected, peek: peek, onPeek: setPeek, onToggleCheck: handleToggleCheck, onLongPress: handleLongPress, onOpen: handleOpen, onAct: handleAct }) }));
68
+ _jsx("div", { role: "presentation", onPointerDownCapture: modifierSelect.onMouseDown, onClickCapture: modifierSelect.claimClick, onContextMenu: modifierSelect.onContextMenu, children: _jsx(SwipeableRow, { thread: swipeableRowData(thread, junkMailboxIds), selectionMode: false, checked: false, active: isSelected, peek: peek, onPeek: setPeek, onToggleCheck: handleToggleCheck, onLongPress: handleLongPress, onOpen: handleOpen, onAct: handleAct }) }));
69
69
  };
@@ -45,6 +45,8 @@ interface ThreadListInteractionValue {
45
45
  allSelected: boolean;
46
46
  /** Select every rendered row, or clear when they already all are. */
47
47
  toggleAllLoaded: () => void;
48
+ /** Checks the selection for spam again. Absent outside the app shell. */
49
+ checkAgainSelection: (() => void) | undefined;
48
50
  }
49
51
  /**
50
52
  * Per-row cursor/selection state, or null outside a provider — the mailbox list
@@ -25,6 +25,7 @@ import { useIsDesktop } from "../../hooks/useMediaQuery";
25
25
  import { tabStopId } from "../../lib/list-focus";
26
26
  import { useListHeaderChrome } from "../../lib/list-header-chrome";
27
27
  import { useErrorBanners } from "../ui/error-banner-context";
28
+ import { checkAgainRequestOfRow, useCheckAgain } from "./CheckAgainProvider";
28
29
  import { DeleteConfirmDialog } from "./DeleteConfirmDialog";
29
30
  /** Nothing pending, as a stable identity so the outcome memo does not churn. */
30
31
  const NO_TARGETS = [];
@@ -255,7 +256,15 @@ export function ThreadListInteraction({ selectedMessageId, rows, onOpen, onDelet
255
256
  hasList,
256
257
  ]);
257
258
  const tabStop = tabStopId(orderedIds, focusedMessageId);
259
+ const checkAgain = useCheckAgain();
260
+ const checkAgainSelection = useMemo(() => checkAgain
261
+ ? () => checkAgain.checkAgain(rows
262
+ .filter((row) => selectedIds.has(row.id))
263
+ .map(checkAgainRequestOfRow)
264
+ .filter((request) => request !== undefined), { panel: true })
265
+ : undefined, [checkAgain, rows, selectedIds]);
258
266
  const value = useMemo(() => ({
267
+ checkAgainSelection,
259
268
  selectedIds,
260
269
  selectedCount,
261
270
  exitSelection,
@@ -277,6 +286,7 @@ export function ThreadListInteraction({ selectedMessageId, rows, onOpen, onDelet
277
286
  },
278
287
  }),
279
288
  }), [
289
+ checkAgainSelection,
280
290
  selectedIds,
281
291
  selectedCount,
282
292
  exitSelection,
@@ -308,8 +318,8 @@ export function ThreadListInteraction({ selectedMessageId, rows, onOpen, onDelet
308
318
  */
309
319
  export function ThreadListSelectionBar({ title, isDeleting, }) {
310
320
  const chrome = useListHeaderChrome();
311
- const { selectedCount, exitSelection, startSelectionVerb, orderedIds, allSelected, toggleAllLoaded, } = useThreadListSelection();
312
- return (_jsx(SelectionTopBar, { title: chrome.title || title, navSlot: chrome.navSlot, titleMeta: chrome.titleMeta, searchSlot: chrome.searchSlot, searchField: chrome.searchField, idleSlot: chrome.makeFilterSlot, count: selectedCount, onCancel: exitSelection, onDelete: () => startSelectionVerb("delete"), onMarkRead: () => startSelectionVerb("markRead"), isBusy: isDeleting, selectAll: orderedIds.length > 0
321
+ const { selectedCount, exitSelection, startSelectionVerb, orderedIds, allSelected, toggleAllLoaded, checkAgainSelection, } = useThreadListSelection();
322
+ return (_jsx(SelectionTopBar, { title: chrome.title || title, navSlot: chrome.navSlot, titleMeta: chrome.titleMeta, searchSlot: chrome.searchSlot, searchField: chrome.searchField, idleSlot: chrome.makeFilterSlot, count: selectedCount, onCancel: exitSelection, onDelete: () => startSelectionVerb("delete"), onMarkRead: () => startSelectionVerb("markRead"), onCheckAgain: checkAgainSelection, isBusy: isDeleting, selectAll: orderedIds.length > 0
313
323
  ? {
314
324
  checked: allSelected,
315
325
  indeterminate: selectedCount > 0 && !allSelected,
@@ -1,8 +1,7 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Banner, Button, formatErrorMessage } from "@remit/ui";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { formatErrorMessage, FailureBanner as SectionFailureBanner, } from "@remit/ui";
3
3
  import { classificationReportHref } from "../../../lib/classification";
4
- import { ReportLink } from "../ReportLink";
5
4
  export function FailureBanner({ failure, onRetry, }) {
6
5
  const message = formatErrorMessage(failure.error);
7
- return (_jsxs(Banner, { tone: "danger", variant: "soft", children: [_jsx("p", { className: "font-medium", children: failure.title }), _jsx("p", { className: "mt-0.5 break-words text-fg-muted", children: message }), _jsxs("p", { className: "flex flex-wrap items-center gap-x-4", children: [onRetry && (_jsx(Button, { variant: "secondary", className: "min-h-11", onClick: onRetry, children: "Retry" })), _jsx(ReportLink, { href: classificationReportHref(failure.title, message) })] })] }));
6
+ return (_jsx(SectionFailureBanner, { title: failure.title, message: message, reportHref: classificationReportHref(failure.title, message), onRetry: onRetry }));
8
7
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The Spam & phishing settings at `/settings/spam`: what Remit flagged in the
3
+ * last 30 days, the thresholds in effect, the per-label action and the sender
4
+ * groups. Every section loads and fails on its own.
5
+ */
6
+ export declare function SpamSettingsPanel(): import("react").JSX.Element;