import{j as t,_ as a}from"./main.2.8.1.js";import{u as j,h as v,d as i}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{B as I}from"./BackIcn._kGL_vVw.js";import{S as B}from"./SnackMsg.S8DrwLlT.js";import{S as y}from"./Steps.1hz7v9Vj.js";import{I as k,g as C}from"./Integrations.D2bgBas2.js";import _ from"./SendinBlueAuthorization.DdUzjtSE.js";import{c as N}from"./SendinBlueCommonFunc.DKY2QbR0.js";import{S as w}from"./SendinBlueIntegLayout.B8tucTvT.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function V({formFields:l,setFlow:u,flow:f,allIntegURL:g}){const x=j(),{formID:p}=v(),[r,o]=i.useState(!1),[s,d]=i.useState(1),[S,n]=i.useState({show:!1}),[b,c]=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===""){c({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&&d(3)}};return t.jsxs("div",{children:[t.jsx(B,{snack:S,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:d,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:b,setError:c}),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,x,"","",o),isLoading:r,dataConf:e,setDataConf:m,formFields:l})]})}export{V as default};
