@crystaldesign/diva-backoffice 26.14.0-beta.15 → 26.14.0-beta.16

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.
@@ -24991,6 +24991,18 @@ function ItemSelector(_ref) {
24991
24991
  });
24992
24992
  }
24993
24993
 
24994
+ /**
24995
+ * The text a form configuration names for an error it expects (`onError`, keyed by the error code), or undefined for
24996
+ * any other error.
24997
+ *
24998
+ * @param error - What the save threw
24999
+ * @param onError - The form's texts by error code
25000
+ * @returns The text for the error, if the form names one
25001
+ */
25002
+ function formErrorText(error, onError) {
25003
+ return error instanceof DivaError ? onError === null || onError === void 0 ? void 0 : onError[error.name] : undefined;
25004
+ }
25005
+
24994
25006
  var LOG$o = getLogger('Backoffice', 'Form');
24995
25007
  function toNamePath$1(name) {
24996
25008
  if (name === undefined || name === '') return [];
@@ -25117,9 +25129,8 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
25117
25129
  }();
25118
25130
  var onErrorInternal = function onErrorInternal(err, errorText) {
25119
25131
  if (err instanceof DivaError && err.name) {
25120
- var _state$configuration$;
25121
25132
  LOG$o.error(err);
25122
- var errorTranslation = (_state$configuration$ = state.configuration.onError) === null || _state$configuration$ === void 0 ? void 0 : _state$configuration$[err.name];
25133
+ var errorTranslation = formErrorText(err, state.configuration.onError);
25123
25134
  onError === null || onError === void 0 || onError(errorTranslation ? t(errorTranslation, {
25124
25135
  defaultValue: errorText
25125
25136
  }) : err.message, false);
@@ -32292,6 +32303,10 @@ function BulkAction(_ref8) {
32292
32303
  _useState12 = _slicedToArray(_useState11, 2),
32293
32304
  showPopover = _useState12[0],
32294
32305
  setShowPopover = _useState12[1];
32306
+ var _useState13 = useState(),
32307
+ _useState14 = _slicedToArray(_useState13, 2),
32308
+ failedEntryId = _useState14[0],
32309
+ setFailedEntryId = _useState14[1];
32295
32310
  var allowed = useMemo(function () {
32296
32311
  // if isValue is not set check if all fields have the same value, otherwise check if all fields have the given isValue
32297
32312
  if (!action.rule) return true;
@@ -32356,6 +32371,7 @@ function BulkAction(_ref8) {
32356
32371
  }, [selectedData, action]);
32357
32372
  var onClickError = function onClickError() {
32358
32373
  if (hasSelected && !allowed) {
32374
+ setFailedEntryId(undefined);
32359
32375
  setShowPopover(resolveText(action.errorText));
32360
32376
  return false;
32361
32377
  }
@@ -32367,27 +32383,28 @@ function BulkAction(_ref8) {
32367
32383
  var callback = /*#__PURE__*/function () {
32368
32384
  var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(updatedData) {
32369
32385
  var _action$callback2;
32370
- var _action$callback, apiInterface, data, i, dataEntry;
32386
+ var _action$callback, apiInterface, data, requestId, i, dataEntry, _resolveText, form;
32371
32387
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
32372
32388
  while (1) switch (_context5.prev = _context5.next) {
32373
32389
  case 0:
32390
+ setFailedEntryId(undefined);
32374
32391
  if (!(action.actionType === 'Callback')) {
32375
- _context5.next = 3;
32392
+ _context5.next = 4;
32376
32393
  break;
32377
32394
  }
32378
32395
  (_action$callback = action.callback) === null || _action$callback === void 0 || _action$callback.call(action, selectedData);
32379
32396
  return _context5.abrupt("return");
32380
- case 3:
32397
+ case 4:
32381
32398
  apiInterface = new _default$c({
32382
32399
  apiInterface: action.apiInterface,
32383
32400
  type: 'Form'
32384
32401
  }, root);
32385
32402
  data = [];
32386
- _context5.prev = 5;
32403
+ _context5.prev = 6;
32387
32404
  i = 0;
32388
- case 7:
32405
+ case 8:
32389
32406
  if (!(i < selectedData.length)) {
32390
- _context5.next = 36;
32407
+ _context5.next = 40;
32391
32408
  break;
32392
32409
  }
32393
32410
  if (progressBar) {
@@ -32395,59 +32412,65 @@ function BulkAction(_ref8) {
32395
32412
  }
32396
32413
  dataEntry = selectedData[i];
32397
32414
  if (!apiInterface.canUpdate) {
32398
- _context5.next = 18;
32415
+ _context5.next = 20;
32399
32416
  break;
32400
32417
  }
32418
+ requestId = dataEntry._id;
32419
+ // if form/updatedData only contianed certain fields
32401
32420
  _context5.t0 = data;
32402
- _context5.next = 14;
32421
+ _context5.next = 16;
32403
32422
  return apiInterface.update(_objectSpread$26(_objectSpread$26({}, dataEntry), updatedData), dataEntry, action.apiCallbackMapping);
32404
- case 14:
32423
+ case 16:
32405
32424
  _context5.t1 = _context5.sent;
32406
32425
  _context5.t0.push.call(_context5.t0, _context5.t1);
32407
- _context5.next = 32;
32426
+ _context5.next = 36;
32408
32427
  break;
32409
- case 18:
32428
+ case 20:
32410
32429
  if (!apiInterface.canCreate) {
32411
- _context5.next = 26;
32430
+ _context5.next = 29;
32412
32431
  break;
32413
32432
  }
32433
+ requestId = dataEntry._id;
32414
32434
  _context5.t2 = data;
32415
- _context5.next = 22;
32435
+ _context5.next = 25;
32416
32436
  return apiInterface.create(dataEntry, updatedData);
32417
- case 22:
32437
+ case 25:
32418
32438
  _context5.t3 = _context5.sent;
32419
32439
  _context5.t2.push.call(_context5.t2, _context5.t3);
32420
- _context5.next = 32;
32440
+ _context5.next = 36;
32421
32441
  break;
32422
- case 26:
32442
+ case 29:
32423
32443
  if (!apiInterface.canDelete) {
32424
- _context5.next = 32;
32444
+ _context5.next = 36;
32425
32445
  break;
32426
32446
  }
32447
+ requestId = state.selected[i];
32427
32448
  _context5.t4 = data;
32428
- _context5.next = 30;
32449
+ _context5.next = 34;
32429
32450
  return apiInterface["delete"](state.selected[i], updatedData);
32430
- case 30:
32451
+ case 34:
32431
32452
  _context5.t5 = _context5.sent;
32432
32453
  _context5.t4.push.call(_context5.t4, _context5.t5);
32433
- case 32:
32454
+ case 36:
32434
32455
  if (progressBar) progressBar.setProgressBarPercentage(Math.floor(i / selectedData.length * 100));
32435
- case 33:
32456
+ case 37:
32436
32457
  i++;
32437
- _context5.next = 7;
32458
+ _context5.next = 8;
32438
32459
  break;
32439
- case 36:
32460
+ case 40:
32440
32461
  state.onUpdate(data);
32441
32462
  if (progressBar) {
32442
32463
  progressBar.setProgressBarPercentage(100);
32443
32464
  progressBar.setProgressBarOpen(false);
32444
32465
  progressBar.setProgressBarPercentage(0);
32445
32466
  }
32446
- _context5.next = 45;
32467
+ _context5.next = 52;
32447
32468
  break;
32448
- case 40:
32449
- _context5.prev = 40;
32450
- _context5.t6 = _context5["catch"](5);
32469
+ case 44:
32470
+ _context5.prev = 44;
32471
+ _context5.t6 = _context5["catch"](6);
32472
+ setFailedEntryId(requestId);
32473
+ if (data.length) state.onUpdate(data);
32451
32474
  if (progressBar) {
32452
32475
  progressBar.setProgressBarOpen(false);
32453
32476
  progressBar.setProgressBarPercentage(0);
@@ -32456,14 +32479,17 @@ function BulkAction(_ref8) {
32456
32479
  cause: _context5.t6,
32457
32480
  code: 'BACKO_0002'
32458
32481
  }));
32459
- setShowPopover(t('errorcodes._source.labels.error.BACKO_0002'));
32460
- case 45:
32482
+ // A form can name the text for an error it expects, e.g. a taken product slot (MEDIA_0011) when render jobs are
32483
+ // finished; any other error is a generic failure.
32484
+ form = action.actionType === 'Modal' && action.type === 'Form' && action.id ? root.configurationStore.getConfiguration(action.id, 'Form') : undefined;
32485
+ setShowPopover((_resolveText = resolveText(formErrorText(_context5.t6, form === null || form === void 0 ? void 0 : form.onError))) !== null && _resolveText !== void 0 ? _resolveText : t('errorcodes._source.labels.error.BACKO_0002'));
32486
+ case 52:
32461
32487
  (_action$callback2 = action.callback) === null || _action$callback2 === void 0 || _action$callback2.call(action, updatedData);
32462
- case 46:
32488
+ case 53:
32463
32489
  case "end":
32464
32490
  return _context5.stop();
32465
32491
  }
32466
- }, _callee5, null, [[5, 40]]);
32492
+ }, _callee5, null, [[6, 44]]);
32467
32493
  }));
32468
32494
  return function callback(_x2) {
32469
32495
  return _ref9.apply(this, arguments);
@@ -32479,6 +32505,8 @@ function BulkAction(_ref8) {
32479
32505
  style: {
32480
32506
  marginRight: 5
32481
32507
  }
32508
+ }), failedEntryId && /*#__PURE__*/jsx("div", {
32509
+ children: failedEntryId
32482
32510
  }), showPopover]
32483
32511
  }),
32484
32512
  open: !!showPopover,
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=formErrorText.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formErrorText.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/tests/unit/ui/Form/formErrorText.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The text a form configuration names for an error it expects (`onError`, keyed by the error code), or undefined for
3
+ * any other error.
4
+ *
5
+ * @param error - What the save threw
6
+ * @param onError - The form's texts by error code
7
+ * @returns The text for the error, if the form names one
8
+ */
9
+ export declare function formErrorText(error: unknown, onError?: {
10
+ [code: string]: string;
11
+ }): string | undefined;
12
+ //# sourceMappingURL=formErrorText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formErrorText.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/Form/formErrorText.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CAEtG"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/Form/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAiB,YAAY,EAAgC,MAAM,MAAM,CAAC;AAGjF,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAMnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAe5C,MAAM,WAAW,KAAK;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,qIAAqI;IACrI,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QA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QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,IAAI,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAiWD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,OAG1C;;YAjV0B,MAAM,IAAI;cAAY,MAAM,GAAG;;YAA/B,MAAM,IAAI;cAAY,MAAM,GAAG;;AAmV1D,wBAAuD;AAEvD,cAAc,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/Table/BaseTable/index.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,EAAwB,MAAM,UAAU,CAAC;AAgCvD,eAAO,MAAM,UAAU,mDAAoB,CAAC;AAwB5C,UAAU,KAAK,CAAC,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CACjB;0BAEqB,CAAC,SAAS,MAAM,aAAa,KAAK,CAAC,CAAC,CAAC;;;AAsY3D,wBAAsC;AACtC,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/Table/BaseTable/index.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,EAAwB,MAAM,UAAU,CAAC;AAkCvD,eAAO,MAAM,UAAU,mDAAoB,CAAC;AAwB5C,UAAU,KAAK,CAAC,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CACjB;0BAEqB,CAAC,SAAS,MAAM,aAAa,KAAK,CAAC,CAAC,CAAC;;;AAqY3D,wBAAsC;AACtC,cAAc,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-backoffice",
3
- "version": "26.14.0-beta.15",
3
+ "version": "26.14.0-beta.16",
4
4
  "description": "Ant Design backoffice shell (configuration modules), the Diva Data Engine component hosting the IDM and enricher editors, and the Produkt Onboarding component hosting the Assortment Manager.",
5
5
  "license": "COMMERCIAL",
6
6
  "devDependencies": {
@@ -16,16 +16,16 @@
16
16
  "dependencies": {
17
17
  "@ant-design/icons": "6.3.4",
18
18
  "@babel/runtime": "7.24.7",
19
- "@crystaldesign/classification": "26.14.0-beta.15",
20
- "@crystaldesign/content-box": "26.14.0-beta.15",
21
- "@crystaldesign/content-item": "26.14.0-beta.15",
22
- "@crystaldesign/diva-agent": "26.14.0-beta.15",
23
- "@crystaldesign/diva-core": "26.14.0-beta.15",
24
- "@crystaldesign/diva-utils": "26.14.0-beta.15",
25
- "@crystaldesign/mass-configurator": "26.14.0-beta.15",
26
- "@crystaldesign/media-upload": "26.14.0-beta.15",
27
- "@crystaldesign/rtf-editor": "26.14.0-beta.15",
28
- "@crystaldesign/spreadsheet": "26.14.0-beta.15",
19
+ "@crystaldesign/classification": "26.14.0-beta.16",
20
+ "@crystaldesign/content-box": "26.14.0-beta.16",
21
+ "@crystaldesign/content-item": "26.14.0-beta.16",
22
+ "@crystaldesign/diva-agent": "26.14.0-beta.16",
23
+ "@crystaldesign/diva-core": "26.14.0-beta.16",
24
+ "@crystaldesign/diva-utils": "26.14.0-beta.16",
25
+ "@crystaldesign/mass-configurator": "26.14.0-beta.16",
26
+ "@crystaldesign/media-upload": "26.14.0-beta.16",
27
+ "@crystaldesign/rtf-editor": "26.14.0-beta.16",
28
+ "@crystaldesign/spreadsheet": "26.14.0-beta.16",
29
29
  "@dnd-kit/core": "^6.1.0",
30
30
  "@dnd-kit/sortable": "^8.0.0",
31
31
  "@dnd-kit/utilities": "^3.2.2",
@@ -62,5 +62,5 @@
62
62
  "suiteName": "diva-backoffice",
63
63
  "outputDirectory": "./test-reports"
64
64
  },
65
- "gitHead": "90c05638b9e706476d467f7d15196c75e938242f"
65
+ "gitHead": "11c0bdb7e9f25e64b2fea6acd824925b879d20f5"
66
66
  }