@coinbase/cdp-react 0.0.97 → 0.0.99
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/dist/components/AuthButton/index.d.ts +102 -0
- package/dist/components/CDPReactProvider/index.d.ts +114 -0
- package/dist/components/CopyAddress/index.d.ts +29 -0
- package/dist/components/CopyEvmKeyButton/index.d.ts +77 -0
- package/dist/components/CopySolanaKeyButton/index.d.ts +73 -0
- package/dist/components/EnrollMfa/EnrollMfaDescription.d.ts +21 -0
- package/dist/components/EnrollMfa/EnrollMfaFlow.d.ts +27 -0
- package/dist/components/EnrollMfa/EnrollMfaFlowBackButton.d.ts +19 -0
- package/dist/components/EnrollMfa/EnrollMfaFlowProvider.d.ts +52 -0
- package/dist/components/EnrollMfa/EnrollMfaFooter.d.ts +18 -0
- package/dist/components/EnrollMfa/EnrollMfaImage.d.ts +24 -0
- package/dist/components/EnrollMfa/EnrollMfaItem.d.ts +21 -0
- package/dist/components/EnrollMfa/EnrollMfaItems.d.ts +17 -0
- package/dist/components/EnrollMfa/EnrollMfaProvider.d.ts +35 -0
- package/dist/components/EnrollMfa/EnrollMfaTitle.d.ts +21 -0
- package/dist/components/EnrollMfa/index.d.ts +65 -0
- package/dist/components/EnrollMfa/methods/sms.d.ts +25 -0
- package/dist/components/EnrollMfa/methods/totp.d.ts +25 -0
- package/dist/components/EnrollMfa/types.d.ts +48 -0
- package/dist/components/EnrollMfa/useEnrollMfaReducer.d.ts +6 -0
- package/dist/components/EnrollMfaModal/index.d.ts +111 -0
- package/dist/components/ExportWallet/index.d.ts +163 -0
- package/dist/components/ExportWalletModal/index.d.ts +173 -0
- package/dist/components/Fund/FundForm.d.ts +18 -0
- package/dist/components/Fund/FundProvider.d.ts +17 -0
- package/dist/components/Fund/FundTitle.d.ts +12 -0
- package/dist/components/Fund/components/FundAmountInput.d.ts +13 -0
- package/dist/components/Fund/components/FundErrorScreen.d.ts +7 -0
- package/dist/components/Fund/components/FundPaymentMethods.d.ts +7 -0
- package/dist/components/Fund/components/FundPresetAmountInputs.d.ts +7 -0
- package/dist/components/Fund/components/FundTransactionStatus.d.ts +6 -0
- package/dist/components/Fund/hooks/useBuyUrl.d.ts +23 -0
- package/dist/components/Fund/hooks/useEmitLifecycleStatus.d.ts +12 -0
- package/dist/components/Fund/hooks/useExchangeRate.d.ts +17 -0
- package/dist/components/Fund/hooks/usePaymentMethods.d.ts +16 -0
- package/dist/components/Fund/hooks/usePopupMonitor.d.ts +9 -0
- package/dist/components/Fund/hooks/useSetupOnrampEventListeners.d.ts +6 -0
- package/dist/components/Fund/index.d.ts +87 -0
- package/dist/components/Fund/types.d.ts +137 -0
- package/dist/components/Fund/useFundReducer.d.ts +15 -0
- package/dist/components/Fund/utils/buildPaymentMethods.d.ts +15 -0
- package/dist/components/Fund/utils/setupOnrampEventListeners.d.ts +10 -0
- package/dist/components/Fund/utils/subscribeToWindowMessage.d.ts +27 -0
- package/dist/components/FundModal/index.d.ts +106 -0
- package/dist/components/LinkAuth/LinkAuthFlow.d.ts +25 -0
- package/dist/components/LinkAuth/LinkAuthFlowBackButton.d.ts +19 -0
- package/dist/components/LinkAuth/LinkAuthFlowProvider.d.ts +60 -0
- package/dist/components/LinkAuth/LinkAuthItem.d.ts +23 -0
- package/dist/components/LinkAuth/LinkAuthItems.d.ts +17 -0
- package/dist/components/LinkAuth/LinkAuthProvider.d.ts +31 -0
- package/dist/components/LinkAuth/LinkAuthTitle.d.ts +17 -0
- package/dist/components/LinkAuth/index.d.ts +170 -0
- package/dist/components/LinkAuth/types.d.ts +31 -0
- package/dist/components/LinkAuth/utils.d.ts +12 -0
- package/dist/components/LinkAuthModal/index.d.ts +112 -0
- package/dist/components/OAuthStatusModal/index.d.ts +24 -0
- package/dist/components/SendEvmTransactionButton/index.d.ts +27 -0
- package/dist/components/SendSolanaTransactionButton/index.d.ts +27 -0
- package/dist/components/SignIn/SignInAuthMethodButtons.d.ts +26 -0
- package/dist/components/SignIn/SignInBackButton.d.ts +40 -0
- package/dist/components/SignIn/SignInCredentials.d.ts +13 -0
- package/dist/components/SignIn/SignInDescription.d.ts +35 -0
- package/dist/components/SignIn/SignInFooter.d.ts +27 -0
- package/dist/components/SignIn/SignInForm.d.ts +39 -0
- package/dist/components/SignIn/SignInImage.d.ts +38 -0
- package/dist/components/SignIn/SignInProvider.d.ts +54 -0
- package/dist/components/SignIn/SignInTitle.d.ts +35 -0
- package/dist/components/SignIn/flows/SignInWithEmail.d.ts +26 -0
- package/dist/components/SignIn/flows/SignInWithOAuth.d.ts +19 -0
- package/dist/components/SignIn/flows/SignInWithSms.d.ts +26 -0
- package/dist/components/SignIn/hooks/useEmailForm.d.ts +7 -0
- package/dist/components/SignIn/hooks/useOTPForm.d.ts +8 -0
- package/dist/components/SignIn/hooks/usePhoneNumberForm.d.ts +7 -0
- package/dist/components/SignIn/hooks/useSignInWithOAuth.d.ts +8 -0
- package/dist/components/SignIn/index.d.ts +124 -0
- package/dist/components/SignIn/types.d.ts +37 -0
- package/dist/components/SignIn/useSignInReducer.d.ts +9 -0
- package/dist/components/SignInModal/index.d.ts +123 -0
- package/dist/components/SignOutButton/index.d.ts +39 -0
- package/dist/components/ThemeProvider/index.d.ts +70 -0
- package/dist/components/VerifyMfa/VerifyMfaDescription.d.ts +24 -0
- package/dist/components/VerifyMfa/VerifyMfaFlow.d.ts +30 -0
- package/dist/components/VerifyMfa/VerifyMfaFlowBackButton.d.ts +19 -0
- package/dist/components/VerifyMfa/VerifyMfaFlowProvider.d.ts +51 -0
- package/dist/components/VerifyMfa/VerifyMfaFooter.d.ts +18 -0
- package/dist/components/VerifyMfa/VerifyMfaImage.d.ts +23 -0
- package/dist/components/VerifyMfa/VerifyMfaItem.d.ts +20 -0
- package/dist/components/VerifyMfa/VerifyMfaItems.d.ts +18 -0
- package/dist/components/VerifyMfa/VerifyMfaProvider.d.ts +40 -0
- package/dist/components/VerifyMfa/VerifyMfaTitle.d.ts +24 -0
- package/dist/components/VerifyMfa/index.d.ts +55 -0
- package/dist/components/VerifyMfa/methods/sms.d.ts +29 -0
- package/dist/components/VerifyMfa/methods/totp.d.ts +29 -0
- package/dist/components/VerifyMfa/types.d.ts +33 -0
- package/dist/components/VerifyMfa/useVerifyMfaReducer.d.ts +7 -0
- package/dist/components/VerifyMfaInline/index.d.ts +212 -0
- package/dist/components/VerifyMfaModal/index.d.ts +114 -0
- package/dist/components/forms/AmountInput/index.d.ts +16 -0
- package/dist/components/forms/AmountInput/types.d.ts +9 -0
- package/dist/components/forms/AmountInput/useAmountInput.d.ts +14 -0
- package/dist/components/forms/AmountInput/useInputScale.d.ts +12 -0
- package/dist/components/forms/AmountInput/useNumberParseAndFormat.d.ts +20 -0
- package/dist/components/forms/CountrySelect/index.d.ts +9 -0
- package/dist/components/forms/EmailForm/index.d.ts +17 -0
- package/dist/components/forms/ExchangeAmountInput/index.d.ts +19 -0
- package/dist/components/forms/ExchangeAmountInput/types.d.ts +12 -0
- package/dist/components/forms/ExchangeAmountInput/useExchangeAmountInput.d.ts +17 -0
- package/dist/components/forms/Field/index.d.ts +15 -0
- package/dist/components/forms/Input/index.d.ts +15 -0
- package/dist/components/forms/Label/index.d.ts +8 -0
- package/dist/components/forms/OTP/index.d.ts +6 -0
- package/dist/components/forms/OTPForm/index.d.ts +20 -0
- package/dist/components/forms/PhoneNumberForm/index.d.ts +27 -0
- package/dist/components/forms/PhoneNumberInput/index.d.ts +16 -0
- package/dist/components/forms/PhoneNumberInput/maskOverride.d.ts +6 -0
- package/dist/components/forms/PhoneNumberInput/usePhoneNumberFormatter.d.ts +7 -0
- package/dist/components/forms/Select/index.d.ts +30 -0
- package/dist/components/ui/Badge/index.d.ts +19 -0
- package/dist/components/ui/Banner/index.d.ts +25 -0
- package/dist/components/ui/Button/index.d.ts +50 -0
- package/dist/components/ui/ButtonBase/index.d.ts +20 -0
- package/dist/components/ui/CoinbaseFooter/index.d.ts +16 -0
- package/dist/components/ui/CopyTextField/index.d.ts +35 -0
- package/dist/components/ui/Error/index.d.ts +14 -0
- package/dist/components/ui/IframeButton/index.d.ts +17 -0
- package/dist/components/ui/LoadingSkeleton/index.d.ts +22 -0
- package/dist/components/ui/LoadingSpinner/index.d.ts +11 -0
- package/dist/components/ui/Modal/index.d.ts +82 -0
- package/dist/components/ui/QRCode/QRCodeSvg.d.ts +35 -0
- package/dist/components/ui/QRCode/index.d.ts +7 -0
- package/dist/components/ui/QRCode/useCorners.d.ts +9 -0
- package/dist/components/ui/QRCode/useDotsPath.d.ts +18 -0
- package/dist/components/ui/QRCode/useLogo.d.ts +18 -0
- package/dist/components/ui/QRCode/useMatrix.d.ts +7 -0
- package/dist/components/ui/ServerError/index.d.ts +6 -0
- package/dist/components/ui/SuccessMessage/index.d.ts +14 -0
- package/dist/components/ui/SwitchFadeTransition/index.d.ts +15 -0
- package/dist/components/ui/SwitchSlideTransition/index.d.ts +16 -0
- package/dist/components/ui/SwitchTransition/index.d.ts +42 -0
- package/dist/components/ui/ToggleListItem/index.d.ts +31 -0
- package/dist/components/ui/VisuallyHidden/index.d.ts +18 -0
- package/dist/data/countries.d.ts +15 -0
- package/dist/data/countryNames.d.ts +4 -0
- package/dist/hooks/useKeyExportPostMessage.d.ts +25 -0
- package/dist/hooks/usePhoneNumberState.d.ts +47 -0
- package/dist/hooks/usePhoneNumberValidators.d.ts +8 -0
- package/dist/hooks/useTimeout.d.ts +18 -0
- package/dist/hooks/useTimer.d.ts +6 -0
- package/dist/hooks/useTransitionMap.d.ts +22 -0
- package/dist/hooks/useVerifyMfaModal.d.ts +78 -0
- package/dist/icons/IconAppleLogo.d.ts +22 -0
- package/dist/icons/IconArrowLeft.d.ts +22 -0
- package/dist/icons/IconArrowsUpDown.d.ts +22 -0
- package/dist/icons/IconCheck.d.ts +22 -0
- package/dist/icons/IconCheckCircle.d.ts +21 -0
- package/dist/icons/IconChevronDown.d.ts +22 -0
- package/dist/icons/IconCoinbaseMark.d.ts +22 -0
- package/dist/icons/IconCoinbaseWordmark.d.ts +22 -0
- package/dist/icons/IconCopy.d.ts +22 -0
- package/dist/icons/IconCreditCard.d.ts +22 -0
- package/dist/icons/IconCurrencies.d.ts +22 -0
- package/dist/icons/IconEnvelope.d.ts +22 -0
- package/dist/icons/IconExclamationCircle.d.ts +22 -0
- package/dist/icons/IconExclamationTriangle.d.ts +22 -0
- package/dist/icons/IconGoogleColorLogo.d.ts +22 -0
- package/dist/icons/IconGoogleLogo.d.ts +22 -0
- package/dist/icons/IconLock.d.ts +22 -0
- package/dist/icons/IconMinus.d.ts +21 -0
- package/dist/icons/IconPhone.d.ts +22 -0
- package/dist/icons/IconPinCode.d.ts +22 -0
- package/dist/icons/IconPlus.d.ts +21 -0
- package/dist/icons/IconShield.d.ts +22 -0
- package/dist/icons/IconSmartPhone.d.ts +22 -0
- package/dist/icons/IconTelegramLogo.d.ts +22 -0
- package/dist/icons/IconXLogo.d.ts +22 -0
- package/dist/icons/IconXMark.d.ts +22 -0
- package/dist/icons/SvgIcon.d.ts +6 -0
- package/dist/theme/cssVariables.d.ts +10 -0
- package/dist/theme/theme.d.ts +246 -0
- package/dist/theme/tokens.d.ts +54 -0
- package/dist/theme/utils.d.ts +63 -0
- package/dist/types/secureIframe.d.ts +3 -0
- package/dist/utils/capitalize.d.ts +8 -0
- package/dist/utils/childrenHasComponent.d.ts +10 -0
- package/dist/utils/clamp.d.ts +10 -0
- package/dist/utils/formatFiat.d.ts +11 -0
- package/dist/utils/formatPhoneNumber.d.ts +8 -0
- package/dist/utils/getMessageFromUnknownError.d.ts +9 -0
- package/dist/utils/isApiError.d.ts +21 -0
- package/dist/utils/isEmailInvalid.d.ts +15 -0
- package/dist/utils/openPopup.d.ts +15 -0
- package/dist/utils/parseValuesFromPhoneNumber.d.ts +16 -0
- package/dist/utils/sendIframeMessage.d.ts +8 -0
- package/dist/utils/toOAuthProviderType.d.ts +8 -0
- package/dist/utils/transition.d.ts +41 -0
- package/dist/version.d.ts +5 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { SignInModalProps } from '../SignInModal';
|
|
3
3
|
import { SignOutButtonProps } from '../SignOutButton';
|
|
4
|
+
/**
|
|
5
|
+
* Component slots for the AuthButton.
|
|
6
|
+
*/
|
|
4
7
|
export type AuthButtonSlots = {
|
|
8
|
+
/** The placeholder to render while the CDP SDK is initializing. */
|
|
5
9
|
placeholder?: (props: Pick<HTMLAttributes<HTMLDivElement>, "className">) => ReactNode;
|
|
10
|
+
/** The sign out button, rendered when the user is signed in. */
|
|
6
11
|
signOutButton?: (props: Pick<SignOutButtonProps, "onSuccess">) => ReactNode;
|
|
12
|
+
/** The sign in modal, rendered when the user is signed out. */
|
|
7
13
|
signInModal?: (props: Pick<SignInModalProps, "open" | "setIsOpen" | "onSuccess">) => ReactNode;
|
|
8
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* The props for the AuthButton component.
|
|
17
|
+
*/
|
|
9
18
|
export interface AuthButtonProps extends AuthButtonSlots {
|
|
10
19
|
children?: (props: {
|
|
11
20
|
[key in keyof AuthButtonSlots as Capitalize<key>]: ReactNode;
|
|
@@ -13,9 +22,102 @@ export interface AuthButtonProps extends AuthButtonSlots {
|
|
|
13
22
|
isInitialized: boolean;
|
|
14
23
|
isSignedIn: boolean;
|
|
15
24
|
}) => ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* The delay in milliseconds before the sign in modal is closed and the sign out button is shown after the sign in is successful.
|
|
27
|
+
* If null, the sign in modal will not be closed automatically.
|
|
28
|
+
* If 0, the sign in modal will be closed immediately.
|
|
29
|
+
*/
|
|
16
30
|
closeOnSuccessDelay?: null | number;
|
|
31
|
+
/** A function to call when the sign in is successful. */
|
|
17
32
|
onSignInSuccess?: () => void;
|
|
33
|
+
/** A function to call after the sign in success, when the dialog close transition ends. */
|
|
18
34
|
onSignInSuccessTransitionEnd?: () => void;
|
|
35
|
+
/** A function to call when the sign out is successful. */
|
|
19
36
|
onSignOutSuccess?: () => void;
|
|
20
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* A button that signs the user in or out.
|
|
40
|
+
*
|
|
41
|
+
* This component will render the {@link SignInModal} component when the user is signed out, and a {@link SignOutButton} when the user is signed in.
|
|
42
|
+
* If the SDK is initializing (i.e. the initial user state is pending), the component will render a loading skeleton.
|
|
43
|
+
*
|
|
44
|
+
* @param {AuthButtonProps & HTMLAttributes<HTMLDivElement>} props - The props for the component.
|
|
45
|
+
* @param {number} [props.closeOnSuccessDelay] - The delay in milliseconds before the sign in modal is closed and the sign out button is shown after the sign in is successful.
|
|
46
|
+
* @param {() => void} [props.onSignInSuccess] - The function to call when the sign in is successful.
|
|
47
|
+
* @param {() => void} [props.onSignInSuccessTransitionEnd] - The function to call when the sign in success transition ends.
|
|
48
|
+
* @returns {JSX.Element} The rendered component.
|
|
49
|
+
*
|
|
50
|
+
* @group Components
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx lines
|
|
54
|
+
* // Render the AuthButton component
|
|
55
|
+
* function App() {
|
|
56
|
+
* return (
|
|
57
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
58
|
+
* <AuthButton />
|
|
59
|
+
* </CDPReactProvider>
|
|
60
|
+
* );
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```tsx lines
|
|
66
|
+
* // Render the AuthButton component with custom components
|
|
67
|
+
*
|
|
68
|
+
* // Define a custom placeholder
|
|
69
|
+
* const SmallPlaceholder: AuthButtonProps["placeholder"] = props => (
|
|
70
|
+
* <LoadingSkeleton {...props} className={`${props.className} small-placeholder`} />
|
|
71
|
+
* );
|
|
72
|
+
*
|
|
73
|
+
* // Define a custom sign in modal using the secondary variant and small size for the trigger button
|
|
74
|
+
* const SmallSecondarySignInModal: AuthButtonProps["signInModal"] = props => (
|
|
75
|
+
* <SignInModal {...props}>
|
|
76
|
+
* <SignInModalTrigger variant="secondary" size="sm" label="Log me in" />
|
|
77
|
+
* </SignInModal>
|
|
78
|
+
* );
|
|
79
|
+
*
|
|
80
|
+
* // Define a custom sign out button using the secondary variant and small size
|
|
81
|
+
* const SmallSecondarySignOutButton: AuthButtonProps["signOutButton"] = props => (
|
|
82
|
+
* <SignOutButton {...props} variant="secondary" size="sm">Log me out</SignOutButton>
|
|
83
|
+
* );
|
|
84
|
+
*
|
|
85
|
+
* function App() {
|
|
86
|
+
* return (
|
|
87
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
88
|
+
* <AuthButton
|
|
89
|
+
* placeholder={SmallPlaceholder}
|
|
90
|
+
* signInModal={SmallSecondarySignInModal}
|
|
91
|
+
* signOutButton={SmallSecondarySignOutButton}
|
|
92
|
+
* />
|
|
93
|
+
* </CDPReactProvider>
|
|
94
|
+
* );
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```tsx lines
|
|
100
|
+
* // Render the AuthButton component with custom containers around the slot content
|
|
101
|
+
* function App() {
|
|
102
|
+
* return (
|
|
103
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
104
|
+
* <AuthButton className="auth-wrapper">
|
|
105
|
+
* {({ isInitialized, isSignedIn, Placeholder, SignOutButton, SignInModal }) => (
|
|
106
|
+
* <>
|
|
107
|
+
* {!isInitialized && Placeholder}
|
|
108
|
+
* {isInitialized && (
|
|
109
|
+
* <div>
|
|
110
|
+
* <p>Hello {isSignedIn ? "signed in" : "signed out"} user!</p>
|
|
111
|
+
* {isSignedIn && <div>{SignOutButton}</div>}
|
|
112
|
+
* {!isSignedIn && <div>{SignInModal}</div>}
|
|
113
|
+
* </div>
|
|
114
|
+
* )}
|
|
115
|
+
* </>
|
|
116
|
+
* )}
|
|
117
|
+
* </AuthButton>
|
|
118
|
+
* </CDPReactProvider>
|
|
119
|
+
* );
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
21
123
|
export declare const AuthButton: ({ children, closeOnSuccessDelay, onSignInSuccess, onSignInSuccessTransitionEnd, onSignOutSuccess, placeholder, signInModal, signOutButton, ...props }: AuthButtonProps & Omit<HTMLAttributes<HTMLDivElement>, "children">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,23 +1,137 @@
|
|
|
1
1
|
import { Config as CDPHooksConfig, OAuth2ProviderType } from '@coinbase/cdp-hooks';
|
|
2
2
|
import { ThemeProviderProps } from '../ThemeProvider';
|
|
3
3
|
export declare const OAUTH_METHODS: string[];
|
|
4
|
+
/**
|
|
5
|
+
* The auth methods that can be used to sign in.
|
|
6
|
+
*/
|
|
4
7
|
export declare const AUTH_METHODS: readonly ["email", "sms"];
|
|
8
|
+
/**
|
|
9
|
+
* All possible auth methods that can be used to sign in.
|
|
10
|
+
*/
|
|
5
11
|
export declare const ALL_AUTH_METHODS: string[];
|
|
12
|
+
/**
|
|
13
|
+
* The auth method type.
|
|
14
|
+
*/
|
|
6
15
|
export type AuthMethod = (typeof AUTH_METHODS)[number] | `oauth:${OAuth2ProviderType}`;
|
|
16
|
+
/**
|
|
17
|
+
* Optional app config to add branding
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx lines
|
|
21
|
+
* const appConfig: AppConfig = {
|
|
22
|
+
* appName: "My App",
|
|
23
|
+
* appLogoUrl: "https://placehold.co/64",
|
|
24
|
+
* };
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
7
27
|
export interface AppConfig {
|
|
28
|
+
/** The name of the app. */
|
|
8
29
|
appName?: string;
|
|
30
|
+
/** The URL of the app logo. This should be at least 64 by 64px and must start with `http` or `https`. */
|
|
9
31
|
appLogoUrl?: string;
|
|
32
|
+
/** Whether to show the "secured by Coinbase" footer. Defaults to `true`. */
|
|
10
33
|
showCoinbaseFooter?: boolean;
|
|
34
|
+
/** Authentication methods to allow for the user. Defaults to `["email"]`. */
|
|
11
35
|
authMethods?: [AuthMethod, ...AuthMethod[]];
|
|
36
|
+
/** MFA verification configuration. */
|
|
12
37
|
mfa?: {
|
|
38
|
+
/**
|
|
39
|
+
* Disable automatic prompting of the MFA verification modal.
|
|
40
|
+
* Set to `true` when using `useRegisterMfaListener` for custom MFA UI,
|
|
41
|
+
* or when you want to trigger the modal manually via `useVerifyMfaModal`.
|
|
42
|
+
*
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
13
45
|
disableAutoPrompt?: boolean;
|
|
14
46
|
};
|
|
15
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* The CDP hooks provider config combined with the app config.
|
|
50
|
+
*
|
|
51
|
+
* @see {@link AppConfig}
|
|
52
|
+
* @see {@link @coinbase/cdp-hooks!Config | CDPHooksConfig}
|
|
53
|
+
*/
|
|
16
54
|
export type Config = AppConfig & CDPHooksConfig;
|
|
55
|
+
/**
|
|
56
|
+
* @interface CDPReactProviderProps
|
|
57
|
+
* @augments {ThemeProviderProps}
|
|
58
|
+
* @property {ReactNode} children - The children of the component
|
|
59
|
+
* @property {Config} config - The app configuration
|
|
60
|
+
* @property {string} [name] - The provider name, i.e. to distinguish between multiple providers
|
|
61
|
+
* @property {Theme} [theme] - The theme values to override
|
|
62
|
+
*/
|
|
17
63
|
export type CDPReactProviderProps = {
|
|
18
64
|
config: Config;
|
|
19
65
|
name?: string;
|
|
20
66
|
} & ThemeProviderProps;
|
|
67
|
+
/**
|
|
68
|
+
* CDPReactProvider component.
|
|
69
|
+
*
|
|
70
|
+
* @param {CDPReactProviderProps} props - Props for the CDPReactProvider component
|
|
71
|
+
* @param {Config} props.config - The app configuration
|
|
72
|
+
* @param {Theme} [props.theme] - The theme values to override
|
|
73
|
+
* @returns {JSX.Element} The CDPReactProvider component
|
|
74
|
+
*
|
|
75
|
+
* @group Components
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```tsx lines
|
|
79
|
+
* function App() {
|
|
80
|
+
* return (
|
|
81
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
82
|
+
* <YourApp />
|
|
83
|
+
* </CDPReactProvider>
|
|
84
|
+
* );
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
21
88
|
export declare const CDPReactProvider: ({ children, className, config, name: nameFromProps, style, theme, }: CDPReactProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
89
|
+
/**
|
|
90
|
+
* Hook to access the app config from a component.
|
|
91
|
+
*
|
|
92
|
+
* @returns {AppConfig} The app config.
|
|
93
|
+
*
|
|
94
|
+
* @group Hooks
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```tsx lines
|
|
98
|
+
* const MyComponent = () => {
|
|
99
|
+
* // Access the app config from a child component
|
|
100
|
+
* const appConfig = useAppConfig();
|
|
101
|
+
* return <div>{appConfig.appName}</div>;
|
|
102
|
+
* }
|
|
103
|
+
*
|
|
104
|
+
* function App() {
|
|
105
|
+
* return (
|
|
106
|
+
* <CDPReactProvider config={config}>
|
|
107
|
+
* <MyComponent />
|
|
108
|
+
* </CDPReactProvider>
|
|
109
|
+
* );
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
22
113
|
export declare const useAppConfig: () => Required<AppConfig>;
|
|
114
|
+
/**
|
|
115
|
+
* Hook to access the provider name from a component.
|
|
116
|
+
*
|
|
117
|
+
* @returns {string} The provider name.
|
|
118
|
+
*
|
|
119
|
+
* @group Hooks
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```tsx lines
|
|
123
|
+
* const MyComponent = () => {
|
|
124
|
+
* const providerName = useProviderName();
|
|
125
|
+
* return <div>{providerName}</div>;
|
|
126
|
+
* }
|
|
127
|
+
*
|
|
128
|
+
* function App() {
|
|
129
|
+
* return (
|
|
130
|
+
* <CDPReactProvider name="provider-instance" config={config}>
|
|
131
|
+
* <MyComponent />
|
|
132
|
+
* </CDPReactProvider>
|
|
133
|
+
* );
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
23
137
|
export declare const useProviderName: () => string;
|
|
@@ -1,8 +1,37 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The props for the CopyAddress component.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link CopyAddress}
|
|
6
|
+
*/
|
|
2
7
|
export interface CopyAddressProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
8
|
+
/** The address to copy. */
|
|
3
9
|
address: string;
|
|
10
|
+
/** The label for the input. */
|
|
4
11
|
label?: string;
|
|
12
|
+
/** A function to call when the address copy button is clicked. */
|
|
5
13
|
onCopy?: () => void;
|
|
14
|
+
/** A function to call when the address is copied successfully. */
|
|
6
15
|
onCopySuccess?: () => void;
|
|
7
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A component that copies an address to the clipboard.
|
|
19
|
+
*
|
|
20
|
+
* @param {CopyAddressProps} props - The props for the component.
|
|
21
|
+
* @returns {JSX.Element} The CopyAddress component.
|
|
22
|
+
*
|
|
23
|
+
* @group Components
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx lines
|
|
27
|
+
* // Render the CopyAddress component with a custom label
|
|
28
|
+
* function CopyAddressExample() {
|
|
29
|
+
* const { evmAddress } = useEvmAddress();
|
|
30
|
+
* if (!evmAddress) return null;
|
|
31
|
+
* return (
|
|
32
|
+
* <CopyAddress address={evmAddress} label="My EVM address" />
|
|
33
|
+
* );
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
8
37
|
export declare const CopyAddress: ({ className, address, label, onCopy, onCopySuccess, ...props }: CopyAddressProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +1,94 @@
|
|
|
1
1
|
import { ButtonProps } from '../ui/Button';
|
|
2
2
|
import { IframeTheme } from '../../types/secureIframe';
|
|
3
|
+
/**
|
|
4
|
+
* The props for the CopyEvmKeyButton component.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link CopyEvmKeyButton}
|
|
7
|
+
* @see {@link IframeTheme}
|
|
8
|
+
*/
|
|
3
9
|
interface CopyEvmKeyButtonProps extends Pick<ButtonProps, "size" | "fullWidth"> {
|
|
10
|
+
/** The address of the evm account to copy. */
|
|
4
11
|
address: string;
|
|
12
|
+
/** The class name to apply to the button. */
|
|
5
13
|
className?: string;
|
|
14
|
+
/** The label to display when the private key is copied. */
|
|
6
15
|
copiedLabel?: string;
|
|
16
|
+
/** Whether to show an icon in the button. */
|
|
7
17
|
icon?: boolean;
|
|
18
|
+
/** The label to display on the button. */
|
|
8
19
|
label?: string;
|
|
20
|
+
/** A function to call when the iframe UI is ready. */
|
|
9
21
|
onReady?: () => void;
|
|
22
|
+
/** A function to call when the iframe session has expired. */
|
|
10
23
|
onSessionExpired?: () => void;
|
|
24
|
+
/** A function to call when the key is copied successfully. */
|
|
11
25
|
onSuccess?: () => void;
|
|
26
|
+
/** A function to call when there is an error in the secure iframe */
|
|
12
27
|
onError?: (error?: string) => void;
|
|
28
|
+
/** Theme overrides for the iframe. */
|
|
13
29
|
theme?: Partial<IframeTheme>;
|
|
30
|
+
/** The variant of the button. */
|
|
14
31
|
variant?: Extract<ButtonProps["variant"], "primary" | "secondary">;
|
|
15
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* The CopyEvmKeyButton component is used to copy the private key of an EVM account.
|
|
35
|
+
*
|
|
36
|
+
* @param {CopyEvmKeyButtonProps} props - The props for the CopyEvmKeyButton component.
|
|
37
|
+
* @returns {JSX.Element} The CopyEvmKeyButton component.
|
|
38
|
+
*
|
|
39
|
+
* @group Components
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx lines
|
|
43
|
+
* // Render the CopyEvmKeyButton component
|
|
44
|
+
* function CopyEvmKeyButtonExample() {
|
|
45
|
+
* const { currentUser } = useCurrentUser();
|
|
46
|
+
* const evmAddress = currentUser?.evmAccountObjects?.[0]?.address;
|
|
47
|
+
* if (!evmAddress) return null;
|
|
48
|
+
* return (
|
|
49
|
+
* <CopyEvmKeyButton address={evmAddress} />
|
|
50
|
+
* );
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx lines
|
|
56
|
+
* // Render the CopyEvmKeyButton component with custom labels
|
|
57
|
+
* function CopyEvmKeyButtonExample() {
|
|
58
|
+
* const { currentUser } = useCurrentUser();
|
|
59
|
+
* const evmAddress = currentUser?.evmAccountObjects?.[0]?.address;
|
|
60
|
+
* if (!evmAddress) return null;
|
|
61
|
+
* return (
|
|
62
|
+
* <CopyEvmKeyButton address={evmAddress} label="Copy private key" copiedLabel="Private key copied" />
|
|
63
|
+
* );
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx lines
|
|
69
|
+
* // Render the CopyEvmKeyButton component with a different variant
|
|
70
|
+
* function CopyEvmKeyButtonExample() {
|
|
71
|
+
* const { currentUser } = useCurrentUser();
|
|
72
|
+
* const evmAddress = currentUser?.evmAccountObjects?.[0]?.address;
|
|
73
|
+
* if (!evmAddress) return null;
|
|
74
|
+
* return (
|
|
75
|
+
* <CopyEvmKeyButton address={evmAddress} variant="secondary" />
|
|
76
|
+
* );
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```tsx lines
|
|
82
|
+
* // Render the CopyEvmKeyButton component with theme overrides
|
|
83
|
+
* function CopyEvmKeyButtonExample() {
|
|
84
|
+
* const { currentUser } = useCurrentUser();
|
|
85
|
+
* const evmAddress = currentUser?.evmAccountObjects?.[0]?.address;
|
|
86
|
+
* if (!evmAddress) return null;
|
|
87
|
+
* return (
|
|
88
|
+
* <CopyEvmKeyButton address={evmAddress} theme={{ fontUrl: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap", fontFamily: '"Roboto", sans-serif' }} />
|
|
89
|
+
* );
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
16
93
|
declare const CopyEvmKeyButton: ({ address, className, copiedLabel, icon, fullWidth, label, onReady, onSessionExpired, onSuccess, onError, size, theme: themeOverrides, variant, }: CopyEvmKeyButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
94
|
export { CopyEvmKeyButton, type CopyEvmKeyButtonProps };
|
|
@@ -1,17 +1,90 @@
|
|
|
1
1
|
import { ButtonProps } from '../ui/Button';
|
|
2
2
|
import { IframeTheme } from '../../types/secureIframe';
|
|
3
|
+
/**
|
|
4
|
+
* The props for the CopySolanaKeyButton component.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link CopySolanaKeyButton}
|
|
7
|
+
* @see {@link IframeTheme}
|
|
8
|
+
*/
|
|
3
9
|
interface CopySolanaKeyButtonProps extends Pick<ButtonProps, "size" | "fullWidth"> {
|
|
10
|
+
/** The address of the solana account to copy. */
|
|
4
11
|
address: string;
|
|
12
|
+
/** The class name to apply to the button. */
|
|
5
13
|
className?: string;
|
|
14
|
+
/** The label to display when the private key is copied. */
|
|
6
15
|
copiedLabel?: string;
|
|
16
|
+
/** Whether to show an icon in the button. */
|
|
7
17
|
icon?: boolean;
|
|
18
|
+
/** The label to display on the button. */
|
|
8
19
|
label?: string;
|
|
20
|
+
/** A function to call when the iframe UI is ready. */
|
|
9
21
|
onReady?: () => void;
|
|
22
|
+
/** A function to call when the iframe session has expired. */
|
|
10
23
|
onSessionExpired?: () => void;
|
|
24
|
+
/** A function to call when the key is copied successfully. */
|
|
11
25
|
onSuccess?: () => void;
|
|
26
|
+
/** A function to call when there is an error in the secure iframe */
|
|
12
27
|
onError?: (error?: string) => void;
|
|
28
|
+
/** Theme overrides for the iframe. */
|
|
13
29
|
theme?: Partial<IframeTheme>;
|
|
30
|
+
/** The variant of the button. */
|
|
14
31
|
variant?: Extract<ButtonProps["variant"], "primary" | "secondary">;
|
|
15
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* The CopySolanaKeyButton component is used to copy the private key of a Solana account.
|
|
35
|
+
*
|
|
36
|
+
* @param {CopySolanaKeyButtonProps} props - The props for the CopySolanaKeyButton component.
|
|
37
|
+
* @returns {JSX.Element} The CopySolanaKeyButton component.
|
|
38
|
+
*
|
|
39
|
+
* @group Components
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx lines
|
|
43
|
+
* // Render the CopySolanaKeyButton component
|
|
44
|
+
* function CopySolanaKeyButtonExample() {
|
|
45
|
+
* const { solanaAddress } = useSolanaAddress();
|
|
46
|
+
* if (!solanaAddress) return null;
|
|
47
|
+
* return (
|
|
48
|
+
* <CopySolanaKeyButton address={solanaAddress} />
|
|
49
|
+
* );
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx lines
|
|
55
|
+
* // Render the CopySolanaKeyButton component with custom labels
|
|
56
|
+
* function CopySolanaKeyButtonExample() {
|
|
57
|
+
* const { solanaAddress } = useSolanaAddress();
|
|
58
|
+
* if (!solanaAddress) return null;
|
|
59
|
+
* return (
|
|
60
|
+
* <CopySolanaKeyButton address={solanaAddress} label="Copy private key" copiedLabel="Private key copied" />
|
|
61
|
+
* );
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx lines
|
|
67
|
+
* // Render the CopySolanaKeyButton component with a different variant
|
|
68
|
+
* function CopySolanaKeyButtonExample() {
|
|
69
|
+
* const { solanaAddress } = useSolanaAddress();
|
|
70
|
+
* if (!solanaAddress) return null;
|
|
71
|
+
* return (
|
|
72
|
+
* <CopySolanaKeyButton address={solanaAddress} variant="secondary" />
|
|
73
|
+
* );
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```tsx lines
|
|
79
|
+
* // Render the CopySolanaKeyButton component with theme overrides
|
|
80
|
+
* function CopySolanaKeyButtonExample() {
|
|
81
|
+
* const { solanaAddress } = useSolanaAddress();
|
|
82
|
+
* if (!solanaAddress) return null;
|
|
83
|
+
* return (
|
|
84
|
+
* <CopySolanaKeyButton address={solanaAddress} theme={{ fontUrl: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap", fontFamily: '"Roboto", sans-serif' }} />
|
|
85
|
+
* );
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
16
89
|
declare const CopySolanaKeyButton: ({ address, className, copiedLabel, icon, fullWidth, label, onReady, onSessionExpired, onSuccess, onError, size, theme: themeOverrides, variant, }: CopySolanaKeyButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
90
|
export { CopySolanaKeyButton, type CopySolanaKeyButtonProps };
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { ElementType, HTMLAttributes } from 'react';
|
|
2
2
|
import { EnrollMfaMethodComponentProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The props for the EnrollMfaDescription component.
|
|
5
|
+
*/
|
|
3
6
|
export interface EnrollMfaDescriptionProps extends EnrollMfaMethodComponentProps, HTMLAttributes<HTMLElement> {
|
|
7
|
+
/** The element type to render the description as. */
|
|
4
8
|
as?: ElementType;
|
|
5
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* A description for the EnrollMfa component.
|
|
12
|
+
*
|
|
13
|
+
* @param {EnrollMfaDescriptionProps} props - The props for the component.
|
|
14
|
+
* @returns {JSX.Element} The rendered component.
|
|
15
|
+
*
|
|
16
|
+
* @group Components
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <EnrollMfa>
|
|
21
|
+
* <EnrollMfaTitle />
|
|
22
|
+
* <EnrollMfaDescription />
|
|
23
|
+
* <EnrollMfaFlow />
|
|
24
|
+
* </EnrollMfa>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
6
27
|
export declare const EnrollMfaDescription: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: EnrollMfaDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { EnrollMfaStep, MfaMethod } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the EnrollMfaFlow component.
|
|
5
|
+
*/
|
|
3
6
|
export interface EnrollMfaFlowProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
7
|
+
/** If set, will auto focus the form when the component mounts. */
|
|
4
8
|
autoFocus?: boolean;
|
|
9
|
+
/** If set, will animate the height of the component. */
|
|
5
10
|
animateHeight?: boolean;
|
|
11
|
+
/** The children of the component. */
|
|
6
12
|
children?: (props: {
|
|
7
13
|
step: EnrollMfaStep;
|
|
8
14
|
method: MfaMethod;
|
|
9
15
|
Content: ReactNode;
|
|
10
16
|
}) => ReactNode;
|
|
11
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The flow for the EnrollMfa component. Renders the appropriate content
|
|
20
|
+
* based on the current MFA method and step.
|
|
21
|
+
*
|
|
22
|
+
* The "list" step is handled directly by this component.
|
|
23
|
+
* The "setup" and "setup-verification" steps are delegated to method-specific content.
|
|
24
|
+
*
|
|
25
|
+
* @param {EnrollMfaFlowProps} props - The component props.
|
|
26
|
+
* @returns {JSX.Element} The rendered component.
|
|
27
|
+
*
|
|
28
|
+
* @group Components
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <EnrollMfa>
|
|
33
|
+
* <EnrollMfaTitle />
|
|
34
|
+
* <EnrollMfaDescription />
|
|
35
|
+
* <EnrollMfaFlow />
|
|
36
|
+
* </EnrollMfa>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
12
39
|
export declare const EnrollMfaFlow: ({ autoFocus, animateHeight, children, className, ...props }: EnrollMfaFlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import { ButtonProps } from '../ui/Button/Button';
|
|
3
3
|
import { EnrollMfaStep } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the EnrollMfaFlowBackButton component.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link EnrollMfaFlowBackButton}
|
|
8
|
+
*/
|
|
4
9
|
export interface EnrollMfaFlowBackButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
|
+
/** If set, will render the back button for this step of the flow, regardless of the context value. */
|
|
5
11
|
step?: EnrollMfaStep;
|
|
12
|
+
/** The size of the button. */
|
|
6
13
|
size?: ButtonProps["size"];
|
|
14
|
+
/** The variant of the button. */
|
|
7
15
|
variant?: ButtonProps["variant"];
|
|
8
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A button to go back to the previous step of the MFA enrollment flow.
|
|
19
|
+
*
|
|
20
|
+
* @param {EnrollMfaFlowBackButtonProps} props - The props for the component.
|
|
21
|
+
* @returns {JSX.Element | null} The EnrollMfaFlowBackButton component.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link EnrollMfaFlow}
|
|
24
|
+
* @see {@link EnrollMfa}
|
|
25
|
+
*
|
|
26
|
+
* @group Components
|
|
27
|
+
*/
|
|
9
28
|
export declare const EnrollMfaFlowBackButton: ({ ["aria-label"]: ariaLabel, children, className, size, onClick, variant, step: stepFromProps, ...props }: EnrollMfaFlowBackButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,21 +1,73 @@
|
|
|
1
1
|
import { FormEvent, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { SwitchSlideTransitionRef } from '../ui/SwitchSlideTransition';
|
|
3
3
|
import { EnrollMfaStep, MfaMethod } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* The value of the MFA enrollment flow context.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link useEnrollMfaFlow}
|
|
8
|
+
*/
|
|
4
9
|
export interface EnrollMfaFlowContextValue {
|
|
10
|
+
/** A function to go back to the previous step. */
|
|
5
11
|
back: () => void;
|
|
12
|
+
/** A function to start enrollment for a method. */
|
|
6
13
|
startEnrollment: (method: MfaMethod) => Promise<void>;
|
|
14
|
+
/** A function to submit the MFA code. */
|
|
7
15
|
submit: (e: FormEvent<HTMLFormElement>) => void;
|
|
8
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The value of the MFA enrollment flow context for internal use.
|
|
19
|
+
*
|
|
20
|
+
* @see {@link useEnrollMfaFlowInternal}
|
|
21
|
+
*/
|
|
9
22
|
export interface EnrollMfaFlowContextValueInternal extends EnrollMfaFlowContextValue {
|
|
23
|
+
/** A ref to the flow transition. */
|
|
10
24
|
transitionRef: RefObject<SwitchSlideTransitionRef<EnrollMfaStep> | null> | null;
|
|
11
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Props for the EnrollMfaFlowProvider component.
|
|
28
|
+
*
|
|
29
|
+
* @see {@link EnrollMfaFlowProvider}
|
|
30
|
+
*/
|
|
12
31
|
export interface EnrollMfaFlowProviderProps {
|
|
32
|
+
/** The children of the component. */
|
|
13
33
|
children?: ReactNode;
|
|
34
|
+
/** A function to go back to the previous step. */
|
|
14
35
|
onBack: EnrollMfaFlowContextValue["back"];
|
|
36
|
+
/** A function to start enrollment for a method. */
|
|
15
37
|
onStartEnrollment: EnrollMfaFlowContextValue["startEnrollment"];
|
|
38
|
+
/** A function to submit the MFA code. */
|
|
16
39
|
onSubmit: EnrollMfaFlowContextValue["submit"];
|
|
40
|
+
/** A ref to the flow transition. */
|
|
17
41
|
transitionRef: EnrollMfaFlowContextValueInternal["transitionRef"];
|
|
18
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* A hook to get the MFA enrollment flow context value (internal).
|
|
45
|
+
*
|
|
46
|
+
* @returns {EnrollMfaFlowContextValueInternal} The MFA enrollment flow context value.
|
|
47
|
+
*
|
|
48
|
+
* @group Hooks
|
|
49
|
+
*/
|
|
19
50
|
export declare const useEnrollMfaFlowInternal: () => EnrollMfaFlowContextValueInternal;
|
|
51
|
+
/**
|
|
52
|
+
* A hook to get the MFA enrollment flow context value.
|
|
53
|
+
*
|
|
54
|
+
* @returns {EnrollMfaFlowContextValue} The MFA enrollment flow context value.
|
|
55
|
+
*
|
|
56
|
+
* @see {@link EnrollMfaFlow}
|
|
57
|
+
* @see {@link EnrollMfa}
|
|
58
|
+
*
|
|
59
|
+
* @group Hooks
|
|
60
|
+
*/
|
|
20
61
|
export declare const useEnrollMfaFlow: () => EnrollMfaFlowContextValue;
|
|
62
|
+
/**
|
|
63
|
+
* A provider for the MFA enrollment flow.
|
|
64
|
+
*
|
|
65
|
+
* @param {EnrollMfaFlowProviderProps} props - The props for the EnrollMfaFlowProvider component.
|
|
66
|
+
* @returns {JSX.Element} The EnrollMfaFlowProvider component.
|
|
67
|
+
*
|
|
68
|
+
* @see {@link EnrollMfaFlow}
|
|
69
|
+
* @see {@link EnrollMfa}
|
|
70
|
+
*
|
|
71
|
+
* @group Components
|
|
72
|
+
*/
|
|
21
73
|
export declare const EnrollMfaFlowProvider: ({ children, onBack, onStartEnrollment, onSubmit, transitionRef, }: EnrollMfaFlowProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A footer component for the MFA enrollment flow.
|
|
4
|
+
*
|
|
5
|
+
* @param {HTMLAttributes<HTMLDivElement>} props - The props for the component.
|
|
6
|
+
* @returns {JSX.Element} The rendered footer.
|
|
7
|
+
*
|
|
8
|
+
* @group Components
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <EnrollMfa>
|
|
13
|
+
* <EnrollMfaTitle />
|
|
14
|
+
* <EnrollMfaDescription />
|
|
15
|
+
* <EnrollMfaForm />
|
|
16
|
+
* <EnrollMfaFooter />
|
|
17
|
+
* </EnrollMfa>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
2
20
|
export declare const EnrollMfaFooter: (props: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|