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