@backstage/core-app-api 1.0.3 → 1.0.4

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,31 @@
1
1
  # @backstage/core-app-api
2
2
 
3
+ ## 1.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 881fc75a75: Internal tweak removing usage of explicit type parameters for the `BackstagePlugin` type.
8
+ - 8fe2357101: The `signOut` method of the `IdentityApi` will now navigate the user back to the base URL of the app as indicated by the `app.baseUrl` config.
9
+ - a70869e775: Updated dependency `msw` to `^0.43.0`.
10
+ - 8006d0f9bf: Updated dependency `msw` to `^0.44.0`.
11
+ - Updated dependencies
12
+ - @backstage/core-plugin-api@1.0.4
13
+
14
+ ## 1.0.4-next.1
15
+
16
+ ### Patch Changes
17
+
18
+ - 881fc75a75: Internal tweak removing usage of explicit type parameters for the `BackstagePlugin` type.
19
+ - a70869e775: Updated dependency `msw` to `^0.43.0`.
20
+ - Updated dependencies
21
+ - @backstage/core-plugin-api@1.0.4-next.0
22
+
23
+ ## 1.0.4-next.0
24
+
25
+ ### Patch Changes
26
+
27
+ - 8fe2357101: The `signOut` method of the `IdentityApi` will now navigate the user back to the base URL of the app as indicated by the `app.baseUrl` config.
28
+
3
29
  ## 1.0.3
4
30
 
5
31
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -663,7 +663,7 @@ declare type AppOptions = {
663
663
  /**
664
664
  * A list of all plugins to include in the app.
665
665
  */
666
- plugins?: Array<BackstagePlugin<any, any> & {
666
+ plugins?: Array<BackstagePlugin & {
667
667
  output?(): Array<{
668
668
  type: 'feature-flag';
669
669
  name: string;
@@ -747,7 +747,7 @@ declare type BackstageApp = {
747
747
  /**
748
748
  * Returns all plugins registered for the app.
749
749
  */
750
- getPlugins(): BackstagePlugin<any, any>[];
750
+ getPlugins(): BackstagePlugin[];
751
751
  /**
752
752
  * Get a common or custom icon for this app.
753
753
  */
@@ -773,7 +773,7 @@ declare type AppContext = {
773
773
  /**
774
774
  * Get a list of all plugins that are installed in the app.
775
775
  */
776
- getPlugins(): BackstagePlugin<any, any>[];
776
+ getPlugins(): BackstagePlugin[];
777
777
  /**
778
778
  * Get a common or custom icon for this app.
779
779
  */
package/dist/index.esm.js CHANGED
@@ -2031,12 +2031,14 @@ class AppIdentityProxy {
2031
2031
  constructor() {
2032
2032
  this.resolveTarget = () => {
2033
2033
  };
2034
+ this.signOutTargetUrl = "/";
2034
2035
  this.waitForTarget = new Promise((resolve) => {
2035
2036
  this.resolveTarget = resolve;
2036
2037
  });
2037
2038
  }
2038
- setTarget(identityApi) {
2039
+ setTarget(identityApi, targetOptions) {
2039
2040
  this.target = identityApi;
2041
+ this.signOutTargetUrl = targetOptions.signOutTargetUrl;
2040
2042
  this.resolveTarget(identityApi);
2041
2043
  }
2042
2044
  getUserId() {
@@ -2083,7 +2085,7 @@ class AppIdentityProxy {
2083
2085
  }
2084
2086
  async signOut() {
2085
2087
  await this.waitForTarget.then((target) => target.signOut());
2086
- location.reload();
2088
+ location.href = this.signOutTargetUrl;
2087
2089
  }
2088
2090
  }
2089
2091
 
@@ -2377,17 +2379,22 @@ class AppManager {
2377
2379
  children
2378
2380
  }) => {
2379
2381
  const [identityApi, setIdentityApi] = useState();
2382
+ const configApi = useApi(configApiRef);
2383
+ const basePath = getBasePath(configApi);
2380
2384
  if (!identityApi) {
2381
2385
  return /* @__PURE__ */ React.createElement(Component, {
2382
2386
  onSignInSuccess: setIdentityApi
2383
2387
  });
2384
2388
  }
2385
- this.appIdentityProxy.setTarget(identityApi);
2389
+ this.appIdentityProxy.setTarget(identityApi, {
2390
+ signOutTargetUrl: basePath || "/"
2391
+ });
2386
2392
  return children;
2387
2393
  };
2388
2394
  const AppRouter = ({ children }) => {
2389
2395
  const configApi = useApi(configApiRef);
2390
- const mountPath = `${getBasePath(configApi)}/*`;
2396
+ const basePath = getBasePath(configApi);
2397
+ const mountPath = `${basePath}/*`;
2391
2398
  const { routeObjects } = useContext(InternalAppContext);
2392
2399
  if (!SignInPageComponent) {
2393
2400
  this.appIdentityProxy.setTarget({
@@ -2409,7 +2416,7 @@ class AppManager {
2409
2416
  getCredentials: async () => ({}),
2410
2417
  signOut: async () => {
2411
2418
  }
2412
- });
2419
+ }, { signOutTargetUrl: basePath || "/" });
2413
2420
  return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, {
2414
2421
  routeObjects
2415
2422
  }), /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {