@commercetools-frontend/react-notifications 20.10.4 → 20.12.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.
@@ -59,8 +59,8 @@ var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
59
59
  var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
60
60
  var isNumber__default = /*#__PURE__*/_interopDefault(isNumber);
61
61
 
62
- // NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
63
- var version = '20.10.4';
62
+ // NOTE: This string will be replaced on build time with the package version.
63
+ var version = "20.12.1";
64
64
 
65
65
  var Context = /*#__PURE__*/react.createContext(function () {
66
66
  return null;
@@ -74,8 +74,8 @@ function NotificationProviderForCustomComponent(props) {
74
74
  }
75
75
 
76
76
  NotificationProviderForCustomComponent.propTypes = process.env.NODE_ENV !== "production" ? {
77
- mapNotificationToComponent: _pt__default['default'].func.isRequired,
78
- children: _pt__default['default'].node.isRequired
77
+ mapNotificationToComponent: _pt__default["default"].func.isRequired,
78
+ children: _pt__default["default"].node.isRequired
79
79
  } : {};
80
80
  NotificationProviderForCustomComponent.displayName = 'NotificationProviderForCustomComponent';
81
81
  var useCustomNotificationComponent = function useCustomNotificationComponent() {
@@ -83,8 +83,8 @@ var useCustomNotificationComponent = function useCustomNotificationComponent() {
83
83
  }; // Exports
84
84
 
85
85
  function filterDataAttributes(obj) {
86
- return omitBy__default['default'](obj, function (_value, key) {
87
- return !_startsWithInstanceProperty__default['default'](key).call(key, 'data-');
86
+ return omitBy__default["default"](obj, function (_value, key) {
87
+ return !_startsWithInstanceProperty__default["default"](key).call(key, 'data-');
88
88
  });
89
89
  }
90
90
 
@@ -152,9 +152,9 @@ var getStylesForNotification = function getStylesForNotification(props) {
152
152
  }
153
153
  };
154
154
 
155
- function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
155
+ function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
156
156
 
157
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default['default'](_context = ownKeys$4(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context2; _forEachInstanceProperty__default['default'](_context2 = ownKeys$4(Object(source))).call(_context2, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
157
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
158
158
 
159
159
  var NotificationIcon = function NotificationIcon(props) {
160
160
  if (props.type === constants.NOTIFICATION_KINDS_SIDE.error) return jsxRuntime.jsx(icons.ErrorIcon, {
@@ -172,8 +172,8 @@ var NotificationIcon = function NotificationIcon(props) {
172
172
  };
173
173
 
174
174
  NotificationIcon.propTypes = process.env.NODE_ENV !== "production" ? {
175
- type: _pt__default['default'].any.isRequired,
176
- color: _pt__default['default'].oneOf(['error', 'warning', 'info', 'solid', 'neutral60', 'surface', 'primary', 'primary40']).isRequired
175
+ type: _pt__default["default"].any.isRequired,
176
+ color: _pt__default["default"].oneOf(['error', 'warning', 'info', 'solid', 'neutral60', 'surface', 'primary', 'primary40']).isRequired
177
177
  } : {};
178
178
  NotificationIcon.displayName = 'NotificationIcon';
179
179
  var defaultProps$1 = {
@@ -189,7 +189,7 @@ var Notification = function Notification(props) {
189
189
  css: getStylesForContent(props),
190
190
  children: props.children
191
191
  }), props.onCloseClick ? jsxRuntime.jsx("div", {
192
- children: jsxRuntime.jsx(IconButton__default['default'], {
192
+ children: jsxRuntime.jsx(IconButton__default["default"], {
193
193
  label: intl.formatMessage(messages.hideNotification),
194
194
  onClick: props.onCloseClick,
195
195
  icon: jsxRuntime.jsx(icons.CloseBoldIcon, {}),
@@ -206,11 +206,11 @@ var Notification = function Notification(props) {
206
206
  };
207
207
 
208
208
  Notification.propTypes = process.env.NODE_ENV !== "production" ? {
209
- domain: _pt__default['default'].any.isRequired,
210
- type: _pt__default['default'].any.isRequired,
211
- fixed: _pt__default['default'].bool.isRequired,
212
- onCloseClick: _pt__default['default'].func,
213
- children: _pt__default['default'].node.isRequired
209
+ domain: _pt__default["default"].any.isRequired,
210
+ type: _pt__default["default"].any.isRequired,
211
+ fixed: _pt__default["default"].bool.isRequired,
212
+ onCloseClick: _pt__default["default"].func,
213
+ children: _pt__default["default"].node.isRequired
214
214
  } : {};
215
215
  Notification.displayName = 'Notification';
216
216
  Notification.defaultProps = defaultProps$1;
@@ -225,8 +225,8 @@ var GenericNotification = function GenericNotification(props) {
225
225
  };
226
226
 
227
227
  GenericNotification.propTypes = process.env.NODE_ENV !== "production" ? {
228
- notification: _pt__default['default'].any.isRequired,
229
- dismiss: _pt__default['default'].func.isRequired
228
+ notification: _pt__default["default"].any.isRequired,
229
+ dismiss: _pt__default["default"].func.isRequired
230
230
  } : {};
231
231
  GenericNotification.displayName = 'GenericNotification';
232
232
 
@@ -371,9 +371,9 @@ var apiErrorMessages = reactIntl.defineMessages({
371
371
  }
372
372
  });
373
373
 
374
- function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
374
+ function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
375
375
 
376
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context6; _forEachInstanceProperty__default['default'](_context6 = ownKeys$3(Object(source), true)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context7; _forEachInstanceProperty__default['default'](_context7 = ownKeys$3(Object(source))).call(_context7, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
376
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context6; _forEachInstanceProperty__default["default"](_context6 = ownKeys$3(Object(source), true)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context7; _forEachInstanceProperty__default["default"](_context7 = ownKeys$3(Object(source))).call(_context7, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
377
377
  var regexInvalidOperationRequiredAttribute = /Required attribute '(.*)' cannot be removed/;
378
378
 
379
379
  // The values passed to the Intl message must be a map of scalar values.
@@ -396,11 +396,12 @@ var hasErrorCodeAMatchingMessage = function hasErrorCodeAMatchingMessage(errorCo
396
396
  };
397
397
 
398
398
  var FormattedErrorMessage = function FormattedErrorMessage(props) {
399
- var _context2;
399
+ var _props$error$extensio, _props$error$extensio2, _context2;
400
400
 
401
401
  var intl = reactIntl.useIntl(); // Attempt to map the error by code
402
402
 
403
- var messageCode = props.error.code && hasErrorCodeAMatchingMessage(props.error.code) ? apiErrorMessages[props.error.code] : undefined;
403
+ var extensionErrorCode = (_props$error$extensio = (_props$error$extensio2 = props.error.extensions) === null || _props$error$extensio2 === void 0 ? void 0 : _props$error$extensio2.code) !== null && _props$error$extensio !== void 0 ? _props$error$extensio : props.error.code;
404
+ var messageCode = extensionErrorCode && hasErrorCodeAMatchingMessage(extensionErrorCode) ? apiErrorMessages[extensionErrorCode] : undefined;
404
405
  react.useEffect(function () {
405
406
  if (!messageCode) {
406
407
  var _context;
@@ -408,13 +409,13 @@ var FormattedErrorMessage = function FormattedErrorMessage(props) {
408
409
  // This error is not mapped / translated yet,
409
410
  // we log, report it to sentry and show the original error, unless `error.code` is `invalid_scope`
410
411
  // which an error code emitted for expired project(s)
411
- if (props.error.code !== 'invalid_scope' && !_includesInstanceProperty__default['default'](_context = props.error.message).call(_context, 'has expired')) {
412
+ if (extensionErrorCode !== 'invalid_scope' && !_includesInstanceProperty__default["default"](_context = props.error.message).call(_context, 'has expired')) {
412
413
  sentry.reportErrorToSentry(new Error('Unmapped error'), {
413
414
  extra: props.error
414
415
  });
415
416
  }
416
417
  }
417
- }, [messageCode, props.error]);
418
+ }, [extensionErrorCode, messageCode, props.error]);
418
419
 
419
420
  if (messageCode) {
420
421
  // The `error` object might contain extra fields for the specific `code`.
@@ -424,12 +425,12 @@ var FormattedErrorMessage = function FormattedErrorMessage(props) {
424
425
  }
425
426
 
426
427
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
427
- children: _filterInstanceProperty__default['default'](_context2 = [props.error.message, props.error.detailedErrorMessage && "(".concat(props.error.detailedErrorMessage, ")")]).call(_context2, Boolean).join(' ')
428
+ children: _filterInstanceProperty__default["default"](_context2 = [props.error.message, props.error.detailedErrorMessage && "(".concat(props.error.detailedErrorMessage, ")")]).call(_context2, Boolean).join(' ')
428
429
  });
429
430
  };
430
431
 
431
432
  FormattedErrorMessage.propTypes = {
432
- error: _pt__default['default'].any.isRequired
433
+ error: _pt__default["default"].any.isRequired
433
434
  };
434
435
  FormattedErrorMessage.displayName = 'FormattedErrorMessage';
435
436
 
@@ -448,12 +449,14 @@ var ApiErrorMessage = function ApiErrorMessage(props) {
448
449
  };
449
450
 
450
451
  ApiErrorMessage.propTypes = process.env.NODE_ENV !== "production" ? {
451
- error: _pt__default['default'].any.isRequired
452
+ error: _pt__default["default"].any.isRequired
452
453
  } : {};
453
454
  ApiErrorMessage.displayName = 'ApiErrorMessage';
454
455
 
455
456
  function getSpecialFormattedMessageByErrorCode(error, intl) {
456
- var _context3, _context4, _context5;
457
+ var _error$extensions$cod, _error$extensions, _context3, _context4, _context5;
458
+
459
+ var extensionErrorCode = (_error$extensions$cod = (_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) !== null && _error$extensions$cod !== void 0 ? _error$extensions$cod : error.code;
457
460
 
458
461
  if (error.errorByExtension) {
459
462
  var extensionMessage;
@@ -465,26 +468,26 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
465
468
  return extensionMessage || error.message;
466
469
  }
467
470
 
468
- if (!error.code || error.code === 'InvalidInput') return intl.formatMessage(apiErrorMessages.General); // TODO: this is a temporary solution until we have proper pages about 403
471
+ if (!extensionErrorCode || extensionErrorCode === 'InvalidInput') return intl.formatMessage(apiErrorMessages.General); // TODO: this is a temporary solution until we have proper pages about 403
469
472
 
470
- if (error.code === 'insufficient_scope') return intl.formatMessage(apiErrorMessages.Forbidden);
471
- if (error.code === 'DuplicateField' && error.field === 'slug') return intl.formatMessage(apiErrorMessages.DuplicateSlug, {
473
+ if (extensionErrorCode === 'insufficient_scope') return intl.formatMessage(apiErrorMessages.Forbidden);
474
+ if (extensionErrorCode === 'DuplicateField' && error.field === 'slug') return intl.formatMessage(apiErrorMessages.DuplicateSlug, {
472
475
  slugValue: error.duplicateValue
473
476
  }); // Try to match the error with a custom error message
474
477
 
475
- if (has__default['default'](error, 'invalidValue') && has__default['default'](error.invalidValue, 'overlappingPrices')) return intl.formatMessage(apiErrorMessages.OverlappingPrices);
478
+ if (has__default["default"](error, 'invalidValue') && has__default["default"](error.invalidValue, 'overlappingPrices')) return intl.formatMessage(apiErrorMessages.OverlappingPrices);
476
479
 
477
- if (error.code === 'InvalidOperation' && _includesInstanceProperty__default['default'](_context3 = error.message).call(_context3, 'validFrom') && _includesInstanceProperty__default['default'](_context4 = error.message).call(_context4, 'validUntil')) {
480
+ if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context3 = error.message).call(_context3, 'validFrom') && _includesInstanceProperty__default["default"](_context4 = error.message).call(_context4, 'validUntil')) {
478
481
  return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
479
482
  field: 'validFrom'
480
483
  });
481
484
  }
482
485
 
483
- if (error.code === 'InvalidOperation' && _includesInstanceProperty__default['default'](_context5 = error.message).call(_context5, 'Duplicate tax rate for')) {
486
+ if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context5 = error.message).call(_context5, 'Duplicate tax rate for')) {
484
487
  return intl.formatMessage(apiErrorMessages.TaxCategoryDuplicateCountry);
485
488
  }
486
489
 
487
- if (error.code === 'InvalidOperation' && regexInvalidOperationRequiredAttribute.test(error.message)) {
490
+ if (extensionErrorCode === 'InvalidOperation' && regexInvalidOperationRequiredAttribute.test(error.message)) {
488
491
  var attrName = error.message.replace(regexInvalidOperationRequiredAttribute, '$1');
489
492
  return intl.formatMessage(apiErrorMessages.RequiredField, {
490
493
  field: attrName
@@ -494,17 +497,17 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
494
497
  // errors. We should investigate this further.
495
498
 
496
499
 
497
- if (error.code === 'InvalidField' && error.field === 'price' && has__default['default'](error, 'invalidValue') && has__default['default'](error.invalidValue, 'validFrom') && has__default['default'](error.invalidValue, 'validUntil')) return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
500
+ if (extensionErrorCode === 'InvalidField' && error.field === 'price' && has__default["default"](error, 'invalidValue') && has__default["default"](error.invalidValue, 'validFrom') && has__default["default"](error.invalidValue, 'validUntil')) return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
498
501
  field: error.field
499
502
  });
500
503
 
501
- if (error.code === 'DuplicateAttributeValue' && error.attribute) {
504
+ if (extensionErrorCode === 'DuplicateAttributeValue' && error.attribute) {
502
505
  return intl.formatMessage(apiErrorMessages.DuplicateAttributeValue, {
503
506
  name: error.attribute.name
504
507
  });
505
508
  }
506
509
 
507
- if (error.code === 'MaxResourceLimitExceeded') {
510
+ if (extensionErrorCode === 'MaxResourceLimitExceeded') {
508
511
  return intl.formatMessage(apiErrorMessages.MaxResourceLimitExceeded);
509
512
  }
510
513
 
@@ -519,8 +522,11 @@ var ApiErrorNotification = function ApiErrorNotification(props) {
519
522
  domain: props.notification.domain,
520
523
  onCloseClick: props.dismiss,
521
524
  children: jsxRuntime.jsx("ul", {
522
- children: _valuesInstanceProperty__default['default'](props.notification) && _mapInstanceProperty__default['default'](_context = _valuesInstanceProperty__default['default'](props.notification).errors).call(_context, function (error, idx) {
523
- var shouldLogErrorToConsole = !error.code && process.env.NODE_ENV === 'development';
525
+ children: _valuesInstanceProperty__default["default"](props.notification) && _mapInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](props.notification).errors).call(_context, function (error, idx) {
526
+ var _error$extensions$cod, _error$extensions;
527
+
528
+ var extensionErrorCode = (_error$extensions$cod = (_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) !== null && _error$extensions$cod !== void 0 ? _error$extensions$cod : error.code;
529
+ var shouldLogErrorToConsole = !extensionErrorCode && process.env.NODE_ENV === 'development';
524
530
 
525
531
  if (shouldLogErrorToConsole) {
526
532
  /**
@@ -544,33 +550,33 @@ var ApiErrorNotification = function ApiErrorNotification(props) {
544
550
  };
545
551
 
546
552
  ApiErrorNotification.propTypes = process.env.NODE_ENV !== "production" ? {
547
- notification: _pt__default['default'].any.isRequired,
548
- dismiss: _pt__default['default'].func.isRequired
553
+ notification: _pt__default["default"].any.isRequired,
554
+ dismiss: _pt__default["default"].func.isRequired
549
555
  } : {};
550
556
  ApiErrorNotification.displayName = 'ApiErrorNotification';
551
557
 
552
- function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
558
+ function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
553
559
 
554
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default['default'](_context = ownKeys$2(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context2; _forEachInstanceProperty__default['default'](_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
560
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
555
561
 
556
562
  var UnexpectedErrorNotification = function UnexpectedErrorNotification(props) {
557
563
  return jsxRuntime.jsx(Notification, {
558
564
  type: "error",
559
565
  domain: props.notification.domain,
560
566
  onCloseClick: props.dismiss,
561
- children: jsxRuntime.jsxs(Spacings__default['default'].Stack, {
567
+ children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
562
568
  children: [jsxRuntime.jsx("div", {
563
569
  children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, apiErrorMessages.General))
564
- }), _valuesInstanceProperty__default['default'](props.notification) && _valuesInstanceProperty__default['default'](props.notification).errorId && jsxRuntime.jsx("div", {
565
- children: "ID (".concat(_valuesInstanceProperty__default['default'](props.notification).errorId, ")")
570
+ }), _valuesInstanceProperty__default["default"](props.notification) && _valuesInstanceProperty__default["default"](props.notification).errorId && jsxRuntime.jsx("div", {
571
+ children: "ID (".concat(_valuesInstanceProperty__default["default"](props.notification).errorId, ")")
566
572
  })]
567
573
  })
568
574
  });
569
575
  };
570
576
 
571
577
  UnexpectedErrorNotification.propTypes = process.env.NODE_ENV !== "production" ? {
572
- notification: _pt__default['default'].any.isRequired,
573
- dismiss: _pt__default['default'].func.isRequired
578
+ notification: _pt__default["default"].any.isRequired,
579
+ dismiss: _pt__default["default"].func.isRequired
574
580
  } : {};
575
581
  UnexpectedErrorNotification.displayName = 'UnexpectedErrorNotification';
576
582
 
@@ -582,18 +588,18 @@ var selectNotifications = function selectNotifications(state) {
582
588
  var selectGlobalNotifications = reselect.createSelector(selectNotifications, function (notifications) {
583
589
  var _context;
584
590
 
585
- return _sliceInstanceProperty__default['default'](_context = _filterInstanceProperty__default['default'](notifications).call(notifications, function (notification) {
591
+ return _sliceInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
586
592
  return notification.domain === constants.NOTIFICATION_DOMAINS.GLOBAL;
587
593
  }) // Return only 1 at a time
588
594
  ).call(_context, 0, 1);
589
595
  });
590
596
  var selectPageNotifications = reselect.createSelector(selectNotifications, function (notifications) {
591
- return _filterInstanceProperty__default['default'](notifications).call(notifications, function (notification) {
597
+ return _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
592
598
  return notification.domain === constants.NOTIFICATION_DOMAINS.PAGE;
593
599
  });
594
600
  });
595
601
  var selectSideNotifications = reselect.createSelector(selectNotifications, function (notifications) {
596
- return _filterInstanceProperty__default['default'](notifications).call(notifications, function (notification) {
602
+ return _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
597
603
  return notification.domain === constants.NOTIFICATION_DOMAINS.SIDE;
598
604
  });
599
605
  });
@@ -622,9 +628,9 @@ var _excluded = ["values"],
622
628
  _excluded4 = ["text"],
623
629
  _excluded5 = ["text"];
624
630
 
625
- function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
631
+ function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
626
632
 
627
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default['default'](_context = ownKeys$1(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context2; _forEachInstanceProperty__default['default'](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
633
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
628
634
 
629
635
  var NotificationsListGlobal = function NotificationsListGlobal(props) {
630
636
  var dispatch = reactRedux.useDispatch();
@@ -632,7 +638,7 @@ var NotificationsListGlobal = function NotificationsListGlobal(props) {
632
638
  var notifications$1 = reactRedux.useSelector(selectGlobalNotifications);
633
639
  return jsxRuntime.jsx("div", {
634
640
  css: getStyles(props),
635
- children: _mapInstanceProperty__default['default'](notifications$1).call(notifications$1, function (notification) {
641
+ children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
636
642
  // 1. Check if there is a custom notification component first
637
643
  var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
638
644
 
@@ -651,7 +657,7 @@ var NotificationsListGlobal = function NotificationsListGlobal(props) {
651
657
  case constants.NOTIFICATION_KINDS_GLOBAL.info:
652
658
  case constants.NOTIFICATION_KINDS_GLOBAL.success:
653
659
  {
654
- _valuesInstanceProperty__default['default'](notification);
660
+ _valuesInstanceProperty__default["default"](notification);
655
661
  var genericNotification = _objectWithoutProperties(notification, _excluded);
656
662
 
657
663
  return jsxRuntime.jsx(GenericNotification, {
@@ -697,7 +703,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
697
703
  var notifications$1 = reactRedux.useSelector(selectPageNotifications);
698
704
  return jsxRuntime.jsx("div", {
699
705
  css: getStyles(props),
700
- children: _mapInstanceProperty__default['default'](notifications$1).call(notifications$1, function (notification) {
706
+ children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
701
707
  // 1. Check if there is a custom notification component first
702
708
  var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
703
709
 
@@ -716,7 +722,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
716
722
  case constants.NOTIFICATION_KINDS_PAGE.info:
717
723
  case constants.NOTIFICATION_KINDS_PAGE.success:
718
724
  {
719
- _valuesInstanceProperty__default['default'](notification);
725
+ _valuesInstanceProperty__default["default"](notification);
720
726
  var genericNotification = _objectWithoutProperties(notification, _excluded3);
721
727
 
722
728
  return jsxRuntime.jsx(GenericNotification, {
@@ -749,7 +755,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
749
755
 
750
756
  return jsxRuntime.jsx(UnexpectedErrorNotification, {
751
757
  notification: _objectSpread$1(_objectSpread$1({}, _errorNotification), {}, {
752
- values: _valuesInstanceProperty__default['default'](notification)
758
+ values: _valuesInstanceProperty__default["default"](notification)
753
759
  }),
754
760
  dismiss: function dismiss() {
755
761
  dispatch(notifications.removeNotification(notification.id));
@@ -770,7 +776,7 @@ var NotificationsListSide = function NotificationsListSide(props) {
770
776
  var notifications$1 = reactRedux.useSelector(selectSideNotifications);
771
777
  return jsxRuntime.jsx("div", {
772
778
  css: getStyles(props),
773
- children: _mapInstanceProperty__default['default'](notifications$1).call(notifications$1, function (notification) {
779
+ children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
774
780
  // 1. Check if there is a custom notification component first
775
781
  var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
776
782
 
@@ -820,9 +826,9 @@ var NotificationsList = function NotificationsList(props) {
820
826
 
821
827
  NotificationsList.displayName = 'NotificationsList';
822
828
 
823
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
829
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
824
830
 
825
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default['default'](_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context2; _forEachInstanceProperty__default['default'](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
831
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
826
832
  var defaultProps = {
827
833
  domain: constants.NOTIFICATION_DOMAINS.SIDE,
828
834
  kind: constants.NOTIFICATION_KINDS_SIDE.success
@@ -836,7 +842,7 @@ var Notifier = function Notifier(props) {
836
842
  domain: props.domain,
837
843
  kind: props.kind,
838
844
  text: props.text
839
- }, isNumber__default['default'](props.dismissAfter) ? _objectSpread(_objectSpread({}, props.meta), {}, {
845
+ }, isNumber__default["default"](props.dismissAfter) ? _objectSpread(_objectSpread({}, props.meta), {}, {
840
846
  dismissAfter: props.dismissAfter
841
847
  }) : props.meta);
842
848
  return function () {
@@ -849,11 +855,11 @@ var Notifier = function Notifier(props) {
849
855
  };
850
856
 
851
857
  Notifier.propTypes = {
852
- domain: _pt__default['default'].any.isRequired,
853
- kind: _pt__default['default'].any.isRequired,
854
- text: _pt__default['default'].string,
855
- meta: _pt__default['default'].objectOf(_pt__default['default'].any),
856
- dismissAfter: _pt__default['default'].number
858
+ domain: _pt__default["default"].any.isRequired,
859
+ kind: _pt__default["default"].any.isRequired,
860
+ text: _pt__default["default"].string,
861
+ meta: _pt__default["default"].objectOf(_pt__default["default"].any),
862
+ dismissAfter: _pt__default["default"].number
857
863
  };
858
864
  Notifier.displayName = 'Notifier';
859
865
  Notifier.defaultProps = defaultProps;
@@ -59,8 +59,8 @@ var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
59
59
  var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
60
60
  var isNumber__default = /*#__PURE__*/_interopDefault(isNumber);
61
61
 
62
- // NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
63
- var version = '20.10.4';
62
+ // NOTE: This string will be replaced on build time with the package version.
63
+ var version = "20.12.1";
64
64
 
65
65
  var Context = /*#__PURE__*/react.createContext(function () {
66
66
  return null;
@@ -80,8 +80,8 @@ var useCustomNotificationComponent = function useCustomNotificationComponent() {
80
80
  }; // Exports
81
81
 
82
82
  function filterDataAttributes(obj) {
83
- return omitBy__default['default'](obj, function (_value, key) {
84
- return !_startsWithInstanceProperty__default['default'](key).call(key, 'data-');
83
+ return omitBy__default["default"](obj, function (_value, key) {
84
+ return !_startsWithInstanceProperty__default["default"](key).call(key, 'data-');
85
85
  });
86
86
  }
87
87
 
@@ -149,9 +149,9 @@ var getStylesForNotification = function getStylesForNotification(props) {
149
149
  }
150
150
  };
151
151
 
152
- function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
152
+ function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
153
153
 
154
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default['default'](_context = ownKeys$4(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context2; _forEachInstanceProperty__default['default'](_context2 = ownKeys$4(Object(source))).call(_context2, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
154
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
155
155
 
156
156
  var NotificationIcon = function NotificationIcon(props) {
157
157
  if (props.type === constants.NOTIFICATION_KINDS_SIDE.error) return jsxRuntime.jsx(icons.ErrorIcon, {
@@ -183,7 +183,7 @@ var Notification = function Notification(props) {
183
183
  css: getStylesForContent(props),
184
184
  children: props.children
185
185
  }), props.onCloseClick ? jsxRuntime.jsx("div", {
186
- children: jsxRuntime.jsx(IconButton__default['default'], {
186
+ children: jsxRuntime.jsx(IconButton__default["default"], {
187
187
  label: intl.formatMessage(messages.hideNotification),
188
188
  onClick: props.onCloseClick,
189
189
  icon: jsxRuntime.jsx(icons.CloseBoldIcon, {}),
@@ -356,9 +356,9 @@ var apiErrorMessages = reactIntl.defineMessages({
356
356
  }
357
357
  });
358
358
 
359
- function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
359
+ function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
360
360
 
361
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context6; _forEachInstanceProperty__default['default'](_context6 = ownKeys$3(Object(source), true)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context7; _forEachInstanceProperty__default['default'](_context7 = ownKeys$3(Object(source))).call(_context7, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
361
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context6; _forEachInstanceProperty__default["default"](_context6 = ownKeys$3(Object(source), true)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context7; _forEachInstanceProperty__default["default"](_context7 = ownKeys$3(Object(source))).call(_context7, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
362
362
  var regexInvalidOperationRequiredAttribute = /Required attribute '(.*)' cannot be removed/;
363
363
 
364
364
  // The values passed to the Intl message must be a map of scalar values.
@@ -381,11 +381,12 @@ var hasErrorCodeAMatchingMessage = function hasErrorCodeAMatchingMessage(errorCo
381
381
  };
382
382
 
383
383
  var FormattedErrorMessage = function FormattedErrorMessage(props) {
384
- var _context2;
384
+ var _props$error$extensio, _props$error$extensio2, _context2;
385
385
 
386
386
  var intl = reactIntl.useIntl(); // Attempt to map the error by code
387
387
 
388
- var messageCode = props.error.code && hasErrorCodeAMatchingMessage(props.error.code) ? apiErrorMessages[props.error.code] : undefined;
388
+ var extensionErrorCode = (_props$error$extensio = (_props$error$extensio2 = props.error.extensions) === null || _props$error$extensio2 === void 0 ? void 0 : _props$error$extensio2.code) !== null && _props$error$extensio !== void 0 ? _props$error$extensio : props.error.code;
389
+ var messageCode = extensionErrorCode && hasErrorCodeAMatchingMessage(extensionErrorCode) ? apiErrorMessages[extensionErrorCode] : undefined;
389
390
  react.useEffect(function () {
390
391
  if (!messageCode) {
391
392
  var _context;
@@ -393,13 +394,13 @@ var FormattedErrorMessage = function FormattedErrorMessage(props) {
393
394
  // This error is not mapped / translated yet,
394
395
  // we log, report it to sentry and show the original error, unless `error.code` is `invalid_scope`
395
396
  // which an error code emitted for expired project(s)
396
- if (props.error.code !== 'invalid_scope' && !_includesInstanceProperty__default['default'](_context = props.error.message).call(_context, 'has expired')) {
397
+ if (extensionErrorCode !== 'invalid_scope' && !_includesInstanceProperty__default["default"](_context = props.error.message).call(_context, 'has expired')) {
397
398
  sentry.reportErrorToSentry(new Error('Unmapped error'), {
398
399
  extra: props.error
399
400
  });
400
401
  }
401
402
  }
402
- }, [messageCode, props.error]);
403
+ }, [extensionErrorCode, messageCode, props.error]);
403
404
 
404
405
  if (messageCode) {
405
406
  // The `error` object might contain extra fields for the specific `code`.
@@ -409,12 +410,12 @@ var FormattedErrorMessage = function FormattedErrorMessage(props) {
409
410
  }
410
411
 
411
412
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
412
- children: _filterInstanceProperty__default['default'](_context2 = [props.error.message, props.error.detailedErrorMessage && "(".concat(props.error.detailedErrorMessage, ")")]).call(_context2, Boolean).join(' ')
413
+ children: _filterInstanceProperty__default["default"](_context2 = [props.error.message, props.error.detailedErrorMessage && "(".concat(props.error.detailedErrorMessage, ")")]).call(_context2, Boolean).join(' ')
413
414
  });
414
415
  };
415
416
 
416
417
  FormattedErrorMessage.propTypes = {
417
- error: _pt__default['default'].any.isRequired
418
+ error: _pt__default["default"].any.isRequired
418
419
  };
419
420
  FormattedErrorMessage.displayName = 'FormattedErrorMessage';
420
421
 
@@ -436,7 +437,9 @@ ApiErrorMessage.propTypes = {};
436
437
  ApiErrorMessage.displayName = 'ApiErrorMessage';
437
438
 
438
439
  function getSpecialFormattedMessageByErrorCode(error, intl) {
439
- var _context3, _context4, _context5;
440
+ var _error$extensions$cod, _error$extensions, _context3, _context4, _context5;
441
+
442
+ var extensionErrorCode = (_error$extensions$cod = (_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) !== null && _error$extensions$cod !== void 0 ? _error$extensions$cod : error.code;
440
443
 
441
444
  if (error.errorByExtension) {
442
445
  var extensionMessage;
@@ -448,26 +451,26 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
448
451
  return extensionMessage || error.message;
449
452
  }
450
453
 
451
- if (!error.code || error.code === 'InvalidInput') return intl.formatMessage(apiErrorMessages.General); // TODO: this is a temporary solution until we have proper pages about 403
454
+ if (!extensionErrorCode || extensionErrorCode === 'InvalidInput') return intl.formatMessage(apiErrorMessages.General); // TODO: this is a temporary solution until we have proper pages about 403
452
455
 
453
- if (error.code === 'insufficient_scope') return intl.formatMessage(apiErrorMessages.Forbidden);
454
- if (error.code === 'DuplicateField' && error.field === 'slug') return intl.formatMessage(apiErrorMessages.DuplicateSlug, {
456
+ if (extensionErrorCode === 'insufficient_scope') return intl.formatMessage(apiErrorMessages.Forbidden);
457
+ if (extensionErrorCode === 'DuplicateField' && error.field === 'slug') return intl.formatMessage(apiErrorMessages.DuplicateSlug, {
455
458
  slugValue: error.duplicateValue
456
459
  }); // Try to match the error with a custom error message
457
460
 
458
- if (has__default['default'](error, 'invalidValue') && has__default['default'](error.invalidValue, 'overlappingPrices')) return intl.formatMessage(apiErrorMessages.OverlappingPrices);
461
+ if (has__default["default"](error, 'invalidValue') && has__default["default"](error.invalidValue, 'overlappingPrices')) return intl.formatMessage(apiErrorMessages.OverlappingPrices);
459
462
 
460
- if (error.code === 'InvalidOperation' && _includesInstanceProperty__default['default'](_context3 = error.message).call(_context3, 'validFrom') && _includesInstanceProperty__default['default'](_context4 = error.message).call(_context4, 'validUntil')) {
463
+ if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context3 = error.message).call(_context3, 'validFrom') && _includesInstanceProperty__default["default"](_context4 = error.message).call(_context4, 'validUntil')) {
461
464
  return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
462
465
  field: 'validFrom'
463
466
  });
464
467
  }
465
468
 
466
- if (error.code === 'InvalidOperation' && _includesInstanceProperty__default['default'](_context5 = error.message).call(_context5, 'Duplicate tax rate for')) {
469
+ if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context5 = error.message).call(_context5, 'Duplicate tax rate for')) {
467
470
  return intl.formatMessage(apiErrorMessages.TaxCategoryDuplicateCountry);
468
471
  }
469
472
 
470
- if (error.code === 'InvalidOperation' && regexInvalidOperationRequiredAttribute.test(error.message)) {
473
+ if (extensionErrorCode === 'InvalidOperation' && regexInvalidOperationRequiredAttribute.test(error.message)) {
471
474
  var attrName = error.message.replace(regexInvalidOperationRequiredAttribute, '$1');
472
475
  return intl.formatMessage(apiErrorMessages.RequiredField, {
473
476
  field: attrName
@@ -477,17 +480,17 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
477
480
  // errors. We should investigate this further.
478
481
 
479
482
 
480
- if (error.code === 'InvalidField' && error.field === 'price' && has__default['default'](error, 'invalidValue') && has__default['default'](error.invalidValue, 'validFrom') && has__default['default'](error.invalidValue, 'validUntil')) return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
483
+ if (extensionErrorCode === 'InvalidField' && error.field === 'price' && has__default["default"](error, 'invalidValue') && has__default["default"](error.invalidValue, 'validFrom') && has__default["default"](error.invalidValue, 'validUntil')) return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
481
484
  field: error.field
482
485
  });
483
486
 
484
- if (error.code === 'DuplicateAttributeValue' && error.attribute) {
487
+ if (extensionErrorCode === 'DuplicateAttributeValue' && error.attribute) {
485
488
  return intl.formatMessage(apiErrorMessages.DuplicateAttributeValue, {
486
489
  name: error.attribute.name
487
490
  });
488
491
  }
489
492
 
490
- if (error.code === 'MaxResourceLimitExceeded') {
493
+ if (extensionErrorCode === 'MaxResourceLimitExceeded') {
491
494
  return intl.formatMessage(apiErrorMessages.MaxResourceLimitExceeded);
492
495
  }
493
496
 
@@ -502,8 +505,11 @@ var ApiErrorNotification = function ApiErrorNotification(props) {
502
505
  domain: props.notification.domain,
503
506
  onCloseClick: props.dismiss,
504
507
  children: jsxRuntime.jsx("ul", {
505
- children: _valuesInstanceProperty__default['default'](props.notification) && _mapInstanceProperty__default['default'](_context = _valuesInstanceProperty__default['default'](props.notification).errors).call(_context, function (error, idx) {
506
- var shouldLogErrorToConsole = !error.code && "production" === 'development';
508
+ children: _valuesInstanceProperty__default["default"](props.notification) && _mapInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](props.notification).errors).call(_context, function (error, idx) {
509
+ var _error$extensions$cod, _error$extensions;
510
+
511
+ var extensionErrorCode = (_error$extensions$cod = (_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) !== null && _error$extensions$cod !== void 0 ? _error$extensions$cod : error.code;
512
+ var shouldLogErrorToConsole = !extensionErrorCode && "production" === 'development';
507
513
 
508
514
  if (shouldLogErrorToConsole) {
509
515
  /**
@@ -529,20 +535,20 @@ var ApiErrorNotification = function ApiErrorNotification(props) {
529
535
  ApiErrorNotification.propTypes = {};
530
536
  ApiErrorNotification.displayName = 'ApiErrorNotification';
531
537
 
532
- function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
538
+ function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
533
539
 
534
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default['default'](_context = ownKeys$2(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context2; _forEachInstanceProperty__default['default'](_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
540
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
535
541
 
536
542
  var UnexpectedErrorNotification = function UnexpectedErrorNotification(props) {
537
543
  return jsxRuntime.jsx(Notification, {
538
544
  type: "error",
539
545
  domain: props.notification.domain,
540
546
  onCloseClick: props.dismiss,
541
- children: jsxRuntime.jsxs(Spacings__default['default'].Stack, {
547
+ children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
542
548
  children: [jsxRuntime.jsx("div", {
543
549
  children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, apiErrorMessages.General))
544
- }), _valuesInstanceProperty__default['default'](props.notification) && _valuesInstanceProperty__default['default'](props.notification).errorId && jsxRuntime.jsx("div", {
545
- children: "ID (".concat(_valuesInstanceProperty__default['default'](props.notification).errorId, ")")
550
+ }), _valuesInstanceProperty__default["default"](props.notification) && _valuesInstanceProperty__default["default"](props.notification).errorId && jsxRuntime.jsx("div", {
551
+ children: "ID (".concat(_valuesInstanceProperty__default["default"](props.notification).errorId, ")")
546
552
  })]
547
553
  })
548
554
  });
@@ -559,18 +565,18 @@ var selectNotifications = function selectNotifications(state) {
559
565
  var selectGlobalNotifications = reselect.createSelector(selectNotifications, function (notifications) {
560
566
  var _context;
561
567
 
562
- return _sliceInstanceProperty__default['default'](_context = _filterInstanceProperty__default['default'](notifications).call(notifications, function (notification) {
568
+ return _sliceInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
563
569
  return notification.domain === constants.NOTIFICATION_DOMAINS.GLOBAL;
564
570
  }) // Return only 1 at a time
565
571
  ).call(_context, 0, 1);
566
572
  });
567
573
  var selectPageNotifications = reselect.createSelector(selectNotifications, function (notifications) {
568
- return _filterInstanceProperty__default['default'](notifications).call(notifications, function (notification) {
574
+ return _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
569
575
  return notification.domain === constants.NOTIFICATION_DOMAINS.PAGE;
570
576
  });
571
577
  });
572
578
  var selectSideNotifications = reselect.createSelector(selectNotifications, function (notifications) {
573
- return _filterInstanceProperty__default['default'](notifications).call(notifications, function (notification) {
579
+ return _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
574
580
  return notification.domain === constants.NOTIFICATION_DOMAINS.SIDE;
575
581
  });
576
582
  });
@@ -599,9 +605,9 @@ var _excluded = ["values"],
599
605
  _excluded4 = ["text"],
600
606
  _excluded5 = ["text"];
601
607
 
602
- function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
608
+ function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
603
609
 
604
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default['default'](_context = ownKeys$1(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context2; _forEachInstanceProperty__default['default'](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
610
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
605
611
 
606
612
  var NotificationsListGlobal = function NotificationsListGlobal(props) {
607
613
  var dispatch = reactRedux.useDispatch();
@@ -609,7 +615,7 @@ var NotificationsListGlobal = function NotificationsListGlobal(props) {
609
615
  var notifications$1 = reactRedux.useSelector(selectGlobalNotifications);
610
616
  return jsxRuntime.jsx("div", {
611
617
  css: getStyles(props),
612
- children: _mapInstanceProperty__default['default'](notifications$1).call(notifications$1, function (notification) {
618
+ children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
613
619
  // 1. Check if there is a custom notification component first
614
620
  var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
615
621
 
@@ -628,7 +634,7 @@ var NotificationsListGlobal = function NotificationsListGlobal(props) {
628
634
  case constants.NOTIFICATION_KINDS_GLOBAL.info:
629
635
  case constants.NOTIFICATION_KINDS_GLOBAL.success:
630
636
  {
631
- _valuesInstanceProperty__default['default'](notification);
637
+ _valuesInstanceProperty__default["default"](notification);
632
638
  var genericNotification = _objectWithoutProperties(notification, _excluded);
633
639
 
634
640
  return jsxRuntime.jsx(GenericNotification, {
@@ -668,7 +674,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
668
674
  var notifications$1 = reactRedux.useSelector(selectPageNotifications);
669
675
  return jsxRuntime.jsx("div", {
670
676
  css: getStyles(props),
671
- children: _mapInstanceProperty__default['default'](notifications$1).call(notifications$1, function (notification) {
677
+ children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
672
678
  // 1. Check if there is a custom notification component first
673
679
  var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
674
680
 
@@ -687,7 +693,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
687
693
  case constants.NOTIFICATION_KINDS_PAGE.info:
688
694
  case constants.NOTIFICATION_KINDS_PAGE.success:
689
695
  {
690
- _valuesInstanceProperty__default['default'](notification);
696
+ _valuesInstanceProperty__default["default"](notification);
691
697
  var genericNotification = _objectWithoutProperties(notification, _excluded3);
692
698
 
693
699
  return jsxRuntime.jsx(GenericNotification, {
@@ -720,7 +726,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
720
726
 
721
727
  return jsxRuntime.jsx(UnexpectedErrorNotification, {
722
728
  notification: _objectSpread$1(_objectSpread$1({}, _errorNotification), {}, {
723
- values: _valuesInstanceProperty__default['default'](notification)
729
+ values: _valuesInstanceProperty__default["default"](notification)
724
730
  }),
725
731
  dismiss: function dismiss() {
726
732
  dispatch(notifications.removeNotification(notification.id));
@@ -741,7 +747,7 @@ var NotificationsListSide = function NotificationsListSide(props) {
741
747
  var notifications$1 = reactRedux.useSelector(selectSideNotifications);
742
748
  return jsxRuntime.jsx("div", {
743
749
  css: getStyles(props),
744
- children: _mapInstanceProperty__default['default'](notifications$1).call(notifications$1, function (notification) {
750
+ children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
745
751
  // 1. Check if there is a custom notification component first
746
752
  var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
747
753
 
@@ -791,9 +797,9 @@ var NotificationsList = function NotificationsList(props) {
791
797
 
792
798
  NotificationsList.displayName = 'NotificationsList';
793
799
 
794
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
800
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
795
801
 
796
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default['default'](_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context2; _forEachInstanceProperty__default['default'](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
802
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
797
803
  var defaultProps = {
798
804
  domain: constants.NOTIFICATION_DOMAINS.SIDE,
799
805
  kind: constants.NOTIFICATION_KINDS_SIDE.success
@@ -807,7 +813,7 @@ var Notifier = function Notifier(props) {
807
813
  domain: props.domain,
808
814
  kind: props.kind,
809
815
  text: props.text
810
- }, isNumber__default['default'](props.dismissAfter) ? _objectSpread(_objectSpread({}, props.meta), {}, {
816
+ }, isNumber__default["default"](props.dismissAfter) ? _objectSpread(_objectSpread({}, props.meta), {}, {
811
817
  dismissAfter: props.dismissAfter
812
818
  }) : props.meta);
813
819
  return function () {
@@ -820,11 +826,11 @@ var Notifier = function Notifier(props) {
820
826
  };
821
827
 
822
828
  Notifier.propTypes = {
823
- domain: _pt__default['default'].any.isRequired,
824
- kind: _pt__default['default'].any.isRequired,
825
- text: _pt__default['default'].string,
826
- meta: _pt__default['default'].objectOf(_pt__default['default'].any),
827
- dismissAfter: _pt__default['default'].number
829
+ domain: _pt__default["default"].any.isRequired,
830
+ kind: _pt__default["default"].any.isRequired,
831
+ text: _pt__default["default"].string,
832
+ meta: _pt__default["default"].objectOf(_pt__default["default"].any),
833
+ dismissAfter: _pt__default["default"].number
828
834
  };
829
835
  Notifier.displayName = 'Notifier';
830
836
  Notifier.defaultProps = defaultProps;
@@ -33,8 +33,8 @@ import { createSelector } from 'reselect';
33
33
  import isNumber from 'lodash/isNumber';
34
34
  import { useShowNotification } from '@commercetools-frontend/actions-global';
35
35
 
36
- // NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
37
- var version = '20.10.4';
36
+ // NOTE: This string will be replaced on build time with the package version.
37
+ var version = "20.12.1";
38
38
 
39
39
  var Context = /*#__PURE__*/createContext(function () {
40
40
  return null;
@@ -370,11 +370,12 @@ var hasErrorCodeAMatchingMessage = function hasErrorCodeAMatchingMessage(errorCo
370
370
  };
371
371
 
372
372
  var FormattedErrorMessage = function FormattedErrorMessage(props) {
373
- var _context2;
373
+ var _props$error$extensio, _props$error$extensio2, _context2;
374
374
 
375
375
  var intl = useIntl(); // Attempt to map the error by code
376
376
 
377
- var messageCode = props.error.code && hasErrorCodeAMatchingMessage(props.error.code) ? apiErrorMessages[props.error.code] : undefined;
377
+ var extensionErrorCode = (_props$error$extensio = (_props$error$extensio2 = props.error.extensions) === null || _props$error$extensio2 === void 0 ? void 0 : _props$error$extensio2.code) !== null && _props$error$extensio !== void 0 ? _props$error$extensio : props.error.code;
378
+ var messageCode = extensionErrorCode && hasErrorCodeAMatchingMessage(extensionErrorCode) ? apiErrorMessages[extensionErrorCode] : undefined;
378
379
  useEffect(function () {
379
380
  if (!messageCode) {
380
381
  var _context;
@@ -382,13 +383,13 @@ var FormattedErrorMessage = function FormattedErrorMessage(props) {
382
383
  // This error is not mapped / translated yet,
383
384
  // we log, report it to sentry and show the original error, unless `error.code` is `invalid_scope`
384
385
  // which an error code emitted for expired project(s)
385
- if (props.error.code !== 'invalid_scope' && !_includesInstanceProperty(_context = props.error.message).call(_context, 'has expired')) {
386
+ if (extensionErrorCode !== 'invalid_scope' && !_includesInstanceProperty(_context = props.error.message).call(_context, 'has expired')) {
386
387
  reportErrorToSentry(new Error('Unmapped error'), {
387
388
  extra: props.error
388
389
  });
389
390
  }
390
391
  }
391
- }, [messageCode, props.error]);
392
+ }, [extensionErrorCode, messageCode, props.error]);
392
393
 
393
394
  if (messageCode) {
394
395
  // The `error` object might contain extra fields for the specific `code`.
@@ -427,7 +428,9 @@ ApiErrorMessage.propTypes = process.env.NODE_ENV !== "production" ? {
427
428
  ApiErrorMessage.displayName = 'ApiErrorMessage';
428
429
 
429
430
  function getSpecialFormattedMessageByErrorCode(error, intl) {
430
- var _context3, _context4, _context5;
431
+ var _error$extensions$cod, _error$extensions, _context3, _context4, _context5;
432
+
433
+ var extensionErrorCode = (_error$extensions$cod = (_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) !== null && _error$extensions$cod !== void 0 ? _error$extensions$cod : error.code;
431
434
 
432
435
  if (error.errorByExtension) {
433
436
  var extensionMessage;
@@ -439,26 +442,26 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
439
442
  return extensionMessage || error.message;
440
443
  }
441
444
 
442
- if (!error.code || error.code === 'InvalidInput') return intl.formatMessage(apiErrorMessages.General); // TODO: this is a temporary solution until we have proper pages about 403
445
+ if (!extensionErrorCode || extensionErrorCode === 'InvalidInput') return intl.formatMessage(apiErrorMessages.General); // TODO: this is a temporary solution until we have proper pages about 403
443
446
 
444
- if (error.code === 'insufficient_scope') return intl.formatMessage(apiErrorMessages.Forbidden);
445
- if (error.code === 'DuplicateField' && error.field === 'slug') return intl.formatMessage(apiErrorMessages.DuplicateSlug, {
447
+ if (extensionErrorCode === 'insufficient_scope') return intl.formatMessage(apiErrorMessages.Forbidden);
448
+ if (extensionErrorCode === 'DuplicateField' && error.field === 'slug') return intl.formatMessage(apiErrorMessages.DuplicateSlug, {
446
449
  slugValue: error.duplicateValue
447
450
  }); // Try to match the error with a custom error message
448
451
 
449
452
  if (has(error, 'invalidValue') && has(error.invalidValue, 'overlappingPrices')) return intl.formatMessage(apiErrorMessages.OverlappingPrices);
450
453
 
451
- if (error.code === 'InvalidOperation' && _includesInstanceProperty(_context3 = error.message).call(_context3, 'validFrom') && _includesInstanceProperty(_context4 = error.message).call(_context4, 'validUntil')) {
454
+ if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty(_context3 = error.message).call(_context3, 'validFrom') && _includesInstanceProperty(_context4 = error.message).call(_context4, 'validUntil')) {
452
455
  return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
453
456
  field: 'validFrom'
454
457
  });
455
458
  }
456
459
 
457
- if (error.code === 'InvalidOperation' && _includesInstanceProperty(_context5 = error.message).call(_context5, 'Duplicate tax rate for')) {
460
+ if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty(_context5 = error.message).call(_context5, 'Duplicate tax rate for')) {
458
461
  return intl.formatMessage(apiErrorMessages.TaxCategoryDuplicateCountry);
459
462
  }
460
463
 
461
- if (error.code === 'InvalidOperation' && regexInvalidOperationRequiredAttribute.test(error.message)) {
464
+ if (extensionErrorCode === 'InvalidOperation' && regexInvalidOperationRequiredAttribute.test(error.message)) {
462
465
  var attrName = error.message.replace(regexInvalidOperationRequiredAttribute, '$1');
463
466
  return intl.formatMessage(apiErrorMessages.RequiredField, {
464
467
  field: attrName
@@ -468,17 +471,17 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
468
471
  // errors. We should investigate this further.
469
472
 
470
473
 
471
- if (error.code === 'InvalidField' && error.field === 'price' && has(error, 'invalidValue') && has(error.invalidValue, 'validFrom') && has(error.invalidValue, 'validUntil')) return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
474
+ if (extensionErrorCode === 'InvalidField' && error.field === 'price' && has(error, 'invalidValue') && has(error.invalidValue, 'validFrom') && has(error.invalidValue, 'validUntil')) return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
472
475
  field: error.field
473
476
  });
474
477
 
475
- if (error.code === 'DuplicateAttributeValue' && error.attribute) {
478
+ if (extensionErrorCode === 'DuplicateAttributeValue' && error.attribute) {
476
479
  return intl.formatMessage(apiErrorMessages.DuplicateAttributeValue, {
477
480
  name: error.attribute.name
478
481
  });
479
482
  }
480
483
 
481
- if (error.code === 'MaxResourceLimitExceeded') {
484
+ if (extensionErrorCode === 'MaxResourceLimitExceeded') {
482
485
  return intl.formatMessage(apiErrorMessages.MaxResourceLimitExceeded);
483
486
  }
484
487
 
@@ -494,7 +497,10 @@ var ApiErrorNotification = function ApiErrorNotification(props) {
494
497
  onCloseClick: props.dismiss,
495
498
  children: jsx("ul", {
496
499
  children: _valuesInstanceProperty(props.notification) && _mapInstanceProperty(_context = _valuesInstanceProperty(props.notification).errors).call(_context, function (error, idx) {
497
- var shouldLogErrorToConsole = !error.code && process.env.NODE_ENV === 'development';
500
+ var _error$extensions$cod, _error$extensions;
501
+
502
+ var extensionErrorCode = (_error$extensions$cod = (_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) !== null && _error$extensions$cod !== void 0 ? _error$extensions$cod : error.code;
503
+ var shouldLogErrorToConsole = !extensionErrorCode && process.env.NODE_ENV === 'development';
498
504
 
499
505
  if (shouldLogErrorToConsole) {
500
506
  /**
@@ -1,12 +1,24 @@
1
1
  import type { TAppNotificationGlobal, TAppNotificationPage, TAppNotificationSide } from '@commercetools-frontend/constants';
2
2
  import type { TAppState } from './types';
3
3
  export declare const selectNotifications: (state: TAppState) => (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[];
4
- export declare const selectGlobalNotifications: import("reselect").OutputSelector<[(state: TAppState) => (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[]], TAppNotificationGlobal[], never, ((args_0: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[], ...args_1: unknown[]) => TAppNotificationGlobal[]) & ((...args: any[]) => any) & {
4
+ export declare const selectGlobalNotifications: ((state: {
5
+ notifications: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[];
6
+ }) => TAppNotificationGlobal[]) & import("reselect").OutputSelectorFields<(args_0: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[]) => TAppNotificationGlobal[] & {
5
7
  clearCache: () => void;
6
- }>;
7
- export declare const selectPageNotifications: import("reselect").OutputSelector<[(state: TAppState) => (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[]], TAppNotificationPage[], never, ((args_0: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[], ...args_1: unknown[]) => TAppNotificationPage[]) & ((...args: any[]) => any) & {
8
+ }> & {
8
9
  clearCache: () => void;
9
- }>;
10
- export declare const selectSideNotifications: import("reselect").OutputSelector<[(state: TAppState) => (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[]], TAppNotificationSide[], never, ((args_0: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[], ...args_1: unknown[]) => TAppNotificationSide[]) & ((...args: any[]) => any) & {
10
+ };
11
+ export declare const selectPageNotifications: ((state: {
12
+ notifications: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[];
13
+ }) => TAppNotificationPage[]) & import("reselect").OutputSelectorFields<(args_0: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[]) => TAppNotificationPage[] & {
11
14
  clearCache: () => void;
12
- }>;
15
+ }> & {
16
+ clearCache: () => void;
17
+ };
18
+ export declare const selectSideNotifications: ((state: {
19
+ notifications: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[];
20
+ }) => TAppNotificationSide[]) & import("reselect").OutputSelectorFields<(args_0: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[]) => TAppNotificationSide[] & {
21
+ clearCache: () => void;
22
+ }> & {
23
+ clearCache: () => void;
24
+ };
@@ -1,2 +1,2 @@
1
- declare const _default: "20.10.4";
1
+ declare const _default: "__@APPLICATION_KIT_PACKAGE/VERSION_OF_RELEASE__";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/react-notifications",
3
- "version": "20.10.4",
3
+ "version": "20.12.1",
4
4
  "description": "React bindings for @commercetools-frontend/notifications",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -11,29 +11,25 @@
11
11
  "homepage": "https://docs.commercetools.com/custom-applications",
12
12
  "keywords": ["javascript", "frontend", "react", "toolkit"],
13
13
  "license": "MIT",
14
- "private": false,
15
14
  "publishConfig": {
16
15
  "access": "public"
17
16
  },
18
17
  "main": "dist/commercetools-frontend-react-notifications.cjs.js",
19
18
  "module": "dist/commercetools-frontend-react-notifications.esm.js",
20
19
  "files": ["dist", "package.json", "LICENSE", "README.md"],
21
- "scripts": {
22
- "prepare": "./../../scripts/version.js replace"
23
- },
24
20
  "dependencies": {
25
- "@babel/runtime": "7.15.4",
26
- "@babel/runtime-corejs3": "7.15.4",
27
- "@commercetools-frontend/actions-global": "20.10.4",
28
- "@commercetools-frontend/constants": "20.10.1",
29
- "@commercetools-frontend/notifications": "20.10.1",
30
- "@commercetools-frontend/sentry": "20.10.4",
21
+ "@babel/runtime": "7.16.3",
22
+ "@babel/runtime-corejs3": "7.16.3",
23
+ "@commercetools-frontend/actions-global": "20.12.1",
24
+ "@commercetools-frontend/constants": "20.12.1",
25
+ "@commercetools-frontend/notifications": "20.12.1",
26
+ "@commercetools-frontend/sentry": "20.12.1",
31
27
  "@commercetools-uikit/design-system": "^12.2.2",
32
28
  "@commercetools-uikit/icon-button": "^12.2.2",
33
29
  "@commercetools-uikit/icons": "^12.2.2",
34
30
  "@commercetools-uikit/spacings": "^12.2.2",
35
- "@emotion/react": "11.5.0",
36
- "@emotion/styled": "11.3.0",
31
+ "@emotion/react": "11.7.0",
32
+ "@emotion/styled": "11.6.0",
37
33
  "@types/history": "4.7.9",
38
34
  "@types/lodash": "^4.14.167",
39
35
  "@types/prop-types": "^15.7.3",
@@ -46,13 +42,13 @@
46
42
  "moment": "^2.29.1",
47
43
  "moment-timezone": "^0.5.32",
48
44
  "prop-types": "15.7.2",
49
- "reselect": "4.1.0"
45
+ "reselect": "4.1.5"
50
46
  },
51
47
  "devDependencies": {
52
48
  "@testing-library/react": "12.1.2",
53
49
  "react": "17.0.2",
54
50
  "react-dom": "17.0.2",
55
- "react-intl": "5.21.0",
51
+ "react-intl": "5.23.0",
56
52
  "react-redux": "7.2.6",
57
53
  "react-router-dom": "5.3.0"
58
54
  },