@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
package/auth/resetPhoneNumber.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return stateHookGenerator(stateMapper, 'resetPhoneNumberState');
|
|
1
|
+
import { useSnapshot } from 'valtio/react';
|
|
2
|
+
import { useStore } from '../FronteggStoreContext';
|
|
3
|
+
export function useResetPhoneNumberState() {
|
|
4
|
+
return useSnapshot(useStore().store.auth.resetPhoneNumberState);
|
|
6
5
|
}
|
|
7
|
-
export const useResetPhoneNumberActions = () =>
|
|
6
|
+
export const useResetPhoneNumberActions = () => {
|
|
7
|
+
return useStore().stateActions.auth.resetPhoneNumberActions;
|
|
8
|
+
};
|
package/auth/roles.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { RolesActions, RolesState } from '@frontegg/redux-store';
|
|
2
|
-
export declare type RolesStateMapper<S> = (state: RolesState) => S;
|
|
1
|
+
import type { RolesActions, RolesState } from '@frontegg/redux-store';
|
|
3
2
|
export declare function useRolesState(): RolesState;
|
|
4
|
-
export declare function useRolesState<S>(stateMapper: RolesStateMapper<S>): S;
|
|
5
3
|
export declare const useRolesActions: () => RolesActions;
|
package/auth/roles.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return stateHookGenerator(stateMapper, 'rolesState');
|
|
1
|
+
import { useSnapshot } from 'valtio/react';
|
|
2
|
+
import { useStore } from '../FronteggStoreContext';
|
|
3
|
+
export function useRolesState() {
|
|
4
|
+
return useSnapshot(useStore().store.auth.rolesState);
|
|
6
5
|
}
|
|
7
|
-
export const useRolesActions = () =>
|
|
6
|
+
export const useRolesActions = () => {
|
|
7
|
+
return useStore().stateActions.auth.rolesActions;
|
|
8
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { RestrictionsActions, RestrictionsState } from '@frontegg/redux-store';
|
|
2
|
-
export declare type RestrictionsStateMapper<S> = (state: RestrictionsState) => S;
|
|
3
2
|
export declare function useRestrictionsState(): RestrictionsState;
|
|
4
|
-
export declare function useRestrictionsState<S>(stateMapper: RestrictionsStateMapper<S>): S;
|
|
5
3
|
export declare const useRestrictionsActions: () => RestrictionsActions;
|
|
6
4
|
export declare const useIpRestrictions: (loadOnMount?: boolean) => {
|
|
7
5
|
loading: boolean;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { restrictionsReducers, restrictionsActions } from '@frontegg/redux-store';
|
|
2
1
|
import { useEffect } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export function useRestrictionsState(
|
|
6
|
-
|
|
2
|
+
import { useStore } from '../../FronteggStoreContext';
|
|
3
|
+
import { useSnapshot } from 'valtio/react';
|
|
4
|
+
export function useRestrictionsState() {
|
|
5
|
+
const state = useStore().store.auth.restrictionsState;
|
|
6
|
+
return useSnapshot(state);
|
|
7
7
|
}
|
|
8
|
-
export const useRestrictionsActions = () =>
|
|
8
|
+
export const useRestrictionsActions = () => {
|
|
9
|
+
return useStore().stateActions.auth.restrictionsActions;
|
|
10
|
+
};
|
|
9
11
|
export const useIpRestrictions = (loadOnMount = false) => {
|
|
10
12
|
const {
|
|
11
13
|
loading,
|
|
@@ -15,13 +17,12 @@ export const useIpRestrictions = (loadOnMount = false) => {
|
|
|
15
17
|
pagination,
|
|
16
18
|
totalPages,
|
|
17
19
|
userIpValid
|
|
18
|
-
} = useRestrictionsState(
|
|
20
|
+
} = useRestrictionsState().ipRestrictions;
|
|
19
21
|
const {
|
|
20
22
|
loadIpRestrictions
|
|
21
23
|
} = useRestrictionsActions();
|
|
22
24
|
useEffect(() => {
|
|
23
25
|
(loadOnMount || !data) && loadIpRestrictions();
|
|
24
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
26
|
}, [loadOnMount, loadIpRestrictions]);
|
|
26
27
|
return {
|
|
27
28
|
loading,
|
|
@@ -39,13 +40,12 @@ export const useEmailDomainRestrictions = (loadOnMount = false) => {
|
|
|
39
40
|
data,
|
|
40
41
|
saving,
|
|
41
42
|
error
|
|
42
|
-
} = useRestrictionsState(
|
|
43
|
+
} = useRestrictionsState().emailDomainRestrictions;
|
|
43
44
|
const {
|
|
44
45
|
loadEmailDomainRestrictions
|
|
45
46
|
} = useRestrictionsActions();
|
|
46
47
|
useEffect(() => {
|
|
47
48
|
(loadOnMount || !data) && loadEmailDomainRestrictions();
|
|
48
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
49
|
}, [loadOnMount, loadEmailDomainRestrictions]);
|
|
50
50
|
return {
|
|
51
51
|
loading,
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { SecurityCenterActions, SecurityCenterState } from '@frontegg/redux-store';
|
|
2
|
-
declare type AuthSecurityCenterStateMapper<S> = (state: SecurityCenterState) => S;
|
|
1
|
+
import type { SecurityCenterActions, SecurityCenterState } from '@frontegg/redux-store';
|
|
3
2
|
export declare function useSecurityCenterState(): SecurityCenterState;
|
|
4
|
-
export declare function useSecurityCenterState<S>(stateMapper: AuthSecurityCenterStateMapper<S>): S;
|
|
5
3
|
export declare const useSecurityCenterActions: () => SecurityCenterActions;
|
|
6
|
-
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return
|
|
1
|
+
import { useStore } from '../../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from 'valtio/react';
|
|
3
|
+
export function useSecurityCenterState() {
|
|
4
|
+
const state = useStore().store.auth.securityCenterState;
|
|
5
|
+
return useSnapshot(state);
|
|
6
6
|
}
|
|
7
|
-
export const useSecurityCenterActions = () =>
|
|
7
|
+
export const useSecurityCenterActions = () => {
|
|
8
|
+
return useStore().stateActions.auth.securityCenterActions;
|
|
9
|
+
};
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { SecurityPolicyActions, SecurityPolicyState } from '@frontegg/redux-store';
|
|
1
|
+
import type { SecurityPolicyActions, SecurityPolicyState } from '@frontegg/redux-store';
|
|
2
2
|
export declare type SecurityPolicyStateMapper<S> = (state: SecurityPolicyState) => S;
|
|
3
3
|
export declare function useSecurityPolicyState(): SecurityPolicyState;
|
|
4
4
|
export declare function useSecurityPolicyState<S>(stateMapper: SecurityPolicyStateMapper<S>): S;
|
|
5
5
|
export declare const useSecurityPolicyActions: () => SecurityPolicyActions;
|
|
6
|
-
export declare const usePublicPolicySettings: (loadOnMount?: boolean) => {
|
|
7
|
-
|
|
8
|
-
saving: boolean | undefined;
|
|
9
|
-
error: any;
|
|
10
|
-
policy: import("@frontegg/rest-api").IVendorConfig | undefined;
|
|
6
|
+
export declare const usePublicPolicySettings: (loadOnMount?: boolean) => import("@frontegg/redux-store").WithStatus & {
|
|
7
|
+
policy?: import("@frontegg/rest-api").IVendorConfig | undefined;
|
|
11
8
|
};
|
|
12
|
-
export declare const usePublicAuthStrategiesPolicySettings: (loadOnMount?: boolean) => {
|
|
13
|
-
|
|
14
|
-
saving: boolean | undefined;
|
|
15
|
-
error: any;
|
|
16
|
-
policy: import("@frontegg/rest-api").IAuthStrategiesConfig | undefined;
|
|
9
|
+
export declare const usePublicAuthStrategiesPolicySettings: (loadOnMount?: boolean) => import("@frontegg/redux-store").WithStatus & {
|
|
10
|
+
policy?: import("@frontegg/rest-api").IAuthStrategiesConfig | undefined;
|
|
17
11
|
};
|
|
@@ -1,50 +1,39 @@
|
|
|
1
|
-
import { securityPolicyActions, securityPolicyReducers } from '@frontegg/redux-store';
|
|
2
|
-
import { reducerActionsGenerator, stateHookGenerator } from '../hooks';
|
|
3
1
|
import { useEffect } from 'react';
|
|
2
|
+
import { useStore } from '../../FronteggStoreContext';
|
|
3
|
+
import { useSnapshot } from 'valtio/react';
|
|
4
|
+
|
|
5
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
6
|
+
|
|
4
7
|
const defaultMapper = state => state;
|
|
8
|
+
// @deprecated use useSecurityPolicyState() instead
|
|
5
9
|
export function useSecurityPolicyState(stateMapper = defaultMapper) {
|
|
6
|
-
|
|
10
|
+
const state = useStore().store.auth.securityPolicyState;
|
|
11
|
+
return stateMapper(useSnapshot(state));
|
|
7
12
|
}
|
|
8
|
-
export const useSecurityPolicyActions = () =>
|
|
13
|
+
export const useSecurityPolicyActions = () => {
|
|
14
|
+
return useStore().stateActions.auth.securityPolicyActions;
|
|
15
|
+
};
|
|
9
16
|
export const usePublicPolicySettings = (loadOnMount = false) => {
|
|
10
17
|
const {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
saving,
|
|
14
|
-
error
|
|
15
|
-
} = useSecurityPolicyState(state => state.publicPolicy);
|
|
18
|
+
publicPolicy
|
|
19
|
+
} = useSecurityPolicyState();
|
|
16
20
|
const {
|
|
17
21
|
loadPublicSecurityPolicy
|
|
18
22
|
} = useSecurityPolicyActions();
|
|
19
23
|
useEffect(() => {
|
|
20
|
-
(loadOnMount || !policy) && loadPublicSecurityPolicy();
|
|
21
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
|
+
(loadOnMount || !publicPolicy.policy) && loadPublicSecurityPolicy();
|
|
22
25
|
}, [loadOnMount, loadPublicSecurityPolicy]);
|
|
23
|
-
return
|
|
24
|
-
loading,
|
|
25
|
-
saving,
|
|
26
|
-
error,
|
|
27
|
-
policy
|
|
28
|
-
};
|
|
26
|
+
return publicPolicy;
|
|
29
27
|
};
|
|
30
28
|
export const usePublicAuthStrategiesPolicySettings = (loadOnMount = false) => {
|
|
31
29
|
const {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
saving,
|
|
35
|
-
error
|
|
36
|
-
} = useSecurityPolicyState(state => state.publicAuthStrategyPolicy);
|
|
30
|
+
publicAuthStrategyPolicy
|
|
31
|
+
} = useSecurityPolicyState();
|
|
37
32
|
const {
|
|
38
33
|
loadPublicAuthStrategiesPolicy
|
|
39
34
|
} = useSecurityPolicyActions();
|
|
40
35
|
useEffect(() => {
|
|
41
|
-
(loadOnMount || !policy) && loadPublicAuthStrategiesPolicy();
|
|
42
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
|
+
(loadOnMount || !publicAuthStrategyPolicy.policy) && loadPublicAuthStrategiesPolicy();
|
|
43
37
|
}, [loadOnMount, loadPublicAuthStrategiesPolicy]);
|
|
44
|
-
return
|
|
45
|
-
loading,
|
|
46
|
-
saving,
|
|
47
|
-
error,
|
|
48
|
-
policy
|
|
49
|
-
};
|
|
38
|
+
return publicAuthStrategyPolicy;
|
|
50
39
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { SessionsPolicyState, SessionsPolicyActions } from '@frontegg/redux-store';
|
|
2
|
-
export declare type SessionsPolicyStateMapper<S> = (state: SessionsPolicyState) => S;
|
|
1
|
+
import type { SessionsPolicyState, SessionsPolicyActions } from '@frontegg/redux-store';
|
|
3
2
|
export declare function useSessionsPolicyState(): SessionsPolicyState;
|
|
4
|
-
export declare function useSessionsPolicyState<S>(stateMapper: SessionsPolicyStateMapper<S>): S;
|
|
5
3
|
export declare const useSessionsPolicyActions: () => SessionsPolicyActions;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return
|
|
1
|
+
import { useStore } from '../../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from 'valtio/react';
|
|
3
|
+
export function useSessionsPolicyState() {
|
|
4
|
+
const state = useStore().store.auth.sessionsPolicyState;
|
|
5
|
+
return useSnapshot(state);
|
|
6
6
|
}
|
|
7
|
-
export const useSessionsPolicyActions = () =>
|
|
7
|
+
export const useSessionsPolicyActions = () => {
|
|
8
|
+
return useStore().stateActions.auth.sessionsPolicyActions;
|
|
9
|
+
};
|
package/auth/sessions.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { SessionsState, SessionsActions } from '@frontegg/redux-store';
|
|
2
|
-
export declare type SessionsStateMapper<S> = (state: SessionsState) => S;
|
|
1
|
+
import type { SessionsState, SessionsActions } from '@frontegg/redux-store';
|
|
3
2
|
export declare function useSessionsState(): SessionsState;
|
|
4
|
-
export declare function useSessionsState<S>(stateMapper: SessionsStateMapper<S>): S;
|
|
5
3
|
export declare const useSessionsActions: () => SessionsActions;
|
package/auth/sessions.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return stateHookGenerator(stateMapper, 'sessionsState');
|
|
1
|
+
import { useSnapshot } from 'valtio/react';
|
|
2
|
+
import { useStore } from '../FronteggStoreContext';
|
|
3
|
+
export function useSessionsState() {
|
|
4
|
+
return useSnapshot(useStore().store.auth.sessionsState);
|
|
6
5
|
}
|
|
7
|
-
export const useSessionsActions = () =>
|
|
6
|
+
export const useSessionsActions = () => {
|
|
7
|
+
return useStore().stateActions.auth.sessionsActions;
|
|
8
|
+
};
|
package/auth/signup.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SignUpState, SignUpActions } from '@frontegg/redux-store';
|
|
1
|
+
import type { SignUpState, SignUpActions } from '@frontegg/redux-store';
|
|
2
2
|
export declare type SignUpStateMapper<S> = (state: SignUpState) => S;
|
|
3
3
|
export declare function useSignUpState(): SignUpState;
|
|
4
4
|
export declare function useSignUpState<S>(stateMapper: SignUpStateMapper<S>): S;
|
package/auth/signup.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useSnapshot } from 'valtio/react';
|
|
2
|
+
import { useStore } from '../FronteggStoreContext';
|
|
3
|
+
|
|
4
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
5
|
+
|
|
3
6
|
const defaultMapper = state => state;
|
|
7
|
+
// @deprecated use useSignUpState() instead
|
|
4
8
|
export function useSignUpState(stateMapper = defaultMapper) {
|
|
5
|
-
|
|
9
|
+
const {
|
|
10
|
+
signUpState
|
|
11
|
+
} = useStore().store.auth;
|
|
12
|
+
return stateMapper(useSnapshot(signUpState));
|
|
6
13
|
}
|
|
7
|
-
export const useSignUpActions = () =>
|
|
14
|
+
export const useSignUpActions = () => {
|
|
15
|
+
return useStore().stateActions.auth.signUpActions;
|
|
16
|
+
};
|
package/auth/sms.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { SmsActions, SmsState } from '@frontegg/redux-store';
|
|
2
|
-
declare type AuthSmsStateMapper<S> = (state: SmsState) => S;
|
|
1
|
+
import type { SmsActions, SmsState } from '@frontegg/redux-store';
|
|
3
2
|
export declare function useSmsState(): SmsState;
|
|
4
|
-
export declare function useSmsState<S>(stateMapper: AuthSmsStateMapper<S>): S;
|
|
5
3
|
export declare const useSmsActions: () => SmsActions;
|
|
6
|
-
export {};
|
package/auth/sms.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return stateHookGenerator(stateMapper, 'smsState');
|
|
1
|
+
import { useSnapshot } from 'valtio/react';
|
|
2
|
+
import { useStore } from '../FronteggStoreContext';
|
|
3
|
+
export function useSmsState() {
|
|
4
|
+
return useSnapshot(useStore().store.auth.smsState);
|
|
6
5
|
}
|
|
7
|
-
export const useSmsActions = () =>
|
|
6
|
+
export const useSmsActions = () => {
|
|
7
|
+
return useStore().stateActions.auth.smsActions;
|
|
8
|
+
};
|
package/auth/socialLogin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SocialLoginActions, SocialLoginState } from '@frontegg/redux-store';
|
|
1
|
+
import type { SocialLoginActions, SocialLoginState } from '@frontegg/redux-store';
|
|
2
2
|
export declare type SocialLoginStateMapper<S> = (state: SocialLoginState) => S;
|
|
3
3
|
export declare function useSocialLoginState(): SocialLoginState;
|
|
4
4
|
export declare function useSocialLoginState<S>(stateMapper: SocialLoginStateMapper<S>): S;
|
package/auth/socialLogin.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from 'valtio/react';
|
|
3
|
+
|
|
4
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
5
|
+
|
|
3
6
|
const defaultMapper = state => state;
|
|
7
|
+
// @deprecated use useSocialLoginState() instead
|
|
4
8
|
export function useSocialLoginState(stateMapper = defaultMapper) {
|
|
5
|
-
return
|
|
9
|
+
return stateMapper(useSnapshot(useStore().store.auth.socialLoginState));
|
|
6
10
|
}
|
|
7
|
-
export const useSocialLoginActions = () =>
|
|
11
|
+
export const useSocialLoginActions = () => {
|
|
12
|
+
return useStore().stateActions.auth.socialLoginActions;
|
|
13
|
+
};
|
package/auth/sso.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SSOState, SSOActions } from '@frontegg/redux-store';
|
|
1
|
+
import type { SSOState, SSOActions } from '@frontegg/redux-store';
|
|
2
2
|
declare type AuthSSOStateMapper<S> = (state: SSOState) => S;
|
|
3
3
|
export declare function useSSOState(): SSOState;
|
|
4
4
|
export declare function useSSOState<S>(stateMapper: AuthSSOStateMapper<S>): S;
|
package/auth/sso.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useSnapshot } from 'valtio/react';
|
|
2
|
+
import { useStore } from '../FronteggStoreContext';
|
|
3
|
+
|
|
4
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
5
|
+
|
|
3
6
|
const defaultMapper = state => state;
|
|
7
|
+
// @deprecated use useSSOState() instead
|
|
4
8
|
export function useSSOState(stateMapper = defaultMapper) {
|
|
5
|
-
return
|
|
9
|
+
return stateMapper(useSnapshot(useStore().store.auth.ssoState));
|
|
6
10
|
}
|
|
7
|
-
export const useSSOActions = () =>
|
|
11
|
+
export const useSSOActions = () => {
|
|
12
|
+
return useStore().stateActions.auth.ssoActions;
|
|
13
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { StepUpState, StepUpActions, IsSteppedUpOptions } from '@frontegg/redux-store';
|
|
2
|
-
import { StepUpStateMapper } from './interfaces';
|
|
3
2
|
export declare function useStepUpState(): StepUpState;
|
|
4
|
-
export declare function useStepUpState<S>(stateMapper: StepUpStateMapper<S>): S;
|
|
5
3
|
export declare const useStepUpActions: () => StepUpActions;
|
|
6
4
|
/**
|
|
7
5
|
* @returns max age from the query param as a number or null if not exists
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { STEP_UP_MAX_AGE_PARAM_NAME, getSearchParam, redirectByStepUpUrl, isSteppedUp } from '@frontegg/redux-store';
|
|
2
|
+
import { useSnapshot } from 'valtio/react';
|
|
3
|
+
import { useStore } from '../FronteggStoreContext';
|
|
4
|
+
import { useAuth, useAuthRoutes, useAuthUserOrNull, useOnRedirectTo } from './hooks';
|
|
3
5
|
import { useCallback } from 'react';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return stateHookGenerator(stateMapper, 'stepUpState');
|
|
6
|
+
export function useStepUpState() {
|
|
7
|
+
return useSnapshot(useStore().store.auth.stepUpState);
|
|
7
8
|
}
|
|
8
|
-
export const useStepUpActions = () =>
|
|
9
|
+
export const useStepUpActions = () => {
|
|
10
|
+
return useStore().stateActions.auth.stepUpActions;
|
|
11
|
+
};
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* @returns max age from the query param as a number or null if not exists
|
package/auth/team.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TeamActions, TeamState } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useTeamState(): TeamState;
|
|
3
|
+
export declare const useTeamActions: () => TeamActions;
|
|
2
4
|
export declare type AuthTeamStateMapper<S> = (state: TeamState) => S;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use useTeamState instead
|
|
7
|
+
*/
|
|
3
8
|
export declare function useAuthTeamState(): TeamState;
|
|
4
9
|
export declare function useAuthTeamState<S>(stateMapper: AuthTeamStateMapper<S>): S;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use useTeamActions instead
|
|
12
|
+
*/
|
|
5
13
|
export declare const useAuthTeamActions: () => TeamActions;
|
package/auth/team.js
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useSnapshot } from 'valtio/react';
|
|
2
|
+
import { useStore } from '../FronteggStoreContext';
|
|
3
|
+
export function useTeamState() {
|
|
4
|
+
const state = useStore().store.auth.teamState;
|
|
5
|
+
return useSnapshot(state);
|
|
6
|
+
}
|
|
7
|
+
export const useTeamActions = () => {
|
|
8
|
+
return useStore().stateActions.auth.teamActions;
|
|
9
|
+
};
|
|
3
10
|
const defaultMapper = state => state;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use useTeamState instead
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// @deprecated use useTeamState() instead
|
|
4
16
|
export function useAuthTeamState(stateMapper = defaultMapper) {
|
|
5
|
-
return
|
|
17
|
+
return stateMapper(useTeamState());
|
|
6
18
|
}
|
|
7
|
-
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated use useTeamActions instead
|
|
22
|
+
*/
|
|
23
|
+
export const useAuthTeamActions = () => {
|
|
24
|
+
return useTeamActions();
|
|
25
|
+
};
|
package/auth/tenants.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { TenantsState, TenantsActions } from '@frontegg/redux-store';
|
|
2
|
-
export declare type TenantsStateMapper<S> = (state: TenantsState) => S;
|
|
1
|
+
import type { TenantsState, TenantsActions } from '@frontegg/redux-store';
|
|
3
2
|
export declare function useTenantsState(): TenantsState;
|
|
4
|
-
export declare function useTenantsState<S>(stateMapper: TenantsStateMapper<S>): S;
|
|
5
3
|
export declare const useTenantsActions: () => TenantsActions;
|
package/auth/tenants.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from 'valtio/react';
|
|
3
|
+
export function useTenantsState() {
|
|
4
|
+
const state = useStore().store.auth.tenantsState;
|
|
5
|
+
return useSnapshot(state);
|
|
6
6
|
}
|
|
7
|
-
export const useTenantsActions = () =>
|
|
7
|
+
export const useTenantsActions = () => {
|
|
8
|
+
return useStore().stateActions.auth.tenantsActions;
|
|
9
|
+
};
|
|
@@ -80,7 +80,9 @@ export const CustomComponentRegister = ({
|
|
|
80
80
|
CustomComponentHolder.set(generatedKey, obj);
|
|
81
81
|
return [generatedKey];
|
|
82
82
|
}
|
|
83
|
-
} catch (e) {
|
|
83
|
+
} catch (e) {
|
|
84
|
+
/* empty */
|
|
85
|
+
}
|
|
84
86
|
}
|
|
85
87
|
if ( /*#__PURE__*/isValidElement(obj) || isElement(obj) || obj === null) {
|
|
86
88
|
const generatedKey = `${keyPath}.${key}`;
|
package/common/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["urlStrategy", "onRedirectTo", "renderByRoute", "customLoader", "customStyles", "contextOptions"];
|
|
4
4
|
import { createContext, useContext } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useStore } from '../FronteggStoreContext';
|
|
6
|
+
import { useSnapshot } from 'valtio/react';
|
|
7
7
|
export const ShadowDomContext = /*#__PURE__*/createContext({});
|
|
8
8
|
export const useShadowDom = () => {
|
|
9
9
|
const context = useContext(ShadowDomContext);
|
|
@@ -29,6 +29,6 @@ export const useShadowDom = () => {
|
|
|
29
29
|
}, rest);
|
|
30
30
|
};
|
|
31
31
|
export const useRootState = () => {
|
|
32
|
-
return
|
|
32
|
+
return useSnapshot(useStore().store.root);
|
|
33
33
|
};
|
|
34
34
|
export * from './CustomComponentHolder';
|
package/connectivity/hooks.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
3
|
-
export declare type StateHookFunction<T> = (() => T) & (<S extends object>(mapper: (state: T) => S) => S);
|
|
4
|
-
export declare function useConnectivityState(): IConnectivityState;
|
|
5
|
-
export declare function useConnectivityState<S>(stateMapper: ConnectivityStateMapper<S>): S;
|
|
1
|
+
import { ConnectivityState, ConnectivityActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useConnectivityState(): ConnectivityState;
|
|
6
3
|
export declare const useConnectivityActions: () => ConnectivityActions;
|
package/connectivity/hooks.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function useConnectivityState(stateMapper = defaultMapper) {
|
|
7
|
-
return useSelector(state => stateMapper(state[connectivityStoreName]), shallowEqual);
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from 'valtio/react';
|
|
3
|
+
export function useConnectivityState() {
|
|
4
|
+
const state = useStore().store.connectivity;
|
|
5
|
+
return useSnapshot(state);
|
|
8
6
|
}
|
|
9
7
|
export const useConnectivityActions = () => {
|
|
10
|
-
|
|
11
|
-
return useMemo(() => bindActionCreators(connectivityActions, dispatch), [connectivityActions]);
|
|
8
|
+
return useStore().stateActions.connectivity;
|
|
12
9
|
};
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from './common';
|
|
2
|
-
export * from './audits';
|
|
3
1
|
export * from './auth';
|
|
2
|
+
export * from './audits';
|
|
4
3
|
export * from './connectivity';
|
|
5
4
|
export * from './subscriptions';
|
|
6
5
|
export * from './vendor';
|
|
6
|
+
export * from './common';
|
|
7
7
|
export * from './flags';
|
|
8
8
|
export * from './FronteggProvider';
|
|
9
9
|
export * from './FronteggStoreContext';
|
package/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.
|
|
5
5
|
*/
|
|
6
|
-
export * from './common';
|
|
7
|
-
export * from './audits';
|
|
8
6
|
export * from './auth';
|
|
7
|
+
export * from './audits';
|
|
9
8
|
export * from './connectivity';
|
|
10
9
|
export * from './subscriptions';
|
|
11
10
|
export * from './vendor';
|
|
11
|
+
export * from './common';
|
|
12
12
|
export * from './flags';
|
|
13
13
|
export * from './FronteggProvider';
|
|
14
14
|
export * from './FronteggStoreContext';
|