Infiniment Double Espresso LE Vertuo Pods (2024)

' ); clearInterval(checkHeaderLoaded); } }, 50);

${name}

${price} €

`; card.innerHTML = cardInn; if($("#" + this.cs_id).length){ $("#" + this.cs_id).append(card); }else{ console.error('PAGE BUILDER CONVERSION ERROR - container not found') }console.log('generate card on: ' + this.cs_id) //OGNI VOLTA CHE VIENE AGGIUNTA UNA CARD, CONTROLLO SE CI SONO TUTTE this.#checkForInitializeCart(); } //RECUPERO DATI SINGOLA SKU DA NESSOFT, POI GENERO LA CARD async getDataFromSKU(sku, color, type) { try { let response = await napi.catalog().getProduct(sku); //console.log(response); let name = response.name; let image = response.images.foreground; if (!image) { image = response.images.icon; } let link = response.pdpURLs.desktop; let price = response.unitPrice; if(price < 1){ price=price.toFixed(2);} this.#generateCard(name, image, color, link, price, sku, type); } catch (err) { console.log(err + 'sku: '+sku+' non trovata'); } } //PER OGNI ELEMENTO DEL DATASET T FORNITO, RECUPERA DATI DA NESSOFT, POI GENERA CARD #dataCycle(t) { Object.keys(t).forEach((key) => { let sku = t[key].SKU; let color = t[key].COLOR; let type = t[key].TYPE; this.skus.push(sku); this.getDataFromSKU(sku, color, type); }); } //INIZIO CARICAMENTO: ANALISI TIPO DI CROSSELL E ASSOCIAZIONE A DATASET CORRETTO async #getData() { console.log("CROSSELL-TYPE: " + this.cs_type); this.queryData; let naps; var obj; //CONTROLLO SE IL CROSSELL E' PERSONALIZZATO O STATICO if (this.cs_type == "custom") { this.queryData = cs_database_custom[this.cs_id]; //ACCEDO A DATABASE PERSONALIZZATO try { let cus = await sessionStorage["customerInfo-it"]; //ACCEDO AI DATI UTENTE LOGGATO if (cus === undefined) { //SE UTENTE NON LOGGATO, GENERO POOL CASUALE TRA LE SKU DISPONIBILI console.log("utente non loggato"); let a1 = this.queryData.OL; let b1 = this.queryData.VL; const combined = { ...a1, 4: b1[1], 5: b1[2], 6: b1[3] }; var arr = []; while (arr.length < 3) { var r = Math.floor(Math.random() * 6) + 1; if (arr.indexOf(r) === -1) arr.push(r); } this.l = 3; let randomPool = { 1: combined[arr[0]], 2: combined[arr[1]], 3: combined[arr[2]], }; //console.log(randomPool); this.#dataCycle(randomPool); //CARICO CASUALE } else { var obj = JSON.parse(cus); //console.log(obj) naps = obj; //await napi.customer().read(); //console.log(naps); let t = naps.preferredTechnology; //CONTROLLO TECNOLOGIA PREFERITA E AVVIO GENERAZIONE let tec; if (t == "nesclub2.it.b2c/machineTechno/vertuo") { tec = this.queryData.VL; try { this.l = Object.keys(tec).length; } catch (err) { console.err("RISCONTRO ID CROSSELL NON TROVATO"); } this.#dataCycle(tec); } else if (t == "nesclub2.it.b2c/machineTechno/original") { tec = this.queryData.OL; try { this.l = Object.keys(tec).length; } catch (err) { console.err("RISCONTRO ID CROSSELL NON TROVATO"); } this.#dataCycle(tec); } } } catch (err) { console.log(err); if (this.recursive < 1) { this.recursive = 1; console.err("ALLERTA RICORSIONE"); this.#getData(); //RICORSIONE FUNZIONE SE IL DATABASE NON SI CARICA } } } else { //AVVIO CROSSELL STATICO this.queryData = cs_database[this.cs_id];console.log('AVVIO XSELL STATICO ') this.l = Object.keys(this.queryData).length; this.#dataCycle(this.queryData); } } #loadControl() { //CONTROLLO LAZY LOADING E IMPRESSION this.posY = this.getBoundingClientRect().y; let delta = this.posY - window.scrollY; if (delta <= this.startLoad) { if (this.lockLoad) { this.lockLoad = false; this.#getData(); } if (delta <= 0) { $(window).off("scroll." + this.cs_id + "_scr"); //SPENGO EVENTO DI CONTROLLO QUANDO CARICATO //TRACKING IMPRESSION this.skus.forEach((element, index) => { this.pushTrackImpression(this.skus[index]); }); } } } #resizeUpdate() { //AGGIORNAMENTO PARAMETRI CONTROLLO CARICAMENTO IN CASO DI RESIZE this.wHeight = window.innerHeight; this.posY = this.getBoundingClientRect().y; this.startLoad = this.wHeight * this.factorLoad; //console.log(this.wHeight); } //ATTIVO EVENTI PRINCIPALI E TRACCIATORI (ORA SI ATTIVA TUTTO AL PRIMO SCROLL) #activeEvents() {console.log('XSELL START') //this.#loadControl(); this.#generateTrackers(); $(window).on("resize", () => this.#resizeUpdate());if($(this).hasClass('notlazy')){ console.log('XSELL : CARICAMENTO MANUALE') if (this.lockLoad) { this.lockLoad = false; this.#getData(); }}else{ $(window).on("scroll." + this.cs_id + "_scr", () => this.#loadControl() );} } // connect component connectedCallback() { let csLang = $("html").attr("lang"); let csIntroTxt; if (csLang == "it") { csIntroTxt = "POTREBBE PIACERTI ANCHE:"; } else if (csLang == "en") { csIntroTxt = "YOU MIGHT LIKE:"; } this.innerHTML = `

${csIntroTxt}

`; this.#activeEvents(); } } // register component customElements.define("cross-sell", Crossell); });
${text}
`; } else { banner.innerHTML = `

Infiniment Double Espresso LE Vertuo Pods (1)

${cus_text}
`; } $("#" + this.sb_id).append(banner); //A SECONDA DELLA PAGINA INIZIALIZZO ADD TO CART BUTTONS let mos = document.getElementById("main-container"); if (mos) { mosaic.initializeAllFreeHTMLModules(mos); } else { mosaic.initializeAllFreeHTMLModules(document.getElementById("main")); } //IMPRESSION AVVIO this.pushTrackImpression(sku); } async getDataFromSKU(sku, color, isCustom) { try { let response = await napi.catalog().getProduct(sku); //elaborate response data let image = response.images.foreground; if (!image) { image = response.images.icon; } let name = response.name; let link = response.pdpURLs.desktop; let price = response.unitPrice; this.#generateBanner(image, name, color, price, sku, link); } catch (err) { console.log(err); } } #generateOnlyLink(txt, color, link) { let bkg_color = `background-color: ${color};`; let cus_img = this.queryData.IMG; $("#" + this.sb_id).attr("style", bkg_color); let banner = document.createElement("div"); banner.addEventListener("click", (e) => { this.pushTrackClick("CTA"); setTimeout(() => { let newUrl=window.location.href.split('#')[0]; history.replaceState( {} , '', newUrl ); }, 200) }); if (cus_img == "") { banner.setAttribute("class", "sb-banner-inner sb-link"); if(link == ""){ banner.innerHTML = `

${txt}

`; }else{ banner.innerHTML = `

${txt}

SCOPRI

`; } } else { banner.setAttribute("class", "sb-banner-inner sb-link-img"); banner.innerHTML = `

Infiniment Double Espresso LE Vertuo Pods (2)

${txt}

SCOPRI

`; } $("#" + this.sb_id).append(banner); //IMPRESSION AVVIO this.pushTrackImpression("CTA"); } #elaborate() { //console.log(this.queryData) let sku = this.queryData.SKU; let color = this.queryData.COLOR; let format = this.queryData.FORMAT; let txt = this.queryData.TEXT; let link = this.queryData.LINK; if (sku != "") { this.getDataFromSKU(sku, color); } else { this.#generateOnlyLink(txt, color, link); } } async #getData() { this.queryData = sb_database[this.sb_id]; if (this.selid == "SELID") { try { let cus = await sessionStorage["customerInfo-it"]; //ACCEDO AI DATI UTENTE LOGGATO if (cus === undefined) { let i = 1; let interval = setInterval(() => { if (i >= 5) { console.log("utente non loggato"); clearInterval(interval); } cus = sessionStorage["customerInfo-it"]; console.log("customer try connection " + i); if (cus != undefined) { var obj = JSON.parse(cus); let selIds = obj.selectionIDs; console.log(this.queryData.SELID); //control if selid is ok for (let k = 0; k < this.queryData.SELID.length; k++) { if (selIds.includes(this.queryData.SELID[k])) { this.#elaborate(); clearInterval(interval); console.log("connected " + this.queryData.SELID[k]); break; } } } i++; }, 400); } else { var obj = JSON.parse(cus); let selIds = obj.selectionIDs; //control if selid is ok for (let k = 0; k < this.queryData.SELID.length; k++) { if (selIds.includes(this.queryData.SELID[k])) { this.#elaborate(); console.log("connected " + this.queryData.SELID[k]); break; } } } } catch (err) { console.error(err); } } else if (this.selid == "STATIC") { this.#elaborate(); } } // connect component connectedCallback() { this.innerHTML = ` `; this.#generateTrackers(); setTimeout(() => { this.#getData(); }, 1500); } } // register component customElements.define("sticky-banner", Sticky_banner); });

+

` ); } else if ( customerCart .flat() .map((value) => value.type) .indexOf('capsule') !== -1 && excludeSKUs.some((r) => inCartSKU.includes(r)) && document.querySelector('.MiniBasketTotalTable') !== null && document.querySelector('#minibasketCrossell') === null ) { gtmDataObject = window.gtmDataObject || []; gtmDataObject.push({ event: 'impression', eventAction: 'Promo Impression - On Load', eventRaisedBy: 'FreeHTML', ecommerce: { promoView: { promotions: [ { id: 'IT_tracking_minibasketCrossell', name: "Summer Days 2024 - View Biscotti all'arancia from Minibasket", creative: 'NIT_minibasket_crossell', position: 'IT_nespresso_minibasket', }, ], }, }, }); document .querySelector('.MiniBasketTotalTable') .insertAdjacentHTML( 'afterend', `` ); } else if ( customerCart .flat() .map((value) => value.type) .indexOf('capsule') !== -1 && document.querySelector('.MiniBasketTotalTable') !== null && document.querySelector('#minibasketCrossell') === null ) { gtmDataObject = window.gtmDataObject || []; gtmDataObject.push({ event: 'impression', eventAction: 'Promo Impression - On Load', eventRaisedBy: 'FreeHTML', ecommerce: { promoView: { promotions: [ { id: 'IT_tracking_minibasketCrossell', name: 'Summer Days 2024 - View Barista Ice Cube Tray from Minibasket', creative: 'NIT_minibasket_crossell', position: 'IT_nespresso_minibasket', }, ], }, }, }); document .querySelector('.MiniBasketTotalTable') .insertAdjacentHTML( 'afterend', `

Infiniment Double Espresso LE Vertuo Pods (4)

L'ideale per il tuo caffè con ghiaccio Aggiungi il Barista Ice Cube Tray a 9€

+

` ); } else { } }, 500); }); } function addDecaKitToBasket() { CartManager.updateItem('5048-1', 1); $('#minibasketCrossell').fadeOut(); gtmDataObject = window.gtmDataObject || []; gtmDataObject.push({ event: 'promoClick', ecommerce: { promoClick: { promotions: [ { creative: 'NIT_minibasket_crossell', id: 'IT_tracking_minibasketCrossell', name: 'Summer Days 2024 - Added Kit Descaling from Minibasket', position: 'IT_nespresso_minibasket', }, ], }, }, }); } function addBiscottiToBasket() { CartManager.updateItem('128004', 1); $('#minibasketCrossell').fadeOut(); gtmDataObject = window.gtmDataObject || []; gtmDataObject.push({ event: 'promoClick', ecommerce: { promoClick: { promotions: [ { creative: 'NIT_minibasket_crossell', id: 'IT_tracking_minibasketCrossell', name: "Summer Days 2024 - Added Biscotti all'arancia from Minibasket", position: 'IT_nespresso_minibasket', }, ], }, }, }); } function addIceToBasket() { CartManager.updateItem('137277', 1); $('#minibasketCrossell').fadeOut(); gtmDataObject = window.gtmDataObject || []; gtmDataObject.push({ event: 'promoClick', ecommerce: { promoClick: { promotions: [ { creative: 'NIT_minibasket_crossell', id: 'IT_tracking_minibasketCrossell', name: 'Summer Days 2024 - Added Barista Ice Cube Tray from Minibasket', position: 'IT_nespresso_minibasket', }, ], }, }, }); }
You are on the main content ` ); $('#activationStickyBanner').fadeIn(); } new casperEventHub.Experience( 'logged-customer-on-GWPICA-' + trackingIDGWPICA ) .visitorIs({ status: 'Active', }) .executeOnMatch(function (data) { let eligibleSelIDs = configureGWPICAVariable .map((element) => element.selID) .flat(); username = data.user.firstName; new casperEventHub.Experience(trackingIDGWPICA) .visitorIs({ selectionIDs: casperEventHub.oneOf( ...eligibleSelIDs.filter((item) => item !== '') ), }) .executeOnMatch(function (data) { let eligibleUserSelID = data.user.selectionIDs.filter( (element) => eligibleSelIDs.includes(element) )[0]; setupGWPICAEnviromentWithSelID(eligibleUserSelID); data.unsubscribe(); }) .executeOnMismatch(function (data) { let checkExcludedUser = data.user.selectionIDs.filter((value) => excludeSelIDs.includes(value) ).length > 0 ? true : false; if (eligibleSelIDs.includes('') && !checkExcludedUser) { setupGWPICAEnviromentWithSelID(''); } else { $('#GWPICAProgressBarText').html( `Manca un solo step,
per vedere le nostre promozioni.` ); $('#GWPICAProgressBarCTA').html( `

SCOPRI

` ); } data.unsubscribe(); }) .evaluate(); data.unsubscribe(); }) .executeOnMismatch(function (data) { /* EVENTUALE USE CASE PER PROSPECT CHE SCEGLIE DI REGISTRARSI */ }) .evaluate(); }); function setupGWPICAEnviromentWithSelID(eligibleUserSelID) { eligibleSelIDProperties = {}; configureGWPICAVariable.some(function (el) { if (el.selID.indexOf(eligibleUserSelID) !== -1) { eligibleSelIDProperties = el; return true; } }); capsuleOLSKUInPromo = Object.values( NITDATABASE.filter((e) => e.TECH === 'OL') ) .flat() .map((value) => value.SKU); capsuleVLSKUInPromo = Object.values( NITDATABASE.filter((e) => e.TECH === 'VL') ) .flat() .map((value) => value.SKU); if (eligibleSelIDProperties.gifts.length > 1) { $('#GWPICAProgressBarImage').html( `Infiniment Double Espresso LE Vertuo Pods (5)` ); } else { $('#GWPICAProgressBarImage').html( `Infiniment Double Espresso LE Vertuo Pods (6)` ); } executeCapsulesCount(); window.napi.data().on( 'cart.*', function () { executeCapsulesCount(); }, 100 ); $('#activationStickyBanner').fadeIn(); } function executeCapsulesCount() { let capsOL = 0; let capsVL = 0; Promise.resolve( napi.cart().read({ forceFull: true, expandProducts: true }) ).then(function (cartResponse) { customerCart = cartResponse.cartLines; customerCart.forEach((object) => { if ( capsuleOLSKUInPromo.indexOf( object.id.replace('erp.it.b2c/prod/', '') ) !== -1 && object.type === 'capsule' ) { capsOL += object.bundled ? object.unitQuantity : object.quantity; } if ( capsuleVLSKUInPromo.indexOf( object.id.replace('erp.it.b2c/prod/', '') ) !== -1 && object.type === 'capsule' ) { capsVL += object.bundled ? object.unitQuantity : object.quantity; } }); let customerSelectedOL = false; totalCapsulesOnCart = 0; if (eligibleSelIDProperties.canMixCapsulesTech) { totalCapsulesOnCart = capsOL + capsVL; } else { if (capsVL >= capsOL) { totalCapsulesOnCart = capsVL; } else { totalCapsulesOnCart = capsOL; customerSelectedOL = true; } } let capsulesNextLimit = eligibleSelIDProperties.capsulesRequired !== 0 ? eligibleSelIDProperties.capsulesRequired : eligibleSelIDProperties.gifts.at(-1).capsulesRequired; if (totalCapsulesOnCart === 0) { if (eligibleSelIDProperties.canChooseGift) { if (eligibleSelIDProperties.gifts.length === 1) { $('#GWPICAProgressBarText').html( `${username},
aggiungi ${eligibleSelIDProperties.capsulesRequired} capsule per ricevere ${eligibleSelIDProperties.gifts[0].name}!` ); $('#GWPICAProgressBarCTA').html( `

AGGIUNGI REGALO E ACCESSORIO

` ); } else { if (eligibleSelIDProperties.capsulesRequired !== 0) { $('#GWPICAProgressBarText').html( `${username},
aggiungi ${eligibleSelIDProperties.capsulesRequired} capsule per scegliere il tuo regalo e il tuo accessorio preferito!` ); $('#GWPICAProgressBarCTA').html( `

SCEGLI REGALO E ACCESSORIO

` ); } else { $('#GWPICAProgressBarText').html( `${username},
aggiungi ${eligibleSelIDProperties.gifts[0].capsulesRequired} capsule per scegliere il tuo regalo e il tuo accessorio preferito!` ); $('#GWPICAProgressBarCTA').html( `

SCEGLI REGALO E ACCESSORIO

` ); } } } else { $('#GWPICAProgressBarText').html( `${username},
aggiungi ${eligibleSelIDProperties.capsulesRequired} capsule per avere il tuo regalo e il tuo accessorio preferito!` ); $('#GWPICAProgressBarCTA').html( `

CHECKOUT

` ); } if (!eligibleSelIDProperties.isClubActionDriven) { if ( eligibleSelIDProperties.selID.indexOf('') !== -1 && eligibleSelIDProperties.capsulesRequired !== 0 ) { executeNoCANoSelIDUseCase(customerSelectedOL, false); } if (eligibleSelIDProperties.canChooseGift) { let allGiftableSKU = eligibleSelIDProperties.gifts.map( (element) => element.sku ); let allInCartSKU = customerCart.map((element) => element.id.replace('erp.it.b2c/prod/', '') ); let filteredSKUArray = allGiftableSKU.filter(function (n) { return allInCartSKU.indexOf(n) !== -1; }); let allCrosselableSKU = crossellGift.map( (element) => element.sku ); let filteredCrosselableSKUArray = allCrosselableSKU.filter( function (n) { return allInCartSKU.indexOf(n) !== -1; } ); if (filteredSKUArray.length !== 0) { if (filteredCrosselableSKUArray.length === 0) { Promise.resolve( CartManager.updateItem(filteredSKUArray[0], 0) ); } else { Promise.resolve( CartManager.updateItem(filteredSKUArray[0], 0).then( (e) => { setTimeout(() => { $.post( CartManager.updateItem( filteredCrosselableSKUArray[0], 0 ) ); }, 1000); } ) ); } } } } } else if (totalCapsulesOnCart < capsulesNextLimit) { let progressBarGifts = ''; eligibleSelIDProperties.gifts .slice() //.reverse() .forEach((gift, index) => { progressBarGifts += `

${ gift.capsulesRequired } Infiniment Double Espresso LE Vertuo Pods (7)

`; }); if (eligibleSelIDProperties.canChooseGift) { if (eligibleSelIDProperties.gifts.length === 1) { $('#GWPICAProgressBarText').html( `${username},
aggiungi altre ${ eligibleSelIDProperties.capsulesRequired - totalCapsulesOnCart } capsule per ricevere ${ eligibleSelIDProperties.gifts[0].name }!

${totalCapsulesOnCart}

` ); $('#GWPICAProgressBarCTA').html( `

AGGIUNGI REGALO E ACCESSORIO

` ); } else { if (eligibleSelIDProperties.capsulesRequired !== 0) { $('#GWPICAProgressBarText').html( `${username},
aggiungi altre ${ eligibleSelIDProperties.capsulesRequired - totalCapsulesOnCart } capsule per scegliere il tuo regalo e il tuo accessorio preferito!

${totalCapsulesOnCart}

` ); $('#GWPICAProgressBarCTA').html( `

SCEGLI REGALO E ACCESSORIO

` ); } else { if ( totalCapsulesOnCart < eligibleSelIDProperties.gifts[0].capsulesRequired ) { $('#GWPICAProgressBarText').html( `${username}, raggiungi la soglia capsule per avere il tuo regalo e il tuo accessorio preferito!

${progressBarGifts}

` ); $('#GWPICAProgressBarCTA').html( `

AGGIUNGI REGALO E ACCESSORIO

` ); } else { let allGiftableSKU = eligibleSelIDProperties.gifts.map( (element) => element.sku ); let allInCartSKU = customerCart.map((element) => element.id.replace('erp.it.b2c/prod/', '') ); let filteredSKUArray = allGiftableSKU.filter(function ( n ) { return allInCartSKU.indexOf(n) !== -1; }); if (filteredSKUArray.length === 0) { $('#GWPICAProgressBarText').html( `${username}, raggiungi la soglia capsule per avere il tuo regalo e il tuo accessorio preferito!

${progressBarGifts}

${totalCapsulesOnCart}

` ); $('#GWPICAProgressBarCTA').html( `

AGGIUNGI REGALO E ACCESSORIO

` ); } else { $('#GWPICAProgressBarText').html( `${username}, raggiungi la soglia capsule per avere il tuo regalo e il tuo accessorio preferito!

${progressBarGifts}

${totalCapsulesOnCart}

` ); $('#GWPICAProgressBarCTA').html( `

CAMBIA REGALO E ACCESSORIO

` ); } } } } let targetPercentage = (100 * totalCapsulesOnCart) / capsulesNextLimit; document.querySelector( '.progress-bar-striped > div' ).style.width = targetPercentage + '%'; } else { $('#GWPICAProgressBarText').html( `${username},
aggiungi altre ${ eligibleSelIDProperties.capsulesRequired - totalCapsulesOnCart } capsule per avere il tuo regalo e il tuo accessorio preferito!` ); $('#GWPICAProgressBarCTA').html( `

CHECKOUT

` ); } if (!eligibleSelIDProperties.isClubActionDriven) { if ( eligibleSelIDProperties.selID.indexOf('') !== -1 && eligibleSelIDProperties.capsulesRequired !== 0 ) { executeNoCANoSelIDUseCase(customerSelectedOL, false); } if (eligibleSelIDProperties.canChooseGift) { let allGiftableSKU = eligibleSelIDProperties.gifts .filter(function (n) { return n.capsulesRequired > totalCapsulesOnCart; }) .map((element) => element.sku); let allInCartSKU = customerCart.map((element) => element.id.replace('erp.it.b2c/prod/', '') ); let filteredSKUArray = allGiftableSKU.filter(function (n) { return allInCartSKU.indexOf(n) !== -1; }); let allCrosselableSKU = crossellGift.map( (element) => element.sku ); let filteredCrosselableSKUArray = allCrosselableSKU.filter( function (n) { return allInCartSKU.indexOf(n) !== -1; } ); if (filteredSKUArray.length !== 0) { if (filteredCrosselableSKUArray.length === 0) { Promise.resolve( CartManager.updateItem(filteredSKUArray[0], 0) ); } else { Promise.resolve( CartManager.updateItem(filteredSKUArray[0], 0).then( (e) => { setTimeout(() => { $.post( CartManager.updateItem( filteredCrosselableSKUArray[0], 0 ) ); }, 1000); } ) ); } } } } } else { if (eligibleSelIDProperties.canChooseGift) { eligibleSelIDProperties = eligibleSelIDProperties; let allGiftableSKU = eligibleSelIDProperties.gifts.map( (element) => element.sku ); let allInCartSKU = customerCart.map((element) => element.id.replace('erp.it.b2c/prod/', '') ); let filteredSKUArray = allGiftableSKU.filter(function (n) { return allInCartSKU.indexOf(n) !== -1; }); let allCrosselableSKU = crossellGift.map( (element) => element.sku ); let filteredCrosselableSKUArray = allCrosselableSKU.filter( function (n) { return allInCartSKU.indexOf(n) !== -1; } ); if (filteredSKUArray.length > 0) { if (filteredSKUArray.length > 1) { if (filteredCrosselableSKUArray.length === 0) { Promise.resolve( CartManager.updateItem(filteredSKUArray[0], 0) ); } else { Promise.resolve( CartManager.updateItem(filteredSKUArray[0], 0).then( (e) => { setTimeout(() => { $.post( CartManager.updateItem( filteredCrosselableSKUArray[0], 0 ) ); }, 1000); } ) ); } } setChangeGiftButton(filteredSKUArray[0]); } else { if (eligibleSelIDProperties.gifts.length === 1) { $('#GWPICAProgressBarText').html( `COMPLIMENTI ${username}!
Hai raggiunto il numero di capsule necessario per ricevere ${eligibleSelIDProperties.gifts[0].name}!` ); $('#GWPICAProgressBarCTA').html( `

AGGIUNGI REGALO E ACCESSORIO

` ); } else { if (eligibleSelIDProperties.capsulesRequired !== 0) { $('#GWPICAProgressBarText').html( `COMPLIMENTI ${username}!
Hai raggiunto il numero di capsule necessario per scegliere il tuo regalo e il tuo accessorio preferito!` ); $('#GWPICAProgressBarCTA').html( `

SCEGLI REGALO E ACCESSORIO

` ); } else { $('#GWPICAProgressBarText').html( `COMPLIMENTI ${username}!
Hai raggiunto il numero di capsule necessario per scegliere il tuo regalo e il tuo accessorio preferito!` ); $('#GWPICAProgressBarCTA').html( `

SCEGLI REGALO E ACCESSORIO

` ); } } if (window.location.href.indexOf('checkout') !== -1) { openGiftSelectorPopup(); } } } else { $('#GWPICAProgressBarText').html( `COMPLIMENTI ${username}!
Hai raggiunto il numero di capsule necessario per avere il tuo regalo e il tuo accessorio preferito!` ); $('#GWPICAProgressBarCTA').html( `

CHECKOUT

` ); } if (!eligibleSelIDProperties.isClubActionDriven) { if ( eligibleSelIDProperties.selID.indexOf('') !== -1 && !prospectAlreadyHadGift && eligibleSelIDProperties.capsulesRequired !== 0 ) { executeNoCANoSelIDUseCase(customerSelectedOL, true); } } } }); } function executeNoCANoSelIDUseCase(customerSelectedOL, positiveQuantity) { let techSelectedByCustomer = customerSelectedOL ? 'original' : 'vertuo'; let customerGiftBySelectedCapsulesTech = eligibleSelIDProperties.gifts.find( (element) => element.tech === techSelectedByCustomer ); if (positiveQuantity) { setChangeGiftButton(customerGiftBySelectedCapsulesTech.sku); CartManager.updateItem( customerGiftBySelectedCapsulesTech.sku, customerGiftBySelectedCapsulesTech.quantity ); prospectAlreadyHadGift = true; } else { Promise.resolve( CartManager.updateItem(customerGiftBySelectedCapsulesTech.sku, 0) ); prospectAlreadyHadGift = false; } } function setChangeGiftButton(sku) { if (eligibleSelIDProperties.capsulesRequired !== 0) { $('#GWPICAProgressBarText').html( `COMPLIMENTI ${username}!,
Hai raggiunto il numero di capsule necessario per scegliere il tuo regalo e il tuo accessorio preferito!` ); $('#GWPICAProgressBarCTA').html( `

CAMBIA REGALO E ACCESSORIO

` ); } else { if (eligibleSelIDProperties.gifts.at(-1).sku === sku) { $('#GWPICAProgressBarText').html( `COMPLIMENTI ${username}!,
Hai raggiunto il numero di capsule necessario per scegliere il tuo regalo e il tuo accessorio preferito!` ); $('#GWPICAProgressBarCTA').html( `

CAMBIA REGALO E ACCESSORIO

` ); } else { let progressBarGifts = ''; eligibleSelIDProperties.gifts .slice() //.reverse() .forEach((gift, index) => { progressBarGifts += `

${ gift.capsulesRequired } Infiniment Double Espresso LE Vertuo Pods (8)

`; }); if ( totalCapsulesOnCart < eligibleSelIDProperties.gifts[0].capsulesRequired ) { $('#GWPICAProgressBarText').html( `${username}, raggiungi la soglia capsule per avere il tuo regalo e il tuo accessorio preferito!

${progressBarGifts}

${totalCapsulesOnCart}

` ); $('#GWPICAProgressBarCTA').html( `

AGGIUNGI REGALO E ACCESSORIO

` ); } else { $('#GWPICAProgressBarText').html( `${username}, raggiungi la soglia capsule per avere il tuo regalo e il tuo accessorio preferito!

${progressBarGifts}

${totalCapsulesOnCart}

` ); $('#GWPICAProgressBarCTA').html( `

CAMBIA REGALO E ACCESSORIO

` ); } let targetPercentage = (100 * totalCapsulesOnCart) / eligibleSelIDProperties.gifts.at(-1).capsulesRequired; document.querySelector('.progress-bar-striped > div').style.width = targetPercentage + '%'; } } } function changeGift(sku) { $('.GWPICA-progressBar-success').text('...'); let allInCartSKU = customerCart.map((element) => element.id.replace('erp.it.b2c/prod/', '') ); let allCrosselableSKU = crossellGift.map((element) => element.sku); let filteredCrosselableSKUArray = allCrosselableSKU.filter(function (n) { return allInCartSKU.indexOf(n) !== -1; }); if (filteredCrosselableSKUArray.length === 0) { Promise.resolve(CartManager.updateItem(sku, 0)).then(function () { openGiftSelectorPopup(totalCapsulesOnCart); }); } else { Promise.resolve( CartManager.updateItem(sku, 0).then((e) => { setTimeout(() => { $.post( CartManager.updateItem(filteredCrosselableSKUArray[0], 0) ); openGiftSelectorPopup(totalCapsulesOnCart); }, 1000); }) ); } } function addGiftToCart(sku, quantity) { if (sku !== 'none' && quantity !== 0) { $('#addGiftCTA-' + sku).text('...'); Promise.resolve(CartManager.updateItem(sku, quantity)).then( function () { $('#addGiftCTA-' + sku).text('AGGIUNGI'); setChangeGiftButton(sku); closeGiftSelectorPopup(); openCrossellSelectorPopup(); } ); } else { closeGiftSelectorPopup(); } gtmDataObject.push({ event: 'promoClick', ecommerce: { promoClick: { promotions: [ { creative: 'IT_coffeePLP_activationPromoBanner', id: trackingIDGWPICA + '-' + sku, name: trackingIDGWPICA + ' ' + sku, position: 'IT_nespresso_coffeePLP', }, ], }, }, }); } function addCrossellToCart(sku) { if (sku !== 'none') { $('#addCrossellCTA-' + sku).text('...'); Promise.resolve(CartManager.updateItem(sku, 1)).then(function () { $('#addCrossellCTA-' + sku).text('AGGIUNGI'); closeCrossellSelectorPopup(); }); } else { closeCrossellSelectorPopup(); } gtmDataObject.push({ event: 'promoClick', ecommerce: { promoClick: { promotions: [ { creative: 'IT_coffeePLP_activationPromoBanner', id: trackingIDGWPICA + '-' + sku, name: trackingIDGWPICA + ' ' + sku, position: 'IT_nespresso_coffeePLP', }, ], }, }, }); } function openGiftSelectorPopup(capsulesQuantityOnCart) { $('#nnes-statement-list').html(''); if (eligibleSelIDProperties.gifts.length === 1) { $('#nnes-statement-title').text('AGGIUNGI IL TUO OMAGGIO'); $('#nnes-statement-subtitle').text('Seleziona il tuo regalo:'); } eligibleSelIDProperties.gifts.forEach((selectedGift, index) => { if (capsulesQuantityOnCart === undefined) { document.getElementById('nnes-statement-list').insertAdjacentHTML( 'afterbegin', `

Infiniment Double Espresso LE Vertuo Pods (9)

${selectedGift.name} ${selectedGift.description}

AGGIUNGI

` ); } else { let addToCartGift = ''; if (capsulesQuantityOnCart >= selectedGift.capsulesRequired) { addToCartGift = `

AGGIUNGI

`; } else { addToCartGift = `

DISPONIBILE CON ${selectedGift.capsulesRequired} CAPSULE

`; } document.getElementById('nnes-statement-list').insertAdjacentHTML( 'beforeend', `

Infiniment Double Espresso LE Vertuo Pods (10)

${selectedGift.name} ${selectedGift.description}

${addToCartGift}

` ); } }); setTimeout(() => { $('#giftedCapsuleSelector-popup').fadeIn(250); $('html').addClass('disableScroll'); }, 2000); } function openCrossellSelectorPopup() { $('#nnes-statement-list-crossell').html(''); crossellGift.forEach((selectedCrossell, index) => { let crossellAddToCartElement = selectedCrossell.oos ? `ESAURITO` : `

ACQUISTA A ${selectedCrossell.price}

`; document .getElementById('nnes-statement-list-crossell') .insertAdjacentHTML( 'afterbegin', `

Infiniment Double Espresso LE Vertuo Pods (11)

${selectedCrossell.name} ${selectedCrossell.description}

${crossellAddToCartElement}

` ); }); setTimeout(() => { $('#crossellSelector-popup').fadeIn(50); $('html').addClass('disableScroll'); }, 1000); } function closeGiftSelectorPopup() { $('#giftedCapsuleSelector-popup').fadeOut(250); $('html').removeClass('disableScroll'); } function closeCrossellSelectorPopup() { $('#crossellSelector-popup').fadeOut(250); $('html').removeClass('disableScroll'); }`; document .querySelector( 'nb-pdp-detailed-description > nb-detailed-description > nb-container > section > div.cb-inner > div.cb-header' ) .insertAdjacentHTML('beforeend', htmlCamaleonte); if ( document.querySelector( 'nb-sku-main-info > nb-container > section > div.cb-inner > div.cb-col2 > nb-sku-coffee > div > h1' ) !== null ) { document .querySelector( 'nb-sku-main-info > nb-container > section > div.cb-inner > div.cb-col2 > nb-sku-coffee > div > h1' ) .insertAdjacentHTML( 'beforeend', `Infiniment Double Espresso LE Vertuo Pods (12)` ); } else { document .querySelector( 'nb-pdp > nb-pdp-header > nb-container > section > div.cb-inner > div.cb-col2 > nb-plp-product-card > div > h1' ) .insertAdjacentHTML( 'beforeend', `Infiniment Double Espresso LE Vertuo Pods (13)` ); } clearInterval(checkAppendElementExists); } }, 100); } }); });
Infiniment Double Espresso LE Vertuo Pods (2024)
Top Articles
Latest Posts
Article information

Author: Clemencia Bogisich Ret

Last Updated:

Views: 5982

Rating: 5 / 5 (80 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Clemencia Bogisich Ret

Birthday: 2001-07-17

Address: Suite 794 53887 Geri Spring, West Cristentown, KY 54855

Phone: +5934435460663

Job: Central Hospitality Director

Hobby: Yoga, Electronics, Rafting, Lockpicking, Inline skating, Puzzles, scrapbook

Introduction: My name is Clemencia Bogisich Ret, I am a super, outstanding, graceful, friendly, vast, comfortable, agreeable person who loves writing and wants to share my knowledge and understanding with you.