![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/app/code/Cnc/Catalog/view/frontend/web/js/product/ |
/** * Copyright (c) 2020 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com) All Rights Reserved. * https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * Cnc * Radosław Stępień <[email protected]> <[email protected]> */ define([ 'jquery', 'Ecombricks_InventoryCatalog/js/product/estimate/data', 'Magento_Checkout/js/model/shipping-rates-validator', 'Ecombricks_InventoryCatalog/js/product' ], function ($, data, shippingRatesValidator, product) { 'use strict'; return function (target) { return target.extend({ defaults: { template: 'Cnc_Catalog/product/estimate' }, initElement: function (element) { if (element.index !== 'address') { return this; } shippingRatesValidator.bindChangeHandlers(element.elems(), true, 2000); element.elems.subscribe(function (elems) { shippingRatesValidator.doElementBinding(elems[elems.length - 1], true, 2000); }); return this; }, initSource: function () { if (!this.source) { return this; } data.shippingAddress(this.source.shippingAddress); this.source.on('shippingAddress', (function (address) { data.shippingAddress(address); this.isEnabled(true); }).bind(this)); data.shippingAddress.subscribe(function () { if (data.shippingAddress._latestValue.postcode && data.shippingAddress._latestValue.postcode.length >= 5) { this.reloadSourceQuotes(); } }, this); return this; }, initProductForm: function () { data.request(product.getJson()); product.getForms().on('change', (function() { data.request(product.getJson()); }).bind(this)); data.request.subscribe(function () { if (this.isEnabled()) { this.reloadSourceQuotes(); } }, this); return this; } }); } });