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.9.0.js";import{u as S,b as m}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as I}from"./Steps.BYe8zHkm.js";import{I as _,s as w}from"./Integrations.DL8wqGct.js";import F from"./ElasticEmailAuthorization.W_aEh3_6.js";import{h as L,c as q}from"./ElasticEmailCommonFunc.CdVhlC2W.js";import{E as z}from"./ElasticEmailIntegLayout.Be6L1HkN.js";import"./react-vendor.P7K3d6op.js";import"./SnackMsg.DYSD96P4.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./BackIcn._8Wofmn2.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.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};
