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

1 line
22 KiB
JavaScript
Raw Normal View History

!function(){var e,t={373: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,a,o,i=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){l=!0,s=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw s}}return i}}(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.React,c=window.wp.i18n,l=window.wp.components,m=window.wp.element,d=window.wp.apiFetch,p=n.n(d),u=n(162),g=n.n(u);function _(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 f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var h=function(){var e=o((0,m.useState)(!1),2),t=e[0],n=e[1],a=o((0,m.useState)(""),2),d=a[0],u=a[1],_=o((0,m.useState)(""),2),h=_[0],b=_[1],v=o((0,m.useState)(!1),2),y=v[0],E=v[1],w=o((0,m.useState)(!1),2),S=w[0],O=w[1],L=o((0,m.useState)(generateProDashboard.modules),2),x=L[0],C=L[1];if((0,m.useEffect)((function(){t||n(!0)})),!t)return(0,i.createElement)(l.Placeholder,{className:"generatepress-dashboard__placeholder"},(0,i.createElement)(l.Spinner,null));var N=function(e,t,n){u(t);var r=e.target.previousElementSibling.previousElementSibling;p()({path:"/generatepress-pro/v1/modules",method:"POST",data:{key:x[t].key,action:n}}).then((function(e){u(""),r.classList.add("generatepress-dashboard__section-item-message__show"),r.textContent=e.response,e.success&&e.response?(C((function(e){return f(f({},e),{},s({},t,f(f({},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,!!x&&(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(x).filter((function(e){return!(!x[e].isActive&&x[e].deprecated)})).map((function(e){return(0,i.createElement)("div",{className:"generatepress-dashboard__section-item",key:e,style:{boxShadow:x[e].isActive?"-5px 0 0 var(--wp-admin-theme-color)":"-5px 0 0 #ddd",pointerEvents:"WooCommerce"!==e||generateProDashboard.hasWooCommerce?