@xh/hoist 73.0.0-SNAPSHOT.1747153991877 → 73.0.0-SNAPSHOT.1747155067044

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
@@ -35,6 +35,8 @@
35
35
  allow the client to do a potentially interactive popup login during the session to re-establish
36
36
  the login. This is especially useful to allow recovery from expired or invalidated refresh
37
37
  tokens.
38
+ * New utility method `XH.openWindow()` for ensuring that new windows/tabs are opened without
39
+ an unintended `opener` relationship with the original window.
38
40
  * Improvements to Grid columns `HeaderFilter` component:
39
41
  * `GridFilterModel` `commitOnChage` now set to `false` by default
40
42
  * Addition of ability to append terms to active filter **only** when `commitOnChage:false`
package/admin/AppModel.ts CHANGED
@@ -155,7 +155,8 @@ export class AppModel extends HoistAppModel {
155
155
 
156
156
  /** Open the primary business-facing application, typically 'app'. */
157
157
  openPrimaryApp() {
158
- window.open(`/${this.getPrimaryAppCode()}`);
158
+ const appCode = this.getPrimaryAppCode();
159
+ XH.openWindow(`/${appCode}`, appCode);
159
160
  }
160
161
 
161
162
  getPrimaryAppCode() {
@@ -218,6 +218,14 @@ export declare class XHApi {
218
218
  * {@link reloadApp} instead.
219
219
  */
220
220
  refreshAppAsync(): Promise<void>;
221
+ /**
222
+ * Open a url in an external browser window/tab.
223
+ *
224
+ * Unlike a simple call to `open`, this method ensures the "opener" method on the
225
+ * new window is null. This ensures that the new page will not share sessionState with
226
+ * this page. See https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
227
+ */
228
+ openWindow(url: string, target?: string): void;
221
229
  /**
222
230
  * Flags for controlling experimental, hotfix, or otherwise provisional features.
223
231
  *
package/core/XH.ts CHANGED
@@ -442,6 +442,17 @@ export class XHApi {
442
442
  return this.refreshContextModel.refreshAsync();
443
443
  }
444
444
 
445
+ /**
446
+ * Open a url in an external browser window/tab.
447
+ *
448
+ * Unlike a simple call to `open`, this method ensures the "opener" method on the
449
+ * new window is null. This ensures that the new page will not share sessionState with
450
+ * this page. See https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
451
+ */
452
+ openWindow(url: string, target?: string) {
453
+ window.open(url, target ?? '_blank', 'noopener=true');
454
+ }
455
+
445
456
  /**
446
457
  * Flags for controlling experimental, hotfix, or otherwise provisional features.
447
458
  *
@@ -55,7 +55,7 @@ export const versionBar = hoistCmp.factory({
55
55
  Icon.wrench({
56
56
  omit: isAdminApp || !XH.getUser().isHoistAdminReader,
57
57
  title: 'Open Admin Console',
58
- onClick: () => window.open('/admin')
58
+ onClick: () => XH.openWindow('/admin', 'xhAdmin')
59
59
  })
60
60
  ]
61
61
  });
@@ -143,7 +143,7 @@ function buildMenuItems(props: AppMenuButtonProps) {
143
143
  omit: hideAdminItem,
144
144
  text: 'Admin',
145
145
  icon: Icon.wrench(),
146
- actionFn: () => window.open('/admin')
146
+ actionFn: () => XH.openWindow('/admin', 'xhAdmin')
147
147
  },
148
148
  {
149
149
  omit: hideImpersonateItem,
@@ -25,7 +25,7 @@ export const [LaunchAdminButton, launchAdminButton] = hoistCmp.withFactory<Launc
25
25
  ref,
26
26
  icon: Icon.wrench(),
27
27
  title: 'Launch admin client...',
28
- onClick: () => window.open('/admin'),
28
+ onClick: () => XH.openWindow('/admin', 'xhAdmin'),
29
29
  ...props
30
30
  });
31
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "73.0.0-SNAPSHOT.1747153991877",
3
+ "version": "73.0.0-SNAPSHOT.1747155067044",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",