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