laipower/wp-content/plugins/gp-premium/dist/dashboard.js

1 line
22 KiB
JavaScript
Raw Normal View History

!function(){var e,t={520:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,"string");if("object"!==r(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===r(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,s,_x,a,o=[],_n=!0,i=!1;try{if(_x=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;_n=!1}else for(;!(_n=(r=_x.call(n)).done)&&(o.push(r.value),o.length!==t);_n=!0);}catch(e){i=!0,s=e}finally{try{if(!_n&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(i)throw s}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||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 i=window.wp.element,c=window.wp.i18n,l=window.wp.components,m=window.wp.apiFetch,d=n.n(m),p=n(162),u=n.n(p);function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?g(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var f=function(){var e=o((0,i.useState)(!1),2),t=e[0],n=e[1],a=o((0,i.useState)(""),2),m=a[0],p=a[1],g=o((0,i.useState)(""),2),f=g[0],h=g[1],b=o((0,i.useState)(!1),2),v=b[0],y=b[1],E=o((0,i.useState)(!1),2),w=E[0],S=E[1],O=o((0,i.useState)(generateProDashboard.modules),2),L=O[0],x=O[1];if((0,i.useEffect)((function(){t||n(!0)})),!t)return(0,i.createElement)(l.Placeholder,{className:"generatepress-dashboard__placeholder"},(0,i.createElement)(l.Spinner,null));var C=function(e,t,n){p(t);var r=e.target.previousElementSibling.previousElementSibling;d()({path:"/generatepress-pro/v1/modules",method:"POST",data:{key:L[t].key,action:n}}).then((function(e){p(""),r.classList.add("generatepress-dashboard__section-item-message__show"),r.textContent=e.response,e.success&&e.response?(x((function(e){return _(_({},e),{},s({},t,_(_({},e[t]),{},{isActive:"activate"===n})))})),setTimeout((function(){r.classList.remove("generatepress-dashboard__section-item-message__show")}),3e3)):r.classList.add("generatepress-dashboard__section-item-message__error")}))};return(0,i.createElement)(i.Fragment,null,!!L&&(0,i.createElement)("div",{className:"generatepress-dashboard__section"},(0,i.createElement)("div",{className:"generatepress-dashboard__section-title"},(0,i.createElement)("h2",null,(0,c.__)("Modules","gp-premium"))),Object.keys(L).filter((function(e){return!(!L[e].isActive&&L[e].deprecated)})).map((function(e){return(0,i.createElement)("div",{className:"generatepress-dashboard__section-item",key:e,style:{boxShadow:L[e].isActive?"-5px 0 0 var(--wp-admin-theme-color)":"-5px 0 0 #ddd",pointerEvents:"WooCommerce"!==e||generateProDashboard.hasWooCommerce?null:"n