@frontegg/react-hooks 6.34.0 → 6.35.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.
package/auth/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { useAuth, useAuthActions, useOnRedirectTo, useAuthRoutes, useIsAuthenticated, useAuthUser, useAuthUserOrNull, useLoginWithRedirect } from './hooks';
1
+ export { useAuth, useAuthActions, useOnRedirectTo, useAuthRoutes, useIsAuthenticated, useAuthUser, useAuthUserOrNull, useLoginWithRedirect, } from './hooks';
2
2
  export * from './acceptInvitation';
3
3
  export * from './activateAccount';
4
4
  export * from './apiTokens';
@@ -15,3 +15,12 @@ export declare const useIpRestrictions: (loadOnMount?: boolean) => {
15
15
  totalPages: number;
16
16
  userIpValid: boolean;
17
17
  };
18
+ export declare const useEmailDomainRestrictions: (loadOnMount?: boolean) => {
19
+ loading: boolean;
20
+ saving: boolean | undefined;
21
+ error: any;
22
+ data: {
23
+ config: import("@frontegg/rest-api").DomainRestrictionConfig;
24
+ restrictions: import("@frontegg/rest-api").DomainRestriction[];
25
+ } | undefined;
26
+ };
@@ -33,4 +33,24 @@ export const useIpRestrictions = (loadOnMount = false) => {
33
33
  totalPages,
34
34
  userIpValid
35
35
  };
36
+ };
37
+ export const useEmailDomainRestrictions = (loadOnMount = false) => {
38
+ const {
39
+ loading,
40
+ data,
41
+ saving,
42
+ error
43
+ } = useRestrictionsState(state => state.emailDomainRestrictions);
44
+ const {
45
+ loadEmailDomainRestrictions
46
+ } = useRestrictionsActions();
47
+ useEffect(() => {
48
+ (loadOnMount || !data) && loadEmailDomainRestrictions(); // eslint-disable-next-line react-hooks/exhaustive-deps
49
+ }, [loadOnMount, loadEmailDomainRestrictions]);
50
+ return {
51
+ loading,
52
+ saving,
53
+ error,
54
+ data
55
+ };
36
56
  };
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.34.0
1
+ /** @license Frontegg v6.35.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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useRestrictionsActions = exports.useIpRestrictions = void 0;
6
+ exports.useRestrictionsActions = exports.useIpRestrictions = exports.useEmailDomainRestrictions = void 0;
7
7
  exports.useRestrictionsState = useRestrictionsState;
8
8
 
9
9
  var _reduxStore = require("@frontegg/redux-store");
@@ -49,4 +49,27 @@ const useIpRestrictions = (loadOnMount = false) => {
49
49
  };
50
50
  };
51
51
 
52
- exports.useIpRestrictions = useIpRestrictions;
52
+ exports.useIpRestrictions = useIpRestrictions;
53
+
54
+ const useEmailDomainRestrictions = (loadOnMount = false) => {
55
+ const {
56
+ loading,
57
+ data,
58
+ saving,
59
+ error
60
+ } = useRestrictionsState(state => state.emailDomainRestrictions);
61
+ const {
62
+ loadEmailDomainRestrictions
63
+ } = useRestrictionsActions();
64
+ (0, _react.useEffect)(() => {
65
+ (loadOnMount || !data) && loadEmailDomainRestrictions(); // eslint-disable-next-line react-hooks/exhaustive-deps
66
+ }, [loadOnMount, loadEmailDomainRestrictions]);
67
+ return {
68
+ loading,
69
+ saving,
70
+ error,
71
+ data
72
+ };
73
+ };
74
+
75
+ exports.useEmailDomainRestrictions = useEmailDomainRestrictions;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.34.0
1
+ /** @license Frontegg v6.35.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.34.0",
3
+ "version": "6.35.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.34.0",
10
- "@frontegg/types": "6.34.0",
9
+ "@frontegg/redux-store": "6.35.0-alpha.0",
10
+ "@frontegg/types": "6.35.0-alpha.0",
11
11
  "@types/react": "*",
12
12
  "react-redux": "^7.x"
13
13
  },