@frontegg/react-hooks 6.176.0 → 6.178.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/FronteggProvider/FronteggProvider.d.ts +12 -0
- package/FronteggProvider/FronteggProvider.js +134 -0
- package/FronteggProvider/index.d.ts +1 -12
- package/FronteggProvider/index.js +1 -133
- package/FronteggStoreContext/FronteggStoreContext.d.ts +9 -0
- package/FronteggStoreContext/FronteggStoreContext.js +16 -0
- package/FronteggStoreContext/index.d.ts +1 -13
- package/FronteggStoreContext/index.js +1 -14
- package/audits/auditLogs.d.ts +2 -4
- package/audits/auditLogs.js +8 -6
- package/audits/auditsMetadata.d.ts +2 -4
- package/audits/auditsMetadata.js +8 -6
- package/audits/hooks.d.ts +0 -8
- package/audits/hooks.js +6 -30
- package/auth/acceptInvitation.js +10 -5
- package/auth/activateAccount.js +10 -4
- package/auth/{MSP/allAccounts.d.ts → allAccounts.d.ts} +2 -4
- package/auth/allAccounts.js +20 -0
- package/auth/apiTokens.d.ts +0 -2
- package/auth/apiTokens.js +8 -6
- package/auth/customLogin.d.ts +2 -5
- package/auth/customLogin.js +10 -11
- package/auth/entitlements.d.ts +14 -14
- package/auth/entitlements.js +25 -21
- package/auth/forgotPassword.d.ts +0 -2
- package/auth/forgotPassword.js +8 -6
- package/auth/groups.d.ts +0 -4
- package/auth/groups.js +12 -13
- package/auth/hooks.d.ts +9 -11
- package/auth/hooks.js +27 -58
- package/auth/impersonate.d.ts +0 -2
- package/auth/impersonate.js +7 -6
- package/auth/index.d.ts +14 -17
- package/auth/index.js +15 -18
- package/auth/login.d.ts +1 -1
- package/auth/login.js +13 -4
- package/auth/mfa.d.ts +1 -1
- package/auth/mfa.js +13 -4
- package/auth/passkeys.d.ts +1 -4
- package/auth/passkeys.js +7 -6
- package/auth/profile.d.ts +2 -4
- package/auth/profile.js +9 -8
- package/auth/provisioning.d.ts +1 -3
- package/auth/provisioning.js +7 -6
- package/auth/resetPhoneNumber.d.ts +1 -3
- package/auth/resetPhoneNumber.js +7 -6
- package/auth/roles.d.ts +1 -3
- package/auth/roles.js +7 -6
- package/auth/security/index.d.ts +4 -0
- package/auth/security/index.js +4 -0
- package/auth/security/restrictions.d.ts +0 -2
- package/auth/security/restrictions.js +10 -10
- package/auth/security/securityCenter.d.ts +1 -4
- package/auth/security/securityCenter.js +8 -6
- package/auth/security/securityPolicy.d.ts +5 -11
- package/auth/security/securityPolicy.js +19 -30
- package/auth/security/sessionsPolicy.d.ts +1 -3
- package/auth/security/sessionsPolicy.js +8 -6
- package/auth/sessions.d.ts +1 -3
- package/auth/sessions.js +7 -6
- package/auth/signup.d.ts +1 -1
- package/auth/signup.js +13 -4
- package/auth/sms.d.ts +1 -4
- package/auth/sms.js +7 -6
- package/auth/socialLogin.d.ts +1 -1
- package/auth/socialLogin.js +10 -4
- package/auth/sso.d.ts +1 -1
- package/auth/sso.js +10 -4
- package/auth/{stepUp/stepUp.d.ts → stepUp.d.ts} +0 -2
- package/auth/{stepUp/stepUp.js → stepUp.js} +9 -6
- package/auth/team.d.ts +9 -1
- package/auth/team.js +22 -4
- package/auth/tenants.d.ts +1 -3
- package/auth/tenants.js +8 -6
- package/common/CustomComponentHolder.js +3 -1
- package/common/index.js +3 -3
- package/connectivity/hooks.d.ts +2 -5
- package/connectivity/hooks.js +6 -9
- package/index.d.ts +2 -2
- package/index.js +3 -3
- package/node/FronteggProvider/FronteggProvider.js +140 -0
- package/node/FronteggProvider/index.js +9 -134
- package/node/FronteggStoreContext/FronteggStoreContext.js +26 -0
- package/node/FronteggStoreContext/index.js +11 -35
- package/node/audits/auditLogs.js +8 -6
- package/node/audits/auditsMetadata.js +8 -6
- package/node/audits/hooks.js +7 -34
- package/node/auth/acceptInvitation.js +7 -5
- package/node/auth/activateAccount.js +7 -4
- package/node/auth/allAccounts.js +27 -0
- package/node/auth/apiTokens.js +8 -6
- package/node/auth/customLogin.js +11 -12
- package/node/auth/entitlements.js +24 -20
- package/node/auth/forgotPassword.js +8 -6
- package/node/auth/groups.js +12 -12
- package/node/auth/hooks.js +27 -61
- package/node/auth/impersonate.js +7 -6
- package/node/auth/index.js +84 -120
- package/node/auth/login.js +10 -4
- package/node/auth/mfa.js +10 -4
- package/node/auth/passkeys.js +7 -6
- package/node/auth/profile.js +10 -9
- package/node/auth/provisioning.js +7 -6
- package/node/auth/resetPhoneNumber.js +7 -6
- package/node/auth/roles.js +7 -6
- package/node/auth/security/index.js +49 -0
- package/node/auth/security/restrictions.js +10 -10
- package/node/auth/security/securityCenter.js +8 -6
- package/node/auth/security/securityPolicy.js +16 -30
- package/node/auth/security/sessionsPolicy.js +8 -6
- package/node/auth/sessions.js +7 -6
- package/node/auth/signup.js +10 -4
- package/node/auth/sms.js +7 -6
- package/node/auth/socialLogin.js +7 -4
- package/node/auth/sso.js +7 -4
- package/node/auth/{stepUp/stepUp.js → stepUp.js} +10 -7
- package/node/auth/team.js +25 -4
- package/node/auth/tenants.js +8 -6
- package/node/common/CustomComponentHolder.js +3 -1
- package/node/common/index.js +2 -2
- package/node/connectivity/hooks.js +5 -8
- package/node/index.js +16 -16
- package/node/subscriptions/hooks.js +84 -51
- package/node/vendor/hooks.js +5 -6
- package/package.json +3 -3
- package/subscriptions/hooks.d.ts +32 -10
- package/subscriptions/hooks.js +81 -49
- package/vendor/hooks.d.ts +0 -1
- package/vendor/hooks.js +9 -7
- package/auth/MSP/allAccounts.js +0 -15
- package/auth/stepUp/index.d.ts +0 -2
- package/auth/stepUp/index.js +0 -2
- package/auth/stepUp/interfaces.d.ts +0 -2
- package/auth/stepUp/interfaces.js +0 -1
- package/node/auth/MSP/allAccounts.js +0 -24
- package/node/auth/stepUp/index.js +0 -27
- package/node/auth/stepUp/interfaces.js +0 -5
- package/node/tests/hooks.tsc-test.js +0 -318
- package/tests/hooks.tsc-test.js +0 -317
|
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useSecurityCenterActions = void 0;
|
|
7
7
|
exports.useSecurityCenterState = useSecurityCenterState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (0,
|
|
8
|
+
var _FronteggStoreContext = require("../../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
10
|
+
function useSecurityCenterState() {
|
|
11
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.securityCenterState;
|
|
12
|
+
return (0, _react.useSnapshot)(state);
|
|
13
13
|
}
|
|
14
|
-
const useSecurityCenterActions = () =>
|
|
14
|
+
const useSecurityCenterActions = () => {
|
|
15
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.securityCenterActions;
|
|
16
|
+
};
|
|
15
17
|
exports.useSecurityCenterActions = useSecurityCenterActions;
|
|
@@ -5,56 +5,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useSecurityPolicyActions = exports.usePublicPolicySettings = exports.usePublicAuthStrategiesPolicySettings = void 0;
|
|
7
7
|
exports.useSecurityPolicyState = useSecurityPolicyState;
|
|
8
|
-
var _reduxStore = require("@frontegg/redux-store");
|
|
9
|
-
var _hooks = require("../hooks");
|
|
10
8
|
var _react = require("react");
|
|
9
|
+
var _FronteggStoreContext = require("../../FronteggStoreContext");
|
|
10
|
+
var _react2 = require("valtio/react");
|
|
11
11
|
const defaultMapper = state => state;
|
|
12
|
+
// @deprecated use useSecurityPolicyState() instead
|
|
12
13
|
function useSecurityPolicyState(stateMapper = defaultMapper) {
|
|
13
|
-
|
|
14
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.securityPolicyState;
|
|
15
|
+
return stateMapper((0, _react2.useSnapshot)(state));
|
|
14
16
|
}
|
|
15
|
-
const useSecurityPolicyActions = () =>
|
|
17
|
+
const useSecurityPolicyActions = () => {
|
|
18
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.securityPolicyActions;
|
|
19
|
+
};
|
|
16
20
|
exports.useSecurityPolicyActions = useSecurityPolicyActions;
|
|
17
21
|
const usePublicPolicySettings = (loadOnMount = false) => {
|
|
18
22
|
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
saving,
|
|
22
|
-
error
|
|
23
|
-
} = useSecurityPolicyState(state => state.publicPolicy);
|
|
23
|
+
publicPolicy
|
|
24
|
+
} = useSecurityPolicyState();
|
|
24
25
|
const {
|
|
25
26
|
loadPublicSecurityPolicy
|
|
26
27
|
} = useSecurityPolicyActions();
|
|
27
28
|
(0, _react.useEffect)(() => {
|
|
28
|
-
(loadOnMount || !policy) && loadPublicSecurityPolicy();
|
|
29
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
+
(loadOnMount || !publicPolicy.policy) && loadPublicSecurityPolicy();
|
|
30
30
|
}, [loadOnMount, loadPublicSecurityPolicy]);
|
|
31
|
-
return
|
|
32
|
-
loading,
|
|
33
|
-
saving,
|
|
34
|
-
error,
|
|
35
|
-
policy
|
|
36
|
-
};
|
|
31
|
+
return publicPolicy;
|
|
37
32
|
};
|
|
38
33
|
exports.usePublicPolicySettings = usePublicPolicySettings;
|
|
39
34
|
const usePublicAuthStrategiesPolicySettings = (loadOnMount = false) => {
|
|
40
35
|
const {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
saving,
|
|
44
|
-
error
|
|
45
|
-
} = useSecurityPolicyState(state => state.publicAuthStrategyPolicy);
|
|
36
|
+
publicAuthStrategyPolicy
|
|
37
|
+
} = useSecurityPolicyState();
|
|
46
38
|
const {
|
|
47
39
|
loadPublicAuthStrategiesPolicy
|
|
48
40
|
} = useSecurityPolicyActions();
|
|
49
41
|
(0, _react.useEffect)(() => {
|
|
50
|
-
(loadOnMount || !policy) && loadPublicAuthStrategiesPolicy();
|
|
51
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
+
(loadOnMount || !publicAuthStrategyPolicy.policy) && loadPublicAuthStrategiesPolicy();
|
|
52
43
|
}, [loadOnMount, loadPublicAuthStrategiesPolicy]);
|
|
53
|
-
return
|
|
54
|
-
loading,
|
|
55
|
-
saving,
|
|
56
|
-
error,
|
|
57
|
-
policy
|
|
58
|
-
};
|
|
44
|
+
return publicAuthStrategyPolicy;
|
|
59
45
|
};
|
|
60
46
|
exports.usePublicAuthStrategiesPolicySettings = usePublicAuthStrategiesPolicySettings;
|
|
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useSessionsPolicyActions = void 0;
|
|
7
7
|
exports.useSessionsPolicyState = useSessionsPolicyState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (0,
|
|
8
|
+
var _FronteggStoreContext = require("../../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
10
|
+
function useSessionsPolicyState() {
|
|
11
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.sessionsPolicyState;
|
|
12
|
+
return (0, _react.useSnapshot)(state);
|
|
13
13
|
}
|
|
14
|
-
const useSessionsPolicyActions = () =>
|
|
14
|
+
const useSessionsPolicyActions = () => {
|
|
15
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.sessionsPolicyActions;
|
|
16
|
+
};
|
|
15
17
|
exports.useSessionsPolicyActions = useSessionsPolicyActions;
|
package/node/auth/sessions.js
CHANGED
|
@@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useSessionsActions = void 0;
|
|
7
7
|
exports.useSessionsState = useSessionsState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (0, _hooks.stateHookGenerator)(stateMapper, 'sessionsState');
|
|
8
|
+
var _react = require("valtio/react");
|
|
9
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
10
|
+
function useSessionsState() {
|
|
11
|
+
return (0, _react.useSnapshot)((0, _FronteggStoreContext.useStore)().store.auth.sessionsState);
|
|
13
12
|
}
|
|
14
|
-
const useSessionsActions = () =>
|
|
13
|
+
const useSessionsActions = () => {
|
|
14
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.sessionsActions;
|
|
15
|
+
};
|
|
15
16
|
exports.useSessionsActions = useSessionsActions;
|
package/node/auth/signup.js
CHANGED
|
@@ -5,11 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useSignUpActions = void 0;
|
|
7
7
|
exports.useSignUpState = useSignUpState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var _react = require("valtio/react");
|
|
9
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
10
10
|
const defaultMapper = state => state;
|
|
11
|
+
// @deprecated use useSignUpState() instead
|
|
11
12
|
function useSignUpState(stateMapper = defaultMapper) {
|
|
12
|
-
|
|
13
|
+
const {
|
|
14
|
+
signUpState
|
|
15
|
+
} = (0, _FronteggStoreContext.useStore)().store.auth;
|
|
16
|
+
return stateMapper((0, _react.useSnapshot)(signUpState));
|
|
13
17
|
}
|
|
14
|
-
const useSignUpActions = () =>
|
|
18
|
+
const useSignUpActions = () => {
|
|
19
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.signUpActions;
|
|
20
|
+
};
|
|
15
21
|
exports.useSignUpActions = useSignUpActions;
|
package/node/auth/sms.js
CHANGED
|
@@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useSmsActions = void 0;
|
|
7
7
|
exports.useSmsState = useSmsState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (0, _hooks.stateHookGenerator)(stateMapper, 'smsState');
|
|
8
|
+
var _react = require("valtio/react");
|
|
9
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
10
|
+
function useSmsState() {
|
|
11
|
+
return (0, _react.useSnapshot)((0, _FronteggStoreContext.useStore)().store.auth.smsState);
|
|
13
12
|
}
|
|
14
|
-
const useSmsActions = () =>
|
|
13
|
+
const useSmsActions = () => {
|
|
14
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.smsActions;
|
|
15
|
+
};
|
|
15
16
|
exports.useSmsActions = useSmsActions;
|
package/node/auth/socialLogin.js
CHANGED
|
@@ -5,11 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useSocialLoginActions = void 0;
|
|
7
7
|
exports.useSocialLoginState = useSocialLoginState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
10
10
|
const defaultMapper = state => state;
|
|
11
|
+
// @deprecated use useSocialLoginState() instead
|
|
11
12
|
function useSocialLoginState(stateMapper = defaultMapper) {
|
|
12
|
-
return (0,
|
|
13
|
+
return stateMapper((0, _react.useSnapshot)((0, _FronteggStoreContext.useStore)().store.auth.socialLoginState));
|
|
13
14
|
}
|
|
14
|
-
const useSocialLoginActions = () =>
|
|
15
|
+
const useSocialLoginActions = () => {
|
|
16
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.socialLoginActions;
|
|
17
|
+
};
|
|
15
18
|
exports.useSocialLoginActions = useSocialLoginActions;
|
package/node/auth/sso.js
CHANGED
|
@@ -5,11 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useSSOActions = void 0;
|
|
7
7
|
exports.useSSOState = useSSOState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var _react = require("valtio/react");
|
|
9
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
10
10
|
const defaultMapper = state => state;
|
|
11
|
+
// @deprecated use useSSOState() instead
|
|
11
12
|
function useSSOState(stateMapper = defaultMapper) {
|
|
12
|
-
return (0,
|
|
13
|
+
return stateMapper((0, _react.useSnapshot)((0, _FronteggStoreContext.useStore)().store.auth.ssoState));
|
|
13
14
|
}
|
|
14
|
-
const useSSOActions = () =>
|
|
15
|
+
const useSSOActions = () => {
|
|
16
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.ssoActions;
|
|
17
|
+
};
|
|
15
18
|
exports.useSSOActions = useSSOActions;
|
|
@@ -6,13 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useStepUpActions = exports.useStepUp = exports.useIsSteppedUp = exports.getMaxAgeFromQueryParam = void 0;
|
|
7
7
|
exports.useStepUpState = useStepUpState;
|
|
8
8
|
var _reduxStore = require("@frontegg/redux-store");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
var _react = require("valtio/react");
|
|
10
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
11
|
+
var _hooks = require("./hooks");
|
|
12
|
+
var _react2 = require("react");
|
|
13
|
+
function useStepUpState() {
|
|
14
|
+
return (0, _react.useSnapshot)((0, _FronteggStoreContext.useStore)().store.auth.stepUpState);
|
|
14
15
|
}
|
|
15
|
-
const useStepUpActions = () =>
|
|
16
|
+
const useStepUpActions = () => {
|
|
17
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.stepUpActions;
|
|
18
|
+
};
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* @returns max age from the query param as a number or null if not exists
|
|
@@ -38,7 +41,7 @@ const useStepUp = () => {
|
|
|
38
41
|
stepUpHostedLogin
|
|
39
42
|
} = useStepUpActions();
|
|
40
43
|
const onRedirectTo = (0, _hooks.useOnRedirectTo)();
|
|
41
|
-
return (0,
|
|
44
|
+
return (0, _react2.useCallback)(options => {
|
|
42
45
|
if (hostedLoginBox) {
|
|
43
46
|
stepUpHostedLogin(options || {});
|
|
44
47
|
return;
|
package/node/auth/team.js
CHANGED
|
@@ -5,11 +5,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useAuthTeamActions = void 0;
|
|
7
7
|
exports.useAuthTeamState = useAuthTeamState;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
exports.useTeamActions = void 0;
|
|
9
|
+
exports.useTeamState = useTeamState;
|
|
10
|
+
var _react = require("valtio/react");
|
|
11
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
12
|
+
function useTeamState() {
|
|
13
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.teamState;
|
|
14
|
+
return (0, _react.useSnapshot)(state);
|
|
15
|
+
}
|
|
16
|
+
const useTeamActions = () => {
|
|
17
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.teamActions;
|
|
18
|
+
};
|
|
19
|
+
exports.useTeamActions = useTeamActions;
|
|
10
20
|
const defaultMapper = state => state;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated use useTeamState instead
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
// @deprecated use useTeamState() instead
|
|
11
26
|
function useAuthTeamState(stateMapper = defaultMapper) {
|
|
12
|
-
return (
|
|
27
|
+
return stateMapper(useTeamState());
|
|
13
28
|
}
|
|
14
|
-
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated use useTeamActions instead
|
|
32
|
+
*/
|
|
33
|
+
const useAuthTeamActions = () => {
|
|
34
|
+
return useTeamActions();
|
|
35
|
+
};
|
|
15
36
|
exports.useAuthTeamActions = useAuthTeamActions;
|
package/node/auth/tenants.js
CHANGED
|
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useTenantsActions = void 0;
|
|
7
7
|
exports.useTenantsState = useTenantsState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (0,
|
|
8
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
10
|
+
function useTenantsState() {
|
|
11
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.tenantsState;
|
|
12
|
+
return (0, _react.useSnapshot)(state);
|
|
13
13
|
}
|
|
14
|
-
const useTenantsActions = () =>
|
|
14
|
+
const useTenantsActions = () => {
|
|
15
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.tenantsActions;
|
|
16
|
+
};
|
|
15
17
|
exports.useTenantsActions = useTenantsActions;
|
|
@@ -88,7 +88,9 @@ const CustomComponentRegister = ({
|
|
|
88
88
|
CustomComponentHolder.set(generatedKey, obj);
|
|
89
89
|
return [generatedKey];
|
|
90
90
|
}
|
|
91
|
-
} catch (e) {
|
|
91
|
+
} catch (e) {
|
|
92
|
+
/* empty */
|
|
93
|
+
}
|
|
92
94
|
}
|
|
93
95
|
if ( /*#__PURE__*/(0, _react.isValidElement)(obj) || (0, _reactIs.isElement)(obj) || obj === null) {
|
|
94
96
|
const generatedKey = `${keyPath}.${key}`;
|
package/node/common/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
14
14
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
15
15
|
var _react = require("react");
|
|
16
16
|
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
17
|
-
var
|
|
17
|
+
var _react2 = require("valtio/react");
|
|
18
18
|
var _CustomComponentHolder = require("./CustomComponentHolder");
|
|
19
19
|
Object.keys(_CustomComponentHolder).forEach(function (key) {
|
|
20
20
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -55,6 +55,6 @@ const useShadowDom = () => {
|
|
|
55
55
|
};
|
|
56
56
|
exports.useShadowDom = useShadowDom;
|
|
57
57
|
const useRootState = () => {
|
|
58
|
-
return (0,
|
|
58
|
+
return (0, _react2.useSnapshot)((0, _FronteggStoreContext.useStore)().store.root);
|
|
59
59
|
};
|
|
60
60
|
exports.useRootState = useRootState;
|
|
@@ -5,16 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useConnectivityActions = void 0;
|
|
7
7
|
exports.useConnectivityState = useConnectivityState;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactRedux = require("react-redux");
|
|
10
8
|
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return (0,
|
|
9
|
+
var _react = require("valtio/react");
|
|
10
|
+
function useConnectivityState() {
|
|
11
|
+
const state = (0, _FronteggStoreContext.useStore)().store.connectivity;
|
|
12
|
+
return (0, _react.useSnapshot)(state);
|
|
15
13
|
}
|
|
16
14
|
const useConnectivityActions = () => {
|
|
17
|
-
|
|
18
|
-
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.connectivityActions, dispatch), [_reduxStore.connectivityActions]);
|
|
15
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.connectivity;
|
|
19
16
|
};
|
|
20
17
|
exports.useConnectivityActions = useConnectivityActions;
|
package/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license Frontegg v6.
|
|
1
|
+
/** @license Frontegg v6.178.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.
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", {
|
|
9
9
|
value: true
|
|
10
10
|
});
|
|
11
|
-
var
|
|
12
|
-
Object.keys(
|
|
11
|
+
var _auth = require("./auth");
|
|
12
|
+
Object.keys(_auth).forEach(function (key) {
|
|
13
13
|
if (key === "default" || key === "__esModule") return;
|
|
14
|
-
if (key in exports && exports[key] ===
|
|
14
|
+
if (key in exports && exports[key] === _auth[key]) return;
|
|
15
15
|
Object.defineProperty(exports, key, {
|
|
16
16
|
enumerable: true,
|
|
17
17
|
get: function () {
|
|
18
|
-
return
|
|
18
|
+
return _auth[key];
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
});
|
|
@@ -30,17 +30,6 @@ Object.keys(_audits).forEach(function (key) {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
|
-
var _auth = require("./auth");
|
|
34
|
-
Object.keys(_auth).forEach(function (key) {
|
|
35
|
-
if (key === "default" || key === "__esModule") return;
|
|
36
|
-
if (key in exports && exports[key] === _auth[key]) return;
|
|
37
|
-
Object.defineProperty(exports, key, {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function () {
|
|
40
|
-
return _auth[key];
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
33
|
var _connectivity = require("./connectivity");
|
|
45
34
|
Object.keys(_connectivity).forEach(function (key) {
|
|
46
35
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -74,6 +63,17 @@ Object.keys(_vendor).forEach(function (key) {
|
|
|
74
63
|
}
|
|
75
64
|
});
|
|
76
65
|
});
|
|
66
|
+
var _common = require("./common");
|
|
67
|
+
Object.keys(_common).forEach(function (key) {
|
|
68
|
+
if (key === "default" || key === "__esModule") return;
|
|
69
|
+
if (key in exports && exports[key] === _common[key]) return;
|
|
70
|
+
Object.defineProperty(exports, key, {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () {
|
|
73
|
+
return _common[key];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
77
|
var _flags = require("./flags");
|
|
78
78
|
Object.keys(_flags).forEach(function (key) {
|
|
79
79
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1,103 +1,136 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.useVendorPublicConfigActions = exports.useVendorPublicConfig = exports.useSubscriptionRenewal = exports.useSubscriptionCancellation = exports.useSubscriptionActions = exports.useSubscription = exports.useStripeState = exports.useStripeActions = exports.usePlansActions = exports.usePlans = exports.usePaymentProviderActions = exports.usePaymentProvider = exports.usePaymentMethodActions = exports.usePaymentMethod = exports.useInvoicesActions = exports.useInvoices = exports.useCheckoutActions = exports.useCheckout = exports.useBillingInformationActions = exports.useBillingInformation = void 0;
|
|
7
|
-
var
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
9
|
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return
|
|
10
|
+
var _react = require("valtio/react");
|
|
11
|
+
function getSubscriptionsState() {
|
|
12
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
13
|
+
return (0, _FronteggStoreContext.useStore)().store.subscriptions;
|
|
13
14
|
}
|
|
14
15
|
const usePaymentProvider = () => {
|
|
15
|
-
|
|
16
|
+
const {
|
|
17
|
+
config
|
|
18
|
+
} = getSubscriptionsState();
|
|
19
|
+
return (0, _react.useSnapshot)(config);
|
|
16
20
|
};
|
|
17
21
|
exports.usePaymentProvider = usePaymentProvider;
|
|
18
22
|
const usePaymentProviderActions = () => {
|
|
19
|
-
|
|
20
|
-
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.config, dispatch), [dispatch]);
|
|
23
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.subscriptions.config;
|
|
21
24
|
};
|
|
22
25
|
exports.usePaymentProviderActions = usePaymentProviderActions;
|
|
23
26
|
const usePlans = () => {
|
|
24
|
-
|
|
27
|
+
const {
|
|
28
|
+
plans
|
|
29
|
+
} = getSubscriptionsState();
|
|
30
|
+
return (0, _react.useSnapshot)(plans);
|
|
25
31
|
};
|
|
26
32
|
exports.usePlans = usePlans;
|
|
27
33
|
const usePlansActions = () => {
|
|
28
|
-
|
|
29
|
-
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.plans, dispatch), [dispatch]);
|
|
34
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.subscriptions.plans;
|
|
30
35
|
};
|
|
31
36
|
exports.usePlansActions = usePlansActions;
|
|
32
37
|
const useCheckout = () => {
|
|
33
|
-
|
|
38
|
+
const {
|
|
39
|
+
checkout
|
|
40
|
+
} = getSubscriptionsState();
|
|
41
|
+
return (0, _react.useSnapshot)(checkout);
|
|
34
42
|
};
|
|
35
43
|
exports.useCheckout = useCheckout;
|
|
36
44
|
const useCheckoutActions = () => {
|
|
37
|
-
|
|
38
|
-
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.checkout, dispatch), [dispatch]);
|
|
45
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.subscriptions.checkout;
|
|
39
46
|
};
|
|
40
47
|
exports.useCheckoutActions = useCheckoutActions;
|
|
41
48
|
const useBillingActions = billingKey => {
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.subscriptions.billing[billingKey];
|
|
50
|
+
};
|
|
51
|
+
const useBillingInformation = () => {
|
|
52
|
+
const {
|
|
53
|
+
billing
|
|
54
|
+
} = getSubscriptionsState();
|
|
55
|
+
return (0, _react.useSnapshot)(billing.information);
|
|
44
56
|
};
|
|
45
|
-
const useBillingInformation = () => (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.information, _reactRedux.shallowEqual);
|
|
46
57
|
exports.useBillingInformation = useBillingInformation;
|
|
47
|
-
const useBillingInformationActions = () =>
|
|
58
|
+
const useBillingInformationActions = () => {
|
|
59
|
+
return useBillingActions('information');
|
|
60
|
+
};
|
|
48
61
|
exports.useBillingInformationActions = useBillingInformationActions;
|
|
49
|
-
const usePaymentMethod = () =>
|
|
62
|
+
const usePaymentMethod = () => {
|
|
63
|
+
const {
|
|
64
|
+
billing
|
|
65
|
+
} = getSubscriptionsState();
|
|
66
|
+
return (0, _react.useSnapshot)(billing.paymentMethod);
|
|
67
|
+
};
|
|
50
68
|
exports.usePaymentMethod = usePaymentMethod;
|
|
51
|
-
const usePaymentMethodActions = () =>
|
|
69
|
+
const usePaymentMethodActions = () => {
|
|
70
|
+
return useBillingActions('paymentMethod');
|
|
71
|
+
};
|
|
52
72
|
exports.usePaymentMethodActions = usePaymentMethodActions;
|
|
53
|
-
const useInvoices = () =>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).stripe, _reactRedux.shallowEqual);
|
|
73
|
+
const useInvoices = () => {
|
|
74
|
+
const {
|
|
75
|
+
billing
|
|
76
|
+
} = getSubscriptionsState();
|
|
77
|
+
return (0, _react.useSnapshot)(billing.invoices);
|
|
59
78
|
};
|
|
60
|
-
exports.
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.stripe, dispatch), [dispatch]);
|
|
79
|
+
exports.useInvoices = useInvoices;
|
|
80
|
+
const useInvoicesActions = () => {
|
|
81
|
+
return useBillingActions('invoices');
|
|
64
82
|
};
|
|
65
|
-
exports.
|
|
83
|
+
exports.useInvoicesActions = useInvoicesActions;
|
|
66
84
|
const useSubscriptionCancellation = () => {
|
|
67
|
-
|
|
85
|
+
const {
|
|
86
|
+
billing
|
|
87
|
+
} = getSubscriptionsState();
|
|
88
|
+
const {
|
|
89
|
+
cancellation
|
|
90
|
+
} = (0, _react.useSnapshot)(billing.subscription);
|
|
91
|
+
return cancellation;
|
|
68
92
|
};
|
|
69
93
|
exports.useSubscriptionCancellation = useSubscriptionCancellation;
|
|
70
94
|
const useSubscriptionRenewal = () => {
|
|
71
|
-
|
|
95
|
+
const {
|
|
96
|
+
billing
|
|
97
|
+
} = getSubscriptionsState();
|
|
98
|
+
const {
|
|
99
|
+
renewal
|
|
100
|
+
} = (0, _react.useSnapshot)(billing.subscription);
|
|
101
|
+
return renewal;
|
|
72
102
|
};
|
|
73
103
|
exports.useSubscriptionRenewal = useSubscriptionRenewal;
|
|
74
104
|
const useSubscription = () => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
} = getSubscriptionState(state);
|
|
81
|
-
return subscription;
|
|
82
|
-
}, _reactRedux.shallowEqual);
|
|
105
|
+
const {
|
|
106
|
+
billing
|
|
107
|
+
} = getSubscriptionsState();
|
|
108
|
+
return (0, _react.useSnapshot)(billing.subscription);
|
|
83
109
|
};
|
|
84
110
|
exports.useSubscription = useSubscription;
|
|
85
111
|
const useSubscriptionActions = () => {
|
|
86
|
-
const
|
|
87
|
-
return (0,
|
|
112
|
+
const actions = (0, _FronteggStoreContext.useStore)().stateActions.subscriptions.billing.subscription;
|
|
113
|
+
return (0, _extends2.default)({}, actions, {
|
|
114
|
+
load: actions.loadSubscription
|
|
115
|
+
});
|
|
88
116
|
};
|
|
89
117
|
exports.useSubscriptionActions = useSubscriptionActions;
|
|
118
|
+
const useStripeState = () => {
|
|
119
|
+
const {
|
|
120
|
+
stripe
|
|
121
|
+
} = getSubscriptionsState();
|
|
122
|
+
return (0, _react.useSnapshot)(stripe);
|
|
123
|
+
};
|
|
124
|
+
exports.useStripeState = useStripeState;
|
|
125
|
+
const useStripeActions = () => {
|
|
126
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.subscriptions.stripe;
|
|
127
|
+
};
|
|
128
|
+
exports.useStripeActions = useStripeActions;
|
|
90
129
|
const useVendorPublicConfig = () => {
|
|
91
|
-
return (0, _FronteggStoreContext.
|
|
92
|
-
const {
|
|
93
|
-
vendorPublicConfig
|
|
94
|
-
} = getSubscriptionState(state);
|
|
95
|
-
return vendorPublicConfig;
|
|
96
|
-
}, _reactRedux.shallowEqual);
|
|
130
|
+
return (0, _react.useSnapshot)((0, _FronteggStoreContext.useStore)().store.subscriptions.vendorPublicConfig);
|
|
97
131
|
};
|
|
98
132
|
exports.useVendorPublicConfig = useVendorPublicConfig;
|
|
99
133
|
const useVendorPublicConfigActions = () => {
|
|
100
|
-
|
|
101
|
-
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.vendorPublicConfig, dispatch), [dispatch]);
|
|
134
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.subscriptions.vendorPublicConfig;
|
|
102
135
|
};
|
|
103
136
|
exports.useVendorPublicConfigActions = useVendorPublicConfigActions;
|
package/node/vendor/hooks.js
CHANGED
|
@@ -5,16 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useVendorActions = void 0;
|
|
7
7
|
exports.useVendorState = useVendorState;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reduxStore = require("@frontegg/redux-store");
|
|
10
|
-
var _reactRedux = require("react-redux");
|
|
11
8
|
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
12
10
|
const defaultMapper = state => state;
|
|
11
|
+
// @deprecated use useVendorState() instead
|
|
13
12
|
function useVendorState(stateMapper = defaultMapper) {
|
|
14
|
-
|
|
13
|
+
const state = (0, _FronteggStoreContext.useStore)().store.vendor;
|
|
14
|
+
return stateMapper((0, _react.useSnapshot)(state));
|
|
15
15
|
}
|
|
16
16
|
const useVendorActions = () => {
|
|
17
|
-
|
|
18
|
-
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.vendorActions, dispatch), [_reduxStore.vendorActions]);
|
|
17
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.vendor;
|
|
19
18
|
};
|
|
20
19
|
exports.useVendorActions = useVendorActions;
|