zudoku 0.33.0 → 0.33.1
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/lib/authentication/state.js +8 -2
- package/dist/lib/authentication/state.js.map +1 -1
- package/dist/lib/components/index.d.ts +1 -1
- package/dist/lib/core/RouteGuard.d.ts +1 -1
- package/dist/lib/core/RouteGuard.js +23 -18
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/lib/{AuthenticationPlugin-_gUMnGxb.js → AuthenticationPlugin-CiO1FM6Q.js} +2 -2
- package/lib/{AuthenticationPlugin-_gUMnGxb.js.map → AuthenticationPlugin-CiO1FM6Q.js.map} +1 -1
- package/lib/Dialog-DIKGQxQc.js +83 -0
- package/lib/Dialog-DIKGQxQc.js.map +1 -0
- package/lib/{MdxPage-DM9mE-G-.js → MdxPage-DZTt9ld7.js} +3 -3
- package/lib/{MdxPage-DM9mE-G-.js.map → MdxPage-DZTt9ld7.js.map} +1 -1
- package/lib/{OasProvider-Bvu4dDpX.js → OasProvider-SzD9mHJc.js} +3 -3
- package/lib/{OasProvider-Bvu4dDpX.js.map → OasProvider-SzD9mHJc.js.map} +1 -1
- package/lib/{OperationList-DWnNbwVg.js → OperationList-DDs9NblY.js} +5 -5
- package/lib/{OperationList-DWnNbwVg.js.map → OperationList-DDs9NblY.js.map} +1 -1
- package/lib/{Select-BmoX1iTH.js → Select-Dqtcn53H.js} +3 -3
- package/lib/{Select-BmoX1iTH.js.map → Select-Dqtcn53H.js.map} +1 -1
- package/lib/{hook-4_6pQSo4.js → hook-CN__aZIt.js} +39 -35
- package/lib/{hook-4_6pQSo4.js.map → hook-CN__aZIt.js.map} +1 -1
- package/lib/{index-DVBlM15k.js → index-CibzSNks.js} +27 -26
- package/lib/{index-DVBlM15k.js.map → index-CibzSNks.js.map} +1 -1
- package/lib/index-gQD2h1wX.js +447 -0
- package/lib/index-gQD2h1wX.js.map +1 -0
- package/lib/{mutation-DTunCQKB.js → mutation-EclmI0is.js} +2 -2
- package/lib/{mutation-DTunCQKB.js.map → mutation-EclmI0is.js.map} +1 -1
- package/lib/ui/Command.js +21 -20
- package/lib/ui/Command.js.map +1 -1
- package/lib/{useScrollToAnchor-BW8y_cwU.js → useScrollToAnchor-C7ilRSts.js} +2 -2
- package/lib/{useScrollToAnchor-BW8y_cwU.js.map → useScrollToAnchor-C7ilRSts.js.map} +1 -1
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +2 -2
- package/lib/zudoku.components.js +475 -464
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +1 -1
- package/lib/zudoku.plugin-api-catalog.js +1 -1
- package/lib/zudoku.plugin-api-keys.js +2 -2
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +2 -2
- package/package.json +1 -1
- package/src/lib/authentication/state.ts +8 -2
- package/src/lib/core/RouteGuard.tsx +43 -18
- package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
- package/lib/index-Du5aNddU.js +0 -509
- package/lib/index-Du5aNddU.js.map +0 -1
package/lib/zudoku.hooks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z as f } from "./index-DwT-v3zK.js";
|
|
2
2
|
import { useState as m, useEffect as i } from "react";
|
|
3
|
-
import { a } from "./hook-
|
|
3
|
+
import { a } from "./hook-CN__aZIt.js";
|
|
4
4
|
function d(e, t) {
|
|
5
5
|
const s = a(), [n, o] = m();
|
|
6
6
|
return i(() => s.addEventListener(e, (...u) => {
|
|
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-CYK1ROHF.js";
|
|
|
2
2
|
import { s as f } from "./index-LNp6rxyU.js";
|
|
3
3
|
import { d as b, m as x } from "./chunk-IR6S3I6Y-D_3UmFIn.js";
|
|
4
4
|
import { j as d } from "./joinUrl-10po2Jdj.js";
|
|
5
|
-
import { u as j, b as y } from "./hook-
|
|
5
|
+
import { u as j, b as y } from "./hook-CN__aZIt.js";
|
|
6
6
|
import { Head as v, Link as N } from "./zudoku.components.js";
|
|
7
7
|
import { H as S, M as w } from "./Markdown-DePfm7oQ.js";
|
|
8
8
|
const M = ({
|
|
@@ -2,8 +2,8 @@ import { j as e } from "./jsx-runtime-CYK1ROHF.js";
|
|
|
2
2
|
import { RotateCwIcon as j, TrashIcon as v, EyeOffIcon as w, EyeIcon as K, CheckIcon as b, CopyIcon as k, FileKey2Icon as N } from "lucide-react";
|
|
3
3
|
import { D as I, S as x, R as S } from "./SlotletProvider-DdtIOUi6.js";
|
|
4
4
|
import { i as c } from "./invariant-Caa8-XvF.js";
|
|
5
|
-
import { a as h, f as g, k as A, b as C } from "./hook-
|
|
6
|
-
import { u as d, S as E, a as P, b as D, c as q, d as R, e as p } from "./Select-
|
|
5
|
+
import { a as h, f as g, k as A, b as C } from "./hook-CN__aZIt.js";
|
|
6
|
+
import { u as d, S as E, a as P, b as D, c as q, d as R, e as p } from "./Select-Dqtcn53H.js";
|
|
7
7
|
import { a as O } from "./index.esm--gIChbWs.js";
|
|
8
8
|
import { a as z, L as u, O as F } from "./chunk-IR6S3I6Y-D_3UmFIn.js";
|
|
9
9
|
import { Button as l } from "./ui/Button.js";
|
|
@@ -53,7 +53,7 @@ const P = (e) => ({
|
|
|
53
53
|
const u = {
|
|
54
54
|
path: r,
|
|
55
55
|
lazy: async () => {
|
|
56
|
-
const { MdxPage: p } = await import("./MdxPage-
|
|
56
|
+
const { MdxPage: p } = await import("./MdxPage-DZTt9ld7.js"), { default: f, ...l } = await i();
|
|
57
57
|
return {
|
|
58
58
|
element: /* @__PURE__ */ d.jsx(
|
|
59
59
|
p,
|
|
@@ -2,10 +2,10 @@ import "./jsx-runtime-CYK1ROHF.js";
|
|
|
2
2
|
import "./index-LNp6rxyU.js";
|
|
3
3
|
import "lucide-react";
|
|
4
4
|
import "./chunk-IR6S3I6Y-D_3UmFIn.js";
|
|
5
|
-
import "./hook-
|
|
5
|
+
import "./hook-CN__aZIt.js";
|
|
6
6
|
import "./ui/Button.js";
|
|
7
7
|
import "./joinUrl-10po2Jdj.js";
|
|
8
|
-
import { U as n, o as s } from "./index-
|
|
8
|
+
import { U as n, o as s } from "./index-CibzSNks.js";
|
|
9
9
|
export {
|
|
10
10
|
n as UNTAGGED_PATH,
|
|
11
11
|
s as openApiPlugin
|
package/package.json
CHANGED
|
@@ -38,14 +38,20 @@ export const useAuthState = create<AuthState>()(
|
|
|
38
38
|
persist(
|
|
39
39
|
(state) => ({
|
|
40
40
|
isAuthenticated: false,
|
|
41
|
-
isPending:
|
|
41
|
+
isPending: true,
|
|
42
42
|
profile: null,
|
|
43
43
|
providerData: null,
|
|
44
44
|
}),
|
|
45
45
|
{
|
|
46
|
+
merge: (persistedState, currentState) => {
|
|
47
|
+
return {
|
|
48
|
+
...currentState,
|
|
49
|
+
isPending: false,
|
|
50
|
+
...(typeof persistedState === "object" ? persistedState : {}),
|
|
51
|
+
};
|
|
52
|
+
},
|
|
46
53
|
name: "auth-state",
|
|
47
54
|
storage: createJSONStorage(() => localStorage),
|
|
48
|
-
// partialize: (s) => ({ state: s }),
|
|
49
55
|
},
|
|
50
56
|
),
|
|
51
57
|
);
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { matchPath, Outlet, useLocation } from "react-router";
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { matchPath, Outlet, useLocation, useNavigate } from "react-router";
|
|
3
|
+
import {
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogDescription,
|
|
7
|
+
DialogHeader,
|
|
8
|
+
DialogTitle,
|
|
9
|
+
} from "zudoku/ui/Dialog.js";
|
|
3
10
|
import { useAuth } from "../authentication/hook.js";
|
|
4
11
|
import { useZudoku } from "../components/context/ZudokuContext.js";
|
|
5
12
|
import { ZudokuError } from "../util/invariant.js";
|
|
@@ -8,6 +15,7 @@ import { useLatest } from "../util/useLatest.js";
|
|
|
8
15
|
export const RouteGuard = () => {
|
|
9
16
|
const auth = useAuth();
|
|
10
17
|
const zudoku = useZudoku();
|
|
18
|
+
const navigate = useNavigate();
|
|
11
19
|
const location = useLocation();
|
|
12
20
|
const latestPath = useLatest(location.pathname);
|
|
13
21
|
|
|
@@ -15,24 +23,41 @@ export const RouteGuard = () => {
|
|
|
15
23
|
matchPath({ path, end: true }, location.pathname),
|
|
16
24
|
);
|
|
17
25
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]);
|
|
26
|
+
useQuery({
|
|
27
|
+
queryKey: ["login-redirect"],
|
|
28
|
+
queryFn: async () => {
|
|
29
|
+
await new Promise((resolve) => setTimeout(resolve, 1200));
|
|
30
|
+
return zudoku.authentication?.signIn({
|
|
31
|
+
redirectTo: latestPath.current,
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
enabled:
|
|
35
|
+
typeof window !== "undefined" &&
|
|
36
|
+
isProtected &&
|
|
37
|
+
!auth.isPending &&
|
|
38
|
+
!auth.isAuthenticated,
|
|
39
|
+
});
|
|
33
40
|
|
|
34
41
|
if (isProtected && !auth.isAuthenticated) {
|
|
35
|
-
return
|
|
42
|
+
return (
|
|
43
|
+
<Dialog
|
|
44
|
+
open={true}
|
|
45
|
+
onOpenChange={(open) => {
|
|
46
|
+
if (!open) {
|
|
47
|
+
void navigate(-1);
|
|
48
|
+
}
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
<DialogContent>
|
|
52
|
+
<DialogHeader>
|
|
53
|
+
<DialogTitle>Logging you in...</DialogTitle>
|
|
54
|
+
</DialogHeader>
|
|
55
|
+
<DialogDescription>
|
|
56
|
+
Please wait while we log you in.
|
|
57
|
+
</DialogDescription>
|
|
58
|
+
</DialogContent>
|
|
59
|
+
</Dialog>
|
|
60
|
+
);
|
|
36
61
|
}
|
|
37
62
|
|
|
38
63
|
if (isProtected && !auth.isAuthEnabled) {
|
|
@@ -178,7 +178,7 @@ export const Sidecar = ({
|
|
|
178
178
|
>
|
|
179
179
|
<SidecarBox.Root>
|
|
180
180
|
<SidecarBox.Head className="flex justify-between items-center flex-nowrap py-2.5 gap-2 text-xs">
|
|
181
|
-
<span className="font-mono break-words">
|
|
181
|
+
<span className="font-mono break-words leading-6">
|
|
182
182
|
<span className={cn("font-semibold", methodTextColor)}>
|
|
183
183
|
{operation.method.toLocaleUpperCase()}
|
|
184
184
|
</span>
|