zudoku 0.3.0-dev.60 → 0.3.0-dev.62
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/dist/config/config.d.ts +6 -0
- package/dist/config/validators/validate.d.ts +30 -0
- package/dist/config/validators/validate.js +6 -0
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/lib/authentication/AuthenticationPlugin.d.ts +2 -5
- package/dist/lib/authentication/AuthenticationPlugin.js +12 -12
- package/dist/lib/authentication/AuthenticationPlugin.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +3 -5
- package/dist/lib/authentication/components/SignIn.d.ts +1 -0
- package/dist/lib/authentication/components/{Logout.js → SignIn.js} +3 -3
- package/dist/lib/authentication/components/{Logout.js.map → SignIn.js.map} +1 -1
- package/dist/lib/authentication/components/SignOut.d.ts +1 -0
- package/dist/lib/authentication/components/SignOut.js +10 -0
- package/dist/lib/authentication/components/SignOut.js.map +1 -0
- package/dist/lib/authentication/components/SignUp.d.ts +1 -0
- package/dist/lib/authentication/components/{Login.js → SignUp.js} +3 -3
- package/dist/lib/authentication/components/SignUp.js.map +1 -0
- package/dist/lib/authentication/hook.js +2 -2
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +2 -2
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/clerk.js +17 -6
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +10 -5
- package/dist/lib/authentication/providers/openid.js +24 -6
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/components/Header.js +1 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/navigation/SideNavigationItem.d.ts +0 -4
- package/dist/lib/components/navigation/SideNavigationItem.js +2 -2
- package/dist/lib/components/navigation/SideNavigationItem.js.map +1 -1
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/lib/AuthenticationPlugin-RvXALgvS.js +52 -0
- package/lib/AuthenticationPlugin-RvXALgvS.js.map +1 -0
- package/lib/{hook-Q_gAL2NZ.js → hook-BY1NP0kj.js} +9 -9
- package/lib/{hook-Q_gAL2NZ.js.map → hook-BY1NP0kj.js.map} +1 -1
- package/lib/zudoku.auth-auth0.js +9 -7
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +48 -35
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-openid.js +472 -456
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +64 -64
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +1 -1
- package/package.json +1 -1
- package/src/lib/authentication/AuthenticationPlugin.tsx +12 -10
- package/src/lib/authentication/authentication.ts +3 -5
- package/src/lib/authentication/components/{Login.tsx → SignIn.tsx} +2 -2
- package/src/lib/authentication/components/SignOut.tsx +11 -0
- package/src/lib/authentication/components/{Logout.tsx → SignUp.tsx} +2 -2
- package/src/lib/authentication/hook.ts +2 -2
- package/src/lib/authentication/providers/auth0.tsx +4 -2
- package/src/lib/authentication/providers/clerk.tsx +22 -7
- package/src/lib/authentication/providers/openid.tsx +33 -5
- package/src/lib/components/Header.tsx +27 -23
- package/src/lib/components/navigation/SideNavigationItem.tsx +2 -2
- package/src/lib/core/DevPortalContext.ts +2 -0
- package/dist/lib/authentication/components/Login.d.ts +0 -1
- package/dist/lib/authentication/components/Login.js.map +0 -1
- package/dist/lib/authentication/components/Logout.d.ts +0 -1
- package/dist/lib/authentication/routes.d.ts +0 -5
- package/dist/lib/authentication/routes.js +0 -12
- package/dist/lib/authentication/routes.js.map +0 -1
- package/lib/AuthenticationPlugin-CG6Bw32B.js +0 -46
- package/lib/AuthenticationPlugin-CG6Bw32B.js.map +0 -1
- package/src/lib/authentication/routes.tsx +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as e, b as j, O as v } from "./jsx-runtime-BIr0WBt_.js";
|
|
2
|
-
import { u as w, R as b } from "./hook-
|
|
2
|
+
import { u as w, R as b } from "./hook-BY1NP0kj.js";
|
|
3
3
|
import { u as k, a as h, S as N, b as K, c as E, d as A, e as P, f as p } from "./Select-CEnkyfyn.js";
|
|
4
4
|
import { c, a as m, L as x } from "./Markdown-BjRJKl_E.js";
|
|
5
5
|
import { u as y, x as S, y as I } from "./DevPortalProvider-BBhQ8kgI.js";
|
package/package.json
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import type { RouteObject } from "react-router-dom";
|
|
2
1
|
import {
|
|
3
2
|
CommonPlugin,
|
|
4
3
|
NavigationPlugin,
|
|
5
4
|
ProfileMenuPlugin,
|
|
6
5
|
} from "../core/plugins.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { SignIn } from "./components/SignIn.js";
|
|
7
|
+
import { SignOut } from "./components/SignOut.js";
|
|
8
|
+
import { SignUp } from "./components/SignUp.js";
|
|
9
9
|
|
|
10
10
|
type PluginInterface = NavigationPlugin & CommonPlugin & ProfileMenuPlugin;
|
|
11
11
|
|
|
12
12
|
export class AuthenticationPlugin implements PluginInterface {
|
|
13
|
-
constructor(private additionalRoutes: RouteObject[] = []) {}
|
|
14
13
|
getRoutes() {
|
|
15
14
|
return [
|
|
16
15
|
{
|
|
17
|
-
path: "/
|
|
18
|
-
element: <
|
|
16
|
+
path: "/signout",
|
|
17
|
+
element: <SignOut />,
|
|
19
18
|
},
|
|
20
19
|
{
|
|
21
|
-
path: "/
|
|
22
|
-
element: <
|
|
20
|
+
path: "/signin",
|
|
21
|
+
element: <SignIn />,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
path: "/signup",
|
|
25
|
+
element: <SignUp />,
|
|
23
26
|
},
|
|
24
|
-
...this.additionalRoutes,
|
|
25
27
|
];
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -29,7 +31,7 @@ export class AuthenticationPlugin implements PluginInterface {
|
|
|
29
31
|
return [
|
|
30
32
|
{
|
|
31
33
|
label: "Logout",
|
|
32
|
-
path: "/
|
|
34
|
+
path: "/signout",
|
|
33
35
|
},
|
|
34
36
|
];
|
|
35
37
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { DevPortalPlugin } from "../core/plugins.js";
|
|
2
2
|
|
|
3
3
|
export interface AuthenticationProvider {
|
|
4
|
-
|
|
4
|
+
signUp(): Promise<void>;
|
|
5
|
+
signIn(): Promise<void>;
|
|
6
|
+
signOut(): Promise<void>;
|
|
5
7
|
getAccessToken(): Promise<string>;
|
|
6
|
-
logout(): Promise<void>;
|
|
7
8
|
getAuthenticationPlugin?(): DevPortalPlugin;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
/**
|
|
11
|
-
* Function to get an initialized AuthenticationProvider
|
|
12
|
-
*/
|
|
13
11
|
export interface AuthenticationProviderInitializer<TConfig> {
|
|
14
12
|
(config: TConfig): AuthenticationProvider;
|
|
15
13
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { useDevPortal } from "../../components/context/DevPortalProvider.js";
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const SignIn = () => {
|
|
5
5
|
const context = useDevPortal();
|
|
6
6
|
useEffect(() => {
|
|
7
|
-
void context.authentication?.
|
|
7
|
+
void context.authentication?.signIn();
|
|
8
8
|
}, [context.authentication]);
|
|
9
9
|
|
|
10
10
|
return null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useDevPortal } from "../../components/context/DevPortalProvider.js";
|
|
3
|
+
|
|
4
|
+
export const SignOut = () => {
|
|
5
|
+
const context = useDevPortal();
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
void context.authentication?.signOut();
|
|
8
|
+
}, [context.authentication]);
|
|
9
|
+
|
|
10
|
+
return null;
|
|
11
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { useDevPortal } from "../../components/context/DevPortalProvider.js";
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const SignUp = () => {
|
|
5
5
|
const context = useDevPortal();
|
|
6
6
|
useEffect(() => {
|
|
7
|
-
void context.authentication?.
|
|
7
|
+
void context.authentication?.signUp();
|
|
8
8
|
}, [context.authentication]);
|
|
9
9
|
|
|
10
10
|
return null;
|
|
@@ -17,7 +17,7 @@ export const useAuth = () => {
|
|
|
17
17
|
throw new Error("Authentication is not enabled.");
|
|
18
18
|
}
|
|
19
19
|
// TODO: Should handle errors/state
|
|
20
|
-
await authentication.
|
|
20
|
+
await authentication.signIn();
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
logout: async () => {
|
|
@@ -25,7 +25,7 @@ export const useAuth = () => {
|
|
|
25
25
|
throw new Error("Authentication is not enabled.");
|
|
26
26
|
}
|
|
27
27
|
// TODO: Should handle errors/state
|
|
28
|
-
await authentication.
|
|
28
|
+
await authentication.signOut();
|
|
29
29
|
|
|
30
30
|
// Redirect to home
|
|
31
31
|
window.location.href = "/";
|
|
@@ -4,7 +4,7 @@ import { useAuthState } from "../state.js";
|
|
|
4
4
|
import { OpenIDAuthenticationProvider } from "./openid.js";
|
|
5
5
|
|
|
6
6
|
class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
|
|
7
|
-
override async
|
|
7
|
+
override async signOut(): Promise<void> {
|
|
8
8
|
useAuthState.setState({
|
|
9
9
|
isAuthenticated: false,
|
|
10
10
|
isPending: false,
|
|
@@ -12,7 +12,9 @@ class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
|
|
|
12
12
|
});
|
|
13
13
|
const as = await this.getAuthServer();
|
|
14
14
|
|
|
15
|
-
const redirectUrl = new URL(
|
|
15
|
+
const redirectUrl = new URL(
|
|
16
|
+
window.location.origin + this.logoutRedirectUrlPath,
|
|
17
|
+
);
|
|
16
18
|
redirectUrl.pathname = this.logoutRedirectUrlPath;
|
|
17
19
|
|
|
18
20
|
// SEE: https://auth0.com/docs/authenticate/login/logout/log-users-out-of-auth0
|
|
@@ -39,9 +39,13 @@ class ClerkAuthPlugin extends AuthenticationPlugin {
|
|
|
39
39
|
|
|
40
40
|
const clerkAuth: AuthenticationProviderInitializer<
|
|
41
41
|
ClerkAuthenticationConfig
|
|
42
|
-
> = ({
|
|
42
|
+
> = ({
|
|
43
|
+
clerkPubKey,
|
|
44
|
+
redirectToAfterSignOut = "/",
|
|
45
|
+
redirectToAfterSignUp = "/",
|
|
46
|
+
redirectToAfterSignIn = "/",
|
|
47
|
+
}) => {
|
|
43
48
|
let clerkApi: Clerk;
|
|
44
|
-
|
|
45
49
|
const ensureLoaded = (async () => {
|
|
46
50
|
if (typeof window === "undefined") return;
|
|
47
51
|
const { Clerk } = await import("@clerk/clerk-js");
|
|
@@ -65,13 +69,24 @@ const clerkAuth: AuthenticationProviderInitializer<
|
|
|
65
69
|
|
|
66
70
|
return {
|
|
67
71
|
getAccessToken,
|
|
68
|
-
|
|
69
|
-
await
|
|
72
|
+
signOut: async () => {
|
|
73
|
+
await ensureLoaded;
|
|
74
|
+
await clerkApi.signOut({
|
|
75
|
+
redirectUrl: window.location.origin + redirectToAfterSignOut,
|
|
76
|
+
});
|
|
70
77
|
},
|
|
71
|
-
|
|
78
|
+
signIn: async () => {
|
|
79
|
+
await ensureLoaded;
|
|
72
80
|
await clerkApi.redirectToSignIn({
|
|
73
|
-
signInForceRedirectUrl:
|
|
74
|
-
signUpForceRedirectUrl:
|
|
81
|
+
signInForceRedirectUrl: window.location.origin + redirectToAfterSignIn,
|
|
82
|
+
signUpForceRedirectUrl: window.location.origin + redirectToAfterSignUp,
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
signUp: async () => {
|
|
86
|
+
await ensureLoaded;
|
|
87
|
+
await clerkApi.redirectToSignUp({
|
|
88
|
+
signInForceRedirectUrl: window.location.origin + redirectToAfterSignIn,
|
|
89
|
+
signUpForceRedirectUrl: window.location.origin + redirectToAfterSignUp,
|
|
75
90
|
});
|
|
76
91
|
},
|
|
77
92
|
getAuthenticationPlugin() {
|
|
@@ -48,12 +48,18 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
48
48
|
|
|
49
49
|
protected callbackUrlPath = "/oauth/callback";
|
|
50
50
|
protected logoutRedirectUrlPath = "/";
|
|
51
|
+
private redirectToAfterSignUp?: string;
|
|
52
|
+
private redirectToAfterSignIn?: string;
|
|
53
|
+
private redirectToAfterSignOut?: string;
|
|
51
54
|
|
|
52
55
|
constructor({
|
|
53
56
|
issuer,
|
|
54
57
|
authorizationEndpoint,
|
|
55
58
|
tokenEndpoint,
|
|
56
59
|
clientId,
|
|
60
|
+
redirectToAfterSignUp,
|
|
61
|
+
redirectToAfterSignIn,
|
|
62
|
+
redirectToAfterSignOut,
|
|
57
63
|
}: OpenIDAuthenticationConfig) {
|
|
58
64
|
this.client = {
|
|
59
65
|
client_id: clientId,
|
|
@@ -62,6 +68,9 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
62
68
|
this.issuer = issuer;
|
|
63
69
|
this.authorizationEndpoint = authorizationEndpoint;
|
|
64
70
|
this.tokenEndpoint = tokenEndpoint;
|
|
71
|
+
this.redirectToAfterSignUp = redirectToAfterSignUp ?? "/";
|
|
72
|
+
this.redirectToAfterSignIn = redirectToAfterSignIn ?? "/";
|
|
73
|
+
this.redirectToAfterSignOut = redirectToAfterSignOut ?? "/";
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
protected async getAuthServer() {
|
|
@@ -109,7 +118,15 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
109
118
|
};
|
|
110
119
|
}
|
|
111
120
|
|
|
112
|
-
async
|
|
121
|
+
async signUp() {
|
|
122
|
+
return this.authorize(true);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async signIn() {
|
|
126
|
+
return this.authorize();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private async authorize(signUp = false): Promise<void> {
|
|
113
130
|
const code_challenge_method = "S256";
|
|
114
131
|
const authorizationServer = await this.getAuthServer();
|
|
115
132
|
|
|
@@ -129,10 +146,18 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
129
146
|
|
|
130
147
|
// redirect user to as.authorization_endpoint
|
|
131
148
|
const authorizationUrl = new URL(
|
|
132
|
-
|
|
149
|
+
signUp
|
|
150
|
+
? authorizationServer.registration_endpoint ??
|
|
151
|
+
authorizationServer.authorization_endpoint
|
|
152
|
+
: authorizationServer.authorization_endpoint,
|
|
133
153
|
);
|
|
134
154
|
|
|
135
|
-
const redirectUrl = new URL(
|
|
155
|
+
const redirectUrl = new URL(
|
|
156
|
+
(signUp
|
|
157
|
+
? window.location.origin + this.redirectToAfterSignUp
|
|
158
|
+
: window.location.origin + this.redirectToAfterSignIn) ??
|
|
159
|
+
window.location.href,
|
|
160
|
+
);
|
|
136
161
|
redirectUrl.pathname = this.callbackUrlPath;
|
|
137
162
|
redirectUrl.search = "";
|
|
138
163
|
|
|
@@ -161,6 +186,7 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
161
186
|
// now redirect the user to authorizationUrl.href
|
|
162
187
|
location.href = authorizationUrl.href;
|
|
163
188
|
}
|
|
189
|
+
|
|
164
190
|
async getAccessToken(): Promise<string> {
|
|
165
191
|
const as = await this.getAuthServer();
|
|
166
192
|
if (!this.tokens) {
|
|
@@ -191,7 +217,7 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
191
217
|
return this.tokens.accessToken;
|
|
192
218
|
}
|
|
193
219
|
|
|
194
|
-
async
|
|
220
|
+
async signOut(): Promise<void> {
|
|
195
221
|
useAuthState.setState({
|
|
196
222
|
isAuthenticated: false,
|
|
197
223
|
isPending: false,
|
|
@@ -200,7 +226,9 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
200
226
|
|
|
201
227
|
const as = await this.getAuthServer();
|
|
202
228
|
|
|
203
|
-
const redirectUrl = new URL(
|
|
229
|
+
const redirectUrl = new URL(
|
|
230
|
+
window.location.origin + this.redirectToAfterSignOut,
|
|
231
|
+
);
|
|
204
232
|
redirectUrl.pathname = this.logoutRedirectUrlPath;
|
|
205
233
|
|
|
206
234
|
let logoutUrl: URL;
|
|
@@ -54,28 +54,32 @@ export const Header = memo(function HeaderInner() {
|
|
|
54
54
|
<header className="fixed top-0 w-full z-10 bg-background/80 backdrop-blur">
|
|
55
55
|
<div className="max-w-screen-2xl mx-auto">
|
|
56
56
|
<div className="grid grid-cols-[calc(var(--side-nav-width))_1fr] lg:gap-12 items-center border-b px-12 h-[--top-header-height]">
|
|
57
|
-
<div className="flex
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
<div className="flex">
|
|
58
|
+
<Link to="/">
|
|
59
|
+
<div className="flex items-center gap-3.5">
|
|
60
|
+
{page?.logo && (
|
|
61
|
+
<>
|
|
62
|
+
<img
|
|
63
|
+
src={page.logo.src.light}
|
|
64
|
+
alt={page.logo.alt ?? page.pageTitle}
|
|
65
|
+
style={{ width: page.logo.width }}
|
|
66
|
+
className={cn("h-10", isDark && "hidden")}
|
|
67
|
+
loading="lazy"
|
|
68
|
+
/>
|
|
69
|
+
<img
|
|
70
|
+
src={page.logo.src.dark}
|
|
71
|
+
alt={page.logo.alt ?? page.pageTitle}
|
|
72
|
+
style={{ width: page.logo.width }}
|
|
73
|
+
className={cn("h-10", !isDark && "hidden")}
|
|
74
|
+
loading="lazy"
|
|
75
|
+
/>
|
|
76
|
+
</>
|
|
77
|
+
)}
|
|
78
|
+
<span className="font-bold text-2xl text-foreground/85 tracking-wide">
|
|
79
|
+
{page?.pageTitle}
|
|
80
|
+
</span>
|
|
81
|
+
</div>
|
|
82
|
+
</Link>
|
|
79
83
|
</div>
|
|
80
84
|
<div className="grid grid-cols-[--sidecar-grid-cols] items-center gap-8">
|
|
81
85
|
<div className="w-full max-w-prose">
|
|
@@ -93,7 +97,7 @@ export const Header = memo(function HeaderInner() {
|
|
|
93
97
|
<div className="items-center justify-self-end text-sm hidden lg:flex gap-2">
|
|
94
98
|
{isAuthEnabled && !isAuthenticated ? (
|
|
95
99
|
<Button variant="ghost" asChild>
|
|
96
|
-
<Link to="/
|
|
100
|
+
<Link to="/signin">Login</Link>
|
|
97
101
|
</Button>
|
|
98
102
|
) : (
|
|
99
103
|
<DropdownMenu>
|
|
@@ -14,7 +14,7 @@ import { AnchorLink } from "../AnchorLink.js";
|
|
|
14
14
|
import { useNavigationCollapsibleState } from "./useNavigationCollapsibleState.js";
|
|
15
15
|
import { checkHasActiveItem, isLinkItem, isPathItem } from "./util.js";
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const navigationListItem = cva(
|
|
18
18
|
"flex px-[--padding-nav-item] py-1.5 rounded-lg hover:bg-accent transition-colors duration-300",
|
|
19
19
|
{
|
|
20
20
|
variants: {
|
|
@@ -51,7 +51,7 @@ export const SideNavigationItem = ({
|
|
|
51
51
|
const [isOpen, setIsOpen] = useNavigationCollapsibleState({
|
|
52
52
|
item,
|
|
53
53
|
path: currentPath,
|
|
54
|
-
defaultOpen: () => checkHasActiveItem(item, location.pathname,
|
|
54
|
+
defaultOpen: () => checkHasActiveItem(item, location.pathname, basePath),
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
if (isLinkItem(item)) {
|
|
@@ -71,6 +71,7 @@ type Metadata = Partial<{
|
|
|
71
71
|
creator: string;
|
|
72
72
|
publisher: string;
|
|
73
73
|
}>;
|
|
74
|
+
|
|
74
75
|
type Page = Partial<{
|
|
75
76
|
pageTitle?: string;
|
|
76
77
|
logo?: {
|
|
@@ -82,6 +83,7 @@ type Page = Partial<{
|
|
|
82
83
|
alt?: string;
|
|
83
84
|
};
|
|
84
85
|
}>;
|
|
86
|
+
|
|
85
87
|
export type ZudokuContextOptions = {
|
|
86
88
|
metadata?: Metadata;
|
|
87
89
|
page?: Page;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Login: () => null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Login.js","sourceRoot":"","sources":["../../../../src/lib/authentication/components/Login.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE7E,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE;IACxB,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAC/B,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,OAAO,CAAC,cAAc,EAAE,KAAK,EAAE,CAAC;IACvC,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;IAE7B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Logout: () => null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export default [
|
|
3
|
-
{
|
|
4
|
-
path: "/logout",
|
|
5
|
-
element: _jsx("div", { children: "Logout" }),
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
path: "/login",
|
|
9
|
-
element: _jsx("div", { children: "Login" }),
|
|
10
|
-
},
|
|
11
|
-
];
|
|
12
|
-
//# sourceMappingURL=routes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/lib/authentication/routes.tsx"],"names":[],"mappings":";AAAA,eAAe;IACb;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,mCAAiB;KAC3B;IACD;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,kCAAgB;KAC1B;CACF,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { j as n } from "./jsx-runtime-BIr0WBt_.js";
|
|
2
|
-
import { useEffect as e } from "react";
|
|
3
|
-
import { u as i } from "./DevPortalProvider-BBhQ8kgI.js";
|
|
4
|
-
const u = () => {
|
|
5
|
-
const o = i();
|
|
6
|
-
return e(() => {
|
|
7
|
-
var t;
|
|
8
|
-
(t = o.authentication) == null || t.login();
|
|
9
|
-
}, [o.authentication]), null;
|
|
10
|
-
}, a = () => {
|
|
11
|
-
const o = i();
|
|
12
|
-
return e(() => {
|
|
13
|
-
var t;
|
|
14
|
-
(t = o.authentication) == null || t.logout();
|
|
15
|
-
}, [o.authentication]), null;
|
|
16
|
-
};
|
|
17
|
-
class c {
|
|
18
|
-
constructor(t = []) {
|
|
19
|
-
this.additionalRoutes = t;
|
|
20
|
-
}
|
|
21
|
-
getRoutes() {
|
|
22
|
-
return [
|
|
23
|
-
{
|
|
24
|
-
path: "/logout",
|
|
25
|
-
element: /* @__PURE__ */ n.jsx(a, {})
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
path: "/login",
|
|
29
|
-
element: /* @__PURE__ */ n.jsx(u, {})
|
|
30
|
-
},
|
|
31
|
-
...this.additionalRoutes
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
getProfileMenuItems() {
|
|
35
|
-
return [
|
|
36
|
-
{
|
|
37
|
-
label: "Logout",
|
|
38
|
-
path: "/logout"
|
|
39
|
-
}
|
|
40
|
-
];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
export {
|
|
44
|
-
c as A
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=AuthenticationPlugin-CG6Bw32B.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationPlugin-CG6Bw32B.js","sources":["../src/lib/authentication/components/Login.tsx","../src/lib/authentication/components/Logout.tsx","../src/lib/authentication/AuthenticationPlugin.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useDevPortal } from \"../../components/context/DevPortalProvider.js\";\n\nexport const Login = () => {\n const context = useDevPortal();\n useEffect(() => {\n void context.authentication?.login();\n }, [context.authentication]);\n\n return null;\n};\n","import { useEffect } from \"react\";\nimport { useDevPortal } from \"../../components/context/DevPortalProvider.js\";\n\nexport const Logout = () => {\n const context = useDevPortal();\n useEffect(() => {\n void context.authentication?.logout();\n }, [context.authentication]);\n\n return null;\n};\n","import type { RouteObject } from \"react-router-dom\";\nimport {\n CommonPlugin,\n NavigationPlugin,\n ProfileMenuPlugin,\n} from \"../core/plugins.js\";\nimport { Login } from \"./components/Login.js\";\nimport { Logout } from \"./components/Logout.js\";\n\ntype PluginInterface = NavigationPlugin & CommonPlugin & ProfileMenuPlugin;\n\nexport class AuthenticationPlugin implements PluginInterface {\n constructor(private additionalRoutes: RouteObject[] = []) {}\n getRoutes() {\n return [\n {\n path: \"/logout\",\n element: <Logout />,\n },\n {\n path: \"/login\",\n element: <Login />,\n },\n ...this.additionalRoutes,\n ];\n }\n\n getProfileMenuItems() {\n return [\n {\n label: \"Logout\",\n path: \"/logout\",\n },\n ];\n }\n}\n"],"names":["Login","context","useDevPortal","useEffect","_a","Logout","AuthenticationPlugin","additionalRoutes"],"mappings":";;;AAGO,MAAMA,IAAQ,MAAM;AACzB,QAAMC,IAAUC;AAChB,SAAAC,EAAU,MAAM;;AACT,KAAAC,IAAAH,EAAQ,mBAAR,QAAAG,EAAwB;AAAA,EAAM,GAClC,CAACH,EAAQ,cAAc,CAAC,GAEpB;AACT,GCPaI,IAAS,MAAM;AAC1B,QAAMJ,IAAUC;AAChB,SAAAC,EAAU,MAAM;;AACT,KAAAC,IAAAH,EAAQ,mBAAR,QAAAG,EAAwB;AAAA,EAAO,GACnC,CAACH,EAAQ,cAAc,CAAC,GAEpB;AACT;ACCO,MAAMK,EAAgD;AAAA,EAC3D,YAAoBC,IAAkC,IAAI;AAAtC,SAAA,mBAAAA;AAAA,EAAuC;AAAA,EAC3D,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,+BAAUF,GAAO,EAAA;AAAA,MACnB;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,+BAAUL,GAAM,EAAA;AAAA,MAClB;AAAA,MACA,GAAG,KAAK;AAAA,IAAA;AAAA,EAEZ;AAAA,EAEA,sBAAsB;AACb,WAAA;AAAA,MACL;AAAA,QACE,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACF;"}
|