var w=Object.defineProperty;var h=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var b=(a,e,s)=>e in a?w(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s,u=(a,e)=>{for(var s in e||(e={}))z.call(e,s)&&b(a,s,e[s]);if(h)for(var s of h(e))C.call(e,s)&&b(a,s,e[s]);return a};import{j as t,_ as i,b as I}from"./main.2.9.0.js";import{b as x}from"./react-router.DMwpH23k.js";import{B as F}from"./BackIcn._8Wofmn2.js";import{y as p}from"./Note.NSUdvR3c.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.CEA_lFLo.js";function H({ivyFormsConf:a,setIvyFormsConf:e,step:s,nextPage:j,isLoading:c,setIsLoading:l,setSnackbar:v,isInfo:o}){const[r,f]=x.useState(!1),[m,N]=x.useState(!1),g=()=>{l("auth"),I({},"ivy_forms_authorize").then(n=>{n!=null&&n.success&&(f(!0),v({show:!0,msg:i("Connected with IvyForms Successfully","bit-integrations")})),l(!1),N(!0)}).catch(()=>l(!1))},y=n=>{const d=u({},a);d[n.target.name]=n.target.value,e(d)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:s===1&&900,height:s===1&&"auto"},children:[t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:i("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:y,name:"name",value:a.name,type:"text",placeholder:i("Integration Name...","bit-integrations"),disabled:o}),c==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(p,{size:25,clr:"#022217",className:"mr-2"}),i("Checking if IvyForms is authorized!!!","bit-integrations")]}),m&&!r&&!c&&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:i("IvyForms is not activated or not installed","bit-integrations")})]})}),m&&r&&!c&&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:i("IvyForms is activated","bit-integrations")})]}),!o&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:g,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:r||c==="auth",children:[r?i("Connected","bit-integrations"):i("Connect to IvyForms","bit-integrations"),c==="auth"&&t.jsx(p,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>j(2),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!r,children:[i("Next","bit-integrations"),t.jsx(F,{className:"ml-1 rev-icn"})]})]})]})}export{H as default};
