Changeset 3286706
- Timestamp:
- 05/03/2025 11:00:16 AM (11 months ago)
- Location:
- art-woocommerce-order-one-click
- Files:
-
- 6 deleted
- 18 edited
- 1 copied
-
tags/3.1.8 (copied) (copied from art-woocommerce-order-one-click/trunk)
-
tags/3.1.8/.gitattributes (deleted)
-
tags/3.1.8/art-woo-order-one-click.php (modified) (1 diff)
-
tags/3.1.8/assets/js/awooc-public-script.js (modified) (4 diffs)
-
tags/3.1.8/assets/js/awooc-public-script.min.js (modified) (1 diff)
-
tags/3.1.8/classes/Prepare/Prepare.php (modified) (1 diff)
-
tags/3.1.8/classes/RequestProcessing/EmailModifier.php (modified) (2 diffs)
-
tags/3.1.8/package-lock.json (deleted)
-
tags/3.1.8/readme.txt (modified) (2 diffs)
-
tags/3.1.8/src (deleted)
-
tags/3.1.8/vendor/autoload.php (modified) (1 diff)
-
tags/3.1.8/vendor/composer/InstalledVersions.php (modified) (3 diffs)
-
tags/3.1.8/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/.gitattributes (deleted)
-
trunk/art-woo-order-one-click.php (modified) (1 diff)
-
trunk/assets/js/awooc-public-script.js (modified) (4 diffs)
-
trunk/assets/js/awooc-public-script.min.js (modified) (1 diff)
-
trunk/classes/Prepare/Prepare.php (modified) (1 diff)
-
trunk/classes/RequestProcessing/EmailModifier.php (modified) (2 diffs)
-
trunk/package-lock.json (deleted)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src (deleted)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/InstalledVersions.php (modified) (3 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
art-woocommerce-order-one-click/tags/3.1.8/art-woo-order-one-click.php
r3253620 r3286706 6 6 * Domain Path: /languages 7 7 * Description: Plugin for WooCommerce. It includes the catalog mode in the store (there are no prices and the Buy button) and can turn on the Buy/Order button in one click. WooCommerce and Contact Form 7 are required for proper operation. 8 * Version: 3.1. 78 * Version: 3.1.8 9 9 * Author: Artem Abramovich 10 10 * Author URI: https://wpruse.ru/ -
art-woocommerce-order-one-click/tags/3.1.8/assets/js/awooc-public-script.js
r3253607 r3286706 1164 1164 var swatch = e.target; 1165 1165 if (this.isSwatchSelected(swatch)) { 1166 this.deselectSwatch(swatch);1167 1166 this.resetButtonData(swatch); 1168 1167 } else { … … 1180 1179 return; 1181 1180 } 1182 button.disabled = true; 1183 button.classList.remove('cfvsw_variation_found'); 1184 button.dataset.selectedVariant = ''; 1181 var select = this.getSelectElement(swatch); 1182 var hasDefaultValue = (select === null || select === void 0 ? void 0 : select.value) && select.value !== ''; 1183 if (hasDefaultValue) { 1184 this.updateButtonData(swatch.closest('form')); 1185 } else { 1186 button.disabled = true; 1187 button.classList.remove('cfvsw_variation_found'); 1188 button.dataset.selectedVariant = ''; 1189 } 1185 1190 } 1186 1191 }, { … … 1191 1196 if (select) { 1192 1197 select.value = value; 1193 select.dispatchEvent(new Event('change')); 1198 setTimeout(function () { 1199 select.dispatchEvent(new CustomEvent('change', { 1200 bubbles: true 1201 })); 1202 }, 50); 1194 1203 } 1195 1204 } … … 1198 1207 value: function isSwatchSelected(swatch) { 1199 1208 return (!swatch.classList.contains('cfvsw-swatches-disabled') || !swatch.classList.contains('cfvsw-swatches-out-of-stock')) && swatch.classList.contains('cfvsw-selected-swatch'); 1200 }1201 }, {1202 key: "deselectSwatch",1203 value: function deselectSwatch(swatch) {1204 swatch.classList.remove('cfvsw-selected-swatch');1205 1209 } 1206 1210 }, { -
art-woocommerce-order-one-click/tags/3.1.8/assets/js/awooc-public-script.min.js
r3253607 r3286706 1 (()=>{"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var i=a.call(t,n||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function a(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function i(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=function(){return i((function e(){t(this,e),this.events={}}),[{key:"on",value:function(t,e){var n=this;this.events[t]||(this.events[t]=[]),this.events[t].push(e);var a=function(e){n.events[t].forEach((function(t){return t(e,e.detail)}))};this.events[t].listener=a,document.addEventListener(t,a)}},{key:"off",value:function(t,e){var n;this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})),null!==(n=this.events[t])&&void 0!==n&&n.length||(document.removeEventListener(t,this.events[t].listener),delete this.events[t].listener))}},{key:"trigger",value:function(t){var e=new CustomEvent(t,{detail:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}});document.dispatchEvent(e)}}])}(),r=awooc_scripts_settings,u=awooc_scripts_ajax,s=awooc_scripts_translate,c=function(){return i((function e(n){t(this,e),this.app=n,this.bindEvent()}),[{key:"bindEvent",value:function(){var t=this;document.addEventListener("click",(function(e){t.unBlock(e)}))}},{key:"showPopup",value:function(t){var e=this;jQuery.blockUI({message:r.template,css:r.popup.css,overlayCSS:r.popup.overlay,fadeIn:r.popup.fadeIn,fadeOut:r.popup.fadeOut,focusInput:r.popup.focusInput,bindEvents:!1,timeout:0,allowBodyStretch:!0,centerX:!0,centerY:!0,blockMsgClass:"blockMsg blockMsgAwooc",onBlock:function(){e.app.events.trigger("awooc_popup_open_trigger"),e.app.request.sendRequest(t)},onUnblock:function(){return e.app.events.trigger("awooc_popup_close_trigger")},onOverlayClick:function(){return document.documentElement.style.overflow="initial"}})}},{key:"unBlock",value:function(t){(t.target.classList.contains("awooc-close")||t.target.classList.contains("blockOverlay"))&&jQuery.unblockUI()}}])}(),l=function(){return i((function e(n){t(this,e),this.app=n,this.button=document.querySelectorAll("form.cart .awooc-button-js"),this.addToCartElements=document.querySelectorAll(".woocommerce-variation-add-to-cart .quantity, .woocommerce-variation-add-to-cart .single_add_to_cart_button"),this.disableClasses=["disabled","wc-variation-selection-needed"],this.disableClassesOutStock=["disabled","wc-variation-is-unavailable"]}),[{key:"init",value:function(){var t=this;document.addEventListener("click",(function(e){return t.handleShowPopup(e)})),jQuery(document.body).on("hide_variation",(function(){return t.toggleButtonClasses(t.button,"add",t.disableClasses)})).on("show_variation",(function(e,n,a){return t.updateButtonState(n,a)}))}},{key:"handleShowPopup",value:function(t){var e=t.target.closest(".awooc-button-js");if(e){if(e.classList.contains("disabled")){t.preventDefault();var n=e.classList.contains("wc-variation-is-unavailable")?wc_add_to_cart_variation_params.i18n_unavailable_text:wc_add_to_cart_variation_params.i18n_make_a_selection_text;return window.alert(n),!1}this.app.popup.showPopup(t)}}},{key:"updateButtonState",value:function(t,e){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||this.button;switch(r.mode){case"in_stock_add_to_card":this.handlePreloadMode(t,n);break;case"no_stock_no_price":this.handleSpecialMode(t,n);break;default:this.handleDefaultMode(e,n)}}},{key:"handlePreloadMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;t.backorders_allowed||!t.is_in_stock?(this.hideAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClassesOutStock)):(this.showAddToCartModule(),this.toggleButtonClasses(e,"add",this.disableClasses))}},{key:"handleSpecialMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;t.is_purchasable&&!t.is_in_stock?(this.hideAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClasses)):t.is_purchasable&&t.is_in_stock?(this.showAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClasses)):(this.showAddToCartModule(),this.toggleButtonClasses(e,"add",this.disableClasses))}},{key:"handleDefaultMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;this.toggleButtonClasses(e,t?"remove":"add",this.disableClassesOutStock)}},{key:"toggleButtonClasses",value:function(t,e,n){t||(t=this.button),t instanceof NodeList&&(t=Array.from(t)),Array.isArray(t)||(t=[t]),t.forEach((function(t){t&&t.classList&&n.forEach((function(n){"string"==typeof n&&t.classList[e](n)}))}))}},{key:"toggleModuleVisibility",value:function(t){this.addToCartElements.forEach((function(e){return e.classList[t]("awooc-hide")})),this.button.forEach((function(e){return e.classList[t]("no-margin")}))}},{key:"hideAddToCartModule",value:function(){this.toggleModuleVisibility("add")}},{key:"showAddToCartModule",value:function(){this.toggleModuleVisibility("remove")}}])}();function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=Array(e);n<e;n++)a[n]=t[n];return a}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var a,i,o,r,u=[],s=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(a=o.call(n)).done)&&(u.push(a.value),u.length!==e);s=!0);}catch(t){c=!0,i=t}finally{try{if(!s&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw i}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return d(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var f=function(){return i((function e(n,a,i){t(this,e),this.toMail=n,this.request=a,this.qtyVal="",this.cache=a.cache,this.event=i}),[{key:"bindEvent",value:function(){var t=document.querySelector(".awooc-popup-qty");if(t){var e=t.querySelector(".awooc-popup-input-qty");e&&this.initializeQuantityInput(e)}}},{key:"initializeQuantityInput",value:function(t){var e=this;this.setMaxValueInput(t),this.updateAll(),t.addEventListener("input",(function(t){return e.handleInputEvent(t)})),this.handlerPlusMinusButtonsEvent(t)}},{key:"handlerPlusMinusButtonsEvent",value:function(t){var e=this,n=document.querySelector(".awooc-popup-input-qty--minus"),a=document.querySelector(".awooc-popup-input-qty--plus");n&&a&&(n.addEventListener("click",(function(){return e.updateInputQuantity(t,"decrease")})),a.addEventListener("click",(function(){return e.updateInputQuantity(t,"increase")})))}},{key:"updateInputQuantity",value:function(t,e){var n=parseFloat(t.value),a=this.getSafeValue(t.step,1),i=this.getSafeValue(t.min,-1/0),o=this.getSafeValue(t.max,1/0),r=n+("decrease"===e?-a:a),u=Math.max(0,-Math.floor(Math.log10(a)));(r=parseFloat(r.toFixed(u)))>=i&&r<=o&&(t.value=r,t.dispatchEvent(new Event("input",{bubbles:!0})))}},{key:"handleInputEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e||(e=t.target.closest(".awooc-popup-input-qty")),e&&(this.setMaxValueInput(e),this.qtyVal=e.value,this.updateAll())}},{key:"setMaxValueInput",value:function(t){var e=this.getSafeValue(t.min,t.step),n=this.getSafeValue(t.max,t.value);t.value=Math.min(Math.max(parseFloat(String(t.value))||e,e),n),this.qtyVal=t.value}},{key:"updateAll",value:function(){this.updateMailQuantity(),this.updateAmount(),this.updateMailData(),this.updateProductQuantity(),this.updateAnalytics()}},{key:"updateMailQuantity",value:function(){this.toMail.qty="".concat(s.product_qty).concat(this.qtyVal)}},{key:"updateMailData",value:function(){var t=document.querySelector('input[name="awooc-hidden-data"]');t&&(t.value=this.request.fillDataToMail(this.toMail))}},{key:"updateAnalytics",value:function(){this.request.app.analyticData.qty=this.qtyVal}},{key:"updateProductQuantity",value:function(){var t=document.querySelector('input[name="awooc_product_qty"]');t&&(t.value=this.qtyVal)}},{key:"updateAmount",value:function(){var t=this.getPrice();if(t){var e=this.displayPrice(this.parsePrice(t)*this.qtyVal);this.updateDOMAmount(e),this.updateMailAmount()}}},{key:"getPrice",value:function(){var t,e=document.querySelector(".awooc-popup-price .woocommerce-Price-currencyValue");return(null==e||null===(t=e.textContent)||void 0===t?void 0:t.replace(/\s+/g,""))||null}},{key:"getSafeValue",value:function(t,e){return""===t||Number.isNaN(parseFloat(t))?e:parseFloat(t)}},{key:"getPriceSettings",value:function(){var t=r.popup,e=t.price_num_decimals,n=void 0===e?0:e,a=t.price_decimal_sep,i=void 0===a?".":a,o=t.price_thousand_sep;return{decimalPlaces:n||0,decimalSeparator:i||".",thousandSeparator:(void 0===o?"":o)||""}}},{key:"displayPrice",value:function(t){var e=String(t).replace(/[^0-9.]/g,""),n=parseFloat(e);if(isNaN(n))return"Invalid number";var a=this.getPriceSettings(),i=a.decimalPlaces,o=a.decimalSeparator,r=a.thousandSeparator,u=p(String(n.toFixed(i)).split("."),2),s=u[0],c=u[1],l=s.replace(/\B(?=(\d{3})+(?!\d))/g,r),d=i>0?c.padEnd(i,"0").slice(0,i):"";return i>0&&d?"".concat(l).concat(o).concat(d):l}},{key:"parsePrice",value:function(t){t=null!=t?t:0;var e=this.getPriceSettings(),n=e.decimalPlaces,a=e.decimalSeparator,i=e.thousandSeparator,o=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")};if("number"!=typeof t&&(t=String(t),[i," ",".",","].filter(Boolean).forEach((function(e){e!==a&&(t=t.replace(new RegExp(o(e),"g"),""))})),"."!==a&&(t=t.replace(new RegExp(o(a),"g"),".")),t=t.replace(/\.+(?![^.]+$)|[^0-9.-]/g,"")),t=parseFloat(t)||0,!1!==n){var r=""===String(n)?2:parseInt(n,10);return t.toFixed(r)}return t.toFixed(20)}},{key:"updateDOMAmount",value:function(t){var e=document.querySelector(".awooc-popup-sum .woocommerce-Price-currencyValue");e&&(e.textContent=t)}},{key:"updateMailAmount",value:function(){var t=document.querySelector(".awooc-popup-sum bdi");t?this.toMail.sum="".concat(s.formatted_sum).concat(t.textContent):delete this.toMail.sum}}])}();function v(t,e,a){return(e=n(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){v(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var m,w=function(){return i((function e(n){t(this,e),this.request=n,this.defaultAttributes={}}),[{key:"collectData",value:function(t){var e=this.getBaseData(t);return this.setAttributesOnCatalog(t,e),this.serializeFormData(t,e),e}},{key:"getBaseData",value:function(t){return{id:this.request.getProductID(t),action:"awooc_ajax_product_form",nonce:u.nonce,attributes:y({},this.defaultAttributes)}}},{key:"setAttributesOnCatalog",value:function(t,e){e.attributes=y({},this.defaultAttributes);var n=t.target.dataset.selectedVariant;n&&(e.attributes=JSON.parse(n))}},{key:"serializeFormData",value:function(t,e){var n=t.target.closest(".cart");n&&(e.attributes=y({},this.defaultAttributes),this.processFormData(new FormData(n),e))}},{key:"processFormData",value:function(t,e){var n=this;t.forEach((function(t,a){n.updateDataField(e,a,t),a.startsWith("attribute_")&&n.updateDataField(e.attributes,a,t)})),delete e["add-to-cart"]}},{key:"updateDataField",value:function(t,e,n){t[e]=t[e]?[].concat(t[e],n):n}}])}(), g=function(){return i((function e(n){t(this,e),this.app=n,this.$=this.app.$,this.dataCollector=new w(this)}),[{key:"sendRequest",value:function(t){var e=this,n=this.dataCollector.collectData(t);this.app.xhr=this.$.ajax({url:u.url,data:n,type:"POST",dataType:"json",success:function(n){return e.handleSuccessResponse(n,t)},error:function(t){return e.handleErrorResponse(t)}})}},{key:"getProductID",value:function(t){var e,n=t.target.closest(".variations_form"),a=null==n||null===(e=n.querySelector('input[name="variation_id"]'))||void 0===e?void 0:e.value;return null!=a?a:t.target.dataset.valueProductId}},{key:"handleSuccessResponse",value:function(t,e){this.removeSkeleton();var n=t.data,a=n.toMail,i=n.toPopup,o=n.toAnalytics;this.fillDataToPopup(i),this.fillHiddenFormFields(a,e),new f(a,this,e).bindEvent(),this.app.analyticData=o,this.initUI(),this.closeMagnificPopup(),this.app.events.trigger("awooc_popup_ajax_trigger",t)}},{key:"handleErrorResponse",value:function(t){t.responseJSON&&console.error(t.responseJSON.data)}},{key:"fillDataToMail",value:function(t){return"\n".concat(s.product_data_title,"\n———\n").concat(Object.values(t).join("\n"))}},{key:"fillDataToPopup",value:function(t){Object.entries(t).forEach((function(t){var e=p(t,2),n=e[0],a=e[1],i=document.querySelector(".awooc-popup-".concat(n));i&&(i.innerHTML=a)}))}},{key:"fillHiddenFormFields",value:function(t,e){this.updateField("awooc_product_id",this.getProductID(e)),this.updateField("awooc_product_qty",this.getQty()),this.updateField("awooc-hidden-data",this.fillDataToMail(t))}},{key:"updateField",value:function(t,e){var n=document.querySelector('input[name="'.concat(t,'"]'));n&&(n.value=e)}},{key:"initUI",value:function(){this.app.form.initContactForm(),this.app.form.initMask()}},{key:"removeSkeleton",value:function(){document.querySelectorAll(".awooc-popup-inner .awooc-popup-item").forEach((function(t){t.classList.remove("skeleton-loader")}))}},{key:"closeMagnificPopup",value:function(){var t;null!==(t=this.$.magnificPopup)&&void 0!==t&&t.instance&&this.$.magnificPopup.close()}},{key:"getQty",value:function(){var t=document.querySelector('.quantity input[name="quantity"]');return t?t.value:1}}])}(),b=function(){return i((function e(n){t(this,e),this.app=n;var a=r.popup,i=a.cf7_form_id,o=a.mailsent_timeout,u=a.invalid_timeout;this.formId=Number(i),this.mailsentTimeout=o,this.invalidTimeout=u}),[{key:"init",value:function(){this.bindEvents()}},{key:"bindEvents",value:function(){var t=this;document.addEventListener("wpcf7mailsent",(function(e){return t.handleMailSent(e)})),document.addEventListener("wpcf7invalid",(function(e){return t.handleInvalid(e)})),this.app.events.on("awooc_popup_ajax_trigger",(function(){return t.setupFormSubmitListener()}))}},{key:"setupFormSubmitListener",value:function(){var t=this,e=document.querySelector("form.wpcf7-form");e&&e.addEventListener("submit",(function(e){return t.handleFormSubmit(e)}))}},{key:"handleMailSent",value:function(t){var e=t.detail;setTimeout((function(){return jQuery.unblockUI()}),this.mailsentTimeout),this.formId===e.contactFormId&&this.app.events.trigger("awooc_mail_sent_trigger",{selectedProduct:this.app.analyticData,mailDetail:e})}},{key:"handleInvalid",value:function(t){var e=this,n=t.detail;this.formId===n.contactFormId&&this.app.events.trigger("awooc_mail_invalid_trigger"),setTimeout((function(){return e.clearFormErrors()}),this.invalidTimeout)}},{key:"clearFormErrors",value:function(){var t=document.querySelector(".awooc-form-custom-order .wpcf7-response-output"),e=document.querySelectorAll(".awooc-form-custom-order .wpcf7-not-valid-tip"),n=document.querySelector('.awooc-form-custom-order input[type="submit"]');t&&(t.innerHTML=""),n&&(n.disabled=!1),e.forEach((function(t){return t.remove()}))}},{key:"handleFormSubmit",value:function(t){var e=t.currentTarget.querySelector('input[type="submit"]');e&&(e.disabled=!0)}},{key:"initContactForm",value:function(){var t=this;document.querySelectorAll(".awooc-form-custom-order div.wpcf7 > form").forEach((function(e){var n=e.querySelector('input[name="_wpcf7_version"]');n&&(n.value&&n.value<="5.4"?t.initOldWpcf7(e):wpcf7.init(e))}))}},{key:"initOldWpcf7",value:function(t){wpcf7.initForm(t),wpcf7.cached&&wpcf7.refill(t)}},{key:"initMask",value:function(){document.querySelectorAll(".awooc-form-custom-order .wpcf7-mask").forEach((function(t){var e=jQuery(t).data("mask");if(e)try{jQuery(t).mask(e),/[a*]/.test(e)||t.setAttribute("inputmode","numeric")}catch(t){console.error("Error ".concat(t.name,": ").concat(t.message,"\n").concat(t.stack))}}))}}])}(),k=function(){return i((function e(n){t(this,e),this.app=n,this.variationForms=document.querySelectorAll(".cfvsw_variations_form, form.variations_form"),this.buttons=this.getButtons()}),[{key:"getButtons",value:function(){return Array.from(this.variationForms).map((function(t){return t.closest("li")})).filter((function(t){return null!==t})).flatMap((function(t){return Array.from(t.querySelectorAll(".awooc-button-js"))}))}},{key:"init",value:function(){this.variationForms.length<0||(this.addedToButtonAttributes(),this.disableButtons(),this.bindEvents())}},{key:"bindEvents",value:function(){var t=this;document.addEventListener("cfvswVariationLoad",(function(){return t.addedToButtonAttributes()})),document.addEventListener("astraInfinitePaginationLoaded",(function(){return t.addedToButtonAttributes()})),document.querySelectorAll(".cfvsw-swatches-option").forEach((function(e){e.addEventListener("click",(function(e){return t.onClickSwatchesOption(e)}))}))}},{key:"addedToButtonAttributes",value:function(){var t=this;this.variationForms.forEach((function(e){jQuery(e).wc_variation_form(),e.dataset.cfvswCatalog||jQuery(e).on("found_variation",(function(){return t.updateButtonData(e)}))}))}},{key:"updateButtonData",value:function(t){var e,n=t.querySelectorAll(".variations select"),a={},i=null===(e=t.closest("li"))||void 0===e?void 0:e.querySelector(".awooc-button-js");n.forEach((function(t){var e=t.dataset.attributeName||t.name;a[e]=t.value||""})),i&&(i.disabled=!1,i.classList.add("cfvsw_variation_found"),i.dataset.selectedVariant=JSON.stringify(a))}},{key:"onClickSwatchesOption",value:function(t){var e=t.target;this.isSwatchSelected(e)?(this.deselectSwatch(e),this.resetButtonData(e)):(this.deselectAllSwatches(e),this.selectSwatch(e)),this.updateSelectOption(e)}},{key:"resetButtonData",value:function(t){var e,n=null===(e=t.closest("li"))||void 0===e?void 0:e.querySelector(".awooc-button-js");n&&(n.disabled=!0,n.classList.remove("cfvsw_variation_found"),n.dataset.selectedVariant="")}},{key:"updateSelectOption",value:function(t){var e=this.getSwatchValue(t),n=this.getSelectElement(t);n&&(n.value=e,n.dispatchEvent(new Event("change")))}},{key:"isSwatchSelected",value:function(t){return(!t.classList.contains("cfvsw-swatches-disabled")||!t.classList.contains("cfvsw-swatches-out-of-stock"))&&t.classList.contains("cfvsw-selected-swatch")}},{key:"deselectSwatch",value:function(t){t.classList.remove("cfvsw-selected-swatch")}},{key:"deselectAllSwatches",value:function(t){t.parentElement.querySelectorAll(".cfvsw-swatches-option").forEach((function(t){return t.classList.remove("cfvsw-selected-swatch")}))}},{key:"selectSwatch",value:function(t){t.classList.add("cfvsw-selected-swatch")}},{key:"getSwatchValue",value:function(t){return this.isSwatchSelected(t)?t.dataset.slug:""}},{key:"getSelectElement",value:function(t){var e;return null===(e=t.closest(".cfvsw-swatches-container"))||void 0===e||null===(e=e.previousElementSibling)||void 0===e?void 0:e.querySelector("select")}},{key:"disableButtons",value:function(){this.buttons.forEach((function(t){return t.disabled=!0}))}}])}(),S=function(){return i((function e(n){t(this,e),this.app=n}),[{key:"init",value:function(){var t=this;jQuery(document.body).on("woodmart-quick-view-displayed",(function(){var e=document.querySelector(".product.quick-shop-loaded form.cart .awooc-button-js");e&&jQuery(".product.quick-shop-loaded").find(".variations_form").on("hide_variation",(function(){return t.app.buttons.toggleButtonClasses([e],"add",t.app.buttons.disableClasses)})).on("show_variation",(function(n,a,i){return t.app.buttons.updateButtonState(a,i,[e])}))}))}}])}(),_=function(){return i((function e(n){t(this,e),this.validateGlobals()&&(this.$=n,this.xhr=!1,this.analyticData={},this.events=new o,this.popup=new c(this),this.buttons=new l(this),this.request=new g(this),this.form=new b(this),this.variationSwatches=new k(this),this.woodmart=new S(this),this.init())}),[{key:"init",value:function(){this.buttons.init(),this.form.init(),this.variationSwatches.init(),this.woodmart.init()}},{key:"validateGlobals",value:function(){var t={awooc_scripts_ajax:"awooc_scripts_ajax not found",awooc_scripts_translate:"awooc_scripts_translate not found",awooc_scripts_settings:"awooc_scripts_settings not found",wpcf7:"На странице не существует объекта wpcf7. Что-то не так с темой..."};for(var e in t)if(void 0===window[e]||null===window[e])return console.warn(t[e]),!1;return!0}}])}();(function(t){var e="awooc_",n=t.fn.on,a=t.fn.trigger;t.fn.on=function(t,a,i,o){return"function"==typeof a?(o=a,a=void 0,i=void 0):"function"==typeof i&&(o=i,i=void 0),"string"==typeof t&&t.startsWith(e)&&o?n.call(this,t,a,i,(function(e){o.length>1&&console.warn("[WARNING] '".concat(t,"' передает данные через event.detail, но обработчик ожидает data. Используйте event.detail вместо второго аргумента.")),o.call(this,e,e.detail)})):n.apply(this,arguments)},t.fn.trigger=function(t,n){if("string"==typeof t&&t.startsWith(e)){var i=new CustomEvent(t,{detail:n});return document.dispatchEvent(i),this}return a.apply(this,arguments)},document.addEventListener(e,(function(n){n.type.startsWith(e)&&t(document).triggerHandler(n.type,n.detail)}),!0)})(m=jQuery),m(document).ready((function(){window.AwoocAppCore||(window.AwoocAppCore=new _(m))}))})();1 (()=>{"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var i=a.call(t,n||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function a(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function i(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=function(){return i((function e(){t(this,e),this.events={}}),[{key:"on",value:function(t,e){var n=this;this.events[t]||(this.events[t]=[]),this.events[t].push(e);var a=function(e){n.events[t].forEach((function(t){return t(e,e.detail)}))};this.events[t].listener=a,document.addEventListener(t,a)}},{key:"off",value:function(t,e){var n;this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})),null!==(n=this.events[t])&&void 0!==n&&n.length||(document.removeEventListener(t,this.events[t].listener),delete this.events[t].listener))}},{key:"trigger",value:function(t){var e=new CustomEvent(t,{detail:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}});document.dispatchEvent(e)}}])}(),r=awooc_scripts_settings,u=awooc_scripts_ajax,s=awooc_scripts_translate,c=function(){return i((function e(n){t(this,e),this.app=n,this.bindEvent()}),[{key:"bindEvent",value:function(){var t=this;document.addEventListener("click",(function(e){t.unBlock(e)}))}},{key:"showPopup",value:function(t){var e=this;jQuery.blockUI({message:r.template,css:r.popup.css,overlayCSS:r.popup.overlay,fadeIn:r.popup.fadeIn,fadeOut:r.popup.fadeOut,focusInput:r.popup.focusInput,bindEvents:!1,timeout:0,allowBodyStretch:!0,centerX:!0,centerY:!0,blockMsgClass:"blockMsg blockMsgAwooc",onBlock:function(){e.app.events.trigger("awooc_popup_open_trigger"),e.app.request.sendRequest(t)},onUnblock:function(){return e.app.events.trigger("awooc_popup_close_trigger")},onOverlayClick:function(){return document.documentElement.style.overflow="initial"}})}},{key:"unBlock",value:function(t){(t.target.classList.contains("awooc-close")||t.target.classList.contains("blockOverlay"))&&jQuery.unblockUI()}}])}(),l=function(){return i((function e(n){t(this,e),this.app=n,this.button=document.querySelectorAll("form.cart .awooc-button-js"),this.addToCartElements=document.querySelectorAll(".woocommerce-variation-add-to-cart .quantity, .woocommerce-variation-add-to-cart .single_add_to_cart_button"),this.disableClasses=["disabled","wc-variation-selection-needed"],this.disableClassesOutStock=["disabled","wc-variation-is-unavailable"]}),[{key:"init",value:function(){var t=this;document.addEventListener("click",(function(e){return t.handleShowPopup(e)})),jQuery(document.body).on("hide_variation",(function(){return t.toggleButtonClasses(t.button,"add",t.disableClasses)})).on("show_variation",(function(e,n,a){return t.updateButtonState(n,a)}))}},{key:"handleShowPopup",value:function(t){var e=t.target.closest(".awooc-button-js");if(e){if(e.classList.contains("disabled")){t.preventDefault();var n=e.classList.contains("wc-variation-is-unavailable")?wc_add_to_cart_variation_params.i18n_unavailable_text:wc_add_to_cart_variation_params.i18n_make_a_selection_text;return window.alert(n),!1}this.app.popup.showPopup(t)}}},{key:"updateButtonState",value:function(t,e){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||this.button;switch(r.mode){case"in_stock_add_to_card":this.handlePreloadMode(t,n);break;case"no_stock_no_price":this.handleSpecialMode(t,n);break;default:this.handleDefaultMode(e,n)}}},{key:"handlePreloadMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;t.backorders_allowed||!t.is_in_stock?(this.hideAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClassesOutStock)):(this.showAddToCartModule(),this.toggleButtonClasses(e,"add",this.disableClasses))}},{key:"handleSpecialMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;t.is_purchasable&&!t.is_in_stock?(this.hideAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClasses)):t.is_purchasable&&t.is_in_stock?(this.showAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClasses)):(this.showAddToCartModule(),this.toggleButtonClasses(e,"add",this.disableClasses))}},{key:"handleDefaultMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;this.toggleButtonClasses(e,t?"remove":"add",this.disableClassesOutStock)}},{key:"toggleButtonClasses",value:function(t,e,n){t||(t=this.button),t instanceof NodeList&&(t=Array.from(t)),Array.isArray(t)||(t=[t]),t.forEach((function(t){t&&t.classList&&n.forEach((function(n){"string"==typeof n&&t.classList[e](n)}))}))}},{key:"toggleModuleVisibility",value:function(t){this.addToCartElements.forEach((function(e){return e.classList[t]("awooc-hide")})),this.button.forEach((function(e){return e.classList[t]("no-margin")}))}},{key:"hideAddToCartModule",value:function(){this.toggleModuleVisibility("add")}},{key:"showAddToCartModule",value:function(){this.toggleModuleVisibility("remove")}}])}();function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=Array(e);n<e;n++)a[n]=t[n];return a}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var a,i,o,r,u=[],s=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(a=o.call(n)).done)&&(u.push(a.value),u.length!==e);s=!0);}catch(t){c=!0,i=t}finally{try{if(!s&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw i}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return d(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var f=function(){return i((function e(n,a,i){t(this,e),this.toMail=n,this.request=a,this.qtyVal="",this.cache=a.cache,this.event=i}),[{key:"bindEvent",value:function(){var t=document.querySelector(".awooc-popup-qty");if(t){var e=t.querySelector(".awooc-popup-input-qty");e&&this.initializeQuantityInput(e)}}},{key:"initializeQuantityInput",value:function(t){var e=this;this.setMaxValueInput(t),this.updateAll(),t.addEventListener("input",(function(t){return e.handleInputEvent(t)})),this.handlerPlusMinusButtonsEvent(t)}},{key:"handlerPlusMinusButtonsEvent",value:function(t){var e=this,n=document.querySelector(".awooc-popup-input-qty--minus"),a=document.querySelector(".awooc-popup-input-qty--plus");n&&a&&(n.addEventListener("click",(function(){return e.updateInputQuantity(t,"decrease")})),a.addEventListener("click",(function(){return e.updateInputQuantity(t,"increase")})))}},{key:"updateInputQuantity",value:function(t,e){var n=parseFloat(t.value),a=this.getSafeValue(t.step,1),i=this.getSafeValue(t.min,-1/0),o=this.getSafeValue(t.max,1/0),r=n+("decrease"===e?-a:a),u=Math.max(0,-Math.floor(Math.log10(a)));(r=parseFloat(r.toFixed(u)))>=i&&r<=o&&(t.value=r,t.dispatchEvent(new Event("input",{bubbles:!0})))}},{key:"handleInputEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e||(e=t.target.closest(".awooc-popup-input-qty")),e&&(this.setMaxValueInput(e),this.qtyVal=e.value,this.updateAll())}},{key:"setMaxValueInput",value:function(t){var e=this.getSafeValue(t.min,t.step),n=this.getSafeValue(t.max,t.value);t.value=Math.min(Math.max(parseFloat(String(t.value))||e,e),n),this.qtyVal=t.value}},{key:"updateAll",value:function(){this.updateMailQuantity(),this.updateAmount(),this.updateMailData(),this.updateProductQuantity(),this.updateAnalytics()}},{key:"updateMailQuantity",value:function(){this.toMail.qty="".concat(s.product_qty).concat(this.qtyVal)}},{key:"updateMailData",value:function(){var t=document.querySelector('input[name="awooc-hidden-data"]');t&&(t.value=this.request.fillDataToMail(this.toMail))}},{key:"updateAnalytics",value:function(){this.request.app.analyticData.qty=this.qtyVal}},{key:"updateProductQuantity",value:function(){var t=document.querySelector('input[name="awooc_product_qty"]');t&&(t.value=this.qtyVal)}},{key:"updateAmount",value:function(){var t=this.getPrice();if(t){var e=this.displayPrice(this.parsePrice(t)*this.qtyVal);this.updateDOMAmount(e),this.updateMailAmount()}}},{key:"getPrice",value:function(){var t,e=document.querySelector(".awooc-popup-price .woocommerce-Price-currencyValue");return(null==e||null===(t=e.textContent)||void 0===t?void 0:t.replace(/\s+/g,""))||null}},{key:"getSafeValue",value:function(t,e){return""===t||Number.isNaN(parseFloat(t))?e:parseFloat(t)}},{key:"getPriceSettings",value:function(){var t=r.popup,e=t.price_num_decimals,n=void 0===e?0:e,a=t.price_decimal_sep,i=void 0===a?".":a,o=t.price_thousand_sep;return{decimalPlaces:n||0,decimalSeparator:i||".",thousandSeparator:(void 0===o?"":o)||""}}},{key:"displayPrice",value:function(t){var e=String(t).replace(/[^0-9.]/g,""),n=parseFloat(e);if(isNaN(n))return"Invalid number";var a=this.getPriceSettings(),i=a.decimalPlaces,o=a.decimalSeparator,r=a.thousandSeparator,u=p(String(n.toFixed(i)).split("."),2),s=u[0],c=u[1],l=s.replace(/\B(?=(\d{3})+(?!\d))/g,r),d=i>0?c.padEnd(i,"0").slice(0,i):"";return i>0&&d?"".concat(l).concat(o).concat(d):l}},{key:"parsePrice",value:function(t){t=null!=t?t:0;var e=this.getPriceSettings(),n=e.decimalPlaces,a=e.decimalSeparator,i=e.thousandSeparator,o=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")};if("number"!=typeof t&&(t=String(t),[i," ",".",","].filter(Boolean).forEach((function(e){e!==a&&(t=t.replace(new RegExp(o(e),"g"),""))})),"."!==a&&(t=t.replace(new RegExp(o(a),"g"),".")),t=t.replace(/\.+(?![^.]+$)|[^0-9.-]/g,"")),t=parseFloat(t)||0,!1!==n){var r=""===String(n)?2:parseInt(n,10);return t.toFixed(r)}return t.toFixed(20)}},{key:"updateDOMAmount",value:function(t){var e=document.querySelector(".awooc-popup-sum .woocommerce-Price-currencyValue");e&&(e.textContent=t)}},{key:"updateMailAmount",value:function(){var t=document.querySelector(".awooc-popup-sum bdi");t?this.toMail.sum="".concat(s.formatted_sum).concat(t.textContent):delete this.toMail.sum}}])}();function v(t,e,a){return(e=n(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){v(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var m,w=function(){return i((function e(n){t(this,e),this.request=n,this.defaultAttributes={}}),[{key:"collectData",value:function(t){var e=this.getBaseData(t);return this.setAttributesOnCatalog(t,e),this.serializeFormData(t,e),e}},{key:"getBaseData",value:function(t){return{id:this.request.getProductID(t),action:"awooc_ajax_product_form",nonce:u.nonce,attributes:y({},this.defaultAttributes)}}},{key:"setAttributesOnCatalog",value:function(t,e){e.attributes=y({},this.defaultAttributes);var n=t.target.dataset.selectedVariant;n&&(e.attributes=JSON.parse(n))}},{key:"serializeFormData",value:function(t,e){var n=t.target.closest(".cart");n&&(e.attributes=y({},this.defaultAttributes),this.processFormData(new FormData(n),e))}},{key:"processFormData",value:function(t,e){var n=this;t.forEach((function(t,a){n.updateDataField(e,a,t),a.startsWith("attribute_")&&n.updateDataField(e.attributes,a,t)})),delete e["add-to-cart"]}},{key:"updateDataField",value:function(t,e,n){t[e]=t[e]?[].concat(t[e],n):n}}])}(),b=function(){return i((function e(n){t(this,e),this.app=n,this.$=this.app.$,this.dataCollector=new w(this)}),[{key:"sendRequest",value:function(t){var e=this,n=this.dataCollector.collectData(t);this.app.xhr=this.$.ajax({url:u.url,data:n,type:"POST",dataType:"json",success:function(n){return e.handleSuccessResponse(n,t)},error:function(t){return e.handleErrorResponse(t)}})}},{key:"getProductID",value:function(t){var e,n=t.target.closest(".variations_form"),a=null==n||null===(e=n.querySelector('input[name="variation_id"]'))||void 0===e?void 0:e.value;return null!=a?a:t.target.dataset.valueProductId}},{key:"handleSuccessResponse",value:function(t,e){this.removeSkeleton();var n=t.data,a=n.toMail,i=n.toPopup,o=n.toAnalytics;this.fillDataToPopup(i),this.fillHiddenFormFields(a,e),new f(a,this,e).bindEvent(),this.app.analyticData=o,this.initUI(),this.closeMagnificPopup(),this.app.events.trigger("awooc_popup_ajax_trigger",t)}},{key:"handleErrorResponse",value:function(t){t.responseJSON&&console.error(t.responseJSON.data)}},{key:"fillDataToMail",value:function(t){return"\n".concat(s.product_data_title,"\n———\n").concat(Object.values(t).join("\n"))}},{key:"fillDataToPopup",value:function(t){Object.entries(t).forEach((function(t){var e=p(t,2),n=e[0],a=e[1],i=document.querySelector(".awooc-popup-".concat(n));i&&(i.innerHTML=a)}))}},{key:"fillHiddenFormFields",value:function(t,e){this.updateField("awooc_product_id",this.getProductID(e)),this.updateField("awooc_product_qty",this.getQty()),this.updateField("awooc-hidden-data",this.fillDataToMail(t))}},{key:"updateField",value:function(t,e){var n=document.querySelector('input[name="'.concat(t,'"]'));n&&(n.value=e)}},{key:"initUI",value:function(){this.app.form.initContactForm(),this.app.form.initMask()}},{key:"removeSkeleton",value:function(){document.querySelectorAll(".awooc-popup-inner .awooc-popup-item").forEach((function(t){t.classList.remove("skeleton-loader")}))}},{key:"closeMagnificPopup",value:function(){var t;null!==(t=this.$.magnificPopup)&&void 0!==t&&t.instance&&this.$.magnificPopup.close()}},{key:"getQty",value:function(){var t=document.querySelector('.quantity input[name="quantity"]');return t?t.value:1}}])}(),g=function(){return i((function e(n){t(this,e),this.app=n;var a=r.popup,i=a.cf7_form_id,o=a.mailsent_timeout,u=a.invalid_timeout;this.formId=Number(i),this.mailsentTimeout=o,this.invalidTimeout=u}),[{key:"init",value:function(){this.bindEvents()}},{key:"bindEvents",value:function(){var t=this;document.addEventListener("wpcf7mailsent",(function(e){return t.handleMailSent(e)})),document.addEventListener("wpcf7invalid",(function(e){return t.handleInvalid(e)})),this.app.events.on("awooc_popup_ajax_trigger",(function(){return t.setupFormSubmitListener()}))}},{key:"setupFormSubmitListener",value:function(){var t=this,e=document.querySelector("form.wpcf7-form");e&&e.addEventListener("submit",(function(e){return t.handleFormSubmit(e)}))}},{key:"handleMailSent",value:function(t){var e=t.detail;setTimeout((function(){return jQuery.unblockUI()}),this.mailsentTimeout),this.formId===e.contactFormId&&this.app.events.trigger("awooc_mail_sent_trigger",{selectedProduct:this.app.analyticData,mailDetail:e})}},{key:"handleInvalid",value:function(t){var e=this,n=t.detail;this.formId===n.contactFormId&&this.app.events.trigger("awooc_mail_invalid_trigger"),setTimeout((function(){return e.clearFormErrors()}),this.invalidTimeout)}},{key:"clearFormErrors",value:function(){var t=document.querySelector(".awooc-form-custom-order .wpcf7-response-output"),e=document.querySelectorAll(".awooc-form-custom-order .wpcf7-not-valid-tip"),n=document.querySelector('.awooc-form-custom-order input[type="submit"]');t&&(t.innerHTML=""),n&&(n.disabled=!1),e.forEach((function(t){return t.remove()}))}},{key:"handleFormSubmit",value:function(t){var e=t.currentTarget.querySelector('input[type="submit"]');e&&(e.disabled=!0)}},{key:"initContactForm",value:function(){var t=this;document.querySelectorAll(".awooc-form-custom-order div.wpcf7 > form").forEach((function(e){var n=e.querySelector('input[name="_wpcf7_version"]');n&&(n.value&&n.value<="5.4"?t.initOldWpcf7(e):wpcf7.init(e))}))}},{key:"initOldWpcf7",value:function(t){wpcf7.initForm(t),wpcf7.cached&&wpcf7.refill(t)}},{key:"initMask",value:function(){document.querySelectorAll(".awooc-form-custom-order .wpcf7-mask").forEach((function(t){var e=jQuery(t).data("mask");if(e)try{jQuery(t).mask(e),/[a*]/.test(e)||t.setAttribute("inputmode","numeric")}catch(t){console.error("Error ".concat(t.name,": ").concat(t.message,"\n").concat(t.stack))}}))}}])}(),k=function(){return i((function e(n){t(this,e),this.app=n,this.variationForms=document.querySelectorAll(".cfvsw_variations_form, form.variations_form"),this.buttons=this.getButtons()}),[{key:"getButtons",value:function(){return Array.from(this.variationForms).map((function(t){return t.closest("li")})).filter((function(t){return null!==t})).flatMap((function(t){return Array.from(t.querySelectorAll(".awooc-button-js"))}))}},{key:"init",value:function(){this.variationForms.length<0||(this.addedToButtonAttributes(),this.disableButtons(),this.bindEvents())}},{key:"bindEvents",value:function(){var t=this;document.addEventListener("cfvswVariationLoad",(function(){return t.addedToButtonAttributes()})),document.addEventListener("astraInfinitePaginationLoaded",(function(){return t.addedToButtonAttributes()})),document.querySelectorAll(".cfvsw-swatches-option").forEach((function(e){e.addEventListener("click",(function(e){return t.onClickSwatchesOption(e)}))}))}},{key:"addedToButtonAttributes",value:function(){var t=this;this.variationForms.forEach((function(e){jQuery(e).wc_variation_form(),e.dataset.cfvswCatalog||jQuery(e).on("found_variation",(function(){return t.updateButtonData(e)}))}))}},{key:"updateButtonData",value:function(t){var e,n=t.querySelectorAll(".variations select"),a={},i=null===(e=t.closest("li"))||void 0===e?void 0:e.querySelector(".awooc-button-js");n.forEach((function(t){var e=t.dataset.attributeName||t.name;a[e]=t.value||""})),i&&(i.disabled=!1,i.classList.add("cfvsw_variation_found"),i.dataset.selectedVariant=JSON.stringify(a))}},{key:"onClickSwatchesOption",value:function(t){var e=t.target;this.isSwatchSelected(e)?this.resetButtonData(e):(this.deselectAllSwatches(e),this.selectSwatch(e)),this.updateSelectOption(e)}},{key:"resetButtonData",value:function(t){var e,n=null===(e=t.closest("li"))||void 0===e?void 0:e.querySelector(".awooc-button-js");if(n){var a=this.getSelectElement(t);(null==a?void 0:a.value)&&""!==a.value?this.updateButtonData(t.closest("form")):(n.disabled=!0,n.classList.remove("cfvsw_variation_found"),n.dataset.selectedVariant="")}}},{key:"updateSelectOption",value:function(t){var e=this.getSwatchValue(t),n=this.getSelectElement(t);n&&(n.value=e,setTimeout((function(){n.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}),50))}},{key:"isSwatchSelected",value:function(t){return(!t.classList.contains("cfvsw-swatches-disabled")||!t.classList.contains("cfvsw-swatches-out-of-stock"))&&t.classList.contains("cfvsw-selected-swatch")}},{key:"deselectAllSwatches",value:function(t){t.parentElement.querySelectorAll(".cfvsw-swatches-option").forEach((function(t){return t.classList.remove("cfvsw-selected-swatch")}))}},{key:"selectSwatch",value:function(t){t.classList.add("cfvsw-selected-swatch")}},{key:"getSwatchValue",value:function(t){return this.isSwatchSelected(t)?t.dataset.slug:""}},{key:"getSelectElement",value:function(t){var e;return null===(e=t.closest(".cfvsw-swatches-container"))||void 0===e||null===(e=e.previousElementSibling)||void 0===e?void 0:e.querySelector("select")}},{key:"disableButtons",value:function(){this.buttons.forEach((function(t){return t.disabled=!0}))}}])}(),S=function(){return i((function e(n){t(this,e),this.app=n}),[{key:"init",value:function(){var t=this;jQuery(document.body).on("woodmart-quick-view-displayed",(function(){var e=document.querySelector(".product.quick-shop-loaded form.cart .awooc-button-js");e&&jQuery(".product.quick-shop-loaded").find(".variations_form").on("hide_variation",(function(){return t.app.buttons.toggleButtonClasses([e],"add",t.app.buttons.disableClasses)})).on("show_variation",(function(n,a,i){return t.app.buttons.updateButtonState(a,i,[e])}))}))}}])}(),_=function(){return i((function e(n){t(this,e),this.validateGlobals()&&(this.$=n,this.xhr=!1,this.analyticData={},this.events=new o,this.popup=new c(this),this.buttons=new l(this),this.request=new b(this),this.form=new g(this),this.variationSwatches=new k(this),this.woodmart=new S(this),this.init())}),[{key:"init",value:function(){this.buttons.init(),this.form.init(),this.variationSwatches.init(),this.woodmart.init()}},{key:"validateGlobals",value:function(){var t={awooc_scripts_ajax:"awooc_scripts_ajax not found",awooc_scripts_translate:"awooc_scripts_translate not found",awooc_scripts_settings:"awooc_scripts_settings not found",wpcf7:"На странице не существует объекта wpcf7. Что-то не так с темой..."};for(var e in t)if(void 0===window[e]||null===window[e])return console.warn(t[e]),!1;return!0}}])}();(function(t){var e="awooc_",n=t.fn.on,a=t.fn.trigger;t.fn.on=function(t,a,i,o){return"function"==typeof a?(o=a,a=void 0,i=void 0):"function"==typeof i&&(o=i,i=void 0),"string"==typeof t&&t.startsWith(e)&&o?n.call(this,t,a,i,(function(e){o.length>1&&console.warn("[WARNING] '".concat(t,"' передает данные через event.detail, но обработчик ожидает data. Используйте event.detail вместо второго аргумента.")),o.call(this,e,e.detail)})):n.apply(this,arguments)},t.fn.trigger=function(t,n){if("string"==typeof t&&t.startsWith(e)){var i=new CustomEvent(t,{detail:n});return document.dispatchEvent(i),this}return a.apply(this,arguments)},document.addEventListener(e,(function(n){n.type.startsWith(e)&&t(document).triggerHandler(n.type,n.detail)}),!0)})(m=jQuery),m(document).ready((function(){window.AwoocAppCore||(window.AwoocAppCore=new _(m))}))})(); -
art-woocommerce-order-one-click/tags/3.1.8/classes/Prepare/Prepare.php
r3232179 r3286706 323 323 } 324 324 325 if ( defined( 'ICL_LANGUAGE_CODE' ) && ! defined( 'WP_CLI' ) ) { 326 $select_form = apply_filters( 327 'wpml_object_id', 328 $select_form, 329 'wpcf7_contact_form', 330 true, 331 ICL_LANGUAGE_CODE 332 ); 333 } 334 325 335 return wpcf7_contact_form_tag_func( [ 'id' => esc_attr( $select_form ) ], null, 'contact-form-7' ); 326 336 } -
art-woocommerce-order-one-click/tags/3.1.8/classes/RequestProcessing/EmailModifier.php
r3232179 r3286706 35 35 public function add_hidden_fields( $fields ): array { 36 36 37 $form_id = WPCF7_ContactForm::get_current()->id();38 $ select_form = $this->main->get_selected_form_id();39 40 if ( $select_form !== $form_id) {37 // phpcs:disable WordPress.Security.NonceVerification.Recommended 38 $is_ajax_request = wp_doing_ajax() && isset( $_REQUEST['action'] ) && 'awooc_ajax_product_form' === $_REQUEST['action']; 39 // phpcs:enable WordPress.Security.NonceVerification.Recommended 40 if ( ! $is_ajax_request ) { 41 41 return $fields; 42 42 } … … 54 54 if ( class_exists( 'Polylang' ) && ! defined( 'WP_CLI' ) ) { 55 55 $addon_fields['lang'] = pll_current_language(); 56 } 57 58 if ( defined( 'ICL_LANGUAGE_CODE' ) && ! defined( 'WP_CLI' ) ) { 59 $addon_fields['lang'] = ICL_LANGUAGE_CODE; 56 60 } 57 61 -
art-woocommerce-order-one-click/tags/3.1.8/readme.txt
r3253620 r3286706 4 4 Tags: woocommerce, mode catalog 5 5 Requires at least: 5.5 6 Tested up to: 6. 77 Stable tag: 3.1. 76 Tested up to: 6.8 7 Stable tag: 3.1.8 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 100 100 101 101 == Changelog == 102 = [3.1.7 - 2025-03-11 = 102 = [3.1.8] - 2025-05-03 = 103 * Добавлено: поддержка WPML для мультиязычности 104 * Исправлено: поведение при дефолтных атрибутах и использовании плагина Variation Swatches for WooCommerce 105 * Исправлено: поддержка WP 6.8 106 107 = [3.1.7] - 2025-03-11 = 103 108 * Исправлено: ошибка версионности 104 109 -
art-woocommerce-order-one-click/tags/3.1.8/vendor/autoload.php
r3232179 r3286706 15 15 } 16 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 17 throw new RuntimeException($err); 21 18 } 22 19 -
art-woocommerce-order-one-click/tags/3.1.8/vendor/composer/InstalledVersions.php
r3232179 r3286706 27 27 class InstalledVersions 28 28 { 29 /** 30 * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to 31 * @internal 32 */ 33 private static $selfDir = null; 34 29 35 /** 30 36 * @var mixed[]|null … … 324 330 325 331 /** 332 * @return string 333 */ 334 private static function getSelfDir() 335 { 336 if (self::$selfDir === null) { 337 self::$selfDir = strtr(__DIR__, '\\', '/'); 338 } 339 340 return self::$selfDir; 341 } 342 343 /** 326 344 * @return array[] 327 345 * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> … … 337 355 338 356 if (self::$canGetVendors) { 339 $selfDir = s trtr(__DIR__, '\\', '/');357 $selfDir = self::getSelfDir(); 340 358 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 341 359 $vendorDir = strtr($vendorDir, '\\', '/'); -
art-woocommerce-order-one-click/tags/3.1.8/vendor/composer/installed.php
r3253620 r3286706 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' 6d16c24dbae220f748175c4c75cf68b96560bfb8',6 'reference' => '2b40a4b4e80e42b85d3b97042ddd808d9a692374', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' 6d16c24dbae220f748175c4c75cf68b96560bfb8',16 'reference' => '2b40a4b4e80e42b85d3b97042ddd808d9a692374', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
art-woocommerce-order-one-click/trunk/art-woo-order-one-click.php
r3253620 r3286706 6 6 * Domain Path: /languages 7 7 * Description: Plugin for WooCommerce. It includes the catalog mode in the store (there are no prices and the Buy button) and can turn on the Buy/Order button in one click. WooCommerce and Contact Form 7 are required for proper operation. 8 * Version: 3.1. 78 * Version: 3.1.8 9 9 * Author: Artem Abramovich 10 10 * Author URI: https://wpruse.ru/ -
art-woocommerce-order-one-click/trunk/assets/js/awooc-public-script.js
r3253607 r3286706 1164 1164 var swatch = e.target; 1165 1165 if (this.isSwatchSelected(swatch)) { 1166 this.deselectSwatch(swatch);1167 1166 this.resetButtonData(swatch); 1168 1167 } else { … … 1180 1179 return; 1181 1180 } 1182 button.disabled = true; 1183 button.classList.remove('cfvsw_variation_found'); 1184 button.dataset.selectedVariant = ''; 1181 var select = this.getSelectElement(swatch); 1182 var hasDefaultValue = (select === null || select === void 0 ? void 0 : select.value) && select.value !== ''; 1183 if (hasDefaultValue) { 1184 this.updateButtonData(swatch.closest('form')); 1185 } else { 1186 button.disabled = true; 1187 button.classList.remove('cfvsw_variation_found'); 1188 button.dataset.selectedVariant = ''; 1189 } 1185 1190 } 1186 1191 }, { … … 1191 1196 if (select) { 1192 1197 select.value = value; 1193 select.dispatchEvent(new Event('change')); 1198 setTimeout(function () { 1199 select.dispatchEvent(new CustomEvent('change', { 1200 bubbles: true 1201 })); 1202 }, 50); 1194 1203 } 1195 1204 } … … 1198 1207 value: function isSwatchSelected(swatch) { 1199 1208 return (!swatch.classList.contains('cfvsw-swatches-disabled') || !swatch.classList.contains('cfvsw-swatches-out-of-stock')) && swatch.classList.contains('cfvsw-selected-swatch'); 1200 }1201 }, {1202 key: "deselectSwatch",1203 value: function deselectSwatch(swatch) {1204 swatch.classList.remove('cfvsw-selected-swatch');1205 1209 } 1206 1210 }, { -
art-woocommerce-order-one-click/trunk/assets/js/awooc-public-script.min.js
r3253607 r3286706 1 (()=>{"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var i=a.call(t,n||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function a(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function i(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=function(){return i((function e(){t(this,e),this.events={}}),[{key:"on",value:function(t,e){var n=this;this.events[t]||(this.events[t]=[]),this.events[t].push(e);var a=function(e){n.events[t].forEach((function(t){return t(e,e.detail)}))};this.events[t].listener=a,document.addEventListener(t,a)}},{key:"off",value:function(t,e){var n;this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})),null!==(n=this.events[t])&&void 0!==n&&n.length||(document.removeEventListener(t,this.events[t].listener),delete this.events[t].listener))}},{key:"trigger",value:function(t){var e=new CustomEvent(t,{detail:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}});document.dispatchEvent(e)}}])}(),r=awooc_scripts_settings,u=awooc_scripts_ajax,s=awooc_scripts_translate,c=function(){return i((function e(n){t(this,e),this.app=n,this.bindEvent()}),[{key:"bindEvent",value:function(){var t=this;document.addEventListener("click",(function(e){t.unBlock(e)}))}},{key:"showPopup",value:function(t){var e=this;jQuery.blockUI({message:r.template,css:r.popup.css,overlayCSS:r.popup.overlay,fadeIn:r.popup.fadeIn,fadeOut:r.popup.fadeOut,focusInput:r.popup.focusInput,bindEvents:!1,timeout:0,allowBodyStretch:!0,centerX:!0,centerY:!0,blockMsgClass:"blockMsg blockMsgAwooc",onBlock:function(){e.app.events.trigger("awooc_popup_open_trigger"),e.app.request.sendRequest(t)},onUnblock:function(){return e.app.events.trigger("awooc_popup_close_trigger")},onOverlayClick:function(){return document.documentElement.style.overflow="initial"}})}},{key:"unBlock",value:function(t){(t.target.classList.contains("awooc-close")||t.target.classList.contains("blockOverlay"))&&jQuery.unblockUI()}}])}(),l=function(){return i((function e(n){t(this,e),this.app=n,this.button=document.querySelectorAll("form.cart .awooc-button-js"),this.addToCartElements=document.querySelectorAll(".woocommerce-variation-add-to-cart .quantity, .woocommerce-variation-add-to-cart .single_add_to_cart_button"),this.disableClasses=["disabled","wc-variation-selection-needed"],this.disableClassesOutStock=["disabled","wc-variation-is-unavailable"]}),[{key:"init",value:function(){var t=this;document.addEventListener("click",(function(e){return t.handleShowPopup(e)})),jQuery(document.body).on("hide_variation",(function(){return t.toggleButtonClasses(t.button,"add",t.disableClasses)})).on("show_variation",(function(e,n,a){return t.updateButtonState(n,a)}))}},{key:"handleShowPopup",value:function(t){var e=t.target.closest(".awooc-button-js");if(e){if(e.classList.contains("disabled")){t.preventDefault();var n=e.classList.contains("wc-variation-is-unavailable")?wc_add_to_cart_variation_params.i18n_unavailable_text:wc_add_to_cart_variation_params.i18n_make_a_selection_text;return window.alert(n),!1}this.app.popup.showPopup(t)}}},{key:"updateButtonState",value:function(t,e){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||this.button;switch(r.mode){case"in_stock_add_to_card":this.handlePreloadMode(t,n);break;case"no_stock_no_price":this.handleSpecialMode(t,n);break;default:this.handleDefaultMode(e,n)}}},{key:"handlePreloadMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;t.backorders_allowed||!t.is_in_stock?(this.hideAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClassesOutStock)):(this.showAddToCartModule(),this.toggleButtonClasses(e,"add",this.disableClasses))}},{key:"handleSpecialMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;t.is_purchasable&&!t.is_in_stock?(this.hideAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClasses)):t.is_purchasable&&t.is_in_stock?(this.showAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClasses)):(this.showAddToCartModule(),this.toggleButtonClasses(e,"add",this.disableClasses))}},{key:"handleDefaultMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;this.toggleButtonClasses(e,t?"remove":"add",this.disableClassesOutStock)}},{key:"toggleButtonClasses",value:function(t,e,n){t||(t=this.button),t instanceof NodeList&&(t=Array.from(t)),Array.isArray(t)||(t=[t]),t.forEach((function(t){t&&t.classList&&n.forEach((function(n){"string"==typeof n&&t.classList[e](n)}))}))}},{key:"toggleModuleVisibility",value:function(t){this.addToCartElements.forEach((function(e){return e.classList[t]("awooc-hide")})),this.button.forEach((function(e){return e.classList[t]("no-margin")}))}},{key:"hideAddToCartModule",value:function(){this.toggleModuleVisibility("add")}},{key:"showAddToCartModule",value:function(){this.toggleModuleVisibility("remove")}}])}();function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=Array(e);n<e;n++)a[n]=t[n];return a}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var a,i,o,r,u=[],s=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(a=o.call(n)).done)&&(u.push(a.value),u.length!==e);s=!0);}catch(t){c=!0,i=t}finally{try{if(!s&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw i}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return d(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var f=function(){return i((function e(n,a,i){t(this,e),this.toMail=n,this.request=a,this.qtyVal="",this.cache=a.cache,this.event=i}),[{key:"bindEvent",value:function(){var t=document.querySelector(".awooc-popup-qty");if(t){var e=t.querySelector(".awooc-popup-input-qty");e&&this.initializeQuantityInput(e)}}},{key:"initializeQuantityInput",value:function(t){var e=this;this.setMaxValueInput(t),this.updateAll(),t.addEventListener("input",(function(t){return e.handleInputEvent(t)})),this.handlerPlusMinusButtonsEvent(t)}},{key:"handlerPlusMinusButtonsEvent",value:function(t){var e=this,n=document.querySelector(".awooc-popup-input-qty--minus"),a=document.querySelector(".awooc-popup-input-qty--plus");n&&a&&(n.addEventListener("click",(function(){return e.updateInputQuantity(t,"decrease")})),a.addEventListener("click",(function(){return e.updateInputQuantity(t,"increase")})))}},{key:"updateInputQuantity",value:function(t,e){var n=parseFloat(t.value),a=this.getSafeValue(t.step,1),i=this.getSafeValue(t.min,-1/0),o=this.getSafeValue(t.max,1/0),r=n+("decrease"===e?-a:a),u=Math.max(0,-Math.floor(Math.log10(a)));(r=parseFloat(r.toFixed(u)))>=i&&r<=o&&(t.value=r,t.dispatchEvent(new Event("input",{bubbles:!0})))}},{key:"handleInputEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e||(e=t.target.closest(".awooc-popup-input-qty")),e&&(this.setMaxValueInput(e),this.qtyVal=e.value,this.updateAll())}},{key:"setMaxValueInput",value:function(t){var e=this.getSafeValue(t.min,t.step),n=this.getSafeValue(t.max,t.value);t.value=Math.min(Math.max(parseFloat(String(t.value))||e,e),n),this.qtyVal=t.value}},{key:"updateAll",value:function(){this.updateMailQuantity(),this.updateAmount(),this.updateMailData(),this.updateProductQuantity(),this.updateAnalytics()}},{key:"updateMailQuantity",value:function(){this.toMail.qty="".concat(s.product_qty).concat(this.qtyVal)}},{key:"updateMailData",value:function(){var t=document.querySelector('input[name="awooc-hidden-data"]');t&&(t.value=this.request.fillDataToMail(this.toMail))}},{key:"updateAnalytics",value:function(){this.request.app.analyticData.qty=this.qtyVal}},{key:"updateProductQuantity",value:function(){var t=document.querySelector('input[name="awooc_product_qty"]');t&&(t.value=this.qtyVal)}},{key:"updateAmount",value:function(){var t=this.getPrice();if(t){var e=this.displayPrice(this.parsePrice(t)*this.qtyVal);this.updateDOMAmount(e),this.updateMailAmount()}}},{key:"getPrice",value:function(){var t,e=document.querySelector(".awooc-popup-price .woocommerce-Price-currencyValue");return(null==e||null===(t=e.textContent)||void 0===t?void 0:t.replace(/\s+/g,""))||null}},{key:"getSafeValue",value:function(t,e){return""===t||Number.isNaN(parseFloat(t))?e:parseFloat(t)}},{key:"getPriceSettings",value:function(){var t=r.popup,e=t.price_num_decimals,n=void 0===e?0:e,a=t.price_decimal_sep,i=void 0===a?".":a,o=t.price_thousand_sep;return{decimalPlaces:n||0,decimalSeparator:i||".",thousandSeparator:(void 0===o?"":o)||""}}},{key:"displayPrice",value:function(t){var e=String(t).replace(/[^0-9.]/g,""),n=parseFloat(e);if(isNaN(n))return"Invalid number";var a=this.getPriceSettings(),i=a.decimalPlaces,o=a.decimalSeparator,r=a.thousandSeparator,u=p(String(n.toFixed(i)).split("."),2),s=u[0],c=u[1],l=s.replace(/\B(?=(\d{3})+(?!\d))/g,r),d=i>0?c.padEnd(i,"0").slice(0,i):"";return i>0&&d?"".concat(l).concat(o).concat(d):l}},{key:"parsePrice",value:function(t){t=null!=t?t:0;var e=this.getPriceSettings(),n=e.decimalPlaces,a=e.decimalSeparator,i=e.thousandSeparator,o=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")};if("number"!=typeof t&&(t=String(t),[i," ",".",","].filter(Boolean).forEach((function(e){e!==a&&(t=t.replace(new RegExp(o(e),"g"),""))})),"."!==a&&(t=t.replace(new RegExp(o(a),"g"),".")),t=t.replace(/\.+(?![^.]+$)|[^0-9.-]/g,"")),t=parseFloat(t)||0,!1!==n){var r=""===String(n)?2:parseInt(n,10);return t.toFixed(r)}return t.toFixed(20)}},{key:"updateDOMAmount",value:function(t){var e=document.querySelector(".awooc-popup-sum .woocommerce-Price-currencyValue");e&&(e.textContent=t)}},{key:"updateMailAmount",value:function(){var t=document.querySelector(".awooc-popup-sum bdi");t?this.toMail.sum="".concat(s.formatted_sum).concat(t.textContent):delete this.toMail.sum}}])}();function v(t,e,a){return(e=n(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){v(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var m,w=function(){return i((function e(n){t(this,e),this.request=n,this.defaultAttributes={}}),[{key:"collectData",value:function(t){var e=this.getBaseData(t);return this.setAttributesOnCatalog(t,e),this.serializeFormData(t,e),e}},{key:"getBaseData",value:function(t){return{id:this.request.getProductID(t),action:"awooc_ajax_product_form",nonce:u.nonce,attributes:y({},this.defaultAttributes)}}},{key:"setAttributesOnCatalog",value:function(t,e){e.attributes=y({},this.defaultAttributes);var n=t.target.dataset.selectedVariant;n&&(e.attributes=JSON.parse(n))}},{key:"serializeFormData",value:function(t,e){var n=t.target.closest(".cart");n&&(e.attributes=y({},this.defaultAttributes),this.processFormData(new FormData(n),e))}},{key:"processFormData",value:function(t,e){var n=this;t.forEach((function(t,a){n.updateDataField(e,a,t),a.startsWith("attribute_")&&n.updateDataField(e.attributes,a,t)})),delete e["add-to-cart"]}},{key:"updateDataField",value:function(t,e,n){t[e]=t[e]?[].concat(t[e],n):n}}])}(), g=function(){return i((function e(n){t(this,e),this.app=n,this.$=this.app.$,this.dataCollector=new w(this)}),[{key:"sendRequest",value:function(t){var e=this,n=this.dataCollector.collectData(t);this.app.xhr=this.$.ajax({url:u.url,data:n,type:"POST",dataType:"json",success:function(n){return e.handleSuccessResponse(n,t)},error:function(t){return e.handleErrorResponse(t)}})}},{key:"getProductID",value:function(t){var e,n=t.target.closest(".variations_form"),a=null==n||null===(e=n.querySelector('input[name="variation_id"]'))||void 0===e?void 0:e.value;return null!=a?a:t.target.dataset.valueProductId}},{key:"handleSuccessResponse",value:function(t,e){this.removeSkeleton();var n=t.data,a=n.toMail,i=n.toPopup,o=n.toAnalytics;this.fillDataToPopup(i),this.fillHiddenFormFields(a,e),new f(a,this,e).bindEvent(),this.app.analyticData=o,this.initUI(),this.closeMagnificPopup(),this.app.events.trigger("awooc_popup_ajax_trigger",t)}},{key:"handleErrorResponse",value:function(t){t.responseJSON&&console.error(t.responseJSON.data)}},{key:"fillDataToMail",value:function(t){return"\n".concat(s.product_data_title,"\n———\n").concat(Object.values(t).join("\n"))}},{key:"fillDataToPopup",value:function(t){Object.entries(t).forEach((function(t){var e=p(t,2),n=e[0],a=e[1],i=document.querySelector(".awooc-popup-".concat(n));i&&(i.innerHTML=a)}))}},{key:"fillHiddenFormFields",value:function(t,e){this.updateField("awooc_product_id",this.getProductID(e)),this.updateField("awooc_product_qty",this.getQty()),this.updateField("awooc-hidden-data",this.fillDataToMail(t))}},{key:"updateField",value:function(t,e){var n=document.querySelector('input[name="'.concat(t,'"]'));n&&(n.value=e)}},{key:"initUI",value:function(){this.app.form.initContactForm(),this.app.form.initMask()}},{key:"removeSkeleton",value:function(){document.querySelectorAll(".awooc-popup-inner .awooc-popup-item").forEach((function(t){t.classList.remove("skeleton-loader")}))}},{key:"closeMagnificPopup",value:function(){var t;null!==(t=this.$.magnificPopup)&&void 0!==t&&t.instance&&this.$.magnificPopup.close()}},{key:"getQty",value:function(){var t=document.querySelector('.quantity input[name="quantity"]');return t?t.value:1}}])}(),b=function(){return i((function e(n){t(this,e),this.app=n;var a=r.popup,i=a.cf7_form_id,o=a.mailsent_timeout,u=a.invalid_timeout;this.formId=Number(i),this.mailsentTimeout=o,this.invalidTimeout=u}),[{key:"init",value:function(){this.bindEvents()}},{key:"bindEvents",value:function(){var t=this;document.addEventListener("wpcf7mailsent",(function(e){return t.handleMailSent(e)})),document.addEventListener("wpcf7invalid",(function(e){return t.handleInvalid(e)})),this.app.events.on("awooc_popup_ajax_trigger",(function(){return t.setupFormSubmitListener()}))}},{key:"setupFormSubmitListener",value:function(){var t=this,e=document.querySelector("form.wpcf7-form");e&&e.addEventListener("submit",(function(e){return t.handleFormSubmit(e)}))}},{key:"handleMailSent",value:function(t){var e=t.detail;setTimeout((function(){return jQuery.unblockUI()}),this.mailsentTimeout),this.formId===e.contactFormId&&this.app.events.trigger("awooc_mail_sent_trigger",{selectedProduct:this.app.analyticData,mailDetail:e})}},{key:"handleInvalid",value:function(t){var e=this,n=t.detail;this.formId===n.contactFormId&&this.app.events.trigger("awooc_mail_invalid_trigger"),setTimeout((function(){return e.clearFormErrors()}),this.invalidTimeout)}},{key:"clearFormErrors",value:function(){var t=document.querySelector(".awooc-form-custom-order .wpcf7-response-output"),e=document.querySelectorAll(".awooc-form-custom-order .wpcf7-not-valid-tip"),n=document.querySelector('.awooc-form-custom-order input[type="submit"]');t&&(t.innerHTML=""),n&&(n.disabled=!1),e.forEach((function(t){return t.remove()}))}},{key:"handleFormSubmit",value:function(t){var e=t.currentTarget.querySelector('input[type="submit"]');e&&(e.disabled=!0)}},{key:"initContactForm",value:function(){var t=this;document.querySelectorAll(".awooc-form-custom-order div.wpcf7 > form").forEach((function(e){var n=e.querySelector('input[name="_wpcf7_version"]');n&&(n.value&&n.value<="5.4"?t.initOldWpcf7(e):wpcf7.init(e))}))}},{key:"initOldWpcf7",value:function(t){wpcf7.initForm(t),wpcf7.cached&&wpcf7.refill(t)}},{key:"initMask",value:function(){document.querySelectorAll(".awooc-form-custom-order .wpcf7-mask").forEach((function(t){var e=jQuery(t).data("mask");if(e)try{jQuery(t).mask(e),/[a*]/.test(e)||t.setAttribute("inputmode","numeric")}catch(t){console.error("Error ".concat(t.name,": ").concat(t.message,"\n").concat(t.stack))}}))}}])}(),k=function(){return i((function e(n){t(this,e),this.app=n,this.variationForms=document.querySelectorAll(".cfvsw_variations_form, form.variations_form"),this.buttons=this.getButtons()}),[{key:"getButtons",value:function(){return Array.from(this.variationForms).map((function(t){return t.closest("li")})).filter((function(t){return null!==t})).flatMap((function(t){return Array.from(t.querySelectorAll(".awooc-button-js"))}))}},{key:"init",value:function(){this.variationForms.length<0||(this.addedToButtonAttributes(),this.disableButtons(),this.bindEvents())}},{key:"bindEvents",value:function(){var t=this;document.addEventListener("cfvswVariationLoad",(function(){return t.addedToButtonAttributes()})),document.addEventListener("astraInfinitePaginationLoaded",(function(){return t.addedToButtonAttributes()})),document.querySelectorAll(".cfvsw-swatches-option").forEach((function(e){e.addEventListener("click",(function(e){return t.onClickSwatchesOption(e)}))}))}},{key:"addedToButtonAttributes",value:function(){var t=this;this.variationForms.forEach((function(e){jQuery(e).wc_variation_form(),e.dataset.cfvswCatalog||jQuery(e).on("found_variation",(function(){return t.updateButtonData(e)}))}))}},{key:"updateButtonData",value:function(t){var e,n=t.querySelectorAll(".variations select"),a={},i=null===(e=t.closest("li"))||void 0===e?void 0:e.querySelector(".awooc-button-js");n.forEach((function(t){var e=t.dataset.attributeName||t.name;a[e]=t.value||""})),i&&(i.disabled=!1,i.classList.add("cfvsw_variation_found"),i.dataset.selectedVariant=JSON.stringify(a))}},{key:"onClickSwatchesOption",value:function(t){var e=t.target;this.isSwatchSelected(e)?(this.deselectSwatch(e),this.resetButtonData(e)):(this.deselectAllSwatches(e),this.selectSwatch(e)),this.updateSelectOption(e)}},{key:"resetButtonData",value:function(t){var e,n=null===(e=t.closest("li"))||void 0===e?void 0:e.querySelector(".awooc-button-js");n&&(n.disabled=!0,n.classList.remove("cfvsw_variation_found"),n.dataset.selectedVariant="")}},{key:"updateSelectOption",value:function(t){var e=this.getSwatchValue(t),n=this.getSelectElement(t);n&&(n.value=e,n.dispatchEvent(new Event("change")))}},{key:"isSwatchSelected",value:function(t){return(!t.classList.contains("cfvsw-swatches-disabled")||!t.classList.contains("cfvsw-swatches-out-of-stock"))&&t.classList.contains("cfvsw-selected-swatch")}},{key:"deselectSwatch",value:function(t){t.classList.remove("cfvsw-selected-swatch")}},{key:"deselectAllSwatches",value:function(t){t.parentElement.querySelectorAll(".cfvsw-swatches-option").forEach((function(t){return t.classList.remove("cfvsw-selected-swatch")}))}},{key:"selectSwatch",value:function(t){t.classList.add("cfvsw-selected-swatch")}},{key:"getSwatchValue",value:function(t){return this.isSwatchSelected(t)?t.dataset.slug:""}},{key:"getSelectElement",value:function(t){var e;return null===(e=t.closest(".cfvsw-swatches-container"))||void 0===e||null===(e=e.previousElementSibling)||void 0===e?void 0:e.querySelector("select")}},{key:"disableButtons",value:function(){this.buttons.forEach((function(t){return t.disabled=!0}))}}])}(),S=function(){return i((function e(n){t(this,e),this.app=n}),[{key:"init",value:function(){var t=this;jQuery(document.body).on("woodmart-quick-view-displayed",(function(){var e=document.querySelector(".product.quick-shop-loaded form.cart .awooc-button-js");e&&jQuery(".product.quick-shop-loaded").find(".variations_form").on("hide_variation",(function(){return t.app.buttons.toggleButtonClasses([e],"add",t.app.buttons.disableClasses)})).on("show_variation",(function(n,a,i){return t.app.buttons.updateButtonState(a,i,[e])}))}))}}])}(),_=function(){return i((function e(n){t(this,e),this.validateGlobals()&&(this.$=n,this.xhr=!1,this.analyticData={},this.events=new o,this.popup=new c(this),this.buttons=new l(this),this.request=new g(this),this.form=new b(this),this.variationSwatches=new k(this),this.woodmart=new S(this),this.init())}),[{key:"init",value:function(){this.buttons.init(),this.form.init(),this.variationSwatches.init(),this.woodmart.init()}},{key:"validateGlobals",value:function(){var t={awooc_scripts_ajax:"awooc_scripts_ajax not found",awooc_scripts_translate:"awooc_scripts_translate not found",awooc_scripts_settings:"awooc_scripts_settings not found",wpcf7:"На странице не существует объекта wpcf7. Что-то не так с темой..."};for(var e in t)if(void 0===window[e]||null===window[e])return console.warn(t[e]),!1;return!0}}])}();(function(t){var e="awooc_",n=t.fn.on,a=t.fn.trigger;t.fn.on=function(t,a,i,o){return"function"==typeof a?(o=a,a=void 0,i=void 0):"function"==typeof i&&(o=i,i=void 0),"string"==typeof t&&t.startsWith(e)&&o?n.call(this,t,a,i,(function(e){o.length>1&&console.warn("[WARNING] '".concat(t,"' передает данные через event.detail, но обработчик ожидает data. Используйте event.detail вместо второго аргумента.")),o.call(this,e,e.detail)})):n.apply(this,arguments)},t.fn.trigger=function(t,n){if("string"==typeof t&&t.startsWith(e)){var i=new CustomEvent(t,{detail:n});return document.dispatchEvent(i),this}return a.apply(this,arguments)},document.addEventListener(e,(function(n){n.type.startsWith(e)&&t(document).triggerHandler(n.type,n.detail)}),!0)})(m=jQuery),m(document).ready((function(){window.AwoocAppCore||(window.AwoocAppCore=new _(m))}))})();1 (()=>{"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var i=a.call(t,n||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function a(t,e){for(var a=0;a<e.length;a++){var i=e[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function i(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=function(){return i((function e(){t(this,e),this.events={}}),[{key:"on",value:function(t,e){var n=this;this.events[t]||(this.events[t]=[]),this.events[t].push(e);var a=function(e){n.events[t].forEach((function(t){return t(e,e.detail)}))};this.events[t].listener=a,document.addEventListener(t,a)}},{key:"off",value:function(t,e){var n;this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})),null!==(n=this.events[t])&&void 0!==n&&n.length||(document.removeEventListener(t,this.events[t].listener),delete this.events[t].listener))}},{key:"trigger",value:function(t){var e=new CustomEvent(t,{detail:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}});document.dispatchEvent(e)}}])}(),r=awooc_scripts_settings,u=awooc_scripts_ajax,s=awooc_scripts_translate,c=function(){return i((function e(n){t(this,e),this.app=n,this.bindEvent()}),[{key:"bindEvent",value:function(){var t=this;document.addEventListener("click",(function(e){t.unBlock(e)}))}},{key:"showPopup",value:function(t){var e=this;jQuery.blockUI({message:r.template,css:r.popup.css,overlayCSS:r.popup.overlay,fadeIn:r.popup.fadeIn,fadeOut:r.popup.fadeOut,focusInput:r.popup.focusInput,bindEvents:!1,timeout:0,allowBodyStretch:!0,centerX:!0,centerY:!0,blockMsgClass:"blockMsg blockMsgAwooc",onBlock:function(){e.app.events.trigger("awooc_popup_open_trigger"),e.app.request.sendRequest(t)},onUnblock:function(){return e.app.events.trigger("awooc_popup_close_trigger")},onOverlayClick:function(){return document.documentElement.style.overflow="initial"}})}},{key:"unBlock",value:function(t){(t.target.classList.contains("awooc-close")||t.target.classList.contains("blockOverlay"))&&jQuery.unblockUI()}}])}(),l=function(){return i((function e(n){t(this,e),this.app=n,this.button=document.querySelectorAll("form.cart .awooc-button-js"),this.addToCartElements=document.querySelectorAll(".woocommerce-variation-add-to-cart .quantity, .woocommerce-variation-add-to-cart .single_add_to_cart_button"),this.disableClasses=["disabled","wc-variation-selection-needed"],this.disableClassesOutStock=["disabled","wc-variation-is-unavailable"]}),[{key:"init",value:function(){var t=this;document.addEventListener("click",(function(e){return t.handleShowPopup(e)})),jQuery(document.body).on("hide_variation",(function(){return t.toggleButtonClasses(t.button,"add",t.disableClasses)})).on("show_variation",(function(e,n,a){return t.updateButtonState(n,a)}))}},{key:"handleShowPopup",value:function(t){var e=t.target.closest(".awooc-button-js");if(e){if(e.classList.contains("disabled")){t.preventDefault();var n=e.classList.contains("wc-variation-is-unavailable")?wc_add_to_cart_variation_params.i18n_unavailable_text:wc_add_to_cart_variation_params.i18n_make_a_selection_text;return window.alert(n),!1}this.app.popup.showPopup(t)}}},{key:"updateButtonState",value:function(t,e){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||this.button;switch(r.mode){case"in_stock_add_to_card":this.handlePreloadMode(t,n);break;case"no_stock_no_price":this.handleSpecialMode(t,n);break;default:this.handleDefaultMode(e,n)}}},{key:"handlePreloadMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;t.backorders_allowed||!t.is_in_stock?(this.hideAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClassesOutStock)):(this.showAddToCartModule(),this.toggleButtonClasses(e,"add",this.disableClasses))}},{key:"handleSpecialMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;t.is_purchasable&&!t.is_in_stock?(this.hideAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClasses)):t.is_purchasable&&t.is_in_stock?(this.showAddToCartModule(),this.toggleButtonClasses(e,"remove",this.disableClasses)):(this.showAddToCartModule(),this.toggleButtonClasses(e,"add",this.disableClasses))}},{key:"handleDefaultMode",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||this.button;this.toggleButtonClasses(e,t?"remove":"add",this.disableClassesOutStock)}},{key:"toggleButtonClasses",value:function(t,e,n){t||(t=this.button),t instanceof NodeList&&(t=Array.from(t)),Array.isArray(t)||(t=[t]),t.forEach((function(t){t&&t.classList&&n.forEach((function(n){"string"==typeof n&&t.classList[e](n)}))}))}},{key:"toggleModuleVisibility",value:function(t){this.addToCartElements.forEach((function(e){return e.classList[t]("awooc-hide")})),this.button.forEach((function(e){return e.classList[t]("no-margin")}))}},{key:"hideAddToCartModule",value:function(){this.toggleModuleVisibility("add")}},{key:"showAddToCartModule",value:function(){this.toggleModuleVisibility("remove")}}])}();function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=Array(e);n<e;n++)a[n]=t[n];return a}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var a,i,o,r,u=[],s=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(a=o.call(n)).done)&&(u.push(a.value),u.length!==e);s=!0);}catch(t){c=!0,i=t}finally{try{if(!s&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw i}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return d(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var f=function(){return i((function e(n,a,i){t(this,e),this.toMail=n,this.request=a,this.qtyVal="",this.cache=a.cache,this.event=i}),[{key:"bindEvent",value:function(){var t=document.querySelector(".awooc-popup-qty");if(t){var e=t.querySelector(".awooc-popup-input-qty");e&&this.initializeQuantityInput(e)}}},{key:"initializeQuantityInput",value:function(t){var e=this;this.setMaxValueInput(t),this.updateAll(),t.addEventListener("input",(function(t){return e.handleInputEvent(t)})),this.handlerPlusMinusButtonsEvent(t)}},{key:"handlerPlusMinusButtonsEvent",value:function(t){var e=this,n=document.querySelector(".awooc-popup-input-qty--minus"),a=document.querySelector(".awooc-popup-input-qty--plus");n&&a&&(n.addEventListener("click",(function(){return e.updateInputQuantity(t,"decrease")})),a.addEventListener("click",(function(){return e.updateInputQuantity(t,"increase")})))}},{key:"updateInputQuantity",value:function(t,e){var n=parseFloat(t.value),a=this.getSafeValue(t.step,1),i=this.getSafeValue(t.min,-1/0),o=this.getSafeValue(t.max,1/0),r=n+("decrease"===e?-a:a),u=Math.max(0,-Math.floor(Math.log10(a)));(r=parseFloat(r.toFixed(u)))>=i&&r<=o&&(t.value=r,t.dispatchEvent(new Event("input",{bubbles:!0})))}},{key:"handleInputEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e||(e=t.target.closest(".awooc-popup-input-qty")),e&&(this.setMaxValueInput(e),this.qtyVal=e.value,this.updateAll())}},{key:"setMaxValueInput",value:function(t){var e=this.getSafeValue(t.min,t.step),n=this.getSafeValue(t.max,t.value);t.value=Math.min(Math.max(parseFloat(String(t.value))||e,e),n),this.qtyVal=t.value}},{key:"updateAll",value:function(){this.updateMailQuantity(),this.updateAmount(),this.updateMailData(),this.updateProductQuantity(),this.updateAnalytics()}},{key:"updateMailQuantity",value:function(){this.toMail.qty="".concat(s.product_qty).concat(this.qtyVal)}},{key:"updateMailData",value:function(){var t=document.querySelector('input[name="awooc-hidden-data"]');t&&(t.value=this.request.fillDataToMail(this.toMail))}},{key:"updateAnalytics",value:function(){this.request.app.analyticData.qty=this.qtyVal}},{key:"updateProductQuantity",value:function(){var t=document.querySelector('input[name="awooc_product_qty"]');t&&(t.value=this.qtyVal)}},{key:"updateAmount",value:function(){var t=this.getPrice();if(t){var e=this.displayPrice(this.parsePrice(t)*this.qtyVal);this.updateDOMAmount(e),this.updateMailAmount()}}},{key:"getPrice",value:function(){var t,e=document.querySelector(".awooc-popup-price .woocommerce-Price-currencyValue");return(null==e||null===(t=e.textContent)||void 0===t?void 0:t.replace(/\s+/g,""))||null}},{key:"getSafeValue",value:function(t,e){return""===t||Number.isNaN(parseFloat(t))?e:parseFloat(t)}},{key:"getPriceSettings",value:function(){var t=r.popup,e=t.price_num_decimals,n=void 0===e?0:e,a=t.price_decimal_sep,i=void 0===a?".":a,o=t.price_thousand_sep;return{decimalPlaces:n||0,decimalSeparator:i||".",thousandSeparator:(void 0===o?"":o)||""}}},{key:"displayPrice",value:function(t){var e=String(t).replace(/[^0-9.]/g,""),n=parseFloat(e);if(isNaN(n))return"Invalid number";var a=this.getPriceSettings(),i=a.decimalPlaces,o=a.decimalSeparator,r=a.thousandSeparator,u=p(String(n.toFixed(i)).split("."),2),s=u[0],c=u[1],l=s.replace(/\B(?=(\d{3})+(?!\d))/g,r),d=i>0?c.padEnd(i,"0").slice(0,i):"";return i>0&&d?"".concat(l).concat(o).concat(d):l}},{key:"parsePrice",value:function(t){t=null!=t?t:0;var e=this.getPriceSettings(),n=e.decimalPlaces,a=e.decimalSeparator,i=e.thousandSeparator,o=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")};if("number"!=typeof t&&(t=String(t),[i," ",".",","].filter(Boolean).forEach((function(e){e!==a&&(t=t.replace(new RegExp(o(e),"g"),""))})),"."!==a&&(t=t.replace(new RegExp(o(a),"g"),".")),t=t.replace(/\.+(?![^.]+$)|[^0-9.-]/g,"")),t=parseFloat(t)||0,!1!==n){var r=""===String(n)?2:parseInt(n,10);return t.toFixed(r)}return t.toFixed(20)}},{key:"updateDOMAmount",value:function(t){var e=document.querySelector(".awooc-popup-sum .woocommerce-Price-currencyValue");e&&(e.textContent=t)}},{key:"updateMailAmount",value:function(){var t=document.querySelector(".awooc-popup-sum bdi");t?this.toMail.sum="".concat(s.formatted_sum).concat(t.textContent):delete this.toMail.sum}}])}();function v(t,e,a){return(e=n(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){v(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var m,w=function(){return i((function e(n){t(this,e),this.request=n,this.defaultAttributes={}}),[{key:"collectData",value:function(t){var e=this.getBaseData(t);return this.setAttributesOnCatalog(t,e),this.serializeFormData(t,e),e}},{key:"getBaseData",value:function(t){return{id:this.request.getProductID(t),action:"awooc_ajax_product_form",nonce:u.nonce,attributes:y({},this.defaultAttributes)}}},{key:"setAttributesOnCatalog",value:function(t,e){e.attributes=y({},this.defaultAttributes);var n=t.target.dataset.selectedVariant;n&&(e.attributes=JSON.parse(n))}},{key:"serializeFormData",value:function(t,e){var n=t.target.closest(".cart");n&&(e.attributes=y({},this.defaultAttributes),this.processFormData(new FormData(n),e))}},{key:"processFormData",value:function(t,e){var n=this;t.forEach((function(t,a){n.updateDataField(e,a,t),a.startsWith("attribute_")&&n.updateDataField(e.attributes,a,t)})),delete e["add-to-cart"]}},{key:"updateDataField",value:function(t,e,n){t[e]=t[e]?[].concat(t[e],n):n}}])}(),b=function(){return i((function e(n){t(this,e),this.app=n,this.$=this.app.$,this.dataCollector=new w(this)}),[{key:"sendRequest",value:function(t){var e=this,n=this.dataCollector.collectData(t);this.app.xhr=this.$.ajax({url:u.url,data:n,type:"POST",dataType:"json",success:function(n){return e.handleSuccessResponse(n,t)},error:function(t){return e.handleErrorResponse(t)}})}},{key:"getProductID",value:function(t){var e,n=t.target.closest(".variations_form"),a=null==n||null===(e=n.querySelector('input[name="variation_id"]'))||void 0===e?void 0:e.value;return null!=a?a:t.target.dataset.valueProductId}},{key:"handleSuccessResponse",value:function(t,e){this.removeSkeleton();var n=t.data,a=n.toMail,i=n.toPopup,o=n.toAnalytics;this.fillDataToPopup(i),this.fillHiddenFormFields(a,e),new f(a,this,e).bindEvent(),this.app.analyticData=o,this.initUI(),this.closeMagnificPopup(),this.app.events.trigger("awooc_popup_ajax_trigger",t)}},{key:"handleErrorResponse",value:function(t){t.responseJSON&&console.error(t.responseJSON.data)}},{key:"fillDataToMail",value:function(t){return"\n".concat(s.product_data_title,"\n———\n").concat(Object.values(t).join("\n"))}},{key:"fillDataToPopup",value:function(t){Object.entries(t).forEach((function(t){var e=p(t,2),n=e[0],a=e[1],i=document.querySelector(".awooc-popup-".concat(n));i&&(i.innerHTML=a)}))}},{key:"fillHiddenFormFields",value:function(t,e){this.updateField("awooc_product_id",this.getProductID(e)),this.updateField("awooc_product_qty",this.getQty()),this.updateField("awooc-hidden-data",this.fillDataToMail(t))}},{key:"updateField",value:function(t,e){var n=document.querySelector('input[name="'.concat(t,'"]'));n&&(n.value=e)}},{key:"initUI",value:function(){this.app.form.initContactForm(),this.app.form.initMask()}},{key:"removeSkeleton",value:function(){document.querySelectorAll(".awooc-popup-inner .awooc-popup-item").forEach((function(t){t.classList.remove("skeleton-loader")}))}},{key:"closeMagnificPopup",value:function(){var t;null!==(t=this.$.magnificPopup)&&void 0!==t&&t.instance&&this.$.magnificPopup.close()}},{key:"getQty",value:function(){var t=document.querySelector('.quantity input[name="quantity"]');return t?t.value:1}}])}(),g=function(){return i((function e(n){t(this,e),this.app=n;var a=r.popup,i=a.cf7_form_id,o=a.mailsent_timeout,u=a.invalid_timeout;this.formId=Number(i),this.mailsentTimeout=o,this.invalidTimeout=u}),[{key:"init",value:function(){this.bindEvents()}},{key:"bindEvents",value:function(){var t=this;document.addEventListener("wpcf7mailsent",(function(e){return t.handleMailSent(e)})),document.addEventListener("wpcf7invalid",(function(e){return t.handleInvalid(e)})),this.app.events.on("awooc_popup_ajax_trigger",(function(){return t.setupFormSubmitListener()}))}},{key:"setupFormSubmitListener",value:function(){var t=this,e=document.querySelector("form.wpcf7-form");e&&e.addEventListener("submit",(function(e){return t.handleFormSubmit(e)}))}},{key:"handleMailSent",value:function(t){var e=t.detail;setTimeout((function(){return jQuery.unblockUI()}),this.mailsentTimeout),this.formId===e.contactFormId&&this.app.events.trigger("awooc_mail_sent_trigger",{selectedProduct:this.app.analyticData,mailDetail:e})}},{key:"handleInvalid",value:function(t){var e=this,n=t.detail;this.formId===n.contactFormId&&this.app.events.trigger("awooc_mail_invalid_trigger"),setTimeout((function(){return e.clearFormErrors()}),this.invalidTimeout)}},{key:"clearFormErrors",value:function(){var t=document.querySelector(".awooc-form-custom-order .wpcf7-response-output"),e=document.querySelectorAll(".awooc-form-custom-order .wpcf7-not-valid-tip"),n=document.querySelector('.awooc-form-custom-order input[type="submit"]');t&&(t.innerHTML=""),n&&(n.disabled=!1),e.forEach((function(t){return t.remove()}))}},{key:"handleFormSubmit",value:function(t){var e=t.currentTarget.querySelector('input[type="submit"]');e&&(e.disabled=!0)}},{key:"initContactForm",value:function(){var t=this;document.querySelectorAll(".awooc-form-custom-order div.wpcf7 > form").forEach((function(e){var n=e.querySelector('input[name="_wpcf7_version"]');n&&(n.value&&n.value<="5.4"?t.initOldWpcf7(e):wpcf7.init(e))}))}},{key:"initOldWpcf7",value:function(t){wpcf7.initForm(t),wpcf7.cached&&wpcf7.refill(t)}},{key:"initMask",value:function(){document.querySelectorAll(".awooc-form-custom-order .wpcf7-mask").forEach((function(t){var e=jQuery(t).data("mask");if(e)try{jQuery(t).mask(e),/[a*]/.test(e)||t.setAttribute("inputmode","numeric")}catch(t){console.error("Error ".concat(t.name,": ").concat(t.message,"\n").concat(t.stack))}}))}}])}(),k=function(){return i((function e(n){t(this,e),this.app=n,this.variationForms=document.querySelectorAll(".cfvsw_variations_form, form.variations_form"),this.buttons=this.getButtons()}),[{key:"getButtons",value:function(){return Array.from(this.variationForms).map((function(t){return t.closest("li")})).filter((function(t){return null!==t})).flatMap((function(t){return Array.from(t.querySelectorAll(".awooc-button-js"))}))}},{key:"init",value:function(){this.variationForms.length<0||(this.addedToButtonAttributes(),this.disableButtons(),this.bindEvents())}},{key:"bindEvents",value:function(){var t=this;document.addEventListener("cfvswVariationLoad",(function(){return t.addedToButtonAttributes()})),document.addEventListener("astraInfinitePaginationLoaded",(function(){return t.addedToButtonAttributes()})),document.querySelectorAll(".cfvsw-swatches-option").forEach((function(e){e.addEventListener("click",(function(e){return t.onClickSwatchesOption(e)}))}))}},{key:"addedToButtonAttributes",value:function(){var t=this;this.variationForms.forEach((function(e){jQuery(e).wc_variation_form(),e.dataset.cfvswCatalog||jQuery(e).on("found_variation",(function(){return t.updateButtonData(e)}))}))}},{key:"updateButtonData",value:function(t){var e,n=t.querySelectorAll(".variations select"),a={},i=null===(e=t.closest("li"))||void 0===e?void 0:e.querySelector(".awooc-button-js");n.forEach((function(t){var e=t.dataset.attributeName||t.name;a[e]=t.value||""})),i&&(i.disabled=!1,i.classList.add("cfvsw_variation_found"),i.dataset.selectedVariant=JSON.stringify(a))}},{key:"onClickSwatchesOption",value:function(t){var e=t.target;this.isSwatchSelected(e)?this.resetButtonData(e):(this.deselectAllSwatches(e),this.selectSwatch(e)),this.updateSelectOption(e)}},{key:"resetButtonData",value:function(t){var e,n=null===(e=t.closest("li"))||void 0===e?void 0:e.querySelector(".awooc-button-js");if(n){var a=this.getSelectElement(t);(null==a?void 0:a.value)&&""!==a.value?this.updateButtonData(t.closest("form")):(n.disabled=!0,n.classList.remove("cfvsw_variation_found"),n.dataset.selectedVariant="")}}},{key:"updateSelectOption",value:function(t){var e=this.getSwatchValue(t),n=this.getSelectElement(t);n&&(n.value=e,setTimeout((function(){n.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}),50))}},{key:"isSwatchSelected",value:function(t){return(!t.classList.contains("cfvsw-swatches-disabled")||!t.classList.contains("cfvsw-swatches-out-of-stock"))&&t.classList.contains("cfvsw-selected-swatch")}},{key:"deselectAllSwatches",value:function(t){t.parentElement.querySelectorAll(".cfvsw-swatches-option").forEach((function(t){return t.classList.remove("cfvsw-selected-swatch")}))}},{key:"selectSwatch",value:function(t){t.classList.add("cfvsw-selected-swatch")}},{key:"getSwatchValue",value:function(t){return this.isSwatchSelected(t)?t.dataset.slug:""}},{key:"getSelectElement",value:function(t){var e;return null===(e=t.closest(".cfvsw-swatches-container"))||void 0===e||null===(e=e.previousElementSibling)||void 0===e?void 0:e.querySelector("select")}},{key:"disableButtons",value:function(){this.buttons.forEach((function(t){return t.disabled=!0}))}}])}(),S=function(){return i((function e(n){t(this,e),this.app=n}),[{key:"init",value:function(){var t=this;jQuery(document.body).on("woodmart-quick-view-displayed",(function(){var e=document.querySelector(".product.quick-shop-loaded form.cart .awooc-button-js");e&&jQuery(".product.quick-shop-loaded").find(".variations_form").on("hide_variation",(function(){return t.app.buttons.toggleButtonClasses([e],"add",t.app.buttons.disableClasses)})).on("show_variation",(function(n,a,i){return t.app.buttons.updateButtonState(a,i,[e])}))}))}}])}(),_=function(){return i((function e(n){t(this,e),this.validateGlobals()&&(this.$=n,this.xhr=!1,this.analyticData={},this.events=new o,this.popup=new c(this),this.buttons=new l(this),this.request=new b(this),this.form=new g(this),this.variationSwatches=new k(this),this.woodmart=new S(this),this.init())}),[{key:"init",value:function(){this.buttons.init(),this.form.init(),this.variationSwatches.init(),this.woodmart.init()}},{key:"validateGlobals",value:function(){var t={awooc_scripts_ajax:"awooc_scripts_ajax not found",awooc_scripts_translate:"awooc_scripts_translate not found",awooc_scripts_settings:"awooc_scripts_settings not found",wpcf7:"На странице не существует объекта wpcf7. Что-то не так с темой..."};for(var e in t)if(void 0===window[e]||null===window[e])return console.warn(t[e]),!1;return!0}}])}();(function(t){var e="awooc_",n=t.fn.on,a=t.fn.trigger;t.fn.on=function(t,a,i,o){return"function"==typeof a?(o=a,a=void 0,i=void 0):"function"==typeof i&&(o=i,i=void 0),"string"==typeof t&&t.startsWith(e)&&o?n.call(this,t,a,i,(function(e){o.length>1&&console.warn("[WARNING] '".concat(t,"' передает данные через event.detail, но обработчик ожидает data. Используйте event.detail вместо второго аргумента.")),o.call(this,e,e.detail)})):n.apply(this,arguments)},t.fn.trigger=function(t,n){if("string"==typeof t&&t.startsWith(e)){var i=new CustomEvent(t,{detail:n});return document.dispatchEvent(i),this}return a.apply(this,arguments)},document.addEventListener(e,(function(n){n.type.startsWith(e)&&t(document).triggerHandler(n.type,n.detail)}),!0)})(m=jQuery),m(document).ready((function(){window.AwoocAppCore||(window.AwoocAppCore=new _(m))}))})(); -
art-woocommerce-order-one-click/trunk/classes/Prepare/Prepare.php
r3232179 r3286706 323 323 } 324 324 325 if ( defined( 'ICL_LANGUAGE_CODE' ) && ! defined( 'WP_CLI' ) ) { 326 $select_form = apply_filters( 327 'wpml_object_id', 328 $select_form, 329 'wpcf7_contact_form', 330 true, 331 ICL_LANGUAGE_CODE 332 ); 333 } 334 325 335 return wpcf7_contact_form_tag_func( [ 'id' => esc_attr( $select_form ) ], null, 'contact-form-7' ); 326 336 } -
art-woocommerce-order-one-click/trunk/classes/RequestProcessing/EmailModifier.php
r3232179 r3286706 35 35 public function add_hidden_fields( $fields ): array { 36 36 37 $form_id = WPCF7_ContactForm::get_current()->id();38 $ select_form = $this->main->get_selected_form_id();39 40 if ( $select_form !== $form_id) {37 // phpcs:disable WordPress.Security.NonceVerification.Recommended 38 $is_ajax_request = wp_doing_ajax() && isset( $_REQUEST['action'] ) && 'awooc_ajax_product_form' === $_REQUEST['action']; 39 // phpcs:enable WordPress.Security.NonceVerification.Recommended 40 if ( ! $is_ajax_request ) { 41 41 return $fields; 42 42 } … … 54 54 if ( class_exists( 'Polylang' ) && ! defined( 'WP_CLI' ) ) { 55 55 $addon_fields['lang'] = pll_current_language(); 56 } 57 58 if ( defined( 'ICL_LANGUAGE_CODE' ) && ! defined( 'WP_CLI' ) ) { 59 $addon_fields['lang'] = ICL_LANGUAGE_CODE; 56 60 } 57 61 -
art-woocommerce-order-one-click/trunk/readme.txt
r3253620 r3286706 4 4 Tags: woocommerce, mode catalog 5 5 Requires at least: 5.5 6 Tested up to: 6. 77 Stable tag: 3.1. 76 Tested up to: 6.8 7 Stable tag: 3.1.8 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 100 100 101 101 == Changelog == 102 = [3.1.7 - 2025-03-11 = 102 = [3.1.8] - 2025-05-03 = 103 * Добавлено: поддержка WPML для мультиязычности 104 * Исправлено: поведение при дефолтных атрибутах и использовании плагина Variation Swatches for WooCommerce 105 * Исправлено: поддержка WP 6.8 106 107 = [3.1.7] - 2025-03-11 = 103 108 * Исправлено: ошибка версионности 104 109 -
art-woocommerce-order-one-click/trunk/vendor/autoload.php
r3232179 r3286706 15 15 } 16 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 17 throw new RuntimeException($err); 21 18 } 22 19 -
art-woocommerce-order-one-click/trunk/vendor/composer/InstalledVersions.php
r3232179 r3286706 27 27 class InstalledVersions 28 28 { 29 /** 30 * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to 31 * @internal 32 */ 33 private static $selfDir = null; 34 29 35 /** 30 36 * @var mixed[]|null … … 324 330 325 331 /** 332 * @return string 333 */ 334 private static function getSelfDir() 335 { 336 if (self::$selfDir === null) { 337 self::$selfDir = strtr(__DIR__, '\\', '/'); 338 } 339 340 return self::$selfDir; 341 } 342 343 /** 326 344 * @return array[] 327 345 * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> … … 337 355 338 356 if (self::$canGetVendors) { 339 $selfDir = s trtr(__DIR__, '\\', '/');357 $selfDir = self::getSelfDir(); 340 358 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 341 359 $vendorDir = strtr($vendorDir, '\\', '/'); -
art-woocommerce-order-one-click/trunk/vendor/composer/installed.php
r3253620 r3286706 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' 6d16c24dbae220f748175c4c75cf68b96560bfb8',6 'reference' => '2b40a4b4e80e42b85d3b97042ddd808d9a692374', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' 6d16c24dbae220f748175c4c75cf68b96560bfb8',16 'reference' => '2b40a4b4e80e42b85d3b97042ddd808d9a692374', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.