@sap-ux/preview-middleware 0.23.99 → 0.23.100
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/config.d.ts +1 -0
- package/dist/base/config.js +2 -3
- package/dist/base/flp.d.ts +2 -1
- package/dist/base/flp.js +29 -27
- package/dist/client/adp/api-handler.js +2 -1
- package/dist/client/adp/api-handler.ts +2 -1
- package/dist/client/flp/WorkspaceConnector.js +6 -4
- package/dist/client/flp/WorkspaceConnector.ts +7 -4
- package/dist/client/flp/enableFakeConnector.js +6 -3
- package/dist/client/flp/enableFakeConnector.ts +6 -3
- package/package.json +4 -4
- package/templates/flp/cdm.ejs +1 -4
- package/templates/flp/editor.ejs +1 -1
- package/templates/flp/sandbox.ejs +2 -5
- package/templates/flp/sandbox2.ejs +2 -5
package/dist/base/config.d.ts
CHANGED
package/dist/base/config.js
CHANGED
|
@@ -281,6 +281,7 @@ function createFlpTemplateConfig(config, manifest, resources = {}) {
|
|
|
281
281
|
}
|
|
282
282
|
return {
|
|
283
283
|
basePath: basePath,
|
|
284
|
+
baseUrl: '',
|
|
284
285
|
apps: {},
|
|
285
286
|
init: initPath,
|
|
286
287
|
ui5: {
|
|
@@ -385,9 +386,7 @@ async function generatePreviewFiles(basePath, config, fs, logger = new logger_1.
|
|
|
385
386
|
// remove incorrect configurations
|
|
386
387
|
sanitizeConfig(config, logger);
|
|
387
388
|
// create file system if not provided
|
|
388
|
-
|
|
389
|
-
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
390
|
-
}
|
|
389
|
+
fs ??= (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
391
390
|
// generate FLP configuration
|
|
392
391
|
const flpTemplate = (0, node_fs_1.readFileSync)((0, node_path_1.join)(TEMPLATE_PATH, 'flp/sandbox.ejs'), 'utf-8');
|
|
393
392
|
const flpConfig = getFlpConfigWithDefaults(config.flp);
|
package/dist/base/flp.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare class FlpSandbox {
|
|
|
34
34
|
readonly rta?: RtaConfig;
|
|
35
35
|
readonly test?: TestConfig[];
|
|
36
36
|
readonly router: EnhancedRouter;
|
|
37
|
-
private fs;
|
|
37
|
+
private readonly fs;
|
|
38
38
|
private readonly logger;
|
|
39
39
|
private readonly utils;
|
|
40
40
|
private readonly project;
|
|
@@ -103,6 +103,7 @@ export declare class FlpSandbox {
|
|
|
103
103
|
/**
|
|
104
104
|
* Handler for the GET requests to the runtime adaptation editor in developer mode.
|
|
105
105
|
*
|
|
106
|
+
* @param req the request
|
|
106
107
|
* @param res the response
|
|
107
108
|
* @param rta runtime adaptation configuration
|
|
108
109
|
* @param previewUrl the url of the preview
|
package/dist/base/flp.js
CHANGED
|
@@ -78,6 +78,7 @@ class FlpSandbox {
|
|
|
78
78
|
* @param logger logger instance
|
|
79
79
|
*/
|
|
80
80
|
constructor(config, project, utils, logger) {
|
|
81
|
+
this.fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
81
82
|
this.logger = logger;
|
|
82
83
|
this.project = project;
|
|
83
84
|
this.utils = utils;
|
|
@@ -220,12 +221,19 @@ class FlpSandbox {
|
|
|
220
221
|
? '@sap-ux/control-property-editor'
|
|
221
222
|
: '@sap-ux/preview-middleware';
|
|
222
223
|
await this.setApplicationDependencies();
|
|
223
|
-
|
|
224
|
-
|
|
224
|
+
this.templateConfig.baseUrl = req['ui5-patched-router']?.baseUrl ?? '';
|
|
225
|
+
const ui5Version = await this.getUi5Version(req.protocol, req.headers.host, this.templateConfig.baseUrl);
|
|
226
|
+
this.checkDeleteConnectors(ui5Version.major, ui5Version.minor, ui5Version.isCdn);
|
|
227
|
+
if (ui5Version.major === 1 && ui5Version.minor <= 71) {
|
|
228
|
+
this.removeAsyncHintsRequests();
|
|
229
|
+
}
|
|
230
|
+
const config = structuredClone(this.templateConfig);
|
|
225
231
|
if (!config.ui5.libs.includes('sap.ui.rta')) {
|
|
226
|
-
|
|
227
|
-
libs
|
|
228
|
-
|
|
232
|
+
// sap.ui.rta needs to be added to the list of preload libs for variants management and adaptation projects
|
|
233
|
+
config.ui5.libs += ',sap.ui.rta';
|
|
234
|
+
}
|
|
235
|
+
if (editor.developerMode) {
|
|
236
|
+
config.ui5.bootstrapOptions = serializeUi5Configuration(this.getDeveloperModeConfig(ui5Version.major));
|
|
229
237
|
}
|
|
230
238
|
config.flexSettings = {
|
|
231
239
|
layer: rta.layer ?? 'CUSTOMER_BASE',
|
|
@@ -235,14 +243,6 @@ class FlpSandbox {
|
|
|
235
243
|
pluginScript: editor.pluginScript
|
|
236
244
|
};
|
|
237
245
|
config.features = feature_toggle_1.FeatureToggleAccess.getAllFeatureToggles();
|
|
238
|
-
const ui5Version = await this.getUi5Version(req.protocol, req.headers.host, req['ui5-patched-router']?.baseUrl);
|
|
239
|
-
this.checkDeleteConnectors(ui5Version.major, ui5Version.minor, ui5Version.isCdn);
|
|
240
|
-
if (editor.developerMode === true) {
|
|
241
|
-
config.ui5.bootstrapOptions = serializeUi5Configuration(this.getDeveloperModeConfig(ui5Version.major));
|
|
242
|
-
}
|
|
243
|
-
if (ui5Version.major === 1 && ui5Version.minor <= 71) {
|
|
244
|
-
this.removeAsyncHintsRequests();
|
|
245
|
-
}
|
|
246
246
|
return (0, ejs_1.render)(this.getSandboxTemplate(ui5Version), config);
|
|
247
247
|
}
|
|
248
248
|
/**
|
|
@@ -261,12 +261,13 @@ class FlpSandbox {
|
|
|
261
261
|
/**
|
|
262
262
|
* Handler for the GET requests to the runtime adaptation editor in developer mode.
|
|
263
263
|
*
|
|
264
|
+
* @param req the request
|
|
264
265
|
* @param res the response
|
|
265
266
|
* @param rta runtime adaptation configuration
|
|
266
267
|
* @param previewUrl the url of the preview
|
|
267
268
|
* @private
|
|
268
269
|
*/
|
|
269
|
-
async editorGetHandlerDeveloperMode(res, rta, previewUrl) {
|
|
270
|
+
async editorGetHandlerDeveloperMode(req, res, rta, previewUrl) {
|
|
270
271
|
const scenario = rta.options?.scenario;
|
|
271
272
|
let templatePreviewUrl = `${previewUrl}?sap-ui-xx-viewCache=false&fiori-tools-rta-mode=forAdaptation&sap-ui-rta-skip-flex-validation=true&sap-ui-xx-condense-changes=true#${this.flpConfig.intent.object}-${this.flpConfig.intent.action}`;
|
|
272
273
|
if (scenario === 'ADAPTATION_PROJECT') {
|
|
@@ -280,12 +281,13 @@ class FlpSandbox {
|
|
|
280
281
|
const envLivereloadUrl = (0, btp_utils_1.isAppStudio)() ? await (0, btp_utils_1.exposePort)(livereloadPort) : undefined;
|
|
281
282
|
const html = (0, ejs_1.render)(template, {
|
|
282
283
|
previewUrl: templatePreviewUrl,
|
|
283
|
-
telemetry: rta.options?.telemetry
|
|
284
|
+
telemetry: !!rta.options?.telemetry,
|
|
284
285
|
appName: rta.options?.appName,
|
|
285
286
|
scenario,
|
|
286
287
|
livereloadPort,
|
|
287
288
|
livereloadUrl: envLivereloadUrl,
|
|
288
|
-
features: JSON.stringify(features)
|
|
289
|
+
features: JSON.stringify(features),
|
|
290
|
+
baseUrl: req['ui5-patched-router']?.baseUrl ?? ''
|
|
289
291
|
});
|
|
290
292
|
this.sendResponse(res, 'text/html', 200, html);
|
|
291
293
|
}
|
|
@@ -302,7 +304,9 @@ class FlpSandbox {
|
|
|
302
304
|
async editorGetHandler(req, res, rta, previewUrl, editor) {
|
|
303
305
|
if (!req.query['fiori-tools-rta-mode']) {
|
|
304
306
|
this.logger.debug(`Adjusting URL parameters for runtime adaptation mode. Redirecting to correct URL.`);
|
|
305
|
-
const url = 'ui5-patched-router' in req
|
|
307
|
+
const url = 'ui5-patched-router' in req
|
|
308
|
+
? node_path_1.posix.join(req['ui5-patched-router']?.baseUrl ?? '', previewUrl)
|
|
309
|
+
: previewUrl;
|
|
306
310
|
const params = structuredClone(req.query);
|
|
307
311
|
params['sap-ui-xx-viewCache'] = 'false';
|
|
308
312
|
params['fiori-tools-rta-mode'] = 'true';
|
|
@@ -326,8 +330,8 @@ class FlpSandbox {
|
|
|
326
330
|
if (editor.developerMode) {
|
|
327
331
|
previewUrl = `${previewUrl}.inner.html`;
|
|
328
332
|
editor.pluginScript ??= 'open/ux/preview/client/cpe/init';
|
|
329
|
-
this.router.get(editor.path, async (
|
|
330
|
-
await this.editorGetHandlerDeveloperMode(res, rta, previewUrl);
|
|
333
|
+
this.router.get(editor.path, async (req, res) => {
|
|
334
|
+
await this.editorGetHandlerDeveloperMode(req, res, rta, previewUrl);
|
|
331
335
|
});
|
|
332
336
|
let path = (0, node_path_1.dirname)(editor.path);
|
|
333
337
|
if (!path.endsWith('/')) {
|
|
@@ -352,7 +356,7 @@ class FlpSandbox {
|
|
|
352
356
|
// connect API (karma test runner) has no request query property
|
|
353
357
|
if ('query' in req && 'redirect' in res && !req.query['sap-ui-xx-viewCache']) {
|
|
354
358
|
this.logger.debug(`Adjusting URL parameters for preview. Redirecting to correct URL.`);
|
|
355
|
-
const url = 'ui5-patched-router' in req ?
|
|
359
|
+
const url = 'ui5-patched-router' in req ? node_path_1.posix.join(req['ui5-patched-router']?.baseUrl ?? '', req.path) : req.path;
|
|
356
360
|
const params = structuredClone(req.query);
|
|
357
361
|
params['sap-ui-xx-viewCache'] = 'false';
|
|
358
362
|
res.redirect(302, `${url}?${new URLSearchParams(params)}`);
|
|
@@ -368,12 +372,15 @@ class FlpSandbox {
|
|
|
368
372
|
next();
|
|
369
373
|
}
|
|
370
374
|
else {
|
|
375
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
376
|
+
this.templateConfig.baseUrl = ('ui5-patched-router' in req && req['ui5-patched-router']?.baseUrl) || '';
|
|
371
377
|
const ui5Version = await this.getUi5Version(
|
|
372
378
|
//use protocol from request header referer as fallback for connect API (karma test runner)
|
|
373
379
|
'protocol' in req
|
|
374
380
|
? req.protocol
|
|
375
|
-
: (req.headers.referer?.substring(0, req.headers.referer.indexOf(':')) ?? 'http'), req.headers.host,
|
|
381
|
+
: (req.headers.referer?.substring(0, req.headers.referer.indexOf(':')) ?? 'http'), req.headers.host, this.templateConfig.baseUrl);
|
|
376
382
|
this.checkDeleteConnectors(ui5Version.major, ui5Version.minor, ui5Version.isCdn);
|
|
383
|
+
//for consistency reasons, we also add the baseUrl to the HTML here, although it is only used in editor mode
|
|
377
384
|
const html = (0, ejs_1.render)(this.getSandboxTemplate(ui5Version), this.templateConfig);
|
|
378
385
|
this.sendResponse(res, 'text/html', 200, html);
|
|
379
386
|
}
|
|
@@ -492,7 +499,6 @@ class FlpSandbox {
|
|
|
492
499
|
for (const app of this.flpConfig.apps) {
|
|
493
500
|
let manifest;
|
|
494
501
|
if (app.local) {
|
|
495
|
-
this.fs = this.fs ?? (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
496
502
|
const webappPath = await (0, project_access_1.getWebappPath)(app.local, this.fs);
|
|
497
503
|
manifest = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(webappPath, 'manifest.json'), 'utf-8'));
|
|
498
504
|
this.router.use(app.target, (0, express_1.static)(webappPath));
|
|
@@ -534,7 +540,6 @@ class FlpSandbox {
|
|
|
534
540
|
async flexGetHandler(res) {
|
|
535
541
|
const changes = await (0, flex_1.readChanges)(this.project, this.logger);
|
|
536
542
|
if (this.onChangeRequest) {
|
|
537
|
-
this.fs = this.fs ?? (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
538
543
|
for (const change of Object.values(changes)) {
|
|
539
544
|
await this.onChangeRequest('read', change, this.fs, this.logger);
|
|
540
545
|
}
|
|
@@ -549,7 +554,6 @@ class FlpSandbox {
|
|
|
549
554
|
* @private
|
|
550
555
|
*/
|
|
551
556
|
async flexPostHandler(req, res) {
|
|
552
|
-
this.fs = this.fs ?? (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
553
557
|
try {
|
|
554
558
|
const body = req.body;
|
|
555
559
|
if (this.onChangeRequest) {
|
|
@@ -788,7 +792,6 @@ class FlpSandbox {
|
|
|
788
792
|
async storeCardManifestHandler(req, res) {
|
|
789
793
|
try {
|
|
790
794
|
const { floorplan, localPath, fileName = project_access_1.FileName.Manifest, manifests } = req.body;
|
|
791
|
-
this.fs = this.fs ?? (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
792
795
|
const webappPath = await (0, project_access_1.getWebappPath)(node_path_1.default.resolve(), this.fs);
|
|
793
796
|
const fullPath = (0, node_path_1.join)(webappPath, localPath);
|
|
794
797
|
const filePath = fileName.endsWith('.json') ? (0, node_path_1.join)(fullPath, fileName) : `${(0, node_path_1.join)(fullPath, fileName)}.json`;
|
|
@@ -838,7 +841,6 @@ class FlpSandbox {
|
|
|
838
841
|
*/
|
|
839
842
|
async storeI18nKeysHandler(req, res) {
|
|
840
843
|
try {
|
|
841
|
-
this.fs = this.fs ?? (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
842
844
|
const webappPath = await (0, project_access_1.getWebappPath)(node_path_1.default.resolve(), this.fs);
|
|
843
845
|
const i18nConfig = this.manifest['sap.app'].i18n;
|
|
844
846
|
let i18nPath = 'i18n/i18n.properties';
|
|
@@ -853,7 +855,7 @@ class FlpSandbox {
|
|
|
853
855
|
supportedLocales = locales;
|
|
854
856
|
fallbackLocale = fallback;
|
|
855
857
|
}
|
|
856
|
-
const requestedLocale = req.query.locale
|
|
858
|
+
const requestedLocale = req.query.locale ?? fallbackLocale ?? '';
|
|
857
859
|
const baseFilePath = (0, node_path_1.join)(webappPath, i18nPath);
|
|
858
860
|
const filePath = requestedLocale
|
|
859
861
|
? baseFilePath.replace('.properties', `_${requestedLocale}.properties`)
|
|
@@ -38,7 +38,8 @@ sap.ui.define(["../utils/error"], function (___utils_error) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
try {
|
|
41
|
-
const
|
|
41
|
+
const baseUrl = document.getElementById('root')?.dataset.openUxPreviewBaseUrl ?? '';
|
|
42
|
+
const response = await fetch(`${baseUrl}${endpoint}`, config);
|
|
42
43
|
if (!response.ok) {
|
|
43
44
|
const errorData = await response.json();
|
|
44
45
|
const message = errorData?.message ? ` Server message: ${errorData.message}.` : '';
|
|
@@ -83,7 +83,8 @@ export async function request<T>(endpoint: ApiEndpoints, method: RequestMethod,
|
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
try {
|
|
86
|
-
const
|
|
86
|
+
const baseUrl = document.getElementById('root')?.dataset.openUxPreviewBaseUrl ?? '';
|
|
87
|
+
const response: Response = await fetch(`${baseUrl}${endpoint}`, config);
|
|
87
88
|
|
|
88
89
|
if (!response.ok) {
|
|
89
90
|
const errorData = (await response.json()) as ResponseMessage;
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStorageConnector", "sap/ui/fl/Layer", "./common", "../utils/version", "../utils/additional-change-info"], function (merge, ObjectStorageConnector, Layer, ___common, ___utils_version, ___utils_additional_change_info) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const CHANGES_API_PATH_STATIC = ___common["CHANGES_API_PATH"];
|
|
7
7
|
const getFlexSettings = ___common["getFlexSettings"];
|
|
8
8
|
const getUi5Version = ___utils_version["getUi5Version"];
|
|
9
9
|
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
10
10
|
const getAdditionalChangeInfo = ___utils_additional_change_info["getAdditionalChangeInfo"];
|
|
11
|
+
const baseUrl = document.getElementById('sap-ui-bootstrap')?.dataset.openUxPreviewBaseUrl ?? '';
|
|
12
|
+
const changesApiPath = `${baseUrl}${CHANGES_API_PATH_STATIC}`;
|
|
11
13
|
const connector = merge({}, ObjectStorageConnector, {
|
|
12
14
|
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
13
15
|
storage: {
|
|
@@ -31,7 +33,7 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStor
|
|
|
31
33
|
change,
|
|
32
34
|
additionalChangeInfo
|
|
33
35
|
};
|
|
34
|
-
return fetch(
|
|
36
|
+
return fetch(changesApiPath, {
|
|
35
37
|
method: 'POST',
|
|
36
38
|
body: JSON.stringify(body, null, 2),
|
|
37
39
|
headers: {
|
|
@@ -47,7 +49,7 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStor
|
|
|
47
49
|
// exceptions in the listener call are ignored
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
|
-
return fetch(
|
|
52
|
+
return fetch(changesApiPath, {
|
|
51
53
|
method: 'DELETE',
|
|
52
54
|
body: JSON.stringify({
|
|
53
55
|
fileName: key
|
|
@@ -64,7 +66,7 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStor
|
|
|
64
66
|
// not implemented
|
|
65
67
|
},
|
|
66
68
|
getItems: async function () {
|
|
67
|
-
const response = await fetch(
|
|
69
|
+
const response = await fetch(changesApiPath, {
|
|
68
70
|
method: 'GET',
|
|
69
71
|
headers: {
|
|
70
72
|
'content-type': 'application/json'
|
|
@@ -2,10 +2,13 @@ import merge from 'sap/base/util/merge';
|
|
|
2
2
|
import ObjectStorageConnector from 'sap/ui/fl/write/api/connectors/ObjectStorageConnector';
|
|
3
3
|
import Layer from 'sap/ui/fl/Layer';
|
|
4
4
|
import type { FlexChange } from './common';
|
|
5
|
-
import { CHANGES_API_PATH, getFlexSettings } from './common';
|
|
5
|
+
import { CHANGES_API_PATH as CHANGES_API_PATH_STATIC, getFlexSettings } from './common';
|
|
6
6
|
import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
|
|
7
7
|
import { getAdditionalChangeInfo } from '../utils/additional-change-info';
|
|
8
8
|
|
|
9
|
+
const baseUrl = document.getElementById('sap-ui-bootstrap')?.dataset.openUxPreviewBaseUrl ??'';
|
|
10
|
+
const changesApiPath = `${baseUrl}${CHANGES_API_PATH_STATIC}`;
|
|
11
|
+
|
|
9
12
|
const connector = merge({}, ObjectStorageConnector, {
|
|
10
13
|
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
11
14
|
storage: {
|
|
@@ -33,7 +36,7 @@ const connector = merge({}, ObjectStorageConnector, {
|
|
|
33
36
|
additionalChangeInfo
|
|
34
37
|
};
|
|
35
38
|
|
|
36
|
-
return fetch(
|
|
39
|
+
return fetch(changesApiPath, {
|
|
37
40
|
method: 'POST',
|
|
38
41
|
body: JSON.stringify(body, null, 2),
|
|
39
42
|
headers: {
|
|
@@ -50,7 +53,7 @@ const connector = merge({}, ObjectStorageConnector, {
|
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
return fetch(
|
|
56
|
+
return fetch(changesApiPath, {
|
|
54
57
|
method: 'DELETE',
|
|
55
58
|
body: JSON.stringify({ fileName: key }),
|
|
56
59
|
headers: {
|
|
@@ -65,7 +68,7 @@ const connector = merge({}, ObjectStorageConnector, {
|
|
|
65
68
|
// not implemented
|
|
66
69
|
},
|
|
67
70
|
getItems: async function () {
|
|
68
|
-
const response = await fetch(
|
|
71
|
+
const response = await fetch(changesApiPath, {
|
|
69
72
|
method: 'GET',
|
|
70
73
|
headers: {
|
|
71
74
|
'content-type': 'application/json'
|
|
@@ -4,8 +4,11 @@ sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "../uti
|
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const getAdditionalChangeInfo = ___utils_additional_change_info["getAdditionalChangeInfo"];
|
|
7
|
-
const
|
|
7
|
+
const CHANGES_API_PATH_STATIC = ___common["CHANGES_API_PATH"];
|
|
8
8
|
const getFlexSettings = ___common["getFlexSettings"];
|
|
9
|
+
const baseUrl = document.getElementById('sap-ui-bootstrap')?.dataset.openUxPreviewBaseUrl ?? '';
|
|
10
|
+
const changesApiPath = `${baseUrl}${CHANGES_API_PATH_STATIC}`;
|
|
11
|
+
|
|
9
12
|
/**
|
|
10
13
|
* Processes an array of FlexChange objects.
|
|
11
14
|
* It updates each change object with settings and sends them to a API endpoint.
|
|
@@ -32,7 +35,7 @@ sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "../uti
|
|
|
32
35
|
change,
|
|
33
36
|
additionalChangeInfo
|
|
34
37
|
};
|
|
35
|
-
return fetch(
|
|
38
|
+
return fetch(changesApiPath, {
|
|
36
39
|
method: 'POST',
|
|
37
40
|
body: JSON.stringify(body, null, 2),
|
|
38
41
|
headers: {
|
|
@@ -50,7 +53,7 @@ sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "../uti
|
|
|
50
53
|
*/
|
|
51
54
|
async function loadChanges(...args) {
|
|
52
55
|
const lrep = new LrepConnector();
|
|
53
|
-
const response = await fetch(
|
|
56
|
+
const response = await fetch(changesApiPath, {
|
|
54
57
|
method: 'GET',
|
|
55
58
|
headers: {
|
|
56
59
|
'content-type': 'application/json'
|
|
@@ -3,7 +3,7 @@ import FakeLrepConnector from 'sap/ui/fl/FakeLrepConnector';
|
|
|
3
3
|
import { getAdditionalChangeInfo } from '../utils/additional-change-info';
|
|
4
4
|
|
|
5
5
|
import type { FlexChange } from './common';
|
|
6
|
-
import { CHANGES_API_PATH, getFlexSettings } from './common';
|
|
6
|
+
import { CHANGES_API_PATH as CHANGES_API_PATH_STATIC, getFlexSettings } from './common';
|
|
7
7
|
|
|
8
8
|
interface FetchedChanges {
|
|
9
9
|
[key: string]: FlexChange;
|
|
@@ -23,6 +23,9 @@ interface LoadChangesResult {
|
|
|
23
23
|
messagebundle: string | undefined;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
const baseUrl = document.getElementById('sap-ui-bootstrap')?.dataset.openUxPreviewBaseUrl ?? '';
|
|
27
|
+
const changesApiPath = `${baseUrl}${CHANGES_API_PATH_STATIC}`;
|
|
28
|
+
|
|
26
29
|
/**
|
|
27
30
|
* Processes an array of FlexChange objects.
|
|
28
31
|
* It updates each change object with settings and sends them to a API endpoint.
|
|
@@ -55,7 +58,7 @@ export async function create(changes: FlexChange | FlexChange[]): Promise<void>
|
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
|
|
58
|
-
return fetch(
|
|
61
|
+
return fetch(changesApiPath, {
|
|
59
62
|
method: 'POST',
|
|
60
63
|
body: JSON.stringify(body, null, 2),
|
|
61
64
|
headers: {
|
|
@@ -75,7 +78,7 @@ export async function create(changes: FlexChange | FlexChange[]): Promise<void>
|
|
|
75
78
|
export async function loadChanges(...args: []): Promise<LoadChangesResult> {
|
|
76
79
|
const lrep = new LrepConnector();
|
|
77
80
|
|
|
78
|
-
const response = await fetch(
|
|
81
|
+
const response = await fetch(changesApiPath, {
|
|
79
82
|
method: 'GET',
|
|
80
83
|
headers: {
|
|
81
84
|
'content-type': 'application/json'
|
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.
|
|
12
|
+
"version": "0.23.100",
|
|
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.45",
|
|
31
30
|
"@sap-ux/btp-utils": "1.1.6",
|
|
32
31
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.7.9",
|
|
33
|
-
"@sap-ux/
|
|
32
|
+
"@sap-ux/adp-tooling": "0.18.45",
|
|
34
33
|
"@sap-ux/logger": "0.8.0",
|
|
35
34
|
"@sap-ux/project-access": "1.34.2",
|
|
35
|
+
"@sap-ux/feature-toggle": "0.3.5",
|
|
36
36
|
"@sap-ux/system-access": "0.6.43",
|
|
37
37
|
"@sap-ux/i18n": "0.3.7"
|
|
38
38
|
},
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"nock": "13.4.0",
|
|
54
54
|
"npm-run-all2": "6.2.0",
|
|
55
55
|
"supertest": "7.1.4",
|
|
56
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.18.
|
|
56
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.18.12",
|
|
57
57
|
"@sap-ux/axios-extension": "1.25.7",
|
|
58
58
|
"@sap-ux/store": "1.5.1",
|
|
59
59
|
"@sap-ux/ui5-info": "0.13.8"
|
package/templates/flp/cdm.ejs
CHANGED
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
for productive scenarios.
|
|
25
25
|
-->
|
|
26
26
|
|
|
27
|
-
<script type="text/javascript">
|
|
28
|
-
window["data-open-ux-preview-basePath"] = "<%- basePath %>";
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
27
|
<!-- Bootstrap the UI5 core library. 'data-sap-ui-frameOptions="allow"' is a NON-SECURE setting for test environments -->
|
|
32
28
|
<script id="sap-ui-bootstrap"
|
|
33
29
|
src="<%- basePath %>/resources/sap-ui-core.js"
|
|
@@ -49,6 +45,7 @@
|
|
|
49
45
|
data-open-ux-preview-features='<%- JSON.stringify(features) %>'
|
|
50
46
|
data-open-ux-preview-flex-settings='<%- JSON.stringify(flexSettings) %>'<% } if (locals.locateReuseLibsScript) { %>
|
|
51
47
|
data-open-ux-preview-libs-manifests='<%- JSON.stringify(Object.values(apps).map(app => app.url)) %>'<% } %>
|
|
48
|
+
data-open-ux-preview-base-url='<%- baseUrl %>'
|
|
52
49
|
data-open-ux-preview-enhanced-homepage='true'>
|
|
53
50
|
</script>
|
|
54
51
|
|
package/templates/flp/editor.ejs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
13
|
-
<div id="root"></div>
|
|
13
|
+
<div id="root" data-open-ux-preview-base-url="<%- baseUrl %>"></div>
|
|
14
14
|
<script type="module">
|
|
15
15
|
import { start } from './editor/app.js';
|
|
16
16
|
start({
|
|
@@ -40,10 +40,6 @@
|
|
|
40
40
|
};
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
|
-
<script type="text/javascript">
|
|
44
|
-
window["data-open-ux-preview-basePath"] = "<%- basePath %>";
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
43
|
<script src="<%- basePath %>/test-resources/sap/ushell/bootstrap/sandbox.js" id="sap-ushell-bootstrap"></script>
|
|
48
44
|
<!-- Bootstrap the UI5 core library. 'data-sap-ui-frameOptions="allow"' is a NON-SECURE setting for test environments -->
|
|
49
45
|
<script id="sap-ui-bootstrap"
|
|
@@ -65,7 +61,8 @@
|
|
|
65
61
|
data-open-ux-preview-custom-init='<%- init %>'<% } if (locals.flexSettings) { %>
|
|
66
62
|
data-open-ux-preview-features='<%- JSON.stringify(features) %>'
|
|
67
63
|
data-open-ux-preview-flex-settings='<%- JSON.stringify(flexSettings) %>'<% } if (locals.locateReuseLibsScript) { %>
|
|
68
|
-
data-open-ux-preview-libs-manifests='<%- JSON.stringify(Object.values(apps).map(app => app.url)) %>'<% }
|
|
64
|
+
data-open-ux-preview-libs-manifests='<%- JSON.stringify(Object.values(apps).map(app => app.url)) %>'<% } %>
|
|
65
|
+
data-open-ux-preview-base-url='<%- baseUrl %>'>
|
|
69
66
|
</script>
|
|
70
67
|
|
|
71
68
|
<% if (locals.flexSettings && flexSettings?.developerMode) { %>
|
|
@@ -40,10 +40,6 @@
|
|
|
40
40
|
};
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
|
-
<script type="text/javascript">
|
|
44
|
-
window["data-open-ux-preview-basePath"] = "<%- basePath %>";
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
43
|
<script src="<%- basePath %>/resources/sap/ushell/bootstrap/sandbox2.js" id="sap-ushell-bootstrap"></script>
|
|
48
44
|
<!-- Bootstrap the UI5 core library. 'data-sap-ui-frameOptions="allow"' is a NON-SECURE setting for test environments -->
|
|
49
45
|
<script id="sap-ui-bootstrap"
|
|
@@ -63,7 +59,8 @@
|
|
|
63
59
|
data-open-ux-preview-custom-init='<%- init %>'<% } if (locals.flexSettings) { %>
|
|
64
60
|
data-open-ux-preview-features='<%- JSON.stringify(features) %>'
|
|
65
61
|
data-open-ux-preview-flex-settings='<%- JSON.stringify(flexSettings) %>'<% } if (locals.locateReuseLibsScript) { %>
|
|
66
|
-
data-open-ux-preview-libs-manifests='<%- JSON.stringify(Object.values(apps).map(app => app.url)) %>'<% }
|
|
62
|
+
data-open-ux-preview-libs-manifests='<%- JSON.stringify(Object.values(apps).map(app => app.url)) %>'<% } %>
|
|
63
|
+
data-open-ux-preview-base-url='<%- baseUrl %>'>
|
|
67
64
|
</script>
|
|
68
65
|
|
|
69
66
|
<% if (locals.flexSettings && flexSettings?.developerMode) { %>
|