@mano8/astro-auth-m8 2.1.0 → 2.2.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.
- package/CHANGELOG.md +26 -0
- package/README.md +27 -0
- package/dist/src/runtime/react/AuthErrorBoundary.d.ts +53 -0
- package/dist/src/runtime/react/AuthErrorBoundary.d.ts.map +1 -0
- package/dist/src/runtime/react/AuthErrorBoundary.js +58 -0
- package/dist/src/runtime/react/AuthErrorBoundary.js.map +1 -0
- package/dist/src/runtime/react/default-ui/CallbackView.d.ts.map +1 -1
- package/dist/src/runtime/react/default-ui/CallbackView.js +5 -1
- package/dist/src/runtime/react/default-ui/CallbackView.js.map +1 -1
- package/dist/src/runtime/react/default-ui/SignupView.d.ts.map +1 -1
- package/dist/src/runtime/react/default-ui/SignupView.js +4 -1
- package/dist/src/runtime/react/default-ui/SignupView.js.map +1 -1
- package/dist/src/runtime/react/default-ui/StarterAccountPage.d.ts.map +1 -1
- package/dist/src/runtime/react/default-ui/StarterAccountPage.js +4 -1
- package/dist/src/runtime/react/default-ui/StarterAccountPage.js.map +1 -1
- package/dist/src/runtime/react/default-ui/StarterLoginPage.d.ts.map +1 -1
- package/dist/src/runtime/react/default-ui/StarterLoginPage.js +5 -1
- package/dist/src/runtime/react/default-ui/StarterLoginPage.js.map +1 -1
- package/dist/src/runtime/react/default-ui/StarterLogoutPage.d.ts +20 -0
- package/dist/src/runtime/react/default-ui/StarterLogoutPage.d.ts.map +1 -0
- package/dist/src/runtime/react/default-ui/StarterLogoutPage.js +20 -0
- package/dist/src/runtime/react/default-ui/StarterLogoutPage.js.map +1 -0
- package/dist/src/runtime/react/default-ui/index.d.ts +1 -0
- package/dist/src/runtime/react/default-ui/index.d.ts.map +1 -1
- package/dist/src/runtime/react/default-ui/index.js +1 -0
- package/dist/src/runtime/react/default-ui/index.js.map +1 -1
- package/dist/src/runtime/react/index.d.ts +1 -0
- package/dist/src/runtime/react/index.d.ts.map +1 -1
- package/dist/src/runtime/react/index.js +1 -0
- package/dist/src/runtime/react/index.js.map +1 -1
- package/package.json +11 -4
- package/registry/r/account-dashboard.json +1 -1
- package/src/routes/logout.astro +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,32 @@ 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.2.0
|
|
10
|
+
|
|
11
|
+
Additive only; the supported backend contract stays `fa-auth-m8@2.0`, range
|
|
12
|
+
`>=2.0.0 <3.0.0`.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **`AuthErrorBoundary` from `./react`**, with a safe default fallback, custom
|
|
17
|
+
fallback and reporting hooks, retry support, and reset keys. Every starter
|
|
18
|
+
island root now mounts beneath this boundary so a render failure leaves a
|
|
19
|
+
usable recovery surface instead of a blank login, signup, callback, account,
|
|
20
|
+
or logout region.
|
|
21
|
+
- **A dev-only `/_preview` gallery** for exercising every auth island against a
|
|
22
|
+
deterministic in-browser service stub. Run it with `npm run preview:dev`;
|
|
23
|
+
`npm run preview:build` typechecks and bundles the same gallery in CI.
|
|
24
|
+
- **Standalone package-consumer gates** for generated registry skins and the
|
|
25
|
+
packed tarball, plus fleet-alignment and registry-drift checks in CI.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Raised the runtime dependency on `@mano8/astro-ui-m8` from `^1.4.2` to
|
|
30
|
+
`^1.5.0`, the published shared-UI release required by the registry gates.
|
|
31
|
+
- Expanded linting to the maintained repository surface and kept development
|
|
32
|
+
dependencies inside the high-severity audit that protects the build and
|
|
33
|
+
signing environment.
|
|
34
|
+
|
|
9
35
|
## 2.1.0
|
|
10
36
|
|
|
11
37
|
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";
|
|
@@ -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.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAQD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,8BAA8B,KAAK,KAAK,CAAC,SAAS,CAAC;IACtE,0DAA0D;IAC1D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnE,4EAA4E;IAC5E,SAAS,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC3C;AAED,UAAU,sBAAsB;IAC9B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAkBD,qBAAa,iBAAkB,SAAQ,KAAK,CAAC,SAAS,CACpD,sBAAsB,EACtB,sBAAsB,CACvB;IACU,KAAK,EAAE,sBAAsB,CAAmB;IAEzD,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,sBAAsB;IAI/D,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI;IAM/D,kBAAkB,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAMnE,KAAK,QAAO,IAAI,CAEd;IAEO,MAAM,IAAI,KAAK,CAAC,SAAS;CAkCnC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallbackView.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/react/default-ui/CallbackView.tsx"],"names":[],"mappings":"
|
|
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
|
-
|
|
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;
|
|
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;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAO5D,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,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":"
|
|
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,
|
|
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":"
|
|
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;
|
|
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":"
|
|
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;
|
|
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"}
|
|
@@ -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"}
|
|
@@ -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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mano8/astro-auth-m8",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.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
|
|
67
|
+
"lint": "eslint .",
|
|
62
68
|
"test:unit": "vitest run"
|
|
63
69
|
},
|
|
64
70
|
"dependencies": {
|
|
65
|
-
"@mano8/astro-ui-m8": "^1.
|
|
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
|
|
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
|
}
|
package/src/routes/logout.astro
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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 () => {
|