@backstage/core-app-api 1.10.1-next.1 → 1.11.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,40 @@
1
1
  # @backstage/core-app-api
2
2
 
3
+ ## 1.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c9d9bfeca2: URL encode some well known unsafe characters in `RouteResolver` (and therefore `useRouteRef`)
8
+
9
+ ### Patch Changes
10
+
11
+ - 29e4d8b76b: Fixed bug in `AppRouter` to determine the correct `signOutTargetUrl` if `app.baseUrl` contains a `basePath`
12
+ - acca17e91a: Wrap entire app in `<Suspense>`, enabling support for using translations outside plugins.
13
+ - 1a0616fa10: Add missing resource and template app icons
14
+ - 9a1fce352e: Updated dependency `@testing-library/jest-dom` to `^6.0.0`.
15
+ - f95af4e540: Updated dependency `@testing-library/dom` to `^9.0.0`.
16
+ - f1b349cfba: Fixed a bug in `TranslationApi` implementation where in some cases it wouldn't notify subscribers of language changes.
17
+ - Updated dependencies
18
+ - @backstage/core-plugin-api@1.7.0
19
+ - @backstage/version-bridge@1.0.6
20
+ - @backstage/config@1.1.1
21
+ - @backstage/types@1.1.1
22
+
23
+ ## 1.11.0-next.2
24
+
25
+ ### Minor Changes
26
+
27
+ - c9d9bfeca2: URL encode some well known unsafe characters in `RouteResolver` (and therefore `useRouteRef`)
28
+
29
+ ### Patch Changes
30
+
31
+ - acca17e91a: Wrap entire app in `<Suspense>`, enabling support for using translations outside plugins.
32
+ - Updated dependencies
33
+ - @backstage/core-plugin-api@1.7.0-next.1
34
+ - @backstage/config@1.1.1-next.0
35
+ - @backstage/types@1.1.1
36
+ - @backstage/version-bridge@1.0.5
37
+
3
38
  ## 1.10.1-next.1
4
39
 
5
40
  ### Patch Changes
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useContext, createContext, useEffect, useState, Children, isValidElement, useMemo, useRef } from 'react';
1
+ import React, { useContext, createContext, useEffect, useState, Children, isValidElement, useMemo, useRef, Suspense } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { createVersionedContext, createVersionedValueMap, getOrCreateGlobalSingleton } from '@backstage/version-bridge';
4
4
  import ObservableImpl from 'zen-observable';
@@ -9,6 +9,7 @@ export { ConfigReader } from '@backstage/config';
9
9
  import { createRoutesFromChildren, Route, useLocation, matchRoutes, Routes, generatePath, useRoutes } from 'react-router-dom';
10
10
  import useAsync from 'react-use/lib/useAsync';
11
11
  import { appLanguageApiRef, translationApiRef } from '@backstage/core-plugin-api/alpha';
12
+ import mapValues from 'lodash/mapValues';
12
13
  import useObservable from 'react-use/lib/useObservable';
13
14
  import { createInstance } from 'i18next';
14
15
 
@@ -2294,7 +2295,7 @@ function SignInPageWrapper({
2294
2295
  }) {
2295
2296
  const [identityApi, setIdentityApi] = useState();
2296
2297
  const configApi = useApi(configApiRef);
2297
- const basePath = getBasePath(configApi);
2298
+ const basePath = readBasePath(configApi);
2298
2299
  if (!identityApi) {
2299
2300
  return /* @__PURE__ */ React.createElement(Component, { onSignInSuccess: setIdentityApi });
2300
2301
  }
@@ -2834,7 +2835,13 @@ class RouteResolver {
2834
2835
  this.routeObjects
2835
2836
  );
2836
2837
  const routeFunc = (...[params]) => {
2837
- return joinPaths(basePath, generatePath(targetPath, params));
2838
+ const encodedParams = params && mapValues(params, (value) => {
2839
+ if (typeof value === "string") {
2840
+ return value.replaceAll(/[&?#;\/]/g, (c) => encodeURIComponent(c));
2841
+ }
2842
+ return value;
2843
+ });
2844
+ return joinPaths(basePath, generatePath(targetPath, encodedParams));
2838
2845
  };
2839
2846
  return routeFunc;
2840
2847
  }
@@ -3493,7 +3500,6 @@ const _I18nextTranslationApi = class _I18nextTranslationApi {
3493
3500
  __privateMethod(this, _registerDefaults, registerDefaults_fn).call(this, internalRef);
3494
3501
  return new ObservableImpl((subscriber) => {
3495
3502
  let loadTicket = {};
3496
- let lastSnapshotWasReady = false;
3497
3503
  const loadResource = () => {
3498
3504
  loadTicket = {};
3499
3505
  const ticket = loadTicket;
@@ -3501,8 +3507,7 @@ const _I18nextTranslationApi = class _I18nextTranslationApi {
3501
3507
  () => {
3502
3508
  if (ticket === loadTicket) {
3503
3509
  const snapshot = __privateMethod(this, _createSnapshot, createSnapshot_fn).call(this, internalRef);
3504
- if (snapshot.ready || lastSnapshotWasReady) {
3505
- lastSnapshotWasReady = snapshot.ready;
3510
+ if (snapshot.ready) {
3506
3511
  subscriber.next(snapshot);
3507
3512
  }
3508
3513
  }
@@ -3516,11 +3521,9 @@ const _I18nextTranslationApi = class _I18nextTranslationApi {
3516
3521
  };
3517
3522
  const onChange = () => {
3518
3523
  const snapshot = __privateMethod(this, _createSnapshot, createSnapshot_fn).call(this, internalRef);
3519
- if (lastSnapshotWasReady && !snapshot.ready) {
3520
- lastSnapshotWasReady = snapshot.ready;
3524
+ if (snapshot.ready) {
3521
3525
  subscriber.next(snapshot);
3522
- }
3523
- if (!snapshot.ready) {
3526
+ } else {
3524
3527
  loadResource();
3525
3528
  }
3526
3529
  };
@@ -3841,7 +3844,7 @@ class AppManager {
3841
3844
  }
3842
3845
  }
3843
3846
  }
3844
- const { ThemeProvider = AppThemeProvider } = this.components;
3847
+ const { ThemeProvider = AppThemeProvider, Progress } = this.components;
3845
3848
  return /* @__PURE__ */ React.createElement(ApiProvider, { apis: this.getApiHolder() }, /* @__PURE__ */ React.createElement(AppContextProvider, { appContext }, /* @__PURE__ */ React.createElement(ThemeProvider, null, /* @__PURE__ */ React.createElement(
3846
3849
  RoutingProvider,
3847
3850
  {
@@ -3859,7 +3862,7 @@ class AppManager {
3859
3862
  appIdentityProxy: this.appIdentityProxy
3860
3863
  }
3861
3864
  },
3862
- children
3865
+ /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, children)
3863
3866
  )
3864
3867
  ))));
3865
3868
  };