@sapui5/sap.ushell_abap 1.146.0 → 1.147.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.
Files changed (61) hide show
  1. package/package.json +4 -4
  2. package/src/main/js/sap/ushell_abap/.library +1 -1
  3. package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +4 -5
  4. package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +1 -1
  5. package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +10 -8
  6. package/src/main/js/sap/ushell_abap/adapters/abap/CommonDataModelAdapter.js +1 -1
  7. package/src/main/js/sap/ushell_abap/adapters/abap/ConfigurationDefaultsAdapter.js +7 -4
  8. package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +8 -10
  9. package/src/main/js/sap/ushell_abap/adapters/abap/FlpLaunchPageAdapter.js +148 -109
  10. package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.js +1 -1
  11. package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionAdapter.js +1 -1
  12. package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionInternalAdapter.js +1 -1
  13. package/src/main/js/sap/ushell_abap/adapters/abap/PageBuildingAdapter.js +1 -1
  14. package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +1 -1
  15. package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +1 -1
  16. package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationV2Adapter.js +1 -1
  17. package/src/main/js/sap/ushell_abap/adapters/abap/SearchAdapter.js +1 -1
  18. package/src/main/js/sap/ushell_abap/adapters/abap/SupportTicketAdapter.js +1 -1
  19. package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +1 -1
  20. package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +1 -1
  21. package/src/main/js/sap/ushell_abap/bootstrap/BootTask/PrepareDirectAppStart.js +20 -0
  22. package/src/main/js/sap/ushell_abap/bootstrap/BootTask/RequestGroups.js +51 -0
  23. package/src/main/js/sap/ushell_abap/bootstrap/BootTask/RequestTargetMappings.js +29 -0
  24. package/src/main/js/sap/ushell_abap/bootstrap/BootTask.js +47 -0
  25. package/src/main/js/sap/ushell_abap/bootstrap/ConfigurationProvider.js +87 -0
  26. package/src/main/js/sap/ushell_abap/bootstrap/DirectAppStart.js +231 -0
  27. package/src/main/js/sap/ushell_abap/bootstrap/LoadLaunchpad/CreateRenderer.js +43 -0
  28. package/src/main/js/sap/ushell_abap/bootstrap/LoadLaunchpad/InitXhrLogon.js +148 -0
  29. package/src/main/js/sap/ushell_abap/bootstrap/LoadLaunchpad/RequestPages.js +86 -0
  30. package/src/main/js/sap/ushell_abap/bootstrap/LoadLaunchpad.js +63 -0
  31. package/src/main/js/sap/ushell_abap/bootstrap/LoadLaunchpadModule.js +11 -0
  32. package/src/main/js/sap/ushell_abap/bootstrap/PageSetsRequestHandler.js +247 -0
  33. package/src/main/js/sap/ushell_abap/bootstrap/PlatformConfig.js +385 -0
  34. package/src/main/js/sap/ushell_abap/bootstrap/{evo/SAPCompanionConditionSetter.js → SAPCompanionConditionSetter.js} +6 -4
  35. package/src/main/js/sap/ushell_abap/bootstrap/StartupRequestHandler.js +145 -0
  36. package/src/main/js/sap/ushell_abap/bootstrap/ThemeHandler.js +276 -0
  37. package/src/main/js/sap/ushell_abap/bootstrap/XhrFactory.js +69 -0
  38. package/src/main/js/sap/ushell_abap/bootstrap/{evo/XhrLogonEventHandler.js → XhrLogonEventHandler.js} +13 -7
  39. package/src/main/js/sap/ushell_abap/bootstrap/XhrLogonLibLoader.js +51 -0
  40. package/src/main/js/sap/ushell_abap/bootstrap/abap-def-dev.js +20 -0
  41. package/src/main/js/sap/ushell_abap/bootstrap/{evo/abap-def-loader.js → abap-def-loader.js} +2 -2
  42. package/src/main/js/sap/ushell_abap/bootstrap/abap-def.js +22 -0
  43. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.js +1 -1
  44. package/src/main/js/sap/ushell_abap/components/TCodeNavigation.js +3 -3
  45. package/src/main/js/sap/ushell_abap/library.js +1 -1
  46. package/src/main/js/sap/ushell_abap/pbServices/ui2/Contracts.js +33 -0
  47. package/ui5.yaml +7 -6
  48. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def-dev.js +0 -42
  49. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def.js +0 -45
  50. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils.js +0 -172
  51. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.theme.js +0 -28
  52. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.ushell.js +0 -181
  53. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.load.launchpad.js +0 -72
  54. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.pageset.js +0 -219
  55. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.startup.js +0 -154
  56. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.theme.handler.js +0 -79
  57. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.xhrlogon.LibLoader.js +0 -21
  58. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.xhrlogon.configure.js +0 -62
  59. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.xhrlogon.handler.js +0 -82
  60. package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +0 -944
  61. /package/src/main/js/sap/ushell_abap/bootstrap/{evo/abap.constants.js → abapConstants.js} +0 -0
@@ -1,944 +0,0 @@
1
- // Copyright (c) 2009-2026 SAP SE, All Rights Reserved
2
-
3
- sap.ui.define([
4
- "sap/ushell_abap/bootstrap/evo/abap.xhrlogon.LibLoader",
5
- "sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils",
6
- "sap/ushell_abap/bootstrap/evo/abap.request.startup",
7
- "sap/ushell_abap/bootstrap/evo/abap.request.pageset",
8
- "sap/ushell_abap/bootstrap/evo/abap.xhrlogon.handler",
9
- "sap/ushell_abap/bootstrap/evo/abap.theme.handler",
10
- "sap/ushell/EventHub",
11
- "sap/ui/performance/trace/initTraces",
12
- "sap/base/util/ObjectPath",
13
- "sap/base/Log",
14
- "sap/ushell_abap/pbServices/ui2/Utils",
15
- "sap/ushell/bootstrap/common/common.util",
16
- "sap/ushell_abap/bootstrap/evo/SAPCompanionConditionSetter",
17
- "sap/ushell/utils/UrlParsing"
18
- ], (
19
- abapXhrlogonLibLoader,
20
- abapBootstrapUtils,
21
- abapRequestStartup,
22
- abapRequestPageset,
23
- abapXhrlogonHandler,
24
- abapThemeHandler,
25
- EventHub,
26
- initTraces,
27
- ObjectPath,
28
- Log,
29
- ui2Utils,
30
- commonUtils,
31
- SAPCompanionConditionSetter,
32
- UrlParsing
33
- ) => {
34
- "use strict";
35
-
36
- const oBoottask = {};
37
-
38
- const rShellHash = new RegExp("^(#)?([A-Za-z0-9_]+)-([A-Za-z0-9_]+)");
39
- let sSystemThemeRoot; // theme root - provided by startup service or fallback
40
- let oStartupTheme; // theme from startup service
41
-
42
- //**************************************
43
- // function for operation with hash and url
44
- //
45
- // URLParsing service could not used because some functional need before Container is created
46
- //
47
- // TODO: move to ushell or separate module or find other solution
48
- //**************************************
49
-
50
- /**
51
- * Determines whether an application
52
- * direct start is occurring.
53
- *
54
- * The root intent (e.g., #Shell-home) will
55
- * not determine a direct start condition.
56
- *
57
- * @param {string} sHash the hash
58
- *
59
- * @returns {boolean} if it is a direct start
60
- * @private
61
- */
62
- function isDirectStart (sHash) {
63
- /**
64
- * Determine whether sHash is a standalone hash.
65
- * In this case, the hash is not set as initial target for the start_up service.
66
- *
67
- * @param {string} sCurrentHash
68
- * URL parameter name
69
- * @returns {boolean} if it is a standalone hash
70
- * @private
71
- */
72
- function isStandaloneHash (sCurrentHash) {
73
- if (!sCurrentHash) {
74
- return false;
75
- }
76
- return sCurrentHash.indexOf("Shell-home") === 0
77
- || sCurrentHash.indexOf("Launchpad-openFLPPage") === 0
78
- || sCurrentHash.indexOf("Shell-appfinder") === 0
79
- || sCurrentHash.indexOf("Shell-catalog") === 0
80
- || sCurrentHash.indexOf("shell-catalog") === 0
81
- || sCurrentHash.indexOf("Action-search") === 0;
82
- }
83
-
84
- /**
85
- * We allow to switch off the initial target resolution via configuration; use case is
86
- * SAP Fiori launchpad designer which bootstraps the ushell,
87
- * but uses non-standard URL hashes; start_up service performance is very bad if target
88
- * cannot be resolved; see internal CSN 0000796004 2014
89
- *
90
- * @returns {boolean} <code>true</code>, if window['sap-ushell_abap-bootstrap-abap-noInitialTarget']
91
- * is set to any value
92
- */
93
- function isNoInitialTargetResolution () {
94
- return window["sap-ushell_abap-bootstrap-abap-noInitialTarget"] !== undefined;
95
- }
96
-
97
- const oMatch = sHash.match(rShellHash);
98
- const sSemanticObject = oMatch && oMatch[2];
99
- const sAction = oMatch && oMatch[3];
100
- const bIsDirectStart = sHash && !isStandaloneHash(sHash) && !isNoInitialTargetResolution() && sSemanticObject && sAction;
101
- return bIsDirectStart;
102
- }
103
-
104
- /**
105
- * Returns the shell hash which is the part of the URL fragment which determines the
106
- * navigation for the shell. If the URL fragment does not exist or is empty, an empty
107
- * string is returned.
108
- *
109
- * @returns {string}
110
- * the shell hash
111
- *
112
- * @private
113
- */
114
- // TODO Refactor: Align with URLParsing.getShellHash
115
- function getFullShellHash () {
116
- const sHref = abapBootstrapUtils.getLocationHref();
117
- const iHashIndex = sHref.indexOf("#");
118
- if (iHashIndex < 0) {
119
- return "";
120
- }
121
- // decode hash: identical behavior to ShellNavigationInternal.hrefForExternal
122
- const sHashDecoded = decodeURI(sHref.slice(iHashIndex + 1));
123
- return sHashDecoded;
124
- }
125
-
126
- function getShellHash () {
127
- const sHashDecoded = getFullShellHash();
128
- const iAppStateIndex = sHashDecoded.indexOf("&/");
129
- return iAppStateIndex < 0 ? sHashDecoded : sHashDecoded.slice(0, iAppStateIndex);
130
- }
131
-
132
- function getContainer () {
133
- return sap.ui.require("sap/ushell/Container");
134
- }
135
- /**
136
- * Returns the parsed shell hash
137
- *
138
- * @returns {object} with properties <code>semanticObject</code> and <code>action</code>
139
- *
140
- * @private
141
- */
142
- // TODO Refactor: Align with URLParsing.getShellHash
143
- function getParsedShellHash (sHash) {
144
- const oMatch = sHash.match(rShellHash);
145
- return oMatch ? { semanticObject: oMatch[2], action: oMatch[3] } : undefined;
146
- }
147
-
148
- /**
149
- * Determine whether sHash is a hash which loads the home page; in this case
150
- * some OData requests are triggered early for performance optimization
151
- *
152
- * @param {string} sHash
153
- * URL parameter name
154
- * @returns {boolean}
155
- * Return true if home page or catalog
156
- * @private
157
- */
158
- function isHomepageHash (sHash) {
159
- if (!sHash || sHash === "#") {
160
- return true;
161
- }
162
- return (sHash.indexOf("Shell-home") === 0)
163
- || (sHash.indexOf("Launchpad-openFLPPage") === 0)
164
- || (sHash.indexOf("Shell-appfinder") === 0)
165
- || (sHash.indexOf("Shell-catalog") === 0)
166
- || (sHash.indexOf("shell-catalog") === 0);
167
- }
168
-
169
- //**************************************
170
- // end function for operation with hash and url
171
- //**************************************
172
-
173
- /**
174
- * Clone a JSON object.
175
- *
176
- * @param {object} oObject to clone
177
- * @returns {object} copy of the input object
178
- *
179
- * @private
180
- */
181
- function clone (oObject) {
182
- if (oObject === undefined) {
183
- return undefined;
184
- }
185
- try {
186
- return JSON.parse(JSON.stringify(oObject));
187
- } catch (oError) {
188
- Log.error(
189
- "Could not clone object",
190
- oError,
191
- "sap.ushell_abap.bootstrap"
192
- );
193
- return undefined;
194
- }
195
- }
196
-
197
- /**
198
- * Determines if a theme is a SAP theme
199
- * @param {string} sTheme
200
- * Theme to be tested
201
- * @returns {boolean}
202
- * <code>true</code> if the theme is an SAP theme
203
- * @private
204
- */
205
- function isSapTheme (sTheme) {
206
- return sTheme.indexOf("sap_") === 0;
207
- }
208
-
209
- /**
210
- * Sets the given language and format settings in SAPUI5.
211
- *
212
- * @param {object} [oSettings] the options (may be undefined when nothing to apply)
213
- * @param {string} [oSettings.language] the language
214
- * @param {string} [oSettings.legacyDateFormat] the date format
215
- * @param {string} [oSettings.legacyNumberFormat] the number format
216
- * @param {string} [oSettings.legacyTimeFormat] the time format
217
- * @param {object} [oCurrencyFormats] Currency Format Information
218
- * @param {string} [sTimeZoneIana] IANA timezone
219
- *
220
- * @private
221
- */
222
- function setSapui5Settings (oSettings, oCurrencyFormats) {
223
- Log.debug("setSapui5Settings()", JSON.stringify(oSettings), "sap.ushell_abap.bootstrap.abap");
224
-
225
- const Formatting = sap.ui.require("sap/base/i18n/Formatting");
226
- const Localization = sap.ui.require("sap/base/i18n/Localization");
227
-
228
- if (oSettings.language) {
229
- Localization.setLanguage(oSettings.language, oSettings.ABAPLanguage);
230
- }
231
- if (oSettings.legacyDateFormat) {
232
- Formatting.setABAPDateFormat(oSettings.legacyDateFormat);
233
- }
234
- if (oSettings.legacyDateCalendarCustomizing) {
235
- Formatting.setCustomIslamicCalendarData(oSettings.legacyDateCalendarCustomizing);
236
- }
237
- if (oSettings.legacyNumberFormat) {
238
- Formatting.setABAPNumberFormat(oSettings.legacyNumberFormat);
239
- }
240
- if (oSettings.legacyTimeFormat) {
241
- Formatting.setABAPTimeFormat(oSettings.legacyTimeFormat);
242
- }
243
- // Copy currency formats, if provided, to the UI5 custom currencies format settings
244
- if (typeof oCurrencyFormats === "object") {
245
- Formatting.addCustomCurrencies(oCurrencyFormats);
246
- }
247
-
248
- if (oSettings.useTimeZoneIana && oSettings.timeZoneIana !== "") {
249
- Localization.setTimezone(oSettings.timeZoneIana);
250
- }
251
- }
252
-
253
- /**
254
- * determine a theme from the startup result, propagating it into the configuration
255
- * at window["sap-ushell-config"].services.Container.adapter.config.bootTheme
256
- *
257
- * @param {object} oBootTheme the parsed response of the start-up service call
258
- *
259
- * @private
260
- */
261
- function copyThemeToContainerAdapterConfig (oBootTheme) {
262
- (ObjectPath.get("sap-ushell-config.services.Container.adapter.config") || ObjectPath.create("sap-ushell-config.services.Container.adapter.config")).bootTheme = clone(oBootTheme);
263
- }
264
-
265
- /**
266
- * Extracts the theme root from the startup service result or fall back
267
- * @param {object} oStartupServiceResult the startup service result
268
- * @returns {string} the system theme root
269
- *
270
- * @private
271
- */
272
- function extractSystemThemeRoot (oStartupServiceResult) {
273
- if (!oStartupServiceResult) {
274
- Log.error("extractSystemThemeRoot: mandatory parameter oStartupServiceResult not supplied");
275
- }
276
- if (oStartupServiceResult.themeRoot) {
277
- // we expect that theme root is supplied by the startup service
278
- return oStartupServiceResult.themeRoot;
279
- }
280
- if (oStartupServiceResult.client) {
281
- // fallback
282
- Log.warning(
283
- "Theme root was not contained in startup service result. A fallback to /sap/public/bc/themes/~client-<client number> is used",
284
- null,
285
- "sap.ushell_abap.bootstrap"
286
- );
287
- return `/sap/public/bc/themes/~client-${oStartupServiceResult.client}`;
288
- }
289
- Log.error("extractSystemThemeRoot: Could not determine system theme root");
290
- }
291
-
292
- /**
293
- * Extracts the theme from the startup service result
294
- * @param {object} oStartupServiceResult startup service result
295
- * @returns {string} the theme or undefined
296
- *
297
- * @private
298
- */
299
- function extractThemeFromStartupServiceResult (oStartupServiceResult) {
300
- let aProperties;
301
- let oThemeData;
302
-
303
- if (oStartupServiceResult && oStartupServiceResult.userProfile && oStartupServiceResult.userProfile.filter) {
304
- aProperties = oStartupServiceResult.userProfile.filter((obj) => {
305
- return obj.id === "THEME";
306
- });
307
- oThemeData = aProperties.length ? aProperties[0] : {};
308
- if (oThemeData.value) {
309
- return oThemeData.value; // this is the one we expect
310
- }
311
- }
312
- if (oStartupServiceResult && oStartupServiceResult.theme) {
313
- return oStartupServiceResult.theme; // fallback to system default theme
314
- }
315
- return ""; // fallback
316
- }
317
-
318
- /**
319
- * Determines the theme root for the given theme.
320
- * In case the theme begins with sap_ we assume that it is a theme provided by sap and therefore
321
- * theme root is set to "". The theme is then loaded by the UI5 http handler. This is necessary
322
- * as the theming infrastructure is not mandatory and therefore it cannot be ensured that the
323
- * http handler of the theming infrastructure is running.
324
- * @param {string} sTheme theme
325
- * @param {string} sSystemThemeRoot system theme root
326
- * @returns {string} theme root for the given theme
327
- *
328
- * @private
329
- */
330
- function determineThemeRoot (sTheme, sSystemThemeRoot) {
331
- if (sTheme && isSapTheme(sTheme)) {
332
- // SAP theme
333
- return "";
334
- }
335
- return sSystemThemeRoot;
336
- }
337
-
338
- /**
339
- * Determines the startup theme.
340
- * Assumption: The theme returned in the startup service does not have a root.
341
- * It is only the theme name!
342
- * The theme root is amended here in.
343
- * @param {string} oStartupServiceResult startup theme
344
- * @param {string} sSystemThemeRoot system theme root
345
- * @returns {object} theme root for the startup theme
346
- *
347
- * @private
348
- */
349
- function determineStartupTheme (oStartupServiceResult, sSystemThemeRoot) {
350
- const sTheme = extractThemeFromStartupServiceResult(oStartupServiceResult);
351
- return {
352
- theme: sTheme,
353
- root: determineThemeRoot(sTheme, sSystemThemeRoot)
354
- };
355
- }
356
-
357
- /**
358
- * Extracts the theme from the URL and determines the theme root
359
- *
360
- * @param {string} sSystemThemeRoot
361
- * the system theme root, as determined by the startup service
362
- *
363
- * @returns {object} contains the theme and the theme root, undefined if no URL theme supplied
364
- *
365
- * @private
366
- */
367
- function determineUrlTheme (sSystemThemeRoot) {
368
- let aThemeParts;
369
-
370
- const sThemeUrlParameter = abapBootstrapUtils.getUrlParameterValue("sap-theme") || abapBootstrapUtils.getUrlParameterValue("sap-ui-theme");
371
- if (sThemeUrlParameter) {
372
- if (sThemeUrlParameter.indexOf("@") > 0) {
373
- aThemeParts = sThemeUrlParameter.split("@", 2);
374
- return {
375
- theme: aThemeParts[0],
376
- root: aThemeParts[1]
377
- };
378
- }
379
- // no theme root supplied
380
- return {
381
- theme: sThemeUrlParameter,
382
- root: determineThemeRoot(sThemeUrlParameter, sSystemThemeRoot)
383
- };
384
- }
385
- return undefined;
386
- }
387
-
388
- /**
389
- * Returns value of "sap-theme" URL parameter
390
- * @returns {string|undefined} Theme as given via "sap-theme" URL parameter
391
- *
392
- * @private
393
- */
394
- function getSapThemeUrlParameter () {
395
- const oParameterMap = ui2Utils.getParameterMap();
396
- return oParameterMap["sap-theme"]?.[0] || oParameterMap["sap-ui-theme"]?.[0];
397
- }
398
-
399
- /**
400
- * Checks if a theme string is evaluated safe from an FLP perspective.
401
- *
402
- * Returns true if the theme root is not given in the theme string passed on entry,
403
- * or if the theme root has no origin.
404
- *
405
- * Returns false if a theme root is given and its origin is not listed in the
406
- * <code><meta name="sap-allowed-theme-origins" ...></code> meta tag
407
- *
408
- * Returns false if a theme root with origin is given, but no
409
- * <code><meta name="sap-allowed-theme-origins" ...></code> tag is available
410
- * to check against.
411
- *
412
- * @param {string} theme Theme string: <theme ID> or <theme ID>@<theme root>
413
- * @returns {boolean} <code>true</code>, <code>false</code>
414
- * <code>true</code> if the theme is safe.
415
- * <code>false</code> if the allowlist check of the theme root origin against the
416
- * meta tag failed or if an allowlist check of the theme origin was not
417
- * performed because no allowlist was given.
418
- *
419
- * @private
420
- */
421
- function isThemeSafe (theme) {
422
- // Analyze theme string
423
- const sTheme = theme;
424
- const iIndex = theme.indexOf("@");
425
- if (iIndex >= 0) {
426
- const sThemeRoot = sTheme.slice(iIndex + 1);
427
- return abapThemeHandler.isThemeRootSafe(sThemeRoot);
428
- }
429
- return true;
430
- }
431
-
432
- /**
433
- * Process themes
434
- *
435
- * @param {object} oStartupTheme
436
- * the theme from the startup service
437
- * @param {string} sSystemThemeRoot
438
- * the system theme root, as determined by the startup service
439
- *
440
- * @returns {object} oBootTheme
441
- * @private
442
- */
443
- function processTheme (oStartupTheme, sSystemThemeRoot) {
444
- let oUrlTheme;
445
- const oHtmlTheme = {};
446
- let oBootTheme;
447
- const sUrlTheme = getSapThemeUrlParameter();
448
-
449
- if (sUrlTheme && isThemeSafe(sUrlTheme)) { // URL = prio 1
450
- oUrlTheme = determineUrlTheme(sSystemThemeRoot);
451
- oBootTheme = oUrlTheme;
452
- Log.debug(`theme: URL theme = "${oBootTheme.theme}" theme root = "${oBootTheme.root}"`, null, "sap.ushell_abap.bootstrap");
453
- } else if (oStartupTheme) { // startup theme = prio 2
454
- oBootTheme = oStartupTheme;
455
- Log.debug(`theme: startup service theme = "${oBootTheme.theme}" theme root = "${oBootTheme.root}"`, null, "sap.ushell_abap.bootstrap");
456
- // If the theme is provided in the url and the theme origin is not in "sap-allowed-theme-origins" meta tag,
457
- // switch to the theme from userParameters because ui5 core does not do such a switch itself.
458
- if (sUrlTheme) {
459
- const sTheme = oBootTheme.theme;
460
- // replace unsafe url theme theme only after the core is ready
461
- sap.ui.require("sap/ui/core/Core").ready(() => sap.ui.require("sap/ui/core/Theming").setTheme(sTheme));
462
- }
463
- } else { // html file theme = prio 3
464
- // set via e.g. data-sap-ui-theme="sap_horizon" as part of UI5 startup in the central
465
- // Fiori launchpad html file
466
- oHtmlTheme.theme = ObjectPath.get("sap-ui-config.theme");
467
- // could be the URL theme; no problem
468
- // Assumption: no theme root included here
469
- if (oHtmlTheme.theme) {
470
- oHtmlTheme.root = ObjectPath.get(`sap-ui-config.themeRoots.${oHtmlTheme.theme}` || "");
471
- if (!oHtmlTheme.root) {
472
- oHtmlTheme.root = determineThemeRoot(oHtmlTheme.theme, sSystemThemeRoot);
473
- }
474
- oBootTheme = {
475
- theme: oHtmlTheme.theme,
476
- root: oHtmlTheme.root
477
- };
478
- Log.debug(`theme: html file theme = "${oBootTheme.theme}" theme root = "${oBootTheme.root}"`, null, "sap.ushell_abap.bootstrap");
479
- } else {
480
- oBootTheme = {
481
- theme: "",
482
- root: ""
483
- };
484
- Log.error("Could not determine theme", null, "sap.ushell_abap.bootstrap");
485
- }
486
- }
487
- copyThemeToContainerAdapterConfig(oBootTheme);
488
- return oBootTheme;
489
- }
490
-
491
- /**
492
- * Processes the result of the Context independent
493
- * configuration results (part of the FioriLaunchpad.html response)
494
- *
495
- *
496
- * @param {object} oStartupResult
497
- * the result as a JSON object
498
- */
499
- function processStartup (oStartupResult) {
500
- const mParameterMap = ui2Utils.getParameterMap();
501
- const sRequestLocale = abapBootstrapUtils.getUrlParameterValue("sap-locale", mParameterMap);
502
- const oUshellConfig = {
503
- services: {}
504
- };
505
-
506
- // write the support ticket service enablement to the bootstrap config;
507
- // do not enable if already disabled, but disable if not available in backend
508
- const vSupportTicketEnabled = ObjectPath.get("sap-ushell-config.services.SupportTicket.config.enabled");
509
- if (vSupportTicketEnabled !== false) {
510
- oUshellConfig.services.SupportTicket = {
511
- config: {
512
- enabled: oStartupResult.isEmbReportingActive === true
513
- }
514
- };
515
- }
516
-
517
- // we just copy the setting of the startupResult to the bootstrap configuration
518
- // startup result might have been adjusted with fallback URL
519
- oUshellConfig.services.ClientSideTargetResolution = {
520
- adapter: {
521
- config: {
522
- services: {
523
- targetMappings: oStartupResult?.services?.targetMappings
524
- }
525
- }
526
- }
527
- };
528
-
529
- // the same settings must be copied also in the LaunchPage adapter
530
- // configuration as long as OData requests to target mappings are being
531
- // made in there.
532
- oUshellConfig.services.LaunchPage = {
533
- adapter: {
534
- config: {
535
- services: {
536
- targetMappings: oStartupResult?.services?.targetMappings,
537
- launchPage: oStartupResult?.services?.pbFioriHome
538
- }
539
- }
540
- }
541
- };
542
-
543
- // the same LaunchPage settings must be copied to the VisualizationDataProvider
544
- // configuration as it uses the LaunchPage adapter inside.
545
- oUshellConfig.services.VisualizationDataProvider = {
546
- adapter: {
547
- module: "sap.ushell_abap.adapters.abap.FlpLaunchPageAdapter",
548
- config: {
549
- services: {
550
- targetMappings: oStartupResult?.services?.targetMappings,
551
- launchPage: oStartupResult?.services?.pbFioriHome
552
- }
553
- }
554
- }
555
- };
556
-
557
- oUshellConfig.services.PageBuilding = {
558
- adapter: {
559
- config: {
560
- services: {
561
- pageBuilding: oStartupResult?.services?.pbFioriHome
562
- }
563
- }
564
- }
565
- };
566
-
567
- // we just copy the setting of the startupResult to the bootstrap configuration
568
- // startup result might have been adjusted with fallback URL
569
- oUshellConfig.services.Personalization = {
570
- adapter: {
571
- config: {
572
- services: {
573
- personalization: oStartupResult?.services?.personalization
574
- }
575
- }
576
- }
577
- };
578
-
579
- let oUi5UserInfo = {};
580
- if (!sRequestLocale) {
581
- oUi5UserInfo = {
582
- language: oStartupResult.languageBcp47 || oStartupResult.language,
583
- ABAPLanguage: oStartupResult.language,
584
- legacyDateFormat: oStartupResult.dateFormat,
585
- legacyDateCalendarCustomizing: oStartupResult.tislcal,
586
- legacyNumberFormat: oStartupResult.numberFormat === "" ? " "
587
- : oStartupResult.numberFormat,
588
- legacyTimeFormat: oStartupResult.timeFormat
589
- };
590
- }
591
-
592
- // IANA Timezone support based on server config
593
- let bTimeZoneIana = ObjectPath.get("sap-ushell-config.ui5.timeZoneFromServerInUI5");
594
- if (bTimeZoneIana === undefined) {
595
- bTimeZoneIana = false;
596
- ObjectPath.set("startupConfig.timeZoneFromServerInUI5", bTimeZoneIana, oUshellConfig);
597
- ObjectPath.set("ushell.ui5.timeZoneFromServerInUI5", bTimeZoneIana);
598
- }
599
- let sTimeZoneIana = ObjectPath.get("sap-ushell-config.startupConfig.timeZone");
600
- if (sTimeZoneIana === undefined) {
601
- sTimeZoneIana = "";
602
- ObjectPath.set("startupConfig.timeZone", sTimeZoneIana, oUshellConfig);
603
- }
604
-
605
- oUi5UserInfo.useTimeZoneIana = bTimeZoneIana;
606
- oUi5UserInfo.timeZoneIana = sTimeZoneIana;
607
-
608
- // migrate configuration and write to global
609
- const oMigrationConfig = commonUtils.getV2ServiceMigrationConfig(oUshellConfig);
610
- commonUtils.mergeConfig(window["sap-ushell-config"], oMigrationConfig, true);
611
- commonUtils.mergeConfig(window["sap-ushell-config"], oUshellConfig, true);
612
-
613
- processTheme(oStartupTheme, sSystemThemeRoot);
614
- setSapui5Settings(oUi5UserInfo, oStartupResult.currencyFormats);
615
- }
616
-
617
- /**
618
- * Processes the result of the Context dependent
619
- * configuration results (part of an explicit start_up call)
620
- * result processing will trigger resolution of the following two
621
- * promises
622
- * a) AppState Service
623
- * services.AppState.config.initialAppStatesPromise
624
- * (initialAppStates : { "<key>" : "value as json"})
625
- * b) ClientSideTargetResolutionAdapter abap
626
- * services.ClientSideTargetResolution.adapter.config.initialSegmentPromise
627
- * {[aSegments], oTargetMappings, oSystems);
628
- * Sends AllCatalogs request if the FLP is started in page mode.
629
- * @param {object} oStartupResult
630
- * the result as a JSON object
631
- */
632
- function processDirectStart (oStartupResult) {
633
- const sHash = oBoottask._getShellHash();
634
- const sFullHash = getFullShellHash();
635
- const oRequestSegment = getParsedShellHash(sHash);
636
- const aSegment = [oRequestSegment];
637
- const oInitialAppStates = {};
638
- const oInitialKeys = {};
639
- let oRequestPromise;
640
-
641
- const oAppStateConfig = ObjectPath.get("sap-ushell-config.services.AppState.config") ||
642
- ObjectPath.create("sap-ushell-config.services.AppState.config");
643
- const oClientTargetResolutionAdapterConfig = ObjectPath.get("sap-ushell-config.services.ClientSideTargetResolution.adapter.config") ||
644
- ObjectPath.create("sap-ushell-config.services.ClientSideTargetResolution.adapter.config");
645
-
646
- function addInitialKey (oRegex, sFullHash) {
647
- const oMatch = sFullHash.match(oRegex);
648
- let aSplit = [];
649
- if (!oMatch) {
650
- return;
651
- }
652
- aSplit = (oMatch[2]).toString().split("=");
653
- oInitialKeys[aSplit[0]] = aSplit[1];
654
- }
655
-
656
- function addInitialAppState (oTarget, oData, oInitialKeys, oParam, oMember) {
657
- if (oData && oData[oMember] && oInitialKeys && oInitialKeys[oParam]) {
658
- oTarget[oInitialKeys[oParam]] = oData[oMember];
659
- }
660
- }
661
-
662
- if (isDirectStart(sHash)) {
663
- addInitialKey(/(\?|&)(sap-xapp-state=[A-Z0-9]+)/, sHash);
664
- addInitialKey(/(\?|&)(sap-intent-param=[A-Z0-9]+)/, sHash);
665
- addInitialKey(/(\?|&)(sap-system=[A-Z0-9]+)/, sHash);
666
- addInitialKey(/(\?|&|[/])(sap-iapp-state=[A-Z0-9]+)/, sFullHash);
667
-
668
- oRequestPromise = abapRequestStartup.requestDirectStart(oStartupResult, oRequestSegment, oInitialKeys);
669
-
670
- oAppStateConfig.initialAppStatesPromise = oRequestPromise.then((oDirectStart) => {
671
- addInitialAppState(oInitialAppStates, oDirectStart, oInitialKeys, "sap-intent-param", "iparState");
672
- addInitialAppState(oInitialAppStates, oDirectStart, oInitialKeys, "sap-iapp-state", "iappState");
673
- addInitialAppState(oInitialAppStates, oDirectStart, oInitialKeys, "sap-xapp-state", "xappState");
674
-
675
- oAppStateConfig.initialAppStates = oInitialAppStates;
676
- return Promise.resolve(oInitialAppStates);
677
- });
678
-
679
- oClientTargetResolutionAdapterConfig.initialSegmentPromise = oRequestPromise.then((oDirectStart) => {
680
- if (oDirectStart.targetMappings) {
681
- return Promise.resolve([aSegment, oDirectStart.targetMappings, oDirectStart.systemAliases, oDirectStart.urlTemplates]);
682
- }
683
- return Promise.resolve(null);
684
- });
685
- } else {
686
- oAppStateConfig.initialAppStatesPromise = Promise.resolve({});
687
- oClientTargetResolutionAdapterConfig.initialSegmentPromise = Promise.resolve(null);
688
- }
689
- }
690
-
691
- /**
692
- * Creates an ECMA6 Promise which resolves after the shell renderer has been created. This
693
- * is necessary to delay the component creation in direct start case, so that the shell renderer
694
- * had time to initialize (e.g. init shell navigation service).
695
- *
696
- * This method must only be called after the shell bootstrap!
697
- * @returns {Promise} A promise to chain following steps.
698
- * @private
699
- */
700
- function createWaitForRendererCreatedPromise () {
701
- const oPromise = new Promise((resolve, reject) => {
702
- let oRenderer;
703
-
704
- function fnOnRendererCreated () {
705
- Log.info("Direct application start: resolving component waitFor promise after shell renderer created event fired.");
706
- resolve();
707
- getContainer().detachRendererCreatedInternal(fnOnRendererCreated);
708
- }
709
-
710
- EventHub.once("ShellNavigationInitialized").do(() => {
711
- oRenderer = getContainer().getRendererInternal();
712
- if (oRenderer) {
713
- Log.info("Direct application start: resolving component waitFor promise immediately (shell renderer already created).");
714
- resolve();
715
- } else {
716
- // the renderer should be created when the shell navigation is initialized, just to but be robust
717
- getContainer().attachRendererCreatedInternal(fnOnRendererCreated);
718
- }
719
- });
720
- });
721
-
722
- return oPromise;
723
- }
724
-
725
- function afterBootstrap () {
726
- SAPCompanionConditionSetter.run().catch(() => {
727
- Log.info("SAPCompanion conditions could not be set.");
728
- });
729
-
730
- let sShellHash = oBoottask._getShellHash();
731
-
732
- if (isHomepageHash(sShellHash) && window["sap-ushell-config"].ushell &&
733
- window["sap-ushell-config"].ushell.spaces && window["sap-ushell-config"].ushell.spaces.enabled) {
734
- oBoottask._loadPage(sShellHash); // earliest point available to load page object
735
- }
736
- abapXhrlogonLibLoader.getLib().then((oXhrLogonLib) => {
737
- const oFrameLogonManager = oXhrLogonLib.FrameLogonManager.getInstance();
738
- getContainer().oFrameLogonManager = oFrameLogonManager;
739
- });
740
-
741
- if (isDirectStart(sShellHash)) { // only set on direct app start (not #Shell-home)
742
- sShellHash = this._getFullShellHash(); // take full hash for direct start
743
-
744
- let fnResolve;
745
- let fnReject;
746
- window["sap-ushell-async-libs-promise-directstart"] = new Promise((resolve, reject) => {
747
- fnResolve = resolve;
748
- fnReject = reject;
749
- });
750
- window["sap-ushell-async-libs-promise-directstart"].catch((oError) => {
751
- Log.error("Direct app start failed", oError, "sap.ushell_abap.bootstrap");
752
- });
753
-
754
- let oPromise = Promise.resolve();
755
- if (sShellHash.includes("sap-ssb-eval-id")) {
756
- // For a Smart Business direct start the parameter sap-ssb-eval-id has to be
757
- // resolved by Smart Business early so that the resolved parameters are already
758
- // passed to the app component during the early component creation.
759
- oPromise = Promise.resolve()
760
- .then(async () => {
761
- const SmartBusiness = await new Promise((resolve, reject) => {
762
- sap.ui.require(["sap/ushell/utils/SmartBusiness"], resolve, reject);
763
- });
764
- // At this early point in time the Smart Business library has not been loaded yet.
765
- // Load it to avoid single file requests.
766
- // On ABAP, the path where the library is loaded from differs from the
767
- // common namespace so it has to be mapped.
768
- await SmartBusiness.loadSmartBusinessLibrary("/sap/bc/ui5_ui5/sap/ssbtileslibs1");
769
-
770
- let oParsedShellHash = UrlParsing.parseShellHash(sShellHash);
771
- oParsedShellHash = await SmartBusiness.resolveEvaluationId(oParsedShellHash, true);
772
- sShellHash = UrlParsing.constructShellHash(oParsedShellHash, true);
773
- });
774
- }
775
-
776
- // resolve the shell hash and try to load a UI5 component for it; if successful,
777
- // the application context for the component will be attached to the resolution result
778
- // for non-UI5 targets, it will be empty
779
- oPromise
780
- .then(() => {
781
- return getContainer().getServiceAsync("NavTargetResolutionInternal");
782
- })
783
- .then((oNavTargetResolutionInternal) => {
784
- oNavTargetResolutionInternal.resolveHashFragment(UrlParsing.ensureLeadingHash(sShellHash))
785
- .done((oResolutionResult) => {
786
- sap.ui.require(["sap/ushell/services/AppConfiguration"], (AppConfiguration) => {
787
- AppConfiguration.setCurrentApplication(oResolutionResult);
788
-
789
- if (oResolutionResult && oResolutionResult.ui5ComponentName) {
790
- // create UI5 component early
791
- getContainer().getServiceAsync("Ui5ComponentLoader").then((oUi5ComponentLoader) => {
792
- oUi5ComponentLoader.createComponent(
793
- oResolutionResult,
794
- [createWaitForRendererCreatedPromise()],
795
- "Application"
796
- )
797
- .then((oResolutionResultWithComponentHandle) => {
798
- fnResolve({
799
- resolvedHashFragment: oResolutionResultWithComponentHandle,
800
- dependenciesLoaded: true
801
- });
802
- })
803
- .catch((oError) => {
804
- fnReject(oError);
805
- });
806
- });
807
- } else {
808
- // non-ui5 app
809
- fnResolve({
810
- resolvedHashFragment: oResolutionResult,
811
- dependenciesLoaded: false
812
- });
813
- }
814
- });
815
- })
816
- .fail((oError) => {
817
- fnReject(oError);
818
- });
819
- })
820
- .catch((oError) => {
821
- fnReject(oError);
822
- });
823
- }
824
- }
825
-
826
- function _loadPage (sShellHash) {
827
- if (sShellHash && sShellHash.indexOf("Shell-appfinder") === 0) {
828
- return;
829
- }
830
-
831
- getContainer().getServiceAsync("PersonalizationV2").then(async (oPersonalizationService) => {
832
- const oPersId = {
833
- container: "sap.ushell.cdm3-1.personalization",
834
- item: "data"
835
- };
836
-
837
- const oScope = {
838
- validity: "Infinity",
839
- keyCategory: oPersonalizationService.KeyCategory.GENERATED_KEY,
840
- writeFrequency: oPersonalizationService.WriteFrequency.HIGH,
841
- clientStorageAllowed: false
842
- };
843
- const oPersonalizer = await oPersonalizationService.getPersonalizer(oPersId, oScope);
844
- return oPersonalizer.getPersData();
845
- });
846
-
847
- sap.ui.require([
848
- "sap/ushell/components/pages/controller/PagesAndSpaceId",
849
- "sap/ushell/resources"
850
- ], async (
851
- PagesAndSpaceId,
852
- ushellResources
853
- ) => {
854
- await ushellResources.awaitResourceBundle();
855
- const pId = PagesAndSpaceId.getPageAndSpaceId(sShellHash);
856
- const pPagePersistenceService = getContainer().getServiceAsync("PagePersistence");
857
-
858
- Promise.all([
859
- pId,
860
- pPagePersistenceService
861
- ])
862
- .then((aResults) => {
863
- const oIds = aResults[0];
864
- const oPagePersistenceService = aResults[1];
865
- oPagePersistenceService.getPage(oIds.pageId);
866
- })
867
- .catch((oError) => {
868
- Log.error("getPage failed", oError);
869
- });
870
- });
871
- }
872
-
873
- /**
874
- * Performs a start-up request and synchronizes it with the SAPUI5 boot task.
875
- * @param {object} fnCallback To be called for UI5 Core during boot process
876
- */
877
- function start (fnCallback) {
878
- abapXhrlogonHandler.initXhrLogon(window["sap-ushell-config"]);
879
-
880
- // initialize UI5 performance tracing (FESR) before first request is sent, so that this is also instrumented
881
- initTraces();
882
-
883
- // fire start-up request if direct start also indicates suppression of pageset request
884
- // must be kept before success handler of requestStartUp
885
- abapRequestStartup.requestStartupConfig()
886
- .catch((oError) => {
887
- Log.error("start_up request failed:", oError, "sap.ushell_abap.bootstrap");
888
- return {};
889
- })
890
- .then((oStartupResult) => {
891
- const sHash = oBoottask._getShellHash();
892
- (ObjectPath.get("sap-ushell-config.services.Container.adapter") || ObjectPath.create("sap-ushell-config.services.Container.adapter")).config = oStartupResult;
893
- const oLaunchPageAdapterConfig = ObjectPath.get("sap-ushell-config.services.LaunchPage.adapter.config") || ObjectPath.create("sap-ushell-config.services.LaunchPage.adapter.config");
894
- const oClientSideTargetResolutionAdapterConfig = ObjectPath.get("sap-ushell-config.services.ClientSideTargetResolution.adapter.config") ||
895
- ObjectPath.create("sap-ushell-config.services.ClientSideTargetResolution.adapter.config");
896
- // NavigationDataProvider and ClientSideTargetResolution both create a ClientSideTargetResolutionAdapter instance. These should
897
- // use the same config object (not copies) as the request promises are stored in the config and need to be accessible for all instances.
898
- ObjectPath.set("sap-ushell-config.services.NavigationDataProvider.adapter.config", oClientSideTargetResolutionAdapterConfig);
899
- if (ObjectPath.get("sap-ushell-config.ushell.spaces.enabled")) {
900
- // VisualizationDataProvider and LaunchPageAdapter should have the same configuration
901
- ObjectPath.set("sap-ushell-config.services.VisualizationDataProvider.adapter.config", oLaunchPageAdapterConfig);
902
- }
903
- processDirectStart(oStartupResult);
904
-
905
- // Startup theme processing: as early as possible for performance reasons
906
- sSystemThemeRoot = extractSystemThemeRoot(oStartupResult);
907
- oStartupTheme = determineStartupTheme(oStartupResult, sSystemThemeRoot);
908
- if (!getSapThemeUrlParameter() && oStartupTheme) {
909
- Log.debug("theme: load theme from startup service via window",
910
- null, "sap.ushell_abap.bootstrap");
911
- }
912
- // Request page set and incomplete target mappings only if the home page is loaded
913
- // (not a direct application start)
914
- if (isHomepageHash(sHash) && !ObjectPath.get("sap-ushell-config.ushell.spaces.enabled")) {
915
- // do not create cache entries for PageSet and compact TMs
916
- // otherwise the FLP will freeze when returning to HOME from the cold started app (???)
917
- abapRequestPageset.requestPageSet(oStartupResult);
918
- }
919
- const oTMPromise = abapRequestStartup.requestFullTM(oStartupResult);
920
- oClientSideTargetResolutionAdapterConfig.navTargetDataPromise = oTMPromise;
921
- // Do not issue the separate compact request for the launchpage adapter, as it was done in the earlier FLP versions.
922
- // Reuse the existing full target mappings request that is sent in any case.
923
- oLaunchPageAdapterConfig.compactTMPromise = oTMPromise;
924
- ObjectPath.set("sap-ushell-config.services.FlpLaunchPage.adapter.config.compactTMPromise", oTMPromise);
925
-
926
- // Request the target mappings immediately when startup request is finished; this is always requested,
927
- // because we need it for navigation target resolution
928
- return Promise.resolve(oStartupResult);
929
- })
930
- .then((oStartupResult) => {
931
- // Note: processStartup creates window["sap-ushell-config"]
932
- processStartup(oStartupResult);
933
- fnCallback();
934
- });
935
- }
936
-
937
- oBoottask.start = start;
938
- oBoottask.afterBootstrap = afterBootstrap;
939
- oBoottask._getShellHash = getShellHash; // only for testing
940
- oBoottask._getFullShellHash = getFullShellHash; // only for testing
941
- oBoottask._createWaitForRendererCreatedPromise = createWaitForRendererCreatedPromise; // only for testing
942
- oBoottask._loadPage = _loadPage; // only for testing
943
- return oBoottask;
944
- });