@remit/ui 0.0.237 → 0.0.239

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 (35) hide show
  1. package/dist/category-presentation.d.ts +1 -1
  2. package/dist/category-presentation.js +7 -1
  3. package/dist/components/app-shell-types.d.ts +18 -2
  4. package/dist/components/button.d.ts +5 -0
  5. package/dist/components/button.js +2 -0
  6. package/dist/components/check-again-panel.d.ts +43 -0
  7. package/dist/components/check-again-panel.js +60 -0
  8. package/dist/components/failure-banner.d.ts +11 -0
  9. package/dist/components/failure-banner.js +7 -0
  10. package/dist/components/intelligence-calendar-fixtures.js +0 -12
  11. package/dist/components/intelligence-panel.d.ts +7 -26
  12. package/dist/components/intelligence-panel.js +4 -16
  13. package/dist/components/intelligence-section.d.ts +3 -1
  14. package/dist/components/intelligence-section.js +2 -2
  15. package/dist/components/message-row.js +6 -3
  16. package/dist/components/nav-sidebar.d.ts +7 -2
  17. package/dist/components/nav-sidebar.js +9 -2
  18. package/dist/components/selection-top-bar.d.ts +3 -1
  19. package/dist/components/selection-top-bar.js +10 -2
  20. package/dist/components/spam-copy.d.ts +25 -0
  21. package/dist/components/spam-copy.js +100 -0
  22. package/dist/components/spam-daily-chart.d.ts +17 -0
  23. package/dist/components/spam-daily-chart.js +18 -0
  24. package/dist/components/spam-fixtures.d.ts +19 -0
  25. package/dist/components/spam-fixtures.js +143 -0
  26. package/dist/components/spam-row-marker.d.ts +12 -0
  27. package/dist/components/spam-row-marker.js +10 -0
  28. package/dist/components/spam-verdict-panel.d.ts +37 -0
  29. package/dist/components/spam-verdict-panel.js +74 -0
  30. package/dist/components/spam-warning-banner.d.ts +20 -0
  31. package/dist/components/spam-warning-banner.js +62 -0
  32. package/dist/index.d.ts +10 -3
  33. package/dist/index.js +8 -1
  34. package/dist/lib/email-render-treatment.d.ts +1 -1
  35. package/package.json +3 -2
@@ -7,7 +7,7 @@ import type { CategoryTone, FilterSheetCategory } from "./components/filter-shee
7
7
  * (`file:build/ts-enums`) and @remit/ui publishes standalone — so this is the
8
8
  * kit's one owner of the union, and every other surface narrows to it.
9
9
  */
10
- export type ThreadCategory = "uncategorized" | "personal" | "newsletter" | "marketing" | "automated" | "transactional" | "social";
10
+ export type ThreadCategory = "uncategorized" | "personal" | "newsletter" | "marketing" | "automated" | "transactional" | "social" | "coldOutreach";
11
11
  /** "all" (no category narrowing) plus every content-type category. */
12
12
  export type BriefCategoryFilter = ThreadCategory | "all";
13
13
  /** How one category reads: on a chip, on a row badge, as a brief section. */
@@ -22,7 +22,7 @@ export const CATEGORY_PRESENTATION = [
22
22
  category: "uncategorized",
23
23
  label: "Unclassified",
24
24
  tone: "neutral",
25
- section: 7,
25
+ section: 8,
26
26
  },
27
27
  {
28
28
  category: "transactional",
@@ -34,6 +34,12 @@ export const CATEGORY_PRESENTATION = [
34
34
  { category: "marketing", label: "Marketing", tone: "neutral", section: 4 },
35
35
  { category: "social", label: "Social", tone: "warning", section: 5 },
36
36
  { category: "automated", label: "Automated", tone: "neutral", section: 6 },
37
+ {
38
+ category: "coldOutreach",
39
+ label: "Cold outreach",
40
+ tone: "neutral",
41
+ section: 7,
42
+ },
37
43
  ];
38
44
  /** Every category in the brief's section order, which ends with Unclassified. */
39
45
  export const CATEGORY_SECTION_ORDER = [
@@ -115,6 +115,17 @@ export interface NavMailbox {
115
115
  /** Present when the last change to this folder failed: what went wrong, in words. */
116
116
  failure?: string;
117
117
  }
118
+ /**
119
+ * A label, shown once whatever the number of accounts: one entry that lists the
120
+ * label's folder in every account.
121
+ */
122
+ export interface NavLabel {
123
+ /** The nav id the entry links to and is selected by. */
124
+ id: string;
125
+ name: string;
126
+ /** The label's color name; a value the kit has no swatch for renders as Default. */
127
+ color: string;
128
+ }
118
129
  /** Per-account mailbox-load status, so the nav can show loading/error inline. */
119
130
  export type NavAccountStatus = "loading" | "error" | "ready";
120
131
  export interface NavAccount {
@@ -164,6 +175,11 @@ export interface ThreadRowLabel {
164
175
  name: string;
165
176
  color: string;
166
177
  }
178
+ export interface ThreadRowSpam {
179
+ label: ThreadRowLabel;
180
+ /** The message still sits where it arrived, under the warning. */
181
+ suspected: boolean;
182
+ }
167
183
  export interface ThreadRowData {
168
184
  id: string;
169
185
  /**
@@ -196,8 +212,8 @@ export interface ThreadRowData {
196
212
  category?: ThreadCategory;
197
213
  /** Number of messages when the row is a thread. */
198
214
  messageCount?: number;
199
- /** Authenticity heuristics flagged this row (DKIM/From mismatch). */
200
- suspicious?: boolean;
215
+ /** The Remit Spam or Phishing label the message carries. */
216
+ spam?: ThreadRowSpam;
201
217
  /** Labels applied to this message (issue #26) — filter-, organize-, and manually-applied alike. */
202
218
  labels?: ThreadRowLabel[];
203
219
  /**
@@ -7,6 +7,11 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
7
7
  icon?: ReactNode;
8
8
  ref?: Ref<HTMLButtonElement>;
9
9
  }
10
+ /** The button look, for a router link that has to read as a button. */
11
+ export declare const buttonClassName: ({ variant, size, }: {
12
+ variant?: Variant;
13
+ size?: Size;
14
+ }) => string;
10
15
  export declare function Button({ variant, size, icon, className, children, ref, ...props }: ButtonProps): import("react").JSX.Element;
11
16
  export interface ButtonLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
12
17
  variant?: Variant;
@@ -15,6 +15,8 @@ const sizes = {
15
15
  * with `md` plus an explicit `min-h-11` instead of stretching to square. */
16
16
  touch: "h-11 w-11 text-sm",
17
17
  };
18
+ /** The button look, for a router link that has to read as a button. */
19
+ export const buttonClassName = ({ variant = "primary", size = "md", }) => cn(base, variants[variant], sizes[size]);
18
20
  export function Button({ variant = "primary", size = "md", icon, className, children, ref, ...props }) {
19
21
  return (_jsxs("button", { type: "button", ref: ref, className: cn(base, variants[variant], sizes[size], className), ...props, children: [icon, children] }));
20
22
  }
@@ -0,0 +1,43 @@
1
+ import type { RemitImapRescanFailureCode } from "@remit/api-http-client/types.gen.ts";
2
+ export interface CheckAgainFailure {
3
+ messageId: string;
4
+ subject: string;
5
+ code: RemitImapRescanFailureCode;
6
+ retryable: boolean;
7
+ }
8
+ export interface CheckAgainSummary {
9
+ nowSpam: number;
10
+ nowSuspected: number;
11
+ noLongerSuspected: number;
12
+ }
13
+ export type CheckAgainPanelProps = {
14
+ state: "Running";
15
+ checked: number;
16
+ total: number;
17
+ onStop: () => void;
18
+ } | {
19
+ state: "Done";
20
+ total: number;
21
+ summary: CheckAgainSummary;
22
+ onDone: () => void;
23
+ } | {
24
+ state: "PartialFailure";
25
+ checked: number;
26
+ total: number;
27
+ failures: CheckAgainFailure[];
28
+ reportIssueHref: string;
29
+ onRetry: () => void;
30
+ onClose: () => void;
31
+ };
32
+ export declare function checkAgainSummarySentence(summary: CheckAgainSummary): string;
33
+ /**
34
+ * Progress and outcome of Check again over a selection or one message. Remit
35
+ * sends ten at a time; the run lives in memory and ends with the page.
36
+ */
37
+ export declare function CheckAgainPanel(props: CheckAgainPanelProps): import("react").JSX.Element;
38
+ export type CheckAgainOutcome = "NowSpam" | "NowSuspected" | "NowClean" | "Unchanged";
39
+ /** The dashed tag a row carries once its Check again batch lands. */
40
+ export declare function CheckAgainResultTag({ outcome, score, }: {
41
+ outcome: CheckAgainOutcome;
42
+ score: number;
43
+ }): import("react").JSX.Element;
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from "react";
3
+ import { Button, ButtonLink } from "./button.js";
4
+ import { ProgressBar } from "./progress-bar.js";
5
+ import { CHECK_AGAIN_FAILURE_SENTENCES, formatSpamScore } from "./spam-copy.js";
6
+ export function checkAgainSummarySentence(summary) {
7
+ const parts = [
8
+ summary.nowSpam > 0 && `${summary.nowSpam} now reach Spam`,
9
+ summary.nowSuspected > 0 &&
10
+ `${summary.nowSuspected} ${summary.nowSuspected === 1 ? "is" : "are"} now suspected`,
11
+ summary.noLongerSuspected > 0 &&
12
+ `${summary.noLongerSuspected} ${summary.noLongerSuspected === 1 ? "is" : "are"} no longer suspected`,
13
+ ].filter((part) => typeof part === "string");
14
+ const changed = summary.nowSpam + summary.nowSuspected + summary.noLongerSuspected;
15
+ const moved = summary.nowSpam > 0
16
+ ? "Nothing moved. Open a message to move it to Spam."
17
+ : "Nothing moved.";
18
+ if (changed === 0)
19
+ return `Nothing changed. ${moved}`;
20
+ return `${changed} changed: ${parts.join(", ")}. ${moved}`;
21
+ }
22
+ const onEscape = (action) => (event) => {
23
+ if (event.key !== "Escape")
24
+ return;
25
+ event.stopPropagation();
26
+ action();
27
+ };
28
+ function PanelFrame({ children, onKeyDown, }) {
29
+ return (_jsx("section", { "aria-label": "Check again", onKeyDown: onKeyDown, className: "w-full max-w-md space-y-3 rounded-lg border border-line bg-surface p-4 text-sm shadow-lg", children: children }));
30
+ }
31
+ /**
32
+ * Progress and outcome of Check again over a selection or one message. Remit
33
+ * sends ten at a time; the run lives in memory and ends with the page.
34
+ */
35
+ export function CheckAgainPanel(props) {
36
+ const focusRef = useRef(null);
37
+ const { state } = props;
38
+ // biome-ignore lint/correctness/useExhaustiveDependencies: focus moves once per state the panel enters
39
+ useEffect(() => {
40
+ focusRef.current?.focus();
41
+ }, [state]);
42
+ if (props.state === "Running") {
43
+ return (_jsxs(PanelFrame, { onKeyDown: onEscape(props.onStop), children: [_jsx("p", { "aria-live": "polite", className: "font-semibold text-fg tabular-nums", children: `Checked ${props.checked} of ${props.total}` }), _jsx(ProgressBar, { value: props.checked, max: props.total }), _jsx("p", { className: "text-fg-muted", children: "Remit sends ten at a time and waits for each answer. Keep this page open until it finishes." }), _jsx(Button, { ref: focusRef, variant: "secondary", size: "md", onClick: props.onStop, children: "Stop" })] }));
44
+ }
45
+ if (props.state === "Done") {
46
+ return (_jsxs(PanelFrame, { onKeyDown: onEscape(props.onDone), children: [_jsx("p", { "aria-live": "polite", className: "font-semibold text-fg tabular-nums", children: `Checked ${props.total} of ${props.total}` }), _jsx(ProgressBar, { value: props.total, max: props.total, tone: "success" }), _jsx("p", { className: "text-fg-muted", children: checkAgainSummarySentence(props.summary) }), _jsx(Button, { ref: focusRef, variant: "primary", size: "md", onClick: props.onDone, children: "Done" })] }));
47
+ }
48
+ const retryable = props.failures.filter((failure) => failure.retryable).length;
49
+ return (_jsxs(PanelFrame, { onKeyDown: onEscape(props.onClose), children: [_jsx("p", { "aria-live": "polite", className: "font-semibold text-fg tabular-nums", children: `Checked ${props.checked} of ${props.total}. ${props.failures.length} couldn't be checked.` }), _jsx(ProgressBar, { value: props.checked, max: props.total, tone: "warning" }), _jsx("ul", { className: "list-disc space-y-1 pl-4 text-fg-muted marker:text-fg-subtle", children: props.failures.map((failure) => (_jsxs("li", { children: [_jsx("span", { className: "text-fg", children: failure.subject }), ":", " ", CHECK_AGAIN_FAILURE_SENTENCES[failure.code]] }, failure.messageId))) }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [retryable > 0 && (_jsx(Button, { ref: focusRef, variant: "primary", size: "md", onClick: props.onRetry, children: `Try again for ${retryable}` })), _jsx(ButtonLink, { variant: "ghost", size: "md", href: props.reportIssueHref, external: true, children: "Report an issue" }), _jsx(Button, { ref: retryable > 0 ? undefined : focusRef, variant: "secondary", size: "md", onClick: props.onClose, children: "Close" })] })] }));
50
+ }
51
+ const OUTCOME_LABELS = {
52
+ NowSpam: "Now: Spam",
53
+ NowSuspected: "Now: suspected",
54
+ NowClean: "Now: clean",
55
+ Unchanged: "Unchanged",
56
+ };
57
+ /** The dashed tag a row carries once its Check again batch lands. */
58
+ export function CheckAgainResultTag({ outcome, score, }) {
59
+ return (_jsx("span", { className: "inline-flex shrink-0 items-center rounded border border-dashed border-line-strong px-1.5 text-2xs font-medium leading-4 text-fg-muted tabular-nums", children: `${OUTCOME_LABELS[outcome]} ${formatSpamScore(score)}` }));
60
+ }
@@ -0,0 +1,11 @@
1
+ import type { Ref } from "react";
2
+ export interface FailureBannerProps {
3
+ title: string;
4
+ message: string;
5
+ reportHref: string;
6
+ onRetry?: () => void;
7
+ retryLabel?: string;
8
+ retryRef?: Ref<HTMLButtonElement>;
9
+ }
10
+ /** A settings section's failure: what failed, the error, a retry and a report link. */
11
+ export declare function FailureBanner({ title, message, reportHref, onRetry, retryLabel, retryRef, }: FailureBannerProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Banner } from "./banner.js";
3
+ import { Button } from "./button.js";
4
+ /** A settings section's failure: what failed, the error, a retry and a report link. */
5
+ export function FailureBanner({ title, message, reportHref, onRetry, retryLabel = "Retry", retryRef, }) {
6
+ return (_jsxs(Banner, { tone: "danger", variant: "soft", children: [_jsx("p", { className: "font-medium", children: 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, { ref: retryRef, variant: "secondary", className: "min-h-11", onClick: onRetry, children: retryLabel })), _jsx("a", { href: reportHref, target: "_blank", rel: "noreferrer", className: "inline-flex min-h-11 items-center font-medium text-accent hover:underline", children: "Report an issue" })] })] }));
7
+ }
@@ -290,12 +290,6 @@ export const organiserSender = {
290
290
  inboundCount: 214,
291
291
  replyCount: 188,
292
292
  },
293
- authenticity: {
294
- verdict: "aligned",
295
- fromDomain: "northwind.example",
296
- dkimDomain: "northwind.example",
297
- summary: "This message was signed by northwind.example.",
298
- },
299
293
  category: { value: "personal" },
300
294
  spamAction: "reportSpam",
301
295
  flags: { vip: true },
@@ -309,12 +303,6 @@ export const airlineSender = {
309
303
  inboundCount: 31,
310
304
  replyCount: 0,
311
305
  },
312
- authenticity: {
313
- verdict: "aligned",
314
- fromDomain: "klm.example",
315
- dkimDomain: "klm.example",
316
- summary: "This message was signed by klm.example.",
317
- },
318
306
  category: { value: "transactional" },
319
307
  spamAction: "reportSpam",
320
308
  };
@@ -1,3 +1,4 @@
1
+ import { type ReactNode } from "react";
1
2
  import { type ThreadCategory } from "../category-presentation.js";
2
3
  import { type IntelligenceCalendarActions, type IntelligenceCalendarData } from "./intelligence-calendar.js";
3
4
  import { type PlacementIntel } from "./intelligence-placement.js";
@@ -19,31 +20,10 @@ export interface SenderIntel {
19
20
  /**
20
21
  * True when the sender address is missing or unparseable (no valid domain).
21
22
  * Drives a red "couldn't verify the address" badge instead of the quiet grey
22
- * "Unknown sender", and forces the authenticity verdict to the red tier.
23
+ * "Unknown sender".
23
24
  */
24
25
  addressUnverified?: boolean;
25
26
  }
26
- export interface AuthenticityIntel {
27
- /**
28
- * Risk tier. `aligned` (green) — verified sender. `caution` (orange) — no
29
- * verification signal available. `mismatch` (red) — impersonation or an
30
- * unreadable sender address.
31
- */
32
- verdict: "aligned" | "caution" | "mismatch";
33
- fromDomain: string;
34
- /** Signing domain the message was actually sent from, when known. */
35
- dkimDomain?: string;
36
- /** Brand the display name claims, when it differs from the mailbox. */
37
- claimedBrand?: string;
38
- /** Plain-language verdict shown to the user. */
39
- summary: string;
40
- /**
41
- * True when the red tier is driven by an unreadable sender address rather
42
- * than an impersonation mismatch — selects the headline and suppresses the
43
- * domain-comparison line (there is no valid domain to show).
44
- */
45
- addressUnreadable?: boolean;
46
- }
47
27
  export interface SenderFlagsIntel {
48
28
  vip?: boolean;
49
29
  muted?: boolean;
@@ -61,7 +41,6 @@ export interface SenderFlagsIntel {
61
41
  }
62
42
  export interface IntelligenceData {
63
43
  sender: SenderIntel;
64
- authenticity: AuthenticityIntel;
65
44
  category: {
66
45
  value: ThreadCategory;
67
46
  overridden?: boolean;
@@ -69,10 +48,10 @@ export interface IntelligenceData {
69
48
  flags?: SenderFlagsIntel;
70
49
  /** Where Remit placed this message and why. Absent when Remit recorded no verdict. */
71
50
  placement?: PlacementIntel;
72
- spamAction: SpamAction;
51
+ spamAction: SpamQuickAction;
73
52
  }
74
53
  /** Which spam control the message offers: undo its spam report, move it out of Junk, or report it. */
75
- export type SpamAction = "undoSpamReport" | "notSpam" | "reportSpam";
54
+ export type SpamQuickAction = "undoSpamReport" | "notSpam" | "reportSpam";
76
55
  export interface IntelligenceQuickActions {
77
56
  onToggleVip?: () => void;
78
57
  onToggleMute?: () => void;
@@ -143,5 +122,7 @@ export interface IntelligencePanelProps {
143
122
  defaultTab?: IntelligenceTabId;
144
123
  /** Larger hit targets, for the drawer host on a touch screen. */
145
124
  touch?: boolean;
125
+ /** The Spam check section, under Sender. */
126
+ spamCheck?: ReactNode;
146
127
  }
147
- export declare function IntelligencePanel({ data, onClose, actions, className, hideCloseButton, reportSpamPending, notSpamPending, calendar, tab, onTabChange, defaultTab, touch, }: IntelligencePanelProps): import("react").JSX.Element;
128
+ export declare function IntelligencePanel({ data, onClose, actions, className, hideCloseButton, reportSpamPending, notSpamPending, calendar, tab, onTabChange, defaultTab, touch, spamCheck, }: IntelligencePanelProps): import("react").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useId, useState } from "react";
3
3
  import { categoryLabels, categoryTone, } from "../category-presentation.js";
4
- import { BellOff, MailCheck, ShieldAlert, ShieldCheck, ShieldQuestionMark, ShieldX, Sparkles, Star, X, } from "../icons.js";
4
+ import { BellOff, MailCheck, ShieldX, Sparkles, Star, X } from "../icons.js";
5
5
  import { cn } from "../lib/cn.js";
6
6
  import { Avatar } from "./avatar.js";
7
7
  import { Badge } from "./badge.js";
@@ -31,18 +31,6 @@ function SenderCard({ sender }) {
31
31
  : `${sender.inboundCount} received · you've never replied`;
32
32
  return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Avatar, { name: sender.name, email: sender.email, size: "md" }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate text-sm font-semibold text-fg", children: sender.name }), _jsx("div", { className: "truncate text-2xs text-fg-subtle", children: sender.email })] })] }), _jsx("div", { className: "mt-2 flex items-center gap-2", children: sender.addressUnverified ? (_jsx(Badge, { tone: "danger", dot: true, children: "Address couldn't be verified" })) : (_jsx(Badge, { tone: trust.tone, dot: true, children: trust.label })) }), _jsxs("p", { className: "mt-2 text-xs text-fg-muted", children: ["First seen ", sender.firstSeenLabel, engagement ? ` · ${engagement}` : ""] })] }));
33
33
  }
34
- function Authenticity({ auth }) {
35
- if (auth.verdict === "aligned") {
36
- return (_jsxs("div", { className: "flex items-start gap-2 text-xs text-fg-muted", children: [_jsx(ShieldCheck, { className: "mt-0.5 size-3.5 shrink-0 text-positive" }), _jsx("span", { children: auth.summary })] }));
37
- }
38
- if (auth.verdict === "caution") {
39
- return (_jsxs("div", { className: "flex items-start gap-2 rounded-md bg-warning/10 p-3 text-warning", children: [_jsx(ShieldQuestionMark, { className: "mt-0.5 size-4 shrink-0" }), _jsx("p", { className: "text-xs leading-relaxed", children: auth.summary })] }));
40
- }
41
- const headline = auth.addressUnreadable
42
- ? "This sender can't be verified"
43
- : "This message may be impersonating someone";
44
- return (_jsx("div", { className: "rounded-md bg-danger-soft p-3", children: _jsxs("div", { className: "flex items-start gap-2", children: [_jsx(ShieldAlert, { className: "mt-0.5 size-4 shrink-0 text-danger" }), _jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "text-sm font-semibold text-danger", children: headline }), _jsx("p", { className: "mt-1 text-xs leading-relaxed text-fg", children: auth.summary }), !auth.addressUnreadable && auth.dkimDomain && (_jsxs("p", { className: "mt-1 text-2xs text-fg-muted", children: ["Sent from", " ", _jsx("code", { className: "rounded bg-surface px-1 py-0.5", children: auth.dkimDomain }), ", claims to be", " ", _jsx("code", { className: "rounded bg-surface px-1 py-0.5", children: auth.fromDomain })] }))] })] }) }));
45
- }
46
34
  function QuickAction({ icon, label, active, danger, onClick, pending, }) {
47
35
  // No handler means the action cannot be serviced yet (the sender's address
48
36
  // record has not resolved). Render it visibly unavailable rather than as a
@@ -53,8 +41,8 @@ function QuickAction({ icon, label, active, danger, onClick, pending, }) {
53
41
  ? "border-accent-2 bg-accent-2-soft text-accent-2"
54
42
  : "border-line text-fg-muted hover:border-line-strong hover:text-fg", danger && !active && "text-danger hover:bg-danger-soft", disabled && "cursor-not-allowed opacity-50 hover:border-line"), children: [icon, label] }));
55
43
  }
56
- export function IntelligencePanel({ data, onClose, actions, className, hideCloseButton = false, reportSpamPending = false, notSpamPending = false, calendar, tab, onTabChange, defaultTab = "sender", touch, }) {
57
- const { sender, authenticity, category, flags = {}, placement, spamAction, } = data;
44
+ export function IntelligencePanel({ data, onClose, actions, className, hideCloseButton = false, reportSpamPending = false, notSpamPending = false, calendar, tab, onTabChange, defaultTab = "sender", touch, spamCheck, }) {
45
+ const { sender, category, flags = {}, placement, spamAction } = data;
58
46
  const notSpamPendingLabel = spamAction === "undoSpamReport" ? "Undoing…" : "Moving…";
59
47
  const [ownTab, setOwnTab] = useState(defaultTab);
60
48
  const tabStripName = useId();
@@ -64,6 +52,6 @@ export function IntelligencePanel({ data, onClose, actions, className, hideClose
64
52
  if (tab === undefined)
65
53
  setOwnTab(next);
66
54
  onTabChange?.(next);
67
- } }) })), calendarTab && (_jsx(IntelligenceCalendar, { data: calendarTab.data, actions: calendarTab.actions, selectedEventId: calendarTab.selectedEventId, touch: touch })), calendarTab === undefined && (_jsxs(_Fragment, { children: [_jsx(IntelligenceSection, { label: "Sender", children: _jsx(SenderCard, { sender: sender }) }), _jsx(IntelligenceSection, { label: "Authenticity", children: _jsx(Authenticity, { auth: authenticity }) }), _jsx(IntelligenceSection, { label: "Category", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Badge, { tone: categoryTone[category.value], children: categoryLabels[category.value] }), category.overridden && (_jsx("span", { className: "text-2xs text-fg-subtle", children: "your override" })), _jsx("button", { type: "button", className: cn("ml-auto text-2xs text-accent hover:underline", !actions?.onReclassify &&
55
+ } }) })), calendarTab && (_jsx(IntelligenceCalendar, { data: calendarTab.data, actions: calendarTab.actions, selectedEventId: calendarTab.selectedEventId, touch: touch })), calendarTab === undefined && (_jsxs(_Fragment, { children: [_jsx(IntelligenceSection, { label: "Sender", children: _jsx(SenderCard, { sender: sender }) }), spamCheck, _jsx(IntelligenceSection, { label: "Category", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Badge, { tone: categoryTone[category.value], children: categoryLabels[category.value] }), category.overridden && (_jsx("span", { className: "text-2xs text-fg-subtle", children: "your override" })), _jsx("button", { type: "button", className: cn("ml-auto text-2xs text-accent hover:underline", !actions?.onReclassify &&
68
56
  "cursor-not-allowed opacity-50 hover:no-underline"), disabled: !actions?.onReclassify, onClick: actions?.onReclassify, children: "reclassify" })] }) }), placement && (_jsx(IntelligenceSection, { label: "Placement", children: _jsx(Placement, { placement: placement }) })), _jsxs(IntelligenceSection, { label: "Quick actions", children: [_jsxs("div", { className: "flex flex-wrap gap-1.5", children: [_jsx(QuickAction, { icon: _jsx(Star, { className: "size-3.5" }), label: "VIP", active: flags.vip, onClick: actions?.onToggleVip }), _jsx(QuickAction, { icon: _jsx(BellOff, { className: "size-3.5" }), label: "Mute", active: flags.muted, onClick: actions?.onToggleMute }), actions?.onNotSpam && (_jsx(QuickAction, { icon: _jsx(MailCheck, { className: "size-3.5" }), label: notSpamPending ? notSpamPendingLabel : "Not spam", active: true, onClick: actions.onNotSpam, pending: notSpamPending })), actions?.onReportSpam && (_jsx(QuickAction, { icon: _jsx(ShieldX, { className: "size-3.5" }), label: reportSpamPending ? "Reporting…" : "Report spam", danger: true, onClick: actions.onReportSpam, pending: reportSpamPending }))] }), actions?.onNotSpam && spamAction === "undoSpamReport" && (_jsx("p", { className: "mt-1.5 text-2xs text-fg-subtle", children: "You reported this message as spam" }))] }), _jsx(IntelligenceSection, { label: "Coming soon", className: "border-b-0 opacity-70", children: _jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex items-start gap-2 rounded-md border border-dashed border-line p-2", children: [_jsx(Sparkles, { className: "mt-0.5 size-3.5 shrink-0 text-fg-subtle" }), _jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-fg-muted", children: "Suggested actions" }), _jsx("div", { className: "text-2xs text-fg-subtle", children: "\"Create a filter for messages like this\" \u2014 on-device model" })] })] }), _jsxs("div", { className: "flex items-start gap-2 rounded-md border border-dashed border-line p-2", children: [_jsx(Sparkles, { className: "mt-0.5 size-3.5 shrink-0 text-fg-subtle" }), _jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-fg-muted", children: "Thread summary" }), _jsx("div", { className: "text-2xs text-fg-subtle", children: "One-paragraph digest \u2014 Bedrock" })] })] })] }) })] }))] }));
69
57
  }
@@ -1,7 +1,9 @@
1
1
  import type { ReactNode } from "react";
2
2
  /** One labelled band of the intelligence panel, shared by both its tabs. */
3
- export declare function IntelligenceSection({ label, children, className, }: {
3
+ export declare function IntelligenceSection({ label, headingId, children, className, }: {
4
4
  label: string;
5
+ /** Names the heading so a control elsewhere can move focus to it. */
6
+ headingId?: string;
5
7
  children: ReactNode;
6
8
  className?: string;
7
9
  }): import("react").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../lib/cn.js";
3
3
  /** One labelled band of the intelligence panel, shared by both its tabs. */
4
- export function IntelligenceSection({ label, children, className, }) {
5
- return (_jsxs("section", { className: cn("border-b border-line px-row-inset py-3", className), children: [_jsx("h3", { className: "text-2xs font-semibold uppercase tracking-wider text-fg-subtle", children: label }), _jsx("div", { className: "mt-2", children: children })] }));
4
+ export function IntelligenceSection({ label, headingId, children, className, }) {
5
+ return (_jsxs("section", { "aria-labelledby": headingId, className: cn("border-b border-line px-row-inset py-3", className), children: [_jsx("h3", { id: headingId, tabIndex: headingId ? -1 : undefined, className: "text-2xs font-semibold uppercase tracking-wider text-fg-subtle outline-none focus-visible:ring-2 focus-visible:ring-ring", children: label }), _jsx("div", { className: "mt-2", children: children })] }));
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { categoryTone, getCategoryLabel } from "../category-presentation.js";
3
- import { Check, Paperclip, ShieldAlert, Star } from "../icons.js";
3
+ import { Check, Paperclip, ShieldAlert, Star, TriangleAlert, } from "../icons.js";
4
4
  import { cn } from "../lib/cn.js";
5
5
  import { ROW_ATTRIBUTE } from "../lib/keymap-dispatch.js";
6
6
  import { LIST_ROW_ATTRIBUTE } from "../lib/roving-focus.js";
@@ -8,6 +8,7 @@ import { Avatar } from "./avatar.js";
8
8
  import { Badge } from "./badge.js";
9
9
  import { LabelChip } from "./label-chip.js";
10
10
  import { MessageSettlementBadge } from "./message-settlement.js";
11
+ import { SpamRowMarker } from "./spam-row-marker.js";
11
12
  /** Visible keyboard-focus ring for a row reached by the list's arrow-key cursor. */
12
13
  const ROW_FOCUS_RING = "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset";
13
14
  /**
@@ -40,7 +41,7 @@ export const comfortableRowClass = ({ active, focused, }) => cn(
40
41
  */
41
42
  export function CompactRowBody({ thread }) {
42
43
  const unread = !thread.isRead;
43
- return (_jsxs(_Fragment, { children: [_jsx("span", { className: "flex w-4 shrink-0 items-center justify-center", children: thread.suspicious ? (_jsx(ShieldAlert, { className: "size-3.5 text-danger" })) : thread.starred ? (_jsx(Star, { className: "size-3 fill-warning text-warning" })) : unread ? (_jsx("span", { className: "size-1.5 rounded-full bg-accent" })) : null }), _jsx("span", { className: cn("w-36 shrink-0 truncate text-xs", unread ? "font-semibold text-fg" : "text-fg-muted"), children: thread.fromName }), _jsxs("span", { className: "min-w-0 flex-1 truncate text-xs", children: [_jsx("span", { className: cn(unread ? "font-medium text-fg" : "text-fg-muted"), children: thread.subject }), _jsxs("span", { className: "text-fg-subtle", children: [" \u2014 ", thread.snippet] })] }), thread.hasAttachment && (_jsx(Paperclip, { className: "size-3 shrink-0 text-fg-subtle", role: "img", "aria-label": "Has an attachment" })), thread.settlement && (_jsx(MessageSettlementBadge, { settlement: thread.settlement })), _jsx("span", { className: "w-11 shrink-0 text-right text-2xs text-fg-subtle tabular-nums", children: thread.timeLabel })] }));
44
+ return (_jsxs(_Fragment, { children: [_jsx("span", { className: "flex w-4 shrink-0 items-center justify-center", children: thread.spam ? (thread.spam.label.name === "Phishing" ? (_jsx(ShieldAlert, { className: "size-3.5 text-danger", role: "img", "aria-label": "Phishing" })) : (_jsx(TriangleAlert, { className: "size-3.5 text-warning", role: "img", "aria-label": "Spam" }))) : thread.starred ? (_jsx(Star, { className: "size-3 fill-warning text-warning" })) : unread ? (_jsx("span", { className: "size-1.5 rounded-full bg-accent" })) : null }), _jsx("span", { className: cn("w-36 shrink-0 truncate text-xs", unread ? "font-semibold text-fg" : "text-fg-muted"), children: thread.fromName }), _jsxs("span", { className: "min-w-0 flex-1 truncate text-xs", children: [_jsx("span", { className: cn(unread ? "font-medium text-fg" : "text-fg-muted"), children: thread.subject }), _jsxs("span", { className: "text-fg-subtle", children: [" \u2014 ", thread.snippet] })] }), thread.hasAttachment && (_jsx(Paperclip, { className: "size-3 shrink-0 text-fg-subtle", role: "img", "aria-label": "Has an attachment" })), thread.settlement && (_jsx(MessageSettlementBadge, { settlement: thread.settlement })), _jsx("span", { className: "w-11 shrink-0 text-right text-2xs text-fg-subtle tabular-nums", children: thread.timeLabel })] }));
44
45
  }
45
46
  /**
46
47
  * Bold the literal (case-insensitive) occurrences of `query` in `text`. Used by
@@ -76,7 +77,9 @@ function highlightMatches(text, query) {
76
77
  */
77
78
  export function ComfortableRowTextContent({ thread, badge, highlightQuery, }) {
78
79
  const unread = !thread.isRead;
79
- return (_jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex items-baseline justify-between gap-2", children: [_jsxs("span", { className: cn("flex min-w-0 items-center gap-1.5 truncate text-sm", unread ? "font-semibold text-fg" : "font-medium text-fg-muted"), children: [thread.trust === "vip" && (_jsx("span", { className: "size-1.5 shrink-0 rounded-full bg-accent-2" })), _jsx("span", { className: "truncate", children: thread.fromName }), thread.messageCount != null && thread.messageCount > 1 && (_jsx("span", { className: "shrink-0 text-2xs font-normal text-fg-subtle", children: thread.messageCount }))] }), _jsx("span", { className: "shrink-0 text-2xs text-fg-subtle tabular-nums", children: thread.timeLabel })] }), _jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: cn("truncate text-sm", unread ? "text-fg" : "text-fg-muted"), children: highlightMatches(thread.subject, highlightQuery) }), thread.suspicious && (_jsx(ShieldAlert, { className: "size-3.5 shrink-0 text-danger" })), thread.starred && (_jsx(Star, { className: "size-3 shrink-0 fill-warning text-warning" })), thread.hasAttachment && (_jsx(Paperclip, { className: "size-3 shrink-0 text-fg-subtle", role: "img", "aria-label": "Has an attachment" }))] }), _jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "line-clamp-1 min-w-0 flex-1 text-xs text-fg-subtle", children: highlightMatches(thread.snippet, highlightQuery) }), thread.category && thread.category !== "personal" && (_jsx(Badge, { tone: categoryTone[thread.category], className: "shrink-0", children: getCategoryLabel(thread.category) })), thread.labels?.map((label) => (_jsx(LabelChip, { label: label, className: "max-w-20" }, label.labelId))), thread.settlement && (_jsx(MessageSettlementBadge, { settlement: thread.settlement })), badge] })] }));
80
+ return (_jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex items-baseline justify-between gap-2", children: [_jsxs("span", { className: cn("flex min-w-0 items-center gap-1.5 truncate text-sm", unread ? "font-semibold text-fg" : "font-medium text-fg-muted"), children: [thread.trust === "vip" && (_jsx("span", { className: "size-1.5 shrink-0 rounded-full bg-accent-2" })), _jsx("span", { className: "truncate", children: thread.fromName }), thread.messageCount != null && thread.messageCount > 1 && (_jsx("span", { className: "shrink-0 text-2xs font-normal text-fg-subtle", children: thread.messageCount }))] }), _jsx("span", { className: "shrink-0 text-2xs text-fg-subtle tabular-nums", children: thread.timeLabel })] }), _jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: cn("truncate text-sm", unread ? "text-fg" : "text-fg-muted"), children: highlightMatches(thread.subject, highlightQuery) }), thread.starred && (_jsx(Star, { className: "size-3 shrink-0 fill-warning text-warning" })), thread.hasAttachment && (_jsx(Paperclip, { className: "size-3 shrink-0 text-fg-subtle", role: "img", "aria-label": "Has an attachment" }))] }), _jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: "line-clamp-1 min-w-0 flex-1 text-xs text-fg-subtle", children: highlightMatches(thread.snippet, highlightQuery) }), thread.category && thread.category !== "personal" && (_jsx(Badge, { tone: categoryTone[thread.category], className: "shrink-0", children: getCategoryLabel(thread.category) })), thread.spam && (_jsx(SpamRowMarker, { label: thread.spam.label, suspected: thread.spam.suspected })), thread.labels
81
+ ?.filter((label) => label.labelId !== thread.spam?.label.labelId)
82
+ .map((label) => (_jsx(LabelChip, { label: label, className: "max-w-20" }, label.labelId))), thread.settlement && (_jsx(MessageSettlementBadge, { settlement: thread.settlement })), badge] })] }));
80
83
  }
81
84
  /**
82
85
  * Leading slot of a comfortable row: the avatar, with a checkbox layered over
@@ -1,4 +1,4 @@
1
- import type { AppShellProps, NavLinkComponent } from "./app-shell-types.js";
1
+ import type { AppShellProps, NavLabel, NavLinkComponent } from "./app-shell-types.js";
2
2
  /**
3
3
  * Read a persisted open/closed flag. `fallback` applies only when nothing is
4
4
  * stored yet. Both the account section and the custom-folders section default
@@ -24,6 +24,11 @@ export interface NavSidebarProps extends Pick<AppShellProps, "accounts" | "selec
24
24
  * fall back to programmatic buttons (static stories / AppShell preview).
25
25
  */
26
26
  linkComponent?: NavLinkComponent;
27
+ /**
28
+ * The labels, listed under the daily brief. Each is one entry across every
29
+ * account.
30
+ */
31
+ labels?: NavLabel[];
27
32
  /**
28
33
  * Whether the calendar destination sits under the daily brief. Hidden by
29
34
  * default so a host with no calendar route behind it does not offer an entry
@@ -31,4 +36,4 @@ export interface NavSidebarProps extends Pick<AppShellProps, "accounts" | "selec
31
36
  */
32
37
  calendarNav?: "hidden" | "shown";
33
38
  }
34
- export declare function NavSidebar({ accounts, selectedNavId, briefUnseen, onSelectNav, variant, linkComponent, calendarNav, }: NavSidebarProps): import("react").JSX.Element;
39
+ export declare function NavSidebar({ accounts, selectedNavId, briefUnseen, onSelectNav, variant, linkComponent, labels, calendarNav, }: NavSidebarProps): import("react").JSX.Element;
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { useRef, useState } from "react";
3
3
  import { Archive, BellOff, CalendarDays, ChevronDown, ChevronRight, CircleAlert, CirclePause, FileText, Folder, Inbox, Mails, OctagonAlert, Send, Sparkles, Star, Trash, } from "../icons.js";
4
4
  import { cn } from "../lib/cn.js";
5
+ import { isLabelColorValue, labelDotClass } from "../lib/label-color.js";
5
6
  import { useRovingFocus } from "../lib/roving-focus.js";
6
7
  import { ACCOUNT_SERVICE_OFF_LABEL } from "./account-service-status.js";
7
8
  /* ------------------------------------------------------------------ */
@@ -77,6 +78,12 @@ function roleIcon(role) {
77
78
  return _jsx(Trash, { className: "size-4" });
78
79
  }
79
80
  }
81
+ function labelIcon(color) {
82
+ const dotClass = isLabelColorValue(color)
83
+ ? labelDotClass[color]
84
+ : labelDotClass.Default;
85
+ return (_jsx("span", { className: "flex size-4 items-center justify-center", children: _jsx("span", { className: cn("size-2.5 rounded-full", dotClass) }) }));
86
+ }
80
87
  const hasRole = (mb) => mb.role != null;
81
88
  const FOLDER_COLLAPSE_THRESHOLD = 8;
82
89
  const FOLDER_OPEN_KEY = "remit.nav.folders.open.";
@@ -142,11 +149,11 @@ function AccountNav({ account, selectedNavId, onSelectNav, linkComponent, }) {
142
149
  ? "Show less"
143
150
  : `Show all (${folders.length})` }))] }))] }))] }))] }))] }));
144
151
  }
145
- export function NavSidebar({ accounts, selectedNavId, briefUnseen, onSelectNav, variant = "desktop", linkComponent, calendarNav = "hidden", }) {
152
+ export function NavSidebar({ accounts, selectedNavId, briefUnseen, onSelectNav, variant = "desktop", linkComponent, labels = [], calendarNav = "hidden", }) {
146
153
  const containerRef = useRef(null);
147
154
  useRovingFocus({ containerRef, itemSelector: NAV_ITEM_SELECTOR });
148
155
  const isDrawer = variant === "drawer";
149
- const navBody = (_jsxs("nav", { ref: isDrawer ? containerRef : undefined, className: isDrawer ? "px-2 py-2" : "flex-1 overflow-y-auto px-2 py-2", "aria-label": "Mailboxes", children: [_jsx(NavItem, { navId: "brief", linkComponent: linkComponent, icon: _jsx(Sparkles, { className: "size-4" }), label: "Daily brief", ariaLabel: "Daily brief", count: briefUnseen, active: selectedNavId === "brief", onClick: () => onSelectNav?.("brief") }), calendarNav === "shown" && (_jsx(NavItem, { navId: "calendar", linkComponent: linkComponent, icon: _jsx(CalendarDays, { className: "size-4" }), label: "Calendar", ariaLabel: "Calendar", active: selectedNavId === "calendar", onClick: () => onSelectNav?.("calendar") })), _jsx(NavItem, { navId: "flagged", linkComponent: linkComponent, icon: _jsx(Star, { className: "size-4" }), label: "Starred", ariaLabel: "Starred", active: selectedNavId === "flagged", onClick: () => onSelectNav?.("flagged") }), accounts.length === 0 ? (_jsx("div", { className: "px-2 py-4 text-center text-sm text-fg-muted", children: "No accounts configured" })) : (accounts.map((account) => (_jsx(AccountNav, { account: account, selectedNavId: selectedNavId, onSelectNav: onSelectNav, linkComponent: linkComponent }, account.id))))] }));
156
+ const navBody = (_jsxs("nav", { ref: isDrawer ? containerRef : undefined, className: isDrawer ? "px-2 py-2" : "flex-1 overflow-y-auto px-2 py-2", "aria-label": "Mailboxes", children: [_jsx(NavItem, { navId: "brief", linkComponent: linkComponent, icon: _jsx(Sparkles, { className: "size-4" }), label: "Daily brief", ariaLabel: "Daily brief", count: briefUnseen, active: selectedNavId === "brief", onClick: () => onSelectNav?.("brief") }), labels.map((label) => (_jsx(NavItem, { navId: label.id, linkComponent: linkComponent, icon: labelIcon(label.color), label: label.name, ariaLabel: label.name, active: selectedNavId === label.id, onClick: () => onSelectNav?.(label.id) }, label.id))), calendarNav === "shown" && (_jsx(NavItem, { navId: "calendar", linkComponent: linkComponent, icon: _jsx(CalendarDays, { className: "size-4" }), label: "Calendar", ariaLabel: "Calendar", active: selectedNavId === "calendar", onClick: () => onSelectNav?.("calendar") })), _jsx(NavItem, { navId: "flagged", linkComponent: linkComponent, icon: _jsx(Star, { className: "size-4" }), label: "Starred", ariaLabel: "Starred", active: selectedNavId === "flagged", onClick: () => onSelectNav?.("flagged") }), accounts.length === 0 ? (_jsx("div", { className: "px-2 py-4 text-center text-sm text-fg-muted", children: "No accounts configured" })) : (accounts.map((account) => (_jsx(AccountNav, { account: account, selectedNavId: selectedNavId, onSelectNav: onSelectNav, linkComponent: linkComponent }, account.id))))] }));
150
157
  if (isDrawer)
151
158
  return navBody;
152
159
  return (_jsx("aside", { ref: containerRef, className: "flex h-full w-full flex-col bg-surface-sunken", children: navBody }));
@@ -34,6 +34,8 @@ export interface SelectionTopBarProps {
34
34
  onJunk?: () => void;
35
35
  /** Optional — dropped from the overflow menu while `isBusy`. */
36
36
  onMarkRead?: () => void;
37
+ /** Runs the spam check again over the selection, ten messages at a time. */
38
+ onCheckAgain?: () => void;
37
39
  /**
38
40
  * The list header's own chrome, rendered only while nothing is ticked: the
39
41
  * nav button, the unread count beside the title, and the search affordance.
@@ -119,4 +121,4 @@ export interface SelectionTopBarProps {
119
121
  * row one is a count and the verbs. A back arrow leaves selection at every
120
122
  * width, so a partial selection is always one press from being dropped.
121
123
  */
122
- export declare function SelectionTopBar({ title, count, onCancel, onDelete, onMove, onOrganize, onJunk, onMarkRead, navSlot, titleMeta, searchSlot, searchField, idleSlot, overflowSlot, isBusy, isCounting, selectAll, statusLabel, progress, notice, }: SelectionTopBarProps): import("react").JSX.Element;
124
+ export declare function SelectionTopBar({ title, count, onCancel, onDelete, onMove, onOrganize, onJunk, onMarkRead, onCheckAgain, navSlot, titleMeta, searchSlot, searchField, idleSlot, overflowSlot, isBusy, isCounting, selectAll, statusLabel, progress, notice, }: SelectionTopBarProps): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ArrowLeft, FolderInput, LoaderCircle, MailOpen, ShieldAlert, Sparkles, Trash, } from "../icons.js";
2
+ import { ArrowLeft, FolderInput, LoaderCircle, MailOpen, RefreshCw, ShieldAlert, Sparkles, Trash, } from "../icons.js";
3
3
  import { Banner } from "./banner.js";
4
4
  import { Button } from "./button.js";
5
5
  import { Checkbox } from "./checkbox.js";
@@ -22,7 +22,7 @@ function SelectAllToggle({ selectAll, selecting, className, }) {
22
22
  * row one is a count and the verbs. A back arrow leaves selection at every
23
23
  * width, so a partial selection is always one press from being dropped.
24
24
  */
25
- export function SelectionTopBar({ title, count, onCancel, onDelete, onMove, onOrganize, onJunk, onMarkRead, navSlot, titleMeta, searchSlot, searchField, idleSlot, overflowSlot, isBusy = false, isCounting = false, selectAll, statusLabel, progress, notice, }) {
25
+ export function SelectionTopBar({ title, count, onCancel, onDelete, onMove, onOrganize, onJunk, onMarkRead, onCheckAgain, navSlot, titleMeta, searchSlot, searchField, idleSlot, overflowSlot, isBusy = false, isCounting = false, selectAll, statusLabel, progress, notice, }) {
26
26
  const selecting = count > 0 || isCounting;
27
27
  const defaultLabel = selectAll?.checked
28
28
  ? `All ${formatCount(count)} loaded selected`
@@ -44,5 +44,13 @@ export function SelectionTopBar({ title, count, onCancel, onDelete, onMove, onOr
44
44
  onSelect: onMarkRead,
45
45
  });
46
46
  }
47
+ if (onCheckAgain && !isBusy && !isCounting) {
48
+ overflowItems.push({
49
+ key: "check-again",
50
+ label: "Check again",
51
+ icon: _jsx(RefreshCw, { className: "size-4" }),
52
+ onSelect: onCheckAgain,
53
+ });
54
+ }
47
55
  return (_jsxs("header", { "data-selection-bar": "", className: "flex shrink-0 flex-col border-b border-line bg-surface-sunken", children: [_jsxs("div", { "data-selection-bar-row": "actions", className: "flex h-pane-header items-center gap-1 px-row-inset", children: [selecting ? (_jsx(Button, { variant: "ghost", size: "touch", icon: _jsx(ArrowLeft, { className: "size-5" }), onClick: onCancel, "aria-label": "Cancel selection", className: "-ml-2 shrink-0" })) : (navSlot), selectAll && (_jsx(SelectAllToggle, { selectAll: selectAll, selecting: selecting, className: "hidden shrink-0 pr-2 md:flex" })), selecting ? (_jsx("span", { "data-selection-count": "", className: "min-w-0 flex-1 truncate px-1 text-sm font-medium text-fg", role: "status", "aria-live": "polite", children: statusLabel ?? defaultLabel })) : searchField ? (_jsx("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: searchField })) : (_jsxs(_Fragment, { children: [_jsx("h1", { className: "min-w-0 flex-1 truncate px-1 text-sm font-semibold text-fg", children: title }), titleMeta, searchSlot] })), selecting && !isCounting && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "ghost", size: "touch", icon: isBusy ? (_jsx(LoaderCircle, { className: "size-5 animate-spin" })) : (_jsx(Trash, { className: "size-5 text-danger" })), onClick: isBusy ? undefined : onDelete, "aria-label": "Move selected messages to Trash", "aria-busy": isBusy || undefined, className: "shrink-0" }), !isBusy && onMove && (_jsx(Button, { variant: "ghost", size: "touch", icon: _jsx(FolderInput, { className: "size-5" }), onClick: onMove, "aria-label": "Move selected messages", className: "shrink-0" })), !isBusy && onOrganize && (_jsx(Button, { variant: "ghost", size: "touch", icon: _jsx(Sparkles, { className: "size-5" }), onClick: onOrganize, "aria-label": "Organize selected messages", className: "shrink-0" }))] })), selecting && (_jsx(PopoverMenu, { triggerLabel: "More actions", items: overflowItems, className: "shrink-0", children: !isBusy && !isCounting && overflowSlot }))] }), !selecting && idleSlot, selecting && selectAll && (_jsx("div", { "data-selection-bar-row": "select-all", className: "px-row-inset pb-2 md:hidden", children: _jsx(SelectAllToggle, { selectAll: selectAll, selecting: selecting, className: "w-full" }) })), progress && (_jsx("div", { className: "px-row-inset pb-2", children: _jsx(ProgressBar, { value: progress.value, max: progress.max, tone: progress.tone }) })), notice && (_jsx(Banner, { "data-selection-notice": "", tone: notice.tone, variant: "soft", role: "status", "aria-live": "polite", className: "mx-row-inset mb-2", children: _jsxs("div", { className: "flex items-center justify-between gap-2", children: [notice.text && _jsx("span", { children: notice.text }), notice.action && (_jsx(Button, { variant: "ghost", size: "md", onClick: notice.action.onClick, className: "-my-1 min-h-11 shrink-0", children: notice.action.label }))] }) }))] }));
48
56
  }
@@ -0,0 +1,25 @@
1
+ import type { RemitImapRescanFailureCode, RemitImapSpamChecked, RemitImapSpamFailureKind, RemitImapSpamKind, RemitImapSpamModelOutcome, RemitImapSpamReason, RemitImapSpamSenderScreenRule, RemitImapSpamThresholds } from "@remit/api-http-client/types.gen.ts";
2
+ export declare const isModelReason: (reason: RemitImapSpamReason) => boolean;
3
+ export declare const UNKNOWN_REASON_SENTENCE = "Remit ran a check this version can't describe.";
4
+ export declare const CHECK_FAILED_HEADLINE = "Remit couldn't check this message";
5
+ export declare const BASIC_CHECKS_ONLY = "Only the basic checks ran";
6
+ /**
7
+ * The one sentence a reason reads as, wherever it shows. A backend symbol, or
8
+ * a name this version does not know, yields `undefined`: the caller shows the
9
+ * raw symbol and a report link instead of a guess.
10
+ */
11
+ export declare function spamReasonSentence(name: string): string | undefined;
12
+ export declare function topSpamReason(reasons: readonly RemitImapSpamReason[]): RemitImapSpamReason | undefined;
13
+ export declare function topSpamReasonSentence(reasons: readonly RemitImapSpamReason[]): string;
14
+ /** What the model said, quoted from its reason, when it answered. */
15
+ export declare function modelSaid(verdict: RemitImapSpamChecked): string | undefined;
16
+ export declare const MODEL_SKIP_CAUSES: Record<Exclude<RemitImapSpamModelOutcome, "Answered" | "OutOfBand">, string>;
17
+ /** Why the model did not weigh in on a message it would have helped with. */
18
+ export declare function modelSkipCause(verdict: RemitImapSpamChecked): string | undefined;
19
+ export declare const SPAM_FAILURE_SENTENCES: Record<RemitImapSpamFailureKind, string>;
20
+ export declare const CHECK_AGAIN_FAILURE_SENTENCES: Record<RemitImapRescanFailureCode, string>;
21
+ export declare const SPAM_SCREEN_SENTENCES: Record<Exclude<RemitImapSpamSenderScreenRule, "ReportedSender">, string>;
22
+ export declare const filterScreenSentence: (filterName: string) => string;
23
+ export declare const SPAM_WARN_HEADLINES: Record<RemitImapSpamKind, string>;
24
+ export declare const formatSpamScore: (score: number) => string;
25
+ export declare const spamScoreSentence: (score: number, thresholds: RemitImapSpamThresholds) => string;