/** * shopifyAtcBridge.ts * * Manages native theme button takeover when `styles.volumeBundle?.addtoCartMethod === 'shopify_atc_button'`. * * Scopes button discovery to the qualified primary product form using a robust scoring algorithm, * preventing accidental targeting of buttons inside recommendation sliders, quick-add cards, or installment forms. * */ export interface ShopifyAtcBridgeConfig { /** Callback invoked when the native Add to Cart button is clicked. */ onAddToCart: () => void | Promise; /** Callback invoked when a native Buy Now / Checkout button is clicked. */ onCheckout?: () => void | Promise; /** Non-null when the currently selected variant combination is out of stock. */ notifyVariant?: { tier: number; index: number; optionIndex?: number; value?: string; } | null; } export interface ShopifyAtcBridgeHandle { cleanup: () => void; } /** * Accurately classifies a candidate element as an Add to Cart button, * a Checkout/Buy-Now button, or an unrelated theme UI button (quantity stepper, * variant swatch/picker, accordion toggle, modal opener, share button, etc.). */ export declare function classifyButton(btn: HTMLElement): "atc" | "checkout" | "ignore"; /** * Initialises the native theme button takeover bridge for the Volume Bundle. * Supports dynamic section re-rendering and AJAX variant updates via: * 1. Capture-phase event delegation at document level * 2. MutationObserver for DOM replacements * 3. Theme custom event listeners (e.g. variant:change, shopify:section:load) */ export declare function initShopifyAtcBridge(config: ShopifyAtcBridgeConfig): ShopifyAtcBridgeHandle; /** * Imperatively tears down all active bridge instances. */ export declare function cleanupShopifyAtcBridge(): void;