Plugin Directory

Changeset 3235619

Timestamp:
02/05/2025 06:47:46 PM (13 months ago)
Author:
artabr
Message:

Update to version 3.1.3 from GitHub

Location:
art-woocommerce-order-one-click
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • art-woocommerce-order-one-click/tags/3.1.3/art-woo-order-one-click.php

    r3234688 r3235619  
    66 * Domain Path: /languages
    77 * 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.2
     8 * Version: 3.1.
    99 * Author: Artem Abramovich
    1010 * Author URI: https://wpruse.ru/
  • art-woocommerce-order-one-click/tags/3.1.3/assets/js/awooc-public-script.js

    r3232939 r3235619  
    484484        return _this.handleInputEvent(e);
    485485      });
     486
     487
     488
     489
     490
     491
    486492      var minusButton = document.querySelector('.awooc-popup-input-qty--minus');
    487493      var plusButton = document.querySelector('.awooc-popup-input-qty--plus');
    488494      if (minusButton && plusButton) {
    489         this.handlerPlusMinusButtonsEvent(quantityInput, minusButton, plusButton);
    490       }
    491     }
    492   }, {
    493     key: "handlerPlusMinusButtonsEvent",
    494     value: function handlerPlusMinusButtonsEvent(quantityInput, minusButton, plusButton) {
    495       var _this2 = this;
    496       minusButton.addEventListener('click', function () {
    497         return _this2.updateInputQuantity(quantityInput, 'decrease');
    498       });
    499       plusButton.addEventListener('click', function () {
    500         return _this2.updateInputQuantity(quantityInput, 'increase');
    501       });
     495        minusButton.addEventListener('click', function () {
     496          return _this2.updateInputQuantity(quantityInput, 'decrease');
     497        });
     498        plusButton.addEventListener('click', function () {
     499          return _this2.updateInputQuantity(quantityInput, 'increase');
     500        });
     501      }
    502502    }
    503503  }, {
     
    509509      var maxValue = this.getSafeValue(inputElement.max, Infinity);
    510510      var newValue = currentValue + (action === 'decrease' ? -step : step);
     511
     512
     513
    511514      if (newValue >= minValue && newValue <= maxValue) {
    512515        inputElement.value = newValue;
     
    533536    key: "setMaxValueInput",
    534537    value: function setMaxValueInput(input) {
    535       var minValue = this.getSafeValue(input.min, 1);
     538      var minValue = this.getSafeValue(input.min, );
    536539      var maxValue = this.getSafeValue(input.max, input.value);
    537       input.value = Math.min(Math.max(parseInt(String(input.value), 10) || minValue, minValue), maxValue);
     540      input.value = Math.min(Math.max(parse) || minValue, minValue), maxValue);
    538541      this.qtyVal = input.value;
    539542    }
  • art-woocommerce-order-one-click/tags/3.1.3/assets/js/awooc-public-script.min.js

    r3232939 r3235619  
    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 f(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 p=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)}));var n=document.querySelector(".awooc-popup-input-qty--minus"),a=document.querySelector(".awooc-popup-input-qty--plus");n&&a&&this.handlerPlusMinusButtonsEvent(t,n,a)}},{key:"handlerPlusMinusButtonsEvent",value:function(t,e,n){var a=this;e.addEventListener("click",(function(){return a.updateInputQuantity(t,"decrease")})),n.addEventListener("click",(function(){return a.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);r>=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,1),n=this.getSafeValue(t.max,t.value);t.value=Math.min(Math.max(parseInt(String(t.value),10)||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.formatNumber(this.formatDecimal(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:"formatNumber",value:function(t){var e="number"==typeof t?t:parseFloat(t);if(isNaN(e))return"Invalid number";var n=r.popup,a=n.price_decimal_sep,i=n.price_thousand_sep,o=n.price_num_decimals,u=f(String(e).split("."),2),s=u[0],c=u[1],l=s.replace(/\B(?=(\d{3})+(?!\d))/g,i),d=(c||"").padEnd(o,"0").slice(0,o);return"".concat(l).concat(a).concat(d)}},{key:"formatDecimal",value:function(t){t=null!=t?t:0;var e=r.popup,n=e.price_num_decimals,a=e.price_decimal_sep;"number"!=typeof t&&([".",a].forEach((function(e){t=String(t).replace(new RegExp("\\".concat(e),"g"),".")})),t=(t=t.replace(/[^0-9.-]/g,"")).replace(/\.+(?![^.]+$)|[^0-9.-]/g,""));if(t=parseFloat(t),!1!==n){var i=""===String(n)?2:parseInt(String(n),10);t=t.toFixed(i)}else"number"==typeof t&&(t=t.toFixed(20));return t}},{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 p(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=f(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.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}))}}])}(),_=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])}))}))}}])}(),S=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 _(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 S(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 f(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 p=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)})))||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.formatNumber(this.formatDecimal(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:"formatNumber",value:function(t){var e="number"==typeof t?t:parseFloat(t);if(isNaN(e))return"Invalid number";var n=r.popup,a=n.price_decimal_sep,i=n.price_thousand_sep,o=n.price_num_decimals,u=f(String(e).split("."),2),s=u[0],c=u[1],l=s.replace(/\B(?=(\d{3})+(?!\d))/g,i),d=(c||"").padEnd(o,"0").slice(0,o);return"".concat(l).concat(a).concat(d)}},{key:"formatDecimal",value:function(t){t=null!=t?t:0;var e=r.popup,n=e.price_num_decimals,a=e.price_decimal_sep;"number"!=typeof t&&([".",a].forEach((function(e){t=String(t).replace(new RegExp("\\".concat(e),"g"),".")})),t=(t=t.replace(/[^0-9.-]/g,"")).replace(/\.+(?![^.]+$)|[^0-9.-]/g,""));if(t=parseFloat(t),!1!==n){var i=""===String(n)?2:parseInt(String(n),10);t=t.toFixed(i)}else"number"==typeof t&&(t=t.toFixed(20));return t}},{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 p(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=f(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.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}))}}])}(),_=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])}))}))}}])}(),S=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 _(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 S(m))}))})();
  • art-woocommerce-order-one-click/tags/3.1.3/classes/Prepare/Popup.php

    r3232179 r3235619  
    191191        $negative        = $price < 0;
    192192        $formatted_price = ( $negative ? '-' : '' ) . sprintf(
    193             $args['price_format'],
    194             '<span class="woocommerce-Price-currencySymbol">' . get_woocommerce_currency_symbol( $args['currency'] ) . '</span>',
    195             '<span class="woocommerce-Price-currencyValue">' . $price . '</span>'
    196         );
     193            $args['price_format'],
     194            '<span class="woocommerce-Price-currencySymbol">' . get_woocommerce_currency_symbol( $args['currency'] ) . '</span>',
     195            '<span class="woocommerce-Price-currencyValue">' . $price . '</span>'
     196        );
    197197
    198198        return '<span class="woocommerce-Price-amount amount"><bdi>' . $formatted_price . '</bdi></span>';
     
    235235            $this->main->get_template( 'quantity-input.php' ),
    236236            true,
    237             $args
     237           
    238238        );
    239239
  • art-woocommerce-order-one-click/tags/3.1.3/languages/art-woocommerce-order-one-click-ru_RU.po

    r3234688 r3235619  
    22msgstr ""
    33"Project-Id-Version: art-woocommerce-order-one-click\n"
    4 "POT-Creation-Date: 2025-02-04 15:14+0400\n"
    5 "PO-Revision-Date: 2025-02-04 15:15+0400\n"
     4"POT-Creation-Date: 2025-02-04 15:1+0400\n"
     5"PO-Revision-Date: 2025-02-04 1+0400\n"
    66"Last-Translator: Абрамович Артем | artabr.ru <artikus.sol@gmail.com>\n"
    77"Language-Team: \n"
  • art-woocommerce-order-one-click/tags/3.1.3/readme.txt

    r3234688 r3235619  
    55Requires at least: 5.5
    66Tested up to: 6.7
    7 Stable tag: 3.1.2
     7Stable tag: 3.1.
    88Requires PHP: 7.4
    99License: GPLv2 or later
  • art-woocommerce-order-one-click/tags/3.1.3/vendor/composer/installed.php

    r3234688 r3235619  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '93014740b6443630729b439a1707fb794eb4ec0b',
     6        'reference' => '',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => '93014740b6443630729b439a1707fb794eb4ec0b',
     16            'reference' => '',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • art-woocommerce-order-one-click/trunk/art-woo-order-one-click.php

    r3234688 r3235619  
    66 * Domain Path: /languages
    77 * 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.2
     8 * Version: 3.1.
    99 * Author: Artem Abramovich
    1010 * Author URI: https://wpruse.ru/
  • art-woocommerce-order-one-click/trunk/assets/js/awooc-public-script.js

    r3232939 r3235619  
    484484        return _this.handleInputEvent(e);
    485485      });
     486
     487
     488
     489
     490
     491
    486492      var minusButton = document.querySelector('.awooc-popup-input-qty--minus');
    487493      var plusButton = document.querySelector('.awooc-popup-input-qty--plus');
    488494      if (minusButton && plusButton) {
    489         this.handlerPlusMinusButtonsEvent(quantityInput, minusButton, plusButton);
    490       }
    491     }
    492   }, {
    493     key: "handlerPlusMinusButtonsEvent",
    494     value: function handlerPlusMinusButtonsEvent(quantityInput, minusButton, plusButton) {
    495       var _this2 = this;
    496       minusButton.addEventListener('click', function () {
    497         return _this2.updateInputQuantity(quantityInput, 'decrease');
    498       });
    499       plusButton.addEventListener('click', function () {
    500         return _this2.updateInputQuantity(quantityInput, 'increase');
    501       });
     495        minusButton.addEventListener('click', function () {
     496          return _this2.updateInputQuantity(quantityInput, 'decrease');
     497        });
     498        plusButton.addEventListener('click', function () {
     499          return _this2.updateInputQuantity(quantityInput, 'increase');
     500        });
     501      }
    502502    }
    503503  }, {
     
    509509      var maxValue = this.getSafeValue(inputElement.max, Infinity);
    510510      var newValue = currentValue + (action === 'decrease' ? -step : step);
     511
     512
     513
    511514      if (newValue >= minValue && newValue <= maxValue) {
    512515        inputElement.value = newValue;
     
    533536    key: "setMaxValueInput",
    534537    value: function setMaxValueInput(input) {
    535       var minValue = this.getSafeValue(input.min, 1);
     538      var minValue = this.getSafeValue(input.min, );
    536539      var maxValue = this.getSafeValue(input.max, input.value);
    537       input.value = Math.min(Math.max(parseInt(String(input.value), 10) || minValue, minValue), maxValue);
     540      input.value = Math.min(Math.max(parse) || minValue, minValue), maxValue);
    538541      this.qtyVal = input.value;
    539542    }
  • art-woocommerce-order-one-click/trunk/assets/js/awooc-public-script.min.js

    r3232939 r3235619  
    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 f(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 p=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)}));var n=document.querySelector(".awooc-popup-input-qty--minus"),a=document.querySelector(".awooc-popup-input-qty--plus");n&&a&&this.handlerPlusMinusButtonsEvent(t,n,a)}},{key:"handlerPlusMinusButtonsEvent",value:function(t,e,n){var a=this;e.addEventListener("click",(function(){return a.updateInputQuantity(t,"decrease")})),n.addEventListener("click",(function(){return a.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);r>=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,1),n=this.getSafeValue(t.max,t.value);t.value=Math.min(Math.max(parseInt(String(t.value),10)||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.formatNumber(this.formatDecimal(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:"formatNumber",value:function(t){var e="number"==typeof t?t:parseFloat(t);if(isNaN(e))return"Invalid number";var n=r.popup,a=n.price_decimal_sep,i=n.price_thousand_sep,o=n.price_num_decimals,u=f(String(e).split("."),2),s=u[0],c=u[1],l=s.replace(/\B(?=(\d{3})+(?!\d))/g,i),d=(c||"").padEnd(o,"0").slice(0,o);return"".concat(l).concat(a).concat(d)}},{key:"formatDecimal",value:function(t){t=null!=t?t:0;var e=r.popup,n=e.price_num_decimals,a=e.price_decimal_sep;"number"!=typeof t&&([".",a].forEach((function(e){t=String(t).replace(new RegExp("\\".concat(e),"g"),".")})),t=(t=t.replace(/[^0-9.-]/g,"")).replace(/\.+(?![^.]+$)|[^0-9.-]/g,""));if(t=parseFloat(t),!1!==n){var i=""===String(n)?2:parseInt(String(n),10);t=t.toFixed(i)}else"number"==typeof t&&(t=t.toFixed(20));return t}},{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 p(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=f(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.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}))}}])}(),_=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])}))}))}}])}(),S=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 _(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 S(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 f(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 p=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)})))||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.formatNumber(this.formatDecimal(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:"formatNumber",value:function(t){var e="number"==typeof t?t:parseFloat(t);if(isNaN(e))return"Invalid number";var n=r.popup,a=n.price_decimal_sep,i=n.price_thousand_sep,o=n.price_num_decimals,u=f(String(e).split("."),2),s=u[0],c=u[1],l=s.replace(/\B(?=(\d{3})+(?!\d))/g,i),d=(c||"").padEnd(o,"0").slice(0,o);return"".concat(l).concat(a).concat(d)}},{key:"formatDecimal",value:function(t){t=null!=t?t:0;var e=r.popup,n=e.price_num_decimals,a=e.price_decimal_sep;"number"!=typeof t&&([".",a].forEach((function(e){t=String(t).replace(new RegExp("\\".concat(e),"g"),".")})),t=(t=t.replace(/[^0-9.-]/g,"")).replace(/\.+(?![^.]+$)|[^0-9.-]/g,""));if(t=parseFloat(t),!1!==n){var i=""===String(n)?2:parseInt(String(n),10);t=t.toFixed(i)}else"number"==typeof t&&(t=t.toFixed(20));return t}},{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 p(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=f(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.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}))}}])}(),_=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])}))}))}}])}(),S=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 _(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 S(m))}))})();
  • art-woocommerce-order-one-click/trunk/classes/Prepare/Popup.php

    r3232179 r3235619  
    191191        $negative        = $price < 0;
    192192        $formatted_price = ( $negative ? '-' : '' ) . sprintf(
    193             $args['price_format'],
    194             '<span class="woocommerce-Price-currencySymbol">' . get_woocommerce_currency_symbol( $args['currency'] ) . '</span>',
    195             '<span class="woocommerce-Price-currencyValue">' . $price . '</span>'
    196         );
     193            $args['price_format'],
     194            '<span class="woocommerce-Price-currencySymbol">' . get_woocommerce_currency_symbol( $args['currency'] ) . '</span>',
     195            '<span class="woocommerce-Price-currencyValue">' . $price . '</span>'
     196        );
    197197
    198198        return '<span class="woocommerce-Price-amount amount"><bdi>' . $formatted_price . '</bdi></span>';
     
    235235            $this->main->get_template( 'quantity-input.php' ),
    236236            true,
    237             $args
     237           
    238238        );
    239239
  • art-woocommerce-order-one-click/trunk/languages/art-woocommerce-order-one-click-ru_RU.po

    r3234688 r3235619  
    22msgstr ""
    33"Project-Id-Version: art-woocommerce-order-one-click\n"
    4 "POT-Creation-Date: 2025-02-04 15:14+0400\n"
    5 "PO-Revision-Date: 2025-02-04 15:15+0400\n"
     4"POT-Creation-Date: 2025-02-04 15:1+0400\n"
     5"PO-Revision-Date: 2025-02-04 1+0400\n"
    66"Last-Translator: Абрамович Артем | artabr.ru <artikus.sol@gmail.com>\n"
    77"Language-Team: \n"
  • art-woocommerce-order-one-click/trunk/readme.txt

    r3234688 r3235619  
    55Requires at least: 5.5
    66Tested up to: 6.7
    7 Stable tag: 3.1.2
     7Stable tag: 3.1.
    88Requires PHP: 7.4
    99License: GPLv2 or later
  • art-woocommerce-order-one-click/trunk/vendor/composer/installed.php

    r3234688 r3235619  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '93014740b6443630729b439a1707fb794eb4ec0b',
     6        'reference' => '',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => '93014740b6443630729b439a1707fb794eb4ec0b',
     16            'reference' => '',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.