/** * Post Purchases Hook using TanStack Query * Handles post-purchase offers with automatic caching */ import { CheckoutSessionState, CurrencyOptions, OrderSummary, PostPurchaseOffer, PostPurchaseOfferItem, PostPurchaseOfferSummary } from '../../core/resources/postPurchases'; export interface UsePostPurchasesQueryOptions { orderId: string; enabled?: boolean; autoInitializeCheckout?: boolean; } export interface UsePostPurchasesQueryResult { offers: PostPurchaseOffer[] | undefined; isLoading: boolean; error: Error | null; acceptOffer: (offerId: string, items: PostPurchaseOfferItem[]) => Promise<{ success: boolean; summary?: PostPurchaseOfferSummary; error?: string; }>; declineOffer: (offerId: string) => Promise<{ success: boolean; error?: string; }>; previewOffer: (offerId: string, items: PostPurchaseOfferItem[]) => Promise<{ success: boolean; summary?: PostPurchaseOfferSummary; error?: string; }>; refresh: () => void; payWithCheckoutSession: (checkoutSessionId: string, orderId?: string) => Promise; initCheckoutSession: (offerId: string, orderId: string) => Promise<{ checkoutSessionId: string; }>; initCheckoutSessionWithVariants: (offerId: string, orderId: string, lineItems: { variantId: string; quantity: number; }[]) => Promise<{ checkoutSessionId: string; }>; getOffer: (offerId: string) => PostPurchaseOffer | undefined; getTotalValue: () => number; getTotalSavings: () => number; getCheckoutSessionState: (offerId: string) => CheckoutSessionState | null; initializeOfferCheckout: (offerId: string) => Promise; getAvailableVariants: (offerId: string, productId: string) => { variantId: string; variantName: string; variantSku: string | null; variantDefault: boolean | null; variantExternalId: string | null; priceId: string; currencyOptions: CurrencyOptions; }[]; selectVariant: (offerId: string, productId: string, variantId: string) => Promise; getOrderSummary: (offerId: string) => OrderSummary | null; isLoadingVariants: (offerId: string, productId: string) => boolean; isUpdatingOrderSummary: (offerId: string) => boolean; confirmPurchase: (offerId: string, options?: { draft?: boolean; returnUrl?: string; }) => Promise; } export declare function usePostPurchasesQuery(options: UsePostPurchasesQueryOptions): UsePostPurchasesQueryResult;