@commercetools-frontend/react-notifications 27.5.3 → 27.6.0
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.
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var react = require('react');
|
|
4
6
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
5
7
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
@@ -35,7 +37,7 @@ var reselect = require('reselect');
|
|
|
35
37
|
var isNumber = require('lodash/isNumber');
|
|
36
38
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
37
39
|
|
|
38
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
40
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
39
41
|
|
|
40
42
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
41
43
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
@@ -57,7 +59,7 @@ var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanc
|
|
|
57
59
|
var isNumber__default = /*#__PURE__*/_interopDefault(isNumber);
|
|
58
60
|
|
|
59
61
|
// NOTE: This string will be replaced on build time with the package version.
|
|
60
|
-
var version = "27.
|
|
62
|
+
var version = "27.6.0";
|
|
61
63
|
|
|
62
64
|
const Context = /*#__PURE__*/react.createContext(() => null);
|
|
63
65
|
function NotificationProviderForCustomComponent(props) {
|
|
@@ -70,7 +72,7 @@ NotificationProviderForCustomComponent.displayName = 'NotificationProviderForCus
|
|
|
70
72
|
const useCustomNotificationComponent = () => react.useContext(Context);
|
|
71
73
|
|
|
72
74
|
function filterDataAttributes(obj) {
|
|
73
|
-
return omitBy__default
|
|
75
|
+
return omitBy__default["default"](obj, (_value, key) => !_startsWithInstanceProperty__default["default"](key).call(key, 'data-'));
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
var messages = reactIntl.defineMessages({
|
|
@@ -154,8 +156,8 @@ const getStylesForNotification = props => {
|
|
|
154
156
|
};
|
|
155
157
|
|
|
156
158
|
const _excluded$2 = ["fixed"];
|
|
157
|
-
function ownKeys$4(e, r) { var t = _Object$keys__default
|
|
158
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
159
|
+
function ownKeys$4(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
160
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
159
161
|
const sequentialId = utils.createSequentialId('notification-');
|
|
160
162
|
const NotificationIcon = props => {
|
|
161
163
|
if (props.type === constants.NOTIFICATION_KINDS_SIDE.error) {
|
|
@@ -201,7 +203,7 @@ const Notification = _ref => {
|
|
|
201
203
|
css: getStylesForCloseIcon(_objectSpread$4({
|
|
202
204
|
fixed
|
|
203
205
|
}, props)),
|
|
204
|
-
children: jsxRuntime.jsx(SecondaryIconButton__default
|
|
206
|
+
children: jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
205
207
|
label: intl.formatMessage(messages.hideNotification),
|
|
206
208
|
onClick: props.onCloseClick,
|
|
207
209
|
icon: jsxRuntime.jsx(icons.CloseBoldIcon, {}),
|
|
@@ -376,8 +378,8 @@ var apiErrorMessages = reactIntl.defineMessages({
|
|
|
376
378
|
}
|
|
377
379
|
});
|
|
378
380
|
|
|
379
|
-
function ownKeys$3(e, r) { var t = _Object$keys__default
|
|
380
|
-
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
381
|
+
function ownKeys$3(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
382
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$3(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$3(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
381
383
|
const regexInvalidOperationRequiredAttribute = /^Required attribute '([^']+)' cannot be removed/;
|
|
382
384
|
|
|
383
385
|
// `error` fields for REST errors
|
|
@@ -417,7 +419,7 @@ const FormattedErrorMessage = props => {
|
|
|
417
419
|
// This error is not mapped / translated yet,
|
|
418
420
|
// we log, report it to sentry and show the original error, unless `error.code` is `invalid_scope`
|
|
419
421
|
// which an error code emitted for expired project(s)
|
|
420
|
-
if (extensionErrorCode !== 'invalid_scope' && !_includesInstanceProperty__default
|
|
422
|
+
if (extensionErrorCode !== 'invalid_scope' && !_includesInstanceProperty__default["default"](_context = props.error.message).call(_context, 'has expired')) {
|
|
421
423
|
sentry.reportErrorToSentry(new Error('Unmapped error'), {
|
|
422
424
|
extra: props.error
|
|
423
425
|
});
|
|
@@ -431,7 +433,7 @@ const FormattedErrorMessage = props => {
|
|
|
431
433
|
});
|
|
432
434
|
}
|
|
433
435
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
434
|
-
children: _filterInstanceProperty__default
|
|
436
|
+
children: _filterInstanceProperty__default["default"](_context2 = [props.error.message, props.error.detailedErrorMessage && `(${props.error.detailedErrorMessage})`]).call(_context2, Boolean).join(' ')
|
|
435
437
|
});
|
|
436
438
|
};
|
|
437
439
|
FormattedErrorMessage.displayName = 'FormattedErrorMessage';
|
|
@@ -477,13 +479,13 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
|
|
|
477
479
|
}
|
|
478
480
|
|
|
479
481
|
// Try to match the error with a custom error message
|
|
480
|
-
if (has__default
|
|
481
|
-
if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default
|
|
482
|
+
if (has__default["default"](error, 'invalidValue') && has__default["default"](error.invalidValue, 'overlappingPrices')) return intl.formatMessage(apiErrorMessages.OverlappingPrices);
|
|
483
|
+
if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context3 = error.message).call(_context3, 'validFrom') && _includesInstanceProperty__default["default"](_context4 = error.message).call(_context4, 'validUntil')) {
|
|
482
484
|
return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
|
|
483
485
|
field: 'validFrom'
|
|
484
486
|
});
|
|
485
487
|
}
|
|
486
|
-
if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default
|
|
488
|
+
if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context5 = error.message).call(_context5, 'Duplicate tax rate for')) {
|
|
487
489
|
return intl.formatMessage(apiErrorMessages.TaxCategoryDuplicateCountry);
|
|
488
490
|
}
|
|
489
491
|
if (extensionErrorCode === 'InvalidOperation' && regexInvalidOperationRequiredAttribute.test(error.message)) {
|
|
@@ -496,7 +498,7 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
|
|
|
496
498
|
// TODO: A concern has be raised that we can't accurately distinguish
|
|
497
499
|
// this error (invalid start / end dates with prices) from other price
|
|
498
500
|
// errors. We should investigate this further.
|
|
499
|
-
if (extensionErrorCode === 'InvalidField' && error.field === 'price' && has__default
|
|
501
|
+
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, {
|
|
500
502
|
field: error.field
|
|
501
503
|
});
|
|
502
504
|
if (extensionErrorCode === 'DuplicateAttributeValue' && error.attribute) {
|
|
@@ -517,7 +519,7 @@ const ApiErrorNotification = props => {
|
|
|
517
519
|
domain: props.notification.domain,
|
|
518
520
|
onCloseClick: props.dismiss,
|
|
519
521
|
children: jsxRuntime.jsx("ul", {
|
|
520
|
-
children: _valuesInstanceProperty__default
|
|
522
|
+
children: _valuesInstanceProperty__default["default"](props.notification) && _mapInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](props.notification).errors).call(_context, (error, idx) => {
|
|
521
523
|
const extensionErrorCode = error.extensions?.code ?? error.code;
|
|
522
524
|
const shouldLogErrorToConsole = !extensionErrorCode && process.env.NODE_ENV === 'development';
|
|
523
525
|
if (shouldLogErrorToConsole) {
|
|
@@ -549,17 +551,17 @@ const GenericNotification = props => jsxRuntime.jsx(Notification, {
|
|
|
549
551
|
});
|
|
550
552
|
GenericNotification.displayName = 'GenericNotification';
|
|
551
553
|
|
|
552
|
-
function ownKeys$2(e, r) { var t = _Object$keys__default
|
|
553
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
554
|
+
function ownKeys$2(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
555
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
554
556
|
const UnexpectedErrorNotification = props => jsxRuntime.jsx(Notification, {
|
|
555
557
|
type: "error",
|
|
556
558
|
domain: props.notification.domain,
|
|
557
559
|
onCloseClick: props.dismiss,
|
|
558
|
-
children: jsxRuntime.jsxs(Spacings__default
|
|
560
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
559
561
|
children: [jsxRuntime.jsx("div", {
|
|
560
562
|
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, apiErrorMessages.General))
|
|
561
|
-
}), _valuesInstanceProperty__default
|
|
562
|
-
children: `ID (${_valuesInstanceProperty__default
|
|
563
|
+
}), _valuesInstanceProperty__default["default"](props.notification) && _valuesInstanceProperty__default["default"](props.notification).errorId && jsxRuntime.jsx("div", {
|
|
564
|
+
children: `ID (${_valuesInstanceProperty__default["default"](props.notification).errorId})`
|
|
563
565
|
})]
|
|
564
566
|
})
|
|
565
567
|
});
|
|
@@ -584,20 +586,20 @@ const getStyles = props => {
|
|
|
584
586
|
const selectNotifications = state => state.notifications;
|
|
585
587
|
const selectGlobalNotifications = reselect.createSelector(selectNotifications, notifications => {
|
|
586
588
|
var _context;
|
|
587
|
-
return _sliceInstanceProperty__default
|
|
589
|
+
return _sliceInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](notifications).call(notifications, notification => notification.domain === constants.NOTIFICATION_DOMAINS.GLOBAL)
|
|
588
590
|
// Return only 1 at a time
|
|
589
591
|
).call(_context, 0, 1);
|
|
590
592
|
});
|
|
591
|
-
const selectPageNotifications = reselect.createSelector(selectNotifications, notifications => _filterInstanceProperty__default
|
|
592
|
-
const selectSideNotifications = reselect.createSelector(selectNotifications, notifications => _filterInstanceProperty__default
|
|
593
|
+
const selectPageNotifications = reselect.createSelector(selectNotifications, notifications => _filterInstanceProperty__default["default"](notifications).call(notifications, notification => notification.domain === constants.NOTIFICATION_DOMAINS.PAGE));
|
|
594
|
+
const selectSideNotifications = reselect.createSelector(selectNotifications, notifications => _filterInstanceProperty__default["default"](notifications).call(notifications, notification => notification.domain === constants.NOTIFICATION_DOMAINS.SIDE));
|
|
593
595
|
|
|
594
596
|
const _excluded$1 = ["values"],
|
|
595
597
|
_excluded2 = ["text"],
|
|
596
598
|
_excluded3 = ["values"],
|
|
597
599
|
_excluded4 = ["text"],
|
|
598
600
|
_excluded5 = ["text"];
|
|
599
|
-
function ownKeys$1(e, r) { var t = _Object$keys__default
|
|
600
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
601
|
+
function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
602
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
601
603
|
const NotificationsListGlobal = props => {
|
|
602
604
|
const dispatch = reactRedux.useDispatch();
|
|
603
605
|
const mapCustomNotificationToComponent = useCustomNotificationComponent();
|
|
@@ -605,7 +607,7 @@ const NotificationsListGlobal = props => {
|
|
|
605
607
|
return jsxRuntime.jsx("div", {
|
|
606
608
|
id: `notifications-${props.domain}`,
|
|
607
609
|
css: getStyles(props),
|
|
608
|
-
children: _mapInstanceProperty__default
|
|
610
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, notification => {
|
|
609
611
|
// 1. Check if there is a custom notification component first
|
|
610
612
|
const CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
611
613
|
if (CustomNotificationComponent) {
|
|
@@ -622,7 +624,7 @@ const NotificationsListGlobal = props => {
|
|
|
622
624
|
case constants.NOTIFICATION_KINDS_GLOBAL.info:
|
|
623
625
|
case constants.NOTIFICATION_KINDS_GLOBAL.success:
|
|
624
626
|
{
|
|
625
|
-
_valuesInstanceProperty__default
|
|
627
|
+
_valuesInstanceProperty__default["default"](notification);
|
|
626
628
|
const genericNotification = _objectWithoutProperties(notification, _excluded$1);
|
|
627
629
|
return jsxRuntime.jsx(GenericNotification, {
|
|
628
630
|
notification: genericNotification,
|
|
@@ -663,7 +665,7 @@ const NotificationsListPage = props => {
|
|
|
663
665
|
return jsxRuntime.jsx("div", {
|
|
664
666
|
id: `notifications-${props.domain}`,
|
|
665
667
|
css: getStyles(props),
|
|
666
|
-
children: _mapInstanceProperty__default
|
|
668
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, notification => {
|
|
667
669
|
// 1. Check if there is a custom notification component first
|
|
668
670
|
const CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
669
671
|
if (CustomNotificationComponent) {
|
|
@@ -680,7 +682,7 @@ const NotificationsListPage = props => {
|
|
|
680
682
|
case constants.NOTIFICATION_KINDS_PAGE.info:
|
|
681
683
|
case constants.NOTIFICATION_KINDS_PAGE.success:
|
|
682
684
|
{
|
|
683
|
-
_valuesInstanceProperty__default
|
|
685
|
+
_valuesInstanceProperty__default["default"](notification);
|
|
684
686
|
const genericNotification = _objectWithoutProperties(notification, _excluded3);
|
|
685
687
|
return jsxRuntime.jsx(GenericNotification, {
|
|
686
688
|
notification: _objectSpread$1(_objectSpread$1({}, genericNotification), {}, {
|
|
@@ -708,7 +710,7 @@ const NotificationsListPage = props => {
|
|
|
708
710
|
const errorNotification = _objectWithoutProperties(notification, _excluded5);
|
|
709
711
|
return jsxRuntime.jsx(UnexpectedErrorNotification, {
|
|
710
712
|
notification: _objectSpread$1(_objectSpread$1({}, errorNotification), {}, {
|
|
711
|
-
values: _valuesInstanceProperty__default
|
|
713
|
+
values: _valuesInstanceProperty__default["default"](notification)
|
|
712
714
|
}),
|
|
713
715
|
dismiss: () => {
|
|
714
716
|
dispatch(notifications.removeNotification(notification.id));
|
|
@@ -728,7 +730,7 @@ const NotificationsListSide = props => {
|
|
|
728
730
|
return jsxRuntime.jsx("div", {
|
|
729
731
|
id: `notifications-${props.domain}`,
|
|
730
732
|
css: getStyles(props),
|
|
731
|
-
children: _mapInstanceProperty__default
|
|
733
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, notification => {
|
|
732
734
|
// 1. Check if there is a custom notification component first
|
|
733
735
|
const CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
734
736
|
if (CustomNotificationComponent) {
|
|
@@ -771,8 +773,8 @@ const NotificationsList = props => {
|
|
|
771
773
|
NotificationsList.displayName = 'NotificationsList';
|
|
772
774
|
|
|
773
775
|
const _excluded = ["domain", "kind"];
|
|
774
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
775
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
776
|
+
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
777
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
776
778
|
const Notifier = _ref => {
|
|
777
779
|
let _ref$domain = _ref.domain,
|
|
778
780
|
domain = _ref$domain === void 0 ? constants.NOTIFICATION_DOMAINS.SIDE : _ref$domain,
|
|
@@ -785,7 +787,7 @@ const Notifier = _ref => {
|
|
|
785
787
|
domain: domain,
|
|
786
788
|
kind: kind,
|
|
787
789
|
text: props.text
|
|
788
|
-
}, isNumber__default
|
|
790
|
+
}, isNumber__default["default"](props.dismissAfter) ? _objectSpread(_objectSpread({}, props.meta), {}, {
|
|
789
791
|
dismissAfter: props.dismissAfter
|
|
790
792
|
}) : props.meta);
|
|
791
793
|
return () => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var react = require('react');
|
|
4
6
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
5
7
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
@@ -35,7 +37,7 @@ var reselect = require('reselect');
|
|
|
35
37
|
var isNumber = require('lodash/isNumber');
|
|
36
38
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
37
39
|
|
|
38
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
40
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
39
41
|
|
|
40
42
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
41
43
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
@@ -57,7 +59,7 @@ var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanc
|
|
|
57
59
|
var isNumber__default = /*#__PURE__*/_interopDefault(isNumber);
|
|
58
60
|
|
|
59
61
|
// NOTE: This string will be replaced on build time with the package version.
|
|
60
|
-
var version = "27.
|
|
62
|
+
var version = "27.6.0";
|
|
61
63
|
|
|
62
64
|
const Context = /*#__PURE__*/react.createContext(() => null);
|
|
63
65
|
function NotificationProviderForCustomComponent(props) {
|
|
@@ -70,7 +72,7 @@ NotificationProviderForCustomComponent.displayName = 'NotificationProviderForCus
|
|
|
70
72
|
const useCustomNotificationComponent = () => react.useContext(Context);
|
|
71
73
|
|
|
72
74
|
function filterDataAttributes(obj) {
|
|
73
|
-
return omitBy__default
|
|
75
|
+
return omitBy__default["default"](obj, (_value, key) => !_startsWithInstanceProperty__default["default"](key).call(key, 'data-'));
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
var messages = reactIntl.defineMessages({
|
|
@@ -154,8 +156,8 @@ const getStylesForNotification = props => {
|
|
|
154
156
|
};
|
|
155
157
|
|
|
156
158
|
const _excluded$2 = ["fixed"];
|
|
157
|
-
function ownKeys$4(e, r) { var t = _Object$keys__default
|
|
158
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
159
|
+
function ownKeys$4(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
160
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
159
161
|
const sequentialId = utils.createSequentialId('notification-');
|
|
160
162
|
const NotificationIcon = props => {
|
|
161
163
|
if (props.type === constants.NOTIFICATION_KINDS_SIDE.error) {
|
|
@@ -201,7 +203,7 @@ const Notification = _ref => {
|
|
|
201
203
|
css: getStylesForCloseIcon(_objectSpread$4({
|
|
202
204
|
fixed
|
|
203
205
|
}, props)),
|
|
204
|
-
children: jsxRuntime.jsx(SecondaryIconButton__default
|
|
206
|
+
children: jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
205
207
|
label: intl.formatMessage(messages.hideNotification),
|
|
206
208
|
onClick: props.onCloseClick,
|
|
207
209
|
icon: jsxRuntime.jsx(icons.CloseBoldIcon, {}),
|
|
@@ -376,8 +378,8 @@ var apiErrorMessages = reactIntl.defineMessages({
|
|
|
376
378
|
}
|
|
377
379
|
});
|
|
378
380
|
|
|
379
|
-
function ownKeys$3(e, r) { var t = _Object$keys__default
|
|
380
|
-
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
381
|
+
function ownKeys$3(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
382
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$3(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$3(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
381
383
|
const regexInvalidOperationRequiredAttribute = /^Required attribute '([^']+)' cannot be removed/;
|
|
382
384
|
|
|
383
385
|
// `error` fields for REST errors
|
|
@@ -417,7 +419,7 @@ const FormattedErrorMessage = props => {
|
|
|
417
419
|
// This error is not mapped / translated yet,
|
|
418
420
|
// we log, report it to sentry and show the original error, unless `error.code` is `invalid_scope`
|
|
419
421
|
// which an error code emitted for expired project(s)
|
|
420
|
-
if (extensionErrorCode !== 'invalid_scope' && !_includesInstanceProperty__default
|
|
422
|
+
if (extensionErrorCode !== 'invalid_scope' && !_includesInstanceProperty__default["default"](_context = props.error.message).call(_context, 'has expired')) {
|
|
421
423
|
sentry.reportErrorToSentry(new Error('Unmapped error'), {
|
|
422
424
|
extra: props.error
|
|
423
425
|
});
|
|
@@ -431,7 +433,7 @@ const FormattedErrorMessage = props => {
|
|
|
431
433
|
});
|
|
432
434
|
}
|
|
433
435
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
434
|
-
children: _filterInstanceProperty__default
|
|
436
|
+
children: _filterInstanceProperty__default["default"](_context2 = [props.error.message, props.error.detailedErrorMessage && `(${props.error.detailedErrorMessage})`]).call(_context2, Boolean).join(' ')
|
|
435
437
|
});
|
|
436
438
|
};
|
|
437
439
|
FormattedErrorMessage.displayName = 'FormattedErrorMessage';
|
|
@@ -477,13 +479,13 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
|
|
|
477
479
|
}
|
|
478
480
|
|
|
479
481
|
// Try to match the error with a custom error message
|
|
480
|
-
if (has__default
|
|
481
|
-
if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default
|
|
482
|
+
if (has__default["default"](error, 'invalidValue') && has__default["default"](error.invalidValue, 'overlappingPrices')) return intl.formatMessage(apiErrorMessages.OverlappingPrices);
|
|
483
|
+
if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context3 = error.message).call(_context3, 'validFrom') && _includesInstanceProperty__default["default"](_context4 = error.message).call(_context4, 'validUntil')) {
|
|
482
484
|
return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
|
|
483
485
|
field: 'validFrom'
|
|
484
486
|
});
|
|
485
487
|
}
|
|
486
|
-
if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default
|
|
488
|
+
if (extensionErrorCode === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context5 = error.message).call(_context5, 'Duplicate tax rate for')) {
|
|
487
489
|
return intl.formatMessage(apiErrorMessages.TaxCategoryDuplicateCountry);
|
|
488
490
|
}
|
|
489
491
|
if (extensionErrorCode === 'InvalidOperation' && regexInvalidOperationRequiredAttribute.test(error.message)) {
|
|
@@ -496,7 +498,7 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
|
|
|
496
498
|
// TODO: A concern has be raised that we can't accurately distinguish
|
|
497
499
|
// this error (invalid start / end dates with prices) from other price
|
|
498
500
|
// errors. We should investigate this further.
|
|
499
|
-
if (extensionErrorCode === 'InvalidField' && error.field === 'price' && has__default
|
|
501
|
+
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, {
|
|
500
502
|
field: error.field
|
|
501
503
|
});
|
|
502
504
|
if (extensionErrorCode === 'DuplicateAttributeValue' && error.attribute) {
|
|
@@ -517,8 +519,19 @@ const ApiErrorNotification = props => {
|
|
|
517
519
|
domain: props.notification.domain,
|
|
518
520
|
onCloseClick: props.dismiss,
|
|
519
521
|
children: jsxRuntime.jsx("ul", {
|
|
520
|
-
children: _valuesInstanceProperty__default
|
|
521
|
-
error.extensions?.code ?? error.code;
|
|
522
|
+
children: _valuesInstanceProperty__default["default"](props.notification) && _mapInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](props.notification).errors).call(_context, (error, idx) => {
|
|
523
|
+
const extensionErrorCode = error.extensions?.code ?? error.code;
|
|
524
|
+
const shouldLogErrorToConsole = !extensionErrorCode && "production" === 'development';
|
|
525
|
+
if (shouldLogErrorToConsole) {
|
|
526
|
+
/**
|
|
527
|
+
* NOTE: This is an API error which usually contains
|
|
528
|
+
* a `code` property such as `DuplicateField` or `InvalidOperation`.
|
|
529
|
+
* If this `code` does not exist the API is not conforming to its
|
|
530
|
+
* own error specification.
|
|
531
|
+
*/
|
|
532
|
+
// eslint-disable-next-line no-console
|
|
533
|
+
console.error('Unknown API error', error);
|
|
534
|
+
}
|
|
522
535
|
return jsxRuntime.jsx("li", {
|
|
523
536
|
children: jsxRuntime.jsx(ApiErrorMessage, {
|
|
524
537
|
error: error
|
|
@@ -538,17 +551,17 @@ const GenericNotification = props => jsxRuntime.jsx(Notification, {
|
|
|
538
551
|
});
|
|
539
552
|
GenericNotification.displayName = 'GenericNotification';
|
|
540
553
|
|
|
541
|
-
function ownKeys$2(e, r) { var t = _Object$keys__default
|
|
542
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
554
|
+
function ownKeys$2(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
555
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
543
556
|
const UnexpectedErrorNotification = props => jsxRuntime.jsx(Notification, {
|
|
544
557
|
type: "error",
|
|
545
558
|
domain: props.notification.domain,
|
|
546
559
|
onCloseClick: props.dismiss,
|
|
547
|
-
children: jsxRuntime.jsxs(Spacings__default
|
|
560
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
548
561
|
children: [jsxRuntime.jsx("div", {
|
|
549
562
|
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, apiErrorMessages.General))
|
|
550
|
-
}), _valuesInstanceProperty__default
|
|
551
|
-
children: `ID (${_valuesInstanceProperty__default
|
|
563
|
+
}), _valuesInstanceProperty__default["default"](props.notification) && _valuesInstanceProperty__default["default"](props.notification).errorId && jsxRuntime.jsx("div", {
|
|
564
|
+
children: `ID (${_valuesInstanceProperty__default["default"](props.notification).errorId})`
|
|
552
565
|
})]
|
|
553
566
|
})
|
|
554
567
|
});
|
|
@@ -573,20 +586,20 @@ const getStyles = props => {
|
|
|
573
586
|
const selectNotifications = state => state.notifications;
|
|
574
587
|
const selectGlobalNotifications = reselect.createSelector(selectNotifications, notifications => {
|
|
575
588
|
var _context;
|
|
576
|
-
return _sliceInstanceProperty__default
|
|
589
|
+
return _sliceInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](notifications).call(notifications, notification => notification.domain === constants.NOTIFICATION_DOMAINS.GLOBAL)
|
|
577
590
|
// Return only 1 at a time
|
|
578
591
|
).call(_context, 0, 1);
|
|
579
592
|
});
|
|
580
|
-
const selectPageNotifications = reselect.createSelector(selectNotifications, notifications => _filterInstanceProperty__default
|
|
581
|
-
const selectSideNotifications = reselect.createSelector(selectNotifications, notifications => _filterInstanceProperty__default
|
|
593
|
+
const selectPageNotifications = reselect.createSelector(selectNotifications, notifications => _filterInstanceProperty__default["default"](notifications).call(notifications, notification => notification.domain === constants.NOTIFICATION_DOMAINS.PAGE));
|
|
594
|
+
const selectSideNotifications = reselect.createSelector(selectNotifications, notifications => _filterInstanceProperty__default["default"](notifications).call(notifications, notification => notification.domain === constants.NOTIFICATION_DOMAINS.SIDE));
|
|
582
595
|
|
|
583
596
|
const _excluded$1 = ["values"],
|
|
584
597
|
_excluded2 = ["text"],
|
|
585
598
|
_excluded3 = ["values"],
|
|
586
599
|
_excluded4 = ["text"],
|
|
587
600
|
_excluded5 = ["text"];
|
|
588
|
-
function ownKeys$1(e, r) { var t = _Object$keys__default
|
|
589
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
601
|
+
function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
602
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
590
603
|
const NotificationsListGlobal = props => {
|
|
591
604
|
const dispatch = reactRedux.useDispatch();
|
|
592
605
|
const mapCustomNotificationToComponent = useCustomNotificationComponent();
|
|
@@ -594,7 +607,7 @@ const NotificationsListGlobal = props => {
|
|
|
594
607
|
return jsxRuntime.jsx("div", {
|
|
595
608
|
id: `notifications-${props.domain}`,
|
|
596
609
|
css: getStyles(props),
|
|
597
|
-
children: _mapInstanceProperty__default
|
|
610
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, notification => {
|
|
598
611
|
// 1. Check if there is a custom notification component first
|
|
599
612
|
const CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
600
613
|
if (CustomNotificationComponent) {
|
|
@@ -611,7 +624,7 @@ const NotificationsListGlobal = props => {
|
|
|
611
624
|
case constants.NOTIFICATION_KINDS_GLOBAL.info:
|
|
612
625
|
case constants.NOTIFICATION_KINDS_GLOBAL.success:
|
|
613
626
|
{
|
|
614
|
-
_valuesInstanceProperty__default
|
|
627
|
+
_valuesInstanceProperty__default["default"](notification);
|
|
615
628
|
const genericNotification = _objectWithoutProperties(notification, _excluded$1);
|
|
616
629
|
return jsxRuntime.jsx(GenericNotification, {
|
|
617
630
|
notification: genericNotification,
|
|
@@ -646,7 +659,7 @@ const NotificationsListPage = props => {
|
|
|
646
659
|
return jsxRuntime.jsx("div", {
|
|
647
660
|
id: `notifications-${props.domain}`,
|
|
648
661
|
css: getStyles(props),
|
|
649
|
-
children: _mapInstanceProperty__default
|
|
662
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, notification => {
|
|
650
663
|
// 1. Check if there is a custom notification component first
|
|
651
664
|
const CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
652
665
|
if (CustomNotificationComponent) {
|
|
@@ -663,7 +676,7 @@ const NotificationsListPage = props => {
|
|
|
663
676
|
case constants.NOTIFICATION_KINDS_PAGE.info:
|
|
664
677
|
case constants.NOTIFICATION_KINDS_PAGE.success:
|
|
665
678
|
{
|
|
666
|
-
_valuesInstanceProperty__default
|
|
679
|
+
_valuesInstanceProperty__default["default"](notification);
|
|
667
680
|
const genericNotification = _objectWithoutProperties(notification, _excluded3);
|
|
668
681
|
return jsxRuntime.jsx(GenericNotification, {
|
|
669
682
|
notification: _objectSpread$1(_objectSpread$1({}, genericNotification), {}, {
|
|
@@ -691,7 +704,7 @@ const NotificationsListPage = props => {
|
|
|
691
704
|
const errorNotification = _objectWithoutProperties(notification, _excluded5);
|
|
692
705
|
return jsxRuntime.jsx(UnexpectedErrorNotification, {
|
|
693
706
|
notification: _objectSpread$1(_objectSpread$1({}, errorNotification), {}, {
|
|
694
|
-
values: _valuesInstanceProperty__default
|
|
707
|
+
values: _valuesInstanceProperty__default["default"](notification)
|
|
695
708
|
}),
|
|
696
709
|
dismiss: () => {
|
|
697
710
|
dispatch(notifications.removeNotification(notification.id));
|
|
@@ -711,7 +724,7 @@ const NotificationsListSide = props => {
|
|
|
711
724
|
return jsxRuntime.jsx("div", {
|
|
712
725
|
id: `notifications-${props.domain}`,
|
|
713
726
|
css: getStyles(props),
|
|
714
|
-
children: _mapInstanceProperty__default
|
|
727
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, notification => {
|
|
715
728
|
// 1. Check if there is a custom notification component first
|
|
716
729
|
const CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
717
730
|
if (CustomNotificationComponent) {
|
|
@@ -754,8 +767,8 @@ const NotificationsList = props => {
|
|
|
754
767
|
NotificationsList.displayName = 'NotificationsList';
|
|
755
768
|
|
|
756
769
|
const _excluded = ["domain", "kind"];
|
|
757
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
758
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
770
|
+
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
771
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
759
772
|
const Notifier = _ref => {
|
|
760
773
|
let _ref$domain = _ref.domain,
|
|
761
774
|
domain = _ref$domain === void 0 ? constants.NOTIFICATION_DOMAINS.SIDE : _ref$domain,
|
|
@@ -768,7 +781,7 @@ const Notifier = _ref => {
|
|
|
768
781
|
domain: domain,
|
|
769
782
|
kind: kind,
|
|
770
783
|
text: props.text
|
|
771
|
-
}, isNumber__default
|
|
784
|
+
}, isNumber__default["default"](props.dismissAfter) ? _objectSpread(_objectSpread({}, props.meta), {}, {
|
|
772
785
|
dismissAfter: props.dismissAfter
|
|
773
786
|
}) : props.meta);
|
|
774
787
|
return () => {
|
|
@@ -11,7 +11,7 @@ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object
|
|
|
11
11
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
12
12
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
13
13
|
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
|
14
|
-
import { NOTIFICATION_DOMAINS, NOTIFICATION_KINDS_SIDE,
|
|
14
|
+
import { NOTIFICATION_DOMAINS, NOTIFICATION_KINDS_SIDE, NOTIFICATION_KINDS_GLOBAL, NOTIFICATION_KINDS_PAGE } from '@commercetools-frontend/constants';
|
|
15
15
|
import { useFieldId } from '@commercetools-uikit/hooks';
|
|
16
16
|
import { CloseBoldIcon, ErrorIcon, InformationIcon, WarningIcon, CheckBoldIcon } from '@commercetools-uikit/icons';
|
|
17
17
|
import SecondaryIconButton from '@commercetools-uikit/secondary-icon-button';
|
|
@@ -34,7 +34,7 @@ import isNumber from 'lodash/isNumber';
|
|
|
34
34
|
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
35
35
|
|
|
36
36
|
// NOTE: This string will be replaced on build time with the package version.
|
|
37
|
-
var version = "27.
|
|
37
|
+
var version = "27.6.0";
|
|
38
38
|
|
|
39
39
|
const Context = /*#__PURE__*/createContext(() => null);
|
|
40
40
|
function NotificationProviderForCustomComponent(props) {
|
|
@@ -132,7 +132,7 @@ const getStylesForNotification = props => {
|
|
|
132
132
|
|
|
133
133
|
const _excluded$2 = ["fixed"];
|
|
134
134
|
function ownKeys$4(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
135
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$4(Object(t),
|
|
135
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
136
136
|
const sequentialId = createSequentialId('notification-');
|
|
137
137
|
const NotificationIcon = props => {
|
|
138
138
|
if (props.type === NOTIFICATION_KINDS_SIDE.error) {
|
|
@@ -354,7 +354,7 @@ var apiErrorMessages = defineMessages({
|
|
|
354
354
|
});
|
|
355
355
|
|
|
356
356
|
function ownKeys$3(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
357
|
-
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys$3(Object(t),
|
|
357
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys$3(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys$3(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
358
358
|
const regexInvalidOperationRequiredAttribute = /^Required attribute '([^']+)' cannot be removed/;
|
|
359
359
|
|
|
360
360
|
// `error` fields for REST errors
|
|
@@ -527,7 +527,7 @@ const GenericNotification = props => jsx(Notification, {
|
|
|
527
527
|
GenericNotification.displayName = 'GenericNotification';
|
|
528
528
|
|
|
529
529
|
function ownKeys$2(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
530
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$2(Object(t),
|
|
530
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$2(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$2(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
531
531
|
const UnexpectedErrorNotification = props => jsx(Notification, {
|
|
532
532
|
type: "error",
|
|
533
533
|
domain: props.notification.domain,
|
|
@@ -574,7 +574,7 @@ const _excluded$1 = ["values"],
|
|
|
574
574
|
_excluded4 = ["text"],
|
|
575
575
|
_excluded5 = ["text"];
|
|
576
576
|
function ownKeys$1(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
577
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$1(Object(t),
|
|
577
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
578
578
|
const NotificationsListGlobal = props => {
|
|
579
579
|
const dispatch = useDispatch();
|
|
580
580
|
const mapCustomNotificationToComponent = useCustomNotificationComponent();
|
|
@@ -749,7 +749,7 @@ NotificationsList.displayName = 'NotificationsList';
|
|
|
749
749
|
|
|
750
750
|
const _excluded = ["domain", "kind"];
|
|
751
751
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
752
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t),
|
|
752
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
753
753
|
const Notifier = _ref => {
|
|
754
754
|
let _ref$domain = _ref.domain,
|
|
755
755
|
domain = _ref$domain === void 0 ? NOTIFICATION_DOMAINS.SIDE : _ref$domain,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/react-notifications",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.6.0",
|
|
4
4
|
"description": "React bindings for @commercetools-frontend/notifications",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "^7.22.15",
|
|
32
32
|
"@babel/runtime-corejs3": "^7.22.15",
|
|
33
|
-
"@commercetools-frontend/actions-global": "27.
|
|
34
|
-
"@commercetools-frontend/application-components": "27.
|
|
35
|
-
"@commercetools-frontend/constants": "27.
|
|
36
|
-
"@commercetools-frontend/notifications": "27.
|
|
37
|
-
"@commercetools-frontend/sentry": "27.
|
|
33
|
+
"@commercetools-frontend/actions-global": "27.6.0",
|
|
34
|
+
"@commercetools-frontend/application-components": "27.6.0",
|
|
35
|
+
"@commercetools-frontend/constants": "27.6.0",
|
|
36
|
+
"@commercetools-frontend/notifications": "27.6.0",
|
|
37
|
+
"@commercetools-frontend/sentry": "27.6.0",
|
|
38
38
|
"@commercetools-uikit/design-system": "^20.4.0",
|
|
39
39
|
"@commercetools-uikit/hooks": "^20.4.0",
|
|
40
40
|
"@commercetools-uikit/icon-button": "^20.4.0",
|