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.9.0.js";import{u as N,e as _,b as n}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as C}from"./SnackMsg.DYSD96P4.js";import{S as E}from"./Steps.BYe8zHkm.js";import{I as F,s as L}from"./Integrations.DL8wqGct.js";import T from"./MailupAuthorization.wyGij0vP.js";import{s as z,h as P,c as h}from"./MailupCommonFunc.CvOSpi-8.js";import{M as A}from"./MailupIntegLayout.BoOmRpY6.js";import"./react-vendor.P7K3d6op.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 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};
