@auth0/auth0-react 2.5.0 → 2.6.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/auth0-react.cjs.js +7 -5
- package/dist/auth0-react.cjs.js.map +1 -1
- package/dist/auth0-react.esm.js +7 -5
- package/dist/auth0-react.esm.js.map +1 -1
- package/dist/auth0-react.js +7 -5
- package/dist/auth0-react.js.map +1 -1
- package/dist/auth0-react.min.js +1 -1
- package/dist/auth0-react.min.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/utils.tsx +15 -4
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,aAAa,GAAI,qBAAqC,KAAG,OAEzC,CAAC;AA4B9B,eAAO,MAAM,UAAU,UAxBb,OAAO,KAAG,KAwBsC,CAAC;AAE3D,eAAO,MAAM,UAAU,UA1Bb,OAAO,KAAG,KA0BiD,CAAC;AAEtE;;;;GAIG;AAEH,eAAO,MAAM,oBAAoB,GAAI,UAAU,GAAG,SAkBjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Auth0",
|
|
3
3
|
"name": "@auth0/auth0-react",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.6.0",
|
|
5
5
|
"description": "Auth0 SDK for React Single Page Applications (SPA)",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"auth0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@rollup/plugin-replace": "^5.0.1",
|
|
56
56
|
"@rollup/plugin-terser": "^0.4.3",
|
|
57
57
|
"@testing-library/dom": "^10.4.0",
|
|
58
|
-
"@testing-library/jest-dom": "6.
|
|
58
|
+
"@testing-library/jest-dom": "6.8.0",
|
|
59
59
|
"@testing-library/react": "16.3.0",
|
|
60
60
|
"@types/jest": "^29.5.14",
|
|
61
61
|
"@types/react": "19.1.8",
|
|
@@ -95,6 +95,6 @@
|
|
|
95
95
|
"react-dom": "^16.11.0 || ^17 || ^18 || ^19"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@auth0/auth0-spa-js": "^2.
|
|
98
|
+
"@auth0/auth0-spa-js": "^2.5.0"
|
|
99
99
|
}
|
|
100
100
|
}
|
package/src/utils.tsx
CHANGED
|
@@ -4,6 +4,15 @@ const CODE_RE = /[?&]code=[^&]+/;
|
|
|
4
4
|
const STATE_RE = /[?&]state=[^&]+/;
|
|
5
5
|
const ERROR_RE = /[?&]error=[^&]+/;
|
|
6
6
|
|
|
7
|
+
interface WithError {
|
|
8
|
+
error: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface WithErrorAndDescription {
|
|
12
|
+
error: string;
|
|
13
|
+
error_description: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
7
16
|
export const hasAuthParams = (searchParams = window.location.search): boolean =>
|
|
8
17
|
(CODE_RE.test(searchParams) || ERROR_RE.test(searchParams)) &&
|
|
9
18
|
STATE_RE.test(searchParams);
|
|
@@ -19,15 +28,17 @@ const normalizeErrorFn =
|
|
|
19
28
|
error !== null &&
|
|
20
29
|
typeof error === 'object' &&
|
|
21
30
|
'error' in error &&
|
|
22
|
-
typeof error.error === 'string'
|
|
31
|
+
typeof (error as WithError).error === 'string'
|
|
23
32
|
) {
|
|
24
33
|
if (
|
|
25
34
|
'error_description' in error &&
|
|
26
|
-
typeof error.error_description === 'string'
|
|
35
|
+
typeof (error as WithErrorAndDescription).error_description === 'string'
|
|
27
36
|
) {
|
|
28
|
-
|
|
37
|
+
const e = error as WithErrorAndDescription;
|
|
38
|
+
return new OAuthError(e.error, e.error_description);
|
|
29
39
|
}
|
|
30
|
-
|
|
40
|
+
const e = error as WithError;
|
|
41
|
+
return new OAuthError(e.error);
|
|
31
42
|
}
|
|
32
43
|
return new Error(fallbackMessage);
|
|
33
44
|
};
|