import{D as I,a as v,g as y,r as n,j as t,S as _,_ as p}from"./main-634.js";import"./bf-25-81.js";import{S as b}from"./bf-54-258.js";import{a7 as w}from"./bf-746-82.js";import{I as k}from"./bf-942-184.js";import{N}from"./bf-123-109.js";import P from"./bf-844-120.js";import{c as C}from"./bf-34-174.js";import{S as E}from"./bf-5-213.js";import"./bf-275-83.js";import"./bf-822-108.js";import"./bf-438-114.js";function G({formFields:c,setIntegration:u,integrations:f,allIntegURL:g}){const x=I();v();const{formID:a}=y(),[r,o]=n.useState(!1),[s,l]=n.useState(1),[S,i]=n.useState({show:!1}),[h,m]=n.useState({templateId:"",RedirectionUrl:""}),[e,d]=n.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===""){m({templateId:e.templateId?"":p("Template name cann't be empty"),redirectionUrl:e.redirectionUrl?"":p("Redirection url name cann't be empty")});return}if(!C(e)){i({show:!0,msg:"Please map all required fields to continue."});return}e.name!==""&&e.field_map.length>0&&l(3)}};return t.jsxs("div",{children:[t.jsx(_,{snack:S,setSnackbar:i}),t.jsx("div",{className:"txt-center w-9 mt-2 cal-width",children:t.jsx(b,{step:3,active:s})}),t.jsx(P,{formID:a,sendinBlueConf:e,setSendinBlueConf:d,step:s,setstep:l,isLoading:r,setisLoading:o,setSnackbar:i}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,minHeight:s===2&&"900px"},children:[t.jsx(E,{formID:a,formFields:c,sendinBlueConf:e,setSendinBlueConf:d,isLoading:r,setisLoading:o,setSnackbar:i,error:h,setError:m}),t.jsx(N,{nextPageHandler:()=>B(3),disabled:e.field_map.length<1})]}),t.jsx(k,{step:s,saveConfig:()=>w(f,u,g,e,x)})]})}export{G as default};
