1/** 2 * We offer the best and most useful modules PrestaShop and modifications for your online store 3 * 4 * We are experts and professionals in PrestaShop 5 * 6 * NOTICE OF LICENSE 7 * 8 * This file is not open source! Each license that you purchased is only available for 1 website only 9 * If you want to use this file on more websites (or projects), you need to purchase additional licenses 10 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party 11 * Please ensure that you are using a valid license for this file. 12 * 13 * @author PresTeamShop SAS (Registered Trademark) <[email protected]> 14 * @copyright 2011-2026 PresTeamShop SAS, All rights reserved 15 * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 16 * 17 * @category PrestaShop 18 * @category Module 19 */ 20//Important note 21//If you want to trigger the events of the module elements, you must use 22//the exported variable window.jqueryOPC and not the jQuery of the template, for example: 23//window.jqueryOPC.find('#id_state').trigger('change'); 24 25function initOpcCompatibilities() { 26 if (typeof prestashop === typeof undefined) { 27 return; 28 } 29 30 let intervalPaymentToggleOrderButtonValidation = null; 31 32 //uso de la funcion compareVersion: 33 //console.log(compareVersion('1.0.0', '1.0.1')); // -1 (v1 < v2) 34 //console.log(compareVersion('1.0.2', '1.0.1')); // 1 (v1 > v2) 35 //console.log(compareVersion('1.0.2', '1.0.2')); // 0 (v1 == v2) 36 const compareVersion = (v1, v2) => { 37 if (typeof v1 !== 'string') return false; 38 if (typeof v2 !== 'string') return false; 39 v1 = v1.split('.'); 40 v2 = v2.split('.'); 41 const k = Math.min(v1.length, v2.length); 42 for (let i = 0; i < k; ++i) { 43 v1[i] = parseInt(v1[i], 10); 44 v2[i] = parseInt(v2[i], 10); 45 if (v1[i] > v2[i]) return 1; 46 if (v1[i] < v2[i]) return -1; 47 } 48 return v1.length === v2.length ? 0 : v1.length < v2.length ? -1 : 1; 49 }; 50 51 // App - Events 52 prestashop.on('opc-app-init', (params) => { 53 const { JqueryElementMain } = params; 54 55 $(document).on('ajaxSend', (e, jqXHR, settings) => { 56 if (settings.url === window.prestashop.urls.pages.order 57 && settings.data 58 && settings.data.includes('action=checkCartStillOrderable') 59 ) { 60 $('#btn-placer_order').prop('disabled', true); 61 } 62 }); 63 64 $(document).on('ajaxComplete', (e, jqXHR, settings) => { 65 if (settings.url === window.prestashop.urls.pages.order 66 && settings.data 67 && settings.data.includes('action=checkCartStillOrderable') 68 ) { 69 $('#btn-placer_order').prop('disabled', false); 70 } 71 }); 72 }); 73 74 // Field - Events 75 prestashop.on('opc-field-save-complete', (params) => { 76 const { JqueryElementForm } = params; 77 }); 78 79 // Login - Events 80 prestashop.on('opc-login_customer-loginCustomer-beforeSend', (params) => { 81 const { JqueryElementMain, JqueryElement } = params; 82 }); 83 84 prestashop.on('opc-login-loginCustomer-error', (params) => { 85 const { JqueryElement } = params; 86 87 // idxrdefender - v1.3.2 - innovadeluxe 88 if (typeof IdxrdefenderFront !== typeof undefined) { 89 JqueryElement.find('#g-recaptcha-response-login').val(''); 90 let defender = new IdxrdefenderFront(); 91 defender.bindsCaptcha(); 92 } 93 }); 94 95 // Personal Information - Events 96 prestashop.on('opc-personal_information-saveCustomer-beforeSend', (params) => { 97 const { JqueryElementMain, JqueryElement } = params; 98 }); 99 100 prestashop.on('opc-personal_information-saveCustomer-error', (params) => { 101 const { JqueryElement } = params; 102 103 // idxrdefender - v1.3.2 - innovadeluxe 104 if (typeof IdxrdefenderFront !== typeof undefined) { 105 JqueryElement.find('#g-recaptcha-response-login').val(''); 106 let defender = new IdxrdefenderFront(); 107 defender.bindsCaptcha(); 108 } 109 }); 110 111 // Addresses - Events 112 prestashop.on('opc-addresses-initEventFormAddress', (params) => { 113 const { formAddress } = params; 114 115 // chilexpress_oficial - v1.2.9 - Chilexpress 116 if (typeof chilexpress_oficial_ajax_url !== typeof undefined) { 117 const typeAddress = formAddress.data('component'); 118 let countrIsoCode = OPC.Addresses.country.iso_code; 119 120 const $countrySelector = formAddress.find('[name=id_country]'); 121 if ($countrySelector.length > 0) { 122 countrIsoCode = $countrySelector.find('option:selected').data('iso-code'); 123 } 124 125 if (countrIsoCode == 'CL') { 126 const $stateSelector = formAddress.find('[name=id_state]'); 127 128 $stateSelector.addClass('reloadAddresses'); 129 130 const $citySelector = formAddress.find('[name=city]'); 131 let $cityListSelector = formAddress.find('[name=city_list]'); 132 133 $citySelector.off('blur'); 134 135 $.ajax({ 136 type: 'POST', 137 url: chilexpress_oficial_ajax_url.replace(/&/gi,'&'), 138 cache: false, 139 dataType: 'json', 140 data: { 141 action : 'obtener_comunas_con_id', 142 region : $stateSelector.val(), 143 ajax: true 144 }, 145 success: function (result) { 146 if (typeof result.comunas !== undefined) { 147 if ($cityListSelector.length <= 0) { 148 $cityListSelector = $('<select/>') 149 .attr({ 150 id: typeAddress + '_city_list', 151 class: 'form-control input-sm ' + typeAddress 152 }) 153 .on('change', function(event) { 154 const optionSelected = $(event.currentTarget).find('option:selected'); 155 156 $citySelector.val( 157 $(optionSelected).attr('value') 158 ).trigger('blur'); 159 } 160 ); 161 } else { 162 $cityListSelector.empty().hide(); 163 } 164 165 $('<option/>') 166 .attr({ 167 value: '' 168 }) 169 .append('--') 170 .appendTo($cityListSelector); 171 172 $.each(result.comunas, function(key, city) { 173 $('<option/>') 174 .attr({ 175 'value': key 176 }) 177 .append(city) 178 .appendTo($cityListSelector); 179 }); 180 181 $citySelector.parents('.form-group') 182 .append($cityListSelector); 183 184 if ($cityListSelector.find('option[value="' + $citySelector.val() + '"]').length > 0) { 185 $cityListSelector.val($citySelector.val()); 186 } else { 187 $citySelector.val(''); 188 } 189 190 $cityListSelector.show(); 191 $citySelector.hide(); 192 } 193 194 // if (typeof result.comunas !== undefined) { 195 // $citySelector.typeahead({ 196 // highlight: true, 197 // items : 'all', 198 // showHintOnFocus: false, 199 // autoSelect: true, 200 // minLength: 0, 201 // source: function (query, process) { 202 // process($.map(result.comunas, function (city) { 203 // return { 204 // name: city, 205 // value: city 206 // }; 207 // })); 208 // }, 209 // updater: function (item) { 210 // //$citySelector.val(item.name); 211 212 // return item.value; 213 // } 214 // }); 215 // } 216 }, 217 }); 218 } 219 } 220 }); 221 prestashop.on('opc-addresses-getAddresses-complete', (params) => { 222 const { JqueryElementMain, JqueryElement } = params; 223 224 //facturare - v4.1.5 - Daniel Patilea 225 if (typeof initListen !== typeof undefined) { 226 initListen(); 227 } 228 }); 229 prestashop.on('opc-addresses-getAddresses-complete-edit', (params) => { 230 const { JqueryElementMain, JqueryElement } = params; 231 }); 232 prestashop.on('opc-addresses-getAddresses-complete-add', (params) => { 233 const { JqueryElementMain, JqueryElement } = params; 234 }); 235 236 // Shipping - Events 237 prestashop.on('opc-shipping-getCarrierList-complete', (params) => { 238 const { JqueryElement, JqueryElementContent } = params; 239 240 //support module: mondialrelay - v3.3.3 - ScaleDEV 241 //se hizo modificacion a medida en dicho modulo para poder funcionar. 242 if (typeof window.mondialrelayWidget !== typeof undefined) { 243 if (typeof MONDIALRELAY_SELECTED_RELAY_IDENTIFIER !== typeof undefined) { 244 window.mondialrelayWidget.savedRelay = MONDIALRELAY_SELECTED_RELAY_IDENTIFIER; 245 } 246 247 $(window.mondialrelayWidget).trigger('mondialrelay.ready'); 248 249 // if (typeof window.mondialrelayWidget !== typeof undefined) { 250 // $(document).off('click', window.mondialrelayWidget.save_button); 251 // } 252 253 // let _script = document.createElement('script'); 254 // _script.type = 'text/javascript'; 255 // _script.src = prestashop.urls.base_url + 'modules/mondialrelay/views/js/front/checkout/checkout-17.js';
256 // JqueryElementContent.append(_script); 257 258 // if (typeof window.mondialrelayWidget !== typeof undefined) { 259 // if (typeof MONDIALRELAY_SELECTED_RELAY_IDENTIFIER !== typeof undefined) { 260 // window.mondialrelayWidget.savedRelay = MONDIALRELAY_SELECTED_RELAY_IDENTIFIER; 261 // } 262 263 // $(window.mondialrelayWidget).trigger('mondialrelay.ready'); 264 // } 265 } 266 267 //gelproximity - v1.2.9 - iModuli.it 268 if (typeof gelprx_conf !== typeof undefined) { 269 let _script = document.createElement('script'); 270 _script.type = 'text/javascript'; 271 _script.src = prestashop.urls.base_url + 'modules/gelproximity/views/js/8/front.js'; 272 JqueryElementContent.append(_script); 273 } 274 275 /* Smartpost Shipping - v1.2.13 - Mijora.lt */ 276 if (typeof ItellaModule !== typeof undefined) { 277 ItellaModule.init(); 278 } 279 280 /* Venipak Shipping - v1.1.5 - mijora.lt */ 281 if (typeof venipak_custom_modal !== typeof undefined) { 282 venipak_custom_modal(); 283 } 284 285 //swastarkencl - v3.6.0 - Softwareagil 286 if (typeof swastarkenclRunOnReady !== typeof undefined) { 287 swastarkenclRunOnReady(); 288 } 289 290 /* advanceddateofdelivery - v3.1.0 - Créatym */ 291 if (typeof cartDatesDelivery !== typeof undefined) { 292 JqueryElementContent.find('.delivery-options').after($('#advanceddateofdelivery')); 293 294 let _script = document.createElement('script'); 295 _script.type = 'text/javascript'; 296 _script.src = prestashop.urls.base_url + 'modules/advanceddateofdelivery/views/js/cart.js'; 297 JqueryElement.append(_script); 298 } 299 300 /* shaim_dpdparcelshop - v2.3.10 - Dominik Shaim Ulrich (www.psmoduly.cz / www.openservis.cz) */ 301 if (typeof updateCarrierExtraContentDpdparcelshop !== typeof undefined) { 302 let _script = document.createElement('script'); 303 _script.type = 'text/javascript'; 304 _script.src = prestashop.urls.base_url + '/modules/shaim_dpdparcelshop/shaim_dpdparcelshop.js'; 305 JqueryElement.append(_script); 306 307 updateCarrierExtraContentDpdparcelshop(parseInt(JqueryElement.find(".delivery_option_radio:checked").val())); 308 309 $('.psmoduly_balikovy_modul').on('show.bs.modal', (e) => { 310 $(e.currentTarget).find('.close').attr('data-bs-dismiss', 'modal'); 311 }); 312 } 313 314 /* shaim_zasilkovna_widget - v2.3.7 - Dominik Shaim Ulrich (www.psmoduly.cz / www.openservis.cz) */ 315 if (typeof updateCarrierExtraContentZasilkovnaWidget !== typeof undefined) { 316 let _script = document.createElement('script'); 317 _script.type = 'text/javascript'; 318 _script.src = prestashop.urls.base_url + '/modules/shaim_zasilkovna_widget/shaim_zasilkovna_widget.js'; 319 JqueryElement.append(_script); 320 321 LoadNowZasilkovnaWidget(); 322 323 updateCarrierExtraContentZasilkovnaWidget(parseInt(JqueryElement.find(".delivery_option_radio:checked").val())); 324 } 325 326 /* shaim_baliknapostu - v2.3.7 - Dominik Shaim Ulrich (www.psmoduly.cz / www.openservis.cz) */ 327 if (typeof updateCarrierExtraContentBalikNaPostu !== typeof undefined) { 328 let _script = document.createElement('script'); 329 _script.type = 'text/javascript'; 330 _script.src = prestashop.urls.base_url + '/modules/shaim_baliknapostu/shaim_baliknapostu.js'; 331 JqueryElement.append(_script); 332 333 LoadNowBaliknapostu(); 334 335 updateCarrierExtraContentBalikNaPostu(parseInt(JqueryElement.find(".delivery_option_radio:checked").val())); 336 } 337 338 /* shaim_balikovna - v2.3.7 - Dominik Shaim Ulrich (www.psmoduly.cz / www.openservis.cz) */ 339 if (typeof updateCarrierExtraContentBalikovna !== typeof undefined) { 340 let _script = document.createElement('script'); 341 _script.type = 'text/javascript'; 342 _script.src = prestashop.urls.base_url + '/modules/shaim_balikovna/shaim_balikovna.js';
343 JqueryElement.append(_script); 344 345 LoadNowBalikovna(); 346 347 updateCarrierExtraContentBalikovna(parseInt(JqueryElement.find(".delivery_option_radio:checked").val())); 348 } 349 350 /* shaim_glsparcelshop - v2.3.7 - Dominik Shaim Ulrich (www.psmoduly.cz / www.openservis.cz) */ 351 if (typeof updateCarrierExtraContentGLSParcelShop !== typeof undefined) { 352 let _script = document.createElement('script'); 353 _script.type = 'text/javascript'; 354 _script.src = prestashop.urls.base_url + '/modules/shaim_glsparcelshop/shaim_glsparcelshop.js'; 355 JqueryElement.append(_script); 356 357 LoadNowGlsparcelshop(); 358 359 updateCarrierExtraContentGlsparcelshop(parseInt(JqueryElement.find(".delivery_option_radio:checked").val())); 360 } 361 362 /* shaim_pplparcelshop - v2.3.7 - Dominik Shaim Ulrich (www.psmoduly.cz / www.openservis.cz) */ 363 if (typeof updateCarrierExtraContentPplparcelshop !== typeof undefined) { 364 let _script = document.createElement('script'); 365 _script.type = 'text/javascript'; 366 _script.src = prestashop.urls.base_url + '/modules/shaim_pplparcelshop/shaim_pplparcelshop.js'; 367 JqueryElement.append(_script); 368 369 LoadNowPplparcelshop(); 370 371 updateCarrierExtraContentPplparcelshop(parseInt(JqueryElement.find(".delivery_option_radio:checked").val())); 372 } 373 374 /* shaim_intime - v2.3.7 - Dominik Shaim Ulrich (www.psmoduly.cz / www.openservis.cz) */ 375 if (typeof updateCarrierExtraContentIntime !== typeof undefined) { 376 let _script = document.createElement('script'); 377 _script.type = 'text/javascript'; 378 _script.src = prestashop.urls.base_url + '/modules/shaim_intime/shaim_intime.js'; 379 JqueryElement.append(_script); 380 381 LoadNowIntime(); 382 383 updateCarrierExtraContentIntime(parseInt(JqueryElement.find(".delivery_option_radio:checked").val())); 384 } 385 386 //gmparcellocker - v1.4.1 - GreenMouseStudio.com 387 if (typeof gmParcelLockerAjaxUrl !== typeof undefined && JqueryElement.find('#easypack-widget').length > 0) { 388 window.easyPack.dropdownWidget('easypack-widget', function (point) { 389 const pointData = point.name + '| ' + point.address.line1 + '| ' + point.address.line2; 390 $.ajax({ 391 url: gmParcelLockerAjaxUrl, 392 type: 'POST', 393 crossDomain: true, 394 data: {cartId: gmCartId, pointData: pointData}, 395 async: true, 396 dataType: "json", 397 headers: {"cache-control": "no-cache"}, 398 success: function (data) { 399 if (data.msg == 'OK') { 400 $('.chosen-parcel').html(pointData.split('|').join(',')); 401 402 if (typeof window.checkGmParcellocker !== typeof undefined) { 403 window.gmparcellockerCheckStoreSelected(JqueryElement); 404 } 405 } 406 }, 407 error: function (jqXHR, textStatus) { 408 console.log(jqXHR.responseText); 409 } 410 }); 411 }); 412 413 window.gmparcellockerCheckStoreSelected = function(JqueryElement) { 414 if (JqueryElement.find('.gmparcellocker-button').is(':visible')) { 415 window.checkGmParcellocker = true; 416 if (JqueryElement.find('.chosen-parcel').text().length > 3) { 417 window.gmparcellockerStoreSelected = true; 418 } else { 419 window.gmparcellockerStoreSelected = false; 420 } 421 } else { 422 if (window.checkGmParcellocker) { 423 window.gmparcellockerStoreSelected = true; 424 window.checkGmParcellocker = false; 425 } 426 } 427 } 428 429 const gmparcellocker = window.setInterval(function () { 430 if (typeof window.checkGmParcellocker !== typeof undefined) { 431 window.gmparcellockerCheckStoreSelected(JqueryElement); 432 433 clearInterval(gmparcellocker); 434 } 435 }, 500); 436 } 437 438 //support module: sendcloud - v1.5.2 - Sendcloud _ sendcloudv2 - v2.0.24 - Sendcloud 439 const scriptSendCloud = $('script[src^="https://servicepoints.sendcloud.sc/shops/prestashop/"]').attr('src'); 440 const scriptSendCloudV2 = $('script[src^="https://servicepoints.sendcloud.sc/shops/prestashop_v2/"]').attr('src'); 441 if (typeof scriptSendCloud !== typeof undefined || typeof scriptSendCloudV2 !== typeof undefined) { 442 let _script = document.createElement('script'); 443 _script.type = 'text/javascript'; 444 _script.src = scriptSendCloud || scriptSendCloudV2;
445 JqueryElementContent.append(_script); 446 } 447 448 // correosoficial - v1.2.8.0 - Grupo Correos 449 if ($('.carrier-extra-content .correos_oficial').length > 0) { 450 let _script = document.createElement('script'); 451 _script.type = 'text/javascript'; 452 _script.src = prestashop.urls.base_url + '/modules/correosoficial/js/checkout.js'; 453 JqueryElement.append(_script); 454 } 455 456 //support module: seur - v2.5.9 - de Seur 457 if (typeof initSeurCarriers !== typeof undefined) { 458 initSeurCarriers(); 459 } 460 461 // payseradelivery - v1.5.2- Paysera 462 if ($('.paysera-delivery-gateway-content').length > 0) { 463 let _script = document.createElement('script'); 464 _script.type = 'text/javascript'; 465 _script.src = prestashop.urls.base_url + '/modules/payseradelivery/views/js/frontend/terminal_selection.js'; 466 JqueryElement.append(_script); 467 } 468 469 // darique - v3.0.10 - Silbersaiten 470 if (typeof dariqueModule !== typeof undefined) { 471 dariqueModule.initLoaderBlock(); 472 dariqueModule.loadPresentsBlock(0, []); 473 } 474 }); 475 476 // Payment - Events 477 prestashop.on('opc-payment-getPaymentList-complete', (params) => { 478 const { JqueryElement } = params; 479 480 let paymentList = {}; 481 JqueryElement.find('.payment_radio').each(function (i, item) { 482 paymentList[$(item).val()] = $(item).data('module-version'); 483 }); 484 485 // prevents rage clicking on submit button and related issues 486 const forms = JqueryElement.find('form'); 487 forms.each(function() { 488 const $form = $(this); 489 const $submitButton = $form.find('button[type="submit"]'); 490 491 $form.on('submit', function(e) { 492 if ($form.data('submitting')) { 493 e.preventDefault(); 494 return false; 495 } 496 497 $form.data('submitting', true); 498 $submitButton.prop('disabled', true).addClass('disabled'); 499 500 // Re-enable form after 5 seconds in case of error 501 setTimeout(function() { 502 $form.data('submitting', false); 503 $submitButton.prop('disabled', false).removeClass('disabled'); 504 }, 5000); 505 }); 506 }); 507 508 /* cryptopaymentslight - v1.0.3 - UNAS Holding */ 509 if (typeof initCryptoPaymentsLightUI === 'function') { 510 initCryptoPaymentsLightUI(); 511 } 512 513 /* wkauthorizepayment - v1.0.1 - Webkul */ 514 if ($('#wkauthorize_pay').length > 0) { 515 $('#payment-confirmation > .ps-shown-by-js > button').click(function(e) { 516 e.preventDefault(); 517 var is_authorize_slected = $('.payment-options').find("input[data-module-name='wkauthorizepayment']").is(':checked'); 518 if (is_authorize_slected) { 519 $('#wkauthorize_pay').click(); 520 return false; 521 } 522 }); 523 } 524 525 //ps_checkout - v2.15.4 - PrestaShop 526 if (typeof window.ps_checkout !== typeof undefined && typeof JqueryElement !== typeof undefined) { 527 window.ps_checkout.events = new EventTarget(); 528 window.ps_checkout.events.addEventListener('payment-option-active', ({ detail }) => { 529 const { HTMLElementContainer } = detail; 530 $(HTMLElementContainer).parent().show(); 531 }); 532 533 JqueryElement.find('.payment_radio').each(function (i, item) { 534 const $item = $(item); 535 const moduleName = $item.data('module-name'); 536 const $container = $item.parents('#' + $item.prop('id') + '-container'); 537 538 if (-1 !== moduleName.search('ps_checkout')) { 539 $container.parent().hide(); 540 } 541 }); 542 543 window.ps_checkout.renderCheckout(); 544 } 545 546 //paytpv - v7.7.1 - Paycomet 547 if (typeof paytpv_initialize !== typeof undefined) { 548 paytpv_initialize(); 549 } 550 551 /* Fmmgiftwrapping - v1.1.1 - FMM Modules */ 552 if (typeof initColorBox !== typeof undefined) { 553 initColorBox(); 554 } 555 556 //pts_stripe - v4.0.6 - PresTeamShop 557 if (typeof AppPTSS !== typeof undefined) { 558 AppPTSS.setup(); 559 } 560 561 //klarnapaymentsofficial - v2.2.3 - Prestaworks AB 562 if (typeof paymentList['klarnapaymentsofficial'] !== typeof undefined /*typeof kp_client_token !== typeof undefined*/) {
563 const klarna_options = $('.klarna-container'); 564 565 for (const element of klarna_options) { 566 const payment_category = element.id.substring(26, element.id.length); 567 $('input[data-module-name=klarnapayments_' + payment_category + '_module]') 568 .click(function () { 569 initiateKlarnaWidget(kp_client_token, '#' + element.id, payment_category); 570 }) 571 .parents('.module_payment_container').click(function () { 572 initiateKlarnaWidget(kp_client_token, '#' + element.id, payment_category); 573 }); 574 } 575 576 $('#payment-confirmation > .ps-shown-by-js button').click(function(event) { 577 for (const element of klarna_options) { 578 const payment_category = element.id.substring(26, element.id.length); 579 if ($('input[data-module-name=klarnapayments_' + payment_category + '_module]').is(':checked')) { 580 event.preventDefault(); 581 setupKlarnaAuthCall(payment_category); 582 return; 583 } 584 } 585 }); 586 } 587 588 //redsysinsite - v2.2.2 - idnovate 589 if (typeof paymentList['redsysinsite'] !== typeof undefined) { 590 let _script = document.createElement('script'); 591 _script.type = 'text/javascript'; 592 _script.src = prestashop.urls.base_url + 'modules/redsysinsite/views/js/front.js'; 593 JqueryElement.append(_script); 594 } 595 596 //klarnapayment - v1.0.4 - Invertus 597 if (typeof paymentList['klarnapayment'] !== typeof undefined) { 598 let _script = document.createElement('script'); 599 _script.type = 'text/javascript'; 600 _script.src = prestashop.urls.base_url + 'modules/klarnapayment/views/js/front/payment/payment.js'; 601 JqueryElement.append(_script); 602 } 603 604 if (typeof prestashop !== typeof undefined && typeof prestashop.emit !== typeof undefined) { 605 prestashop.emit('steco_event_updated'); 606 } 607 608 //stripejs - v4.3.9 - NTS 609 if (typeof paymentList['stripejs'] !== typeof undefined && typeof stripe_allow_cards !== typeof undefined && typeof StripePubKey !== typeof undefined) { 610 let _script = document.createElement('script'); 611 _script.type = 'text/javascript'; 612 _script.src = prestashop.urls.base_url + 'modules/stripejs/views/js/stripe-prestashop.js'; 613 JqueryElement.append(_script); 614 } 615 616 //kf_paypal - v2.1.7 - KForge 617 if (typeof paymentList['kfpaypal'] !== typeof undefined) { 618 let _script = document.createElement('script'); 619 _script.type = 'text/javascript'; 620 _script.src = prestashop.urls.base_url + 'modules/kf_paypal/views/js/front.js'; 621 JqueryElement.append(_script); 622 } 623 624 //mollie - v5.0.1 - Mollie B.V. 625 if (typeof paymentList['mollie'] !== typeof undefined) { 626 let $mollieContainers = JqueryElement.find('.mollie-iframe-container'); 627 if ($mollieContainers.length) { 628 let _script = document.createElement('script'); 629 _script.type = 'text/javascript'; 630 _script.src = prestashop.urls.base_url + 'modules/mollie/views/js/front/mollie_iframe.js'; 631 JqueryElement.append(_script); 632 } 633 } 634 635 //a4pauthorizenet - v2.0.1 - Addons4Presta 636 if (typeof paymentList['a4pauthorizenet'] !== typeof undefined) { 637 let _script = document.createElement('script'); 638 _script.type = 'text/javascript'; 639 _script.src = prestashop.urls.base_url + '/modules/a4pauthorizenet/views/js/a4pauthorizenet.js'; 640 JqueryElement.append(_script); 641 } 642 643 //braintreejs - v3.1.2 - Bellini Services 644 if (typeof paymentList['braintreejs'] !== typeof undefined) { 645 if (typeof braintreeHostedSetup !== typeof undefined) { 646 braintreeHostedSetup(); 647 } else if (typeof braintreePaypalSetup !== typeof undefined) { 648 braintreePaypalSetup(); 649 } else if (typeof braintreeSetup !== typeof undefined) { 650 braintreeSetup(); 651 } 652 } 653 654 //support braintreeofficial: v1.2.5 - 202 ecommerce 655 if (typeof BraintreeSubmitPayment !== typeof undefined) { 656 var _script = document.createElement('script'); 657 _script.type = 'text/javascript'; 658 _script.src = prestashop.urls.base_url + 'modules/braintreeofficial/views/js/payment_bt.js';
659 JqueryElement.append(_script); 660 } else if (typeof BraintreePaypalSubmitPayment !== typeof undefined) { 661 var _script = document.createElement('script'); 662 _script.type = 'text/javascript'; 663 _script.src = prestashop.urls.base_url + 'modules/braintreeofficial/views/js/payment_pbt.js'; 664 JqueryElement.append(_script); 665 } 666 667 //support paypalplus: v1.2.3 - PixelWeb 668 if (typeof paymentList['paypalplus'] !== typeof undefined && typeof paypalplus !== typeof undefined) { 669 $(document).ready(_paypalplus.ready); 670 } 671 672 //revolutpayment - v2.2.4 - Revolut 673 if (typeof paymentList['revolutpayment'] !== typeof undefined) { 674 let _script = document.createElement('script'); 675 _script.type = 'text/javascript'; 676 _script.src = prestashop.urls.base_url + '/modules/revolutpayment/views/js/version17/revolut.payment.js'; 677 JqueryElement.append(_script); 678 679 let _script2 = document.createElement('script'); 680 _script2.type = 'text/javascript'; 681 _script2.src = prestashop.urls.base_url + '/modules/revolutpayment/views/js/upsell.banner.js'; 682 JqueryElement.append(_script2); 683 } 684 685 //smallpay - v4.0.0 - SmallPay Srl 686 if (typeof paymentList['smallpay'] !== typeof undefined) { 687 let _script = document.createElement('script'); 688 _script.type = 'text/javascript'; 689 _script.src = prestashop.urls.base_url + '/modules/smallpay/views/js/front.js'; 690 JqueryElement.append(_script); 691 } 692 693 //payoutloud - v1.2.2 - AdsOutLoud LLC 694 if (typeof paymentList['Google Pay'] !== typeof undefined && typeof paymentList['Apple Pay'] !== typeof undefined) { 695 let _script = document.createElement('script'); 696 _script.type = 'text/javascript'; 697 _script.src = prestashop.urls.base_url + '/modules/payoutloud/views/js/payment_request.js'; 698 JqueryElement.append(_script); 699 } 700 701 // verifone - v3.2.1 - Connectors Team - Verifone 702 if (typeof paymentList['verifone'] !== typeof undefined) { 703 let _script = document.createElement('script'); 704 _script.type = 'text/javascript'; 705 _script.src = prestashop.urls.base_url + '/modules/verifone/views/assets/js/iframe.js'; 706 JqueryElement.append(_script); 707 } 708 709 // windcavepayments - v2.0.2 - Windcave 710 if (typeof paymentList['windcavepayments'] !== typeof undefined) { 711 let _script = document.createElement('script'); 712 _script.type = 'text/javascript'; 713 _script.src = prestashop.urls.base_url + '/modules/windcavepayments/views/js/iframe_payment.js'; 714 JqueryElement.append(_script); 715 } 716 717 // stripe_official - v3.0.5 - Stripe - solo si es mayor a 3.0.4. 718 if (typeof paymentList['stripe_official'] !== typeof undefined && compareVersion(paymentList["stripe_official"], '3.0.4') === 1) { 719 window.stripe_official_loaded = false; 720 721 if (!window.stripe_official_loaded) { 722 $(document).on('change', '[data-module-name="stripe_official"]', function() { 723 window.stripe_official_loaded = true; 724 725 let _script = document.createElement('script'); 726 _script.type = 'text/javascript'; 727 _script.src = prestashop.urls.base_url + '/modules/stripe_official/views/js/checkout.js'; 728 JqueryElement.append(_script); 729 730 const setTimeoutStripe = setTimeout(() => { 731 if (document.querySelector('[data-module-name="stripe_official"]').checked) { 732 const eventChange = new Event('change'); 733 document.querySelector('[data-module-name="stripe_official"]').dispatchEvent(eventChange); 734 735 clearTimeout(setTimeoutStripe); 736 } 737 }, 500); 738 }); 739 } 740 } 741 742 if (typeof window.StripeOfficialInitExpressCheckout === 'function') { 743 window.StripeOfficialInitExpressCheckout(JqueryElement); 744 } 745 746 //nexixpay - v7.0.5 - Nexi Payments SpA 747 if (typeof paymentList['nexixpay'] !== typeof undefined) { 748 let _script = document.createElement('script'); 749 _script.type = 'text/javascript'; 750 _script.src = prestashop.urls.base_url + '/modules/nexixpay/views/js/front_xpay.js';
751 JqueryElement.append(_script); 752 } 753 754 // paypal - v6.5.1 - 202 ecommerce 755 // fix paypal_mb y duplicate paypal-mark-container on AJAX reload 756 // Problema marks: en cada recarga AJAX del listado de pagos, shortcut-payment-step.tpl llama 757 // a Shortcut.addMarkTo() directamente Y shortcut-layout.tpl dispara initButton() que 758 // reactiva el listener 'paypal-after-init-shortcut-button' del primer render, causando 759 // que addMarkTo() se ejecute dos veces. Como addMarkTo en shortcut.js/bnpl.js no comprueba 760 // si ya existe un [paypal-mark-container], se añaden spans duplicados. 761 if (typeof paymentList['paypal'] !== typeof undefined) { 762 if (JqueryElement.find('#ppplus-mb').length > 0) { 763 let _script = document.createElement('script'); 764 _script.type = 'text/javascript'; 765 _script.src = prestashop.urls.base_url + '/modules/paypal/views/js/payment_mb.js?v=6.5.1'; 766 JqueryElement.append(_script); 767 } 768 // 1. Limpieza reactiva: eliminar [paypal-mark-container] duplicados ya añadidos al DOM 769 JqueryElement.find('[paypal-mark-container]').parent().each(function () { 770 const $marks = $(this).children('[paypal-mark-container]'); 771 if ($marks.length > 1) { 772 $marks.not(':first').remove(); 773 } 774 }); 775 776 // 2. Parche proactivo: sobreescribir addMarkTo de Shortcut y BNPL para limpiar 777 // antes de añadir, evitando duplicados en recargas futuras 778 ['Shortcut', 'BNPL'].forEach(function (objName) { 779 const obj = window[objName]; 780 if (obj && typeof obj.addMarkTo === 'function' && !obj._opcPatchedAddMarkTo) { 781 const _origAddMarkTo = obj.addMarkTo.bind(obj); 782 obj.addMarkTo = function (container, styles) { 783 if (container instanceof Element) { 784 container.querySelectorAll('[paypal-mark-container]').forEach(function (el) { 785 el.remove(); 786 }); 787 } 788 return _origAddMarkTo(container, styles); 789 }; 790 obj._opcPatchedAddMarkTo = true; 791 } 792 }); 793 794 // 3. Restaurar listeners de visibilidad de PayPal en el nuevo contenedor de pagos 795 // Problema: PaypalTools registra el listener 'input' en el contenedor de pagos original. 796 // Tras el reload AJAX ese contenedor es reemplazado, el listener queda en el nodo 797 // antiguo (desconectado del DOM), y la visibilidad de #payment-confirmation deja de 798 // actualizarse al seleccionar/deseleccionar PayPal. 799 if (typeof window.PaypalTools !== typeof undefined) { 800 const $newPaymentContainer = JqueryElement.find('.payment-options, .payment__list'); 801 const newContainer = $newPaymentContainer[0]; 802 803 if (typeof window.paypalToolsHiddenElemenList !== typeof undefined) { 804 // Eliminar referencias a nodos ya removidos del DOM 805 Object.keys(window.paypalToolsHiddenElemenList).forEach(function (key) { 806 window.paypalToolsHiddenElemenList[key] = window.paypalToolsHiddenElemenList[key].filter( 807 function (el) { return document.body.contains(el); } 808 ); 809 }); 810 // Sincronizar estado inicial de visibilidad 811 window.PaypalTools.hideElementTillChecked(); 812 // Re-vincular listener al nuevo contenedor de pagos 813 if (newContainer instanceof Element) { 814 newContainer.addEventListener('input', window.PaypalTools.hideElementTillChecked); 815 } 816 } 817
818 if (typeof window.paypalToolsShowElemenList !== typeof undefined) { 819 // Eliminar referencias a nodos ya removidos del DOM 820 Object.keys(window.paypalToolsShowElemenList).forEach(function (key) { 821 window.paypalToolsShowElemenList[key] = window.paypalToolsShowElemenList[key].filter( 822 function (el) { return document.body.contains(el); } 823 ); 824 }); 825 // Sincronizar estado inicial de visibilidad 826 window.PaypalTools.showElementsIfChecked(); 827 // Re-vincular listener al nuevo contenedor de pagos 828 if (newContainer instanceof Element) { 829 newContainer.addEventListener('input', window.PaypalTools.showElementsIfChecked); 830 } 831 } 832 } 833 } 834 835 // tfauthorizedotnet - v7.2.0 - presta_world 836 if (typeof paymentList['tfauthorizedotnet'] !== typeof undefined) { 837 let _script = document.createElement('script'); 838 _script.type = 'text/javascript'; 839 _script.src = prestashop.urls.base_url + 'modules/tfauthorizedotnet/views/js/front/DatPayment.js'; 840 JqueryElement.append(_script); 841 } 842 843 // mercadopago - v4.14.0 - mercadopago 844 // El estandar checkout debe ir sin el modal activo. 845 if (typeof paymentList['mercadopago'] !== typeof undefined) { 846 if (typeof loadCustom !== typeof undefined) { 847 loadCustom(); 848 } 849 } 850 851 // bridge - v1.0.13 - 202 ecommerce 852 if (typeof paymentList['bridge'] !== typeof undefined) { 853 let _script = document.createElement('script'); 854 _script.type = 'text/javascript'; 855 _script.src = prestashop.urls.base_url + '/modules/bridge/views/js/front/front.js'; 856 JqueryElement.append(_script); 857 } 858 859 // wkcodextrafee - v7.0.1 - wkcodextrafee 860 if (typeof paymentList['wkcodextrafee'] !== typeof undefined) { 861 let _script = document.createElement('script'); 862 _script.type = 'text/javascript'; 863 _script.src = prestashop.urls.base_url + '/modules/wkcodextrafee/views/js/wkcodpayment.js'; 864 JqueryElement.append(_script); 865 } 866 867 // everypay - v8.0.1 - everypay 868 if (typeof paymentList['everypay'] !== typeof undefined && typeof EVERYPAY !== typeof undefined && typeof EVERYPAY.init !== typeof undefined) { 869 EVERYPAY.init(); 870 } 871 872 if (Object.keys(OPC.Compatibilities).length > 0) { 873 if (typeof OPC.Compatibilities.orderfees_payment !== typeof undefined) { 874 JqueryElement.find('input[name="payment-option"]').on('change', () => { 875 prestashop.emit('opc-cart-getCartSummary', {loadPayment: false, loadShipping: false}) 876 }); 877 } 878 } 879 }); 880 881 prestashop.on('opc-payment-toggleOrderButton-after', (params) => { 882 const { JqueryElement, selectedOption, confirmationSelector, showConfirmationSelector } = params; 883 884 //wkpaymentfee - v6.1.1 - Webkul 885 if (typeof managePaymentFeeForMethod !== typeof undefined) { 886 managePaymentFeeForMethod(JqueryElement.find('input[name="payment-option"]:checked')); 887 } 888 889 //ps_checkout - v2.15.4 - PrestaShop 890 if (typeof window.ps_checkout !== typeof undefined && typeof JqueryElement !== typeof undefined) { 891 JqueryElement.find('.js-payment-binary #btn-placer_order').show(); 892 } 893 894 // paypal - v6.2.1 - 202 ecommerce 895 const paypalEcWrongButtonMessage = JqueryElement.find('[paypal-ec-wrong-button-message]'); 896 if (paypalEcWrongButtonMessage.length > 0) { 897 if (JqueryElement.find('input[name="payment-option"]:checked').attr("data-module-name") === 'paypal') { 898 JqueryElement.find(confirmationSelector + ' button').on('click', function(){ 899 event.preventDefault(); 900 event.stopPropagation(); 901 paypalEcWrongButtonMessage.show(); 902 }); 903 } else { 904 JqueryElement.find(confirmationSelector + ' button').off('click'); 905 } 906 } 907 908 //ets_payment_with_fee - v2.2.9 - ETS-Soft. 909 if (typeof ets_cookie_module_name !== typeof undefined) { 910 ets_cookie_payment_option = false;
911 ajaxChangePaymentMethod = function (){}; 912 913 if (typeof ajaxChangePaymentMethodOPC !== typeof undefined) { 914 ajaxChangePaymentMethodOPC(params); 915 } else { 916 ajaxChangePaymentMethodOPC = function(params) { 917 const { JqueryElement, selectedOption } = params; 918 919 if (typeof selectedOption !== typeof undefined) { 920 const $paymentSelected = JqueryElement.find('input[name="payment-option"]:checked'); 921 const moduleName = $paymentSelected.data('module-name'); 922 let paymentMethodId = 0; 923 924 if (JqueryElement.find('#pay-with-' + selectedOption + '-form input[name="id_payment_method"]').length > 0) { 925 paymentMethodId = JqueryElement.find('#pay-with-' + selectedOption + '-form input[name="id_payment_method"]').val(); 926 } 927 928 $.ajax({ 929 url: '', 930 data: 'ets_set_payment_option=1&module_name=' + moduleName + '&id_payment_method=' + paymentMethodId + '&payment_option=' + selectedOption, 931 type: 'post', 932 dataType: 'json', 933 beforeSend: function () { 934 JqueryElement.append($('<div class="loading-opc"/>')); 935 }, 936 complete: function () { 937 JqueryElement.find('.loading-opc').remove(); 938 } 939 }); 940 } 941 }; 942 943 ajaxChangePaymentMethodOPC(params); 944 } 945 } 946 947 //hipay_enterprise - v2.17.0 - HiPay 948 if (typeof setSelectedPaymentMethod !== typeof undefined) { 949 setSelectedPaymentMethod(); 950 } 951 952 //revolutpayment - v2.2.4 - Revolut 953 if (typeof JqueryElement.find('input#' + selectedOption) !== typeof undefined) { 954 if (JqueryElement.find('input#' + selectedOption).data('module-name') === 'Revolut Pay - Get Cashback' 955 || (JqueryElement.find('input#' + selectedOption).val() === 'revolutpayment' 956 && JqueryElement.find('input#' + selectedOption).closest('.module_payment_container').find('#revolutPayForm button').length > 0 957 ) 958 ) { 959 JqueryElement.find(confirmationSelector + ' button').addClass('revolut_hide'); 960 } else if (showConfirmationSelector) { 961 JqueryElement.find(confirmationSelector + ' button').removeClass('revolut_hide'); 962 } 963 } 964 965 // paypalfeeplus - v1.3.0 - idnovate 966 if (typeof movePPFPElements !== typeof undefined) { 967 setInterval(() => { 968 movePPFPElements(); 969 }, 1000); 970 } 971 }); 972 973 prestashop.on('opc-payment-toggleOrderButton-validation', (params) => { 974 const { JqueryElementMain, JqueryElement, JqueryElementShipping, confirmationAlertSelector } = params; 975 976 const extraContentCarrierSelected = JqueryElementShipping.find('.delivery_option_radio:checked').parents('.delivery-option').next(); 977 978 //Reset 979 if (intervalPaymentToggleOrderButtonValidation !== null) { 980 clearInterval(intervalPaymentToggleOrderButtonValidation); 981 } 982 JqueryElement.data('opc-payment-toggleOrderButton-validation', true); 983 984 if (JqueryElementMain.find('#notifications > .alert').length > 0) { 985 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 986 $(confirmationAlertSelector).text(JqueryElementMain.find('#notifications > .alert').text()); 987 } 988 989 // correosexpress - v5.5.2 - IT Department 990 const $elementCEX = $('#CEX'); 991 if ($elementCEX.length > 0) { 992 const hasOfficeProduct = $('input[name*=delivery_option]:checked').attr('producto'); 993 if (hasOfficeProduct !== undefined) { 994 if ($elementCEX.find('#texto_producto').length > 0) { 995 JqueryElement.data('opc-payment-toggleOrderButton-validation', true); 996 } else { 997 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 998 $(confirmationAlertSelector).text(OPC.Message.pickupStoreRequired); 999 } 1000 } 1001 } 1002 1003 // gelproximity - v1.2.9 - iModuli.it 1004 if (typeof gelprx_conf !== typeof undefined && $('#gelproximity-app-no-pick-point-selected').length > 0) { 1005 $(confirmationAlertSelector).text(OPC.Message.pickupStoreRequired); 1006 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 1007 } 1008 1009 //slmshipping - v1.0.3 - de Skroutz 1010 if (typeof _skroutzPointsMapWidgetOptions !== typeof undefined) { 1011 if ($('[data-target="#SkroutzMapModal"]').is(':visible')) { 1012 const skroutzPointId = jQuery('[name="skroutz_point_id"]').val(); 1013 1014 if ($.trim(skroutzPointId) == '' || $.trim(skroutzPointId) == null) { 1015 $(confirmationAlertSelector).text(OPC.Message.pickupStoreRequired); 1016 1017 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 1018 } 1019 } 1020 } 1021 1022 /* Smartpost Shipping - v1.2.13 - Mijora.lt */ 1023 if (typeof ItellaModule !== typeof undefined) { 1024 const deliveryIdSelected = JqueryElementShipping.find('.delivery_option_radio:checked').val(); 1025 if (deliveryIdSelected == itella_carrier_pickup_id + ',' && $('#itella_pickup_point_id').val() === '') { 1026 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 1027 1028 $(confirmationAlertSelector).text(OPC.Message.pickupStoreRequired); 1029 } 1030 } 1031 1032 /* Venipak Shipping - v1.1.5 - mijora.lt */ 1033 if (document.getElementById("mjvp-selected-terminal") !== null) { 1034 const selected_terminal = document.getElementById("mjvp-selected-terminal").value; 1035 1036 if ($('.mjvp-pp-container').is(':visible') && (selected_terminal == '' || selected_terminal == null || selected_terminal == 0)) { 1037 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 1038 1039 $(confirmationAlertSelector).text(OPC.Message.pickupStoreRequired); 1040 } 1041 } 1042 1043 /* Omniva Shipping - v2.0.20 - Mijora */ 1044 if (typeof omnivalt_params !== typeof undefined) { 1045 const deliveryIdSelected = JqueryElementShipping.find('.delivery_option_radio:checked').val(); 1046 1047 if (deliveryIdSelected == omnivalt_params.methods.omniva_terminal + ',' && $('select[name="omnivalt_parcel_terminal"]').val() == "") { 1048 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 1049 1050 $(confirmationAlertSelector).text(OPC.Message.pickupStoreRequired); 1051 } 1052 } 1053 1054 //glsshipping - v3.3.2 - GLS 1055 if (JqueryElementShipping.find('#parcelshopid').length > 0) { 1056 const parcelShopId = parseInt(JqueryElementShipping.find('#parcelshopid').val()); 1057 const deliveryIdSelected = parseInt(JqueryElementShipping.find('.delivery_option_radio:checked').val()); 1058 1059 if (parcelShopId === deliveryIdSelected && JqueryElementShipping.find('#parcel_codigo').val() === '') { 1060 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 1061 1062 $(confirmationAlertSelector).text(OPC.Message.pickupStoreRequired); 1063 1064 intervalPaymentToggleOrderButtonValidation = setInterval(function () { 1065 if (JqueryElementShipping.find('#parcel_codigo').val() !== '') { 1066 JqueryElement.find('input[name="payment-option"]:checked').trigger('click'); 1067 1068 clearInterval(intervalPaymentToggleOrderButtonValidation); 1069 } 1070 }, 1000); 1071 } else { 1072 JqueryElement.data('opc-payment-toggleOrderButton-validation', true); 1073 } 1074 } 1075 1076 //gmparcellocker - v1.4.1 - GreenMouseStudio.com 1077 if (typeof window.gmparcellockerStoreSelected !== typeof undefined) { 1078 if (!window.gmparcellockerStoreSelected) { 1079 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 1080 1081 $(confirmationAlertSelector).text(OPC.Message.pickupStoreRequired); 1082 1083 intervalPaymentToggleOrderButtonValidation = setInterval(function () { 1084 if (window.gmparcellockerStoreSelected) { 1085 JqueryElement.find('input[name="payment-option"]:checked').trigger('click'); 1086 1087 clearInterval(intervalPaymentToggleOrderButtonValidation); 1088 } 1089 }, 1000); 1090 } else { 1091 JqueryElement.data('opc-payment-toggleOrderButton-validation', true); 1092 } 1093 } 1094 1095 //samedaycourier - v1.4.22 - Sameday Courier 1096 if (typeof extraContentCarrierSelected.find('#locker_name').val() !== typeof undefined) { 1097 if (extraContentCarrierSelected.find('#locker_name').val() === '') { 1098 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 1099 1100 $(confirmationAlertSelector).text(OPC.Message.pickupStoreRequired); 1101 1102 intervalPaymentToggleOrderButtonValidation = setInterval(function () { 1103 if (extraContentCarrierSelected.find('#locker_name').val() !== '') { 1104 JqueryElement.find('input[name="payment-option"]:checked').trigger('click'); 1105 1106 clearInterval(intervalPaymentToggleOrderButtonValidation); 1107 } 1108 }, 1000); 1109 } else { 1110 JqueryElement.data('opc-payment-toggleOrderButton-validation', true); 1111 } 1112 } 1113 1114 //boxnow - v2.x - BoxNow 1115 if (extraContentCarrierSelected.find('#boxnow-map-container').length > 0) { 1116 const boxnowZipValue = extraContentCarrierSelected.find('.boxnow-zip').val(); 1117 if (typeof boxnowZipValue !== typeof undefined && boxnowZipValue === '') { 1118 JqueryElement.data('opc-payment-toggleOrderButton-validation', false); 1119 1120 $(confirmationAlertSelector).text(OPC.Message.pickupStoreRequired); 1121 1122 intervalPaymentToggleOrderButtonValidation = setInterval(function () { 1123 const updatedZipValue = extraContentCarrierSelected.find('.boxnow-zip').val(); 1124 if (typeof updatedZipValue !== typeof undefined && updatedZipValue !== '') { 1125 JqueryElement.find('input[name="payment-option"]:checked').trigger('click'); 1126 1127 clearInterval(intervalPaymentToggleOrderButtonValidation); 1128 } 1129 }, 1000); 1130 } else { 1131 JqueryElement.data('opc-payment-toggleOrderButton-validation', true); 1132 } 1133 } 1134 }); 1135 1136 // Cart - Events 1137 prestashop.on('opc-cart-getCartSummary-complete', (params) => { 1138 const { JqueryElement } = params; 1139 1140 // Actualiza el total del carrito del header si existe. 1141 if ($('.blockcart').length > 0) { 1142 const refreshURL = $('.blockcart').data('refresh-url'); 1143 1144 if (refreshURL !== '') { 1145 $.post(refreshURL, {}).then(function (response) { 1146 $('.blockcart').replaceWith($(response.preview).find('.blockcart')); 1147 }); 1148 } 1149 } 1150 1151 // darique - v3.0.10 - Silbersaiten 1152 if (typeof dariqueModule !== typeof undefined) { 1153 dariqueModule.initLoaderBlock(); 1154 dariqueModule.loadPresentsBlock(0, []); 1155 } 1156
1157 const carousels = document.querySelectorAll('.swiper-default-carousel'); 1158 if (carousels.length > 0 && typeof Swiper !== typeof undefined) { 1159 const defaultOptions = { 1160 pagination: { 1161 el: '.swiper-pagination-product', 1162 clickable: true, 1163 }, 1164 loop: false, 1165 speed: 600, 1166 lazy: { 1167 loadedClass: 'loaded', 1168 checkInView: true, 1169 }, 1170 watchOverflow: true, 1171 watchSlidesProgress: true, 1172 watchSlidesVisibility: true, 1173 navigation: { 1174 nextEl: '.swiper-button-next', 1175 prevEl: '.swiper-button-prev', 1176 }, 1177 slidesPerView: iqitTheme.pl_slider_p, 1178 slidesPerGroup: iqitTheme.pl_slider_p, 1179 breakpoints: { 1180 768: { 1181 slidesPerView: iqitTheme.pl_slider_t, 1182 slidesPerGroup: iqitTheme.pl_slider_t, 1183 }, 1184 992: { 1185 slidesPerView: iqitTheme.pl_slider_d, 1186 slidesPerGroup: iqitTheme.pl_slider_d, 1187 }, 1188 1200: { 1189 slidesPerView: iqitTheme.pl_slider_ld, 1190 slidesPerGroup: iqitTheme.pl_slider_ld, 1191 }, 1192 }, 1193 }; 1194 1195 if (iqitTheme.pl_crsl_autoplay) { 1196 defaultOptions.autoplay = { 1197 delay: 4500, 1198 disableOnInteraction: true, 1199 }; 1200 } 1201 1202 carousels.forEach(function(carousel) { 1203 let customOptions = {}; 1204 1205 const dataOptions = carousel.getAttribute('data-swiper_options'); 1206 1207 if (dataOptions) { 1208 try { 1209 customOptions = JSON.parse(dataOptions); 1210 } catch (err) { 1211 console.error('data swiper parse error', carousel, err); 1212 } 1213 } 1214 1215 const swiperOptions = Object.assign({}, defaultOptions, customOptions); 1216 new Swiper(carousel, swiperOptions); 1217 }); 1218 } 1219 }); 1220} 1221 1222window.addEventListener("load", function(){ 1223 // idxlopd - v3.12.2 - innovadeluxe 1224 // Insert necesario para el funcionamiento de la compatibilidad. 1225 // INSERT INTO `ps_idxlopd_compatible` (`id_button`, `name`, `text`, `controller`, `details`, `id_shop`) VALUES 1226 // ('btn-register', NULL, 'Crear cuenta', 'order', NULL, NULL), 1227 // ('btn-register-guest', NULL, 'Continuar como invitado', 'order', NULL, NULL); 1228 if (typeof makeButtonCompatible !== typeof undefined) { 1229 makeButtonCompatible(); 1230 } 1231});
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.