{"version":3,"file":"index.mjs","sources":["../../src/storefront/callbacks/on-cart-changed.ts","../../src/storefront/callbacks/on-consent-changed.ts","../../src/storefront/callbacks/on-page-load.ts","../../src/storefront/callbacks/on-page-loaded.ts","../../src/storefront/callbacks/on-page-switch.ts","../../src/storefront/callbacks/on-set-profile.ts","../../src/storefront/methods/format-currency.ts","../../src/storefront/methods/get-app-public-config.ts","../../src/storefront/methods/get-app-public-token.ts","../../src/storefront/methods/get-initialized-widgets.ts","../../src/storefront/methods/get-storefront-lang.ts","../../src/storefront/methods/get-tracking-consent.ts","../../src/storefront/methods/get-visitor-location.ts","../../src/storefront/methods/is-storefront-v3.ts","../../src/storefront/methods/open-page.ts","../../src/storefront/methods/set-tracking-consent.ts","../../src/storefront/cart/get.ts","../../src/storefront/cart/add-product.ts","../../src/storefront/cart/remove-product.ts","../../src/storefront/cart/remove-products.ts","../../src/storefront/cart/clear.ts","../../src/storefront/cart/calculate-total.ts","../../src/storefront/cart/can-go-to-checkout.ts","../../src/storefront/cart/go-to-checkout.ts","../../src/storefront/customer/get.ts","../../src/storefront/customer/sign-out.ts"],"sourcesContent":["import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { EcwidApiPromise, CartData } from '@/types';\n\n/**\n * This event allows tracking any cart changes excluding the payment method selection.\n * Its callback function with the cart argument contains details about the cart after the change event.\n *\n * OnCartChanged event triggers when:\n * - Cart is initialized, synced, or cleared\n * - Product has been added, updated (increased quantity, changed selected options), or removed from the cart\n * - Discount coupon or discount is applied or removed\n * - Shipping address is added or updated\n * - Shipping method is selected or changed\n *\n * @example\n *\n * ```ts\n * import { OnCartChanged } from '@lightspeed/ecom-headless';\n *\n * OnCartChanged.add((cart) => {\n *   console.log(`Cart ID: ${cart.cartId}`);\n *   console.log(`Items in cart: ${cart.productsQuantity}`);\n *   console.log(`Cart total: ${cart.total}`);\n * });\n * ```\n */\nexport const OnCartChanged: EcwidApiPromise<CartData> = {\n  add: callback =>\n    waitEcwidApiLoaded(\n      () => getEcwidWindowMethod('OnCartChanged').add(callback),\n    ),\n};\n","import { CustomerCookieConsentType } from '@/constants';\nimport { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { EcwidApiPromise } from '@/types';\n\n/**\n * This method allows you to catch any changes to the consent value.\n *\n * @example\n *\n * ```ts\n * import { OnConsentChanged, CustomerCookieConsent } from '@lightspeed/ecom-headless';\n *\n * OnConsentChanged.add((consent) => {\n *   console.log(\"consent changed to \" + consent);\n * });\n * setTrackingConsent(CustomerCookieConsent.DECLINED);\n * // \"consent changed to DECLINED\"\n * ```\n*/\nexport const OnConsentChanged: EcwidApiPromise<CustomerCookieConsentType> = {\n  add: callback =>\n    waitEcwidApiLoaded(\n      () => getEcwidWindowMethod('OnConsentChanged').add(callback),\n    ),\n};\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { EcwidApiPromise } from '@/types';\n\n/**\n * This event triggers instantly when the page DOM is loaded.\n *\n * This method doesn't wait for the Ecwid product browser and its contents to fully load\n * and therefore doesn't return any details about the opened page.\n *\n * @example\n *\n * ```ts\n * import { OnPageLoad } from '@lightspeed/ecom-headless';\n *\n * OnPageLoad.add(() => {\n *   console.log(\"Page DOM has just loaded\");\n * });\n * ```\n*/\nexport const OnPageLoad: EcwidApiPromise<void> = {\n  add: callback =>\n    waitEcwidApiLoaded(\n      () => getEcwidWindowMethod('OnPageLoad').add(callback),\n    ),\n};\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { EcwidApiPromise, JsApiPage } from '@/types';\n\n/**\n * This method allows you to track the full page load –\n * a moment when both DOM and product browser are loaded and ready for customization.\n *\n * It contains a callback function with page argument containing information about a loaded page.\n *\n * @example\n *\n * ```ts\n * import { OnPageLoaded, JsApiPageValues } from '@lightspeed/ecom-headless';\n *\n * OnPageLoaded.add((page) => {\n *   if (page.type === JsApiPageValues.PRODUCT) {\n *     console.log(page);\n *   }\n * });\n * // {\n * //   \"type\":\"PRODUCT\",\n * //   \"categoryId\":0,\n * //   \"hasPrevious\":false,\n * //   \"mainCategoryId\":0,\n * //   \"name\":\"Desk Black 101x50x76.5 cm Engineered Wood\",\n * //   \"nameTranslated\":{\n * //     \"cs\":\"\",\n * //     \"en\":\"Desk Black 101x50x76.5 cm Engineered Wood\"\n * //   },\n * //   \"productId\":561386461\n * // }\n * ```\n*/\nexport const OnPageLoaded: EcwidApiPromise<JsApiPage> = {\n  add: callback =>\n    waitEcwidApiLoaded(\n      () => getEcwidWindowMethod('OnPageLoaded').add(callback),\n    ),\n};\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { EcwidApiPromise, JsApiPage } from '@/types';\n\n/**\n * This method allows tracking and preventing page switches on the storefront.\n * It is triggered when a user is about to switch a page (a new page is not yet loaded).\n *\n * The method works synchronously and contains the page argument in its callback function.\n * Use it to identify the page where users go and prevent page loading by returning a false value.\n *\n * @example\n *\n * ```ts\n * import { OnPageSwitch, JsApiPageValues } from '@lightspeed/ecom-headless';\n *\n * OnPageSwitch.add((page) => {\n *   if (page.type === JsApiPageValues.PRODUCT) {\n *     console.log(page);\n *   }\n * });\n * // {\n * //   \"type\":\"PRODUCT\",\n * //   \"categoryId\":0,\n * //   \"hasPrevious\":false,\n * //   \"mainCategoryId\":0,\n * //   \"name\":\"Desk Black 101x50x76.5 cm Engineered Wood\",\n * //   \"nameTranslated\":{\n * //     \"cs\":\"\",\n * //     \"en\":\"Desk Black 101x50x76.5 cm Engineered Wood\"\n * //   },\n * //   \"productId\":561386461\n * // }\n * ```\n*/\nexport const OnPageSwitch: EcwidApiPromise<JsApiPage> = {\n  add: callback =>\n    waitEcwidApiLoaded(\n      () => getEcwidWindowMethod('OnPageSwitch').add(callback),\n    ),\n};\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { EcwidApiPromise, CustomerData } from '@/types';\n\n/**\n * This method allows you to track a moment when customers log in and out on the storefront.\n * It contains a callback function with customer argument when a customer logs in, and null if a customer has logged out.\n *\n * @example\n *\n * ```ts\n * import { OnSetProfile } from '@lightspeed/ecom-headless';\n *\n * OnSetProfile.add((customer) => {\n *   console.log(customer.email);\n *   // \"ec.apps@lightspeedhq.com\"\n * });\n * ```\n*/\nexport const OnSetProfile: EcwidApiPromise<CustomerData | null> = {\n  add: callback =>\n    waitEcwidApiLoaded(\n      () => getEcwidWindowMethod('OnSetProfile').add(callback),\n    ),\n};\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\n\n/**\n * This method allows you to get store currency settings on the storefront.\n * It is useful if you need to add a widget that displays some price to customers.\n *\n * It accepts a numeric price as an argument and responds with a formatted price\n * using store settings: currency symbol, and delimiter symbol and precision.\n *\n * @example\n *\n * ```ts\n * import { formatCurrency } from '@lightspeed/ecom-headless';\n *\n * const formattedPrice = await formatCurrency(12.99);\n * console.log(formattedPrice);\n * // \"$12.99\"\n * ```\n*/\nexport async function formatCurrency(amount: number): Promise<string> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('formatCurrency')(amount),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\n\n/**\n * This method accepts an app `client_id` as an argument and responds with a\n * \"public config\" for the app. This config is the data saved in App Storage\n * as a public key.\n *\n * Read more about setting up App Storage:\n * {@link https://docs.ecwid.com/launch-apps/native-and-external-apps/build-user-settings-page-for-ecwid-admin/manage-personal-user-settings-storage}.\n *\n * @example\n * ```ts\n * import { getAppPublicConfig } from '@lightspeed/ecom-headless';\n *\n * const publicConfig = await getAppPublicConfig('client_id');\n * console.log(JSON.parse(publicConfig));\n * // {\"key\": \"public\",\"value\": \"{'color':'red','text':'Email button','border-radius':'3px'}\"}\n * ```\n */\n\nexport async function getAppPublicConfig(clientId: string): Promise<string> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('getAppPublicConfig')(clientId),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\n\n/**\n * This method accepts app client_id as an argument and responds with a public access token for the app.\n * Public tokens are safe to use on the storefront, as they won't be able to reveal any private store data.\n *\n * @example\n *\n * ```ts\n * import { getAppPublicToken } from '@lightspeed/ecom-headless';\n *\n * const publicToken = await getAppPublicToken('client_id');\n * console.log(publicToken);\n * // \"public_qKsUqKkNXzcj9DejwMUqEkY2q2E6BXM9\"\n * ```\n*/\nexport async function getAppPublicToken(clientId: string): Promise<string> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('getAppPublicToken')(clientId),\n  );\n}\n","import { EcwidWidgetType } from '@/constants';\nimport { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\n\n/**\n * This method responds with a list of widgets currently loaded on the website.\n *\n * @example\n *\n * ```ts\n * import { getInitializedWidgets } from '@lightspeed/ecom-headless';\n * const widgets = await getInitializedWidgets();\n * console.log(widgets);\n * // [\"Minicart\", \"SearchPanel\", \"ProductBrowser\"]\n * ```\n*/\nexport async function getInitializedWidgets(): Promise<EcwidWidgetType[]> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('getInitializedWidgets')(),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\n\n/**\n * This method responds with the current storefront language in ISO 639-1 language code.\n * Use it to dynamically translate custom content on the page.\n *\n * @example\n *\n * ```ts\n * import { getStorefrontLang } from '@lightspeed/ecom-headless';\n *\n * const lang = await getStorefrontLang();\n * console.log(lang);\n * // \"en\"\n * ```\n*/\nexport async function getStorefrontLang(): Promise<string> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('getStorefrontLang')(),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { TrackingConsent } from '@/types';\n\n/**\n * This method receives the customer's answer to the cookie consent banner.\n * Use it to define what cookies your application can collect.\n *\n * If the cookie consent value is overridden by the JS method or config,\n * getTrackingConsent() returns the new value added by JS method/config.\n *\n * @example\n *\n * ```ts\n * import { getTrackingConsent } from '@lightspeed/ecom-headless';\n *\n * const trackingConsent = await getTrackingConsent();\n * console.log(trackingConsent);\n * // {  userResponse: \"ACCEPTED\", askConsent: true }\n * ```\n*/\nexport async function getTrackingConsent(): Promise<TrackingConsent> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('getTrackingConsent')(),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { VisitorLocation } from '@/types';\n\n/**\n * This method gets the visitor's location based on their shipping or billing address (when entered), or IP.\n * The call works even for signed-out customers.\n *\n * @example\n *\n * ```ts\n * import { getVisitorLocation } from '@lightspeed/ecom-headless';\n *\n * const location = await getVisitorLocation();\n * console.log(location);\n * // { countryCode: \"US\", stateCode: \"NE\", source: \"IP_ADDRESS\" }\n * ```\n*/\nexport async function getVisitorLocation(): Promise<VisitorLocation> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('getVisitorLocation')(),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\n\n/**\n * This method is useful for public applications developed before 2024.\n * It helps apps to adapt their design by detecting the old storefront version.\n *\n * All stores created in 2024 and later are using the latest storefront without the ability to switch the version.\n *\n * @example\n *\n * ```ts\n * import { isStorefrontV3 } from '@lightspeed/ecom-headless';\n *\n * const isStorefrontV3 = await isStorefrontV3();\n * console.log(isStorefrontV3);\n * // true\n * ```\n*/\nexport async function isStorefrontV3(): Promise<boolean> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('isStorefrontV3')(),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\n\n/**\n * This method allows you to open a specific page on the storefront. The function accepts page slugs and additional parameters in its arguments.\n *\n * For example, you can use these redirects in different promo activities:\n * - Create a popup with a sale product and redirect customers to this product on click.\n * - Offer customers to log in to receive some bonus.\n * - Redirect customers to the search page with pre-configured terms showing promo products.\n *\n * @example\n *\n * ```ts\n * import { openPage } from '@lightspeed/ecom-headless';\n *\n * // Redirect customers to the cart page\n * openPage('cart');\n *\n * // Open search page with shoes of one brand\n * openPage('search', {\n *   keyword: 'shoes',\n *   attribute_Brand: 'Nike',\n *   inventory: 'instock'\n * });\n * ```\n *\n * @see Full list of available pages: https://docs.ecwid.com/storefronts/open-page-on-the-storefront/overview-of-open-page-options#full-list-of-available-pages\n *\n * Learn more about pages that can be opened with additional params:\n *\n * {@link https://docs.ecwid.com/storefronts/open-page-on-the-storefront/open-product-pages-with-params Open product pages with params} |\n * {@link https://docs.ecwid.com/storefronts/open-page-on-the-storefront/open-category-pages-with-params Open category pages with params} |\n * {@link https://docs.ecwid.com/storefronts/open-page-on-the-storefront/open-search-page-with-params Open search page with params} |\n * {@link https://docs.ecwid.com/storefronts/open-page-on-the-storefront/open-account-pages-with-params Open account pages with params}\n*/\nexport async function openPage(\n  page: string,\n  options?: Record<string, unknown>,\n): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('openPage')(page, options),\n  );\n}\n","import { CustomerCookieConsentType } from '@/constants';\nimport { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\n\n/**\n * This method accepts an argument matching one of the following values:\n *\n * \"UNDEFINED\": Customer hasn't given their consent yet.\n *\n * \"ACCEPTED\": Collect all types of cookies.\n *\n * \"DECLINED\": Collect only essential cookies.\n *\n * \"ANALYTICS_ONLY\": Collect essential and analytics cookies only.\n *\n * \"PERSONALIZATION_ONLY\": Collect essential and personalization cookies.\n *\n * @example\n *\n * ```ts\n * import { setTrackingConsent, getTrackingConsent, CustomerCookieConsentValues } from '@lightspeed/ecom-headless';\n *\n * await setTrackingConsent(CustomerCookieConsentValues.DECLINED);\n * const trackingConsent = await getTrackingConsent();\n * console.log(trackingConsent);\n * // {  userResponse: \"DECLINED\", askConsent: false }\n * ```\n*/\nexport async function setTrackingConsent(cookieConsent: CustomerCookieConsentType): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('setTrackingConsent')(cookieConsent),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { CartGetCallback } from '@/types';\n\n/**\n * This method allows you to receive full information about the current shopping cart.\n * The response is available in the cart callback.\n *\n * @example\n *\n * ```ts\n * import { Cart } from '@lightspeed/ecom-headless';\n *\n * Cart.get((cart) => {\n *   console.log(`Cart has ${cart.productsQuantity} products`);\n *   console.log(`Cart ID: ${cart.cartId}`);\n *   cart.items.forEach(item => {\n *     console.log(`${item.product.name} - Quantity: ${item.quantity}`);\n *   });\n * });\n * ```\n */\nexport async function get(callback?: CartGetCallback): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('Cart').get(callback),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { AddProductParameter, CartAddProductCallback } from '@/types';\n\n/**\n * This method allows you to add a new product position to the shopping cart.\n * It accepts either a product ID or a product object with extended details including\n * product ID, quantity, selected options, or subscription product settings.\n *\n * When you use this method, it first checks the product by specified ID for stock and variations.\n * If the selected options match one of the variations, Ecwid will check its stock first.\n * If you don't have enough stock to add a product, Ecwid adds the available quantity.\n * If the product is out of stock, nothing is added to the shopping cart.\n *\n * @example\n *\n * ```ts\n * import { Cart } from '@lightspeed/ecom-headless';\n *\n * // Add product by ID with default quantity\n * Cart.addProduct(10, (success, product, cart) => {\n *   if (success) {\n *     console.log('Product added successfully');\n *   }\n * });\n *\n * // Add product with specific options and quantity\n * Cart.addProduct({\n *   id: 10,\n *   quantity: 3,\n *   options: {\n *     \"Size\": \"L\"\n *   }\n * }, (success, product, cart, error) => {\n *   if (success) {\n *     console.log(`Added ${product.quantity} items to cart`);\n *   } else {\n *     console.error('Failed to add product:', error);\n *   }\n * });\n *\n * // Add subscription product\n * Cart.addProduct({\n *   id: 15,\n *   quantity: 1,\n *   recurringChargeSettings: {\n *     recurringInterval: \"MONTH\",\n *     recurringIntervalCount: 1,\n *   }\n * });\n * ```\n */\nexport async function addProduct(\n  product: AddProductParameter,\n  callback?: CartAddProductCallback,\n): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('Cart').addProduct(product, callback),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { CartRemoveProductCallback } from '@/types';\n\n/**\n * This method removes product position from the shopping cart entirely.\n * The specified product will be removed completely even if its quantity is greater than zero.\n *\n * This method completely removes the product from the cart. If you want to decrease its quantity,\n * use Cart.get() to save product details, then remove the product with Cart.removeProduct()\n * and add it back with all the same details except for the decreased quantity with Cart.addProduct().\n *\n * To remove a product position from the cart, first, you need to get an index with the Cart.get() method.\n * Position of the product in the items array is the index. For example, if you have two different\n * products added to the cart, the first product has an index of 0, and the second has an index of 1.\n *\n * @example\n *\n * ```ts\n * import { Cart } from '@lightspeed/ecom-headless';\n *\n * // Remove the first product from cart\n * Cart.removeProduct(0, (success, itemsRemovedQuantity, product, cart, error) => {\n *   if (success) {\n *     console.log(`Removed ${itemsRemovedQuantity} items from cart`);\n *     console.log(`Product removed: ${product.name}`);\n *   } else {\n *     console.error('Failed to remove product:', error);\n *   }\n * });\n *\n * // Remove product without callback\n * Cart.removeProduct(1);\n * ```\n */\nexport async function removeProduct(\n  index: number,\n  callback?: CartRemoveProductCallback,\n): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('Cart').removeProduct(index, callback),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { CartRemoveProductCallback } from '@/types';\n\n/**\n * This method works in the same way as Cart.removeProduct(), but allows you to remove\n * multiple items from the cart at once by passing an array of indices.\n *\n * Each index represents the position of a product in the cart's items array.\n * All specified products will be removed completely even if their quantity is greater than zero.\n *\n * @example\n *\n * ```ts\n * import { Cart } from '@lightspeed/ecom-headless';\n *\n * // Remove first and second products from cart\n * Cart.removeProducts([0, 1], (success, itemsRemovedQuantity, product, cart, error) => {\n *   if (success) {\n *     console.log(`Removed ${itemsRemovedQuantity} total items from cart`);\n *   } else {\n *     console.error('Failed to remove products:', error);\n *   }\n * });\n *\n * // Remove multiple products without callback\n * Cart.removeProducts([0, 2, 3]);\n * ```\n */\nexport async function removeProducts(\n  indices: number[],\n  callback?: CartRemoveProductCallback,\n): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('Cart').removeProducts(indices, callback),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { CartClearCallback } from '@/types';\n\n/**\n * This method allows you to clear all details from the shopping cart.\n * If the method clears the cart successfully, you receive true in the success argument.\n *\n * @example\n *\n * ```ts\n * import { Cart } from '@lightspeed/ecom-headless';\n *\n * Cart.clear((success, error) => {\n *   if (success) {\n *     console.log(\"Cart was cleared\");\n *   } else {\n *     console.log(\"Cart clear failed. Error message: \" + error);\n *   }\n * });\n *\n * // Clear without callback\n * Cart.clear();\n * ```\n */\nexport async function clear(callback?: CartClearCallback): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('Cart').clear(callback),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { CartCalculateTotalCallback } from '@/types';\n\n/**\n * This method calculates the current cart asynchronously and passes the result as an order\n * callback argument with a snapshot of the generated order with essential details.\n *\n * The order object includes subtotals, taxes, discounts, shipping costs, and a full cart snapshot.\n *\n * @example\n *\n * ```ts\n * import { Cart } from '@lightspeed/ecom-headless';\n *\n * Cart.calculateTotal((order) => {\n *   console.log(`Order total: ${order.total}`);\n *   console.log(`Subtotal: ${order.subtotal}`);\n *   console.log(`Tax: ${order.tax}`);\n *   console.log(`Shipping: ${order.shipping}`);\n *   console.log(`Items in cart: ${order.cart.productsQuantity}`);\n *\n *   // Access individual cart items\n *   order.cart.items.forEach(item => {\n *     console.log(`${item.product.name} - Qty: ${item.quantity}`);\n *   });\n * });\n * ```\n */\nexport async function calculateTotal(callback?: CartCalculateTotalCallback): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('Cart').calculateTotal(callback),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\n\n/**\n * This method checks whether you can send customers to the first step of the checkout called the shopping cart.\n *\n * @example\n *\n * ```ts\n * import { Cart } from '@lightspeed/ecom-headless';\n *\n * const canGoToCheckout = await Cart.canGotoCheckout();\n *\n * if (canGoToCheckout) {\n *   Cart.gotoCheckout();\n * }\n * ```\n */\nexport async function canGotoCheckout(): Promise<boolean> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('Cart').canGotoCheckout(),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { CartGoToCheckoutCallback } from '@/types';\n\n/**\n * This method sends a customer to the first or second checkout step.\n *\n * This method works differently depending on the Ecwid admin > Settings > Legal > Terms & Conditions toggle\n * and whether the customer has already left an email in the shopping cart:\n *\n * - No email: the customer is sent to the shopping cart page.\n * - Email + toggle disabled: the customer is sent to the second checkout page (address details)\n * - Email + toggle disabled + no shipping: the customer is sent to the payment page.\n *\n * @example\n *\n * ```ts\n * import { Cart } from '@lightspeed/ecom-headless';\n *\n * Cart.gotoCheckout(() => {\n *   console.log(\"Checkout process started\");\n * });\n * ```\n */\nexport async function gotoCheckout(callback?: CartGoToCheckoutCallback): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('Cart').gotoCheckout(callback),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { CustomerGetCallback } from '@/types';\n\n/**\n * This method receives all data on the customer currently logged in to the store.\n * If no customer is logged in, the method returns null.\n *\n * @example\n *\n * ```ts\n * import { Customer } from '@lightspeed/ecom-headless';\n *\n * Customer.get((customer) => {\n *   if (customer === null) {\n *     console.log('No customer is logged in');\n *   } else {\n *     console.log(customer.email);\n *   }\n * });\n * ```\n*/\nexport async function get(callback?: CustomerGetCallback): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('Customer').get(callback),\n  );\n}\n","import { getEcwidWindowMethod, waitEcwidApiLoaded } from '@/storefront/utils';\nimport { CustomerSignOutCallback } from '@/types';\n\n/**\n * This method signs out customer from their account.\n *\n * Error message has value only if success is false.\n *\n * @example\n *\n * ```ts\n * import { Customer } from '@lightspeed/ecom-headless';\n *\n * Customer.signOut((success, error) => {\n *   if (success === true) {\n *     console.log('Customer signed out');\n *   } else {\n *     console.log('Signout failed. Error message: ' + error);\n *   }\n * });\n * ```\n*/\nexport async function signOut(callback?: CustomerSignOutCallback): Promise<void> {\n  return waitEcwidApiLoaded(\n    () => getEcwidWindowMethod('Customer').signOut(callback),\n  );\n}\n"],"names":["OnCartChanged","callback","waitEcwidApiLoaded","getEcwidWindowMethod","OnConsentChanged","OnPageLoad","OnPageLoaded","OnPageSwitch","OnSetProfile","formatCurrency","amount","getAppPublicConfig","clientId","getAppPublicToken","getInitializedWidgets","getStorefrontLang","getTrackingConsent","getVisitorLocation","isStorefrontV3","openPage","page","options","setTrackingConsent","cookieConsent","get","addProduct","product","removeProduct","index","removeProducts","indices","clear","calculateTotal","canGotoCheckout","gotoCheckout","signOut"],"mappings":"kJA0BO,MAAMA,EAA2C,CACtD,IAAKC,GACHC,EACE,IAAMC,EAAqB,eAAe,EAAE,IAAIF,CAAQ,CAC1D,CACJ,ECZaG,EAA+D,CAC1E,IAAKH,GACHC,EACE,IAAMC,EAAqB,kBAAkB,EAAE,IAAIF,CAAQ,CAC7D,CACJ,ECLaI,EAAoC,CAC/C,IAAKJ,GACHC,EACE,IAAMC,EAAqB,YAAY,EAAE,IAAIF,CAAQ,CACvD,CACJ,ECSaK,EAA2C,CACtD,IAAKL,GACHC,EACE,IAAMC,EAAqB,cAAc,EAAE,IAAIF,CAAQ,CACzD,CACJ,ECJaM,EAA2C,CACtD,IAAK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