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