@remit/web-client 0.0.346 → 0.0.348

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) 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/{FlaggedList.d.ts → CollectionList.d.ts} +7 -3
  5. package/dist/src/components/mail/{FlaggedList.js → CollectionList.js} +29 -24
  6. package/dist/src/components/mail/CollectionPane.d.ts +32 -0
  7. package/dist/src/components/mail/{FlaggedPane.js → CollectionPane.js} +35 -33
  8. package/dist/src/components/mail/ConversationView.d.ts +7 -8
  9. package/dist/src/components/mail/ConversationView.js +4 -4
  10. package/dist/src/components/mail/DailyBrief.js +6 -4
  11. package/dist/src/components/mail/IntelligencePane.d.ts +2 -2
  12. package/dist/src/components/mail/IntelligencePane.js +33 -4
  13. package/dist/src/components/mail/MailSidebarAdapter.js +29 -7
  14. package/dist/src/components/mail/MailboxPane.js +10 -12
  15. package/dist/src/components/mail/MessageActionMenu.d.ts +3 -1
  16. package/dist/src/components/mail/MessageActionMenu.js +3 -3
  17. package/dist/src/components/mail/MessageCard.js +9 -1
  18. package/dist/src/components/mail/MessageList.js +11 -2
  19. package/dist/src/components/mail/MessageListItem.d.ts +4 -2
  20. package/dist/src/components/mail/MessageListItem.js +4 -6
  21. package/dist/src/components/mail/SpamBannerSlot.d.ts +10 -0
  22. package/dist/src/components/mail/SpamBannerSlot.js +56 -0
  23. package/dist/src/components/mail/SwipeableMessageRow.d.ts +3 -2
  24. package/dist/src/components/mail/SwipeableMessageRow.js +6 -6
  25. package/dist/src/components/mail/ThreadListInteraction.d.ts +2 -0
  26. package/dist/src/components/mail/ThreadListInteraction.js +12 -2
  27. package/dist/src/components/settings/classification/FailureBanner.js +3 -4
  28. package/dist/src/components/settings/spam/SpamSettingsPanel.d.ts +6 -0
  29. package/dist/src/components/settings/spam/SpamSettingsPanel.js +176 -0
  30. package/dist/src/hooks/{useStarredThreads.d.ts → useCollectionThreads.d.ts} +10 -8
  31. package/dist/src/hooks/{useStarredThreads.js → useCollectionThreads.js} +16 -14
  32. package/dist/src/hooks/useCurrentMailboxName.d.ts +1 -0
  33. package/dist/src/hooks/useCurrentMailboxName.js +6 -1
  34. package/dist/src/hooks/useIntelligenceData.d.ts +2 -4
  35. package/dist/src/hooks/useIntelligenceData.js +1 -127
  36. package/dist/src/hooks/useJunkMailboxIds.d.ts +2 -0
  37. package/dist/src/hooks/useJunkMailboxIds.js +17 -0
  38. package/dist/src/hooks/useLabels.d.ts +10 -9
  39. package/dist/src/hooks/useLabels.js +25 -6
  40. package/dist/src/lib/brief.d.ts +1 -1
  41. package/dist/src/lib/brief.js +3 -3
  42. package/dist/src/lib/check-again.d.ts +33 -0
  43. package/dist/src/lib/check-again.js +66 -0
  44. package/dist/src/lib/{flagged-criteria.d.ts → collection-criteria.d.ts} +18 -6
  45. package/dist/src/lib/{flagged-criteria.js → collection-criteria.js} +4 -3
  46. package/dist/src/lib/conversation-target.d.ts +3 -2
  47. package/dist/src/lib/label-folders.d.ts +6 -0
  48. package/dist/src/lib/label-folders.js +10 -0
  49. package/dist/src/lib/mail-route.d.ts +10 -5
  50. package/dist/src/lib/mail-route.js +9 -1
  51. package/dist/src/lib/mail-search.d.ts +11 -0
  52. package/dist/src/lib/mail-search.js +4 -0
  53. package/dist/src/lib/search-scope.d.ts +2 -2
  54. package/dist/src/lib/search-scope.js +4 -4
  55. package/dist/src/lib/search-tokens.d.ts +1 -1
  56. package/dist/src/lib/search-tokens.js +2 -2
  57. package/dist/src/lib/spam-overview.d.ts +23 -0
  58. package/dist/src/lib/spam-overview.js +44 -0
  59. package/dist/src/lib/spam.d.ts +32 -0
  60. package/dist/src/lib/spam.js +38 -0
  61. package/dist/src/lib/thread-search-tokens.js +3 -1
  62. package/dist/src/routeTree.gen.d.ts +312 -5
  63. package/dist/src/routeTree.gen.js +72 -0
  64. package/dist/src/routes/__root.js +2 -1
  65. package/dist/src/routes/mail/flagged/$threadId/$messageId.js +2 -2
  66. package/dist/src/routes/mail/flagged/$threadId/index.js +2 -2
  67. package/dist/src/routes/mail/flagged/index.js +2 -2
  68. package/dist/src/routes/mail/flagged.js +3 -2
  69. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId/$mode.{-$outboxMessageId}.d.ts +18 -0
  70. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId/$mode.{-$outboxMessageId}.js +8 -0
  71. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId.d.ts +15 -0
  72. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId.js +14 -0
  73. package/dist/src/routes/mail/label/$labelId/$threadId/index.d.ts +15 -0
  74. package/dist/src/routes/mail/label/$labelId/$threadId/index.js +9 -0
  75. package/dist/src/routes/mail/label/$labelId/$threadId.d.ts +15 -0
  76. package/dist/src/routes/mail/label/$labelId/$threadId.js +8 -0
  77. package/dist/src/routes/mail/label/$labelId/compose.{-$outboxMessageId}.d.ts +15 -0
  78. package/dist/src/routes/mail/label/$labelId/compose.{-$outboxMessageId}.js +10 -0
  79. package/dist/src/routes/mail/label/$labelId/index.d.ts +15 -0
  80. package/dist/src/routes/mail/label/$labelId/index.js +9 -0
  81. package/dist/src/routes/mail/label/$labelId.d.ts +15 -0
  82. package/dist/src/routes/mail/label/$labelId.js +30 -0
  83. package/dist/src/routes/mail/label/index.d.ts +29 -0
  84. package/dist/src/routes/mail/label/index.js +18 -0
  85. package/dist/src/routes/settings/filters.d.ts +6 -2
  86. package/dist/src/routes/settings/filters.js +10 -3
  87. package/dist/src/routes/settings/senders.d.ts +14 -2
  88. package/dist/src/routes/settings/senders.js +32 -15
  89. package/dist/src/routes/settings/spam.d.ts +1 -0
  90. package/dist/src/routes/settings/spam.js +15 -0
  91. package/dist/src/routes/settings.js +6 -1
  92. package/dist/src/routing/browsed-list.d.ts +1 -1
  93. package/dist/src/routing/browsed-list.js +15 -4
  94. package/dist/src/routing/compose.js +10 -6
  95. package/dist/src/routing/index.d.ts +1 -1
  96. package/dist/src/routing/index.js +1 -1
  97. package/dist/src/routing/nav-selection.d.ts +5 -0
  98. package/dist/src/routing/nav-selection.js +15 -0
  99. package/dist/src/routing/open-thread.js +23 -3
  100. package/dist/src/routing/reply.js +28 -11
  101. package/dist/src/routing/search-mirror.d.ts +5 -0
  102. package/dist/src/routing/search-mirror.js +20 -2
  103. package/dist/src/routing/spam-link.d.ts +3 -0
  104. package/dist/src/routing/spam-link.js +12 -0
  105. package/package.json +2 -2
  106. package/dist/src/components/mail/AuthenticityBanner.d.ts +0 -14
  107. package/dist/src/components/mail/AuthenticityBanner.js +0 -18
  108. package/dist/src/components/mail/FlaggedPane.d.ts +0 -29
@@ -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;
@@ -0,0 +1,176 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { classificationStatsOperationsGetClassificationStatsOptions, configOperationsGetConfigOptions, userSettingsOperationsGetUserSettingsOptions, } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
3
+ import { unifiedThreadOperationsListAllThreads } from "@remit/api-http-client/sdk.gen.ts";
4
+ import { buttonClassName, cn, FailureBanner, formatErrorMessage, formatSpamScore, LabelChip, SegmentedControl, SpamDailyChart, topSpamReasonSentence, } from "@remit/ui";
5
+ import { useQuery } from "@tanstack/react-query";
6
+ import { useId, useState } from "react";
7
+ import { useSaveClassification } from "../../../hooks/useClassificationSettings";
8
+ import { useJunkMailboxIds } from "../../../hooks/useJunkMailboxIds";
9
+ import { useLabelList } from "../../../hooks/useLabels";
10
+ import { isUnauthenticated, softErrorStatuses, } from "../../../lib/error-classifier";
11
+ import { formatEmailDate } from "../../../lib/format";
12
+ import { flaggedVerdict, remitSpamLabel, spamReportHref, } from "../../../lib/spam";
13
+ import { buildSpamOverview, overviewDays, spamOverviewSince, } from "../../../lib/spam-overview";
14
+ import { NavLink } from "../../../routing";
15
+ const SECTION_TITLE = "text-xs font-semibold uppercase tracking-wider text-fg-subtle";
16
+ const sectionMeta = softErrorStatuses(400, 403, 404);
17
+ const LATEST_COUNT = 10;
18
+ function Section({ title, children, aside, }) {
19
+ const id = useId();
20
+ return (_jsxs("section", { "aria-labelledby": id, className: "space-y-3", children: [_jsxs("div", { className: "flex flex-wrap items-baseline justify-between gap-2", children: [_jsx("h2", { id: id, className: SECTION_TITLE, children: title }), aside] }), children] }));
21
+ }
22
+ function Skeleton({ className }) {
23
+ return (_jsx("div", { "aria-hidden": "true", className: cn("animate-pulse rounded-md bg-surface-sunken", className) }));
24
+ }
25
+ /**
26
+ * A section's load failure. An expired session raises the signed-out notice
27
+ * over the page, so the section stays a skeleton behind it rather than reading
28
+ * as empty.
29
+ */
30
+ function SectionFailure({ title, error, onRetry, skeleton, }) {
31
+ if (isUnauthenticated(error))
32
+ return skeleton;
33
+ const message = formatErrorMessage(error);
34
+ return (_jsx(FailureBanner, { title: title, message: message, reportHref: spamReportHref(title, message), onRetry: onRetry }));
35
+ }
36
+ function OverviewSection() {
37
+ const [now] = useState(() => new Date());
38
+ const stats = useQuery({
39
+ ...classificationStatsOperationsGetClassificationStatsOptions({
40
+ query: { since: spamOverviewSince(now) },
41
+ }),
42
+ meta: sectionMeta,
43
+ });
44
+ const skeleton = (_jsxs(_Fragment, { children: [_jsx(Skeleton, { className: "h-4 w-64" }), _jsxs("div", { className: "grid gap-6 sm:grid-cols-2", children: [_jsx(Skeleton, { className: "h-32" }), _jsx(Skeleton, { className: "h-32" })] })] }));
45
+ if (stats.isPending)
46
+ return _jsx(Section, { title: "Last 30 days", children: skeleton });
47
+ if (stats.isError) {
48
+ return (_jsx(Section, { title: "Last 30 days", children: _jsx(SectionFailure, { title: "Couldn't count the last 30 days", error: stats.error, onRetry: () => void stats.refetch(), skeleton: skeleton }) }));
49
+ }
50
+ const overview = buildSpamOverview(stats.data, overviewDays(now));
51
+ if (!overview.checkedAny) {
52
+ return (_jsx(Section, { title: "Last 30 days", children: _jsxs("div", { className: "rounded-md border border-line px-4 py-6 text-center", children: [_jsx("p", { className: "font-medium text-fg", children: "Remit has not checked any mail yet" }), _jsx("p", { className: "mt-1 text-sm text-fg-muted", children: "Counts appear here once new mail arrives." })] }) }));
53
+ }
54
+ return (_jsxs(Section, { title: "Last 30 days", children: [_jsx("p", { className: "text-sm text-fg tabular-nums", children: `Reached Spam ${overview.moved} · Warned ${overview.warned}` }), _jsxs("div", { className: "grid gap-6 sm:grid-cols-2", children: [_jsx(SpamDailyChart, { title: "Spam", tone: "warning", days: overview.spam }), _jsx(SpamDailyChart, { title: "Phishing", tone: "danger", days: overview.phishing })] }), _jsxs("ul", { className: "flex list-none flex-wrap gap-x-4 gap-y-1 text-2xs text-fg-muted", children: [_jsxs("li", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "size-2 rounded-sm bg-fg-muted", "aria-hidden": "true" }), "Reached the Move to Spam threshold"] }), _jsxs("li", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "size-2 rounded-sm bg-fg-muted/35", "aria-hidden": "true" }), "Warned"] })] })] }));
55
+ }
56
+ const latestOf = async (labelId) => {
57
+ const { data } = await unifiedThreadOperationsListAllThreads({
58
+ query: { labelId, order: "desc", limit: LATEST_COUNT },
59
+ throwOnError: true,
60
+ });
61
+ return data.items ?? [];
62
+ };
63
+ function LatestSection() {
64
+ const junkMailboxIds = useJunkMailboxIds();
65
+ const config = useQuery({
66
+ ...configOperationsGetConfigOptions(),
67
+ staleTime: Infinity,
68
+ });
69
+ const labelList = useLabelList(config.data?.accounts[0]?.accountId);
70
+ const spamLabel = labelList.labels.find((label) => label.name === "Spam");
71
+ const phishingLabel = labelList.labels.find((label) => label.name === "Phishing");
72
+ const labelIds = [spamLabel, phishingLabel].flatMap((label) => label ? [label.labelId] : []);
73
+ const latest = useQuery({
74
+ queryKey: ["spam-settings", "latest-flagged", ...labelIds],
75
+ queryFn: async () => (await Promise.all(labelIds.map(latestOf)))
76
+ .flat()
77
+ .filter((row) => !row.spamCleared && remitSpamLabel(row.labels) !== undefined)
78
+ .sort((a, b) => b.sentDate - a.sentDate)
79
+ .slice(0, LATEST_COUNT),
80
+ enabled: labelList.isSuccess,
81
+ meta: sectionMeta,
82
+ });
83
+ const skeleton = (_jsx("div", { className: "space-y-2", children: ["a", "b", "c", "d"].map((key) => (_jsx(Skeleton, { className: "h-10" }, key))) }));
84
+ const failure = config.isError
85
+ ? { error: config.error, retry: () => void config.refetch() }
86
+ : labelList.isError
87
+ ? { error: labelList.error, retry: () => void labelList.refetch() }
88
+ : latest.isError
89
+ ? { error: latest.error, retry: () => void latest.refetch() }
90
+ : undefined;
91
+ if (failure) {
92
+ return (_jsx(Section, { title: "Latest flagged", children: _jsx(SectionFailure, { title: "Couldn't load the latest flagged mail", error: failure.error, onRetry: failure.retry, skeleton: skeleton }) }));
93
+ }
94
+ if (!latest.isSuccess) {
95
+ return _jsx(Section, { title: "Latest flagged", children: skeleton });
96
+ }
97
+ if (latest.data.length === 0) {
98
+ return (_jsx(Section, { title: "Latest flagged", children: _jsx("p", { className: "text-sm text-fg-muted", children: "Nothing flagged yet." }) }));
99
+ }
100
+ return (_jsx(Section, { title: "Latest flagged", aside: _jsxs("span", { className: "flex gap-4 text-sm", children: [spamLabel && (_jsx(NavLink, { to: "/mail/label/$labelId", params: { labelId: spamLabel.labelId }, variant: "inline", children: "Review all in Spam" })), phishingLabel && (_jsx(NavLink, { to: "/mail/label/$labelId", params: { labelId: phishingLabel.labelId }, variant: "inline", children: "Open Phishing" }))] }), children: _jsx("div", { className: "overflow-x-auto rounded-md border border-line", children: _jsxs("table", { className: "w-full text-left text-sm", children: [_jsx("thead", { className: "border-b border-line text-2xs uppercase tracking-wide text-fg-subtle", children: _jsxs("tr", { children: [_jsx("th", { className: "px-3 py-2 font-medium", children: "Sender" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Subject and top reason" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Date" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Label" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Action" })] }) }), _jsx("tbody", { className: "divide-y divide-line", children: latest.data.map((row) => {
101
+ const label = remitSpamLabel(row.labels);
102
+ if (!label)
103
+ return null;
104
+ const verdict = flaggedVerdict(row.spamVerdict);
105
+ return (_jsxs("tr", { className: "hover:bg-surface-sunken", children: [_jsx("td", { className: "px-3 py-2 align-top text-fg", children: row.fromName ?? row.fromEmail ?? "Unknown" }), _jsxs("td", { className: "px-3 py-2 align-top", children: [_jsx(NavLink, { to: "/mail/label/$labelId/$threadId/$messageId", params: {
106
+ labelId: label.labelId,
107
+ threadId: row.threadId,
108
+ messageId: row.messageId,
109
+ }, variant: "inline", className: "text-fg", children: row.subject ?? "(No subject)" }), verdict && (_jsx("p", { className: "text-xs text-fg-muted", children: topSpamReasonSentence(verdict.reasons) }))] }), _jsx("td", { className: "whitespace-nowrap px-3 py-2 align-top text-fg-muted tabular-nums", children: formatEmailDate(row.sentDate) }), _jsx("td", { className: "px-3 py-2 align-top", children: _jsx(LabelChip, { label: label }) }), _jsx("td", { className: "px-3 py-2 align-top text-fg-muted", children: junkMailboxIds.has(row.mailboxId) ? "Moved" : "Warned" })] }, row.messageId));
110
+ }) })] }) }) }));
111
+ }
112
+ function ThresholdsSection({ spam }) {
113
+ const { thresholds } = spam;
114
+ return (_jsxs(Section, { title: "Thresholds", children: [thresholds.state === "Set" ? (_jsxs("dl", { className: "flex flex-wrap gap-x-8 gap-y-2 text-sm", children: [_jsxs("div", { children: [_jsx("dt", { className: "text-fg-muted", children: "Warn from" }), _jsx("dd", { className: "font-medium text-fg tabular-nums", children: formatSpamScore(thresholds.cleanBelow) })] }), _jsxs("div", { children: [_jsx("dt", { className: "text-fg-muted", children: "Move to Spam from" }), _jsx("dd", { className: "font-medium text-fg tabular-nums", children: formatSpamScore(thresholds.spamAt) })] })] })) : (_jsx("p", { className: "text-sm text-fg", children: "The spam service applies its own thresholds." })), _jsx("p", { className: "text-xs text-fg-muted", children: "Scores run from 0 to 1. The deployment sets these values, and they apply to mail arriving from now on. Check again in any list updates older mail." })] }));
115
+ }
116
+ const PLACEMENT_OPTIONS = [
117
+ { value: "WarnOnly", label: "Warn only" },
118
+ { value: "MoveToSpam", label: "Move to Spam" },
119
+ ];
120
+ function PlacementSection({ spam }) {
121
+ const save = useSaveClassification();
122
+ const [announcement, setAnnouncement] = useState("");
123
+ const ids = useId();
124
+ const rows = [
125
+ {
126
+ field: "spamPlacementSpam",
127
+ label: "Spam",
128
+ value: spam.spamPlacement,
129
+ },
130
+ {
131
+ field: "spamPlacementPhishing",
132
+ label: "Phishing",
133
+ value: spam.phishingPlacement,
134
+ },
135
+ ];
136
+ return (_jsxs(Section, { title: "Per label", children: [_jsx("div", { className: "space-y-2", children: rows.map((row) => (_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("span", { className: "w-20 text-sm text-fg", children: row.label }), _jsx(SegmentedControl, { name: `${ids}-${row.field}`, "aria-label": `${row.label} label`, size: "sm", options: PLACEMENT_OPTIONS, value: row.value, onChange: (placement) => {
137
+ setAnnouncement("");
138
+ save.mutate({ body: { [row.field]: placement } }, { onSuccess: () => setAnnouncement("Saved") });
139
+ } })] }, row.field))) }), _jsx("p", { className: "text-xs text-fg-muted", children: "Warn only keeps the message where it arrived, under the warning banner." }), save.isError && (_jsx(FailureBanner, { title: "The label setting was not saved", message: formatErrorMessage(save.error), reportHref: spamReportHref("The label setting was not saved", formatErrorMessage(save.error)), onRetry: () => save.variables && save.mutate(save.variables) })), _jsx("p", { "aria-live": "polite", className: "text-xs text-positive", children: announcement })] }));
140
+ }
141
+ function SettingsSections() {
142
+ const settings = useQuery({
143
+ ...userSettingsOperationsGetUserSettingsOptions(),
144
+ meta: sectionMeta,
145
+ });
146
+ const skeleton = (_jsxs(_Fragment, { children: [_jsx(Section, { title: "Thresholds", children: _jsx(Skeleton, { className: "h-11 w-64" }) }), _jsxs(Section, { title: "Per label", children: [_jsx(Skeleton, { className: "h-9 w-48" }), _jsx(Skeleton, { className: "h-9 w-48" })] })] }));
147
+ if (settings.isPending)
148
+ return skeleton;
149
+ if (settings.isError) {
150
+ return (_jsx(Section, { title: "Thresholds", children: _jsx(SectionFailure, { title: "Couldn't load the spam settings", error: settings.error, onRetry: () => void settings.refetch(), skeleton: skeleton }) }));
151
+ }
152
+ return (_jsxs(_Fragment, { children: [_jsx(ThresholdsSection, { spam: settings.data.spam }), _jsx(PlacementSection, { spam: settings.data.spam })] }));
153
+ }
154
+ function SendersSection() {
155
+ const groups = [
156
+ {
157
+ title: "Never in Spam",
158
+ hint: "Their mail skips the spam check.",
159
+ group: "neverSpam",
160
+ },
161
+ {
162
+ title: "Reported",
163
+ hint: "Their mail goes straight to Spam.",
164
+ group: "blocked",
165
+ },
166
+ ];
167
+ return (_jsx(Section, { title: "Senders", children: _jsx("ul", { className: "list-none divide-y divide-line rounded-md border border-line", children: groups.map((group) => (_jsxs("li", { className: "flex items-center justify-between gap-3 px-3 py-2", children: [_jsxs("div", { children: [_jsx("p", { className: "text-sm font-medium text-fg", children: group.title }), _jsx("p", { className: "text-xs text-fg-muted", children: group.hint })] }), _jsx(NavLink, { to: "/settings/senders", search: { group: group.group }, variant: "inline", className: cn(buttonClassName({ variant: "secondary" }), "min-h-11 hover:no-underline"), "aria-label": `Manage ${group.title}`, children: "Manage" })] }, group.title))) }) }));
168
+ }
169
+ /**
170
+ * The Spam & phishing settings at `/settings/spam`: what Remit flagged in the
171
+ * last 30 days, the thresholds in effect, the per-label action and the sender
172
+ * groups. Every section loads and fails on its own.
173
+ */
174
+ export function SpamSettingsPanel() {
175
+ return (_jsxs("div", { className: "max-w-3xl space-y-8", children: [_jsx(OverviewSection, {}), _jsx(LatestSection, {}), _jsx(SettingsSections, {}), _jsx(SendersSection, {})] }));
176
+ }
@@ -1,20 +1,21 @@
1
1
  import type { RemitImapThreadMessageResponse } from "@remit/api-http-client/types.gen.ts";
2
+ import type { ThreadCollection } from "../lib/collection-criteria";
2
3
  import type { ThreadSearchTokenParams } from "../lib/thread-search-tokens";
3
- /** The criteria the Flagged view narrows its listing by, all server-applied. */
4
- export interface StarredCriteria extends ThreadSearchTokenParams {
4
+ /** The criteria a collection view narrows its listing by, all server-applied. */
5
+ export interface CollectionCriteria extends ThreadSearchTokenParams {
5
6
  /**
6
7
  * Free text, matched against subject, From and the body preview over the
7
8
  * whole collection.
8
9
  */
9
10
  query?: string;
10
11
  }
11
- export declare const starredThreadsQueryKey: (criteria?: StarredCriteria) => [Pick<import("@remit/api-http-client").Options<import("@remit/api-http-client").UnifiedThreadOperationsListAllThreadsData>, "body" | "headers" | "path" | "query" | "baseUrl"> & {
12
+ export declare const collectionThreadsQueryKey: (collection: ThreadCollection, criteria?: CollectionCriteria) => [Pick<import("@remit/api-http-client").Options<import("@remit/api-http-client").UnifiedThreadOperationsListAllThreadsData>, "body" | "headers" | "path" | "query" | "baseUrl"> & {
12
13
  _id: string;
13
14
  _infinite?: boolean;
14
15
  tags?: ReadonlyArray<string>;
15
16
  }];
16
- interface StarredThreads {
17
- /** Every matching starred thread across the pages loaded so far, newest first. */
17
+ interface CollectionThreads {
18
+ /** Every matching thread across the pages loaded so far, newest first. */
18
19
  threads: RemitImapThreadMessageResponse[];
19
20
  isLoading: boolean;
20
21
  isError: boolean;
@@ -24,9 +25,10 @@ interface StarredThreads {
24
25
  hasNextPage: boolean;
25
26
  isFetchingNextPage: boolean;
26
27
  }
27
- export declare function useStarredThreads(criteria?: StarredCriteria): StarredThreads;
28
+ export declare function useCollectionThreads(collection: ThreadCollection, criteria?: CollectionCriteria): CollectionThreads;
28
29
  /**
29
- * How many of the matching starred messages are unread, counted by the server.
30
+ * How many of the collection's matching messages are unread, counted by the
31
+ * server.
30
32
  *
31
33
  * Its own request, so no cursor enters the key and pressing "load more" cannot
32
34
  * move the number — the count is over the whole collection under the active
@@ -38,5 +40,5 @@ export declare function useStarredThreads(criteria?: StarredCriteria): StarredTh
38
40
  * Undefined until the server answers, and undefined when it cannot. The header
39
41
  * shows no number rather than a made-up one.
40
42
  */
41
- export declare function useStarredUnreadCount(criteria?: StarredCriteria): number | undefined;
43
+ export declare function useCollectionUnreadCount(collection: ThreadCollection, criteria?: CollectionCriteria): number | undefined;
42
44
  export {};
@@ -1,6 +1,7 @@
1
1
  /**
2
- * The starred listing — `GET /threads?starred=true`, served by the `byStarred`
3
- * index — as one hook, so the Starred pane's list and its selection resolve
2
+ * A collection listing — `GET /threads?starred=true`, served by the
3
+ * `byStarred` index, or `GET /threads?labelId=…`, one label's folder in every
4
+ * account — as one hook, so a collection pane's list and its selection resolve
4
5
  * from the same query.
5
6
  *
6
7
  * The two are the same cache entry, not two requests: they share a query key,
@@ -26,23 +27,23 @@ import { unifiedThreadOperationsListAllThreadsQueryKey } from "@remit/api-http-c
26
27
  import { unifiedThreadOperationsListAllThreads } from "@remit/api-http-client/sdk.gen.ts";
27
28
  import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
28
29
  import { useMemo } from "react";
29
- // `starred` and `order` are the view itself, not a criterion, so they are set
30
- // last: no chip can widen the listing past starred mail or reorder it.
31
- const starredQuery = (criteria) => ({
30
+ // The collection and `order` are the view itself, not a criterion, so they are
31
+ // set last: no chip can widen the listing past the collection or reorder it.
32
+ const collectionQuery = (collection, criteria) => ({
32
33
  ...criteria,
33
- starred: true,
34
+ ...collection,
34
35
  order: "desc",
35
36
  });
36
- export const starredThreadsQueryKey = (criteria = {}) => unifiedThreadOperationsListAllThreadsQueryKey({
37
- query: starredQuery(criteria),
37
+ export const collectionThreadsQueryKey = (collection, criteria = {}) => unifiedThreadOperationsListAllThreadsQueryKey({
38
+ query: collectionQuery(collection, criteria),
38
39
  });
39
- export function useStarredThreads(criteria = {}) {
40
+ export function useCollectionThreads(collection, criteria = {}) {
40
41
  const { data, isLoading, isError, error, refetch, fetchNextPage, hasNextPage, isFetchingNextPage, } = useInfiniteQuery({
41
- queryKey: starredThreadsQueryKey(criteria),
42
+ queryKey: collectionThreadsQueryKey(collection, criteria),
42
43
  queryFn: async ({ pageParam }) => {
43
44
  const { data: page } = await unifiedThreadOperationsListAllThreads({
44
45
  query: {
45
- ...starredQuery(criteria),
46
+ ...collectionQuery(collection, criteria),
46
47
  continuationToken: pageParam,
47
48
  },
48
49
  throwOnError: true,
@@ -66,7 +67,8 @@ export function useStarredThreads(criteria = {}) {
66
67
  };
67
68
  }
68
69
  /**
69
- * How many of the matching starred messages are unread, counted by the server.
70
+ * How many of the collection's matching messages are unread, counted by the
71
+ * server.
70
72
  *
71
73
  * Its own request, so no cursor enters the key and pressing "load more" cannot
72
74
  * move the number — the count is over the whole collection under the active
@@ -78,9 +80,9 @@ export function useStarredThreads(criteria = {}) {
78
80
  * Undefined until the server answers, and undefined when it cannot. The header
79
81
  * shows no number rather than a made-up one.
80
82
  */
81
- export function useStarredUnreadCount(criteria = {}) {
83
+ export function useCollectionUnreadCount(collection, criteria = {}) {
82
84
  const query = {
83
- ...starredQuery(criteria),
85
+ ...collectionQuery(collection, criteria),
84
86
  unread: true,
85
87
  count: true,
86
88
  results: false,
@@ -9,6 +9,7 @@ interface UseCurrentMailboxNameOptions {
9
9
  *
10
10
  * Priority:
11
11
  * - `/mail/outbox` → "Outbox"
12
+ * - `/mail/label/$labelId` → the label's name
12
13
  * - `/mail/$mailboxId` → display name from the mailbox query
13
14
  * - everything else (e.g. `/mail` mid-redirect) → `null`
14
15
  *
@@ -4,6 +4,7 @@ import { useCallback } from "react";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { buildMailboxRoleMap, labelForMailbox } from "../lib/folder-roles";
6
6
  import { useBrowsedList } from "../routing";
7
+ import { useLabelList } from "./useLabels";
7
8
  /**
8
9
  * Resolves a display label for the mailbox or pseudo-mailbox the user is
9
10
  * currently looking at — used by the mobile top bar so it reads e.g.
@@ -11,6 +12,7 @@ import { useBrowsedList } from "../routing";
11
12
  *
12
13
  * Priority:
13
14
  * - `/mail/outbox` → "Outbox"
15
+ * - `/mail/label/$labelId` → the label's name
14
16
  * - `/mail/$mailboxId` → display name from the mailbox query
15
17
  * - everything else (e.g. `/mail` mid-redirect) → `null`
16
18
  *
@@ -19,7 +21,8 @@ import { useBrowsedList } from "../routing";
19
21
  * mounted on `/mail/*`) this is a free lookup.
20
22
  */
21
23
  export const useCurrentMailboxName = ({ accounts, }) => {
22
- const { list, mailboxId } = useBrowsedList();
24
+ const { list, mailboxId, labelId } = useBrowsedList();
25
+ const { labels } = useLabelList(accounts[0]?.accountId);
23
26
  const { t } = useTranslation("mail", { useSuspense: false });
24
27
  const translator = useCallback((key, fallback) => t(key, { defaultValue: fallback }), [t]);
25
28
  const queries = useQueries({
@@ -32,6 +35,8 @@ export const useCurrentMailboxName = ({ accounts, }) => {
32
35
  });
33
36
  if (list === "outbox")
34
37
  return "Outbox";
38
+ if (list === "label")
39
+ return labels.find((label) => label.labelId === labelId)?.name ?? null;
35
40
  if (!mailboxId)
36
41
  return null;
37
42
  for (let i = 0; i < accounts.length; i++) {
@@ -1,5 +1,5 @@
1
1
  import type { RemitImapAddressResponse, RemitImapThreadMessageResponse } from "@remit/api-http-client/types.gen.ts";
2
- import type { AuthenticityIntel, IntelligenceData, PlacementIntel, SenderIntel } from "@remit/ui";
2
+ import type { IntelligenceData, PlacementIntel, SenderIntel } from "@remit/ui";
3
3
  /**
4
4
  * A sender address we cannot read: empty, missing the `@`, or whose domain
5
5
  * part carries no dot (catches placeholders like `missing_domain` and other
@@ -25,8 +25,6 @@ export declare function buildCategoryIntel(thread: RemitImapThreadMessageRespons
25
25
  * than rendering a misleading "0 received" next to an earned trust badge.
26
26
  */
27
27
  export declare function buildSenderIntel(thread: RemitImapThreadMessageResponse, address: RemitImapAddressResponse | undefined): SenderIntel;
28
- /** Build authenticity intel from the thread message's authenticity field. */
29
- export declare function buildAuthenticityIntel(thread: RemitImapThreadMessageResponse): AuthenticityIntel;
30
28
  export declare function buildPlacementIntel(thread: RemitImapThreadMessageResponse): PlacementIntel | undefined;
31
29
  export interface UseIntelligenceDataResult {
32
30
  data: Omit<IntelligenceData, "spamAction"> | null;
@@ -52,7 +50,7 @@ export interface UseIntelligenceDataResult {
52
50
  * Maps a `RemitImapThreadMessageResponse` into `IntelligenceData` for the
53
51
  * `IntelligencePanel` component. Two data sources:
54
52
  *
55
- * 1. The thread row itself (already loaded) → sender basics, trust, authenticity, category.
53
+ * 1. The thread row itself (already loaded) → sender basics, trust, category.
56
54
  * 2. `GET /addresses/search?q=<email>` → address flags (VIP/muted/blocked/etc.)
57
55
  * and first-seen timestamp. One round-trip per unique sender.
58
56
  */