@crystaldesign/diva-backoffice 24.7.0-beta.49 → 24.7.0-beta.50

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 (2) hide show
  1. package/build/esm/index.js +55 -26
  2. package/package.json +3 -3
@@ -4,7 +4,7 @@ import 'antd/dist/reset.css';
4
4
  import { Button, Spin, Descriptions, Select as Select$1, Alert, Modal as Modal$2, Input, Popover, Typography, Divider, Avatar, Form as Form$1, Radio, DatePicker, Checkbox, InputNumber, Card, Tooltip as Tooltip$1, Upload, Collapse, Space, Switch, Table as Table$1, Popconfirm, Tabs, Image, Progress, Slider, Breadcrumb, List as List$1, Result as Result$1, message, Layout, Cascader, Row, Col, Skeleton, Drawer, ConfigProvider, theme } from 'antd';
5
5
  import { observer } from 'mobx-react-lite';
6
6
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
7
- import { getLogger, CoreError, useDivaCore, useTranslation, DivaUtils } from '@crystaldesign/diva-core';
7
+ import { getLogger, DivaError, useDivaCore, useTranslation, DivaUtils } from '@crystaldesign/diva-core';
8
8
  import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
9
9
  import _createClass from '@babel/runtime/helpers/createClass';
10
10
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
@@ -644,7 +644,9 @@ var _default$d = /*#__PURE__*/function () {
644
644
  _context.t0 = _context["catch"](1);
645
645
  throw new Error('Error while saving');
646
646
  case 12:
647
- throw new CoreError(code, error);
647
+ throw new DivaError(error, {
648
+ code: code
649
+ });
648
650
  case 13:
649
651
  return _context.abrupt("return", r.text());
650
652
  case 14:
@@ -766,7 +768,9 @@ var _default$d = /*#__PURE__*/function () {
766
768
  _context3.t0 = _context3["catch"](1);
767
769
  throw new Error('Error while saving');
768
770
  case 12:
769
- throw new CoreError(code, error);
771
+ throw new DivaError(error, {
772
+ code: code
773
+ });
770
774
  case 13:
771
775
  return _context3.abrupt("return", r.text());
772
776
  case 14:
@@ -873,7 +877,9 @@ var _default$d = /*#__PURE__*/function () {
873
877
  _context5.t0 = _context5["catch"](1);
874
878
  throw new Error('Error while deleting');
875
879
  case 12:
876
- throw new CoreError(code, error);
880
+ throw new DivaError(error, {
881
+ code: code
882
+ });
877
883
  case 13:
878
884
  return _context5.abrupt("return", r.text());
879
885
  case 14:
@@ -1107,7 +1113,7 @@ var _default$d = /*#__PURE__*/function () {
1107
1113
  }
1108
1114
  });
1109
1115
  this._socket.on('error', function (error) {
1110
- LOG$a.error('Error on connection!', error);
1116
+ LOG$a.error(new DivaError('Error on connection', error));
1111
1117
  });
1112
1118
  this._socket.on('connect_error', function (error) {
1113
1119
  LOG$a.log("connect_error due to ".concat(error.message));
@@ -14025,11 +14031,11 @@ function useFormData (_ref) {
14025
14031
  case 30:
14026
14032
  _context2.prev = 30;
14027
14033
  _context2.t0 = _context2["catch"](11);
14028
- if (!(_context2.t0 instanceof CoreError && _context2.t0.code)) {
14034
+ if (!(_context2.t0 instanceof DivaError && _context2.t0.name)) {
14029
14035
  _context2.next = 38;
14030
14036
  break;
14031
14037
  }
14032
- errorCode = _context2.t0.code;
14038
+ errorCode = _context2.t0.name;
14033
14039
  item = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.find(function (item) {
14034
14040
  var _item$onError;
14035
14041
  return (_item$onError = item.onError) === null || _item$onError === void 0 ? void 0 : _item$onError[errorCode];
@@ -16139,15 +16145,18 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
16139
16145
  form.setFieldsValue(_objectSpread$v(_objectSpread$v({}, state.data), data));
16140
16146
  };
16141
16147
  var onErrorInternal = function onErrorInternal(err, errorText) {
16142
- if (err instanceof CoreError && err.code) {
16148
+ if (err instanceof DivaError && err.name) {
16143
16149
  var _state$configuration$;
16144
- LOG$7.error(err, err.code);
16145
- var errorTranslation = (_state$configuration$ = state.configuration.onError) === null || _state$configuration$ === void 0 ? void 0 : _state$configuration$[err.code];
16150
+ LOG$7.error(err);
16151
+ var errorTranslation = (_state$configuration$ = state.configuration.onError) === null || _state$configuration$ === void 0 ? void 0 : _state$configuration$[err.name];
16146
16152
  onError === null || onError === void 0 || onError(errorTranslation ? t(errorTranslation, {
16147
16153
  defaultValue: errorText
16148
16154
  }) : err.message, false);
16149
16155
  } else {
16150
- LOG$7.error(err, 'BACKO_0002');
16156
+ LOG$7.error(new DivaError('An unexpected error prevented finishing', {
16157
+ cause: err,
16158
+ code: 'BACKO_0002'
16159
+ }));
16151
16160
  onError === null || onError === void 0 || onError(errorText !== null && errorText !== void 0 ? errorText : 'Es konnte nicht gespeichert werden, versuchen Sie es später nochmal.');
16152
16161
  }
16153
16162
  };
@@ -17568,7 +17577,12 @@ var CustomCell = function CustomCell(_ref2) {
17568
17577
  case 7:
17569
17578
  _context.prev = 7;
17570
17579
  _context.t0 = _context["catch"](0);
17571
- LOG$6.error('Save failed', 'BACKO_0002', _context.t0);
17580
+ LOG$6.error(new DivaError('Save failed', {
17581
+ cause: _context.t0,
17582
+ custom: {
17583
+ code: 'BACKO_0002'
17584
+ }
17585
+ }));
17572
17586
  case 10:
17573
17587
  case "end":
17574
17588
  return _context.stop();
@@ -18580,7 +18594,10 @@ function BulkAction(_ref6) {
18580
18594
  case 34:
18581
18595
  _context4.prev = 34;
18582
18596
  _context4.t6 = _context4["catch"](2);
18583
- LOG$5.error(_context4.t6, 'BACKO_0002');
18597
+ LOG$5.error(new DivaError('Error changing data', {
18598
+ cause: _context4.t6,
18599
+ code: 'BACKO_0002'
18600
+ }));
18584
18601
  setShowPopover(t('errorcodes._source.labels.error.BACKO_0002'));
18585
18602
  case 38:
18586
18603
  (_action$callback = action.callback) === null || _action$callback === void 0 || _action$callback.call(action, updatedData);
@@ -20161,15 +20178,15 @@ function useTableData (_ref) {
20161
20178
  case 16:
20162
20179
  _context3.prev = 16;
20163
20180
  _context3.t0 = _context3["catch"](7);
20164
- if (!(_context3.t0 instanceof CoreError && _context3.t0.code)) {
20181
+ if (!(_context3.t0 instanceof DivaError && _context3.t0.name)) {
20165
20182
  _context3.next = 22;
20166
20183
  break;
20167
20184
  }
20168
- if (!((_configuration$onErro = configuration.onError) !== null && _configuration$onErro !== void 0 && _configuration$onErro[_context3.t0.code])) {
20185
+ if (!((_configuration$onErro = configuration.onError) !== null && _configuration$onErro !== void 0 && _configuration$onErro[_context3.t0.name])) {
20169
20186
  _context3.next = 22;
20170
20187
  break;
20171
20188
  }
20172
- setError((_configuration$onErro2 = configuration.onError) === null || _configuration$onErro2 === void 0 ? void 0 : _configuration$onErro2[_context3.t0.code]);
20189
+ setError((_configuration$onErro2 = configuration.onError) === null || _configuration$onErro2 === void 0 ? void 0 : _configuration$onErro2[_context3.t0.name]);
20173
20190
  return _context3.abrupt("return", 0);
20174
20191
  case 22:
20175
20192
  setError(_context3.t0.message);
@@ -20271,7 +20288,7 @@ function useTableData (_ref) {
20271
20288
  var onGlobalFilterSelect = function onGlobalFilterSelect(value) {
20272
20289
  var _configuration$filter19;
20273
20290
  if (!((_configuration$filter19 = configuration.filter) !== null && _configuration$filter19 !== void 0 && _configuration$filter19.select)) {
20274
- LOG$4.error('No global select filter defiend');
20291
+ LOG$4.error(new DivaError('No global select filter defiend'));
20275
20292
  return;
20276
20293
  }
20277
20294
  var newGlobalFilter = _objectSpread$m({}, globalFilter);
@@ -20288,7 +20305,7 @@ function useTableData (_ref) {
20288
20305
  var onGlobalFilterToggle = function onGlobalFilterToggle() {
20289
20306
  var _configuration$filter20;
20290
20307
  if (!((_configuration$filter20 = configuration.filter) !== null && _configuration$filter20 !== void 0 && _configuration$filter20.toggle)) {
20291
- LOG$4.error('No global toggle filter defiend');
20308
+ LOG$4.error(new DivaError('No global toggle filter defined'));
20292
20309
  return;
20293
20310
  }
20294
20311
  var toggleFilter = {};
@@ -20306,7 +20323,7 @@ function useTableData (_ref) {
20306
20323
  var onGlobalFilterSearch = function onGlobalFilterSearch(value) {
20307
20324
  var _configuration$filter21;
20308
20325
  if (!((_configuration$filter21 = configuration.filter) !== null && _configuration$filter21 !== void 0 && _configuration$filter21.search)) {
20309
- LOG$4.error('No global search filter defiend');
20326
+ LOG$4.error(new DivaError('No global search filter defiend'));
20310
20327
  return;
20311
20328
  }
20312
20329
  var newGlobalFilter = _objectSpread$m(_objectSpread$m({}, globalFilter), {}, {
@@ -20330,7 +20347,7 @@ function useTableData (_ref) {
20330
20347
  var onGlobalFilterPeriod = function onGlobalFilterPeriod(from, to) {
20331
20348
  var _configuration$filter23;
20332
20349
  if (!((_configuration$filter23 = configuration.filter) !== null && _configuration$filter23 !== void 0 && _configuration$filter23.period)) {
20333
- LOG$4.error('No global period filter defiend');
20350
+ LOG$4.error(new DivaError('No global period filter defiend'));
20334
20351
  return;
20335
20352
  }
20336
20353
  var newGlobalFilter = _objectSpread$m({}, globalFilter);
@@ -26741,17 +26758,20 @@ function useSelectOrCreateData (_ref) {
26741
26758
  }
26742
26759
  }, [data]);
26743
26760
  var internalOnError = function internalOnError(e, message, code) {
26744
- if (e instanceof CoreError && e.code) {
26761
+ if (e instanceof DivaError && e.name) {
26745
26762
  var _configuration$onErro;
26746
- var errorCode = e.code;
26763
+ var errorCode = e.name;
26747
26764
  var errorMessage = (_configuration$onErro = configuration.onError) === null || _configuration$onErro === void 0 ? void 0 : _configuration$onErro[errorCode];
26765
+ LOG$3.error(e);
26748
26766
  if (errorMessage) {
26749
- LOG$3.error(e, errorCode);
26750
26767
  onError === null || onError === void 0 || onError(errorMessage, false);
26751
26768
  return;
26752
26769
  }
26753
26770
  }
26754
- LOG$3.error(e, code);
26771
+ LOG$3.error(new DivaError(message, {
26772
+ cause: e,
26773
+ code: code
26774
+ }));
26755
26775
  onError === null || onError === void 0 || onError(message);
26756
26776
  };
26757
26777
  var fetch = React.useMemo(function () {
@@ -27488,7 +27508,10 @@ function useJsonEditorData (id, setCanSave, onChange, onError) {
27488
27508
  case 14:
27489
27509
  _context.prev = 14;
27490
27510
  _context.t0 = _context["catch"](0);
27491
- LOG$2.error(_context.t0, 'BACKO_0002');
27511
+ LOG$2.error(new DivaError('Error saving data', {
27512
+ cause: _context.t0,
27513
+ code: 'BACKO_0002'
27514
+ }));
27492
27515
  onError === null || onError === void 0 || onError(_context.t0.message);
27493
27516
  case 18:
27494
27517
  case "end":
@@ -28190,7 +28213,13 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
28190
28213
  return _createClass(ErrorBoundary, [{
28191
28214
  key: "componentDidCatch",
28192
28215
  value: function componentDidCatch(error, errorInfo) {
28193
- LOG$1.error(error, 'BACKO_0001', errorInfo);
28216
+ LOG$1.error(new DivaError('Error in Backoffice', {
28217
+ cause: error,
28218
+ custom: {
28219
+ errorInfo: errorInfo,
28220
+ code: 'BACKO_0001'
28221
+ }
28222
+ }));
28194
28223
  }
28195
28224
  }, {
28196
28225
  key: "render",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-backoffice",
3
- "version": "24.7.0-beta.49",
3
+ "version": "24.7.0-beta.50",
4
4
  "license": "COMMERCIAL",
5
5
  "devDependencies": {
6
6
  "@testing-library/jest-dom": "^5.15.0",
@@ -15,7 +15,7 @@
15
15
  "dependencies": {
16
16
  "@ant-design/icons": "5.0.1",
17
17
  "@babel/runtime": "7.18.0",
18
- "@crystaldesign/spreadsheet": "24.7.0-beta.49",
18
+ "@crystaldesign/spreadsheet": "24.7.0-beta.50",
19
19
  "@google/model-viewer": "3.4.0",
20
20
  "@tinymce/tinymce-react": "^3.13.0",
21
21
  "ag-charts-community": "^8.0.1",
@@ -50,5 +50,5 @@
50
50
  },
51
51
  "module": "build/esm/index.js",
52
52
  "types": "./build/types/backoffice/src/index.d.ts",
53
- "gitHead": "b3e730649c5930e63ec22770e58c6b042f3f87e4"
53
+ "gitHead": "a0f1c378ec13a800840c44643de4b9e42fd14e83"
54
54
  }