@frontegg/react-hooks 7.2.0-alpha.2 → 7.2.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.
@@ -1,7 +1,7 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
  import { ContextOptions } from '@frontegg/rest-api';
3
3
  import { FronteggAppInstance } from '@frontegg/types';
4
- declare type FronteggProviderProps = {
4
+ type FronteggProviderProps = {
5
5
  app?: FronteggAppInstance;
6
6
  contextOptions?: ContextOptions;
7
7
  setLoading?: (loading: boolean) => void;
package/audits/hooks.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { AuditsActions, AuditsState } from '@frontegg/redux-store';
2
- export declare type AuditsMapper = {
2
+ export type AuditsMapper = {
3
3
  state: (state: AuditsState) => any;
4
4
  actions: (actions: AuditsActions) => any;
5
5
  };
6
- export declare type AuditsStateMapper<S> = (state: AuditsState) => S;
6
+ export type AuditsStateMapper<S> = (state: AuditsState) => S;
7
7
  export declare function useAuditsState(): AuditsState;
8
8
  export declare function useAuditsState<S>(stateMapper: AuditsStateMapper<S>): S;
9
9
  export declare const useAuditsActions: () => AuditsActions;
@@ -1,5 +1,5 @@
1
1
  import { AcceptInvitationState, AcceptInvitationActions } from '@frontegg/redux-store';
2
- export declare type AcceptInvitationStateMapper<S> = (state: AcceptInvitationState) => S;
2
+ export type AcceptInvitationStateMapper<S> = (state: AcceptInvitationState) => S;
3
3
  export declare function useAcceptInvitationState(): AcceptInvitationState;
4
4
  export declare function useAcceptInvitationState<S>(stateMapper: AcceptInvitationStateMapper<S>): S;
5
5
  export declare const useAcceptInvitationActions: () => AcceptInvitationActions;
@@ -1,5 +1,5 @@
1
1
  import { ActivateAccountState, ActivateAccountActions } from '@frontegg/redux-store';
2
- export declare type ActivateAccountStateMapper<S> = (state: ActivateAccountState) => S;
2
+ export type ActivateAccountStateMapper<S> = (state: ActivateAccountState) => S;
3
3
  export declare function useActivateAccountState(): ActivateAccountState;
4
4
  export declare function useActivateAccountState<S>(stateMapper: ActivateAccountStateMapper<S>): S;
5
5
  export declare const useActivateAccountActions: () => ActivateAccountActions;
@@ -1,5 +1,5 @@
1
1
  import { IAllAccountsState, AllAccountsActions, IAllAccountsDialogsState, AllAccountsDialogActions } from '@frontegg/redux-store';
2
- export declare type AllAccountsStateMapper<S> = (state: IAllAccountsState) => S;
2
+ export type AllAccountsStateMapper<S> = (state: IAllAccountsState) => S;
3
3
  export declare function useAllAccountsState(): IAllAccountsState;
4
4
  export declare function useAllAccountsState<S>(stateMapper: AllAccountsStateMapper<S>): S;
5
5
  export declare const useAllAccountsActions: () => AllAccountsActions;
@@ -3,5 +3,5 @@ export declare function useCustomLoginState(): CustomLoginState;
3
3
  export declare const useCustomLoginActions: () => CustomLoginActions;
4
4
  export declare const useCustomLoginTheme: () => {
5
5
  customLoginTheme: any;
6
- getCustomLoginThemeValue: (path?: string | undefined) => any;
6
+ getCustomLoginThemeValue: (path?: string) => any;
7
7
  };
@@ -5,31 +5,31 @@ import { EntitledToOptions, Entitlement } from '@frontegg/redux-store';
5
5
  @param customAttributes user attributes
6
6
  @returns if the user is entitled to the given feature and attributes. Attaching the justification if not
7
7
  */
8
- export declare const useFeatureEntitlements: (key: string, customAttributes?: Record<string, string | number | boolean | Date> | undefined) => Entitlement;
8
+ export declare const useFeatureEntitlements: (key: string, customAttributes?: CustomAttributes) => Entitlement;
9
9
  /**
10
10
  @param key permission key
11
11
  @param customAttributes user attributes
12
12
  @returns if the user is entitled to the given permission and attributes. Attaching the justification if not
13
13
  */
14
- export declare const usePermissionEntitlements: (key: string, customAttributes?: Record<string, string | number | boolean | Date> | undefined) => Entitlement;
14
+ export declare const usePermissionEntitlements: (key: string, customAttributes?: CustomAttributes) => Entitlement;
15
15
  /**
16
16
  @param entitledToOptions including permission or feature key
17
17
  @param customAttributes user attributes
18
18
  @returns if the user is entitled to the given feature or permission and attributes (check only one). Attaching the justification if not
19
19
  */
20
- export declare const useEntitlements: (options: EntitledToOptions, customAttributes?: Record<string, string | number | boolean | Date> | undefined) => Entitlement;
20
+ export declare const useEntitlements: (options: EntitledToOptions, customAttributes?: CustomAttributes) => Entitlement;
21
21
  /**
22
22
  @param entitledToOptions including permission or feature key
23
23
  @returns an action your can use to detect if the user is entitled to the given feature or permission (check only one). Attaching the justification if not
24
24
  */
25
25
  export declare const useEntitlementsActions: () => {
26
- isEntitledTo: (options: EntitledToOptions, customAttributes?: Record<string, string | number | boolean | Date> | undefined) => Entitlement;
26
+ isEntitledTo: (options: EntitledToOptions, customAttributes?: CustomAttributes) => Entitlement;
27
27
  };
28
28
  /**
29
29
  @returns if the option to use entitlements is enabled
30
30
  */
31
31
  export declare const useEntitlementsOptions: () => {
32
32
  isEntitlementsEnabled: boolean;
33
- isEntitledTo: (options: EntitledToOptions, customAttributes?: Record<string, string | number | boolean | Date> | undefined) => Entitlement;
33
+ isEntitledTo: (options: EntitledToOptions, customAttributes?: CustomAttributes) => Entitlement;
34
34
  verifyIsEntitledFF: boolean;
35
35
  };
package/auth/hooks.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { AuthActions, AuthState } from '@frontegg/redux-store';
2
2
  import { RedirectOptions } from '@frontegg/rest-api';
3
3
  import { AuthPageRoutes, User } from '@frontegg/redux-store';
4
- export declare type AuthMapper = {
4
+ export type AuthMapper = {
5
5
  state: (state: AuthState) => any;
6
6
  actions: (actions: AuthActions) => any;
7
7
  };
8
- export declare type AuthStateMapper<S> = (state: AuthState) => S;
8
+ export type AuthStateMapper<S> = (state: AuthState) => S;
9
9
  /**
10
10
  * Use this `frontegg` hook function to obtain the complete authentication state, if it exists.
11
11
  *
@@ -48,15 +48,15 @@ export declare function useAuthState(): AuthState;
48
48
  *
49
49
  * When using this option, you can have the user on the first load, and you can control when the user is redirected to the login page by using `loginWithRedirect`.
50
50
  */
51
- export declare const useLoginWithRedirect: () => (additionalParams?: Record<string, string> | undefined) => Promise<void>;
51
+ export declare const useLoginWithRedirect: () => (additionalParams?: Record<string, string>) => Promise<void>;
52
52
  export declare const useLoginWithRedirectV2: () => (payload?: {
53
- additionalParams?: Record<string, string> | undefined;
54
- shouldRedirectToLogin?: boolean | undefined;
55
- firstTime?: boolean | undefined;
56
- loginDirectAction?: import("@frontegg/redux-store").LoginDirectAction | undefined;
57
- } | undefined) => Promise<void>;
53
+ additionalParams?: Record<string, string>;
54
+ shouldRedirectToLogin?: boolean;
55
+ firstTime?: boolean;
56
+ loginDirectAction?: import("dist/@frontegg/redux-store/auth/LoginState/interfaces").LoginDirectAction;
57
+ }) => Promise<void>;
58
58
  export declare const useAuthActions: () => AuthActions;
59
- export declare const useOnRedirectTo: () => (path: string, opts?: RedirectOptions | undefined) => void;
59
+ export declare const useOnRedirectTo: () => ((path: string, opts?: RedirectOptions) => void);
60
60
  export declare const useAuthRoutes: () => AuthPageRoutes;
61
61
  /**
62
62
  * ```jsx
package/auth/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { useAuthState, useAuth, useAuthActions, useOnRedirectTo, useAuthRoutes, useIsAuthenticated, useAuthUser, useAuthUserOrNull, useLoginWithRedirect, useLoginWithRedirectV2, } from './hooks';
2
2
  export * from './acceptInvitation';
3
- export * from './unlockAccount';
4
3
  export * from './activateAccount';
5
4
  export * from './allAccounts';
6
5
  export * from './apiTokens';
package/auth/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export { useAuthState, useAuth, useAuthActions, useOnRedirectTo, useAuthRoutes, useIsAuthenticated, useAuthUser, useAuthUserOrNull, useLoginWithRedirect, useLoginWithRedirectV2 } from './hooks';
2
2
  export * from './acceptInvitation';
3
- export * from './unlockAccount';
4
3
  export * from './activateAccount';
5
4
  export * from './allAccounts';
6
5
  export * from './apiTokens';
package/auth/mfa.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { MfaActions, MFAState } from '@frontegg/redux-store';
2
- declare type AuthMfaStateMapper<S> = (state: MFAState) => S;
2
+ type AuthMfaStateMapper<S> = (state: MFAState) => S;
3
3
  export declare function useMfaState(): MFAState;
4
4
  export declare function useMfaState<S>(stateMapper: AuthMfaStateMapper<S>): S;
5
5
  export declare const useMfaActions: () => MfaActions;
@@ -1,11 +1,7 @@
1
1
  import type { SecurityPolicyActions, SecurityPolicyState } from '@frontegg/redux-store';
2
- export declare type SecurityPolicyStateMapper<S> = (state: SecurityPolicyState) => S;
2
+ export type SecurityPolicyStateMapper<S> = (state: SecurityPolicyState) => S;
3
3
  export declare function useSecurityPolicyState(): SecurityPolicyState;
4
4
  export declare function useSecurityPolicyState<S>(stateMapper: SecurityPolicyStateMapper<S>): S;
5
5
  export declare const useSecurityPolicyActions: () => SecurityPolicyActions;
6
- export declare const usePublicPolicySettings: (loadOnMount?: boolean) => import("@frontegg/redux-store").WithStatus & {
7
- policy?: import("@frontegg/rest-api").IVendorConfig | undefined;
8
- };
9
- export declare const usePublicAuthStrategiesPolicySettings: (loadOnMount?: boolean) => import("@frontegg/redux-store").WithStatus & {
10
- policy?: import("@frontegg/rest-api").IAuthStrategiesConfig | undefined;
11
- };
6
+ export declare const usePublicPolicySettings: (loadOnMount?: boolean) => import("@frontegg/redux-store").PublicPolicyState;
7
+ export declare const usePublicAuthStrategiesPolicySettings: (loadOnMount?: boolean) => import("@frontegg/redux-store").PublicAuthStrategyPolicyState;
package/auth/signup.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { SignUpState, SignUpActions } from '@frontegg/redux-store';
2
- export declare type SignUpStateMapper<S> = (state: SignUpState) => S;
2
+ export type SignUpStateMapper<S> = (state: SignUpState) => S;
3
3
  export declare function useSignUpState(): SignUpState;
4
4
  export declare function useSignUpState<S>(stateMapper: SignUpStateMapper<S>): S;
5
5
  export declare const useSignUpActions: () => SignUpActions;
@@ -1,5 +1,5 @@
1
1
  import type { SocialLoginActions, SocialLoginState } from '@frontegg/redux-store';
2
- export declare type SocialLoginStateMapper<S> = (state: SocialLoginState) => S;
2
+ export type SocialLoginStateMapper<S> = (state: SocialLoginState) => S;
3
3
  export declare function useSocialLoginState(): SocialLoginState;
4
4
  export declare function useSocialLoginState<S>(stateMapper: SocialLoginStateMapper<S>): S;
5
5
  export declare const useSocialLoginActions: () => SocialLoginActions;
package/auth/sso.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { SSOState, SSOActions } from '@frontegg/redux-store';
2
- declare type AuthSSOStateMapper<S> = (state: SSOState) => S;
2
+ type AuthSSOStateMapper<S> = (state: SSOState) => S;
3
3
  export declare function useSSOState(): SSOState;
4
4
  export declare function useSSOState<S>(stateMapper: AuthSSOStateMapper<S>): S;
5
5
  export declare const useSSOActions: () => SSOActions;
package/auth/stepUp.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare const getMaxAgeFromQueryParam: () => number | undefined;
8
8
  /**
9
9
  * @returns step up function that redirects to the step up url with the max age param and set the redirect url in the local storage
10
10
  */
11
- export declare const useStepUp: () => (options?: StepUpOptions | undefined) => void;
11
+ export declare const useStepUp: () => ((options?: StepUpOptions) => void);
12
12
  /**
13
13
  * @param options.maxAge - max age of step up
14
14
  * @returns true when the user is stepped up, false otherwise
package/auth/team.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TeamActions, TeamState } from '@frontegg/redux-store';
2
2
  export declare function useTeamState(): TeamState;
3
3
  export declare const useTeamActions: () => TeamActions;
4
- export declare type AuthTeamStateMapper<S> = (state: TeamState) => S;
4
+ export type AuthTeamStateMapper<S> = (state: TeamState) => S;
5
5
  /**
6
6
  * @deprecated use useTeamState instead
7
7
  */
package/common/index.d.ts CHANGED
@@ -20,5 +20,5 @@ export interface DomContext extends ShadowDomContextData {
20
20
  }
21
21
  export declare const ShadowDomContext: import("react").Context<ShadowDomContextData>;
22
22
  export declare const useShadowDom: () => DomContext;
23
- export declare const useRootState: () => FronteggState['root'];
23
+ export declare const useRootState: () => FronteggState["root"];
24
24
  export * from './CustomComponentHolder';
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.2.0-alpha.2
1
+ /** @license Frontegg v7.2.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -88,18 +88,6 @@ Object.keys(_acceptInvitation).forEach(function (key) {
88
88
  }
89
89
  });
90
90
  });
91
- var _unlockAccount = require("./unlockAccount");
92
- Object.keys(_unlockAccount).forEach(function (key) {
93
- if (key === "default" || key === "__esModule") return;
94
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
95
- if (key in exports && exports[key] === _unlockAccount[key]) return;
96
- Object.defineProperty(exports, key, {
97
- enumerable: true,
98
- get: function () {
99
- return _unlockAccount[key];
100
- }
101
- });
102
- });
103
91
  var _activateAccount = require("./activateAccount");
104
92
  Object.keys(_activateAccount).forEach(function (key) {
105
93
  if (key === "default" || key === "__esModule") return;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.2.0-alpha.2
1
+ /** @license Frontegg v7.2.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@frontegg/react-hooks",
3
- "version": "7.2.0-alpha.2",
3
+ "version": "7.2.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
- "@frontegg/redux-store": "7.2.0-alpha.2",
10
- "@frontegg/types": "7.2.0-alpha.2",
9
+ "@frontegg/redux-store": "7.2.0",
10
+ "@frontegg/types": "7.2.0",
11
11
  "@types/react": "*",
12
+ "react-is": "^17.0.2",
13
+ "@types/react-is": "^17.0.7",
12
14
  "get-value": "^3.0.1"
13
15
  },
14
16
  "sideEffects": false,
@@ -9,8 +9,8 @@ export declare const useBillingInformation: () => BillingInformationState;
9
9
  export declare const useBillingInformationActions: () => {
10
10
  setBillingInformationState: (state: Partial<BillingInformationState>) => void;
11
11
  resetBillingInformationState: () => void;
12
- loadSummaries: (tenantId: string, forceActive?: boolean | undefined) => Promise<void>;
13
- loadBillingInformation: (forceActive?: boolean | undefined) => Promise<void>;
12
+ loadSummaries: (tenantId: string, forceActive?: boolean) => Promise<void>;
13
+ loadBillingInformation: (forceActive?: boolean) => Promise<void>;
14
14
  };
15
15
  export declare const usePaymentMethod: () => PaymentMethodState;
16
16
  export declare const usePaymentMethodActions: () => {
@@ -20,7 +20,7 @@ export declare const usePaymentMethodActions: () => {
20
20
  submitPaymentMethod: () => Promise<void>;
21
21
  submitPaymentMethodError: (error: string) => Promise<void>;
22
22
  submitPaymentMethodSuccess: () => Promise<void>;
23
- updatePaymentMethodBillingDetails: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithId<import("@frontegg/rest-api").ISubscriptionUpdatePaymentMethodBillingDetails>, boolean>) => Promise<void>;
23
+ updatePaymentMethodBillingDetails: (payload: import("@frontegg/redux-store").WithCallback<import("@frontegg/redux-store").WithId<import("@frontegg/rest-api").ISubscriptionUpdatePaymentMethodBillingDetails>>) => Promise<void>;
24
24
  };
25
25
  export declare const useInvoices: () => InvoicesState;
26
26
  export declare const useInvoicesActions: () => {
@@ -31,10 +31,10 @@ export declare const useInvoicesActions: () => {
31
31
  downloadInvoice: (payload: import("@frontegg/redux-store").DownloadInvoiceActionPayload) => Promise<void>;
32
32
  downloadBillingInvoice: (payload: import("@frontegg/redux-store").DownloadInvoiceActionPayload) => Promise<void>;
33
33
  };
34
- export declare const useSubscriptionCancellation: () => SubscriptionState['cancellation'];
35
- export declare const useSubscriptionRenewal: () => SubscriptionState['renewal'];
34
+ export declare const useSubscriptionCancellation: () => SubscriptionState["cancellation"];
35
+ export declare const useSubscriptionRenewal: () => SubscriptionState["renewal"];
36
36
  export declare const useSubscription: () => SubscriptionState;
37
- export declare const useSubscriptionActions: () => BillingStateActions['subscription'] & {
37
+ export declare const useSubscriptionActions: () => BillingStateActions["subscription"] & {
38
38
  load: () => void;
39
39
  };
40
40
  export declare const useStripeState: () => StripeState;
@@ -1,5 +1,5 @@
1
1
  import { Snapshot } from '@frontegg/redux-store';
2
- declare type Options = {
2
+ type Options = {
3
3
  sync?: boolean;
4
4
  };
5
5
  /**
package/vendor/hooks.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VendorActions, VendorState } from '@frontegg/redux-store';
2
- export declare type VendorStateMapper<S> = (state: VendorState) => S;
2
+ export type VendorStateMapper<S> = (state: VendorState) => S;
3
3
  export declare function useVendorState(): VendorState;
4
4
  export declare function useVendorState<S>(stateMapper: VendorStateMapper<S>): S;
5
5
  export declare const useVendorActions: () => VendorActions;
@@ -1,5 +0,0 @@
1
- import { UnlockAccountActions, UnlockAccountState } from '@frontegg/redux-store';
2
- export declare type UnlockAccountStateMapper<S> = (state: UnlockAccountState) => S;
3
- export declare function useUnlockAccountState(): UnlockAccountState;
4
- export declare function useUnlockAccountState<S>(stateMapper: UnlockAccountStateMapper<S>): S;
5
- export declare const useUnlockAccountActions: () => UnlockAccountActions;
@@ -1,10 +0,0 @@
1
- import { useStore } from '../FronteggStoreContext';
2
- import { useSnapshot } from '../useSnapshot';
3
- const defaultMapper = state => state;
4
- export function useUnlockAccountState(stateMapper = defaultMapper) {
5
- const state = useStore().store.auth.unlockAccountState;
6
- return stateMapper(useSnapshot(state));
7
- }
8
- export const useUnlockAccountActions = () => {
9
- return useStore().stateActions.auth.unlockAccountActions;
10
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useUnlockAccountActions = void 0;
7
- exports.useUnlockAccountState = useUnlockAccountState;
8
- var _FronteggStoreContext = require("../FronteggStoreContext");
9
- var _useSnapshot = require("../useSnapshot");
10
- const defaultMapper = state => state;
11
- function useUnlockAccountState(stateMapper = defaultMapper) {
12
- const state = (0, _FronteggStoreContext.useStore)().store.auth.unlockAccountState;
13
- return stateMapper((0, _useSnapshot.useSnapshot)(state));
14
- }
15
- const useUnlockAccountActions = () => {
16
- return (0, _FronteggStoreContext.useStore)().stateActions.auth.unlockAccountActions;
17
- };
18
- exports.useUnlockAccountActions = useUnlockAccountActions;