@frontegg/react-hooks 6.2.4 → 6.4.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.
- package/FronteggProvider.js +1 -3
- package/FronteggStoreContext.d.ts +11 -6
- package/FronteggStoreContext.js +3 -2
- package/audits/auditLogs.d.ts +3 -3
- package/audits/auditLogs.js +6 -1
- package/audits/auditsMetadata.d.ts +3 -3
- package/audits/auditsMetadata.js +7 -2
- package/audits/hooks.d.ts +7 -2
- package/audits/hooks.js +8 -8
- package/auth/acceptInvitation.d.ts +3 -3
- package/auth/acceptInvitation.js +6 -1
- package/auth/activateAccount.d.ts +3 -3
- package/auth/activateAccount.js +6 -1
- package/auth/apiTokens.d.ts +3 -3
- package/auth/apiTokens.js +6 -1
- package/auth/forgotPassword.d.ts +3 -3
- package/auth/forgotPassword.js +6 -1
- package/auth/hooks.d.ts +4 -4
- package/auth/hooks.js +2 -2
- package/auth/login.d.ts +3 -3
- package/auth/login.js +6 -1
- package/auth/mfa.d.ts +4 -2
- package/auth/mfa.js +6 -1
- package/auth/profile.d.ts +3 -3
- package/auth/profile.js +6 -1
- package/auth/resetPhoneNumber.d.ts +3 -3
- package/auth/resetPhoneNumber.js +6 -1
- package/auth/roles.d.ts +3 -3
- package/auth/roles.js +6 -1
- package/auth/securityPolicy.d.ts +3 -3
- package/auth/securityPolicy.js +6 -1
- package/auth/sessions.d.ts +3 -3
- package/auth/sessions.js +6 -1
- package/auth/sessionsPolicy.d.ts +4 -5
- package/auth/sessionsPolicy.js +6 -1
- package/auth/signup.d.ts +3 -3
- package/auth/signup.js +6 -1
- package/auth/socialLogin.d.ts +3 -3
- package/auth/socialLogin.js +6 -1
- package/auth/sso.d.ts +4 -2
- package/auth/sso.js +6 -1
- package/auth/team.d.ts +3 -3
- package/auth/team.js +6 -1
- package/auth/tenants.d.ts +3 -3
- package/auth/tenants.js +6 -1
- package/connectivity/hooks.d.ts +3 -2
- package/connectivity/hooks.js +5 -6
- package/index.js +1 -1
- package/node/FronteggProvider.js +1 -5
- package/node/FronteggStoreContext.js +4 -8
- package/node/audits/auditLogs.js +6 -3
- package/node/audits/auditsMetadata.js +8 -5
- package/node/audits/hooks.js +10 -10
- package/node/auth/acceptInvitation.js +6 -3
- package/node/auth/activateAccount.js +6 -3
- package/node/auth/apiTokens.js +6 -3
- package/node/auth/forgotPassword.js +6 -3
- package/node/auth/hooks.js +5 -5
- package/node/auth/login.js +6 -3
- package/node/auth/mfa.js +6 -3
- package/node/auth/profile.js +6 -3
- package/node/auth/resetPhoneNumber.js +6 -3
- package/node/auth/roles.js +6 -3
- package/node/auth/securityPolicy.js +6 -3
- package/node/auth/sessions.js +6 -3
- package/node/auth/sessionsPolicy.js +6 -3
- package/node/auth/signup.js +6 -3
- package/node/auth/socialLogin.js +6 -3
- package/node/auth/sso.js +6 -3
- package/node/auth/team.js +6 -3
- package/node/auth/tenants.js +6 -3
- package/node/connectivity/hooks.js +6 -9
- package/node/index.js +1 -1
- package/node/vendor/hooks.js +6 -9
- package/package.json +4 -4
- package/vendor/hooks.d.ts +3 -2
- package/vendor/hooks.js +5 -6
package/FronteggProvider.js
CHANGED
|
@@ -2,14 +2,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["authenticatedUrl", "signUpSuccessUrl"];
|
|
4
4
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
-
import { Provider as ReduxProvider } from 'react-redux';
|
|
6
5
|
import { createFronteggStore } from '@frontegg/redux-store';
|
|
7
6
|
import { ContextHolder } from '@frontegg/rest-api';
|
|
8
7
|
import { useAuth, useAuthRoutes } from './auth';
|
|
9
|
-
import { FronteggStoreContext } from './FronteggStoreContext';
|
|
8
|
+
import { Provider, FronteggStoreContext } from './FronteggStoreContext';
|
|
10
9
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const Provider = ReduxProvider;
|
|
13
11
|
|
|
14
12
|
const setLoading = loading => {
|
|
15
13
|
const isSSR = typeof document === 'undefined' || typeof window === 'undefined';
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ReactReduxContextValue } from 'react-redux';
|
|
3
|
-
|
|
1
|
+
import React, { FC, ReactNode } from 'react';
|
|
2
|
+
import { ReactReduxContextValue, ProviderProps } from 'react-redux';
|
|
3
|
+
import type { Action, AnyAction } from '@frontegg/redux-store';
|
|
4
|
+
export declare const FronteggStoreContext: React.Context<ReactReduxContextValue<any, AnyAction>>;
|
|
4
5
|
export declare const useSelector: <Selected extends unknown>(selector: (state: any) => Selected, equalityFn?: ((previous: Selected, next: Selected) => boolean) | undefined) => Selected;
|
|
5
|
-
export declare const useDispatch: () => import("redux").Dispatch<
|
|
6
|
-
export declare const useStore: () => import("redux").Store<any,
|
|
7
|
-
export { shallowEqual,
|
|
6
|
+
export declare const useDispatch: () => import("redux").Dispatch<AnyAction>;
|
|
7
|
+
export declare const useStore: () => import("redux").Store<any, AnyAction>;
|
|
8
|
+
export { shallowEqual, Provider as ReactReduxProvider } from 'react-redux';
|
|
9
|
+
declare type ProviderWithChildren<A extends Action = AnyAction> = FC<ProviderProps<A> & {
|
|
10
|
+
children?: ReactNode | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const Provider: ProviderWithChildren;
|
|
8
13
|
export default FronteggStoreContext;
|
package/FronteggStoreContext.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { createSelectorHook, createDispatchHook, createStoreHook } from 'react-redux';
|
|
2
|
+
import { createSelectorHook, createDispatchHook, createStoreHook, Provider as ReactReduxProvider } from 'react-redux';
|
|
3
3
|
export const FronteggStoreContext = /*#__PURE__*/React.createContext(null); // @ts-ignore
|
|
4
4
|
|
|
5
5
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -9,5 +9,6 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
9
9
|
export const useSelector = createSelectorHook(FronteggStoreContext);
|
|
10
10
|
export const useDispatch = createDispatchHook(FronteggStoreContext);
|
|
11
11
|
export const useStore = createStoreHook(FronteggStoreContext);
|
|
12
|
-
export { shallowEqual,
|
|
12
|
+
export { shallowEqual, Provider as ReactReduxProvider } from 'react-redux';
|
|
13
|
+
export const Provider = ReactReduxProvider;
|
|
13
14
|
export default FronteggStoreContext;
|
package/audits/auditLogs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StateHookFunction } from './hooks';
|
|
2
1
|
import { AuditLogsActions, AuditLogsState } from '@frontegg/redux-store';
|
|
3
|
-
export declare type AuditLogsStateMapper<S
|
|
4
|
-
export declare
|
|
2
|
+
export declare type AuditLogsStateMapper<S> = (state: AuditLogsState) => S;
|
|
3
|
+
export declare function useAuditLogsState(): AuditLogsState;
|
|
4
|
+
export declare function useAuditLogsState<S>(stateMapper: AuditLogsStateMapper<S>): S;
|
|
5
5
|
export declare const useAuditLogsActions: () => AuditLogsActions;
|
package/audits/auditLogs.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
2
2
|
import { auditLogsActions, auditLogsReducers } from '@frontegg/redux-store';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useAuditLogsState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'auditLogsState');
|
|
8
|
+
}
|
|
4
9
|
export const useAuditLogsActions = () => reducerActionsGenerator(auditLogsActions, auditLogsReducers);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StateHookFunction } from './hooks';
|
|
2
1
|
import { AuditsMetadataActions, AuditsMetadataState } from '@frontegg/redux-store';
|
|
3
|
-
export declare type AuditsMetadataStateMapper<S
|
|
4
|
-
export declare
|
|
2
|
+
export declare type AuditsMetadataStateMapper<S> = (state: AuditsMetadataState) => S;
|
|
3
|
+
export declare function useAuditsMetadataState(): AuditsMetadataState;
|
|
4
|
+
export declare function useAuditsMetadataState<S>(stateMapper: AuditsMetadataStateMapper<S>): S;
|
|
5
5
|
export declare const useAuditsMetadataActions: () => AuditsMetadataActions;
|
package/audits/auditsMetadata.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
2
1
|
import { auditsMetadataActions, auditsMetadataReducers } from '@frontegg/redux-store';
|
|
3
|
-
|
|
2
|
+
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useAuditsMetadataState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'auditsMetadataState');
|
|
8
|
+
}
|
|
4
9
|
export const useAuditsMetadataActions = () => reducerActionsGenerator(auditsMetadataActions, auditsMetadataReducers);
|
package/audits/hooks.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { CaseReducerActions, SliceCaseReducers } from '@frontegg/redux-store';
|
|
2
2
|
import { AuditsActions, AuditsState } from '@frontegg/redux-store';
|
|
3
|
-
export declare type
|
|
3
|
+
export declare type AuditsMapper = {
|
|
4
|
+
state: (state: AuditsState) => any;
|
|
5
|
+
actions: (actions: AuditsActions) => any;
|
|
6
|
+
};
|
|
4
7
|
export declare type StateHookFunction<T> = (() => T) & (<S extends object>(mapper: (state: T) => S) => S);
|
|
5
|
-
export declare
|
|
8
|
+
export declare type AuditsStateMapper<S> = (state: AuditsState) => S;
|
|
9
|
+
export declare function useAuditsState(): AuditsState;
|
|
10
|
+
export declare function useAuditsState<S>(stateMapper: AuditsStateMapper<S>): S;
|
|
6
11
|
export declare const useAuditsActions: () => AuditsActions;
|
|
7
12
|
/**
|
|
8
13
|
* hooks helpers
|
package/audits/hooks.js
CHANGED
|
@@ -4,13 +4,13 @@ import { bindActionCreators } from '@frontegg/redux-store';
|
|
|
4
4
|
import { shallowEqual } from 'react-redux';
|
|
5
5
|
import { useSelector, useDispatch } from '../FronteggStoreContext';
|
|
6
6
|
import { auditsActions, auditsStoreName } from '@frontegg/redux-store';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return (_stateMapper = stateMapper == null ? void 0 : stateMapper(state[auditsStoreName])) != null ? _stateMapper : state[auditsStoreName];
|
|
12
|
-
}, shallowEqual);
|
|
7
|
+
const defaultMapper = {
|
|
8
|
+
state: state => state,
|
|
9
|
+
actions: actions => actions
|
|
13
10
|
};
|
|
11
|
+
export function useAuditsState(stateMapper = defaultMapper.state) {
|
|
12
|
+
return useSelector(state => stateMapper(state[auditsStoreName]), shallowEqual);
|
|
13
|
+
}
|
|
14
14
|
export const useAuditsActions = () => {
|
|
15
15
|
const dispatch = useDispatch();
|
|
16
16
|
return useMemo(() => bindActionCreators(auditsActions, dispatch), [auditsActions]);
|
|
@@ -28,9 +28,9 @@ export const sliceReducerActionsBy = reducer => {
|
|
|
28
28
|
};
|
|
29
29
|
export const stateHookGenerator = (stateMapper, subState) => {
|
|
30
30
|
return useSelector(state => {
|
|
31
|
-
var
|
|
31
|
+
var _stateMapper;
|
|
32
32
|
|
|
33
|
-
return (
|
|
33
|
+
return (_stateMapper = stateMapper == null ? void 0 : stateMapper(state[auditsStoreName][subState])) != null ? _stateMapper : state[auditsStoreName][subState];
|
|
34
34
|
}, shallowEqual);
|
|
35
35
|
};
|
|
36
36
|
export const reducerActionsGenerator = (actions, reducers) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AcceptInvitationState, AcceptInvitationActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type AcceptInvitationStateMapper<S> = (state: AcceptInvitationState) => S;
|
|
3
|
+
export declare function useAcceptInvitationState(): AcceptInvitationState;
|
|
4
|
+
export declare function useAcceptInvitationState<S>(stateMapper: AcceptInvitationStateMapper<S>): S;
|
|
5
5
|
export declare const useAcceptInvitationActions: () => AcceptInvitationActions;
|
package/auth/acceptInvitation.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { acceptInvitationReducers, acceptInvitationActions } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useAcceptInvitationState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'acceptInvitationState');
|
|
8
|
+
}
|
|
4
9
|
export const useAcceptInvitationActions = () => reducerActionsGenerator(acceptInvitationActions, acceptInvitationReducers);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActivateAccountState, ActivateAccountActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type ActivateAccountStateMapper<S> = (state: ActivateAccountState) => S;
|
|
3
|
+
export declare function useActivateAccountState(): ActivateAccountState;
|
|
4
|
+
export declare function useActivateAccountState<S>(stateMapper: ActivateAccountStateMapper<S>): S;
|
|
5
5
|
export declare const useActivateAccountActions: () => ActivateAccountActions;
|
package/auth/activateAccount.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { activateAccountReducers, activateAccountActions } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useActivateAccountState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'activateState');
|
|
8
|
+
}
|
|
4
9
|
export const useActivateAccountActions = () => reducerActionsGenerator(activateAccountActions, activateAccountReducers);
|
package/auth/apiTokens.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiTokensActions, ApiTokensState } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type ApiTokensStateMapper<S> = (state: ApiTokensState) => S;
|
|
3
|
+
export declare function useApiTokensState(): ApiTokensState;
|
|
4
|
+
export declare function useApiTokensState<S>(stateMapper: ApiTokensStateMapper<S>): S;
|
|
5
5
|
export declare const useApiTokensActions: () => ApiTokensActions;
|
package/auth/apiTokens.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { apiTokensActions, apiTokensReducers } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useApiTokensState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'apiTokensState');
|
|
8
|
+
}
|
|
4
9
|
export const useApiTokensActions = () => reducerActionsGenerator(apiTokensActions, apiTokensReducers);
|
package/auth/forgotPassword.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ForgotPasswordState, ForgotPasswordActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type ForgotPasswordStateMapper<S> = (state: ForgotPasswordState) => S;
|
|
3
|
+
export declare function useForgotPasswordState(): ForgotPasswordState;
|
|
4
|
+
export declare function useForgotPasswordState<S>(stateMapper: ForgotPasswordStateMapper<S>): S;
|
|
5
5
|
export declare const useForgotPasswordActions: () => ForgotPasswordActions;
|
package/auth/forgotPassword.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { forgotPasswordReducers, forgotPasswordActions } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useForgotPasswordState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'forgotPasswordState');
|
|
8
|
+
}
|
|
4
9
|
export const useForgotPasswordActions = () => reducerActionsGenerator(forgotPasswordActions, forgotPasswordReducers);
|
package/auth/hooks.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ export declare type AuthMapper = {
|
|
|
5
5
|
state: (state: AuthState) => any;
|
|
6
6
|
actions: (actions: AuthActions) => any;
|
|
7
7
|
};
|
|
8
|
-
export declare type
|
|
9
|
-
export declare type
|
|
10
|
-
export declare
|
|
11
|
-
export declare
|
|
8
|
+
export declare type StateHookFunction<T> = (() => T) & (<S extends {}>(mapper: (state: T) => S) => S);
|
|
9
|
+
export declare type AuthStateMapper<S> = (state: AuthState) => S;
|
|
10
|
+
export declare function useAuth(): AuthState;
|
|
11
|
+
export declare function useAuth<S>(stateMapper: AuthStateMapper<S>): S;
|
|
12
12
|
/**
|
|
13
13
|
* ```jsx
|
|
14
14
|
* export const MyFunctionComponent = () => {
|
package/auth/hooks.js
CHANGED
|
@@ -10,9 +10,9 @@ const defaultMapper = {
|
|
|
10
10
|
state: state => state,
|
|
11
11
|
actions: actions => actions
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export function useAuth(stateMapper = defaultMapper.state) {
|
|
14
14
|
return useSelector(state => stateMapper(state[authStoreName]), shallowEqual);
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
/**
|
|
17
17
|
* ```jsx
|
|
18
18
|
* export const MyFunctionComponent = () => {
|
package/auth/login.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LoginState, LoginActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type LoginStateMapper<S> = (state: LoginState) => S;
|
|
3
|
+
export declare function useLoginState(): LoginState;
|
|
4
|
+
export declare function useLoginState<S>(stateMapper: LoginStateMapper<S>): S;
|
|
5
5
|
export declare const useLoginActions: () => LoginActions;
|
package/auth/login.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { loginReducers, loginActions } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useLoginState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'loginState');
|
|
8
|
+
}
|
|
4
9
|
export const useLoginActions = () => reducerActionsGenerator(loginActions, loginReducers);
|
package/auth/mfa.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { MfaActions, MFAState } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
2
|
+
declare type AuthMfaStateMapper<S> = (state: MFAState) => S;
|
|
3
|
+
export declare function useMfaState(): MFAState;
|
|
4
|
+
export declare function useMfaState<S>(stateMapper: AuthMfaStateMapper<S>): S;
|
|
4
5
|
export declare const useMfaActions: () => MfaActions;
|
|
6
|
+
export {};
|
package/auth/mfa.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { mfaActions, mfaReducers } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useMfaState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'mfaState');
|
|
8
|
+
}
|
|
4
9
|
export const useMfaActions = () => reducerActionsGenerator(mfaActions, mfaReducers);
|
package/auth/profile.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProfileActions, ProfileState } from '@frontegg/redux-store';
|
|
2
|
-
import { StateHookFunction } from './hooks';
|
|
3
2
|
export declare const reloadProfileIfNeeded: () => void;
|
|
4
|
-
export declare type ProfileStateMapper<S
|
|
5
|
-
export declare
|
|
3
|
+
export declare type ProfileStateMapper<S> = (state: ProfileState) => S;
|
|
4
|
+
export declare function useProfileState(): ProfileState;
|
|
5
|
+
export declare function useProfileState<S>(stateMapper: ProfileStateMapper<S>): S;
|
|
6
6
|
export declare const useProfileActions: () => ProfileActions;
|
package/auth/profile.js
CHANGED
|
@@ -12,5 +12,10 @@ export const reloadProfileIfNeeded = () => {
|
|
|
12
12
|
!loading && loadProfile();
|
|
13
13
|
}, []);
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
const defaultMapper = state => state;
|
|
17
|
+
|
|
18
|
+
export function useProfileState(stateMapper = defaultMapper) {
|
|
19
|
+
return stateHookGenerator(stateMapper, 'profileState');
|
|
20
|
+
}
|
|
16
21
|
export const useProfileActions = () => reducerActionsGenerator(profileActions, profileReducers);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResetPhoneNumberState, ResetPhoneNumberActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type ResetPhoneNumberStateMapper<S> = (state: ResetPhoneNumberState) => S;
|
|
3
|
+
export declare function useResetPhoneNumberState(): ResetPhoneNumberState;
|
|
4
|
+
export declare function useResetPhoneNumberState<S>(stateMapper: ResetPhoneNumberStateMapper<S>): S;
|
|
5
5
|
export declare const useResetPhoneNumberActions: () => ResetPhoneNumberActions;
|
package/auth/resetPhoneNumber.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { resetPhoneNumberReducers, resetPhoneNumberActions } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useResetPhoneNumberState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'resetPhoneNumberState');
|
|
8
|
+
}
|
|
4
9
|
export const useResetPhoneNumberActions = () => reducerActionsGenerator(resetPhoneNumberActions, resetPhoneNumberReducers);
|
package/auth/roles.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RolesActions, RolesState } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type RolesStateMapper<S> = (state: RolesState) => S;
|
|
3
|
+
export declare function useRolesState(): RolesState;
|
|
4
|
+
export declare function useRolesState<S>(stateMapper: RolesStateMapper<S>): S;
|
|
5
5
|
export declare const useRolesActions: () => RolesActions;
|
package/auth/roles.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { rolesReducers, rolesActions } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useRolesState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'rolesState');
|
|
8
|
+
}
|
|
4
9
|
export const useRolesActions = () => reducerActionsGenerator(rolesActions, rolesReducers);
|
package/auth/securityPolicy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SecurityPolicyActions, SecurityPolicyState } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type SecurityPolicyStateMapper<S> = (state: SecurityPolicyState) => S;
|
|
3
|
+
export declare function useSecurityPolicyState(): SecurityPolicyState;
|
|
4
|
+
export declare function useSecurityPolicyState<S>(stateMapper: SecurityPolicyStateMapper<S>): S;
|
|
5
5
|
export declare const useSecurityPolicyActions: () => SecurityPolicyActions;
|
|
6
6
|
export declare const usePublicPolicySettings: (loadOnMount?: boolean) => {
|
|
7
7
|
loading: boolean;
|
package/auth/securityPolicy.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { securityPolicyActions, securityPolicyReducers } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
const defaultMapper = state => state;
|
|
6
|
+
|
|
7
|
+
export function useSecurityPolicyState(stateMapper = defaultMapper) {
|
|
8
|
+
return stateHookGenerator(stateMapper, 'securityPolicyState');
|
|
9
|
+
}
|
|
5
10
|
export const useSecurityPolicyActions = () => reducerActionsGenerator(securityPolicyActions, securityPolicyReducers);
|
|
6
11
|
export const usePublicPolicySettings = (loadOnMount = false) => {
|
|
7
12
|
const {
|
package/auth/sessions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SessionsState, SessionsActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type SessionsStateMapper<S> = (state: SessionsState) => S;
|
|
3
|
+
export declare function useSessionsState(): SessionsState;
|
|
4
|
+
export declare function useSessionsState<S>(stateMapper: SessionsStateMapper<S>): S;
|
|
5
5
|
export declare const useSessionsActions: () => SessionsActions;
|
package/auth/sessions.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { sessionsActions, sessionsReducers } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useSessionsState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'sessionsState');
|
|
8
|
+
}
|
|
4
9
|
export const useSessionsActions = () => reducerActionsGenerator(sessionsActions, sessionsReducers);
|
package/auth/sessionsPolicy.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { SessionsPolicyActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare
|
|
5
|
-
export declare const useSessionsPolicyState: StateHookFunction<SessionsPolicyState>;
|
|
1
|
+
import { SessionsPolicyState, SessionsPolicyActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare type SessionsPolicyStateMapper<S> = (state: SessionsPolicyState) => S;
|
|
3
|
+
export declare function useSessionsPolicyState(): SessionsPolicyState;
|
|
4
|
+
export declare function useSessionsPolicyState<S>(stateMapper: SessionsPolicyStateMapper<S>): S;
|
|
6
5
|
export declare const useSessionsPolicyActions: () => SessionsPolicyActions;
|
package/auth/sessionsPolicy.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { sessionsPolicyActions, sessionsPolicyReducers } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useSessionsPolicyState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'sessionsPolicyState');
|
|
8
|
+
}
|
|
4
9
|
export const useSessionsPolicyActions = () => reducerActionsGenerator(sessionsPolicyActions, sessionsPolicyReducers);
|
package/auth/signup.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SignUpState, SignUpActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type SignUpStateMapper<S> = (state: SignUpState) => S;
|
|
3
|
+
export declare function useSignUpState(): SignUpState;
|
|
4
|
+
export declare function useSignUpState<S>(stateMapper: SignUpStateMapper<S>): S;
|
|
5
5
|
export declare const useSignUpActions: () => SignUpActions;
|
package/auth/signup.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { signUpReducers, signUpActions } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useSignUpState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'signUpState');
|
|
8
|
+
}
|
|
4
9
|
export const useSignUpActions = () => reducerActionsGenerator(signUpActions, signUpReducers);
|
package/auth/socialLogin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SocialLoginActions, SocialLoginState } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type SocialLoginStateMapper<S> = (state: SocialLoginState) => S;
|
|
3
|
+
export declare function useSocialLoginState(): SocialLoginState;
|
|
4
|
+
export declare function useSocialLoginState<S>(stateMapper: SocialLoginStateMapper<S>): S;
|
|
5
5
|
export declare const useSocialLoginActions: () => SocialLoginActions;
|
package/auth/socialLogin.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { socialLoginsActions, socialLoginsReducer } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useSocialLoginState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'socialLoginState');
|
|
8
|
+
}
|
|
4
9
|
export const useSocialLoginActions = () => reducerActionsGenerator(socialLoginsActions, socialLoginsReducer);
|
package/auth/sso.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SSOState, SSOActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
2
|
+
declare type AuthSSOStateMapper<S> = (state: SSOState) => S;
|
|
3
|
+
export declare function useSSOState(): SSOState;
|
|
4
|
+
export declare function useSSOState<S>(stateMapper: AuthSSOStateMapper<S>): S;
|
|
4
5
|
export declare const useSSOActions: () => SSOActions;
|
|
6
|
+
export {};
|
package/auth/sso.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { ssoActions, ssoReducers } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useSSOState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'ssoState');
|
|
8
|
+
}
|
|
4
9
|
export const useSSOActions = () => reducerActionsGenerator(ssoActions, ssoReducers);
|
package/auth/team.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TeamState, TeamActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type AuthTeamStateMapper<S> = (state: TeamState) => S;
|
|
3
|
+
export declare function useAuthTeamState(): TeamState;
|
|
4
|
+
export declare function useAuthTeamState<S>(stateMapper: AuthTeamStateMapper<S>): S;
|
|
5
5
|
export declare const useAuthTeamActions: () => TeamActions;
|
package/auth/team.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { teamActions, teamReducers } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useAuthTeamState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'teamState');
|
|
8
|
+
}
|
|
4
9
|
export const useAuthTeamActions = () => reducerActionsGenerator(teamActions, teamReducers);
|
package/auth/tenants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TenantsState, TenantsActions } from '@frontegg/redux-store';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
2
|
+
export declare type TenantsStateMapper<S> = (state: TenantsState) => S;
|
|
3
|
+
export declare function useTenantsState(): TenantsState;
|
|
4
|
+
export declare function useTenantsState<S>(stateMapper: TenantsStateMapper<S>): S;
|
|
5
5
|
export declare const useTenantsActions: () => TenantsActions;
|
package/auth/tenants.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { tenantsActions, tenantsReducers } from '@frontegg/redux-store';
|
|
2
2
|
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const defaultMapper = state => state;
|
|
5
|
+
|
|
6
|
+
export function useTenantsState(stateMapper = defaultMapper) {
|
|
7
|
+
return stateHookGenerator(stateMapper, 'tenantsState');
|
|
8
|
+
}
|
|
4
9
|
export const useTenantsActions = () => reducerActionsGenerator(tenantsActions, tenantsReducers);
|
package/connectivity/hooks.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ConnectivityActions, IConnectivityState } from '@frontegg/redux-store';
|
|
2
|
-
export declare type
|
|
2
|
+
export declare type ConnectivityStateMapper<S> = (state: IConnectivityState) => S;
|
|
3
3
|
export declare type StateHookFunction<T> = (() => T) & (<S extends object>(mapper: (state: T) => S) => S);
|
|
4
|
-
export declare
|
|
4
|
+
export declare function useConnectivityState(): IConnectivityState;
|
|
5
|
+
export declare function useConnectivityState<S>(stateMapper: ConnectivityStateMapper<S>): S;
|
|
5
6
|
export declare const useConnectivityActions: () => ConnectivityActions;
|
package/connectivity/hooks.js
CHANGED
|
@@ -2,13 +2,12 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import { shallowEqual } from 'react-redux';
|
|
3
3
|
import { useSelector, useDispatch } from '../FronteggStoreContext';
|
|
4
4
|
import { bindActionCreators, connectivityActions, connectivityStoreName } from '@frontegg/redux-store';
|
|
5
|
-
export const useConnectivityState = stateMapper => {
|
|
6
|
-
return useSelector(state => {
|
|
7
|
-
var _stateMapper;
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const defaultMapper = state => state;
|
|
7
|
+
|
|
8
|
+
export function useConnectivityState(stateMapper = defaultMapper) {
|
|
9
|
+
return useSelector(state => stateMapper(state[connectivityStoreName]), shallowEqual);
|
|
10
|
+
}
|
|
12
11
|
export const useConnectivityActions = () => {
|
|
13
12
|
const dispatch = useDispatch();
|
|
14
13
|
return useMemo(() => bindActionCreators(connectivityActions, dispatch), [connectivityActions]);
|