/**
* useFunnel Hook - Access funnel state and navigation methods
*
* This hook consumes the funnel state from TagadaProvider. All complex
* initialization and session management is handled at the provider level.
*
* Usage:
* ```tsx
* // In your root component or layout:
*
*
*
*
* // In any child component:
* const { context, next, isLoading, stepConfig } = useFunnel();
*
* // Access step-specific config (payment flows, resources, etc.)
* const offerId = stepConfig.resources?.offer;
* const paymentFlowId = stepConfig.paymentFlowId;
* ```
*/
import { FunnelState, GTMTrackingConfig, PixelTrackingConfig, RuntimeStepConfig, SnapchatTrackingConfig, TrackingProvider } from '../../core/funnelClient';
import { FunnelAction, FunnelNavigationResult, SimpleFunnelContext } from '../../core/resources/funnel';
/**
* Step configuration from HTML injection (for current step/variant)
*/
export interface StepConfigValue {
/**
* Full step configuration object
*/
raw: RuntimeStepConfig | undefined;
/**
* Payment flow ID override for this step
* If set, this payment flow should be used instead of the store default
*/
paymentFlowId: string | undefined;
/**
* Resource bindings for this step/variant.
* e.g., { offer: 'offer_xxx', product: 'product_xxx' }
*/
resources: Record | undefined;
/** @deprecated Use `resources` instead */
staticResources: Record | undefined;
/**
* Get scripts for a specific injection position
* Only returns enabled scripts
*/
getScripts: (position?: 'head-start' | 'head-end' | 'body-start' | 'body-end') => RuntimeStepConfig['scripts'];
/**
* Pixel tracking configuration
*/
pixels?: {
[TrackingProvider.FACEBOOK]?: PixelTrackingConfig[];
[TrackingProvider.TIKTOK]?: PixelTrackingConfig[];
[TrackingProvider.SNAPCHAT]?: SnapchatTrackingConfig[];
[TrackingProvider.GTM]?: GTMTrackingConfig[];
};
/**
* Enabled order bump offer IDs for this step.
* undefined = inherit all store bumps, string[] = only these IDs.
*/
orderBumpOfferIds: string[] | undefined;
/**
* Enabled upsell offer IDs for this step.
* undefined = inherit all store upsells, string[] = only these IDs.
*/
upsellOfferIds: string[] | undefined;
}
export interface FunnelContextValue extends FunnelState {
currentStep: {
id: string;
} | null;
stepConfig: StepConfigValue;
next: (event: FunnelAction, options?: {
waitForSession?: boolean;
}) => Promise;
goToStep: (stepId: string) => Promise;
updateContext: (updates: Partial) => Promise;
initializeSession: (entryStepId?: string) => Promise;
endSession: () => Promise;
retryInitialization: () => Promise;
refetch: () => Promise;
}
/**
* Hook to access funnel state and methods
*
* This hook returns the funnel state from TagadaProvider plus step configuration
* from HTML injection. All complex logic is handled at the provider level.
*
* @returns FunnelContextValue with state, methods, and step config
*/
export declare function useFunnel(): FunnelContextValue;