${headline}
`\n}\n","export const renderLabelTechnology = ({ label_technology }) => {\n if (!label_technology) {\n return ''\n }\n\n return `${label_technology}
`\n}\n","export const renderLabelRange = ({ label_range }) => {\n if (!label_range) {\n return ''\n }\n\n return `${label_range}
`\n}\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.${finalPrice || giftcard_price}
`\n}\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 viewportHelper from '@kissui/helpers/src/viewport.helpers'\nimport {\n VARIATION_PLP,\n VARIATION_SMALL,\n VARIATION_CROSS_SELL,\n VARIATION_PDP\n} from '@kissui/components/src/sku/constants'\nimport { isLoggedIn } from '@kissui/helpers/src/dataLayer'\n\nconst getButtonSize = variation => {\n switch (variation) {\n case VARIATION_PLP:\n return viewportHelper.is.mobile ? 'small' : 'large'\n case VARIATION_SMALL:\n return 'small'\n default:\n return 'large'\n }\n}\n\nfunction getComputedProps(activeSku, activeLongSku, sku, longSku, disableTracking) {\n const skuProp = activeSku || sku\n const activeLongSkuProp = activeLongSku || longSku\n const disableTrackingProp = disableTracking && `disableTracking=true`\n\n return { skuProp, activeLongSkuProp, disableTrackingProp }\n}\n\nexport const renderAddToCart = props => {\n const {\n activeLongSku,\n activeSku,\n category_name = '',\n contact_cta = {},\n hidePrice,\n longSku = '',\n position,\n rendererName = '',\n show_view_details = false,\n sku,\n url,\n variation = VARIATION_PLP,\n view_details_label = 'View details',\n technologies = [],\n disableTracking = false\n } = props\n\n const buttonSize = getButtonSize(variation)\n let cta_url = url,\n cta_label = view_details_label,\n contact_cta_text = contact_cta.contact_cta_text || '',\n contact_url_anchor = contact_cta.contact_url_anchor || '',\n is_b2b = checkForB2B(technologies)\n\n // CONTACT US BUTTON\n const { skuProp, activeLongSkuProp, disableTrackingProp } = getComputedProps(\n activeSku,\n activeLongSku,\n sku,\n longSku,\n disableTracking\n )\n\n function b2bNotLoggedIn(contact_url_anchor, cta_url, cta_label) {\n //CONTACT US BUTTON[ hidePrice = true]\n const linkAttribute = contact_url_anchor ? `link=\"${cta_url}\"` : ''\n\n return `\n ${renderIcon}\n ${additional_message}
`\n }\n\n const hasAdditionalMessageLink =\n additional_message_link && additional_message_link.link && additional_message_link.label\n\n if (!hasAdditionalMessageLink) {\n return additionalMessageFinal\n }\n\n return (\n additionalMessageFinal +\n `