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