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.9.0.js";import{u as F,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as z}from"./SnackMsg.DYSD96P4.js";import{S as E}from"./Steps.BYe8zHkm.js";import{I as L,g as T}from"./Integrations.DL8wqGct.js";import M from"./VboutAuthorization.D3orsvAL.js";import{h as P,c as A}from"./VboutCommonFunc.3gmsaleD.js";import{V as B}from"./VboutIntegLayout._Y1snnr6.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.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};
