import{u as j,k as b,r as i,j as e}from"./main-406.js";import{d as S,j as y,I,G as v}from"./bi.394.85.js";import{B as M}from"./bi.46.744.js";import{S as k}from"./bi.68.941.js";import _ from"./bi.319.317.js";import{c as N}from"./bi.642.891.js";import{M as w}from"./bi.37.892.js";import"./bi.150.760.js";function q({formFields:c,setFlow:d,flow:p,allIntegURL:f}){const u=j(),{formID:l}=b(),[n,o]=i.useState(!1),[s,m]=i.useState(1),[g,a]=i.useState({show:!1}),[t,r]=i.useState({name:"Sarbacane(Mailify)",type:"Sarbacane(Mailify)",account_id:"",api_key:"",field_map:[{formField:"",mailifyField:""}],actions:{}}),x=h=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),h===3){if(!N(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(S,{snack:g,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(k,{step:3,active:s})}),e.jsx(_,{formID:l,mailifyConf:t,setMailifyConf:r,step:s,setstep:m,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,mailifyConf:t,setMailifyConf:r,isLoading:n,setIsLoading:o,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:[y("Next","bit-integrations")," "," ",e.jsx(M,{className:"ml-1 rev-icn"})]})]}),e.jsx(I,{step:s,saveConfig:()=>v(p,d,f,t,u,"","",o),isLoading:n,dataConf:t,setDataConf:r,formFields:c})]})}export{q as default};
