@mano8/astro-auth-m8 2.1.0 → 2.3.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 (49) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +27 -0
  3. package/dist/src/runtime/api/auth.d.ts.map +1 -1
  4. package/dist/src/runtime/api/auth.js +12 -0
  5. package/dist/src/runtime/api/auth.js.map +1 -1
  6. package/dist/src/runtime/api/oauth.d.ts.map +1 -1
  7. package/dist/src/runtime/api/oauth.js +11 -2
  8. package/dist/src/runtime/api/oauth.js.map +1 -1
  9. package/dist/src/runtime/client.d.ts.map +1 -1
  10. package/dist/src/runtime/client.js +8 -0
  11. package/dist/src/runtime/client.js.map +1 -1
  12. package/dist/src/runtime/react/AuthErrorBoundary.d.ts +53 -0
  13. package/dist/src/runtime/react/AuthErrorBoundary.d.ts.map +1 -0
  14. package/dist/src/runtime/react/AuthErrorBoundary.js +58 -0
  15. package/dist/src/runtime/react/AuthErrorBoundary.js.map +1 -0
  16. package/dist/src/runtime/react/AuthProvider.d.ts.map +1 -1
  17. package/dist/src/runtime/react/AuthProvider.js +63 -15
  18. package/dist/src/runtime/react/AuthProvider.js.map +1 -1
  19. package/dist/src/runtime/react/default-ui/CallbackView.d.ts.map +1 -1
  20. package/dist/src/runtime/react/default-ui/CallbackView.js +5 -1
  21. package/dist/src/runtime/react/default-ui/CallbackView.js.map +1 -1
  22. package/dist/src/runtime/react/default-ui/SignupView.d.ts.map +1 -1
  23. package/dist/src/runtime/react/default-ui/SignupView.js +4 -1
  24. package/dist/src/runtime/react/default-ui/SignupView.js.map +1 -1
  25. package/dist/src/runtime/react/default-ui/StarterAccountPage.d.ts.map +1 -1
  26. package/dist/src/runtime/react/default-ui/StarterAccountPage.js +4 -1
  27. package/dist/src/runtime/react/default-ui/StarterAccountPage.js.map +1 -1
  28. package/dist/src/runtime/react/default-ui/StarterLoginPage.d.ts.map +1 -1
  29. package/dist/src/runtime/react/default-ui/StarterLoginPage.js +5 -1
  30. package/dist/src/runtime/react/default-ui/StarterLoginPage.js.map +1 -1
  31. package/dist/src/runtime/react/default-ui/StarterLogoutPage.d.ts +20 -0
  32. package/dist/src/runtime/react/default-ui/StarterLogoutPage.d.ts.map +1 -0
  33. package/dist/src/runtime/react/default-ui/StarterLogoutPage.js +20 -0
  34. package/dist/src/runtime/react/default-ui/StarterLogoutPage.js.map +1 -0
  35. package/dist/src/runtime/react/default-ui/index.d.ts +1 -0
  36. package/dist/src/runtime/react/default-ui/index.d.ts.map +1 -1
  37. package/dist/src/runtime/react/default-ui/index.js +1 -0
  38. package/dist/src/runtime/react/default-ui/index.js.map +1 -1
  39. package/dist/src/runtime/react/index.d.ts +1 -0
  40. package/dist/src/runtime/react/index.d.ts.map +1 -1
  41. package/dist/src/runtime/react/index.js +1 -0
  42. package/dist/src/runtime/react/index.js.map +1 -1
  43. package/dist/src/runtime/sessionHint.d.ts +35 -0
  44. package/dist/src/runtime/sessionHint.d.ts.map +1 -0
  45. package/dist/src/runtime/sessionHint.js +64 -0
  46. package/dist/src/runtime/sessionHint.js.map +1 -0
  47. package/package.json +11 -4
  48. package/registry/r/account-dashboard.json +1 -1
  49. package/src/routes/logout.astro +3 -3
package/CHANGELOG.md CHANGED
@@ -6,6 +6,102 @@ This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
  The major version tracks the supported `fa-auth-m8` **API contract**, not just
7
7
  this package's own surface: a backend contract repoint is always a major.
8
8
 
9
+ ## 2.3.0
10
+
11
+ Additive only; the supported backend contract stays `fa-auth-m8@2.0`, range
12
+ `>=2.0.0 <3.0.0`. A consumer already on `^2.2.0` resolves this release without
13
+ a manifest change; the fleet raised its floor to `^2.3.0` anyway, because the
14
+ refresh coordination below is behaviour its consumers depend on rather than an
15
+ optimisation they can afford to miss.
16
+
17
+ ### Fixed
18
+
19
+ - **The two refresh paths are coordinated** (remediation `W3.1`).
20
+ `AuthProvider`'s bootstrap called `refreshToken()` directly, bypassing the
21
+ `runRefresh` single-flight guard in `tokenStore.ts` that `client.ts`'s own
22
+ `401`-triggered refresh uses. Two independent guards over one *rotating*
23
+ token let a page mounting both paths against one expired token issue two
24
+ rotations — which `fa-auth-m8` correctly reads as token reuse and answers by
25
+ revoking every session for that account. `bootstrapSession()` now goes
26
+ through `runRefresh`, so whichever path reaches it first performs the
27
+ request and the other piggybacks on its resolved token. The existing
28
+ `bootstrapFailureUntil` cooldown is untouched; it is a separate concern
29
+ layered on top.
30
+ - **A transient failure no longer poisons the session hint.** The bootstrap
31
+ catch recorded "no session" on *any* error, and the hint has no expiry, so a
32
+ single `500` or one offline load made every later page load skip its refresh
33
+ and left a validly signed-in user looking signed out until they signed in by
34
+ hand. Only a `401` records the negative now; every other failure keeps the
35
+ retryable cooldown, which lapses and recovers on its own.
36
+ - **A session established outside `AuthProvider.login` clears the hint.** The
37
+ plugin's own `CallbackView` — and, more to the point, `fa-ui-m8`'s
38
+ `useGoogleLogin`, which calls `exchangeGoogleCode` + `setToken` directly and
39
+ then hard-navigates — never reached the provider's `login`, so a Google
40
+ sign-in after any earlier `401` landed on a page that skipped its bootstrap
41
+ and rendered as signed out. Rather than patch each UI, the hint now lives
42
+ beside `setToken`/`clearToken` at the points that actually establish or
43
+ destroy a session: login, logout, an honoured `refreshToken` (the only auth
44
+ call the sibling plugins make, through `installFaAuthBrowserAdapter`), a
45
+ completed OAuth exchange, and `client.ts`'s `401`-triggered rotation. Every
46
+ consumer is covered with no host change.
47
+ - **Every Web Storage access is guarded.** These are core sign-in paths, so an
48
+ environment with no `localStorage` — or one refusing access to it — must lose
49
+ the optimisation and never the sign-in.
50
+
51
+ ### Added
52
+
53
+ - **A negative-only session hint** (`src/runtime/sessionHint.ts`, remediation
54
+ `W3.2`). The provider's bootstrap called `refreshToken()` unconditionally on
55
+ every page load, including for a browser with no session at all.
56
+ `fa-auth-m8`'s `refresh_token` cookie is `HttpOnly`, so this runtime cannot
57
+ read it to find out, and `fa-auth-m8` behaviour changes were out of scope —
58
+ hence a client-owned substitute that only ever records the *negative*. It is
59
+ cleared by default and on a successful login or bootstrap, and set only once
60
+ a bootstrap refresh has actually been refused, or on logout.
61
+ `bootstrapSession()` then skips the refresh call outright, with no network
62
+ request. An unset hint still always attempts the refresh exactly as before,
63
+ so a browser carrying a still-valid cookie from before this release is never
64
+ signed out on a guess. **This adds one `localStorage` key**, which is why
65
+ this release is a minor rather than a patch.
66
+
67
+ ### Changed
68
+
69
+ - **`AuthProvider` is split into an outer component and `AuthProviderInner`**,
70
+ the inner one rendered inside `AuthQueryProvider` so it can reach
71
+ `useQueryClient()`. A new `applyUser` callback replaces every direct
72
+ `setUser` call and additionally seeds
73
+ `queryClient.setQueryData(authKeys.profile(), profile)`, so a screen's own
74
+ `useProfile()` reads the provider's already-resolved profile from cache
75
+ instead of firing a second identity request for one answer.
76
+ - Internal only: the tarball smoke test resolves the npm CLI on POSIX, and the
77
+ registry command fixture is aligned with `@mano8/astro-ui-m8` `1.5.0`.
78
+
79
+ ## 2.2.0
80
+
81
+ Additive only; the supported backend contract stays `fa-auth-m8@2.0`, range
82
+ `>=2.0.0 <3.0.0`.
83
+
84
+ ### Added
85
+
86
+ - **`AuthErrorBoundary` from `./react`**, with a safe default fallback, custom
87
+ fallback and reporting hooks, retry support, and reset keys. Every starter
88
+ island root now mounts beneath this boundary so a render failure leaves a
89
+ usable recovery surface instead of a blank login, signup, callback, account,
90
+ or logout region.
91
+ - **A dev-only `/_preview` gallery** for exercising every auth island against a
92
+ deterministic in-browser service stub. Run it with `npm run preview:dev`;
93
+ `npm run preview:build` typechecks and bundles the same gallery in CI.
94
+ - **Standalone package-consumer gates** for generated registry skins and the
95
+ packed tarball, plus fleet-alignment and registry-drift checks in CI.
96
+
97
+ ### Changed
98
+
99
+ - Raised the runtime dependency on `@mano8/astro-ui-m8` from `^1.4.2` to
100
+ `^1.5.0`, the published shared-UI release required by the registry gates.
101
+ - Expanded linting to the maintained repository surface and kept development
102
+ dependencies inside the high-severity audit that protects the build and
103
+ signing environment.
104
+
9
105
  ## 2.1.0
10
106
 
11
107
  Additive only; the supported backend contract stays `fa-auth-m8@2.0`, range
package/README.md CHANGED
@@ -77,6 +77,28 @@ const { title, description } = describeApiError(error, "Update failed");
77
77
 
78
78
  `409` `last_superuser_required` is labelled (the raw token is never surfaced); `403` is titled by status (`Not permitted`) with the backend's own readable detail as the description, since several surfaces produce a `403` and the detail that distinguishes them is not a stable contract; `429` and `503` are distinguished (rate limited vs. an unknown outcome that must not be retried); `400` free-text detail (e.g. a purge's retention-floor rejection) is surfaced verbatim under a labelled heading rather than pattern-matched.
79
79
 
80
+ ### Island error boundaries
81
+
82
+ Every starter island root is wrapped in `AuthErrorBoundary`, exported from
83
+ `@mano8/astro-auth-m8/react`. Its default fallback deliberately hides the
84
+ caught message so a token fragment, username, or API URL cannot leak onto a
85
+ public auth page. Applications can replace the fallback, report the error, or
86
+ reset the boundary when route-specific keys change:
87
+
88
+ ```tsx
89
+ import { AuthErrorBoundary } from "@mano8/astro-auth-m8/react";
90
+
91
+ <AuthErrorBoundary
92
+ onError={(error, info) => reportAuthViewError(error, info)}
93
+ resetKeys={[locale]}
94
+ >
95
+ <AuthView />
96
+ </AuthErrorBoundary>
97
+ ```
98
+
99
+ The retry action resets the failed subtree; it does not automatically repeat a
100
+ request whose outcome may be unknown.
101
+
80
102
  ## Admin API-key and security surfaces (fa-auth-m8 2.0.0)
81
103
 
82
104
  `@mano8/astro-auth-m8/api` and `@mano8/astro-auth-m8/hooks` wrap the five 2.0.0 admin routes:
@@ -113,6 +135,11 @@ A mounted `AuthProvider` listens for it and, when the id is the signed-in princi
113
135
  - `starter`: injects small default login, logout, callback, and account routes with `injectRoute()`.
114
136
  - `scaffold`: copies editable Astro/React/CSS files into a consumer app with `astro-auth-m8 scaffold --views --target src/auth`.
115
137
 
138
+ For package development, `npm run preview:dev` serves a dev-only `/_preview`
139
+ gallery backed by a deterministic browser stub. `npm run preview:build` runs
140
+ the typecheck-and-bundle gate used by CI; the preview is a repository fixture
141
+ and is not shipped as a consumer route.
142
+
116
143
  ```ts
117
144
  import { defineConfig } from "astro/config";
118
145
  import react from "@astrojs/react";
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAwD,KAAK,eAAe,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAKxI,wBAAsB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAU9E;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,KAAK,CAAC,CAkBnD;AAED,wBAAsB,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC,CAUvD;AAED,wBAAgB,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC,CAO/C"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAwD,KAAK,eAAe,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAMxI,wBAAsB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAc9E;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,KAAK,CAAC,CAwBnD;AAED,wBAAsB,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC,CAWvD;AAED,wBAAgB,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC,CAO/C"}
@@ -1,5 +1,6 @@
1
1
  import { request } from "../client.js";
2
2
  import { ResponseMessageSchema, TokenSchema, UserPublicSchema } from "../schemas.js";
3
+ import { markSessionAbsent, markSessionPresent } from "../sessionHint.js";
3
4
  import { clearToken, setToken } from "../tokenStore.js";
4
5
  let refreshTokenPromise = null;
5
6
  export async function login(username, password) {
@@ -11,6 +12,10 @@ export async function login(username, password) {
11
12
  skipRefresh: true
12
13
  });
13
14
  setToken(token.access_token);
15
+ // Beside `setToken` on purpose: this is where a session starts existing for
16
+ // this browser, whoever called it. A host with its own sign-in UI built on
17
+ // these wrappers gets the same bookkeeping as `AuthProvider.login`.
18
+ markSessionPresent();
14
19
  return token;
15
20
  }
16
21
  export async function refreshToken() {
@@ -23,6 +28,12 @@ export async function refreshToken() {
23
28
  })
24
29
  .then((token) => {
25
30
  setToken(token.access_token);
31
+ // A refresh the service honoured proves the cookie is still good -
32
+ // including one issued by a sibling plugin through
33
+ // `installFaAuthBrowserAdapter`, which is the only auth call some of
34
+ // them ever make. Clearing here lets any of those recover a hint left
35
+ // by an earlier refusal.
36
+ markSessionPresent();
26
37
  return token;
27
38
  })
28
39
  .finally(() => {
@@ -40,6 +51,7 @@ export async function logout() {
40
51
  skipRefresh: true
41
52
  });
42
53
  clearToken();
54
+ markSessionAbsent();
43
55
  return message;
44
56
  }
45
57
  export function testToken() {
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/runtime/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,gBAAgB,EAAqD,MAAM,eAAe,CAAC;AACxI,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,IAAI,mBAAmB,GAA0B,IAAI,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,QAAgB,EAAE,QAAgB;IAC5D,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC;QAC1B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,qBAAqB;QAC3B,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;QAC5B,MAAM,EAAE,WAAW;QACnB,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IACH,QA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AG,MAAM,OAAO,CAAC;QAC5B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,qBAAqB;QAC7B,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IACH,UAAU,EAAE,CAAC;IACb,iBAAiB,EAAE,CAAC;IACpB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAC;QACb,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,oBAAoB;QAC1B,MAAM,EAAE,gBAAgB;QACxB,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/oauth.ts"],"names":[],"mappings":"AACA,OAAO,EAA8D,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AASrJ,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAIhD;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAMvF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAQ9H;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAQvI"}
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/oauth.ts"],"names":[],"mappings":"AACA,OAAO,EAA8D,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAUrJ,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAIhD;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAMvF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAQ9H;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAgB7I"}
@@ -1,5 +1,6 @@
1
1
  import { request } from "../client.js";
2
2
  import { GoogleExchangeResponseSchema, GoogleLoginUrlResponseSchema } from "../schemas.js";
3
+ import { markSessionPresent } from "../sessionHint.js";
3
4
  const VERIFIER_KEY = "fa-auth-m8:pkce-verifier";
4
5
  function base64Url(bytes) {
5
6
  const values = String.fromCharCode(...new Uint8Array(bytes));
@@ -29,13 +30,21 @@ export function getGoogleLoginUrl(params) {
29
30
  skipRefresh: true
30
31
  });
31
32
  }
32
- export function exchangeGoogleCode(body) {
33
- return request({
33
+ export async function exchangeGoogleCode(body) {
34
+ const exchanged = await request({
34
35
  method: "POST",
35
36
  path: "/google-api/exchange/",
36
37
  body,
37
38
  schema: GoogleExchangeResponseSchema,
38
39
  skipRefresh: true
39
40
  });
41
+ // A completed exchange establishes this browser's session. Recorded here
42
+ // rather than in a callback view because a consumer may complete the flow
43
+ // with its own UI on this wrapper (fa-ui-m8 does) and then hard-navigate,
44
+ // never touching `AuthProvider.login`; without this, a hint left by an
45
+ // earlier refused refresh would make the destination page skip its
46
+ // bootstrap and render a freshly signed-in user as signed out.
47
+ markSessionPresent();
48
+ return exchanged;
40
49
  }
41
50
  //# sourceMappingURL=oauth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../../src/runtime/api/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAA4D,MAAM,eAAe,CAAC;AAErJ,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD,SAAS,SAAS,CAAC,KAAkB;IACnC,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,cAAc,CAAC,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACtD,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACxC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACjC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,C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ourceRoot":"","sources":["../../../src/runtime/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEnF,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ5C;AAqCD,wBAAsB,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAuDvE"}
@@ -1,5 +1,6 @@
1
1
  import { getAuthConfig } from "./config.js";
2
2
  import { ApiError, normalizeFastApiError, UnauthenticatedError } from "./errors.js";
3
+ import { markSessionPresent } from "./sessionHint.js";
3
4
  import { getToken, runRefresh, setToken } from "./tokenStore.js";
4
5
  import { TokenSchema } from "./schemas.js";
5
6
  export * from "./api/index.js";
@@ -40,6 +41,13 @@ async function refreshAccessToken() {
40
41
  if (!response.ok)
41
42
  return null;
42
43
  const token = TokenSchema.parse(await response.json());
44
+ // A rotation the service honoured proves the cookie is still good, so a
45
+ // stale "no session" hint must not survive it - otherwise a tab that
46
+ // refreshed successfully here would still skip its bootstrap on the next
47
+ // page load. Only the success path: this returns `null` for *any* non-ok
48
+ // response, so it cannot tell a 401 from a 500 and must never record the
49
+ // negative. See sessionHint.ts.
50
+ markSessionPresent();
43
51
  return token.access_token;
44
52
  }
45
53
  export async function request(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/runtime/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,aAAa,EAA0B,MAAM,aAAa,CAAC;AAcnF,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,CAAC;IACpC,MAAM,MAAM,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC3F,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,OAAO,GAAG,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IACjD,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC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OAAO;QACP,IAAI;QACJ,WAAW,EAAE,SAAS;KACvB,CAAC,CAAC;IAEH,IAAI,QAAQ,GAAG,MAAM,OAAO,EAAE,CAAC;IAC/B,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACpD,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC,CAAC;QACvD,IAAI,SAAS,EAAE,CAAC;YACd,QAAQ,CAAC,SAAS,CAAC,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,SAAS,EAAE,CAAC,CAAC;YACpD,QAAQ,GAAG,MAAM,OAAO,EAAE,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAI,CAAC,CAAC;YACf,MAAM,IAAI,oBAAoB,CAAC,uCAAuC,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,QAAQ,CAAC,IAAI,CAAC,CAAC;YACf,MAAM,IAAI,oBAAoB,EAAE,CAAC;QACnC,CAAC;QACD,MAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,SAAc,CAAC;IACnD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,53 @@
1
+ import * as React from "react";
2
+ /**
3
+ * Island-root error boundary for the auth plugin (`A-C3`).
4
+ *
5
+ * Every auth view is mounted as an Astro island. A render throw anywhere inside
6
+ * one unmounts the entire island tree, so the route is left with a blank region
7
+ * and a console trace. On this plugin that lands harder than elsewhere: the
8
+ * blanked island is the login form, and a user with no visible way to sign in
9
+ * has no way to reach any other plugin either.
10
+ *
11
+ * A class on purpose: `getDerivedStateFromError`/`componentDidCatch` still have
12
+ * no hook equivalent.
13
+ *
14
+ * The prop contract mirrors `@mano8/astro-ui-m8`'s canonical `error-boundary`
15
+ * registry block deliberately, so the two can be collapsed onto one
16
+ * implementation once that block is reachable from this package. It is not
17
+ * reachable today: the block ships in an unpublished `astro-ui-m8`, and copied
18
+ * registry items are consumer-side artifacts rather than package runtime.
19
+ */
20
+ export interface AuthErrorBoundaryFallbackProps {
21
+ error: Error;
22
+ reset: () => void;
23
+ }
24
+ export interface AuthErrorBoundaryLabels {
25
+ title: string;
26
+ description: string;
27
+ retry: string;
28
+ }
29
+ export interface AuthErrorBoundaryProps {
30
+ children: React.ReactNode;
31
+ /** Replaces the default surface. Receives the error and a `reset`. */
32
+ fallback?: (props: AuthErrorBoundaryFallbackProps) => React.ReactNode;
33
+ /** Reporting hook. The boundary never logs on its own. */
34
+ onError?: (error: Error, info: {
35
+ componentStack: string;
36
+ }) => void;
37
+ /** Clears the boundary when any member changes, compared by `Object.is`. */
38
+ resetKeys?: readonly unknown[];
39
+ labels?: Partial<AuthErrorBoundaryLabels>;
40
+ }
41
+ interface AuthErrorBoundaryState {
42
+ error: Error | null;
43
+ }
44
+ export declare class AuthErrorBoundary extends React.Component<AuthErrorBoundaryProps, AuthErrorBoundaryState> {
45
+ state: AuthErrorBoundaryState;
46
+ static getDerivedStateFromError(thrown: unknown): AuthErrorBoundaryState;
47
+ componentDidCatch(thrown: unknown, info: React.ErrorInfo): void;
48
+ componentDidUpdate(previous: AuthErrorBoundaryProps): void;
49
+ reset: () => void;
50
+ render(): React.ReactNode;
51
+ }
52
+ export {};
53
+ //# sourceMappingURL=AuthErrorBoundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/runtime/react/AuthErrorBoundary.t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
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ const DEFAULT_LABELS = {
4
+ title: "This view stopped responding",
5
+ description: "The page hit an unexpected error and could not finish rendering.",
6
+ retry: "Reload this view"
7
+ };
8
+ /** `throw "boom"` is legal, so normalize before handing anything on. */
9
+ function toError(thrown) {
10
+ if (thrown instanceof Error)
11
+ return thrown;
12
+ if (typeof thrown === "string")
13
+ return new Error(thrown);
14
+ return new Error("The view failed to render.");
15
+ }
16
+ function resetKeysChanged(previous, next) {
17
+ if (previous === undefined || next === undefined)
18
+ return false;
19
+ if (previous.length !== next.length)
20
+ return true;
21
+ return previous.some((value, index) => !Object.is(value, next[index]));
22
+ }
23
+ export class AuthErrorBoundary extends React.Component {
24
+ state = { error: null };
25
+ static getDerivedStateFromError(thrown) {
26
+ return { error: toError(thrown) };
27
+ }
28
+ componentDidCatch(thrown, info) {
29
+ this.props.onError?.(toError(thrown), {
30
+ componentStack: info.componentStack ?? ""
31
+ });
32
+ }
33
+ componentDidUpdate(previous) {
34
+ if (this.state.error === null)
35
+ return;
36
+ if (!resetKeysChanged(previous.resetKeys, this.props.resetKeys))
37
+ return;
38
+ this.reset();
39
+ }
40
+ reset = () => {
41
+ this.setState({ error: null });
42
+ };
43
+ render() {
44
+ const { error } = this.state;
45
+ if (error === null)
46
+ return this.props.children;
47
+ if (this.props.fallback) {
48
+ return this.props.fallback({ error, reset: this.reset });
49
+ }
50
+ const labels = { ...DEFAULT_LABELS, ...this.props.labels };
51
+ // The caught message is deliberately not rendered. That matters more here
52
+ // than in the other plugins: a throw on this surface can carry a username,
53
+ // a token fragment or an API URL, and the login page is the one view an
54
+ // unauthenticated stranger can always reach.
55
+ return (_jsxs("section", { className: "not-content fa-auth-panel mx-auto flex w-full max-w-md flex-col gap-4 rounded-2xl border border-border/70 bg-card/95 p-6 text-card-foreground shadow-sm", "data-auth-error-boundary": "fallback", children: [_jsx("h1", { className: "text-3xl font-semibold tracking-tight text-foreground", children: labels.title }), _jsx("p", { role: "alert", className: "text-sm text-muted-foreground", children: labels.description }), _jsx("button", { type: "button", className: "inline-flex min-h-10 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground", "data-auth-error-boundary-retry": "", onClick: this.reset, children: labels.retry })] }));
56
+ }
57
+ }
58
+ //# sourceMappingURL=AuthErrorBoundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthErrorBoundary.js","sourceRoot":"","sources":["../../../../src/runtime/react/AuthErrorBoundary.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA+B/B,MAAM,cAAc,GAA4B;IAC9C,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,kEAAkE;IAC/E,KAAK,EAAE,kBAAkB;CAC1B,CAAC;AAiBF,wEAAwE;AACxE,SAAS,OAAO,CAAC,MAAe;IAC9B,IAAI,MAAM,YAAY,KAAK;QAAE,OAAO,MAAM,CAAC;IAC3C,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IACzD,OAAO,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,gBAAgB,CACvB,QAAwC,EACxC,IAAoC;IAEpC,IAAI,QAAQ,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC/D,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACjD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,OAAO,iBAAkB,SAAQ,KAAK,CAAC,SAG5C;IACU,KAAK,GAA2B,EAAE,KAAK,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OAAO,IAAI,gBAAgB,CAI1C"}
1
+ {"version":3,"file":"AuthProvider.d.ts","sourceRoot":"","sources":["../../../../src/runtime/react/AuthProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7G,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKhD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACnE,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,EAAE,MAAM,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CAC1C,CAAC;AAkEF,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAgB,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,+BAQrJ;AAwHD,wBAAgB,OAAO,IAAI,gBAAgB,CAI1C"}
@@ -1,9 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useQueryClient } from "@tanstack/react-query";
2
3
  import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
3
4
  import { configureAuth } from "../config.js";
4
5
  import { login as apiLogin, logout as apiLogout, refreshToken } from "../api/auth.js";
5
6
  import { getProfile } from "../api/profile.js";
6
7
  import { AUTH_REVOCATION_EVENT } from "../authEvents.js";
8
+ import { ApiError } from "../errors.js";
9
+ import { authKeys } from "../queryKeys.js";
10
+ import { isSessionKnownAbsent, markSessionAbsent, markSessionPresent } from "../sessionHint.js";
11
+ import { runRefresh, setToken } from "../tokenStore.js";
7
12
  import { AuthQueryProvider } from "./AuthQueryProvider.js";
8
13
  const AuthContext = createContext(null);
9
14
  const AUTH_SESSION_EVENT = "fa-auth-m8:session";
@@ -20,16 +25,42 @@ function bootstrapSession() {
20
25
  const now = Date.now();
21
26
  if (bootstrapFailureUntil > now)
22
27
  return Promise.resolve(null);
28
+ // A prior bootstrap already confirmed this browser has no session: skip
29
+ // the refresh call outright rather than making another one fa-auth-m8 has
30
+ // no cookie to answer. See sessionHint.ts for why this is a negative-only
31
+ // hint and not a read of the actual (HttpOnly) cookie.
32
+ if (isSessionKnownAbsent())
33
+ return Promise.resolve(null);
23
34
  if (!bootstrapSessionPromise) {
24
- bootstrapSessionPromise = refreshToken()
25
- .then(() => getProfile())
35
+ // Routed through the shared `runRefresh` guard so a page mounting this
36
+ // bootstrap alongside client.ts's own 401-triggered refresh (over one
37
+ // expired token) issues at most one rotation, not two: whichever call
38
+ // reaches `runRefresh` first performs the request, the other piggybacks
39
+ // on its result. `refreshToken()` keeps its own single-flight guard for
40
+ // callers that use it directly; nesting it under `runRefresh` here only
41
+ // adds the cross-path coordination `runRefresh` exists for.
42
+ bootstrapSessionPromise = runRefresh(() => refreshToken().then((token) => token.access_token))
43
+ .then((accessToken) => {
44
+ setToken(accessToken);
45
+ return getProfile();
46
+ })
26
47
  .then((profile) => {
27
48
  bootstrapFailureUntil = 0;
49
+ markSessionPresent();
28
50
  emitAuthSession(profile);
29
51
  return profile;
30
52
  })
31
53
  .catch((err) => {
32
54
  bootstrapFailureUntil = Date.now() + BOOTSTRAP_FAILURE_COOLDOWN_MS;
55
+ // Only a 401 proves there is no session. A 500, a timeout or an
56
+ // offline load says nothing about the cookie, and the hint has no
57
+ // expiry - recording "no session" from one of those would make every
58
+ // later load skip the refresh and leave a validly signed-in user
59
+ // looking signed out until they logged in by hand. Those keep only
60
+ // the short `bootstrapFailureUntil` cooldown above, which lapses and
61
+ // retries on its own, exactly as before this hint existed.
62
+ if (err instanceof ApiError && err.status === 401)
63
+ markSessionAbsent();
33
64
  throw err;
34
65
  })
35
66
  .finally(() => {
@@ -41,13 +72,28 @@ function bootstrapSession() {
41
72
  export function AuthProvider({ children, config, bootstrap = true }) {
42
73
  if (config)
43
74
  configureAuth(config);
75
+ return (_jsx(AuthQueryProvider, { children: _jsx(AuthProviderInner, { bootstrap: bootstrap, children: children }) }));
76
+ }
77
+ function AuthProviderInner({ children, bootstrap }) {
78
+ const queryClient = useQueryClient();
44
79
  const [user, setUser] = useState(null);
45
80
  const [loading, setLoading] = useState(bootstrap);
46
81
  const [error, setError] = useState(null);
82
+ // The identity lookup a screen's own `useProfile()` runs is a separate
83
+ // react-query cache entry from this state; without seeding it here, a
84
+ // screen mounting both ends up making two `me` requests for the one
85
+ // answer this provider already has. Every place that learns the true
86
+ // profile - bootstrap, login, reload, the cross-provider session event,
87
+ // revocation - routes through this so `useProfile()` reads it as already
88
+ // fresh instead of refetching.
89
+ const applyUser = useCallback((profile) => {
90
+ setUser(profile);
91
+ queryClient.setQueryData(authKeys.profile(), profile);
92
+ }, [queryClient]);
47
93
  useEffect(() => {
48
94
  const onSession = (event) => {
49
95
  const nextUser = event.detail?.user ?? null;
50
- setUser(nextUser);
96
+ applyUser(nextUser);
51
97
  setError(null);
52
98
  setLoading(false);
53
99
  };
@@ -55,20 +101,20 @@ export function AuthProvider({ children, config, bootstrap = true }) {
55
101
  return () => {
56
102
  window.removeEventListener(AUTH_SESSION_EVENT, onSession);
57
103
  };
58
- }, []);
104
+ }, [applyUser]);
59
105
  const reload = useCallback(async () => {
60
106
  try {
61
107
  const profile = await getProfile();
62
- setUser(profile);
108
+ applyUser(profile);
63
109
  setError(null);
64
110
  return profile;
65
111
  }
66
112
  catch (err) {
67
- setUser(null);
113
+ applyUser(null);
68
114
  setError(err);
69
115
  return null;
70
116
  }
71
- }, []);
117
+ }, [applyUser]);
72
118
  useEffect(() => {
73
119
  if (!bootstrap)
74
120
  return;
@@ -77,13 +123,13 @@ export function AuthProvider({ children, config, bootstrap = true }) {
77
123
  bootstrapSession()
78
124
  .then((profile) => {
79
125
  if (!cancelled) {
80
- setUser(profile);
126
+ applyUser(profile);
81
127
  setError(null);
82
128
  }
83
129
  })
84
130
  .catch((err) => {
85
131
  if (!cancelled) {
86
- setUser(null);
132
+ applyUser(null);
87
133
  setError(err);
88
134
  }
89
135
  })
@@ -94,7 +140,7 @@ export function AuthProvider({ children, config, bootstrap = true }) {
94
140
  return () => {
95
141
  cancelled = true;
96
142
  };
97
- }, [bootstrap, reload]);
143
+ }, [bootstrap, applyUser]);
98
144
  // AA-11: `revocation_enqueued: true` means the backend has already revoked the
99
145
  // target principal's sessions and is propagating an authorization-generation
100
146
  // bump. When that principal is the signed-in one, the claims held here are
@@ -118,21 +164,23 @@ export function AuthProvider({ children, config, bootstrap = true }) {
118
164
  };
119
165
  }, [reload, user?.id]);
120
166
  const login = useCallback(async (username, password) => {
167
+ // `apiLogin` / `apiLogout` own the session hint (see sessionHint.ts), so
168
+ // it is deliberately not written again here.
121
169
  await apiLogin(username, password);
122
170
  const profile = await getProfile();
123
171
  bootstrapFailureUntil = 0;
124
- setUser(profile);
172
+ applyUser(profile);
125
173
  setError(null);
126
174
  emitAuthSession(profile);
127
175
  return profile;
128
- }, []);
176
+ }, [applyUser]);
129
177
  const logout = useCallback(async () => {
130
178
  await apiLogout();
131
- setUser(null);
179
+ applyUser(null);
132
180
  emitAuthSession(null);
133
- }, []);
181
+ }, [applyUser]);
134
182
  const value = useMemo(() => ({ user, loading, error, login, logout, reload }), [user, loading, error, login, logout, reload]);
135
- return (_jsx(AuthQueryProvider, { children: _jsx(AuthContext.Provider, { value: value, children: children }) }));
183
+ return _jsx(AuthContext.Provider, { value: value, children: children });
136
184
  }
137
185
  export function useAuth() {
138
186
  const context = useContext(AuthContext);
@@ -1 +1 @@
1
- {"version":3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EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChJ,OAAO,KAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAwB,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC1E,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CallbackView.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/CallbackView.tsx"],"names":[],"mappings":"AAQA,wBAAgB,YAAY,gCAyB3B"}
1
+ {"version":3,"file":"CallbackView.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/CallbackView.tsx"],"names":[],"mappings":"AASA,wBAAgB,YAAY,gCA8B3B"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from "react";
3
3
  import { exchangeGoogleCode, takePkceVerifier } from "../../api/oauth.js";
4
+ import { AuthErrorBoundary } from "../AuthErrorBoundary.js";
4
5
  export function CallbackView() {
5
6
  const [state, setState] = useState({ message: "Completing sign in", role: "status" });
6
7
  useEffect(() => {
@@ -17,6 +18,9 @@ export function CallbackView() {
17
18
  })
18
19
  .catch(() => setState({ message: "Unable to complete OAuth sign in.", role: "alert" }));
19
20
  }, []);
20
- return (_jsx("section", { className: "not-content fa-auth-panel mx-auto flex w-full max-w-md flex-col gap-4 rounded-2xl border border-border/70 bg-card/95 p-6 text-card-foreground shadow-sm backdrop-blur supports-[backdrop-filter]:bg-card/90", children: _jsx("p", { className: state.role === "alert" ? "text-sm text-destructive" : "text-sm text-muted-foreground", role: state.role, children: state.message }) }));
21
+ // Wrapped here rather than at the route, because this view *is* the island
22
+ // root `callback.astro` mounts (`A-C3`). A headless consumer that renders it
23
+ // directly gets the same protection.
24
+ return (_jsx(AuthErrorBoundary, { children: _jsx("section", { className: "not-content fa-auth-panel mx-auto flex w-full max-w-md flex-col gap-4 rounded-2xl border border-border/70 bg-card/95 p-6 text-card-foreground shadow-sm backdrop-blur supports-[backdrop-filter]:bg-card/90", children: _jsx("p", { className: state.role === "alert" ? "text-sm text-destructive" : "text-sm text-muted-foreground", role: state.role, children: state.message }) }) }));
21
25
  }
22
26
  //# sourceMappingURL=CallbackView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CallbackView.js","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/CallbackView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAO1E,MAAM,UAAU,YAAY;IAC1B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,EAAE,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAErG,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;QACpC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvB,QAAQ,CAAC,EAAE,OAAO,EAAE,2CAA2C,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAClF,OAAO;QACT,CAAC;QACD,kBAAkB,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE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C,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvB,QAAQ,CAAC,EAAE,OAAO,EAAE,2CAA2C,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAClF,OAAO;QACT,CAAC;QACD,kBAAkB,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;aAClD,IAAI,CAAC,GAAG,EAAE;YACT,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC5C,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,mCAAmC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAC5F,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,2EAA2E;IAC3E,6EAA6E;IAC7E,qCAAqC;IACrC,OAAO,CACL,KAAC,iBAAiB,cAClB,kBAAS,SAAS,EAAC,6MAA6M,YAC9N,YAAG,SAAS,EAAE,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,+BAA+B,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,YAClH,KAAK,CAAC,OAAO,GACZ,GACI,GACU,CACrB,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SignupView.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/SignupView.tsx"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,gCASzB"}
1
+ {"version":3,"file":"SignupView.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/SignupView.tsx"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,gCAWzB"}
@@ -1,5 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AuthErrorBoundary } from "../AuthErrorBoundary.js";
3
+ // Wrapped here rather than at the route, because this view *is* the island
4
+ // root `signup.astro` mounts (`A-C3`).
2
5
  export function SignupView() {
3
- return (_jsxs("section", { className: "not-content fa-auth-panel mx-auto flex w-full max-w-md flex-col gap-4 rounded-2xl border border-border/70 bg-card/95 p-6 text-card-foreground shadow-sm backdrop-blur supports-[backdrop-filter]:bg-card/90", children: [_jsx("h1", { className: "text-3xl font-semibold tracking-tight text-foreground", children: "Signup unavailable" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "This backend protects public signup by default. Use the headless user APIs for admin-created users." })] }));
6
+ return (_jsx(AuthErrorBoundary, { children: _jsxs("section", { className: "not-content fa-auth-panel mx-auto flex w-full max-w-md flex-col gap-4 rounded-2xl border border-border/70 bg-card/95 p-6 text-card-foreground shadow-sm backdrop-blur supports-[backdrop-filter]:bg-card/90", children: [_jsx("h1", { className: "text-3xl font-semibold tracking-tight text-foreground", children: "Signup unavailable" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "This backend protects public signup by default. Use the headless user APIs for admin-created users." })] }) }));
4
7
  }
5
8
  //# sourceMappingURL=SignupView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignupView.js","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/SignupView.tsx"],"names":[],"mappings":";AAAA,MAAM,UAAU,UAAU;IACxB,OAAO,CACL,mBAAS,SAAS,EAAC,6MAA6M,aAC9N,aAAI,SAAS,EAAC,uDAAuD,mCAAwB,EAC7F,YAAG,SAAS,EAAC,+BAA+B,oHAExC,IACI,CACX,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"SignupView.js","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/SignupView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,2EAA2E;AAC3E,uCAAuC;AACvC,MAAM,UAAU,UAAU;IACxB,OAAO,CACL,KAAC,iBAAiB,cAClB,mBAAS,SAAS,EAAC,6MAA6M,aAC9N,aAAI,SAAS,EAAC,uDAAuD,mCAAwB,EAC7F,YAAG,SAAS,EAAC,+BAA+B,oHAExC,IACI,GACU,CACrB,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"StarterAccountPage.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/StarterAccountPage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAAE,+BAMrF"}
1
+ {"version":3,"file":"StarterAccountPage.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/StarterAccountPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKzD,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAAE,+BAQrF"}
@@ -1,7 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { AuthProvider } from "../AuthProvider.js";
3
+ import { AuthErrorBoundary } from "../AuthErrorBoundary.js";
3
4
  import { AccountView } from "./AccountView.js";
5
+ // The boundary is the outermost wrapper on purpose (`A-C3`); see
6
+ // StarterLoginPage for why it sits outside `AuthProvider`.
4
7
  export function StarterAccountPage({ config }) {
5
- return (_jsx(AuthProvider, { config: config, children: _jsx(AccountView, {}) }));
8
+ return (_jsx(AuthErrorBoundary, { children: _jsx(AuthProvider, { config: config, children: _jsx(AccountView, {}) }) }));
6
9
  }
7
10
  //# sourceMappingURL=StarterAccountPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StarterAccountPage.js","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/StarterAccountPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,UAAU,kBAAkB,CAAC,EAAE,MAAM,EAA2C;IACpF,OAAO,CACL,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,YAC1B,KAAC,WAAW,KAAG,GACF,CAChB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"StarterAccountPage.js","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/StarterAccountPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,iEAAiE;AACjE,2DAA2D;AAC3D,MAAM,UAAU,kBAAkB,CAAC,EAAE,MAAM,EAA2C;IACpF,OAAO,CACL,KAAC,iBAAiB,cAChB,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,YAC1B,KAAC,WAAW,KAAG,GACF,GACG,CACrB,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"StarterLoginPage.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/StarterLoginPage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAAE,+BAMnF"}
1
+ {"version":3,"file":"StarterLoginPage.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/StarterLoginPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAMzD,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAAE,+BAQnF"}
@@ -1,7 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { AuthProvider } from "../AuthProvider.js";
3
+ import { AuthErrorBoundary } from "../AuthErrorBoundary.js";
3
4
  import { LoginView } from "./LoginView.js";
5
+ // The boundary is the outermost wrapper on purpose (`A-C3`). `AuthProvider`
6
+ // calls `configureAuth` in its own body, so a boundary mounted inside it would
7
+ // be unmounted by exactly the throw most likely to happen here.
4
8
  export function StarterLoginPage({ config }) {
5
- return (_jsx(AuthProvider, { config: config, children: _jsx(LoginView, {}) }));
9
+ return (_jsx(AuthErrorBoundary, { children: _jsx(AuthProvider, { config: config, children: _jsx(LoginView, {}) }) }));
6
10
  }
7
11
  //# sourceMappingURL=StarterLoginPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StarterLoginPage.js","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/StarterLoginPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,UAAU,gBAAgB,CAAC,EAAE,MAAM,EAA2C;IAClF,OAAO,CACL,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,YAC1B,KAAC,SAAS,KAAG,GACA,CAChB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"StarterLoginPage.js","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/StarterLoginPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,4EAA4E;AAC5E,+EAA+E;AAC/E,gEAAgE;AAChE,MAAM,UAAU,gBAAgB,CAAC,EAAE,MAAM,EAA2C;IAClF,OAAO,CACL,KAAC,iBAAiB,cAChB,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,YAC1B,KAAC,SAAS,KAAG,GACA,GACG,CACrB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from "react";
2
+ import type { AuthRuntimeConfig } from "../../config.js";
3
+ /**
4
+ * Island root for `logout.astro` (`A-C3`).
5
+ *
6
+ * The route used to mount `AuthProvider` itself, which left the one island with
7
+ * no boundary above it — and a boundary *inside* `AuthProvider` would not help,
8
+ * because `configureAuth` runs in that component's own body. Wrapping there is
9
+ * the whole point, so the route mounts this instead.
10
+ *
11
+ * It is deliberately a pass-through for children: the sign-out form is authored
12
+ * as markup in the `.astro` route and arrives here as slot content, so this
13
+ * component adds the boundary and the provider without claiming ownership of
14
+ * the page's copy.
15
+ */
16
+ export declare function StarterLogoutPage({ children, config }: {
17
+ children?: ReactNode;
18
+ config?: Partial<AuthRuntimeConfig>;
19
+ }): import("react").JSX.Element;
20
+ //# sourceMappingURL=StarterLogoutPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StarterLogoutPage.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/StarterLogoutPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,MAAM,EACP,EAAE;IACD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACrC,+BAMA"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AuthProvider } from "../AuthProvider.js";
3
+ import { AuthErrorBoundary } from "../AuthErrorBoundary.js";
4
+ /**
5
+ * Island root for `logout.astro` (`A-C3`).
6
+ *
7
+ * The route used to mount `AuthProvider` itself, which left the one island with
8
+ * no boundary above it — and a boundary *inside* `AuthProvider` would not help,
9
+ * because `configureAuth` runs in that component's own body. Wrapping there is
10
+ * the whole point, so the route mounts this instead.
11
+ *
12
+ * It is deliberately a pass-through for children: the sign-out form is authored
13
+ * as markup in the `.astro` route and arrives here as slot content, so this
14
+ * component adds the boundary and the provider without claiming ownership of
15
+ * the page's copy.
16
+ */
17
+ export function StarterLogoutPage({ children, config }) {
18
+ return (_jsx(AuthErrorBoundary, { children: _jsx(AuthProvider, { config: config, children: children }) }));
19
+ }
20
+ //# sourceMappingURL=StarterLogoutPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StarterLogoutPage.js","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/StarterLogoutPage.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,QAAQ,EACR,MAAM,EAIP;IACC,OAAO,CACL,KAAC,iBAAiB,cAChB,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,YAAG,QAAQ,GAAgB,GACrC,CACrB,CAAC;AACJ,CAAC"}
@@ -5,4 +5,5 @@ export * from "./LoginView.js";
5
5
  export * from "./SignupView.js";
6
6
  export * from "./StarterAccountPage.js";
7
7
  export * from "./StarterLoginPage.js";
8
+ export * from "./StarterLogoutPage.js";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
@@ -5,4 +5,5 @@ export * from "./LoginView.js";
5
5
  export * from "./SignupView.js";
6
6
  export * from "./StarterAccountPage.js";
7
7
  export * from "./StarterLoginPage.js";
8
+ export * from "./StarterLogoutPage.js";
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export { AUTH_REVOCATION_EVENT, emitAuthRevocation, type AuthRevocationDetail } from "../authEvents.js";
2
2
  export * from "./AuthQueryProvider.js";
3
3
  export * from "./AuthProvider.js";
4
+ export * from "./AuthErrorBoundary.js";
4
5
  export * from "./RequireAuth.js";
5
6
  export * from "./RequireRole.js";
6
7
  export { ORDERED_ROLES, hasMinimumRole, hasSuperuserPrivileges, privilegeClaimsAreConsistent } from "../authorization.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/runtime/react/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxG,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAOjC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/runtime/react/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxG,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAOjC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC"}
@@ -4,6 +4,7 @@
4
4
  export { AUTH_REVOCATION_EVENT, emitAuthRevocation } from "../authEvents.js";
5
5
  export * from "./AuthQueryProvider.js";
6
6
  export * from "./AuthProvider.js";
7
+ export * from "./AuthErrorBoundary.js";
7
8
  export * from "./RequireAuth.js";
8
9
  export * from "./RequireRole.js";
9
10
  // The hierarchy primitives, re-exported alongside `RequireRole` so a consumer
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtime/react/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gFAAgF;AAChF,uDAAuD;AACvD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAA6B,MAAM,kBAAkB,CAAC;AACxG,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAC/E,kDAAkD;AAClD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtime/react/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gFAAgF;AAChF,uDAAuD;AACvD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAA6B,MAAM,kBAAkB,CAAC;AACxG,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAC/E,kDAAkD;AAClD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Best-effort local record of "this browser is known to have no session",
3
+ * used only to decide whether `AuthProvider`'s bootstrap should skip the
4
+ * refresh call it would otherwise make unconditionally on every page load.
5
+ *
6
+ * This is not a security boundary and never gates anything the identity
7
+ * service itself decides. The actual session lives in `fa-auth-m8`'s
8
+ * `refresh_token` cookie, which that service sets `HttpOnly`
9
+ * (`auth_user_service/routes/login.py`), so this runtime cannot read it -
10
+ * and, `fa-auth-m8` behaviour being out of scope, does not work around that.
11
+ *
12
+ * The hint therefore only ever records a *negative*: cleared (unknown /
13
+ * possibly present) by default and whenever a session is established, set
14
+ * only when the service has actually refused a refresh with a `401`, or on
15
+ * logout. An unset hint always attempts the refresh, exactly as this runtime
16
+ * behaved before the hint existed, so a browser carrying a still-valid cookie
17
+ * is never signed out by a guess; only a browser already shown to have no
18
+ * session skips the next attempt. A transient failure (a `500`, an offline
19
+ * load) must never set it, since it has no expiry. `runRefresh` and the API
20
+ * client's own `401` handling remain the real authority.
21
+ *
22
+ * Written from `api/auth.ts` and `api/oauth.ts` - beside `setToken` /
23
+ * `clearToken`, at the points that actually establish or destroy the session
24
+ * - so every consumer is covered, including a host that builds its own
25
+ * sign-in UI on the API wrappers instead of mounting `AuthProvider`.
26
+ *
27
+ * Because those are core sign-in paths, every access is guarded: a runtime
28
+ * with no Web Storage (this package's own node-environment tests, a non-DOM
29
+ * consumer) or one that refuses access to it (storage disabled in an
30
+ * embedded frame) must lose the optimisation, never the sign-in.
31
+ */
32
+ export declare function isSessionKnownAbsent(): boolean;
33
+ export declare function markSessionAbsent(): void;
34
+ export declare function markSessionPresent(): void;
35
+ //# sourceMappingURL=sessionHint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionHint.d.ts","sourceRoot":"","sources":["../../../src/runtime/sessionHint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAQH,wBAAgB,oBAAoB,IAAI,OAAO,CAQ9C;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAQzC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Best-effort local record of "this browser is known to have no session",
3
+ * used only to decide whether `AuthProvider`'s bootstrap should skip the
4
+ * refresh call it would otherwise make unconditionally on every page load.
5
+ *
6
+ * This is not a security boundary and never gates anything the identity
7
+ * service itself decides. The actual session lives in `fa-auth-m8`'s
8
+ * `refresh_token` cookie, which that service sets `HttpOnly`
9
+ * (`auth_user_service/routes/login.py`), so this runtime cannot read it -
10
+ * and, `fa-auth-m8` behaviour being out of scope, does not work around that.
11
+ *
12
+ * The hint therefore only ever records a *negative*: cleared (unknown /
13
+ * possibly present) by default and whenever a session is established, set
14
+ * only when the service has actually refused a refresh with a `401`, or on
15
+ * logout. An unset hint always attempts the refresh, exactly as this runtime
16
+ * behaved before the hint existed, so a browser carrying a still-valid cookie
17
+ * is never signed out by a guess; only a browser already shown to have no
18
+ * session skips the next attempt. A transient failure (a `500`, an offline
19
+ * load) must never set it, since it has no expiry. `runRefresh` and the API
20
+ * client's own `401` handling remain the real authority.
21
+ *
22
+ * Written from `api/auth.ts` and `api/oauth.ts` - beside `setToken` /
23
+ * `clearToken`, at the points that actually establish or destroy the session
24
+ * - so every consumer is covered, including a host that builds its own
25
+ * sign-in UI on the API wrappers instead of mounting `AuthProvider`.
26
+ *
27
+ * Because those are core sign-in paths, every access is guarded: a runtime
28
+ * with no Web Storage (this package's own node-environment tests, a non-DOM
29
+ * consumer) or one that refuses access to it (storage disabled in an
30
+ * embedded frame) must lose the optimisation, never the sign-in.
31
+ */
32
+ const STORAGE_KEY = "fa-auth-m8:no-session";
33
+ function store() {
34
+ return typeof localStorage === "undefined" ? null : localStorage;
35
+ }
36
+ export function isSessionKnownAbsent() {
37
+ try {
38
+ return store()?.getItem(STORAGE_KEY) === "1";
39
+ }
40
+ catch {
41
+ // Unreadable storage is "unknown", which attempts the refresh - the safe
42
+ // direction, and the behaviour that predates this hint.
43
+ return false;
44
+ }
45
+ }
46
+ export function markSessionAbsent() {
47
+ try {
48
+ store()?.setItem(STORAGE_KEY, "1");
49
+ }
50
+ catch {
51
+ // Losing the write only costs one refused refresh on the next load.
52
+ }
53
+ }
54
+ export function markSessionPresent() {
55
+ try {
56
+ store()?.removeItem(STORAGE_KEY);
57
+ }
58
+ catch {
59
+ // Losing the clear is the dangerous direction, so it is deliberately the
60
+ // one an unreadable store also fails into: `isSessionKnownAbsent` returns
61
+ // false when it cannot read, so the refresh is still attempted.
62
+ }
63
+ }
64
+ //# sourceMappingURL=sessionHint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionHint.js","sourceRoot":"","sources":["../../../src/runtime/sessionHint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,SAAS,KAAK;IACZ,OAAO,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,IAAI,CAAC;QACH,OAAO,KAAK,EAAE,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;QACzE,wDAAwD;QACxD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,IAAI,CAAC;QACH,KAAK,EAAE,EAAE,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,oEAAoE;IACtE,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC;QACH,KAAK,EAAE,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;QACzE,0EAA0E;QAC1E,gEAAgE;IAClE,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mano8/astro-auth-m8",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "Astro integration and headless client for fa-auth-m8.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -55,14 +55,20 @@
55
55
  "scripts": {
56
56
  "build": "tsc -p tsconfig.json && npm run build:registry",
57
57
  "build:registry": "node scripts/build-registry.mjs",
58
+ "preview:dev": "vite --config fixtures/preview/vite.config.ts",
59
+ "preview:build": "tsc -p fixtures/preview/tsconfig.json --noEmit && vite build --config fixtures/preview/vite.config.ts",
60
+ "verify:fleet-gates": "node scripts/verify-fleet-gates.mjs",
61
+ "verify:registry-consumer": "node scripts/verify-registry-consumer.mjs",
62
+ "verify:registry-drift": "node scripts/verify-registry-drift.mjs",
58
63
  "verify:starter-routes": "node scripts/verify-starter-routes.mjs",
64
+ "verify:tarball-install": "node scripts/verify-tarball-install.mjs",
59
65
  "test": "vitest run --coverage",
60
66
  "typecheck": "tsc -p tsconfig.json --noEmit",
61
- "lint": "eslint \"src/**/*.{ts,tsx}\"",
67
+ "lint": "eslint .",
62
68
  "test:unit": "vitest run"
63
69
  },
64
70
  "dependencies": {
65
- "@mano8/astro-ui-m8": "^1.4.2"
71
+ "@mano8/astro-ui-m8": "^1.5.0"
66
72
  },
67
73
  "peerDependencies": {
68
74
  "@astrojs/react": "^6.0.1",
@@ -76,9 +82,10 @@
76
82
  "devDependencies": {
77
83
  "@astrojs/react": "^6.0.1",
78
84
  "@astrojs/starlight": "^0.41.3",
79
- "@eslint/js": "^10.0.1",
80
85
  "@eslint-react/eslint-plugin": "^5.18.0",
86
+ "@eslint/js": "^10.0.1",
81
87
  "@tanstack/react-query": "5.101.1",
88
+ "@tanstack/react-table": "^8.21.3",
82
89
  "@types/node": "^22.0.0",
83
90
  "@types/react": "^19.0.0",
84
91
  "@typescript-eslint/eslint-plugin": "^8.65.0",
@@ -13,7 +13,7 @@
13
13
  "files": [
14
14
  {
15
15
  "path": "registry/blocks/account/account-dashboard.tsx",
16
- "content": "\"use client\";\n\n// fa-auth account view whose FIRST/landing tab is the activity dashboard.\n// Headless auth state comes from the package (@mano8/astro-auth-m8/react); this\n// file is only the shadcn skin and is copied into the consumer via the\n// @fa-m8-auth registry. Secondary tabs (profile/sessions/api-keys/admin) are\n// passed in by the consumer via `extraTabs`, so locale + app-specific panels\n// stay owned by the app. Edit freely per app.\nimport * as React from \"react\";\nimport { LayoutDashboard, LogOut } from \"lucide-react\";\nimport {\n AuthProvider,\n useAuth,\n type AuthContextValue,\n} from \"@mano8/astro-auth-m8/react\";\nimport {\n hasMinimumRole,\n hasSuperuserPrivileges,\n} from \"@mano8/astro-auth-m8/authorization\";\nimport type { RoleType } from \"@mano8/astro-auth-m8/schemas\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport {\n NavigationMenu,\n NavigationMenuItem,\n NavigationMenuList,\n} from \"@/components/ui/navigation-menu\";\nimport {\n DashboardOverview,\n type DashboardOverviewLabels,\n} from \"@/components/fa-auth/dashboard-overview\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface AccountTab {\n id: string;\n label: string;\n icon?: React.ComponentType<{ className?: string }>;\n content: React.ReactNode;\n /** Only render this tab when the signed-in user is a superuser. */\n superuserOnly?: boolean;\n /**\n * Only render this tab when the signed-in user holds at least this role.\n * Uses the ordered hierarchy, so `minRole: \"admin\"` also admits a superadmin.\n * This is the admin tier: `fa-auth-m8` 2.0.0 authorizes the audit-log read\n * from the role hierarchy alone, so gating it with `superuserOnly` would hide\n * an admin's own surface from them.\n */\n minRole?: RoleType;\n}\n\nexport interface AccountDashboardLabels {\n dashboardTab: string;\n signOut: string;\n signInRequired: string;\n dashboard: Partial<DashboardOverviewLabels>;\n}\n\nconst DEFAULT_LABELS: AccountDashboardLabels = {\n dashboardTab: \"Dashboard\",\n signOut: \"Sign out\",\n signInRequired: \"Please sign in to view your account.\",\n dashboard: {},\n};\n\nexport interface AccountDashboardProps {\n /** Auth API base path; defaults to PUBLIC_FA_AUTH_API_BASE or \"/user\". */\n apiBase?: string;\n /** Dashboard scope: \"me\" (default) or \"global\" for superuser fleet stats. */\n scope?: \"me\" | \"global\";\n extraTabs?: AccountTab[];\n labels?: Partial<AccountDashboardLabels>;\n /** Rendered when the user is not authenticated. */\n signIn?: React.ReactNode;\n}\n\nfunction AccountShell({\n scope,\n extraTabs,\n labels,\n signIn,\n}: Required<Pick<AccountDashboardProps, \"scope\" | \"extraTabs\">> & {\n labels: AccountDashboardLabels;\n signIn?: React.ReactNode;\n}) {\n const { user, loading, logout }: AuthContextValue = useAuth();\n\n if (loading) {\n return (\n <div className=\"not-content mx-auto w-full max-w-6xl space-y-4\" aria-busy=\"true\">\n <Skeleton className=\"h-10 w-64\" />\n <Skeleton className=\"h-9 w-full max-w-md\" />\n <Skeleton className=\"h-72 w-full\" />\n </div>\n );\n }\n\n if (!user) {\n return (\n <div className=\"not-content mx-auto w-full max-w-md py-10 text-center text-sm text-muted-foreground\">\n {signIn ?? labels.signInRequired}\n </div>\n );\n }\n\n // Two deliberately different predicates: `superuserOnly` needs dual evidence\n // (role + is_superuser), `minRole` is the role hierarchy alone - the same\n // split the backend makes between its superuser and admin dependencies.\n // Each is only a display gate; every panel still self-gates and the service\n // stays the authority.\n const visibleTabs = extraTabs.filter(\n (tab) =>\n (!tab.superuserOnly ||\n hasSuperuserPrivileges(user.role, user.is_superuser)) &&\n (!tab.minRole || hasMinimumRole(user.role, tab.minRole)),\n );\n const [activeTab, setActiveTab] = React.useState<string>(\"dashboard\");\n const navItems = [\n {\n id: \"dashboard\",\n label: labels.dashboardTab,\n icon: LayoutDashboard,\n content: <DashboardOverview scope={scope} labels={labels.dashboard} />,\n },\n ...visibleTabs,\n ];\n const columnClass = navItems.length >= 5 ? \"lg:grid-cols-5\" : \"lg:grid-cols-4\";\n\n return (\n <div className=\"not-content mx-auto flex w-full max-w-6xl flex-col gap-6\">\n <div className=\"flex flex-col gap-4 border-b pb-5 lg:flex-row lg:items-end lg:justify-between\">\n <div className=\"min-w-0 space-y-2\">\n <h1 className=\"text-2xl font-semibold tracking-tight md:text-3xl\">\n {user.email}\n </h1>\n <div className=\"flex flex-wrap items-center gap-2 text-sm text-muted-foreground\">\n <span className=\"rounded-md border px-2 py-0.5 text-xs uppercase tracking-wide\">\n {user.role}\n </span>\n {user.is_superuser ? (\n <span className=\"rounded-md border px-2 py-0.5 text-xs uppercase tracking-wide\">\n superuser\n </span>\n ) : null}\n </div>\n </div>\n <Button\n variant=\"outline\"\n onClick={() => void logout()}\n className=\"w-full justify-center gap-2 sm:w-auto\"\n >\n <LogOut className=\"size-4\" />\n {labels.signOut}\n </Button>\n </div>\n\n <div className=\"space-y-4\">\n <NavigationMenu viewport={false} className=\"w-full max-w-none justify-stretch\">\n <NavigationMenuList\n className={cn(\n \"grid h-auto w-full grid-cols-1 items-stretch justify-stretch rounded-lg border border-border bg-muted/40 p-1 sm:grid-cols-2\",\n columnClass,\n )}\n >\n {navItems.map((tab) => {\n const Icon = tab.icon;\n const active = activeTab === tab.id;\n return (\n <NavigationMenuItem key={tab.id}>\n <button\n type=\"button\"\n aria-current={active ? \"page\" : undefined}\n className=\"inline-flex h-9 w-full min-w-0 items-center justify-center gap-2 rounded-md px-3 text-sm font-medium whitespace-nowrap transition-colors outline-none select-none hover:bg-background hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 data-[active=true]:bg-background data-[active=true]:text-foreground data-[active=true]:shadow-xs\"\n data-active={active}\n onClick={() => setActiveTab(tab.id)}\n >\n {Icon ? <Icon className=\"size-4 shrink-0\" /> : null}\n <span className=\"truncate\">{tab.label}</span>\n </button>\n </NavigationMenuItem>\n );\n })}\n </NavigationMenuList>\n </NavigationMenu>\n\n {navItems.map((tab) =>\n activeTab === tab.id ? <React.Fragment key={tab.id}>{tab.content}</React.Fragment> : null,\n )}\n </div>\n </div>\n );\n}\n\nexport default function AccountDashboard({\n apiBase,\n scope = \"me\",\n extraTabs = [],\n labels,\n signIn,\n}: AccountDashboardProps) {\n const resolved: AccountDashboardLabels = {\n ...DEFAULT_LABELS,\n ...labels,\n dashboard: { ...DEFAULT_LABELS.dashboard, ...labels?.dashboard },\n };\n const config = apiBase ? { apiBase } : undefined;\n return (\n <AuthProvider config={config}>\n <AccountShell\n scope={scope}\n extraTabs={extraTabs}\n labels={resolved}\n signIn={signIn}\n />\n </AuthProvider>\n );\n}\n",
16
+ "content": "\"use client\";\n\n// fa-auth account view whose FIRST/landing tab is the activity dashboard.\n// Headless auth state comes from the package (@mano8/astro-auth-m8/react); this\n// file is only the shadcn skin and is copied into the consumer via the\n// @fa-m8-auth registry. Secondary tabs (profile/sessions/api-keys/admin) are\n// passed in by the consumer via `extraTabs`, so locale + app-specific panels\n// stay owned by the app. Edit freely per app.\nimport * as React from \"react\";\nimport { LayoutDashboard, LogOut } from \"lucide-react\";\nimport {\n AuthProvider,\n useAuth,\n type AuthContextValue,\n} from \"@mano8/astro-auth-m8/react\";\nimport {\n hasMinimumRole,\n hasSuperuserPrivileges,\n} from \"@mano8/astro-auth-m8/authorization\";\nimport type { RoleType } from \"@mano8/astro-auth-m8/schemas\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport {\n NavigationMenu,\n NavigationMenuItem,\n NavigationMenuList,\n} from \"@/components/ui/navigation-menu\";\nimport {\n DashboardOverview,\n type DashboardOverviewLabels,\n} from \"@/components/fa-auth/dashboard-overview\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface AccountTab {\n id: string;\n label: string;\n icon?: React.ComponentType<{ className?: string }>;\n content: React.ReactNode;\n /** Only render this tab when the signed-in user is a superuser. */\n superuserOnly?: boolean;\n /**\n * Only render this tab when the signed-in user holds at least this role.\n * Uses the ordered hierarchy, so `minRole: \"admin\"` also admits a superadmin.\n * This is the admin tier: `fa-auth-m8` 2.0.0 authorizes the audit-log read\n * from the role hierarchy alone, so gating it with `superuserOnly` would hide\n * an admin's own surface from them.\n */\n minRole?: RoleType;\n}\n\nexport interface AccountDashboardLabels {\n dashboardTab: string;\n signOut: string;\n signInRequired: string;\n dashboard: Partial<DashboardOverviewLabels>;\n}\n\nconst DEFAULT_LABELS: AccountDashboardLabels = {\n dashboardTab: \"Dashboard\",\n signOut: \"Sign out\",\n signInRequired: \"Please sign in to view your account.\",\n dashboard: {},\n};\n\nexport interface AccountDashboardProps {\n /** Auth API base path; defaults to PUBLIC_FA_AUTH_API_BASE or \"/user\". */\n apiBase?: string;\n /** Dashboard scope: \"me\" (default) or \"global\" for superuser fleet stats. */\n scope?: \"me\" | \"global\";\n extraTabs?: AccountTab[];\n labels?: Partial<AccountDashboardLabels>;\n /** Rendered when the user is not authenticated. */\n signIn?: React.ReactNode;\n}\n\nfunction AccountShell({\n scope,\n extraTabs,\n labels,\n signIn,\n}: Required<Pick<AccountDashboardProps, \"scope\" | \"extraTabs\">> & {\n labels: AccountDashboardLabels;\n signIn?: React.ReactNode;\n}) {\n const { user, loading, logout }: AuthContextValue = useAuth();\n // Declared before the loading and signed-out early returns: this component\n // renders those branches first and the signed-in branch afterwards, so a hook\n // placed below them changes hook order between renders and React throws.\n const [activeTab, setActiveTab] = React.useState<string>(\"dashboard\");\n\n if (loading) {\n return (\n <div className=\"not-content mx-auto w-full max-w-6xl space-y-4\" aria-busy=\"true\">\n <Skeleton className=\"h-10 w-64\" />\n <Skeleton className=\"h-9 w-full max-w-md\" />\n <Skeleton className=\"h-72 w-full\" />\n </div>\n );\n }\n\n if (!user) {\n return (\n <div className=\"not-content mx-auto w-full max-w-md py-10 text-center text-sm text-muted-foreground\">\n {signIn ?? labels.signInRequired}\n </div>\n );\n }\n\n // Two deliberately different predicates: `superuserOnly` needs dual evidence\n // (role + is_superuser), `minRole` is the role hierarchy alone - the same\n // split the backend makes between its superuser and admin dependencies.\n // Each is only a display gate; every panel still self-gates and the service\n // stays the authority.\n const visibleTabs = extraTabs.filter(\n (tab) =>\n (!tab.superuserOnly ||\n hasSuperuserPrivileges(user.role, user.is_superuser)) &&\n (!tab.minRole || hasMinimumRole(user.role, tab.minRole)),\n );\n const navItems = [\n {\n id: \"dashboard\",\n label: labels.dashboardTab,\n icon: LayoutDashboard,\n content: <DashboardOverview scope={scope} labels={labels.dashboard} />,\n },\n ...visibleTabs,\n ];\n const columnClass = navItems.length >= 5 ? \"lg:grid-cols-5\" : \"lg:grid-cols-4\";\n\n return (\n <div className=\"not-content mx-auto flex w-full max-w-6xl flex-col gap-6\">\n <div className=\"flex flex-col gap-4 border-b pb-5 lg:flex-row lg:items-end lg:justify-between\">\n <div className=\"min-w-0 space-y-2\">\n <h1 className=\"text-2xl font-semibold tracking-tight md:text-3xl\">\n {user.email}\n </h1>\n <div className=\"flex flex-wrap items-center gap-2 text-sm text-muted-foreground\">\n <span className=\"rounded-md border px-2 py-0.5 text-xs uppercase tracking-wide\">\n {user.role}\n </span>\n {user.is_superuser ? (\n <span className=\"rounded-md border px-2 py-0.5 text-xs uppercase tracking-wide\">\n superuser\n </span>\n ) : null}\n </div>\n </div>\n <Button\n variant=\"outline\"\n onClick={() => void logout()}\n className=\"w-full justify-center gap-2 sm:w-auto\"\n >\n <LogOut className=\"size-4\" />\n {labels.signOut}\n </Button>\n </div>\n\n <div className=\"space-y-4\">\n <NavigationMenu viewport={false} className=\"w-full max-w-none justify-stretch\">\n <NavigationMenuList\n className={cn(\n \"grid h-auto w-full grid-cols-1 items-stretch justify-stretch rounded-lg border border-border bg-muted/40 p-1 sm:grid-cols-2\",\n columnClass,\n )}\n >\n {navItems.map((tab) => {\n const Icon = tab.icon;\n const active = activeTab === tab.id;\n return (\n <NavigationMenuItem key={tab.id}>\n <button\n type=\"button\"\n aria-current={active ? \"page\" : undefined}\n className=\"inline-flex h-9 w-full min-w-0 items-center justify-center gap-2 rounded-md px-3 text-sm font-medium whitespace-nowrap transition-colors outline-none select-none hover:bg-background hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 data-[active=true]:bg-background data-[active=true]:text-foreground data-[active=true]:shadow-xs\"\n data-active={active}\n onClick={() => setActiveTab(tab.id)}\n >\n {Icon ? <Icon className=\"size-4 shrink-0\" /> : null}\n <span className=\"truncate\">{tab.label}</span>\n </button>\n </NavigationMenuItem>\n );\n })}\n </NavigationMenuList>\n </NavigationMenu>\n\n {navItems.map((tab) =>\n activeTab === tab.id ? <React.Fragment key={tab.id}>{tab.content}</React.Fragment> : null,\n )}\n </div>\n </div>\n );\n}\n\nexport default function AccountDashboard({\n apiBase,\n scope = \"me\",\n extraTabs = [],\n labels,\n signIn,\n}: AccountDashboardProps) {\n const resolved: AccountDashboardLabels = {\n ...DEFAULT_LABELS,\n ...labels,\n dashboard: { ...DEFAULT_LABELS.dashboard, ...labels?.dashboard },\n };\n const config = apiBase ? { apiBase } : undefined;\n return (\n <AuthProvider config={config}>\n <AccountShell\n scope={scope}\n extraTabs={extraTabs}\n labels={resolved}\n signIn={signIn}\n />\n </AuthProvider>\n );\n}\n",
17
17
  "type": "registry:component",
18
18
  "target": "components/fa-auth/account-dashboard.tsx"
19
19
  }
@@ -1,10 +1,10 @@
1
1
  ---
2
- import { AuthProvider } from "@mano8/astro-auth-m8/react";
2
+ import { StarterLogoutPage } from "@mano8/astro-auth-m8/default-ui";
3
3
  import { logout } from "@mano8/astro-auth-m8/client";
4
4
  import AuthStyles from "./_AuthStyles.astro";
5
5
  ---
6
6
  <AuthStyles />
7
- <AuthProvider client:load config={{ apiBase: import.meta.env.PUBLIC_FA_AUTH_API_BASE }}>
7
+ <StarterLogoutPage client:load config={{ apiBase: import.meta.env.PUBLIC_FA_AUTH_API_BASE }}>
8
8
  <form
9
9
  class="fa-auth-panel mx-auto flex w-full max-w-md flex-col gap-6 rounded-2xl border border-border/70 bg-card/95 p-6 text-card-foreground shadow-sm backdrop-blur supports-[backdrop-filter]:bg-card/90"
10
10
  method="post"
@@ -21,7 +21,7 @@ import AuthStyles from "./_AuthStyles.astro";
21
21
  Sign out
22
22
  </button>
23
23
  </form>
24
- </AuthProvider>
24
+ </StarterLogoutPage>
25
25
  <script>
26
26
  import { logout } from "@mano8/astro-auth-m8/client";
27
27
  document.getElementById("fa-auth-logout")?.addEventListener("click", async () => {