import type { FormOfPaymentType } from '@funkit/api-base'; import type { PaymentMethod } from '../domains/paymentMethods'; import type { CheckoutModalEvent } from '../hooks/track/CheckoutModalEvent'; import type { WithdrawModalEvent } from '../hooks/track/WithdrawModalEvent'; import type { useTrack } from '../hooks/track/useTrack'; import { FunCheckoutStep } from '../modals/CheckoutModal/FunCheckoutStep'; import type { WithdrawalModalStep } from '../modals/WithdrawalModal/types'; import type { useTrackV2 } from './track/useTrackV2'; import { type AnalyticsFlow } from './track/analytics/events'; /** Shared by the checkout and withdrawal modals — each has its own step enum. */ export type StepReadinessStep = FunCheckoutStep | WithdrawalModalStep; export interface StepQueryMeta extends Record { /** Modal steps that depend on this query being loaded */ dependentSteps: StepReadinessStep[]; /** camelCase identifier for this query, used as key in timing metadata */ name: string; /** Statsig event to emit with this query's individual timing */ timingEvent: CheckoutModalEvent | WithdrawModalEvent; /** This query is currently disabled by a prerequisite expected to resolve. */ enablePending?: boolean; } export declare function stepQueryMeta(params: { name: string; timingEvent: CheckoutModalEvent | WithdrawModalEvent; dependentSteps: StepReadinessStep[]; enablePending?: boolean; }): StepQueryMeta; /** * Ensures all React Query dependencies for a modal step (checkout or * withdrawal) are loaded before marking the step as ready. Queries opt in via * `stepQueryMeta()` in their query options. * * Emits: * - A per-query Statsig event (the query's `timingEvent`) with duration as value * - A step-level measured event (from `readyEventMap`, if provided) with * per-query timing metadata * - {@link AnalyticsEvent.PERF_STEP_READY} with per-query timing metadata * * Steps without dependencies are skipped — no event is emitted. */ export declare function useStepQueryReadiness(params: { checkoutId: string | null; logEvent: ReturnType['logEvent']; logEventV2: ReturnType; logMeasuredEvent: ReturnType['logMeasuredEvent']; /** Flow of the visible step, which may differ from the checkout default. */ flow: AnalyticsFlow; /** Selected payment method, if any, to attach to `fc_perf_step_ready`. */ paymentMethod: PaymentMethod | Lowercase | null; /** Legacy `fc::`/`fw::` step-level event to fire per step, if any. */ readyEventMap?: Partial>; /** * Whether the owning modal is currently open. The modal component stays * mounted across close (`Dialog` just hides it), so an in-flight * `ensureStepQueries` call (e.g. waiting on a disabled query, or awaiting * `ensureQueryData`) would otherwise keep running in the background and * fire a step-ready event well after the user closed the modal. */ isModalOpen: boolean; }): { ensureStepQueries: (step: StepReadinessStep) => Promise; };