var M=Object.defineProperty;var u=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var f=(a,s,e)=>s in a?M(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e,g=(a,s)=>{for(var e in s||(s={}))k.call(s,e)&&f(a,e,s[e]);if(u)for(var e of u(s))w.call(s,e)&&f(a,e,s[e]);return a};import{j as i,_ as x,z as y}from"./main.2.8.10.js";import{u as N,e as _,b as n}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as C}from"./SnackMsg.7BjcJK1j.js";import{S as E}from"./Steps.B84Ui3GU.js";import{I as F,s as L}from"./Integrations.BFhED4ck.js";import T from"./MailupAuthorization.BgwnyczM.js";import{s as z,h as P,c as h}from"./MailupCommonFunc.CtCRKgy-.js";import{M as A}from"./MailupIntegLayout.DJjTHmY6.js";import"./react-vendor.P7K3d6op.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 st({formFields:a,setFlow:s,flow:e,allIntegURL:b}){const I=N(),{formID:j}=_(),[c,r]=n.useState(!1),[p,d]=n.useState(1),[v,o]=n.useState({show:!1}),[t,l]=n.useState({name:"Mailup",type:"Mailup",clientId:"",clientSecret:"",allList:[],allGroup:[],listId:"",groupId:"",field_map:[{formField:"",mailupFormField:""}],staticFields:[],actions:{}});n.useEffect(()=>{window.opener&&z("mailup")},[]);const S=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!h(t)){y.error(x("Please map mandatory fields","bit-integrations"));return}t.field_map.length>0&&d(m)};return i.jsxs("div",{children:[i.jsx(C,{snack:v,setSnackbar:o}),i.jsx("div",{className:"txt-center mt-2",children:i.jsx(E,{step:3,active:p})}),i.jsx(T,{formID:j,mailupConf:t,setMailupConf:l,step:p,setStep:d,isLoading:c,setIsLoading:r,setSnackbar:o}),i.jsxs("div",{className:"btcd-stp-page",style:g({},p===2&&{width:900,height:"auto",overflow:"visible"}),children:[i.jsx(A,{formFields:a,handleInput:m=>P(m,t,l,r,o),mailupConf:t,setMailupConf:l,isLoading:c,setIsLoading:r,setSnackbar:o}),t.listId&&i.jsxs("button",{onClick:()=>S(3),disabled:!(t!=null&&t.listId)||!h(t),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[x("Next","bit-integrations"),"  ",i.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.listId&&i.jsx(F,{step:p,saveConfig:()=>L({flow:e,setFlow:s,allIntegURL:b,navigate:I,conf:t,setIsLoading:r,setSnackbar:o}),isLoading:c,dataConf:t,setDataConf:l,formFields:a})]})}export{st as default};
