@backstage/core-plugin-api 1.0.4 → 1.0.6-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @backstage/core-plugin-api
2
2
 
3
+ ## 1.0.6-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 744fea158b: Added `getSystemIcons()` function to the `AppContext` available through `useApp` that will pull a list of all the icons that have been registered in the App.
8
+ - bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
9
+ - ef9ab322de: Minor API signatures cleanup
10
+
11
+ ## 1.0.5
12
+
13
+ ### Patch Changes
14
+
15
+ - 80da5162c7: Introduced a new experimental feature that allows you to declare plugin-wide options for your plugin by defining
16
+ `__experimentalConfigure` in your `createPlugin` options. See https://backstage.io/docs/plugins/customization.md for more information.
17
+
18
+ This is an experimental feature and it will have breaking changes in the future.
19
+
20
+ - 87649a06bf: Add a note that the `fetchApi` utility should not be used on sign-in page implementations and similar.
21
+
22
+ ## 1.0.5-next.0
23
+
24
+ ### Patch Changes
25
+
26
+ - 80da5162c7: Introduced a new experimental feature that allows you to declare plugin-wide options for your plugin by defining
27
+ `__experimentalConfigure` in your `createPlugin` options. See https://backstage.io/docs/plugins/customization.md for more information.
28
+
29
+ This is an experimental feature and it will have breaking changes in the future.
30
+
3
31
  ## 1.0.4
4
32
 
5
33
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/core-plugin-api",
3
- "version": "1.0.4",
3
+ "version": "1.0.6-next.0",
4
4
  "main": "../dist/index.esm.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -301,6 +301,10 @@ export declare type AppContext = {
301
301
  * Get a common or custom icon for this app.
302
302
  */
303
303
  getSystemIcon(key: string): IconComponent_2 | undefined;
304
+ /**
305
+ * Get a list of common and custom icons for this app.
306
+ */
307
+ getSystemIcons(): Record<string, IconComponent_2>;
304
308
  /**
305
309
  * Get the components registered for various purposes in the app.
306
310
  */
@@ -498,7 +502,7 @@ export declare type BackstageIdentityResponse = {
498
502
  *
499
503
  * @public
500
504
  */
501
- export declare type BackstagePlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}> = {
505
+ export declare type BackstagePlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}, PluginInputOptions extends {} = {}> = {
502
506
  getId(): string;
503
507
  getApis(): Iterable<AnyApiFactory>;
504
508
  /**
@@ -508,6 +512,7 @@ export declare type BackstagePlugin<Routes extends AnyRoutes = {}, ExternalRoute
508
512
  provide<T>(extension: Extension<T>): T;
509
513
  routes: Routes;
510
514
  externalRoutes: ExternalRoutes;
515
+ __experimentalReconfigure(options: PluginInputOptions): void;
511
516
  };
512
517
 
513
518
  /**
@@ -696,7 +701,7 @@ export declare function createExternalRouteRef<Params extends {
696
701
  * @param config - Plugin configuration.
697
702
  * @public
698
703
  */
699
- export declare function createPlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}>(config: PluginConfig<Routes, ExternalRoutes>): BackstagePlugin<Routes, ExternalRoutes>;
704
+ export declare function createPlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}, PluginInputOptions extends {} = {}>(config: PluginConfig<Routes, ExternalRoutes, PluginInputOptions>): BackstagePlugin<Routes, ExternalRoutes, PluginInputOptions>;
700
705
 
701
706
  /**
702
707
  * Used by {@link createComponentExtension} and {@link createRoutableExtension}.
@@ -1111,6 +1116,13 @@ export declare type FetchApi = {
1111
1116
  * This is a wrapper for the fetch API, that has additional behaviors such as
1112
1117
  * the ability to automatically inject auth information where necessary.
1113
1118
  *
1119
+ * Note that the default behavior of this API (unless overridden by your org),
1120
+ * is to require that the user is already signed in so that it has auth
1121
+ * information to inject. Therefore, using the default implementation of this
1122
+ * utility API e.g. on the `SignInPage` or similar, would cause issues. In
1123
+ * special circumstances like those, you can use the regular system `fetch`
1124
+ * instead.
1125
+ *
1114
1126
  * @public
1115
1127
  */
1116
1128
  export declare const fetchApiRef: ApiRef<FetchApi>;
@@ -1477,12 +1489,13 @@ export declare type PendingOAuthRequest = {
1477
1489
  *
1478
1490
  * @public
1479
1491
  */
1480
- export declare type PluginConfig<Routes extends AnyRoutes, ExternalRoutes extends AnyExternalRoutes> = {
1492
+ export declare type PluginConfig<Routes extends AnyRoutes, ExternalRoutes extends AnyExternalRoutes, PluginInputOptions extends {}> = {
1481
1493
  id: string;
1482
1494
  apis?: Iterable<AnyApiFactory>;
1483
1495
  routes?: Routes;
1484
1496
  externalRoutes?: ExternalRoutes;
1485
1497
  featureFlags?: PluginFeatureFlagConfig[];
1498
+ __experimentalConfigure?(options?: PluginInputOptions): {};
1486
1499
  };
1487
1500
 
1488
1501
  /**
@@ -1495,6 +1508,23 @@ export declare type PluginFeatureFlagConfig = {
1495
1508
  name: string;
1496
1509
  };
1497
1510
 
1511
+ /**
1512
+ * Properties for the PluginProvider component.
1513
+ *
1514
+ * @alpha
1515
+ */
1516
+ export declare interface PluginOptionsProviderProps {
1517
+ children: ReactNode;
1518
+ plugin?: BackstagePlugin;
1519
+ }
1520
+
1521
+ /**
1522
+ * Contains the plugin configuration.
1523
+ *
1524
+ * @alpha
1525
+ */
1526
+ export declare const PluginProvider: (props: PluginOptionsProviderProps) => JSX.Element;
1527
+
1498
1528
  /**
1499
1529
  * Profile information of the user.
1500
1530
  *
@@ -1767,6 +1797,14 @@ export declare const useApp: () => AppContext;
1767
1797
  */
1768
1798
  export declare function useElementFilter<T>(node: ReactNode, filterFn: (arg: ElementCollection) => T, dependencies?: any[]): T;
1769
1799
 
1800
+ /**
1801
+ * Grab the current entity from the context, throws if the entity has not yet been loaded
1802
+ * or is not available.
1803
+ *
1804
+ * @alpha
1805
+ */
1806
+ export declare function usePluginOptions<TPluginOptions extends {} = {}>(): TPluginOptions;
1807
+
1770
1808
  /**
1771
1809
  * React hook for constructing URLs to routes.
1772
1810
  *
@@ -301,6 +301,10 @@ export declare type AppContext = {
301
301
  * Get a common or custom icon for this app.
302
302
  */
303
303
  getSystemIcon(key: string): IconComponent_2 | undefined;
304
+ /**
305
+ * Get a list of common and custom icons for this app.
306
+ */
307
+ getSystemIcons(): Record<string, IconComponent_2>;
304
308
  /**
305
309
  * Get the components registered for various purposes in the app.
306
310
  */
@@ -498,7 +502,7 @@ export declare type BackstageIdentityResponse = {
498
502
  *
499
503
  * @public
500
504
  */
501
- export declare type BackstagePlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}> = {
505
+ export declare type BackstagePlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}, PluginInputOptions extends {} = {}> = {
502
506
  getId(): string;
503
507
  getApis(): Iterable<AnyApiFactory>;
504
508
  /**
@@ -508,6 +512,7 @@ export declare type BackstagePlugin<Routes extends AnyRoutes = {}, ExternalRoute
508
512
  provide<T>(extension: Extension<T>): T;
509
513
  routes: Routes;
510
514
  externalRoutes: ExternalRoutes;
515
+ __experimentalReconfigure(options: PluginInputOptions): void;
511
516
  };
512
517
 
513
518
  /**
@@ -696,7 +701,7 @@ export declare function createExternalRouteRef<Params extends {
696
701
  * @param config - Plugin configuration.
697
702
  * @public
698
703
  */
699
- export declare function createPlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}>(config: PluginConfig<Routes, ExternalRoutes>): BackstagePlugin<Routes, ExternalRoutes>;
704
+ export declare function createPlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}, PluginInputOptions extends {} = {}>(config: PluginConfig<Routes, ExternalRoutes, PluginInputOptions>): BackstagePlugin<Routes, ExternalRoutes, PluginInputOptions>;
700
705
 
701
706
  /**
702
707
  * Used by {@link createComponentExtension} and {@link createRoutableExtension}.
@@ -1111,6 +1116,13 @@ export declare type FetchApi = {
1111
1116
  * This is a wrapper for the fetch API, that has additional behaviors such as
1112
1117
  * the ability to automatically inject auth information where necessary.
1113
1118
  *
1119
+ * Note that the default behavior of this API (unless overridden by your org),
1120
+ * is to require that the user is already signed in so that it has auth
1121
+ * information to inject. Therefore, using the default implementation of this
1122
+ * utility API e.g. on the `SignInPage` or similar, would cause issues. In
1123
+ * special circumstances like those, you can use the regular system `fetch`
1124
+ * instead.
1125
+ *
1114
1126
  * @public
1115
1127
  */
1116
1128
  export declare const fetchApiRef: ApiRef<FetchApi>;
@@ -1477,12 +1489,13 @@ export declare type PendingOAuthRequest = {
1477
1489
  *
1478
1490
  * @public
1479
1491
  */
1480
- export declare type PluginConfig<Routes extends AnyRoutes, ExternalRoutes extends AnyExternalRoutes> = {
1492
+ export declare type PluginConfig<Routes extends AnyRoutes, ExternalRoutes extends AnyExternalRoutes, PluginInputOptions extends {}> = {
1481
1493
  id: string;
1482
1494
  apis?: Iterable<AnyApiFactory>;
1483
1495
  routes?: Routes;
1484
1496
  externalRoutes?: ExternalRoutes;
1485
1497
  featureFlags?: PluginFeatureFlagConfig[];
1498
+ __experimentalConfigure?(options?: PluginInputOptions): {};
1486
1499
  };
1487
1500
 
1488
1501
  /**
@@ -1495,6 +1508,10 @@ export declare type PluginFeatureFlagConfig = {
1495
1508
  name: string;
1496
1509
  };
1497
1510
 
1511
+ /* Excluded from this release type: PluginOptionsProviderProps */
1512
+
1513
+ /* Excluded from this release type: PluginProvider */
1514
+
1498
1515
  /**
1499
1516
  * Profile information of the user.
1500
1517
  *
@@ -1767,6 +1784,8 @@ export declare const useApp: () => AppContext;
1767
1784
  */
1768
1785
  export declare function useElementFilter<T>(node: ReactNode, filterFn: (arg: ElementCollection) => T, dependencies?: any[]): T;
1769
1786
 
1787
+ /* Excluded from this release type: usePluginOptions */
1788
+
1770
1789
  /**
1771
1790
  * React hook for constructing URLs to routes.
1772
1791
  *
package/dist/index.d.ts CHANGED
@@ -301,6 +301,10 @@ export declare type AppContext = {
301
301
  * Get a common or custom icon for this app.
302
302
  */
303
303
  getSystemIcon(key: string): IconComponent_2 | undefined;
304
+ /**
305
+ * Get a list of common and custom icons for this app.
306
+ */
307
+ getSystemIcons(): Record<string, IconComponent_2>;
304
308
  /**
305
309
  * Get the components registered for various purposes in the app.
306
310
  */
@@ -498,7 +502,7 @@ export declare type BackstageIdentityResponse = {
498
502
  *
499
503
  * @public
500
504
  */
501
- export declare type BackstagePlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}> = {
505
+ export declare type BackstagePlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}, PluginInputOptions extends {} = {}> = {
502
506
  getId(): string;
503
507
  getApis(): Iterable<AnyApiFactory>;
504
508
  /**
@@ -508,6 +512,7 @@ export declare type BackstagePlugin<Routes extends AnyRoutes = {}, ExternalRoute
508
512
  provide<T>(extension: Extension<T>): T;
509
513
  routes: Routes;
510
514
  externalRoutes: ExternalRoutes;
515
+ __experimentalReconfigure(options: PluginInputOptions): void;
511
516
  };
512
517
 
513
518
  /**
@@ -696,7 +701,7 @@ export declare function createExternalRouteRef<Params extends {
696
701
  * @param config - Plugin configuration.
697
702
  * @public
698
703
  */
699
- export declare function createPlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}>(config: PluginConfig<Routes, ExternalRoutes>): BackstagePlugin<Routes, ExternalRoutes>;
704
+ export declare function createPlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}, PluginInputOptions extends {} = {}>(config: PluginConfig<Routes, ExternalRoutes, PluginInputOptions>): BackstagePlugin<Routes, ExternalRoutes, PluginInputOptions>;
700
705
 
701
706
  /**
702
707
  * Used by {@link createComponentExtension} and {@link createRoutableExtension}.
@@ -1111,6 +1116,13 @@ export declare type FetchApi = {
1111
1116
  * This is a wrapper for the fetch API, that has additional behaviors such as
1112
1117
  * the ability to automatically inject auth information where necessary.
1113
1118
  *
1119
+ * Note that the default behavior of this API (unless overridden by your org),
1120
+ * is to require that the user is already signed in so that it has auth
1121
+ * information to inject. Therefore, using the default implementation of this
1122
+ * utility API e.g. on the `SignInPage` or similar, would cause issues. In
1123
+ * special circumstances like those, you can use the regular system `fetch`
1124
+ * instead.
1125
+ *
1114
1126
  * @public
1115
1127
  */
1116
1128
  export declare const fetchApiRef: ApiRef<FetchApi>;
@@ -1477,12 +1489,13 @@ export declare type PendingOAuthRequest = {
1477
1489
  *
1478
1490
  * @public
1479
1491
  */
1480
- export declare type PluginConfig<Routes extends AnyRoutes, ExternalRoutes extends AnyExternalRoutes> = {
1492
+ export declare type PluginConfig<Routes extends AnyRoutes, ExternalRoutes extends AnyExternalRoutes, PluginInputOptions extends {}> = {
1481
1493
  id: string;
1482
1494
  apis?: Iterable<AnyApiFactory>;
1483
1495
  routes?: Routes;
1484
1496
  externalRoutes?: ExternalRoutes;
1485
1497
  featureFlags?: PluginFeatureFlagConfig[];
1498
+ __experimentalConfigure?(options?: PluginInputOptions): {};
1486
1499
  };
1487
1500
 
1488
1501
  /**
@@ -1495,6 +1508,10 @@ export declare type PluginFeatureFlagConfig = {
1495
1508
  name: string;
1496
1509
  };
1497
1510
 
1511
+ /* Excluded from this release type: PluginOptionsProviderProps */
1512
+
1513
+ /* Excluded from this release type: PluginProvider */
1514
+
1498
1515
  /**
1499
1516
  * Profile information of the user.
1500
1517
  *
@@ -1767,6 +1784,8 @@ export declare const useApp: () => AppContext;
1767
1784
  */
1768
1785
  export declare function useElementFilter<T>(node: ReactNode, filterFn: (arg: ElementCollection) => T, dependencies?: any[]): T;
1769
1786
 
1787
+ /* Excluded from this release type: usePluginOptions */
1788
+
1770
1789
  /**
1771
1790
  * React hook for constructing URLs to routes.
1772
1791
  *
package/dist/index.esm.js CHANGED
@@ -81,7 +81,9 @@ class ApiRefImpl {
81
81
  this.config = config;
82
82
  const valid = config.id.split(".").flatMap((part) => part.split("-")).every((part) => part.match(/^[a-z][a-z0-9]*$/));
83
83
  if (!valid) {
84
- throw new Error(`API id must only contain period separated lowercase alphanum tokens with dashes, got '${config.id}'`);
84
+ throw new Error(
85
+ `API id must only contain period separated lowercase alphanum tokens with dashes, got '${config.id}'`
86
+ );
85
87
  }
86
88
  }
87
89
  get id() {
@@ -241,8 +243,36 @@ function useAnalytics() {
241
243
  return tracker;
242
244
  }
243
245
 
246
+ const contextKey = "plugin-context";
247
+ const PluginProvider = (props) => {
248
+ const { children, plugin } = props;
249
+ const { Provider } = createVersionedContext(contextKey);
250
+ return /* @__PURE__ */ React.createElement(Provider, {
251
+ value: createVersionedValueMap({
252
+ 1: {
253
+ plugin
254
+ }
255
+ })
256
+ }, children);
257
+ };
258
+ function usePluginOptions() {
259
+ const versionedHolder = useVersionedContext(
260
+ contextKey
261
+ );
262
+ if (!versionedHolder) {
263
+ throw new Error("Plugin Options context is not available");
264
+ }
265
+ const value = versionedHolder.atVersion(1);
266
+ if (!value) {
267
+ throw new Error("Plugin Options v1 is not available");
268
+ }
269
+ return value.plugin.getPluginOptions();
270
+ }
271
+
244
272
  const useApp = () => {
245
- const versionedContext = useVersionedContext("app-context");
273
+ const versionedContext = useVersionedContext(
274
+ "app-context"
275
+ );
246
276
  if (!versionedContext) {
247
277
  throw new Error("App context is not available");
248
278
  }
@@ -253,7 +283,10 @@ const useApp = () => {
253
283
  return appContext;
254
284
  };
255
285
 
256
- const globalStore = getOrCreateGlobalSingleton("component-data-store", () => /* @__PURE__ */ new WeakMap());
286
+ const globalStore = getOrCreateGlobalSingleton(
287
+ "component-data-store",
288
+ () => /* @__PURE__ */ new WeakMap()
289
+ );
257
290
  const componentDataKey = "__backstage_data";
258
291
  function attachComponentData(component, type, data) {
259
292
  var _a;
@@ -271,7 +304,9 @@ function attachComponentData(component, type, data) {
271
304
  }
272
305
  if (container.map.has(type)) {
273
306
  const name = component.displayName || component.name;
274
- throw new Error(`Attempted to attach duplicate data "${type}" to component "${name}"`);
307
+ throw new Error(
308
+ `Attempted to attach duplicate data "${type}" to component "${name}"`
309
+ );
275
310
  }
276
311
  container.map.set(type, data);
277
312
  }
@@ -291,7 +326,10 @@ function getComponentData(node, type) {
291
326
  return container.map.get(type);
292
327
  }
293
328
 
294
- const routeRefType = getOrCreateGlobalSingleton("route-ref-type", () => Symbol("route-ref-type"));
329
+ const routeRefType = getOrCreateGlobalSingleton(
330
+ "route-ref-type",
331
+ () => Symbol("route-ref-type")
332
+ );
295
333
 
296
334
  var _a$2;
297
335
  class RouteRefImpl {
@@ -310,7 +348,10 @@ class RouteRefImpl {
310
348
  _a$2 = routeRefType;
311
349
  function createRouteRef(config) {
312
350
  var _a2;
313
- return new RouteRefImpl(config.id, (_a2 = config.params) != null ? _a2 : []);
351
+ return new RouteRefImpl(
352
+ config.id,
353
+ (_a2 = config.params) != null ? _a2 : []
354
+ );
314
355
  }
315
356
 
316
357
  var _a$1;
@@ -333,7 +374,9 @@ function createSubRouteRef(config) {
333
374
  const pathParams = path.split("/").filter((p) => p.startsWith(":")).map((p) => p.substring(1));
334
375
  const params = [...parent.params, ...pathParams];
335
376
  if (parent.params.some((p) => pathParams.includes(p))) {
336
- throw new Error("SubRouteRef may not have params that overlap with its parent");
377
+ throw new Error(
378
+ "SubRouteRef may not have params that overlap with its parent"
379
+ );
337
380
  }
338
381
  if (!path.startsWith("/")) {
339
382
  throw new Error(`SubRouteRef path must start with '/', got '${path}'`);
@@ -346,7 +389,12 @@ function createSubRouteRef(config) {
346
389
  throw new Error(`SubRouteRef path has invalid param, got '${param}'`);
347
390
  }
348
391
  }
349
- const subRouteRef = new SubRouteRefImpl(id, path, parent, params);
392
+ const subRouteRef = new SubRouteRefImpl(
393
+ id,
394
+ path,
395
+ parent,
396
+ params
397
+ );
350
398
  return subRouteRef;
351
399
  }
352
400
 
@@ -365,17 +413,26 @@ class ExternalRouteRefImpl {
365
413
  _a = routeRefType;
366
414
  function createExternalRouteRef(options) {
367
415
  var _a2;
368
- return new ExternalRouteRefImpl(options.id, (_a2 = options.params) != null ? _a2 : [], Boolean(options.optional));
416
+ return new ExternalRouteRefImpl(
417
+ options.id,
418
+ (_a2 = options.params) != null ? _a2 : [],
419
+ Boolean(options.optional)
420
+ );
369
421
  }
370
422
 
371
423
  function useRouteRef(routeRef) {
372
424
  const sourceLocation = useLocation();
373
- const versionedContext = useVersionedContext("routing-context");
425
+ const versionedContext = useVersionedContext(
426
+ "routing-context"
427
+ );
374
428
  if (!versionedContext) {
375
429
  throw new Error("Routing context is not available");
376
430
  }
377
431
  const resolver = versionedContext.atVersion(1);
378
- const routeFunc = useMemo(() => resolver && resolver.resolve(routeRef, sourceLocation), [resolver, routeRef, sourceLocation]);
432
+ const routeFunc = useMemo(
433
+ () => resolver && resolver.resolve(routeRef, sourceLocation),
434
+ [resolver, routeRef, sourceLocation]
435
+ );
379
436
  if (!versionedContext) {
380
437
  throw new Error("useRouteRef used outside of routing context");
381
438
  }
@@ -423,37 +480,42 @@ function createRoutableExtension(options) {
423
480
  const { component, mountPoint, name } = options;
424
481
  return createReactExtension({
425
482
  component: {
426
- lazy: () => component().then((InnerComponent) => {
427
- const RoutableExtensionWrapper = (props) => {
428
- try {
429
- useRouteRef(mountPoint);
430
- } catch (error) {
431
- if (typeof error === "object" && error !== null) {
432
- const { message } = error;
433
- if (typeof message === "string" && message.startsWith("No path for ")) {
434
- throw new Error(`Routable extension component with mount point ${mountPoint} was not discovered in the app element tree. Routable extension components may not be rendered by other components and must be directly available as an element within the App provider component.`);
483
+ lazy: () => component().then(
484
+ (InnerComponent) => {
485
+ const RoutableExtensionWrapper = (props) => {
486
+ try {
487
+ useRouteRef(mountPoint);
488
+ } catch (error) {
489
+ if (typeof error === "object" && error !== null) {
490
+ const { message } = error;
491
+ if (typeof message === "string" && message.startsWith("No path for ")) {
492
+ throw new Error(
493
+ `Routable extension component with mount point ${mountPoint} was not discovered in the app element tree. Routable extension components may not be rendered by other components and must be directly available as an element within the App provider component.`
494
+ );
495
+ }
435
496
  }
497
+ throw error;
436
498
  }
437
- throw error;
438
- }
439
- return /* @__PURE__ */ React.createElement(InnerComponent, {
440
- ...props
441
- });
442
- };
443
- const componentName = name || InnerComponent.displayName || InnerComponent.name || "LazyComponent";
444
- RoutableExtensionWrapper.displayName = `RoutableExtension(${componentName})`;
445
- return RoutableExtensionWrapper;
446
- }, (error) => {
447
- const RoutableExtensionWrapper = (_) => {
448
- const app = useApp();
449
- const { BootErrorPage } = app.getComponents();
450
- return /* @__PURE__ */ React.createElement(BootErrorPage, {
451
- step: "load-chunk",
452
- error
453
- });
454
- };
455
- return RoutableExtensionWrapper;
456
- })
499
+ return /* @__PURE__ */ React.createElement(InnerComponent, {
500
+ ...props
501
+ });
502
+ };
503
+ const componentName = name || InnerComponent.displayName || InnerComponent.name || "LazyComponent";
504
+ RoutableExtensionWrapper.displayName = `RoutableExtension(${componentName})`;
505
+ return RoutableExtensionWrapper;
506
+ },
507
+ (error) => {
508
+ const RoutableExtensionWrapper = (_) => {
509
+ const app = useApp();
510
+ const { BootErrorPage } = app.getComponents();
511
+ return /* @__PURE__ */ React.createElement(BootErrorPage, {
512
+ step: "load-chunk",
513
+ error
514
+ });
515
+ };
516
+ return RoutableExtensionWrapper;
517
+ }
518
+ )
457
519
  },
458
520
  data: {
459
521
  "core.mountPoint": mountPoint
@@ -468,12 +530,16 @@ function createComponentExtension(options) {
468
530
  function createReactExtension(options) {
469
531
  const { data = {}, name } = options;
470
532
  if (!name) {
471
- console.warn("Declaring extensions without name is DEPRECATED. Make sure that all usages of createReactExtension, createComponentExtension and createRoutableExtension provide a name.");
533
+ console.warn(
534
+ "Declaring extensions without name is DEPRECATED. Make sure that all usages of createReactExtension, createComponentExtension and createRoutableExtension provide a name."
535
+ );
472
536
  }
473
537
  let Component;
474
538
  if ("lazy" in options.component) {
475
539
  const lazyLoader = options.component.lazy;
476
- Component = lazy(() => lazyLoader().then((component) => ({ default: component })));
540
+ Component = lazy(
541
+ () => lazyLoader().then((component) => ({ default: component }))
542
+ );
477
543
  } else {
478
544
  Component = options.component.sync;
479
545
  }
@@ -495,9 +561,11 @@ function createReactExtension(options) {
495
561
  ...name && { extension: name },
496
562
  ...mountPoint && { routeRef: mountPoint.id }
497
563
  }
564
+ }, /* @__PURE__ */ React.createElement(PluginProvider, {
565
+ plugin
498
566
  }, /* @__PURE__ */ React.createElement(Component, {
499
567
  ...props
500
- }))));
568
+ })))));
501
569
  };
502
570
  attachComponentData(Result, "core.plugin", plugin);
503
571
  for (const [key, value] of Object.entries(data)) {
@@ -515,13 +583,23 @@ function selectChildren(rootNode, featureFlagsApi, selector, strictError) {
515
583
  return [];
516
584
  }
517
585
  if (node.type === Fragment) {
518
- return selectChildren(node.props.children, featureFlagsApi, selector, strictError);
586
+ return selectChildren(
587
+ node.props.children,
588
+ featureFlagsApi,
589
+ selector,
590
+ strictError
591
+ );
519
592
  }
520
593
  if (getComponentData(node, "core.featureFlagged")) {
521
594
  const props = node.props;
522
595
  const isEnabled = "with" in props ? featureFlagsApi.isActive(props.with) : !featureFlagsApi.isActive(props.without);
523
596
  if (isEnabled) {
524
- return selectChildren(node.props.children, featureFlagsApi, selector, strictError);
597
+ return selectChildren(
598
+ node.props.children,
599
+ featureFlagsApi,
600
+ selector,
601
+ strictError
602
+ );
525
603
  }
526
604
  return [];
527
605
  }
@@ -531,7 +609,12 @@ function selectChildren(rootNode, featureFlagsApi, selector, strictError) {
531
609
  if (strictError) {
532
610
  throw new Error(strictError);
533
611
  }
534
- return selectChildren(node.props.children, featureFlagsApi, selector, strictError);
612
+ return selectChildren(
613
+ node.props.children,
614
+ featureFlagsApi,
615
+ selector,
616
+ strictError
617
+ );
535
618
  });
536
619
  }
537
620
  class Collection {
@@ -540,11 +623,20 @@ class Collection {
540
623
  this.featureFlagsApi = featureFlagsApi;
541
624
  }
542
625
  selectByComponentData(query) {
543
- const selection = selectChildren(this.node, this.featureFlagsApi, (node) => getComponentData(node, query.key) !== void 0, query.withStrictError);
626
+ const selection = selectChildren(
627
+ this.node,
628
+ this.featureFlagsApi,
629
+ (node) => getComponentData(node, query.key) !== void 0,
630
+ query.withStrictError
631
+ );
544
632
  return new Collection(selection, this.featureFlagsApi);
545
633
  }
546
634
  findComponentData(query) {
547
- const selection = selectChildren(this.node, this.featureFlagsApi, (node) => getComponentData(node, query.key) !== void 0);
635
+ const selection = selectChildren(
636
+ this.node,
637
+ this.featureFlagsApi,
638
+ (node) => getComponentData(node, query.key) !== void 0
639
+ );
548
640
  return selection.map((node) => getComponentData(node, query.key)).filter((data) => data !== void 0);
549
641
  }
550
642
  getElements() {
@@ -560,6 +652,7 @@ function useElementFilter(node, filterFn, dependencies = []) {
560
652
  class PluginImpl {
561
653
  constructor(config) {
562
654
  this.config = config;
655
+ this.options = void 0;
563
656
  }
564
657
  getId() {
565
658
  return this.config.id;
@@ -583,6 +676,18 @@ class PluginImpl {
583
676
  provide(extension) {
584
677
  return extension.expose(this);
585
678
  }
679
+ __experimentalReconfigure(options) {
680
+ if (this.config.__experimentalConfigure) {
681
+ this.options = this.config.__experimentalConfigure(options);
682
+ }
683
+ }
684
+ getPluginOptions() {
685
+ var _a;
686
+ if (this.config.__experimentalConfigure && !this.options) {
687
+ this.options = this.config.__experimentalConfigure();
688
+ }
689
+ return (_a = this.options) != null ? _a : {};
690
+ }
586
691
  toString() {
587
692
  return `plugin{${this.config.id}}`;
588
693
  }
@@ -591,5 +696,5 @@ function createPlugin(config) {
591
696
  return new PluginImpl(config);
592
697
  }
593
698
 
594
- export { AnalyticsContext, FeatureFlagState, SessionState, alertApiRef, analyticsApiRef, appThemeApiRef, atlassianAuthApiRef, attachComponentData, bitbucketAuthApiRef, configApiRef, createApiFactory, createApiRef, createComponentExtension, createExternalRouteRef, createPlugin, createReactExtension, createRoutableExtension, createRouteRef, createSubRouteRef, discoveryApiRef, errorApiRef, featureFlagsApiRef, fetchApiRef, getComponentData, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, identityApiRef, microsoftAuthApiRef, oauthRequestApiRef, oktaAuthApiRef, oneloginAuthApiRef, storageApiRef, useAnalytics, useApi, useApiHolder, useApp, useElementFilter, useRouteRef, useRouteRefParams, withApis };
699
+ export { AnalyticsContext, FeatureFlagState, PluginProvider, SessionState, alertApiRef, analyticsApiRef, appThemeApiRef, atlassianAuthApiRef, attachComponentData, bitbucketAuthApiRef, configApiRef, createApiFactory, createApiRef, createComponentExtension, createExternalRouteRef, createPlugin, createReactExtension, createRoutableExtension, createRouteRef, createSubRouteRef, discoveryApiRef, errorApiRef, featureFlagsApiRef, fetchApiRef, getComponentData, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, identityApiRef, microsoftAuthApiRef, oauthRequestApiRef, oktaAuthApiRef, oneloginAuthApiRef, storageApiRef, useAnalytics, useApi, useApiHolder, useApp, useElementFilter, usePluginOptions, useRouteRef, useRouteRefParams, withApis };
595
700
  //# sourceMappingURL=index.esm.js.map