oidc-spa 7.1.4 → 7.1.5
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/core/createOidc.js +1 -1
- package/package.json +6 -6
- package/react/tools/ClientOnly.d.ts +13 -0
- package/react/tools/{NoSsr.js → ClientOnly.js} +9 -10
- package/react/tools/ClientOnly.js.map +1 -0
- package/src/react/tools/ClientOnly.tsx +25 -0
- package/react/tools/NoSsr.d.ts +0 -14
- package/react/tools/NoSsr.js.map +0 -1
- package/src/react/tools/NoSsr.tsx +0 -26
package/core/createOidc.js
CHANGED
|
@@ -125,7 +125,7 @@ var trustedFetch_1 = require("./trustedFetch");
|
|
|
125
125
|
var getIsOnline_1 = require("../tools/getIsOnline");
|
|
126
126
|
(0, handleOidcCallback_1.handleOidcCallback)();
|
|
127
127
|
// NOTE: Replaced at build time
|
|
128
|
-
var VERSION = "7.1.
|
|
128
|
+
var VERSION = "7.1.5";
|
|
129
129
|
var globalContext = {
|
|
130
130
|
prOidcByConfigId: new Map(),
|
|
131
131
|
hasLogoutBeenCalled: (0, tsafe_1.id)(false),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oidc-spa",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.5",
|
|
4
4
|
"description": "Openidconnect client for Single Page Applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
".": "./index.js",
|
|
13
13
|
"./mock": "./mock/index.js",
|
|
14
14
|
"./react": "./react/index.js",
|
|
15
|
-
"./react/tools/
|
|
15
|
+
"./react/tools/ClientOnly": "./react/tools/ClientOnly.js",
|
|
16
16
|
"./mock/react": "./mock/react.js",
|
|
17
17
|
"./entrypoint": "./entrypoint.js",
|
|
18
18
|
"./backend": "./backend.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"./src/mock/react.tsx",
|
|
61
61
|
"./src/react/index.ts",
|
|
62
62
|
"./src/react/react.tsx",
|
|
63
|
-
"./src/react/tools/
|
|
63
|
+
"./src/react/tools/ClientOnly.tsx",
|
|
64
64
|
"./src/tools/Deferred.ts",
|
|
65
65
|
"./src/tools/EphemeralSessionStorage.ts",
|
|
66
66
|
"./src/tools/Evt.ts",
|
|
@@ -178,9 +178,9 @@
|
|
|
178
178
|
"./react/react.d.ts",
|
|
179
179
|
"./react/react.js",
|
|
180
180
|
"./react/react.js.map",
|
|
181
|
-
"./react/tools/
|
|
182
|
-
"./react/tools/
|
|
183
|
-
"./react/tools/
|
|
181
|
+
"./react/tools/ClientOnly.d.ts",
|
|
182
|
+
"./react/tools/ClientOnly.js",
|
|
183
|
+
"./react/tools/ClientOnly.js.map",
|
|
184
184
|
"./tools/Deferred.d.ts",
|
|
185
185
|
"./tools/Deferred.js",
|
|
186
186
|
"./tools/Deferred.js.map",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic client-only rendering boundary (unrelated to OIDC).
|
|
3
|
+
*
|
|
4
|
+
* Children are rendered only after hydration on the client.
|
|
5
|
+
* During SSR, the optional `fallback` is shown instead.
|
|
6
|
+
*
|
|
7
|
+
* Provided here for convenience—you can replace it with your own
|
|
8
|
+
* implementation or existing tooling if you prefer.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ClientOnly(props: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
fallback?: React.ReactNode;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -16,20 +16,19 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.ClientOnly = ClientOnly;
|
|
20
20
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
21
21
|
var react_1 = require("react");
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
* This is provided purely for convenance, feel free to use your own
|
|
25
|
-
* tooling.
|
|
23
|
+
* Generic client-only rendering boundary (unrelated to OIDC).
|
|
26
24
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
25
|
+
* Children are rendered only after hydration on the client.
|
|
26
|
+
* During SSR, the optional `fallback` is shown instead.
|
|
27
|
+
*
|
|
28
|
+
* Provided here for convenience—you can replace it with your own
|
|
29
|
+
* implementation or existing tooling if you prefer.
|
|
31
30
|
*/
|
|
32
|
-
function
|
|
31
|
+
function ClientOnly(props) {
|
|
33
32
|
var children = props.children, fallback = props.fallback;
|
|
34
33
|
var _a = __read((0, react_1.useState)(false), 2), isHydrated = _a[0], setIsHydrated = _a[1];
|
|
35
34
|
(0, react_1.useEffect)(function () {
|
|
@@ -40,4 +39,4 @@ function NoSsr(props) {
|
|
|
40
39
|
}
|
|
41
40
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
42
41
|
}
|
|
43
|
-
//# sourceMappingURL=
|
|
42
|
+
//# sourceMappingURL=ClientOnly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientOnly.js","sourceRoot":"","sources":["../../src/react/tools/ClientOnly.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAWA,gCAaC;;AAxBD,+BAA4C;AAE5C;;;;;;;;GAQG;AACH,SAAgB,UAAU,CAAC,KAAgE;IAC/E,IAAA,QAAQ,GAAe,KAAK,SAApB,EAAE,QAAQ,GAAK,KAAK,SAAV,CAAW;IAE/B,IAAA,KAAA,OAA8B,IAAA,gBAAQ,EAAC,KAAK,CAAC,IAAA,EAA5C,UAAU,QAAA,EAAE,aAAa,QAAmB,CAAC;IACpD,IAAA,iBAAS,EAAC;QACN,aAAa,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,OAAO,2DAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,IAAI,GAAI,CAAC;IACnC,CAAC;IAED,OAAO,2DAAG,QAAQ,GAAI,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generic client-only rendering boundary (unrelated to OIDC).
|
|
5
|
+
*
|
|
6
|
+
* Children are rendered only after hydration on the client.
|
|
7
|
+
* During SSR, the optional `fallback` is shown instead.
|
|
8
|
+
*
|
|
9
|
+
* Provided here for convenience—you can replace it with your own
|
|
10
|
+
* implementation or existing tooling if you prefer.
|
|
11
|
+
*/
|
|
12
|
+
export function ClientOnly(props: { children: React.ReactNode; fallback?: React.ReactNode }) {
|
|
13
|
+
const { children, fallback } = props;
|
|
14
|
+
|
|
15
|
+
const [isHydrated, setIsHydrated] = useState(false);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setIsHydrated(true);
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
if (!isHydrated) {
|
|
21
|
+
return <>{fallback ?? null}</>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return <>{children}</>;
|
|
25
|
+
}
|
package/react/tools/NoSsr.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* There is nothing specific to OIDC with this component.
|
|
3
|
-
* This is provided purely for convenance, feel free to use your own
|
|
4
|
-
* tooling.
|
|
5
|
-
*
|
|
6
|
-
* This is a trivial implementation of a No Server Side Rendering
|
|
7
|
-
* boundary.
|
|
8
|
-
* The children will only be rendered in the client side.
|
|
9
|
-
* You can optionally provide a fallback that will be rendered by the server.
|
|
10
|
-
*/
|
|
11
|
-
export declare function NoSsr(props: {
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
fallback?: React.ReactNode;
|
|
14
|
-
}): import("react/jsx-runtime").JSX.Element;
|
package/react/tools/NoSsr.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NoSsr.js","sourceRoot":"","sources":["../../src/react/tools/NoSsr.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAYA,sBAaC;;AAzBD,+BAA4C;AAE5C;;;;;;;;;GASG;AACH,SAAgB,KAAK,CAAC,KAAgE;IAC1E,IAAA,QAAQ,GAAe,KAAK,SAApB,EAAE,QAAQ,GAAK,KAAK,SAAV,CAAW;IAE/B,IAAA,KAAA,OAA8B,IAAA,gBAAQ,EAAC,KAAK,CAAC,IAAA,EAA5C,UAAU,QAAA,EAAE,aAAa,QAAmB,CAAC;IACpD,IAAA,iBAAS,EAAC;QACN,aAAa,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,OAAO,2DAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,IAAI,GAAI,CAAC;IACnC,CAAC;IAED,OAAO,2DAAG,QAAQ,GAAI,CAAC;AAC3B,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from "react";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* There is nothing specific to OIDC with this component.
|
|
5
|
-
* This is provided purely for convenance, feel free to use your own
|
|
6
|
-
* tooling.
|
|
7
|
-
*
|
|
8
|
-
* This is a trivial implementation of a No Server Side Rendering
|
|
9
|
-
* boundary.
|
|
10
|
-
* The children will only be rendered in the client side.
|
|
11
|
-
* You can optionally provide a fallback that will be rendered by the server.
|
|
12
|
-
*/
|
|
13
|
-
export function NoSsr(props: { children: React.ReactNode; fallback?: React.ReactNode }) {
|
|
14
|
-
const { children, fallback } = props;
|
|
15
|
-
|
|
16
|
-
const [isHydrated, setIsHydrated] = useState(false);
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
setIsHydrated(true);
|
|
19
|
-
}, []);
|
|
20
|
-
|
|
21
|
-
if (!isHydrated) {
|
|
22
|
-
return <>{fallback ?? null}</>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return <>{children}</>;
|
|
26
|
-
}
|