@openfort/react 0.0.6 → 0.0.8
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 +3 -3
- package/build/assets/icons.d.ts +3 -0
- package/build/components/Common/Loading/index.d.ts +8 -3
- package/build/components/FloatingGraphic/index.d.ts +15 -0
- package/build/components/Openfort/types.d.ts +4 -4
- package/build/components/Pages/Providers/index.d.ts +2 -2
- package/build/hooks/openfort/auth/useAuthCallback.d.ts +2 -2
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.d.ts +2 -2
- package/build/hooks/openfort/useProviders.d.ts +4 -4
- package/build/hooks/openfort/useWallets.d.ts +16 -12
- package/build/index.d.ts +2 -2
- package/build/index.es.js +484 -274
- package/build/index.es.js.map +1 -1
- package/build/openfort/CoreOpenfortProvider.d.ts +3 -1
- package/build/types.d.ts +3 -2
- package/build/version.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Website
|
|
7
7
|
</a>
|
|
8
8
|
<span> | </span>
|
|
9
|
-
<a href="https://www.openfort.io/docs/products/embedded-wallet/react/
|
|
9
|
+
<a href="https://www.openfort.io/docs/products/embedded-wallet/react/">
|
|
10
10
|
Documentation
|
|
11
11
|
</a>
|
|
12
12
|
<span> | </span>
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
|
|
26
26
|
[](https://www.npmjs.com/package/@openfort/react)
|
|
27
27
|
[](LICENSE)
|
|
28
|
-
[](https://www.openfort.io/docs/products/embedded-wallet/react/
|
|
28
|
+
[](https://www.openfort.io/docs/products/embedded-wallet/react/)
|
|
29
29
|
[](https://www.npmjs.org/package/@openfort/react)
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
The easiest way to use embedded wallets, with built-in authentication and payments capabilities.
|
|
32
|
+
The easiest way to use embedded wallets, with built-in authentication and payments capabilities in React.
|
|
33
33
|
|
|
34
34
|
## Features
|
|
35
35
|
|
package/build/assets/icons.d.ts
CHANGED
|
@@ -49,3 +49,6 @@ export declare const LockIcon: ({ ...props }: {
|
|
|
49
49
|
export declare const ShieldIcon: ({ ...props }: {
|
|
50
50
|
[x: string]: any;
|
|
51
51
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export declare const FingerPrintIcon: ({ ...props }: {
|
|
53
|
+
[x: string]: any;
|
|
54
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type LoaderProps = {
|
|
2
|
+
header: string;
|
|
3
|
+
description?: string | undefined;
|
|
3
4
|
isLoading?: boolean;
|
|
4
5
|
icon?: React.ReactNode;
|
|
5
|
-
|
|
6
|
+
isError?: boolean;
|
|
7
|
+
isSuccess?: boolean;
|
|
8
|
+
onRetry?: () => void;
|
|
9
|
+
};
|
|
10
|
+
declare const Loader: ({ header, description, icon, isError, isSuccess, isLoading, onRetry, }: LoaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
11
|
export default Loader;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type LogoGraphicProps = {
|
|
3
|
+
size?: string;
|
|
4
|
+
logo: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export declare const LogoGraphic: ({ size, logo }: LogoGraphicProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const FloatingGraphic: ({ height, logoCenter, logoTopRight, logoTopLeft, logoBottomRight, logoBottomLeft }: {
|
|
8
|
+
height?: string;
|
|
9
|
+
logoCenter: LogoGraphicProps;
|
|
10
|
+
logoTopRight?: LogoGraphicProps;
|
|
11
|
+
logoTopLeft?: LogoGraphicProps;
|
|
12
|
+
logoBottomRight?: LogoGraphicProps;
|
|
13
|
+
logoBottomLeft?: LogoGraphicProps;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -21,7 +21,7 @@ export declare const routes: {
|
|
|
21
21
|
readonly PROFILE: "profile";
|
|
22
22
|
readonly SWITCHNETWORKS: "switchNetworks";
|
|
23
23
|
};
|
|
24
|
-
export declare enum
|
|
24
|
+
export declare enum UIAuthProvider {
|
|
25
25
|
GOOGLE = "google",
|
|
26
26
|
TWITTER = "twitter",
|
|
27
27
|
FACEBOOK = "facebook",
|
|
@@ -29,7 +29,7 @@ export declare enum AuthProvider {
|
|
|
29
29
|
WALLET = "wallet",
|
|
30
30
|
GUEST = "guest"
|
|
31
31
|
}
|
|
32
|
-
export declare const socialProviders:
|
|
32
|
+
export declare const socialProviders: UIAuthProvider[];
|
|
33
33
|
type PolicyConfig = string | Record<number, string>;
|
|
34
34
|
type CommonWalletConfig = {
|
|
35
35
|
/** Publishable key for the Shield API */
|
|
@@ -41,7 +41,7 @@ type CommonWalletConfig = {
|
|
|
41
41
|
};
|
|
42
42
|
type EncryptionSession = {
|
|
43
43
|
/** Function to retrieve an encryption session using a session ID */
|
|
44
|
-
getEncryptionSession?: () => Promise<string>;
|
|
44
|
+
getEncryptionSession?: (accessToken: string) => Promise<string>;
|
|
45
45
|
createEncryptedSessionEndpoint?: never;
|
|
46
46
|
} | {
|
|
47
47
|
/** API endpoint for creating an encrypted session */
|
|
@@ -63,7 +63,7 @@ type EncryptionSession = {
|
|
|
63
63
|
export type OpenfortWalletConfig = CommonWalletConfig & EncryptionSession;
|
|
64
64
|
export type OpenfortUIOptions = {
|
|
65
65
|
linkWalletOnSignUp?: boolean;
|
|
66
|
-
authProviders:
|
|
66
|
+
authProviders: UIAuthProvider[];
|
|
67
67
|
skipEmailVerification?: boolean;
|
|
68
68
|
termsOfServiceUrl?: string;
|
|
69
69
|
privacyPolicyUrl?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { UIAuthProvider } from "../../Openfort/types";
|
|
3
3
|
export declare const ProviderButtonSwitch: React.FC<{
|
|
4
|
-
provider:
|
|
4
|
+
provider: UIAuthProvider;
|
|
5
5
|
}>;
|
|
6
6
|
declare const Providers: React.FC;
|
|
7
7
|
export default Providers;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenfortHookOptions, OpenfortError } from "../../../types";
|
|
2
|
-
import {
|
|
2
|
+
import { UIAuthProvider } from "../../../components/Openfort/types";
|
|
3
3
|
import { CreateWalletPostAuthOptions } from "./useConnectToWalletPostAuth";
|
|
4
4
|
import { EmailVerificationResult } from "./useEmailAuth";
|
|
5
5
|
import { StoreCredentialsResult } from "./useOAuth";
|
|
@@ -13,7 +13,7 @@ type UseAuthCallbackOptions = {
|
|
|
13
13
|
} & OpenfortHookOptions<CallbackResult> & CreateWalletPostAuthOptions;
|
|
14
14
|
export declare const useAuthCallback: ({ enabled, ...hookOptions }?: UseAuthCallbackOptions) => {
|
|
15
15
|
email: string | null;
|
|
16
|
-
provider:
|
|
16
|
+
provider: UIAuthProvider | null;
|
|
17
17
|
verifyEmail: (options: import("./useEmailAuth").VerifyEmailOptions) => Promise<EmailVerificationResult>;
|
|
18
18
|
storeCredentials: ({ player, accessToken, refreshToken, ...options }: import("./useOAuth").StoreCredentialsOptions) => Promise<StoreCredentialsResult>;
|
|
19
19
|
isLoading: boolean;
|
|
@@ -9,10 +9,10 @@ export type CreateWalletPostAuthOptions = {
|
|
|
9
9
|
* @default true
|
|
10
10
|
* It will automatically try to recover the first wallet with automatic recovery.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
recoverWalletAutomatically?: boolean;
|
|
13
13
|
};
|
|
14
14
|
export declare const useConnectToWalletPostAuth: () => {
|
|
15
|
-
tryUseWallet: ({ logoutOnError: signOutOnError,
|
|
15
|
+
tryUseWallet: ({ logoutOnError: signOutOnError, recoverWalletAutomatically }: CreateWalletPostAuthOptions) => Promise<{
|
|
16
16
|
wallet?: UserWallet;
|
|
17
17
|
}>;
|
|
18
18
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UIAuthProvider } from "../../components/Openfort/types";
|
|
2
2
|
export declare function useProviders(): {
|
|
3
|
-
availableProviders:
|
|
4
|
-
linkedProviders:
|
|
5
|
-
allProviders:
|
|
3
|
+
availableProviders: UIAuthProvider[];
|
|
4
|
+
linkedProviders: UIAuthProvider[];
|
|
5
|
+
allProviders: UIAuthProvider[];
|
|
6
6
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AccountTypeEnum, RecoveryMethod, RecoveryParams } from "@openfort/openfort-js";
|
|
2
2
|
import { Hex } from "viem";
|
|
3
3
|
import { Connector } from "wagmi";
|
|
4
|
-
import { embeddedWalletId } from "../../constants/openfort";
|
|
5
4
|
import { OpenfortError, OpenfortHookOptions } from "../../types";
|
|
6
5
|
export type UserWallet = {
|
|
7
6
|
address: Hex;
|
|
@@ -13,25 +12,30 @@ export type UserWallet = {
|
|
|
13
12
|
isActive?: boolean;
|
|
14
13
|
isConnecting?: boolean;
|
|
15
14
|
recoveryMethod?: RecoveryMethod;
|
|
15
|
+
accountId?: string;
|
|
16
|
+
accountType?: AccountTypeEnum;
|
|
17
|
+
ownerAddress?: Hex;
|
|
18
|
+
implementationType?: string;
|
|
19
|
+
createdAt?: number;
|
|
20
|
+
salt?: string;
|
|
21
|
+
};
|
|
22
|
+
export type WalletRecovery = {
|
|
23
|
+
recoveryMethod: RecoveryMethod;
|
|
24
|
+
password?: string;
|
|
16
25
|
};
|
|
17
26
|
type SetActiveWalletResult = {
|
|
18
27
|
error?: OpenfortError;
|
|
19
28
|
wallet?: UserWallet;
|
|
20
29
|
};
|
|
21
30
|
type SetActiveWalletOptions = ({
|
|
22
|
-
|
|
31
|
+
walletId: string;
|
|
32
|
+
recovery?: WalletRecovery;
|
|
23
33
|
address?: Hex | undefined;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} | {
|
|
27
|
-
connector: typeof embeddedWalletId;
|
|
28
|
-
password?: string;
|
|
29
|
-
} | {
|
|
30
|
-
connector: Connector;
|
|
31
|
-
})) & OpenfortHookOptions<SetActiveWalletResult>;
|
|
34
|
+
showUI?: boolean;
|
|
35
|
+
}) & OpenfortHookOptions<SetActiveWalletResult>;
|
|
32
36
|
type CreateWalletResult = SetActiveWalletResult;
|
|
33
37
|
type CreateWalletOptions = {
|
|
34
|
-
|
|
38
|
+
recovery?: WalletRecovery;
|
|
35
39
|
accountType?: AccountTypeEnum;
|
|
36
40
|
} & OpenfortHookOptions<CreateWalletResult>;
|
|
37
41
|
type RecoverEmbeddedWalletResult = SetActiveWalletResult;
|
|
@@ -54,7 +58,7 @@ export declare function useWallets(hookOptions?: WalletOptions): {
|
|
|
54
58
|
activeWallet: UserWallet | undefined;
|
|
55
59
|
setRecovery: (params: SetRecoveryOptions) => Promise<RecoverEmbeddedWalletResult>;
|
|
56
60
|
reset: () => void;
|
|
57
|
-
createWallet: ({
|
|
61
|
+
createWallet: ({ recovery, ...options }?: CreateWalletOptions) => Promise<CreateWalletResult>;
|
|
58
62
|
setActiveWallet: (options: SetActiveWalletOptions | string) => Promise<SetActiveWalletResult>;
|
|
59
63
|
};
|
|
60
64
|
export {};
|
package/build/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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
|
-
export { AuthProvider, } from './components/Openfort/types';
|
|
6
|
+
export { UIAuthProvider as AuthProvider, } from './components/Openfort/types';
|
|
7
7
|
export { OpenfortProvider, } from './components/Openfort/OpenfortProvider';
|
|
8
8
|
export { OpenfortButton } from './components/ConnectButton';
|
|
9
9
|
export { default as Avatar } from './components/Common/Avatar';
|
|
@@ -15,7 +15,7 @@ export { useUser } from './hooks/openfort/useUser';
|
|
|
15
15
|
export { useUI } from "./hooks/openfort/useUI";
|
|
16
16
|
export { useWallets, UserWallet } from "./hooks/openfort/useWallets";
|
|
17
17
|
export { useWallet } from "./hooks/openfort/useWallet";
|
|
18
|
-
export { RecoveryMethod, AuthPlayerResponse } from "@openfort/openfort-js";
|
|
18
|
+
export { RecoveryMethod, AuthPlayerResponse, RecoveryParams } from "@openfort/openfort-js";
|
|
19
19
|
export { useOpenfortCore as useOpenfort } from './openfort/useOpenfort';
|
|
20
20
|
export { useConnectWithSiwe } from './hooks/openfort/useConnectWithSiwe';
|
|
21
21
|
export { embeddedWalletId } from './constants/openfort';
|