@sap-ux/preview-middleware 0.18.23 → 0.19.1

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/README.md CHANGED
@@ -24,6 +24,7 @@ When this middleware is used together with the `reload-middleware`, then the ord
24
24
  | `flp.apps` | `array` | `undefined` | Optional additional local apps that are available in local Fiori launchpad |
25
25
  | `flp.libs` | `boolean` | `undefined` | Optional flag to add a generic script fetching the paths of used libraries not available in UI5. To disable set it to `false`, if not set, then the project is checked for a `load-reuse-libs` script and if available the libraries are fetched as well. |
26
26
  | `flp.theme` | `string` | `undefined` | Optional flag for setting the UI5 Theme. |
27
+ | `flp.enhancedHomePage` | `boolean` | `undefined` | Optional flag for enabling enhanced FLP Homepage, available only from UI5 1.123.0 onwards. |
27
28
  | `adp.target` | | | Required configuration for adaptation projects defining the connected backend |
28
29
  | `adp.ignoreCertErrors` | `boolean` | `false` | Optional setting to ignore certification validation errors when working with e.g. development systems with self signed certificates |
29
30
  | `rta` | | | 🚫 *Deprecated: use 'editors.rta' instead* <br/> Optional configuration allowing to add mount points for runtime adaptation |
@@ -0,0 +1,10 @@
1
+ import type { TemplateConfig } from './config';
2
+ import { type FLPCdmConfig } from '../types';
3
+ /**
4
+ * Generates a CDM by embedding the provided app tiles into the FLP homepage.
5
+ *
6
+ * @param apps - A list of app to be embedded.
7
+ * @returns The generated CDM configuration
8
+ */
9
+ export declare function generateCdm(apps?: TemplateConfig['apps']): FLPCdmConfig;
10
+ //# sourceMappingURL=cdm.d.ts.map
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateCdm = generateCdm;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const types_1 = require("../types");
7
+ /**
8
+ * Generates a CDM by embedding the provided app tiles into the FLP homepage.
9
+ *
10
+ * @param apps - A list of app to be embedded.
11
+ * @returns The generated CDM configuration
12
+ */
13
+ function generateCdm(apps = {}) {
14
+ const cdm = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../../templates/flp/cdm.base.json'), 'utf-8'));
15
+ // add apps
16
+ Object.keys(apps).forEach((id) => {
17
+ const appId = apps[id].additionalInformation.split('=')[1];
18
+ const vizId = `VIZ:${appId}`;
19
+ const [object, action] = id.split('-');
20
+ const { title, description, url } = apps[id];
21
+ // add app to default catalog
22
+ cdm.catalogs[types_1.FLPHomePageDefaults.catalogId].payload.viz.push(vizId);
23
+ // create flp visualization
24
+ cdm.visualizations[vizId] = {
25
+ 'vizType': 'sap.ushell.StaticAppLauncher',
26
+ 'businessApp': appId,
27
+ 'vizConfig': {
28
+ 'sap.app': {
29
+ title,
30
+ subTitle: description
31
+ },
32
+ 'sap.flp': {
33
+ 'target': {
34
+ 'appId': appId,
35
+ 'inboundId': `${object}-${action}`,
36
+ 'parameters': [
37
+ {
38
+ 'name': 'sap-ui-tech-hint',
39
+ 'value': 'UI5'
40
+ }
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ };
46
+ // create flp application
47
+ cdm.applications[appId] = {
48
+ 'sap.app': {
49
+ id: appId,
50
+ title,
51
+ crossNavigation: {
52
+ inbounds: {
53
+ [`${object}-${action}`]: {
54
+ 'semanticObject': object,
55
+ 'action': action,
56
+ title,
57
+ 'subTitle': description,
58
+ 'signature': {
59
+ 'additionalParameters': 'allowed'
60
+ }
61
+ }
62
+ }
63
+ }
64
+ },
65
+ 'sap.ui5': {
66
+ 'componentName': appId
67
+ },
68
+ 'sap.ui': {
69
+ 'technology': 'UI5'
70
+ },
71
+ 'sap.platform.runtime': {
72
+ 'componentProperties': {
73
+ url,
74
+ 'asyncHints': {}
75
+ }
76
+ }
77
+ };
78
+ // add app to default section
79
+ cdm.pages[types_1.FLPHomePageDefaults.pageName].payload.sections[types_1.FLPHomePageDefaults.sectionId].layout.vizOrder.push(appId);
80
+ cdm.pages[types_1.FLPHomePageDefaults.pageName].payload.sections[types_1.FLPHomePageDefaults.sectionId].viz[appId] = {
81
+ id: appId,
82
+ vizId
83
+ };
84
+ });
85
+ return cdm;
86
+ }
87
+ //# sourceMappingURL=cdm.js.map
@@ -56,6 +56,7 @@ export interface TemplateConfig {
56
56
  isEnabled: boolean;
57
57
  }[];
58
58
  locateReuseLibsScript?: boolean;
59
+ enhancedHomePage?: boolean;
59
60
  }
60
61
  /**
61
62
  * Static settings
@@ -105,7 +105,8 @@ function getFlpConfigWithDefaults(config = {}) {
105
105
  apps: config.apps ?? [],
106
106
  libs: config.libs,
107
107
  theme: config.theme,
108
- init: config.init
108
+ init: config.init,
109
+ enhancedHomePage: config.enhancedHomePage === true
109
110
  };
110
111
  if (!flpConfig.path.startsWith('/')) {
111
112
  flpConfig.path = `/${flpConfig.path}`;
@@ -268,7 +269,8 @@ function createFlpTemplateConfig(config, manifest, resources = {}) {
268
269
  },
269
270
  bootstrapOptions: ''
270
271
  },
271
- locateReuseLibsScript: config.libs
272
+ locateReuseLibsScript: config.libs,
273
+ enhancedHomePage: config.enhancedHomePage
272
274
  };
273
275
  }
274
276
  /**
@@ -165,6 +165,11 @@ export declare class FlpSandbox {
165
165
  * Add additional routes for apps also to be shown in the local FLP.
166
166
  */
167
167
  private addRoutesForAdditionalApps;
168
+ /**
169
+ * Add routes for cdm.json required by FLP during bootstrapping via cdm.
170
+ *
171
+ */
172
+ private addCDMRoute;
168
173
  /**
169
174
  * Handler for flex changes GET requests.
170
175
  *
package/dist/base/flp.js CHANGED
@@ -15,6 +15,7 @@ const feature_toggle_1 = require("@sap-ux/feature-toggle");
15
15
  const flex_1 = require("./flex");
16
16
  const test_1 = require("./test");
17
17
  const config_1 = require("./config");
18
+ const cdm_1 = require("./cdm");
18
19
  const DEFAULT_LIVERELOAD_PORT = 35729;
19
20
  /**
20
21
  * Class handling preview of a sandbox FLP.
@@ -90,6 +91,9 @@ class FlpSandbox {
90
91
  this.addTestRoutes(this.test.filter((config) => config.framework !== 'Testsuite'), id);
91
92
  this.createTestSuite(this.test);
92
93
  }
94
+ if (this.flpConfig.enhancedHomePage) {
95
+ this.addCDMRoute();
96
+ }
93
97
  await this.addRoutesForAdditionalApps();
94
98
  this.logger.info(`Initialized for app ${id}`);
95
99
  this.logger.debug(`Configured apps: ${JSON.stringify(this.templateConfig.apps)}`);
@@ -345,11 +349,15 @@ class FlpSandbox {
345
349
  }
346
350
  }
347
351
  if (!version) {
348
- this.logger.error('Could not get UI5 version of application. Using 1.121.0 as fallback.');
349
- version = '1.121.0';
352
+ this.logger.error('Could not get UI5 version of application. Using 1.130.0 as fallback.');
353
+ version = '1.130.0';
350
354
  }
351
355
  const [major, minor, patch] = version.split('.').map((versionPart) => parseInt(versionPart, 10));
352
356
  const label = version.split(/-(.*)/s)?.[1];
357
+ if ((major < 2 && minor < 123) || major >= 2 || label?.includes('legacy-free')) {
358
+ this.flpConfig.enhancedHomePage = this.templateConfig.enhancedHomePage = false;
359
+ this.logger.warn(`Feature enhancedHomePage disabled: UI5 version ${version} not supported.`);
360
+ }
353
361
  return {
354
362
  major,
355
363
  minor,
@@ -366,7 +374,8 @@ class FlpSandbox {
366
374
  getSandboxTemplate(ui5Version) {
367
375
  this.logger.info(`Using sandbox template for UI5 version ${ui5Version.major}.${ui5Version.minor}.${ui5Version.patch}${ui5Version.label ? `-${ui5Version.label}` : ''}.`);
368
376
  const filePrefix = ui5Version.major > 1 || ui5Version.label?.includes('legacy-free') ? '2' : '';
369
- return (0, fs_1.readFileSync)((0, path_1.join)(__dirname, `../../templates/flp/sandbox${filePrefix}.html`), 'utf-8');
377
+ const template = this.flpConfig.enhancedHomePage ? 'cdm' : 'sandbox';
378
+ return (0, fs_1.readFileSync)((0, path_1.join)(__dirname, `../../templates/flp/${template}${filePrefix}.html`), 'utf-8');
370
379
  }
371
380
  /**
372
381
  * For UI5 version 1.71 and below, the asyncHints.requests need to be removed from the template configuration
@@ -419,6 +428,16 @@ class FlpSandbox {
419
428
  }
420
429
  }
421
430
  }
431
+ /**
432
+ * Add routes for cdm.json required by FLP during bootstrapping via cdm.
433
+ *
434
+ */
435
+ addCDMRoute() {
436
+ this.router.get('/cdm.json', async (_req, res) => {
437
+ const json = (0, cdm_1.generateCdm)(this.templateConfig.apps);
438
+ this.sendResponse(res, 'application/json', 200, JSON.stringify(json));
439
+ });
440
+ }
422
441
  /**
423
442
  * Handler for flex changes GET requests.
424
443
  *
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/core/UIComponent"], function (BaseComponent) {
4
+ "use strict";
5
+
6
+ /**
7
+ * @namespace open.ux.preview.client.flp.homepage
8
+ */
9
+ const Component = BaseComponent.extend("open.ux.preview.client.flp.homepage.Component", {
10
+ metadata: {
11
+ manifest: 'json'
12
+ }
13
+ });
14
+ return Component;
15
+ });
16
+ //# sourceMappingURL=Component.js.map
@@ -0,0 +1,10 @@
1
+ import BaseComponent from 'sap/ui/core/UIComponent';
2
+
3
+ /**
4
+ * @namespace open.ux.preview.client.flp.homepage
5
+ */
6
+ export default class Component extends BaseComponent {
7
+ public static readonly metadata = {
8
+ manifest: 'json'
9
+ };
10
+ }
@@ -0,0 +1,3 @@
1
+ .homeNewsContainer .sapCuxBaseWrapper > * {
2
+ width: 100%;
3
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "sap.app": {
3
+ "id": "open.ux.preview.client.flp.homepage",
4
+ "type": "application",
5
+ "title": "FLP HomePage"
6
+ },
7
+ "sap.ui": {
8
+ "technology": "UI5",
9
+ "deviceTypes": {
10
+ "desktop": true,
11
+ "tablet": true,
12
+ "phone": true
13
+ }
14
+ },
15
+ "sap.ui5": {
16
+ "rootView": {
17
+ "viewName": "open.ux.preview.client.flp.homepage.view.MyHome",
18
+ "type": "XML",
19
+ "async": true,
20
+ "id": "myhome"
21
+ },
22
+ "dependencies": {
23
+ "minUI5Version": "1.123.0",
24
+ "libs": {
25
+ "sap.ui.core": {},
26
+ "sap.cux.home": {}
27
+ }
28
+ },
29
+ "contentDensities": {
30
+ "compact": true,
31
+ "cozy": true
32
+ },
33
+ "resources": {
34
+ "css": [
35
+ {
36
+ "uri": "css/style.css"
37
+ }
38
+ ]
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,24 @@
1
+ <mvc:View
2
+ xmlns="sap.cux.home"
3
+ xmlns:m="sap.m"
4
+ xmlns:mvc="sap.ui.core.mvc"
5
+ displayBlock="true"
6
+ class="sapUShellFullHeight"
7
+ >
8
+ <m:Page
9
+ id="page"
10
+ showHeader="false"
11
+ class="sapUiBaseLayout sapUiResponsiveContentPadding sapUiLayoutPadding sapCuxBaseLayout"
12
+ >
13
+ <NewsAndPagesContainer id="newsContainer" class="homeNewsContainer">
14
+ <NewsPanel
15
+ id="news"
16
+ url="https://sapui5untested.int.sap.eu2.hana.ondemand.com/databinding/proxy/https/news.sap.com/feed"
17
+ />
18
+ </NewsAndPagesContainer>
19
+
20
+ <AppsContainer id="appsContainer">
21
+ <FavAppPanel id="favoriteApps" />
22
+ </AppsContainer>
23
+ </m:Page>
24
+ </mvc:View>
@@ -6,11 +6,12 @@ sap.ui.define([
6
6
  'sap/base/i18n/ResourceBundle',
7
7
  '../adp/api-handler',
8
8
  '../utils/error',
9
+ './initCdm',
9
10
  './initConnectors',
10
11
  '../utils/version',
11
12
  '../cpe/communication-service',
12
13
  '../i18n'
13
- ], function (Log, ___sap_ux_private_control_property_editor_common, IconPool, ResourceBundle, ___adp_api_handler, ___utils_error, __initConnectors, ___utils_version, ___cpe_communication_service, ___i18n) {
14
+ ], function (Log, ___sap_ux_private_control_property_editor_common, IconPool, ResourceBundle, ___adp_api_handler, ___utils_error, __initCdm, __initConnectors, ___utils_version, ___cpe_communication_service, ___i18n) {
14
15
  'use strict';
15
16
  function _interopRequireDefault(obj) {
16
17
  return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
@@ -32,6 +33,7 @@ sap.ui.define([
32
33
  const showMessage = ___sap_ux_private_control_property_editor_common['showMessage'];
33
34
  const getManifestAppdescr = ___adp_api_handler['getManifestAppdescr'];
34
35
  const getError = ___utils_error['getError'];
36
+ const initCdm = _interopRequireDefault(__initCdm);
35
37
  const initConnectors = _interopRequireDefault(__initConnectors);
36
38
  const getUi5Version = ___utils_version['getUi5Version'];
37
39
  const isLowerThanMinimalUi5Version = ___utils_version['isLowerThanMinimalUi5Version'];
@@ -175,7 +177,7 @@ sap.ui.define([
175
177
  }
176
178
  }
177
179
  async function init(_ref) {
178
- let {appUrls, flex, customInit} = _ref;
180
+ let {appUrls, flex, customInit, enhancedHomePage} = _ref;
179
181
  const urlParams = new URLSearchParams(window.location.search);
180
182
  const container = sap?.ushell?.Container ?? (await __ui5_require_async('sap/ushell/Container')).default;
181
183
  let scenario = '';
@@ -229,6 +231,9 @@ sap.ui.define([
229
231
  const resourceBundle = await loadI18nResourceBundle(scenario);
230
232
  setI18nTitle(resourceBundle);
231
233
  registerSAPFonts();
234
+ if (enhancedHomePage) {
235
+ await initCdm(container);
236
+ }
232
237
  const renderer = ui5VersionInfo.major < 2 && !ui5VersionInfo.label?.includes('legacy-free') ? await container.createRenderer(undefined, true) : await container.createRendererInternal(undefined, true);
233
238
  renderer.placeAt('content');
234
239
  }
@@ -237,7 +242,8 @@ sap.ui.define([
237
242
  init({
238
243
  appUrls: bootstrapConfig.getAttribute('data-open-ux-preview-libs-manifests'),
239
244
  flex: bootstrapConfig.getAttribute('data-open-ux-preview-flex-settings'),
240
- customInit: bootstrapConfig.getAttribute('data-open-ux-preview-customInit')
245
+ customInit: bootstrapConfig.getAttribute('data-open-ux-preview-customInit'),
246
+ enhancedHomePage: !!bootstrapConfig.getAttribute('data-open-ux-preview-enhanced-homepage')
241
247
  }).catch(e => {
242
248
  const error = getError(e);
243
249
  Log.error('Sandbox initialization failed: ' + error.message);
@@ -8,6 +8,7 @@ import ResourceBundle from 'sap/base/i18n/ResourceBundle';
8
8
  import AppState from 'sap/ushell/services/AppState';
9
9
  import { getManifestAppdescr } from '../adp/api-handler';
10
10
  import { getError } from '../utils/error';
11
+ import initCdm from './initCdm';
11
12
  import initConnectors from './initConnectors';
12
13
  import { getUi5Version, isLowerThanMinimalUi5Version, Ui5VersionInfo } from '../utils/version';
13
14
  import { CommunicationService } from '../cpe/communication-service';
@@ -257,16 +258,19 @@ export function setI18nTitle(resourceBundle: ResourceBundle, i18nKey = 'appTitle
257
258
  * @param params.appUrls JSON containing a string array of application urls
258
259
  * @param params.flex JSON containing the flex configuration
259
260
  * @param params.customInit path to the custom init module to be called
261
+ * @param params.enhancedHomePage boolean indicating if enhanced homepage is enabled
260
262
  * @returns promise
261
263
  */
262
264
  export async function init({
263
265
  appUrls,
264
266
  flex,
265
- customInit
267
+ customInit,
268
+ enhancedHomePage
266
269
  }: {
267
270
  appUrls?: string | null;
268
271
  flex?: string | null;
269
272
  customInit?: string | null;
273
+ enhancedHomePage?: boolean | null;
270
274
  }): Promise<void> {
271
275
  const urlParams = new URLSearchParams(window.location.search);
272
276
  const container = sap?.ushell?.Container ??
@@ -340,6 +344,10 @@ export async function init({
340
344
  setI18nTitle(resourceBundle);
341
345
  registerSAPFonts();
342
346
 
347
+ if (enhancedHomePage) {
348
+ await initCdm(container);
349
+ }
350
+
343
351
  const renderer =
344
352
  (ui5VersionInfo.major < 2 && !ui5VersionInfo.label?.includes('legacy-free'))
345
353
  ? await container.createRenderer(undefined, true)
@@ -353,7 +361,8 @@ if (bootstrapConfig) {
353
361
  init({
354
362
  appUrls: bootstrapConfig.getAttribute('data-open-ux-preview-libs-manifests'),
355
363
  flex: bootstrapConfig.getAttribute('data-open-ux-preview-flex-settings'),
356
- customInit: bootstrapConfig.getAttribute('data-open-ux-preview-customInit')
364
+ customInit: bootstrapConfig.getAttribute('data-open-ux-preview-customInit'),
365
+ enhancedHomePage: !!bootstrapConfig.getAttribute('data-open-ux-preview-enhanced-homepage')
357
366
  }).catch((e) => {
358
367
  const error = getError(e);
359
368
  Log.error('Sandbox initialization failed: ' + error.message);
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ sap.ui.define([], function () {
4
+ "use strict";
5
+
6
+ /**
7
+ * Initializes the CDM (Common Data Model) configuration for the SAP Fiori Launchpad.
8
+ *
9
+ * @param {sap.ushell.Container} container - The SAP Fiori Launchpad container.
10
+ * @returns {Promise<void>} A promise that resolves when the initialization is complete.
11
+ */
12
+ async function initCdm(container) {
13
+ window['sap-ushell-config'] = {
14
+ defaultRenderer: 'fiori2',
15
+ renderers: {
16
+ fiori2: {
17
+ componentData: {
18
+ config: {
19
+ enableSearch: false,
20
+ enableRecentActivity: true,
21
+ rootIntent: 'Shell-home'
22
+ }
23
+ }
24
+ }
25
+ },
26
+ ushell: {
27
+ customPreload: {
28
+ enabled: false
29
+ },
30
+ spaces: {
31
+ enabled: true,
32
+ myHome: {
33
+ enabled: true
34
+ }
35
+ },
36
+ homeApp: {
37
+ component: {
38
+ name: 'open.ux.preview.client.flp.homepage',
39
+ url: '/preview/client/flp/homepage'
40
+ }
41
+ }
42
+ },
43
+ services: {
44
+ Container: {
45
+ adapter: {
46
+ config: {
47
+ userProfile: {
48
+ metadata: {
49
+ editablePropterties: ['accessibility', 'contentDensity', 'theme']
50
+ },
51
+ defaults: {
52
+ email: 'john.doe@sap.com',
53
+ firstName: 'John',
54
+ lastName: 'Doe',
55
+ fullName: 'John Doe',
56
+ id: 'DOEJ'
57
+ }
58
+ }
59
+ }
60
+ }
61
+ },
62
+ CommonDataModel: {
63
+ adapter: {
64
+ config: {
65
+ ignoreSiteDataPersonalization: true,
66
+ siteDataUrl: '/cdm.json'
67
+ }
68
+ }
69
+ },
70
+ Personalization: {
71
+ adapter: {
72
+ module: 'sap.ushell.adapters.local.PersonalizationAdapter',
73
+ config: {
74
+ storageType: 'MEMORY'
75
+ }
76
+ }
77
+ },
78
+ PersonalizationV2: {
79
+ adapter: {
80
+ module: 'sap.ushell.adapters.local.PersonalizationAdapter',
81
+ config: {
82
+ storageType: 'MEMORY'
83
+ }
84
+ }
85
+ },
86
+ AppState: {
87
+ adapter: {
88
+ module: 'sap.ushell.adapters.local.AppStateAdapter'
89
+ },
90
+ config: {
91
+ transient: true
92
+ }
93
+ },
94
+ NavTargetResolutionInternal: {
95
+ config: {
96
+ allowTestUrlComponentConfig: false,
97
+ enableClientSideTargetResolution: true
98
+ },
99
+ adapter: {
100
+ module: 'sap.ushell.adapters.local.NavTargetResolutionInternalAdapter'
101
+ }
102
+ },
103
+ UserInfo: {
104
+ adapter: {
105
+ module: 'sap.ushell.adapters.local.UserInfoAdapter'
106
+ }
107
+ },
108
+ FlpLaunchPage: {
109
+ adapter: {
110
+ module: 'sap.ushell.adapters.cdm.v3.FlpLaunchPageAdapter'
111
+ }
112
+ }
113
+ }
114
+ };
115
+ await container.init('cdm');
116
+ }
117
+ return initCdm;
118
+ });
119
+ //# sourceMappingURL=initCdm.js.map
@@ -0,0 +1,118 @@
1
+ import { Window } from 'types/global';
2
+
3
+ /**
4
+ * Initializes the CDM (Common Data Model) configuration for the SAP Fiori Launchpad.
5
+ *
6
+ * @param {sap.ushell.Container} container - The SAP Fiori Launchpad container.
7
+ * @returns {Promise<void>} A promise that resolves when the initialization is complete.
8
+ */
9
+ export default async function initCdm(container: typeof sap.ushell.Container): Promise<void> {
10
+ (window as unknown as Window)['sap-ushell-config'] = {
11
+ defaultRenderer: 'fiori2',
12
+ renderers: {
13
+ fiori2: {
14
+ componentData: {
15
+ config: {
16
+ enableSearch: false,
17
+ enableRecentActivity: true,
18
+ rootIntent: 'Shell-home'
19
+ }
20
+ }
21
+ }
22
+ },
23
+ ushell: {
24
+ customPreload: {
25
+ enabled: false
26
+ },
27
+ spaces: {
28
+ enabled: true,
29
+ myHome: {
30
+ enabled: true
31
+ }
32
+ },
33
+ homeApp: {
34
+ component: {
35
+ name: 'open.ux.preview.client.flp.homepage',
36
+ url: '/preview/client/flp/homepage'
37
+ }
38
+ }
39
+ },
40
+ services: {
41
+ Container: {
42
+ adapter: {
43
+ config: {
44
+ userProfile: {
45
+ metadata: {
46
+ editablePropterties: [
47
+ 'accessibility',
48
+ 'contentDensity',
49
+ 'theme'
50
+ ]
51
+ },
52
+ defaults: {
53
+ email: 'john.doe@sap.com',
54
+ firstName: 'John',
55
+ lastName: 'Doe',
56
+ fullName: 'John Doe',
57
+ id: 'DOEJ'
58
+ }
59
+ }
60
+ }
61
+ }
62
+ },
63
+ CommonDataModel: {
64
+ adapter: {
65
+ config: {
66
+ ignoreSiteDataPersonalization: true,
67
+ siteDataUrl: '/cdm.json'
68
+ }
69
+ }
70
+ },
71
+ Personalization: {
72
+ adapter: {
73
+ module: 'sap.ushell.adapters.local.PersonalizationAdapter',
74
+ config: {
75
+ storageType: 'MEMORY'
76
+ }
77
+ }
78
+ },
79
+ PersonalizationV2: {
80
+ adapter: {
81
+ module: 'sap.ushell.adapters.local.PersonalizationAdapter',
82
+ config: {
83
+ storageType: 'MEMORY'
84
+ }
85
+ }
86
+ },
87
+ AppState: {
88
+ adapter: {
89
+ module: 'sap.ushell.adapters.local.AppStateAdapter'
90
+ },
91
+ config: {
92
+ transient: true
93
+ }
94
+ },
95
+ NavTargetResolutionInternal: {
96
+ config: {
97
+ allowTestUrlComponentConfig: false,
98
+ enableClientSideTargetResolution: true
99
+ },
100
+ adapter: {
101
+ module: 'sap.ushell.adapters.local.NavTargetResolutionInternalAdapter'
102
+ }
103
+ },
104
+ UserInfo: {
105
+ adapter: {
106
+ module: 'sap.ushell.adapters.local.UserInfoAdapter'
107
+ }
108
+ },
109
+ FlpLaunchPage: {
110
+ adapter: {
111
+ module: 'sap.ushell.adapters.cdm.v3.FlpLaunchPageAdapter'
112
+ }
113
+ }
114
+ }
115
+ };
116
+
117
+ await container.init('cdm');
118
+ }
@@ -37,8 +37,8 @@ sap.ui.define(["sap/ui/VersionInfo", "sap/base/Log"], function (VersionInfo, Log
37
37
  library
38
38
  }))?.version;
39
39
  if (!version) {
40
- Log.error('Could not get UI5 version of application. Using 1.121.0 as fallback.');
41
- version = '1.121.0';
40
+ Log.error('Could not get UI5 version of application. Using 1.130.0 as fallback.');
41
+ version = '1.130.0';
42
42
  }
43
43
  const [major, minor, patch] = version.split('.').map(versionPart => parseInt(versionPart, 10));
44
44
  const label = version.split(/-(.*)/s)?.[1];
@@ -48,8 +48,8 @@ function checkVersionInfo(versionInfo: Ui5VersionInfo): void {
48
48
  export async function getUi5Version(library: string = 'sap.ui.core'): Promise<Ui5VersionInfo> {
49
49
  let version = ((await VersionInfo.load({ library })) as SingleVersionInfo)?.version;
50
50
  if (!version) {
51
- Log.error('Could not get UI5 version of application. Using 1.121.0 as fallback.');
52
- version = '1.121.0';
51
+ Log.error('Could not get UI5 version of application. Using 1.130.0 as fallback.');
52
+ version = '1.130.0';
53
53
  }
54
54
  const [major, minor, patch] = version.split('.').map((versionPart) => parseInt(versionPart, 10));
55
55
  const label = version.split(/-(.*)/s)?.[1];
@@ -55,6 +55,10 @@ export interface FlpConfig {
55
55
  * Optional: allows to specify a custom init script executed in addition to the default one
56
56
  */
57
57
  init?: string;
58
+ /**
59
+ * Optional: if set to true then the new FLP homepage will be enabled
60
+ */
61
+ enhancedHomePage?: boolean;
58
62
  }
59
63
  interface OptionalTestConfig {
60
64
  /**
@@ -115,5 +119,108 @@ export type DefaultIntent = {
115
119
  object: 'app';
116
120
  action: 'preview';
117
121
  };
122
+ type FLPAppsCatalog = {
123
+ identification: {
124
+ id: string;
125
+ title: string;
126
+ };
127
+ payload: {
128
+ viz: string[];
129
+ };
130
+ };
131
+ type FLPAppVisualization = {
132
+ vizType: string;
133
+ businessApp: string;
134
+ vizConfig: {
135
+ 'sap.app': {
136
+ title: string;
137
+ subTitle: string;
138
+ };
139
+ 'sap.flp': {
140
+ target: {
141
+ appId: string;
142
+ inboundId: string;
143
+ parameters: {
144
+ name: string;
145
+ value: string;
146
+ }[];
147
+ };
148
+ };
149
+ };
150
+ };
151
+ type FLPApp = {
152
+ 'sap.app': {
153
+ id: string;
154
+ title: string;
155
+ crossNavigation: {
156
+ inbounds: {
157
+ [key: string]: {
158
+ semanticObject: string;
159
+ action: string;
160
+ title: string;
161
+ subTitle: string;
162
+ signature: {
163
+ additionalParameters: string;
164
+ };
165
+ };
166
+ };
167
+ };
168
+ };
169
+ 'sap.ui5': {
170
+ componentName: string;
171
+ };
172
+ 'sap.ui': {
173
+ technology: string;
174
+ };
175
+ 'sap.platform.runtime': {
176
+ componentProperties: {
177
+ url: string;
178
+ asyncHints: Record<string, unknown>;
179
+ };
180
+ };
181
+ };
182
+ type FLPSectionVizConfig = {
183
+ id: string;
184
+ vizId: string;
185
+ };
186
+ type FLPSection = {
187
+ id: string;
188
+ title: string;
189
+ default: boolean;
190
+ layout: {
191
+ vizOrder: FLPSectionVizConfig['id'][];
192
+ };
193
+ viz: Record<FLPSectionVizConfig['id'], FLPSectionVizConfig>;
194
+ };
195
+ type FLPPage = {
196
+ identification: {
197
+ id: string;
198
+ title: string;
199
+ };
200
+ payload: {
201
+ layout: {
202
+ sectionOrder: FLPSection['id'][];
203
+ };
204
+ sections: Record<FLPSection['id'], FLPSection>;
205
+ };
206
+ };
207
+ /**
208
+ * FLP CDM configuration.
209
+ */
210
+ export type FLPCdmConfig = {
211
+ _version: string;
212
+ catalogs: Record<FLPAppsCatalog['identification']['id'], FLPAppsCatalog>;
213
+ visualizations: Record<string, FLPAppVisualization>;
214
+ applications: Record<FLPApp['sap.app']['id'], FLPApp>;
215
+ pages: Record<FLPPage['identification']['id'], FLPPage>;
216
+ };
217
+ /**
218
+ * Default FLP homepage configuration.
219
+ */
220
+ export declare const FLPHomePageDefaults: {
221
+ pageName: string;
222
+ catalogId: string;
223
+ sectionId: string;
224
+ };
118
225
  export {};
119
226
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FLPHomePageDefaults = void 0;
4
+ /**
5
+ * Default FLP homepage configuration.
6
+ */
7
+ exports.FLPHomePageDefaults = {
8
+ pageName: 'SAP_BASIS_PG_UI_MYHOME',
9
+ catalogId: 'homeCatalog',
10
+ sectionId: 'homeAppsSection'
11
+ };
3
12
  //# sourceMappingURL=index.js.map
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.18.23",
12
+ "version": "0.19.1",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -25,12 +25,12 @@
25
25
  "ejs": "3.1.10",
26
26
  "mem-fs": "2.1.0",
27
27
  "mem-fs-editor": "9.4.0",
28
- "@sap-ux/adp-tooling": "0.13.17",
28
+ "@sap-ux/adp-tooling": "0.13.18",
29
29
  "@sap-ux/btp-utils": "1.0.2",
30
+ "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.1",
30
31
  "@sap-ux/feature-toggle": "0.2.3",
31
32
  "@sap-ux/logger": "0.6.0",
32
33
  "@sap-ux/project-access": "1.29.18",
33
- "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.1",
34
34
  "@sap-ux/system-access": "0.5.33"
35
35
  },
36
36
  "devDependencies": {
@@ -49,11 +49,11 @@
49
49
  "nock": "13.4.0",
50
50
  "npm-run-all2": "6.2.0",
51
51
  "supertest": "6.3.3",
52
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.7",
53
- "@sap-ux/axios-extension": "1.19.1",
52
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.8",
54
53
  "@sap-ux/i18n": "0.2.3",
55
54
  "@sap-ux/store": "1.0.0",
56
- "@sap-ux/ui5-info": "0.9.1"
55
+ "@sap-ux/ui5-info": "0.9.1",
56
+ "@sap-ux/axios-extension": "1.19.1"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "express": "4"
@@ -0,0 +1,47 @@
1
+ {
2
+ "_version": "3.1.0",
3
+ "catalogs": {
4
+ "homeCatalog": {
5
+ "identification": {
6
+ "id": "homeCatalog",
7
+ "title": "Homepage Apps"
8
+ },
9
+ "payload": {
10
+ "viz": []
11
+ }
12
+ }
13
+ },
14
+ "site": {
15
+ "payload": {
16
+ "groupsOrder": []
17
+ }
18
+ },
19
+ "groups": {},
20
+ "visualizations": {},
21
+ "applications": {},
22
+ "pages": {
23
+ "SAP_BASIS_PG_UI_MYHOME": {
24
+ "identification": {
25
+ "id": "SAP_BASIS_PG_UI_MYHOME"
26
+ },
27
+ "payload": {
28
+ "layout": {
29
+ "sectionOrder": [
30
+ "homeAppsSection"
31
+ ]
32
+ },
33
+ "sections": {
34
+ "homeAppsSection": {
35
+ "id": "homeAppsSection",
36
+ "title": "Recently Added Apps",
37
+ "default": true,
38
+ "layout": {
39
+ "vizOrder": []
40
+ },
41
+ "viz": {}
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,73 @@
1
+ <!DOCTYPE HTML>
2
+ <html lang="en">
3
+ <!-- Copyright (c) 2015 SAP AG, All Rights Reserved -->
4
+
5
+ <head>
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+ <meta charset="UTF-8">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
+ <title>Local FLP Sandbox</title>
10
+
11
+ <!-- Bootstrap the unified shell in sandbox mode for standalone usage.
12
+
13
+ The renderer is specified in the global Unified Shell configuration object "sap-ushell-config".
14
+
15
+ The fiori2 renderer will render the shell header allowing, for instance,
16
+ testing of additional application setting buttons.
17
+
18
+ The navigation target resolution service is configured in a way that the empty URL hash is
19
+ resolved to our own application.
20
+
21
+ This example uses relative path references for the SAPUI5 resources and test-resources;
22
+ it might be necessary to adapt them depending on the target runtime platform.
23
+ The sandbox platform is restricted to development or demo use cases and must NOT be used
24
+ for productive scenarios.
25
+ -->
26
+
27
+ <script type="text/javascript">
28
+ window["data-open-ux-preview-basePath"] = "<%- basePath %>";
29
+ </script>
30
+
31
+ <!-- Bootstrap the UI5 core library. 'data-sap-ui-frameOptions="allow"' is a NON-SECURE setting for test environments -->
32
+ <script id="sap-ui-bootstrap"
33
+ src="<%- basePath %>/resources/sap-ui-core.js"
34
+ data-sap-ui-libs="<%- ui5.libs %>"
35
+ data-sap-ui-async="true"
36
+ data-sap-ui-preload="async"
37
+ data-sap-ui-theme="<%- ui5.theme %>"
38
+ data-sap-ui-compatVersion="edge"
39
+ data-sap-ui-language="en"
40
+ data-sap-ui-bindingSyntax="complex"
41
+ data-sap-ui-flexibilityServices='<%- JSON.stringify(ui5.flex) %>'
42
+ data-sap-ui-resourceroots='<%- JSON.stringify(ui5.resources) %>'
43
+ data-sap-ui-frameOptions="allow"
44
+ data-sap-ui-xx-componentPreload="off"<%- ui5.bootstrapOptions %>
45
+ data-sap-ui-oninit="module:open/ux/preview/client/flp/init"<% if (locals.init) { %>
46
+ data-open-ux-preview-customInit='<%- init %>'<% } if (locals.flex) { %>
47
+ data-open-ux-preview-features='<%- JSON.stringify(features) %>'
48
+ data-open-ux-preview-flex-settings='<%- JSON.stringify(flex) %>'<% } if (locals.locateReuseLibsScript) { %>
49
+ data-open-ux-preview-libs-manifests='<%- JSON.stringify(Object.values(apps).map(app => app.url)) %>'<% } %>
50
+ data-open-ux-preview-enhanced-homepage='true'>
51
+ </script>
52
+
53
+ <% if (locals.flex && flex?.developerMode) { %>
54
+ <!-- Hides Rta native toolbar -->
55
+ <style>
56
+ #shell-header, .sapUiRtaToolbar {
57
+ visibility: hidden;
58
+ height: 1px;
59
+ }
60
+ .sapUshellShellCanvas {
61
+ top: 0 !important;
62
+ }
63
+ .sapUiRtaMode .sapUiShellBackgroundImage.sapUiGlobalBackgroundImageForce.sapUshellShellBG {
64
+ background-color: transparent !important;
65
+ }
66
+ </style><% } %>
67
+ </head>
68
+
69
+ <!-- UI Content -->
70
+ <body class="sapUiBody" id="content">
71
+ </body>
72
+
73
+ </html>