@frontegg/react-hooks 6.50.0 → 6.51.0-alpha.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.
@@ -10,14 +10,10 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
 
12
12
  const defaultSetLoading = loading => {
13
- const isSSR = typeof document === 'undefined' || typeof window === 'undefined';
14
-
15
- if (!isSSR) {
16
- if (loading) {
17
- document.body.classList.add('frontegg-loading');
18
- } else {
19
- document.body.classList.remove('frontegg-loading');
20
- }
13
+ if (loading) {
14
+ document.body.classList.add('frontegg-loading');
15
+ } else {
16
+ document.body.classList.remove('frontegg-loading');
21
17
  }
22
18
  };
23
19
 
@@ -87,7 +83,7 @@ const FronteggContent = ({
87
83
  const alwaysShowChildren = customLoginBox || isNextJS;
88
84
  const loadingRef = useRef(undefined);
89
85
 
90
- if (isLoading !== loadingRef.current) {
86
+ if (isLoading !== loadingRef.current && !isNextJS) {
91
87
  loadingRef.current = isLoading;
92
88
  setLoading(isLoading);
93
89
  }
package/auth/index.d.ts CHANGED
@@ -17,3 +17,4 @@ export * from './roles';
17
17
  export * from './sessions';
18
18
  export * from './sessionsPolicy';
19
19
  export * from './restrictions';
20
+ export * from './provisioning';
package/auth/index.js CHANGED
@@ -16,4 +16,5 @@ export * from './tenants';
16
16
  export * from './roles';
17
17
  export * from './sessions';
18
18
  export * from './sessionsPolicy';
19
- export * from './restrictions';
19
+ export * from './restrictions';
20
+ export * from './provisioning';
@@ -0,0 +1,5 @@
1
+ import { ProvisioningActions, ProvisioningState } from '@frontegg/redux-store';
2
+ export declare type ProvisioningStateMapper<S> = (state: ProvisioningState) => S;
3
+ export declare function useProvisioningState(): ProvisioningState;
4
+ export declare function useProvisioningState<S>(stateMapper: ProvisioningStateMapper<S>): S;
5
+ export declare const useProvisioningActions: () => ProvisioningActions;
@@ -0,0 +1,9 @@
1
+ import { provisioningActions, provisioningReducers } from '@frontegg/redux-store';
2
+ import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
+
4
+ const defaultMapper = state => state;
5
+
6
+ export function useProvisioningState(stateMapper = defaultMapper) {
7
+ return stateHookGenerator(stateMapper, 'provisioningState');
8
+ }
9
+ export const useProvisioningActions = () => reducerActionsGenerator(provisioningActions, provisioningReducers);
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.50.0
1
+ /** @license Frontegg v6.51.0-alpha.0
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.
@@ -30,14 +30,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
30
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
31
 
32
32
  const defaultSetLoading = loading => {
33
- const isSSR = typeof document === 'undefined' || typeof window === 'undefined';
34
-
35
- if (!isSSR) {
36
- if (loading) {
37
- document.body.classList.add('frontegg-loading');
38
- } else {
39
- document.body.classList.remove('frontegg-loading');
40
- }
33
+ if (loading) {
34
+ document.body.classList.add('frontegg-loading');
35
+ } else {
36
+ document.body.classList.remove('frontegg-loading');
41
37
  }
42
38
  };
43
39
 
@@ -106,7 +102,7 @@ const FronteggContent = ({
106
102
  const alwaysShowChildren = customLoginBox || isNextJS;
107
103
  const loadingRef = (0, _react.useRef)(undefined);
108
104
 
109
- if (isLoading !== loadingRef.current) {
105
+ if (isLoading !== loadingRef.current && !isNextJS) {
110
106
  loadingRef.current = isLoading;
111
107
  setLoading(isLoading);
112
108
  }
@@ -314,4 +314,18 @@ Object.keys(_restrictions).forEach(function (key) {
314
314
  return _restrictions[key];
315
315
  }
316
316
  });
317
+ });
318
+
319
+ var _provisioning = require("./provisioning");
320
+
321
+ Object.keys(_provisioning).forEach(function (key) {
322
+ if (key === "default" || key === "__esModule") return;
323
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
324
+ if (key in exports && exports[key] === _provisioning[key]) return;
325
+ Object.defineProperty(exports, key, {
326
+ enumerable: true,
327
+ get: function () {
328
+ return _provisioning[key];
329
+ }
330
+ });
317
331
  });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useProvisioningActions = void 0;
7
+ exports.useProvisioningState = useProvisioningState;
8
+
9
+ var _reduxStore = require("@frontegg/redux-store");
10
+
11
+ var _hooks = require("./hooks");
12
+
13
+ const defaultMapper = state => state;
14
+
15
+ function useProvisioningState(stateMapper = defaultMapper) {
16
+ return (0, _hooks.stateHookGenerator)(stateMapper, 'provisioningState');
17
+ }
18
+
19
+ const useProvisioningActions = () => (0, _hooks.reducerActionsGenerator)(_reduxStore.provisioningActions, _reduxStore.provisioningReducers);
20
+
21
+ exports.useProvisioningActions = useProvisioningActions;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.50.0
1
+ /** @license Frontegg v6.51.0-alpha.0
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.50.0",
3
+ "version": "6.51.0-alpha.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.50.0",
10
- "@frontegg/types": "6.50.0",
9
+ "@frontegg/redux-store": "6.51.0-alpha.0",
10
+ "@frontegg/types": "6.51.0-alpha.0",
11
11
  "@types/react": "*",
12
12
  "react-redux": "^7.x"
13
13
  },