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