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