@remit/web-client 0.0.335 → 0.0.337

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.
@@ -1,4 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { AccountMenu as AccountMenuView } from "@remit/ui";
3
+ import { useOpenSettingsSection } from "../routing/sections";
4
+ import { useSettingsSlots } from "../settings-slots";
3
5
  import { AccountSession } from "./AccountSession";
4
- export const AccountMenu = () => (_jsx(AccountSession, { children: ({ email, signOut, securityUrl }) => (_jsx(AccountMenuView, { email: email, securityUrl: securityUrl, onSignOut: signOut })) }));
6
+ export const AccountMenu = () => {
7
+ const openSettingsSection = useOpenSettingsSection();
8
+ const slots = useSettingsSlots();
9
+ return (_jsx(AccountSession, { children: ({ email, signOut }) => (_jsx(AccountMenuView, { email: email, sections: slots.map(({ id, label, icon }) => ({ id, label, icon })), onOpenSection: openSettingsSection, onSignOut: signOut })) }));
10
+ };
@@ -8,7 +8,6 @@ import { type FC, type ReactNode } from "react";
8
8
  */
9
9
  export interface AuthAccount {
10
10
  email: string | null;
11
- securityUrl?: string;
12
11
  signOut: () => void | Promise<void>;
13
12
  }
14
13
  export interface AuthAccountProps {
@@ -13,6 +13,7 @@ import { Route as MailFlaggedRouteImport } from './routes/mail/flagged';
13
13
  import { Route as MailOutboxRouteImport } from './routes/mail/outbox';
14
14
  import { Route as ResetPasswordTokenRouteImport } from './routes/reset-password/$token';
15
15
  import { Route as SettingsIndexRouteImport } from './routes/settings/index';
16
+ import { Route as SettingsSlotIdRouteImport } from './routes/settings/$slotId';
16
17
  import { Route as SettingsAccountsRouteImport } from './routes/settings/accounts';
17
18
  import { Route as SettingsAdvancedRouteImport } from './routes/settings/advanced';
18
19
  import { Route as SettingsAppearanceRouteImport } from './routes/settings/appearance';
@@ -170,6 +171,7 @@ declare const MailOutboxRoute: import("@tanstack/router-core").Route<Register, i
170
171
  }, import("zod/v4/core").$strip>, import("@tanstack/router-core").ResolveParams<"/outbox">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
171
172
  declare const ResetPasswordTokenRoute: import("@tanstack/router-core").Route<Register, import("@tanstack/react-router").RootRoute<Register, undefined, import("./router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/reset-password/$token", "/reset-password/$token", "/reset-password/$token", "/reset-password/$token", undefined, import("@tanstack/router-core").ResolveParams<"/reset-password/$token">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, () => never, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
172
173
  declare const SettingsIndexRoute: import("@tanstack/router-core").Route<Register, import("@tanstack/router-core").Route<Register, import("@tanstack/react-router").RootRoute<Register, undefined, import("./router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/settings", "/settings", "/settings", "/settings", undefined, import("@tanstack/router-core").ResolveParams<"/settings">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/", "/settings/", "/settings/", "/settings/", undefined, import("@tanstack/router-core").ResolveParams<"/">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
174
+ declare const SettingsSlotIdRoute: import("@tanstack/router-core").Route<Register, import("@tanstack/router-core").Route<Register, import("@tanstack/react-router").RootRoute<Register, undefined, import("./router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/settings", "/settings", "/settings", "/settings", undefined, import("@tanstack/router-core").ResolveParams<"/settings">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/$slotId", "/settings/$slotId", "/settings/$slotId", "/settings/$slotId", undefined, import("@tanstack/router-core").ResolveParams<"/$slotId">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
173
175
  declare const SettingsAccountsRoute: import("@tanstack/router-core").Route<Register, import("@tanstack/router-core").Route<Register, import("@tanstack/react-router").RootRoute<Register, undefined, import("./router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/settings", "/settings", "/settings", "/settings", undefined, import("@tanstack/router-core").ResolveParams<"/settings">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/accounts", "/settings/accounts", "/settings/accounts", "/settings/accounts", import("zod").ZodObject<{
174
176
  editAccountId: import("zod").ZodOptional<import("zod").ZodString>;
175
177
  focusSmtp: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -583,6 +585,7 @@ export interface FileRoutesByFullPath {
583
585
  '/mail/flagged': typeof MailFlaggedRouteWithChildren;
584
586
  '/mail/outbox': typeof MailOutboxRouteWithChildren;
585
587
  '/reset-password/$token': typeof ResetPasswordTokenRoute;
588
+ '/settings/$slotId': typeof SettingsSlotIdRoute;
586
589
  '/settings/accounts': typeof SettingsAccountsRoute;
587
590
  '/settings/advanced': typeof SettingsAdvancedRoute;
588
591
  '/settings/appearance': typeof SettingsAppearanceRoute;
@@ -635,6 +638,7 @@ export interface FileRoutesByTo {
635
638
  '/import': typeof ImportRoute;
636
639
  '/onboarding': typeof OnboardingRoute;
637
640
  '/reset-password/$token': typeof ResetPasswordTokenRoute;
641
+ '/settings/$slotId': typeof SettingsSlotIdRoute;
638
642
  '/settings/accounts': typeof SettingsAccountsRoute;
639
643
  '/settings/advanced': typeof SettingsAdvancedRoute;
640
644
  '/settings/appearance': typeof SettingsAppearanceRoute;
@@ -689,6 +693,7 @@ export interface FileRoutesById {
689
693
  '/mail/flagged': typeof MailFlaggedRouteWithChildren;
690
694
  '/mail/outbox': typeof MailOutboxRouteWithChildren;
691
695
  '/reset-password/$token': typeof ResetPasswordTokenRoute;
696
+ '/settings/$slotId': typeof SettingsSlotIdRoute;
692
697
  '/settings/accounts': typeof SettingsAccountsRoute;
693
698
  '/settings/advanced': typeof SettingsAdvancedRoute;
694
699
  '/settings/appearance': typeof SettingsAppearanceRoute;
@@ -738,10 +743,10 @@ export interface FileRoutesById {
738
743
  }
739
744
  export interface FileRouteTypes {
740
745
  fileRoutesByFullPath: FileRoutesByFullPath;
741
- fullPaths: '/' | '/calendar' | '/import' | '/mail' | '/onboarding' | '/settings' | '/mail/$mailboxId' | '/mail/brief' | '/mail/flagged' | '/mail/outbox' | '/reset-password/$token' | '/settings/accounts' | '/settings/advanced' | '/settings/appearance' | '/settings/calendars' | '/settings/filters' | '/settings/folders' | '/settings/labels' | '/settings/people' | '/settings/senders' | '/settings/suggested-vips' | '/settings/warnings' | '/calendar/' | '/mail/' | '/settings/' | '/calendar/$view/$date' | '/mail/$mailboxId/$threadId' | '/mail/brief/$threadId' | '/mail/flagged/$threadId' | '/mail/$mailboxId/' | '/mail/brief/' | '/mail/flagged/' | '/mail/outbox/' | '/calendar/$view/$date/$calendarObjectId' | '/calendar/$view/$date/new' | '/mail/$mailboxId/$threadId/$messageId' | '/mail/$mailboxId/compose/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId' | '/mail/brief/compose/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId' | '/mail/flagged/compose/{-$outboxMessageId}' | '/mail/outbox/compose/{-$outboxMessageId}' | '/mail/outbox/draft/$outboxMessageId' | '/calendar/$view/$date/' | '/mail/$mailboxId/$threadId/' | '/mail/brief/$threadId/' | '/mail/flagged/$threadId/' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId' | '/calendar/$view/$date/$calendarObjectId/edit' | '/calendar/$view/$date/suggestion/$suggestionId' | '/calendar/$view/$date/task/$calendarTaskId' | '/calendar/$view/$date/$calendarObjectId/' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit' | '/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId/';
746
+ fullPaths: '/' | '/calendar' | '/import' | '/mail' | '/onboarding' | '/settings' | '/mail/$mailboxId' | '/mail/brief' | '/mail/flagged' | '/mail/outbox' | '/reset-password/$token' | '/settings/$slotId' | '/settings/accounts' | '/settings/advanced' | '/settings/appearance' | '/settings/calendars' | '/settings/filters' | '/settings/folders' | '/settings/labels' | '/settings/people' | '/settings/senders' | '/settings/suggested-vips' | '/settings/warnings' | '/calendar/' | '/mail/' | '/settings/' | '/calendar/$view/$date' | '/mail/$mailboxId/$threadId' | '/mail/brief/$threadId' | '/mail/flagged/$threadId' | '/mail/$mailboxId/' | '/mail/brief/' | '/mail/flagged/' | '/mail/outbox/' | '/calendar/$view/$date/$calendarObjectId' | '/calendar/$view/$date/new' | '/mail/$mailboxId/$threadId/$messageId' | '/mail/$mailboxId/compose/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId' | '/mail/brief/compose/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId' | '/mail/flagged/compose/{-$outboxMessageId}' | '/mail/outbox/compose/{-$outboxMessageId}' | '/mail/outbox/draft/$outboxMessageId' | '/calendar/$view/$date/' | '/mail/$mailboxId/$threadId/' | '/mail/brief/$threadId/' | '/mail/flagged/$threadId/' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId' | '/calendar/$view/$date/$calendarObjectId/edit' | '/calendar/$view/$date/suggestion/$suggestionId' | '/calendar/$view/$date/task/$calendarTaskId' | '/calendar/$view/$date/$calendarObjectId/' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit' | '/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId/';
742
747
  fileRoutesByTo: FileRoutesByTo;
743
- to: '/' | '/import' | '/onboarding' | '/reset-password/$token' | '/settings/accounts' | '/settings/advanced' | '/settings/appearance' | '/settings/calendars' | '/settings/filters' | '/settings/folders' | '/settings/labels' | '/settings/people' | '/settings/senders' | '/settings/suggested-vips' | '/settings/warnings' | '/calendar' | '/mail' | '/settings' | '/mail/$mailboxId' | '/mail/brief' | '/mail/flagged' | '/mail/outbox' | '/calendar/$view/$date/new' | '/mail/$mailboxId/$threadId/$messageId' | '/mail/$mailboxId/compose/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId' | '/mail/brief/compose/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId' | '/mail/flagged/compose/{-$outboxMessageId}' | '/mail/outbox/compose/{-$outboxMessageId}' | '/mail/outbox/draft/$outboxMessageId' | '/calendar/$view/$date' | '/mail/$mailboxId/$threadId' | '/mail/brief/$threadId' | '/mail/flagged/$threadId' | '/calendar/$view/$date/$calendarObjectId/edit' | '/calendar/$view/$date/suggestion/$suggestionId' | '/calendar/$view/$date/task/$calendarTaskId' | '/calendar/$view/$date/$calendarObjectId' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit' | '/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId';
744
- id: '__root__' | '/' | '/calendar' | '/import' | '/mail' | '/onboarding' | '/settings' | '/mail/$mailboxId' | '/mail/brief' | '/mail/flagged' | '/mail/outbox' | '/reset-password/$token' | '/settings/accounts' | '/settings/advanced' | '/settings/appearance' | '/settings/calendars' | '/settings/filters' | '/settings/folders' | '/settings/labels' | '/settings/people' | '/settings/senders' | '/settings/suggested-vips' | '/settings/warnings' | '/calendar/' | '/mail/' | '/settings/' | '/calendar/$view/$date' | '/mail/$mailboxId/$threadId' | '/mail/brief/$threadId' | '/mail/flagged/$threadId' | '/mail/$mailboxId/' | '/mail/brief/' | '/mail/flagged/' | '/mail/outbox/' | '/calendar/$view/$date/$calendarObjectId' | '/calendar/$view/$date/new' | '/mail/$mailboxId/$threadId/$messageId' | '/mail/$mailboxId/compose/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId' | '/mail/brief/compose/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId' | '/mail/flagged/compose/{-$outboxMessageId}' | '/mail/outbox/compose/{-$outboxMessageId}' | '/mail/outbox/draft/$outboxMessageId' | '/calendar/$view/$date/' | '/mail/$mailboxId/$threadId/' | '/mail/brief/$threadId/' | '/mail/flagged/$threadId/' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId' | '/calendar/$view/$date/$calendarObjectId/edit' | '/calendar/$view/$date/suggestion/$suggestionId' | '/calendar/$view/$date/task/$calendarTaskId' | '/calendar/$view/$date/$calendarObjectId/' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit' | '/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId/';
748
+ to: '/' | '/import' | '/onboarding' | '/reset-password/$token' | '/settings/$slotId' | '/settings/accounts' | '/settings/advanced' | '/settings/appearance' | '/settings/calendars' | '/settings/filters' | '/settings/folders' | '/settings/labels' | '/settings/people' | '/settings/senders' | '/settings/suggested-vips' | '/settings/warnings' | '/calendar' | '/mail' | '/settings' | '/mail/$mailboxId' | '/mail/brief' | '/mail/flagged' | '/mail/outbox' | '/calendar/$view/$date/new' | '/mail/$mailboxId/$threadId/$messageId' | '/mail/$mailboxId/compose/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId' | '/mail/brief/compose/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId' | '/mail/flagged/compose/{-$outboxMessageId}' | '/mail/outbox/compose/{-$outboxMessageId}' | '/mail/outbox/draft/$outboxMessageId' | '/calendar/$view/$date' | '/mail/$mailboxId/$threadId' | '/mail/brief/$threadId' | '/mail/flagged/$threadId' | '/calendar/$view/$date/$calendarObjectId/edit' | '/calendar/$view/$date/suggestion/$suggestionId' | '/calendar/$view/$date/task/$calendarTaskId' | '/calendar/$view/$date/$calendarObjectId' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit' | '/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId';
749
+ id: '__root__' | '/' | '/calendar' | '/import' | '/mail' | '/onboarding' | '/settings' | '/mail/$mailboxId' | '/mail/brief' | '/mail/flagged' | '/mail/outbox' | '/reset-password/$token' | '/settings/$slotId' | '/settings/accounts' | '/settings/advanced' | '/settings/appearance' | '/settings/calendars' | '/settings/filters' | '/settings/folders' | '/settings/labels' | '/settings/people' | '/settings/senders' | '/settings/suggested-vips' | '/settings/warnings' | '/calendar/' | '/mail/' | '/settings/' | '/calendar/$view/$date' | '/mail/$mailboxId/$threadId' | '/mail/brief/$threadId' | '/mail/flagged/$threadId' | '/mail/$mailboxId/' | '/mail/brief/' | '/mail/flagged/' | '/mail/outbox/' | '/calendar/$view/$date/$calendarObjectId' | '/calendar/$view/$date/new' | '/mail/$mailboxId/$threadId/$messageId' | '/mail/$mailboxId/compose/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId' | '/mail/brief/compose/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId' | '/mail/flagged/compose/{-$outboxMessageId}' | '/mail/outbox/compose/{-$outboxMessageId}' | '/mail/outbox/draft/$outboxMessageId' | '/calendar/$view/$date/' | '/mail/$mailboxId/$threadId/' | '/mail/brief/$threadId/' | '/mail/flagged/$threadId/' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId' | '/calendar/$view/$date/$calendarObjectId/edit' | '/calendar/$view/$date/suggestion/$suggestionId' | '/calendar/$view/$date/task/$calendarTaskId' | '/calendar/$view/$date/$calendarObjectId/' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit' | '/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}' | '/calendar/$view/$date/$calendarObjectId/$recurrenceId/';
745
750
  fileRoutesById: FileRoutesById;
746
751
  }
747
752
  export interface RootRouteChildren {
@@ -853,6 +858,13 @@ declare module '@tanstack/react-router' {
853
858
  preLoaderRoute: typeof SettingsIndexRouteImport;
854
859
  parentRoute: typeof SettingsRoute;
855
860
  };
861
+ '/settings/$slotId': {
862
+ id: '/settings/$slotId';
863
+ path: '/$slotId';
864
+ fullPath: '/settings/$slotId';
865
+ preLoaderRoute: typeof SettingsSlotIdRouteImport;
866
+ parentRoute: typeof SettingsRoute;
867
+ };
856
868
  '/settings/accounts': {
857
869
  id: '/settings/accounts';
858
870
  path: '/accounts';
@@ -1419,6 +1431,7 @@ declare const MailRouteWithChildren: import("@tanstack/router-core").Route<impor
1419
1431
  wizardFrom: import("zod").ZodCatch<import("zod").ZodOptional<import("zod").ZodLiteral<"search">>>;
1420
1432
  }, import("zod/v4/core").$strip>, import("@tanstack/router-core").ResolveParams<"/mail">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, ({ context: { queryClient } }: import("@tanstack/router-core").LoaderFnContext<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("./router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/mail", import("@tanstack/router-core").ResolveParams<"/mail">, {}, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, unknown, undefined>) => void, MailRouteChildren, unknown, unknown, unknown, undefined>;
1421
1433
  interface SettingsRouteChildren {
1434
+ SettingsSlotIdRoute: typeof SettingsSlotIdRoute;
1422
1435
  SettingsAccountsRoute: typeof SettingsAccountsRoute;
1423
1436
  SettingsAdvancedRoute: typeof SettingsAdvancedRoute;
1424
1437
  SettingsAppearanceRoute: typeof SettingsAppearanceRoute;
@@ -19,6 +19,7 @@ import { Route as MailFlaggedRouteImport } from './routes/mail/flagged';
19
19
  import { Route as MailOutboxRouteImport } from './routes/mail/outbox';
20
20
  import { Route as ResetPasswordTokenRouteImport } from './routes/reset-password/$token';
21
21
  import { Route as SettingsIndexRouteImport } from './routes/settings/index';
22
+ import { Route as SettingsSlotIdRouteImport } from './routes/settings/$slotId';
22
23
  import { Route as SettingsAccountsRouteImport } from './routes/settings/accounts';
23
24
  import { Route as SettingsAdvancedRouteImport } from './routes/settings/advanced';
24
25
  import { Route as SettingsAppearanceRouteImport } from './routes/settings/appearance';
@@ -132,6 +133,11 @@ const SettingsIndexRoute = SettingsIndexRouteImport.update({
132
133
  path: '/',
133
134
  getParentRoute: () => SettingsRoute,
134
135
  });
136
+ const SettingsSlotIdRoute = SettingsSlotIdRouteImport.update({
137
+ id: '/$slotId',
138
+ path: '/$slotId',
139
+ getParentRoute: () => SettingsRoute,
140
+ });
135
141
  const SettingsAccountsRoute = SettingsAccountsRouteImport.update({
136
142
  id: '/accounts',
137
143
  path: '/accounts',
@@ -431,6 +437,7 @@ const MailRouteChildren = {
431
437
  };
432
438
  const MailRouteWithChildren = MailRoute._addFileChildren(MailRouteChildren);
433
439
  const SettingsRouteChildren = {
440
+ SettingsSlotIdRoute: SettingsSlotIdRoute,
434
441
  SettingsAccountsRoute: SettingsAccountsRoute,
435
442
  SettingsAdvancedRoute: SettingsAdvancedRoute,
436
443
  SettingsAppearanceRoute: SettingsAppearanceRoute,
@@ -0,0 +1 @@
1
+ export declare const Route: import("@tanstack/router-core").Route<import("@tanstack/react-router").Register, import("@tanstack/router-core").Route<import("@tanstack/react-router").Register, import("@tanstack/react-router").RootRoute<import("@tanstack/react-router").Register, undefined, import("../../router").RouterContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/settings", "/settings", "/settings", "/settings", undefined, import("@tanstack/router-core").ResolveParams<"/settings">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, "/$slotId", "/settings/$slotId", "/settings/$slotId", "/settings/$slotId", undefined, import("@tanstack/router-core").ResolveParams<"/$slotId">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SettingsShell } from "@remit/ui";
3
+ import { createFileRoute, useNavigate } from "@tanstack/react-router";
4
+ import { useState } from "react";
5
+ import { NavLink } from "../../routing/nav-link";
6
+ import { useOpenSettingsSection } from "../../routing/sections";
7
+ import { useSettingsSlots } from "../../settings-slots";
8
+ import { useSettingsNavItems } from "../settings";
9
+ export const Route = createFileRoute("/settings/$slotId")({
10
+ component: SlotSettings,
11
+ });
12
+ function SlotSettings() {
13
+ const { slotId } = Route.useParams();
14
+ const slot = useSettingsSlots().find(({ id }) => id === slotId);
15
+ const navigate = useNavigate();
16
+ const navItems = useSettingsNavItems();
17
+ const openSettingsSection = useOpenSettingsSection();
18
+ const [helpOpen, setHelpOpen] = useState(true);
19
+ return (_jsx(SettingsShell, { items: navItems, activeId: slotId, title: slot ? slot.label : "Section not found", help: slot?.help, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: slot ? (_jsx(slot.Component, {})) : (_jsxs("div", { className: "space-y-3 text-sm text-fg-muted", children: [_jsx("p", { children: "This settings section doesn't exist." }), _jsx(NavLink, { to: "/settings", variant: "inline", children: "Back to settings" })] })) }));
20
+ }
@@ -13,7 +13,8 @@ import { DangerZone } from "../../components/settings/DangerZone";
13
13
  import { REDIRECT_STALL_MESSAGE, useRedirectEnded, } from "../../hooks/useRedirectEnded";
14
14
  import { useReturnFromRedirect } from "../../hooks/useReturnFromRedirect";
15
15
  import { formatRelativeTime } from "../../lib/format";
16
- import { SETTINGS_ID_TO_PATH, useSettingsNavItems } from "../settings";
16
+ import { useOpenSettingsSection } from "../../routing/sections";
17
+ import { useSettingsNavItems } from "../settings";
17
18
  import { accountsHelp } from "./-shared/help-copy";
18
19
  const accountsSearchSchema = z.object({
19
20
  editAccountId: z.string().optional(),
@@ -146,6 +147,7 @@ function AccountsSettings() {
146
147
  const search = Route.useSearch();
147
148
  const navigate = useNavigate({ from: Route.fullPath });
148
149
  const navItems = useSettingsNavItems();
150
+ const openSettingsSection = useOpenSettingsSection();
149
151
  const [helpOpen, setHelpOpen] = useState(true);
150
152
  const [showForm, setShowForm] = useState(false);
151
153
  const [showAddWizard, setShowAddWizard] = useState(false);
@@ -305,12 +307,7 @@ function AccountsSettings() {
305
307
  setEditingAccountId(null);
306
308
  setFocusSmtp(false);
307
309
  };
308
- const handleSelectNav = (id) => {
309
- const path = SETTINGS_ID_TO_PATH[id];
310
- if (path)
311
- void navigate({ to: path });
312
- };
313
- return (_jsxs(SettingsShell, { items: navItems, activeId: "accounts", title: "Accounts", description: "Every account keeps syncing \u2014 muted ones just stay out of unified views.", help: accountsHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: handleSelectNav, onBackToMail: () => void navigate({ to: "/mail" }), children: [successMessage && (_jsx(Banner, { tone: "success", variant: "soft", "data-testid": "oauth-success-banner", onDismiss: () => setSuccessMessage(null), children: successMessage })), oauthErrorMessage && (_jsx(Banner, { tone: "danger", variant: "soft", "data-testid": "oauth-error-banner", onDismiss: () => setOauthErrorMessage(null), children: oauthErrorMessage })), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Badge, { tone: "neutral", children: isPending || isError
310
+ return (_jsxs(SettingsShell, { items: navItems, activeId: "accounts", title: "Accounts", description: "Every account keeps syncing \u2014 muted ones just stay out of unified views.", help: accountsHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: [successMessage && (_jsx(Banner, { tone: "success", variant: "soft", "data-testid": "oauth-success-banner", onDismiss: () => setSuccessMessage(null), children: successMessage })), oauthErrorMessage && (_jsx(Banner, { tone: "danger", variant: "soft", "data-testid": "oauth-error-banner", onDismiss: () => setOauthErrorMessage(null), children: oauthErrorMessage })), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Badge, { tone: "neutral", children: isPending || isError
314
311
  ? "accounts"
315
312
  : `${config.accounts.length} ${config.accounts.length === 1 ? "account" : "accounts"}` }), _jsx(Button, { variant: "primary", size: "sm", icon: _jsx(Plus, { className: "size-3.5" }), onClick: () => setShowAddWizard(true), children: "Add account" })] }), isPending ? (_jsx(LoadingSkeleton, {})) : isError ? (_jsx(ErrorState, { title: "Couldn't load accounts", error: error, onRetry: () => {
316
313
  refetch();
@@ -10,8 +10,9 @@ import { ConfigTransferPanel } from "../../components/settings/ConfigTransferPan
10
10
  import { SelfUpdatePanel } from "../../components/settings/SelfUpdatePanel";
11
11
  import { TlsRootCaDownload } from "../../components/settings/TlsRootCaDownload";
12
12
  import { AppVersion } from "../../components/ui/AppVersion";
13
+ import { useOpenSettingsSection } from "../../routing/sections";
13
14
  import { getRuntimeConfig } from "../../runtime-config";
14
- import { SETTINGS_ID_TO_PATH, useSettingsNavItems } from "../settings";
15
+ import { useSettingsNavItems } from "../settings";
15
16
  import { advancedHelp } from "./-shared/help-copy";
16
17
  export const Route = createFileRoute("/settings/advanced")({
17
18
  component: AdvancedSettings,
@@ -19,11 +20,7 @@ export const Route = createFileRoute("/settings/advanced")({
19
20
  function AdvancedSettings() {
20
21
  const navigate = useNavigate();
21
22
  const navItems = useSettingsNavItems();
23
+ const openSettingsSection = useOpenSettingsSection();
22
24
  const [helpOpen, setHelpOpen] = useState(true);
23
- const handleSelectNav = (id) => {
24
- const path = SETTINGS_ID_TO_PATH[id];
25
- if (path)
26
- void navigate({ to: path });
27
- };
28
- return (_jsxs(SettingsShell, { items: navItems, activeId: "advanced", title: "Advanced", description: "Notification rules, export, and diagnostics.", help: advancedHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: handleSelectNav, onBackToMail: () => void navigate({ to: "/mail" }), children: [getRuntimeConfig().updateMode === "self" && _jsx(SelfUpdatePanel, {}), _jsx("div", { className: "mt-6 border-t border-line pt-4", children: _jsx(ConfigTransferPanel, {}) }), _jsx("div", { className: "mt-6 border-t border-line pt-4", children: _jsx("p", { className: "text-sm text-fg-muted", children: "Notification rules are coming in a future release." }) }), _jsx(TlsRootCaDownload, {}), _jsxs("div", { className: "border-t border-line pt-4 mt-4", children: [_jsx("p", { className: "text-sm font-medium text-fg mb-1", children: "About" }), _jsx(AppVersion, {})] })] }));
25
+ return (_jsxs(SettingsShell, { items: navItems, activeId: "advanced", title: "Advanced", description: "Notification rules, export, and diagnostics.", help: advancedHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: [getRuntimeConfig().updateMode === "self" && _jsx(SelfUpdatePanel, {}), _jsx("div", { className: "mt-6 border-t border-line pt-4", children: _jsx(ConfigTransferPanel, {}) }), _jsx("div", { className: "mt-6 border-t border-line pt-4", children: _jsx("p", { className: "text-sm text-fg-muted", children: "Notification rules are coming in a future release." }) }), _jsx(TlsRootCaDownload, {}), _jsxs("div", { className: "border-t border-line pt-4 mt-4", children: [_jsx("p", { className: "text-sm font-medium text-fg mb-1", children: "About" }), _jsx(AppVersion, {})] })] }));
29
26
  }
@@ -11,7 +11,8 @@ import { SegmentedControl, SettingsShell } from "@remit/ui";
11
11
  import { createFileRoute, useNavigate } from "@tanstack/react-router";
12
12
  import { useState } from "react";
13
13
  import { getThemePreference, setThemePreference, } from "../../lib/theme-preference";
14
- import { SETTINGS_ID_TO_PATH, useSettingsNavItems } from "../settings";
14
+ import { useOpenSettingsSection } from "../../routing/sections";
15
+ import { useSettingsNavItems } from "../settings";
15
16
  import { appearanceHelp } from "./-shared/help-copy";
16
17
  export const Route = createFileRoute("/settings/appearance")({
17
18
  component: AppearanceSettings,
@@ -31,6 +32,7 @@ function readDensity() {
31
32
  function AppearanceSettings() {
32
33
  const navigate = useNavigate();
33
34
  const navItems = useSettingsNavItems();
35
+ const openSettingsSection = useOpenSettingsSection();
34
36
  const [helpOpen, setHelpOpen] = useState(true);
35
37
  const [density, setDensity] = useState(readDensity);
36
38
  // Read the current stored preference so the picker reflects the boot-time value
@@ -46,12 +48,7 @@ function AppearanceSettings() {
46
48
  setTheme(value);
47
49
  setThemePreference(value); // persists + applies immediately
48
50
  };
49
- const handleSelectNav = (id) => {
50
- const path = SETTINGS_ID_TO_PATH[id];
51
- if (path)
52
- void navigate({ to: path });
53
- };
54
- return (_jsx(SettingsShell, { items: navItems, activeId: "appearance", title: "Appearance", description: "Display density and colour theme \u2014 instant-apply.", help: appearanceHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: handleSelectNav, onBackToMail: () => void navigate({ to: "/mail" }), children: _jsxs("div", { className: "space-y-5", children: [_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm font-medium text-fg", children: "Density" }), _jsx(SegmentedControl, { name: "density", "aria-label": "Density", value: density, onChange: handleDensity, options: [
51
+ return (_jsx(SettingsShell, { items: navItems, activeId: "appearance", title: "Appearance", description: "Display density and colour theme \u2014 instant-apply.", help: appearanceHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: _jsxs("div", { className: "space-y-5", children: [_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm font-medium text-fg", children: "Density" }), _jsx(SegmentedControl, { name: "density", "aria-label": "Density", value: density, onChange: handleDensity, options: [
55
52
  { value: "comfortable", label: "Comfortable" },
56
53
  { value: "compact", label: "Compact" },
57
54
  ] }), _jsx("p", { className: "text-xs text-fg-subtle", children: "Controls the spacing of message rows in the mail list." })] }), _jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm font-medium text-fg", children: "Theme" }), _jsx(SegmentedControl, { name: "theme", "aria-label": "Theme", value: theme, onChange: handleTheme, options: [
@@ -10,7 +10,8 @@ import { CalendarSubscriptionStatus } from "../../components/settings/CalendarSu
10
10
  import { useCalendarCollectionWrites } from "../../hooks/calendar/useCalendarCollectionWrites";
11
11
  import { useCalendarSubscriptions } from "../../hooks/calendar/useCalendarSubscriptions";
12
12
  import { useCalendars } from "../../hooks/calendar/useCalendars";
13
- import { SETTINGS_ID_TO_PATH, useSettingsNavItems } from "../settings";
13
+ import { useOpenSettingsSection } from "../../routing/sections";
14
+ import { useSettingsNavItems } from "../settings";
14
15
  export const Route = createFileRoute("/settings/calendars")({
15
16
  component: CalendarsSettings,
16
17
  });
@@ -18,16 +19,13 @@ const calendarsHelp = (_jsxs("div", { className: "space-y-3", children: [_jsx("p
18
19
  function CalendarsSettings() {
19
20
  const navigate = useNavigate();
20
21
  const navItems = useSettingsNavItems();
22
+ const openSettingsSection = useOpenSettingsSection();
21
23
  const [helpOpen, setHelpOpen] = useState(true);
22
24
  const { calendars, collections, timeZoneByCalendarId, isLoading } = useCalendars();
23
25
  const subscriptions = useCalendarSubscriptions();
24
26
  const { createCalendar, isWriting } = useCalendarCollectionWrites();
25
27
  const [createProblem, setCreateProblem] = useState("");
26
- return (_jsx(SettingsShell, { items: navItems, activeId: "calendars", title: "Calendars", description: "Add, rename and delete calendars, subscribe to a calendar feed, and share one with any client that can subscribe to a URL.", help: calendarsHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((open) => !open), onSelect: (id) => {
27
- const path = SETTINGS_ID_TO_PATH[id];
28
- if (path)
29
- void navigate({ to: path });
30
- }, onBackToMail: () => void navigate({ to: "/mail" }), children: isLoading ? (
28
+ return (_jsx(SettingsShell, { items: navItems, activeId: "calendars", title: "Calendars", description: "Add, rename and delete calendars, subscribe to a calendar feed, and share one with any client that can subscribe to a URL.", help: calendarsHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((open) => !open), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: isLoading ? (
31
29
  // biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-label on a loading skeleton is what assistive tech has to go on
32
30
  _jsx("div", { className: "h-24 animate-pulse rounded-sm border border-line bg-surface", "aria-busy": "true", "aria-label": "Loading calendars" })) : (_jsxs("div", { className: "space-y-4", children: [_jsx(CalendarDefaultSenderCard, {}), calendars.map((calendar) => {
33
31
  const collection = collections.find((candidate) => candidate.calendarId === calendar.id);
@@ -15,7 +15,8 @@ import { filterRunReportHref, filterToggleReportHref, } from "../../lib/filter-r
15
15
  import { buildMailboxRoleMap, labelForMailbox } from "../../lib/folder-roles";
16
16
  import { buildMoveOptions, folderDelimiter } from "../../lib/move-options";
17
17
  import { filterRunStatus } from "../../lib/organize/filter-run";
18
- import { SETTINGS_ID_TO_PATH, useSettingsNavItems } from "../settings";
18
+ import { useOpenSettingsSection } from "../../routing/sections";
19
+ import { useSettingsNavItems } from "../settings";
19
20
  export const Route = createFileRoute("/settings/filters")({
20
21
  component: FiltersSettings,
21
22
  });
@@ -74,14 +75,10 @@ export function AccountFilters({ account, }) {
74
75
  function FiltersSettings() {
75
76
  const navigate = useNavigate();
76
77
  const navItems = useSettingsNavItems();
78
+ const openSettingsSection = useOpenSettingsSection();
77
79
  const [helpOpen, setHelpOpen] = useState(true);
78
80
  const { data: config, isPending, isError, error, refetch, } = useQuery(configOperationsGetConfigOptions());
79
- const handleSelectNav = (id) => {
80
- const path = SETTINGS_ID_TO_PATH[id];
81
- if (path)
82
- void navigate({ to: path });
83
- };
84
- return (_jsx(SettingsShell, { items: navItems, activeId: "filters", title: "Filters", description: "Standing and temporary rules created by Organize, per account.", help: filtersHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: handleSelectNav, onBackToMail: () => void navigate({ to: "/mail" }), children: isPending ? (
81
+ return (_jsx(SettingsShell, { items: navItems, activeId: "filters", title: "Filters", description: "Standing and temporary rules created by Organize, per account.", help: filtersHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: isPending ? (
85
82
  // biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-label on loading skeleton provides useful context for assistive tech
86
83
  _jsx("div", { className: "h-24 animate-pulse rounded-sm border border-line bg-surface", "aria-busy": "true", "aria-label": "Loading accounts" })) : isError ? (_jsx(ErrorState, { title: "Couldn't load accounts", error: error, onRetry: () => {
87
84
  refetch();
@@ -12,7 +12,8 @@ import { guardFolderDeletion } from "../../lib/delete-folder";
12
12
  import { softErrorStatuses } from "../../lib/error-classifier";
13
13
  import { folderFailure } from "../../lib/folder-failure";
14
14
  import { buildMailboxRoleMap, CANONICAL_TO_NAV_ROLE, labelForMailbox, NAV_ROLE_TO_CANONICAL, } from "../../lib/folder-roles";
15
- import { SETTINGS_ID_TO_PATH, useSettingsNavItems } from "../settings";
15
+ import { useOpenSettingsSection } from "../../routing/sections";
16
+ import { useSettingsNavItems } from "../settings";
16
17
  export const Route = createFileRoute("/settings/folders")({
17
18
  component: FoldersSettings,
18
19
  });
@@ -128,14 +129,10 @@ function AccountFolders({ account }) {
128
129
  function FoldersSettings() {
129
130
  const navigate = useNavigate();
130
131
  const navItems = useSettingsNavItems();
132
+ const openSettingsSection = useOpenSettingsSection();
131
133
  const [helpOpen, setHelpOpen] = useState(true);
132
134
  const { data: config, isPending, isError, error, refetch, } = useQuery(configOperationsGetConfigOptions());
133
- const handleSelectNav = (id) => {
134
- const path = SETTINGS_ID_TO_PATH[id];
135
- if (path)
136
- void navigate({ to: path });
137
- };
138
- return (_jsx(SettingsShell, { items: navItems, activeId: "folders", title: "Folder roles", description: "Appoint which real folder fills each canonical role, per account.", help: _jsx(FolderRolesHelp, {}), helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: handleSelectNav, onBackToMail: () => void navigate({ to: "/mail" }), children: isPending ? (
135
+ return (_jsx(SettingsShell, { items: navItems, activeId: "folders", title: "Folder roles", description: "Appoint which real folder fills each canonical role, per account.", help: _jsx(FolderRolesHelp, {}), helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: isPending ? (
139
136
  // biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-label on loading skeleton provides useful context for assistive tech
140
137
  _jsx("div", { className: "h-24 animate-pulse rounded-sm border border-line bg-surface", "aria-busy": "true", "aria-label": "Loading accounts" })) : isError ? (_jsx(ErrorState, { title: "Couldn't load accounts", error: error, onRetry: () => {
141
138
  refetch();
@@ -7,7 +7,8 @@ import { useState } from "react";
7
7
  import { LabelsList } from "../../components/settings/LabelsList";
8
8
  import { useCreateLabel, useDeleteLabel, useLabelList, useUpdateLabel, } from "../../hooks/useLabels";
9
9
  import { deleteLabelConfirmCopy } from "../../lib/organize/label-delete-copy";
10
- import { SETTINGS_ID_TO_PATH, useSettingsNavItems } from "../settings";
10
+ import { useOpenSettingsSection } from "../../routing/sections";
11
+ import { useSettingsNavItems } from "../settings";
11
12
  export const Route = createFileRoute("/settings/labels")({
12
13
  component: LabelsSettings,
13
14
  });
@@ -57,14 +58,10 @@ function AccountLabels({ account }) {
57
58
  function LabelsSettings() {
58
59
  const navigate = useNavigate();
59
60
  const navItems = useSettingsNavItems();
61
+ const openSettingsSection = useOpenSettingsSection();
60
62
  const [helpOpen, setHelpOpen] = useState(true);
61
63
  const { data: config, isPending, isError, error, refetch, } = useQuery(configOperationsGetConfigOptions());
62
- const handleSelectNav = (id) => {
63
- const path = SETTINGS_ID_TO_PATH[id];
64
- if (path)
65
- void navigate({ to: path });
66
- };
67
- return (_jsx(SettingsShell, { items: navItems, activeId: "labels", title: "Labels", description: "Mark mail without moving it, per account.", help: labelsHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: handleSelectNav, onBackToMail: () => void navigate({ to: "/mail" }), children: isPending ? (
64
+ return (_jsx(SettingsShell, { items: navItems, activeId: "labels", title: "Labels", description: "Mark mail without moving it, per account.", help: labelsHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: isPending ? (
68
65
  // biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-label on loading skeleton provides useful context for assistive tech
69
66
  _jsx("div", { className: "h-24 animate-pulse rounded-sm border border-line bg-surface", "aria-busy": "true", "aria-label": "Loading accounts" })) : isError ? (_jsx(ErrorState, { title: "Couldn't load accounts", error: error, onRetry: () => {
70
67
  refetch();
@@ -3,7 +3,8 @@ import { SettingsShell } from "@remit/ui";
3
3
  import { createFileRoute, useNavigate } from "@tanstack/react-router";
4
4
  import { useState } from "react";
5
5
  import { PeoplePanel } from "../../components/settings/people/PeoplePanel";
6
- import { SETTINGS_ID_TO_PATH, useSettingsNavItems } from "../settings";
6
+ import { useOpenSettingsSection } from "../../routing/sections";
7
+ import { useSettingsNavItems } from "../settings";
7
8
  export const Route = createFileRoute("/settings/people")({
8
9
  component: PeopleSettings,
9
10
  });
@@ -11,10 +12,7 @@ const peopleHelp = (_jsxs("div", { className: "space-y-3", children: [_jsx("p",
11
12
  function PeopleSettings() {
12
13
  const navigate = useNavigate();
13
14
  const navItems = useSettingsNavItems();
15
+ const openSettingsSection = useOpenSettingsSection();
14
16
  const [helpOpen, setHelpOpen] = useState(true);
15
- return (_jsx(SettingsShell, { items: navItems, activeId: "people", title: "People", description: "Everyone with an account on this server.", help: peopleHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((open) => !open), onSelect: (id) => {
16
- const path = SETTINGS_ID_TO_PATH[id];
17
- if (path)
18
- void navigate({ to: path });
19
- }, onBackToMail: () => void navigate({ to: "/mail" }), children: _jsx(PeoplePanel, {}) }));
17
+ return (_jsx(SettingsShell, { items: navItems, activeId: "people", title: "People", description: "Everyone with an account on this server.", help: peopleHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((open) => !open), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: _jsx(PeoplePanel, {}) }));
20
18
  }
@@ -17,7 +17,8 @@ import { Search, Star, X } from "lucide-react";
17
17
  import { useCallback, useEffect, useState } from "react";
18
18
  import { useDebouncedValue } from "../../hooks/useDebouncedValue";
19
19
  import { formatDate } from "../../lib/format";
20
- import { SETTINGS_ID_TO_PATH, useSettingsNavItems } from "../settings";
20
+ import { useOpenSettingsSection } from "../../routing/sections";
21
+ import { useSettingsNavItems } from "../settings";
21
22
  import { sendersHelp } from "./-shared/help-copy";
22
23
  export const Route = createFileRoute("/settings/senders")({
23
24
  component: SendersSettings,
@@ -168,6 +169,7 @@ export function SearchGroupPane({ group, query, onCount, }) {
168
169
  function SendersSettings() {
169
170
  const navigate = useNavigate();
170
171
  const navItems = useSettingsNavItems();
172
+ const openSettingsSection = useOpenSettingsSection();
171
173
  const [group, setGroup] = useState("vip");
172
174
  const [query, setQuery] = useState("");
173
175
  const [helpOpen, setHelpOpen] = useState(true);
@@ -185,12 +187,7 @@ function SendersSettings() {
185
187
  setGroupCounts((prev) => ({ ...prev, [group]: m }));
186
188
  }, [group]);
187
189
  const total = groupCounts[group];
188
- const handleSelectNav = (id) => {
189
- const path = SETTINGS_ID_TO_PATH[id];
190
- if (path)
191
- void navigate({ to: path });
192
- };
193
- return (_jsx(SettingsShell, { items: navItems, activeId: "senders", title: "Senders & Rules", description: "Per-sender preferences \u2014 set with one key from any message, managed here.", flush: true, help: sendersHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: handleSelectNav, onBackToMail: () => void navigate({ to: "/mail" }), children: _jsxs("div", { className: "flex min-h-0 flex-1 flex-col lg:flex-row", children: [_jsx(SenderGroupSwitch, { active: group, onSelect: (g) => {
190
+ return (_jsx(SettingsShell, { items: navItems, activeId: "senders", title: "Senders & Rules", description: "Per-sender preferences \u2014 set with one key from any message, managed here.", flush: true, help: sendersHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: _jsxs("div", { className: "flex min-h-0 flex-1 flex-col lg:flex-row", children: [_jsx(SenderGroupSwitch, { active: group, onSelect: (g) => {
194
191
  setGroup(g);
195
192
  setQuery("");
196
193
  }, options: ["vip", "muted", "blocked"].map((g) => ({
@@ -3,7 +3,8 @@ import { SettingsShell } from "@remit/ui";
3
3
  import { createFileRoute, useNavigate } from "@tanstack/react-router";
4
4
  import { useState } from "react";
5
5
  import { WarningsPanel } from "../../components/settings/WarningsPanel";
6
- import { SETTINGS_ID_TO_PATH, useSettingsNavItems } from "../settings";
6
+ import { useOpenSettingsSection } from "../../routing/sections";
7
+ import { useSettingsNavItems } from "../settings";
7
8
  import { warningsHelp } from "./-shared/help-copy";
8
9
  export const Route = createFileRoute("/settings/warnings")({
9
10
  component: WarningsSettings,
@@ -11,11 +12,7 @@ export const Route = createFileRoute("/settings/warnings")({
11
12
  function WarningsSettings() {
12
13
  const navigate = useNavigate();
13
14
  const navItems = useSettingsNavItems();
15
+ const openSettingsSection = useOpenSettingsSection();
14
16
  const [helpOpen, setHelpOpen] = useState(true);
15
- const handleSelectNav = (id) => {
16
- const path = SETTINGS_ID_TO_PATH[id];
17
- if (path)
18
- void navigate({ to: path });
19
- };
20
- return (_jsx(SettingsShell, { items: navItems, activeId: "warnings", title: "Warnings", description: "Messages that failed to sync, and messages set aside.", help: warningsHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: handleSelectNav, onBackToMail: () => void navigate({ to: "/mail" }), children: _jsx(WarningsPanel, {}) }));
17
+ return (_jsx(SettingsShell, { items: navItems, activeId: "warnings", title: "Warnings", description: "Messages that failed to sync, and messages set aside.", help: warningsHelp, helpOpen: helpOpen, onToggleHelp: () => setHelpOpen((v) => !v), onSelect: openSettingsSection, onBackToMail: () => void navigate({ to: "/mail" }), children: _jsx(WarningsPanel, {}) }));
21
18
  }
@@ -10,7 +10,6 @@
10
10
  */
11
11
  import type { SettingsNavItem } from "@remit/ui";
12
12
  export declare const SETTINGS_NAV_ITEMS: SettingsNavItem[];
13
- export declare const SETTINGS_ID_TO_PATH: Record<string, string>;
14
13
  /**
15
14
  * The nav every settings page renders. People shows only once the server lists
16
15
  * people: it answers 404 while self sign-up is open or off self-host.
@@ -4,6 +4,7 @@ import { CalendarDays, Filter, FolderTree, Inbox, Palette, Tag, UserCog, Users,
4
4
  import { AdvancedNavIcon } from "../components/settings/AdvancedNavIcon";
5
5
  import { WarningsNavIcon } from "../components/settings/WarningsNavIcon";
6
6
  import { usePeople } from "../hooks/usePeople";
7
+ import { useSettingsSlots } from "../settings-slots";
7
8
  /* ------------------------------------------------------------------ */
8
9
  /* Nav items — single source of truth shared by all settings pages */
9
10
  /* ------------------------------------------------------------------ */
@@ -46,18 +47,6 @@ export const SETTINGS_NAV_ITEMS = [
46
47
  },
47
48
  { id: "advanced", label: "Advanced", icon: _jsx(AdvancedNavIcon, {}) },
48
49
  ];
49
- export const SETTINGS_ID_TO_PATH = {
50
- accounts: "/settings/accounts",
51
- senders: "/settings/senders",
52
- folders: "/settings/folders",
53
- filters: "/settings/filters",
54
- labels: "/settings/labels",
55
- calendars: "/settings/calendars",
56
- appearance: "/settings/appearance",
57
- warnings: "/settings/warnings",
58
- people: "/settings/people",
59
- advanced: "/settings/advanced",
60
- };
61
50
  const PEOPLE_NAV_ITEM = {
62
51
  id: "people",
63
52
  label: "People",
@@ -69,13 +58,16 @@ const PEOPLE_NAV_ITEM = {
69
58
  */
70
59
  export const useSettingsNavItems = () => {
71
60
  const people = usePeople();
61
+ const slots = useSettingsSlots();
62
+ const items = [...SETTINGS_NAV_ITEMS];
63
+ items.splice(1, 0, ...slots.map(({ id, label, icon }) => ({ id, label, icon })));
72
64
  if (!people.isSuccess)
73
- return SETTINGS_NAV_ITEMS;
74
- const advanced = SETTINGS_NAV_ITEMS.findIndex((item) => item.id === "advanced");
65
+ return items;
66
+ const advanced = items.findIndex((item) => item.id === "advanced");
75
67
  return [
76
- ...SETTINGS_NAV_ITEMS.slice(0, advanced),
68
+ ...items.slice(0, advanced),
77
69
  PEOPLE_NAV_ITEM,
78
- ...SETTINGS_NAV_ITEMS.slice(advanced),
70
+ ...items.slice(advanced),
79
71
  ];
80
72
  };
81
73
  /* ------------------------------------------------------------------ */
@@ -14,3 +14,8 @@ export declare function useGoToSection(): (section: AppSection) => void;
14
14
  * what it was about.
15
15
  */
16
16
  export declare function useConfigureAccountSmtp(): (accountId: string) => void;
17
+ /**
18
+ * Open a settings section by id. A built-in section matches its own literal
19
+ * route before `/settings/$slotId`, so one call reaches both kinds.
20
+ */
21
+ export declare function useOpenSettingsSection(): (slotId: string) => void;
@@ -31,3 +31,13 @@ export function useConfigureAccountSmtp() {
31
31
  });
32
32
  }, [navigate]);
33
33
  }
34
+ /**
35
+ * Open a settings section by id. A built-in section matches its own literal
36
+ * route before `/settings/$slotId`, so one call reaches both kinds.
37
+ */
38
+ export function useOpenSettingsSection() {
39
+ const navigate = useNavigate();
40
+ return useCallback((slotId) => {
41
+ navigate({ to: "/settings/$slotId", params: { slotId } });
42
+ }, [navigate]);
43
+ }
@@ -0,0 +1,14 @@
1
+ import { type ComponentType, type ReactNode } from "react";
2
+ /**
3
+ * A settings section the host registers. It routes at `/settings/<id>` and
4
+ * joins the settings nav beside the built-in sections.
5
+ */
6
+ export interface SettingsSlot {
7
+ id: string;
8
+ label: string;
9
+ icon: ReactNode;
10
+ Component: ComponentType;
11
+ help: ReactNode;
12
+ }
13
+ export declare const SettingsSlotsProvider: import("react").Provider<SettingsSlot[]>;
14
+ export declare const useSettingsSlots: () => SettingsSlot[];
@@ -0,0 +1,4 @@
1
+ import { createContext, useContext, } from "react";
2
+ const SettingsSlotsContext = createContext([]);
3
+ export const SettingsSlotsProvider = SettingsSlotsContext.Provider;
4
+ export const useSettingsSlots = () => useContext(SettingsSlotsContext);
@@ -1,10 +1,13 @@
1
1
  import { type AuthProvider } from "../auth/provider";
2
+ import { type SettingsSlot } from "../settings-slots";
2
3
  import "../lib/i18n";
3
4
  import "../index.css";
4
5
  import "../lib/client";
5
6
  export interface MountOptions {
6
7
  /** The identity system this build composes. */
7
8
  authProvider: AuthProvider;
9
+ /** Settings sections the host adds, each at `/settings/<id>`. */
10
+ settingsSlots?: SettingsSlot[];
8
11
  /** Element to mount into. Defaults to `#root`. */
9
12
  rootElementId?: string;
10
13
  }
@@ -14,4 +17,5 @@ export interface MountOptions {
14
17
  * primitive a deployment shares, with the identity system supplied by the
15
18
  * distributor rather than baked in.
16
19
  */
17
- export declare const mountApp: ({ authProvider, rootElementId, }: MountOptions) => void;
20
+ export declare const mountApp: ({ authProvider, settingsSlots, rootElementId, }: MountOptions) => void;
21
+ export type { SettingsSlot } from "../settings-slots";
@@ -15,6 +15,7 @@ import { TelemetryContext } from "../lib/telemetry-context";
15
15
  import { installThemeSync } from "../lib/theme";
16
16
  import { createAppRouter } from "../router";
17
17
  import { getRuntimeConfig } from "../runtime-config";
18
+ import { SettingsSlotsProvider } from "../settings-slots";
18
19
  import "../lib/i18n";
19
20
  import "../index.css";
20
21
  import "../lib/client"; // Initialize client with error interceptor
@@ -24,7 +25,7 @@ import "../lib/client"; // Initialize client with error interceptor
24
25
  * primitive a deployment shares, with the identity system supplied by the
25
26
  * distributor rather than baked in.
26
27
  */
27
- export const mountApp = ({ authProvider, rootElementId = "root", }) => {
28
+ export const mountApp = ({ authProvider, settingsSlots = [], rootElementId = "root", }) => {
28
29
  installConsoleErrorCatcher();
29
30
  installThemeSync();
30
31
  authProvider.configure();
@@ -51,11 +52,16 @@ export const mountApp = ({ authProvider, rootElementId = "root", }) => {
51
52
  });
52
53
  installStaleBuildReload();
53
54
  const router = createAppRouter(queryClient, telemetry);
55
+ for (const slot of settingsSlots) {
56
+ if (Object.hasOwn(router.routesByPath, `/settings/${slot.id}`)) {
57
+ throw new Error(`Settings slot "${slot.id}" collides with a built-in settings section`);
58
+ }
59
+ }
54
60
  telemetry.recordPageView(window.location.pathname);
55
61
  const rootElement = document.getElementById(rootElementId);
56
62
  if (!rootElement) {
57
63
  throw new Error(`Root element not found: #${rootElementId}`);
58
64
  }
59
65
  const { Shell } = authProvider;
60
- createRoot(rootElement).render(_jsx(StrictMode, { children: _jsx(TelemetryContext.Provider, { value: telemetry, children: _jsxs(QueryClientProvider, { client: queryClient, children: [_jsx(AuthProviderProvider, { value: authProvider, children: _jsx(Shell, { children: _jsx(RouterProvider, { router: router }) }) }), !import.meta.env.PROD && !getRuntimeConfig().disableDevtools && (_jsx(ReactQueryDevtools, { initialIsOpen: false }))] }) }) }));
66
+ createRoot(rootElement).render(_jsx(StrictMode, { children: _jsx(TelemetryContext.Provider, { value: telemetry, children: _jsxs(QueryClientProvider, { client: queryClient, children: [_jsx(AuthProviderProvider, { value: authProvider, children: _jsx(SettingsSlotsProvider, { value: settingsSlots, children: _jsx(Shell, { children: _jsx(RouterProvider, { router: router }) }) }) }), !import.meta.env.PROD && !getRuntimeConfig().disableDevtools && (_jsx(ReactQueryDevtools, { initialIsOpen: false }))] }) }) }));
61
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client",
3
- "version": "0.0.335",
3
+ "version": "0.0.337",
4
4
  "type": "module",
5
5
  "description": "Remit web client, published as composable primitives — the app shell, auth shells, and runtime config. A distributor imports what it composes and bundles it.",
6
6
  "exports": {
@@ -91,7 +91,7 @@
91
91
  },
92
92
  "dependencies": {
93
93
  "@hookform/resolvers": "5.4.0",
94
- "@remit/ui": "0.0.230",
94
+ "@remit/ui": "0.0.232",
95
95
  "@tanstack/react-query": "5.101.2",
96
96
  "@tanstack/react-query-devtools": "5.101.2",
97
97
  "@tanstack/react-router": "1.170.18",