@frontegg/react-hooks 7.78.0-alpha.1 → 7.78.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/audits/auditLogs.d.ts +3 -2
- package/audits/auditLogs.js +9 -8
- package/audits/auditsMetadata.d.ts +3 -2
- package/audits/auditsMetadata.js +9 -8
- package/audits/hooks.d.ts +9 -2
- package/audits/hooks.js +14 -10
- package/auth/acceptInvitation.d.ts +5 -7
- package/auth/acceptInvitation.js +13 -8
- package/auth/activateAccount.d.ts +5 -11
- package/auth/activateAccount.js +13 -8
- package/auth/allAccounts.d.ts +7 -47
- package/auth/allAccounts.js +20 -12
- package/auth/apiTokens.d.ts +3 -14
- package/auth/apiTokens.js +9 -8
- package/auth/applications.d.ts +3 -22
- package/auth/applications.js +9 -8
- package/auth/customLogin.d.ts +3 -9
- package/auth/customLogin.js +12 -9
- package/auth/entitlements.d.ts +25 -6
- package/auth/entitlements.js +73 -41
- package/auth/forgotPassword.d.ts +3 -12
- package/auth/forgotPassword.js +9 -10
- package/auth/groups.d.ts +5 -32
- package/auth/groups.js +14 -14
- package/auth/impersonate.d.ts +3 -6
- package/auth/impersonate.js +8 -8
- package/auth/login.d.ts +3 -74
- package/auth/login.js +8 -8
- package/auth/passkeys.d.ts +3 -10
- package/auth/passkeys.js +8 -8
- package/auth/passwordRotation.d.ts +3 -4
- package/auth/passwordRotation.js +9 -8
- package/auth/profile.d.ts +3 -19
- package/auth/profile.js +12 -17
- package/auth/provisioning.d.ts +3 -20
- package/auth/provisioning.js +8 -8
- package/auth/resetPhoneNumber.d.ts +3 -8
- package/auth/resetPhoneNumber.js +8 -8
- package/auth/roles.d.ts +3 -14
- package/auth/roles.js +8 -8
- package/auth/security/restrictions.d.ts +3 -21
- package/auth/security/restrictions.js +19 -20
- package/auth/security/securityCenter.d.ts +3 -15
- package/auth/security/securityCenter.js +9 -8
- package/auth/security/securityPolicy.d.ts +5 -35
- package/auth/security/securityPolicy.js +18 -16
- package/auth/security/sessionsPolicy.d.ts +3 -7
- package/auth/security/sessionsPolicy.js +9 -8
- package/auth/sessions.d.ts +3 -12
- package/auth/sessions.js +8 -8
- package/auth/signup.d.ts +5 -10
- package/auth/signup.js +16 -8
- package/auth/sms.d.ts +3 -13
- package/auth/sms.js +8 -8
- package/auth/socialLogin.d.ts +5 -9
- package/auth/socialLogin.js +13 -8
- package/auth/sso.d.ts +6 -31
- package/auth/sso.js +13 -8
- package/auth/stepUp.d.ts +14 -15
- package/auth/stepUp.js +22 -9
- package/auth/team.d.ts +13 -84
- package/auth/team.js +23 -12
- package/auth/tenants.d.ts +3 -9
- package/auth/tenants.js +9 -8
- package/auth/unlockAccount.d.ts +5 -6
- package/auth/unlockAccount.js +10 -8
- package/auth/usernames.d.ts +3 -7
- package/auth/usernames.js +8 -8
- package/auth/usersEmailsPolicyState.d.ts +5 -5
- package/auth/usersEmailsPolicyState.js +10 -8
- package/connectivity/hooks.d.ts +3 -41
- package/connectivity/hooks.js +9 -8
- package/index.js +1 -1
- package/node/audits/auditLogs.js +12 -11
- package/node/audits/auditsMetadata.js +12 -11
- package/node/audits/hooks.js +17 -13
- package/node/auth/acceptInvitation.js +13 -11
- package/node/auth/activateAccount.js +13 -11
- package/node/auth/allAccounts.js +20 -15
- package/node/auth/apiTokens.js +12 -11
- package/node/auth/applications.js +12 -11
- package/node/auth/customLogin.js +15 -11
- package/node/auth/entitlements.js +73 -41
- package/node/auth/forgotPassword.js +12 -13
- package/node/auth/groups.js +17 -17
- package/node/auth/impersonate.js +11 -11
- package/node/auth/login.js +11 -11
- package/node/auth/passkeys.js +11 -11
- package/node/auth/passwordRotation.js +12 -11
- package/node/auth/profile.js +13 -19
- package/node/auth/provisioning.js +11 -11
- package/node/auth/resetPhoneNumber.js +11 -11
- package/node/auth/roles.js +11 -11
- package/node/auth/security/restrictions.js +21 -22
- package/node/auth/security/securityCenter.js +12 -11
- package/node/auth/security/securityPolicy.js +17 -18
- package/node/auth/security/sessionsPolicy.js +12 -11
- package/node/auth/sessions.js +11 -11
- package/node/auth/signup.js +16 -11
- package/node/auth/sms.js +11 -11
- package/node/auth/socialLogin.js +13 -11
- package/node/auth/sso.js +13 -11
- package/node/auth/stepUp.js +24 -11
- package/node/auth/team.js +28 -16
- package/node/auth/tenants.js +12 -11
- package/node/auth/unlockAccount.js +13 -11
- package/node/auth/usernames.js +11 -11
- package/node/auth/usersEmailsPolicyState.js +13 -11
- package/node/connectivity/hooks.js +12 -11
- package/node/index.js +1 -1
- package/node/subscriptions/hooks.js +115 -86
- package/node/vendor/hooks.js +14 -11
- package/package.json +3 -3
- package/subscriptions/hooks.d.ts +22 -48
- package/subscriptions/hooks.js +103 -77
- package/vendor/hooks.d.ts +5 -2
- package/vendor/hooks.js +14 -8
- package/node/useSnapshot/hookFactory.js +0 -32
- package/useSnapshot/hookFactory.d.ts +0 -18
- package/useSnapshot/hookFactory.js +0 -26
package/audits/auditLogs.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare
|
|
1
|
+
import { AuditLogsState, AuditsActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useAuditLogsState(): AuditLogsState;
|
|
3
|
+
export declare const useAuditLogsActions: () => AuditsActions;
|
package/audits/auditLogs.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
export function useAuditLogsState() {
|
|
4
|
+
const state = useStore().store.auditLogs.auditLogsState;
|
|
5
|
+
return useSnapshot(state);
|
|
6
|
+
}
|
|
7
|
+
export const useAuditLogsActions = () => {
|
|
8
|
+
return useStore().stateActions.auditLogs;
|
|
9
|
+
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare
|
|
1
|
+
import { AuditsActions, AuditsMetadataState } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useAuditsMetadataState(): AuditsMetadataState;
|
|
3
|
+
export declare const useAuditsMetadataActions: () => AuditsActions;
|
package/audits/auditsMetadata.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
export function useAuditsMetadataState() {
|
|
4
|
+
const state = useStore().store.auditLogs.auditsMetadataState;
|
|
5
|
+
return useSnapshot(state);
|
|
6
|
+
}
|
|
7
|
+
export const useAuditsMetadataActions = () => {
|
|
8
|
+
return useStore().stateActions.auditLogs;
|
|
9
|
+
};
|
package/audits/hooks.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
1
|
+
import { AuditsActions, AuditsState } from '@frontegg/redux-store';
|
|
2
|
+
export type AuditsMapper = {
|
|
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;
|
package/audits/hooks.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
const defaultMapper = {
|
|
4
|
+
state: state => state,
|
|
5
|
+
actions: actions => actions
|
|
6
|
+
};
|
|
7
|
+
export function useAuditsState(stateMapper = defaultMapper.state) {
|
|
8
|
+
const state = useStore().store.auditLogs;
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
return stateMapper(useSnapshot(state));
|
|
11
|
+
}
|
|
12
|
+
export const useAuditsActions = () => {
|
|
13
|
+
return useStore().stateActions.auditLogs;
|
|
14
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
acceptInvitationWithOTC: (payload: import("dist/@frontegg/rest-api").IAcceptInvitationWithOTC) => Promise<void>;
|
|
7
|
-
};
|
|
1
|
+
import { AcceptInvitationState, AcceptInvitationActions } from '@frontegg/redux-store';
|
|
2
|
+
export type AcceptInvitationStateMapper<S> = (state: AcceptInvitationState) => S;
|
|
3
|
+
export declare function useAcceptInvitationState(): AcceptInvitationState;
|
|
4
|
+
export declare function useAcceptInvitationState<S>(stateMapper: AcceptInvitationStateMapper<S>): S;
|
|
5
|
+
export declare const useAcceptInvitationActions: () => AcceptInvitationActions;
|
package/auth/acceptInvitation.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
|
|
4
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
5
|
+
|
|
6
|
+
const defaultMapper = state => state;
|
|
7
|
+
export function useAcceptInvitationState(stateMapper = defaultMapper) {
|
|
8
|
+
const state = useStore().store.auth.acceptInvitationState;
|
|
9
|
+
return stateMapper(useSnapshot(state));
|
|
10
|
+
}
|
|
11
|
+
export const useAcceptInvitationActions = () => {
|
|
12
|
+
return useStore().stateActions.auth.acceptInvitationActions;
|
|
13
|
+
};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
};
|
|
1
|
+
import { ActivateAccountState, ActivateAccountActions } from '@frontegg/redux-store';
|
|
2
|
+
export type ActivateAccountStateMapper<S> = (state: ActivateAccountState) => S;
|
|
3
|
+
export declare function useActivateAccountState(): ActivateAccountState;
|
|
4
|
+
export declare function useActivateAccountState<S>(stateMapper: ActivateAccountStateMapper<S>): S;
|
|
5
|
+
export declare const useActivateAccountActions: () => ActivateAccountActions;
|
package/auth/activateAccount.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
|
|
4
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
5
|
+
|
|
6
|
+
const defaultMapper = state => state;
|
|
7
|
+
export function useActivateAccountState(stateMapper = defaultMapper) {
|
|
8
|
+
const state = useStore().store.auth.activateAccountState;
|
|
9
|
+
return stateMapper(useSnapshot(state));
|
|
10
|
+
}
|
|
11
|
+
export const useActivateAccountActions = () => {
|
|
12
|
+
return useStore().stateActions.auth.activateAccountActions;
|
|
13
|
+
};
|
package/auth/allAccounts.d.ts
CHANGED
|
@@ -1,47 +1,7 @@
|
|
|
1
|
-
import { IAllAccountsState, IAllAccountsDialogsState } from '@frontegg/redux-store';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
};
|
|
1
|
+
import { IAllAccountsState, AllAccountsActions, IAllAccountsDialogsState, AllAccountsDialogActions } from '@frontegg/redux-store';
|
|
2
|
+
export type AllAccountsStateMapper<S> = (state: IAllAccountsState) => S;
|
|
3
|
+
export declare function useAllAccountsState(): IAllAccountsState;
|
|
4
|
+
export declare function useAllAccountsState<S>(stateMapper: AllAccountsStateMapper<S>): S;
|
|
5
|
+
export declare const useAllAccountsActions: () => AllAccountsActions;
|
|
6
|
+
export declare function useAllAccountsDialogsState(): IAllAccountsDialogsState;
|
|
7
|
+
export declare const useAllAccountsDialogsActions: () => AllAccountsDialogActions;
|
package/auth/allAccounts.js
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
export function useAllAccountsState(stateMapper = defaultMapper) {
|
|
8
|
+
const state = useStore().store.auth.allAccountsState;
|
|
9
|
+
return stateMapper(useSnapshot(state));
|
|
10
|
+
}
|
|
11
|
+
export const useAllAccountsActions = () => {
|
|
12
|
+
return useStore().stateActions.auth.allAccountsActions;
|
|
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
|
+
};
|
package/auth/apiTokens.d.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare
|
|
3
|
-
|
|
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
|
-
};
|
|
1
|
+
import { ApiTokensActions, ApiTokensState } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useApiTokensState(): ApiTokensState;
|
|
3
|
+
export declare const useApiTokensActions: () => ApiTokensActions;
|
package/auth/apiTokens.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
export function useApiTokensState() {
|
|
4
|
+
const state = useStore().store.auth.apiTokensState;
|
|
5
|
+
return useSnapshot(state);
|
|
6
|
+
}
|
|
7
|
+
export const useApiTokensActions = () => {
|
|
8
|
+
return useStore().stateActions.auth.apiTokensActions;
|
|
9
|
+
};
|
package/auth/applications.d.ts
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare
|
|
3
|
-
|
|
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
|
-
};
|
|
1
|
+
import { ApplicationsActions, ApplicationsState } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useApplicationsState(): ApplicationsState;
|
|
3
|
+
export declare const useApplicationsActions: () => ApplicationsActions;
|
package/auth/applications.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
export function useApplicationsState() {
|
|
4
|
+
const state = useStore().store.auth.applicationsState;
|
|
5
|
+
return useSnapshot(state);
|
|
6
|
+
}
|
|
7
|
+
export const useApplicationsActions = () => {
|
|
8
|
+
return useStore().stateActions.auth.applicationsActions;
|
|
9
|
+
};
|
package/auth/customLogin.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare
|
|
3
|
-
|
|
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
|
-
};
|
|
1
|
+
import { CustomLoginState, CustomLoginActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useCustomLoginState(): CustomLoginState;
|
|
3
|
+
export declare const useCustomLoginActions: () => CustomLoginActions;
|
|
10
4
|
export declare const useCustomLoginTheme: () => {
|
|
11
5
|
customLoginTheme: any;
|
|
12
6
|
getCustomLoginThemeValue: (path?: string) => any;
|
package/auth/customLogin.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import getValue from 'get-value';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { useStore } from '../FronteggStoreContext';
|
|
4
|
+
import { useSnapshot } from '../useSnapshot';
|
|
5
|
+
export function useCustomLoginState() {
|
|
6
|
+
const state = useStore().store.auth.customLoginState;
|
|
7
|
+
return useSnapshot(state);
|
|
8
|
+
}
|
|
9
|
+
export const useCustomLoginActions = () => {
|
|
10
|
+
return useStore().stateActions.auth.customLoginActions;
|
|
11
|
+
};
|
|
11
12
|
export const useCustomLoginTheme = () => {
|
|
12
13
|
var _useCustomLoginState$, _useCustomLoginState$2, _useCustomLoginState$3;
|
|
13
14
|
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;
|
|
14
|
-
const getCustomLoginThemeValue = useCallback(path =>
|
|
15
|
+
const getCustomLoginThemeValue = useCallback(path => {
|
|
16
|
+
return path && customLoginTheme ? getValue(customLoginTheme, path) : customLoginTheme;
|
|
17
|
+
}, [customLoginTheme]);
|
|
15
18
|
return {
|
|
16
19
|
customLoginTheme,
|
|
17
20
|
getCustomLoginThemeValue
|
package/auth/entitlements.d.ts
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CustomAttributes } from '@frontegg/entitlements-javascript-commons';
|
|
2
2
|
import { EntitledToOptions, Entitlement } from '@frontegg/redux-store';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
@param key feature key
|
|
5
|
+
@param customAttributes user attributes
|
|
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
|
+
*/
|
|
6
25
|
export declare const useEntitlementsActions: () => {
|
|
7
|
-
isEntitledTo: (options: EntitledToOptions,
|
|
26
|
+
isEntitledTo: (options: EntitledToOptions, customAttributes?: CustomAttributes) => Entitlement;
|
|
8
27
|
};
|
|
9
28
|
/**
|
|
10
29
|
@returns if the option to use entitlements is enabled
|
|
11
30
|
*/
|
|
12
31
|
export declare const useEntitlementsOptions: () => {
|
|
13
32
|
isEntitlementsEnabled: boolean;
|
|
14
|
-
isEntitledTo: (
|
|
33
|
+
isEntitledTo: (options: EntitledToOptions, customAttributes?: CustomAttributes) => Entitlement;
|
|
15
34
|
verifyIsEntitledFF: boolean;
|
|
16
35
|
};
|
package/auth/entitlements.js
CHANGED
|
@@ -1,80 +1,112 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { getEntitlements, getFeatureEntitlements, getPermissionEntitlements } from '@frontegg/redux-store';
|
|
3
1
|
import { useAuthUserOrNull } from './hooks';
|
|
2
|
+
import { useMemo } from 'react';
|
|
4
3
|
import { useRootState, useShadowDom } from '../common';
|
|
5
4
|
import { useFeatureFlags } from '../flags';
|
|
6
5
|
import { useStore } from '../FronteggStoreContext';
|
|
7
6
|
import { useSnapshot } from '../useSnapshot';
|
|
7
|
+
import { getEntitlements, getFeatureEntitlements, getPermissionEntitlements } from '@frontegg/redux-store';
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* @returns entitlements state as stored in the user
|
|
11
|
+
*/
|
|
10
12
|
const useEntitlementsState = () => {
|
|
11
13
|
var _useSnapshot$user$ent, _useSnapshot$user;
|
|
12
|
-
|
|
14
|
+
const state = useStore().store.auth;
|
|
15
|
+
return (_useSnapshot$user$ent = (_useSnapshot$user = useSnapshot(state).user) == null ? void 0 : _useSnapshot$user.entitlements) != null ? _useSnapshot$user$ent : {};
|
|
13
16
|
};
|
|
14
17
|
|
|
15
|
-
/**
|
|
16
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @returns user state
|
|
20
|
+
*/
|
|
21
|
+
const useUserState = () => {
|
|
22
|
+
return useAuthUserOrNull() || undefined;
|
|
23
|
+
};
|
|
17
24
|
|
|
18
|
-
/**
|
|
19
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @param customAttributes user attributes
|
|
27
|
+
* @returns is entitled query data including entitlement state and final attributes (consumer and frontegg)
|
|
28
|
+
*/
|
|
29
|
+
const useEntitlementsQueryData = customAttributes => {
|
|
20
30
|
const user = useUserState();
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
const entitlements = useEntitlementsState();
|
|
32
|
+
const attributes = {
|
|
33
|
+
custom: customAttributes,
|
|
23
34
|
jwt: user
|
|
24
|
-
}
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
entitlements,
|
|
38
|
+
attributes
|
|
39
|
+
};
|
|
25
40
|
};
|
|
26
41
|
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
export const useFeatureEntitlements = (key, custom) => {
|
|
39
|
-
const entitlements = useEntitlementsState();
|
|
40
|
-
const attrs = useAttributes(custom);
|
|
42
|
+
/**
|
|
43
|
+
@param key feature key
|
|
44
|
+
@param customAttributes user attributes
|
|
45
|
+
@returns if the user is entitled to the given feature and attributes. Attaching the justification if not
|
|
46
|
+
*/
|
|
47
|
+
export const useFeatureEntitlements = (key, customAttributes) => {
|
|
48
|
+
const {
|
|
49
|
+
entitlements,
|
|
50
|
+
attributes
|
|
51
|
+
} = useEntitlementsQueryData(customAttributes);
|
|
41
52
|
const {
|
|
42
53
|
appName
|
|
43
54
|
} = useRootState();
|
|
44
|
-
return
|
|
55
|
+
return getFeatureEntitlements(entitlements, key, attributes, undefined, appName);
|
|
45
56
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
@param key permission key
|
|
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);
|
|
49
68
|
const {
|
|
50
69
|
appName
|
|
51
70
|
} = useRootState();
|
|
52
|
-
return
|
|
71
|
+
return getPermissionEntitlements(entitlements, key, attributes, undefined, appName);
|
|
53
72
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
@param options
|
|
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);
|
|
57
84
|
const {
|
|
58
85
|
appName
|
|
59
86
|
} = useRootState();
|
|
60
|
-
return
|
|
87
|
+
return getEntitlements(entitlements, options, attributes, undefined, appName);
|
|
61
88
|
};
|
|
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
|
+
*/
|
|
62
94
|
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();
|
|
63
97
|
const entitlements = useEntitlementsState();
|
|
64
98
|
const {
|
|
65
99
|
appName
|
|
66
100
|
} = useRootState();
|
|
67
|
-
const user = useUserState(); // stable referentially via useAuthUserOrNull
|
|
68
|
-
// Pre-compute attrs once so callers don’t need to worry
|
|
69
101
|
return useMemo(() => ({
|
|
70
|
-
isEntitledTo: (options,
|
|
71
|
-
const
|
|
72
|
-
custom,
|
|
102
|
+
isEntitledTo: (options, customAttributes) => {
|
|
103
|
+
const attributes = {
|
|
104
|
+
custom: customAttributes,
|
|
73
105
|
jwt: user
|
|
74
106
|
};
|
|
75
|
-
return getEntitlements(entitlements, options,
|
|
107
|
+
return getEntitlements(entitlements, options, attributes, undefined, appName);
|
|
76
108
|
}
|
|
77
|
-
}), [
|
|
109
|
+
}), [user, entitlements]);
|
|
78
110
|
};
|
|
79
111
|
|
|
80
112
|
/**
|
package/auth/forgotPassword.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare
|
|
3
|
-
|
|
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
|
-
};
|
|
1
|
+
import { ForgotPasswordState, ForgotPasswordActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare function useForgotPasswordState(): ForgotPasswordState;
|
|
3
|
+
export declare const useForgotPasswordActions: () => ForgotPasswordActions;
|