@backstage/core-app-api 1.2.0 → 1.2.1-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @backstage/core-app-api
2
2
 
3
+ ## 1.2.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d3fea4ae0a: Internal fixes to avoid implicit usage of globals
8
+ - c3fa90e184: Updated dependency `zen-observable` to `^0.10.0`.
9
+ - Updated dependencies
10
+ - @backstage/version-bridge@1.0.3-next.0
11
+ - @backstage/core-plugin-api@1.1.1-next.1
12
+ - @backstage/types@1.0.2-next.1
13
+ - @backstage/config@1.0.5-next.1
14
+
15
+ ## 1.2.1-next.0
16
+
17
+ ### Patch Changes
18
+
19
+ - 3280711113: Updated dependency `msw` to `^0.49.0`.
20
+ - 19356df560: Updated dependency `zen-observable` to `^0.9.0`.
21
+ - Updated dependencies
22
+ - @backstage/core-plugin-api@1.1.1-next.0
23
+ - @backstage/types@1.0.2-next.0
24
+ - @backstage/config@1.0.5-next.0
25
+ - @backstage/version-bridge@1.0.2
26
+
3
27
  ## 1.2.0
4
28
 
5
29
  ### Minor Changes
package/dist/index.esm.js CHANGED
@@ -31,10 +31,13 @@ const ApiProvider = (props) => {
31
31
  const { apis, children } = props;
32
32
  const parentHolder = (_a = useContext(ApiContext)) == null ? void 0 : _a.atVersion(1);
33
33
  const holder = parentHolder ? new ApiAggregator(apis, parentHolder) : apis;
34
- return /* @__PURE__ */ React.createElement(ApiContext.Provider, {
35
- value: createVersionedValueMap({ 1: holder }),
36
- children
37
- });
34
+ return /* @__PURE__ */ React.createElement(
35
+ ApiContext.Provider,
36
+ {
37
+ value: createVersionedValueMap({ 1: holder }),
38
+ children
39
+ }
40
+ );
38
41
  };
39
42
  ApiProvider.propTypes = {
40
43
  apis: PropTypes.shape({ get: PropTypes.func.isRequired }).isRequired,
@@ -279,7 +282,7 @@ class DefaultAuthConnector {
279
282
  const scope = this.joinScopesFunc(scopes);
280
283
  const popupUrl = await this.buildUrl("/start", {
281
284
  scope,
282
- origin: location.origin
285
+ origin: window.location.origin
283
286
  });
284
287
  const payload = await showLoginPopup({
285
288
  url: popupUrl,
@@ -2167,9 +2170,7 @@ const RoutingProvider = ({
2167
2170
  basePath
2168
2171
  );
2169
2172
  const versionedValue = createVersionedValueMap({ 1: resolver });
2170
- return /* @__PURE__ */ React.createElement(RoutingContext.Provider, {
2171
- value: versionedValue
2172
- }, children);
2173
+ return /* @__PURE__ */ React.createElement(RoutingContext.Provider, { value: versionedValue }, children);
2173
2174
  };
2174
2175
 
2175
2176
  const getExtensionContext = (pathname, routes) => {
@@ -2211,13 +2212,7 @@ const RouteTracker = ({
2211
2212
  routeObjects
2212
2213
  }) => {
2213
2214
  const { pathname, search, hash } = useLocation();
2214
- return /* @__PURE__ */ React.createElement(AnalyticsContext, {
2215
- attributes: getExtensionContext(pathname, routeObjects)
2216
- }, /* @__PURE__ */ React.createElement(TrackNavigation, {
2217
- pathname,
2218
- search,
2219
- hash
2220
- }));
2215
+ return /* @__PURE__ */ React.createElement(AnalyticsContext, { attributes: getExtensionContext(pathname, routeObjects) }, /* @__PURE__ */ React.createElement(TrackNavigation, { pathname, search, hash }));
2221
2216
  };
2222
2217
 
2223
2218
  function validateRouteParameters(routePaths, routeParents) {
@@ -2277,10 +2272,7 @@ const AppContextProvider = ({
2277
2272
  children
2278
2273
  }) => {
2279
2274
  const versionedValue = createVersionedValueMap({ 1: appContext });
2280
- return /* @__PURE__ */ React.createElement(AppContext.Provider, {
2281
- value: versionedValue,
2282
- children
2283
- });
2275
+ return /* @__PURE__ */ React.createElement(AppContext.Provider, { value: versionedValue, children });
2284
2276
  };
2285
2277
 
2286
2278
  function mkError(thing) {
@@ -2355,7 +2347,7 @@ class AppIdentityProxy {
2355
2347
  }
2356
2348
  async signOut() {
2357
2349
  await this.waitForTarget.then((target) => target.signOut());
2358
- location.href = this.signOutTargetUrl;
2350
+ window.location.href = this.signOutTargetUrl;
2359
2351
  }
2360
2352
  }
2361
2353
 
@@ -2410,9 +2402,7 @@ function AppThemeProvider({ children }) {
2410
2402
  if (!appTheme) {
2411
2403
  throw new Error("App has no themes");
2412
2404
  }
2413
- return /* @__PURE__ */ React.createElement(appTheme.Provider, {
2414
- children
2415
- });
2405
+ return /* @__PURE__ */ React.createElement(appTheme.Provider, { children });
2416
2406
  }
2417
2407
 
2418
2408
  const defaultConfigLoader = async (runtimeConfigJson = "__APP_INJECTED_RUNTIME_CONFIG__") => {
@@ -2504,10 +2494,7 @@ function resolveRouteBindings(bindRoutes) {
2504
2494
  }
2505
2495
 
2506
2496
  function isReactRouterBeta() {
2507
- const [obj] = createRoutesFromChildren(/* @__PURE__ */ React.createElement(Route, {
2508
- index: true,
2509
- element: /* @__PURE__ */ React.createElement("div", null)
2510
- }));
2497
+ const [obj] = createRoutesFromChildren(/* @__PURE__ */ React.createElement(Route, { index: true, element: /* @__PURE__ */ React.createElement("div", null) }));
2511
2498
  return !obj.index;
2512
2499
  }
2513
2500
 
@@ -2537,17 +2524,12 @@ function useConfigLoader(configLoader, components, appThemeApi) {
2537
2524
  noConfigNode = /* @__PURE__ */ React.createElement(Progress, null);
2538
2525
  } else if (config.error) {
2539
2526
  const { BootErrorPage } = components;
2540
- noConfigNode = /* @__PURE__ */ React.createElement(BootErrorPage, {
2541
- step: "load-config",
2542
- error: config.error
2543
- });
2527
+ noConfigNode = /* @__PURE__ */ React.createElement(BootErrorPage, { step: "load-config", error: config.error });
2544
2528
  }
2545
2529
  const { ThemeProvider = AppThemeProvider } = components;
2546
2530
  if (noConfigNode) {
2547
2531
  return {
2548
- node: /* @__PURE__ */ React.createElement(ApiProvider, {
2549
- apis: ApiRegistry.with(appThemeApiRef, appThemeApi)
2550
- }, /* @__PURE__ */ React.createElement(ThemeProvider, null, noConfigNode))
2532
+ node: /* @__PURE__ */ React.createElement(ApiProvider, { apis: ApiRegistry.with(appThemeApiRef, appThemeApi) }, /* @__PURE__ */ React.createElement(ThemeProvider, null, noConfigNode))
2551
2533
  };
2552
2534
  }
2553
2535
  const configReader = ConfigReader.fromConfigs((_a = config.value) != null ? _a : []);
@@ -2671,19 +2653,23 @@ class AppManager {
2671
2653
  return loadedConfig.node;
2672
2654
  }
2673
2655
  const { ThemeProvider = AppThemeProvider } = this.components;
2674
- return /* @__PURE__ */ React.createElement(ApiProvider, {
2675
- apis: this.getApiHolder()
2676
- }, /* @__PURE__ */ React.createElement(AppContextProvider, {
2677
- appContext
2678
- }, /* @__PURE__ */ React.createElement(ThemeProvider, null, /* @__PURE__ */ React.createElement(RoutingProvider, {
2679
- routePaths: routing.paths,
2680
- routeParents: routing.parents,
2681
- routeObjects: routing.objects,
2682
- routeBindings,
2683
- basePath: getBasePath(loadedConfig.api)
2684
- }, /* @__PURE__ */ React.createElement(InternalAppContext.Provider, {
2685
- value: { routeObjects: routing.objects }
2686
- }, children)))));
2656
+ return /* @__PURE__ */ React.createElement(ApiProvider, { apis: this.getApiHolder() }, /* @__PURE__ */ React.createElement(AppContextProvider, { appContext }, /* @__PURE__ */ React.createElement(ThemeProvider, null, /* @__PURE__ */ React.createElement(
2657
+ RoutingProvider,
2658
+ {
2659
+ routePaths: routing.paths,
2660
+ routeParents: routing.parents,
2661
+ routeObjects: routing.objects,
2662
+ routeBindings,
2663
+ basePath: getBasePath(loadedConfig.api)
2664
+ },
2665
+ /* @__PURE__ */ React.createElement(
2666
+ InternalAppContext.Provider,
2667
+ {
2668
+ value: { routeObjects: routing.objects }
2669
+ },
2670
+ children
2671
+ )
2672
+ ))));
2687
2673
  };
2688
2674
  return Provider;
2689
2675
  }
@@ -2697,9 +2683,7 @@ class AppManager {
2697
2683
  const configApi = useApi(configApiRef);
2698
2684
  const basePath = getBasePath(configApi);
2699
2685
  if (!identityApi) {
2700
- return /* @__PURE__ */ React.createElement(Component, {
2701
- onSignInSuccess: setIdentityApi
2702
- });
2686
+ return /* @__PURE__ */ React.createElement(Component, { onSignInSuccess: setIdentityApi });
2703
2687
  }
2704
2688
  this.appIdentityProxy.setTarget(identityApi, {
2705
2689
  signOutTargetUrl: basePath || "/"
@@ -2736,36 +2720,14 @@ class AppManager {
2736
2720
  { signOutTargetUrl: basePath || "/" }
2737
2721
  );
2738
2722
  if (isReactRouterBeta()) {
2739
- return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, {
2740
- routeObjects
2741
- }), /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
2742
- path: mountPath,
2743
- element: /* @__PURE__ */ React.createElement(React.Fragment, null, children)
2744
- })));
2723
+ return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: mountPath, element: /* @__PURE__ */ React.createElement(React.Fragment, null, children) })));
2745
2724
  }
2746
- return /* @__PURE__ */ React.createElement(RouterComponent, {
2747
- basename: basePath
2748
- }, /* @__PURE__ */ React.createElement(RouteTracker, {
2749
- routeObjects
2750
- }), children);
2725
+ return /* @__PURE__ */ React.createElement(RouterComponent, { basename: basePath }, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), children);
2751
2726
  }
2752
2727
  if (isReactRouterBeta()) {
2753
- return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, {
2754
- routeObjects
2755
- }), /* @__PURE__ */ React.createElement(SignInPageWrapper, {
2756
- component: SignInPageComponent
2757
- }, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
2758
- path: mountPath,
2759
- element: /* @__PURE__ */ React.createElement(React.Fragment, null, children)
2760
- }))));
2761
- }
2762
- return /* @__PURE__ */ React.createElement(RouterComponent, {
2763
- basename: basePath
2764
- }, /* @__PURE__ */ React.createElement(RouteTracker, {
2765
- routeObjects
2766
- }), /* @__PURE__ */ React.createElement(SignInPageWrapper, {
2767
- component: SignInPageComponent
2768
- }, /* @__PURE__ */ React.createElement(React.Fragment, null, children)));
2728
+ return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), /* @__PURE__ */ React.createElement(SignInPageWrapper, { component: SignInPageComponent }, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: mountPath, element: /* @__PURE__ */ React.createElement(React.Fragment, null, children) }))));
2729
+ }
2730
+ return /* @__PURE__ */ React.createElement(RouterComponent, { basename: basePath }, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), /* @__PURE__ */ React.createElement(SignInPageWrapper, { component: SignInPageComponent }, /* @__PURE__ */ React.createElement(React.Fragment, null, children)));
2769
2731
  };
2770
2732
  return AppRouter;
2771
2733
  }