@techdocs/cli 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/embedded-app/.config-schema.json +46 -46
- package/dist/embedded-app/index.html +1 -1
- package/dist/embedded-app/index.html.tmpl +1 -1
- package/dist/embedded-app/static/3058.01cd3a56.chunk.js +10 -0
- package/dist/embedded-app/static/3058.01cd3a56.chunk.js.map +1 -0
- package/dist/embedded-app/static/8189.e15bea0f.chunk.js +2 -0
- package/dist/embedded-app/static/8189.e15bea0f.chunk.js.map +1 -0
- package/dist/embedded-app/static/{main.fb841862.js → main.2500b6af.js} +3 -3
- package/dist/embedded-app/static/{main.fb841862.js.map → main.2500b6af.js.map} +1 -1
- package/dist/embedded-app/static/main.d01493c7.css +2 -0
- package/dist/embedded-app/static/main.d01493c7.css.map +1 -0
- package/dist/embedded-app/static/{runtime.eb33ae54.js → runtime.6b26199d.js} +2 -2
- package/dist/embedded-app/static/{runtime.eb33ae54.js.map → runtime.6b26199d.js.map} +1 -1
- package/dist/package.json.cjs.js +1 -1
- package/package.json +1 -1
- package/dist/embedded-app/static/3058.ebf1e6e8.chunk.js +0 -10
- package/dist/embedded-app/static/3058.ebf1e6e8.chunk.js.map +0 -1
- package/dist/embedded-app/static/8189.458f183d.chunk.js +0 -2
- package/dist/embedded-app/static/8189.458f183d.chunk.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -358,52 +358,6 @@
|
|
|
358
358
|
},
|
|
359
359
|
"packageName": "@backstage/core-app-api"
|
|
360
360
|
},
|
|
361
|
-
{
|
|
362
|
-
"path": "../core-components/config.d.ts",
|
|
363
|
-
"value": {
|
|
364
|
-
"type": "object",
|
|
365
|
-
"properties": {
|
|
366
|
-
"auth": {
|
|
367
|
-
"type": "object",
|
|
368
|
-
"properties": {
|
|
369
|
-
"autologout": {
|
|
370
|
-
"description": "Autologout feature configuration",
|
|
371
|
-
"type": "object",
|
|
372
|
-
"properties": {
|
|
373
|
-
"enabled": {
|
|
374
|
-
"description": "Enable or disable the autologout feature",
|
|
375
|
-
"visibility": "frontend",
|
|
376
|
-
"type": "boolean"
|
|
377
|
-
},
|
|
378
|
-
"idleTimeoutMinutes": {
|
|
379
|
-
"description": "Number of minutes after which the inactive user is logged out automatically.\nDefault is 60 minutes (1 hour)",
|
|
380
|
-
"visibility": "frontend",
|
|
381
|
-
"type": "number"
|
|
382
|
-
},
|
|
383
|
-
"promptBeforeIdleSeconds": {
|
|
384
|
-
"description": "Number of seconds before the idle timeout where the user will be asked if it's still active.\nA dialog will be shown.\nDefault is 10 seconds.\nSet to 0 seconds to disable the prompt.",
|
|
385
|
-
"visibility": "frontend",
|
|
386
|
-
"type": "number"
|
|
387
|
-
},
|
|
388
|
-
"useWorkerTimers": {
|
|
389
|
-
"description": "Enable/disable the usage of worker thread timers instead of main thread timers.\nDefault is true.\nIf you experience some browser incompatibility, you may try to set this to false.",
|
|
390
|
-
"visibility": "frontend",
|
|
391
|
-
"type": "boolean"
|
|
392
|
-
},
|
|
393
|
-
"logoutIfDisconnected": {
|
|
394
|
-
"description": "Enable/disable the automatic logout also on users that are logged in but with no Backstage tabs open.\nDefault is true.",
|
|
395
|
-
"visibility": "frontend",
|
|
396
|
-
"type": "boolean"
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
404
|
-
},
|
|
405
|
-
"packageName": "@backstage/core-components"
|
|
406
|
-
},
|
|
407
361
|
{
|
|
408
362
|
"path": "../../plugins/techdocs/config.d.ts",
|
|
409
363
|
"value": {
|
|
@@ -465,6 +419,52 @@
|
|
|
465
419
|
},
|
|
466
420
|
"packageName": "@backstage/plugin-techdocs"
|
|
467
421
|
},
|
|
422
|
+
{
|
|
423
|
+
"path": "../core-components/config.d.ts",
|
|
424
|
+
"value": {
|
|
425
|
+
"type": "object",
|
|
426
|
+
"properties": {
|
|
427
|
+
"auth": {
|
|
428
|
+
"type": "object",
|
|
429
|
+
"properties": {
|
|
430
|
+
"autologout": {
|
|
431
|
+
"description": "Autologout feature configuration",
|
|
432
|
+
"type": "object",
|
|
433
|
+
"properties": {
|
|
434
|
+
"enabled": {
|
|
435
|
+
"description": "Enable or disable the autologout feature",
|
|
436
|
+
"visibility": "frontend",
|
|
437
|
+
"type": "boolean"
|
|
438
|
+
},
|
|
439
|
+
"idleTimeoutMinutes": {
|
|
440
|
+
"description": "Number of minutes after which the inactive user is logged out automatically.\nDefault is 60 minutes (1 hour)",
|
|
441
|
+
"visibility": "frontend",
|
|
442
|
+
"type": "number"
|
|
443
|
+
},
|
|
444
|
+
"promptBeforeIdleSeconds": {
|
|
445
|
+
"description": "Number of seconds before the idle timeout where the user will be asked if it's still active.\nA dialog will be shown.\nDefault is 10 seconds.\nSet to 0 seconds to disable the prompt.",
|
|
446
|
+
"visibility": "frontend",
|
|
447
|
+
"type": "number"
|
|
448
|
+
},
|
|
449
|
+
"useWorkerTimers": {
|
|
450
|
+
"description": "Enable/disable the usage of worker thread timers instead of main thread timers.\nDefault is true.\nIf you experience some browser incompatibility, you may try to set this to false.",
|
|
451
|
+
"visibility": "frontend",
|
|
452
|
+
"type": "boolean"
|
|
453
|
+
},
|
|
454
|
+
"logoutIfDisconnected": {
|
|
455
|
+
"description": "Enable/disable the automatic logout also on users that are logged in but with no Backstage tabs open.\nDefault is true.",
|
|
456
|
+
"visibility": "frontend",
|
|
457
|
+
"type": "boolean"
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
465
|
+
},
|
|
466
|
+
"packageName": "@backstage/core-components"
|
|
467
|
+
},
|
|
468
468
|
{
|
|
469
469
|
"path": "../integration/config.d.ts",
|
|
470
470
|
"value": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open source framework for building developer portals"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><meta name="backstage-app-mode" content="public"><script defer="defer" src="/static/runtime.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open source framework for building developer portals"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><meta name="backstage-app-mode" content="public"><script defer="defer" src="/static/runtime.6b26199d.js"></script><script defer="defer" src="/static/module-material-ui.a211988b.js"></script><script defer="defer" src="/static/module-lodash.011b7e00.js"></script><script defer="defer" src="/static/module-date-fns.0117079c.js"></script><script defer="defer" src="/static/module-mui.642fff5d.js"></script><script defer="defer" src="/static/module-material-table.5444b1ff.js"></script><script defer="defer" src="/static/module-zod.76c8aba2.js"></script><script defer="defer" src="/static/module-react-dom.e3032225.js"></script><script defer="defer" src="/static/module-i18next.93181ae4.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.4021175e.js"></script><script defer="defer" src="/static/module-remix-run.df99de31.js"></script><script defer="defer" src="/static/vendor.06d5fbda.js"></script><script defer="defer" src="/static/main.2500b6af.js"></script><link href="/static/main.d01493c7.css" rel="stylesheet"><script type="backstage.io/config">[
|
|
2
2
|
{
|
|
3
3
|
"context": "app-config.yaml",
|
|
4
4
|
"data": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
color="#5bbad5"
|
|
43
43
|
/>
|
|
44
44
|
<title><%= config.getString('app.title') %></title>
|
|
45
|
-
<meta name="backstage-app-mode" content="public"><meta name="backstage-public-path" content="<%= publicPath %>/"><script defer src="<%= publicPath %>/static/runtime.
|
|
45
|
+
<meta name="backstage-app-mode" content="public"><meta name="backstage-public-path" content="<%= publicPath %>/"><script defer src="<%= publicPath %>/static/runtime.6b26199d.js"></script><script defer src="<%= publicPath %>/static/module-material-ui.a211988b.js"></script><script defer src="<%= publicPath %>/static/module-lodash.011b7e00.js"></script><script defer src="<%= publicPath %>/static/module-date-fns.0117079c.js"></script><script defer src="<%= publicPath %>/static/module-mui.642fff5d.js"></script><script defer src="<%= publicPath %>/static/module-material-table.5444b1ff.js"></script><script defer src="<%= publicPath %>/static/module-zod.76c8aba2.js"></script><script defer src="<%= publicPath %>/static/module-react-dom.e3032225.js"></script><script defer src="<%= publicPath %>/static/module-i18next.93181ae4.js"></script><script defer src="<%= publicPath %>/static/module-react-beautiful-dnd.4021175e.js"></script><script defer src="<%= publicPath %>/static/module-remix-run.df99de31.js"></script><script defer src="<%= publicPath %>/static/vendor.06d5fbda.js"></script><script defer src="<%= publicPath %>/static/main.2500b6af.js"></script><link href="<%= publicPath %>/static/main.d01493c7.css" rel="stylesheet"></head>
|
|
46
46
|
<body>
|
|
47
47
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
48
48
|
<div id="root"></div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([["3058"],{23490:function(e,t,n){n.d(t,{O:()=>r});var a=n(73557);function r(e){return(0,a.UO)()}},5e4:function(e,t,n){n.d(t,{X2:()=>u,ce:()=>d,h$:()=>c});var a=n(52322),r=n(39381),o=n(60214),s=n(18011),i=n(88260);let l=(0,s.CT)("entity-context"),c=e=>{let{children:t,entity:n,loading:s,error:c,refresh:u}=e;return(0,a.jsx)(l.Provider,{value:(0,i.E)({1:{entity:n,loading:s,error:c,refresh:u}}),children:(0,a.jsx)(o.fC,{attributes:{...n?{entityRef:(0,r.eE)(n)}:void 0},children:t})})};function u(){let e=(0,s.Vt)("entity-context");if(!e)throw Error("Entity context is not available");let t=e.atVersion(1);if(!t)throw Error("EntityContext v1 not available");if(!t.entity)throw Error("useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.");return{entity:t.entity}}function d(){let e=(0,s.Vt)("entity-context");if(!e)throw Error("Entity context is not available");let t=e.atVersion(1);if(!t)throw Error("EntityContext v1 not available");let{entity:n,loading:a,error:r,refresh:o}=t;return{entity:n,loading:a,error:r,refresh:o}}},55195:function(e,t,n){n.r(t),n.d(t,{Router:()=>A,EmbeddedDocsRouter:()=>$,TechDocsReaderRouter:()=>M,LegacyEmbeddedDocsRouter:()=>I,isTechDocsAvailable:()=>Z});var a=n(52322),r=n(73557),o=n(39381),s=n(99503),i=n(25942),l=n(98248),c=n(46115),u=n(33741),d=n(2784),h=n(93048),p=n(51173);let m=e=>e.replace(/\/+$/,""),x=({entity:e,withSearch:t=!0})=>{let n=(0,o.iB)(e),r=function(e){let{kind:t,name:n,namespace:a}=e,r=(0,h.t)(p.Fw),o=(0,h.t)(p.pd);return(0,d.useMemo)(()=>{let e=m(r({kind:t,namespace:a,name:n})),s=m(o());return t=>{if(t.toLocaleLowerCase("en-US").startsWith(e.toLocaleLowerCase("en-US"))){let n=t.slice(e.length).replace(/^\/+/,"");return 0===n.length||n.startsWith("#")?`${s}${n}`:`${s}/${n}`}return t}},[r,o,t,n,a])}(n);if(e.metadata.annotations?.[s.Un])try{n=(0,o.of)(e.metadata.annotations?.[s.Un])}catch{}let x=(0,i.IG)(e);return(0,a.jsxs)(l.I6,{entityRef:n,children:[(0,a.jsx)(u.b,{}),(0,a.jsx)(c.F,{withSearch:t,searchResultUrlMapper:r,defaultPath:x})]})};var g=n(84377),f=n(40560),y=n(5e4),j=n(53244),v=n(77277),w=n(79692),b=n(90436),E=n(24780),C=n(12753),k=n(13039);let S=(0,w.Z)(e=>({code:{borderRadius:6,margin:e.spacing(2,0),background:"dark"===e.palette.type?"#444":e.palette.common.white}}),{name:"BackstageMissingAnnotationEmptyState"});function R(e){let t;try{t=(0,y.X2)().entity}catch(e){}let{annotation:n,readMoreUrl:r}=e,o=Array.isArray(n)?n:[n],s=S(),i=t?.kind||"Component",{yamlText:l,lineNumbers:c}=function(e,t){let n=t?.kind||"Component",a=t?.metadata.name||"example",r=t?.spec?.type||"website",o=t?.spec?.owner||"user:default/guest",s=`apiVersion: backstage.io/v1alpha1
|
|
2
|
+
kind: ${n}
|
|
3
|
+
metadata:
|
|
4
|
+
name: ${a}
|
|
5
|
+
annotations:${e.map(e=>`
|
|
6
|
+
${e}: value`).join("")}
|
|
7
|
+
spec:
|
|
8
|
+
type: ${r}
|
|
9
|
+
owner: ${o}`,i=6,l=[];return e.forEach(()=>{l.push(i),i++}),{yamlText:s,lineNumbers:l}}(o,t);return(0,a.jsx)(E.u,{missing:"field",title:"Missing Annotation",description:function(e,t="Component"){let n=e.length<=1;return(0,a.jsxs)(a.Fragment,{children:["The ",n?"annotation":"annotations"," ",e.map(e=>(0,a.jsx)("code",{children:e})).reduce((e,t)=>(0,a.jsxs)(a.Fragment,{children:[e,", ",t]}))," ",n?"is":"are"," missing. You need to add the"," ",n?"annotation":"annotations"," to your ",t," if you want to enable this tool."]})}(o,i),action:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(b.Z,{variant:"body1",children:["Add the annotation to your ",i," YAML as shown in the highlighted example below:"]}),(0,a.jsx)(j.Z,{className:s.code,children:(0,a.jsx)(C.O,{text:l,language:"yaml",showLineNumbers:!0,highlightedNumbers:c,customStyle:{background:"inherit",fontSize:"115%"}})}),(0,a.jsx)(v.Z,{color:"primary",component:k.rU,to:r||"https://backstage.io/docs/features/software-catalog/well-known-annotations",children:"Read more"})]})})}let Z=e=>!!e?.metadata?.annotations?.[s.w5]||!!e?.metadata?.annotations?.[s.Un],A=()=>(0,a.jsxs)(r.Z5,{children:[(0,a.jsx)(r.AW,{path:"/",element:(0,a.jsx)(g.TechDocsIndexPage,{})}),(0,a.jsx)(r.AW,{path:"/:namespace/:kind/:name/*",element:(0,a.jsx)(f.I,{})})]}),M=e=>{let{children:t}=e;return(0,r.V$)([{path:"*",element:(0,a.jsx)(f.I,{}),children:[{path:"*",element:t}]}])},$=e=>{let{children:t,emptyState:n,withSearch:o=!0}=e,{entity:i}=(0,y.X2)(),l=(0,r.V$)([{path:"/*",element:(0,a.jsx)(x,{entity:i,withSearch:o}),children:[{path:"*",element:t}]}]);return i.metadata.annotations?.[s.w5]||i.metadata.annotations?.[s.Un]?l:n??(0,a.jsx)(R,{annotation:[s.w5]})},I=({children:e,withSearch:t=!0})=>(0,a.jsx)($,{children:e,withSearch:t})},84377:function(e,t,n){n.r(t),n.d(t,{TechDocsIndexPage:()=>s});var a=n(52322),r=n(73557),o=n(74556);let s=e=>(0,r.pC)()||(0,a.jsx)(o.u,{...e})},40560:function(e,t,n){n.d(t,{r:()=>U,I:()=>D});var a=n(52322),r=n(2784),o=n(73557),s=n(64796),i=n(77344),l=n(98049),c=n(31546),u=n(46115),d=n(99064),h=n(33741),p=n(51173),m=n(23490),x=n(32904),g=n(33414),f=n(40098),y=n(77277),j=n(16162),v=n(42412),w=n(51943),b=n(6020),E=n(91246),C=n(26291);function k(e){let{children:t,...n}=e,{Progress:o}=(0,f.q)().getComponents(),s=function(e){let{pluginId:t}=e??{},n=(0,j.h_)(v.g),a=(0,j.h_)(w.N),o=(0,r.useMemo)(()=>"BroadcastChannel"in window?new BroadcastChannel(`${t}-auth-cookie-expires-at`):null,[t]),[s,i]=function(e,t){let[n,a]=(0,r.useState)({status:"not-executed",error:void 0,result:void 0}),o=(0,r.useRef)(),s=(0,r.useRef)(),i=(0,b.x)({execute(...t){s.current=t;let n=e(...t);return o.current=n,a(e=>({...e,status:"loading"})),n.then(e=>{n===o.current&&a(t=>({...t,status:"success",error:void 0,result:e}))},e=>{n===o.current&&a(t=>({...t,status:"error",error:e}))}),n},reset(){a({status:"not-executed",error:void 0,result:void 0}),o.current=void 0,s.current=void 0}});return[n,(0,r.useMemo)(()=>({reset(){i.current.reset()},execute:(...e)=>i.current.execute(...e)}),[]),{promise:o.current,lastArgs:s.current}]}(async()=>{let e=await a.getBaseUrl(t),r=`${e}/.backstage/auth/v1/cookie`,o=await n.fetch(`${r}`,{credentials:"include"});if(!o.ok){if(404===o.status)return{expiresAt:new Date(Date.now()+31536e6)};throw await C.V.fromResponse(o)}let s=await o.json();if(!s.expiresAt)throw Error("No expiration date found in response");return s});(0,E.n)(i.execute);let l=(0,r.useCallback)(()=>{i.execute()},[i]),c=(0,r.useCallback)(e=>{let t=(1+3*Math.random())*6e4,n=setTimeout(l,Date.parse(e.expiresAt)-Date.now()-t);return()=>clearTimeout(n)},[l]);return((0,r.useEffect)(()=>{if("success"!==s.status||!s.result)return()=>{};o?.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:s.result});let e=c(s.result),t=t=>{let{action:n,payload:a}=t.data;"COOKIE_REFRESH_SUCCESS"===n&&(e(),e=c(a))};return o?.addEventListener("message",t),()=>{e(),o?.removeEventListener("message",t)}},[s,c,o]),"not-executed"===s.status||"loading"===s.status&&!s.result||"loading"===s.status&&s.error)?{status:"loading"}:"error"===s.status&&s.error?{status:"error",error:s.error,retry:l}:{status:"success",data:s.result}}(n);return"loading"===s.status?(0,a.jsx)(o,{}):"error"===s.status?(0,a.jsx)(g.y,{error:s.error,children:(0,a.jsx)(y.Z,{variant:"outlined",onClick:s.retry,children:"Retry"})}):(0,a.jsx)(a.Fragment,{children:t})}var S=n(36363),R=n(60364),Z=n(84620),A=n(41547),M=n(4812),$=n(93048),I=n(84081),L=n(39381),F=n(25942),T=n(99503);let U=e=>{let{withSearch:t,withHeader:n=!0}=e;return(0,a.jsxs)(s.T,{themeId:"documentation",children:[n&&(0,a.jsx)(d.S,{}),(0,a.jsx)(h.b,{}),(0,a.jsx)(u.F,{withSearch:t})]})},_=(0,S.Z)(s.T)({height:"inherit",overflowY:"visible"}),D=e=>{let t=(0,R.Z)(),n=(0,r.useMemo)(()=>(0,Z.Z)({...t,...e.overrideThemeOptions||{}}),[t,e.overrideThemeOptions]),{kind:s,name:u,namespace:d}=(0,m.O)(p.Fw),{children:h,entityRef:g={kind:s,name:u,namespace:d}}=e,f=(0,o.pC)(),y=(0,r.useMemo)(()=>({kind:g.kind,name:g.name,namespace:g.namespace}),[g.kind,g.name,g.namespace]),{shouldShowProgress:v}=function(e){let t=(0,j.h_)(I.A),n=(0,o.s0)(),a=(0,$.t)(p.Fw),s=(0,L.eE)(e),i=(0,r.useRef)(null),l=i.current!==s,c=(0,M.Z)(async()=>{try{let n=await t.getEntityByRef(e);if(n?.metadata?.annotations?.[T.Un])return(0,F.Li)(n,a)}catch(e){}},[s,t]);(0,r.useEffect)(()=>{!c.loading&&c.value&&n(c.value,{replace:!0}),c.loading||c.value||(i.current=s)},[c.loading,c.value,n,s]);let u=l&&c.loading||!!c.value;return{loading:c.loading,shouldShowProgress:u}}(y),w=(0,r.useMemo)(()=>h?null:(f?r.Children.toArray(f.props.children):[]).flatMap(e=>e?.props?.children??[]).find(e=>!(0,x.I)(e,l.Zz)&&!(0,x.I)(e,l.jM)),[h,f]);return v?(0,a.jsx)(i.E,{}):h?(0,a.jsx)(A.Z,{theme:n,children:(0,a.jsx)(k,{pluginId:"techdocs",children:(0,a.jsx)(c.Z,{entityRef:y,children:({metadata:e,entityMetadata:t,onReady:n})=>(0,a.jsx)(_,{themeId:"documentation",className:"techdocs-reader-page",children:h instanceof Function?h({entityRef:y,techdocsMetadataValue:e.value,entityMetadataValue:t.value,onReady:n}):h})})})}):(0,a.jsx)(A.Z,{theme:n,children:(0,a.jsx)(k,{pluginId:"techdocs",children:(0,a.jsx)(c.Z,{entityRef:y,children:w||(0,a.jsx)(U,{})})})})}},33741:function(e,t,n){n.d(t,{b:()=>g});var a=n(52322),r=n(2784),o=n(79692),s=n(61837),i=n(15223),l=n(80030),c=n(48348),u=n(53244),d=n(47603),h=n(31546),p=n(98049),m=n(63424);let x=(0,o.Z)(e=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:e.spacing(3,3,0),"@media print":{display:"none"}}})),g=e=>{let t=x(),[n,o]=(0,r.useState)(null),g=(0,r.useCallback)(e=>{o(e.currentTarget)},[]),f=(0,r.useCallback)(()=>{o(null)},[]),{entityMetadata:{value:y,loading:j}}=(0,h.x)(),v=(0,p.$L)(),w=v.renderComponentsByLocation(m.o.Subheader),b=v.renderComponentsByLocation(m.o.Settings);return(w||b)&&(!1!==j||y)?(0,a.jsx)(i.Z,{classes:t,...e.toolbarProps,children:(0,a.jsxs)(u.Z,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[w,b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.ZP,{title:"Settings",children:(0,a.jsx)(s.Z,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:g,children:(0,a.jsx)(d.default,{})})}),(0,a.jsx)(c.Z,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:n,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!!n,onClose:f,keepMounted:!0,children:(0,a.jsx)("div",{children:b})})]}):null]})}):null}}}]);
|
|
10
|
+
//# sourceMappingURL=3058.01cd3a56.chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static/3058.01cd3a56.chunk.js","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntity.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/search/hooks/useTechDocsLocation.ts","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/EntityPageDocs.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/components/MissingAnnotationEmptyState/MissingAnnotationEmptyState.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/Router.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsIndexPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","webpack://techdocs-cli-embedded-app/../../node_modules/@react-hookz/web/src/useAsync/index.js","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/useExternalRedirect.ts","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { AnalyticsContext } from '@backstage/core-plugin-api';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport { ReactNode } from 'react';\n\n/** @public */\nexport type EntityLoadingStatus<TEntity extends Entity = Entity> = {\n entity?: TEntity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n};\n\n// This context has support for multiple concurrent versions of this package.\n// It is currently used in parallel with the old context in order to provide\n// a smooth transition, but will eventually be the only context we use.\nconst NewEntityContext = createVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n);\n\n/**\n * Properties for the AsyncEntityProvider component.\n *\n * @public\n */\nexport interface AsyncEntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n}\n\n/**\n * Provides a loaded entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const AsyncEntityProvider = (props: AsyncEntityProviderProps) => {\n const { children, entity, loading, error, refresh } = props;\n const value = { entity, loading, error, refresh };\n // We provide both the old and the new context, since\n // consumers might be doing things like `useContext(EntityContext)`\n return (\n <NewEntityContext.Provider value={createVersionedValueMap({ 1: value })}>\n <AnalyticsContext\n attributes={{\n ...(entity ? { entityRef: stringifyEntityRef(entity) } : undefined),\n }}\n >\n {children}\n </AnalyticsContext>\n </NewEntityContext.Provider>\n );\n};\n\n/**\n * Properties for the EntityProvider component.\n *\n * @public\n */\nexport interface EntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n}\n\n/**\n * Provides an entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const EntityProvider = (props: EntityProviderProps) => (\n <AsyncEntityProvider\n entity={props.entity}\n loading={!Boolean(props.entity)}\n error={undefined}\n refresh={undefined}\n children={props.children}\n />\n);\n\n/**\n * Grab the current entity from the context, throws if the entity has not yet been loaded\n * or is not available.\n *\n * @public\n */\nexport function useEntity<TEntity extends Entity = Entity>(): {\n entity: TEntity;\n} {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n if (!value.entity) {\n throw new Error(\n 'useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.',\n );\n }\n\n return { entity: value.entity as TEntity };\n}\n\n/**\n * Grab the current entity from the context, provides loading state and errors, and the ability to refresh.\n *\n * @public\n */\nexport function useAsyncEntity<\n TEntity extends Entity = Entity,\n>(): EntityLoadingStatus<TEntity> {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n const { entity, loading, error, refresh } = value;\n return { entity: entity as TEntity, loading, error, refresh };\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useMemo } from 'react';\n\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nimport { rootCatalogDocsRouteRef, rootDocsRouteRef } from '../../routes';\n\nconst trimStartSlash = (path: string) => path.replace(/^\\/+/, '');\nconst trimEndSlash = (path: string) => path.replace(/\\/+$/, '');\n\n/**\n * Returns a function that takes a location to a Tech Docs entry, and returns a\n * new location, re-routed to the catalog page tab.\n *\n * @internal\n */\nexport function useEntityPageTechDocsRedirect(entityRef: CompoundEntityRef) {\n const { kind, name, namespace } = entityRef;\n\n const routeDocsRoot = useRouteRef(rootDocsRouteRef);\n const routeDocsCatalog = useRouteRef(rootCatalogDocsRouteRef);\n\n // Re-routes a /docs/:namespace/:kind/:name/* location into\n // /catalog/:namespace/:kind/:name/docs/*, while handling situations where\n // these defaults are changed.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const reRouteLocationToCatalog = useMemo(() => {\n const rootDocsPath = trimEndSlash(routeDocsRoot({ kind, namespace, name }));\n const catalogDocsPath = trimEndSlash(routeDocsCatalog());\n\n return (url: string): string => {\n if (\n url\n .toLocaleLowerCase('en-US')\n .startsWith(rootDocsPath.toLocaleLowerCase('en-US'))\n ) {\n const suffix = trimStartSlash(url.slice(rootDocsPath.length));\n return suffix.length === 0 || suffix.startsWith('#')\n ? `${catalogDocsPath}${suffix}`\n : `${catalogDocsPath}/${suffix}`;\n }\n return url;\n };\n }, [routeDocsRoot, routeDocsCatalog, kind, name, namespace]);\n\n return reRouteLocationToCatalog;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\nimport { TECHDOCS_EXTERNAL_ANNOTATION } from '@backstage/plugin-techdocs-common';\nimport { getEntityRootTechDocsPath } from '@backstage/plugin-techdocs-react';\n\nimport { TechDocsReaderPage } from './plugin';\nimport { TechDocsReaderPageContent } from './reader/components/TechDocsReaderPageContent';\nimport { TechDocsReaderPageSubheader } from './reader/components/TechDocsReaderPageSubheader';\nimport { useEntityPageTechDocsRedirect } from './search/hooks/useTechDocsLocation';\n\ntype EntityPageDocsProps = {\n entity: Entity;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\nexport const EntityPageDocs = ({\n entity,\n withSearch = true,\n}: EntityPageDocsProps) => {\n let entityRef = getCompoundEntityRef(entity);\n\n const searchResultUrlMapper = useEntityPageTechDocsRedirect(entityRef);\n\n if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {\n try {\n entityRef = parseEntityRef(\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION],\n );\n } catch {\n // not a fan of this but we don't care if the parseEntityRef fails\n }\n }\n\n const defaultPath = getEntityRootTechDocsPath(entity);\n\n return (\n <TechDocsReaderPage entityRef={entityRef}>\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent\n withSearch={withSearch}\n searchResultUrlMapper={searchResultUrlMapper}\n defaultPath={defaultPath}\n />\n </TechDocsReaderPage>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { CodeSnippet, Link, EmptyState } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport { useEntity } from '../../hooks';\n\n/** @public */\nexport type MissingAnnotationEmptyStateClassKey = 'code';\n\nconst useStyles = makeStyles(\n theme => ({\n code: {\n borderRadius: 6,\n margin: theme.spacing(2, 0),\n background:\n theme.palette.type === 'dark' ? '#444' : theme.palette.common.white,\n },\n }),\n { name: 'BackstageMissingAnnotationEmptyState' },\n);\n\nfunction generateYamlExample(\n annotations: string[],\n entity?: Entity,\n): { yamlText: string; lineNumbers: number[] } {\n const kind = entity?.kind || 'Component';\n const name = entity?.metadata.name || 'example';\n const type = entity?.spec?.type || 'website';\n const owner = entity?.spec?.owner || 'user:default/guest';\n\n const yamlText = `apiVersion: backstage.io/v1alpha1\nkind: ${kind}\nmetadata:\n name: ${name}\n annotations:${annotations.map(ann => `\\n ${ann}: value`).join('')}\nspec:\n type: ${type}\n owner: ${owner}`;\n\n let line = 6; // Line 6 is the line number that annotations are added to.\n const lineNumbers: number[] = [];\n annotations.forEach(() => {\n lineNumbers.push(line);\n line++;\n });\n\n return {\n yamlText,\n lineNumbers,\n };\n}\n\nfunction generateDescription(annotations: string[], entityKind = 'Component') {\n const isSingular = annotations.length <= 1;\n return (\n <>\n The {isSingular ? 'annotation' : 'annotations'}{' '}\n {annotations\n .map(ann => <code>{ann}</code>)\n .reduce((prev, curr) => (\n <>\n {prev}, {curr}\n </>\n ))}{' '}\n {isSingular ? 'is' : 'are'} missing. You need to add the{' '}\n {isSingular ? 'annotation' : 'annotations'} to your {entityKind} if you\n want to enable this tool.\n </>\n );\n}\n\n/**\n * @public\n * Renders an empty state when an annotation is missing from an entity.\n */\nexport function MissingAnnotationEmptyState(props: {\n annotation: string | string[];\n readMoreUrl?: string;\n}) {\n let entity: Entity | undefined;\n try {\n const entityContext = useEntity();\n entity = entityContext.entity;\n } catch (err) {\n // ignore when entity context doesnt exist\n }\n\n const { annotation, readMoreUrl } = props;\n const annotations = Array.isArray(annotation) ? annotation : [annotation];\n const url =\n readMoreUrl ||\n 'https://backstage.io/docs/features/software-catalog/well-known-annotations';\n const classes = useStyles();\n\n const entityKind = entity?.kind || 'Component';\n const { yamlText, lineNumbers } = generateYamlExample(annotations, entity);\n return (\n <EmptyState\n missing=\"field\"\n title=\"Missing Annotation\"\n description={generateDescription(annotations, entityKind)}\n action={\n <>\n <Typography variant=\"body1\">\n Add the annotation to your {entityKind} YAML as shown in the\n highlighted example below:\n </Typography>\n <Box className={classes.code}>\n <CodeSnippet\n text={yamlText}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={lineNumbers}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </Box>\n <Button color=\"primary\" component={Link} to={url}>\n Read more\n </Button>\n </>\n }\n />\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactElement, PropsWithChildren } from 'react';\nimport { Route, Routes, useRoutes } from 'react-router-dom';\n\nimport { Entity } from '@backstage/catalog-model';\nimport { EntityPageDocs } from './EntityPageDocs';\nimport { TechDocsIndexPage } from './home/components/TechDocsIndexPage';\nimport { TechDocsReaderPage } from './reader/components/TechDocsReaderPage';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport {\n TECHDOCS_ANNOTATION,\n TECHDOCS_EXTERNAL_ANNOTATION,\n} from '@backstage/plugin-techdocs-common';\n\n/**\n * Helper that takes in entity and returns true/false if TechDocs is available for the entity\n *\n * @public\n */\nexport const isTechDocsAvailable = (entity: Entity) =>\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_ANNOTATION]) ||\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]);\n\n/**\n * Responsible for registering routes for TechDocs, TechDocs Homepage and separate TechDocs page\n *\n * @public\n */\nexport const Router = () => {\n return (\n <Routes>\n <Route path=\"/\" element={<TechDocsIndexPage />} />\n <Route\n path=\"/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n />\n </Routes>\n );\n};\n\nexport const TechDocsReaderRouter = (props: PropsWithChildren) => {\n const { children } = props;\n\n // Using objects instead of <Route> elements, otherwise \"outlet\" will be null on sub-pages and add-ons won't render\n const element = useRoutes([\n {\n path: '*',\n element: <TechDocsReaderPage />,\n children: [\n {\n path: '*',\n element: children,\n },\n ],\n },\n ]);\n\n return element;\n};\n\nexport const EmbeddedDocsRouter = (\n props: PropsWithChildren<{\n emptyState?: ReactElement;\n withSearch?: boolean;\n }>,\n) => {\n const { children, emptyState, withSearch = true } = props;\n const { entity } = useEntity();\n\n // Using objects instead of <Route> elements, otherwise \"outlet\" will be null on sub-pages and add-ons won't render\n const element = useRoutes([\n {\n path: '/*',\n element: <EntityPageDocs entity={entity} withSearch={withSearch} />,\n children: [\n {\n path: '*',\n element: children,\n },\n ],\n },\n ]);\n\n const projectId =\n entity.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION];\n\n if (!projectId) {\n return (\n emptyState ?? (\n <MissingAnnotationEmptyState annotation={[TECHDOCS_ANNOTATION]} />\n )\n );\n }\n return element;\n};\n\n/**\n * Responsible for registering route to view docs on Entity page\n *\n * @public\n */\nexport const LegacyEmbeddedDocsRouter = ({\n children,\n withSearch = true,\n}: PropsWithChildren<{ withSearch?: boolean }>) => {\n // Wrap the Router to avoid exposing the emptyState prop in the non-alpha\n // public API and make it easier for us to change later.\n return <EmbeddedDocsRouter children={children} withSearch={withSearch} />;\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FC } from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport {\n TableColumn,\n TableProps,\n TableOptions,\n} from '@backstage/core-components';\nimport {\n EntityListPagination,\n EntityOwnerPickerProps,\n UserListFilterKind,\n} from '@backstage/plugin-catalog-react';\nimport { DefaultTechDocsHome } from './DefaultTechDocsHome';\nimport { DocsTableRow } from './Tables';\n\n/**\n * Props for {@link TechDocsIndexPage}\n *\n * @public\n */\nexport type TechDocsIndexPageProps = {\n initialFilter?: UserListFilterKind;\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n pagination?: EntityListPagination;\n options?: TableOptions<DocsTableRow>;\n PageWrapper?: FC;\n CustomHeader?: FC;\n};\n\nexport const TechDocsIndexPage = (props: TechDocsIndexPageProps) => {\n const outlet = useOutlet();\n\n return outlet || <DefaultTechDocsHome {...props} />;\n};\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport { ErrorPanel } from '@backstage/core-components';\nimport { useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport { useCookieAuthRefresh } from '../../hooks';\n\n/**\n * @public\n * Props for the {@link CookieAuthRefreshProvider} component.\n */\nexport type CookieAuthRefreshProviderProps = {\n // The plugin ID used for discovering the API origin\n pluginId: string;\n // The children to render when the refresh is successful\n children: ReactNode;\n};\n\n/**\n * @public\n * A provider that will refresh the cookie when it is about to expire.\n */\nexport function CookieAuthRefreshProvider(\n props: CookieAuthRefreshProviderProps,\n): JSX.Element {\n const { children, ...options } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n\n const result = useCookieAuthRefresh(options);\n\n if (result.status === 'loading') {\n return <Progress />;\n }\n\n if (result.status === 'error') {\n return (\n <ErrorPanel error={result.error}>\n <Button variant=\"outlined\" onClick={result.retry}>\n Retry\n </Button>\n </ErrorPanel>\n );\n }\n\n return <>{children}</>;\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useCallback, useMemo } from 'react';\nimport {\n discoveryApiRef,\n fetchApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsync, useMountEffect } from '@react-hookz/web';\nimport { ResponseError } from '@backstage/errors';\n\nconst COOKIE_PATH = '/.backstage/auth/v1/cookie';\nconst ONE_YEAR_MS = 365 * 24 * 3600_000;\n\n/**\n * @public\n * A hook that will refresh the cookie when it is about to expire.\n * @param options - Options for configuring the refresh cookie endpoint\n */\nexport function useCookieAuthRefresh(options: {\n // The plugin id used for discovering the API origin\n pluginId: string;\n}):\n | { status: 'loading' }\n | { status: 'error'; error: Error; retry: () => void }\n | { status: 'success'; data: { expiresAt: string } } {\n const { pluginId } = options ?? {};\n const fetchApi = useApi(fetchApiRef);\n const discoveryApi = useApi(discoveryApiRef);\n\n const channel = useMemo(() => {\n return 'BroadcastChannel' in window\n ? new BroadcastChannel(`${pluginId}-auth-cookie-expires-at`)\n : null;\n }, [pluginId]);\n\n const [state, actions] = useAsync<{ expiresAt: string }>(async () => {\n const apiOrigin = await discoveryApi.getBaseUrl(pluginId);\n const requestUrl = `${apiOrigin}${COOKIE_PATH}`;\n const response = await fetchApi.fetch(`${requestUrl}`, {\n credentials: 'include',\n });\n if (!response.ok) {\n // If we get a 404 from the cookie endpoint we assume that it does not\n // exist and cookie auth is not needed. For all active tabs we don't\n // schedule another refresh for the foreseeable future, but new tabs will\n // still check if cookie auth has been added to the deployment.\n // TODO(Rugvip): Once the legacy backend system is no longer supported we should remove this check\n if (response.status === 404) {\n return { expiresAt: new Date(Date.now() + ONE_YEAR_MS) };\n }\n throw await ResponseError.fromResponse(response);\n }\n const data = await response.json();\n if (!data.expiresAt) {\n throw new Error('No expiration date found in response');\n }\n return data;\n });\n\n useMountEffect(actions.execute);\n\n const retry = useCallback(() => {\n actions.execute();\n }, [actions]);\n\n const refresh = useCallback(\n (params: { expiresAt: string }) => {\n // Randomize the refreshing margin with a margin of 1-4 minutes to avoid all tabs refreshing at the same time\n // It cannot be less than 5 minutes otherwise the backend will return the same expiration date\n const margin = (1 + 3 * Math.random()) * 60000;\n const delay = Date.parse(params.expiresAt) - Date.now() - margin;\n const timeout = setTimeout(retry, delay);\n return () => clearTimeout(timeout);\n },\n [retry],\n );\n\n useEffect(() => {\n // Only schedule a refresh if we have a successful response\n if (state.status !== 'success' || !state.result) {\n return () => {};\n }\n channel?.postMessage({\n action: 'COOKIE_REFRESH_SUCCESS',\n payload: state.result,\n });\n let cancel = refresh(state.result);\n const listener = (\n event: MessageEvent<{ action: string; payload: { expiresAt: string } }>,\n ) => {\n const { action, payload } = event.data;\n if (action === 'COOKIE_REFRESH_SUCCESS') {\n cancel();\n cancel = refresh(payload);\n }\n };\n channel?.addEventListener('message', listener);\n return () => {\n cancel();\n channel?.removeEventListener('message', listener);\n };\n }, [state, refresh, channel]);\n\n // Initialising\n if (state.status === 'not-executed') {\n return { status: 'loading' };\n }\n\n // First refresh or retrying without any success before\n // Possible state transitions:\n // e.g. not-executed -> loading (first-refresh)\n // e.g. not-executed -> loading (first-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && !state.result) {\n return { status: 'loading' };\n }\n\n // Retrying after having succeeding at least once\n // Current state is: { status: 'loading', result: {...}, error: undefined | Error }\n // e.g. not-executed -> loading (first-refresh) -> success -> loading (scheduled-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && state.error) {\n return { status: 'loading' };\n }\n\n // Something went wrong during any situation of a refresh\n if (state.status === 'error' && state.error) {\n return { status: 'error', error: state.error, retry };\n }\n\n // At this point it should be safe to assume that we have a successful refresh\n return { status: 'success', data: state.result! };\n}\n","import { useMemo, useRef, useState } from 'react';\nimport { useSyncedRef } from '../useSyncedRef/index.js';\nexport function useAsync(asyncFn, initialValue) {\n const [state, setState] = useState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n const promiseRef = useRef();\n const argsRef = useRef();\n const methods = useSyncedRef({\n execute(...params) {\n argsRef.current = params;\n const promise = asyncFn(...params);\n promiseRef.current = promise;\n setState((s) => ({ ...s, status: 'loading' }));\n promise.then((result) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'success', error: undefined, result }));\n }\n }, (error) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'error', error }));\n }\n });\n return promise;\n },\n reset() {\n setState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n promiseRef.current = undefined;\n argsRef.current = undefined;\n },\n });\n return [\n state,\n useMemo(() => ({\n reset() {\n methods.current.reset();\n },\n execute: (...params) => methods.current.execute(...params),\n }), []),\n { promise: promiseRef.current, lastArgs: argsRef.current },\n ];\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Children, ReactElement, ReactNode, useMemo } from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport { Page, Progress } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_KEY,\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\nimport {\n createTheme,\n styled,\n ThemeOptions,\n ThemeProvider,\n useTheme,\n} from '@material-ui/core/styles';\nimport { useExternalRedirect } from './useExternalRedirect';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n overrideThemeOptions?: Partial<ThemeOptions>;\n};\n\n/**\n * Styled Backstage Page that fills available vertical space\n */\nconst StyledPage = styled(Page)({\n height: 'inherit',\n overflowY: 'visible',\n});\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const currentTheme = useTheme();\n\n const readerPageTheme = useMemo(\n () =>\n createTheme({\n ...currentTheme,\n ...(props.overrideThemeOptions || {}),\n }),\n [currentTheme, props.overrideThemeOptions],\n );\n\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n const memoizedEntityRef = useMemo(\n () => ({\n kind: entityRef.kind,\n name: entityRef.name,\n namespace: entityRef.namespace,\n }),\n [entityRef.kind, entityRef.name, entityRef.namespace],\n );\n\n // Check for external TechDocs redirects and handle navigation\n const { shouldShowProgress } = useExternalRedirect(memoizedEntityRef);\n\n const page: ReactNode = useMemo(() => {\n if (children) {\n return null;\n }\n\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n return grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n }, [children, outlet]);\n\n // Show full-page loading spinner when checking for external redirects or about to redirect.\n // This replaces the entire page content (header, sidebar, and documentation).\n if (shouldShowProgress) {\n return <Progress />;\n }\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n if (!children) {\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={memoizedEntityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n }\n\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={memoizedEntityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <StyledPage\n themeId=\"documentation\"\n className=\"techdocs-reader-page\"\n >\n {children instanceof Function\n ? children({\n entityRef: memoizedEntityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </StyledPage>\n )}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n};\n","/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useRef } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport {\n CompoundEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { buildTechDocsURL } from '@backstage/plugin-techdocs-react';\nimport { TECHDOCS_EXTERNAL_ANNOTATION } from '@backstage/plugin-techdocs-common';\nimport { rootDocsRouteRef } from '../../../routes';\n\n/**\n * Hook to handle external TechDocs redirects based on entity annotations.\n * Checks if an entity has the `backstage.io/techdocs-entity` annotation and\n * redirects to the external TechDocs URL if present.\n *\n * @param entityRef - The entity reference to check for external redirects\n * @returns Object containing loading state and whether a redirect is in progress\n *\n * @internal\n */\nexport function useExternalRedirect(entityRef: CompoundEntityRef): {\n loading: boolean;\n shouldShowProgress: boolean;\n} {\n const catalogApi = useApi(catalogApiRef);\n const navigate = useNavigate();\n const viewTechdocLink = useRouteRef(rootDocsRouteRef);\n\n // Create a stable string key for the entity to use as a dependency.\n // This ensures the useAsync hook only re-runs when the entity changes,\n // preventing redundant API calls during sub-page navigation within the same entity's documentation.\n const entityKey = stringifyEntityRef(entityRef);\n // Track which entity we've already checked to avoid redundant checks\n // when navigating between pages within the same entity's documentation.\n const checkedEntityRef = useRef<string | null>(null);\n const shouldCheckForRedirect = checkedEntityRef.current !== entityKey;\n\n // Check if this entity should redirect to external TechDocs\n const externalRedirectResult = useAsync(async () => {\n try {\n const catalogEntity = await catalogApi.getEntityByRef(entityRef);\n\n if (\n catalogEntity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]\n ) {\n return buildTechDocsURL(catalogEntity, viewTechdocLink);\n }\n } catch (error) {\n // Ignore errors and allow the current entity's TechDocs to load.\n // This handles cases where the catalog API is unavailable or the entity doesn't exist.\n }\n\n return undefined;\n }, [entityKey, catalogApi]);\n\n useEffect(() => {\n // Navigate to external TechDocs if a redirect URL is available\n if (!externalRedirectResult.loading && externalRedirectResult.value) {\n navigate(externalRedirectResult.value, { replace: true });\n }\n\n // Mark entity as checked once we've determined there's no redirect needed.\n // This prevents the entire page from unmounting/remounting (showing Progress spinner)\n // on subsequent sub-page navigation within the same entity.\n if (!externalRedirectResult.loading && !externalRedirectResult.value) {\n checkedEntityRef.current = entityKey;\n }\n }, [\n externalRedirectResult.loading,\n externalRedirectResult.value,\n navigate,\n entityKey,\n ]);\n\n // Determine if we should show a loading indicator (which replaces the entire page with a Progress spinner).\n // Only show it when: 1) checking a new/unchecked entity, or 2) we have a redirect URL and are navigating.\n const shouldShowProgress =\n (shouldCheckForRedirect && externalRedirectResult.loading) ||\n !!externalRedirectResult.value;\n\n return {\n loading: externalRedirectResult.loading,\n shouldShowProgress,\n };\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MouseEvent, useState, useCallback } from 'react';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { ToolbarProps } from '@material-ui/core/Toolbar';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Menu from '@material-ui/core/Menu';\nimport Box from '@material-ui/core/Box';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport {\n TechDocsAddonLocations as locations,\n useTechDocsAddons,\n useTechDocsReaderPage,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageSubheader',\n flexDirection: 'column',\n minHeight: 'auto',\n padding: theme.spacing(3, 3, 0),\n '@media print': {\n display: 'none',\n },\n },\n}));\n\n/**\n * Renders the reader page subheader.\n * Please use the Tech Docs add-ons to customize it\n * @public\n */\nexport const TechDocsReaderPageSubheader = (props: {\n toolbarProps?: ToolbarProps;\n}) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const handleClose = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const {\n entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },\n } = useTechDocsReaderPage();\n\n const addons = useTechDocsAddons();\n\n const subheaderAddons = addons.renderComponentsByLocation(\n locations.Subheader,\n );\n\n const settingsAddons = addons.renderComponentsByLocation(locations.Settings);\n\n if (!subheaderAddons && !settingsAddons) return null;\n\n // No entity metadata = 404. Don't render subheader on 404.\n if (entityMetadataLoading === false && !entityMetadata) return null;\n\n return (\n <Toolbar classes={classes} {...props.toolbarProps}>\n <Box\n display=\"flex\"\n justifyContent=\"flex-end\"\n width=\"100%\"\n flexWrap=\"wrap\"\n >\n {subheaderAddons}\n {settingsAddons ? (\n <>\n <Tooltip title=\"Settings\">\n <IconButton\n aria-controls=\"tech-docs-reader-page-settings\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n >\n <SettingsIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"tech-docs-reader-page-settings\"\n getContentAnchorEl={null}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n open={Boolean(anchorEl)}\n onClose={handleClose}\n keepMounted\n >\n <div>{settingsAddons}</div>\n </Menu>\n </>\n ) : null}\n </Box>\n </Toolbar>\n );\n};\n"],"names":["useRouteRefParams","_routeRef","useParams","NewEntityContext","createVersionedContext","AsyncEntityProvider","props","children","entity","loading","error","refresh","createVersionedValueMap","AnalyticsContext","stringifyEntityRef","undefined","useEntity","versionedHolder","useVersionedContext","Error","value","useAsyncEntity","trimEndSlash","path","EntityPageDocs","withSearch","entityRef","getCompoundEntityRef","searchResultUrlMapper","useEntityPageTechDocsRedirect","kind","name","namespace","routeDocsRoot","useRouteRef","rootDocsRouteRef","routeDocsCatalog","rootCatalogDocsRouteRef","useMemo","rootDocsPath","catalogDocsPath","url","suffix","TECHDOCS_EXTERNAL_ANNOTATION","parseEntityRef","defaultPath","getEntityRootTechDocsPath","TechDocsReaderPage","TechDocsReaderPageSubheader","TechDocsReaderPageContent","useStyles","makeStyles","theme","MissingAnnotationEmptyState","entityContext","err","annotation","readMoreUrl","annotations","Array","classes","entityKind","yamlText","lineNumbers","generateYamlExample","type","owner","ann","line","EmptyState","generateDescription","isSingular","prev","curr","Typography","Box","CodeSnippet","Button","Link","isTechDocsAvailable","Boolean","TECHDOCS_ANNOTATION","Router","Routes","Route","TechDocsIndexPage","TechDocsReaderRouter","useRoutes","EmbeddedDocsRouter","emptyState","element","LegacyEmbeddedDocsRouter","outlet","useOutlet","DefaultTechDocsHome","CookieAuthRefreshProvider","options","Progress","app","useApp","result","useCookieAuthRefresh","pluginId","fetchApi","useApi","fetchApiRef","discoveryApi","discoveryApiRef","channel","window","BroadcastChannel","state","actions","useAsync","e","apiOrigin","requestUrl","response","Date","ResponseError","data","useMountEffect","retry","useCallback","params","margin","Math","timeout","setTimeout","clearTimeout","useEffect","cancel","listener","event","action","payload","ErrorPanel","TechDocsReaderLayout","withHeader","Page","TechDocsReaderPageHeader","StyledPage","styled","currentTheme","useTheme","readerPageTheme","createTheme","memoizedEntityRef","shouldShowProgress","useExternalRedirect","catalogApi","catalogApiRef","navigate","useNavigate","viewTechdocLink","entityKey","checkedEntityRef","useRef","shouldCheckForRedirect","externalRedirectResult","catalogEntity","buildTechDocsURL","page","grandChildren","childrenList","Children","child","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","ThemeProvider","TechDocsReaderPageProvider","metadata","entityMetadata","onReady","Function","anchorEl","setAnchorEl","useState","handleClick","handleClose","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","locations","settingsAddons","Toolbar","Tooltip","IconButton","SettingsIcon","Menu"],"mappings":"+KAwBO,SAASA,EACdC,CAAiD,EAEjD,MAAOC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,GACT,C,qHCOA,IAAMC,EAAmBC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EACvB,kBAqBWC,EAAsB,AAACC,IAClC,GAAM,CAAEC,SAAAA,CAAQ,CAAEC,OAAAA,CAAM,CAAEC,QAAAA,CAAO,CAAEC,MAAAA,CAAK,CAAEC,QAAAA,CAAO,CAAE,CAAGL,EAItD,MACE,UAACH,EAAiB,QAAQ,EAAC,MAAOS,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,EAAwB,CAAE,EAJhD,CAAEJ,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,CAIuB,G,SACnE,UAACE,EAAAA,EAAgBA,CAAAA,CACf,WAAY,CACV,GAAIL,EAAS,CAAE,UAAWM,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EAAmBN,EAAQ,EAAIO,MAAS,AACpE,E,SAECR,C,IAIT,EAiCO,SAASS,IAGd,IAAMC,EAAkBC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EACtB,kBAGF,GAAI,CAACD,EACH,MAAM,AAAIE,MAAM,mCAGlB,IAAMC,EAAQH,EAAgB,SAAS,CAAC,GACxC,GAAI,CAACG,EACH,MAAM,AAAID,MAAM,kCAGlB,GAAI,CAACC,EAAM,MAAM,CACf,MAAM,AAAID,MACR,8JAIJ,MAAO,CAAE,OAAQC,EAAM,MAAM,AAAY,CAC3C,CAOO,SAASC,IAGd,IAAMJ,EAAkBC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EACtB,kBAGF,GAAI,CAACD,EACH,MAAM,AAAIE,MAA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,GAAoBE,CAAa,GAGlCN,CAAAA,AAA0B,KAA1BA,GAAoCR,CAAa,EAGnD,UAACe,EAAAA,CAAOA,CAAAA,CAAC,QAASjI,EAAU,GAAGtD,EAAM,YAAY,C,SAC/C,WAACqE,EAAAA,CAAGA,CAAAA,CACF,QAAQ,OACR,eAAe,WACf,MAAM,OACN,SAAS,O,UAER+G,EACAE,EACC,uB,UACE,UAACE,EAAAA,EAAOA,CAAAA,CAAC,MAAM,W,SACb,UAACC,EAAAA,CAAUA,CAAAA,CACT,gBAAc,iCACd,gBAAc,OACd,QAASX,E,SAET,UAACY,EAAAA,OAAYA,CAAAA,CAAAA,E,KAGjB,UAACC,EAAAA,CAAIA,CAAAA,CACH,GAAG,iCACH,mBAAoB,KACpB,SAAUhB,EACV,aAAc,CAAE,SAAU,SAAU,WAAY,OAAQ,EACxD,KAAMjG,EAAQiG,EACd,QAASI,EACT,YAAW,G,SAEX,UAAC,O,SAAKO,C,QAGR,K,KArCsC,IAyClD,C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([["8189"],{23490:function(e,t,r){r.d(t,{O:()=>a});var n=r(73557);function a(e){return(0,n.UO)()}},40560:function(e,t,r){r.d(t,{r:()=>D,I:()=>B});var n=r(52322),a=r(2784),s=r(73557),o=r(64796),i=r(77344),l=r(98049),u=r(31546),c=r(46115),d=r(99064),h=r(33741),p=r(51173),x=r(23490),g=r(32904),f=r(33414),m=r(40098),v=r(77277),j=r(16162),C=r(42412),w=r(51943),y=r(6020),k=r(91246),E=r(26291);function b(e){let{children:t,...r}=e,{Progress:s}=(0,m.q)().getComponents(),o=function(e){let{pluginId:t}=e??{},r=(0,j.h_)(C.g),n=(0,j.h_)(w.N),s=(0,a.useMemo)(()=>"BroadcastChannel"in window?new BroadcastChannel(`${t}-auth-cookie-expires-at`):null,[t]),[o,i]=function(e,t){let[r,n]=(0,a.useState)({status:"not-executed",error:void 0,result:void 0}),s=(0,a.useRef)(),o=(0,a.useRef)(),i=(0,y.x)({execute(...t){o.current=t;let r=e(...t);return s.current=r,n(e=>({...e,status:"loading"})),r.then(e=>{r===s.current&&n(t=>({...t,status:"success",error:void 0,result:e}))},e=>{r===s.current&&n(t=>({...t,status:"error",error:e}))}),r},reset(){n({status:"not-executed",error:void 0,result:void 0}),s.current=void 0,o.current=void 0}});return[r,(0,a.useMemo)(()=>({reset(){i.current.reset()},execute:(...e)=>i.current.execute(...e)}),[]),{promise:s.current,lastArgs:o.current}]}(async()=>{let e=await n.getBaseUrl(t),a=`${e}/.backstage/auth/v1/cookie`,s=await r.fetch(`${a}`,{credentials:"include"});if(!s.ok){if(404===s.status)return{expiresAt:new Date(Date.now()+31536e6)};throw await E.V.fromResponse(s)}let o=await s.json();if(!o.expiresAt)throw Error("No expiration date found in response");return o});(0,k.n)(i.execute);let l=(0,a.useCallback)(()=>{i.execute()},[i]),u=(0,a.useCallback)(e=>{let t=(1+3*Math.random())*6e4,r=setTimeout(l,Date.parse(e.expiresAt)-Date.now()-t);return()=>clearTimeout(r)},[l]);return((0,a.useEffect)(()=>{if("success"!==o.status||!o.result)return()=>{};s?.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:o.result});let e=u(o.result),t=t=>{let{action:r,payload:n}=t.data;"COOKIE_REFRESH_SUCCESS"===r&&(e(),e=u(n))};return s?.addEventListener("message",t),()=>{e(),s?.removeEventListener("message",t)}},[o,u,s]),"not-executed"===o.status||"loading"===o.status&&!o.result||"loading"===o.status&&o.error)?{status:"loading"}:"error"===o.status&&o.error?{status:"error",error:o.error,retry:l}:{status:"success",data:o.result}}(r);return"loading"===o.status?(0,n.jsx)(s,{}):"error"===o.status?(0,n.jsx)(f.y,{error:o.error,children:(0,n.jsx)(v.Z,{variant:"outlined",onClick:o.retry,children:"Retry"})}):(0,n.jsx)(n.Fragment,{children:t})}var S=r(36363),Z=r(60364),R=r(84620),M=r(41547),_=r(4812),I=r(93048),O=r(84081),T=r(39381),A=r(25942),F=r(99503);let D=e=>{let{withSearch:t,withHeader:r=!0}=e;return(0,n.jsxs)(o.T,{themeId:"documentation",children:[r&&(0,n.jsx)(d.S,{}),(0,n.jsx)(h.b,{}),(0,n.jsx)(c.F,{withSearch:t})]})},L=(0,S.Z)(o.T)({height:"inherit",overflowY:"visible"}),B=e=>{let t=(0,Z.Z)(),r=(0,a.useMemo)(()=>(0,R.Z)({...t,...e.overrideThemeOptions||{}}),[t,e.overrideThemeOptions]),{kind:o,name:c,namespace:d}=(0,x.O)(p.Fw),{children:h,entityRef:f={kind:o,name:c,namespace:d}}=e,m=(0,s.pC)(),v=(0,a.useMemo)(()=>({kind:f.kind,name:f.name,namespace:f.namespace}),[f.kind,f.name,f.namespace]),{shouldShowProgress:C}=function(e){let t=(0,j.h_)(O.A),r=(0,s.s0)(),n=(0,I.t)(p.Fw),o=(0,T.eE)(e),i=(0,a.useRef)(null),l=i.current!==o,u=(0,_.Z)(async()=>{try{let r=await t.getEntityByRef(e);if(r?.metadata?.annotations?.[F.Un])return(0,A.Li)(r,n)}catch(e){}},[o,t]);(0,a.useEffect)(()=>{!u.loading&&u.value&&r(u.value,{replace:!0}),u.loading||u.value||(i.current=o)},[u.loading,u.value,r,o]);let c=l&&u.loading||!!u.value;return{loading:u.loading,shouldShowProgress:c}}(v),w=(0,a.useMemo)(()=>h?null:(m?a.Children.toArray(m.props.children):[]).flatMap(e=>e?.props?.children??[]).find(e=>!(0,g.I)(e,l.Zz)&&!(0,g.I)(e,l.jM)),[h,m]);return C?(0,n.jsx)(i.E,{}):h?(0,n.jsx)(M.Z,{theme:r,children:(0,n.jsx)(b,{pluginId:"techdocs",children:(0,n.jsx)(u.Z,{entityRef:v,children:({metadata:e,entityMetadata:t,onReady:r})=>(0,n.jsx)(L,{themeId:"documentation",className:"techdocs-reader-page",children:h instanceof Function?h({entityRef:v,techdocsMetadataValue:e.value,entityMetadataValue:t.value,onReady:r}):h})})})}):(0,n.jsx)(M.Z,{theme:r,children:(0,n.jsx)(b,{pluginId:"techdocs",children:(0,n.jsx)(u.Z,{entityRef:v,children:w||(0,n.jsx)(D,{})})})})}},95930:function(e,t,r){r.r(t),r.d(t,{TechDocsReaderLayout:()=>n.r,TechDocsReaderPage:()=>n.I});var n=r(40560)},33741:function(e,t,r){r.d(t,{b:()=>f});var n=r(52322),a=r(2784),s=r(79692),o=r(61837),i=r(15223),l=r(80030),u=r(48348),c=r(53244),d=r(47603),h=r(31546),p=r(98049),x=r(63424);let g=(0,s.Z)(e=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:e.spacing(3,3,0),"@media print":{display:"none"}}})),f=e=>{let t=g(),[r,s]=(0,a.useState)(null),f=(0,a.useCallback)(e=>{s(e.currentTarget)},[]),m=(0,a.useCallback)(()=>{s(null)},[]),{entityMetadata:{value:v,loading:j}}=(0,h.x)(),C=(0,p.$L)(),w=C.renderComponentsByLocation(x.o.Subheader),y=C.renderComponentsByLocation(x.o.Settings);return(w||y)&&(!1!==j||v)?(0,n.jsx)(i.Z,{classes:t,...e.toolbarProps,children:(0,n.jsxs)(c.Z,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[w,y?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.ZP,{title:"Settings",children:(0,n.jsx)(o.Z,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:f,children:(0,n.jsx)(d.default,{})})}),(0,n.jsx)(u.Z,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:r,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!!r,onClose:m,keepMounted:!0,children:(0,n.jsx)("div",{children:y})})]}):null]})}):null}}}]);
|
|
2
|
+
//# sourceMappingURL=8189.e15bea0f.chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static/8189.e15bea0f.chunk.js","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","webpack://techdocs-cli-embedded-app/../../node_modules/@react-hookz/web/src/useAsync/index.js","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/useExternalRedirect.ts","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport { ErrorPanel } from '@backstage/core-components';\nimport { useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport { useCookieAuthRefresh } from '../../hooks';\n\n/**\n * @public\n * Props for the {@link CookieAuthRefreshProvider} component.\n */\nexport type CookieAuthRefreshProviderProps = {\n // The plugin ID used for discovering the API origin\n pluginId: string;\n // The children to render when the refresh is successful\n children: ReactNode;\n};\n\n/**\n * @public\n * A provider that will refresh the cookie when it is about to expire.\n */\nexport function CookieAuthRefreshProvider(\n props: CookieAuthRefreshProviderProps,\n): JSX.Element {\n const { children, ...options } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n\n const result = useCookieAuthRefresh(options);\n\n if (result.status === 'loading') {\n return <Progress />;\n }\n\n if (result.status === 'error') {\n return (\n <ErrorPanel error={result.error}>\n <Button variant=\"outlined\" onClick={result.retry}>\n Retry\n </Button>\n </ErrorPanel>\n );\n }\n\n return <>{children}</>;\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useCallback, useMemo } from 'react';\nimport {\n discoveryApiRef,\n fetchApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsync, useMountEffect } from '@react-hookz/web';\nimport { ResponseError } from '@backstage/errors';\n\nconst COOKIE_PATH = '/.backstage/auth/v1/cookie';\nconst ONE_YEAR_MS = 365 * 24 * 3600_000;\n\n/**\n * @public\n * A hook that will refresh the cookie when it is about to expire.\n * @param options - Options for configuring the refresh cookie endpoint\n */\nexport function useCookieAuthRefresh(options: {\n // The plugin id used for discovering the API origin\n pluginId: string;\n}):\n | { status: 'loading' }\n | { status: 'error'; error: Error; retry: () => void }\n | { status: 'success'; data: { expiresAt: string } } {\n const { pluginId } = options ?? {};\n const fetchApi = useApi(fetchApiRef);\n const discoveryApi = useApi(discoveryApiRef);\n\n const channel = useMemo(() => {\n return 'BroadcastChannel' in window\n ? new BroadcastChannel(`${pluginId}-auth-cookie-expires-at`)\n : null;\n }, [pluginId]);\n\n const [state, actions] = useAsync<{ expiresAt: string }>(async () => {\n const apiOrigin = await discoveryApi.getBaseUrl(pluginId);\n const requestUrl = `${apiOrigin}${COOKIE_PATH}`;\n const response = await fetchApi.fetch(`${requestUrl}`, {\n credentials: 'include',\n });\n if (!response.ok) {\n // If we get a 404 from the cookie endpoint we assume that it does not\n // exist and cookie auth is not needed. For all active tabs we don't\n // schedule another refresh for the foreseeable future, but new tabs will\n // still check if cookie auth has been added to the deployment.\n // TODO(Rugvip): Once the legacy backend system is no longer supported we should remove this check\n if (response.status === 404) {\n return { expiresAt: new Date(Date.now() + ONE_YEAR_MS) };\n }\n throw await ResponseError.fromResponse(response);\n }\n const data = await response.json();\n if (!data.expiresAt) {\n throw new Error('No expiration date found in response');\n }\n return data;\n });\n\n useMountEffect(actions.execute);\n\n const retry = useCallback(() => {\n actions.execute();\n }, [actions]);\n\n const refresh = useCallback(\n (params: { expiresAt: string }) => {\n // Randomize the refreshing margin with a margin of 1-4 minutes to avoid all tabs refreshing at the same time\n // It cannot be less than 5 minutes otherwise the backend will return the same expiration date\n const margin = (1 + 3 * Math.random()) * 60000;\n const delay = Date.parse(params.expiresAt) - Date.now() - margin;\n const timeout = setTimeout(retry, delay);\n return () => clearTimeout(timeout);\n },\n [retry],\n );\n\n useEffect(() => {\n // Only schedule a refresh if we have a successful response\n if (state.status !== 'success' || !state.result) {\n return () => {};\n }\n channel?.postMessage({\n action: 'COOKIE_REFRESH_SUCCESS',\n payload: state.result,\n });\n let cancel = refresh(state.result);\n const listener = (\n event: MessageEvent<{ action: string; payload: { expiresAt: string } }>,\n ) => {\n const { action, payload } = event.data;\n if (action === 'COOKIE_REFRESH_SUCCESS') {\n cancel();\n cancel = refresh(payload);\n }\n };\n channel?.addEventListener('message', listener);\n return () => {\n cancel();\n channel?.removeEventListener('message', listener);\n };\n }, [state, refresh, channel]);\n\n // Initialising\n if (state.status === 'not-executed') {\n return { status: 'loading' };\n }\n\n // First refresh or retrying without any success before\n // Possible state transitions:\n // e.g. not-executed -> loading (first-refresh)\n // e.g. not-executed -> loading (first-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && !state.result) {\n return { status: 'loading' };\n }\n\n // Retrying after having succeeding at least once\n // Current state is: { status: 'loading', result: {...}, error: undefined | Error }\n // e.g. not-executed -> loading (first-refresh) -> success -> loading (scheduled-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && state.error) {\n return { status: 'loading' };\n }\n\n // Something went wrong during any situation of a refresh\n if (state.status === 'error' && state.error) {\n return { status: 'error', error: state.error, retry };\n }\n\n // At this point it should be safe to assume that we have a successful refresh\n return { status: 'success', data: state.result! };\n}\n","import { useMemo, useRef, useState } from 'react';\nimport { useSyncedRef } from '../useSyncedRef/index.js';\nexport function useAsync(asyncFn, initialValue) {\n const [state, setState] = useState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n const promiseRef = useRef();\n const argsRef = useRef();\n const methods = useSyncedRef({\n execute(...params) {\n argsRef.current = params;\n const promise = asyncFn(...params);\n promiseRef.current = promise;\n setState((s) => ({ ...s, status: 'loading' }));\n promise.then((result) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'success', error: undefined, result }));\n }\n }, (error) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'error', error }));\n }\n });\n return promise;\n },\n reset() {\n setState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n promiseRef.current = undefined;\n argsRef.current = undefined;\n },\n });\n return [\n state,\n useMemo(() => ({\n reset() {\n methods.current.reset();\n },\n execute: (...params) => methods.current.execute(...params),\n }), []),\n { promise: promiseRef.current, lastArgs: argsRef.current },\n ];\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Children, ReactElement, ReactNode, useMemo } from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport { Page, Progress } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_KEY,\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\nimport {\n createTheme,\n styled,\n ThemeOptions,\n ThemeProvider,\n useTheme,\n} from '@material-ui/core/styles';\nimport { useExternalRedirect } from './useExternalRedirect';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n overrideThemeOptions?: Partial<ThemeOptions>;\n};\n\n/**\n * Styled Backstage Page that fills available vertical space\n */\nconst StyledPage = styled(Page)({\n height: 'inherit',\n overflowY: 'visible',\n});\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const currentTheme = useTheme();\n\n const readerPageTheme = useMemo(\n () =>\n createTheme({\n ...currentTheme,\n ...(props.overrideThemeOptions || {}),\n }),\n [currentTheme, props.overrideThemeOptions],\n );\n\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n const memoizedEntityRef = useMemo(\n () => ({\n kind: entityRef.kind,\n name: entityRef.name,\n namespace: entityRef.namespace,\n }),\n [entityRef.kind, entityRef.name, entityRef.namespace],\n );\n\n // Check for external TechDocs redirects and handle navigation\n const { shouldShowProgress } = useExternalRedirect(memoizedEntityRef);\n\n const page: ReactNode = useMemo(() => {\n if (children) {\n return null;\n }\n\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n return grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n }, [children, outlet]);\n\n // Show full-page loading spinner when checking for external redirects or about to redirect.\n // This replaces the entire page content (header, sidebar, and documentation).\n if (shouldShowProgress) {\n return <Progress />;\n }\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n if (!children) {\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={memoizedEntityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n }\n\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={memoizedEntityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <StyledPage\n themeId=\"documentation\"\n className=\"techdocs-reader-page\"\n >\n {children instanceof Function\n ? children({\n entityRef: memoizedEntityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </StyledPage>\n )}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n};\n","/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useRef } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport {\n CompoundEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { buildTechDocsURL } from '@backstage/plugin-techdocs-react';\nimport { TECHDOCS_EXTERNAL_ANNOTATION } from '@backstage/plugin-techdocs-common';\nimport { rootDocsRouteRef } from '../../../routes';\n\n/**\n * Hook to handle external TechDocs redirects based on entity annotations.\n * Checks if an entity has the `backstage.io/techdocs-entity` annotation and\n * redirects to the external TechDocs URL if present.\n *\n * @param entityRef - The entity reference to check for external redirects\n * @returns Object containing loading state and whether a redirect is in progress\n *\n * @internal\n */\nexport function useExternalRedirect(entityRef: CompoundEntityRef): {\n loading: boolean;\n shouldShowProgress: boolean;\n} {\n const catalogApi = useApi(catalogApiRef);\n const navigate = useNavigate();\n const viewTechdocLink = useRouteRef(rootDocsRouteRef);\n\n // Create a stable string key for the entity to use as a dependency.\n // This ensures the useAsync hook only re-runs when the entity changes,\n // preventing redundant API calls during sub-page navigation within the same entity's documentation.\n const entityKey = stringifyEntityRef(entityRef);\n // Track which entity we've already checked to avoid redundant checks\n // when navigating between pages within the same entity's documentation.\n const checkedEntityRef = useRef<string | null>(null);\n const shouldCheckForRedirect = checkedEntityRef.current !== entityKey;\n\n // Check if this entity should redirect to external TechDocs\n const externalRedirectResult = useAsync(async () => {\n try {\n const catalogEntity = await catalogApi.getEntityByRef(entityRef);\n\n if (\n catalogEntity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]\n ) {\n return buildTechDocsURL(catalogEntity, viewTechdocLink);\n }\n } catch (error) {\n // Ignore errors and allow the current entity's TechDocs to load.\n // This handles cases where the catalog API is unavailable or the entity doesn't exist.\n }\n\n return undefined;\n }, [entityKey, catalogApi]);\n\n useEffect(() => {\n // Navigate to external TechDocs if a redirect URL is available\n if (!externalRedirectResult.loading && externalRedirectResult.value) {\n navigate(externalRedirectResult.value, { replace: true });\n }\n\n // Mark entity as checked once we've determined there's no redirect needed.\n // This prevents the entire page from unmounting/remounting (showing Progress spinner)\n // on subsequent sub-page navigation within the same entity.\n if (!externalRedirectResult.loading && !externalRedirectResult.value) {\n checkedEntityRef.current = entityKey;\n }\n }, [\n externalRedirectResult.loading,\n externalRedirectResult.value,\n navigate,\n entityKey,\n ]);\n\n // Determine if we should show a loading indicator (which replaces the entire page with a Progress spinner).\n // Only show it when: 1) checking a new/unchecked entity, or 2) we have a redirect URL and are navigating.\n const shouldShowProgress =\n (shouldCheckForRedirect && externalRedirectResult.loading) ||\n !!externalRedirectResult.value;\n\n return {\n loading: externalRedirectResult.loading,\n shouldShowProgress,\n };\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MouseEvent, useState, useCallback } from 'react';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { ToolbarProps } from '@material-ui/core/Toolbar';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Menu from '@material-ui/core/Menu';\nimport Box from '@material-ui/core/Box';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport {\n TechDocsAddonLocations as locations,\n useTechDocsAddons,\n useTechDocsReaderPage,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageSubheader',\n flexDirection: 'column',\n minHeight: 'auto',\n padding: theme.spacing(3, 3, 0),\n '@media print': {\n display: 'none',\n },\n },\n}));\n\n/**\n * Renders the reader page subheader.\n * Please use the Tech Docs add-ons to customize it\n * @public\n */\nexport const TechDocsReaderPageSubheader = (props: {\n toolbarProps?: ToolbarProps;\n}) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const handleClose = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const {\n entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },\n } = useTechDocsReaderPage();\n\n const addons = useTechDocsAddons();\n\n const subheaderAddons = addons.renderComponentsByLocation(\n locations.Subheader,\n );\n\n const settingsAddons = addons.renderComponentsByLocation(locations.Settings);\n\n if (!subheaderAddons && !settingsAddons) return null;\n\n // No entity metadata = 404. Don't render subheader on 404.\n if (entityMetadataLoading === false && !entityMetadata) return null;\n\n return (\n <Toolbar classes={classes} {...props.toolbarProps}>\n <Box\n display=\"flex\"\n justifyContent=\"flex-end\"\n width=\"100%\"\n flexWrap=\"wrap\"\n >\n {subheaderAddons}\n {settingsAddons ? (\n <>\n <Tooltip title=\"Settings\">\n <IconButton\n aria-controls=\"tech-docs-reader-page-settings\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n >\n <SettingsIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"tech-docs-reader-page-settings\"\n getContentAnchorEl={null}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n open={Boolean(anchorEl)}\n onClose={handleClose}\n keepMounted\n >\n <div>{settingsAddons}</div>\n </Menu>\n </>\n ) : null}\n </Box>\n </Toolbar>\n );\n};\n"],"names":["useRouteRefParams","_routeRef","useParams","CookieAuthRefreshProvider","props","children","options","Progress","app","useApp","result","useCookieAuthRefresh","pluginId","fetchApi","useApi","fetchApiRef","discoveryApi","discoveryApiRef","channel","useMemo","window","BroadcastChannel","state","actions","useAsync","e","apiOrigin","requestUrl","response","Date","ResponseError","data","Error","useMountEffect","retry","useCallback","refresh","params","margin","Math","timeout","setTimeout","clearTimeout","useEffect","cancel","listener","event","action","payload","ErrorPanel","Button","TechDocsReaderLayout","withSearch","withHeader","Page","TechDocsReaderPageHeader","TechDocsReaderPageSubheader","TechDocsReaderPageContent","StyledPage","styled","TechDocsReaderPage","currentTheme","useTheme","readerPageTheme","createTheme","kind","name","namespace","rootDocsRouteRef","entityRef","outlet","useOutlet","memoizedEntityRef","shouldShowProgress","useExternalRedirect","catalogApi","catalogApiRef","navigate","useNavigate","viewTechdocLink","useRouteRef","entityKey","stringifyEntityRef","checkedEntityRef","useRef","shouldCheckForRedirect","externalRedirectResult","catalogEntity","TECHDOCS_EXTERNAL_ANNOTATION","buildTechDocsURL","error","page","grandChildren","childrenList","Children","child","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","ThemeProvider","TechDocsReaderPageProvider","metadata","entityMetadata","onReady","Function","useStyles","makeStyles","theme","classes","anchorEl","setAnchorEl","useState","handleClick","handleClose","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","locations","settingsAddons","Toolbar","Box","Tooltip","IconButton","SettingsIcon","Menu","Boolean"],"mappings":"+KAwBO,SAASA,EACdC,CAAiD,EAEjD,MAAOC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,GACT,C,qSCSO,SAASC,EACdC,CAAqC,EAErC,GAAM,CAAEC,SAAAA,CAAQ,CAAE,GAAGC,EAAS,CAAGF,EAE3B,CAAEG,SAAAA,CAAQ,CAAE,CAAGC,AADTC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,IACa,aAAa,GAEhCC,EAASC,ACXV,SAA8BL,CAGpC,EAIC,GAAM,CAAEM,SAAAA,CAAQ,CAAE,CAAGN,GAAW,CAAC,EAC3BO,EAAWC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EAAOC,EAAAA,CAAWA,EAC7BC,EAAeF,AAAAA,GAAAA,EAAA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