@frontegg/react-hooks 7.0.0-alpha.1 → 7.0.0-alpha.3
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/FronteggProvider/FronteggProvider.d.ts +12 -0
- package/FronteggProvider/FronteggProvider.js +140 -0
- package/FronteggProvider/index.d.ts +1 -12
- package/FronteggProvider/index.js +1 -133
- package/FronteggStoreContext/FronteggStoreContext.d.ts +9 -0
- package/FronteggStoreContext/FronteggStoreContext.js +16 -0
- package/FronteggStoreContext/index.d.ts +1 -13
- package/FronteggStoreContext/index.js +1 -14
- package/audits/auditLogs.d.ts +2 -4
- package/audits/auditLogs.js +8 -6
- package/audits/auditsMetadata.d.ts +2 -4
- package/audits/auditsMetadata.js +8 -6
- package/audits/hooks.d.ts +0 -8
- package/audits/hooks.js +6 -30
- package/auth/acceptInvitation.js +10 -5
- package/auth/activateAccount.js +10 -4
- package/auth/{MSP/allAccounts.d.ts → allAccounts.d.ts} +2 -4
- package/auth/allAccounts.js +20 -0
- package/auth/apiTokens.d.ts +0 -2
- package/auth/apiTokens.js +8 -6
- package/auth/applications.d.ts +3 -0
- package/auth/applications.js +9 -0
- package/auth/customLogin.d.ts +2 -5
- package/auth/customLogin.js +10 -11
- package/auth/entitlements.d.ts +32 -13
- package/auth/entitlements.js +103 -21
- package/auth/forgotPassword.d.ts +0 -2
- package/auth/forgotPassword.js +8 -6
- package/auth/groups.d.ts +0 -4
- package/auth/groups.js +12 -13
- package/auth/hooks.d.ts +44 -12
- package/auth/hooks.js +73 -62
- package/auth/impersonate.d.ts +0 -2
- package/auth/impersonate.js +7 -6
- package/auth/index.d.ts +16 -16
- package/auth/index.js +16 -16
- package/auth/login.d.ts +1 -3
- package/auth/login.js +7 -6
- package/auth/mfa.d.ts +1 -1
- package/auth/mfa.js +13 -4
- package/auth/passkeys.d.ts +1 -4
- package/auth/passkeys.js +7 -6
- package/auth/profile.d.ts +2 -4
- package/auth/profile.js +9 -8
- package/auth/provisioning.d.ts +1 -3
- package/auth/provisioning.js +7 -6
- package/auth/resetPhoneNumber.d.ts +1 -3
- package/auth/resetPhoneNumber.js +7 -6
- package/auth/roles.d.ts +1 -3
- package/auth/roles.js +7 -6
- package/auth/security/index.d.ts +4 -0
- package/auth/security/index.js +4 -0
- package/auth/security/restrictions.d.ts +0 -2
- package/auth/security/restrictions.js +10 -10
- package/auth/security/securityCenter.d.ts +1 -4
- package/auth/security/securityCenter.js +8 -6
- package/auth/security/securityPolicy.d.ts +5 -11
- package/auth/security/securityPolicy.js +19 -30
- package/auth/security/sessionsPolicy.d.ts +1 -3
- package/auth/security/sessionsPolicy.js +8 -6
- package/auth/sessions.d.ts +1 -3
- package/auth/sessions.js +7 -6
- package/auth/signup.d.ts +1 -1
- package/auth/signup.js +13 -4
- package/auth/sms.d.ts +3 -0
- package/auth/sms.js +8 -0
- package/auth/socialLogin.d.ts +1 -1
- package/auth/socialLogin.js +10 -4
- package/auth/sso.d.ts +1 -1
- package/auth/sso.js +10 -4
- package/auth/stepUp.d.ts +16 -0
- package/auth/stepUp.js +51 -0
- package/auth/team.d.ts +9 -1
- package/auth/team.js +22 -4
- package/auth/tenants.d.ts +1 -3
- package/auth/tenants.js +8 -6
- package/common/CustomComponentHolder.js +3 -1
- package/common/index.d.ts +1 -0
- package/common/index.js +3 -3
- package/connectivity/hooks.d.ts +2 -5
- package/connectivity/hooks.js +6 -9
- package/index.d.ts +2 -2
- package/index.js +3 -3
- package/node/FronteggProvider/FronteggProvider.js +148 -0
- package/node/FronteggProvider/index.js +9 -134
- package/node/FronteggStoreContext/FronteggStoreContext.js +28 -0
- package/node/FronteggStoreContext/index.js +11 -35
- package/node/audits/auditLogs.js +8 -6
- package/node/audits/auditsMetadata.js +8 -6
- package/node/audits/hooks.js +7 -34
- package/node/auth/acceptInvitation.js +7 -5
- package/node/auth/activateAccount.js +7 -4
- package/node/auth/allAccounts.js +27 -0
- package/node/auth/apiTokens.js +8 -6
- package/node/auth/applications.js +17 -0
- package/node/auth/customLogin.js +11 -12
- package/node/auth/entitlements.js +106 -22
- package/node/auth/forgotPassword.js +8 -6
- package/node/auth/groups.js +12 -12
- package/node/auth/hooks.js +77 -67
- package/node/auth/impersonate.js +7 -6
- package/node/auth/index.js +107 -93
- package/node/auth/login.js +7 -6
- package/node/auth/mfa.js +10 -4
- package/node/auth/passkeys.js +7 -6
- package/node/auth/profile.js +10 -9
- package/node/auth/provisioning.js +7 -6
- package/node/auth/resetPhoneNumber.js +7 -6
- package/node/auth/roles.js +7 -6
- package/node/auth/security/index.js +49 -0
- package/node/auth/security/restrictions.js +10 -10
- package/node/auth/security/securityCenter.js +8 -6
- package/node/auth/security/securityPolicy.js +16 -30
- package/node/auth/security/sessionsPolicy.js +8 -6
- package/node/auth/sessions.js +7 -6
- package/node/auth/signup.js +10 -4
- package/node/auth/sms.js +16 -0
- package/node/auth/socialLogin.js +7 -4
- package/node/auth/sso.js +7 -4
- package/node/auth/stepUp.js +62 -0
- package/node/auth/team.js +25 -4
- package/node/auth/tenants.js +8 -6
- package/node/common/CustomComponentHolder.js +3 -1
- package/node/common/index.js +2 -2
- package/node/connectivity/hooks.js +5 -8
- package/node/index.js +16 -16
- package/node/subscriptions/hooks.js +84 -51
- package/node/tests/hooks.tsc-test.js +339 -0
- package/node/useSnapshot/index.js +137 -0
- package/node/vendor/hooks.js +5 -6
- package/package.json +3 -3
- package/subscriptions/hooks.d.ts +32 -10
- package/subscriptions/hooks.js +81 -49
- package/tests/hooks.tsc-test.js +338 -0
- package/useSnapshot/index.d.ts +78 -0
- package/useSnapshot/index.js +128 -0
- package/useSnapshot/package.json +6 -0
- package/vendor/hooks.d.ts +0 -1
- package/vendor/hooks.js +9 -7
- package/auth/MSP/allAccounts.js +0 -15
- package/node/auth/MSP/allAccounts.js +0 -24
package/vendor/hooks.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { VendorActions, VendorState } from '@frontegg/redux-store';
|
|
2
2
|
export declare type VendorStateMapper<S> = (state: VendorState) => S;
|
|
3
|
-
export declare type StateHookFunction<T> = (() => T) & (<S extends object>(mapper: (state: T) => S) => S);
|
|
4
3
|
export declare function useVendorState(): VendorState;
|
|
5
4
|
export declare function useVendorState<S>(stateMapper: VendorStateMapper<S>): S;
|
|
6
5
|
export declare const useVendorActions: () => VendorActions;
|
package/vendor/hooks.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useStore } from '../FronteggStoreContext';
|
|
2
|
+
import { useSnapshot } from '../useSnapshot';
|
|
3
|
+
|
|
4
|
+
// TODO: remove useless stateMapper, valtio already does this
|
|
5
|
+
|
|
5
6
|
const defaultMapper = state => state;
|
|
7
|
+
// @deprecated use useVendorState() instead
|
|
6
8
|
export function useVendorState(stateMapper = defaultMapper) {
|
|
7
|
-
|
|
9
|
+
const state = useStore().store.vendor;
|
|
10
|
+
return stateMapper(useSnapshot(state));
|
|
8
11
|
}
|
|
9
12
|
export const useVendorActions = () => {
|
|
10
|
-
|
|
11
|
-
return useMemo(() => bindActionCreators(vendorActions, dispatch), [vendorActions]);
|
|
13
|
+
return useStore().stateActions.vendor;
|
|
12
14
|
};
|
package/auth/MSP/allAccounts.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { allAccountsActions, allAccountsReducers, allAccountsDialogsReducers } from '@frontegg/redux-store';
|
|
2
|
-
import { reducerActionsGenerator, stateHookGenerator } from '../hooks';
|
|
3
|
-
const defaultMapper = state => state;
|
|
4
|
-
export function useAllAccountsState(stateMapper = defaultMapper) {
|
|
5
|
-
return stateHookGenerator(stateMapper, 'allAccountsState');
|
|
6
|
-
}
|
|
7
|
-
export const useAllAccountsActions = () => reducerActionsGenerator(allAccountsActions, allAccountsReducers);
|
|
8
|
-
|
|
9
|
-
//dialogs
|
|
10
|
-
|
|
11
|
-
const defaultDialogsMapper = state => state;
|
|
12
|
-
export function useAllAccountsDialogsState(stateMapper = defaultDialogsMapper) {
|
|
13
|
-
return stateHookGenerator(stateMapper, 'allAccountsDialogsState');
|
|
14
|
-
}
|
|
15
|
-
export const useAllAccountsDialogsActions = () => reducerActionsGenerator({}, allAccountsDialogsReducers);
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useAllAccountsDialogsActions = exports.useAllAccountsActions = void 0;
|
|
7
|
-
exports.useAllAccountsDialogsState = useAllAccountsDialogsState;
|
|
8
|
-
exports.useAllAccountsState = useAllAccountsState;
|
|
9
|
-
var _reduxStore = require("@frontegg/redux-store");
|
|
10
|
-
var _hooks = require("../hooks");
|
|
11
|
-
const defaultMapper = state => state;
|
|
12
|
-
function useAllAccountsState(stateMapper = defaultMapper) {
|
|
13
|
-
return (0, _hooks.stateHookGenerator)(stateMapper, 'allAccountsState');
|
|
14
|
-
}
|
|
15
|
-
const useAllAccountsActions = () => (0, _hooks.reducerActionsGenerator)(_reduxStore.allAccountsActions, _reduxStore.allAccountsReducers);
|
|
16
|
-
|
|
17
|
-
//dialogs
|
|
18
|
-
exports.useAllAccountsActions = useAllAccountsActions;
|
|
19
|
-
const defaultDialogsMapper = state => state;
|
|
20
|
-
function useAllAccountsDialogsState(stateMapper = defaultDialogsMapper) {
|
|
21
|
-
return (0, _hooks.stateHookGenerator)(stateMapper, 'allAccountsDialogsState');
|
|
22
|
-
}
|
|
23
|
-
const useAllAccountsDialogsActions = () => (0, _hooks.reducerActionsGenerator)({}, _reduxStore.allAccountsDialogsReducers);
|
|
24
|
-
exports.useAllAccountsDialogsActions = useAllAccountsDialogsActions;
|