zudoku 0.37.0 → 0.38.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/dist/app/main.js +2 -0
- package/dist/app/main.js.map +1 -1
- package/dist/config/validators/common.d.ts +287 -18
- package/dist/config/validators/common.js +2 -0
- package/dist/config/validators/common.js.map +1 -1
- package/dist/config/validators/validate.d.ts +107 -7
- package/dist/lib/authentication/authentication.d.ts +1 -0
- package/dist/lib/authentication/providers/clerk.js +19 -0
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +1 -0
- package/dist/lib/authentication/providers/openid.js +5 -0
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/authentication/providers/supabase.js +5 -0
- package/dist/lib/authentication/providers/supabase.js.map +1 -1
- package/dist/lib/authentication/state.d.ts +0 -26
- package/dist/lib/authentication/state.js +1 -16
- package/dist/lib/authentication/state.js.map +1 -1
- package/dist/lib/components/Layout.js +5 -3
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/Zudoku.js +3 -2
- package/dist/lib/components/Zudoku.js.map +1 -1
- package/dist/lib/core/ZudokuContext.d.ts +7 -0
- package/dist/lib/core/ZudokuContext.js +8 -3
- package/dist/lib/core/ZudokuContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +8 -6
- package/dist/lib/plugins/markdown/MdxPage.js +2 -8
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/openapi/Endpoint.js +1 -1
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +1 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +29 -5
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +26 -0
- package/dist/lib/plugins/openapi/playground/Playground.js +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +2 -2
- package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js.map +1 -1
- package/dist/lib/plugins/openapi/state.d.ts +25 -0
- package/dist/lib/plugins/openapi/state.js +18 -0
- package/dist/lib/plugins/openapi/state.js.map +1 -0
- package/dist/lib/plugins/search-pagefind/PagefindSearch.js +13 -4
- package/dist/lib/plugins/search-pagefind/PagefindSearch.js.map +1 -1
- package/dist/lib/plugins/search-pagefind/ResultList.js +19 -12
- package/dist/lib/plugins/search-pagefind/ResultList.js.map +1 -1
- package/dist/lib/plugins/search-pagefind/get-results.d.ts +8 -1
- package/dist/lib/plugins/search-pagefind/get-results.js +9 -4
- package/dist/lib/plugins/search-pagefind/get-results.js.map +1 -1
- package/dist/lib/util/traverse.d.ts +2 -8
- package/dist/lib/util/traverse.js.map +1 -1
- package/dist/lib/util/types.d.ts +7 -0
- package/dist/lib/util/types.js +2 -0
- package/dist/lib/util/types.js.map +1 -0
- package/dist/lib/util/useScrollToAnchor.js +18 -12
- package/dist/lib/util/useScrollToAnchor.js.map +1 -1
- package/dist/vite/api/schema-codegen.d.ts +1 -1
- package/dist/vite/api/schema-codegen.js +8 -4
- package/dist/vite/api/schema-codegen.js.map +1 -1
- package/dist/vite/plugin-api.js +5 -2
- package/dist/vite/plugin-api.js.map +1 -1
- package/lib/{AuthenticationPlugin-Cij2tPWa.js → AuthenticationPlugin-Duy_R1TU.js} +3 -3
- package/lib/{AuthenticationPlugin-Cij2tPWa.js.map → AuthenticationPlugin-Duy_R1TU.js.map} +1 -1
- package/lib/{Markdown-DT5Rrq8_.js → Markdown-DIZ8nBVC.js} +742 -738
- package/lib/{Markdown-DT5Rrq8_.js.map → Markdown-DIZ8nBVC.js.map} +1 -1
- package/lib/{MdxPage-D2rD1vC4.js → MdxPage-JEdbfW-f.js} +42 -47
- package/lib/MdxPage-JEdbfW-f.js.map +1 -0
- package/lib/{OasProvider-DdEBf2qS.js → OasProvider-D1A10JeA.js} +4 -4
- package/lib/{OasProvider-DdEBf2qS.js.map → OasProvider-D1A10JeA.js.map} +1 -1
- package/lib/{OperationList-DT4-gm_S.js → OperationList-yOmYzMIp.js} +1128 -1112
- package/lib/OperationList-yOmYzMIp.js.map +1 -0
- package/lib/{Select-z1Lwl0-J.js → Select-fAYcJ0OU.js} +8 -8
- package/lib/{Select-z1Lwl0-J.js.map → Select-fAYcJ0OU.js.map} +1 -1
- package/lib/{SlotletProvider-D8OBnr77.js → SlotletProvider-BEwNY8q0.js} +4 -4
- package/lib/{SlotletProvider-D8OBnr77.js.map → SlotletProvider-BEwNY8q0.js.map} +1 -1
- package/lib/{chunk-HA7DTUK3-ZGg2W6yV.js → chunk-HA7DTUK3-C4gP41vD.js} +5 -5
- package/lib/{chunk-HA7DTUK3-ZGg2W6yV.js.map → chunk-HA7DTUK3-C4gP41vD.js.map} +1 -1
- package/lib/hook-Cge6LiTK.js +1483 -0
- package/lib/hook-Cge6LiTK.js.map +1 -0
- package/lib/{index-DdQSV2RF.js → index-B0y3fTg-.js} +261 -243
- package/lib/index-B0y3fTg-.js.map +1 -0
- package/lib/{mutation-_Z5C2wFZ.js → mutation-EChriCeF.js} +2 -2
- package/lib/{mutation-_Z5C2wFZ.js.map → mutation-EChriCeF.js.map} +1 -1
- package/lib/post-processors/traverse.js.map +1 -1
- package/lib/{useExposedProps-BslIn-FE.js → useExposedProps-B9qXJedG.js} +2 -2
- package/lib/{useExposedProps-BslIn-FE.js.map → useExposedProps-B9qXJedG.js.map} +1 -1
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-clerk.js +59 -41
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-openid.js +76 -73
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +370 -354
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +1 -1
- package/lib/zudoku.plugin-api-catalog.js +23 -24
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +15 -16
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +2 -2
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +5 -6
- package/lib/zudoku.plugin-openapi.js.map +1 -1
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +133 -98
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/lib/zudoku.plugins.js.map +1 -1
- package/package.json +2 -2
- package/src/app/main.tsx +2 -0
- package/src/lib/authentication/authentication.ts +2 -0
- package/src/lib/authentication/providers/clerk.tsx +20 -0
- package/src/lib/authentication/providers/openid.tsx +6 -0
- package/src/lib/authentication/providers/supabase.tsx +6 -0
- package/src/lib/authentication/state.ts +1 -35
- package/src/lib/components/Layout.tsx +14 -2
- package/src/lib/components/Zudoku.tsx +5 -2
- package/src/lib/core/ZudokuContext.ts +13 -6
- package/src/lib/core/plugins.ts +9 -9
- package/src/lib/plugins/markdown/MdxPage.tsx +1 -8
- package/src/lib/plugins/openapi/Endpoint.tsx +1 -1
- package/src/lib/plugins/openapi/OperationList.tsx +1 -1
- package/src/lib/plugins/openapi/Sidecar.tsx +36 -7
- package/src/lib/plugins/openapi/interfaces.ts +29 -0
- package/src/lib/plugins/openapi/playground/Playground.tsx +1 -1
- package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +2 -1
- package/src/lib/plugins/openapi/state.ts +36 -0
- package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +26 -4
- package/src/lib/plugins/search-pagefind/ResultList.tsx +59 -47
- package/src/lib/plugins/search-pagefind/get-results.tsx +31 -10
- package/src/lib/util/traverse.ts +2 -6
- package/src/lib/util/types.ts +7 -0
- package/src/lib/util/useScrollToAnchor.ts +20 -12
- package/lib/MdxPage-D2rD1vC4.js.map +0 -1
- package/lib/OperationList-DT4-gm_S.js.map +0 -1
- package/lib/hook-DzQC8PzJ.js +0 -355
- package/lib/hook-DzQC8PzJ.js.map +0 -1
- package/lib/index-DdQSV2RF.js.map +0 -1
- package/lib/joinUrl-BjDooT-T.js +0 -1154
- package/lib/joinUrl-BjDooT-T.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as t, a as c, b as n, c as u } from "./chunk-HA7DTUK3-
|
|
1
|
+
import { u as t, a as c, b as n, c as u } from "./chunk-HA7DTUK3-C4gP41vD.js";
|
|
2
2
|
const i = () => {
|
|
3
3
|
const a = t(), s = c(), [e, o] = n(), r = u();
|
|
4
4
|
return { location: a, navigate: s, params: r, searchParams: e, setSearchParams: o };
|
|
@@ -6,4 +6,4 @@ const i = () => {
|
|
|
6
6
|
export {
|
|
7
7
|
i as u
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=useExposedProps-
|
|
9
|
+
//# sourceMappingURL=useExposedProps-B9qXJedG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExposedProps-
|
|
1
|
+
{"version":3,"file":"useExposedProps-B9qXJedG.js","sources":["../src/lib/util/useExposedProps.tsx"],"sourcesContent":["import {\n useLocation,\n useNavigate,\n useParams,\n useSearchParams,\n} from \"react-router\";\nimport type { ExposedComponentProps } from \"../components/SlotletProvider.js\";\n\nexport const useExposedProps = (): ExposedComponentProps => {\n const location = useLocation();\n const navigate = useNavigate();\n const [searchParams, setSearchParams] = useSearchParams();\n const params = useParams();\n\n return { location, navigate, params, searchParams, setSearchParams };\n};\n"],"names":["useExposedProps","location","useLocation","navigate","useNavigate","searchParams","setSearchParams","useSearchParams","params","useParams"],"mappings":";AAQO,MAAMA,IAAkB,MAA6B;AAC1D,QAAMC,IAAWC,EAAY,GACvBC,IAAWC,EAAY,GACvB,CAACC,GAAcC,CAAe,IAAIC,EAAgB,GAClDC,IAASC,EAAU;AAEzB,SAAO,EAAE,UAAAR,GAAU,UAAAE,GAAU,QAAAK,GAAQ,cAAAH,GAAc,iBAAAC,EAAgB;AACrE;"}
|
package/lib/zudoku.auth-auth0.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var r = Object.defineProperty;
|
|
2
2
|
var c = (t, s, e) => s in t ? r(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
3
3
|
var n = (t, s, e) => c(t, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
-
import { u } from "./hook-
|
|
4
|
+
import { u } from "./hook-Cge6LiTK.js";
|
|
5
5
|
import { OpenIDAuthenticationProvider as d } from "./zudoku.auth-openid.js";
|
|
6
6
|
class h extends d {
|
|
7
7
|
constructor(e) {
|
package/lib/zudoku.auth-clerk.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { A as
|
|
5
|
-
import { u as l } from "./hook-
|
|
6
|
-
class
|
|
7
|
-
constructor(
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var m = (n, t, s) => t in n ? g(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s;
|
|
3
|
+
var c = (n, t, s) => m(n, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
import { A as h } from "./AuthenticationPlugin-Duy_R1TU.js";
|
|
5
|
+
import { u as l } from "./hook-Cge6LiTK.js";
|
|
6
|
+
class p extends h {
|
|
7
|
+
constructor(s) {
|
|
8
8
|
super();
|
|
9
|
-
|
|
9
|
+
c(this, "initialize", async () => {
|
|
10
10
|
var r;
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
if (
|
|
14
|
-
const e =
|
|
11
|
+
const s = await this.clerk;
|
|
12
|
+
if (s)
|
|
13
|
+
if (s.session) {
|
|
14
|
+
const e = s.session.user.emailAddresses.find(
|
|
15
15
|
(a) => a.verification.status === "verified"
|
|
16
16
|
);
|
|
17
17
|
l.setState({
|
|
18
18
|
isAuthenticated: !0,
|
|
19
19
|
isPending: !1,
|
|
20
20
|
profile: {
|
|
21
|
-
sub:
|
|
22
|
-
name:
|
|
23
|
-
email: (e == null ? void 0 : e.emailAddress) ?? ((r =
|
|
21
|
+
sub: s.session.user.id,
|
|
22
|
+
name: s.session.user.fullName ?? void 0,
|
|
23
|
+
email: (e == null ? void 0 : e.emailAddress) ?? ((r = s.session.user.emailAddresses[0]) == null ? void 0 : r.emailAddress),
|
|
24
24
|
emailVerified: e !== void 0,
|
|
25
|
-
pictureUrl:
|
|
25
|
+
pictureUrl: s.session.user.imageUrl
|
|
26
|
+
},
|
|
27
|
+
providerData: {
|
|
28
|
+
user: s.session.user
|
|
26
29
|
}
|
|
27
30
|
});
|
|
28
31
|
} else
|
|
@@ -32,23 +35,23 @@ class h extends m {
|
|
|
32
35
|
profile: void 0
|
|
33
36
|
});
|
|
34
37
|
});
|
|
35
|
-
this.clerk =
|
|
38
|
+
this.clerk = s;
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
|
-
const
|
|
41
|
+
const y = ({
|
|
39
42
|
clerkPubKey: n,
|
|
40
|
-
redirectToAfterSignOut:
|
|
41
|
-
redirectToAfterSignUp:
|
|
43
|
+
redirectToAfterSignOut: t = "/",
|
|
44
|
+
redirectToAfterSignUp: s = "/",
|
|
42
45
|
redirectToAfterSignIn: r = "/"
|
|
43
46
|
}) => {
|
|
44
47
|
let e;
|
|
45
48
|
const a = (async () => {
|
|
46
|
-
var
|
|
49
|
+
var o;
|
|
47
50
|
if (typeof window > "u") return;
|
|
48
|
-
const { Clerk:
|
|
49
|
-
if (e = new
|
|
50
|
-
const
|
|
51
|
-
(
|
|
51
|
+
const { Clerk: i } = await import("@clerk/clerk-js");
|
|
52
|
+
if (e = new i(n), await e.load(), e.user) {
|
|
53
|
+
const u = e.user.emailAddresses.find(
|
|
54
|
+
(w) => w.verification.status === "verified"
|
|
52
55
|
);
|
|
53
56
|
l.setState({
|
|
54
57
|
isAuthenticated: !0,
|
|
@@ -56,27 +59,42 @@ const v = ({
|
|
|
56
59
|
profile: {
|
|
57
60
|
sub: e.user.id,
|
|
58
61
|
name: e.user.fullName ?? void 0,
|
|
59
|
-
email: (
|
|
60
|
-
emailVerified:
|
|
62
|
+
email: (u == null ? void 0 : u.emailAddress) ?? ((o = e.user.emailAddresses[0]) == null ? void 0 : o.emailAddress),
|
|
63
|
+
emailVerified: u !== void 0,
|
|
61
64
|
pictureUrl: e.user.imageUrl
|
|
65
|
+
},
|
|
66
|
+
providerData: {
|
|
67
|
+
user: {
|
|
68
|
+
publicMetadata: e.user.publicMetadata,
|
|
69
|
+
id: e.user.id,
|
|
70
|
+
emailAddresses: e.user.emailAddresses,
|
|
71
|
+
imageUrl: e.user.imageUrl,
|
|
72
|
+
fullName: e.user.fullName
|
|
73
|
+
}
|
|
62
74
|
}
|
|
63
75
|
});
|
|
64
76
|
}
|
|
65
77
|
return e;
|
|
66
78
|
})();
|
|
67
|
-
async function
|
|
79
|
+
async function d() {
|
|
68
80
|
if (await a, !(e != null && e.session))
|
|
69
81
|
throw new Error("No session available");
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
82
|
+
const i = await e.session.getToken();
|
|
83
|
+
if (!i)
|
|
72
84
|
throw new Error("Could not get access token from Clerk");
|
|
73
|
-
return
|
|
85
|
+
return i;
|
|
86
|
+
}
|
|
87
|
+
async function f(i) {
|
|
88
|
+
const o = await d();
|
|
89
|
+
return i.headers.set("Authorization", `Bearer ${o}`), i;
|
|
74
90
|
}
|
|
75
91
|
return {
|
|
76
|
-
|
|
92
|
+
clerk: e,
|
|
93
|
+
getAccessToken: d,
|
|
94
|
+
signRequest: f,
|
|
77
95
|
signOut: async () => {
|
|
78
96
|
await a, await (e == null ? void 0 : e.signOut({
|
|
79
|
-
redirectUrl: window.location.origin +
|
|
97
|
+
redirectUrl: window.location.origin + t
|
|
80
98
|
})), l.setState({
|
|
81
99
|
isAuthenticated: !1,
|
|
82
100
|
isPending: !1,
|
|
@@ -84,24 +102,24 @@ const v = ({
|
|
|
84
102
|
providerData: null
|
|
85
103
|
});
|
|
86
104
|
},
|
|
87
|
-
signIn: async ({ redirectTo:
|
|
105
|
+
signIn: async ({ redirectTo: i }) => {
|
|
88
106
|
await a, await (e == null ? void 0 : e.redirectToSignIn({
|
|
89
|
-
signInForceRedirectUrl:
|
|
90
|
-
signUpForceRedirectUrl:
|
|
107
|
+
signInForceRedirectUrl: i ?? window.location.origin + r,
|
|
108
|
+
signUpForceRedirectUrl: i ?? window.location.origin + s
|
|
91
109
|
}));
|
|
92
110
|
},
|
|
93
|
-
signUp: async ({ redirectTo:
|
|
111
|
+
signUp: async ({ redirectTo: i }) => {
|
|
94
112
|
await a, await (e == null ? void 0 : e.redirectToSignUp({
|
|
95
|
-
signInForceRedirectUrl:
|
|
96
|
-
signUpForceRedirectUrl:
|
|
113
|
+
signInForceRedirectUrl: i ?? window.location.origin + r,
|
|
114
|
+
signUpForceRedirectUrl: i ?? window.location.origin + s
|
|
97
115
|
}));
|
|
98
116
|
},
|
|
99
117
|
getAuthenticationPlugin() {
|
|
100
|
-
return new
|
|
118
|
+
return new p(a);
|
|
101
119
|
}
|
|
102
120
|
};
|
|
103
121
|
};
|
|
104
122
|
export {
|
|
105
|
-
|
|
123
|
+
y as default
|
|
106
124
|
};
|
|
107
125
|
//# sourceMappingURL=zudoku.auth-clerk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zudoku.auth-clerk.js","sources":["../src/lib/authentication/providers/clerk.tsx"],"sourcesContent":["import type { Clerk } from \"@clerk/clerk-js\";\nimport { type ClerkAuthenticationConfig } from \"../../../config/config.js\";\nimport { type AuthenticationProviderInitializer } from \"../authentication.js\";\nimport { AuthenticationPlugin } from \"../AuthenticationPlugin.js\";\nimport { useAuthState } from \"../state.js\";\n\nclass ClerkAuthPlugin extends AuthenticationPlugin {\n constructor(private clerk: Promise<Clerk | undefined>) {\n super();\n }\n initialize = async () => {\n const clerk = await this.clerk;\n\n if (!clerk) {\n return;\n }\n\n if (clerk.session) {\n const verifiedEmail = clerk.session.user.emailAddresses.find(\n (email) => email.verification.status === \"verified\",\n );\n useAuthState.setState({\n isAuthenticated: true,\n isPending: false,\n profile: {\n sub: clerk.session.user.id,\n name: clerk.session.user.fullName ?? undefined,\n email:\n verifiedEmail?.emailAddress ??\n clerk.session.user.emailAddresses[0]?.emailAddress,\n emailVerified: verifiedEmail !== undefined,\n pictureUrl: clerk.session.user.imageUrl,\n },\n });\n } else {\n useAuthState.setState({\n isAuthenticated: false,\n isPending: false,\n profile: undefined,\n });\n }\n };\n}\n\nconst clerkAuth: AuthenticationProviderInitializer<\n ClerkAuthenticationConfig\n> = ({\n clerkPubKey,\n redirectToAfterSignOut = \"/\",\n redirectToAfterSignUp = \"/\",\n redirectToAfterSignIn = \"/\",\n}) => {\n let clerkApi: Clerk | undefined;\n const ensureLoaded = (async () => {\n if (typeof window === \"undefined\") return;\n const { Clerk } = await import(\"@clerk/clerk-js\");\n clerkApi = new Clerk(clerkPubKey);\n\n await clerkApi.load();\n\n if (clerkApi.user) {\n const verifiedEmail = clerkApi.user.emailAddresses.find(\n (email) => email.verification.status === \"verified\",\n );\n useAuthState.setState({\n isAuthenticated: true,\n isPending: false,\n profile: {\n sub: clerkApi.user.id,\n name: clerkApi.user.fullName ?? undefined,\n email:\n verifiedEmail?.emailAddress ??\n clerkApi.user.emailAddresses[0]?.emailAddress,\n emailVerified: verifiedEmail !== undefined,\n pictureUrl: clerkApi.user.imageUrl,\n },\n });\n }\n\n return clerkApi;\n })();\n\n async function getAccessToken() {\n await ensureLoaded;\n if (!clerkApi?.session) {\n throw new Error(\"No session available\");\n }\n const response = await clerkApi.session.getToken();\n if (!response) {\n throw new Error(\"Could not get access token from Clerk\");\n }\n return response;\n }\n\n return {\n getAccessToken,\n signOut: async () => {\n await ensureLoaded;\n await clerkApi?.signOut({\n redirectUrl: window.location.origin + redirectToAfterSignOut,\n });\n useAuthState.setState({\n isAuthenticated: false,\n isPending: false,\n profile: null,\n providerData: null,\n });\n },\n signIn: async ({ redirectTo }: { redirectTo?: string }) => {\n await ensureLoaded;\n await clerkApi?.redirectToSignIn({\n signInForceRedirectUrl:\n redirectTo ?? window.location.origin + redirectToAfterSignIn,\n signUpForceRedirectUrl:\n redirectTo ?? window.location.origin + redirectToAfterSignUp,\n });\n },\n signUp: async ({ redirectTo }: { redirectTo?: string }) => {\n await ensureLoaded;\n await clerkApi?.redirectToSignUp({\n signInForceRedirectUrl:\n redirectTo ?? window.location.origin + redirectToAfterSignIn,\n signUpForceRedirectUrl:\n redirectTo ?? window.location.origin + redirectToAfterSignUp,\n });\n },\n getAuthenticationPlugin() {\n return new ClerkAuthPlugin(ensureLoaded);\n },\n };\n};\n\nexport default clerkAuth;\n"],"names":["ClerkAuthPlugin","AuthenticationPlugin","clerk","__publicField","verifiedEmail","email","useAuthState","_a","clerkAuth","clerkPubKey","redirectToAfterSignOut","redirectToAfterSignUp","redirectToAfterSignIn","clerkApi","ensureLoaded","Clerk","getAccessToken","response","redirectTo"],"mappings":";;;;;AAMA,MAAMA,UAAwBC,EAAqB;AAAA,EACjD,YAAoBC,GAAmC;AAC/C,UAAA;AAER,IAAAC,EAAA,oBAAa,YAAY;;AACjB,YAAAD,IAAQ,MAAM,KAAK;AAEzB,UAAKA;AAIL,YAAIA,EAAM,SAAS;AACjB,gBAAME,IAAgBF,EAAM,QAAQ,KAAK,eAAe;AAAA,YACtD,CAACG,MAAUA,EAAM,aAAa,WAAW;AAAA,UAC3C;AACA,UAAAC,EAAa,SAAS;AAAA,YACpB,iBAAiB;AAAA,YACjB,WAAW;AAAA,YACX,SAAS;AAAA,cACP,KAAKJ,EAAM,QAAQ,KAAK;AAAA,cACxB,MAAMA,EAAM,QAAQ,KAAK,YAAY;AAAA,cACrC,QACEE,KAAA,gBAAAA,EAAe,mBACfG,IAAAL,EAAM,QAAQ,KAAK,eAAe,CAAC,MAAnC,gBAAAK,EAAsC;AAAA,cACxC,eAAeH,MAAkB;AAAA,cACjC,YAAYF,EAAM,QAAQ,KAAK;AAAA,YAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"zudoku.auth-clerk.js","sources":["../src/lib/authentication/providers/clerk.tsx"],"sourcesContent":["import type { Clerk } from \"@clerk/clerk-js\";\nimport { type ClerkAuthenticationConfig } from \"../../../config/config.js\";\nimport { type AuthenticationProviderInitializer } from \"../authentication.js\";\nimport { AuthenticationPlugin } from \"../AuthenticationPlugin.js\";\nimport { useAuthState } from \"../state.js\";\n\nclass ClerkAuthPlugin extends AuthenticationPlugin {\n constructor(private clerk: Promise<Clerk | undefined>) {\n super();\n }\n initialize = async () => {\n const clerk = await this.clerk;\n\n if (!clerk) {\n return;\n }\n\n if (clerk.session) {\n const verifiedEmail = clerk.session.user.emailAddresses.find(\n (email) => email.verification.status === \"verified\",\n );\n useAuthState.setState({\n isAuthenticated: true,\n isPending: false,\n profile: {\n sub: clerk.session.user.id,\n name: clerk.session.user.fullName ?? undefined,\n email:\n verifiedEmail?.emailAddress ??\n clerk.session.user.emailAddresses[0]?.emailAddress,\n emailVerified: verifiedEmail !== undefined,\n pictureUrl: clerk.session.user.imageUrl,\n },\n providerData: {\n user: clerk.session.user,\n },\n });\n } else {\n useAuthState.setState({\n isAuthenticated: false,\n isPending: false,\n profile: undefined,\n });\n }\n };\n}\n\nconst clerkAuth: AuthenticationProviderInitializer<\n ClerkAuthenticationConfig\n> = ({\n clerkPubKey,\n redirectToAfterSignOut = \"/\",\n redirectToAfterSignUp = \"/\",\n redirectToAfterSignIn = \"/\",\n}) => {\n let clerkApi: Clerk | undefined;\n const ensureLoaded = (async () => {\n if (typeof window === \"undefined\") return;\n const { Clerk } = await import(\"@clerk/clerk-js\");\n clerkApi = new Clerk(clerkPubKey);\n\n await clerkApi.load();\n\n if (clerkApi.user) {\n const verifiedEmail = clerkApi.user.emailAddresses.find(\n (email) => email.verification.status === \"verified\",\n );\n useAuthState.setState({\n isAuthenticated: true,\n isPending: false,\n profile: {\n sub: clerkApi.user.id,\n name: clerkApi.user.fullName ?? undefined,\n email:\n verifiedEmail?.emailAddress ??\n clerkApi.user.emailAddresses[0]?.emailAddress,\n emailVerified: verifiedEmail !== undefined,\n pictureUrl: clerkApi.user.imageUrl,\n },\n providerData: {\n user: {\n publicMetadata: clerkApi.user.publicMetadata,\n id: clerkApi.user.id,\n emailAddresses: clerkApi.user.emailAddresses,\n imageUrl: clerkApi.user.imageUrl,\n fullName: clerkApi.user.fullName,\n },\n },\n });\n }\n\n return clerkApi;\n })();\n\n async function getAccessToken() {\n await ensureLoaded;\n if (!clerkApi?.session) {\n throw new Error(\"No session available\");\n }\n const response = await clerkApi.session.getToken();\n if (!response) {\n throw new Error(\"Could not get access token from Clerk\");\n }\n return response;\n }\n\n async function signRequest(request: Request): Promise<Request> {\n const response = await getAccessToken();\n request.headers.set(\"Authorization\", `Bearer ${response}`);\n return request;\n }\n\n return {\n clerk: clerkApi,\n getAccessToken,\n signRequest,\n signOut: async () => {\n await ensureLoaded;\n await clerkApi?.signOut({\n redirectUrl: window.location.origin + redirectToAfterSignOut,\n });\n useAuthState.setState({\n isAuthenticated: false,\n isPending: false,\n profile: null,\n providerData: null,\n });\n },\n signIn: async ({ redirectTo }: { redirectTo?: string }) => {\n await ensureLoaded;\n await clerkApi?.redirectToSignIn({\n signInForceRedirectUrl:\n redirectTo ?? window.location.origin + redirectToAfterSignIn,\n signUpForceRedirectUrl:\n redirectTo ?? window.location.origin + redirectToAfterSignUp,\n });\n },\n signUp: async ({ redirectTo }: { redirectTo?: string }) => {\n await ensureLoaded;\n await clerkApi?.redirectToSignUp({\n signInForceRedirectUrl:\n redirectTo ?? window.location.origin + redirectToAfterSignIn,\n signUpForceRedirectUrl:\n redirectTo ?? window.location.origin + redirectToAfterSignUp,\n });\n },\n getAuthenticationPlugin() {\n return new ClerkAuthPlugin(ensureLoaded);\n },\n };\n};\n\nexport default clerkAuth;\n"],"names":["ClerkAuthPlugin","AuthenticationPlugin","clerk","__publicField","verifiedEmail","email","useAuthState","_a","clerkAuth","clerkPubKey","redirectToAfterSignOut","redirectToAfterSignUp","redirectToAfterSignIn","clerkApi","ensureLoaded","Clerk","getAccessToken","response","signRequest","request","redirectTo"],"mappings":";;;;;AAMA,MAAMA,UAAwBC,EAAqB;AAAA,EACjD,YAAoBC,GAAmC;AAC/C,UAAA;AAER,IAAAC,EAAA,oBAAa,YAAY;;AACjB,YAAAD,IAAQ,MAAM,KAAK;AAEzB,UAAKA;AAIL,YAAIA,EAAM,SAAS;AACjB,gBAAME,IAAgBF,EAAM,QAAQ,KAAK,eAAe;AAAA,YACtD,CAACG,MAAUA,EAAM,aAAa,WAAW;AAAA,UAC3C;AACA,UAAAC,EAAa,SAAS;AAAA,YACpB,iBAAiB;AAAA,YACjB,WAAW;AAAA,YACX,SAAS;AAAA,cACP,KAAKJ,EAAM,QAAQ,KAAK;AAAA,cACxB,MAAMA,EAAM,QAAQ,KAAK,YAAY;AAAA,cACrC,QACEE,KAAA,gBAAAA,EAAe,mBACfG,IAAAL,EAAM,QAAQ,KAAK,eAAe,CAAC,MAAnC,gBAAAK,EAAsC;AAAA,cACxC,eAAeH,MAAkB;AAAA,cACjC,YAAYF,EAAM,QAAQ,KAAK;AAAA,YACjC;AAAA,YACA,cAAc;AAAA,cACZ,MAAMA,EAAM,QAAQ;AAAA,YAAA;AAAA,UACtB,CACD;AAAA,QAAA;AAED,UAAAI,EAAa,SAAS;AAAA,YACpB,iBAAiB;AAAA,YACjB,WAAW;AAAA,YACX,SAAS;AAAA,UAAA,CACV;AAAA,IAEL;AArCoB,SAAA,QAAAJ;AAAA,EAAA;AAsCtB;AAEA,MAAMM,IAEF,CAAC;AAAA,EACH,aAAAC;AAAA,EACA,wBAAAC,IAAyB;AAAA,EACzB,uBAAAC,IAAwB;AAAA,EACxB,uBAAAC,IAAwB;AAC1B,MAAM;AACA,MAAAC;AACJ,QAAMC,KAAgB,YAAY;;AAC5B,QAAA,OAAO,SAAW,IAAa;AACnC,UAAM,EAAE,OAAAC,EAAA,IAAU,MAAM,OAAO,iBAAiB;AAKhD,QAJWF,IAAA,IAAIE,EAAMN,CAAW,GAEhC,MAAMI,EAAS,KAAK,GAEhBA,EAAS,MAAM;AACX,YAAAT,IAAgBS,EAAS,KAAK,eAAe;AAAA,QACjD,CAACR,MAAUA,EAAM,aAAa,WAAW;AAAA,MAC3C;AACA,MAAAC,EAAa,SAAS;AAAA,QACpB,iBAAiB;AAAA,QACjB,WAAW;AAAA,QACX,SAAS;AAAA,UACP,KAAKO,EAAS,KAAK;AAAA,UACnB,MAAMA,EAAS,KAAK,YAAY;AAAA,UAChC,QACET,KAAA,gBAAAA,EAAe,mBACfG,IAAAM,EAAS,KAAK,eAAe,CAAC,MAA9B,gBAAAN,EAAiC;AAAA,UACnC,eAAeH,MAAkB;AAAA,UACjC,YAAYS,EAAS,KAAK;AAAA,QAC5B;AAAA,QACA,cAAc;AAAA,UACZ,MAAM;AAAA,YACJ,gBAAgBA,EAAS,KAAK;AAAA,YAC9B,IAAIA,EAAS,KAAK;AAAA,YAClB,gBAAgBA,EAAS,KAAK;AAAA,YAC9B,UAAUA,EAAS,KAAK;AAAA,YACxB,UAAUA,EAAS,KAAK;AAAA,UAAA;AAAA,QAC1B;AAAA,MACF,CACD;AAAA,IAAA;AAGI,WAAAA;AAAA,EAAA,GACN;AAEH,iBAAeG,IAAiB;AAE1B,QADE,MAAAF,GACF,EAACD,KAAA,QAAAA,EAAU;AACP,YAAA,IAAI,MAAM,sBAAsB;AAExC,UAAMI,IAAW,MAAMJ,EAAS,QAAQ,SAAS;AACjD,QAAI,CAACI;AACG,YAAA,IAAI,MAAM,uCAAuC;AAElD,WAAAA;AAAA,EAAA;AAGT,iBAAeC,EAAYC,GAAoC;AACvD,UAAAF,IAAW,MAAMD,EAAe;AACtC,WAAAG,EAAQ,QAAQ,IAAI,iBAAiB,UAAUF,CAAQ,EAAE,GAClDE;AAAA,EAAA;AAGF,SAAA;AAAA,IACL,OAAON;AAAA,IACP,gBAAAG;AAAA,IACA,aAAAE;AAAA,IACA,SAAS,YAAY;AACb,YAAAJ,GACN,OAAMD,KAAA,gBAAAA,EAAU,QAAQ;AAAA,QACtB,aAAa,OAAO,SAAS,SAASH;AAAA,MAAA,KAExCJ,EAAa,SAAS;AAAA,QACpB,iBAAiB;AAAA,QACjB,WAAW;AAAA,QACX,SAAS;AAAA,QACT,cAAc;AAAA,MAAA,CACf;AAAA,IACH;AAAA,IACA,QAAQ,OAAO,EAAE,YAAAc,QAA0C;AACnD,YAAAN,GACN,OAAMD,KAAA,gBAAAA,EAAU,iBAAiB;AAAA,QAC/B,wBACEO,KAAc,OAAO,SAAS,SAASR;AAAA,QACzC,wBACEQ,KAAc,OAAO,SAAS,SAAST;AAAA,MAAA;AAAA,IAE7C;AAAA,IACA,QAAQ,OAAO,EAAE,YAAAS,QAA0C;AACnD,YAAAN,GACN,OAAMD,KAAA,gBAAAA,EAAU,iBAAiB;AAAA,QAC/B,wBACEO,KAAc,OAAO,SAAS,SAASR;AAAA,QACzC,wBACEQ,KAAc,OAAO,SAAS,SAAST;AAAA,MAAA;AAAA,IAE7C;AAAA,IACA,0BAA0B;AACjB,aAAA,IAAIX,EAAgBc,CAAY;AAAA,IAAA;AAAA,EAE3C;AACF;"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
var Le = Object.defineProperty;
|
|
2
2
|
var xe = (t, e, n) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var
|
|
3
|
+
var b = (t, e, n) => xe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
import { j as B } from "./jsx-runtime-CYK1ROHF.js";
|
|
5
5
|
import { g as Ce } from "./_commonjsHelpers-BkfeUUK-.js";
|
|
6
6
|
import { C as Ie } from "./ClientOnly-E7hGysn1.js";
|
|
7
|
-
import {
|
|
8
|
-
import { A as
|
|
9
|
-
import {
|
|
10
|
-
import { N as Oe } from "./chunk-HA7DTUK3-ZGg2W6yV.js";
|
|
7
|
+
import { b as je, d as ie, u as x } from "./hook-Cge6LiTK.js";
|
|
8
|
+
import { A as Je } from "./AuthenticationPlugin-Duy_R1TU.js";
|
|
9
|
+
import { N as Oe } from "./chunk-HA7DTUK3-C4gP41vD.js";
|
|
11
10
|
import { Z as ze } from "./invariant-Caa8-XvF.js";
|
|
12
11
|
var D = { exports: {} }, De = D.exports, ae;
|
|
13
12
|
function Ne() {
|
|
@@ -23,8 +22,8 @@ function Ne() {
|
|
|
23
22
|
"warn",
|
|
24
23
|
"error"
|
|
25
24
|
], r = {}, i = null;
|
|
26
|
-
function c(l,
|
|
27
|
-
var u = l[
|
|
25
|
+
function c(l, m) {
|
|
26
|
+
var u = l[m];
|
|
28
27
|
if (typeof u.bind == "function")
|
|
29
28
|
return u.bind(l);
|
|
30
29
|
try {
|
|
@@ -42,9 +41,9 @@ function Ne() {
|
|
|
42
41
|
return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && o ? p : console[l] !== void 0 ? c(console, l) : console.log !== void 0 ? c(console, "log") : e;
|
|
43
42
|
}
|
|
44
43
|
function f() {
|
|
45
|
-
for (var l = this.getLevel(),
|
|
46
|
-
var u = a[
|
|
47
|
-
this[u] =
|
|
44
|
+
for (var l = this.getLevel(), m = 0; m < a.length; m++) {
|
|
45
|
+
var u = a[m];
|
|
46
|
+
this[u] = m < l ? e : this.methodFactory(u, l, this.name);
|
|
48
47
|
}
|
|
49
48
|
if (this.log = this.debug, typeof console === n && l < this.levels.SILENT)
|
|
50
49
|
return "No console available for logging";
|
|
@@ -54,10 +53,10 @@ function Ne() {
|
|
|
54
53
|
typeof console !== n && (f.call(this), this[l].apply(this, arguments));
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
|
-
function
|
|
56
|
+
function _(l, m, u) {
|
|
58
57
|
return w(l) || v.apply(this, arguments);
|
|
59
58
|
}
|
|
60
|
-
function h(l,
|
|
59
|
+
function h(l, m) {
|
|
61
60
|
var u = this, J, $, U, S = "loglevel";
|
|
62
61
|
typeof l == "string" ? S += ":" + l : typeof l == "symbol" && (S = void 0);
|
|
63
62
|
function Re(d) {
|
|
@@ -117,7 +116,7 @@ function Ne() {
|
|
|
117
116
|
WARN: 3,
|
|
118
117
|
ERROR: 4,
|
|
119
118
|
SILENT: 5
|
|
120
|
-
}, u.methodFactory =
|
|
119
|
+
}, u.methodFactory = m || _, u.getLevel = function() {
|
|
121
120
|
return U ?? $ ?? J;
|
|
122
121
|
}, u.setLevel = function(d, y) {
|
|
123
122
|
return U = L(d), y !== !1 && Re(U), f.call(u);
|
|
@@ -139,12 +138,12 @@ function Ne() {
|
|
|
139
138
|
var re = ne();
|
|
140
139
|
re != null && (U = L(re)), f.call(u);
|
|
141
140
|
}
|
|
142
|
-
i = new h(), i.getLogger = function(
|
|
143
|
-
if (typeof
|
|
141
|
+
i = new h(), i.getLogger = function(m) {
|
|
142
|
+
if (typeof m != "symbol" && typeof m != "string" || m === "")
|
|
144
143
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
145
|
-
var u = r[
|
|
146
|
-
return u || (u = r[
|
|
147
|
-
|
|
144
|
+
var u = r[m];
|
|
145
|
+
return u || (u = r[m] = new h(
|
|
146
|
+
m,
|
|
148
147
|
i.methodFactory
|
|
149
148
|
)), u;
|
|
150
149
|
};
|
|
@@ -232,20 +231,20 @@ class Ye extends Error {
|
|
|
232
231
|
super(e, n), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
|
|
233
232
|
}
|
|
234
233
|
}
|
|
235
|
-
const s = Ye,
|
|
236
|
-
function
|
|
234
|
+
const s = Ye, ge = new Ge(100);
|
|
235
|
+
function me(t) {
|
|
237
236
|
return t instanceof CryptoKey;
|
|
238
237
|
}
|
|
239
238
|
function Ze(t) {
|
|
240
|
-
return
|
|
239
|
+
return me(t) && t.type === "private";
|
|
241
240
|
}
|
|
242
241
|
function Qe(t) {
|
|
243
|
-
return
|
|
242
|
+
return me(t) && t.type === "public";
|
|
244
243
|
}
|
|
245
244
|
function Q(t) {
|
|
246
245
|
try {
|
|
247
246
|
const e = t.headers.get("dpop-nonce");
|
|
248
|
-
e &&
|
|
247
|
+
e && ge.set(new URL(t.url).origin, e);
|
|
249
248
|
} catch {
|
|
250
249
|
}
|
|
251
250
|
return t;
|
|
@@ -292,7 +291,7 @@ async function et(t, e) {
|
|
|
292
291
|
signal: null
|
|
293
292
|
}).then(Q);
|
|
294
293
|
}
|
|
295
|
-
function
|
|
294
|
+
function g(t) {
|
|
296
295
|
return typeof t == "string" && t.length !== 0;
|
|
297
296
|
}
|
|
298
297
|
async function tt(t, e) {
|
|
@@ -311,7 +310,7 @@ async function tt(t, e) {
|
|
|
311
310
|
}
|
|
312
311
|
if (!C(n))
|
|
313
312
|
throw new s('"response" body must be a top level object');
|
|
314
|
-
if (!
|
|
313
|
+
if (!g(n.issuer))
|
|
315
314
|
throw new s('"response" body "issuer" property must be a non-empty string');
|
|
316
315
|
if (new URL(n.issuer).href !== t.href)
|
|
317
316
|
throw new s('"response" body "issuer" does not match "expectedIssuer"');
|
|
@@ -327,7 +326,7 @@ function rt() {
|
|
|
327
326
|
return X();
|
|
328
327
|
}
|
|
329
328
|
async function ot(t) {
|
|
330
|
-
if (!
|
|
329
|
+
if (!g(t))
|
|
331
330
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
332
331
|
return k(await crypto.subtle.digest("SHA-256", E(t)));
|
|
333
332
|
}
|
|
@@ -403,19 +402,19 @@ function ee() {
|
|
|
403
402
|
function I(t) {
|
|
404
403
|
if (typeof t != "object" || t === null)
|
|
405
404
|
throw new TypeError('"as" must be an object');
|
|
406
|
-
if (!
|
|
405
|
+
if (!g(t.issuer))
|
|
407
406
|
throw new TypeError('"as.issuer" property must be a non-empty string');
|
|
408
407
|
return !0;
|
|
409
408
|
}
|
|
410
409
|
function j(t) {
|
|
411
410
|
if (typeof t != "object" || t === null)
|
|
412
411
|
throw new TypeError('"client" must be an object');
|
|
413
|
-
if (!
|
|
412
|
+
if (!g(t.client_id))
|
|
414
413
|
throw new TypeError('"client.client_id" property must be a non-empty string');
|
|
415
414
|
return !0;
|
|
416
415
|
}
|
|
417
416
|
function le(t) {
|
|
418
|
-
if (!
|
|
417
|
+
if (!g(t))
|
|
419
418
|
throw new TypeError('"client.client_secret" property must be a non-empty string');
|
|
420
419
|
return t;
|
|
421
420
|
}
|
|
@@ -453,13 +452,13 @@ async function dt(t, e, n) {
|
|
|
453
452
|
return `${o}.${a}`;
|
|
454
453
|
}
|
|
455
454
|
async function ht(t, e, n, o, a, r) {
|
|
456
|
-
var
|
|
457
|
-
const { privateKey: i, publicKey: c, nonce: p =
|
|
455
|
+
var _;
|
|
456
|
+
const { privateKey: i, publicKey: c, nonce: p = ge.get(n.origin) } = e;
|
|
458
457
|
if (!Ze(i))
|
|
459
458
|
throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
|
|
460
459
|
if (!Qe(c))
|
|
461
460
|
throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
|
|
462
|
-
if (p !== void 0 && !
|
|
461
|
+
if (p !== void 0 && !g(p))
|
|
463
462
|
throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
|
|
464
463
|
if (!c.extractable)
|
|
465
464
|
throw new TypeError('"DPoP.publicKey.extractable" must be true');
|
|
@@ -475,7 +474,7 @@ async function ht(t, e, n, o, a, r) {
|
|
|
475
474
|
htu: `${n.origin}${n.pathname}`,
|
|
476
475
|
ath: r ? k(await crypto.subtle.digest("SHA-256", E(r))) : void 0
|
|
477
476
|
};
|
|
478
|
-
(
|
|
477
|
+
(_ = e[He]) == null || _.call(e, f, v), t.set("dpop", await dt(f, v, i));
|
|
479
478
|
}
|
|
480
479
|
let N;
|
|
481
480
|
async function ft(t) {
|
|
@@ -501,7 +500,7 @@ function G(t) {
|
|
|
501
500
|
return typeof e != "object" || Array.isArray(e) || e === null ? !1 : e.error !== void 0;
|
|
502
501
|
}
|
|
503
502
|
async function wt(t, e, n, o, a, r) {
|
|
504
|
-
if (!
|
|
503
|
+
if (!g(t))
|
|
505
504
|
throw new TypeError('"accessToken" must be a non-empty string');
|
|
506
505
|
if (!(n instanceof URL))
|
|
507
506
|
throw new TypeError('"url" must be an instance of URL');
|
|
@@ -513,7 +512,7 @@ async function wt(t, e, n, o, a, r) {
|
|
|
513
512
|
signal: r != null && r.signal ? Xe(r.signal) : null
|
|
514
513
|
}).then(Q);
|
|
515
514
|
}
|
|
516
|
-
async function
|
|
515
|
+
async function gt(t, e, n, o) {
|
|
517
516
|
I(t), j(e);
|
|
518
517
|
const a = be(t, "userinfo_endpoint", _e(e, o)), r = K(o == null ? void 0 : o.headers);
|
|
519
518
|
return e.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), wt(n, "GET", a, r, null, {
|
|
@@ -521,7 +520,7 @@ async function mt(t, e, n, o) {
|
|
|
521
520
|
[W]: H(e)
|
|
522
521
|
});
|
|
523
522
|
}
|
|
524
|
-
async function
|
|
523
|
+
async function mt(t, e, n, o, a, r, i) {
|
|
525
524
|
return await lt(t, e, a, r), r.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[Z]) || fetch)(o.href, {
|
|
526
525
|
body: a,
|
|
527
526
|
headers: Object.fromEntries(r.entries()),
|
|
@@ -534,10 +533,10 @@ async function ve(t, e, n, o, a) {
|
|
|
534
533
|
const r = be(t, "token_endpoint", _e(e, a));
|
|
535
534
|
o.set("grant_type", n);
|
|
536
535
|
const i = K(a == null ? void 0 : a.headers);
|
|
537
|
-
return i.set("accept", "application/json"),
|
|
536
|
+
return i.set("accept", "application/json"), mt(t, e, "POST", r, o, i, a);
|
|
538
537
|
}
|
|
539
538
|
async function yt(t, e, n, o) {
|
|
540
|
-
if (I(t), j(e), !
|
|
539
|
+
if (I(t), j(e), !g(n))
|
|
541
540
|
throw new TypeError('"refreshToken" must be a non-empty string');
|
|
542
541
|
const a = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
|
|
543
542
|
return a.set("refresh_token", n), ve(t, e, "refresh_token", a, o);
|
|
@@ -569,20 +568,20 @@ async function Te(t, e, n, o = !1, a = !1) {
|
|
|
569
568
|
}
|
|
570
569
|
if (!C(r))
|
|
571
570
|
throw new s('"response" body must be a top level object');
|
|
572
|
-
if (!
|
|
571
|
+
if (!g(r.access_token))
|
|
573
572
|
throw new s('"response" body "access_token" property must be a non-empty string');
|
|
574
|
-
if (!
|
|
573
|
+
if (!g(r.token_type))
|
|
575
574
|
throw new s('"response" body "token_type" property must be a non-empty string');
|
|
576
575
|
if (r.token_type = r.token_type.toLowerCase(), r.token_type !== "dpop" && r.token_type !== "bearer")
|
|
577
576
|
throw new T("unsupported `token_type` value");
|
|
578
577
|
if (r.expires_in !== void 0 && (typeof r.expires_in != "number" || r.expires_in <= 0))
|
|
579
578
|
throw new s('"response" body "expires_in" property must be a positive number');
|
|
580
|
-
if (!a && r.refresh_token !== void 0 && !
|
|
579
|
+
if (!a && r.refresh_token !== void 0 && !g(r.refresh_token))
|
|
581
580
|
throw new s('"response" body "refresh_token" property must be a non-empty string');
|
|
582
581
|
if (r.scope !== void 0 && typeof r.scope != "string")
|
|
583
582
|
throw new s('"response" body "scope" property must be a string');
|
|
584
583
|
if (!o) {
|
|
585
|
-
if (r.id_token !== void 0 && !
|
|
584
|
+
if (r.id_token !== void 0 && !g(r.id_token))
|
|
586
585
|
throw new s('"response" body "id_token" property must be a non-empty string');
|
|
587
586
|
if (r.id_token) {
|
|
588
587
|
const { claims: i, jwt: c } = await Ct(r.id_token, It.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ee, H(e), ye(e), e[$e]).then(Et.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(St.bind(void 0, t.issuer)).then(vt.bind(void 0, e.client_id));
|
|
@@ -622,9 +621,9 @@ function Tt(t) {
|
|
|
622
621
|
async function At(t, e, n, o, a, r) {
|
|
623
622
|
if (I(t), j(e), !Ae.has(n))
|
|
624
623
|
throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
|
|
625
|
-
if (!
|
|
624
|
+
if (!g(o))
|
|
626
625
|
throw new TypeError('"redirectUri" must be a non-empty string');
|
|
627
|
-
if (!
|
|
626
|
+
if (!g(a))
|
|
628
627
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
629
628
|
const i = A(n, "code");
|
|
630
629
|
if (!i)
|
|
@@ -659,7 +658,7 @@ async function Pt(t, e, n, o, a) {
|
|
|
659
658
|
const r = await Te(t, e, n);
|
|
660
659
|
if (G(r))
|
|
661
660
|
return r;
|
|
662
|
-
if (!
|
|
661
|
+
if (!g(r.id_token))
|
|
663
662
|
throw new s('"response" body "id_token" property must be a non-empty string');
|
|
664
663
|
a ?? (a = e.default_max_age ?? F);
|
|
665
664
|
const i = bt(r);
|
|
@@ -679,7 +678,7 @@ async function Pt(t, e, n, o, a) {
|
|
|
679
678
|
throw new s('unexpected ID Token "nonce" claim value');
|
|
680
679
|
break;
|
|
681
680
|
default:
|
|
682
|
-
if (!
|
|
681
|
+
if (!g(o))
|
|
683
682
|
throw new TypeError('"expectedNonce" must be a non-empty string');
|
|
684
683
|
if (i.nonce === void 0)
|
|
685
684
|
throw new s('ID Token "nonce" claim missing');
|
|
@@ -772,8 +771,8 @@ async function Ct(t, e, n, o, a, r) {
|
|
|
772
771
|
if (e(f), f.crit !== void 0)
|
|
773
772
|
throw new s('unexpected JWT "crit" header parameter');
|
|
774
773
|
const v = k(p);
|
|
775
|
-
let
|
|
776
|
-
n !== Ee && (
|
|
774
|
+
let _;
|
|
775
|
+
n !== Ee && (_ = await n(f), await xt(i, c, _, v));
|
|
777
776
|
let h;
|
|
778
777
|
try {
|
|
779
778
|
h = JSON.parse(E(k(c)));
|
|
@@ -801,7 +800,7 @@ async function Ct(t, e, n, o, a, r) {
|
|
|
801
800
|
}
|
|
802
801
|
if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
|
|
803
802
|
throw new s('unexpected JWT "aud" (audience) claim type');
|
|
804
|
-
return { header: f, claims: h, signature: v, key:
|
|
803
|
+
return { header: f, claims: h, signature: v, key: _, jwt: t };
|
|
805
804
|
}
|
|
806
805
|
function It(t, e, n) {
|
|
807
806
|
if (t !== void 0) {
|
|
@@ -843,7 +842,7 @@ function Ot(t, e, n, o) {
|
|
|
843
842
|
case jt:
|
|
844
843
|
break;
|
|
845
844
|
default:
|
|
846
|
-
if (!
|
|
845
|
+
if (!g(o))
|
|
847
846
|
throw new s('"expectedState" must be a non-empty string');
|
|
848
847
|
if (r === void 0)
|
|
849
848
|
throw new s('response parameter "state" missing');
|
|
@@ -865,7 +864,7 @@ function Ot(t, e, n, o) {
|
|
|
865
864
|
function zt({
|
|
866
865
|
handleCallback: t
|
|
867
866
|
}) {
|
|
868
|
-
const e =
|
|
867
|
+
const e = je({
|
|
869
868
|
retry: !1,
|
|
870
869
|
queryKey: ["oauth-callback"],
|
|
871
870
|
queryFn: async () => {
|
|
@@ -890,7 +889,7 @@ class pe extends R {
|
|
|
890
889
|
}
|
|
891
890
|
}
|
|
892
891
|
const M = "code-verifier", q = "oauth-state";
|
|
893
|
-
class Dt extends
|
|
892
|
+
class Dt extends Je {
|
|
894
893
|
constructor(e, n) {
|
|
895
894
|
super(), this.callbackUrlPath = e, this.handleCallback = n;
|
|
896
895
|
}
|
|
@@ -915,18 +914,22 @@ class Nt {
|
|
|
915
914
|
basePath: c,
|
|
916
915
|
scopes: p
|
|
917
916
|
}) {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
917
|
+
b(this, "client");
|
|
918
|
+
b(this, "issuer");
|
|
919
|
+
b(this, "authorizationServer");
|
|
920
|
+
b(this, "callbackUrlPath");
|
|
921
|
+
b(this, "logoutRedirectUrlPath");
|
|
922
|
+
b(this, "onAuthorizationUrl");
|
|
923
|
+
b(this, "redirectToAfterSignUp");
|
|
924
|
+
b(this, "redirectToAfterSignIn");
|
|
925
|
+
b(this, "redirectToAfterSignOut");
|
|
926
|
+
b(this, "audience");
|
|
927
|
+
b(this, "scopes");
|
|
928
|
+
b(this, "signRequest", async (e) => {
|
|
929
|
+
const n = await this.getAccessToken();
|
|
930
|
+
return e.headers.set("Authorization", `Bearer ${n}`), e;
|
|
931
|
+
});
|
|
932
|
+
b(this, "signOut", async () => {
|
|
930
933
|
x.setState({
|
|
931
934
|
isAuthenticated: !1,
|
|
932
935
|
isPending: !1,
|
|
@@ -943,7 +946,7 @@ class Nt {
|
|
|
943
946
|
n.toString()
|
|
944
947
|
)) : o = n;
|
|
945
948
|
});
|
|
946
|
-
|
|
949
|
+
b(this, "handleCallback", async () => {
|
|
947
950
|
const e = new URL(window.location.href), n = e.searchParams.get("state"), o = sessionStorage.getItem(q);
|
|
948
951
|
if (sessionStorage.removeItem(q), n !== o)
|
|
949
952
|
throw new R("Invalid state parameter");
|
|
@@ -975,16 +978,16 @@ class Nt {
|
|
|
975
978
|
p
|
|
976
979
|
);
|
|
977
980
|
this.setTokensFromResponse(w);
|
|
978
|
-
const f = await this.getAccessToken(),
|
|
981
|
+
const f = await this.getAccessToken(), _ = await (await gt(
|
|
979
982
|
r,
|
|
980
983
|
this.client,
|
|
981
984
|
f
|
|
982
985
|
)).json(), h = {
|
|
983
|
-
sub:
|
|
984
|
-
email:
|
|
985
|
-
name:
|
|
986
|
-
emailVerified:
|
|
987
|
-
pictureUrl:
|
|
986
|
+
sub: _.sub,
|
|
987
|
+
email: _.email,
|
|
988
|
+
name: _.name,
|
|
989
|
+
emailVerified: _.email_verified ?? !1,
|
|
990
|
+
pictureUrl: _.picture
|
|
988
991
|
};
|
|
989
992
|
x.setState({
|
|
990
993
|
isAuthenticated: !0,
|
|
@@ -1099,9 +1102,9 @@ class Nt {
|
|
|
1099
1102
|
return new Dt(this.callbackUrlPath, this.handleCallback);
|
|
1100
1103
|
}
|
|
1101
1104
|
}
|
|
1102
|
-
const
|
|
1105
|
+
const Vt = (t) => new Nt(t);
|
|
1103
1106
|
export {
|
|
1104
1107
|
Nt as OpenIDAuthenticationProvider,
|
|
1105
|
-
|
|
1108
|
+
Vt as default
|
|
1106
1109
|
};
|
|
1107
1110
|
//# sourceMappingURL=zudoku.auth-openid.js.map
|