@frontegg/react-hooks 6.129.0-alpha.0 → 6.129.0-alpha.1

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