@openui5/sap.ui.integration 1.120.10 → 1.121.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 (229) hide show
  1. package/.reuse/dep5 +23 -21
  2. package/THIRDPARTY.txt +6 -43
  3. package/package.json +6 -6
  4. package/src/sap/ui/integration/.library +1 -1
  5. package/src/sap/ui/integration/ActionDefinition.js +1 -1
  6. package/src/sap/ui/integration/Designtime.js +1 -1
  7. package/src/sap/ui/integration/Extension.js +1 -1
  8. package/src/sap/ui/integration/Host.js +14 -12
  9. package/src/sap/ui/integration/cards/AdaptiveContent.js +16 -16
  10. package/src/sap/ui/integration/cards/AnalyticalContent.js +37 -11
  11. package/src/sap/ui/integration/cards/AnalyticsCloudContent.js +1 -1
  12. package/src/sap/ui/integration/cards/BaseContent.js +13 -4
  13. package/src/sap/ui/integration/cards/BaseContentRenderer.js +1 -1
  14. package/src/sap/ui/integration/cards/BaseListContent.js +1 -1
  15. package/src/sap/ui/integration/cards/CalendarContent.js +9 -9
  16. package/src/sap/ui/integration/cards/CalendarContentRenderer.js +10 -7
  17. package/src/sap/ui/integration/cards/ComponentContent.js +1 -1
  18. package/src/sap/ui/integration/cards/Footer.js +11 -5
  19. package/src/sap/ui/integration/cards/Header.js +4 -4
  20. package/src/sap/ui/integration/cards/ListContent.js +8 -2
  21. package/src/sap/ui/integration/cards/ListContentRenderer.js +5 -3
  22. package/src/sap/ui/integration/cards/NumericHeader.js +4 -4
  23. package/src/sap/ui/integration/cards/ObjectContent.js +42 -5
  24. package/src/sap/ui/integration/cards/TableContent.js +1 -1
  25. package/src/sap/ui/integration/cards/TimelineContent.js +4 -4
  26. package/src/sap/ui/integration/cards/WebPageContent.js +1 -1
  27. package/src/sap/ui/integration/cards/actions/BaseAction.js +4 -4
  28. package/src/sap/ui/integration/cards/actions/CardActions.js +1 -1
  29. package/src/sap/ui/integration/cards/actions/ShowCardAction.js +3 -3
  30. package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputChoiceSet.js +1 -1
  31. package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputDate.js +1 -1
  32. package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputNumber.js +1 -1
  33. package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputText.js +1 -1
  34. package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputToggle.js +1 -1
  35. package/src/sap/ui/integration/cards/adaptivecards/overwrites/inputsGeneralOverwrites.js +3 -3
  36. package/src/sap/ui/integration/cards/data/CsrfToken.js +61 -0
  37. package/src/sap/ui/integration/cards/filters/BaseFilter.js +33 -32
  38. package/src/sap/ui/integration/cards/filters/ComboBoxFilter.js +254 -0
  39. package/src/sap/ui/integration/cards/filters/DateRangeFilter.js +1 -1
  40. package/src/sap/ui/integration/cards/filters/FilterBar.js +1 -1
  41. package/src/sap/ui/integration/cards/filters/FilterBarFactory.js +9 -3
  42. package/src/sap/ui/integration/cards/filters/SearchFilter.js +16 -3
  43. package/src/sap/ui/integration/cards/filters/SelectFilter.js +1 -1
  44. package/src/sap/ui/integration/cards/list/MicrochartsResizeHelper.js +1 -1
  45. package/src/sap/ui/integration/controls/ActionsStrip.js +189 -84
  46. package/src/sap/ui/integration/controls/ActionsToolbar.js +12 -9
  47. package/src/sap/ui/integration/controls/BlockingMessage.js +93 -44
  48. package/src/sap/ui/integration/controls/ImageWithOverlay.js +199 -0
  49. package/src/sap/ui/integration/controls/ImageWithOverlayRenderer.js +36 -0
  50. package/src/sap/ui/integration/controls/LinkWithIcon.js +2 -2
  51. package/src/sap/ui/integration/controls/ListContentItem.js +10 -7
  52. package/src/sap/ui/integration/controls/ListContentItemRenderer.js +5 -4
  53. package/src/sap/ui/integration/controls/Microchart.js +4 -4
  54. package/src/sap/ui/integration/controls/MicrochartLegend.js +4 -4
  55. package/src/sap/ui/integration/controls/MicrochartLegendRenderer.js +3 -3
  56. package/src/sap/ui/integration/controls/ObjectStatus.js +3 -1
  57. package/src/sap/ui/integration/controls/Paginator.js +19 -11
  58. package/src/sap/ui/integration/controls/PaginatorRenderer.js +4 -4
  59. package/src/sap/ui/integration/designtime/baseEditor/BaseEditor.js +1 -1
  60. package/src/sap/ui/integration/designtime/baseEditor/PropertyEditor.js +6 -4
  61. package/src/sap/ui/integration/designtime/baseEditor/PropertyEditors.js +8 -6
  62. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/BasePropertyEditor.js +1 -1
  63. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/PropertyEditorFactory.js +1 -1
  64. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/arrayEditor/ArrayEditor.js +1 -1
  65. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
  66. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/codeEditor/CodeEditor.js +1 -1
  67. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateEditor/DateEditor.js +1 -1
  68. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateTimeEditor/DateTimeEditor.js +1 -1
  69. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/enumStringEditor/EnumStringEditor.js +1 -1
  70. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/groupEditor/GroupEditor.js +1 -1
  71. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/iconEditor/IconEditor.js +1 -1
  72. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/iconEditor/IsInIconPool.validator.js +1 -1
  73. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/integerEditor/IntegerEditor.js +1 -1
  74. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/jsonEditor/JsonEditor.js +1 -1
  75. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/listEditor/ListEditor.js +1 -1
  76. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/mapEditor/MapEditor.js +1 -1
  77. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/multiSelectEditor/MultiSelectEditor.js +1 -1
  78. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/numberEditor/NumberEditor.js +1 -1
  79. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/objectArrayEditor/ObjectArrayEditor.js +1 -1
  80. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/selectEditor/SelectEditor.js +1 -1
  81. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/separatorEditor/SeparatorEditor.js +1 -1
  82. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/stringEditor/StringEditor.js +1 -1
  83. package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/textAreaEditor/TextAreaEditor.js +1 -1
  84. package/src/sap/ui/integration/designtime/baseEditor/util/binding/ObjectBinding.js +1 -1
  85. package/src/sap/ui/integration/designtime/baseEditor/util/unset.js +1 -1
  86. package/src/sap/ui/integration/designtime/baseEditor/validator/IsBoolean.js +1 -1
  87. package/src/sap/ui/integration/designtime/baseEditor/validator/IsDate.js +1 -1
  88. package/src/sap/ui/integration/designtime/baseEditor/validator/IsInteger.js +1 -1
  89. package/src/sap/ui/integration/designtime/baseEditor/validator/IsNumber.js +1 -1
  90. package/src/sap/ui/integration/designtime/baseEditor/validator/IsSelectedKey.js +1 -1
  91. package/src/sap/ui/integration/designtime/baseEditor/validator/IsStringList.js +1 -1
  92. package/src/sap/ui/integration/designtime/baseEditor/validator/IsUniqueKey.js +1 -1
  93. package/src/sap/ui/integration/designtime/baseEditor/validator/IsUniqueList.js +1 -1
  94. package/src/sap/ui/integration/designtime/baseEditor/validator/IsValidBinding.js +1 -1
  95. package/src/sap/ui/integration/designtime/baseEditor/validator/MaxLength.js +1 -1
  96. package/src/sap/ui/integration/designtime/baseEditor/validator/NotABinding.js +1 -1
  97. package/src/sap/ui/integration/designtime/baseEditor/validator/ValidatorRegistry.js +1 -1
  98. package/src/sap/ui/integration/designtime/cardEditor/config/index.js +5 -16
  99. package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_mk.properties +1 -1
  100. package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/complexMapEditor/ComplexMapEditor.js +1 -1
  101. package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/destinationsEditor/DestinationsEditor.js +1 -1
  102. package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/filtersEditor/FiltersEditor.js +1 -1
  103. package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/iconEditor/IconEditor.js +5 -3
  104. package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/parametersEditor/ParametersEditor.js +1 -1
  105. package/src/sap/ui/integration/designtime/editor/Card.js +1 -1
  106. package/src/sap/ui/integration/designtime/editor/CardEditor.js +14 -6
  107. package/src/sap/ui/integration/designtime/editor/CardPreview.js +27 -11
  108. package/src/sap/ui/integration/designtime/editor/css/CardPreview.css +30 -17
  109. package/src/sap/ui/integration/editor/Editor.js +23 -25
  110. package/src/sap/ui/integration/editor/EditorResourceBundles.js +1 -1
  111. package/src/sap/ui/integration/editor/Extension.js +1 -1
  112. package/src/sap/ui/integration/editor/Manifest.js +1 -1
  113. package/src/sap/ui/integration/editor/Settings.js +21 -18
  114. package/src/sap/ui/integration/editor/css/Editor.css +9 -7
  115. package/src/sap/ui/integration/editor/fields/BaseField.js +27 -7
  116. package/src/sap/ui/integration/editor/fields/BooleanField.js +1 -1
  117. package/src/sap/ui/integration/editor/fields/DateField.js +5 -5
  118. package/src/sap/ui/integration/editor/fields/DateTimeField.js +5 -5
  119. package/src/sap/ui/integration/editor/fields/DestinationField.js +1 -1
  120. package/src/sap/ui/integration/editor/fields/GroupField.js +11 -13
  121. package/src/sap/ui/integration/editor/fields/IntegerField.js +5 -5
  122. package/src/sap/ui/integration/editor/fields/NumberField.js +5 -5
  123. package/src/sap/ui/integration/editor/fields/ObjectField.js +171 -13
  124. package/src/sap/ui/integration/editor/fields/ObjectListField.js +2 -1
  125. package/src/sap/ui/integration/editor/fields/StringField.js +4 -4
  126. package/src/sap/ui/integration/editor/fields/StringListField.js +1 -1
  127. package/src/sap/ui/integration/editor/fields/fragment/Controller.js +5 -5
  128. package/src/sap/ui/integration/editor/fields/viz/ColorSelect.js +2 -3
  129. package/src/sap/ui/integration/editor/fields/viz/IconSelect.js +12 -8
  130. package/src/sap/ui/integration/editor/fields/viz/ImageSelect.js +1 -1
  131. package/src/sap/ui/integration/editor/fields/viz/ShapeSelect.js +1 -1
  132. package/src/sap/ui/integration/editor/fields/viz/VizBase.js +1 -1
  133. package/src/sap/ui/integration/formatters/IconFormatter.js +5 -5
  134. package/src/sap/ui/integration/library-bootstrap.js +21 -20
  135. package/src/sap/ui/integration/library.js +23 -8
  136. package/src/sap/ui/integration/messagebundle.properties +3 -3
  137. package/src/sap/ui/integration/messagebundle_ar.properties +2 -0
  138. package/src/sap/ui/integration/messagebundle_bg.properties +2 -0
  139. package/src/sap/ui/integration/messagebundle_ca.properties +2 -0
  140. package/src/sap/ui/integration/messagebundle_cnr.properties +2 -0
  141. package/src/sap/ui/integration/messagebundle_cs.properties +2 -0
  142. package/src/sap/ui/integration/messagebundle_cy.properties +2 -0
  143. package/src/sap/ui/integration/messagebundle_da.properties +2 -0
  144. package/src/sap/ui/integration/messagebundle_de.properties +2 -0
  145. package/src/sap/ui/integration/messagebundle_el.properties +2 -0
  146. package/src/sap/ui/integration/messagebundle_en.properties +157 -0
  147. package/src/sap/ui/integration/messagebundle_en_GB.properties +2 -0
  148. package/src/sap/ui/integration/messagebundle_en_US_saprigi.properties +154 -152
  149. package/src/sap/ui/integration/messagebundle_es.properties +2 -0
  150. package/src/sap/ui/integration/messagebundle_es_MX.properties +2 -0
  151. package/src/sap/ui/integration/messagebundle_et.properties +2 -0
  152. package/src/sap/ui/integration/messagebundle_fi.properties +2 -0
  153. package/src/sap/ui/integration/messagebundle_fr.properties +2 -0
  154. package/src/sap/ui/integration/messagebundle_fr_CA.properties +2 -0
  155. package/src/sap/ui/integration/messagebundle_hi.properties +2 -0
  156. package/src/sap/ui/integration/messagebundle_hr.properties +2 -0
  157. package/src/sap/ui/integration/messagebundle_hu.properties +2 -0
  158. package/src/sap/ui/integration/messagebundle_id.properties +2 -0
  159. package/src/sap/ui/integration/messagebundle_it.properties +2 -0
  160. package/src/sap/ui/integration/messagebundle_iw.properties +2 -0
  161. package/src/sap/ui/integration/messagebundle_ja.properties +2 -0
  162. package/src/sap/ui/integration/messagebundle_kk.properties +2 -0
  163. package/src/sap/ui/integration/messagebundle_ko.properties +2 -0
  164. package/src/sap/ui/integration/messagebundle_lt.properties +2 -0
  165. package/src/sap/ui/integration/messagebundle_lv.properties +2 -0
  166. package/src/sap/ui/integration/messagebundle_mk.properties +4 -2
  167. package/src/sap/ui/integration/messagebundle_ms.properties +2 -0
  168. package/src/sap/ui/integration/messagebundle_nl.properties +2 -0
  169. package/src/sap/ui/integration/messagebundle_no.properties +2 -0
  170. package/src/sap/ui/integration/messagebundle_pl.properties +2 -0
  171. package/src/sap/ui/integration/messagebundle_pt.properties +2 -0
  172. package/src/sap/ui/integration/messagebundle_pt_PT.properties +2 -0
  173. package/src/sap/ui/integration/messagebundle_ro.properties +2 -0
  174. package/src/sap/ui/integration/messagebundle_ru.properties +2 -0
  175. package/src/sap/ui/integration/messagebundle_sh.properties +2 -0
  176. package/src/sap/ui/integration/messagebundle_sk.properties +2 -0
  177. package/src/sap/ui/integration/messagebundle_sl.properties +2 -0
  178. package/src/sap/ui/integration/messagebundle_sr.properties +2 -0
  179. package/src/sap/ui/integration/messagebundle_sv.properties +2 -0
  180. package/src/sap/ui/integration/messagebundle_th.properties +2 -0
  181. package/src/sap/ui/integration/messagebundle_tr.properties +2 -0
  182. package/src/sap/ui/integration/messagebundle_uk.properties +2 -0
  183. package/src/sap/ui/integration/messagebundle_vi.properties +2 -0
  184. package/src/sap/ui/integration/messagebundle_zh_CN.properties +2 -0
  185. package/src/sap/ui/integration/messagebundle_zh_TW.properties +2 -0
  186. package/src/sap/ui/integration/model/ContextModel.js +1 -1
  187. package/src/sap/ui/integration/model/ObservableModel.js +1 -1
  188. package/src/sap/ui/integration/model/PagingModelListBinding.js +1 -1
  189. package/src/sap/ui/integration/schemas/sap-card.json +198 -22
  190. package/src/sap/ui/integration/themes/base/ActionsStrip.less +6 -0
  191. package/src/sap/ui/integration/themes/base/AnalyticsCloudContent.less +2 -2
  192. package/src/sap/ui/integration/themes/base/Card.less +5 -0
  193. package/src/sap/ui/integration/themes/base/ImageWithOverlay.less +47 -0
  194. package/src/sap/ui/integration/themes/base/ListContentItem.less +12 -0
  195. package/src/sap/ui/integration/themes/base/ObjectContent.less +20 -2
  196. package/src/sap/ui/integration/themes/base/{ObjectStatusIcons.less → ObjectStatus.less} +12 -8
  197. package/src/sap/ui/integration/themes/base/library.source.less +2 -1
  198. package/src/sap/ui/integration/util/BaseFactory.js +1 -1
  199. package/src/sap/ui/integration/util/BindingHelper.js +1 -1
  200. package/src/sap/ui/integration/util/BindingResolver.js +1 -1
  201. package/src/sap/ui/integration/util/CacheAndRequestDataProvider.js +4 -4
  202. package/src/sap/ui/integration/util/CardMerger.js +4 -4
  203. package/src/sap/ui/integration/util/CardObserver.js +1 -1
  204. package/src/sap/ui/integration/util/ComboBoxHelper.js +59 -0
  205. package/src/sap/ui/integration/util/ContentFactory.js +1 -1
  206. package/src/sap/ui/integration/util/CsrfTokenHandler.js +130 -148
  207. package/src/sap/ui/integration/util/DataProvider.js +22 -9
  208. package/src/sap/ui/integration/util/DataProviderFactory.js +32 -12
  209. package/src/sap/ui/integration/util/Destinations.js +1 -1
  210. package/src/sap/ui/integration/util/ErrorHandler.js +3 -2
  211. package/src/sap/ui/integration/util/ExtensionDataProvider.js +1 -1
  212. package/src/sap/ui/integration/util/Form.js +9 -34
  213. package/src/sap/ui/integration/util/HeaderFactory.js +6 -4
  214. package/src/sap/ui/integration/util/JSONBindingHelper.js +1 -1
  215. package/src/sap/ui/integration/util/LoadingProvider.js +1 -1
  216. package/src/sap/ui/integration/util/Manifest.js +22 -7
  217. package/src/sap/ui/integration/util/ManifestResolver.js +3 -3
  218. package/src/sap/ui/integration/util/ParameterMap.js +5 -3
  219. package/src/sap/ui/integration/util/RequestDataProvider.js +27 -22
  220. package/src/sap/ui/integration/util/ServiceDataProvider.js +1 -1
  221. package/src/sap/ui/integration/util/ServiceManager.js +1 -1
  222. package/src/sap/ui/integration/util/SkeletonCard.js +1 -1
  223. package/src/sap/ui/integration/util/Utils.js +1 -1
  224. package/src/sap/ui/integration/util/Validators.js +1 -1
  225. package/src/sap/ui/integration/widgets/Card.js +47 -33
  226. package/src/sap/ui/integration/widgets/CardRenderer.js +6 -1
  227. package/src/sap-ui-integration.js +19 -17
  228. package/ui5.yaml +4 -0
  229. package/LICENSES/BSD-2-Clause.txt +0 -22
@@ -8,16 +8,18 @@ sap.ui.define([
8
8
  "sap/ui/base/Object",
9
9
  "sap/base/util/isPlainObject",
10
10
  "sap/base/util/merge",
11
- "sap/ui/model/json/JSONModel"
11
+ "sap/ui/model/json/JSONModel",
12
+ "../cards/data/CsrfToken"
12
13
  ], function (
13
14
  BaseObject,
14
15
  isPlainObject,
15
16
  merge,
16
- JSONModel
17
+ JSONModel,
18
+ CsrfToken
17
19
  ) {
18
20
  "use strict";
19
21
 
20
- var rPattern = /\{\{csrfTokens.([^\}]+)/;
22
+ var rPattern = /\{\{csrfTokens.([^\}]+)\}\}/;
21
23
  var TOKEN_DEFAULT_HEADER = "X-CSRF-Token";
22
24
 
23
25
  /**
@@ -30,11 +32,10 @@ sap.ui.define([
30
32
  * @extends sap.ui.base.Object
31
33
  *
32
34
  * @author SAP SE
33
- * @version 1.120.10
35
+ * @version 1.121.1
34
36
  *
35
37
  * @constructor
36
- * @param {sap.ui.integration.Host} oHost The Host which will be used for resolve CSRF tokens.
37
- * @param {object} oConfiguration The CSRF configuration from the manifest.
38
+ * @param {object} mSettings Token handler settings
38
39
  * @private
39
40
  * @ui5-restricted sap.ui.integration
40
41
  * @alias sap.ui.integration.util.CsrfTokenHandler
@@ -48,102 +49,66 @@ sap.ui.define([
48
49
 
49
50
  mSettings = mSettings || {};
50
51
 
52
+ this._mTokens = new Map();
53
+ this._oModel = mSettings.model;
54
+ /**
55
+ * @deprecated As of version 1.121.0
56
+ */
51
57
  this._oHost = mSettings.host;
52
58
  this._oConfiguration = mSettings.configuration;
59
+ this._oDataProviderFactory = mSettings.dataProviderFactory;
60
+
61
+ for (const [sTokenName, oTokenConfig] of Object.entries(mSettings.configuration)) {
62
+ this._mTokens.set(sTokenName, new CsrfToken(sTokenName, oTokenConfig, this));
63
+ }
53
64
  }
54
65
  });
55
66
 
56
- /**
57
- * Map of all Promises which resolve to CSRF tokens. Keyed by the unique URL of each CSRF request. Shared by all cards.
58
- *
59
- * @static
60
- * @private
61
- */
62
- CsrfTokenHandler._mTokens = new Map();
67
+ CsrfTokenHandler.prototype.getUsedToken = function (oDataConfig) {
68
+ const sTokenName = this._findTokenName(oDataConfig);
63
69
 
64
- /**
65
- * Resolves CSRF placeholders to actual values within a data configuration object.
66
- *
67
- * @private
68
- * @ui5-restricted sap.ui.integration
69
- * @param {object} oDataConfig Data configuration object
70
- * @returns {Promise<object>} A promise which resolves with the data configuration object containing resolved CSRF token values
71
- */
72
- CsrfTokenHandler.prototype.resolveToken = function (oDataConfig) {
73
- var oCsrfTokenContext,
74
- oCsrfTokenConfig;
70
+ return this._mTokens.get(sTokenName);
71
+ };
75
72
 
73
+ CsrfTokenHandler.prototype.fetchValue = function (sTokenName, oTokenConfig) {
76
74
  // clone the data configuration,
77
75
  // so we won't change the original settings
78
- oDataConfig = merge({}, oDataConfig);
79
-
80
- oCsrfTokenContext = this._findCsrfPlaceholder(oDataConfig);
81
-
82
- if (!oCsrfTokenContext) {
83
- return Promise.resolve(oDataConfig);
84
- }
85
-
86
- oCsrfTokenConfig = this._getCsrfConfig(oCsrfTokenContext.tokenName);
87
-
88
- if (this._oHost) {
89
- return this._oHost.getCsrfToken(oCsrfTokenConfig)
90
- .then(function (sTokenValue) {
91
- if (!sTokenValue) {
92
- return this._resolveTokenByUrl(oDataConfig, oCsrfTokenContext);
93
- }
94
-
95
- this._replaceCsrfPlaceholder(oCsrfTokenContext, sTokenValue);
96
- return oDataConfig;
97
- }.bind(this))
98
- .catch(function (sError) {
99
- return Promise.reject(sError);
100
- });
101
- }
76
+ oTokenConfig = merge({}, oTokenConfig);
102
77
 
103
- return this._resolveTokenByUrl(oDataConfig, oCsrfTokenContext);
78
+ return this._requestToken(sTokenName, oTokenConfig.data);
104
79
  };
105
80
 
106
- CsrfTokenHandler.prototype._resolveTokenByUrl = function (oDataConfig, oCsrfTokenContext) {
107
- var sCsrfTokenName = oCsrfTokenContext.tokenName,
108
- sCsrfUrl = this._getCsrfConfig(sCsrfTokenName).data.request.url;
109
-
110
- if (CsrfTokenHandler._mTokens.has(sCsrfUrl)) {
111
- return CsrfTokenHandler._mTokens.get(sCsrfUrl).then(function (sTokenValue) {
112
- this._replaceCsrfPlaceholder(oCsrfTokenContext, sTokenValue);
113
- return oDataConfig;
114
- }.bind(this));
115
- }
81
+ /**
82
+ * @deprecated As of version 1.120.0
83
+ */
84
+ CsrfTokenHandler.prototype.fetchValueByHost = function (oTokenConfig) {
85
+ if (this._oHost) {
86
+ // clone the data configuration,
87
+ // so we won't change the original settings
88
+ oTokenConfig = merge({}, oTokenConfig);
116
89
 
117
- if (sCsrfTokenName) {
118
- return this._requestToken(oDataConfig, oCsrfTokenContext);
90
+ return this._oHost.getCsrfToken(oTokenConfig);
119
91
  }
120
92
 
121
- return Promise.resolve(oDataConfig);
93
+ return Promise.resolve();
122
94
  };
123
95
 
124
- /**
125
- * Saves a reference to the DataProviderFactory to create own data requests.
126
- * Those CSRF placeholders may contain destinations placeholders which need to be resolved prior to making the request.
127
- *
128
- * @private
129
- * @ui5-restricted sap.ui.integration
130
- * @param {sap.ui.integration.util.DataProviderFactory} oDataProviderFactory the factory
131
- */
132
- CsrfTokenHandler.prototype.setDataProviderFactory = function (oDataProviderFactory) {
133
- this._oDataProviderFactory = oDataProviderFactory;
96
+ CsrfTokenHandler.prototype.onTokenFetched = function (sTokenName, sTokenValue) {
97
+ this._setCsrfModelValue(sTokenName, sTokenValue);
134
98
  };
135
99
 
136
100
  /**
137
101
  * Sets the host which is used to resolve tokens.
138
102
  * @param {sap.ui.integration.Host} oHost The host.
103
+ * @deprecated As of version 1.121.0
139
104
  */
140
105
  CsrfTokenHandler.prototype.setHost = function (oHost) {
141
106
  this._oHost = oHost;
142
107
  };
143
108
 
144
109
  /**
145
- * Checks if a response contains an expired CSRF Token.
146
- * @param {object} oResponse The response.
110
+ * @param {Response} oResponse The response.
111
+ * @returns {boolean} Whether the response contains an expired CSRF token
147
112
  */
148
113
  CsrfTokenHandler.prototype.isExpiredToken = function (oResponse) {
149
114
  if (!oResponse) {
@@ -154,63 +119,94 @@ sap.ui.define([
154
119
  return sXCSRFHeader && sXCSRFHeader.toLowerCase() === "required" && oResponse.status === 403;
155
120
  };
156
121
 
122
+ CsrfTokenHandler.prototype.replacePlaceholders = function (vData) {
123
+ if (!vData) {
124
+ return vData;
125
+ }
126
+
127
+ if (Array.isArray(vData)) {
128
+ return vData.map((vValue) => {
129
+ this.replacePlaceholders(vValue);
130
+ });
131
+ }
132
+
133
+ if (isPlainObject(vData)) {
134
+ const oItemCopy = {};
135
+
136
+ for (const sKey in vData) {
137
+ oItemCopy[sKey] = this.replacePlaceholders(vData[sKey]);
138
+ }
139
+
140
+ return oItemCopy;
141
+ }
142
+
143
+ if (typeof vData === "string") {
144
+ const oToken = this._mTokens.get(this._getTokenName(vData));
145
+
146
+ if (oToken) {
147
+ return vData.replace(rPattern, oToken.value);
148
+ }
149
+ }
150
+
151
+ return vData;
152
+ };
153
+
157
154
  /**
158
- * Executes a CSRF token request based on the data configuration object which contains a CSRF placeholder in its headers property.
155
+ * Executes a CSRF token request
159
156
  *
160
157
  * @private
161
- * @param {object} oDataConfig Data configuration object
158
+ * @param {string} sTokenName Token name in the current card
159
+ * @param {object} oTokenDataConfig Token data configuration
162
160
  * @returns {Promise} Promise which resolves with the CSRF token
163
161
  */
164
- CsrfTokenHandler.prototype._requestToken = function (oDataConfig, oCsrfTokenContext) {
165
- var sCsrfTokenName = oCsrfTokenContext.tokenName,
166
- oCsrfTokenConfig = this._getCsrfConfig(sCsrfTokenName);
167
-
168
- if (!sCsrfTokenName || !oCsrfTokenConfig) {
162
+ CsrfTokenHandler.prototype._requestToken = function (sTokenName, oTokenDataConfig) {
163
+ if (!sTokenName || !oTokenDataConfig) {
169
164
  return Promise.reject("CSRF definition is incorrect");
170
165
  }
171
166
 
172
- var pTokenValuePromise = new Promise(function (resolve, reject) {
173
- var oCsrfTokenDataProvider = this._oDataProviderFactory.create(oCsrfTokenConfig.data);
174
- oCsrfTokenDataProvider.getData().then(function (oData) {
175
- var sTokenValue,
176
- oModel;
177
-
178
- if (oCsrfTokenConfig.data.path) {
179
- oModel = new JSONModel(oData);
180
- sTokenValue = oModel.getProperty(oCsrfTokenConfig.data.path);
181
- oModel.destroy();
182
- } else {
183
- sTokenValue = oCsrfTokenDataProvider.getLastResponse().headers.get(TOKEN_DEFAULT_HEADER);
184
- }
167
+ const oTokenDataProvider = this._oDataProviderFactory.create(oTokenDataConfig);
168
+ const pTokenValue = oTokenDataProvider.getData().then((oData) => {
169
+ var sTokenValue,
170
+ oModel;
171
+
172
+ if (oTokenDataConfig.path) {
173
+ oModel = new JSONModel(oData);
174
+ sTokenValue = oModel.getProperty(oTokenDataConfig.path);
175
+ oModel.destroy();
176
+ } else {
177
+ sTokenValue = oTokenDataProvider.getLastResponse().headers.get(TOKEN_DEFAULT_HEADER);
178
+ }
185
179
 
186
- resolve(sTokenValue);
187
- }).catch(function () {
188
- reject("CSRF token cannot be resolved");
189
- });
190
- }.bind(this));
180
+ return sTokenValue;
181
+ }).catch(function () {
182
+ throw "CSRF token cannot be resolved";
183
+ });
191
184
 
192
- this._registerToken(oCsrfTokenConfig, pTokenValuePromise);
185
+ /**
186
+ * @deprecated As of version 1.120.0
187
+ */
188
+ if (this._oHost) {
189
+ this._oHost.csrfTokenFetched(oTokenDataConfig, pTokenValue);
190
+ }
193
191
 
194
- return pTokenValuePromise.then(function (sTokenValue) {
195
- this._replaceCsrfPlaceholder(oCsrfTokenContext, sTokenValue);
196
- return oDataConfig;
197
- }.bind(this));
192
+ return pTokenValue;
198
193
  };
199
194
 
200
- /**
201
- * Deletes a token based on a data configuration object which contains a CSRF placeholder in its headers property.
202
- *
203
- * @private
204
- * @ui5-restricted sap.ui.integration
205
- * @param {object} oDataConfig Data configuration object
206
- */
207
- CsrfTokenHandler.prototype.resetTokenByRequest = function (oDataConfig) {
208
- var oCsrfTokenContext = this._findCsrfPlaceholder(oDataConfig);
209
- if (!oCsrfTokenContext) {
195
+ CsrfTokenHandler.prototype.setExpiredTokenByRequest = function (oDataConfig) {
196
+ const sTokenName = this._findTokenName(oDataConfig);
197
+
198
+ if (!sTokenName) {
210
199
  return;
211
200
  }
212
201
 
213
- this._deleteRegisteredToken(this._getCsrfConfig(oCsrfTokenContext.tokenName));
202
+ this._mTokens.get(sTokenName).setExpired();
203
+
204
+ /**
205
+ * @deprecated As of version 1.120.0
206
+ */
207
+ if (this._oHost) {
208
+ this._oHost.csrfTokenExpired(this._getTokenConfig(sTokenName));
209
+ }
214
210
  };
215
211
 
216
212
  /**
@@ -220,17 +216,17 @@ sap.ui.define([
220
216
  * @param {string} sCsrfTokenName The name of the CSRF object.
221
217
  * @returns {object} The CSRF configuration object.
222
218
  */
223
- CsrfTokenHandler.prototype._getCsrfConfig = function (sCsrfTokenName) {
219
+ CsrfTokenHandler.prototype._getTokenConfig = function (sCsrfTokenName) {
224
220
  return this._oConfiguration[sCsrfTokenName];
225
221
  };
226
222
 
227
- CsrfTokenHandler.prototype._replaceCsrfPlaceholder = function (oCsrfTokenContext, sTokenValue) {
228
- var sPlaceholder = oCsrfTokenContext.object[oCsrfTokenContext.key];
229
-
230
- oCsrfTokenContext.object[oCsrfTokenContext.key] = sPlaceholder.replace("{{csrfTokens." + oCsrfTokenContext.tokenName + "}}", sTokenValue);
223
+ CsrfTokenHandler.prototype._setCsrfModelValue = function (sTokenName, sTokenValue) {
224
+ this._oModel.setProperty(`/${sTokenName}`, {
225
+ value: sTokenValue
226
+ });
231
227
  };
232
228
 
233
- CsrfTokenHandler.prototype._findCsrfPlaceholder = function (oConfig) {
229
+ CsrfTokenHandler.prototype._findTokenName = function (oConfig) {
234
230
  var vValue,
235
231
  sKey,
236
232
  sTokenName;
@@ -239,19 +235,15 @@ sap.ui.define([
239
235
  vValue = oConfig[sKey];
240
236
 
241
237
  if (typeof vValue === "string") {
242
- sTokenName = this._getCsrfTokenName(vValue);
238
+ sTokenName = this._getTokenName(vValue);
243
239
 
244
240
  if (sTokenName) {
245
- return {
246
- object: oConfig,
247
- key: sKey,
248
- tokenName: sTokenName
249
- };
241
+ return sTokenName;
250
242
  }
251
243
  }
252
244
 
253
245
  if (isPlainObject(vValue)) {
254
- vValue = this._findCsrfPlaceholder(vValue);
246
+ vValue = this._findTokenName(vValue);
255
247
 
256
248
  if (vValue) {
257
249
  return vValue;
@@ -264,35 +256,25 @@ sap.ui.define([
264
256
 
265
257
  /**
266
258
  * Returns the name from the CSRF placeholder.
267
- * For input of <code>{{csrfTokens.token1}}</code>, it will return <code>"token1"</code>
259
+ * For input of <code>{csrfTokens>/token1}</code>, it will return <code>"token1"</code>
268
260
  *
269
261
  * @private
270
262
  * @param {string} sString the CSRF placeholder
271
263
  * @returns {string} The name of the placeholder or empty string
272
264
  */
273
- CsrfTokenHandler.prototype._getCsrfTokenName = function (sString) {
274
- var aMatches = sString.match(rPattern);
275
- if (!aMatches) {
276
- return "";
277
- }
278
-
279
- return aMatches[1];
280
- };
265
+ CsrfTokenHandler.prototype._getTokenName = function (sString) {
266
+ const rBinding = /\{csrfTokens\>\/([^\/]*).*}/;
267
+ let aMatches = sString.match(rBinding);
281
268
 
282
- CsrfTokenHandler.prototype._registerToken = function (mCSRFTokenConfig, pTokenValuePromise) {
283
- CsrfTokenHandler._mTokens.set(mCSRFTokenConfig.data.request.url, pTokenValuePromise);
269
+ if (!aMatches) {
270
+ aMatches = sString.match(rPattern);
284
271
 
285
- if (this._oHost) {
286
- this._oHost.csrfTokenFetched(mCSRFTokenConfig, pTokenValuePromise);
272
+ if (!aMatches) {
273
+ return "";
274
+ }
287
275
  }
288
- };
289
276
 
290
- CsrfTokenHandler.prototype._deleteRegisteredToken = function (mCSRFTokenConfig) {
291
- CsrfTokenHandler._mTokens.delete(mCSRFTokenConfig.data.request.url);
292
-
293
- if (this._oHost) {
294
- this._oHost.csrfTokenExpired(mCSRFTokenConfig);
295
- }
277
+ return aMatches[1];
296
278
  };
297
279
 
298
280
  return CsrfTokenHandler;
@@ -29,7 +29,7 @@ sap.ui.define([
29
29
  * @extends sap.ui.base.ManagedObject
30
30
  *
31
31
  * @author SAP SE
32
- * @version 1.120.10
32
+ * @version 1.121.1
33
33
  *
34
34
  * @constructor
35
35
  * @private
@@ -41,6 +41,13 @@ sap.ui.define([
41
41
  metadata: {
42
42
  library: "sap.ui.integration",
43
43
  properties: {
44
+ /**
45
+ * Data provider configuration from the manifest
46
+ */
47
+ configuration: {
48
+ type: "object"
49
+ },
50
+
44
51
  /**
45
52
  * Data settings.
46
53
  */
@@ -110,6 +117,7 @@ sap.ui.define([
110
117
 
111
118
  DataProvider.prototype.init = function () {
112
119
  this._iCurrentRequestNumber = 0;
120
+ this._oDependencies = new Set();
113
121
  };
114
122
 
115
123
  /**
@@ -132,10 +140,10 @@ sap.ui.define([
132
140
 
133
141
  /**
134
142
  * Sets a list of <code>sap.ui.integration.util.DataProvider</code> which will be considered dependencies of the current one.
135
- * @param {sap.ui.integration.util.DataProvider[]} aDependencies The list of dependencies.
143
+ * @param {sap.ui.integration.util.DataProvider} oDependency The new dependency.
136
144
  */
137
- DataProvider.prototype.setDependencies = function (aDependencies) {
138
- this._aDependencies = aDependencies;
145
+ DataProvider.prototype.addDependency = function (oDependency) {
146
+ this._oDependencies.add(oDependency);
139
147
  };
140
148
 
141
149
  /**
@@ -189,6 +197,12 @@ sap.ui.define([
189
197
  this._pInitialRequestPromise = pDataUpdate;
190
198
  }
191
199
 
200
+ pDataUpdate.catch((e) => {
201
+ this.fireError({
202
+ message: e
203
+ });
204
+ });
205
+
192
206
  return pDataUpdate;
193
207
  };
194
208
 
@@ -263,7 +277,7 @@ sap.ui.define([
263
277
  ManagedObject.prototype.destroy.apply(this, arguments);
264
278
  };
265
279
 
266
- DataProvider.prototype.getInitialRequestPromise = function () {
280
+ DataProvider.prototype.load = function () {
267
281
  return this._pInitialRequestPromise;
268
282
  };
269
283
 
@@ -303,11 +317,10 @@ sap.ui.define([
303
317
  * @return {Promise} Promise which fulfills when all dependencies are ready.
304
318
  */
305
319
  DataProvider.prototype._waitDependencies = function () {
306
- var aDependencies = this._aDependencies || [],
307
- aPromises = [];
320
+ const aPromises = [];
308
321
 
309
- aDependencies.forEach(function (oDataProvider) {
310
- aPromises.push(oDataProvider.getInitialRequestPromise());
322
+ this._oDependencies.forEach((oDependency) => {
323
+ aPromises.push(oDependency.load());
311
324
  });
312
325
 
313
326
  return Promise.all(aPromises);
@@ -14,7 +14,8 @@ sap.ui.define([
14
14
  "sap/ui/integration/util/ExtensionDataProvider",
15
15
  "sap/ui/integration/util/JSONBindingHelper",
16
16
  "sap/ui/integration/util/BindingHelper",
17
- "sap/ui/integration/util/CsrfTokenHandler"
17
+ "sap/ui/integration/util/CsrfTokenHandler",
18
+ "sap/ui/model/json/JSONModel"
18
19
  ], function (
19
20
  EventProvider,
20
21
  Log,
@@ -26,7 +27,8 @@ sap.ui.define([
26
27
  ExtensionDataProvider,
27
28
  JSONBindingHelper,
28
29
  BindingHelper,
29
- CsrfTokenHandler
30
+ CsrfTokenHandler,
31
+ JSONModel
30
32
  ) {
31
33
  "use strict";
32
34
 
@@ -38,7 +40,7 @@ sap.ui.define([
38
40
  * When destroyed, all data providers created by this class are also destroyed.
39
41
  *
40
42
  * @author SAP SE
41
- * @version 1.120.10
43
+ * @version 1.121.1
42
44
  *
43
45
  * @private
44
46
  * @ui5-restricted sap.ui.integration, shell-toolkit
@@ -53,15 +55,20 @@ sap.ui.define([
53
55
 
54
56
  this._oDestinations = mSettings.destinations;
55
57
  this._oExtension = mSettings.extension;
56
- this._oCsrfTokenHandler = mSettings.csrfTokenHandler;
57
58
  this._oCard = mSettings.card;
58
59
  this._oEditor = mSettings.editor;
59
60
  this._oHost = mSettings.host;
60
61
 
61
62
  if (mSettings.csrfTokensConfig) {
63
+ this._oCsrfTokensModel = new JSONModel();
62
64
  this._oCsrfTokenHandler = new CsrfTokenHandler({
65
+ /**
66
+ * @deprecated As of version 1.121.0
67
+ */
63
68
  host: mSettings.host,
64
- configuration: mSettings.csrfTokensConfig
69
+ configuration: mSettings.csrfTokensConfig,
70
+ model: this._oCsrfTokensModel,
71
+ dataProviderFactory: this
65
72
  });
66
73
  }
67
74
 
@@ -154,31 +161,41 @@ sap.ui.define([
154
161
  oDataProvider = new ExtensionDataProvider(oSettings, this._oExtension);
155
162
  }
156
163
 
164
+ oDataProvider.setConfiguration(oDataConfiguration);
165
+
157
166
  if (oCard) {
158
167
  oDataProvider.setCard(oCard);
159
168
  BindingHelper.propagateModels(oCard, oDataProvider);
160
169
  } else if (oEditor) {
161
170
  BindingHelper.propagateModels(oEditor, oDataProvider);
162
171
  }
163
- oDataProvider.bindObject("/");
164
172
 
173
+ oDataProvider.bindObject("/");
165
174
  oDataProvider.setDestinations(this._oDestinations);
166
175
 
167
- if (this._oCsrfTokenHandler) {
168
- oDataProvider.setCsrfTokenHandler(this._oCsrfTokenHandler);
169
- this._oCsrfTokenHandler.setDataProviderFactory(this);
170
- }
171
-
172
176
  if (oDataProvider.isA("sap.ui.integration.util.IServiceDataProvider")) {
173
177
  oDataProvider.createServiceInstances(oServiceManager);
174
178
  }
175
179
 
176
180
  this._aDataProviders.push(oDataProvider);
177
181
 
182
+ if (this._oCsrfTokenHandler) {
183
+ const oToken = this._oCsrfTokenHandler.getUsedToken(oDataConfiguration);
184
+
185
+ if (oToken) {
186
+ oDataProvider.setCsrfTokenHandler(this._oCsrfTokenHandler);
187
+ oDataProvider.addDependency(oToken);
188
+ oDataProvider.setModel(this._oCsrfTokensModel, "csrfTokens");
189
+ }
190
+ }
191
+
178
192
  if (bIsFilter) {
179
193
  this._aFiltersProviders.push(oDataProvider);
180
194
  } else {
181
- oDataProvider.setDependencies(this._aFiltersProviders);
195
+ // TODO: check if the data provider uses filters before adding them to the dependency list
196
+ this._aFiltersProviders.forEach((oFilterDataProvider) => {
197
+ oDataProvider.addDependency(oFilterDataProvider);
198
+ });
182
199
  }
183
200
 
184
201
  return oDataProvider;
@@ -207,6 +224,9 @@ sap.ui.define([
207
224
  DataProviderFactory.prototype.setHost = function (oHost) {
208
225
  this._oHost = oHost;
209
226
 
227
+ /**
228
+ * @deprecated As of version 1.121.0
229
+ */
210
230
  if (this._oCsrfTokenHandler) {
211
231
  this._oCsrfTokenHandler.setHost(oHost);
212
232
  }
@@ -29,7 +29,7 @@ sap.ui.define([
29
29
  * @extends sap.ui.base.Object
30
30
  *
31
31
  * @author SAP SE
32
- * @version 1.120.10
32
+ * @version 1.121.1
33
33
  *
34
34
  * @constructor
35
35
  * @param {sap.ui.integration.Host} oHost The Host which will be used for resolving destinations.
@@ -35,7 +35,7 @@ sap.ui.define([
35
35
  * Utility class for handling errors in the cards.
36
36
  *
37
37
  * @author SAP SE
38
- * @version 1.120.10
38
+ * @version 1.121.1
39
39
  *
40
40
  * @private
41
41
  * @ui5-restricted
@@ -132,7 +132,8 @@ sap.ui.define([
132
132
 
133
133
  ErrorHandler.configureErrorInfo = function (mErrorInfo, oCard) {
134
134
  var sDetails = oCard.getTranslatedText("CARD_MANIFEST") + "\n" + formatJson(oCard._oCardManifest.getJson()) + "\n\n" +
135
- oCard.getTranslatedText("CARD_STACK_TRACE") + "\n" + new Error().stack;
135
+ oCard.getTranslatedText("CARD_STACK_TRACE") + "\n" +
136
+ (mErrorInfo.originalError ? mErrorInfo.originalError.stack : new Error().stack);
136
137
 
137
138
  return {
138
139
  type: CardBlockingMessageType.Error,
@@ -17,7 +17,7 @@ sap.ui.define(["sap/ui/integration/util/DataProvider"], function (DataProvider)
17
17
  * @extends sap.ui.integration.util.DataProvider
18
18
  *
19
19
  * @author SAP SE
20
- * @version 1.120.10
20
+ * @version 1.121.1
21
21
  *
22
22
  * @constructor
23
23
  * @private