@backstage/frontend-plugin-api 0.13.1 → 0.13.2-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/dist/analytics/useAnalytics.esm.js +14 -1
  3. package/dist/analytics/useAnalytics.esm.js.map +1 -1
  4. package/dist/apis/definitions/AlertApi.esm.js +11 -0
  5. package/dist/apis/definitions/AlertApi.esm.js.map +1 -0
  6. package/dist/apis/definitions/AnalyticsApi.esm.js +4 -1
  7. package/dist/apis/definitions/AnalyticsApi.esm.js.map +1 -1
  8. package/dist/apis/definitions/AppLanguageApi.esm.js +11 -0
  9. package/dist/apis/definitions/AppLanguageApi.esm.js.map +1 -0
  10. package/dist/apis/definitions/AppThemeApi.esm.js +11 -0
  11. package/dist/apis/definitions/AppThemeApi.esm.js.map +1 -0
  12. package/dist/apis/definitions/AppTreeApi.esm.js +4 -1
  13. package/dist/apis/definitions/AppTreeApi.esm.js.map +1 -1
  14. package/dist/apis/definitions/ConfigApi.esm.js +11 -0
  15. package/dist/apis/definitions/ConfigApi.esm.js.map +1 -0
  16. package/dist/apis/definitions/DialogApi.esm.js +4 -1
  17. package/dist/apis/definitions/DialogApi.esm.js.map +1 -1
  18. package/dist/apis/definitions/DiscoveryApi.esm.js +11 -0
  19. package/dist/apis/definitions/DiscoveryApi.esm.js.map +1 -0
  20. package/dist/apis/definitions/ErrorApi.esm.js +11 -0
  21. package/dist/apis/definitions/ErrorApi.esm.js.map +1 -0
  22. package/dist/apis/definitions/FeatureFlagsApi.esm.js +21 -0
  23. package/dist/apis/definitions/FeatureFlagsApi.esm.js.map +1 -0
  24. package/dist/apis/definitions/FetchApi.esm.js +11 -0
  25. package/dist/apis/definitions/FetchApi.esm.js.map +1 -0
  26. package/dist/apis/definitions/IconsApi.esm.js +4 -1
  27. package/dist/apis/definitions/IconsApi.esm.js.map +1 -1
  28. package/dist/apis/definitions/IdentityApi.esm.js +11 -0
  29. package/dist/apis/definitions/IdentityApi.esm.js.map +1 -0
  30. package/dist/apis/definitions/OAuthRequestApi.esm.js +11 -0
  31. package/dist/apis/definitions/OAuthRequestApi.esm.js.map +1 -0
  32. package/dist/apis/definitions/RouteResolutionApi.esm.js +4 -1
  33. package/dist/apis/definitions/RouteResolutionApi.esm.js.map +1 -1
  34. package/dist/apis/definitions/StorageApi.esm.js +11 -0
  35. package/dist/apis/definitions/StorageApi.esm.js.map +1 -0
  36. package/dist/apis/definitions/SwappableComponentsApi.esm.js +4 -1
  37. package/dist/apis/definitions/SwappableComponentsApi.esm.js.map +1 -1
  38. package/dist/apis/definitions/TranslationApi.esm.js +11 -0
  39. package/dist/apis/definitions/TranslationApi.esm.js.map +1 -0
  40. package/dist/apis/definitions/auth.esm.js +51 -0
  41. package/dist/apis/definitions/auth.esm.js.map +1 -0
  42. package/dist/apis/system/ApiRef.esm.js +27 -0
  43. package/dist/apis/system/ApiRef.esm.js.map +1 -0
  44. package/dist/apis/system/helpers.esm.js +13 -0
  45. package/dist/apis/system/helpers.esm.js.map +1 -0
  46. package/dist/apis/system/useApi.esm.js +50 -0
  47. package/dist/apis/system/useApi.esm.js.map +1 -0
  48. package/dist/blueprints/AppRootElementBlueprint.esm.js +6 -2
  49. package/dist/blueprints/AppRootElementBlueprint.esm.js.map +1 -1
  50. package/dist/blueprints/NavItemBlueprint.esm.js.map +1 -1
  51. package/dist/blueprints/PageBlueprint.esm.js +15 -1
  52. package/dist/blueprints/PageBlueprint.esm.js.map +1 -1
  53. package/dist/blueprints/SignInPageBlueprint.esm.js +15 -1
  54. package/dist/blueprints/SignInPageBlueprint.esm.js.map +1 -1
  55. package/dist/blueprints/ThemeBlueprint.esm.js.map +1 -1
  56. package/dist/components/ErrorApiBoundary.esm.js +24 -0
  57. package/dist/components/ErrorApiBoundary.esm.js.map +1 -0
  58. package/dist/components/{ErrorBoundary.esm.js → ErrorDisplayBoundary.esm.js} +3 -3
  59. package/dist/components/ErrorDisplayBoundary.esm.js.map +1 -0
  60. package/dist/components/ExtensionBoundary.esm.js +40 -4
  61. package/dist/components/ExtensionBoundary.esm.js.map +1 -1
  62. package/dist/components/createSwappableComponent.esm.js +14 -1
  63. package/dist/components/createSwappableComponent.esm.js.map +1 -1
  64. package/dist/index.d.ts +1692 -243
  65. package/dist/index.esm.js +20 -2
  66. package/dist/index.esm.js.map +1 -1
  67. package/dist/routing/useRouteRef.esm.js +14 -1
  68. package/dist/routing/useRouteRef.esm.js.map +1 -1
  69. package/dist/translation/TranslationMessages.esm.js +11 -0
  70. package/dist/translation/TranslationMessages.esm.js.map +1 -0
  71. package/dist/translation/TranslationRef.esm.js +62 -0
  72. package/dist/translation/TranslationRef.esm.js.map +1 -0
  73. package/dist/translation/TranslationResource.esm.js +21 -0
  74. package/dist/translation/TranslationResource.esm.js.map +1 -0
  75. package/dist/translation/useTranslationRef.esm.js +89 -0
  76. package/dist/translation/useTranslationRef.esm.js.map +1 -0
  77. package/dist/wiring/createExtension.esm.js +1 -1
  78. package/dist/wiring/createExtension.esm.js.map +1 -1
  79. package/dist/wiring/createExtensionBlueprint.esm.js.map +1 -1
  80. package/package.json +28 -21
  81. package/dist/components/ErrorBoundary.esm.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,15 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ReactNode, JSX as JSX$1, ComponentType } from 'react';
4
- import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
5
- import { ApiHolder, ConfigApi, ApiRef, TypesToApiRefs, ApiFactory, AnyApiFactory, IconComponent as IconComponent$2, SignInPageProps, AppTheme } from '@backstage/core-plugin-api';
6
- export { AlertApi, AlertMessage, AnyApiFactory, AnyApiRef, ApiFactory, ApiHolder, ApiRef, ApiRefConfig, AppTheme, AppThemeApi, AuthProviderInfo, AuthRequestOptions, BackstageIdentityApi, BackstageIdentityResponse, BackstageUserIdentity, ConfigApi, DiscoveryApi, ErrorApi, ErrorApiError, ErrorApiErrorContext, FeatureFlag, FeatureFlagState, FeatureFlagsApi, FeatureFlagsSaveOptions, FetchApi, IdentityApi, OAuthApi, OAuthRequestApi, OAuthRequester, OAuthRequesterOptions, OAuthScope, OpenIdConnectApi, PendingOAuthRequest, ProfileInfo, ProfileInfoApi, SessionApi, SessionState, StorageApi, StorageValueSnapshot, TypesToApiRefs, alertApiRef, appThemeApiRef, atlassianAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, configApiRef, createApiFactory, createApiRef, discoveryApiRef, errorApiRef, featureFlagsApiRef, fetchApiRef, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, identityApiRef, microsoftAuthApiRef, oauthRequestApiRef, oktaAuthApiRef, oneloginAuthApiRef, openshiftAuthApiRef, storageApiRef, useApi, useApiHolder, vmwareCloudAuthApiRef, withApis } from '@backstage/core-plugin-api';
7
- import { Expand, JsonObject } from '@backstage/types';
8
- import { z } from 'zod';
3
+ import { ReactNode, JSX as JSX$1, ComponentType, PropsWithChildren } from 'react';
9
4
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
10
5
  import { IconComponent as IconComponent$1, RouteRef as RouteRef$1 } from '@backstage/frontend-plugin-api';
11
- import { TranslationResource, TranslationMessages } from '@backstage/core-plugin-api/alpha';
12
- export { TranslationMessages, TranslationMessagesOptions, TranslationRef, TranslationRefOptions, TranslationResource, TranslationResourceOptions, createTranslationMessages, createTranslationRef, createTranslationResource, useTranslationRef } from '@backstage/core-plugin-api/alpha';
6
+ import { Expand, JsonObject, Observable, JsonValue, ExpandRecursive } from '@backstage/types';
7
+ import { z } from 'zod';
8
+ import { Config } from '@backstage/config';
13
9
 
14
10
  /**
15
11
  * Analytics context envelope.
@@ -44,46 +40,6 @@ declare const AnalyticsContext: (options: {
44
40
  children: ReactNode;
45
41
  }) => react_jsx_runtime.JSX.Element;
46
42
 
47
- /** @public */
48
- type ExtensionDataValue<TData, TId extends string> = {
49
- readonly $$type: '@backstage/ExtensionDataValue';
50
- readonly id: TId;
51
- readonly value: TData;
52
- };
53
- /** @public */
54
- type ExtensionDataRef<TData = unknown, TId extends string = string, TConfig extends {
55
- optional?: true;
56
- } = {
57
- optional?: true;
58
- }> = {
59
- readonly $$type: '@backstage/ExtensionDataRef';
60
- readonly id: TId;
61
- readonly T: TData;
62
- readonly config: TConfig;
63
- };
64
- /** @public */
65
- type ExtensionDataRefToValue<TDataRef extends AnyExtensionDataRef> = TDataRef extends ExtensionDataRef<infer IData, infer IId, any> ? ExtensionDataValue<IData, IId> : never;
66
- /**
67
- * @deprecated Use `ExtensionDataRef` without type parameters instead.
68
- * @public
69
- */
70
- type AnyExtensionDataRef = ExtensionDataRef;
71
- /** @public */
72
- interface ConfigurableExtensionDataRef<TData, TId extends string, TConfig extends {
73
- optional?: true;
74
- } = {}> extends ExtensionDataRef<TData, TId, TConfig> {
75
- optional(): ConfigurableExtensionDataRef<TData, TId, TConfig & {
76
- optional: true;
77
- }>;
78
- (t: TData): ExtensionDataValue<TData, TId>;
79
- }
80
- /** @public */
81
- declare function createExtensionDataRef<TData>(): {
82
- with<TId extends string>(options: {
83
- id: TId;
84
- }): ConfigurableExtensionDataRef<TData, TId>;
85
- };
86
-
87
43
  /**
88
44
  * Catch-all type for route params.
89
45
  *
@@ -124,10 +80,50 @@ declare function createRouteRef<TParams extends {
124
80
 
125
81
  /** @public */
126
82
  declare const coreExtensionData: {
127
- title: ConfigurableExtensionDataRef<string, "core.title", {}>;
128
- reactElement: ConfigurableExtensionDataRef<JSX$1.Element, "core.reactElement", {}>;
129
- routePath: ConfigurableExtensionDataRef<string, "core.routing.path", {}>;
130
- routeRef: ConfigurableExtensionDataRef<RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {}>;
83
+ title: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.title", {}>;
84
+ reactElement: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<JSX$1.Element, "core.reactElement", {}>;
85
+ routePath: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}>;
86
+ routeRef: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {}>;
87
+ };
88
+
89
+ /** @public */
90
+ type ExtensionDataValue<TData, TId extends string> = {
91
+ readonly $$type: '@backstage/ExtensionDataValue';
92
+ readonly id: TId;
93
+ readonly value: TData;
94
+ };
95
+ /** @public */
96
+ type ExtensionDataRef<TData = unknown, TId extends string = string, TConfig extends {
97
+ optional?: true;
98
+ } = {
99
+ optional?: true;
100
+ }> = {
101
+ readonly $$type: '@backstage/ExtensionDataRef';
102
+ readonly id: TId;
103
+ readonly T: TData;
104
+ readonly config: TConfig;
105
+ };
106
+ /** @public */
107
+ type ExtensionDataRefToValue<TDataRef extends AnyExtensionDataRef> = TDataRef extends ExtensionDataRef<infer IData, infer IId, any> ? ExtensionDataValue<IData, IId> : never;
108
+ /**
109
+ * @deprecated Use `ExtensionDataRef` without type parameters instead.
110
+ * @public
111
+ */
112
+ type AnyExtensionDataRef = ExtensionDataRef;
113
+ /** @public */
114
+ interface ConfigurableExtensionDataRef<TData, TId extends string, TConfig extends {
115
+ optional?: true;
116
+ } = {}> extends ExtensionDataRef<TData, TId, TConfig> {
117
+ optional(): ConfigurableExtensionDataRef<TData, TId, TConfig & {
118
+ optional: true;
119
+ }>;
120
+ (t: TData): ExtensionDataValue<TData, TId>;
121
+ }
122
+ /** @public */
123
+ declare function createExtensionDataRef<TData>(): {
124
+ with<TId extends string>(options: {
125
+ id: TId;
126
+ }): ConfigurableExtensionDataRef<TData, TId>;
131
127
  };
132
128
 
133
129
  /** @public */
@@ -290,8 +286,8 @@ type SortExtensions<T extends readonly ExtensionDefinition[]> = T extends [
290
286
  low: infer ILow extends readonly ExtensionDefinition[],
291
287
  high: infer IHigh extends readonly ExtensionDefinition[]
292
288
  ] ? [...SortExtensions<ILow>, IPivot, ...SortExtensions<IHigh>] : 'invalid SortExtensionsInner' : [];
293
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
294
- type PopUnion$1<U> = UnionToIntersection<U extends any ? () => U : never> extends () => infer R ? [next: R, rest: Exclude<U, R>] : undefined;
289
+ type UnionToIntersection$1<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
290
+ type PopUnion$1<U> = UnionToIntersection$1<U extends any ? () => U : never> extends () => infer R ? [next: R, rest: Exclude<U, R>] : undefined;
295
291
  type UnionToArray<U, T = U, TResult extends T[] = []> = PopUnion$1<U> extends [
296
292
  next: infer INext extends T,
297
293
  rest: infer IRest extends T
@@ -774,9 +770,9 @@ interface ExtensionBlueprint<T extends ExtensionBlueprintParameters = ExtensionB
774
770
  */
775
771
  makeWithOverrides<TName extends string | undefined, TExtensionConfigSchema extends {
776
772
  [key in string]: (zImpl: typeof z) => z.ZodType;
777
- }, UFactoryOutput extends ExtensionDataValue<any, any>, UNewOutput extends ExtensionDataRef, TExtraInputs extends {
773
+ }, UFactoryOutput extends ExtensionDataValue<any, any>, UNewOutput extends ExtensionDataRef, UParentInputs extends ExtensionDataRef, TExtraInputs extends {
778
774
  [inputName in string]: ExtensionInput;
779
- }, UParentInputs extends ExtensionDataRef>(args: {
775
+ } = {}>(args: {
780
776
  name?: TName;
781
777
  attachTo?: ExtensionDefinitionAttachTo<UParentInputs> & VerifyExtensionAttachTo<ExtensionDataRef extends UNewOutput ? NonNullable<T['output']> : UNewOutput, UParentInputs>;
782
778
  disabled?: boolean;
@@ -801,14 +797,14 @@ interface ExtensionBlueprint<T extends ExtensionBlueprintParameters = ExtensionB
801
797
  inputs: Expand<ResolvedExtensionInputs<T['inputs'] & TExtraInputs>>;
802
798
  }): Iterable<UFactoryOutput> & VerifyExtensionFactoryOutput<ExtensionDataRef extends UNewOutput ? NonNullable<T['output']> : UNewOutput, UFactoryOutput>;
803
799
  }): OverridableExtensionDefinition<{
804
- config: (string extends keyof TExtensionConfigSchema ? {} : {
800
+ config: Expand<(string extends keyof TExtensionConfigSchema ? {} : {
805
801
  [key in keyof TExtensionConfigSchema]: z.infer<ReturnType<TExtensionConfigSchema[key]>>;
806
- }) & T['config'];
807
- configInput: (string extends keyof TExtensionConfigSchema ? {} : z.input<z.ZodObject<{
802
+ }) & T['config']>;
803
+ configInput: Expand<(string extends keyof TExtensionConfigSchema ? {} : z.input<z.ZodObject<{
808
804
  [key in keyof TExtensionConfigSchema]: ReturnType<TExtensionConfigSchema[key]>;
809
- }>>) & T['configInput'];
805
+ }>>) & T['configInput']>;
810
806
  output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;
811
- inputs: T['inputs'] & TExtraInputs;
807
+ inputs: Expand<T['inputs'] & TExtraInputs>;
812
808
  kind: T['kind'];
813
809
  name: string | undefined extends TName ? undefined : TName;
814
810
  params: T['params'];
@@ -1240,112 +1236,123 @@ interface AppTreeApi {
1240
1236
  *
1241
1237
  * @public
1242
1238
  */
1243
- declare const appTreeApiRef: _backstage_core_plugin_api.ApiRef<AppTreeApi>;
1244
-
1245
- /** @public */
1246
- interface ExtensionBoundaryProps {
1247
- node: AppNode;
1248
- children: ReactNode;
1249
- }
1250
- /** @public */
1251
- declare function ExtensionBoundary(props: ExtensionBoundaryProps): react_jsx_runtime.JSX.Element;
1252
- /** @public */
1253
- declare namespace ExtensionBoundary {
1254
- function lazy(appNode: AppNode, loader: () => Promise<JSX.Element>): JSX.Element;
1255
- function lazyComponent<TProps extends {}>(appNode: AppNode, loader: () => Promise<(props: TProps) => JSX.Element>): (props: TProps) => JSX.Element;
1256
- }
1239
+ declare const appTreeApiRef: _backstage_frontend_plugin_api.ApiRef<AppTreeApi>;
1257
1240
 
1258
- /** @public */
1259
- type SwappableComponentRef<TInnerComponentProps extends {} = {}, TExternalComponentProps extends {} = TInnerComponentProps> = {
1260
- id: string;
1261
- TProps: TInnerComponentProps;
1262
- TExternalProps: TExternalComponentProps;
1263
- $$type: '@backstage/SwappableComponentRef';
1264
- };
1265
1241
  /**
1266
- * Options for creating an SwappableComponent.
1242
+ * API reference.
1267
1243
  *
1268
1244
  * @public
1269
1245
  */
1270
- type CreateSwappableComponentOptions<TInnerComponentProps extends {}, TExternalComponentProps extends {} = TInnerComponentProps> = {
1246
+ type ApiRef<T> = {
1271
1247
  id: string;
1272
- loader?: (() => (props: TInnerComponentProps) => JSX.Element | null) | (() => Promise<(props: TInnerComponentProps) => JSX.Element | null>);
1273
- transformProps?: (props: TExternalComponentProps) => TInnerComponentProps;
1248
+ T: T;
1274
1249
  };
1275
1250
  /**
1276
- * Creates a SwappableComponent that can be used to render the component, optionally overridden by the app.
1251
+ * Catch-all {@link ApiRef} type.
1277
1252
  *
1278
1253
  * @public
1279
1254
  */
1280
- declare function createSwappableComponent<TInnerComponentProps extends {}, TExternalComponentProps extends {} = TInnerComponentProps>(options: CreateSwappableComponentOptions<TInnerComponentProps, TExternalComponentProps>): {
1281
- (props: TExternalComponentProps): JSX.Element | null;
1282
- ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>;
1283
- };
1284
-
1255
+ type AnyApiRef = ApiRef<unknown>;
1285
1256
  /**
1286
- * React hook providing access to the current {@link AppNode}.
1257
+ * Wraps a type with API properties into a type holding their respective {@link ApiRef}s.
1287
1258
  *
1288
1259
  * @public
1289
- * @remarks
1290
- *
1291
- * This hook will return the {@link AppNode} for the closest extension. This
1292
- * relies on the extension using the {@link (ExtensionBoundary:function)} component in its
1293
- * implementation, which is included by default for all common blueprints.
1260
+ */
1261
+ type TypesToApiRefs<T> = {
1262
+ [key in keyof T]: ApiRef<T[key]>;
1263
+ };
1264
+ /**
1265
+ * Provides lookup of APIs through their {@link ApiRef}s.
1294
1266
  *
1295
- * If the current component is not inside an {@link (ExtensionBoundary:function)}, it will
1296
- * return `undefined`.
1267
+ * @public
1297
1268
  */
1298
- declare function useAppNode(): AppNode | undefined;
1299
-
1300
- /** @public */
1301
- type ProgressProps = {};
1302
- /** @public */
1303
- type NotFoundErrorPageProps = {
1304
- children?: ReactNode;
1269
+ type ApiHolder = {
1270
+ get<T>(api: ApiRef<T>): T | undefined;
1305
1271
  };
1306
- /** @public */
1307
- type ErrorDisplayProps = {
1308
- plugin?: FrontendPlugin;
1309
- error: Error;
1310
- resetError: () => void;
1272
+ /**
1273
+ * Describes type returning API implementations.
1274
+ *
1275
+ * @public
1276
+ */
1277
+ type ApiFactory<Api, Impl extends Api, Deps extends {
1278
+ [name in string]: unknown;
1279
+ }> = {
1280
+ api: ApiRef<Api>;
1281
+ deps: TypesToApiRefs<Deps>;
1282
+ factory(deps: Deps): Impl;
1311
1283
  };
1284
+ /**
1285
+ * Catch-all {@link ApiFactory} type.
1286
+ *
1287
+ * @public
1288
+ */
1289
+ type AnyApiFactory = ApiFactory<unknown, unknown, {
1290
+ [key in string]: unknown;
1291
+ }>;
1312
1292
 
1313
1293
  /**
1294
+ * React hook for retrieving {@link ApiHolder}, an API catalog.
1295
+ *
1314
1296
  * @public
1315
1297
  */
1316
- declare const Progress: {
1317
- (props: ProgressProps): JSX.Element | null;
1318
- ref: SwappableComponentRef<ProgressProps, ProgressProps>;
1319
- };
1298
+ declare function useApiHolder(): ApiHolder;
1320
1299
  /**
1300
+ * React hook for retrieving APIs.
1301
+ *
1302
+ * @param apiRef - Reference of the API to use.
1321
1303
  * @public
1322
1304
  */
1323
- declare const NotFoundErrorPage: {
1324
- (props: NotFoundErrorPageProps): JSX.Element | null;
1325
- ref: SwappableComponentRef<NotFoundErrorPageProps, NotFoundErrorPageProps>;
1305
+ declare function useApi<T>(apiRef: ApiRef<T>): T;
1306
+ /**
1307
+ * Wrapper for giving component an API context.
1308
+ *
1309
+ * @param apis - APIs for the context.
1310
+ * @public
1311
+ */
1312
+ declare function withApis<T extends {}>(apis: TypesToApiRefs<T>): <TProps extends T>(WrappedComponent: ComponentType<TProps>) => {
1313
+ (props: PropsWithChildren<Omit<TProps, keyof T>>): react_jsx_runtime.JSX.Element;
1314
+ displayName: string;
1326
1315
  };
1316
+
1327
1317
  /**
1318
+ * API reference configuration - holds an ID of the referenced API.
1319
+ *
1328
1320
  * @public
1329
1321
  */
1330
- declare const ErrorDisplay: {
1331
- (props: ErrorDisplayProps): JSX.Element | null;
1332
- ref: SwappableComponentRef<ErrorDisplayProps, ErrorDisplayProps>;
1322
+ type ApiRefConfig = {
1323
+ id: string;
1333
1324
  };
1325
+ /**
1326
+ * Creates a reference to an API.
1327
+ *
1328
+ * @param config - The descriptor of the API to reference.
1329
+ * @returns An API reference.
1330
+ * @public
1331
+ */
1332
+ declare function createApiRef<T>(config: ApiRefConfig): ApiRef<T>;
1334
1333
 
1335
1334
  /**
1336
- * API for looking up components based on component refs.
1335
+ * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed
1336
+ * to another function.
1337
+ *
1338
+ * @remarks
1339
+ *
1340
+ * This function doesn't actually do anything, it's only used to infer types.
1337
1341
  *
1338
1342
  * @public
1339
1343
  */
1340
- interface SwappableComponentsApi {
1341
- getComponent<TInnerComponentProps extends {}, TExternalComponentProps extends {} = TInnerComponentProps>(ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>): (props: TInnerComponentProps) => JSX.Element | null;
1342
- }
1344
+ declare function createApiFactory<Api, Impl extends Api, Deps extends {
1345
+ [name in string]: unknown;
1346
+ }>(factory: ApiFactory<Api, Impl, Deps>): ApiFactory<Api, Impl, Deps>;
1343
1347
  /**
1344
- * The `ApiRef` of {@link SwappableComponentsApi}.
1348
+ * Used to infer types for a standalone {@link ApiFactory} that isn't immediately passed
1349
+ * to another function.
1345
1350
  *
1351
+ * @param api - Ref of the API that will be produced by the factory.
1352
+ * @param instance - Implementation of the API to use.
1346
1353
  * @public
1347
1354
  */
1348
- declare const swappableComponentsApiRef: _backstage_core_plugin_api.ApiRef<SwappableComponentsApi>;
1355
+ declare function createApiFactory<Api, Impl extends Api>(api: ApiRef<Api>, instance: Impl): ApiFactory<Api, Impl, {}>;
1349
1356
 
1350
1357
  /**
1351
1358
  * IconComponent is the common icon type used throughout Backstage when
@@ -1368,87 +1375,956 @@ type IconComponent = ComponentType<{
1368
1375
  }>;
1369
1376
 
1370
1377
  /**
1371
- * API for accessing app icons.
1378
+ * This file contains declarations for common interfaces of auth-related APIs.
1379
+ * The declarations should be used to signal which type of authentication and
1380
+ * authorization methods each separate auth provider supports.
1372
1381
  *
1373
- * @public
1382
+ * For example, a Google OAuth provider that supports OAuth 2 and OpenID Connect,
1383
+ * would be declared as follows:
1384
+ *
1385
+ * const googleAuthApiRef = createApiRef<OAuthApi & OpenIDConnectApi>({ ... })
1374
1386
  */
1375
- interface IconsApi {
1376
- getIcon(key: string): IconComponent | undefined;
1377
- listIconKeys(): string[];
1378
- }
1379
1387
  /**
1380
- * The `ApiRef` of {@link IconsApi}.
1388
+ * Information about the auth provider.
1389
+ *
1390
+ * @remarks
1391
+ *
1392
+ * This information is used both to connect the correct auth provider in the backend, as
1393
+ * well as displaying the provider to the user.
1381
1394
  *
1382
1395
  * @public
1383
1396
  */
1384
- declare const iconsApiRef: _backstage_core_plugin_api.ApiRef<IconsApi>;
1385
-
1397
+ type AuthProviderInfo = {
1398
+ /**
1399
+ * The ID of the auth provider. This should match with ID of the provider in the `@backstage/auth-backend`.
1400
+ */
1401
+ id: string;
1402
+ /**
1403
+ * Title for the auth provider, for example "GitHub"
1404
+ */
1405
+ title: string;
1406
+ /**
1407
+ * Icon for the auth provider.
1408
+ */
1409
+ icon: IconComponent;
1410
+ /**
1411
+ * Optional user friendly messaage to display for the auth provider.
1412
+ */
1413
+ message?: string;
1414
+ };
1386
1415
  /**
1387
- * A handle for an open dialog that can be used to interact with it.
1416
+ * An array of scopes, or a scope string formatted according to the
1417
+ * auth provider, which is typically a space separated list.
1388
1418
  *
1389
1419
  * @remarks
1390
1420
  *
1391
- * Dialogs can be opened using either {@link DialogApi.show} or {@link DialogApi.showModal}.
1421
+ * See the documentation for each auth provider for the list of scopes
1422
+ * supported by each provider.
1392
1423
  *
1393
1424
  * @public
1394
1425
  */
1395
- interface DialogApiDialog<TResult = void> {
1426
+ type OAuthScope = string | string[];
1427
+ /**
1428
+ * Configuration of an authentication request.
1429
+ *
1430
+ * @public
1431
+ */
1432
+ type AuthRequestOptions = {
1396
1433
  /**
1397
- * Closes the dialog with that provided result.
1434
+ * If this is set to true, the user will not be prompted to log in,
1435
+ * and an empty response will be returned if there is no existing session.
1398
1436
  *
1399
- * @remarks
1437
+ * This can be used to perform a check whether the user is logged in, or if you don't
1438
+ * want to force a user to be logged in, but provide functionality if they already are.
1400
1439
  *
1401
- * If the dialog is a modal dialog a result must always be provided. If it's a regular dialog then passing a result is optional.
1402
- */
1403
- close(...args: undefined extends TResult ? [result?: TResult] : [result: TResult]): void;
1404
- /**
1405
- * Replaces the content of the dialog with the provided element or component, causing it to be rerenedered.
1440
+ * @defaultValue false
1406
1441
  */
1407
- update(elementOrComponent: React.JSX.Element | ((props: {
1408
- dialog: DialogApiDialog<TResult>;
1409
- }) => JSX.Element)): void;
1442
+ optional?: boolean;
1410
1443
  /**
1411
- * Wait until the dialog is closed and return the result.
1444
+ * If this is set to true, the request will bypass the regular oauth login modal
1445
+ * and open the login popup directly.
1412
1446
  *
1413
- * @remarks
1447
+ * The method must be called synchronously from a user action for this to work in all browsers.
1414
1448
  *
1415
- * If the dialog is a modal dialog a result will always be returned. If it's a regular dialog then the result may be `undefined`.
1449
+ * @defaultValue false
1416
1450
  */
1417
- result(): Promise<TResult>;
1418
- }
1451
+ instantPopup?: boolean;
1452
+ };
1419
1453
  /**
1420
- * A Utility API for showing dialogs that render in the React tree and return a result.
1454
+ * This API provides access to OAuth 2 credentials. It lets you request access tokens,
1455
+ * which can be used to act on behalf of the user when talking to APIs.
1421
1456
  *
1422
1457
  * @public
1423
1458
  */
1424
- interface DialogApi {
1459
+ type OAuthApi = {
1425
1460
  /**
1426
- * Opens a modal dialog and returns a handle to it.
1461
+ * Requests an OAuth 2 Access Token, optionally with a set of scopes. The access token allows
1462
+ * you to make requests on behalf of the user, and the copes may grant you broader access, depending
1463
+ * on the auth provider.
1427
1464
  *
1428
- * @remarks
1465
+ * Each auth provider has separate handling of scope, so you need to look at the documentation
1466
+ * for each one to know what scope you need to request.
1429
1467
  *
1430
- * This dialog can be closed by calling the `close` method on the returned handle, optionally providing a result.
1431
- * The dialog can also be closed by the user by clicking the backdrop or pressing the escape key.
1468
+ * This method is cheap and should be called each time an access token is used. Do not for example
1469
+ * store the access token in React component state, as that could cause the token to expire. Instead
1470
+ * fetch a new access token for each request.
1432
1471
  *
1433
- * If the dialog is closed without a result, the result will be `undefined`.
1472
+ * Be sure to include all required scopes when requesting an access token. When testing your implementation
1473
+ * it is best to log out the Backstage session and then visit your plugin page directly, as
1474
+ * you might already have some required scopes in your existing session. Not requesting the correct
1475
+ * scopes can lead to 403 or other authorization errors, which can be tricky to debug.
1434
1476
  *
1435
- * @example
1477
+ * If the user has not yet granted access to the provider and the set of requested scopes, the user
1478
+ * will be prompted to log in. The returned promise will not resolve until the user has
1479
+ * successfully logged in. The returned promise can be rejected, but only if the user rejects the login request.
1480
+ */
1481
+ getAccessToken(scope?: OAuthScope, options?: AuthRequestOptions): Promise<string>;
1482
+ };
1483
+ /**
1484
+ * This API provides access to OpenID Connect credentials. It lets you request ID tokens,
1485
+ * which can be passed to backend services to prove the user's identity.
1486
+ *
1487
+ * @public
1488
+ */
1489
+ type OpenIdConnectApi = {
1490
+ /**
1491
+ * Requests an OpenID Connect ID Token.
1436
1492
  *
1437
- * ### Example with inline dialog content
1438
- * ```tsx
1439
- * const dialog = dialogApi.show<boolean>(
1440
- * <DialogContent>
1441
- * <DialogTitle>Are you sure?</DialogTitle>
1442
- * <DialogActions>
1443
- * <Button onClick={() => dialog.close(true)}>Yes</Button>
1444
- * <Button onClick={() => dialog.close(false)}>No</Button>
1445
- * </DialogActions>
1446
- * </DialogContent>
1447
- * );
1448
- * const result = await dialog.result();
1449
- * ```
1493
+ * This method is cheap and should be called each time an ID token is used. Do not for example
1494
+ * store the id token in React component state, as that could cause the token to expire. Instead
1495
+ * fetch a new id token for each request.
1450
1496
  *
1451
- * @example
1497
+ * If the user has not yet logged in to Google inside Backstage, the user will be prompted
1498
+ * to log in. The returned promise will not resolve until the user has successfully logged in.
1499
+ * The returned promise can be rejected, but only if the user rejects the login request.
1500
+ */
1501
+ getIdToken(options?: AuthRequestOptions): Promise<string>;
1502
+ };
1503
+ /**
1504
+ * This API provides access to profile information of the user from an auth provider.
1505
+ *
1506
+ * @public
1507
+ */
1508
+ type ProfileInfoApi = {
1509
+ /**
1510
+ * Get profile information for the user as supplied by this auth provider.
1511
+ *
1512
+ * If the optional flag is not set, a session is guaranteed to be returned, while if
1513
+ * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.
1514
+ */
1515
+ getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;
1516
+ };
1517
+ /**
1518
+ * This API provides access to the user's identity within Backstage.
1519
+ *
1520
+ * @remarks
1521
+ *
1522
+ * An auth provider that implements this interface can be used to sign-in to backstage. It is
1523
+ * not intended to be used directly from a plugin, but instead serves as a connection between
1524
+ * this authentication method and the app's {@link IdentityApi}
1525
+ *
1526
+ * @public
1527
+ */
1528
+ type BackstageIdentityApi = {
1529
+ /**
1530
+ * Get the user's identity within Backstage. This should normally not be called directly,
1531
+ * use the {@link IdentityApi} instead.
1532
+ *
1533
+ * If the optional flag is not set, a session is guaranteed to be returned, while if
1534
+ * the optional flag is set, the session may be undefined. See {@link AuthRequestOptions} for more details.
1535
+ */
1536
+ getBackstageIdentity(options?: AuthRequestOptions): Promise<BackstageIdentityResponse | undefined>;
1537
+ };
1538
+ /**
1539
+ * User identity information within Backstage.
1540
+ *
1541
+ * @public
1542
+ */
1543
+ type BackstageUserIdentity = {
1544
+ /**
1545
+ * The type of identity that this structure represents. In the frontend app
1546
+ * this will currently always be 'user'.
1547
+ */
1548
+ type: 'user';
1549
+ /**
1550
+ * The entityRef of the user in the catalog.
1551
+ * For example User:default/sandra
1552
+ */
1553
+ userEntityRef: string;
1554
+ /**
1555
+ * The user and group entities that the user claims ownership through
1556
+ */
1557
+ ownershipEntityRefs: string[];
1558
+ };
1559
+ /**
1560
+ * Token and Identity response, with the users claims in the Identity.
1561
+ *
1562
+ * @public
1563
+ */
1564
+ type BackstageIdentityResponse = {
1565
+ /**
1566
+ * The token used to authenticate the user within Backstage.
1567
+ */
1568
+ token: string;
1569
+ /**
1570
+ * The time at which the token expires. If not set, it can be assumed that the token does not expire.
1571
+ */
1572
+ expiresAt?: Date;
1573
+ /**
1574
+ * Identity information derived from the token.
1575
+ */
1576
+ identity: BackstageUserIdentity;
1577
+ };
1578
+ /**
1579
+ * Profile information of the user.
1580
+ *
1581
+ * @public
1582
+ */
1583
+ type ProfileInfo = {
1584
+ /**
1585
+ * Email ID.
1586
+ */
1587
+ email?: string;
1588
+ /**
1589
+ * Display name that can be presented to the user.
1590
+ */
1591
+ displayName?: string;
1592
+ /**
1593
+ * URL to an avatar image of the user.
1594
+ */
1595
+ picture?: string;
1596
+ };
1597
+ /**
1598
+ * Session state values passed to subscribers of the SessionApi.
1599
+ *
1600
+ * @public
1601
+ */
1602
+ declare const SessionState: {
1603
+ /**
1604
+ * User signed in.
1605
+ */
1606
+ readonly SignedIn: "SignedIn";
1607
+ /**
1608
+ * User not signed in.
1609
+ */
1610
+ readonly SignedOut: "SignedOut";
1611
+ };
1612
+ /**
1613
+ * @public
1614
+ */
1615
+ type SessionState = (typeof SessionState)[keyof typeof SessionState];
1616
+ /**
1617
+ * @public
1618
+ */
1619
+ declare namespace SessionState {
1620
+ type SignedIn = typeof SessionState.SignedIn;
1621
+ type SignedOut = typeof SessionState.SignedOut;
1622
+ }
1623
+ /**
1624
+ * The SessionApi provides basic controls for any auth provider that is tied to a persistent session.
1625
+ *
1626
+ * @public
1627
+ */
1628
+ type SessionApi = {
1629
+ /**
1630
+ * Sign in with a minimum set of permissions.
1631
+ */
1632
+ signIn(): Promise<void>;
1633
+ /**
1634
+ * Sign out from the current session. This will reload the page.
1635
+ */
1636
+ signOut(): Promise<void>;
1637
+ /**
1638
+ * Observe the current state of the auth session. Emits the current state on subscription.
1639
+ */
1640
+ sessionState$(): Observable<SessionState>;
1641
+ };
1642
+ /**
1643
+ * Provides authentication towards Google APIs and identities.
1644
+ *
1645
+ * @public
1646
+ * @remarks
1647
+ *
1648
+ * See {@link https://developers.google.com/identity/protocols/googlescopes} for a full list of supported scopes.
1649
+ *
1650
+ * Note that the ID token payload is only guaranteed to contain the user's numerical Google ID,
1651
+ * email and expiration information. Do not rely on any other fields, as they might not be present.
1652
+ */
1653
+ declare const googleAuthApiRef: ApiRef<OAuthApi & OpenIdConnectApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1654
+ /**
1655
+ * Provides authentication towards GitHub APIs.
1656
+ *
1657
+ * @public
1658
+ * @remarks
1659
+ *
1660
+ * See {@link https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/}
1661
+ * for a full list of supported scopes.
1662
+ */
1663
+ declare const githubAuthApiRef: ApiRef<OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1664
+ /**
1665
+ * Provides authentication towards Okta APIs.
1666
+ *
1667
+ * @public
1668
+ * @remarks
1669
+ *
1670
+ * See {@link https://developer.okta.com/docs/guides/implement-oauth-for-okta/scopes/}
1671
+ * for a full list of supported scopes.
1672
+ */
1673
+ declare const oktaAuthApiRef: ApiRef<OAuthApi & OpenIdConnectApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1674
+ /**
1675
+ * Provides authentication towards GitLab APIs.
1676
+ *
1677
+ * @public
1678
+ * @remarks
1679
+ *
1680
+ * See {@link https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#limiting-scopes-of-a-personal-access-token}
1681
+ * for a full list of supported scopes.
1682
+ */
1683
+ declare const gitlabAuthApiRef: ApiRef<OAuthApi & OpenIdConnectApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1684
+ /**
1685
+ * Provides authentication towards Microsoft APIs and identities.
1686
+ *
1687
+ * @public
1688
+ * @remarks
1689
+ *
1690
+ * For more info and a full list of supported scopes, see:
1691
+ * - {@link https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent}
1692
+ * - {@link https://docs.microsoft.com/en-us/graph/permissions-reference}
1693
+ */
1694
+ declare const microsoftAuthApiRef: ApiRef<OAuthApi & OpenIdConnectApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1695
+ /**
1696
+ * Provides authentication towards OneLogin APIs.
1697
+ *
1698
+ * @public
1699
+ */
1700
+ declare const oneloginAuthApiRef: ApiRef<OAuthApi & OpenIdConnectApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1701
+ /**
1702
+ * Provides authentication towards Bitbucket APIs.
1703
+ *
1704
+ * @public
1705
+ * @remarks
1706
+ *
1707
+ * See {@link https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/}
1708
+ * for a full list of supported scopes.
1709
+ */
1710
+ declare const bitbucketAuthApiRef: ApiRef<OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1711
+ /**
1712
+ * Provides authentication towards Bitbucket Server APIs.
1713
+ *
1714
+ * @public
1715
+ * @remarks
1716
+ *
1717
+ * See {@link https://confluence.atlassian.com/bitbucketserver/bitbucket-oauth-2-0-provider-api-1108483661.html#BitbucketOAuth2.0providerAPI-scopes}
1718
+ * for a full list of supported scopes.
1719
+ */
1720
+ declare const bitbucketServerAuthApiRef: ApiRef<OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1721
+ /**
1722
+ * Provides authentication towards Atlassian APIs.
1723
+ *
1724
+ * @public
1725
+ * @remarks
1726
+ *
1727
+ * See {@link https://developer.atlassian.com/cloud/jira/platform/scopes-for-connect-and-oauth-2-3LO-apps/}
1728
+ * for a full list of supported scopes.
1729
+ */
1730
+ declare const atlassianAuthApiRef: ApiRef<OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1731
+ /**
1732
+ * Provides authentication towards VMware Cloud APIs and identities.
1733
+ *
1734
+ * @public
1735
+ * @remarks
1736
+ *
1737
+ * For more info about VMware Cloud identity and access management:
1738
+ * - {@link https://docs.vmware.com/en/VMware-Cloud-services/services/Using-VMware-Cloud-Services/GUID-53D39337-D93A-4B84-BD18-DDF43C21479A.html}
1739
+ */
1740
+ declare const vmwareCloudAuthApiRef: ApiRef<OAuthApi & OpenIdConnectApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1741
+ /**
1742
+ * Provides authentication towards OpenShift APIs and identities.
1743
+ *
1744
+ * @public
1745
+ * @remarks
1746
+ *
1747
+ * See {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html/authentication_and_authorization/configuring-oauth-clients}
1748
+ * on how to configure the OAuth clients and
1749
+ * {@link https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html-single/authentication_and_authorization/index#tokens-scoping-about_configuring-internal-oauth}
1750
+ * for available scopes.
1751
+ */
1752
+ declare const openshiftAuthApiRef: ApiRef<OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi>;
1753
+
1754
+ /**
1755
+ * Message handled by the {@link AlertApi}.
1756
+ *
1757
+ * @public
1758
+ */
1759
+ type AlertMessage = {
1760
+ message: string;
1761
+ severity?: 'success' | 'info' | 'warning' | 'error';
1762
+ display?: 'permanent' | 'transient';
1763
+ };
1764
+ /**
1765
+ * The alert API is used to report alerts to the app, and display them to the user.
1766
+ *
1767
+ * @public
1768
+ */
1769
+ type AlertApi = {
1770
+ /**
1771
+ * Post an alert for handling by the application.
1772
+ */
1773
+ post(alert: AlertMessage): void;
1774
+ /**
1775
+ * Observe alerts posted by other parts of the application.
1776
+ */
1777
+ alert$(): Observable<AlertMessage>;
1778
+ };
1779
+ /**
1780
+ * The {@link ApiRef} of {@link AlertApi}.
1781
+ *
1782
+ * @public
1783
+ */
1784
+ declare const alertApiRef: ApiRef<AlertApi>;
1785
+
1786
+ /** @public */
1787
+ type AppLanguageApi = {
1788
+ getAvailableLanguages(): {
1789
+ languages: string[];
1790
+ };
1791
+ setLanguage(language?: string): void;
1792
+ getLanguage(): {
1793
+ language: string;
1794
+ };
1795
+ language$(): Observable<{
1796
+ language: string;
1797
+ }>;
1798
+ };
1799
+ /**
1800
+ * @public
1801
+ */
1802
+ declare const appLanguageApiRef: ApiRef<AppLanguageApi>;
1803
+
1804
+ /**
1805
+ * Describes a theme provided by the app.
1806
+ *
1807
+ * @public
1808
+ */
1809
+ type AppTheme = {
1810
+ /**
1811
+ * ID used to remember theme selections.
1812
+ */
1813
+ id: string;
1814
+ /**
1815
+ * Title of the theme
1816
+ */
1817
+ title: string;
1818
+ /**
1819
+ * Theme variant
1820
+ */
1821
+ variant: 'light' | 'dark';
1822
+ /**
1823
+ * An Icon for the theme mode setting.
1824
+ */
1825
+ icon?: React.ReactElement;
1826
+ Provider(props: {
1827
+ children: ReactNode;
1828
+ }): JSX.Element | null;
1829
+ };
1830
+ /**
1831
+ * The AppThemeApi gives access to the current app theme, and allows switching
1832
+ * to other options that have been registered as a part of the App.
1833
+ *
1834
+ * @public
1835
+ */
1836
+ type AppThemeApi = {
1837
+ /**
1838
+ * Get a list of available themes.
1839
+ */
1840
+ getInstalledThemes(): AppTheme[];
1841
+ /**
1842
+ * Observe the currently selected theme. A value of undefined means no specific theme has been selected.
1843
+ */
1844
+ activeThemeId$(): Observable<string | undefined>;
1845
+ /**
1846
+ * Get the current theme ID. Returns undefined if no specific theme is selected.
1847
+ */
1848
+ getActiveThemeId(): string | undefined;
1849
+ /**
1850
+ * Set a specific theme to use in the app, overriding the default theme selection.
1851
+ *
1852
+ * Clear the selection by passing in undefined.
1853
+ */
1854
+ setActiveThemeId(themeId?: string): void;
1855
+ };
1856
+ /**
1857
+ * The {@link ApiRef} of {@link AppThemeApi}.
1858
+ *
1859
+ * @public
1860
+ */
1861
+ declare const appThemeApiRef: ApiRef<AppThemeApi>;
1862
+
1863
+ /** @public */
1864
+ interface ExtensionBoundaryProps {
1865
+ errorPresentation?: 'error-api' | 'error-display';
1866
+ node: AppNode;
1867
+ children: ReactNode;
1868
+ }
1869
+ /** @public */
1870
+ declare function ExtensionBoundary(props: ExtensionBoundaryProps): react_jsx_runtime.JSX.Element;
1871
+ /** @public */
1872
+ declare namespace ExtensionBoundary {
1873
+ function lazy(appNode: AppNode, loader: () => Promise<JSX.Element>): JSX.Element;
1874
+ function lazyComponent<TProps extends {}>(appNode: AppNode, loader: () => Promise<(props: TProps) => JSX.Element>): (props: TProps) => JSX.Element;
1875
+ }
1876
+
1877
+ /** @public */
1878
+ type SwappableComponentRef<TInnerComponentProps extends {} = {}, TExternalComponentProps extends {} = TInnerComponentProps> = {
1879
+ id: string;
1880
+ TProps: TInnerComponentProps;
1881
+ TExternalProps: TExternalComponentProps;
1882
+ $$type: '@backstage/SwappableComponentRef';
1883
+ };
1884
+ /**
1885
+ * Options for creating an SwappableComponent.
1886
+ *
1887
+ * @public
1888
+ */
1889
+ type CreateSwappableComponentOptions<TInnerComponentProps extends {}, TExternalComponentProps extends {} = TInnerComponentProps> = {
1890
+ id: string;
1891
+ loader?: (() => (props: TInnerComponentProps) => JSX.Element | null) | (() => Promise<(props: TInnerComponentProps) => JSX.Element | null>);
1892
+ transformProps?: (props: TExternalComponentProps) => TInnerComponentProps;
1893
+ };
1894
+ /**
1895
+ * Creates a SwappableComponent that can be used to render the component, optionally overridden by the app.
1896
+ *
1897
+ * @public
1898
+ */
1899
+ declare function createSwappableComponent<TInnerComponentProps extends {}, TExternalComponentProps extends {} = TInnerComponentProps>(options: CreateSwappableComponentOptions<TInnerComponentProps, TExternalComponentProps>): {
1900
+ (props: TExternalComponentProps): JSX.Element | null;
1901
+ ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>;
1902
+ };
1903
+
1904
+ /**
1905
+ * React hook providing access to the current {@link AppNode}.
1906
+ *
1907
+ * @public
1908
+ * @remarks
1909
+ *
1910
+ * This hook will return the {@link AppNode} for the closest extension. This
1911
+ * relies on the extension using the {@link (ExtensionBoundary:function)} component in its
1912
+ * implementation, which is included by default for all common blueprints.
1913
+ *
1914
+ * If the current component is not inside an {@link (ExtensionBoundary:function)}, it will
1915
+ * return `undefined`.
1916
+ */
1917
+ declare function useAppNode(): AppNode | undefined;
1918
+
1919
+ /** @public */
1920
+ type ProgressProps = {};
1921
+ /** @public */
1922
+ type NotFoundErrorPageProps = {
1923
+ children?: ReactNode;
1924
+ };
1925
+ /** @public */
1926
+ type ErrorDisplayProps = {
1927
+ plugin?: FrontendPlugin;
1928
+ error: Error;
1929
+ resetError: () => void;
1930
+ };
1931
+
1932
+ /**
1933
+ * @public
1934
+ */
1935
+ declare const Progress: {
1936
+ (props: ProgressProps): JSX.Element | null;
1937
+ ref: _backstage_frontend_plugin_api.SwappableComponentRef<ProgressProps, ProgressProps>;
1938
+ };
1939
+ /**
1940
+ * @public
1941
+ */
1942
+ declare const NotFoundErrorPage: {
1943
+ (props: NotFoundErrorPageProps): JSX.Element | null;
1944
+ ref: _backstage_frontend_plugin_api.SwappableComponentRef<NotFoundErrorPageProps, NotFoundErrorPageProps>;
1945
+ };
1946
+ /**
1947
+ * @public
1948
+ */
1949
+ declare const ErrorDisplay: {
1950
+ (props: ErrorDisplayProps): JSX.Element | null;
1951
+ ref: _backstage_frontend_plugin_api.SwappableComponentRef<ErrorDisplayProps, ErrorDisplayProps>;
1952
+ };
1953
+
1954
+ /**
1955
+ * API for looking up components based on component refs.
1956
+ *
1957
+ * @public
1958
+ */
1959
+ interface SwappableComponentsApi {
1960
+ getComponent<TInnerComponentProps extends {}, TExternalComponentProps extends {} = TInnerComponentProps>(ref: SwappableComponentRef<TInnerComponentProps, TExternalComponentProps>): (props: TInnerComponentProps) => JSX.Element | null;
1961
+ }
1962
+ /**
1963
+ * The `ApiRef` of {@link SwappableComponentsApi}.
1964
+ *
1965
+ * @public
1966
+ */
1967
+ declare const swappableComponentsApiRef: _backstage_frontend_plugin_api.ApiRef<SwappableComponentsApi>;
1968
+
1969
+ /**
1970
+ * The Config API is used to provide a mechanism to access the
1971
+ * runtime configuration of the system.
1972
+ *
1973
+ * @public
1974
+ */
1975
+ type ConfigApi = Config;
1976
+ /**
1977
+ * The {@link ApiRef} of {@link ConfigApi}.
1978
+ *
1979
+ * @public
1980
+ */
1981
+ declare const configApiRef: ApiRef<ConfigApi>;
1982
+
1983
+ /**
1984
+ * The discovery API is used to provide a mechanism for plugins to
1985
+ * discover the endpoint to use to talk to their backend counterpart.
1986
+ *
1987
+ * @remarks
1988
+ *
1989
+ * The purpose of the discovery API is to allow for many different deployment
1990
+ * setups and routing methods through a central configuration, instead
1991
+ * of letting each individual plugin manage that configuration.
1992
+ *
1993
+ * Implementations of the discovery API can be a simple as a URL pattern
1994
+ * using the pluginId, but could also have overrides for individual plugins,
1995
+ * or query a separate discovery service.
1996
+ *
1997
+ * @public
1998
+ */
1999
+ type DiscoveryApi = {
2000
+ /**
2001
+ * Returns the HTTP base backend URL for a given plugin, without a trailing slash.
2002
+ *
2003
+ * This method must always be called just before making a request, as opposed to
2004
+ * fetching the URL when constructing an API client. That is to ensure that more
2005
+ * flexible routing patterns can be supported.
2006
+ *
2007
+ * For example, asking for the URL for `auth` may return something
2008
+ * like `https://backstage.example.com/api/auth`
2009
+ */
2010
+ getBaseUrl(pluginId: string): Promise<string>;
2011
+ };
2012
+ /**
2013
+ * The {@link ApiRef} of {@link DiscoveryApi}.
2014
+ *
2015
+ * @public
2016
+ */
2017
+ declare const discoveryApiRef: ApiRef<DiscoveryApi>;
2018
+
2019
+ /**
2020
+ * Mirrors the JavaScript Error class, for the purpose of
2021
+ * providing documentation and optional fields.
2022
+ *
2023
+ * @public
2024
+ */
2025
+ type ErrorApiError = {
2026
+ name: string;
2027
+ message: string;
2028
+ stack?: string;
2029
+ };
2030
+ /**
2031
+ * Provides additional information about an error that was posted to the application.
2032
+ *
2033
+ * @public
2034
+ */
2035
+ type ErrorApiErrorContext = {
2036
+ /**
2037
+ * If set to true, this error should not be displayed to the user.
2038
+ *
2039
+ * Hidden errors are typically not displayed in the UI, but the ErrorApi
2040
+ * implementation may still report them to error tracking services
2041
+ * or other utilities that care about all errors.
2042
+ *
2043
+ * @defaultValue false
2044
+ */
2045
+ hidden?: boolean;
2046
+ };
2047
+ /**
2048
+ * The error API is used to report errors to the app, and display them to the user.
2049
+ *
2050
+ * @remarks
2051
+ *
2052
+ * Plugins can use this API as a method of displaying errors to the user, but also
2053
+ * to report errors for collection by error reporting services.
2054
+ *
2055
+ * If an error can be displayed inline, e.g. as feedback in a form, that should be
2056
+ * preferred over relying on this API to display the error. The main use of this API
2057
+ * for displaying errors should be for asynchronous errors, such as a failing background process.
2058
+ *
2059
+ * Even if an error is displayed inline, it should still be reported through this API
2060
+ * if it would be useful to collect or log it for debugging purposes, but with
2061
+ * the hidden flag set. For example, an error arising from form field validation
2062
+ * should probably not be reported, while a failed REST call would be useful to report.
2063
+ *
2064
+ * @public
2065
+ */
2066
+ type ErrorApi = {
2067
+ /**
2068
+ * Post an error for handling by the application.
2069
+ */
2070
+ post(error: ErrorApiError, context?: ErrorApiErrorContext): void;
2071
+ /**
2072
+ * Observe errors posted by other parts of the application.
2073
+ */
2074
+ error$(): Observable<{
2075
+ error: ErrorApiError;
2076
+ context?: ErrorApiErrorContext;
2077
+ }>;
2078
+ };
2079
+ /**
2080
+ * The {@link ApiRef} of {@link ErrorApi}.
2081
+ *
2082
+ * @public
2083
+ */
2084
+ declare const errorApiRef: ApiRef<ErrorApi>;
2085
+
2086
+ /**
2087
+ * Feature flag descriptor.
2088
+ *
2089
+ * @public
2090
+ */
2091
+ type FeatureFlag = {
2092
+ name: string;
2093
+ pluginId: string;
2094
+ description?: string;
2095
+ };
2096
+ /**
2097
+ * Enum representing the state of a feature flag (inactive/active).
2098
+ *
2099
+ * @public
2100
+ */
2101
+ declare const FeatureFlagState: {
2102
+ /**
2103
+ * Feature flag inactive (disabled).
2104
+ */
2105
+ readonly None: 0;
2106
+ /**
2107
+ * Feature flag active (enabled).
2108
+ */
2109
+ readonly Active: 1;
2110
+ };
2111
+ /**
2112
+ * @public
2113
+ */
2114
+ type FeatureFlagState = (typeof FeatureFlagState)[keyof typeof FeatureFlagState];
2115
+ /**
2116
+ * @public
2117
+ */
2118
+ declare namespace FeatureFlagState {
2119
+ type None = typeof FeatureFlagState.None;
2120
+ type Active = typeof FeatureFlagState.Active;
2121
+ }
2122
+ /**
2123
+ * Options to use when saving feature flags.
2124
+ *
2125
+ * @public
2126
+ */
2127
+ type FeatureFlagsSaveOptions = {
2128
+ /**
2129
+ * The new feature flag states to save.
2130
+ */
2131
+ states: Record<string, FeatureFlagState>;
2132
+ /**
2133
+ * Whether the saves states should be merged into the existing ones, or replace them.
2134
+ *
2135
+ * Defaults to false.
2136
+ */
2137
+ merge?: boolean;
2138
+ };
2139
+ /**
2140
+ * The feature flags API is used to toggle functionality to users across plugins and Backstage.
2141
+ *
2142
+ * @remarks
2143
+ *
2144
+ * Plugins can use this API to register feature flags that they have available
2145
+ * for users to enable/disable, and this API will centralize the current user's
2146
+ * state of which feature flags they would like to enable.
2147
+ *
2148
+ * This is ideal for Backstage plugins, as well as your own App, to trial incomplete
2149
+ * or unstable upcoming features. Although there will be a common interface for users
2150
+ * to enable and disable feature flags, this API acts as another way to enable/disable.
2151
+ *
2152
+ * @public
2153
+ */
2154
+ interface FeatureFlagsApi {
2155
+ /**
2156
+ * Registers a new feature flag. Once a feature flag has been registered it
2157
+ * can be toggled by users, and read back to enable or disable features.
2158
+ */
2159
+ registerFlag(flag: FeatureFlag): void;
2160
+ /**
2161
+ * Get a list of all registered flags.
2162
+ */
2163
+ getRegisteredFlags(): FeatureFlag[];
2164
+ /**
2165
+ * Whether the feature flag with the given name is currently activated for the user.
2166
+ */
2167
+ isActive(name: string): boolean;
2168
+ /**
2169
+ * Save the user's choice of feature flag states.
2170
+ */
2171
+ save(options: FeatureFlagsSaveOptions): void;
2172
+ }
2173
+ /**
2174
+ * The {@link ApiRef} of {@link FeatureFlagsApi}.
2175
+ *
2176
+ * @public
2177
+ */
2178
+ declare const featureFlagsApiRef: ApiRef<FeatureFlagsApi>;
2179
+
2180
+ /**
2181
+ * A wrapper for the fetch API, that has additional behaviors such as the
2182
+ * ability to automatically inject auth information where necessary.
2183
+ *
2184
+ * @public
2185
+ */
2186
+ type FetchApi = {
2187
+ /**
2188
+ * The `fetch` implementation.
2189
+ */
2190
+ fetch: typeof fetch;
2191
+ };
2192
+ /**
2193
+ * The {@link ApiRef} of {@link FetchApi}.
2194
+ *
2195
+ * @remarks
2196
+ *
2197
+ * This is a wrapper for the fetch API, that has additional behaviors such as
2198
+ * the ability to automatically inject auth information where necessary.
2199
+ *
2200
+ * Note that the default behavior of this API (unless overridden by your org),
2201
+ * is to require that the user is already signed in so that it has auth
2202
+ * information to inject. Therefore, using the default implementation of this
2203
+ * utility API e.g. on the `SignInPage` or similar, would cause issues. In
2204
+ * special circumstances like those, you can use the regular system `fetch`
2205
+ * instead.
2206
+ *
2207
+ * @public
2208
+ */
2209
+ declare const fetchApiRef: ApiRef<FetchApi>;
2210
+
2211
+ /**
2212
+ * API for accessing app icons.
2213
+ *
2214
+ * @public
2215
+ */
2216
+ interface IconsApi {
2217
+ getIcon(key: string): IconComponent | undefined;
2218
+ listIconKeys(): string[];
2219
+ }
2220
+ /**
2221
+ * The `ApiRef` of {@link IconsApi}.
2222
+ *
2223
+ * @public
2224
+ */
2225
+ declare const iconsApiRef: _backstage_frontend_plugin_api.ApiRef<IconsApi>;
2226
+
2227
+ /**
2228
+ * The Identity API used to identify and get information about the signed in user.
2229
+ *
2230
+ * @public
2231
+ */
2232
+ type IdentityApi = {
2233
+ /**
2234
+ * The profile of the signed in user.
2235
+ */
2236
+ getProfileInfo(): Promise<ProfileInfo>;
2237
+ /**
2238
+ * User identity information within Backstage.
2239
+ */
2240
+ getBackstageIdentity(): Promise<BackstageUserIdentity>;
2241
+ /**
2242
+ * Provides credentials in the form of a token which proves the identity of the signed in user.
2243
+ *
2244
+ * The token will be undefined if the signed in user does not have a verified
2245
+ * identity, such as a demo user or mocked user for e2e tests.
2246
+ */
2247
+ getCredentials(): Promise<{
2248
+ token?: string;
2249
+ }>;
2250
+ /**
2251
+ * Sign out the current user
2252
+ */
2253
+ signOut(): Promise<void>;
2254
+ };
2255
+ /**
2256
+ * The {@link ApiRef} of {@link IdentityApi}.
2257
+ *
2258
+ * @public
2259
+ */
2260
+ declare const identityApiRef: ApiRef<IdentityApi>;
2261
+
2262
+ /**
2263
+ * A handle for an open dialog that can be used to interact with it.
2264
+ *
2265
+ * @remarks
2266
+ *
2267
+ * Dialogs can be opened using either {@link DialogApi.show} or {@link DialogApi.showModal}.
2268
+ *
2269
+ * @public
2270
+ */
2271
+ interface DialogApiDialog<TResult = void> {
2272
+ /**
2273
+ * Closes the dialog with that provided result.
2274
+ *
2275
+ * @remarks
2276
+ *
2277
+ * If the dialog is a modal dialog a result must always be provided. If it's a regular dialog then passing a result is optional.
2278
+ */
2279
+ close(...args: undefined extends TResult ? [result?: TResult] : [result: TResult]): void;
2280
+ /**
2281
+ * Replaces the content of the dialog with the provided element or component, causing it to be rerenedered.
2282
+ */
2283
+ update(elementOrComponent: React.JSX.Element | ((props: {
2284
+ dialog: DialogApiDialog<TResult>;
2285
+ }) => JSX.Element)): void;
2286
+ /**
2287
+ * Wait until the dialog is closed and return the result.
2288
+ *
2289
+ * @remarks
2290
+ *
2291
+ * If the dialog is a modal dialog a result will always be returned. If it's a regular dialog then the result may be `undefined`.
2292
+ */
2293
+ result(): Promise<TResult>;
2294
+ }
2295
+ /**
2296
+ * A Utility API for showing dialogs that render in the React tree and return a result.
2297
+ *
2298
+ * @public
2299
+ */
2300
+ interface DialogApi {
2301
+ /**
2302
+ * Opens a modal dialog and returns a handle to it.
2303
+ *
2304
+ * @remarks
2305
+ *
2306
+ * This dialog can be closed by calling the `close` method on the returned handle, optionally providing a result.
2307
+ * The dialog can also be closed by the user by clicking the backdrop or pressing the escape key.
2308
+ *
2309
+ * If the dialog is closed without a result, the result will be `undefined`.
2310
+ *
2311
+ * @example
2312
+ *
2313
+ * ### Example with inline dialog content
2314
+ * ```tsx
2315
+ * const dialog = dialogApi.show<boolean>(
2316
+ * <DialogContent>
2317
+ * <DialogTitle>Are you sure?</DialogTitle>
2318
+ * <DialogActions>
2319
+ * <Button onClick={() => dialog.close(true)}>Yes</Button>
2320
+ * <Button onClick={() => dialog.close(false)}>No</Button>
2321
+ * </DialogActions>
2322
+ * </DialogContent>
2323
+ * );
2324
+ * const result = await dialog.result();
2325
+ * ```
2326
+ *
2327
+ * @example
1452
2328
  *
1453
2329
  * ### Example with separate dialog component
1454
2330
  * ```tsx
@@ -1495,37 +2371,135 @@ interface DialogApi {
1495
2371
  * const result = await dialog.result();
1496
2372
  * ```
1497
2373
  *
1498
- * @example
2374
+ * @example
2375
+ *
2376
+ * ### Example with separate dialog component
2377
+ * ```tsx
2378
+ * function CustomDialog({ dialog }: { dialog: DialogApiDialog<boolean> }) {
2379
+ * return (
2380
+ * <DialogContent>
2381
+ * <DialogTitle>Are you sure?</DialogTitle>
2382
+ * <DialogActions>
2383
+ * <Button onClick={() => dialog.close(true)}>Yes</Button>
2384
+ * <Button onClick={() => dialog.close(false)}>No</Button>
2385
+ * </DialogActions>
2386
+ * </DialogContent>
2387
+ * )
2388
+ * }
2389
+ * const result = await dialogApi.showModal(CustomDialog).result();
2390
+ * ```
2391
+ *
2392
+ * @param elementOrComponent - The element or component to render in the dialog. If a component is provided, it will be provided with a `dialog` prop that contains the dialog handle.
2393
+ * @public
2394
+ */
2395
+ showModal<TResult = void>(elementOrComponent: JSX.Element | ((props: {
2396
+ dialog: DialogApiDialog<TResult>;
2397
+ }) => JSX.Element)): DialogApiDialog<TResult>;
2398
+ }
2399
+ /**
2400
+ * The `ApiRef` of {@link DialogApi}.
2401
+ *
2402
+ * @public
2403
+ */
2404
+ declare const dialogApiRef: _backstage_frontend_plugin_api.ApiRef<DialogApi>;
2405
+
2406
+ /**
2407
+ * Describes how to handle auth requests. Both how to show them to the user, and what to do when
2408
+ * the user accesses the auth request.
2409
+ *
2410
+ * @public
2411
+ */
2412
+ type OAuthRequesterOptions<TOAuthResponse> = {
2413
+ /**
2414
+ * Information about the auth provider, which will be forwarded to auth requests.
2415
+ */
2416
+ provider: AuthProviderInfo;
2417
+ /**
2418
+ * Implementation of the auth flow, which will be called synchronously when
2419
+ * trigger() is called on an auth requests.
2420
+ */
2421
+ onAuthRequest(scopes: Set<string>): Promise<TOAuthResponse>;
2422
+ };
2423
+ /**
2424
+ * Function used to trigger new auth requests for a set of scopes.
2425
+ *
2426
+ * @remarks
2427
+ *
2428
+ * The returned promise will resolve to the same value returned by the onAuthRequest in the
2429
+ * {@link OAuthRequesterOptions}. Or rejected, if the request is rejected.
2430
+ *
2431
+ * This function can be called multiple times before the promise resolves. All calls
2432
+ * will be merged into one request, and the scopes forwarded to the onAuthRequest will be the
2433
+ * union of all requested scopes.
2434
+ *
2435
+ * @public
2436
+ */
2437
+ type OAuthRequester<TAuthResponse> = (scopes: Set<string>) => Promise<TAuthResponse>;
2438
+ /**
2439
+ * An pending auth request for a single auth provider. The request will remain in this pending
2440
+ * state until either reject() or trigger() is called.
2441
+ *
2442
+ * @remarks
2443
+ *
2444
+ * Any new requests for the same provider are merged into the existing pending request, meaning
2445
+ * there will only ever be a single pending request for a given provider.
2446
+ *
2447
+ * @public
2448
+ */
2449
+ type PendingOAuthRequest = {
2450
+ /**
2451
+ * Information about the auth provider, as given in the AuthRequesterOptions
2452
+ */
2453
+ provider: AuthProviderInfo;
2454
+ /**
2455
+ * Rejects the request, causing all pending AuthRequester calls to fail with "RejectedError".
2456
+ */
2457
+ reject(): void;
2458
+ /**
2459
+ * Trigger the auth request to continue the auth flow, by for example showing a popup.
2460
+ *
2461
+ * Synchronously calls onAuthRequest with all scope currently in the request.
2462
+ */
2463
+ trigger(): Promise<void>;
2464
+ };
2465
+ /**
2466
+ * Provides helpers for implemented OAuth login flows within Backstage.
2467
+ *
2468
+ * @public
2469
+ */
2470
+ type OAuthRequestApi = {
2471
+ /**
2472
+ * A utility for showing login popups or similar things, and merging together multiple requests for
2473
+ * different scopes into one request that includes all scopes.
2474
+ *
2475
+ * The passed in options provide information about the login provider, and how to handle auth requests.
2476
+ *
2477
+ * The returned AuthRequester function is used to request login with new scopes. These requests
2478
+ * are merged together and forwarded to the auth handler, as soon as a consumer of auth requests
2479
+ * triggers an auth flow.
2480
+ *
2481
+ * See AuthRequesterOptions, AuthRequester, and handleAuthRequests for more info.
2482
+ */
2483
+ createAuthRequester<OAuthResponse>(options: OAuthRequesterOptions<OAuthResponse>): OAuthRequester<OAuthResponse>;
2484
+ /**
2485
+ * Observers pending auth requests. The returned observable will emit all
2486
+ * current active auth request, at most one for each created auth requester.
1499
2487
  *
1500
- * ### Example with separate dialog component
1501
- * ```tsx
1502
- * function CustomDialog({ dialog }: { dialog: DialogApiDialog<boolean> }) {
1503
- * return (
1504
- * <DialogContent>
1505
- * <DialogTitle>Are you sure?</DialogTitle>
1506
- * <DialogActions>
1507
- * <Button onClick={() => dialog.close(true)}>Yes</Button>
1508
- * <Button onClick={() => dialog.close(false)}>No</Button>
1509
- * </DialogActions>
1510
- * </DialogContent>
1511
- * )
1512
- * }
1513
- * const result = await dialogApi.showModal(CustomDialog).result();
1514
- * ```
2488
+ * Each request has its own info about the login provider, forwarded from the auth requester options.
1515
2489
  *
1516
- * @param elementOrComponent - The element or component to render in the dialog. If a component is provided, it will be provided with a `dialog` prop that contains the dialog handle.
1517
- * @public
2490
+ * Depending on user interaction, the request should either be rejected, or used to trigger the auth handler.
2491
+ * If the request is rejected, all pending AuthRequester calls will fail with a "RejectedError".
2492
+ * If a auth is triggered, and the auth handler resolves successfully, then all currently pending
2493
+ * AuthRequester calls will resolve to the value returned by the onAuthRequest call.
1518
2494
  */
1519
- showModal<TResult = void>(elementOrComponent: JSX.Element | ((props: {
1520
- dialog: DialogApiDialog<TResult>;
1521
- }) => JSX.Element)): DialogApiDialog<TResult>;
1522
- }
2495
+ authRequest$(): Observable<PendingOAuthRequest[]>;
2496
+ };
1523
2497
  /**
1524
- * The `ApiRef` of {@link DialogApi}.
2498
+ * The {@link ApiRef} of {@link OAuthRequestApi}.
1525
2499
  *
1526
2500
  * @public
1527
2501
  */
1528
- declare const dialogApiRef: _backstage_core_plugin_api.ApiRef<DialogApi>;
2502
+ declare const oauthRequestApiRef: ApiRef<OAuthRequestApi>;
1529
2503
 
1530
2504
  /**
1531
2505
  * TS magic for handling route parameters.
@@ -1558,7 +2532,87 @@ interface RouteResolutionApi {
1558
2532
  *
1559
2533
  * @public
1560
2534
  */
1561
- declare const routeResolutionApiRef: _backstage_core_plugin_api.ApiRef<RouteResolutionApi>;
2535
+ declare const routeResolutionApiRef: _backstage_frontend_plugin_api.ApiRef<RouteResolutionApi>;
2536
+
2537
+ /**
2538
+ * A snapshot in time of the current known value of a storage key.
2539
+ *
2540
+ * @public
2541
+ */
2542
+ type StorageValueSnapshot<TValue extends JsonValue> = {
2543
+ key: string;
2544
+ presence: 'unknown' | 'absent';
2545
+ value?: undefined;
2546
+ } | {
2547
+ key: string;
2548
+ presence: 'present';
2549
+ value: TValue;
2550
+ };
2551
+ /**
2552
+ * Provides a key-value persistence API.
2553
+ *
2554
+ * @public
2555
+ */
2556
+ interface StorageApi {
2557
+ /**
2558
+ * Create a bucket to store data in.
2559
+ *
2560
+ * @param name - Namespace for the storage to be stored under,
2561
+ * will inherit previous namespaces too
2562
+ */
2563
+ forBucket(name: string): StorageApi;
2564
+ /**
2565
+ * Remove persistent data.
2566
+ *
2567
+ * @param key - Unique key associated with the data.
2568
+ */
2569
+ remove(key: string): Promise<void>;
2570
+ /**
2571
+ * Save persistent data, and emit messages to anyone that is using
2572
+ * {@link StorageApi.observe$} for this key.
2573
+ *
2574
+ * @param key - Unique key associated with the data.
2575
+ * @param data - The data to be stored under the key.
2576
+ */
2577
+ set<T extends JsonValue>(key: string, data: T): Promise<void>;
2578
+ /**
2579
+ * Observe the value over time for a particular key in the current bucket.
2580
+ *
2581
+ * @remarks
2582
+ *
2583
+ * The observable will only emit values when the value changes in the underlying
2584
+ * storage, although multiple values with the same shape may be emitted in a row.
2585
+ *
2586
+ * If a {@link StorageApi.snapshot} of a key is retrieved and the presence is
2587
+ * `'unknown'`, then you are guaranteed to receive a snapshot with a known
2588
+ * presence, as long as you observe the key within the same tick.
2589
+ *
2590
+ * Since the emitted values are shared across all subscribers, it is important
2591
+ * not to mutate the returned values. The values may be frozen as a precaution.
2592
+ *
2593
+ * @param key - Unique key associated with the data
2594
+ */
2595
+ observe$<T extends JsonValue>(key: string): Observable<StorageValueSnapshot<T>>;
2596
+ /**
2597
+ * Returns an immediate snapshot value for the given key, if possible.
2598
+ *
2599
+ * @remarks
2600
+ *
2601
+ * Combine with {@link StorageApi.observe$} to get notified of value changes.
2602
+ *
2603
+ * Note that this method is synchronous, and some underlying storages may be
2604
+ * unable to retrieve a value using this method - the result may or may not
2605
+ * consistently have a presence of 'unknown'. Use {@link StorageApi.observe$}
2606
+ * to be sure to receive an actual value eventually.
2607
+ */
2608
+ snapshot<T extends JsonValue>(key: string): StorageValueSnapshot<T>;
2609
+ }
2610
+ /**
2611
+ * The {@link ApiRef} of {@link StorageApi}.
2612
+ *
2613
+ * @public
2614
+ */
2615
+ declare const storageApiRef: ApiRef<StorageApi>;
1562
2616
 
1563
2617
  /**
1564
2618
  * Represents an event worth tracking in an analytics system that could inform
@@ -1683,6 +2737,385 @@ type AnalyticsApi = {
1683
2737
  */
1684
2738
  declare const analyticsApiRef: ApiRef<AnalyticsApi>;
1685
2739
 
2740
+ /** @public */
2741
+ interface TranslationRef<TId extends string = string, TMessages extends {
2742
+ [key in string]: string;
2743
+ } = {
2744
+ [key in string]: string;
2745
+ }> {
2746
+ $$type: '@backstage/TranslationRef';
2747
+ id: TId;
2748
+ T: TMessages;
2749
+ }
2750
+ /** @ignore */
2751
+ type AnyNestedMessages = {
2752
+ [key in string]: AnyNestedMessages | string;
2753
+ };
2754
+ /**
2755
+ * Flattens a nested message declaration into a flat object with dot-separated keys.
2756
+ *
2757
+ * @ignore
2758
+ */
2759
+ type FlattenedMessages<TMessages extends AnyNestedMessages> = {
2760
+ [TKey in keyof TMessages]: (_: TMessages[TKey] extends infer TValue ? TValue extends AnyNestedMessages ? FlattenedMessages<TValue> extends infer TNested ? {
2761
+ [TNestedKey in keyof TNested as `${TKey & string}.${TNestedKey & string}`]: TNested[TNestedKey];
2762
+ } : never : {
2763
+ [_ in TKey]: TValue;
2764
+ } : never) => void;
2765
+ }[keyof TMessages] extends (_: infer TIntersection) => void ? {
2766
+ readonly [TExpandKey in keyof TIntersection]: TIntersection[TExpandKey];
2767
+ } : never;
2768
+ /** @public */
2769
+ interface TranslationRefOptions<TId extends string, TNestedMessages extends AnyNestedMessages, TTranslations extends {
2770
+ [language in string]: () => Promise<{
2771
+ default: {
2772
+ [key in keyof FlattenedMessages<TNestedMessages>]: string | null;
2773
+ };
2774
+ }>;
2775
+ }> {
2776
+ id: TId;
2777
+ messages: TNestedMessages;
2778
+ translations?: TTranslations;
2779
+ }
2780
+ /** @public */
2781
+ declare function createTranslationRef<TId extends string, const TNestedMessages extends AnyNestedMessages, TTranslations extends {
2782
+ [language in string]: () => Promise<{
2783
+ default: {
2784
+ [key in keyof FlattenedMessages<TNestedMessages>]: string | null;
2785
+ };
2786
+ }>;
2787
+ }>(config: TranslationRefOptions<TId, TNestedMessages, TTranslations>): TranslationRef<TId, FlattenedMessages<TNestedMessages>>;
2788
+
2789
+ /**
2790
+ * Represents a collection of messages to be provided for a given translation ref.
2791
+ *
2792
+ * @public
2793
+ * @remarks
2794
+ *
2795
+ * This collection of messages can either be used directly as an override for the
2796
+ * default messages, or it can be used to provide translations for a language by
2797
+ * by being referenced by a {@link TranslationResource}.
2798
+ */
2799
+ interface TranslationMessages<TId extends string = string, TMessages extends {
2800
+ [key in string]: string;
2801
+ } = {
2802
+ [key in string]: string;
2803
+ }, TFull extends boolean = boolean> {
2804
+ $$type: '@backstage/TranslationMessages';
2805
+ /** The ID of the translation ref that these messages are for */
2806
+ id: TId;
2807
+ /** Whether or not these messages override all known messages */
2808
+ full: TFull;
2809
+ /** The messages provided for the given translation ref */
2810
+ messages: TMessages;
2811
+ }
2812
+ /**
2813
+ * Options for {@link createTranslationMessages}.
2814
+ *
2815
+ * @public
2816
+ */
2817
+ interface TranslationMessagesOptions<TId extends string, TMessages extends {
2818
+ [key in string]: string;
2819
+ }, TFull extends boolean> {
2820
+ ref: TranslationRef<TId, TMessages>;
2821
+ full?: TFull;
2822
+ messages: false extends TFull ? {
2823
+ [key in keyof TMessages]?: string | null;
2824
+ } : {
2825
+ [key in keyof TMessages]: string | null;
2826
+ };
2827
+ }
2828
+ /**
2829
+ * Creates a collection of messages for a given translation ref.
2830
+ *
2831
+ * @public
2832
+ */
2833
+ declare function createTranslationMessages<TId extends string, TMessages extends {
2834
+ [key in string]: string;
2835
+ }, TFull extends boolean>(options: TranslationMessagesOptions<TId, TMessages, TFull>): TranslationMessages<TId, TMessages, TFull>;
2836
+
2837
+ /** @public */
2838
+ interface TranslationResource<TId extends string = string> {
2839
+ $$type: '@backstage/TranslationResource';
2840
+ id: TId;
2841
+ }
2842
+ /** @public */
2843
+ interface TranslationResourceOptions<TId extends string, TMessages extends {
2844
+ [key in string]: string;
2845
+ }, TTranslations extends {
2846
+ [language in string]: () => Promise<{
2847
+ default: TranslationMessages<TId> | {
2848
+ [key in keyof TMessages]: string | null;
2849
+ };
2850
+ }>;
2851
+ }> {
2852
+ ref: TranslationRef<TId, TMessages>;
2853
+ translations: TTranslations;
2854
+ }
2855
+ /** @public */
2856
+ declare function createTranslationResource<TId extends string, TMessages extends {
2857
+ [key in string]: string;
2858
+ }, TTranslations extends {
2859
+ [language in string]: () => Promise<{
2860
+ default: TranslationMessages<TId> | {
2861
+ [key in keyof TMessages]: string | null;
2862
+ };
2863
+ }>;
2864
+ }>(options: TranslationResourceOptions<TId, TMessages, TTranslations>): TranslationResource<TId>;
2865
+
2866
+ /** @public */
2867
+ declare const useTranslationRef: <TMessages extends { [key in string]: string; }>(translationRef: TranslationRef<string, TMessages>) => {
2868
+ t: TranslationFunction<TMessages>;
2869
+ };
2870
+
2871
+ /**
2872
+ * Base translation options.
2873
+ *
2874
+ * @alpha
2875
+ */
2876
+ interface BaseOptions {
2877
+ interpolation?: {
2878
+ /** Whether to HTML escape provided values, defaults to false */
2879
+ escapeValue?: boolean;
2880
+ };
2881
+ }
2882
+ /**
2883
+ * All pluralization suffixes supported by i18next
2884
+ *
2885
+ * @ignore
2886
+ */
2887
+ type TranslationPlural = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
2888
+ /**
2889
+ * A mapping of i18n formatting types to their corresponding types and options.
2890
+ * @ignore
2891
+ */
2892
+ type I18nextFormatMap = {
2893
+ number: {
2894
+ type: number;
2895
+ options: Intl.NumberFormatOptions;
2896
+ };
2897
+ currency: {
2898
+ type: number;
2899
+ options: Intl.NumberFormatOptions;
2900
+ };
2901
+ datetime: {
2902
+ type: Date;
2903
+ options: Intl.DateTimeFormatOptions;
2904
+ };
2905
+ relativetime: {
2906
+ type: number;
2907
+ options: {
2908
+ range?: Intl.RelativeTimeFormatUnit;
2909
+ } & Intl.RelativeTimeFormatOptions;
2910
+ };
2911
+ list: {
2912
+ type: string[];
2913
+ options: Intl.ListFormatOptions;
2914
+ };
2915
+ };
2916
+ /**
2917
+ * Extracts all pluralized keys from the message map.
2918
+ *
2919
+ * @example
2920
+ * ```
2921
+ * { foo: 'foo', bar_one: 'bar', bar_other: 'bars' } -> 'bar'
2922
+ * ```
2923
+ *
2924
+ * @ignore
2925
+ */
2926
+ type PluralKeys<TMessages extends {
2927
+ [key in string]: string;
2928
+ }> = {
2929
+ [Key in keyof TMessages]: Key extends `${infer K}_${TranslationPlural}` ? K : never;
2930
+ }[keyof TMessages];
2931
+ /**
2932
+ * Collapses a message map into normalized keys with union values.
2933
+ *
2934
+ * @example
2935
+ * ```
2936
+ * { foo_one: 'foo', foo_other: 'foos' } -> { foo: 'foo' | 'foos' }
2937
+ * ```
2938
+ *
2939
+ * @ignore
2940
+ */
2941
+ type CollapsedMessages<TMessages extends {
2942
+ [key in string]: string;
2943
+ }> = {
2944
+ [key in keyof TMessages as key extends `${infer K}_${TranslationPlural}` ? K : key]: TMessages[key];
2945
+ };
2946
+ /**
2947
+ * Trim away whitespace
2948
+ *
2949
+ * @ignore
2950
+ */
2951
+ type Trim<T> = T extends ` ${infer U}` ? Trim<U> : T extends `${infer U} ` ? Trim<U> : T;
2952
+ /**
2953
+ * Extracts the key and format from a replacement string.
2954
+ *
2955
+ * @example
2956
+ * ```
2957
+ * 'foo, number' -> { foo: number }, 'foo' -> { foo: undefined }
2958
+ * ```
2959
+ */
2960
+ type ExtractFormat<Replacement extends string> = Replacement extends `${infer Key},${infer FullFormat}` ? {
2961
+ [key in Trim<Key>]: Lowercase<Trim<FullFormat extends `${infer Format}(${string})${string}` ? Format : FullFormat>>;
2962
+ } : {
2963
+ [key in Trim<Replacement>]: undefined;
2964
+ };
2965
+ /**
2966
+ * Expand the keys in a flat map to nested objects.
2967
+ *
2968
+ * @example
2969
+ * ```
2970
+ * { 'a.b': 'foo', 'a.c': 'bar' } -> { a: { b: 'foo', c: 'bar' }
2971
+ * ```
2972
+ *
2973
+ * @ignore
2974
+ */
2975
+ type ExpandKeys<TMap extends {}> = {
2976
+ [Key in keyof TMap as Key extends `${infer Prefix}.${string}` ? Prefix : Key]: Key extends `${string}.${infer Rest}` ? ExpandKeys<{
2977
+ [key in Rest]: TMap[Key];
2978
+ }> : TMap[Key];
2979
+ };
2980
+ /**
2981
+ * Extracts all option keys and their format from a message string.
2982
+ *
2983
+ * @example
2984
+ * ```
2985
+ * 'foo {{bar}} {{baz, number}}' -> { 'bar': undefined, 'baz': 'number' }
2986
+ * ```
2987
+ *
2988
+ * @ignore
2989
+ */
2990
+ type ReplaceFormatsFromMessage<TMessage> = TMessage extends `${string}{{${infer Replacement}}}${infer Tail}` ? ExpandKeys<ExtractFormat<Replacement>> & ReplaceFormatsFromMessage<Tail> : {};
2991
+ /**
2992
+ * Generates the replace options structure
2993
+ *
2994
+ * @ignore
2995
+ */
2996
+ type ReplaceOptionsFromFormats<TFormats extends {}, TValueType> = {
2997
+ [Key in keyof TFormats]: TFormats[Key] extends keyof I18nextFormatMap ? I18nextFormatMap[TFormats[Key]]['type'] : TFormats[Key] extends {} ? Expand<ReplaceOptionsFromFormats<TFormats[Key], TValueType>> : TValueType;
2998
+ };
2999
+ /**
3000
+ * Generates the formatParams options structure
3001
+ *
3002
+ * @ignore
3003
+ */
3004
+ type ReplaceFormatParamsFromFormats<TFormats extends {}> = {
3005
+ [Key in keyof TFormats]?: TFormats[Key] extends keyof I18nextFormatMap ? I18nextFormatMap[TFormats[Key]]['options'] : TFormats[Key] extends {} ? Expand<ReplaceFormatParamsFromFormats<TFormats[Key]>> : undefined;
3006
+ };
3007
+ /**
3008
+ * Extracts all nesting keys from a message string.
3009
+ *
3010
+ * @example
3011
+ * ```
3012
+ * 'foo $t(bar) $t(baz)' -> 'bar' | 'baz'
3013
+ * ```
3014
+ *
3015
+ * @ignore
3016
+ */
3017
+ type NestingKeysFromMessage<TMessage extends string> = TMessage extends `${string}$t(${infer Key})${infer Tail}` ? Trim<Key> | NestingKeysFromMessage<Tail> : never;
3018
+ /**
3019
+ * Find all referenced keys, given a starting key and the full set of messages.
3020
+ *
3021
+ * This will only discover keys up to 3 levels deep.
3022
+ *
3023
+ * @example
3024
+ * ```
3025
+ * <'x', { x: '$t(y) $t(z)', y: 'y', z: '$t(w)', w: 'w', foo: 'foo' }> -> 'x' | 'y' | 'z' | 'w'
3026
+ * ```
3027
+ *
3028
+ * @ignore
3029
+ */
3030
+ type NestedMessageKeys<TKey extends keyof TMessages, TMessages extends {
3031
+ [key in string]: string;
3032
+ }> = TKey | NestedMessageKeys2<NestingKeysFromMessage<TMessages[TKey]>, TMessages>;
3033
+ type NestedMessageKeys2<TKey extends keyof TMessages, TMessages extends {
3034
+ [key in string]: string;
3035
+ }> = TKey | NestedMessageKeys3<NestingKeysFromMessage<TMessages[TKey]>, TMessages>;
3036
+ type NestedMessageKeys3<TKey extends keyof TMessages, TMessages extends {
3037
+ [key in string]: string;
3038
+ }> = TKey | NestingKeysFromMessage<TMessages[TKey]>;
3039
+ /**
3040
+ * Converts a union type to an intersection type.
3041
+ *
3042
+ * @example
3043
+ * ```
3044
+ * { foo: 'foo' } | { bar: 'bar' } -> { foo: 'foo' } & { bar: 'bar' }
3045
+ * ```
3046
+ *
3047
+ * @ignore
3048
+ */
3049
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
3050
+ /**
3051
+ * Collects different types of options into a single object
3052
+ *
3053
+ * @ignore
3054
+ */
3055
+ type CollectOptions<TCount extends {
3056
+ count?: number;
3057
+ }, TFormats extends {}, TValueType> = TCount & (keyof Omit<TFormats, 'count'> extends never ? {} : (Expand<Omit<ReplaceOptionsFromFormats<TFormats, TValueType>, 'count'>> | {
3058
+ replace: Expand<Omit<ReplaceOptionsFromFormats<TFormats, TValueType>, 'count'>>;
3059
+ }) & {
3060
+ formatParams?: Expand<ReplaceFormatParamsFromFormats<TFormats>>;
3061
+ });
3062
+ /**
3063
+ * Helper type to only require options argument if needed
3064
+ *
3065
+ * @ignore
3066
+ */
3067
+ type OptionArgs<TOptions extends {}> = keyof TOptions extends never ? [options?: Expand<BaseOptions>] : [options: Expand<BaseOptions & TOptions>];
3068
+ /**
3069
+ * @ignore
3070
+ */
3071
+ type TranslationFunctionOptions<TKeys extends keyof TMessages, // All normalized message keys to be considered, i.e. included nested ones
3072
+ TPluralKeys extends keyof TMessages, // All keys in the message map that are pluralized
3073
+ TMessages extends {
3074
+ [key in string]: string;
3075
+ }, // Collapsed message map with normalized keys and union values
3076
+ TValueType> = OptionArgs<Expand<CollectOptions<TKeys & TPluralKeys extends never ? {} : {
3077
+ count: number;
3078
+ }, ExpandRecursive<UnionToIntersection<ReplaceFormatsFromMessage<TMessages[TKeys]>>>, TValueType>>>;
3079
+ /** @public */
3080
+ type TranslationFunction<TMessages extends {
3081
+ [key in string]: string;
3082
+ }> = CollapsedMessages<TMessages> extends infer IMessages extends {
3083
+ [key in string]: string;
3084
+ } ? {
3085
+ /**
3086
+ * A translation function that returns a string.
3087
+ */
3088
+ <TKey extends keyof IMessages>(key: TKey, ...[args]: TranslationFunctionOptions<NestedMessageKeys<TKey, IMessages>, PluralKeys<TMessages>, IMessages, string>): IMessages[TKey];
3089
+ /**
3090
+ * A translation function where at least one JSX.Element has been
3091
+ * provided as an interpolation value, and will therefore return a
3092
+ * JSX.Element.
3093
+ */
3094
+ <TKey extends keyof IMessages>(key: TKey, ...[args]: TranslationFunctionOptions<NestedMessageKeys<TKey, IMessages>, PluralKeys<TMessages>, IMessages, string | JSX$1.Element>): JSX$1.Element;
3095
+ } : never;
3096
+ /** @public */
3097
+ type TranslationSnapshot<TMessages extends {
3098
+ [key in string]: string;
3099
+ }> = {
3100
+ ready: false;
3101
+ } | {
3102
+ ready: true;
3103
+ t: TranslationFunction<TMessages>;
3104
+ };
3105
+ /** @public */
3106
+ type TranslationApi = {
3107
+ getTranslation<TMessages extends {
3108
+ [key in string]: string;
3109
+ }>(translationRef: TranslationRef<string, TMessages>): TranslationSnapshot<TMessages>;
3110
+ translation$<TMessages extends {
3111
+ [key in string]: string;
3112
+ }>(translationRef: TranslationRef<string, TMessages>): Observable<TranslationSnapshot<TMessages>>;
3113
+ };
3114
+ /**
3115
+ * @public
3116
+ */
3117
+ declare const translationApiRef: ApiRef<TranslationApi>;
3118
+
1686
3119
  /**
1687
3120
  * Gets a pre-configured analytics tracker.
1688
3121
  *
@@ -1702,15 +3135,15 @@ type AnalyticsImplementationFactory<Deps extends {
1702
3135
  *
1703
3136
  * @public
1704
3137
  */
1705
- declare const AnalyticsImplementationBlueprint: ExtensionBlueprint<{
3138
+ declare const AnalyticsImplementationBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1706
3139
  kind: "analytics";
1707
- params: <TDeps extends { [name in string]: unknown; }>(params: AnalyticsImplementationFactory<TDeps>) => ExtensionBlueprintParams<AnalyticsImplementationFactory<{}>>;
1708
- output: ExtensionDataRef<AnalyticsImplementationFactory<{}>, "core.analytics.factory", {}>;
3140
+ params: <TDeps extends { [name in string]: unknown; }>(params: AnalyticsImplementationFactory<TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<AnalyticsImplementationFactory<{}>>;
3141
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<AnalyticsImplementationFactory<{}>, "core.analytics.factory", {}>;
1709
3142
  inputs: {};
1710
3143
  config: {};
1711
3144
  configInput: {};
1712
3145
  dataRefs: {
1713
- factory: ConfigurableExtensionDataRef<AnalyticsImplementationFactory<{}>, "core.analytics.factory", {}>;
3146
+ factory: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<AnalyticsImplementationFactory<{}>, "core.analytics.factory", {}>;
1714
3147
  };
1715
3148
  }>;
1716
3149
 
@@ -1719,15 +3152,15 @@ declare const AnalyticsImplementationBlueprint: ExtensionBlueprint<{
1719
3152
  *
1720
3153
  * @public
1721
3154
  */
1722
- declare const ApiBlueprint: ExtensionBlueprint<{
3155
+ declare const ApiBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1723
3156
  kind: "api";
1724
- params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: ApiFactory<TApi, TImpl, TDeps>) => ExtensionBlueprintParams<AnyApiFactory>;
1725
- output: ExtensionDataRef<AnyApiFactory, "core.api.factory", {}>;
3157
+ params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<AnyApiFactory>;
3158
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<AnyApiFactory, "core.api.factory", {}>;
1726
3159
  inputs: {};
1727
3160
  config: {};
1728
3161
  configInput: {};
1729
3162
  dataRefs: {
1730
- factory: ConfigurableExtensionDataRef<AnyApiFactory, "core.api.factory", {}>;
3163
+ factory: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<AnyApiFactory, "core.api.factory", {}>;
1731
3164
  };
1732
3165
  }>;
1733
3166
 
@@ -1737,12 +3170,12 @@ declare const ApiBlueprint: ExtensionBlueprint<{
1737
3170
  *
1738
3171
  * @public
1739
3172
  */
1740
- declare const AppRootElementBlueprint: ExtensionBlueprint<{
3173
+ declare const AppRootElementBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1741
3174
  kind: "app-root-element";
1742
3175
  params: {
1743
3176
  element: JSX.Element;
1744
3177
  };
1745
- output: ExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
3178
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
1746
3179
  inputs: {};
1747
3180
  config: {};
1748
3181
  configInput: {};
@@ -1756,7 +3189,7 @@ declare const AppRootElementBlueprint: ExtensionBlueprint<{
1756
3189
  *
1757
3190
  * @public
1758
3191
  */
1759
- declare const AppRootWrapperBlueprint: ExtensionBlueprint<{
3192
+ declare const AppRootWrapperBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1760
3193
  kind: "app-root-wrapper";
1761
3194
  params: {
1762
3195
  /** @deprecated use the `component` parameter instead */
@@ -1765,33 +3198,33 @@ declare const AppRootWrapperBlueprint: ExtensionBlueprint<{
1765
3198
  children: ReactNode;
1766
3199
  }) => JSX.Element | null;
1767
3200
  };
1768
- output: ExtensionDataRef<(props: {
3201
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<(props: {
1769
3202
  children: ReactNode;
1770
3203
  }) => JSX.Element | null, "app.root.wrapper", {}>;
1771
3204
  inputs: {};
1772
3205
  config: {};
1773
3206
  configInput: {};
1774
3207
  dataRefs: {
1775
- component: ConfigurableExtensionDataRef<(props: {
3208
+ component: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: {
1776
3209
  children: ReactNode;
1777
3210
  }) => JSX.Element | null, "app.root.wrapper", {}>;
1778
3211
  };
1779
3212
  }>;
1780
3213
 
1781
3214
  /** @public */
1782
- declare const IconBundleBlueprint: ExtensionBlueprint<{
3215
+ declare const IconBundleBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1783
3216
  kind: "icon-bundle";
1784
3217
  params: {
1785
3218
  icons: { [key in string]: IconComponent; };
1786
3219
  };
1787
- output: ExtensionDataRef<{
3220
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<{
1788
3221
  [x: string]: IconComponent;
1789
3222
  }, "core.icons", {}>;
1790
3223
  inputs: {};
1791
3224
  config: {};
1792
3225
  configInput: {};
1793
3226
  dataRefs: {
1794
- icons: ConfigurableExtensionDataRef<{
3227
+ icons: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
1795
3228
  [x: string]: IconComponent;
1796
3229
  }, "core.icons", {}>;
1797
3230
  };
@@ -1849,25 +3282,25 @@ declare const NavContentBlueprint: _backstage_frontend_plugin_api.ExtensionBluep
1849
3282
  *
1850
3283
  * @public
1851
3284
  */
1852
- declare const NavItemBlueprint: ExtensionBlueprint<{
3285
+ declare const NavItemBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1853
3286
  kind: "nav-item";
1854
3287
  params: {
1855
3288
  title: string;
1856
- icon: IconComponent$2;
3289
+ icon: IconComponent;
1857
3290
  routeRef: RouteRef<undefined>;
1858
3291
  };
1859
- output: ExtensionDataRef<{
3292
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<{
1860
3293
  title: string;
1861
- icon: IconComponent$2;
3294
+ icon: IconComponent;
1862
3295
  routeRef: RouteRef<undefined>;
1863
3296
  }, "core.nav-item.target", {}>;
1864
3297
  inputs: {};
1865
3298
  config: {};
1866
3299
  configInput: {};
1867
3300
  dataRefs: {
1868
- target: ConfigurableExtensionDataRef<{
3301
+ target: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
1869
3302
  title: string;
1870
- icon: IconComponent$2;
3303
+ icon: IconComponent;
1871
3304
  routeRef: RouteRef<undefined>;
1872
3305
  }, "core.nav-item.target", {}>;
1873
3306
  };
@@ -1878,7 +3311,7 @@ declare const NavItemBlueprint: ExtensionBlueprint<{
1878
3311
  *
1879
3312
  * @public
1880
3313
  */
1881
- declare const PageBlueprint: ExtensionBlueprint<{
3314
+ declare const PageBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1882
3315
  kind: "page";
1883
3316
  params: {
1884
3317
  /**
@@ -1889,7 +3322,7 @@ declare const PageBlueprint: ExtensionBlueprint<{
1889
3322
  loader: () => Promise<JSX.Element>;
1890
3323
  routeRef?: RouteRef;
1891
3324
  };
1892
- output: ExtensionDataRef<string, "core.routing.path", {}> | ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | ExtensionDataRef<RouteRef<AnyRouteRefParams>, "core.routing.ref", {
3325
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
1893
3326
  optional: true;
1894
3327
  }>;
1895
3328
  inputs: {};
@@ -1903,7 +3336,7 @@ declare const PageBlueprint: ExtensionBlueprint<{
1903
3336
  }>;
1904
3337
 
1905
3338
  /** @public */
1906
- declare const RouterBlueprint: ExtensionBlueprint<{
3339
+ declare const RouterBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1907
3340
  kind: "app-router-component";
1908
3341
  params: {
1909
3342
  /** @deprecated use the `component` parameter instead */
@@ -1912,35 +3345,50 @@ declare const RouterBlueprint: ExtensionBlueprint<{
1912
3345
  children: ReactNode;
1913
3346
  }) => JSX.Element | null;
1914
3347
  };
1915
- output: ExtensionDataRef<(props: {
3348
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<(props: {
1916
3349
  children: ReactNode;
1917
3350
  }) => JSX.Element | null, "app.router.wrapper", {}>;
1918
3351
  inputs: {};
1919
3352
  config: {};
1920
3353
  configInput: {};
1921
3354
  dataRefs: {
1922
- component: ConfigurableExtensionDataRef<(props: {
3355
+ component: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: {
1923
3356
  children: ReactNode;
1924
3357
  }) => JSX.Element | null, "app.router.wrapper", {}>;
1925
3358
  };
1926
3359
  }>;
1927
3360
 
3361
+ /**
3362
+ * Props for the `SignInPage` component.
3363
+ *
3364
+ * @public
3365
+ */
3366
+ type SignInPageProps = {
3367
+ /**
3368
+ * Set the IdentityApi on successful sign-in. This should only be called once.
3369
+ */
3370
+ onSignInSuccess(identityApi: IdentityApi): void;
3371
+ /**
3372
+ * The children to render.
3373
+ */
3374
+ children?: ReactNode;
3375
+ };
1928
3376
  /**
1929
3377
  * Creates an extension that replaces the sign in page.
1930
3378
  *
1931
3379
  * @public
1932
3380
  */
1933
- declare const SignInPageBlueprint: ExtensionBlueprint<{
3381
+ declare const SignInPageBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1934
3382
  kind: "sign-in-page";
1935
3383
  params: {
1936
3384
  loader: () => Promise<ComponentType<SignInPageProps>>;
1937
3385
  };
1938
- output: ExtensionDataRef<ComponentType<SignInPageProps>, "core.sign-in-page.component", {}>;
3386
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<ComponentType<SignInPageProps>, "core.sign-in-page.component", {}>;
1939
3387
  inputs: {};
1940
3388
  config: {};
1941
3389
  configInput: {};
1942
3390
  dataRefs: {
1943
- component: ConfigurableExtensionDataRef<ComponentType<SignInPageProps>, "core.sign-in-page.component", {}>;
3391
+ component: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<ComponentType<SignInPageProps>, "core.sign-in-page.component", {}>;
1944
3392
  };
1945
3393
  }>;
1946
3394
 
@@ -1949,17 +3397,17 @@ declare const SignInPageBlueprint: ExtensionBlueprint<{
1949
3397
  *
1950
3398
  * @public
1951
3399
  */
1952
- declare const ThemeBlueprint: ExtensionBlueprint<{
3400
+ declare const ThemeBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1953
3401
  kind: "theme";
1954
3402
  params: {
1955
3403
  theme: AppTheme;
1956
3404
  };
1957
- output: ExtensionDataRef<AppTheme, "core.theme.theme", {}>;
3405
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<AppTheme, "core.theme.theme", {}>;
1958
3406
  inputs: {};
1959
3407
  config: {};
1960
3408
  configInput: {};
1961
3409
  dataRefs: {
1962
- theme: ConfigurableExtensionDataRef<AppTheme, "core.theme.theme", {}>;
3410
+ theme: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<AppTheme, "core.theme.theme", {}>;
1963
3411
  };
1964
3412
  }>;
1965
3413
 
@@ -1968,19 +3416,19 @@ declare const ThemeBlueprint: ExtensionBlueprint<{
1968
3416
  *
1969
3417
  * @public
1970
3418
  */
1971
- declare const TranslationBlueprint: ExtensionBlueprint<{
3419
+ declare const TranslationBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1972
3420
  kind: "translation";
1973
3421
  params: {
1974
3422
  resource: TranslationResource | TranslationMessages;
1975
3423
  };
1976
- output: ExtensionDataRef<TranslationResource<string> | TranslationMessages<string, {
3424
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<TranslationResource<string> | TranslationMessages<string, {
1977
3425
  [x: string]: string;
1978
3426
  }, boolean>, "core.translation.translation", {}>;
1979
3427
  inputs: {};
1980
3428
  config: {};
1981
3429
  configInput: {};
1982
3430
  dataRefs: {
1983
- translation: ConfigurableExtensionDataRef<TranslationResource<string> | TranslationMessages<string, {
3431
+ translation: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<TranslationResource<string> | TranslationMessages<string, {
1984
3432
  [x: string]: string;
1985
3433
  }, boolean>, "core.translation.translation", {}>;
1986
3434
  };
@@ -1991,20 +3439,20 @@ declare const TranslationBlueprint: ExtensionBlueprint<{
1991
3439
  *
1992
3440
  * @public
1993
3441
  */
1994
- declare const SwappableComponentBlueprint: ExtensionBlueprint<{
3442
+ declare const SwappableComponentBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
1995
3443
  kind: "component";
1996
3444
  params: <Ref extends SwappableComponentRef<any>>(params: {
1997
3445
  component: Ref extends SwappableComponentRef<any, infer IExternalComponentProps> ? {
1998
3446
  ref: Ref;
1999
3447
  } & ((props: IExternalComponentProps) => JSX.Element | null) : never;
2000
3448
  loader: Ref extends SwappableComponentRef<infer IInnerComponentProps, any> ? (() => (props: IInnerComponentProps) => JSX.Element | null) | (() => Promise<(props: IInnerComponentProps) => JSX.Element | null>) : never;
2001
- }) => ExtensionBlueprintParams<{
3449
+ }) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<{
2002
3450
  component: Ref extends SwappableComponentRef<any, infer IExternalComponentProps> ? {
2003
3451
  ref: Ref;
2004
3452
  } & ((props: IExternalComponentProps) => JSX.Element | null) : never;
2005
3453
  loader: Ref extends SwappableComponentRef<infer IInnerComponentProps, any> ? (() => (props: IInnerComponentProps) => JSX.Element | null) | (() => Promise<(props: IInnerComponentProps) => JSX.Element | null>) : never;
2006
3454
  }>;
2007
- output: ExtensionDataRef<{
3455
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<{
2008
3456
  ref: SwappableComponentRef;
2009
3457
  loader: (() => (props: {}) => JSX.Element | null) | (() => Promise<(props: {}) => JSX.Element | null>);
2010
3458
  }, "core.swappableComponent", {}>;
@@ -2012,11 +3460,12 @@ declare const SwappableComponentBlueprint: ExtensionBlueprint<{
2012
3460
  config: {};
2013
3461
  configInput: {};
2014
3462
  dataRefs: {
2015
- component: ConfigurableExtensionDataRef<{
3463
+ component: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
2016
3464
  ref: SwappableComponentRef;
2017
3465
  loader: (() => (props: {}) => JSX.Element | null) | (() => Promise<(props: {}) => JSX.Element | null>);
2018
3466
  }, "core.swappableComponent", {}>;
2019
3467
  };
2020
3468
  }>;
2021
3469
 
2022
- export { type AnalyticsApi, AnalyticsContext, type AnalyticsContextValue, type AnalyticsEvent, type AnalyticsEventAttributes, type AnalyticsImplementation, AnalyticsImplementationBlueprint, type AnalyticsImplementationFactory, type AnalyticsTracker, type AnyExtensionDataRef, type AnyRouteRefParams, ApiBlueprint, type AppNode, type AppNodeEdges, type AppNodeInstance, type AppNodeSpec, AppRootElementBlueprint, AppRootWrapperBlueprint, type AppTree, type AppTreeApi, type ConfigurableExtensionDataRef, type CreateExtensionBlueprintOptions, type CreateExtensionOptions, type CreateFrontendFeatureLoaderOptions, type CreateFrontendModuleOptions, type CreateSwappableComponentOptions, type DialogApi, type DialogApiDialog, ErrorDisplay, type ErrorDisplayProps, type Extension, type ExtensionAttachTo, type ExtensionAttachToSpec, type ExtensionBlueprint, type ExtensionBlueprintDefineParams, type ExtensionBlueprintParameters, type ExtensionBlueprintParams, ExtensionBoundary, type ExtensionBoundaryProps, type ExtensionDataContainer, type ExtensionDataRef, type ExtensionDataRefToValue, type ExtensionDataValue, type ExtensionDefinition, type ExtensionDefinitionAttachTo, type ExtensionDefinitionParameters, type ExtensionFactoryMiddleware, type ExtensionInput, type ExternalRouteRef, type FeatureFlagConfig, type FrontendFeature, type FrontendFeatureLoader, type FrontendModule, type FrontendPlugin, type FrontendPluginInfo, type FrontendPluginInfoOptions, IconBundleBlueprint, type IconComponent, type IconsApi, NavContentBlueprint, type NavContentComponent, type NavContentComponentProps, NavItemBlueprint, NotFoundErrorPage, type NotFoundErrorPageProps, type OverridableExtensionDefinition, type OverridableFrontendPlugin, PageBlueprint, type PluginOptions, type PortableSchema, Progress, type ProgressProps, type ResolvedExtensionInput, type ResolvedExtensionInputs, type RouteFunc, type RouteRef, type RouteResolutionApi, RouterBlueprint, SignInPageBlueprint, type SubRouteRef, SwappableComponentBlueprint, type SwappableComponentRef, type SwappableComponentsApi, ThemeBlueprint, TranslationBlueprint, analyticsApiRef, appTreeApiRef, coreExtensionData, createExtension, createExtensionBlueprint, createExtensionBlueprintParams, createExtensionDataRef, createExtensionInput, createExternalRouteRef, createFrontendFeatureLoader, createFrontendModule, createFrontendPlugin, createRouteRef, createSubRouteRef, createSwappableComponent, dialogApiRef, iconsApiRef, routeResolutionApiRef, swappableComponentsApiRef, useAnalytics, useAppNode, useRouteRef, useRouteRefParams };
3470
+ export { AnalyticsContext, AnalyticsImplementationBlueprint, ApiBlueprint, AppRootElementBlueprint, AppRootWrapperBlueprint, ErrorDisplay, ExtensionBoundary, FeatureFlagState, IconBundleBlueprint, NavContentBlueprint, NavItemBlueprint, NotFoundErrorPage, PageBlueprint, Progress, RouterBlueprint, SessionState, SignInPageBlueprint, SwappableComponentBlueprint, ThemeBlueprint, TranslationBlueprint, alertApiRef, analyticsApiRef, appLanguageApiRef, appThemeApiRef, appTreeApiRef, atlassianAuthApiRef, bitbucketAuthApiRef, bitbucketServerAuthApiRef, configApiRef, coreExtensionData, createApiFactory, createApiRef, createExtension, createExtensionBlueprint, createExtensionBlueprintParams, createExtensionDataRef, createExtensionInput, createExternalRouteRef, createFrontendFeatureLoader, createFrontendModule, createFrontendPlugin, createRouteRef, createSubRouteRef, createSwappableComponent, createTranslationMessages, createTranslationRef, createTranslationResource, dialogApiRef, discoveryApiRef, errorApiRef, featureFlagsApiRef, fetchApiRef, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, iconsApiRef, identityApiRef, microsoftAuthApiRef, oauthRequestApiRef, oktaAuthApiRef, oneloginAuthApiRef, openshiftAuthApiRef, routeResolutionApiRef, storageApiRef, swappableComponentsApiRef, translationApiRef, useAnalytics, useApi, useApiHolder, useAppNode, useRouteRef, useRouteRefParams, useTranslationRef, vmwareCloudAuthApiRef, withApis };
3471
+ export type { AlertApi, AlertMessage, AnalyticsApi, AnalyticsContextValue, AnalyticsEvent, AnalyticsEventAttributes, AnalyticsImplementation, AnalyticsImplementationFactory, AnalyticsTracker, AnyApiFactory, AnyApiRef, AnyExtensionDataRef, AnyRouteRefParams, ApiFactory, ApiHolder, ApiRef, ApiRefConfig, AppLanguageApi, AppNode, AppNodeEdges, AppNodeInstance, AppNodeSpec, AppTheme, AppThemeApi, AppTree, AppTreeApi, AuthProviderInfo, AuthRequestOptions, BackstageIdentityApi, BackstageIdentityResponse, BackstageUserIdentity, ConfigApi, ConfigurableExtensionDataRef, CreateExtensionBlueprintOptions, CreateExtensionOptions, CreateFrontendFeatureLoaderOptions, CreateFrontendModuleOptions, CreateSwappableComponentOptions, DialogApi, DialogApiDialog, DiscoveryApi, ErrorApi, ErrorApiError, ErrorApiErrorContext, ErrorDisplayProps, Extension, ExtensionAttachTo, ExtensionAttachToSpec, ExtensionBlueprint, ExtensionBlueprintDefineParams, ExtensionBlueprintParameters, ExtensionBlueprintParams, ExtensionBoundaryProps, ExtensionDataContainer, ExtensionDataRef, ExtensionDataRefToValue, ExtensionDataValue, ExtensionDefinition, ExtensionDefinitionAttachTo, ExtensionDefinitionParameters, ExtensionFactoryMiddleware, ExtensionInput, ExternalRouteRef, FeatureFlag, FeatureFlagConfig, FeatureFlagsApi, FeatureFlagsSaveOptions, FetchApi, FrontendFeature, FrontendFeatureLoader, FrontendModule, FrontendPlugin, FrontendPluginInfo, FrontendPluginInfoOptions, IconComponent, IconsApi, IdentityApi, NavContentComponent, NavContentComponentProps, NotFoundErrorPageProps, OAuthApi, OAuthRequestApi, OAuthRequester, OAuthRequesterOptions, OAuthScope, OpenIdConnectApi, OverridableExtensionDefinition, OverridableFrontendPlugin, PendingOAuthRequest, PluginOptions, PortableSchema, ProfileInfo, ProfileInfoApi, ProgressProps, ResolvedExtensionInput, ResolvedExtensionInputs, RouteFunc, RouteRef, RouteResolutionApi, SessionApi, SignInPageProps, StorageApi, StorageValueSnapshot, SubRouteRef, SwappableComponentRef, SwappableComponentsApi, TranslationApi, TranslationFunction, TranslationMessages, TranslationMessagesOptions, TranslationRef, TranslationRefOptions, TranslationResource, TranslationResourceOptions, TranslationSnapshot, TypesToApiRefs };