@backstage/plugin-app 0.2.0-next.0 → 0.2.0-next.2

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 (58) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +1 -7
  3. package/dist/alpha/appModulePublicSignIn.esm.js +52 -0
  4. package/dist/alpha/appModulePublicSignIn.esm.js.map +1 -0
  5. package/dist/alpha.d.ts +54 -0
  6. package/dist/alpha.esm.js +2 -0
  7. package/dist/alpha.esm.js.map +1 -0
  8. package/dist/apis/DefaultDialogApi.esm.js.map +1 -1
  9. package/dist/apis/SwappableComponentsApi/DefaultSwappableComponentsApi.esm.js +40 -0
  10. package/dist/apis/SwappableComponentsApi/DefaultSwappableComponentsApi.esm.js.map +1 -0
  11. package/dist/defaultApis.esm.js +23 -30
  12. package/dist/defaultApis.esm.js.map +1 -1
  13. package/dist/extensions/AnalyticsApi.esm.js +56 -0
  14. package/dist/extensions/AnalyticsApi.esm.js.map +1 -0
  15. package/dist/extensions/AppLanguageApi.esm.js +1 -1
  16. package/dist/extensions/AppLanguageApi.esm.js.map +1 -1
  17. package/dist/extensions/AppRoot.esm.js.map +1 -1
  18. package/dist/extensions/AppRoutes.esm.js +1 -4
  19. package/dist/extensions/AppRoutes.esm.js.map +1 -1
  20. package/dist/extensions/AppThemeApi.esm.js +1 -1
  21. package/dist/extensions/AppThemeApi.esm.js.map +1 -1
  22. package/dist/extensions/DialogDisplay.esm.js.map +1 -1
  23. package/dist/extensions/FeatureFlagsApi.esm.js +1 -1
  24. package/dist/extensions/FeatureFlagsApi.esm.js.map +1 -1
  25. package/dist/extensions/IconsApi.esm.js +1 -1
  26. package/dist/extensions/IconsApi.esm.js.map +1 -1
  27. package/dist/extensions/LegacyComponentsApi.esm.js +26 -0
  28. package/dist/extensions/LegacyComponentsApi.esm.js.map +1 -0
  29. package/dist/extensions/SwappableComponentsApi.esm.js +40 -0
  30. package/dist/extensions/SwappableComponentsApi.esm.js.map +1 -0
  31. package/dist/extensions/TranslationsApi.esm.js +1 -1
  32. package/dist/extensions/TranslationsApi.esm.js.map +1 -1
  33. package/dist/extensions/components.esm.js +21 -43
  34. package/dist/extensions/components.esm.js.map +1 -1
  35. package/dist/extensions/elements.esm.js +1 -1
  36. package/dist/extensions/elements.esm.js.map +1 -1
  37. package/dist/index.d.ts +143 -63
  38. package/dist/packages/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js +7 -0
  39. package/dist/packages/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js.map +1 -0
  40. package/dist/packages/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js +7 -0
  41. package/dist/packages/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js.map +1 -0
  42. package/dist/packages/frontend-internal/src/wiring/InternalSwappableComponentRef.esm.js +9 -0
  43. package/dist/packages/frontend-internal/src/wiring/InternalSwappableComponentRef.esm.js.map +1 -0
  44. package/dist/packages/opaque-internal/src/OpaqueType.esm.js +103 -0
  45. package/dist/packages/opaque-internal/src/OpaqueType.esm.js.map +1 -0
  46. package/dist/plugin.esm.js +9 -7
  47. package/dist/plugin.esm.js.map +1 -1
  48. package/dist/plugins/app/package.json.esm.js +26 -6
  49. package/dist/plugins/app/package.json.esm.js.map +1 -1
  50. package/package.json +38 -18
  51. package/dist/extensions/ComponentsApi.esm.js +0 -28
  52. package/dist/extensions/ComponentsApi.esm.js.map +0 -1
  53. package/dist/packages/app-defaults/src/defaults/components.esm.js +0 -46
  54. package/dist/packages/app-defaults/src/defaults/components.esm.js.map +0 -1
  55. package/dist/packages/core-app-api/src/apis/implementations/AnalyticsApi/NoOpAnalyticsApi.esm.js +0 -7
  56. package/dist/packages/core-app-api/src/apis/implementations/AnalyticsApi/NoOpAnalyticsApi.esm.js.map +0 -1
  57. package/dist/packages/frontend-app-api/src/apis/implementations/ComponentsApi/DefaultComponentsApi.esm.js +0 -21
  58. package/dist/packages/frontend-app-api/src/apis/implementations/ComponentsApi/DefaultComponentsApi.esm.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AppLanguageApi.esm.js","sources":["../../src/extensions/AppLanguageApi.ts"],"sourcesContent":["/*\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\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppLanguageSelector } from '../../../../packages/core-app-api/src/apis/implementations/AppLanguageApi';\nimport { appLanguageApiRef } from '@backstage/core-plugin-api/alpha';\nimport { ApiBlueprint } from '@backstage/frontend-plugin-api';\n\nexport const AppLanguageApi = ApiBlueprint.make({\n name: 'app-language',\n params: define =>\n define({\n api: appLanguageApiRef,\n deps: {},\n factory: () => AppLanguageSelector.createWithStorage(),\n }),\n});\n"],"names":[],"mappings":";;;;AAqBa,MAAA,cAAA,GAAiB,aAAa,IAAK,CAAA;AAAA,EAC9C,IAAM,EAAA,cAAA;AAAA,EACN,MAAA,EAAQ,YACN,MAAO,CAAA;AAAA,IACL,GAAK,EAAA,iBAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,mBAAA,CAAoB,iBAAkB;AAAA,GACtD;AACL,CAAC;;;;"}
1
+ {"version":3,"file":"AppLanguageApi.esm.js","sources":["../../src/extensions/AppLanguageApi.ts"],"sourcesContent":["/*\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\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppLanguageSelector } from '../../../../packages/core-app-api/src/apis/implementations/AppLanguageApi';\nimport { appLanguageApiRef } from '@backstage/core-plugin-api/alpha';\nimport { ApiBlueprint } from '@backstage/frontend-plugin-api';\n\nexport const AppLanguageApi = ApiBlueprint.make({\n name: 'app-language',\n params: defineParams =>\n defineParams({\n api: appLanguageApiRef,\n deps: {},\n factory: () => AppLanguageSelector.createWithStorage(),\n }),\n});\n"],"names":[],"mappings":";;;;AAqBa,MAAA,cAAA,GAAiB,aAAa,IAAK,CAAA;AAAA,EAC9C,IAAM,EAAA,cAAA;AAAA,EACN,MAAA,EAAQ,kBACN,YAAa,CAAA;AAAA,IACX,GAAK,EAAA,iBAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,mBAAA,CAAoB,iBAAkB;AAAA,GACtD;AACL,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppRoot.esm.js","sources":["../../src/extensions/AppRoot.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentType,\n PropsWithChildren,\n ReactNode,\n useState,\n JSX,\n} from 'react';\nimport {\n AppRootWrapperBlueprint,\n RouterBlueprint,\n SignInPageBlueprint,\n coreExtensionData,\n discoveryApiRef,\n fetchApiRef,\n errorApiRef,\n createExtension,\n createExtensionInput,\n routeResolutionApiRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n DiscoveryApi,\n ErrorApi,\n FetchApi,\n IdentityApi,\n ProfileInfo,\n SignInPageProps,\n configApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { isProtectedApp } from '../../../../packages/core-app-api/src/app/isProtectedApp';\nimport { BrowserRouter } from 'react-router-dom';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { RouteTracker } from '../../../../packages/frontend-app-api/src/routing/RouteTracker';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { getBasePath } from '../../../../packages/frontend-app-api/src/routing/getBasePath';\n\nexport const AppRoot = createExtension({\n name: 'root',\n attachTo: { id: 'app', input: 'root' },\n inputs: {\n router: createExtensionInput([RouterBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n signInPage: createExtensionInput([SignInPageBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n children: createExtensionInput([coreExtensionData.reactElement], {\n singleton: true,\n }),\n elements: createExtensionInput([coreExtensionData.reactElement]),\n wrappers: createExtensionInput([\n AppRootWrapperBlueprint.dataRefs.component,\n ]),\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs, apis }) {\n if (isProtectedApp()) {\n const identityApi = apis.get(identityApiRef);\n if (!identityApi) {\n throw new Error('App requires an Identity API implementation');\n }\n const appIdentityProxy = toAppIdentityProxy(identityApi);\n const discoveryApi = apis.get(discoveryApiRef);\n const errorApi = apis.get(errorApiRef);\n const fetchApi = apis.get(fetchApiRef);\n if (!discoveryApi || !errorApi || !fetchApi) {\n throw new Error(\n 'App is running in protected mode but missing required APIs',\n );\n }\n appIdentityProxy.enableCookieAuth({\n discoveryApi,\n errorApi,\n fetchApi,\n });\n }\n\n let content: ReactNode = inputs.children.get(\n coreExtensionData.reactElement,\n );\n\n for (const wrapper of inputs.wrappers) {\n const Component = wrapper.get(AppRootWrapperBlueprint.dataRefs.component);\n content = <Component>{content}</Component>;\n }\n\n return [\n coreExtensionData.reactElement(\n <AppRouter\n SignInPageComponent={inputs.signInPage?.get(\n SignInPageBlueprint.dataRefs.component,\n )}\n RouterComponent={inputs.router?.get(\n RouterBlueprint.dataRefs.component,\n )}\n extraElements={inputs.elements?.map(el =>\n el.get(coreExtensionData.reactElement),\n )}\n >\n {content}\n </AppRouter>,\n ),\n ];\n },\n});\n\n// This wraps the sign-in page and waits for sign-in to be completed before rendering the app\nfunction SignInPageWrapper({\n component: Component,\n appIdentityProxy,\n children,\n}: {\n component: ComponentType<SignInPageProps>;\n appIdentityProxy: AppIdentityProxy;\n children: ReactNode;\n}) {\n const [identityApi, setIdentityApi] = useState<IdentityApi>();\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n\n if (!identityApi) {\n return <Component onSignInSuccess={setIdentityApi} />;\n }\n\n appIdentityProxy.setTarget(identityApi, {\n signOutTargetUrl: basePath || '/',\n });\n return <>{children}</>;\n}\n\ntype AppIdentityProxy = IdentityApi & {\n enableCookieAuth(ctx: {\n errorApi: ErrorApi;\n fetchApi: FetchApi;\n discoveryApi: DiscoveryApi;\n }): void;\n setTarget(\n impl: IdentityApi & /* backwards compat stuff */ {\n getUserId?(): string;\n getIdToken?(): Promise<string | undefined>;\n getProfile?(): ProfileInfo;\n },\n options: { signOutTargetUrl: string },\n ): void;\n};\n\nfunction toAppIdentityProxy(identityApi: IdentityApi): AppIdentityProxy {\n if (!('enableCookieAuth' in identityApi)) {\n throw new Error('Unexpected Identity API implementation');\n }\n return identityApi as AppIdentityProxy;\n}\n\ntype RouteResolverProxy = {\n getRouteObjects(): any[];\n};\n\n/**\n * Props for the {@link AppRouter} component.\n * @public\n */\nexport interface AppRouterProps {\n children?: ReactNode;\n SignInPageComponent?: ComponentType<SignInPageProps>;\n RouterComponent?: ComponentType<PropsWithChildren<{}>>;\n extraElements?: Array<JSX.Element>;\n}\n\nfunction DefaultRouter(props: PropsWithChildren<{}>) {\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n return <BrowserRouter basename={basePath}>{props.children}</BrowserRouter>;\n}\n\n/**\n * App router and sign-in page wrapper.\n *\n * @remarks\n *\n * The AppRouter provides the routing context and renders the sign-in page.\n * Until the user has successfully signed in, this component will render\n * the sign-in page. Once the user has signed-in, it will instead render\n * the app, while providing routing and route tracking for the app.\n */\nexport function AppRouter(props: AppRouterProps) {\n const {\n children,\n SignInPageComponent,\n RouterComponent = DefaultRouter,\n extraElements = [],\n } = props;\n\n const configApi = useApi(configApiRef);\n const appIdentityProxy = toAppIdentityProxy(useApi(identityApiRef));\n const routeResolutionsApi = useApi(routeResolutionApiRef);\n const basePath = getBasePath(configApi);\n\n // TODO: Private access for now, probably replace with path -> node lookup method on the API\n if (!('getRouteObjects' in routeResolutionsApi)) {\n throw new Error('Unexpected route resolution API implementation');\n }\n const routeObjects = (\n routeResolutionsApi as RouteResolverProxy\n ).getRouteObjects();\n\n // If the app hasn't configured a sign-in page, we just continue as guest.\n if (!SignInPageComponent) {\n appIdentityProxy.setTarget(\n {\n getUserId: () => 'guest',\n getIdToken: async () => undefined,\n getProfile: () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getProfileInfo: async () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getBackstageIdentity: async () => ({\n type: 'user',\n userEntityRef: 'user:default/guest',\n ownershipEntityRefs: ['user:default/guest'],\n }),\n getCredentials: async () => ({}),\n signOut: async () => {},\n },\n { signOutTargetUrl: basePath || '/' },\n );\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n {children}\n </RouterComponent>\n );\n }\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n <SignInPageWrapper\n component={SignInPageComponent}\n appIdentityProxy={appIdentityProxy}\n >\n {children}\n </SignInPageWrapper>\n </RouterComponent>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAsDO,MAAM,UA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","sources":["../../src/extensions/AppRoot.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentType,\n PropsWithChildren,\n ReactNode,\n useState,\n JSX,\n} from 'react';\nimport {\n AppRootWrapperBlueprint,\n RouterBlueprint,\n SignInPageBlueprint,\n coreExtensionData,\n discoveryApiRef,\n fetchApiRef,\n errorApiRef,\n createExtension,\n createExtensionInput,\n routeResolutionApiRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n DiscoveryApi,\n ErrorApi,\n FetchApi,\n IdentityApi,\n ProfileInfo,\n SignInPageProps,\n configApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { isProtectedApp } from '../../../../packages/core-app-api/src/app/isProtectedApp';\nimport { BrowserRouter } from 'react-router-dom';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { RouteTracker } from '../../../../packages/frontend-app-api/src/routing/RouteTracker';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { getBasePath } from '../../../../packages/frontend-app-api/src/routing/getBasePath';\n\nexport const AppRoot = createExtension({\n name: 'root',\n attachTo: { id: 'app', input: 'root' },\n inputs: {\n router: createExtensionInput([RouterBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n signInPage: createExtensionInput([SignInPageBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n children: createExtensionInput([coreExtensionData.reactElement], {\n singleton: true,\n }),\n elements: createExtensionInput([coreExtensionData.reactElement]),\n wrappers: createExtensionInput([\n AppRootWrapperBlueprint.dataRefs.component,\n ]),\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs, apis }) {\n if (isProtectedApp()) {\n const identityApi = apis.get(identityApiRef);\n if (!identityApi) {\n throw new Error('App requires an Identity API implementation');\n }\n const appIdentityProxy = toAppIdentityProxy(identityApi);\n const discoveryApi = apis.get(discoveryApiRef);\n const errorApi = apis.get(errorApiRef);\n const fetchApi = apis.get(fetchApiRef);\n if (!discoveryApi || !errorApi || !fetchApi) {\n throw new Error(\n 'App is running in protected mode but missing required APIs',\n );\n }\n appIdentityProxy.enableCookieAuth({\n discoveryApi,\n errorApi,\n fetchApi,\n });\n }\n\n let content: ReactNode = inputs.children.get(\n coreExtensionData.reactElement,\n );\n\n for (const wrapper of inputs.wrappers) {\n const Component = wrapper.get(AppRootWrapperBlueprint.dataRefs.component);\n content = <Component>{content}</Component>;\n }\n\n return [\n coreExtensionData.reactElement(\n <AppRouter\n SignInPageComponent={inputs.signInPage?.get(\n SignInPageBlueprint.dataRefs.component,\n )}\n RouterComponent={inputs.router?.get(\n RouterBlueprint.dataRefs.component,\n )}\n extraElements={inputs.elements?.map(el =>\n el.get(coreExtensionData.reactElement),\n )}\n >\n {content}\n </AppRouter>,\n ),\n ];\n },\n});\n\n// This wraps the sign-in page and waits for sign-in to be completed before rendering the app\nfunction SignInPageWrapper({\n component: Component,\n appIdentityProxy,\n children,\n}: {\n component: ComponentType<SignInPageProps>;\n appIdentityProxy: AppIdentityProxy;\n children: ReactNode;\n}) {\n const [identityApi, setIdentityApi] = useState<IdentityApi>();\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n\n if (!identityApi) {\n return <Component onSignInSuccess={setIdentityApi} />;\n }\n\n appIdentityProxy.setTarget(identityApi, {\n signOutTargetUrl: basePath || '/',\n });\n return <>{children}</>;\n}\n\ntype AppIdentityProxy = IdentityApi & {\n enableCookieAuth(ctx: {\n errorApi: ErrorApi;\n fetchApi: FetchApi;\n discoveryApi: DiscoveryApi;\n }): void;\n setTarget(\n impl: IdentityApi & /* backwards compat stuff */ {\n getUserId?(): string;\n getIdToken?(): Promise<string | undefined>;\n getProfile?(): ProfileInfo;\n },\n options: { signOutTargetUrl: string },\n ): void;\n};\n\nfunction toAppIdentityProxy(identityApi: IdentityApi): AppIdentityProxy {\n if (!('enableCookieAuth' in identityApi)) {\n throw new Error('Unexpected Identity API implementation');\n }\n return identityApi as AppIdentityProxy;\n}\n\ntype RouteResolverProxy = {\n getRouteObjects(): any[];\n};\n\n/**\n * Props for the {@link AppRouter} component.\n * @public\n */\nexport interface AppRouterProps {\n children?: ReactNode;\n SignInPageComponent?: ComponentType<SignInPageProps>;\n RouterComponent?: (props: { children: ReactNode }) => JSX.Element | null;\n extraElements?: Array<JSX.Element>;\n}\n\nfunction DefaultRouter(props: PropsWithChildren<{}>) {\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n return <BrowserRouter basename={basePath}>{props.children}</BrowserRouter>;\n}\n\n/**\n * App router and sign-in page wrapper.\n *\n * @remarks\n *\n * The AppRouter provides the routing context and renders the sign-in page.\n * Until the user has successfully signed in, this component will render\n * the sign-in page. Once the user has signed-in, it will instead render\n * the app, while providing routing and route tracking for the app.\n */\nexport function AppRouter(props: AppRouterProps) {\n const {\n children,\n SignInPageComponent,\n RouterComponent = DefaultRouter,\n extraElements = [],\n } = props;\n\n const configApi = useApi(configApiRef);\n const appIdentityProxy = toAppIdentityProxy(useApi(identityApiRef));\n const routeResolutionsApi = useApi(routeResolutionApiRef);\n const basePath = getBasePath(configApi);\n\n // TODO: Private access for now, probably replace with path -> node lookup method on the API\n if (!('getRouteObjects' in routeResolutionsApi)) {\n throw new Error('Unexpected route resolution API implementation');\n }\n const routeObjects = (\n routeResolutionsApi as RouteResolverProxy\n ).getRouteObjects();\n\n // If the app hasn't configured a sign-in page, we just continue as guest.\n if (!SignInPageComponent) {\n appIdentityProxy.setTarget(\n {\n getUserId: () => 'guest',\n getIdToken: async () => undefined,\n getProfile: () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getProfileInfo: async () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getBackstageIdentity: async () => ({\n type: 'user',\n userEntityRef: 'user:default/guest',\n ownershipEntityRefs: ['user:default/guest'],\n }),\n getCredentials: async () => ({}),\n signOut: async () => {},\n },\n { signOutTargetUrl: basePath || '/' },\n );\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n {children}\n </RouterComponent>\n );\n }\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n <SignInPageWrapper\n component={SignInPageComponent}\n appIdentityProxy={appIdentityProxy}\n >\n {children}\n </SignInPageWrapper>\n </RouterComponent>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAsDO,MAAM,UAAU,eAAgB,CAAA;AAAA,EACrC,IAAM,EAAA,MAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,KAAA,EAAO,OAAO,MAAO,EAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,QAAQ,oBAAqB,CAAA,CAAC,eAAgB,CAAA,QAAA,CAAS,SAAS,CAAG,EAAA;AAAA,MACjE,SAAW,EAAA,IAAA;AAAA,MACX,QAAU,EAAA;AAAA,KACX,CAAA;AAAA,IACD,YAAY,oBAAqB,CAAA,CAAC,mBAAoB,CAAA,QAAA,CAAS,SAAS,CAAG,EAAA;AAAA,MACzE,SAAW,EAAA,IAAA;AAAA,MACX,QAAU,EAAA;AAAA,KACX,CAAA;AAAA,IACD,QAAU,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAG,EAAA;AAAA,MAC/D,SAAW,EAAA;AAAA,KACZ,CAAA;AAAA,IACD,QAAU,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAC,CAAA;AAAA,IAC/D,UAAU,oBAAqB,CAAA;AAAA,MAC7B,wBAAwB,QAAS,CA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EAAE,gBAAkB,EAAA,QAAA,IAAY,GAAI;AAAA,KACtC;AAEA,IAAA,4BACG,eACE,EAAA,EAAA,QAAA,EAAA;AAAA,MAAG,GAAA,aAAA;AAAA,sBACJ,GAAA,CAAC,gBAAa,YAA4B,EAAA,CAAA;AAAA,MACzC;AAAA,KACH,EAAA,CAAA;AAAA;AAIJ,EAAA,4BACG,eACE,EAAA,EAAA,QAAA,EAAA;AAAA,IAAG,GAAA,aAAA;AAAA,oBACJ,GAAA,CAAC,gBAAa,YAA4B,EAAA,CAAA;AAAA,oBAC1C,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,SAAW,EAAA,mBAAA;AAAA,QACX,gBAAA;AAAA,QAEC;AAAA;AAAA;AACH,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { createExtension, createExtensionInput, coreExtensionData, useComponentRef, coreComponentRefs } from '@backstage/frontend-plugin-api';
2
+ import { createExtension, createExtensionInput, coreExtensionData, NotFoundErrorPage } from '@backstage/frontend-plugin-api';
3
3
  import { useRoutes } from 'react-router-dom';
4
4
 
5
5
  const AppRoutes = createExtension({
@@ -15,9 +15,6 @@ const AppRoutes = createExtension({
15
15
  output: [coreExtensionData.reactElement],
16
16
  factory({ inputs }) {
17
17
  const Routes = () => {
18
- const NotFoundErrorPage = useComponentRef(
19
- coreComponentRefs.notFoundErrorPage
20
- );
21
18
  const element = useRoutes([
22
19
  ...inputs.routes.map((route) => ({
23
20
  path: `${route.get(coreExtensionData.routePath).replace(/\/$/, "")}/*`,
@@ -1 +1 @@
1
- {"version":3,"file":"AppRoutes.esm.js","sources":["../../src/extensions/AppRoutes.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n coreComponentRefs,\n useComponentRef,\n} from '@backstage/frontend-plugin-api';\nimport { useRoutes } from 'react-router-dom';\n\nexport const AppRoutes = createExtension({\n name: 'routes',\n attachTo: { id: 'app/layout', input: 'content' },\n inputs: {\n routes: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n ]),\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs }) {\n const Routes = () => {\n const NotFoundErrorPage = useComponentRef(\n coreComponentRefs.notFoundErrorPage,\n );\n\n const element = useRoutes([\n ...inputs.routes.map(route => ({\n path: `${route\n .get(coreExtensionData.routePath)\n .replace(/\\/$/, '')}/*`,\n element: route.get(coreExtensionData.reactElement),\n })),\n {\n path: '*',\n element: <NotFoundErrorPage />,\n },\n ]);\n\n return element;\n };\n\n return [coreExtensionData.reactElement(<Routes />)];\n },\n});\n"],"names":[],"mappings":";;;;AAyBO,MAAM,YAAY,eAAgB,CAAA;AAAA,EACvC,IAAM,EAAA,QAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,YAAA,EAAc,OAAO,SAAU,EAAA;AAAA,EAC/C,MAAQ,EAAA;AAAA,IACN,QAAQ,oBAAqB,CAAA;AAAA,MAC3B,iBAAkB,CAAA,SAAA;AAAA,MAClB,iBAAA,CAAkB,SAAS,QAAS,EAAA;AAAA,MACpC,iBAAkB,CAAA;AAAA,KACnB;AAAA,GACH;AAAA,EACA,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,OAAA,CAAQ,EAAE,MAAA,EAAU,EAAA;AAClB,IAAA,MAAM,SAAS,MAAM;AACnB,MAAA,MAAM,iBAAoB,GAAA,eAAA;AAAA,QACxB,iBAAkB,CAAA;AAAA,OACpB;AAEA,MAAA,MAAM,UAAU,SAAU,CAAA;AAAA,QACxB,GAAG,MAAA,CAAO,MAAO,CAAA,GAAA,CAAI,CAAU,KAAA,MAAA;AAAA,UAC7B,IAAA,EAAM,CAAG,EAAA,KAAA,CACN,GAAI,CAAA,iBAAA,CAAkB,SAAS,CAC/B,CAAA,OAAA,CAAQ,KAAO,EAAA,EAAE,CAAC,CAAA,EAAA,CAAA;AAAA,UACrB,OAAS,EAAA,KAAA,CAAM,GAAI,CAAA,iBAAA,CAAkB,YAAY;AAAA,SACjD,CAAA,CAAA;AAAA,QACF;AAAA,UACE,IAAM,EAAA,GAAA;AAAA,UACN,OAAA,sBAAU,iBAAkB,EAAA,EAAA;AAAA;AAC9B,OACD,CAAA;AAED,MAAO,OAAA,OAAA;AAAA,KACT;AAEA,IAAA,OAAO,CAAC,iBAAkB,CAAA,YAAA,iBAAc,GAAA,CAAA,MAAA,EAAA,EAAO,CAAE,CAAC,CAAA;AAAA;AAEtD,CAAC;;;;"}
1
+ {"version":3,"file":"AppRoutes.esm.js","sources":["../../src/extensions/AppRoutes.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n NotFoundErrorPage,\n} from '@backstage/frontend-plugin-api';\nimport { useRoutes } from 'react-router-dom';\n\nexport const AppRoutes = createExtension({\n name: 'routes',\n attachTo: { id: 'app/layout', input: 'content' },\n inputs: {\n routes: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n ]),\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs }) {\n const Routes = () => {\n const element = useRoutes([\n ...inputs.routes.map(route => ({\n path: `${route\n .get(coreExtensionData.routePath)\n .replace(/\\/$/, '')}/*`,\n element: route.get(coreExtensionData.reactElement),\n })),\n {\n path: '*',\n element: <NotFoundErrorPage />,\n },\n ]);\n\n return element;\n };\n\n return [coreExtensionData.reactElement(<Routes />)];\n },\n});\n"],"names":[],"mappings":";;;;AAwBO,MAAM,YAAY,eAAgB,CAAA;AAAA,EACvC,IAAM,EAAA,QAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,YAAA,EAAc,OAAO,SAAU,EAAA;AAAA,EAC/C,MAAQ,EAAA;AAAA,IACN,QAAQ,oBAAqB,CAAA;AAAA,MAC3B,iBAAkB,CAAA,SAAA;AAAA,MAClB,iBAAA,CAAkB,SAAS,QAAS,EAAA;AAAA,MACpC,iBAAkB,CAAA;AAAA,KACnB;AAAA,GACH;AAAA,EACA,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,OAAA,CAAQ,EAAE,MAAA,EAAU,EAAA;AAClB,IAAA,MAAM,SAAS,MAAM;AACnB,MAAA,MAAM,UAAU,SAAU,CAAA;AAAA,QACxB,GAAG,MAAA,CAAO,MAAO,CAAA,GAAA,CAAI,CAAU,KAAA,MAAA;AAAA,UAC7B,IAAA,EAAM,CAAG,EAAA,KAAA,CACN,GAAI,CAAA,iBAAA,CAAkB,SAAS,CAC/B,CAAA,OAAA,CAAQ,KAAO,EAAA,EAAE,CAAC,CAAA,EAAA,CAAA;AAAA,UACrB,OAAS,EAAA,KAAA,CAAM,GAAI,CAAA,iBAAA,CAAkB,YAAY;AAAA,SACjD,CAAA,CAAA;AAAA,QACF;AAAA,UACE,IAAM,EAAA,GAAA;AAAA,UACN,OAAA,sBAAU,iBAAkB,EAAA,EAAA;AAAA;AAC9B,OACD,CAAA;AAED,MAAO,OAAA,OAAA;AAAA,KACT;AAEA,IAAA,OAAO,CAAC,iBAAkB,CAAA,YAAA,iBAAc,GAAA,CAAA,MAAA,EAAA,EAAO,CAAE,CAAC,CAAA;AAAA;AAEtD,CAAC;;;;"}
@@ -18,7 +18,7 @@ const AppThemeApi = ApiBlueprint.makeWithOverrides({
18
18
  },
19
19
  factory: (originalFactory, { inputs }) => {
20
20
  return originalFactory(
21
- (define) => define({
21
+ (defineParams) => defineParams({
22
22
  api: appThemeApiRef,
23
23
  deps: {},
24
24
  factory: () => AppThemeSelector.createWithStorage(
@@ -1 +1 @@
1
- {"version":3,"file":"AppThemeApi.esm.js","sources":["../../src/extensions/AppThemeApi.tsx"],"sourcesContent":["/*\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 {\n UnifiedThemeProvider,\n themes as builtinThemes,\n} from '@backstage/theme';\nimport DarkIcon from '@material-ui/icons/Brightness2';\nimport LightIcon from '@material-ui/icons/WbSunny';\nimport {\n createExtensionInput,\n ThemeBlueprint,\n ApiBlueprint,\n appThemeApiRef,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppThemeSelector } from '../../../../packages/core-app-api/src/apis/implementations';\n\n/**\n * Contains the themes installed into the app.\n */\nexport const AppThemeApi = ApiBlueprint.makeWithOverrides({\n name: 'app-theme',\n inputs: {\n themes: createExtensionInput([ThemeBlueprint.dataRefs.theme], {\n replaces: [{ id: 'app', input: 'themes' }],\n }),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(define =>\n define({\n api: appThemeApiRef,\n deps: {},\n factory: () =>\n AppThemeSelector.createWithStorage(\n inputs.themes.map(i => i.get(ThemeBlueprint.dataRefs.theme)),\n ),\n }),\n );\n },\n});\n\nexport const LightTheme = ThemeBlueprint.make({\n name: 'light',\n params: {\n theme: {\n id: 'light',\n title: 'Light Theme',\n variant: 'light',\n icon: <LightIcon />,\n Provider: ({ children }) => (\n <UnifiedThemeProvider theme={builtinThemes.light} children={children} />\n ),\n },\n },\n});\n\nexport const DarkTheme = ThemeBlueprint.make({\n name: 'dark',\n params: {\n theme: {\n id: 'dark',\n title: 'Dark Theme',\n variant: 'dark',\n icon: <DarkIcon />,\n Provider: ({ children }) => (\n <UnifiedThemeProvider theme={builtinThemes.dark} children={children} />\n ),\n },\n },\n});\n"],"names":["builtinThemes"],"mappings":";;;;;;;;;;;AAkCa,MAAA,WAAA,GAAc,aAAa,iBAAkB,CAAA;AAAA,EACxD,IAAM,EAAA,WAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,QAAQ,oBAAqB,CAAA,CAAC,cAAe,CAAA,QAAA,CAAS,KAAK,CAAG,EAAA;AAAA,MAC5D,UAAU,CAAC,EAAE,IAAI,KAAO,EAAA,KAAA,EAAO,UAAU;AAAA,KAC1C;AAAA,GACH;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAO,OAAA,eAAA;AAAA,MAAgB,YACrB,MAAO,CAAA;AAAA,QACL,GAAK,EAAA,cAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,gBAAiB,CAAA,iBAAA;AAAA,UACf,MAAA,CAAO,OAAO,GAAI,CAAA,CAAA,CAAA,KAAK,EAAE,GAAI,CAAA,cAAA,CAAe,QAAS,CAAA,KAAK,CAAC;AAAA;AAC7D,OACH;AAAA,KACH;AAAA;AAEJ,CAAC;AAEY,MAAA,UAAA,GAAa,eAAe,IAAK,CAAA;AAAA,EAC5C,IAAM,EAAA,OAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA;AAAA,MACL,EAAI,EAAA,OAAA;AAAA,MACJ,KAAO,EAAA,aAAA;AAAA,MACP,OAAS,EAAA,OAAA;AAAA,MACT,IAAA,sBAAO,SAAU,EAAA,EAAA,CAAA;AAAA,MACjB,QAAA,EAAU,CAAC,EAAE,QAAS,EAAA,yBACnB,oBAAqB,EAAA,EAAA,KAAA,EAAOA,MAAc,CAAA,KAAA,EAAO,QAAoB,EAAA;AAAA;AAE1E;AAEJ,CAAC;AAEY,MAAA,SAAA,GAAY,eAAe,IAAK,CAAA;AAAA,EAC3C,IAAM,EAAA,MAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA;AAAA,MACL,EAAI,EAAA,MAAA;AAAA,MACJ,KAAO,EAAA,YAAA;AAAA,MACP,OAAS,EAAA,MAAA;AAAA,MACT,IAAA,sBAAO,QAAS,EAAA,EAAA,CAAA;AAAA,MAChB,QAAA,EAAU,CAAC,EAAE,QAAS,EAAA,yBACnB,oBAAqB,EAAA,EAAA,KAAA,EAAOA,MAAc,CAAA,IAAA,EAAM,QAAoB,EAAA;AAAA;AAEzE;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"AppThemeApi.esm.js","sources":["../../src/extensions/AppThemeApi.tsx"],"sourcesContent":["/*\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 {\n UnifiedThemeProvider,\n themes as builtinThemes,\n} from '@backstage/theme';\nimport DarkIcon from '@material-ui/icons/Brightness2';\nimport LightIcon from '@material-ui/icons/WbSunny';\nimport {\n createExtensionInput,\n ThemeBlueprint,\n ApiBlueprint,\n appThemeApiRef,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppThemeSelector } from '../../../../packages/core-app-api/src/apis/implementations';\n\n/**\n * Contains the themes installed into the app.\n */\nexport const AppThemeApi = ApiBlueprint.makeWithOverrides({\n name: 'app-theme',\n inputs: {\n themes: createExtensionInput([ThemeBlueprint.dataRefs.theme], {\n replaces: [{ id: 'app', input: 'themes' }],\n }),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(defineParams =>\n defineParams({\n api: appThemeApiRef,\n deps: {},\n factory: () =>\n AppThemeSelector.createWithStorage(\n inputs.themes.map(i => i.get(ThemeBlueprint.dataRefs.theme)),\n ),\n }),\n );\n },\n});\n\nexport const LightTheme = ThemeBlueprint.make({\n name: 'light',\n params: {\n theme: {\n id: 'light',\n title: 'Light Theme',\n variant: 'light',\n icon: <LightIcon />,\n Provider: ({ children }) => (\n <UnifiedThemeProvider theme={builtinThemes.light} children={children} />\n ),\n },\n },\n});\n\nexport const DarkTheme = ThemeBlueprint.make({\n name: 'dark',\n params: {\n theme: {\n id: 'dark',\n title: 'Dark Theme',\n variant: 'dark',\n icon: <DarkIcon />,\n Provider: ({ children }) => (\n <UnifiedThemeProvider theme={builtinThemes.dark} children={children} />\n ),\n },\n },\n});\n"],"names":["builtinThemes"],"mappings":";;;;;;;;;;;AAkCa,MAAA,WAAA,GAAc,aAAa,iBAAkB,CAAA;AAAA,EACxD,IAAM,EAAA,WAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,QAAQ,oBAAqB,CAAA,CAAC,cAAe,CAAA,QAAA,CAAS,KAAK,CAAG,EAAA;AAAA,MAC5D,UAAU,CAAC,EAAE,IAAI,KAAO,EAAA,KAAA,EAAO,UAAU;AAAA,KAC1C;AAAA,GACH;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,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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 { Fragment, useEffect, useState } from 'react';\nimport {\n AppRootElementBlueprint,\n DialogApi,\n DialogApiDialog,\n dialogApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { createDeferred } from '@backstage/types';\nimport { OnShowDialog } from '../apis/DefaultDialogApi';\nimport Dialog from '@material-ui/core/Dialog';\n\nlet dialogId = 0;\nfunction getDialogId() {\n dialogId += 1;\n return dialogId.toString(36);\n}\n\ntype DialogState = DialogApiDialog & {\n id: string;\n modal: boolean;\n};\n\n/**\n * The other half of the default implementation of the {@link DialogApi}.\n *\n * This component is responsible for rendering the dialogs in the React tree and managing a stack of dialogs.\n * It expects the implementation of the {@link DialogApi} to be the `DefaultDialogApi`. If one is replaced the other must be too.\n * @internal\n */\nfunction DialogDisplay({\n dialogApi,\n}: {\n dialogApi: DialogApi & { connect(onShow: OnShowDialog): void };\n}) {\n const [dialogs, setDialogs] = useState<\n { dialog: DialogState; element: React.JSX.Element }[]\n >([]);\n\n useEffect(() => {\n dialogApi.connect(options => {\n const id = getDialogId();\n const deferred = createDeferred<unknown>();\n const dialog: DialogState = {\n id,\n modal: options.modal,\n close(result) {\n deferred.resolve(result);\n setDialogs(ds => ds.filter(d => d.dialog.id !== id));\n },\n update(ElementOrComponent) {\n const element =\n typeof ElementOrComponent === 'function' ? (\n <ElementOrComponent dialog={dialog} />\n ) : (\n ElementOrComponent\n );\n setDialogs(ds =>\n ds.map(d => (d.dialog.id === id ? { dialog, element } : d)),\n );\n },\n async result() {\n return deferred;\n },\n };\n const element = <options.component dialog={dialog} />;\n setDialogs(ds => [...ds, { dialog, element }]);\n return dialog;\n });\n }, [dialogApi]);\n\n if (dialogs.length > 0) {\n const lastDialog = dialogs[dialogs.length - 1];\n return (\n <Dialog\n open\n onClose={() => {\n if (!lastDialog.dialog.modal) {\n lastDialog.dialog.close();\n }\n }}\n >\n {lastDialog.element}\n </Dialog>\n );\n }\n\n return null;\n}\n\nexport const dialogDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n name: 'dialog-display',\n factory(originalFactory, { apis }) {\n const dialogApi = apis.get(dialogApiRef);\n if (!isInternalDialogApi(dialogApi)) {\n return originalFactory({\n element: <Fragment />,\n });\n }\n return originalFactory({\n element: <DialogDisplay dialogApi={dialogApi} />,\n });\n },\n });\n\nfunction isInternalDialogApi(\n dialogApi?: DialogApi,\n): dialogApi is DialogApi & { connect(onShow: OnShowDialog): void } {\n if (!dialogApi) {\n return false;\n }\n return 'connect' in dialogApi;\n}\n"],"names":["element"],"mappings":";;;;;;AA2BA,IAAI,QAAW,GAAA,CAAA;AACf,SAAS,WAAc,GAAA;AACrB,EAAY,QAAA,IAAA,CAAA;AACZ,EAAO,OAAA,QAAA,CAAS,SAAS,EAAE,CAAA;AAC7B;AAcA,SAAS,aAAc,CAAA;AAAA,EACrB;AACF,CAEG,EAAA;AACD,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,QAAA,CAE5B,EAAE,CAAA;AAEJ,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,SAAA,CAAU,QAAQ,CAAW,OAAA,KAAA;AAC3B,MAAA,MAAM,KAAK,WAAY,EAAA;AACvB,MAAA,MAAM,WAAW,cAAwB,EAAA;AACzC,MAAA,MAAM,MAAsB,GAAA;AAAA,QAC1B,EAAA;AAAA,QACA,OAAO,OAAQ,CAAA,KAAA;AAAA,QACf,MAAM,MAAQ,EAAA;AACZ,UAAA,QAAA,CAAS,QAAQ,MAAM,CAAA;AACvB,UAAW,UAAA,CAAA,CAAA,EAAA,KAAM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IJ,EAAO,OAAA,IAAA;AACT;AAEa,MAAA,2BAAA,GACX,wBAAwB,iBAAkB,CAAA;AAAA,EACxC,IAAM,EAAA,gBAAA;AAAA,EACN,OAAQ,CAAA,eAAA,EAAiB,EAAE,IAAA,EAAQ,EAAA;AACjC,IAAM,MAAA,SAAA,GAAY,IAAK,CAAA,GAAA,CAAI,YAAY,CAAA;AACvC,IAAI,IAAA,CAAC,mBAAoB,CAAA,SAAS,CAAG,EAAA;AACnC,MAAA,OAAO,eAAgB,CAAA;AAAA,QACrB,OAAA,sBAAU,QAAS,EAAA,EAAA;AAAA,OACpB,CAAA;AAAA;AAEH,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,OAAA,kBAAU,GAAA,CAAA,aAAA,EAAA,EAAc,SAAsB,EAAA;AAAA,KAC/C,CAAA;AAAA;AAEL,CAAC;AAEH,SAAS,oBACP,SACkE,EAAA;AAClE,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAO,OAAA,KAAA;AAAA;AAET,EAAA,OAAO,SAAa,IAAA,SAAA;AACtB;;;;"}
1
+ {"version":3,"file":"DialogDisplay.esm.js","sources":["../../src/extensions/DialogDisplay.tsx"],"sourcesContent":["/*\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 { Fragment, useEffect, useState } from 'react';\nimport {\n AppRootElementBlueprint,\n DialogApi,\n DialogApiDialog,\n dialogApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { createDeferred } from '@backstage/types';\nimport { OnShowDialog } from '../apis/DefaultDialogApi';\nimport Dialog from '@material-ui/core/Dialog';\n\nlet dialogId = 0;\nfunction getDialogId() {\n dialogId += 1;\n return dialogId.toString(36);\n}\n\ntype DialogState = DialogApiDialog<unknown> & {\n id: string;\n modal: boolean;\n};\n\n/**\n * The other half of the default implementation of the {@link DialogApi}.\n *\n * This component is responsible for rendering the dialogs in the React tree and managing a stack of dialogs.\n * It expects the implementation of the {@link DialogApi} to be the `DefaultDialogApi`. If one is replaced the other must be too.\n * @internal\n */\nfunction DialogDisplay({\n dialogApi,\n}: {\n dialogApi: DialogApi & { connect(onShow: OnShowDialog): void };\n}) {\n const [dialogs, setDialogs] = useState<\n { dialog: DialogState; element: React.JSX.Element }[]\n >([]);\n\n useEffect(() => {\n dialogApi.connect(options => {\n const id = getDialogId();\n const deferred = createDeferred<unknown>();\n const dialog: DialogState = {\n id,\n modal: options.modal,\n close(result) {\n deferred.resolve(result);\n setDialogs(ds => ds.filter(d => d.dialog.id !== id));\n },\n update(ElementOrComponent) {\n const element =\n typeof ElementOrComponent === 'function' ? (\n <ElementOrComponent dialog={dialog} />\n ) : (\n ElementOrComponent\n );\n setDialogs(ds =>\n ds.map(d => (d.dialog.id === id ? { dialog, element } : d)),\n );\n },\n async result() {\n return deferred;\n },\n };\n const element = <options.component dialog={dialog} />;\n setDialogs(ds => [...ds, { dialog, element }]);\n return dialog;\n });\n }, [dialogApi]);\n\n if (dialogs.length > 0) {\n const lastDialog = dialogs[dialogs.length - 1];\n return (\n <Dialog\n open\n onClose={() => {\n if (!lastDialog.dialog.modal) {\n lastDialog.dialog.close();\n }\n }}\n >\n {lastDialog.element}\n </Dialog>\n );\n }\n\n return null;\n}\n\nexport const dialogDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n name: 'dialog-display',\n factory(originalFactory, { apis }) {\n const dialogApi = apis.get(dialogApiRef);\n if (!isInternalDialogApi(dialogApi)) {\n return originalFactory({\n element: <Fragment />,\n });\n }\n return originalFactory({\n element: <DialogDisplay dialogApi={dialogApi} />,\n });\n },\n });\n\nfunction isInternalDialogApi(\n dialogApi?: DialogApi,\n): dialogApi is DialogApi & { connect(onShow: OnShowDialog): void } {\n if (!dialogApi) {\n return false;\n }\n return 'connect' in dialogApi;\n}\n"],"names":["element"],"mappings":";;;;;;AA2BA,IAAI,QAAW,GAAA,CAAA;AACf,SAAS,WAAc,GAAA;AACrB,EAAY,QAAA,IAAA,CAAA;AACZ,EAAO,OAAA,QAAA,CAAS,SAAS,EAAE,CAAA;AAC7B;AAcA,SAAS,aAAc,CAAA;AAAA,EACrB;AACF,CAEG,EAAA;AACD,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,QAAA,CAE5B,EAAE,CAAA;AAEJ,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,SAAA,CAAU,QAAQ,CAAW,OAAA,KAAA;AAC3B,MAAA,MAAM,KAAK,WAAY,EAAA;AACvB,MAAA,MAAM,WAAW,cAAwB,EAAA;AACzC,MAAA,MAAM,MAAsB,GAAA;AAAA,QAC1B,EAAA;AAAA,QACA,OAAO,OAAQ,CAAA,KAAA;AAAA,QACf,MAAM,MAAQ,EAAA;AACZ,UAAA,QAAA,CAAS,QAAQ,MAAM,CAAA;AACvB,UAAW,UAAA,CAAA,CAAA,EAAA,KAAM,GAAG,MAAO,CAAA,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA,EAAA,KAAO,EAAE,CAAC,CAAA;AAAA,SACrD;AAAA,QACA,OAAO,kBAAoB,EAAA;AACzB,UAAA,MAAMA,WACJ,OAAO,kBAAA,KAAuB,6BAC3B,GAAA,CAAA,kBAAA,EAAA,EAAmB,QAAgB,CAEpC,GAAA,kBAAA;AAEJ,UAAA,UAAA;AAAA,YAAW,CACT,EAAA,KAAA,EAAA,CAAG,GAAI,CAAA,CAAA,CAAA,KAAM,CAAE,CAAA,MAAA,CAAO,EAAO,KAAA,EAAA,GAAK,EAAE,MAAA,EAAQ,OAAAA,EAAAA,QAAAA,KAAY,CAAE;AAAA,WAC5D;AAAA,SACF;AAAA,QACA,MAAM,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,SAAsB,EAAA;AAAA,KAC/C,CAAA;AAAA;AAEL,CAAC;AAEH,SAAS,oBACP,SACkE,EAAA;AAClE,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAO,OAAA,KAAA;AAAA;AAET,EAAA,OAAO,SAAa,IAAA,SAAA;AACtB;;;;"}
@@ -3,7 +3,7 @@ import { LocalStorageFeatureFlags } from '../packages/core-app-api/src/apis/impl
3
3
 
4
4
  const FeatureFlagsApi = ApiBlueprint.make({
5
5
  name: "feature-flags",
6
- params: (define) => define({
6
+ params: (defineParams) => defineParams({
7
7
  // TODO: properly discovery feature flags, maybe rework the whole thing
8
8
  api: featureFlagsApiRef,
9
9
  deps: {},
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureFlagsApi.esm.js","sources":["../../src/extensions/FeatureFlagsApi.ts"],"sourcesContent":["/*\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 {\n ApiBlueprint,\n featureFlagsApiRef,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { LocalStorageFeatureFlags } from '../../../../packages/core-app-api/src/apis/implementations/FeatureFlagsApi/LocalStorageFeatureFlags';\n\n/**\n * Contains the shareable icons installed into the app.\n */\nexport const FeatureFlagsApi = ApiBlueprint.make({\n name: 'feature-flags',\n params: define =>\n define({\n // TODO: properly discovery feature flags, maybe rework the whole thing\n api: featureFlagsApiRef,\n deps: {},\n factory: () => new LocalStorageFeatureFlags(),\n }),\n});\n"],"names":[],"mappings":";;;AA0Ba,MAAA,eAAA,GAAkB,aAAa,IAAK,CAAA;AAAA,EAC/C,IAAM,EAAA,eAAA;AAAA,EACN,MAAA,EAAQ,YACN,MAAO,CAAA;AAAA;AAAA,IAEL,GAAK,EAAA,kBAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,IAAI,wBAAyB;AAAA,GAC7C;AACL,CAAC;;;;"}
1
+ {"version":3,"file":"FeatureFlagsApi.esm.js","sources":["../../src/extensions/FeatureFlagsApi.ts"],"sourcesContent":["/*\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 {\n ApiBlueprint,\n featureFlagsApiRef,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { LocalStorageFeatureFlags } from '../../../../packages/core-app-api/src/apis/implementations/FeatureFlagsApi/LocalStorageFeatureFlags';\n\n/**\n * Contains the shareable icons installed into the app.\n */\nexport const FeatureFlagsApi = ApiBlueprint.make({\n name: 'feature-flags',\n params: defineParams =>\n defineParams({\n // TODO: properly discovery feature flags, maybe rework the whole thing\n api: featureFlagsApiRef,\n deps: {},\n factory: () => new LocalStorageFeatureFlags(),\n }),\n});\n"],"names":[],"mappings":";;;AA0Ba,MAAA,eAAA,GAAkB,aAAa,IAAK,CAAA;AAAA,EAC/C,IAAM,EAAA,eAAA;AAAA,EACN,MAAA,EAAQ,kBACN,YAAa,CAAA;AAAA;AAAA,IAEX,GAAK,EAAA,kBAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,IAAI,wBAAyB;AAAA,GAC7C;AACL,CAAC;;;;"}
@@ -19,7 +19,7 @@ const IconsApi = ApiBlueprint.makeWithOverrides({
19
19
  },
20
20
  factory: (originalFactory, { inputs }) => {
21
21
  return originalFactory(
22
- (define) => define({
22
+ (defineParams) => defineParams({
23
23
  api: iconsApiRef,
24
24
  deps: {},
25
25
  factory: () => new DefaultIconsApi(
@@ -1 +1 @@
1
- {"version":3,"file":"IconsApi.esm.js","sources":["../../src/extensions/IconsApi.ts"],"sourcesContent":["/*\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 {\n createExtensionInput,\n IconBundleBlueprint,\n ApiBlueprint,\n iconsApiRef,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { DefaultIconsApi } from '../../../../packages/frontend-app-api/src/apis/implementations/IconsApi';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { icons as defaultIcons } from '../../../../packages/app-defaults/src/defaults';\n\n/**\n * Contains the shareable icons installed into the app.\n */\nexport const IconsApi = ApiBlueprint.makeWithOverrides({\n name: 'icons',\n inputs: {\n icons: createExtensionInput([IconBundleBlueprint.dataRefs.icons], {\n replaces: [{ id: 'app', input: 'icons' }],\n }),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(define =>\n define({\n api: iconsApiRef,\n deps: {},\n factory: () =>\n new DefaultIconsApi(\n inputs.icons\n .map(i => i.get(IconBundleBlueprint.dataRefs.icons))\n .reduce((acc, bundle) => ({ ...acc, ...bundle }), defaultIcons),\n ),\n }),\n );\n },\n});\n"],"names":["defaultIcons"],"mappings":";;;;;;;;;;;;AA8Ba,MAAA,QAAA,GAAW,aAAa,iBAAkB,CAAA;AAAA,EACrD,IAAM,EAAA,OAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,OAAO,oBAAqB,CAAA,CAAC,mBAAoB,CAAA,QAAA,CAAS,KAAK,CAAG,EAAA;AAAA,MAChE,UAAU,CAAC,EAAE,IAAI,KAAO,EAAA,KAAA,EAAO,SAAS;AAAA,KACzC;AAAA,GACH;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAO,OAAA,eAAA;AAAA,MAAgB,YACrB,MAAO,CAAA;AAAA,QACL,GAAK,EAAA,WAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,IAAI,eAAA;AAAA,UACF,MAAA,CAAO,MACJ,GAAI,CAAA,CAAA,CAAA,KAAK,EAAE,GAAI,CAAA,mBAAA,CAAoB,SAAS,KAAK,CAAC,EAClD,MAAO,CAAA,CAAC,KAAK,MAAY,MAAA,EAAE,GAAG,GAAK,EAAA,GAAG,MAAO,EAAA,CAAA,EAAIA,KAAY;AAAA;AAClE,OACH;AAAA,KACH;AAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"IconsApi.esm.js","sources":["../../src/extensions/IconsApi.ts"],"sourcesContent":["/*\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 {\n createExtensionInput,\n IconBundleBlueprint,\n ApiBlueprint,\n iconsApiRef,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { DefaultIconsApi } from '../../../../packages/frontend-app-api/src/apis/implementations/IconsApi';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { icons as defaultIcons } from '../../../../packages/app-defaults/src/defaults';\n\n/**\n * Contains the shareable icons installed into the app.\n */\nexport const IconsApi = ApiBlueprint.makeWithOverrides({\n name: 'icons',\n inputs: {\n icons: createExtensionInput([IconBundleBlueprint.dataRefs.icons], {\n replaces: [{ id: 'app', input: 'icons' }],\n }),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(defineParams =>\n defineParams({\n api: iconsApiRef,\n deps: {},\n factory: () =>\n new DefaultIconsApi(\n inputs.icons\n .map(i => i.get(IconBundleBlueprint.dataRefs.icons))\n .reduce((acc, bundle) => ({ ...acc, ...bundle }), defaultIcons),\n ),\n }),\n );\n },\n});\n"],"names":["defaultIcons"],"mappings":";;;;;;;;;;;;AA8Ba,MAAA,QAAA,GAAW,aAAa,iBAAkB,CAAA;AAAA,EACrD,IAAM,EAAA,OAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,OAAO,oBAAqB,CAAA,CAAC,mBAAoB,CAAA,QAAA,CAAS,KAAK,CAAG,EAAA;AAAA,MAChE,UAAU,CAAC,EAAE,IAAI,KAAO,EAAA,KAAA,EAAO,SAAS;AAAA,KACzC;AAAA,GACH;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAO,OAAA,eAAA;AAAA,MAAgB,kBACrB,YAAa,CAAA;AAAA,QACX,GAAK,EAAA,WAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,IAAI,eAAA;AAAA,UACF,MAAA,CAAO,MACJ,GAAI,CAAA,CAAA,CAAA,KAAK,EAAE,GAAI,CAAA,mBAAA,CAAoB,SAAS,KAAK,CAAC,EAClD,MAAO,CAAA,CAAC,KAAK,MAAY,MAAA,EAAE,GAAG,GAAK,EAAA,GAAG,MAAO,EAAA,CAAA,EAAIA,KAAY;AAAA;AAClE,OACH;AAAA,KACH;AAAA;AAEJ,CAAC;;;;"}
@@ -0,0 +1,26 @@
1
+ import { ApiBlueprint, createApiRef, Progress, NotFoundErrorPage, ErrorDisplay } from '@backstage/frontend-plugin-api';
2
+
3
+ const LegacyComponentsApi = ApiBlueprint.make({
4
+ name: "components",
5
+ params: (defineParams) => defineParams({
6
+ api: createApiRef({ id: "core.components" }),
7
+ deps: {},
8
+ factory: () => ({
9
+ getComponent(ref) {
10
+ if (ref.id === "core.components.progress") {
11
+ return Progress;
12
+ }
13
+ if (ref.id === "core.components.notFoundErrorPage") {
14
+ return NotFoundErrorPage;
15
+ }
16
+ if (ref.id === "core.components.errorBoundaryFallback") {
17
+ return ErrorDisplay;
18
+ }
19
+ throw new Error(`No implementation found for component ref ${ref}`);
20
+ }
21
+ })
22
+ })
23
+ });
24
+
25
+ export { LegacyComponentsApi };
26
+ //# sourceMappingURL=LegacyComponentsApi.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegacyComponentsApi.esm.js","sources":["../../src/extensions/LegacyComponentsApi.ts"],"sourcesContent":["/*\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 {\n ApiBlueprint,\n createApiRef,\n ErrorDisplay,\n NotFoundErrorPage,\n Progress,\n} from '@backstage/frontend-plugin-api';\nimport { ComponentType } from 'react';\n\n/**\n * This is the old component API that has been replaced by the new SwappableComponentsApi.\n *\n * This backwards compatibility implementation exists to avoid breaking older plugins.\n *\n * This was added for the 1.42 release, and can be removed in the future.\n *\n * @internal\n */\nexport const LegacyComponentsApi = ApiBlueprint.make({\n name: 'components',\n params: defineParams =>\n defineParams({\n api: createApiRef<{\n getComponent(ref: { id: string }): ComponentType<any>;\n }>({ id: 'core.components' }),\n deps: {},\n factory: () => ({\n getComponent(ref) {\n if (ref.id === 'core.components.progress') {\n return Progress;\n }\n if (ref.id === 'core.components.notFoundErrorPage') {\n return NotFoundErrorPage;\n }\n if (ref.id === 'core.components.errorBoundaryFallback') {\n return ErrorDisplay;\n }\n throw new Error(`No implementation found for component ref ${ref}`);\n },\n }),\n }),\n});\n"],"names":[],"mappings":";;AAkCa,MAAA,mBAAA,GAAsB,aAAa,IAAK,CAAA;AAAA,EACnD,IAAM,EAAA,YAAA;AAAA,EACN,MAAA,EAAQ,kBACN,YAAa,CAAA;AAAA,IACX,GAAK,EAAA,YAAA,CAEF,EAAE,EAAA,EAAI,mBAAmB,CAAA;AAAA,IAC5B,MAAM,EAAC;AAAA,IACP,SAAS,OAAO;AAAA,MACd,aAAa,GAAK,EAAA;AAChB,QAAI,IAAA,GAAA,CAAI,OAAO,0BAA4B,EAAA;AACzC,UAAO,OAAA,QAAA;AAAA;AAET,QAAI,IAAA,GAAA,CAAI,OAAO,mCAAqC,EAAA;AAClD,UAAO,OAAA,iBAAA;AAAA;AAET,QAAI,IAAA,GAAA,CAAI,OAAO,uCAAyC,EAAA;AACtD,UAAO,OAAA,YAAA;AAAA;AAET,QAAA,MAAM,IAAI,KAAA,CAAM,CAA6C,0CAAA,EAAA,GAAG,CAAE,CAAA,CAAA;AAAA;AACpE,KACF;AAAA,GACD;AACL,CAAC;;;;"}
@@ -0,0 +1,40 @@
1
+ import { ApiBlueprint, createExtensionInput, SwappableComponentBlueprint, swappableComponentsApiRef } from '@backstage/frontend-plugin-api';
2
+ import { DefaultSwappableComponentsApi } from '../apis/SwappableComponentsApi/DefaultSwappableComponentsApi.esm.js';
3
+
4
+ const SwappableComponentsApi = ApiBlueprint.makeWithOverrides({
5
+ name: "swappable-components",
6
+ inputs: {
7
+ components: createExtensionInput([
8
+ SwappableComponentBlueprint.dataRefs.component
9
+ ])
10
+ },
11
+ factory: (originalFactory, { inputs }) => {
12
+ return originalFactory(
13
+ (defineParams) => defineParams({
14
+ api: swappableComponentsApiRef,
15
+ deps: {},
16
+ factory: () => {
17
+ const nonAppExtensions = inputs.components.filter(
18
+ (i) => i.node.spec.plugin?.id !== "app"
19
+ );
20
+ if (nonAppExtensions.length > 0) {
21
+ console.warn(
22
+ `SwappableComponents should only be installed as an extension in the app plugin. You can either use appPlugin.override(), or provide a module for the app-plugin with the extension there instead. Invalid extensions: ${nonAppExtensions.map((i) => i.node.spec.id).join(", ")}`
23
+ );
24
+ }
25
+ const appExtensions = inputs.components.filter(
26
+ (i) => i.node.spec.plugin?.id === "app"
27
+ );
28
+ return DefaultSwappableComponentsApi.fromComponents(
29
+ appExtensions.map(
30
+ (i) => i.get(SwappableComponentBlueprint.dataRefs.component)
31
+ )
32
+ );
33
+ }
34
+ })
35
+ );
36
+ }
37
+ });
38
+
39
+ export { SwappableComponentsApi };
40
+ //# sourceMappingURL=SwappableComponentsApi.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwappableComponentsApi.esm.js","sources":["../../src/extensions/SwappableComponentsApi.ts"],"sourcesContent":["/*\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 {\n SwappableComponentBlueprint,\n createExtensionInput,\n ApiBlueprint,\n swappableComponentsApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { DefaultSwappableComponentsApi } from '../apis/SwappableComponentsApi';\n\n/**\n * Contains the shareable components installed into the app.\n */\nexport const SwappableComponentsApi = ApiBlueprint.makeWithOverrides({\n name: 'swappable-components',\n inputs: {\n components: createExtensionInput([\n SwappableComponentBlueprint.dataRefs.component,\n ]),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(defineParams =>\n defineParams({\n api: swappableComponentsApiRef,\n deps: {},\n factory: () => {\n const nonAppExtensions = inputs.components.filter(\n i => i.node.spec.plugin?.id !== 'app',\n );\n\n if (nonAppExtensions.length > 0) {\n // eslint-disable-next-line no-console\n console.warn(\n `SwappableComponents should only be installed as an extension in the app plugin. You can either use appPlugin.override(), or provide a module for the app-plugin with the extension there instead. Invalid extensions: ${nonAppExtensions\n .map(i => i.node.spec.id)\n .join(', ')}`,\n );\n }\n\n const appExtensions = inputs.components.filter(\n i => i.node.spec.plugin?.id === 'app',\n );\n\n return DefaultSwappableComponentsApi.fromComponents(\n appExtensions.map(i =>\n i.get(SwappableComponentBlueprint.dataRefs.component),\n ),\n );\n },\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;AA2Ba,MAAA,sBAAA,GAAyB,aAAa,iBAAkB,CAAA;AAAA,EACnE,IAAM,EAAA,sBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,YAAY,oBAAqB,CAAA;AAAA,MAC/B,4BAA4B,QAAS,CAAA;AAAA,KACtC;AAAA,GACH;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAO,OAAA,eAAA;AAAA,MAAgB,kBACrB,YAAa,CAAA;AAAA,QACX,GAAK,EAAA,yBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,SAAS,MAAM;AACb,UAAM,MAAA,gBAAA,GAAmB,OAAO,UAAW,CAAA,MAAA;AAAA,YACzC,CAAK,CAAA,KAAA,CAAA,CAAE,IAAK,CAAA,IAAA,CAAK,QAAQ,EAAO,KAAA;AAAA,WAClC;AAEA,UAAI,IAAA,gBAAA,CAAiB,SAAS,CAAG,EAAA;AAE/B,YAAQ,OAAA,CAAA,IAAA;AAAA,cACN,CAAA,sNAAA,EAAyN,gBACtN,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAA,CAAE,IAAK,CAAA,IAAA,CAAK,EAAE,CAAA,CACvB,IAAK,CAAA,IAAI,CAAC,CAAA;AAAA,aACf;AAAA;AAGF,UAAM,MAAA,aAAA,GAAgB,OAAO,UAAW,CAAA,MAAA;AAAA,YACtC,CAAK,CAAA,KAAA,CAAA,CAAE,IAAK,CAAA,IAAA,CAAK,QAAQ,EAAO,KAAA;AAAA,WAClC;AAEA,UAAA,OAAO,6BAA8B,CAAA,cAAA;AAAA,YACnC,aAAc,CAAA,GAAA;AAAA,cAAI,CAChB,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,2BAAA,CAA4B,SAAS,SAAS;AAAA;AACtD,WACF;AAAA;AACF,OACD;AAAA,KACH;AAAA;AAEJ,CAAC;;;;"}
@@ -12,7 +12,7 @@ const TranslationsApi = ApiBlueprint.makeWithOverrides({
12
12
  },
13
13
  factory: (originalFactory, { inputs }) => {
14
14
  return originalFactory(
15
- (define) => define({
15
+ (defineParams) => defineParams({
16
16
  api: translationApiRef,
17
17
  deps: { languageApi: appLanguageApiRef },
18
18
  factory: ({ languageApi }) => I18nextTranslationApi.create({
@@ -1 +1 @@
1
- {"version":3,"file":"TranslationsApi.esm.js","sources":["../../src/extensions/TranslationsApi.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n ApiBlueprint,\n TranslationBlueprint,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport {\n appLanguageApiRef,\n translationApiRef,\n} from '@backstage/core-plugin-api/alpha';\n\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { I18nextTranslationApi } from '../../../../packages/core-app-api/src/apis/implementations/TranslationApi/I18nextTranslationApi';\n\n/**\n * Contains translations that are installed in the app.\n */\nexport const TranslationsApi = ApiBlueprint.makeWithOverrides({\n name: 'translations',\n inputs: {\n translations: createExtensionInput(\n [TranslationBlueprint.dataRefs.translation],\n { replaces: [{ id: 'app', input: 'translations' }] },\n ),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(define =>\n define({\n api: translationApiRef,\n deps: { languageApi: appLanguageApiRef },\n factory: ({ languageApi }) =>\n I18nextTranslationApi.create({\n languageApi,\n resources: inputs.translations.map(i =>\n i.get(TranslationBlueprint.dataRefs.translation),\n ),\n }),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;AA+Ba,MAAA,eAAA,GAAkB,aAAa,iBAAkB,CAAA;AAAA,EAC5D,IAAM,EAAA,cAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,YAAc,EAAA,oBAAA;AAAA,MACZ,CAAC,oBAAqB,CAAA,QAAA,CAAS,WAAW,CAAA;AAAA,MAC1C,EAAE,UAAU,CAAC,EAAE,IAAI,KAAO,EAAA,KAAA,EAAO,cAAe,EAAC,CAAE;AAAA;AACrD,GACF;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAO,OAAA,eAAA;AAAA,MAAgB,YACrB,MAAO,CAAA;AAAA,QACL,GAAK,EAAA,iBAAA;AAAA,QACL,IAAA,EAAM,EAAE,WAAA,EAAa,iBAAkB,EAAA;AAAA,QACvC,SAAS,CAAC,EAAE,WAAY,EAAA,KACtB,sBAAsB,MAAO,CAAA;AAAA,UAC3B,WAAA;AAAA,UACA,SAAA,EAAW,OAAO,YAAa,CAAA,GAAA;AAAA,YAAI,CACjC,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,oBAAA,CAAqB,SAAS,WAAW;AAAA;AACjD,SACD;AAAA,OACJ;AAAA,KACH;AAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"TranslationsApi.esm.js","sources":["../../src/extensions/TranslationsApi.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n ApiBlueprint,\n TranslationBlueprint,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport {\n appLanguageApiRef,\n translationApiRef,\n} from '@backstage/core-plugin-api/alpha';\n\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { I18nextTranslationApi } from '../../../../packages/core-app-api/src/apis/implementations/TranslationApi/I18nextTranslationApi';\n\n/**\n * Contains translations that are installed in the app.\n */\nexport const TranslationsApi = ApiBlueprint.makeWithOverrides({\n name: 'translations',\n inputs: {\n translations: createExtensionInput(\n [TranslationBlueprint.dataRefs.translation],\n { replaces: [{ id: 'app', input: 'translations' }] },\n ),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory(defineParams =>\n defineParams({\n api: translationApiRef,\n deps: { languageApi: appLanguageApiRef },\n factory: ({ languageApi }) =>\n I18nextTranslationApi.create({\n languageApi,\n resources: inputs.translations.map(i =>\n i.get(TranslationBlueprint.dataRefs.translation),\n ),\n }),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;AA+Ba,MAAA,eAAA,GAAkB,aAAa,iBAAkB,CAAA;AAAA,EAC5D,IAAM,EAAA,cAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,YAAc,EAAA,oBAAA;AAAA,MACZ,CAAC,oBAAqB,CAAA,QAAA,CAAS,WAAW,CAAA;AAAA,MAC1C,EAAE,UAAU,CAAC,EAAE,IAAI,KAAO,EAAA,KAAA,EAAO,cAAe,EAAC,CAAE;AAAA;AACrD,GACF;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAO,OAAA,eAAA;AAAA,MAAgB,kBACrB,YAAa,CAAA;AAAA,QACX,GAAK,EAAA,iBAAA;AAAA,QACL,IAAA,EAAM,EAAE,WAAA,EAAa,iBAAkB,EAAA;AAAA,QACvC,SAAS,CAAC,EAAE,WAAY,EAAA,KACtB,sBAAsB,MAAO,CAAA;AAAA,UAC3B,WAAA;AAAA,UACA,SAAA,EAAW,OAAO,YAAa,CAAA,GAAA;AAAA,YAAI,CACjC,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,oBAAA,CAAqB,SAAS,WAAW;AAAA;AACjD,SACD;AAAA,OACJ;AAAA,KACH;AAAA;AAEJ,CAAC;;;;"}
@@ -1,55 +1,33 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
+ import { SwappableComponentBlueprint, Progress as Progress$1, NotFoundErrorPage as NotFoundErrorPage$1, ErrorDisplay as ErrorDisplay$1 } from '@backstage/frontend-plugin-api';
3
+ import { Progress as Progress$2, ErrorPage, ErrorPanel } from '@backstage/core-components';
2
4
  import Button from '@material-ui/core/Button';
3
- import { createComponentExtension, coreComponentRefs } from '@backstage/frontend-plugin-api';
4
- import { ErrorPanel } from '@backstage/core-components';
5
- import '../packages/app-defaults/src/defaults/apis.esm.js';
6
- import { components } from '../packages/app-defaults/src/defaults/components.esm.js';
7
- import '@material-ui/icons/Apartment';
8
- import '@material-ui/icons/BrokenImage';
9
- import '@material-ui/icons/Category';
10
- import '@material-ui/icons/CreateNewFolder';
11
- import '@material-ui/icons/Subject';
12
- import '@material-ui/icons/Search';
13
- import '@material-ui/icons/Chat';
14
- import '@material-ui/icons/Dashboard';
15
- import '@material-ui/icons/Description';
16
- import '@material-ui/icons/Email';
17
- import '@material-ui/icons/Extension';
18
- import '@material-ui/icons/GitHub';
19
- import '@material-ui/icons/Help';
20
- import '@material-ui/icons/LocationOn';
21
- import '@material-ui/icons/Memory';
22
- import '@material-ui/icons/MenuBook';
23
- import '@material-ui/icons/People';
24
- import '@material-ui/icons/Person';
25
- import '@material-ui/icons/Warning';
26
- import '@material-ui/icons/Storage';
27
- import '@material-ui/icons/FeaturedPlayList';
28
- import '@material-ui/icons/Star';
29
- import '@material-ui/icons/StarBorder';
30
- import '@material-ui/icons/OpenInNew';
31
- import '@backstage/theme';
32
- import '@material-ui/icons/Brightness2';
33
- import '@material-ui/icons/WbSunny';
34
5
 
35
- const DefaultProgressComponent = createComponentExtension({
36
- ref: coreComponentRefs.progress,
37
- loader: { sync: () => components.Progress }
6
+ const Progress = SwappableComponentBlueprint.make({
7
+ name: "core-progress",
8
+ params: (define) => define({
9
+ component: Progress$1,
10
+ loader: () => Progress$2
11
+ })
38
12
  });
39
- const DefaultNotFoundErrorPageComponent = createComponentExtension({
40
- ref: coreComponentRefs.notFoundErrorPage,
41
- loader: { sync: () => components.NotFoundErrorPage }
13
+ const NotFoundErrorPage = SwappableComponentBlueprint.make({
14
+ name: "core-not-found-error-page",
15
+ params: (define) => define({
16
+ component: NotFoundErrorPage$1,
17
+ loader: () => () => /* @__PURE__ */ jsx(ErrorPage, { status: "404", statusMessage: "PAGE NOT FOUND" })
18
+ })
42
19
  });
43
- const DefaultErrorBoundaryComponent = createComponentExtension({
44
- ref: coreComponentRefs.errorBoundaryFallback,
45
- loader: {
46
- sync: () => (props) => {
20
+ const ErrorDisplay = SwappableComponentBlueprint.make({
21
+ name: "core-error-display",
22
+ params: (define) => define({
23
+ component: ErrorDisplay$1,
24
+ loader: () => (props) => {
47
25
  const { plugin, error, resetError } = props;
48
26
  const title = `Error in ${plugin?.id}`;
49
27
  return /* @__PURE__ */ jsx(ErrorPanel, { title, error, defaultExpanded: true, children: /* @__PURE__ */ jsx(Button, { variant: "outlined", onClick: resetError, children: "Retry" }) });
50
28
  }
51
- }
29
+ })
52
30
  });
53
31
 
54
- export { DefaultErrorBoundaryComponent, DefaultNotFoundErrorPageComponent, DefaultProgressComponent };
32
+ export { ErrorDisplay, NotFoundErrorPage, Progress };
55
33
  //# sourceMappingURL=components.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.esm.js","sources":["../../src/extensions/components.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 Button from '@material-ui/core/Button';\n\nimport {\n createComponentExtension,\n coreComponentRefs,\n} from '@backstage/frontend-plugin-api';\nimport { ErrorPanel } from '@backstage/core-components';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { components as defaultComponents } from '../../../../packages/app-defaults/src/defaults';\n\nexport const DefaultProgressComponent = createComponentExtension({\n ref: coreComponentRefs.progress,\n loader: { sync: () => defaultComponents.Progress },\n});\n\nexport const DefaultNotFoundErrorPageComponent = createComponentExtension({\n ref: coreComponentRefs.notFoundErrorPage,\n loader: { sync: () => defaultComponents.NotFoundErrorPage },\n});\n\nexport const DefaultErrorBoundaryComponent = createComponentExtension({\n ref: coreComponentRefs.errorBoundaryFallback,\n loader: {\n sync: () => props => {\n const { plugin, error, resetError } = props;\n const title = `Error in ${plugin?.id}`;\n\n return (\n <ErrorPanel title={title} error={error} defaultExpanded>\n <Button variant=\"outlined\" onClick={resetError}>\n Retry\n </Button>\n </ErrorPanel>\n );\n },\n },\n});\n"],"names":["defaultComponents"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,MAAM,2BAA2B,wBAAyB,CAAA;AAAA,EAC/D,KAAK,iBAAkB,CAAA,QAAA;AAAA,EACvB,MAAQ,EAAA,EAAE,IAAM,EAAA,MAAMA,WAAkB,QAAS;AACnD,CAAC;AAEM,MAAM,oCAAoC,wBAAyB,CAAA;AAAA,EACxE,KAAK,iBAAkB,CAAA,iBAAA;AAAA,EACvB,MAAQ,EAAA,EAAE,IAAM,EAAA,MAAMA,WAAkB,iBAAkB;AAC5D,CAAC;AAEM,MAAM,gCAAgC,wBAAyB,CAAA;AAAA,EACpE,KAAK,iBAAkB,CAAA,qBAAA;AAAA,EACvB,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,MAAM,CAAS,KAAA,KAAA;AACnB,MAAA,MAAM,EAAE,MAAA,EAAQ,KAAO,EAAA,UAAA,EAAe,GAAA,KAAA;AACtC,MAAM,MAAA,KAAA,GAAQ,CAAY,SAAA,EAAA,MAAA,EAAQ,EAAE,CAAA,CAAA;AAEpC,MAAA,uBACG,GAAA,CAAA,UAAA,EAAA,EAAW,KAAc,EAAA,KAAA,EAAc,eAAe,EAAA,IAAA,EACrD,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA,EAAO,OAAQ,EAAA,UAAA,EAAW,OAAS,EAAA,UAAA,EAAY,mBAEhD,CACF,EAAA,CAAA;AAAA;AAEJ;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"components.esm.js","sources":["../../src/extensions/components.tsx"],"sourcesContent":["/*\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 */\nimport {\n NotFoundErrorPage as SwappableNotFoundErrorPage,\n Progress as SwappableProgress,\n ErrorDisplay as SwappableErrorDisplay,\n SwappableComponentBlueprint,\n} from '@backstage/frontend-plugin-api';\n\nimport {\n ErrorPage,\n ErrorPanel,\n Progress as ProgressComponent,\n} from '@backstage/core-components';\nimport Button from '@material-ui/core/Button';\n\nexport const Progress = SwappableComponentBlueprint.make({\n name: 'core-progress',\n params: define =>\n define({\n component: SwappableProgress,\n loader: () => ProgressComponent,\n }),\n});\n\nexport const NotFoundErrorPage = SwappableComponentBlueprint.make({\n name: 'core-not-found-error-page',\n params: define =>\n define({\n component: SwappableNotFoundErrorPage,\n loader: () => () =>\n <ErrorPage status=\"404\" statusMessage=\"PAGE NOT FOUND\" />,\n }),\n});\n\nexport const ErrorDisplay = SwappableComponentBlueprint.make({\n name: 'core-error-display',\n params: define =>\n define({\n component: SwappableErrorDisplay,\n loader: () => props => {\n const { plugin, error, resetError } = props;\n const title = `Error in ${plugin?.id}`;\n return (\n <ErrorPanel title={title} error={error} defaultExpanded>\n <Button variant=\"outlined\" onClick={resetError}>\n Retry\n </Button>\n </ErrorPanel>\n );\n },\n }),\n});\n"],"names":["SwappableProgress","ProgressComponent","SwappableNotFoundErrorPage","SwappableErrorDisplay"],"mappings":";;;;;AA6Ba,MAAA,QAAA,GAAW,4BAA4B,IAAK,CAAA;AAAA,EACvD,IAAM,EAAA,eAAA;AAAA,EACN,MAAA,EAAQ,YACN,MAAO,CAAA;AAAA,IACL,SAAW,EAAAA,UAAA;AAAA,IACX,QAAQ,MAAMC;AAAA,GACf;AACL,CAAC;AAEY,MAAA,iBAAA,GAAoB,4BAA4B,IAAK,CAAA;AAAA,EAChE,IAAM,EAAA,2BAAA;AAAA,EACN,MAAA,EAAQ,YACN,MAAO,CAAA;AAAA,IACL,SAAW,EAAAC,mBAAA;AAAA,IACX,MAAA,EAAQ,MAAM,sBACZ,GAAA,CAAC,aAAU,MAAO,EAAA,KAAA,EAAM,eAAc,gBAAiB,EAAA;AAAA,GAC1D;AACL,CAAC;AAEY,MAAA,YAAA,GAAe,4BAA4B,IAAK,CAAA;AAAA,EAC3D,IAAM,EAAA,oBAAA;AAAA,EACN,MAAA,EAAQ,YACN,MAAO,CAAA;AAAA,IACL,SAAW,EAAAC,cAAA;AAAA,IACX,MAAA,EAAQ,MAAM,CAAS,KAAA,KAAA;AACrB,MAAA,MAAM,EAAE,MAAA,EAAQ,KAAO,EAAA,UAAA,EAAe,GAAA,KAAA;AACtC,MAAM,MAAA,KAAA,GAAQ,CAAY,SAAA,EAAA,MAAA,EAAQ,EAAE,CAAA,CAAA;AACpC,MAAA,uBACG,GAAA,CAAA,UAAA,EAAA,EAAW,KAAc,EAAA,KAAA,EAAc,eAAe,EAAA,IAAA,EACrD,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA,EAAO,OAAQ,EAAA,UAAA,EAAW,OAAS,EAAA,UAAA,EAAY,mBAEhD,CACF,EAAA,CAAA;AAAA;AAEJ,GACD;AACL,CAAC;;;;"}
@@ -21,7 +21,7 @@ const alertDisplayAppRootElement = AppRootElementBlueprint.makeWithOverrides({
21
21
  },
22
22
  factory: (originalFactory, { config }) => {
23
23
  return originalFactory({
24
- element: () => /* @__PURE__ */ jsx(AlertDisplay, { ...config })
24
+ element: /* @__PURE__ */ jsx(AlertDisplay, { ...config })
25
25
  });
26
26
  }
27
27
  });
@@ -1 +1 @@
1
- {"version":3,"file":"elements.esm.js","sources":["../../src/extensions/elements.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { AlertDisplay, OAuthRequestDialog } from '@backstage/core-components';\nimport { AppRootElementBlueprint } from '@backstage/frontend-plugin-api';\n\nexport const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({\n name: 'oauth-request-dialog',\n params: {\n element: <OAuthRequestDialog />,\n },\n});\n\nexport const alertDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n name: 'alert-display',\n config: {\n schema: {\n transientTimeoutMs: z => z.number().default(5000),\n anchorOrigin: z =>\n z\n .object({\n vertical: z.enum(['top', 'bottom']).default('top'),\n horizontal: z.enum(['left', 'center', 'right']).default('center'),\n })\n .default({}),\n },\n },\n factory: (originalFactory, { config }) => {\n return originalFactory({\n element: () => <AlertDisplay {...config} />,\n });\n },\n });\n"],"names":[],"mappings":";;;;AAmBa,MAAA,gCAAA,GAAmC,wBAAwB,IAAK,CAAA;AAAA,EAC3E,IAAM,EAAA,sBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,OAAA,sBAAU,kBAAmB,EAAA,EAAA;AAAA;AAEjC,CAAC;AAEY,MAAA,0BAAA,GACX,wBAAwB,iBAAkB,CAAA;AAAA,EACxC,IAAM,EAAA,eAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,oBAAoB,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAQ,GAAI,CAAA;AAAA,MAChD,YAAA,EAAc,CACZ,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,QACN,QAAA,EAAU,EAAE,IAAK,CAAA,CAAC,OAAO,QAAQ,CAAC,CAAE,CAAA,OAAA,CAAQ,KAAK,CAAA;AAAA,QACjD,UAAA,EAAY,CAAE,CAAA,IAAA,CAAK,CAAC,MAAA,EAAQ,UAAU,OAAO,CAAC,CAAE,CAAA,OAAA,CAAQ,QAAQ;AAAA,OACjE,CAAA,CACA,OAAQ,CAAA,EAAE;AAAA;AACjB,GACF;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,OAAS,EAAA,sBAAO,GAAA,CAAA,YAAA,EAAA,EAAc,GAAG,MAAQ,EAAA;AAAA,KAC1C,CAAA;AAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"elements.esm.js","sources":["../../src/extensions/elements.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { AlertDisplay, OAuthRequestDialog } from '@backstage/core-components';\nimport { AppRootElementBlueprint } from '@backstage/frontend-plugin-api';\n\nexport const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({\n name: 'oauth-request-dialog',\n params: {\n element: <OAuthRequestDialog />,\n },\n});\n\nexport const alertDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n name: 'alert-display',\n config: {\n schema: {\n transientTimeoutMs: z => z.number().default(5000),\n anchorOrigin: z =>\n z\n .object({\n vertical: z.enum(['top', 'bottom']).default('top'),\n horizontal: z.enum(['left', 'center', 'right']).default('center'),\n })\n .default({}),\n },\n },\n factory: (originalFactory, { config }) => {\n return originalFactory({\n element: <AlertDisplay {...config} />,\n });\n },\n });\n"],"names":[],"mappings":";;;;AAmBa,MAAA,gCAAA,GAAmC,wBAAwB,IAAK,CAAA;AAAA,EAC3E,IAAM,EAAA,sBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,OAAA,sBAAU,kBAAmB,EAAA,EAAA;AAAA;AAEjC,CAAC;AAEY,MAAA,0BAAA,GACX,wBAAwB,iBAAkB,CAAA;AAAA,EACxC,IAAM,EAAA,eAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,oBAAoB,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAQ,GAAI,CAAA;AAAA,MAChD,YAAA,EAAc,CACZ,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,QACN,QAAA,EAAU,EAAE,IAAK,CAAA,CAAC,OAAO,QAAQ,CAAC,CAAE,CAAA,OAAA,CAAQ,KAAK,CAAA;AAAA,QACjD,UAAA,EAAY,CAAE,CAAA,IAAA,CAAK,CAAC,MAAA,EAAQ,UAAU,OAAO,CAAC,CAAE,CAAA,OAAA,CAAQ,QAAQ;AAAA,OACjE,CAAA,CACA,OAAQ,CAAA,EAAE;AAAA;AACjB,GACF;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,OAAS,kBAAA,GAAA,CAAC,YAAc,EAAA,EAAA,GAAG,MAAQ,EAAA;AAAA,KACpC,CAAA;AAAA;AAEL,CAAC;;;;"}