import{j as e,_ as l}from"./main.2.8.10.js";import{u as h,e as b,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as j}from"./BackIcn.BFDZx8No.js";import{S as P}from"./SnackMsg.7BjcJK1j.js";import{I,g as k}from"./Integrations.BFhED4ck.js";import v from"./PeepSoAuthorization.CGjRdbV_.js";import{P as N,c as _}from"./PeepSoIntegLayout.DVKtBywB.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./ProUtilHelpers.CtRYkgop.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.Belqr4OT.js";function O({formFields:d,setFlow:f,flow:g,allIntegURL:u}){const x=h(),{formID:y}=b(),[i,r]=o.useState(!1),[s,p]=o.useState(1),[S,a]=o.useState({show:!1}),[t,m]=o.useState({name:"PeepSo",type:"PeepSo",field_map:[{formField:"",peepSoField:""}],actions:{},mainAction:""}),c=n=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),n===3){if(!_(t)){a({show:!0,msg:l("Please map all required fields to continue.","bit-integrations")});return}t.name!==""&&t.field_map.length>0&&p(n)}else p(n)};return e.jsxs("div",{children:[e.jsx(P,{snack:S,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2"}),e.jsx(v,{peepSoConf:t,setPeepSoConf:m,step:s,nextPage:c,isLoading:i,setIsLoading:r,setSnackbar:a}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"500px"},children:[e.jsx(N,{formFields:d,peepSoConf:t,setPeepSoConf:m,isLoading:i}),e.jsx("br",{}),e.jsx("br",{}),e.jsx("br",{}),e.jsxs("button",{onClick:()=>c(3),disabled:t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),e.jsx(j,{className:"ml-1 rev-icn"})]})]}),e.jsx(I,{step:s,saveConfig:()=>k(g,f,u,t,x,"","",r),isLoading:i})]})}export{O as default};
