var k=Object.defineProperty;var b=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var g=(n,e,s)=>e in n?k(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s,c=(n,e)=>{for(var s in e||(e={}))w.call(e,s)&&g(n,s,e[s]);if(b)for(var s of b(e))A.call(e,s)&&g(n,s,e[s]);return n};import{j as t,_ as a,b as E}from"./main.2.8.10.js";import{b as r}from"./react-router.DMwpH23k.js";import{y as f}from"./Note.DalStCGz.js";import{B as _}from"./BackIcn.BFDZx8No.js";import{T as L}from"./TutorialLink.D6K_DiHL.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.BnhKHfEP.js";function H({formID:n,fluentCrmConf:e,setFluentCrmConf:s,step:m,nextPage:p,setSnackbar:x,isInfo:j}){const[o,N]=r.useState(!1),[C,y]=r.useState({integrationName:""}),[S,v]=r.useState(!1),[l,u]=r.useState(!1),[z,I]=r.useState(!0);r.useEffect(()=>()=>{I(!1)},[]);const F=()=>{u("auth"),E({},"fluent_crm_authorize").then(i=>{z&&(i!=null&&i.success&&(N(!0),x({show:!0,msg:a("Connected Successfully","bit-integrations")})),v(!0),u(!1))})},M=i=>{const d=c({},e),h=c({},C);h[i.target.name]="",d[i.target.name]=i.target.value,y(h),s(d)};return t.jsx(t.Fragment,{children:t.jsxs("div",{className:"btcd-stp-page",style:{width:m===1&&900,height:m===1&&"auto"},children:[t.jsx(L,{linkKey:"fluentCrm"}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:a("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-5 mt-1",onChange:M,name:"name",value:e.name,type:"text",placeholder:a("Integration Name...","bit-integrations"),disabled:j}),l==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(f,{size:25,clr:"#022217",className:"mr-2"}),a("Checking if Fluent CRM is active!!!","bit-integrations")]}),S&&!o&&!l&&t.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[t.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),a("Please! First Install Fluent CRM Plugins","bit-integrations")]}),t.jsxs("button",{onClick:F,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:o||l,children:[o?a("Connected ✔","bit-integrations"):a("Connect to Fluent CRM","bit-integrations"),l&&t.jsx(f,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>p(2),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!o,children:[a("Next","bit-integrations"),t.jsx(_,{className:"ml-1 rev-icn"})]})]})})}export{H as default};
