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