From 9391742506c0b53ae49e404f50d072ff27b86c03 Mon Sep 17 00:00:00 2001 From: Eclipse Srl Date: Wed, 21 Aug 2019 21:28:15 +0200 Subject: [PATCH] added check for error message --- README.txt | 2 +- assets/js/bundle/udesly-wf-wp.bundle.min.js | 2 +- udesly-adapter-plugin.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.txt b/README.txt index e294231..d874d87 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.2 -Stable tag: 2.0.0.15 +Stable tag: 2.0.0.16 License: GPLv3 or later License URI: https://www.udesly.com/terms-conditions-of-use/#udesly-wordpress-plugin Requires PHP: 5.6.0 diff --git a/assets/js/bundle/udesly-wf-wp.bundle.min.js b/assets/js/bundle/udesly-wf-wp.bundle.min.js index c2d8267..f3e8a92 100644 --- a/assets/js/bundle/udesly-wf-wp.bundle.min.js +++ b/assets/js/bundle/udesly-wf-wp.bundle.min.js @@ -1 +1 @@ -!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t(function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r,n){var i=e&&e.prototype instanceof p?e:p,o=Object.create(i.prototype),a=new _(n||[]);return o._invoke=function(t,e,r){var n=l;return function(i,o){if(n===f)throw new Error("Generator is already running");if(n===m){if("throw"===i)throw o;return E()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=q(a,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=f;var u=c(t,e,r);if("normal"===u.type){if(n=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=m,r.method="throw",r.arg=u.arg)}}}(t,r,a),o}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l="suspendedStart",h="suspendedYield",f="executing",m="completed",y={};function p(){}function d(){}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=p.prototype=Object.create(g);function S(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function k(t){var e;this._invoke=function(r,i){function o(){return new Promise(function(e,o){!function e(r,i,o,a){var s=c(t[r],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,o,a)},function(t){e("throw",t,o,a)}):Promise.resolve(l).then(function(t){u.value=t,o(u)},function(t){return e("throw",t,o,a)})}a(s.arg)}(r,i,e,o)})}return e=e?e.then(o,o):o()}}function q(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,q(t,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=c(n,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var o=i.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,y):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function B(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 L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,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 i=-1,a=function r(){for(;++i=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),y}},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 i=n.arg;L(r)}return i}}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),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}});function r(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}var n=function(t){return function(){var e=this,n=arguments;return new Promise(function(i,o){var a=t.apply(e,n);function s(t){r(a,i,o,s,u,"next",t)}function u(t){r(a,i,o,s,u,"throw",t)}s(void 0)})}};var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function o(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=t.action,r=t.nonce,n=t.nonceField,i=t.data,o=t.method,a=t.url,u=t.credentials;if(!e)throw new TypeError("Cannot make ajax call without action");if(i&&"object"!==s(i))throw new TypeError("Data to send must be an object");if(!a&&!window.udeslyAjax.ajaxUrl)throw new TypeError("Cannot make ajax call without url");var c=new FormData;if(c.append("action",e),c.append(n||"security",r||window.udeslyAjax.nonce),i)for(var l in i)c.append(l,i[l]);return fetch(a||window.udeslyAjax.ajaxUrl,{method:o||"POST",body:c,credentials:u||"same-origin"})}var c=function(){function t(e){var r=this;i(this,t),this.form=e,this.formBlock=e.closest(".w-form"),this.formDone=this.formBlock.querySelector(".w-form-done"),this.formFail=this.formBlock.querySelector(".w-form-fail"),this.errorMessage=this.formFail.querySelector('[udy-el="error-message"]'),this.submitButton=e.querySelector('input[type="submit"]'),this.defaultValue=this.submitButton.value,this.loadingValue=this.submitButton.getAttribute("data-wait")||"Wait...";var n=this.formBlock.querySelector('input[name="redirect_to"]');n&&(this.redirect=n.value),e.addEventListener("submit",function(t){r.handleSubmit(t)})}return a(t,[{key:"handleSubmit",value:function(){var t=n(e.mark(function t(r){var n,i,o=this;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.preventDefault(),this.formFail.style.display="none",this.submitButton.value=this.loadingValue,t.next=5,u({action:"udesly_wp_login",data:{username:this.form.querySelector('[name="log"]').value,password:this.form.querySelector('[name="pwd"]').value,rememberme:!!this.form.querySelector('checkbox[name="rememberme"]')&&this.form.querySelector('checkbox[name="rememberme"]').checked}});case 5:if(!(n=t.sent).ok){t.next=12;break}this.form.style.display="none",this.formDone.style.display="inherit",this.redirect&&setTimeout(function(){window.location=o.redirect},500),t.next=24;break;case 12:return t.prev=12,t.next=15,n.json();case 15:(i=t.sent).data.message&&this.errorMessage&&(this.errorMessage.innerHTML=i.data.message),t.next=23;break;case 19:t.prev=19,t.t0=t.catch(12),console.error(t.t0),this.formFail.style.display="";case 23:this.formFail.style.display="inherit";case 24:this.submitButton.value=this.defaultValue;case 25:case"end":return t.stop()}},t,this,[[12,19]])}));return function(e){return t.apply(this,arguments)}}()}]),t}(),l=function(){function t(e){var r=this;i(this,t),this.form=e,this.formBlock=e.closest(".w-form"),this.formDone=this.formBlock.querySelector(".w-form-done"),this.formFail=this.formBlock.querySelector(".w-form-fail"),this.errorMessage=this.formFail.querySelector('[udy-el="error-message"]'),this.submitButton=e.querySelector('input[type="submit"]'),this.defaultValue=this.submitButton.value,this.loadingValue=this.submitButton.getAttribute("data-wait")||"Wait...";var n=this.formBlock.querySelector('input[name="redirect_to"]');n&&(this.redirect=n.value),e.addEventListener("submit",function(t){r.handleSubmit(t)})}return a(t,[{key:"handleSubmit",value:function(){var t=n(e.mark(function t(r){var n,i,o=this;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.preventDefault(),this.formFail.style.display="none",this.submitButton.value=this.loadingValue,t.next=5,u({action:"udesly_wp_register",data:{username:this.form.querySelector('[name="username"]')?this.form.querySelector('[name="username"]').value:"",password:this.form.querySelector('[name="password"]').value,password_repeat:this.form.querySelector('[name="password_repeat"]').value,mail:this.form.querySelector('[name="email"]').value,first_name:this.form.querySelector('[name="first_name"]')?this.form.querySelector('[name="first_name"]').value:"",last_name:this.form.querySelector('[name="last_name"]')?this.form.querySelector('[name="last_name"]').value:""}});case 5:if(!(n=t.sent).ok){t.next=12;break}this.form.style.display="none",this.formDone.style.display="inherit",this.redirect&&setTimeout(function(){window.location=o.redirect},500),t.next=23;break;case 12:return t.prev=12,t.next=15,n.json();case 15:(i=t.sent).data.message&&this.errorMessage&&(this.errorMessage.innerHTML=i.data.message),t.next=22;break;case 19:t.prev=19,t.t0=t.catch(12),this.formFail.style.display="";case 22:this.formFail.style.display="inherit";case 23:this.submitButton.value=this.defaultValue;case 24:case"end":return t.stop()}},t,this,[[12,19]])}));return function(e){return t.apply(this,arguments)}}()}]),t}(),h=function(){function t(e){var r=this;i(this,t),this.form=e,this.formBlock=e.closest(".w-form"),this.formDone=this.formBlock.querySelector(".w-form-done"),this.formFail=this.formBlock.querySelector(".w-form-fail"),this.errorMessage=this.formFail.querySelector('[udy-el="error-message"]'),this.submitButton=e.querySelector('input[type="submit"]'),this.defaultValue=this.submitButton.value,this.loadingValue=this.submitButton.getAttribute("data-wait")||"Wait...";var n=this.formBlock.querySelector('input[name="redirect_to"]');n&&(this.redirect=n.value),e.addEventListener("submit",function(t){r.handleSubmit(t)})}return a(t,[{key:"handleSubmit",value:function(){var t=n(e.mark(function t(r){var n,i,o=this;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.preventDefault(),this.formFail.style.display="none",this.submitButton.value=this.loadingValue,t.next=5,u({action:"udesly_wp_lost_password",data:{user_login:this.form.querySelector('[name="user_login"]').value,page_slug:document.body.getAttribute("udesly-page")}});case 5:if(!(n=t.sent).ok){t.next=12;break}this.form.style.display="none",this.formDone.style.display="inherit",this.redirect&&setTimeout(function(){window.location=o.redirect},500),t.next=24;break;case 12:return t.prev=12,t.next=15,n.json();case 15:(i=t.sent).data.message&&this.errorMessage&&(this.errorMessage.innerHTML=i.data.message),t.next=23;break;case 19:t.prev=19,t.t0=t.catch(12),console.error(t.t0),this.formFail.style.display="";case 23:this.formFail.style.display="inherit";case 24:this.submitButton.value=this.defaultValue;case 25:case"end":return t.stop()}},t,this,[[12,19]])}));return function(e){return t.apply(this,arguments)}}()}]),t}(),f=function(){function t(e){var r=this;i(this,t),this.form=e,this.formBlock=e.closest(".w-form"),this.formDone=this.formBlock.querySelector(".w-form-done"),this.formFail=this.formBlock.querySelector(".w-form-fail"),this.errorMessage=this.formFail.querySelector('[udy-el="error-message"]'),this.submitButton=e.querySelector('input[type="submit"]'),this.defaultValue=this.submitButton.value,this.loadingValue=this.submitButton.getAttribute("data-wait")||"Wait...";var n=this.formBlock.querySelector('input[name="redirect_to"]');n&&(this.redirect=n.value),e.addEventListener("submit",function(t){r.handleSubmit(t)})}return a(t,[{key:"handleSubmit",value:function(){var t=n(e.mark(function t(r){var n,i,o=this;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.preventDefault(),this.formFail.style.display="none",this.submitButton.value=this.loadingValue,t.next=5,u({action:"udesly_wp_reset_password",data:{user_key:this.form.querySelector('[name="user_key"]').value,user_login:this.form.querySelector('[name="user_login"]').value,password:this.form.querySelector('[name="password"]').value,password_repeat:this.form.querySelector('[name="password_repeat"]').value}});case 5:if(!(n=t.sent).ok){t.next=12;break}this.form.style.display="none",this.formDone.style.display="inherit",this.redirect&&setTimeout(function(){window.location=o.redirect},500),t.next=24;break;case 12:return t.prev=12,t.next=15,n.json();case 15:(i=t.sent).data.message&&this.errorMessage&&(this.errorMessage.innerHTML=i.data.message),t.next=23;break;case 19:t.prev=19,t.t0=t.catch(12),console.error(t.t0),this.formFail.style.display="";case 23:this.formFail.style.display="inherit";case 24:this.submitButton.value=this.defaultValue;case 25:case"end":return t.stop()}},t,this,[[12,19]])}));return function(e){return t.apply(this,arguments)}}()}]),t}();var m=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t};var y=function(t){for(var e=1;e1?(this.nextButton.addEventListener("click",function(e){return t.getNextPage()}),this.prevButton.addEventListener("click",function(e){return t.getPreviousPage()}),this.nextButton.removeAttribute("style")):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=n(e.mark(function t(r){var n;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.processing=!0,this.itemsList.classList.add("loading"),!(r<=this.maxPages)){t.next=14;break}if(!this.cache[r]){t.next=8;break}this.itemsList.innerHTML=this.cache[r],this.currentPage=r,t.next=12;break;case 8:return t.next=10,this.queryPosts(r);case 10:""!==(n=t.sent)&&(this.cache[r]=n,this.itemsList.innerHTML=n,this.currentPage=r,this.processing=!1);case 12:t.next=15;break;case 14: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=n(e.mark(function t(){var r;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.processing){t.next=2;break}return t.abrupt("return");case 2:r=this.currentPage-1,this.getPage(r);case 4:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"queryPosts",value:function(){var t=n(e.mark(function t(r){var n,i;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u({action:"udesly_get_posts",data:{page:r,name:this.queryName,template:this.queryTemplateName}});case 2:if(!(n=t.sent).ok){t.next=10;break}return t.next=6,n.json();case 6:return i=t.sent,t.abrupt("return",i.data.posts);case 10:return this.processing=!1,this.prevButton.remove(),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.setAttribute("style","display: none"),this.nextButton.removeAttribute("style")):this.currentPage===this.maxPages?(this.prevButton.removeAttribute("style"),this.nextButton.setAttribute("style","display: none")):(this.nextButton.removeAttribute("style"),this.prevButton.removeAttribute("style")),this.countPage&&(this.countPage.textContent="".concat(this.currentPage," / ").concat(this.maxPages))}}]),t}();document.addEventListener("DOMContentLoaded",function(){var t=document.querySelectorAll("[udesly-wp-ajax='login']");t.length&&t.forEach(function(t){new c(t)});var e=document.querySelectorAll("[udesly-wp-ajax='register']");e.length&&e.forEach(function(t){new l(t)});var r=document.querySelectorAll("[udesly-wp-ajax='lost-password']");r.length&&r.forEach(function(t){new h(t)});var n=document.querySelectorAll("[udesly-wp-ajax='reset-password']");n.length&&n.forEach(function(t){new f(t)});var i=document.querySelectorAll("[udesly-wp-ajax='form']");i.length&&i.forEach(function(t){new d(t)});var o=document.querySelectorAll("[data-query-template][data-query-name]");o.length&&o.forEach(function(t){new v(t)});try{document.querySelectorAll('[href="'.concat(window.location.pathname,'"], [href="').concat(window.location.toString(),'"]')).forEach(function(t){return t.classList.add("w--current")})}catch(t){}},!1)}); +!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t(function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r,n){var i=e&&e.prototype instanceof p?e:p,o=Object.create(i.prototype),a=new _(n||[]);return o._invoke=function(t,e,r){var n=l;return function(i,o){if(n===f)throw new Error("Generator is already running");if(n===m){if("throw"===i)throw o;return E()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=q(a,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=f;var u=c(t,e,r);if("normal"===u.type){if(n=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=m,r.method="throw",r.arg=u.arg)}}}(t,r,a),o}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l="suspendedStart",h="suspendedYield",f="executing",m="completed",y={};function p(){}function d(){}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=p.prototype=Object.create(g);function S(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function k(t){var e;this._invoke=function(r,i){function o(){return new Promise(function(e,o){!function e(r,i,o,a){var s=c(t[r],t,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,o,a)},function(t){e("throw",t,o,a)}):Promise.resolve(l).then(function(t){u.value=t,o(u)},function(t){return e("throw",t,o,a)})}a(s.arg)}(r,i,e,o)})}return e=e?e.then(o,o):o()}}function q(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,q(t,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=c(n,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var o=i.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,y):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function B(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 L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,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 i=-1,a=function r(){for(;++i=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),y}},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 i=n.arg;L(r)}return i}}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),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}});function r(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}var n=function(t){return function(){var e=this,n=arguments;return new Promise(function(i,o){var a=t.apply(e,n);function s(t){r(a,i,o,s,u,"next",t)}function u(t){r(a,i,o,s,u,"throw",t)}s(void 0)})}};var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function o(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=t.action,r=t.nonce,n=t.nonceField,i=t.data,o=t.method,a=t.url,u=t.credentials;if(!e)throw new TypeError("Cannot make ajax call without action");if(i&&"object"!==s(i))throw new TypeError("Data to send must be an object");if(!a&&!window.udeslyAjax.ajaxUrl)throw new TypeError("Cannot make ajax call without url");var c=new FormData;if(c.append("action",e),c.append(n||"security",r||window.udeslyAjax.nonce),i)for(var l in i)c.append(l,i[l]);return fetch(a||window.udeslyAjax.ajaxUrl,{method:o||"POST",body:c,credentials:u||"same-origin"})}var c=function(){function t(e){var r=this;i(this,t),this.form=e,this.formBlock=e.closest(".w-form"),this.formDone=this.formBlock.querySelector(".w-form-done"),this.formFail=this.formBlock.querySelector(".w-form-fail"),this.errorMessage=this.formFail.querySelector('[udy-el="error-message"]'),this.submitButton=e.querySelector('input[type="submit"]'),this.defaultValue=this.submitButton.value,this.loadingValue=this.submitButton.getAttribute("data-wait")||"Wait...";var n=this.formBlock.querySelector('input[name="redirect_to"]');n&&(this.redirect=n.value),e.addEventListener("submit",function(t){r.handleSubmit(t)})}return a(t,[{key:"handleSubmit",value:function(){var t=n(e.mark(function t(r){var n,i,o=this;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.preventDefault(),this.formFail.style.display="none",this.submitButton.value=this.loadingValue,t.next=5,u({action:"udesly_wp_login",data:{username:this.form.querySelector('[name="log"]').value,password:this.form.querySelector('[name="pwd"]').value,rememberme:!!this.form.querySelector('checkbox[name="rememberme"]')&&this.form.querySelector('checkbox[name="rememberme"]').checked}});case 5:if(!(n=t.sent).ok){t.next=12;break}this.form.style.display="none",this.formDone.style.display="inherit",this.redirect&&setTimeout(function(){window.location=o.redirect},500),t.next=24;break;case 12:return t.prev=12,t.next=15,n.json();case 15:(i=t.sent).data.message&&this.errorMessage&&(this.errorMessage.innerHTML=i.data.message),t.next=23;break;case 19:t.prev=19,t.t0=t.catch(12),console.error(t.t0),this.formFail.style.display="";case 23:this.formFail.style.display="inherit";case 24:this.submitButton.value=this.defaultValue;case 25:case"end":return t.stop()}},t,this,[[12,19]])}));return function(e){return t.apply(this,arguments)}}()}]),t}(),l=function(){function t(e){var r=this;i(this,t),this.form=e,this.formBlock=e.closest(".w-form"),this.formDone=this.formBlock.querySelector(".w-form-done"),this.formFail=this.formBlock.querySelector(".w-form-fail"),this.errorMessage=this.formFail.querySelector('[udy-el="error-message"]'),this.submitButton=e.querySelector('input[type="submit"]'),this.defaultValue=this.submitButton.value,this.loadingValue=this.submitButton.getAttribute("data-wait")||"Wait...";var n=this.formBlock.querySelector('input[name="redirect_to"]');n&&(this.redirect=n.value),e.addEventListener("submit",function(t){r.handleSubmit(t)})}return a(t,[{key:"handleSubmit",value:function(){var t=n(e.mark(function t(r){var n,i,o=this;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.preventDefault(),this.formFail.style.display="none",this.submitButton.value=this.loadingValue,t.next=5,u({action:"udesly_wp_register",data:{username:this.form.querySelector('[name="username"]')?this.form.querySelector('[name="username"]').value:"",password:this.form.querySelector('[name="password"]').value,password_repeat:this.form.querySelector('[name="password_repeat"]').value,mail:this.form.querySelector('[name="email"]').value,first_name:this.form.querySelector('[name="first_name"]')?this.form.querySelector('[name="first_name"]').value:"",last_name:this.form.querySelector('[name="last_name"]')?this.form.querySelector('[name="last_name"]').value:""}});case 5:if(!(n=t.sent).ok){t.next=12;break}this.form.style.display="none",this.formDone.style.display="inherit",this.redirect&&setTimeout(function(){window.location=o.redirect},500),t.next=23;break;case 12:return t.prev=12,t.next=15,n.json();case 15:(i=t.sent).data.message&&this.errorMessage&&(this.errorMessage.innerHTML=i.data.message),t.next=22;break;case 19:t.prev=19,t.t0=t.catch(12),this.formFail.style.display="";case 22:this.formFail.style.display="inherit";case 23:this.submitButton.value=this.defaultValue;case 24:case"end":return t.stop()}},t,this,[[12,19]])}));return function(e){return t.apply(this,arguments)}}()}]),t}(),h=function(){function t(e){var r=this;i(this,t),this.form=e,this.formBlock=e.closest(".w-form"),this.formDone=this.formBlock.querySelector(".w-form-done"),this.formFail=this.formBlock.querySelector(".w-form-fail"),this.errorMessage=this.formFail.querySelector('[udy-el="error-message"]'),this.submitButton=e.querySelector('input[type="submit"]'),this.defaultValue=this.submitButton.value,this.loadingValue=this.submitButton.getAttribute("data-wait")||"Wait...";var n=this.formBlock.querySelector('input[name="redirect_to"]');n&&(this.redirect=n.value),e.addEventListener("submit",function(t){r.handleSubmit(t)})}return a(t,[{key:"handleSubmit",value:function(){var t=n(e.mark(function t(r){var n,i,o=this;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.preventDefault(),this.formFail.style.display="none",this.submitButton.value=this.loadingValue,t.next=5,u({action:"udesly_wp_lost_password",data:{user_login:this.form.querySelector('[name="user_login"]').value,page_slug:document.body.getAttribute("udesly-page")}});case 5:if(!(n=t.sent).ok){t.next=12;break}this.form.style.display="none",this.formDone.style.display="inherit",this.redirect&&setTimeout(function(){window.location=o.redirect},500),t.next=24;break;case 12:return t.prev=12,t.next=15,n.json();case 15:(i=t.sent).data.message&&this.errorMessage&&(this.errorMessage.innerHTML=i.data.message),t.next=23;break;case 19:t.prev=19,t.t0=t.catch(12),console.error(t.t0),this.formFail.style.display="";case 23:this.formFail.style.display="inherit";case 24:this.submitButton.value=this.defaultValue;case 25:case"end":return t.stop()}},t,this,[[12,19]])}));return function(e){return t.apply(this,arguments)}}()}]),t}(),f=function(){function t(e){var r=this;i(this,t),this.form=e,this.formBlock=e.closest(".w-form"),this.formDone=this.formBlock.querySelector(".w-form-done"),this.formFail=this.formBlock.querySelector(".w-form-fail"),this.formFail&&(this.errorMessage=this.formFail.querySelector('[udy-el="error-message"]')),this.submitButton=e.querySelector('input[type="submit"]'),this.defaultValue=this.submitButton.value,this.loadingValue=this.submitButton.getAttribute("data-wait")||"Wait...";var n=this.formBlock.querySelector('input[name="redirect_to"]');n&&(this.redirect=n.value),e.addEventListener("submit",function(t){r.handleSubmit(t)})}return a(t,[{key:"handleSubmit",value:function(){var t=n(e.mark(function t(r){var n,i,o=this;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.preventDefault(),this.formFail&&(this.formFail.style.display="none"),this.submitButton.value=this.loadingValue,t.next=5,u({action:"udesly_wp_reset_password",data:{user_key:this.form.querySelector('[name="user_key"]').value,user_login:this.form.querySelector('[name="user_login"]').value,password:this.form.querySelector('[name="password"]').value,password_repeat:this.form.querySelector('[name="password_repeat"]').value}});case 5:if(!(n=t.sent).ok){t.next=12;break}this.form.style.display="none",this.formDone.style.display="inherit",this.redirect&&setTimeout(function(){window.location=o.redirect},500),t.next=24;break;case 12:return t.prev=12,t.next=15,n.json();case 15:(i=t.sent).data.message&&this.errorMessage&&(this.errorMessage.innerHTML=i.data.message),t.next=23;break;case 19:t.prev=19,t.t0=t.catch(12),console.error(t.t0),this.formFail&&(this.formFail.style.display="");case 23:this.formFail&&(this.formFail.style.display="inherit");case 24:this.submitButton.value=this.defaultValue;case 25:case"end":return t.stop()}},t,this,[[12,19]])}));return function(e){return t.apply(this,arguments)}}()}]),t}();var m=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t};var y=function(t){for(var e=1;e1?(this.nextButton.addEventListener("click",function(e){return t.getNextPage()}),this.prevButton.addEventListener("click",function(e){return t.getPreviousPage()}),this.nextButton.removeAttribute("style")):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=n(e.mark(function t(r){var n;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.processing=!0,this.itemsList.classList.add("loading"),!(r<=this.maxPages)){t.next=14;break}if(!this.cache[r]){t.next=8;break}this.itemsList.innerHTML=this.cache[r],this.currentPage=r,t.next=12;break;case 8:return t.next=10,this.queryPosts(r);case 10:""!==(n=t.sent)&&(this.cache[r]=n,this.itemsList.innerHTML=n,this.currentPage=r,this.processing=!1);case 12:t.next=15;break;case 14: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=n(e.mark(function t(){var r;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.processing){t.next=2;break}return t.abrupt("return");case 2:r=this.currentPage-1,this.getPage(r);case 4:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"queryPosts",value:function(){var t=n(e.mark(function t(r){var n,i;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u({action:"udesly_get_posts",data:{page:r,name:this.queryName,template:this.queryTemplateName}});case 2:if(!(n=t.sent).ok){t.next=10;break}return t.next=6,n.json();case 6:return i=t.sent,t.abrupt("return",i.data.posts);case 10:return this.processing=!1,this.prevButton.remove(),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.setAttribute("style","display: none"),this.nextButton.removeAttribute("style")):this.currentPage===this.maxPages?(this.prevButton.removeAttribute("style"),this.nextButton.setAttribute("style","display: none")):(this.nextButton.removeAttribute("style"),this.prevButton.removeAttribute("style")),this.countPage&&(this.countPage.textContent="".concat(this.currentPage," / ").concat(this.maxPages))}}]),t}();document.addEventListener("DOMContentLoaded",function(){var t=document.querySelectorAll("[udesly-wp-ajax='login']");t.length&&t.forEach(function(t){new c(t)});var e=document.querySelectorAll("[udesly-wp-ajax='register']");e.length&&e.forEach(function(t){new l(t)});var r=document.querySelectorAll("[udesly-wp-ajax='lost-password']");r.length&&r.forEach(function(t){new h(t)});var n=document.querySelectorAll("[udesly-wp-ajax='reset-password']");n.length&&n.forEach(function(t){new f(t)});var i=document.querySelectorAll("[udesly-wp-ajax='form']");i.length&&i.forEach(function(t){new d(t)});var o=document.querySelectorAll("[data-query-template][data-query-name]");o.length&&o.forEach(function(t){new v(t)});try{document.querySelectorAll('[href="'.concat(window.location.pathname,'"], [href="').concat(window.location.toString(),'"]')).forEach(function(t){return t.classList.add("w--current")})}catch(t){}},!1)}); diff --git a/udesly-adapter-plugin.php b/udesly-adapter-plugin.php index ba5fe8a..44cb171 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.0.15 + * Version: 2.0.0.16 * 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.0.15"); +defined('UDESLY_ADAPTER_VERSION') ?: define('UDESLY_ADAPTER_VERSION', "2.0.0.16"); 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/');