{"version":3,"file":"index.es.min.js","sources":["../../../packages/helpers/src/props.helpers.js","../../../packages/helpers/src/utils.ts","../../../packages/components/src/constants.mjs","../../../packages/helpers/src/refs.helpers.js","../../../packages/helpers/src/catalog.js","../../../packages/components/src/sku/services/index.js","../../../packages/components/src/sku/constants.mjs","../../../packages/helpers/src/dataLayer.js","../../../packages/helpers/src/cremaDataHelper.js","../../../packages/components/src/sku-coffee/services/index.js","../../../packages/page-builder-sections/src/cross-sell-natural/dataTransform/product.coffee.dto.js","../../../services/plp/services.js","../../../packages/page-builder-sections/src/cross-sell-natural/dataTransform/product.dto.js","../../../packages/page-builder-sections/src/cross-sell-natural/dataTransform/product.machine.dto.js","../../../packages/page-builder-sections/src/cross-sell-natural/dataTransform/product.accessory.dto.js","../../../packages/page-builder-sections/src/cross-sell-natural/dataTransform/product.giftCard.dto.js","../../../services/pdp-data/src/prod/index.js","../../../packages/page-builder-sections/src/cross-sell-natural/js/constants.js","../../../packages/page-builder-sections/src/cross-sell-natural/js/coveo.config.js","../../../packages/coveo-search/src/search-bar/constants.ts","../../../packages/coveo-search/src/config.ts","../../../packages/coveo-search/src/experimental/engine/shared/coveo-api-commons.ts","../../../packages/page-builder-sections/src/cross-sell-natural/services/fetcher.service.js","../../../packages/page-builder-sections/src/cross-sell-natural/constants.mjs","../../../packages/components/src/sku-quick-view/shared-quick-view-types.ts","../../../packages/components/src/sku-quick-view/shared-quick-view.ts","../../../packages/helpers/src/gtmEvents.js","../../../packages/page-builder-sections/src/cross-sell-natural/cross-sell-natural.js","../../../packages/helpers/src/assets/js/eventDispatch.js"],"sourcesContent":["const getData = attributes => attributes.find(attribute => attribute.nodeName === 'data')\n\nconst createProps = attributes => {\n    const data = getData([...attributes])\n    const props = [...attributes]\n        .filter(attribute => attribute.nodeName !== 'data')\n        .reduce((all, attr) => {\n            return { ...all, [attr.nodeName]: attr.nodeValue }\n        }, {})\n\n    if (isNil(data)) {\n        return props\n    }\n\n    try {\n        return { ...props, ...JSON.parse(data.nodeValue) }\n    } catch (error) {\n        console.log('ERROR: No data', error, data?.nodeValue)\n    }\n}\n\nconst isNil = obj => obj === undefined || obj === null\n\nexport const parseBool = value => (!value || value === 'false' ? false : true)\n\nexport default createProps\n","export { waitForSelector } from './waitForSelector'\n\nexport const constants = {\n    LEFT: 37,\n    UP: 38,\n    RIGHT: 39,\n    DOWN: 40,\n    ESC: 27,\n    SPACE: 32,\n    ENTER: 13,\n    TAB: 9\n}\n\nexport function capitalize(s = '') {\n    return s[0].toUpperCase() + s.slice(1)\n}\n\nexport const convertToCamelCase = (str: string): string => {\n    const arr = str.match(/[a-z]+|\\d+/gi)\n    if (!arr) { return str }\n    return arr.map((m, i) => {\n        let low = m.toLowerCase()\n        if (i !== 0) {\n            low = low.split('').map((s, k) => (k === 0 ? s.toUpperCase() : s)).join(\"\")\n        }\n        return low\n    }).join(\"\")\n}\n\nexport function slug(s = '') {\n    return s\n        .toLowerCase()\n        .trim()\n        .replace(/\\s+/g, '-') // Replace spaces with -\n        .replace(/[^\\w-]+/g, '') // Remove all non-word chars\n        .replace(/--+/g, '-') // Replace multiple - with single -\n}\n\nexport function pxToEm(target: number, stripedInnerFontSize = 1) {\n    return target / 14 / stripedInnerFontSize + 'em'\n}\n\nexport function percent(target: number) {\n    return target + '%'\n}\n\nexport function parseHTML(str: string) {\n    const tmp = document.implementation.createHTMLDocument('')\n    tmp.body.innerHTML = str\n    return tmp.body.childNodes\n}\n\nexport function stripHTML(str: string) {\n    const tmp = document.implementation.createHTMLDocument('')\n    tmp.body.innerHTML = str\n    return (tmp.body.textContent ?? \"\").replace(RegExp('[\\\\s|\\'|\"]', 'g'), '')\n}\n\nexport function makeId(length: number) {\n    var result = ''\n    var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'\n    var charactersLength = characters.length\n    for (var i = 0; i < length; i++) {\n        result += characters.charAt(Math.floor(Math.random() * charactersLength))\n    }\n    return result\n}\n\nexport function removeEmptyValues(obj: { [key: string]: any }): { [key: string]: any } {\n    const findText = [\n        'Default campaign ID (tracking missing in Page Builder export)',\n        'Default campaign name (tracking missing in Page Builder export)',\n        'promoname', \n        'promoid', \n        'promocreative', \n        'undefined'\n    ];\n    \n    for (let key in obj) {\n        const value = obj[key];\n        \n        if (value === null || value === undefined || value === '') {\n            delete obj[key];\n            continue;\n        }\n        \n        if (typeof value === 'string') {\n            for (const text of findText) {\n                if (value.includes(text)) {\n                    delete obj[key];\n                    break;\n                }\n            }\n        }\n    }\n    \n    return obj;\n}\n\nexport function makeHash(str: string) {\n    var hash = 0,\n        i,\n        chr\n    if (!str) {\n        return hash\n    }\n    for (i = 0; i < str.length; i++) {\n        chr = str.charCodeAt(i)\n        hash = (hash << 5) - hash + chr\n        hash |= 0 // Convert to 32bit integer\n    }\n    return 'id-' + hash\n}\n\nexport function getHashLink(link: string) {\n    let linkHash = link\n    let linkNoHash = link\n    if (link.indexOf('#') !== -1) {\n        linkNoHash = link.replace('#', '')\n    } else {\n        linkHash = '#' + link\n    }\n\n    return { linkNoHash, linkHash }\n}\n\nexport function lazyLoad(node: Element, attribute: string, value: any, url: string) {\n    const CLASSNAME_OUT_OF_SCREEN = 'lazy-load'\n    const CLASSNAME_IN_SCREEN = 'lazy-loaded'\n    const CLASSNAME_ON_ERROR = 'lazy-loaded-error'\n\n    const isOldIOS = () => {\n        var agent = window.navigator.userAgent,\n            start = agent.indexOf('OS ')\n        if ((agent.indexOf('iPhone') > -1 || agent.indexOf('iPad') > -1) && start > -1) {\n            return window.Number(agent.substr(start + 3, 3).replace('_', '.')) < 14\n        }\n        return false\n    }\n\n    const inViewPort = (attribute: string, value: any) => {\n        node.setAttribute(attribute, value)\n\n        const cb = () => node.classList.add(CLASSNAME_IN_SCREEN)\n\n        if (url) {\n            const img = new Image()\n            img.src = url\n            img.onload = cb\n            img.onerror = () => {\n                cb()\n                node.classList.add(CLASSNAME_ON_ERROR)\n                throw new Error(`Image ${url} cannot be loaded`)\n            }\n\n            return\n        }\n\n        cb()\n    }\n\n    if (/Trident\\/|MSIE/.test(window.navigator.userAgent) || isOldIOS()) {\n        inViewPort(attribute, value)\n    } else {\n        if ('IntersectionObserver' in window) {\n            node.classList.add(CLASSNAME_OUT_OF_SCREEN)\n            let lazyBackgroundObserver = new IntersectionObserver(function (entries) {\n                entries.forEach(function (entry) {\n                    if (entry.isIntersecting) {\n                        inViewPort(attribute, value)\n                        lazyBackgroundObserver.unobserve(entry.target)\n                    }\n                })\n            })\n            lazyBackgroundObserver.observe(node)\n        } else {\n            inViewPort(attribute, value)\n        }\n    }\n}\n\nexport function lazyLoadCallback(node: Element, cb: () => void) {\n    const isOldIOS = () => {\n        var agent = window.navigator.userAgent,\n            start = agent.indexOf('OS ')\n        if ((agent.indexOf('iPhone') > -1 || agent.indexOf('iPad') > -1) && start > -1) {\n            return window.Number(agent.substr(start + 3, 3).replace('_', '.')) < 14\n        }\n        return false\n    }\n\n    if (/Trident\\/|MSIE/.test(window.navigator.userAgent) || isOldIOS()) {\n        cb()\n    } else {\n        if ('IntersectionObserver' in window) {\n            let lazyBackgroundObserver = new IntersectionObserver(\n                function (entries) {\n                    entries.forEach(function (entry) {\n                        if (entry.isIntersecting) {\n                            cb()\n                            lazyBackgroundObserver.unobserve(entry.target)\n                        }\n                    })\n                },\n                { rootMargin: '150% 0px' }\n            )\n            lazyBackgroundObserver.observe(node)\n        }\n    }\n}\n\n// Debounce\nexport function debounce<T>(func: (v: T) => void, time = 100) {\n    let timer: number\n    return function (event: T) {\n        if (timer) {\n            window.clearTimeout(timer)\n        }\n        timer = window.setTimeout(func, time, event)\n    }\n}\n\n// isIE - to check for internet explorer\nexport function isIE() {\n    let ua = window.navigator.userAgent,\n        isIE = /MSIE|Trident/.test(ua)\n\n    return isIE\n}\n\n// Load external script\nexport const loadExternalScript = ({\n    src,\n    callback = null,\n    async = false,\n    defer = false,\n    module = false,\n    id = ''\n}: {\n    src: string;\n    callback: null | GlobalEventHandlers[\"onload\"]\n    module: boolean,\n    defer: boolean,\n    async: boolean,\n    id: string\n}) => {\n    const script = document.createElement('script')\n    script.type = module ? 'module' : 'text/javascript'\n    script.src = src\n    id ? (script.id = id) : false // add id attribute only if passed\n    if (typeof callback === 'function') {\n        script.onload = callback\n    }\n    script.async = async\n    script.defer = defer\n    document.body.appendChild(script)\n}\n\n// Load external css\nexport const loadExternalCss = ({ src }: { src: string }) => {\n    const script = document.createElement('link')\n    script.rel = 'stylesheet'\n    script.href = src\n    document.body.appendChild(script)\n}\n// Lazy load vendor script\nexport const lazyLoadVendorScript = (handler, el) => {\n    const observer = new IntersectionObserver(handler)\n    observer.observe(el)\n}\n\n/**\n * Replaces variable inside a given string\n * Each variable have to be enclosed between stChr and enChr\n * The values have to be contained in the vars object, they key must match\n * example :\n * txt : 'See {resultsLength} Results'\n * vars : {resultsLength:'30'}\n * stChr : '{'\n * enChr : '}'\n *\n * will return : 'See 30 Results'\n *\n * @param {string} txt\n * @param {object} vars\n * @param {string} stChr\n * @param {string} enChr\n */\nexport function interpolate(txt: string, vars: Record<string, null | undefined | string>, stChr: string, enChr: string) {\n    let curIdx = 0\n\n    while (txt) {\n        const stIdx = txt.indexOf(stChr, curIdx)\n        if (stIdx === -1) {\n            break\n        }\n        const enIdx = txt.indexOf(enChr, stIdx + 1)\n        if (enIdx === -1) {\n            break\n        }\n        const hashId = txt.substring(stIdx + stChr.length, enIdx)\n        if (vars[hashId] != null) {\n            txt = txt.substr(0, stIdx) + vars[hashId] + txt.substr(enIdx + enChr.length)\n            curIdx = stIdx\n        } else {\n            curIdx = enIdx\n        }\n    }\n    return txt\n}\n\n/**\n * Find in container element, add height to equal size of element\n * @param container css path where my element is contain e.g. `.c-container`\n * @param el css path of elements to equalized\n */\nexport const equalHeight = (containerSelector: string, el: string, elementScope: HTMLElement) => {\n    const container = elementScope.querySelector<HTMLElement>(containerSelector)\n    if (!container) {\n        return\n    }\n\n    const items = container.querySelectorAll<HTMLElement>(el)\n    let max = -1\n\n    for (let i = 0; i < [...items].length; i++) {\n        const item = [...items][i]\n        let h = item.offsetHeight\n        max = h > max ? h : max\n    }\n\n    if (max <= 0) {\n        return\n    }\n\n    for (let i = 0; i < [...items].length; i++) {\n        const item = [...items][i]\n        item.style.height = `${max}px`\n    }\n}\n\nexport const stringifyCurlyQuote = (data: {}) => JSON.stringify(data).replace(\"'\", '’')\n\nexport const stringifyForAttribute = (data = {}) => {\n    return escapeHtml(JSON.stringify(data))\n}\n\n/**\n * This function is included instead of sanitizeString because for\n * inserting HTML into innerHTML we need to make sure all HTML\n * entities are escaped.\n */\nexport const escapeHtml = (text: string) => {\n    const map = {\n        '&': '&amp;',\n        '<': '&lt;',\n        '>': '&gt;',\n        '\"': '&quot;',\n        \"'\": '&#039;'\n    } as { [s: string]: string }\n\n    return text.replace(/[&<>\"']/g, (m) => map[m])\n}\n\n/**\n * Because setting attributes escapes more than the characters above and then preact also\n * escapes text we need a more complete way of unescaping all html entities (not just the ones\n * above)\n */\nconst domParser = new DOMParser()\nexport const unescapeHtml = (text: string) => {\n    return domParser.parseFromString(text, \"text/html\").body.textContent\n}\n\nexport const sanitizeString = (data: {}) => {\n    if (!data) {\n        return ''\n    }\n\n    return data.toString().replace(/\"/g, '&quot;').replace(/'/g, '&apos;')\n}\n\nexport const stripTags = (s: string) => {\n    return (s || '').replace(/(<([^>]+)>)/gi, '')\n}\n\nexport const setAttributes = (element: Element, attrs: Record<string, any>) => {\n    for (let key in attrs) {\n        element.setAttribute(key, attrs[key])\n    }\n    return element\n}\n\nexport const getMetaContent = (metaName: string) => {\n    const metaTag = document.querySelector(`meta[name=${metaName}]`)\n    if (!metaTag) {\n        return ''\n    }\n    return metaTag.getAttribute('content')\n}\n\nexport const isObjectEmpty = (obj: {}) => {\n    return Object.keys(obj).length === 0\n}\n","export const MAX_WIDTH_CONTAINER = 1160\n\nexport const BREAKPOINT_XL = 1920\nexport const BREAKPOINT_TABLET = 1024\nexport const BREAKPOINT_L = 996\nexport const BREAKPOINT_M = 768\nexport const BREAKPOINT_S = 750\nexport const BREAKPOINT_XS = 375\n\nexport const CTA_PRIMARY = 'primary'\nexport const CTA_PRIMARY_TRANSPARENT = 'primary_transparent'\nexport const CTA_SUBTLE = 'subtle'\nexport const CTA_LINK = 'link'\nexport const CTA_LINK_UNDERLINE = 'link-underline'\nexport const CTA_LINK_GOLD = 'link-gold'\nexport const CTA_LINK_ADD_TO_CART_SMALL = 'AddToCart_small'\nexport const CTA_LINK_ADD_TO_CART_LARGE = 'AddToCart_large'\n\nexport const EVENT_TAB_CHANGE = 'EVENT_TAB_CHANGE'\n\nexport const EVENT_VIDEO = 'WEB_COMPONENT_VIDEO'\nexport const EVENT_POPIN_OPEN = 'WEB_COMPONENT_POPIN_OPEN'\nexport const EVENT_POPIN_OPENED = 'WEB_COMPONENT_POPIN_OPENED'\nexport const EVENT_POPIN_CLOSE = 'WEB_COMPONENT_POPIN_CLOSE'\nexport const EVENT_POPIN_CLOSED = 'WEB_COMPONENT_POPIN_CLOSED'\nexport const EVENT_POPIN_CLOSE_CLICK = 'WEB_COMPONENT_POPIN_CLOSE_CLICK'\nexport const EVENT_POPIN_KEY_DOWN = 'keydown'\nexport const EVENT_POPIN_FORM_TOGGLE_TITLE = 'WEB_COMPONENT_POPIN_FORM_TOGGLE_TITLE'\nexport const EVENT_CTA_CLICK = 'WEB_COMPONENT_CTA_CLICK'\nexport const EVENT_HERO_REORDER_OPEN = 'WEB_COMPONENT_HERO_REORDER_OPEN'\nexport const EVENT_HERO_REORDER_CLOSE = 'WEB_COMPONENT_HERO_REORDER_CLOSE'\nexport const EVENT_QUICKVIEW_OPEN = 'WEB_COMPONENT_QUICKVIEW_OPEN'\nexport const EVENT_QS_OPEN = 'WEB_COMPONENT_QS_OPEN'\nexport const EVENT_QS_OPENED = 'WEB_COMPONENT_QS_OPENED'\nexport const EVENT_QS_CLOSE = 'WEB_COMPONENT_QS_CLOSE'\nexport const EVENT_QS_CLOSED = 'WEB_COMPONENT_QS_CLOSED'\nexport const EVENT_QS_CLOSE_CLICK = 'WEB_COMPONENT_QS_CLOSE_CLICK'\nexport const EVENT_QS_KEY_DOWN = 'keydown'\nexport const EVENT_ADD_TO_CART = 'WEB_COMPONENT_ADD_TO_CART'\nexport const EVENT_CART_UPDATED = 'WEB_COMPONENT_CART_UPDATED'\nexport const EVENT_VIDEO_TOGGLE = 'WEB_COMPONENT_VIDEO_TOGGLE'\nexport const VIDEO_ON_HOVER = 'VIDEO_ON_HOVER'\nexport const VIDEO_ON_OUT = 'VIDEO_ON_OUT'\nexport const EVENT_DETAIL_OPEN = 'WEB_COMPONENT_DETAIL_OPEN'\nexport const EVENT_SLIDER_READY = 'WEB_COMPONENT_SLIDER_READY'\nexport const EVENT_SLIDE_CHANGE = 'WEB_COMPONENT_SLIDE_CHANGE'\nexport const EVENT_OVERLAY_OPEN = 'WEB_COMPONENT_OVERLAY_OPEN'\nexport const EVENT_OVERLAY_CLOSE = 'WEB_COMPONENT_OVERLAY_CLOSE'\nexport const EVENT_OVERLAY_CLICKED = 'WEB_COMPONENT_OVERLAY_CLICKED'\nexport const EVENT_OPEN_PRODUCT_AR_CLICKED = 'OPEN_PRODUCT_AR_CLICKED'\nexport const EVENT_SORT_BY_CHANGE = 'WEB_COMPONENT_SORT_BY_CHANGE'\n\nexport const EVENT_BUBBLE_SELECTED = 'EVENT_BUBBLE_SELECTED'\nexport const EVENT_RECO_TOOL_OPTION_CLICKED = 'EVENT_RECO_TOOL_OPTION_CLICKED'\nexport const WEB_COMPONENT_PROJECTS_LOADED = 'WEB_COMPONENT_PROJECTS_LOADED'\nexport const WEB_COMPONENT_ANCHOR_LOADED = 'WEB_COMPONENT_ANCHOR_LOADED'\n\nexport const EVENT_SWIPED_UP = 'swiped-up'\nexport const EVENT_SWIPED_DOWN = 'swiped-down'\nexport const EVENT_SWIPED_LEFT = 'swiped-left'\nexport const EVENT_SWIPED_RIGHT = 'swiped-right'\n\nexport const EVENT_HEADER_POSITION_CHANGED = 'EVENT_HEADER_POSITION_CHANGED'\n\nexport const keys = { ESC: 'Escape' }\n\nexport const ADD_TO_CART_MODIFIER_MINI = 'mini'\nexport const ADD_TO_CART_MODIFIER_DEFAULT = ADD_TO_CART_MODIFIER_MINI\n\nexport const COFFEE_ORIGINAL = 'original'\nexport const COFFEE_VERTUO = 'vertuo'\nexport const COFFEE_PRO = 'pro'\nexport const COFFEE_OL = 'OL'\nexport const COFFEE_VL = 'VL'\nexport const INTENSITY_MAX_OL = 14\nexport const INTENSITY_MAX_VL = 12\nexport const DEFAULT_BUBBLE_ICON = ''\n\nexport const NUMBER_PRODUCTS_SLIDER = 8\nexport const NUMBER_FEATURES_PDP = 8\n\nexport const ALIGNMENT = ['center', 'left', 'right']\nexport const POSITION = ['top', 'right', 'bottom', 'left']\nexport const TRANSLATION_ADD_TO_CART = 'Add to cart'\nexport const TRANSLATION_UPDATE_BASKET = 'Update basket'\n\nexport const TIME_INSTANT = 1\nexport const TIME_FAST = 300\nexport const TIME_MEDIUM = 600\nexport const TIME_SLOW = 1200\n\nexport const APP_APPLE_LINK = {\n    default: 'https://apps.apple.com/us/app/nespresso/id342879434',\n    us: 'https://apps.apple.com/us/app/nespresso-new/id1609639566',\n    uk: 'https://apps.apple.com/gb/app/nespresso-new/id1609639566'\n}\nexport const APP_ANDROID_LINK =\n    'https://play.google.com/store/apps/details?id=com.nespresso.activities'\nexport const APP_HUAWEI_LINK = 'https://appgallery.huawei.com/app/C102571517'\n\nexport const SRC_PAGE_PLP = 'plp'\nexport const SRC_PAGE_PDP = 'pdp'\n\nexport const PLP_TYPE_COFFEE = 'coffee'\nexport const PLP_TYPE_MACHINE = 'machine'\nexport const PLP_TYPE_ACCESSORY = 'accessory'\nexport const CALLEO_API_DOMAIN = 'https://www.contact.nespresso.com/'\n\n// SCSS RELATED\n// Todo : should be shared by JS and SCSS\nexport const BROWSER_CONTEXT = 16 // 1rem = 16px\nexport const COLOR_WHITE_1000 = '#FFFFFF' // Do not change for #FFF shortcut, it will break slider-natural gradients !\n\nexport const CONTRAST_DARK = 'dark'\nexport const CONTRAST_LIGHT = 'light'\n\nexport const B2B_CONTACT_FORM_POPIN_ID = 'b2b-contact-form-popin-id'\nexport const B2B_CONTACT_FORM_POPIN_SRC_SEARCH = 'coveo-search'\n\nexport const B2B_CONTACT_FORM_POPIN_SRC_SKU_MAIN_INFO = 'sku-main-info'\n\nexport const B2B_CONTACT_FORM_POPIN_SRC_SKU_MAIN_INFO_AUTO = 'sku-main-info-auto'\n\nexport const ASPECT_RATIO_16_9 = '16/9'\nexport const ASPECT_RATIO_1_1 = '1/1'\n\nexport const NESPRESSO_PRODUCTION_DOMAIN = 'https://www.nespresso.com'\nexport const NESPRESSO_ROLLOUT_DOMAIN = 'https://nc2-env-rollout.nespresso.com'\n\nexport const EVENT_QUIZ_ON_GO_BACK = 'WEB_COMPONENT_EVENT_QUIZ_ON_GO_BACK'\nexport const EVENT_QUIZ_SUBMIT = 'WEB_COMPONENT_EVENT_QUIZ_SUBMIT'\n","const createRefs = component => [...component.querySelectorAll('[data-ref]')].reduce(extract, {})\n\nconst extract = (refs, $ref) => {\n    const { ref } = $ref.dataset\n\n    // Check if ref is of type array\n    const refArray = ref.match(/(\\w+)\\[(.+)\\]/)\n\n    if (refArray !== null) {\n        return getRefArray(refs, $ref, refArray)\n    } else {\n        return { ...refs, [$ref.dataset.ref]: $ref }\n    }\n}\n\nconst getRefArray = (refs, $ref, [, name, index]) => {\n    if (refs[name] === undefined) {\n        refs[name] = []\n    }\n    refs[name][index] = $ref\n    return refs\n}\n\nexport default createRefs\n","import { COFFEE_VERTUO } from '@kissui/components/src/constants.mjs'\nimport { getCurrency } from './getCurrency'\nexport { getCurrency } from './getCurrency'\n\nexport const ECAPI_TYPE_CAPSULE = 'capsule'\nexport const ECAPI_TYPE_MACHINE = 'machine'\nexport const ECAPI_TYPE_ACCESSORY = 'accessory'\nexport const ECAPI_TYPE_GIFT_CARD = 'giftcard'\n\nconst TECHNOLOGY_CATEGORY_IDENTIFIER = '/machineTechno/'\nconst SLEEVE_OF_10 = 10\nconst SLEEVE_OF_7 = 7\n\nconst trimSku = sku => sku.replace(/[^a-z0-9- +./]/gi, '')\n\nexport const getLegacySKU = productId => productId.split('prod/').pop()\n\nexport const getPriceFormatter = async () => await window.napi.priceFormat()\n\nexport const getProduct = sku => window.napi.catalog().getProduct(trimSku(sku))\n\nexport function getTechnologyName(productData) {\n    const techno = productData.technologies[0]\n    return techno.substring(\n        techno.indexOf(TECHNOLOGY_CATEGORY_IDENTIFIER) + TECHNOLOGY_CATEGORY_IDENTIFIER.length\n    )\n}\n\nfunction isMultipleOf(quantity, multiple) {\n    return quantity % multiple === 0\n}\n\nexport function getSleeveNumber(product, getTechnologyNameFn = getTechnologyName) {\n    if (product.sales_multiple !== 1 && isMultipleOf(product.sales_multiple, SLEEVE_OF_10)) {\n        // Sleeve of original or vertuo\n        return product.sales_multiple / SLEEVE_OF_10\n    }\n\n    if (\n        product.sales_multiple !== 1 &&\n        getTechnologyNameFn(product) === COFFEE_VERTUO &&\n        isMultipleOf(product.sales_multiple, SLEEVE_OF_7)\n    ) {\n        // Sleeve of vertuo\n        return product.sales_multiple / SLEEVE_OF_7\n    }\n\n    if (product.sales_multiple === 1 && isMultipleOf(product.unitQuantity, SLEEVE_OF_10)) {\n        // Bundle of original or vertuo\n        return product.unitQuantity / SLEEVE_OF_10\n    }\n\n    if (\n        product.sales_multiple === 1 &&\n        getTechnologyNameFn(product) === COFFEE_VERTUO &&\n        isMultipleOf(product.unitQuantity, SLEEVE_OF_7)\n    ) {\n        // Bundle of vertuo\n        return product.unitQuantity / SLEEVE_OF_7\n    }\n\n    return NaN\n}\n\n/**\n * Guess if the product is part of a bundle.\n * This is determined by checking the 'sales_multiple' and 'unitQuantity' properties.\n */\nexport function isBundled(productData) {\n    // TODO: this function should not change the productData, but some components still need it\n    productData.sales_multiple = productData.sales_multiple || productData.salesMultiple\n\n    const isSalesMultipleGreaterThanOne = productData.sales_multiple > 1\n    const isUnitQuantityEqualToOne = productData.unitQuantity === 1\n    const isSalesMultipleEqualToOne = productData.sales_multiple === 1\n    const isUnitQuantityGreaterThanOne = productData.unitQuantity > 1\n\n    // The product is not bundled if sales_multiple > 1 and unitQuantity = 1\n    if (isSalesMultipleGreaterThanOne && isUnitQuantityEqualToOne) {\n        return false\n    }\n\n    // The product is bundled if sales_multiple = 1 and unitQuantity > 1\n    return isSalesMultipleEqualToOne && isUnitQuantityGreaterThanOne\n}\n\n/**\n * Replace an array of SKU with product data\n * Remove the element inside the list if sku fail. It prevents to get an empty item.\n * @param {Array.<String>} skus\n * @param getProductFn\n * @returns {Promise<Awaited<unknown>[]>}\n */\nexport function getProductAndClean(skus, getProductFn = getProduct, napi = window.napi) {\n    const promises = []\n\n    if (!napi) {\n        return Promise.reject()\n    }\n\n    if (!Array.isArray(skus)) {\n        skus = [skus]\n    }\n\n    // Load manually the product to delete SKU fail\n    for (const sku of skus) {\n        promises.push(\n            getProductFn(sku)\n                .then(data => skus.splice(skus.indexOf(sku), 1, data))\n                .catch(() => {\n                    skus.splice(skus.indexOf(sku), 1)\n                    console.error(`getProduct fail on sku ${sku}`)\n                })\n        )\n    }\n\n    return Promise.all(promises)\n}\n\nexport const getFormattedPrice = async price => {\n    const priceFormatter = await getPriceFormatter()\n    const currency = getCurrency()\n\n    return priceFormatter.html\n        ? priceFormatter.html(currency, price)\n        : priceFormatter.short(currency, price) || ''\n}\n\nexport const getProductCategories = async sku => {\n    const productDetails = await getProduct(sku)\n    const productCategories = productDetails ? productDetails.supercategories : []\n    const productCategoriesNew = await Promise.all(\n        productCategories.map(async categoryEncoded => {\n            const productCategoryData = await window.napi.catalog().getCategory(categoryEncoded)\n            return productCategoryData\n        })\n    )\n    return productCategoriesNew\n}\n","import {\n    ECAPI_TYPE_ACCESSORY,\n    ECAPI_TYPE_CAPSULE,\n    ECAPI_TYPE_GIFT_CARD,\n    ECAPI_TYPE_MACHINE\n} from '@kissui/helpers/src/catalog'\n\nexport const getSkuComponentByType = ({ type, is_machine_b2b }) => {\n    let result = 'nb-sku'\n\n    if (type === ECAPI_TYPE_CAPSULE) {\n        result = 'nb-sku-coffee'\n    } else if (type === ECAPI_TYPE_MACHINE && is_machine_b2b) {\n        result = 'nb-sku-machine-b2b'\n    } else if (type === ECAPI_TYPE_MACHINE) {\n        result = 'nb-sku-machine'\n    } else if (type === ECAPI_TYPE_ACCESSORY) {\n        result = 'nb-sku-accessory'\n    } else if (type === ECAPI_TYPE_GIFT_CARD) {\n        result = 'nb-sku-gift-card'\n    }\n\n    return result\n}\n\nexport const apiOverride = (productData, pageBuilderData) => {\n    if (!productData || !pageBuilderData) {\n        return {}\n    }\n\n    const { images, name, headline, description } = productData\n    const { api_override } = pageBuilderData\n\n    if (!api_override) {\n        return {}\n    }\n\n    return {\n        image: api_override.image || images?.icon || images?.url || images?.push || images?.main,\n        name: api_override.name || name,\n        headline: api_override.headline || headline,\n        description: api_override.description || description\n    }\n}\n","export const VARIATION_PLP = 'plp'\nexport const VARIATION_PDP = 'pdp'\nexport const VARIATION_CROSS_SELL = 'cross-sell'\nexport const VARIATION_SMALL = 'small'\n","export const getDataLayer = () => {\n    return window[window?.padlNamespace]?.dataLayer\n}\n\nexport const getMarketCode = () => {\n    const dataLayer = getDataLayer()\n    if (!dataLayer) {\n        return 'ch'\n    }\n\n    return dataLayer.app.app.market.toLocaleLowerCase()\n}\n\nexport const getLangCode = () => {\n    const dataLayer = getDataLayer()\n    if (!dataLayer) {\n        return 'en'\n    }\n\n    return getDataLayer().page.page.pageInfo.language.toLocaleLowerCase()\n}\n\nexport const getSegmentCode = () => {\n    const dataLayer = getDataLayer()\n    if (!dataLayer) {\n        return 'B2C'\n    }\n\n    return getDataLayer().page.page.pageInfo.segmentBusiness\n}\n\nexport const isLoggedIn = () => {\n    const dataLayer = getDataLayer()\n    if (!dataLayer || !dataLayer.user) {\n        return false\n    }\n\n    return dataLayer.user.isLoggedIn\n}\n\nexport const interpolateMarketLang = (string, market, lang) => {\n    return string.replace('{market}', market).replace('{lang}', lang)\n}\n","import { getMarketCode } from './dataLayer'\n\nconst LABEL_CATEGORY_NAME = 'cat/capsule-range-label'\nconst LABEL_CATEGORY_NAME_MACHINE = 'cat/machine-range-label'\nexport const RANGE_CATEGORY_NAME = 'cat/capsule-range'\nconst FAIR_TRADE_CATEGORY_NAME = 'cat/capsule-range-fair-trade'\nconst VERTUO_NEXT_CATEGORY_NAME = 'cat/capsule-attribute-only-vertuo-next'\nconst ORGANIC_EU_CATEGORY_NAME = 'capsule-attribute-organic-eu'\nconst RAINFOREST_CATEGORY_NAME = 'capsule-attribute-rainforest'\nconst SUSTAINABILITY_CATEGORY_NAME = 'capsule-attribute-sustainability'\nconst ARABICA_CATEGORY_NAME = 'capsule-attribute-arabica'\nconst PRODUCT_HIGHLIGHT_CATEGORY_NAME = 'cat/capsule-attribute-highlight'\nconst TECHNOLOGY_CATEGORY_IDENTIFIER = '/machineTechno/'\n\nconst COMMON_URL = 'https://www.nespresso.com/shared_res/agility/commons/img/icons/'\n\nexport const FAIR_TRADE_IMG = COMMON_URL + 'fairTrade.svg'\nexport const ORGANIC_LOGO_IMG_EU = COMMON_URL + 'logo-organic-eu.svg'\nexport const ORGANIC_LOGO_IMG_US = COMMON_URL + 'logo-organic-us.svg'\nexport const ORGANIC_LOGO_IMG_CA = COMMON_URL + 'logo-organic-ca.svg'\nexport const ORGANIC_LOGO_IMG_BR = COMMON_URL + 'logo-organic-br.svg'\nexport const ORGANIC_LOGO_IMG_JP = COMMON_URL + 'logo-organic-jp.svg'\nexport const ORGANIC_LOGO_IMG_BE = COMMON_URL + 'logo-organic-be.png'\n\nexport const VERTUONEXT_LOGO_IMG = COMMON_URL + 'logo-only-vertuo-next.svg'\nexport const RAINFOREST_LOGO_IMG = COMMON_URL + 'logo-rainforest.svg'\nexport const SUSTAINABILITY_LOGO_IMG = COMMON_URL + 'logo-sustainability.svg'\nexport const Q_CERTIFICATION_ARABICA_LOGO_IMG = COMMON_URL + 'q_grade_certification_arabica.svg'\nexport const DESIGN_AWARD_2021_IMG = COMMON_URL + 'design_award_2021.svg'\n\nexport const LOGO_IMG_MAP = {\n    fair_trade: FAIR_TRADE_IMG,\n    is_organic: getOrganicLogo(),\n    only_vertuo_next: VERTUONEXT_LOGO_IMG,\n    is_q_certified_arabica: Q_CERTIFICATION_ARABICA_LOGO_IMG,\n    is_rainforest: RAINFOREST_LOGO_IMG,\n    is_sustainable: SUSTAINABILITY_LOGO_IMG,\n    is_design_award_2021: DESIGN_AWARD_2021_IMG\n}\n\nexport function getOrganicLogo() {\n    let organicLogoImg = ORGANIC_LOGO_IMG_EU\n\n    switch (getMarketCode()) {\n        case 'us':\n            organicLogoImg = ORGANIC_LOGO_IMG_US\n            break\n        case 'ca':\n            organicLogoImg = ORGANIC_LOGO_IMG_CA\n            break\n        case 'br':\n            organicLogoImg = ORGANIC_LOGO_IMG_BR\n            break\n        case 'jp':\n            organicLogoImg = ORGANIC_LOGO_IMG_JP\n            break\n        case 'be':\n            organicLogoImg = ORGANIC_LOGO_IMG_BE\n            break\n    }\n\n    return organicLogoImg\n}\n\n/**\n * retrieves the list of categories of type Vertuo Next\n * @param {category[]} categories\n */\nexport function getVertuoNext(categories) {\n    return categories.find(category => isVertuoNext(category))\n}\n\n/**\n * returns true when the category is product vertuo next\n * @param {category} category\n */\nfunction isVertuoNext(category) {\n    return getCategoryRegEx(VERTUO_NEXT_CATEGORY_NAME).test(category.id)\n}\n\n/**\n * retrieves the list of categories of type organic EU\n * @param {category[]} categories\n */\nexport function getOrganicEu(categories) {\n    return categories.find(category => isOrganicEu(category))\n}\n\n/**\n * returns true when the category is product organic EU\n * @param {category} category\n */\nfunction isOrganicEu(category) {\n    return getCategoryRegEx(ORGANIC_EU_CATEGORY_NAME).test(category.id)\n}\n\n/**\n * retrieves the list of categories of type rainforest\n * @param {category[]} categories\n */\nexport function getRainforest(categories) {\n    return categories.find(category => isRainforest(category))\n}\n\n/**\n * returns true when the category is rainforest\n * @param {category} category\n */\nfunction isRainforest(category) {\n    return getCategoryRegEx(RAINFOREST_CATEGORY_NAME).test(category.id)\n}\n\n/**\n * retrieves the list of categories of type sustainability\n * @param {category[]} categories\n */\nexport function getSustainability(categories) {\n    return categories.find(category => isSustainability(category))\n}\n\n/**\n * retrieves the list of categories of type arabica\n * @param {category[]} categories\n */\nexport function getArabica(categories) {\n    return categories.find(category => isArabica(category))\n}\n\n/**\n * returns true when the category is arabica\n * @param {category} category\n */\nfunction isArabica(category) {\n    return getCategoryRegEx(ARABICA_CATEGORY_NAME).test(category.id)\n}\n\n/**\n * returns true when the category is sustainability\n * @param {category} category\n */\nfunction isSustainability(category) {\n    return getCategoryRegEx(SUSTAINABILITY_CATEGORY_NAME).test(category.id)\n}\n\n/**\n * retrieves the list of categories of type label\n * @param {category[]} categories\n */\nexport function getLabels(categories) {\n    return categories.filter(category => isLabel(category))\n}\n\n/**\n * retrieves the list of categories of type label\n * @param {category[]} categories\n */\nexport function getProductHighlight(categories) {\n    return categories.find(category => isProductHighlight(category))\n}\n/**\n * retrieves the list of categories of type label\n * @param {category[]} categories\n */\nexport function getFairTrade(categories) {\n    return categories.find(category => isFairTrade(category))\n}\n\n/**\n * returns a regex to match the tail (global) of a given local category ID\n * @param {string} categoryIdTail : should contain the end of the category ID\n */\nexport function getCategoryRegEx(categoryIdTail) {\n    return new RegExp(categoryIdTail.replace(/\\//g, '\\\\/'))\n}\n\n/**\n * returns true when the category is child of the label category (is type label)\n * @param {category} category\n */\nfunction isLabel(category) {\n    return (\n        getCategoryRegEx(LABEL_CATEGORY_NAME).test(category.id) ||\n        getCategoryRegEx(LABEL_CATEGORY_NAME_MACHINE).test(category.id)\n    )\n}\n\n/**\n * returns true when the category is product highlight\n * @param {category} category\n */\nfunction isProductHighlight(category) {\n    return getCategoryRegEx(PRODUCT_HIGHLIGHT_CATEGORY_NAME).test(category.id)\n}\n/**\n * returns true when the category is fair trade\n * @param {category} category\n */\nfunction isFairTrade(category) {\n    return getCategoryRegEx(FAIR_TRADE_CATEGORY_NAME).test(category.id)\n}\n\n/**\n * returns true when the category is child of the range category (is type range)\n * @param {category} category\n */\nexport function isRange(category) {\n    return category.superCategories.some(superCategory =>\n        getCategoryRegEx(RANGE_CATEGORY_NAME).test(superCategory)\n    )\n}\n\nexport function getTechnologyName(productData, categories) {\n    if (!productData || !productData.technologies || !productData.technologies.length) {\n        return null\n    }\n\n    const techno = productData.technologies[0]\n    const categoryNameAsSubstring = techno.substring(\n        techno.indexOf(TECHNOLOGY_CATEGORY_IDENTIFIER) + TECHNOLOGY_CATEGORY_IDENTIFIER.length\n    )\n    const category = categories?.find(cat => cat.id === techno)\n\n    // Backward compatibility, return name as substring if the list of categories are not available\n    return category?.name || categoryNameAsSubstring\n}\n\nexport function isCategoryHidden(categoryId) {\n    let hideCategory = false\n    // To enable AB testing: exclude categories which are to be hidden\n    if (\n        window.PLP_HIDE_CATEGORIES?.length &&\n        window.PLP_HIDE_CATEGORIES.findIndex(c => categoryId.indexOf(c) >= 0) >= 0\n    ) {\n        hideCategory = true\n    }\n\n    // To enable AB testing: exclude categories except those which are to be shown\n    if (window.PLP_ONLY_SHOW_CATEGORIES?.length) {\n        // Default to hide\n        hideCategory = true\n        if (window.PLP_ONLY_SHOW_CATEGORIES.findIndex(c => categoryId.indexOf(c) >= 0) >= 0) {\n            hideCategory = false\n        }\n    }\n    return hideCategory\n}\n","import { INTENSITY_MAX_OL, INTENSITY_MAX_VL } from '@kissui/components'\n\nexport const getMaxIntensity = ({ technologies }) =>\n    technologies.indexOf('original') !== -1 ? INTENSITY_MAX_OL : INTENSITY_MAX_VL\n","import { getFinalPrice } from '@kissui/plp/services'\nimport { isBundled } from '@kissui/helpers/src/catalog'\nimport { getMaxIntensity } from '@kissui/components/src/sku-coffee/services'\n\nexport const getMergedProductCoffeeData = (\n    product,\n    pageBuilderProductProps,\n    pageBuilderProps,\n    priceFormatter,\n    currency\n) => {\n    const { bundle_details } = pageBuilderProductProps\n    const { options } = pageBuilderProps\n    const { show_sleeve_price } = options\n\n    const isBundledResult = isBundled(product)\n\n    const { showCapsulePrice, price_per_capsule, final_price } = getFinalPrice(\n        show_sleeve_price,\n        product,\n        isBundled\n    )\n\n    const option = {\n        bundled: isBundledResult,\n        intensity: product.capsuleProperties?.intensity || product.intensity || null,\n        max_intensity: getMaxIntensity(product),\n        price_per_capsule: price_per_capsule\n            ? priceFormatter.short(currency, price_per_capsule)\n            : null,\n        show_capsule_price: showCapsulePrice\n    }\n\n    if (show_sleeve_price) {\n        option.price = priceFormatter.short(currency, final_price)\n    }\n\n    if (bundle_details) {\n        option.bundle_details = bundle_details\n    }\n\n    return option\n}\n","import {\n    getVertuoNext,\n    getOrganicEu,\n    getRainforest,\n    getLabels,\n    getProductHighlight,\n    getFairTrade,\n    getSustainability,\n    isRange,\n    getCategoryRegEx,\n    RANGE_CATEGORY_NAME,\n    getArabica\n} from '@kissui/helpers/src/cremaDataHelper'\n\n/**\n * Modifies the structure to make it easier to use in components\n * Applies all the data customization mixing Page builder with HMC data\n * @param {object} plpData : original PLP data\n */\nexport async function getMergedPLPData(plpData) {\n    const { data } = plpData\n    if (!data) {\n        return []\n    }\n\n    const eCommerceData = data.configuration.eCommerceData\n\n    addLabels(eCommerceData)\n\n    addProductAttribute(\n        eCommerceData,\n        getFairTrade,\n        (prod, category) => (prod.fairTrade = category.name)\n    )\n    addProductAttribute(eCommerceData, getProductHighlight, prod => (prod.highlighted = true))\n    addProductAttribute(eCommerceData, getVertuoNext, prod => (prod.onlyVertuoNext = true))\n    addProductAttribute(eCommerceData, getOrganicEu, prod => (prod.organicEu = true))\n    addProductAttribute(eCommerceData, getRainforest, prod => (prod.rainforest = true))\n    addProductAttribute(eCommerceData, getSustainability, prod => (prod.sustainability = true))\n    addProductAttribute(eCommerceData, getArabica, prod => (prod.arabica = true))\n\n    addSubSegments(eCommerceData)\n\n    return eCommerceData.categories\n}\n\nfunction addSubSegments(eCommerceData) {\n    const { categories, productGroups, products } = eCommerceData\n    // should be forEach if nothing returned/assigned\n    categories.forEach(category => {\n        const hasSegment = category.subCategories.length > 0 && isRange(category)\n        if (hasSegment) {\n            category.segments = category.subCategories.map(categoryId => {\n                const segment = categories.find(subCategory => subCategory.id === categoryId)\n                if (segment && isSubsegment(categories, segment)) {\n                    segment.products = getProductsData(productGroups, segment.id, products)\n                    segment.isSegment = true\n                }\n                return segment\n            })\n        }\n\n        category.products = getProductsData(productGroups, category.id, products)\n    })\n}\n\nexport function getProductsData(productGroups, categoryId, products) {\n    let result = []\n    try {\n        const currentCategory = productGroups.find(category => category.categoryId === categoryId)\n\n        if (!currentCategory) {\n            return result\n        }\n\n        const { productIds } = currentCategory\n        return productIds.map(productId => {\n            const product = products.find(product => product.id === productId)\n            return product\n        })\n    } catch (e) {\n        //generally an anti pattern to only log the error, with no try catch the result would be the same\n        console.log(e)\n    }\n\n    return result\n}\n\n/**\n * adds labels property to products containing each label's category data (JSON parsed description property) assigned to it\n * labels are categories that have the label base category as parent\n * to apply a label on a given product, the label has to contain the product\n * this function has to clean the productGroups as well by removing the label ones\n * @param {category[]} categories\n * @param {productGroup[]} productGroups\n * @param {product[]} products\n */\nfunction addLabels(eCommerceData) {\n    const { categories, productGroups, products } = eCommerceData\n    const labels = getLabels(categories)\n    const labelGroups = getLabelGroups(productGroups, labels)\n    labelGroups.forEach(group => {\n        const label = labels.find(label => label.id === group.categoryId)\n        group.productIds.forEach(productId => {\n            const prod = products.find(product => product.id === productId)\n            prod.labels = prod.labels || []\n            prod.labels.push(label.description)\n        })\n    })\n    //removing label categories from productGroups\n    labelGroups.forEach(labelGroup => {\n        const indexToRemove = productGroups.findIndex(\n            productGroup => productGroup.categoryId === labelGroup.categoryId\n        )\n        productGroups.splice(indexToRemove, 1)\n    })\n}\n\n/**\n * adds a property to products containing the given category assigned to it\n * The category is recognized by ID\n * to apply a the category on a given product, the category's productGroup has to contain the product\n * this function has to clean the productGroups as well by removing the given's one to not let it display as a range in the PLP\n * @param {category[]} categories\n * @param {productGroup[]} productGroups\n * @param {product[]} products\n */\nfunction addProductAttribute(eCommerceData, categoryFetcher, assignHandler) {\n    const { categories, productGroups, products } = eCommerceData\n    const category = categoryFetcher(categories)\n    if (!category) {\n        return\n    }\n    const categoryGroup = getCategoryGroup(productGroups, category)\n    if (!categoryGroup) {\n        return\n    }\n    categoryGroup.productIds.forEach(productId => {\n        const prod = products.find(product => product.id === productId)\n        if (categoryFetcher === getArabica) {\n            console.log('addProductAttribute', prod)\n        }\n        assignHandler(prod, category)\n    })\n    const indexToRemove = productGroups.findIndex(\n        productGroup => productGroup.categoryId === categoryGroup.categoryId\n    )\n    productGroups.splice(indexToRemove, 1)\n}\n\n/**\n * retrieve all the productGroup that are labels\n * @param {productGroup[]} productGroups\n * @param {category[]} labels\n */\nfunction getLabelGroups(productGroups, labels) {\n    return productGroups.filter(group => labels.some(label => label.id === group.categoryId))\n}\n\n/**\n * retrieve the productGroup which correspond to a category\n * @param {productGroup[]} productGroups\n * @param {category} fairTrade\n */\nfunction getCategoryGroup(productGroups, category) {\n    return productGroups.find(group => category.id === group.categoryId)\n}\n\n/**\n * returns true when the category is child of the range category (is type range)\n * @param {category} category\n */\nexport function isSubsegment(categories, category) {\n    /*category.superCategories.some(superCategoryId => {\n        const superCategoryData = categories.find(categoryToFind => categoryToFind.id === superCategoryId)\n    })*/\n    const result = category.superCategories.some(superCategory =>\n        getCategoryRegEx(RANGE_CATEGORY_NAME).test(superCategory)\n    )\n    return result\n}\nexport function getFinalPrice(show_sleeve_price, product, isBundled) {\n    let showCapsulePrice = show_sleeve_price\n    let final_price\n    let price_per_capsule\n\n    const bundled = isBundled(product)\n\n    if (product.type === 'capsule' && !bundled) {\n        final_price = product.price * product.salesMultiple\n        // this isn't necessary in prod but the mock price formatter needs it\n        final_price = Math.round(final_price * 100) / 100\n        price_per_capsule = product.price\n    } else {\n        showCapsulePrice = false\n        final_price = product.price\n    }\n\n    return { showCapsulePrice, final_price, price_per_capsule }\n}\n","import { sanitizeString } from '@kissui/helpers/src/utils'\nimport { getMergedProductCoffeeData } from './product.coffee.dto'\nimport { getMergedProductMachineData } from './product.machine.dto'\nimport { VARIATION_PLP } from '@kissui/components/src/sku/constants'\nimport { getMergedProductGiftCardData } from './product.giftCard.dto'\nimport { getMergedProductAccessoryData } from './product.accessory.dto'\nimport { apiOverride } from '@kissui/components/src/sku/services'\nimport {\n    ECAPI_TYPE_ACCESSORY,\n    ECAPI_TYPE_CAPSULE,\n    ECAPI_TYPE_GIFT_CARD,\n    ECAPI_TYPE_MACHINE\n} from '@kissui/helpers/src/catalog'\n\nexport const getMergedProductData = (\n    product,\n    pageBuilderProductProps,\n    pageBuilderProps,\n    priceFormatter,\n    currency\n) => {\n    const { options } = pageBuilderProps\n    const {\n        variant = {},\n        labels = [],\n        strikethrough_price,\n        additional_message,\n        additional_message_icon,\n        additional_message_link,\n        contact_cta\n    } = pageBuilderProductProps || {}\n\n    // lists header props not coming from this.props\n    let data = {\n        sku: product.internationalId,\n        technologies: product.technologies,\n        longSku: product.id,\n        name: product.name,\n        headline: sanitizeString(product.headline),\n        sales_multiple: product.salesMultiple,\n        unit_quantity: product.unitQuantity,\n        type: product.type,\n        category_name: product.rangeData?.name || '',\n        label_range: product.rangeData?.name || '',\n        price: product.price ? priceFormatter.short(currency, product.price) : null,\n        rawPrice: product.price,\n        strikethrough_price: strikethrough_price || '',\n        variation: VARIATION_PLP,\n        image_alt_text: product.name,\n        image: product.images?.icon || product.images?.push || product.images?.main,\n        additional_message: additional_message || '',\n        additional_message_icon: additional_message_icon || '',\n        additional_message_link: additional_message_link || {},\n        contact_cta: contact_cta || {},\n        ...apiOverride(product, pageBuilderProductProps)\n    }\n\n    if (labels && labels.length) {\n        data.labels = labels\n    }\n\n    if (product.highlighted) {\n        data.highlighted = product.highlighted\n    }\n\n    let dataTransformObjectProductType = {}\n    if (product.type === ECAPI_TYPE_CAPSULE) {\n        dataTransformObjectProductType = getMergedProductCoffeeData(\n            product,\n            pageBuilderProductProps,\n            pageBuilderProps,\n            priceFormatter,\n            currency\n        )\n    } else if (product.type === ECAPI_TYPE_MACHINE) {\n        dataTransformObjectProductType = getMergedProductMachineData(\n            product,\n            pageBuilderProductProps,\n            pageBuilderProps\n        )\n    } else if (product.type === ECAPI_TYPE_ACCESSORY) {\n        dataTransformObjectProductType = getMergedProductAccessoryData(\n            product,\n            pageBuilderProductProps,\n            pageBuilderProps\n        )\n    } else if (product.type === ECAPI_TYPE_GIFT_CARD) {\n        dataTransformObjectProductType = getMergedProductGiftCardData(\n            product,\n            pageBuilderProductProps,\n            pageBuilderProps\n        )\n    }\n\n    return {\n        ...product,\n        ...options,\n        ...variant,\n        ...data,\n        ...dataTransformObjectProductType\n    }\n}\n","export const getMergedProductMachineData = (product, pageBuilderProductProps, pageBuilderProps) => {\n    const { strikethrough_price, variant = {} } = pageBuilderProductProps\n    const { ratingsAndReviews } = product\n\n    // lists header props not coming from this.props\n    const options = {\n        ratings: ratingsAndReviews\n    }\n\n    if (variant?.colors) {\n        options.colors = variant.colors\n        options.activeSku = product.internationalId\n        options.max_colors = 99\n    }\n\n    options.strikethrough_price = strikethrough_price || ''\n    options.show_ratings = (pageBuilderProps && pageBuilderProps.options.show_ratings) || false\n    options.minimum_rating = (pageBuilderProps && pageBuilderProps.options.minimum_rating) || 0\n\n    return options\n}\n","export const getMergedProductAccessoryData = () => ({})\n","export const getMergedProductGiftCardData = (_, pageBuilderProductProps) => {\n    const { variant = {} } = pageBuilderProductProps\n\n    return {\n        image: variant && variant.default_image\n    }\n}\n","import { getDataLayer } from '@kissui/helpers/src/dataLayer'\n\nexport async function setPDPDataProvider() {\n    window.getPDPData = window.getPDPData || getPDPData\n}\n\nexport async function getPDPData() {\n    return await window.pdpData\n}\n\nexport async function market() {\n    return napi.market().read() // eslint-disable-line\n}\n\nexport function getCurrency() {\n    return getDataLayer().currency\n}\n\nexport async function getPriceFormatter() {\n    return napi.priceFormat() // eslint-disable-line\n}\n","export const NB_SLIDES_MOBILE = 1\nexport const NB_SLIDES_TABLET = 2\nexport const NB_SLIDES_DESKTOP = 3\n\nexport const SLIDES_TO_SCROLL = 1\nexport const MAX_PRODUCTS = 8\n","const toNonProd = new URLSearchParams(window.location.search).has('non-prod')\n\nexport const COVEO_ACCESS_TOKEN = toNonProd\n    ? 'xxea192144-c340-457a-bfb0-dfb5cbe4970e'\n    : 'xxc997e6c1-d94a-4d9f-b8fb-0c641f6813f3'\nexport const COVEO_ORGANIZATION_ID = toNonProd\n    ? 'nespressononproduction1skusciyz'\n    : 'nespressoproductiong3iqhhz5'\nexport const COVEO_PLATFORM_URL = 'https://platform-eu.cloud.coveo.com'\n","// TODO where is the best place to put this black magic\nconst toNonProd = new URLSearchParams(window.location.search).has('non-prod') || window.location.host.includes('nc2-env-rollout')\n\n// export const COVEO_ACCESS_TOKEN = 'xxc997e6c1-d94a-4d9f-b8fb-0c641f6813f3'\n// export const COVEO_ORGANIZATION_ID = 'nespressoproductiong3iqhhz5'\nexport const COVEO_ACCESS_TOKEN = toNonProd\n    ? 'xxea192144-c340-457a-bfb0-dfb5cbe4970e'\n    : 'xxc997e6c1-d94a-4d9f-b8fb-0c641f6813f3'\nexport const COVEO_ACCESS_TOKEN_B2B = toNonProd\n    ? 'xx847978f3-7957-46fe-9dcf-1b82152e0d9c'\n    : 'xxc511eda8-240a-4ba7-a372-49574b86e70b'\nexport const COVEO_ORGANIZATION_ID = toNonProd\n    ? 'nespressononproduction1skusciyz'\n    : 'nespressoproductiong3iqhhz5'\nexport const COVEO_PLATFORM_URL = 'https://platform-eu.cloud.coveo.com'\nexport const COVEO_API_KEY_RECS = 'xxf96dac22-66c0-438a-a58c-fe13fa817e86'\nexport const COVEO_API_KEY_CART_RECS = 'xx5a4f431d-da86-4d34-a585-6ddd7e8148de'\nexport const COVEO_CLIENT_ORIGIN_SEARCH_API_FETCH = 'searchApiFetch'\nexport const COVEO_CLIENT_ORIGIN_ANALYTICS_FETCH = 'analyticsFetch'\nexport const COVEO_MAX_RESPONSE_TIME = 8000\n\nexport const COVEO_SEARCH_TERM_MIN_LENGTH = 3\n\nexport const CAPSULE_TECHNOLOGY_B2B = 'Pro'\n\nexport const B2B_PRICE_DISPLAY_ALL = 'ALL'\nexport const B2B_PRICE_DISPLAY_ONLY_AUTHENTICATED = 'ONLY_AUTHENTICATED'\n\n","import {getMarketCode, getSegmentCode, isLoggedIn} from \"@kissui/helpers/src/dataLayer\";\nimport {\n    B2B_PRICE_DISPLAY_ALL, B2B_PRICE_DISPLAY_ONLY_AUTHENTICATED,\n    COVEO_ACCESS_TOKEN,\n    COVEO_ACCESS_TOKEN_B2B\n} from \"./search-bar/constants\";\nimport {ProductResult } from \"./experimental/engine\";\n\ninterface Config {\n    experimentalSearch: {\n        enabledMarkets: string[];\n    };\n}\n\nconst sessionKey = 'nn_searchConfigData_C6_R0';\n\nasync function fetchConfigData(): Promise<Config> {\n    const signal = AbortSignal.timeout(3000)\n    const response = await fetch('/shared_res/agility/coveo-search/config.json', { signal })\n\n    if (response.ok) {\n        const config = await response.json()\n        sessionStorage.setItem(sessionKey, JSON.stringify(config))\n        return config\n    } else {\n        throw new Error('SEARCH_CONFIG_FETCH_ERROR')\n    }\n}\n\nasync function getConfig(): Promise<Config> {\n  const configData = sessionStorage.getItem(sessionKey)\n\n  return configData ? JSON.parse(configData) : fetchConfigData()\n}\n\nexport async function getExperimentalMode(): Promise<boolean> {\n    try {\n        const isB2B = getSegmentCode().toUpperCase() === 'B2B'\n        const hasExperimentalFlag = window.location.href.includes('experimental-search')\n        const forceExperimental = isB2B || hasExperimentalFlag\n\n        if (forceExperimental) {\n            return true\n        }\n\n        const currentMarket = getMarketCode()?.toUpperCase()\n        const config = await getConfig()\n        const enabledMarkets = config?.experimentalSearch?.enabledMarkets ?? []\n\n        return !!enabledMarkets?.includes(currentMarket)\n    } catch (error) {\n        return false\n    }\n}\n\nexport function isB2B() : boolean {\n    return getSegmentCode().toUpperCase() === 'B2B'\n}\n\nexport function getCoveoAccessToken() : string {\n    return isB2B() ? COVEO_ACCESS_TOKEN_B2B : COVEO_ACCESS_TOKEN\n}\n\n// Check price condition only of B2B\nexport const showPriceSection = (result: ProductResult) : boolean=> {\n    if(!isB2B()){\n        return true\n    }\n    return isB2B() ? result.price !== undefined : true;\n}\n\n// check if the flag nes_prd_price_display is set\nexport const displayPrice = (result: ProductResult) : boolean => {\n    if(!isB2B()){\n        return true\n    }\n\n    const isPublicPrice = result.priceDisplay === B2B_PRICE_DISPLAY_ALL;\n    const isAuthenticatedPrice = result.priceDisplay === B2B_PRICE_DISPLAY_ONLY_AUTHENTICATED && !!isLoggedIn();\n    return isPublicPrice || isAuthenticatedPrice;\n}\n\nexport const getTaxSystemTariff = async () => {\n    if(!isB2B()){\n        return ''\n    }\n    let taxSystemTariff = ''\n    if(!isLoggedIn()){\n        const { taxSystem, tariff } = await window.napi.market().read()\n        taxSystemTariff = `${taxSystem}_${tariff}`\n    }\n    else {\n        const { taxSystem, tariff } = await window.napi.customer().read()\n        taxSystemTariff = `${taxSystem}_${tariff}`\n    }\n\n    return taxSystemTariff\n}\n\nexport function setSearchedQuery(query: string): void {\n    sessionStorage.setItem('searchedQuery-sessionKey', query)\n}\n\nexport function getSearchedQuery(): string | null {\n    return sessionStorage.getItem('searchedQuery-sessionKey')\n}\n\nexport function deleteSearchedQuery(): void {\n    sessionStorage.removeItem('searchedQuery-sessionKey')\n}\n\n","\nimport { SharedProps } from \"./types\"\n\nexport const fieldsToInclude = [\n    \"author\",\n    \"language\",\n    \"urihash\",\n    \"objecttype\",\n    \"collection\",\n    \"source\",\n    \"permanentid\",\n    \"date\",\n    \"parents\",\n    \"commontab\",\n    \"filetype\",\n    \"nes_prd_sku\",\n    \"nes_prd_image_url\",\n    \"nes_prd_categories\",\n    \"nes_prd_sleeve_main_price\",\n    \"nes_prd_name\",\n    \"nes_prd_price\",\n    \"nes_prd_technology\",\n    \"faq_question\",\n    \"faq_answer\",\n    \"nes_prd_cup_size_oz\",\n    \"nes_prd_sales_multiple\",\n    \"nes_prd_cup_size\",\n    \"nes_prd_unit_quantity\",\n    \"nes_article_category\",\n    \"nes_prd_color\",\n    \"nes_prd_color_css\",\n    \"nes_prd_usage\",\n    \"nes_prd_intensity\",\n    \"nes_prd_quantities\",\n    \"nes_prd_bundled\",\n    \"nes_prd_strikethrough_price\",\n]\n\nexport const fieldsToIncludeB2B = [...fieldsToInclude,\n    \"nes_prd_price_display\",\n    \"nes_prd_sku\"\n]\n\nexport const getCoveoAnalytics = ({ visitorId }: { visitorId: string }) => {\n    return ({\n        clientId: visitorId,\n        \"clientTimestamp\": new Date().toISOString(),\n        \"documentReferrer\": \"default\",\n        \"originContext\": \"Search\",\n        \"documentLocation\": window.location.href\n    })\n}\n\nexport const getCoveoContext = (ctx: Pick<SharedProps, \"website\" | \"sitename\" | \"contextWebsite\" | \"contextSitename\" | \"lang\" | \"locale\" | \"country\">) => {\n    return ({\n        \"website\": ctx.website,\n        \"sitename\": ctx.sitename,\n        \"context_website\": ctx.contextWebsite,\n        \"context_sitename\": ctx.contextSitename,\n        \"language\": ctx.lang,\n        \"locale\": ctx.locale,\n        \"country\": ctx.country\n    })\n}\n\nexport const getCoveoGroupBy = (q: string) => {\n    return [\n        {\n            \"field\": \"@commontab\",\n            \"queryOverride\": q,\n            \"constantQueryOverride\": \"@uri\",\n            \"advancedQueryOverride\": \"@uri\"\n        }\n    ]\n}\n\n","import { getMarketCode, getLangCode } from '@kissui/helpers/src/dataLayer'\nimport { MAX_PRODUCTS } from '../js/constants'\nimport { COVEO_ORGANIZATION_ID, COVEO_PLATFORM_URL } from '../js/coveo.config'\nimport { loadExternalScript } from '@kissui/helpers/src/utils'\nimport { COVEO_CLIENT_ORIGIN_SEARCH_API_FETCH, COVEO_MAX_RESPONSE_TIME } from '../constants.mjs'\nimport { getCoveoAccessToken, isB2B } from '@kissui/coveo-search/src/config'\nimport {\n    fieldsToInclude,\n    fieldsToIncludeB2B\n} from '../../../../coveo-search/src/experimental/engine/shared/coveo-api-commons'\n\nlet CoveoHeadless\nconst language = getLangCode()\nconst country = getMarketCode()\nconst upperCaseCountry = country.toUpperCase()\nconst locale = `${language}-${upperCaseCountry}`\nexport const fetchProductsLastOrder = async (checkoutService = window.napi.checkout) => {\n    try {\n        const lastOrder = await checkoutService().getMyLastOrder()\n\n        if (!lastOrder?.quotation?.cartLines?.length) {\n            return []\n        }\n\n        return lastOrder.quotation.cartLines\n            .map(cartItem => cartItem.legacyId)\n            .slice(0, MAX_PRODUCTS)\n    } catch (error) {\n        console.error('Failed to retrieve last order data', error)\n        throw new Error('Failed to retrieve last order data')\n    }\n}\nconst expectedRecommendations = [\n    'VER_LIMITED_EDITION_1',\n    'VER_LIMITED_EDITION_2',\n    'VER_LIMITED_EDITION_3',\n    'VER_LIMITED_EDITION_4',\n    'VER_LIMITED_EDITION_5',\n    'CLA_LIMITED_EDITION_1',\n    'CLA_LIMITED_EDITION_2',\n    'CLA_PERMANENT_5',\n    'VER_PERMANENT_1',\n    'VER_PERMANENT_2',\n    'VER_PERMANENT_3',\n    'VER_PERMANENT_4',\n    'VER_PERMANENT_5'\n]\n/**\n * @returns {Promise<string[]>}\n */\nexport const fetchHQRecommendation = async () => {\n    // This prevent the double module instantiation when using redirection tools, both localhost and nespresso.com\n    const { subscribe } = await import(\n        `${window.location.origin}/shared_res/agility/next-components/vendors/event-queue.es.min.js`\n    )\n\n    const baseUrl = `/ecapi/products/v2/${country}/b2c/productsByCategories`\n    const params = new URLSearchParams({\n        language,\n        superCategory: 'capsules',\n        allDetails: 'false',\n        usageIntent: 'standard-order'\n    })\n    const url = `${baseUrl}?${params}`\n\n    const plpProductList = []\n\n    const response = await fetch(url)\n\n    if (!response.ok) {\n        throw new Error('Failed to retrieve products by categories data')\n    }\n    const data = await response.json()\n\n    data.forEach(category => {\n        category?.products?.forEach(product => {\n            plpProductList.push(product.legacyId)\n        })\n    })\n\n    const waitTimeout = 10000\n    let timeoutHandler\n    let unsubscribe\n    return new Promise((resolve, reject) => {\n        timeoutHandler = setTimeout(\n            reject,\n            waitTimeout,\n            new Error(`\"hq-products-recommendation\" message not received in ${waitTimeout}ms`)\n        )\n        unsubscribe = subscribe('hq-products-recommendation', ({ message }) => {\n            if (\n                typeof message !== 'object' ||\n                Array.isArray(message) ||\n                expectedRecommendations.some(key => !(key in message))\n            ) {\n                return reject(\n                    new TypeError(\n                        `\"hq-products-recommendation\" message has unexpected format ${JSON.stringify(\n                            message\n                        )}`\n                    )\n                )\n            }\n            const arrayOfSKUs = Object.values(message).filter(Boolean)\n            //checking the ECAPI list here to make sure if they are present in it\n            const filteredArrayOfSKUs = arrayOfSKUs.filter(sku => plpProductList.includes(sku))\n            return resolve(filteredArrayOfSKUs)\n        })\n    }).finally(() => {\n        clearTimeout(timeoutHandler)\n        unsubscribe()\n    })\n}\n\nexport const fetchCoveo = async (searchHub, skus) => {\n    validateCoveoHeadless()\n\n    const selectedCountry = getSelectedCountry(country)\n    const website = getWebsite(country)\n\n    const engine = CoveoHeadless.buildSearchEngine({\n        configuration: {\n            organizationId: COVEO_ORGANIZATION_ID,\n            accessToken: getCoveoAccessToken(),\n            platformUrl: COVEO_PLATFORM_URL,\n            search: {\n                searchHub: getSearchHubName(searchHub),\n                pipeline: 'Product Recommendations'\n            },\n            preprocessRequest: (request, clientOrigin) => {\n                if (clientOrigin === COVEO_CLIENT_ORIGIN_SEARCH_API_FETCH) {\n                    const body = JSON.parse(request.body.toString())\n                    body.context = {\n                        website: website,\n                        sitename: website,\n                        context_website: website,\n                        context_sitename: website,\n                        language,\n                        locale,\n                        country: selectedCountry\n                    }\n                    body.mlParameters = { itemId: '8899.81' }\n                    assignSkusToMlParameters(skus, body)\n                    body.recommendation = 'Recommendation'\n                    body.fieldsToInclude = getFieldsToInclude()\n                    body.numberOfResults = MAX_PRODUCTS\n                    request.body = JSON.stringify(body)\n                }\n                return request\n            }\n        }\n    })\n\n    const recsList = CoveoHeadless.buildResultList(engine)\n\n    return new Promise((resolve, reject) => {\n        const unsubscribe = recsList.subscribe(() => {\n            const state = recsList.state\n            if (!state.isLoading && state.firstSearchExecuted) {\n                const results = state.results\n                resolve(results.map(result => result.raw.nes_prd_sku))\n            }\n        })\n\n        window.setTimeout(() => {\n            unsubscribe()\n            reject(new Error('Error Coveo - Request timed out'))\n        }, COVEO_MAX_RESPONSE_TIME)\n        engine.executeFirstSearch()\n    })\n}\n\nexport async function init() {\n    return new Promise((resolve, reject) => {\n        loadExternalScript({\n            src: 'https://unpkg.com/@coveo/headless@2.0.1/dist/browser/headless.js',\n            defer: true,\n            callback: () => {\n                if (!window.CoveoHeadless) {\n                    return reject(new Error('Coveo Headless failed to load'))\n                }\n                CoveoHeadless = window.CoveoHeadless\n                resolve(CoveoHeadless)\n            },\n            error: error => reject(error)\n        })\n    })\n}\n\nexport function assignSkusToMlParameters(skus, body) {\n    if (skus && skus.length) {\n        if (skus.length > 1) {\n            body.mlParameters = { itemIds: skus }\n        } else {\n            body.mlParameters = { itemId: skus[0] }\n        }\n    }\n}\n\nexport function getFieldsToInclude() {\n    return isB2B() ? fieldsToIncludeB2B : fieldsToInclude\n}\n\nexport function getSearchHubName(searchHub) {\n    return isB2B() ? `Nespresso_PRO_${country.toUpperCase()}_Search` : searchHub\n}\n\nexport function getCountryForCoveoB2B(country) {\n    return `pro_${country}`\n}\n\nexport function getSelectedCountry(country) {\n    return isB2B() ? getCountryForCoveoB2B(country) : country\n}\n\nexport function getUpperCaseCountryForCoveoB2B(country) {\n    return getCountryForCoveoB2B(country).toUpperCase()\n}\n\nexport function getWebsite(country) {\n    const upperCaseCountry = country.toUpperCase()\n    return isB2B()\n        ? `Nespresso_${getUpperCaseCountryForCoveoB2B(country)}`\n        : `Nespresso_${upperCaseCountry}`\n}\n\nexport function validateCoveoHeadless() {\n    if (!CoveoHeadless) {\n        throw new Error('fetchCoveo was called before init')\n    }\n}\n\nexport default {\n    init,\n    fetchProductsLastOrder,\n    fetchCoveo,\n    fetchHQRecommendation,\n    assignSkusToMlParameters,\n    getFieldsToInclude,\n    getSearchHubName,\n    getCountryForCoveoB2B,\n    getSelectedCountry,\n    getUpperCaseCountryForCoveoB2B,\n    getWebsite,\n    validateCoveoHeadless\n}\n","export const API_SOURCE_LAST_USER_ORDERS = 'Last User Orders'\nexport const API_SOURCE_COVEO_POPULAR_ITEMS_BOUGHT = 'REC - Popular Items bought'\nexport const API_SOURCE_COVEO_CART_RECOMMENDER = 'REC - Cart Recommender'\nexport const API_SOURCE_COVEO_FREQUENTLY_BOUGHT_TOGETHER = 'REC - Frequently Bought Together'\nexport const API_SOURCE_HQ_RECOMMENDATION_HW = 'REC - HQ RECOMMENDATION'\n\nexport const COVEO_CLIENT_ORIGIN_SEARCH_API_FETCH = 'searchApiFetch'\nexport const COVEO_CLIENT_ORIGIN_ANALYTICS_FETCH = 'analyticsFetch'\nexport const COVEO_MAX_RESPONSE_TIME = 8000\n","export const VARIATION_CROSS_SELL = 'cross-sell'\nexport const VARIATION_PLP = 'plp'\n\nexport interface CapsuleFeaturesInputType {\n    acidity?: number | null\n    bitterness?: number | null\n    body?: number | null\n    intensity?: number | null\n    roastLevel?: number | null\n}\n\nexport interface CapsuleFeatureType {\n    value: number | null\n}\n\nexport interface CapsuleFeaturesOutputType {\n    acidity: CapsuleFeatureType\n    bitterness: CapsuleFeatureType\n    body: CapsuleFeatureType\n    intensity: CapsuleFeatureType\n    roast: CapsuleFeatureType\n}\n\nexport type QuickViewProductType = {\n    modelType: string\n    id: string\n    legacyId: string\n    internationalId: string\n    name: string\n    urlFriendlyName: string\n    internationalName: string\n    headline: string\n    rootCategory: string\n    category: string\n    supercategories: string[]\n    mobileImages: {\n        modelType: string\n        icon: string\n        main: string\n    }\n    responsiveImages: {\n        standard: string\n    }\n    pdpURLs: {\n        opr: string\n        desktop: string\n        mobile: string\n    }\n    unitQuantity: number\n    salesMultiple: number\n    maxOrderQuantity: number\n    technologies: string[]\n    comingSoon: boolean\n    unit_quantity: number\n    productSelections: string[]\n    type: string\n    priceDisplay: string\n    isOrderable: boolean\n    bundled: boolean\n    capsuleProperties: {\n        intensity: number\n        bitterness: number\n        acidity: number\n        roastLevel: number\n    }\n    capsuleProductAromatics: string[]\n    aromaticProfileDescription: string\n    roastingDescription: string\n    capsuleCupSizes: string[]\n    capsuleCupSizesDetails: {\n        id: string\n        name: string\n        capacityLabel: string\n    }[]\n    capsuleAromatics: {\n        id: string\n        name: string\n    }[]\n    decaffeinated: boolean\n}\n\n//Confirmed this props are not available in Product Type\nexport type ProductNewPropsType = {\n    currency: string\n    pdpURLs: {\n        desktop: string\n        mobile: string\n    }\n    responsiveImages: {\n        standard: string\n    }\n    supercategories: string[]\n    productSelections: string[]\n    capsuleProperties?: CapsuleFeaturesInputType\n    capsuleProductAromatics: string[]\n    unitPrice: number\n    cupSizesDetails?: {\n        icon: string\n        label: string\n        size: string\n        capacityLabel: string | null\n        category: {\n            id: string\n            name: string\n            description: string | null\n            icon: {\n                url: string\n                altText: string\n            }\n            detailsIcon: {\n                url: string\n                altText: string\n            }\n            url: string | null\n            capacityLabel: string | null\n            rangeLink: string | null\n            subCategories: []\n            superCategories: string[]\n        }\n    }[]\n    category_name: string\n    url: string\n}\n\n// This is the Product Type signature Combined\nexport type ProductPropsType = QuickViewProductType & ProductNewPropsType\n\nexport type AddToCartPropsType = {\n    sku?: string\n    longSku?: string\n    category_name?: string\n    price?: string\n    strikethrough_price?: number\n    hidePrice?: boolean\n    type?: string\n    price_per_capsule?: number | string\n    show_capsule_price?: boolean\n    label_capsules?: string\n    capsule_price_label?: string\n    capsule_price_syntax?: string\n    show_sleeve_price?: boolean\n    show_sleeve?: boolean\n    sleeve_syntax?: string\n    number_of_sleeves?: number\n    label_sleeves?: string\n    label_sleeve?: string\n    technologies: string[]\n    sales_multiple?: number\n    unitQuantity?: number\n    unit_quantity?: number\n    bundled?: boolean\n    url?: string\n}\n\nexport type PageBuilderProductPropsType = {\n    sku: string\n    highlighted: boolean\n    labels: {\n        bgColor: string\n        color: string\n        name: string\n    }[]\n    strikethrough_price: string\n    variant: {\n        is_capsule: boolean\n        number_of_sleeves: number\n        number_of_capsules: string\n        bundle_details: {\n            popin_link_text: string\n            popin_label_close: string\n            description: string\n            other_skus: string\n            other_skus_quantity: string\n        }\n        logos: {\n            fair_trade: boolean\n            alt_fair_trade: string\n            is_organic: boolean\n            alt_organic: string\n            only_vertuo_next: boolean\n            alt_vertuo_next: string\n            is_rainforest: boolean\n            alt_rainforest: string\n            is_sustainable: boolean\n            alt_sustainable: string\n            is_q_certified_arabica: boolean\n            alt_q_certification_arabica: string\n        }\n        sku_timer: {\n            launch_date: string\n            remaining_days: string\n            remaining_day: string\n            label: string\n            a11y_label: string\n        }\n        ingredients: {\n            heading: string\n            description: string\n        }\n    }\n}\n\nexport type PageBuilderPropsType = {\n    quick_view_plp?: {\n        popin?: {\n            close?: string\n        }\n        cup_sizes?: {\n            heading: string\n            unit_is_oz: boolean\n            items: string[]\n        }\n        aromatic_profile?: {\n            heading: string\n            items: string[]\n        }\n        link?: {\n            label: string\n            url: string\n        }\n        levels?: {\n            a11y_level_of: string\n            acidity_label: string\n            bitterness_label: string\n            roastiness_label: string\n            body_label: string\n        }\n    }\n    campaign?: {\n        id?: string\n        name?: string\n        creative?: string\n        position?: string\n    }\n    tracking_position: string\n    tracking_list: string\n    capsuleProperties?: CapsuleFeaturesInputType\n    price_per_capsule?: number | string\n    show_capsule_price?: boolean\n    label_capsules?: string\n    capsule_price_label?: string\n    capsule_price_syntax?: string\n    show_sleeve_price?: boolean\n    show_sleeve?: boolean\n    sleeve_syntax?: string\n    number_of_sleeves?: number\n    label_sleeves?: string\n    label_sleeve?: string\n    technologies: string[]\n    sales_multiple?: number\n    unit_quantity?: number\n    bundled?: boolean\n    pdpURLs: {\n        desktop: string\n        mobile: string\n    }\n    intensity_label: string\n    products: {\n        sku: string\n        longSku: string\n        price: number\n        strikethrough_price: number\n        hidePrice: boolean\n        url: string\n    }[]\n    priceFormatter: {\n        formatPrice: (price: number) => string\n    }\n    currency: string\n    options: {\n        intensity_label: string\n        show_sleeve: boolean\n        label_sleeve: string\n        label_sleeves: string\n        label_capsules: string\n        sleeve_syntax: string\n        show_sleeve_price: boolean\n        capsule_price_label: string\n        capsule_price_syntax: string\n        a11y_intensity_max: string\n        label_decaffeinato: string\n        is_headline_hidden: boolean\n        sizes_title: string\n        notes_title: string\n        enabledExperiments: string[]\n    }\n    copywriting: {\n        sku_quick_view: {\n            more_info: string\n            a11y_more_info: string\n            popin: {\n                close: string\n            }\n            cup_sizes: {\n                heading: string\n                unit_is_oz: boolean\n                items: string[]\n            }\n            aromatic_profile: {\n                heading: string\n                items: string[]\n            }\n            link: {\n                label: string\n            }\n        }\n        aromatic_profile: {\n            heading: string\n            items: string[]\n        }\n    }\n}\n\nexport type SkuType = {\n    tracking_list: string\n    tracking_position: string\n    id: string\n    sku: string\n    longSku: string\n    name: string\n    name_custom: string\n    available: boolean\n    description: string | null\n    hidePrice: boolean\n    image_alt_text: string\n    inStock: boolean\n    internationalId: string\n    internationalName: string\n    legacyId: string\n    maxOrderQuantity: number | null\n    packagingType: string | null\n    price: string\n    pushRatingEnabled: boolean\n    ranges: string[]\n    salesMultiple: number\n    technologies: string[]\n    type: string\n    unitQuantity: number\n    url: string\n    labels: []\n    category_name: string\n    category: {\n        id: string\n        name: string\n        description: string | null\n        icon: {\n            url: string\n            altText: string | null\n        }\n        detailsIcon: string | null\n        url: string | null\n        capacityLabel: string | null\n        rangeLink: string | null\n        subCategories: []\n        superCategories: string[]\n    }\n    highlighted: boolean\n    strikethrough_price: string\n    view_details_label: string\n    headline: string\n    cupSizes: string[]\n    cupSizesDetails: {\n        icon: string\n        label: string\n        size: string\n        capacityLabel: string | null\n        category: {\n            id: string\n            name: string\n            description: string | null\n            icon: {\n                url: string\n                altText: string | null\n            }\n            detailsIcon: string | null\n            url: string | null\n            capacityLabel: string | null\n            rangeLink: string | null\n            subCategories: []\n            superCategories: string[]\n        }\n    }[]\n    flavors: string[]\n    in_stock: boolean\n    sales_multiple: number\n    bundled: boolean\n    logos: []\n    is_headline_hidden: boolean\n    a11y_price: string\n    a11y_product_card: string\n    label_sleeve: string\n    label_sleeves: string\n    label_capsules: string\n    intensity: number\n    a11y_intensity_max: string\n    label_decaffeinato: string\n    show_sleeve_price: boolean\n    show_sleeve: boolean\n    price_per_capsule: number | string\n    final_price: string | null\n    capsule_price_label: string\n    capsule_price_syntax: string\n    sleeve_syntax: string\n    perSleeveLabel: string\n    number_of_sleeves: number\n    number_of_capsules: string\n    show_capsule_price: boolean\n    sort_price: number\n    bundle_details: any\n    quick_view_plp: {\n        show_view: boolean\n        quick_view_text: string\n        popin: {\n            close: string\n        }\n        cup_sizes: {\n            heading: string\n            unit_is_oz: boolean\n            items: string[]\n        }\n        aromatic_profile: {\n            heading: string\n            items: string[]\n        }\n        link: {\n            label: string\n        }\n        levels: {\n            a11y_level_of: string\n            acidity_label: string\n            bitterness_label: string\n            roastiness_label: string\n            body_label: string\n        }\n    }\n    hasPricePerSleeve: boolean\n    sleevePrice: string\n    rendererName: string\n    position: number\n    rawPrice: number\n    variation: string\n    intensity_label: string\n    campaign: {\n        id: string\n        name: string\n        creative: string\n        position: string\n    }\n    capsuleProductAromatics: string[]\n    copywriting: {\n        heading: string\n        sku_quick_view: {\n            more_info: string\n            a11y_more_info: string\n            popin: {\n                close: string\n            }\n            cup_sizes: {\n                heading: string\n                unit_is_oz: false\n                items: string[]\n            }\n            aromatic_profile: {\n                heading: string\n                items: string[]\n            }\n            link: {\n                label: string\n            }\n        }\n        aromatic_profile: {\n            heading: string\n            items: string[]\n        }\n    }\n    options: {\n        intensity_label: string\n        show_sleeve: boolean\n        label_sleeve: string\n        label_sleeves: string\n        label_capsules: string\n        sleeve_syntax: string\n        show_sleeve_price: boolean\n        capsule_price_label: string\n        capsule_price_syntax: string\n        a11y_intensity_max: string\n        label_decaffeinato: string\n        is_headline_hidden: boolean\n        sizes_title: string\n        notes_title: string\n        enabledExperiments: string[]\n    }\n    products: {\n        sku: string\n        longSku: string\n        price: number\n        strikethrough_price: number\n        hidePrice: boolean\n        url: string\n    }[]\n    priceFormatter: {\n        formatPrice: (price: number) => string\n    }\n    currency: string\n}\n\nexport type MergedProductType = {\n    intensity_label: string\n    capsuleProductAromatics?: string[]\n    pdpURLs?: {\n        desktop: string\n        mobile: string\n    }\n}\n\nexport type AddToCardPropertiesType = SkuType & MergedProductType\n\ntype CupSizeType = {\n    icon: string\n    label: string\n    size: string\n    capacityLabel: string | null\n    category: {\n        id: string\n        name: string\n        description: string | null\n        icon: {\n            url: string\n            altText: string\n        }\n        detailsIcon: {\n            url: string\n            altText: string\n        }\n        url: string | null\n        capacityLabel: string | null\n        rangeLink: string | null\n        subCategories: []\n        superCategories: string[]\n    }\n}[]\n\nexport type QuickViewPropsType = {\n    popin: {\n        popin_id: string\n        close?: string\n        footer: boolean\n    }\n    product: MergedProductType\n    intensity: {\n        intensity_label?: string\n        a11y_intensity_max: string\n    }\n    cup_sizes: {\n        heading: string\n        unit_is_oz: boolean\n        items?: [] | CupSizeType\n    }\n    aromatic_profile: {\n        heading: string\n        items: string[]\n    }\n    link: {\n        label: string\n        url?: string\n    }\n    levels: any\n    pricing: {\n        add_to_cart: AddToCartPropsType & {\n            position: string\n            variation: string\n            url: string\n            view_details_label: string\n            rendererName: string\n        }\n        showSleeve: any\n        showCapsulePrice: any\n    }\n    campaign: any\n}\n","import { getMergedProductData } from '@kissui/page-builder-sections/src/cross-sell-natural/dataTransform'\n\nimport {\n    CapsuleFeaturesInputType,\n    CapsuleFeaturesOutputType,\n    ProductPropsType,\n    AddToCartPropsType,\n    SkuType,\n    ProductNewPropsType,\n    MergedProductType,\n    AddToCardPropertiesType,\n    QuickViewPropsType,\n    VARIATION_PLP,\n    VARIATION_CROSS_SELL\n} from './shared-quick-view-types'\n\nexport const getCapsuleFeatures = ({\n    acidity = null,\n    bitterness = null,\n    body = null,\n    intensity = null,\n    roastLevel = null\n}: CapsuleFeaturesInputType = {}): CapsuleFeaturesOutputType => ({\n    acidity: { value: acidity },\n    bitterness: { value: bitterness },\n    body: { value: body },\n    intensity: { value: intensity },\n    roast: { value: roastLevel }\n})\n\nexport const getSkuQuickViewData = async (\n    product: ProductPropsType,\n    popinId: string,\n    skuData: SkuType,\n    componentType: string\n) => {\n    const { tracking_position, tracking_list } = skuData\n\n    const handlePLPVariation = () => {\n        if (!product) return\n        let quickViewElement = document.createElement('nb-sku-quick-view')\n        quickViewElement.setAttribute(\n            'data',\n            JSON.stringify(getSkuQuickViewProp(popinId, product, skuData, componentType))\n        )\n        quickViewElement.setAttribute('id', popinId)\n        quickViewElement.setAttribute('tracking_no_impression', 'true')\n        quickViewElement.setAttribute('tracking_position', tracking_position)\n        quickViewElement.setAttribute('tracking_list', tracking_list)\n        quickViewElement.setAttribute('campaign_position', skuData.campaign.position)\n        quickViewElement.setAttribute('listname_text', skuData.copywriting.heading)\n        document.body.appendChild(quickViewElement)\n    }\n\n    const handleCrossSellVariation = () => {\n        const { sku_quick_view } = skuData.copywriting\n        if (!sku_quick_view.more_info) return ''\n        const quickViewElement = document.querySelector('nb-sku-quick-view')\n        if (quickViewElement) quickViewElement.remove()\n\n        let newQuickViewElement = document.createElement('nb-sku-quick-view')\n        newQuickViewElement.setAttribute(\n            'data',\n            JSON.stringify(getSkuQuickViewProp(popinId, product, skuData, componentType))\n        )\n        newQuickViewElement.setAttribute('tracking_no_impression', 'true')\n        newQuickViewElement.setAttribute('tracking_position', tracking_position)\n        newQuickViewElement.setAttribute('tracking_list', tracking_list)\n        newQuickViewElement.setAttribute('campaign_position', skuData.campaign.position)\n        newQuickViewElement.setAttribute('listname_text', skuData.copywriting.heading)\n        document.body.appendChild(newQuickViewElement)\n    }\n\n    const variationHandlers: { [key: string]: () => void | string } = {\n        [VARIATION_PLP]: handlePLPVariation,\n        [VARIATION_CROSS_SELL]: handleCrossSellVariation\n    }\n\n    const handleVariation = variationHandlers[componentType]\n    if (handleVariation) {\n        handleVariation()\n    }\n}\n\nexport const getSkuQuickViewProp = (\n    popinId: string,\n    product: ProductPropsType,\n    skuData: SkuType,\n    componentType: string\n) => {\n    let mergedProductData = getMergedProductDataForComponentType(product, skuData, componentType)\n    let addToCartProps = getAddToCartProperties(componentType, skuData, mergedProductData)\n\n    return isVariationOnPLP(componentType)\n        ? getPlpQuickViewProps(popinId, skuData, mergedProductData, addToCartProps)\n        : getCrossSellQuickViewProps(popinId, product, skuData, mergedProductData, addToCartProps)\n}\n\nconst getMergedProductDataForComponentType = (\n    product: ProductPropsType,\n    skuData: SkuType,\n    componentType: string\n) => {\n    switch (componentType) {\n        case VARIATION_PLP:\n            return {\n                ...skuData,\n                ...product,\n                ...getCapsuleFeatures(product?.capsuleProperties)\n            }\n        case VARIATION_CROSS_SELL: {\n            const matchedProduct =\n                skuData.products?.find(\n                    productPageBuilder => productPageBuilder.sku === product?.legacyId\n                ) || {}\n            return getMergedProductData(\n                product,\n                matchedProduct,\n                skuData,\n                skuData?.priceFormatter,\n                skuData?.currency\n            )\n        }\n        default:\n            return {}\n    }\n}\n\nexport const getAddToCartProperties = (\n    componentType: string,\n    skuData: SkuType,\n    mergedProductData: MergedProductType\n): AddToCartPropsType => {\n    const data: AddToCardPropertiesType = isVariationOnPLP(componentType)\n        ? skuData\n        : (mergedProductData as AddToCardPropertiesType)\n    return getAddToCartProps(data, componentType)\n}\n\nexport const getAddToCartProps = (\n    data: AddToCardPropertiesType,\n    componentType: string\n): AddToCartPropsType => {\n    const commonProps: AddToCartPropsType = {\n        sku: data.sku,\n        longSku: data.longSku,\n        category_name: data.category_name,\n        price: data.price ?? 0,\n        strikethrough_price: Number(data.strikethrough_price),\n        hidePrice: data.hidePrice,\n        technologies: data.technologies || [],\n        url: data.url || ''\n    }\n\n    if (isVariationOnPLP(componentType)) {\n        return {\n            ...commonProps,\n            type: data.type,\n            price_per_capsule: data.price_per_capsule,\n            show_capsule_price: data.show_capsule_price,\n            label_capsules: data.label_capsules,\n            capsule_price_label: data.capsule_price_label,\n            capsule_price_syntax: data.capsule_price_syntax,\n            show_sleeve_price: data.show_sleeve_price,\n            show_sleeve: data.show_sleeve,\n            sleeve_syntax: data.sleeve_syntax,\n            number_of_sleeves: data.number_of_sleeves,\n            label_sleeves: data.label_sleeves,\n            label_sleeve: data.label_sleeve,\n            technologies: data.technologies || [],\n            sales_multiple: data.sales_multiple,\n            unit_quantity: data.unitQuantity,\n            bundled: data.bundled,\n            url: data.url || ''\n        }\n    }\n\n    return commonProps\n}\n\nexport const getPlpQuickViewProps = (\n    popinId: string,\n    skuData: SkuType,\n    mergedProductData: MergedProductType,\n    addToCartProps: AddToCartPropsType\n): QuickViewPropsType => {\n    return {\n        popin: {\n            popin_id: popinId,\n            close: skuData?.quick_view_plp?.popin?.close,\n            footer: true\n        },\n        product: {\n            ...mergedProductData\n        },\n        intensity: {\n            intensity_label: mergedProductData?.intensity_label,\n            a11y_intensity_max: 'max of {max_intensity}'\n        },\n        cup_sizes: {\n            ...skuData?.quick_view_plp?.cup_sizes,\n            items: skuData?.cupSizesDetails\n        },\n        aromatic_profile: {\n            ...skuData?.quick_view_plp?.aromatic_profile,\n            items: skuData?.capsuleProductAromatics || mergedProductData?.capsuleProductAromatics\n        },\n        link: {\n            ...skuData?.quick_view_plp?.link,\n            url: skuData?.url\n        },\n        levels: {\n            ...skuData?.quick_view_plp?.levels\n        },\n        pricing: {\n            add_to_cart: {\n                ...addToCartProps,\n                position: '',\n                variation: 'small',\n                url: '',\n                view_details_label: 'View details',\n                rendererName: ''\n            },\n            showSleeve: {},\n            showCapsulePrice: {}\n        },\n        campaign: skuData.campaign\n    }\n}\n\nexport const getCrossSellQuickViewProps = (\n    popinId: string,\n    product: ProductNewPropsType,\n    skuData: SkuType,\n    mergedProductData: MergedProductType,\n    addToCartProps: AddToCartPropsType\n): QuickViewPropsType => {\n    const props: QuickViewPropsType = {\n        popin: {\n            popin_id: popinId,\n            close: skuData?.copywriting?.sku_quick_view?.popin?.close,\n            footer: true\n        },\n        product: {\n            ...mergedProductData\n        },\n        intensity: {\n            intensity_label: skuData?.options?.intensity_label,\n            a11y_intensity_max: 'max of {max_intensity}'\n        },\n        cup_sizes: {\n            ...skuData?.copywriting?.sku_quick_view?.cup_sizes,\n            items: product?.cupSizesDetails\n        },\n        aromatic_profile: {\n            ...skuData?.copywriting?.sku_quick_view?.aromatic_profile,\n            items: product?.capsuleProductAromatics || mergedProductData?.capsuleProductAromatics\n        },\n        link: {\n            ...skuData?.copywriting?.sku_quick_view?.link,\n            url: mergedProductData?.pdpURLs?.desktop\n        },\n        levels: {\n            ...skuData?.quick_view_plp?.levels\n        },\n        pricing: {\n            add_to_cart: {\n                ...addToCartProps,\n                position: '',\n                variation: 'small',\n                url: '',\n                view_details_label: 'View details',\n                rendererName: ''\n            },\n            showSleeve: {},\n            showCapsulePrice: {}\n        },\n        campaign: {}\n    }\n    return props\n}\nconst isVariationOnPLP = (componentType: string) => componentType === VARIATION_PLP\n","import { getProduct } from '@kissui/helpers/src/catalog'\nimport { emitCustomEvent } from './events.helpers'\nimport { removeEmptyValues } from '@kissui/helpers/src/utils'\n\nconst raisedByPB = 'page builder'\nconst raisedByWC = 'Web component'\n\n/**\n * helper method for 'itemDisplay' GTM event\n * @param {*} event : 'itemDisplay' - Mandatory as is\n * @param {*} eventRaisedBy : 'Web component' - Mandatory as is\n * @param {*} eventAction : 'Click' - Action that led to the item display. For example, click\n * @param {*} itemTypes : ['products'] - Mandatory as is\n * @param {*} rootElement : ['nb-slider'] - Root DOM element for item detection. Closest common ancestor element of the inserted/displayed promotions and products. It will help the detection to reduce its performance consumption. Set to 0 (zero) in order to request detection through the entire document.\n */\nexport const itemDisplay = args => {\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'itemDisplay',\n        eventRaisedBy: raisedByWC,\n        eventAction: 'Click',\n        itemTypes: ['products'],\n        ...args\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('itemDisplay', eventData)\n}\n\n/**\n *\n * helper method for 'customEvent' GTM event\n * @param {*} args (event, eventRaisedBy, eventCategory, eventAction, eventLabel, nonInteraction)\n */\n\nexport const customEvent = args => {\n    window.gtmDataObject = window.gtmDataObject || []\n    var eventData\n    if (args.event_GA4 === undefined || args.event_GA4 === false) {\n        eventData = {\n            event: 'customEvent',\n            eventRaisedBy: raisedByWC,\n            eventCategory: 'User Engagement',\n            eventAction: 'Click',\n            eventLabel: '',\n            nonInteraction: 0,\n            ...args\n        }\n    } else {\n        eventData = {\n            event_raised_by: raisedByPB,\n            ...args\n        }\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('customEvent', eventData)\n}\n\n/**\n * Helper method for tracking component interactions, compatible with GA4.\n *\n * @param {String} creative : component raising the event, e.g. 'before_coffees_list', 'before_machines_list', 'before_accessories_list'\n * @param {String} actionType : description of the interaction, e.g 'pdp quick view'\n * @param {String} internationalId : long SKU, e.g. 'erp.pt.b2c/prod/7243.30'\n * @param {String} internationalName : international name of the product, e.g. 'Vertuo Carafe Pour-Over Style Mild'\n * @param {String} productType : type of product, i.e. 'capsule', 'machine', 'accessory'\n * @param {String} range : product range, e.g. 'ispirazione italiana'\n * @param {String} technology : technology, i.e. 'original', 'vertuo'\n * @param {Number} price : price, e.g. .51\n * @param {String} eventAction : description of the action, e.g. 'PDP Quick View'\n *\n * Initally created for PDP Quick View tracking:\n * https://dsu-confluence.nestle.biz/display/DIANA/BEFORE+-+PDP+Quick+View\n * Will probably be rolled out across all components, update this comment accordingly.\n */\nexport const trackComponentInteraction = ({\n    creative = '',\n    actionType = '',\n    internationalId = '',\n    internationalName = '',\n    productType = '',\n    technology = '',\n    category = '',\n    rawPrice = '',\n    eventAction = ''\n}) => {\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'page_builder_component_interaction',\n        event_raised_by: raisedByPB,\n        component_name: creative,\n        action_type: actionType,\n        item_id_event: internationalId,\n        item_name_event: internationalName,\n        item_category_event: productType,\n        item_technology_event: technology,\n        item_range_event: category,\n        item_price_event: rawPrice,\n        eventCategory: 'User Engagement',\n        eventAction: eventAction,\n        eventLabel: `${productType} - ${technology} - ${internationalName}`\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('page_builder_component_interaction', eventData)\n}\n\n/**\n *\n * Push 'view_promotion' event for GA 4\n * @param {*} args (event, event_raised_by, ecommerce: {promotion_id, promotion_name, creative_slot, creative_name})\n */\nexport const viewPromotion = args => {\n    const event = 'view_promotion'\n    const eventData = {\n        event,\n        event_raised_by: raisedByPB,\n        ecommerce: {}\n    }\n    if (Object.keys(args).length) {\n        const { id = '', creative = '', name = '', position = '' } = args\n        let ecommerceData = {\n            promotion_id: id,\n            promotion_name: name,\n            creative_slot: position,\n            creative_name: creative\n        }\n        ecommerceData = removeEmptyValues(ecommerceData)\n        eventData.ecommerce = ecommerceData\n    }\n    window.gtmDataObject ??= []\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent(event, eventData)\n}\n\nexport const handlePromoClick = args => {\n    const { campaign, cta_name } = args\n\n    const cleanedData = removeEmptyValues(campaign)\n    selectPromotion({ cta_name, ...cleanedData })\n}\n\n/**\n *\n * Push 'select_promotion' event for GA 4\n * @param {*} args (event, event_raised_by, cta_name, ecommerce: {promotion_id, promotion_name, creative_slot, creative_name})\n */\nexport const selectPromotion = args => {\n    const event = 'select_promotion'\n    const eventData = {\n        event: 'select_promotion',\n        cta_name: args?.cta_name ?? '(not set)',\n        event_raised_by: raisedByPB,\n        ecommerce: {}\n    }\n    if (Object.keys(args).length) {\n        const { id = '', creative = '', name = '', position = '' } = args\n        let ecommerceData = {\n            promotion_id: id,\n            promotion_name: name,\n            creative_slot: position,\n            creative_name: creative\n        }\n        ecommerceData = removeEmptyValues(ecommerceData)\n        eventData.ecommerce = ecommerceData\n    }\n\n    window.gtmDataObject ??= []\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent(event, eventData)\n}\n\nexport const interactionClick = (nameComponent, ctaName) => {\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'page_builder_component_interaction',\n        event_raised_by: raisedByPB,\n        eventCategory: 'User Engagement',\n        eventAction: 'Click CTA',\n        eventLabel: `Page Builder - ${nameComponent} - ${ctaName}`,\n        component_name: nameComponent,\n        action_type: 'web component click',\n        cta_name: ctaName\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('page_builder_component_interaction', eventData)\n}\n\nexport const getProductInfo = async (sku, data) => {\n    let product = data\n    if (!product) {\n        product = await getProduct(sku)\n    }\n    return product\n}\n\nexport const getProductPayload = (data, actionField = {}) => {\n    const {\n        internationalName,\n        internationalId,\n        category,\n        unitPrice,\n        legacyId,\n        name,\n        technologies,\n        bundled,\n        inStock,\n        type\n    } = data\n\n    const technology = technologies.map(item => item.split('/').pop()).join('|')\n    const isDiscovery = category.toLowerCase().includes('discovery')\n\n    return [\n        // Array consists of one product details for PDP Product Detail View\n        {\n            ...actionField,\n            name: internationalName, // '[[International Product Name]]' NIE, Contract\n            id: internationalId, // '[[International Product ID]]'\n            price: unitPrice, // '[[Product Price]'\n            // dimension43: '[[true/false]]', // '[[true/false]]' // Signifies if this product is part of a standing order or not\n            dimension44: isDiscovery.toString(), // '[[true/false]]', // Signifies if this product is part of a discovery offer\n            dimension53: legacyId, // '[[Product Local market ID]]', // Local market id for product\n            dimension54: name, // '[[Product Local market Name]]', // Local market name for product\n            dimension55: category, // '[[Product Range]]', // Range of the product, eg: Barista Creations for Ice (Nessoft Category)\n            dimension56: technology, // '[[Product Technology]]', //Product technology according to Nespresso categorization (original, vertuo, pro)\n            dimension57: bundled ? 'bundle' : 'single', // '[[Product Type]]', //If the product is single or bundle\n            dimension192: inStock ? 'in stock' : 'out of stock', // '[in stock]', // \"in stock\" or \"out of stock\"\n            category: type, // '[[Product Category]]', //Product category according to Nespresso categorization (Nessoft type): capsule, accessory, machine\n            brand: 'Nespresso' // Static value set to Nespresso\n        }\n    ]\n}\n\nexport const trackDetailView = async (sku, data) => {\n    // https://dsu-confluence.nestle.biz/display/DIANA/HQ+PB+Tracking+-+Product+Detail+View\n    if (window.pbTrackDetailViewPDP || !sku || !window.napi) {\n        return\n    }\n\n    const productInfo = await getProductInfo(sku, data)\n    const productPayload = getProductPayload(productInfo)\n    const currency = productInfo.currency\n\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'detailView',\n        currencyCode: currency,\n        eventRaisedBy: raisedByPB,\n        ecommerce: {\n            detail: {\n                actionField: {},\n                products: productPayload\n            }\n        }\n    }\n    window.gtmDataObject.push(eventData)\n    // Track only once per page\n    window.pbTrackDetailViewPDP = true\n    emitCustomEvent('detailView', eventData)\n}\n\nexport const trackAddToCartImpression = (product, isStickyBar) => {\n    // https://dsu-confluence.nestle.biz/pages/viewpage.action?spaceKey=DIANA&title=PDP+-+Sticky+Add+To+Cart+Custom+Event\n\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'page_builder_component_interaction',\n        event_raised_by: raisedByPB,\n        component_name: 'before_sku_main_info',\n        action_type: isStickyBar\n            ? 'sticky add to cart impression'\n            : 'standard add to cart impression',\n        //product info\n        item_id_event: product.internationalId,\n        item_name_event: product.internationalName,\n        item_category_event: product.type,\n        item_price_event: product.price_per_capsule?.split(' ')[0],\n        item_market_id_event: product.legacyId,\n        item_market_name_event: product.name,\n        item_range_event: product.category_name,\n        item_technology_event: product.technology?.[0]?.split('/').slice(-1) ?? '',\n        item_type_event: product.bundled ? 'bundle' : 'single'\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('page_builder_component_interaction', eventData)\n}\n\nexport const productImpression = async (position, list, sku, data) => {\n    // https://dsu-confluence.nestle.biz/pages/viewpage.action?pageId=225612781\n    // don't track already tracked products\n    window.gtmDataObject = window.gtmDataObject || []\n    const hasDetailView = window.gtmDataObject.find(item => item.event === 'detailView')\n    const alreadyTracked = !!hasDetailView?.ecommerce?.detail?.products.find(p =>\n        sku.includes(p.id)\n    )\n    if (alreadyTracked) {\n        return\n    }\n\n    const productInfo = await getProductInfo(sku, data)\n    const productPayload = getProductPayload(productInfo, { list: list, position: position })\n    const currency = productInfo.currency\n    const eventData = {\n        event: 'impression',\n        eventAction: 'Product Impression',\n        currencyCode: currency,\n        eventRaisedBy: raisedByPB,\n        ecommerce: {\n            impressions: productPayload\n        }\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('impression', eventData)\n}\n\nexport const productClick = async (position, list, sku, data) => {\n    // https://dsu-confluence.nestle.biz/pages/viewpage.action?pageId=225612781\n\n    if (typeof list !== 'string') return\n\n    const productInfo = await getProductInfo(sku, data)\n    const productPayload = getProductPayload(productInfo, { position: position })\n    const currency = productInfo.currency\n\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'productClick',\n        eventAction: 'Product Click',\n        currencyCode: currency,\n        eventRaisedBy: raisedByPB,\n        ecommerce: {\n            click: {\n                actionField: {\n                    list: list\n                },\n                products: productPayload\n            }\n        }\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('productClick', eventData)\n}\n\nexport function filterTrackingFromPlpFilters(filtersSelected) {\n    const grouped = groupSelectedFilters(filtersSelected)\n    const groupKeys = Object.keys(grouped)\n    const typesFiltersSelected = groupKeys.join('|').substring(0, 99)\n    const valuesFiltersSelected = groupKeys\n        .map(key => grouped[key].values.map(value => value.split('/').at(-1)).join(','))\n        .join('|')\n        .substring(0, 99)\n\n    return [typesFiltersSelected, valuesFiltersSelected]\n}\n\nexport const filterActionEvent = (\n    actionType,\n    filterType,\n    filterValues,\n    clickLocation,\n    dataType\n) => {\n    // https://dsu-confluence.nestle.biz/display/DIANA/PLP+-+Filter+Revamp\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = getExplicitFilterEventData(\n        actionType,\n        filterType,\n        filterValues,\n        clickLocation\n    )\n\n    window.gtmDataObject.push(eventData)\n    if (window.NEXT_V1_PLP_EXPLICIT_FILTER_TRACKING && dataType) {\n        window.gtmDataObject.push({\n            ...window.NEXT_V1_PLP_EXPLICIT_FILTER_TRACKING,\n            experiment_action: `${actionType} - ${dataType}`,\n            cta_name: 'All filters'\n        })\n    }\n\n    emitCustomEvent('plp_filter', eventData)\n}\n\nconst getExplicitFilterEventData = (actionType, filterType, filterValues, clickLocation) => {\n    return {\n        event: 'plp_filter',\n        event_raised_by: raisedByPB,\n        action_type: actionType,\n        filter_type: filterType,\n        ...(filterValues ? { filter_values: filterValues } : {}),\n        ...(clickLocation ? { click_location: clickLocation } : {})\n    }\n}\n\nfunction groupSelectedFilters(filtersSelected = []) {\n    return filtersSelected.reduce((grouped, { key, value }) => {\n        if (!grouped[key]) grouped[key] = { key, values: [] }\n        grouped[key].values.push(value.replaceAll(',', '-'))\n        return grouped\n    }, {})\n}\n\nfunction arrTolastURLElementMapper(arr) {\n    if (typeof arr === 'undefined' || arr.length === 0) return undefined\n\n    return arr.map(item => item.split('/').pop()?.trim() || '')\n}\n\nfunction arrToJoinedString(arr, joiner = '|') {\n    if (typeof arr === 'undefined' || arr.length === 0) return undefined\n\n    return arr.map(item => item.trim()).join(joiner)\n}\n\nfunction findTechnogiesText(arr) {\n    if (typeof arr === 'undefined' || arr.length === 0) return undefined\n\n    if (arr.length === 1) return cleanText(arrTolastURLElementMapper(arr)?.[0])\n    else return 'multiple'\n}\n\nfunction cleanText(str) {\n    if (typeof str === 'undefined') return undefined\n\n    return str.toString().trim()\n}\n\nconst generateEcommerceObject = async (productIds, options) => {\n    const productRequests = productIds.map(SKU => getProduct(SKU))\n    const productData = await Promise.all(productRequests)\n\n    return {\n        ecommerce: {\n            currency: window[window.config.padl.namespace].dataLayer.app.app.currency,\n            value: productData.reduce((ac, product) => {\n                return ac + product.price\n            }, 0),\n            items: productData.map((product, index) => {\n                if (product.type === 'bundle' || product.type === 'giftcard') {\n                    return {\n                        item_id: cleanText(product.internationalId),\n                        item_name: cleanText(product.internationalName),\n                        item_brand: 'nespresso',\n                        item_category: cleanText(product.type),\n                        index: index + 1\n                    }\n                }\n\n                let output = {\n                    item_id: cleanText(product.internationalId),\n                    item_name: cleanText(product.internationalName),\n                    item_brand: 'nespresso',\n                    item_category: cleanText(product.type),\n                    item_category2: arrToJoinedString(\n                        arrTolastURLElementMapper(product.technologies)\n                    ),\n                    item_category3: cleanText(product.category),\n                    price: product.price,\n                    quantity: product.salesMultiple,\n                    affiliation: 'nespresso online store',\n                    coupon: undefined,\n                    discount: undefined,\n                    location_id: undefined,\n                    item_list_name: cleanText(options?.listName),\n                    item_list_id: cleanText(options?.listId),\n                    index: index + 1,\n                    item_market_id: cleanText(product.legacyId),\n                    item_market_name: cleanText(product.name),\n                    item_technology: findTechnogiesText(product.technologies),\n                    item_range: cleanText(product.category),\n                    item_discovery_offer: product.category.includes('discovery').toString(),\n                    item_added_by_user: undefined,\n                    item_ecotax_applicable: product?.displayEcoTax\n                        ? cleanText(product?.displayEcoTax.toString())\n                        : undefined,\n                    item_selection_list: cleanText(arrToJoinedString(product.productSelections)),\n                    item_in_stock: product?.inStock\n                        ? cleanText(product?.inStock.toString())\n                        : undefined,\n                    item_subscription_name: undefined,\n                    item_subscription_category: undefined,\n                    item_subscription_price: undefined,\n                    item_subscription_duration: undefined,\n                    item_subscription_fee: undefined\n                }\n\n                switch (product.type) {\n                    case 'capsule': {\n                        const capsuleProduct = product\n\n                        output.item_category4 = capsuleProduct.bundled ? 'bundle' : 'single'\n\n                        output.item_type = capsuleProduct.bundled ? 'bundle' : 'single'\n\n                        output.item_coffee_aromatic_profile = cleanText(\n                            arrToJoinedString(capsuleProduct.capsuleProductAromatics)?.toLowerCase()\n                        )\n\n                        output.item_coffee_intensity =\n                            cleanText(capsuleProduct.capsuleProperties.intensity) ?? undefined\n\n                        output.item_coffee_cup_size = cleanText(\n                            arrToJoinedString(capsuleProduct.capsuleCupSizes)\n                        )?.toLowerCase()\n\n                        break\n                    }\n                    case 'machine': {\n                        const machineProduct = product\n\n                        output.item_machine_shade = cleanText(machineProduct.colorShade?.name)\n\n                        break\n                    }\n                }\n\n                if (product.type === 'machine' || product.type === 'accessory') {\n                    output.item_avg_rating = product.ratingCode\n                    output.item_number_of_reviews = product.ratingCode\n                }\n\n                return output\n            })\n        }\n    }\n}\n\nexport const selectItems = async (productIds, options) => {\n    const ecommerceObject = await generateEcommerceObject(productIds, options)\n\n    const output = {\n        event: 'select_item',\n        event_raised_by: options?.eventRaisedBy ?? 'before_cross_sell_v3',\n        click_location: options?.clickLocation ?? 'page builder cross sell quick view',\n        item_list_id: options?.listId ?? 'before_cross_sell_v3',\n        subscription_product_included: 'false',\n        discovery_offer_included: 'false',\n        ...ecommerceObject\n    }\n\n    window.gtmDataObject.push({ ecommerce: null })\n    window.gtmDataObject.push(output)\n}\n\nexport const viewItemList = async (productIds, options) => {\n    const ecommerceObject = await generateEcommerceObject(productIds, options)\n\n    const output = {\n        event: 'view_item_list',\n        event_raised_by: options?.eventRaisedBy,\n        subscription_product_included: 'false',\n        discovery_offer_included: 'false',\n        ...ecommerceObject\n    }\n\n    if (options?.eventRaisedBy === undefined) delete output.event_raised_by\n\n    window.gtmDataObject.push({ ecommerce: null })\n    window.gtmDataObject.push(output)\n}\n\nexport const isGtmTrackingExists = trackingData => {\n    window.gtmDataObject = window.gtmDataObject || []\n\n    return window.gtmDataObject.some(\n        event =>\n            event.event === trackingData.event &&\n            event.ecommerce?.creative_slot === trackingData.campaign.position &&\n            event.ecommerce?.promotion_id === trackingData.campaign.id &&\n            event.ecommerce?.promotion_name === trackingData.campaign.name &&\n            event.ecommerce?.creative_name === trackingData.campaign.creative\n    )\n}\n","import createProps from '@kissui/helpers/src/props.helpers'\nimport { stringifyForAttribute, makeId } from '@kissui/helpers/src/utils'\nimport { EVENT_POPIN_OPEN, EVENT_QUICKVIEW_OPEN } from '@kissui/components'\nimport { dispatchEvent } from '@kissui/helpers/src/assets/js/eventDispatch'\nimport createRefs from '@kissui/helpers/src/refs.helpers'\nimport { getSkuComponentByType } from '@kissui/components/src/sku/services'\nimport { getProductAndClean } from '@kissui/helpers/src/catalog'\nimport { VARIATION_CROSS_SELL } from '@kissui/components/src/sku/constants'\nimport { getMergedProductData } from './dataTransform'\nimport { getPriceFormatter, market } from '@kissui/pdp-data'\nimport { NB_SLIDES_MOBILE, NB_SLIDES_TABLET, NB_SLIDES_DESKTOP } from './js/constants'\nimport { isLoggedIn } from '@kissui/helpers/src/dataLayer'\nimport fetcherService from './services/fetcher.service'\nimport {\n    API_SOURCE_LAST_USER_ORDERS,\n    API_SOURCE_COVEO_POPULAR_ITEMS_BOUGHT,\n    API_SOURCE_COVEO_FREQUENTLY_BOUGHT_TOGETHER,\n    API_SOURCE_HQ_RECOMMENDATION_HW\n} from './constants'\nimport { getSkuQuickViewData } from '@kissui/components/src/sku-quick-view/shared-quick-view'\nimport { viewItemList } from '../../../helpers/src/gtmEvents'\nclass CrossSellNatural extends HTMLElement {\n    constructor() {\n        super()\n        this.boundOnQuickViewOpen = this.onQuickViewOpen.bind(this)\n        this.popinId = `quick_view_popin_${makeId(5)}`\n    }\n\n    connectedCallback() {\n        this.props = createProps(this.attributes)\n        this.moveBackground()\n        this.onReady().then(() => {\n            this.bindEvent()\n            this.render()\n        })\n\n        const SKUs = this.props.products.map(product => product.sku)\n        const { campaign, copywriting } = this.props\n\n        viewItemList(SKUs, {\n            listId: campaign.position,\n            listName: `${campaign.position} - ${copywriting.heading}`,\n            eventRaisedBy: campaign.position\n        })\n    }\n\n    render() {\n        if (this.currentProducts?.length === 0) {\n            return\n        }\n        const { layout, campaign } = this.props\n\n        this.innerHTML = `\n            <nb-container\n                campaign_id=\"${campaign.id}\"\n                campaign_name=\"${campaign.name}\"\n                campaign_position=\"${campaign.position}\"\n                campaign_creative=\"${campaign.creative}\"\n                contrast=\"${layout.contrast}\"\n                background_color=\"${layout.background_color}\"\n                background_mobile='${layout.background.mobile}'\n                background_desktop='${layout.background.desktop}'\n                background_retina='${layout.background.retina}'\n                classname=\"${layout.padding_top} ${layout.padding_bottom} ${\n            layout.background_color\n        }\">\n                ${this.renderHeading()}\n                ${this.renderDescription()}\n                ${this.renderLink()}\n                ${this.renderSlider()}\n            </nb-container>\n        `\n        this.renderProducts()\n    }\n\n    moveBackground() {\n        this.backgroundColor = this.querySelector('.cb-bg-color')\n        this.backgroundImage = this.querySelector('.cb-bg-img')\n        this.inner = this.querySelector('.cb-inner')\n        this.slider = this.querySelector('nb-slider-natural')\n        if (this.backgroundColor) {\n            this.inner.insertBefore(this.backgroundColor, this.slider)\n        }\n        if (this.backgroundImage) {\n            this.inner.insertBefore(this.backgroundImage, this.slider)\n        }\n    }\n\n    renderHeading() {\n        const { heading } = this.props.copywriting\n\n        if (!heading) {\n            return ''\n        }\n\n        return `<h2 class='h-3xl-300'>${heading}</h2>`\n    }\n\n    renderDescription() {\n        const { description } = this.props.copywriting\n\n        if (!description) {\n            return ''\n        }\n\n        return `<p class='t-sm-400'>${description}</p>`\n    }\n\n    renderLink() {\n        const { id, name, creative, position } = this.props.campaign\n        const { link = {} } = this.props.copywriting\n        const { label = '' } = link\n\n        if (!label) {\n            return ''\n        }\n\n        link.campaign_id = id\n        link.campaign_name = name\n        link.campaign_creative = creative\n        link.campaign_position = position\n        const data = stringifyForAttribute(link)\n        return `<nb-link data=\"${data}\">${label}</nb-link>`\n    }\n\n    renderSlider() {\n        const { a11y_labels } = this.props.copywriting\n\n        const data = {\n            options: {\n                mobile: {\n                    items_per_slide: NB_SLIDES_MOBILE,\n                    item_width: '279', // Need to check where this magic number comes from\n                    slide_min_height: 'auto',\n                    slider_gap: '16',\n                    display_counter: 'true'\n                },\n                tablet: {\n                    items_per_slide: NB_SLIDES_TABLET,\n                    item_width: 'auto',\n                    slide_min_height: 'auto',\n                    slider_gap: '40'\n                },\n                desktop: {\n                    items_per_slide: NB_SLIDES_DESKTOP,\n                    item_width: 'auto',\n                    slide_min_height: 'auto',\n                    slider_gap: '40'\n                }\n            },\n            a11y_labels\n        }\n\n        return `<nb-slider-natural data=\"${stringifyForAttribute(data)}\" data-ref=\"slider\">\n            <li class=\"slide\"><nb-loader></nb-loader></li>\n            <li class=\"slide\"><nb-loader></nb-loader></li>\n            <li class=\"slide\"><nb-loader></nb-loader></li>\n        </nb-slider-natural>`\n    }\n\n    async onReady() {\n        const payloads = await Promise.all([market(), getPriceFormatter(), fetcherService.init()])\n        const [{ currency }, priceFormatter] = payloads\n        this.currency = currency\n        this.priceFormatter = priceFormatter\n        await this.loadProducts()\n    }\n\n    async getExternal() {\n        const { source } = this.props.options\n\n        if (source === API_SOURCE_LAST_USER_ORDERS && isLoggedIn()) {\n            return fetcherService.fetchProductsLastOrder()\n        } else if (source === API_SOURCE_HQ_RECOMMENDATION_HW) {\n            return fetcherService.fetchHQRecommendation()\n        } else if (source === API_SOURCE_COVEO_POPULAR_ITEMS_BOUGHT) {\n            return fetcherService.fetchCoveo(source)\n        } else if (source === API_SOURCE_COVEO_FREQUENTLY_BOUGHT_TOGETHER) {\n            const pdpProduct = await window\n                .getPDPData()\n                .then(v => v.configuration.eCommerceData.product.legacyId)\n            return fetcherService.fetchCoveo(source, [pdpProduct])\n        }\n    }\n\n    async loadProducts() {\n        const { products } = this.props\n        const external = await this.getExternal()\n\n        this.currentProducts = external ?? products.map(product => product.sku)\n\n        try {\n            await getProductAndClean(this.currentProducts)\n        } catch (e) {\n            console.error(e)\n        }\n    }\n\n    renderProducts() {\n        this.refs = createRefs(this)\n        const renderedProductList = this.currentProducts.reduce(\n            (output, product, index) => `${output}${this.renderProductElement(product, index)}`,\n            ''\n        )\n\n        this.slider = this.refs['slider']\n\n        this.slider.carousel.innerHTML = `${renderedProductList}`\n        this.slider.initSlider()\n    }\n\n    renderProductElement(product, index) {\n        const { sku_quick_view, heading } = this.props.copywriting\n        const { source } = this.props.options\n\n        // TODO: DTO to merge and format data\n        const tag = getSkuComponentByType(product) // sku-coffee\n        const elementProduct = document.createElement(tag)\n\n        const pageBuilderProductProps = this.props.products.find(\n            productPageBuilder => productPageBuilder.sku === product.legacyId\n        )\n\n        const mergedProductData = getMergedProductData(\n            product,\n            pageBuilderProductProps ?? {},\n            this.props,\n            this.priceFormatter,\n            this.currency\n        )\n        mergedProductData.variation = VARIATION_CROSS_SELL\n\n        let trackingList = heading\n        if (source) {\n            trackingList = source\n        }\n\n        elementProduct.setAttribute('tracking_list', 'Cross Sell - ' + trackingList)\n        elementProduct.setAttribute('tracking_position', index + 1)\n        elementProduct.setAttribute('campaign_creative', this.props.campaign?.creative)\n\n        if (\n            mergedProductData.contact_cta?.contact_cta_text &&\n            mergedProductData.contact_cta?.show_contact_cta\n        ) {\n            mergedProductData.show_view_details = true\n        }\n\n        if (sku_quick_view.more_info) {\n            mergedProductData.quick_view_plp = {\n                show_view: true,\n                popin: {\n                    popin_id: this.popinId,\n                    close: sku_quick_view.popin.close,\n                    footer: true\n                }\n            }\n\n            mergedProductData.quick_view = {\n                label: sku_quick_view.more_info,\n                popin_id: this.popinId\n            }\n        }\n\n        elementProduct.setAttribute('data', JSON.stringify(mergedProductData))\n        return `<li class=\"slide\">${elementProduct.outerHTML}</li>`\n    }\n\n    onQuickViewOpen(e) {\n        const { detail = {} } = e\n        const { sku_quick_view } = this.props.copywriting\n        if (detail.id !== this.popinId || !detail.sku) {\n            return\n        }\n\n        if (this.quickViewElement) {\n            this.quickViewElement.remove()\n        }\n\n        if (detail.sku_colors) {\n            detail.sku_colors = detail.sku_colors.split(',')\n        }\n\n        const currentProduct = this.currentProducts.find(\n            product =>\n                product.legacyId === detail.sku ||\n                detail.sku === product.internationalId ||\n                (detail.sku_colors ? detail.sku_colors.indexOf(product.legacyId) : '')\n        )\n        const skuData = {\n            ...this.props,\n            priceFormatter: this.priceFormatter,\n            currency: this.currency,\n            sku_quick_view,\n            tracking_position: detail.tracking_position,\n            tracking_list: detail.tracking_list\n        }\n        getSkuQuickViewData(currentProduct, this.popinId, skuData, VARIATION_CROSS_SELL)\n        dispatchEvent({ eventName: EVENT_POPIN_OPEN, args: { id: detail.id } })\n    }\n\n    bindEvent() {\n        this.unbindEvent()\n        window.addEventListener(EVENT_QUICKVIEW_OPEN, this.boundOnQuickViewOpen)\n    }\n\n    unbindEvent() {\n        window.removeEventListener(EVENT_QUICKVIEW_OPEN, this.boundOnQuickViewOpen)\n    }\n\n    disconnectedCallback() {\n        this.unbindEvent()\n    }\n}\n\ncustomElements.get('nb-cross-sell-natural') ||\n    customElements.define('nb-cross-sell-natural', CrossSellNatural)\n\nexport default CrossSellNatural\n","export const dispatchEvent = ({ eventName, args, element }) => {\n    // Use the provided element or fallback to window if available\n    if (!element) {\n        if (typeof window !== 'undefined') {\n            element = window\n        } else {\n            throw new Error(\n                '`element` is not provided and `window` is unavailable. Provide a valid element to dispatch the event.'\n            )\n        }\n    }\n\n    let event\n    if (args) {\n        event = new CustomEvent(eventName, { detail: args, bubbles: true })\n    } else {\n        if (typeof Event === 'function') {\n            event = new Event(eventName)\n        } else {\n            event = document.createEvent('Event')\n            event.initEvent(eventName, true, true)\n        }\n    }\n    element.dispatchEvent(event)\n}\n\nexport const readEvent = e => {\n    if (!e.detail) {\n        return\n    }\n    return e.detail\n}\n"],"names":["isNil","obj","stringifyForAttribute","data","escapeHtml","JSON","stringify","text","map","replace","m","DOMParser","sanitizeString","toString","EVENT_QUICKVIEW_OPEN","extract","refs","$ref","ref","dataset","refArray","match","getRefArray","name","index","undefined","ECAPI_TYPE_CAPSULE","ECAPI_TYPE_MACHINE","ECAPI_TYPE_ACCESSORY","ECAPI_TYPE_GIFT_CARD","getProduct","sku","window","napi","catalog","trimSku","isBundled","productData","sales_multiple","salesMultiple","isSalesMultipleGreaterThanOne","isUnitQuantityEqualToOne","unitQuantity","isSalesMultipleEqualToOne","isUnitQuantityGreaterThanOne","apiOverride","pageBuilderData","images","headline","description","api_override","image","icon","url","push","main","VARIATION_CROSS_SELL","getDataLayer","padlNamespace","dataLayer","getMarketCode","app","market","toLocaleLowerCase","getSegmentCode","page","pageInfo","segmentBusiness","COMMON_URL","ORGANIC_LOGO_IMG_EU","ORGANIC_LOGO_IMG_US","ORGANIC_LOGO_IMG_CA","ORGANIC_LOGO_IMG_BR","ORGANIC_LOGO_IMG_JP","ORGANIC_LOGO_IMG_BE","organicLogoImg","getOrganicLogo","getMaxIntensity","technologies","INTENSITY_MAX_OL","indexOf","getMergedProductCoffeeData","product","pageBuilderProductProps","pageBuilderProps","priceFormatter","currency","bundle_details","options","show_sleeve_price","isBundledResult","showCapsulePrice","price_per_capsule","final_price","bundled","type","price","Math","round","getFinalPrice","option","intensity","capsuleProperties","max_intensity","short","show_capsule_price","getMergedProductData","variant","labels","strikethrough_price","additional_message","additional_message_icon","additional_message_link","contact_cta","internationalId","longSku","id","unit_quantity","category_name","rangeData","label_range","rawPrice","variation","image_alt_text","length","highlighted","dataTransformObjectProductType","getMergedProductMachineData","ratingsAndReviews","ratings","colors","activeSku","max_colors","show_ratings","minimum_rating","getMergedProductGiftCardData","_","default_image","async","read","getPriceFormatter","priceFormat","COVEO_ORGANIZATION_ID","URLSearchParams","location","search","has","toNonProd","host","includes","COVEO_ACCESS_TOKEN","COVEO_ACCESS_TOKEN_B2B","isB2B","toUpperCase","fieldsToInclude","fieldsToIncludeB2B","CoveoHeadless","language","country","upperCaseCountry","locale","expectedRecommendations","assignSkusToMlParameters","skus","body","mlParameters","itemIds","itemId","getFieldsToInclude","getSearchHubName","searchHub","getCountryForCoveoB2B","getSelectedCountry","getUpperCaseCountryForCoveoB2B","getWebsite","validateCoveoHeadless","Error","fetcherService","init","Promise","resolve","reject","loadExternalScript","src","callback","defer","module","script","document","createElement","onload","appendChild","error","fetchProductsLastOrder","checkoutService","checkout","lastOrder","getMyLastOrder","quotation","cartLines","cartItem","legacyId","slice","console","fetchCoveo","selectedCountry","website","engine","buildSearchEngine","configuration","organizationId","accessToken","platformUrl","pipeline","preprocessRequest","request","clientOrigin","parse","context","sitename","context_website","context_sitename","recommendation","numberOfResults","recsList","buildResultList","unsubscribe","subscribe","state","isLoading","firstSearchExecuted","results","result","raw","nes_prd_sku","setTimeout","executeFirstSearch","fetchHQRecommendation","import","origin","superCategory","allDetails","usageIntent","plpProductList","response","fetch","ok","json","forEach","category","products","timeoutHandler","message","Array","isArray","some","key","TypeError","filteredArrayOfSKUs","Object","values","filter","Boolean","finally","VARIATION_PLP","getCapsuleFeatures","acidity","bitterness","roastLevel","value","roast","getSkuQuickViewProp","popinId","skuData","componentType","mergedProductData","getMergedProductDataForComponentType","addToCartProps","getAddToCartProperties","isVariationOnPLP","getPlpQuickViewProps","getCrossSellQuickViewProps","matchedProduct","find","productPageBuilder","getAddToCartProps","commonProps","Number","hidePrice","label_capsules","capsule_price_label","capsule_price_syntax","show_sleeve","sleeve_syntax","number_of_sleeves","label_sleeves","label_sleeve","popin","popin_id","close","quick_view_plp","footer","intensity_label","a11y_intensity_max","cup_sizes","items","cupSizesDetails","aromatic_profile","capsuleProductAromatics","link","levels","pricing","add_to_cart","position","view_details_label","rendererName","showSleeve","campaign","copywriting","sku_quick_view","pdpURLs","desktop","arrTolastURLElementMapper","arr","item","split","pop","trim","arrToJoinedString","joiner","join","findTechnogiesText","cleanText","str","viewItemList","productIds","ecommerceObject","productRequests","SKU","all","ecommerce","config","padl","namespace","reduce","ac","item_id","item_name","internationalName","item_brand","item_category","output","item_category2","item_category3","quantity","affiliation","coupon","discount","location_id","item_list_name","listName","item_list_id","listId","item_market_id","item_market_name","item_technology","item_range","item_discovery_offer","item_added_by_user","item_ecotax_applicable","displayEcoTax","item_selection_list","productSelections","item_in_stock","inStock","item_subscription_name","item_subscription_category","item_subscription_price","item_subscription_duration","item_subscription_fee","capsuleProduct","item_category4","item_type","item_coffee_aromatic_profile","toLowerCase","item_coffee_intensity","item_coffee_cup_size","capsuleCupSizes","machineProduct","item_machine_shade","colorShade","item_avg_rating","ratingCode","item_number_of_reviews","generateEcommerceObject","event","event_raised_by","eventRaisedBy","subscription_product_included","discovery_offer_included","gtmDataObject","CrossSellNatural","HTMLElement","constructor","super","this","boundOnQuickViewOpen","onQuickViewOpen","bind","characters","i","charAt","floor","random","makeId","connectedCallback","props","attributes","attribute","nodeName","getData","attr","nodeValue","log","createProps","moveBackground","onReady","then","bindEvent","render","SKUs","heading","currentProducts","layout","innerHTML","creative","contrast","background_color","background","mobile","retina","padding_top","padding_bottom","renderHeading","renderDescription","renderLink","renderSlider","renderProducts","backgroundColor","querySelector","backgroundImage","inner","slider","insertBefore","label","campaign_id","campaign_name","campaign_creative","campaign_position","a11y_labels","items_per_slide","item_width","slide_min_height","slider_gap","display_counter","tablet","payloads","loadProducts","getExternal","source","isLoggedIn","user","pdpProduct","getPDPData","v","eCommerceData","external","getProductFn","promises","splice","catch","getProductAndClean","e","querySelectorAll","renderedProductList","renderProductElement","carousel","initSlider","tag","getSkuComponentByType","is_machine_b2b","elementProduct","trackingList","setAttribute","contact_cta_text","show_contact_cta","show_view_details","more_info","show_view","quick_view","outerHTML","detail","quickViewElement","remove","sku_colors","currentProduct","tracking_position","tracking_list","handleVariation","P","handlePLPVariation","Y","handleCrossSellVariation","newQuickViewElement","getSkuQuickViewData","dispatchEvent","eventName","args","element","CustomEvent","bubbles","Event","createEvent","initEvent","unbindEvent","addEventListener","removeEventListener","disconnectedCallback","customElements","get","define"],"mappings":"AAAA,MAqBMA,EAAQC,GAAoC,MAARA,ECkNnC,MAgHMC,EAAwBA,CAACC,EAAO,KAClCC,EAAWC,KAAKC,UAAUH,IAQxBC,EAAcG,IACvB,MAAMC,EAAM,CACR,IAAK,QACL,IAAK,OACL,IAAK,OACL,IAAK,SACL,IAAK,UAGT,OAAOD,EAAKE,QAAQ,YAAmBD,GAAAA,EAAIE,IAAE,EAQ/B,IAAIC,UAKTC,MAAAA,EAAkBT,GACtBA,EAIEA,EAAKU,WAAWJ,QAAQ,KAAM,UAAUA,QAAQ,KAAM,UAHlD,GCzVFK,EAAuB,+BC7B9BC,EAAUA,CAACC,EAAMC,KACb,MAAEC,IAAAA,GAAQD,EAAKE,QAGfC,EAAWF,EAAIG,MAAM,iBAE3B,OAAiB,OAAbD,EACOE,EAAYN,EAAMC,EAAMG,GAExB,IAAKJ,EAAM,CAACC,EAAKE,QAAQD,KAAMD,IAIxCK,EAAcA,CAACN,EAAMC,GAAM,CAAGM,EAAMC,WACnBC,IAAfT,EAAKO,KACLP,EAAKO,GAAQ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