@backstage/frontend-plugin-api 0.3.1-next.0 → 0.4.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/dist/index.d.ts +363 -64
- package/dist/index.esm.js +334 -48
- package/dist/index.esm.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @backstage/frontend-plugin-api
|
|
2
2
|
|
|
3
|
+
## 0.4.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8f5d6c1: Extension inputs are now wrapped into an additional object when passed to the extension factory, with the previous values being available at the `output` property. The `ExtensionInputValues` type has also been replaced by `ResolvedExtensionInputs`.
|
|
8
|
+
- 8837a96: **BREAKING**: This version changes how extensions are created and how their IDs are determined. The `createExtension` function now accepts `kind`, `namespace` and `name` instead of `id`. All of the new options are optional, and are used to construct the final extension ID. By convention extension creators should set the `kind` to match their own name, for example `createNavItemExtension` sets the kind `nav-item`.
|
|
9
|
+
|
|
10
|
+
The `createExtension` function as well as all extension creators now also return an `ExtensionDefinition` rather than an `Extension`, which in turn needs to be passed to `createPlugin` or `createExtensionOverrides` to be used.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- b7adf24: Update alpha component ref type to be more specific than any, delete boot page component and use new plugin type for error boundary component extensions.
|
|
15
|
+
- 73246ec: Added translation APIs as well as `createTranslationExtension`.
|
|
16
|
+
- cb4197a: Forward ` node`` instead of `extensionId` to resolved extension inputs.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @backstage/config@1.1.1
|
|
19
|
+
- @backstage/core-components@0.13.9-next.2
|
|
20
|
+
- @backstage/core-plugin-api@1.8.1-next.1
|
|
21
|
+
- @backstage/types@1.1.1
|
|
22
|
+
- @backstage/version-bridge@1.0.7
|
|
23
|
+
|
|
24
|
+
## 0.4.0-next.1
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- a5a04739e1: The extension `factory` function now longer receives `id` or `source`, but instead now provides the extension's `AppNode` as `node`. The `ExtensionBoundary` component has also been updated to receive a `node` prop rather than `id` and `source`.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- 5eb6b8a7bc: Added the nav logo extension for customization of sidebar logo
|
|
33
|
+
- 1f12fb762c: Create factories for overriding default core components extensions.
|
|
34
|
+
- 59709286b3: Add feature flags to plugins and extension overrides.
|
|
35
|
+
- e539735435: Added `createSignInPageExtension`.
|
|
36
|
+
- f27ee7d937: Migrate analytics api and context files.
|
|
37
|
+
- Updated dependencies
|
|
38
|
+
- @backstage/core-components@0.13.9-next.1
|
|
39
|
+
- @backstage/core-plugin-api@1.8.1-next.1
|
|
40
|
+
- @backstage/config@1.1.1
|
|
41
|
+
- @backstage/types@1.1.1
|
|
42
|
+
- @backstage/version-bridge@1.0.7
|
|
43
|
+
|
|
3
44
|
## 0.3.1-next.0
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,56 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import React, { ReactNode, JSX as JSX$1, ComponentType } from 'react';
|
|
2
3
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
3
|
-
import { IconComponent as IconComponent$1, AnyApiFactory, AppTheme, AnyApiRef } from '@backstage/core-plugin-api';
|
|
4
|
+
import { IconComponent as IconComponent$1, AnyApiFactory, AppTheme, ApiRef, AnyApiRef, SignInPageProps } from '@backstage/core-plugin-api';
|
|
4
5
|
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, storageApiRef, useApi, useApiHolder, withApis } from '@backstage/core-plugin-api';
|
|
5
6
|
import { JsonObject } from '@backstage/types';
|
|
6
|
-
import
|
|
7
|
+
import { TranslationResource, TranslationMessages } from '@backstage/core-plugin-api/alpha';
|
|
8
|
+
export { TranslationMessages, TranslationMessagesOptions, TranslationRef, TranslationRefOptions, TranslationResource, TranslationResourceOptions, createTranslationMessages, createTranslationRef, createTranslationResource, useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
9
|
import { z, ZodSchema, ZodTypeDef } from 'zod';
|
|
8
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Common analytics context attributes.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
type CommonAnalyticsContext = {
|
|
17
|
+
/**
|
|
18
|
+
* The nearest known parent plugin where the event was captured.
|
|
19
|
+
*/
|
|
20
|
+
pluginId: string;
|
|
21
|
+
/**
|
|
22
|
+
* The nearest known parent extension where the event was captured.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The nearest known parent extension where the event was captured.
|
|
26
|
+
*/
|
|
27
|
+
extensionId: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Analytics context envelope.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
type AnalyticsContextValue = CommonAnalyticsContext & {
|
|
35
|
+
[param in string]: string | boolean | number | undefined;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Provides components in the child react tree an Analytics Context, ensuring
|
|
40
|
+
* all analytics events captured within the context have relevant attributes.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
*
|
|
44
|
+
* Analytics contexts are additive, meaning the context ultimately emitted with
|
|
45
|
+
* an event is the combination of all contexts in the parent tree.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
declare const AnalyticsContext: (options: {
|
|
50
|
+
attributes: Partial<AnalyticsContextValue>;
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
}) => React.JSX.Element;
|
|
53
|
+
|
|
9
54
|
/**
|
|
10
55
|
* Catch-all type for route params.
|
|
11
56
|
*
|
|
@@ -217,6 +262,47 @@ interface ConfigurableExtensionDataRef<TData, TConfig extends {
|
|
|
217
262
|
/** @public */
|
|
218
263
|
declare function createExtensionDataRef<TData>(id: string): ConfigurableExtensionDataRef<TData>;
|
|
219
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Utility type to expand type aliases into their equivalent type.
|
|
267
|
+
* @ignore
|
|
268
|
+
*/
|
|
269
|
+
type Expand<T> = T extends infer O ? {
|
|
270
|
+
[K in keyof O]: O[K];
|
|
271
|
+
} : never;
|
|
272
|
+
/** @public */
|
|
273
|
+
type CoreProgressProps = {};
|
|
274
|
+
/** @public */
|
|
275
|
+
type CoreNotFoundErrorPageProps = {
|
|
276
|
+
children?: ReactNode;
|
|
277
|
+
};
|
|
278
|
+
/** @public */
|
|
279
|
+
type CoreErrorBoundaryFallbackProps = {
|
|
280
|
+
plugin?: BackstagePlugin;
|
|
281
|
+
error: Error;
|
|
282
|
+
resetError: () => void;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/** @public */
|
|
286
|
+
type ComponentRef<T extends {} = {}> = {
|
|
287
|
+
id: string;
|
|
288
|
+
T: T;
|
|
289
|
+
};
|
|
290
|
+
/** @public */
|
|
291
|
+
declare const coreComponentRefs: {
|
|
292
|
+
progress: ComponentRef<CoreProgressProps>;
|
|
293
|
+
notFoundErrorPage: ComponentRef<CoreNotFoundErrorPageProps>;
|
|
294
|
+
errorBoundaryFallback: ComponentRef<CoreErrorBoundaryFallbackProps>;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/** @public */
|
|
298
|
+
interface ExtensionBoundaryProps {
|
|
299
|
+
node: AppNode;
|
|
300
|
+
routable?: boolean;
|
|
301
|
+
children: ReactNode;
|
|
302
|
+
}
|
|
303
|
+
/** @public */
|
|
304
|
+
declare function ExtensionBoundary(props: ExtensionBoundaryProps): React.JSX.Element;
|
|
305
|
+
|
|
220
306
|
/** @public */
|
|
221
307
|
type NavTarget = {
|
|
222
308
|
title: string;
|
|
@@ -224,6 +310,11 @@ type NavTarget = {
|
|
|
224
310
|
routeRef: RouteRef<undefined>;
|
|
225
311
|
};
|
|
226
312
|
/** @public */
|
|
313
|
+
type LogoElements = {
|
|
314
|
+
logoIcon?: JSX$1.Element;
|
|
315
|
+
logoFull?: JSX$1.Element;
|
|
316
|
+
};
|
|
317
|
+
/** @public */
|
|
227
318
|
declare const coreExtensionData: {
|
|
228
319
|
reactElement: ConfigurableExtensionDataRef<JSX$1.Element, {}>;
|
|
229
320
|
routePath: ConfigurableExtensionDataRef<string, {}>;
|
|
@@ -231,6 +322,11 @@ declare const coreExtensionData: {
|
|
|
231
322
|
routeRef: ConfigurableExtensionDataRef<RouteRef<AnyRouteRefParams>, {}>;
|
|
232
323
|
navTarget: ConfigurableExtensionDataRef<NavTarget, {}>;
|
|
233
324
|
theme: ConfigurableExtensionDataRef<AppTheme, {}>;
|
|
325
|
+
logoElements: ConfigurableExtensionDataRef<LogoElements, {}>;
|
|
326
|
+
component: ConfigurableExtensionDataRef<{
|
|
327
|
+
ref: ComponentRef;
|
|
328
|
+
impl: ComponentType;
|
|
329
|
+
}, {}>;
|
|
234
330
|
};
|
|
235
331
|
|
|
236
332
|
/** @public */
|
|
@@ -242,14 +338,6 @@ type PortableSchema<TOutput> = {
|
|
|
242
338
|
/** @public */
|
|
243
339
|
declare function createSchemaFromZod<TOutput, TInput>(schemaCreator: (zImpl: typeof z) => ZodSchema<TOutput, ZodTypeDef, TInput>): PortableSchema<TOutput>;
|
|
244
340
|
|
|
245
|
-
/**
|
|
246
|
-
* Utility type to expand type aliases into their equivalent type.
|
|
247
|
-
* @ignore
|
|
248
|
-
*/
|
|
249
|
-
type Expand<T> = T extends infer O ? {
|
|
250
|
-
[K in keyof O]: O[K];
|
|
251
|
-
} : never;
|
|
252
|
-
|
|
253
341
|
/** @public */
|
|
254
342
|
interface ExtensionInput<TExtensionData extends AnyExtensionDataMap, TConfig extends {
|
|
255
343
|
singleton: boolean;
|
|
@@ -268,32 +356,6 @@ declare function createExtensionInput<TExtensionData extends AnyExtensionDataMap
|
|
|
268
356
|
optional: TConfig['optional'] extends true ? true : false;
|
|
269
357
|
}>;
|
|
270
358
|
|
|
271
|
-
/** @public */
|
|
272
|
-
type AnyRoutes = {
|
|
273
|
-
[name in string]: RouteRef;
|
|
274
|
-
};
|
|
275
|
-
/** @public */
|
|
276
|
-
type AnyExternalRoutes = {
|
|
277
|
-
[name in string]: ExternalRouteRef;
|
|
278
|
-
};
|
|
279
|
-
/** @public */
|
|
280
|
-
interface PluginOptions<Routes extends AnyRoutes, ExternalRoutes extends AnyExternalRoutes> {
|
|
281
|
-
id: string;
|
|
282
|
-
routes?: Routes;
|
|
283
|
-
externalRoutes?: ExternalRoutes;
|
|
284
|
-
extensions?: Extension<unknown>[];
|
|
285
|
-
}
|
|
286
|
-
/** @public */
|
|
287
|
-
interface BackstagePlugin<Routes extends AnyRoutes = AnyRoutes, ExternalRoutes extends AnyExternalRoutes = AnyExternalRoutes> {
|
|
288
|
-
$$type: '@backstage/BackstagePlugin';
|
|
289
|
-
id: string;
|
|
290
|
-
extensions: Extension<unknown>[];
|
|
291
|
-
routes: Routes;
|
|
292
|
-
externalRoutes: ExternalRoutes;
|
|
293
|
-
}
|
|
294
|
-
/** @public */
|
|
295
|
-
declare function createPlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}>(options: PluginOptions<Routes, ExternalRoutes>): BackstagePlugin<Routes, ExternalRoutes>;
|
|
296
|
-
|
|
297
359
|
/** @public */
|
|
298
360
|
type AnyExtensionDataMap = {
|
|
299
361
|
[name in string]: ExtensionDataRef<unknown, {
|
|
@@ -321,17 +383,27 @@ type ExtensionDataValues<TExtensionData extends AnyExtensionDataMap> = {
|
|
|
321
383
|
} ? DataName : never]?: TExtensionData[DataName]['T'];
|
|
322
384
|
};
|
|
323
385
|
/**
|
|
324
|
-
*
|
|
386
|
+
* Convert a single extension input into a matching resolved input.
|
|
325
387
|
* @public
|
|
326
388
|
*/
|
|
327
|
-
type
|
|
389
|
+
type ResolvedExtensionInput<TExtensionData extends AnyExtensionDataMap> = {
|
|
390
|
+
node: AppNode;
|
|
391
|
+
output: ExtensionDataValues<TExtensionData>;
|
|
392
|
+
};
|
|
393
|
+
/**
|
|
394
|
+
* Converts an extension input map into a matching collection of resolved inputs.
|
|
395
|
+
* @public
|
|
396
|
+
*/
|
|
397
|
+
type ResolvedExtensionInputs<TInputs extends {
|
|
328
398
|
[name in string]: ExtensionInput<any, any>;
|
|
329
399
|
}> = {
|
|
330
|
-
[InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton'] ? Array<Expand<
|
|
400
|
+
[InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton'] ? Array<Expand<ResolvedExtensionInput<TInputs[InputName]['extensionData']>>> : false extends TInputs[InputName]['config']['optional'] ? Expand<ResolvedExtensionInput<TInputs[InputName]['extensionData']>> : Expand<ResolvedExtensionInput<TInputs[InputName]['extensionData']> | undefined>;
|
|
331
401
|
};
|
|
332
402
|
/** @public */
|
|
333
403
|
interface CreateExtensionOptions<TOutput extends AnyExtensionDataMap, TInputs extends AnyExtensionInputMap, TConfig> {
|
|
334
|
-
|
|
404
|
+
kind?: string;
|
|
405
|
+
namespace?: string;
|
|
406
|
+
name?: string;
|
|
335
407
|
attachTo: {
|
|
336
408
|
id: string;
|
|
337
409
|
input: string;
|
|
@@ -341,12 +413,32 @@ interface CreateExtensionOptions<TOutput extends AnyExtensionDataMap, TInputs ex
|
|
|
341
413
|
output: TOutput;
|
|
342
414
|
configSchema?: PortableSchema<TConfig>;
|
|
343
415
|
factory(options: {
|
|
344
|
-
|
|
416
|
+
node: AppNode;
|
|
345
417
|
config: TConfig;
|
|
346
|
-
inputs: Expand<
|
|
418
|
+
inputs: Expand<ResolvedExtensionInputs<TInputs>>;
|
|
347
419
|
}): Expand<ExtensionDataValues<TOutput>>;
|
|
348
420
|
}
|
|
349
421
|
/** @public */
|
|
422
|
+
interface ExtensionDefinition<TConfig> {
|
|
423
|
+
$$type: '@backstage/ExtensionDefinition';
|
|
424
|
+
kind?: string;
|
|
425
|
+
namespace?: string;
|
|
426
|
+
name?: string;
|
|
427
|
+
attachTo: {
|
|
428
|
+
id: string;
|
|
429
|
+
input: string;
|
|
430
|
+
};
|
|
431
|
+
disabled: boolean;
|
|
432
|
+
inputs: AnyExtensionInputMap;
|
|
433
|
+
output: AnyExtensionDataMap;
|
|
434
|
+
configSchema?: PortableSchema<TConfig>;
|
|
435
|
+
factory(options: {
|
|
436
|
+
node: AppNode;
|
|
437
|
+
config: TConfig;
|
|
438
|
+
inputs: ResolvedExtensionInputs<any>;
|
|
439
|
+
}): ExtensionDataValues<any>;
|
|
440
|
+
}
|
|
441
|
+
/** @public */
|
|
350
442
|
interface Extension<TConfig> {
|
|
351
443
|
$$type: '@backstage/Extension';
|
|
352
444
|
id: string;
|
|
@@ -359,21 +451,58 @@ interface Extension<TConfig> {
|
|
|
359
451
|
output: AnyExtensionDataMap;
|
|
360
452
|
configSchema?: PortableSchema<TConfig>;
|
|
361
453
|
factory(options: {
|
|
362
|
-
|
|
454
|
+
node: AppNode;
|
|
363
455
|
config: TConfig;
|
|
364
|
-
inputs:
|
|
456
|
+
inputs: ResolvedExtensionInputs<any>;
|
|
365
457
|
}): ExtensionDataValues<any>;
|
|
366
458
|
}
|
|
367
459
|
/** @public */
|
|
368
|
-
declare function createExtension<TOutput extends AnyExtensionDataMap, TInputs extends AnyExtensionInputMap, TConfig = never>(options: CreateExtensionOptions<TOutput, TInputs, TConfig>):
|
|
460
|
+
declare function createExtension<TOutput extends AnyExtensionDataMap, TInputs extends AnyExtensionInputMap, TConfig = never>(options: CreateExtensionOptions<TOutput, TInputs, TConfig>): ExtensionDefinition<TConfig>;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Feature flag configuration.
|
|
464
|
+
*
|
|
465
|
+
* @public
|
|
466
|
+
*/
|
|
467
|
+
type FeatureFlagConfig = {
|
|
468
|
+
/** Feature flag name */
|
|
469
|
+
name: string;
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
/** @public */
|
|
473
|
+
type AnyRoutes = {
|
|
474
|
+
[name in string]: RouteRef;
|
|
475
|
+
};
|
|
476
|
+
/** @public */
|
|
477
|
+
type AnyExternalRoutes = {
|
|
478
|
+
[name in string]: ExternalRouteRef;
|
|
479
|
+
};
|
|
480
|
+
/** @public */
|
|
481
|
+
interface PluginOptions<Routes extends AnyRoutes, ExternalRoutes extends AnyExternalRoutes> {
|
|
482
|
+
id: string;
|
|
483
|
+
routes?: Routes;
|
|
484
|
+
externalRoutes?: ExternalRoutes;
|
|
485
|
+
extensions?: ExtensionDefinition<unknown>[];
|
|
486
|
+
featureFlags?: FeatureFlagConfig[];
|
|
487
|
+
}
|
|
488
|
+
/** @public */
|
|
489
|
+
interface BackstagePlugin<Routes extends AnyRoutes = AnyRoutes, ExternalRoutes extends AnyExternalRoutes = AnyExternalRoutes> {
|
|
490
|
+
readonly $$type: '@backstage/BackstagePlugin';
|
|
491
|
+
readonly id: string;
|
|
492
|
+
readonly routes: Routes;
|
|
493
|
+
readonly externalRoutes: ExternalRoutes;
|
|
494
|
+
}
|
|
495
|
+
/** @public */
|
|
496
|
+
declare function createPlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}>(options: PluginOptions<Routes, ExternalRoutes>): BackstagePlugin<Routes, ExternalRoutes>;
|
|
369
497
|
|
|
370
498
|
/** @public */
|
|
371
499
|
interface ExtensionOverridesOptions {
|
|
372
|
-
extensions:
|
|
500
|
+
extensions: ExtensionDefinition<unknown>[];
|
|
501
|
+
featureFlags?: FeatureFlagConfig[];
|
|
373
502
|
}
|
|
374
503
|
/** @public */
|
|
375
504
|
interface ExtensionOverrides {
|
|
376
|
-
$$type: '@backstage/ExtensionOverrides';
|
|
505
|
+
readonly $$type: '@backstage/ExtensionOverrides';
|
|
377
506
|
}
|
|
378
507
|
/** @public */
|
|
379
508
|
declare function createExtensionOverrides(options: ExtensionOverridesOptions): ExtensionOverrides;
|
|
@@ -476,29 +605,145 @@ interface AppTreeApi {
|
|
|
476
605
|
*/
|
|
477
606
|
declare const appTreeApiRef: _backstage_core_plugin_api.ApiRef<AppTreeApi>;
|
|
478
607
|
|
|
479
|
-
/**
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
608
|
+
/**
|
|
609
|
+
* API for looking up components based on component refs.
|
|
610
|
+
*
|
|
611
|
+
* @public
|
|
612
|
+
*/
|
|
613
|
+
interface ComponentsApi {
|
|
614
|
+
getComponent<T extends {}>(ref: ComponentRef<T>): ComponentType<T>;
|
|
485
615
|
}
|
|
486
|
-
/**
|
|
487
|
-
|
|
616
|
+
/**
|
|
617
|
+
* The `ApiRef` of {@link ComponentsApi}.
|
|
618
|
+
*
|
|
619
|
+
* @public
|
|
620
|
+
*/
|
|
621
|
+
declare const componentsApiRef: _backstage_core_plugin_api.ApiRef<ComponentsApi>;
|
|
622
|
+
/**
|
|
623
|
+
* @public
|
|
624
|
+
* Returns the component associated with the given ref.
|
|
625
|
+
*/
|
|
626
|
+
declare function useComponentRef<T extends {}>(ref: ComponentRef<T>): ComponentType<T>;
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Represents an event worth tracking in an analytics system that could inform
|
|
630
|
+
* how users of a Backstage instance are using its features.
|
|
631
|
+
*
|
|
632
|
+
* @public
|
|
633
|
+
*/
|
|
634
|
+
type AnalyticsEvent = {
|
|
635
|
+
/**
|
|
636
|
+
* A string that identifies the event being tracked by the type of action the
|
|
637
|
+
* event represents. Be careful not to encode extra metadata in this string
|
|
638
|
+
* that should instead be placed in the Analytics Context or attributes.
|
|
639
|
+
* Examples include:
|
|
640
|
+
*
|
|
641
|
+
* - view
|
|
642
|
+
* - click
|
|
643
|
+
* - filter
|
|
644
|
+
* - search
|
|
645
|
+
* - hover
|
|
646
|
+
* - scroll
|
|
647
|
+
*/
|
|
648
|
+
action: string;
|
|
649
|
+
/**
|
|
650
|
+
* A string that uniquely identifies the object that the action is being
|
|
651
|
+
* taken on. Examples include:
|
|
652
|
+
*
|
|
653
|
+
* - The path of the page viewed
|
|
654
|
+
* - The url of the link clicked
|
|
655
|
+
* - The value that was filtered by
|
|
656
|
+
* - The text that was searched for
|
|
657
|
+
*/
|
|
658
|
+
subject: string;
|
|
659
|
+
/**
|
|
660
|
+
* An optional numeric value relevant to the event that could be aggregated
|
|
661
|
+
* by analytics tools. Examples include:
|
|
662
|
+
*
|
|
663
|
+
* - The index or position of the clicked element in an ordered list
|
|
664
|
+
* - The percentage of an element that has been scrolled through
|
|
665
|
+
* - The amount of time that has elapsed since a fixed point
|
|
666
|
+
* - A satisfaction score on a fixed scale
|
|
667
|
+
*/
|
|
668
|
+
value?: number;
|
|
669
|
+
/**
|
|
670
|
+
* Optional, additional attributes (representing dimensions or metrics)
|
|
671
|
+
* specific to the event that could be forwarded on to analytics systems.
|
|
672
|
+
*/
|
|
673
|
+
attributes?: AnalyticsEventAttributes;
|
|
674
|
+
/**
|
|
675
|
+
* Contextual metadata relating to where the event was captured and by whom.
|
|
676
|
+
* This could include information about the route, plugin, or extension in
|
|
677
|
+
* which an event was captured.
|
|
678
|
+
*/
|
|
679
|
+
context: AnalyticsContextValue;
|
|
680
|
+
};
|
|
681
|
+
/**
|
|
682
|
+
* A structure allowing other arbitrary metadata to be provided by analytics
|
|
683
|
+
* event emitters.
|
|
684
|
+
*
|
|
685
|
+
* @public
|
|
686
|
+
*/
|
|
687
|
+
type AnalyticsEventAttributes = {
|
|
688
|
+
[attribute in string]: string | boolean | number;
|
|
689
|
+
};
|
|
690
|
+
/**
|
|
691
|
+
* Represents a tracker with methods that can be called to track events in a
|
|
692
|
+
* configured analytics service.
|
|
693
|
+
*
|
|
694
|
+
* @public
|
|
695
|
+
*/
|
|
696
|
+
type AnalyticsTracker = {
|
|
697
|
+
captureEvent: (action: string, subject: string, options?: {
|
|
698
|
+
value?: number;
|
|
699
|
+
attributes?: AnalyticsEventAttributes;
|
|
700
|
+
}) => void;
|
|
701
|
+
};
|
|
702
|
+
/**
|
|
703
|
+
* The Analytics API is used to track user behavior in a Backstage instance.
|
|
704
|
+
*
|
|
705
|
+
* @remarks
|
|
706
|
+
*
|
|
707
|
+
* To instrument your App or Plugin, retrieve an analytics tracker using the
|
|
708
|
+
* useAnalytics() hook. This will return a pre-configured AnalyticsTracker
|
|
709
|
+
* with relevant methods for instrumentation.
|
|
710
|
+
*
|
|
711
|
+
* @public
|
|
712
|
+
*/
|
|
713
|
+
type AnalyticsApi = {
|
|
714
|
+
/**
|
|
715
|
+
* Primary event handler responsible for compiling and forwarding events to
|
|
716
|
+
* an analytics system.
|
|
717
|
+
*/
|
|
718
|
+
captureEvent(event: AnalyticsEvent): void;
|
|
719
|
+
};
|
|
720
|
+
/**
|
|
721
|
+
* The API reference of {@link AnalyticsApi}.
|
|
722
|
+
*
|
|
723
|
+
* @public
|
|
724
|
+
*/
|
|
725
|
+
declare const analyticsApiRef: ApiRef<AnalyticsApi>;
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Gets a pre-configured analytics tracker.
|
|
729
|
+
*
|
|
730
|
+
* @public
|
|
731
|
+
*/
|
|
732
|
+
declare function useAnalytics(): AnalyticsTracker;
|
|
488
733
|
|
|
489
734
|
/** @public */
|
|
490
735
|
declare function createApiExtension<TConfig extends {}, TInputs extends AnyExtensionInputMap>(options: ({
|
|
491
736
|
api: AnyApiRef;
|
|
492
737
|
factory: (options: {
|
|
493
738
|
config: TConfig;
|
|
494
|
-
inputs: Expand<
|
|
739
|
+
inputs: Expand<ResolvedExtensionInputs<TInputs>>;
|
|
495
740
|
}) => AnyApiFactory;
|
|
496
741
|
} | {
|
|
497
742
|
factory: AnyApiFactory;
|
|
498
743
|
}) & {
|
|
499
744
|
configSchema?: PortableSchema<TConfig>;
|
|
500
745
|
inputs?: TInputs;
|
|
501
|
-
}):
|
|
746
|
+
}): ExtensionDefinition<TConfig>;
|
|
502
747
|
|
|
503
748
|
/**
|
|
504
749
|
* Helper for creating extensions for a routable React page component.
|
|
@@ -512,7 +757,8 @@ declare function createPageExtension<TConfig extends {
|
|
|
512
757
|
} | {
|
|
513
758
|
configSchema: PortableSchema<TConfig>;
|
|
514
759
|
}) & {
|
|
515
|
-
|
|
760
|
+
namespace?: string;
|
|
761
|
+
name?: string;
|
|
516
762
|
attachTo?: {
|
|
517
763
|
id: string;
|
|
518
764
|
input: string;
|
|
@@ -522,25 +768,78 @@ declare function createPageExtension<TConfig extends {
|
|
|
522
768
|
routeRef?: RouteRef;
|
|
523
769
|
loader: (options: {
|
|
524
770
|
config: TConfig;
|
|
525
|
-
inputs: Expand<
|
|
771
|
+
inputs: Expand<ResolvedExtensionInputs<TInputs>>;
|
|
526
772
|
}) => Promise<JSX.Element>;
|
|
527
|
-
}):
|
|
773
|
+
}): ExtensionDefinition<TConfig>;
|
|
528
774
|
|
|
529
775
|
/**
|
|
530
776
|
* Helper for creating extensions for a nav item.
|
|
531
777
|
* @public
|
|
532
778
|
*/
|
|
533
779
|
declare function createNavItemExtension(options: {
|
|
534
|
-
|
|
780
|
+
namespace?: string;
|
|
781
|
+
name?: string;
|
|
535
782
|
routeRef: RouteRef<undefined>;
|
|
536
783
|
title: string;
|
|
537
784
|
icon: IconComponent$1;
|
|
538
|
-
}):
|
|
785
|
+
}): ExtensionDefinition<{
|
|
539
786
|
title: string;
|
|
540
787
|
}>;
|
|
541
788
|
|
|
789
|
+
/**
|
|
790
|
+
*
|
|
791
|
+
* @public
|
|
792
|
+
*/
|
|
793
|
+
declare function createSignInPageExtension<TConfig extends {}, TInputs extends AnyExtensionInputMap>(options: {
|
|
794
|
+
namespace?: string;
|
|
795
|
+
name?: string;
|
|
796
|
+
attachTo?: {
|
|
797
|
+
id: string;
|
|
798
|
+
input: string;
|
|
799
|
+
};
|
|
800
|
+
configSchema?: PortableSchema<TConfig>;
|
|
801
|
+
disabled?: boolean;
|
|
802
|
+
inputs?: TInputs;
|
|
803
|
+
loader: (options: {
|
|
804
|
+
config: TConfig;
|
|
805
|
+
inputs: Expand<ResolvedExtensionInputs<TInputs>>;
|
|
806
|
+
}) => Promise<ComponentType<SignInPageProps>>;
|
|
807
|
+
}): ExtensionDefinition<TConfig>;
|
|
808
|
+
|
|
809
|
+
/** @public */
|
|
810
|
+
declare function createThemeExtension(theme: AppTheme): ExtensionDefinition<never>;
|
|
811
|
+
|
|
812
|
+
/** @public */
|
|
813
|
+
declare function createComponentExtension<TProps extends {}, TConfig extends {}, TInputs extends AnyExtensionInputMap>(options: {
|
|
814
|
+
ref: ComponentRef<TProps>;
|
|
815
|
+
name?: string;
|
|
816
|
+
disabled?: boolean;
|
|
817
|
+
inputs?: TInputs;
|
|
818
|
+
configSchema?: PortableSchema<TConfig>;
|
|
819
|
+
component: {
|
|
820
|
+
lazy: (values: {
|
|
821
|
+
config: TConfig;
|
|
822
|
+
inputs: Expand<ResolvedExtensionInputs<TInputs>>;
|
|
823
|
+
}) => Promise<ComponentType<TProps>>;
|
|
824
|
+
} | {
|
|
825
|
+
sync: (values: {
|
|
826
|
+
config: TConfig;
|
|
827
|
+
inputs: Expand<ResolvedExtensionInputs<TInputs>>;
|
|
828
|
+
}) => ComponentType<TProps>;
|
|
829
|
+
};
|
|
830
|
+
}): ExtensionDefinition<TConfig>;
|
|
831
|
+
|
|
832
|
+
/** @public */
|
|
833
|
+
declare function createTranslationExtension(options: {
|
|
834
|
+
name?: string;
|
|
835
|
+
resource: TranslationResource | TranslationMessages;
|
|
836
|
+
}): ExtensionDefinition<never>;
|
|
542
837
|
/** @public */
|
|
543
|
-
declare
|
|
838
|
+
declare namespace createTranslationExtension {
|
|
839
|
+
const translationDataRef: ConfigurableExtensionDataRef<TranslationResource<string> | TranslationMessages<string, {
|
|
840
|
+
[x: string]: string;
|
|
841
|
+
}, boolean>, {}>;
|
|
842
|
+
}
|
|
544
843
|
|
|
545
844
|
/**
|
|
546
845
|
* IconComponent is the common icon type used throughout Backstage when
|
|
@@ -564,4 +863,4 @@ type IconComponent = ComponentType<{
|
|
|
564
863
|
fontSize?: 'medium' | 'large' | 'small' | 'inherit';
|
|
565
864
|
}>;
|
|
566
865
|
|
|
567
|
-
export { AnyExtensionDataMap, AnyExtensionInputMap, AnyExternalRoutes, AnyRouteRefParams, AnyRoutes, AppNode, AppNodeEdges, AppNodeInstance, AppNodeSpec, AppTree, AppTreeApi, BackstagePlugin, ConfigurableExtensionDataRef, CreateExtensionOptions, Extension, ExtensionBoundary, ExtensionBoundaryProps, ExtensionDataRef, ExtensionDataValues,
|
|
866
|
+
export { AnalyticsApi, AnalyticsContext, AnalyticsContextValue, AnalyticsEvent, AnalyticsEventAttributes, AnalyticsTracker, AnyExtensionDataMap, AnyExtensionInputMap, AnyExternalRoutes, AnyRouteRefParams, AnyRoutes, AppNode, AppNodeEdges, AppNodeInstance, AppNodeSpec, AppTree, AppTreeApi, BackstagePlugin, CommonAnalyticsContext, ComponentRef, ComponentsApi, ConfigurableExtensionDataRef, CoreErrorBoundaryFallbackProps, CoreNotFoundErrorPageProps, CoreProgressProps, CreateExtensionOptions, Extension, ExtensionBoundary, ExtensionBoundaryProps, ExtensionDataRef, ExtensionDataValues, ExtensionDefinition, ExtensionInput, ExtensionOverrides, ExtensionOverridesOptions, ExternalRouteRef, FeatureFlagConfig, IconComponent, LogoElements, NavTarget, PluginOptions, PortableSchema, ResolvedExtensionInput, ResolvedExtensionInputs, RouteFunc, RouteRef, SubRouteRef, analyticsApiRef, appTreeApiRef, componentsApiRef, coreComponentRefs, coreExtensionData, createApiExtension, createComponentExtension, createExtension, createExtensionDataRef, createExtensionInput, createExtensionOverrides, createExternalRouteRef, createNavItemExtension, createPageExtension, createPlugin, createRouteRef, createSchemaFromZod, createSignInPageExtension, createSubRouteRef, createThemeExtension, createTranslationExtension, useAnalytics, useComponentRef, useRouteRef, useRouteRefParams };
|