@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.
Files changed (120) hide show
  1. package/audits/auditLogs.d.ts +3 -2
  2. package/audits/auditLogs.js +9 -8
  3. package/audits/auditsMetadata.d.ts +3 -2
  4. package/audits/auditsMetadata.js +9 -8
  5. package/audits/hooks.d.ts +9 -2
  6. package/audits/hooks.js +14 -10
  7. package/auth/acceptInvitation.d.ts +5 -7
  8. package/auth/acceptInvitation.js +13 -8
  9. package/auth/activateAccount.d.ts +5 -11
  10. package/auth/activateAccount.js +13 -8
  11. package/auth/allAccounts.d.ts +7 -47
  12. package/auth/allAccounts.js +20 -12
  13. package/auth/apiTokens.d.ts +3 -14
  14. package/auth/apiTokens.js +9 -8
  15. package/auth/applications.d.ts +3 -22
  16. package/auth/applications.js +9 -8
  17. package/auth/customLogin.d.ts +3 -9
  18. package/auth/customLogin.js +12 -9
  19. package/auth/entitlements.d.ts +25 -6
  20. package/auth/entitlements.js +73 -41
  21. package/auth/forgotPassword.d.ts +3 -12
  22. package/auth/forgotPassword.js +9 -10
  23. package/auth/groups.d.ts +5 -32
  24. package/auth/groups.js +14 -14
  25. package/auth/impersonate.d.ts +3 -6
  26. package/auth/impersonate.js +8 -8
  27. package/auth/login.d.ts +3 -74
  28. package/auth/login.js +8 -8
  29. package/auth/passkeys.d.ts +3 -10
  30. package/auth/passkeys.js +8 -8
  31. package/auth/passwordRotation.d.ts +3 -4
  32. package/auth/passwordRotation.js +9 -8
  33. package/auth/profile.d.ts +3 -19
  34. package/auth/profile.js +12 -17
  35. package/auth/provisioning.d.ts +3 -20
  36. package/auth/provisioning.js +8 -8
  37. package/auth/resetPhoneNumber.d.ts +3 -8
  38. package/auth/resetPhoneNumber.js +8 -8
  39. package/auth/roles.d.ts +3 -14
  40. package/auth/roles.js +8 -8
  41. package/auth/security/restrictions.d.ts +3 -21
  42. package/auth/security/restrictions.js +19 -20
  43. package/auth/security/securityCenter.d.ts +3 -15
  44. package/auth/security/securityCenter.js +9 -8
  45. package/auth/security/securityPolicy.d.ts +5 -35
  46. package/auth/security/securityPolicy.js +18 -16
  47. package/auth/security/sessionsPolicy.d.ts +3 -7
  48. package/auth/security/sessionsPolicy.js +9 -8
  49. package/auth/sessions.d.ts +3 -12
  50. package/auth/sessions.js +8 -8
  51. package/auth/signup.d.ts +5 -10
  52. package/auth/signup.js +16 -8
  53. package/auth/sms.d.ts +3 -13
  54. package/auth/sms.js +8 -8
  55. package/auth/socialLogin.d.ts +5 -9
  56. package/auth/socialLogin.js +13 -8
  57. package/auth/sso.d.ts +6 -31
  58. package/auth/sso.js +13 -8
  59. package/auth/stepUp.d.ts +14 -15
  60. package/auth/stepUp.js +22 -9
  61. package/auth/team.d.ts +13 -84
  62. package/auth/team.js +23 -12
  63. package/auth/tenants.d.ts +3 -9
  64. package/auth/tenants.js +9 -8
  65. package/auth/unlockAccount.d.ts +5 -6
  66. package/auth/unlockAccount.js +10 -8
  67. package/auth/usernames.d.ts +3 -7
  68. package/auth/usernames.js +8 -8
  69. package/auth/usersEmailsPolicyState.d.ts +5 -5
  70. package/auth/usersEmailsPolicyState.js +10 -8
  71. package/connectivity/hooks.d.ts +3 -41
  72. package/connectivity/hooks.js +9 -8
  73. package/index.js +1 -1
  74. package/node/audits/auditLogs.js +12 -11
  75. package/node/audits/auditsMetadata.js +12 -11
  76. package/node/audits/hooks.js +17 -13
  77. package/node/auth/acceptInvitation.js +13 -11
  78. package/node/auth/activateAccount.js +13 -11
  79. package/node/auth/allAccounts.js +20 -15
  80. package/node/auth/apiTokens.js +12 -11
  81. package/node/auth/applications.js +12 -11
  82. package/node/auth/customLogin.js +15 -11
  83. package/node/auth/entitlements.js +73 -41
  84. package/node/auth/forgotPassword.js +12 -13
  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 +12 -11
  90. package/node/auth/profile.js +13 -19
  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 +21 -22
  95. package/node/auth/security/securityCenter.js +12 -11
  96. package/node/auth/security/securityPolicy.js +17 -18
  97. package/node/auth/security/sessionsPolicy.js +12 -11
  98. package/node/auth/sessions.js +11 -11
  99. package/node/auth/signup.js +16 -11
  100. package/node/auth/sms.js +11 -11
  101. package/node/auth/socialLogin.js +13 -11
  102. package/node/auth/sso.js +13 -11
  103. package/node/auth/stepUp.js +24 -11
  104. package/node/auth/team.js +28 -16
  105. package/node/auth/tenants.js +12 -11
  106. package/node/auth/unlockAccount.js +13 -11
  107. package/node/auth/usernames.js +11 -11
  108. package/node/auth/usersEmailsPolicyState.js +13 -11
  109. package/node/connectivity/hooks.js +12 -11
  110. package/node/index.js +1 -1
  111. package/node/subscriptions/hooks.js +115 -86
  112. package/node/vendor/hooks.js +14 -11
  113. package/package.json +3 -3
  114. package/subscriptions/hooks.d.ts +22 -48
  115. package/subscriptions/hooks.js +103 -77
  116. package/vendor/hooks.d.ts +5 -2
  117. package/vendor/hooks.js +14 -8
  118. package/node/useSnapshot/hookFactory.js +0 -32
  119. package/useSnapshot/hookFactory.d.ts +0 -18
  120. package/useSnapshot/hookFactory.js +0 -26
@@ -1,37 +1,7 @@
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
- };
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 { 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
- });
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
- if ((loadOnMount || !publicPolicy.policy) && !publicPolicy.loading) {
19
- loadPublicSecurityPolicy();
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
- if ((loadOnMount || !publicAuthStrategyPolicy.policy) && !publicAuthStrategyPolicy.error && !publicAuthStrategyPolicy.loading) {
33
- loadPublicAuthStrategiesPolicy();
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 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
+ 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 { 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
+ 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,12 +1,3 @@
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
- };
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 { 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
- });
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 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
- };
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 { 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
- });
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 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
- };
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 { 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
+ 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,9 +1,5 @@
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
+ 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,8 +1,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
- });
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
- 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
- };
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 { 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
- });
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 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
- };
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
- export declare const useStepUp: () => (options?: StepUpOptions) => void;
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 { useCallback } from 'react';
3
- import { createSliceHooks } from '../useSnapshot/hookFactory';
2
+ import { useSnapshot } from '../useSnapshot';
3
+ import { useStore } from '../FronteggStoreContext';
4
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
- });
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 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
- };
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 { 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
- });
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
- /* @deprecated use useTeamActions instead */
11
- export const useAuthTeamState = useTeamState;
15
+ // @deprecated use useTeamState() instead
16
+ export function useAuthTeamState(stateMapper = defaultMapper) {
17
+ return stateMapper(useTeamState());
18
+ }
12
19
 
13
- /* @deprecated use useTeamActions instead */
14
- export const useAuthTeamActions = useTeamActions;
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 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
- };
1
+ import type { TenantsState, TenantsActions } from '@frontegg/redux-store';
2
+ export declare function useTenantsState(): TenantsState;
3
+ export declare const useTenantsActions: () => TenantsActions;