@frontegg/react-hooks 7.77.0 → 7.78.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/audits/auditLogs.d.ts +2 -3
  2. package/audits/auditLogs.js +8 -9
  3. package/audits/auditsMetadata.d.ts +2 -3
  4. package/audits/auditsMetadata.js +8 -9
  5. package/audits/hooks.d.ts +2 -9
  6. package/audits/hooks.js +10 -14
  7. package/auth/acceptInvitation.d.ts +7 -5
  8. package/auth/acceptInvitation.js +8 -13
  9. package/auth/activateAccount.d.ts +11 -5
  10. package/auth/activateAccount.js +8 -13
  11. package/auth/allAccounts.d.ts +47 -7
  12. package/auth/allAccounts.js +12 -20
  13. package/auth/apiTokens.d.ts +14 -3
  14. package/auth/apiTokens.js +8 -9
  15. package/auth/applications.d.ts +22 -3
  16. package/auth/applications.js +8 -9
  17. package/auth/customLogin.d.ts +9 -3
  18. package/auth/customLogin.js +9 -12
  19. package/auth/entitlements.d.ts +6 -25
  20. package/auth/entitlements.js +41 -73
  21. package/auth/forgotPassword.d.ts +12 -3
  22. package/auth/forgotPassword.js +10 -9
  23. package/auth/groups.d.ts +32 -5
  24. package/auth/groups.js +14 -14
  25. package/auth/impersonate.d.ts +6 -3
  26. package/auth/impersonate.js +8 -8
  27. package/auth/login.d.ts +74 -3
  28. package/auth/login.js +8 -8
  29. package/auth/passkeys.d.ts +10 -3
  30. package/auth/passkeys.js +8 -8
  31. package/auth/passwordRotation.d.ts +4 -3
  32. package/auth/passwordRotation.js +8 -9
  33. package/auth/profile.d.ts +19 -3
  34. package/auth/profile.js +17 -12
  35. package/auth/provisioning.d.ts +20 -3
  36. package/auth/provisioning.js +8 -8
  37. package/auth/resetPhoneNumber.d.ts +8 -3
  38. package/auth/resetPhoneNumber.js +8 -8
  39. package/auth/roles.d.ts +14 -3
  40. package/auth/roles.js +8 -8
  41. package/auth/security/restrictions.d.ts +21 -3
  42. package/auth/security/restrictions.js +20 -19
  43. package/auth/security/securityCenter.d.ts +15 -3
  44. package/auth/security/securityCenter.js +8 -9
  45. package/auth/security/securityPolicy.d.ts +35 -5
  46. package/auth/security/securityPolicy.js +16 -18
  47. package/auth/security/sessionsPolicy.d.ts +7 -3
  48. package/auth/security/sessionsPolicy.js +8 -9
  49. package/auth/sessions.d.ts +12 -3
  50. package/auth/sessions.js +8 -8
  51. package/auth/signup.d.ts +10 -5
  52. package/auth/signup.js +8 -16
  53. package/auth/sms.d.ts +13 -3
  54. package/auth/sms.js +8 -8
  55. package/auth/socialLogin.d.ts +9 -5
  56. package/auth/socialLogin.js +8 -13
  57. package/auth/sso.d.ts +31 -6
  58. package/auth/sso.js +8 -13
  59. package/auth/stepUp.d.ts +15 -14
  60. package/auth/stepUp.js +9 -22
  61. package/auth/team.d.ts +84 -13
  62. package/auth/team.js +12 -23
  63. package/auth/tenants.d.ts +9 -3
  64. package/auth/tenants.js +8 -9
  65. package/auth/unlockAccount.d.ts +6 -5
  66. package/auth/unlockAccount.js +8 -10
  67. package/auth/usernames.d.ts +7 -3
  68. package/auth/usernames.js +8 -8
  69. package/auth/usersEmailsPolicyState.d.ts +5 -5
  70. package/auth/usersEmailsPolicyState.js +8 -10
  71. package/connectivity/hooks.d.ts +41 -3
  72. package/connectivity/hooks.js +8 -9
  73. package/index.js +1 -1
  74. package/node/audits/auditLogs.js +11 -12
  75. package/node/audits/auditsMetadata.js +11 -12
  76. package/node/audits/hooks.js +13 -17
  77. package/node/auth/acceptInvitation.js +11 -13
  78. package/node/auth/activateAccount.js +11 -13
  79. package/node/auth/allAccounts.js +15 -20
  80. package/node/auth/apiTokens.js +11 -12
  81. package/node/auth/applications.js +11 -12
  82. package/node/auth/customLogin.js +11 -15
  83. package/node/auth/entitlements.js +41 -73
  84. package/node/auth/forgotPassword.js +13 -12
  85. package/node/auth/groups.js +17 -17
  86. package/node/auth/impersonate.js +11 -11
  87. package/node/auth/login.js +11 -11
  88. package/node/auth/passkeys.js +11 -11
  89. package/node/auth/passwordRotation.js +11 -12
  90. package/node/auth/profile.js +19 -13
  91. package/node/auth/provisioning.js +11 -11
  92. package/node/auth/resetPhoneNumber.js +11 -11
  93. package/node/auth/roles.js +11 -11
  94. package/node/auth/security/restrictions.js +22 -21
  95. package/node/auth/security/securityCenter.js +11 -12
  96. package/node/auth/security/securityPolicy.js +18 -17
  97. package/node/auth/security/sessionsPolicy.js +11 -12
  98. package/node/auth/sessions.js +11 -11
  99. package/node/auth/signup.js +11 -16
  100. package/node/auth/sms.js +11 -11
  101. package/node/auth/socialLogin.js +11 -13
  102. package/node/auth/sso.js +11 -13
  103. package/node/auth/stepUp.js +11 -24
  104. package/node/auth/team.js +16 -28
  105. package/node/auth/tenants.js +11 -12
  106. package/node/auth/unlockAccount.js +11 -13
  107. package/node/auth/usernames.js +11 -11
  108. package/node/auth/usersEmailsPolicyState.js +11 -13
  109. package/node/connectivity/hooks.js +11 -12
  110. package/node/index.js +1 -1
  111. package/node/subscriptions/hooks.js +86 -115
  112. package/node/useSnapshot/hookFactory.js +32 -0
  113. package/node/vendor/hooks.js +11 -14
  114. package/package.json +3 -3
  115. package/subscriptions/hooks.d.ts +48 -22
  116. package/subscriptions/hooks.js +77 -103
  117. package/useSnapshot/hookFactory.d.ts +18 -0
  118. package/useSnapshot/hookFactory.js +26 -0
  119. package/vendor/hooks.d.ts +2 -5
  120. package/vendor/hooks.js +8 -14
@@ -1,7 +1,37 @@
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;
1
+ import type { SecurityPolicyState } from '@frontegg/redux-store';
2
+ export declare const useSecurityPolicyState: <S = SecurityPolicyState>(selector?: (s: SecurityPolicyState) => S) => S, useSecurityPolicyActions: () => {
3
+ setSecurityPolicyState: (state: Partial<SecurityPolicyState>) => void;
4
+ setSecurityPolicyGlobalState: (state: Partial<import("@frontegg/redux-store").GlobalPolicyState>) => void;
5
+ setSecurityPolicyPublicState: (state: Partial<import("@frontegg/redux-store").PublicPolicyState>) => void;
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
+ };
6
36
  export declare const usePublicPolicySettings: (loadOnMount?: boolean) => import("@frontegg/redux-store").PublicPolicyState;
7
37
  export declare const usePublicAuthStrategiesPolicySettings: (loadOnMount?: boolean) => import("@frontegg/redux-store").PublicAuthStrategyPolicyState;
@@ -1,18 +1,12 @@
1
1
  import { useEffect } from 'react';
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
- };
2
+ import { createSliceHooks } from '../../useSnapshot/hookFactory';
3
+ export const {
4
+ useSliceState: useSecurityPolicyState,
5
+ useSliceActions: useSecurityPolicyActions
6
+ } = createSliceHooks({
7
+ getState: s => s.auth.securityPolicyState,
8
+ getActions: a => a.auth.securityPolicyActions
9
+ });
16
10
  export const usePublicPolicySettings = (loadOnMount = false) => {
17
11
  const {
18
12
  publicPolicy
@@ -21,8 +15,10 @@ export const usePublicPolicySettings = (loadOnMount = false) => {
21
15
  loadPublicSecurityPolicy
22
16
  } = useSecurityPolicyActions();
23
17
  useEffect(() => {
24
- (loadOnMount || !publicPolicy.policy) && loadPublicSecurityPolicy();
25
- }, [loadOnMount, loadPublicSecurityPolicy]);
18
+ if ((loadOnMount || !publicPolicy.policy) && !publicPolicy.loading) {
19
+ loadPublicSecurityPolicy();
20
+ }
21
+ }, [loadOnMount, publicPolicy.policy, publicPolicy.loading, loadPublicSecurityPolicy]);
26
22
  return publicPolicy;
27
23
  };
28
24
  export const usePublicAuthStrategiesPolicySettings = (loadOnMount = false) => {
@@ -33,7 +29,9 @@ export const usePublicAuthStrategiesPolicySettings = (loadOnMount = false) => {
33
29
  loadPublicAuthStrategiesPolicy
34
30
  } = useSecurityPolicyActions();
35
31
  useEffect(() => {
36
- (loadOnMount || !publicAuthStrategyPolicy.policy) && !publicAuthStrategyPolicy.error && loadPublicAuthStrategiesPolicy();
37
- }, [loadOnMount, loadPublicAuthStrategiesPolicy]);
32
+ if ((loadOnMount || !publicAuthStrategyPolicy.policy) && !publicAuthStrategyPolicy.error && !publicAuthStrategyPolicy.loading) {
33
+ loadPublicAuthStrategiesPolicy();
34
+ }
35
+ }, [loadOnMount, publicAuthStrategyPolicy.policy, publicAuthStrategyPolicy.error, publicAuthStrategyPolicy.loading, loadPublicAuthStrategiesPolicy]);
38
36
  return publicAuthStrategyPolicy;
39
37
  };
@@ -1,3 +1,7 @@
1
- import type { SessionsPolicyState, SessionsPolicyActions } from '@frontegg/redux-store';
2
- export declare function useSessionsPolicyState(): SessionsPolicyState;
3
- export declare const useSessionsPolicyActions: () => SessionsPolicyActions;
1
+ import type { SessionsPolicyState } from '@frontegg/redux-store';
2
+ export declare const useSessionsPolicyState: <S = SessionsPolicyState>(selector?: (s: SessionsPolicyState) => S) => S, useSessionsPolicyActions: () => {
3
+ setSessionsPolicyState: (state: Partial<SessionsPolicyState>) => void;
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,9 +1,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
- };
1
+ import { createSliceHooks } from '../../useSnapshot/hookFactory';
2
+ export const {
3
+ useSliceState: useSessionsPolicyState,
4
+ useSliceActions: useSessionsPolicyActions
5
+ } = createSliceHooks({
6
+ getState: s => s.auth.sessionsPolicyState,
7
+ getActions: a => a.auth.sessionsPolicyActions
8
+ });
@@ -1,3 +1,12 @@
1
- import type { SessionsState, SessionsActions } from '@frontegg/redux-store';
2
- export declare function useSessionsState(): SessionsState;
3
- export declare const useSessionsActions: () => SessionsActions;
1
+ import type { SessionsState } from '@frontegg/redux-store';
2
+ export declare const useSessionsState: <S = SessionsState>(selector?: (s: SessionsState) => S) => S, useSessionsActions: () => {
3
+ setSessionsState: (state: Partial<SessionsState>) => void;
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
+ };
package/auth/sessions.js CHANGED
@@ -1,8 +1,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
- };
1
+ import { createSliceHooks } from '../useSnapshot/hookFactory';
2
+ export const {
3
+ useSliceState: useSessionsState,
4
+ useSliceActions: useSessionsActions
5
+ } = createSliceHooks({
6
+ getState: s => s.auth.sessionsState,
7
+ getActions: a => a.auth.sessionsActions
8
+ });
package/auth/signup.d.ts CHANGED
@@ -1,5 +1,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;
1
+ import type { SignUpState } from '@frontegg/redux-store';
2
+ export declare const useSignUpState: <S = SignUpState>(selector?: (s: SignUpState) => S) => S, useSignUpActions: () => {
3
+ setSignUpState: (state: Partial<SignUpState>) => void;
4
+ resetSignUpState: () => void;
5
+ resetSignUpStateSoft: () => void;
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
+ };
package/auth/signup.js CHANGED
@@ -1,16 +1,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
- };
1
+ import { createSliceHooks } from '../useSnapshot/hookFactory';
2
+ export const {
3
+ useSliceState: useSignUpState,
4
+ useSliceActions: useSignUpActions
5
+ } = createSliceHooks({
6
+ getState: s => s.auth.signUpState,
7
+ getActions: a => a.auth.signUpActions
8
+ });
package/auth/sms.d.ts CHANGED
@@ -1,3 +1,13 @@
1
- import type { SmsActions, SmsState } from '@frontegg/redux-store';
2
- export declare function useSmsState(): SmsState;
3
- export declare const useSmsActions: () => SmsActions;
1
+ import type { SmsState } from '@frontegg/redux-store';
2
+ export declare const useSmsState: <S = SmsState>(selector?: (s: SmsState) => S) => S, useSmsActions: () => {
3
+ setSmsState: (state: Partial<SmsState>) => void;
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
+ };
package/auth/sms.js CHANGED
@@ -1,8 +1,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
- };
1
+ import { createSliceHooks } from '../useSnapshot/hookFactory';
2
+ export const {
3
+ useSliceState: useSmsState,
4
+ useSliceActions: useSmsActions
5
+ } = createSliceHooks({
6
+ getState: s => s.auth.smsState,
7
+ getActions: a => a.auth.smsActions
8
+ });
@@ -1,5 +1,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;
1
+ import type { SocialLoginState } from '@frontegg/redux-store';
2
+ export declare const useSocialLoginState: <S = SocialLoginState>(selector?: (s: SocialLoginState) => S) => S, useSocialLoginActions: () => {
3
+ setSocialLoginsState: (state: Partial<SocialLoginState>) => void;
4
+ resetSocialLoginsState: () => void;
5
+ setSocialLoginError: (payload: import("dist/@frontegg/rest-api").ISetSocialLoginError) => void;
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,13 +1,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
- };
1
+ import { createSliceHooks } from '../useSnapshot/hookFactory';
2
+ export const {
3
+ useSliceState: useSocialLoginState,
4
+ useSliceActions: useSocialLoginActions
5
+ } = createSliceHooks({
6
+ getState: s => s.auth.socialLoginState,
7
+ getActions: a => a.auth.socialLoginActions
8
+ });
package/auth/sso.d.ts CHANGED
@@ -1,6 +1,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 {};
1
+ import type { SSOState } from '@frontegg/redux-store';
2
+ export declare const useSSOState: <S = SSOState>(selector?: (s: SSOState) => S) => S, useSSOActions: () => {
3
+ loadSSOConfigurationsV2: (payload?: import("dist/@frontegg/redux-store/interfaces").WithRetryConfig<{}>) => Promise<void>;
4
+ saveSSOConfigurationV2: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").SaveSSOConfigurationPayloadV2) => Promise<void>;
5
+ updateSSOConfiguration: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").UpdateSSOConfigurationPayload) => Promise<void>;
6
+ deleteSSOConfiguration: (payload: import("dist/@frontegg/redux-store/auth/SSOState/interfaces").DeleteSSOConfigurationPayload) => Promise<void>;
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
+ };
package/auth/sso.js CHANGED
@@ -1,13 +1,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
- };
1
+ import { createSliceHooks } from '../useSnapshot/hookFactory';
2
+ export const {
3
+ useSliceState: useSSOState,
4
+ useSliceActions: useSSOActions
5
+ } = createSliceHooks({
6
+ getState: s => s.auth.ssoState,
7
+ getActions: a => a.auth.ssoActions
8
+ });
package/auth/stepUp.d.ts CHANGED
@@ -1,16 +1,17 @@
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
- */
1
+ import { StepUpState, StepUpOptions, IsSteppedUpOptions } from '@frontegg/redux-store';
2
+ export declare const useStepUpState: <S = StepUpState>(selector?: (s: StepUpState) => S) => S, useStepUpActions: () => {
3
+ stepUpHostedLogin: (payload: import("@frontegg/redux-store").IStepUpHostedLogin) => Promise<void>;
4
+ generateStepUpSession: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").IGenerateStepUpSession>) => Promise<void>;
5
+ setStepUpState: (state: Partial<StepUpState>) => void;
6
+ resetStepUpState: () => void;
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
+ };
7
15
  export declare const getMaxAgeFromQueryParam: () => number | undefined;
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
- */
16
+ export declare const useStepUp: () => (options?: StepUpOptions) => void;
16
17
  export declare const useIsSteppedUp: (options?: IsSteppedUpOptions) => boolean;
package/auth/stepUp.js CHANGED
@@ -1,26 +1,18 @@
1
1
  import { STEP_UP_MAX_AGE_PARAM_NAME, getSearchParam, redirectByStepUpUrl, isSteppedUp } from '@frontegg/redux-store';
2
- import { useSnapshot } from '../useSnapshot';
3
- import { useStore } from '../FronteggStoreContext';
4
- import { useAuth, useAuthRoutes, useAuthUserOrNull, useOnRedirectTo } from './hooks';
5
2
  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
- */
3
+ import { createSliceHooks } from '../useSnapshot/hookFactory';
4
+ import { useAuth, useAuthRoutes, useAuthUserOrNull, useOnRedirectTo } from './hooks';
5
+ export const {
6
+ useSliceState: useStepUpState,
7
+ useSliceActions: useStepUpActions
8
+ } = createSliceHooks({
9
+ getState: s => s.auth.stepUpState,
10
+ getActions: a => a.auth.stepUpActions
11
+ });
16
12
  export const getMaxAgeFromQueryParam = () => {
17
13
  const str = getSearchParam(STEP_UP_MAX_AGE_PARAM_NAME);
18
14
  return str === undefined ? undefined : +str;
19
15
  };
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
- */
24
16
  export const useStepUp = () => {
25
17
  const {
26
18
  stepUpUrl
@@ -40,11 +32,6 @@ export const useStepUp = () => {
40
32
  redirectByStepUpUrl(stepUpUrl, onRedirectTo, options == null ? void 0 : options.maxAge);
41
33
  }, [stepUpUrl, onRedirectTo, stepUpHostedLogin, hostedLoginBox]);
42
34
  };
43
-
44
- /**
45
- * @param options.maxAge - max age of step up
46
- * @returns true when the user is stepped up, false otherwise
47
- */
48
35
  export const useIsSteppedUp = (options = {}) => {
49
36
  const user = useAuthUserOrNull();
50
37
  return isSteppedUp(user, options);
package/auth/team.d.ts CHANGED
@@ -1,13 +1,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;
1
+ import type { TeamState } from '@frontegg/redux-store';
2
+ export declare const useTeamState: <S = TeamState>(selector?: (s: TeamState) => S) => S, useTeamActions: () => {
3
+ getInvitationLink: (payload?: import("dist/@frontegg/redux-store/interfaces").WithRetryConfig<{}>) => Promise<void>;
4
+ createInvitationLink: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").ICreateOrUpdateInviteUserLink, string>) => Promise<void>;
5
+ updateInvitationLink: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").ICreateOrUpdateInviteUserLink>) => Promise<void>;
6
+ deleteInvitationLink: (payload?: import("@frontegg/redux-store").WithCallback<{}, boolean>) => Promise<void>;
7
+ resendActivationLink: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IResendActivationLink>) => Promise<void>;
8
+ resendInvitationLink: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IResendInvitationLink>) => Promise<void>;
9
+ resendInvitationEmail: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IResendInvitationEmail>) => Promise<void>;
10
+ resendInvitationLinkToAllSubTenants: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IResendInvitationLink>) => Promise<void>;
11
+ 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>;
12
+ setUserRolesForSubTenants: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").UpdateUserRolesForSubTenantsRequestDto & {
13
+ userId: string;
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
+ };
package/auth/team.js CHANGED
@@ -1,25 +1,14 @@
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
- */
1
+ import { createSliceHooks } from '../useSnapshot/hookFactory';
2
+ export const {
3
+ useSliceState: useTeamState,
4
+ useSliceActions: useTeamActions
5
+ } = createSliceHooks({
6
+ getState: s => s.auth.teamState,
7
+ getActions: a => a.auth.teamActions
8
+ });
14
9
 
15
- // @deprecated use useTeamState() instead
16
- export function useAuthTeamState(stateMapper = defaultMapper) {
17
- return stateMapper(useTeamState());
18
- }
10
+ /* @deprecated use useTeamActions instead */
11
+ export const useAuthTeamState = useTeamState;
19
12
 
20
- /**
21
- * @deprecated use useTeamActions instead
22
- */
23
- export const useAuthTeamActions = () => {
24
- return useTeamActions();
25
- };
13
+ /* @deprecated use useTeamActions instead */
14
+ export const useAuthTeamActions = useTeamActions;
package/auth/tenants.d.ts CHANGED
@@ -1,3 +1,9 @@
1
- import type { TenantsState, TenantsActions } from '@frontegg/redux-store';
2
- export declare function useTenantsState(): TenantsState;
3
- export declare const useTenantsActions: () => TenantsActions;
1
+ import type { TenantsState } from '@frontegg/redux-store';
2
+ export declare const useTenantsState: <S = TenantsState>(selector?: (s: TenantsState) => S) => S, useTenantsActions: () => {
3
+ setTenantsState: (state: Partial<TenantsState>) => void;
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
+ };