@backstage/frontend-plugin-api 0.18.1 → 0.18.2-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 (83) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/alpha.d.ts +1 -1
  3. package/dist/analytics/AnalyticsContext.esm.js.map +1 -1
  4. package/dist/analytics/Tracker.esm.js.map +1 -1
  5. package/dist/analytics/useAnalytics.esm.js.map +1 -1
  6. package/dist/apis/definitions/AlertApi.esm.js.map +1 -1
  7. package/dist/apis/definitions/AnalyticsApi.esm.js.map +1 -1
  8. package/dist/apis/definitions/AppLanguageApi.esm.js.map +1 -1
  9. package/dist/apis/definitions/AppThemeApi.esm.js.map +1 -1
  10. package/dist/apis/definitions/AppTreeApi.esm.js.map +1 -1
  11. package/dist/apis/definitions/ConfigApi.esm.js.map +1 -1
  12. package/dist/apis/definitions/DialogApi.esm.js.map +1 -1
  13. package/dist/apis/definitions/DiscoveryApi.esm.js.map +1 -1
  14. package/dist/apis/definitions/ErrorApi.esm.js.map +1 -1
  15. package/dist/apis/definitions/FeatureFlagsApi.esm.js.map +1 -1
  16. package/dist/apis/definitions/FetchApi.esm.js.map +1 -1
  17. package/dist/apis/definitions/IconsApi.esm.js.map +1 -1
  18. package/dist/apis/definitions/IdentityApi.esm.js.map +1 -1
  19. package/dist/apis/definitions/OAuthRequestApi.esm.js.map +1 -1
  20. package/dist/apis/definitions/PluginHeaderActionsApi.esm.js.map +1 -1
  21. package/dist/apis/definitions/PluginWrapperApi.esm.js.map +1 -1
  22. package/dist/apis/definitions/RouteResolutionApi.esm.js.map +1 -1
  23. package/dist/apis/definitions/StorageApi.esm.js.map +1 -1
  24. package/dist/apis/definitions/SwappableComponentsApi.esm.js.map +1 -1
  25. package/dist/apis/definitions/ToastApi.esm.js.map +1 -1
  26. package/dist/apis/definitions/TranslationApi.esm.js.map +1 -1
  27. package/dist/apis/definitions/auth.esm.js.map +1 -1
  28. package/dist/apis/system/ApiRef.esm.js.map +1 -1
  29. package/dist/apis/system/helpers.esm.js.map +1 -1
  30. package/dist/apis/system/useApi.esm.js.map +1 -1
  31. package/dist/blueprints/AnalyticsImplementationBlueprint.esm.js.map +1 -1
  32. package/dist/blueprints/ApiBlueprint.esm.js.map +1 -1
  33. package/dist/blueprints/AppRootElementBlueprint.esm.js.map +1 -1
  34. package/dist/blueprints/PageBlueprint.esm.js.map +1 -1
  35. package/dist/blueprints/PluginHeaderActionBlueprint.esm.js.map +1 -1
  36. package/dist/blueprints/PluginWrapperBlueprint.esm.js.map +1 -1
  37. package/dist/blueprints/SubPageBlueprint.esm.js.map +1 -1
  38. package/dist/breadcrumbs/useBreadcrumbEntries.esm.js.map +1 -1
  39. package/dist/components/AppNodeProvider.esm.js.map +1 -1
  40. package/dist/components/DefaultSwappableComponents.esm.js.map +1 -1
  41. package/dist/components/ErrorApiBoundary.esm.js.map +1 -1
  42. package/dist/components/ErrorDisplayBoundary.esm.js.map +1 -1
  43. package/dist/components/ExtensionBoundary.esm.js.map +1 -1
  44. package/dist/components/PageLayout.esm.js.map +1 -1
  45. package/dist/components/createSwappableComponent.esm.js.map +1 -1
  46. package/dist/core-plugin-api/src/analytics/Tracker.esm.js.map +1 -1
  47. package/dist/frontend-internal/src/apis/OpaqueApiRef.esm.js.map +1 -1
  48. package/dist/frontend-internal/src/routing/OpaqueExternalRouteRef.esm.js.map +1 -1
  49. package/dist/frontend-internal/src/routing/OpaqueRouteRef.esm.js.map +1 -1
  50. package/dist/frontend-internal/src/routing/OpaqueSubRouteRef.esm.js.map +1 -1
  51. package/dist/frontend-internal/src/wiring/InternalExtensionDefinition.esm.js.map +1 -1
  52. package/dist/frontend-internal/src/wiring/InternalExtensionInput.esm.js.map +1 -1
  53. package/dist/frontend-internal/src/wiring/InternalFrontendPlugin.esm.js.map +1 -1
  54. package/dist/frontend-internal/src/wiring/InternalSwappableComponentRef.esm.js.map +1 -1
  55. package/dist/frontend-internal/src/wiring/createExtensionDataContainer.esm.js.map +1 -1
  56. package/dist/index.d.ts +75 -75
  57. package/dist/opaque-internal/src/OpaqueType.esm.js.map +1 -1
  58. package/dist/routing/ExternalRouteRef.esm.js.map +1 -1
  59. package/dist/routing/RouteRef.esm.js.map +1 -1
  60. package/dist/routing/SubRouteRef.esm.js.map +1 -1
  61. package/dist/routing/describeParentCallSite.esm.js.map +1 -1
  62. package/dist/routing/useRouteRef.esm.js.map +1 -1
  63. package/dist/routing/useRouteRefParams.esm.js.map +1 -1
  64. package/dist/schema/assertNoLegacyConfigSchema.esm.js.map +1 -1
  65. package/dist/schema/createPortableSchema.esm.js.map +1 -1
  66. package/dist/schema/optionalStringSchema.esm.js.map +1 -1
  67. package/dist/translation/TranslationMessages.esm.js.map +1 -1
  68. package/dist/translation/TranslationRef.esm.js.map +1 -1
  69. package/dist/translation/TranslationResource.esm.js.map +1 -1
  70. package/dist/translation/useTranslationRef.esm.js.map +1 -1
  71. package/dist/types/{alpha.d-DZG-WVJf.d.ts → alpha.d-BVLu8HlA.d.ts} +412 -412
  72. package/dist/wiring/constants.esm.js.map +1 -1
  73. package/dist/wiring/coreExtensionData.esm.js.map +1 -1
  74. package/dist/wiring/createExtension.esm.js.map +1 -1
  75. package/dist/wiring/createExtensionBlueprint.esm.js.map +1 -1
  76. package/dist/wiring/createExtensionDataRef.esm.js.map +1 -1
  77. package/dist/wiring/createExtensionInput.esm.js.map +1 -1
  78. package/dist/wiring/createFrontendFeatureLoader.esm.js.map +1 -1
  79. package/dist/wiring/createFrontendModule.esm.js.map +1 -1
  80. package/dist/wiring/createFrontendPlugin.esm.js.map +1 -1
  81. package/dist/wiring/resolveExtensionDefinition.esm.js.map +1 -1
  82. package/dist/wiring/resolveInputOverrides.esm.js.map +1 -1
  83. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"auth.esm.js","sources":["../../../src/apis/definitions/auth.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* We want to maintain the same information as an enum, so we disable the redeclaration warning */\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { createApiRef } from '../system';\nimport { IconComponent, IconElement } from '../../icons/types';\nimport { Observable } from '@backstage/types';\n\n/**\n * This file contains declarations for common interfaces of auth-related APIs.\n * The declarations should be used to signal which type of authentication and\n * authorization methods each separate auth provider supports.\n *\n * For example, a Google OAuth provider that supports OAuth 2 and OpenID Connect,\n * would be declared as follows:\n *\n * const googleAuthApiRef = createApiRef<OAuthApi & OpenIDConnectApi>().with({\n * id: 'core.auth.google',\n * pluginId: 'app',\n * })\n */\n\n/**\n * Information about the auth provider.\n *\n * @remarks\n *\n * This information is used both to connect the correct auth provider in the backend, as\n * well as displaying the provider to the user.\n *\n * @public\n */\nexport type AuthProviderInfo = {\n /**\n * The ID of the auth provider. This should match with ID of the provider in the `@backstage/auth-backend`.\n */\n id: string;\n\n /**\n * Title for the auth provider, for example \"GitHub\"\n */\n title: string;\n\n /**\n * Icon for the auth provider.\n *\n * @remarks\n *\n * Accepts either an `IconElement` (e.g. `<MyIcon />`) or an `IconComponent`\n * (e.g. `MyIcon`). Prefer passing `IconElement`.\n */\n icon: IconComponent | IconElement;\n\n /**\n * Optional user friendly message to display for the auth provider.\n */\n message?: string;\n};\n\n/**\n * An array of scopes, or a scope string formatted according to the\n * auth provider, which is typically a space separated list.\n *\n * @remarks\n *\n * See the documentation for each auth provider for the list of scopes\n * supported by each provider.\n *\n * @public\n */\nexport type OAuthScope = string | string[];\n\n/**\n * Configuration of an authentication request.\n *\n * @public\n */\nexport type AuthRequestOptions = {\n /**\n * If this is set to true, the user will not be prompted to log in,\n * and an empty response will be returned if there is no existing session.\n *\n * This can be used to perform a check whether the user is logged in, or if you don't\n * want to force a user to be logged in, but provide functionality if they already are.\n *\n * @defaultValue false\n */\n optional?: boolean;\n\n /**\n * If this is set to true, the request will bypass the regular oauth login modal\n * and open the login popup directly.\n *\n * The method must be called synchronously from a user action for this to work in all browsers.\n *\n * @defaultValue false\n */\n instantPopup?: boolean;\n};\n\n/**\n * This API provides access to OAuth 2 credentials. It lets you request access tokens,\n * which can be used to act on behalf of the user when talking to APIs.\n *\n * @public\n */\nexport type OAuthApi = {\n /**\n * Requests an OAuth 2 Access Token, optionally with a set of scopes. The access token allows\n * you to make requests on behalf of the user, and the copes may grant you broader access, depending\n * on the auth provider.\n *\n * Each auth provider has separate handling of scope, so you need to look at the documentation\n * for each one to know what scope you need to request.\n *\n * This method is cheap and should be called each time an access token is used. Do not for example\n * store the access token in React component state, as that could cause the token to expire. Instead\n * fetch a new access token for each request.\n *\n * Be sure to include all required scopes when requesting an access token. When testing your implementation\n * it is best to log out the Backstage session and then visit your plugin page directly, as\n * you might already have some required scopes in your existing session. Not requesting the correct\n * scopes can lead to 403 or other authorization errors, which can be tricky to debug.\n *\n * If the user has not yet granted access to the provider and the set of requested scopes, the user\n * will be prompted to log in. The returned promise will not resolve until the user has\n * successfully logged in. The returned promise can be rejected, but only if the user rejects the login request.\n */\n getAccessToken(\n scope?: OAuthScope,\n options?: AuthRequestOptions,\n ): Promise<string>;\n};\n\n/**\n * This API provides access to OpenID Connect credentials. It lets you request ID tokens,\n * which can be passed to backend services to prove the user's identity.\n *\n * @public\n */\nexport type OpenIdConnectApi = {\n /**\n * Requests an OpenID Connect ID Token.\n *\n * This method is cheap and should be called each time an ID token is used. Do not for example\n * store the id token in React component state, as that could cause the token to expire. Instead\n * fetch a new id token for each request.\n *\n * If the user has not yet logged in to Google inside Backstage, the user will be prompted\n * to log in. The returned promise will not resolve until the user has successfully logged in.\n * The returned promise can be rejected, but only if the user rejects the login request.\n */\n getIdToken(options?: AuthRequestOptions): Promise<string>;\n};\n\n/**\n * This API provides access to profile information of the user from an auth provider.\n *\n * @public\n */\nexport type ProfileInfoApi = {\n /**\n * Get profile information for the user as supplied by this auth provider.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;\n};\n\n/**\n * This API provides access to the user's identity within Backstage.\n *\n * @remarks\n *\n * An auth provider that implements this interface can be used to sign-in to backstage. It is\n * not intended to be used directly from a plugin, but instead serves as a connection between\n * this authentication method and the app's {@link IdentityApi}\n *\n * @public\n */\nexport type BackstageIdentityApi = {\n /**\n * Get the user's identity within Backstage. This should normally not be called directly,\n * use the {@link IdentityApi} instead.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getBackstageIdentity(\n options?: AuthRequestOptions,\n ): Promise<BackstageIdentityResponse | undefined>;\n};\n\n/**\n * User identity information within Backstage.\n *\n * @public\n */\nexport type BackstageUserIdentity = {\n /**\n * The type of identity that this structure represents. In the frontend app\n * this will currently always be 'user'.\n */\n type: 'user';\n\n /**\n * The entityRef of the user in the catalog.\n * For example User:default/sandra\n */\n userEntityRef: string;\n\n /**\n * The user and group entities that the user claims ownership through\n */\n ownershipEntityRefs: string[];\n};\n\n/**\n * Token and Identity response, with the users claims in the Identity.\n *\n * @public\n */\nexport type BackstageIdentityResponse = {\n /**\n * The token used to authenticate the user within Backstage.\n */\n token: string;\n\n /**\n * The time at which the token expires. If not set, it can be assumed that the token does not expire.\n */\n expiresAt?: Date;\n\n /**\n * Identity information derived from the token.\n */\n identity: BackstageUserIdentity;\n};\n\n/**\n * Profile information of the user.\n *\n * @public\n */\nexport type ProfileInfo = {\n /**\n * Email ID.\n */\n email?: string;\n\n /**\n * Display name that can be presented to the user.\n */\n displayName?: string;\n\n /**\n * URL to an avatar image of the user.\n */\n picture?: string;\n};\n\n/**\n * Session state values passed to subscribers of the SessionApi.\n *\n * @public\n */\nexport const SessionState = {\n /**\n * User signed in.\n */\n SignedIn: 'SignedIn',\n /**\n * User not signed in.\n */\n SignedOut: 'SignedOut',\n} as const;\n\n/**\n * @public\n */\nexport type SessionState = (typeof SessionState)[keyof typeof SessionState];\n\n/**\n * @public\n */\nexport namespace SessionState {\n export type SignedIn = typeof SessionState.SignedIn;\n export type SignedOut = typeof SessionState.SignedOut;\n}\n\n/**\n * The SessionApi provides basic controls for any auth provider that is tied to a persistent session.\n *\n * @public\n */\nexport type SessionApi = {\n /**\n * Sign in with a minimum set of permissions.\n */\n signIn(): Promise<void>;\n\n /**\n * Sign out from the current session. This will reload the page.\n */\n signOut(): Promise<void>;\n\n /**\n * Observe the current state of the auth session. Emits the current state on subscription.\n */\n sessionState$(): Observable<SessionState>;\n};\n\n/**\n * Provides authentication towards Google APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://developers.google.com/identity/protocols/googlescopes} for a full list of supported scopes.\n *\n * Note that the ID token payload is only guaranteed to contain the user's numerical Google ID,\n * email and expiration information. Do not rely on any other fields, as they might not be present.\n */\nexport const googleAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.google',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards GitHub APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/}\n * for a full list of supported scopes.\n */\nexport const githubAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.github',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Okta APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.okta.com/docs/guides/implement-oauth-for-okta/scopes/}\n * for a full list of supported scopes.\n */\nexport const oktaAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.okta',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards GitLab APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#limiting-scopes-of-a-personal-access-token}\n * for a full list of supported scopes.\n */\nexport const gitlabAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.gitlab',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Microsoft APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info and a full list of supported scopes, see:\n * - {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent}\n * - {@link https://docs.microsoft.com/en-us/graph/permissions-reference}\n */\nexport const microsoftAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.microsoft',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards OneLogin APIs.\n *\n * @public\n */\nexport const oneloginAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.onelogin',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Bitbucket APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/}\n * for a full list of supported scopes.\n */\nexport const bitbucketAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.bitbucket',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Bitbucket Server APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://confluence.atlassian.com/bitbucketserver/bitbucket-oauth-2-0-provider-api-1108483661.html#BitbucketOAuth2.0providerAPI-scopes}\n * for a full list of supported scopes.\n */\nexport const bitbucketServerAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.bitbucket-server',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Atlassian APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.atlassian.com/cloud/jira/platform/scopes-for-connect-and-oauth-2-3LO-apps/}\n * for a full list of supported scopes.\n */\nexport const atlassianAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.atlassian',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards VMware Cloud APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info about VMware Cloud identity and access management:\n * - {@link https://docs.vmware.com/en/VMware-Cloud-services/services/Using-VMware-Cloud-Services/GUID-53D39337-D93A-4B84-BD18-DDF43C21479A.html}\n */\nexport const vmwareCloudAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.vmware-cloud',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards OpenShift APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html/authentication_and_authorization/configuring-oauth-clients}\n * on how to configure the OAuth clients and\n * {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html-single/authentication_and_authorization/index#tokens-scoping-about_configuring-internal-oauth}\n * for available scopes.\n */\nexport const openshiftAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.openshift',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AAyRO,MAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA,EAI1B,QAAA,EA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AA,EACP,EAAA,EAAI,wBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAaM,MAAM,mBAAA,GAAsB,YAAA,EAEjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;;;"}
1
+ {"version":3,"file":"auth.esm.js","sources":["../../../src/apis/definitions/auth.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* We want to maintain the same information as an enum, so we disable the redeclaration warning */\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { createApiRef } from '../system';\nimport { IconComponent, IconElement } from '../../icons/types';\nimport { Observable } from '@backstage/types';\n\n/**\n * This file contains declarations for common interfaces of auth-related APIs.\n * The declarations should be used to signal which type of authentication and\n * authorization methods each separate auth provider supports.\n *\n * For example, a Google OAuth provider that supports OAuth 2 and OpenID Connect,\n * would be declared as follows:\n *\n * const googleAuthApiRef = createApiRef<OAuthApi & OpenIDConnectApi>().with({\n * id: 'core.auth.google',\n * pluginId: 'app',\n * })\n */\n\n/**\n * Information about the auth provider.\n *\n * @remarks\n *\n * This information is used both to connect the correct auth provider in the backend, as\n * well as displaying the provider to the user.\n *\n * @public\n */\nexport type AuthProviderInfo = {\n /**\n * The ID of the auth provider. This should match with ID of the provider in the `@backstage/auth-backend`.\n */\n id: string;\n\n /**\n * Title for the auth provider, for example \"GitHub\"\n */\n title: string;\n\n /**\n * Icon for the auth provider.\n *\n * @remarks\n *\n * Accepts either an `IconElement` (e.g. `<MyIcon />`) or an `IconComponent`\n * (e.g. `MyIcon`). Prefer passing `IconElement`.\n */\n icon: IconComponent | IconElement;\n\n /**\n * Optional user friendly message to display for the auth provider.\n */\n message?: string;\n};\n\n/**\n * An array of scopes, or a scope string formatted according to the\n * auth provider, which is typically a space separated list.\n *\n * @remarks\n *\n * See the documentation for each auth provider for the list of scopes\n * supported by each provider.\n *\n * @public\n */\nexport type OAuthScope = string | string[];\n\n/**\n * Configuration of an authentication request.\n *\n * @public\n */\nexport type AuthRequestOptions = {\n /**\n * If this is set to true, the user will not be prompted to log in,\n * and an empty response will be returned if there is no existing session.\n *\n * This can be used to perform a check whether the user is logged in, or if you don't\n * want to force a user to be logged in, but provide functionality if they already are.\n *\n * @defaultValue false\n */\n optional?: boolean;\n\n /**\n * If this is set to true, the request will bypass the regular oauth login modal\n * and open the login popup directly.\n *\n * The method must be called synchronously from a user action for this to work in all browsers.\n *\n * @defaultValue false\n */\n instantPopup?: boolean;\n};\n\n/**\n * This API provides access to OAuth 2 credentials. It lets you request access tokens,\n * which can be used to act on behalf of the user when talking to APIs.\n *\n * @public\n */\nexport type OAuthApi = {\n /**\n * Requests an OAuth 2 Access Token, optionally with a set of scopes. The access token allows\n * you to make requests on behalf of the user, and the copes may grant you broader access, depending\n * on the auth provider.\n *\n * Each auth provider has separate handling of scope, so you need to look at the documentation\n * for each one to know what scope you need to request.\n *\n * This method is cheap and should be called each time an access token is used. Do not for example\n * store the access token in React component state, as that could cause the token to expire. Instead\n * fetch a new access token for each request.\n *\n * Be sure to include all required scopes when requesting an access token. When testing your implementation\n * it is best to log out the Backstage session and then visit your plugin page directly, as\n * you might already have some required scopes in your existing session. Not requesting the correct\n * scopes can lead to 403 or other authorization errors, which can be tricky to debug.\n *\n * If the user has not yet granted access to the provider and the set of requested scopes, the user\n * will be prompted to log in. The returned promise will not resolve until the user has\n * successfully logged in. The returned promise can be rejected, but only if the user rejects the login request.\n */\n getAccessToken(\n scope?: OAuthScope,\n options?: AuthRequestOptions,\n ): Promise<string>;\n};\n\n/**\n * This API provides access to OpenID Connect credentials. It lets you request ID tokens,\n * which can be passed to backend services to prove the user's identity.\n *\n * @public\n */\nexport type OpenIdConnectApi = {\n /**\n * Requests an OpenID Connect ID Token.\n *\n * This method is cheap and should be called each time an ID token is used. Do not for example\n * store the id token in React component state, as that could cause the token to expire. Instead\n * fetch a new id token for each request.\n *\n * If the user has not yet logged in to Google inside Backstage, the user will be prompted\n * to log in. The returned promise will not resolve until the user has successfully logged in.\n * The returned promise can be rejected, but only if the user rejects the login request.\n */\n getIdToken(options?: AuthRequestOptions): Promise<string>;\n};\n\n/**\n * This API provides access to profile information of the user from an auth provider.\n *\n * @public\n */\nexport type ProfileInfoApi = {\n /**\n * Get profile information for the user as supplied by this auth provider.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;\n};\n\n/**\n * This API provides access to the user's identity within Backstage.\n *\n * @remarks\n *\n * An auth provider that implements this interface can be used to sign-in to backstage. It is\n * not intended to be used directly from a plugin, but instead serves as a connection between\n * this authentication method and the app's {@link IdentityApi}\n *\n * @public\n */\nexport type BackstageIdentityApi = {\n /**\n * Get the user's identity within Backstage. This should normally not be called directly,\n * use the {@link IdentityApi} instead.\n *\n * If the optional flag is not set, a session is guaranteed to be returned, while if\n * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.\n */\n getBackstageIdentity(\n options?: AuthRequestOptions,\n ): Promise<BackstageIdentityResponse | undefined>;\n};\n\n/**\n * User identity information within Backstage.\n *\n * @public\n */\nexport type BackstageUserIdentity = {\n /**\n * The type of identity that this structure represents. In the frontend app\n * this will currently always be 'user'.\n */\n type: 'user';\n\n /**\n * The entityRef of the user in the catalog.\n * For example User:default/sandra\n */\n userEntityRef: string;\n\n /**\n * The user and group entities that the user claims ownership through\n */\n ownershipEntityRefs: string[];\n};\n\n/**\n * Token and Identity response, with the users claims in the Identity.\n *\n * @public\n */\nexport type BackstageIdentityResponse = {\n /**\n * The token used to authenticate the user within Backstage.\n */\n token: string;\n\n /**\n * The time at which the token expires. If not set, it can be assumed that the token does not expire.\n */\n expiresAt?: Date;\n\n /**\n * Identity information derived from the token.\n */\n identity: BackstageUserIdentity;\n};\n\n/**\n * Profile information of the user.\n *\n * @public\n */\nexport type ProfileInfo = {\n /**\n * Email ID.\n */\n email?: string;\n\n /**\n * Display name that can be presented to the user.\n */\n displayName?: string;\n\n /**\n * URL to an avatar image of the user.\n */\n picture?: string;\n};\n\n/**\n * Session state values passed to subscribers of the SessionApi.\n *\n * @public\n */\nexport const SessionState = {\n /**\n * User signed in.\n */\n SignedIn: 'SignedIn',\n /**\n * User not signed in.\n */\n SignedOut: 'SignedOut',\n} as const;\n\n/**\n * @public\n */\nexport type SessionState = (typeof SessionState)[keyof typeof SessionState];\n\n/**\n * @public\n */\nexport namespace SessionState {\n export type SignedIn = typeof SessionState.SignedIn;\n export type SignedOut = typeof SessionState.SignedOut;\n}\n\n/**\n * The SessionApi provides basic controls for any auth provider that is tied to a persistent session.\n *\n * @public\n */\nexport type SessionApi = {\n /**\n * Sign in with a minimum set of permissions.\n */\n signIn(): Promise<void>;\n\n /**\n * Sign out from the current session. This will reload the page.\n */\n signOut(): Promise<void>;\n\n /**\n * Observe the current state of the auth session. Emits the current state on subscription.\n */\n sessionState$(): Observable<SessionState>;\n};\n\n/**\n * Provides authentication towards Google APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://developers.google.com/identity/protocols/googlescopes} for a full list of supported scopes.\n *\n * Note that the ID token payload is only guaranteed to contain the user's numerical Google ID,\n * email and expiration information. Do not rely on any other fields, as they might not be present.\n */\nexport const googleAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.google',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards GitHub APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/}\n * for a full list of supported scopes.\n */\nexport const githubAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.github',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Okta APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.okta.com/docs/guides/implement-oauth-for-okta/scopes/}\n * for a full list of supported scopes.\n */\nexport const oktaAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.okta',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards GitLab APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#limiting-scopes-of-a-personal-access-token}\n * for a full list of supported scopes.\n */\nexport const gitlabAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.gitlab',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Microsoft APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info and a full list of supported scopes, see:\n * - {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent}\n * - {@link https://docs.microsoft.com/en-us/graph/permissions-reference}\n */\nexport const microsoftAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.microsoft',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards OneLogin APIs.\n *\n * @public\n */\nexport const oneloginAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.onelogin',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Bitbucket APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/}\n * for a full list of supported scopes.\n */\nexport const bitbucketAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.bitbucket',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Bitbucket Server APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://confluence.atlassian.com/bitbucketserver/bitbucket-oauth-2-0-provider-api-1108483661.html#BitbucketOAuth2.0providerAPI-scopes}\n * for a full list of supported scopes.\n */\nexport const bitbucketServerAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.bitbucket-server',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards Atlassian APIs.\n *\n * @public\n * @remarks\n *\n * See {@link https://developer.atlassian.com/cloud/jira/platform/scopes-for-connect-and-oauth-2-3LO-apps/}\n * for a full list of supported scopes.\n */\nexport const atlassianAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.atlassian',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards VMware Cloud APIs and identities.\n *\n * @public\n * @remarks\n *\n * For more info about VMware Cloud identity and access management:\n * - {@link https://docs.vmware.com/en/VMware-Cloud-services/services/Using-VMware-Cloud-Services/GUID-53D39337-D93A-4B84-BD18-DDF43C21479A.html}\n */\nexport const vmwareCloudAuthApiRef = createApiRef<\n OAuthApi &\n OpenIdConnectApi &\n ProfileInfoApi &\n BackstageIdentityApi &\n SessionApi\n>().with({\n id: 'core.auth.vmware-cloud',\n pluginId: 'app',\n});\n\n/**\n * Provides authentication towards OpenShift APIs and identities.\n *\n * @public\n * @remarks\n *\n * See {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html/authentication_and_authorization/configuring-oauth-clients}\n * on how to configure the OAuth clients and\n * {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html-single/authentication_and_authorization/index#tokens-scoping-about_configuring-internal-oauth}\n * for available scopes.\n */\nexport const openshiftAuthApiRef = createApiRef<\n OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi\n>().with({\n id: 'core.auth.openshift',\n pluginId: 'app',\n});\n"],"names":[],"mappings":";;;;;AAyRO,MAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA,EAI1B,QAAA,EAAU,UAAA;AAAA;AAAA;AAAA;AAAA,EAIV,SAAA,EAAW;AACb;AAgDO,MAAM,gBAAA,GAAmB,YAAA,EAM9B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,gBAAA,GAAmB,YAAA,EAE9B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,cAAA,GAAiB,YAAA,EAM5B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,gBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,gBAAA,GAAmB,YAAA,EAM9B,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAYM,MAAM,mBAAA,GAAsB,YAAA,EAMjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAOM,MAAM,kBAAA,GAAqB,YAAA,EAMhC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,oBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,mBAAA,GAAsB,YAAA,EAEjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,yBAAA,GAA4B,YAAA,EAEvC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,4BAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,mBAAA,GAAsB,YAAA,EAEjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAWM,MAAM,qBAAA,GAAwB,YAAA,EAMnC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,wBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;AAaM,MAAM,mBAAA,GAAsB,YAAA,EAEjC,CAAE,IAAA,CAAK;AAAA,EACP,EAAA,EAAI,qBAAA;AAAA,EACJ,QAAA,EAAU;AACZ,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiRef.esm.js","sources":["../../../src/apis/system/ApiRef.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OpaqueApiRef } from '@internal/frontend';\nimport type { ApiRef } from './types';\n\n/**\n * API reference configuration - holds an ID of the referenced API.\n *\n * @public\n */\nexport type ApiRefConfig = {\n id: string;\n};\n\ntype ApiRefBuilderConfig<TId extends string> = {\n id: TId;\n pluginId?: string;\n};\n\nfunction validateId(id: string): void {\n const valid = id\n .split('.')\n .flatMap(part => part.split('-'))\n .every(part => part.match(/^[a-z][a-z0-9]*$/));\n if (!valid) {\n throw new Error(\n `API id must only contain period separated lowercase alphanum tokens with dashes, got '${id}'`,\n );\n }\n}\n\nfunction makeApiRef<T, TId extends string>(\n config: ApiRefBuilderConfig<TId>,\n): ApiRef<T, TId> & { readonly $$type: '@backstage/ApiRef' } {\n return OpaqueApiRef.createInstance('v1', {\n id: config.id,\n ...(config.pluginId ? { pluginId: config.pluginId } : {}),\n T: null as unknown as T,\n toString() {\n return `apiRef{${config.id}}`;\n },\n }) as ApiRef<T, TId> & { readonly $$type: '@backstage/ApiRef' };\n}\n\n/**\n * Creates a reference to an API.\n *\n * @remarks\n *\n * The `id` is a stable identifier for the API implementation. The frontend\n * system infers the owning plugin for an API from the `id`. When using the\n * builder form, you can instead provide a `pluginId` explicitly. The\n * recommended pattern is `plugin.<plugin-id>.*` (for example,\n * `plugin.catalog.entity-presentation`). This ensures that other plugins can't\n * mistakenly override your API implementation.\n *\n * The recommended way to create an API reference is:\n *\n * ```ts\n * const myApiRef = createApiRef<MyApi>().with({\n * id: 'my-api',\n * pluginId: 'my-plugin',\n * });\n * ```\n *\n * The legacy way to create an API reference is:\n *\n * ```ts\n * const myApiRef = createApiRef<MyApi>({ id: 'plugin.my.api' });\n * ```\n *\n * @public\n */\n/**\n * Creates a reference to an API.\n *\n * @deprecated Use `createApiRef<T>().with(...)` instead.\n * @public\n */\nexport function createApiRef<T>(\n config: ApiRefConfig,\n): ApiRef<T> & { readonly $$type: '@backstage/ApiRef' };\n/**\n * Creates a reference to an API.\n *\n * @remarks\n *\n * Returns a builder with a `.with()` method for providing the API reference\n * configuration.\n *\n * @public\n */\nexport function createApiRef<T>(): {\n with<const TId extends string>(\n config: ApiRefConfig & { id: TId; pluginId?: string },\n ): ApiRef<T, TId> & {\n readonly $$type: '@backstage/ApiRef';\n };\n};\nexport function createApiRef<T>(config?: ApiRefConfig):\n | (ApiRef<T> & { readonly $$type: '@backstage/ApiRef' })\n | {\n with<const TId extends string>(\n config: ApiRefConfig & { id: TId; pluginId?: string },\n ): ApiRef<T, TId> & {\n readonly $$type: '@backstage/ApiRef';\n };\n } {\n if (config) {\n validateId(config.id);\n return makeApiRef<T, string>(config);\n }\n return {\n with<const TId extends string>(\n withConfig: ApiRefConfig & { id: TId; pluginId?: string },\n ): ApiRef<T, TId> & { readonly $$type: '@backstage/ApiRef' } {\n validateId(withConfig.id);\n return makeApiRef<T, TId>(withConfig);\n },\n };\n}\n"],"names":[],"mappings":";;AAiCA,SAAS,WAAW,EAAA,EAAkB;AACpC,EAAA,MAAM,QAAQ,EAAA,CACX,KAAA,CAAM,GAAG,CAAA,CACT,QAAQ,CAAA,IAAA,KAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,CAAC,CAAA,CAC/B,KAAA,CAAM,UAAQ,IAAA,CAAK,KAAA,CAAM,kBAAkB,CAAC,CAAA;AAC/C,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,yFAAyF,EAAE,CAAA,CAAA;AAAA,KAC7F;AAAA,EACF;AACF;AAEA,SAAS,WACP,MAAA,EAC2D;AAC3D,EAAA,OAAO,YAAA,CAAa,eAAe,IAAA,EAAM;AAAA,IACvC,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,GAAI,OAAO,QAAA,GAAW,EAAE,UAAU,MAAA,CAAO,QAAA,KAAa,EAAC;AAAA,IACvD,CAAA,EAAG,IAAA;AAAA,IACH,QAAA,GAAW;AACT,MAAA,OAAO,CAAA,OAAA,EAAU,OAAO,EAAE,CAAA,CAAA,CAAA;AAAA,IAC5B;AAAA,GACD,CAAA;AACH;AAyDO,SAAS,aAAgB,MAAA,EAQ1B;AACJ,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,UAAA,CAAW,OAAO,EAAE,CAAA;AACpB,IAAA,OAAO,WAAsB,MAAM,CAAA;AAAA,EACrC;AACA,EAAA,OAAO;AAAA,IACL,KACE,UAAA,EAC2D;AAC3D,MAAA,UAAA,CAAW,WAAW,EAAE,CAAA;AACxB,MAAA,OAAO,WAAmB,UAAU,CAAA;AAAA,IACtC;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"ApiRef.esm.js","sources":["../../../src/apis/system/ApiRef.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OpaqueApiRef } from '@internal/frontend';\nimport type { ApiRef } from './types';\n\n/**\n * API reference configuration - holds an ID of the referenced API.\n *\n * @public\n */\nexport type ApiRefConfig = {\n id: string;\n};\n\ntype ApiRefBuilderConfig<TId extends string> = {\n id: TId;\n pluginId?: string;\n};\n\nfunction validateId(id: string): void {\n const valid = id\n .split('.')\n .flatMap(part => part.split('-'))\n .every(part => part.match(/^[a-z][a-z0-9]*$/));\n if (!valid) {\n throw new Error(\n `API id must only contain period separated lowercase alphanum tokens with dashes, got '${id}'`,\n );\n }\n}\n\nfunction makeApiRef<T, TId extends string>(\n config: ApiRefBuilderConfig<TId>,\n): ApiRef<T, TId> & { readonly $$type: '@backstage/ApiRef' } {\n return OpaqueApiRef.createInstance('v1', {\n id: config.id,\n ...(config.pluginId ? { pluginId: config.pluginId } : {}),\n T: null as unknown as T,\n toString() {\n return `apiRef{${config.id}}`;\n },\n }) as ApiRef<T, TId> & { readonly $$type: '@backstage/ApiRef' };\n}\n\n/**\n * Creates a reference to an API.\n *\n * @remarks\n *\n * The `id` is a stable identifier for the API implementation. The frontend\n * system infers the owning plugin for an API from the `id`. When using the\n * builder form, you can instead provide a `pluginId` explicitly. The\n * recommended pattern is `plugin.<plugin-id>.*` (for example,\n * `plugin.catalog.entity-presentation`). This ensures that other plugins can't\n * mistakenly override your API implementation.\n *\n * The recommended way to create an API reference is:\n *\n * ```ts\n * const myApiRef = createApiRef<MyApi>().with({\n * id: 'my-api',\n * pluginId: 'my-plugin',\n * });\n * ```\n *\n * The legacy way to create an API reference is:\n *\n * ```ts\n * const myApiRef = createApiRef<MyApi>({ id: 'plugin.my.api' });\n * ```\n *\n * @public\n */\n/**\n * Creates a reference to an API.\n *\n * @deprecated Use `createApiRef<T>().with(...)` instead.\n * @public\n */\nexport function createApiRef<T>(\n config: ApiRefConfig,\n): ApiRef<T> & { readonly $$type: '@backstage/ApiRef' };\n/**\n * Creates a reference to an API.\n *\n * @remarks\n *\n * Returns a builder with a `.with()` method for providing the API reference\n * configuration.\n *\n * @public\n */\nexport function createApiRef<T>(): {\n with<const TId extends string>(\n config: ApiRefConfig & { id: TId; pluginId?: string },\n ): ApiRef<T, TId> & {\n readonly $$type: '@backstage/ApiRef';\n };\n};\nexport function createApiRef<T>(config?: ApiRefConfig):\n | (ApiRef<T> & { readonly $$type: '@backstage/ApiRef' })\n | {\n with<const TId extends string>(\n config: ApiRefConfig & { id: TId; pluginId?: string },\n ): ApiRef<T, TId> & {\n readonly $$type: '@backstage/ApiRef';\n };\n } {\n if (config) {\n validateId(config.id);\n return makeApiRef<T, string>(config);\n }\n return {\n with<const TId extends string>(\n withConfig: ApiRefConfig & { id: TId; pluginId?: string },\n ): ApiRef<T, TId> & { readonly $$type: '@backstage/ApiRef' } {\n validateId(withConfig.id);\n return makeApiRef<T, TId>(withConfig);\n },\n };\n}\n"],"names":[],"mappings":";;AAiCA,SAAS,WAAW,EAAA,EAAkB;AACpC,EAAA,MAAM,QAAQ,EAAA,CACX,KAAA,CAAM,GAAG,CAAA,CACT,QAAQ,CAAA,IAAA,KAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,CAAC,CAAA,CAC/B,KAAA,CAAM,UAAQ,IAAA,CAAK,KAAA,CAAM,kBAAkB,CAAC,CAAA;AAC/C,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,yFAAyF,EAAE,CAAA,CAAA;AAAA,KAC7F;AAAA,EACF;AACF;AAEA,SAAS,WACP,MAAA,EAC2D;AAC3D,EAAA,OAAO,YAAA,CAAa,eAAe,IAAA,EAAM;AAAA,IACvC,IAAI,MAAA,CAAO,EAAA;AAAA,IACX,GAAI,OAAO,QAAA,GAAW,EAAE,UAAU,MAAA,CAAO,QAAA,KAAa,EAAC;AAAA,IACvD,CAAA,EAAG,IAAA;AAAA,IACH,QAAA,GAAW;AACT,MAAA,OAAO,CAAA,OAAA,EAAU,OAAO,EAAE,CAAA,CAAA,CAAA;AAAA,IAC5B;AAAA,GACD,CAAA;AACH;AAyDO,SAAS,aAAgB,MAAA,EAQ1B;AACJ,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,UAAA,CAAW,OAAO,EAAE,CAAA;AACpB,IAAA,OAAO,WAAsB,MAAM,CAAA;AAAA,EACrC;AACA,EAAA,OAAO;AAAA,IACL,KACE,UAAA,EAC2D;AAC3D,MAAA,UAAA,CAAW,WAAW,EAAE,CAAA;AACxB,MAAA,OAAO,WAAmB,UAAU,CAAA;AAAA,IACtC;AAAA,GACF;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.esm.js","sources":["../../../src/apis/system/helpers.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiRef, ApiFactory, TypesToApiRefs } from './types';\n\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @remarks\n *\n * This function doesn't actually do anything, it's only used to infer types.\n *\n * @public\n */\nexport function createApiFactory<\n Api,\n Impl extends Api,\n Deps extends { [name in string]: unknown },\n>(factory: ApiFactory<Api, Impl, Deps>): ApiFactory<Api, Impl, Deps>;\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @param api - Ref of the API that will be produced by the factory.\n * @param instance - Implementation of the API to use.\n * @public\n */\nexport function createApiFactory<Api, Impl extends Api>(\n api: ApiRef<Api>,\n instance: Impl,\n): ApiFactory<Api, Impl, {}>;\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @remarks\n *\n * Creates factory from {@link ApiRef} or returns the factory itself if provided.\n *\n * @param factory - Existing factory or {@link ApiRef}.\n * @param instance - The instance to be returned by the factory.\n * @public\n */\nexport function createApiFactory<\n Api,\n Impl extends Api,\n Deps extends { [name in string]: unknown },\n>(\n factory: ApiFactory<Api, Impl, Deps> | ApiRef<Api>,\n instance?: Impl,\n): ApiFactory<Api, Impl, Deps> {\n if ('id' in factory) {\n return {\n api: factory,\n deps: {} as TypesToApiRefs<Deps>,\n factory: () => instance!,\n };\n }\n return factory;\n}\n"],"names":[],"mappings":"AAyDO,SAAS,gBAAA,CAKd,SACA,QAAA,EAC6B;AAC7B,EAAA,IAAI,QAAQ,OAAA,EAAS;AACnB,IAAA,OAAO;AAAA,MACL,GAAA,EAAK,OAAA;AAAA,MACL,MAAM,EAAC;AAAA,MACP,SAAS,MAAM;AAAA,KACjB;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT;;;;"}
1
+ {"version":3,"file":"helpers.esm.js","sources":["../../../src/apis/system/helpers.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ApiRef, ApiFactory, TypesToApiRefs } from './types';\n\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @remarks\n *\n * This function doesn't actually do anything, it's only used to infer types.\n *\n * @public\n */\nexport function createApiFactory<\n Api,\n Impl extends Api,\n Deps extends { [name in string]: unknown },\n>(factory: ApiFactory<Api, Impl, Deps>): ApiFactory<Api, Impl, Deps>;\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @param api - Ref of the API that will be produced by the factory.\n * @param instance - Implementation of the API to use.\n * @public\n */\nexport function createApiFactory<Api, Impl extends Api>(\n api: ApiRef<Api>,\n instance: Impl,\n): ApiFactory<Api, Impl, {}>;\n/**\n * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed\n * to another function.\n *\n * @remarks\n *\n * Creates factory from {@link ApiRef} or returns the factory itself if provided.\n *\n * @param factory - Existing factory or {@link ApiRef}.\n * @param instance - The instance to be returned by the factory.\n * @public\n */\nexport function createApiFactory<\n Api,\n Impl extends Api,\n Deps extends { [name in string]: unknown },\n>(\n factory: ApiFactory<Api, Impl, Deps> | ApiRef<Api>,\n instance?: Impl,\n): ApiFactory<Api, Impl, Deps> {\n if ('id' in factory) {\n return {\n api: factory,\n deps: {} as TypesToApiRefs<Deps>,\n factory: () => instance!,\n };\n }\n return factory;\n}\n"],"names":[],"mappings":"AAyDO,SAAS,gBAAA,CAKd,SACA,QAAA,EAC6B;AAC7B,EAAA,IAAI,QAAQ,OAAA,EAAS;AACnB,IAAA,OAAO;AAAA,MACL,GAAA,EAAK,OAAA;AAAA,MACL,MAAM,EAAC;AAAA,MACP,SAAS,MAAM;AAAA,KACjB;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useApi.esm.js","sources":["../../../src/apis/system/useApi.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ComponentType, PropsWithChildren } from 'react';\nimport { ApiRef, ApiHolder, TypesToApiRefs } from './types';\nimport { useVersionedContext } from '@backstage/version-bridge';\nimport { NotImplementedError } from '@backstage/errors';\n\nconst emptyApiHolder: ApiHolder = Object.freeze({ get: () => undefined });\n\n/**\n * React hook for retrieving {@link ApiHolder}, an API catalog.\n *\n * @public\n */\nexport function useApiHolder(): ApiHolder {\n const versionedHolder = useVersionedContext<{ 1: ApiHolder }>('api-context');\n if (!versionedHolder) {\n return emptyApiHolder;\n }\n\n const apiHolder = versionedHolder.atVersion(1);\n if (!apiHolder) {\n throw new NotImplementedError('ApiContext v1 not available');\n }\n return apiHolder;\n}\n\n/**\n * React hook for retrieving APIs.\n *\n * @param apiRef - Reference of the API to use.\n * @public\n */\nexport function useApi<T>(apiRef: ApiRef<T>): T {\n const apiHolder = useApiHolder();\n\n const api = apiHolder.get(apiRef);\n if (!api) {\n throw new NotImplementedError(`No implementation available for ${apiRef}`);\n }\n return api;\n}\n\n/**\n * Wrapper for giving component an API context.\n *\n * @param apis - APIs for the context.\n * @deprecated Use `withApis` from `@backstage/core-compat-api` instead.\n * @public\n */\nexport function withApis<T extends {}>(apis: TypesToApiRefs<T>) {\n return function withApisWrapper<TProps extends T>(\n WrappedComponent: ComponentType<TProps>,\n ) {\n const Hoc = (props: PropsWithChildren<Omit<TProps, keyof T>>) => {\n const apiHolder = useApiHolder();\n\n const impls = {} as T;\n\n for (const key in apis) {\n if (apis.hasOwnProperty(key)) {\n const ref = apis[key];\n\n const api = apiHolder.get(ref);\n if (!api) {\n throw new NotImplementedError(\n `No implementation available for ${ref}`,\n );\n }\n impls[key] = api;\n }\n }\n\n return <WrappedComponent {...(props as TProps)} {...impls} />;\n };\n const displayName =\n WrappedComponent.displayName || WrappedComponent.name || 'Component';\n\n Hoc.displayName = `withApis(${displayName})`;\n\n return Hoc;\n };\n}\n"],"names":[],"mappings":";;;;AAqBA,MAAM,iBAA4B,MAAA,CAAO,MAAA,CAAO,EAAE,GAAA,EAAK,MAAM,QAAW,CAAA;AAOjE,SAAS,YAAA,GAA0B;AACxC,EAAA,MAAM,eAAA,GAAkB,oBAAsC,aAAa,CAAA;AAC3E,EAAA,IAAI,CAAC,eAAA,EAAiB;AACpB,IAAA,OAAO,cAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAAA,GAAY,eAAA,CAAgB,SAAA,CAAU,CAAC,CAAA;AAC7C,EAAA,IAAI,CAAC,SAAA,EAAW;AACd,IAAA,MAAM,IAAI,oBAAoB,6BAA6B,CAAA;AAAA,EAC7D;AACA,EAAA,OAAO,SAAA;AACT;AAQO,SAAS,OAAU,MAAA,EAAsB;AAC9C,EAAA,MAAM,YAAY,YAAA,EAAa;AAE/B,EAAA,MAAM,GAAA,GAAM,SAAA,CAAU,GAAA,CAAI,MAAM,CAAA;AAChC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,mBAAA,CAAoB,CAAA,gCAAA,EAAmC,MAAM,CAAA,CAAE,CAAA;AAAA,EAC3E;AACA,EAAA,OAAO,GAAA;AACT;AASO,SAAS,SAAuB,IAAA,EAAyB;AAC9D,EAAA,OAAO,SAAS,gBACd,gBAAA,EACA;AACA,IAAA,MAAM,GAAA,GAAM,CAAC,KAAA,KAAoD;AAC/D,MAAA,MAAM,YAAY,YAAA,EAAa;AAE/B,MAAA,MAAM,QAAQ,EAAC;AAEf,MAAA,KAAA,MAAW,OAAO,IAAA,EAAM;AACtB,QAAA,IAAI,IAAA,CAAK,cAAA,CAAe,GAAG,CAAA,EAAG;AAC5B,UAAA,MAAM,GAAA,GAAM,KAAK,GAAG,CAAA;AAEpB,UAAA,MAAM,GAAA,GAAM,SAAA,CAAU,GAAA,CAAI,GAAG,CAAA;AAC7B,UAAA,IAAI,CAAC,GAAA,EAAK;AACR,YAAA,MAAM,IAAI,mBAAA;AAAA,cACR,mCAAmC,GAAG,CAAA;AAAA,aACxC;AAAA,UACF;AACA,UAAA,KAAA,CAAM,GAAG,CAAA,GAAI,GAAA;AAAA,QACf;AAAA,MACF;AAEA,MAAA,uBAAO,GAAA,CAAC,gBAAA,EAAA,EAAkB,GAAI,KAAA,EAAmB,GAAG,KAAA,EAAO,CAAA;AAAA,IAC7D,CAAA;AACA,IAAA,MAAM,WAAA,GACJ,gBAAA,CAAiB,WAAA,IAAe,gBAAA,CAAiB,IAAA,IAAQ,WAAA;AAE3D,IAAA,GAAA,CAAI,WAAA,GAAc,YAAY,WAAW,CAAA,CAAA,CAAA;AAEzC,IAAA,OAAO,GAAA;AAAA,EACT,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"useApi.esm.js","sources":["../../../src/apis/system/useApi.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ComponentType, PropsWithChildren } from 'react';\nimport { ApiRef, ApiHolder, TypesToApiRefs } from './types';\nimport { useVersionedContext } from '@backstage/version-bridge';\nimport { NotImplementedError } from '@backstage/errors';\n\nconst emptyApiHolder: ApiHolder = Object.freeze({ get: () => undefined });\n\n/**\n * React hook for retrieving {@link ApiHolder}, an API catalog.\n *\n * @public\n */\nexport function useApiHolder(): ApiHolder {\n const versionedHolder = useVersionedContext<{ 1: ApiHolder }>('api-context');\n if (!versionedHolder) {\n return emptyApiHolder;\n }\n\n const apiHolder = versionedHolder.atVersion(1);\n if (!apiHolder) {\n throw new NotImplementedError('ApiContext v1 not available');\n }\n return apiHolder;\n}\n\n/**\n * React hook for retrieving APIs.\n *\n * @param apiRef - Reference of the API to use.\n * @public\n */\nexport function useApi<T>(apiRef: ApiRef<T>): T {\n const apiHolder = useApiHolder();\n\n const api = apiHolder.get(apiRef);\n if (!api) {\n throw new NotImplementedError(`No implementation available for ${apiRef}`);\n }\n return api;\n}\n\n/**\n * Wrapper for giving component an API context.\n *\n * @param apis - APIs for the context.\n * @deprecated Use `withApis` from `@backstage/core-compat-api` instead.\n * @public\n */\nexport function withApis<T extends {}>(apis: TypesToApiRefs<T>) {\n return function withApisWrapper<TProps extends T>(\n WrappedComponent: ComponentType<TProps>,\n ) {\n const Hoc = (props: PropsWithChildren<Omit<TProps, keyof T>>) => {\n const apiHolder = useApiHolder();\n\n const impls = {} as T;\n\n for (const key in apis) {\n if (apis.hasOwnProperty(key)) {\n const ref = apis[key];\n\n const api = apiHolder.get(ref);\n if (!api) {\n throw new NotImplementedError(\n `No implementation available for ${ref}`,\n );\n }\n impls[key] = api;\n }\n }\n\n return <WrappedComponent {...(props as TProps)} {...impls} />;\n };\n const displayName =\n WrappedComponent.displayName || WrappedComponent.name || 'Component';\n\n Hoc.displayName = `withApis(${displayName})`;\n\n return Hoc;\n };\n}\n"],"names":[],"mappings":";;;;AAqBA,MAAM,iBAA4B,MAAA,CAAO,MAAA,CAAO,EAAE,GAAA,EAAK,MAAM,QAAW,CAAA;AAOjE,SAAS,YAAA,GAA0B;AACxC,EAAA,MAAM,eAAA,GAAkB,oBAAsC,aAAa,CAAA;AAC3E,EAAA,IAAI,CAAC,eAAA,EAAiB;AACpB,IAAA,OAAO,cAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAAA,GAAY,eAAA,CAAgB,SAA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AAQ,WAAA;AAE3D,IAAA,GAAA,CAAI,WAAA,GAAc,YAAY,WAAW,CAAA,CAAA,CAAA;AAEzC,IAAA,OAAO,GAAA;AAAA,EACT,CAAA;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsImplementationBlueprint.esm.js","sources":["../../src/blueprints/AnalyticsImplementationBlueprint.ts"],"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 { AnalyticsImplementation, TypesToApiRefs } from '../apis';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\n/**\n * @public\n * @deprecated Use `AnalyticsImplementationFactory` from `@backstage/plugin-app-react` instead.\n */\nexport type AnalyticsImplementationFactory<\n Deps extends { [name in string]: unknown } = {},\n> = {\n deps: TypesToApiRefs<Deps>;\n factory(deps: Deps): AnalyticsImplementation;\n};\n\nconst factoryDataRef =\n createExtensionDataRef<AnalyticsImplementationFactory>().with({\n id: 'core.analytics.factory',\n });\n\n/**\n * Creates analytics implementations.\n *\n * @public\n * @deprecated Use `AnalyticsImplementationBlueprint` from `@backstage/plugin-app-react` instead.\n */\nexport const AnalyticsImplementationBlueprint = createExtensionBlueprint({\n kind: 'analytics',\n attachTo: { id: 'api:app/analytics', input: 'implementations' },\n output: [factoryDataRef],\n dataRefs: {\n factory: factoryDataRef,\n },\n defineParams: <TDeps extends { [name in string]: unknown }>(\n params: AnalyticsImplementationFactory<TDeps>,\n ) => createExtensionBlueprintParams(params as AnalyticsImplementationFactory),\n *factory(params) {\n yield factoryDataRef(params);\n },\n});\n"],"names":[],"mappings":";;;;AAkCA,MAAM,cAAA,GACJ,sBAAA,EAAuD,CAAE,IAAA,CAAK;AAAA,EAC5D,EAAA,EAAI;AACN,CAAC,CAAA;AAQI,MAAM,mCAAmC,wBAAA,CAAyB;AAAA,EACvE,IAAA,EAAM,WAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,mBAAA,EAAqB,OAAO,iBAAA,EAAkB;AAAA,EAC9D,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,YAAA,EAAc,CACZ,MAAA,KACG,8BAAA,CAA+B,MAAwC,CAAA;AAAA,EAC5E,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,eAAe,MAAM,CAAA;AAAA,EAC7B;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"AnalyticsImplementationBlueprint.esm.js","sources":["../../src/blueprints/AnalyticsImplementationBlueprint.ts"],"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 { AnalyticsImplementation, TypesToApiRefs } from '../apis';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\n/**\n * @public\n * @deprecated Use `AnalyticsImplementationFactory` from `@backstage/plugin-app-react` instead.\n */\nexport type AnalyticsImplementationFactory<\n Deps extends { [name in string]: unknown } = {},\n> = {\n deps: TypesToApiRefs<Deps>;\n factory(deps: Deps): AnalyticsImplementation;\n};\n\nconst factoryDataRef =\n createExtensionDataRef<AnalyticsImplementationFactory>().with({\n id: 'core.analytics.factory',\n });\n\n/**\n * Creates analytics implementations.\n *\n * @public\n * @deprecated Use `AnalyticsImplementationBlueprint` from `@backstage/plugin-app-react` instead.\n */\nexport const AnalyticsImplementationBlueprint = createExtensionBlueprint({\n kind: 'analytics',\n attachTo: { id: 'api:app/analytics', input: 'implementations' },\n output: [factoryDataRef],\n dataRefs: {\n factory: factoryDataRef,\n },\n defineParams: <TDeps extends { [name in string]: unknown }>(\n params: AnalyticsImplementationFactory<TDeps>,\n ) => createExtensionBlueprintParams(params as AnalyticsImplementationFactory),\n *factory(params) {\n yield factoryDataRef(params);\n },\n});\n"],"names":[],"mappings":";;;;AAkCA,MAAM,cAAA,GACJ,sBAAA,EAAuD,CAAE,IAAA,CAAK;AAAA,EAC5D,EAAA,EAAI;AACN,CAAC,CAAA;AAQI,MAAM,mCAAmC,wBAAA,CAAyB;AAAA,EACvE,IAAA,EAAM,WAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,mBAAA,EAAqB,OAAO,iBAAA,EAAkB;AAAA,EAC9D,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,YAAA,EAAc,CACZ,MAAA,KACG,8BAAA,CAA+B,MAAwC,CAAA;AAAA,EAC5E,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,eAAe,MAAM,CAAA;AAAA,EAC7B;AACF,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiBlueprint.esm.js","sources":["../../src/blueprints/ApiBlueprint.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 { AnyApiFactory, ApiFactory } from '../apis/system';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\nimport { createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint';\n\nconst factoryDataRef = createExtensionDataRef<AnyApiFactory>().with({\n id: 'core.api.factory',\n});\n\n/**\n * Creates utility API extensions.\n *\n * @public\n */\nexport const ApiBlueprint = createExtensionBlueprint({\n kind: 'api',\n attachTo: { id: 'root', input: 'apis' },\n output: [factoryDataRef],\n dataRefs: {\n factory: factoryDataRef,\n },\n defineParams: <\n TApi,\n TImpl extends TApi,\n TDeps extends { [name in string]: unknown },\n >(\n params: ApiFactory<TApi, TImpl, TDeps>,\n ) => createExtensionBlueprintParams(params as AnyApiFactory),\n *factory(params) {\n yield factoryDataRef(params);\n },\n});\n"],"names":[],"mappings":";;;;AAoBA,MAAM,cAAA,GAAiB,sBAAA,EAAsC,CAAE,IAAA,CAAK;AAAA,EAClE,EAAA,EAAI;AACN,CAAC,CAAA;AAOM,MAAM,eAAe,wBAAA,CAAyB;AAAA,EACnD,IAAA,EAAM,KAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,MAAA,EAAQ,OAAO,MAAA,EAAO;AAAA,EACtC,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,YAAA,EAAc,CAKZ,MAAA,KACG,8BAAA,CAA+B,MAAuB,CAAA;AAAA,EAC3D,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,eAAe,MAAM,CAAA;AAAA,EAC7B;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"ApiBlueprint.esm.js","sources":["../../src/blueprints/ApiBlueprint.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 { AnyApiFactory, ApiFactory } from '../apis/system';\nimport { createExtensionBlueprint, createExtensionDataRef } from '../wiring';\nimport { createExtensionBlueprintParams } from '../wiring/createExtensionBlueprint';\n\nconst factoryDataRef = createExtensionDataRef<AnyApiFactory>().with({\n id: 'core.api.factory',\n});\n\n/**\n * Creates utility API extensions.\n *\n * @public\n */\nexport const ApiBlueprint = createExtensionBlueprint({\n kind: 'api',\n attachTo: { id: 'root', input: 'apis' },\n output: [factoryDataRef],\n dataRefs: {\n factory: factoryDataRef,\n },\n defineParams: <\n TApi,\n TImpl extends TApi,\n TDeps extends { [name in string]: unknown },\n >(\n params: ApiFactory<TApi, TImpl, TDeps>,\n ) => createExtensionBlueprintParams(params as AnyApiFactory),\n *factory(params) {\n yield factoryDataRef(params);\n },\n});\n"],"names":[],"mappings":";;;;AAoBA,MAAM,cAAA,GAAiB,sBAAA,EAAsC,CAAE,IAAA,CAAK;AAAA,EAClE,EAAA,EAAI;AACN,CAAC,CAAA;AAOM,MAAM,eAAe,wBAAA,CAAyB;AAAA,EACnD,IAAA,EAAM,KAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,MAAA,EAAQ,OAAO,MAAA,EAAO;AAAA,EACtC,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,YAAA,EAAc,CAKZ,MAAA,KACG,8BAAA,CAA+B,MAAuB,CAAA;AAAA,EAC3D,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,eAAe,MAAM,CAAA;AAAA,EAC7B;AACF,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppRootElementBlueprint.esm.js","sources":["../../src/blueprints/AppRootElementBlueprint.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 { ExtensionBoundary } from '../components/ExtensionBoundary';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\n\n/**\n * Creates extensions that render a React element at the app root, outside of\n * the app layout. This is useful for example for shared popups and similar.\n *\n * @public\n */\nexport const AppRootElementBlueprint = createExtensionBlueprint({\n kind: 'app-root-element',\n attachTo: { id: 'app/root', input: 'elements' },\n output: [coreExtensionData.reactElement],\n *factory(params: { element: JSX.Element }, { node }) {\n yield coreExtensionData.reactElement(\n <ExtensionBoundary node={node} errorPresentation=\"error-api\">\n {params.element}\n </ExtensionBoundary>,\n );\n },\n});\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,0BAA0B,wBAAA,CAAyB;AAAA,EAC9D,IAAA,EAAM,kBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,UAAA,EAAY,OAAO,UAAA,EAAW;AAAA,EAC9C,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,CAAC,OAAA,CAAQ,MAAA,EAAkC,EAAE,MAAK,EAAG;AACnD,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,0BACrB,iBAAA,EAAA,EAAkB,IAAA,EAAY,iBAAA,EAAkB,WAAA,EAC9C,iBAAO,OAAA,EACV;AAAA,KACF;AAAA,EACF;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"AppRootElementBlueprint.esm.js","sources":["../../src/blueprints/AppRootElementBlueprint.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 { ExtensionBoundary } from '../components/ExtensionBoundary';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\n\n/**\n * Creates extensions that render a React element at the app root, outside of\n * the app layout. This is useful for example for shared popups and similar.\n *\n * @public\n */\nexport const AppRootElementBlueprint = createExtensionBlueprint({\n kind: 'app-root-element',\n attachTo: { id: 'app/root', input: 'elements' },\n output: [coreExtensionData.reactElement],\n *factory(params: { element: JSX.Element }, { node }) {\n yield coreExtensionData.reactElement(\n <ExtensionBoundary node={node} errorPresentation=\"error-api\">\n {params.element}\n </ExtensionBoundary>,\n );\n },\n});\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,0BAA0B,wBAAA,CAAyB;AAAA,EAC9D,IAAA,EAAM,kBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,UAAA,EAAY,OAAO,UAAA,EAAW;AAAA,EAC9C,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,CAAC,OAAA,CAAQ,MAAA,EAAkC,EAAE,MAAK,EAAG;AACnD,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,0BACrB,iBAAA,EAAA,EAAkB,IAAA,EAAY,iBAAA,EAAkB,WAAA,EAC9C,iBAAO,OAAA,EACV;AAAA,KACF;AAAA,EACF;AACF,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PageBlueprint.esm.js","sources":["../../src/blueprints/PageBlueprint.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 { JSX } from 'react';\nimport { Routes, Route, Navigate } from 'react-router-dom';\nimport { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n createExtensionInput,\n} from '../wiring';\nimport { ExtensionBoundary, PageLayout, PageLayoutTab } from '../components';\nimport { useApi } from '../apis/system';\nimport { BreadcrumbEntry } from '../breadcrumbs';\nimport { routeResolutionApiRef } from '../apis/definitions/RouteResolutionApi';\nimport { pluginHeaderActionsApiRef } from '../apis/definitions/PluginHeaderActionsApi';\nimport { RouteResolutionApi } from '../apis/definitions/RouteResolutionApi';\nimport { optionalStringSchema } from '../schema/optionalStringSchema';\n\nfunction resolveTitleLink(\n routeResolutionApi: RouteResolutionApi,\n routeRef: RouteRef | undefined,\n): string | undefined {\n if (!routeRef) {\n return undefined;\n }\n try {\n return routeResolutionApi.resolve(routeRef)?.();\n } catch {\n // Route ref may require params not available in the current context\n return undefined;\n }\n}\n\n/**\n * Creates extensions that are routable React page components.\n *\n * @public\n */\nexport const PageBlueprint = createExtensionBlueprint({\n kind: 'page',\n attachTo: { id: 'app/routes', input: 'routes' },\n inputs: {\n pages: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ]),\n },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ],\n configSchema: {\n path: optionalStringSchema,\n title: optionalStringSchema,\n },\n *factory(\n params: {\n path: string;\n title?: string;\n icon?: IconElement;\n loader?: () => Promise<JSX.Element>;\n routeRef?: RouteRef;\n /**\n * Hide the default plugin page header, making the page fill up all available space.\n */\n noHeader?: boolean;\n },\n { config, node, inputs },\n ) {\n const title = config.title ?? params.title;\n const icon = params.icon;\n const pluginId = node.spec.plugin.pluginId;\n const noHeader = params.noHeader ?? false;\n const resolvedTitle =\n title ?? node.spec.plugin.title ?? node.spec.plugin.pluginId;\n const resolvedIcon = icon ?? node.spec.plugin.icon;\n const titleRouteRef =\n (node.spec.plugin.routes as { root?: RouteRef }).root ?? params.routeRef;\n\n yield coreExtensionData.routePath(config.path ?? params.path);\n if (params.loader) {\n const loader = params.loader;\n const PageContent = () => {\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n noHeader={noHeader}\n titleLink={titleLink}\n headerActions={headerActions}\n >\n {ExtensionBoundary.lazy(node, loader)}\n </PageLayout>\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n } else if (inputs.pages.length > 0) {\n // Parent page with sub-pages - render header with tabs\n const tabs: PageLayoutTab[] = inputs.pages.map(page => {\n const path = page.get(coreExtensionData.routePath);\n const tabTitle = page.get(coreExtensionData.title);\n const tabIcon = page.get(coreExtensionData.icon);\n return {\n id: path,\n label: tabTitle || path,\n icon: tabIcon,\n href: path,\n };\n });\n\n const PageContent = () => {\n const firstPagePath = inputs.pages[0]?.get(coreExtensionData.routePath);\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n tabs={tabs}\n titleLink={titleLink}\n headerActions={headerActions}\n >\n <Routes>\n {firstPagePath && (\n <Route\n index\n element={<Navigate to={firstPagePath} replace />}\n />\n )}\n {inputs.pages.map((page, index) => {\n const path = page.get(coreExtensionData.routePath);\n const tabTitle = page.get(coreExtensionData.title);\n const element = page.get(coreExtensionData.reactElement);\n return (\n <Route\n key={index}\n path={`${path}/*`}\n element={\n <BreadcrumbEntry\n entry={{ label: tabTitle || path, href: path }}\n >\n {element}\n </BreadcrumbEntry>\n }\n />\n );\n })}\n </Routes>\n </PageLayout>\n );\n };\n\n yield coreExtensionData.reactElement(<PageContent />);\n } else {\n const PageContent = () => {\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n titleLink={titleLink}\n headerActions={headerActions}\n />\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n }\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (title) {\n yield coreExtensionData.title(title);\n }\n if (icon) {\n yield coreExtensionData.icon(icon);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,SAAS,gBAAA,CACP,oBACA,QAAA,EACoB;AACpB,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,IAAI;AACF,IAAA,OAAO,kBAAA,CAAmB,OAAA,CAAQ,QAAQ,CAAA,IAAI;AAAA,EAChD,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAOO,MAAM,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AU;AACnB,MAAA,MAAM,iBAAA,CAAkB,QAAA,CAAS,MAAA,CAAO,QAAQ,CAAA;AAAA,IAClD;AACA,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,MAAM,iBAAA,CAAkB,MAAM,KAAK,CAAA;AAAA,IACrC;AACA,IAAA,IAAI,IAAA,EAAM;AACR,MAAA,MAAM,iBAAA,CAAkB,KAAK,IAAI,CAAA;AAAA,IACnC;AAAA,EACF;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"PageBlueprint.esm.js","sources":["../../src/blueprints/PageBlueprint.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 { JSX } from 'react';\nimport { Routes, Route, Navigate } from 'react-router-dom';\nimport { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n createExtensionInput,\n} from '../wiring';\nimport { ExtensionBoundary, PageLayout, PageLayoutTab } from '../components';\nimport { useApi } from '../apis/system';\nimport { BreadcrumbEntry } from '../breadcrumbs';\nimport { routeResolutionApiRef } from '../apis/definitions/RouteResolutionApi';\nimport { pluginHeaderActionsApiRef } from '../apis/definitions/PluginHeaderActionsApi';\nimport { RouteResolutionApi } from '../apis/definitions/RouteResolutionApi';\nimport { optionalStringSchema } from '../schema/optionalStringSchema';\n\nfunction resolveTitleLink(\n routeResolutionApi: RouteResolutionApi,\n routeRef: RouteRef | undefined,\n): string | undefined {\n if (!routeRef) {\n return undefined;\n }\n try {\n return routeResolutionApi.resolve(routeRef)?.();\n } catch {\n // Route ref may require params not available in the current context\n return undefined;\n }\n}\n\n/**\n * Creates extensions that are routable React page components.\n *\n * @public\n */\nexport const PageBlueprint = createExtensionBlueprint({\n kind: 'page',\n attachTo: { id: 'app/routes', input: 'routes' },\n inputs: {\n pages: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ]),\n },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.title.optional(),\n coreExtensionData.icon.optional(),\n ],\n configSchema: {\n path: optionalStringSchema,\n title: optionalStringSchema,\n },\n *factory(\n params: {\n path: string;\n title?: string;\n icon?: IconElement;\n loader?: () => Promise<JSX.Element>;\n routeRef?: RouteRef;\n /**\n * Hide the default plugin page header, making the page fill up all available space.\n */\n noHeader?: boolean;\n },\n { config, node, inputs },\n ) {\n const title = config.title ?? params.title;\n const icon = params.icon;\n const pluginId = node.spec.plugin.pluginId;\n const noHeader = params.noHeader ?? false;\n const resolvedTitle =\n title ?? node.spec.plugin.title ?? node.spec.plugin.pluginId;\n const resolvedIcon = icon ?? node.spec.plugin.icon;\n const titleRouteRef =\n (node.spec.plugin.routes as { root?: RouteRef }).root ?? params.routeRef;\n\n yield coreExtensionData.routePath(config.path ?? params.path);\n if (params.loader) {\n const loader = params.loader;\n const PageContent = () => {\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n noHeader={noHeader}\n titleLink={titleLink}\n headerActions={headerActions}\n >\n {ExtensionBoundary.lazy(node, loader)}\n </PageLayout>\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n } else if (inputs.pages.length > 0) {\n // Parent page with sub-pages - render header with tabs\n const tabs: PageLayoutTab[] = inputs.pages.map(page => {\n const path = page.get(coreExtensionData.routePath);\n const tabTitle = page.get(coreExtensionData.title);\n const tabIcon = page.get(coreExtensionData.icon);\n return {\n id: path,\n label: tabTitle || path,\n icon: tabIcon,\n href: path,\n };\n });\n\n const PageContent = () => {\n const firstPagePath = inputs.pages[0]?.get(coreExtensionData.routePath);\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n tabs={tabs}\n titleLink={titleLink}\n headerActions={headerActions}\n >\n <Routes>\n {firstPagePath && (\n <Route\n index\n element={<Navigate to={firstPagePath} replace />}\n />\n )}\n {inputs.pages.map((page, index) => {\n const path = page.get(coreExtensionData.routePath);\n const tabTitle = page.get(coreExtensionData.title);\n const element = page.get(coreExtensionData.reactElement);\n return (\n <Route\n key={index}\n path={`${path}/*`}\n element={\n <BreadcrumbEntry\n entry={{ label: tabTitle || path, href: path }}\n >\n {element}\n </BreadcrumbEntry>\n }\n />\n );\n })}\n </Routes>\n </PageLayout>\n );\n };\n\n yield coreExtensionData.reactElement(<PageContent />);\n } else {\n const PageContent = () => {\n const routeResolutionApi = useApi(routeResolutionApiRef);\n const titleLink = resolveTitleLink(routeResolutionApi, titleRouteRef);\n const headerActionsApi = useApi(pluginHeaderActionsApiRef);\n const headerActions = headerActionsApi.getPluginHeaderActions(pluginId);\n return (\n <PageLayout\n title={resolvedTitle}\n icon={resolvedIcon}\n titleLink={titleLink}\n headerActions={headerActions}\n />\n );\n };\n yield coreExtensionData.reactElement(<PageContent />);\n }\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (title) {\n yield coreExtensionData.title(title);\n }\n if (icon) {\n yield coreExtensionData.icon(icon);\n }\n },\n});\n"],"names":[],"mapp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uB,QAAQ,CAAA;AACtE,QAAA,uBACE,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO,aAAA;AAAA,YACP,IAAA,EAAM,YAAA;AAAA,YACN,SAAA;AAAA,YACA;AAAA;AAAA,SACF;AAAA,MAEJ,CAAA;AACA,MAAA,MAAM,iBAAA,CAAkB,YAAA,iBAAa,GAAA,CAAC,WAAA,EAAA,EAAY,CAAE,CAAA;AAAA,IACtD;AACA,IAAA,IAAI,OAAO,QAAA,EAAU;AACnB,MAAA,MAAM,iBAAA,CAAkB,QAAA,CAAS,MAAA,CAAO,QAAQ,CAAA;AAAA,IAClD;AACA,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,MAAM,iBAAA,CAAkB,MAAM,KAAK,CAAA;AAAA,IACrC;AACA,IAAA,IAAI,IAAA,EAAM;AACR,MAAA,MAAM,iBAAA,CAAkB,KAAK,IAAI,CAAA;AAAA,IACnC;AAAA,EACF;AACF,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PluginHeaderActionBlueprint.esm.js","sources":["../../src/blueprints/PluginHeaderActionBlueprint.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 { lazy as reactLazy } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\n\n/**\n * Creates extensions that provide plugin-scoped header actions.\n *\n * @remarks\n *\n * These actions are automatically scoped to the plugin that provides them\n * and will appear in the header of all pages belonging to that plugin.\n *\n * @public\n */\nexport const PluginHeaderActionBlueprint = createExtensionBlueprint({\n kind: 'plugin-header-action',\n attachTo: { id: 'api:app/plugin-header-actions', input: 'actions' },\n output: [coreExtensionData.reactElement],\n *factory(params: { loader: () => Promise<JSX.Element> }, { node }) {\n const LazyAction = reactLazy(() =>\n params.loader().then(element => ({ default: () => element })),\n );\n yield coreExtensionData.reactElement(\n <ExtensionBoundary node={node} errorPresentation=\"error-api\">\n <LazyAction />\n </ExtensionBoundary>,\n );\n },\n});\n"],"names":["reactLazy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,MAAM,8BAA8B,wBAAA,CAAyB;AAAA,EAClE,IAAA,EAAM,sBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,+BAAA,EAAiC,OAAO,SAAA,EAAU;AAAA,EAClE,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,CAAC,OAAA,CAAQ,MAAA,EAAgD,EAAE,MAAK,EAAG;AACjE,IAAA,MAAM,UAAA,GAAaA,IAAA;AAAA,MAAU,MAC3B,MAAA,CAAO,MAAA,EAAO,CAAE,IAAA,CAAK,cAAY,EAAE,OAAA,EAAS,MAAM,OAAA,EAAQ,CAAE;AAAA,KAC9D;AACA,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,0BACrB,iBAAA,EAAA,EAAkB,IAAA,EAAY,mBAAkB,WAAA,EAC/C,QAAA,kBAAA,GAAA,CAAC,cAAW,CAAA,EACd;AAAA,KACF;AAAA,EACF;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"PluginHeaderActionBlueprint.esm.js","sources":["../../src/blueprints/PluginHeaderActionBlueprint.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 { lazy as reactLazy } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\n\n/**\n * Creates extensions that provide plugin-scoped header actions.\n *\n * @remarks\n *\n * These actions are automatically scoped to the plugin that provides them\n * and will appear in the header of all pages belonging to that plugin.\n *\n * @public\n */\nexport const PluginHeaderActionBlueprint = createExtensionBlueprint({\n kind: 'plugin-header-action',\n attachTo: { id: 'api:app/plugin-header-actions', input: 'actions' },\n output: [coreExtensionData.reactElement],\n *factory(params: { loader: () => Promise<JSX.Element> }, { node }) {\n const LazyAction = reactLazy(() =>\n params.loader().then(element => ({ default: () => element })),\n );\n yield coreExtensionData.reactElement(\n <ExtensionBoundary node={node} errorPresentation=\"error-api\">\n <LazyAction />\n </ExtensionBoundary>,\n );\n },\n});\n"],"names":["reactLazy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,MAAM,8BAA8B,wBAAA,CAAyB;AAAA,EAClE,IAAA,EAAM,sBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,+BAAA,EAAiC,OAAO,SAAA,EAAU;AAAA,EAClE,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,CAAC,OAAA,CAAQ,MAAA,EAAgD,EAAE,MAAK,EAAG;AACjE,IAAA,MAAM,UAAA,GAAaA,IAAA;AAAA,MAAU,MAC3B,MAAA,CAAO,MAAA,EAAO,CAAE,IAAA,CAAK,cAAY,EAAE,OAAA,EAAS,MAAM,OAAA,EAAQ,CAAE;AAAA,KAC9D;AACA,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,0BACrB,iBAAA,EAAA,EAAkB,IAAA,EAAY,mBAAkB,WAAA,EAC/C,QAAA,kBAAA,GAAA,CAAC,cAAW,CAAA,EACd;AAAA,KACF;AAAA,EACF;AACF,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PluginWrapperBlueprint.esm.js","sources":["../../src/blueprints/PluginWrapperBlueprint.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 { ComponentType, ReactNode } from 'react';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\n/**\n * Defines the structure of a plugin wrapper, optionally including a shared\n * hook value.\n *\n * @remarks\n *\n * When `useWrapperValue` is provided, the hook is called in a single location\n * in the app and the resulting value is forwarded as the `value` prop to the\n * component. The hook obeys the rules of React hooks and is not called until a\n * component from the plugin is rendered.\n *\n * @public\n */\nexport type PluginWrapperDefinition<TValue = unknown | never> = {\n /**\n * Creates a shared value that is forwarded as the `value` prop to the\n * component.\n *\n * @remarks\n *\n * This function obeys the rules of React hooks and is only invoked in a\n * single location in the app. Note that the hook will not be called until a\n * component from the plugin is rendered.\n */\n useWrapperValue?: () => TValue;\n component: ComponentType<{ children: ReactNode; value: TValue }>;\n};\n\nconst wrapperDataRef = createExtensionDataRef<\n () => Promise<PluginWrapperDefinition>\n>().with({ id: 'core.plugin-wrapper.loader' });\n\n/**\n * Creates extensions that wrap plugin extensions with providers.\n *\n * @public\n */\nexport const PluginWrapperBlueprint = createExtensionBlueprint({\n kind: 'plugin-wrapper',\n attachTo: { id: 'api:app/plugin-wrapper', input: 'wrappers' },\n output: [wrapperDataRef],\n dataRefs: {\n wrapper: wrapperDataRef,\n },\n defineParams<TValue = never>(params: {\n loader: () => Promise<PluginWrapperDefinition<TValue>>;\n }) {\n return createExtensionBlueprintParams(\n params as { loader: () => Promise<PluginWrapperDefinition> },\n );\n },\n *factory(params) {\n yield wrapperDataRef(params.loader);\n },\n});\n"],"names":[],"mappings":";;;;AAmDA,MAAM,iBAAiB,sBAAA,EAErB,CAAE,KAAK,EAAE,EAAA,EAAI,8BAA8B,CAAA;AAOtC,MAAM,yBAAyB,wBAAA,CAAyB;AAAA,EAC7D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,wBAAA,EAA0B,OAAO,UAAA,EAAW;AAAA,EAC5D,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,aAA6B,MAAA,EAE1B;AACD,IAAA,OAAO,8BAAA;AAAA,MACL;AAAA,KACF;AAAA,EACF,CAAA;AAAA,EACA,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,cAAA,CAAe,OAAO,MAAM,CAAA;AAAA,EACpC;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"PluginWrapperBlueprint.esm.js","sources":["../../src/blueprints/PluginWrapperBlueprint.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 { ComponentType, ReactNode } from 'react';\nimport {\n createExtensionBlueprint,\n createExtensionBlueprintParams,\n createExtensionDataRef,\n} from '../wiring';\n\n/**\n * Defines the structure of a plugin wrapper, optionally including a shared\n * hook value.\n *\n * @remarks\n *\n * When `useWrapperValue` is provided, the hook is called in a single location\n * in the app and the resulting value is forwarded as the `value` prop to the\n * component. The hook obeys the rules of React hooks and is not called until a\n * component from the plugin is rendered.\n *\n * @public\n */\nexport type PluginWrapperDefinition<TValue = unknown | never> = {\n /**\n * Creates a shared value that is forwarded as the `value` prop to the\n * component.\n *\n * @remarks\n *\n * This function obeys the rules of React hooks and is only invoked in a\n * single location in the app. Note that the hook will not be called until a\n * component from the plugin is rendered.\n */\n useWrapperValue?: () => TValue;\n component: ComponentType<{ children: ReactNode; value: TValue }>;\n};\n\nconst wrapperDataRef = createExtensionDataRef<\n () => Promise<PluginWrapperDefinition>\n>().with({ id: 'core.plugin-wrapper.loader' });\n\n/**\n * Creates extensions that wrap plugin extensions with providers.\n *\n * @public\n */\nexport const PluginWrapperBlueprint = createExtensionBlueprint({\n kind: 'plugin-wrapper',\n attachTo: { id: 'api:app/plugin-wrapper', input: 'wrappers' },\n output: [wrapperDataRef],\n dataRefs: {\n wrapper: wrapperDataRef,\n },\n defineParams<TValue = never>(params: {\n loader: () => Promise<PluginWrapperDefinition<TValue>>;\n }) {\n return createExtensionBlueprintParams(\n params as { loader: () => Promise<PluginWrapperDefinition> },\n );\n },\n *factory(params) {\n yield wrapperDataRef(params.loader);\n },\n});\n"],"names":[],"mappings":";;;;AAmDA,MAAM,iBAAiB,sBAAA,EAErB,CAAE,KAAK,EAAE,EAAA,EAAI,8BAA8B,CAAA;AAOtC,MAAM,yBAAyB,wBAAA,CAAyB;AAAA,EAC7D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,EAAE,EAAA,EAAI,wBAAA,EAA0B,OAAO,UAAA,EAAW;AAAA,EAC5D,MAAA,EAAQ,CAAC,cAAc,CAAA;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,GACX;AAAA,EACA,aAA6B,MAAA,EAE1B;AACD,IAAA,OAAO,8BAAA;AAAA,MACL;AAAA,KACF;AAAA,EACF,CAAA;AAAA,EACA,CAAC,QAAQ,MAAA,EAAQ;AACf,IAAA,MAAM,cAAA,CAAe,OAAO,MAAM,CAAA;AAAA,EACpC;AACF,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubPageBlueprint.esm.js","sources":["../../src/blueprints/SubPageBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\nimport { ExtensionBoundary } from '../components';\nimport { optionalStringSchema } from '../schema/optionalStringSchema';\n\n/**\n * Creates extensions that are sub-page React components attached to a parent page.\n * Sub-pages are rendered as tabs within the parent page's header.\n *\n * @public\n * @example\n * ```tsx\n * const overviewRouteRef = createRouteRef();\n *\n * const mySubPage = SubPageBlueprint.make({\n * attachTo: { id: 'page:my-plugin', input: 'pages' },\n * name: 'overview',\n * params: {\n * path: 'overview',\n * title: 'Overview',\n * routeRef: overviewRouteRef,\n * loader: () => import('./components/Overview').then(m => <m.Overview />),\n * },\n * });\n * ```\n */\nexport const SubPageBlueprint = createExtensionBlueprint({\n kind: 'sub-page',\n attachTo: { relative: { kind: 'page' }, input: 'pages' },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.title,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.icon.optional(),\n ],\n configSchema: {\n path: optionalStringSchema,\n title: optionalStringSchema,\n },\n *factory(\n params: {\n /**\n * The path for this sub-page, relative to the parent page. Must **not** start with '/'.\n *\n * @example 'overview', 'settings', 'details'\n */\n path: string;\n /**\n * The title displayed in the tab for this sub-page.\n */\n title: string;\n /**\n * Optional icon for this sub-page, displayed in the tab.\n */\n icon?: IconElement;\n /**\n * A function that returns a promise resolving to the React element to render.\n * This enables lazy loading of the sub-page content.\n */\n loader: () => Promise<JSX.Element>;\n /**\n * Optional route reference for this sub-page.\n */\n routeRef?: RouteRef;\n },\n { config, node },\n ) {\n yield coreExtensionData.routePath(config.path ?? params.path);\n yield coreExtensionData.title(config.title ?? params.title);\n yield coreExtensionData.reactElement(\n ExtensionBoundary.lazy(node, params.loader),\n );\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (params.icon) {\n yield coreExtensionData.icon(params.icon);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CO,MAAM,mBAAmB,wBAAA,CAAyB;AAAA,EACvD,IAAA,EAAM,UAAA;AAAA,EACN,QAAA,EAAU,EAAE,QAAA,EAAU,EAAE,MAAM,MAAA,EAAO,EAAG,OAAO,OAAA,EAAQ;AAAA,EACvD,MAAA,EAAQ;AAAA,IACN,iBAAA,CAAkB,SAAA;AAAA,IAClB,iBAAA,CAAkB,YAAA;AAAA,IAClB,iBAAA,CAAkB,KAAA;AAAA,IAClB,iBAAA,CAAkB,SAAS,QAAA,EAAS;AAAA,IACpC,iBAAA,CAAkB,KAAK,QAAA;AAAS,GAClC;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,IAAA,EAAM,oBAAA;AAAA,IACN,KAAA,EAAO;AAAA,GACT;AAAA,EACA,CAAC,OAAA,CACC,MAAA,EAyBA,EAAE,MAAA,EAAQ,MAAK,EACf;AACA,IAAA,MAAM,iBAAA,CAAkB,SAAA,CAAU,MAAA,CAAO,IAAA,IAAQ,OAAO,IAAI,CAAA;AAC5D,IAAA,MAAM,iBAAA,CAAkB,KAAA,CAAM,MAAA,CAAO,KAAA,IAAS,OAAO,KAAK,CAAA;AAC1D,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,MACtB,iBAAA,CAAkB,IAAA,CAAK,IAAA,EAAM,MAAA,CAAO,MAAM;AAAA,KAC5C;AACA,IAAA,IAAI,OAAO,QAAA,EAAU;AACnB,MAAA,MAAM,iBAAA,CAAkB,QAAA,CAAS,MAAA,CAAO,QAAQ,CAAA;AAAA,IAClD;AACA,IAAA,IAAI,OAAO,IAAA,EAAM;AACf,MAAA,MAAM,iBAAA,CAAkB,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA;AAAA,IAC1C;AAAA,EACF;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"SubPageBlueprint.esm.js","sources":["../../src/blueprints/SubPageBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { IconElement } from '../icons/types';\nimport { RouteRef } from '../routing';\nimport { coreExtensionData, createExtensionBlueprint } from '../wiring';\nimport { ExtensionBoundary } from '../components';\nimport { optionalStringSchema } from '../schema/optionalStringSchema';\n\n/**\n * Creates extensions that are sub-page React components attached to a parent page.\n * Sub-pages are rendered as tabs within the parent page's header.\n *\n * @public\n * @example\n * ```tsx\n * const overviewRouteRef = createRouteRef();\n *\n * const mySubPage = SubPageBlueprint.make({\n * attachTo: { id: 'page:my-plugin', input: 'pages' },\n * name: 'overview',\n * params: {\n * path: 'overview',\n * title: 'Overview',\n * routeRef: overviewRouteRef,\n * loader: () => import('./components/Overview').then(m => <m.Overview />),\n * },\n * });\n * ```\n */\nexport const SubPageBlueprint = createExtensionBlueprint({\n kind: 'sub-page',\n attachTo: { relative: { kind: 'page' }, input: 'pages' },\n output: [\n coreExtensionData.routePath,\n coreExtensionData.reactElement,\n coreExtensionData.title,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.icon.optional(),\n ],\n configSchema: {\n path: optionalStringSchema,\n title: optionalStringSchema,\n },\n *factory(\n params: {\n /**\n * The path for this sub-page, relative to the parent page. Must **not** start with '/'.\n *\n * @example 'overview', 'settings', 'details'\n */\n path: string;\n /**\n * The title displayed in the tab for this sub-page.\n */\n title: string;\n /**\n * Optional icon for this sub-page, displayed in the tab.\n */\n icon?: IconElement;\n /**\n * A function that returns a promise resolving to the React element to render.\n * This enables lazy loading of the sub-page content.\n */\n loader: () => Promise<JSX.Element>;\n /**\n * Optional route reference for this sub-page.\n */\n routeRef?: RouteRef;\n },\n { config, node },\n ) {\n yield coreExtensionData.routePath(config.path ?? params.path);\n yield coreExtensionData.title(config.title ?? params.title);\n yield coreExtensionData.reactElement(\n ExtensionBoundary.lazy(node, params.loader),\n );\n if (params.routeRef) {\n yield coreExtensionData.routeRef(params.routeRef);\n }\n if (params.icon) {\n yield coreExtensionData.icon(params.icon);\n }\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CO,MAAM,mBAAmB,wBAAA,CAAyB;AAAA,EACvD,IAAA,EAAM,UAAA;AAAA,EACN,QAAA,EAAU,EAAE,QAAA,EAAU,EAAE,MAAM,MAAA,EAAO,EAAG,OAAO,OAAA,EAAQ;AAAA,EACvD,MAAA,EAAQ;AAAA,IACN,iBAAA,CAAkB,SAAA;AAAA,IAClB,iBAAA,CAAkB,YAAA;AAAA,IAClB,iBAAA,CAAkB,KAAA;AAAA,IAClB,iBAAA,CAAkB,SAAS,QAAA,EAAS;AAAA,IACpC,iBAAA,CAAkB,KAAK,QAAA;AAAS,GAClC;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,IAAA,EAAM,oBAAA;AAAA,IACN,KAAA,EAAO;AAAA,GACT;AAAA,EACA,CAAC,OAAA,CACC,MAAA,EAyBA,EAAE,MAAA,EAAQ,MAAK,EACf;AACA,IAAA,MAAM,iBAAA,CAAkB,SAAA,CAAU,MAAA,CAAO,IAAA,IAAQ,OAAO,IAAI,CAAA;AAC5D,IAAA,MAAM,iBAAA,CAAkB,KAAA,CAAM,MAAA,CAAO,KAAA,IAAS,OAAO,KAAK,CAAA;AAC1D,IAAA,MAAM,iBAAA,CAAkB,YAAA;AAAA,MACtB,iBAAA,CAAkB,IAAA,CAAK,IAAA,EAAM,MAAA,CAAO,MAAM;AAAA,KAC5C;AACA,IAAA,IAAI,OAAO,QAAA,EAAU;AACnB,MAAA,MAAM,iBAAA,CAAkB,QAAA,CAAS,MAAA,CAAO,QAAQ,CAAA;AAAA,IAClD;AACA,IAAA,IAAI,OAAO,IAAA,EAAM;AACf,MAAA,MAAM,iBAAA,CAAkB,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA;AAAA,IAC1C;AAAA,EACF;AACF,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useBreadcrumbEntries.esm.js","sources":["../../src/breadcrumbs/useBreadcrumbEntries.tsx"],"sourcesContent":["/*\n * Copyright 2026 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, useMemo, useRef, type ReactNode } from 'react';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport type { BreadcrumbEntryData } from './types';\n\ninterface Registration {\n update(label: string, href: string): void;\n unregister(): void;\n}\n\ninterface BreadcrumbsContextValue {\n breadcrumbs: { items: BreadcrumbEntryData[] };\n register: (entry: BreadcrumbEntryData) => Registration;\n}\n\n// This key must match the one used by BreadcrumbsRegistryProvider in @backstage/plugin-app.\nconst CONTEXT_KEY = 'breadcrumbs-context';\nconst DEPTH_KEY = 'breadcrumbs-depth';\n\ntype ContextMap = { 1: BreadcrumbsContextValue };\ntype DepthMap = { 1: number };\n\nconst DepthContext = createVersionedContext<DepthMap>(DEPTH_KEY);\n\nconst EMPTY: { items: BreadcrumbEntryData[] } = { items: [] };\n\n/**\n * Returns the current breadcrumb entries registered by page components anywhere\n * in the tree. Call this in components that render breadcrumbs (e.g. PluginHeader).\n *\n * @public\n */\nexport function useBreadcrumbEntries(): { items: BreadcrumbEntryData[] } {\n const ctx = useVersionedContext<ContextMap>(CONTEXT_KEY);\n return ctx?.atVersion(1)?.breadcrumbs ?? EMPTY;\n}\n\n/**\n * Registers a breadcrumb entry for the current page. The entry is added on\n * mount and removed on unmount. Wraps its children and increments the depth\n * counter so nested registrations are ordered correctly.\n *\n * @public\n */\nexport function BreadcrumbEntry(props: {\n entry: Omit<BreadcrumbEntryData, 'depth'>;\n children: ReactNode;\n}) {\n const ctx = useVersionedContext<ContextMap>(CONTEXT_KEY);\n const register = ctx?.atVersion(1)?.register;\n const depthCtx = useVersionedContext<DepthMap>(DEPTH_KEY);\n const depth = depthCtx?.atVersion(1) ?? 0;\n const { label, href } = props.entry;\n const registrationRef = useRef<Registration | null>(null);\n\n useEffect(() => {\n if (!register) return undefined;\n const reg = register({ label, href, depth });\n registrationRef.current = reg;\n return () => {\n reg.unregister();\n registrationRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [register, depth]);\n\n useEffect(() => {\n registrationRef.current?.update(label, href);\n }, [label, href]);\n\n const depthValue = useMemo(\n () => createVersionedValueMap({ 1: depth + 1 }),\n [depth],\n );\n\n return (\n <DepthContext.Provider value={depthValue}>\n {props.children}\n </DepthContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;;AAmCA,MAAM,WAAA,GAAc,qBAAA;AACpB,MAAM,SAAA,GAAY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hB,EAAA,MAAM,UAAA,GAAa,OAAA;AAAA,IACjB,MAAM,uBAAA,CAAwB,EAAE,CAAA,EAAG,KAAA,GAAQ,GAAG,CAAA;AAAA,IAC9C,CAAC,KAAK;AAAA,GACR;AAEA,EAAA,2BACG,YAAA,CAAa,QAAA,EAAb,EAAsB,KAAA,EAAO,UAAA,EAC3B,gBAAM,QAAA,EACT,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"useBreadcrumbEntries.esm.js","sources":["../../src/breadcrumbs/useBreadcrumbEntries.tsx"],"sourcesContent":["/*\n * Copyright 2026 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, useMemo, useRef, type ReactNode } from 'react';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport type { BreadcrumbEntryData } from './types';\n\ninterface Registration {\n update(label: string, href: string): void;\n unregister(): void;\n}\n\ninterface BreadcrumbsContextValue {\n breadcrumbs: { items: BreadcrumbEntryData[] };\n register: (entry: BreadcrumbEntryData) => Registration;\n}\n\n// This key must match the one used by BreadcrumbsRegistryProvider in @backstage/plugin-app.\nconst CONTEXT_KEY = 'breadcrumbs-context';\nconst DEPTH_KEY = 'breadcrumbs-depth';\n\ntype ContextMap = { 1: BreadcrumbsContextValue };\ntype DepthMap = { 1: number };\n\nconst DepthContext = createVersionedContext<DepthMap>(DEPTH_KEY);\n\nconst EMPTY: { items: BreadcrumbEntryData[] } = { items: [] };\n\n/**\n * Returns the current breadcrumb entries registered by page components anywhere\n * in the tree. Call this in components that render breadcrumbs (e.g. PluginHeader).\n *\n * @public\n */\nexport function useBreadcrumbEntries(): { items: BreadcrumbEntryData[] } {\n const ctx = useVersionedContext<ContextMap>(CONTEXT_KEY);\n return ctx?.atVersion(1)?.breadcrumbs ?? EMPTY;\n}\n\n/**\n * Registers a breadcrumb entry for the current page. The entry is added on\n * mount and removed on unmount. Wraps its children and increments the depth\n * counter so nested registrations are ordered correctly.\n *\n * @public\n */\nexport function BreadcrumbEntry(props: {\n entry: Omit<BreadcrumbEntryData, 'depth'>;\n children: ReactNode;\n}) {\n const ctx = useVersionedContext<ContextMap>(CONTEXT_KEY);\n const register = ctx?.atVersion(1)?.register;\n const depthCtx = useVersionedContext<DepthMap>(DEPTH_KEY);\n const depth = depthCtx?.atVersion(1) ?? 0;\n const { label, href } = props.entry;\n const registrationRef = useRef<Registration | null>(null);\n\n useEffect(() => {\n if (!register) return undefined;\n const reg = register({ label, href, depth });\n registrationRef.current = reg;\n return () => {\n reg.unregister();\n registrationRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [register, depth]);\n\n useEffect(() => {\n registrationRef.current?.update(label, href);\n }, [label, href]);\n\n const depthValue = useMemo(\n () => createVersionedValueMap({ 1: depth + 1 }),\n [depth],\n );\n\n return (\n <DepthContext.Provider value={depthValue}>\n {props.children}\n </DepthContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;;AAmCA,MAAM,WAAA,GAAc,qBAAA;AACpB,MAAM,SAAA,GAAY,mBAAA;AAKlB,MAAM,YAAA,GAAe,uBAAiC,SAAS,CAAA;AAE/D,MAAM,KAAA,GAA0C,EAAE,KAAA,EAAO,EAAC,EAAE;AAQrD,SAAS,oBAAA,GAAyD;AACvE,EAAA,MAAM,GAAA,GAAM,oBAAgC,WAAW,CAAA;AACvD,EAAA,OAAO,GAAA,EAAK,SAAA,CAAU,CAAC,CAAA,EAAG,WAAA,IAAe,KAAA;AAC3C;AASO,SAAS,gBAAgB,KAAA,EAG7B;AACD,EAAA,MAAM,GAAA,GAAM,oBAAgC,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*\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 {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport type { AppNode } from '../apis/definitions/AppTreeApi';\nimport { ReactNode } from 'react';\n\nconst CONTEXT_KEY = 'app-node-context';\n\ntype AppNodeContextV1 = {\n node?: AppNode;\n};\n\ntype AppNodeContextMap = {\n 1: AppNodeContextV1;\n};\n\nconst AppNodeContext = createVersionedContext<AppNodeContextMap>(CONTEXT_KEY);\n\n/** @internal */\nexport function AppNodeProvider({\n node,\n children,\n}: {\n node: AppNode;\n children: ReactNode;\n}) {\n const versionedValue = createVersionedValueMap({ 1: { node } });\n\n return <AppNodeContext.Provider value={versionedValue} children={children} />;\n}\n\n/**\n * React hook providing access to the current {@link AppNode}.\n *\n * @public\n * @remarks\n *\n * This hook will return the {@link AppNode} for the closest extension. This\n * relies on the extension using the {@link (ExtensionBoundary:function)} component in its\n * implementation, which is included by default for all common blueprints.\n *\n * If the current component is not inside an {@link (ExtensionBoundary:function)}, it will\n * return `undefined`.\n */\nexport function useAppNode(): AppNode | undefined {\n const versionedContext = useVersionedContext<AppNodeContextMap>(CONTEXT_KEY);\n if (!versionedContext) {\n return undefined;\n }\n\n const context = versionedContext.atVersion(1);\n if (!context) {\n throw new Error('AppNodeContext v1 not available');\n }\n return context.node;\n}\n"],"names":[],"mappings":";;;AAwBA,MAAM,WAAA,GAAc,kBAAA;AAUpB,MAAM,cAAA,GAAiB,uBAA0C,WAAW,CAAA;AAGrE,SAAS,eAAA,CAAgB;AAAA,EAC9B,IAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,MAAM,iBAAiB,uBAAA,CAAwB,EAAE,GAAG,EAAE,IAAA,IAAQ,CAAA;AAE9D,EAAA,2BAAQ,cAAA,CAAe,QAAA,EAAf,EAAwB,KAAA,EAAO,gBAAgB,QAAA,EAAoB,CAAA;AAC7E;AAeO,SAAS,UAAA,GAAkC;AAChD,EAAA,MAAM,gBAAA,GAAmB,oBAAuC,WAAW,CAAA;AAC3E,EAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAA,GAAU,gBAAA,CAAiB,SAAA,CAAU,CAAC,CAAA;AAC5C,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,MAAM,iCAAiC,CAAA;AAAA,EACnD;AACA,EAAA,OAAO,OAAA,CAAQ,IAAA;AACjB;;;;"}
1
+ {"version":3,"file":"AppNodeProvider.esm.js","sources":["../../src/components/AppNodeProvider.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 {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport type { AppNode } from '../apis/definitions/AppTreeApi';\nimport { ReactNode } from 'react';\n\nconst CONTEXT_KEY = 'app-node-context';\n\ntype AppNodeContextV1 = {\n node?: AppNode;\n};\n\ntype AppNodeContextMap = {\n 1: AppNodeContextV1;\n};\n\nconst AppNodeContext = createVersionedContext<AppNodeContextMap>(CONTEXT_KEY);\n\n/** @internal */\nexport function AppNodeProvider({\n node,\n children,\n}: {\n node: AppNode;\n children: ReactNode;\n}) {\n const versionedValue = createVersionedValueMap({ 1: { node } });\n\n return <AppNodeContext.Provider value={versionedValue} children={children} />;\n}\n\n/**\n * React hook providing access to the current {@link AppNode}.\n *\n * @public\n * @remarks\n *\n * This hook will return the {@link AppNode} for the closest extension. This\n * relies on the extension using the {@link (ExtensionBoundary:function)} component in its\n * implementation, which is included by default for all common blueprints.\n *\n * If the current component is not inside an {@link (ExtensionBoundary:function)}, it will\n * return `undefined`.\n */\nexport function useAppNode(): AppNode | undefined {\n const versionedContext = useVersionedContext<AppNodeContextMap>(CONTEXT_KEY);\n if (!versionedContext) {\n return undefined;\n }\n\n const context = versionedContext.atVersion(1);\n if (!context) {\n throw new Error('AppNodeContext v1 not available');\n }\n return context.node;\n}\n"],"names":[],"mappings":";;;AAwBA,MAAM,WAAA,GAAc,kBAAA;AAUpB,MAAM,cAAA,GAAiB,uBAA0C,WAAW,CAAA;AAGrE,SAAS,eAAA,CAAgB;AAAA,EAC9B,IAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,MAAM,iBAAiB,uBAAA,CAAwB,EAAE,GAAG,EAAE,IAAA,IAAQ,CAAA;AAE9D,EAAA,2BAAQ,cAAA,CAAe,QAAA,EAAf,EAAwB,KAAA,EAAO,gBAAgB,QAAA,EAAoB,CAAA;AAC7E;AAeO,SAAS,UAAA,GAAkC;AAChD,EAAA,MAAM,gBAAA,GAAmB,oBAAuC,WAAW,CAAA;AAC3E,EAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAA,GAAU,gBAAA,CAAiB,SAAA,CAAU,CAAC,CAAA;AAC5C,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,MAAM,iCAAiC,CAAA;AAAA,EACnD;AACA,EAAA,OAAO,OAAA,CAAQ,IAAA;AACjB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultSwappableComponents.esm.js","sources":["../../src/components/DefaultSwappableComponents.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 {\n ErrorDisplayProps,\n NotFoundErrorPageProps,\n ProgressProps,\n} from '../types';\nimport { createSwappableComponent } from './createSwappableComponent';\n\n/**\n * @public\n */\nexport const Progress = createSwappableComponent<ProgressProps>({\n id: 'core-progress',\n});\n\n/**\n * @public\n */\nexport const NotFoundErrorPage =\n createSwappableComponent<NotFoundErrorPageProps>({\n id: 'core-not-found-error-page',\n });\n\n/**\n * @public\n */\nexport const ErrorDisplay = createSwappableComponent<ErrorDisplayProps>({\n id: 'core-error-display',\n loader: () => props =>\n <div data-testid=\"core-error-display\">{props.error.message}</div>,\n});\n"],"names":[],"mappings":";;;AA0BO,MAAM,WAAW,wBAAA,CAAwC;AAAA,EAC9D,EAAA,EAAI;AACN,CAAC;AAKM,MAAM,oBACX,wBAAA,CAAiD;AAAA,EAC/C,EAAA,EAAI;AACN,CAAC;AAKI,MAAM,eAAe,wBAAA,CAA4C;AAAA,EACtE,EAAA,EAAI,oBAAA;AAAA,EACJ,MAAA,EAAQ,MAAM,CAAA,KAAA,qBACZ,GAAA,CAAC,SAAI,aAAA,EAAY,oBAAA,EAAsB,QAAA,EAAA,KAAA,CAAM,KAAA,CAAM,OAAA,EAAQ;AAC/D,CAAC;;;;"}
1
+ {"version":3,"file":"DefaultSwappableComponents.esm.js","sources":["../../src/components/DefaultSwappableComponents.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 {\n ErrorDisplayProps,\n NotFoundErrorPageProps,\n ProgressProps,\n} from '../types';\nimport { createSwappableComponent } from './createSwappableComponent';\n\n/**\n * @public\n */\nexport const Progress = createSwappableComponent<ProgressProps>({\n id: 'core-progress',\n});\n\n/**\n * @public\n */\nexport const NotFoundErrorPage =\n createSwappableComponent<NotFoundErrorPageProps>({\n id: 'core-not-found-error-page',\n });\n\n/**\n * @public\n */\nexport const ErrorDisplay = createSwappableComponent<ErrorDisplayProps>({\n id: 'core-error-display',\n loader: () => props =>\n <div data-testid=\"core-error-display\">{props.error.message}</div>,\n});\n"],"names":[],"mappings":";;;AA0BO,MAAM,WAAW,wBAAA,CAAwC;AAAA,EAC9D,EAAA,EAAI;AACN,CAAC;AAKM,MAAM,oBACX,wBAAA,CAAiD;AAAA,EAC/C,EAAA,EAAI;AACN,CAAC;AAKI,MAAM,eAAe,wBAAA,CAA4C;AAAA,EACtE,EAAA,EAAI,oBAAA;AAAA,EACJ,MAAA,EAAQ,MAAM,CAAA,KAAA,qBACZ,GAAA,CAAC,SAAI,aAAA,EAAY,oBAAA,EAAsB,QAAA,EAAA,KAAA,CAAM,KAAA,CAAM,OAAA,EAAQ;AAC/D,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorApiBoundary.esm.js","sources":["../../src/components/ErrorApiBoundary.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 { Component, ErrorInfo, ReactNode } from 'react';\nimport { AppNode, ErrorApi } from '../apis';\nimport { ForwardedError } from '@backstage/errors';\n\n/** @internal */\nexport class ErrorApiBoundary extends Component<\n {\n children: ReactNode;\n node: AppNode;\n errorApi?: ErrorApi;\n },\n { error?: Error }\n> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state = { error: undefined };\n\n componentDidCatch(error: Error, _errorInfo: ErrorInfo) {\n const { node, errorApi } = this.props;\n errorApi?.post(\n new ForwardedError(`Error in extension '${node.spec.id}'`, error),\n );\n }\n\n render() {\n if (this.state.error) {\n return null;\n }\n\n return this.props.children;\n }\n}\n"],"names":[],"mappings":";;;AAqBO,MAAM,yBAAyB,SAAA,CAOpC;AAAA,EACA,OAAO,yBAAyB,KAAA,EAAc;AAC5C,IAAA,OAAO,EAAE,KAAA,EAAM;AAAA,EACjB;AAAA,EAEA,KAAA,GAAQ,EAAE,KAAA,EAAO,MAAA,EAAU;AAAA,EAE3B,iBAAA,CAAkB,OAAc,UAAA,EAAuB;AACrD,IAAA,MAAM,EAAE,IAAA,EAAM,QAAA,EAAS,GAAI,IAAA,CAAK,KAAA;AAChC,IAAA,QAAA,EAAU,IAAA;AAAA,MACR,IAAI,cAAA,CAAe,CAAA,oBAAA,EAAuB,KAAK,IAAA,CAAK,EAAE,KAAK,KAAK;AAAA,KAClE;AAAA,EACF;AAAA,EAEA,MAAA,GAAS;AACP,IAAA,IAAI,IAAA,CAAK,MAAM,KAAA,EAAO;AACpB,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,OAAO,KAAK,KAAA,CAAM,QAAA;AAAA,EACpB;AACF;;;;"}
1
+ {"version":3,"file":"ErrorApiBoundary.esm.js","sources":["../../src/components/ErrorApiBoundary.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 { Component, ErrorInfo, ReactNode } from 'react';\nimport { AppNode, ErrorApi } from '../apis';\nimport { ForwardedError } from '@backstage/errors';\n\n/** @internal */\nexport class ErrorApiBoundary extends Component<\n {\n children: ReactNode;\n node: AppNode;\n errorApi?: ErrorApi;\n },\n { error?: Error }\n> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state = { error: undefined };\n\n componentDidCatch(error: Error, _errorInfo: ErrorInfo) {\n const { node, errorApi } = this.props;\n errorApi?.post(\n new ForwardedError(`Error in extension '${node.spec.id}'`, error),\n );\n }\n\n render() {\n if (this.state.error) {\n return null;\n }\n\n return this.props.children;\n }\n}\n"],"names":[],"mappings":";;;AAqBO,MAAM,yBAAyB,SAAA,CAOpC;AAAA,EACA,OAAO,yBAAyB,KAAA,EAAc;AAC5C,IAAA,OAAO,EAAE,KAAA,EAAM;AAAA,EACjB;AAAA,EAEA,KAAA,GAAQ,EAAE,KAAA,EAAO,MAAA,EAAU;AAAA,EAE3B,iBAAA,CAAkB,OAAc,UAAA,EAAuB;AACrD,IAAA,MAAM,EAAE,IAAA,EAAM,QAAA,EAAS,GAAI,IAAA,CAAK,KAAA;AAChC,IAAA,QAAA,EAAU,IAAA;AAAA,MACR,IAAI,cAAA,CAAe,CAAA,oBAAA,EAAuB,KAAK,IAAA,CAAK,EAAE,KAAK,KAAK;AAAA,KAClE;AAAA,EACF;AAAA,EAEA,MAAA,GAAS;AACP,IAAA,IAAI,IAAA,CAAK,MAAM,KAAA,EAAO;AACpB,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,OAAO,KAAK,KAAA,CAAM,QAAA;AAAA,EACpB;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorDisplayBoundary.esm.js","sources":["../../src/components/ErrorDisplayBoundary.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 { Component, ReactNode } from 'react';\nimport { FrontendPlugin } from '../wiring';\nimport { ErrorDisplay } from './DefaultSwappableComponents';\n\n/** @internal */\nexport class ErrorDisplayBoundary extends Component<\n {\n children: ReactNode;\n plugin: FrontendPlugin;\n },\n { error?: Error }\n> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state = { error: undefined };\n\n handleErrorReset = () => {\n this.setState({ error: undefined });\n };\n\n render() {\n const { error } = this.state;\n const { plugin, children } = this.props;\n\n if (error) {\n return (\n <ErrorDisplay\n // todo: do we want to just use useAppNode hook in the ErrorDisplay instead?\n plugin={plugin}\n error={error}\n // todo: probably change this to onResetError\n resetError={this.handleErrorReset}\n />\n );\n }\n\n return children;\n }\n}\n"],"names":[],"mappings":";;;;AAqBO,MAAM,6BAA6B,SAAA,CAMxC;AAAA,EACA,OAAO,yBAAyB,KAAA,EAAc;AAC5C,IAAA,OAAO,EAAE,KAAA,EAAM;AAAA,EACjB;AAAA,EAEA,KAAA,GAAQ,EAAE,KAAA,EAAO,MAAA,EAAU;AAAA,EAE3B,mBAAmB,MAAM;AACvB,IAAA,IAAA,CAAK,QAAA,CAAS,EAAE,KAAA,EAAO,MAAA,EAAW,CAAA;AAAA,EACpC,CAAA;AAAA,EAEA,MAAA,GAAS;AACP,IAAA,MAAM,EAAE,KAAA,EAAM,GAAI,IAAA,CAAK,KAAA;AACvB,IAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,EAAS,GAAI,IAAA,CAAK,KAAA;AAElC,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,uBACE,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UAEC,MAAA;AAAA,UACA,KAAA;AAAA,UAEA,YAAY,IAAA,CAAK;AAAA;AAAA,OACnB;AAAA,IAEJ;AAEA,IAAA,OAAO,QAAA;AAAA,EACT;AACF;;;;"}
1
+ {"version":3,"file":"ErrorDisplayBoundary.esm.js","sources":["../../src/components/ErrorDisplayBoundary.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 { Component, ReactNode } from 'react';\nimport { FrontendPlugin } from '../wiring';\nimport { ErrorDisplay } from './DefaultSwappableComponents';\n\n/** @internal */\nexport class ErrorDisplayBoundary extends Component<\n {\n children: ReactNode;\n plugin: FrontendPlugin;\n },\n { error?: Error }\n> {\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n state = { error: undefined };\n\n handleErrorReset = () => {\n this.setState({ error: undefined });\n };\n\n render() {\n const { error } = this.state;\n const { plugin, children } = this.props;\n\n if (error) {\n return (\n <ErrorDisplay\n // todo: do we want to just use useAppNode hook in the ErrorDisplay instead?\n plugin={plugin}\n error={error}\n // todo: probably change this to onResetError\n resetError={this.handleErrorReset}\n />\n );\n }\n\n return children;\n }\n}\n"],"names":[],"mappings":";;;;AAqBO,MAAM,6BAA6B,SAAA,CAMxC;AAAA,EACA,OAAO,yBAAyB,KAAA,EAAc;AAC5C,IAAA,OAAO,EAAE,KAAA,EAAM;AAAA,EACjB;AAAA,EAEA,KAAA,GAAQ,EAAE,KAAA,EAAO,MAAA,EAAU;AAAA,EAE3B,mBAAmB,MAAM;AACvB,IAAA,IAAA,CAAK,QAAA,CAAS,EAAE,KAAA,EAAO,MAAA,EAAW,CAAA;AAAA,EACpC,CAAA;AAAA,EAEA,MAAA,GAAS;AACP,IAAA,MAAM,EAAE,KAAA,EAAM,GAAI,IAAA,CAAK,KAAA;AACvB,IAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,EAAS,GAAI,IAAA,CAAK,KAAA;AAElC,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,uBACE,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UAEC,MAAA;AAAA,UACA,KAAA;AAAA,UAEA,YAAY,IAAA,CAAK;AAAA;AAAA,OACnB;AAAA,IAEJ;AAEA,IAAA,OAAO,QAAA;AAAA,EACT;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExtensionBoundary.esm.js","sources":["../../src/components/ExtensionBoundary.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 PropsWithChildren,\n ReactNode,\n Suspense,\n useEffect,\n useMemo,\n lazy as reactLazy,\n} from 'react';\nimport { AnalyticsContext, useAnalytics } from '../analytics';\nimport { ErrorDisplayBoundary } from './ErrorDisplayBoundary';\nimport { ErrorApiBoundary } from './ErrorApiBoundary';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { routableExtensionRenderedEvent } from '../../../core-plugin-api/src/analytics/Tracker';\nimport { ErrorApi, errorApiRef, useApi } from '../apis';\nimport type { AppNode } from '../apis/definitions/AppTreeApi';\nimport {\n PluginWrapperApi,\n pluginWrapperApiRef,\n} from '../apis/definitions/PluginWrapperApi';\nimport { coreExtensionData } from '../wiring';\nimport { AppNodeProvider } from './AppNodeProvider';\nimport { Progress } from './DefaultSwappableComponents';\n\nfunction useOptionalErrorApi(): ErrorApi | undefined {\n try {\n return useApi(errorApiRef);\n } catch {\n return undefined;\n }\n}\n\nfunction useOptionalPluginWrapperApi(): PluginWrapperApi | undefined {\n try {\n return useApi(pluginWrapperApiRef);\n } catch {\n return undefined;\n }\n}\ntype RouteTrackerProps = PropsWithChildren<{\n enabled?: boolean;\n}>;\n\nconst RouteTracker = (props: RouteTrackerProps) => {\n const { enabled, children } = props;\n const analytics = useAnalytics();\n\n // This event, never exposed to end-users of the analytics API,\n // helps inform which extension metadata gets associated with a\n // navigation event when the route navigated to is a gathered\n // mountpoint.\n useEffect(() => {\n if (enabled) {\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }\n }, [analytics, enabled]);\n\n return <>{children}</>;\n};\n\n/** @public */\nexport interface ExtensionBoundaryProps {\n errorPresentation?: 'error-api' | 'error-display';\n node: AppNode;\n children: ReactNode;\n}\n\n/** @public */\nexport function ExtensionBoundary(props: ExtensionBoundaryProps) {\n const { node, children } = props;\n\n const errorApi = useOptionalErrorApi();\n\n const hasRoutePathOutput = Boolean(\n node.instance?.getData(coreExtensionData.routePath),\n );\n\n const plugin = node.spec.plugin;\n const pluginId = plugin.pluginId ?? 'app';\n\n const pluginWrapperApi = useOptionalPluginWrapperApi();\n\n const PluginWrapper = useMemo(() => {\n return pluginWrapperApi?.getPluginWrapper(pluginId);\n }, [pluginWrapperApi, pluginId]);\n\n // Skipping \"routeRef\" attribute in the new system, the extension \"id\" should provide more insight\n const attributes = {\n extensionId: node.spec.id,\n pluginId,\n };\n\n let content = (\n <AnalyticsContext attributes={attributes}>\n <RouteTracker enabled={hasRoutePathOutput}>{children}</RouteTracker>\n </AnalyticsContext>\n );\n\n if (PluginWrapper) {\n content = <PluginWrapper>{content}</PluginWrapper>;\n }\n\n if (props.errorPresentation === 'error-api') {\n content = (\n <ErrorApiBoundary node={node} errorApi={errorApi}>\n {content}\n </ErrorApiBoundary>\n );\n } else {\n content = (\n <ErrorDisplayBoundary plugin={plugin}>{content}</ErrorDisplayBoundary>\n );\n }\n\n return (\n <AppNodeProvider node={node}>\n <Suspense fallback={<Progress />}>{content}</Suspense>\n </AppNodeProvider>\n );\n}\n\n/** @public */\nexport namespace ExtensionBoundary {\n export function lazy(\n appNode: AppNode,\n loader: () => Promise<JSX.Element>,\n ): JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(element => ({ default: () => element })),\n );\n return (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent />\n </ExtensionBoundary>\n );\n }\n\n export function lazyComponent<TProps extends {}>(\n appNode: AppNode,\n loader: () => Promise<(props: TProps) => JSX.Element>,\n ): (props: TProps) => JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(Component => ({ default: Component })),\n ) as unknown as React.ComponentType<TProps>;\n\n return (props: TProps) => (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n );\n }\n}\n"],"names":["ExtensionBoundary","lazy","reactLazy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,mBAAA,GAA4C;AACnD,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,WAAW,CAAA;AAAA,EAC3B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,SAAS,2BAAA,GAA4D;AACnE,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,mBAAmB,CAAA;AAAA,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CAAC,KAAA,qBACN,GAAA,CAACF,kBAAAA,EAAA,EAAkB,IAAA,EAAM,OAAA,EACvB,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA,EACjC,CAAA;AAAA,EAEJ;AAbO,EAAAA,kBAAAA,CAAS,aAAA,GAAA,aAAA;AAAA,CAAA,EAfD,iBAAA,KAAA,iBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"ExtensionBoundary.esm.js","sources":["../../src/components/ExtensionBoundary.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 PropsWithChildren,\n ReactNode,\n Suspense,\n useEffect,\n useMemo,\n lazy as reactLazy,\n} from 'react';\nimport { AnalyticsContext, useAnalytics } from '../analytics';\nimport { ErrorDisplayBoundary } from './ErrorDisplayBoundary';\nimport { ErrorApiBoundary } from './ErrorApiBoundary';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { routableExtensionRenderedEvent } from '../../../core-plugin-api/src/analytics/Tracker';\nimport { ErrorApi, errorApiRef, useApi } from '../apis';\nimport type { AppNode } from '../apis/definitions/AppTreeApi';\nimport {\n PluginWrapperApi,\n pluginWrapperApiRef,\n} from '../apis/definitions/PluginWrapperApi';\nimport { coreExtensionData } from '../wiring';\nimport { AppNodeProvider } from './AppNodeProvider';\nimport { Progress } from './DefaultSwappableComponents';\n\nfunction useOptionalErrorApi(): ErrorApi | undefined {\n try {\n return useApi(errorApiRef);\n } catch {\n return undefined;\n }\n}\n\nfunction useOptionalPluginWrapperApi(): PluginWrapperApi | undefined {\n try {\n return useApi(pluginWrapperApiRef);\n } catch {\n return undefined;\n }\n}\ntype RouteTrackerProps = PropsWithChildren<{\n enabled?: boolean;\n}>;\n\nconst RouteTracker = (props: RouteTrackerProps) => {\n const { enabled, children } = props;\n const analytics = useAnalytics();\n\n // This event, never exposed to end-users of the analytics API,\n // helps inform which extension metadata gets associated with a\n // navigation event when the route navigated to is a gathered\n // mountpoint.\n useEffect(() => {\n if (enabled) {\n analytics.captureEvent(routableExtensionRenderedEvent, '');\n }\n }, [analytics, enabled]);\n\n return <>{children}</>;\n};\n\n/** @public */\nexport interface ExtensionBoundaryProps {\n errorPresentation?: 'error-api' | 'error-display';\n node: AppNode;\n children: ReactNode;\n}\n\n/** @public */\nexport function ExtensionBoundary(props: ExtensionBoundaryProps) {\n const { node, children } = props;\n\n const errorApi = useOptionalErrorApi();\n\n const hasRoutePathOutput = Boolean(\n node.instance?.getData(coreExtensionData.routePath),\n );\n\n const plugin = node.spec.plugin;\n const pluginId = plugin.pluginId ?? 'app';\n\n const pluginWrapperApi = useOptionalPluginWrapperApi();\n\n const PluginWrapper = useMemo(() => {\n return pluginWrapperApi?.getPluginWrapper(pluginId);\n }, [pluginWrapperApi, pluginId]);\n\n // Skipping \"routeRef\" attribute in the new system, the extension \"id\" should provide more insight\n const attributes = {\n extensionId: node.spec.id,\n pluginId,\n };\n\n let content = (\n <AnalyticsContext attributes={attributes}>\n <RouteTracker enabled={hasRoutePathOutput}>{children}</RouteTracker>\n </AnalyticsContext>\n );\n\n if (PluginWrapper) {\n content = <PluginWrapper>{content}</PluginWrapper>;\n }\n\n if (props.errorPresentation === 'error-api') {\n content = (\n <ErrorApiBoundary node={node} errorApi={errorApi}>\n {content}\n </ErrorApiBoundary>\n );\n } else {\n content = (\n <ErrorDisplayBoundary plugin={plugin}>{content}</ErrorDisplayBoundary>\n );\n }\n\n return (\n <AppNodeProvider node={node}>\n <Suspense fallback={<Progress />}>{content}</Suspense>\n </AppNodeProvider>\n );\n}\n\n/** @public */\nexport namespace ExtensionBoundary {\n export function lazy(\n appNode: AppNode,\n loader: () => Promise<JSX.Element>,\n ): JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(element => ({ default: () => element })),\n );\n return (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent />\n </ExtensionBoundary>\n );\n }\n\n export function lazyComponent<TProps extends {}>(\n appNode: AppNode,\n loader: () => Promise<(props: TProps) => JSX.Element>,\n ): (props: TProps) => JSX.Element {\n const ExtensionComponent = reactLazy(() =>\n loader().then(Component => ({ default: Component })),\n ) as unknown as React.ComponentType<TProps>;\n\n return (props: TProps) => (\n <ExtensionBoundary node={appNode}>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n );\n }\n}\n"],"names":["ExtensionBoundary","lazy","reactLazy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,mBAAA,GAA4C;AACnD,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,WAAW,CAAA;AAAA,EAC3B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,SAAS,2BAAA,GAA4D;AACnE,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,mBAAmB,CAAA;AAAA,EACnC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAKA,MAAM,YAAA,GAAe,CAAC,KAAA,KAA6B;AACjD,EAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAS,GAAI,KAAA;AAC9B,EAAA,MAAM,YAAY,YAAA,EAAa;AAM/B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,SAAA,CAAU,YAAA,CAAa,gCAAgC,EAAE,CAAA;AAAA,IAC3D;AAAA,EACF,CAAA,EAAG,CAAC,SAAA,EAAW,OAAO,CAAC,CAAA;AAEvB,EAAA,uCAAU,QAAA,EAAS,C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AAA;AAAA,EAEnD;AAEA,EAAA,uBACE,GAAA,CAAC,eAAA,EAAA,EAAgB,IAAA,EACf,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,0BAAU,GAAA,CAAC,QAAA,EAAA,EAAS,CAAA,EAAK,QAAA,EAAA,OAAA,EAAQ,CAAA,EAC7C,CAAA;AAEJ;AAAA,CAGO,CAAUA,kBAAAA,KAAV;AACE,EAAA,SAASC,MAAA,CACd,SACA,MAAA,EACa;AACb,IAAA,MAAM,kBAAA,GAAqBC,IAAA;AAAA,MAAU,MACnC,QAAO,CAAE,IAAA,CAAK,cAAY,EAAE,OAAA,EAAS,MAAM,OAAA,EAAQ,CAAE;AAAA,KACvD;AACA,IAAA,2BACGF,kBAAAA,EAAA,EAAkB,MAAM,OAAA,EACvB,QAAA,kBAAA,GAAA,CAAC,sBAAmB,CAAA,EACtB,CAAA;AAAA,EAEJ;AAZO,EAAAA,kBAAAA,CAAS,IAAA,GAAAC,MAAA;AAcT,EAAA,SAAS,aAAA,CACd,SACA,MAAA,EACgC;AAChC,IAAA,MAAM,kBAAA,GAAqBC,IAAA;AAAA,MAAU,MACnC,QAAO,CAAE,IAAA,CAAK,gBAAc,EAAE,OAAA,EAAS,WAAU,CAAE;AAAA,KACrD;AAEA,IAAA,OAAO,CAAC,KAAA,qBACN,GAAA,CAACF,kBAAAA,EAAA,EAAkB,IAAA,EAAM,OAAA,EACvB,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA,EACjC,CAAA;AAAA,EAEJ;AAbO,EAAAA,kBAAAA,CAAS,aAAA,GAAA,aAAA;AAAA,CAAA,EAfD,iBAAA,KAAA,iBAAA,GAAA,EAAA,CAAA,CAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PageLayout.esm.js","sources":["../../src/components/PageLayout.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 { ReactNode } from 'react';\nimport { IconElement } from '../icons/types';\nimport { createSwappableComponent } from './createSwappableComponent';\n\n/**\n * Tab configuration for page navigation\n * @public\n */\nexport interface PageLayoutTab {\n id: string;\n label: string;\n icon?: IconElement;\n href: string;\n}\n\n/**\n * @deprecated Use {@link PageLayoutTab} instead\n * @public\n */\nexport type PageTab = PageLayoutTab;\n\n/**\n * Props for the PageLayout component\n * @public\n */\nexport interface PageLayoutProps {\n title?: string;\n icon?: IconElement;\n noHeader?: boolean;\n titleLink?: string;\n headerActions?: Array<JSX.Element | null>;\n tabs?: PageLayoutTab[];\n children?: ReactNode;\n}\n\n/**\n * Default implementation of PageLayout using plain HTML elements\n */\nfunction DefaultPageLayout(props: PageLayoutProps): JSX.Element {\n const { title, icon, headerActions, tabs, children } = props;\n\n return (\n <div\n data-component=\"page-layout\"\n style={{\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n minHeight: 0,\n }}\n >\n {(title || tabs) && (\n <header\n style={{\n borderBottom: '1px solid #ddd',\n backgroundColor: '#fff',\n flexShrink: 0,\n }}\n >\n {title && (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n padding: '12px 24px 8px',\n fontSize: '18px',\n fontWeight: 500,\n }}\n >\n {icon}\n {title}\n {headerActions && (\n <div style={{ marginLeft: 'auto' }}>{headerActions}</div>\n )}\n </div>\n )}\n {tabs && tabs.length > 0 && (\n <nav\n style={{\n display: 'flex',\n gap: '4px',\n padding: '0 24px',\n }}\n >\n {tabs.map(tab => (\n <a\n key={tab.id}\n href={tab.href}\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n padding: '8px 12px',\n textDecoration: 'none',\n color: '#333',\n borderBottom: '2px solid transparent',\n }}\n >\n {tab.icon}\n {tab.label}\n </a>\n ))}\n </nav>\n )}\n </header>\n )}\n <div\n style={{\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n minHeight: 0,\n }}\n >\n {children}\n </div>\n </div>\n );\n}\n\n/**\n * Swappable component for laying out page content with header and navigation.\n * The default implementation uses plain HTML elements.\n * Apps can override this with a custom implementation (e.g., using \\@backstage/ui).\n *\n * @public\n */\nexport const PageLayout = createSwappableComponent<PageLayoutProps>({\n id: 'core.page-layout',\n loader: () => DefaultPageLayout,\n});\n"],"names":[],"mappings":";;;AAsDA,SAAS,kBAAkB,KAAA,EAAqC;AAC9D,EAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,UAAS,GAAI,KAAA;AAEvD,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,gBAAA,EAAe,aAAA;AAAA,MACf,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,MAAA;AAAA,QACT,aAAA,EAAe,QAAA;AAAA,QACf,QAAA,EAAU,CAAA;AAAA,QACV,SAAA,EAAW;AAAA,OACb;AAAA,MAEE,QAAA,EAAA;AAAA,QAAA,CAAA,KAAA,IAAS,IAAA,qBACT,IAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO;AAAA,cACL,YAAA,EAAc,gBAAA;AAAA,cACd,eAAA,EAAiB,MAAA;AAAA,cACjB,UAAA,EAAY;AAAA,aACd;AAAA,YAEC,QAAA,EAAA;AAAA,cAAA,KAAA,oBACC,IAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,KAAA,EAAO;AAAA,oBACL,OAAA,EAAS,MAAA;AAAA,oBACT,UAAA,EAAY,QAAA;AAAA,oBACZ,GAAA,EAAK,KAAA;AAAA,oBACL,OAAA,EAAS,e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A,aACb;AAAA,YAEC;AAAA;AAAA;AACH;AAAA;AAAA,GACF;AAEJ;AASO,MAAM,aAAa,wBAAA,CAA0C;AAAA,EAClE,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAQ,MAAM;AAChB,CAAC;;;;"}
1
+ {"version":3,"file":"PageLayout.esm.js","sources":["../../src/components/PageLayout.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 { ReactNode } from 'react';\nimport { IconElement } from '../icons/types';\nimport { createSwappableComponent } from './createSwappableComponent';\n\n/**\n * Tab configuration for page navigation\n * @public\n */\nexport interface PageLayoutTab {\n id: string;\n label: string;\n icon?: IconElement;\n href: string;\n}\n\n/**\n * @deprecated Use {@link PageLayoutTab} instead\n * @public\n */\nexport type PageTab = PageLayoutTab;\n\n/**\n * Props for the PageLayout component\n * @public\n */\nexport interface PageLayoutProps {\n title?: string;\n icon?: IconElement;\n noHeader?: boolean;\n titleLink?: string;\n headerActions?: Array<JSX.Element | null>;\n tabs?: PageLayoutTab[];\n children?: ReactNode;\n}\n\n/**\n * Default implementation of PageLayout using plain HTML elements\n */\nfunction DefaultPageLayout(props: PageLayoutProps): JSX.Element {\n const { title, icon, headerActions, tabs, children } = props;\n\n return (\n <div\n data-component=\"page-layout\"\n style={{\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n minHeight: 0,\n }}\n >\n {(title || tabs) && (\n <header\n style={{\n borderBottom: '1px solid #ddd',\n backgroundColor: '#fff',\n flexShrink: 0,\n }}\n >\n {title && (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n padding: '12px 24px 8px',\n fontSize: '18px',\n fontWeight: 500,\n }}\n >\n {icon}\n {title}\n {headerActions && (\n <div style={{ marginLeft: 'auto' }}>{headerActions}</div>\n )}\n </div>\n )}\n {tabs && tabs.length > 0 && (\n <nav\n style={{\n display: 'flex',\n gap: '4px',\n padding: '0 24px',\n }}\n >\n {tabs.map(tab => (\n <a\n key={tab.id}\n href={tab.href}\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n padding: '8px 12px',\n textDecoration: 'none',\n color: '#333',\n borderBottom: '2px solid transparent',\n }}\n >\n {tab.icon}\n {tab.label}\n </a>\n ))}\n </nav>\n )}\n </header>\n )}\n <div\n style={{\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n minHeight: 0,\n }}\n >\n {children}\n </div>\n </div>\n );\n}\n\n/**\n * Swappable component for laying out page content with header and navigation.\n * The default implementation uses plain HTML elements.\n * Apps can override this with a custom implementation (e.g., using \\@backstage/ui).\n *\n * @public\n */\nexport const PageLayout = createSwappableComponent<PageLayoutProps>({\n id: 'core.page-layout',\n loader: () => DefaultPageLayout,\n});\n"],"names":[],"mappings":";;;AAsDA,SAAS,kBAAkB,KAAA,EAAqC;AAC9D,EAAA,MAAM,EAAE,KAAA,EAAO,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,UAAS,GAAI,KAAA;AAEvD,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,gBAAA,EAAe,aAAA;AAAA,MACf,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,MAAA;AAAA,QACT,aAAA,EAAe,QAAA;AAAA,QACf,QAAA,EAAU,CAAA;AAAA,QACV,SAAA,EAAW;AAAA,OACb;AAAA,MAEE,QAAA,EAAA;AAAA,QAAA,CAAA,KAAA,IAAS,IAAA,qBACT,IAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO;AAAA,cACL,YAAA,EAAc,gBA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J,GAAA,CAAI;AAAA;AAAA,qBAAA;AAAA,oBAbA,GAAA,CAAI;AAAA,mBAeZ;AAAA;AAAA;AACH;AAAA;AAAA,SAEJ;AAAA,wBAEF,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO;AAAA,cACL,OAAA,EAAS,MAAA;AAAA,cACT,aAAA,EAAe,QAAA;AAAA,cACf,QAAA,EAAU,CAAA;AAAA,cACV,SAAA,EAAW;AAAA,aACb;AAAA,YAEC;AAAA;AAAA;AACH;AAAA;AAAA,GACF;AAEJ;AASO,MAAM,aAAa,wBAAA,CAA0C;AAAA,EAClE,EAAA,EAAI,kBAAA;AAAA,EACJ,QAAQ,MAAM;AAChB,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createSwappableComponent.esm.js","sources":["../../src/components/createSwappableComponent.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 { OpaqueSwappableComponentRef } from '@internal/frontend';\nimport { swappableComponentsApiRef, useApi } from '../apis';\nimport { lazy } from 'react';\n\n/** @public */\nexport type SwappableComponentRef<\n TInnerComponentProps extends {} = {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n> = {\n id: string;\n TProps: TInnerComponentProps;\n TExternalProps: TExternalComponentProps;\n $$type: '@backstage/SwappableComponentRef';\n};\n\n/**\n * Options for creating an SwappableComponent.\n *\n * @public\n */\nexport type CreateSwappableComponentOptions<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n> = {\n id: string;\n loader?:\n | (() => (props: TInnerComponentProps) => JSX.Element | null)\n | (() => Promise<(props: TInnerComponentProps) => JSX.Element | null>);\n transformProps?: (props: TExternalComponentProps) => TInnerComponentProps;\n};\n\nconst useComponentRefApi = () => {\n try {\n return useApi(swappableComponentsApiRef);\n } catch (e) {\n return undefined;\n }\n};\n\n/**\n * Creates a SwappableComponent that can be used to render the component, optionally overridden by the app.\n *\n * @public\n */\nexport function createSwappableComponent<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n>(\n options: CreateSwappableComponentOptions<\n TInnerComponentProps,\n TExternalComponentProps\n >,\n): {\n (props: TExternalComponentProps): JSX.Element | null;\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>;\n} {\n const FallbackComponent = (p: JSX.IntrinsicAttributes) => (\n <div data-testid={options.id} {...p} />\n );\n\n const ref = OpaqueSwappableComponentRef.createInstance('v1', {\n id: options.id,\n TProps: null as unknown as TInnerComponentProps,\n TExternalProps: null as unknown as TExternalComponentProps,\n toString() {\n return `SwappableComponentRef{id=${options.id}}`;\n },\n defaultComponent: lazy(async () => {\n const Component = (await options.loader?.()) ?? FallbackComponent;\n return { default: Component };\n }) as (typeof OpaqueSwappableComponentRef.TInternal)['defaultComponent'],\n transformProps:\n options.transformProps as (typeof OpaqueSwappableComponentRef.TInternal)['transformProps'],\n });\n\n const ComponentRefImpl = (props: TExternalComponentProps) => {\n const api = useComponentRefApi();\n\n if (!api) {\n const internalRef = OpaqueSwappableComponentRef.toInternal(ref);\n const Component = internalRef.defaultComponent;\n const innerProps = internalRef.transformProps?.(props) ?? props;\n return <Component {...innerProps} />;\n }\n\n const Component = api.getComponent<any>(ref);\n return <Component {...props} />;\n };\n\n Object.assign(ComponentRefImpl, { ref });\n\n return ComponentRefImpl as {\n (props: TExternalComponentProps): JSX.Element | null;\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>;\n };\n}\n"],"names":["Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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C;AAEA,IAAA,MAAM,SAAA,GAAY,GAAA,CAAI,YAAA,CAAkB,GAAG,CAAA;AAC3C,IAAA,uBAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAAA,EAC/B,CAAA;AAEA,EAAA,MAAA,CAAO,MAAA,CAAO,gBAAA,EAAkB,EAAE,GAAA,EAAK,CAAA;AAEvC,EAAA,OAAO,gBAAA;AAIT;;;;"}
1
+ {"version":3,"file":"createSwappableComponent.esm.js","sources":["../../src/components/createSwappableComponent.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 { OpaqueSwappableComponentRef } from '@internal/frontend';\nimport { swappableComponentsApiRef, useApi } from '../apis';\nimport { lazy } from 'react';\n\n/** @public */\nexport type SwappableComponentRef<\n TInnerComponentProps extends {} = {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n> = {\n id: string;\n TProps: TInnerComponentProps;\n TExternalProps: TExternalComponentProps;\n $$type: '@backstage/SwappableComponentRef';\n};\n\n/**\n * Options for creating an SwappableComponent.\n *\n * @public\n */\nexport type CreateSwappableComponentOptions<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n> = {\n id: string;\n loader?:\n | (() => (props: TInnerComponentProps) => JSX.Element | null)\n | (() => Promise<(props: TInnerComponentProps) => JSX.Element | null>);\n transformProps?: (props: TExternalComponentProps) => TInnerComponentProps;\n};\n\nconst useComponentRefApi = () => {\n try {\n return useApi(swappableComponentsApiRef);\n } catch (e) {\n return undefined;\n }\n};\n\n/**\n * Creates a SwappableComponent that can be used to render the component, optionally overridden by the app.\n *\n * @public\n */\nexport function createSwappableComponent<\n TInnerComponentProps extends {},\n TExternalComponentProps extends {} = TInnerComponentProps,\n>(\n options: CreateSwappableComponentOptions<\n TInnerComponentProps,\n TExternalComponentProps\n >,\n): {\n (props: TExternalComponentProps): JSX.Element | null;\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>;\n} {\n const FallbackComponent = (p: JSX.IntrinsicAttributes) => (\n <div data-testid={options.id} {...p} />\n );\n\n const ref = OpaqueSwappableComponentRef.createInstance('v1', {\n id: options.id,\n TProps: null as unknown as TInnerComponentProps,\n TExternalProps: null as unknown as TExternalComponentProps,\n toString() {\n return `SwappableComponentRef{id=${options.id}}`;\n },\n defaultComponent: lazy(async () => {\n const Component = (await options.loader?.()) ?? FallbackComponent;\n return { default: Component };\n }) as (typeof OpaqueSwappableComponentRef.TInternal)['defaultComponent'],\n transformProps:\n options.transformProps as (typeof OpaqueSwappableComponentRef.TInternal)['transformProps'],\n });\n\n const ComponentRefImpl = (props: TExternalComponentProps) => {\n const api = useComponentRefApi();\n\n if (!api) {\n const internalRef = OpaqueSwappableComponentRef.toInternal(ref);\n const Component = internalRef.defaultComponent;\n const innerProps = internalRef.transformProps?.(props) ?? props;\n return <Component {...innerProps} />;\n }\n\n const Component = api.getComponent<any>(ref);\n return <Component {...props} />;\n };\n\n Object.assign(ComponentRefImpl, { ref });\n\n return ComponentRefImpl as {\n (props: TExternalComponentProps): JSX.Element | null;\n ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>;\n };\n}\n"],"names":["Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAM,qBAAqB,MAAM;AAC/B,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,yBAAyB,CAAA;AAAA,EACzC,SAAS,CAAA,EAAG;AACV,IAAA,OAAO,MAAA;AAAA,EACT;AACF,CAAA;AAOO,SAAS,yBAId,OAAA,EAOA;AACA,EAA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AO,gBAAA,EAAkB,EAAE,GAAA,EAAK,CAAA;AAEvC,EAAA,OAAO,gBAAA;AAIT;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tracker.esm.js","sources":["../../../../../core-plugin-api/src/analytics/Tracker.ts"],"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 { getOrCreateGlobalSingleton } from '@backstage/version-bridge';\nimport {\n AnalyticsApi,\n AnalyticsEventAttributes,\n AnalyticsTracker,\n} from '../apis';\nimport { AnalyticsContextValue } from './types';\n\ntype TempGlobalEvents = {\n /**\n * Stores the most recent \"gathered\" mountpoint navigation.\n */\n mostRecentGatheredNavigation?: {\n action: string;\n subject: string;\n value?: number;\n attributes?: AnalyticsEventAttributes;\n context: AnalyticsContextValue;\n };\n /**\n * Stores the most recent routable extension render.\n */\n mostRecentRoutableExtensionRender?: {\n context: AnalyticsContextValue;\n };\n /**\n * Tracks whether or not a beforeunload event listener has already been\n * registered.\n */\n beforeUnloadRegistered: boolean;\n};\n\n/**\n * Temporary global store for select event data. Used to make `navigate` events\n * more accurate when gathered mountpoints are used.\n */\nconst globalEvents = getOrCreateGlobalSingleton<TempGlobalEvents>(\n 'core-plugin-api:analytics-tracker-events',\n () => ({\n mostRecentGatheredNavigation: undefined,\n mostRecentRoutableExtensionRender: undefined,\n beforeUnloadRegistered: false,\n }),\n);\n\n/**\n * Internal-only event representing when a routable extension is rendered.\n */\nexport const routableExtensionRenderedEvent = '_ROUTABLE-EXTENSION-RENDERED';\n\nexport class Tracker implements AnalyticsTracker {\n private readonly analyticsApi: AnalyticsApi;\n private context: AnalyticsContextValue;\n\n constructor(\n analyticsApi: AnalyticsApi,\n context: AnalyticsContextValue = {\n routeRef: 'unknown',\n pluginId: 'root',\n extension: 'App',\n },\n ) {\n this.analyticsApi = analyticsApi;\n this.context = context;\n // Only register a single beforeunload event across all trackers.\n if (!globalEvents.beforeUnloadRegistered) {\n // Before the page unloads, attempt to capture any deferred navigation\n // events that haven't yet been captured.\n addEventListener(\n 'beforeunload',\n () => {\n if (globalEvents.mostRecentGatheredNavigation) {\n this.analyticsApi.captureEvent({\n ...globalEvents.mostRecentGatheredNavigation,\n ...globalEvents.mostRecentRoutableExtensionRender,\n });\n globalEvents.mostRecentGatheredNavigation = undefined;\n globalEvents.mostRecentRoutableExtensionRender = undefined;\n }\n },\n { once: true, passive: true },\n );\n\n // Prevent duplicate handlers from being registered.\n globalEvents.beforeUnloadRegistered = true;\n }\n }\n\n setContext(context: AnalyticsContextValue) {\n this.context = context;\n }\n\n captureEvent(\n action: string,\n subject: string,\n {\n value,\n attributes,\n }: { value?: number; attributes?: AnalyticsEventAttributes } = {},\n ) {\n // Never pass internal \"_routeNodeType\" context value.\n const { _routeNodeType, ...context } = this.context;\n\n // Never fire the special \"_routable-extension-rendered\" internal event.\n if (action === routableExtensionRenderedEvent) {\n // But keep track of it if we're delaying a `navigate` event for a\n // a gathered route node type.\n if (globalEvents.mostRecentGatheredNavigation) {\n globalEvents.mostRecentRoutableExtensionRender = {\n context: {\n ...context,\n extension: 'App',\n },\n };\n }\n return;\n }\n\n // If we are about to fire a real event, and we have an un-fired gathered\n // mountpoint navigation on the global store, we need to fire the navigate\n // event first, so this real event happens accurately after the navigation.\n if (globalEvents.mostRecentGatheredNavigation) {\n try {\n this.analyticsApi.captureEvent({\n ...globalEvents.mostRecentGatheredNavigation,\n ...globalEvents.mostRecentRoutableExtensionRender,\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error during analytics event capture. %o', e);\n }\n\n // Clear the global stores.\n globalEvents.mostRecentGatheredNavigation = undefined;\n globalEvents.mostRecentRoutableExtensionRender = undefined;\n }\n\n // Never directly fire a navigation event on a gathered route with default\n // contextual details.\n if (\n action === 'navigate' &&\n _routeNodeType === 'gathered' &&\n context.pluginId === 'root'\n ) {\n // Instead, set it on the global store.\n globalEvents.mostRecentGatheredNavigation = {\n action,\n subject,\n value,\n attributes,\n context,\n };\n return;\n }\n\n try {\n this.analyticsApi.captureEvent({\n action,\n subject,\n value,\n attributes,\n context,\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error during analytics event capture. %o', e);\n }\n }\n}\n"],"names":[],"mappings":";;AAoDqB,0BAAA;AAAA,EACnB,0CAAA;AAAA,EACA,OAAO;AAAA,IACL,4BAAA,EAA8B,MAAA;AAAA,IAC9B,iCAAA,EAAmC,MAAA;AAAA,IACnC,sBAAA,EAAwB;AAAA,GAC1B;AACF;AAKO,MAAM,8BAAA,GAAiC;;;;"}
1
+ {"version":3,"file":"Tracker.esm.js","sources":["../../../../../core-plugin-api/src/analytics/Tracker.ts"],"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 { getOrCreateGlobalSingleton } from '@backstage/version-bridge';\nimport {\n AnalyticsApi,\n AnalyticsEventAttributes,\n AnalyticsTracker,\n} from '../apis';\nimport { AnalyticsContextValue } from './types';\n\ntype TempGlobalEvents = {\n /**\n * Stores the most recent \"gathered\" mountpoint navigation.\n */\n mostRecentGatheredNavigation?: {\n action: string;\n subject: string;\n value?: number;\n attributes?: AnalyticsEventAttributes;\n context: AnalyticsContextValue;\n };\n /**\n * Stores the most recent routable extension render.\n */\n mostRecentRoutableExtensionRender?: {\n context: AnalyticsContextValue;\n };\n /**\n * Tracks whether or not a beforeunload event listener has already been\n * registered.\n */\n beforeUnloadRegistered: boolean;\n};\n\n/**\n * Temporary global store for select event data. Used to make `navigate` events\n * more accurate when gathered mountpoints are used.\n */\nconst globalEvents = getOrCreateGlobalSingleton<TempGlobalEvents>(\n 'core-plugin-api:analytics-tracker-events',\n () => ({\n mostRecentGatheredNavigation: undefined,\n mostRecentRoutableExtensionRender: undefined,\n beforeUnloadRegistered: false,\n }),\n);\n\n/**\n * Internal-only event representing when a routable extension is rendered.\n */\nexport const routableExtensionRenderedEvent = '_ROUTABLE-EXTENSION-RENDERED';\n\nexport class Tracker implements AnalyticsTracker {\n private readonly analyticsApi: AnalyticsApi;\n private context: AnalyticsContextValue;\n\n constructor(\n analyticsApi: AnalyticsApi,\n context: AnalyticsContextValue = {\n routeRef: 'unknown',\n pluginId: 'root',\n extension: 'App',\n },\n ) {\n this.analyticsApi = analyticsApi;\n this.context = context;\n // Only register a single beforeunload event across all trackers.\n if (!globalEvents.beforeUnloadRegistered) {\n // Before the page unloads, attempt to capture any deferred navigation\n // events that haven't yet been captured.\n addEventListener(\n 'beforeunload',\n () => {\n if (globalEvents.mostRecentGatheredNavigation) {\n this.analyticsApi.captureEvent({\n ...globalEvents.mostRecentGatheredNavigation,\n ...globalEvents.mostRecentRoutableExtensionRender,\n });\n globalEvents.mostRecentGatheredNavigation = undefined;\n globalEvents.mostRecentRoutableExtensionRender = undefined;\n }\n },\n { once: true, passive: true },\n );\n\n // Prevent duplicate handlers from being registered.\n globalEvents.beforeUnloadRegistered = true;\n }\n }\n\n setContext(context: AnalyticsContextValue) {\n this.context = context;\n }\n\n captureEvent(\n action: string,\n subject: string,\n {\n value,\n attributes,\n }: { value?: number; attributes?: AnalyticsEventAttributes } = {},\n ) {\n // Never pass internal \"_routeNodeType\" context value.\n const { _routeNodeType, ...context } = this.context;\n\n // Never fire the special \"_routable-extension-rendered\" internal event.\n if (action === routableExtensionRenderedEvent) {\n // But keep track of it if we're delaying a `navigate` event for a\n // a gathered route node type.\n if (globalEvents.mostRecentGatheredNavigation) {\n globalEvents.mostRecentRoutableExtensionRender = {\n context: {\n ...context,\n extension: 'App',\n },\n };\n }\n return;\n }\n\n // If we are about to fire a real event, and we have an un-fired gathered\n // mountpoint navigation on the global store, we need to fire the navigate\n // event first, so this real event happens accurately after the navigation.\n if (globalEvents.mostRecentGatheredNavigation) {\n try {\n this.analyticsApi.captureEvent({\n ...globalEvents.mostRecentGatheredNavigation,\n ...globalEvents.mostRecentRoutableExtensionRender,\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error during analytics event capture. %o', e);\n }\n\n // Clear the global stores.\n globalEvents.mostRecentGatheredNavigation = undefined;\n globalEvents.mostRecentRoutableExtensionRender = undefined;\n }\n\n // Never directly fire a navigation event on a gathered route with default\n // contextual details.\n if (\n action === 'navigate' &&\n _routeNodeType === 'gathered' &&\n context.pluginId === 'root'\n ) {\n // Instead, set it on the global store.\n globalEvents.mostRecentGatheredNavigation = {\n action,\n subject,\n value,\n attributes,\n context,\n };\n return;\n }\n\n try {\n this.analyticsApi.captureEvent({\n action,\n subject,\n value,\n attributes,\n context,\n });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error during analytics event capture. %o', e);\n }\n }\n}\n"],"names":[],"mappings":";;AAoDqB,0BAAA;AAAA,EACnB,0CAAA;AAAA,EACA,OAAO;AAAA,IACL,4BAAA,EAA8B,MAAA;AAAA,IAC9B,iCAAA,EAAmC,MAAA;AAAA,IACnC,sBAAA,EAAwB;AAAA,GAC1B;AACF;AAKO,MAAM,8BAAA,GAAiC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"OpaqueApiRef.esm.js","sources":["../../../../../frontend-internal/src/apis/OpaqueApiRef.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 type { ApiRef } from '@backstage/frontend-plugin-api';\nimport { OpaqueType } from '@internal/opaque';\n\nexport const OpaqueApiRef = OpaqueType.create<{\n public: ApiRef<unknown> & {\n readonly $$type: '@backstage/ApiRef';\n };\n versions: {\n readonly version: 'v1';\n readonly pluginId?: string;\n };\n}>({\n type: '@backstage/ApiRef',\n versions: ['v1'],\n});\n"],"names":[],"mappings":";;AAmBO,MAAM,YAAA,GAAe,WAAW,MAAA,CAQpC;AAAA,EACD,IAAA,EAAM,mBAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAI;AACjB,CAAC;;;;"}
1
+ {"version":3,"file":"OpaqueApiRef.esm.js","sources":["../../../../../frontend-internal/src/apis/OpaqueApiRef.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 type { ApiRef } from '@backstage/frontend-plugin-api';\nimport { OpaqueType } from '@internal/opaque';\n\nexport const OpaqueApiRef = OpaqueType.create<{\n public: ApiRef<unknown> & {\n readonly $$type: '@backstage/ApiRef';\n };\n versions: {\n readonly version: 'v1';\n readonly pluginId?: string;\n };\n}>({\n type: '@backstage/ApiRef',\n versions: ['v1'],\n});\n"],"names":[],"mappings":";;AAmBO,MAAM,YAAA,GAAe,WAAW,MAAA,CAQpC;AAAA,EACD,IAAA,EAAM,mBAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAI;AACjB,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"OpaqueExternalRouteRef.esm.js","sources":["../../../../../frontend-internal/src/routing/OpaqueExternalRouteRef.ts"],"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 { ExternalRouteRef } from '@backstage/frontend-plugin-api';\nimport { OpaqueType } from '@internal/opaque';\n\nexport const OpaqueExternalRouteRef = OpaqueType.create<{\n public: ExternalRouteRef;\n versions: {\n readonly version: 'v1';\n\n getParams(): string[];\n getDescription(): string;\n getDefaultTarget(): string | undefined;\n\n setId(id: string): void;\n };\n}>({\n type: '@backstage/ExternalRouteRef',\n versions: ['v1'],\n});\n"],"names":[],"mappings":";;AAmBO,MAAM,sBAAA,GAAyB,WAAW,MAAA,CAW9C;AAAA,EACD,IAAA,EAAM,6BAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAI;AACjB,CAAC;;;;"}
1
+ {"version":3,"file":"OpaqueExternalRouteRef.esm.js","sources":["../../../../../frontend-internal/src/routing/OpaqueExternalRouteRef.ts"],"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 { ExternalRouteRef } from '@backstage/frontend-plugin-api';\nimport { OpaqueType } from '@internal/opaque';\n\nexport const OpaqueExternalRouteRef = OpaqueType.create<{\n public: ExternalRouteRef;\n versions: {\n readonly version: 'v1';\n\n getParams(): string[];\n getDescription(): string;\n getDefaultTarget(): string | undefined;\n\n setId(id: string): void;\n };\n}>({\n type: '@backstage/ExternalRouteRef',\n versions: ['v1'],\n});\n"],"names":[],"mappings":";;AAmBO,MAAM,sBAAA,GAAyB,WAAW,MAAA,CAW9C;AAAA,EACD,IAAA,EAAM,6BAAA;AAAA,EACN,QAAA,EAAU,CAAC,IAAI;AACjB,CAAC;;"}