@techdocs/cli 1.10.2 → 1.10.3-next.0

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/embedded-app/.config-schema.json +145 -145
  3. package/dist/embedded-app/index.html +1 -1
  4. package/dist/embedded-app/index.html.tmpl +1 -1
  5. package/dist/embedded-app/static/1155.1bc918a1.chunk.js +10 -0
  6. package/dist/embedded-app/static/{1155.c6c120ba.chunk.js.map → 1155.1bc918a1.chunk.js.map} +1 -1
  7. package/dist/embedded-app/static/{1335.e649d01a.chunk.js → 1335.d9759037.chunk.js} +2 -2
  8. package/dist/embedded-app/static/{1335.e649d01a.chunk.js.map → 1335.d9759037.chunk.js.map} +1 -1
  9. package/dist/embedded-app/static/{1749.ecaae025.chunk.js → 1749.aa6bc589.chunk.js} +2 -2
  10. package/dist/embedded-app/static/{1749.ecaae025.chunk.js.map → 1749.aa6bc589.chunk.js.map} +1 -1
  11. package/dist/embedded-app/static/{1994.90be16c3.chunk.js → 1994.ca9d4fc1.chunk.js} +2 -2
  12. package/dist/embedded-app/static/{1994.90be16c3.chunk.js.map → 1994.ca9d4fc1.chunk.js.map} +1 -1
  13. package/dist/embedded-app/static/{2295.676254a6.chunk.js → 2295.3f44c986.chunk.js} +2 -2
  14. package/dist/embedded-app/static/{2295.676254a6.chunk.js.map → 2295.3f44c986.chunk.js.map} +1 -1
  15. package/dist/embedded-app/static/{4591.c7904e2c.chunk.js → 4591.5aa5d796.chunk.js} +2 -2
  16. package/dist/embedded-app/static/{4591.c7904e2c.chunk.js.map → 4591.5aa5d796.chunk.js.map} +1 -1
  17. package/dist/embedded-app/static/{4648.42e253c5.chunk.js → 4648.68d2c6ff.chunk.js} +2 -2
  18. package/dist/embedded-app/static/{4648.42e253c5.chunk.js.map → 4648.68d2c6ff.chunk.js.map} +1 -1
  19. package/dist/embedded-app/static/{5574.3e0b1b01.chunk.js → 5574.723a5e64.chunk.js} +2 -2
  20. package/dist/embedded-app/static/{5574.3e0b1b01.chunk.js.map → 5574.723a5e64.chunk.js.map} +1 -1
  21. package/dist/embedded-app/static/{7203.f047878f.chunk.js → 6138.ca5f4dea.chunk.js} +2 -2
  22. package/dist/embedded-app/static/{6138.72f63616.chunk.js.map → 6138.ca5f4dea.chunk.js.map} +1 -1
  23. package/dist/embedded-app/static/6270.33cbf043.chunk.js +2 -0
  24. package/dist/embedded-app/static/{6270.0cf24ebb.chunk.js.map → 6270.33cbf043.chunk.js.map} +1 -1
  25. package/dist/embedded-app/static/7186.96e6edf9.chunk.js +2 -0
  26. package/dist/embedded-app/static/{7186.c0fa7899.chunk.js.map → 7186.96e6edf9.chunk.js.map} +1 -1
  27. package/dist/embedded-app/static/{6138.72f63616.chunk.js → 7203.7288c4e0.chunk.js} +2 -2
  28. package/dist/embedded-app/static/{7203.f047878f.chunk.js.map → 7203.7288c4e0.chunk.js.map} +1 -1
  29. package/dist/embedded-app/static/7226.99db194a.chunk.js +2 -0
  30. package/dist/embedded-app/static/{7226.f8fc7544.chunk.js.map → 7226.99db194a.chunk.js.map} +1 -1
  31. package/dist/embedded-app/static/{7382.688a734f.chunk.js → 7382.836db1c7.chunk.js} +2 -2
  32. package/dist/embedded-app/static/{7382.688a734f.chunk.js.map → 7382.836db1c7.chunk.js.map} +1 -1
  33. package/dist/embedded-app/static/7526.601d8e47.chunk.js +2 -0
  34. package/dist/embedded-app/static/{7526.a9e2aca8.chunk.js.map → 7526.601d8e47.chunk.js.map} +1 -1
  35. package/dist/embedded-app/static/{8125.d73ed16d.chunk.js → 8125.2e82046f.chunk.js} +3 -3
  36. package/dist/embedded-app/static/{8125.d73ed16d.chunk.js.map → 8125.2e82046f.chunk.js.map} +1 -1
  37. package/dist/embedded-app/static/{9050.47091371.chunk.js → 9050.1b486cae.chunk.js} +2 -2
  38. package/dist/embedded-app/static/{9050.47091371.chunk.js.map → 9050.1b486cae.chunk.js.map} +1 -1
  39. package/dist/embedded-app/static/{9230.57f4ae14.chunk.js → 9230.02b12ff0.chunk.js} +2 -2
  40. package/dist/embedded-app/static/{9230.57f4ae14.chunk.js.map → 9230.02b12ff0.chunk.js.map} +1 -1
  41. package/dist/embedded-app/static/{9579.46a875e3.chunk.js → 9579.beaea584.chunk.js} +2 -2
  42. package/dist/embedded-app/static/{9579.46a875e3.chunk.js.map → 9579.beaea584.chunk.js.map} +1 -1
  43. package/dist/embedded-app/static/main.9f641a04.js +550 -0
  44. package/dist/embedded-app/static/main.9f641a04.js.map +1 -0
  45. package/dist/embedded-app/static/{runtime.1ed9627a.js → runtime.89b37e56.js} +2 -2
  46. package/dist/embedded-app/static/{runtime.1ed9627a.js.map → runtime.89b37e56.js.map} +1 -1
  47. package/dist/package.json.cjs.js +1 -1
  48. package/package.json +7 -7
  49. package/dist/embedded-app/static/1155.c6c120ba.chunk.js +0 -10
  50. package/dist/embedded-app/static/6270.0cf24ebb.chunk.js +0 -2
  51. package/dist/embedded-app/static/7186.c0fa7899.chunk.js +0 -2
  52. package/dist/embedded-app/static/7226.f8fc7544.chunk.js +0 -2
  53. package/dist/embedded-app/static/7526.a9e2aca8.chunk.js +0 -2
  54. package/dist/embedded-app/static/main.a9a0a87c.js +0 -550
  55. package/dist/embedded-app/static/main.a9a0a87c.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"static/6270.0cf24ebb.chunk.js","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","webpack://techdocs-cli-embedded-app/../../node_modules/@react-hookz/web/src/useAsync/index.js","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/useExternalRedirect.ts","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport { ErrorPanel } from '@backstage/core-components';\nimport { useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport { useCookieAuthRefresh } from '../../hooks';\n\n/**\n * @public\n * Props for the {@link CookieAuthRefreshProvider} component.\n */\nexport type CookieAuthRefreshProviderProps = {\n // The plugin ID used for discovering the API origin\n pluginId: string;\n // The children to render when the refresh is successful\n children: ReactNode;\n};\n\n/**\n * @public\n * A provider that will refresh the cookie when it is about to expire.\n */\nexport function CookieAuthRefreshProvider(\n props: CookieAuthRefreshProviderProps,\n): JSX.Element {\n const { children, ...options } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n\n const result = useCookieAuthRefresh(options);\n\n if (result.status === 'loading') {\n return <Progress />;\n }\n\n if (result.status === 'error') {\n return (\n <ErrorPanel error={result.error}>\n <Button variant=\"outlined\" onClick={result.retry}>\n Retry\n </Button>\n </ErrorPanel>\n );\n }\n\n return <>{children}</>;\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useCallback, useMemo } from 'react';\nimport {\n discoveryApiRef,\n fetchApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsync, useMountEffect } from '@react-hookz/web';\nimport { ResponseError } from '@backstage/errors';\n\nconst COOKIE_PATH = '/.backstage/auth/v1/cookie';\nconst ONE_YEAR_MS = 365 * 24 * 3600_000;\n\n/**\n * @public\n * A hook that will refresh the cookie when it is about to expire.\n * @param options - Options for configuring the refresh cookie endpoint\n */\nexport function useCookieAuthRefresh(options: {\n // The plugin id used for discovering the API origin\n pluginId: string;\n}):\n | { status: 'loading' }\n | { status: 'error'; error: Error; retry: () => void }\n | { status: 'success'; data: { expiresAt: string } } {\n const { pluginId } = options ?? {};\n const fetchApi = useApi(fetchApiRef);\n const discoveryApi = useApi(discoveryApiRef);\n\n const channel = useMemo(() => {\n return 'BroadcastChannel' in window\n ? new BroadcastChannel(`${pluginId}-auth-cookie-expires-at`)\n : null;\n }, [pluginId]);\n\n const [state, actions] = useAsync<{ expiresAt: string }>(async () => {\n const apiOrigin = await discoveryApi.getBaseUrl(pluginId);\n const requestUrl = `${apiOrigin}${COOKIE_PATH}`;\n const response = await fetchApi.fetch(`${requestUrl}`, {\n credentials: 'include',\n });\n if (!response.ok) {\n // If we get a 404 from the cookie endpoint we assume that it does not\n // exist and cookie auth is not needed. For all active tabs we don't\n // schedule another refresh for the foreseeable future, but new tabs will\n // still check if cookie auth has been added to the deployment.\n // TODO(Rugvip): Once the legacy backend system is no longer supported we should remove this check\n if (response.status === 404) {\n return { expiresAt: new Date(Date.now() + ONE_YEAR_MS) };\n }\n throw await ResponseError.fromResponse(response);\n }\n const data = await response.json();\n if (!data.expiresAt) {\n throw new Error('No expiration date found in response');\n }\n return data;\n });\n\n useMountEffect(actions.execute);\n\n const retry = useCallback(() => {\n actions.execute();\n }, [actions]);\n\n const refresh = useCallback(\n (params: { expiresAt: string }) => {\n // Randomize the refreshing margin with a margin of 1-4 minutes to avoid all tabs refreshing at the same time\n // It cannot be less than 5 minutes otherwise the backend will return the same expiration date\n const margin = (1 + 3 * Math.random()) * 60000;\n const delay = Date.parse(params.expiresAt) - Date.now() - margin;\n const timeout = setTimeout(retry, delay);\n return () => clearTimeout(timeout);\n },\n [retry],\n );\n\n useEffect(() => {\n // Only schedule a refresh if we have a successful response\n if (state.status !== 'success' || !state.result) {\n return () => {};\n }\n channel?.postMessage({\n action: 'COOKIE_REFRESH_SUCCESS',\n payload: state.result,\n });\n let cancel = refresh(state.result);\n const listener = (\n event: MessageEvent<{ action: string; payload: { expiresAt: string } }>,\n ) => {\n const { action, payload } = event.data;\n if (action === 'COOKIE_REFRESH_SUCCESS') {\n cancel();\n cancel = refresh(payload);\n }\n };\n channel?.addEventListener('message', listener);\n return () => {\n cancel();\n channel?.removeEventListener('message', listener);\n };\n }, [state, refresh, channel]);\n\n // Initialising\n if (state.status === 'not-executed') {\n return { status: 'loading' };\n }\n\n // First refresh or retrying without any success before\n // Possible state transitions:\n // e.g. not-executed -> loading (first-refresh)\n // e.g. not-executed -> loading (first-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && !state.result) {\n return { status: 'loading' };\n }\n\n // Retrying after having succeeding at least once\n // Current state is: { status: 'loading', result: {...}, error: undefined | Error }\n // e.g. not-executed -> loading (first-refresh) -> success -> loading (scheduled-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && state.error) {\n return { status: 'loading' };\n }\n\n // Something went wrong during any situation of a refresh\n if (state.status === 'error' && state.error) {\n return { status: 'error', error: state.error, retry };\n }\n\n // At this point it should be safe to assume that we have a successful refresh\n return { status: 'success', data: state.result! };\n}\n","import { useMemo, useRef, useState } from 'react';\nimport { useSyncedRef } from '../useSyncedRef/index.js';\nexport function useAsync(asyncFn, initialValue) {\n const [state, setState] = useState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n const promiseRef = useRef();\n const argsRef = useRef();\n const methods = useSyncedRef({\n execute(...params) {\n argsRef.current = params;\n const promise = asyncFn(...params);\n promiseRef.current = promise;\n setState((s) => ({ ...s, status: 'loading' }));\n promise.then((result) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'success', error: undefined, result }));\n }\n }, (error) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'error', error }));\n }\n });\n return promise;\n },\n reset() {\n setState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n promiseRef.current = undefined;\n argsRef.current = undefined;\n },\n });\n return [\n state,\n useMemo(() => ({\n reset() {\n methods.current.reset();\n },\n execute: (...params) => methods.current.execute(...params),\n }), []),\n { promise: promiseRef.current, lastArgs: argsRef.current },\n ];\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Children, ReactElement, ReactNode, useMemo } from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport { Page, Progress } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_KEY,\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\nimport {\n createTheme,\n styled,\n ThemeOptions,\n ThemeProvider,\n useTheme,\n} from '@material-ui/core/styles';\nimport { useExternalRedirect } from './useExternalRedirect';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n overrideThemeOptions?: Partial<ThemeOptions>;\n};\n\n/**\n * Styled Backstage Page that fills available vertical space\n */\nconst StyledPage = styled(Page)({\n height: 'inherit',\n overflowY: 'visible',\n});\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const currentTheme = useTheme();\n\n const readerPageTheme = useMemo(\n () =>\n createTheme({\n ...currentTheme,\n ...(props.overrideThemeOptions || {}),\n }),\n [currentTheme, props.overrideThemeOptions],\n );\n\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n const memoizedEntityRef = useMemo(\n () => ({\n kind: entityRef.kind,\n name: entityRef.name,\n namespace: entityRef.namespace,\n }),\n [entityRef.kind, entityRef.name, entityRef.namespace],\n );\n\n // Check for external TechDocs redirects and handle navigation\n const { shouldShowProgress } = useExternalRedirect(memoizedEntityRef);\n\n const page: ReactNode = useMemo(() => {\n if (children) {\n return null;\n }\n\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n return grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n }, [children, outlet]);\n\n // Show full-page loading spinner when checking for external redirects or about to redirect.\n // This replaces the entire page content (header, sidebar, and documentation).\n if (shouldShowProgress) {\n return <Progress />;\n }\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n if (!children) {\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={memoizedEntityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n }\n\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={memoizedEntityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <StyledPage\n themeId=\"documentation\"\n className=\"techdocs-reader-page\"\n >\n {children instanceof Function\n ? children({\n entityRef: memoizedEntityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </StyledPage>\n )}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n};\n","/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useRef } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport {\n CompoundEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { buildTechDocsURL } from '@backstage/plugin-techdocs-react';\nimport { TECHDOCS_EXTERNAL_ANNOTATION } from '@backstage/plugin-techdocs-common';\nimport { rootDocsRouteRef } from '../../../routes';\n\n/**\n * Hook to handle external TechDocs redirects based on entity annotations.\n * Checks if an entity has the `backstage.io/techdocs-entity` annotation and\n * redirects to the external TechDocs URL if present.\n *\n * @param entityRef - The entity reference to check for external redirects\n * @returns Object containing loading state and whether a redirect is in progress\n *\n * @internal\n */\nexport function useExternalRedirect(entityRef: CompoundEntityRef): {\n loading: boolean;\n shouldShowProgress: boolean;\n} {\n const catalogApi = useApi(catalogApiRef);\n const navigate = useNavigate();\n const viewTechdocLink = useRouteRef(rootDocsRouteRef);\n\n // Create a stable string key for the entity to use as a dependency.\n // This ensures the useAsync hook only re-runs when the entity changes,\n // preventing redundant API calls during sub-page navigation within the same entity's documentation.\n const entityKey = stringifyEntityRef(entityRef);\n // Track which entity we've already checked to avoid redundant checks\n // when navigating between pages within the same entity's documentation.\n const checkedEntityRef = useRef<string | null>(null);\n const shouldCheckForRedirect = checkedEntityRef.current !== entityKey;\n\n // Check if this entity should redirect to external TechDocs\n const externalRedirectResult = useAsync(async () => {\n try {\n const catalogEntity = await catalogApi.getEntityByRef(entityRef);\n\n if (\n catalogEntity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]\n ) {\n return buildTechDocsURL(catalogEntity, viewTechdocLink);\n }\n } catch (error) {\n // Ignore errors and allow the current entity's TechDocs to load.\n // This handles cases where the catalog API is unavailable or the entity doesn't exist.\n }\n\n return undefined;\n }, [entityKey, catalogApi]);\n\n useEffect(() => {\n // Navigate to external TechDocs if a redirect URL is available\n if (!externalRedirectResult.loading && externalRedirectResult.value) {\n navigate(externalRedirectResult.value, { replace: true });\n }\n\n // Mark entity as checked once we've determined there's no redirect needed.\n // This prevents the entire page from unmounting/remounting (showing Progress spinner)\n // on subsequent sub-page navigation within the same entity.\n if (!externalRedirectResult.loading && !externalRedirectResult.value) {\n checkedEntityRef.current = entityKey;\n }\n }, [\n externalRedirectResult.loading,\n externalRedirectResult.value,\n navigate,\n entityKey,\n ]);\n\n // Determine if we should show a loading indicator (which replaces the entire page with a Progress spinner).\n // Only show it when: 1) checking a new/unchecked entity, or 2) we have a redirect URL and are navigating.\n const shouldShowProgress =\n (shouldCheckForRedirect && externalRedirectResult.loading) ||\n !!externalRedirectResult.value;\n\n return {\n loading: externalRedirectResult.loading,\n shouldShowProgress,\n };\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MouseEvent, useState, useCallback } from 'react';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { ToolbarProps } from '@material-ui/core/Toolbar';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Menu from '@material-ui/core/Menu';\nimport Box from '@material-ui/core/Box';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport {\n TechDocsAddonLocations as locations,\n useTechDocsAddons,\n useTechDocsReaderPage,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageSubheader',\n flexDirection: 'column',\n minHeight: 'auto',\n padding: theme.spacing(3, 3, 0),\n '@media print': {\n display: 'none',\n },\n },\n}));\n\n/**\n * Renders the reader page subheader.\n * Please use the Tech Docs add-ons to customize it\n * @public\n */\nexport const TechDocsReaderPageSubheader = (props: {\n toolbarProps?: ToolbarProps;\n}) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const handleClose = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const {\n entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },\n } = useTechDocsReaderPage();\n\n const addons = useTechDocsAddons();\n\n const subheaderAddons = addons.renderComponentsByLocation(\n locations.Subheader,\n );\n\n const settingsAddons = addons.renderComponentsByLocation(locations.Settings);\n\n if (!subheaderAddons && !settingsAddons) return null;\n\n // No entity metadata = 404. Don't render subheader on 404.\n if (entityMetadataLoading === false && !entityMetadata) return null;\n\n return (\n <Toolbar classes={classes} {...props.toolbarProps}>\n <Box\n display=\"flex\"\n justifyContent=\"flex-end\"\n width=\"100%\"\n flexWrap=\"wrap\"\n >\n {subheaderAddons}\n {settingsAddons ? (\n <>\n <Tooltip title=\"Settings\">\n <IconButton\n aria-controls=\"tech-docs-reader-page-settings\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n >\n <SettingsIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"tech-docs-reader-page-settings\"\n getContentAnchorEl={null}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n open={Boolean(anchorEl)}\n onClose={handleClose}\n keepMounted\n >\n <div>{settingsAddons}</div>\n </Menu>\n </>\n ) : null}\n </Box>\n </Toolbar>\n );\n};\n"],"names":["useRouteRefParams","_routeRef","useParams","CookieAuthRefreshProvider","props","children","options","Progress","app","useApp","result","useCookieAuthRefresh","pluginId","fetchApi","useApi","fetchApiRef","discoveryApi","discoveryApiRef","channel","useMemo","window","BroadcastChannel","state","actions","useAsync","e","apiOrigin","requestUrl","response","Date","ResponseError","data","Error","useMountEffect","retry","useCallback","refresh","params","margin","Math","timeout","setTimeout","clearTimeout","useEffect","cancel","listener","event","action","payload","ErrorPanel","Button","TechDocsReaderLayout","withSearch","withHeader","Page","TechDocsReaderPageHeader","TechDocsReaderPageSubheader","TechDocsReaderPageContent","StyledPage","styled","TechDocsReaderPage","catalogApi","navigate","viewTechdocLink","entityKey","checkedEntityRef","shouldCheckForRedirect","externalRedirectResult","shouldShowProgress","currentTheme","useTheme","readerPageTheme","createTheme","kind","name","namespace","rootDocsRouteRef","entityRef","outlet","useOutlet","memoizedEntityRef","catalogApiRef","useNavigate","useRouteRef","stringifyEntityRef","useRef","catalogEntity","TECHDOCS_EXTERNAL_ANNOTATION","buildTechDocsURL","error","page","grandChildren","childrenList","Children","child","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","ThemeProvider","TechDocsReaderPageProvider","metadata","entityMetadata","onReady","Function","useStyles","makeStyles","theme","classes","anchorEl","setAnchorEl","useState","handleClick","handleClose","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","locations","settingsAddons","Toolbar","Box","Tooltip","IconButton","SettingsIcon","Menu","Boolean"],"mappings":"+KAwBO,SAASA,EACdC,CAAiD,EAEjD,MAAOC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,GACT,C,6RCSO,SAASC,EACdC,CAAqC,EAErC,GAAM,CAAEC,SAAAA,CAAQ,CAAE,GAAGC,EAAS,CAAGF,EAE3B,CAAEG,SAAAA,CAAQ,CAAE,CAAGC,AADTC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,IACa,aAAa,GAEhCC,EAASC,ACXV,SAA8BL,CAGpC,EAIC,GAAM,CAAEM,SAAAA,CAAQ,CAAE,CAAGN,GAAW,CAAC,EAC3BO,EAAWC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EAAOC,EAAAA,CAAWA,EAC7BC,EAAeF,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EAAOG,EAAAA,CAAeA,EAErCC,EAAUC,AAAAA,GAAAA,EAAAA,OAAAA,AAAAA,EAAQ,IACf,qBAAsBC,OACzB,IAAIC,iBAAiB,CAAC,EAAET,EAAS,uBAAuB,CAAC,EACzD,KACH,CAACA,EAAS,EAEP,CAACU,EAAOC,EAAQ,CAAGC,AChDpB,SAAkB,CAAO,CAAE,CAAY,EAC1C,GAAM,CAAC,EAAO,EAAS,CAAG,eAAS,CAC/B,OAAQ,eACR,MAAO,OACP,OAJ0B,M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CAAa,EAGnD,UAACmB,EAAAA,CAAOA,CAAAA,CAAC,QAASb,EAAU,GAAGxG,EAAM,YAAY,C,SAC/C,WAACsH,EAAAA,CAAGA,CAAAA,CACF,QAAQ,OACR,eAAe,WACf,MAAM,OACN,SAAS,O,UAERJ,EACAE,EACC,uB,UACE,UAACG,EAAAA,EAAOA,CAAAA,CAAC,MAAM,W,SACb,UAACC,EAAAA,CAAUA,CAAAA,CACT,gBAAc,iCACd,gBAAc,OACd,QAASZ,E,SAET,UAACa,EAAAA,OAAYA,CAAAA,CAAAA,E,KAGjB,UAACC,EAAAA,CAAIA,CAAAA,CACH,GAAG,iCACH,mBAAoB,KACpB,SAAUjB,EACV,aAAc,CAAE,SAAU,SAAU,WAAY,OAAQ,EACxD,KAAMkB,EAAQlB,EACd,QAASI,EACT,YAAW,G,SAEX,UAAC,O,SAAKO,C,QAGR,K,KArCsC,IAyClD,C"}
1
+ {"version":3,"file":"static/6270.33cbf043.chunk.js","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","webpack://techdocs-cli-embedded-app/../../node_modules/@react-hookz/web/src/useAsync/index.js","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/useExternalRedirect.ts","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport { ErrorPanel } from '@backstage/core-components';\nimport { useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport { useCookieAuthRefresh } from '../../hooks';\n\n/**\n * @public\n * Props for the {@link CookieAuthRefreshProvider} component.\n */\nexport type CookieAuthRefreshProviderProps = {\n // The plugin ID used for discovering the API origin\n pluginId: string;\n // The children to render when the refresh is successful\n children: ReactNode;\n};\n\n/**\n * @public\n * A provider that will refresh the cookie when it is about to expire.\n */\nexport function CookieAuthRefreshProvider(\n props: CookieAuthRefreshProviderProps,\n): JSX.Element {\n const { children, ...options } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n\n const result = useCookieAuthRefresh(options);\n\n if (result.status === 'loading') {\n return <Progress />;\n }\n\n if (result.status === 'error') {\n return (\n <ErrorPanel error={result.error}>\n <Button variant=\"outlined\" onClick={result.retry}>\n Retry\n </Button>\n </ErrorPanel>\n );\n }\n\n return <>{children}</>;\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useCallback, useMemo } from 'react';\nimport {\n discoveryApiRef,\n fetchApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsync, useMountEffect } from '@react-hookz/web';\nimport { ResponseError } from '@backstage/errors';\n\nconst COOKIE_PATH = '/.backstage/auth/v1/cookie';\nconst ONE_YEAR_MS = 365 * 24 * 3600_000;\n\n/**\n * @public\n * A hook that will refresh the cookie when it is about to expire.\n * @param options - Options for configuring the refresh cookie endpoint\n */\nexport function useCookieAuthRefresh(options: {\n // The plugin id used for discovering the API origin\n pluginId: string;\n}):\n | { status: 'loading' }\n | { status: 'error'; error: Error; retry: () => void }\n | { status: 'success'; data: { expiresAt: string } } {\n const { pluginId } = options ?? {};\n const fetchApi = useApi(fetchApiRef);\n const discoveryApi = useApi(discoveryApiRef);\n\n const channel = useMemo(() => {\n return 'BroadcastChannel' in window\n ? new BroadcastChannel(`${pluginId}-auth-cookie-expires-at`)\n : null;\n }, [pluginId]);\n\n const [state, actions] = useAsync<{ expiresAt: string }>(async () => {\n const apiOrigin = await discoveryApi.getBaseUrl(pluginId);\n const requestUrl = `${apiOrigin}${COOKIE_PATH}`;\n const response = await fetchApi.fetch(`${requestUrl}`, {\n credentials: 'include',\n });\n if (!response.ok) {\n // If we get a 404 from the cookie endpoint we assume that it does not\n // exist and cookie auth is not needed. For all active tabs we don't\n // schedule another refresh for the foreseeable future, but new tabs will\n // still check if cookie auth has been added to the deployment.\n // TODO(Rugvip): Once the legacy backend system is no longer supported we should remove this check\n if (response.status === 404) {\n return { expiresAt: new Date(Date.now() + ONE_YEAR_MS) };\n }\n throw await ResponseError.fromResponse(response);\n }\n const data = await response.json();\n if (!data.expiresAt) {\n throw new Error('No expiration date found in response');\n }\n return data;\n });\n\n useMountEffect(actions.execute);\n\n const retry = useCallback(() => {\n actions.execute();\n }, [actions]);\n\n const refresh = useCallback(\n (params: { expiresAt: string }) => {\n // Randomize the refreshing margin with a margin of 1-4 minutes to avoid all tabs refreshing at the same time\n // It cannot be less than 5 minutes otherwise the backend will return the same expiration date\n const margin = (1 + 3 * Math.random()) * 60000;\n const delay = Date.parse(params.expiresAt) - Date.now() - margin;\n const timeout = setTimeout(retry, delay);\n return () => clearTimeout(timeout);\n },\n [retry],\n );\n\n useEffect(() => {\n // Only schedule a refresh if we have a successful response\n if (state.status !== 'success' || !state.result) {\n return () => {};\n }\n channel?.postMessage({\n action: 'COOKIE_REFRESH_SUCCESS',\n payload: state.result,\n });\n let cancel = refresh(state.result);\n const listener = (\n event: MessageEvent<{ action: string; payload: { expiresAt: string } }>,\n ) => {\n const { action, payload } = event.data;\n if (action === 'COOKIE_REFRESH_SUCCESS') {\n cancel();\n cancel = refresh(payload);\n }\n };\n channel?.addEventListener('message', listener);\n return () => {\n cancel();\n channel?.removeEventListener('message', listener);\n };\n }, [state, refresh, channel]);\n\n // Initialising\n if (state.status === 'not-executed') {\n return { status: 'loading' };\n }\n\n // First refresh or retrying without any success before\n // Possible state transitions:\n // e.g. not-executed -> loading (first-refresh)\n // e.g. not-executed -> loading (first-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && !state.result) {\n return { status: 'loading' };\n }\n\n // Retrying after having succeeding at least once\n // Current state is: { status: 'loading', result: {...}, error: undefined | Error }\n // e.g. not-executed -> loading (first-refresh) -> success -> loading (scheduled-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && state.error) {\n return { status: 'loading' };\n }\n\n // Something went wrong during any situation of a refresh\n if (state.status === 'error' && state.error) {\n return { status: 'error', error: state.error, retry };\n }\n\n // At this point it should be safe to assume that we have a successful refresh\n return { status: 'success', data: state.result! };\n}\n","import { useMemo, useRef, useState } from 'react';\nimport { useSyncedRef } from '../useSyncedRef/index.js';\nexport function useAsync(asyncFn, initialValue) {\n const [state, setState] = useState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n const promiseRef = useRef();\n const argsRef = useRef();\n const methods = useSyncedRef({\n execute(...params) {\n argsRef.current = params;\n const promise = asyncFn(...params);\n promiseRef.current = promise;\n setState((s) => ({ ...s, status: 'loading' }));\n promise.then((result) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'success', error: undefined, result }));\n }\n }, (error) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'error', error }));\n }\n });\n return promise;\n },\n reset() {\n setState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n promiseRef.current = undefined;\n argsRef.current = undefined;\n },\n });\n return [\n state,\n useMemo(() => ({\n reset() {\n methods.current.reset();\n },\n execute: (...params) => methods.current.execute(...params),\n }), []),\n { promise: promiseRef.current, lastArgs: argsRef.current },\n ];\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Children, ReactElement, ReactNode, useMemo } from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport { Page, Progress } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_KEY,\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\nimport {\n createTheme,\n styled,\n ThemeOptions,\n ThemeProvider,\n useTheme,\n} from '@material-ui/core/styles';\nimport { useExternalRedirect } from './useExternalRedirect';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n overrideThemeOptions?: Partial<ThemeOptions>;\n};\n\n/**\n * Styled Backstage Page that fills available vertical space\n */\nconst StyledPage = styled(Page)({\n height: 'inherit',\n overflowY: 'visible',\n});\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const currentTheme = useTheme();\n\n const readerPageTheme = useMemo(\n () =>\n createTheme({\n ...currentTheme,\n ...(props.overrideThemeOptions || {}),\n }),\n [currentTheme, props.overrideThemeOptions],\n );\n\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n const memoizedEntityRef = useMemo(\n () => ({\n kind: entityRef.kind,\n name: entityRef.name,\n namespace: entityRef.namespace,\n }),\n [entityRef.kind, entityRef.name, entityRef.namespace],\n );\n\n // Check for external TechDocs redirects and handle navigation\n const { shouldShowProgress } = useExternalRedirect(memoizedEntityRef);\n\n const page: ReactNode = useMemo(() => {\n if (children) {\n return null;\n }\n\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n return grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n }, [children, outlet]);\n\n // Show full-page loading spinner when checking for external redirects or about to redirect.\n // This replaces the entire page content (header, sidebar, and documentation).\n if (shouldShowProgress) {\n return <Progress />;\n }\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n if (!children) {\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={memoizedEntityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n }\n\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <ThemeProvider theme={readerPageTheme}>\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={memoizedEntityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <StyledPage\n themeId=\"documentation\"\n className=\"techdocs-reader-page\"\n >\n {children instanceof Function\n ? children({\n entityRef: memoizedEntityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </StyledPage>\n )}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n </ThemeProvider>\n );\n};\n","/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useRef } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport {\n CompoundEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { buildTechDocsURL } from '@backstage/plugin-techdocs-react';\nimport { TECHDOCS_EXTERNAL_ANNOTATION } from '@backstage/plugin-techdocs-common';\nimport { rootDocsRouteRef } from '../../../routes';\n\n/**\n * Hook to handle external TechDocs redirects based on entity annotations.\n * Checks if an entity has the `backstage.io/techdocs-entity` annotation and\n * redirects to the external TechDocs URL if present.\n *\n * @param entityRef - The entity reference to check for external redirects\n * @returns Object containing loading state and whether a redirect is in progress\n *\n * @internal\n */\nexport function useExternalRedirect(entityRef: CompoundEntityRef): {\n loading: boolean;\n shouldShowProgress: boolean;\n} {\n const catalogApi = useApi(catalogApiRef);\n const navigate = useNavigate();\n const viewTechdocLink = useRouteRef(rootDocsRouteRef);\n\n // Create a stable string key for the entity to use as a dependency.\n // This ensures the useAsync hook only re-runs when the entity changes,\n // preventing redundant API calls during sub-page navigation within the same entity's documentation.\n const entityKey = stringifyEntityRef(entityRef);\n // Track which entity we've already checked to avoid redundant checks\n // when navigating between pages within the same entity's documentation.\n const checkedEntityRef = useRef<string | null>(null);\n const shouldCheckForRedirect = checkedEntityRef.current !== entityKey;\n\n // Check if this entity should redirect to external TechDocs\n const externalRedirectResult = useAsync(async () => {\n try {\n const catalogEntity = await catalogApi.getEntityByRef(entityRef);\n\n if (\n catalogEntity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]\n ) {\n return buildTechDocsURL(catalogEntity, viewTechdocLink);\n }\n } catch (error) {\n // Ignore errors and allow the current entity's TechDocs to load.\n // This handles cases where the catalog API is unavailable or the entity doesn't exist.\n }\n\n return undefined;\n }, [entityKey, catalogApi]);\n\n useEffect(() => {\n // Navigate to external TechDocs if a redirect URL is available\n if (!externalRedirectResult.loading && externalRedirectResult.value) {\n navigate(externalRedirectResult.value, { replace: true });\n }\n\n // Mark entity as checked once we've determined there's no redirect needed.\n // This prevents the entire page from unmounting/remounting (showing Progress spinner)\n // on subsequent sub-page navigation within the same entity.\n if (!externalRedirectResult.loading && !externalRedirectResult.value) {\n checkedEntityRef.current = entityKey;\n }\n }, [\n externalRedirectResult.loading,\n externalRedirectResult.value,\n navigate,\n entityKey,\n ]);\n\n // Determine if we should show a loading indicator (which replaces the entire page with a Progress spinner).\n // Only show it when: 1) checking a new/unchecked entity, or 2) we have a redirect URL and are navigating.\n const shouldShowProgress =\n (shouldCheckForRedirect && externalRedirectResult.loading) ||\n !!externalRedirectResult.value;\n\n return {\n loading: externalRedirectResult.loading,\n shouldShowProgress,\n };\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MouseEvent, useState, useCallback } from 'react';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { ToolbarProps } from '@material-ui/core/Toolbar';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Menu from '@material-ui/core/Menu';\nimport Box from '@material-ui/core/Box';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport {\n TechDocsAddonLocations as locations,\n useTechDocsAddons,\n useTechDocsReaderPage,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageSubheader',\n flexDirection: 'column',\n minHeight: 'auto',\n padding: theme.spacing(3, 3, 0),\n '@media print': {\n display: 'none',\n },\n },\n}));\n\n/**\n * Renders the reader page subheader.\n * Please use the Tech Docs add-ons to customize it\n * @public\n */\nexport const TechDocsReaderPageSubheader = (props: {\n toolbarProps?: ToolbarProps;\n}) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const handleClose = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const {\n entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },\n } = useTechDocsReaderPage();\n\n const addons = useTechDocsAddons();\n\n const subheaderAddons = addons.renderComponentsByLocation(\n locations.Subheader,\n );\n\n const settingsAddons = addons.renderComponentsByLocation(locations.Settings);\n\n if (!subheaderAddons && !settingsAddons) return null;\n\n // No entity metadata = 404. Don't render subheader on 404.\n if (entityMetadataLoading === false && !entityMetadata) return null;\n\n return (\n <Toolbar classes={classes} {...props.toolbarProps}>\n <Box\n display=\"flex\"\n justifyContent=\"flex-end\"\n width=\"100%\"\n flexWrap=\"wrap\"\n >\n {subheaderAddons}\n {settingsAddons ? (\n <>\n <Tooltip title=\"Settings\">\n <IconButton\n aria-controls=\"tech-docs-reader-page-settings\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n >\n <SettingsIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"tech-docs-reader-page-settings\"\n getContentAnchorEl={null}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n open={Boolean(anchorEl)}\n onClose={handleClose}\n keepMounted\n >\n <div>{settingsAddons}</div>\n </Menu>\n </>\n ) : null}\n </Box>\n </Toolbar>\n );\n};\n"],"names":["useRouteRefParams","_routeRef","useParams","CookieAuthRefreshProvider","props","children","options","Progress","app","useApp","result","useCookieAuthRefresh","pluginId","fetchApi","useApi","fetchApiRef","discoveryApi","discoveryApiRef","channel","useMemo","window","BroadcastChannel","state","actions","useAsync","e","apiOrigin","requestUrl","response","Date","ResponseError","data","Error","useMountEffect","retry","useCallback","refresh","params","margin","Math","timeout","setTimeout","clearTimeout","useEffect","cancel","listener","event","action","payload","ErrorPanel","Button","TechDocsReaderLayout","withSearch","withHeader","Page","TechDocsReaderPageHeader","TechDocsReaderPageSubheader","TechDocsReaderPageContent","StyledPage","styled","TechDocsReaderPage","catalogApi","navigate","viewTechdocLink","entityKey","checkedEntityRef","shouldCheckForRedirect","externalRedirectResult","shouldShowProgress","currentTheme","useTheme","readerPageTheme","createTheme","kind","name","namespace","rootDocsRouteRef","entityRef","outlet","useOutlet","memoizedEntityRef","catalogApiRef","useNavigate","useRouteRef","stringifyEntityRef","useRef","catalogEntity","TECHDOCS_EXTERNAL_ANNOTATION","buildTechDocsURL","error","page","grandChildren","childrenList","Children","child","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","ThemeProvider","TechDocsReaderPageProvider","metadata","entityMetadata","onReady","Function","useStyles","makeStyles","theme","classes","anchorEl","setAnchorEl","useState","handleClick","handleClose","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","locations","settingsAddons","Toolbar","Box","Tooltip","IconButton","SettingsIcon","Menu","Boolean"],"mappings":"+KAwBO,SAASA,EACdC,CAAiD,EAEjD,MAAOC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,GACT,C,8RCSO,SAASC,EACdC,CAAqC,EAErC,GAAM,CAAEC,SAAAA,CAAQ,CAAE,GAAGC,EAAS,CAAGF,EAE3B,CAAEG,SAAAA,CAAQ,CAAE,CAAGC,AADTC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,IACa,aAAa,GAEhCC,EAASC,ACXV,SAA8BL,CAGpC,EAIC,GAAM,CAAEM,SAAAA,CAAQ,CAAE,CAAGN,GAAW,CAAC,EAC3BO,EAAWC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EAAOC,EAAAA,CAAWA,EAC7BC,EAAeF,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EAAOG,EAAAA,CAAeA,EAErCC,EAAUC,AAAAA,GAAAA,EAAAA,OAAAA,AAAAA,EAAQ,IACf,qBAAsBC,OACzB,IAAIC,iBAAiB,CAAC,EAAET,EAAS,uBAAuB,CAAC,EACzD,KACH,CAACA,EAAS,EAEP,CAACU,EAAOC,EAAQ,CAAGC,AChDpB,SAAkB,CAAO,CAAE,CAAY,EAC1C,GAAM,CAAC,EAAO,EAAS,CAAG,eAAS,CAC/B,OAAQ,eACR,MAAO,OACP,OAJ0B,MAK9B,GACM,EAAa,eACb,EAAU,eACV,EAAU,QAAa,CACzB,QAAQ,GAAG,CAAM,EACb,EAAQ,OAAO,CAAG,EAClB,IAAM,EAAU,KAAW,GAY3B,OAXA,EAAW,OAAO,CAAG,EACrB,EAAS,AAAC,GAAO,EAAE,GAAG,CAAC,CAAE,OAAQ,SAAU,IAC3C,EAAQ,IAAI,CAAC,AAAC,IACN,IAAY,EAAW,OAAO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A,CACT,gBAAc,iCACd,gBAAc,OACd,QAASZ,E,SAET,UAACa,EAAAA,OAAYA,CAAAA,CAAAA,E,KAGjB,UAACC,EAAAA,CAAIA,CAAAA,CACH,GAAG,iCACH,mBAAoB,KACpB,SAAUjB,EACV,aAAc,CAAE,SAAU,SAAU,WAAY,OAAQ,EACxD,KAAMkB,EAAQlB,EACd,QAASI,EACT,YAAW,G,SAEX,UAAC,O,SAAKO,C,QAGR,K,KArCsC,IAyClD,C"}
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([["7186"],{98557:function(e,t,a){a.d(t,{M:()=>r});var n=a(31085),i=a(58837),l=a(71677),o=a(72501);let s=(0,i.A)({container:{overflow:"visible !important"},typo:{fontSize:"inherit",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box","-webkit-line-clamp":({line:e})=>e||1,"-webkit-box-orient":"vertical"}},{name:"BackstageOverflowTooltip"});function r(e){let t=s(e);return(0,n.jsx)(l.Ay,{title:e.title??(e.text||""),placement:e.placement,children:(0,n.jsx)(o.A,{className:t.typo,variant:"inherit",children:e.text})})}},40466:function(e,t,a){a.d(t,{C4:()=>l,tS:()=>o});var n=a(47426);let i="catalog-entity";(0,n.i)({name:"catalog.entity.read",attributes:{action:"read"},resourceType:i});let l=(0,n.i)({name:"catalog.entity.create",attributes:{action:"create"}});(0,n.i)({name:"catalog.entity.delete",attributes:{action:"delete"},resourceType:i});let o=(0,n.i)({name:"catalog.entity.refresh",attributes:{action:"update"},resourceType:i});(0,n.i)({name:"catalog.entity.validate",attributes:{}}),(0,n.i)({name:"catalog.location.read",attributes:{action:"read"}}),(0,n.i)({name:"catalog.location.create",attributes:{action:"create"}}),(0,n.i)({name:"catalog.location.analyze",attributes:{}}),(0,n.i)({name:"catalog.location.delete",attributes:{action:"delete"}})},19857:function(e,t,a){a.d(t,{g:()=>l});var n=a(89595),i=a(79811);let l=({translationKey:e})=>{let{t}=(0,n.i)(i.j);return t(`entityTableColumnTitle.${e}`)}},50010:function(e,t,a){a.d(t,{W:()=>n});let n=(0,a(97386).h)({id:"catalog",messages:{indexPage:{title:"{{orgName}} Catalog",createButtonTitle:"Create",supportButtonContent:"All your software catalog entities"},aboutCard:{title:"About",refreshButtonTitle:"Schedule entity refresh",editButtonTitle:"Edit Metadata",createSimilarButtonTitle:"Create something similar",refreshScheduledMessage:"Refresh scheduled",launchTemplate:"Launch Template",viewTechdocs:"View TechDocs",viewSource:"View Source",descriptionField:{label:"Description",value:"No description"},ownerField:{label:"Owner",value:"No Owner"},domainField:{label:"Domain",value:"No Domain"},systemField:{label:"System",value:"No System"},parentComponentField:{label:"Parent Component",value:"No Parent Component"},typeField:{label:"Type"},lifecycleField:{label:"Lifecycle"},tagsField:{label:"Tags",value:"No Tags"},targetsField:{label:"Targets"}},searchResultItem:{lifecycle:"Lifecycle",Owner:"Owner"},catalogTable:{warningPanelTitle:"Could not fetch catalog entities.",viewActionTitle:"View",editActionTitle:"Edit",starActionTitle:"Add to favorites",unStarActionTitle:"Remove from favorites"},dependencyOfComponentsCard:{title:"Dependency of components",emptyMessage:"No component depends on this component"},dependsOnComponentsCard:{title:"Depends on components",emptyMessage:"No component is a dependency of this component"},dependsOnResourcesCard:{title:"Depends on resources",emptyMessage:"No resource is a dependency of this component"},entityContextMenu:{copiedMessage:"Copied!",moreButtonTitle:"More",inspectMenuTitle:"Inspect entity",copyURLMenuTitle:"Copy entity URL",unregisterMenuTitle:"Unregister entity"},entityLabelsCard:{title:"Labels",emptyDescription:"No labels defined for this entity. You can add labels to your entity YAML as shown in the highlighted example below:",readMoreButtonTitle:"Read more"},entityLabels:{warningPanelTitle:"Entity not found",ownerLabel:"Owner",lifecycleLabel:"Lifecycle"},entityLinksCard:{title:"Links",emptyDescription:"No links defined for this entity. You can add links to your entity YAML as shown in the highlighted example below:",readMoreButtonTitle:"Read more"},entityNotFound:{title:"Entity was not found",description:"Want to help us build this? Check out our Getting Started documentation.",docButtonTitle:"DOCS"},deleteEntity:{dialogTitle:"Are you sure you want to delete this entity?",deleteButtonTitle:"Delete",cancelButtonTitle:"Cancel",description:"This entity is not referenced by any location and is therefore not receiving updates. Click here to delete."},entityProcessingErrorsDescription:"The error below originates from",entityRelationWarningDescription:"This entity has relations to other entities, which can't be found in the catalog.\n Entities not found are: ",hasComponentsCard:{title:"Has components",emptyMessage:"No component is part of this system"},hasResourcesCard:{title:"Has resources",emptyMessage:"No resource is part of this system"},hasSubcomponentsCard:{title:"Has subcomponents",emptyMessage:"No subcomponent is part of this component"},hasSubdomainsCard:{title:"Has subdomains",emptyMessage:"No subdomain is part of this domain"},hasSystemsCard:{title:"Has systems",emptyMessage:"No system is part of this domain"},relatedEntitiesCard:{emptyHelpLinkTitle:"Learn how to change this"},systemDiagramCard:{title:"System Diagram",description:"Use pinch & zoom to move around the diagram.",edgeLabels:{partOf:"part of",provides:"provides",dependsOn:"depends on"}}}})},20393:function(e,t,a){a.d(t,{CatalogPage:()=>eV});var n=a(31085),i=a(18690),l=a(17944),o=a(84391),s=a(15179),r=a(64947),c=a(29365),d=a(5893),u=a(73657),p=a(25534);function m(e){let{title:t,to:a}=e,i=(0,d.A)(e=>e.breakpoints.down("xs"));return a?i?(0,n.jsx)(c.A,{component:u.N_,color:"primary",title:t,size:"small",to:a,children:(0,n.jsx)(p.default,{})}):(0,n.jsx)(r.A,{component:u.N_,variant:"contained",color:"primary",to:a,children:t}):null}var y=a(23413),g=a(50509),f=a(19735),h=a(16647),x=a(59378),b=a(71242),C=a(48266),j=a(50375),w=a(9720),v=a(14041),S=a(47195),T=a(73466),A=a(76272),k=a(79811),L=a(89595);let P=e=>{let t,a,{allowedKinds:i,hidden:l,initialFilter:o="component"}=e,{t:s}=(0,L.i)(k.j),r=(0,g.gf)(j.k),{error:c,allKinds:d,selectedKind:u,setSelectedKind:p}=function(e){let{filters:t,queryParameters:{kind:a},updateFilters:n}=(0,x.nK)(),i=(0,v.useMemo)(()=>[a].flat()[0],[a]),[l,o]=(0,v.useState)(i??t.kind?.value??e.initialFilter);(0,v.useEffect)(()=>{i&&o(i)},[i]),(0,v.useEffect)(()=>{t.kind?.value&&o(t.kind?.value)},[t.kind]);let{allKinds:s,loading:r,error:c}=function(){let e=(0,g.gf)(A.v),{error:t,loading:a,value:n}=(0,T.A)(async()=>{let{facets:t}=await e.getEntityFacets({facets:["kind"]});return new Map((t.kind??[]).map(e=>e.value).map(e=>[e.toLocaleLowerCase("en-US"),e]))},[e]);return{loading:a,error:t,allKinds:n??new Map}}(),d=s.get(l)||l;return(0,v.useEffect)(()=>{n({kind:l?new S.gM(l,d):void 0})},[l,d,n]),{loading:r,error:c,allKinds:s,selectedKind:l,setSelectedKind:o}}({initialFilter:o});if((0,v.useEffect)(()=>{c&&r.post({message:s("entityKindPicker.errorMessage"),severity:"error"})},[c,r,s]),c)return null;let m=[...(t=Array.from(d.keys()),i&&(t=i.map(e=>e.toLocaleLowerCase("en-US")).filter(e=>d.has(e))),a=new Map(t.map(e=>[e,d.get(e)||e])),u&&!a.has(u)&&a.set(u.toLocaleLowerCase("en-US"),u),a).entries()].map(([e,t])=>({label:t,value:e}));return l?null:(0,n.jsx)(w.A,{pb:1,pt:1,children:(0,n.jsx)(C.w,{label:s("entityKindPicker.title"),items:m,selected:u.toLocaleLowerCase("en-US"),onChange:e=>p(String(e))})})};var M=a(58837),N=a(19030);let O=(0,M.A)({input:{}},{name:"CatalogReactEntityLifecyclePicker"}),R=e=>{let{initialFilter:t=[]}=e,a=O(),{t:i}=(0,L.i)(k.j);return(0,n.jsx)(N.y,{label:i("entityLifecyclePicker.title"),name:"lifecycles",path:"spec.lifecycle",Filter:S.I5,InputProps:{className:a.input},initialSelectedOptions:t})},E=(0,M.A)({input:{}},{name:"CatalogReactEntityNamespacePicker"}),F=e=>{let{initiallySelectedNamespaces:t}=e,a=E(),{t:i}=(0,L.i)(k.j);return(0,n.jsx)(N.y,{label:i("entityNamespacePicker.title"),name:"namespace",path:"metadata.namespace",Filter:S.z,InputProps:{className:a.input},initialSelectedOptions:t})};var K=a(53149),B=a(98552),z=a(86901),U=a(44148),D=a(41260),I=a(80018);let _=(0,M.A)({root:{},input:{},label:{}},{name:"CatalogReactEntityProcessingStatusPickerPicker"}),H=(0,n.jsx)(D.default,{fontSize:"small"}),W=(0,n.jsx)(U.default,{fontSize:"small"}),G=()=>{let e=_(),{updateFilters:t}=(0,x.nK)(),{t:a}=(0,L.i)(k.j),[i,l]=(0,v.useState)([]);return(0,n.jsx)(w.A,{className:e.root,pb:1,pt:1,children:(0,n.jsx)(I.Q,{label:a("entityProcessingStatusPicker.title"),multiple:!0,disableCloseOnSelect:!0,options:["Is Orphan","Has Error"],value:i,onChange:(e,a)=>{var n,i;l(a),t({orphan:(n=a.includes("Is Orphan"))?new S.Kf(n):void 0}),t({error:(i=a.includes("Has Error"))?new S.mT(i):void 0})},renderOption:(e,{selected:t})=>(0,n.jsx)(z.A,{control:(0,n.jsx)(B.A,{icon:H,checkedIcon:W,checked:t}),onClick:e=>e.preventDefault(),label:e}),name:"processing-status-picker",LabelProps:{className:e.label},TextFieldProps:{className:e.input}})})};var V=a(67762),X=a(46343),Y=a.n(X),q=a(40074),J=a.n(q);let $=e=>{let{hidden:t,initialFilter:a}=e,i=(0,g.gf)(j.k),{error:l,availableTypes:o,selectedTypes:s,setSelectedTypes:r}=function(){let e=(0,g.gf)(A.v),{filters:{kind:t,type:a},queryParameters:{type:n},updateFilters:i}=(0,x.nK)(),l=(0,v.useMemo)(()=>[n].flat().filter(Boolean),[n]),[o,s]=(0,v.useState)(l.length?l:a?.getTypes()??[]);(0,v.useEffect)(()=>{l.length&&s(l)},[l]);let[r,c]=(0,v.useState)([]),d=(0,v.useMemo)(()=>t?.value,[t]),{error:u,loading:p,value:m}=(0,T.A)(async()=>d?await e.getEntityFacets({filter:{kind:d},facets:["spec.type"]}).then(e=>e.facets["spec.type"]||[]):[],[d,e]),y=(0,v.useRef)(m);return(0,v.useEffect)(()=>{let e=y.current;if(y.current=m,p||!d||e===m||!m)return;let t=[...new Set(J()(m,e=>-e.count).map(e=>e.value.toLocaleLowerCase("en-US")))];c(t);let a=o.filter(e=>t.includes(e));Y()(o,a)||s(a)},[p,d,o,s,m]),(0,v.useEffect)(()=>{i({type:o.length?new S.qA(o):void 0})},[o,i]),{loading:p,error:u,availableTypes:r,selectedTypes:o,setSelectedTypes:s}}(),{t:c}=(0,L.i)(k.j);if((0,v.useEffect)(()=>{l&&i.post({message:c("entityTypePicker.errorMessage"),severity:"error"}),a&&r([a])},[l,i,a,r,c]),0===o.length||l)return null;o.sort((e,t)=>e.toLocaleLowerCase("en-US").localeCompare(t.toLocaleLowerCase("en-US")));let d=[{value:"all",label:c("entityTypePicker.optionAllTitle")},...o.map(e=>({value:e,label:e}))];return t?null:(0,n.jsx)(w.A,{pb:1,pt:1,children:(0,n.jsx)(C.w,{label:c("entityTypePicker.title"),items:d,selected:(d.length>1?s[0]:void 0)??"all",onChange:e=>r("all"===e?[]:[String(e)])})})};var Q=a(59302);let Z=e=>{let{initialKind:t,initiallySelectedFilter:a,ownerPickerMode:i,initiallySelectedNamespaces:l}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P,{initialFilter:t}),(0,n.jsx)($,{}),(0,n.jsx)(Q.y,{initialFilter:a}),(0,n.jsx)(K.t,{mode:i}),(0,n.jsx)(R,{}),(0,n.jsx)(V.m,{}),(0,n.jsx)(G,{}),(0,n.jsx)(F,{initiallySelectedNamespaces:l})]})};var ee=a(50714),et=a(11773),ea=a(96403),en=a(58077),ei=a(87187),el=a(4809),eo=a(28499),es=a(7537),er=a(75710),ec=a(53320),ed=a(72501),eu=a(88654),ep=a(75625),em=a(39330),ey=a(45250),eg=a(65398),ef=a.n(eg),eh=a(76025),ex=a(53987),eb=a(94390),eC=a(98557),ej=a(19857);let ew=Object.freeze({createNameColumn(e){function t(t){return t.metadata?.title||(0,es.S)(t,{defaultKind:e?.defaultKind})}return{title:(0,n.jsx)(ej.g,{translationKey:"name"}),field:"resolved.entityRef",highlight:!0,customSort:({entity:e},{entity:a})=>t(e).localeCompare(t(a)),render:({entity:t})=>(0,n.jsx)(eh.z,{entityRef:t,defaultKind:e?.defaultKind||"Component"})}},createSystemColumn:()=>({title:(0,n.jsx)(ej.g,{translationKey:"system"}),field:"resolved.partOfSystemRelationTitle",customFilterAndSearch:(e,t)=>!!t.resolved.partOfSystemRelations&&t.resolved.partOfSystemRelations.map(e=>e.name).join(", ").toLocaleUpperCase("en-US").includes(e.toLocaleUpperCase("en-US")),render:({resolved:e})=>(0,n.jsx)(ex.i,{entityRefs:e.partOfSystemRelations,defaultKind:"system"})}),createOwnerColumn:()=>({title:(0,n.jsx)(ej.g,{translationKey:"owner"}),field:"resolved.ownedByRelationsTitle",render:({resolved:e})=>(0,n.jsx)(ex.i,{entityRefs:e.ownedByRelations,defaultKind:"group"})}),createSpecTargetsColumn:()=>({title:(0,n.jsx)(ej.g,{translationKey:"targets"}),field:"entity.spec.targets",customFilterAndSearch:(e,t)=>{let a=[];return t.entity?.spec?.targets&&Array.isArray(t.entity?.spec?.targets)?a=t.entity?.spec?.targets:t.entity?.spec?.target&&(a=[t.entity?.spec?.target]),a.join(", ").toLocaleUpperCase("en-US").includes(e.toLocaleUpperCase("en-US"))},render:({entity:e})=>(0,n.jsx)(n.Fragment,{children:(e?.spec?.targets||e?.spec?.target)&&(0,n.jsx)(eC.M,{text:(e.spec.targets||[e.spec.target]).join(", "),placement:"bottom-start"})})}),createSpecTypeColumn:(e={hidden:!1})=>({title:(0,n.jsx)(ej.g,{translationKey:"type"}),field:"entity.spec.type",hidden:e.hidden,width:"auto"}),createSpecLifecycleColumn:()=>({title:(0,n.jsx)(ej.g,{translationKey:"lifecycle"}),field:"entity.spec.lifecycle"}),createMetadataDescriptionColumn:()=>({title:(0,n.jsx)(ej.g,{translationKey:"description"}),field:"entity.metadata.description",render:({entity:e})=>(0,n.jsx)(eC.M,{text:e.metadata.description,placement:"bottom-start"}),width:"auto"}),createTagsColumn:()=>({title:(0,n.jsx)(ej.g,{translationKey:"tags"}),field:"entity.metadata.tags",cellStyle:{padding:"0px 16px 0px 20px"},render:({entity:e})=>(0,n.jsx)(n.Fragment,{children:e.metadata.tags&&e.metadata.tags.map(e=>(0,n.jsx)(eb.A,{label:e,size:"small",variant:"outlined",style:{marginBottom:"0px"}},e))}),width:"auto"}),createTitleColumn:e=>({title:(0,n.jsx)(ej.g,{translationKey:"title"}),field:"entity.metadata.title",hidden:e?.hidden,searchable:!0}),createLabelColumn(e,t){function a(e,t){let a=t.metadata?.labels;return a&&a[e]||""}return{title:t?.title||(0,n.jsx)(ej.g,{translationKey:"label"}),field:"entity.metadata.labels",cellStyle:{padding:"0px 16px 0px 20px"},customSort:({entity:t},{entity:n})=>a(e,t).localeCompare(a(e,n)),render:({entity:a})=>{let i=a.metadata?.labels,l=i&&i[e]||t?.defaultValue;return(0,n.jsx)(n.Fragment,{children:l&&(0,n.jsx)(eb.A,{label:l,size:"small",variant:"outlined"},l)})},width:"auto"}},createNamespaceColumn:()=>({title:(0,n.jsx)(ej.g,{translationKey:"namespace"}),field:"entity.metadata.namespace",width:"auto"})});var ev=a(95061),eS=a(63301),eT=a(34839),eA=a(75173),ek=a(64704),eL=a(45917),eP=a(16983);let eM=(0,M.A)(e=>({searchToolbar:{paddingLeft:0,paddingRight:0},input:{}}),{name:"CatalogReactEntitySearchBar"}),eN=()=>{let e=eM(),{t}=(0,L.i)(k.j),{updateFilters:a,queryParameters:{text:i}}=(0,x.nK)(),l=(0,v.useMemo)(()=>[i].flat()[0],[i]),[o,s]=(0,v.useState)(l??"");return(0,eP.default)(()=>{a({text:o.length?new S.V3(o):void 0})},250,[o,a]),(0,v.useEffect)(()=>{l&&s(l)},[l]),(0,n.jsx)(eA.A,{className:e.searchToolbar,children:(0,n.jsx)(ev.A,{children:(0,n.jsx)(eS.A,{"aria-label":"search",id:"input-with-icon-adornment",className:e.input,placeholder:t("entitySearchBar.placeholder"),autoComplete:"off",onChange:e=>s(e.target.value),value:o,startAdornment:(0,n.jsx)(eT.A,{position:"start",children:(0,n.jsx)(eL.default,{})}),endAdornment:(0,n.jsx)(eT.A,{position:"end",children:(0,n.jsx)(c.A,{"aria-label":"clear search",onClick:()=>s(""),edge:"end",disabled:0===o.length,children:(0,n.jsx)(ek.default,{})})})})})})},eO=(0,M.A)(e=>({root:{paddingTop:e.spacing(1.25),paddingLeft:e.spacing(2.5),paddingBottom:e.spacing(.75),display:"flex",justifyContent:"space-between"},text:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}),{name:"PluginCatalogTableToolbar"});function eR(e){let t=eO();return(0,n.jsxs)(eA.A,{className:t.root,children:[(0,n.jsx)(ed.A,{variant:"h5",className:t.text,children:e.title}),(0,n.jsx)(eN,{})]})}function eE(e){let{columns:t,data:a,options:i,...l}=e,{setLimit:o,setOffset:s,limit:r,totalItems:c,offset:d}=(0,x.nK)(),[u,p]=(0,v.useState)(d&&r?Math.floor(d/r):0);return(0,v.useEffect)(()=>{c&&u*r>=c?s(Math.max(0,c-r)):s(Math.max(0,u*r))},[s,u,r,c]),(0,n.jsx)(eo.X,{columns:t,data:a,options:{pageSizeOptions:[5,10,20,50,100],pageSize:r,emptyRowsWhenPaging:!1,...i},components:{Toolbar:eR},page:u,onPageChange:p,onRowsPerPageChange:o,totalCount:c,...l})}function eF(e){let{columns:t,data:a,next:i,prev:l,options:o,...s}=e;return(0,n.jsx)(eo.X,{columns:t,data:a,options:{...o,pageSizeOptions:[],showFirstLastPageButtons:!1,pageSize:Number.MAX_SAFE_INTEGER,emptyRowsWhenPaging:!1},onPageChange:e=>{e>0?i?.():l?.()},components:{Toolbar:eR},page:+!!l,totalCount:i?Number.MAX_VALUE:Number.MAX_SAFE_INTEGER,localization:{pagination:{labelDisplayedRows:""}},...s})}let eK=({filters:e,entities:t})=>{let a=void 0===e.type;return[ew.createTitleColumn({hidden:!0}),ew.createNameColumn({defaultKind:e.kind?.value}),...function(){let n=[ew.createMetadataDescriptionColumn(),ew.createTagsColumn()],i=[ew.createSystemColumn(),ew.createOwnerColumn(),ew.createSpecTypeColumn({hidden:!a}),ew.createSpecLifecycleColumn()];switch(e.kind?.value){case"user":return[...n];case"domain":case"system":return[ew.createOwnerColumn(),...n];case"group":case"template":return[ew.createSpecTypeColumn({hidden:!a}),...n];case"location":return[ew.createSpecTypeColumn({hidden:!a}),ew.createSpecTargetsColumn()];default:return t.every(e=>"default"===e.metadata.namespace)?[...i,...n]:[...i,ew.createNamespaceColumn(),...n]}}()]};var eB=a(50010),ez=a(77899);let eU=(e,t)=>{let a=e=>e.metadata.title||(0,es.S)(e,{defaultKind:"Component"});return a(e).localeCompare(a(t))},eD=e=>{let{columns:t=eK,tableOptions:a,subtitle:i,emptyContent:l}=e,{isStarredEntity:o,toggleStarredEntity:s}=(0,er.I)(),r=(0,x.nK)(),{loading:c,error:d,entities:u,filters:p,pageInfo:m,totalItems:y,paginationMode:g}=r,f=(0,v.useMemo)(()=>"function"==typeof t?t(r):t,[t,r]),{t:h}=(0,L.i)(eB.W);if(d)return(0,n.jsx)("div",{children:(0,n.jsx)(ei.B,{severity:"error",title:h("catalogTable.warningPanelTitle"),children:(0,n.jsx)(el.z,{language:"text",text:d.toString()})})});let b=[({entity:e})=>{let t=e.metadata.annotations?.[et._P],a=h("catalogTable.viewActionTitle");return{icon:()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ed.A,{style:eu.A,children:a}),(0,n.jsx)(em.default,{fontSize:"small"})]}),tooltip:a,disabled:!t,onClick:()=>{t&&window.open(t,"_blank")}}},({entity:e})=>{let t=e.metadata.annotations?.[et.P],a=h("catalogTable.editActionTitle");return{icon:()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ed.A,{style:eu.A,children:a}),(0,n.jsx)(ep.default,{fontSize:"small"})]}),tooltip:a,disabled:!t,onClick:()=>{t&&window.open(t,"_blank")}}},({entity:e})=>{let t=o(e);return{cellStyle:{paddingLeft:"1em"},icon:()=>(0,n.jsx)(ez.m,{isFavorite:t}),tooltip:t?h("catalogTable.unStarActionTitle"):h("catalogTable.starActionTitle"),onClick:()=>s(e)}}],C=p.kind?.label||"",j=p.type?.value||"",w="number"==typeof y?`(${y})`:"",S=(0,ey.capitalize)(p.user?.value??"all"),T=e.title||[S,j,ef()(C),w].filter(e=>e).join(" "),A=e.actions||b,k={actionsColumnIndex:-1,loadingType:"linear",showEmptyDataSourceMessage:!c,padding:"dense",...a};if("cursor"===g)return(0,n.jsx)(eF,{columns:f,emptyContent:l,isLoading:c,title:T,actions:A,subtitle:i,options:k,data:u.map(eI),next:m?.next,prev:m?.prev});if("offset"===g)return(0,n.jsx)(eE,{columns:f,emptyContent:l,isLoading:c,title:T,actions:A,subtitle:i,options:k,data:u.map(eI)});let P=u.sort(eU).map(eI),M=P.length>20;return(0,n.jsx)(eo.X,{isLoading:c,columns:f,options:{paging:M,pageSize:20,pageSizeOptions:[20,50,100],...k},title:T,data:P,actions:A,subtitle:i,emptyContent:l})};function eI(e){let t=(0,ec.t)(e,ea.jn,{kind:"system"}),a=(0,ec.t)(e,ea.vv);return{entity:e,resolved:{name:(0,es.S)(e,{defaultKind:"Component"}),entityRef:(0,en.U2)(e),ownedByRelationsTitle:a.map(e=>(0,es.S)(e,{defaultKind:"group"})).join(", "),ownedByRelations:a,partOfSystemRelationTitle:t.map(e=>(0,es.S)(e,{defaultKind:"system"})).join(", "),partOfSystemRelations:t}}}eD.columns=ew,eD.defaultColumnsFunc=eK;var e_=a(40466),eH=a(17883);function eW(e){let{filters:t,content:a=(0,n.jsx)(eD,{}),pagination:i}=e,r=(0,g.gf)(f.U).getOptionalString("organization.name")??"Backstage",c=(0,h.S)(ee.qP),{t:d}=(0,L.i)(eB.W),{allowed:u}=(0,eH.J)({permission:e_.C4});return(0,n.jsx)(l.d,{title:d("indexPage.title",{orgName:r}),themeId:"home",children:(0,n.jsxs)(o.U,{children:[(0,n.jsxs)(s.d,{title:"",children:[u&&(0,n.jsx)(m,{title:d("indexPage.createButtonTitle"),to:c&&c()}),(0,n.jsx)(y.Y,{children:d("indexPage.supportButtonContent")})]}),(0,n.jsx)(x.B9,{pagination:i,children:(0,n.jsxs)(b.GI,{children:[(0,n.jsx)(b.GI.Filters,{children:t}),(0,n.jsx)(b.GI.Content,{children:a})]})})]})})}function eG(e){let{columns:t,actions:a,initiallySelectedFilter:i="owned",initialKind:l="component",tableOptions:o={},emptyContent:s,pagination:r,ownerPickerMode:c,filters:d,initiallySelectedNamespaces:u}=e;return(0,n.jsx)(eW,{filters:d??(0,n.jsx)(Z,{initialKind:l,initiallySelectedFilter:i,ownerPickerMode:c,initiallySelectedNamespaces:u}),content:(0,n.jsx)(eD,{columns:t,actions:a,tableOptions:o,emptyContent:s}),pagination:r})}function eV(e){return(0,i.P1)()||(0,n.jsx)(eG,{...e})}},47426:function(e,t,a){a.d(t,{i:()=>n});function n({name:e,attributes:t,resourceType:a}){return a?{type:"resource",name:e,attributes:t,resourceType:a}:{type:"basic",name:e,attributes:t}}},17883:function(e,t,a){a.d(t,{J:()=>r});var n=a(50509),i=a(31057),l=a(98109),o=a(71696),s=a(22250);function r(e){let t=(0,n.gf)(i.x),{data:a,error:r}=(0,s.Ay)(e,async e=>{if((0,l.OL)(e.permission)&&!e.resourceRef)return o.b.DENY;let{result:a}=await t.authorize(e);return a});return r?{error:r,loading:!1,allowed:!1}:void 0===a?{loading:!0,allowed:!1}:{loading:!1,allowed:a===o.b.ALLOW}}}}]);
2
+ //# sourceMappingURL=7186.96e6edf9.chunk.js.map