@sapui5/sap.ushell_abap 1.146.0 → 1.147.0

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,219 +0,0 @@
1
- // Copyright (c) 2009-2026 SAP SE, All Rights Reserved
2
-
3
- sap.ui.define([
4
- "sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils",
5
- "sap/ushell/bootstrap/common/common.util",
6
- "sap/ui/thirdparty/jquery",
7
- "sap/ushell_abap/pbServices/ui2/Utils",
8
- "sap/base/Log"
9
- ], (
10
- abapBootstrapUtils,
11
- commonUtil,
12
- jQuery,
13
- ui2Utils,
14
- Log
15
- ) => {
16
- "use strict";
17
-
18
- /* global OData */
19
-
20
- const oPagesetHandler = {};
21
- const S_PAGE_SETS_FALLBACK_URL_BASE = "/sap/opu/odata/UI2/PAGE_BUILDER_PERS";
22
- const S_PAGE_SETS_FALLBACK_EXPAND = "Pages/PageChipInstances/Chip/ChipBags/ChipProperties,"
23
- + "Pages/PageChipInstances/RemoteCatalog,"
24
- + "Pages/PageChipInstances/ChipInstanceBags/ChipInstanceProperties,"
25
- + "AssignedPages,DefaultPage";
26
- const S_PAGE_SETS_FALLBACK_URL_RELATIVE = "PageSets('%2FUI2%2FFiori2LaunchpadHome')";
27
-
28
- // Check (only once for this file) if sap-statistics is set in query parameter or local storage
29
- let bSapStatistics = commonUtil.isSapStatisticsSet();
30
-
31
- /**
32
- * Determines the URL for the PageSets OData service from the startup service result. If the URL is not set
33
- * a hard-coded fallback URL is returned and set in the startupResult.
34
- *
35
- * @param {object} oStartupCallResult
36
- * the startup service result object
37
- * @param {string} sServicePropertyName
38
- * the name of the service property in the startup result
39
- * @param {string} sFallbackBaseUrl
40
- * the fallback base URL to be used if the service URL is not set
41
- * @param {string} sFallbackRelativeUrl
42
- * the fallback relative URL to be used if the service URL is not set
43
- * @param {string} sFallbackExpand
44
- * the fallback expand parameter to be used if the service URL is not set
45
- * @returns {string}
46
- * the URL for the service, adjusted with the fallback values if necessary
47
- */
48
- function getAndAdjustServiceURL (oStartupCallResult, sServicePropertyName, sFallbackBaseUrl, sFallbackRelativeUrl, sFallbackExpand) {
49
- let sServiceUrl;
50
- let oServiceData; // shortcut for oStartupCallResult.services[sServicePropertyName]
51
- let bFallbackApplied = false;
52
-
53
- if (oStartupCallResult.services) {
54
- if (oStartupCallResult.services[sServicePropertyName]) {
55
- oServiceData = oStartupCallResult.services[sServicePropertyName];
56
- } else {
57
- oServiceData = {};
58
- oStartupCallResult.services[sServicePropertyName] = oServiceData;
59
- bFallbackApplied = true;
60
- }
61
- } else {
62
- oServiceData = {};
63
- oStartupCallResult.services = {};
64
- oStartupCallResult.services[sServicePropertyName] = oServiceData;
65
- bFallbackApplied = true;
66
- }
67
-
68
- if (!oServiceData.baseUrl || !oServiceData.relativeUrl) {
69
- oServiceData.baseUrl = sFallbackBaseUrl;
70
- oServiceData.relativeUrl = sFallbackRelativeUrl;
71
- bFallbackApplied = true;
72
- }
73
-
74
- if (bFallbackApplied) {
75
- Log.warning(
76
- `URL for ${sServicePropertyName} service not found in startup service result; fallback to default; cache invalidation might fail`,
77
- null,
78
- "sap.ushell_abap.bootstrap"
79
- );
80
- }
81
-
82
- // clean trailing and leading slashes
83
- if (oServiceData.baseUrl.lastIndexOf("/") !== oServiceData.baseUrl.length - 1) {
84
- // modify the startUpResult, to simplify the adapter code later
85
- oServiceData.baseUrl += "/";
86
- }
87
- if (oServiceData.relativeUrl[0] === "/") {
88
- // modify the startUpResult, to simplify the adapter code later
89
- oServiceData.relativeUrl = oServiceData.relativeUrl.slice(1);
90
- }
91
-
92
- sServiceUrl = oServiceData.baseUrl + oServiceData.relativeUrl;
93
-
94
- // add parameters if needed
95
- // Note: order should always be 1. $expand, 2. sap-cache-id=, 3. additional params;
96
- // as OData.read.$cache may otherwise not work properly
97
- if (!/\$expand=/.test(sServiceUrl) && sFallbackExpand) {
98
- // no expand, add fallback expand (if not "")
99
- sServiceUrl += `${sServiceUrl.indexOf("?") < 0 ? "?" : "&"}$expand=${sFallbackExpand}`;
100
- }
101
- if (oServiceData.cacheId) {
102
- sServiceUrl += `${sServiceUrl.indexOf("?") < 0 ? "?" : "&"}sap-cache-id=${oServiceData.cacheId}`;
103
- }
104
- if (oServiceData["sap-ui2-cache-disable"]) {
105
- sServiceUrl += `${sServiceUrl.indexOf("?") < 0 ? "?" : "&"}sap-ui2-cache-disable=${oServiceData["sap-ui2-cache-disable"]}`;
106
- }
107
-
108
- return sServiceUrl;
109
- }
110
-
111
- /**
112
- * Processes the OData response.
113
- * @param {jQuery.Deferred} oDeferred
114
- * the deferred object updating the cache in OData.read
115
- * @param {int} iStatus
116
- * the status code
117
- * @param {string} sCsrfToken
118
- * the CSRF token
119
- * @param {string} sResponse
120
- * the response message
121
- */
122
- function processOData (oDeferred, iStatus, sCsrfToken, sResponse) {
123
- if (iStatus === 200) {
124
- oDeferred.resolve(JSON.parse(sResponse).d, sCsrfToken);
125
- } else {
126
- // rejecting the deferred will make the request later (in the ushell adapter) fail, so
127
- // the error handling there takes effect
128
- oDeferred.reject(new Error(`PageSet request failed: ${sResponse}`));
129
- }
130
- }
131
-
132
- /**
133
- * Determines the URL for the PageSets OData service from the startup service result. If the URL is not set
134
- * a hard-coded fallback URL is returned and set in the startupResult.
135
- *
136
- * @param {object} oStartupCallResult
137
- * the startup service result object
138
- * @returns {string}
139
- * the URL for the PageSets OData service
140
- */
141
- function getAndAdjustPageSetServiceURL (oStartupCallResult) {
142
- const sUI2CacheDisable = abapBootstrapUtils.getUrlParameterValue("sap-ui2-cache-disable");
143
- if (sUI2CacheDisable && oStartupCallResult && oStartupCallResult.services && oStartupCallResult.services.pbFioriHome) {
144
- oStartupCallResult.services.pbFioriHome["sap-ui2-cache-disable"] = sUI2CacheDisable;
145
- }
146
- return getAndAdjustServiceURL(
147
- oStartupCallResult,
148
- "pbFioriHome",
149
- S_PAGE_SETS_FALLBACK_URL_BASE,
150
- S_PAGE_SETS_FALLBACK_URL_RELATIVE,
151
- S_PAGE_SETS_FALLBACK_EXPAND
152
- );
153
- }
154
-
155
- /**
156
- * Creates the Deferred in the OData.read cache to keep the result of the request with the
157
- * given URL.
158
- * @param {string} sUrl
159
- * the URL to be requested
160
- * @returns {jQuery.Deferred}
161
- * the deferred object which will be resolved with the response of the request
162
- *
163
- * @private
164
- */
165
- function createODataDeferred (sUrl) {
166
- const oDeferred = new jQuery.Deferred();
167
- // creating the deferred objects here should ensure that the ushell adapters later read
168
- // the responses from the "cache", even if UI5 bootstrap is faster than the
169
- // OData requests
170
- sap.ui.require(["sap/ui/thirdparty/datajs"], (datajs) => {
171
- OData.read.$cache = OData.read.$cache || new ui2Utils.Map();
172
- OData.read.$cache.put(sUrl, oDeferred.promise());
173
- });
174
- return oDeferred;
175
- }
176
-
177
- /**
178
- * Performs an OData GET request using a plain XHR.
179
- * @param {string} sUrl
180
- * the url to be requested
181
- * @param {object} oStartupResult
182
- * the startup result object, containing the base URL and the CSRF token
183
- * @param {function(number, object, function)} fnCallback
184
- * callback function to be called when the request finished, taking the status code, the
185
- * CSRF token and the response message
186
- */
187
- function requestOData (sUrl, oStartupResult, fnCallback) {
188
- const oXHR = abapBootstrapUtils.createAndOpenXHR(sUrl, oStartupResult);
189
- // set sap-statistics header, see
190
- // http://help.sap.com/saphelp_nw74/helpdata/de/40/93b81292194d6a926e105c10d5048d/content.htm
191
- if (bSapStatistics) {
192
- oXHR.setRequestHeader("sap-statistics", "true");
193
- }
194
- oXHR.onreadystatechange = function () {
195
- if (this.readyState !== /* DONE */4) {
196
- return; // not yet DONE
197
- }
198
- fnCallback(oXHR.status, undefined /* csrf token */, oXHR.responseText);
199
- };
200
- oXHR.send();
201
- }
202
-
203
- function requestPageSet (oStartupResult) {
204
- const sPageSetServiceUrl = getAndAdjustPageSetServiceURL(oStartupResult);
205
- const oDeferred = createODataDeferred(sPageSetServiceUrl);// TODO make as Promise.all
206
-
207
- requestOData(sPageSetServiceUrl, oStartupResult, (iStatus, sCsrfToken, sResponse) => {
208
- processOData(oDeferred, iStatus, sCsrfToken, sResponse);
209
- });
210
- }
211
-
212
- oPagesetHandler.requestPageSet = requestPageSet;
213
- oPagesetHandler._getAndAdjustServiceURL = getAndAdjustServiceURL; // Only for testing
214
- oPagesetHandler._getAndAdjustPageSetServiceURL = getAndAdjustPageSetServiceURL; // Only for testing
215
- oPagesetHandler._setSapStatistics = function (bValue) {
216
- bSapStatistics = bValue;
217
- }; // Only for testing
218
- return oPagesetHandler;
219
- });
@@ -1,154 +0,0 @@
1
- // Copyright (c) 2009-2026 SAP SE, All Rights Reserved
2
- sap.ui.define([
3
- "sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils",
4
- "sap/base/util/ObjectPath",
5
- "sap/base/Log",
6
- "sap/ushell_abap/pbServices/ui2/Utils",
7
- "sap/ushell/utils"
8
- ], (
9
- abapBootstrapUtils,
10
- ObjectPath,
11
- Log,
12
- ui2Utils,
13
- ushellUtils
14
- ) => {
15
- "use strict";
16
-
17
- const oStartupHandler = {};
18
-
19
- /**
20
- * Performs the start-up request.
21
- * @param {string} sQuery
22
- * String which is added to the "/sap/bc/ui2/start_up?"
23
- * @param {string[]} aParametersFromUrl
24
- * The List of parameters which should be copied to the requested url
25
- * @param {object} oStartupConfig
26
- * Startup object, used to take cacheId and other parameters
27
- *
28
- * @returns {Promise}
29
- * Result of the GET request should be resolved
30
- */
31
- function requestStartup (sQuery, aParametersFromUrl, oStartupConfig) {
32
- let sRequestUrl = "/sap/bc/ui2/start_up?";
33
- const mParameterMap = ui2Utils.getParameterMap();
34
- let oXHR;
35
-
36
- if (sQuery) {
37
- sRequestUrl += `${sQuery}&`;
38
- }
39
-
40
- /**
41
- * Copies the URL parameter with the given name from <code>mParameterMap</code> to
42
- * <code>sRequestUrl</code>.
43
- *
44
- * @param {string} sName
45
- * URL parameter name
46
- * @private
47
- */
48
- function copyParameter (sName) {
49
- const sValue = mParameterMap[sName];
50
- if (sValue) {
51
- sRequestUrl += `${sName}=${encodeURIComponent(sValue[0])}&`;
52
- }
53
- }
54
-
55
- aParametersFromUrl.forEach(copyParameter);
56
- sRequestUrl += `shellType=${ushellUtils.getShellType()}&depth=0`;
57
- if (oStartupConfig) {
58
- sRequestUrl += abapBootstrapUtils.getCacheIdAsQueryParameter(oStartupConfig);
59
- oXHR = abapBootstrapUtils.createAndOpenXHR(sRequestUrl, oStartupConfig); // XMLHttpRequest + headers
60
- }
61
-
62
- return new Promise((resolve, reject) => {
63
- ui2Utils.get(
64
- sRequestUrl,
65
- false, /* xml=*/
66
- (sStartupCallResult) => {
67
- const oStartupResult = JSON.parse(sStartupCallResult);
68
- resolve(oStartupResult);
69
- },
70
- (sErrorMessage) => {
71
- reject(new Error(sErrorMessage));
72
- },
73
- oXHR
74
- );
75
- });
76
- }
77
-
78
- /**
79
- * Performs the start-up request without so and action.
80
- *
81
- * @returns {Promise}
82
- * Result of the GET request should be resolved
83
- */
84
- oStartupHandler.requestStartupConfig = function () {
85
- const oServerSideConfigStartup = ObjectPath.get("sap-ushell-config.services.Container.adapter.config"); // do not create
86
- if (oServerSideConfigStartup) {
87
- return Promise.resolve(oServerSideConfigStartup);
88
- }
89
-
90
- return requestStartup("", ["sap-language", "sap-client"]);
91
- };
92
-
93
- /**
94
- * Performs the full start-up request (so=%2A&action=%2A).
95
- *
96
- * @param {object} oStartupConfig
97
- * Startup object, used to take cacheId and other parameters
98
- * @param {boolean} bNoOData
99
- * If Odata is not allowed. If true - return rejected promise.
100
- *
101
- * @returns {Promise}
102
- * Result of the GET request should be resolved
103
- */
104
- oStartupHandler.requestFullTM = function (oStartupConfig) {
105
- return requestStartup("so=%2A&action=%2A&systemAliasesFormat=object", ["sap-language", "sap-client", "sap-ui2-cache-disable"], oStartupConfig)
106
- .then((oResult) => {
107
- if (oResult) {
108
- if (oResult.client) { // double check we get the correct response
109
- // TODO: move this to integration test perhaps
110
- throw new Error("A start up response was returned in a target mappings request.");
111
- }
112
- return oResult;
113
- }
114
- return {};
115
- })
116
- .catch((oError) => {
117
- Log.error("navTargetDataPromise rejected:", oError);
118
- throw oError;
119
- });
120
- };
121
-
122
- /**
123
- * Performs an extra request to retrieve a direct Start Request.
124
- *
125
- * @param {object} oStartupConfig
126
- * Startup object, used to take cacheId and other parameters
127
- * @param {sap.ushell.services.URLParsing.DecomposedHash} oParsedHash
128
- * The parsed shell hash object. The object must contain semanticObject and action
129
- * @param {object} oInitialKeys
130
- * The parameters which should be copied to the requested url
131
- *
132
- * @returns {Promise}
133
- * Result of the GET request should be resolved
134
- */
135
- oStartupHandler.requestDirectStart = function (oStartupConfig, oParsedHash, oInitialKeys) {
136
- const sFormFactor = ui2Utils.getFormFactor();
137
- let sQueryPath = "";
138
-
139
- sQueryPath = `so=${oParsedHash.semanticObject}&action=${oParsedHash.action}`;
140
- sQueryPath += "&systemAliasesFormat=object";
141
- Object.keys(oInitialKeys).forEach((sKey) => {
142
- sQueryPath += `&${sKey}=${oInitialKeys[sKey]}`;
143
- });
144
- if (sFormFactor) {
145
- sQueryPath += `&formFactor=${encodeURIComponent(sFormFactor)}`;
146
- }
147
-
148
- return requestStartup(sQueryPath, ["sap-language", "sap-client"], oStartupConfig).then((oResult) => {
149
- return Promise.resolve(oResult);
150
- });
151
- };
152
-
153
- return oStartupHandler;
154
- });
@@ -1,79 +0,0 @@
1
- // Copyright (c) 2009-2026 SAP SE, All Rights Reserved
2
-
3
- /**
4
- * @fileOverview
5
- * Returns a function <code>isThemeRootSafe</code> to validate
6
- * the origin of a given theme root string.
7
- */
8
- sap.ui.define([
9
- "sap/ui/thirdparty/URI",
10
- "sap/base/Log",
11
- "sap/ushell/bootstrap/common/common.read.metatags"
12
- ], (
13
- URI,
14
- Log,
15
- commonReadMetatags
16
- ) => {
17
- "use strict";
18
-
19
- const oThemeHandler = {};
20
-
21
- /**
22
- * Checks if ThemeRoot is part of the allowlist
23
- * @param {string} sOrigin the origin of the theme root to be validated
24
- *
25
- * @returns {boolean} if it is part of the allowlist
26
- */
27
- function validateThemeOrigin (sOrigin) {
28
- const aArrayOfAllowedOrigins = commonReadMetatags.readMetaTags(
29
- "sap-allowed-theme-origins",
30
- // only one allowed origin shall be provided
31
- (sMetaNodeContent) => {
32
- return sMetaNodeContent.trim();
33
- }
34
- );
35
- let sAllowedOrigins = "";
36
- // only one meta tag of this type should exist, therefore only looking for first element
37
- if (aArrayOfAllowedOrigins.length > 0) {
38
- sAllowedOrigins = aArrayOfAllowedOrigins[0];
39
- } else {
40
- Log.debug('No meta tag "sap-allowed-theme-origins" was found. No allowed origin for "theme-url" was applied.');
41
- }
42
-
43
- return !!sAllowedOrigins && sAllowedOrigins.split(",").some((sAllowedOrigin) => {
44
- return sAllowedOrigin === "*" || sOrigin === sAllowedOrigin.trim();
45
- });
46
- }
47
-
48
- /**
49
- * Checks if the origin of the theme root string passed on entry
50
- * is regarded safe.
51
- *
52
- * The function returns <code>true</code>
53
- * - if the theme root is server relative
54
- * - if the allowlist check passed successfully
55
- * - if the theme root is identical to the current host
56
- *
57
- * The allowlist is taken from the value of the meta tag
58
- * <code><meta name="sap-allowed-theme-origins" value=...></code>.
59
- *
60
- * @param {string} themeRoot Theme root string to be verified
61
- *
62
- * @returns {boolean}
63
- * true/false if the allowlist check passed/failed
64
- * false in case no allowlist was specified, not producible by flp-handler
65
- */
66
- oThemeHandler.isThemeRootSafe = function (themeRoot) {
67
- // Remove search query as they are not supported for themeRoots/resourceRoots
68
- const oURI = new URI(themeRoot).search("");
69
- const sOrigin = oURI.origin().toString();
70
-
71
- // Return true if the theme root is relative or on the same host
72
- if (sOrigin === "" || validateThemeOrigin(sOrigin) || oURI.origin() === window.location.origin) {
73
- return true;
74
- }
75
- return false;
76
- };
77
-
78
- return oThemeHandler;
79
- });
@@ -1,21 +0,0 @@
1
- // Copyright (c) 2009-2026 SAP SE, All Rights Reserved
2
-
3
- sap.ui.define([
4
- "sap/ushell/bootstrap/common/common.debug.mode"
5
- ], (
6
- commonDebugMode
7
- ) => {
8
- "use strict";
9
-
10
- const pLoadXhrLib = new Promise((resolve) => {
11
- const sFileName = `sap/ushell_abap/thirdparty/sap-xhrlib-esm${commonDebugMode.isDebug() ? "-dbg" : ""}.js`;
12
- const sPath = sap.ui.require.toUrl(sFileName);
13
- import(sPath).then((oModule) => {
14
- resolve(oModule.xhrlib);
15
- });
16
- });
17
-
18
- return {
19
- getLib: function () { return pLoadXhrLib; }
20
- };
21
- });
@@ -1,62 +0,0 @@
1
- // Copyright (c) 2009-2026 SAP SE, All Rights Reserved
2
- sap.ui.define([
3
- "sap/ushell/bootstrap/common/common.util",
4
- "sap/base/Log"
5
- ], (
6
- commonUtil,
7
- Log
8
- ) => {
9
- "use strict";
10
-
11
- /**
12
- * Creates a logger for XMLHttpRequest(s) that logs errors, warnings, info
13
- * and debug messages via Log.
14
- *
15
- * @returns {object}
16
- * A logger that can be assigned to XMLHttpRequest.
17
- *
18
- * @private
19
- */
20
- function createUi5ConnectedXhrLogger () {
21
- return ["error", "warning", "info", "debug"].reduce((oXhrLogger, sLevel) => {
22
- oXhrLogger[sLevel] = function (sMsg) {
23
- return Log[sLevel](sMsg);
24
- };
25
- return oXhrLogger;
26
- }, {});
27
- }
28
-
29
- /**
30
- * Initializes the ignore list of the XHR logon manager.
31
- * <p>
32
- * If the UI5 resources (including the own bootstrap script) are loaded from an absolute URL
33
- * (in case CDN is activated),
34
- * this URL is added to the ignore list to prevent CORS preflight requests due to the X headers.
35
- * We expect that all resources can be loaded without authentication in this case.
36
- *
37
- * @param {object} oXHRLogonManager
38
- * the logon frame manager instance to use
39
- *
40
- * @private
41
- */
42
- function initXhrLogonIgnoreList (oXHRLogonManager) {
43
- const sOrigin = commonUtil.getLocationOrigin();
44
- const sUi5ResourceRootUrl = sap.ui.require.toUrl("");
45
-
46
- // add "/" to origin, as otherwise the following use case will match:
47
- // sUi5ResourceRootUrl: http://sap.com:123
48
- // sOrigin: http://sap.com
49
- if (sUi5ResourceRootUrl && sUi5ResourceRootUrl.indexOf(`${sOrigin}/`) === -1) {
50
- // In case UI5 is loaded from a different domain (CDN / AKAMAI), that URL
51
- // needs to be ignored for the XHR logon, as we expect that the resources
52
- // are not protected.
53
- oXHRLogonManager.ignore.add(sUi5ResourceRootUrl);
54
- }
55
- }
56
-
57
- const oModule = {
58
- initXhrLogonIgnoreList: initXhrLogonIgnoreList,
59
- createUi5ConnectedXhrLogger: createUi5ConnectedXhrLogger
60
- };
61
- return oModule;
62
- });
@@ -1,82 +0,0 @@
1
- // Copyright (c) 2009-2026 SAP SE, All Rights Reserved
2
- sap.ui.define([
3
- "sap/ushell_abap/bootstrap/evo/abap.xhrlogon.LibLoader",
4
- "sap/ushell_abap/bootstrap/evo/abap.xhrlogon.configure",
5
- "sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils",
6
- "sap/ushell_abap/bootstrap/evo/XhrLogonEventHandler",
7
- "sap/base/Log"
8
- ], (
9
- abapXhrlogonLibLoader,
10
- abapXhrlogonConfigure,
11
- abapBootstrapUtils,
12
- XhrLogonEventHandler,
13
- Log
14
- ) => {
15
- "use strict";
16
-
17
- const oHandler = {};
18
-
19
- /**
20
- * Determines the XHR logon mode based on the bootstrap configuration and the URL parameter
21
- *
22
- * @param {object} oConfig
23
- * the configuration
24
- * @returns {string} the logon mode
25
- */
26
- oHandler.getLogonMode = function (oConfig) {
27
- return abapBootstrapUtils.getUrlParameterValue("sap-ushell-xhrLogon-mode")
28
- || oConfig && oConfig.xhrLogon && oConfig.xhrLogon.mode
29
- || "frame";
30
- };
31
-
32
- /**
33
- * Initializes and starts XHR logon lib based on a given configuration.
34
- * <p>
35
- *
36
- * @param {object} oConfig
37
- * the configuration
38
- *
39
- * @private
40
- */
41
- oHandler.initXhrLogon = function (oConfig) {
42
- abapXhrlogonLibLoader.getLib().then((oXhrLogonLib) => {
43
- const sLogonMode = oHandler.getLogonMode(oConfig);
44
- const oXhrLogonEventHandler = oHandler.createXhrLogonEventHandler(window, sLogonMode);
45
- const oLogonManager = oXhrLogonLib.LogonManager.getInstance();
46
- const oXHRLogonManager = oXhrLogonLib.XHRLogonManager.getInstance();
47
- const oXhrLibConfig = {
48
- explicitMatchOnCORS: true // avoids to send XHRLib HTTP headers to thirdparty services
49
- };
50
-
51
- oXhrLogonLib.start(oXhrLibConfig);
52
-
53
- if (sLogonMode === "reload" || sLogonMode === "logoffAndRedirect") {
54
- oLogonManager.unregisterAllHandlers();
55
- oLogonManager.registerAuthHandler("*", (oEvent) => {
56
- oXhrLogonEventHandler.handleEvent(oEvent);
57
- });
58
- } else if (sLogonMode !== "frame") {
59
- Log.warning(`Unknown setting for xhrLogonMode: '${sLogonMode}'. Using default mode 'frame'.`,
60
- null, "sap.ushell_abap.bootstrap.evo.abap.xhrlogon.handler");
61
- }
62
-
63
- oXhrLogonLib.Log.set(abapXhrlogonConfigure.createUi5ConnectedXhrLogger());
64
- abapXhrlogonConfigure.initXhrLogonIgnoreList(oXHRLogonManager);
65
- });
66
- };
67
-
68
- /**
69
- * We expose a factory method for the tests and allow to pass a test double for the window object
70
- *
71
- * @param {object} oWindow the window object
72
- * @param {string} sXhrLogonMode logon mode
73
- * @returns {XhrLogonEventHandler} a new XhrLogonEventHandler
74
- *
75
- * @private
76
- */
77
- oHandler.createXhrLogonEventHandler = function (oWindow, sXhrLogonMode) {
78
- return new XhrLogonEventHandler(oWindow, sXhrLogonMode);
79
- };
80
-
81
- return oHandler;
82
- });