import { CheckoutAttributes, CheckoutMethods, CheckoutProperties, CheckoutTarget, TypedEventListener, Checkout, CheckoutLineItem, CheckoutMessage, Total, Buyer, OrderConfirmation, UcpErrorResponse } from './checkout.types'; export declare const DEFAULT_POPUP_WIDTH = 600; export declare const DEFAULT_POPUP_HEIGHT = 600; export declare const EMBED_PROTOCOL_VERSION = "2026-04-08"; export declare const CK_VERSION = "4.0.0"; /** * An element that renders a Shopify Checkout. Checkout opens in a popup or browser tab/window * (see `target`). To use, create a `shopify-checkout` element, set the `src` attribute to the * checkout URL (typically retrieved from the `cart.checkoutUrl` field), and then call `open()`. * * @attribute src - The URL of the checkout to load. * @attribute target - Where the checkout is presented (auto, popup, new tab, or a named window). * * @event checkout:start - Dispatched when the checkout has started * @event checkout:complete - Dispatched when the checkout was successfully completed * @event checkout:error - Dispatched on a session-level fatal error * @event checkout:lineItemsChange - Dispatched when cart line items change * @event checkout:buyerChange - Dispatched when buyer information changes * @event checkout:totalsChange - Dispatched when totals change * @event checkout:messagesChange - Dispatched when checkout messages change * @event checkout:close - Dispatched when the checkout overlay is closed (synthetic, not part of ECP) * * @example * ```js * // Popup target (default) * const cart = await fetchCart(); * const checkout = document.createElement("shopify-checkout"); * checkout.setAttribute("src", cart.checkoutUrl); * document.body.append(checkout); * checkout.open(); * ``` */ export declare class ShopifyCheckout extends HTMLElement implements CheckoutAttributes, CheckoutMethods, CheckoutProperties { #private; static observedAttributes: readonly ["src", "target"]; constructor(); get src(): string; set src(value: string | undefined); /** * Whether the component should log diagnostic messages to the console. */ get debug(): boolean; set debug(value: boolean | string | undefined); get target(): CheckoutTarget | string; set target(value: CheckoutTarget | string | undefined); /** * The latest UCP `Checkout` object received from the embedded checkout. * Populated and updated whenever a notification carrying a `checkout` field * is received (e.g., `ec.start`, `ec.complete`, every `ec.*.change`). * * @returns The current Checkout, or undefined before the first notification. * @example * checkout.addEventListener('checkout:start', (event) => { * const {line_items, totals, buyer} = event.detail.checkout; * }); */ get checkout(): Checkout | undefined; /** * Session-level fatal error received via `ec.error`. * * @returns The UCP error response, or undefined. * @example * checkout.addEventListener('checkout:error', (event) => { * const {messages} = event.detail.error; * console.error(messages[0]?.code, messages[0]?.content); * }); */ get error(): UcpErrorResponse | undefined; /** * Reveals checkout in the target. */ open(): void; close(): void; focus(): void; connectedCallback(): void; disconnectedCallback(): void; attributeChangedCallback(name: (typeof ShopifyCheckout.observedAttributes)[number], oldValue: string, newValue: string): void; addEventListener(type: "checkout:start", listener: TypedEventListener | null, options?: boolean | AddEventListenerOptions): void; addEventListener(type: "checkout:close", listener: TypedEventListener | null, options?: boolean | AddEventListenerOptions): void; addEventListener(type: "checkout:complete", listener: TypedEventListener | null, options?: boolean | AddEventListenerOptions): void; addEventListener(type: "checkout:error", listener: TypedEventListener | null, options?: boolean | AddEventListenerOptions): void; addEventListener(type: "checkout:lineItemsChange", listener: TypedEventListener | null, options?: boolean | AddEventListenerOptions): void; addEventListener(type: "checkout:buyerChange", listener: TypedEventListener | null, options?: boolean | AddEventListenerOptions): void; addEventListener(type: "checkout:totalsChange", listener: TypedEventListener | null, options?: boolean | AddEventListenerOptions): void; addEventListener(type: "checkout:messagesChange", listener: TypedEventListener | null, options?: boolean | AddEventListenerOptions): void; } export interface ShopifyCheckoutStartEventDetail { /** Initial checkout snapshot from the ECP `ec.start` notification. */ checkout: Checkout; } export interface ShopifyCheckoutCompleteEventDetail { /** Final checkout snapshot from the ECP `ec.complete` notification. */ checkout: Checkout; /** Order confirmation populated when checkout completes. */ order: OrderConfirmation; } export interface ShopifyCheckoutErrorEventDetail { /** Wire-shape error payload from the ECP `ec.error` notification. */ error: UcpErrorResponse; } export interface ShopifyCheckoutLineItemsChangeEventDetail { /** Updated cart line items. */ lineItems: readonly CheckoutLineItem[]; /** Full checkout snapshot for handlers that want broader context. */ checkout: Checkout; } export interface ShopifyCheckoutBuyerChangeEventDetail { /** Updated buyer (may be undefined when buyer information is cleared). */ buyer: Buyer | undefined; /** Full checkout snapshot for handlers that want broader context. */ checkout: Checkout; } export interface ShopifyCheckoutTotalsChangeEventDetail { /** Updated totals. */ totals: readonly Total[]; /** Full checkout snapshot for handlers that want broader context. */ checkout: Checkout; } export interface ShopifyCheckoutMessagesChangeEventDetail { /** Updated checkout-level messages (warnings, errors, info). */ messages: readonly CheckoutMessage[]; /** Full checkout snapshot for handlers that want broader context. */ checkout: Checkout; } export declare class ShopifyCheckoutStartEvent extends CustomEvent { type: "checkout:start"; constructor(detail: ShopifyCheckoutStartEventDetail); } export declare class ShopifyCheckoutCompleteEvent extends CustomEvent { type: "checkout:complete"; constructor(detail: ShopifyCheckoutCompleteEventDetail); } export declare class ShopifyCheckoutCloseEvent extends CustomEvent { type: "checkout:close"; constructor(); } export declare class ShopifyCheckoutErrorEvent extends CustomEvent { type: "checkout:error"; constructor(detail: ShopifyCheckoutErrorEventDetail); } export declare class ShopifyCheckoutLineItemsChangeEvent extends CustomEvent { type: "checkout:lineItemsChange"; constructor(detail: ShopifyCheckoutLineItemsChangeEventDetail); } export declare class ShopifyCheckoutBuyerChangeEvent extends CustomEvent { type: "checkout:buyerChange"; constructor(detail: ShopifyCheckoutBuyerChangeEventDetail); } export declare class ShopifyCheckoutTotalsChangeEvent extends CustomEvent { type: "checkout:totalsChange"; constructor(detail: ShopifyCheckoutTotalsChangeEventDetail); } export declare class ShopifyCheckoutMessagesChangeEvent extends CustomEvent { type: "checkout:messagesChange"; constructor(detail: ShopifyCheckoutMessagesChangeEventDetail); }