@openfort/react 0.2.5 → 0.2.6

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,8 +1,9 @@
1
- export declare function OtpInputStandalone({ length, onChange, onComplete, isLoading, isError, isSuccess, }: {
1
+ export declare function OtpInputStandalone({ length, onChange, onComplete, isLoading, isError, isSuccess, scale, }: {
2
2
  length?: number;
3
3
  onChange?: (value: string) => void;
4
4
  onComplete?: (value: string) => void;
5
5
  isLoading?: boolean;
6
6
  isError?: boolean;
7
7
  isSuccess?: boolean;
8
+ scale?: string;
8
9
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  export declare const OtpContainer: import("styled-components").StyledComponent<"div", any, {
2
2
  showBorder: boolean;
3
+ scale?: string;
3
4
  }, never>;
4
5
  export declare const OTPGroup: import("styled-components").StyledComponent<"div", any, {
5
6
  isError?: boolean;
@@ -111,15 +111,34 @@ type CommonWalletConfig = {
111
111
  [chainId: number]: Hex[];
112
112
  };
113
113
  };
114
+ export type GetEncryptionSessionParams = {
115
+ accessToken: string;
116
+ otpCode?: string;
117
+ userId: string;
118
+ };
114
119
  type EncryptionSession = {
115
120
  /** Function to retrieve an encryption session using a session ID. */
116
- getEncryptionSession?: (accessToken: string) => Promise<string>;
121
+ getEncryptionSession?: ({ accessToken, otpCode, userId }: GetEncryptionSessionParams) => Promise<string>;
117
122
  createEncryptedSessionEndpoint?: never;
118
123
  } | {
119
124
  /** API endpoint for creating an encrypted session. */
120
125
  getEncryptionSession?: never;
121
126
  createEncryptedSessionEndpoint?: string;
122
127
  };
128
+ type RecoverWithOTP = {
129
+ /** Function to recover a wallet with otp. */
130
+ requestWalletRecoverOTP?: ({ accessToken, userId, email, phone, }: {
131
+ accessToken: string;
132
+ userId: string;
133
+ email?: string;
134
+ phone?: string;
135
+ }) => Promise<void>;
136
+ requestWalletRecoverOTPEndpoint?: never;
137
+ } | {
138
+ /** API endpoint for recovering a wallet with otp. */
139
+ requestWalletRecoverOTP?: never;
140
+ requestWalletRecoverOTPEndpoint?: string;
141
+ };
123
142
  export type DebugModeOptions = {
124
143
  openfortReactDebugMode?: boolean;
125
144
  openfortCoreDebugMode?: boolean;
@@ -133,7 +152,7 @@ export type DebugModeOptions = {
133
152
  * the `createEncryptedSessionEndpoint` endpoint or the `getEncryptionSession` callback.
134
153
  * Password-based and passkey-based recovery methods do not require encryption sessions.
135
154
  */
136
- export type OpenfortWalletConfig = CommonWalletConfig & EncryptionSession;
155
+ export type OpenfortWalletConfig = CommonWalletConfig & EncryptionSession & RecoverWithOTP;
137
156
  type OpenfortUIOptions = {
138
157
  linkWalletOnSignUp?: LinkWalletOnSignUpOption;
139
158
  authProviders: UIAuthProvider[];
@@ -238,11 +257,15 @@ export type ConnectUIOptions = {
238
257
  buyFromExchangeUrl?: string;
239
258
  buyTroubleshootingUrl?: string;
240
259
  phoneConfig?: PhoneConfig;
260
+ customPageComponents?: {
261
+ [key in CustomizableRoutes]?: React.ReactElement;
262
+ };
241
263
  } & Partial<OpenfortUIOptions>;
242
264
  type WalletRecoveryOptionsExtended = {
243
265
  allowedMethods: RecoveryMethod[];
244
266
  defaultMethod: RecoveryMethod;
245
267
  };
268
+ export type CustomizableRoutes = typeof routes.CONNECTED;
246
269
  export type OpenfortUIOptionsExtended = {
247
270
  theme: Theme;
248
271
  mode: Mode;
@@ -277,6 +300,9 @@ export type OpenfortUIOptionsExtended = {
277
300
  buyTroubleshootingUrl?: string;
278
301
  walletRecovery: WalletRecoveryOptionsExtended;
279
302
  phoneConfig?: PhoneConfig;
303
+ customPageComponents?: {
304
+ [key in CustomizableRoutes]?: React.ReactElement;
305
+ };
280
306
  } & OpenfortUIOptions;
281
307
  export type Asset = {
282
308
  type: 'native';
@@ -5,6 +5,7 @@ type PageContentProps = {
5
5
  width?: number | string;
6
6
  onBack?: SetOnBackFunction;
7
7
  logoutOnBack?: boolean;
8
+ header?: string;
8
9
  };
9
- export declare const PageContent: ({ children, width, onBack, logoutOnBack }: PageContentProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const PageContent: ({ children, width, onBack, logoutOnBack, header }: PageContentProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -0,0 +1,6 @@
1
+ export type PageLayoutProps = {
2
+ children?: React.ReactNode;
3
+ width?: number | string;
4
+ header?: string;
5
+ };
6
+ export declare const PageLayout: ({ children, width, header }: PageLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,9 @@
1
- export declare const ProviderSelectContent: import("styled-components").StyledComponent<({ children, width, onBack, logoutOnBack }: {
1
+ export declare const ProviderSelectContent: import("styled-components").StyledComponent<({ children, width, onBack, logoutOnBack, header }: {
2
2
  children?: React.ReactNode;
3
3
  width?: number | string;
4
4
  onBack?: import("../../PageContent").SetOnBackFunction;
5
5
  logoutOnBack?: boolean;
6
+ header?: string;
6
7
  }) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
7
8
  export declare const ProviderList: import("styled-components").StyledComponent<"div", any, {}, never>;
8
9
  export declare const ProviderButton: import("styled-components").StyledComponent<"button", any, {
@@ -1,8 +1,9 @@
1
- export declare const SelectTokenContent: import("styled-components").StyledComponent<({ children, width, onBack, logoutOnBack }: {
1
+ export declare const SelectTokenContent: import("styled-components").StyledComponent<({ children, width, onBack, logoutOnBack, header }: {
2
2
  children?: React.ReactNode;
3
3
  width?: number | string;
4
4
  onBack?: import("../../PageContent").SetOnBackFunction;
5
5
  logoutOnBack?: boolean;
6
+ header?: string;
6
7
  }) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
7
8
  export declare const TokenList: import("styled-components").StyledComponent<"div", any, {}, never>;
8
9
  export declare const TokenButton: import("styled-components").StyledComponent<"button", any, {}, never>;
@@ -28,10 +28,18 @@ export type UserWallet = {
28
28
  type WalletRecovery = {
29
29
  recoveryMethod: RecoveryMethod;
30
30
  password?: string;
31
+ otpCode?: string;
32
+ };
33
+ export type RequestWalletRecoverOTPResponse = {
34
+ error?: OpenfortError;
35
+ sentTo?: 'email' | 'phone';
36
+ email?: string;
37
+ phone?: string;
31
38
  };
32
39
  type SetActiveWalletResult = {
33
40
  error?: OpenfortError;
34
41
  wallet?: UserWallet;
42
+ isOTPRequired?: boolean;
35
43
  };
36
44
  type SetActiveWalletOptions = {
37
45
  walletId: string;
@@ -120,5 +128,7 @@ export declare function useWallets(hookOptions?: WalletOptions): {
120
128
  reset: () => void;
121
129
  createWallet: ({ recovery, ...options }?: CreateWalletOptions) => Promise<CreateWalletResult>;
122
130
  setActiveWallet: (options: SetActiveWalletOptions | string) => Promise<SetActiveWalletResult>;
131
+ requestWalletRecoverOTP: () => Promise<RequestWalletRecoverOTPResponse>;
132
+ isWalletRecoveryOTPEnabled: boolean;
123
133
  };
124
134
  export {};
package/build/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { default as ChainIcon } from './components/Common/Chain';
4
4
  export { OpenfortButton } from './components/ConnectButton';
5
5
  export { OpenfortProvider } from './components/Openfort/OpenfortProvider';
6
6
  export { LinkWalletOnSignUpOption, UIAuthProvider as AuthProvider } from './components/Openfort/types';
7
+ export { PageLayout, type PageLayoutProps } from './components/PageLayout';
7
8
  export { embeddedWalletId } from './constants/openfort';
8
9
  export { default as getDefaultConfig } from './defaultConfig';
9
10
  export { default as getDefaultConnectors } from './defaultConnectors';
@@ -27,7 +28,7 @@ export { useChainIsSupported } from './hooks/useChainIsSupported';
27
28
  export { useChains } from './hooks/useChains';
28
29
  export { useOpenfortCore as useOpenfort } from './openfort/useOpenfort';
29
30
  export type { CustomTheme } from './styles/customTheme';
30
- export type { CustomAvatarProps, Languages, Mode, OpenfortHookOptions, OpenfortOptions, OpenfortWalletConfig, PhoneConfig, Theme, } from './types';
31
+ export type { CustomAvatarProps, CustomizableRoutes, Languages, Mode, OpenfortHookOptions, OpenfortOptions, OpenfortWalletConfig, PhoneConfig, Theme, } from './types';
31
32
  export { OAuthProvider, OpenfortError, OpenfortReactErrorType as OpenfortErrorType, SDKOverrides, ThirdPartyOAuthProvider, } from './types';
32
33
  export { OPENFORT_VERSION } from './version';
33
34
  export { wallets } from './wallets';