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