/* heatons.js — Heatons storefront widgets, one file: * * Cart delivery groups (cart page, body.ex-cart): cart lines grouped into lead-time bands, a delivery card with live * stock on each line, and "send everything together" when lines ship on different schedules. * Search alternatives (body.ex-cart): the popover behind "Search alternatives" on Contact Us lines and tiles — * phrases (HeyMojo API) → store searches in the shopper's session → picks (HeyMojo API) → live price → rank → * cards → live stock → add to basket. First visit (seed): every phrase, in stock + all products, judged in one * picks request. Repeat visits: phrases 1–2 first, then the rest unless 4 close matches are already shown. * * Both run on the shared core below: store POSTs with timeouts, one cached /api/products lookup per product, * live inventory, add to basket with the mini cart and Vue cart-table redraw, the lead-time bands, and the delivery * card styles. Each feature starts in its own try/catch, so one failing can't stop the other. * * Grid tiles and the product page are built too, but switched off in PAGES (cart page only for now). Who gets any * of it: AUDIENCE (customer labels, account numbers, user numbers). * * Popover settings can be overridden with `window.cswAlternativesConfig` (see CONFIG). */ (() => { "use strict"; const isBrowser = typeof window !== "undefined" && typeof document !== "undefined"; // Which features run on which pages, by body class: '*' every page, [] off. const PAGES = { cartGroups: ["ex-cart"], // the cart page: delivery groups, delivery options, "Delete basket after checkout" switch alternatives: ["ex-cart"], // the Search alternatives popover; also runs wherever gridTiles or productPage runs gridTiles: [], // OFF — product-grid tiles (delivery card, stepper, Search alternatives); ['*'] = every page productPage: [], // OFF — product page layout + buy-box delivery card; ['ex-product'] to turn on }; // Who gets it. EvoX puts these on for the signed-in customer: // ex-l-