@frontegg/react-hooks 7.77.0 → 7.78.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.
- package/audits/auditLogs.d.ts +2 -3
- package/audits/auditLogs.js +8 -9
- package/audits/auditsMetadata.d.ts +2 -3
- package/audits/auditsMetadata.js +8 -9
- package/audits/hooks.d.ts +2 -9
- package/audits/hooks.js +10 -14
- package/auth/acceptInvitation.d.ts +7 -5
- package/auth/acceptInvitation.js +8 -13
- package/auth/activateAccount.d.ts +11 -5
- package/auth/activateAccount.js +8 -13
- package/auth/allAccounts.d.ts +47 -7
- package/auth/allAccounts.js +12 -20
- package/auth/apiTokens.d.ts +14 -3
- package/auth/apiTokens.js +8 -9
- package/auth/applications.d.ts +22 -3
- package/auth/applications.js +8 -9
- package/auth/customLogin.d.ts +9 -3
- package/auth/customLogin.js +9 -12
- package/auth/entitlements.d.ts +6 -25
- package/auth/entitlements.js +41 -73
- package/auth/forgotPassword.d.ts +12 -3
- package/auth/forgotPassword.js +10 -9
- package/auth/groups.d.ts +32 -5
- package/auth/groups.js +14 -14
- package/auth/impersonate.d.ts +6 -3
- package/auth/impersonate.js +8 -8
- package/auth/login.d.ts +74 -3
- package/auth/login.js +8 -8
- package/auth/passkeys.d.ts +10 -3
- package/auth/passkeys.js +8 -8
- package/auth/passwordRotation.d.ts +4 -3
- package/auth/passwordRotation.js +8 -9
- package/auth/profile.d.ts +19 -3
- package/auth/profile.js +17 -12
- package/auth/provisioning.d.ts +20 -3
- package/auth/provisioning.js +8 -8
- package/auth/resetPhoneNumber.d.ts +8 -3
- package/auth/resetPhoneNumber.js +8 -8
- package/auth/roles.d.ts +14 -3
- package/auth/roles.js +8 -8
- package/auth/security/restrictions.d.ts +21 -3
- package/auth/security/restrictions.js +20 -19
- package/auth/security/securityCenter.d.ts +15 -3
- package/auth/security/securityCenter.js +8 -9
- package/auth/security/securityPolicy.d.ts +35 -5
- package/auth/security/securityPolicy.js +16 -18
- package/auth/security/sessionsPolicy.d.ts +7 -3
- package/auth/security/sessionsPolicy.js +8 -9
- package/auth/sessions.d.ts +12 -3
- package/auth/sessions.js +8 -8
- package/auth/signup.d.ts +10 -5
- package/auth/signup.js +8 -16
- package/auth/sms.d.ts +13 -3
- package/auth/sms.js +8 -8
- package/auth/socialLogin.d.ts +9 -5
- package/auth/socialLogin.js +8 -13
- package/auth/sso.d.ts +31 -6
- package/auth/sso.js +8 -13
- package/auth/stepUp.d.ts +15 -14
- package/auth/stepUp.js +9 -22
- package/auth/team.d.ts +84 -13
- package/auth/team.js +12 -23
- package/auth/tenants.d.ts +9 -3
- package/auth/tenants.js +8 -9
- package/auth/unlockAccount.d.ts +6 -5
- package/auth/unlockAccount.js +8 -10
- package/auth/usernames.d.ts +7 -3
- package/auth/usernames.js +8 -8
- package/auth/usersEmailsPolicyState.d.ts +5 -5
- package/auth/usersEmailsPolicyState.js +8 -10
- package/connectivity/hooks.d.ts +41 -3
- package/connectivity/hooks.js +8 -9
- package/index.js +1 -1
- package/node/audits/auditLogs.js +11 -12
- package/node/audits/auditsMetadata.js +11 -12
- package/node/audits/hooks.js +13 -17
- package/node/auth/acceptInvitation.js +11 -13
- package/node/auth/activateAccount.js +11 -13
- package/node/auth/allAccounts.js +15 -20
- package/node/auth/apiTokens.js +11 -12
- package/node/auth/applications.js +11 -12
- package/node/auth/customLogin.js +11 -15
- package/node/auth/entitlements.js +41 -73
- package/node/auth/forgotPassword.js +13 -12
- package/node/auth/groups.js +17 -17
- package/node/auth/impersonate.js +11 -11
- package/node/auth/login.js +11 -11
- package/node/auth/passkeys.js +11 -11
- package/node/auth/passwordRotation.js +11 -12
- package/node/auth/profile.js +19 -13
- package/node/auth/provisioning.js +11 -11
- package/node/auth/resetPhoneNumber.js +11 -11
- package/node/auth/roles.js +11 -11
- package/node/auth/security/restrictions.js +22 -21
- package/node/auth/security/securityCenter.js +11 -12
- package/node/auth/security/securityPolicy.js +18 -17
- package/node/auth/security/sessionsPolicy.js +11 -12
- package/node/auth/sessions.js +11 -11
- package/node/auth/signup.js +11 -16
- package/node/auth/sms.js +11 -11
- package/node/auth/socialLogin.js +11 -13
- package/node/auth/sso.js +11 -13
- package/node/auth/stepUp.js +11 -24
- package/node/auth/team.js +16 -28
- package/node/auth/tenants.js +11 -12
- package/node/auth/unlockAccount.js +11 -13
- package/node/auth/usernames.js +11 -11
- package/node/auth/usersEmailsPolicyState.js +11 -13
- package/node/connectivity/hooks.js +11 -12
- package/node/index.js +1 -1
- package/node/subscriptions/hooks.js +86 -115
- package/node/useSnapshot/hookFactory.js +32 -0
- package/node/vendor/hooks.js +11 -14
- package/package.json +3 -3
- package/subscriptions/hooks.d.ts +48 -22
- package/subscriptions/hooks.js +77 -103
- package/useSnapshot/hookFactory.d.ts +18 -0
- package/useSnapshot/hookFactory.js +26 -0
- package/vendor/hooks.d.ts +2 -5
- package/vendor/hooks.js +8 -14
|
@@ -4,117 +4,85 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.usePermissionEntitlements = exports.useFeatureEntitlements = exports.useEntitlementsOptions = exports.useEntitlementsActions = exports.useEntitlements = void 0;
|
|
7
|
-
var _hooks = require("./hooks");
|
|
8
7
|
var _react = require("react");
|
|
8
|
+
var _reduxStore = require("@frontegg/redux-store");
|
|
9
|
+
var _hooks = require("./hooks");
|
|
9
10
|
var _common = require("../common");
|
|
10
11
|
var _flags = require("../flags");
|
|
11
12
|
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
12
13
|
var _useSnapshot = require("../useSnapshot");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @returns entitlements state as stored in the user
|
|
16
|
-
*/
|
|
14
|
+
/** Current entitlements object (or empty) */
|
|
17
15
|
const useEntitlementsState = () => {
|
|
18
16
|
var _useSnapshot$user$ent, _useSnapshot$user;
|
|
19
|
-
|
|
20
|
-
return (_useSnapshot$user$ent = (_useSnapshot$user = (0, _useSnapshot.useSnapshot)(state).user) == null ? void 0 : _useSnapshot$user.entitlements) != null ? _useSnapshot$user$ent : {};
|
|
17
|
+
return (_useSnapshot$user$ent = (_useSnapshot$user = (0, _useSnapshot.useSnapshot)((0, _FronteggStoreContext.useStore)().store.auth).user) == null ? void 0 : _useSnapshot$user.entitlements) != null ? _useSnapshot$user$ent : {};
|
|
21
18
|
};
|
|
22
19
|
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
const useUserState = () => {
|
|
27
|
-
return (0, _hooks.useAuthUserOrNull)() || undefined;
|
|
28
|
-
};
|
|
20
|
+
/** Currently logged-in user claims (or undefined) */
|
|
21
|
+
const useUserState = () => (0, _hooks.useAuthUserOrNull)() || undefined;
|
|
29
22
|
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
* @returns is entitled query data including entitlement state and final attributes (consumer and frontegg)
|
|
33
|
-
*/
|
|
34
|
-
const useEntitlementsQueryData = customAttributes => {
|
|
23
|
+
/** Shared attributes object passed to the entitlement engine */
|
|
24
|
+
const useAttributes = custom => {
|
|
35
25
|
const user = useUserState();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
custom: customAttributes,
|
|
26
|
+
return (0, _react.useMemo)(() => ({
|
|
27
|
+
custom,
|
|
39
28
|
jwt: user
|
|
40
|
-
};
|
|
41
|
-
return {
|
|
42
|
-
entitlements,
|
|
43
|
-
attributes
|
|
44
|
-
};
|
|
29
|
+
}), [custom, user]);
|
|
45
30
|
};
|
|
46
31
|
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
32
|
+
/** Single resolver so we don’t repeat switch-cases in every hook */
|
|
33
|
+
const resolveEntitlement = (variant, keyOrOpts, entitlements, attrs, appName) => {
|
|
34
|
+
switch (variant) {
|
|
35
|
+
case 'feature':
|
|
36
|
+
return (0, _reduxStore.getFeatureEntitlements)(entitlements, keyOrOpts, attrs, undefined, appName);
|
|
37
|
+
case 'permission':
|
|
38
|
+
return (0, _reduxStore.getPermissionEntitlements)(entitlements, keyOrOpts, attrs, undefined, appName);
|
|
39
|
+
default:
|
|
40
|
+
return (0, _reduxStore.getEntitlements)(entitlements, keyOrOpts, attrs, undefined, appName);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const useFeatureEntitlements = (key, custom) => {
|
|
44
|
+
const entitlements = useEntitlementsState();
|
|
45
|
+
const attrs = useAttributes(custom);
|
|
57
46
|
const {
|
|
58
47
|
appName
|
|
59
48
|
} = (0, _common.useRootState)();
|
|
60
|
-
return (
|
|
49
|
+
return resolveEntitlement('feature', key, entitlements, attrs, appName);
|
|
61
50
|
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
@param key permission key
|
|
65
|
-
@param customAttributes user attributes
|
|
66
|
-
@returns if the user is entitled to the given permission and attributes. Attaching the justification if not
|
|
67
|
-
*/
|
|
68
51
|
exports.useFeatureEntitlements = useFeatureEntitlements;
|
|
69
|
-
const usePermissionEntitlements = (key,
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
attributes
|
|
73
|
-
} = useEntitlementsQueryData(customAttributes);
|
|
52
|
+
const usePermissionEntitlements = (key, custom) => {
|
|
53
|
+
const entitlements = useEntitlementsState();
|
|
54
|
+
const attrs = useAttributes(custom);
|
|
74
55
|
const {
|
|
75
56
|
appName
|
|
76
57
|
} = (0, _common.useRootState)();
|
|
77
|
-
return (
|
|
58
|
+
return resolveEntitlement('permission', key, entitlements, attrs, appName);
|
|
78
59
|
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
@param options
|
|
82
|
-
@param customAttributes user attributes
|
|
83
|
-
@returns if the user is entitled to the given feature or permission and attributes (check only one). Attaching the justification if not
|
|
84
|
-
*/
|
|
85
60
|
exports.usePermissionEntitlements = usePermissionEntitlements;
|
|
86
|
-
const useEntitlements = (
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
attributes
|
|
90
|
-
} = useEntitlementsQueryData(customAttributes);
|
|
61
|
+
const useEntitlements = (opts, custom) => {
|
|
62
|
+
const entitlements = useEntitlementsState();
|
|
63
|
+
const attrs = useAttributes(custom);
|
|
91
64
|
const {
|
|
92
65
|
appName
|
|
93
66
|
} = (0, _common.useRootState)();
|
|
94
|
-
return (
|
|
67
|
+
return resolveEntitlement('any', opts, entitlements, attrs, appName);
|
|
95
68
|
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
@returns an action your can use to detect if the user is entitled to the given feature or permission (check only one).
|
|
99
|
-
Attaching the justification if not
|
|
100
|
-
*/
|
|
101
69
|
exports.useEntitlements = useEntitlements;
|
|
102
70
|
const useEntitlementsActions = () => {
|
|
103
|
-
// this code is duplicated because React is yelling when using useEntitlementsQueryData inside the isEntitledTo function because it's not a hook
|
|
104
|
-
const user = useUserState();
|
|
105
71
|
const entitlements = useEntitlementsState();
|
|
106
72
|
const {
|
|
107
73
|
appName
|
|
108
74
|
} = (0, _common.useRootState)();
|
|
75
|
+
const user = useUserState(); // stable referentially via useAuthUserOrNull
|
|
76
|
+
// Pre-compute attrs once so callers don’t need to worry
|
|
109
77
|
return (0, _react.useMemo)(() => ({
|
|
110
|
-
isEntitledTo: (options,
|
|
111
|
-
const
|
|
112
|
-
custom
|
|
78
|
+
isEntitledTo: (options, custom) => {
|
|
79
|
+
const attrs = {
|
|
80
|
+
custom,
|
|
113
81
|
jwt: user
|
|
114
82
|
};
|
|
115
|
-
return (0, _reduxStore.getEntitlements)(entitlements, options,
|
|
83
|
+
return (0, _reduxStore.getEntitlements)(entitlements, options, attrs, undefined, appName);
|
|
116
84
|
}
|
|
117
|
-
}), [user,
|
|
85
|
+
}), [entitlements, user, appName]);
|
|
118
86
|
};
|
|
119
87
|
|
|
120
88
|
/**
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useForgotPasswordActions = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
exports.useForgotPasswordActions = useForgotPasswordActions;
|
|
6
|
+
exports.useForgotPasswordState = exports.useForgotPasswordActions = void 0;
|
|
7
|
+
var _hookFactory = require("../useSnapshot/hookFactory");
|
|
8
|
+
// forgotPasswordHooks.ts
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
useSliceState: useForgotPasswordState,
|
|
12
|
+
useSliceActions: useForgotPasswordActions
|
|
13
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
14
|
+
getState: s => s.auth.forgotPasswordState,
|
|
15
|
+
getActions: a => a.auth.forgotPasswordActions
|
|
16
|
+
});
|
|
17
|
+
exports.useForgotPasswordActions = useForgotPasswordActions;
|
|
18
|
+
exports.useForgotPasswordState = useForgotPasswordState;
|
package/node/auth/groups.js
CHANGED
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useGroupsDialogsActions = exports.useGroupsActions = void 0;
|
|
6
|
+
exports.useGroupsState = exports.useGroupsDialogsState = exports.useGroupsDialogsActions = exports.useGroupsActions = void 0;
|
|
7
|
+
var _hookFactory = require("../useSnapshot/hookFactory");
|
|
8
|
+
// groupsHooks.ts
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
useSliceState: useGroupsState,
|
|
12
|
+
useSliceActions: useGroupsActions,
|
|
13
|
+
useSliceDialogsState: useGroupsDialogsState,
|
|
14
|
+
useSliceDialogsActions: useGroupsDialogsActions
|
|
15
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
16
|
+
getState: s => s.auth.groupsState,
|
|
17
|
+
getActions: a => a.auth.groupsActions,
|
|
18
|
+
getDialogsState: s => s.auth.groupsDialogsState,
|
|
19
|
+
getDialogsActions: a => a.auth.groupsDialogsActions
|
|
20
|
+
});
|
|
21
|
+
exports.useGroupsDialogsActions = useGroupsDialogsActions;
|
|
7
22
|
exports.useGroupsDialogsState = useGroupsDialogsState;
|
|
8
|
-
exports.useGroupsState = useGroupsState;
|
|
9
|
-
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
10
|
-
var _useSnapshot = require("../useSnapshot");
|
|
11
|
-
function useGroupsState() {
|
|
12
|
-
return (0, _useSnapshot.useSnapshot)((0, _FronteggStoreContext.useStore)().store.auth.groupsState);
|
|
13
|
-
}
|
|
14
|
-
const useGroupsActions = () => {
|
|
15
|
-
return (0, _FronteggStoreContext.useStore)().stateActions.auth.groupsActions;
|
|
16
|
-
};
|
|
17
23
|
exports.useGroupsActions = useGroupsActions;
|
|
18
|
-
|
|
19
|
-
return (0, _useSnapshot.useSnapshot)((0, _FronteggStoreContext.useStore)().store.auth.groupsDialogsState);
|
|
20
|
-
}
|
|
21
|
-
const useGroupsDialogsActions = () => {
|
|
22
|
-
return (0, _FronteggStoreContext.useStore)().stateActions.auth.groupsDialogsActions;
|
|
23
|
-
};
|
|
24
|
-
exports.useGroupsDialogsActions = useGroupsDialogsActions;
|
|
24
|
+
exports.useGroupsState = useGroupsState;
|
package/node/auth/impersonate.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useImpersonateActions = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.
|
|
6
|
+
exports.useImpersonateState = exports.useImpersonateActions = void 0;
|
|
7
|
+
var _hookFactory = require("../useSnapshot/hookFactory");
|
|
8
|
+
const {
|
|
9
|
+
useSliceState: useImpersonateState,
|
|
10
|
+
useSliceActions: useImpersonateActions
|
|
11
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
12
|
+
getState: s => s.auth.impersonateState,
|
|
13
|
+
getActions: a => a.auth.impersonateActions
|
|
14
|
+
});
|
|
15
|
+
exports.useImpersonateActions = useImpersonateActions;
|
|
16
|
+
exports.useImpersonateState = useImpersonateState;
|
package/node/auth/login.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useLoginActions = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.
|
|
6
|
+
exports.useLoginState = exports.useLoginActions = void 0;
|
|
7
|
+
var _hookFactory = require("../useSnapshot/hookFactory");
|
|
8
|
+
const {
|
|
9
|
+
useSliceState: useLoginState,
|
|
10
|
+
useSliceActions: useLoginActions
|
|
11
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
12
|
+
getState: s => s.auth.loginState,
|
|
13
|
+
getActions: a => a.auth.loginActions
|
|
14
|
+
});
|
|
15
|
+
exports.useLoginActions = useLoginActions;
|
|
16
|
+
exports.useLoginState = useLoginState;
|
package/node/auth/passkeys.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.usePasskeysActions = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.
|
|
6
|
+
exports.usePasskeysState = exports.usePasskeysActions = void 0;
|
|
7
|
+
var _hookFactory = require("../useSnapshot/hookFactory");
|
|
8
|
+
const {
|
|
9
|
+
useSliceState: usePasskeysState,
|
|
10
|
+
useSliceActions: usePasskeysActions
|
|
11
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
12
|
+
getState: s => s.auth.passkeysState,
|
|
13
|
+
getActions: a => a.auth.passkeysActions
|
|
14
|
+
});
|
|
15
|
+
exports.usePasskeysActions = usePasskeysActions;
|
|
16
|
+
exports.usePasskeysState = usePasskeysState;
|
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.usePasswordRotationActions = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
exports.usePasswordRotationActions = usePasswordRotationActions;
|
|
6
|
+
exports.usePasswordRotationState = exports.usePasswordRotationActions = void 0;
|
|
7
|
+
var _hookFactory = require("../useSnapshot/hookFactory");
|
|
8
|
+
const {
|
|
9
|
+
useSliceState: usePasswordRotationState,
|
|
10
|
+
useSliceActions: usePasswordRotationActions
|
|
11
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
12
|
+
getState: s => s.auth.passwordRotationState,
|
|
13
|
+
getActions: a => a.auth.passwordRotationActions
|
|
14
|
+
});
|
|
15
|
+
exports.usePasswordRotationActions = usePasswordRotationActions;
|
|
16
|
+
exports.usePasswordRotationState = usePasswordRotationState;
|
package/node/auth/profile.js
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useProfileActions = exports.reloadProfileIfNeeded = void 0;
|
|
7
|
-
exports.useProfileState = useProfileState;
|
|
6
|
+
exports.useReloadProfileIfNeeded = exports.useProfileState = exports.useProfileActions = exports.reloadProfileIfNeeded = void 0;
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
8
|
+
var _hookFactory = require("../useSnapshot/hookFactory");
|
|
9
|
+
const {
|
|
10
|
+
useSliceState: useProfileState,
|
|
11
|
+
useSliceActions: useProfileActions
|
|
12
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
13
|
+
getState: s => s.auth.profileState,
|
|
14
|
+
getActions: a => a.auth.profileActions
|
|
15
|
+
});
|
|
17
16
|
exports.useProfileActions = useProfileActions;
|
|
18
|
-
|
|
17
|
+
exports.useProfileState = useProfileState;
|
|
18
|
+
const useReloadProfileIfNeeded = () => {
|
|
19
19
|
const {
|
|
20
20
|
loading
|
|
21
21
|
} = useProfileState();
|
|
@@ -23,7 +23,13 @@ const reloadProfileIfNeeded = () => {
|
|
|
23
23
|
loadProfile
|
|
24
24
|
} = useProfileActions();
|
|
25
25
|
(0, _react.useEffect)(() => {
|
|
26
|
-
!loading
|
|
27
|
-
}, []);
|
|
26
|
+
if (!loading) loadProfile();
|
|
27
|
+
}, [loading, loadProfile]);
|
|
28
28
|
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated use `useReloadProfileIfNeeded` instead
|
|
32
|
+
*/
|
|
33
|
+
exports.useReloadProfileIfNeeded = useReloadProfileIfNeeded;
|
|
34
|
+
const reloadProfileIfNeeded = useReloadProfileIfNeeded;
|
|
29
35
|
exports.reloadProfileIfNeeded = reloadProfileIfNeeded;
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useProvisioningActions = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.
|
|
6
|
+
exports.useProvisioningState = exports.useProvisioningActions = void 0;
|
|
7
|
+
var _hookFactory = require("../useSnapshot/hookFactory");
|
|
8
|
+
const {
|
|
9
|
+
useSliceState: useProvisioningState,
|
|
10
|
+
useSliceActions: useProvisioningActions
|
|
11
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
12
|
+
getState: s => s.auth.provisioningState,
|
|
13
|
+
getActions: a => a.auth.provisioningActions
|
|
14
|
+
});
|
|
15
|
+
exports.useProvisioningActions = useProvisioningActions;
|
|
16
|
+
exports.useProvisioningState = useProvisioningState;
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useResetPhoneNumberActions = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.
|
|
6
|
+
exports.useResetPhoneNumberState = exports.useResetPhoneNumberActions = void 0;
|
|
7
|
+
var _hookFactory = require("../useSnapshot/hookFactory");
|
|
8
|
+
const {
|
|
9
|
+
useSliceState: useResetPhoneNumberState,
|
|
10
|
+
useSliceActions: useResetPhoneNumberActions
|
|
11
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
12
|
+
getState: s => s.auth.resetPhoneNumberState,
|
|
13
|
+
getActions: a => a.auth.resetPhoneNumberActions
|
|
14
|
+
});
|
|
15
|
+
exports.useResetPhoneNumberActions = useResetPhoneNumberActions;
|
|
16
|
+
exports.useResetPhoneNumberState = useResetPhoneNumberState;
|
package/node/auth/roles.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useRolesActions = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.
|
|
6
|
+
exports.useRolesState = exports.useRolesActions = void 0;
|
|
7
|
+
var _hookFactory = require("../useSnapshot/hookFactory");
|
|
8
|
+
const {
|
|
9
|
+
useSliceState: useRolesState,
|
|
10
|
+
useSliceActions: useRolesActions
|
|
11
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
12
|
+
getState: s => s.auth.rolesState,
|
|
13
|
+
getActions: a => a.auth.rolesActions
|
|
14
|
+
});
|
|
15
|
+
exports.useRolesActions = useRolesActions;
|
|
16
|
+
exports.useRolesState = useRolesState;
|
|
@@ -3,20 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useRestrictionsActions = exports.useIpRestrictions = exports.useEmailDomainRestrictions = void 0;
|
|
7
|
-
exports.useRestrictionsState = useRestrictionsState;
|
|
6
|
+
exports.useRestrictionsState = exports.useRestrictionsActions = exports.useIpRestrictions = exports.useEmailDomainRestrictions = void 0;
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
8
|
+
var _hookFactory = require("../../useSnapshot/hookFactory");
|
|
9
|
+
const {
|
|
10
|
+
useSliceState: useRestrictionsState,
|
|
11
|
+
useSliceActions: useRestrictionsActions
|
|
12
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
13
|
+
getState: s => s.auth.restrictionsState,
|
|
14
|
+
getActions: a => a.auth.restrictionsActions
|
|
15
|
+
});
|
|
18
16
|
exports.useRestrictionsActions = useRestrictionsActions;
|
|
17
|
+
exports.useRestrictionsState = useRestrictionsState;
|
|
19
18
|
const useIpRestrictions = () => {
|
|
19
|
+
const {
|
|
20
|
+
ipRestrictions
|
|
21
|
+
} = useRestrictionsState();
|
|
20
22
|
const {
|
|
21
23
|
loading,
|
|
22
24
|
data,
|
|
@@ -25,15 +27,13 @@ const useIpRestrictions = () => {
|
|
|
25
27
|
pagination,
|
|
26
28
|
totalPages,
|
|
27
29
|
userIpValid
|
|
28
|
-
} =
|
|
30
|
+
} = ipRestrictions;
|
|
29
31
|
const {
|
|
30
32
|
loadIpRestrictions
|
|
31
33
|
} = useRestrictionsActions();
|
|
32
34
|
(0, _react.useEffect)(() => {
|
|
33
|
-
if (!data && !loading)
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}, [loadIpRestrictions, data, loading]);
|
|
35
|
+
if (!data && !loading) loadIpRestrictions();
|
|
36
|
+
}, [data, loading, loadIpRestrictions]);
|
|
37
37
|
return {
|
|
38
38
|
loading,
|
|
39
39
|
saving,
|
|
@@ -46,20 +46,21 @@ const useIpRestrictions = () => {
|
|
|
46
46
|
};
|
|
47
47
|
exports.useIpRestrictions = useIpRestrictions;
|
|
48
48
|
const useEmailDomainRestrictions = () => {
|
|
49
|
+
const {
|
|
50
|
+
emailDomainRestrictions
|
|
51
|
+
} = useRestrictionsState();
|
|
49
52
|
const {
|
|
50
53
|
loading,
|
|
51
54
|
data,
|
|
52
55
|
saving,
|
|
53
56
|
error
|
|
54
|
-
} =
|
|
57
|
+
} = emailDomainRestrictions;
|
|
55
58
|
const {
|
|
56
59
|
loadEmailDomainRestrictions
|
|
57
60
|
} = useRestrictionsActions();
|
|
58
61
|
(0, _react.useEffect)(() => {
|
|
59
|
-
if (!data && !loading)
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
}, [loadEmailDomainRestrictions, data, loading]);
|
|
62
|
+
if (!data && !loading) loadEmailDomainRestrictions();
|
|
63
|
+
}, [data, loading, loadEmailDomainRestrictions]);
|
|
63
64
|
return {
|
|
64
65
|
loading,
|
|
65
66
|
saving,
|
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useSecurityCenterActions = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
exports.useSecurityCenterActions = useSecurityCenterActions;
|
|
6
|
+
exports.useSecurityCenterState = exports.useSecurityCenterActions = void 0;
|
|
7
|
+
var _hookFactory = require("../../useSnapshot/hookFactory");
|
|
8
|
+
const {
|
|
9
|
+
useSliceState: useSecurityCenterState,
|
|
10
|
+
useSliceActions: useSecurityCenterActions
|
|
11
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
12
|
+
getState: s => s.auth.securityCenterState,
|
|
13
|
+
getActions: a => a.auth.securityCenterActions
|
|
14
|
+
});
|
|
15
|
+
exports.useSecurityCenterActions = useSecurityCenterActions;
|
|
16
|
+
exports.useSecurityCenterState = useSecurityCenterState;
|
|
@@ -3,21 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useSecurityPolicyActions = exports.usePublicPolicySettings = exports.usePublicAuthStrategiesPolicySettings = void 0;
|
|
7
|
-
exports.useSecurityPolicyState = useSecurityPolicyState;
|
|
6
|
+
exports.useSecurityPolicyState = exports.useSecurityPolicyActions = exports.usePublicPolicySettings = exports.usePublicAuthStrategiesPolicySettings = void 0;
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
const useSecurityPolicyActions = () => {
|
|
18
|
-
return (0, _FronteggStoreContext.useStore)().stateActions.auth.securityPolicyActions;
|
|
19
|
-
};
|
|
8
|
+
var _hookFactory = require("../../useSnapshot/hookFactory");
|
|
9
|
+
const {
|
|
10
|
+
useSliceState: useSecurityPolicyState,
|
|
11
|
+
useSliceActions: useSecurityPolicyActions
|
|
12
|
+
} = (0, _hookFactory.createSliceHooks)({
|
|
13
|
+
getState: s => s.auth.securityPolicyState,
|
|
14
|
+
getActions: a => a.auth.securityPolicyActions
|
|
15
|
+
});
|
|
20
16
|
exports.useSecurityPolicyActions = useSecurityPolicyActions;
|
|
17
|
+
exports.useSecurityPolicyState = useSecurityPolicyState;
|
|
21
18
|
const usePublicPolicySettings = (loadOnMount = false) => {
|
|
22
19
|
const {
|
|
23
20
|
publicPolicy
|
|
@@ -26,8 +23,10 @@ const usePublicPolicySettings = (loadOnMount = false) => {
|
|
|
26
23
|
loadPublicSecurityPolicy
|
|
27
24
|
} = useSecurityPolicyActions();
|
|
28
25
|
(0, _react.useEffect)(() => {
|
|
29
|
-
(loadOnMount || !publicPolicy.policy) &&
|
|
30
|
-
|
|
26
|
+
if ((loadOnMount || !publicPolicy.policy) && !publicPolicy.loading) {
|
|
27
|
+
loadPublicSecurityPolicy();
|
|
28
|
+
}
|
|
29
|
+
}, [loadOnMount, publicPolicy.policy, publicPolicy.loading, loadPublicSecurityPolicy]);
|
|
31
30
|
return publicPolicy;
|
|
32
31
|
};
|
|
33
32
|
exports.usePublicPolicySettings = usePublicPolicySettings;
|
|
@@ -39,8 +38,10 @@ const usePublicAuthStrategiesPolicySettings = (loadOnMount = false) => {
|
|
|
39
38
|
loadPublicAuthStrategiesPolicy
|
|
40
39
|
} = useSecurityPolicyActions();
|
|
41
40
|
(0, _react.useEffect)(() => {
|
|
42
|
-
(loadOnMount || !publicAuthStrategyPolicy.policy) && !publicAuthStrategyPolicy.error &&
|
|
43
|
-
|
|
41
|
+
if ((loadOnMount || !publicAuthStrategyPolicy.policy) && !publicAuthStrategyPolicy.error && !publicAuthStrategyPolicy.loading) {
|
|
42
|
+
loadPublicAuthStrategiesPolicy();
|
|
43
|
+
}
|
|
44
|
+
}, [loadOnMount, publicAuthStrategyPolicy.policy, publicAuthStrategyPolicy.error, publicAuthStrategyPolicy.loading, loadPublicAuthStrategiesPolicy]);
|
|
44
45
|
return publicAuthStrategyPolicy;
|
|
45
46
|
};
|
|
46
47
|
exports.usePublicAuthStrategiesPolicySettings = usePublicAuthStrategiesPolicySettings;
|