diff --git a/README.txt b/README.txt index 91d5202..0e47c36 100644 --- a/README.txt +++ b/README.txt @@ -4,7 +4,7 @@ Donate link: https://www.udesly.com/ Tags: webflow to wordpress, editor, page builder, layout design, udesly, webflow Requires at least: 5.0 Tested up to: 5.2.3 -Stable tag: 2.0.23 +Stable tag: 2.0.24 License: GPLv3 or later License URI: https://www.udesly.com/terms-conditions-of-use/#udesly-wordpress-plugin Requires PHP: 7.0.0 @@ -82,6 +82,9 @@ Absolutely! You can use the Udesly Adapter to create more than one website. == Changelog == += 2.0.24 = +* Minor Bug fix + = 2.0.23 = * Fixed Fatal error on WC get cart contents on null * Fixed missing token check on password reset request diff --git a/assets/css/ajax-loading.css b/assets/css/ajax-loading.css index 919e95b..413466a 100644 --- a/assets/css/ajax-loading.css +++ b/assets/css/ajax-loading.css @@ -2,6 +2,10 @@ visibility: hidden; } +[data-udy-fe-enabled="link_"] a * { + pointer-events: none; +} + [udy-el="wc-variation-add-to-cart"] select { display: none; } diff --git a/assets/js/bundle/udesly-wf-wc.bundle.min.js b/assets/js/bundle/udesly-wf-wc.bundle.min.js index f71ee8e..acb5cd6 100644 --- a/assets/js/bundle/udesly-wf-wc.bundle.min.js +++ b/assets/js/bundle/udesly-wf-wc.bundle.min.js @@ -1 +1 @@ -!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";function t(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?document.querySelector('[udy-el="'.concat(t,'"]')):document.querySelectorAll('[udy-el="'.concat(t,'"]'))}var e=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function r(t,e){for(var r=0;r3?f.length%3:0,p=d+(h?f.substr(0,h)+e.thousand:"")+f.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+e.thousand)+(e.precision>0?e.decimal+a(Math.abs(t),e.precision).split(".")[1]:"");return e.stripZeros?(n=p,o=e.decimal,s=n.split(o),u=s[0],(l=s[1].replace(/0+$/,"")).length>0?u+o+l:u):p}var s=e(function(t){var e=String.prototype.valueOf,r=Object.prototype.toString,n="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"string"==typeof t||"object"==typeof t&&(n?function(t){try{return e.call(t),!0}catch(t){return!1}}(t):"[object String]"===r.call(t))}}),u=s&&"object"==typeof s&&"default"in s?s.default:s;function l(t){return u(t)&&t.match("%v")?{pos:t,neg:t.replace("-","").replace("%v","-%v"),zero:t}:t}function d(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(Array.isArray(t))return t.map(function(t){return d(t,e)});var n=l((e=i({},r,e)).format);return(t>0?n.pos:t<0?n.neg:n.zero).replace("%s",e.symbol).replace("%v",c(Math.abs(t),e))}t.settings=r,t.unformat=n,t.toFixed=a,t.formatMoney=d,t.formatNumber=c,t.formatColumn=function t(e){var a=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(!e)return[];var o=l((a=i({},r,a)).format),s=o.pos.indexOf("%s")0?o.pos:e<0?o.neg:o.zero).replace("%s",a.symbol).replace("%v",c(Math.abs(e),a));return r.length>d&&(d=r.length),r});return f.map(function(t){return u(t)&&t.length'.concat(e,"")}}]),r}(),h=function(){function t(r){var n=this;e(this,t),this.el=r,this.selects={},this.el.querySelectorAll("select").forEach(function(t){var e=t.getAttribute("name");n.selects[e]=t}),jQuery(this.el).on("check_variations",function(){return n.alignRadios()}),this.radios=this.el.querySelectorAll('input[type="radio"]'),this.labels=this.el.querySelectorAll('[udy-el="wc-variations-options"] label'),this.variationsData=JSON.parse(this.el.getAttribute("data-product_variations")),this.listen(),setTimeout(function(){n.alignRadios()},500)}return n(t,[{key:"listen",value:function(){var t=this;this.el.addEventListener("change",function(e){if(e.target.matches('input[type="radio"]')){var r=e.target.getAttribute("name");t.selects[r].value=e.target.value,t.selects[r].dispatchEvent(new Event("change",{bubbles:!0})),t.alignRadios()}})}},{key:"alignRadios",value:function(){var t=this;this.radios.forEach(function(t){t.disabled=!0}),this.labels.forEach(function(t){t.classList.remove("selected"),t.classList.add("disabled")});var e=function(e){Array.from(t.selects[e].options).forEach(function(r){if(r.classList.contains("enabled")&&r.value){t.el.querySelector('input[type="radio"][name="'.concat(e,'"][value="').concat(r.value,'"]')).disabled=!1;var n=t.el.querySelector('label[for="'.concat(r.value.toLowerCase(),'"]'));n&&n.classList.remove("disabled")}});var r=t.el.querySelector('label[for="'.concat(t.selects[e].value.toLowerCase(),'"]'));r&&r.classList.add("selected")};for(var r in this.selects)e(r);var n,a,o=this.el.querySelector('input[name="variation_id"]').value,i=this.variationsData.filter(function(t){return t.variation_id==o})[0];if(i){var c=i.display_price,u=i.display_regular_price,l=i.image_id,d=i.image;n=c,a=u,document.body.dispatchEvent(new CustomEvent("change-price",{detail:{price:n,regularPrice:a}})),s(l,d.url)}}}]),t}(),p=function(){function t(r){var n=this;e(this,t),this.slider=r,u(function(t){return n.handleImageChange(t.detail)}),this.images=this.slider.querySelectorAll("[data-wc-slider-image-id]"),this.dots=this.slider.querySelectorAll(".w-slider-dot");var a=this.slider.querySelector(".w-slider-nav");new MutationObserver(function(t,e){var r=!0,a=!1,o=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done);r=!0)if("class"===i.value.attributeName){var u=m(n.slider.querySelector(".w-slider-dot.w-active"));-1!==u&&n.images[u]&&s(n.images[u].getAttribute("data-wc-slider-image-id"))}}catch(t){a=!0,o=t}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}}).observe(a,{attributes:!0,childList:!1,subtree:!0})}return n(t,[{key:"handleImageChange",value:function(t){var e=t.id;t.url;if(e){var r=m(this.slider.querySelector('[data-wc-slider-image-id="'.concat(e,'"]')));-1!==r&&this.dots[r]&&this.dots[r].dispatchEvent(new Event("click",{bubbles:!0}))}}}]),t}();function m(t){if(!t)return-1;for(var e=0;t=t.previousElementSibling;)e++;return e}var y=function(){function r(){var n=this;e(this,r),this.featuredImages=t("wc-featured-image"),this.thumbImages=[],document.querySelectorAll("[data-wc-image-id]").forEach(function(t){var e=t.getAttribute("data-wc-image-id"),r="";window.udeslyWcImages&&(r=window.udeslyWcImages[e].full_src),n.thumbImages[e]=t,t.addEventListener("click",function(t){s(e,r)})}),u(function(t){return n.handleImageChange(t.detail)})}return n(r,[{key:"handleImageChange",value:function(t){var e=t.id,r=t.url;e&&(r&&this.featuredImages.forEach(function(t){"IMG"===t.tagName?t.setAttribute("src",r):t.style.backgroundImage="url(".concat(r,")")}),Object.values(this.thumbImages).forEach(function(t){t.classList.remove("current")}),this.thumbImages[e]&&this.thumbImages[e].classList.add("current"))}}]),r}();function v(t){t.addEventListener("change",function(t){var e=t.target.closest("form");window.location.href=window.location.origin+window.location.pathname+"?"+new URLSearchParams(Array.from(new FormData(e))).toString()})}var g=l(function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(t,e,r,n){var a=e&&e.prototype instanceof m?e:m,o=Object.create(a.prototype),i=new A(n||[]);return o._invoke=function(t,e,r){var n=l;return function(a,o){if(n===f)throw new Error("Generator is already running");if(n===h){if("throw"===a)throw o;return C()}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var c=k(i,r);if(c){if(c===p)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=f;var s=u(t,e,r);if("normal"===s.type){if(n=r.done?h:d,s.arg===p)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=h,r.method="throw",r.arg=s.arg)}}}(t,r,i),o}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l="suspendedStart",d="suspendedYield",f="executing",h="completed",p={};function m(){}function y(){}function v(){}var g={};g[o]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(P([])));b&&b!==r&&n.call(b,o)&&(g=b);var x=v.prototype=m.prototype=Object.create(g);function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function L(t){var e;this._invoke=function(r,a){function o(){return new Promise(function(e,o){!function e(r,a,o,i){var c=u(t[r],t,a);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,o,i)},function(t){e("throw",t,o,i)}):Promise.resolve(l).then(function(t){s.value=t,o(s)},function(t){return e("throw",t,o,i)})}i(c.arg)}(r,a,e,o)})}return e=e?e.then(o,o):o()}}function k(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method))return p;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var a=u(n,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,p;var o=a.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,p):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function P(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){for(;++a=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var a=n.arg;S(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:P(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),p}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}});function w(t,e,r,n,a,o,i){try{var c=t[o](i),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,a)}var b=function(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function i(t){w(o,n,a,i,c,"next",t)}function c(t){w(o,n,a,i,c,"throw",t)}i(void 0)})}},x=l(function(t){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})(t)}function r(n){return"function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?t.exports=r=function(t){return e(t)}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},r(n)}t.exports=r});function E(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.action,r=t.nonce,n=t.nonceField,a=t.data,o=t.method,i=t.url,c=t.credentials;if(!e)throw new TypeError("Cannot make ajax call without action");if(a&&"object"!==x(a))throw new TypeError("Data to send must be an object");if(!i&&!window.udeslyAjax.ajaxUrl)throw new TypeError("Cannot make ajax call without url");var s=new FormData;if(s.append("action",e),s.append(n||"security",r||window.udeslyAjax.nonce),a)for(var u in a)s.append(u,a[u]);return fetch(i||window.udeslyAjax.ajaxUrl,{method:o||"POST",body:s,credentials:c||"same-origin"})}var L=function(){function t(r){e(this,t),this.queryTemplateName=r.getAttribute("data-wc-query-template"),this.queryName=r.getAttribute("data-wc-query-name"),this.itemsList=r.querySelector(".w-dyn-items"),this.maxPages=parseInt(this.itemsList.getAttribute("data-max-pages"),10),this.prevButton=r.querySelector('[udy-el="previous-posts"]'),this.nextButton=r.querySelector('[udy-el="next-posts"]'),this.countPage=r.querySelector(".w-page-count"),this.init()}return n(t,[{key:"init",value:function(){var t=this;this.processing=!1,this.currentPage=1,this.maxPages>1?(this.nextButton&&this.nextButton.addEventListener("click",function(e){return t.getNextPage()}),this.prevButton&&this.prevButton.addEventListener("click",function(e){return t.getPreviousPage()}),this.nextButton&&this.nextButton.removeAttribute("style")):this.nextButton&&this.nextButton.setAttribute("style","display: none;"),this.cache={},this.cache[1]=this.itemsList.innerHTML}},{key:"getNextPage",value:function(){if(!this.processing){var t=this.currentPage+1;this.getPage(t)}}},{key:"getPage",value:function(){var t=b(g.mark(function t(e){var r;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.processing=!0,this.itemsList.classList.add("loading"),!(e<=this.maxPages)){t.next=14;break}if(!this.cache[e]){t.next=8;break}this.itemsList.innerHTML=this.cache[e],this.currentPage=e,t.next=12;break;case 8:return t.next=10,this.queryPosts(e);case 10:""!==(r=t.sent)&&(this.cache[e]=r,this.itemsList.innerHTML=r,this.currentPage=e,this.processing=!1);case 12:t.next=15;break;case 14:this.nextButton&&this.nextButton.setAttribute("style","display: none");case 15:this.itemsList.classList.remove("loading"),this.processing=!1;case 17:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getPreviousPage",value:function(){var t=b(g.mark(function t(){var e;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.processing){t.next=2;break}return t.abrupt("return");case 2:e=this.currentPage-1,this.getPage(e);case 4:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"queryPosts",value:function(){var t=b(g.mark(function t(e){var r,n;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,E({action:"udesly_get_products",data:{page:e,name:this.queryName,template:this.queryTemplateName}});case 2:if(!(r=t.sent).ok){t.next=10;break}return t.next=6,r.json();case 6:return n=t.sent,t.abrupt("return",n.data.posts);case 10:return this.processing=!1,this.prevButton&&this.prevButton.remove(),this.nextButton&&this.nextButton.remove(),t.abrupt("return","");case 14:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"currentPage",get:function(){return this._currentPage||1},set:function(t){t<=this.maxPages&&(this._currentPage=t),1===this.currentPage?(this.prevButton&&this.prevButton.setAttribute("style","display: none"),this.nextButton&&this.nextButton.removeAttribute("style")):this.currentPage===this.maxPages?(this.prevButton&&this.prevButton.removeAttribute("style"),this.nextButton&&this.nextButton.setAttribute("style","display: none")):(this.nextButton&&this.nextButton.removeAttribute("style"),this.prevButton&&this.prevButton.removeAttribute("style")),this.countPage&&(this.countPage.textContent="".concat(this.currentPage," / ").concat(this.maxPages))}}]),t}();function k(t,e){return e?e.querySelector('[data-node-type="'.concat(t,'"]')):document.querySelector('[data-node-type="'.concat(t,'"]'))}var _=function(){function r(t){e(this,r),this.el=t,this.wrapper=this.el,this.wrapper&&this.init(),t.test=this}return n(r,[{key:"init",value:function(){var t,e=this;this.wrapper.addEventListener("wf-change-cart-state",function(t){return e.handleChangeCartState(t)}),this.openOnProductAdded=this.wrapper.hasAttribute("data-open-product"),this.openOnHover=this.wrapper.hasAttribute("data-open-on-hover"),this.closeLink=k("commerce-cart-close-link",this.el),this.openLink=k("commerce-cart-open-link",this.el),this.cartContainer=k("commerce-cart-container",this.el),this.cartContainerWrapper=k("commerce-cart-container-wrapper",this.el),this.form=k("commerce-cart-form",this.el),this.closeLink&&(this.closeLink.addEventListener("click",function(){return e.toggleCart()}),this.closeLink.addEventListener("tap",function(){return e.toggleCart()})),this.openLink&&(this.openOnHover?(this.openLink.addEventListener("mouseenter",function(){return e.openCart()}),this.cartContainer&&this.cartContainer.addEventListener("mouseleave",function(){return e.closeCart()})):(this.openLink.addEventListener("click",function(){return e.toggleCart()}),this.openLink.addEventListener("tap",function(){return e.toggleCart()}))),this.cartContainerWrapper&&this.cartContainerWrapper.addEventListener("click",function(t){t.target.contains(e.cartContainer)&&e.closeCart()}),this.openOnProductAdded&&(t=function(){return e.toggleCart()},document.body.addEventListener("product-added-to-cart",t)),function(t){document.body.addEventListener("cart-should-be-updated",t)}(function(){return e.updateCart()}),this.cartContainer.addEventListener("click",function(t){return e.handleRemove(t)})}},{key:"updateCart",value:function(){var e=b(g.mark(function e(){var r,n,a,o;return g.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=document.querySelector("#udesly-wc-mini-cart-count"),n=document.querySelector("#udesly-wc-mini-cart-subtotal"),a=document.querySelector("#udesly-wc-mini-cart-items"),r&&t("wc-cart-count").forEach(function(t){return t.textContent=r.textContent}),n&&t("wc-cart-total").forEach(function(t){return t.innerHTML=n.innerHTML}),a&&(o=JSON.parse(a.textContent),this.updateItemsTemplate(o));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"handleRemove",value:function(){var t=b(g.mark(function t(e){var r,n,i;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e.target.matches('[udy-el="wc-remove"]')){t.next=20;break}if(e.preventDefault(),(r=e.target.closest("li"))&&r.classList.add("removing"),!(n=e.target.getAttribute("data-cart-item-key"))){t.next=20;break}return t.next=9,E({action:"udesly_wc_remove_from_cart",data:{key:n}});case 9:if(!(i=t.sent).ok){t.next=14;break}return t.delegateYield(g.mark(function t(){var e,r,n;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i.json();case 2:for(n in e=t.sent,r=function(t){document.querySelectorAll(t).forEach(function(r){return r.outerHTML=e.fragments[t]})},e.fragments)r(n);document.body.dispatchEvent(new CustomEvent("product-removed-from-cart")),a(),c();case 8:case"end":return t.stop()}},t)})(),"t0",12);case 12:t.next=20;break;case 14:return t.next=16,i.json();case 16:o(t.sent.message||"Failed to remove the product"),a(),r&&r.classList.remove("removing");case 20:t.next=25;break;case 22:t.prev=22,t.t1=t.catch(0),console.error(t.t1);case 25:case"end":return t.stop()}},t,null,[[0,22]])}));return function(e){return t.apply(this,arguments)}}()},{key:"updateItemsTemplate",value:function(e){if(window.udeslyMiniCartTemplate){t("wc-cart-actions").forEach(function(t){return t.classList.remove("udesly-display-none")}),0===e.length?(this.form.style.display="none",t("wc-no-items-in-cart").forEach(function(t){t.style.display=""})):(this.form.style.display="",t("wc-no-items-in-cart").forEach(function(t){t.style.display="none"}));var r="",n=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done);n=!0){var s=i.value;r+=window.udeslyMiniCartTemplate(s),0}}catch(t){a=!0,o=t}finally{try{n||null==c.return||c.return()}finally{if(a)throw o}}t("wc-items-list").forEach(function(t){return t.innerHTML=r})}}},{key:"toggleCart",value:function(){this.wrapper.dispatchEvent(new CustomEvent("wf-change-cart-state",{bubbles:1}))}},{key:"openCart",value:function(){this.wrapper.dispatchEvent(new CustomEvent("wf-change-cart-state",{bubbles:1,detail:{open:!0}}))}},{key:"closeCart",value:function(){this.wrapper.dispatchEvent(new CustomEvent("wf-change-cart-state",{bubbles:1,detail:{open:!1}}))}},{key:"handleChangeCartState",value:function(t){if(t.currentTarget instanceof Element&&t instanceof CustomEvent){var e=t.currentTarget,r=t.detail,n=e.hasAttribute("data-cart-open"),a=r&&null!=r.open?r.open:!n,o=k("commerce-cart-container-wrapper",this.el);if(o){var i=k("commerce-cart-container",this.el);if(i){var c=o.parentElement;if(c){var s=c.getAttribute("data-wf-cart-type"),u=c.getAttribute("data-wf-cart-duration")||"300ms",l=c.getAttribute("data-wf-cart-easing")||"ease-out-quad",d="opacity "+u+" ease 0ms",f="0ms"!==u,h=void 0,p=void 0;switch(s){case"modal":h={scale:.95},p={scale:1};break;case"leftSidebar":h={x:-30},p={x:0};break;case"rightSidebar":h={x:30},p={x:0};break;case"leftDropdown":case"rightDropdown":h={y:-10},p={y:0}}a?(e.setAttribute("data-cart-open",""),o.style.removeProperty("display"),f&&!n&&(window.Webflow.tram(o).add(d).set({opacity:0}).start({opacity:1}),window.Webflow.tram(i).add("transform "+u+" "+l+" 0ms").set(h).start(p))):(e.removeAttribute("data-cart-open"),f?(window.Webflow.tram(o).add(d).start({opacity:0}).then(function(){o.style.display="none",window.Webflow.tram(i).stop()}),window.Webflow.tram(i).add("transform "+u+" "+l+" 50ms").start(h)):o.style.display="none")}}}}}}]),r}(),S=function(){function t(r){var n=this;e(this,t),this.products=r,this.products.addEventListener("submit",function(t){return n.handleSubmit(t)})}return n(t,[{key:"handleSubmit",value:function(){var t=b(g.mark(function t(e){var r,n,o;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=e.target).matches('[data-product-type="product_type_simple"][data-product-stock="true"]')){t.next=8;break}return e.preventDefault(),n=r.querySelector('[type="submit"]'),o={action:"udesly_wc_add_to_cart",product_id:r.querySelector("[data-product_id]").getAttribute("data-product_id"),quantity:r.querySelector('input[type="number"]')?r.querySelector('input[type="number"]').value:1,security:window.udeslyAjax.nonce},jQuery(document.body).trigger("adding_to_cart",[o]),jQuery.ajax({type:"post",url:window.udeslyAjax.ajaxUrl,data:o,beforeSend:function(t){n.classList.remove("added"),n.classList.add("loading")},complete:function(t){n.classList.add("added"),n.classList.remove("loading"),setTimeout(function(){n.classList.remove("added")},3e3)},success:function(t){t.error&t.product_url?window.location=t.product_url:"yes"!==window.wc_add_to_cart_params.cart_redirect_after_add?(jQuery(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash]),document.body.dispatchEvent(new CustomEvent("product-added-to-cart")),a(),c()):window.location=wc_add_to_cart_params.cart_url}}),t.abrupt("return",!1);case 8:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()}]),t}(),A=1e3*window.udeslyAjax.config.wc_notification_duration,P=function(){function t(){var r,n=this;e(this,t),r=function(t){return n.handleNotices()},document.body.addEventListener("retrieve-wc-notices",r),function(t){document.body.addEventListener("remove-wc-notices",t)}(function(t){return n.removeNotices()}),i()}return n(t,[{key:"handleNotices",value:function(){var t=b(g.mark(function t(){var e,r,n,a;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,E({action:"udesly_wc_get_notices"});case 2:if(!(e=t.sent).ok){t.next=9;break}return t.next=6,e.json();case 6:r=t.sent,(n=r.data.notices)&&""!==n&&(a=document.createElement("div"),document.body.append(a),a.outerHTML=n,i());case 9:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}()},{key:"removeNotices",value:function(){var t=document.querySelectorAll(".udy-wc-notices-wrapper");t.length&&(setTimeout(function(){t.forEach(function(t){return t.style.opacity="1"})},200),setTimeout(function(){t.forEach(function(t){t.style.opacity="0",setTimeout(function(){return t.remove()},1e3)})},A))}}]),t}();function C(){if(document.body.classList.contains("woocommerce")){new f;var e=t("wc-variable-add-to-cart");e.length&&e.forEach(function(t){new h(t)});var r=t("wc-product-images-slider");r.length&&r.forEach(function(t){new p(t)})}var n=t("wc-orderby");n.length&&n.forEach(function(t){new v(t.querySelector("select"))});var a=document.querySelectorAll("[data-wc-query-template][data-wc-query-name]");a.length&&a.forEach(function(t){new L(t)});var o=t("wc-mini-cart");o.length&&o.forEach(function(t){new _(t)});var i=t("wc-products");i.length&&i.forEach(function(t){new S(t)}),document.querySelectorAll("[data-form-classes]").forEach(function(t){var e=JSON.parse(t.getAttribute("data-form-classes"));e.f&&t.querySelectorAll("form").forEach(function(t){t.setAttribute("class",e.f)}),e.l&&t.querySelectorAll("label").forEach(function(t){t.setAttribute("class",e.l)}),e.i&&t.querySelectorAll('input:not([type="checkbox"])').forEach(function(t){t.setAttribute("class",e.i)}),e.b&&t.querySelectorAll('[type="submit"], a.woocommerce-Button').forEach(function(t){t.setAttribute("class",e.b)})}),t("wc-my-account").forEach(function(t){t.childNodes.forEach(function(t){""===t.textContent&&t.remove()})}),new y,new P}document.addEventListener("readystatechange",function(){"complete"!==document.readyState&&"interactive"!==document.readyState||C()}),"complete"!==document.readyState&&"interactive"!==document.readyState||C();var j=setInterval(function(){"complete"!==document.readyState&&"interactive"!==document.readyState||(C(),clearInterval(j))},300)}); +!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";function t(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?document.querySelector('[udy-el="'.concat(t,'"]')):document.querySelectorAll('[udy-el="'.concat(t,'"]'))}var e=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function r(t,e){for(var r=0;r3?f.length%3:0,p=d+(h?f.substr(0,h)+e.thousand:"")+f.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+e.thousand)+(e.precision>0?e.decimal+a(Math.abs(t),e.precision).split(".")[1]:"");return e.stripZeros?(n=p,o=e.decimal,s=n.split(o),u=s[0],(l=s[1].replace(/0+$/,"")).length>0?u+o+l:u):p}var s=e(function(t){var e=String.prototype.valueOf,r=Object.prototype.toString,n="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"string"==typeof t||"object"==typeof t&&(n?function(t){try{return e.call(t),!0}catch(t){return!1}}(t):"[object String]"===r.call(t))}}),u=s&&"object"==typeof s&&"default"in s?s.default:s;function l(t){return u(t)&&t.match("%v")?{pos:t,neg:t.replace("-","").replace("%v","-%v"),zero:t}:t}function d(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(Array.isArray(t))return t.map(function(t){return d(t,e)});var n=l((e=i({},r,e)).format);return(t>0?n.pos:t<0?n.neg:n.zero).replace("%s",e.symbol).replace("%v",c(Math.abs(t),e))}t.settings=r,t.unformat=n,t.toFixed=a,t.formatMoney=d,t.formatNumber=c,t.formatColumn=function t(e){var a=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(!e)return[];var o=l((a=i({},r,a)).format),s=o.pos.indexOf("%s")0?o.pos:e<0?o.neg:o.zero).replace("%s",a.symbol).replace("%v",c(Math.abs(e),a));return r.length>d&&(d=r.length),r});return f.map(function(t){return u(t)&&t.length'.concat(e,"")}}]),r}(),h=function(){function t(r){var n=this;e(this,t),this.el=r,this.selects={},this.el.querySelectorAll("select").forEach(function(t){var e=t.getAttribute("name");n.selects[e]=t}),jQuery(this.el).on("check_variations",function(){return n.alignRadios()}),this.radios=this.el.querySelectorAll('input[type="radio"]'),this.labels=this.el.querySelectorAll('[udy-el="wc-variations-options"] label'),this.variationsData=JSON.parse(this.el.getAttribute("data-product_variations")),this.listen(),setTimeout(function(){n.alignRadios()},500)}return n(t,[{key:"listen",value:function(){var t=this;this.el.addEventListener("change",function(e){if(e.target.matches('input[type="radio"]')){var r=e.target.getAttribute("name");t.selects[r].value=e.target.value,t.selects[r].dispatchEvent(new Event("change",{bubbles:!0})),t.alignRadios()}})}},{key:"alignRadios",value:function(){var t=this;this.radios.forEach(function(t){t.disabled=!0}),this.labels.forEach(function(t){t.classList.remove("selected"),t.classList.add("disabled")});var e=function(e){Array.from(t.selects[e].options).forEach(function(r){if(r.classList.contains("enabled")&&r.value){t.el.querySelector('input[type="radio"][name="'.concat(e,'"][value="').concat(r.value,'"]')).disabled=!1;var n=t.el.querySelector('label[for="'.concat(r.value.toLowerCase(),'"]'));n&&n.classList.remove("disabled")}});var r=t.el.querySelector('label[for="'.concat(t.selects[e].value.toLowerCase(),'"]'));r&&r.classList.add("selected")};for(var r in this.selects)e(r);var n,a,o=this.el.querySelector('input[name="variation_id"]').value,i=this.variationsData.filter(function(t){return t.variation_id==o})[0];if(i){var c=i.display_price,u=i.display_regular_price,l=i.image_id,d=i.image;n=c,a=u,document.body.dispatchEvent(new CustomEvent("change-price",{detail:{price:n,regularPrice:a}})),s(l,d.url)}}}]),t}(),p=function(){function t(r){var n=this;e(this,t),this.slider=r,u(function(t){return n.handleImageChange(t.detail)}),this.images=this.slider.querySelectorAll("[data-wc-slider-image-id]"),this.dots=this.slider.querySelectorAll(".w-slider-dot");var a=this.slider.querySelector(".w-slider-nav");new MutationObserver(function(t,e){var r=!0,a=!1,o=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done);r=!0)if("class"===i.value.attributeName){var u=y(n.slider.querySelector(".w-slider-dot.w-active"));-1!==u&&n.images[u]&&s(n.images[u].getAttribute("data-wc-slider-image-id"))}}catch(t){a=!0,o=t}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}}).observe(a,{attributes:!0,childList:!1,subtree:!0})}return n(t,[{key:"handleImageChange",value:function(t){var e=t.id;t.url;if(e){var r=y(this.slider.querySelector('[data-wc-slider-image-id="'.concat(e,'"]')));-1!==r&&this.dots[r]&&this.dots[r].dispatchEvent(new Event("click",{bubbles:!0}))}}}]),t}();function y(t){if(!t)return-1;for(var e=0;t=t.previousElementSibling;)e++;return e}var m=function(){function r(){var n=this;e(this,r),this.featuredImages=t("wc-featured-image"),this.thumbImages=[],document.querySelectorAll("[data-wc-image-id]").forEach(function(t){var e=t.getAttribute("data-wc-image-id"),r="";window.udeslyWcImages&&(r=window.udeslyWcImages[e].full_src),n.thumbImages[e]=t,t.addEventListener("click",function(t){s(e,r)})}),u(function(t){return n.handleImageChange(t.detail)})}return n(r,[{key:"handleImageChange",value:function(t){var e=t.id,r=t.url;e&&(r&&this.featuredImages.forEach(function(t){"IMG"===t.tagName?t.setAttribute("src",r):t.style.backgroundImage="url(".concat(r,")")}),Object.values(this.thumbImages).forEach(function(t){t.classList.remove("current")}),this.thumbImages[e]&&this.thumbImages[e].classList.add("current"))}}]),r}();function v(t){t.addEventListener("change",function(t){var e=t.target.closest("form");window.location.href=window.location.origin+window.location.pathname+"?"+new URLSearchParams(Array.from(new FormData(e))).toString()})}var g=l(function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(t,e,r,n){var a=e&&e.prototype instanceof y?e:y,o=Object.create(a.prototype),i=new A(n||[]);return o._invoke=function(t,e,r){var n=l;return function(a,o){if(n===f)throw new Error("Generator is already running");if(n===h){if("throw"===a)throw o;return C()}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var c=k(i,r);if(c){if(c===p)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=f;var s=u(t,e,r);if("normal"===s.type){if(n=r.done?h:d,s.arg===p)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=h,r.method="throw",r.arg=s.arg)}}}(t,r,i),o}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l="suspendedStart",d="suspendedYield",f="executing",h="completed",p={};function y(){}function m(){}function v(){}var g={};g[o]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(P([])));b&&b!==r&&n.call(b,o)&&(g=b);var x=v.prototype=y.prototype=Object.create(g);function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function L(t){var e;this._invoke=function(r,a){function o(){return new Promise(function(e,o){!function e(r,a,o,i){var c=u(t[r],t,a);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,o,i)},function(t){e("throw",t,o,i)}):Promise.resolve(l).then(function(t){s.value=t,o(s)},function(t){return e("throw",t,o,i)})}i(c.arg)}(r,a,e,o)})}return e=e?e.then(o,o):o()}}function k(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method))return p;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var a=u(n,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,p;var o=a.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,p):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function P(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){for(;++a=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var a=n.arg;S(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:P(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),p}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}});function w(t,e,r,n,a,o,i){try{var c=t[o](i),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,a)}var b=function(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function i(t){w(o,n,a,i,c,"next",t)}function c(t){w(o,n,a,i,c,"throw",t)}i(void 0)})}},x=l(function(t){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})(t)}function r(n){return"function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?t.exports=r=function(t){return e(t)}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},r(n)}t.exports=r});function E(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.action,r=t.nonce,n=t.nonceField,a=t.data,o=t.method,i=t.url,c=t.credentials;if(!e)throw new TypeError("Cannot make ajax call without action");if(a&&"object"!==x(a))throw new TypeError("Data to send must be an object");if(!i&&!window.udeslyAjax.ajaxUrl)throw new TypeError("Cannot make ajax call without url");var s=new FormData;if(s.append("action",e),s.append(n||"security",r||window.udeslyAjax.nonce),a)for(var u in a)s.append(u,a[u]);return fetch(i||window.udeslyAjax.ajaxUrl,{method:o||"POST",body:s,credentials:c||"same-origin"})}var L=function(){function t(r){e(this,t),this.queryTemplateName=r.getAttribute("data-wc-query-template"),this.queryName=r.getAttribute("data-wc-query-name"),this.itemsList=r.querySelector(".w-dyn-items"),this.maxPages=parseInt(this.itemsList.getAttribute("data-max-pages"),10),this.prevButton=r.querySelector('[udy-el="previous-posts"]'),this.nextButton=r.querySelector('[udy-el="next-posts"]'),this.countPage=r.querySelector(".w-page-count"),this.init()}return n(t,[{key:"init",value:function(){var t=this;this.processing=!1,this.currentPage=1,this.maxPages>1?(this.nextButton&&this.nextButton.addEventListener("click",function(e){return t.getNextPage()}),this.prevButton&&this.prevButton.addEventListener("click",function(e){return t.getPreviousPage()}),this.nextButton&&this.nextButton.removeAttribute("style")):this.nextButton&&this.nextButton.setAttribute("style","display: none;"),this.cache={},this.cache[1]=this.itemsList.innerHTML}},{key:"getNextPage",value:function(){if(!this.processing){var t=this.currentPage+1;this.getPage(t)}}},{key:"getPage",value:function(){var t=b(g.mark(function t(e){var r;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.processing=!0,this.itemsList.classList.add("loading"),!(e<=this.maxPages)){t.next=14;break}if(!this.cache[e]){t.next=8;break}this.itemsList.innerHTML=this.cache[e],this.currentPage=e,t.next=12;break;case 8:return t.next=10,this.queryPosts(e);case 10:""!==(r=t.sent)&&(this.cache[e]=r,this.itemsList.innerHTML=r,this.currentPage=e,this.processing=!1);case 12:t.next=15;break;case 14:this.nextButton&&this.nextButton.setAttribute("style","display: none");case 15:this.itemsList.classList.remove("loading"),this.processing=!1;case 17:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getPreviousPage",value:function(){var t=b(g.mark(function t(){var e;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.processing){t.next=2;break}return t.abrupt("return");case 2:e=this.currentPage-1,this.getPage(e);case 4:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"queryPosts",value:function(){var t=b(g.mark(function t(e){var r,n;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,E({action:"udesly_get_products",data:{page:e,name:this.queryName,template:this.queryTemplateName}});case 2:if(!(r=t.sent).ok){t.next=10;break}return t.next=6,r.json();case 6:return n=t.sent,t.abrupt("return",n.data.posts);case 10:return this.processing=!1,this.prevButton&&this.prevButton.remove(),this.nextButton&&this.nextButton.remove(),t.abrupt("return","");case 14:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"currentPage",get:function(){return this._currentPage||1},set:function(t){t<=this.maxPages&&(this._currentPage=t),1===this.currentPage?(this.prevButton&&this.prevButton.setAttribute("style","display: none"),this.nextButton&&this.nextButton.removeAttribute("style")):this.currentPage===this.maxPages?(this.prevButton&&this.prevButton.removeAttribute("style"),this.nextButton&&this.nextButton.setAttribute("style","display: none")):(this.nextButton&&this.nextButton.removeAttribute("style"),this.prevButton&&this.prevButton.removeAttribute("style")),this.countPage&&(this.countPage.textContent="".concat(this.currentPage," / ").concat(this.maxPages))}}]),t}();function k(t,e){return e?e.querySelector('[data-node-type="'.concat(t,'"]')):document.querySelector('[data-node-type="'.concat(t,'"]'))}var _=function(){function r(t){e(this,r),this.el=t,this.wrapper=this.el,this.wrapper&&this.init(),t.test=this}return n(r,[{key:"init",value:function(){var t,e=this;this.wrapper.addEventListener("wf-change-cart-state",function(t){return e.handleChangeCartState(t)}),this.openOnProductAdded=this.wrapper.hasAttribute("data-open-product"),this.openOnHover=this.wrapper.hasAttribute("data-open-on-hover"),this.closeLink=k("commerce-cart-close-link",this.el),this.openLink=k("commerce-cart-open-link",this.el),this.cartContainer=k("commerce-cart-container",this.el),this.cartContainerWrapper=k("commerce-cart-container-wrapper",this.el),this.form=k("commerce-cart-form",this.el),this.closeLink&&(this.closeLink.addEventListener("click",function(){return e.toggleCart()}),this.closeLink.addEventListener("tap",function(){return e.toggleCart()})),this.openLink&&(this.openOnHover?(this.openLink.addEventListener("mouseenter",function(){return e.openCart()}),this.cartContainer&&this.cartContainer.addEventListener("mouseleave",function(){return e.closeCart()})):(this.openLink.addEventListener("click",function(){return e.toggleCart()}),this.openLink.addEventListener("tap",function(){return e.toggleCart()}))),this.cartContainerWrapper&&this.cartContainerWrapper.addEventListener("click",function(t){t.target.contains(e.cartContainer)&&e.closeCart()}),this.openOnProductAdded&&(t=function(){return e.toggleCart()},document.body.addEventListener("product-added-to-cart",t)),function(t){document.body.addEventListener("cart-should-be-updated",t)}(function(){return e.updateCart()}),this.cartContainer.addEventListener("click",function(t){return e.handleRemove(t)})}},{key:"updateCart",value:function(){var e=b(g.mark(function e(){var r,n,a,o;return g.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=document.querySelector("#udesly-wc-mini-cart-count"),n=document.querySelector("#udesly-wc-mini-cart-subtotal"),a=document.querySelector("#udesly-wc-mini-cart-items"),r&&t("wc-cart-count").forEach(function(t){return t.textContent=r.textContent}),n&&t("wc-cart-total").forEach(function(t){return t.innerHTML=n.innerHTML}),a&&(o=JSON.parse(a.textContent),this.updateItemsTemplate(o));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"handleRemove",value:function(){var t=b(g.mark(function t(e){var r,n,i;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e.target.matches('[udy-el="wc-remove"]')){t.next=20;break}if(e.preventDefault(),(r=e.target.closest("li"))&&r.classList.add("removing"),!(n=e.target.getAttribute("data-cart-item-key"))){t.next=20;break}return t.next=9,E({action:"udesly_wc_remove_from_cart",data:{key:n}});case 9:if(!(i=t.sent).ok){t.next=14;break}return t.delegateYield(g.mark(function t(){var e,r,n;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i.json();case 2:for(n in e=t.sent,r=function(t){document.querySelectorAll(t).forEach(function(r){return r.outerHTML=e.fragments[t]})},e.fragments)r(n);document.body.dispatchEvent(new CustomEvent("product-removed-from-cart")),a(),c();case 8:case"end":return t.stop()}},t)})(),"t0",12);case 12:t.next=20;break;case 14:return t.next=16,i.json();case 16:o(t.sent.message||"Failed to remove the product"),a(),r&&r.classList.remove("removing");case 20:t.next=25;break;case 22:t.prev=22,t.t1=t.catch(0),console.error(t.t1);case 25:case"end":return t.stop()}},t,null,[[0,22]])}));return function(e){return t.apply(this,arguments)}}()},{key:"updateItemsTemplate",value:function(e){if(window.udeslyMiniCartTemplate){t("wc-cart-actions").forEach(function(t){return t.classList.remove("udesly-display-none")}),0===e.length?(this.form.style.display="none",t("wc-no-items-in-cart").forEach(function(t){t.style.display=""})):(this.form.style.display="",t("wc-no-items-in-cart").forEach(function(t){t.style.display="none"}));var r="",n=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done);n=!0){var s=i.value;r+=window.udeslyMiniCartTemplate(s),0}}catch(t){a=!0,o=t}finally{try{n||null==c.return||c.return()}finally{if(a)throw o}}t("wc-items-list").forEach(function(t){return t.innerHTML=r})}}},{key:"toggleCart",value:function(){this.wrapper.dispatchEvent(new CustomEvent("wf-change-cart-state",{bubbles:1}))}},{key:"openCart",value:function(){this.wrapper.dispatchEvent(new CustomEvent("wf-change-cart-state",{bubbles:1,detail:{open:!0}}))}},{key:"closeCart",value:function(){this.wrapper.dispatchEvent(new CustomEvent("wf-change-cart-state",{bubbles:1,detail:{open:!1}}))}},{key:"handleChangeCartState",value:function(t){if(t.currentTarget instanceof Element&&t instanceof CustomEvent){var e=t.currentTarget,r=t.detail,n=e.hasAttribute("data-cart-open"),a=r&&null!=r.open?r.open:!n,o=k("commerce-cart-container-wrapper",this.el);if(o){var i=k("commerce-cart-container",this.el);if(i){var c=o.parentElement;if(c){var s=c.getAttribute("data-wf-cart-type"),u=c.getAttribute("data-wf-cart-duration")||"300ms",l=c.getAttribute("data-wf-cart-easing")||"ease-out-quad",d="opacity "+u+" ease 0ms",f="0ms"!==u,h=void 0,p=void 0;switch(s){case"modal":h={scale:.95},p={scale:1};break;case"leftSidebar":h={x:-30},p={x:0};break;case"rightSidebar":h={x:30},p={x:0};break;case"leftDropdown":case"rightDropdown":h={y:-10},p={y:0}}a?(e.setAttribute("data-cart-open",""),o.style.removeProperty("display"),f&&!n&&(window.Webflow.tram(o).add(d).set({opacity:0}).start({opacity:1}),window.Webflow.tram(i).add("transform "+u+" "+l+" 0ms").set(h).start(p))):(e.removeAttribute("data-cart-open"),f?(window.Webflow.tram(o).add(d).start({opacity:0}).then(function(){o.style.display="none",window.Webflow.tram(i).stop()}),window.Webflow.tram(i).add("transform "+u+" "+l+" 50ms").start(h)):o.style.display="none")}}}}}}]),r}(),S=function(){function t(r){var n=this;e(this,t),this.products=r,this.products.addEventListener("submit",function(t){return n.handleSubmit(t)})}return n(t,[{key:"handleSubmit",value:function(){var t=b(g.mark(function t(e){var r,n,o;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=e.target).matches('[data-product-type="product_type_simple"][data-product-stock="true"]')){t.next=8;break}return e.preventDefault(),n=r.querySelector('[type="submit"]'),o={action:"udesly_wc_add_to_cart",product_id:r.querySelector("[data-product_id]").getAttribute("data-product_id"),quantity:r.querySelector('input[type="number"]')?r.querySelector('input[type="number"]').value:1,security:window.udeslyAjax.nonce},jQuery(document.body).trigger("adding_to_cart",[o]),jQuery.ajax({type:"post",url:window.udeslyAjax.ajaxUrl,data:o,beforeSend:function(t){n.classList.remove("added"),n.classList.add("loading")},complete:function(t){n.classList.add("added"),n.classList.remove("loading"),setTimeout(function(){n.classList.remove("added")},3e3)},success:function(t){t.error&t.product_url?window.location=t.product_url:"yes"!==window.wc_add_to_cart_params.cart_redirect_after_add?(jQuery(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash]),document.body.dispatchEvent(new CustomEvent("product-added-to-cart")),a(),c()):window.location=wc_add_to_cart_params.cart_url}}),t.abrupt("return",!1);case 8:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()}]),t}(),A=1e3*window.udeslyAjax.config.wc_notification_duration,P=function(){function t(){var r,n=this;e(this,t),r=function(t){return n.handleNotices()},document.body.addEventListener("retrieve-wc-notices",r),function(t){document.body.addEventListener("remove-wc-notices",t)}(function(t){return n.removeNotices()}),i()}return n(t,[{key:"handleNotices",value:function(){var t=b(g.mark(function t(){var e,r,n,a;return g.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,E({action:"udesly_wc_get_notices"});case 2:if(!(e=t.sent).ok){t.next=9;break}return t.next=6,e.json();case 6:r=t.sent,(n=r.data.notices)&&""!==n&&(a=document.createElement("div"),document.body.append(a),a.outerHTML=n,i());case 9:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}()},{key:"removeNotices",value:function(){var t=document.querySelectorAll(".udy-wc-notices-wrapper");t.length&&(setTimeout(function(){t.forEach(function(t){return t.style.opacity="1"})},200),setTimeout(function(){t.forEach(function(t){t.style.opacity="0",setTimeout(function(){return t.remove()},1e3)})},A))}}]),t}(),C=!1;function j(){if(!C){if(C=!0,document.body.classList.contains("woocommerce")){new f;var e=t("wc-variable-add-to-cart");e.length&&e.forEach(function(t){new h(t)});var r=t("wc-product-images-slider");r.length&&r.forEach(function(t){new p(t)})}var n=t("wc-orderby");n.length&&n.forEach(function(t){new v(t.querySelector("select"))});var a=document.querySelectorAll("[data-wc-query-template][data-wc-query-name]");a.length&&a.forEach(function(t){new L(t)});var o=t("wc-mini-cart");o.length&&o.forEach(function(t){new _(t)});var i=t("wc-products");i.length&&i.forEach(function(t){new S(t)}),document.querySelectorAll("[data-form-classes]").forEach(function(t){var e=JSON.parse(t.getAttribute("data-form-classes"));e.f&&t.querySelectorAll("form").forEach(function(t){t.setAttribute("class",e.f)}),e.l&&t.querySelectorAll("label").forEach(function(t){t.setAttribute("class",e.l)}),e.i&&t.querySelectorAll('input:not([type="checkbox"])').forEach(function(t){t.setAttribute("class",e.i)}),e.b&&t.querySelectorAll('[type="submit"], a.woocommerce-Button').forEach(function(t){t.setAttribute("class",e.b)})}),t("wc-my-account").forEach(function(t){t.childNodes.forEach(function(t){""===t.textContent&&t.remove()})}),new m,new P}}document.addEventListener("readystatechange",function(){"complete"!==document.readyState&&"interactive"!==document.readyState||j()}),"complete"!==document.readyState&&"interactive"!==document.readyState||j()}); diff --git a/udesly-adapter-plugin.php b/udesly-adapter-plugin.php index a69cdda..4331bbf 100644 --- a/udesly-adapter-plugin.php +++ b/udesly-adapter-plugin.php @@ -11,7 +11,7 @@ * Plugin Name: Udesly Adapter * Plugin URI: https://www.udesly.com * Description: This is a support plugin for Udesly (Webflow to WordPress converter) that allows you to enable additional features for your theme. - * Version: 2.0.23 + * Version: 2.0.24 * Author: Udesly * Author URI: https://www.udesly.com * License: GPL-2.0+ @@ -29,7 +29,7 @@ // Constants defined('UDESLY_ADAPTER_PLUGIN_DIRECTORY_PATH') ?: define('UDESLY_ADAPTER_PLUGIN_DIRECTORY_PATH', plugin_dir_path(__FILE__)); defined('UDESLY_ADAPTER_PLUGIN_DIRECTORY_URL') ?: define('UDESLY_ADAPTER_PLUGIN_DIRECTORY_URL', plugin_dir_url(__FILE__)); -defined('UDESLY_ADAPTER_VERSION') ?: define('UDESLY_ADAPTER_VERSION', "2.0.23"); +defined('UDESLY_ADAPTER_VERSION') ?: define('UDESLY_ADAPTER_VERSION', "2.0.24"); defined('UDESLY_TEXT_DOMAIN') ?: define('UDESLY_TEXT_DOMAIN', "udesly-adapter-plugin"); defined('UDESLY_ADAPTER_PLUGIN_MISC_PATH') ?: define('UDESLY_ADAPTER_PLUGIN_MISC_PATH', plugin_dir_path(__FILE__) . 'includes/misc/');