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