@remit/ui 0.0.238 → 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.
- package/dist/components/app-shell-types.d.ts +7 -2
- package/dist/components/button.d.ts +5 -0
- package/dist/components/button.js +2 -0
- package/dist/components/check-again-panel.d.ts +43 -0
- package/dist/components/check-again-panel.js +60 -0
- package/dist/components/failure-banner.d.ts +11 -0
- package/dist/components/failure-banner.js +7 -0
- package/dist/components/intelligence-calendar-fixtures.js +0 -12
- package/dist/components/intelligence-panel.d.ts +7 -26
- package/dist/components/intelligence-panel.js +4 -16
- package/dist/components/intelligence-section.d.ts +3 -1
- package/dist/components/intelligence-section.js +2 -2
- package/dist/components/message-row.js +6 -3
- package/dist/components/selection-top-bar.d.ts +3 -1
- package/dist/components/selection-top-bar.js +10 -2
- package/dist/components/spam-copy.d.ts +25 -0
- package/dist/components/spam-copy.js +100 -0
- package/dist/components/spam-daily-chart.d.ts +17 -0
- package/dist/components/spam-daily-chart.js +18 -0
- package/dist/components/spam-fixtures.d.ts +19 -0
- package/dist/components/spam-fixtures.js +143 -0
- package/dist/components/spam-row-marker.d.ts +12 -0
- package/dist/components/spam-row-marker.js +10 -0
- package/dist/components/spam-verdict-panel.d.ts +37 -0
- package/dist/components/spam-verdict-panel.js +74 -0
- package/dist/components/spam-warning-banner.d.ts +20 -0
- package/dist/components/spam-warning-banner.js +62 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +8 -1
- package/package.json +3 -2
|
@@ -175,6 +175,11 @@ export interface ThreadRowLabel {
|
|
|
175
175
|
name: string;
|
|
176
176
|
color: string;
|
|
177
177
|
}
|
|
178
|
+
export interface ThreadRowSpam {
|
|
179
|
+
label: ThreadRowLabel;
|
|
180
|
+
/** The message still sits where it arrived, under the warning. */
|
|
181
|
+
suspected: boolean;
|
|
182
|
+
}
|
|
178
183
|
export interface ThreadRowData {
|
|
179
184
|
id: string;
|
|
180
185
|
/**
|
|
@@ -207,8 +212,8 @@ export interface ThreadRowData {
|
|
|
207
212
|
category?: ThreadCategory;
|
|
208
213
|
/** Number of messages when the row is a thread. */
|
|
209
214
|
messageCount?: number;
|
|
210
|
-
/**
|
|
211
|
-
|
|
215
|
+
/** The Remit Spam or Phishing label the message carries. */
|
|
216
|
+
spam?: ThreadRowSpam;
|
|
212
217
|
/** Labels applied to this message (issue #26) — filter-, organize-, and manually-applied alike. */
|
|
213
218
|
labels?: ThreadRowLabel[];
|
|
214
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"
|
|
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:
|
|
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
|
|
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,
|
|
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,
|
|
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 }) }),
|
|
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.
|
|
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.
|
|
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
|
|
@@ -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;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
const REASON_SENTENCES = {
|
|
2
|
+
DmarcFail: "It failed the sender domain's DMARC check.",
|
|
3
|
+
SignerMismatch: "It was signed by a different domain than its sender.",
|
|
4
|
+
ReplyToMismatch: "Replies would go to a different domain than the sender's.",
|
|
5
|
+
LinkTextMismatch: "A link's text shows one domain and opens another.",
|
|
6
|
+
LinkDomainDistant: "A link leads to a domain unrelated to the sender's.",
|
|
7
|
+
PunycodeDomain: "A domain in it is written in punycode, which can hide lookalike letters.",
|
|
8
|
+
MixedScriptDomain: "A domain in it mixes letters from different alphabets.",
|
|
9
|
+
ConfusableDomains: "Two different domains in it look the same.",
|
|
10
|
+
SingleOffDomainLink: "Its only link leads away from the sender's domain.",
|
|
11
|
+
GeneratedName: "The sender's address looks machine-generated.",
|
|
12
|
+
FirstContactDomain: "The sender's domain has sent you nothing before.",
|
|
13
|
+
RecentlyRegisteredDomain: "The sender's domain was registered recently.",
|
|
14
|
+
UnknownRegistrationDate: "The sender's domain has no public registration date.",
|
|
15
|
+
ClassifierSpam: "Remit's classifier rated it as likely spam.",
|
|
16
|
+
ClassifierPhishing: "Remit's classifier rated it as likely phishing.",
|
|
17
|
+
ProviderSpam: "Your provider marked it as spam.",
|
|
18
|
+
DisplayNameForeignAddress: "The display name spells out an address at another domain.",
|
|
19
|
+
DisplayNameLookalike: "The display name looks like a different domain's name.",
|
|
20
|
+
ModelImpersonation: "The model judged that it claims an organisation its sender does not belong to.",
|
|
21
|
+
ModelSpam: "The model judged it spam.",
|
|
22
|
+
ModelClean: "The model judged it legitimate.",
|
|
23
|
+
ListedPhishingLink: "A link in it is on a list of known phishing pages.",
|
|
24
|
+
};
|
|
25
|
+
const MODEL_REASONS = new Set([
|
|
26
|
+
"ModelImpersonation",
|
|
27
|
+
"ModelSpam",
|
|
28
|
+
"ModelClean",
|
|
29
|
+
]);
|
|
30
|
+
export const isModelReason = (reason) => MODEL_REASONS.has(reason.name);
|
|
31
|
+
export const UNKNOWN_REASON_SENTENCE = "Remit ran a check this version can't describe.";
|
|
32
|
+
export const CHECK_FAILED_HEADLINE = "Remit couldn't check this message";
|
|
33
|
+
export const BASIC_CHECKS_ONLY = "Only the basic checks ran";
|
|
34
|
+
const isDescribedReason = (name) => Object.hasOwn(REASON_SENTENCES, name);
|
|
35
|
+
/**
|
|
36
|
+
* The one sentence a reason reads as, wherever it shows. A backend symbol, or
|
|
37
|
+
* a name this version does not know, yields `undefined`: the caller shows the
|
|
38
|
+
* raw symbol and a report link instead of a guess.
|
|
39
|
+
*/
|
|
40
|
+
export function spamReasonSentence(name) {
|
|
41
|
+
return isDescribedReason(name) ? REASON_SENTENCES[name] : undefined;
|
|
42
|
+
}
|
|
43
|
+
export function topSpamReason(reasons) {
|
|
44
|
+
return reasons.reduce((top, reason) => (top && top.score >= reason.score ? top : reason), undefined);
|
|
45
|
+
}
|
|
46
|
+
export function topSpamReasonSentence(reasons) {
|
|
47
|
+
const top = topSpamReason(reasons);
|
|
48
|
+
if (!top)
|
|
49
|
+
return "";
|
|
50
|
+
return spamReasonSentence(top.name) ?? UNKNOWN_REASON_SENTENCE;
|
|
51
|
+
}
|
|
52
|
+
/** What the model said, quoted from its reason, when it answered. */
|
|
53
|
+
export function modelSaid(verdict) {
|
|
54
|
+
if (verdict.modelOutcome !== "Answered")
|
|
55
|
+
return undefined;
|
|
56
|
+
const reason = verdict.reasons.find(isModelReason);
|
|
57
|
+
if (!reason || reason.options.length === 0)
|
|
58
|
+
return undefined;
|
|
59
|
+
return reason.options.join(" ");
|
|
60
|
+
}
|
|
61
|
+
export const MODEL_SKIP_CAUSES = {
|
|
62
|
+
NotConfigured: "this account has no model set up.",
|
|
63
|
+
DailyLimit: "this account reached its daily model limit.",
|
|
64
|
+
RateLimited: "the model provider asked Remit to slow down.",
|
|
65
|
+
};
|
|
66
|
+
/** Why the model did not weigh in on a message it would have helped with. */
|
|
67
|
+
export function modelSkipCause(verdict) {
|
|
68
|
+
const outcome = verdict.modelOutcome;
|
|
69
|
+
if (outcome === "Answered" || outcome === "OutOfBand")
|
|
70
|
+
return undefined;
|
|
71
|
+
return MODEL_SKIP_CAUSES[outcome];
|
|
72
|
+
}
|
|
73
|
+
export const SPAM_FAILURE_SENTENCES = {
|
|
74
|
+
Unreachable: "the spam service could not be reached",
|
|
75
|
+
TimedOut: "the spam service did not answer in time",
|
|
76
|
+
ServiceError: "the spam service answered with an error",
|
|
77
|
+
Unparseable: "Remit could not read the spam service's answer",
|
|
78
|
+
};
|
|
79
|
+
export const CHECK_AGAIN_FAILURE_SENTENCES = {
|
|
80
|
+
RateLimited: "try again in a minute.",
|
|
81
|
+
DailyCap: "try again tomorrow (daily model limit).",
|
|
82
|
+
NotSettled: "a move is still settling. Remit will retry it once the move lands.",
|
|
83
|
+
NotFound: "the message is gone from the server. No retry for this one.",
|
|
84
|
+
NotPermitted: "the server refused access to this message. No retry for this one.",
|
|
85
|
+
};
|
|
86
|
+
export const SPAM_SCREEN_SENTENCES = {
|
|
87
|
+
NeverSpam: "You marked this sender Never in Spam.",
|
|
88
|
+
Vip: "This sender is a VIP.",
|
|
89
|
+
WellKnown: "You know this sender well.",
|
|
90
|
+
Newsletter: "It is a newsletter from a sender you already get mail from.",
|
|
91
|
+
};
|
|
92
|
+
export const filterScreenSentence = (filterName) => `Your filter "${filterName}" matched it.`;
|
|
93
|
+
export const SPAM_WARN_HEADLINES = {
|
|
94
|
+
Spam: "Remit suspects this is spam",
|
|
95
|
+
Phishing: "Remit suspects this message impersonates someone",
|
|
96
|
+
};
|
|
97
|
+
export const formatSpamScore = (score) => score.toFixed(2);
|
|
98
|
+
export const spamScoreSentence = (score, thresholds) => thresholds.state === "Set"
|
|
99
|
+
? `Score ${formatSpamScore(score)}. Remit warns from ${formatSpamScore(thresholds.cleanBelow)} and moves to Spam from ${formatSpamScore(thresholds.spamAt)}.`
|
|
100
|
+
: `Score ${formatSpamScore(score)}. The spam service applies its own thresholds.`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** One day of verdicts: what reached the Spam threshold and what only warned. */
|
|
2
|
+
export interface SpamDay {
|
|
3
|
+
date: string;
|
|
4
|
+
moved: number;
|
|
5
|
+
warned: number;
|
|
6
|
+
}
|
|
7
|
+
export interface SpamDailyChartProps {
|
|
8
|
+
title: string;
|
|
9
|
+
tone: "warning" | "danger";
|
|
10
|
+
days: SpamDay[];
|
|
11
|
+
}
|
|
12
|
+
export declare const spamDayDescription: (day: SpamDay) => string;
|
|
13
|
+
/**
|
|
14
|
+
* One bar per day, moved stacked under warned. Each bar carries its own text
|
|
15
|
+
* alternative.
|
|
16
|
+
*/
|
|
17
|
+
export declare function SpamDailyChart({ title, tone, days }: SpamDailyChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
const TONES = {
|
|
4
|
+
warning: { moved: "bg-warning", warned: "bg-warning/35" },
|
|
5
|
+
danger: { moved: "bg-danger", warned: "bg-danger/35" },
|
|
6
|
+
};
|
|
7
|
+
export const spamDayDescription = (day) => `${day.date}: ${day.moved} moved, ${day.warned} warned`;
|
|
8
|
+
/**
|
|
9
|
+
* One bar per day, moved stacked under warned. Each bar carries its own text
|
|
10
|
+
* alternative.
|
|
11
|
+
*/
|
|
12
|
+
export function SpamDailyChart({ title, tone, days }) {
|
|
13
|
+
const peak = Math.max(1, ...days.map((day) => day.moved + day.warned));
|
|
14
|
+
const colours = TONES[tone];
|
|
15
|
+
const first = days[0];
|
|
16
|
+
const last = days[days.length - 1];
|
|
17
|
+
return (_jsxs("figure", { className: "min-w-0", children: [_jsx("figcaption", { className: "text-xs font-semibold text-fg", children: title }), _jsx("ul", { className: "mt-2 flex h-24 list-none items-end gap-px border-b border-line", children: days.map((day) => (_jsx("li", { className: "h-full min-w-0 flex-1", children: _jsxs("span", { role: "img", "aria-label": spamDayDescription(day), className: "flex h-full flex-col justify-end", children: [_jsx("span", { className: cn("w-full rounded-t-sm", colours.warned), style: { height: `${(day.warned / peak) * 100}%` } }), _jsx("span", { className: cn("w-full", colours.moved), style: { height: `${(day.moved / peak) * 100}%` } })] }) }, day.date))) }), first && last && (_jsxs("div", { "aria-hidden": "true", className: "mt-1 flex justify-between text-2xs text-fg-subtle tabular-nums", children: [_jsx("span", { children: first.date }), _jsx("span", { children: last.date })] }))] }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RemitImapSpamChecked, RemitImapSpamFailed, RemitImapSpamThresholdsSet } from "@remit/api-http-client/types.gen.ts";
|
|
2
|
+
import type { CheckAgainFailure } from "./check-again-panel.js";
|
|
3
|
+
import type { LabelChipData } from "./label-chip.js";
|
|
4
|
+
import type { SpamDay } from "./spam-daily-chart.js";
|
|
5
|
+
export declare const spamThresholdsFixture: RemitImapSpamThresholdsSet;
|
|
6
|
+
export declare const spamLabelFixture: LabelChipData;
|
|
7
|
+
export declare const phishingLabelFixture: LabelChipData;
|
|
8
|
+
export declare const warnSpamVerdict: RemitImapSpamChecked;
|
|
9
|
+
export declare const warnPhishingVerdict: RemitImapSpamChecked;
|
|
10
|
+
export declare const junkPhishingVerdict: RemitImapSpamChecked;
|
|
11
|
+
export declare const modelSkippedVerdict: RemitImapSpamChecked;
|
|
12
|
+
export declare const modelJudgedVerdict: RemitImapSpamChecked;
|
|
13
|
+
export declare const nowJunkVerdict: RemitImapSpamChecked;
|
|
14
|
+
export declare const warnOnlyAboveJunkVerdict: RemitImapSpamChecked;
|
|
15
|
+
export declare const unknownReasonVerdict: RemitImapSpamChecked;
|
|
16
|
+
export declare const failedVerdict: RemitImapSpamFailed;
|
|
17
|
+
export declare const checkAgainFailuresFixture: CheckAgainFailure[];
|
|
18
|
+
export declare const spamDaysFixture: SpamDay[];
|
|
19
|
+
export declare const phishingDaysFixture: SpamDay[];
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export const spamThresholdsFixture = {
|
|
2
|
+
state: "Set",
|
|
3
|
+
cleanBelow: 0.4,
|
|
4
|
+
spamAt: 0.85,
|
|
5
|
+
};
|
|
6
|
+
export const spamLabelFixture = {
|
|
7
|
+
labelId: "label-spam",
|
|
8
|
+
name: "Spam",
|
|
9
|
+
color: "Orange",
|
|
10
|
+
};
|
|
11
|
+
export const phishingLabelFixture = {
|
|
12
|
+
labelId: "label-phishing",
|
|
13
|
+
name: "Phishing",
|
|
14
|
+
color: "Red",
|
|
15
|
+
};
|
|
16
|
+
const reason = (name, score, options = []) => ({ name, symbol: name, score, options });
|
|
17
|
+
export const warnSpamVerdict = {
|
|
18
|
+
state: "Checked",
|
|
19
|
+
score: 0.72,
|
|
20
|
+
action: "Warn",
|
|
21
|
+
kind: "Spam",
|
|
22
|
+
modelOutcome: "OutOfBand",
|
|
23
|
+
reasons: [
|
|
24
|
+
reason("LinkTextMismatch", 0.3, ["bank.example -> login-check.example"]),
|
|
25
|
+
reason("FirstContactDomain", 0.25, ["sender-domain.example"]),
|
|
26
|
+
reason("ProviderSpam", 0.17),
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
export const warnPhishingVerdict = {
|
|
30
|
+
state: "Checked",
|
|
31
|
+
score: 0.68,
|
|
32
|
+
action: "Warn",
|
|
33
|
+
kind: "Phishing",
|
|
34
|
+
modelOutcome: "OutOfBand",
|
|
35
|
+
reasons: [
|
|
36
|
+
reason("DisplayNameForeignAddress", 0.4, [
|
|
37
|
+
'"support@bank.example" <x@other.example>',
|
|
38
|
+
]),
|
|
39
|
+
reason("DmarcFail", 0.28),
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
export const junkPhishingVerdict = {
|
|
43
|
+
...warnPhishingVerdict,
|
|
44
|
+
score: 0.93,
|
|
45
|
+
action: "Junk",
|
|
46
|
+
};
|
|
47
|
+
export const modelSkippedVerdict = {
|
|
48
|
+
...warnSpamVerdict,
|
|
49
|
+
modelOutcome: "DailyLimit",
|
|
50
|
+
};
|
|
51
|
+
export const modelJudgedVerdict = {
|
|
52
|
+
state: "Checked",
|
|
53
|
+
score: 0.61,
|
|
54
|
+
action: "Warn",
|
|
55
|
+
kind: "Spam",
|
|
56
|
+
modelOutcome: "Answered",
|
|
57
|
+
reasons: [
|
|
58
|
+
reason("RecentlyRegisteredDomain", 0.35, ["registered 2026-11-02"]),
|
|
59
|
+
reason("ModelSpam", 0.2, [
|
|
60
|
+
"It pushes a payment link from a domain registered last week.",
|
|
61
|
+
]),
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
export const nowJunkVerdict = {
|
|
65
|
+
...warnSpamVerdict,
|
|
66
|
+
score: 0.88,
|
|
67
|
+
action: "Junk",
|
|
68
|
+
};
|
|
69
|
+
export const warnOnlyAboveJunkVerdict = {
|
|
70
|
+
state: "Checked",
|
|
71
|
+
score: 0.9,
|
|
72
|
+
action: "Warn",
|
|
73
|
+
kind: "Spam",
|
|
74
|
+
modelOutcome: "Answered",
|
|
75
|
+
reasons: [
|
|
76
|
+
reason("LinkTextMismatch", 0.5, ["bank.example -> login-check.example"]),
|
|
77
|
+
reason("FirstContactDomain", 0.4, ["sender-domain.example"]),
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
export const unknownReasonVerdict = {
|
|
81
|
+
state: "Checked",
|
|
82
|
+
score: 0.55,
|
|
83
|
+
action: "Warn",
|
|
84
|
+
kind: "Spam",
|
|
85
|
+
modelOutcome: "Answered",
|
|
86
|
+
reasons: [
|
|
87
|
+
reason("ProviderSpam", 0.3),
|
|
88
|
+
{
|
|
89
|
+
name: "BackendSymbol",
|
|
90
|
+
symbol: "MIME_HTML_ONLY",
|
|
91
|
+
score: 0.25,
|
|
92
|
+
options: [],
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
export const failedVerdict = {
|
|
97
|
+
state: "Failed",
|
|
98
|
+
kind: "TimedOut",
|
|
99
|
+
};
|
|
100
|
+
export const checkAgainFailuresFixture = [
|
|
101
|
+
{
|
|
102
|
+
messageId: "m-1",
|
|
103
|
+
subject: "Subject line",
|
|
104
|
+
code: "RateLimited",
|
|
105
|
+
retryable: true,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
messageId: "m-2",
|
|
109
|
+
subject: "Subject line",
|
|
110
|
+
code: "RateLimited",
|
|
111
|
+
retryable: true,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
messageId: "m-3",
|
|
115
|
+
subject: "Subject line",
|
|
116
|
+
code: "DailyCap",
|
|
117
|
+
retryable: true,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
messageId: "m-4",
|
|
121
|
+
subject: "Subject line",
|
|
122
|
+
code: "NotFound",
|
|
123
|
+
retryable: false,
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
127
|
+
const LAST_DAY = Date.UTC(2026, 10, 13);
|
|
128
|
+
const isoDay = (offset) => new Date(LAST_DAY - offset * DAY_MS).toISOString().slice(0, 10);
|
|
129
|
+
const spamPattern = [3, 5, 2, 6, 4, 1, 0, 4, 7, 3, 5, 2, 3, 6, 4];
|
|
130
|
+
const phishingPattern = [0, 1, 0, 0, 2, 0, 1, 0, 0, 1, 0, 0, 2, 0, 1];
|
|
131
|
+
export const spamDaysFixture = Array.from({ length: 30 }, (_, i) => {
|
|
132
|
+
const n = spamPattern[i % spamPattern.length] ?? 0;
|
|
133
|
+
return {
|
|
134
|
+
date: isoDay(29 - i),
|
|
135
|
+
moved: n,
|
|
136
|
+
warned: Math.ceil(n / 2),
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
export const phishingDaysFixture = Array.from({ length: 30 }, (_, i) => ({
|
|
140
|
+
date: isoDay(29 - i),
|
|
141
|
+
moved: phishingPattern[i % phishingPattern.length] ?? 0,
|
|
142
|
+
warned: i % 7 === 3 ? 1 : 0,
|
|
143
|
+
}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type LabelChipData } from "./label-chip.js";
|
|
2
|
+
export interface SpamRowMarkerProps {
|
|
3
|
+
label: LabelChipData;
|
|
4
|
+
/** The message still sits where it arrived, under the warning. */
|
|
5
|
+
suspected: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A thread row's one spam mark: the Remit label chip, then an outlined
|
|
9
|
+
* Suspected marker while the message sits outside Spam. A row in Spam shows
|
|
10
|
+
* the chip alone, because the folder already says it moved.
|
|
11
|
+
*/
|
|
12
|
+
export declare function SpamRowMarker({ label, suspected }: SpamRowMarkerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LabelChip } from "./label-chip.js";
|
|
3
|
+
/**
|
|
4
|
+
* A thread row's one spam mark: the Remit label chip, then an outlined
|
|
5
|
+
* Suspected marker while the message sits outside Spam. A row in Spam shows
|
|
6
|
+
* the chip alone, because the folder already says it moved.
|
|
7
|
+
*/
|
|
8
|
+
export function SpamRowMarker({ label, suspected }) {
|
|
9
|
+
return (_jsxs("span", { className: "inline-flex shrink-0 items-center gap-1", children: [_jsx("span", { className: "sr-only", children: suspected ? `${label.name}, suspected` : label.name }), _jsxs("span", { "aria-hidden": "true", className: "inline-flex items-center gap-1", children: [_jsx(LabelChip, { label: label, className: "max-w-20" }), suspected && (_jsx("span", { className: "rounded-full border border-warning/60 px-1.5 text-2xs font-medium leading-4 text-warning", children: "Suspected" }))] })] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { RemitImapSpamChecked, RemitImapSpamFailed, RemitImapSpamLabelPlacement, RemitImapSpamThresholds, RemitImapSpamVerdictScreenedOut } from "@remit/api-http-client/types.gen.ts";
|
|
2
|
+
import type { ReactElement, ReactNode } from "react";
|
|
3
|
+
import type { LabelChipData } from "./label-chip.js";
|
|
4
|
+
export declare const SPAM_CHECK_HEADING_ID = "spam-check-heading";
|
|
5
|
+
/** Where a link in the Spam check section goes; the host maps it to a route. */
|
|
6
|
+
export type SpamVerdictLinkTarget = {
|
|
7
|
+
kind: "SpamSettings";
|
|
8
|
+
} | {
|
|
9
|
+
kind: "NeverInSpamSenders";
|
|
10
|
+
} | {
|
|
11
|
+
kind: "Filter";
|
|
12
|
+
filterId: string;
|
|
13
|
+
};
|
|
14
|
+
export interface SpamVerdictLinkProps {
|
|
15
|
+
target: SpamVerdictLinkTarget;
|
|
16
|
+
className: string;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/** Renders an in-app link, so following it is a navigation, not a reload. */
|
|
20
|
+
export type SpamVerdictLinkComponent = (props: SpamVerdictLinkProps) => ReactElement;
|
|
21
|
+
export interface SpamVerdictPanelProps {
|
|
22
|
+
verdict: RemitImapSpamChecked | RemitImapSpamFailed | RemitImapSpamVerdictScreenedOut;
|
|
23
|
+
/** The Remit label the message carries, when it carries one. */
|
|
24
|
+
label?: LabelChipData;
|
|
25
|
+
thresholds: RemitImapSpamThresholds;
|
|
26
|
+
placement: RemitImapSpamLabelPlacement;
|
|
27
|
+
filterName?: string;
|
|
28
|
+
linkComponent: SpamVerdictLinkComponent;
|
|
29
|
+
reportIssueHref: (symbol: string) => string;
|
|
30
|
+
onNotSpam: () => void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The intelligence rail's Spam check section: what the check concluded, the
|
|
34
|
+
* score against the thresholds, and one sentence per reason. Why on the
|
|
35
|
+
* banner focuses its heading by {@link SPAM_CHECK_HEADING_ID}.
|
|
36
|
+
*/
|
|
37
|
+
export declare function SpamVerdictPanel(props: SpamVerdictPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import { IntelligenceSection } from "./intelligence-section.js";
|
|
5
|
+
import { BASIC_CHECKS_ONLY, CHECK_FAILED_HEADLINE, filterScreenSentence, formatSpamScore, isModelReason, modelSaid, modelSkipCause, SPAM_FAILURE_SENTENCES, SPAM_SCREEN_SENTENCES, SPAM_WARN_HEADLINES, spamReasonSentence, spamScoreSentence, UNKNOWN_REASON_SENTENCE, } from "./spam-copy.js";
|
|
6
|
+
import { SpamRowMarker } from "./spam-row-marker.js";
|
|
7
|
+
export const SPAM_CHECK_HEADING_ID = "spam-check-heading";
|
|
8
|
+
const LINK = "text-accent-2 hover:underline";
|
|
9
|
+
function Section({ children }) {
|
|
10
|
+
return (_jsx(IntelligenceSection, { label: "Spam check", headingId: SPAM_CHECK_HEADING_ID, children: _jsx("div", { className: "space-y-2 text-sm", children: children }) }));
|
|
11
|
+
}
|
|
12
|
+
function Headline({ children }) {
|
|
13
|
+
return _jsx("p", { className: "font-semibold text-fg", children: children });
|
|
14
|
+
}
|
|
15
|
+
function ScoreBar({ score, thresholds, }) {
|
|
16
|
+
const at = (value) => `${Math.min(100, Math.max(0, value * 100))}%`;
|
|
17
|
+
return (_jsxs("div", { "aria-hidden": "true", className: "pt-4 pb-1", children: [_jsxs("div", { className: "relative h-1.5 rounded-full bg-surface-sunken", children: [_jsx("div", { className: "absolute inset-y-0 rounded-r-full bg-warning/30", style: { left: at(thresholds.cleanBelow), right: 0 } }), _jsx("div", { className: "absolute inset-y-0 rounded-r-full bg-danger/30", style: { left: at(thresholds.spamAt), right: 0 } }), [
|
|
18
|
+
{ key: "warn", value: thresholds.cleanBelow, text: "Warn" },
|
|
19
|
+
{ key: "junk", value: thresholds.spamAt, text: "Spam" },
|
|
20
|
+
].map((mark) => (_jsx("span", { className: "absolute -top-4 -translate-x-1/2 text-2xs text-fg-subtle tabular-nums", style: { left: at(mark.value) }, children: `${mark.text} ${formatSpamScore(mark.value)}` }, mark.key))), _jsx("span", { className: "absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-surface bg-fg", style: { left: at(score) } })] }), _jsxs("div", { className: "mt-1 flex justify-between text-2xs text-fg-subtle tabular-nums", children: [_jsx("span", { children: "0" }), _jsx("span", { children: "1" })] })] }));
|
|
21
|
+
}
|
|
22
|
+
function Finding({ text }) {
|
|
23
|
+
return (_jsx("code", { className: "mt-0.5 inline-block max-w-full break-all rounded bg-surface-sunken px-1.5 py-0.5 font-mono text-2xs text-fg-muted", children: text }));
|
|
24
|
+
}
|
|
25
|
+
function ReasonItem({ reason, reportIssueHref, }) {
|
|
26
|
+
const sentence = spamReasonSentence(reason.name);
|
|
27
|
+
if (!sentence) {
|
|
28
|
+
return (_jsxs("li", { children: [_jsx("p", { className: "text-fg", children: UNKNOWN_REASON_SENTENCE }), _jsx(Finding, { text: reason.symbol }), _jsx("a", { href: reportIssueHref(reason.symbol), target: "_blank", rel: "noopener noreferrer", className: cn("ml-2 text-xs", LINK), children: "Report an issue" })] }));
|
|
29
|
+
}
|
|
30
|
+
return (_jsxs("li", { children: [_jsx("p", { className: "text-fg", children: sentence }), reason.options.length > 0 && (_jsx(Finding, { text: reason.options.join(", ") }))] }));
|
|
31
|
+
}
|
|
32
|
+
function CheckedVerdict({ verdict, label, thresholds, placement, linkComponent: Link, reportIssueHref, }) {
|
|
33
|
+
const said = modelSaid(verdict);
|
|
34
|
+
const skipped = modelSkipCause(verdict);
|
|
35
|
+
const headline = verdict.action === "Junk"
|
|
36
|
+
? "Remit moved this to Spam"
|
|
37
|
+
: verdict.action === "Warn"
|
|
38
|
+
? SPAM_WARN_HEADLINES[verdict.kind]
|
|
39
|
+
: "Remit found too little to act on";
|
|
40
|
+
const keptByWarnOnly = verdict.action !== "None" &&
|
|
41
|
+
placement === "WarnOnly" &&
|
|
42
|
+
thresholds.state === "Set" &&
|
|
43
|
+
verdict.score >= thresholds.spamAt;
|
|
44
|
+
return (_jsxs(Section, { children: [_jsx(Headline, { children: headline }), label && verdict.action !== "None" && (_jsx(SpamRowMarker, { label: label, suspected: verdict.action === "Warn" })), _jsx("p", { className: "text-fg-muted", children: spamScoreSentence(verdict.score, thresholds) }), thresholds.state === "Set" && (_jsx(ScoreBar, { score: verdict.score, thresholds: thresholds })), _jsxs("div", { children: [_jsx("h4", { className: "text-xs font-semibold text-fg", children: "Why" }), _jsx("ul", { className: "mt-1 list-disc space-y-1.5 pl-4 marker:text-fg-subtle", children: verdict.reasons
|
|
45
|
+
.filter((reason) => !isModelReason(reason))
|
|
46
|
+
.map((reason) => (_jsx(ReasonItem, { reason: reason, reportIssueHref: reportIssueHref }, reason.symbol))) })] }), said !== undefined && (_jsxs("div", { className: "text-fg-muted", children: [_jsx("p", { children: "Remit asked the model. It said:" }), _jsx("blockquote", { className: "mt-0.5 border-l-2 border-line pl-2 italic", children: said })] })), skipped !== undefined && (_jsx("p", { className: "text-fg-muted", children: `${BASIC_CHECKS_ONLY}: ${skipped}` })), keptByWarnOnly && (_jsxs("p", { className: "text-fg-muted", children: ["The score reached your Spam threshold. Spam is set to Warn only, so it stays here.", " ", _jsx(Link, { target: { kind: "SpamSettings" }, className: LINK, children: "Change in Spam & phishing settings" })] }))] }));
|
|
47
|
+
}
|
|
48
|
+
function ScreenedOutVerdict({ verdict, label, filterName, linkComponent: Link, onNotSpam, }) {
|
|
49
|
+
const { screen } = verdict;
|
|
50
|
+
if (screen.rule === "ReportedSender") {
|
|
51
|
+
return (_jsxs(Section, { children: [_jsx(Headline, { children: "You reported this sender" }), label && _jsx(SpamRowMarker, { label: label, suspected: false }), _jsx("p", { className: "text-fg-muted", children: "Remit sent their mail to Spam without checking it." }), _jsx(Button, { variant: "secondary", size: "md", onClick: onNotSpam, children: "Not spam" })] }));
|
|
52
|
+
}
|
|
53
|
+
if (screen.rule === "Filter") {
|
|
54
|
+
return (_jsxs(Section, { children: [_jsx(Headline, { children: "Remit skipped the spam check" }), _jsx("p", { className: "text-fg-muted", children: filterName
|
|
55
|
+
? filterScreenSentence(filterName)
|
|
56
|
+
: "One of your filters matched it." }), _jsx(Link, { target: { kind: "Filter", filterId: screen.filterId }, className: LINK, children: "Open the filter in Settings" })] }));
|
|
57
|
+
}
|
|
58
|
+
return (_jsxs(Section, { children: [_jsx(Headline, { children: "Remit skipped the spam check" }), _jsx("p", { className: "text-fg-muted", children: SPAM_SCREEN_SENTENCES[screen.rule] }), screen.rule === "NeverSpam" && (_jsx(Link, { target: { kind: "NeverInSpamSenders" }, className: LINK, children: "Manage in Senders & Rules" }))] }));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The intelligence rail's Spam check section: what the check concluded, the
|
|
62
|
+
* score against the thresholds, and one sentence per reason. Why on the
|
|
63
|
+
* banner focuses its heading by {@link SPAM_CHECK_HEADING_ID}.
|
|
64
|
+
*/
|
|
65
|
+
export function SpamVerdictPanel(props) {
|
|
66
|
+
const { verdict } = props;
|
|
67
|
+
if (verdict.state === "ScreenedOut") {
|
|
68
|
+
return _jsx(ScreenedOutVerdict, { ...props, verdict: verdict });
|
|
69
|
+
}
|
|
70
|
+
if (verdict.state === "Failed") {
|
|
71
|
+
return (_jsxs(Section, { children: [_jsx(Headline, { children: CHECK_FAILED_HEADLINE }), _jsx("p", { className: "text-fg-muted", children: `The spam check failed: ${SPAM_FAILURE_SENTENCES[verdict.kind]}.` })] }));
|
|
72
|
+
}
|
|
73
|
+
return _jsx(CheckedVerdict, { ...props, verdict: verdict });
|
|
74
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RemitImapRescanFailureCode, RemitImapSpamChecked, RemitImapSpamFailed } from "@remit/api-http-client/types.gen.ts";
|
|
2
|
+
export type SpamWarningPending = "NotSpam" | "Report" | "Move" | "CheckAgain";
|
|
3
|
+
export interface SpamWarningBannerProps {
|
|
4
|
+
verdict: RemitImapSpamChecked | RemitImapSpamFailed;
|
|
5
|
+
inSpamFolder: boolean;
|
|
6
|
+
pending?: SpamWarningPending;
|
|
7
|
+
checkAgainFailure?: RemitImapRescanFailureCode;
|
|
8
|
+
onNotSpam: () => void;
|
|
9
|
+
onReport: () => void;
|
|
10
|
+
onMove: () => void;
|
|
11
|
+
onWhy: () => void;
|
|
12
|
+
onCheckAgain: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The message view's one banner slot, between the header and the body. The
|
|
16
|
+
* verdict decides what it says: a failed check, a Check again that now reaches
|
|
17
|
+
* Spam for a message outside it, or a warning. It has no close control; it
|
|
18
|
+
* goes when its verdict goes.
|
|
19
|
+
*/
|
|
20
|
+
export declare function SpamWarningBanner({ verdict, inSpamFolder, pending, checkAgainFailure, onNotSpam, onReport, onMove, onWhy, onCheckAgain, }: SpamWarningBannerProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { CircleQuestionMark, ShieldAlert, TriangleAlert } from "../icons.js";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { Banner } from "./banner.js";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { BASIC_CHECKS_ONLY, CHECK_AGAIN_FAILURE_SENTENCES, CHECK_FAILED_HEADLINE, formatSpamScore, modelSkipCause, SPAM_FAILURE_SENTENCES, SPAM_WARN_HEADLINES, topSpamReasonSentence, } from "./spam-copy.js";
|
|
7
|
+
const PENDING_LABELS = {
|
|
8
|
+
NotSpam: "Removing label...",
|
|
9
|
+
Report: "Reporting...",
|
|
10
|
+
Move: "Moving...",
|
|
11
|
+
CheckAgain: "Checking...",
|
|
12
|
+
};
|
|
13
|
+
const ACTION_BUTTON = "h-10";
|
|
14
|
+
function BannerAction({ label, pending, busy, onClick, variant = "secondary", disabled = false, }) {
|
|
15
|
+
const pressed = pending === busy;
|
|
16
|
+
const blocked = pending !== undefined || disabled;
|
|
17
|
+
return (_jsx(Button, { variant: variant, size: "md", className: cn(ACTION_BUTTON, blocked && "pointer-events-none opacity-60"), "aria-disabled": blocked || undefined, "aria-busy": pressed || undefined, onClick: blocked ? undefined : onClick, children: pressed ? PENDING_LABELS[busy] : label }));
|
|
18
|
+
}
|
|
19
|
+
function WhyButton({ onWhy }) {
|
|
20
|
+
return (_jsx(Button, { variant: "ghost", size: "md", className: ACTION_BUTTON, onClick: onWhy, children: "Why" }));
|
|
21
|
+
}
|
|
22
|
+
function BannerBody({ tone, icon, headline, lines, actions, role, }) {
|
|
23
|
+
return (_jsx(Banner, { tone: tone, variant: "soft", role: role, className: "rounded-none border-b border-line px-5 py-3", children: _jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "mt-0.5 shrink-0", "aria-hidden": "true", children: icon }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "font-semibold text-fg", children: headline }), lines.map((line) => (_jsx("p", { className: "mt-0.5 text-fg-muted", children: line }, line))), _jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: actions })] })] }) }));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The message view's one banner slot, between the header and the body. The
|
|
27
|
+
* verdict decides what it says: a failed check, a Check again that now reaches
|
|
28
|
+
* Spam for a message outside it, or a warning. It has no close control; it
|
|
29
|
+
* goes when its verdict goes.
|
|
30
|
+
*/
|
|
31
|
+
export function SpamWarningBanner({ verdict, inSpamFolder, pending, checkAgainFailure, onNotSpam, onReport, onMove, onWhy, onCheckAgain, }) {
|
|
32
|
+
if (verdict.state === "Failed") {
|
|
33
|
+
return (_jsx(BannerBody, { tone: "info", role: "status", icon: _jsx(CircleQuestionMark, { className: "size-4 text-accent-2" }), headline: CHECK_FAILED_HEADLINE, lines: [
|
|
34
|
+
`The spam check failed: ${SPAM_FAILURE_SENTENCES[verdict.kind]}. No label was added.`,
|
|
35
|
+
...(checkAgainFailure
|
|
36
|
+
? [
|
|
37
|
+
`Check again didn't finish: ${CHECK_AGAIN_FAILURE_SENTENCES[checkAgainFailure]}`,
|
|
38
|
+
]
|
|
39
|
+
: []),
|
|
40
|
+
], actions: _jsx(BannerAction, { label: "Check again", pending: pending, busy: "CheckAgain", disabled: checkAgainFailure === "DailyCap", onClick: onCheckAgain }) }));
|
|
41
|
+
}
|
|
42
|
+
if (verdict.action === "None")
|
|
43
|
+
return null;
|
|
44
|
+
if (verdict.action === "Junk" && inSpamFolder)
|
|
45
|
+
return null;
|
|
46
|
+
const phishing = verdict.kind === "Phishing";
|
|
47
|
+
const skipped = modelSkipCause(verdict);
|
|
48
|
+
const tone = phishing ? "danger" : "warning";
|
|
49
|
+
const role = phishing ? "alert" : "status";
|
|
50
|
+
const icon = phishing ? (_jsx(ShieldAlert, { className: "size-4 text-danger" })) : (_jsx(TriangleAlert, { className: "size-4 text-warning" }));
|
|
51
|
+
if (verdict.action === "Junk") {
|
|
52
|
+
return (_jsx(BannerBody, { tone: tone, role: role, icon: icon, headline: phishing
|
|
53
|
+
? "Remit now judges this phishing"
|
|
54
|
+
: "Remit now judges this spam", lines: [
|
|
55
|
+
`Check again scored it ${formatSpamScore(verdict.score)}, past your Move to Spam threshold. It stays here until you move it.`,
|
|
56
|
+
], actions: _jsxs(_Fragment, { children: [_jsx(BannerAction, { label: "Move to Spam", variant: "primary", pending: pending, busy: "Move", onClick: onMove }), _jsx(BannerAction, { label: "Not spam", pending: pending, busy: "NotSpam", onClick: onNotSpam }), _jsx(WhyButton, { onWhy: onWhy })] }) }));
|
|
57
|
+
}
|
|
58
|
+
return (_jsx(BannerBody, { tone: tone, role: role, icon: icon, headline: SPAM_WARN_HEADLINES[verdict.kind], lines: [
|
|
59
|
+
topSpamReasonSentence(verdict.reasons),
|
|
60
|
+
...(skipped ? [`${BASIC_CHECKS_ONLY}: ${skipped}`] : []),
|
|
61
|
+
], actions: _jsxs(_Fragment, { children: [_jsx(BannerAction, { label: "Not spam", pending: pending, busy: "NotSpam", onClick: onNotSpam }), _jsx(BannerAction, { label: "Report spam", pending: pending, busy: "Report", onClick: onReport }), _jsx(WhyButton, { onWhy: onWhy })] }) }));
|
|
62
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { NextUpCard, type NextUpCardProps, } from "./components/agenda-panels.js
|
|
|
11
11
|
export { AppChrome, type AppChromeProps } from "./components/app-chrome.js";
|
|
12
12
|
export { AppPasswordHint, type AppPasswordHintProps, } from "./components/app-password-hint.js";
|
|
13
13
|
export { type AppShellLayoutContext, AppShellSlotted, type AppShellSlottedProps, useAppShellLayout, } from "./components/app-shell-slotted.js";
|
|
14
|
-
export { type AppShellProps, type Density, INTELLIGENCE_MIN_WIDTH, type MessageListKeyboard, type MessageListSelection, type NarrowView, type NavAccount, type NavAccountStatus, type NavLabel, type NavLinkComponent, type NavLinkRenderProps, type NavMailbox, type NavMailboxRole, type PaneLayout, READING_PANE_MIN_WIDTH, resolvePaneLayout, type ThreadData, type ThreadMessageData, type ThreadRowData, type ThreadSection, type TouchSeed, useContainerWidth, } from "./components/app-shell-types.js";
|
|
14
|
+
export { type AppShellProps, type Density, INTELLIGENCE_MIN_WIDTH, type MessageListKeyboard, type MessageListSelection, type NarrowView, type NavAccount, type NavAccountStatus, type NavLabel, type NavLinkComponent, type NavLinkRenderProps, type NavMailbox, type NavMailboxRole, type PaneLayout, READING_PANE_MIN_WIDTH, resolvePaneLayout, type ThreadData, type ThreadMessageData, type ThreadRowData, type ThreadRowSpam, type ThreadSection, type TouchSeed, useContainerWidth, } from "./components/app-shell-types.js";
|
|
15
15
|
export { AppBar, type AppId, type AppSwitcherProps, type AppSwitchItem, AppTabBar, } from "./components/app-switcher.js";
|
|
16
16
|
export { AppTopBar, type AppTopBarProps } from "./components/app-top-bar.js";
|
|
17
17
|
export { type AttachmentDownloadState, type AttachmentItem, type AttachmentKind, AttachmentList, type AttachmentListProps, } from "./components/attachment-list.js";
|
|
@@ -29,7 +29,7 @@ export { BottomSheet, type BottomSheetProps, } from "./components/bottom-sheet.j
|
|
|
29
29
|
export { BriefEmpty, type BriefEmptyProps, type BriefSyncProgress, } from "./components/brief-empty.js";
|
|
30
30
|
export { BriefSection, type BriefSectionProps, SECTION_ROW_CAP, } from "./components/brief-section.js";
|
|
31
31
|
export { type BriefCategoryControl, type BriefFilterControl, type BriefFilterSurface, BriefSections, type BriefSectionsProps, type BriefSourceControl, } from "./components/brief-sections.js";
|
|
32
|
-
export { Button, ButtonLink, type ButtonLinkProps, type ButtonProps, } from "./components/button.js";
|
|
32
|
+
export { Button, ButtonLink, type ButtonLinkProps, type ButtonProps, buttonClassName, } from "./components/button.js";
|
|
33
33
|
export { CalendarClashStrip, type CalendarClashStripProps, } from "./components/calendar-clash-strip.js";
|
|
34
34
|
export { CalendarEventChip, type CalendarEventChipProps, } from "./components/calendar-event-chip.js";
|
|
35
35
|
export { CalendarEventChipContent, type CalendarEventChipContentProps, } from "./components/calendar-event-chip-content.js";
|
|
@@ -55,6 +55,7 @@ export { type CalendarAttendee, type CalendarClash, type CalendarColorId, type C
|
|
|
55
55
|
export { CalendarYear, type CalendarYearProps, } from "./components/calendar-year.js";
|
|
56
56
|
export { Card, CardBody, CardHeader, type CardProps, CardTitle, } from "./components/card.js";
|
|
57
57
|
export { CategoryBadge, type CategoryBadgeProps, } from "./components/category-badge.js";
|
|
58
|
+
export { type CheckAgainFailure, type CheckAgainOutcome, CheckAgainPanel, type CheckAgainPanelProps, CheckAgainResultTag, type CheckAgainSummary, checkAgainSummarySentence, } from "./components/check-again-panel.js";
|
|
58
59
|
export { Checkbox, type CheckboxProps } from "./components/checkbox.js";
|
|
59
60
|
export { ComposeActionBar, type ComposeActionBarProps, type ComposeSaveState, type ComposeSendState, } from "./components/compose-action-bar.js";
|
|
60
61
|
export { type AddressEntry, type ComposeAddressCommit, ComposeAddressField, type ComposeAddressFieldHandle, type ComposeAddressFieldProps, type ParsedAddressInput, } from "./components/compose-address-field.js";
|
|
@@ -80,6 +81,7 @@ export type { AuthorDeclarations, EmailFrameVariant, } from "./components/email-
|
|
|
80
81
|
export { EventEditor, type EventEditorLayout, type EventEditorProps, endsBeforeStart, withAllDay, withStartDate, } from "./components/event-editor.js";
|
|
81
82
|
export { EventEditorPane, type EventEditorPaneProps, } from "./components/event-editor-pane.js";
|
|
82
83
|
export { EventSuggestionCard, type EventSuggestionCardProps, settleZone, ZONE_UNSETTLED_REASON, type ZoneSettlement, } from "./components/event-suggestion-card.js";
|
|
84
|
+
export { FailureBanner, type FailureBannerProps, } from "./components/failure-banner.js";
|
|
83
85
|
export { FieldLabel, type FieldLabelProps, } from "./components/field-label.js";
|
|
84
86
|
export { AddChipButton, type AddChipButtonProps, ClauseChip, type ClauseChipProps, type ClauseDraft, ClauseEditor, type ClauseEditorProps, } from "./components/filter-clause-chip.js";
|
|
85
87
|
export { FilterPreviewCount, type FilterPreviewCountProps, } from "./components/filter-preview-count.js";
|
|
@@ -97,7 +99,7 @@ export { FolderSyncBadge, type FolderSyncBadgeProps, type FolderSyncMailbox, typ
|
|
|
97
99
|
export { type FolderTreeNode, FolderTreePicker, type FolderTreePickerLabels, type FolderTreePickerProps, type FolderTreeRow, } from "./components/folder-tree-picker.js";
|
|
98
100
|
export { Input, type InputProps, type InputVariant, } from "./components/input.js";
|
|
99
101
|
export { type CalendarDayEntry, type CalendarInviteIntel, type CalendarProseIntel, type CalendarSuggestionIntel, IntelligenceCalendar, type IntelligenceCalendarActions, type IntelligenceCalendarData, type IntelligenceCalendarProps, } from "./components/intelligence-calendar.js";
|
|
100
|
-
export { type
|
|
102
|
+
export { type IntelligenceCalendarSurface, type IntelligenceData, IntelligencePanel, type IntelligencePanelProps, type IntelligenceQuickActions, type IntelligenceTabId, type SenderFlagsIntel, type SenderIntel, type SenderTrustLevel, type SpamQuickAction, } from "./components/intelligence-panel.js";
|
|
101
103
|
export type { PlacementIntel } from "./components/intelligence-placement.js";
|
|
102
104
|
export { IntelligenceSection } from "./components/intelligence-section.js";
|
|
103
105
|
export { IntelligenceToggle, type IntelligenceToggleProps, } from "./components/intelligence-toggle.js";
|
|
@@ -170,7 +172,12 @@ export { type SenderTrust, SenderTrustIndicator, type SenderTrustIndicatorProps,
|
|
|
170
172
|
export { AccountHealthCard, type AccountHealthCardProps, SenderFlagRow, type SenderFlagRowProps, type SettingsNavItem, SettingsShell, type SettingsShellProps, } from "./components/settings-screen.js";
|
|
171
173
|
export { type ShellSearchScope, ShellTopBar, type ShellTopBarProps, type ShellTopBarSearch, } from "./components/shell-top-bar.js";
|
|
172
174
|
export { SlidePanel, type SlidePanelProps, } from "./components/slide-panel.js";
|
|
175
|
+
export { BASIC_CHECKS_ONLY, CHECK_AGAIN_FAILURE_SENTENCES, CHECK_FAILED_HEADLINE, filterScreenSentence, formatSpamScore, isModelReason, MODEL_SKIP_CAUSES, modelSaid, modelSkipCause, spamReasonSentence, spamScoreSentence, topSpamReason, topSpamReasonSentence, UNKNOWN_REASON_SENTENCE, } from "./components/spam-copy.js";
|
|
176
|
+
export { SpamDailyChart, type SpamDailyChartProps, type SpamDay, spamDayDescription, } from "./components/spam-daily-chart.js";
|
|
173
177
|
export { SpamResultsOffer, type SpamResultsOfferProps, } from "./components/spam-results-offer.js";
|
|
178
|
+
export { SpamRowMarker, type SpamRowMarkerProps, } from "./components/spam-row-marker.js";
|
|
179
|
+
export { SPAM_CHECK_HEADING_ID, type SpamVerdictLinkComponent, type SpamVerdictLinkProps, type SpamVerdictLinkTarget, SpamVerdictPanel, type SpamVerdictPanelProps, } from "./components/spam-verdict-panel.js";
|
|
180
|
+
export { SpamWarningBanner, type SpamWarningBannerProps, type SpamWarningPending, } from "./components/spam-warning-banner.js";
|
|
174
181
|
export { type Suggestion, SuggestList, type SuggestListProps, } from "./components/suggest-list.js";
|
|
175
182
|
export { commitPeek, SwipeableRow, type SwipePeek, } from "./components/swipeable-row.js";
|
|
176
183
|
export { Switch, type SwitchProps } from "./components/switch.js";
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ export { BottomSheet, } from "./components/bottom-sheet.js";
|
|
|
29
29
|
export { BriefEmpty, } from "./components/brief-empty.js";
|
|
30
30
|
export { BriefSection, SECTION_ROW_CAP, } from "./components/brief-section.js";
|
|
31
31
|
export { BriefSections, } from "./components/brief-sections.js";
|
|
32
|
-
export { Button, ButtonLink, } from "./components/button.js";
|
|
32
|
+
export { Button, ButtonLink, buttonClassName, } from "./components/button.js";
|
|
33
33
|
export { CalendarClashStrip, } from "./components/calendar-clash-strip.js";
|
|
34
34
|
export { CalendarEventChip, } from "./components/calendar-event-chip.js";
|
|
35
35
|
export { CalendarEventChipContent, } from "./components/calendar-event-chip-content.js";
|
|
@@ -55,6 +55,7 @@ export { calendarColorIds, } from "./components/calendar-types.js";
|
|
|
55
55
|
export { CalendarYear, } from "./components/calendar-year.js";
|
|
56
56
|
export { Card, CardBody, CardHeader, CardTitle, } from "./components/card.js";
|
|
57
57
|
export { CategoryBadge, } from "./components/category-badge.js";
|
|
58
|
+
export { CheckAgainPanel, CheckAgainResultTag, checkAgainSummarySentence, } from "./components/check-again-panel.js";
|
|
58
59
|
export { Checkbox } from "./components/checkbox.js";
|
|
59
60
|
export { ComposeActionBar, } from "./components/compose-action-bar.js";
|
|
60
61
|
export { ComposeAddressField, } from "./components/compose-address-field.js";
|
|
@@ -79,6 +80,7 @@ export { ErrorState, formatErrorMessage } from "./components/ErrorState.js";
|
|
|
79
80
|
export { EventEditor, endsBeforeStart, withAllDay, withStartDate, } from "./components/event-editor.js";
|
|
80
81
|
export { EventEditorPane, } from "./components/event-editor-pane.js";
|
|
81
82
|
export { EventSuggestionCard, settleZone, ZONE_UNSETTLED_REASON, } from "./components/event-suggestion-card.js";
|
|
83
|
+
export { FailureBanner, } from "./components/failure-banner.js";
|
|
82
84
|
export { FieldLabel, } from "./components/field-label.js";
|
|
83
85
|
export { AddChipButton, ClauseChip, ClauseEditor, } from "./components/filter-clause-chip.js";
|
|
84
86
|
export { FilterPreviewCount, } from "./components/filter-preview-count.js";
|
|
@@ -168,7 +170,12 @@ export { SenderTrustIndicator, selectSenderTrustVariant, } from "./components/se
|
|
|
168
170
|
export { AccountHealthCard, SenderFlagRow, SettingsShell, } from "./components/settings-screen.js";
|
|
169
171
|
export { ShellTopBar, } from "./components/shell-top-bar.js";
|
|
170
172
|
export { SlidePanel, } from "./components/slide-panel.js";
|
|
173
|
+
export { BASIC_CHECKS_ONLY, CHECK_AGAIN_FAILURE_SENTENCES, CHECK_FAILED_HEADLINE, filterScreenSentence, formatSpamScore, isModelReason, MODEL_SKIP_CAUSES, modelSaid, modelSkipCause, spamReasonSentence, spamScoreSentence, topSpamReason, topSpamReasonSentence, UNKNOWN_REASON_SENTENCE, } from "./components/spam-copy.js";
|
|
174
|
+
export { SpamDailyChart, spamDayDescription, } from "./components/spam-daily-chart.js";
|
|
171
175
|
export { SpamResultsOffer, } from "./components/spam-results-offer.js";
|
|
176
|
+
export { SpamRowMarker, } from "./components/spam-row-marker.js";
|
|
177
|
+
export { SPAM_CHECK_HEADING_ID, SpamVerdictPanel, } from "./components/spam-verdict-panel.js";
|
|
178
|
+
export { SpamWarningBanner, } from "./components/spam-warning-banner.js";
|
|
172
179
|
export { SuggestList, } from "./components/suggest-list.js";
|
|
173
180
|
export { commitPeek, SwipeableRow, } from "./components/swipeable-row.js";
|
|
174
181
|
export { Switch } from "./components/switch.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remit/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.239",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css",
|
|
@@ -76,7 +76,8 @@
|
|
|
76
76
|
"react-dom": "^19",
|
|
77
77
|
"@types/react": "^19",
|
|
78
78
|
"@types/react-dom": "^19",
|
|
79
|
-
"@remit/domain-enums": "*"
|
|
79
|
+
"@remit/domain-enums": "*",
|
|
80
|
+
"@remit/api-http-client": "*"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
83
|
"@remit/test-dom": "*",
|