@frontegg/react-hooks 6.36.0-alpha.5 → 6.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/{FronteggProvider.d.ts → FronteggProvider/index.d.ts} +0 -0
- package/{FronteggProvider.js → FronteggProvider/index.js} +12 -9
- package/FronteggProvider/package.json +6 -0
- package/{FronteggStoreContext.d.ts → FronteggStoreContext/index.d.ts} +0 -0
- package/{FronteggStoreContext.js → FronteggStoreContext/index.js} +0 -0
- package/FronteggStoreContext/package.json +6 -0
- package/index.js +1 -1
- package/node/{FronteggProvider.js → FronteggProvider/index.js} +11 -8
- package/node/{FronteggStoreContext.js → FronteggStoreContext/index.js} +0 -0
- package/node/index.js +1 -1
- package/package.json +3 -3
|
File without changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["authenticatedUrl", "signUpSuccessUrl"];
|
|
4
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { createFronteggStore } from '@frontegg/redux-store';
|
|
6
6
|
import { ContextHolder } from '@frontegg/rest-api';
|
|
7
|
-
import { useAuth, useAuthRoutes } from '
|
|
8
|
-
import { Provider, FronteggStoreContext } from '
|
|
7
|
+
import { useAuth, useAuthRoutes } from '../auth';
|
|
8
|
+
import { Provider, FronteggStoreContext } from '../FronteggStoreContext';
|
|
9
9
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
|
|
@@ -29,16 +29,14 @@ const HideChildrenIfFronteggRoutes = ({
|
|
|
29
29
|
const uriRef = useRef(window.location.pathname);
|
|
30
30
|
const animationFrameRef = useRef(0);
|
|
31
31
|
const [uri, setUri] = useState(window.location.pathname);
|
|
32
|
-
|
|
33
|
-
const checker = () => {
|
|
32
|
+
const checker = useCallback(() => {
|
|
34
33
|
if (uriRef.current !== window.location.pathname) {
|
|
35
34
|
uriRef.current = window.location.pathname;
|
|
36
35
|
setUri(document.location.pathname);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
animationFrameRef.current = window.requestAnimationFrame(checker);
|
|
40
|
-
};
|
|
41
|
-
|
|
39
|
+
}, []);
|
|
42
40
|
useEffect(() => {
|
|
43
41
|
document.addEventListener('frontegg_onRedirectTo_fired', () => {
|
|
44
42
|
if (uriRef.current !== window.location.pathname) {
|
|
@@ -56,7 +54,7 @@ const HideChildrenIfFronteggRoutes = ({
|
|
|
56
54
|
return () => {
|
|
57
55
|
window.cancelAnimationFrame(animationFrameRef.current);
|
|
58
56
|
};
|
|
59
|
-
}, [setUri]);
|
|
57
|
+
}, [checker, setUri]);
|
|
60
58
|
const calculatedBasename = basename ? basename.endsWith('/') ? basename.substring(0, basename.length - 1) : '' : '';
|
|
61
59
|
|
|
62
60
|
const checkRoutes = _objectWithoutPropertiesLoose(routes, _excluded);
|
|
@@ -120,6 +118,11 @@ export const FronteggStoreProvider = props => {
|
|
|
120
118
|
} = props; // TODO: make this optionals more readable
|
|
121
119
|
|
|
122
120
|
const context = (_app$options$contextO = app == null ? void 0 : (_app$options4 = app.options) == null ? void 0 : _app$options4.contextOptions) != null ? _app$options$contextO : contextOptions;
|
|
121
|
+
|
|
122
|
+
if (!context) {
|
|
123
|
+
throw Error("contextOptions must not be null or undefined");
|
|
124
|
+
}
|
|
125
|
+
|
|
123
126
|
const previewMode = (_app$options$previewM = app == null ? void 0 : (_app$options5 = app.options) == null ? void 0 : _app$options5.previewMode) != null ? _app$options$previewM : false;
|
|
124
127
|
const authOptions = app != null && (_app$options6 = app.options) != null && _app$options6.authOptions ? _extends({}, app.options.authOptions, {
|
|
125
128
|
hostedLoginBox: app.options.hostedLoginBox
|
|
@@ -131,7 +134,7 @@ export const FronteggStoreProvider = props => {
|
|
|
131
134
|
var _app$options8;
|
|
132
135
|
|
|
133
136
|
return createFronteggStore({
|
|
134
|
-
context
|
|
137
|
+
context
|
|
135
138
|
}, app, previewMode, authOptions, undefined, false, app == null ? void 0 : (_app$options8 = app.options) == null ? void 0 : _app$options8.urlStrategy);
|
|
136
139
|
}, [app, previewMode]);
|
|
137
140
|
return /*#__PURE__*/_jsx(Provider, {
|
|
File without changes
|
|
File without changes
|
package/index.js
CHANGED
|
@@ -17,9 +17,9 @@ var _reduxStore = require("@frontegg/redux-store");
|
|
|
17
17
|
|
|
18
18
|
var _restApi = require("@frontegg/rest-api");
|
|
19
19
|
|
|
20
|
-
var _auth = require("
|
|
20
|
+
var _auth = require("../auth");
|
|
21
21
|
|
|
22
|
-
var _FronteggStoreContext = require("
|
|
22
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
23
23
|
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
|
|
@@ -49,16 +49,14 @@ const HideChildrenIfFronteggRoutes = ({
|
|
|
49
49
|
const uriRef = (0, _react.useRef)(window.location.pathname);
|
|
50
50
|
const animationFrameRef = (0, _react.useRef)(0);
|
|
51
51
|
const [uri, setUri] = (0, _react.useState)(window.location.pathname);
|
|
52
|
-
|
|
53
|
-
const checker = () => {
|
|
52
|
+
const checker = (0, _react.useCallback)(() => {
|
|
54
53
|
if (uriRef.current !== window.location.pathname) {
|
|
55
54
|
uriRef.current = window.location.pathname;
|
|
56
55
|
setUri(document.location.pathname);
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
animationFrameRef.current = window.requestAnimationFrame(checker);
|
|
60
|
-
};
|
|
61
|
-
|
|
59
|
+
}, []);
|
|
62
60
|
(0, _react.useEffect)(() => {
|
|
63
61
|
document.addEventListener('frontegg_onRedirectTo_fired', () => {
|
|
64
62
|
if (uriRef.current !== window.location.pathname) {
|
|
@@ -76,7 +74,7 @@ const HideChildrenIfFronteggRoutes = ({
|
|
|
76
74
|
return () => {
|
|
77
75
|
window.cancelAnimationFrame(animationFrameRef.current);
|
|
78
76
|
};
|
|
79
|
-
}, [setUri]);
|
|
77
|
+
}, [checker, setUri]);
|
|
80
78
|
const calculatedBasename = basename ? basename.endsWith('/') ? basename.substring(0, basename.length - 1) : '' : '';
|
|
81
79
|
const checkRoutes = (0, _objectWithoutPropertiesLoose2.default)(routes, _excluded);
|
|
82
80
|
|
|
@@ -139,6 +137,11 @@ const FronteggStoreProvider = props => {
|
|
|
139
137
|
} = props; // TODO: make this optionals more readable
|
|
140
138
|
|
|
141
139
|
const context = (_app$options$contextO = app == null ? void 0 : (_app$options4 = app.options) == null ? void 0 : _app$options4.contextOptions) != null ? _app$options$contextO : contextOptions;
|
|
140
|
+
|
|
141
|
+
if (!context) {
|
|
142
|
+
throw Error("contextOptions must not be null or undefined");
|
|
143
|
+
}
|
|
144
|
+
|
|
142
145
|
const previewMode = (_app$options$previewM = app == null ? void 0 : (_app$options5 = app.options) == null ? void 0 : _app$options5.previewMode) != null ? _app$options$previewM : false;
|
|
143
146
|
const authOptions = app != null && (_app$options6 = app.options) != null && _app$options6.authOptions ? (0, _extends2.default)({}, app.options.authOptions, {
|
|
144
147
|
hostedLoginBox: app.options.hostedLoginBox
|
|
@@ -152,7 +155,7 @@ const FronteggStoreProvider = props => {
|
|
|
152
155
|
var _app$options8;
|
|
153
156
|
|
|
154
157
|
return (0, _reduxStore.createFronteggStore)({
|
|
155
|
-
context
|
|
158
|
+
context
|
|
156
159
|
}, app, previewMode, authOptions, undefined, false, app == null ? void 0 : (_app$options8 = app.options) == null ? void 0 : _app$options8.urlStrategy);
|
|
157
160
|
}, [app, previewMode]);
|
|
158
161
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FronteggStoreContext.Provider, {
|
|
File without changes
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/react-hooks",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.38.0",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/runtime": "^7.18.6",
|
|
9
|
-
"@frontegg/redux-store": "6.
|
|
10
|
-
"@frontegg/types": "6.
|
|
9
|
+
"@frontegg/redux-store": "6.38.0",
|
|
10
|
+
"@frontegg/types": "6.38.0",
|
|
11
11
|
"@types/react": "*",
|
|
12
12
|
"react-redux": "^7.x"
|
|
13
13
|
},
|