import{j as t,_ as d}from"./main.2.8.10.js";import{u as C,e as L,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as S}from"./BackIcn.BFDZx8No.js";import{S as I}from"./SnackMsg.7BjcJK1j.js";import{I as k,g as v}from"./Integrations.BFhED4ck.js";import N from"./CreatorLmsAuthorization.p0K3pfvx.js";import{C as y,c as f}from"./CreatorLmsIntegLayout.DZLsCPwA.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 K({formFields:g,setFlow:u,flow:x,allIntegURL:b}){const h=C(),{formID:m}=L(),[a,i]=o.useState(!1),[s,c]=o.useState(1),[j,r]=o.useState({show:!1}),[e,p]=o.useState({name:"Creator LMS",type:"CreatorLms",field_map:[{formField:"",creatorLmsField:""}],actions:{},mainAction:""}),l=n=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),n===3){if(!f(e)){r({show:!0,msg:d("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&c(n)}else c(n)};return t.jsxs("div",{children:[t.jsx(I,{snack:j,setSnackbar:r}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(N,{formID:m,creatorLmsConf:e,setCreatorLmsConf:p,step:s,nextPage:l,isLoading:a,setIsLoading:i,setSnackbar:r}),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:m,formFields:g,creatorLmsConf:e,setCreatorLmsConf:p,setSnackbar:r,setIsLoading:i,isLoading:a}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>l(3),disabled:!f(e),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[d("Next","bit-integrations"),t.jsx(S,{className:"ml-1 rev-icn"})]})]}),t.jsx(k,{step:s,saveConfig:()=>v(x,u,b,e,h,"","",i),isLoading:a})]})}export{K as default};
