@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
@@ -2,13 +2,26 @@ import { ElementType, HTMLAttributes, Key, ReactNode, Ref } from 'react';
2
2
  import { TransitionMapOptions, TransitionMapResult } from '../../../hooks/useTransitionMap';
3
3
  import { TransitionState } from '../../../utils/transition';
4
4
  export { type TransitionMapOptions, type TransitionMapResult, type TransitionState };
5
+ /**
6
+ * TransitionRef type for the SwitchTransition component.
7
+ */
5
8
  export interface SwitchTransitionRef<T extends Key> {
9
+ /** The transition result. */
6
10
  transition: TransitionMapResult<T>;
7
11
  }
12
+ /**
13
+ * Props for the SwitchTransition component.
14
+ *
15
+ * @template T - The type of the key for the transition.
16
+ */
8
17
  export interface SwitchTransitionProps<T extends Key> extends Omit<HTMLAttributes<HTMLElement>, "children" | "autoFocus">, TransitionMapOptions<T> {
18
+ /** Whether to animate the height of the component. */
9
19
  animateHeight?: boolean;
20
+ /** Whether to auto focus on transition change. If a string is provided, it will be used as the selector for the focusable element. */
10
21
  autoFocus?: boolean | string;
22
+ /** The component or element to render. */
11
23
  as?: ElementType;
24
+ /** The children to transition between. */
12
25
  children: (props: {
13
26
  "data-index": number;
14
27
  inert?: boolean;
@@ -19,9 +32,38 @@ export interface SwitchTransitionProps<T extends Key> extends Omit<HTMLAttribute
19
32
  "data-is-resolved": TransitionState["isResolved"] | undefined;
20
33
  "data-parent": string;
21
34
  }) => ReactNode;
35
+ /** The class name to apply to the component. */
22
36
  className?: string;
37
+ /** Item keys to transition between. */
23
38
  items: readonly T[] | T[];
39
+ /** The name of the transition. Use one of the defined values to use a pre-defined transition, or a custom string to use a custom transition. */
24
40
  transitionName: "fade" | "slide-left" | "slide-right" | string;
41
+ /** A ref to provide access to the transition result. */
25
42
  transitionRef?: Ref<SwitchTransitionRef<T>>;
26
43
  }
44
+ /**
45
+ * A component that transitions between two children.
46
+ *
47
+ * @param {object} props - The props for the component.
48
+ * @param {TransitionMapOptions["allowMultiple"]} props.allowMultiple - Allow multiple items to be in the 'entered' state at the same time.
49
+ * @param {boolean} props.animateHeight - Whether to animate the height of the component.
50
+ * @param {boolean} props.autoFocus - Whether to auto focus the first focusable child on transition change.
51
+ * @param {ElementType} props.as - The component to render.
52
+ * @param {(props: { key: T } & Partial<TransitionState>) => ReactNode} props.children - A render function for each child. A child will be rednered for each item in the `items` prop, which will be passed to the render function as the `key` prop. The TransitionState (status, isMounted, isEnter, isResolved) will also be passed to the render function as data-attributes.
53
+ * @param {string} props.className - The class name to apply to the component.
54
+ * @param {T[]} props.items - Item keys to transition between.
55
+ * @param {TransitionMapOptions["enter"]} props.enter - Enable or disable enter phase transitions.
56
+ * @param {TransitionMapOptions["exit"]} props.exit - Enable or disable exit phase transition.
57
+ * @param {TransitionMapOptions["initialEntered"]} props.initialEntered - Beginning from 'entered' state.
58
+ * @param {TransitionMapOptions["mountOnEnter"]} props.mountOnEnter - State will be 'unmounted' until hit enter phase for the first time. It allows you to create lazily mounted component.
59
+ * @param {TransitionMapOptions["onStateChange"]} props.onStateChange - A callback function that is called when the state of the transition changes.
60
+ * @param {TransitionMapOptions["preEnter"]} props.preEnter - Add a 'preEnter' state immediately before 'entering', which is necessary to change DOM elements from unmounted or display: none with CSS transition (not necessary for CSS animation).
61
+ * @param {TransitionMapOptions["preExit"]} props.preExit - Add a 'preExit' state immediately before 'exiting'.
62
+ * @param {TransitionMapOptions["timeout"]} props.timeout - Set timeout in ms for transitions; you can set a single value or different values for enter and exit transitions.
63
+ * @param {TransitionMapOptions["unmountOnExit"]} props.unmountOnExit - State will become 'unmounted' after 'exiting' finishes. It allows you to transition component out of DOM.
64
+ * @param {"fade" | "slide-left" | "slide-right" | string} props.transitionName - The name of the transition. Use one of the defined values to use a pre-defined transition, or a custom string to use a custom transition.
65
+ * @param {Ref<TransitionMapResult<T>>} props.transitionRef - A ref to provide access to the transition result.
66
+ * @param {CSSProperties} props.style - Styles to apply to the component.
67
+ * @returns {JSX.Element} The component.
68
+ */
27
69
  export declare const SwitchTransition: <T extends Key>({ allowMultiple, animateHeight, autoFocus, initialEntered, as: Component, children, className, enter, exit, items, mountOnEnter, onStateChange, preEnter, preExit, style, timeout, transitionName, transitionRef, unmountOnExit, ...props }: SwitchTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -1,15 +1,46 @@
1
1
  import { MouseEventHandler, ReactNode } from 'react';
2
+ /**
3
+ * The props for the ToggleListItem component.
4
+ */
2
5
  interface ToggleListItemProps {
6
+ /** An icon to display */
3
7
  icon?: ReactNode;
8
+ /** A label for the item */
4
9
  label: ReactNode;
10
+ /** Whether the item is in the active/enabled state */
5
11
  isActive?: boolean;
12
+ /** Whether the action button is pending */
6
13
  isPending?: boolean;
14
+ /** Whether the action button is disabled */
7
15
  isDisabled?: boolean;
16
+ /** A function to call when the activate button is clicked */
8
17
  onActivate?: MouseEventHandler<HTMLButtonElement>;
18
+ /** A function to call when the deactivate button is clicked */
9
19
  onDeactivate?: MouseEventHandler<HTMLButtonElement>;
20
+ /** Accessibility label for the activate button. Defaults to "Activate {label}" */
10
21
  activateAriaLabel?: string;
22
+ /** Accessibility label for the deactivate button. Defaults to "Deactivate {label}" */
11
23
  deactivateAriaLabel?: string;
24
+ /** The size of the list item. Defaults to "md" */
12
25
  size?: "md" | "sm";
13
26
  }
27
+ /**
28
+ * A component for displaying a list item with an activate/deactivate toggle button.
29
+ * Shows a plus icon when inactive, minus icon when active.
30
+ *
31
+ * @param {ToggleListItemProps} props - The props for the ToggleListItem component.
32
+ * @returns {JSX.Element} The ToggleListItem component.
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * <ToggleListItem
37
+ * icon={<IconEmail />}
38
+ * label="Email"
39
+ * isActive={isLinked}
40
+ * onActivate={handleLink}
41
+ * onDeactivate={handleUnlink}
42
+ * />
43
+ * ```
44
+ */
14
45
  export declare const ToggleListItem: ({ icon, label, isActive, isPending, isDisabled, onActivate, onDeactivate, activateAriaLabel, deactivateAriaLabel, size, }: ToggleListItemProps) => import("react/jsx-runtime").JSX.Element;
15
46
  export type { ToggleListItemProps };
@@ -3,5 +3,23 @@ interface VisuallyHiddenProps {
3
3
  as?: ElementType;
4
4
  children?: ReactNode;
5
5
  }
6
+ /**
7
+ * Visually hidden component.
8
+ * Used to expose content to screen readers only.
9
+ *
10
+ * @param {VisuallyHiddenProps} props - The props for the component.
11
+ * @param {ElementType} [props.as] - The component to render. Note it must not have a Fragment as the root element. Defaults to "span".
12
+ * @param {ReactNode} [props.children] - The children of the component.
13
+ * @returns {JSX.Element} A visually hidden component.
14
+ *
15
+ * @example
16
+ * ```tsx lines
17
+ * // provide screen-reader accessible text for an abbreviation
18
+ * <p>
19
+ * <span aria-hidden="true">30s</span>
20
+ * <VisuallyHidden>30 seconds</VisuallyHidden>
21
+ * </p>
22
+ * ```
23
+ */
6
24
  export declare const VisuallyHidden: ({ as: Component, children }: VisuallyHiddenProps) => import("react/jsx-runtime").JSX.Element | null;
7
25
  export {};
@@ -1,12 +1,27 @@
1
1
  import { CountryCallingCode, CountryCode as ICountryCode } from 'libphonenumber-js';
2
+ /**
3
+ * Re-export the type for the country code.
4
+ */
2
5
  export type CountryCode = ICountryCode;
6
+ /**
7
+ * A country option for the country code select list.
8
+ */
3
9
  export type CountryOption = {
4
10
  callingCode: CountryCallingCode;
5
11
  code: CountryCode;
6
12
  flag: string;
7
13
  name: string;
8
14
  };
15
+ /**
16
+ * These contries are completely removed from the phone dropdown
17
+ */
9
18
  export declare const OFAC_BLOCKED_COUNTRIES: string[];
10
19
  export declare const DEFAULT_COUNTRY_CODE: CountryCode;
20
+ /**
21
+ * Returns the country calling code for a given country code.
22
+ *
23
+ * @param countryCode - The country code to get the calling code for.
24
+ * @returns The country calling code for the given country code.
25
+ */
11
26
  export declare const nonThrowingGetCountryCallingCode: (countryCode: CountryCode) => CountryCallingCode | undefined;
12
27
  export declare const countries: CountryOption[];
@@ -1 +1,5 @@
1
+ /**
2
+ * This file was copied from @cbhq/two-factor-register (/data/countryNames.ts)
3
+ * and currently only contains the country name for the US
4
+ */
1
5
  export declare const countryNames: Record<string, string>;
@@ -1,18 +1,43 @@
1
1
  import { RefObject } from 'react';
2
2
  import { SecureIframeChainType, SecureIframeKeyExportIncomingMessage, SecureIframeStatus, IframeTheme } from '../types/secureIframe';
3
+ /**
4
+ * The props for the useKeyExportPostMessage hook.
5
+ */
3
6
  export interface UseKeyExportPostMessageProps {
7
+ /** The address of the account to export. */
4
8
  address: string;
9
+ /** The type of account to export. */
5
10
  type: SecureIframeChainType;
11
+ /** The base path of the secure iframe. */
6
12
  basePath?: string;
13
+ /** The project ID. */
7
14
  projectId: string;
15
+ /** The label of the button. */
8
16
  label?: string;
17
+ /** The label to display on copy success. */
9
18
  copiedLabel?: string;
19
+ /** Whether to show an icon in the button. */
10
20
  icon: boolean;
21
+ /** The ref to the iframe. */
11
22
  iframeRef: RefObject<HTMLIFrameElement | null>;
23
+ /** The function to call when the status is updated. */
12
24
  onStatusUpdate?: (status: SecureIframeStatus, message?: string) => void;
25
+ /** The theme to use for the iframe. */
13
26
  theme?: IframeTheme;
14
27
  }
28
+ /**
29
+ * Sends a message to the secure iframe.
30
+ *
31
+ * @param el - The iframe element to send the message to.
32
+ * @param message - The message to send to the iframe.
33
+ */
15
34
  export declare const sendKeyExportMessage: (el: HTMLIFrameElement | null, message: SecureIframeKeyExportIncomingMessage) => void;
35
+ /**
36
+ * The hook to use the key export post message.
37
+ *
38
+ * @param {UseKeyExportPostMessageProps} props - The props for the useKeyExportPostMessage hook.
39
+ * @returns The iframe url and the onLoad function.
40
+ */
16
41
  export declare const useKeyExportPostMessage: ({ address, basePath, copiedLabel, icon, iframeRef, label, onStatusUpdate, projectId, theme, type, }: UseKeyExportPostMessageProps) => {
17
42
  iframeUrl: string;
18
43
  isPending: boolean;
@@ -1,15 +1,62 @@
1
1
  import { CountryCode } from 'libphonenumber-js';
2
2
  import { PhoneNumber } from '../utils/parseValuesFromPhoneNumber';
3
+ /**
4
+ * Options for the usePhoneNumberState hook.
5
+ */
3
6
  export interface UsePhoneNumberStateOptions {
7
+ /** The initial E.164 phone number string. */
4
8
  phoneNumber?: string;
9
+ /** The initial country code. Defaults to "US". */
5
10
  countryCode?: CountryCode;
11
+ /** Callback when the E.164 phone number changes. */
6
12
  onPhoneNumberChange?: (e164: string) => void;
13
+ /** Callback when the country code changes. */
7
14
  onCountryCodeChange?: (countryCode: CountryCode) => void;
8
15
  }
16
+ /**
17
+ * Return value from the usePhoneNumberState hook.
18
+ */
9
19
  export interface UsePhoneNumberStateResult {
20
+ /** The phone number object with value and e164 fields. */
10
21
  phoneNumberObject: PhoneNumber;
22
+ /** The current country code. */
11
23
  countryCode: CountryCode;
24
+ /** Handler for PhoneNumberInput/PhoneNumberForm onPhoneNumberChange prop. */
12
25
  handlePhoneNumberChange: (pn: PhoneNumber) => void;
26
+ /** Handler for PhoneNumberInput/PhoneNumberForm onCountryCodeChange prop. */
13
27
  handleCountryCodeChange: (countryCode: CountryCode) => void;
14
28
  }
29
+ /**
30
+ * A hook for managing phone number state with conversion between E.164 string
31
+ * and PhoneNumber object formats.
32
+ *
33
+ * This hook handles the bidirectional sync between:
34
+ * - An E.164 formatted string (used for API calls)
35
+ * - A PhoneNumber object with value/e164 fields (used by PhoneNumberInput/PhoneNumberForm)
36
+ *
37
+ * @param options - Configuration options for the hook.
38
+ * @param options.phoneNumber - The initial phone number.
39
+ * @param options.countryCode - The initial country code. Defaults to "US".
40
+ * @param options.onPhoneNumberChange - Callback when the phone number changes.
41
+ * @param options.onCountryCodeChange - Callback when the country code changes.
42
+ * @returns Phone number state and handlers for use with PhoneNumberInput/PhoneNumberForm.
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * const { phoneNumberObject, countryCode, handlePhoneNumberChange, handleCountryCodeChange } =
47
+ * usePhoneNumberState({
48
+ * phoneNumber: state.phoneNumber,
49
+ * onPhoneNumberChange: (e164) => dispatch({ type: "SET_PHONE_NUMBER", payload: { phoneNumber: e164 } }),
50
+ * });
51
+ *
52
+ * <PhoneNumberForm
53
+ * phoneNumber={phoneNumberObject}
54
+ * countryCode={countryCode}
55
+ * onPhoneNumberChange={handlePhoneNumberChange}
56
+ * onCountryCodeChange={handleCountryCodeChange}
57
+ * />
58
+ * ```
59
+ *
60
+ * @group Hooks
61
+ */
15
62
  export declare const usePhoneNumberState: ({ phoneNumber, countryCode: initialCountryCode, onPhoneNumberChange, onCountryCodeChange, }?: UsePhoneNumberStateOptions) => UsePhoneNumberStateResult;
@@ -3,6 +3,14 @@ import { CountryCode } from '../data/countries';
3
3
  interface UsePhoneNumberValidatorsProps {
4
4
  countryCode?: CountryCode;
5
5
  }
6
+ /**
7
+ * A hook that returns a set of phone number validation functions.
8
+ *
9
+ * @param {UsePhoneNumberValidatorsProps} props - The props for the hook.
10
+ * @param {UsePhoneNumberValidatorsProps["error"]} [props.error] - The error message or API error.
11
+ * @param {UsePhoneNumberValidatorsProps["countryCode"]} [props.countryCode] - The country code to use for validation. Defaults to "US".
12
+ * @returns {object} An object containing the validation functions.
13
+ */
6
14
  export declare const usePhoneNumberValidators: ({ countryCode }: UsePhoneNumberValidatorsProps) => {
7
15
  isInvalidCountry: (v: string) => boolean;
8
16
  isInvalidLength: (v: string) => boolean;
@@ -1,3 +1,21 @@
1
+ /**
2
+ * A hook that returns a `schedule` function for delayed callbacks with automatic cleanup.
3
+ *
4
+ * Calling `schedule` cancels any previously pending timeout. The timeout is
5
+ * automatically cancelled when the component unmounts, preventing state updates
6
+ * on unmounted components.
7
+ *
8
+ * @returns An object with `schedule` and `cancel` functions.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * const { schedule } = useTimeout();
13
+ *
14
+ * const handleSuccess = () => {
15
+ * schedule(() => resetView(), 800);
16
+ * };
17
+ * ```
18
+ */
1
19
  export declare const useTimeout: () => {
2
20
  schedule: (callback: () => void, delay: number) => void;
3
21
  cancel: () => void;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * A countdown timer hook.
3
+ * It uses timestamp comparisons to remain accurate despite browser throttling or event loop delays.
4
+ *
5
+ * @returns {object} An object containing the current time left, a function to start the timer, and a function to reset the timer.
6
+ */
1
7
  export declare const useTimer: () => {
2
8
  timeRemaining: number | null;
3
9
  start: (durationSeconds: number) => void;
@@ -1,4 +1,7 @@
1
1
  import { TransitionState } from '../utils/transition';
2
+ /**
3
+ * The options for a transition.
4
+ */
2
5
  export interface TransitionOptions {
3
6
  initialEntered?: boolean;
4
7
  mountOnEnter?: boolean;
@@ -15,9 +18,15 @@ export interface TransitionOptions {
15
18
  current: TransitionState;
16
19
  }) => void;
17
20
  }
21
+ /**
22
+ * The options for a transition item.
23
+ */
18
24
  export interface TransitionItemOptions {
19
25
  initialEntered?: boolean;
20
26
  }
27
+ /**
28
+ * The options for a transition map.
29
+ */
21
30
  export interface TransitionMapOptions<K> extends Omit<TransitionOptions, "onStateChange"> {
22
31
  allowMultiple?: boolean;
23
32
  onStateChange?: (event: {
@@ -25,6 +34,9 @@ export interface TransitionMapOptions<K> extends Omit<TransitionOptions, "onStat
25
34
  current: TransitionState;
26
35
  }) => void;
27
36
  }
37
+ /**
38
+ * The result of a transition map.
39
+ */
28
40
  export interface TransitionMapResult<K> {
29
41
  stateMap: ReadonlyMap<K, TransitionState>;
30
42
  toggle: (key: K, toEnter?: boolean) => void;
@@ -33,6 +45,16 @@ export interface TransitionMapResult<K> {
33
45
  setItem: (key: K, options?: TransitionItemOptions) => void;
34
46
  deleteItem: (key: K) => boolean;
35
47
  }
48
+ /**
49
+ * The useTransitionMap hook is a hook that provides a transition state map.
50
+ *
51
+ * @param {TransitionMapOptions<K>} options - The options for the transition map.
52
+ * @returns {TransitionMapResult<K>} - The result of the transition map.
53
+ *
54
+ * @see {@link SwitchTransition}
55
+ *
56
+ * @group Hooks
57
+ */
36
58
  declare const useTransitionMap: <K>(options?: TransitionMapOptions<K>) => {
37
59
  stateMap: Map<K, Readonly<{
38
60
  _s: number;
@@ -1,22 +1,100 @@
1
1
  import { ReactNode, RefObject } from 'react';
2
2
  import { VerifyMfaModalProps } from '../components/VerifyMfaModal';
3
+ /**
4
+ * Options for the useVerifyMfaModal hook.
5
+ */
3
6
  export interface UseVerifyMfaModalOptions extends Pick<VerifyMfaModalProps, "onCancel" | "onError" | "onSuccess"> {
7
+ /**
8
+ * The delay in milliseconds before the modal is closed after successful verification.
9
+ * If `null`, the modal will not close automatically after success.
10
+ * If `0`, the modal closes immediately.
11
+ * Defaults to 500ms.
12
+ *
13
+ * @default 500
14
+ */
4
15
  closeOnSuccessDelay?: number | null;
5
16
  }
17
+ /**
18
+ * Return value of the useVerifyMfaModal hook.
19
+ */
6
20
  export interface UseVerifyMfaModalReturn {
21
+ /** Opens the MFA verification modal. Returns true if opened, false if a modal is already open. */
7
22
  open: () => boolean;
23
+ /** Closes the MFA verification modal */
8
24
  close: () => void;
9
25
  }
10
26
  interface VerifyMfaModalContextValue {
27
+ /** Registers a modal instance with its options ref */
11
28
  register: (id: string, optionsRef: RefObject<UseVerifyMfaModalOptions>) => void;
29
+ /** Unregisters a modal instance */
12
30
  unregister: (id: string) => void;
31
+ /** Opens the modal for a specific instance. Returns true if opened, false if already open. */
13
32
  open: (id: string) => boolean;
33
+ /** Closes the currently open modal */
14
34
  close: () => void;
15
35
  }
16
36
  interface MfaVerificationProviderProps {
17
37
  children: ReactNode;
18
38
  }
39
+ /**
40
+ * Provider component that manages MFA verification UI coordination.
41
+ *
42
+ * This provider:
43
+ * - Enables the `useVerifyMfaModal` hook for programmatic modal control
44
+ * - Registers a global MFA handler that respects the `mfa.disableAutoPrompt` config
45
+ * - Supports multiple CDPReactProvider instances on the same page
46
+ *
47
+ * This is automatically included in `CDPReactProvider`.
48
+ *
49
+ * @param {MfaVerificationProviderProps} props - The props for the MfaVerificationProvider component.
50
+ * @param {ReactNode} props.children - The children of the MfaVerificationProvider component.
51
+ * @returns {JSX.Element} The MfaVerificationProvider component.
52
+ * @internal
53
+ */
19
54
  export declare const VerifyMfaModalProvider: ({ children }: MfaVerificationProviderProps) => import("react/jsx-runtime").JSX.Element;
55
+ /**
56
+ * Hook to imperatively control the MFA verification modal.
57
+ *
58
+ * This hook allows you to open and close the MFA verification modal programmatically,
59
+ * which is useful for integrating MFA verification into complex flows without using
60
+ * the `<VerifyMfaModal />` component pattern.
61
+ *
62
+ * @param {UseVerifyMfaModalOptions} options - The options for the hook including callbacks.
63
+ * @returns {UseVerifyMfaModalReturn} An object containing `open` and `close` functions.
64
+ *
65
+ * @group Hooks
66
+ *
67
+ * @example
68
+ * ```tsx lines
69
+ * function ProtectedAction() {
70
+ * const { open } = useVerifyMfaModal({
71
+ * onSuccess: () => performSensitiveAction(),
72
+ * onError: (error) => console.error("MFA verification failed:", error),
73
+ * onCancel: () => console.log("MFA verification cancelled"),
74
+ * });
75
+ *
76
+ * const handleClick = () => {
77
+ * const opened = open(); // Returns false if modal is already open
78
+ * if (!opened) {
79
+ * console.log("MFA modal is already open");
80
+ * }
81
+ * };
82
+ *
83
+ * return (
84
+ * <button onClick={handleClick}>
85
+ * Perform sensitive action
86
+ * </button>
87
+ * );
88
+ * }
89
+ * ```
90
+ */
20
91
  export declare const useVerifyMfaModal: (options?: UseVerifyMfaModalOptions) => UseVerifyMfaModalReturn;
92
+ /**
93
+ * Hook to access the MFA verification context for coordination.
94
+ * Used internally by MfaFlow to coordinate with the global modal.
95
+ *
96
+ * @returns The MFA verification context value with default values if not in a provider.
97
+ * @internal
98
+ */
21
99
  export declare const useMfaVerification: () => VerifyMfaModalContextValue;
22
100
  export {};
@@ -1,2 +1,24 @@
1
1
  import { SVGProps } from 'react';
2
+ /**
3
+ * Apple logo icon component.
4
+ *
5
+ * @param {SVGProps<SVGSVGElement>} props - The props for the icon.
6
+ * @returns {JSX.Element} The Apple logo icon.
7
+ *
8
+ * @group Components
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * // Icon is correctly hidden from screen readers
13
+ * <p>
14
+ * <IconAppleLogo />
15
+ * Apple
16
+ * </p>
17
+ *
18
+ * // Icon with screen-reader accessible label only
19
+ * <p>
20
+ * <IconAppleLogo aria-label="Apple" />
21
+ * </p>
22
+ * ```
23
+ */
2
24
  export declare const IconAppleLogo: (props: Omit<SVGProps<SVGSVGElement>, "viewBox">) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,24 @@
1
1
  import { SVGProps } from 'react';
2
+ /**
3
+ * Arrow Left icon component.
4
+ *
5
+ * @param {SVGProps<SVGSVGElement>} props - The props for the icon.
6
+ * @returns {JSX.Element} The Arrow Left icon.
7
+ *
8
+ * @group Components
9
+ *
10
+ * @example
11
+ * ```tsx lines
12
+ * // Icon is correctly hidden from screen readers
13
+ * <p>
14
+ * <IconArrowLeft />
15
+ * Back
16
+ * </p>
17
+ *
18
+ * // Icon with screen-reader accessible label only
19
+ * <p>
20
+ * <IconArrowLeft aria-label="Back" />
21
+ * </p>
22
+ * ```
23
+ */
2
24
  export declare const IconArrowLeft: (props: Omit<SVGProps<SVGSVGElement>, "viewBox">) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,24 @@
1
1
  import { SVGProps } from 'react';
2
+ /**
3
+ * Arrows Up/Down icon component.
4
+ *
5
+ * @param {SVGProps<SVGSVGElement>} props - The props for the icon.
6
+ * @returns {JSX.Element} The Arrow Left icon.
7
+ *
8
+ * @group Components
9
+ *
10
+ * @example
11
+ * ```tsx lines
12
+ * // Icon is correctly hidden from screen readers
13
+ * <p>
14
+ * <IconArrowsUpDown />
15
+ * Swap
16
+ * </p>
17
+ *
18
+ * // Icon with screen-reader accessible label only
19
+ * <p>
20
+ * <IconArrowsUpDown aria-label="Swap" />
21
+ * </p>
22
+ * ```
23
+ */
2
24
  export declare const IconArrowsUpDown: (props: Omit<SVGProps<SVGSVGElement>, "viewBox">) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,24 @@
1
1
  import { SVGProps } from 'react';
2
+ /**
3
+ * Check Circle icon component.
4
+ *
5
+ * @param {SVGProps<SVGSVGElement>} props - The props for the icon.
6
+ * @returns {JSX.Element} The Check Circle icon.
7
+ *
8
+ * @group Components
9
+ *
10
+ * @example
11
+ * ```tsx lines
12
+ * // Icon is correctly from screen readers
13
+ * <p>
14
+ * <IconCheck />
15
+ * Success!
16
+ * </p>
17
+ *
18
+ * // Icon with screen-reader accessible label only
19
+ * <p>
20
+ * <IconCheck aria-label="Success" />
21
+ * </p>
22
+ * ```
23
+ */
2
24
  export declare const IconCheck: (props: Omit<SVGProps<SVGSVGElement>, "viewBox">) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,23 @@
1
1
  import { SVGProps } from 'react';
2
+ /**
3
+ * Check Circle icon component.
4
+ *
5
+ * @param {SVGProps<SVGSVGElement>} props - The props for the icon.
6
+ * @returns {JSX.Element} The Check Circle icon.
7
+ *
8
+ * @group Components
9
+ * @example
10
+ * ```tsx lines
11
+ * // Icon is correctly from screen readers
12
+ * <p>
13
+ * <IconCheckCircle />
14
+ * Success!
15
+ * </p>
16
+ *
17
+ * // Icon with screen-reader accessible label only
18
+ * <p>
19
+ * <IconCheckCircle aria-label="Success" />
20
+ * </p>
21
+ * ```
22
+ */
2
23
  export declare const IconCheckCircle: (props: Omit<SVGProps<SVGSVGElement>, "viewBox">) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,24 @@
1
1
  import { SVGProps } from 'react';
2
+ /**
3
+ * Chevron down icon component.
4
+ *
5
+ * @param {SVGProps<SVGSVGElement>} props - The props for the icon.
6
+ * @returns {JSX.Element} The chevron down icon.
7
+ *
8
+ * @group Components
9
+ *
10
+ * @example
11
+ * ```tsx lines
12
+ * // Icon is correctly hidden from screen readers
13
+ * <p>
14
+ * <IconChevronDown />
15
+ * Expand
16
+ * </p>
17
+ *
18
+ * // Icon with screen-reader accessible label only
19
+ * <p>
20
+ * <IconChevronDown aria-label="Expand" />
21
+ * </p>
22
+ * ```
23
+ */
2
24
  export declare const IconChevronDown: (props: Omit<SVGProps<SVGSVGElement>, "viewBox">) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,24 @@
1
1
  import { SVGProps } from 'react';
2
+ /**
3
+ * Coinbase mark icon component.
4
+ *
5
+ * @param {SVGProps<SVGSVGElement>} props - The props for the icon.
6
+ * @returns {JSX.Element} The Coinbase mark icon.
7
+ *
8
+ * @group Components
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * // Icon is correctly hidden from screen readers
13
+ * <p>
14
+ * <IconCoinbaseMark />
15
+ * Coinbase
16
+ * </p>
17
+ *
18
+ * // Icon with screen-reader accessible label only
19
+ * <p>
20
+ * <IconCoinbaseMark aria-label="Coinbase" />
21
+ * </p>
22
+ * ```
23
+ */
2
24
  export declare const IconCoinbaseMark: (props: Omit<SVGProps<SVGSVGElement>, "viewBox">) => import("react/jsx-runtime").JSX.Element;