@openfort/react 0.0.3 → 0.0.5

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/README.md CHANGED
@@ -44,7 +44,7 @@ and much more...
44
44
 
45
45
  ### New app
46
46
 
47
- Get started with `create` Openfortkit + [wagmi](https://wagmi.sh/) + [viem](https://viem.sh) project by running one of the following in your terminal:
47
+ Get started with `create` Openfort + [wagmi](https://wagmi.sh/) + [viem](https://viem.sh) project by running one of the following in your terminal:
48
48
 
49
49
  #### npm
50
50
 
@@ -99,7 +99,7 @@ There are various runnable examples included in this repository in the [examples
99
99
  Clone the project and install the necessary dependencies:
100
100
 
101
101
  ```sh
102
- $ git clone git@github.com:openfort-xyz/openfort-kit.git
102
+ $ git clone git@github.com:openfort-xyz/openfort-react.git
103
103
  $ cd openfort
104
104
  $ yarn install
105
105
  ```
@@ -120,8 +120,8 @@ $ yarn dev:cra # Create React App
120
120
 
121
121
  ## License
122
122
 
123
- See [LICENSE](https://github.com/openfort-xyz/openfort-kit/blob/main/LICENSE) for more information.
123
+ See [LICENSE](https://github.com/openfort-xyz/openfort-react/blob/main/LICENSE) for more information.
124
124
 
125
125
  ## Credits
126
126
 
127
- OpenfortKit is a fork of [Connectkit](https://github.com/openfort-xyz/openfort-kit) developed by [Family](https://family.co). We're grateful to them for making Connectkit fast, beautiful and open-source.
127
+ Openfort is a fork of [Connectkit](https://github.com/openfort-xyz/openfort-react) developed by [Family](https://family.co). We're grateful to them for making Connectkit fast, beautiful and open-source.
@@ -17,7 +17,7 @@ type ConnectButtonRendererProps = {
17
17
  ensName?: string;
18
18
  }) => React.ReactNode;
19
19
  };
20
- type OpenfortKitButtonProps = {
20
+ type OpenfortButtonProps = {
21
21
  label?: string;
22
22
  showBalance?: boolean;
23
23
  showAvatar?: boolean;
@@ -26,8 +26,8 @@ type OpenfortKitButtonProps = {
26
26
  customTheme?: CustomTheme;
27
27
  onClick?: (open: () => void) => void;
28
28
  };
29
- export declare function OpenfortKitButton({ label, showBalance, showAvatar, theme, mode, customTheme, onClick, }: OpenfortKitButtonProps): import("react/jsx-runtime").JSX.Element | null;
30
- export declare namespace OpenfortKitButton {
29
+ export declare function OpenfortButton({ label, showBalance, showAvatar, theme, mode, customTheme, onClick, }: OpenfortButtonProps): import("react/jsx-runtime").JSX.Element | null;
30
+ export declare namespace OpenfortButton {
31
31
  var Custom: React.FC<ConnectButtonRendererProps>;
32
32
  }
33
33
  export {};
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { SDKOverrides, ThirdPartyAuthConfiguration } from '@openfort/openfort-js';
2
3
  import { useConnectCallbackProps } from '../../hooks/useConnectCallback';
3
4
  import { ContextValue } from './context';
4
5
  import { ConnectUIOptions, OpenfortWalletConfig } from './types';
@@ -8,9 +9,11 @@ type OpenfortProviderProps = {
8
9
  publishableKey: string;
9
10
  uiConfig?: ConnectUIOptions;
10
11
  walletConfig?: OpenfortWalletConfig;
12
+ overrides?: SDKOverrides;
13
+ thirdPartyAuth?: ThirdPartyAuthConfiguration;
11
14
  } & useConnectCallbackProps;
12
15
  /**
13
- * OpenfortProvider component provides context and configuration for OpenfortKit.
16
+ * OpenfortProvider component provides context and configuration for Openfort.
14
17
  * It must be used within a WagmiProvider.
15
18
  *
16
19
  * @param {React.ReactNode} children - The child components to be wrapped by the provider.
@@ -24,5 +27,5 @@ type OpenfortProviderProps = {
24
27
  * @param {OpenfortOptions} [openfortOptions] - Options for Openfort integration.
25
28
  * @throws Will throw an error if used outside of a WagmiProvider or if nested usages are detected.
26
29
  */
27
- export declare const OpenfortProvider: ({ children, uiConfig, onConnect, onDisconnect, debugMode, publishableKey, walletConfig, }: OpenfortProviderProps) => React.FunctionComponentElement<React.ProviderProps<ContextValue | null>>;
30
+ export declare const OpenfortProvider: ({ children, uiConfig, onConnect, onDisconnect, debugMode, publishableKey, walletConfig, overrides, thirdPartyAuth, }: OpenfortProviderProps) => React.FunctionComponentElement<React.ProviderProps<ContextValue | null>>;
28
31
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { CustomTheme, Languages, Mode, Theme } from '../../types';
3
- import { OAuthProvider } from '@openfort/openfort-js';
3
+ import { OAuthProvider, SDKOverrides, ThirdPartyAuthConfiguration } from '@openfort/openfort-js';
4
4
  import { ValueOf } from 'viem/_types/types/utils';
5
5
  import { useConnectCallbackProps } from '../../hooks/useConnectCallback';
6
6
  import { OpenfortUIOptionsExtended, OpenfortWalletConfig, routes } from './types';
@@ -33,6 +33,8 @@ export type ContextValue = {
33
33
  triggerResize: () => void;
34
34
  uiConfig?: OpenfortUIOptionsExtended;
35
35
  walletConfig?: OpenfortWalletConfig;
36
+ overrides?: SDKOverrides;
37
+ thirdPartyAuth?: ThirdPartyAuthConfiguration;
36
38
  } & useConnectCallbackProps;
37
- export declare const OpenfortKitContext: React.Context<ContextValue | null>;
39
+ export declare const Openfortcontext: React.Context<ContextValue | null>;
38
40
  export {};
@@ -1,7 +1,7 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { CustomAvatarProps, CustomTheme, Languages, Mode, Theme } from '../../types';
3
- import { RecoveryMethod } from '@openfort/openfort-js';
4
- import { CoreOpenfortProviderProps } from '../../openfort/OpenfortProvider';
3
+ import { AccountTypeEnum, RecoveryMethod } from '@openfort/openfort-js';
4
+ import { CoreOpenfortProviderProps } from '../../openfort/CoreOpenfortProvider';
5
5
  export declare const routes: {
6
6
  readonly PROVIDERS: "providers";
7
7
  readonly SOCIAL_PROVIDERS: "socialProviders";
@@ -35,6 +35,7 @@ type CommonWalletConfig = {
35
35
  shieldPublishableKey: string;
36
36
  /** Policy ID (pol_...) for the embedded signer */
37
37
  ethereumProviderPolicyId?: string;
38
+ accountType?: AccountTypeEnum;
38
39
  debug?: boolean;
39
40
  };
40
41
  type EncryptionSession = {
@@ -77,14 +78,16 @@ type PasswordRecoveryWalletConfig = {
77
78
  * - `getEncryptionSession.` as a function that returns a promise.
78
79
  */
79
80
  export type OpenfortWalletConfig = CommonWalletConfig & (AutomaticRecoveryWalletConfig | PasswordRecoveryWalletConfig);
80
- export type OpenfortOptions = {
81
+ export type OpenfortUIOptions = {
81
82
  linkWalletOnSignUp?: boolean;
82
83
  authProviders?: AuthProvider[];
83
84
  skipEmailVerification?: boolean;
84
85
  termsOfServiceUrl?: string;
85
86
  privacyPolicyUrl?: string;
86
87
  logo?: React.ReactNode;
87
- openfortUrlOverrides?: CoreOpenfortProviderProps['overrides'];
88
+ };
89
+ export type OpenfortSDKOptions = {
90
+ overrides?: CoreOpenfortProviderProps['overrides'];
88
91
  };
89
92
  export type ConnectUIOptions = {
90
93
  theme?: Theme;
@@ -106,7 +109,7 @@ export type ConnectUIOptions = {
106
109
  initialChainId?: number;
107
110
  enforceSupportedChains?: boolean;
108
111
  overlayBlur?: number;
109
- } & OpenfortOptions;
112
+ } & OpenfortUIOptions;
110
113
  export type OpenfortUIOptionsExtended = {
111
114
  theme: Theme;
112
115
  mode: Mode;
@@ -132,5 +135,5 @@ export type OpenfortUIOptionsExtended = {
132
135
  walletOnboardingUrl?: string;
133
136
  disableSiweRedirect?: boolean;
134
137
  overlayBlur?: number;
135
- } & OpenfortOptions;
138
+ } & OpenfortUIOptions;
136
139
  export {};
@@ -0,0 +1 @@
1
+ export declare const useOpenfort: () => import("./context").ContextValue;
@@ -14,7 +14,7 @@ type UseAuthCallbackOptions = {
14
14
  export declare const useAuthCallback: ({ enabled, ...hookOptions }?: UseAuthCallbackOptions) => {
15
15
  email: string | null;
16
16
  provider: AuthProvider | null;
17
- verifyEmail: ({ email, state, ...options }: import("./useEmailAuth").VerifyEmailOptions) => Promise<EmailVerificationResult>;
17
+ verifyEmail: (options: import("./useEmailAuth").VerifyEmailOptions) => Promise<EmailVerificationResult>;
18
18
  storeCredentials: ({ player, accessToken, refreshToken, ...options }: import("./useOAuth").StoreCredentialsOptions) => Promise<StoreCredentialsResult>;
19
19
  isLoading: boolean;
20
20
  isError: boolean;
@@ -53,7 +53,7 @@ export declare const useEmailAuth: (hookOptions?: UseEmailHookOptions) => {
53
53
  error: OpenfortError | null | undefined;
54
54
  signInEmail: (options: SignInEmailOptions) => Promise<EmailAuthResult>;
55
55
  signUpEmail: (options: SignUpEmailOptions) => Promise<EmailAuthResult>;
56
- verifyEmail: ({ email, state, ...options }: VerifyEmailOptions) => Promise<EmailVerificationResult>;
56
+ verifyEmail: (options: VerifyEmailOptions) => Promise<EmailVerificationResult>;
57
57
  linkEmail: (options: LinkEmailOptions) => Promise<EmailAuthResult>;
58
58
  requestResetPassword: (options: RequestResetPasswordOptions) => Promise<EmailAuthResult>;
59
59
  resetPassword: (options: ResetPasswordOptions) => Promise<EmailAuthResult>;
@@ -7,7 +7,7 @@ export type GuestHookResult = {
7
7
  user?: OpenfortUser;
8
8
  wallet?: UserWallet;
9
9
  };
10
- export type GuestHookOptions = OpenfortHookOptions<OpenfortUser> & CreateWalletPostAuthOptions;
10
+ export type GuestHookOptions = OpenfortHookOptions<GuestHookResult> & CreateWalletPostAuthOptions;
11
11
  export declare const useGuestAuth: (hookOptions?: GuestHookOptions) => {
12
12
  isLoading: boolean;
13
13
  isError: boolean;
@@ -1,12 +1,12 @@
1
- import { AuthProvider } from '../../../components/Openfort/types';
1
+ import { OAuthProvider } from '@openfort/openfort-js';
2
2
  import { OpenfortHookOptions, OpenfortError } from '../../../types';
3
3
  import { CreateWalletPostAuthOptions } from './useCreateWalletPostAuth';
4
4
  import { UserWallet } from "../useWallets";
5
5
  import { type AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
6
6
  export type InitializeOAuthOptions = {
7
- provider: AuthProvider;
7
+ provider: OAuthProvider;
8
8
  redirectTo?: string;
9
- } & OpenfortHookOptions;
9
+ } & OpenfortHookOptions<InitOAuthReturnType>;
10
10
  export type InitOAuthReturnType = {
11
11
  error?: OpenfortError;
12
12
  };
@@ -22,7 +22,7 @@ export type StoreCredentialsOptions = {
22
22
  } & OpenfortHookOptions<StoreCredentialsResult> & CreateWalletPostAuthOptions;
23
23
  export type AuthHookOptions = {
24
24
  redirectTo?: string;
25
- } & OpenfortHookOptions<StoreCredentialsResult> & CreateWalletPostAuthOptions;
25
+ } & OpenfortHookOptions<StoreCredentialsResult | InitOAuthReturnType> & CreateWalletPostAuthOptions;
26
26
  export declare const useOAuth: (hookOptions?: AuthHookOptions) => {
27
27
  isLoading: boolean;
28
28
  isError: boolean;
@@ -1,6 +1,6 @@
1
1
  import { OpenfortHookOptions, OpenfortError } from '../../../types';
2
2
  export declare function useSignOut(hookOptions?: OpenfortHookOptions): {
3
- signOut: (options?: OpenfortHookOptions) => Promise<{} | undefined>;
3
+ signOut: (options?: OpenfortHookOptions) => Promise<{}>;
4
4
  isLoading: boolean;
5
5
  isError: boolean;
6
6
  isSuccess: boolean;
@@ -1,4 +1,4 @@
1
- export declare enum OpenfortKitStatus {
1
+ export declare enum OpenfortStatus {
2
2
  DISCONNECTED = 0,
3
3
  NEEDS_RECOVERY = 1,
4
4
  LOADING = 2,
@@ -1,9 +1,10 @@
1
+ import { AccountTypeEnum, RecoveryParams } from "@openfort/openfort-js";
1
2
  import { Hex } from "viem";
2
3
  import { Connector } from "wagmi";
3
4
  import { embeddedWalletId } from "../../constants/openfort";
4
5
  import { OpenfortError, OpenfortHookOptions } from "../../types";
5
6
  export type UserWallet = {
6
- address?: `0x${string}`;
7
+ address: Hex;
7
8
  connectorType?: string;
8
9
  walletClientType?: string;
9
10
  connector?: Connector;
@@ -24,10 +25,18 @@ type SetActiveWalletOptions = ({
24
25
  } | {
25
26
  connector: typeof embeddedWalletId;
26
27
  password?: string;
28
+ } | {
29
+ connector: Connector;
27
30
  })) & OpenfortHookOptions<SetActiveWalletResult>;
28
31
  type CreateWalletResult = SetActiveWalletResult;
29
32
  type CreateWalletOptions = {
30
33
  password?: string;
34
+ accountType?: AccountTypeEnum;
35
+ } & OpenfortHookOptions<CreateWalletResult>;
36
+ type RecoverEmbeddedWalletResult = SetActiveWalletResult;
37
+ type SetRecoveryOptions = {
38
+ previousRecovery: RecoveryParams;
39
+ newRecovery: RecoveryParams;
31
40
  } & OpenfortHookOptions<CreateWalletResult>;
32
41
  type WalletOptions = OpenfortHookOptions<SetActiveWalletResult | CreateWalletResult>;
33
42
  export declare function useWallets(hookOptions?: WalletOptions): {
@@ -37,23 +46,14 @@ export declare function useWallets(hookOptions?: WalletOptions): {
37
46
  isSuccess: boolean;
38
47
  isCreating: boolean;
39
48
  isConnecting: boolean;
40
- wallets: {
41
- isConnecting: boolean;
42
- isActive: boolean;
43
- address?: `0x${string}`;
44
- connectorType?: string;
45
- walletClientType?: string;
46
- connector?: Connector;
47
- id: string;
48
- isAvailable: boolean;
49
- }[];
49
+ hasWallet: boolean;
50
+ isLoadingWallets: boolean;
51
+ wallets: UserWallet[];
50
52
  availableWallets: import("../../wallets/useWallets").WalletProps[];
51
53
  activeWallet: UserWallet | undefined;
54
+ setRecovery: (params: SetRecoveryOptions) => Promise<RecoverEmbeddedWalletResult>;
55
+ reset: () => void;
56
+ createWallet: ({ password, ...options }?: CreateWalletOptions) => Promise<CreateWalletResult>;
52
57
  setActiveWallet: (options: SetActiveWalletOptions | string) => Promise<SetActiveWalletResult>;
53
- createWallet: ({ password, ...options }?: CreateWalletOptions) => Promise<{
54
- error: OpenfortError;
55
- } | {
56
- wallet: UserWallet;
57
- }>;
58
58
  };
59
59
  export {};
package/build/index.d.ts CHANGED
@@ -1,17 +1,16 @@
1
- export { OPENFORTKIT_VERSION } from './version';
1
+ export { OPENFORT_VERSION } from './version';
2
2
  export * from './types';
3
3
  export { default as getDefaultConfig } from './defaultConfig';
4
4
  export { default as getDefaultConnectors } from './defaultConnectors';
5
5
  export { wallets } from './wallets';
6
6
  export { AuthProvider, } from './components/Openfort/types';
7
- export { OpenfortKitContext, } from './components/Openfort/context';
8
- export { OpenfortProvider, } from './components/Openfort/OpenfortKit';
9
- export { OpenfortKitButton } from './components/ConnectButton';
7
+ export { OpenfortProvider, } from './components/Openfort/OpenfortProvider';
8
+ export { OpenfortButton } from './components/ConnectButton';
10
9
  export { default as Avatar } from './components/Common/Avatar';
11
10
  export { default as ChainIcon } from './components/Common/Chain';
12
11
  export { useChains } from './hooks/useChains';
13
12
  export { useChainIsSupported } from './hooks/useChainIsSupported';
14
- export { useStatus, OpenfortKitStatus } from './hooks/openfort/useStatus';
13
+ export { useStatus, OpenfortStatus } from './hooks/openfort/useStatus';
15
14
  export { useUser } from './hooks/openfort/useUser';
16
15
  export { useUI } from "./hooks/openfort/useUI";
17
16
  export { useWallets, UserWallet } from "./hooks/openfort/useWallets";