import{u as j,k as I,r as i,j as e}from"./main-333.js";import{d as L,_ as m,I as v,F as S}from"./bi.636.93.js";import{B as k}from"./bi.429.767.js";import{S as _}from"./bi.563.969.js";import y from"./bi.249.329.js";import{c as N}from"./bi.718.916.js";import{L as w}from"./bi.896.917.js";import"./bi.318.783.js";function q({formFields:c,setFlow:d,flow:g,allIntegURL:u}){const f=j(),{formID:l}=I(),[n,o]=i.useState(!1),[s,p]=i.useState(1),[x,a]=i.useState({show:!1}),[t,r]=i.useState({name:"Lemlist",type:"Lemlist",api_key:"",field_map:[{formField:"",lemlistField:""}],actions:{}}),h=b=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),b===3){if(!N(t)){a({show:!0,msg:m("Please map all required fields to continue.","bit-integrations")});return}if(!(t!=null&&t.campaignId)){a({show:!0,msg:m("Please select list to continue.","bit-integrations")});return}t.name!==""&&t.field_map.length>0&&p(3)}};return e.jsxs("div",{children:[e.jsx(L,{snack:x,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(_,{step:3,active:s})}),e.jsx(y,{formID:l,lemlistConf:t,setLemlistConf:r,step:s,setstep:p,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:l,formFields:c,lemlistConf:t,setLemlistConf:r,isLoading:n,setIsLoading:o,setSnackbar:a}),e.jsxs("button",{onClick:()=>h(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:[m("Next","bit-integrations"),"  ",e.jsx(k,{className:"ml-1 rev-icn"})]})]}),e.jsx(v,{step:s,saveConfig:()=>S(g,d,u,t,f,"","",o),isLoading:n,dataConf:t,setDataConf:r,formFields:c})]})}export{q as default};
