import{u as C,k as S,r as n,j as t}from"./main-406.js";import{d as F,_ as I,I as N,G as k}from"./bi.394.85.js";import{B as v}from"./bi.46.744.js";import{S as _}from"./bi.68.941.js";import w from"./bi.751.250.js";import{F as y,c as L}from"./bi.459.750.js";import"./bi.150.760.js";import"./bi.704.707.js";import"./bi.701.708.js";function A({formFields:l,setFlow:p,flow:f,allIntegURL:g}){const x=C(),{formID:c}=S(),[i,o]=n.useState(!1),[h,j]=n.useState({}),[s,u]=n.useState(1),[b,a]=n.useState({show:!1}),[e,r]=n.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)){a({show:!0,msg:"Please map all required fields to continue."});return}if((e==null?void 0:e.actionName)==="add-user"&&!e.list_id){a({show:!0,msg:"Please select list to continue."});return}e.name!==""&&e.field_map.length>0&&u(m)}else u(m)};return t.jsxs("div",{children:[t.jsx(F,{snack:b,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(_,{step:3,active:s})}),t.jsx(w,{formID:c,fluentCrmConf:e,setFluentCrmConf:r,step:s,nextPage:d,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:c,formFields:l,fluentCrmConf:e,setFluentCrmConf:r,isLoading:i,setIsLoading:o,loading:h,setLoading:j,setSnackbar:a}),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:[I("Next","bit-integrations"),t.jsx(v,{className:"ml-1 rev-icn"})]})]}),t.jsx(N,{step:s,saveConfig:()=>k(f,p,g,e,x,"","",o),isLoading:i,dataConf:e,setDataConf:r,formFields:l})]})}export{A as default};
