@techdocs/cli 0.0.0-nightly-20250601025149 → 0.0.0-nightly-20250603024010

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 CHANGED
@@ -1,12 +1,15 @@
1
1
  # @techdocs/cli
2
2
 
3
- ## 0.0.0-nightly-20250601025149
3
+ ## 0.0.0-nightly-20250603024010
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - Updated dependencies
8
- - @backstage/backend-defaults@0.0.0-nightly-20250601025149
9
- - @backstage/plugin-techdocs-node@0.0.0-nightly-20250601025149
8
+ - @backstage/backend-defaults@0.0.0-nightly-20250603024010
9
+ - @backstage/catalog-model@1.7.4
10
+ - @backstage/cli-common@0.1.15
11
+ - @backstage/config@1.3.2
12
+ - @backstage/plugin-techdocs-node@0.0.0-nightly-20250603024010
10
13
 
11
14
  ## 1.9.4-next.0
12
15
 
@@ -1161,29 +1161,6 @@
1161
1161
  },
1162
1162
  "packageName": "@backstage/plugin-catalog"
1163
1163
  },
1164
- {
1165
- "path": "../../node_modules/@backstage-community/plugin-stackstorm/config.d.ts",
1166
- "value": {
1167
- "type": "object",
1168
- "properties": {
1169
- "stackstorm": {
1170
- "type": "object",
1171
- "properties": {
1172
- "webUrl": {
1173
- "description": "StackStorm Web UI url\nUsed in links to StackStorm web UI",
1174
- "visibility": "frontend",
1175
- "type": "string"
1176
- }
1177
- },
1178
- "required": [
1179
- "webUrl"
1180
- ]
1181
- }
1182
- },
1183
- "$schema": "http://json-schema.org/draft-07/schema#"
1184
- },
1185
- "packageName": "@backstage-community/plugin-stackstorm"
1186
- },
1187
1164
  {
1188
1165
  "path": "../../node_modules/@oriflame/backstage-plugin-score-card/config.d.ts",
1189
1166
  "value": {
@@ -1228,6 +1205,29 @@
1228
1205
  },
1229
1206
  "packageName": "@oriflame/backstage-plugin-score-card"
1230
1207
  },
1208
+ {
1209
+ "path": "../../node_modules/@backstage-community/plugin-stackstorm/config.d.ts",
1210
+ "value": {
1211
+ "type": "object",
1212
+ "properties": {
1213
+ "stackstorm": {
1214
+ "type": "object",
1215
+ "properties": {
1216
+ "webUrl": {
1217
+ "description": "StackStorm Web UI url\nUsed in links to StackStorm web UI",
1218
+ "visibility": "frontend",
1219
+ "type": "string"
1220
+ }
1221
+ },
1222
+ "required": [
1223
+ "webUrl"
1224
+ ]
1225
+ }
1226
+ },
1227
+ "$schema": "http://json-schema.org/draft-07/schema#"
1228
+ },
1229
+ "packageName": "@backstage-community/plugin-stackstorm"
1230
+ },
1231
1231
  {
1232
1232
  "path": "../backend-plugin-api/config.d.ts",
1233
1233
  "value": {
@@ -1429,7 +1429,7 @@
1429
1429
  "packageName": "@backstage/plugin-auth-backend-module-guest-provider"
1430
1430
  },
1431
1431
  {
1432
- "path": "../../node_modules/@backstage-community/plugin-stackstorm/node_modules/@backstage/core-components/config.d.ts",
1432
+ "path": "../../node_modules/@oriflame/backstage-plugin-score-card/node_modules/@backstage/core-components/config.d.ts",
1433
1433
  "value": {
1434
1434
  "type": "object",
1435
1435
  "properties": {
@@ -1475,7 +1475,7 @@
1475
1475
  "packageName": "@backstage/core-components"
1476
1476
  },
1477
1477
  {
1478
- "path": "../../node_modules/@oriflame/backstage-plugin-score-card/node_modules/@backstage/core-components/config.d.ts",
1478
+ "path": "../../node_modules/@backstage-community/plugin-stackstorm/node_modules/@backstage/core-components/config.d.ts",
1479
1479
  "value": {
1480
1480
  "type": "object",
1481
1481
  "properties": {
@@ -1520,105 +1520,6 @@
1520
1520
  },
1521
1521
  "packageName": "@backstage/core-components"
1522
1522
  },
1523
- {
1524
- "path": "../backend-app-api/config.d.ts",
1525
- "value": {
1526
- "type": "object",
1527
- "properties": {
1528
- "backend": {
1529
- "type": "object",
1530
- "properties": {
1531
- "packages": {
1532
- "description": "Used by the feature discovery service",
1533
- "anyOf": [
1534
- {
1535
- "type": "object",
1536
- "properties": {
1537
- "include": {
1538
- "type": "array",
1539
- "items": {
1540
- "type": "string"
1541
- }
1542
- },
1543
- "exclude": {
1544
- "type": "array",
1545
- "items": {
1546
- "type": "string"
1547
- }
1548
- }
1549
- }
1550
- },
1551
- {
1552
- "const": "all",
1553
- "type": "string"
1554
- }
1555
- ]
1556
- },
1557
- "startup": {
1558
- "type": "object",
1559
- "properties": {
1560
- "default": {
1561
- "type": "object",
1562
- "properties": {
1563
- "onPluginBootFailure": {
1564
- "description": "The default value for `onPluginBootFailure` if not specified for a particular plugin.\nThis defaults to 'abort', which means `onPluginBootFailure: continue` must be specified\nfor backend startup to continue on plugin boot failure. This can also be set to\n'continue', which flips the logic for individual plugins so that they must be set to\n`onPluginBootFailure: abort` to be required.",
1565
- "enum": [
1566
- "abort",
1567
- "continue"
1568
- ],
1569
- "type": "string"
1570
- },
1571
- "onPluginModuleBootFailure": {
1572
- "description": "The default value for `onPluginModuleBootFailure` if not specified for a particular plugin module.\nThis defaults to 'abort', which means `onPluginModuleBootFailure: continue` must be specified\nfor backend startup to continue on plugin module boot failure. This can also be set to\n'continue', which flips the logic for individual plugin modules so that they must be set to\n`onPluginModuleBootFailure: abort` to be required.",
1573
- "enum": [
1574
- "abort",
1575
- "continue"
1576
- ],
1577
- "type": "string"
1578
- }
1579
- }
1580
- },
1581
- "plugins": {
1582
- "type": "object",
1583
- "additionalProperties": {
1584
- "type": "object",
1585
- "properties": {
1586
- "onPluginBootFailure": {
1587
- "description": "Used to control backend startup behavior when this plugin fails to boot up. Setting\nthis to `continue` allows the backend to continue starting up, even if this plugin\nfails. This can enable leaving a crashing plugin installed, but still permit backend\nstartup, which may help troubleshoot data-dependent issues. Plugin failures for plugins\nset to `abort` are fatal (this is the default unless overridden by the `default`\nsetting).",
1588
- "enum": [
1589
- "abort",
1590
- "continue"
1591
- ],
1592
- "type": "string"
1593
- },
1594
- "modules": {
1595
- "type": "object",
1596
- "additionalProperties": {
1597
- "type": "object",
1598
- "properties": {
1599
- "onPluginModuleBootFailure": {
1600
- "description": "Used to control backend startup behavior when this plugin module fails to boot up. Setting\nthis to `continue` allows the backend to continue starting up, even if this plugin\nmodule fails. This can enable leaving a crashing plugin installed, but still permit backend\nstartup, which may help troubleshoot data-dependent issues. Plugin module failures for plugin modules\nset to `abort` are fatal (this is the default unless overridden by the `default`\nsetting).",
1601
- "enum": [
1602
- "abort",
1603
- "continue"
1604
- ],
1605
- "type": "string"
1606
- }
1607
- }
1608
- }
1609
- }
1610
- }
1611
- }
1612
- }
1613
- }
1614
- }
1615
- }
1616
- }
1617
- },
1618
- "$schema": "http://json-schema.org/draft-07/schema#"
1619
- },
1620
- "packageName": "@backstage/backend-app-api"
1621
- },
1622
1523
  {
1623
1524
  "path": "../backend-defaults/config.d.ts",
1624
1525
  "value": {
@@ -2793,6 +2694,105 @@
2793
2694
  },
2794
2695
  "packageName": "@backstage/plugin-events-node"
2795
2696
  },
2697
+ {
2698
+ "path": "../backend-app-api/config.d.ts",
2699
+ "value": {
2700
+ "type": "object",
2701
+ "properties": {
2702
+ "backend": {
2703
+ "type": "object",
2704
+ "properties": {
2705
+ "packages": {
2706
+ "description": "Used by the feature discovery service",
2707
+ "anyOf": [
2708
+ {
2709
+ "type": "object",
2710
+ "properties": {
2711
+ "include": {
2712
+ "type": "array",
2713
+ "items": {
2714
+ "type": "string"
2715
+ }
2716
+ },
2717
+ "exclude": {
2718
+ "type": "array",
2719
+ "items": {
2720
+ "type": "string"
2721
+ }
2722
+ }
2723
+ }
2724
+ },
2725
+ {
2726
+ "const": "all",
2727
+ "type": "string"
2728
+ }
2729
+ ]
2730
+ },
2731
+ "startup": {
2732
+ "type": "object",
2733
+ "properties": {
2734
+ "default": {
2735
+ "type": "object",
2736
+ "properties": {
2737
+ "onPluginBootFailure": {
2738
+ "description": "The default value for `onPluginBootFailure` if not specified for a particular plugin.\nThis defaults to 'abort', which means `onPluginBootFailure: continue` must be specified\nfor backend startup to continue on plugin boot failure. This can also be set to\n'continue', which flips the logic for individual plugins so that they must be set to\n`onPluginBootFailure: abort` to be required.",
2739
+ "enum": [
2740
+ "abort",
2741
+ "continue"
2742
+ ],
2743
+ "type": "string"
2744
+ },
2745
+ "onPluginModuleBootFailure": {
2746
+ "description": "The default value for `onPluginModuleBootFailure` if not specified for a particular plugin module.\nThis defaults to 'abort', which means `onPluginModuleBootFailure: continue` must be specified\nfor backend startup to continue on plugin module boot failure. This can also be set to\n'continue', which flips the logic for individual plugin modules so that they must be set to\n`onPluginModuleBootFailure: abort` to be required.",
2747
+ "enum": [
2748
+ "abort",
2749
+ "continue"
2750
+ ],
2751
+ "type": "string"
2752
+ }
2753
+ }
2754
+ },
2755
+ "plugins": {
2756
+ "type": "object",
2757
+ "additionalProperties": {
2758
+ "type": "object",
2759
+ "properties": {
2760
+ "onPluginBootFailure": {
2761
+ "description": "Used to control backend startup behavior when this plugin fails to boot up. Setting\nthis to `continue` allows the backend to continue starting up, even if this plugin\nfails. This can enable leaving a crashing plugin installed, but still permit backend\nstartup, which may help troubleshoot data-dependent issues. Plugin failures for plugins\nset to `abort` are fatal (this is the default unless overridden by the `default`\nsetting).",
2762
+ "enum": [
2763
+ "abort",
2764
+ "continue"
2765
+ ],
2766
+ "type": "string"
2767
+ },
2768
+ "modules": {
2769
+ "type": "object",
2770
+ "additionalProperties": {
2771
+ "type": "object",
2772
+ "properties": {
2773
+ "onPluginModuleBootFailure": {
2774
+ "description": "Used to control backend startup behavior when this plugin module fails to boot up. Setting\nthis to `continue` allows the backend to continue starting up, even if this plugin\nmodule fails. This can enable leaving a crashing plugin installed, but still permit backend\nstartup, which may help troubleshoot data-dependent issues. Plugin module failures for plugin modules\nset to `abort` are fatal (this is the default unless overridden by the `default`\nsetting).",
2775
+ "enum": [
2776
+ "abort",
2777
+ "continue"
2778
+ ],
2779
+ "type": "string"
2780
+ }
2781
+ }
2782
+ }
2783
+ }
2784
+ }
2785
+ }
2786
+ }
2787
+ }
2788
+ }
2789
+ }
2790
+ }
2791
+ },
2792
+ "$schema": "http://json-schema.org/draft-07/schema#"
2793
+ },
2794
+ "packageName": "@backstage/backend-app-api"
2795
+ },
2796
2796
  {
2797
2797
  "path": "../../plugins/auth-backend-module-google-provider/config.d.ts",
2798
2798
  "value": {
@@ -3028,7 +3028,7 @@
3028
3028
  "packageName": "@backstage/integration-aws-node"
3029
3029
  },
3030
3030
  {
3031
- "path": "../../node_modules/@backstage-community/plugin-puppetdb/node_modules/@backstage/frontend-app-api/config.d.ts",
3031
+ "path": "../../node_modules/@oriflame/backstage-plugin-score-card/node_modules/@backstage/frontend-app-api/config.d.ts",
3032
3032
  "value": {
3033
3033
  "type": "object",
3034
3034
  "properties": {
@@ -1 +1 @@
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.6c18f966.js"></script><script defer="defer" src="/static/module-material-ui.557c1930.js"></script><script defer="defer" src="/static/module-lodash.05581125.js"></script><script defer="defer" src="/static/module-date-fns.c633d602.js"></script><script defer="defer" src="/static/module-mui.f702282a.js"></script><script defer="defer" src="/static/module-material-table.00de7997.js"></script><script defer="defer" src="/static/module-react-dom.42a304d3.js"></script><script defer="defer" src="/static/module-zod.67a27cd9.js"></script><script defer="defer" src="/static/module-i18next.f50c1612.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.e9f14677.js"></script><script defer="defer" src="/static/module-remix-run.ae6d33c5.js"></script><script defer="defer" src="/static/vendor.6c18f966.js"></script><script defer="defer" src="/static/main.6c18f966.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
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.dcd8a2f6.js"></script><script defer="defer" src="/static/module-material-ui.557c1930.js"></script><script defer="defer" src="/static/module-lodash.05581125.js"></script><script defer="defer" src="/static/module-date-fns.c633d602.js"></script><script defer="defer" src="/static/module-mui.f702282a.js"></script><script defer="defer" src="/static/module-material-table.00de7997.js"></script><script defer="defer" src="/static/module-react-dom.42a304d3.js"></script><script defer="defer" src="/static/module-zod.67a27cd9.js"></script><script defer="defer" src="/static/module-i18next.f50c1612.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.e9f14677.js"></script><script defer="defer" src="/static/module-remix-run.ae6d33c5.js"></script><script defer="defer" src="/static/vendor.dcd8a2f6.js"></script><script defer="defer" src="/static/main.dcd8a2f6.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -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.6c18f966.js"></script><script defer src="<%= publicPath %>/static/module-material-ui.557c1930.js"></script><script defer src="<%= publicPath %>/static/module-lodash.05581125.js"></script><script defer src="<%= publicPath %>/static/module-date-fns.c633d602.js"></script><script defer src="<%= publicPath %>/static/module-mui.f702282a.js"></script><script defer src="<%= publicPath %>/static/module-material-table.00de7997.js"></script><script defer src="<%= publicPath %>/static/module-react-dom.42a304d3.js"></script><script defer src="<%= publicPath %>/static/module-zod.67a27cd9.js"></script><script defer src="<%= publicPath %>/static/module-i18next.f50c1612.js"></script><script defer src="<%= publicPath %>/static/module-react-beautiful-dnd.e9f14677.js"></script><script defer src="<%= publicPath %>/static/module-remix-run.ae6d33c5.js"></script><script defer src="<%= publicPath %>/static/vendor.6c18f966.js"></script><script defer src="<%= publicPath %>/static/main.6c18f966.js"></script></head>
45
+ <meta name="backstage-app-mode" content="public"><meta name="backstage-public-path" content="<%= publicPath %>/"><script defer src="<%= publicPath %>/static/runtime.dcd8a2f6.js"></script><script defer src="<%= publicPath %>/static/module-material-ui.557c1930.js"></script><script defer src="<%= publicPath %>/static/module-lodash.05581125.js"></script><script defer src="<%= publicPath %>/static/module-date-fns.c633d602.js"></script><script defer src="<%= publicPath %>/static/module-mui.f702282a.js"></script><script defer src="<%= publicPath %>/static/module-material-table.00de7997.js"></script><script defer src="<%= publicPath %>/static/module-react-dom.42a304d3.js"></script><script defer src="<%= publicPath %>/static/module-zod.67a27cd9.js"></script><script defer src="<%= publicPath %>/static/module-i18next.f50c1612.js"></script><script defer src="<%= publicPath %>/static/module-react-beautiful-dnd.e9f14677.js"></script><script defer src="<%= publicPath %>/static/module-remix-run.ae6d33c5.js"></script><script defer src="<%= publicPath %>/static/vendor.dcd8a2f6.js"></script><script defer src="<%= publicPath %>/static/main.dcd8a2f6.js"></script></head>
46
46
  <body>
47
47
  <noscript>You need to enable JavaScript to run this app.</noscript>
48
48
  <div id="root"></div>
@@ -1,3 +1,3 @@
1
- "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[4036],{70048:(I,m,e)=>{e.d(m,{K:()=>s});var t=e(18690);function s(P){return(0,t.g)()}},93160:(I,m,e)=>{e.d(m,{b:()=>Z,W:()=>X});var t=e(31085),s=e(14041),P=e(18690),x=e(24504),C=e(72020),D=e(88572),S=e(29729),B=e(45061),L=e(39299),K=e(82779),U=e(70048),v=e(19402),W=e(22020),F=e(82266),A=e(64947),M=e(72427),O=e(70795),T=e(57405),H=e(16261);function Y(g,c){const[E,f]=(0,s.useState)({status:"not-executed",error:void 0,result:c}),a=(0,s.useRef)(),n=(0,s.useRef)(),l=(0,H.J)({execute(...d){n.current=d;const i=g(...d);return a.current=i,f(r=>({...r,status:"loading"})),i.then(r=>{i===a.current&&f(o=>({...o,status:"success",error:void 0,result:r}))},r=>{i===a.current&&f(o=>({...o,status:"error",error:r}))}),i},reset(){f({status:"not-executed",error:void 0,result:c}),a.current=void 0,n.current=void 0}});return[E,(0,s.useMemo)(()=>({reset(){l.current.reset()},execute:(...d)=>l.current.execute(...d)}),[]),{promise:a.current,lastArgs:n.current}]}var $=e(76842),N=e(70835);const p="/.backstage/auth/v1/cookie",y=365*24*36e5;function R(g){const{pluginId:c}=g??{},E=(0,M.gf)(O.a),f=(0,M.gf)(T.I),a=(0,s.useMemo)(()=>"BroadcastChannel"in window?new BroadcastChannel(`${c}-auth-cookie-expires-at`):null,[c]),[n,l]=Y(async()=>{const o=`${await f.getBaseUrl(c)}${p}`,u=await E.fetch(`${o}`,{credentials:"include"});if(!u.ok){if(u.status===404)return{expiresAt:new Date(Date.now()+y)};throw await N.o.fromResponse(u)}const h=await u.json();if(!h.expiresAt)throw new Error("No expiration date found in response");return h});(0,$.u)(l.execute);const d=(0,s.useCallback)(()=>{l.execute()},[l]),i=(0,s.useCallback)(r=>{const o=(1+3*Math.random())*6e4,u=Date.parse(r.expiresAt)-Date.now()-o,h=setTimeout(d,u);return()=>clearTimeout(h)},[d]);return(0,s.useEffect)(()=>{if(n.status!=="success"||!n.result)return()=>{};a?.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:n.result});let r=i(n.result);const o=u=>{const{action:h,payload:b}=u.data;h==="COOKIE_REFRESH_SUCCESS"&&(r(),r=i(b))};return a?.addEventListener("message",o),()=>{r(),a?.removeEventListener("message",o)}},[n,i,a]),n.status==="not-executed"?{status:"loading"}:n.status==="loading"&&!n.result?{status:"loading"}:n.status==="loading"&&n.error?{status:"loading"}:n.status==="error"&&n.error?{status:"error",error:n.error,retry:d}:{status:"success",data:n.result}}function j(g){const{children:c,...E}=g,f=(0,F.n)(),{Progress:a}=f.getComponents(),n=R(E);return n.status==="loading"?(0,t.jsx)(a,{}):n.status==="error"?(0,t.jsx)(W.b,{error:n.error,children:(0,t.jsx)(A.A,{variant:"outlined",onClick:n.retry,children:"Retry"})}):(0,t.jsx)(t.Fragment,{children:c})}var z=e(58502),J=e(54917),G=e(98392),V=e(50868);const Z=g=>{const{withSearch:c,withHeader:E=!0}=g;return(0,t.jsxs)(x.Y,{themeId:"documentation",children:[E&&(0,t.jsx)(B.T,{}),(0,t.jsx)(L.Z,{}),(0,t.jsx)(S.p,{withSearch:c})]})},Q=(0,z.A)(x.Y)({height:"inherit",overflowY:"visible"}),X=g=>{const c=(0,J.A)(),E=(0,G.A)({...c,...g.overrideThemeOptions||{}}),{kind:f,name:a,namespace:n}=(0,U.K)(K.Oc),{children:l,entityRef:d={kind:f,name:a,namespace:n}}=g,i=(0,P.P1)();if(!l){const u=(i?s.Children.toArray(i.props.children):[]).flatMap(h=>h?.props?.children??[]).find(h=>!(0,v.E)(h,C.AF)&&!(0,v.E)(h,C.Wm));return(0,t.jsx)(V.A,{theme:E,children:(0,t.jsx)(j,{pluginId:"techdocs",children:(0,t.jsx)(D.R,{entityRef:d,children:u||(0,t.jsx)(Z,{})})})})}return(0,t.jsx)(V.A,{theme:E,children:(0,t.jsx)(j,{pluginId:"techdocs",children:(0,t.jsx)(D.R,{entityRef:d,children:({metadata:r,entityMetadata:o,onReady:u})=>(0,t.jsx)(Q,{themeId:"documentation",className:"techdocs-reader-page",children:l instanceof Function?l({entityRef:d,techdocsMetadataValue:r.value,entityMetadataValue:o.value,onReady:u}):l})})})})}},84036:(I,m,e)=>{e.r(m),e.d(m,{TechDocsReaderLayout:()=>t.b,TechDocsReaderPage:()=>t.W});var t=e(93160)},39299:(I,m,e)=>{e.d(m,{Z:()=>F});var t=e(31085),s=e(14041),P=e(58837),x=e(29365),C=e(75173),D=e(71677),S=e(37757),B=e(10394),L=e(9684),K=e(88572),U=e(72020),v=e(99730);const W=(0,P.A)(A=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:A.spacing(3,3,0),"@media print":{display:"none"}}})),F=A=>{const M=W(),[O,T]=(0,s.useState)(null),H=(0,s.useCallback)(j=>{T(j.currentTarget)},[]),Y=(0,s.useCallback)(()=>{T(null)},[]),{entityMetadata:{value:$,loading:N}}=(0,K.V)(),p=(0,U.YR)(),y=p.renderComponentsByLocation(v.e.Subheader),R=p.renderComponentsByLocation(v.e.Settings);return!y&&!R||N===!1&&!$?null:(0,t.jsx)(C.A,{classes:M,...A.toolbarProps,children:(0,t.jsxs)(B.A,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[y,R?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(D.Ay,{title:"Settings",children:(0,t.jsx)(x.A,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:H,children:(0,t.jsx)(L.A,{})})}),(0,t.jsx)(S.A,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:O,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!!O,onClose:Y,keepMounted:!0,children:(0,t.jsx)("div",{children:R})})]}):null]})})}}}]);})();
1
+ "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[4036],{70048:(I,m,e)=>{e.d(m,{K:()=>s});var t=e(18690);function s(P){return(0,t.g)()}},93160:(I,m,e)=>{e.d(m,{b:()=>Z,W:()=>X});var t=e(31085),s=e(14041),P=e(18690),x=e(24504),C=e(72020),D=e(88572),S=e(13976),B=e(45061),L=e(39299),K=e(82779),U=e(70048),v=e(19402),W=e(22020),F=e(82266),A=e(64947),M=e(72427),O=e(70795),T=e(57405),H=e(16261);function Y(g,c){const[E,f]=(0,s.useState)({status:"not-executed",error:void 0,result:c}),a=(0,s.useRef)(),n=(0,s.useRef)(),l=(0,H.J)({execute(...d){n.current=d;const i=g(...d);return a.current=i,f(r=>({...r,status:"loading"})),i.then(r=>{i===a.current&&f(o=>({...o,status:"success",error:void 0,result:r}))},r=>{i===a.current&&f(o=>({...o,status:"error",error:r}))}),i},reset(){f({status:"not-executed",error:void 0,result:c}),a.current=void 0,n.current=void 0}});return[E,(0,s.useMemo)(()=>({reset(){l.current.reset()},execute:(...d)=>l.current.execute(...d)}),[]),{promise:a.current,lastArgs:n.current}]}var $=e(76842),N=e(70835);const p="/.backstage/auth/v1/cookie",y=365*24*36e5;function R(g){const{pluginId:c}=g??{},E=(0,M.gf)(O.a),f=(0,M.gf)(T.I),a=(0,s.useMemo)(()=>"BroadcastChannel"in window?new BroadcastChannel(`${c}-auth-cookie-expires-at`):null,[c]),[n,l]=Y(async()=>{const o=`${await f.getBaseUrl(c)}${p}`,u=await E.fetch(`${o}`,{credentials:"include"});if(!u.ok){if(u.status===404)return{expiresAt:new Date(Date.now()+y)};throw await N.o.fromResponse(u)}const h=await u.json();if(!h.expiresAt)throw new Error("No expiration date found in response");return h});(0,$.u)(l.execute);const d=(0,s.useCallback)(()=>{l.execute()},[l]),i=(0,s.useCallback)(r=>{const o=(1+3*Math.random())*6e4,u=Date.parse(r.expiresAt)-Date.now()-o,h=setTimeout(d,u);return()=>clearTimeout(h)},[d]);return(0,s.useEffect)(()=>{if(n.status!=="success"||!n.result)return()=>{};a?.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:n.result});let r=i(n.result);const o=u=>{const{action:h,payload:b}=u.data;h==="COOKIE_REFRESH_SUCCESS"&&(r(),r=i(b))};return a?.addEventListener("message",o),()=>{r(),a?.removeEventListener("message",o)}},[n,i,a]),n.status==="not-executed"?{status:"loading"}:n.status==="loading"&&!n.result?{status:"loading"}:n.status==="loading"&&n.error?{status:"loading"}:n.status==="error"&&n.error?{status:"error",error:n.error,retry:d}:{status:"success",data:n.result}}function j(g){const{children:c,...E}=g,f=(0,F.n)(),{Progress:a}=f.getComponents(),n=R(E);return n.status==="loading"?(0,t.jsx)(a,{}):n.status==="error"?(0,t.jsx)(W.b,{error:n.error,children:(0,t.jsx)(A.A,{variant:"outlined",onClick:n.retry,children:"Retry"})}):(0,t.jsx)(t.Fragment,{children:c})}var z=e(58502),J=e(54917),G=e(98392),V=e(50868);const Z=g=>{const{withSearch:c,withHeader:E=!0}=g;return(0,t.jsxs)(x.Y,{themeId:"documentation",children:[E&&(0,t.jsx)(B.T,{}),(0,t.jsx)(L.Z,{}),(0,t.jsx)(S.p,{withSearch:c})]})},Q=(0,z.A)(x.Y)({height:"inherit",overflowY:"visible"}),X=g=>{const c=(0,J.A)(),E=(0,G.A)({...c,...g.overrideThemeOptions||{}}),{kind:f,name:a,namespace:n}=(0,U.K)(K.Oc),{children:l,entityRef:d={kind:f,name:a,namespace:n}}=g,i=(0,P.P1)();if(!l){const u=(i?s.Children.toArray(i.props.children):[]).flatMap(h=>h?.props?.children??[]).find(h=>!(0,v.E)(h,C.AF)&&!(0,v.E)(h,C.Wm));return(0,t.jsx)(V.A,{theme:E,children:(0,t.jsx)(j,{pluginId:"techdocs",children:(0,t.jsx)(D.R,{entityRef:d,children:u||(0,t.jsx)(Z,{})})})})}return(0,t.jsx)(V.A,{theme:E,children:(0,t.jsx)(j,{pluginId:"techdocs",children:(0,t.jsx)(D.R,{entityRef:d,children:({metadata:r,entityMetadata:o,onReady:u})=>(0,t.jsx)(Q,{themeId:"documentation",className:"techdocs-reader-page",children:l instanceof Function?l({entityRef:d,techdocsMetadataValue:r.value,entityMetadataValue:o.value,onReady:u}):l})})})})}},84036:(I,m,e)=>{e.r(m),e.d(m,{TechDocsReaderLayout:()=>t.b,TechDocsReaderPage:()=>t.W});var t=e(93160)},39299:(I,m,e)=>{e.d(m,{Z:()=>F});var t=e(31085),s=e(14041),P=e(58837),x=e(29365),C=e(75173),D=e(71677),S=e(37757),B=e(10394),L=e(9684),K=e(88572),U=e(72020),v=e(99730);const W=(0,P.A)(A=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:A.spacing(3,3,0),"@media print":{display:"none"}}})),F=A=>{const M=W(),[O,T]=(0,s.useState)(null),H=(0,s.useCallback)(j=>{T(j.currentTarget)},[]),Y=(0,s.useCallback)(()=>{T(null)},[]),{entityMetadata:{value:$,loading:N}}=(0,K.V)(),p=(0,U.YR)(),y=p.renderComponentsByLocation(v.e.Subheader),R=p.renderComponentsByLocation(v.e.Settings);return!y&&!R||N===!1&&!$?null:(0,t.jsx)(C.A,{classes:M,...A.toolbarProps,children:(0,t.jsxs)(B.A,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[y,R?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(D.Ay,{title:"Settings",children:(0,t.jsx)(x.A,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:H,children:(0,t.jsx)(L.A,{})})}),(0,t.jsx)(S.A,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:O,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!!O,onClose:Y,keepMounted:!0,children:(0,t.jsx)("div",{children:R})})]}):null]})})}}}]);})();
2
2
 
3
- //# sourceMappingURL=4036.0e3a284b.chunk.js.map
3
+ //# sourceMappingURL=4036.30d46c9e.chunk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"static/4036.0e3a284b.chunk.js","mappings":"6KAwBO,SAASA,EACdC,EAAiD,CAEjD,SAAOC,EAAAA,GAAU,CACnB,C,gQC1BO,SAASC,EAASC,EAASC,EAAc,CAC5C,KAAM,CAACC,EAAOC,CAAQ,KAAI,YAAS,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BAAoB,KACpB/B,SAAUA,EACVgC,aAAc,CAAEC,SAAU,SAAUC,WAAY,OAAQ,EACxDC,KAAMC,EAAQpC,EACdqC,QAAShC,EACTiC,YAAW,G,YAEX,OAACC,MAAAA,C,SAAKxB,C,QAGR,I,KAIZ,C","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../node_modules/@react-hookz/web/src/useAsync/index.js","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","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","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 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","/*\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 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 } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport { Page } 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';\n\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\n\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';\n\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\nimport {\n createTheme,\n styled,\n ThemeOptions,\n ThemeProvider,\n useTheme,\n} from '@material-ui/core/styles';\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 = createTheme({\n ...currentTheme,\n ...(props.overrideThemeOptions || {}),\n });\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n if (!children) {\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 const page: ReactNode = grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\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={entityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <StyledPage\n themeId=\"documentation\"\n className=\"techdocs-reader-page\"\n >\n {children instanceof Function\n ? children({\n entityRef,\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 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","useAsync","asyncFn","initialValue","state","setState","promiseRef","argsRef","methods","useSyncedRef","params","promise","s","result","error","COOKIE_PATH","ONE_YEAR_MS","useCookieAuthRefresh","options","pluginId","fetchApi","useApi","fetchApiRef","discoveryApi","discoveryApiRef","channel","useMemo","window","BroadcastChannel","actions","requestUrl","getBaseUrl","response","fetch","credentials","ok","status","expiresAt","Date","now","ResponseError","fromResponse","data","json","Error","useMountEffect","execute","retry","useCallback","refresh","margin","Math","random","delay","parse","timeout","setTimeout","clearTimeout","useEffect","postMessage","action","payload","cancel","listener","event","addEventListener","removeEventListener","CookieAuthRefreshProvider","props","children","app","useApp","Progress","getComponents","ErrorPanel","Button","variant","onClick","TechDocsReaderLayout","withSearch","withHeader","Page","themeId","TechDocsReaderPageHeader","TechDocsReaderPageSubheader","TechDocsReaderPageContent","StyledPage","styled","height","overflowY","TechDocsReaderPage","currentTheme","useTheme","readerPageTheme","createTheme","overrideThemeOptions","kind","name","namespace","rootDocsRouteRef","entityRef","outlet","useOutlet","page","Children","toArray","flatMap","child","find","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","ThemeProvider","theme","TechDocsReaderPageProvider","metadata","entityMetadata","onReady","className","Function","techdocsMetadataValue","value","entityMetadataValue","useStyles","makeStyles","root","gridArea","flexDirection","minHeight","padding","spacing","display","classes","anchorEl","setAnchorEl","useState","handleClick","currentTarget","handleClose","loading","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","renderComponentsByLocation","locations","Subheader","settingsAddons","Settings","Toolbar","toolbarProps","Box","justifyContent","width","flexWrap","Tooltip","title","IconButton","aria-controls","aria-haspopup","SettingsIcon","Menu","id","getContentAnchorEl","anchorOrigin","vertical","horizontal","open","Boolean","onClose","keepMounted","div"],"sourceRoot":""}
1
+ {"version":3,"file":"static/4036.30d46c9e.chunk.js","mappings":"6KAwBO,SAASA,EACdC,EAAiD,CAEjD,SAAOC,EAAAA,GAAU,CACnB,C,gQC1BO,SAASC,EAASC,E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AAAA,C,QAGjB,OAACC,EAAAA,EAAIA,CACHC,GAAG,iCACHC,mBAAoB,KACpB/B,SAAUA,EACVgC,aAAc,CAAEC,SAAU,SAAUC,WAAY,OAAQ,EACxDC,KAAMC,EAAQpC,EACdqC,QAAShC,EACTiC,YAAW,G,YAEX,OAACC,MAAAA,C,SAAKxB,C,QAGR,I,KAIZ,C","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../node_modules/@react-hookz/web/src/useAsync/index.js","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","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","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 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","/*\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 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 } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport { Page } 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';\n\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\n\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';\n\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\nimport {\n createTheme,\n styled,\n ThemeOptions,\n ThemeProvider,\n useTheme,\n} from '@material-ui/core/styles';\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 = createTheme({\n ...currentTheme,\n ...(props.overrideThemeOptions || {}),\n });\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n if (!children) {\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 const page: ReactNode = grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\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={entityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <StyledPage\n themeId=\"documentation\"\n className=\"techdocs-reader-page\"\n >\n {children instanceof Function\n ? children({\n entityRef,\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 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","useAsync","asyncFn","initialValue","state","setState","promiseRef","argsRef","methods","useSyncedRef","params","promise","s","result","error","COOKIE_PATH","ONE_YEAR_MS","useCookieAuthRefresh","options","pluginId","fetchApi","useApi","fetchApiRef","discoveryApi","discoveryApiRef","channel","useMemo","window","BroadcastChannel","actions","requestUrl","getBaseUrl","response","fetch","credentials","ok","status","expiresAt","Date","now","ResponseError","fromResponse","data","json","Error","useMountEffect","execute","retry","useCallback","refresh","margin","Math","random","delay","parse","timeout","setTimeout","clearTimeout","useEffect","postMessage","action","payload","cancel","listener","event","addEventListener","removeEventListener","CookieAuthRefreshProvider","props","children","app","useApp","Progress","getComponents","ErrorPanel","Button","variant","onClick","TechDocsReaderLayout","withSearch","withHeader","Page","themeId","TechDocsReaderPageHeader","TechDocsReaderPageSubheader","TechDocsReaderPageContent","StyledPage","styled","height","overflowY","TechDocsReaderPage","currentTheme","useTheme","readerPageTheme","createTheme","overrideThemeOptions","kind","name","namespace","rootDocsRouteRef","entityRef","outlet","useOutlet","page","Children","toArray","flatMap","child","find","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","ThemeProvider","theme","TechDocsReaderPageProvider","metadata","entityMetadata","onReady","className","Function","techdocsMetadataValue","value","entityMetadataValue","useStyles","makeStyles","root","gridArea","flexDirection","minHeight","padding","spacing","display","classes","anchorEl","setAnchorEl","useState","handleClick","currentTarget","handleClose","loading","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","renderComponentsByLocation","locations","Subheader","settingsAddons","Settings","Toolbar","toolbarProps","Box","justifyContent","width","flexWrap","Tooltip","title","IconButton","aria-controls","aria-haspopup","SettingsIcon","Menu","id","getContentAnchorEl","anchorOrigin","vertical","horizontal","open","Boolean","onClose","keepMounted","div"],"sourceRoot":""}
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[5788,8803],{70048:($,f,t)=>{t.d(f,{K:()=>c});var e=t(18690);function c(R){return(0,e.g)()}},99538:($,f,t)=>{t.d(f,{T7:()=>j,TY:()=>p,tN:()=>S});var e=t(31085),c=t(6820),R=t(25862),m=t(43836),A=t(10602);const M=(0,m.tK)("entity-context"),j=g=>{const{children:v,entity:x,loading:O,error:D,refresh:C}=g,T={entity:x,loading:O,error:D,refresh:C};return(0,e.jsx)(M.Provider,{value:(0,A.B)({1:T}),children:(0,e.jsx)(R.Ig,{attributes:{...x?{entityRef:(0,c.U2)(x)}:void 0},children:v})})},B=g=>_jsx(j,{entity:g.entity,loading:!g.entity,error:void 0,refresh:void 0,children:g.children});function S(){const g=(0,m.qO)("entity-context");if(!g)throw new Error("Entity context is not available");const v=g.atVersion(1);if(!v)throw new Error("EntityContext v1 not available");if(!v.entity)throw new 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:v.entity}}function p(){const g=(0,m.qO)("entity-context");if(!g)throw new Error("Entity context is not available");const v=g.atVersion(1);if(!v)throw new Error("EntityContext v1 not available");const{entity:x,loading:O,error:D,refresh:C}=v;return{entity:x,loading:O,error:D,refresh:C}}},38803:($,f,t)=>{t.r(f),t.d(f,{EmbeddedDocsRouter:()=>z,LegacyEmbeddedDocsRouter:()=>y,Router:()=>G,TechDocsReaderRouter:()=>X,isTechDocsAvailable:()=>V});var e=t(31085),c=t(18690),R=t(6820),m=t(86202),A=t(65614),M=t(39278),j=t(29729),B=t(39299),S=t(14041),p=t(9222),g=t(82779);const v=n=>n.replace(/^\/+/,""),x=n=>n.replace(/\/+$/,"");function O(n){const{kind:o,name:a,namespace:r}=n,s=(0,p.S)(g.Oc),u=(0,p.S)(g.Ri);return(0,S.useMemo)(()=>{const d=x(s({kind:o,namespace:r,name:a})),i=x(u());return l=>{if(l.toLocaleLowerCase("en-US").startsWith(d.toLocaleLowerCase("en-US"))){const h=v(l.slice(d.length));return h.length===0||h.startsWith("#")?`${i}${h}`:`${i}/${h}`}return l}},[s,u,o,a,r])}const D=({entity:n,withSearch:o=!0})=>{let a=(0,R.sM)(n);const r=O(a);if(n.metadata.annotations?.[m.GO])try{a=(0,R.KU)(n.metadata.annotations?.[m.GO])}catch{}const s=(0,A.oN)(n);return(0,e.jsxs)(M.Wj,{entityRef:a,children:[(0,e.jsx)(B.Z,{}),(0,e.jsx)(j.p,{withSearch:o,searchResultUrlMapper:r,defaultPath:s})]})};var C=t(85788),T=t(93160),L=t(99538),N=t(10394),Y=t(64947),F=t(58837),H=t(72501),U=t(44186),K=t(77310),I=t(72072);const W=(0,F.A)(n=>({code:{borderRadius:6,margin:n.spacing(2,0),background:n.palette.type==="dark"?"#444":n.palette.common.white}}),{name:"BackstageMissingAnnotationEmptyState"});function Z(n,o){const a=o?.kind||"Component",r=o?.metadata.name||"example",s=o?.spec?.type||"website",u=o?.spec?.owner||"user:default/guest",E=`apiVersion: backstage.io/v1alpha1
1
+ "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[5788,8803],{70048:($,f,t)=>{t.d(f,{K:()=>c});var e=t(18690);function c(R){return(0,e.g)()}},99538:($,f,t)=>{t.d(f,{T7:()=>j,TY:()=>p,tN:()=>S});var e=t(31085),c=t(6820),R=t(25862),m=t(43836),A=t(10602);const M=(0,m.tK)("entity-context"),j=g=>{const{children:v,entity:x,loading:O,error:D,refresh:C}=g,T={entity:x,loading:O,error:D,refresh:C};return(0,e.jsx)(M.Provider,{value:(0,A.B)({1:T}),children:(0,e.jsx)(R.Ig,{attributes:{...x?{entityRef:(0,c.U2)(x)}:void 0},children:v})})},B=g=>_jsx(j,{entity:g.entity,loading:!g.entity,error:void 0,refresh:void 0,children:g.children});function S(){const g=(0,m.qO)("entity-context");if(!g)throw new Error("Entity context is not available");const v=g.atVersion(1);if(!v)throw new Error("EntityContext v1 not available");if(!v.entity)throw new 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:v.entity}}function p(){const g=(0,m.qO)("entity-context");if(!g)throw new Error("Entity context is not available");const v=g.atVersion(1);if(!v)throw new Error("EntityContext v1 not available");const{entity:x,loading:O,error:D,refresh:C}=v;return{entity:x,loading:O,error:D,refresh:C}}},38803:($,f,t)=>{t.r(f),t.d(f,{EmbeddedDocsRouter:()=>z,LegacyEmbeddedDocsRouter:()=>y,Router:()=>G,TechDocsReaderRouter:()=>X,isTechDocsAvailable:()=>V});var e=t(31085),c=t(18690),R=t(6820),m=t(86202),A=t(65614),M=t(39278),j=t(13976),B=t(39299),S=t(14041),p=t(9222),g=t(82779);const v=n=>n.replace(/^\/+/,""),x=n=>n.replace(/\/+$/,"");function O(n){const{kind:o,name:a,namespace:r}=n,s=(0,p.S)(g.Oc),u=(0,p.S)(g.Ri);return(0,S.useMemo)(()=>{const d=x(s({kind:o,namespace:r,name:a})),i=x(u());return l=>{if(l.toLocaleLowerCase("en-US").startsWith(d.toLocaleLowerCase("en-US"))){const h=v(l.slice(d.length));return h.length===0||h.startsWith("#")?`${i}${h}`:`${i}/${h}`}return l}},[s,u,o,a,r])}const D=({entity:n,withSearch:o=!0})=>{let a=(0,R.sM)(n);const r=O(a);if(n.metadata.annotations?.[m.GO])try{a=(0,R.KU)(n.metadata.annotations?.[m.GO])}catch{}const s=(0,A.oN)(n);return(0,e.jsxs)(M.Wj,{entityRef:a,children:[(0,e.jsx)(B.Z,{}),(0,e.jsx)(j.p,{withSearch:o,searchResultUrlMapper:r,defaultPath:s})]})};var C=t(85788),T=t(93160),L=t(99538),N=t(10394),Y=t(64947),F=t(58837),H=t(72501),U=t(44186),K=t(77310),I=t(72072);const W=(0,F.A)(n=>({code:{borderRadius:6,margin:n.spacing(2,0),background:n.palette.type==="dark"?"#444":n.palette.common.white}}),{name:"BackstageMissingAnnotationEmptyState"});function Z(n,o){const a=o?.kind||"Component",r=o?.metadata.name||"example",s=o?.spec?.type||"website",u=o?.spec?.owner||"user:default/guest",E=`apiVersion: backstage.io/v1alpha1
2
2
  kind: ${a}
3
3
  metadata:
4
4
  name: ${r}
@@ -6,6 +6,6 @@ metadata:
6
6
  ${l}: value`).join("")}
7
7
  spec:
8
8
  type: ${s}
9
- owner: ${u}`;let d=6;const i=[];return n.forEach(()=>{i.push(d),d++}),{yamlText:E,lineNumbers:i}}function J(n,o="Component"){const a=n.length<=1;return(0,e.jsxs)(e.Fragment,{children:["The ",a?"annotation":"annotations"," ",n.map(r=>(0,e.jsx)("code",{children:r})).reduce((r,s)=>(0,e.jsxs)(e.Fragment,{children:[r,", ",s]}))," ",a?"is":"are"," missing. You need to add the"," ",a?"annotation":"annotations"," to your ",o," if you want to enable this tool."]})}function Q(n){let o;try{o=(0,L.tN)().entity}catch{}const{annotation:a,readMoreUrl:r}=n,s=Array.isArray(a)?a:[a],u=r||"https://backstage.io/docs/features/software-catalog/well-known-annotations",E=W(),d=o?.kind||"Component",{yamlText:i,lineNumbers:l}=Z(s,o);return(0,e.jsx)(U.p,{missing:"field",title:"Missing Annotation",description:J(s,d),action:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(H.A,{variant:"body1",children:["Add the annotation to your ",d," YAML as shown in the highlighted example below:"]}),(0,e.jsx)(N.A,{className:E.code,children:(0,e.jsx)(K.z,{text:i,language:"yaml",showLineNumbers:!0,highlightedNumbers:l,customStyle:{background:"inherit",fontSize:"115%"}})}),(0,e.jsx)(Y.A,{color:"primary",component:I.N_,to:u,children:"Read more"})]})})}const V=n=>!!n?.metadata?.annotations?.[m.As]||!!n?.metadata?.annotations?.[m.GO],G=()=>(0,e.jsxs)(c.BV,{children:[(0,e.jsx)(c.qh,{path:"/",element:(0,e.jsx)(C.TechDocsIndexPage,{})}),(0,e.jsx)(c.qh,{path:"/:namespace/:kind/:name/*",element:(0,e.jsx)(T.W,{})})]}),X=n=>{const{children:o}=n;return(0,c.Ye)([{path:"*",element:(0,e.jsx)(T.W,{}),children:[{path:"*",element:o}]}])},z=n=>{const{children:o,emptyState:a,withSearch:r=!0}=n,{entity:s}=(0,L.tN)(),u=(0,c.Ye)([{path:"/*",element:(0,e.jsx)(D,{entity:s,withSearch:r}),children:[{path:"*",element:o}]}]);return s.metadata.annotations?.[m.As]||s.metadata.annotations?.[m.GO]?u:a??(0,e.jsx)(Q,{annotation:[m.As]})},y=({children:n,withSearch:o=!0})=>(0,e.jsx)(z,{children:n,withSearch:o})},85788:($,f,t)=>{t.r(f),t.d(f,{TechDocsIndexPage:()=>m});var e=t(31085),c=t(18690),R=t(8915);const m=A=>(0,c.P1)()||(0,e.jsx)(R.K,{...A})},93160:($,f,t)=>{t.d(f,{b:()=>G,W:()=>z});var e=t(31085),c=t(14041),R=t(18690),m=t(24504),A=t(72020),M=t(88572),j=t(29729),B=t(45061),S=t(39299),p=t(82779),g=t(70048),v=t(19402),x=t(22020),O=t(82266),D=t(64947),C=t(72427),T=t(70795),L=t(57405),N=t(16261);function Y(y,n){const[o,a]=(0,c.useState)({status:"not-executed",error:void 0,result:n}),r=(0,c.useRef)(),s=(0,c.useRef)(),u=(0,N.J)({execute(...E){s.current=E;const d=y(...E);return r.current=d,a(i=>({...i,status:"loading"})),d.then(i=>{d===r.current&&a(l=>({...l,status:"success",error:void 0,result:i}))},i=>{d===r.current&&a(l=>({...l,status:"error",error:i}))}),d},reset(){a({status:"not-executed",error:void 0,result:n}),r.current=void 0,s.current=void 0}});return[o,(0,c.useMemo)(()=>({reset(){u.current.reset()},execute:(...E)=>u.current.execute(...E)}),[]),{promise:r.current,lastArgs:s.current}]}var F=t(76842),H=t(70835);const U="/.backstage/auth/v1/cookie",K=365*24*36e5;function I(y){const{pluginId:n}=y??{},o=(0,C.gf)(T.a),a=(0,C.gf)(L.I),r=(0,c.useMemo)(()=>"BroadcastChannel"in window?new BroadcastChannel(`${n}-auth-cookie-expires-at`):null,[n]),[s,u]=Y(async()=>{const l=`${await a.getBaseUrl(n)}${U}`,h=await o.fetch(`${l}`,{credentials:"include"});if(!h.ok){if(h.status===404)return{expiresAt:new Date(Date.now()+K)};throw await H.o.fromResponse(h)}const P=await h.json();if(!P.expiresAt)throw new Error("No expiration date found in response");return P});(0,F.u)(u.execute);const E=(0,c.useCallback)(()=>{u.execute()},[u]),d=(0,c.useCallback)(i=>{const l=(1+3*Math.random())*6e4,h=Date.parse(i.expiresAt)-Date.now()-l,P=setTimeout(E,h);return()=>clearTimeout(P)},[E]);return(0,c.useEffect)(()=>{if(s.status!=="success"||!s.result)return()=>{};r?.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:s.result});let i=d(s.result);const l=h=>{const{action:P,payload:b}=h.data;P==="COOKIE_REFRESH_SUCCESS"&&(i(),i=d(b))};return r?.addEventListener("message",l),()=>{i(),r?.removeEventListener("message",l)}},[s,d,r]),s.status==="not-executed"?{status:"loading"}:s.status==="loading"&&!s.result?{status:"loading"}:s.status==="loading"&&s.error?{status:"loading"}:s.status==="error"&&s.error?{status:"error",error:s.error,retry:E}:{status:"success",data:s.result}}function W(y){const{children:n,...o}=y,a=(0,O.n)(),{Progress:r}=a.getComponents(),s=I(o);return s.status==="loading"?(0,e.jsx)(r,{}):s.status==="error"?(0,e.jsx)(x.b,{error:s.error,children:(0,e.jsx)(D.A,{variant:"outlined",onClick:s.retry,children:"Retry"})}):(0,e.jsx)(e.Fragment,{children:n})}var Z=t(58502),J=t(54917),Q=t(98392),V=t(50868);const G=y=>{const{withSearch:n,withHeader:o=!0}=y;return(0,e.jsxs)(m.Y,{themeId:"documentation",children:[o&&(0,e.jsx)(B.T,{}),(0,e.jsx)(S.Z,{}),(0,e.jsx)(j.p,{withSearch:n})]})},X=(0,Z.A)(m.Y)({height:"inherit",overflowY:"visible"}),z=y=>{const n=(0,J.A)(),o=(0,Q.A)({...n,...y.overrideThemeOptions||{}}),{kind:a,name:r,namespace:s}=(0,g.K)(p.Oc),{children:u,entityRef:E={kind:a,name:r,namespace:s}}=y,d=(0,R.P1)();if(!u){const h=(d?c.Children.toArray(d.props.children):[]).flatMap(P=>P?.props?.children??[]).find(P=>!(0,v.E)(P,A.AF)&&!(0,v.E)(P,A.Wm));return(0,e.jsx)(V.A,{theme:o,children:(0,e.jsx)(W,{pluginId:"techdocs",children:(0,e.jsx)(M.R,{entityRef:E,children:h||(0,e.jsx)(G,{})})})})}return(0,e.jsx)(V.A,{theme:o,children:(0,e.jsx)(W,{pluginId:"techdocs",children:(0,e.jsx)(M.R,{entityRef:E,children:({metadata:i,entityMetadata:l,onReady:h})=>(0,e.jsx)(X,{themeId:"documentation",className:"techdocs-reader-page",children:u instanceof Function?u({entityRef:E,techdocsMetadataValue:i.value,entityMetadataValue:l.value,onReady:h}):u})})})})}},39299:($,f,t)=>{t.d(f,{Z:()=>O});var e=t(31085),c=t(14041),R=t(58837),m=t(29365),A=t(75173),M=t(71677),j=t(37757),B=t(10394),S=t(9684),p=t(88572),g=t(72020),v=t(99730);const x=(0,R.A)(D=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:D.spacing(3,3,0),"@media print":{display:"none"}}})),O=D=>{const C=x(),[T,L]=(0,c.useState)(null),N=(0,c.useCallback)(W=>{L(W.currentTarget)},[]),Y=(0,c.useCallback)(()=>{L(null)},[]),{entityMetadata:{value:F,loading:H}}=(0,p.V)(),U=(0,g.YR)(),K=U.renderComponentsByLocation(v.e.Subheader),I=U.renderComponentsByLocation(v.e.Settings);return!K&&!I||H===!1&&!F?null:(0,e.jsx)(A.A,{classes:C,...D.toolbarProps,children:(0,e.jsxs)(B.A,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[K,I?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(M.Ay,{title:"Settings",children:(0,e.jsx)(m.A,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:N,children:(0,e.jsx)(S.A,{})})}),(0,e.jsx)(j.A,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:T,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!!T,onClose:Y,keepMounted:!0,children:(0,e.jsx)("div",{children:I})})]}):null]})})}}}]);})();
9
+ owner: ${u}`;let d=6;const i=[];return n.forEach(()=>{i.push(d),d++}),{yamlText:E,lineNumbers:i}}function J(n,o="Component"){const a=n.length<=1;return(0,e.jsxs)(e.Fragment,{children:["The ",a?"annotation":"annotations"," ",n.map(r=>(0,e.jsx)("code",{children:r})).reduce((r,s)=>(0,e.jsxs)(e.Fragment,{children:[r,", ",s]}))," ",a?"is":"are"," missing. You need to add the"," ",a?"annotation":"annotations"," to your ",o," if you want to enable this tool."]})}function Q(n){let o;try{o=(0,L.tN)().entity}catch{}const{annotation:a,readMoreUrl:r}=n,s=Array.isArray(a)?a:[a],u=r||"https://backstage.io/docs/features/software-catalog/well-known-annotations",E=W(),d=o?.kind||"Component",{yamlText:i,lineNumbers:l}=Z(s,o);return(0,e.jsx)(U.p,{missing:"field",title:"Missing Annotation",description:J(s,d),action:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(H.A,{variant:"body1",children:["Add the annotation to your ",d," YAML as shown in the highlighted example below:"]}),(0,e.jsx)(N.A,{className:E.code,children:(0,e.jsx)(K.z,{text:i,language:"yaml",showLineNumbers:!0,highlightedNumbers:l,customStyle:{background:"inherit",fontSize:"115%"}})}),(0,e.jsx)(Y.A,{color:"primary",component:I.N_,to:u,children:"Read more"})]})})}const V=n=>!!n?.metadata?.annotations?.[m.As]||!!n?.metadata?.annotations?.[m.GO],G=()=>(0,e.jsxs)(c.BV,{children:[(0,e.jsx)(c.qh,{path:"/",element:(0,e.jsx)(C.TechDocsIndexPage,{})}),(0,e.jsx)(c.qh,{path:"/:namespace/:kind/:name/*",element:(0,e.jsx)(T.W,{})})]}),X=n=>{const{children:o}=n;return(0,c.Ye)([{path:"*",element:(0,e.jsx)(T.W,{}),children:[{path:"*",element:o}]}])},z=n=>{const{children:o,emptyState:a,withSearch:r=!0}=n,{entity:s}=(0,L.tN)(),u=(0,c.Ye)([{path:"/*",element:(0,e.jsx)(D,{entity:s,withSearch:r}),children:[{path:"*",element:o}]}]);return s.metadata.annotations?.[m.As]||s.metadata.annotations?.[m.GO]?u:a??(0,e.jsx)(Q,{annotation:[m.As]})},y=({children:n,withSearch:o=!0})=>(0,e.jsx)(z,{children:n,withSearch:o})},85788:($,f,t)=>{t.r(f),t.d(f,{TechDocsIndexPage:()=>m});var e=t(31085),c=t(18690),R=t(8915);const m=A=>(0,c.P1)()||(0,e.jsx)(R.K,{...A})},93160:($,f,t)=>{t.d(f,{b:()=>G,W:()=>z});var e=t(31085),c=t(14041),R=t(18690),m=t(24504),A=t(72020),M=t(88572),j=t(13976),B=t(45061),S=t(39299),p=t(82779),g=t(70048),v=t(19402),x=t(22020),O=t(82266),D=t(64947),C=t(72427),T=t(70795),L=t(57405),N=t(16261);function Y(y,n){const[o,a]=(0,c.useState)({status:"not-executed",error:void 0,result:n}),r=(0,c.useRef)(),s=(0,c.useRef)(),u=(0,N.J)({execute(...E){s.current=E;const d=y(...E);return r.current=d,a(i=>({...i,status:"loading"})),d.then(i=>{d===r.current&&a(l=>({...l,status:"success",error:void 0,result:i}))},i=>{d===r.current&&a(l=>({...l,status:"error",error:i}))}),d},reset(){a({status:"not-executed",error:void 0,result:n}),r.current=void 0,s.current=void 0}});return[o,(0,c.useMemo)(()=>({reset(){u.current.reset()},execute:(...E)=>u.current.execute(...E)}),[]),{promise:r.current,lastArgs:s.current}]}var F=t(76842),H=t(70835);const U="/.backstage/auth/v1/cookie",K=365*24*36e5;function I(y){const{pluginId:n}=y??{},o=(0,C.gf)(T.a),a=(0,C.gf)(L.I),r=(0,c.useMemo)(()=>"BroadcastChannel"in window?new BroadcastChannel(`${n}-auth-cookie-expires-at`):null,[n]),[s,u]=Y(async()=>{const l=`${await a.getBaseUrl(n)}${U}`,h=await o.fetch(`${l}`,{credentials:"include"});if(!h.ok){if(h.status===404)return{expiresAt:new Date(Date.now()+K)};throw await H.o.fromResponse(h)}const P=await h.json();if(!P.expiresAt)throw new Error("No expiration date found in response");return P});(0,F.u)(u.execute);const E=(0,c.useCallback)(()=>{u.execute()},[u]),d=(0,c.useCallback)(i=>{const l=(1+3*Math.random())*6e4,h=Date.parse(i.expiresAt)-Date.now()-l,P=setTimeout(E,h);return()=>clearTimeout(P)},[E]);return(0,c.useEffect)(()=>{if(s.status!=="success"||!s.result)return()=>{};r?.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:s.result});let i=d(s.result);const l=h=>{const{action:P,payload:b}=h.data;P==="COOKIE_REFRESH_SUCCESS"&&(i(),i=d(b))};return r?.addEventListener("message",l),()=>{i(),r?.removeEventListener("message",l)}},[s,d,r]),s.status==="not-executed"?{status:"loading"}:s.status==="loading"&&!s.result?{status:"loading"}:s.status==="loading"&&s.error?{status:"loading"}:s.status==="error"&&s.error?{status:"error",error:s.error,retry:E}:{status:"success",data:s.result}}function W(y){const{children:n,...o}=y,a=(0,O.n)(),{Progress:r}=a.getComponents(),s=I(o);return s.status==="loading"?(0,e.jsx)(r,{}):s.status==="error"?(0,e.jsx)(x.b,{error:s.error,children:(0,e.jsx)(D.A,{variant:"outlined",onClick:s.retry,children:"Retry"})}):(0,e.jsx)(e.Fragment,{children:n})}var Z=t(58502),J=t(54917),Q=t(98392),V=t(50868);const G=y=>{const{withSearch:n,withHeader:o=!0}=y;return(0,e.jsxs)(m.Y,{themeId:"documentation",children:[o&&(0,e.jsx)(B.T,{}),(0,e.jsx)(S.Z,{}),(0,e.jsx)(j.p,{withSearch:n})]})},X=(0,Z.A)(m.Y)({height:"inherit",overflowY:"visible"}),z=y=>{const n=(0,J.A)(),o=(0,Q.A)({...n,...y.overrideThemeOptions||{}}),{kind:a,name:r,namespace:s}=(0,g.K)(p.Oc),{children:u,entityRef:E={kind:a,name:r,namespace:s}}=y,d=(0,R.P1)();if(!u){const h=(d?c.Children.toArray(d.props.children):[]).flatMap(P=>P?.props?.children??[]).find(P=>!(0,v.E)(P,A.AF)&&!(0,v.E)(P,A.Wm));return(0,e.jsx)(V.A,{theme:o,children:(0,e.jsx)(W,{pluginId:"techdocs",children:(0,e.jsx)(M.R,{entityRef:E,children:h||(0,e.jsx)(G,{})})})})}return(0,e.jsx)(V.A,{theme:o,children:(0,e.jsx)(W,{pluginId:"techdocs",children:(0,e.jsx)(M.R,{entityRef:E,children:({metadata:i,entityMetadata:l,onReady:h})=>(0,e.jsx)(X,{themeId:"documentation",className:"techdocs-reader-page",children:u instanceof Function?u({entityRef:E,techdocsMetadataValue:i.value,entityMetadataValue:l.value,onReady:h}):u})})})})}},39299:($,f,t)=>{t.d(f,{Z:()=>O});var e=t(31085),c=t(14041),R=t(58837),m=t(29365),A=t(75173),M=t(71677),j=t(37757),B=t(10394),S=t(9684),p=t(88572),g=t(72020),v=t(99730);const x=(0,R.A)(D=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:D.spacing(3,3,0),"@media print":{display:"none"}}})),O=D=>{const C=x(),[T,L]=(0,c.useState)(null),N=(0,c.useCallback)(W=>{L(W.currentTarget)},[]),Y=(0,c.useCallback)(()=>{L(null)},[]),{entityMetadata:{value:F,loading:H}}=(0,p.V)(),U=(0,g.YR)(),K=U.renderComponentsByLocation(v.e.Subheader),I=U.renderComponentsByLocation(v.e.Settings);return!K&&!I||H===!1&&!F?null:(0,e.jsx)(A.A,{classes:C,...D.toolbarProps,children:(0,e.jsxs)(B.A,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[K,I?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(M.Ay,{title:"Settings",children:(0,e.jsx)(m.A,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:N,children:(0,e.jsx)(S.A,{})})}),(0,e.jsx)(j.A,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:T,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!!T,onClose:Y,keepMounted:!0,children:(0,e.jsx)("div",{children:I})})]}):null]})})}}}]);})();
10
10
 
11
- //# sourceMappingURL=8803.ea659624.chunk.js.map
11
+ //# sourceMappingURL=8803.48dd4e23.chunk.js.map