@sap-ux/preview-middleware 0.25.0 → 0.25.2

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/dist/base/flp.js CHANGED
@@ -282,7 +282,8 @@ class FlpSandbox {
282
282
  params['fiori-tools-rta-mode'] = 'true';
283
283
  params['sap-ui-rta-skip-flex-validation'] = 'true';
284
284
  params['sap-ui-xx-condense-changes'] = 'true';
285
- res.redirect(302, `${url}?${new URLSearchParams(params)}`);
285
+ const redirectUrl = new URL(`${url}?${new URLSearchParams(params)}`, 'http://localhost');
286
+ res.redirect(302, `${redirectUrl.pathname}${redirectUrl.search}`);
286
287
  return;
287
288
  }
288
289
  const html = (await this.generateSandboxForEditor(req, rta, editor)).replace('</body>', `</body>\n<!-- livereload disabled for editor </body>-->`);
@@ -329,7 +330,8 @@ class FlpSandbox {
329
330
  const url = 'ui5-patched-router' in req ? node_path_1.posix.join(req['ui5-patched-router']?.baseUrl ?? '', req.path) : req.path;
330
331
  const params = structuredClone(req.query);
331
332
  params['sap-ui-xx-viewCache'] = 'false';
332
- res.redirect(302, `${url}?${new URLSearchParams(params)}`);
333
+ const redirectUrl = new URL(`${url}?${new URLSearchParams(params)}`, 'http://localhost');
334
+ res.redirect(302, `${redirectUrl.pathname}${redirectUrl.search}`);
333
335
  return;
334
336
  }
335
337
  await this.setApplicationDependencies();
@@ -133,7 +133,7 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
133
133
  * @param container the UShell container
134
134
  */
135
135
  async function resetAppState(container) {
136
- const urlParams = new URLSearchParams(window.location.hash);
136
+ const urlParams = new URLSearchParams(globalThis.location.hash);
137
137
  const appStateValue = urlParams.get('sap-iapp-state') ?? urlParams.get('/?sap-iapp-state');
138
138
  if (appStateValue) {
139
139
  const appStateService = await container.getServiceAsync('AppState');
@@ -266,7 +266,7 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
266
266
  if (enhancedHomePage) {
267
267
  initCdm();
268
268
  }
269
- const urlParams = new URLSearchParams(window.location.search);
269
+ const urlParams = new URLSearchParams(globalThis.location.search);
270
270
  const container = sap?.ushell?.Container ?? (await __ui5_require_async('sap/ushell/Container')).default;
271
271
  let scenario = '';
272
272
  const ui5VersionInfo = await getUi5Version();
@@ -277,6 +277,10 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
277
277
  container.attachRendererCreatedEvent(async function () {
278
278
  const lifecycleService = await container.getServiceAsync('AppLifeCycle');
279
279
  lifecycleService.attachAppLoaded(event => {
280
+ // Prevent starting RTA when the FLP home component (#Shell-home) fires attachAppLoaded before the user navigates to the actual app.
281
+ if (!globalThis.location.hash || globalThis.location.hash.startsWith('#Shell-home')) {
282
+ return;
283
+ }
280
284
  const view = event.getParameter('componentInstance');
281
285
  const pluginScript = flexSettings.pluginScript ?? '';
282
286
  const libs = [];
@@ -358,7 +362,7 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
358
362
  renderer.placeAt('content');
359
363
  }
360
364
 
361
- // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-dom-access,@sap-ux/fiori-tools/sap-browser-api-warning
365
+ // 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
362
366
  const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
363
367
  if (bootstrapConfig) {
364
368
  init({
@@ -398,9 +402,7 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
398
402
  type: MessageBarType.warning
399
403
  });
400
404
  }
401
-
402
- // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-location-reload
403
- window.location.reload();
405
+ globalThis.location.reload();
404
406
  }
405
407
  }
406
408
  var __exports = {
@@ -168,7 +168,7 @@ function registerModules(dataFromAppIndex: AppIndexData) {
168
168
  * @param container the UShell container
169
169
  */
170
170
  export async function resetAppState(container: typeof sap.ushell.Container): Promise<void> {
171
- const urlParams = new URLSearchParams(window.location.hash);
171
+ const urlParams = new URLSearchParams(globalThis.location.hash);
172
172
  const appStateValue = urlParams.get('sap-iapp-state') ?? urlParams.get('/?sap-iapp-state');
173
173
  if (appStateValue) {
174
174
  const appStateService = await container.getServiceAsync<AppState>('AppState');
@@ -308,7 +308,7 @@ export async function init({
308
308
  initCdm();
309
309
  }
310
310
 
311
- const urlParams = new URLSearchParams(window.location.search);
311
+ const urlParams = new URLSearchParams(globalThis.location.search);
312
312
  const container =
313
313
  sap?.ushell?.Container ??
314
314
  ((await import('sap/ushell/Container')).default as unknown as typeof sap.ushell.Container);
@@ -321,6 +321,10 @@ export async function init({
321
321
  container.attachRendererCreatedEvent(async function () {
322
322
  const lifecycleService = await container.getServiceAsync<AppLifeCycle>('AppLifeCycle');
323
323
  lifecycleService.attachAppLoaded((event) => {
324
+ // Prevent starting RTA when the FLP home component (#Shell-home) fires attachAppLoaded before the user navigates to the actual app.
325
+ if (!globalThis.location.hash || globalThis.location.hash.startsWith('#Shell-home')) {
326
+ return;
327
+ }
324
328
  const view = event.getParameter('componentInstance');
325
329
  const pluginScript = flexSettings.pluginScript ?? '';
326
330
 
@@ -408,7 +412,7 @@ export async function init({
408
412
  renderer.placeAt('content');
409
413
  }
410
414
 
411
- // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-dom-access,@sap-ux/fiori-tools/sap-browser-api-warning
415
+ // 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
412
416
  const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
413
417
  if (bootstrapConfig) {
414
418
  init({
@@ -442,7 +446,6 @@ export async function handleHigherLayerChanges(error: unknown, ui5VersionInfo: U
442
446
  });
443
447
  }
444
448
 
445
- // eslint-disable-next-line @sap-ux/fiori-tools/sap-no-location-reload
446
- window.location.reload();
449
+ globalThis.location.reload();
447
450
  }
448
451
  }
@@ -284,7 +284,7 @@ sap.ui.define((function () { 'use strict';
284
284
  */
285
285
  function postMessageListener(event) {
286
286
  const target = getTarget();
287
- if (!target || event.origin !== target.origin || event.source !== target) {
287
+ if (event.origin !== target?.origin || event.source !== target) {
288
288
  // Ignore messages from unknown sources
289
289
  return;
290
290
  }
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.0",
12
+ "version": "0.25.2",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -27,25 +27,25 @@
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.99",
31
- "@sap-ux/btp-utils": "1.1.10",
32
- "@sap-ux/feature-toggle": "0.3.7",
30
+ "@sap-ux/adp-tooling": "0.18.101",
31
+ "@sap-ux/btp-utils": "1.1.11",
33
32
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.7.22",
34
- "@sap-ux/logger": "0.8.2",
35
- "@sap-ux/project-access": "1.35.14",
36
- "@sap-ux/system-access": "0.7.1",
37
- "@sap-ux/i18n": "0.3.9"
33
+ "@sap-ux/feature-toggle": "0.3.7",
34
+ "@sap-ux/logger": "0.8.3",
35
+ "@sap-ux/project-access": "1.35.16",
36
+ "@sap-ux/system-access": "0.7.2",
37
+ "@sap-ux/i18n": "0.3.10"
38
38
  },
39
39
  "devDependencies": {
40
- "@sap-ux-private/playwright": "0.2.12",
40
+ "@sap-ux-private/playwright": "0.2.13",
41
41
  "@types/connect": "^3.4.38",
42
- "@types/qrcode": "1.5.5",
43
- "@types/ejs": "3.1.2",
42
+ "@types/qrcode": "1.5.6",
43
+ "@types/ejs": "3.1.5",
44
44
  "@types/express": "4.17.21",
45
45
  "@types/mem-fs": "1.1.2",
46
46
  "@types/mem-fs-editor": "7.0.1",
47
- "@types/prompts": "2.4.4",
48
- "@types/supertest": "2.0.12",
47
+ "@types/prompts": "2.4.9",
48
+ "@types/supertest": "7.2.0",
49
49
  "connect": "^3.7.0",
50
50
  "copyfiles": "2.4.1",
51
51
  "dotenv": "17.3.1",
@@ -54,9 +54,9 @@
54
54
  "npm-run-all2": "8.0.4",
55
55
  "supertest": "7.2.2",
56
56
  "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.19.1",
57
- "@sap-ux/axios-extension": "1.25.25",
58
- "@sap-ux/store": "1.5.10",
59
- "@sap-ux/ui5-info": "0.13.15"
57
+ "@sap-ux/axios-extension": "1.25.26",
58
+ "@sap-ux/store": "1.5.11",
59
+ "@sap-ux/ui5-info": "0.13.16"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "express": "4"