@frontegg/react-hooks 7.28.0-alpha.1 → 7.28.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.
@@ -1,7 +1,7 @@
1
1
  import { RestrictionsActions, RestrictionsState } from '@frontegg/redux-store';
2
2
  export declare function useRestrictionsState(): RestrictionsState;
3
3
  export declare const useRestrictionsActions: () => RestrictionsActions;
4
- export declare const useIpRestrictions: (loadOnMount?: boolean) => {
4
+ export declare const useIpRestrictions: () => {
5
5
  loading: boolean;
6
6
  saving: boolean | undefined;
7
7
  error: any;
@@ -13,7 +13,7 @@ export declare const useIpRestrictions: (loadOnMount?: boolean) => {
13
13
  totalPages: number;
14
14
  userIpValid: boolean;
15
15
  };
16
- export declare const useEmailDomainRestrictions: (loadOnMount?: boolean) => {
16
+ export declare const useEmailDomainRestrictions: () => {
17
17
  loading: boolean;
18
18
  saving: boolean | undefined;
19
19
  error: any;
@@ -8,7 +8,7 @@ export function useRestrictionsState() {
8
8
  export const useRestrictionsActions = () => {
9
9
  return useStore().stateActions.auth.restrictionsActions;
10
10
  };
11
- export const useIpRestrictions = (loadOnMount = false) => {
11
+ export const useIpRestrictions = () => {
12
12
  const {
13
13
  loading,
14
14
  data,
@@ -22,8 +22,10 @@ export const useIpRestrictions = (loadOnMount = false) => {
22
22
  loadIpRestrictions
23
23
  } = useRestrictionsActions();
24
24
  useEffect(() => {
25
- (loadOnMount || !data) && loadIpRestrictions();
26
- }, [loadOnMount, loadIpRestrictions]);
25
+ if (!data && !loading) {
26
+ loadIpRestrictions();
27
+ }
28
+ }, [loadIpRestrictions, data, loading]);
27
29
  return {
28
30
  loading,
29
31
  saving,
@@ -34,7 +36,7 @@ export const useIpRestrictions = (loadOnMount = false) => {
34
36
  userIpValid
35
37
  };
36
38
  };
37
- export const useEmailDomainRestrictions = (loadOnMount = false) => {
39
+ export const useEmailDomainRestrictions = () => {
38
40
  const {
39
41
  loading,
40
42
  data,
@@ -45,8 +47,10 @@ export const useEmailDomainRestrictions = (loadOnMount = false) => {
45
47
  loadEmailDomainRestrictions
46
48
  } = useRestrictionsActions();
47
49
  useEffect(() => {
48
- (loadOnMount || !data) && loadEmailDomainRestrictions();
49
- }, [loadOnMount, loadEmailDomainRestrictions]);
50
+ if (!data && !loading) {
51
+ loadEmailDomainRestrictions();
52
+ }
53
+ }, [loadEmailDomainRestrictions, data, loading]);
50
54
  return {
51
55
  loading,
52
56
  saving,
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.28.0-alpha.1
1
+ /** @license Frontegg v7.28.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.
@@ -16,7 +16,7 @@ const useRestrictionsActions = () => {
16
16
  return (0, _FronteggStoreContext.useStore)().stateActions.auth.restrictionsActions;
17
17
  };
18
18
  exports.useRestrictionsActions = useRestrictionsActions;
19
- const useIpRestrictions = (loadOnMount = false) => {
19
+ const useIpRestrictions = () => {
20
20
  const {
21
21
  loading,
22
22
  data,
@@ -30,8 +30,10 @@ const useIpRestrictions = (loadOnMount = false) => {
30
30
  loadIpRestrictions
31
31
  } = useRestrictionsActions();
32
32
  (0, _react.useEffect)(() => {
33
- (loadOnMount || !data) && loadIpRestrictions();
34
- }, [loadOnMount, loadIpRestrictions]);
33
+ if (!data && !loading) {
34
+ loadIpRestrictions();
35
+ }
36
+ }, [loadIpRestrictions, data, loading]);
35
37
  return {
36
38
  loading,
37
39
  saving,
@@ -43,7 +45,7 @@ const useIpRestrictions = (loadOnMount = false) => {
43
45
  };
44
46
  };
45
47
  exports.useIpRestrictions = useIpRestrictions;
46
- const useEmailDomainRestrictions = (loadOnMount = false) => {
48
+ const useEmailDomainRestrictions = () => {
47
49
  const {
48
50
  loading,
49
51
  data,
@@ -54,8 +56,10 @@ const useEmailDomainRestrictions = (loadOnMount = false) => {
54
56
  loadEmailDomainRestrictions
55
57
  } = useRestrictionsActions();
56
58
  (0, _react.useEffect)(() => {
57
- (loadOnMount || !data) && loadEmailDomainRestrictions();
58
- }, [loadOnMount, loadEmailDomainRestrictions]);
59
+ if (!data && !loading) {
60
+ loadEmailDomainRestrictions();
61
+ }
62
+ }, [loadEmailDomainRestrictions, data, loading]);
59
63
  return {
60
64
  loading,
61
65
  saving,
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.28.0-alpha.1
1
+ /** @license Frontegg v7.28.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": "7.28.0-alpha.1",
3
+ "version": "7.28.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": "7.28.0-alpha.1",
10
- "@frontegg/types": "7.28.0-alpha.1",
9
+ "@frontegg/redux-store": "7.28.0",
10
+ "@frontegg/types": "7.28.0",
11
11
  "@types/react": "*",
12
12
  "@types/react-is": "^17.0.7",
13
13
  "get-value": "^3.0.1",