import{j as t,_ as l}from"./main.2.9.0.js";import{u as C,e as F,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as I}from"./BackIcn._8Wofmn2.js";import{S as N}from"./SnackMsg.DYSD96P4.js";import{S as v}from"./Steps.BYe8zHkm.js";import{I as _,g as k}from"./Integrations.DL8wqGct.js";import w from"./FluentCrmAuthorization.0qwdUUMz.js";import{F as y,c as L}from"./FluentCrmIntegLayout.OJJUsnz9.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./ActionProFeatureLabels.gUp7_RXn.js";import"./TagifyInput.KPPRQJ1B.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};
