var I=Object.defineProperty;var v=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var j=(e,t,s)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,S=(e,t)=>{for(var s in t||(t={}))y.call(t,s)&&j(e,s,t[s]);if(v)for(var s of v(t))N.call(t,s)&&j(e,s,t[s]);return e};import{u as w,r as n,j as a}from"./main-406.js";import{d as F,_ as E,I as L,G as T,c as u}from"./bi.394.85.js";import{S as M}from"./bi.68.941.js";import P from"./bi.189.272.js";import{h as z,c as A}from"./bi.929.798.js";import{V as B}from"./bi.110.799.js";import"./bi.150.760.js";import"./bi.704.707.js";import"./bi.701.708.js";function X({formFields:e,setFlow:t,flow:s,allIntegURL:p}){const m=w(),[_,f]=n.useState(!1),[b,g]=n.useState({list:!1,field:!1,auth:!1}),[i,h]=n.useState(1),[V,l]=n.useState({show:!1}),[o,r]=n.useState({name:"Vbout",type:"Vbout",auth_token:"",field_map:[{formField:"",VboutFormField:""}],VboutFields:[],list_id:"",contact_status:"",actions:{}}),C=()=>{f(!0),T(s,t,p,o,m,"","",f).then(d=>{var x;d.success?(u.success((x=d.data)==null?void 0:x.msg),m(p)):u.error(d.data||d)})},k=c=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!A(o)){u.error("Please map mandatory fields");return}o.field_map.length>0&&h(c)};return a.jsxs("div",{children:[a.jsx(F,{snack:V,setSnackbar:l}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(M,{step:3,active:i})}),a.jsx(P,{vboutConf:o,setVboutConf:r,step:i,setstep:h,loading:b,setLoading:g,setSnackbar:l}),a.jsxs("div",{className:"btcd-stp-page",style:S({},i===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(B,{formFields:e,handleInput:c=>z(c,o,r),vboutConf:o,setVboutConf:r,loading:b,setLoading:g,setSnackbar:l}),a.jsxs("button",{onClick:()=>k(3),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[E("Next","bit-integrations")," "," ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(L,{step:i,saveConfig:()=>C(),isLoading:_,dataConf:o,setDataConf:r,formFields:e})]})}export{X as default};
