import{j as e,_ as m}from"./main.2.8.10.js";import{u as S,e as b,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as j}from"./BackIcn.BFDZx8No.js";import{S as v}from"./SnackMsg.7BjcJK1j.js";import{S as I}from"./Steps.B84Ui3GU.js";import{I as P,g as _}from"./Integrations.BFhED4ck.js";import k from"./SendPulseAuthorization.UaS6dL0q.js";import{c as N}from"./SendPulseCommonFunc.CT4Iq455.js";import{S as w}from"./SendPulseIntegLayout.B-T2DyRI.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";function K({formFields:l,setFlow:d,flow:u,allIntegURL:f}){const g=S(),{formID:c}=b(),[n,o]=i.useState(!1),[s,p]=i.useState(1),[x,a]=i.useState({show:!1}),[t,r]=i.useState({name:"SendPulse",type:"SendPulse",client_id:"",client_secret:"",field_map:[{formField:"",sendPulseField:""}],actions:{}}),h=y=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(!N(t)){a({show:!0,msg:m("Please map all required fields to continue.","bit-integrations")});return}if(!(t!=null&&t.listId)){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(v,{snack:x,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(I,{step:3,active:s})}),e.jsx(k,{formID:c,sendPulseConf:t,setSendPulseConf: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:c,formFields:l,sendPulseConf:t,setSendPulseConf:r,isLoading:n,setIsLoading:o,setSnackbar:a}),e.jsxs("button",{onClick:()=>h(),disabled:!(t!=null&&t.listId)||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(j,{className:"ml-1 rev-icn"})]})]}),e.jsx(P,{step:s,saveConfig:()=>_(u,d,f,t,g,"","",o),isLoading:n,dataConf:t,setDataConf:r,formFields:l})]})}export{K as default};
