/** * usePreviewOffer - Lightweight offer preview without checkout sessions * * This hook provides a fast, client-side offer preview by: * 1. Fetching offer data with pre-computed summaries * 2. Allowing variant/quantity selection * 3. Recalculating totals on-the-fly without backend calls * 4. NO checkout session creation - perfect for browsing/previewing */ import { Offer } from '../../core/resources/offers'; export interface PreviewLineItemSelection { lineItemId: string; variantId: string; quantity: number; priceId?: string; } export interface PreviewOfferSummary { items: Array<{ id: string; productId: string; variantId: string; priceId: string; productName: string; variantName: string; imageUrl: string | null; quantity: number; unitAmount: number; amount: number; adjustedAmount: number; currency: string; }>; totalAmount: number; totalAdjustedAmount: number; totalPromotionAmount: number; currency: string; options: Record; }>; default: boolean; }>>; } export interface UsePreviewOfferOptions { offerId: string; currency?: string; initialSelections?: Record; } export interface UsePreviewOfferResult { offer: Offer | null; isLoading: boolean; isFetching: boolean; isPaying: boolean; error: Error | null; summary: PreviewOfferSummary | null; selections: Record; selectVariant: (lineItemId: string, variantId: string) => void; updateQuantity: (lineItemId: string, quantity: number) => void; selectVariantByProduct: (productId: string, variantId: string) => void; updateQuantityByProduct: (productId: string, quantity: number) => void; getAvailableVariants: (productId: string) => Array<{ variantId: string; variantName: string; imageUrl: string | null; unitAmount: number; currency: string; }>; pay: (mainOrderId?: string) => Promise<{ checkoutUrl: string; }>; toCheckout: (mainOrderId?: string) => Promise<{ checkoutToken: string; customerId: string; status: 'processing'; }>; } export declare function usePreviewOffer(options: UsePreviewOfferOptions): UsePreviewOfferResult;