@funkit/connect 12.16.0 → 12.18.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 (97) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/dist/clients/axiom.d.ts +1 -5
  3. package/dist/clients/{chunk-BKK2BFIP.js → chunk-AELXD5XA.js} +1 -1
  4. package/dist/clients/{chunk-6IH7AWFA.js → chunk-FOXMRDKD.js} +1 -1
  5. package/dist/clients/{chunk-UZ3NA7HN.js → chunk-G6A62MZO.js} +3 -3
  6. package/dist/clients/{chunk-OB5GKTP2.js → chunk-L6JL2XJY.js} +1 -1
  7. package/dist/clients/{chunk-I5VRAFH6.js → chunk-LCYJLY4X.js} +1 -1
  8. package/dist/clients/chunk-R25GIAD5.js +59 -0
  9. package/dist/clients/{chunk-7JYLS7IF.js → chunk-YSAAJSWT.js} +272 -48
  10. package/dist/clients/fanatics.js +2 -2
  11. package/dist/clients/internal/nado/withdrawalCallback.js +4 -4
  12. package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
  13. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  14. package/dist/clients/internal/nado/withdrawalForm.js +6 -6
  15. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  16. package/dist/clients/lighter.css +8 -8
  17. package/dist/clients/lighter.d.ts +29 -16
  18. package/dist/clients/lighter.js +149 -68
  19. package/dist/clients/mallard.js +2 -2
  20. package/dist/clients/nado.js +4 -4
  21. package/dist/components/LargeAmountInput/LargeAmountInput.d.ts +3 -1
  22. package/dist/components/TokenSwapWidget/TokenSelectButton/TokenSelectButton.d.ts +5 -2
  23. package/dist/components/TokenSwapWidget/TokenSwapCard/TokenSwapCard.d.ts +7 -3
  24. package/dist/components/TokenSwapWidget/TokenSwapWidget.d.ts +7 -2
  25. package/dist/consts/customers.d.ts +12 -1
  26. package/dist/domains/convert/assets.d.ts +30 -0
  27. package/dist/domains/convert/balances.d.ts +44 -24
  28. package/dist/domains/convert/errors.d.ts +38 -0
  29. package/dist/domains/convert/execution.d.ts +39 -0
  30. package/dist/domains/convert/hostTimeout.d.ts +8 -0
  31. package/dist/domains/convert/inputAmount.d.ts +53 -0
  32. package/dist/domains/convert/quote.d.ts +33 -0
  33. package/dist/domains/convert/recipient.d.ts +2 -1
  34. package/dist/domains/convert/reducer.d.ts +112 -0
  35. package/dist/domains/convert/screen.d.ts +169 -0
  36. package/dist/domains/convert/settlement.d.ts +52 -0
  37. package/dist/domains/convert/sourceWallet.d.ts +5 -4
  38. package/dist/domains/convert/submit.d.ts +67 -0
  39. package/dist/domains/convert/types.d.ts +52 -27
  40. package/dist/domains/convert/view.d.ts +111 -0
  41. package/dist/domains/nativeFeeReserve.d.ts +29 -0
  42. package/dist/domains/quote.d.ts +14 -1
  43. package/dist/hooks/queries/useWithdrawFops.d.ts +6 -0
  44. package/dist/hooks/queries/useWithdrawalQuote.d.ts +4 -1
  45. package/dist/hooks/track/CheckoutModalEvent.d.ts +2 -0
  46. package/dist/hooks/track/WithdrawModalEvent.d.ts +1 -0
  47. package/dist/hooks/track/analytics/events.d.ts +59 -1
  48. package/dist/hooks/track/analytics/mappers.d.ts +5 -4
  49. package/dist/hooks/track/analytics/resolveIframeStepNavigation.d.ts +18 -0
  50. package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +2 -2
  51. package/dist/hooks/track/analytics/useTrackSwappedIframeEvents.d.ts +5 -0
  52. package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +2 -2
  53. package/dist/hooks/track/useQuoteAttemptCounter.d.ts +2 -0
  54. package/dist/hooks/useConvertAssetList.d.ts +23 -0
  55. package/dist/hooks/useConvertAssets.d.ts +11 -0
  56. package/dist/hooks/useConvertBalances.d.ts +50 -0
  57. package/dist/hooks/useConvertExecute.d.ts +33 -0
  58. package/dist/hooks/useConvertQuote.d.ts +53 -0
  59. package/dist/hooks/useConvertSelectionWallets.d.ts +34 -0
  60. package/dist/hooks/useConvertTransactionStatus.d.ts +17 -0
  61. package/dist/hooks/useMaxSpendableAmount.d.ts +19 -0
  62. package/dist/hooks/useStepQueryReadiness.d.ts +45 -15
  63. package/dist/index.css +8 -8
  64. package/dist/index.d.ts +3 -2
  65. package/dist/index.js +8169 -3491
  66. package/dist/modals/CheckoutModal/Convert/ConvertAssetList.d.ts +16 -0
  67. package/dist/modals/CheckoutModal/Convert/ConvertAssetRow.d.ts +21 -0
  68. package/dist/modals/CheckoutModal/Convert/ConvertChainPills.d.ts +14 -0
  69. package/dist/modals/CheckoutModal/Convert/ConvertSelectDestinationStep.d.ts +30 -0
  70. package/dist/modals/CheckoutModal/Convert/ConvertSelectSourceStep.d.ts +18 -0
  71. package/dist/modals/CheckoutModal/Convert/ConvertStep.d.ts +4 -2
  72. package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +2 -0
  73. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +5 -3
  74. package/dist/modals/CheckoutModal/SwappedIframe/swappedIframeReady.track.d.ts +8 -0
  75. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalComplete.d.ts +5 -2
  76. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalEnterAmount.d.ts +4 -2
  77. package/dist/modals/CheckoutModal/stepTransition.d.ts +7 -2
  78. package/dist/modals/CheckoutModal/stepTransition.shared.d.ts +0 -1
  79. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +48 -15
  80. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +17 -4
  81. package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +10 -7
  82. package/dist/modals/WithdrawalModal/useMaxWithdrawableAmount.d.ts +10 -0
  83. package/dist/modals/WithdrawalModal/useMultiSourceWithdrawal.d.ts +41 -0
  84. package/dist/modals/WithdrawalModal/withdrawalFormHelpers.d.ts +28 -8
  85. package/dist/providers/ConvertProvider.d.ts +40 -0
  86. package/dist/providers/FunkitCheckoutContext/index.d.ts +2 -2
  87. package/dist/providers/FunkitCheckoutContext/types.d.ts +36 -2
  88. package/dist/providers/FunkitQuoteContext.track.d.ts +23 -3
  89. package/dist/providers/SwappedProvider.d.ts +7 -0
  90. package/dist/shadow-css.js +1 -1
  91. package/dist/utils/customer.d.ts +34 -4
  92. package/dist/utils/withdrawal.d.ts +28 -1
  93. package/dist/wallets/multiSourceWithdrawal.d.ts +36 -0
  94. package/dist/wallets/walletConnectors/index.js +42 -42
  95. package/package.json +6 -6
  96. package/dist/clients/chunk-6EU6CXNH.js +0 -20
  97. /package/dist/clients/{chunk-4DBUYTEE.js → chunk-LICTGZXW.js} +0 -0
@@ -37,8 +37,8 @@ export type TrackDepositAmountConfirmedArgs = {
37
37
  };
38
38
  export type TrackDepositMethodSelectedArgs = {
39
39
  connectionStatus?: ConnectionStatus;
40
- /** Some Swapped methods can't be mapped to PaymentMethod and are forwarded as-is. */
41
- paymentMethod: PaymentMethod | FormOfPaymentType;
40
+ /** Swapped methods without a PaymentMethod equivalent use their lowercase FOP type. */
41
+ paymentMethod: PaymentMethod | Lowercase<FormOfPaymentType>;
42
42
  paymentRail?: AnalyticsPaymentRail;
43
43
  /** Selected checkout provider, such as a Bluvo exchange. */
44
44
  provider?: string;
@@ -0,0 +1,5 @@
1
+ import type { FormOfPaymentType } from '@funkit/api-base';
2
+ import { type AnalyticsFlow } from './events';
3
+ export declare function useTrackSwappedIframeEvents(flow: AnalyticsFlow): {
4
+ trackIframeStepViewed: (step: string, fopType: FormOfPaymentType) => void;
5
+ };
@@ -16,8 +16,8 @@ export type TrackWithdrawalAmountConfirmedArgs = {
16
16
  };
17
17
  export type TrackWithdrawalMethodSelectedArgs = {
18
18
  connectionStatus?: ConnectionStatus;
19
- /** Some Swapped methods can't be mapped to PaymentMethod and are forwarded as-is. */
20
- paymentMethod: PaymentMethod | FormOfPaymentType;
19
+ /** Swapped methods without a PaymentMethod equivalent use their lowercase FOP type. */
20
+ paymentMethod: PaymentMethod | Lowercase<FormOfPaymentType>;
21
21
  paymentRail?: AnalyticsPaymentRail;
22
22
  /** Selected checkout provider, such as a Bluvo exchange or a Lighter method id. */
23
23
  provider?: string;
@@ -0,0 +1,2 @@
1
+ /** Returns a per-quote-flow counter that resets when its checkout changes. */
2
+ export declare function useQuoteAttemptCounter(): (checkoutId: string) => number;
@@ -0,0 +1,23 @@
1
+ import type { ConvertBalances } from '../domains/convert/balances';
2
+ import type { ConvertConfig, ConvertResolvedAsset } from '../domains/convert/types';
3
+ import type { ConvertAssetListStatus } from '../domains/convert/assets';
4
+ export interface ConvertAssetListResult {
5
+ status: ConvertAssetListStatus;
6
+ /** Resolved assets; empty until they resolve or when the host lists none. */
7
+ assets: ConvertResolvedAsset[];
8
+ balances: ConvertBalances | undefined;
9
+ /** Balances are being read, including a poll or retry. */
10
+ isBalancesFetching: boolean;
11
+ /** Loads again after a failure. */
12
+ retry: () => void;
13
+ /** Reads the given assets (all by default) again; rejects if the read fails. */
14
+ refetchBalances: (assets?: ConvertResolvedAsset[]) => Promise<ConvertBalances>;
15
+ }
16
+ /** The host's Convert assets and balances, read once for every Convert screen by `ConvertProvider`. */
17
+ export declare function useConvertAssetList({ checkoutId, config, enabled, }: {
18
+ /** The checkout session; Convert's host reads are cached per checkout. */
19
+ checkoutId: string | undefined;
20
+ config: ConvertConfig | undefined;
21
+ /** Off stops reads and polling; the last read stays readable. */
22
+ enabled: boolean;
23
+ }): ConvertAssetListResult;
@@ -0,0 +1,11 @@
1
+ import type { ConvertAsset, ConvertResolvedAsset } from '../domains/convert/types';
2
+ /**
3
+ * Resolves the host's Convert asset list. Waits for the supported-assets list
4
+ * (already loading for the checkout modal) so every token that it covers
5
+ * resolves without a network call. If that list fails to load, resolution
6
+ * still runs and every token takes the per-token fallback instead of the
7
+ * screen staying empty.
8
+ */
9
+ export declare function useConvertAssets(assets: ConvertAsset[] | undefined, { enabled }?: {
10
+ enabled?: boolean;
11
+ }): import("@tanstack/react-query").UseQueryResult<ConvertResolvedAsset[], Error>;
@@ -0,0 +1,50 @@
1
+ import { type ConvertBalances } from '../domains/convert/balances';
2
+ import type { ConvertRecipientAddresses, ConvertResolvedAsset, GetConvertBalances } from '../domains/convert/types';
3
+ export declare const BALANCES_QUERY_KEY: readonly ["convert", "balances"];
4
+ interface UseConvertBalancesParams {
5
+ /** Scopes reads to one checkout, whose `getBalances` may differ from the last. */
6
+ checkoutId: string | undefined;
7
+ /** Resolved assets; one read covers all of them. */
8
+ assets: ConvertResolvedAsset[] | undefined;
9
+ getBalances: GetConvertBalances | undefined;
10
+ /**
11
+ * The host's account per VM. Part of the cache key, so an account switch
12
+ * never shows the previous account's balances. These are the host's receive
13
+ * addresses: an identity for the account, not a claim about which wallet
14
+ * each balance was read from (Polygon pUSD is read from the proxy).
15
+ */
16
+ recipientAddresses: ConvertRecipientAddresses | undefined;
17
+ refetchIntervalMs?: number;
18
+ /** Off stops reads and polling; the last read stays readable. */
19
+ enabled?: boolean;
20
+ }
21
+ export interface UseConvertBalancesResult {
22
+ /**
23
+ * One entry per listed asset, keyed by `convertAssetKey`; `undefined`
24
+ * until the first read for the current asset list and account settles. A
25
+ * failed poll keeps the last good read.
26
+ */
27
+ balances: ConvertBalances | undefined;
28
+ isLoading: boolean;
29
+ /** A read is running, including a poll or retry with balances shown. */
30
+ isFetching: boolean;
31
+ /** The latest read threw. `balances` still holds the last good one, if any. */
32
+ isError: boolean;
33
+ /**
34
+ * Read again now, e.g. before signing or after a convert settles. Resolves
35
+ * with the fresh balances and rejects if the host's read failed, so a
36
+ * caller never mistakes the last good read for a fresh one.
37
+ * - With `assets`, reads only those and merges them into the cached
38
+ * balances; the rest keep their last read.
39
+ * - Without, reads every listed asset.
40
+ */
41
+ refetch: (assets?: ConvertResolvedAsset[]) => Promise<ConvertBalances>;
42
+ }
43
+ /**
44
+ * Owns Convert's balance state: one query for every listed asset, polled on
45
+ * a timer while mounted. Keyed by the asset list and the host's account, so a
46
+ * change to either is a cache miss; a late response for an old key can't
47
+ * replace a newer one.
48
+ */
49
+ export declare function useConvertBalances({ checkoutId, assets, getBalances, recipientAddresses, refetchIntervalMs, enabled, }: UseConvertBalancesParams): UseConvertBalancesResult;
50
+ export {};
@@ -0,0 +1,33 @@
1
+ import { type Dispatch } from 'react';
2
+ import type { ConvertBalances } from '../domains/convert/balances';
3
+ import type { ConvertEvent, ConvertSnapshot } from '../domains/convert/reducer';
4
+ import type { ConvertConfig, ConvertResolvedAsset } from '../domains/convert/types';
5
+ import type { MaxSpendableAmount } from '../hooks/useMaxSpendableAmount';
6
+ interface UseConvertExecuteParams {
7
+ dispatch: Dispatch<ConvertEvent>;
8
+ /** The source's fee reserve, for the pre-sign check's fresh Max. */
9
+ feeReserve: MaxSpendableAmount;
10
+ /** Called with only the source asset. */
11
+ refetchBalances: (assets: ConvertResolvedAsset[]) => Promise<ConvertBalances>;
12
+ /**
13
+ * The host's callback: quote problems, failures before funds move, and an
14
+ * untrackable outcome.
15
+ */
16
+ onError?: ConvertConfig['onError'];
17
+ }
18
+ export interface UseConvertExecuteResult {
19
+ /**
20
+ * Runs one conversion of `snapshot` up to a recorded deposit, signing only
21
+ * what the pre-sign check passes. A call while one is running, or after its
22
+ * outcome turned untrackable, does nothing.
23
+ */
24
+ execute: (snapshot: ConvertSnapshot) => Promise<void>;
25
+ }
26
+ /**
27
+ * Convert's submit, like withdrawal's `useWithdrawal`: pre-sign check, source
28
+ * leg through the host's wallet, then a direct-execution record for
29
+ * `useConvertTransactionStatus` to follow. Holds no state: it reports each
30
+ * step to the reducer, and never polls.
31
+ */
32
+ export declare function useConvertExecute({ dispatch, feeReserve, refetchBalances, onError, }: UseConvertExecuteParams): UseConvertExecuteResult;
33
+ export {};
@@ -0,0 +1,53 @@
1
+ import { type ConvertQuote } from '../domains/convert/quote';
2
+ import type { ConvertResolvedAsset } from '../domains/convert/types';
3
+ export declare const CONVERT_QUOTE_REFRESH_MS = 30000;
4
+ export declare const CONVERT_QUOTE_QUERY_KEY: readonly ["convert", "quote"];
5
+ interface UseConvertQuoteParams {
6
+ /**
7
+ * Scopes quotes to one checkout, like withdrawal's, so a reopened checkout
8
+ * never reuses one from before.
9
+ */
10
+ checkoutId: string;
11
+ sourceAsset: ConvertResolvedAsset | undefined;
12
+ destinationAsset: ConvertResolvedAsset | undefined;
13
+ /** Exact amount to spend; no quote for `undefined` or zero. */
14
+ amountInBaseUnits: bigint | undefined;
15
+ /** The source wallet that signs. */
16
+ userAddress: string | undefined;
17
+ recipientAddress: string | undefined;
18
+ /**
19
+ * Off stops all fetching and keeps the shown quote. On re-enable TanStack
20
+ * refetches a quote past its refresh time at once, reporting `isFetching`
21
+ * from that render, so it's never signed stale.
22
+ */
23
+ enabled?: boolean;
24
+ /**
25
+ * Bumped per sent deposit, so the next attempt never reuses a quote whose
26
+ * Relay request was already sent.
27
+ */
28
+ sentCount?: number;
29
+ /** Refresh cadence; overridable so tests don't wait 30s. */
30
+ refetchIntervalMs?: number;
31
+ }
32
+ export interface UseConvertQuoteResult {
33
+ /** The current quote; `undefined` while loading or after a failed fetch. */
34
+ quote: ConvertQuote | undefined;
35
+ isLoading: boolean;
36
+ /** A fetch is running, including a timed refresh while a quote is shown. */
37
+ isFetching: boolean;
38
+ isError: boolean;
39
+ /** As thrown; a Relay rejection stays a `RelayQuoteError`. */
40
+ error: Error | null;
41
+ /** When the shown quote is replaced; seeds the countdown. */
42
+ refreshesAtMs: number | undefined;
43
+ /** Quote again now, e.g. when the user retries a failed quote. Rejects if it fails. */
44
+ refetch: () => Promise<ConvertQuote>;
45
+ }
46
+ /**
47
+ * Convert's exact-in quote. Keyed by everything the request carries, so an
48
+ * edit never shows a quote for the old inputs, and refreshed on a timer while
49
+ * a quote is shown. A failed fetch hides the quote and stops the timer until
50
+ * the inputs change or `refetch` is called.
51
+ */
52
+ export declare function useConvertQuote({ checkoutId, sourceAsset, destinationAsset, amountInBaseUnits, userAddress, recipientAddress, enabled: isEnabled, sentCount, refetchIntervalMs, }: UseConvertQuoteParams): UseConvertQuoteResult;
53
+ export {};
@@ -0,0 +1,34 @@
1
+ import { type ConvertRecipientSelection } from '../domains/convert/recipient';
2
+ import { type ConvertSourceWalletSelection } from '../domains/convert/sourceWallet';
3
+ import type { ConvertRecipientAddresses, ConvertResolvedAsset, GetConvertSourceWallet } from '../domains/convert/types';
4
+ export interface ConvertSelectionLookup<Selection> {
5
+ /** `undefined` while it resolves, or with nothing picked. */
6
+ selection: Selection | undefined;
7
+ /** The lookup is running, including a retry. */
8
+ isFetching: boolean;
9
+ /** Looks up again, e.g. after the host's resolver failed or timed out. */
10
+ retry: () => void;
11
+ }
12
+ /** Where the chosen destination's funds land. */
13
+ export declare function useConvertRecipient({ checkoutId, asset, recipientAddresses, enabled, }: {
14
+ /** Scopes the answer to one checkout, whose host callbacks may differ from the last. */
15
+ checkoutId: string | undefined;
16
+ asset: ConvertResolvedAsset | undefined;
17
+ recipientAddresses: ConvertRecipientAddresses | undefined;
18
+ /** Off keeps the last answer without asking the host. */
19
+ enabled?: boolean;
20
+ }): ConvertSelectionLookup<ConvertRecipientSelection>;
21
+ /**
22
+ * The signing wallet for the chosen source. Keyed on the asset, since the host
23
+ * may resolve different wallets for tokens on one chain.
24
+ */
25
+ export declare function useConvertSourceWallet({ checkoutId, asset, getSourceWallet, recipientAddresses, enabled, }: {
26
+ /** Scopes the wallet to one checkout, so a replaced host wallet is never reused. */
27
+ checkoutId: string | undefined;
28
+ asset: ConvertResolvedAsset | undefined;
29
+ getSourceWallet: GetConvertSourceWallet | undefined;
30
+ /** Only keys the cache to the host's account. */
31
+ recipientAddresses: ConvertRecipientAddresses | undefined;
32
+ /** Off keeps the last answer without asking the host. */
33
+ enabled?: boolean;
34
+ }): ConvertSelectionLookup<ConvertSourceWalletSelection>;
@@ -0,0 +1,17 @@
1
+ import { type Dispatch } from 'react';
2
+ import type { ConvertEvent, ConvertSubmission } from '../domains/convert/reducer';
3
+ import type { ConvertConfig } from '../domains/convert/types';
4
+ /**
5
+ * Follows a recorded conversion to settlement, like withdrawal's
6
+ * `useNadoWithdrawalStatus`: polls its direct execution with the same hook
7
+ * checkout and withdrawal status screens use. Once per conversion, when Relay
8
+ * reports a terminal status, it fires the host's callback and reports
9
+ * `COMPLETED` or `FILL_FAILED`. A refund reads as a failure.
10
+ */
11
+ export declare function useConvertTransactionStatus({ submission, dispatch, onSuccess, onError, }: {
12
+ /** Only a `pending` submission is polled. */
13
+ submission: ConvertSubmission | undefined;
14
+ dispatch: Dispatch<ConvertEvent>;
15
+ onSuccess?: ConvertConfig['onSuccess'];
16
+ onError?: ConvertConfig['onError'];
17
+ }): void;
@@ -0,0 +1,19 @@
1
+ import type { Dnum } from 'dnum';
2
+ export interface MaxSpendableAmount {
3
+ /** A native EVM source's gas price hasn't loaded, so Max is unknown. */
4
+ isLoading: boolean;
5
+ /** The balance less its fee reserve. Only meaningful when `!isLoading`. */
6
+ getMaxSpendable: (balance: Dnum) => Dnum;
7
+ }
8
+ /**
9
+ * What Max may fill in for a source token: the balance less its fee reserve.
10
+ * A function of the balance so a caller can apply it to a balance read after
11
+ * render (the pre-sign check).
12
+ * - EVM gas is the live gas price × checkout's Statsig gas-unit buffer.
13
+ * - A chain missing from the wagmi config, or a failed gas request, falls back
14
+ * to the full balance with a warning rather than leaving Max disabled.
15
+ */
16
+ export declare function useMaxSpendableAmount({ chainId, tokenAddress, }: {
17
+ chainId: string;
18
+ tokenAddress: string;
19
+ }): MaxSpendableAmount;
@@ -1,32 +1,62 @@
1
+ import type { FormOfPaymentType } from '@funkit/api-base';
2
+ import type { PaymentMethod } from '../domains/paymentMethods';
1
3
  import type { CheckoutModalEvent } from '../hooks/track/CheckoutModalEvent';
4
+ import type { WithdrawModalEvent } from '../hooks/track/WithdrawModalEvent';
2
5
  import type { useTrack } from '../hooks/track/useTrack';
3
- import type { FunCheckoutStep } from '../modals/CheckoutModal/FunCheckoutStep';
6
+ import { FunCheckoutStep } from '../modals/CheckoutModal/FunCheckoutStep';
7
+ import type { WithdrawalModalStep } from '../modals/WithdrawalModal/types';
8
+ import type { useTrackV2 } from './track/useTrackV2';
9
+ import { type AnalyticsFlow } from './track/analytics/events';
10
+ /** Shared by the checkout and withdrawal modals — each has its own step enum. */
11
+ export type StepReadinessStep = FunCheckoutStep | WithdrawalModalStep;
4
12
  export interface StepQueryMeta extends Record<string, unknown> {
5
- /** Checkout steps that depend on this query being loaded */
6
- dependentSteps: FunCheckoutStep[];
13
+ /** Modal steps that depend on this query being loaded */
14
+ dependentSteps: StepReadinessStep[];
7
15
  /** camelCase identifier for this query, used as key in timing metadata */
8
16
  name: string;
9
17
  /** Statsig event to emit with this query's individual timing */
10
- timingEvent: CheckoutModalEvent;
18
+ timingEvent: CheckoutModalEvent | WithdrawModalEvent;
19
+ /** This query is currently disabled by a prerequisite expected to resolve. */
20
+ enablePending?: boolean;
11
21
  }
12
22
  export declare function stepQueryMeta(params: {
13
23
  name: string;
14
- timingEvent: CheckoutModalEvent;
15
- dependentSteps: FunCheckoutStep[];
24
+ timingEvent: CheckoutModalEvent | WithdrawModalEvent;
25
+ dependentSteps: StepReadinessStep[];
26
+ enablePending?: boolean;
16
27
  }): StepQueryMeta;
17
28
  /**
18
- * Ensures all React Query dependencies for a checkout step are loaded before
19
- * marking the step as ready. Queries opt in via `stepQueryMeta()` in their
20
- * query options.
29
+ * Ensures all React Query dependencies for a modal step (checkout or
30
+ * withdrawal) are loaded before marking the step as ready. Queries opt in via
31
+ * `stepQueryMeta()` in their query options.
21
32
  *
22
33
  * Emits:
23
34
  * - A per-query Statsig event (the query's `timingEvent`) with duration as value
24
- * - A step-level measured event (`fc::ready::*`) with per-query timing metadata
35
+ * - A step-level measured event (from `readyEventMap`, if provided) with
36
+ * per-query timing metadata
37
+ * - {@link AnalyticsEvent.PERF_STEP_READY} with per-query timing metadata
25
38
  *
26
- * Steps without dependencies are skipped — no event is emitted and
27
- * `isStepReady` is set immediately.
39
+ * Steps without dependencies are skipped — no event is emitted.
28
40
  */
29
- export declare function useStepQueryReadiness(logEvent: ReturnType<typeof useTrack>['logEvent'], logMeasuredEvent: ReturnType<typeof useTrack>['logMeasuredEvent']): {
30
- isStepReady: boolean;
31
- ensureStepQueries: (step: FunCheckoutStep) => Promise<void>;
41
+ export declare function useStepQueryReadiness(params: {
42
+ checkoutId: string | null;
43
+ logEvent: ReturnType<typeof useTrack>['logEvent'];
44
+ logEventV2: ReturnType<typeof useTrackV2>;
45
+ logMeasuredEvent: ReturnType<typeof useTrack>['logMeasuredEvent'];
46
+ /** Flow of the visible step, which may differ from the checkout default. */
47
+ flow: AnalyticsFlow;
48
+ /** Selected payment method, if any, to attach to `fc_perf_step_ready`. */
49
+ paymentMethod: PaymentMethod | Lowercase<FormOfPaymentType> | null;
50
+ /** Legacy `fc::`/`fw::` step-level event to fire per step, if any. */
51
+ readyEventMap?: Partial<Record<StepReadinessStep, CheckoutModalEvent | WithdrawModalEvent>>;
52
+ /**
53
+ * Whether the owning modal is currently open. The modal component stays
54
+ * mounted across close (`Dialog` just hides it), so an in-flight
55
+ * `ensureStepQueries` call (e.g. waiting on a disabled query, or awaiting
56
+ * `ensureQueryData`) would otherwise keep running in the background and
57
+ * fire a step-ready event well after the user closed the modal.
58
+ */
59
+ isModalOpen: boolean;
60
+ }): {
61
+ ensureStepQueries: (step: StepReadinessStep) => Promise<void>;
32
62
  };
package/dist/index.css CHANGED
@@ -17345,14 +17345,6 @@
17345
17345
  background: var(--rk-colors-modalBackground);
17346
17346
  }
17347
17347
 
17348
- /* vanilla-extract-css-ns:src/components/FunSelectBrokerage/FunBrokerageItem.css.ts.vanilla.css?source=LmFuMzR5OTAgewogIGRpc3BsYXk6IGZsZXg7CiAganVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuOwogIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgZmxleDogMTsKfQ */
17349
- [data-rk] .an34y90 {
17350
- display: flex;
17351
- justify-content: space-between;
17352
- align-items: center;
17353
- flex: 1;
17354
- }
17355
-
17356
17348
  /* vanilla-extract-css-ns:src/components/FunCountdown/FunCountdown.css.ts.vanilla.css?source=Ll8xdDBiYzExMSB7CiAgcG9zaXRpb246IGFic29sdXRlOwogIGxlZnQ6IDA7CiAgdG9wOiAwOwogIGJvdHRvbTogMDsKICB0cmFuc2Zvcm06IHJvdGF0ZSgtOTBkZWcpOwp9Ci5fMXQwYmMxMTMgewogIHBvc2l0aW9uOiBhYnNvbHV0ZTsKICBsZWZ0OiAwOwogIHRvcDogMDsKICBib3R0b206IDA7CiAgdHJhbnNmb3JtOiByb3RhdGUoLTkwZGVnKTsKfQ */
17357
17349
  [data-rk] ._1t0bc111 {
17358
17350
  position: absolute;
@@ -17369,6 +17361,14 @@
17369
17361
  transform: rotate(-90deg);
17370
17362
  }
17371
17363
 
17364
+ /* vanilla-extract-css-ns:src/components/FunSelectBrokerage/FunBrokerageItem.css.ts.vanilla.css?source=LmFuMzR5OTAgewogIGRpc3BsYXk6IGZsZXg7CiAganVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuOwogIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgZmxleDogMTsKfQ */
17365
+ [data-rk] .an34y90 {
17366
+ display: flex;
17367
+ justify-content: space-between;
17368
+ align-items: center;
17369
+ flex: 1;
17370
+ }
17371
+
17372
17372
  /* vanilla-extract-css-ns:src/components/SourcePaymentMethodItem/SourcePaymentMethodItem.css.ts.vanilla.css?source=Ll8xeW9mZWZsMCB7CiAgZGlzcGxheTogaW5saW5lLWZsZXg7CiAgYWxpZ24taXRlbXM6IGNlbnRlcjsKICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjsKICBtaW4td2lkdGg6IDdweDsKfQouXzF5b2ZlZmwxIHsKICBwb3NpdGlvbjogcmVsYXRpdmU7Cn0KLl8xeW9mZWZsMSAuXzF5b2ZlZmwyIHsKICBiYWNrZ3JvdW5kOiBsaW5lYXItZ3JhZGllbnQoOTBkZWcsIHRyYW5zcGFyZW50IDYzLjE2JSwgdmFyKC0tcmstY29sb3JzLW9wdGlvbkJveEJhY2tncm91bmQpIDkxLjQ1JSk7Cn0KLl8xeW9mZWZsMTpob3ZlciAuXzF5b2ZlZmwyIHsKICBiYWNrZ3JvdW5kOiBsaW5lYXItZ3JhZGllbnQoOTBkZWcsIHRyYW5zcGFyZW50IDYzLjE2JSwgdmFyKC0tcmstY29sb3JzLW9mZkJhY2tncm91bmQpIDkxLjQ1JSk7Cn0 */
17373
17373
  [data-rk] ._1yofefl0 {
17374
17374
  display: inline-flex;
package/dist/index.d.ts CHANGED
@@ -20,7 +20,7 @@ export { createAuthenticationAdapter, FunkitConnectAuthenticationProvider, } fro
20
20
  export type { AuthenticationAdapter, FunkitConnectAuthenticationProviderProps, } from './providers/AuthenticationContext';
21
21
  export type { AvatarComponent } from './providers/AvatarContext';
22
22
  export type { CheckoutBlockedReason } from './modals/CheckoutModal/CheckoutBlockedReason';
23
- export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, WithdrawalParam, WithdrawalFormData, WithdrawalSourceTokenBalanceParams, WithdrawalSourceCustomData, SourceTokenOption, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, WithdrawalCustomerConfig, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, DestinationLineItem, DestinationLineItemContext, LineItemSlot, LineItemValue, LineItemValueColor, WithdrawalFeeItem, WithdrawalFeeItemContext, } from './providers/FunkitCheckoutContext';
23
+ export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, MultiSourceWithdrawalConfig, WithdrawalSourceOption, SingleWithdrawalConfig, WithdrawalParam, WithdrawalFormData, WithdrawalSourceTokenBalanceParams, WithdrawalSourceCustomData, SourceTokenOption, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, WithdrawalCustomerConfig, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, DestinationLineItem, DestinationLineItemContext, LineItemSlot, LineItemValue, LineItemValueColor, WithdrawalFeeItem, WithdrawalFeeItemContext, } from './providers/FunkitCheckoutContext';
24
24
  export { useFunkitCheckout, FunCheckoutStartingStep, } from './providers/FunkitCheckoutContext';
25
25
  export type { FunkitCheckoutQuoteResult } from './domains/quote';
26
26
  export type { FunkitConfig, FunkitUiCustomizationsConfig, FunkitTextCustomizationsConfig, } from './providers/FunkitConfigContext';
@@ -49,6 +49,7 @@ export type { FunkitConnectWalletConnectParameters, Wallet, WalletDetailsParams,
49
49
  export { createConnectedWithdrawalClient } from './wallets/createConnectedWithdrawalClient';
50
50
  export { useSolanaWithdrawalConfig, type SolanaWithdrawalConfig, } from './wallets/solanaWithdrawal';
51
51
  export { useHypercoreWithdrawalConfig, type HypercoreSigner, type HypercoreWithdrawalOptions, } from './wallets/hypercoreWithdrawal';
52
- export type { ConvertAsset, ConvertConfig, ConvertErrorResult, ConvertErrorStage, ConvertRecipientAddresses, ConvertResolvedAsset, ConvertSourceBalances, ConvertSourceWallet, ConvertSuccessResult, ConvertTransaction, ConvertVm, GetConvertSourceBalances, GetConvertSourceWallet, } from './domains/convert/types';
52
+ export { createMultiSourceWithdrawalConfig, type MultiSourceWithdrawalOptions, } from './wallets/multiSourceWithdrawal';
53
+ export type { ConvertAsset, ConvertConfig, ConvertErrorResult, ConvertErrorStage, ConvertRecipientAddresses, ConvertResolvedAsset, ConvertAssetBalance, ConvertSourceWallet, ConvertSuccessResult, ConvertTransaction, ConvertVm, GetConvertBalances, GetConvertSourceWallet, } from './domains/convert/types';
53
54
  export { useFunkitAccount, useFunkitDisconnect, useFunkitReconnect, useFunkitSwitchChains, } from './providers/GeneralWalletProvider';
54
55
  export { SelectedHomeTab } from './modals/ProfileDetails/FunProfileViews/Home';