import{j as t,_ as l}from"./main.2.8.10.js";import{u as C,e as F,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as I}from"./BackIcn.BFDZx8No.js";import{S as N}from"./SnackMsg.7BjcJK1j.js";import{S as v}from"./Steps.B84Ui3GU.js";import{I as _,g as k}from"./Integrations.BFhED4ck.js";import w from"./FluentCrmAuthorization.C_fbqJbC.js";import{F as y,c as L}from"./FluentCrmIntegLayout.CJLz4YRP.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./ActionProFeatureLabels.BzMNdAoD.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function V({formFields:c,setFlow:g,flow:f,allIntegURL:x}){const h=C(),{formID:p}=F(),[n,o]=a.useState(!1),[b,j]=a.useState({}),[s,u]=a.useState(1),[S,i]=a.useState({show:!1}),[e,r]=a.useState({name:"Fluent CRM",type:"Fluent Crm",actionName:"",field_map:[{formField:"",fluentCRMField:""}],actions:{}}),d=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),m===3){if(!L(e)){i({show:!0,msg:l("Please map all required fields to continue.","bit-integrations")});return}if((e==null?void 0:e.actionName)==="add-user"&&!e.list_id){i({show:!0,msg:l("Please select list to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&u(m)}else u(m)};return t.jsxs("div",{children:[t.jsx(N,{snack:S,setSnackbar:i}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(v,{step:3,active:s})}),t.jsx(w,{formID:p,fluentCrmConf:e,setFluentCrmConf:r,step:s,nextPage:d,isLoading:n,setIsLoading:o,setSnackbar:i}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"500px"},children:[t.jsx(y,{formID:p,formFields:c,fluentCrmConf:e,setFluentCrmConf:r,isLoading:n,setIsLoading:o,loading:b,setLoading:j,setSnackbar:i}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>d(3),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),t.jsx(I,{className:"ml-1 rev-icn"})]})]}),t.jsx(_,{step:s,saveConfig:()=>k(f,g,x,e,h,"","",o),isLoading:n,dataConf:e,setDataConf:r,formFields:c})]})}export{V as default};
