@sap-ux/preview-middleware 0.25.14 → 0.25.16

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.
@@ -132,7 +132,7 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
132
132
  * @param container the UShell container
133
133
  */
134
134
  async function resetAppState(container) {
135
- const urlParams = new URLSearchParams(window.location.hash);
135
+ const urlParams = new URLSearchParams(globalThis.location.hash);
136
136
  const appStateValue = urlParams.get('sap-iapp-state') ?? urlParams.get('/?sap-iapp-state');
137
137
  if (appStateValue) {
138
138
  const appStateService = await container.getServiceAsync('AppState');
@@ -260,7 +260,7 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
260
260
  enhancedHomePage,
261
261
  enableCardGenerator
262
262
  }) {
263
- const urlParams = new URLSearchParams(window.location.search);
263
+ const urlParams = new URLSearchParams(globalThis.location.search);
264
264
  const container = sap?.ushell?.Container ?? (await __ui5_require_async('sap/ushell/Container')).default;
265
265
  let scenario = '';
266
266
  const ui5VersionInfo = await getUi5Version();
@@ -271,6 +271,10 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
271
271
  container.attachRendererCreatedEvent(async function () {
272
272
  const lifecycleService = await container.getServiceAsync('AppLifeCycle');
273
273
  lifecycleService.attachAppLoaded(event => {
274
+ // Prevent starting RTA when the FLP home component (#Shell-home) fires attachAppLoaded before the user navigates to the actual app.
275
+ if (!globalThis.location.hash || globalThis.location.hash.startsWith('#Shell-home')) {
276
+ return;
277
+ }
274
278
  const view = event.getParameter('componentInstance');
275
279
  const pluginScript = flexSettings.pluginScript ?? '';
276
280
  const libs = [];
@@ -352,7 +356,7 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
352
356
  renderer.placeAt('content');
353
357
  }
354
358
 
355
- // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-dom-access,@sap-ux/fiori-tools/sap-browser-api-warning
359
+ // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-dom-access,@sap-ux/fiori-tools/sap-browser-api-warning, @sap-ux/fiori-tools/sap-no-global-variable
356
360
  const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
357
361
  if (bootstrapConfig) {
358
362
  init({
@@ -392,9 +396,7 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
392
396
  type: MessageBarType.warning
393
397
  });
394
398
  }
395
-
396
- // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-location-reload
397
- window.location.reload();
399
+ globalThis.location.reload();
398
400
  }
399
401
  }
400
402
  var __exports = {
@@ -167,7 +167,7 @@ function registerModules(dataFromAppIndex: AppIndexData) {
167
167
  * @param container the UShell container
168
168
  */
169
169
  export async function resetAppState(container: typeof sap.ushell.Container): Promise<void> {
170
- const urlParams = new URLSearchParams(window.location.hash);
170
+ const urlParams = new URLSearchParams(globalThis.location.hash);
171
171
  const appStateValue = urlParams.get('sap-iapp-state') ?? urlParams.get('/?sap-iapp-state');
172
172
  if (appStateValue) {
173
173
  const appStateService = await container.getServiceAsync<AppState>('AppState');
@@ -301,7 +301,7 @@ export async function init({
301
301
  enhancedHomePage?: boolean | null;
302
302
  enableCardGenerator?: boolean;
303
303
  }): Promise<void> {
304
- const urlParams = new URLSearchParams(window.location.search);
304
+ const urlParams = new URLSearchParams(globalThis.location.search);
305
305
  const container =
306
306
  sap?.ushell?.Container ??
307
307
  ((await import('sap/ushell/Container')).default as unknown as typeof sap.ushell.Container);
@@ -314,6 +314,10 @@ export async function init({
314
314
  container.attachRendererCreatedEvent(async function () {
315
315
  const lifecycleService = await container.getServiceAsync<AppLifeCycle>('AppLifeCycle');
316
316
  lifecycleService.attachAppLoaded((event) => {
317
+ // Prevent starting RTA when the FLP home component (#Shell-home) fires attachAppLoaded before the user navigates to the actual app.
318
+ if (!globalThis.location.hash || globalThis.location.hash.startsWith('#Shell-home')) {
319
+ return;
320
+ }
317
321
  const view = event.getParameter('componentInstance');
318
322
  const pluginScript = flexSettings.pluginScript ?? '';
319
323
 
@@ -401,7 +405,7 @@ export async function init({
401
405
  renderer.placeAt('content');
402
406
  }
403
407
 
404
- // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-dom-access,@sap-ux/fiori-tools/sap-browser-api-warning
408
+ // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-dom-access,@sap-ux/fiori-tools/sap-browser-api-warning, @sap-ux/fiori-tools/sap-no-global-variable
405
409
  const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
406
410
  if (bootstrapConfig) {
407
411
  init({
@@ -435,7 +439,6 @@ export async function handleHigherLayerChanges(error: unknown, ui5VersionInfo: U
435
439
  });
436
440
  }
437
441
 
438
- // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-location-reload
439
- window.location.reload();
442
+ globalThis.location.reload();
440
443
  }
441
444
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
11
11
  },
12
- "version": "0.25.14",
12
+ "version": "0.25.16",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "mem-fs-editor": "9.4.0",
28
28
  "qrcode": "1.5.4",
29
29
  "@sap/bas-sdk": "3.13.3",
30
- "@sap-ux/adp-tooling": "0.18.109",
30
+ "@sap-ux/adp-tooling": "0.18.110",
31
31
  "@sap-ux/btp-utils": "1.1.12",
32
32
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.7.23",
33
33
  "@sap-ux/feature-toggle": "0.3.8",
@@ -53,10 +53,10 @@
53
53
  "nock": "14.0.11",
54
54
  "npm-run-all2": "8.0.4",
55
55
  "supertest": "7.2.2",
56
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.25.14",
56
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.25.16",
57
57
  "@sap-ux/axios-extension": "1.25.28",
58
- "@sap-ux/store": "1.5.12",
59
- "@sap-ux/ui5-info": "0.13.17"
58
+ "@sap-ux/ui5-info": "0.13.17",
59
+ "@sap-ux/store": "1.5.12"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "express": "4"