import{j as t,_ as a}from"./main.2.9.0.js";import{u as j,e as v,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as I}from"./BackIcn._8Wofmn2.js";import{S as B}from"./SnackMsg.DYSD96P4.js";import{S as y}from"./Steps.BYe8zHkm.js";import{I as k,g as C}from"./Integrations.DL8wqGct.js";import _ from"./SendinBlueAuthorization.24dgffEI.js";import{c as N}from"./SendinBlueCommonFunc.EZGAW48O.js";import{S as w}from"./SendinBlueIntegLayout.D7uoleyI.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.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};
