@remit/ui 0.0.222 → 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.
Files changed (200) hide show
  1. package/package.json +12 -3
  2. package/src/components/DropdownMenu.tsx +100 -0
  3. package/src/components/EmptyState.tsx +11 -0
  4. package/src/components/ErrorBanner.render.test.ts +107 -0
  5. package/src/components/ErrorBanner.stories.tsx +132 -0
  6. package/src/components/ErrorBanner.tsx +122 -0
  7. package/src/components/ErrorBannerStack.tsx +34 -0
  8. package/src/components/ErrorState.render.test.ts +82 -0
  9. package/src/components/ErrorState.tsx +80 -0
  10. package/src/components/KeyboardShortcutsModal.tsx +111 -0
  11. package/src/components/account-service-change-dialog.render.test.ts +1 -41
  12. package/src/components/account-service-choice.render.test.ts +0 -26
  13. package/src/components/account-service-toggles.render.test.ts +0 -6
  14. package/src/components/address-display.render.test.ts +1 -38
  15. package/src/components/address-tag.render.test.ts +0 -11
  16. package/src/components/agenda-flow.reach.test.ts +0 -8
  17. package/src/components/agenda-flow.render.test.ts +0 -31
  18. package/src/components/agenda-panels.render.test.ts +0 -5
  19. package/src/components/app-shell-slotted.render.test.ts +0 -118
  20. package/src/components/attachment-list.render.test.ts +41 -24
  21. package/src/components/attachment-list.stories.tsx +67 -0
  22. package/src/components/attachment-list.tsx +112 -35
  23. package/src/components/attendee-row.render.test.ts +0 -41
  24. package/src/components/attention-dot.stories.tsx +46 -0
  25. package/src/components/attention-dot.tsx +23 -0
  26. package/src/components/banner.render.test.ts +0 -7
  27. package/src/components/bottom-sheet.render.test.ts +0 -42
  28. package/src/components/brief-section.render.test.ts +0 -13
  29. package/src/components/brief-sections.keyboard.test.ts +0 -13
  30. package/src/components/brief-sections.render.test.ts +0 -22
  31. package/src/components/calendar-clash-strip.render.test.ts +0 -19
  32. package/src/components/calendar-grid.render.test.ts +0 -79
  33. package/src/components/calendar-invite-card.render.test.ts +0 -19
  34. package/src/components/calendar-list.render.test.ts +0 -21
  35. package/src/components/calendar-slot-offers.render.test.ts +0 -24
  36. package/src/components/calendar-suggestion-deck.render.test.ts +0 -18
  37. package/src/components/calendar-toolbar.render.test.ts +1 -53
  38. package/src/components/category-badge.render.test.ts +1 -24
  39. package/src/components/compose-action-bar.render.test.ts +0 -5
  40. package/src/components/compose-attachments.render.test.ts +0 -38
  41. package/src/components/event-detail.render.test.ts +0 -27
  42. package/src/components/event-editor.render.test.ts +0 -4
  43. package/src/components/event-suggestion-card.render.test.ts +0 -61
  44. package/src/components/event-suggestion-card.zone-gate.test.ts +1 -7
  45. package/src/components/filter-clause-chip.tsx +1 -60
  46. package/src/components/filter-rule-editor.create.test.ts +0 -6
  47. package/src/components/filter-rule-editor.stories.tsx +24 -138
  48. package/src/components/filter-rule-editor.tsx +7 -93
  49. package/src/components/filter-rule.render.test.ts +9 -299
  50. package/src/components/filter-rule.ts +20 -85
  51. package/src/components/filter-sheet.render.test.ts +0 -7
  52. package/src/components/folder-manage-actions.render.test.ts +0 -13
  53. package/src/components/folder-manager.render.test.ts +0 -31
  54. package/src/components/folder-mutation-dialog.render.test.ts +0 -83
  55. package/src/components/folder-rename-dialog.render.test.ts +0 -14
  56. package/src/components/folder-row.render.test.ts +0 -30
  57. package/src/components/folder-sync-state.test.ts +0 -61
  58. package/src/components/folder-tree-picker.create.test.ts +0 -30
  59. package/src/components/folder-tree-picker.render.test.ts +0 -35
  60. package/src/components/intelligence-calendar-fixtures.ts +0 -2
  61. package/src/components/intelligence-calendar.render.test.ts +0 -4
  62. package/src/components/intelligence-panel.render.test.ts +1 -62
  63. package/src/components/intelligence-panel.stories.tsx +0 -76
  64. package/src/components/intelligence-panel.tab-strip.test.ts +0 -1
  65. package/src/components/intelligence-panel.tsx +6 -176
  66. package/src/components/intelligence-toggle.render.test.ts +0 -5
  67. package/src/components/isolated-email-frame.render.test.ts +0 -122
  68. package/src/components/isolated-email-frame.tsx +1 -1
  69. package/src/components/keyboard-hint-bar.render.test.ts +0 -7
  70. package/src/components/label-chip.render.test.ts +0 -28
  71. package/src/components/label-chip.tsx +1 -1
  72. package/src/components/mail-header.render.test.ts +0 -20
  73. package/src/components/mcp-connected-apps-page.stories.tsx +58 -0
  74. package/src/components/mcp-connected-apps-page.tsx +79 -0
  75. package/src/components/mcp-consent-page.stories.tsx +39 -0
  76. package/src/components/mcp-consent-page.tsx +47 -0
  77. package/src/components/mcp-device-page.stories.tsx +57 -0
  78. package/src/components/mcp-device-page.tsx +107 -0
  79. package/src/components/mcp-error-notice.stories.tsx +34 -0
  80. package/src/components/mcp-error-notice.tsx +23 -0
  81. package/src/components/mcp-error-page.stories.tsx +17 -0
  82. package/src/components/mcp-error-page.tsx +15 -0
  83. package/src/components/mcp-fixtures.ts +16 -0
  84. package/src/components/mcp-login-page.stories.tsx +37 -0
  85. package/src/components/mcp-login-page.tsx +58 -0
  86. package/src/components/mcp-page.stories.tsx +27 -0
  87. package/src/components/mcp-page.tsx +35 -0
  88. package/src/components/mcp-permission-list.stories.tsx +21 -0
  89. package/src/components/mcp-permission-list.tsx +22 -0
  90. package/src/components/message-body-view.render.test.ts +0 -21
  91. package/src/components/message-list-pane.brief-filter.test.ts +0 -6
  92. package/src/components/message-list-pane.render.test.ts +0 -54
  93. package/src/components/message-list-state.render.test.ts +0 -84
  94. package/src/components/{quarantine-bug-dialog.tsx → message-report-dialog.tsx} +9 -14
  95. package/src/components/message-row.render.test.ts +1 -98
  96. package/src/components/mobile-message-action-bar.render.test.ts +0 -59
  97. package/src/components/mobile-reading-pane.render.test.ts +0 -48
  98. package/src/components/mobile-search-view.render.test.ts +0 -16
  99. package/src/components/mobile-search-view.stories.tsx +8 -11
  100. package/src/components/mobile-search-view.tsx +1 -1
  101. package/src/components/nav-sidebar.keyboard.test.ts +0 -8
  102. package/src/components/nav-sidebar.render.test.ts +2 -133
  103. package/src/components/new-folder-form.render.test.ts +0 -26
  104. package/src/components/outbox-row.render.test.ts +0 -9
  105. package/src/components/pane-layout.render.test.ts +0 -18
  106. package/src/components/plain-text-editor.mount.test.ts +0 -16
  107. package/src/components/popover-menu.render.test.ts +0 -11
  108. package/src/components/progress-bar.render.test.ts +0 -14
  109. package/src/components/quarantine-report.test.ts +0 -8
  110. package/src/components/quarantine-section.render.test.ts +16 -13
  111. package/src/components/quarantine-section.stories.tsx +11 -8
  112. package/src/components/reading-pane.render.test.ts +2 -106
  113. package/src/components/reading-pane.stories.tsx +3 -0
  114. package/src/components/refresh-button.render.test.ts +0 -9
  115. package/src/components/rescue-from-spam-flow.render.test.ts +0 -24
  116. package/src/components/rich-text-editor.mount.test.ts +0 -19
  117. package/src/components/rich-text-image-node.ts +11 -9
  118. package/src/components/role-appointment-list.render.test.ts +0 -49
  119. package/src/components/role-appointment-prompt.render.test.ts +0 -79
  120. package/src/components/row-actions.render.test.ts +0 -34
  121. package/src/components/search-bar.render.test.ts +0 -44
  122. package/src/components/search-chip-input.render.test.ts +0 -71
  123. package/src/components/search-conversion-notice.stories.tsx +0 -6
  124. package/src/components/search-conversion-notice.tsx +3 -9
  125. package/src/components/search-conversion.render.test.ts +0 -52
  126. package/src/components/search-conversion.ts +2 -18
  127. package/src/components/search-result-row.tsx +5 -26
  128. package/src/components/search-results.render.test.ts +0 -68
  129. package/src/components/search-results.stories.tsx +0 -30
  130. package/src/components/search-results.tsx +1 -1
  131. package/src/components/security-select.render.test.ts +1 -14
  132. package/src/components/selection-top-bar.render.test.ts +0 -180
  133. package/src/components/selection-wizard-fixtures.ts +0 -2
  134. package/src/components/selection-wizard.render.test.ts +7 -212
  135. package/src/components/selection-wizard.stories.tsx +24 -164
  136. package/src/components/selection-wizard.tsx +10 -86
  137. package/src/components/self-update.render.test.ts +0 -113
  138. package/src/components/sender-trust-indicator.render.test.ts +0 -30
  139. package/src/components/shell-top-bar.render.test.ts +0 -31
  140. package/src/components/shell-top-bar.stories.tsx +7 -0
  141. package/src/components/shell-top-bar.tsx +11 -2
  142. package/src/components/slide-panel.render.test.ts +0 -18
  143. package/src/components/suggest-list.render.test.ts +0 -6
  144. package/src/components/swipeable-row.gesture.test.ts +0 -15
  145. package/src/components/swipeable-row.render.test.ts +0 -7
  146. package/src/components/sync-warning-fixtures.ts +22 -0
  147. package/src/components/sync-warning-report.ts +38 -0
  148. package/src/components/sync-warning-row.tsx +51 -0
  149. package/src/components/sync-warning-section.render.test.ts +19 -0
  150. package/src/components/sync-warning-section.stories.tsx +94 -0
  151. package/src/components/sync-warning-section.tsx +56 -0
  152. package/src/components/touch-list-body.render.test.ts +0 -29
  153. package/src/components/wizard.render.test.ts +0 -22
  154. package/src/filter-presets.test.ts +1 -107
  155. package/src/index.ts +40 -30
  156. package/src/lib/compose-language.test.ts +0 -11
  157. package/src/lib/email-render-treatment.test.ts +0 -21
  158. package/src/lib/keymap.test.ts +0 -32
  159. package/src/lib/property-prefill.ts +2 -2
  160. package/src/lib/search-rule.test.ts +0 -4
  161. package/src/lib/search-rule.ts +0 -9
  162. package/src/lib/sender-derivation.ts +3 -5
  163. package/src/lib/use-list-cursor.test.ts +0 -7
  164. package/src/lib/use-list-keyboard.test.ts +0 -14
  165. package/src/lib/use-modal-focus.test.ts +0 -20
  166. package/src/lib/use-selection.hook.test.ts +0 -13
  167. package/src/lib/use-selection.test.ts +0 -101
  168. package/src/lib/wizard-steps.test.ts +18 -79
  169. package/src/lib/wizard-steps.ts +27 -67
  170. package/src/mcp-pages.ts +36 -0
  171. package/src/category-presentation.test.ts +0 -76
  172. package/src/components/account-service-status.render.test.ts +0 -82
  173. package/src/components/app-password-hint.render.test.ts +0 -23
  174. package/src/components/app-top-bar.render.test.ts +0 -59
  175. package/src/components/auth-card.render.test.ts +0 -24
  176. package/src/components/auth-footer.render.test.ts +0 -17
  177. package/src/components/auth-hero.render.test.ts +0 -31
  178. package/src/components/auto-moved-badge.render.test.ts +0 -65
  179. package/src/components/button.render.test.ts +0 -29
  180. package/src/components/calendar-event-chip.render.test.ts +0 -67
  181. package/src/components/calendar-parse-badge.render.test.ts +0 -40
  182. package/src/components/checkbox.render.test.ts +0 -65
  183. package/src/components/compose-form-shell.render.test.ts +0 -106
  184. package/src/components/dialog.render.test.ts +0 -51
  185. package/src/components/field-label.render.test.ts +0 -16
  186. package/src/components/mail-action-toolbar.render.test.ts +0 -43
  187. package/src/components/nav-link-surface.render.test.ts +0 -126
  188. package/src/components/new-folder-action.render.test.ts +0 -44
  189. package/src/components/pane-header.render.test.ts +0 -22
  190. package/src/components/pull-to-refresh.render.test.ts +0 -46
  191. package/src/components/recurrence-scope-prompt.render.test.ts +0 -36
  192. package/src/components/rescue-banner.render.test.ts +0 -32
  193. package/src/components/rescue-candidate-row.render.test.ts +0 -68
  194. package/src/components/search-token-chip.render.test.ts +0 -42
  195. package/src/components/self-update-dot.tsx +0 -32
  196. package/src/components/settings-primitives.render.test.ts +0 -160
  197. package/src/lib/email-layout-clamp.test.ts +0 -139
  198. package/src/lib/label-color.test.ts +0 -25
  199. package/src/lib/semantic-off.ts +0 -20
  200. package/src/stories-viewport-globals.test.ts +0 -77
@@ -0,0 +1,39 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { expect, within } from "storybook/test";
3
+ import { McpConsentPage } from "./mcp-consent-page.js";
4
+ import { mcpPermissionsFixture } from "./mcp-fixtures.js";
5
+
6
+ const meta: Meta<typeof McpConsentPage> = {
7
+ title: "Playground/Proposed/MCP/McpConsentPage",
8
+ tags: ["proposed"],
9
+ component: McpConsentPage,
10
+ parameters: { layout: "fullscreen" },
11
+ args: { clientName: "Claude", oauthQuery: "client_id=abc&sig=xyz" },
12
+ };
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof McpConsentPage>;
16
+
17
+ export const ReadAndRules: Story = {
18
+ args: { permissions: mcpPermissionsFixture },
19
+ play: async ({ canvasElement }) => {
20
+ const canvas = within(canvasElement);
21
+ await expect(canvas.getByText("Read your mail")).toBeVisible();
22
+ await expect(
23
+ canvas.getByText("Create and change folders and filters"),
24
+ ).toBeVisible();
25
+ await expect(canvas.getByRole("button", { name: "Allow" })).toBeVisible();
26
+ await expect(canvas.getByRole("button", { name: "Deny" })).toBeVisible();
27
+ },
28
+ };
29
+
30
+ export const ReadOnly: Story = {
31
+ args: { permissions: mcpPermissionsFixture.slice(0, 1) },
32
+ };
33
+
34
+ export const LongClientName: Story = {
35
+ args: {
36
+ clientName: "A very long assistant name registered by a desktop client",
37
+ permissions: mcpPermissionsFixture,
38
+ },
39
+ };
@@ -0,0 +1,47 @@
1
+ import { Button } from "./button.js";
2
+ import type { McpPermission } from "./mcp-page.js";
3
+ import { McpPage } from "./mcp-page.js";
4
+ import { McpPermissionList } from "./mcp-permission-list.js";
5
+
6
+ export interface McpConsentPageProps {
7
+ clientName: string;
8
+ permissions: readonly McpPermission[];
9
+ oauthQuery: string;
10
+ }
11
+
12
+ export function McpConsentPage({
13
+ clientName,
14
+ permissions,
15
+ oauthQuery,
16
+ }: McpConsentPageProps) {
17
+ return (
18
+ <McpPage
19
+ heading={`Allow ${clientName} to use your mail?`}
20
+ intro={`${clientName} asks to:`}
21
+ >
22
+ <McpPermissionList permissions={permissions} />
23
+ <p className="text-xs text-fg-muted">
24
+ You can disconnect it at any time from{" "}
25
+ <a href="/apps" className="underline underline-offset-2">
26
+ connected apps
27
+ </a>
28
+ .
29
+ </p>
30
+ <form method="post" className="flex gap-2">
31
+ <input type="hidden" name="oauth_query" value={oauthQuery} />
32
+ <Button
33
+ type="submit"
34
+ name="accept"
35
+ value="false"
36
+ variant="secondary"
37
+ className="flex-1"
38
+ >
39
+ Deny
40
+ </Button>
41
+ <Button type="submit" name="accept" value="true" className="flex-1">
42
+ Allow
43
+ </Button>
44
+ </form>
45
+ </McpPage>
46
+ );
47
+ }
@@ -0,0 +1,57 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { expect, within } from "storybook/test";
3
+ import { McpDevicePage } from "./mcp-device-page.js";
4
+ import { mcpErrorFixture } from "./mcp-fixtures.js";
5
+
6
+ const meta: Meta<typeof McpDevicePage> = {
7
+ title: "Playground/Proposed/MCP/McpDevicePage",
8
+ tags: ["proposed"],
9
+ component: McpDevicePage,
10
+ parameters: { layout: "fullscreen" },
11
+ };
12
+ export default meta;
13
+
14
+ type Story = StoryObj<typeof McpDevicePage>;
15
+
16
+ export const EnterCode: Story = {
17
+ args: { state: { kind: "enter", userCode: "" } },
18
+ };
19
+
20
+ export const UnknownCode: Story = {
21
+ args: {
22
+ state: {
23
+ kind: "enter",
24
+ userCode: "WXYZ-1234",
25
+ error: {
26
+ message: "That code is not valid or has expired.",
27
+ fix: "Run remit mcp login again and enter the new code.",
28
+ reportUrl: mcpErrorFixture.reportUrl,
29
+ },
30
+ },
31
+ },
32
+ play: async ({ canvasElement }) => {
33
+ const canvas = within(canvasElement);
34
+ await expect(canvas.getByRole("alert")).toHaveTextContent(
35
+ "Run remit mcp login again",
36
+ );
37
+ await expect(canvas.getByLabelText("Code")).toHaveValue("WXYZ-1234");
38
+ },
39
+ };
40
+
41
+ export const Confirm: Story = {
42
+ args: { state: { kind: "confirm", userCode: "ABCD-EFGH" } },
43
+ play: async ({ canvasElement }) => {
44
+ const canvas = within(canvasElement);
45
+ await expect(canvas.getByText("ABCD-EFGH")).toBeVisible();
46
+ await expect(canvas.getByRole("button", { name: "Approve" })).toBeVisible();
47
+ await expect(canvas.getByRole("button", { name: "Deny" })).toBeVisible();
48
+ },
49
+ };
50
+
51
+ export const Approved: Story = {
52
+ args: { state: { kind: "approved" } },
53
+ };
54
+
55
+ export const Denied: Story = {
56
+ args: { state: { kind: "denied" } },
57
+ };
@@ -0,0 +1,107 @@
1
+ import { Button, ButtonLink } from "./button.js";
2
+ import { Input } from "./input.js";
3
+ import { McpErrorNotice } from "./mcp-error-notice.js";
4
+ import { McpPage, type McpPageError } from "./mcp-page.js";
5
+
6
+ export type McpDeviceState =
7
+ | { kind: "enter"; userCode: string; error?: McpPageError }
8
+ | { kind: "confirm"; userCode: string }
9
+ | { kind: "approved" }
10
+ | { kind: "denied" };
11
+
12
+ export interface McpDevicePageProps {
13
+ state: McpDeviceState;
14
+ }
15
+
16
+ function EnterCode({
17
+ userCode,
18
+ error,
19
+ }: {
20
+ userCode: string;
21
+ error?: McpPageError;
22
+ }) {
23
+ return (
24
+ <McpPage
25
+ heading="Connect a device"
26
+ intro="Enter the code your terminal shows."
27
+ >
28
+ {error && <McpErrorNotice error={error} />}
29
+ <form method="get" className="flex flex-col gap-4">
30
+ <div className="flex flex-col gap-1 text-sm">
31
+ <label htmlFor="mcp-user-code" className="text-fg-muted">
32
+ Code
33
+ </label>
34
+ <Input
35
+ id="mcp-user-code"
36
+ name="user_code"
37
+ defaultValue={userCode}
38
+ autoComplete="one-time-code"
39
+ autoCapitalize="characters"
40
+ spellCheck={false}
41
+ placeholder="ABCD-EFGH"
42
+ className="font-mono uppercase tracking-widest"
43
+ required
44
+ />
45
+ </div>
46
+ <Button type="submit">Continue</Button>
47
+ </form>
48
+ </McpPage>
49
+ );
50
+ }
51
+
52
+ function ConfirmCode({ userCode }: { userCode: string }) {
53
+ return (
54
+ <McpPage
55
+ heading="Approve this device?"
56
+ intro="Only approve if your terminal shows the same code."
57
+ >
58
+ <p className="rounded-md border border-line bg-surface-sunken py-3 text-center font-mono text-2xl tracking-widest text-fg">
59
+ {userCode}
60
+ </p>
61
+ <p className="text-sm text-fg-muted">
62
+ Approving lets the device use your mail until you disconnect it.
63
+ </p>
64
+ <form method="post" className="flex gap-2">
65
+ <input type="hidden" name="user_code" value={userCode} />
66
+ <Button
67
+ type="submit"
68
+ name="action"
69
+ value="deny"
70
+ variant="secondary"
71
+ className="flex-1"
72
+ >
73
+ Deny
74
+ </Button>
75
+ <Button type="submit" name="action" value="approve" className="flex-1">
76
+ Approve
77
+ </Button>
78
+ </form>
79
+ </McpPage>
80
+ );
81
+ }
82
+
83
+ function Outcome({ approved }: { approved: boolean }) {
84
+ return (
85
+ <McpPage
86
+ heading={approved ? "Device connected" : "Device denied"}
87
+ intro={
88
+ approved
89
+ ? "Go back to your terminal; it signs in by itself."
90
+ : "The device gets no access. You can close this page."
91
+ }
92
+ >
93
+ <ButtonLink href="/apps" variant="secondary">
94
+ Manage connected apps
95
+ </ButtonLink>
96
+ </McpPage>
97
+ );
98
+ }
99
+
100
+ export function McpDevicePage({ state }: McpDevicePageProps) {
101
+ if (state.kind === "enter") {
102
+ return <EnterCode userCode={state.userCode} error={state.error} />;
103
+ }
104
+ if (state.kind === "confirm")
105
+ return <ConfirmCode userCode={state.userCode} />;
106
+ return <Outcome approved={state.kind === "approved"} />;
107
+ }
@@ -0,0 +1,34 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { expect, within } from "storybook/test";
3
+ import { McpErrorNotice } from "./mcp-error-notice.js";
4
+ import { mcpErrorFixture } from "./mcp-fixtures.js";
5
+
6
+ const meta: Meta<typeof McpErrorNotice> = {
7
+ title: "Playground/Proposed/MCP/McpErrorNotice",
8
+ tags: ["proposed"],
9
+ component: McpErrorNotice,
10
+ parameters: { layout: "padded" },
11
+ decorators: [
12
+ (Story) => (
13
+ <div className="mx-auto max-w-sm">
14
+ <Story />
15
+ </div>
16
+ ),
17
+ ],
18
+ };
19
+ export default meta;
20
+
21
+ type Story = StoryObj<typeof McpErrorNotice>;
22
+
23
+ export const StatesTheFix: Story = {
24
+ args: { error: mcpErrorFixture },
25
+ play: async ({ canvasElement }) => {
26
+ const canvas = within(canvasElement);
27
+ await expect(canvas.getByRole("alert")).toHaveTextContent(
28
+ mcpErrorFixture.fix,
29
+ );
30
+ await expect(
31
+ canvas.getByRole("link", { name: "Report an issue" }),
32
+ ).toHaveAttribute("href", mcpErrorFixture.reportUrl);
33
+ },
34
+ };
@@ -0,0 +1,23 @@
1
+ import { Banner } from "./banner.js";
2
+ import type { McpPageError } from "./mcp-page.js";
3
+
4
+ export interface McpErrorNoticeProps {
5
+ error: McpPageError;
6
+ }
7
+
8
+ export function McpErrorNotice({ error }: McpErrorNoticeProps) {
9
+ return (
10
+ <Banner tone="danger" variant="soft">
11
+ <p className="font-medium">{error.message}</p>
12
+ <p className="mt-1">{error.fix}</p>
13
+ <a
14
+ href={error.reportUrl}
15
+ target="_blank"
16
+ rel="noopener noreferrer"
17
+ className="mt-2 inline-block underline underline-offset-2"
18
+ >
19
+ Report an issue
20
+ </a>
21
+ </Banner>
22
+ );
23
+ }
@@ -0,0 +1,17 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { McpErrorPage } from "./mcp-error-page.js";
3
+ import { mcpErrorFixture } from "./mcp-fixtures.js";
4
+
5
+ const meta: Meta<typeof McpErrorPage> = {
6
+ title: "Playground/Proposed/MCP/McpErrorPage",
7
+ tags: ["proposed"],
8
+ component: McpErrorPage,
9
+ parameters: { layout: "fullscreen" },
10
+ };
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof McpErrorPage>;
14
+
15
+ export const ExpiredSignIn: Story = {
16
+ args: { heading: "Sign-in expired", error: mcpErrorFixture },
17
+ };
@@ -0,0 +1,15 @@
1
+ import { McpErrorNotice } from "./mcp-error-notice.js";
2
+ import { McpPage, type McpPageError } from "./mcp-page.js";
3
+
4
+ export interface McpErrorPageProps {
5
+ heading: string;
6
+ error: McpPageError;
7
+ }
8
+
9
+ export function McpErrorPage({ heading, error }: McpErrorPageProps) {
10
+ return (
11
+ <McpPage heading={heading}>
12
+ <McpErrorNotice error={error} />
13
+ </McpPage>
14
+ );
15
+ }
@@ -0,0 +1,16 @@
1
+ import type { McpPageError, McpPermission } from "./mcp-page.js";
2
+
3
+ export const mcpPermissionsFixture: readonly McpPermission[] = [
4
+ { scope: "mail:read", description: "Read your mail" },
5
+ { scope: "mail:rules", description: "Create and change folders and filters" },
6
+ {
7
+ scope: "offline_access",
8
+ description: "Stay connected until you disconnect it",
9
+ },
10
+ ];
11
+
12
+ export const mcpErrorFixture: McpPageError = {
13
+ message: "This sign-in link has expired.",
14
+ fix: "Go back to Claude and connect remit again.",
15
+ reportUrl: "https://github.com/remit-mail/reader/issues/new",
16
+ };
@@ -0,0 +1,37 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { expect, within } from "storybook/test";
3
+ import { mcpErrorFixture } from "./mcp-fixtures.js";
4
+ import { McpLoginPage } from "./mcp-login-page.js";
5
+
6
+ const meta: Meta<typeof McpLoginPage> = {
7
+ title: "Playground/Proposed/MCP/McpLoginPage",
8
+ tags: ["proposed"],
9
+ component: McpLoginPage,
10
+ parameters: { layout: "fullscreen" },
11
+ args: { hiddenFields: { oauth_query: "client_id=abc&sig=xyz" } },
12
+ };
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof McpLoginPage>;
16
+
17
+ export const Empty: Story = {};
18
+
19
+ export const WrongPassword: Story = {
20
+ args: {
21
+ email: "owner@example.com",
22
+ error: {
23
+ message: "Wrong email or password.",
24
+ fix: "Check both and try again. It is the password you sign in to remit with.",
25
+ reportUrl: mcpErrorFixture.reportUrl,
26
+ },
27
+ },
28
+ play: async ({ canvasElement }) => {
29
+ const canvas = within(canvasElement);
30
+ await expect(canvas.getByRole("alert")).toHaveTextContent(
31
+ "Wrong email or password.",
32
+ );
33
+ await expect(canvas.getByLabelText("Email")).toHaveValue(
34
+ "owner@example.com",
35
+ );
36
+ },
37
+ };
@@ -0,0 +1,58 @@
1
+ import { Button } from "./button.js";
2
+ import { Input } from "./input.js";
3
+ import { McpErrorNotice } from "./mcp-error-notice.js";
4
+ import { McpPage, type McpPageError } from "./mcp-page.js";
5
+
6
+ export interface McpLoginPageProps {
7
+ hiddenFields: Readonly<Record<string, string>>;
8
+ email?: string;
9
+ error?: McpPageError;
10
+ }
11
+
12
+ export function McpLoginPage({
13
+ hiddenFields,
14
+ email,
15
+ error,
16
+ }: McpLoginPageProps) {
17
+ return (
18
+ <McpPage
19
+ heading="Sign in to remit"
20
+ intro="Use the email and password you sign in to remit with."
21
+ >
22
+ {error && <McpErrorNotice error={error} />}
23
+ <form method="post" className="flex flex-col gap-4">
24
+ {Object.entries(hiddenFields).map(([name, value]) => (
25
+ <input key={name} type="hidden" name={name} value={value} />
26
+ ))}
27
+ <div className="flex flex-col gap-1 text-sm">
28
+ <label htmlFor="mcp-email" className="text-fg-muted">
29
+ Email
30
+ </label>
31
+ <Input
32
+ id="mcp-email"
33
+ name="email"
34
+ type="email"
35
+ autoComplete="username"
36
+ defaultValue={email}
37
+ placeholder="you@example.com"
38
+ required
39
+ />
40
+ </div>
41
+ <div className="flex flex-col gap-1 text-sm">
42
+ <label htmlFor="mcp-password" className="text-fg-muted">
43
+ Password
44
+ </label>
45
+ <Input
46
+ id="mcp-password"
47
+ name="password"
48
+ type="password"
49
+ autoComplete="current-password"
50
+ placeholder="Your password"
51
+ required
52
+ />
53
+ </div>
54
+ <Button type="submit">Sign in</Button>
55
+ </form>
56
+ </McpPage>
57
+ );
58
+ }
@@ -0,0 +1,27 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { McpPage } from "./mcp-page.js";
3
+
4
+ const meta: Meta<typeof McpPage> = {
5
+ title: "Playground/Proposed/MCP/McpPage",
6
+ tags: ["proposed"],
7
+ component: McpPage,
8
+ parameters: { layout: "fullscreen" },
9
+ };
10
+ export default meta;
11
+
12
+ type Story = StoryObj<typeof McpPage>;
13
+
14
+ export const WithIntro: Story = {
15
+ args: {
16
+ heading: "Connected apps",
17
+ intro: "These apps can use your mail.",
18
+ children: <p className="text-sm text-fg">Page content</p>,
19
+ },
20
+ };
21
+
22
+ export const HeadingOnly: Story = {
23
+ args: {
24
+ heading: "Something went wrong",
25
+ children: <p className="text-sm text-fg">Page content</p>,
26
+ },
27
+ };
@@ -0,0 +1,35 @@
1
+ import type { ReactNode } from "react";
2
+ import { AuthCard } from "./auth-card.js";
3
+ import { AuthHero } from "./auth-hero.js";
4
+
5
+ export interface McpPermission {
6
+ scope: string;
7
+ description: string;
8
+ }
9
+
10
+ export interface McpPageError {
11
+ message: string;
12
+ fix: string;
13
+ reportUrl: string;
14
+ }
15
+
16
+ export interface McpPageProps {
17
+ heading: string;
18
+ intro?: ReactNode;
19
+ children: ReactNode;
20
+ }
21
+
22
+ export function McpPage({ heading, intro, children }: McpPageProps) {
23
+ return (
24
+ <AuthCard>
25
+ <AuthHero wordmark="remit" tagline="Connect your AI assistant" />
26
+ <main className="flex flex-col gap-4 rounded-lg border border-line bg-surface p-7 shadow-lg">
27
+ <div className="flex flex-col gap-1">
28
+ <h2 className="text-lg font-semibold text-fg">{heading}</h2>
29
+ {intro && <p className="text-sm text-fg-muted">{intro}</p>}
30
+ </div>
31
+ {children}
32
+ </main>
33
+ </AuthCard>
34
+ );
35
+ }
@@ -0,0 +1,21 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { mcpPermissionsFixture } from "./mcp-fixtures.js";
3
+ import { McpPermissionList } from "./mcp-permission-list.js";
4
+
5
+ const meta: Meta<typeof McpPermissionList> = {
6
+ title: "Playground/Proposed/MCP/McpPermissionList",
7
+ tags: ["proposed"],
8
+ component: McpPermissionList,
9
+ parameters: { layout: "padded" },
10
+ };
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof McpPermissionList>;
14
+
15
+ export const AllScopes: Story = {
16
+ args: { permissions: mcpPermissionsFixture },
17
+ };
18
+
19
+ export const ReadOnly: Story = {
20
+ args: { permissions: mcpPermissionsFixture.slice(0, 1) },
21
+ };
@@ -0,0 +1,22 @@
1
+ import { Check } from "lucide-react";
2
+ import type { McpPermission } from "./mcp-page.js";
3
+
4
+ export interface McpPermissionListProps {
5
+ permissions: readonly McpPermission[];
6
+ }
7
+
8
+ export function McpPermissionList({ permissions }: McpPermissionListProps) {
9
+ return (
10
+ <ul className="flex flex-col gap-2 text-sm">
11
+ {permissions.map((permission) => (
12
+ <li key={permission.scope} className="flex items-start gap-2 text-fg">
13
+ <Check
14
+ className="mt-0.5 size-4 shrink-0 text-positive"
15
+ aria-hidden="true"
16
+ />
17
+ <span>{permission.description}</span>
18
+ </li>
19
+ ))}
20
+ </ul>
21
+ );
22
+ }
@@ -14,19 +14,6 @@ import { MessageBodyView } from "./message-body-view.js";
14
14
  * Storybook stories.
15
15
  */
16
16
  describe("MessageBodyView", () => {
17
- it("renders the empty state when there is no html or text", () => {
18
- const html = renderToString(createElement(MessageBodyView, {}));
19
- assert.match(html, /This message has no body content\./);
20
- });
21
-
22
- it("renders plain text in a pre block (no sanitizer needed)", () => {
23
- const html = renderToString(
24
- createElement(MessageBodyView, { text: "Just a plain note." }),
25
- );
26
- assert.match(html, /Just a plain note\./);
27
- assert.match(html, /email-text/);
28
- });
29
-
30
17
  it("does not emit raw email HTML without a DOM to sanitize it", () => {
31
18
  // No DOM ⇒ cannot DOMPurify ⇒ the component must NOT paint the HTML.
32
19
  const html = renderToString(
@@ -48,12 +35,4 @@ describe("MessageBodyView", () => {
48
35
  assert.doesNotMatch(html, /html body/);
49
36
  assert.match(html, /plain fallback/);
50
37
  });
51
-
52
- it("applies the message-body wrapper class", () => {
53
- const html = renderToString(
54
- createElement(MessageBodyView, { text: "x", className: "px-4" }),
55
- );
56
- assert.match(html, /message-body/);
57
- assert.match(html, /px-4/);
58
- });
59
38
  });
@@ -140,12 +140,6 @@ describe("the brief's filter panel inside the message list pane", () => {
140
140
  assert.equal(picked, "acc_work");
141
141
  });
142
142
 
143
- it("offers no source row without pills", () => {
144
- mount();
145
- openPanel();
146
- assert.doesNotMatch(container.textContent ?? "", /Work/);
147
- });
148
-
149
143
  it("draws the chips the caller holds and reports a toggle", () => {
150
144
  let toggled: string | undefined;
151
145
  mount({