@remit/ui 0.0.221 → 0.0.223
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/package.json +14 -3
- package/src/components/DropdownMenu.tsx +100 -0
- package/src/components/EmptyState.tsx +11 -0
- package/src/components/ErrorBanner.render.test.ts +107 -0
- package/src/components/ErrorBanner.stories.tsx +132 -0
- package/src/components/ErrorBanner.tsx +122 -0
- package/src/components/ErrorBannerStack.tsx +34 -0
- package/src/components/ErrorState.render.test.ts +82 -0
- package/src/components/ErrorState.tsx +80 -0
- package/src/components/KeyboardShortcutsModal.tsx +111 -0
- package/src/components/account-service-change-dialog.render.test.ts +1 -41
- package/src/components/account-service-choice.render.test.ts +0 -26
- package/src/components/account-service-toggles.render.test.ts +0 -6
- package/src/components/address-display.render.test.ts +1 -38
- package/src/components/address-tag.render.test.ts +0 -11
- package/src/components/agenda-flow.reach.test.ts +0 -8
- package/src/components/agenda-flow.render.test.ts +0 -31
- package/src/components/agenda-panels.render.test.ts +0 -5
- package/src/components/app-shell-slotted.render.test.ts +0 -118
- package/src/components/attachment-list.render.test.ts +41 -24
- package/src/components/attachment-list.stories.tsx +67 -0
- package/src/components/attachment-list.tsx +112 -35
- package/src/components/attendee-row.render.test.ts +0 -41
- package/src/components/attention-dot.stories.tsx +46 -0
- package/src/components/attention-dot.tsx +23 -0
- package/src/components/banner.render.test.ts +0 -7
- package/src/components/bottom-sheet.render.test.ts +0 -42
- package/src/components/brief-section.render.test.ts +0 -13
- package/src/components/brief-sections.keyboard.test.ts +0 -13
- package/src/components/brief-sections.render.test.ts +0 -22
- package/src/components/calendar-clash-strip.render.test.ts +0 -19
- package/src/components/calendar-grid.render.test.ts +0 -79
- package/src/components/calendar-invite-card.render.test.ts +0 -19
- package/src/components/calendar-list.render.test.ts +0 -21
- package/src/components/calendar-slot-offers.render.test.ts +0 -24
- package/src/components/calendar-suggestion-deck.render.test.ts +0 -18
- package/src/components/calendar-toolbar.render.test.ts +1 -53
- package/src/components/category-badge.render.test.ts +1 -24
- package/src/components/compose-action-bar.render.test.ts +0 -5
- package/src/components/compose-attachments.render.test.ts +0 -38
- package/src/components/event-detail.render.test.ts +0 -27
- package/src/components/event-editor.render.test.ts +0 -4
- package/src/components/event-suggestion-card.render.test.ts +0 -61
- package/src/components/event-suggestion-card.zone-gate.test.ts +1 -7
- package/src/components/filter-clause-chip.tsx +1 -60
- package/src/components/filter-rule-editor.create.test.ts +0 -6
- package/src/components/filter-rule-editor.stories.tsx +24 -138
- package/src/components/filter-rule-editor.tsx +7 -93
- package/src/components/filter-rule.render.test.ts +9 -299
- package/src/components/filter-rule.ts +20 -85
- package/src/components/filter-sheet.render.test.ts +0 -7
- package/src/components/folder-manage-actions.render.test.ts +0 -13
- package/src/components/folder-manager.render.test.ts +0 -31
- package/src/components/folder-mutation-dialog.render.test.ts +0 -83
- package/src/components/folder-rename-dialog.render.test.ts +0 -14
- package/src/components/folder-row.render.test.ts +0 -30
- package/src/components/folder-sync-state.test.ts +0 -61
- package/src/components/folder-tree-picker.create.test.ts +0 -30
- package/src/components/folder-tree-picker.render.test.ts +0 -35
- package/src/components/intelligence-calendar-fixtures.ts +0 -2
- package/src/components/intelligence-calendar.render.test.ts +0 -4
- package/src/components/intelligence-panel.render.test.ts +1 -62
- package/src/components/intelligence-panel.stories.tsx +0 -76
- package/src/components/intelligence-panel.tab-strip.test.ts +0 -1
- package/src/components/intelligence-panel.tsx +6 -176
- package/src/components/intelligence-toggle.render.test.ts +0 -5
- package/src/components/isolated-email-frame.render.test.ts +0 -122
- package/src/components/isolated-email-frame.tsx +55 -3
- package/src/components/keyboard-hint-bar.render.test.ts +0 -7
- package/src/components/label-chip.render.test.ts +0 -28
- package/src/components/label-chip.tsx +1 -1
- package/src/components/mail-header.render.test.ts +0 -20
- package/src/components/mcp-connected-apps-page.stories.tsx +58 -0
- package/src/components/mcp-connected-apps-page.tsx +79 -0
- package/src/components/mcp-consent-page.stories.tsx +39 -0
- package/src/components/mcp-consent-page.tsx +47 -0
- package/src/components/mcp-device-page.stories.tsx +57 -0
- package/src/components/mcp-device-page.tsx +107 -0
- package/src/components/mcp-error-notice.stories.tsx +34 -0
- package/src/components/mcp-error-notice.tsx +23 -0
- package/src/components/mcp-error-page.stories.tsx +17 -0
- package/src/components/mcp-error-page.tsx +15 -0
- package/src/components/mcp-fixtures.ts +16 -0
- package/src/components/mcp-login-page.stories.tsx +37 -0
- package/src/components/mcp-login-page.tsx +58 -0
- package/src/components/mcp-page.stories.tsx +27 -0
- package/src/components/mcp-page.tsx +35 -0
- package/src/components/mcp-permission-list.stories.tsx +21 -0
- package/src/components/mcp-permission-list.tsx +22 -0
- package/src/components/message-body-view.render.test.ts +0 -21
- package/src/components/message-list-pane.brief-filter.test.ts +0 -6
- package/src/components/message-list-pane.render.test.ts +0 -54
- package/src/components/message-list-state.render.test.ts +0 -84
- package/src/components/{quarantine-bug-dialog.tsx → message-report-dialog.tsx} +9 -14
- package/src/components/message-row.render.test.ts +1 -98
- package/src/components/mobile-message-action-bar.render.test.ts +0 -59
- package/src/components/mobile-reading-pane.render.test.ts +0 -48
- package/src/components/mobile-reading-pane.stories.tsx +78 -0
- package/src/components/mobile-reading-pane.tsx +55 -41
- package/src/components/mobile-search-view.render.test.ts +0 -16
- package/src/components/mobile-search-view.stories.tsx +8 -11
- package/src/components/mobile-search-view.tsx +1 -1
- package/src/components/nav-sidebar.keyboard.test.ts +0 -8
- package/src/components/nav-sidebar.render.test.ts +2 -133
- package/src/components/new-folder-form.render.test.ts +0 -26
- package/src/components/outbox-row.render.test.ts +0 -9
- package/src/components/pane-layout.render.test.ts +0 -18
- package/src/components/plain-text-editor.mount.test.ts +0 -16
- package/src/components/popover-menu.render.test.ts +0 -11
- package/src/components/progress-bar.render.test.ts +0 -14
- package/src/components/quarantine-report.test.ts +0 -8
- package/src/components/quarantine-section.render.test.ts +16 -13
- package/src/components/quarantine-section.stories.tsx +11 -8
- package/src/components/reading-pane.render.test.ts +2 -106
- package/src/components/reading-pane.stories.tsx +3 -0
- package/src/components/refresh-button.render.test.ts +0 -9
- package/src/components/rescue-from-spam-flow.render.test.ts +0 -24
- package/src/components/rich-text-editor.mount.test.ts +0 -19
- package/src/components/rich-text-image-node.ts +11 -9
- package/src/components/role-appointment-list.render.test.ts +0 -49
- package/src/components/role-appointment-prompt.render.test.ts +0 -79
- package/src/components/row-actions.render.test.ts +0 -34
- package/src/components/search-bar.render.test.ts +0 -44
- package/src/components/search-chip-input.render.test.ts +0 -71
- package/src/components/search-conversion-notice.stories.tsx +0 -6
- package/src/components/search-conversion-notice.tsx +3 -9
- package/src/components/search-conversion.render.test.ts +0 -52
- package/src/components/search-conversion.ts +2 -18
- package/src/components/search-result-row.tsx +5 -26
- package/src/components/search-results.render.test.ts +0 -68
- package/src/components/search-results.stories.tsx +0 -30
- package/src/components/search-results.tsx +1 -1
- package/src/components/security-select.render.test.ts +1 -14
- package/src/components/selection-top-bar.render.test.ts +0 -180
- package/src/components/selection-wizard-fixtures.ts +0 -2
- package/src/components/selection-wizard.render.test.ts +7 -212
- package/src/components/selection-wizard.stories.tsx +24 -164
- package/src/components/selection-wizard.tsx +10 -86
- package/src/components/self-update.render.test.ts +0 -113
- package/src/components/sender-trust-indicator.render.test.ts +0 -30
- package/src/components/shell-top-bar.render.test.ts +0 -31
- package/src/components/shell-top-bar.stories.tsx +7 -0
- package/src/components/shell-top-bar.tsx +11 -2
- package/src/components/slide-panel.render.test.ts +0 -18
- package/src/components/suggest-list.render.test.ts +0 -6
- package/src/components/swipeable-row.gesture.test.ts +85 -40
- package/src/components/swipeable-row.render.test.ts +0 -7
- package/src/components/swipeable-row.stories.tsx +3 -2
- package/src/components/swipeable-row.tsx +65 -144
- package/src/components/sync-warning-fixtures.ts +22 -0
- package/src/components/sync-warning-report.ts +38 -0
- package/src/components/sync-warning-row.tsx +51 -0
- package/src/components/sync-warning-section.render.test.ts +19 -0
- package/src/components/sync-warning-section.stories.tsx +94 -0
- package/src/components/sync-warning-section.tsx +56 -0
- package/src/components/touch-list-body.render.test.ts +0 -29
- package/src/components/wizard.render.test.ts +0 -22
- package/src/filter-presets.test.ts +1 -107
- package/src/index.ts +40 -34
- package/src/lib/compose-language.test.ts +0 -11
- package/src/lib/email-render-treatment.test.ts +0 -21
- package/src/lib/keymap.test.ts +0 -32
- package/src/lib/property-prefill.ts +2 -2
- package/src/lib/search-rule.test.ts +0 -4
- package/src/lib/search-rule.ts +0 -9
- package/src/lib/sender-derivation.ts +3 -5
- package/src/lib/swipe-config.ts +11 -0
- package/src/lib/use-list-cursor.test.ts +0 -7
- package/src/lib/use-list-keyboard.test.ts +0 -14
- package/src/lib/use-long-press.test.ts +53 -36
- package/src/lib/use-long-press.ts +62 -56
- package/src/lib/use-modal-focus.test.ts +0 -20
- package/src/lib/use-selection.hook.test.ts +0 -13
- package/src/lib/use-selection.test.ts +0 -101
- package/src/lib/use-swipe-navigation.test.ts +162 -0
- package/src/lib/use-swipe-navigation.ts +90 -0
- package/src/lib/wizard-steps.test.ts +18 -79
- package/src/lib/wizard-steps.ts +27 -67
- package/src/mcp-pages.ts +36 -0
- package/src/category-presentation.test.ts +0 -76
- package/src/components/account-service-status.render.test.ts +0 -82
- package/src/components/app-password-hint.render.test.ts +0 -23
- package/src/components/app-top-bar.render.test.ts +0 -59
- package/src/components/auth-card.render.test.ts +0 -24
- package/src/components/auth-footer.render.test.ts +0 -17
- package/src/components/auth-hero.render.test.ts +0 -31
- package/src/components/auto-moved-badge.render.test.ts +0 -65
- package/src/components/button.render.test.ts +0 -29
- package/src/components/calendar-event-chip.render.test.ts +0 -67
- package/src/components/calendar-parse-badge.render.test.ts +0 -40
- package/src/components/checkbox.render.test.ts +0 -65
- package/src/components/compose-form-shell.render.test.ts +0 -106
- package/src/components/dialog.render.test.ts +0 -51
- package/src/components/field-label.render.test.ts +0 -16
- package/src/components/mail-action-toolbar.render.test.ts +0 -43
- package/src/components/nav-link-surface.render.test.ts +0 -126
- package/src/components/new-folder-action.render.test.ts +0 -44
- package/src/components/pane-header.render.test.ts +0 -22
- package/src/components/pull-to-refresh.render.test.ts +0 -46
- package/src/components/recurrence-scope-prompt.render.test.ts +0 -36
- package/src/components/rescue-banner.render.test.ts +0 -32
- package/src/components/rescue-candidate-row.render.test.ts +0 -68
- package/src/components/search-token-chip.render.test.ts +0 -42
- package/src/components/self-update-dot.tsx +0 -32
- package/src/components/settings-primitives.render.test.ts +0 -160
- package/src/lib/email-layout-clamp.test.ts +0 -139
- package/src/lib/label-color.test.ts +0 -25
- package/src/lib/semantic-off.ts +0 -20
- package/src/stories-viewport-globals.test.ts +0 -77
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useDrag } from "@use-gesture/react";
|
|
2
|
+
import type { FullGestureState } from "@use-gesture/vanilla";
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
type RefObject,
|
|
6
|
+
useEffect,
|
|
7
|
+
useRef,
|
|
8
|
+
useSyncExternalStore,
|
|
9
|
+
} from "react";
|
|
10
|
+
import { SWIPE_DRAG_CONFIG } from "./swipe-config.js";
|
|
11
|
+
|
|
12
|
+
export type SwipeDirection = "left" | "right";
|
|
13
|
+
|
|
14
|
+
export const SWIPE_EVENT = "remit:swipe";
|
|
15
|
+
|
|
16
|
+
export const SwipeSurface = createContext(false);
|
|
17
|
+
|
|
18
|
+
const ZOOMED_SCALE = 1.01;
|
|
19
|
+
|
|
20
|
+
export const releasedSwipe = (
|
|
21
|
+
state: FullGestureState<"drag">,
|
|
22
|
+
): SwipeDirection | null => {
|
|
23
|
+
const { event } = state;
|
|
24
|
+
if ("pointerType" in event && event.pointerType !== "touch") return null;
|
|
25
|
+
if (event.type !== "pointerup") return null;
|
|
26
|
+
const sign = state.swipe[0];
|
|
27
|
+
if (sign < 0) return "left";
|
|
28
|
+
if (sign > 0) return "right";
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const subscribeToZoom = (notify: () => void): (() => void) => {
|
|
33
|
+
const viewport = window.visualViewport;
|
|
34
|
+
viewport?.addEventListener("resize", notify);
|
|
35
|
+
return () => viewport?.removeEventListener("resize", notify);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const isZoomed = (): boolean =>
|
|
39
|
+
(window.visualViewport?.scale ?? 1) > ZOOMED_SCALE;
|
|
40
|
+
|
|
41
|
+
interface UseSwipeNavigationOptions {
|
|
42
|
+
onSwipeLeft?: () => void;
|
|
43
|
+
onSwipeRight?: () => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface SwipeNavigation {
|
|
47
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
48
|
+
bind: ReturnType<typeof useDrag>;
|
|
49
|
+
touchAction: "pan-y pinch-zoom" | "auto";
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const useSwipeNavigation = ({
|
|
54
|
+
onSwipeLeft,
|
|
55
|
+
onSwipeRight,
|
|
56
|
+
}: UseSwipeNavigationOptions): SwipeNavigation => {
|
|
57
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
58
|
+
const swipeEnabled = onSwipeLeft !== undefined || onSwipeRight !== undefined;
|
|
59
|
+
const zoomed = useSyncExternalStore(subscribeToZoom, isZoomed, () => false);
|
|
60
|
+
|
|
61
|
+
const go = (direction: SwipeDirection | null): void => {
|
|
62
|
+
if (direction === "left") onSwipeLeft?.();
|
|
63
|
+
if (direction === "right") onSwipeRight?.();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const bind = useDrag((state) => go(releasedSwipe(state)), {
|
|
67
|
+
...SWIPE_DRAG_CONFIG,
|
|
68
|
+
axis: "x",
|
|
69
|
+
enabled: swipeEnabled && !zoomed,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
const element = ref.current;
|
|
74
|
+
if (!element || !swipeEnabled || zoomed) return;
|
|
75
|
+
const onFrameSwipe = (event: Event) => {
|
|
76
|
+
if (!(event instanceof CustomEvent)) return;
|
|
77
|
+
const { detail } = event;
|
|
78
|
+
if (detail === "left" || detail === "right") go(detail);
|
|
79
|
+
};
|
|
80
|
+
element.addEventListener(SWIPE_EVENT, onFrameSwipe);
|
|
81
|
+
return () => element.removeEventListener(SWIPE_EVENT, onFrameSwipe);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
ref,
|
|
86
|
+
bind,
|
|
87
|
+
touchAction: swipeEnabled && !zoomed ? "pan-y pinch-zoom" : "auto",
|
|
88
|
+
enabled: swipeEnabled,
|
|
89
|
+
};
|
|
90
|
+
};
|
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
type RunState,
|
|
28
28
|
ruleRestrictionFor,
|
|
29
29
|
runCopy,
|
|
30
|
+
SAMPLE_EMPTY_COPY,
|
|
30
31
|
type StepId,
|
|
31
|
-
sampleEmptyCopy,
|
|
32
32
|
stepBlockedReason,
|
|
33
33
|
stepIndex,
|
|
34
34
|
stepLabel,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
} from "./wizard-steps.js";
|
|
43
43
|
|
|
44
44
|
const VERBS: Verb[] = ["delete", "move", "junk", "markRead", "organize"];
|
|
45
|
-
const MODES: MatchMode[] = ["selected", "
|
|
45
|
+
const MODES: MatchMode[] = ["selected", "properties", "escalated"];
|
|
46
46
|
const SCOPES: (RuleScope | undefined)[] = [
|
|
47
47
|
undefined,
|
|
48
48
|
"once",
|
|
@@ -63,11 +63,6 @@ describe("stepsFor — the step ids for every verb × match mode × scope", () =
|
|
|
63
63
|
"review",
|
|
64
64
|
"run",
|
|
65
65
|
]);
|
|
66
|
-
assert.deepEqual(stepsFor({ verb: "junk", mode: "similar" }), [
|
|
67
|
-
"match",
|
|
68
|
-
"review",
|
|
69
|
-
"run",
|
|
70
|
-
]);
|
|
71
66
|
assert.deepEqual(stepsFor({ verb: "markRead", mode: "properties" }), [
|
|
72
67
|
"match",
|
|
73
68
|
"properties",
|
|
@@ -105,7 +100,7 @@ describe("stepsFor — the step ids for every verb × match mode × scope", () =
|
|
|
105
100
|
["match", "folder", "rule", "review", "run"],
|
|
106
101
|
);
|
|
107
102
|
assert.deepEqual(
|
|
108
|
-
stepsFor({ verb: "organize", mode: "
|
|
103
|
+
stepsFor({ verb: "organize", mode: "selected", scope: "standing" }),
|
|
109
104
|
["match", "folder", "rule", "name", "review", "run"],
|
|
110
105
|
);
|
|
111
106
|
assert.deepEqual(
|
|
@@ -412,38 +407,19 @@ describe("stepBlockedReason", () => {
|
|
|
412
407
|
);
|
|
413
408
|
});
|
|
414
409
|
|
|
415
|
-
it("waits on no count where
|
|
410
|
+
it("waits on no count where the properties door never had one", () => {
|
|
416
411
|
assert.equal(stepBlockedReason("review", draft(), UNCOUNTED), undefined);
|
|
417
412
|
});
|
|
418
413
|
|
|
419
|
-
it("
|
|
420
|
-
// The clause was added on the property door, then the user went back and
|
|
421
|
-
// took "Similar to these". The widen is the matcher now and it reads
|
|
422
|
-
// bodies, so a one-off apply is fine — and the property step is not even in
|
|
423
|
-
// this step list, so a block here would name a clause on no reachable
|
|
424
|
-
// screen.
|
|
425
|
-
const clauses = [clause("HasWords", "boarding pass")];
|
|
426
|
-
const similar = draft({
|
|
427
|
-
clauses,
|
|
428
|
-
scope: "once",
|
|
429
|
-
widen: { anchorCount: 3 },
|
|
430
|
-
});
|
|
431
|
-
assert.equal(
|
|
432
|
-
stepsFor({ verb: "organize", mode: "similar", scope: "once" }).includes(
|
|
433
|
-
"properties",
|
|
434
|
-
),
|
|
435
|
-
false,
|
|
436
|
-
);
|
|
437
|
-
assert.deepEqual(unreadableDraftClauses(similar), []);
|
|
438
|
-
assert.equal(stepBlockedReason("rule", similar, UNCOUNTED), undefined);
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
it("holds a one-off apply again once the widen cannot be evaluated", () => {
|
|
414
|
+
it("holds a one-off apply with a clause the literal matcher cannot read", () => {
|
|
442
415
|
const blocked = draft({
|
|
443
416
|
clauses: [clause("HasWords", "boarding pass")],
|
|
444
417
|
scope: "once",
|
|
445
|
-
widen: { anchorCount: 3, inactive: true },
|
|
446
418
|
});
|
|
419
|
+
assert.deepEqual(
|
|
420
|
+
unreadableDraftClauses(blocked).map((c) => c.field),
|
|
421
|
+
["HasWords"],
|
|
422
|
+
);
|
|
447
423
|
assert.equal(
|
|
448
424
|
stepBlockedReason("rule", blocked, UNCOUNTED),
|
|
449
425
|
ruleBlockedCopy.bodyTextOnce,
|
|
@@ -452,7 +428,7 @@ describe("stepBlockedReason", () => {
|
|
|
452
428
|
|
|
453
429
|
it("refuses a standing rule the ticked-rows door built no predicate for", () => {
|
|
454
430
|
// The ticked rows are a list of ids, not a predicate: a rule saved through
|
|
455
|
-
// that door has no
|
|
431
|
+
// that door has no clause, so it matches nothing now and
|
|
456
432
|
// nothing later (#1193).
|
|
457
433
|
const ticked = draft({ scope: "standing", name: "Receipts" });
|
|
458
434
|
assert.equal(
|
|
@@ -473,7 +449,7 @@ describe("stepBlockedReason", () => {
|
|
|
473
449
|
);
|
|
474
450
|
});
|
|
475
451
|
|
|
476
|
-
it("takes
|
|
452
|
+
it("takes a clause as the predicate a saved rule needs", () => {
|
|
477
453
|
const named = { scope: "standing" as const, name: "Receipts" };
|
|
478
454
|
assert.equal(
|
|
479
455
|
stepBlockedReason(
|
|
@@ -483,23 +459,6 @@ describe("stepBlockedReason", () => {
|
|
|
483
459
|
),
|
|
484
460
|
undefined,
|
|
485
461
|
);
|
|
486
|
-
assert.equal(
|
|
487
|
-
stepBlockedReason(
|
|
488
|
-
"review",
|
|
489
|
-
draft({ ...named, widen: { anchorCount: 3 } }),
|
|
490
|
-
{ status: "ready", count: 3 },
|
|
491
|
-
),
|
|
492
|
-
undefined,
|
|
493
|
-
);
|
|
494
|
-
// A widen the probe could not evaluate is no matcher at all.
|
|
495
|
-
assert.equal(
|
|
496
|
-
stepBlockedReason(
|
|
497
|
-
"review",
|
|
498
|
-
draft({ ...named, widen: { anchorCount: 3, inactive: true } }),
|
|
499
|
-
{ status: "ready", count: 3 },
|
|
500
|
-
),
|
|
501
|
-
ruleBlockedCopy.noMatch,
|
|
502
|
-
);
|
|
503
462
|
});
|
|
504
463
|
|
|
505
464
|
it("leaves the one-off scopes to the door that already resolved them", () => {
|
|
@@ -754,8 +713,7 @@ describe("runCopy", () => {
|
|
|
754
713
|
|
|
755
714
|
describe("sample and door vocabulary", () => {
|
|
756
715
|
it("explains an empty sample rather than leaving it bare", () => {
|
|
757
|
-
assert.match(
|
|
758
|
-
assert.match(sampleEmptyCopy("notIndexed"), /isn't indexed yet/);
|
|
716
|
+
assert.match(SAMPLE_EMPTY_COPY, /Nothing matches/);
|
|
759
717
|
});
|
|
760
718
|
|
|
761
719
|
it("states what an escalated predicate covers instead of a door", () => {
|
|
@@ -767,10 +725,10 @@ describe("sample and door vocabulary", () => {
|
|
|
767
725
|
assert.match(ESCALATED_REVIEW_WARNING, /by the time it runs/);
|
|
768
726
|
});
|
|
769
727
|
|
|
770
|
-
it("withholds the
|
|
728
|
+
it("withholds the properties door where there is no single account", () => {
|
|
771
729
|
assert.deepEqual(
|
|
772
730
|
[...matchDoorsFor("acc-personal")],
|
|
773
|
-
["selected", "
|
|
731
|
+
["selected", "properties"],
|
|
774
732
|
);
|
|
775
733
|
assert.deepEqual([...matchDoorsFor(undefined)], ["selected"]);
|
|
776
734
|
assert.match(crossAccountMatchReason, /within one account/);
|
|
@@ -778,7 +736,6 @@ describe("sample and door vocabulary", () => {
|
|
|
778
736
|
|
|
779
737
|
it("names each door and what it does", () => {
|
|
780
738
|
assert.equal(matchDoorLabel("selected", 3), "These 3 messages");
|
|
781
|
-
assert.equal(matchDoorLabel("similar", 3), "Similar to these 3");
|
|
782
739
|
assert.equal(matchDoorLabel("properties", 3), "Its properties");
|
|
783
740
|
assert.match(matchDoorHint("selected"), /ticked in the list/);
|
|
784
741
|
assert.match(matchDoorHint("properties"), /No reading involved/);
|
|
@@ -832,15 +789,6 @@ describe("the match as words", () => {
|
|
|
832
789
|
}),
|
|
833
790
|
"These 4 messages",
|
|
834
791
|
);
|
|
835
|
-
assert.equal(
|
|
836
|
-
matchSummary({
|
|
837
|
-
mode: "similar",
|
|
838
|
-
selectedCount: 4,
|
|
839
|
-
clauses,
|
|
840
|
-
matchOperator: "all",
|
|
841
|
-
}),
|
|
842
|
-
"Similar to these 4",
|
|
843
|
-
);
|
|
844
792
|
assert.equal(
|
|
845
793
|
matchSummary({
|
|
846
794
|
mode: "properties",
|
|
@@ -911,15 +859,6 @@ describe("the match as words", () => {
|
|
|
911
859
|
}),
|
|
912
860
|
"4 messages",
|
|
913
861
|
);
|
|
914
|
-
assert.equal(
|
|
915
|
-
matchPhrase({
|
|
916
|
-
mode: "similar",
|
|
917
|
-
selectedCount: 4,
|
|
918
|
-
clauses,
|
|
919
|
-
matchOperator: "all",
|
|
920
|
-
}),
|
|
921
|
-
"mail similar to these 4",
|
|
922
|
-
);
|
|
923
862
|
assert.equal(
|
|
924
863
|
matchPhrase({
|
|
925
864
|
mode: "properties",
|
|
@@ -957,13 +896,13 @@ describe("the restriction a selection walks the wizard with", () => {
|
|
|
957
896
|
});
|
|
958
897
|
|
|
959
898
|
it("keeps the account a folder-spanning selection has", () => {
|
|
960
|
-
// The
|
|
961
|
-
// there is nothing to withhold
|
|
899
|
+
// The properties door is counted through a preview that account answers,
|
|
900
|
+
// so there is nothing to withhold it for.
|
|
962
901
|
const scope = wizardScopeFor("acc-personal", "spansFolders");
|
|
963
902
|
assert.equal(scope.accountId, "acc-personal");
|
|
964
903
|
assert.deepEqual(
|
|
965
904
|
[...matchDoorsFor(scope.accountId)],
|
|
966
|
-
["selected", "
|
|
905
|
+
["selected", "properties"],
|
|
967
906
|
);
|
|
968
907
|
});
|
|
969
908
|
|
|
@@ -1011,7 +950,7 @@ describe("the restriction the rule step states", () => {
|
|
|
1011
950
|
});
|
|
1012
951
|
|
|
1013
952
|
it("restricts nothing on a door that can carry a predicate", () => {
|
|
1014
|
-
for (const mode of ["selected", "
|
|
953
|
+
for (const mode of ["selected", "properties"] as const) {
|
|
1015
954
|
assert.equal(ruleRestrictionFor(mode, unrestricted), undefined);
|
|
1016
955
|
}
|
|
1017
956
|
});
|
package/src/lib/wizard-steps.ts
CHANGED
|
@@ -14,17 +14,13 @@ import {
|
|
|
14
14
|
hasMatcher,
|
|
15
15
|
type MatchOperator,
|
|
16
16
|
matchJoinWord,
|
|
17
|
-
|
|
18
|
-
matchModeLabel,
|
|
17
|
+
PROPERTIES_MATCH_HINT,
|
|
19
18
|
type PreviewCount,
|
|
20
19
|
previewSettledReason,
|
|
21
20
|
type RuleClause,
|
|
22
|
-
type RuleMatchMode,
|
|
23
21
|
type RuleScope,
|
|
24
|
-
type RuleWiden,
|
|
25
22
|
ruleBlockedCopy,
|
|
26
23
|
unreadableBodyClauses,
|
|
27
|
-
widenChipLabel,
|
|
28
24
|
} from "../components/filter-rule.js";
|
|
29
25
|
|
|
30
26
|
/** What the action does. Delete, Move and Organize carry a glyph on the bar; Junk and Mark read live in the overflow menu. */
|
|
@@ -71,15 +67,14 @@ const VERB_COPY: Record<Verb, VerbCopy> = {
|
|
|
71
67
|
export const verbCopy = (verb: Verb): VerbCopy => VERB_COPY[verb];
|
|
72
68
|
|
|
73
69
|
/**
|
|
74
|
-
* The
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* ids, which no predicate stands in for.
|
|
70
|
+
* The two choices the match step offers a ticked selection. `selected` is the
|
|
71
|
+
* bounded list of ticked message ids, which no predicate stands in for;
|
|
72
|
+
* `properties` widens to every message matching literal clauses.
|
|
78
73
|
*/
|
|
79
|
-
export type MatchDoor = "selected" |
|
|
74
|
+
export type MatchDoor = "selected" | "properties";
|
|
80
75
|
|
|
81
76
|
/**
|
|
82
|
-
* What the action is applied to. Beside the
|
|
77
|
+
* What the action is applied to. Beside the two doors sits `escalated`: the
|
|
83
78
|
* selection the list escalated to a predicate, every message matching the query
|
|
84
79
|
* it is showing rather than the rows on screen. It is offered no doors, because
|
|
85
80
|
* the predicate is already the match and there is nothing left to widen; the
|
|
@@ -114,8 +109,7 @@ export interface WizardAnswers {
|
|
|
114
109
|
scope?: RuleScope;
|
|
115
110
|
/**
|
|
116
111
|
* Entered by converting a search rather than by ticking rows. There is
|
|
117
|
-
* nothing ticked
|
|
118
|
-
* applies to, so the match step is dropped rather than opened past.
|
|
112
|
+
* nothing ticked and the query has already answered what this applies to, so the match step is dropped rather than opened past.
|
|
119
113
|
*/
|
|
120
114
|
fromSearch?: boolean;
|
|
121
115
|
}
|
|
@@ -170,13 +164,6 @@ export const backExits = (steps: readonly StepId[], step: StepId): boolean =>
|
|
|
170
164
|
export interface WizardDraft {
|
|
171
165
|
clauses: readonly RuleClause[];
|
|
172
166
|
matchOperator: MatchOperator;
|
|
173
|
-
/**
|
|
174
|
-
* The semantic widen the similar door rides on. Present makes the widen the
|
|
175
|
-
* matcher, and it reads message bodies — so a body-text clause the user left
|
|
176
|
-
* behind on the property door is readable here, and must not be held against
|
|
177
|
-
* a one-time apply.
|
|
178
|
-
*/
|
|
179
|
-
widen?: RuleWiden;
|
|
180
167
|
/** The Move destination. Absent until the folder step is answered. */
|
|
181
168
|
moveMailboxId?: string;
|
|
182
169
|
/** Absent until the scope step is answered. */
|
|
@@ -189,26 +176,21 @@ export interface WizardDraft {
|
|
|
189
176
|
const asRule = (draft: WizardDraft, scope: RuleScope): FilterRule => ({
|
|
190
177
|
clauses: [...draft.clauses],
|
|
191
178
|
matchOperator: draft.matchOperator,
|
|
192
|
-
widen: draft.widen,
|
|
193
179
|
moveMailboxId: draft.moveMailboxId,
|
|
194
180
|
scope,
|
|
195
181
|
until: draft.until,
|
|
196
182
|
name: draft.name,
|
|
197
183
|
});
|
|
198
184
|
|
|
199
|
-
/**
|
|
200
|
-
* The draft's body-text clauses that nothing on its current match path can read.
|
|
201
|
-
* Empty whenever the semantic widen is carrying the match, because the widen
|
|
202
|
-
* reads bodies; empty for a rule with no body-text clause at all.
|
|
203
|
-
*/
|
|
185
|
+
/** The draft's body-text clauses the organize matcher cannot read. */
|
|
204
186
|
export const unreadableDraftClauses = (draft: WizardDraft): RuleClause[] =>
|
|
205
187
|
unreadableBodyClauses(asRule(draft, draft.scope ?? "once"));
|
|
206
188
|
|
|
207
189
|
/**
|
|
208
190
|
* Why a scope that persists cannot be saved from the door the wizard is on, or
|
|
209
191
|
* `undefined` when it can. The ticked-rows door is a bounded list of ids and no
|
|
210
|
-
* predicate at all: a rule saved through it carries
|
|
211
|
-
*
|
|
192
|
+
* predicate at all: a rule saved through it carries no clause, so it would
|
|
193
|
+
* match nothing, now and for future mail. The rule editor
|
|
212
194
|
* refuses that shape through `hasMatcher`, and so does this — one question, one
|
|
213
195
|
* answer, in the editor's words (#1193).
|
|
214
196
|
*
|
|
@@ -223,7 +205,7 @@ const missingPredicateReason = (draft: WizardDraft): string | undefined => {
|
|
|
223
205
|
|
|
224
206
|
/**
|
|
225
207
|
* The count the wizard is committing against. `uncounted` is a stated answer,
|
|
226
|
-
* not a missing one:
|
|
208
|
+
* not a missing one: the properties door carries no count until it has run
|
|
227
209
|
* (#477 3.3), so there is nothing to wait for and nothing to display.
|
|
228
210
|
*/
|
|
229
211
|
export type MatchCount = PreviewCount | { status: "uncounted" };
|
|
@@ -243,8 +225,8 @@ export const crossAccountDestinationReason =
|
|
|
243
225
|
|
|
244
226
|
/**
|
|
245
227
|
* The same restriction on the step that asks what the action applies to (#523).
|
|
246
|
-
*
|
|
247
|
-
* selection with no single account has nothing to count
|
|
228
|
+
* The properties door is resolved by a preview one account answers, so a
|
|
229
|
+
* selection with no single account has nothing to count it against. The ticked
|
|
248
230
|
* rows are their own match and are unaffected.
|
|
249
231
|
*/
|
|
250
232
|
export const crossAccountMatchReason =
|
|
@@ -287,10 +269,10 @@ const RESTRICTION_COPY: Record<
|
|
|
287
269
|
/** What a restricted selection leaves the wizard's account-scoped steps to work with. */
|
|
288
270
|
export interface WizardScope {
|
|
289
271
|
/**
|
|
290
|
-
* The account a filter, a folder create and
|
|
291
|
-
* belong to. Absent only when the selection has no single account — a
|
|
292
|
-
* selection spanning folders of one account keeps it, so its
|
|
293
|
-
*
|
|
272
|
+
* The account a filter, a folder create and the properties door's preview
|
|
273
|
+
* all belong to. Absent only when the selection has no single account — a
|
|
274
|
+
* selection spanning folders of one account keeps it, so its properties door
|
|
275
|
+
* has something to count against.
|
|
294
276
|
*/
|
|
295
277
|
accountId?: string;
|
|
296
278
|
/** What the rule step states, when the selection cannot reach a saved scope. */
|
|
@@ -302,8 +284,7 @@ export interface WizardScope {
|
|
|
302
284
|
/**
|
|
303
285
|
* Why an escalated predicate cannot become a rule (#1193). The list resolved it
|
|
304
286
|
* to the query on screen before the wizard opened, so there is no clause to
|
|
305
|
-
* build a rule from and no
|
|
306
|
-
* get one from. It applies once; the query itself is what makes a filter, from
|
|
287
|
+
* build a rule from — and no door on the match step to get one from. It applies once; the query itself is what makes a filter, from
|
|
307
288
|
* the affordance above the results.
|
|
308
289
|
*/
|
|
309
290
|
export const escalatedRuleReason =
|
|
@@ -343,16 +324,14 @@ export const wizardScopeFor = (
|
|
|
343
324
|
};
|
|
344
325
|
|
|
345
326
|
/**
|
|
346
|
-
* The doors the match step offers. Withholding the
|
|
327
|
+
* The doors the match step offers. Withholding the properties door is what
|
|
347
328
|
* keeps a selection spanning accounts off a review that waits on a count nobody
|
|
348
329
|
* can take; the step says why in `crossAccountMatchReason`.
|
|
349
330
|
*/
|
|
350
331
|
export const matchDoorsFor = (
|
|
351
332
|
accountId: string | undefined,
|
|
352
333
|
): readonly MatchDoor[] =>
|
|
353
|
-
accountId === undefined
|
|
354
|
-
? ["selected"]
|
|
355
|
-
: ["selected", "similar", "properties"];
|
|
334
|
+
accountId === undefined ? ["selected"] : ["selected", "properties"];
|
|
356
335
|
|
|
357
336
|
/**
|
|
358
337
|
* The match reached nothing, so committing it would report a bulk action that
|
|
@@ -442,22 +421,9 @@ export type RunState =
|
|
|
442
421
|
| "runStopped"
|
|
443
422
|
| "commitFailed";
|
|
444
423
|
|
|
445
|
-
/**
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
* simply has not been indexed yet.
|
|
449
|
-
*/
|
|
450
|
-
export type SampleEmptyReason = "noMatch" | "notIndexed";
|
|
451
|
-
|
|
452
|
-
const SAMPLE_EMPTY_COPY: Record<SampleEmptyReason, string> = {
|
|
453
|
-
noMatch:
|
|
454
|
-
"Nothing matches this yet. Widen a property, or match on a different one.",
|
|
455
|
-
notIndexed:
|
|
456
|
-
"This mail isn't indexed yet, so nothing can be counted. The rule still matches once indexing catches up.",
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
export const sampleEmptyCopy = (reason: SampleEmptyReason): string =>
|
|
460
|
-
SAMPLE_EMPTY_COPY[reason];
|
|
424
|
+
/** What an empty sample says, so it never reads as a blank. */
|
|
425
|
+
export const SAMPLE_EMPTY_COPY =
|
|
426
|
+
"Nothing matches this yet. Widen a property, or match on a different one.";
|
|
461
427
|
|
|
462
428
|
export interface RunOutcome {
|
|
463
429
|
state: RunState;
|
|
@@ -669,21 +635,18 @@ export const clauseSentence = (
|
|
|
669
635
|
operator: MatchOperator,
|
|
670
636
|
): string => clauses.map(clauseWords).join(` ${matchJoinWord(operator)} `);
|
|
671
637
|
|
|
672
|
-
/** What a match door is called, with the ticked count
|
|
638
|
+
/** What a match door is called, with the ticked count. */
|
|
673
639
|
export const matchDoorLabel = (
|
|
674
640
|
mode: MatchDoor,
|
|
675
641
|
selectedCount: number,
|
|
676
|
-
): string =>
|
|
677
|
-
|
|
678
|
-
if (mode === "similar") return widenChipLabel({ anchorCount: selectedCount });
|
|
679
|
-
return matchModeLabel("properties");
|
|
680
|
-
};
|
|
642
|
+
): string =>
|
|
643
|
+
mode === "selected" ? `These ${selectedCount} messages` : "Its properties";
|
|
681
644
|
|
|
682
645
|
/** One line saying what a match door actually does, so the choice is never a guess. */
|
|
683
646
|
export const matchDoorHint = (mode: MatchDoor): string =>
|
|
684
647
|
mode === "selected"
|
|
685
648
|
? "Only the messages ticked in the list."
|
|
686
|
-
:
|
|
649
|
+
: PROPERTIES_MATCH_HINT;
|
|
687
650
|
|
|
688
651
|
/**
|
|
689
652
|
* What an escalated predicate covers, in the words the list already used to
|
|
@@ -756,9 +719,6 @@ export const matchPhrase = ({
|
|
|
756
719
|
? `every message ${scope}`
|
|
757
720
|
: `all ${escalatedCount.toLocaleString()} messages ${scope}`;
|
|
758
721
|
}
|
|
759
|
-
if (mode === "similar") {
|
|
760
|
-
return `mail ${widenChipLabel({ anchorCount: selectedCount }).toLowerCase()}`;
|
|
761
|
-
}
|
|
762
722
|
if (clauses.length === 0) return "every message";
|
|
763
723
|
return `every message where ${clauseSentence(clauses, matchOperator)}`;
|
|
764
724
|
};
|
package/src/mcp-pages.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export {
|
|
2
|
+
type McpConnectedApp,
|
|
3
|
+
McpConnectedAppsPage,
|
|
4
|
+
type McpConnectedAppsPageProps,
|
|
5
|
+
} from "./components/mcp-connected-apps-page.js";
|
|
6
|
+
export {
|
|
7
|
+
McpConsentPage,
|
|
8
|
+
type McpConsentPageProps,
|
|
9
|
+
} from "./components/mcp-consent-page.js";
|
|
10
|
+
export {
|
|
11
|
+
McpDevicePage,
|
|
12
|
+
type McpDevicePageProps,
|
|
13
|
+
type McpDeviceState,
|
|
14
|
+
} from "./components/mcp-device-page.js";
|
|
15
|
+
export {
|
|
16
|
+
McpErrorNotice,
|
|
17
|
+
type McpErrorNoticeProps,
|
|
18
|
+
} from "./components/mcp-error-notice.js";
|
|
19
|
+
export {
|
|
20
|
+
McpErrorPage,
|
|
21
|
+
type McpErrorPageProps,
|
|
22
|
+
} from "./components/mcp-error-page.js";
|
|
23
|
+
export {
|
|
24
|
+
McpLoginPage,
|
|
25
|
+
type McpLoginPageProps,
|
|
26
|
+
} from "./components/mcp-login-page.js";
|
|
27
|
+
export {
|
|
28
|
+
McpPage,
|
|
29
|
+
type McpPageError,
|
|
30
|
+
type McpPageProps,
|
|
31
|
+
type McpPermission,
|
|
32
|
+
} from "./components/mcp-page.js";
|
|
33
|
+
export {
|
|
34
|
+
McpPermissionList,
|
|
35
|
+
type McpPermissionListProps,
|
|
36
|
+
} from "./components/mcp-permission-list.js";
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert/strict";
|
|
2
|
-
import { describe, it } from "node:test";
|
|
3
|
-
import {
|
|
4
|
-
CATEGORY_PRESENTATION,
|
|
5
|
-
CATEGORY_SECTION_ORDER,
|
|
6
|
-
categoryChips,
|
|
7
|
-
categoryLabels,
|
|
8
|
-
categoryTone,
|
|
9
|
-
} from "./category-presentation.js";
|
|
10
|
-
|
|
11
|
-
// Written out rather than derived: the table is the only definition of these
|
|
12
|
-
// words and this order, so a test that reads them back from it agrees with any
|
|
13
|
-
// rename. A reader who has learnt "Unclassified" should not meet a new word
|
|
14
|
-
// because an edit here went unnoticed.
|
|
15
|
-
describe("the canonical category table", () => {
|
|
16
|
-
it("gives every category the word every surface shows", () => {
|
|
17
|
-
assert.deepEqual(categoryLabels, {
|
|
18
|
-
personal: "Personal",
|
|
19
|
-
uncategorized: "Unclassified",
|
|
20
|
-
transactional: "Transactional",
|
|
21
|
-
newsletter: "Newsletter",
|
|
22
|
-
marketing: "Marketing",
|
|
23
|
-
social: "Social",
|
|
24
|
-
automated: "Automated",
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("gives every category its tone, and does not warn about marketing", () => {
|
|
29
|
-
assert.deepEqual(categoryTone, {
|
|
30
|
-
personal: "accent",
|
|
31
|
-
uncategorized: "neutral",
|
|
32
|
-
transactional: "positive",
|
|
33
|
-
newsletter: "neutral",
|
|
34
|
-
marketing: "neutral",
|
|
35
|
-
social: "warning",
|
|
36
|
-
automated: "neutral",
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("ends the brief's section order with the unclassified mail", () => {
|
|
41
|
-
assert.deepEqual(CATEGORY_SECTION_ORDER, [
|
|
42
|
-
"personal",
|
|
43
|
-
"transactional",
|
|
44
|
-
"newsletter",
|
|
45
|
-
"marketing",
|
|
46
|
-
"social",
|
|
47
|
-
"automated",
|
|
48
|
-
"uncategorized",
|
|
49
|
-
]);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("leads the chip row with All, then Personal and Unclassified", () => {
|
|
53
|
-
assert.deepEqual(
|
|
54
|
-
categoryChips.map((chip) => chip.label),
|
|
55
|
-
[
|
|
56
|
-
"All",
|
|
57
|
-
"Personal",
|
|
58
|
-
"Unclassified",
|
|
59
|
-
"Transactional",
|
|
60
|
-
"Newsletter",
|
|
61
|
-
"Marketing",
|
|
62
|
-
"Social",
|
|
63
|
-
"Automated",
|
|
64
|
-
],
|
|
65
|
-
);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it("gives each category one row, and each section one place", () => {
|
|
69
|
-
const categories = CATEGORY_PRESENTATION.map((entry) => entry.category);
|
|
70
|
-
assert.equal(new Set(categories).size, categories.length);
|
|
71
|
-
assert.deepEqual(
|
|
72
|
-
CATEGORY_PRESENTATION.map((entry) => entry.section).sort((a, b) => a - b),
|
|
73
|
-
[1, 2, 3, 4, 5, 6, 7],
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
});
|