@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.
Files changed (198) 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/LinkAuthProvider.d.ts +31 -0
  51. package/dist/components/LinkAuth/LinkAuthTitle.d.ts +17 -0
  52. package/dist/components/LinkAuth/index.d.ts +170 -0
  53. package/dist/components/LinkAuth/types.d.ts +31 -0
  54. package/dist/components/LinkAuth/utils.d.ts +12 -0
  55. package/dist/components/LinkAuthModal/index.d.ts +112 -0
  56. package/dist/components/OAuthStatusModal/index.d.ts +24 -0
  57. package/dist/components/SendEvmTransactionButton/index.d.ts +27 -0
  58. package/dist/components/SendSolanaTransactionButton/index.d.ts +27 -0
  59. package/dist/components/SignIn/SignInAuthMethodButtons.d.ts +26 -0
  60. package/dist/components/SignIn/SignInBackButton.d.ts +40 -0
  61. package/dist/components/SignIn/SignInCredentials.d.ts +13 -0
  62. package/dist/components/SignIn/SignInDescription.d.ts +35 -0
  63. package/dist/components/SignIn/SignInFooter.d.ts +27 -0
  64. package/dist/components/SignIn/SignInForm.d.ts +39 -0
  65. package/dist/components/SignIn/SignInImage.d.ts +38 -0
  66. package/dist/components/SignIn/SignInProvider.d.ts +54 -0
  67. package/dist/components/SignIn/SignInTitle.d.ts +35 -0
  68. package/dist/components/SignIn/flows/SignInWithEmail.d.ts +26 -0
  69. package/dist/components/SignIn/flows/SignInWithOAuth.d.ts +19 -0
  70. package/dist/components/SignIn/flows/SignInWithSms.d.ts +26 -0
  71. package/dist/components/SignIn/hooks/useEmailForm.d.ts +7 -0
  72. package/dist/components/SignIn/hooks/useOTPForm.d.ts +8 -0
  73. package/dist/components/SignIn/hooks/usePhoneNumberForm.d.ts +7 -0
  74. package/dist/components/SignIn/hooks/useSignInWithOAuth.d.ts +8 -0
  75. package/dist/components/SignIn/index.d.ts +124 -0
  76. package/dist/components/SignIn/types.d.ts +37 -0
  77. package/dist/components/SignIn/useSignInReducer.d.ts +9 -0
  78. package/dist/components/SignInModal/index.d.ts +123 -0
  79. package/dist/components/SignOutButton/index.d.ts +39 -0
  80. package/dist/components/ThemeProvider/index.d.ts +70 -0
  81. package/dist/components/VerifyMfa/VerifyMfaDescription.d.ts +24 -0
  82. package/dist/components/VerifyMfa/VerifyMfaFlow.d.ts +30 -0
  83. package/dist/components/VerifyMfa/VerifyMfaFlowBackButton.d.ts +19 -0
  84. package/dist/components/VerifyMfa/VerifyMfaFlowProvider.d.ts +51 -0
  85. package/dist/components/VerifyMfa/VerifyMfaFooter.d.ts +18 -0
  86. package/dist/components/VerifyMfa/VerifyMfaImage.d.ts +23 -0
  87. package/dist/components/VerifyMfa/VerifyMfaItem.d.ts +20 -0
  88. package/dist/components/VerifyMfa/VerifyMfaItems.d.ts +18 -0
  89. package/dist/components/VerifyMfa/VerifyMfaProvider.d.ts +40 -0
  90. package/dist/components/VerifyMfa/VerifyMfaTitle.d.ts +24 -0
  91. package/dist/components/VerifyMfa/index.d.ts +55 -0
  92. package/dist/components/VerifyMfa/methods/sms.d.ts +29 -0
  93. package/dist/components/VerifyMfa/methods/totp.d.ts +29 -0
  94. package/dist/components/VerifyMfa/types.d.ts +33 -0
  95. package/dist/components/VerifyMfa/useVerifyMfaReducer.d.ts +7 -0
  96. package/dist/components/VerifyMfaInline/index.d.ts +212 -0
  97. package/dist/components/VerifyMfaModal/index.d.ts +114 -0
  98. package/dist/components/forms/AmountInput/index.d.ts +16 -0
  99. package/dist/components/forms/AmountInput/types.d.ts +9 -0
  100. package/dist/components/forms/AmountInput/useAmountInput.d.ts +14 -0
  101. package/dist/components/forms/AmountInput/useInputScale.d.ts +12 -0
  102. package/dist/components/forms/AmountInput/useNumberParseAndFormat.d.ts +20 -0
  103. package/dist/components/forms/CountrySelect/index.d.ts +9 -0
  104. package/dist/components/forms/EmailForm/index.d.ts +17 -0
  105. package/dist/components/forms/ExchangeAmountInput/index.d.ts +19 -0
  106. package/dist/components/forms/ExchangeAmountInput/types.d.ts +12 -0
  107. package/dist/components/forms/ExchangeAmountInput/useExchangeAmountInput.d.ts +17 -0
  108. package/dist/components/forms/Field/index.d.ts +15 -0
  109. package/dist/components/forms/Input/index.d.ts +15 -0
  110. package/dist/components/forms/Label/index.d.ts +8 -0
  111. package/dist/components/forms/OTP/index.d.ts +6 -0
  112. package/dist/components/forms/OTPForm/index.d.ts +20 -0
  113. package/dist/components/forms/PhoneNumberForm/index.d.ts +27 -0
  114. package/dist/components/forms/PhoneNumberInput/index.d.ts +16 -0
  115. package/dist/components/forms/PhoneNumberInput/maskOverride.d.ts +6 -0
  116. package/dist/components/forms/PhoneNumberInput/usePhoneNumberFormatter.d.ts +7 -0
  117. package/dist/components/forms/Select/index.d.ts +30 -0
  118. package/dist/components/ui/Badge/index.d.ts +19 -0
  119. package/dist/components/ui/Banner/index.d.ts +25 -0
  120. package/dist/components/ui/Button/index.d.ts +50 -0
  121. package/dist/components/ui/ButtonBase/index.d.ts +20 -0
  122. package/dist/components/ui/CoinbaseFooter/index.d.ts +16 -0
  123. package/dist/components/ui/CopyTextField/index.d.ts +35 -0
  124. package/dist/components/ui/Error/index.d.ts +14 -0
  125. package/dist/components/ui/IframeButton/index.d.ts +17 -0
  126. package/dist/components/ui/LoadingSkeleton/index.d.ts +22 -0
  127. package/dist/components/ui/LoadingSpinner/index.d.ts +11 -0
  128. package/dist/components/ui/Modal/index.d.ts +82 -0
  129. package/dist/components/ui/QRCode/QRCodeSvg.d.ts +35 -0
  130. package/dist/components/ui/QRCode/index.d.ts +7 -0
  131. package/dist/components/ui/QRCode/useCorners.d.ts +9 -0
  132. package/dist/components/ui/QRCode/useDotsPath.d.ts +18 -0
  133. package/dist/components/ui/QRCode/useLogo.d.ts +18 -0
  134. package/dist/components/ui/QRCode/useMatrix.d.ts +7 -0
  135. package/dist/components/ui/ServerError/index.d.ts +6 -0
  136. package/dist/components/ui/SuccessMessage/index.d.ts +14 -0
  137. package/dist/components/ui/SwitchFadeTransition/index.d.ts +15 -0
  138. package/dist/components/ui/SwitchSlideTransition/index.d.ts +16 -0
  139. package/dist/components/ui/SwitchTransition/index.d.ts +42 -0
  140. package/dist/components/ui/ToggleListItem/index.d.ts +31 -0
  141. package/dist/components/ui/VisuallyHidden/index.d.ts +18 -0
  142. package/dist/data/countries.d.ts +15 -0
  143. package/dist/data/countryNames.d.ts +4 -0
  144. package/dist/hooks/useKeyExportPostMessage.d.ts +25 -0
  145. package/dist/hooks/usePhoneNumberState.d.ts +47 -0
  146. package/dist/hooks/usePhoneNumberValidators.d.ts +8 -0
  147. package/dist/hooks/useTimeout.d.ts +18 -0
  148. package/dist/hooks/useTimer.d.ts +6 -0
  149. package/dist/hooks/useTransitionMap.d.ts +22 -0
  150. package/dist/hooks/useVerifyMfaModal.d.ts +78 -0
  151. package/dist/icons/IconAppleLogo.d.ts +22 -0
  152. package/dist/icons/IconArrowLeft.d.ts +22 -0
  153. package/dist/icons/IconArrowsUpDown.d.ts +22 -0
  154. package/dist/icons/IconCheck.d.ts +22 -0
  155. package/dist/icons/IconCheckCircle.d.ts +21 -0
  156. package/dist/icons/IconChevronDown.d.ts +22 -0
  157. package/dist/icons/IconCoinbaseMark.d.ts +22 -0
  158. package/dist/icons/IconCoinbaseWordmark.d.ts +22 -0
  159. package/dist/icons/IconCopy.d.ts +22 -0
  160. package/dist/icons/IconCreditCard.d.ts +22 -0
  161. package/dist/icons/IconCurrencies.d.ts +22 -0
  162. package/dist/icons/IconEnvelope.d.ts +22 -0
  163. package/dist/icons/IconExclamationCircle.d.ts +22 -0
  164. package/dist/icons/IconExclamationTriangle.d.ts +22 -0
  165. package/dist/icons/IconGoogleColorLogo.d.ts +22 -0
  166. package/dist/icons/IconGoogleLogo.d.ts +22 -0
  167. package/dist/icons/IconLock.d.ts +22 -0
  168. package/dist/icons/IconMinus.d.ts +21 -0
  169. package/dist/icons/IconPhone.d.ts +22 -0
  170. package/dist/icons/IconPinCode.d.ts +22 -0
  171. package/dist/icons/IconPlus.d.ts +21 -0
  172. package/dist/icons/IconShield.d.ts +22 -0
  173. package/dist/icons/IconSmartPhone.d.ts +22 -0
  174. package/dist/icons/IconTelegramLogo.d.ts +22 -0
  175. package/dist/icons/IconXLogo.d.ts +22 -0
  176. package/dist/icons/IconXMark.d.ts +22 -0
  177. package/dist/icons/SvgIcon.d.ts +6 -0
  178. package/dist/theme/cssVariables.d.ts +10 -0
  179. package/dist/theme/theme.d.ts +246 -0
  180. package/dist/theme/tokens.d.ts +54 -0
  181. package/dist/theme/utils.d.ts +63 -0
  182. package/dist/types/secureIframe.d.ts +3 -0
  183. package/dist/utils/capitalize.d.ts +8 -0
  184. package/dist/utils/childrenHasComponent.d.ts +10 -0
  185. package/dist/utils/clamp.d.ts +10 -0
  186. package/dist/utils/formatFiat.d.ts +11 -0
  187. package/dist/utils/formatPhoneNumber.d.ts +8 -0
  188. package/dist/utils/getMessageFromUnknownError.d.ts +9 -0
  189. package/dist/utils/isApiError.d.ts +21 -0
  190. package/dist/utils/isEmailInvalid.d.ts +15 -0
  191. package/dist/utils/openPopup.d.ts +15 -0
  192. package/dist/utils/parseValuesFromPhoneNumber.d.ts +16 -0
  193. package/dist/utils/sendIframeMessage.d.ts +8 -0
  194. package/dist/utils/toOAuthProviderType.d.ts +8 -0
  195. package/dist/utils/transition.d.ts +41 -0
  196. package/dist/version.d.ts +5 -1
  197. package/dist/version.js +1 -1
  198. package/package.json +5 -5
@@ -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]>];
@@ -1,40 +1,252 @@
1
1
  import { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
2
2
  import { ButtonSize, ButtonVariant } from '../../theme/theme';
3
+ /**
4
+ * The views of the inline MFA flow.
5
+ *
6
+ * @see {@link VerifyMfaInline}
7
+ */
3
8
  type VerifyMfaInlineView = "verify" | "content";
9
+ /**
10
+ * The direction of the transition animation.
11
+ */
4
12
  type VerifyMfaInlineDirection = "left" | "right";
13
+ /**
14
+ * The context value for the VerifyMfaInline component.
15
+ *
16
+ * @see {@link useVerifyMfaInlineContext}
17
+ */
5
18
  interface VerifyMfaInlineContextValue {
19
+ /** The current view of the inline MFA flow. */
6
20
  view: VerifyMfaInlineView;
21
+ /** A function to go to the verify view. */
7
22
  goToVerify: () => void;
23
+ /** A function to go to the content view. Optionally specify animation direction. */
8
24
  goToContent: (direction?: VerifyMfaInlineDirection) => void;
25
+ /** A function to go back to the previous view. */
9
26
  goBack: () => void;
10
27
  }
28
+ /**
29
+ * A hook to get the VerifyMfaInline context value.
30
+ *
31
+ * @returns {VerifyMfaInlineContextValue} The link auth flow context value.
32
+ *
33
+ * @see {@link VerifyMfaInline}
34
+ *
35
+ * @group Hooks
36
+ */
11
37
  declare const useVerifyMfaInlineContext: () => VerifyMfaInlineContextValue;
38
+ /**
39
+ * Props for the VerifyMfaInline component.
40
+ *
41
+ * @see {@link VerifyMfaInline}
42
+ */
12
43
  interface VerifyMfaInlineProps extends HTMLAttributes<HTMLDivElement> {
44
+ /**
45
+ * The component children. Should include VerifyMfaInlineFlow.
46
+ * Can optionally include VerifyMfaInlineBackButton outside the Flow.
47
+ */
13
48
  children: ReactNode;
49
+ /**
50
+ * If true, forces MFA verification before showing content.
51
+ * Use this when you want users to verify BEFORE seeing the content.
52
+ *
53
+ * If false (default), content is shown first and MFA is triggered
54
+ * automatically when a protected action is called.
55
+ *
56
+ * @default true
57
+ */
14
58
  verifyFirst?: boolean;
59
+ /**
60
+ * Called when MFA verification completes successfully.
61
+ */
15
62
  onVerified?: () => void;
63
+ /**
64
+ * Called when MFA verification is cancelled.
65
+ * If provided, a back/cancel action in the verify view will trigger this
66
+ * and transition back to content.
67
+ */
16
68
  onCancel?: () => void;
69
+ /**
70
+ * The delay in milliseconds before transitioning to content after successful verification.
71
+ * This allows users to see the success state before the transition.
72
+ *
73
+ * @default 500
74
+ */
17
75
  successDelay?: number;
76
+ /**
77
+ * Additional class name for the container.
78
+ */
18
79
  className?: string;
19
80
  }
81
+ /**
82
+ * Props for VerifyMfaInlineFlow component.
83
+ *
84
+ * @see {@link VerifyMfaInlineFlow}
85
+ */
20
86
  interface VerifyMfaInlineFlowProps {
87
+ /**
88
+ * The content to display. Can be:
89
+ * - A ReactNode: Used as the protected content (shown after MFA verification)
90
+ * - A render function: Receives `{ view, Content }` for full control over rendering
91
+ *
92
+ * When using a render function:
93
+ * - `view` is the current view ("verify" or "content")
94
+ * - `Content` is the default UI for that view (MFA form for "verify", null for "content")
95
+ */
21
96
  children: ReactNode | ((props: {
97
+ /** The verify view. */
22
98
  view: "verify";
99
+ /** The default content for for the "verify" view (i.e. the default MFA verification UI). */
23
100
  Content: ReactNode;
24
101
  } | {
102
+ /** The content view. */
25
103
  view: "content";
104
+ /** There is no default content for the "content" view (consumer provides content). */
26
105
  Content: null;
27
106
  }) => ReactNode);
107
+ /**
108
+ * Additional class name for the transition container.
109
+ */
28
110
  className?: string;
111
+ /**
112
+ * Whether to animate the height during transitions.
113
+ *
114
+ * @default true
115
+ */
29
116
  animateHeight?: boolean;
117
+ /**
118
+ * Whether to auto focus forms.
119
+ *
120
+ * @default true
121
+ */
30
122
  autoFocus?: boolean;
123
+ /**
124
+ * The type of transition to use between views.
125
+ * - "slide": Slides content left/right (default)
126
+ * - "fade": Fades content in/out
127
+ *
128
+ * @default "slide"
129
+ */
31
130
  transition?: "slide" | "fade";
32
131
  }
132
+ /**
133
+ * Props for VerifyMfaInlineBackButton component.
134
+ *
135
+ * @see {@link VerifyMfaInlineBackButton}
136
+ */
33
137
  interface VerifyMfaInlineBackButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
138
+ /** The size of the button. */
34
139
  size?: ButtonSize;
140
+ /** The variant of the button. */
35
141
  variant?: ButtonVariant;
36
142
  }
143
+ /**
144
+ * Back button for navigating within the MFA verification flow or back to content.
145
+ *
146
+ * In `verifyFirst` mode, it only renders when the inner MFA flow has back navigation.
147
+ *
148
+ * Otherwise, it renders on the verify view and navigates back to content when the
149
+ * inner MFA flow can't go back.
150
+ *
151
+ * @param {VerifyMfaInlineBackButtonProps} props - The props for the component.
152
+ * @returns The back button, or null when there is nothing to navigate back to.
153
+ *
154
+ * @group Components
155
+ */
37
156
  declare const VerifyMfaInlineBackButton: ({ children, onClick, size, variant, ["aria-label"]: ariaLabel, className, ...props }: VerifyMfaInlineBackButtonProps) => import("react/jsx-runtime").JSX.Element | null;
157
+ /**
158
+ * The transition component for the inline MFA flow.
159
+ * Place this inside VerifyMfaInline, alongside VerifyMfaInlineBackButton if needed.
160
+ *
161
+ * @param props - The props for the VerifyMfaInlineFlow component.
162
+ * @param props.children - The protected content or a render function for full control.
163
+ * @param props.className - Additional class name.
164
+ * @param props.animateHeight - Whether to animate height during transitions.
165
+ * @param props.autoFocus - Whether to auto focus forms.
166
+ * @param props.transition - The type of transition animation ("slide" or "fade").
167
+ * @returns The rendered transition component.
168
+ *
169
+ * @group Components
170
+ *
171
+ * @see {@link VerifyMfaInline}
172
+ */
38
173
  declare const VerifyMfaInlineFlow: ({ children, className, animateHeight, autoFocus, transition, }: VerifyMfaInlineFlowProps) => import("react/jsx-runtime").JSX.Element;
174
+ /**
175
+ * A wrapper component that provides context and coordination for inline MFA verification.
176
+ * Use with VerifyMfaInlineFlow and optionally VerifyMfaInlineBackButton.
177
+ *
178
+ * By default, shows content first and automatically transitions to MFA verification
179
+ * when a protected action (like signing or exporting) is called. After verification,
180
+ * the action completes automatically.
181
+ *
182
+ * Use `verifyFirst` prop to force MFA verification before showing content.
183
+ *
184
+ * @param props - The props for the VerifyMfaInline component.
185
+ * @param props.children - Should include VerifyMfaInlineFlow and optionally VerifyMfaInlineBackButton.
186
+ * @param props.verifyFirst - If true, forces MFA verification before showing content.
187
+ * @param props.onVerified - Called when MFA verification completes.
188
+ * @param props.onCancel - Called when MFA verification is cancelled.
189
+ * @param props.className - Additional class name for the container.
190
+ * @param props.successDelay - The delay in milliseconds before transitioning to content after successful verification.
191
+ * @returns The rendered component.
192
+ *
193
+ * @group Components
194
+ *
195
+ * @document ./README.md
196
+ *
197
+ * @see {@link VerifyMfaInlineBackButton}
198
+ * @see {@link VerifyMfaInlineFlow}
199
+ * @see {@link useVerifyMfaInlineContext}
200
+ *
201
+ * @example
202
+ * ```tsx lines
203
+ * // Simple usage: Just the flow
204
+ * function ExportWalletModal({ address }) {
205
+ * return (
206
+ * <Modal>
207
+ * <VerifyMfaInline verifyFirst>
208
+ * <VerifyMfaInlineFlow>
209
+ * <ExportWallet address={address} skipMfa />
210
+ * </VerifyMfaInlineFlow>
211
+ * </VerifyMfaInline>
212
+ * </Modal>
213
+ * );
214
+ * }
215
+ * ```
216
+ *
217
+ * @example
218
+ * ```tsx lines
219
+ * // With back button outside the transition
220
+ * function CustomModal() {
221
+ * return (
222
+ * <Modal>
223
+ * <VerifyMfaInline>
224
+ * <VerifyMfaInlineBackButton />
225
+ * <VerifyMfaInlineFlow transition="fade">
226
+ * <MyProtectedContent />
227
+ * </VerifyMfaInlineFlow>
228
+ * </VerifyMfaInline>
229
+ * </Modal>
230
+ * );
231
+ * }
232
+ * ```
233
+ *
234
+ * @example
235
+ * ```tsx lines
236
+ * // With render function for full control
237
+ * function AdvancedModal() {
238
+ * return (
239
+ * <VerifyMfaInline verifyFirst>
240
+ * <VerifyMfaInlineBackButton />
241
+ * <VerifyMfaInlineFlow>
242
+ * {({ view, Content }) => (
243
+ * view === "verify" ? <div>{Content}</div> : <MyProtectedContent />
244
+ * )}
245
+ * </VerifyMfaInlineFlow>
246
+ * </VerifyMfaInline>
247
+ * );
248
+ * }
249
+ * ```
250
+ */
39
251
  declare const VerifyMfaInline: ({ children, verifyFirst, onVerified, onCancel, successDelay, className, ...props }: VerifyMfaInlineProps) => import("react/jsx-runtime").JSX.Element;
40
252
  export { VerifyMfaInline, VerifyMfaInlineBackButton, VerifyMfaInlineFlow, useVerifyMfaInlineContext, type VerifyMfaInlineBackButtonProps, type VerifyMfaInlineContextValue, type VerifyMfaInlineDirection, type VerifyMfaInlineFlowProps, type VerifyMfaInlineProps, type VerifyMfaInlineView, };