@sap-ux/preview-middleware 0.16.82 → 0.16.83

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.
@@ -13,6 +13,19 @@ sap.ui.define([
13
13
  function _interopRequireDefault(obj) {
14
14
  return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
15
15
  }
16
+ function __ui5_require_async(path) {
17
+ return new Promise(function (resolve, reject) {
18
+ sap.ui.require([path], function (module) {
19
+ if (!(module && module.__esModule)) {
20
+ module = module === null || !(typeof module === 'object' && path.endsWith('/library')) ? { default: module } : module;
21
+ Object.defineProperty(module, '__esModule', { value: true });
22
+ }
23
+ resolve(module);
24
+ }, function (err) {
25
+ reject(err);
26
+ });
27
+ });
28
+ }
16
29
  const SCENARIO = ___sap_ux_private_control_property_editor_common['SCENARIO'];
17
30
  const getManifestAppdescr = ___adp_api_handler['getManifestAppdescr'];
18
31
  const getError = ___utils_error['getError'];
@@ -159,7 +172,7 @@ sap.ui.define([
159
172
  async function init(_ref) {
160
173
  let {appUrls, flex, customInit} = _ref;
161
174
  const urlParams = new URLSearchParams(window.location.search);
162
- const container = sap?.ushell?.Container ?? sap.ui.require('sap/ushell/Container');
175
+ const container = sap?.ushell?.Container ?? (await __ui5_require_async('sap/ushell/Container')).default;
163
176
  let scenario = '';
164
177
  const ui5VersionInfo = await getUi5Version();
165
178
  if (flex) {
@@ -169,7 +182,6 @@ sap.ui.define([
169
182
  const lifecycleService = await container.getServiceAsync('AppLifeCycle');
170
183
  lifecycleService.attachAppLoaded(event => {
171
184
  const view = event.getParameter('componentInstance');
172
- const flexSettings = JSON.parse(flex);
173
185
  const pluginScript = flexSettings.pluginScript ?? '';
174
186
  let libs = [];
175
187
  if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
@@ -199,7 +211,7 @@ sap.ui.define([
199
211
  await resetAppState(container);
200
212
  }
201
213
  if (appUrls) {
202
- await registerComponentDependencyPaths(JSON.parse(appUrls), urlParams);
214
+ await registerComponentDependencyPaths(JSON.parse(appUrls) ?? [], urlParams);
203
215
  }
204
216
  await initConnectors();
205
217
  if (customInit) {
@@ -267,7 +267,8 @@ export async function init({
267
267
  customInit?: string | null;
268
268
  }): Promise<void> {
269
269
  const urlParams = new URLSearchParams(window.location.search);
270
- const container = sap?.ushell?.Container ?? sap.ui.require('sap/ushell/Container');
270
+ const container = sap?.ushell?.Container ??
271
+ (await import('sap/ushell/Container')).default as unknown as typeof sap.ushell.Container;
271
272
  let scenario: string = '';
272
273
  const ui5VersionInfo = await getUi5Version();
273
274
  // Register RTA if configured
@@ -278,7 +279,6 @@ export async function init({
278
279
  const lifecycleService = await container.getServiceAsync<AppLifeCycle>('AppLifeCycle');
279
280
  lifecycleService.attachAppLoaded((event) => {
280
281
  const view = event.getParameter('componentInstance');
281
- const flexSettings = JSON.parse(flex) as FlexSettings;
282
282
  const pluginScript = flexSettings.pluginScript ?? '';
283
283
 
284
284
  let libs: string[] = [];
@@ -302,6 +302,7 @@ export async function init({
302
302
 
303
303
  sap.ui.require(
304
304
  libs,
305
+ // eslint-disable-next-line no-shadow
305
306
  async function (startAdaptation: StartAdaptation | InitRtaScript, pluginScript: RTAPlugin) {
306
307
  await startAdaptation(options, pluginScript);
307
308
  }
@@ -317,7 +318,7 @@ export async function init({
317
318
 
318
319
  // Load custom library paths if configured
319
320
  if (appUrls) {
320
- await registerComponentDependencyPaths(JSON.parse(appUrls), urlParams);
321
+ await registerComponentDependencyPaths(JSON.parse(appUrls) as string[] ?? [], urlParams);
321
322
  }
322
323
 
323
324
  // Load rta connector
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.16.82",
12
+ "version": "0.16.83",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "supertest": "6.3.3",
46
46
  "@sap-ux-private/playwright": "0.1.0",
47
47
  "dotenv": "16.3.1",
48
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.13",
48
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.14",
49
49
  "@sap-ux/axios-extension": "1.16.6",
50
50
  "@sap-ux/store": "0.9.2",
51
51
  "@sap-ux/ui5-info": "0.8.1",