@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.
- package/audits/auditLogs.d.ts +2 -3
- package/audits/auditLogs.js +8 -9
- package/audits/auditsMetadata.d.ts +2 -3
- package/audits/auditsMetadata.js +8 -9
- package/audits/hooks.d.ts +2 -9
- package/audits/hooks.js +10 -14
- package/auth/acceptInvitation.d.ts +7 -5
- package/auth/acceptInvitation.js +8 -13
- package/auth/activateAccount.d.ts +11 -5
- package/auth/activateAccount.js +8 -13
- package/auth/allAccounts.d.ts +47 -7
- package/auth/allAccounts.js +12 -20
- package/auth/apiTokens.d.ts +14 -3
- package/auth/apiTokens.js +8 -9
- package/auth/applications.d.ts +22 -3
- package/auth/applications.js +8 -9
- package/auth/customLogin.d.ts +9 -3
- package/auth/customLogin.js +9 -12
- package/auth/entitlements.d.ts +6 -25
- package/auth/entitlements.js +41 -73
- package/auth/forgotPassword.d.ts +12 -3
- package/auth/forgotPassword.js +10 -9
- package/auth/groups.d.ts +32 -5
- package/auth/groups.js +14 -14
- package/auth/impersonate.d.ts +6 -3
- package/auth/impersonate.js +8 -8
- package/auth/login.d.ts +74 -3
- package/auth/login.js +8 -8
- package/auth/passkeys.d.ts +10 -3
- package/auth/passkeys.js +8 -8
- package/auth/passwordRotation.d.ts +4 -3
- package/auth/passwordRotation.js +8 -9
- package/auth/profile.d.ts +19 -3
- package/auth/profile.js +17 -12
- package/auth/provisioning.d.ts +20 -3
- package/auth/provisioning.js +8 -8
- package/auth/resetPhoneNumber.d.ts +8 -3
- package/auth/resetPhoneNumber.js +8 -8
- package/auth/roles.d.ts +14 -3
- package/auth/roles.js +8 -8
- package/auth/security/restrictions.d.ts +21 -3
- package/auth/security/restrictions.js +20 -19
- package/auth/security/securityCenter.d.ts +15 -3
- package/auth/security/securityCenter.js +8 -9
- package/auth/security/securityPolicy.d.ts +35 -5
- package/auth/security/securityPolicy.js +16 -18
- package/auth/security/sessionsPolicy.d.ts +7 -3
- package/auth/security/sessionsPolicy.js +8 -9
- package/auth/sessions.d.ts +12 -3
- package/auth/sessions.js +8 -8
- package/auth/signup.d.ts +10 -5
- package/auth/signup.js +8 -16
- package/auth/sms.d.ts +13 -3
- package/auth/sms.js +8 -8
- package/auth/socialLogin.d.ts +9 -5
- package/auth/socialLogin.js +8 -13
- package/auth/sso.d.ts +31 -6
- package/auth/sso.js +8 -13
- package/auth/stepUp.d.ts +15 -14
- package/auth/stepUp.js +9 -22
- package/auth/team.d.ts +84 -13
- package/auth/team.js +12 -23
- package/auth/tenants.d.ts +9 -3
- package/auth/tenants.js +8 -9
- package/auth/unlockAccount.d.ts +6 -5
- package/auth/unlockAccount.js +8 -10
- package/auth/usernames.d.ts +7 -3
- package/auth/usernames.js +8 -8
- package/auth/usersEmailsPolicyState.d.ts +5 -5
- package/auth/usersEmailsPolicyState.js +8 -10
- package/connectivity/hooks.d.ts +41 -3
- package/connectivity/hooks.js +8 -9
- package/index.js +1 -1
- package/node/audits/auditLogs.js +11 -12
- package/node/audits/auditsMetadata.js +11 -12
- package/node/audits/hooks.js +13 -17
- package/node/auth/acceptInvitation.js +11 -13
- package/node/auth/activateAccount.js +11 -13
- package/node/auth/allAccounts.js +15 -20
- package/node/auth/apiTokens.js +11 -12
- package/node/auth/applications.js +11 -12
- package/node/auth/customLogin.js +11 -15
- package/node/auth/entitlements.js +41 -73
- package/node/auth/forgotPassword.js +13 -12
- 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 +11 -12
- package/node/auth/profile.js +19 -13
- 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 +22 -21
- package/node/auth/security/securityCenter.js +11 -12
- package/node/auth/security/securityPolicy.js +18 -17
- package/node/auth/security/sessionsPolicy.js +11 -12
- package/node/auth/sessions.js +11 -11
- package/node/auth/signup.js +11 -16
- package/node/auth/sms.js +11 -11
- package/node/auth/socialLogin.js +11 -13
- package/node/auth/sso.js +11 -13
- package/node/auth/stepUp.js +11 -24
- package/node/auth/team.js +16 -28
- package/node/auth/tenants.js +11 -12
- package/node/auth/unlockAccount.js +11 -13
- package/node/auth/usernames.js +11 -11
- package/node/auth/usersEmailsPolicyState.js +11 -13
- package/node/connectivity/hooks.js +11 -12
- package/node/index.js +1 -1
- package/node/subscriptions/hooks.js +86 -115
- package/node/useSnapshot/hookFactory.js +32 -0
- package/node/vendor/hooks.js +11 -14
- package/package.json +3 -3
- package/subscriptions/hooks.d.ts +48 -22
- package/subscriptions/hooks.js +77 -103
- package/useSnapshot/hookFactory.d.ts +18 -0
- package/useSnapshot/hookFactory.js +26 -0
- package/vendor/hooks.d.ts +2 -5
- package/vendor/hooks.js +8 -14
package/audits/auditLogs.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { AuditLogsState, AuditsActions } from '@frontegg/redux-store';
|
|
2
|
-
export declare
|
|
3
|
-
export declare const useAuditLogsActions: () => AuditsActions;
|
|
1
|
+
import type { AuditLogsState, AuditsActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare const useAuditLogsState: <S = AuditLogsState>(selector?: (s: AuditLogsState) => S) => S, useAuditLogsActions: () => AuditsActions;
|
package/audits/auditLogs.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
import { createSliceHooks } from '../useSnapshot/hookFactory';
|
|
2
|
+
export const {
|
|
3
|
+
useSliceState: useAuditLogsState,
|
|
4
|
+
useSliceActions: useAuditLogsActions
|
|
5
|
+
} = createSliceHooks({
|
|
6
|
+
getState: s => s.auditLogs.auditLogsState,
|
|
7
|
+
getActions: a => a.auditLogs
|
|
8
|
+
});
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
3
|
-
export declare const useAuditsMetadataActions: () => AuditsActions;
|
|
1
|
+
import type { AuditsMetadataState, AuditsActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare const useAuditsMetadataState: <S = AuditsMetadataState>(selector?: (s: AuditsMetadataState) => S) => S, useAuditsMetadataActions: () => AuditsActions;
|
package/audits/auditsMetadata.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
import { createSliceHooks } from '../useSnapshot/hookFactory';
|
|
2
|
+
export const {
|
|
3
|
+
useSliceState: useAuditsMetadataState,
|
|
4
|
+
useSliceActions: useAuditsMetadataActions
|
|
5
|
+
} = createSliceHooks({
|
|
6
|
+
getState: s => s.auditLogs.auditsMetadataState,
|
|
7
|
+
getActions: a => a.auditLogs
|
|
8
|
+
});
|
package/audits/hooks.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
state: (state: AuditsState) => any;
|
|
4
|
-
actions: (actions: AuditsActions) => any;
|
|
5
|
-
};
|
|
6
|
-
export type AuditsStateMapper<S> = (state: AuditsState) => S;
|
|
7
|
-
export declare function useAuditsState(): AuditsState;
|
|
8
|
-
export declare function useAuditsState<S>(stateMapper: AuditsStateMapper<S>): S;
|
|
9
|
-
export declare const useAuditsActions: () => AuditsActions;
|
|
1
|
+
import type { AuditsState, AuditsActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare const useAuditsState: <S = AuditsState>(selector?: (s: AuditsState) => S) => S, useAuditsActions: () => AuditsActions;
|
package/audits/hooks.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
export const useAuditsActions = () => {
|
|
13
|
-
return useStore().stateActions.auditLogs;
|
|
14
|
-
};
|
|
1
|
+
import { createSliceHooks } from '../useSnapshot/hookFactory';
|
|
2
|
+
export const {
|
|
3
|
+
useSliceState: useAuditsState,
|
|
4
|
+
// supports optional selector
|
|
5
|
+
useSliceActions: useAuditsActions
|
|
6
|
+
} = createSliceHooks({
|
|
7
|
+
getState: s => s.auditLogs,
|
|
8
|
+
// whole audits slice
|
|
9
|
+
getActions: a => a.auditLogs
|
|
10
|
+
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { AcceptInvitationState
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { AcceptInvitationState } from '@frontegg/redux-store';
|
|
2
|
+
export declare const useAcceptInvitationState: <S = AcceptInvitationState>(selector?: (s: AcceptInvitationState) => S) => S, useAcceptInvitationActions: () => {
|
|
3
|
+
setAcceptInvitationState: (state: Partial<AcceptInvitationState>) => void;
|
|
4
|
+
resetAcceptInvitationState: () => void;
|
|
5
|
+
acceptInvitation: (payload: import("dist/@frontegg/rest-api").IAcceptInvitation) => Promise<void>;
|
|
6
|
+
acceptInvitationWithOTC: (payload: import("dist/@frontegg/rest-api").IAcceptInvitationWithOTC) => Promise<void>;
|
|
7
|
+
};
|
package/auth/acceptInvitation.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return stateMapper(useSnapshot(state));
|
|
10
|
-
}
|
|
11
|
-
export const useAcceptInvitationActions = () => {
|
|
12
|
-
return useStore().stateActions.auth.acceptInvitationActions;
|
|
13
|
-
};
|
|
1
|
+
import { createSliceHooks } from '../useSnapshot/hookFactory';
|
|
2
|
+
export const {
|
|
3
|
+
useSliceState: useAcceptInvitationState,
|
|
4
|
+
useSliceActions: useAcceptInvitationActions
|
|
5
|
+
} = createSliceHooks({
|
|
6
|
+
getState: s => s.auth.acceptInvitationState,
|
|
7
|
+
getActions: a => a.auth.acceptInvitationActions
|
|
8
|
+
});
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { ActivateAccountState
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { ActivateAccountState } from '@frontegg/redux-store';
|
|
2
|
+
export declare const useActivateAccountState: <S = ActivateAccountState>(selector?: (s: ActivateAccountState) => S) => S, useActivateAccountActions: () => {
|
|
3
|
+
setActivateState: (state: Partial<ActivateAccountState>) => void;
|
|
4
|
+
resetActivateState: () => void;
|
|
5
|
+
setActivateStrategyState: (state: Partial<ActivateAccountState["activationStrategy"]>) => void;
|
|
6
|
+
activateAccount: (_payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").IActivateAccountPayload>) => Promise<void>;
|
|
7
|
+
preActivateAccount: (payload: import("@frontegg/redux-store").IPreActivateAccount) => Promise<void>;
|
|
8
|
+
getActivateAccountStrategy: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IGetActivateAccountStrategy, import("dist/@frontegg/rest-api").IGetActivateAccountStrategyResponse>) => Promise<void>;
|
|
9
|
+
resendActivationEmail: (payload: import("@frontegg/redux-store").WithCallback<import("dist/@frontegg/rest-api").IResendActivationEmail>) => Promise<void>;
|
|
10
|
+
activateAccountWithCode: (_payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").IActivateAccountWithOTCPayload>) => Promise<void>;
|
|
11
|
+
};
|
package/auth/activateAccount.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return stateMapper(useSnapshot(state));
|
|
10
|
-
}
|
|
11
|
-
export const useActivateAccountActions = () => {
|
|
12
|
-
return useStore().stateActions.auth.activateAccountActions;
|
|
13
|
-
};
|
|
1
|
+
import { createSliceHooks } from '../useSnapshot/hookFactory';
|
|
2
|
+
export const {
|
|
3
|
+
useSliceState: useActivateAccountState,
|
|
4
|
+
useSliceActions: useActivateAccountActions
|
|
5
|
+
} = createSliceHooks({
|
|
6
|
+
getState: s => s.auth.activateAccountState,
|
|
7
|
+
getActions: a => a.auth.activateAccountActions
|
|
8
|
+
});
|
package/auth/allAccounts.d.ts
CHANGED
|
@@ -1,7 +1,47 @@
|
|
|
1
|
-
import { IAllAccountsState,
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { IAllAccountsState, IAllAccountsDialogsState } from '@frontegg/redux-store';
|
|
2
|
+
export declare const useAllAccountsState: <S = IAllAccountsState>(selector?: (s: IAllAccountsState) => S) => S, useAllAccountsActions: () => {
|
|
3
|
+
setAllAccountsLoader: (payload: import("@frontegg/redux-store").AllAccountsStateIndicator) => void;
|
|
4
|
+
setAllAccountsError: (payload: import("@frontegg/redux-store").AllAccountsStateIndicator) => void;
|
|
5
|
+
setAllAccountsState: (state: Partial<IAllAccountsState>) => void;
|
|
6
|
+
setSelectedAccountState: (payload: Partial<IAllAccountsState["selectedAccount"]>) => void;
|
|
7
|
+
resetAllAccountsState: () => void;
|
|
8
|
+
clearSelectedAccount: () => void;
|
|
9
|
+
loadAccounts: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["loadAccounts"]) => Promise<void>;
|
|
10
|
+
searchAccounts: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["searchAccounts"]) => Promise<void>;
|
|
11
|
+
updateSubAccountAccessForUser: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["updateSubAccountAccessForUser"]) => Promise<void>;
|
|
12
|
+
createSubAccount: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["createSubAccount"]) => Promise<void>;
|
|
13
|
+
updateSubAccount: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["updateSubAccount"]) => Promise<void>;
|
|
14
|
+
deleteSubAccount: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["deleteSubAccount"]) => Promise<void>;
|
|
15
|
+
updateSubAccountSettings: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["updateSubAccountSettings"]) => Promise<void>;
|
|
16
|
+
updateSubAccountManagement: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["updateSubAccountManagement"]) => Promise<void>;
|
|
17
|
+
updateSubAccountHierarchySettings: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["updateSubAccountHierarchySettings"]) => Promise<void>;
|
|
18
|
+
addUsersToAccount: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["addUsersToAccount"]) => Promise<void>;
|
|
19
|
+
getAccountUsers: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["getAccountUsers"]) => Promise<void>;
|
|
20
|
+
deleteUsersFromAccount: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["deleteUsersFromAccount"]) => Promise<void>;
|
|
21
|
+
setUserRolesForSubAccount: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["setUserRolesForSubAccount"]) => Promise<void>;
|
|
22
|
+
getUserJwtForSubAccount: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["getUserJwtForSubAccount"]) => Promise<void>;
|
|
23
|
+
setRootAccountData: () => Promise<void>;
|
|
24
|
+
setSelectedSubAccountData: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["setSelectedSubAccountData"]) => Promise<void>;
|
|
25
|
+
loadNumberOfUsersForSelectedSubAccount: (payload: import("@frontegg/redux-store").IAllAccountsStateActionsPayloads["loadNumberOfUsersForSelectedSubAccount"]) => Promise<void>;
|
|
26
|
+
}, useAllAccountsDialogsState: () => IAllAccountsDialogsState, useAllAccountsDialogsActions: () => {
|
|
27
|
+
setAllAccountDialogsState: (payload: Partial<IAllAccountsDialogsState>) => void;
|
|
28
|
+
resetAllAccountDialogsState: () => void;
|
|
29
|
+
openCreateSubAccountDialog: (payload: Partial<import("@frontegg/redux-store").TCreateSubAccountDialogState>) => void;
|
|
30
|
+
closeCreateSubAccountDialog: () => void;
|
|
31
|
+
openUpdateSubAccountDialog: (payload: Partial<import("@frontegg/redux-store").TUpdateAccountDialogState>) => void;
|
|
32
|
+
closeUpdateSubAccountDialog: () => void;
|
|
33
|
+
openEnableSubAccountManagementDialog: (payload: Partial<import("@frontegg/redux-store").TUpdateSubAccountManagementState>) => void;
|
|
34
|
+
closeEnableSubAccountManagementDialog: () => void;
|
|
35
|
+
openUpdateSubAccountHierarchySettingsDialog: (payload: Partial<import("@frontegg/redux-store").TUpdateSubAccountHierarchySettingsDialogState>) => void;
|
|
36
|
+
closeUpdateSubAccountHierarchySettingsDialog: () => void;
|
|
37
|
+
openDisableSubAccountManagementDialog: (payload: Partial<import("@frontegg/redux-store").TUpdateSubAccountManagementState>) => void;
|
|
38
|
+
closeDisableSubAccountManagementDialog: () => void;
|
|
39
|
+
openDeleteSubAccountDialog: (payload: Partial<import("@frontegg/redux-store").TDeleteSubAccountDialogState>) => void;
|
|
40
|
+
closeDeleteSubAccountDialog: () => void;
|
|
41
|
+
openAddUsersToAccountDialog: (payload: Partial<import("@frontegg/redux-store").TAddUsersToSubAccountDialogState>) => void;
|
|
42
|
+
closeAddUsersToAccountDialog: () => void;
|
|
43
|
+
openDeleteUserFromAccountDialog: (payload: Partial<import("@frontegg/redux-store").TDeleteUserFromSubAccountDialogState>) => void;
|
|
44
|
+
closeDeleteUserFromAccountDialog: () => void;
|
|
45
|
+
openEditUserRolesDialog: (payload: Partial<import("@frontegg/redux-store").TEditUserRolesDialogState>) => void;
|
|
46
|
+
closeEditUserRolesDialog: () => void;
|
|
47
|
+
};
|
package/auth/allAccounts.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
export function useAllAccountsDialogsState() {
|
|
15
|
-
const state = useStore().store.auth.allAccountsDialogsState;
|
|
16
|
-
return useSnapshot(state);
|
|
17
|
-
}
|
|
18
|
-
export const useAllAccountsDialogsActions = () => {
|
|
19
|
-
return useStore().stateActions.auth.allAccountsDialogActions;
|
|
20
|
-
};
|
|
1
|
+
import { createSliceHooks } from '../useSnapshot/hookFactory';
|
|
2
|
+
export const {
|
|
3
|
+
useSliceState: useAllAccountsState,
|
|
4
|
+
useSliceActions: useAllAccountsActions,
|
|
5
|
+
useSliceDialogsState: useAllAccountsDialogsState,
|
|
6
|
+
useSliceDialogsActions: useAllAccountsDialogsActions
|
|
7
|
+
} = createSliceHooks({
|
|
8
|
+
getState: s => s.auth.allAccountsState,
|
|
9
|
+
getActions: a => a.auth.allAccountsActions,
|
|
10
|
+
getDialogsState: s => s.auth.allAccountsDialogsState,
|
|
11
|
+
getDialogsActions: a => a.auth.allAccountsDialogActions
|
|
12
|
+
});
|
package/auth/apiTokens.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
3
|
-
|
|
1
|
+
import type { ApiTokensState } from '@frontegg/redux-store';
|
|
2
|
+
export declare const useApiTokensState: <S = ApiTokensState>(selector?: (s: ApiTokensState) => S) => S, useApiTokensActions: () => {
|
|
3
|
+
setApiTokensLoader: (payload: import("@frontegg/redux-store").ApiStateIndicator) => void;
|
|
4
|
+
setApiTokensError: (payload: import("@frontegg/redux-store").ApiStateIndicator) => void;
|
|
5
|
+
setApiTokensState: (state: Partial<ApiTokensState>) => void;
|
|
6
|
+
resetApiTokensState: () => void;
|
|
7
|
+
loadApiTokens: (payload?: import("@frontegg/redux-store").WithSilentLoad<import("@frontegg/redux-store").WithCallback>) => Promise<void>;
|
|
8
|
+
loadUserApiTokens: (payload?: import("@frontegg/redux-store").WithRetryConfig<import("@frontegg/redux-store").WithSilentLoad<import("@frontegg/redux-store").WithCallback>>) => Promise<void>;
|
|
9
|
+
loadTenantApiTokens: (payload?: import("@frontegg/redux-store").WithRetryConfig<import("@frontegg/redux-store").WithSilentLoad<import("@frontegg/redux-store").WithCallback>>) => Promise<void>;
|
|
10
|
+
addTenantApiToken: (payload: import("@frontegg/redux-store").AddTenantApiTokenPayload) => Promise<void>;
|
|
11
|
+
addUserApiToken: (payload: import("@frontegg/redux-store").AddUserApiTokenPayload) => Promise<void>;
|
|
12
|
+
deleteUserApiToken: (payload: string) => Promise<void>;
|
|
13
|
+
deleteTenantApiToken: (payload: string) => Promise<void>;
|
|
14
|
+
};
|
package/auth/apiTokens.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
import { createSliceHooks } from '../useSnapshot/hookFactory';
|
|
2
|
+
export const {
|
|
3
|
+
useSliceState: useApiTokensState,
|
|
4
|
+
useSliceActions: useApiTokensActions
|
|
5
|
+
} = createSliceHooks({
|
|
6
|
+
getState: s => s.auth.apiTokensState,
|
|
7
|
+
getActions: a => a.auth.apiTokensActions
|
|
8
|
+
});
|
package/auth/applications.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
3
|
-
|
|
1
|
+
import type { ApplicationsState } from '@frontegg/redux-store';
|
|
2
|
+
export declare const useApplicationsState: <S = ApplicationsState>(selector?: (s: ApplicationsState) => S) => S, useApplicationsActions: () => {
|
|
3
|
+
setApplicationsState: (payload: Partial<ApplicationsState>) => void;
|
|
4
|
+
resetApplicationsState: () => void;
|
|
5
|
+
loadUserApplications: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
6
|
+
loadAccountApplications: (payload?: import("@frontegg/redux-store").WithRetryConfig<{}>) => Promise<void>;
|
|
7
|
+
loadMultipleUsersApplications: ({ userIds, retryConfig }: import("@frontegg/redux-store").WithRetryConfig<{
|
|
8
|
+
userIds: string[];
|
|
9
|
+
}>) => Promise<Record<string, import("dist/@frontegg/rest-api").IApplicationsResponse[]> | undefined>;
|
|
10
|
+
assignUserToApps: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").UserAppsAssignmentPayload>) => Promise<void>;
|
|
11
|
+
unassignUserFromApps: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").UserAppsAssignmentPayload>) => Promise<void>;
|
|
12
|
+
assignNewUserToApps: ({ appIds, user }: {
|
|
13
|
+
appIds?: string[];
|
|
14
|
+
user: import("dist/@frontegg/rest-api").ITeamUser;
|
|
15
|
+
}) => Promise<((import("dist/@frontegg/rest-api").IApplicationsResponse & {
|
|
16
|
+
userIds?: string[];
|
|
17
|
+
}) | never[])[] | undefined>;
|
|
18
|
+
mapUsersWithApplicationData: ({ shouldLoadApps, users, retryConfig, }: import("@frontegg/redux-store").WithRetryConfig<{
|
|
19
|
+
shouldLoadApps?: boolean;
|
|
20
|
+
users: import("dist/@frontegg/rest-api").ITeamUser[];
|
|
21
|
+
}>) => Promise<import("dist/@frontegg/rest-api").ITeamUser[]>;
|
|
22
|
+
};
|
package/auth/applications.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
import { createSliceHooks } from '../useSnapshot/hookFactory';
|
|
2
|
+
export const {
|
|
3
|
+
useSliceState: useApplicationsState,
|
|
4
|
+
useSliceActions: useApplicationsActions
|
|
5
|
+
} = createSliceHooks({
|
|
6
|
+
getState: s => s.auth.applicationsState,
|
|
7
|
+
getActions: a => a.auth.applicationsActions
|
|
8
|
+
});
|
package/auth/customLogin.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { CustomLoginState
|
|
2
|
-
export declare
|
|
3
|
-
|
|
1
|
+
import type { CustomLoginState } from '@frontegg/redux-store';
|
|
2
|
+
export declare const useCustomLoginState: <S = CustomLoginState>(selector?: (s: CustomLoginState) => S) => S, useCustomLoginActions: () => {
|
|
3
|
+
setCustomLoginState: (payload: Partial<CustomLoginState>) => void;
|
|
4
|
+
resetCustomLoginState: () => void;
|
|
5
|
+
loadTenantMetadata: () => Promise<void>;
|
|
6
|
+
updateTenantMetadata: (payload: import("@frontegg/redux-store").WithCallback<Partial<import("@frontegg/redux-store").UpdateTenantMetadataRequest>>) => Promise<void>;
|
|
7
|
+
customLoginEnabled: () => Promise<boolean>;
|
|
8
|
+
loadCustomLoginRoutes: (payload?: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithRetryConfig<{}>>) => Promise<void>;
|
|
9
|
+
};
|
|
4
10
|
export declare const useCustomLoginTheme: () => {
|
|
5
11
|
customLoginTheme: any;
|
|
6
12
|
getCustomLoginThemeValue: (path?: string) => any;
|
package/auth/customLogin.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import getValue from 'get-value';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
3
|
+
import { createSliceHooks } from '../useSnapshot/hookFactory';
|
|
4
|
+
export const {
|
|
5
|
+
useSliceState: useCustomLoginState,
|
|
6
|
+
useSliceActions: useCustomLoginActions
|
|
7
|
+
} = createSliceHooks({
|
|
8
|
+
getState: s => s.auth.customLoginState,
|
|
9
|
+
getActions: a => a.auth.customLoginActions
|
|
10
|
+
});
|
|
12
11
|
export const useCustomLoginTheme = () => {
|
|
13
12
|
var _useCustomLoginState$, _useCustomLoginState$2, _useCustomLoginState$3;
|
|
14
13
|
const customLoginTheme = (_useCustomLoginState$ = useCustomLoginState().tenantMetadata) == null ? void 0 : (_useCustomLoginState$2 = _useCustomLoginState$.configuration) == null ? void 0 : (_useCustomLoginState$3 = _useCustomLoginState$2.themeV2) == null ? void 0 : _useCustomLoginState$3.loginBox;
|
|
15
|
-
const getCustomLoginThemeValue = useCallback(path =>
|
|
16
|
-
return path && customLoginTheme ? getValue(customLoginTheme, path) : customLoginTheme;
|
|
17
|
-
}, [customLoginTheme]);
|
|
14
|
+
const getCustomLoginThemeValue = useCallback(path => path && customLoginTheme ? getValue(customLoginTheme, path) : customLoginTheme, [customLoginTheme]);
|
|
18
15
|
return {
|
|
19
16
|
customLoginTheme,
|
|
20
17
|
getCustomLoginThemeValue
|
package/auth/entitlements.d.ts
CHANGED
|
@@ -1,35 +1,16 @@
|
|
|
1
|
-
import { CustomAttributes } from '@frontegg/entitlements-javascript-commons';
|
|
1
|
+
import type { CustomAttributes } from '@frontegg/entitlements-javascript-commons';
|
|
2
2
|
import { EntitledToOptions, Entitlement } from '@frontegg/redux-store';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@returns if the user is entitled to the given feature and attributes. Attaching the justification if not
|
|
7
|
-
*/
|
|
8
|
-
export declare const useFeatureEntitlements: (key: string, customAttributes?: CustomAttributes) => Entitlement;
|
|
9
|
-
/**
|
|
10
|
-
@param key permission key
|
|
11
|
-
@param customAttributes user attributes
|
|
12
|
-
@returns if the user is entitled to the given permission and attributes. Attaching the justification if not
|
|
13
|
-
*/
|
|
14
|
-
export declare const usePermissionEntitlements: (key: string, customAttributes?: CustomAttributes) => Entitlement;
|
|
15
|
-
/**
|
|
16
|
-
@param options
|
|
17
|
-
@param customAttributes user attributes
|
|
18
|
-
@returns if the user is entitled to the given feature or permission and attributes (check only one). Attaching the justification if not
|
|
19
|
-
*/
|
|
20
|
-
export declare const useEntitlements: (options: EntitledToOptions, customAttributes?: CustomAttributes) => Entitlement;
|
|
21
|
-
/**
|
|
22
|
-
@returns an action your can use to detect if the user is entitled to the given feature or permission (check only one).
|
|
23
|
-
Attaching the justification if not
|
|
24
|
-
*/
|
|
3
|
+
export declare const useFeatureEntitlements: (key: string, custom?: CustomAttributes) => Entitlement;
|
|
4
|
+
export declare const usePermissionEntitlements: (key: string, custom?: CustomAttributes) => Entitlement;
|
|
5
|
+
export declare const useEntitlements: (opts: EntitledToOptions, custom?: CustomAttributes) => Entitlement;
|
|
25
6
|
export declare const useEntitlementsActions: () => {
|
|
26
|
-
isEntitledTo: (options: EntitledToOptions,
|
|
7
|
+
isEntitledTo: (options: EntitledToOptions, custom?: CustomAttributes) => Entitlement;
|
|
27
8
|
};
|
|
28
9
|
/**
|
|
29
10
|
@returns if the option to use entitlements is enabled
|
|
30
11
|
*/
|
|
31
12
|
export declare const useEntitlementsOptions: () => {
|
|
32
13
|
isEntitlementsEnabled: boolean;
|
|
33
|
-
isEntitledTo: (
|
|
14
|
+
isEntitledTo: (o: EntitledToOptions, c?: CustomAttributes) => Entitlement;
|
|
34
15
|
verifyIsEntitledFF: boolean;
|
|
35
16
|
};
|
package/auth/entitlements.js
CHANGED
|
@@ -1,112 +1,80 @@
|
|
|
1
|
-
import { useAuthUserOrNull } from './hooks';
|
|
2
1
|
import { useMemo } from 'react';
|
|
2
|
+
import { getEntitlements, getFeatureEntitlements, getPermissionEntitlements } from '@frontegg/redux-store';
|
|
3
|
+
import { useAuthUserOrNull } from './hooks';
|
|
3
4
|
import { useRootState, useShadowDom } from '../common';
|
|
4
5
|
import { useFeatureFlags } from '../flags';
|
|
5
6
|
import { useStore } from '../FronteggStoreContext';
|
|
6
7
|
import { useSnapshot } from '../useSnapshot';
|
|
7
|
-
import { getEntitlements, getFeatureEntitlements, getPermissionEntitlements } from '@frontegg/redux-store';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @returns entitlements state as stored in the user
|
|
11
|
-
*/
|
|
9
|
+
/** Current entitlements object (or empty) */
|
|
12
10
|
const useEntitlementsState = () => {
|
|
13
11
|
var _useSnapshot$user$ent, _useSnapshot$user;
|
|
14
|
-
|
|
15
|
-
return (_useSnapshot$user$ent = (_useSnapshot$user = useSnapshot(state).user) == null ? void 0 : _useSnapshot$user.entitlements) != null ? _useSnapshot$user$ent : {};
|
|
12
|
+
return (_useSnapshot$user$ent = (_useSnapshot$user = useSnapshot(useStore().store.auth).user) == null ? void 0 : _useSnapshot$user.entitlements) != null ? _useSnapshot$user$ent : {};
|
|
16
13
|
};
|
|
17
14
|
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
const useUserState = () => {
|
|
22
|
-
return useAuthUserOrNull() || undefined;
|
|
23
|
-
};
|
|
15
|
+
/** Currently logged-in user claims (or undefined) */
|
|
16
|
+
const useUserState = () => useAuthUserOrNull() || undefined;
|
|
24
17
|
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
* @returns is entitled query data including entitlement state and final attributes (consumer and frontegg)
|
|
28
|
-
*/
|
|
29
|
-
const useEntitlementsQueryData = customAttributes => {
|
|
18
|
+
/** Shared attributes object passed to the entitlement engine */
|
|
19
|
+
const useAttributes = custom => {
|
|
30
20
|
const user = useUserState();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
custom: customAttributes,
|
|
21
|
+
return useMemo(() => ({
|
|
22
|
+
custom,
|
|
34
23
|
jwt: user
|
|
35
|
-
};
|
|
36
|
-
return {
|
|
37
|
-
entitlements,
|
|
38
|
-
attributes
|
|
39
|
-
};
|
|
24
|
+
}), [custom, user]);
|
|
40
25
|
};
|
|
41
26
|
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
27
|
+
/** Single resolver so we don’t repeat switch-cases in every hook */
|
|
28
|
+
const resolveEntitlement = (variant, keyOrOpts, entitlements, attrs, appName) => {
|
|
29
|
+
switch (variant) {
|
|
30
|
+
case 'feature':
|
|
31
|
+
return getFeatureEntitlements(entitlements, keyOrOpts, attrs, undefined, appName);
|
|
32
|
+
case 'permission':
|
|
33
|
+
return getPermissionEntitlements(entitlements, keyOrOpts, attrs, undefined, appName);
|
|
34
|
+
default:
|
|
35
|
+
return getEntitlements(entitlements, keyOrOpts, attrs, undefined, appName);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export const useFeatureEntitlements = (key, custom) => {
|
|
39
|
+
const entitlements = useEntitlementsState();
|
|
40
|
+
const attrs = useAttributes(custom);
|
|
52
41
|
const {
|
|
53
42
|
appName
|
|
54
43
|
} = useRootState();
|
|
55
|
-
return
|
|
44
|
+
return resolveEntitlement('feature', key, entitlements, attrs, appName);
|
|
56
45
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
@param customAttributes user attributes
|
|
61
|
-
@returns if the user is entitled to the given permission and attributes. Attaching the justification if not
|
|
62
|
-
*/
|
|
63
|
-
export const usePermissionEntitlements = (key, customAttributes) => {
|
|
64
|
-
const {
|
|
65
|
-
entitlements,
|
|
66
|
-
attributes
|
|
67
|
-
} = useEntitlementsQueryData(customAttributes);
|
|
46
|
+
export const usePermissionEntitlements = (key, custom) => {
|
|
47
|
+
const entitlements = useEntitlementsState();
|
|
48
|
+
const attrs = useAttributes(custom);
|
|
68
49
|
const {
|
|
69
50
|
appName
|
|
70
51
|
} = useRootState();
|
|
71
|
-
return
|
|
52
|
+
return resolveEntitlement('permission', key, entitlements, attrs, appName);
|
|
72
53
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
@param customAttributes user attributes
|
|
77
|
-
@returns if the user is entitled to the given feature or permission and attributes (check only one). Attaching the justification if not
|
|
78
|
-
*/
|
|
79
|
-
export const useEntitlements = (options, customAttributes) => {
|
|
80
|
-
const {
|
|
81
|
-
entitlements,
|
|
82
|
-
attributes
|
|
83
|
-
} = useEntitlementsQueryData(customAttributes);
|
|
54
|
+
export const useEntitlements = (opts, custom) => {
|
|
55
|
+
const entitlements = useEntitlementsState();
|
|
56
|
+
const attrs = useAttributes(custom);
|
|
84
57
|
const {
|
|
85
58
|
appName
|
|
86
59
|
} = useRootState();
|
|
87
|
-
return
|
|
60
|
+
return resolveEntitlement('any', opts, entitlements, attrs, appName);
|
|
88
61
|
};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
@returns an action your can use to detect if the user is entitled to the given feature or permission (check only one).
|
|
92
|
-
Attaching the justification if not
|
|
93
|
-
*/
|
|
94
62
|
export const useEntitlementsActions = () => {
|
|
95
|
-
// this code is duplicated because React is yelling when using useEntitlementsQueryData inside the isEntitledTo function because it's not a hook
|
|
96
|
-
const user = useUserState();
|
|
97
63
|
const entitlements = useEntitlementsState();
|
|
98
64
|
const {
|
|
99
65
|
appName
|
|
100
66
|
} = useRootState();
|
|
67
|
+
const user = useUserState(); // stable referentially via useAuthUserOrNull
|
|
68
|
+
// Pre-compute attrs once so callers don’t need to worry
|
|
101
69
|
return useMemo(() => ({
|
|
102
|
-
isEntitledTo: (options,
|
|
103
|
-
const
|
|
104
|
-
custom
|
|
70
|
+
isEntitledTo: (options, custom) => {
|
|
71
|
+
const attrs = {
|
|
72
|
+
custom,
|
|
105
73
|
jwt: user
|
|
106
74
|
};
|
|
107
|
-
return getEntitlements(entitlements, options,
|
|
75
|
+
return getEntitlements(entitlements, options, attrs, undefined, appName);
|
|
108
76
|
}
|
|
109
|
-
}), [user,
|
|
77
|
+
}), [entitlements, user, appName]);
|
|
110
78
|
};
|
|
111
79
|
|
|
112
80
|
/**
|
package/auth/forgotPassword.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import { ForgotPasswordState
|
|
2
|
-
export declare
|
|
3
|
-
|
|
1
|
+
import type { ForgotPasswordState } from '@frontegg/redux-store';
|
|
2
|
+
export declare const useForgotPasswordState: <S = ForgotPasswordState>(selector?: (s: ForgotPasswordState) => S) => S, useForgotPasswordActions: () => {
|
|
3
|
+
setForgotPasswordState: (payload: Partial<ForgotPasswordState>) => void;
|
|
4
|
+
resetForgotPasswordState: () => void;
|
|
5
|
+
forgotPassword: (payload: import("@frontegg/redux-store").IForgotPasswordPayload) => Promise<void>;
|
|
6
|
+
resetPassword: (payload: import("@frontegg/redux-store").IResetPasswordPayload) => Promise<void>;
|
|
7
|
+
loadPasswordConfig: (payload?: import("dist/@frontegg/rest-api").IGetUserPasswordConfig) => Promise<void>;
|
|
8
|
+
determinePasswordRecoveryStrategy: (payload: import("@frontegg/redux-store").IDeterminePasswordRecoveryStrategyPayload) => Promise<void>;
|
|
9
|
+
sendPasswordRecoveryEmail: () => Promise<void>;
|
|
10
|
+
sendPasswordRecoverySms: () => Promise<void>;
|
|
11
|
+
verifyPasswordViaSms: (payload: import("@frontegg/redux-store").IVerifyPasswordViaSmsPayload) => Promise<void>;
|
|
12
|
+
};
|