@coinbase/cdp-react 0.0.98 → 0.0.100
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/LinkAuthItems.js +30 -30
- 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,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;
|
|
@@ -9,10 +9,134 @@ import { SignInImage, SignInImageProps } from './SignInImage';
|
|
|
9
9
|
import { useSignInContext } from './SignInProvider';
|
|
10
10
|
import { SignInTitle, SignInTitleProps } from './SignInTitle';
|
|
11
11
|
import { SignInState, SignInAction } from './types';
|
|
12
|
+
/**
|
|
13
|
+
* Props for the SignIn component
|
|
14
|
+
*/
|
|
12
15
|
export interface SignInProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
16
|
+
/**
|
|
17
|
+
* The children of the component. Leave empty to use the default sign-in flow UI.
|
|
18
|
+
*
|
|
19
|
+
* If a function is provided, it will be called with the current state of the sign-in flow.
|
|
20
|
+
* The function should return a `ReactNode`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx lines
|
|
24
|
+
* <SignIn>
|
|
25
|
+
* {(state) => {
|
|
26
|
+
* // Render a page title based on the current step
|
|
27
|
+
* return (
|
|
28
|
+
* <>
|
|
29
|
+
* <SignInBackButton />
|
|
30
|
+
* <SignInImage />
|
|
31
|
+
* <h1>
|
|
32
|
+
* {state.step === "credentials" && "Welcome"}
|
|
33
|
+
* {state.step === "verification" && "Almost there"}
|
|
34
|
+
* </h1>
|
|
35
|
+
* <SignInTitle />
|
|
36
|
+
* <SignInDescription />
|
|
37
|
+
* <SignInForm />
|
|
38
|
+
* {state.step === "credentials" && <SignInAuthMethodButtons activeMethod={state.authMethod} />}
|
|
39
|
+
* <SignInFooter />
|
|
40
|
+
* </>
|
|
41
|
+
* );
|
|
42
|
+
* }}
|
|
43
|
+
* </SignIn>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
13
46
|
children?: ReactNode | ((state: SignInState) => ReactNode);
|
|
47
|
+
/** A function to call when the sign-in flow is successful. */
|
|
14
48
|
onSuccess?: () => void;
|
|
49
|
+
/** Filter the auth methods that are shown to the user (this still respects the CDP config auth methods). */
|
|
15
50
|
authMethods?: AuthMethod[];
|
|
16
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* A sign-in component that handles the email and OTP flow.
|
|
54
|
+
*
|
|
55
|
+
* @param {SignInProps} props - The props for the component.
|
|
56
|
+
* @param {ReactNode} [props.children] - The children to render inside the component.
|
|
57
|
+
* @param {() => void} [props.onSuccess] - A function to call when the sign-in flow is successful.
|
|
58
|
+
* @returns {JSX.Element} The SignIn component.
|
|
59
|
+
*
|
|
60
|
+
* @group Components
|
|
61
|
+
*
|
|
62
|
+
* @document ./README.md
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```tsx lines
|
|
66
|
+
* function App() {
|
|
67
|
+
* // Render the SignIn component with a custom onSuccess handler
|
|
68
|
+
* const handleSuccess = () => {
|
|
69
|
+
* console.log("Sign in successful");
|
|
70
|
+
* }
|
|
71
|
+
* return (
|
|
72
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
73
|
+
* <SignIn onSuccess={handleSuccess} />
|
|
74
|
+
* </CDPReactProvider>
|
|
75
|
+
* );
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx lines
|
|
81
|
+
* function App() {
|
|
82
|
+
* // Render the title, description, and auth method buttons inside the transition containers
|
|
83
|
+
* // This is the default UI if no children are provided.
|
|
84
|
+
* return (
|
|
85
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
86
|
+
* <SignIn>
|
|
87
|
+
* <SignInBackButton />
|
|
88
|
+
* <SignInImage />
|
|
89
|
+
* <SignInForm>
|
|
90
|
+
* {({ authMethod, step, Form }) => {
|
|
91
|
+
* // Pass the authMethod and step from the render function args to the title
|
|
92
|
+
* // and description components so the UI is rendered correctly when both states
|
|
93
|
+
* // are visible during the transition
|
|
94
|
+
* return (
|
|
95
|
+
* <>
|
|
96
|
+
* <SignInTitle step={step} authMethod={authMethod} />
|
|
97
|
+
* <SignInDescription step={step} authMethod={authMethod} />
|
|
98
|
+
* {Form}
|
|
99
|
+
* {state.step === "credentials" && <SignInAuthMethodButtons activeMethod={authMethod} />}
|
|
100
|
+
* </>
|
|
101
|
+
* );
|
|
102
|
+
* }}
|
|
103
|
+
* </SignInForm>
|
|
104
|
+
* <SignInFooter />
|
|
105
|
+
* </SignIn>
|
|
106
|
+
* </CDPReactProvider>
|
|
107
|
+
* );
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```tsx lines
|
|
113
|
+
* function App() {
|
|
114
|
+
* // Render a page title based on the current step
|
|
115
|
+
* return (
|
|
116
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
117
|
+
* <SignIn>
|
|
118
|
+
* {(state) => {
|
|
119
|
+
* return (
|
|
120
|
+
* <>
|
|
121
|
+
* <SignInBackButton />
|
|
122
|
+
* <SignInImage />
|
|
123
|
+
* <h1>
|
|
124
|
+
* {state.step === "credentials" && "Welcome"}
|
|
125
|
+
* {state.step === "verification" && "Almost there"}
|
|
126
|
+
* </h1>
|
|
127
|
+
* <SignInTitle />
|
|
128
|
+
* <SignInDescription />
|
|
129
|
+
* <SignInForm />
|
|
130
|
+
* {state.step === "credentials" && <SignInAuthMethodButtons activeMethod={state.authMethod} />}
|
|
131
|
+
* <SignInFooter />
|
|
132
|
+
* </>
|
|
133
|
+
* );
|
|
134
|
+
* }}
|
|
135
|
+
* </SignIn>
|
|
136
|
+
* </CDPReactProvider>
|
|
137
|
+
* );
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
17
141
|
export declare const SignIn: ({ authMethods, ...props }: SignInProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
142
|
export { SignInAuthMethodButtons, SignInBackButton, SignInDescription, SignInFooter, SignInForm, SignInImage, SignInTitle, useSignInContext, type SignInAuthMethodButtonsProps, type SignInBackButtonProps, type SignInDescriptionProps, type SignInFormProps, type SignInImageProps, type SignInTitleProps, type SignInState, type SignInAction, };
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import { APIError } from '@coinbase/cdp-hooks';
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
|
3
3
|
import { AuthMethod } from '../CDPReactProvider';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the SignInTitle and SignInDescription components.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link SignInTitle}
|
|
8
|
+
* @see {@link SignInDescription}
|
|
9
|
+
*/
|
|
4
10
|
export interface SignInTitleAndDescriptionProps {
|
|
11
|
+
/** The auth method to render the title for. */
|
|
5
12
|
authMethod?: AuthMethod;
|
|
13
|
+
/** If set, will render the title for this step of the sign in flow, regardless of the context value. */
|
|
6
14
|
step?: SignInState["step"];
|
|
7
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The state of the SignIn component.
|
|
18
|
+
*
|
|
19
|
+
* @property {AuthMethod | null} authMethod - The auth method selected by the user.
|
|
20
|
+
* @property {boolean} canResetOTP - Whether the user can request a new OTP.
|
|
21
|
+
* @property {string} email - The email address of the user.
|
|
22
|
+
* @property {string | APIError | null} error - The error message or APIError object.
|
|
23
|
+
* @property {string} flowId - The flow ID of the current sign-in flow.
|
|
24
|
+
* @property {boolean} isPending - Whether the form state is pending.
|
|
25
|
+
* @property {boolean} isSuccess - Whether the sign-in flow is successful.
|
|
26
|
+
* @property {string} otp - The OTP code entered by the user.
|
|
27
|
+
* @property {string} phoneNumber - The phone number of the user.
|
|
28
|
+
* @property {AuthMethod | "otp" | "success"} step - The current step of the sign-in flow.
|
|
29
|
+
*
|
|
30
|
+
* @see {@link SignIn}
|
|
31
|
+
* @see {@link useSignInReducer}
|
|
32
|
+
*/
|
|
8
33
|
export interface SignInState {
|
|
9
34
|
authMethod: AuthMethod;
|
|
10
35
|
authMethods: AuthMethod[];
|
|
@@ -18,6 +43,12 @@ export interface SignInState {
|
|
|
18
43
|
phoneNumber: string;
|
|
19
44
|
step: "credentials" | "verification";
|
|
20
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* The actions that can be performed on the SignIn state.
|
|
48
|
+
*
|
|
49
|
+
* @see {@link SignIn}
|
|
50
|
+
* @see {@link useSignInReducer}
|
|
51
|
+
*/
|
|
21
52
|
export type SignInAction = {
|
|
22
53
|
type: "SET_AUTH_METHOD";
|
|
23
54
|
payload: {
|
|
@@ -99,6 +130,9 @@ export type SignInAction = {
|
|
|
99
130
|
} | {
|
|
100
131
|
type: "RESET_STATE";
|
|
101
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* Shared props for a sign in flow.
|
|
135
|
+
*/
|
|
102
136
|
export interface SignInFlowProps {
|
|
103
137
|
step: SignInState["step"];
|
|
104
138
|
autoFocus?: boolean;
|
|
@@ -108,6 +142,9 @@ export interface SignInFlowProps {
|
|
|
108
142
|
Form: ReactNode;
|
|
109
143
|
}) => ReactNode;
|
|
110
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* The configuration for a sign in flow.
|
|
147
|
+
*/
|
|
111
148
|
export interface SignInFlowConfig {
|
|
112
149
|
forms: FC<SignInFlowProps>;
|
|
113
150
|
description: FC<SignInTitleAndDescriptionProps>;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import { SignInAction, SignInState } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A reducer hook for the SignIn component.
|
|
4
|
+
*
|
|
5
|
+
* @param {SignInState} initialState - The initial state of the component.
|
|
6
|
+
*
|
|
7
|
+
* @returns {[SignInState, SignInAction]} The current state and dispatcher to perform actions on the state.
|
|
8
|
+
*
|
|
9
|
+
* @group Hooks
|
|
10
|
+
*/
|
|
2
11
|
export declare const useSignInReducer: (initialState: SignInState) => [SignInState, import('react').ActionDispatch<[action: SignInAction]>];
|
|
@@ -2,20 +2,143 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { AuthMethod } from '../CDPReactProvider';
|
|
3
3
|
import { ButtonProps } from '../ui/Button';
|
|
4
4
|
import { ModalContentProps } from '../ui/Modal';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the sign in modal trigger button
|
|
7
|
+
*
|
|
8
|
+
* @see {@link SignInModalTrigger}
|
|
9
|
+
*/
|
|
5
10
|
export interface SignInModalTriggerProps extends Partial<Pick<ButtonProps, "className" | "fullWidth" | "size" | "style" | "variant">> {
|
|
11
|
+
/** If provided, will render the children instead of the default trigger button. */
|
|
6
12
|
children?: ReactNode;
|
|
13
|
+
/** The label to display on the trigger button. */
|
|
7
14
|
label?: ReactNode;
|
|
8
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Props for the sign in modal content.
|
|
18
|
+
*
|
|
19
|
+
* @augments ModalContentProps
|
|
20
|
+
*
|
|
21
|
+
* @see {@link SignInModalContent}
|
|
22
|
+
*/
|
|
9
23
|
export interface SignInModalContentProps extends ModalContentProps {
|
|
24
|
+
/** A function to call when the sign-in flow is successful. */
|
|
10
25
|
onSuccess?: () => void;
|
|
11
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Props for the SignInModal component.
|
|
29
|
+
*
|
|
30
|
+
* @see {@link SignInModal}
|
|
31
|
+
*/
|
|
12
32
|
export interface SignInModalProps {
|
|
33
|
+
/** Filter the auth methods that are shown to the user (this still respects the CDP config auth methods). */
|
|
13
34
|
authMethods?: AuthMethod[];
|
|
35
|
+
/** If provided, will render the children instead of the default trigger button. */
|
|
14
36
|
children?: ReactNode;
|
|
37
|
+
/** Whether the modal is open. Note: if you set this, you must also set `setIsOpen`. */
|
|
15
38
|
open?: boolean;
|
|
39
|
+
/** A function to set the modal's open state. Note: if you set this, you must also set `open`. */
|
|
16
40
|
setIsOpen?: (value: boolean) => void;
|
|
41
|
+
/** A function to call when the sign-in flow is successful. */
|
|
17
42
|
onSuccess?: () => void;
|
|
18
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* A trigger button that opens the sign in modal.
|
|
46
|
+
*
|
|
47
|
+
* @param {SignInModalTriggerProps} props - The props for the SignInModalTrigger component.
|
|
48
|
+
* @param {ReactNode} [props.children] - The children to render inside the trigger button.
|
|
49
|
+
* @param {ReactNode} [props.label] - The label to display on the trigger button.
|
|
50
|
+
* @returns {JSX.Element} The SignInModalTrigger component.
|
|
51
|
+
*
|
|
52
|
+
* @group Components
|
|
53
|
+
*/
|
|
19
54
|
export declare const SignInModalTrigger: ({ children, className, label, ...props }: SignInModalTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* The sign in modal content.
|
|
57
|
+
*
|
|
58
|
+
* @augments ModalContentProps
|
|
59
|
+
* @param {SignInModalContentProps} props - The props for the SignInModalContent component.
|
|
60
|
+
* @returns {JSX.Element} The SignInModalContent component.
|
|
61
|
+
*
|
|
62
|
+
* @group Components
|
|
63
|
+
*/
|
|
20
64
|
export declare const SignInModalContent: (props: SignInModalContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* A sign-in modal component that wraps the {@link SignIn} component.
|
|
67
|
+
* In the SignIn modal, the description is hidden on the "credentials" step, and the title is hidden on the "verification" step.
|
|
68
|
+
*
|
|
69
|
+
* @see {@link SignInModalTrigger} for the trigger button.
|
|
70
|
+
* @see {@link SignInModalContent} for the modal content.
|
|
71
|
+
*
|
|
72
|
+
* @param {SignInModalProps} props - The props for the SignInModal component.
|
|
73
|
+
* @param {boolean} props.open - Whether the modal is open.
|
|
74
|
+
* @param {(value: boolean) => void} props.setIsOpen - A function to set the modal's open state.
|
|
75
|
+
* @param {ReactNode} props.children - The children to render inside the modal.
|
|
76
|
+
* @param {() => void} props.onSuccess - A function to call when the sign-in flow is successful.
|
|
77
|
+
* @returns {JSX.Element} The SignInModal component.
|
|
78
|
+
*
|
|
79
|
+
* @group Components
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx lines
|
|
83
|
+
* // Render the SignInModal component with a custom success handler
|
|
84
|
+
* function App() {
|
|
85
|
+
* // optional custom success handler
|
|
86
|
+
* const handleSignInSuccess = useCallback(() => {
|
|
87
|
+
* console.log("Sign in successful");
|
|
88
|
+
* }, []);
|
|
89
|
+
* return (
|
|
90
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
91
|
+
* <SignInModal onSuccess={handleSignInSuccess} />
|
|
92
|
+
* </CDPReactProvider>
|
|
93
|
+
* );
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```tsx lines
|
|
99
|
+
* // Render the SignInModal component with a custom trigger button
|
|
100
|
+
* function App() {
|
|
101
|
+
* return (
|
|
102
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
103
|
+
* <SignInModal>
|
|
104
|
+
* <button type="button" className="sign-in-button">
|
|
105
|
+
* Sign in
|
|
106
|
+
* </button>
|
|
107
|
+
* </SignInModal>
|
|
108
|
+
* </CDPReactProvider>
|
|
109
|
+
* );
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```tsx lines
|
|
115
|
+
* // Render the SignInModal component with a secondary variant trigger button and a custom label
|
|
116
|
+
* function App() {
|
|
117
|
+
* return (
|
|
118
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
119
|
+
* <SignInModal>
|
|
120
|
+
* <SignInModalTrigger variant="secondary" label="Log in" />
|
|
121
|
+
* <!-- modal content will be rendered automatically if not provided -->
|
|
122
|
+
* </SignInModal>
|
|
123
|
+
* </CDPReactProvider>
|
|
124
|
+
* );
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```tsx lines
|
|
130
|
+
* // Render the SignInModal component with a custom class on the modal overlay and window
|
|
131
|
+
* function App() {
|
|
132
|
+
* return (
|
|
133
|
+
* <CDPReactProvider config={config} theme={themeOverrides}>
|
|
134
|
+
* <SignInModal>
|
|
135
|
+
* <!-- SignInModalTrigger must be rendered if SignInModalContent is provided and you want to display the trigger button -->
|
|
136
|
+
* <SignInModalTrigger />
|
|
137
|
+
* <SignInModalContent className="custom-class" overlayClassName="custom-overlay-class" />
|
|
138
|
+
* </SignInModal>
|
|
139
|
+
* </CDPReactProvider>
|
|
140
|
+
* );
|
|
141
|
+
* }
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
21
144
|
export declare const SignInModal: ({ authMethods, children, open, setIsOpen, onSuccess, }: SignInModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,46 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ButtonProps } from '../ui/Button';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the SignOutButton component.
|
|
5
|
+
*
|
|
6
|
+
* @augments {ButtonProps}
|
|
7
|
+
*
|
|
8
|
+
* @see {@link SignOutButton}
|
|
9
|
+
*/
|
|
3
10
|
export interface SignOutButtonProps extends ButtonProps {
|
|
11
|
+
/** The children to render inside the button. */
|
|
4
12
|
children?: ReactNode;
|
|
13
|
+
/** A function to call when the sign-out is successful. */
|
|
5
14
|
onSuccess?: () => void;
|
|
6
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* A button that signs the user out.
|
|
18
|
+
*
|
|
19
|
+
* @param {SignOutButtonProps} [props] - The props for the component.
|
|
20
|
+
* @param {ReactNode} [props.children] - The children to render inside the button.
|
|
21
|
+
* @param {() => void} [props.onSuccess] - A function to call when the sign-out is successful.
|
|
22
|
+
* @returns {JSX.Element} The rendered component.
|
|
23
|
+
*
|
|
24
|
+
* @group Components
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx lines
|
|
28
|
+
* // Render a sign out button
|
|
29
|
+
* <SignOutButton onSuccess={() => console.log("Sign out success")} />
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx lines
|
|
34
|
+
* // Render a sign out button with a custom label, size, and variant
|
|
35
|
+
* <SignOutButton size="sm" variant="secondary">Log out</SignOutButton>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx lines
|
|
40
|
+
* // Render a sign out button with a custom button element
|
|
41
|
+
* <SignOutButton asChild>
|
|
42
|
+
* <button className="custom-button">Log out</button>
|
|
43
|
+
* </SignOutButton>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
7
46
|
export declare const SignOutButton: ({ children, className, onSuccess, ...props }: SignOutButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,83 @@
|
|
|
1
1
|
import { HTMLAttributes, JSX } from 'react';
|
|
2
2
|
import { Theme } from '../../theme/theme';
|
|
3
3
|
import { CDPWebCSSVariables } from '../../theme/utils';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the ThemeProvider component.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link ThemeProvider}
|
|
8
|
+
*/
|
|
4
9
|
export type ThemeProviderProps = {
|
|
10
|
+
/** Theme overrides */
|
|
5
11
|
theme?: Partial<Theme>;
|
|
12
|
+
/**
|
|
13
|
+
* Provider name for multi-provider coordination.
|
|
14
|
+
* Used internally by CDPReactProvider to identify which provider owns focused elements.
|
|
15
|
+
* If not provided, a unique ID is generated automatically.
|
|
16
|
+
*/
|
|
6
17
|
"data-cdp-provider"?: string;
|
|
7
18
|
} & HTMLAttributes<HTMLDivElement>;
|
|
19
|
+
/**
|
|
20
|
+
* The value of the theme context.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link useTheme}
|
|
23
|
+
*/
|
|
8
24
|
export interface ThemeContextValue {
|
|
9
25
|
theme: Theme;
|
|
10
26
|
cssVariables: CDPWebCSSVariables;
|
|
11
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Provides the theme to its child components and injects CSS variables.
|
|
30
|
+
*
|
|
31
|
+
* @param {ThemeProviderProps} props - The props for the component.
|
|
32
|
+
* @returns {JSX.Element} The theme provider component.
|
|
33
|
+
*
|
|
34
|
+
* @see {@link useTheme}
|
|
35
|
+
*
|
|
36
|
+
* @group Components
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx lines
|
|
40
|
+
* const AuthBasedTheme = ({ children }: { children: React.ReactNode }) => {
|
|
41
|
+
* const { isSignedIn: signedIn } = useIsSignedIn();
|
|
42
|
+
* const { evmAddress: cdpEvmAddress } = useEvmAddress();
|
|
43
|
+
* const isAuthenticated = signedIn && cdpEvmAddress;
|
|
44
|
+
* const theme = useMemo(() => (isAuthenticated ? darkTheme : {}), [isAuthenticated]);
|
|
45
|
+
* return (
|
|
46
|
+
* <ThemeProvider theme={theme}>
|
|
47
|
+
* {children}
|
|
48
|
+
* </ThemeProvider>
|
|
49
|
+
* );
|
|
50
|
+
* };
|
|
51
|
+
*
|
|
52
|
+
* function App() {
|
|
53
|
+
* // Change the theme based on the user's authentication status
|
|
54
|
+
* return (
|
|
55
|
+
* <CDPHooksProvider config={cdpConfig}>
|
|
56
|
+
* <AuthBasedTheme>
|
|
57
|
+
* <YourApp />
|
|
58
|
+
* </AuthBasedTheme>
|
|
59
|
+
* </CDPHooksProvider>
|
|
60
|
+
* );
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
12
64
|
export declare const ThemeProvider: ({ children, className, style, theme: themeOverrides, "data-cdp-provider": nameFromProps, ...props }: ThemeProviderProps) => JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* Hook to access the theme from a component.
|
|
67
|
+
*
|
|
68
|
+
* @returns {ThemeContextValue} The theme.
|
|
69
|
+
*
|
|
70
|
+
* @see {@link ThemeProvider}
|
|
71
|
+
*
|
|
72
|
+
* @group Hooks
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx lines
|
|
76
|
+
* function App() {
|
|
77
|
+
* // Style a paragraph with the secondary text color
|
|
78
|
+
* const { theme } = useTheme();
|
|
79
|
+
* return <p style={{ color: theme["colors-fg-muted"] }}>Secondary text</p>;
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
13
83
|
export declare const useTheme: () => ThemeContextValue;
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import { ElementType, HTMLAttributes } from 'react';
|
|
2
2
|
import { VerifyMfaMethodComponentProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The props for the VerifyMfaDescription component.
|
|
5
|
+
*/
|
|
3
6
|
export interface VerifyMfaDescriptionProps extends VerifyMfaMethodComponentProps, HTMLAttributes<HTMLElement> {
|
|
7
|
+
/** The element type to render the description as. */
|
|
4
8
|
as?: ElementType;
|
|
5
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* A description for the VerifyMfa component.
|
|
12
|
+
*
|
|
13
|
+
* @param {VerifyMfaDescriptionProps} props - The props for the component.
|
|
14
|
+
* @param {ElementType} [props.as] - The element type to render the description as.
|
|
15
|
+
* @param {MfaMethod} [props.method] - The MFA method to render the description for.
|
|
16
|
+
* @param {VerifyMfaState["step"]} [props.step] - The step of the verification flow.
|
|
17
|
+
* @returns {JSX.Element} The rendered component.
|
|
18
|
+
*
|
|
19
|
+
* @group Components
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <VerifyMfa>
|
|
24
|
+
* <VerifyMfaTitle />
|
|
25
|
+
* <VerifyMfaDescription />
|
|
26
|
+
* <VerifyMfaFlow />
|
|
27
|
+
* </VerifyMfa>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
6
30
|
export declare const VerifyMfaDescription: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: VerifyMfaDescriptionProps) => import("react/jsx-runtime").JSX.Element | null;
|