@connextar/house 0.23.3 → 0.25.0

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 (69) hide show
  1. package/README.md +82 -22
  2. package/dist/account/data-contract.d.ts +20 -0
  3. package/dist/account/data-contract.d.ts.map +1 -1
  4. package/dist/account/data-contract.js +17 -3
  5. package/dist/account/data-contract.js.map +1 -1
  6. package/dist/account/index.d.ts +1 -1
  7. package/dist/account/index.d.ts.map +1 -1
  8. package/dist/account/index.js +1 -1
  9. package/dist/account/index.js.map +1 -1
  10. package/dist/admin/access.d.ts +22 -2
  11. package/dist/admin/access.d.ts.map +1 -1
  12. package/dist/admin/access.js +35 -7
  13. package/dist/admin/access.js.map +1 -1
  14. package/dist/admin/index.d.ts +1 -1
  15. package/dist/admin/index.d.ts.map +1 -1
  16. package/dist/admin/index.js +1 -1
  17. package/dist/admin/index.js.map +1 -1
  18. package/dist/admin/second-factor-index.d.ts +1 -1
  19. package/dist/admin/second-factor-index.d.ts.map +1 -1
  20. package/dist/admin/second-factor-index.js.map +1 -1
  21. package/dist/admin/second-factor.d.ts +17 -6
  22. package/dist/admin/second-factor.d.ts.map +1 -1
  23. package/dist/admin/second-factor.js +5 -3
  24. package/dist/admin/second-factor.js.map +1 -1
  25. package/dist/admin/view-as.d.ts +12 -3
  26. package/dist/admin/view-as.d.ts.map +1 -1
  27. package/dist/admin/view-as.js +6 -2
  28. package/dist/admin/view-as.js.map +1 -1
  29. package/dist/analytics/browser.js +2 -2
  30. package/dist/analytics/posthog-extensions.d.ts +19 -0
  31. package/dist/analytics/posthog-extensions.d.ts.map +1 -0
  32. package/dist/analytics/posthog-extensions.js +19 -0
  33. package/dist/analytics/posthog-extensions.js.map +1 -0
  34. package/dist/auth/step-up-index.d.ts +1 -1
  35. package/dist/auth/step-up-index.d.ts.map +1 -1
  36. package/dist/auth/step-up-index.js.map +1 -1
  37. package/dist/auth/step-up.d.ts +22 -0
  38. package/dist/auth/step-up.d.ts.map +1 -1
  39. package/dist/auth/step-up.js +8 -6
  40. package/dist/auth/step-up.js.map +1 -1
  41. package/dist/house.css +19 -0
  42. package/dist/whats-new/index.d.ts +1 -1
  43. package/dist/whats-new/index.d.ts.map +1 -1
  44. package/dist/whats-new/index.js +1 -1
  45. package/dist/whats-new/index.js.map +1 -1
  46. package/dist/whats-new/use-whats-new.d.ts +7 -1
  47. package/dist/whats-new/use-whats-new.d.ts.map +1 -1
  48. package/dist/whats-new/use-whats-new.js +10 -6
  49. package/dist/whats-new/use-whats-new.js.map +1 -1
  50. package/dist/words.d.ts +12 -0
  51. package/dist/words.d.ts.map +1 -0
  52. package/dist/words.js +17 -0
  53. package/dist/words.js.map +1 -0
  54. package/package.json +13 -2
  55. package/src/account/data-contract.ts +34 -4
  56. package/src/account/index.ts +3 -0
  57. package/src/admin/access.ts +50 -9
  58. package/src/admin/index.ts +2 -0
  59. package/src/admin/second-factor-index.ts +1 -0
  60. package/src/admin/second-factor.ts +19 -5
  61. package/src/admin/view-as.ts +20 -4
  62. package/src/analytics/browser.ts +2 -2
  63. package/src/analytics/posthog-extensions.ts +19 -0
  64. package/src/auth/step-up-index.ts +1 -1
  65. package/src/auth/step-up.ts +28 -6
  66. package/src/styles/house.css +19 -0
  67. package/src/whats-new/index.ts +1 -1
  68. package/src/whats-new/use-whats-new.ts +13 -6
  69. package/src/words.ts +16 -0
package/README.md CHANGED
@@ -444,6 +444,7 @@ plugins: [
444
444
  | `routes` | `STEP_UP_PASSKEY_ROUTES` | The routes that need a confirmation. To add one, keep the defaults: `[...STEP_UP_PASSKEY_ROUTES, "/my/route"]`. Other routes get a plain message. Router endpoints only: a server-only method such as `setPassword` has no path, so listing it guards nothing (see below). |
445
445
  | `maxAttempts` | `5` | Wrong codes and passwords one session may give before it has to sign in again. |
446
446
  | `onPasskeyAdded` | none | Called after `/passkey/verify-registration` succeeds. See below. |
447
+ | `messages` | the house's | The refusals in the app's words: `requiredForPasskey`, `required`, `locked`, `useCode`, `noPassword`. The codes stay the same, so a client still tells them apart by `code`. |
447
448
  | `enabled` | `true` | `false` turns the refusal off and keeps the endpoints, so a client that asks for status still gets an answer. `onPasskeyAdded` still runs. |
448
449
 
449
450
  `POST /step-up/password` is rate-limited the same way as Better Auth's own
@@ -614,7 +615,12 @@ export const access = adminAccess(
614
615
  {
615
616
  auth,
616
617
  recordPrefix: "admin-second-factor:",
617
- words: { "two-factor-off": { fixHref: "/settings?tab=security#two-factor" } },
618
+ words: {
619
+ places: {
620
+ securitySettings: "Settings › Account & security",
621
+ securitySettingsHref: "/settings?tab=security#two-factor",
622
+ },
623
+ },
618
624
  },
619
625
  );
620
626
 
@@ -648,6 +654,12 @@ An administrator gets in only when all of these hold, checked in this order:
648
654
  settings page the same sentence the route refused with. `toString` and arrays
649
655
  give `null`. `decideAdminAccess(facts, words)` is the pure decision, for an app
650
656
  that gathers the facts itself (Canisters).
657
+ - **The places are placeholders.** The house's sentences name no app's screens:
658
+ `{securitySettings}` (default "your account’s security settings"),
659
+ `{securitySettingsHref}` (default `/settings#two-factor`) and `{signInHref}`
660
+ (default `/sign-in`) are filled from `words.places`, and the two links to the
661
+ security settings gain `?admin=<reason>`. An app's own `message` may use the
662
+ same placeholders; its own `fixHref` is used as written.
651
663
  - `AdminRefusalError` (`status`, `reason`, `refusal`) and
652
664
  `assertAdminAccess(decision, makeError?)` are for code that answers by
653
665
  throwing. Pass `makeError` to throw the app's own `ForbiddenError`.
@@ -741,14 +753,14 @@ unproven session is asked to confirm it is them, and then refused anyway with
741
753
  `ADMIN_SECOND_FACTOR_REQUIRED`. AltEd met this. Listed first, the plugin says
742
754
  why at once. A test pins both orders.
743
755
 
744
- | Option | Default | What it does |
745
- | --------------------- | ---------------------- | --------------------------------------------------------------------------------- |
746
- | `isAdmin` | required | Whether the account is an administrator now, read from the database. |
747
- | `recordPrefix` | `admin-second-factor:` | The record's prefix. Pass the app's existing one. |
748
- | `trustedDeviceCounts` | `true` | A password sign-in on a trusted device counts, for an account with two-factor on. |
749
- | `onAdminSignedIn` | none | The sign-in event, for the app's audit log. |
750
- | `standing`, `scope` | `"admin"`, platform | The actor's standing and the event's scope. |
751
- | `messages` | the house's | `factorChange`, `passkeyNeedsTwoFactor`. |
756
+ | Option | Default | What it does |
757
+ | --------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
758
+ | `isAdmin` | required | Whether the account is an administrator now, read from the database. |
759
+ | `recordPrefix` | `admin-second-factor:` | The record's prefix. Pass the app's existing one. |
760
+ | `trustedDeviceCounts` | `true` | A password sign-in on a trusted device counts, for an account with two-factor on. |
761
+ | `onAdminSignedIn` | none | The sign-in event, for the app's audit log. |
762
+ | `standing`, `scope` | `"admin"`, platform | The actor's standing and the event's scope. |
763
+ | `messages` | the house's | `factorChange`, `passkeyNeedsTwoFactor`: a sentence, or `({ path, factor }) => string` to say which change was refused (`factor` is `"passkey"` or `"two-factor"`). |
752
764
 
753
765
  Expired records for the same account are swept whenever a new one is written.
754
766
 
@@ -865,8 +877,11 @@ AltEd's rules, made safe by default:
865
877
 
866
878
  - **The words are the app's.** `viewingAsGate`, `refuseWhileViewingAs` and
867
879
  `viewAsWriteGuard` take `appName` ("You’re viewing Quickie as Pat. Stop
868
- viewing as them before sending an email.") or `message`, a template
869
- `({ name, what, appName }) => string` for the whole sentence.
880
+ viewing as them before sending an email.") or `message`, the whole sentence:
881
+ a template with `{app}`, `{name}` and `{what}` —
882
+ `"You are viewing {app} as {name}. Stop viewing as them before {what}."` — or
883
+ `({ name, what, appName }) => string` for anything a template can't say.
884
+ `undetermined` words the refusal when the lookup throws (`{what}`).
870
885
  `viewingAsMessage(name, what, words)` gives the same sentence anywhere else.
871
886
  Quickie's regex rewrite of the house's text (`inQuickieWords`) goes, since it
872
887
  would have stopped matching silently at the first changed character.
@@ -1105,7 +1120,14 @@ wrappers the same way.
1105
1120
  ### `@connextar/house/account`
1106
1121
 
1107
1122
  The contract for "your data" and "delete my account" — types, the export notice,
1108
- and the sole-owner refusal message. The _implementation_ stays per-app, because
1123
+ and the sole-owner refusal message.
1124
+
1125
+ The notice is in the app's words: `accountExportNotice({ authored, place })` —
1126
+ `authored` is what people write in the app ("notes, interactions and expenses"),
1127
+ `place` where it belongs ("business", "workspace"). The defaults are generic
1128
+ ("notes and other records", "organisation"); `template` replaces the whole
1129
+ notice for an app where authored work belongs to nobody else, and may use
1130
+ `{authored}` and `{place}`. `ACCOUNT_EXPORT_NOTICE` is the generic notice. The _implementation_ stays per-app, because
1109
1131
  an export is a walk over that app's Prisma schema. What must not be per-app is
1110
1132
  the shape of the answer, since that is what a person receives and a regulator
1111
1133
  reads.
@@ -1244,6 +1266,10 @@ if (!news.data) return null;
1244
1266
  </Dialog>;
1245
1267
  ```
1246
1268
 
1269
+ A failed save is reported through the app's `ActionFeedbackProvider`;
1270
+ `labels: { saveFailedTitle, saveFailedText }` puts it in the app's words
1271
+ (`WHATS_NEW_SAVE_LABELS` are the house's).
1272
+
1247
1273
  **The dialog is yours**, as the setup guide's panel is: every app already has
1248
1274
  one, with its own idea of how it appears and where focus goes, so this ships
1249
1275
  what goes inside it. `WhatsNewTitle` is an `<h2>` that passes its props through
@@ -3367,15 +3393,16 @@ their code. AltEd did none of the three. That was the open finding
3367
3393
  consent at all, and MAS and Canisters render GTM on every page. senco imports
3368
3394
  posthog-js and never initialises it.
3369
3395
 
3370
- | Entry point | What | Imports |
3371
- | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
3372
- | `@connextar/house/analytics` | `defineAnalytics`, `createRedactor`, `ingestProxy`, `logsSink`, the marker attributes | nothing |
3373
- | `/analytics/client` | `createBrowserAnalytics`: consent, GTM, PostHog's config, the gate, replay | nothing; the app's posthog-js is handed in |
3374
- | `/analytics/react` | `<SiteAnalytics>`, `<ConsentKnownScript>`, `<CookieSettingsButton>`, `<RecordingAllowed>`, `<NotMeasured>`, `useAnalyticsConsent` | React, `next/navigation.js` |
3375
- | `/analytics/server` | `createServerAnalytics` (error reports, events), `measurementProtocol` | nothing; posthog-node and `after` are handed in |
3396
+ | Entry point | What | Imports |
3397
+ | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
3398
+ | `@connextar/house/analytics` | `defineAnalytics`, `createRedactor`, `ingestProxy`, `logsSink`, the marker attributes | nothing |
3399
+ | `/analytics/client` | `createBrowserAnalytics`: consent, GTM, PostHog's config, the gate, replay | nothing; the app's posthog-js is handed in |
3400
+ | `/analytics/react` | `<SiteAnalytics>`, `<ConsentKnownScript>`, `<CookieSettingsButton>`, `<RecordingAllowed>`, `<NotMeasured>`, `useAnalyticsConsent` | React, `next/navigation.js` |
3401
+ | `/analytics/server` | `createServerAnalytics` (error reports, events), `measurementProtocol` | nothing; posthog-node and `after` are handed in |
3402
+ | `/analytics/posthog-extensions` | imported for its effect, before `posthog.init`: posthog-js's two lazy-loaded scripts, bundled | the app's posthog-js (optional peer) |
3376
3403
 
3377
3404
  The server half imports no browser package, and in fact no package at all.
3378
- `entry-points.test.ts` holds all four against the build, so a server route can
3405
+ `entry-points.test.ts` holds all five against the build, so a server route can
3379
3406
  never pull posthog-js into its bundle and the PostHog versions stay the app's.
3380
3407
  `browser.test.ts` and `server.test.ts` check the structural types against
3381
3408
  posthog-js 1.438 and posthog-node 5.56 themselves.
@@ -3403,6 +3430,7 @@ export const browser = createBrowserAnalytics(analytics);
3403
3430
 
3404
3431
  // instrumentation-client.ts
3405
3432
  import posthog from "posthog-js";
3433
+ import "@connextar/house/analytics/posthog-extensions"; // before init: no fetch of /ingest/static/*.js on any page
3406
3434
  if (process.env.NEXT_PUBLIC_POSTHOG_KEY) posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, browser.posthogConfig());
3407
3435
 
3408
3436
  // components/analytics/site-analytics.tsx — the app's own client wrapper, since a definition holding functions
@@ -3581,9 +3609,23 @@ databaseHooks: { user: { create: { after: async (_user, context) => ga4.recordSi
3581
3609
  | senco | posthog-js imported, never initialised; server events with a viewing-as gate, no redaction | the server half (events redacted, its gate kept, error reports). The browser half only if the owner wants public-page measurement. |
3582
3610
 
3583
3611
  Each app's own cookie card in Settings keeps its UI primitives and takes
3584
- `useAnalyticsConsent(browser)`. The pre-paint CSS rule,
3585
- `html[data-consent-known] [data-cookie-card]:not([data-reopened]) { display: none }`,
3586
- stays in each app's global stylesheet. The env names are already the same
3612
+ `useAnalyticsConsent(browser)`. The CSS that keeps the card off screen before
3613
+ first paint ships in `house.css` since 0.24.0: once an answer is stored
3614
+ (`html[data-consent-known]`), and on a page carrying `data-analytics-private`
3615
+ or `data-viewing-as`, which an address alone would call public. An app that
3616
+ copied the first rule into its own stylesheet deletes it. An app's own
3617
+ `renderCard` puts `data-cookie-card` on its root, and `data-reopened` while
3618
+ reopened, or none of it applies.
3619
+
3620
+ **posthog-js's lazy scripts.** posthog-js fetches the exception autocapture
3621
+ (error reports) and the dead-clicks autocapture (heatmaps, whatever
3622
+ `capture_dead_clicks` says) from `<api_host>/static/` on every page, unless
3623
+ they are already registered on `window.__PosthogExtensions__`. Import
3624
+ `@connextar/house/analytics/posthog-extensions` before `posthog.init` and they
3625
+ come from the app's bundle instead: a `<NotMeasured />` page then makes no
3626
+ request to the relay at all, and nothing depends on the relay serving scripts.
3627
+ PharmaLine found it in 0.27.5. The package's `sideEffects` names the file, so a
3628
+ bundler does not drop the bare import. The env names are already the same
3587
3629
  everywhere: `NEXT_PUBLIC_POSTHOG_KEY`, `NEXT_PUBLIC_POSTHOG_HOST`,
3588
3630
  `NEXT_PUBLIC_GTM_ID`, `GA4_MEASUREMENT_ID`, `GA4_API_SECRET`.
3589
3631
 
@@ -3747,6 +3789,13 @@ mounted`. Inline the package so vite transforms it:
3747
3789
  factory silently replaces the first, and an assertion on `router.refresh` then
3748
3790
  watches a spy nothing ever called — a test that passes while proving nothing.
3749
3791
  Build the spies once at module scope and return those from both factories.
3792
+ - **Check that the relay's logs route is committed.** A `.gitignore` with a
3793
+ bare `logs` rule (the usual debug-logs line) also ignores
3794
+ `app/ingest/i/v1/logs/route.ts`. Canisters and FB Web shipped without it, and
3795
+ the catch-all relay then answered `/ingest/i/v1/logs` with a 404. Add
3796
+ `!app/ingest/i/v1/logs/` after the rule, and confirm with
3797
+ `git ls-files app/ingest`. `git status` shows such a file as ignored, not
3798
+ untracked, so it is easy to miss.
3750
3799
  - **A locale-aware app inlines its i18n package too.** `next-intl`'s
3751
3800
  `createNavigation` also imports `next/navigation` extensionlessly, so with only
3752
3801
  the package inlined the whole suite fails to load: `inline: [/@connextar\/house/, /next-intl/]`.
@@ -3777,3 +3826,14 @@ Two questions, in order:
3777
3826
  function argument. This package imports no app's Prisma client, no app's
3778
3827
  design system and no app's routes, and that is what makes it droppable into
3779
3828
  the next one.
3829
+
3830
+ **Wording.** Every sentence a person can read is the app's to replace, and none
3831
+ names one app's things. A default that needs something only the app knows — its
3832
+ name, where its settings live, what its records are called — is a template with
3833
+ `{placeholders}` that the app fills once (`places`, `appName`, `authored`), and
3834
+ every sentence also takes the app's own text through `words`, `messages` or
3835
+ `labels`. An app never rewrites the house's text after the fact: Quickie matched
3836
+ the view-as refusal with a regex and FB Web re-threw the second-factor refusal in
3837
+ its own words, and either would have broken silently at the first changed
3838
+ character. Until 0.25.0 every app's data export told people their "notes,
3839
+ interactions, expenses" — Quickie's records — belonged to "the organisation".
@@ -24,6 +24,26 @@
24
24
  */
25
25
  /** Bumped when the export shape changes, so an old file stays readable. */
26
26
  export declare const ACCOUNT_EXPORT_SCHEMA_VERSION = 1;
27
+ /** The app's words for the export's notice. Every field is optional; the house's generic words fill the gaps. */
28
+ export interface AccountExportWords {
29
+ /** What the person authors in this app, as a list: "notes, interactions and expenses". Default "notes and other records". */
30
+ authored?: string;
31
+ /** Where authored work belongs: "organisation", "workspace", "family". Default "organisation". */
32
+ place?: string;
33
+ /**
34
+ * The whole notice, for an app the house's sentence does not fit — one where authored work belongs to nobody
35
+ * else. `{authored}` and `{place}` are filled in if it uses them.
36
+ */
37
+ template?: string;
38
+ }
39
+ export declare const ACCOUNT_EXPORT_NOTICE_TEMPLATE: string;
40
+ /**
41
+ * The notice at the top of an export, in the app's words. Quickie's sentence used to ship as the house's, so every
42
+ * app's export told people their "notes, interactions, expenses" belonged to "the organisation" — in apps with
43
+ * neither.
44
+ */
45
+ export declare function accountExportNotice(words?: AccountExportWords): string;
46
+ /** The generic notice. An app passes its own words to `accountExportNotice` instead. */
27
47
  export declare const ACCOUNT_EXPORT_NOTICE: string;
28
48
  /** A count of something the person authored. Never the contents. */
29
49
  export interface AuthoredSummary {
@@ -1 +1 @@
1
- {"version":3,"file":"data-contract.d.ts","sourceRoot":"","sources":["../../src/account/data-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C,eAAO,MAAM,qBAAqB,QAG+B,CAAC;AAElE,oEAAoE;AACpE,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,4EAA4E;IAC5E,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,IAAI,GAAG,MAAM,CAAA;KAAE,EAAE,CAAC;CACnF;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,6BAA6B,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,O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G,OAAO,CAEnF"}
@@ -22,11 +22,25 @@
22
22
  * erasable by its subject was never an audit trail. Re-deciding that in code
23
23
  * is how the two drift apart.
24
24
  */
25
+ import { fillWords } from "../words.js";
25
26
  /** Bumped when the export shape changes, so an old file stays readable. */
26
27
  export const ACCOUNT_EXPORT_SCHEMA_VERSION = 1;
27
- export const ACCOUNT_EXPORT_NOTICE = "This file contains the personal data we hold about you. Work you authored — notes, interactions, " +
28
- "expenses — belongs to the organisation it was created in and is summarised rather than included. " +
29
- "Ask an owner of that organisation for the records themselves.";
28
+ export const ACCOUNT_EXPORT_NOTICE_TEMPLATE = "This file contains the personal data we hold about you. Work you authored — {authored} — belongs to the " +
29
+ "{place} it was created in and is summarised rather than included. Ask an owner of that {place} for the " +
30
+ "records themselves.";
31
+ /**
32
+ * The notice at the top of an export, in the app's words. Quickie's sentence used to ship as the house's, so every
33
+ * app's export told people their "notes, interactions, expenses" belonged to "the organisation" — in apps with
34
+ * neither.
35
+ */
36
+ export function accountExportNotice(words = {}) {
37
+ return fillWords(words.template ?? ACCOUNT_EXPORT_NOTICE_TEMPLATE, {
38
+ authored: words.authored?.trim() || "notes and other records",
39
+ place: words.place?.trim() || "organisation",
40
+ });
41
+ }
42
+ /** The generic notice. An app passes its own words to `accountExportNotice` instead. */
43
+ export const ACCOUNT_EXPORT_NOTICE = accountExportNotice();
30
44
  /**
31
45
  * Why a deletion was refused, in words the person can act on.
32
46
  *
@@ -1 +1 @@
1
- {"version":3,"file":"data-contract.js","sourceRoot":"","sources":["../../src/account/data-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,qBAAqB,GAChC,mGAAmG;IACnG,mGAAmG;IACnG,+DAA+D,CAAC;AA8DlE;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAA2B;IAChE,MAAM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A6B,KAAK,6DAA6D;QAC/F,+BAA+B,CAChC,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,6BAA6B,CAAC,SAA4B;IACxE,OAAO,SAAS,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;AACpD,CAAC"}
@@ -1,2 +1,2 @@
1
- export { ACCOUNT_EXPORT_NOTICE, ACCOUNT_EXPORT_SCHEMA_VERSION, deletionBlockedMessage, deletionDestroysOrganisations, type AccountExport, type AccountExportSignIn, type AuthoredSummary, type DeletionBlocker, type DeletionPreflight, } from "./data-contract.js";
1
+ export { ACCOUNT_EXPORT_NOTICE, ACCOUNT_EXPORT_NOTICE_TEMPLATE, ACCOUNT_EXPORT_SCHEMA_VERSION, accountExportNotice, type AccountExportWords, deletionBlockedMessage, deletionDestroysOrganisations, type AccountExport, type AccountExportSignIn, type AuthoredSummary, type DeletionBlocker, type DeletionPreflight, } from "./data-contract.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,6BAA6B,EAC7B,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,6BAA6B,EAC7B,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,6BAA6B,EAC7B,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,oBAAoB,CAAC"}
@@ -1,2 +1,2 @@
1
- export { ACCOUNT_EXPORT_NOTICE, ACCOUNT_EXPORT_SCHEMA_VERSION, deletionBlockedMessage, deletionDestroysOrganisations, } from "./data-contract.js";
1
+ export { ACCOUNT_EXPORT_NOTICE, ACCOUNT_EXPORT_NOTICE_TEMPLATE, ACCOUNT_EXPORT_SCHEMA_VERSION, accountExportNotice, deletionBlockedMessage, deletionDestroysOrganisations, } from "./data-contract.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,6BAA6B,GAM9B,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,6BAA6B,EAC7B,mBAAmB,EAEnB,sBAAsB,EACtB,6BAA6B,GAM9B,MAAM,oBAAoB,CAAC"}
@@ -48,8 +48,28 @@ export interface AdminRefusalWording {
48
48
  message?: string;
49
49
  fixHref?: string | null;
50
50
  }
51
- /** Per reason, the words and the link an app wants instead of the house's. */
52
- export type AdminRefusalWords = Partial<Record<AdminRefusalReason, AdminRefusalWording>>;
51
+ /**
52
+ * The places only the app knows, which the house's sentences and links name through placeholders. Set them once
53
+ * rather than rewriting whole sentences; an app's own `message` or `fixHref` may use the same placeholders.
54
+ */
55
+ export interface AdminPlaces {
56
+ /** Where two-factor is turned on, as the app's screens name it: "Settings › Account & security". `{securitySettings}`. */
57
+ securitySettings?: string;
58
+ /** That screen's address: "/settings?tab=security#two-factor". `{securitySettingsHref}`. */
59
+ securitySettingsHref?: string;
60
+ /** The sign-in page: "/login". `{signInHref}`. */
61
+ signInHref?: string;
62
+ }
63
+ export declare const DEFAULT_ADMIN_PLACES: Required<AdminPlaces>;
64
+ /** Per reason, the words and the link an app wants instead of the house's, and the places its sentences name. */
65
+ export type AdminRefusalWords = Partial<Record<AdminRefusalReason, AdminRefusalWording>> & {
66
+ places?: AdminPlaces;
67
+ };
68
+ /**
69
+ * The house's sentences and links, as templates. `{securitySettings}`, `{securitySettingsHref}` and `{signInHref}`
70
+ * are filled from `words.places`. The two links to the security settings also carry `?admin=<reason>`, so the page
71
+ * can say why the person was sent there (`adminRefusalFromParam`).
72
+ */
53
73
  export declare const DEFAULT_ADMIN_REFUSAL_WORDS: Record<AdminRefusalReason, Required<AdminRefusalWording>>;
54
74
  /** The refusal for a reason, in the app's words where it has them. */
55
75
  export declare function adminRefusal(reason: AdminRefusalReason, words?: AdminRefusalWords): AdminRefusal;
@@ -1 +1 @@
1
- {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/admin/access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjG;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,kBAAkB,GAC5B,YAAY,GAAG,WAAW,GAAG,gBAAgB,GAAG,+BAA+B,GAAG,eAAe,GAAG,YAAY,CAAC;AAEnH,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAO9D,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,kBAAkB,CAAC;IAC3B,iGAAiG;IACjG,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,0DAA0D;IAC1D,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;CACnB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,YAAY,CAAC;AAE9D,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,0EAA0E;IAC1E,aA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,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC/F,6FAA6F;IAC7F,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,sFAAsF;IACtF,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAAC;IAClD,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;CACnC;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,GAAE,kBAAuB,GAAG,WAAW,CA6CtG;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,EAC3C,KAAK,CAAC,EAAE,iBAAiB,GACxB,YAAY,GAAG,IAAI,CAGrB;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;gBAExB,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAOjE;AAED,kGAAkG;AAClG,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,GAAE,CAAC,OAAO,EAAE,YAAY,KAAK,KAAmD,GACxF,IAAI,CAEN"}
@@ -1,3 +1,4 @@
1
+ import { fillWords } from "../words.js";
1
2
  import { DEFAULT_ADMIN_PROOF_PREFIX, sessionProofReader } from "./proof.js";
2
3
  export const ADMIN_REFUSAL_REASONS = [
3
4
  "signed-out",
@@ -7,26 +8,44 @@ export const ADMIN_REFUSAL_REASONS = [
7
8
  "session-ended",
8
9
  "viewing-as",
9
10
  ];
11
+ export const DEFAULT_ADMIN_PLACES = {
12
+ securitySettings: "your account’s security settings",
13
+ securitySettingsHref: "/settings#two-factor",
14
+ signInHref: "/sign-in",
15
+ };
16
+ /**
17
+ * The house's sentences and links, as templates. `{securitySettings}`, `{securitySettingsHref}` and `{signInHref}`
18
+ * are filled from `words.places`. The two links to the security settings also carry `?admin=<reason>`, so the page
19
+ * can say why the person was sent there (`adminRefusalFromParam`).
20
+ */
10
21
  export const DEFAULT_ADMIN_REFUSAL_WORDS = {
11
- "signed-out": { message: "Sign in to use administration.", fixHref: "/sign-in" },
22
+ "signed-out": { message: "Sign in to use administration.", fixHref: "{signInHref}" },
12
23
  "session-ended": {
13
24
  message: "This sign-in has ended. Sign in again to use administration.",
14
- fixHref: "/sign-in",
25
+ fixHref: "{signInHref}",
15
26
  },
16
27
  "not-admin": { message: "Only an administrator can do that.", fixHref: null },
17
28
  "two-factor-off": {
18
- message: "Administration needs two-factor authentication on your account. Turn it on in Settings › Account & security, then come back.",
19
- fixHref: "/settings?admin=two-factor-off#two-factor",
29
+ message: "Administration needs two-factor authentication on your account. Turn it on in {securitySettings}, then come back.",
30
+ fixHref: "{securitySettingsHref}",
20
31
  },
21
32
  "sign-in-without-second-factor": {
22
33
  message: "Administration needs a sign-in that used your authenticator code or a passkey, and this one didn’t. Sign out, then sign in with your email, password and code — or with a passkey.",
23
- fixHref: "/settings?admin=sign-in-without-second-factor#two-factor",
34
+ fixHref: "{securitySettingsHref}",
24
35
  },
25
36
  "viewing-as": {
26
37
  message: "You’re viewing as somebody else. Stop viewing as them to use administration.",
27
38
  fixHref: null,
28
39
  },
29
40
  };
41
+ const SENT_TO_SETTINGS = new Set(["two-factor-off", "sign-in-without-second-factor"]);
42
+ /** `href` with `admin=<reason>` added to its query, before any `#fragment`. */
43
+ function withAdminParam(href, reason) {
44
+ const hash = href.indexOf("#");
45
+ const path = hash === -1 ? href : href.slice(0, hash);
46
+ const fragment = hash === -1 ? "" : href.slice(hash);
47
+ return `${path}${path.includes("?") ? "&" : "?"}admin=${encodeURIComponent(reason)}${fragment}`;
48
+ }
30
49
  const STATUS = {
31
50
  "signed-out": 401,
32
51
  "session-ended": 401,
@@ -39,11 +58,20 @@ const STATUS = {
39
58
  export function adminRefusal(reason, words = {}) {
40
59
  const own = words[reason];
41
60
  const fallback = DEFAULT_ADMIN_REFUSAL_WORDS[reason];
61
+ const places = { ...DEFAULT_ADMIN_PLACES };
62
+ for (const [key, value] of Object.entries(words.places ?? {}))
63
+ if (value?.trim())
64
+ places[key] = value.trim();
65
+ const ownHref = own && "fixHref" in own && own.fixHref !== undefined;
66
+ const href = ownHref ? own.fixHref : fallback.fixHref;
67
+ let fixHref = href === null ? null : fillWords(href, places);
68
+ if (fixHref !== null && !ownHref && SENT_TO_SETTINGS.has(reason))
69
+ fixHref = withAdminParam(fixHref, reason);
42
70
  return {
43
71
  ok: false,
44
72
  reason,
45
- message: own?.message ?? fallback.message,
46
- fixHref: own && "fixHref" in own && own.fixHref !== undefined ? own.fixHref : fallback.fixHref,
73
+ message: fillWords(own?.message ?? fallback.message, places),
74
+ fixHref,
47
75
  status: STATUS[reason],
48
76
  };
49
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/admin/access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAC;AAwBjG,MAAM,CAAC,MAAM,qBAAqB,GAAkC;IAClE,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,+BAA+B;IAC/B,eAAe;IACf,YAAY;CACb,CAAC;AAmCF,MAAM,CAAC,MAAM,2BAA2B,GAA8D;IACpG,YAAY,EAAE,EAAE,OAAO,EAAE,gCAAgC,EAAE,OAAO,EAAE,UAAU,EAAE;IAChF,eAAe,EAAE;QACf,OAAO,EAAE,8DAA8D;QACvE,OAAO,EAAE,UAAU;KACpB;IACD,WAAW,EAAE,EAAE,OAAO,EAAE,oCAAoC,EAAE,OAAO,EAAE,I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CAAC,MAAM,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;QAClE,CAAC;QACD,OAAO;QACP,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC;QAChD,KAAK;KACN,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAA2C,EAC3C,KAAyB;IAEzB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAE,qBAA2C,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5G,OAAO,YAAY,CAAC,KAA2B,EAAE,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,OAAO,CAAe;IACtB,MAAM,CAAY;IAClB,MAAM,CAAqB;IAEpC,YAAY,OAAqB,EAAE,OAA6B;QAC9D,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC/B,CAAC;CACF;AAED,kGAAkG;AAClG,MAAM,UAAU,iBAAiB,CAC/B,QAA6B,EAC7B,YAA8C,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC;IAEzF,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * are. The Better Auth plugin that records second-factor sign-ins is `@connextar/house/admin/second-factor`; the
6
6
  * notice and the banner are `@connextar/house/admin/client`; the guard-coverage sweep is `@connextar/house/admin/testing`.
7
7
  */
8
- export { ADMIN_REFUSAL_REASONS, AdminRefusalError, DEFAULT_ADMIN_REFUSAL_WORDS, adminAccess, adminRefusal, adminRefusalFromParam, assertAdminAccess, decideAdminAccess, type AdminAccess, type AdminAccessDecision, type AdminAccessFacts, type AdminAccessLookups, type AdminAccessOptions, type AdminRefusal, type AdminRefusalReason, type AdminRefusalWording, type AdminRefusalWords, type SignedIn, } from "./access.js";
8
+ export { ADMIN_REFUSAL_REASONS, AdminRefusalError, DEFAULT_ADMIN_PLACES, DEFAULT_ADMIN_REFUSAL_WORDS, adminAccess, adminRefusal, adminRefusalFromParam, assertAdminAccess, decideAdminAccess, type AdminAccess, type AdminAccessDecision, type AdminAccessFacts, type AdminAccessLookups, type AdminAccessOptions, type AdminPlaces, type AdminRefusal, type AdminRefusalReason, type AdminRefusalWording, type AdminRefusalWords, type SignedIn, } from "./access.js";
9
9
  export { PLATFORM_SCOPE, SUMMARY_MAX, adminSignedIn, emitSafely, platformAction, requestMeta, roleChanged, viewAsStarted, viewAsStopped, type AdminAuditActor, type AdminAuditEvent, type AdminAuditScope, type AdminAuditSink, type AdminSignInMethod, type AuditLogger, type RequestMeta, } from "./audit.js";
10
10
  export { bootstrapAdmin, bootstrapAdminArgs, type BootstrapAdminDeps, type BootstrapAdminRequest, type BootstrapAdminResult, type BootstrapRefusalReason, type BootstrapUser, } from "./bootstrap.js";
11
11
  export { DEFAULT_ADMIN_PROOF_PREFIX, adminProofIdentifier, isLiveProof, readVerificationValue, sessionProofReader, type AuthWithProofs, type ProofContext, type ProofRow, type StoreIdentifierOption, } from "./proof.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACj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B,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,WAAW,EACX,aAAa,EACb,UAAU,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,2BAA2B,EAChC,KAAK,MAAM,EACX,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * are. The Better Auth plugin that records second-factor sign-ins is `@connextar/house/admin/second-factor`; the
6
6
  * notice and the banner are `@connextar/house/admin/client`; the guard-coverage sweep is `@connextar/house/admin/testing`.
7
7
  */
8
- export { ADMIN_REFUSAL_REASONS, AdminRefusalError, DEFAULT_ADMIN_REFUSAL_WORDS, adminAccess, adminRefusal, adminRefusalFromParam, assertAdminAccess, decideAdminAccess, } from "./access.js";
8
+ export { ADMIN_REFUSAL_REASONS, AdminRefusalError, DEFAULT_ADMIN_PLACES, DEFAULT_ADMIN_REFUSAL_WORDS, adminAccess, adminRefusal, adminRefusalFromParam, assertAdminAccess, decideAdminAccess, } from "./access.js";
9
9
  export { PLATFORM_SCOPE, SUMMARY_MAX, adminSignedIn, emitSafely, platformAction, requestMeta, roleChanged, viewAsStarted, viewAsStopped, } from "./audit.js";
10
10
  export { bootstrapAdmin, bootstrapAdminArgs, } from "./bootstrap.js";
11
11
  export { DEFAULT_ADMIN_PROOF_PREFIX, adminProofIdentifier, isLiveProof, readVerificationValue, sessionProofReader, } from "./proof.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GAWlB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,WAAW,EACX,aAAa,EACb,UAAU,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,GAQd,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EACd,kBAAkB,GAMnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,kBAAkB,GAKnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GAiBjB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GAYlB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,WAAW,EACX,aAAa,EACb,UAAU,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,GAQd,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EACd,kBAAkB,GAMnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,kBAAkB,GAKnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GAiBjB,MAAM,cAAc,CAAC"}
@@ -3,6 +3,6 @@
3
3
  * made with a second factor, and refuses an administrator's factor change from a session that wasn't. Its own entry
4
4
  * point so `@connextar/house/admin` stays free of Better Auth for an app with its own auth.
5
5
  */
6
- export { ADMIN_PASSKEY_ADD_PATHS, ADMIN_PROVING_PATHS, ADMIN_SECOND_FACTOR_ERROR_CODES, ADMIN_SECOND_FACTOR_SESSIONS_ID, ADMIN_TWO_FACTOR_CHANGE_PATHS, adminSecondFactorSessions, type AdminSecondFactorSessionsOptions, type AdminSignIn, } from "./second-factor.js";
6
+ export { ADMIN_PASSKEY_ADD_PATHS, ADMIN_PROVING_PATHS, ADMIN_SECOND_FACTOR_ERROR_CODES, ADMIN_SECOND_FACTOR_SESSIONS_ID, ADMIN_TWO_FACTOR_CHANGE_PATHS, adminSecondFactorSessions, type AdminFactorChange, type AdminSecondFactorSessionsOptions, type AdminSignIn, } from "./second-factor.js";
7
7
  export { DEFAULT_ADMIN_PROOF_PREFIX, adminProofIdentifier, sessionProofReader } from "./proof.js";
8
8
  //# sourceMappingURL=second-factor-index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"second-factor-index.d.ts","sourceRoot":"","sources":["../../src/admin/second-factor-index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,+BAA+B,EAC/B,+BAA+B,EAC/B,6BAA6B,EAC7B,yBAAyB,EACzB,KAAK,gCAAgC,EACrC,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"second-factor-index.d.ts","sourceRoot":"","sources":["../../src/admin/second-factor-index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,+BAA+B,EAC/B,+BAA+B,EAC/B,6BAA6B,EAC7B,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,gCAAgC,EACrC,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"second-factor-index.js","sourceRoot":"","sources":["../../src/admin/second-factor-index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,+BAA+B,EAC/B,+BAA+B,EAC/B,6BAA6B,EAC7B,yBAAyB,GAG1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"second-factor-index.js","sourceRoot":"","sources":["../../src/admin/second-factor-index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,+BAA+B,EAC/B,+BAA+B,EAC/B,6BAA6B,EAC7B,yBAAyB,GAI1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
@@ -62,12 +62,20 @@ export interface AdminSecondFactorSessionsOptions {
62
62
  standing?: string;
63
63
  /** The sign-in event's scope. Default platform. */
64
64
  scope?: AdminAuditScope;
65
- /** The refusals' words. */
65
+ /**
66
+ * The refusals' words. Each is a sentence, or a function of the refused route for an app that says which change
67
+ * was refused — FB Web re-threw the plugin's error in its own words until it could.
68
+ */
66
69
  messages?: {
67
- factorChange?: string;
68
- passkeyNeedsTwoFactor?: string;
70
+ factorChange?: string | ((refused: AdminFactorChange) => string);
71
+ passkeyNeedsTwoFactor?: string | ((refused: AdminFactorChange) => string);
69
72
  };
70
73
  }
74
+ /** The route a factor-change refusal is for: adding a passkey, or reading or changing two-factor. */
75
+ export interface AdminFactorChange {
76
+ path: string;
77
+ factor: "passkey" | "two-factor";
78
+ }
71
79
  export interface AdminSignIn {
72
80
  userId: string;
73
81
  sessionId: string;
@@ -116,10 +124,13 @@ export declare function adminSecondFactorSessions(options: AdminSecondFactorSess
116
124
  standing?: string;
117
125
  /** The sign-in event's scope. Default platform. */
118
126
  scope?: AdminAuditScope;
119
- /** The refusals' words. */
127
+ /**
128
+ * The refusals' words. Each is a sentence, or a function of the refused route for an app that says which change
129
+ * was refused — FB Web re-threw the plugin's error in its own words until it could.
130
+ */
120
131
  messages?: {
121
- factorChange?: string;
122
- passkeyNeedsTwoFactor?: string;
132
+ factorChange?: string | ((refused: AdminFactorChange) => string);
133
+ passkeyNeedsTwoFactor?: string | ((refused: AdminFactorChange) => string);
123
134
  };
124
135
  };
125
136
  init(ctx: import("better-auth").AuthContext): {
@@ -1 +1 @@
1
- {"version":3,"file":"second-factor.d.ts","sourceRoot":"","sources":["../../src/admin/second-factor.ts"],"names":[],"mappings":"AASA,OAAO,EAAiB,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAU/G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,WAAW,gCAAgC;IAC/C,mGAAmG;IACnG,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAC9F,yHAAyH;IACzH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0HAA0H;IAC1H,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxF,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,2BAA2B;IAC3B,QAA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MAAM,CAAC,CAAC;YACjE,qBAAqB,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,iBAAiB,KAAK,MAAM,CAAC,CAAC;SAC3E;;;;;;;yCAwToC,UAAU,YAAY,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;EAenE"}
@@ -164,9 +164,11 @@ export function adminSecondFactorSessions(options) {
164
164
  const refusal = addsPasskey && !twoFactorOn
165
165
  ? ADMIN_SECOND_FACTOR_ERROR_CODES.ADMIN_PASSKEY_NEEDS_TWO_FACTOR
166
166
  : ADMIN_SECOND_FACTOR_ERROR_CODES.ADMIN_SECOND_FACTOR_REQUIRED;
167
- const message = refusal.code === "ADMIN_PASSKEY_NEEDS_TWO_FACTOR"
168
- ? (options.messages?.passkeyNeedsTwoFactor ?? refusal.message)
169
- : (options.messages?.factorChange ?? refusal.message);
167
+ const refused = { path: ctx.path, factor: addsPasskey ? "passkey" : "two-factor" };
168
+ const words = refusal.code === "ADMIN_PASSKEY_NEEDS_TWO_FACTOR"
169
+ ? options.messages?.passkeyNeedsTwoFactor
170
+ : options.messages?.factorChange;
171
+ const message = (typeof words === "function" ? words(refused) : words)?.trim() || refusal.message;
170
172
  throw new APIError("FORBIDDEN", { code: refusal.code, message });
171
173
  }),
172
174
  };