/**
 * CDN-hosted Shopify Web Pixel — bundled to `dist/shopify-pixel.min.js` and
 * served from `cdn.syntrologie.com/runtime-sdk/v2/latest/shopify-pixel.min.js`.
 *
 * Merchants install this by pasting a small loader snippet into Shopify admin
 * under Settings → Customer events → Add custom pixel. The loader dynamically
 * loads this file, then calls `window.__SyntroShopifyPixel.register({ analytics, browser })`
 * to wire up subscribers. The indirection means we ship updates to every
 * merchant's pixel by redeploying the CDN file — merchants never re-paste.
 *
 * The pixel's only job is to forward Shopify checkout events to the
 * Syntrologie PostHog proxy with the shopper's distinct_id attached.
 * Experiment attribution is handled server-side by PostHog — once the
 * storefront SDK has fired `$experiment_started` for a distinct_id, PostHog
 * associates all future events from that user (including checkout events
 * this pixel posts) with the correct variant.
 *
 * Shopify custom pixels run in a "lax sandbox" iframe. Script tag injection
 * works (verified by PostHog, Sentry, GTM following the same pattern). The
 * sandbox is re-initialized on every page (storefront, checkout, thank-you),
 * so we cannot keep state across navigation in the pixel itself.
 *
 * Identity is propagated two ways:
 *   - Cookie (`syntro_experiments`): written by `ShopifyPixelBridge` on the
 *     storefront. Readable from the storefront context, sufficient for
 *     `product_added_to_cart`. Not reliable on `checkout_completed` because
 *     `browser.cookie.get()` proxies to the *checkout's* top frame — the
 *     merchant's checkout host (`{shop}/checkouts/...`) for normal flow, or
 *     `shop.app` for Shop Pay — neither of which can see a host-only cookie
 *     on the storefront origin.
 *   - Cart attributes (`_syntro_distinct_id` etc.): also written by
 *     `ShopifyPixelBridge` via the storefront Cart Ajax API. The underscore
 *     prefix hides them from the customer at checkout. Cart attributes travel
 *     with the cart token through every page Shopify orchestrates and arrive
 *     intact in `event.data.checkout.attributes`. This is the reliable path
 *     for `checkout_completed`.
 *
 * All errors swallowed — a pixel failure must never disturb checkout.
 */
interface ShopifyAnalytics {
    subscribe(eventName: string, handler: (event: ShopifyPixelEvent) => void | Promise<void>): void;
}
interface ShopifyBrowserCookie {
    get(name: string): Promise<string | undefined>;
}
interface ShopifyBrowser {
    cookie: ShopifyBrowserCookie;
}
interface ShopifyPixelEvent {
    data: {
        checkout?: {
            totalPrice: {
                amount: string | number;
                currencyCode: string;
            };
            order?: {
                id: string;
            };
            attributes?: ShopifyAttribute[];
        };
        cartLine?: {
            merchandise: {
                id: string;
                product: {
                    id: string;
                };
            };
            quantity: number;
        };
    };
}
interface ShopifyAttribute {
    key: string;
    value: string;
}
export declare function register({ analytics, browser, }: {
    analytics: ShopifyAnalytics;
    browser: ShopifyBrowser;
}): void;
declare global {
    interface Window {
        __SyntroShopifyPixel?: {
            register: typeof register;
        };
    }
}
export {};
