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 h,z as y}from"./main.2.8.1.js";import{u as N,h as _,d as n}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as C}from"./SnackMsg.S8DrwLlT.js";import{S as E}from"./Steps.1hz7v9Vj.js";import{I as F,s as L}from"./Integrations.D2bgBas2.js";import T from"./MailupAuthorization.mm06sR9Z.js";import{s as z,h as P,c as x}from"./MailupCommonFunc.BFSnhSMw.js";import{M as A}from"./MailupIntegLayout.Cjj3CBI-.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./BackIcn._kGL_vVw.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.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),!x(t)){y.error(h("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)||!x(t),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[h("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};
