import{u as S,k as j,r as i,j as t}from"./main-406.js";import{d as b,j as I,I as v,G as P}from"./bi.394.85.js";import{B as k}from"./bi.46.744.js";import{S as _}from"./bi.68.941.js";import N from"./bi.99.301.js";import{c as w}from"./bi.160.861.js";import{S as y}from"./bi.25.862.js";import"./bi.150.760.js";function q({formFields:l,setFlow:d,flow:p,allIntegURL:u}){const f=S(),{formID:c}=j(),[n,o]=i.useState(!1),[s,m]=i.useState(1),[g,a]=i.useState({show:!1}),[e,r]=i.useState({name:"SendPulse",type:"SendPulse",client_id:"",client_secret:"",field_map:[{formField:"",sendPulseField:""}],actions:{}}),x=h=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),h===3){if(!w(e)){a({show:!0,msg:"Please map all required fields to continue."});return}if(!(e!=null&&e.listId)){a({show:!0,msg:"Please select list to continue."});return}e.name!==""&&e.field_map.length>0&&m(3)}};return t.jsxs("div",{children:[t.jsx(b,{snack:g,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(_,{step:3,active:s})}),t.jsx(N,{formID:c,sendPulseConf:e,setSendPulseConf:r,step:s,setstep:m,isLoading:n,setIsLoading:o,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[t.jsx(y,{formID:c,formFields:l,sendPulseConf:e,setSendPulseConf:r,isLoading:n,setIsLoading:o,setSnackbar:a}),t.jsxs("button",{onClick:()=>x(3),disabled:!(e!=null&&e.listId)||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(k,{className:"ml-1 rev-icn"})]})]}),t.jsx(v,{step:s,saveConfig:()=>P(p,d,u,e,f,"","",o),isLoading:n,dataConf:e,setDataConf:r,formFields:l})]})}export{q as default};
