@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,5 +1,17 @@
|
|
|
1
1
|
import { APIError, SendSolanaTransactionOptions } from '@coinbase/cdp-hooks';
|
|
2
2
|
import { ButtonProps } from '../ui/Button';
|
|
3
|
+
/**
|
|
4
|
+
* The props for the SendSolanaTransactionButton component.
|
|
5
|
+
*
|
|
6
|
+
* @augments {Omit<ButtonProps, "onError">}
|
|
7
|
+
* @property {SendSolanaTransactionOptions["solanaAccount"]} account - The Solana account to send the transaction from.
|
|
8
|
+
* @property {SendSolanaTransactionOptions["network"]} network - The network to send the transaction on.
|
|
9
|
+
* @property {(error: APIError | Error) => void} [onError] - A function to call when the transaction errors.
|
|
10
|
+
* @property {(signature: string) => void} [onSuccess] - A function to call when the transaction is successful.
|
|
11
|
+
* @property {SendSolanaTransactionOptions["transaction"]} transaction - The base64 encoded transaction to send.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link SendSolanaTransactionButton}
|
|
14
|
+
*/
|
|
3
15
|
export interface SendSolanaTransactionButtonProps extends Omit<ButtonProps, "onError"> {
|
|
4
16
|
account: SendSolanaTransactionOptions["solanaAccount"];
|
|
5
17
|
network: SendSolanaTransactionOptions["network"];
|
|
@@ -7,4 +19,19 @@ export interface SendSolanaTransactionButtonProps extends Omit<ButtonProps, "onE
|
|
|
7
19
|
onSuccess?: (signature: string) => void;
|
|
8
20
|
transaction: SendSolanaTransactionOptions["transaction"];
|
|
9
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* A button that signs and sends a Solana transaction.
|
|
24
|
+
*
|
|
25
|
+
* @param {SendSolanaTransactionButtonProps} props - The props for the SendSolanaTransactionButton component.
|
|
26
|
+
* @param {SendSolanaTransactionOptions["solanaAccount"]} props.account - The Solana account to send the transaction from.
|
|
27
|
+
* @param {SendSolanaTransactionOptions["network"]} props.network - The network to send the transaction on.
|
|
28
|
+
* @param {(error: APIError | Error) => void} [props.onError] - A function to call when the transaction errors.
|
|
29
|
+
* @param {(signature: string) => void} [props.onSuccess] - A function to call when the transaction is successful.
|
|
30
|
+
* @param {ReactNode} [props.pendingLabel] - The label to display when the transaction is pending.
|
|
31
|
+
* @param {SendSolanaTransactionOptions["transaction"]} props.transaction - The base64 encoded transaction to send.
|
|
32
|
+
* @param {ButtonVariant} [props.variant] - The variant of the button.
|
|
33
|
+
* @returns {JSX.Element} The rendered component.
|
|
34
|
+
*
|
|
35
|
+
* @group Components
|
|
36
|
+
*/
|
|
10
37
|
export declare const SendSolanaTransactionButton: ({ account, children, className, network, onClick, onError, onSuccess, pendingLabel, transaction, ...props }: SendSolanaTransactionButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { AuthMethod } from '../CDPReactProvider';
|
|
3
|
+
/**
|
|
4
|
+
* The props for an AuthMethodButton.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link SignInAuthMethodButtonProps}
|
|
7
|
+
*/
|
|
3
8
|
export interface SignInAuthMethodButtonProps {
|
|
9
|
+
/** The key of the auth method. */
|
|
4
10
|
key: AuthMethod;
|
|
11
|
+
/** The label of the auth method. */
|
|
5
12
|
label: string;
|
|
13
|
+
/** The aria label of the auth method. */
|
|
6
14
|
ariaLabel?: string;
|
|
15
|
+
/** The icon of the auth method. */
|
|
7
16
|
icon: ReactNode;
|
|
17
|
+
/** Whether the auth method is pending. */
|
|
8
18
|
isPending?: boolean;
|
|
19
|
+
/** The function to call when the auth method is clicked. */
|
|
9
20
|
onClick: () => void;
|
|
10
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* The props for the AuthMethodButtons component.
|
|
24
|
+
*
|
|
25
|
+
* @see {@link SignInAuthMethodButtons}
|
|
26
|
+
*/
|
|
11
27
|
export interface SignInAuthMethodButtonsProps {
|
|
28
|
+
/** The active auth method. */
|
|
12
29
|
activeMethod?: AuthMethod;
|
|
13
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* The AuthMethodButtons component.
|
|
33
|
+
*
|
|
34
|
+
* @param {AuthMethodButtonProps} props - The props for the AuthMethodButtons component.
|
|
35
|
+
* @param {AuthMethod} [props.activeMethod] - The active auth method.
|
|
36
|
+
* @returns {JSX.Element} The AuthMethodButtons component.
|
|
37
|
+
*
|
|
38
|
+
* @group Components
|
|
39
|
+
*/
|
|
14
40
|
export declare const SignInAuthMethodButtons: ({ activeMethod }: SignInAuthMethodButtonsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,9 +1,49 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
import { ButtonSize, ButtonVariant } from '../../theme/theme';
|
|
3
3
|
import { SignInState } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* A button to go back to the previous step of the sign-in flow.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link SignInBackButton}
|
|
8
|
+
*/
|
|
4
9
|
export interface SignInBackButtonProps extends HTMLAttributes<HTMLButtonElement> {
|
|
10
|
+
/** If set, will render the back button for this step of the sign in flow, regardless of the context value. */
|
|
5
11
|
step?: SignInState["step"];
|
|
12
|
+
/** The size of the button. */
|
|
6
13
|
size?: ButtonSize;
|
|
14
|
+
/** The variant of the button. */
|
|
7
15
|
variant?: ButtonVariant;
|
|
8
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A button to go back to the previous step of the sign-in flow.
|
|
19
|
+
*
|
|
20
|
+
* @param {SignInBackButtonProps} props - The props for the component.
|
|
21
|
+
* @param {SignInState["step"]} [props.step] - If set, will render the back button for this step of the sign in flow, regardless of the context value.
|
|
22
|
+
* @param {ButtonSize} [props.size] - The size of the button.
|
|
23
|
+
* @param {ButtonVariant} [props.variant] - The variant of the button.
|
|
24
|
+
* @returns {JSX.Element} The sign-in back button.
|
|
25
|
+
*
|
|
26
|
+
* @group Components
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx lines
|
|
30
|
+
* function App() {
|
|
31
|
+
* // Customize the back button icon and label
|
|
32
|
+
* return (
|
|
33
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
34
|
+
* <SignIn>
|
|
35
|
+
* <SignInBackButton aria-label="go back">
|
|
36
|
+
* <MyCustomIcon />
|
|
37
|
+
* </SignInBackButton>
|
|
38
|
+
* <SignInImage />
|
|
39
|
+
* <SignInTitle />
|
|
40
|
+
* <SignInDescription />
|
|
41
|
+
* <SignInForm />
|
|
42
|
+
* <SignInFooter />
|
|
43
|
+
* </SignIn>
|
|
44
|
+
* </CDPReactProvider>
|
|
45
|
+
* );
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
9
49
|
export declare const SignInBackButton: ({ step: stepFromProps, children, onClick, size, variant, ["aria-label"]: ariaLabel, ...props }: SignInBackButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A component that renders styled credentials for the sign in flow.
|
|
4
|
+
*
|
|
5
|
+
* @param {HTMLAttributes<HTMLSpanElement>} props - The props for the component.
|
|
6
|
+
* @param {ReactNode} props.children - The children of the component.
|
|
7
|
+
* @returns {JSX.Element} The rendered component.
|
|
8
|
+
*
|
|
9
|
+
* @group Components
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx lines
|
|
13
|
+
* Email: <SignInCredentials>name@example.com</SignInCredentials>
|
|
14
|
+
*/
|
|
2
15
|
export declare const SignInCredentials: ({ children, ...props }: HTMLAttributes<HTMLSpanElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
import { ElementType, HTMLAttributes } from 'react';
|
|
2
2
|
import { SignInTitleAndDescriptionProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The props for the SignInDescription component.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link SignInDescription}
|
|
7
|
+
*/
|
|
3
8
|
export interface SignInDescriptionProps extends SignInTitleAndDescriptionProps, HTMLAttributes<HTMLElement> {
|
|
9
|
+
/** The element type to render the description as. */
|
|
4
10
|
as?: ElementType;
|
|
5
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* A description for the SignIn component.
|
|
14
|
+
*
|
|
15
|
+
* @param {SignInDescriptionProps} props - The props for the component.
|
|
16
|
+
* @returns {JSX.Element} The rendered component.
|
|
17
|
+
*
|
|
18
|
+
* @group Components
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx lines
|
|
22
|
+
* function App() {
|
|
23
|
+
* // Render a custom description in the SignIn component
|
|
24
|
+
* return (
|
|
25
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
26
|
+
* <SignIn>
|
|
27
|
+
* <SignInBackButton />
|
|
28
|
+
* <SignInImage />
|
|
29
|
+
* <SignInTitle />
|
|
30
|
+
* <SignInDescription>
|
|
31
|
+
* Custom Sign In Description
|
|
32
|
+
* </SignInDescription>
|
|
33
|
+
* <SignInForm />
|
|
34
|
+
* <SignInFooter />
|
|
35
|
+
* </SignIn>
|
|
36
|
+
* </CDPReactProvider>
|
|
37
|
+
* );
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
6
41
|
export declare const SignInDescription: ({ as: Component, authMethod: authMethodFromProps, children, className, step: stepFromProps, ...props }: SignInDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,29 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A footer component for the sign-in flow.
|
|
4
|
+
*
|
|
5
|
+
* @param {HTMLAttributes<HTMLDivElement>} props - The props for the component.
|
|
6
|
+
* @returns {JSX.Element} The sign-in footer.
|
|
7
|
+
*
|
|
8
|
+
* @group Components
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx lines
|
|
12
|
+
* function App() {
|
|
13
|
+
* // Add class to the footer
|
|
14
|
+
* return (
|
|
15
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
16
|
+
* <SignIn>
|
|
17
|
+
* <SignInBackButton />
|
|
18
|
+
* <SignInImage />
|
|
19
|
+
* <SignInTitle />
|
|
20
|
+
* <SignInDescription />
|
|
21
|
+
* <SignInForm />
|
|
22
|
+
* <SignInFooter className="sign-in-footer" />
|
|
23
|
+
* </SignIn>
|
|
24
|
+
* </CDPReactProvider>
|
|
25
|
+
* );
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
2
29
|
export declare const SignInFooter: (props: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,54 @@
|
|
|
1
1
|
import { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { AuthMethod } from '../CDPReactProvider';
|
|
3
3
|
import { SignInState } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the SignInForm component.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link SignInForm}
|
|
8
|
+
*/
|
|
4
9
|
export interface SignInFormProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
10
|
+
/** The element type to render the form as. */
|
|
5
11
|
as?: ElementType;
|
|
12
|
+
/** If set, will auto focus the form when the component mounts and after transitions. */
|
|
6
13
|
autoFocus?: boolean;
|
|
14
|
+
/** The function to call when the sign in is successful. */
|
|
7
15
|
onSuccess?: () => void;
|
|
16
|
+
/** If set, will render the form for this step of the sign in flow, regardless of the context value. */
|
|
8
17
|
step?: SignInState["step"];
|
|
18
|
+
/** The children of the component. */
|
|
9
19
|
children?: (props: {
|
|
10
20
|
step: SignInState["step"];
|
|
11
21
|
authMethod: AuthMethod;
|
|
12
22
|
Form: ReactNode;
|
|
13
23
|
}) => ReactNode;
|
|
14
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The form for the SignIn component.
|
|
27
|
+
*
|
|
28
|
+
* @param {SignInFormProps} props - The component props.
|
|
29
|
+
* @returns {JSX.Element} The rendered component.
|
|
30
|
+
*
|
|
31
|
+
* @group Components
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx lines
|
|
35
|
+
* function App() {
|
|
36
|
+
* // Add div wrapper and class to the form
|
|
37
|
+
* return (
|
|
38
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
39
|
+
* <SignIn>
|
|
40
|
+
* <SignInBackButton />
|
|
41
|
+
* <SignInImage />
|
|
42
|
+
* <SignInTitle />
|
|
43
|
+
* <SignInDescription />
|
|
44
|
+
* <div className="sign-in-form-wrapper">
|
|
45
|
+
* <SignInForm className="sign-in-form" />
|
|
46
|
+
* </div>
|
|
47
|
+
* <SignInFooter />
|
|
48
|
+
* </SignIn>
|
|
49
|
+
* </CDPReactProvider>
|
|
50
|
+
* );
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
15
54
|
export declare const SignInForm: ({ autoFocus, onSuccess, step: stepFromProps, children, ...props }: SignInFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for the SignInImage component.
|
|
3
|
+
*
|
|
4
|
+
* @see {@link SignInImage}
|
|
5
|
+
*/
|
|
1
6
|
export interface SignInImageProps {
|
|
7
|
+
/** The class name to apply to the component. */
|
|
2
8
|
className?: string;
|
|
9
|
+
/** The alt text for the image. */
|
|
3
10
|
alt?: string;
|
|
11
|
+
/** The source URL for the image. Uses the app logo by default. */
|
|
4
12
|
src?: string;
|
|
5
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* A logo or success icon for the SignIn component.
|
|
16
|
+
*
|
|
17
|
+
* @param {SignInImageProps} props - The props for the component.
|
|
18
|
+
* @param {string} [props.className] - The class name to apply to the component.
|
|
19
|
+
* @param {string} [props.alt] - The alt text for the image.
|
|
20
|
+
* @param {string} [props.src] - The source URL for the image. Uses the app logo by default.
|
|
21
|
+
* @returns {JSX.Element} The rendered component.
|
|
22
|
+
*
|
|
23
|
+
* @group Components
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx lines
|
|
27
|
+
* function App() {
|
|
28
|
+
* // Use a different image from your app logo in the SignIn component
|
|
29
|
+
* return (
|
|
30
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
31
|
+
* <SignIn>
|
|
32
|
+
* <SignInBackButton />
|
|
33
|
+
* <SignInImage src="https://example.com/image.png" alt="Example Image" />
|
|
34
|
+
* <SignInTitle />
|
|
35
|
+
* <SignInDescription />
|
|
36
|
+
* <SignInForm />
|
|
37
|
+
* <SignInFooter />
|
|
38
|
+
* </SignIn>
|
|
39
|
+
* </CDPReactProvider>
|
|
40
|
+
* );
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
6
44
|
export declare const SignInImage: ({ className, alt, src }: SignInImageProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,13 +1,67 @@
|
|
|
1
1
|
import { Dispatch, ReactNode } from 'react';
|
|
2
2
|
import { SignInAction, SignInState } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Context for the SignIn component.
|
|
5
|
+
*/
|
|
3
6
|
export declare const SignInContext: import('react').Context<{
|
|
4
7
|
state: SignInState;
|
|
5
8
|
dispatch: Dispatch<SignInAction>;
|
|
6
9
|
}>;
|
|
10
|
+
/**
|
|
11
|
+
* A context for the SignIn component.
|
|
12
|
+
*
|
|
13
|
+
* @returns {SignInState} The current state of the SignIn component.
|
|
14
|
+
*
|
|
15
|
+
* @group Hooks
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx lines
|
|
19
|
+
* function EmailComponent() {
|
|
20
|
+
* const { state } = useSignInContext();
|
|
21
|
+
* return <div>Submitted email: {state.email}</div>;
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* function App() {
|
|
25
|
+
* return (
|
|
26
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
27
|
+
* <SignIn>
|
|
28
|
+
* <SignInTitle />
|
|
29
|
+
* <SignInDescription />
|
|
30
|
+
* <EmailComponent />
|
|
31
|
+
* <SignInForm />
|
|
32
|
+
* </SignIn>
|
|
33
|
+
* </CDPReactProvider>
|
|
34
|
+
* );
|
|
35
|
+
*/
|
|
7
36
|
export declare const useSignInContext: () => {
|
|
8
37
|
state: SignInState;
|
|
9
38
|
dispatch: Dispatch<SignInAction>;
|
|
10
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* A provider for the SignInContext.
|
|
42
|
+
*
|
|
43
|
+
* @param {SignInProviderProps} props - The props for the SignInProvider component.
|
|
44
|
+
* @param {ReactNode} props.children - The children to render inside the provider.
|
|
45
|
+
* @returns {JSX.Element} The rendered component.
|
|
46
|
+
*
|
|
47
|
+
* @group Components
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx lines
|
|
51
|
+
* function App() {
|
|
52
|
+
* return (
|
|
53
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
54
|
+
* <SignInProvider>
|
|
55
|
+
* <SignInImage />
|
|
56
|
+
* <SignInTitle />
|
|
57
|
+
* <SignInDescription />
|
|
58
|
+
* <SignInForm />
|
|
59
|
+
* </SignInProvider>
|
|
60
|
+
* </CDPReactProvider>
|
|
61
|
+
* );
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
11
65
|
export declare const SignInProvider: ({ children, authMethods: authMethodsFromProps, }: {
|
|
12
66
|
children: ReactNode;
|
|
13
67
|
authMethods?: SignInState["authMethods"];
|
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
import { ElementType, HTMLAttributes } from 'react';
|
|
2
2
|
import { SignInTitleAndDescriptionProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The props for the SignInTitle component.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link SignInTitle}
|
|
7
|
+
*/
|
|
3
8
|
export interface SignInTitleProps extends SignInTitleAndDescriptionProps, HTMLAttributes<HTMLElement> {
|
|
9
|
+
/** The element type to render the title as. */
|
|
4
10
|
as?: ElementType;
|
|
5
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* A title for the SignIn component.
|
|
14
|
+
*
|
|
15
|
+
* @param {SignInTitleAndDescriptionProps} props - The props for the component.
|
|
16
|
+
* @returns {JSX.Element} The rendered component.
|
|
17
|
+
*
|
|
18
|
+
* @group Components
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx lines
|
|
22
|
+
* function App() {
|
|
23
|
+
* // Render a custom title in the SignIn component
|
|
24
|
+
* return (
|
|
25
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
26
|
+
* <SignIn>
|
|
27
|
+
* <SignInBackButton />
|
|
28
|
+
* <SignInImage />
|
|
29
|
+
* <SignInTitle>
|
|
30
|
+
* Custom Sign In Title
|
|
31
|
+
* </SignInTitle>
|
|
32
|
+
* <SignInDescription />
|
|
33
|
+
* <SignInForm />
|
|
34
|
+
* <SignInFooter />
|
|
35
|
+
* </SignIn>
|
|
36
|
+
* </CDPReactProvider>
|
|
37
|
+
* );
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
6
41
|
export declare const SignInTitle: ({ as: Component, children, className, authMethod: authMethodFromProps, step: stepFromProps, ...props }: SignInTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { SignInFlowProps, SignInTitleAndDescriptionProps, SignInFlowConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The step of the email OTP flow.
|
|
4
|
+
*/
|
|
2
5
|
export type Step = "email" | "otp";
|
|
6
|
+
/**
|
|
7
|
+
* A component that renders the sign in with email flow.
|
|
8
|
+
*
|
|
9
|
+
* @param {SignInFlowProps} props - The props for the sign in with email flow.
|
|
10
|
+
* @param {SignInFlowProps["children"]} [props.children] - A function to render the children. If provided, the function will be called with the current step of the flow and the form component.
|
|
11
|
+
* @param {SignInFlowProps["onSuccess"]} props.onSuccess - The callback to call when the sign in is successful.
|
|
12
|
+
* @param {SignInFlowProps["step"]} props.step - The step to render the flow for.
|
|
13
|
+
* @returns {JSX.Element} The SignInWithEmail component.
|
|
14
|
+
*/
|
|
3
15
|
export declare const SignInWithEmail: ({ step: stepFromProps, autoFocus, onSuccess, children, }: SignInFlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* A component that renders the title for the sign in with email flow.
|
|
18
|
+
*
|
|
19
|
+
* @param {SignInTitleAndDescriptionProps} props - The props for the component.
|
|
20
|
+
* @param {Step} props.step - The step to render the component for.
|
|
21
|
+
* @returns {JSX.Element} The rendered component.
|
|
22
|
+
*/
|
|
4
23
|
export declare const SignInWithEmailTitle: ({ step }: SignInTitleAndDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* A component that renders the description for the sign in with email flow.
|
|
26
|
+
*
|
|
27
|
+
* @param {SignInTitleAndDescriptionProps} props - The props for the component.
|
|
28
|
+
* @param {Step} props.step - The step to render the component for.
|
|
29
|
+
* @returns {JSX.Element} The rendered component.
|
|
30
|
+
*/
|
|
5
31
|
export declare const SignInWithEmailDescription: ({ step }: SignInTitleAndDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
32
|
export declare const config: SignInFlowConfig;
|
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { SignInFlowProps, SignInFlowConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* A component that renders the sign in with email flow.
|
|
4
|
+
*
|
|
5
|
+
* @param {SignInFlowProps} props - The props for the sign in with email flow.
|
|
6
|
+
* @param {SignInFlowProps["children"]} [props.children] - A function to render the children. If provided, the function will be called with the current step of the flow and the form component.
|
|
7
|
+
* @param {SignInFlowProps["onSuccess"]} props.onSuccess - The callback to call when the sign in is successful.
|
|
8
|
+
* @param {SignInFlowProps["step"]} props.step - The step to render the flow for.
|
|
9
|
+
* @returns {JSX.Element} The SignInWithEmail component.
|
|
10
|
+
*/
|
|
2
11
|
export declare const SignInWithOAuth: ({ step, children }: SignInFlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* A component that renders the title for the sign in with email flow.
|
|
14
|
+
*
|
|
15
|
+
* @returns {JSX.Element} The rendered component.
|
|
16
|
+
*/
|
|
3
17
|
export declare const SignInWithOAuthTitle: () => string;
|
|
18
|
+
/**
|
|
19
|
+
* A component that renders the description for the sign in with email flow.
|
|
20
|
+
*
|
|
21
|
+
* @returns {JSX.Element} The rendered component.
|
|
22
|
+
*/
|
|
4
23
|
export declare const SignInWithOAuthDescription: () => string;
|
|
5
24
|
export declare const config: SignInFlowConfig;
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
import { SignInFlowProps, SignInTitleAndDescriptionProps, SignInFlowConfig } from '../types';
|
|
2
2
|
declare const STEPS: readonly ["phoneNumber", "otp"];
|
|
3
|
+
/**
|
|
4
|
+
* The step of the phone number OTP flow.
|
|
5
|
+
*/
|
|
3
6
|
export type Step = (typeof STEPS)[number];
|
|
7
|
+
/**
|
|
8
|
+
* A component that renders the sign in with email flow.
|
|
9
|
+
*
|
|
10
|
+
* @param {SignInFlowProps} props - The props for the sign in with email flow.
|
|
11
|
+
* @param {SignInFlowProps["children"]} [props.children] - A function to render the children. If provided, the function will be called with the current step of the flow and the form component.
|
|
12
|
+
* @param {SignInFlowProps["onSuccess"]} props.onSuccess - The callback to call when the sign in is successful.
|
|
13
|
+
* @param {SignInFlowProps["step"]} props.step - The step to render the flow for.
|
|
14
|
+
* @returns {JSX.Element} The FlowEmailOTP component.
|
|
15
|
+
*/
|
|
4
16
|
export declare const SignInWithSms: ({ step: stepFromProps, autoFocus, onSuccess, children, }: SignInFlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* A component that renders the title for the sign in with email flow.
|
|
19
|
+
*
|
|
20
|
+
* @param {SignInTitleAndDescriptionProps} props - The props for the component.
|
|
21
|
+
* @param {Step} props.step - The step to render the component for.
|
|
22
|
+
* @returns {JSX.Element} The rendered component.
|
|
23
|
+
*/
|
|
5
24
|
export declare const SignInWithSmsTitle: ({ step }: SignInTitleAndDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* A component that renders the description for the sign in with email flow.
|
|
27
|
+
*
|
|
28
|
+
* @param {SignInTitleAndDescriptionProps} props - The props for the component.
|
|
29
|
+
* @param {Step} props.step - The step to render the component for.
|
|
30
|
+
* @returns {JSX.Element} The rendered component.
|
|
31
|
+
*/
|
|
6
32
|
export declare const SignInWithSmsDescription: ({ step }: SignInTitleAndDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
33
|
export declare const config: SignInFlowConfig;
|
|
8
34
|
export {};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { APIError } from '@coinbase/cdp-hooks';
|
|
2
|
+
/**
|
|
3
|
+
* A hook for the email form.
|
|
4
|
+
*
|
|
5
|
+
* @param {object} params - The params for the hook.
|
|
6
|
+
* @param {(email: string) => Promise<{ flowId: string }>} params.submit - The function to submit the email.
|
|
7
|
+
* @returns {object} A function to set the email and a function to submit the email.
|
|
8
|
+
*/
|
|
2
9
|
export declare const useEmailForm: ({ submit, }: {
|
|
3
10
|
submit: (email: string) => Promise<{
|
|
4
11
|
flowId: string;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { APIError } from '@coinbase/cdp-hooks';
|
|
2
|
+
/**
|
|
3
|
+
* A hook for the OTP form.
|
|
4
|
+
*
|
|
5
|
+
* @param {object} params - The params for the hook.
|
|
6
|
+
* @param {number} params.passwordLength - The length of the password.
|
|
7
|
+
* @param {(otp: string) => Promise<T>} params.submit - The function to submit the OTP.
|
|
8
|
+
* @returns {object} A function to set the OTP and a function to submit the OTP.
|
|
9
|
+
*/
|
|
2
10
|
export declare const useOTPForm: <T>({ passwordLength, submit, }: {
|
|
3
11
|
passwordLength: number;
|
|
4
12
|
submit: (otp: string) => Promise<T>;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { APIError } from '@coinbase/cdp-hooks';
|
|
2
|
+
/**
|
|
3
|
+
* A hook for the email form.
|
|
4
|
+
*
|
|
5
|
+
* @param {object} params - The params for the hook.
|
|
6
|
+
* @param {(email: string) => Promise<{ flowId: string }>} params.submit - The function to submit the email.
|
|
7
|
+
* @returns {object} A function to set the email and a function to submit the email.
|
|
8
|
+
*/
|
|
2
9
|
export declare const usePhoneNumberForm: ({ submit, }: {
|
|
3
10
|
submit: (phoneNumber: string) => Promise<{
|
|
4
11
|
flowId: string;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { OAuth2ProviderType, APIError } from '@coinbase/cdp-hooks';
|
|
2
2
|
import { RefObject } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* The return type of the useSignInWithOAuth hook.
|
|
5
|
+
*/
|
|
3
6
|
export type UseSignInWithOAuthReturnType = {
|
|
4
7
|
error: string | APIError | null;
|
|
5
8
|
isPending: boolean;
|
|
6
9
|
oauthProvider: RefObject<OAuth2ProviderType | null>;
|
|
7
10
|
signInWithOAuth: (providerType: OAuth2ProviderType) => Promise<void>;
|
|
8
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* A hook for the sign in with OAuth flow.
|
|
14
|
+
*
|
|
15
|
+
* @returns {UseSignInWithOAuthReturnType} A function to sign in with OAuth, the pending state, and the error state.
|
|
16
|
+
*/
|
|
9
17
|
export declare const useSignInWithOAuth: () => UseSignInWithOAuthReturnType;
|