@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.
Files changed (199) hide show
  1. package/dist/components/AuthButton/index.d.ts +102 -0
  2. package/dist/components/CDPReactProvider/index.d.ts +114 -0
  3. package/dist/components/CopyAddress/index.d.ts +29 -0
  4. package/dist/components/CopyEvmKeyButton/index.d.ts +77 -0
  5. package/dist/components/CopySolanaKeyButton/index.d.ts +73 -0
  6. package/dist/components/EnrollMfa/EnrollMfaDescription.d.ts +21 -0
  7. package/dist/components/EnrollMfa/EnrollMfaFlow.d.ts +27 -0
  8. package/dist/components/EnrollMfa/EnrollMfaFlowBackButton.d.ts +19 -0
  9. package/dist/components/EnrollMfa/EnrollMfaFlowProvider.d.ts +52 -0
  10. package/dist/components/EnrollMfa/EnrollMfaFooter.d.ts +18 -0
  11. package/dist/components/EnrollMfa/EnrollMfaImage.d.ts +24 -0
  12. package/dist/components/EnrollMfa/EnrollMfaItem.d.ts +21 -0
  13. package/dist/components/EnrollMfa/EnrollMfaItems.d.ts +17 -0
  14. package/dist/components/EnrollMfa/EnrollMfaProvider.d.ts +35 -0
  15. package/dist/components/EnrollMfa/EnrollMfaTitle.d.ts +21 -0
  16. package/dist/components/EnrollMfa/index.d.ts +65 -0
  17. package/dist/components/EnrollMfa/methods/sms.d.ts +25 -0
  18. package/dist/components/EnrollMfa/methods/totp.d.ts +25 -0
  19. package/dist/components/EnrollMfa/types.d.ts +48 -0
  20. package/dist/components/EnrollMfa/useEnrollMfaReducer.d.ts +6 -0
  21. package/dist/components/EnrollMfaModal/index.d.ts +111 -0
  22. package/dist/components/ExportWallet/index.d.ts +163 -0
  23. package/dist/components/ExportWalletModal/index.d.ts +173 -0
  24. package/dist/components/Fund/FundForm.d.ts +18 -0
  25. package/dist/components/Fund/FundProvider.d.ts +17 -0
  26. package/dist/components/Fund/FundTitle.d.ts +12 -0
  27. package/dist/components/Fund/components/FundAmountInput.d.ts +13 -0
  28. package/dist/components/Fund/components/FundErrorScreen.d.ts +7 -0
  29. package/dist/components/Fund/components/FundPaymentMethods.d.ts +7 -0
  30. package/dist/components/Fund/components/FundPresetAmountInputs.d.ts +7 -0
  31. package/dist/components/Fund/components/FundTransactionStatus.d.ts +6 -0
  32. package/dist/components/Fund/hooks/useBuyUrl.d.ts +23 -0
  33. package/dist/components/Fund/hooks/useEmitLifecycleStatus.d.ts +12 -0
  34. package/dist/components/Fund/hooks/useExchangeRate.d.ts +17 -0
  35. package/dist/components/Fund/hooks/usePaymentMethods.d.ts +16 -0
  36. package/dist/components/Fund/hooks/usePopupMonitor.d.ts +9 -0
  37. package/dist/components/Fund/hooks/useSetupOnrampEventListeners.d.ts +6 -0
  38. package/dist/components/Fund/index.d.ts +87 -0
  39. package/dist/components/Fund/types.d.ts +137 -0
  40. package/dist/components/Fund/useFundReducer.d.ts +15 -0
  41. package/dist/components/Fund/utils/buildPaymentMethods.d.ts +15 -0
  42. package/dist/components/Fund/utils/setupOnrampEventListeners.d.ts +10 -0
  43. package/dist/components/Fund/utils/subscribeToWindowMessage.d.ts +27 -0
  44. package/dist/components/FundModal/index.d.ts +106 -0
  45. package/dist/components/LinkAuth/LinkAuthFlow.d.ts +25 -0
  46. package/dist/components/LinkAuth/LinkAuthFlowBackButton.d.ts +19 -0
  47. package/dist/components/LinkAuth/LinkAuthFlowProvider.d.ts +60 -0
  48. package/dist/components/LinkAuth/LinkAuthItem.d.ts +23 -0
  49. package/dist/components/LinkAuth/LinkAuthItems.d.ts +17 -0
  50. package/dist/components/LinkAuth/LinkAuthItems.js +30 -30
  51. package/dist/components/LinkAuth/LinkAuthProvider.d.ts +31 -0
  52. package/dist/components/LinkAuth/LinkAuthTitle.d.ts +17 -0
  53. package/dist/components/LinkAuth/index.d.ts +170 -0
  54. package/dist/components/LinkAuth/types.d.ts +31 -0
  55. package/dist/components/LinkAuth/utils.d.ts +12 -0
  56. package/dist/components/LinkAuthModal/index.d.ts +112 -0
  57. package/dist/components/OAuthStatusModal/index.d.ts +24 -0
  58. package/dist/components/SendEvmTransactionButton/index.d.ts +27 -0
  59. package/dist/components/SendSolanaTransactionButton/index.d.ts +27 -0
  60. package/dist/components/SignIn/SignInAuthMethodButtons.d.ts +26 -0
  61. package/dist/components/SignIn/SignInBackButton.d.ts +40 -0
  62. package/dist/components/SignIn/SignInCredentials.d.ts +13 -0
  63. package/dist/components/SignIn/SignInDescription.d.ts +35 -0
  64. package/dist/components/SignIn/SignInFooter.d.ts +27 -0
  65. package/dist/components/SignIn/SignInForm.d.ts +39 -0
  66. package/dist/components/SignIn/SignInImage.d.ts +38 -0
  67. package/dist/components/SignIn/SignInProvider.d.ts +54 -0
  68. package/dist/components/SignIn/SignInTitle.d.ts +35 -0
  69. package/dist/components/SignIn/flows/SignInWithEmail.d.ts +26 -0
  70. package/dist/components/SignIn/flows/SignInWithOAuth.d.ts +19 -0
  71. package/dist/components/SignIn/flows/SignInWithSms.d.ts +26 -0
  72. package/dist/components/SignIn/hooks/useEmailForm.d.ts +7 -0
  73. package/dist/components/SignIn/hooks/useOTPForm.d.ts +8 -0
  74. package/dist/components/SignIn/hooks/usePhoneNumberForm.d.ts +7 -0
  75. package/dist/components/SignIn/hooks/useSignInWithOAuth.d.ts +8 -0
  76. package/dist/components/SignIn/index.d.ts +124 -0
  77. package/dist/components/SignIn/types.d.ts +37 -0
  78. package/dist/components/SignIn/useSignInReducer.d.ts +9 -0
  79. package/dist/components/SignInModal/index.d.ts +123 -0
  80. package/dist/components/SignOutButton/index.d.ts +39 -0
  81. package/dist/components/ThemeProvider/index.d.ts +70 -0
  82. package/dist/components/VerifyMfa/VerifyMfaDescription.d.ts +24 -0
  83. package/dist/components/VerifyMfa/VerifyMfaFlow.d.ts +30 -0
  84. package/dist/components/VerifyMfa/VerifyMfaFlowBackButton.d.ts +19 -0
  85. package/dist/components/VerifyMfa/VerifyMfaFlowProvider.d.ts +51 -0
  86. package/dist/components/VerifyMfa/VerifyMfaFooter.d.ts +18 -0
  87. package/dist/components/VerifyMfa/VerifyMfaImage.d.ts +23 -0
  88. package/dist/components/VerifyMfa/VerifyMfaItem.d.ts +20 -0
  89. package/dist/components/VerifyMfa/VerifyMfaItems.d.ts +18 -0
  90. package/dist/components/VerifyMfa/VerifyMfaProvider.d.ts +40 -0
  91. package/dist/components/VerifyMfa/VerifyMfaTitle.d.ts +24 -0
  92. package/dist/components/VerifyMfa/index.d.ts +55 -0
  93. package/dist/components/VerifyMfa/methods/sms.d.ts +29 -0
  94. package/dist/components/VerifyMfa/methods/totp.d.ts +29 -0
  95. package/dist/components/VerifyMfa/types.d.ts +33 -0
  96. package/dist/components/VerifyMfa/useVerifyMfaReducer.d.ts +7 -0
  97. package/dist/components/VerifyMfaInline/index.d.ts +212 -0
  98. package/dist/components/VerifyMfaModal/index.d.ts +114 -0
  99. package/dist/components/forms/AmountInput/index.d.ts +16 -0
  100. package/dist/components/forms/AmountInput/types.d.ts +9 -0
  101. package/dist/components/forms/AmountInput/useAmountInput.d.ts +14 -0
  102. package/dist/components/forms/AmountInput/useInputScale.d.ts +12 -0
  103. package/dist/components/forms/AmountInput/useNumberParseAndFormat.d.ts +20 -0
  104. package/dist/components/forms/CountrySelect/index.d.ts +9 -0
  105. package/dist/components/forms/EmailForm/index.d.ts +17 -0
  106. package/dist/components/forms/ExchangeAmountInput/index.d.ts +19 -0
  107. package/dist/components/forms/ExchangeAmountInput/types.d.ts +12 -0
  108. package/dist/components/forms/ExchangeAmountInput/useExchangeAmountInput.d.ts +17 -0
  109. package/dist/components/forms/Field/index.d.ts +15 -0
  110. package/dist/components/forms/Input/index.d.ts +15 -0
  111. package/dist/components/forms/Label/index.d.ts +8 -0
  112. package/dist/components/forms/OTP/index.d.ts +6 -0
  113. package/dist/components/forms/OTPForm/index.d.ts +20 -0
  114. package/dist/components/forms/PhoneNumberForm/index.d.ts +27 -0
  115. package/dist/components/forms/PhoneNumberInput/index.d.ts +16 -0
  116. package/dist/components/forms/PhoneNumberInput/maskOverride.d.ts +6 -0
  117. package/dist/components/forms/PhoneNumberInput/usePhoneNumberFormatter.d.ts +7 -0
  118. package/dist/components/forms/Select/index.d.ts +30 -0
  119. package/dist/components/ui/Badge/index.d.ts +19 -0
  120. package/dist/components/ui/Banner/index.d.ts +25 -0
  121. package/dist/components/ui/Button/index.d.ts +50 -0
  122. package/dist/components/ui/ButtonBase/index.d.ts +20 -0
  123. package/dist/components/ui/CoinbaseFooter/index.d.ts +16 -0
  124. package/dist/components/ui/CopyTextField/index.d.ts +35 -0
  125. package/dist/components/ui/Error/index.d.ts +14 -0
  126. package/dist/components/ui/IframeButton/index.d.ts +17 -0
  127. package/dist/components/ui/LoadingSkeleton/index.d.ts +22 -0
  128. package/dist/components/ui/LoadingSpinner/index.d.ts +11 -0
  129. package/dist/components/ui/Modal/index.d.ts +82 -0
  130. package/dist/components/ui/QRCode/QRCodeSvg.d.ts +35 -0
  131. package/dist/components/ui/QRCode/index.d.ts +7 -0
  132. package/dist/components/ui/QRCode/useCorners.d.ts +9 -0
  133. package/dist/components/ui/QRCode/useDotsPath.d.ts +18 -0
  134. package/dist/components/ui/QRCode/useLogo.d.ts +18 -0
  135. package/dist/components/ui/QRCode/useMatrix.d.ts +7 -0
  136. package/dist/components/ui/ServerError/index.d.ts +6 -0
  137. package/dist/components/ui/SuccessMessage/index.d.ts +14 -0
  138. package/dist/components/ui/SwitchFadeTransition/index.d.ts +15 -0
  139. package/dist/components/ui/SwitchSlideTransition/index.d.ts +16 -0
  140. package/dist/components/ui/SwitchTransition/index.d.ts +42 -0
  141. package/dist/components/ui/ToggleListItem/index.d.ts +31 -0
  142. package/dist/components/ui/VisuallyHidden/index.d.ts +18 -0
  143. package/dist/data/countries.d.ts +15 -0
  144. package/dist/data/countryNames.d.ts +4 -0
  145. package/dist/hooks/useKeyExportPostMessage.d.ts +25 -0
  146. package/dist/hooks/usePhoneNumberState.d.ts +47 -0
  147. package/dist/hooks/usePhoneNumberValidators.d.ts +8 -0
  148. package/dist/hooks/useTimeout.d.ts +18 -0
  149. package/dist/hooks/useTimer.d.ts +6 -0
  150. package/dist/hooks/useTransitionMap.d.ts +22 -0
  151. package/dist/hooks/useVerifyMfaModal.d.ts +78 -0
  152. package/dist/icons/IconAppleLogo.d.ts +22 -0
  153. package/dist/icons/IconArrowLeft.d.ts +22 -0
  154. package/dist/icons/IconArrowsUpDown.d.ts +22 -0
  155. package/dist/icons/IconCheck.d.ts +22 -0
  156. package/dist/icons/IconCheckCircle.d.ts +21 -0
  157. package/dist/icons/IconChevronDown.d.ts +22 -0
  158. package/dist/icons/IconCoinbaseMark.d.ts +22 -0
  159. package/dist/icons/IconCoinbaseWordmark.d.ts +22 -0
  160. package/dist/icons/IconCopy.d.ts +22 -0
  161. package/dist/icons/IconCreditCard.d.ts +22 -0
  162. package/dist/icons/IconCurrencies.d.ts +22 -0
  163. package/dist/icons/IconEnvelope.d.ts +22 -0
  164. package/dist/icons/IconExclamationCircle.d.ts +22 -0
  165. package/dist/icons/IconExclamationTriangle.d.ts +22 -0
  166. package/dist/icons/IconGoogleColorLogo.d.ts +22 -0
  167. package/dist/icons/IconGoogleLogo.d.ts +22 -0
  168. package/dist/icons/IconLock.d.ts +22 -0
  169. package/dist/icons/IconMinus.d.ts +21 -0
  170. package/dist/icons/IconPhone.d.ts +22 -0
  171. package/dist/icons/IconPinCode.d.ts +22 -0
  172. package/dist/icons/IconPlus.d.ts +21 -0
  173. package/dist/icons/IconShield.d.ts +22 -0
  174. package/dist/icons/IconSmartPhone.d.ts +22 -0
  175. package/dist/icons/IconTelegramLogo.d.ts +22 -0
  176. package/dist/icons/IconXLogo.d.ts +22 -0
  177. package/dist/icons/IconXMark.d.ts +22 -0
  178. package/dist/icons/SvgIcon.d.ts +6 -0
  179. package/dist/theme/cssVariables.d.ts +10 -0
  180. package/dist/theme/theme.d.ts +246 -0
  181. package/dist/theme/tokens.d.ts +54 -0
  182. package/dist/theme/utils.d.ts +63 -0
  183. package/dist/types/secureIframe.d.ts +3 -0
  184. package/dist/utils/capitalize.d.ts +8 -0
  185. package/dist/utils/childrenHasComponent.d.ts +10 -0
  186. package/dist/utils/clamp.d.ts +10 -0
  187. package/dist/utils/formatFiat.d.ts +11 -0
  188. package/dist/utils/formatPhoneNumber.d.ts +8 -0
  189. package/dist/utils/getMessageFromUnknownError.d.ts +9 -0
  190. package/dist/utils/isApiError.d.ts +21 -0
  191. package/dist/utils/isEmailInvalid.d.ts +15 -0
  192. package/dist/utils/openPopup.d.ts +15 -0
  193. package/dist/utils/parseValuesFromPhoneNumber.d.ts +16 -0
  194. package/dist/utils/sendIframeMessage.d.ts +8 -0
  195. package/dist/utils/toOAuthProviderType.d.ts +8 -0
  196. package/dist/utils/transition.d.ts +41 -0
  197. package/dist/version.d.ts +5 -1
  198. package/dist/version.js +1 -1
  199. package/package.json +5 -5
@@ -1,12 +1,42 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
2
  import { MfaMethod, VerifyMfaStep } from './types';
3
+ /**
4
+ * Props for the VerifyMfaFlow component.
5
+ */
3
6
  export interface VerifyMfaFlowProps 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: VerifyMfaStep;
8
14
  method: MfaMethod;
9
15
  Content: ReactNode;
10
16
  }) => ReactNode;
11
17
  }
18
+ /**
19
+ * The flow for the VerifyMfa component. Renders the appropriate content
20
+ * based on the current MFA method and step.
21
+ *
22
+ * The "verification" step renders the current method's content (verification form).
23
+ * The "list" step renders alternate method options.
24
+ *
25
+ * @param {VerifyMfaFlowProps} props - The component props.
26
+ * @param {boolean} [props.autoFocus] - Whether to auto focus the form when the component mounts.
27
+ * @param {boolean} [props.animateHeight] - Whether to animate the height of the component.
28
+ * @param {(props: { step: VerifyMfaStep; method: MfaMethod; Content: ReactNode }) => ReactNode} [props.children] - The children of the component.
29
+ * @returns {JSX.Element} The rendered component.
30
+ *
31
+ * @group Components
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * <VerifyMfa>
36
+ * <VerifyMfaTitle />
37
+ * <VerifyMfaDescription />
38
+ * <VerifyMfaFlow />
39
+ * </VerifyMfa>
40
+ * ```
41
+ */
12
42
  export declare const VerifyMfaFlow: ({ autoFocus, animateHeight, children, className, ...props }: VerifyMfaFlowProps) => 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 { VerifyMfaStep } from './types';
4
+ /**
5
+ * Props for the VerifyMfaFlowBackButton component.
6
+ *
7
+ * @see {@link VerifyMfaFlowBackButton}
8
+ */
4
9
  export interface VerifyMfaFlowBackButtonProps 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?: VerifyMfaStep;
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 verification flow.
19
+ *
20
+ * @param {VerifyMfaFlowBackButtonProps} props - The props for the component.
21
+ * @returns {JSX.Element | null} The rendered component.
22
+ *
23
+ * @see {@link VerifyMfaFlow}
24
+ * @see {@link VerifyMfa}
25
+ *
26
+ * @group Components
27
+ */
9
28
  export declare const VerifyMfaFlowBackButton: ({ ["aria-label"]: ariaLabel, children, className, size, onClick, variant, step: stepFromProps, ...props }: VerifyMfaFlowBackButtonProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,23 +1,74 @@
1
1
  import { ReactNode, RefObject } from 'react';
2
2
  import { SwitchSlideTransitionRef } from '../ui/SwitchSlideTransition';
3
3
  import { MfaMethod, VerifyMfaStep } from './types';
4
+ /**
5
+ * The value of the MFA verification flow context.
6
+ *
7
+ * @see {@link useVerifyMfaFlow}
8
+ */
4
9
  export interface VerifyMfaFlowContextValue {
10
+ /** A function to go back to the previous step. */
5
11
  back: () => void;
12
+ /** The direction of the flow transition. */
6
13
  direction: "left" | "right";
14
+ /** A function to select an alternate verification method. */
7
15
  selectMethod: (method: MfaMethod) => void;
16
+ /** A function to show the alternate methods list. */
8
17
  showMethodList: () => void;
9
18
  }
19
+ /**
20
+ * The value of the MFA verification flow context for internal use.
21
+ *
22
+ * @see {@link useVerifyMfaFlowInternal}
23
+ */
10
24
  export interface VerifyMfaFlowContextValueInternal extends VerifyMfaFlowContextValue {
25
+ /** A ref to the flow transition. */
11
26
  transitionRef: RefObject<SwitchSlideTransitionRef<VerifyMfaStep> | null> | null;
12
27
  }
28
+ /**
29
+ * Props for the VerifyMfaFlowProvider component.
30
+ *
31
+ * @see {@link VerifyMfaFlowProvider}
32
+ */
13
33
  export interface VerifyMfaFlowProviderProps {
34
+ /** The children of the component. */
14
35
  children?: ReactNode;
36
+ /** The direction of the flow transition. */
15
37
  direction: VerifyMfaFlowContextValue["direction"];
38
+ /** A function to go back to the previous step. */
16
39
  onBack: VerifyMfaFlowContextValue["back"];
40
+ /** A function to select an alternate verification method. */
17
41
  onSelectMethod: VerifyMfaFlowContextValue["selectMethod"];
42
+ /** A function to show the alternate methods list. */
18
43
  onShowMethodList: VerifyMfaFlowContextValue["showMethodList"];
44
+ /** A ref to the flow transition. */
19
45
  transitionRef: VerifyMfaFlowContextValueInternal["transitionRef"];
20
46
  }
47
+ /**
48
+ * A hook to get the MFA verification flow context value (internal).
49
+ *
50
+ * @returns {VerifyMfaFlowContextValueInternal} The context value.
51
+ *
52
+ * @group Hooks
53
+ */
21
54
  export declare const useVerifyMfaFlowInternal: () => VerifyMfaFlowContextValueInternal;
55
+ /**
56
+ * A hook to get the MFA verification flow context value.
57
+ *
58
+ * @returns {VerifyMfaFlowContextValue} The context value.
59
+ *
60
+ * @see {@link VerifyMfaFlow}
61
+ * @see {@link VerifyMfa}
62
+ *
63
+ * @group Hooks
64
+ */
22
65
  export declare const useVerifyMfaFlow: () => VerifyMfaFlowContextValue;
66
+ /**
67
+ * A provider for the MFA verification flow.
68
+ *
69
+ * @param {VerifyMfaFlowProviderProps} props - The props for the component.
70
+ * @returns {JSX.Element} The rendered component.
71
+ *
72
+ * @group Components
73
+ */
23
74
  export declare const VerifyMfaFlowProvider: ({ children, direction, onBack, onSelectMethod, onShowMethodList, transitionRef, }: VerifyMfaFlowProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,20 @@
1
1
  import { HTMLAttributes } from 'react';
2
+ /**
3
+ * A footer component for the MFA verification flow.
4
+ *
5
+ * @param props - The props for the component.
6
+ * @returns The rendered footer.
7
+ *
8
+ * @group Components
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <VerifyMfa>
13
+ * <VerifyMfaTitle />
14
+ * <VerifyMfaDescription />
15
+ * <VerifyMfaFlow />
16
+ * <VerifyMfaFooter />
17
+ * </VerifyMfa>
18
+ * ```
19
+ */
2
20
  export declare const VerifyMfaFooter: (props: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,29 @@
1
1
  import { ElementType, HTMLAttributes } from 'react';
2
2
  import { VerifyMfaMethodComponentProps } from './types';
3
+ /**
4
+ * The props for the VerifyMfaImage component.
5
+ */
3
6
  export interface VerifyMfaImageProps extends VerifyMfaMethodComponentProps, HTMLAttributes<HTMLElement> {
4
7
  as?: ElementType;
5
8
  }
9
+ /**
10
+ * A description for the VerifyMfa component.
11
+ *
12
+ * @param {VerifyMfaImageProps} props - The props for the component.
13
+ * @param {ElementType} [props.as] - The element type to render the description as.
14
+ * @param {MfaMethod} [props.method] - The MFA method to render the description for.
15
+ * @param {VerifyMfaState["step"]} [props.step] - The step of the verification flow.
16
+ * @returns {JSX.Element} The rendered component.
17
+ *
18
+ * @group Components
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <VerifyMfa>
23
+ * <VerifyMfaTitle />
24
+ * <VerifyMfaImage />
25
+ * <VerifyMfaFlow />
26
+ * </VerifyMfa>
27
+ * ```
28
+ */
6
29
  export declare const VerifyMfaImage: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: VerifyMfaImageProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,10 +1,30 @@
1
1
  import { MouseEventHandler, ReactNode } from 'react';
2
2
  import { MfaMethod } from './types';
3
+ /**
4
+ * The props for the VerifyMfaItem component.
5
+ *
6
+ * @see {@link VerifyMfaItem}
7
+ */
3
8
  export interface VerifyMfaItemProps {
9
+ /** The MFA method this item represents. */
4
10
  method: MfaMethod;
11
+ /** An icon to display. */
5
12
  icon?: ReactNode;
13
+ /** A label for the MFA method. */
6
14
  label: string;
15
+ /** A function to call when the user selects this method. */
7
16
  onSelect: MouseEventHandler<HTMLButtonElement>;
8
17
  }
18
+ /**
19
+ * A component for displaying an MFA method in the verification list.
20
+ *
21
+ * @param {VerifyMfaItemProps} props - The props for the component.
22
+ * @returns {JSX.Element} The rendered component.
23
+ *
24
+ * @see {@link VerifyMfaItems}
25
+ * @see {@link VerifyMfa}
26
+ *
27
+ * @group Components
28
+ */
9
29
  declare const VerifyMfaItem: ({ icon, label, onSelect }: VerifyMfaItemProps) => import("react/jsx-runtime").JSX.Element;
10
30
  export { VerifyMfaItem };
@@ -1,9 +1,27 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
2
  import { MfaMethod } from './types';
3
3
  import { VerifyMfaItemProps } from './VerifyMfaItem';
4
+ /**
5
+ * The props for the VerifyMfaItems component.
6
+ *
7
+ * @see {@link VerifyMfaItems}
8
+ */
4
9
  interface VerifyMfaItemsProps extends Omit<HTMLAttributes<HTMLUListElement>, "children" | "onSelect"> {
10
+ /** A render function for the MFA method item. */
5
11
  children?: (props: VerifyMfaItemProps) => ReactNode;
12
+ /** A function to call when a method is selected. */
6
13
  onSelect?: (method: MfaMethod) => void;
7
14
  }
15
+ /**
16
+ * A list of alternate MFA verification methods.
17
+ * Filters out the currently selected method.
18
+ *
19
+ * @param {VerifyMfaItemsProps} props - The props for the component.
20
+ * @returns {JSX.Element} The rendered component.
21
+ *
22
+ * @see {@link VerifyMfa}
23
+ *
24
+ * @group Components
25
+ */
8
26
  declare const VerifyMfaItems: ({ children, className, onSelect, ...props }: VerifyMfaItemsProps) => import("react/jsx-runtime").JSX.Element;
9
27
  export { VerifyMfaItems, type VerifyMfaItemsProps };
@@ -1,15 +1,55 @@
1
1
  import { Dispatch, ReactNode } from 'react';
2
2
  import { VerifyMfaAction, VerifyMfaState } from './types';
3
+ /**
4
+ * The context value for the VerifyMfa component.
5
+ *
6
+ * @see {@link useVerifyMfaContext}
7
+ */
3
8
  export interface VerifyMfaContextValue {
9
+ /** The function to call when verification is successful. */
4
10
  onSuccess?: (mfaCode: string) => void;
11
+ /** The function to call when verification errors. */
5
12
  onError?: (error: Error) => void;
13
+ /** The current state of the verification flow. */
6
14
  state: VerifyMfaState;
15
+ /** The dispatch function to update the state. */
7
16
  dispatch: Dispatch<VerifyMfaAction>;
8
17
  }
18
+ /**
19
+ * Hook to access the VerifyMfa context.
20
+ *
21
+ * @returns The current state and dispatch function of the VerifyMfa component.
22
+ *
23
+ * @group Hooks
24
+ *
25
+ * @see {@link VerifyMfa}
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * function MfaCodeDisplay() {
30
+ * const { state } = useVerifyMfaContext();
31
+ * return <div>Code: {state.mfaCode}</div>;
32
+ * }
33
+ * ```
34
+ */
9
35
  export declare const useVerifyMfaContext: () => VerifyMfaContextValue;
36
+ /**
37
+ * Props for the VerifyMfaProvider component.
38
+ */
10
39
  export interface VerifyMfaProviderProps {
11
40
  children: ReactNode;
41
+ /** The function to call when verification is successful. */
12
42
  onSuccess?: (mfaCode: string) => void;
43
+ /** The function to call when verification errors. */
13
44
  onError?: (error: Error) => void;
14
45
  }
46
+ /**
47
+ * A provider for the VerifyMfaContext.
48
+ *
49
+ * @param props - The props for the VerifyMfaProvider component.
50
+ * @param props.children - The children to render inside the provider.
51
+ * @param props.onSuccess - The function to call when verification is successful.
52
+ * @param props.onError - The function to call when verification errors.
53
+ * @returns {JSX.Element} The rendered component.
54
+ */
15
55
  export declare const VerifyMfaProvider: ({ children, onError, onSuccess }: VerifyMfaProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,30 @@
1
1
  import { ElementType, HTMLAttributes } from 'react';
2
2
  import { VerifyMfaMethodComponentProps } from './types';
3
+ /**
4
+ * The props for the VerifyMfaTitle component.
5
+ */
3
6
  export interface VerifyMfaTitleProps extends VerifyMfaMethodComponentProps, HTMLAttributes<HTMLElement> {
7
+ /** The element type to render the title as. */
4
8
  as?: ElementType;
5
9
  }
10
+ /**
11
+ * A title for the VerifyMfa component.
12
+ *
13
+ * @param {VerifyMfaTitleProps} props - The props for the component.
14
+ * @param {ElementType} [props.as] - The element type to render the title as.
15
+ * @param {MfaMethod} [props.method] - The MFA method to render the title 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 VerifyMfaTitle: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: VerifyMfaTitleProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -11,10 +11,65 @@ import { VerifyMfaItem, VerifyMfaItemProps } from './VerifyMfaItem';
11
11
  import { VerifyMfaItems, VerifyMfaItemsProps } from './VerifyMfaItems';
12
12
  import { useVerifyMfaContext, VerifyMfaContextValue } from './VerifyMfaProvider';
13
13
  import { VerifyMfaTitle, VerifyMfaTitleProps } from './VerifyMfaTitle';
14
+ /**
15
+ * Props for the VerifyMfa component.
16
+ */
14
17
  interface VerifyMfaProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "onSubmit" | "onError"> {
18
+ /**
19
+ * The children of the component. Leave empty to use the default verification UI.
20
+ *
21
+ * If a function is provided, it will be called with the current state of the verification flow.
22
+ * The function should return a `ReactNode`.
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * <VerifyMfa>
27
+ * {(state) => (
28
+ * <>
29
+ * <VerifyMfaTitle />
30
+ * <VerifyMfaDescription />
31
+ * <VerifyMfaFlow />
32
+ * </>
33
+ * )}
34
+ * </VerifyMfa>
35
+ * ```
36
+ */
15
37
  children?: ReactNode | ((state: VerifyMfaState) => ReactNode);
38
+ /** A function to call when the verification is successful. */
16
39
  onSuccess?: (mfaCode: string) => void;
40
+ /** A function to call when the verification errors. */
17
41
  onError?: (error: APIError | Error) => void;
18
42
  }
43
+ /**
44
+ * A component for MFA verification. Prompts enrolled users to enter their
45
+ * authenticator code.
46
+ *
47
+ * @param {VerifyMfaProps} props - The props for the component.
48
+ * @returns {JSX.Element} The rendered component.
49
+ *
50
+ * @group Components
51
+ *
52
+ * @document ./README.md
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * // Default usage
57
+ * <VerifyMfa onSuccess={(mfaCode) => console.log("Verified!", mfaCode)} />
58
+ * ```
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * // With custom UI
63
+ * <VerifyMfa onSuccess={handleSuccess}>
64
+ * {(state) => (
65
+ * <>
66
+ * <h2>Enter your code</h2>
67
+ * <VerifyMfaFlow />
68
+ * {state.error && <p className="error">{state.error}</p>}
69
+ * </>
70
+ * )}
71
+ * </VerifyMfa>
72
+ * ```
73
+ */
19
74
  declare const VerifyMfa: ({ onSuccess, onError, ...props }: VerifyMfaProps) => import("react/jsx-runtime").JSX.Element;
20
75
  export { VerifyMfa, VerifyMfaDescription, VerifyMfaFlow, VerifyMfaFlowBackButton, VerifyMfaFooter, VerifyMfaImage, VerifyMfaItem, VerifyMfaItems, VerifyMfaTitle, useVerifyMfaContext, useVerifyMfaFlow, type VerifyMfaProps, type VerifyMfaContextValue, type VerifyMfaDescriptionProps, type VerifyMfaFlowBackButtonProps, type VerifyMfaFlowContextValue, type VerifyMfaFlowProps, type VerifyMfaImageProps, type VerifyMfaItemProps, type VerifyMfaItemsProps, type VerifyMfaTitleProps, type VerifyMfaAction, type VerifyMfaState, type VerifyMfaStep, };
@@ -1,6 +1,35 @@
1
1
  import { MfaMethodConfig, MfaMethodContentProps, VerifyMfaMethodComponentProps } from '../types';
2
+ /**
3
+ * Content component for SMS verification.
4
+ * Renders an OTP form for entering the SMS code.
5
+ *
6
+ * @param {MfaMethodContentProps} props - The props for the component.
7
+ * @param {boolean} [props.autoFocus] - Whether to auto-focus the input.
8
+ * @param {(error: Error) => void} [props.onError] - The callback to call when verification errors.
9
+ * @param {(mfaCode: string) => void} [props.onSuccess] - The callback to call when verification is successful.
10
+ * @param {(props: { step: VerifyMfaStep; Content: ReactNode }) => ReactNode} [props.children] - Optional render prop for custom rendering.
11
+ * @returns {JSX.Element} The rendered component.
12
+ */
2
13
  export declare const SmsContent: ({ autoFocus, onError, onSuccess, children, }: MfaMethodContentProps) => import("react/jsx-runtime").JSX.Element;
14
+ /**
15
+ * Title component for SMS verification.
16
+ *
17
+ * @param {VerifyMfaMethodComponentProps} _props - The props for the component.
18
+ * @returns {JSX.Element} The rendered component.
19
+ */
3
20
  export declare const SmsTitle: (_props: VerifyMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element;
21
+ /**
22
+ * Image component for SMS verification.
23
+ *
24
+ * @param {VerifyMfaMethodComponentProps} _props - The props for the component.
25
+ * @returns {JSX.Element} The rendered component.
26
+ */
4
27
  export declare const SmsImage: (_props: VerifyMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element;
28
+ /**
29
+ * Description component for SMS verification.
30
+ *
31
+ * @param {VerifyMfaMethodComponentProps} _props - The props for the component.
32
+ * @returns {JSX.Element} The rendered component.
33
+ */
5
34
  export declare const SmsDescription: (_props: VerifyMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element;
6
35
  export declare const smsMethodConfig: MfaMethodConfig;
@@ -1,6 +1,35 @@
1
1
  import { MfaMethodConfig, MfaMethodContentProps, VerifyMfaMethodComponentProps } from '../types';
2
+ /**
3
+ * Content component for TOTP verification.
4
+ * Renders an OTP form for entering the authenticator code.
5
+ *
6
+ * @param {MfaMethodContentProps} props - The props for the component.
7
+ * @param {boolean} [props.autoFocus] - Whether to auto-focus the input.
8
+ * @param {(error: Error) => void} [props.onError] - The callback to call when verification errors.
9
+ * @param {(mfaCode: string) => void} [props.onSuccess] - The callback to call when verification is successful.
10
+ * @param {(props: { step: VerifyMfaState["step"]; Content: ReactNode }) => ReactNode} [props.children] - Optional render prop for custom rendering.
11
+ * @returns {JSX.Element} The rendered component.
12
+ */
2
13
  export declare const TotpContent: ({ autoFocus, onError, onSuccess, children, }: MfaMethodContentProps) => import("react/jsx-runtime").JSX.Element;
14
+ /**
15
+ * Title component for TOTP verification.
16
+ *
17
+ * @param {VerifyMfaMethodComponentProps} _props - The props for the component.
18
+ * @returns {JSX.Element} The rendered component.
19
+ */
3
20
  export declare const TotpTitle: (_props: VerifyMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element;
21
+ /**
22
+ * Image component for TOTP verification.
23
+ *
24
+ * @param {VerifyMfaMethodComponentProps} _props - The props for the component.
25
+ * @returns {JSX.Element} The rendered component.
26
+ */
4
27
  export declare const TotpImage: (_props: VerifyMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element;
28
+ /**
29
+ * Description component for TOTP verification.
30
+ *
31
+ * @param {VerifyMfaMethodComponentProps} _props - The props for the component.
32
+ * @returns {JSX.Element} The rendered component.
33
+ */
5
34
  export declare const TotpDescription: (_props: VerifyMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element;
6
35
  export declare const totpMethodConfig: MfaMethodConfig;
@@ -2,21 +2,43 @@ import { APIError } from '@coinbase/cdp-hooks';
2
2
  import { FC, ReactNode } from 'react';
3
3
  import { MfaMethod } from '../EnrollMfa/types';
4
4
  export { type MfaMethod };
5
+ /**
6
+ * The steps in the MFA verification flow.
7
+ */
5
8
  export type VerifyMfaStep = "verification" | "list";
9
+ /**
10
+ * Props for the VerifyMfaTitle and VerifyMfaDescription components.
11
+ */
6
12
  export interface VerifyMfaMethodComponentProps {
13
+ /** The MFA method to render the title/description for. */
7
14
  method?: MfaMethod;
15
+ /** If set, will render for this step regardless of context value. */
8
16
  step?: VerifyMfaStep;
9
17
  }
18
+ /**
19
+ * The state of the VerifyMfa component.
20
+ */
10
21
  export interface VerifyMfaState {
22
+ /** The currently selected MFA method. */
11
23
  method: MfaMethod;
24
+ /** The available MFA methods for verification (from user's enrolled methods). */
12
25
  methods: MfaMethod[];
26
+ /** The current step of the verification flow. */
13
27
  step: VerifyMfaStep;
28
+ /** The direction of the flow transition. */
14
29
  flowDirection: "left" | "right";
30
+ /** The MFA code entered by the user. */
15
31
  mfaCode: string;
32
+ /** Error message or APIError object. */
16
33
  error: string | APIError | null;
34
+ /** Whether a verification request is pending. */
17
35
  isPending: boolean;
36
+ /** Whether the verification was successful. */
18
37
  isSuccess: boolean;
19
38
  }
39
+ /**
40
+ * The actions that can be performed on the VerifyMfa state.
41
+ */
20
42
  export type VerifyMfaAction = {
21
43
  type: "SET_STEP";
22
44
  payload: {
@@ -61,6 +83,9 @@ export type VerifyMfaAction = {
61
83
  } | {
62
84
  type: "RESET_STATE";
63
85
  };
86
+ /**
87
+ * Shared props for an MFA method content component.
88
+ */
64
89
  export interface MfaMethodContentProps {
65
90
  step: VerifyMfaState["step"];
66
91
  autoFocus?: boolean;
@@ -71,9 +96,17 @@ export interface MfaMethodContentProps {
71
96
  Content: ReactNode;
72
97
  }) => ReactNode;
73
98
  }
99
+ /**
100
+ * The configuration for an MFA verification method.
101
+ * Each method has its own title, description, and content components.
102
+ */
74
103
  export interface MfaMethodConfig {
104
+ /** The main content component for this method (e.g., OTPForm, PasskeyUI). */
75
105
  content: FC<MfaMethodContentProps>;
106
+ /** The description component for this method. */
76
107
  description: FC<VerifyMfaMethodComponentProps>;
108
+ /** The image component for this method. */
77
109
  image: FC<VerifyMfaMethodComponentProps>;
110
+ /** The title component for this method. */
78
111
  title: FC<VerifyMfaMethodComponentProps>;
79
112
  }
@@ -1,3 +1,10 @@
1
1
  import { VerifyMfaAction, VerifyMfaState, VerifyMfaStep } from './types';
2
2
  export declare const STEPS: readonly VerifyMfaStep[];
3
+ /**
4
+ * A reducer hook for the VerifyMfa component.
5
+ *
6
+ * @param initialState - The initial state of the component.
7
+ *
8
+ * @returns The current state and dispatcher to perform actions on the state.
9
+ */
3
10
  export declare const useVerifyMfaReducer: (initialState: VerifyMfaState) => [VerifyMfaState, import('react').ActionDispatch<[action: VerifyMfaAction]>];