import{G as I,a as v,g as y,r as n,j as t,S as _,_ as p}from"./main-343.js";import"./bf-649-79.js";import{S as b}from"./bf-149-261.js";import{a7 as w}from"./bf-659-81.js";import{I as k}from"./bf-58-184.js";import{N}from"./bf-713-109.js";import P from"./bf-9-119.js";import{c as C}from"./bf-252-174.js";import{S as E}from"./bf-397-213.js";import"./bf-974-82.js";import"./bf-594-113.js";function G({formFields:c,setIntegration:u,integrations:f,allIntegURL:g}){const x=I();v();const{formID:i}=y(),[r,o]=n.useState(!1),[s,l]=n.useState(1),[S,a]=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)){a({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:a}),t.jsx("div",{className:"txt-center w-9 mt-2 cal-width",children:t.jsx(b,{step:3,active:s})}),t.jsx(P,{formID:i,sendinBlueConf:e,setSendinBlueConf:d,step:s,setstep:l,isLoading:r,setisLoading:o,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,minHeight:s===2&&"900px"},children:[t.jsx(E,{formID:i,formFields:c,sendinBlueConf:e,setSendinBlueConf:d,isLoading:r,setisLoading:o,setSnackbar:a,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};
