@frontegg/react-hooks 7.78.0-alpha.1 → 7.78.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/audits/auditLogs.d.ts +3 -2
- package/audits/auditLogs.js +9 -8
- package/audits/auditsMetadata.d.ts +3 -2
- package/audits/auditsMetadata.js +9 -8
- package/audits/hooks.d.ts +9 -2
- package/audits/hooks.js +14 -10
- package/auth/acceptInvitation.d.ts +5 -7
- package/auth/acceptInvitation.js +13 -8
- package/auth/activateAccount.d.ts +5 -11
- package/auth/activateAccount.js +13 -8
- package/auth/allAccounts.d.ts +7 -47
- package/auth/allAccounts.js +20 -12
- package/auth/apiTokens.d.ts +3 -14
- package/auth/apiTokens.js +9 -8
- package/auth/applications.d.ts +3 -22
- package/auth/applications.js +9 -8
- package/auth/customLogin.d.ts +3 -9
- package/auth/customLogin.js +12 -9
- package/auth/entitlements.d.ts +25 -6
- package/auth/entitlements.js +73 -41
- package/auth/forgotPassword.d.ts +3 -12
- package/auth/forgotPassword.js +9 -10
- package/auth/groups.d.ts +5 -32
- package/auth/groups.js +14 -14
- package/auth/impersonate.d.ts +3 -6
- package/auth/impersonate.js +8 -8
- package/auth/login.d.ts +3 -74
- package/auth/login.js +8 -8
- package/auth/passkeys.d.ts +3 -10
- package/auth/passkeys.js +8 -8
- package/auth/passwordRotation.d.ts +3 -4
- package/auth/passwordRotation.js +9 -8
- package/auth/profile.d.ts +3 -19
- package/auth/profile.js +12 -17
- package/auth/provisioning.d.ts +3 -20
- package/auth/provisioning.js +8 -8
- package/auth/resetPhoneNumber.d.ts +3 -8
- package/auth/resetPhoneNumber.js +8 -8
- package/auth/roles.d.ts +3 -14
- package/auth/roles.js +8 -8
- package/auth/security/restrictions.d.ts +3 -21
- package/auth/security/restrictions.js +19 -20
- package/auth/security/securityCenter.d.ts +3 -15
- package/auth/security/securityCenter.js +9 -8
- package/auth/security/securityPolicy.d.ts +5 -35
- package/auth/security/securityPolicy.js +18 -16
- package/auth/security/sessionsPolicy.d.ts +3 -7
- package/auth/security/sessionsPolicy.js +9 -8
- package/auth/sessions.d.ts +3 -12
- package/auth/sessions.js +8 -8
- package/auth/signup.d.ts +5 -10
- package/auth/signup.js +16 -8
- package/auth/sms.d.ts +3 -13
- package/auth/sms.js +8 -8
- package/auth/socialLogin.d.ts +5 -9
- package/auth/socialLogin.js +13 -8
- package/auth/sso.d.ts +6 -31
- package/auth/sso.js +13 -8
- package/auth/stepUp.d.ts +14 -15
- package/auth/stepUp.js +22 -9
- package/auth/team.d.ts +13 -84
- package/auth/team.js +23 -12
- package/auth/tenants.d.ts +3 -9
- package/auth/tenants.js +9 -8
- package/auth/unlockAccount.d.ts +5 -6
- package/auth/unlockAccount.js +10 -8
- package/auth/usernames.d.ts +3 -7
- package/auth/usernames.js +8 -8
- package/auth/usersEmailsPolicyState.d.ts +5 -5
- package/auth/usersEmailsPolicyState.js +10 -8
- package/connectivity/hooks.d.ts +3 -41
- package/connectivity/hooks.js +9 -8
- package/index.js +1 -1
- package/node/audits/auditLogs.js +12 -11
- package/node/audits/auditsMetadata.js +12 -11
- package/node/audits/hooks.js +17 -13
- package/node/auth/acceptInvitation.js +13 -11
- package/node/auth/activateAccount.js +13 -11
- package/node/auth/allAccounts.js +20 -15
- package/node/auth/apiTokens.js +12 -11
- package/node/auth/applications.js +12 -11
- package/node/auth/customLogin.js +15 -11
- package/node/auth/entitlements.js +73 -41
- package/node/auth/forgotPassword.js +12 -13
- 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 +12 -11
- package/node/auth/profile.js +13 -19
- 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 +21 -22
- package/node/auth/security/securityCenter.js +12 -11
- package/node/auth/security/securityPolicy.js +17 -18
- package/node/auth/security/sessionsPolicy.js +12 -11
- package/node/auth/sessions.js +11 -11
- package/node/auth/signup.js +16 -11
- package/node/auth/sms.js +11 -11
- package/node/auth/socialLogin.js +13 -11
- package/node/auth/sso.js +13 -11
- package/node/auth/stepUp.js +24 -11
- package/node/auth/team.js +28 -16
- package/node/auth/tenants.js +12 -11
- package/node/auth/unlockAccount.js +13 -11
- package/node/auth/usernames.js +11 -11
- package/node/auth/usersEmailsPolicyState.js +13 -11
- package/node/connectivity/hooks.js +12 -11
- package/node/index.js +1 -1
- package/node/subscriptions/hooks.js +115 -86
- package/node/vendor/hooks.js +14 -11
- package/package.json +3 -3
- package/subscriptions/hooks.d.ts +22 -48
- package/subscriptions/hooks.js +103 -77
- package/vendor/hooks.d.ts +5 -2
- package/vendor/hooks.js +14 -8
- package/node/useSnapshot/hookFactory.js +0 -32
- package/useSnapshot/hookFactory.d.ts +0 -18
- package/useSnapshot/hookFactory.js +0 -26
|
@@ -1,37 +1,7 @@
|
|
|
1
|
-
import type { SecurityPolicyState } from '@frontegg/redux-store';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
setSecurityPolicyMfaState: (state: Partial<import("@frontegg/redux-store").MfaPolicyState>) => void;
|
|
7
|
-
setSecurityPolicyVendorMfaState: (state: Partial<import("@frontegg/redux-store").MfaPolicyState>) => void;
|
|
8
|
-
setSecurityPolicyLockoutState: (state: Partial<import("@frontegg/redux-store").LockoutPolicyState>) => void;
|
|
9
|
-
setSecurityPolicyVendorLockoutState: (state: Partial<import("@frontegg/redux-store").LockoutPolicyState>) => void;
|
|
10
|
-
setSecurityPolicyCaptchaState: (state: Partial<import("@frontegg/redux-store").CaptchaPolicyState>) => void;
|
|
11
|
-
setSecurityPolicyPasswordHistoryState: (state: Partial<import("@frontegg/redux-store").PasswordHistoryPolicyState>) => void;
|
|
12
|
-
setSecurityPolicyVendorPasswordHistoryState: (state: Partial<import("@frontegg/redux-store").PasswordHistoryPolicyState>) => void;
|
|
13
|
-
setSecurityPolicyPasswordRotationState: (state: Partial<import("@frontegg/redux-store").PasswordRotationPolicyState>) => void;
|
|
14
|
-
resetSecurityPolicyState: () => void;
|
|
15
|
-
setSecurityPolicyPasswordState: (state: Partial<import("@frontegg/redux-store").PasswordPolicyState>) => void;
|
|
16
|
-
setSecurityPolicyAuthStrategyPublicState: (state: Partial<import("@frontegg/redux-store").PublicAuthStrategyPolicyState>) => void;
|
|
17
|
-
loadSecurityPolicy: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
18
|
-
loadGlobalSecurityPolicy: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
19
|
-
loadPublicSecurityPolicy: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
20
|
-
loadVendorPasswordConfig: (payload?: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithRetryConfig<{}>, Partial<import("dist/@frontegg/rest-api").TestConfig>>) => Promise<void>;
|
|
21
|
-
loadSecurityPolicyMfa: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
22
|
-
loadSecurityPolicyVendorMfa: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
23
|
-
loadSecurityPolicyLockout: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
24
|
-
loadSecurityPolicyVendorLockout: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
25
|
-
loadSecurityPolicyCaptcha: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
26
|
-
loadSecurityPolicyPasswordHistory: () => Promise<void>;
|
|
27
|
-
loadSecurityPolicyVendorPasswordHistory: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
28
|
-
loadSecurityPolicyPasswordRotation: () => Promise<void>;
|
|
29
|
-
loadPublicAuthStrategiesPolicy: (payload?: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithRetryConfig<{}>, import("dist/@frontegg/rest-api").IAuthStrategiesConfig>) => Promise<void>;
|
|
30
|
-
saveSecurityPolicyMfa: (payload: import("@frontegg/redux-store").SaveSecurityPolicyMfaPayload) => Promise<void>;
|
|
31
|
-
saveSecurityPolicyLockout: (payload: import("@frontegg/redux-store").SaveSecurityPolicyLockoutPayload) => Promise<void>;
|
|
32
|
-
saveSecurityPolicyPasswordHistory: (payload: import("@frontegg/redux-store").SaveSecurityPolicyPasswordHistoryPayload) => Promise<void>;
|
|
33
|
-
saveSecurityPolicyPasswordRotation: (payload: import("@frontegg/redux-store").SaveSecurityPolicyPasswordRotationPayload) => Promise<void>;
|
|
34
|
-
__getSecurityPolicyPublicStateWithCustomLogin: (securityPolicyPublicState?: import("dist/@frontegg/rest-api").IVendorConfig, retryConfig?: import("@frontegg/redux-store").RetryConfig) => Promise<import("dist/@frontegg/rest-api").IVendorConfig | undefined>;
|
|
35
|
-
};
|
|
1
|
+
import type { SecurityPolicyActions, SecurityPolicyState } from '@frontegg/redux-store';
|
|
2
|
+
export type SecurityPolicyStateMapper<S> = (state: SecurityPolicyState) => S;
|
|
3
|
+
export declare function useSecurityPolicyState(): SecurityPolicyState;
|
|
4
|
+
export declare function useSecurityPolicyState<S>(stateMapper: SecurityPolicyStateMapper<S>): S;
|
|
5
|
+
export declare const useSecurityPolicyActions: () => SecurityPolicyActions;
|
|
36
6
|
export declare const usePublicPolicySettings: (loadOnMount?: boolean) => import("@frontegg/redux-store").PublicPolicyState;
|
|
37
7
|
export declare const usePublicAuthStrategiesPolicySettings: (loadOnMount?: boolean) => import("@frontegg/redux-store").PublicAuthStrategyPolicyState;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { useStore } from '../../FronteggStoreContext';
|
|
3
|
+
import { useSnapshot } from '../../useSnapshot';
|
|
4
|
+
|
|
5
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
6
|
+
|
|
7
|
+
const defaultMapper = state => state;
|
|
8
|
+
// @deprecated use useSecurityPolicyState() instead
|
|
9
|
+
export function useSecurityPolicyState(stateMapper = defaultMapper) {
|
|
10
|
+
const state = useStore().store.auth.securityPolicyState;
|
|
11
|
+
return stateMapper(useSnapshot(state));
|
|
12
|
+
}
|
|
13
|
+
export const useSecurityPolicyActions = () => {
|
|
14
|
+
return useStore().stateActions.auth.securityPolicyActions;
|
|
15
|
+
};
|
|
10
16
|
export const usePublicPolicySettings = (loadOnMount = false) => {
|
|
11
17
|
const {
|
|
12
18
|
publicPolicy
|
|
@@ -15,10 +21,8 @@ export const usePublicPolicySettings = (loadOnMount = false) => {
|
|
|
15
21
|
loadPublicSecurityPolicy
|
|
16
22
|
} = useSecurityPolicyActions();
|
|
17
23
|
useEffect(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
}, [loadOnMount, publicPolicy.policy, publicPolicy.loading, loadPublicSecurityPolicy]);
|
|
24
|
+
(loadOnMount || !publicPolicy.policy) && loadPublicSecurityPolicy();
|
|
25
|
+
}, [loadOnMount, loadPublicSecurityPolicy]);
|
|
22
26
|
return publicPolicy;
|
|
23
27
|
};
|
|
24
28
|
export const usePublicAuthStrategiesPolicySettings = (loadOnMount = false) => {
|
|
@@ -29,9 +33,7 @@ export const usePublicAuthStrategiesPolicySettings = (loadOnMount = false) => {
|
|
|
29
33
|
loadPublicAuthStrategiesPolicy
|
|
30
34
|
} = useSecurityPolicyActions();
|
|
31
35
|
useEffect(() => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}, [loadOnMount, publicAuthStrategyPolicy.policy, publicAuthStrategyPolicy.error, publicAuthStrategyPolicy.loading, loadPublicAuthStrategiesPolicy]);
|
|
36
|
+
(loadOnMount || !publicAuthStrategyPolicy.policy) && !publicAuthStrategyPolicy.error && loadPublicAuthStrategiesPolicy();
|
|
37
|
+
}, [loadOnMount, loadPublicAuthStrategiesPolicy]);
|
|
36
38
|
return publicAuthStrategyPolicy;
|
|
37
39
|
};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { SessionsPolicyState } from '@frontegg/redux-store';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
resetSessionsPolicyState: () => void;
|
|
5
|
-
loadSessionsPolicy: () => Promise<void>;
|
|
6
|
-
createOrUpdateSessionsPolicy: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").ISessionConfigurations>) => Promise<void>;
|
|
7
|
-
};
|
|
1
|
+
import type { SessionsPolicyState, SessionsPolicyActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useSessionsPolicyState(): SessionsPolicyState;
|
|
3
|
+
export declare const useSessionsPolicyActions: () => SessionsPolicyActions;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useStore } from '../../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../../useSnapshot';
|
|
3
|
+
export function useSessionsPolicyState() {
|
|
4
|
+
const state = useStore().store.auth.sessionsPolicyState;
|
|
5
|
+
return useSnapshot(state);
|
|
6
|
+
}
|
|
7
|
+
export const useSessionsPolicyActions = () => {
|
|
8
|
+
return useStore().stateActions.auth.sessionsPolicyActions;
|
|
9
|
+
};
|
package/auth/sessions.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import type { SessionsState } from '@frontegg/redux-store';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
resetSessionsState: () => void;
|
|
5
|
-
loadUserSessions: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
6
|
-
loadCurrentUserSession: () => Promise<void>;
|
|
7
|
-
deleteUserSession: (payload: import("@frontegg/redux-store").WithId) => Promise<void>;
|
|
8
|
-
deleteAllUserSessions: () => Promise<void>;
|
|
9
|
-
revokeUserSessions: (payload: import("@frontegg/redux-store").WithCallback<{
|
|
10
|
-
userId: string;
|
|
11
|
-
}>) => Promise<void>;
|
|
12
|
-
};
|
|
1
|
+
import type { SessionsState, SessionsActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useSessionsState(): SessionsState;
|
|
3
|
+
export declare const useSessionsActions: () => SessionsActions;
|
package/auth/sessions.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { useSnapshot } from '../useSnapshot';
|
|
2
|
+
import { useStore } from '../FronteggStoreContext';
|
|
3
|
+
export function useSessionsState() {
|
|
4
|
+
return useSnapshot(useStore().store.auth.sessionsState);
|
|
5
|
+
}
|
|
6
|
+
export const useSessionsActions = () => {
|
|
7
|
+
return useStore().stateActions.auth.sessionsActions;
|
|
8
|
+
};
|
package/auth/signup.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import type { SignUpState } from '@frontegg/redux-store';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
signUpUser: (_payload: import("@frontegg/redux-store").ISignUpUserPayload) => Promise<void>;
|
|
7
|
-
signUpUserWithPhoneNumber: (_payload: import("@frontegg/redux-store").ISignUpUserPayload) => Promise<void>;
|
|
8
|
-
loadAllowSignUps: (payload?: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithRetryConfig<{}>, import("dist/@frontegg/rest-api").IVendorConfig>) => Promise<void>;
|
|
9
|
-
loadSignUpStrategies: () => Promise<void>;
|
|
10
|
-
};
|
|
1
|
+
import type { SignUpState, SignUpActions } from '@frontegg/redux-store';
|
|
2
|
+
export type SignUpStateMapper<S> = (state: SignUpState) => S;
|
|
3
|
+
export declare function useSignUpState(): SignUpState;
|
|
4
|
+
export declare function useSignUpState<S>(stateMapper: SignUpStateMapper<S>): S;
|
|
5
|
+
export declare const useSignUpActions: () => SignUpActions;
|
package/auth/signup.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useSnapshot } from '../useSnapshot';
|
|
2
|
+
import { useStore } from '../FronteggStoreContext';
|
|
3
|
+
|
|
4
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
5
|
+
|
|
6
|
+
const defaultMapper = state => state;
|
|
7
|
+
// @deprecated use useSignUpState() instead
|
|
8
|
+
export function useSignUpState(stateMapper = defaultMapper) {
|
|
9
|
+
const {
|
|
10
|
+
signUpState
|
|
11
|
+
} = useStore().store.auth;
|
|
12
|
+
return stateMapper(useSnapshot(signUpState));
|
|
13
|
+
}
|
|
14
|
+
export const useSignUpActions = () => {
|
|
15
|
+
return useStore().stateActions.auth.signUpActions;
|
|
16
|
+
};
|
package/auth/sms.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import type { SmsState } from '@frontegg/redux-store';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
resetSmsState: () => void;
|
|
5
|
-
loadPhoneNumbers: () => Promise<void>;
|
|
6
|
-
loadUserOwnPhoneNumbers: () => Promise<void>;
|
|
7
|
-
setUpPhoneNumber: (_payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IUpdatePhoneNumber>) => Promise<void>;
|
|
8
|
-
setUpOwnPhoneNumber: (_payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IUpdatePhoneNumber>) => Promise<void>;
|
|
9
|
-
verifyPhoneNumber: (_payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IVerifyPhoneNumber>) => Promise<void>;
|
|
10
|
-
deletePhoneNumber: (_payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").IPhoneId>) => Promise<void>;
|
|
11
|
-
verifyDeletePhoneNumber: (_payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithPhoneId<import("dist/@frontegg/rest-api").IVerifyPhoneNumber>>) => Promise<void>;
|
|
12
|
-
preVerifyPhoneNumber: (_payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IPreVerifyPhoneNumber>) => Promise<void>;
|
|
13
|
-
};
|
|
1
|
+
import type { SmsActions, SmsState } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useSmsState(): SmsState;
|
|
3
|
+
export declare const useSmsActions: () => SmsActions;
|
package/auth/sms.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
export function useSmsState() {
|
|
4
|
+
return useSnapshot(useStore().store.auth.smsState);
|
|
5
|
+
}
|
|
6
|
+
export const useSmsActions = () => {
|
|
7
|
+
return useStore().stateActions.auth.smsActions;
|
|
8
|
+
};
|
package/auth/socialLogin.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type { SocialLoginState } from '@frontegg/redux-store';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
loadSocialLoginsConfiguration: () => Promise<void>;
|
|
7
|
-
loadSocialLoginsConfigurationV2: (payload?: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithRetryConfig<{}>, SocialLoginState>) => Promise<void>;
|
|
8
|
-
loginViaSocialLogin: (_payload: import("@frontegg/redux-store").ILoginViaSocialLoginPayload) => Promise<void>;
|
|
9
|
-
};
|
|
1
|
+
import type { SocialLoginActions, SocialLoginState } from '@frontegg/redux-store';
|
|
2
|
+
export type SocialLoginStateMapper<S> = (state: SocialLoginState) => S;
|
|
3
|
+
export declare function useSocialLoginState(): SocialLoginState;
|
|
4
|
+
export declare function useSocialLoginState<S>(stateMapper: SocialLoginStateMapper<S>): S;
|
|
5
|
+
export declare const useSocialLoginActions: () => SocialLoginActions;
|
package/auth/socialLogin.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
|
|
4
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
5
|
+
|
|
6
|
+
const defaultMapper = state => state;
|
|
7
|
+
// @deprecated use useSocialLoginState() instead
|
|
8
|
+
export function useSocialLoginState(stateMapper = defaultMapper) {
|
|
9
|
+
return stateMapper(useSnapshot(useStore().store.auth.socialLoginState));
|
|
10
|
+
}
|
|
11
|
+
export const useSocialLoginActions = () => {
|
|
12
|
+
return useStore().stateActions.auth.socialLoginActions;
|
|
13
|
+
};
|
package/auth/sso.d.ts
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
|
-
import type { SSOState } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
saveSSODomain: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SaveSSODomainPayload) => Promise<void>;
|
|
8
|
-
deleteSSODomain: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").ValidateSSODomainPayload) => Promise<void>;
|
|
9
|
-
validateSSODomainV2: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").ValidateSSODomainPayload) => Promise<void>;
|
|
10
|
-
setSSOGroups: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SetSSOGroupsPayload) => Promise<void>;
|
|
11
|
-
updateSSOGroups: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").UpdateSSOGroupsPayload) => Promise<void>;
|
|
12
|
-
setSSODefaultRoles: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").UpdateSSODefaultRolesPayload) => Promise<void>;
|
|
13
|
-
saveSSOConfigurationByMetadata: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SaveSSOConfigurationByMetadataPayload) => Promise<void>;
|
|
14
|
-
updateSSOConfigurationByMetadata: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").UpdateSSOConfigurationByMetadataPayload) => Promise<void>;
|
|
15
|
-
saveSSOConfigurationByUrl: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SaveSSOConfigurationByUrlPayload) => Promise<void>;
|
|
16
|
-
saveSSOConfigurationByData: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SaveSSOConfigurationByDataPayload) => Promise<void>;
|
|
17
|
-
setSSOState: (state: Partial<import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SSOState>) => void;
|
|
18
|
-
resetSSOState: () => void;
|
|
19
|
-
setSSOLoader: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SSOStateIndicator) => void;
|
|
20
|
-
setSSOError: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SSOStateIndicator) => void;
|
|
21
|
-
loadSSOConfigurations: () => Promise<void>;
|
|
22
|
-
saveSSOConfigurations: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SaveSSOConfigurationPayload) => Promise<void>;
|
|
23
|
-
saveSSOConfigurationsFile: (configFile: File[]) => Promise<void>;
|
|
24
|
-
saveSSOConfigurationsFileWithCallback: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SaveSSOConfigurationFilePayload) => Promise<void>;
|
|
25
|
-
validateSSODomain: (payload?: import("dist/@frontegg/redux-store/interfaces").WithCallback) => Promise<void>;
|
|
26
|
-
loadSSOAuthorizationRoles: () => Promise<void>;
|
|
27
|
-
updateSSOAuthorizationRoles: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").UpdateSSOAuthorizationRolesPayload) => Promise<void>;
|
|
28
|
-
deleteSamlGroup: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").DeleteSamlGroupPayload) => Promise<void>;
|
|
29
|
-
createSamlGroup: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").CreateSamlGroupPayload) => Promise<void>;
|
|
30
|
-
oidcPostlogin: (payload: import("dist/@frontegg/rest-api").IOidcPostLogin) => Promise<void>;
|
|
31
|
-
};
|
|
1
|
+
import type { SSOState, SSOActions } from '@frontegg/redux-store';
|
|
2
|
+
type AuthSSOStateMapper<S> = (state: SSOState) => S;
|
|
3
|
+
export declare function useSSOState(): SSOState;
|
|
4
|
+
export declare function useSSOState<S>(stateMapper: AuthSSOStateMapper<S>): S;
|
|
5
|
+
export declare const useSSOActions: () => SSOActions;
|
|
6
|
+
export {};
|
package/auth/sso.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useSnapshot } from '../useSnapshot';
|
|
2
|
+
import { useStore } from '../FronteggStoreContext';
|
|
3
|
+
|
|
4
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
5
|
+
|
|
6
|
+
const defaultMapper = state => state;
|
|
7
|
+
// @deprecated use useSSOState() instead
|
|
8
|
+
export function useSSOState(stateMapper = defaultMapper) {
|
|
9
|
+
return stateMapper(useSnapshot(useStore().store.auth.ssoState));
|
|
10
|
+
}
|
|
11
|
+
export const useSSOActions = () => {
|
|
12
|
+
return useStore().stateActions.auth.ssoActions;
|
|
13
|
+
};
|
package/auth/stepUp.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { StepUpState, StepUpOptions, IsSteppedUpOptions } from '@frontegg/redux-store';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
stepUpWithAuthenticator: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").IStepUpWithAuthenticator>) => Promise<void>;
|
|
8
|
-
preVerifyMFASMSForStepUp: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithDeviceId<import("dist/@frontegg/rest-api").IPreVerifyMFA>>) => Promise<void>;
|
|
9
|
-
verifyMFASMSForStepUp: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithDeviceId<import("dist/@frontegg/rest-api").IVerifyMFASMS>>) => Promise<void>;
|
|
10
|
-
preVerifyMFAWebAuthnForStepUp: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithDeviceId<import("dist/@frontegg/rest-api").IPreVerifyMFA>, import("@frontegg/redux-store").IPreVerifyMFAWebAuthNForLoginResponse>) => Promise<void>;
|
|
11
|
-
verifyMFAWebAuthnForStepUp: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").IVerifyMFAWebAuthnPayload>) => Promise<void>;
|
|
12
|
-
preVerifyMFAEmailCodeForStepUp: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IPreVerifyMFA>) => Promise<void>;
|
|
13
|
-
verifyMFAEmailCodeForStepUp: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IVerifyMFAEmailCode>) => Promise<void>;
|
|
14
|
-
};
|
|
1
|
+
import { StepUpState, StepUpActions, StepUpOptions, IsSteppedUpOptions } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useStepUpState(): StepUpState;
|
|
3
|
+
export declare const useStepUpActions: () => StepUpActions;
|
|
4
|
+
/**
|
|
5
|
+
* @returns max age from the query param as a number or null if not exists
|
|
6
|
+
*/
|
|
15
7
|
export declare const getMaxAgeFromQueryParam: () => number | undefined;
|
|
16
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @returns step up function that redirects to the step up url with the max age param and set the redirect url in the local storage
|
|
10
|
+
*/
|
|
11
|
+
export declare const useStepUp: () => ((options?: StepUpOptions) => void);
|
|
12
|
+
/**
|
|
13
|
+
* @param options.maxAge - max age of step up
|
|
14
|
+
* @returns true when the user is stepped up, false otherwise
|
|
15
|
+
*/
|
|
17
16
|
export declare const useIsSteppedUp: (options?: IsSteppedUpOptions) => boolean;
|
package/auth/stepUp.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { STEP_UP_MAX_AGE_PARAM_NAME, getSearchParam, redirectByStepUpUrl, isSteppedUp } from '@frontegg/redux-store';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
import { useStore } from '../FronteggStoreContext';
|
|
4
4
|
import { useAuth, useAuthRoutes, useAuthUserOrNull, useOnRedirectTo } from './hooks';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
export function useStepUpState() {
|
|
7
|
+
return useSnapshot(useStore().store.auth.stepUpState);
|
|
8
|
+
}
|
|
9
|
+
export const useStepUpActions = () => {
|
|
10
|
+
return useStore().stateActions.auth.stepUpActions;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @returns max age from the query param as a number or null if not exists
|
|
15
|
+
*/
|
|
12
16
|
export const getMaxAgeFromQueryParam = () => {
|
|
13
17
|
const str = getSearchParam(STEP_UP_MAX_AGE_PARAM_NAME);
|
|
14
18
|
return str === undefined ? undefined : +str;
|
|
15
19
|
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @returns step up function that redirects to the step up url with the max age param and set the redirect url in the local storage
|
|
23
|
+
*/
|
|
16
24
|
export const useStepUp = () => {
|
|
17
25
|
const {
|
|
18
26
|
stepUpUrl
|
|
@@ -32,6 +40,11 @@ export const useStepUp = () => {
|
|
|
32
40
|
redirectByStepUpUrl(stepUpUrl, onRedirectTo, options == null ? void 0 : options.maxAge);
|
|
33
41
|
}, [stepUpUrl, onRedirectTo, stepUpHostedLogin, hostedLoginBox]);
|
|
34
42
|
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param options.maxAge - max age of step up
|
|
46
|
+
* @returns true when the user is stepped up, false otherwise
|
|
47
|
+
*/
|
|
35
48
|
export const useIsSteppedUp = (options = {}) => {
|
|
36
49
|
const user = useAuthUserOrNull();
|
|
37
50
|
return isSteppedUp(user, options);
|
package/auth/team.d.ts
CHANGED
|
@@ -1,84 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}>) => Promise<void>;
|
|
15
|
-
deleteUserFromSubTenants: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").RemoveUserFromSubTenantsRequest>) => Promise<void>;
|
|
16
|
-
addUserToSubTenants: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").AddUserToSubTenantsRequest>) => Promise<void>;
|
|
17
|
-
loadRoles: (payload?: import("dist/@frontegg/redux-store/interfaces").WithRetryConfig<import("dist/@frontegg/redux-store/auth/TeamState/interfaces").LoadRolesAndPermissionsPayload>) => Promise<void>;
|
|
18
|
-
loadUsers: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithSilentLoad<import("dist/@frontegg/rest-api").ILoadUsers>, import("dist/@frontegg/rest-api").ITeamUser[]>) => Promise<void>;
|
|
19
|
-
loadUsersV2: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithRetryConfig<import("@frontegg/redux-store").WithSilentLoad<import("@frontegg/redux-store").IGetUsersV2Payload>>, import("dist/@frontegg/rest-api").ITeamUser[]>) => Promise<void>;
|
|
20
|
-
addUser: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").AddUserPayload, import("dist/@frontegg/rest-api").ITeamUser>) => Promise<void>;
|
|
21
|
-
addUsersBulk: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").IAddUsers, import("@frontegg/redux-store").BulkInvintationData>) => Promise<void>;
|
|
22
|
-
updateUser: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IUpdateUser, import("dist/@frontegg/rest-api").ITeamUser>) => Promise<void>;
|
|
23
|
-
deleteUser: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IDeleteUser>) => Promise<void>;
|
|
24
|
-
enableUser: (payload: import("@frontegg/redux-store").WithCallback<{
|
|
25
|
-
userId: string;
|
|
26
|
-
}>) => Promise<void>;
|
|
27
|
-
disableUser: (payload: import("@frontegg/redux-store").WithCallback<{
|
|
28
|
-
userId: string;
|
|
29
|
-
}>) => Promise<void>;
|
|
30
|
-
getTemporaryUsersConfig: (payload?: import("dist/@frontegg/redux-store/interfaces").WithRetryConfig<{}>) => Promise<void>;
|
|
31
|
-
updateUserExpirationTime: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IUpdateUserExpiration>) => Promise<void>;
|
|
32
|
-
setUserAsPermanent: (payload: import("@frontegg/redux-store").WithCallback<Pick<import("dist/@frontegg/rest-api").IUpdateUserExpiration, "userId">>) => Promise<void>;
|
|
33
|
-
setTeamLoader: (payload: import("@frontegg/redux-store").TeamStateIndicator) => void;
|
|
34
|
-
setTeamError: (payload: import("@frontegg/redux-store").TeamStateIndicator) => void;
|
|
35
|
-
setTeamState: (payload: Partial<TeamState>) => void;
|
|
36
|
-
resetTeamState: () => void;
|
|
37
|
-
openAddUserDialog: (payload?: import("@frontegg/redux-store").ISetAddUserDialog) => void;
|
|
38
|
-
closeAddUserDialog: (payload?: any) => void;
|
|
39
|
-
openDeleteUserDialog: (payload?: import("@frontegg/redux-store").ISetDeleteUserDialog) => void;
|
|
40
|
-
closeDeleteUserDialog: (payload?: any) => void;
|
|
41
|
-
lockUser: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IDeleteUser>) => Promise<void>;
|
|
42
|
-
};
|
|
43
|
-
export declare const useAuthTeamState: <S = TeamState>(selector?: (s: TeamState) => S) => S;
|
|
44
|
-
export declare const useAuthTeamActions: () => {
|
|
45
|
-
getInvitationLink: (payload?: import("dist/@frontegg/redux-store/interfaces").WithRetryConfig<{}>) => Promise<void>;
|
|
46
|
-
createInvitationLink: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").ICreateOrUpdateInviteUserLink, string>) => Promise<void>;
|
|
47
|
-
updateInvitationLink: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").ICreateOrUpdateInviteUserLink>) => Promise<void>;
|
|
48
|
-
deleteInvitationLink: (payload?: import("@frontegg/redux-store").WithCallback<{}, boolean>) => Promise<void>;
|
|
49
|
-
resendActivationLink: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IResendActivationLink>) => Promise<void>;
|
|
50
|
-
resendInvitationLink: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IResendInvitationLink>) => Promise<void>;
|
|
51
|
-
resendInvitationEmail: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IResendInvitationEmail>) => Promise<void>;
|
|
52
|
-
resendInvitationLinkToAllSubTenants: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IResendInvitationLink>) => Promise<void>;
|
|
53
|
-
loadAllSubTenantsUsers: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithSilentLoad<Partial<import("dist/@frontegg/rest-api").ILoadAllUsers>>, import("dist/@frontegg/rest-api").ISubTenantUser[]>) => Promise<void>;
|
|
54
|
-
setUserRolesForSubTenants: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").UpdateUserRolesForSubTenantsRequestDto & {
|
|
55
|
-
userId: string;
|
|
56
|
-
}>) => Promise<void>;
|
|
57
|
-
deleteUserFromSubTenants: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").RemoveUserFromSubTenantsRequest>) => Promise<void>;
|
|
58
|
-
addUserToSubTenants: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").AddUserToSubTenantsRequest>) => Promise<void>;
|
|
59
|
-
loadRoles: (payload?: import("dist/@frontegg/redux-store/interfaces").WithRetryConfig<import("dist/@frontegg/redux-store/auth/TeamState/interfaces").LoadRolesAndPermissionsPayload>) => Promise<void>;
|
|
60
|
-
loadUsers: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithSilentLoad<import("dist/@frontegg/rest-api").ILoadUsers>, import("dist/@frontegg/rest-api").ITeamUser[]>) => Promise<void>;
|
|
61
|
-
loadUsersV2: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithRetryConfig<import("@frontegg/redux-store").WithSilentLoad<import("@frontegg/redux-store").IGetUsersV2Payload>>, import("dist/@frontegg/rest-api").ITeamUser[]>) => Promise<void>;
|
|
62
|
-
addUser: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").AddUserPayload, import("dist/@frontegg/rest-api").ITeamUser>) => Promise<void>;
|
|
63
|
-
addUsersBulk: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").IAddUsers, import("@frontegg/redux-store").BulkInvintationData>) => Promise<void>;
|
|
64
|
-
updateUser: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IUpdateUser, import("dist/@frontegg/rest-api").ITeamUser>) => Promise<void>;
|
|
65
|
-
deleteUser: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IDeleteUser>) => Promise<void>;
|
|
66
|
-
enableUser: (payload: import("@frontegg/redux-store").WithCallback<{
|
|
67
|
-
userId: string;
|
|
68
|
-
}>) => Promise<void>;
|
|
69
|
-
disableUser: (payload: import("@frontegg/redux-store").WithCallback<{
|
|
70
|
-
userId: string;
|
|
71
|
-
}>) => Promise<void>;
|
|
72
|
-
getTemporaryUsersConfig: (payload?: import("dist/@frontegg/redux-store/interfaces").WithRetryConfig<{}>) => Promise<void>;
|
|
73
|
-
updateUserExpirationTime: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IUpdateUserExpiration>) => Promise<void>;
|
|
74
|
-
setUserAsPermanent: (payload: import("@frontegg/redux-store").WithCallback<Pick<import("dist/@frontegg/rest-api").IUpdateUserExpiration, "userId">>) => Promise<void>;
|
|
75
|
-
setTeamLoader: (payload: import("@frontegg/redux-store").TeamStateIndicator) => void;
|
|
76
|
-
setTeamError: (payload: import("@frontegg/redux-store").TeamStateIndicator) => void;
|
|
77
|
-
setTeamState: (payload: Partial<TeamState>) => void;
|
|
78
|
-
resetTeamState: () => void;
|
|
79
|
-
openAddUserDialog: (payload?: import("@frontegg/redux-store").ISetAddUserDialog) => void;
|
|
80
|
-
closeAddUserDialog: (payload?: any) => void;
|
|
81
|
-
openDeleteUserDialog: (payload?: import("@frontegg/redux-store").ISetDeleteUserDialog) => void;
|
|
82
|
-
closeDeleteUserDialog: (payload?: any) => void;
|
|
83
|
-
lockUser: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IDeleteUser>) => Promise<void>;
|
|
84
|
-
};
|
|
1
|
+
import { TeamActions, TeamState } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useTeamState(): TeamState;
|
|
3
|
+
export declare const useTeamActions: () => TeamActions;
|
|
4
|
+
export type AuthTeamStateMapper<S> = (state: TeamState) => S;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use useTeamState instead
|
|
7
|
+
*/
|
|
8
|
+
export declare function useAuthTeamState(): TeamState;
|
|
9
|
+
export declare function useAuthTeamState<S>(stateMapper: AuthTeamStateMapper<S>): S;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use useTeamActions instead
|
|
12
|
+
*/
|
|
13
|
+
export declare const useAuthTeamActions: () => TeamActions;
|
package/auth/team.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useSnapshot } from '../useSnapshot';
|
|
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
|
+
};
|
|
10
|
+
const defaultMapper = state => state;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use useTeamState instead
|
|
13
|
+
*/
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
export
|
|
15
|
+
// @deprecated use useTeamState() instead
|
|
16
|
+
export function useAuthTeamState(stateMapper = defaultMapper) {
|
|
17
|
+
return stateMapper(useTeamState());
|
|
18
|
+
}
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated use useTeamActions instead
|
|
22
|
+
*/
|
|
23
|
+
export const useAuthTeamActions = () => {
|
|
24
|
+
return useTeamActions();
|
|
25
|
+
};
|
package/auth/tenants.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import type { TenantsState } from '@frontegg/redux-store';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
resetTenantsState: () => void;
|
|
5
|
-
switchTenant: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").SwitchTenantOptions>) => Promise<void>;
|
|
6
|
-
loadTenants: (payload?: import("@frontegg/redux-store").WithCallback<{}, import("dist/@frontegg/rest-api").ITenantsResponse[]>) => Promise<void>;
|
|
7
|
-
loadSubTenants: (payload?: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithRetryConfig<{}>>) => Promise<void>;
|
|
8
|
-
loadSubTenantsTree: (payload?: import("@frontegg/redux-store").WithCallback<{}>) => Promise<void>;
|
|
9
|
-
};
|
|
1
|
+
import type { TenantsState, TenantsActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useTenantsState(): TenantsState;
|
|
3
|
+
export declare const useTenantsActions: () => TenantsActions;
|