'); // Append Helper Tooltip } idleTime = idleTime + 1; //console.log(idleTime); let pagePos = getPosition(whereAreU); // Reset timer if click on add-to-cart button $('#add-to-cart').click(function() { idleTime = 0; }); if (idleTime == timerJson[pagePos].startTimer && !$('#helper').is(":visible") && viewChat === 'false') { let startHelper = true; if($('.minicart-quantity').is(':visible') == false && pagePos == "cart"){ startHelper = false; } if(startHelper) { initHelper(pagePos); //console.log('--- Start: initHelper() ---'); } } if (idleTime == timerJson[pagePos].endTimer) { idleTime = 0; clearInterval(idleInterval); $('.embeddedServiceHelpButton .tooltip').removeClass('slideInUp').addClass('slideOutDown'); setTimeout(function() { $('.embeddedServiceHelpButton .tooltip').css('cssText','display: none'); }, 2000); } } }; $('head').append(style); // Append style node to the DOM $('head').append(animate); // Append animation node to the DOM setTimeout(function() { if($('a.iubenda-cs-close-btn')[0]) { // Check if privacy banner is visible $('a.iubenda-cs-close-btn').on('click', function() { setTimer(); }); } else { setTimer(); } }, 4000); // Hide Helper Plugin on click of the Live Agent Chat $('button.helpButtonEnabled.uiButton').on('click', function() { if (sessionStorage.getItem('viewChat') === 'false') { sessionStorage.setItem('viewChat', true); viewChat = true; } setTimeout(function() { $('button.closeButton.headerItem').click(function() { $('.embeddedServiceHelpButton .tooltip').css('cssText','display: none !important;'); }); }, 5000); }); $(document).on('click', 'span.tooltiptext', function() { $('button.helpButtonEnabled.uiButton').trigger('click'); }); $(document).on('click', 'span.livechat-emitter', function() { $('button.helpButtonEnabled.uiButton').trigger('click'); });var firstName = '';var lastName = '';var email = '';var form = '';$(document).on('click', 'button.helpButtonEnabled.uiButton', function () {//UPD 26.04.2023 Aggiunto frammento tulip-livechat per comunicare servizioswitch (lang) { case 'it': var html_shopAss = '
Chatta o videochiama uno dei nostri In Store Personal Shopper e lasciati consigliare come se fossi in negozio
oppure
per altre richieste compila il form per chattare con il Customer Service
'; var html_shopAss_cs = '
Compila il form per chattare con il Customer Service
'; break; case 'fr': var html_shopAss = '
Cliquez sur Personal Shopper pour une nouvelle expérience d’achat numérique
ou
pour d\'autres requêtes, remplissez le formulaire pour dialoguer avec le service clientèle
'; var html_shopAss_cs = '
Remplissez le formulaire pour dialoguer avec le service clientèle
'; break; case 'de': var html_shopAss = '
Klicken Sie auf Personal Shopper für ein neues digitales Einkaufserlebnis
oder
Für andere Anfragen füllen Sie bitte das Formular aus, um mit dem Kundendienst kontaktiert zu chatten
'; var html_shopAss_cs = '
Sie bitte das Formular aus, um mit dem Kundendienst zu chatten
'; break; case 'es': var html_shopAss = '
Haz clic en Personal Shopper para una nueva experiencia de compra digital
o
para cualquier otra solicitud, rellene el formulario para chatear con el servicio de atención al cliente
'; var html_shopAss_cs = '
Rellene el formulario para chatear con el servicio de atención al cliente
' break; default: var html_shopAss = '
Click on Personal Shopper for a new digital shopping experience
or
for other requests fill out the form to chat with the Customer Service
'; var html_shopAss_cs = '
Fill out the form to chat with the Customer Service
'; break; } dataLayer.push({ event: 'openChat' }); var checkExist = setInterval(function () { if ($('.formContent.embeddedServiceSidebarForm').length) { form = $('.formContent.embeddedServiceSidebarForm').html();//UPD 26.04.2023 Aggiunto frammento tulip-livechat per comunicare serviziovar controllo = document.getElementsByClassName( "live-chat-header" );if(controllo.length > 0){//the flag was not found, so the code has not run$('.formContent > div').prepend(html_shopAss);}else{$('.formContent > div').prepend(html_shopAss_cs);} $('#FirstName').on('input', function () { firstName = $(this).val(); }); $('#LastName').on('input', function () { lastName = $(this).val(); }); $('#Email').on('input', function () { email = $(this).val(); }); clearInterval(checkExist); } }, 100);});$(document).on("click", "button.startButton", function () { console.log(firstName); console.log(lastName); console.log(email); if (firstName && lastName && email && _iub && _iub.cons_instructions) { _iub.cons_instructions.push([ "submit", { consent: { subject: { id: email, email: email, first_name: firstName, last_name: lastName }, preferences: { privacy_policy: true, }, legal_notices: [ { identifier: "privacy_policy", }, { identifier: "cookie_policy", } ], proofs: [ { content: JSON.stringify({ first_name: firstName, last_name: lastName, email: email }), form: form } ] } }, { success: function (response) { console.log(response); }, error: function (response) { console.log(response); } } ]); }}); $('.mini-cart').click(function() { $('.embeddedServiceHelpButton .tooltip').css('cssText','display: none'); }); if ($('.pdp-main').length) { var $mobileStickyPanel = $('.mobile-sticky-panel'); if ($mobileStickyPanel.is(':visible')) { var offset = $mobileStickyPanel.outerHeight(); var productNameHeight = $('.mobile-sticky-panel .product-name').outerHeight(); waitForElement('.helpButtonEnabled.uiButton', function () { var $buttonElement = $('.helpButtonEnabled.uiButton'); var buttonHeight = $buttonElement.outerHeight(); $buttonElement.css({'bottom': (offset - (buttonHeight * 1.55) - productNameHeight) + 'px', 'right': '-8px'}); }); waitForElement('.tooltip.animated', function () { var $tooltipElement = $('.tooltip.animated'); $tooltipElement.css('bottom', offset + 'px'); }); } } /** Waiting funtions for div element */ function waitForElement(elementPath, callBack) { window.setTimeout(function () { if ($(elementPath).length) { callBack(elementPath, $(elementPath)); } else { waitForElement(elementPath, callBack); } }, 500) }});Array.prototype.slice.call(document.querySelectorAll('.live-chat, .live-chat-pdp, .live-chat-pdp_geolocation-msg')).forEach(function(el) {el.classList.remove('hide');});