var y=Object.defineProperty;var f=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var u=(a,t,e)=>t in a?y(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,b=(a,t)=>{for(var e in t||(t={}))N.call(t,e)&&u(a,e,t[e]);if(f)for(var e of f(t))k.call(t,e)&&u(a,e,t[e]);return a};import{_ as o,j as i,z as C}from"./main.2.8.10.js";import{u as S,b as m}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as I}from"./Steps.B84Ui3GU.js";import{I as _,s as w}from"./Integrations.BFhED4ck.js";import F from"./ElasticEmailAuthorization.CMaSRzEZ.js";import{h as L,c as q}from"./ElasticEmailCommonFunc.CE20DUPG.js";import{E as z}from"./ElasticEmailIntegLayout.CO0UFtk1.js";import"./react-vendor.P7K3d6op.js";import"./SnackMsg.7BjcJK1j.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./BackIcn.BFDZx8No.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function $({formFields:a,setFlow:t,flow:e,allIntegURL:g}){const E=S(),[c,r]=m.useState(!1),[n,d]=m.useState(1),[T,h]=m.useState({show:!1}),x=[{key:"Email",label:o("Email","bit-integrations"),required:!0},{key:"FirstName",label:o("FirstName","bit-integrations"),required:!1},{key:"LastName",label:o("LastName","bit-integrations"),required:!1}],[s,l]=m.useState({name:"Elastic Email",type:"ElasticEmail",api_key:"",field_map:[{formField:"",elasticEmailField:""}],actions:{},elasticEmailFields:x}),v=()=>{r(!0),w({flow:e,setFlow:t,allIntegURL:g,conf:s,navigate:E,setIsLoading:r,setSnackbar:h})},j=p=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!q(s)){C.error(o("Please map mandatory fields","bit-integrations"));return}s.field_map.length>0&&d(p)};return i.jsxs("div",{children:[i.jsx("div",{className:"txt-center mt-2",children:i.jsx(I,{step:3,active:n})}),i.jsx(F,{elasticEmailConf:s,setElasticEmailConf:l,step:n,setstep:d,isLoading:c,setIsLoading:r}),i.jsxs("div",{className:"btcd-stp-page",style:b({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[i.jsx(z,{formFields:a,handleInput:p=>L(p,s,l),elasticEmailConf:s,setElasticEmailConf:l,isLoading:c,setIsLoading:r}),i.jsxs("button",{onClick:()=>j(3),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[o("Next","bit-integrations"),"  ",i.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),i.jsx(_,{step:n,saveConfig:()=>v(),isLoading:c,dataConf:s,setDataConf:l,formFields:a})]})}export{$ as default};
