import{j as t,_ as s,b as j}from"./main.2.9.0.js";import{b as d}from"./react-router.DMwpH23k.js";import{B as f}from"./BackIcn._8Wofmn2.js";import{y as h}from"./Note.NSUdvR3c.js";import{h as N}from"./MainWPCommonFunc.e0JBbT1d.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.CEA_lFLo.js";function A({formID:g,mainWPConf:c,setMainWPConf:m,step:r,nextPage:b,isLoading:e,setIsLoading:n,setSnackbar:u}){const[a,x]=d.useState(!1),[l,o]=d.useState(!1),p=()=>{n("auth"),j({},"main_wp_authorize").then(i=>{i!=null&&i.success&&(x(!0),u({show:!0,msg:s("Connected with MainWP Dashboard Successfully","bit-integrations")})),n(!1),o(!0)}).catch(()=>{n(!1),o(!0)})};return t.jsxs("div",{className:"btcd-stp-page",style:{width:r===1&&900,height:r===1&&"auto"},children:[t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:i=>N(i,c,m),name:"name",value:c.name,type:"text",placeholder:s("Integration Name...","bit-integrations")}),e==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(h,{size:25,clr:"#022217",className:"mr-2"}),s("Checking if MainWP Dashboard is active...","bit-integrations")]}),l&&!a&&!e&&t.jsx("div",{className:"flx mt-5",style:{width:900,justifyContent:"center"},children:t.jsxs("div",{className:"txt-center",children:[t.jsx("div",{className:"btcd-icn btcd-icn-err",children:t.jsx("span",{children:"✕"})}),t.jsx("div",{className:"mt-2",children:s("MainWP Dashboard is not activated or not installed","bit-integrations")})]})}),l&&a&&!e&&t.jsxs("div",{className:"flx mt-5",style:{width:900},children:[t.jsx("div",{className:"btcd-icn btcd-icn-success",children:t.jsx("span",{children:"✓"})}),t.jsx("div",{className:"mt-2",children:s("MainWP Dashboard is activated","bit-integrations")})]}),t.jsxs("button",{onClick:p,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:a||e==="auth",children:[a?s("Connected","bit-integrations"):s("Connect to MainWP Dashboard","bit-integrations"),e==="auth"&&t.jsx(h,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>b(2),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!a,children:[s("Next","bit-integrations"),t.jsx(f,{className:"ml-1 rev-icn"})]})]})}export{A as default};
