import{j as e,_ as c}from"./main.2.9.0.js";import{u as I,e as b,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as j}from"./BackIcn._8Wofmn2.js";import{S as v}from"./SnackMsg.DYSD96P4.js";import{S}from"./Steps.BYe8zHkm.js";import{I as D,g as _}from"./Integrations.DL8wqGct.js";import k from"./DirectIqAuthorization.Ionf7RMY.js";import{c as N}from"./DirectIqCommonFunc.D1AObw2G.js";import{D as q}from"./DirectIqIntegLayout.Doxy5Aee.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";function K({formFields:m,setFlow:d,flow:u,allIntegURL:f}){const g=I(),{formID:l}=b(),[o,r]=a.useState(!1),[s,p]=a.useState(1),[x,i]=a.useState({show:!1}),[t,n]=a.useState({name:"DirectIq",type:"DirectIq",client_id:"",client_secret:"",field_map:[{formField:"",directIqField:""}],actions:{}}),h=w=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300);{if(!N(t)){i({show:!0,msg:c("Please map all required fields to continue.","bit-integrations")});return}if(!(t!=null&&t.listId)){i({show:!0,msg:c("Please select list to continue.","bit-integrations")});return}t.name!==""&&t.field_map.length>0&&p(3)}};return e.jsxs("div",{children:[e.jsx(v,{snack:x,setSnackbar:i}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(S,{step:3,active:s})}),e.jsx(k,{formID:l,directIqConf:t,setDirectIqConf:n,step:s,setstep:p,isLoading:o,setIsLoading:r,setSnackbar:i}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(q,{formID:l,formFields:m,directIqConf:t,setDirectIqConf:n,isLoading:o,setIsLoading:r,setSnackbar:i}),e.jsxs("button",{onClick:()=>h(),disabled:!(t!=null&&t.listId)||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[c("Next","bit-integrations"),"  ",e.jsx(j,{className:"ml-1 rev-icn"})]})]}),e.jsx(D,{step:s,saveConfig:()=>_(u,d,f,t,g,"","",r),isLoading:o,dataConf:t,setDataConf:n,formFields:m})]})}export{K as default};
