import{j as e,_ as l}from"./main.2.8.10.js";import{u as b,e as j,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as v}from"./BackIcn.BFDZx8No.js";import{S as I}from"./SnackMsg.7BjcJK1j.js";import{S}from"./Steps.B84Ui3GU.js";import{I as _,g as k}from"./Integrations.BFhED4ck.js";import Z from"./ZagoMailAuthorization.Bh4N4bTc.js";import{c as y}from"./ZagoMailCommonFunc.ey3CW4KV.js";import{Z as M}from"./ZagoMailIntegLayout.tzMzoljF.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:m,setFlow:d,flow:g,allIntegURL:u}){const f=b(),{formID:c}=j(),[o,n]=i.useState(!1),[s,p]=i.useState(1),[x,a]=i.useState({show:!1}),[t,r]=i.useState({name:"ZagoMail",type:"ZagoMail",api_public_key:"",field_map:[{formField:"",zagoMailField:""}],selectedList:"",actions:{},selectedTags:[]}),h=N=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(!y(t)){a({show:!0,msg:l("Please map all required fields to continue.","bit-integrations")});return}if(!(t!=null&&t.listId)){a({show:!0,msg:l("Please select list to continue.","bit-integrations")});return}t.name!==""&&t.field_map.length>0&&p(3)}};return e.jsxs("div",{children:[e.jsx(I,{snack:x,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(S,{step:3,active:s})}),e.jsx(Z,{formID:c,zagoMailConf:t,setZagoMailConf:r,step:s,setstep:p,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(M,{formID:c,formFields:m,zagoMailConf:t,setZagoMailConf:r,isLoading:o,setIsLoading:n,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:[l("Next","bit-integrations"),"  ",e.jsx(v,{className:"ml-1 rev-icn"})]})]}),e.jsx(_,{step:s,saveConfig:()=>k(g,d,u,t,f,"","",n),isLoading:o,dataConf:t,setDataConf:r,formFields:m})]})}export{K as default};
