@frontegg/react-hooks 6.131.0-alpha.1 → 6.131.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/index.js +11 -9
- package/index.js +1 -1
- package/node/FronteggProvider/index.js +11 -9
- package/node/index.js +1 -1
- package/package.json +3 -3
|
@@ -63,7 +63,7 @@ const FronteggContent = ({
|
|
|
63
63
|
app,
|
|
64
64
|
setLoading
|
|
65
65
|
}) => {
|
|
66
|
-
var _app$options, _app$options2, _app$options3;
|
|
66
|
+
var _app$options, _app$options2, _app$options3, _app$options4, _app$options4$authOpt, _app$options4$authOpt2;
|
|
67
67
|
const {
|
|
68
68
|
isLoading
|
|
69
69
|
} = useAuth(({
|
|
@@ -73,7 +73,9 @@ const FronteggContent = ({
|
|
|
73
73
|
}));
|
|
74
74
|
const customLoginBox = !app || (app == null ? void 0 : (_app$options = app.options) == null ? void 0 : _app$options.customLoginBox) === true;
|
|
75
75
|
const isNextJS = (app == null ? void 0 : (_app$options2 = app.options) == null ? void 0 : _app$options2.framework) === 'nextjs';
|
|
76
|
-
const
|
|
76
|
+
const isHostedLoginBox = (app == null ? void 0 : (_app$options3 = app.options) == null ? void 0 : _app$options3.hostedLoginBox) === true;
|
|
77
|
+
const shouldShowChildrenOnHostedLogin = isHostedLoginBox && (app == null ? void 0 : (_app$options4 = app.options) == null ? void 0 : (_app$options4$authOpt = _app$options4.authOptions) == null ? void 0 : (_app$options4$authOpt2 = _app$options4$authOpt.hostedLoginOptions) == null ? void 0 : _app$options4$authOpt2.loadUserOnFirstLoad) !== true;
|
|
78
|
+
const alwaysShowChildren = customLoginBox || isNextJS || shouldShowChildrenOnHostedLogin;
|
|
77
79
|
const loadingRef = useRef(undefined);
|
|
78
80
|
if (isLoading !== loadingRef.current && !isNextJS) {
|
|
79
81
|
loadingRef.current = isLoading;
|
|
@@ -93,7 +95,7 @@ const FronteggContent = ({
|
|
|
93
95
|
});
|
|
94
96
|
};
|
|
95
97
|
export const FronteggStoreProvider = props => {
|
|
96
|
-
var _app$options$contextO, _app$
|
|
98
|
+
var _app$options$contextO, _app$options5, _app$options$previewM, _app$options6, _app$options7, _app$options8;
|
|
97
99
|
const {
|
|
98
100
|
children,
|
|
99
101
|
app,
|
|
@@ -103,23 +105,23 @@ export const FronteggStoreProvider = props => {
|
|
|
103
105
|
} = props;
|
|
104
106
|
|
|
105
107
|
// TODO: make this optionals more readable
|
|
106
|
-
const context = (_app$options$contextO = app == null ? void 0 : (_app$
|
|
108
|
+
const context = (_app$options$contextO = app == null ? void 0 : (_app$options5 = app.options) == null ? void 0 : _app$options5.contextOptions) != null ? _app$options$contextO : contextOptions;
|
|
107
109
|
if (!context) {
|
|
108
110
|
throw Error('contextOptions must not be null or undefined');
|
|
109
111
|
}
|
|
110
|
-
const previewMode = (_app$options$previewM = app == null ? void 0 : (_app$
|
|
111
|
-
const authOptions = app != null && (_app$
|
|
112
|
+
const previewMode = (_app$options$previewM = app == null ? void 0 : (_app$options6 = app.options) == null ? void 0 : _app$options6.previewMode) != null ? _app$options$previewM : false;
|
|
113
|
+
const authOptions = app != null && (_app$options7 = app.options) != null && _app$options7.authOptions ? _extends({}, app.options.authOptions, {
|
|
112
114
|
hostedLoginBox: app.options.hostedLoginBox
|
|
113
115
|
}) : {
|
|
114
|
-
hostedLoginBox: app == null ? void 0 : (_app$
|
|
116
|
+
hostedLoginBox: app == null ? void 0 : (_app$options8 = app.options) == null ? void 0 : _app$options8.hostedLoginBox
|
|
115
117
|
};
|
|
116
118
|
ContextHolder.setContext(context);
|
|
117
119
|
const store = useMemo(() => {
|
|
118
|
-
var _app$name, _app$
|
|
120
|
+
var _app$name, _app$options9;
|
|
119
121
|
return createFronteggStore({
|
|
120
122
|
context,
|
|
121
123
|
appName: (_app$name = app == null ? void 0 : app.name) != null ? _app$name : 'default'
|
|
122
|
-
}, app, previewMode, authOptions, undefined, false, app == null ? void 0 : (_app$
|
|
124
|
+
}, app, previewMode, authOptions, undefined, false, app == null ? void 0 : (_app$options9 = app.options) == null ? void 0 : _app$options9.urlStrategy);
|
|
123
125
|
}, [app, previewMode]);
|
|
124
126
|
return /*#__PURE__*/_jsxs(Provider, {
|
|
125
127
|
context: FronteggStoreContext,
|
package/index.js
CHANGED
|
@@ -70,7 +70,7 @@ const FronteggContent = ({
|
|
|
70
70
|
app,
|
|
71
71
|
setLoading
|
|
72
72
|
}) => {
|
|
73
|
-
var _app$options, _app$options2, _app$options3;
|
|
73
|
+
var _app$options, _app$options2, _app$options3, _app$options4, _app$options4$authOpt, _app$options4$authOpt2;
|
|
74
74
|
const {
|
|
75
75
|
isLoading
|
|
76
76
|
} = (0, _auth.useAuth)(({
|
|
@@ -80,7 +80,9 @@ const FronteggContent = ({
|
|
|
80
80
|
}));
|
|
81
81
|
const customLoginBox = !app || (app == null ? void 0 : (_app$options = app.options) == null ? void 0 : _app$options.customLoginBox) === true;
|
|
82
82
|
const isNextJS = (app == null ? void 0 : (_app$options2 = app.options) == null ? void 0 : _app$options2.framework) === 'nextjs';
|
|
83
|
-
const
|
|
83
|
+
const isHostedLoginBox = (app == null ? void 0 : (_app$options3 = app.options) == null ? void 0 : _app$options3.hostedLoginBox) === true;
|
|
84
|
+
const shouldShowChildrenOnHostedLogin = isHostedLoginBox && (app == null ? void 0 : (_app$options4 = app.options) == null ? void 0 : (_app$options4$authOpt = _app$options4.authOptions) == null ? void 0 : (_app$options4$authOpt2 = _app$options4$authOpt.hostedLoginOptions) == null ? void 0 : _app$options4$authOpt2.loadUserOnFirstLoad) !== true;
|
|
85
|
+
const alwaysShowChildren = customLoginBox || isNextJS || shouldShowChildrenOnHostedLogin;
|
|
84
86
|
const loadingRef = (0, _react.useRef)(undefined);
|
|
85
87
|
if (isLoading !== loadingRef.current && !isNextJS) {
|
|
86
88
|
loadingRef.current = isLoading;
|
|
@@ -100,7 +102,7 @@ const FronteggContent = ({
|
|
|
100
102
|
});
|
|
101
103
|
};
|
|
102
104
|
const FronteggStoreProvider = props => {
|
|
103
|
-
var _app$options$contextO, _app$
|
|
105
|
+
var _app$options$contextO, _app$options5, _app$options$previewM, _app$options6, _app$options7, _app$options8;
|
|
104
106
|
const {
|
|
105
107
|
children,
|
|
106
108
|
app,
|
|
@@ -110,23 +112,23 @@ const FronteggStoreProvider = props => {
|
|
|
110
112
|
} = props;
|
|
111
113
|
|
|
112
114
|
// TODO: make this optionals more readable
|
|
113
|
-
const context = (_app$options$contextO = app == null ? void 0 : (_app$
|
|
115
|
+
const context = (_app$options$contextO = app == null ? void 0 : (_app$options5 = app.options) == null ? void 0 : _app$options5.contextOptions) != null ? _app$options$contextO : contextOptions;
|
|
114
116
|
if (!context) {
|
|
115
117
|
throw Error('contextOptions must not be null or undefined');
|
|
116
118
|
}
|
|
117
|
-
const previewMode = (_app$options$previewM = app == null ? void 0 : (_app$
|
|
118
|
-
const authOptions = app != null && (_app$
|
|
119
|
+
const previewMode = (_app$options$previewM = app == null ? void 0 : (_app$options6 = app.options) == null ? void 0 : _app$options6.previewMode) != null ? _app$options$previewM : false;
|
|
120
|
+
const authOptions = app != null && (_app$options7 = app.options) != null && _app$options7.authOptions ? (0, _extends2.default)({}, app.options.authOptions, {
|
|
119
121
|
hostedLoginBox: app.options.hostedLoginBox
|
|
120
122
|
}) : {
|
|
121
|
-
hostedLoginBox: app == null ? void 0 : (_app$
|
|
123
|
+
hostedLoginBox: app == null ? void 0 : (_app$options8 = app.options) == null ? void 0 : _app$options8.hostedLoginBox
|
|
122
124
|
};
|
|
123
125
|
_restApi.ContextHolder.setContext(context);
|
|
124
126
|
const store = (0, _react.useMemo)(() => {
|
|
125
|
-
var _app$name, _app$
|
|
127
|
+
var _app$name, _app$options9;
|
|
126
128
|
return (0, _reduxStore.createFronteggStore)({
|
|
127
129
|
context,
|
|
128
130
|
appName: (_app$name = app == null ? void 0 : app.name) != null ? _app$name : 'default'
|
|
129
|
-
}, app, previewMode, authOptions, undefined, false, app == null ? void 0 : (_app$
|
|
131
|
+
}, app, previewMode, authOptions, undefined, false, app == null ? void 0 : (_app$options9 = app.options) == null ? void 0 : _app$options9.urlStrategy);
|
|
130
132
|
}, [app, previewMode]);
|
|
131
133
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FronteggStoreContext.Provider, {
|
|
132
134
|
context: _FronteggStoreContext.FronteggStoreContext,
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/react-hooks",
|
|
3
|
-
"version": "6.131.0
|
|
3
|
+
"version": "6.131.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.131.0
|
|
10
|
-
"@frontegg/types": "6.131.0
|
|
9
|
+
"@frontegg/redux-store": "6.131.0",
|
|
10
|
+
"@frontegg/types": "6.131.0",
|
|
11
11
|
"@types/react": "*",
|
|
12
12
|
"get-value": "^3.0.1",
|
|
13
13
|
"react-redux": "^7.x"
|