import{u as S,k as F,r as n,j as t}from"./main-333.js";import{d as I,_ as l,I as N,F as k}from"./bi.636.93.js";import{B as v}from"./bi.429.767.js";import{S as _}from"./bi.563.969.js";import w from"./bi.210.261.js";import{F as y,c as L}from"./bi.721.773.js";import"./bi.318.783.js";import"./bi.535.730.js";import"./bi.286.731.js";function A({formFields:c,setFlow:g,flow:f,allIntegURL:x}){const h=S(),{formID:u}=F(),[i,o]=n.useState(!1),[b,j]=n.useState({}),[s,d]=n.useState(1),[C,a]=n.useState({show:!1}),[e,r]=n.useState({name:"Fluent CRM",type:"Fluent Crm",actionName:"",field_map:[{formField:"",fluentCRMField:""}],actions:{}}),p=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),m===3){if(!L(e)){a({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){a({show:!0,msg:l("Please select list to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&d(m)}else d(m)};return t.jsxs("div",{children:[t.jsx(I,{snack:C,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(_,{step:3,active:s})}),t.jsx(w,{formID:u,fluentCrmConf:e,setFluentCrmConf:r,step:s,nextPage:p,isLoading:i,setIsLoading:o,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"200px"},children:[t.jsx(y,{formID:u,formFields:c,fluentCrmConf:e,setFluentCrmConf:r,isLoading:i,setIsLoading:o,loading:b,setLoading:j,setSnackbar:a}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>p(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(v,{className:"ml-1 rev-icn"})]})]}),t.jsx(N,{step:s,saveConfig:()=>k(f,g,x,e,h,"","",o),isLoading:i,dataConf:e,setDataConf:r,formFields:c})]})}export{A as default};
