import{u as j,k as b,r as i,j as e}from"./main-406.js";import{d as I,j as L,I as v,G as S}from"./bi.394.85.js";import{B as k}from"./bi.46.744.js";import{S as y}from"./bi.68.941.js";import N from"./bi.634.318.js";import{c as _}from"./bi.465.893.js";import{L as w}from"./bi.653.894.js";import"./bi.150.760.js";function q({formFields:m,setFlow:p,flow:d,allIntegURL:u}){const f=j(),{formID:c}=b(),[n,o]=i.useState(!1),[s,l]=i.useState(1),[g,a]=i.useState({show:!1}),[t,r]=i.useState({name:"Lemlist",type:"Lemlist",api_key:"",field_map:[{formField:"",lemlistField:""}],actions:{}}),x=h=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),h===3){if(!_(t)){a({show:!0,msg:"Please map all required fields to continue."});return}if(!(t!=null&&t.campaignId)){a({show:!0,msg:"Please select list to continue."});return}t.name!==""&&t.field_map.length>0&&l(3)}};return e.jsxs("div",{children:[e.jsx(I,{snack:g,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(y,{step:3,active:s})}),e.jsx(N,{formID:c,lemlistConf:t,setLemlistConf:r,step:s,setstep:l,isLoading:n,setIsLoading:o,setSnackbar:a}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(w,{formID:c,formFields:m,lemlistConf:t,setLemlistConf:r,isLoading:n,setIsLoading:o,setSnackbar:a}),e.jsxs("button",{onClick:()=>x(3),disabled:!(t!=null&&t.campaignId)||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[L("Next","bit-integrations")," "," ",e.jsx(k,{className:"ml-1 rev-icn"})]})]}),e.jsx(v,{step:s,saveConfig:()=>S(d,p,u,t,f,"","",o),isLoading:n,dataConf:t,setDataConf:r,formFields:m})]})}export{q as default};
