@funkit/connect 13.1.1 → 13.3.0

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 (117) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/dist/{chunk-53FF4ZHH.js → chunk-SJ7E3DKC.js} +6 -0
  3. package/dist/{chunk-2RND3WWH.js → chunk-V4VFNIG4.js} +6 -0
  4. package/dist/clients/aave.d.ts +1 -1
  5. package/dist/clients/{chunk-44LV4GCX.js → chunk-2INCUCQQ.js} +1 -0
  6. package/dist/clients/chunk-6JL6PF5P.js +22 -0
  7. package/dist/clients/chunk-747THMHY.js +185 -0
  8. package/dist/clients/{chunk-Q4JGDB4L.js → chunk-BMU5EYUJ.js} +8 -24
  9. package/dist/clients/{chunk-T6YNXIOS.js → chunk-HBW7AZUH.js} +7 -5
  10. package/dist/clients/{chunk-ZBBYOJWK.js → chunk-KDZFZETH.js} +176 -0
  11. package/dist/clients/{chunk-D6EY2WW4.js → chunk-PVBHWD47.js} +1 -1
  12. package/dist/clients/chunk-RNTQ7KEL.js +76 -0
  13. package/dist/clients/{chunk-ZEXIDBIZ.js → chunk-RTHDOT5K.js} +1 -1
  14. package/dist/clients/{chunk-AJGDTTRJ.js → chunk-SKYQYPX5.js} +58 -2
  15. package/dist/clients/{chunk-NNMZMHO6.js → chunk-Z6FHIDTD.js} +5 -5
  16. package/dist/clients/fanatics.css +3136 -2947
  17. package/dist/clients/fanatics.js +1 -1
  18. package/dist/clients/internal/nado/withdrawalCallback.js +4 -4
  19. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  20. package/dist/clients/internal/nado/withdrawalForm.js +12 -77
  21. package/dist/clients/internal/nado/withdrawalStatus.css +18233 -0
  22. package/dist/clients/internal/nado/withdrawalStatus.js +218 -20
  23. package/dist/clients/lighter.css +3519 -2947
  24. package/dist/clients/lighter.js +5 -7
  25. package/dist/clients/mallard.d.ts +24 -3
  26. package/dist/clients/mallard.js +7 -3
  27. package/dist/clients/nado.js +4 -4
  28. package/dist/clients/polymarket/createPolymarketDepositConfig.js +4 -3
  29. package/dist/clients/polymarket/index.js +9 -7
  30. package/dist/clients/polymarket/polymarket.js +6 -4
  31. package/dist/components/Box/Box.d.ts +18 -18
  32. package/dist/components/Dropdown/BaseDropdownItem.d.ts +1 -1
  33. package/dist/components/FunAsset/FunAssetItem.d.ts +3 -1
  34. package/dist/components/FunBadge/FunBadge.d.ts +1 -1
  35. package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +2 -3
  36. package/dist/components/FunTransactionSummary/PaymentFeesSummary.track.d.ts +2 -3
  37. package/dist/components/ModalErrorState/ModalErrorState.d.ts +2 -3
  38. package/dist/consts/customers.d.ts +1 -1
  39. package/dist/consts/polymarket.d.ts +1 -1
  40. package/dist/css/sprinkles.css.d.ts +24 -18
  41. package/dist/domains/clientMetadata.d.ts +2 -1
  42. package/dist/domains/convert/hostTimeout.d.ts +1 -1
  43. package/dist/domains/destinationAssetBalance.d.ts +1 -1
  44. package/dist/hooks/queries/useWithdrawalQuote.d.ts +2 -3
  45. package/dist/hooks/statsig/index.d.ts +1 -0
  46. package/dist/hooks/track/analytics/mappers.d.ts +11 -1
  47. package/dist/hooks/track/analytics/swappedErrorCode.d.ts +1 -0
  48. package/dist/hooks/track/analytics/useTrackErrorShown.d.ts +2 -3
  49. package/dist/hooks/useConvertBalances.d.ts +6 -1
  50. package/dist/hooks/useFunkitMaxCheckoutUsdInfo.d.ts +3 -3
  51. package/dist/hooks/useHostDepositSettlement.d.ts +12 -0
  52. package/dist/hooks/useModalStateValueWithProp.d.ts +1 -1
  53. package/dist/hooks/useRefreshBalancesOnDeposit.d.ts +20 -0
  54. package/dist/index.css +3519 -2947
  55. package/dist/index.d.ts +3 -1
  56. package/dist/index.js +6179 -3864
  57. package/dist/interfaces/solanaWallet.d.ts +2 -2
  58. package/dist/modals/CheckoutModal/FiatV2/FiatV2Step.d.ts +19 -0
  59. package/dist/modals/CheckoutModal/FiatV2/fiatV2DepositInputs.d.ts +38 -0
  60. package/dist/modals/CheckoutModal/FiatV2/fiatV2PaymentSelectionEffects.d.ts +26 -0
  61. package/dist/modals/CheckoutModal/FiatV2/useFiatV2DepositInputs.d.ts +6 -0
  62. package/dist/modals/CheckoutModal/FiatV2/useFiatV2PaymentSelectionHost.d.ts +22 -0
  63. package/dist/modals/CheckoutModal/FiatV2/useFiatV2Text.d.ts +7 -0
  64. package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +3 -1
  65. package/dist/modals/CheckoutModal/InputAmount/useCheckoutAmountLimits.d.ts +3 -3
  66. package/dist/modals/CheckoutModal/SourceChange/AddCardItem.d.ts +9 -0
  67. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +5 -0
  68. package/dist/modals/CheckoutModal/SourceChange/fiatV2Reroute.d.ts +24 -0
  69. package/dist/modals/CheckoutModal/SourceChange/useAddCardRow.d.ts +13 -0
  70. package/dist/modals/CheckoutModal/SourceChange/useFiatV2Entry.d.ts +21 -0
  71. package/dist/modals/CheckoutModal/stepTransition.d.ts +3 -0
  72. package/dist/modals/PolymarketPerpsTransfer/TransferActionButton.d.ts +5 -5
  73. package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +2 -3
  74. package/dist/providers/FunSessionContext.d.ts +20 -0
  75. package/dist/providers/FunkitCheckoutContext/index.d.ts +7 -1
  76. package/dist/providers/FunkitCheckoutContext/types.d.ts +30 -0
  77. package/dist/providers/FunkitProvider.d.ts +7 -0
  78. package/dist/providers/FunkitQuoteContext.track.d.ts +2 -3
  79. package/dist/providers/FunkitThemeProvider.d.ts +9 -0
  80. package/dist/shadow-css.js +1 -1
  81. package/dist/themes/darkTheme.js +1 -1
  82. package/dist/themes/lightTheme.js +1 -1
  83. package/dist/utils/checkout.d.ts +2 -2
  84. package/dist/utils/localStorageFunSessionStorage.d.ts +9 -0
  85. package/dist/v2/components/PrimaryButton.css.d.ts +5 -0
  86. package/dist/v2/components/PrimaryButton.d.ts +16 -0
  87. package/dist/v2/components/Sheet.css.d.ts +13 -0
  88. package/dist/v2/components/Sheet.d.ts +23 -0
  89. package/dist/v2/components/Spinner.css.d.ts +2 -0
  90. package/dist/v2/components/Spinner.d.ts +6 -0
  91. package/dist/v2/flows/fiat/FiatDepositGate.d.ts +20 -0
  92. package/dist/v2/flows/fiat/FiatScreenPicker.d.ts +37 -0
  93. package/dist/v2/flows/funLogin/FunLoginScreenPicker.d.ts +30 -0
  94. package/dist/v2/screens/amount/AmountDisplay.css.d.ts +5 -0
  95. package/dist/v2/screens/amount/AmountDisplay.d.ts +15 -0
  96. package/dist/v2/screens/amount/AmountScreen.css.d.ts +2 -0
  97. package/dist/v2/screens/amount/AmountScreen.d.ts +37 -0
  98. package/dist/v2/screens/amount/PresetButton.css.d.ts +1 -0
  99. package/dist/v2/screens/amount/PresetButton.d.ts +9 -0
  100. package/dist/v2/screens/amount/fittedText/useFittedText.d.ts +19 -0
  101. package/dist/v2/screens/amount/fittedText/useIsomorphicEffect.d.ts +2 -0
  102. package/dist/v2/screens/amount/fittedText/useTextMeasurer.d.ts +3 -0
  103. package/dist/v2/screens/amount/typedAmount/amountText.d.ts +37 -0
  104. package/dist/v2/screens/amount/typedAmount/attachInputNormalization.d.ts +1 -0
  105. package/dist/v2/screens/fiat/FiatPlaceholderScreen.d.ts +9 -0
  106. package/dist/v2/screens/funLogin/FunLoginCodeScreen.d.ts +35 -0
  107. package/dist/v2/screens/funLogin/FunLoginEmailScreen.d.ts +26 -0
  108. package/dist/v2/screens/funLogin/FunLoginScreen.css.d.ts +20 -0
  109. package/dist/v2/screens/funLogin/looksLikeEmail.d.ts +5 -0
  110. package/dist/v2/theme/colors.d.ts +28 -0
  111. package/dist/v2/theme/fonts.d.ts +9 -0
  112. package/dist/v2/theme/radii.d.ts +6 -0
  113. package/dist/wallets/walletConnectors/index.js +39 -39
  114. package/package.json +4 -4
  115. package/dist/clients/chunk-JXTKKLVA.js +0 -185
  116. package/dist/clients/chunk-PZSKO3BJ.js +0 -60
  117. package/dist/components/FunPayments/icons/coinbase.d.ts +0 -5
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  darkTheme
4
- } from "../chunk-53FF4ZHH.js";
4
+ } from "../chunk-SJ7E3DKC.js";
5
5
  import "../chunk-DH3DS4FX.js";
6
6
  export {
7
7
  darkTheme
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  lightTheme
4
- } from "../chunk-2RND3WWH.js";
4
+ } from "../chunk-V4VFNIG4.js";
5
5
  import "../chunk-DH3DS4FX.js";
6
6
  export {
7
7
  lightTheme
@@ -97,8 +97,8 @@ export declare function isCheckoutCrFlow(config: FunkitCheckoutConfig): boolean;
97
97
  export declare function isCheckoutPostActionRequired(config: FunkitCheckoutConfig | ServerCheckoutConfig): boolean;
98
98
  /**
99
99
  * The amount-input switcher labels the *traded* token, which differs by quote
100
- * mode: in EXACT_IN the entered amount is the source quantity, so it's labelled
101
- * with the input token; in EXACT_OUT it's the destination quantity, labelled
100
+ * mode: in EXACT_IN the entered amount is the source quantity, so it's labeled
101
+ * with the input token; in EXACT_OUT it's the destination quantity, labeled
102
102
  * with the output token. Single source of truth shared by the loaded and
103
103
  * loading screens so their labels never diverge.
104
104
  */
@@ -0,0 +1,9 @@
1
+ import type { FunSessionStorage } from '@funkit/connect-core';
2
+ /**
3
+ * Fun's login kept in the browser's `localStorage`: the default when the host passes no
4
+ * `funSessionStorage`.
5
+ * - Any script on the host's page can read it. A host that wants it kept elsewhere passes its own.
6
+ * - Where the browser blocks `localStorage` (some private modes, sandboxed frames), each call
7
+ * stores nothing, so the login lasts only as long as the page.
8
+ */
9
+ export declare const localStorageFunSessionStorage: FunSessionStorage;
@@ -0,0 +1,5 @@
1
+ export declare const primaryButton: string;
2
+ /** Figma 627:14272 draws only the ring where the button was. */
3
+ export declare const busy: string;
4
+ /** The label stays in the accessibility tree while the ring is drawn in its place. */
5
+ export declare const hiddenLabel: string;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ interface PrimaryButtonProps {
3
+ label: string;
4
+ /** Omit when the button submits its enclosing form. */
5
+ onPress?: () => void;
6
+ type?: 'button' | 'submit';
7
+ isDisabled?: boolean;
8
+ /**
9
+ * The button stays mounted, keeps focus and its name, and draws only Figma's ring (node
10
+ * 627:14272) while busy. It can't be pressed: a submit it starts is ignored by its form.
11
+ */
12
+ isBusy?: boolean;
13
+ testId?: string;
14
+ }
15
+ export declare function PrimaryButton({ label, onPress, type, isDisabled, isBusy, testId, }: PrimaryButtonProps): React.JSX.Element;
16
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare const sheet: string;
2
+ export declare const header: string;
3
+ export declare const title: string;
4
+ export declare const closeButton: string;
5
+ export declare const closeIcon: string;
6
+ export declare const closeIconDisc: string;
7
+ export declare const form: string;
8
+ export declare const body: string;
9
+ export declare const footer: string;
10
+ /** Figma's OTP frames put a back button opposite the close button. */
11
+ export declare const backButton: string;
12
+ /** The title still names the sheet for screen readers when the screen draws its own heading. */
13
+ export declare const hiddenTitle: string;
@@ -0,0 +1,23 @@
1
+ import React, { type ReactNode } from 'react';
2
+ interface SheetProps {
3
+ title: string;
4
+ closeLabel: string;
5
+ onClose: () => void;
6
+ /** Pinned to the bottom of the sheet, e.g. the method row and the primary action. */
7
+ footer?: ReactNode;
8
+ /** Makes body + footer one form, so Enter in a field submits it. */
9
+ onSubmit?: () => void;
10
+ children: ReactNode;
11
+ testId?: string;
12
+ /** A round back button at the top left, as Figma's OTP frames draw it. */
13
+ onBack?: () => void;
14
+ backLabel?: string;
15
+ /**
16
+ * The screen draws its own heading in its body, so the sheet's title is kept for screen readers
17
+ * only (it still names the sheet).
18
+ */
19
+ isTitleHidden?: boolean;
20
+ }
21
+ /** The V2 sheet: centered title, round close button, body and pinned footer. */
22
+ export declare function Sheet({ title, closeLabel, onClose, footer, onSubmit, children, testId, onBack, backLabel, isTitleHidden, }: SheetProps): React.JSX.Element;
23
+ export {};
@@ -0,0 +1,2 @@
1
+ /** Figma Fun Web V2, node 627:14455: a 48px ring, the accent arc on the track. */
2
+ export declare const spinner: string;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * The ring Figma draws while the session works (node 627:14455). Decorative: whatever holds it
4
+ * says it is busy, as the Continue button does with `aria-busy`.
5
+ */
6
+ export declare function Spinner(): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { type FunSessionStore } from '@funkit/connect-core/internal';
2
+ import React from 'react';
3
+ import { type FunLoginText } from '../funLogin/FunLoginScreenPicker';
4
+ import { type FiatScreenPickerProps } from './FiatScreenPicker';
5
+ export interface FiatDepositGateProps extends Omit<FiatScreenPickerProps, 'initialAmount'> {
6
+ /** The buyer's Fun login. Web has no host minter yet, so every web fiat buyer uses it. */
7
+ funSession: FunSessionStore;
8
+ loginText: FunLoginText;
9
+ }
10
+ /**
11
+ * Decides who vouches for the buyer before any provider is asked, and mounts the screen-picker
12
+ * for that phase. It draws no screen of its own.
13
+ * - Draft: the amount screen runs on the checkout reducer and the routing table alone. A provider
14
+ * refuses a request with no bearer, so none is asked yet.
15
+ * - Continue: a saved Fun login goes straight to the deposit; otherwise Fun login opens.
16
+ * - Deposit: the fiat session starts from the draft's amount and method, with the login as its
17
+ * bearer, and fetches its own routing table with the login, since a bearer can change it.
18
+ * - A new buyer (session store) or checkout sends the gate back to the amount.
19
+ */
20
+ export declare function FiatDepositGate({ funSession, loginText, ...picker }: FiatDepositGateProps): React.JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { type FiatDepositSession, type FunSessionStore, type UseFiatDepositSessionArgs } from '@funkit/connect-core/internal';
2
+ import React from 'react';
3
+ import { type AmountScreenText } from '../../screens/amount/AmountScreen';
4
+ export interface FiatScreenPickerProps extends UseFiatDepositSessionArgs {
5
+ text: AmountScreenText;
6
+ /**
7
+ * The amounts a preset adds, as decimal strings in the session's currency (`"25"`). One the
8
+ * session can't add is dropped and logged here, where the list enters.
9
+ */
10
+ presets?: readonly string[];
11
+ onClose: () => void;
12
+ /** The Fun login the deposit's bearer comes from, when the buyer signed in to Fun. */
13
+ funSession?: FunSessionStore;
14
+ /**
15
+ * The login ended, such as a refresh that failed, and no charge may be underway: the deposit
16
+ * can be left. Not called while one may be, so the charge's outcome still reaches this session.
17
+ */
18
+ onLoginEnded?: () => void;
19
+ }
20
+ /** How Continue is drawn. It is never pressable yet; see `continueDrawn`. */
21
+ export type ContinueDrawn = 'disabled' | 'loading';
22
+ /**
23
+ * Continue for the session's state, drawing only what Figma has.
24
+ * - Disabled when there is nothing to press: no amount, no provider for it, or nothing to do.
25
+ * - Otherwise the session needs something this screen can't show: a provider's terms, a sign-in
26
+ * or identity step, its pay control, a retry's reason, a prompt over the screen, or a hidden
27
+ * element a provider's shell mounts. Continue shows loading until product/design decide what the
28
+ * buyer sees (ENG-7736).
29
+ * - So no state lets the buyer press Continue. A tap that answers one of those needs (a retry
30
+ * tap also counts as the buyer's tap for the provider) comes back with the first drawable need.
31
+ */
32
+ export declare function continueDrawn(session: FiatDepositSession): ContinueDrawn;
33
+ /**
34
+ * The fiat screen-picker: runs the deposit session and draws the screen it is on. Today that is
35
+ * the amount screen only.
36
+ */
37
+ export declare function FiatScreenPicker({ text, presets, onClose, funSession, onLoginEnded, ...args }: FiatScreenPickerProps): React.JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { type FunLoginError, type FunSessionStore, type UseFunLoginArgs } from '@funkit/connect-core/internal';
2
+ import React from 'react';
3
+ import { type FunLoginCodeScreenText } from '../../screens/funLogin/FunLoginCodeScreen';
4
+ import { type FunLoginEmailScreenText } from '../../screens/funLogin/FunLoginEmailScreen';
5
+ /** How long the tick shows before the deposit goes on, as connect-rn's code screen waits. */
6
+ export declare const VERIFIED_BEAT_MS = 800;
7
+ export interface FunLoginText {
8
+ email: FunLoginEmailScreenText;
9
+ code: FunLoginCodeScreenText;
10
+ /** What the buyer reads for each thing that can go wrong. */
11
+ errors: Record<FunLoginError, string>;
12
+ }
13
+ export interface FunLoginScreenPickerProps {
14
+ apiKey: string;
15
+ logger: UseFunLoginArgs['logger'];
16
+ /** Where the verified login is kept; the deposit sends it as its bearer. */
17
+ funSession: FunSessionStore;
18
+ text: FunLoginText;
19
+ /** The buyer is signed in: the tick has shown, and the session is in `funSession`. */
20
+ onVerified: () => void;
21
+ /** Back from the email, to the amount screen. */
22
+ onBack: () => void;
23
+ onClose: () => void;
24
+ }
25
+ /**
26
+ * Fun login as a flow: runs the login and draws its email or code screen.
27
+ * - Its own flow, beside the fiat one: the fiat engine never sees the login, only the bearer it
28
+ * leaves in `funSession`.
29
+ */
30
+ export declare function FunLoginScreenPicker({ apiKey, logger, funSession, text, onVerified, onBack, onClose, }: FunLoginScreenPickerProps): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ export declare const container: string;
2
+ export declare const row: string;
3
+ export declare const currency: string;
4
+ /** `!important` beats host pages that style bare `input` selectors. */
5
+ export declare const input: string;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ interface AmountDisplayProps {
3
+ amount: string;
4
+ onAmountChange: (next: string) => void;
5
+ ariaLabel: string;
6
+ currencySymbol?: string;
7
+ placeholder?: string;
8
+ autoFocus?: boolean;
9
+ testId?: string;
10
+ /** Which separators the field shows and reads. V1 also uses the browser's, the default. */
11
+ locale?: Intl.LocalesArgument;
12
+ }
13
+ /** The V2 "$180" field: an editable amount that shrinks to fit its width. */
14
+ export declare function AmountDisplay({ amount, onAmountChange, ariaLabel, currencySymbol, placeholder, autoFocus, testId, locale, }: AmountDisplayProps): React.JSX.Element;
15
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const content: string;
2
+ export declare const presets: string;
@@ -0,0 +1,37 @@
1
+ import React, { type ReactNode } from 'react';
2
+ export declare const DEFAULT_PRESETS: readonly string[];
3
+ /**
4
+ * The screen's strings. V2 doesn't import translations, so the host step builds these from the
5
+ * locale keys (`common.deposit`, `common.close`, `common.continue`, and one for the input label).
6
+ */
7
+ export interface AmountScreenText {
8
+ title: string;
9
+ close: string;
10
+ continue: string;
11
+ /** The amount field's accessible name. */
12
+ inputLabel: string;
13
+ }
14
+ export interface AmountScreenProps {
15
+ text: AmountScreenText;
16
+ /**
17
+ * Plain text, such as `1000.5`, that the owner (the checkout reducer) parses and bounds. The field
18
+ * shows it grouped in the buyer's locale and reports the buyer's edits back as plain text.
19
+ */
20
+ amount: string;
21
+ onAmountChange: (next: string) => void;
22
+ /** Amounts a chip adds, as decimal strings (`"25"`), handed back as given. */
23
+ presets?: readonly string[];
24
+ onPresetPress: (amount: string) => void;
25
+ /** Fires from the button or Enter in the amount field, never while disabled or loading. */
26
+ onContinue: () => void;
27
+ isContinueDisabled?: boolean;
28
+ /** Continue stays mounted but busy: Figma's ring (node 627:14272) in its place, and it can't be pressed. */
29
+ isContinueLoading?: boolean;
30
+ onClose: () => void;
31
+ /** Payment method row above Continue (Figma: payment-type-selector). */
32
+ methodSelector?: ReactNode;
33
+ /** The field's separators; the browser's when left out, as in V1. */
34
+ locale?: Intl.LocalesArgument;
35
+ }
36
+ /** Web V2 deposit amount entry (Figma Fun Web V2, node 392:5964). */
37
+ export declare function AmountScreen({ text, amount, onAmountChange, presets, onPresetPress, onContinue, isContinueDisabled, isContinueLoading, onClose, methodSelector, locale, }: AmountScreenProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const presetButton: string;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface PresetButtonProps {
3
+ /** Also the button's accessible name, so a screen reader says what the buyer sees. */
4
+ label: string;
5
+ onPress: () => void;
6
+ testId?: string;
7
+ }
8
+ export declare function PresetButton({ label, onPress, testId }: PresetButtonProps): React.JSX.Element;
9
+ export {};
@@ -0,0 +1,19 @@
1
+ export declare function getFittedTextFontSize({ availableWidth, textWidthAtMaxFontSize, maxFontSize, minFontSize, }: {
2
+ availableWidth: number;
3
+ textWidthAtMaxFontSize: number;
4
+ maxFontSize: number;
5
+ minFontSize: number;
6
+ }): number;
7
+ export declare function useFittedText(options: {
8
+ availableWidthRef?: React.RefObject<HTMLElement | null>;
9
+ enabled?: boolean;
10
+ maxAvailableWidth?: number;
11
+ maxFontSize?: number;
12
+ minFontSize: number;
13
+ remeasureKey?: unknown;
14
+ text: string;
15
+ textRef: React.RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
16
+ }): {
17
+ fontSize: number | undefined;
18
+ textWidth: number | undefined;
19
+ };
@@ -0,0 +1,2 @@
1
+ import { useLayoutEffect } from 'react';
2
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
@@ -0,0 +1,3 @@
1
+ export declare function useTextMeasurer(inputRef: React.RefObject<HTMLInputElement | HTMLTextAreaElement | null>): {
2
+ measureText: (text: string, fontSize?: number) => number | undefined;
3
+ };
@@ -0,0 +1,37 @@
1
+ /** USD, the only currency V2 takes, has cents. */
2
+ export declare const AMOUNT_DECIMALS = 2;
3
+ export type NumberSeparators = {
4
+ decimalSeparator: string;
5
+ groupSeparator: RegExp;
6
+ };
7
+ /**
8
+ * Reads the separators from the same plain-number format that `reformatIntegerPart` writes with.
9
+ * A currency format can group differently: `de-AT` groups currency with `.` but plain numbers with
10
+ * a space, and then the field could not read back the amount it had just shown.
11
+ */
12
+ export declare function getNumberSeparators(locale: Intl.LocalesArgument): NumberSeparators;
13
+ export declare function parseNumberInputValue(inputValue: string, separators: NumberSeparators): {
14
+ amount: number | undefined;
15
+ amountString: string;
16
+ amountStringNormalized: string;
17
+ decimalPart: string | null;
18
+ integerPart: string;
19
+ };
20
+ /**
21
+ * Whether `text` is an amount grouped the way the buyer's locale groups it, such as `1.234` or
22
+ * `1.234,5` in `de-DE`. Paste uses it to keep such an amount whole before it guesses that a `.` was
23
+ * meant as a decimal point.
24
+ */
25
+ export declare function isLocaleGroupedAmount(text: string, { decimalSeparator, groupSeparator }: NumberSeparators): boolean;
26
+ export declare function replaceStringRange(original: string, replacement: string, start: number, end: number): string;
27
+ export declare function reformatDecimalPart(decimalPart: string, decimals: number): string;
28
+ export declare function reformatIntegerPart(integerPart: string, locale: Intl.LocalesArgument, preserveLeadingZeroes: boolean): string;
29
+ /**
30
+ * The session's amount (`"1000.5"`) as the field shows it in the buyer's locale (`"1,000.5"`,
31
+ * `"1.000,5"`). V1 keeps the shown text in its state; V2's session keeps the plain text, so the field
32
+ * formats on the way in and `readDisplayedAmount` undoes it on the way out.
33
+ * - Leading zeros and a trailing separator stay, so `00` and `12.` show as typed.
34
+ */
35
+ export declare function displayAmount(amount: string, locale: Intl.LocalesArgument): string;
36
+ /** What the field shows, as plain text the session reads (`"1000.5"`), or `undefined` when unreadable. */
37
+ export declare function readDisplayedAmount(shown: string, locale: Intl.LocalesArgument): string | undefined;
@@ -0,0 +1 @@
1
+ export declare function attachInputNormalization(element: HTMLInputElement, inputDecimals: number, locale: Intl.LocalesArgument): () => void;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /**
3
+ * Stand-in for the FiatV2 screens until they land. Shows the FiatV2 stage so
4
+ * the wiring can be checked on staging. Only users with the
5
+ * `enable-web-fiat-deposit-flow` gate can reach it.
6
+ */
7
+ export declare function FiatPlaceholderScreen({ stage }: {
8
+ stage: string;
9
+ }): React.JSX.Element;
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ /** The code is six digits, as the server's `otpCode` input says. */
3
+ export declare const CODE_LENGTH = 6;
4
+ export interface FunLoginCodeScreenText {
5
+ /** "Enter the code sent to"; the email is drawn under it. */
6
+ heading: string;
7
+ /** The code field's accessible name. */
8
+ codeLabel: string;
9
+ resendPrompt: string;
10
+ resend: string;
11
+ next: string;
12
+ close: string;
13
+ back: string;
14
+ verified: string;
15
+ }
16
+ export interface FunLoginCodeScreenProps {
17
+ text: FunLoginCodeScreenText;
18
+ email: string;
19
+ /** Digits only, at most six. */
20
+ code: string;
21
+ onCodeChange: (code: string) => void;
22
+ /** Fires from Next or Enter, and by itself once a sixth digit is typed or pasted. */
23
+ onSubmit: () => void;
24
+ onResend: () => void;
25
+ /** A new code may be asked for now; Resend is greyed out until then. */
26
+ canResend: boolean;
27
+ /** `verifying`: the ring where Next was. `verified`: the tick. */
28
+ status: 'entering' | 'verifying' | 'verified';
29
+ /** What went wrong, already in the buyer's words; drawn where Next was. */
30
+ errorMessage?: string;
31
+ onBack: () => void;
32
+ onClose: () => void;
33
+ }
34
+ /** Fun login's code step (Figma Fun Web V2, OTP flow, nodes 547:4269 to 547:5163). */
35
+ export declare function FunLoginCodeScreen({ text, email, code, onCodeChange, onSubmit, onResend, canResend, status, errorMessage, onBack, onClose, }: FunLoginCodeScreenProps): React.JSX.Element;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ /** The screen's strings. V2 doesn't import translations, so the flow passes them in. */
3
+ export interface FunLoginEmailScreenText {
4
+ heading: string;
5
+ placeholder: string;
6
+ next: string;
7
+ close: string;
8
+ back: string;
9
+ /** Shown when the buyer sends something that is not an email address. */
10
+ invalidEmail: string;
11
+ }
12
+ export interface FunLoginEmailScreenProps {
13
+ text: FunLoginEmailScreenText;
14
+ email: string;
15
+ onEmailChange: (email: string) => void;
16
+ /** Fires from Next or Enter, only for something shaped like an email address. */
17
+ onSubmit: () => void;
18
+ /** The code is being sent: Next draws its ring and can't be pressed. */
19
+ isSending?: boolean;
20
+ /** What went wrong on the server's side, already in the buyer's words; drawn where Next was. */
21
+ errorMessage?: string;
22
+ onBack?: () => void;
23
+ onClose: () => void;
24
+ }
25
+ /** Fun login's email step (Figma Fun Web V2, OTP flow, node 547:4195). */
26
+ export declare function FunLoginEmailScreen({ text, email, onEmailChange, onSubmit, isSending, errorMessage, onBack, onClose, }: FunLoginEmailScreenProps): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ /** Figma's OTP frames: the heading sits in the body, left-aligned, under the back and close row. */
2
+ export declare const content: string;
3
+ export declare const heading: string;
4
+ export declare const headingDetail: string;
5
+ export declare const emailField: string;
6
+ /** The six boxes sit under one real field, which takes the typing, the paste and autofill. */
7
+ export declare const codeBoxes: string;
8
+ export declare const codeBox: string;
9
+ export declare const codeBoxFilled: string;
10
+ /** The field itself is invisible, so its focus shows on the box the next digit goes into. */
11
+ export declare const codeBoxActive: string;
12
+ export declare const codeField: string;
13
+ export declare const resendRow: string;
14
+ export declare const resendButton: string;
15
+ /** Figma's "Wrong code" and "Please enter a valid email": a message drawn where the button was. */
16
+ export declare const notice: string;
17
+ /** A message over Next, when a full code failed to send and can be sent again. */
18
+ export declare const footerStack: string;
19
+ /** Where the button was, while the code is checked or once it is: a ring, then the tick. */
20
+ export declare const status: string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Whether the text is shaped like an email address: something, one `@`, and a domain with a dot.
3
+ * Only a first check, so the buyer hears about a typo before a code is sent; the server decides.
4
+ */
5
+ export declare function looksLikeEmail(text: string): boolean;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * V2's colors, as CSS custom properties. V2 cannot import V1's theme (R1), so
3
+ * the host step sets these from whatever theme is active. Each has a fallback,
4
+ * so a screen still renders without a host, in Storybook or a test.
5
+ *
6
+ * Temporary: each customer is styled by their own host theme, not by this
7
+ * palette. The fallback values are placeholders, and this list of names lasts
8
+ * until V2's theme contract replaces it (ENG-7612).
9
+ */
10
+ export declare const V2_COLOR_VARIABLES: {
11
+ readonly accent: '--fun-v2-color-accent';
12
+ readonly accentForeground: '--fun-v2-color-accent-foreground';
13
+ readonly success: '--fun-v2-color-success';
14
+ readonly warning: '--fun-v2-color-warning';
15
+ readonly warningSurface: '--fun-v2-color-warning-surface';
16
+ readonly error: '--fun-v2-color-error';
17
+ readonly textPrimary: '--fun-v2-color-text-primary';
18
+ readonly textSecondary: '--fun-v2-color-text-secondary';
19
+ readonly border: '--fun-v2-color-border';
20
+ readonly track: '--fun-v2-color-track';
21
+ readonly fieldBackground: '--fun-v2-color-field-background';
22
+ readonly fieldBorder: '--fun-v2-color-field-border';
23
+ readonly surface: '--fun-v2-color-surface';
24
+ readonly edge: '--fun-v2-color-edge';
25
+ readonly subtleFill: '--fun-v2-color-subtle-fill';
26
+ };
27
+ export type V2ColorName = keyof typeof V2_COLOR_VARIABLES;
28
+ export declare const v2Colors: Record<V2ColorName, string>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * V2's font stacks, as CSS custom properties the host step can set from its theme. Each has the
3
+ * Figma face as its fallback. Neither face is loaded by connect yet; hosts without them fall back.
4
+ */
5
+ export declare const V2_FONT_VARIABLES: {
6
+ readonly ui: '--fun-v2-font-ui';
7
+ readonly amount: '--fun-v2-font-amount';
8
+ };
9
+ export declare const v2Fonts: Record<keyof typeof V2_FONT_VARIABLES, string>;
@@ -0,0 +1,6 @@
1
+ /** V2's corner radii, from the Figma frames. Named, so a screen never holds the number. */
2
+ export declare const v2Radii: {
3
+ readonly sheet: 28;
4
+ readonly control: 12;
5
+ readonly preset: 10;
6
+ };