@sap-ux/preview-middleware 0.23.68 → 0.23.71

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.
@@ -209,8 +209,9 @@ async function addApp(templateConfig, manifest, app, logger) {
209
209
  const appName = getAppName(manifest, app.intent);
210
210
  templateConfig.ui5.resources[id] = app.target;
211
211
  templateConfig.apps[appName] = {
212
- title: (await getI18nTextFromProperty(app.local, manifest['sap.app']?.title, logger)) ?? id,
213
- description: (await getI18nTextFromProperty(app.local, manifest['sap.app']?.description, logger)) ?? '',
212
+ title: (await getI18nTextFromProperty(app.local, manifest['sap.app']?.title, manifest['sap.app']?.id, logger)) ??
213
+ id,
214
+ description: (await getI18nTextFromProperty(app.local, manifest['sap.app']?.description, manifest['sap.app']?.id, logger)) ?? '',
214
215
  additionalInformation: `SAPUI5.Component=${app.componentId ?? id}`,
215
216
  applicationType: 'URL',
216
217
  url: app.target
@@ -236,18 +237,21 @@ function getAppName(manifest, intent) {
236
237
  *
237
238
  * @param projectRoot absolute path to the project root
238
239
  * @param propertyValue value of the property
240
+ * @param appId application id
239
241
  * @param logger logger instance
240
242
  * @returns i18n text of the property
241
243
  */
242
- async function getI18nTextFromProperty(projectRoot, propertyValue, logger) {
244
+ async function getI18nTextFromProperty(projectRoot, propertyValue, appId, logger) {
243
245
  const propertyI18nKey = (0, i18n_1.extractDoubleCurlyBracketsKey)(propertyValue ?? '');
244
246
  if (!projectRoot || !propertyI18nKey) {
245
247
  return propertyValue;
246
248
  }
247
- const projectAccess = await (0, project_access_1.createProjectAccess)(projectRoot);
248
- const applicationIds = projectAccess.getApplicationIds();
249
+ const absolutePath = (0, node_path_1.resolve)(process.cwd(), projectRoot);
249
250
  try {
250
- const bundle = (await projectAccess.getApplication(applicationIds[0]).getI18nBundles())['sap.app'];
251
+ const projectAccess = await (0, project_access_1.createProjectAccess)(absolutePath);
252
+ const appPath = await projectAccess.getApplicationIdByManifestAppId(appId ?? '');
253
+ const applicationAccess = projectAccess.getApplication(appPath ?? '');
254
+ const bundle = (await applicationAccess.getI18nBundles())['sap.app'];
251
255
  return bundle[propertyI18nKey]?.[0]?.value?.value ?? propertyI18nKey;
252
256
  }
253
257
  catch (e) {
package/dist/base/flp.js CHANGED
@@ -105,7 +105,8 @@ class FlpSandbox {
105
105
  * @param adp optional reference to the ADP tooling
106
106
  */
107
107
  async init(manifest, componentId, resources = {}, adp) {
108
- this.projectType = await (0, project_access_1.getProjectType)(await (0, project_access_1.findProjectRoot)(process.cwd(), true, true));
108
+ const projectRoot = await (0, project_access_1.findProjectRoot)(process.cwd(), false, true);
109
+ this.projectType = await (0, project_access_1.getProjectType)(projectRoot);
109
110
  this.createFlexHandler();
110
111
  this.flpConfig.libs ??= await this.hasLocateReuseLibsScript();
111
112
  const id = manifest['sap.app']?.id ?? '';
@@ -156,22 +157,22 @@ class FlpSandbox {
156
157
  return new Map([
157
158
  // Run application in design time mode
158
159
  // Adds bindingString to BindingInfo objects. Required to create and read PropertyBinding changes
159
- ['xx-designMode', 'true'],
160
+ ['data-sap-ui-xx-designMode', 'true'],
160
161
  // In design mode, the controller code will not be executed by default, which is not desired in our case, so we suppress the deactivation
161
- ['xx-suppressDeactivationOfControllerCode', 'true'],
162
+ ['data-sap-ui-xx-suppressDeactivationOfControllerCode', 'true'],
162
163
  // Make sure that XML preprocessing results are correctly invalidated
163
- ['xx-viewCache', 'false']
164
+ ['data-sap-ui-xx-viewCache', 'false']
164
165
  ]);
165
166
  }
166
167
  else {
167
168
  return new Map([
168
169
  // Run application in design time mode
169
170
  // Adds bindingString to BindingInfo objects. Required to create and read PropertyBinding changes
170
- ['xx-design-mode', 'true'],
171
+ ['data-sap-ui-xx-design-mode', 'true'],
171
172
  // In design mode, the controller code will not be executed by default, which is not desired in our case, so we suppress the deactivation
172
- ['xx-suppress-deactivation-of-controller-code', 'true'],
173
+ ['data-sap-ui-xx-suppress-deactivation-of-controller-code', 'true'],
173
174
  // Make sure that XML preprocessing results are correctly invalidated
174
- ['xx-view-cache', 'false']
175
+ ['data-sap-ui-xx-view-cache', 'false']
175
176
  ]);
176
177
  }
177
178
  }
@@ -936,28 +937,13 @@ class FlpSandbox {
936
937
  }
937
938
  exports.FlpSandbox = FlpSandbox;
938
939
  /**
939
- * Creates an attribute string that can be added to an HTML element.
940
- *
941
- * @param attributes map with attributes and their values
942
- * @param indent indentation that's inserted before each attribute
943
- * @param prefix value that should be added at the start of to all attribute names
944
- * @returns attribute string
945
- */
946
- function serializeDataAttributes(attributes, indent = '', prefix = 'data') {
947
- return [...attributes.entries()]
948
- .map(([name, value]) => {
949
- return `${indent}${prefix}-${name}="${value}"`;
950
- })
951
- .join('\n');
952
- }
953
- /**
954
- * Creates an attribute string that can be added to bootstrap script in a HTML file.
940
+ * Creates an attribute string that can be added to the UI5 bootstrap script of an HTML file.
955
941
  *
956
942
  * @param config ui5 configuration options
957
943
  * @returns attribute string
958
944
  */
959
945
  function serializeUi5Configuration(config) {
960
- return '\n' + serializeDataAttributes(config, ' ', 'data-sap-ui');
946
+ return '\n' + [...config.entries()].map(([name, value]) => ` ${name}="${value}"`).join('\n');
961
947
  }
962
948
  /**
963
949
  * Configure RTA (Runtime Adaptation) for the FLP sandbox.
@@ -12,6 +12,9 @@ export interface Intent {
12
12
  */
13
13
  export interface App {
14
14
  target: string;
15
+ /**
16
+ * Either a local path to a folder containing the application or the componentId of a remote app
17
+ */
15
18
  local?: string;
16
19
  /**
17
20
  * Optional component id if it differs from the manifest (e.g. for adaptation projects)
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.23.68",
12
+ "version": "0.23.71",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -27,12 +27,12 @@
27
27
  "mem-fs-editor": "9.4.0",
28
28
  "qrcode": "1.5.4",
29
29
  "@sap/bas-sdk": "3.12.0",
30
- "@sap-ux/adp-tooling": "0.18.16",
31
- "@sap-ux/btp-utils": "1.1.5",
30
+ "@sap-ux/adp-tooling": "0.18.19",
32
31
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.7.3",
33
32
  "@sap-ux/feature-toggle": "0.3.4",
33
+ "@sap-ux/project-access": "1.32.14",
34
+ "@sap-ux/btp-utils": "1.1.5",
34
35
  "@sap-ux/logger": "0.7.1",
35
- "@sap-ux/project-access": "1.32.12",
36
36
  "@sap-ux/system-access": "0.6.31",
37
37
  "@sap-ux/i18n": "0.3.5"
38
38
  },