@plitzi/sdk-auth 0.32.0 → 0.32.2
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 +20 -0
- package/dist/AuthContext.mjs +1 -1
- package/dist/AuthContextProvider.d.ts +1 -1
- package/dist/AuthContextProvider.mjs +52 -52
- package/dist/index.mjs +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @plitzi/sdk-auth
|
|
2
2
|
|
|
3
|
+
## 0.32.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- v0.32.2
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @plitzi/sdk-navigation@0.32.2
|
|
10
|
+
- @plitzi/sdk-schema@0.32.2
|
|
11
|
+
- @plitzi/sdk-shared@0.32.2
|
|
12
|
+
|
|
13
|
+
## 0.32.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- v0.32.1
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @plitzi/sdk-navigation@0.32.1
|
|
20
|
+
- @plitzi/sdk-schema@0.32.1
|
|
21
|
+
- @plitzi/sdk-shared@0.32.1
|
|
22
|
+
|
|
3
23
|
## 0.32.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/dist/AuthContext.mjs
CHANGED
|
@@ -8,5 +8,5 @@ export type AuthContextProviderProps = {
|
|
|
8
8
|
server: Server;
|
|
9
9
|
environment?: Environment;
|
|
10
10
|
};
|
|
11
|
-
declare const AuthContextProvider: ({ previewMode, isHydrating, children, server, environment }: AuthContextProviderProps) => import("react
|
|
11
|
+
declare const AuthContextProvider: ({ previewMode, isHydrating, children, server, environment }: AuthContextProviderProps) => import("react").JSX.Element;
|
|
12
12
|
export default AuthContextProvider;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import e from "./hooks/useAuth/index.mjs";
|
|
2
|
-
import t from "./AuthContext.mjs";
|
|
2
|
+
import { AuthContext as t } from "./AuthContext.mjs";
|
|
3
3
|
import { useMemo as n } from "react";
|
|
4
4
|
import { QueryBuilderEvaluator as r } from "@plitzi/plitzi-ui/QueryBuilder";
|
|
5
|
-
import
|
|
6
|
-
import a from "@plitzi/sdk-
|
|
7
|
-
import {
|
|
5
|
+
import i from "@plitzi/sdk-navigation/hooks/useNavigation";
|
|
6
|
+
import { processTwig as a } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
7
|
+
import { useCommonStore as o } from "@plitzi/sdk-shared/store";
|
|
8
8
|
import { jsx as s } from "react/jsx-runtime";
|
|
9
9
|
//#region src/AuthContextProvider.tsx
|
|
10
10
|
var c = ({ previewMode: c = !0, isHydrating: l = !1, children: u, server: d, environment: f = "production" }) => {
|
|
11
|
-
let
|
|
12
|
-
queryParams:
|
|
13
|
-
hostname:
|
|
11
|
+
let [[{ userProvider: p, loginUrl: m, userUrl: h, refreshUrl: g, logoutUrl: _, tokenStorage: v = "localStorage", detailsPath: y = "details", tokenPath: b = "access_token", expirationTimePath: x = "expire_at" }, S]] = o(["schema.settings", "schema.variables"]), { queryParams: C, hostname: w } = i({ server: d }), T = n(() => ({
|
|
12
|
+
queryParams: C,
|
|
13
|
+
hostname: w,
|
|
14
14
|
environment: f
|
|
15
15
|
}), [
|
|
16
|
+
C,
|
|
16
17
|
w,
|
|
17
|
-
T,
|
|
18
18
|
f
|
|
19
|
-
]),
|
|
19
|
+
]), E = n(() => Array.isArray(S) ? S.reduce((e, t) => {
|
|
20
20
|
let { name: n, value: i, subValues: a } = t;
|
|
21
21
|
if (!Array.isArray(a) || a.length === 0) return {
|
|
22
22
|
...e,
|
|
23
23
|
[n]: i
|
|
24
24
|
};
|
|
25
|
-
let o = a.find((e) => r(e.when,
|
|
25
|
+
let o = a.find((e) => r(e.when, T));
|
|
26
26
|
return o ? {
|
|
27
27
|
...e,
|
|
28
28
|
[n]: o.value
|
|
@@ -30,68 +30,68 @@ var c = ({ previewMode: c = !0, isHydrating: l = !1, children: u, server: d, env
|
|
|
30
30
|
...e,
|
|
31
31
|
[n]: i
|
|
32
32
|
};
|
|
33
|
-
}, {}) : {}, [
|
|
33
|
+
}, {}) : {}, [S, T]), D = n(() => {
|
|
34
34
|
try {
|
|
35
|
-
return JSON.parse(
|
|
36
|
-
loginUrl:
|
|
37
|
-
userUrl:
|
|
38
|
-
refreshUrl:
|
|
39
|
-
logoutUrl:
|
|
40
|
-
detailsPath:
|
|
41
|
-
tokenPath:
|
|
42
|
-
expirationTimePath:
|
|
43
|
-
}),
|
|
35
|
+
return JSON.parse(a(JSON.stringify({
|
|
36
|
+
loginUrl: m,
|
|
37
|
+
userUrl: h,
|
|
38
|
+
refreshUrl: g,
|
|
39
|
+
logoutUrl: _,
|
|
40
|
+
detailsPath: y,
|
|
41
|
+
tokenPath: b,
|
|
42
|
+
expirationTimePath: x
|
|
43
|
+
}), E));
|
|
44
44
|
} catch {
|
|
45
45
|
return {
|
|
46
|
-
loginUrl:
|
|
47
|
-
userUrl:
|
|
48
|
-
refreshUrl:
|
|
49
|
-
logoutUrl:
|
|
50
|
-
detailsPath:
|
|
51
|
-
tokenPath:
|
|
52
|
-
expirationTimePath:
|
|
46
|
+
loginUrl: m,
|
|
47
|
+
userUrl: h,
|
|
48
|
+
refreshUrl: g,
|
|
49
|
+
logoutUrl: _,
|
|
50
|
+
detailsPath: y,
|
|
51
|
+
tokenPath: b,
|
|
52
|
+
expirationTimePath: x
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
}, [
|
|
56
|
+
m,
|
|
56
57
|
h,
|
|
57
58
|
g,
|
|
58
59
|
_,
|
|
59
|
-
|
|
60
|
+
y,
|
|
60
61
|
b,
|
|
61
62
|
x,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
]), { manager: k, loading: A, authenticated: j } = e({
|
|
63
|
+
E
|
|
64
|
+
]), { manager: O, loading: k, authenticated: A } = e({
|
|
65
65
|
server: d,
|
|
66
66
|
isHydrating: l,
|
|
67
|
-
tokenStorage:
|
|
68
|
-
provider:
|
|
69
|
-
loginUrl:
|
|
70
|
-
userUrl:
|
|
71
|
-
refreshUrl:
|
|
72
|
-
logoutUrl:
|
|
73
|
-
detailsPath:
|
|
74
|
-
tokenPath:
|
|
75
|
-
expirationTimePath:
|
|
67
|
+
tokenStorage: v,
|
|
68
|
+
provider: p,
|
|
69
|
+
loginUrl: D.loginUrl,
|
|
70
|
+
userUrl: D.userUrl,
|
|
71
|
+
refreshUrl: D.refreshUrl,
|
|
72
|
+
logoutUrl: D.logoutUrl,
|
|
73
|
+
detailsPath: D.detailsPath,
|
|
74
|
+
tokenPath: D.tokenPath,
|
|
75
|
+
expirationTimePath: D.expirationTimePath
|
|
76
76
|
});
|
|
77
77
|
return /* @__PURE__ */ s(t, {
|
|
78
78
|
value: n(() => ({
|
|
79
|
-
manager:
|
|
80
|
-
login:
|
|
81
|
-
refresh:
|
|
82
|
-
can:
|
|
83
|
-
logout:
|
|
84
|
-
authenticated:
|
|
85
|
-
user:
|
|
86
|
-
details:
|
|
87
|
-
accessToken:
|
|
79
|
+
manager: O,
|
|
80
|
+
login: O.login.bind(O),
|
|
81
|
+
refresh: O.refresh.bind(O),
|
|
82
|
+
can: O.can.bind(O),
|
|
83
|
+
logout: O.logout.bind(O),
|
|
84
|
+
authenticated: A || !c,
|
|
85
|
+
user: O.getProvider() ? {
|
|
86
|
+
details: O.getProvider()?.user,
|
|
87
|
+
accessToken: O.getProvider()?.token?.accessToken
|
|
88
88
|
} : void 0
|
|
89
89
|
}), [
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
O,
|
|
91
|
+
A,
|
|
92
92
|
c
|
|
93
93
|
]),
|
|
94
|
-
children: !
|
|
94
|
+
children: !k && u
|
|
95
95
|
});
|
|
96
96
|
};
|
|
97
97
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthManager as e } from "./AuthManager.mjs";
|
|
2
2
|
import t from "./hooks/useAuth/index.mjs";
|
|
3
|
-
import n from "./AuthContext.mjs";
|
|
3
|
+
import { AuthContext as n } from "./AuthContext.mjs";
|
|
4
4
|
import r from "./AuthContextProvider.mjs";
|
|
5
5
|
export { n as AuthContext, r as AuthContextProvider, e as AuthManager, t as useAuth };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-auth",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.2",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
"build:prod": "vite build && node ../sdk-shared/scripts/generate-exports.mjs"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
67
|
-
"@plitzi/sdk-navigation": "0.32.
|
|
68
|
-
"@plitzi/sdk-schema": "0.32.
|
|
69
|
-
"@plitzi/sdk-shared": "0.32.
|
|
66
|
+
"@plitzi/plitzi-ui": "^1.6.13",
|
|
67
|
+
"@plitzi/sdk-navigation": "0.32.2",
|
|
68
|
+
"@plitzi/sdk-schema": "0.32.2",
|
|
69
|
+
"@plitzi/sdk-shared": "0.32.2"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"eslint": "^9.39.4",
|
|
73
73
|
"typescript": "^6.0.3",
|
|
74
|
-
"vite": "^8.0.
|
|
75
|
-
"vitest": "^4.1.
|
|
74
|
+
"vite": "^8.0.16",
|
|
75
|
+
"vitest": "^4.1.9"
|
|
76
76
|
}
|
|
77
77
|
}
|