Current File : /home/kelaby89/onlycnc.com.au/wp-content/plugins/gutenverse/assets/js/wizard.js |
/*! For license information please see wizard.js.LICENSE.txt */
(()=>{var e={500:(e,t)=>{var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=s(e,i(r)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var r in e)n.call(e,r)&&e[r]&&(t=s(t,r));return t}function s(e,t){return t?e?e+" "+t:e+t:e}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";function e(t){return e="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},e(t)}function t(t,r,n){return(r=function(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,s,c=[],a=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);a=!0);}catch(e){l=!0,o=e}finally{try{if(!a&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(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.")}()}const i=window.wp.element,s=window.wp.i18n,c=(window.React,window.ReactJSXRuntime);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?a(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const u=function(e){return(0,c.jsxs)("svg",l(l({xmlns:"http://www.w3.org/2000/svg",width:64,height:64,fill:"none"},e),{},{children:[(0,c.jsx)("circle",{cx:32,cy:32,r:32,fill:"#3B57F7"}),(0,c.jsxs)("g",{fill:"#fff",clipPath:"url(#icon-plugin-form_svg__a)",children:[(0,c.jsx)("path",{d:"M23.79 42.129v4.619h8.467l-.974-1.772 1.595-2.847zM23.79 30.58h16.419v-6.928h-16.42zm2.198-4.618h12.021v2.309H25.988zM23.79 39.819h10.408l1.173-2.31h-9.383V35.2h14.221v-2.31h-16.42z"}),(0,c.jsx)("path",{d:"M18.219 14.416v36.95h16.578l-1.27-2.31h-13.11V21.344h23.164v16.165l2.2 4.003V14.416zm25.362 4.619H20.418v-2.31H43.58z"}),(0,c.jsx)("path",{d:"m40.39 42.896 2.906 5.085-.97 1.696h-5.81l-2.907-5.086.969-1.695 2.906 5.085h3.874l-1.937-3.39h-3.874l-.97-1.695zm1.938-3.39h-5.813l-.969 1.695h5.813l2.905 5.085.969-1.695z"})]}),(0,c.jsx)("defs",{children:(0,c.jsx)("clipPath",{id:"icon-plugin-form_svg__a",children:(0,c.jsx)("path",{fill:"#fff",d:"M13.71 13.715h36.572v36.95H13.71z"})})})]}))};function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?d(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const p=function(e){return(0,c.jsxs)("svg",f(f({xmlns:"http://www.w3.org/2000/svg",width:64,height:64,fill:"none"},e),{},{children:[(0,c.jsx)("circle",{cx:32,cy:32,r:32,fill:"#3B57F7"}),(0,c.jsx)("g",{clipPath:"url(#icon-plugin-font_svg__a)",children:(0,c.jsx)("path",{fill:"#fff",d:"M30.252 44.25h3.481V46h-8.722v-1.75h3.492v-24.5h-8.754v1.743H18V18h22.745l-.001 3.493h-1.75l.002-1.743h-8.744zm10.904-.011c-1.188-.001-2.155-1.205-2.155-2.684V31.116h3.481v-1.749H39v-3.503h-1.75v3.503h-3.482v1.75h3.483v10.438c0 2.442 1.751 4.43 3.904 4.433l3.953.003.001-1.749z"})}),(0,c.jsx)("defs",{children:(0,c.jsx)("clipPath",{id:"icon-plugin-font_svg__a",children:(0,c.jsx)("path",{fill:"#fff",d:"M18 18h28v28H18z"})})})]}))};function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?h(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const g=function(e){return(0,c.jsx)("svg",v(v({xmlns:"http://www.w3.org/2000/svg",width:13,height:13,fill:"none"},e),{},{children:(0,c.jsx)("path",{fill:"#40505D",d:"M13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0M9.774 4.038a.61.61 0 0 0-.877.018L6.075 7.651l-1.7-1.701a.61.61 0 0 0-.862.861l2.15 2.15a.61.61 0 0 0 .877-.015L9.783 4.89a.61.61 0 0 0-.008-.853"})}))};var j=function(){return(0,c.jsx)(g,{})},y=function(){return(0,c.jsx)(u,{})},b=function(){return(0,c.jsx)(p,{})},m=r(500),w=r.n(m);const x=window.wp.apiFetch;var O=r.n(x);function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function P(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?_(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var S=function(e){var t=e.part,r=e.selected,n=e.toggleSelected,o=e.icon,i=e.title,s=e.subtitle,a=w()("wizard-gutenverse-form","wizard-item",{selected:r});return(0,c.jsxs)("div",{className:a,onClick:function(){return n(t)},children:[(0,c.jsx)("div",{className:"wizard-item-icon",children:o}),(0,c.jsxs)("div",{className:"wizard-item-content",children:[(0,c.jsx)("h3",{children:i()}),(0,c.jsx)("p",{children:s})]}),r&&(0,c.jsx)("div",{className:"wizard-item-check",children:(0,c.jsx)(j,{})})]})},z=function(e){var r=e.setStage,n=window.GutenverseWizard,a=n.status,l=n.dashboard,u=Object.keys(a).reduce((function(e,t){return a[t]?e+1:e}),0),d=o((0,i.useState)({form:a.form,icon:a.icon}),2),f=d[0],p=d[1],h=a.form,v=a.icon,g=o((0,i.useState)("choose"),2),j=g[0],m=g[1],x=o((0,i.useState)({step:-1,totalStep:1,text:""}),2),_=x[0],z=x[1],N=function(e){"choose"===j&&p((function(r){return P(P({},r),{},t({},e,!r[e]))}))},D=function(e){m("installing");var t=Object.keys(f).filter((function(e){return f[e]})),r=Object.keys(f).reduce((function(e,t){return f[t]?e+1:e}),0),n=t[e],o="";switch(n){case"form":o=(0,s.__)("Install Gutenverse Form Plugin","gutenverse");break;case"icon":o=(0,s.__)("Install Gutenverse Icon","gutenverse")}z({step:e,totalStep:r,text:o}),e<r?O()({path:"gutenverse-client/v1/upgrade",method:"POST",data:{step:n}}).then((function(){D(e+1)})):(O()({path:"gutenverse-client/v1/upgrade",method:"POST",data:{step:"complete"}}),z({step:r,totalStep:r,text:(0,s.__)("Redirecting to Dashboard","gutenverse")}),setTimeout((function(){window.location.href=l}),3e3))};return u>0?(0,c.jsx)("div",{className:"wizard-wrapper",children:(0,c.jsxs)("div",{className:"wizard-container",children:[(0,c.jsxs)("div",{className:"wizard-container-header",children:[(0,c.jsx)("h1",{children:(0,s.__)("Thank you for upgrading Gutenverse","gutenverse")}),(0,c.jsx)("p",{children:(0,s.__)("We separate block into several plugin on Version 2. Choose plugin or asset that you want to install & activate.","gutenverse")})]}),(0,c.jsxs)("div",{className:"wizard-container-body",children:[h&&(0,c.jsx)(S,{title:function(){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("strong",{children:[(0,s.__)("Gutenverse","gutenverse")," "]}),(0,s.__)("Form","gutenverse")]})},subtitle:(0,s.__)("Flexible, Design-Friendly and Advanced Contact Form builder plugin for WordPress new Editor"),icon:(0,c.jsx)(y,{}),part:"form",selected:f.form,toggleSelected:N}),v&&(0,c.jsx)(S,{title:function(){return(0,c.jsx)(c.Fragment,{children:(0,s.__)("Gutenicon & Fontawesome","gutenverse")})},subtitle:(0,s.__)("Download Gutenverse fonticon into your server"),icon:(0,c.jsx)(b,{}),part:"icon",selected:f.icon,toggleSelected:N})]}),(0,c.jsxs)("div",{className:"wizard-container-footer",children:[(0,c.jsxs)("div",{className:w()("wizard-progress",{hide:"installing"!==j}),children:[(0,c.jsxs)("div",{className:"wizard-progress-wrapper",children:[(0,c.jsxs)("div",{className:"progress-text",children:[" ",_.text," "]}),_.step!==_.totalStep&&(0,c.jsxs)("div",{className:"progress-step",children:[_.step+1," / ",_.totalStep," ",(0,s.__)("Completed","gutenverse")]})]}),(0,c.jsx)("div",{className:"progress-bar",children:(0,c.jsx)("div",{className:"progress-done",style:{width:(_.step+1)/(_.totalStep+1)*100+"%"}})})]}),"choose"===j&&(0,c.jsxs)("div",{className:"wizard-button",children:[(0,c.jsx)("div",{className:"button secondary",onClick:function(){return r("later")},children:(0,s.__)("Install Later")}),(0,c.jsx)("div",{className:"button active",onClick:function(){return D(0)},children:(0,s.__)("Install & Activate")})]})]})]})}):(0,c.jsx)("h1",{children:(0,s.__)("All is Done","gutenverse")})},N=function(e){var t=e.setStage,r=window.GutenverseWizard.dashboard;return(0,c.jsx)("div",{className:"wizard-wrapper",children:(0,c.jsxs)("div",{className:"wizard-container",children:[(0,c.jsxs)("div",{className:"wizard-container-header",children:[(0,c.jsx)("h1",{children:(0,s.__)("New Gutenverse Setup","gutenverse")}),(0,c.jsx)("p",{children:(0,s.__)("If you decide to do upgrade later, you can follow this step.","gutenverse")})]}),(0,c.jsx)("div",{className:"wizard-container-body",style:{margin:"70px 0px 90px"},children:(0,c.jsxs)("ol",{children:[(0,c.jsxs)("li",{style:{marginBottom:"40px"},children:[(0,c.jsx)("h3",{style:{fontWeight:500},children:(0,s.__)("Install Additional Gutenverse Plugin","gutenverse")}),(0,c.jsxs)("p",{children:[(0,s.__)("Go to","gutenverse")," ",(0,c.jsx)("strong",{children:(0,s.__)("Gutenverse Dashboard → Ecosystem","gutenverse")})," ",(0,s.__)("and Choose which plugin you want to install.","gutenverse")]})]}),(0,c.jsxs)("li",{style:{marginBottom:"40px"},children:[(0,c.jsx)("h3",{style:{fontWeight:500},children:(0,s.__)("Load Fonticon locally","gutenverse")}),(0,c.jsxs)("p",{children:[(0,s.__)("Go to","gutenverse")," ",(0,c.jsx)("strong",{children:(0,s.__)("Gutenverse Dashboard → Setting → Font","gutenverse")})," ",(0,s.__)("and you can download font icon and serve it from your server instead of cloud.","gutenverse")]})]})]})}),(0,c.jsx)("div",{className:"wizard-container-footer",children:(0,c.jsxs)("div",{className:"wizard-button",children:[(0,c.jsx)("a",{className:"button secondary",href:r,children:(0,s.__)("Go to Dashboard","gutenverse")}),(0,c.jsx)("div",{className:"button active",onClick:function(){return t("install")},children:(0,s.__)("Back to Upgrade Page","gutenverse")})]})})]})})},D=function(){var e=o((0,i.useState)("install"),2),t=e[0],r=e[1];return"install"===t?(0,c.jsx)(z,{setStage:r}):(0,c.jsx)(N,{setStage:r})};window.addEventListener("load",(function(){var e;(e=document.getElementById("gutenverse-wizard"))&&(0,i.render)((0,c.jsx)(D,{}),e)}))})()})();