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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @backstage/plugin-app
2
2
 
3
+ ## 0.1.7-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 0aa9d82: Added implementation of the new `DialogApi`.
8
+ - Updated dependencies
9
+ - @backstage/frontend-plugin-api@0.10.0-next.2
10
+ - @backstage/core-components@0.16.5-next.1
11
+ - @backstage/core-plugin-api@1.10.4
12
+ - @backstage/integration-react@1.2.5-next.0
13
+ - @backstage/theme@0.6.4
14
+ - @backstage/types@1.2.1
15
+ - @backstage/plugin-permission-react@0.4.31
16
+
17
+ ## 0.1.7-next.1
18
+
19
+ ### Patch Changes
20
+
21
+ - 583fc54: Fixed extra app elements not being rendered as part of apps without a sign-in page.
22
+ - Updated dependencies
23
+ - @backstage/core-components@0.16.5-next.0
24
+ - @backstage/core-plugin-api@1.10.4
25
+ - @backstage/frontend-plugin-api@0.9.6-next.1
26
+ - @backstage/integration-react@1.2.4
27
+ - @backstage/theme@0.6.4
28
+ - @backstage/plugin-permission-react@0.4.31
29
+
3
30
  ## 0.1.7-next.0
4
31
 
5
32
  ### Patch Changes
@@ -0,0 +1,27 @@
1
+ class DefaultDialogApi {
2
+ #onShow;
3
+ show(elementOrComponent) {
4
+ if (!this.#onShow) {
5
+ throw new Error("Dialog API has not been connected");
6
+ }
7
+ return this.#onShow({
8
+ component: typeof elementOrComponent === "function" ? elementOrComponent : () => elementOrComponent,
9
+ modal: false
10
+ });
11
+ }
12
+ showModal(elementOrComponent) {
13
+ if (!this.#onShow) {
14
+ throw new Error("Dialog API has not been connected");
15
+ }
16
+ return this.#onShow({
17
+ component: typeof elementOrComponent === "function" ? elementOrComponent : () => elementOrComponent,
18
+ modal: true
19
+ });
20
+ }
21
+ connect(onShow) {
22
+ this.#onShow = onShow;
23
+ }
24
+ }
25
+
26
+ export { DefaultDialogApi };
27
+ //# sourceMappingURL=DefaultDialogApi.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultDialogApi.esm.js","sources":["../../src/apis/DefaultDialogApi.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 { DialogApi, DialogApiDialog } from '@backstage/frontend-plugin-api';\n\nexport type OnShowDialog = (options: {\n component: (props: { dialog: DialogApiDialog<any> }) => React.JSX.Element;\n modal: boolean;\n}) => DialogApiDialog;\n\n/**\n * Default implementation for the {@link DialogApi}.\n * @internal\n */\nexport class DefaultDialogApi implements DialogApi {\n #onShow?: OnShowDialog;\n\n show<TResult = {}>(\n elementOrComponent:\n | JSX.Element\n | ((props: {\n dialog: DialogApiDialog<TResult | undefined>;\n }) => JSX.Element),\n ): DialogApiDialog<TResult | undefined> {\n if (!this.#onShow) {\n throw new Error('Dialog API has not been connected');\n }\n return this.#onShow({\n component:\n typeof elementOrComponent === 'function'\n ? elementOrComponent\n : () => elementOrComponent,\n modal: false,\n }) as DialogApiDialog<TResult | undefined>;\n }\n\n showModal<TResult = {}>(\n elementOrComponent:\n | JSX.Element\n | ((props: { dialog: DialogApiDialog<TResult> }) => JSX.Element),\n ): DialogApiDialog<TResult> {\n if (!this.#onShow) {\n throw new Error('Dialog API has not been connected');\n }\n return this.#onShow({\n component:\n typeof elementOrComponent === 'function'\n ? elementOrComponent\n : () => elementOrComponent,\n modal: true,\n }) as DialogApiDialog<TResult>;\n }\n\n connect(onShow: OnShowDialog): void {\n this.#onShow = onShow;\n }\n}\n"],"names":[],"mappings":"AA2BO,MAAM,gBAAsC,CAAA;AAAA,EACjD,OAAA;AAAA,EAEA,KACE,kBAKsC,EAAA;AACtC,IAAI,IAAA,CAAC,KAAK,OAAS,EAAA;AACjB,MAAM,MAAA,IAAI,MAAM,mCAAmC,CAAA;AAAA;AAErD,IAAA,OAAO,KAAK,OAAQ,CAAA;AAAA,MAClB,SACE,EAAA,OAAO,kBAAuB,KAAA,UAAA,GAC1B,qBACA,MAAM,kBAAA;AAAA,MACZ,KAAO,EAAA;AAAA,KACR,CAAA;AAAA;AACH,EAEA,UACE,kBAG0B,EAAA;AAC1B,IAAI,IAAA,CAAC,KAAK,OAAS,EAAA;AACjB,MAAM,MAAA,IAAI,MAAM,mCAAmC,CAAA;AAAA;AAErD,IAAA,OAAO,KAAK,OAAQ,CAAA;AAAA,MAClB,SACE,EAAA,OAAO,kBAAuB,KAAA,UAAA,GAC1B,qBACA,MAAM,kBAAA;AAAA,MACZ,KAAO,EAAA;AAAA,KACR,CAAA;AAAA;AACH,EAEA,QAAQ,MAA4B,EAAA;AAClC,IAAA,IAAA,CAAK,OAAU,GAAA,MAAA;AAAA;AAEnB;;;;"}
@@ -22,11 +22,22 @@ import { createFetchApi } from './packages/core-app-api/src/apis/implementations
22
22
  import { FetchMiddlewares } from './packages/core-app-api/src/apis/implementations/FetchApi/FetchMiddlewares.esm.js';
23
23
  import { OAuthRequestManager } from './packages/core-app-api/src/apis/implementations/OAuthRequestApi/OAuthRequestManager.esm.js';
24
24
  import { WebStorage } from './packages/core-app-api/src/apis/implementations/StorageApi/WebStorage.esm.js';
25
- import { ApiBlueprint } from '@backstage/frontend-plugin-api';
25
+ import { ApiBlueprint, dialogApiRef } from '@backstage/frontend-plugin-api';
26
26
  import { ScmAuth, scmIntegrationsApiRef, ScmIntegrationsApi } from '@backstage/integration-react';
27
27
  import { permissionApiRef, IdentityPermissionApi } from '@backstage/plugin-permission-react';
28
+ import { DefaultDialogApi } from './apis/DefaultDialogApi.esm.js';
28
29
 
29
30
  const apis = [
31
+ ApiBlueprint.make({
32
+ name: "dialog",
33
+ params: {
34
+ factory: createApiFactory({
35
+ api: dialogApiRef,
36
+ deps: {},
37
+ factory: () => new DefaultDialogApi()
38
+ })
39
+ }
40
+ }),
30
41
  ApiBlueprint.make({
31
42
  name: "discovery",
32
43
  params: {
@@ -1 +1 @@
1
- {"version":3,"file":"defaultApis.esm.js","sources":["../src/defaultApis.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\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport {\n AlertApiForwarder,\n NoOpAnalyticsApi,\n ErrorApiForwarder,\n ErrorAlerter,\n GoogleAuth,\n GithubAuth,\n OktaAuth,\n GitlabAuth,\n MicrosoftAuth,\n BitbucketAuth,\n BitbucketServerAuth,\n OAuthRequestManager,\n WebStorage,\n UrlPatternDiscovery,\n OneLoginAuth,\n UnhandledErrorForwarder,\n AtlassianAuth,\n createFetchApi,\n FetchMiddlewares,\n VMwareCloudAuth,\n} from '../../../packages/core-app-api/src/apis/implementations';\n\nimport {\n createApiFactory,\n alertApiRef,\n analyticsApiRef,\n errorApiRef,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n oauthRequestApiRef,\n googleAuthApiRef,\n githubAuthApiRef,\n oktaAuthApiRef,\n gitlabAuthApiRef,\n microsoftAuthApiRef,\n storageApiRef,\n configApiRef,\n oneloginAuthApiRef,\n bitbucketAuthApiRef,\n bitbucketServerAuthApiRef,\n atlassianAuthApiRef,\n vmwareCloudAuthApiRef,\n} from '@backstage/core-plugin-api';\nimport { ApiBlueprint } from '@backstage/frontend-plugin-api';\nimport {\n ScmAuth,\n ScmIntegrationsApi,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport {\n permissionApiRef,\n IdentityPermissionApi,\n} from '@backstage/plugin-permission-react';\n\nexport const apis = [\n ApiBlueprint.make({\n name: 'discovery',\n params: {\n factory: createApiFactory({\n api: discoveryApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) =>\n UrlPatternDiscovery.compile(\n `${configApi.getString('backend.baseUrl')}/api/{{ pluginId }}`,\n ),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'alert',\n params: {\n factory: createApiFactory({\n api: alertApiRef,\n deps: {},\n factory: () => new AlertApiForwarder(),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'analytics',\n params: {\n factory: createApiFactory({\n api: analyticsApiRef,\n deps: {},\n factory: () => new NoOpAnalyticsApi(),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'error',\n params: {\n factory: createApiFactory({\n api: errorApiRef,\n deps: { alertApi: alertApiRef },\n factory: ({ alertApi }) => {\n const errorApi = new ErrorAlerter(alertApi, new ErrorApiForwarder());\n UnhandledErrorForwarder.forward(errorApi, { hidden: false });\n return errorApi;\n },\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'storage',\n params: {\n factory: createApiFactory({\n api: storageApiRef,\n deps: { errorApi: errorApiRef },\n factory: ({ errorApi }) => WebStorage.create({ errorApi }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'fetch',\n params: {\n factory: createApiFactory({\n api: fetchApiRef,\n deps: {\n configApi: configApiRef,\n identityApi: identityApiRef,\n discoveryApi: discoveryApiRef,\n },\n factory: ({ configApi, identityApi, discoveryApi }) => {\n return createFetchApi({\n middleware: [\n FetchMiddlewares.resolvePluginProtocol({\n discoveryApi,\n }),\n FetchMiddlewares.injectIdentityAuth({\n identityApi,\n config: configApi,\n }),\n ],\n });\n },\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'oauth-request',\n params: {\n factory: createApiFactory({\n api: oauthRequestApiRef,\n deps: {},\n factory: () => new OAuthRequestManager(),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'google-auth',\n params: {\n factory: createApiFactory({\n api: googleAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GoogleAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'microsoft-auth',\n params: {\n factory: createApiFactory({\n api: microsoftAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n MicrosoftAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'github-auth',\n params: {\n factory: createApiFactory({\n api: githubAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GithubAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['read:user'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'okta-auth',\n params: {\n factory: createApiFactory({\n api: oktaAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OktaAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'gitlab-auth',\n params: {\n factory: createApiFactory({\n api: gitlabAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GitlabAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'onelogin-auth',\n params: {\n factory: createApiFactory({\n api: oneloginAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OneLoginAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'bitbucket-auth',\n params: {\n factory: createApiFactory({\n api: bitbucketAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['account'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'bitbucket-server-auth',\n params: {\n factory: createApiFactory({\n api: bitbucketServerAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketServerAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['REPO_READ'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'atlassian-auth',\n params: {\n factory: createApiFactory({\n api: atlassianAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return AtlassianAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'vmware-cloud-auth',\n params: {\n factory: createApiFactory({\n api: vmwareCloudAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return VMwareCloudAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'permission',\n params: {\n factory: createApiFactory({\n api: permissionApiRef,\n deps: {\n discovery: discoveryApiRef,\n identity: identityApiRef,\n config: configApiRef,\n },\n factory: ({ config, discovery, identity }) =>\n IdentityPermissionApi.create({ config, discovery, identity }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'scm-auth',\n params: {\n factory: ScmAuth.createDefaultApiFactory(),\n },\n }),\n ApiBlueprint.make({\n name: 'scm-integrations',\n params: {\n factory: createApiFactory({\n api: scmIntegrationsApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi),\n }),\n },\n }),\n] as const;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEO,MAAM,IAAO,GAAA;AAAA,EAClB,aAAa,IAAK,CAAA;AAAA,IAChB,IAAM,EAAA,WAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,eAAA;AAAA,QACL,IAAA,EAAM,EAAE,SAAA,EAAW,YAAa,EAAA;AAAA,QAChC,OAAS,EAAA,CAAC,EAAE,SAAA,OACV,mBAAoB,CAAA,OAAA;AAAA,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;AAAA,YACA,YAAA;AAAA,YACA,eAAA;AAAA,YACA,WAAA,EAAa,SAAU,CAAA,iBAAA,CAAkB,kBAAkB;AAAA,WAC5D,CAAA;AAAA;AACH,OACD;AAAA;AACH,GACD,CAAA;AAAA,EACD,aAAa,IAAK,CAAA;AAAA,IAChB,IAAM,EAAA,YAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,gBAAA;AAAA,QACL,IAAM,EAAA;AAAA,UACJ,SAAW,EAAA,eAAA;AAAA,UACX,QAAU,EAAA,cAAA;AAAA,UACV,MAAQ,EAAA;AAAA,SACV;AAAA,QACA,OAAS,EAAA,CAAC,EAAE,MAAA,EAAQ,SAAW,EAAA,QAAA,EAC7B,KAAA,qBAAA,CAAsB,MAAO,CAAA,EAAE,MAAQ,EAAA,SAAA,EAAW,UAAU;AAAA,OAC/D;AAAA;AACH,GACD,CAAA;AAAA,EACD,aAAa,IAAK,CAAA;AAAA,IAChB,IAAM,EAAA,UAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,OAAA,EAAS,QAAQ,uBAAwB;AAAA;AAC3C,GACD,CAAA;AAAA,EACD,aAAa,IAAK,CAAA;AAAA,IAChB,IAAM,EAAA,kBAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,qBAAA;AAAA,QACL,IAAA,EAAM,EAAE,SAAA,EAAW,YAAa,EAAA;AAAA,QAChC,SAAS,CAAC,EAAE,WAAgB,KAAA,kBAAA,CAAmB,WAAW,SAAS;AAAA,OACpE;AAAA;AACH,GACD;AACH;;;;"}
1
+ {"version":3,"file":"defaultApis.esm.js","sources":["../src/defaultApis.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\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport {\n AlertApiForwarder,\n NoOpAnalyticsApi,\n ErrorApiForwarder,\n ErrorAlerter,\n GoogleAuth,\n GithubAuth,\n OktaAuth,\n GitlabAuth,\n MicrosoftAuth,\n BitbucketAuth,\n BitbucketServerAuth,\n OAuthRequestManager,\n WebStorage,\n UrlPatternDiscovery,\n OneLoginAuth,\n UnhandledErrorForwarder,\n AtlassianAuth,\n createFetchApi,\n FetchMiddlewares,\n VMwareCloudAuth,\n} from '../../../packages/core-app-api/src/apis/implementations';\n\nimport {\n createApiFactory,\n alertApiRef,\n analyticsApiRef,\n errorApiRef,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n oauthRequestApiRef,\n googleAuthApiRef,\n githubAuthApiRef,\n oktaAuthApiRef,\n gitlabAuthApiRef,\n microsoftAuthApiRef,\n storageApiRef,\n configApiRef,\n oneloginAuthApiRef,\n bitbucketAuthApiRef,\n bitbucketServerAuthApiRef,\n atlassianAuthApiRef,\n vmwareCloudAuthApiRef,\n} from '@backstage/core-plugin-api';\nimport { ApiBlueprint, dialogApiRef } from '@backstage/frontend-plugin-api';\nimport {\n ScmAuth,\n ScmIntegrationsApi,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport {\n permissionApiRef,\n IdentityPermissionApi,\n} from '@backstage/plugin-permission-react';\nimport { DefaultDialogApi } from './apis/DefaultDialogApi';\n\nexport const apis = [\n ApiBlueprint.make({\n name: 'dialog',\n params: {\n factory: createApiFactory({\n api: dialogApiRef,\n deps: {},\n factory: () => new DefaultDialogApi(),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'discovery',\n params: {\n factory: createApiFactory({\n api: discoveryApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) =>\n UrlPatternDiscovery.compile(\n `${configApi.getString('backend.baseUrl')}/api/{{ pluginId }}`,\n ),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'alert',\n params: {\n factory: createApiFactory({\n api: alertApiRef,\n deps: {},\n factory: () => new AlertApiForwarder(),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'analytics',\n params: {\n factory: createApiFactory({\n api: analyticsApiRef,\n deps: {},\n factory: () => new NoOpAnalyticsApi(),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'error',\n params: {\n factory: createApiFactory({\n api: errorApiRef,\n deps: { alertApi: alertApiRef },\n factory: ({ alertApi }) => {\n const errorApi = new ErrorAlerter(alertApi, new ErrorApiForwarder());\n UnhandledErrorForwarder.forward(errorApi, { hidden: false });\n return errorApi;\n },\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'storage',\n params: {\n factory: createApiFactory({\n api: storageApiRef,\n deps: { errorApi: errorApiRef },\n factory: ({ errorApi }) => WebStorage.create({ errorApi }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'fetch',\n params: {\n factory: createApiFactory({\n api: fetchApiRef,\n deps: {\n configApi: configApiRef,\n identityApi: identityApiRef,\n discoveryApi: discoveryApiRef,\n },\n factory: ({ configApi, identityApi, discoveryApi }) => {\n return createFetchApi({\n middleware: [\n FetchMiddlewares.resolvePluginProtocol({\n discoveryApi,\n }),\n FetchMiddlewares.injectIdentityAuth({\n identityApi,\n config: configApi,\n }),\n ],\n });\n },\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'oauth-request',\n params: {\n factory: createApiFactory({\n api: oauthRequestApiRef,\n deps: {},\n factory: () => new OAuthRequestManager(),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'google-auth',\n params: {\n factory: createApiFactory({\n api: googleAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GoogleAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'microsoft-auth',\n params: {\n factory: createApiFactory({\n api: microsoftAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n MicrosoftAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'github-auth',\n params: {\n factory: createApiFactory({\n api: githubAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GithubAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['read:user'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'okta-auth',\n params: {\n factory: createApiFactory({\n api: oktaAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OktaAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'gitlab-auth',\n params: {\n factory: createApiFactory({\n api: gitlabAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GitlabAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'onelogin-auth',\n params: {\n factory: createApiFactory({\n api: oneloginAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OneLoginAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'bitbucket-auth',\n params: {\n factory: createApiFactory({\n api: bitbucketAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['account'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'bitbucket-server-auth',\n params: {\n factory: createApiFactory({\n api: bitbucketServerAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketServerAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['REPO_READ'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'atlassian-auth',\n params: {\n factory: createApiFactory({\n api: atlassianAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return AtlassianAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'vmware-cloud-auth',\n params: {\n factory: createApiFactory({\n api: vmwareCloudAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return VMwareCloudAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'permission',\n params: {\n factory: createApiFactory({\n api: permissionApiRef,\n deps: {\n discovery: discoveryApiRef,\n identity: identityApiRef,\n config: configApiRef,\n },\n factory: ({ config, discovery, identity }) =>\n IdentityPermissionApi.create({ config, discovery, identity }),\n }),\n },\n }),\n ApiBlueprint.make({\n name: 'scm-auth',\n params: {\n factory: ScmAuth.createDefaultApiFactory(),\n },\n }),\n ApiBlueprint.make({\n name: 'scm-integrations',\n params: {\n factory: createApiFactory({\n api: scmIntegrationsApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi),\n }),\n },\n }),\n] as const;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EO,MAAM,IAAO,GAAA;AAAA,EAClB,aAAa,IAAK,CAAA;AAAA,IAChB,IAAM,EAAA,QAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,YAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MAAM,IAAI,gBAAiB;AAAA,OACrC;AAAA;AACH,GACD,CAAA;AAAA,EACD,aAAa,IAAK,CAAA;AAAA,IAChB,IAAM,EAAA,WAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,eAAA;AAAA,QACL,IAAA,EAAM,EAAE,SAAA,EAAW,YAAa,EAAA;AAAA,QAChC,OAAS,EAAA,CAAC,EAAE,SAAA,OACV,mBAAoB,CAAA,OAAA;AAAA,UAClB,CAAG,EAAA,SAAA,CAAU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eAAA;AAAA,YACA,WAAA,EAAa,SAAU,CAAA,iBAAA,CAAkB,kBAAkB;AAAA,WAC5D,CAAA;AAAA;AACH,OACD;AAAA;AACH,GACD,CAAA;AAAA,EACD,aAAa,IAAK,CAAA;AAAA,IAChB,IAAM,EAAA,YAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,gBAAA;AAAA,QACL,IAAM,EAAA;AAAA,UACJ,SAAW,EAAA,eAAA;AAAA,UACX,QAAU,EAAA,cAAA;AAAA,UACV,MAAQ,EAAA;AAAA,SACV;AAAA,QACA,OAAS,EAAA,CAAC,EAAE,MAAA,EAAQ,SAAW,EAAA,QAAA,EAC7B,KAAA,qBAAA,CAAsB,MAAO,CAAA,EAAE,MAAQ,EAAA,SAAA,EAAW,UAAU;AAAA,OAC/D;AAAA;AACH,GACD,CAAA;AAAA,EACD,aAAa,IAAK,CAAA;AAAA,IAChB,IAAM,EAAA,UAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,OAAA,EAAS,QAAQ,uBAAwB;AAAA;AAC3C,GACD,CAAA;AAAA,EACD,aAAa,IAAK,CAAA;AAAA,IAChB,IAAM,EAAA,kBAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,SAAS,gBAAiB,CAAA;AAAA,QACxB,GAAK,EAAA,qBAAA;AAAA,QACL,IAAA,EAAM,EAAE,SAAA,EAAW,YAAa,EAAA;AAAA,QAChC,SAAS,CAAC,EAAE,WAAgB,KAAA,kBAAA,CAAmB,WAAW,SAAS;AAAA,OACpE;AAAA;AACH,GACD;AACH;;;;"}
@@ -142,7 +142,7 @@ function AppRouter(props) {
142
142
  },
143
143
  { signOutTargetUrl: basePath || "/" }
144
144
  );
145
- return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), children);
145
+ return /* @__PURE__ */ React.createElement(RouterComponent, null, ...extraElements, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), children);
146
146
  }
147
147
  return /* @__PURE__ */ React.createElement(RouterComponent, null, ...extraElements, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), /* @__PURE__ */ React.createElement(
148
148
  SignInPageWrapper,
@@ -1 +1 @@
1
- {"version":3,"file":"AppRoot.esm.js","sources":["../../src/extensions/AppRoot.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentType,\n PropsWithChildren,\n ReactNode,\n useState,\n} from 'react';\nimport {\n AppRootWrapperBlueprint,\n RouterBlueprint,\n SignInPageBlueprint,\n coreExtensionData,\n discoveryApiRef,\n fetchApiRef,\n errorApiRef,\n createExtension,\n createExtensionInput,\n routeResolutionApiRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n DiscoveryApi,\n ErrorApi,\n FetchApi,\n IdentityApi,\n ProfileInfo,\n SignInPageProps,\n configApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { isProtectedApp } from '../../../../packages/core-app-api/src/app/isProtectedApp';\nimport { BrowserRouter } from 'react-router-dom';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { RouteTracker } from '../../../../packages/frontend-app-api/src/routing/RouteTracker';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { getBasePath } from '../../../../packages/frontend-app-api/src/routing/getBasePath';\n\nexport const AppRoot = createExtension({\n name: 'root',\n attachTo: { id: 'app', input: 'root' },\n inputs: {\n router: createExtensionInput([RouterBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n signInPage: createExtensionInput([SignInPageBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n children: createExtensionInput([coreExtensionData.reactElement], {\n singleton: true,\n }),\n elements: createExtensionInput([coreExtensionData.reactElement]),\n wrappers: createExtensionInput([\n AppRootWrapperBlueprint.dataRefs.component,\n ]),\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs, apis }) {\n if (isProtectedApp()) {\n const identityApi = apis.get(identityApiRef);\n if (!identityApi) {\n throw new Error('App requires an Identity API implementation');\n }\n const appIdentityProxy = toAppIdentityProxy(identityApi);\n const discoveryApi = apis.get(discoveryApiRef);\n const errorApi = apis.get(errorApiRef);\n const fetchApi = apis.get(fetchApiRef);\n if (!discoveryApi || !errorApi || !fetchApi) {\n throw new Error(\n 'App is running in protected mode but missing required APIs',\n );\n }\n appIdentityProxy.enableCookieAuth({\n discoveryApi,\n errorApi,\n fetchApi,\n });\n }\n\n let content: React.ReactNode = inputs.children.get(\n coreExtensionData.reactElement,\n );\n\n for (const wrapper of inputs.wrappers) {\n const Component = wrapper.get(AppRootWrapperBlueprint.dataRefs.component);\n content = <Component>{content}</Component>;\n }\n\n return [\n coreExtensionData.reactElement(\n <AppRouter\n SignInPageComponent={inputs.signInPage?.get(\n SignInPageBlueprint.dataRefs.component,\n )}\n RouterComponent={inputs.router?.get(\n RouterBlueprint.dataRefs.component,\n )}\n extraElements={inputs.elements?.map(el =>\n el.get(coreExtensionData.reactElement),\n )}\n >\n {content}\n </AppRouter>,\n ),\n ];\n },\n});\n\n// This wraps the sign-in page and waits for sign-in to be completed before rendering the app\nfunction SignInPageWrapper({\n component: Component,\n appIdentityProxy,\n children,\n}: {\n component: ComponentType<SignInPageProps>;\n appIdentityProxy: AppIdentityProxy;\n children: ReactNode;\n}) {\n const [identityApi, setIdentityApi] = useState<IdentityApi>();\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n\n if (!identityApi) {\n return <Component onSignInSuccess={setIdentityApi} />;\n }\n\n appIdentityProxy.setTarget(identityApi, {\n signOutTargetUrl: basePath || '/',\n });\n return <>{children}</>;\n}\n\ntype AppIdentityProxy = IdentityApi & {\n enableCookieAuth(ctx: {\n errorApi: ErrorApi;\n fetchApi: FetchApi;\n discoveryApi: DiscoveryApi;\n }): void;\n setTarget(\n impl: IdentityApi & /* backwards compat stuff */ {\n getUserId?(): string;\n getIdToken?(): Promise<string | undefined>;\n getProfile?(): ProfileInfo;\n },\n options: { signOutTargetUrl: string },\n ): void;\n};\n\nfunction toAppIdentityProxy(identityApi: IdentityApi): AppIdentityProxy {\n if (!('enableCookieAuth' in identityApi)) {\n throw new Error('Unexpected Identity API implementation');\n }\n return identityApi as AppIdentityProxy;\n}\n\ntype RouteResolverProxy = {\n getRouteObjects(): any[];\n};\n\n/**\n * Props for the {@link AppRouter} component.\n * @public\n */\nexport interface AppRouterProps {\n children?: ReactNode;\n SignInPageComponent?: ComponentType<SignInPageProps>;\n RouterComponent?: ComponentType<PropsWithChildren<{}>>;\n extraElements?: Array<React.JSX.Element>;\n}\n\nfunction DefaultRouter(props: PropsWithChildren<{}>) {\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n return <BrowserRouter basename={basePath}>{props.children}</BrowserRouter>;\n}\n\n/**\n * App router and sign-in page wrapper.\n *\n * @remarks\n *\n * The AppRouter provides the routing context and renders the sign-in page.\n * Until the user has successfully signed in, this component will render\n * the sign-in page. Once the user has signed-in, it will instead render\n * the app, while providing routing and route tracking for the app.\n */\nexport function AppRouter(props: AppRouterProps) {\n const {\n children,\n SignInPageComponent,\n RouterComponent = DefaultRouter,\n extraElements = [],\n } = props;\n\n const configApi = useApi(configApiRef);\n const appIdentityProxy = toAppIdentityProxy(useApi(identityApiRef));\n const routeResolutionsApi = useApi(routeResolutionApiRef);\n const basePath = getBasePath(configApi);\n\n // TODO: Private access for now, probably replace with path -> node lookup method on the API\n if (!('getRouteObjects' in routeResolutionsApi)) {\n throw new Error('Unexpected route resolution API implementation');\n }\n const routeObjects = (\n routeResolutionsApi as RouteResolverProxy\n ).getRouteObjects();\n\n // If the app hasn't configured a sign-in page, we just continue as guest.\n if (!SignInPageComponent) {\n appIdentityProxy.setTarget(\n {\n getUserId: () => 'guest',\n getIdToken: async () => undefined,\n getProfile: () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getProfileInfo: async () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getBackstageIdentity: async () => ({\n type: 'user',\n userEntityRef: 'user:default/guest',\n ownershipEntityRefs: ['user:default/guest'],\n }),\n getCredentials: async () => ({}),\n signOut: async () => {},\n },\n { signOutTargetUrl: basePath || '/' },\n );\n\n return (\n <RouterComponent>\n <RouteTracker routeObjects={routeObjects} />\n {children}\n </RouterComponent>\n );\n }\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n <SignInPageWrapper\n component={SignInPageComponent}\n appIdentityProxy={appIdentityProxy}\n >\n {children}\n </SignInPageWrapper>\n </RouterComponent>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAqDO,MAAM,UAAU,eAAgB,CAAA;AAAA,EACrC,IAAM,EAAA,MAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,KAAA,EAAO,OAAO,MAAO,EAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,QAAQ,oBAAqB,CAAA,CAAC,eAAgB,CAAA,QAAA,CAAS,SAAS,CAAG,EAAA;AAAA,MACjE,SAAW,EAAA,IAAA;AAAA,MACX,QAAU,EAAA;AAAA,KACX,CAAA;AAAA,IACD,YAAY,oBAAqB,CAAA,CAAC,mBAAoB,CAAA,QAAA,CAAS,SAAS,CAAG,EAAA;AAAA,MACzE,SAAW,EAAA,IAAA;AAAA,MACX,QAAU,EAAA;AAAA,KACX,CAAA;AAAA,IACD,QAAU,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAG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IAAM,EAAA,MAAA;AAAA,UACN,aAAe,EAAA,oBAAA;AAAA,UACf,mBAAA,EAAqB,CAAC,oBAAoB;AAAA,SAC5C,CAAA;AAAA,QACA,cAAA,EAAgB,aAAa,EAAC,CAAA;AAAA,QAC9B,SAAS,YAAY;AAAA;AAAC,OACxB;AAAA,MACA,EAAE,gBAAkB,EAAA,QAAA,IAAY,GAAI;AAAA,KACtC;AAEA,IAAA,2CACG,eACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,YAAA,EAA4B,GACzC,QACH,CAAA;AAAA;AAIJ,EAAA,2CACG,eACE,EAAA,IAAA,EAAA,GAAG,+BACH,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,cAA4B,CAC1C,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,mBAAA;AAAA,MACX;AAAA,KAAA;AAAA,IAEC;AAAA,GAEL,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"AppRoot.esm.js","sources":["../../src/extensions/AppRoot.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentType,\n PropsWithChildren,\n ReactNode,\n useState,\n} from 'react';\nimport {\n AppRootWrapperBlueprint,\n RouterBlueprint,\n SignInPageBlueprint,\n coreExtensionData,\n discoveryApiRef,\n fetchApiRef,\n errorApiRef,\n createExtension,\n createExtensionInput,\n routeResolutionApiRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n DiscoveryApi,\n ErrorApi,\n FetchApi,\n IdentityApi,\n ProfileInfo,\n SignInPageProps,\n configApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { isProtectedApp } from '../../../../packages/core-app-api/src/app/isProtectedApp';\nimport { BrowserRouter } from 'react-router-dom';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { RouteTracker } from '../../../../packages/frontend-app-api/src/routing/RouteTracker';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { getBasePath } from '../../../../packages/frontend-app-api/src/routing/getBasePath';\n\nexport const AppRoot = createExtension({\n name: 'root',\n attachTo: { id: 'app', input: 'root' },\n inputs: {\n router: createExtensionInput([RouterBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n signInPage: createExtensionInput([SignInPageBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n children: createExtensionInput([coreExtensionData.reactElement], {\n singleton: true,\n }),\n elements: createExtensionInput([coreExtensionData.reactElement]),\n wrappers: createExtensionInput([\n AppRootWrapperBlueprint.dataRefs.component,\n ]),\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs, apis }) {\n if (isProtectedApp()) {\n const identityApi = apis.get(identityApiRef);\n if (!identityApi) {\n throw new Error('App requires an Identity API implementation');\n }\n const appIdentityProxy = toAppIdentityProxy(identityApi);\n const discoveryApi = apis.get(discoveryApiRef);\n const errorApi = apis.get(errorApiRef);\n const fetchApi = apis.get(fetchApiRef);\n if (!discoveryApi || !errorApi || !fetchApi) {\n throw new Error(\n 'App is running in protected mode but missing required APIs',\n );\n }\n appIdentityProxy.enableCookieAuth({\n discoveryApi,\n errorApi,\n fetchApi,\n });\n }\n\n let content: React.ReactNode = inputs.children.get(\n coreExtensionData.reactElement,\n );\n\n for (const wrapper of inputs.wrappers) {\n const Component = wrapper.get(AppRootWrapperBlueprint.dataRefs.component);\n content = <Component>{content}</Component>;\n }\n\n return [\n coreExtensionData.reactElement(\n <AppRouter\n SignInPageComponent={inputs.signInPage?.get(\n SignInPageBlueprint.dataRefs.component,\n )}\n RouterComponent={inputs.router?.get(\n RouterBlueprint.dataRefs.component,\n )}\n extraElements={inputs.elements?.map(el =>\n el.get(coreExtensionData.reactElement),\n )}\n >\n {content}\n </AppRouter>,\n ),\n ];\n },\n});\n\n// This wraps the sign-in page and waits for sign-in to be completed before rendering the app\nfunction SignInPageWrapper({\n component: Component,\n appIdentityProxy,\n children,\n}: {\n component: ComponentType<SignInPageProps>;\n appIdentityProxy: AppIdentityProxy;\n children: ReactNode;\n}) {\n const [identityApi, setIdentityApi] = useState<IdentityApi>();\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n\n if (!identityApi) {\n return <Component onSignInSuccess={setIdentityApi} />;\n }\n\n appIdentityProxy.setTarget(identityApi, {\n signOutTargetUrl: basePath || '/',\n });\n return <>{children}</>;\n}\n\ntype AppIdentityProxy = IdentityApi & {\n enableCookieAuth(ctx: {\n errorApi: ErrorApi;\n fetchApi: FetchApi;\n discoveryApi: DiscoveryApi;\n }): void;\n setTarget(\n impl: IdentityApi & /* backwards compat stuff */ {\n getUserId?(): string;\n getIdToken?(): Promise<string | undefined>;\n getProfile?(): ProfileInfo;\n },\n options: { signOutTargetUrl: string },\n ): void;\n};\n\nfunction toAppIdentityProxy(identityApi: IdentityApi): AppIdentityProxy {\n if (!('enableCookieAuth' in identityApi)) {\n throw new Error('Unexpected Identity API implementation');\n }\n return identityApi as AppIdentityProxy;\n}\n\ntype RouteResolverProxy = {\n getRouteObjects(): any[];\n};\n\n/**\n * Props for the {@link AppRouter} component.\n * @public\n */\nexport interface AppRouterProps {\n children?: ReactNode;\n SignInPageComponent?: ComponentType<SignInPageProps>;\n RouterComponent?: ComponentType<PropsWithChildren<{}>>;\n extraElements?: Array<React.JSX.Element>;\n}\n\nfunction DefaultRouter(props: PropsWithChildren<{}>) {\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n return <BrowserRouter basename={basePath}>{props.children}</BrowserRouter>;\n}\n\n/**\n * App router and sign-in page wrapper.\n *\n * @remarks\n *\n * The AppRouter provides the routing context and renders the sign-in page.\n * Until the user has successfully signed in, this component will render\n * the sign-in page. Once the user has signed-in, it will instead render\n * the app, while providing routing and route tracking for the app.\n */\nexport function AppRouter(props: AppRouterProps) {\n const {\n children,\n SignInPageComponent,\n RouterComponent = DefaultRouter,\n extraElements = [],\n } = props;\n\n const configApi = useApi(configApiRef);\n const appIdentityProxy = toAppIdentityProxy(useApi(identityApiRef));\n const routeResolutionsApi = useApi(routeResolutionApiRef);\n const basePath = getBasePath(configApi);\n\n // TODO: Private access for now, probably replace with path -> node lookup method on the API\n if (!('getRouteObjects' in routeResolutionsApi)) {\n throw new Error('Unexpected route resolution API implementation');\n }\n const routeObjects = (\n routeResolutionsApi as RouteResolverProxy\n ).getRouteObjects();\n\n // If the app hasn't configured a sign-in page, we just continue as guest.\n if (!SignInPageComponent) {\n appIdentityProxy.setTarget(\n {\n getUserId: () => 'guest',\n getIdToken: async () => undefined,\n getProfile: () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getProfileInfo: async () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getBackstageIdentity: async () => ({\n type: 'user',\n userEntityRef: 'user:default/guest',\n ownershipEntityRefs: ['user:default/guest'],\n }),\n getCredentials: async () => ({}),\n signOut: async () => {},\n },\n { signOutTargetUrl: basePath || '/' },\n );\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n {children}\n </RouterComponent>\n );\n }\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n <SignInPageWrapper\n component={SignInPageComponent}\n appIdentityProxy={appIdentityProxy}\n >\n {children}\n </SignInPageWrapper>\n </RouterComponent>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAqDO,MAAM,UAAU,eAAgB,CAAA;AAAA,EACrC,IAAM,EAAA,M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,IAAM,MAAA,IAAI,MAAM,gDAAgD,CAAA;AAAA;AAElE,EAAM,MAAA,YAAA,GACJ,oBACA,eAAgB,EAAA;AAGlB,EAAA,IAAI,CAAC,mBAAqB,EAAA;AACxB,IAAiB,gBAAA,CAAA,SAAA;AAAA,MACf;AAAA,QACE,WAAW,MAAM,OAAA;AAAA,QACjB,YAAY,YAAY,KAAA,CAAA;AAAA,QACxB,YAAY,OAAO;AAAA,UACjB,KAAO,EAAA,mBAAA;AAAA,UACP,WAAa,EAAA;AAAA,SACf,CAAA;AAAA,QACA,gBAAgB,aAAa;AAAA,UAC3B,KAAO,EAAA,mBAAA;AAAA,UACP,WAAa,EAAA;AAAA,SACf,CAAA;AAAA,QACA,sBAAsB,aAAa;AAAA,UACjC,IAAM,EAAA,MAAA;AAAA,UACN,aAAe,EAAA,oBAAA;AAAA,UACf,mBAAA,EAAqB,CAAC,oBAAoB;AAAA,SAC5C,CAAA;AAAA,QACA,cAAA,EAAgB,aAAa,EAAC,CAAA;AAAA,QAC9B,SAAS,YAAY;AAAA;AAAC,OACxB;AAAA,MACA,EAAE,gBAAkB,EAAA,QAAA,IAAY,GAAI;AAAA,KACtC;AAEA,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,uBACE,GAAG,aAAA,sCACH,YAAa,EAAA,EAAA,YAAA,EAA4B,GACzC,QACH,CAAA;AAAA;AAIJ,EAAA,2CACG,eACE,EAAA,IAAA,EAAA,GAAG,+BACH,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,cAA4B,CAC1C,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,mBAAA;AAAA,MACX;AAAA,KAAA;AAAA,IAEC;AAAA,GAEL,CAAA;AAEJ;;;;"}
@@ -0,0 +1,80 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { AppRootElementBlueprint, dialogApiRef } from '@backstage/frontend-plugin-api';
3
+ import { createDeferred } from '@backstage/types';
4
+ import Dialog from '@material-ui/core/Dialog';
5
+
6
+ let dialogId = 0;
7
+ function getDialogId() {
8
+ dialogId += 1;
9
+ return dialogId.toString(36);
10
+ }
11
+ function DialogDisplay({
12
+ dialogApi
13
+ }) {
14
+ const [dialogs, setDialogs] = useState([]);
15
+ useEffect(() => {
16
+ dialogApi.connect((options) => {
17
+ const id = getDialogId();
18
+ const deferred = createDeferred();
19
+ const dialog = {
20
+ id,
21
+ modal: options.modal,
22
+ close(result) {
23
+ deferred.resolve(result);
24
+ setDialogs((ds) => ds.filter((d) => d.dialog.id !== id));
25
+ },
26
+ update(ElementOrComponent) {
27
+ const element2 = typeof ElementOrComponent === "function" ? /* @__PURE__ */ React.createElement(ElementOrComponent, { dialog }) : ElementOrComponent;
28
+ setDialogs(
29
+ (ds) => ds.map((d) => d.dialog.id === id ? { dialog, element: element2 } : d)
30
+ );
31
+ },
32
+ async result() {
33
+ return deferred;
34
+ }
35
+ };
36
+ const element = /* @__PURE__ */ React.createElement(options.component, { dialog });
37
+ setDialogs((ds) => [...ds, { dialog, element }]);
38
+ return dialog;
39
+ });
40
+ }, [dialogApi]);
41
+ if (dialogs.length > 0) {
42
+ const lastDialog = dialogs[dialogs.length - 1];
43
+ return /* @__PURE__ */ React.createElement(
44
+ Dialog,
45
+ {
46
+ open: true,
47
+ onClose: () => {
48
+ if (!lastDialog.dialog.modal) {
49
+ lastDialog.dialog.close();
50
+ }
51
+ }
52
+ },
53
+ lastDialog.element
54
+ );
55
+ }
56
+ return null;
57
+ }
58
+ const dialogDisplayAppRootElement = AppRootElementBlueprint.makeWithOverrides({
59
+ name: "dialog-display",
60
+ factory(originalFactory, { apis }) {
61
+ const dialogApi = apis.get(dialogApiRef);
62
+ if (!isInternalDialogApi(dialogApi)) {
63
+ return originalFactory({
64
+ element: /* @__PURE__ */ React.createElement(React.Fragment, null)
65
+ });
66
+ }
67
+ return originalFactory({
68
+ element: /* @__PURE__ */ React.createElement(DialogDisplay, { dialogApi })
69
+ });
70
+ }
71
+ });
72
+ function isInternalDialogApi(dialogApi) {
73
+ if (!dialogApi) {
74
+ return false;
75
+ }
76
+ return "connect" in dialogApi;
77
+ }
78
+
79
+ export { dialogDisplayAppRootElement };
80
+ //# sourceMappingURL=DialogDisplay.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogDisplay.esm.js","sources":["../../src/extensions/DialogDisplay.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState } from 'react';\nimport {\n AppRootElementBlueprint,\n DialogApi,\n DialogApiDialog,\n dialogApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { createDeferred } from '@backstage/types';\nimport { OnShowDialog } from '../apis/DefaultDialogApi';\nimport Dialog from '@material-ui/core/Dialog';\n\nlet dialogId = 0;\nfunction getDialogId() {\n dialogId += 1;\n return dialogId.toString(36);\n}\n\ntype DialogState = DialogApiDialog & {\n id: string;\n modal: boolean;\n};\n\n/**\n * The other half of the default implementation of the {@link DialogApi}.\n *\n * This component is responsible for rendering the dialogs in the React tree and managing a stack of dialogs.\n * It expects the implementation of the {@link DialogApi} to be the `DefaultDialogApi`. If one is replaced the other must be too.\n * @internal\n */\nfunction DialogDisplay({\n dialogApi,\n}: {\n dialogApi: DialogApi & { connect(onShow: OnShowDialog): void };\n}) {\n const [dialogs, setDialogs] = useState<\n { dialog: DialogState; element: React.JSX.Element }[]\n >([]);\n\n useEffect(() => {\n dialogApi.connect(options => {\n const id = getDialogId();\n const deferred = createDeferred<unknown>();\n const dialog: DialogState = {\n id,\n modal: options.modal,\n close(result) {\n deferred.resolve(result);\n setDialogs(ds => ds.filter(d => d.dialog.id !== id));\n },\n update(ElementOrComponent) {\n const element =\n typeof ElementOrComponent === 'function' ? (\n <ElementOrComponent dialog={dialog} />\n ) : (\n ElementOrComponent\n );\n setDialogs(ds =>\n ds.map(d => (d.dialog.id === id ? { dialog, element } : d)),\n );\n },\n async result() {\n return deferred;\n },\n };\n const element = <options.component dialog={dialog} />;\n setDialogs(ds => [...ds, { dialog, element }]);\n return dialog;\n });\n }, [dialogApi]);\n\n if (dialogs.length > 0) {\n const lastDialog = dialogs[dialogs.length - 1];\n return (\n <Dialog\n open\n onClose={() => {\n if (!lastDialog.dialog.modal) {\n lastDialog.dialog.close();\n }\n }}\n >\n {lastDialog.element}\n </Dialog>\n );\n }\n\n return null;\n}\n\nexport const dialogDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n name: 'dialog-display',\n factory(originalFactory, { apis }) {\n const dialogApi = apis.get(dialogApiRef);\n if (!isInternalDialogApi(dialogApi)) {\n return originalFactory({\n element: <React.Fragment />,\n });\n }\n return originalFactory({\n element: <DialogDisplay dialogApi={dialogApi} />,\n });\n },\n });\n\nfunction isInternalDialogApi(\n dialogApi?: DialogApi,\n): dialogApi is DialogApi & { connect(onShow: OnShowDialog): void } {\n if (!dialogApi) {\n return false;\n }\n return 'connect' in dialogApi;\n}\n"],"names":["element"],"mappings":";;;;;AA2BA,IAAI,QAAW,GAAA,CAAA;AACf,SAAS,WAAc,GAAA;AACrB,EAAY,QAAA,IAAA,CAAA;AACZ,EAAO,OAAA,QAAA,CAAS,SAAS,EAAE,CAAA;AAC7B;AAcA,SAAS,aAAc,CAAA;AAAA,EACrB;AACF,CAEG,EAAA;AACD,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,QAAA,CAE5B,EAAE,CAAA;AAEJ,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,SAAA,CAAU,QAAQ,CAAW,OAAA,KAAA;AAC3B,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A;AAC7C,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,IAAI,EAAA,IAAA;AAAA,QACJ,SAAS,MAAM;AACb,UAAI,IAAA,CAAC,UAAW,CAAA,MAAA,CAAO,KAAO,EAAA;AAC5B,YAAA,UAAA,CAAW,OAAO,KAAM,EAAA;AAAA;AAC1B;AACF,OAAA;AAAA,MAEC,UAAW,CAAA;AAAA,KACd;AAAA;AAIJ,EAAO,OAAA,IAAA;AACT;AAEa,MAAA,2BAAA,GACX,wBAAwB,iBAAkB,CAAA;AAAA,EACxC,IAAM,EAAA,gBAAA;AAAA,EACN,OAAQ,CAAA,eAAA,EAAiB,EAAE,IAAA,EAAQ,EAAA;AACjC,IAAM,MAAA,SAAA,GAAY,IAAK,CAAA,GAAA,CAAI,YAAY,CAAA;AACvC,IAAI,IAAA,CAAC,mBAAoB,CAAA,SAAS,CAAG,EAAA;AACnC,MAAA,OAAO,eAAgB,CAAA;AAAA,QACrB,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,CAAA,QAAA,EAAN,IAAe;AAAA,OAC1B,CAAA;AAAA;AAEH,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,SAAsB,EAAA;AAAA,KAC/C,CAAA;AAAA;AAEL,CAAC;AAEH,SAAS,oBACP,SACkE,EAAA;AAClE,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAO,OAAA,KAAA;AAAA;AAET,EAAA,OAAO,SAAa,IAAA,SAAA;AACtB;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
2
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
4
3
  import * as react from 'react';
@@ -19,18 +18,6 @@ declare const appPlugin: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
19
18
  kind: undefined;
20
19
  name: undefined;
21
20
  }>;
22
- "api:app/app-language": _backstage_frontend_plugin_api.ExtensionDefinition<{
23
- kind: "api";
24
- name: "app-language";
25
- config: {};
26
- configInput: {};
27
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
28
- inputs: {};
29
- params: {
30
- /** @public */
31
- factory: _backstage_frontend_plugin_api.AnyApiFactory;
32
- };
33
- }>;
34
21
  "app/layout": _backstage_frontend_plugin_api.ExtensionDefinition<{
35
22
  config: {};
36
23
  configInput: {};
@@ -63,8 +50,8 @@ declare const appPlugin: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
63
50
  optional: false;
64
51
  }>;
65
52
  logos: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
66
- logoIcon?: JSX.Element | undefined;
67
- logoFull?: JSX.Element | undefined;
53
+ logoIcon?: JSX.Element;
54
+ logoFull?: JSX.Element;
68
55
  }, "core.nav-logo.logo-elements", {}>, {
69
56
  singleton: true;
70
57
  optional: true;
@@ -80,7 +67,7 @@ declare const appPlugin: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
80
67
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
81
68
  inputs: {
82
69
  router: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.ComponentType<{
83
- children?: react.ReactNode;
70
+ children?: react.ReactNode | undefined;
84
71
  }>, "app.router.wrapper", {}>, {
85
72
  singleton: true;
86
73
  optional: true;
@@ -98,7 +85,7 @@ declare const appPlugin: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
98
85
  optional: false;
99
86
  }>;
100
87
  wrappers: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.ComponentType<{
101
- children?: react.ReactNode;
88
+ children?: react.ReactNode | undefined;
102
89
  }>, "app.root.wrapper", {}>, {
103
90
  singleton: false;
104
91
  optional: false;
@@ -124,163 +111,116 @@ declare const appPlugin: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
124
111
  kind: undefined;
125
112
  name: "routes";
126
113
  }>;
127
- "api:app/app-theme": _backstage_frontend_plugin_api.ExtensionDefinition<{
114
+ "api:app/alert": _backstage_frontend_plugin_api.ExtensionDefinition<{
115
+ kind: "api";
116
+ name: "alert";
128
117
  config: {};
129
118
  configInput: {};
130
119
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
131
- inputs: {
132
- themes: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AppTheme, "core.theme.theme", {}>, {
133
- singleton: false;
134
- optional: false;
135
- }>;
136
- };
137
- kind: "api";
138
- name: "app-theme";
120
+ inputs: {};
139
121
  params: {
140
- /** @public */
141
122
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
142
123
  };
143
124
  }>;
144
- "theme:app/light": _backstage_frontend_plugin_api.ExtensionDefinition<{
145
- kind: "theme";
146
- name: "light";
125
+ "api:app/analytics": _backstage_frontend_plugin_api.ExtensionDefinition<{
126
+ kind: "api";
127
+ name: "analytics";
147
128
  config: {};
148
129
  configInput: {};
149
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AppTheme, "core.theme.theme", {}>;
130
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
150
131
  inputs: {};
151
132
  params: {
152
- theme: _backstage_frontend_plugin_api.AppTheme;
133
+ factory: _backstage_frontend_plugin_api.AnyApiFactory;
153
134
  };
154
135
  }>;
155
- "theme:app/dark": _backstage_frontend_plugin_api.ExtensionDefinition<{
156
- kind: "theme";
157
- name: "dark";
136
+ "api:app/app-language": _backstage_frontend_plugin_api.ExtensionDefinition<{
137
+ kind: "api";
138
+ name: "app-language";
158
139
  config: {};
159
140
  configInput: {};
160
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AppTheme, "core.theme.theme", {}>;
141
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
161
142
  inputs: {};
162
143
  params: {
163
- theme: _backstage_frontend_plugin_api.AppTheme;
144
+ factory: _backstage_frontend_plugin_api.AnyApiFactory;
164
145
  };
165
146
  }>;
166
- "api:app/components": _backstage_frontend_plugin_api.ExtensionDefinition<{
147
+ "api:app/app-theme": _backstage_frontend_plugin_api.ExtensionDefinition<{
167
148
  config: {};
168
149
  configInput: {};
169
150
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
170
151
  inputs: {
171
- components: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
172
- ref: _backstage_frontend_plugin_api.ComponentRef;
173
- impl: react.ComponentType;
174
- }, "core.component.component", {}>, {
152
+ themes: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AppTheme, "core.theme.theme", {}>, {
175
153
  singleton: false;
176
154
  optional: false;
177
155
  }>;
178
156
  };
179
157
  kind: "api";
180
- name: "components";
158
+ name: "app-theme";
181
159
  params: {
182
- /** @public */
183
160
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
184
161
  };
185
162
  }>;
186
- "api:app/icons": _backstage_frontend_plugin_api.ExtensionDefinition<{
163
+ "api:app/atlassian-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
164
+ kind: "api";
165
+ name: "atlassian-auth";
187
166
  config: {};
188
167
  configInput: {};
189
168
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
190
- inputs: {
191
- icons: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
192
- [x: string]: _backstage_frontend_plugin_api.IconComponent;
193
- }, "core.icons", {}>, {
194
- singleton: false;
195
- optional: false;
196
- }>;
169
+ inputs: {};
170
+ params: {
171
+ factory: _backstage_frontend_plugin_api.AnyApiFactory;
197
172
  };
173
+ }>;
174
+ "api:app/bitbucket-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
198
175
  kind: "api";
199
- name: "icons";
176
+ name: "bitbucket-auth";
177
+ config: {};
178
+ configInput: {};
179
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
180
+ inputs: {};
200
181
  params: {
201
- /** @public */
202
182
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
203
183
  };
204
184
  }>;
205
- "api:app/feature-flags": _backstage_frontend_plugin_api.ExtensionDefinition<{
185
+ "api:app/bitbucket-server-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
206
186
  kind: "api";
207
- name: "feature-flags";
187
+ name: "bitbucket-server-auth";
208
188
  config: {};
209
189
  configInput: {};
210
190
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
211
191
  inputs: {};
212
192
  params: {
213
- /** @public */
214
193
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
215
194
  };
216
195
  }>;
217
- "api:app/translations": _backstage_frontend_plugin_api.ExtensionDefinition<{
196
+ "api:app/components": _backstage_frontend_plugin_api.ExtensionDefinition<{
218
197
  config: {};
219
198
  configInput: {};
220
199
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
221
200
  inputs: {
222
- translations: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.TranslationResource<string> | _backstage_frontend_plugin_api.TranslationMessages<string, {
223
- [x: string]: string;
224
- }, boolean>, "core.translation.translation", {}>, {
201
+ components: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
202
+ ref: _backstage_frontend_plugin_api.ComponentRef;
203
+ impl: react.ComponentType;
204
+ }, "core.component.component", {}>, {
225
205
  singleton: false;
226
206
  optional: false;
227
207
  }>;
228
208
  };
229
209
  kind: "api";
230
- name: "translations";
210
+ name: "components";
231
211
  params: {
232
- /** @public */
233
212
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
234
213
  };
235
214
  }>;
236
- "sign-in-page:app": _backstage_frontend_plugin_api.ExtensionDefinition<{
237
- kind: "sign-in-page";
238
- name: undefined;
239
- config: {};
240
- configInput: {};
241
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.ComponentType<_backstage_core_plugin_api.SignInPageProps>, "core.sign-in-page.component", {}>;
242
- inputs: {};
243
- params: {
244
- loader: () => Promise<react.ComponentType<_backstage_core_plugin_api.SignInPageProps>>;
245
- };
246
- }>;
247
- "app-root-element:app/oauth-request-dialog": _backstage_frontend_plugin_api.ExtensionDefinition<{
248
- kind: "app-root-element";
249
- name: "oauth-request-dialog";
215
+ "api:app/dialog": _backstage_frontend_plugin_api.ExtensionDefinition<{
216
+ kind: "api";
217
+ name: "dialog";
250
218
  config: {};
251
219
  configInput: {};
252
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
220
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
253
221
  inputs: {};
254
222
  params: {
255
- element: JSX.Element | (() => JSX.Element);
256
- };
257
- }>;
258
- "app-root-element:app/alert-display": _backstage_frontend_plugin_api.ExtensionDefinition<{
259
- config: {
260
- transientTimeoutMs: number;
261
- anchorOrigin: {
262
- horizontal: "center" | "left" | "right";
263
- vertical: "top" | "bottom";
264
- };
265
- };
266
- configInput: {
267
- anchorOrigin?: {
268
- horizontal?: "center" | "left" | "right" | undefined;
269
- vertical?: "top" | "bottom" | undefined;
270
- } | undefined;
271
- transientTimeoutMs?: number | undefined;
272
- };
273
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
274
- inputs: {
275
- [x: string]: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.AnyExtensionDataRef, {
276
- optional: boolean;
277
- singleton: boolean;
278
- }>;
279
- };
280
- kind: "app-root-element";
281
- name: "alert-display";
282
- params: {
283
- element: JSX.Element | (() => JSX.Element);
223
+ factory: _backstage_frontend_plugin_api.AnyApiFactory;
284
224
  };
285
225
  }>;
286
226
  "api:app/discovery": _backstage_frontend_plugin_api.ExtensionDefinition<{
@@ -291,91 +231,90 @@ declare const appPlugin: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
291
231
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
292
232
  inputs: {};
293
233
  params: {
294
- /** @public */
295
234
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
296
235
  };
297
236
  }>;
298
- "api:app/alert": _backstage_frontend_plugin_api.ExtensionDefinition<{
237
+ "api:app/error": _backstage_frontend_plugin_api.ExtensionDefinition<{
299
238
  kind: "api";
300
- name: "alert";
239
+ name: "error";
301
240
  config: {};
302
241
  configInput: {};
303
242
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
304
243
  inputs: {};
305
244
  params: {
306
- /** @public */
307
245
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
308
246
  };
309
247
  }>;
310
- "api:app/analytics": _backstage_frontend_plugin_api.ExtensionDefinition<{
248
+ "api:app/feature-flags": _backstage_frontend_plugin_api.ExtensionDefinition<{
311
249
  kind: "api";
312
- name: "analytics";
250
+ name: "feature-flags";
313
251
  config: {};
314
252
  configInput: {};
315
253
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
316
254
  inputs: {};
317
255
  params: {
318
- /** @public */
319
256
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
320
257
  };
321
258
  }>;
322
- "api:app/error": _backstage_frontend_plugin_api.ExtensionDefinition<{
259
+ "api:app/fetch": _backstage_frontend_plugin_api.ExtensionDefinition<{
323
260
  kind: "api";
324
- name: "error";
261
+ name: "fetch";
325
262
  config: {};
326
263
  configInput: {};
327
264
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
328
265
  inputs: {};
329
266
  params: {
330
- /** @public */
331
267
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
332
268
  };
333
269
  }>;
334
- "api:app/storage": _backstage_frontend_plugin_api.ExtensionDefinition<{
270
+ "api:app/github-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
335
271
  kind: "api";
336
- name: "storage";
272
+ name: "github-auth";
337
273
  config: {};
338
274
  configInput: {};
339
275
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
340
276
  inputs: {};
341
277
  params: {
342
- /** @public */
343
278
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
344
279
  };
345
280
  }>;
346
- "api:app/fetch": _backstage_frontend_plugin_api.ExtensionDefinition<{
281
+ "api:app/gitlab-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
347
282
  kind: "api";
348
- name: "fetch";
283
+ name: "gitlab-auth";
349
284
  config: {};
350
285
  configInput: {};
351
286
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
352
287
  inputs: {};
353
288
  params: {
354
- /** @public */
355
289
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
356
290
  };
357
291
  }>;
358
- "api:app/oauth-request": _backstage_frontend_plugin_api.ExtensionDefinition<{
292
+ "api:app/google-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
359
293
  kind: "api";
360
- name: "oauth-request";
294
+ name: "google-auth";
361
295
  config: {};
362
296
  configInput: {};
363
297
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
364
298
  inputs: {};
365
299
  params: {
366
- /** @public */
367
300
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
368
301
  };
369
302
  }>;
370
- "api:app/google-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
371
- kind: "api";
372
- name: "google-auth";
303
+ "api:app/icons": _backstage_frontend_plugin_api.ExtensionDefinition<{
373
304
  config: {};
374
305
  configInput: {};
375
306
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
376
- inputs: {};
307
+ inputs: {
308
+ icons: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
309
+ [x: string]: _backstage_frontend_plugin_api.IconComponent;
310
+ }, "core.icons", {}>, {
311
+ singleton: false;
312
+ optional: false;
313
+ }>;
314
+ };
315
+ kind: "api";
316
+ name: "icons";
377
317
  params: {
378
- /** @public */
379
318
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
380
319
  };
381
320
  }>;
@@ -387,19 +326,17 @@ declare const appPlugin: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
387
326
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
388
327
  inputs: {};
389
328
  params: {
390
- /** @public */
391
329
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
392
330
  };
393
331
  }>;
394
- "api:app/github-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
332
+ "api:app/oauth-request": _backstage_frontend_plugin_api.ExtensionDefinition<{
395
333
  kind: "api";
396
- name: "github-auth";
334
+ name: "oauth-request";
397
335
  config: {};
398
336
  configInput: {};
399
337
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
400
338
  inputs: {};
401
339
  params: {
402
- /** @public */
403
340
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
404
341
  };
405
342
  }>;
@@ -411,67 +348,79 @@ declare const appPlugin: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
411
348
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
412
349
  inputs: {};
413
350
  params: {
414
- /** @public */
415
351
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
416
352
  };
417
353
  }>;
418
- "api:app/gitlab-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
354
+ "api:app/onelogin-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
419
355
  kind: "api";
420
- name: "gitlab-auth";
356
+ name: "onelogin-auth";
421
357
  config: {};
422
358
  configInput: {};
423
359
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
424
360
  inputs: {};
425
361
  params: {
426
- /** @public */
427
362
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
428
363
  };
429
364
  }>;
430
- "api:app/onelogin-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
365
+ "api:app/permission": _backstage_frontend_plugin_api.ExtensionDefinition<{
431
366
  kind: "api";
432
- name: "onelogin-auth";
367
+ name: "permission";
433
368
  config: {};
434
369
  configInput: {};
435
370
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
436
371
  inputs: {};
437
372
  params: {
438
- /** @public */
439
373
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
440
374
  };
441
375
  }>;
442
- "api:app/bitbucket-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
376
+ "api:app/scm-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
443
377
  kind: "api";
444
- name: "bitbucket-auth";
378
+ name: "scm-auth";
445
379
  config: {};
446
380
  configInput: {};
447
381
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
448
382
  inputs: {};
449
383
  params: {
450
- /** @public */
451
384
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
452
385
  };
453
386
  }>;
454
- "api:app/bitbucket-server-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
387
+ "api:app/scm-integrations": _backstage_frontend_plugin_api.ExtensionDefinition<{
455
388
  kind: "api";
456
- name: "bitbucket-server-auth";
389
+ name: "scm-integrations";
457
390
  config: {};
458
391
  configInput: {};
459
392
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
460
393
  inputs: {};
461
394
  params: {
462
- /** @public */
463
395
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
464
396
  };
465
397
  }>;
466
- "api:app/atlassian-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
398
+ "api:app/storage": _backstage_frontend_plugin_api.ExtensionDefinition<{
467
399
  kind: "api";
468
- name: "atlassian-auth";
400
+ name: "storage";
469
401
  config: {};
470
402
  configInput: {};
471
403
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
472
404
  inputs: {};
473
405
  params: {
474
- /** @public */
406
+ factory: _backstage_frontend_plugin_api.AnyApiFactory;
407
+ };
408
+ }>;
409
+ "api:app/translations": _backstage_frontend_plugin_api.ExtensionDefinition<{
410
+ config: {};
411
+ configInput: {};
412
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
413
+ inputs: {
414
+ translations: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.TranslationResource<string> | _backstage_frontend_plugin_api.TranslationMessages<string, {
415
+ [x: string]: string;
416
+ }, boolean>, "core.translation.translation", {}>, {
417
+ singleton: false;
418
+ optional: false;
419
+ }>;
420
+ };
421
+ kind: "api";
422
+ name: "translations";
423
+ params: {
475
424
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
476
425
  };
477
426
  }>;
@@ -483,44 +432,95 @@ declare const appPlugin: _backstage_frontend_plugin_api.FrontendPlugin<{}, {}, {
483
432
  output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
484
433
  inputs: {};
485
434
  params: {
486
- /** @public */
487
435
  factory: _backstage_frontend_plugin_api.AnyApiFactory;
488
436
  };
489
437
  }>;
490
- "api:app/permission": _backstage_frontend_plugin_api.ExtensionDefinition<{
491
- kind: "api";
492
- name: "permission";
438
+ "app-root-element:app/alert-display": _backstage_frontend_plugin_api.ExtensionDefinition<{
439
+ config: {
440
+ transientTimeoutMs: number;
441
+ anchorOrigin: {
442
+ horizontal: "center" | "left" | "right";
443
+ vertical: "top" | "bottom";
444
+ };
445
+ };
446
+ configInput: {
447
+ anchorOrigin?: {
448
+ horizontal?: "center" | "left" | "right" | undefined;
449
+ vertical?: "top" | "bottom" | undefined;
450
+ } | undefined;
451
+ transientTimeoutMs?: number | undefined;
452
+ };
453
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
454
+ inputs: {
455
+ [x: string]: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.AnyExtensionDataRef, {
456
+ optional: boolean;
457
+ singleton: boolean;
458
+ }>;
459
+ };
460
+ kind: "app-root-element";
461
+ name: "alert-display";
462
+ params: {
463
+ element: JSX.Element | (() => JSX.Element);
464
+ };
465
+ }>;
466
+ "app-root-element:app/dialog-display": _backstage_frontend_plugin_api.ExtensionDefinition<{
493
467
  config: {};
494
468
  configInput: {};
495
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
469
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
470
+ inputs: {
471
+ [x: string]: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.AnyExtensionDataRef, {
472
+ optional: boolean;
473
+ singleton: boolean;
474
+ }>;
475
+ };
476
+ kind: "app-root-element";
477
+ name: "dialog-display";
478
+ params: {
479
+ element: JSX.Element | (() => JSX.Element);
480
+ };
481
+ }>;
482
+ "app-root-element:app/oauth-request-dialog": _backstage_frontend_plugin_api.ExtensionDefinition<{
483
+ kind: "app-root-element";
484
+ name: "oauth-request-dialog";
485
+ config: {};
486
+ configInput: {};
487
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
496
488
  inputs: {};
497
489
  params: {
498
- /** @public */
499
- factory: _backstage_frontend_plugin_api.AnyApiFactory;
490
+ element: JSX.Element | (() => JSX.Element);
500
491
  };
501
492
  }>;
502
- "api:app/scm-auth": _backstage_frontend_plugin_api.ExtensionDefinition<{
503
- kind: "api";
504
- name: "scm-auth";
493
+ "sign-in-page:app": _backstage_frontend_plugin_api.ExtensionDefinition<{
494
+ kind: "sign-in-page";
495
+ name: undefined;
505
496
  config: {};
506
497
  configInput: {};
507
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
498
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.ComponentType<_backstage_core_plugin_api.SignInPageProps>, "core.sign-in-page.component", {}>;
508
499
  inputs: {};
509
500
  params: {
510
- /** @public */
511
- factory: _backstage_frontend_plugin_api.AnyApiFactory;
501
+ loader: () => Promise<react.ComponentType<_backstage_core_plugin_api.SignInPageProps>>;
512
502
  };
513
503
  }>;
514
- "api:app/scm-integrations": _backstage_frontend_plugin_api.ExtensionDefinition<{
515
- kind: "api";
516
- name: "scm-integrations";
504
+ "theme:app/dark": _backstage_frontend_plugin_api.ExtensionDefinition<{
505
+ kind: "theme";
506
+ name: "dark";
517
507
  config: {};
518
508
  configInput: {};
519
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
509
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AppTheme, "core.theme.theme", {}>;
520
510
  inputs: {};
521
511
  params: {
522
- /** @public */
523
- factory: _backstage_frontend_plugin_api.AnyApiFactory;
512
+ theme: _backstage_frontend_plugin_api.AppTheme;
513
+ };
514
+ }>;
515
+ "theme:app/light": _backstage_frontend_plugin_api.ExtensionDefinition<{
516
+ kind: "theme";
517
+ name: "light";
518
+ config: {};
519
+ configInput: {};
520
+ output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AppTheme, "core.theme.theme", {}>;
521
+ inputs: {};
522
+ params: {
523
+ theme: _backstage_frontend_plugin_api.AppTheme;
524
524
  };
525
525
  }>;
526
526
  }>;
@@ -1,4 +1,4 @@
1
- import { UrlPatternDiscovery, AlertApiForwarder, NoOpAnalyticsApi, ErrorAlerter, ErrorApiForwarder, UnhandledErrorForwarder, WebStorage, createFetchApi, FetchMiddlewares, OAuthRequestManager, GoogleAuth, MicrosoftAuth, GithubAuth, OktaAuth, GitlabAuth, OneLoginAuth, BitbucketAuth, BitbucketServerAuth, AtlassianAuth, VMwareCloudAuth } from '@backstage/core-app-api';
1
+ import { FrontendHostDiscovery, AlertApiForwarder, NoOpAnalyticsApi, ErrorAlerter, ErrorApiForwarder, UnhandledErrorForwarder, WebStorage, createFetchApi, FetchMiddlewares, OAuthRequestManager, GoogleAuth, MicrosoftAuth, GithubAuth, OktaAuth, GitlabAuth, OneLoginAuth, BitbucketAuth, BitbucketServerAuth, AtlassianAuth, VMwareCloudAuth } from '@backstage/core-app-api';
2
2
  import { createApiFactory, discoveryApiRef, configApiRef, alertApiRef, analyticsApiRef, errorApiRef, storageApiRef, fetchApiRef, identityApiRef, oauthRequestApiRef, googleAuthApiRef, microsoftAuthApiRef, githubAuthApiRef, oktaAuthApiRef, gitlabAuthApiRef, oneloginAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, atlassianAuthApiRef, vmwareCloudAuthApiRef } from '@backstage/core-plugin-api';
3
3
  import { permissionApiRef, IdentityPermissionApi } from '@backstage/plugin-permission-react';
4
4
 
@@ -6,9 +6,7 @@ import { permissionApiRef, IdentityPermissionApi } from '@backstage/plugin-permi
6
6
  createApiFactory({
7
7
  api: discoveryApiRef,
8
8
  deps: { configApi: configApiRef },
9
- factory: ({ configApi }) => UrlPatternDiscovery.compile(
10
- `${configApi.getString("backend.baseUrl")}/api/{{ pluginId }}`
11
- )
9
+ factory: ({ configApi }) => FrontendHostDiscovery.fromConfig(configApi)
12
10
  }),
13
11
  createApiFactory({
14
12
  api: alertApiRef,
@@ -1 +1 @@
1
- {"version":3,"file":"apis.esm.js","sources":["../../../../../../../packages/app-defaults/src/defaults/apis.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 {\n AlertApiForwarder,\n NoOpAnalyticsApi,\n ErrorApiForwarder,\n ErrorAlerter,\n GoogleAuth,\n GithubAuth,\n OktaAuth,\n GitlabAuth,\n MicrosoftAuth,\n BitbucketAuth,\n BitbucketServerAuth,\n OAuthRequestManager,\n WebStorage,\n UrlPatternDiscovery,\n OneLoginAuth,\n UnhandledErrorForwarder,\n AtlassianAuth,\n createFetchApi,\n FetchMiddlewares,\n VMwareCloudAuth,\n} from '@backstage/core-app-api';\n\nimport {\n createApiFactory,\n alertApiRef,\n analyticsApiRef,\n errorApiRef,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n oauthRequestApiRef,\n googleAuthApiRef,\n githubAuthApiRef,\n oktaAuthApiRef,\n gitlabAuthApiRef,\n microsoftAuthApiRef,\n storageApiRef,\n configApiRef,\n oneloginAuthApiRef,\n bitbucketAuthApiRef,\n bitbucketServerAuthApiRef,\n atlassianAuthApiRef,\n vmwareCloudAuthApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n permissionApiRef,\n IdentityPermissionApi,\n} from '@backstage/plugin-permission-react';\n\nexport const apis = [\n createApiFactory({\n api: discoveryApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) =>\n UrlPatternDiscovery.compile(\n `${configApi.getString('backend.baseUrl')}/api/{{ pluginId }}`,\n ),\n }),\n createApiFactory({\n api: alertApiRef,\n deps: {},\n factory: () => new AlertApiForwarder(),\n }),\n createApiFactory({\n api: analyticsApiRef,\n deps: {},\n factory: () => new NoOpAnalyticsApi(),\n }),\n createApiFactory({\n api: errorApiRef,\n deps: { alertApi: alertApiRef },\n factory: ({ alertApi }) => {\n const errorApi = new ErrorAlerter(alertApi, new ErrorApiForwarder());\n UnhandledErrorForwarder.forward(errorApi, { hidden: false });\n return errorApi;\n },\n }),\n createApiFactory({\n api: storageApiRef,\n deps: { errorApi: errorApiRef },\n factory: ({ errorApi }) => WebStorage.create({ errorApi }),\n }),\n createApiFactory({\n api: fetchApiRef,\n deps: {\n configApi: configApiRef,\n identityApi: identityApiRef,\n discoveryApi: discoveryApiRef,\n },\n factory: ({ configApi, identityApi, discoveryApi }) => {\n return createFetchApi({\n middleware: [\n FetchMiddlewares.resolvePluginProtocol({\n discoveryApi,\n }),\n FetchMiddlewares.injectIdentityAuth({\n identityApi,\n config: configApi,\n }),\n ],\n });\n },\n }),\n createApiFactory({\n api: oauthRequestApiRef,\n deps: {},\n factory: () => new OAuthRequestManager(),\n }),\n createApiFactory({\n api: googleAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GoogleAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: microsoftAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n MicrosoftAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: githubAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GithubAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['read:user'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: oktaAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OktaAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: gitlabAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GitlabAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: oneloginAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OneLoginAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: bitbucketAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['account'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: bitbucketServerAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketServerAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['REPO_READ'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: atlassianAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return AtlassianAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n createApiFactory({\n api: vmwareCloudAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return VMwareCloudAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n createApiFactory({\n api: permissionApiRef,\n deps: {\n discovery: discoveryApiRef,\n identity: identityApiRef,\n config: configApiRef,\n },\n factory: ({ config, discovery, identity }) =>\n IdentityPermissionApi.create({ config, discovery, identity }),\n }),\n];\n"],"names":[],"mappings":";;;;AAkEoB;AAAA,EAClB,gBAAiB,CAAA;AAAA,IACf,GAAK,EAAA,eAAA;AAAA,IACL,IAAA,EAAM,EAAE,SAAA,EAAW,YAAa,EAAA;AAAA,IAChC,OAAS,EAAA,CAAC,EAAE,SAAA,OACV,mBAAoB,CAAA,OAAA;AAAA,MAClB,CAAG,EAAA,SAAA,CAAU,SAAU,CAAA,iBAAiB,CAAC,CAAA,mBAAA;AAAA;AAC3C,GACH,CAAA;AAAA,EACD,gBAAiB,CAAA;AAAA,IACf,GAAK,EAAA,WAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,IAAI,iBAAkB;AAAA,GACtC,CAAA;AAAA,EACD,gBAAiB,CAAA;AAAA,IACf,GAAK,EAAA,eAAA;AAAA,IACL,MAAM,EAAC;AAAA,IACP,OAAA,EAAS,MAAM,IAAI,gBAAiB;AAAA,GACrC,CAAA;AAAA,EACD,gBAAiB,CAAA;AAAA,IACf,GAAK,EAAA,WAAA;AAAA,IACL,IAAA,EAAM,EAAE,QAAA,EAAU,WAAY,EAAA;AAAA,IAC9B,OAAS,EAAA,CAAC,EAAE,QAAA,EAAe,KAAA;AACzB,MAAA,MAAM,WAAW,IAAI,YAAA,CAAa,QAAU,EAAA,IAAI,mBAAmB,CAAA;AACnE,MAAA,uBAAA,CAAwB,OAAQ,CAAA,QAAA,EA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AC,EAAE,YAAc,EAAA,eAAA,EAAiB,WAAgB,KAAA;AACzD,MAAA,OAAO,gBAAgB,MAAO,CAAA;AAAA,QAC5B,SAAA;AAAA,QACA,YAAA;AAAA,QACA,eAAA;AAAA,QACA,WAAA,EAAa,SAAU,CAAA,iBAAA,CAAkB,kBAAkB;AAAA,OAC5D,CAAA;AAAA;AACH,GACD,CAAA;AAAA,EACD,gBAAiB,CAAA;AAAA,IACf,GAAK,EAAA,gBAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,SAAW,EAAA,eAAA;AAAA,MACX,QAAU,EAAA,cAAA;AAAA,MACV,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,OAAS,EAAA,CAAC,EAAE,MAAA,EAAQ,SAAW,EAAA,QAAA,EAC7B,KAAA,qBAAA,CAAsB,MAAO,CAAA,EAAE,MAAQ,EAAA,SAAA,EAAW,UAAU;AAAA,GAC/D;AACH"}
1
+ {"version":3,"file":"apis.esm.js","sources":["../../../../../../../packages/app-defaults/src/defaults/apis.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 {\n AlertApiForwarder,\n NoOpAnalyticsApi,\n ErrorApiForwarder,\n ErrorAlerter,\n GoogleAuth,\n GithubAuth,\n OktaAuth,\n GitlabAuth,\n MicrosoftAuth,\n BitbucketAuth,\n BitbucketServerAuth,\n OAuthRequestManager,\n WebStorage,\n OneLoginAuth,\n UnhandledErrorForwarder,\n AtlassianAuth,\n createFetchApi,\n FetchMiddlewares,\n VMwareCloudAuth,\n FrontendHostDiscovery,\n} from '@backstage/core-app-api';\n\nimport {\n createApiFactory,\n alertApiRef,\n analyticsApiRef,\n errorApiRef,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n oauthRequestApiRef,\n googleAuthApiRef,\n githubAuthApiRef,\n oktaAuthApiRef,\n gitlabAuthApiRef,\n microsoftAuthApiRef,\n storageApiRef,\n configApiRef,\n oneloginAuthApiRef,\n bitbucketAuthApiRef,\n bitbucketServerAuthApiRef,\n atlassianAuthApiRef,\n vmwareCloudAuthApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n permissionApiRef,\n IdentityPermissionApi,\n} from '@backstage/plugin-permission-react';\n\nexport const apis = [\n createApiFactory({\n api: discoveryApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) => FrontendHostDiscovery.fromConfig(configApi),\n }),\n createApiFactory({\n api: alertApiRef,\n deps: {},\n factory: () => new AlertApiForwarder(),\n }),\n createApiFactory({\n api: analyticsApiRef,\n deps: {},\n factory: () => new NoOpAnalyticsApi(),\n }),\n createApiFactory({\n api: errorApiRef,\n deps: { alertApi: alertApiRef },\n factory: ({ alertApi }) => {\n const errorApi = new ErrorAlerter(alertApi, new ErrorApiForwarder());\n UnhandledErrorForwarder.forward(errorApi, { hidden: false });\n return errorApi;\n },\n }),\n createApiFactory({\n api: storageApiRef,\n deps: { errorApi: errorApiRef },\n factory: ({ errorApi }) => WebStorage.create({ errorApi }),\n }),\n createApiFactory({\n api: fetchApiRef,\n deps: {\n configApi: configApiRef,\n identityApi: identityApiRef,\n discoveryApi: discoveryApiRef,\n },\n factory: ({ configApi, identityApi, discoveryApi }) => {\n return createFetchApi({\n middleware: [\n FetchMiddlewares.resolvePluginProtocol({\n discoveryApi,\n }),\n FetchMiddlewares.injectIdentityAuth({\n identityApi,\n config: configApi,\n }),\n ],\n });\n },\n }),\n createApiFactory({\n api: oauthRequestApiRef,\n deps: {},\n factory: () => new OAuthRequestManager(),\n }),\n createApiFactory({\n api: googleAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GoogleAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: microsoftAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n MicrosoftAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: githubAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GithubAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['read:user'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: oktaAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OktaAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: gitlabAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n GitlabAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: oneloginAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n OneLoginAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: bitbucketAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['account'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: bitbucketServerAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) =>\n BitbucketServerAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n defaultScopes: ['REPO_READ'],\n environment: configApi.getOptionalString('auth.environment'),\n }),\n }),\n createApiFactory({\n api: atlassianAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return AtlassianAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n createApiFactory({\n api: vmwareCloudAuthApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n oauthRequestApi: oauthRequestApiRef,\n configApi: configApiRef,\n },\n factory: ({ discoveryApi, oauthRequestApi, configApi }) => {\n return VMwareCloudAuth.create({\n configApi,\n discoveryApi,\n oauthRequestApi,\n environment: configApi.getOptionalString('auth.environment'),\n });\n },\n }),\n createApiFactory({\n api: permissionApiRef,\n deps: {\n discovery: discoveryApiRef,\n identity: identityApiRef,\n config: configApiRef,\n },\n factory: ({ config, discovery, identity }) =>\n IdentityPermissionApi.create({ config, discovery, identity }),\n }),\n];\n"],"names":[],"mappings":";;;;AAkEoB;AAAA,EAClB,gBAAiB,CAA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AAsB,MAAO,CAAA,EAAE,MAAQ,EAAA,SAAA,EAAW,UAAU;AAAA,GAC/D;AACH"}
@@ -16,6 +16,20 @@ class IdentityAuthInjectorFetchMiddleware {
16
16
  headerValue
17
17
  );
18
18
  }
19
+ /**
20
+ * Returns an array of plugin URL prefixes derived from the static `discovery`
21
+ * configuration, to be used as `urlPrefixAllowlist` option of {@link create}.
22
+ */
23
+ static getDiscoveryUrlPrefixes(config) {
24
+ const endpointConfigs = config.getOptionalConfigArray("discovery.endpoints") || [];
25
+ return endpointConfigs.flatMap((c) => {
26
+ const target = typeof c.get("target") === "object" ? c.getString("target.external") : c.getString("target");
27
+ const plugins = c.getStringArray("plugins");
28
+ return plugins.map(
29
+ (pluginId) => target.replace(/\{\{\s*pluginId\s*\}\}/g, pluginId)
30
+ );
31
+ });
32
+ }
19
33
  apply(next) {
20
34
  return async (input, init) => {
21
35
  const request = new Request(input, init);
@@ -34,7 +48,12 @@ function buildMatcher(options) {
34
48
  } else if (options.urlPrefixAllowlist) {
35
49
  return buildPrefixMatcher(options.urlPrefixAllowlist);
36
50
  } else if (options.config) {
37
- return buildPrefixMatcher([options.config.getString("backend.baseUrl")]);
51
+ return buildPrefixMatcher([
52
+ options.config.getString("backend.baseUrl"),
53
+ ...IdentityAuthInjectorFetchMiddleware.getDiscoveryUrlPrefixes(
54
+ options.config
55
+ )
56
+ ]);
38
57
  }
39
58
  return () => false;
40
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IdentityAuthInjectorFetchMiddleware.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FetchApi/IdentityAuthInjectorFetchMiddleware.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 { Config } from '@backstage/config';\nimport { IdentityApi } from '@backstage/core-plugin-api';\nimport { FetchMiddleware } from './types';\n\n/**\n * A fetch middleware, which injects a Backstage token header when the user is\n * signed in.\n */\nexport class IdentityAuthInjectorFetchMiddleware implements FetchMiddleware {\n static create(options: {\n identityApi: IdentityApi;\n config?: Config;\n urlPrefixAllowlist?: string[];\n allowUrl?: (url: string) => boolean;\n header?: {\n name: string;\n value: (backstageToken: string) => string;\n };\n }): IdentityAuthInjectorFetchMiddleware {\n const matcher = buildMatcher(options);\n const headerName = options.header?.name || 'authorization';\n const headerValue = options.header?.value || (token => `Bearer ${token}`);\n\n return new IdentityAuthInjectorFetchMiddleware(\n options.identityApi,\n matcher,\n headerName,\n headerValue,\n );\n }\n\n constructor(\n public readonly identityApi: IdentityApi,\n public readonly allowUrl: (url: string) => boolean,\n public readonly headerName: string,\n public readonly headerValue: (pluginId: string) => string,\n ) {}\n\n apply(next: typeof fetch): typeof fetch {\n return async (input, init) => {\n // Skip this middleware if the header already exists, or if the URL\n // doesn't match any of the allowlist items, or if there was no token.\n // NOTE(freben): The \"as any\" casts here and below are because of subtle\n // undici type differences that happened in a node types bump. Those are\n // immaterial to the code at hand at runtime, as the global fetch and\n // Request are always taken from the same place.\n const request = new Request(input as any, init);\n const { token } = await this.identityApi.getCredentials();\n if (\n request.headers.get(this.headerName) ||\n typeof token !== 'string' ||\n !token ||\n !this.allowUrl(request.url)\n ) {\n return next(input as any, init);\n }\n\n request.headers.set(this.headerName, this.headerValue(token));\n return next(request);\n };\n }\n}\n\nfunction buildMatcher(options: {\n config?: Config;\n urlPrefixAllowlist?: string[];\n allowUrl?: (url: string) => boolean;\n}): (url: string) => boolean {\n if (options.allowUrl) {\n return options.allowUrl;\n } else if (options.urlPrefixAllowlist) {\n return buildPrefixMatcher(options.urlPrefixAllowlist);\n } else if (options.config) {\n return buildPrefixMatcher([options.config.getString('backend.baseUrl')]);\n }\n return () => false;\n}\n\nfunction buildPrefixMatcher(prefixes: string[]): (url: string) => boolean {\n const trimmedPrefixes = prefixes.map(prefix => prefix.replace(/\\/$/, ''));\n return url =>\n trimmedPrefixes.some(\n prefix => url === prefix || url.startsWith(`${prefix}/`),\n );\n}\n"],"names":[],"mappings":"AAwBO,MAAM,mCAA+D,CAAA;AAAA,EAuB1E,WACkB,CAAA,WAAA,EACA,QACA,EAAA,UAAA,EACA,WAChB,EAAA;AAJgB,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AACA,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAAA;AACf,EA3BH,OAAO,OAAO,OAS0B,EAAA;AACtC,IAAM,MAAA,OAAA,GAAU,aAAa,OAAO,CAAA;AACpC,IAAM,MAAA,UAAA,GAAa,OAAQ,CAAA,MAAA,EAAQ,IAAQ,IAAA,eAAA;AAC3C,IAAA,MAAM,cAAc,OAAQ,CAAA,MAAA,EAAQ,KAAU,KAAA,CAAA,KAAA,KAAS,UAAU,KAAK,CAAA,CAAA,CAAA;AAEtE,IAAA,OAAO,IAAI,mCAAA;AAAA,MACT,OAAQ,CAAA,WAAA;AAAA,MACR,OAAA;AAAA,MACA,UAAA;AAAA,MACA;AAAA,KACF;AAAA;AACF,EASA,MAAM,IAAkC,EAAA;AACtC,IAAO,OAAA,OAAO,OAAO,IAAS,KAAA;AAO5B,MAAA,MAAM,OAAU,GAAA,IAAI,OAAQ,CAAA,KAAA,EAAc,IAAI,CAAA;AAC9C,MAAA,MAAM,EAAE,KAAM,EAAA,GAAI,MAAM,IAAA,CAAK,YAAY,cAAe,EAAA;AACxD,MAAA,IACE,QAAQ,OAAQ,CAAA,GAAA,CAAI,IAAK,CAAA,UAAU,KACnC,OAAO,KAAA,KAAU,QACjB,IAAA,CAAC,SACD,CAAC,IAAA,CAAK,QAAS,CAAA,OAAA,CAAQ,GAAG,CAC1B,EAAA;AACA,QAAO,OAAA,IAAA,CAAK,OAAc,IAAI,CAAA;AAAA;AAGhC,MAAA,OAAA,CAAQ,QAAQ,GAAI,CAAA,IAAA,CAAK,YAAY,IAAK,CAAA,WAAA,CAAY,KAAK,CAAC,CAAA;AAC5D,MAAA,OAAO,KAAK,OAAO,CAAA;AAAA,KACrB;AAAA;AAEJ;AAEA,SAAS,aAAa,OAIO,EAAA;AAC3B,EAAA,IAAI,QAAQ,QAAU,EAAA;AACpB,IAAA,OAAO,OAAQ,CAAA,QAAA;AAAA,GACjB,MAAA,IAAW,QAAQ,kBAAoB,EAAA;AACrC,IAAO,OAAA,kBAAA,CAAmB,QAAQ,kBAAkB,CAAA;AAAA,GACtD,MAAA,IAAW,QAAQ,MAAQ,EAAA;AACzB,IAAA,OAAO,mBAAmB,CAAC,OAAA,CAAQ,OAAO,SAAU,CAAA,iBAAiB,CAAC,CAAC,CAAA;AAAA;AAEzE,EAAA,OAAO,MAAM,KAAA;AACf;AAEA,SAAS,mBAAmB,QAA8C,EAAA;AACxE,EAAM,MAAA,eAAA,GAAkB,SAAS,GAAI,CAAA,CAAA,MAAA,KAAU,OAAO,OAAQ,CAAA,KAAA,EAAO,EAAE,CAAC,CAAA;AACxE,EAAA,OAAO,SACL,eAAgB,CAAA,IAAA;AAAA,IACd,YAAU,GAAQ,KAAA,MAAA,IAAU,IAAI,UAAW,CAAA,CAAA,EAAG,MAAM,CAAG,CAAA,CAAA;AAAA,GACzD;AACJ;;;;"}
1
+ {"version":3,"file":"IdentityAuthInjectorFetchMiddleware.esm.js","sources":["../../../../../../../../../packages/core-app-api/src/apis/implementations/FetchApi/IdentityAuthInjectorFetchMiddleware.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 { Config } from '@backstage/config';\nimport { IdentityApi } from '@backstage/core-plugin-api';\nimport { FetchMiddleware } from './types';\n\n/**\n * A fetch middleware, which injects a Backstage token header when the user is\n * signed in.\n */\nexport class IdentityAuthInjectorFetchMiddleware implements FetchMiddleware {\n static create(options: {\n identityApi: IdentityApi;\n config?: Config;\n urlPrefixAllowlist?: string[];\n allowUrl?: (url: string) => boolean;\n header?: {\n name: string;\n value: (backstageToken: string) => string;\n };\n }): IdentityAuthInjectorFetchMiddleware {\n const matcher = buildMatcher(options);\n const headerName = options.header?.name || 'authorization';\n const headerValue = options.header?.value || (token => `Bearer ${token}`);\n\n return new IdentityAuthInjectorFetchMiddleware(\n options.identityApi,\n matcher,\n headerName,\n headerValue,\n );\n }\n\n /**\n * Returns an array of plugin URL prefixes derived from the static `discovery`\n * configuration, to be used as `urlPrefixAllowlist` option of {@link create}.\n */\n static getDiscoveryUrlPrefixes(config: Config): string[] {\n const endpointConfigs =\n config.getOptionalConfigArray('discovery.endpoints') || [];\n return endpointConfigs.flatMap(c => {\n const target =\n typeof c.get('target') === 'object'\n ? c.getString('target.external')\n : c.getString('target');\n const plugins = c.getStringArray('plugins');\n return plugins.map(pluginId =>\n target.replace(/\\{\\{\\s*pluginId\\s*\\}\\}/g, pluginId),\n );\n });\n }\n\n constructor(\n public readonly identityApi: IdentityApi,\n public readonly allowUrl: (url: string) => boolean,\n public readonly headerName: string,\n public readonly headerValue: (pluginId: string) => string,\n ) {}\n\n apply(next: typeof fetch): typeof fetch {\n return async (input, init) => {\n // Skip this middleware if the header already exists, or if the URL\n // doesn't match any of the allowlist items, or if there was no token.\n // NOTE(freben): The \"as any\" casts here and below are because of subtle\n // undici type differences that happened in a node types bump. Those are\n // immaterial to the code at hand at runtime, as the global fetch and\n // Request are always taken from the same place.\n const request = new Request(input as any, init);\n const { token } = await this.identityApi.getCredentials();\n if (\n request.headers.get(this.headerName) ||\n typeof token !== 'string' ||\n !token ||\n !this.allowUrl(request.url)\n ) {\n return next(input as any, init);\n }\n\n request.headers.set(this.headerName, this.headerValue(token));\n return next(request);\n };\n }\n}\n\nfunction buildMatcher(options: {\n config?: Config;\n urlPrefixAllowlist?: string[];\n allowUrl?: (url: string) => boolean;\n}): (url: string) => boolean {\n if (options.allowUrl) {\n return options.allowUrl;\n } else if (options.urlPrefixAllowlist) {\n return buildPrefixMatcher(options.urlPrefixAllowlist);\n } else if (options.config) {\n return buildPrefixMatcher([\n options.config.getString('backend.baseUrl'),\n ...IdentityAuthInjectorFetchMiddleware.getDiscoveryUrlPrefixes(\n options.config,\n ),\n ]);\n }\n return () => false;\n}\n\nfunction buildPrefixMatcher(prefixes: string[]): (url: string) => boolean {\n const trimmedPrefixes = prefixes.map(prefix => prefix.replace(/\\/$/, ''));\n return url =>\n trimmedPrefixes.some(\n prefix => url === prefix || url.startsWith(`${prefix}/`),\n );\n}\n"],"names":[],"mappings":"AAwBO,MAAM,mCAA+D,CAAA;AAAA,EA0C1E,WACkB,CAAA,WAAA,EACA,QACA,EAAA,UAAA,EACA,WAChB,EAAA;AAJgB,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AACA,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAAA;AACf,EA9CH,OAAO,OAAO,OAS0B,EAAA;AACtC,IAAM,MAAA,OAAA,GAAU,aAAa,OAAO,CAAA;AACpC,IAAM,MAAA,UAAA,GAAa,OAAQ,CAAA,MAAA,EAAQ,IAAQ,IAAA,eAAA;AAC3C,IAAA,MAAM,cAAc,OAAQ,CAAA,MAAA,EAAQ,KAAU,KAAA,CAAA,KAAA,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GAAI,CAAA,IAAA,CAAK,YAAY,IAAK,CAAA,WAAA,CAAY,KAAK,CAAC,CAAA;AAC5D,MAAA,OAAO,KAAK,OAAO,CAAA;AAAA,KACrB;AAAA;AAEJ;AAEA,SAAS,aAAa,OAIO,EAAA;AAC3B,EAAA,IAAI,QAAQ,QAAU,EAAA;AACpB,IAAA,OAAO,OAAQ,CAAA,QAAA;AAAA,GACjB,MAAA,IAAW,QAAQ,kBAAoB,EAAA;AACrC,IAAO,OAAA,kBAAA,CAAmB,QAAQ,kBAAkB,CAAA;AAAA,GACtD,MAAA,IAAW,QAAQ,MAAQ,EAAA;AACzB,IAAA,OAAO,kBAAmB,CAAA;AAAA,MACxB,OAAA,CAAQ,MAAO,CAAA,SAAA,CAAU,iBAAiB,CAAA;AAAA,MAC1C,GAAG,mCAAoC,CAAA,uBAAA;AAAA,QACrC,OAAQ,CAAA;AAAA;AACV,KACD,CAAA;AAAA;AAEH,EAAA,OAAO,MAAM,KAAA;AACf;AAEA,SAAS,mBAAmB,QAA8C,EAAA;AACxE,EAAM,MAAA,eAAA,GAAkB,SAAS,GAAI,CAAA,CAAA,MAAA,KAAU,OAAO,OAAQ,CAAA,KAAA,EAAO,EAAE,CAAC,CAAA;AACxE,EAAA,OAAO,SACL,eAAgB,CAAA,IAAA;AAAA,IACd,YAAU,GAAQ,KAAA,MAAA,IAAU,IAAI,UAAW,CAAA,CAAA,EAAG,MAAM,CAAG,CAAA,CAAA;AAAA,GACzD;AACJ;;;;"}
@@ -11,6 +11,7 @@ import { IconsApi } from './extensions/IconsApi.esm.js';
11
11
  import { FeatureFlagsApi } from './extensions/FeatureFlagsApi.esm.js';
12
12
  import { TranslationsApi } from './extensions/TranslationsApi.esm.js';
13
13
  import { DefaultSignInPage } from './extensions/DefaultSignInPage.esm.js';
14
+ import { dialogDisplayAppRootElement } from './extensions/DialogDisplay.esm.js';
14
15
  import { DefaultProgressComponent, DefaultNotFoundErrorPageComponent, DefaultErrorBoundaryComponent } from './extensions/components.esm.js';
15
16
  import { oauthRequestDialogAppRootElement, alertDisplayAppRootElement } from './extensions/elements.esm.js';
16
17
  import { apis } from './defaultApis.esm.js';
@@ -37,7 +38,8 @@ const appPlugin = createFrontendPlugin({
37
38
  DefaultErrorBoundaryComponent,
38
39
  DefaultSignInPage,
39
40
  oauthRequestDialogAppRootElement,
40
- alertDisplayAppRootElement
41
+ alertDisplayAppRootElement,
42
+ dialogDisplayAppRootElement
41
43
  ]
42
44
  });
43
45
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport {\n App,\n AppLanguageApi,\n AppLayout,\n AppNav,\n AppRoot,\n AppRoutes,\n AppThemeApi,\n DarkTheme,\n LightTheme,\n ComponentsApi,\n IconsApi,\n FeatureFlagsApi,\n TranslationsApi,\n DefaultProgressComponent,\n DefaultNotFoundErrorPageComponent,\n DefaultErrorBoundaryComponent,\n oauthRequestDialogAppRootElement,\n alertDisplayAppRootElement,\n DefaultSignInPage,\n} from './extensions';\nimport { apis } from './defaultApis';\n\n/** @public */\nexport const appPlugin = createFrontendPlugin({\n id: 'app',\n extensions: [\n ...apis,\n App,\n AppLanguageApi,\n AppLayout,\n AppNav,\n AppRoot,\n AppRoutes,\n AppThemeApi,\n DarkTheme,\n LightTheme,\n ComponentsApi,\n IconsApi,\n FeatureFlagsApi,\n TranslationsApi,\n DefaultProgressComponent,\n DefaultNotFoundErrorPageComponent,\n DefaultErrorBoundaryComponent,\n DefaultSignInPage,\n oauthRequestDialogAppRootElement,\n alertDisplayAppRootElement,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAyCO,MAAM,YAAY,oBAAqB,CAAA;AAAA,EAC5C,EAAI,EAAA,KAAA;AAAA,EACJ,UAAY,EAAA;AAAA,IACV,GAAG,IAAA;AAAA,IACH,GAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA;AAAA,IACA,eAAA;AAAA,IACA,wBAAA;AAAA,IACA,iCAAA;AAAA,IACA,6BAAA;AAAA,IACA,iBAAA;AAAA,IACA,gCAAA;AAAA,IACA;AAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport {\n App,\n AppLanguageApi,\n AppLayout,\n AppNav,\n AppRoot,\n AppRoutes,\n AppThemeApi,\n DarkTheme,\n LightTheme,\n ComponentsApi,\n IconsApi,\n FeatureFlagsApi,\n TranslationsApi,\n DefaultProgressComponent,\n DefaultNotFoundErrorPageComponent,\n DefaultErrorBoundaryComponent,\n oauthRequestDialogAppRootElement,\n alertDisplayAppRootElement,\n DefaultSignInPage,\n dialogDisplayAppRootElement,\n} from './extensions';\nimport { apis } from './defaultApis';\n\n/** @public */\nexport const appPlugin = createFrontendPlugin({\n id: 'app',\n extensions: [\n ...apis,\n App,\n AppLanguageApi,\n AppLayout,\n AppNav,\n AppRoot,\n AppRoutes,\n AppThemeApi,\n DarkTheme,\n LightTheme,\n ComponentsApi,\n IconsApi,\n FeatureFlagsApi,\n TranslationsApi,\n DefaultProgressComponent,\n DefaultNotFoundErrorPageComponent,\n DefaultErrorBoundaryComponent,\n DefaultSignInPage,\n oauthRequestDialogAppRootElement,\n alertDisplayAppRootElement,\n dialogDisplayAppRootElement,\n ],\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA0CO,MAAM,YAAY,oBAAqB,CAAA;AAAA,EAC5C,EAAI,EAAA,KAAA;AAAA,EACJ,UAAY,EAAA;AAAA,IACV,GAAG,IAAA;AAAA,IACH,GAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA;AAAA,IACA,eAAA;AAAA,IACA,wBAAA;AAAA,IACA,iCAAA;AAAA,IACA,6BAAA;AAAA,IACA,iBAAA;AAAA,IACA,gCAAA;AAAA,IACA,0BAAA;AAAA,IACA;AAAA;AAEJ,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-app",
3
- "version": "0.1.7-next.0",
3
+ "version": "0.1.7-next.2",
4
4
  "backstage": {
5
5
  "role": "frontend-plugin",
6
6
  "pluginId": "app",
@@ -40,21 +40,22 @@
40
40
  "test": "backstage-cli package test"
41
41
  },
42
42
  "dependencies": {
43
- "@backstage/core-components": "0.16.4",
43
+ "@backstage/core-components": "0.16.5-next.1",
44
44
  "@backstage/core-plugin-api": "1.10.4",
45
- "@backstage/frontend-plugin-api": "0.9.6-next.0",
46
- "@backstage/integration-react": "1.2.4",
45
+ "@backstage/frontend-plugin-api": "0.10.0-next.2",
46
+ "@backstage/integration-react": "1.2.5-next.0",
47
47
  "@backstage/plugin-permission-react": "0.4.31",
48
48
  "@backstage/theme": "0.6.4",
49
+ "@backstage/types": "1.2.1",
49
50
  "@material-ui/core": "^4.9.13",
50
51
  "@material-ui/icons": "^4.9.1",
51
52
  "@material-ui/lab": "^4.0.0-alpha.61",
52
53
  "react-use": "^17.2.4"
53
54
  },
54
55
  "devDependencies": {
55
- "@backstage/cli": "0.30.0",
56
- "@backstage/dev-utils": "1.1.8-next.0",
57
- "@backstage/frontend-test-utils": "0.2.7-next.0",
56
+ "@backstage/cli": "0.31.0-next.1",
57
+ "@backstage/dev-utils": "1.1.8-next.2",
58
+ "@backstage/frontend-test-utils": "0.3.0-next.2",
58
59
  "@testing-library/jest-dom": "^6.0.0",
59
60
  "@testing-library/react": "^16.0.0",
60
61
  "@testing-library/user-event": "^14.0.0",
@@ -75,12 +76,5 @@
75
76
  "optional": true
76
77
  }
77
78
  },
78
- "typesVersions": {
79
- "*": {
80
- "index": [
81
- "dist/index.d.ts"
82
- ]
83
- }
84
- },
85
79
  "module": "./dist/index.esm.js"
86
80
  }