@openfort/react 0.1.14 → 0.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.
- package/build/assets/icons.d.ts +3 -0
- package/build/components/Common/Button/types.d.ts +1 -0
- package/build/components/Common/Modal/styles.d.ts +1 -0
- package/build/components/Common/OTPInput/index.d.ts +8 -0
- package/build/components/Common/OTPInput/styles.d.ts +18 -0
- package/build/components/Common/Providers/ProviderHeader.d.ts +7 -0
- package/build/components/Common/Providers/ProviderIcon.d.ts +4 -0
- package/build/components/Common/Providers/getProviderName.d.ts +2 -0
- package/build/components/FloatingGraphic/index.d.ts +3 -1
- package/build/components/FloatingGraphic/styles.d.ts +2 -0
- package/build/components/Openfort/context.d.ts +2 -0
- package/build/components/Openfort/types.d.ts +86 -1
- package/build/components/Pages/EmailOTP/index.d.ts +3 -0
- package/build/components/Pages/EmailOTP/styles.d.ts +4 -0
- package/build/components/Pages/LinkedProvider/index.d.ts +2 -0
- package/build/components/Pages/LinkedProviders/styles.d.ts +2 -1
- package/build/components/Pages/PhoneOTP/index.d.ts +3 -0
- package/build/components/Pages/PhoneOTP/styles.d.ts +4 -0
- package/build/components/Pages/Providers/index.d.ts +2 -1
- package/build/components/Pages/RemoveLinkedProvider/index.d.ts +2 -0
- package/build/hooks/openfort/auth/status.d.ts +3 -1
- package/build/hooks/openfort/auth/useAuthCallback.d.ts +7 -10
- package/build/hooks/openfort/auth/useEmailAuth.d.ts +2 -3
- package/build/hooks/openfort/auth/useEmailOtpAuth.d.ts +29 -0
- package/build/hooks/openfort/auth/useGuestAuth.d.ts +2 -2
- package/build/hooks/openfort/auth/useOAuth.d.ts +5 -6
- package/build/hooks/openfort/auth/usePhoneOtpAuth.d.ts +30 -0
- package/build/hooks/openfort/useConnectWithSiwe.d.ts +4 -3
- package/build/hooks/openfort/useUser.d.ts +3 -2
- package/build/hooks/useConnectCallback.d.ts +3 -3
- package/build/hooks/useRouteProps.d.ts +10 -0
- package/build/index.d.ts +5 -3
- package/build/index.es.js +1715 -548
- package/build/index.es.js.map +1 -1
- package/build/openfort/CoreOpenfortProvider.d.ts +5 -3
- package/build/openfortCustomTypes.d.ts +10 -0
- package/build/siwe/create-siwe-message.d.ts +1 -1
- package/build/types.d.ts +4 -4
- package/build/utils/validation.d.ts +1 -0
- package/build/version.d.ts +1 -1
- package/package.json +4 -3
package/build/assets/icons.d.ts
CHANGED
|
@@ -35,6 +35,9 @@ export declare const AuthIcon: ({ ...props }: {
|
|
|
35
35
|
export declare const EmailIcon: ({ ...props }: {
|
|
36
36
|
[x: string]: any;
|
|
37
37
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare const PhoneIcon: ({ ...props }: {
|
|
39
|
+
[x: string]: any;
|
|
40
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
38
41
|
export declare const GuestIcon: ({ ...props }: {
|
|
39
42
|
[x: string]: any;
|
|
40
43
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,6 +12,7 @@ export declare const ModalH1: import("styled-components").StyledComponent<import
|
|
|
12
12
|
}, never>;
|
|
13
13
|
export declare const ModalBody: import("styled-components").StyledComponent<"div", any, {
|
|
14
14
|
$error?: boolean;
|
|
15
|
+
$valid?: boolean;
|
|
15
16
|
}, never>;
|
|
16
17
|
export declare const BackgroundOverlay: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {
|
|
17
18
|
$active: boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function OtpInputStandalone({ length, onChange, onComplete, isLoading, isError, isSuccess, }: {
|
|
2
|
+
length?: number;
|
|
3
|
+
onChange?: (value: string) => void;
|
|
4
|
+
onComplete?: (value: string) => void;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
isError?: boolean;
|
|
7
|
+
isSuccess?: boolean;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const OtpContainer: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
showBorder: boolean;
|
|
3
|
+
}, never>;
|
|
4
|
+
export declare const OTPGroup: import("styled-components").StyledComponent<"div", any, {
|
|
5
|
+
isError?: boolean;
|
|
6
|
+
isSuccess?: boolean;
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
}, never>;
|
|
9
|
+
export declare const OTPSlotWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
}, never>;
|
|
12
|
+
export declare const OTPNumberValue: import("styled-components").StyledComponent<"div", any, {
|
|
13
|
+
$hide?: boolean;
|
|
14
|
+
}, never>;
|
|
15
|
+
export declare const OTPHiddenInput: import("styled-components").StyledComponent<"input", any, {}, never>;
|
|
16
|
+
export declare const FakeCaretWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
|
+
export declare const CaretBar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
+
export declare const SuccessTickWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -3,8 +3,10 @@ type LogoGraphicProps = {
|
|
|
3
3
|
size?: string;
|
|
4
4
|
logo: React.ReactNode;
|
|
5
5
|
};
|
|
6
|
-
export declare const FloatingGraphic: ({ height, logoCenter, logoTopRight, logoTopLeft, logoBottomRight, logoBottomLeft, }: {
|
|
6
|
+
export declare const FloatingGraphic: ({ height, marginBottom, marginTop, logoCenter, logoTopRight, logoTopLeft, logoBottomRight, logoBottomLeft, }: {
|
|
7
7
|
height?: string;
|
|
8
|
+
marginBottom?: string;
|
|
9
|
+
marginTop?: string;
|
|
8
10
|
logoCenter: LogoGraphicProps;
|
|
9
11
|
logoTopRight?: LogoGraphicProps;
|
|
10
12
|
logoTopLeft?: LogoGraphicProps;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const Graphic: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {
|
|
2
2
|
$height?: string;
|
|
3
|
+
$marginBottom?: string;
|
|
4
|
+
$marginTop?: string;
|
|
3
5
|
}, never>;
|
|
4
6
|
export declare const LogoGroup: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
5
7
|
export declare const GraphicBackground: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
@@ -43,6 +43,8 @@ export type ContextValue = {
|
|
|
43
43
|
thirdPartyAuth?: ThirdPartyAuthConfiguration;
|
|
44
44
|
emailInput: string;
|
|
45
45
|
setEmailInput: React.Dispatch<React.SetStateAction<string>>;
|
|
46
|
+
phoneInput: string;
|
|
47
|
+
setPhoneInput: React.Dispatch<React.SetStateAction<string>>;
|
|
46
48
|
sendForm: SendFormState;
|
|
47
49
|
setSendForm: React.Dispatch<React.SetStateAction<SendFormState>>;
|
|
48
50
|
buyForm: BuyFormState;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { AccountTypeEnum, RecoveryMethod } from '@openfort/openfort-js';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
|
+
import type { CountryData, CountryIso2, CountrySelectorProps } from 'react-international-phone';
|
|
4
5
|
import type { Hex } from 'viem';
|
|
5
6
|
import type { getAssets } from 'viem/_types/experimental/erc7811/actions/getAssets';
|
|
6
7
|
import type { UserWallet } from '../../hooks/openfort/useWallets';
|
|
8
|
+
import type { UserAccount } from '../../openfortCustomTypes';
|
|
7
9
|
import type { CustomAvatarProps, CustomTheme, Languages, Mode, Theme } from '../../types';
|
|
8
10
|
export declare const routes: {
|
|
9
11
|
readonly PROVIDERS: "providers";
|
|
@@ -16,6 +18,8 @@ export declare const routes: {
|
|
|
16
18
|
readonly CONNECTED_SUCCESS: "connectedSuccess";
|
|
17
19
|
readonly CREATE_GUEST_USER: "createGuestUser";
|
|
18
20
|
readonly EMAIL_LOGIN: "emailLogin";
|
|
21
|
+
readonly EMAIL_OTP: "emailOtp";
|
|
22
|
+
readonly PHONE_OTP: "phoneOtp";
|
|
19
23
|
readonly FORGOT_PASSWORD: "forgotPassword";
|
|
20
24
|
readonly EMAIL_VERIFICATION: "emailVerification";
|
|
21
25
|
readonly LINK_EMAIL: "linkEmail";
|
|
@@ -29,7 +33,9 @@ export declare const routes: {
|
|
|
29
33
|
readonly CONNECTED: "connected";
|
|
30
34
|
readonly PROFILE: "profile";
|
|
31
35
|
readonly SWITCHNETWORKS: "switchNetworks";
|
|
36
|
+
readonly LINKED_PROVIDER: "linkedProvider";
|
|
32
37
|
readonly LINKED_PROVIDERS: "linkedProviders";
|
|
38
|
+
readonly REMOVE_LINKED_PROVIDER: "removeLinkedProvider";
|
|
33
39
|
readonly EXPORT_KEY: "exportKey";
|
|
34
40
|
readonly NO_ASSETS_AVAILABLE: "noAssetsAvailable";
|
|
35
41
|
readonly ASSET_INVENTORY: "assetInventory";
|
|
@@ -59,6 +65,12 @@ type RoutesWithOptions = ({
|
|
|
59
65
|
} & ConnectOptions) | {
|
|
60
66
|
route: typeof routes.RECOVER_WALLET;
|
|
61
67
|
wallet: UserWallet;
|
|
68
|
+
} | {
|
|
69
|
+
route: typeof routes.LINKED_PROVIDER;
|
|
70
|
+
provider: UserAccount;
|
|
71
|
+
} | {
|
|
72
|
+
route: typeof routes.REMOVE_LINKED_PROVIDER;
|
|
73
|
+
provider: UserAccount;
|
|
62
74
|
};
|
|
63
75
|
export type RoutesWithoutOptions = {
|
|
64
76
|
route: Exclude<AllRoutes, RoutesWithOptions['route']>;
|
|
@@ -68,10 +80,17 @@ export type SetRouteOptions = RouteOptions | RoutesWithoutOptions['route'];
|
|
|
68
80
|
export declare enum UIAuthProvider {
|
|
69
81
|
GOOGLE = "google",
|
|
70
82
|
TWITTER = "twitter",
|
|
83
|
+
X = "twitter",
|
|
71
84
|
FACEBOOK = "facebook",
|
|
72
85
|
DISCORD = "discord",
|
|
73
86
|
APPLE = "apple",
|
|
74
|
-
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated Use `UIAuthProvider.EMAIL_PASSWORD` or `UIAuthProvider.EMAIL_OTP` instead.
|
|
89
|
+
*/
|
|
90
|
+
EMAIL = "emailPassword",
|
|
91
|
+
EMAIL_PASSWORD = "emailPassword",
|
|
92
|
+
EMAIL_OTP = "emailOtp",
|
|
93
|
+
PHONE = "phone",
|
|
75
94
|
WALLET = "wallet",
|
|
76
95
|
GUEST = "guest"
|
|
77
96
|
}
|
|
@@ -132,6 +151,70 @@ type WalletRecoveryOptions = {
|
|
|
132
151
|
allowedMethods?: RecoveryMethod[];
|
|
133
152
|
defaultMethod?: RecoveryMethod;
|
|
134
153
|
};
|
|
154
|
+
export type PhoneConfig = {
|
|
155
|
+
/**
|
|
156
|
+
* @description Default country value (iso2).
|
|
157
|
+
* @default "us"
|
|
158
|
+
*/
|
|
159
|
+
defaultCountry?: CountryIso2;
|
|
160
|
+
/**
|
|
161
|
+
* @description Array of available countries for guessing.
|
|
162
|
+
* @default defaultCountries // full country list
|
|
163
|
+
*/
|
|
164
|
+
countries?: CountryData[];
|
|
165
|
+
/**
|
|
166
|
+
* @description Countries to display at the top of the list of dropdown options.
|
|
167
|
+
* @default []
|
|
168
|
+
*/
|
|
169
|
+
preferredCountries?: CountryIso2[];
|
|
170
|
+
/**
|
|
171
|
+
* @description Disable country guess on value change.
|
|
172
|
+
* @default false
|
|
173
|
+
*/
|
|
174
|
+
disableCountryGuess?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* @description
|
|
177
|
+
* Disable dial code prefill on initialization.
|
|
178
|
+
* Dial code prefill works only when "empty" phone value have been provided.
|
|
179
|
+
* @default false
|
|
180
|
+
*/
|
|
181
|
+
disableDialCodePrefill?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* @description
|
|
184
|
+
* Always display the dial code.
|
|
185
|
+
* Dial code can't be removed/changed by keyboard events, but it can be changed by pasting another country phone value.
|
|
186
|
+
* @default false
|
|
187
|
+
*/
|
|
188
|
+
forceDialCode?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* @description Display phone value will not include passed *dialCode* and *prefix* if set to *true*.
|
|
191
|
+
* @ignore *forceDialCode* value will be ignored.
|
|
192
|
+
* @default false
|
|
193
|
+
*/
|
|
194
|
+
disableDialCodeAndPrefix?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* @description Disable phone value mask formatting. All formatting characters will not be displayed, but the mask length will be preserved.
|
|
197
|
+
* @default false
|
|
198
|
+
*/
|
|
199
|
+
disableFormatting?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* @description Hide the dropdown icon. Make country selection not accessible.
|
|
202
|
+
* @default false
|
|
203
|
+
*/
|
|
204
|
+
hideDropdown?: CountrySelectorProps['hideDropdown'];
|
|
205
|
+
/**
|
|
206
|
+
* @description
|
|
207
|
+
* Show prefix and dial code between country selector and phone input.
|
|
208
|
+
* Works only when *disableDialCodeAndPrefix* is *true*
|
|
209
|
+
* @default false
|
|
210
|
+
*/
|
|
211
|
+
showDisabledDialCodeAndPrefix?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* @description Disable auto focus on input field after country select.
|
|
214
|
+
* @default false
|
|
215
|
+
*/
|
|
216
|
+
disableFocusAfterCountrySelect?: boolean;
|
|
217
|
+
};
|
|
135
218
|
export type ConnectUIOptions = {
|
|
136
219
|
theme?: Theme;
|
|
137
220
|
mode?: Mode;
|
|
@@ -158,6 +241,7 @@ export type ConnectUIOptions = {
|
|
|
158
241
|
buyWithCardUrl?: string;
|
|
159
242
|
buyFromExchangeUrl?: string;
|
|
160
243
|
buyTroubleshootingUrl?: string;
|
|
244
|
+
phoneConfig?: PhoneConfig;
|
|
161
245
|
} & Partial<OpenfortUIOptions>;
|
|
162
246
|
type WalletRecoveryOptionsExtended = {
|
|
163
247
|
allowedMethods: RecoveryMethod[];
|
|
@@ -196,6 +280,7 @@ export type OpenfortUIOptionsExtended = {
|
|
|
196
280
|
buyFromExchangeUrl?: string;
|
|
197
281
|
buyTroubleshootingUrl?: string;
|
|
198
282
|
walletRecovery: WalletRecoveryOptionsExtended;
|
|
283
|
+
phoneConfig?: PhoneConfig;
|
|
199
284
|
} & OpenfortUIOptions;
|
|
200
285
|
export type Asset = {
|
|
201
286
|
type: 'native';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const Body: import("styled-components").StyledComponent<"p", any, {}, never>;
|
|
2
|
+
export declare const ResultContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const FooterButtonText: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
4
|
+
export declare const FooterTextButton: import("styled-components").StyledComponent<"p", any, {}, never>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const ProviderIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const LinkedProviderButtonContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const LinkedProviderButtonWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
4
|
export declare const LinkedProvidersGroupWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
5
|
export declare const LinkedProviderText: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const Body: import("styled-components").StyledComponent<"p", any, {}, never>;
|
|
2
|
+
export declare const ResultContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const FooterButtonText: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
4
|
+
export declare const FooterTextButton: import("styled-components").StyledComponent<"p", any, {}, never>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import 'react-international-phone/style.css';
|
|
2
3
|
import { UIAuthProvider } from '../../Openfort/types';
|
|
3
|
-
export declare const
|
|
4
|
+
export declare const ProviderButton: React.FC<{
|
|
4
5
|
provider: UIAuthProvider;
|
|
5
6
|
}>;
|
|
6
7
|
declare const Providers: React.FC;
|
|
@@ -6,7 +6,9 @@ export type BaseFlowState = {
|
|
|
6
6
|
status: 'error';
|
|
7
7
|
error: OpenfortError | null;
|
|
8
8
|
};
|
|
9
|
-
export declare const mapStatus: (status: BaseFlowState
|
|
9
|
+
export declare const mapStatus: (status: BaseFlowState | {
|
|
10
|
+
status: string;
|
|
11
|
+
}) => {
|
|
10
12
|
isLoading: boolean;
|
|
11
13
|
isError: boolean;
|
|
12
14
|
isSuccess: boolean;
|
|
@@ -63,13 +63,11 @@ type UseAuthCallbackOptions = {
|
|
|
63
63
|
* state: 'verification-token',
|
|
64
64
|
* });
|
|
65
65
|
* };
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* const handleManualStore = async () => {
|
|
66
|
+
* // Manually trigger storing credentials (if needed)
|
|
67
|
+
* const handleManualStoreCredentials = async () => {
|
|
69
68
|
* await authCallback.storeCredentials({
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* refreshToken: 'refresh-token',
|
|
69
|
+
* userId: 'player-id',
|
|
70
|
+
* token: 'access-token',
|
|
73
71
|
* });
|
|
74
72
|
* };
|
|
75
73
|
* ```
|
|
@@ -81,10 +79,9 @@ export declare const useAuthCallback: ({ enabled, ...hookOptions }?: UseAuthCall
|
|
|
81
79
|
email: string;
|
|
82
80
|
state: string;
|
|
83
81
|
} & OpenfortHookOptions<EmailVerificationResult>) => Promise<EmailVerificationResult>;
|
|
84
|
-
storeCredentials: ({
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
refreshToken: string;
|
|
82
|
+
storeCredentials: ({ userId, token, ...options }: {
|
|
83
|
+
userId: string;
|
|
84
|
+
token: string;
|
|
88
85
|
} & OpenfortHookOptions<StoreCredentialsResult> & CreateWalletPostAuthOptions) => Promise<StoreCredentialsResult>;
|
|
89
86
|
isLoading: boolean;
|
|
90
87
|
isError: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { User } from '@openfort/openfort-js';
|
|
2
2
|
import { OpenfortError, type OpenfortHookOptions } from '../../../types';
|
|
3
3
|
import type { UserWallet } from '../useWallets';
|
|
4
4
|
import { type CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
5
5
|
type EmailAuthResult = {
|
|
6
6
|
error?: OpenfortError;
|
|
7
|
-
user?:
|
|
7
|
+
user?: User;
|
|
8
8
|
wallet?: UserWallet;
|
|
9
9
|
requiresEmailVerification?: boolean;
|
|
10
10
|
};
|
|
@@ -30,7 +30,6 @@ type ResetPasswordOptions = {
|
|
|
30
30
|
} & OpenfortHookOptions<EmailAuthResult>;
|
|
31
31
|
type LinkEmailOptions = {
|
|
32
32
|
email: string;
|
|
33
|
-
password: string;
|
|
34
33
|
emailVerificationRedirectTo?: string;
|
|
35
34
|
} & OpenfortHookOptions<EmailAuthResult>;
|
|
36
35
|
type VerifyEmailOptions = {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { User } from '@openfort/openfort-js';
|
|
2
|
+
import { OpenfortError, type OpenfortHookOptions } from '../../../types';
|
|
3
|
+
import type { UserWallet } from '../useWallets';
|
|
4
|
+
import { type CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
5
|
+
type EmailOtpAuthResult = {
|
|
6
|
+
error?: OpenfortError;
|
|
7
|
+
user?: User;
|
|
8
|
+
wallet?: UserWallet;
|
|
9
|
+
};
|
|
10
|
+
type LoginWithEmailOtpOptions = {
|
|
11
|
+
email: string;
|
|
12
|
+
otp: string;
|
|
13
|
+
} & OpenfortHookOptions<EmailOtpAuthResult> & CreateWalletPostAuthOptions;
|
|
14
|
+
type RequestEmailOtpOptions = {
|
|
15
|
+
email: string;
|
|
16
|
+
} & OpenfortHookOptions<EmailOtpAuthResult> & CreateWalletPostAuthOptions;
|
|
17
|
+
type UseEmailOtpHookOptions = OpenfortHookOptions<EmailOtpAuthResult> & CreateWalletPostAuthOptions;
|
|
18
|
+
export declare const useEmailOtpAuth: (hookOptions?: UseEmailOtpHookOptions) => {
|
|
19
|
+
isAwaitingInput: boolean;
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
isError: boolean;
|
|
22
|
+
isSuccess: boolean;
|
|
23
|
+
error: OpenfortError | null | undefined;
|
|
24
|
+
signInEmailOtp: (options: LoginWithEmailOtpOptions) => Promise<EmailOtpAuthResult>;
|
|
25
|
+
requestEmailOtp: (options: RequestEmailOtpOptions) => Promise<EmailOtpAuthResult>;
|
|
26
|
+
reset: () => void;
|
|
27
|
+
isRequesting: boolean;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { User } from '@openfort/openfort-js';
|
|
2
2
|
import { OpenfortError, type OpenfortHookOptions } from '../../../types';
|
|
3
3
|
import type { UserWallet } from '../useWallets';
|
|
4
4
|
import { type CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
5
5
|
type GuestHookResult = {
|
|
6
6
|
error?: OpenfortError;
|
|
7
|
-
user?:
|
|
7
|
+
user?: User;
|
|
8
8
|
wallet?: UserWallet;
|
|
9
9
|
};
|
|
10
10
|
type GuestHookOptions = OpenfortHookOptions<GuestHookResult> & CreateWalletPostAuthOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OAuthProvider,
|
|
1
|
+
import type { OAuthProvider, User } from '@openfort/openfort-js';
|
|
2
2
|
import { OpenfortError, type OpenfortHookOptions } from '../../../types';
|
|
3
3
|
import type { UserWallet } from '../useWallets';
|
|
4
4
|
import { type CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
@@ -10,14 +10,13 @@ type InitOAuthReturnType = {
|
|
|
10
10
|
error?: OpenfortError;
|
|
11
11
|
};
|
|
12
12
|
export type StoreCredentialsResult = {
|
|
13
|
-
user?:
|
|
13
|
+
user?: User;
|
|
14
14
|
wallet?: UserWallet;
|
|
15
15
|
error?: OpenfortError;
|
|
16
16
|
};
|
|
17
17
|
type StoreCredentialsOptions = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
refreshToken: string;
|
|
18
|
+
userId: string;
|
|
19
|
+
token: string;
|
|
21
20
|
} & OpenfortHookOptions<StoreCredentialsResult> & CreateWalletPostAuthOptions;
|
|
22
21
|
type AuthHookOptions = {
|
|
23
22
|
redirectTo?: string;
|
|
@@ -103,6 +102,6 @@ export declare const useOAuth: (hookOptions?: AuthHookOptions) => {
|
|
|
103
102
|
error: OpenfortError | null | undefined;
|
|
104
103
|
initOAuth: (options: InitializeOAuthOptions) => Promise<InitOAuthReturnType>;
|
|
105
104
|
linkOauth: (options: InitializeOAuthOptions) => Promise<InitOAuthReturnType>;
|
|
106
|
-
storeCredentials: ({
|
|
105
|
+
storeCredentials: ({ userId, token, ...options }: StoreCredentialsOptions) => Promise<StoreCredentialsResult>;
|
|
107
106
|
};
|
|
108
107
|
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { User } from '@openfort/openfort-js';
|
|
2
|
+
import { OpenfortError, type OpenfortHookOptions } from '../../../types';
|
|
3
|
+
import type { UserWallet } from '../useWallets';
|
|
4
|
+
import { type CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
5
|
+
type PhoneAuthResult = {
|
|
6
|
+
error?: OpenfortError;
|
|
7
|
+
user?: User;
|
|
8
|
+
wallet?: UserWallet;
|
|
9
|
+
};
|
|
10
|
+
type LoginWithPhoneOtpOptions = {
|
|
11
|
+
phoneNumber: string;
|
|
12
|
+
otp: string;
|
|
13
|
+
} & OpenfortHookOptions<PhoneAuthResult> & CreateWalletPostAuthOptions;
|
|
14
|
+
type RequestPhoneOtpOptions = {
|
|
15
|
+
phoneNumber: string;
|
|
16
|
+
} & OpenfortHookOptions<PhoneAuthResult> & CreateWalletPostAuthOptions;
|
|
17
|
+
type UsePhoneHookOptions = OpenfortHookOptions<PhoneAuthResult> & CreateWalletPostAuthOptions;
|
|
18
|
+
export declare const usePhoneOtpAuth: (hookOptions?: UsePhoneHookOptions) => {
|
|
19
|
+
isAwaitingInput: boolean;
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
isError: boolean;
|
|
22
|
+
isSuccess: boolean;
|
|
23
|
+
error: OpenfortError | null | undefined;
|
|
24
|
+
logInWithPhoneOtp: (options: LoginWithPhoneOtpOptions) => Promise<PhoneAuthResult>;
|
|
25
|
+
requestPhoneOtp: (options: RequestPhoneOtpOptions) => Promise<PhoneAuthResult>;
|
|
26
|
+
linkPhoneOtp: (options: LoginWithPhoneOtpOptions) => Promise<PhoneAuthResult>;
|
|
27
|
+
reset: () => void;
|
|
28
|
+
isRequesting: boolean;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function useConnectWithSiwe(): ({ onError, onConnect, connectorType: propsConnectorType, walletClientType: propsWalletClientType, }?: {
|
|
1
|
+
import { OpenfortError } from '@openfort/openfort-js';
|
|
2
|
+
export declare function useConnectWithSiwe(): ({ onError, onConnect, connectorType: propsConnectorType, walletClientType: propsWalletClientType, link, }?: {
|
|
3
3
|
connectorType?: string;
|
|
4
4
|
walletClientType?: string;
|
|
5
|
-
onError?: (error: string, openfortError?:
|
|
5
|
+
onError?: (error: string, openfortError?: OpenfortError) => void;
|
|
6
6
|
onConnect?: () => void;
|
|
7
|
+
link?: boolean;
|
|
7
8
|
}) => Promise<void>;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* console.log('User is authenticated:', userHook.user);
|
|
17
17
|
* console.log('User ID:', userHook.user.id);
|
|
18
18
|
* console.log('User email:', userHook.user.email);
|
|
19
|
-
* console.log('Linked accounts:', userHook.
|
|
19
|
+
* console.log('Linked accounts:', userHook.linkedAccounts);
|
|
20
20
|
* } else {
|
|
21
21
|
* console.log('User is not authenticated');
|
|
22
22
|
* }
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
export declare function useUser(): {
|
|
46
|
-
user: import("@openfort/openfort-js").
|
|
46
|
+
user: import("@openfort/openfort-js").User | null;
|
|
47
|
+
linkedAccounts: import("../../openfortCustomTypes").UserAccount[];
|
|
47
48
|
isAuthenticated: boolean;
|
|
48
49
|
getAccessToken: () => Promise<string | null>;
|
|
49
50
|
validateAndRefreshToken: () => Promise<void>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { User } from '@openfort/openfort-js';
|
|
2
2
|
export type useConnectCallbackProps = {
|
|
3
|
-
onConnect?: ({ address, connectorId, user
|
|
3
|
+
onConnect?: ({ address, connectorId, user }: {
|
|
4
4
|
address?: string;
|
|
5
5
|
connectorId?: string;
|
|
6
|
-
user?:
|
|
6
|
+
user?: User;
|
|
7
7
|
}) => void;
|
|
8
8
|
onDisconnect?: () => void;
|
|
9
9
|
};
|
|
@@ -32,4 +32,14 @@ export declare const useRouteProps: <T extends RouteOptions["route"]>(currentRou
|
|
|
32
32
|
wallet: import("..").UserWallet;
|
|
33
33
|
}, {
|
|
34
34
|
route: T;
|
|
35
|
+
}> | Extract<{
|
|
36
|
+
route: "linkedProvider";
|
|
37
|
+
provider: import("../openfortCustomTypes").UserAccount;
|
|
38
|
+
}, {
|
|
39
|
+
route: T;
|
|
40
|
+
}> | Extract<{
|
|
41
|
+
route: "removeLinkedProvider";
|
|
42
|
+
provider: import("../openfortCustomTypes").UserAccount;
|
|
43
|
+
}, {
|
|
44
|
+
route: T;
|
|
35
45
|
}>;
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AccountTypeEnum, AuthInitPayload,
|
|
1
|
+
export { AccountTypeEnum, AuthInitPayload, AuthResponse, EmbeddedAccount, OpenfortEventMap, OpenfortEvents, openfortEvents, RecoveryMethod, RecoveryParams, SignedMessagePayload, User, } from '@openfort/openfort-js';
|
|
2
2
|
export { default as Avatar } from './components/Common/Avatar';
|
|
3
3
|
export { default as ChainIcon } from './components/Common/Chain';
|
|
4
4
|
export { OpenfortButton } from './components/ConnectButton';
|
|
@@ -25,7 +25,9 @@ export { useChainIsSupported } from './hooks/useChainIsSupported';
|
|
|
25
25
|
export { useChains } from './hooks/useChains';
|
|
26
26
|
export { useOpenfortCore as useOpenfort } from './openfort/useOpenfort';
|
|
27
27
|
export type { CustomTheme } from './styles/customTheme';
|
|
28
|
-
export type {
|
|
29
|
-
export { OAuthProvider, OpenfortError, OpenfortErrorType, SDKOverrides, ThirdPartyOAuthProvider, } from './types';
|
|
28
|
+
export type { CustomAvatarProps, Languages, Mode, OpenfortHookOptions, OpenfortOptions, OpenfortWalletConfig, PhoneConfig, Theme, } from './types';
|
|
29
|
+
export { OAuthProvider, OpenfortError, OpenfortReactErrorType as OpenfortErrorType, SDKOverrides, ThirdPartyOAuthProvider, } from './types';
|
|
30
30
|
export { OPENFORT_VERSION } from './version';
|
|
31
31
|
export { wallets } from './wallets';
|
|
32
|
+
import type { CountryData, CountryIso2, CountrySelectorProps } from 'react-international-phone';
|
|
33
|
+
export type { CountryData, CountryIso2, CountrySelectorProps };
|