vendor: 3,595 bytes, lines 1-88
1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // define getter function for harmony exports 37/******/ __webpack_require__.d = function(exports, name, getter) { 38/******/ if(!__webpack_require__.o(exports, name)) { 39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40/******/ } 41/******/ }; 42/******/ 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = function(exports) { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ 51/******/ // create a fake namespace object 52/******/ // mode & 1: value is a module id, require it 53/******/ // mode & 2: merge all properties of value into the ns 54/******/ // mode & 4: return value when already ns object 55/******/ // mode & 8|1: behave like require 56/******/ __webpack_require__.t = function(value, mode) { 57/******/ if(mode & 1) value = __webpack_require__(value); 58/******/ if(mode & 8) return value; 59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60/******/ var ns = Object.create(null); 61/******/ __webpack_require__.r(ns); 62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64/******/ return ns; 65/******/ }; 66/******/ 67/******/ // getDefaultExport function for compatibility with non-harmony modules 68/******/ __webpack_require__.n = function(module) { 69/******/ var getter = module && module.__esModule ? 70/******/ function getDefault() { return module['default']; } : 71/******/ function getModuleExports() { return module; }; 72/******/ __webpack_require__.d(getter, 'a', getter); 73/******/ return getter; 74/******/ }; 75/******/ 76/******/ // Object.prototype.hasOwnProperty.call 77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78/******/ 79/******/ // __webpack_public_path__ 80/******/ __webpack_require__.p = "/"; 81/******/ 82/******/ 83/******/ // Load entry module and return exports 84/******/ return __webpack_require__(__webpack_require__.s = 0); 85/******/ }) 86/************************************************************************/ 87/******/ ({ 88
89/***/ "./js/src/parts/button.js": 90/*!********************************!*\ 91 !*** ./js/src/parts/button.js ***! 92 \********************************/ 93/*! no static exports found */ 94/***/ (function(module, exports) { 95 96/** 97 * ===================================================== 98 * button.js 99 * ===================================================== 100 * 101 * Progetto: Ventura Shop 102 * Tipo: Satellite JS 103 * Dipendenza: main.js (namespace globale "ventura") 104 * 105 * Descrizione: 106 * Questo file risolve il conflitto del "doppio click" sui 107 * dispositivi mobili (in particolare iOS/Safari) causato 108 * da script di terze parti (es. Cloudflare Turnstile) e 109 * dalla gestione degli stati di hover del browser. 110 * Intercettando l'evento 'touchstart', il codice bypassa 111 * i ritardi di WebKit forzando il 'click' immediato sui 112 * pulsanti critici (come l'aggiunta al carrello e altri 113 * bottoni definiti), rendendo l'interazione istantanea. 114 * 115 * Note: 116 * - Non dipendere da altri satelliti, solo da main.js 117 * - Il caricamento condizionale avviene tramite la 118 * variabile globale `isTemplate` passata da PHP 119 * tramite WP_PARAMS.is_page_template. 120 * - Tutte le funzioni dovrebbero essere incapsulate 121 * all'interno di ventura o di closure locali. 122 * 123 * Esempio di utilizzo: 124 * ventura.checkoutInit(); 125 * 126 * ===================================================== 127 */ 128var ventura = window.ventura; 129window.isTemplate = window.WP_PARAMS ? window.WP_PARAMS.is_page_template : null; 130(function ($) { 131 ventura.disableButtonHoverMobile = function () { 132 $('.single_add_to_cart_button').on('touchstart', function (e) { 133 $(this).trigger('click'); 134 }); 135 }; 136 ventura.disableGenericHoverMobile = function () { 137 $('a, button:not(.single_add_to_cart_button), .btn:not(.single_add_to_cart_button)').on('touchstart', function (e) { 138 $(this).trigger('click'); 139 }); 140 }; 141 ventura.addToCartFeedback = function () { 142 $('.single_add_to_cart_button').on('click', function () { 143 $(this).addClass('loading'); 144 }); 145 $(document.body).on('wc_cart_button_updated', function (e, $btn) { 146 $btn.removeClass('loading'); 147 }); 148 }; 149 $(document).on('venturaReady', function () { 150 ventura.disableButtonHoverMobile(); 151 ventura.disableGenericHoverMobile(); 152 ventura.addToCartFeedback(); 153 window.addEventListener('resize', function () { 154 ventura.disableButtonHoverMobile(); 155 ventura.disableGenericHoverMobile(); 156 }); 157 }); 158})(jQuery); 159 160/***/ }), 161
162/***/ "./js/src/parts/checkout/checkout.js": 163/*!*******************************************!*\ 164 !*** ./js/src/parts/checkout/checkout.js ***! 165 \*******************************************/ 166/*! no static exports found */ 167/***/ (function(module, exports) { 168 169/** 170 * ===================================================== 171 * checkout.js 172 * ===================================================== 173 * 174 * Progetto: Ventura Shop 175 * Tipo: Satellite JS 176 * Dipendenza: main.js (namespace globale "ventura") 177 * 178 * Descrizione: 179 * Questo file contiene tutte le logiche JS specifiche 180 * per la pagina checkout. Si integra con il namespace 181 * globale "ventura" definito in main.js. 182 * 183 * Note: 184 * - Non dipendere da altri satelliti, solo da main.js 185 * - Il caricamento condizionale avviene tramite la 186 * variabile globale `isTemplate` passata da PHP 187 * tramite WP_PARAMS.is_page_template. 188 * - Tutte le funzioni dovrebbero essere incapsulate 189 * all'interno di ventura o di closure locali. 190 * 191 * Esempio di utilizzo: 192 * ventura.checkoutInit(); 193 * 194 * ===================================================== 195 */ 196var ventura = window.ventura; 197window.isTemplate = window.WP_PARAMS ? window.WP_PARAMS.is_page_template : null; 198(function ($) { 199 if (isTemplate !== 'templ-checkout.php') return; 200 ventura.openListProductsCheckout = function () { 201 $(document).on("click", ".product-total-toggle", function () { 202 $(".product-total-list").toggleClass('product-total-list--open'); 203 }); 204 }; 205 206 // Document ready per satellite 207 $(document).on('venturaReady', function () { 208 ventura.openListProductsCheckout(); 209 }); 210})(jQuery); 211 212/***/ }), 213
214/***/ "./js/src/parts/checkout/form-checkout.js": 215/*!************************************************!*\ 216 !*** ./js/src/parts/checkout/form-checkout.js ***! 217 \************************************************/ 218/*! no static exports found */ 219/***/ (function(module, exports) { 220 221/** 222 * ===================================================== 223 * form-checkout.js 224 * ===================================================== 225 * 226 * Progetto: Ventura Shop 227 * Tipo: Satellite JS 228 * Dipendenza: main.js (namespace globale "ventura") 229 * 230 * Descrizione: 231 * Questo file contiene tutte le logiche JS specifiche 232 * per la pagina Checkout. Si integra con il namespace 233 * globale "ventura" definito in main.js. 234 * 235 * Note: 236 * - Non dipendere da altri satelliti, solo da main.js 237 * - Il caricamento condizionale avviene tramite la 238 * variabile globale `isTemplate` passata da PHP 239 * tramite WP_PARAMS.is_page_template. 240 * - Tutte le funzioni dovrebbero essere incapsulate 241 * all'interno di ventura o di closure locali. 242 * 243 * Esempio di utilizzo: 244 * ventura.cartInit(); 245 * 246 * ===================================================== 247 */ 248var ventura = window.ventura; 249window.isTemplate = window.WP_PARAMS ? window.WP_PARAMS.is_page_template : null; 250(function ($) { 251 if (typeof isTemplate === 'undefined' || isTemplate !== 'templ-checkout.php') return; 252 ventura.FormCheckout = { 253 /** 254 * Gestisce la validazione della lunghezza e i contatori visivi. 255 */ 256 limitFields: { 257 config: [{ 258 'billing_first_name_field': 17 259 }, { 260 'billing_last_name_field': 18 261 }, { 262 'billing_address_1_field': 32 263 }, { 264 'billing_address_2_field': 8 265 }, { 266 'billing_city_field': 30 267 }, { 268 'shipping_city_field': 30 269 }, { 270 'shipping_first_name_field': 17 271 }, { 272 'shipping_last_name_field': 18 273 }, { 274 'shipping_address_1_field': 32 275 }, { 276 'shipping_address_2_field': 8 277 }, { 278 'billing_company_field': 32 279 }, { 280 'shipping_company_field': 32 281 }], 282 init: function init() { 283 var $context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $(document); 284 var self = this; 285 $.each(this.config, function () { 286 $.each(this, function (id, maxLength) { 287 var $row = $('#' + id); 288 var $input = $row.find('input'); 289 if ($input.length === 0) return; 290 291 // Reset e Setup attributi 292 $input.removeAttr('maxlength autocomplete').attr('maxlength', maxLength).attr('data-length', true); 293 self._renderCounter($row, $input, maxLength); 294 295 // Listener evento 296 $input.off('keyup').on('keyup', function () { 297 self._renderCounter($row, $(this), maxLength); 298 }); 299 }); 300 }); 301 }, 302 // Aggiornare il contatore e l'errore 303 _renderCounter: function _renderCounter($row, $input, maxLength) { 304 var $counter = $row.find('.input-counter'); 305 if ($counter.length === 0) { 306 $counter = $('<span class="input-counter"></span>').appendTo($row); 307 } 308 var remaining = maxLength - $input.val().length; 309 if (remaining < 0) { 310 $counter.addClass('input-counter-error').html('testo troppo lungo'); 311 $row.addClass('woocommerce-invalid-character-length'); 312 } else { 313 $counter.removeClass('input-counter-error').html("".concat(remaining, " caratteri rimanenti")); 314 $row.removeClass('woocommerce-invalid-character-length'); 315 } 316 } 317 }, 318 /** 319 * Gestisce la visibilità dei campi B2B e comportamenti correlati. 320 */ 321 typeSwitcher: { 322 init: function init() { 323 var self = this; 324 var $container = $(document.body); 325 var updateUI = function updateUI() { 326 var isAzienda = $('.checkbox-azienda input:checked').val() === 'azienda';
327 isAzienda ? self._applyAzienda() : self._applyPrivato(); 328 }; 329 updateUI(); 330 $container.on('change', '.checkbox-azienda input', updateUI); 331 $container.on('updated_checkout', updateUI); 332 }, 333 _applyAzienda: function _applyAzienda() { 334 $('.woocommerce-form-coupon-toggle, .create-account').hide(); 335 $('.js-tipo-azienda').show(); 336 $('.create-account input').prop('checked', true); 337 if (!$(document.body).hasClass('logged-in')) { 338 var msg = "Dopo l'acquisto, verrà inviata una password al tuo indirizzo e-mail per accedere al tuo account."; 339 if ($('.b2b-create-account').length === 0) { 340 $('#billing_privacy_field').before("<p class=\"form-row wide b2b-create-account\">".concat(msg, "</p>")); 341 } else { 342 $('.b2b-create-account').show(); 343 } 344 } 345 346 // Forza la spunta su "Crea account" 347 var $createAccCheckbox = $('.create-account input[type="checkbox"]'); 348 if ($createAccCheckbox.length) { 349 $createAccCheckbox.prop('checked', true).trigger('change'); 350 } 351 352 // Nasconde coupon (opzionale, se richiesto dal business) 353 $('.woocommerce-form-coupon-toggle').hide(); 354 }, 355 _applyPrivato: function _applyPrivato() { 356 $('.create-account, .woocommerce-form-coupon-toggle').show(); 357 $('.js-tipo-azienda, .b2b-create-account').hide(); 358 // Reset campi B2B 359 $('input[name="billing_pec"], input[name="billing_vat_number"], input[name="billing_company"], input[name="billing_codice_fiscale"]').val(''); 360 } 361 }, 362 /** 363 * Mappa il campo "fake" sul modulo coupon originale di WooCommerce 364 */ 365 coupons: { 366 init: function init() { 367 $(document).on('click', 'button[name="fake_apply_coupon"]', function (e) { 368 e.preventDefault(); 369 e.stopImmediatePropagation(); 370 var value = $('input#fake_coupon_code').val().trim().toUpperCase(); 371 var $realForm = $('form.woocommerce-form-coupon'); 372 373 // Validazione: PARTITAIVA15 solo per clienti B2B 374 // Verifica se il checkout è presente (se no, la validazione avverrà lato server) 375 if (value === 'PARTITAIVA15') { 376 var $checkbox = $('.checkbox-azienda input:checked'); 377 378 // Se il selector esiste (siamo al checkout), verifichiamo il valore 379 if ($checkbox.length > 0) { 380 var isB2B = $checkbox.val() === 'azienda'; 381 if (!isB2B) { 382 alert('Il coupon PARTITAIVA15 è riservato solo ai clienti con Partita IVA.'); 383 $('input#fake_coupon_code').val('').focus(); 384 return; 385 } 386 } 387 // Se il selector non esiste (siamo nel carrello), lasciamo procedere 388 // La validazione avverrà lato server via woocommerce_coupon_is_valid 389 } 390 if ($realForm.length && value) { 391 var $realInput = $realForm.find('input#coupon_code'); 392 if ($realInput.length) { 393 $realInput.val(value); 394 $realForm.trigger('submit'); 395 } 396 } else if (value) { 397 console.warn("Modulo coupon originale non trovato."); 398 } 399 }); 400 } 401 }, 402 helpers: { 403 // Assicura che il pulsante PayPal sia visibile 404 fixPaypalButton: function fixPaypalButton() { 405 var toggle = function toggle() { 406 // Selettori 407 var paypalInput = $('#payment_method_ppcp-gateway'); 408 var orderButton = $('button[name="woocommerce_checkout_place_order"]'); 409 410 // Se PayPal è selezionato, forziamo la visibilità del pulsante originale 411 if (paypalInput.is(':checked')) { 412 orderButton.removeClass('ppcp-hidden').show(); 413 } 414 }; 415 416 // 1. Eseguiamo un controllo a intervalli per i primi 5 secondi (per battere i caricamenti AJAX) 417 var attempts = 0; 418 var checkInterval = setInterval(function () { 419 toggle(); 420 attempts++; 421 if (attempts > 20) clearInterval(checkInterval); // Si ferma dopo 5 secondi (250ms * 20) 422 }, 250); 423 424 // 2. Continuiamo a monitorare i cambiamenti manuali dell'utente 425 $(document).on('updated_checkout change', 'input[name="payment_method"]', toggle); 426 }, 427 // Forza il toggle del pulsante ordine in base ai termini 428 bindPrivacyTerms: function bindPrivacyTerms() {
429 var toggle = function toggle() { 430 return $('#place_order').prop('disabled', !$('#terms').is(':checked')); 431 }; 432 toggle(); 433 $(document).on('change', '#terms', toggle); 434 } 435 }, 436 /** 437 * Monitora il riquadro dell'ordine e aggiorna eventuali totali esterni (es. in sidebar) 438 */ 439 priceSync: { 440 init: function init() { 441 var targetNode = document.getElementById('order_review'); 442 if (!targetNode) return; 443 var observer = new MutationObserver(function () { 444 // Preleva il totale aggiornato da WooCommerce 445 var $amountEl = $('#order_review .order-total .amount, #order_review .product-total .amount').first(); 446 if ($amountEl.length) { 447 var totalPrice = $amountEl.text(); 448 // Aggiorna l'elemento della tua UI (es. barra fissa o sidebar) 449 $('.fixed-cart-total .amount').html(totalPrice); 450 } 451 }); 452 observer.observe(targetNode, { 453 childList: true, 454 subtree: true 455 }); 456 } 457 }, 458 /** 459 * Gestisce Regex, Campi Obbligatori e Controllo Email Ajax 460 */ 461 validation: { 462 patterns: { 463 email: /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, 464 phone: /^[0-9+ ]*$/ // Permette numeri, spazio e il simbolo + 465 }, 466 init: function init() { 467 var self = this; 468 var $form = $('form.checkout'); 469 470 // Intercettiamo l'invio dell'ordine 471 $form.on('checkout_place_order', function () { 472 // Se la validazione fallisce, blocchiamo l'ordine (return false) 473 return self._validateAll(); 474 }); 475 }, 476 _validateAll: function _validateAll() { 477 var isValid = true; 478 var email = $('#billing_email').val(); 479 var phone = $('#billing_phone').val(); 480 481 // Reset errori grafici precedenti 482 $('.woocommerce-invalid').removeClass('woocommerce-invalid'); 483 484 // 1. Validazione Regex Email 485 if (email && !this.patterns.email.test(email)) { 486 $('#billing_email_field').addClass('woocommerce-invalid'); 487 isValid = false; 488 } 489 490 // 2. Validazione Regex Telefono 491 if (phone && !this.patterns.phone.test(phone)) { 492 $('#billing_phone_field').addClass('woocommerce-invalid'); 493 isValid = false; 494 } 495 496 // 3. Controllo Utente Esistente (Ajax sincrono o bloccante) 497 if (isValid && !$('body').hasClass('logged-in') && email) { 498 // Nota: In un flusso "place_order" l'Ajax dovrebbe essere gestito con cautela. 499 // Se l'email esiste, apriamo il login e blocchiamo l'ordine. 500 this._checkUserAjax(email); 501 } 502 if (!isValid) { 503 $('html, body').animate({ 504 scrollTop: $('.woocommerce-invalid:first').offset().top - 100 505 }, 500); 506 } 507 return isValid; 508 }, 509 _checkUserAjax: function _checkUserAjax(email) { 510 $.post(WP_PARAMS.ajax_url, { 511 action: 'existing_user', 512 email: email 513 }, function (data) { 514 if (data.emailExists) { 515 $('.open-account-overlay').click(); // Trigger per il tuo popup di login 516 $('#username').val(email); 517 alert("Questo indirizzo email è già registrato. Effettua il login per procedere."); 518 } 519 }); 520 } 521 } 522 }; 523 $(document).on('venturaReady', function () { 524 ventura.FormCheckout.limitFields.init($('#customer_details')); 525 ventura.FormCheckout.typeSwitcher.init(); 526 ventura.FormCheckout.helpers.fixPaypalButton(); 527 ventura.FormCheckout.helpers.bindPrivacyTerms(); 528 ventura.FormCheckout.priceSync.init(); 529 ventura.FormCheckout.validation.init(); 530 ventura.FormCheckout.coupons.init(); 531 }); 532})(jQuery); 533 534/***/ }), 535
536/***/ "./js/src/parts/form/form-piva-subscription.js": 537/*!*****************************************************!*\ 538 !*** ./js/src/parts/form/form-piva-subscription.js ***! 539 \*****************************************************/ 540/*! no static exports found */ 541/***/ (function(module, exports) { 542 543/** 544 * ===================================================== 545 * Piva subscription.js 546 * ===================================================== 547 * 548 * Progetto: Ventura Shop 549 * Tipo: Satellite JS 550 * Dipendenza: main.js (namespace globale "ventura") 551 * 552 * Descrizione: 553 * Questo file contiene tutte le logiche JS specifiche 554 * per la pagina form subscription. Si integra con il namespace 555 * globale "ventura" definito in main.js. 556 * 557 * Note: 558 * - Non dipendere da altri satelliti, solo da main.js 559 * - Il caricamento condizionale avviene tramite la 560 * variabile globale `isTemplate` passata da PHP 561 * tramite WP_PARAMS.is_page_template. 562 * - Tutte le funzioni dovrebbero essere incapsulate 563 * all'interno di ventura o di closure locali. 564 * 565 * Esempio di utilizzo: 566 * ventura.checkoutInit(); 567 * 568 * ===================================================== 569 */ 570var ventura = window.ventura; 571window.isTemplate = window.WP_PARAMS ? window.WP_PARAMS.is_page_template : null; 572(function ($) { 573 if (window.isTemplate !== 'templ-landing-piva.php') return; // si avvia solo sul template del form partita iva 574 575 /** 576 * Gestisce i contatori dei campi 577 */ 578 ventura.formPivaCounter = { 579 config: [{ 580 'f-nome': 50 581 }, { 582 'f-cognome': 50 583 }, { 584 'f-piva': 11 585 }], 586 init: function init() { 587 var $context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $(document); 588 var self = this; 589 $.each(this.config, function () { 590 $.each(this, function (inputId, maxLength) { 591 var $input = $('#' + inputId); 592 var $hint = $('#' + inputId.replace('f-', 'hint-')); 593 if ($input.length === 0 || $hint.length === 0) return; 594 595 // Reset e Setup attributi 596 $input.removeAttr('maxlength').attr('maxlength', maxLength).attr('data-length', true); 597 self._renderCounter($input, $hint, maxLength); 598 599 // Listener evento 600 $input.off('keyup').on('keyup', function () { 601 self._renderCounter($(this), $hint, maxLength); 602 }); 603 }); 604 }); 605 }, 606 _renderCounter: function _renderCounter($input, $hint, maxLength) { 607 var remaining = maxLength - $input.val().length; 608 if (remaining < 0) { 609 $hint.addClass('input-counter-error').text('testo troppo lungo'); 610 $input.closest('.form-row').addClass('woocommerce-invalid-character-length'); 611 } else { 612 $hint.removeClass('input-counter-error').text(remaining + ' caratteri rimanenti'); 613 $input.closest('.form-row').removeClass('woocommerce-invalid-character-length'); 614 } 615 } 616 }; 617 618 /** 619 * Validazione Partita IVA 620 */ 621 ventura.formPivaValidation = { 622 validatePIVA: function validatePIVA(piva) { 623 piva = piva.trim(); 624 if (!/^\d{11}$/.test(piva)) return false; 625 var s = 0; 626 for (var i = 0; i < 10; i++) { 627 var n = parseInt(piva[i]); 628 if (i % 2 !== 0) { 629 n *= 2; 630 if (n > 9) n -= 9; 631 } 632 s += n; 633 } 634 return (10 - s % 10) % 10 === parseInt(piva[10]); 635 }, 636 init: function init() { 637 var self = this; 638 639 // Validazione in tempo reale della Partita IVA 640 $('#f-piva').on('input', function () { 641 var $this = $(this); 642 var value = $this.val().trim(); 643 if (value.length === 11) { 644 var isValid = self.validatePIVA(value); 645 if (!isValid) { 646 $this.closest('.form-row').addClass('woocommerce-invalid'); 647 $('#hint-piva').text('Partita IVA non valida').css('color', 'red'); 648 } else { 649 $this.closest('.form-row').removeClass('woocommerce-invalid'); 650 $('#hint-piva').text('Partita IVA valida').css('color', 'green'); 651 } 652 } else { 653 $this.closest('.form-row').removeClass('woocommerce-invalid'); 654 $('#hint-piva').css('color', ''); 655 } 656 }); 657 } 658 }; 659 660 /** 661 * Gestione messaggi 662 */ 663 ventura.formPivaMessages = { 664 show: function show(type, text) { 665 var $el = $('#form-msg'); 666 $el.removeClass('error success').addClass('form-msg ' + type); 667 $el.text(text); 668 }, 669 clear: function clear() { 670 $('#form-msg').removeClass('error success').addClass('form-msg'); 671 $('#form-msg').text(''); 672 } 673 }; 674 675 /** 676 * Funzione principale del form 677 */ 678 ventura.formPivaSubscription = function () { 679 // Inizializza contatori 680 ventura.formPivaCounter.init(); 681 682 // Inizializza validazione PIVA 683 ventura.formPivaValidation.init(); 684 685 // Validazione campi prima dell'invio (SOLO CONTROLLI) 686 $('#btn-submit').on('click', function (e) { 687 e.preventDefault(); 688 var $nome = $('#f-nome'); 689 var $cognome = $('#f-cognome'); 690 var $ragione = $('#f-ragione'); 691 var $piva = $('#f-piva'); 692 var $email = $('#f-email'); 693 var $privacy = $('#f-privacy'); 694 var nome = $nome.val().trim(); 695 var cognome = $cognome.val().trim(); 696 var ragione = $ragione.val().trim(); 697 var piva = $piva.val().trim(); 698 var email = $email.val().trim(); 699 var privacy = $privacy.prop('checked'); 700 701 // Reset errori 702 $('.form-row').removeClass('woocommerce-invalid'); 703 ventura.formPivaMessages.clear(); 704 var hasError = false;
705 if (!nome) { 706 ventura.formPivaMessages.show('error', "Il campo Nome è obbligatorio."); 707 $nome.closest('.form-row').addClass('woocommerce-invalid'); 708 hasError = true; 709 } 710 if (!cognome) { 711 ventura.formPivaMessages.show('error', "Il campo Cognome è obbligatorio."); 712 $cognome.closest('.form-row').addClass('woocommerce-invalid'); 713 hasError = true; 714 } 715 if (!ragione) { 716 ventura.formPivaMessages.show('error', "Il campo Ragione Sociale è obbligatorio."); 717 $ragione.closest('.form-row').addClass('woocommerce-invalid'); 718 hasError = true; 719 } 720 if (!piva) { 721 ventura.formPivaMessages.show('error', "Il campo Partita IVA è obbligatorio."); 722 $piva.closest('.form-row').addClass('woocommerce-invalid'); 723 hasError = true; 724 } else if (!ventura.formPivaValidation.validatePIVA(piva)) { 725 ventura.formPivaMessages.show('error', "Partita IVA non valida (11 cifre)."); 726 $piva.closest('.form-row').addClass('woocommerce-invalid'); 727 hasError = true; 728 } 729 if (!email) { 730 ventura.formPivaMessages.show('error', "Il campo Email è obbligatorio."); 731 $email.closest('.form-row').addClass('woocommerce-invalid'); 732 hasError = true; 733 } else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { 734 ventura.formPivaMessages.show('error', "Inserisci un indirizzo email valido."); 735 $email.closest('.form-row').addClass('woocommerce-invalid'); 736 hasError = true; 737 } 738 if (!privacy) { 739 ventura.formPivaMessages.show('error', "Devi accettare la privacy per procedere."); 740 $privacy.closest('.form-row').addClass('woocommerce-invalid'); 741 hasError = true; 742 } 743 if (hasError) { 744 // Scroll al primo errore 745 $('html, body').animate({ 746 scrollTop: $('.woocommerce-invalid:first').offset().top - 100 747 }, 500); 748 return false; 749 } 750 751 // Se tutti i controlli sono passati, invio AJAX 752 $.ajax(WP_PARAMS.ajax_url, { 753 type: 'POST', 754 data: { 755 nome: nome, 756 cognome: cognome, 757 ragione_sociale: ragione, 758 partita_iva: piva, 759 email: email, 760 privacy: privacy, 761 action: "zohoFormPivaSubscription", 762 nonce: WP_PARAMS.zoho_form_nonce 763 }, 764 success: function success(response) { 765 if (response.success) { 766 ventura.formPivaMessages.show('success', response.data.message); 767 768 // Redirect alla thank you page 769 if (response.data.redirect_url) { 770 window.location.href = response.data.redirect_url; 771 } 772 } else { 773 ventura.formPivaMessages.show('error', response.data.message); 774 $('#btn-submit').prop('disabled', false).text('Entra nel Mondo Ventura'); 775 } 776 }, 777 error: function error(xhr, status, _error) { 778 ventura.formPivaMessages.show('error', "Errore durante l'invio del form."); 779 $('#btn-submit').prop('disabled', false).text('Entra nel Mondo Ventura'); 780 } 781 }); 782 return false; 783 }); 784 }; 785 786 // Document ready 787 $(document).on('venturaReady', function () { 788 ventura.formPivaSubscription(); 789 }); 790})(jQuery); 791 792/***/ }), 793
794/***/ "./js/src/parts/menu.js": 795/*!******************************!*\ 796 !*** ./js/src/parts/menu.js ***! 797 \******************************/ 798/*! no static exports found */ 799/***/ (function(module, exports) { 800 801/** 802 * ===================================================== 803 * menu.js 804 * ===================================================== 805 * 806 * Progetto: Ventura Shop 807 * Tipo: Satellite JS 808 * Dipendenza: main.js (namespace globale "ventura") 809 * 810 * Descrizione: 811 * Questo file contiene tutte le logiche JS specifiche 812 * dei menu. Si integra con il namespace 813 * globale "ventura" definito in main.js. 814 * 815 * Note: 816 * - Non dipendere da altri satelliti, solo da main.js 817 * - Il caricamento condizionale avviene tramite la 818 * variabile globale `isTemplate` passata da PHP 819 * tramite WP_PARAMS.is_page_template. 820 * - Tutte le funzioni dovrebbero essere incapsulate 821 * all'interno di ventura o di closure locali. 822 * 823 * Esempio di utilizzo: 824 * ventura.cartInit(); 825 * 826 * ===================================================== 827 */ 828window.ventura = window.ventura || {}; 829(function ($) { 830 ventura.menuMobileEng = function () { 831 var $body = $('body'); 832 var $hamburger = $('.hamburger-eng'); 833 var $menuContainer = $('.menu-main-container'); 834 var $closeBtn = $('.close-header-nav'); 835 var $showcaseImgs = $('.showcase-items__media img'); 836 837 // Toggle menu principale 838 $hamburger.on('click', function () { 839 $menuContainer.slideToggle(550); 840 if ($body.hasClass('menu_aperto')) { 841 $body.removeClass('menu_aperto'); 842 } else { 843 $body.addClass('menu_aperto'); 844 if (typeof dataLayer !== 'undefined') { 845 dataLayer.push({ 846 id: 'menuop' 847 }); 848 } 849 } 850 851 // Gestione menu mobile aperto/chiusura 852 if ($body.hasClass('menu_mobile_aperto')) { 853 $body.addClass('menu_mobile_closing'); 854 setTimeout(function () { 855 $body.removeClass('menu_mobile_closing menu_mobile_aperto'); 856 }, 500); 857 } else { 858 $body.addClass('menu_mobile_aperto'); 859 } 860 }); 861 862 // Pulsante di chiusura menu 863 $closeBtn.on('click', function () { 864 if ($body.hasClass('menu_mobile_aperto')) { 865 $body.addClass('menu_mobile_closing'); 866 setTimeout(function () { 867 $body.removeClass('menu_mobile_closing menu_mobile_aperto'); 868 }, 500); 869 } 870 }); 871 872 // Listener resize 873 $(window).on('resize', function () { 874 if (ventura.onResize) ventura.onResize(); 875 if (ventura.customCookieText) ventura.customCookieText(); 876 if ($(window).width() < 768) { 877 $showcaseImgs.css('border-radius', '0px'); 878 } else { 879 $showcaseImgs.css('border-radius', '6px'); 880 } 881 }); 882 }; 883 ventura.menuMagazine = function () { 884 var $body = $('body'); 885 var $hamburger = $('.hamburger'); 886 var $menuContainer = $('.menu-main-container'); 887 $hamburger.on('click', function () { 888 // Toggle visibilità menu 889 $menuContainer.slideToggle(550); 890 891 // Gestione classe menu_aperto 892 if ($body.hasClass('menu_aperto')) { 893 $body.removeClass('menu_aperto'); 894 } else { 895 $body.addClass('menu_aperto'); 896 897 // Push su dataLayer se definito 898 if (typeof dataLayer !== 'undefined') { 899 dataLayer.push({ 900 id: 'menuop' 901 }); 902 } 903 } 904 }); 905 }; 906 ventura.menuMobile = function () { 907 var $body = document.body; 908 var navElement = document.getElementById("hamburger"); 909 if (!navElement) return; // Esci se non c'è il menu 910 911 // --- Multilevel mobile menu --- 912 var navExpandItems = Array.from(document.querySelectorAll(".nav-expand")); 913 var backLinkHTML = "\n <li class=\"nav-item nav-back-item\">\n <a class=\"nav-link nav-back-link\" href=\"javascript:;\">Indietro</a>\n </li>\n "; 914 navExpandItems.forEach(function (item) { 915 var expandContent = item.querySelector(".nav-expand-content"); 916 var navLink = item.querySelector(".nav-link"); 917 var backLink = item.querySelector(".nav-back-link"); 918 expandContent.insertAdjacentHTML("afterbegin", backLinkHTML); 919 navLink.addEventListener("click", function () { 920 return item.classList.add("active"); 921 }); 922 backLink.addEventListener("click", function () { 923 return item.classList.remove("active"); 924 }); 925 }); 926 927 // Toggle menu principale 928 var ham = navElement; 929 var hamClose = document.getElementById("nav-close"); 930 if (ham) ham.addEventListener("click", function () { 931 return $body.classList.toggle("nav-is-toggled"); 932 }); 933 if (hamClose) hamClose.addEventListener("click", function () { 934 return $body.classList.toggle("nav-is-toggled"); 935 }); 936 937 // Resize window 938 window.addEventListener("resize", function () { 939 // --- FUNZIONI ESTERNE --- 940 if (typeof ventura !== "undefined" && typeof ventura.onResize === "function") { 941 ventura.onResize(); 942 } 943 $(".showcase-items__media img").css("border-radius", window.innerWidth < 768 ? "0px" : "6px"); 944 }); 945 }; 946 947 // Document ready per satellite 948 $(document).ready(function () { 949 //ventura.menuMobileEng(); 950 //ventura.menuMagazine(); 951 //ventura.menuMobile(); 952 }); 953})(jQuery); 954 955/***/ }), 956
957/***/ "./js/src/parts/product-slider.js": 958/*!****************************************!*\ 959 !*** ./js/src/parts/product-slider.js ***! 960 \****************************************/ 961/*! no static exports found */ 962/***/ (function(module, exports) { 963 964/** 965 * ===================================================== 966 * Product Slider.js 967 * ===================================================== 968 * 969 * Progetto: Ventura Shop 970 * Tipo: Satellite JS 971 * Dipendenza: main.js (namespace globale "ventura") 972 * 973 * Descrizione: 974 * Questo file risolve il conflitto del "doppio click" sui 975 * dispositivi mobili (in particolare iOS/Safari) causato 976 * da script di terze parti (es. Cloudflare Turnstile) e 977 * dalla gestione degli stati di hover del browser. 978 * Intercettando l'evento 'touchstart', il codice bypassa 979 * i ritardi di WebKit forzando il 'click' immediato sui 980 * pulsanti critici (come l'aggiunta al carrello e altri 981 * bottoni definiti), rendendo l'interazione istantanea. 982 * 983 * Note: 984 * - Non dipendere da altri satelliti, solo da main.js 985 * - Il caricamento condizionale avviene tramite la 986 * variabile globale `isTemplate` passata da PHP 987 * tramite WP_PARAMS.is_page_template. 988 * - Tutte le funzioni dovrebbero essere incapsulate 989 * all'interno di ventura o di closure locali. 990 * 991 * Esempio di utilizzo: 992 * ventura.checkoutInit(); 993 * 994 * ===================================================== 995 */ 996var ventura = window.ventura; 997window.isTemplate = window.WP_PARAMS ? window.WP_PARAMS.is_page_template : null; 998(function ($) { 999 ventura.activeSliderProducts = function () { 1000 $(".slider-products ul").slick({ 1001 dots: false, 1002 arrows: true, 1003 infinite: true, 1004 speed: 300, 1005 slidesToShow: 4, 1006 responsive: [{ 1007 breakpoint: 480, 1008 settings: { 1009 slidesToShow: 1 1010 } 1011 }, { 1012 breakpoint: 992, 1013 settings: { 1014 slidesToShow: 2 1015 } 1016 }, { 1017 breakpoint: 1200, 1018 settings: { 1019 slidesToShow: 3 1020 } 1021 }] 1022 }); 1023 }; 1024 $(document).on('venturaReady', function () { 1025 ventura.activeSliderProducts(); 1026 window.addEventListener('resize', function () {}); 1027 }); 1028})(jQuery); 1029 1030/***/ }), 1031
1032/***/ "./js/src/scripts.js": 1033/*!***************************!*\ 1034 !*** ./js/src/scripts.js ***! 1035 \***************************/ 1036/*! no exports provided */ 1037/***/ (function(module, __webpack_exports__, __webpack_require__) { 1038 1039"use strict"; 1040__webpack_require__.r(__webpack_exports__); 1041/* harmony import */ var _parts_menu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parts/menu */ "./js/src/parts/menu.js"); 1042/* harmony import */ var _parts_menu__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_parts_menu__WEBPACK_IMPORTED_MODULE_0__); 1043/* harmony import */ var _parts_button__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parts/button */ "./js/src/parts/button.js"); 1044/* harmony import */ var _parts_button__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parts_button__WEBPACK_IMPORTED_MODULE_1__); 1045/* harmony import */ var _parts_checkout_form_checkout__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parts/checkout/form-checkout */ "./js/src/parts/checkout/form-checkout.js"); 1046/* harmony import */ var _parts_checkout_form_checkout__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_parts_checkout_form_checkout__WEBPACK_IMPORTED_MODULE_2__); 1047/* harmony import */ var _parts_checkout_checkout__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parts/checkout/checkout */ "./js/src/parts/checkout/checkout.js"); 1048/* harmony import */ var _parts_checkout_checkout__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parts_checkout_checkout__WEBPACK_IMPORTED_MODULE_3__); 1049/* harmony import */ var _parts_product_slider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./parts/product-slider */ "./js/src/parts/product-slider.js"); 1050/* harmony import */ var _parts_product_slider__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_parts_product_slider__WEBPACK_IMPORTED_MODULE_4__); 1051/* harmony import */ var _parts_form_form_piva_subscription__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./parts/form/form-piva-subscription */ "./js/src/parts/form/form-piva-subscription.js"); 1052/* harmony import */ var _parts_form_form_piva_subscription__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_parts_form_form_piva_subscription__WEBPACK_IMPORTED_MODULE_5__); 1053var ventura = {}; 1054var isTemplate = WP_PARAMS.is_page_template; 1055 1056 1057 1058 1059 1060 1061//import './parts/christmas-box'; 1062 1063(function ($) { 1064 ventura.init = function () { 1065 ventura.test(); 1066 //ventura.onResize(); 1067 //ventura.vhVariable(); 1068 //avvio dei satelliti 1069 1070 $(document).trigger('venturaReady'); 1071 }; 1072 $(document).ready(function () { 1073 ventura.init(); 1074 }); 1075 $(window).on('resize', function () {}); 1076 ventura.test = function () { 1077 console.log('start ' + isTemplate); 1078 }; 1079 ventura.onResize = function () { 1080 var windowWidth = window.innerWidth; 1081 if (windowWidth > 768) { 1082 $(".prd_image").prependTo(".single-prodotto"); 1083 } else { 1084 $(".prd_image").appendTo(".img-mobile-placeholder"); 1085 } 1086 if (windowWidth > 991) { 1087 $("body").removeClass("menu_mobile_aperto"); 1088 } 1089 if (typeof ventura.vhVariable === "function") { 1090 ventura.vhVariable(); 1091 } 1092 }; 1093 ventura.vhVariable = function () { 1094 var vh = window.innerHeight * 0.01; 1095 document.documentElement.style.setProperty("--vh", "".concat(vh, "px")); 1096 }; 1097})(jQuery); 1098 1099// Espone ventura globalmente per i satelliti 1100window.ventura = ventura; 1101window.isTemplate = isTemplate; 1102 1103/***/ }), 1104
1105/***/ "./new_scss/main.scss": 1106/*!****************************!*\ 1107 !*** ./new_scss/main.scss ***! 1108 \****************************/ 1109/*! no static exports found */ 1110/***/ (function(module, exports) { 1111 1112// removed by extract-text-webpack-plugin 1113 1114/***/ })
1114, 1115 1116/***/ 0: 1117/*!******************************************************!*\ 1118 !*** multi ./js/src/scripts.js ./new_scss/main.scss ***! 1119 \******************************************************/ 1120/*! no static exports found */ 1121/***/ (function(module, exports, __webpack_require__) { 1122 1123__webpack_require__(/*! /home/gianluca/Progetti/NP11/ventura_shop/js/src/scripts.js */"./js/src/scripts.js"); 1124module.exports = __webpack_require__(/*! /home/gianluca/Progetti/NP11/ventura_shop/new_scss/main.scss */"./new_scss/main.scss"); 1125 1126 1127/***/ }) 1128 1129/******/ }); 1130//# sourceMappingURL=scripts.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.