import{v as I,a as v,w as y,r as i,j as t,S as b,_ as d}from"./main-40.js";/* empty css          */import{S as w}from"./bf-679-136.js";import{b as _}from"./bf-132-75.js";import{I as k}from"./bf-94-335.js";import{N}from"./bf-504-404.js";import P from"./bf-70-252.js";import{c as C}from"./bf-447-379.js";import{S as E}from"./bf-289-380.js";import"./bf-860-126.js";import"./bf-892-199.js";import"./bf-141-80.js";import"./bf-586-70.js";import"./bf-541-403.js";import"./bf-528-128.js";import"./bf-200-122.js";import"./bf-689-131.js";function V({formFields:c,setIntegration:u,integrations:f,allIntegURL:g}){const x=I();v();const{formID:n}=y(),[a,o]=i.useState(!1),[s,m]=i.useState(1),[S,r]=i.useState({show:!1}),[h,l]=i.useState({templateId:"",RedirectionUrl:""}),[e,p]=i.useState({name:"Brevo(SendinBlue) API",type:"Brevo(SendinBlue)",lists:[],api_key:"",field_map:[{formField:"",sendinBlueField:""}],actions:{}}),B=j=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),j===3){if(e.templateId===""||e.redirectionUrl===""){l({templateId:e.templateId?"":d("Template name cann't be empty"),redirectionUrl:e.redirectionUrl?"":d("Redirection url name cann't be empty")});return}if(!C(e)){r({show:!0,msg:"Please map all required fields to continue."});return}e.name!==""&&e.field_map.length>0&&m(3)}};return t.jsxs("div",{children:[t.jsx(b,{snack:S,setSnackbar:r}),t.jsx("div",{className:"txt-center w-9 mt-2 cal-width",children:t.jsx(w,{step:3,active:s})}),t.jsx(P,{formID:n,sendinBlueConf:e,setSendinBlueConf:p,step:s,setstep:m,isLoading:a,setisLoading:o,setSnackbar:r}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,minHeight:s===2&&"900px"},children:[t.jsx(E,{formID:n,formFields:c,sendinBlueConf:e,setSendinBlueConf:p,isLoading:a,setisLoading:o,setSnackbar:r,error:h,setError:l}),t.jsx(N,{nextPageHandler:()=>B(3),disabled:e.field_map.length<1})]}),t.jsx(k,{step:s,saveConfig:()=>_(f,u,g,e,x)})]})}export{V as default};
