var y=Object.defineProperty;var v=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var j=(e,t,s)=>t in e?y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,S=(e,t)=>{for(var s in t||(t={}))N.call(t,s)&&j(e,s,t[s]);if(v)for(var s of v(t))w.call(t,s)&&j(e,s,t[s]);return e};import{j as o,_ as V,z as l}from"./main.2.8.10.js";import{u as F,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as z}from"./SnackMsg.7BjcJK1j.js";import{S as E}from"./Steps.B84Ui3GU.js";import{I as L,g as T}from"./Integrations.BFhED4ck.js";import M from"./VboutAuthorization.CvBRDeMi.js";import{h as P,c as A}from"./VboutCommonFunc.Bcusx1Hb.js";import{V as B}from"./VboutIntegLayout.CXOniNb3.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function et({formFields:e,setFlow:t,flow:s,allIntegURL:u}){const d=F(),[_,f]=i.useState(!1),[b,g]=i.useState({list:!1,field:!1,auth:!1}),[n,h]=i.useState(1),[C,p]=i.useState({show:!1}),[a,r]=i.useState({name:"Vbout",type:"Vbout",auth_token:"",field_map:[{formField:"",VboutFormField:""}],VboutFields:[],list_id:"",contact_status:"",actions:{}}),k=()=>{f(!0),T(s,t,u,a,d,"","",f).then(m=>{var x;m.success?(l.success((x=m.data)==null?void 0:x.msg),d(u)):l.error(m.data||m)})},I=c=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!A(a)){l.error(V("Please map mandatory fields","bit-integrations"));return}a.field_map.length>0&&h(c)};return o.jsxs("div",{children:[o.jsx(z,{snack:C,setSnackbar:p}),o.jsx("div",{className:"txt-center mt-2",children:o.jsx(E,{step:3,active:n})}),o.jsx(M,{vboutConf:a,setVboutConf:r,step:n,setstep:h,loading:b,setLoading:g,setSnackbar:p}),o.jsxs("div",{className:"btcd-stp-page",style:S({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(B,{formFields:e,handleInput:c=>P(c,a,r),vboutConf:a,setVboutConf:r,loading:b,setLoading:g,setSnackbar:p}),o.jsxs("button",{onClick:()=>I(3),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[V("Next","bit-integrations"),"  ",o.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),o.jsx(L,{step:n,saveConfig:()=>k(),isLoading:_,dataConf:a,setDataConf:r,formFields:e})]})}export{et as default};
