/** * TEDL analytics events for Express Checkout. * * Pushes events onto window.tedl.events[] — the same mechanism as * @economist/tedl's emitTedlEvent — without the package dependency. * Avoids pulling a Node-targeted CJS bundle (crypto, sf-entitlement) into a * browser-only Web Component library. * * Event shape matches sma-checkout's pushTedlEvent schema: * { name: 'user.journey', type: 'checkout', action, info: 'applepay', ...extra } * * Event names are aligned to the PRD spec (section 10 — Tracking & Analytics). */ declare global { interface Window { tedl?: { events?: Record[]; [key: string]: unknown; }; } } export declare const EXPRESS_CHECKOUT_EVENTS: { /** Wallet button displayed */ readonly IMPRESSION: "express_wallet_impression"; /** Wallet button clicked */ readonly BUTTON_CLICK: "express_wallet_click"; /** Apple Pay sheet opened */ readonly SHEET_OPEN: "wallet_payment_sheet_open"; /** Payment authorised by the user in the Apple Pay sheet */ readonly AUTHORISED: "wallet_payment_authorised"; /** Purchase completed — BFF returned success */ readonly SUCCESS: "wallet_payment_success"; /** Payment failed — BFF returned error */ readonly FAILURE: "wallet_payment_failure"; /** Redirect to standard checkout (any fallback path) */ readonly FALLBACK_CHECKOUT: "fallback_checkout"; }; /** * Metadata required for the wallet impression event. * Covers the 5 analytics dimensions from the PRD tracking spec: * wallet_type, entry_point, offer_id (sku_id), country, device. */ export type ImpressionMetadata = { /** Entry point where the Apple Pay button appeared — e.g. 'article_paywall', 'homepage_banner'. */ entryPoint: string; /** ISO 3166-1 alpha-2 country code of the offer (e.g. 'GB', 'US'). */ country: string; }; /** Wallet button displayed — emits all 5 required analytics dimensions. */ export declare const trackExpressWalletImpression: (skuId: string, { entryPoint, country }: ImpressionMetadata) => void; /** * Optional metadata for the wallet click event. * `entry_point` is included only when provided so existing one-arg callers stay * payload-compatible. */ export type ClickMetadata = { /** Entry point where the Apple Pay button was clicked — e.g. 'free_trial_banner'. */ entryPoint?: string; }; /** Wallet button clicked */ export declare const trackExpressWalletClick: (skuId: string, { entryPoint }?: ClickMetadata) => void; /** Apple Pay sheet opened (session.begin() called) */ export declare const trackWalletPaymentSheetOpen: (skuId: string) => void; /** Payment authorised by the user in the Apple Pay sheet */ export declare const trackWalletPaymentAuthorised: (skuId: string) => void; /** Purchase completed — BFF returned success */ export declare const trackWalletPaymentSuccess: (skuId: string, basketId: string) => void; /** Payment failed — BFF returned an error */ export declare const trackWalletPaymentFailure: (skuId: string, reason: string) => void; /** Redirect to standard checkout triggered */ export declare const trackFallbackCheckout: (skuId: string) => void; /** Billing/shipping field failed validation (emitted per-field when Apple Pay sheet stays open) */ export declare const trackValidationFieldError: (field: string, errorType: string) => void;