import{REDOCLY_TEAMS_RBAC as o}from"@redocly/config";import{getTemplatePath as c}from"./get-template-path.js";import{getDevOnboardingRbacConfig as s}from"./utils.js";import{telemetryTraceStep as u}from"../../../cli/telemetry/helpers/trace-step.js";const d="apigee-";async function y({contentDir:g}){return{id:"Developer Onboarding",requiredEntitlements:["devOnboarding"],async processContent(e,{getConfig:n}){await u("build.plugin.dev_onboarding",async()=>{const t=await n();if(!t.developerOnboarding)return;const r=t.access?.rbac,a=e.createTemplate(d,c("./template/index.js"));e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,slug:"/apps/",fsPath:"",templateId:a,hasClientRoutes:!0,[o]:r?s(r):void 0,getNavText:()=>Promise.resolve("My Apps"),getStaticData:async()=>({props:{proxyUrl:"https://api.enterprise.apigee.com/v1/organizations/ORGNAME/apis",seo:{title:"My Apps"}}})})})},async afterRoutesCreated(e){const n=e.getConfig();if(!n.developerOnboarding)return;const t=n.access?.rbac,a=e.getGlobalData().userMenu||{},i={type:"link",link:"/apps/",label:"My Apps",[o]:t?s(t):void 0,labelTranslationKey:"userMenu.devOnboardingLabel"},p=a?.menu||[],l={...a,menu:[...p,i]};e.setGlobalData({userMenu:l})}}}export{y as apiKeyMgmtPlugin};
