import{j as t,_ as l}from"./main.2.9.0.js";import{u as b,e as j,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as D}from"./BackIcn._8Wofmn2.js";import{S as I}from"./SnackMsg.DYSD96P4.js";import{I as C,g as k}from"./Integrations.DL8wqGct.js";import _ from"./SureDashAuthorization.CBcn8P3T.js";import{S as v,c as y}from"./SureDashIntegLayout.zRhGHEFW.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.B6YI8w_n.js";function K({formFields:p,setFlow:f,flow:d,allIntegURL:g}){const h=b(),{formID:x}=j(),[o,r]=i.useState(!1),[s,c]=i.useState(1),[S,a]=i.useState({show:!1}),[e,n]=i.useState({name:"SureDash",type:"SureDash",field_map:[{formField:"",sureDashField:""}],mainAction:""}),u=m=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),m===3){if(!y(e)){a({show:!0,msg:l("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&c(m)}else c(m)};return t.jsxs("div",{children:[t.jsx(I,{snack:S,setSnackbar:a}),t.jsx(_,{sureDashConf:e,setSureDashConf:n,step:s,nextPage:u,isLoading:o,setIsLoading:r,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(v,{formID:x,formFields:p,sureDashConf:e,setSureDashConf:n,setSnackbar:a,setIsLoading:r,isLoading:o}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>u(3),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),t.jsx(D,{className:"ml-1 rev-icn"})]})]}),t.jsx(C,{step:s,saveConfig:()=>k(d,f,g,e,h,"","",r),isLoading:o,dataConf:e,setDataConf:n,formFields:p})]})}export{K as default};
