var j=Object.defineProperty;var p=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var f=(a,t,e)=>t in a?j(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,u=(a,t)=>{for(var e in t||(t={}))y.call(t,e)&&f(a,e,t[e]);if(p)for(var e of p(t))N.call(t,e)&&f(a,e,t[e]);return a};import{u as k,r,j as s}from"./main-333.js";import{_ as C,I as S,s as _,c as I}from"./bi.636.93.js";import{S as w}from"./bi.563.969.js";import F from"./bi.370.264.js";import{h as L,c as q}from"./bi.543.788.js";import{E as T}from"./bi.326.789.js";import"./bi.429.767.js";import"./bi.318.783.js";import"./bi.535.730.js";import"./bi.286.731.js";function Q({formFields:a,setFlow:t,flow:e,allIntegURL:E}){const g=k(),[c,l]=r.useState(!1),[n,d]=r.useState(1),[A,h]=r.useState({show:!1}),x=[{key:"Email",label:"Email",required:!0},{key:"FirstName",label:"FirstName",required:!1},{key:"LastName",label:"LastName",required:!1}],[i,o]=r.useState({name:"Elastic Email",type:"ElasticEmail",api_key:"",field_map:[{formField:"",elasticEmailField:""}],actions:{},elasticEmailFields:x}),b=()=>{l(!0),_({flow:e,setFlow:t,allIntegURL:E,conf:i,navigate:g,setIsLoading:l,setSnackbar:h})},v=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!q(i)){I.error("Please map mandatory fields");return}i.field_map.length>0&&d(m)};return s.jsxs("div",{children:[s.jsx("div",{className:"txt-center mt-2",children:s.jsx(w,{step:3,active:n})}),s.jsx(F,{elasticEmailConf:i,setElasticEmailConf:o,step:n,setstep:d,isLoading:c,setIsLoading:l}),s.jsxs("div",{className:"btcd-stp-page",style:u({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[s.jsx(T,{formFields:a,handleInput:m=>L(m,i,o),elasticEmailConf:i,setElasticEmailConf:o,isLoading:c,setIsLoading:l}),s.jsxs("button",{onClick:()=>v(3),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[C("Next","bit-integrations")," "," ",s.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),s.jsx(S,{step:n,saveConfig:()=>b(),isLoading:c,dataConf:i,setDataConf:o,formFields:a})]})}export{Q as default};
