// Code generated by jtd-codegen for TypeScript v0.2.1

export interface PixelEventsAdvancedDomAvailableData {
  /**
   * A fragment that contains the entire DOM tree, starting with the document
   * node.
   */
  root: DomFragment;
}

/**
 * The `advanced_dom_available` event logs an instance where the DOM has been
 * loaded and is available for interaction.
 */
export interface PixelEventsAdvancedDomAvailable {
  clientId: ClientId;
  data: PixelEventsAdvancedDomAvailableData;
  id: Id;

  /**
   * The name of the customer event.
   */
  name: 'advanced_dom_available';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

export interface PixelEventsAdvancedDomChangedData {
  /**
   * Array of `DomFragment` added to the document. Each `DomFragment` represents
   * a sub-tree of the document. Use the `parentSerializationId` and the
   * `prevSiblingSerializationId` to reconstruct the document.
   */
  addedFragments: DomFragment[];

  /**
   * Array of `DomNode` that have had their attributes changed. Use the
   * `serializationId` of each to find it and update your own representation of
   * the document.
   */
  modifiedNodes: DomNode[];

  /**
   * Array of `DomNode` removed from the document. Use the `serializationId` of
   * each to find it and remove it from your own representation of the document.
   */
  removedNodes: DomNode[];
}

/**
 * The `advanced_dom_changed` event logs an instance where the DOM has been
 * changed in any way, such as an element being added, removed, or modified.
 */
export interface PixelEventsAdvancedDomChanged {
  clientId: ClientId;
  data: PixelEventsAdvancedDomChangedData;
  id: Id;

  /**
   * The name of the customer event.
   */
  name: 'advanced_dom_changed';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

/**
 * The `advanced_dom_clicked` event logs an instance where any element on the
 * page has been clicked
 */
export interface PixelEventsAdvancedDomClicked {
  clientId: ClientId;
  data: AdvancedMouseEventData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'advanced_dom_clicked';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

/**
 * The action that was taken with the clipboard.
 */
export enum PixelEventsAdvancedDomClipboardDataAction {
  Copy = 'copy',
  Cut = 'cut',
  Paste = 'paste',
}

export interface PixelEventsAdvancedDomClipboardData {
  /**
   * The action that was taken with the clipboard.
   */
  action: PixelEventsAdvancedDomClipboardDataAction;

  /**
   * The node object for the event target.
   */
  node: DomNode;
}

/**
 * The `clipboard` event logs an instance where the user has cut, copied or
 * pasted text to or from the clipboard.
 */
export interface PixelEventsAdvancedDomClipboard {
  clientId: ClientId;
  data: PixelEventsAdvancedDomClipboardData;
  id: Id;

  /**
   * The name of the customer event.
   */
  name: 'advanced_dom_clipboard';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

export interface PixelEventsAdvancedDomFormSubmittedData {
  /**
   * The node object for the event target. In this case, it is the form element
   * that was submitted.
   */
  node: DomNode;
}

/**
 * The `advanced_dom_form_submitted` event logs an instance where a form element
 * on the page has been submitted
 */
export interface PixelEventsAdvancedDomFormSubmitted {
  clientId: ClientId;
  data: PixelEventsAdvancedDomFormSubmittedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'advanced_dom_form_submitted';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

export interface PixelEventsAdvancedDomInputBlurredData {
  /**
   * The node object for the event target.
   */
  node: DomNode;
}

/**
 * The `advanced_dom_input_blurred` event logs an instance where an input,
 * textarea, or select element on the page has lost focus
 */
export interface PixelEventsAdvancedDomInputBlurred {
  clientId: ClientId;
  data: PixelEventsAdvancedDomInputBlurredData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'advanced_dom_input_blurred';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

export interface PixelEventsAdvancedDomInputChangedData {
  /**
   * The node object for the event target.
   */
  node: DomNode;
}

/**
 * The `advanced_dom_input_changed` event logs an instance where an input,
 * textarea, or select element on the page has changed
 */
export interface PixelEventsAdvancedDomInputChanged {
  clientId: ClientId;
  data: PixelEventsAdvancedDomInputChangedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'advanced_dom_input_changed';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

export interface PixelEventsAdvancedDomInputFocusedData {
  /**
   * The node object for the event target.
   */
  node: DomNode;
}

/**
 * The `advanced_dom_input_focused` event logs an instance where an input,
 * textarea, or select element on the page has received focus
 */
export interface PixelEventsAdvancedDomInputFocused {
  clientId: ClientId;
  data: PixelEventsAdvancedDomInputFocusedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'advanced_dom_input_focused';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

/**
 * The `advanced_dom_mouse_moved` event logs an instance where the user has
 * moved the mouse on the page.
 */
export interface PixelEventsAdvancedDomMouseMoved {
  clientId: ClientId;
  data: AdvancedMouseEventData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'advanced_dom_mouse_moved';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

export interface PixelEventsAdvancedDomScrolledData {
  /**
   * The element that is currently being scrolled. Can be either the document or
   * an element on the page.
   */
  node: DomNode;
}

/**
 * The `advanced_dom_scrolled` event logs an instance where the user has
 * scrolled the page or an element on the page.
 */
export interface PixelEventsAdvancedDomScrolled {
  clientId: ClientId;
  data: PixelEventsAdvancedDomScrolledData;
  id: Id;

  /**
   * The name of the customer event.
   */
  name: 'advanced_dom_scrolled';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

export interface PixelEventsAdvancedDomSelectionChangedData {
  /**
   * The node object for the event target.
   */
  node: DomNode;
}

/**
 * The `advanced_dom_selection_changed` event logs an instance where the user
 * has changed the selection of text on the page.
 */
export interface PixelEventsAdvancedDomSelectionChanged {
  clientId: ClientId;
  data: PixelEventsAdvancedDomSelectionChangedData;
  id: Id;

  /**
   * The name of the customer event.
   */
  name: 'advanced_dom_selection_changed';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

/**
 * No additional data is provided by design. Use the event context to get the
 * latest window size.
 */
export interface PixelEventsAdvancedDomWindowResizedData {}

/**
 * The `advanced_dom_window_resized` event logs an instance where the browser
 * window has been resized.
 */
export interface PixelEventsAdvancedDomWindowResized {
  clientId: ClientId;

  /**
   * No additional data is provided by design. Use the event context to get the
   * latest window size.
   */
  data: PixelEventsAdvancedDomWindowResizedData;
  id: Id;

  /**
   * The name of the customer event.
   */
  name: 'advanced_dom_window_resized';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.AdvancedDom;
}

export interface PixelEventsAlertDisplayedData {
  alert: AlertDisplayed;
}

/**
 * The `alert_displayed` event logs an instance of an alert being displayed to
 * a buyer.
 */
export interface PixelEventsAlertDisplayed {
  clientId: ClientId;
  context: Context;
  data: PixelEventsAlertDisplayedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'alert_displayed';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsCartViewedData {
  cart: Cart | null;
}

/**
 * The `cart_viewed` event logs an instance where a customer visited the cart
 * page
 */
export interface PixelEventsCartViewed {
  clientId: ClientId;
  context: Context;
  data: PixelEventsCartViewedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'cart_viewed';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsCheckoutAddressInfoSubmittedData {
  checkout: Checkout;
}

/**
 * The `checkout_address_info_submitted` event logs an instance of a customer
 * submitting their mailing address. This event is only available in checkouts
 * where Checkout Extensibility for customizations is enabled
 */
export interface PixelEventsCheckoutAddressInfoSubmitted {
  clientId: ClientId;
  context: Context;
  data: PixelEventsCheckoutAddressInfoSubmittedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'checkout_address_info_submitted';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsCheckoutCompletedData {
  checkout: Checkout;
}

/**
 * The `checkout_completed` event logs when a visitor completes a purchase. This
 * event is available on the **Order status** and checkout pages
 */
export interface PixelEventsCheckoutCompleted {
  clientId: ClientId;
  context: Context;
  data: PixelEventsCheckoutCompletedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'checkout_completed';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsCheckoutContactInfoSubmittedData {
  checkout: Checkout;
}

/**
 * The `checkout_contact_info_submitted` event logs an instance where a customer
 * submits a checkout form. This event is only available in checkouts where
 * Checkout Extensibility for customizations is enabled
 */
export interface PixelEventsCheckoutContactInfoSubmitted {
  clientId: ClientId;
  context: Context;
  data: PixelEventsCheckoutContactInfoSubmittedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'checkout_contact_info_submitted';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsCheckoutShippingInfoSubmittedData {
  checkout: Checkout;
}

/**
 * The `checkout_shipping_info_submitted` event logs an instance where the
 * customer chooses a shipping rate. This event is only available in checkouts
 * where Checkout Extensibility for customizations is enabled
 */
export interface PixelEventsCheckoutShippingInfoSubmitted {
  clientId: ClientId;
  context: Context;
  data: PixelEventsCheckoutShippingInfoSubmittedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'checkout_shipping_info_submitted';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsCheckoutStartedData {
  checkout: Checkout;
}

/**
 * The `checkout_started` event logs an instance of a customer starting the
 * checkout process. This event is available on the checkout page. For Checkout
 * Extensibility, this event is triggered every time a customer enters checkout.
 * For non-checkout extensible shops, this event is only triggered the first
 * time a customer enters checkout.
 */
export interface PixelEventsCheckoutStarted {
  clientId: ClientId;
  context: Context;
  data: PixelEventsCheckoutStartedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'checkout_started';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

/**
 * The `clicked` event logs an instance where any element on the page has been
 * clicked
 */
export interface PixelEventsClicked {
  clientId: ClientId;
  data: MouseEventData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'clicked';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Dom;
}

export interface PixelEventsCollectionViewedData {
  collection: Collection;
}

/**
 * The `collection_viewed` event logs an instance where a customer visited a
 * product collection index page. This event is available on the online store
 * page
 */
export interface PixelEventsCollectionViewed {
  clientId: ClientId;
  context: Context;
  data: PixelEventsCollectionViewedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'collection_viewed';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsFormSubmittedData {
  element: FormElement;
}

/**
 * The `form_submitted` event logs an instance where a form element on the page
 * has been submitted
 */
export interface PixelEventsFormSubmitted {
  clientId: ClientId;
  data: PixelEventsFormSubmittedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'form_submitted';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Dom;
}

export interface PixelEventsInputBlurredData {
  element: InputElement;
}

/**
 * The `input_blurred` event logs an instance where an input, textarea, or
 * select element on the page has lost focus
 */
export interface PixelEventsInputBlurred {
  clientId: ClientId;
  data: PixelEventsInputBlurredData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'input_blurred';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Dom;
}

export interface PixelEventsInputChangedData {
  element: InputElement;
}

/**
 * The `input_changed` event logs an instance where an input, textarea, or
 * select element on the page has changed
 */
export interface PixelEventsInputChanged {
  clientId: ClientId;
  data: PixelEventsInputChangedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'input_changed';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Dom;
}

export interface PixelEventsInputFocusedData {
  element: InputElement;
}

/**
 * The `input_focused` event logs an instance where an input, textarea, or
 * select element on the page has received focus
 */
export interface PixelEventsInputFocused {
  clientId: ClientId;
  data: PixelEventsInputFocusedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'input_focused';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Dom;
}

/**
 * No additional data is provided by design. Use the event context to get the
 * page metadata. E.g. `event.context.document.location.href`
 */
export interface PixelEventsPageViewedData {}

/**
 * The `page_viewed` event logs an instance where a customer visited a page.
 * This event is available on the online store, checkout, and **Order status**
 * pages
 */
export interface PixelEventsPageViewed {
  clientId: ClientId;
  context: Context;

  /**
   * No additional data is provided by design. Use the event context to get the
   * page metadata. E.g. `event.context.document.location.href`
   */
  data: PixelEventsPageViewedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'page_viewed';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsPaymentInfoSubmittedData {
  checkout: Checkout;
}

/**
 * The `payment_info_submitted` event logs an instance of a customer submitting
 * their payment information. This event is available on the checkout page
 */
export interface PixelEventsPaymentInfoSubmitted {
  clientId: ClientId;
  context: Context;
  data: PixelEventsPaymentInfoSubmittedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'payment_info_submitted';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsProductAddedToCartData {
  cartLine: CartLine | null;
}

/**
 * The `product_added_to_cart` event logs an instance where a customer adds a
 * product to their cart. This event is available on the online store page
 */
export interface PixelEventsProductAddedToCart {
  clientId: ClientId;
  context: Context;
  data: PixelEventsProductAddedToCartData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'product_added_to_cart';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsProductRemovedFromCartData {
  cartLine: CartLine | null;
}

/**
 * The `product_removed_from_cart` event logs an instance where a customer
 * removes a product from their cart. This event is available on the online
 * store page
 */
export interface PixelEventsProductRemovedFromCart {
  clientId: ClientId;
  context: Context;
  data: PixelEventsProductRemovedFromCartData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'product_removed_from_cart';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsProductViewedData {
  productVariant: ProductVariant;
}

/**
 * The `product_viewed` event logs an instance where a customer visited a
 * product details page. This event is available on the product page
 */
export interface PixelEventsProductViewed {
  clientId: ClientId;
  context: Context;
  data: PixelEventsProductViewedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'product_viewed';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsSearchSubmittedData {
  searchResult: SearchResult;
}

/**
 * The `search_submitted` event logs an instance where a customer performed a
 * search on the storefront. This event is available on the online store page
 */
export interface PixelEventsSearchSubmitted {
  clientId: ClientId;
  context: Context;
  data: PixelEventsSearchSubmittedData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'search_submitted';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEventsUiExtensionErroredData {
  error: UiExtensionError;
}

/**
 * The `ui_extension_errored` event logs an instance of a UI extension
 * encountering an error.
 */
export interface PixelEventsUiExtensionErrored {
  clientId: ClientId;
  context: Context;
  data: PixelEventsUiExtensionErroredData;
  id: Id;

  /**
   * The name of the customer event
   */
  name: 'ui_extension_errored';

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Standard;
}

export interface PixelEvents {
  /**
   * The `advanced_dom_available` event logs an instance where the DOM has been
   * loaded and is available for interaction.
   */
  advanced_dom_available: PixelEventsAdvancedDomAvailable;

  /**
   * The `advanced_dom_changed` event logs an instance where the DOM has been
   * changed in any way, such as an element being added, removed, or modified.
   */
  advanced_dom_changed: PixelEventsAdvancedDomChanged;

  /**
   * The `advanced_dom_clicked` event logs an instance where any element on the
   * page has been clicked
   */
  advanced_dom_clicked: PixelEventsAdvancedDomClicked;

  /**
   * The `clipboard` event logs an instance where the user has cut, copied or
   * pasted text to or from the clipboard.
   */
  advanced_dom_clipboard: PixelEventsAdvancedDomClipboard;

  /**
   * The `advanced_dom_form_submitted` event logs an instance where a form
   * element on the page has been submitted
   */
  advanced_dom_form_submitted: PixelEventsAdvancedDomFormSubmitted;

  /**
   * The `advanced_dom_input_blurred` event logs an instance where an input,
   * textarea, or select element on the page has lost focus
   */
  advanced_dom_input_blurred: PixelEventsAdvancedDomInputBlurred;

  /**
   * The `advanced_dom_input_changed` event logs an instance where an input,
   * textarea, or select element on the page has changed
   */
  advanced_dom_input_changed: PixelEventsAdvancedDomInputChanged;

  /**
   * The `advanced_dom_input_focused` event logs an instance where an input,
   * textarea, or select element on the page has received focus
   */
  advanced_dom_input_focused: PixelEventsAdvancedDomInputFocused;

  /**
   * The `advanced_dom_mouse_moved` event logs an instance where the user has
   * moved the mouse on the page.
   */
  advanced_dom_mouse_moved: PixelEventsAdvancedDomMouseMoved;

  /**
   * The `advanced_dom_scrolled` event logs an instance where the user has
   * scrolled the page or an element on the page.
   */
  advanced_dom_scrolled: PixelEventsAdvancedDomScrolled;

  /**
   * The `advanced_dom_selection_changed` event logs an instance where the user
   * has changed the selection of text on the page.
   */
  advanced_dom_selection_changed: PixelEventsAdvancedDomSelectionChanged;

  /**
   * The `advanced_dom_window_resized` event logs an instance where the browser
   * window has been resized.
   */
  advanced_dom_window_resized: PixelEventsAdvancedDomWindowResized;

  /**
   * The `alert_displayed` event logs an instance of an alert being displayed to
   * a buyer.
   */
  alert_displayed: PixelEventsAlertDisplayed;

  /**
   * The `cart_viewed` event logs an instance where a customer visited the cart
   * page
   */
  cart_viewed: PixelEventsCartViewed;

  /**
   * The `checkout_address_info_submitted` event logs an instance of a customer
   * submitting their mailing address. This event is only available in checkouts
   * where Checkout Extensibility for customizations is enabled
   */
  checkout_address_info_submitted: PixelEventsCheckoutAddressInfoSubmitted;

  /**
   * The `checkout_completed` event logs when a visitor completes a purchase.
   * This event is available on the **Order status** and checkout pages
   */
  checkout_completed: PixelEventsCheckoutCompleted;

  /**
   * The `checkout_contact_info_submitted` event logs an instance where a
   * customer submits a checkout form. This event is only available in checkouts
   * where Checkout Extensibility for customizations is enabled
   */
  checkout_contact_info_submitted: PixelEventsCheckoutContactInfoSubmitted;

  /**
   * The `checkout_shipping_info_submitted` event logs an instance where the
   * customer chooses a shipping rate. This event is only available in checkouts
   * where Checkout Extensibility for customizations is enabled
   */
  checkout_shipping_info_submitted: PixelEventsCheckoutShippingInfoSubmitted;

  /**
   * The `checkout_started` event logs an instance of a customer starting
   * the checkout process. This event is available on the checkout page. For
   * Checkout Extensibility, this event is triggered every time a customer
   * enters checkout. For non-checkout extensible shops, this event is only
   * triggered the first time a customer enters checkout.
   */
  checkout_started: PixelEventsCheckoutStarted;

  /**
   * The `clicked` event logs an instance where any element on the page has
   * been clicked
   */
  clicked: PixelEventsClicked;

  /**
   * The `collection_viewed` event logs an instance where a customer visited a
   * product collection index page. This event is available on the online store
   * page
   */
  collection_viewed: PixelEventsCollectionViewed;

  /**
   * The `form_submitted` event logs an instance where a form element on the
   * page has been submitted
   */
  form_submitted: PixelEventsFormSubmitted;

  /**
   * The `input_blurred` event logs an instance where an input, textarea, or
   * select element on the page has lost focus
   */
  input_blurred: PixelEventsInputBlurred;

  /**
   * The `input_changed` event logs an instance where an input, textarea, or
   * select element on the page has changed
   */
  input_changed: PixelEventsInputChanged;

  /**
   * The `input_focused` event logs an instance where an input, textarea, or
   * select element on the page has received focus
   */
  input_focused: PixelEventsInputFocused;

  /**
   * The `page_viewed` event logs an instance where a customer visited a page.
   * This event is available on the online store, checkout, and **Order status**
   * pages
   */
  page_viewed: PixelEventsPageViewed;

  /**
   * The `payment_info_submitted` event logs an instance of a customer
   * submitting their payment information. This event is available on the
   * checkout page
   */
  payment_info_submitted: PixelEventsPaymentInfoSubmitted;

  /**
   * The `product_added_to_cart` event logs an instance where a customer adds a
   * product to their cart. This event is available on the online store page
   */
  product_added_to_cart: PixelEventsProductAddedToCart;

  /**
   * The `product_removed_from_cart` event logs an instance where a customer
   * removes a product from their cart. This event is available on the online
   * store page
   */
  product_removed_from_cart: PixelEventsProductRemovedFromCart;

  /**
   * The `product_viewed` event logs an instance where a customer visited a
   * product details page. This event is available on the product page
   */
  product_viewed: PixelEventsProductViewed;

  /**
   * The `search_submitted` event logs an instance where a customer performed a
   * search on the storefront. This event is available on the online store page
   */
  search_submitted: PixelEventsSearchSubmitted;

  /**
   * The `ui_extension_errored` event logs an instance of a UI extension
   * encountering an error.
   */
  ui_extension_errored: PixelEventsUiExtensionErrored;
}

/**
 * An object that contains data about a mouse event.
 */
export interface AdvancedMouseEventData {
  clientX: number;
  clientY: number;
  movementX: number;
  movementY: number;

  /**
   * The node object for the event target.
   */
  node: DomNode;
  offsetX: number;
  offsetY: number;
  pageX: number;
  pageY: number;
  screenX: number;
  screenY: number;
}

/**
 * An object that contains information about an alert that was displayed to
 * a buyer.
 */
export interface AlertDisplayed {
  /**
   * The message that was displayed to the user.
   */
  message: string;

  /**
   * The part of the page the alert relates to.
   * Follows the [Shopify Functions target
   * format](https://shopify.dev/docs/api/functions/reference/cart-checkout-
   * validation/graphql#supported-checkout-field-targets), for example
   * `cart.deliveryGroups[0].deliveryAddress.address1`.
   */
  target: string;

  /**
   * The type of alert that was displayed.
   */
  type: AlertDisplayedType;

  /**
   * The value of the field at the time the alert was displayed or null if the
   * alert did not relate to an individual field.
   */
  value: string | null;
}

export enum AlertDisplayedType {
  /**
   * An alert related to general checkout issue was displayed.
   */
  CheckoutError = 'CHECKOUT_ERROR',

  /**
   * An alert related to a contact information issue was displayed.
   */
  ContactError = 'CONTACT_ERROR',

  /**
   * An alert related to a delivery issue was displayed.
   */
  DeliveryError = 'DELIVERY_ERROR',

  /**
   * An alert related to a discount code or gift card issue was displayed.
   */
  DiscountError = 'DISCOUNT_ERROR',

  /**
   * The input provided is incorrect or improperly formatted.
   */
  InputInvalid = 'INPUT_INVALID',

  /**
   * A required field is empty.
   */
  InputRequired = 'INPUT_REQUIRED',

  /**
   * An alert related to an inventory issue was displayed.
   */
  InventoryError = 'INVENTORY_ERROR',

  /**
   * An alert related to a merchandise issue was displayed.
   */
  MerchandiseError = 'MERCHANDISE_ERROR',

  /**
   * An alert related to a payment issue was displayed.
   */
  PaymentError = 'PAYMENT_ERROR',
}

/**
 * Custom attributes associated with the cart or checkout.
 */
export interface Attribute {
  /**
   * The key for the attribute.
   */
  key: string;

  /**
   * The value for the attribute.
   */
  value: string;
}

/**
 * This object replaces the native document.cookie API and provides a
 * setter/getter to set cookies on the top frame.
 */
export interface BrowserCookie {
  /**
   * An asynchronous method to get a specific cookie by name. Takes a cookie
   * name of type `string` and returns the cookie value as a `string`
   */
  get: (name?: string) => Promise<string>;

  /**
   * An asynchronous method to set a cookie by name. It
   * takes two arguments, a string of form `key=value` as
   * [described here](https://developer.mozilla.org/en-
   * US/docs/Web/API/Document/cookie#write_a_new_cookie) or the name of the
   * cookie as the first argument and the value as the second argument.
   */
  set: (cookieOrName: string, value?: string) => Promise<string>;
}

export interface BrowserLocalStorage {
  /**
   * When invoked, will empty all keys out of the storage.
   */
  clear: () => Promise<ReturnType<WindowLocalStorage['localStorage']['clear']>>;

  /**
   * When passed a key name, will return that key's value.
   */
  getItem: (
    key: string,
  ) => Promise<ReturnType<WindowLocalStorage['localStorage']['getItem']>>;

  /**
   * When passed a number n, this method will return the name of the nth key in
   * the storage.
   */
  key: (
    index: number,
  ) => Promise<ReturnType<WindowLocalStorage['localStorage']['key']>>;

  /**
   * Returns an integer representing the number of data items stored in the
   * Storage object.
   */
  length: () => Promise<WindowLocalStorage['localStorage']['length']>;

  /**
   * When passed a key name, will remove that key from the storage.
   */
  removeItem: (
    key: string,
  ) => Promise<ReturnType<WindowLocalStorage['localStorage']['removeItem']>>;

  /**
   * When passed a key name and value, will add that key to the storage, or
   * update that key's value if it already exists.
   */
  setItem: (
    key: string,
    value: any,
  ) => Promise<ReturnType<WindowLocalStorage['localStorage']['setItem']>>;
}

export interface BrowserSessionStorage {
  /**
   * When invoked, will empty all keys out of the storage.
   */
  clear: () => Promise<
    ReturnType<WindowSessionStorage['sessionStorage']['clear']>
  >;

  /**
   * When passed a key name, will return that key's value.
   */
  getItem: (
    key: string,
  ) => Promise<ReturnType<WindowSessionStorage['sessionStorage']['getItem']>>;

  /**
   * When passed a number n, this method will return the name of the nth key in
   * the storage.
   */
  key: (
    index: number,
  ) => Promise<ReturnType<WindowSessionStorage['sessionStorage']['key']>>;

  /**
   * Returns an integer representing the number of data items stored in the
   * Storage object.
   */
  length: () => Promise<WindowSessionStorage['sessionStorage']['length']>;

  /**
   * When passed a key name, will remove that key from the storage.
   */
  removeItem: (
    key: string,
  ) => Promise<
    ReturnType<WindowSessionStorage['sessionStorage']['removeItem']>
  >;

  /**
   * When passed a key name and value, will add that key to the storage, or
   * update that key's value if it already exists.
   */
  setItem: (
    key: string,
    value: any,
  ) => Promise<ReturnType<WindowSessionStorage['sessionStorage']['setItem']>>;
}

export interface Browser {
  /**
   * This object replaces the native document.cookie API and provides a
   * setter/getter to set cookies on the top frame.
   */
  cookie: BrowserCookie;
  localStorage: BrowserLocalStorage;

  /**
   * @deprecated The navigator.sendBeacon() method asynchronously sends an HTTP
   * POST request containing a small amount of data to a web server. Please use
   * the standard web `fetch` api with the option `keepalive: true` to achieve
   * this functionality.
   */
  sendBeacon: (url: string, body?: string) => Promise<boolean>;
  sessionStorage: BrowserSessionStorage;
}

/**
 * A cart represents the merchandise that a customer intends to purchase, and
 * the estimated cost associated with the cart.
 */
export interface Cart {
  /**
   * The attributes associated with the cart. This property
   * is only available if the shop has [upgraded to Checkout
   * Extensibility](https://help.shopify.com/en/manual/checkout-
   * settings/checkout-extensibility/checkout-upgrade).
   */
  attributes: Attribute[];

  /**
   * The estimated costs that the customer will pay at checkout.
   */
  cost: CartCost;

  /**
   * A globally unique identifier.
   */
  id: string | null;

  /**
   * A list of lines containing information about the items the customer intends
   * to purchase.
   */
  lines: CartLine[];

  /**
   * The total number of items in the cart.
   */
  totalQuantity: number;
}

/**
 * The costs that the customer will pay at checkout. It uses
 * [`CartBuyerIdentity`](https://shopify.dev/api/storefront/reference/cart/cartb
 * uyeridentity) to determine [international pricing](https://shopify.dev/custom-
 * storefronts/internationalization/international-pricing#create-a-cart).
 */
export interface CartCost {
  /**
   * The total amount for the customer to pay.
   */
  totalAmount: MoneyV2;
}

/**
 * Information about the merchandise in the cart.
 */
export interface CartLine {
  /**
   * The cost of the merchandise that the customer will pay for at checkout. The
   * costs are subject to change and changes will be reflected at checkout.
   */
  cost: CartLineCost;

  /**
   * The merchandise that the buyer intends to purchase.
   */
  merchandise: ProductVariant;

  /**
   * The quantity of the merchandise that the customer intends to purchase.
   */
  quantity: number;
}

/**
 * The cost of the merchandise line that the customer will pay at checkout.
 */
export interface CartLineCost {
  /**
   * The total cost of the merchandise line.
   */
  totalAmount: MoneyV2;
}

/**
 * A container for all the information required to add items to checkout and
 * pay.
 */
export interface Checkout {
  /**
   * A list of attributes accumulated throughout the checkout process.
   */
  attributes: Attribute[];

  /**
   * The billing address to where the order will be charged.
   */
  billingAddress: MailingAddress | null;

  /**
   * Indicates whether the customer has consented to be sent marketing material
   * via email. This property is only available if the shop has [upgraded
   * to Checkout Extensibility](https://help.shopify.com/en/manual/checkout-
   * settings/checkout-extensibility/checkout-upgrade).
   */
  buyerAcceptsEmailMarketing: boolean;

  /**
   * Indicates whether the customer has consented to be sent marketing material
   * via SMS. This property is only available if the shop has [upgraded to
   * Checkout Extensibility](https://help.shopify.com/en/manual/checkout-
   * settings/checkout-extensibility/checkout-upgrade).
   */
  buyerAcceptsSmsMarketing: boolean;

  /**
   * The three-letter code that represents the currency, for example, USD.
   * Supported codes include standard ISO 4217 codes, legacy codes, and non-
   * standard codes.
   */
  currencyCode: string | null;

  /**
   * Represents the selected delivery options for a checkout. This
   * property is only available if the shop has [upgraded to Checkout
   * Extensibility](https://help.shopify.com/en/manual/checkout-
   * settings/checkout-extensibility/checkout-upgrade).
   */
  delivery: Delivery | null;

  /**
   * A list of discount applications.
   */
  discountApplications: DiscountApplication[];

  /**
   * The total amount of the discounts applied to the price of the checkout.
   * This property is only available if the shop has [upgraded to Checkout
   * Extensibility](https://help.shopify.com/manual/checkout-settings/checkout-
   * extensibility/checkout-upgrade).
   */
  discountsAmount: MoneyV2 | null;

  /**
   * The email attached to this checkout.
   */
  email: string | null;

  /**
   * A list of line item objects, each one containing information about an item
   * in the checkout.
   */
  lineItems: CheckoutLineItem[];

  /**
   * Information about the active localized experience. This
   * property is only available if the shop has [upgraded to Checkout
   * Extensibility](https://help.shopify.com/en/manual/checkout-
   * settings/checkout-extensibility/checkout-upgrade).
   */
  localization: Localization;

  /**
   * The resulting order from a paid checkout.
   */
  order: Order | null;

  /**
   * A unique phone number for the customer. Formatted using E.164 standard. For
   * example, *+16135551111*.
   */
  phone: string | null;

  /**
   * The shipping address to where the line items will be shipped.
   */
  shippingAddress: MailingAddress | null;

  /**
   * Once a shipping rate is selected by the customer it is transitioned to a
   * `shipping_line` object.
   */
  shippingLine: ShippingRate | null;

  /**
   * The phone number provided by the buyer after opting in to SMS
   * marketing. This property is only available if the shop has [upgraded
   * to Checkout Extensibility](https://help.shopify.com/en/manual/checkout-
   * settings/checkout-extensibility/checkout-upgrade).
   */
  smsMarketingPhone: string | null;

  /**
   * The price at checkout before duties, shipping, and taxes.
   */
  subtotalPrice: MoneyV2 | null;

  /**
   * A unique identifier for a particular checkout.
   */
  token: string | null;

  /**
   * The sum of all the prices of all the items in the checkout, including
   * duties, taxes, and discounts.
   */
  totalPrice: MoneyV2 | null;

  /**
   * The sum of all the taxes applied to the line items and shipping lines in
   * the checkout.
   */
  totalTax: MoneyV2;

  /**
   * A list of transactions associated with a checkout or order. Certain
   * transactions, such as credit card transactions, may only be present in the
   * checkout_completed event.
   */
  transactions: Transaction[];
}

/**
 * A single line item in the checkout, grouped by variant and attributes.
 */
export interface CheckoutLineItem {
  /**
   * The discounts that have been applied to the checkout line item by a
   * discount application.
   */
  discountAllocations: DiscountAllocation[];

  /**
   * The combined price of all of the items in the line item
   * after line-level discounts have been applied. This property
   * is only available if the shop has [upgraded to Checkout
   * Extensibility](https://help.shopify.com/manual/checkout-settings/checkout-
   * extensibility/checkout-upgrade).
   */
  finalLinePrice: MoneyV2;

  /**
   * A globally unique identifier.
   */
  id: string | null;

  /**
   * The properties of the line item. A shop may add, or enable customers to add
   * custom information to a line item. Line item properties consist of a key
   * and value pair. This property is only available if the shop has [upgraded
   * to Checkout Extensibility](https://help.shopify.com/manual/checkout-
   * settings/checkout-extensibility/checkout-upgrade).
   */
  properties: Property[];

  /**
   * The quantity of the line item.
   */
  quantity: number;

  /**
   * The selling plan associated with the line item and the effect that
   * each selling plan has on variants when they're purchased. This
   * property is only available if the shop has [upgraded to Checkout
   * Extensibility](https://help.shopify.com/manual/checkout-settings/checkout-
   * extensibility/checkout-upgrade).
   */
  sellingPlanAllocation: SellingPlanAllocation | null;

  /**
   * The title of the line item. Defaults to the product's title.
   */
  title: string | null;

  /**
   * Product variant of the line item.
   */
  variant: ProductVariant | null;
}

/**
 * The client-side ID of the customer, provided by Shopify
 */
export type ClientId = string;

/**
 * An object that contains data about an element coordinates in a viewport.
 */
export interface ClientRect {
  height: number;
  width: number;
  x: number;
  y: number;
}

/**
 * A collection is a group of products that a shop owner can create to organize
 * them or make their shops easier to browse.
 */
export interface Collection {
  /**
   * A globally unique identifier.
   */
  id: string;
  productVariants: ProductVariant[];

  /**
   * The collection’s name. Maximum length: 255 characters.
   */
  title: string;
}

/**
 * A snapshot of various read-only properties of the browser at the time of
 * event
 */
export interface Context {
  /**
   * Snapshot of a subset of properties of the `document` object in the top
   * frame of the browser
   */
  document: WebPixelsDocument;

  /**
   * Snapshot of a subset of properties of the `navigator` object in the top
   * frame of the browser
   */
  navigator: WebPixelsNavigator;

  /**
   * Snapshot of a subset of properties of the `window` object in the top frame
   * of the browser
   */
  window: WebPixelsWindow;
}

/**
 * A country.
 */
export interface Country {
  /**
   * The ISO-3166-1 code for this country, for example, "US".
   */
  isoCode: string | null;
}

/**
 * A free-form object representing data specific to a custom event provided by
 * the custom event publisher
 */
export type CustomData = Record<string, unknown>;

/**
 * This event represents any custom events emitted by partners or merchants via
 * the `publish` method
 */
export interface CustomEvent {
  clientId: ClientId;
  context: Context;
  customData: CustomData | null;
  id: Id;

  /**
   * Arbitrary name of the custom event
   */
  name: string;

  /**
   * The sequence index number of the event.
   */
  seq: number;
  timestamp: Timestamp;
  type: EventType.Custom;
}

/**
 * A customer represents a customer account with the shop. Customer accounts
 * store contact information for the customer, saving logged-in customers the
 * trouble of having to provide it at every checkout.
 */
export interface Customer {
  /**
   * The customer’s email address.
   */
  email: string | null;

  /**
   * The customer’s first name.
   */
  firstName: string | null;

  /**
   * The ID of the customer.
   */
  id: string;

  /**
   * The customer’s last name.
   */
  lastName: string | null;

  /**
   * The total number of orders that the customer has placed.
   */
  ordersCount: number | null;

  /**
   * The customer’s phone number.
   */
  phone: string | null;
}

/**
 * A free-form object representing data specific to this event provided by
 * Shopify. Refer to [standard events](#standard-events) for details on the
 * payload available to each event
 */
export type Data = Record<string, unknown>;

/**
 * The delivery information for the event.
 */
export interface Delivery {
  /**
   * The selected delivery options for the event.
   */
  selectedDeliveryOptions: DeliveryOption[];
}

/**
 * Represents a delivery option that the customer can choose from.
 */
export interface DeliveryOption {
  /**
   * The cost of the delivery option.
   */
  cost: MoneyV2 | null;

  /**
   * The cost of the delivery option after discounts have been applied.
   */
  costAfterDiscounts: MoneyV2 | null;

  /**
   * The description of the delivery option.
   */
  description: string | null;

  /**
   * The unique identifier of the delivery option.
   */
  handle: string;

  /**
   * The title of the delivery option.
   */
  title: string | null;

  /**
   * The type of delivery option.
   *
   * - `pickup`
   * - `pickupPoint`
   * - `shipping`
   * - `local`
   */
  type: string;
}

/**
 * The discount that has been applied to the checkout line item.
 */
export interface DiscountAllocation {
  /**
   * The monetary value with currency allocated to the discount.
   */
  amount: MoneyV2;

  /**
   * The information about the intent of the discount.
   */
  discountApplication: DiscountApplication;
}

/**
 * The information about the intent of the discount.
 */
export interface DiscountApplication {
  /**
   * The method by which the discount's value is applied to its entitled items.
   *
   * - `ACROSS`: The value is spread across all entitled lines.
   * - `EACH`: The value is applied onto every entitled line.
   */
  allocationMethod: string;

  /**
   * How the discount amount is distributed on the discounted lines.
   *
   * - `ALL`: The discount is allocated onto all the lines.
   * - `ENTITLED`: The discount is allocated onto only the lines that it's
   * entitled for.
   * - `EXPLICIT`: The discount is allocated onto explicitly chosen lines.
   */
  targetSelection: string;

  /**
   * The type of line (i.e. line item or shipping line) on an order that the
   * discount is applicable towards.
   *
   * - `LINE_ITEM`: The discount applies onto line items.
   * - `SHIPPING_LINE`: The discount applies onto shipping lines.
   */
  targetType: string;

  /**
   * The customer-facing name of the discount. If the type of discount is
   * a `DISCOUNT_CODE`, this `title` attribute represents the code of the
   * discount.
   */
  title: string;

  /**
   * The type of the discount.
   *
   * - `AUTOMATIC`: A discount automatically at checkout or in the cart without
   * the need for a code.
   * - `DISCOUNT_CODE`: A discount applied onto checkouts through the use of
   * a code.
   * - `MANUAL`: A discount that is applied to an order by a merchant or store
   * owner manually, rather than being automatically applied by the system or
   * through a script.
   * - `SCRIPT`: A discount applied to a customer's order using a script
   */
  type: string;

  /**
   * The value of the discount. Fixed discounts return a `Money` Object, while
   * Percentage discounts return a `PricingPercentageValue` object.
   */
  value: MoneyV2 | PricingPercentageValue;
}

/**
 * Representation of a sub-tree of the host document.
 */
export interface DomFragment {
  /**
   * Array of `DomFragment` representing children of the parent `DomFragment`.
   */
  children: DomFragment[];

  /**
   * The node object of the `DomFragment`.
   */
  node: DomNode;

  /**
   * The serialization ID of the parent node. -1 if there are no parents.
   */
  parentSerializationId: number;

  /**
   * The serialization ID of the previous sibling node. -1 if there are no
   * previous siblings.
   */
  prevSiblingSerializationId: number;
}

/**
 * Representation of a node in the document.
 */
export interface DomNode {
  /**
   * The type of node based on the native DOM API's
   * [`nodeType`](https://developer.mozilla.org/en-
   * US/docs/Web/API/Node/nodeType) values. It distinguishes different kind of
   * nodes from each other, such as elements, text and comments.
   */
  nodeType: number;

  /**
   * The serialization id of the node. This is a unique identifier for the node
   * based on its stable reference in the host DOM tree.
   */
  serializationId: number;

  /**
   * A dictionary of attributes of an element. Only available on element nodes.
   */
  attributes?: {[key: string]: string};

  /**
   * The checked state of an element. Only available on input element nodes.
   */
  checked?: boolean;

  /**
   * The coordinates of the element in the viewport. Only available on element
   * nodes.
   */
  clientRect?: ClientRect;

  /**
   * The scroll coordinates of the element in the viewport. Only available on
   * element nodes.
   */
  scroll?: ClientRect;

  /**
   * A string representation of the tag of a node. Only available on element
   * nodes.
   */
  tagName?: string;

  /**
   * The text content of an element. Only available on text nodes.
   */
  textContent?: string;
}

export enum EventType {
  AdvancedDom = 'advanced-dom',
  Custom = 'custom',
  Dom = 'dom',
  Meta = 'meta',
  Standard = 'standard',
}

/**
 * An object that contains data about a form element type
 */
export interface FormElement {
  /**
   * The action attribute of a form element
   */
  action: string | null;
  elements: InputElement[];

  /**
   * The id attribute of an element
   */
  id: string | null;
}

/**
 * An object that contains data about a generic element type
 */
export interface GenericElement {
  /**
   * The href attribute of an element
   */
  href: string | null;

  /**
   * The id attribute of an element
   */
  id: string | null;

  /**
   * The name attribute of an element
   */
  name: string | null;

  /**
   * A string representation of the tag of an element
   */
  tagName: string | null;

  /**
   * The type attribute of an element. Often relevant for an input or button
   * element.
   */
  type: string | null;

  /**
   * The value attribute of an element. Often relevant for an input element.
   */
  value: string | null;
}

/**
 * The ID of the customer event
 */
export type Id = string;

/**
 * An image resource.
 */
export interface Image {
  /**
   * The location of the image as a URL.
   */
  src: string | null;
}

export interface InitData {
  cart: Cart | null;
  checkout: Checkout | null;
  customer: Customer | null;
  productVariants: ProductVariant[] | null;
  purchasingCompany: PurchasingCompany | null;
  shop: Shop;
}

/**
 * An object that contains data about an input element type
 */
export interface InputElement {
  /**
   * The id attribute of an element
   */
  id: string | null;

  /**
   * The name attribute of an element
   */
  name: string | null;

  /**
   * A string representation of the tag of an element
   */
  tagName: string | null;

  /**
   * The type attribute of an element. Often relevant for an input or button
   * element.
   */
  type: string | null;

  /**
   * The value attribute of an element. Often relevant for an input element.
   */
  value: string | null;
}

/**
 * A language.
 */
export interface Language {
  /**
   * The BCP-47 language tag. It may contain a dash followed by an ISO 3166-1
   * alpha-2 region code, for example, "en-US".
   */
  isoCode: string;
}

/**
 * Information about the active localized experience.
 */
export interface Localization {
  /**
   * The country of the active localized experience.
   */
  country: Country;

  /**
   * The language of the active localized experience.
   */
  language: Language;

  /**
   * The market including the country of the active localized experience.
   */
  market: Market;
}

/**
 * A snapshot of a subset of properties of the `location` object in the top
 * frame of the browser
 */
export interface Location {
  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), a
   * string containing a `'#'` followed by the fragment identifier of the URL
   */
  hash: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), a
   * string containing the host, that is the hostname, a `':'`, and the port of
   * the URL
   */
  host: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), a
   * string containing the domain of the URL
   */
  hostname: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), a
   * string containing the entire URL
   */
  href: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), a
   * string containing the canonical form of the origin of the specific location
   */
  origin: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), a
   * string containing an initial `'/'` followed by the path of the URL, not
   * including the query string or fragment
   */
  pathname: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), a
   * string containing the port number of the URL
   */
  port: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), a
   * string containing the protocol scheme of the URL, including the final `':'`
   */
  protocol: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location), a
   * string containing a `'?'` followed by the parameters or "querystring" of
   * the URL
   */
  search: string;
}

/**
 * A mailing address for customers and shipping.
 */
export interface MailingAddress {
  /**
   * The first line of the address. This is usually the street address or a P.O.
   * Box number.
   */
  address1: string | null;

  /**
   * The second line of the address. This is usually an apartment, suite, or
   * unit number.
   */
  address2: string | null;

  /**
   * The name of the city, district, village, or town.
   */
  city: string | null;

  /**
   * The name of the country.
   */
  country: string | null;

  /**
   * The two-letter code that represents the country, for example, US.
   * The country codes generally follows ISO 3166-1 alpha-2 guidelines.
   */
  countryCode: string | null;

  /**
   * The customer’s first name.
   */
  firstName: string | null;

  /**
   * The customer’s last name.
   */
  lastName: string | null;

  /**
   * The phone number for this mailing address as entered by the customer.
   */
  phone: string | null;

  /**
   * The region of the address, such as the province, state, or district.
   */
  province: string | null;

  /**
   * The two-letter code for the region.
   * For example, ON.
   */
  provinceCode: string | null;

  /**
   * The ZIP or postal code of the address.
   */
  zip: string | null;
}

/**
 * A group of one or more regions of the world that a merchant
 * is targeting for sales. To learn more about markets, refer to
 * [this](https://shopify.dev/docs/apps/markets) conceptual overview.
 */
export interface Market {
  /**
   * A human-readable, shop-scoped identifier.
   */
  handle: string | null;

  /**
   * A globally unique identifier.
   */
  id: string | null;
}

/**
 * A monetary value with currency.
 */
export interface MoneyV2 {
  /**
   * The decimal money amount.
   */
  amount: number;

  /**
   * The three-letter code that represents the currency, for example, USD.
   * Supported codes include standard ISO 4217 codes, legacy codes, and non-
   * standard codes.
   */
  currencyCode: string;
}

/**
 * An object that contains data about a mouse event
 */
export interface MouseEventData {
  clientX: number;
  clientY: number;
  element: GenericElement;
  movementX: number;
  movementY: number;
  offsetX: number;
  offsetY: number;
  pageX: number;
  pageY: number;
  screenX: number;
  screenY: number;
}

/**
 * The name of the customer event
 */
export type Name = string;

/**
 * An order is a customer’s completed request to purchase one or more products
 * from a shop. An order is created when a customer completes the checkout
 * process.
 */
export interface Order {
  /**
   * The customer that placed the order.
   */
  customer: OrderCustomer | null;

  /**
   * The ID of the order. ID will be null for all events except
   * checkout_completed.
   */
  id: string | null;
}

/**
 * The customer that placed the order.
 */
export interface OrderCustomer {
  /**
   * The ID of the customer.
   */
  id: string | null;

  /**
   * Indicates if the order is the customer’s first order. This
   * property is only available if the shop has [upgraded to Checkout
   * Extensibility](https://help.shopify.com/en/manual/checkout-
   * settings/checkout-extensibility/checkout-upgrade).
   */
  isFirstOrder: boolean | null;
}

/**
 * A value given to a customer when a discount is applied to an order. The
 * application of a discount with this value gives the customer the specified
 * percentage off a specified item.
 */
export interface PricingPercentageValue {
  /**
   * The percentage value of the object.
   */
  percentage: number;
}

/**
 * A product is an individual item for sale in a Shopify store.
 */
export interface Product {
  /**
   * The ID of the product.
   */
  id: string | null;

  /**
   * The product’s title.
   */
  title: string;

  /**
   * The [product
   * type](https://help.shopify.com/en/manual/products/details/product-type)
   * specified by the merchant.
   */
  type: string | null;

  /**
   * The product’s untranslated title.
   */
  untranslatedTitle: string | null;

  /**
   * The relative URL of the product.
   */
  url: string | null;

  /**
   * The product’s vendor name.
   */
  vendor: string;
}

/**
 * A product variant represents a different version of a product, such as
 * differing sizes or differing colors.
 */
export interface ProductVariant {
  /**
   * A globally unique identifier.
   */
  id: string | null;

  /**
   * Image associated with the product variant. This field falls back to the
   * product image if no image is available.
   */
  image: Image | null;

  /**
   * The product variant’s price.
   */
  price: MoneyV2;

  /**
   * The product object that the product variant belongs to.
   */
  product: Product;

  /**
   * The SKU (stock keeping unit) associated with the variant.
   */
  sku: string | null;

  /**
   * The product variant’s title.
   */
  title: string | null;

  /**
   * The product variant’s untranslated title.
   */
  untranslatedTitle: string | null;
}

/**
 * The line item additional custom properties.
 */
export interface Property {
  /**
   * The key for the property.
   */
  key: string;

  /**
   * The value for the property.
   */
  value: string;
}

/**
 * Includes information of the company that the business customer is purchasing
 * on behalf of.
 */
export interface PurchasingCompanyCompany {
  /**
   * The external ID of the company that can be set by the merchant.
   */
  externalId: string | null;

  /**
   * The company ID.
   */
  id: string;

  /**
   * The name of the company.
   */
  name: string;
}

/**
 * Includes information of the company location that the business customer is
 * purchasing on behalf of.
 */
export interface PurchasingCompanyLocation {
  /**
   * The external ID of the company location that can be set by the merchant.
   */
  externalId: string | null;

  /**
   * The company location ID.
   */
  id: string;

  /**
   * The name of the company location.
   */
  name: string;
}

/**
 * Provides details of the company and the company location that the business
 * customer is purchasing on behalf of.
 */
export interface PurchasingCompany {
  /**
   * Includes information of the company that the business customer is
   * purchasing on behalf of.
   */
  company: PurchasingCompanyCompany;

  /**
   * Includes information of the company location that the business customer is
   * purchasing on behalf of.
   */
  location: PurchasingCompanyLocation;
}

/**
 * The interface representing a screen, usually the one on which the current
 * window is being rendered
 */
export interface Screen {
  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Screen/height),
   * the height of the screen
   */
  height: number;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Screen/width),
   * the width of the screen
   */
  width: number;
}

/**
 * An object that contains the metadata of when a search has been performed.
 */
export interface SearchResult {
  productVariants: ProductVariant[];

  /**
   * The search query that was executed
   */
  query: string;
}

/**
 * Represents how products and variants can be sold and purchased.
 */
export interface SellingPlan {
  /**
   * A globally unique identifier.
   */
  id: string;

  /**
   * The name of the selling plan. For example, '6 weeks of prepaid granola,
   * delivered weekly'.
   */
  name: string;
}

/**
 * Represents an association between a variant and a selling plan.
 */
export interface SellingPlanAllocation {
  /**
   * A representation of how products and variants can be sold and purchased.
   * For example, an individual selling plan could be '6 weeks of prepaid
   * granola, delivered weekly'.
   */
  sellingPlan: SellingPlan;
}

/**
 * A shipping rate to be applied to a checkout.
 */
export interface ShippingRate {
  /**
   * Price of this shipping rate.
   */
  price: MoneyV2;
}

/**
 * Settings related to payments.
 */
export interface ShopPaymentSettings {
  /**
   * The three-letter code for the shop’s primary currency.
   */
  currencyCode: string;
}

/**
 * The shop represents information about the store, such as the store name and
 * currency.
 */
export interface Shop {
  /**
   * The shop’s country code.
   */
  countryCode: string;

  /**
   * The shop’s myshopify.com domain.
   */
  myshopifyDomain: string;

  /**
   * The shop’s name.
   */
  name: string;

  /**
   * Settings related to payments.
   */
  paymentSettings: ShopPaymentSettings;

  /**
   * The shop’s primary storefront URL.
   */
  storefrontUrl: string | null;
}

/**
 * The timestamp of when the customer event occurred, in [ISO
 * 8601](https://en.wikipedia.org/wiki/ISO_8601) format
 */
export type Timestamp = string;

/**
 * The payment method used for the transaction. This property
 * is only available if the shop has [upgraded to Checkout
 * Extensibility](https://help.shopify.com/en/manual/checkout-settings/checkout-
 * extensibility/checkout-upgrade).
 */
export interface TransactionPaymentMethod {
  /**
   * The name of the payment method used for the transaction. This may further
   * specify the payment method used.
   */
  name: string;

  /**
   * The type of payment method used for the transaction.
   *
   * - `creditCard`: A vaulted or manually entered credit card.
   * - `redeemable`: A redeemable payment method, such as a gift card or store
   * credit.
   * - `deferred`: A [deferred
   * payment](https://help.shopify.com/en/manual/orders/deferred-payments), such
   * as invoicing the buyer and collecting payment later.
   * - `local`: A [local payment
   * method](https://help.shopify.com/en/manual/payments/shopify-payments/local-
   * payment-methods) specific to the current region or market.
   * - `manualPayment`: A manual payment method, such as an in-person retail
   * transaction.
   * - `paymentOnDelivery`: A payment that will be collected on delivery.
   * - `wallet`: An integrated wallet, such as PayPal, Google Pay, Apple Pay,
   * etc.
   * - `offsite`: A payment processed outside of Shopify's checkout, excluding
   * integrated wallets.
   * - `customOnSite`: A custom payment method that is processed through a
   * checkout extension with a payments app.
   * - `other`: Another type of payment not defined here.
   */
  type: string;
}

/**
 * A transaction associated with a checkout or order.
 */
export interface Transaction {
  /**
   * The monetary value with currency allocated to the transaction method.
   */
  amount: MoneyV2;

  /**
   * The name of the payment provider used for the transaction.
   */
  gateway: string;

  /**
   * The payment method used for the transaction. This property
   * is only available if the shop has [upgraded to Checkout
   * Extensibility](https://help.shopify.com/en/manual/checkout-
   * settings/checkout-extensibility/checkout-upgrade).
   */
  paymentMethod: TransactionPaymentMethod;
}

/**
 * An object that contains data about a UI Extension error that occurred.
 */
export interface UiExtensionError {
  /**
   * The API version used by the extension.
   */
  apiVersion: string;

  /**
   * The unique identifier of the app that the extension belongs to.
   */
  appId: string;

  /**
   * The name of the app that the extension belongs to.
   */
  appName: string;

  /**
   * The version of the app that encountered the error.
   */
  appVersion: string;

  /**
   * The name of the extension that encountered the error.
   */
  extensionName: string;

  /**
   * The [target](https://shopify.dev/docs/api/checkout-ui-
   * extensions/latest/targets) of the extension, for example
   * "purchase.checkout.delivery-address.render-after".
   */
  extensionTarget: string;

  /**
   * The message associated with the error that occurred.
   */
  message: string;

  /**
   * The [placement reference](https://shopify.dev/docs/apps/build/checkout/test-
   * checkout-ui-extensions#dynamic-targets) of the extension, only populated
   * for dynamic targets.
   */
  placementReference: string | null;

  /**
   * The stack trace associated with the error that occurred.
   */
  trace: string;

  /**
   * The type of error that occurred.
   */
  type: UiExtensionErrorType;
}

export enum UiExtensionErrorType {
  /**
   * An error caused by incorrect usage of extension APIs or UI components.
   */
  ExtensionUsageError = 'EXTENSION_USAGE_ERROR',
}

/**
 * A snapshot of a subset of properties of the `document` object in the top
 * frame of the browser
 */
export interface WebPixelsDocument {
  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document),
   * returns the character set being used by the document
   */
  characterSet: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document),
   * returns the URI of the current document
   */
  location: Location;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document),
   * returns the URI of the page that linked to this page
   */
  referrer: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document),
   * returns the title of the current document
   */
  title: string;
}

/**
 * A snapshot of a subset of properties of the `navigator` object in the top
 * frame of the browser
 */
export interface WebPixelsNavigator {
  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Navigator),
   * returns `false` if setting a cookie will be ignored and true otherwise
   */
  cookieEnabled: boolean;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Navigator),
   * returns a string representing the preferred language of the user, usually
   * the language of the browser UI. The `null` value is returned when this
   * is unknown
   */
  language: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Navigator),
   * returns an array of strings representing the languages known to the user,
   * by order of preference
   */
  languages: ReadonlyArray<string>;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Navigator),
   * returns the user agent string for the current browser
   */
  userAgent: string;
}

/**
 * A snapshot of a subset of properties of the `window` object in the top frame
 * of the browser
 */
export interface WebPixelsWindow {
  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window),
   * gets the height of the content area of the browser window including, if
   * rendered, the horizontal scrollbar
   */
  innerHeight: number;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), gets
   * the width of the content area of the browser window including, if rendered,
   * the vertical scrollbar
   */
  innerWidth: number;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), the
   * location, or current URL, of the window object
   */
  location: Location;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), the
   * global object's origin, serialized as a string
   */
  origin: string;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), gets
   * the height of the outside of the browser window
   */
  outerHeight: number;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), gets
   * the width of the outside of the browser window
   */
  outerWidth: number;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), an
   * alias for window.scrollX
   */
  pageXOffset: number;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), an
   * alias for window.scrollY
   */
  pageYOffset: number;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Screen), the
   * interface representing a screen, usually the one on which the current
   * window is being rendered
   */
  screen: Screen;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), the
   * horizontal distance from the left border of the user's browser viewport to
   * the left side of the screen
   */
  screenX: number;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), the
   * vertical distance from the top border of the user's browser viewport to the
   * top side of the screen
   */
  screenY: number;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), the
   * number of pixels that the document has already been scrolled horizontally
   */
  scrollX: number;

  /**
   * Per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window), the
   * number of pixels that the document has already been scrolled vertically
   */
  scrollY: number;
}
