import{j as t,_ as a}from"./main.2.8.10.js";import{u as j,e as v,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as I}from"./BackIcn.BFDZx8No.js";import{S as B}from"./SnackMsg.7BjcJK1j.js";import{S as y}from"./Steps.B84Ui3GU.js";import{I as k,g as C}from"./Integrations.BFhED4ck.js";import _ from"./SendinBlueAuthorization.Du2G_pVO.js";import{c as N}from"./SendinBlueCommonFunc.B6q5JU1k.js";import{S as w}from"./SendinBlueIntegLayout.D2PPjFCj.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function V({formFields:l,setFlow:u,flow:f,allIntegURL:g}){const b=j(),{formID:p}=v(),[r,o]=i.useState(!1),[s,c]=i.useState(1),[x,n]=i.useState({show:!1}),[S,d]=i.useState({templateId:"",RedirectionUrl:""}),[e,m]=i.useState({name:"Brevo(Sendinblue)",type:"Brevo(Sendinblue)",lists:[],api_key:"",field_map:[{formField:"",sendinBlueField:""}],actions:{}}),h=E=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(e.templateId===""||e.redirectionUrl===""){d({templateId:e.templateId?"":a("Template name can't be empty","bit-integrations"),redirectionUrl:e.redirectionUrl?"":a("Redirection url name can't be empty","bit-integrations")});return}if(!N(e)){n({show:!0,msg:a("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&c(3)}};return t.jsxs("div",{children:[t.jsx(B,{snack:x,setSnackbar:n}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(y,{step:3,active:s})}),t.jsx(_,{formID:p,sendinBlueConf:e,setSendinBlueConf:m,step:s,setstep:c,isLoading:r,setIsLoading:o,setSnackbar:n}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[t.jsx(w,{formID:p,formFields:l,sendinBlueConf:e,setSendinBlueConf:m,isLoading:r,setIsLoading:o,setSnackbar:n,error:S,setError:d}),t.jsxs("button",{onClick:()=>h(),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[a("Next","bit-integrations"),t.jsx(I,{className:"ml-1 rev-icn"})]})]}),t.jsx(k,{step:s,saveConfig:()=>C(f,u,g,e,b,"","",o),isLoading:r,dataConf:e,setDataConf:m,formFields:l})]})}export{V as default};
