@agilemotion/oui-react-js 1.7.1 → 1.7.3

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 (58) hide show
  1. package/dist/ApplicationManager.js +8 -3
  2. package/dist/BasicAppHome.js +1 -1
  3. package/dist/DynamicJS.js +5 -2
  4. package/dist/InteractionPortalAppHome.js +5 -0
  5. package/dist/RestService.js +344 -0
  6. package/dist/RestUtils.js +22 -8
  7. package/dist/Utils.js +9 -0
  8. package/dist/components/AlertBar.js +3 -0
  9. package/dist/components/DataGrid.js +72 -43
  10. package/dist/components/DocumentTemplateDesigner.css +2 -2
  11. package/dist/components/DocumentTemplateDesigner.js +43 -31
  12. package/dist/components/DocumentTemplateDesignerComponent.css +15 -0
  13. package/dist/components/DocumentTemplateDesignerComponent.js +368 -72
  14. package/dist/components/DocumentTemplatePlaceholderDialog.js +6 -6
  15. package/dist/components/DocumentViewer.css +10 -0
  16. package/dist/components/DocumentViewer.js +95 -45
  17. package/dist/components/Graph.js +12 -2
  18. package/dist/components/GraphNode.js +0 -2
  19. package/dist/components/{DocumentViewerComponent.js → PDFViewer.js} +2 -2
  20. package/dist/components/TabPage.js +7 -3
  21. package/dist/components/TabPanel.js +13 -3
  22. package/dist/components/TableCellContent.js +21 -4
  23. package/dist/components/TemplateDesigner.css +3 -2
  24. package/dist/components/TemplateDesigner.js +3 -1
  25. package/dist/components/TemplateItemEventHandler.js +30 -15
  26. package/dist/components/Toolbar.js +3 -1
  27. package/dist/components/Tree.js +5 -5
  28. package/dist/components/WordDocumentViewer.js +167 -0
  29. package/dist/components/dashboard/SideMenuModuleDashboard.js +1 -3
  30. package/dist/components/dashboard/components/blackDashboard/sidebar/ModuleMenuSidebar.css +4 -0
  31. package/dist/components/dashboard/components/blackDashboard/sidebar/ModuleMenuSidebar.js +131 -159
  32. package/dist/components/form/AutoComplete.js +28 -6
  33. package/dist/components/form/BaseField.js +3 -3
  34. package/dist/components/form/DatePicker.js +7 -2
  35. package/dist/components/form/FieldSet.js +24 -8
  36. package/dist/components/form/Form.js +4 -3
  37. package/dist/components/form/GridField.js +13 -37
  38. package/dist/components/form/LookupField.js +23 -23
  39. package/dist/components/form/RadioGroup.js +2 -1
  40. package/dist/components/form/Section.js +4 -0
  41. package/dist/components/form/SelectItem.js +2 -3
  42. package/dist/components/form/TextField.js +6 -6
  43. package/dist/components/layout/Layout.js +24 -15
  44. package/dist/components/menu/MenuButton.js +12 -7
  45. package/dist/components/menu/MenuLink.js +6 -0
  46. package/dist/components/signatures/AgilitySignaturePanel.js +33 -14
  47. package/dist/components/signatures/DocumentContainer.css +26 -1
  48. package/dist/components/signatures/DocumentContainer.js +55 -10
  49. package/dist/components/signatures/SignatureInputProps.js +59 -9
  50. package/dist/components/signatures/SignatureTemplateDesigner.js +71 -38
  51. package/dist/event/ActionHandlers.js +7 -4
  52. package/dist/event/RouteActionHandler.js +3 -3
  53. package/dist/event/ScriptActionHandler.js +2 -2
  54. package/dist/event/ServiceCallActionHandler.js +73 -28
  55. package/dist/js/Docs.js +57 -10
  56. package/dist/view/Dashboard.js +3 -3
  57. package/package.json +10 -5
  58. package/dist/components/DocumentView.css +0 -4
@@ -654,6 +654,9 @@ class ApplicationManager {
654
654
  var _this3 = this;
655
655
  return function (parameterConfig) {
656
656
  let eventData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
657
+ if (parameterConfig.static) {
658
+ return parameterConfig.value;
659
+ }
657
660
  let expression = parameterConfig.value.toString();
658
661
  let isEvent = expression.startsWith('$event.data');
659
662
  if (isEvent) {
@@ -725,7 +728,9 @@ class ApplicationManager {
725
728
  if (this.graphs.length > 0) {
726
729
  let graph = this.graphs[this.graphs.length - 1];
727
730
  let view = graph.config.isWindow ? this.getTopWindowView() : this.getTopAnchorView();
728
- this.closeView(view.config.id, false);
731
+ if (view) {
732
+ this.closeView(view.config.id, false);
733
+ }
729
734
  if (!_Utils.default.isNull(graph.anchorHistoryElement) && routeBackToAnchor) {
730
735
  this.loadAnchor(graph);
731
736
  }
@@ -755,11 +760,11 @@ class ApplicationManager {
755
760
  graph.anchorView = this.getTopAnchorView(); //= this.getCurrentView();
756
761
  graph.anchorHistoryElement = this.navHistory[this.navHistory.length - 1];
757
762
  }
758
- graph.init();
763
+ this.graphs.push(graph);
759
764
  for (const parameterValue of parameterValues) {
760
765
  graph.model[parameterValue.name] = parameterValue.value;
761
766
  }
762
- this.graphs.push(graph);
767
+ graph.init();
763
768
  }
764
769
  getTopAnchorView() {
765
770
  for (let i = this.views.length - 1; i >= 0; i--) {
@@ -99,7 +99,7 @@ const BasicAppHome = props => {
99
99
  }, /*#__PURE__*/_react.default.createElement("div", {
100
100
  className: "w-100 h-100"
101
101
  }, /*#__PURE__*/_react.default.createElement(_ThemeProvider.default, {
102
- theme: (0, _core.createMuiTheme)({
102
+ theme: (0, _core.createTheme)({
103
103
  palette: {
104
104
  primary: {
105
105
  main: dashboardSettings.systemProfileDto.firstCorporateBrandColor
package/dist/DynamicJS.js CHANGED
@@ -68,12 +68,14 @@ class DynamicJS {
68
68
  * @param componentId
69
69
  * @param isScriplet
70
70
  * @param event
71
+ * @param scriptConfig
71
72
  */
72
73
  executeScript = (() => {
73
74
  var _this2 = this;
74
75
  return function (name, scriptCode, componentId) {
75
76
  let isScriplet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
76
77
  let event = arguments.length > 4 ? arguments[4] : undefined;
78
+ let scriptConfig = arguments.length > 5 ? arguments[5] : undefined;
77
79
  let parsedScript = _this2.parseScript(scriptCode, componentId, isScriplet);
78
80
  let eventParam = null;
79
81
  if (!_Utils.default.isNull(event)) {
@@ -90,7 +92,8 @@ class DynamicJS {
90
92
  }
91
93
  } catch (e) {
92
94
  console.error(e);
93
- throw new Error("Error Executing script : " + parsedScript + " - " + e.message);
95
+ console.error("Error Executing script : ", scriptConfig?.lines);
96
+ throw new Error(e.message);
94
97
  }
95
98
  return null;
96
99
  };
@@ -130,7 +133,7 @@ class DynamicJS {
130
133
  for (const line of script.lines) {
131
134
  scriptBody += _this3.parseScriptLine(line, valuesMap);
132
135
  }
133
- return _this3.executeScript(name, scriptBody, componentId, false, event);
136
+ return _this3.executeScript(name, scriptBody, componentId, false, event, script);
134
137
  };
135
138
  })();
136
139
  }
@@ -47,6 +47,11 @@ const InteractionPortalAppHome = /*#__PURE__*/_react.default.memo( /*#__PURE__*/
47
47
  }, e => {
48
48
  console.log(e);
49
49
  });
50
+ (0, _RestUtils.sendRequest)(location + _ApplicationManager.default.getContextRoot() + '/auth/api/v1/user/find', response => {
51
+ _ApplicationManager.default.setUserDetails(response);
52
+ }, e => {
53
+ console.log(e);
54
+ });
50
55
  setLoading(false);
51
56
  }, []);
52
57
  _react.default.useEffect(() => {
@@ -0,0 +1,344 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.location = exports.invokeRpc = exports.invokeRest = void 0;
7
+ var _Utils = _interopRequireDefault(require("./Utils"));
8
+ var _reactPromiseTracker = require("react-promise-tracker");
9
+ var _ApplicationManager = _interopRequireDefault(require("./ApplicationManager"));
10
+ var _Event = _interopRequireDefault(require("./event/Event"));
11
+ var _Observable = _interopRequireDefault(require("./event/Observable"));
12
+ var _EventType = _interopRequireDefault(require("./event/EventType"));
13
+ var _propTypes = require("prop-types");
14
+ var _RestUtils = require("./RestUtils");
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
+ const location = exports.location = window.location.protocol + '//' + window.location.hostname;
17
+ const status = response => {
18
+ if (response.ok) {
19
+ return Promise.resolve(response);
20
+ } else {
21
+ return Promise.reject(response);
22
+ }
23
+ };
24
+ const json = response => {
25
+ return response.text();
26
+ };
27
+ class RestService {
28
+ isParamValueNull(paramValue) {
29
+ if (_Utils.default.isNull(paramValue)) {
30
+ return true;
31
+ }
32
+ return paramValue.hasOwnProperty('value') ? _Utils.default.isNull(paramValue.value) : false;
33
+ }
34
+ invokeRest(request) {
35
+ let service = request.service;
36
+ let url = service.url.startsWith('http://') || service.url.startsWith('https://') ? service.url : location + `${_ApplicationManager.default.getContextRoot() + service.url}`;
37
+ let requestBody = null;
38
+ let headers = service.headers;
39
+ return new Promise((resolve, reject) => {
40
+ if (!_Utils.default.isNull(service.parameters)) {
41
+ let queryString = '';
42
+ let pathParameters = '';
43
+ let requestBodyParamFound = false;
44
+ for (const parameter of service.parameters) {
45
+ let parameterValue = _ApplicationManager.default.resolveParameterValue(parameter, request.event ? request.event.data : null);
46
+ if (!_Utils.default.isNull(parameter.validator) && !_Utils.default.evaluateBooleanExpression(parameter.validator.nullable, parameter.name) && this.isParamValueNull(parameterValue)) {
47
+ reject({
48
+ errorType: 'INVALID_PARAMETER',
49
+ parameter
50
+ });
51
+ return;
52
+ }
53
+ let httpParameterType = parameter.httpParameterType;
54
+ if (_Utils.default.isNull(httpParameterType)) {
55
+ httpParameterType = 'QUERY_PARAMETER';
56
+ }
57
+ if (httpParameterType === 'QUERY_PARAMETER') {
58
+ if (!_Utils.default.isNull(parameterValue)) {
59
+ if (queryString.length > 0) {
60
+ queryString += '&';
61
+ }
62
+ if (!_Utils.default.isNull(service.includeParameterTypes) && service.includeParameterTypes === true) {
63
+ queryString += parameterValue.type + ':';
64
+ }
65
+ queryString += parameter.name + '=';
66
+ queryString += typeof parameterValue.value === 'string' || typeof parameterValue.value === 'number' ? parameterValue.value : JSON.stringify(parameterValue.value);
67
+ }
68
+ }
69
+ if (httpParameterType === 'PATH_VARIABLE') {
70
+ if (!_Utils.default.isNull(parameterValue)) {
71
+ pathParameters += '/' + (typeof parameterValue.value === 'object' ? JSON.stringify(parameterValue.value) : parameterValue.instanceType === 'TypedValue' ? parameterValue.value : parameterValue);
72
+ }
73
+ }
74
+ if (httpParameterType === 'HEADER') {
75
+ if (!_Utils.default.isNull(parameterValue)) {
76
+ if (!headers) {
77
+ headers = {};
78
+ }
79
+ headers[parameter.name] = parameterValue.value;
80
+ }
81
+ }
82
+ if (httpParameterType === 'REQUEST_BODY') {
83
+ if (requestBodyParamFound) {
84
+ reject(new Error("Only one request body is permitted"));
85
+ return;
86
+ } else {
87
+ if (!this.isParamValueNull(parameterValue)) {
88
+ requestBody = parameterValue.instanceType === 'TypedValue' ? parameterValue.value : parameterValue;
89
+ if (typeof requestBody === 'object') {
90
+ requestBody.type = parameterValue.type;
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ if (pathParameters.length > 0) {
97
+ url += pathParameters;
98
+ }
99
+ if (queryString.length > 0) {
100
+ url += '?';
101
+ url += queryString;
102
+ }
103
+ }
104
+ let contentType = null;
105
+ if (!_Utils.default.isNull(headers)) {
106
+ contentType = headers['Content-Type'];
107
+ }
108
+ if (requestBody !== null && service.method === 'GET') {
109
+ throw new Error('A request body parameter cannot be specified for a GET request');
110
+ }
111
+ if (requestBody !== null || service.method === 'POST') {
112
+ this.fetchWithCustomConfig({
113
+ url,
114
+ serviceType: request.service.type,
115
+ method: 'POST',
116
+ secure: !service.url.startsWith('http://'),
117
+ body: requestBody,
118
+ headers
119
+ }).then(response => {
120
+ let path = _Utils.default.getPropertyChainPath(request.returnValueBinding);
121
+ if (!_Utils.default.isNull(path.valueObject) && !_Utils.default.isNull(path.property)) {
122
+ path.valueObject[path.property] = response;
123
+ }
124
+ resolve(this.processSuccessfulResponseData(request.component, response, request.viewId, request.successMessage));
125
+ }).catch(e => {
126
+ reject(e);
127
+ });
128
+ } else if (contentType === 'application/pdf' || contentType === 'application/vnd.ms-excel') {
129
+ this.fetchWithCustomConfig({
130
+ url,
131
+ serviceType: request.service.type,
132
+ secure: request.secure,
133
+ method: 'GET',
134
+ download: true,
135
+ headers
136
+ }).then(() => {
137
+ resolve();
138
+ }).catch(e => {
139
+ reject(e);
140
+ });
141
+ } else {
142
+ this.fetchWithCustomConfig({
143
+ url,
144
+ serviceType: request.service.type,
145
+ secure: !service.url.startsWith('http://'),
146
+ method: 'GET',
147
+ headers
148
+ }).then(response => {
149
+ let path = _Utils.default.getPropertyChainPath(request.returnValueBinding);
150
+ if (!_Utils.default.isNull(path.valueObject) && !_Utils.default.isNull(path.property)) {
151
+ path.valueObject[path.property] = response;
152
+ }
153
+ resolve(this.processSuccessfulResponseData(request.component, response, request.viewId, request.successMessage));
154
+ }).catch(e => {
155
+ reject(e);
156
+ });
157
+ }
158
+ });
159
+ }
160
+ invokeRpc(request) {
161
+ let rpcRequest = {};
162
+ rpcRequest.id = request.viewId;
163
+ let split = request.service.serviceId.split('.');
164
+ rpcRequest.service = split[1];
165
+ rpcRequest.method = request.service.procedureName;
166
+ let module = split[0].toLowerCase();
167
+ return new Promise((resolve, reject) => {
168
+ if (!_Utils.default.isNull(request.service.parameters) && request.service.parameters.length > 0) {
169
+ rpcRequest.parameters = [];
170
+ for (let i = 0; i < request.service.parameters.length; i++) {
171
+ let parameterConfig = request.service.parameters[i];
172
+ let parameter = {};
173
+ parameter.name = parameterConfig.name;
174
+ parameter.index = parameterConfig.index;
175
+ let val = _ApplicationManager.default.resolveParameterValue(parameterConfig, request.event ? request.event.data : null);
176
+ if (!_Utils.default.isNull(val)) {
177
+ parameter.value = val.value;
178
+ parameter.type = val.type;
179
+ }
180
+ if (typeof parameter.value === 'undefined') {
181
+ parameter.value = null;
182
+ }
183
+ if (_Utils.default.isNull(parameter.type)) {
184
+ parameter.type = 'String';
185
+ }
186
+ if (!_Utils.default.isNull(parameterConfig.validator) && _Utils.default.evaluateBooleanExpression(parameterConfig.validator.nullable, parameterConfig.name) === false && this.isParamValueNull(parameter)) {
187
+ console.error('INVALID PARAMETER : ', parameter);
188
+ reject({
189
+ errorType: 'INVALID_PARAMETER',
190
+ parameter
191
+ });
192
+ return;
193
+ }
194
+ rpcRequest.parameters.push(parameter);
195
+ }
196
+ }
197
+ this.fetchWithCustomConfig({
198
+ url: location + _ApplicationManager.default.getContextRoot() + '/' + module + '/api/v1/rpc/invoke',
199
+ serviceType: request.service.type,
200
+ secure: true,
201
+ method: 'POST',
202
+ body: rpcRequest,
203
+ track: true,
204
+ contentType: 'application/json'
205
+ }).then(response => {
206
+ if (request.returnValueBinding) {
207
+ let path = _Utils.default.getPropertyChainPath(request.returnValueBinding);
208
+ if (!_Utils.default.isNull(path.valueObject) && !_Utils.default.isNull(path.property)) {
209
+ path.valueObject[path.property] = response;
210
+ }
211
+ }
212
+ resolve(this.processSuccessfulResponseData(request.component, response, request.viewId, request.successMessage));
213
+ }).catch(e => {
214
+ reject(e);
215
+ });
216
+ });
217
+ }
218
+ fetchWithCustomConfig(request) {
219
+ const accessToken = sessionStorage.getItem('accessToken');
220
+ const idToken = sessionStorage.getItem('idToken');
221
+ let data = request.body ? request.body instanceof FormData ? request.body : JSON.stringify(request.body) : null;
222
+ let fetchConfig = request.config;
223
+ return new Promise((resolve, reject) => {
224
+ if (_Utils.default.isNull(fetchConfig)) {
225
+ if (_Utils.default.isNull(request.secure) || request.secure === true) {
226
+ fetchConfig = {
227
+ method: _Utils.default.isNull(request.method) ? 'GET' : request.method,
228
+ headers: {
229
+ ...request.headers,
230
+ 'Content-Type': request.contentType ? request.contentType : 'application/x-www-form-urlencoded',
231
+ 'Authorization': 'Bearer ' + accessToken,
232
+ 'idToken': idToken
233
+ },
234
+ body: data
235
+ };
236
+ } else {
237
+ fetchConfig = {
238
+ method: _Utils.default.isNull(request.method) ? 'GET' : request.method,
239
+ headers: {
240
+ ...request.headers,
241
+ 'Content-Type': request.contentType ? request.contentType : 'application/json',
242
+ 'Accept': request.accept ? request.accept : 'application/json'
243
+ },
244
+ body: data
245
+ };
246
+ }
247
+ if ('rest' === request.serviceType && !(request.body instanceof FormData)) {
248
+ fetchConfig.headers['Content-Type'] = request.contentType ? request.contentType : 'application/json; charset=utf-8';
249
+ }
250
+ if (request.body instanceof FormData) {
251
+ delete fetchConfig.headers['Content-Type'];
252
+ fetchConfig.headers['Accept'] = request.accept ? request.accept : 'application/json';
253
+ }
254
+ }
255
+ if (request.contentType) {
256
+ fetchConfig.headers['Content-Type'] = request.contentType;
257
+ }
258
+ let url = request.url;
259
+ if (request.download) {
260
+ if (url.indexOf('?') < 0) {
261
+ url += '?';
262
+ } else {
263
+ url += '&';
264
+ }
265
+ url += 'access_token=' + accessToken;
266
+ url += '&idToken=' + idToken;
267
+ url += '&themePrimaryColor=' + encodeURIComponent(_ApplicationManager.default.getApplicationPrimaryColor());
268
+ url += '&themeSecondaryColor=' + encodeURIComponent(_ApplicationManager.default.getApplicationSecondaryColor());
269
+ window.open(encodeURI(url), '_blank');
270
+ } else {
271
+ if (_Utils.default.isNull(request.track) || request.track === true) {
272
+ (0, _reactPromiseTracker.trackPromise)(this.executeFetch(url, fetchConfig, request.viewId, request.successMessage).then(response => {
273
+ resolve(response);
274
+ }).catch(e => {
275
+ reject(e);
276
+ }));
277
+ } else {
278
+ this.executeFetch(url, fetchConfig, request.viewId, request.successMessage).then(response => {
279
+ resolve(response);
280
+ }).catch(e => {
281
+ reject(e);
282
+ });
283
+ }
284
+ }
285
+ });
286
+ }
287
+ executeFetch(url, fetchConfig, viewId, successMessage) {
288
+ return new Promise((resolve, reject) => {
289
+ fetch(encodeURI(url), fetchConfig).then(status).then(json).then(data => {
290
+ resolve(this.processSuccessfulResponseData(null, data, viewId, successMessage));
291
+ }).catch(e => {
292
+ console.error(e);
293
+ if (e.status === 401 && !url.endsWith('/logout')) {
294
+ _ApplicationManager.default.clear();
295
+ _ApplicationManager.default.navigate('/login');
296
+ }
297
+ reject(e);
298
+ });
299
+ });
300
+ }
301
+ processSuccessfulResponseData(component, data, viewId, successMessage) {
302
+ let response;
303
+ if (!_Utils.default.isNull(data) && data.toString().trim().length === 0) {
304
+ response = null;
305
+ } else if (typeof data === 'object' || _Utils.default.isNull(data) || data.toString().trim().length === 0) {
306
+ response = data;
307
+ } else {
308
+ try {
309
+ response = JSON.parse(data);
310
+ } catch (ignored) {
311
+ response = data;
312
+ }
313
+ }
314
+ if (response && response.dataType === 'message') {
315
+ let event = new _Event.default(_ApplicationManager.default, viewId, response);
316
+ _Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
317
+ if (component !== null) {
318
+ event = new _Event.default(component, viewId, response);
319
+ _Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
320
+ }
321
+ } else if (!_Utils.default.isNull(successMessage)) {
322
+ let message = {
323
+ messageType: 'SUCCESS',
324
+ message: _ApplicationManager.default.populateTemplate(successMessage, response)
325
+ };
326
+ let event = new _Event.default(_ApplicationManager.default, viewId, message);
327
+ _Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
328
+ if (component !== null) {
329
+ event = new _Event.default(component, viewId, message);
330
+ _Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
331
+ }
332
+ }
333
+ return response;
334
+ }
335
+ }
336
+ const instance = new RestService();
337
+ const invokeRpc = request => {
338
+ return instance.invokeRpc(request);
339
+ };
340
+ exports.invokeRpc = invokeRpc;
341
+ const invokeRest = request => {
342
+ return instance.invokeRest(request);
343
+ };
344
+ exports.invokeRest = invokeRest;
package/dist/RestUtils.js CHANGED
@@ -34,6 +34,7 @@ class RestUtils {
34
34
  let event = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
35
35
  let url = service.url.startsWith('http://') || service.url.startsWith('https://') ? service.url : location + `${_ApplicationManager.default.getContextRoot() + service.url}`;
36
36
  let requestBody = null;
37
+ let headers = service.headers;
37
38
  if (!_Utils.default.isNull(service.parameters)) {
38
39
  let queryString = '';
39
40
  let pathParameters = '';
@@ -71,6 +72,14 @@ class RestUtils {
71
72
  pathParameters += '/' + (typeof parameterValue.value === 'object' ? JSON.stringify(parameterValue.value) : parameterValue.instanceType === 'TypedValue' ? parameterValue.value : parameterValue);
72
73
  }
73
74
  }
75
+ if (httpParameterType === 'HEADER') {
76
+ if (!_Utils.default.isNull(parameterValue)) {
77
+ if (!headers) {
78
+ headers = {};
79
+ }
80
+ headers[parameter.name] = parameterValue;
81
+ }
82
+ }
74
83
  if (httpParameterType === 'REQUEST_BODY') {
75
84
  if (requestBodyParamFound) {
76
85
  console.error('Only one request body is permitted');
@@ -97,7 +106,6 @@ class RestUtils {
97
106
  url += queryString;
98
107
  }
99
108
  }
100
- let headers = service.headers;
101
109
  let contentType = null;
102
110
  if (!_Utils.default.isNull(headers)) {
103
111
  contentType = headers['Content-Type'];
@@ -180,11 +188,13 @@ class RestUtils {
180
188
  }
181
189
  this.doFetch(location + _ApplicationManager.default.getContextRoot() + '/' + module + '/api/v1/rpc/invoke', response => {
182
190
  if (!_Utils.default.isNull(viewId) && !_Utils.default.isNull(component)) {
183
- let path = _Utils.default.getPropertyChainPath(returnValueBinding);
184
- if (!_Utils.default.isNull(path.valueObject) && !_Utils.default.isNull(path.property)) {
185
- path.valueObject[path.property] = response;
191
+ if (returnValueBinding) {
192
+ let path = _Utils.default.getPropertyChainPath(returnValueBinding);
193
+ if (!_Utils.default.isNull(path.valueObject) && !_Utils.default.isNull(path.property)) {
194
+ path.valueObject[path.property] = response;
195
+ }
186
196
  }
187
- this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_SUCCESS, response.data);
197
+ this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_SUCCESS, response);
188
198
  if (successCallback !== null) {
189
199
  successCallback(response);
190
200
  }
@@ -196,15 +206,16 @@ class RestUtils {
196
206
  if (!_Utils.default.isNull(viewId) && !_Utils.default.isNull(component)) {
197
207
  this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_FAILURE);
198
208
  }
199
- }, true, 'POST', false, request, viewId, successMessage, true);
209
+ }, true, 'POST', false, request, viewId, successMessage, true, 'application/json');
200
210
  }
201
211
  doPostData(url, successCallback, errorCallback, secure, data, viewId, successMessage) {
202
212
  this.fetchWithCustomConfig(url, successCallback, errorCallback, secure, null, 'POST', false, data, 'rest');
203
213
  }
204
214
  doFetch(url, successCallback, errorCallback, secure, method, download, body, viewId, successMessage, track) {
205
- this.fetchWithCustomConfig(url, successCallback, errorCallback, secure, null, method, download, body, null, viewId, successMessage, track);
215
+ let contentType = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
216
+ this.fetchWithCustomConfig(url, successCallback, errorCallback, secure, null, method, download, body, null, viewId, successMessage, track, contentType);
206
217
  }
207
- fetchWithCustomConfig(url, successCallback, errorCallback, secure, config, method, download, body, serviceType, viewId, successMessage, track) {
218
+ fetchWithCustomConfig(url, successCallback, errorCallback, secure, config, method, download, body, serviceType, viewId, successMessage, track, contentType) {
208
219
  const accessToken = sessionStorage.getItem('accessToken');
209
220
  const idToken = sessionStorage.getItem('idToken');
210
221
  let data = body ? body instanceof FormData ? body : JSON.stringify(body) : null;
@@ -238,6 +249,9 @@ class RestUtils {
238
249
  fetchConfig.headers['Accept'] = 'application/json';
239
250
  }
240
251
  }
252
+ if (contentType) {
253
+ fetchConfig.headers['Content-Type'] = contentType;
254
+ }
241
255
  if (download) {
242
256
  if (url.indexOf('?') < 0) {
243
257
  url += '?';
package/dist/Utils.js CHANGED
@@ -345,5 +345,14 @@ class Utils {
345
345
  let component = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
346
346
  Utils.publishErrorMessage('A system error has accured. Please try again later', viewId, component);
347
347
  };
348
+ static base64ToArrayBuffer = base64 => {
349
+ const binaryString = window.atob(base64);
350
+ const len = binaryString.length;
351
+ const bytes = new Uint8Array(len);
352
+ for (let i = 0; i < len; i++) {
353
+ bytes[i] = binaryString.charCodeAt(i);
354
+ }
355
+ return bytes.buffer;
356
+ };
348
357
  }
349
358
  exports.default = Utils;
@@ -43,6 +43,9 @@ const AlertBar = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
43
43
  }
44
44
  }
45
45
  _Observable.default.addSubscriptions(eventHandlingConfig, props.handle, props.viewId);
46
+ return () => {
47
+ _Observable.default.clearComponentEventListeners(props.handle);
48
+ };
46
49
  }, []);
47
50
  const api = () => {
48
51
  return {