@commercetools-frontend/react-notifications 20.9.4 → 20.10.6
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.
- package/dist/commercetools-frontend-react-notifications.cjs.dev.js +66 -76
- package/dist/commercetools-frontend-react-notifications.cjs.prod.js +50 -60
- package/dist/commercetools-frontend-react-notifications.esm.js +14 -24
- package/dist/declarations/src/components/map-notification-to-component/index.d.ts +4 -4
- package/dist/declarations/src/components/map-notification-to-component/map-notification-to-component.d.ts +12 -12
- package/dist/declarations/src/components/notification/index.d.ts +1 -1
- package/dist/declarations/src/components/notification/messages.d.ts +8 -8
- package/dist/declarations/src/components/notification/notification.d.ts +15 -15
- package/dist/declarations/src/components/notification/notification.styles.d.ts +10 -10
- package/dist/declarations/src/components/notification-kinds/api-error/api-error.d.ts +16 -16
- package/dist/declarations/src/components/notification-kinds/api-error/index.d.ts +1 -1
- package/dist/declarations/src/components/notification-kinds/api-error-message/api-error-message.d.ts +31 -31
- package/dist/declarations/src/components/notification-kinds/api-error-message/index.d.ts +1 -1
- package/dist/declarations/src/components/notification-kinds/api-error-message/messages.d.ts +138 -138
- package/dist/declarations/src/components/notification-kinds/generic/generic.d.ts +15 -15
- package/dist/declarations/src/components/notification-kinds/generic/index.d.ts +1 -1
- package/dist/declarations/src/components/notification-kinds/unexpected-error/index.d.ts +1 -1
- package/dist/declarations/src/components/notification-kinds/unexpected-error/unexpected-error.d.ts +16 -16
- package/dist/declarations/src/components/notifications-list/index.d.ts +2 -2
- package/dist/declarations/src/components/notifications-list/notifications-list.d.ts +9 -9
- package/dist/declarations/src/components/notifications-list/notifications-list.styles.d.ts +6 -6
- package/dist/declarations/src/components/notifications-list/selectors.d.ts +12 -6
- package/dist/declarations/src/components/notifications-list/types.d.ts +4 -4
- package/dist/declarations/src/components/notifier/index.d.ts +1 -1
- package/dist/declarations/src/components/notifier/notifier.d.ts +16 -16
- package/dist/declarations/src/export-types.d.ts +2 -2
- package/dist/declarations/src/index.d.ts +7 -7
- package/dist/declarations/src/utils/filter-data-attributes.d.ts +1 -1
- package/dist/declarations/src/version.d.ts +2 -2
- package/package.json +13 -17
|
@@ -59,8 +59,8 @@ var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
|
59
59
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
60
60
|
var isNumber__default = /*#__PURE__*/_interopDefault(isNumber);
|
|
61
61
|
|
|
62
|
-
// NOTE: This string will be replaced
|
|
63
|
-
var version =
|
|
62
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
63
|
+
var version = "20.10.6";
|
|
64
64
|
|
|
65
65
|
var Context = /*#__PURE__*/react.createContext(function () {
|
|
66
66
|
return null;
|
|
@@ -80,8 +80,8 @@ var useCustomNotificationComponent = function useCustomNotificationComponent() {
|
|
|
80
80
|
}; // Exports
|
|
81
81
|
|
|
82
82
|
function filterDataAttributes(obj) {
|
|
83
|
-
return omitBy__default[
|
|
84
|
-
return !_startsWithInstanceProperty__default[
|
|
83
|
+
return omitBy__default["default"](obj, function (_value, key) {
|
|
84
|
+
return !_startsWithInstanceProperty__default["default"](key).call(key, 'data-');
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -149,9 +149,9 @@ var getStylesForNotification = function getStylesForNotification(props) {
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
152
|
+
function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
153
153
|
|
|
154
|
-
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default[
|
|
154
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
155
155
|
|
|
156
156
|
var NotificationIcon = function NotificationIcon(props) {
|
|
157
157
|
if (props.type === constants.NOTIFICATION_KINDS_SIDE.error) return jsxRuntime.jsx(icons.ErrorIcon, {
|
|
@@ -183,7 +183,7 @@ var Notification = function Notification(props) {
|
|
|
183
183
|
css: getStylesForContent(props),
|
|
184
184
|
children: props.children
|
|
185
185
|
}), props.onCloseClick ? jsxRuntime.jsx("div", {
|
|
186
|
-
children: jsxRuntime.jsx(IconButton__default[
|
|
186
|
+
children: jsxRuntime.jsx(IconButton__default["default"], {
|
|
187
187
|
label: intl.formatMessage(messages.hideNotification),
|
|
188
188
|
onClick: props.onCloseClick,
|
|
189
189
|
icon: jsxRuntime.jsx(icons.CloseBoldIcon, {}),
|
|
@@ -356,9 +356,9 @@ var apiErrorMessages = reactIntl.defineMessages({
|
|
|
356
356
|
}
|
|
357
357
|
});
|
|
358
358
|
|
|
359
|
-
function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
359
|
+
function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
360
360
|
|
|
361
|
-
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context6; _forEachInstanceProperty__default[
|
|
361
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context6; _forEachInstanceProperty__default["default"](_context6 = ownKeys$3(Object(source), true)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context7; _forEachInstanceProperty__default["default"](_context7 = ownKeys$3(Object(source))).call(_context7, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
362
362
|
var regexInvalidOperationRequiredAttribute = /Required attribute '(.*)' cannot be removed/;
|
|
363
363
|
|
|
364
364
|
// The values passed to the Intl message must be a map of scalar values.
|
|
@@ -393,7 +393,7 @@ var FormattedErrorMessage = function FormattedErrorMessage(props) {
|
|
|
393
393
|
// This error is not mapped / translated yet,
|
|
394
394
|
// we log, report it to sentry and show the original error, unless `error.code` is `invalid_scope`
|
|
395
395
|
// which an error code emitted for expired project(s)
|
|
396
|
-
if (props.error.code !== 'invalid_scope' && !_includesInstanceProperty__default[
|
|
396
|
+
if (props.error.code !== 'invalid_scope' && !_includesInstanceProperty__default["default"](_context = props.error.message).call(_context, 'has expired')) {
|
|
397
397
|
sentry.reportErrorToSentry(new Error('Unmapped error'), {
|
|
398
398
|
extra: props.error
|
|
399
399
|
});
|
|
@@ -409,12 +409,12 @@ var FormattedErrorMessage = function FormattedErrorMessage(props) {
|
|
|
409
409
|
}
|
|
410
410
|
|
|
411
411
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
412
|
-
children: _filterInstanceProperty__default[
|
|
412
|
+
children: _filterInstanceProperty__default["default"](_context2 = [props.error.message, props.error.detailedErrorMessage && "(".concat(props.error.detailedErrorMessage, ")")]).call(_context2, Boolean).join(' ')
|
|
413
413
|
});
|
|
414
414
|
};
|
|
415
415
|
|
|
416
416
|
FormattedErrorMessage.propTypes = {
|
|
417
|
-
error: _pt__default[
|
|
417
|
+
error: _pt__default["default"].any.isRequired
|
|
418
418
|
};
|
|
419
419
|
FormattedErrorMessage.displayName = 'FormattedErrorMessage';
|
|
420
420
|
|
|
@@ -455,15 +455,15 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
|
|
|
455
455
|
slugValue: error.duplicateValue
|
|
456
456
|
}); // Try to match the error with a custom error message
|
|
457
457
|
|
|
458
|
-
if (has__default[
|
|
458
|
+
if (has__default["default"](error, 'invalidValue') && has__default["default"](error.invalidValue, 'overlappingPrices')) return intl.formatMessage(apiErrorMessages.OverlappingPrices);
|
|
459
459
|
|
|
460
|
-
if (error.code === 'InvalidOperation' && _includesInstanceProperty__default[
|
|
460
|
+
if (error.code === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context3 = error.message).call(_context3, 'validFrom') && _includesInstanceProperty__default["default"](_context4 = error.message).call(_context4, 'validUntil')) {
|
|
461
461
|
return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
|
|
462
462
|
field: 'validFrom'
|
|
463
463
|
});
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
-
if (error.code === 'InvalidOperation' && _includesInstanceProperty__default[
|
|
466
|
+
if (error.code === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context5 = error.message).call(_context5, 'Duplicate tax rate for')) {
|
|
467
467
|
return intl.formatMessage(apiErrorMessages.TaxCategoryDuplicateCountry);
|
|
468
468
|
}
|
|
469
469
|
|
|
@@ -477,7 +477,7 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
|
|
|
477
477
|
// errors. We should investigate this further.
|
|
478
478
|
|
|
479
479
|
|
|
480
|
-
if (error.code === 'InvalidField' && error.field === 'price' && has__default[
|
|
480
|
+
if (error.code === 'InvalidField' && error.field === 'price' && has__default["default"](error, 'invalidValue') && has__default["default"](error.invalidValue, 'validFrom') && has__default["default"](error.invalidValue, 'validUntil')) return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
|
|
481
481
|
field: error.field
|
|
482
482
|
});
|
|
483
483
|
|
|
@@ -502,7 +502,7 @@ var ApiErrorNotification = function ApiErrorNotification(props) {
|
|
|
502
502
|
domain: props.notification.domain,
|
|
503
503
|
onCloseClick: props.dismiss,
|
|
504
504
|
children: jsxRuntime.jsx("ul", {
|
|
505
|
-
children: _valuesInstanceProperty__default[
|
|
505
|
+
children: _valuesInstanceProperty__default["default"](props.notification) && _mapInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](props.notification).errors).call(_context, function (error, idx) {
|
|
506
506
|
var shouldLogErrorToConsole = !error.code && "production" === 'development';
|
|
507
507
|
|
|
508
508
|
if (shouldLogErrorToConsole) {
|
|
@@ -529,20 +529,20 @@ var ApiErrorNotification = function ApiErrorNotification(props) {
|
|
|
529
529
|
ApiErrorNotification.propTypes = {};
|
|
530
530
|
ApiErrorNotification.displayName = 'ApiErrorNotification';
|
|
531
531
|
|
|
532
|
-
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
532
|
+
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
533
533
|
|
|
534
|
-
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default[
|
|
534
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
535
535
|
|
|
536
536
|
var UnexpectedErrorNotification = function UnexpectedErrorNotification(props) {
|
|
537
537
|
return jsxRuntime.jsx(Notification, {
|
|
538
538
|
type: "error",
|
|
539
539
|
domain: props.notification.domain,
|
|
540
540
|
onCloseClick: props.dismiss,
|
|
541
|
-
children: jsxRuntime.jsxs(Spacings__default[
|
|
541
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
542
542
|
children: [jsxRuntime.jsx("div", {
|
|
543
543
|
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, apiErrorMessages.General))
|
|
544
|
-
}), _valuesInstanceProperty__default[
|
|
545
|
-
children: "ID (".concat(_valuesInstanceProperty__default[
|
|
544
|
+
}), _valuesInstanceProperty__default["default"](props.notification) && _valuesInstanceProperty__default["default"](props.notification).errorId && jsxRuntime.jsx("div", {
|
|
545
|
+
children: "ID (".concat(_valuesInstanceProperty__default["default"](props.notification).errorId, ")")
|
|
546
546
|
})]
|
|
547
547
|
})
|
|
548
548
|
});
|
|
@@ -557,32 +557,22 @@ var selectNotifications = function selectNotifications(state) {
|
|
|
557
557
|
return state.notifications;
|
|
558
558
|
};
|
|
559
559
|
var selectGlobalNotifications = reselect.createSelector(selectNotifications, function (notifications) {
|
|
560
|
-
var _context
|
|
561
|
-
|
|
562
|
-
return (
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
).call(_context, 0, 1)
|
|
567
|
-
);
|
|
560
|
+
var _context;
|
|
561
|
+
|
|
562
|
+
return _sliceInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
|
|
563
|
+
return notification.domain === constants.NOTIFICATION_DOMAINS.GLOBAL;
|
|
564
|
+
}) // Return only 1 at a time
|
|
565
|
+
).call(_context, 0, 1);
|
|
568
566
|
});
|
|
569
567
|
var selectPageNotifications = reselect.createSelector(selectNotifications, function (notifications) {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
_filterInstanceProperty__default['default'](_context3 = notifications).call(_context3, function (notification) {
|
|
574
|
-
return notification.domain === constants.NOTIFICATION_DOMAINS.PAGE;
|
|
575
|
-
})
|
|
576
|
-
);
|
|
568
|
+
return _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
|
|
569
|
+
return notification.domain === constants.NOTIFICATION_DOMAINS.PAGE;
|
|
570
|
+
});
|
|
577
571
|
});
|
|
578
572
|
var selectSideNotifications = reselect.createSelector(selectNotifications, function (notifications) {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
_filterInstanceProperty__default['default'](_context4 = notifications).call(_context4, function (notification) {
|
|
583
|
-
return notification.domain === constants.NOTIFICATION_DOMAINS.SIDE;
|
|
584
|
-
})
|
|
585
|
-
);
|
|
573
|
+
return _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
|
|
574
|
+
return notification.domain === constants.NOTIFICATION_DOMAINS.SIDE;
|
|
575
|
+
});
|
|
586
576
|
});
|
|
587
577
|
|
|
588
578
|
var getStyles = function getStyles(props) {
|
|
@@ -609,9 +599,9 @@ var _excluded = ["values"],
|
|
|
609
599
|
_excluded4 = ["text"],
|
|
610
600
|
_excluded5 = ["text"];
|
|
611
601
|
|
|
612
|
-
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
602
|
+
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
613
603
|
|
|
614
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default[
|
|
604
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
615
605
|
|
|
616
606
|
var NotificationsListGlobal = function NotificationsListGlobal(props) {
|
|
617
607
|
var dispatch = reactRedux.useDispatch();
|
|
@@ -619,7 +609,7 @@ var NotificationsListGlobal = function NotificationsListGlobal(props) {
|
|
|
619
609
|
var notifications$1 = reactRedux.useSelector(selectGlobalNotifications);
|
|
620
610
|
return jsxRuntime.jsx("div", {
|
|
621
611
|
css: getStyles(props),
|
|
622
|
-
children: _mapInstanceProperty__default[
|
|
612
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
|
|
623
613
|
// 1. Check if there is a custom notification component first
|
|
624
614
|
var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
625
615
|
|
|
@@ -638,7 +628,7 @@ var NotificationsListGlobal = function NotificationsListGlobal(props) {
|
|
|
638
628
|
case constants.NOTIFICATION_KINDS_GLOBAL.info:
|
|
639
629
|
case constants.NOTIFICATION_KINDS_GLOBAL.success:
|
|
640
630
|
{
|
|
641
|
-
_valuesInstanceProperty__default[
|
|
631
|
+
_valuesInstanceProperty__default["default"](notification);
|
|
642
632
|
var genericNotification = _objectWithoutProperties(notification, _excluded);
|
|
643
633
|
|
|
644
634
|
return jsxRuntime.jsx(GenericNotification, {
|
|
@@ -678,7 +668,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
|
|
|
678
668
|
var notifications$1 = reactRedux.useSelector(selectPageNotifications);
|
|
679
669
|
return jsxRuntime.jsx("div", {
|
|
680
670
|
css: getStyles(props),
|
|
681
|
-
children: _mapInstanceProperty__default[
|
|
671
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
|
|
682
672
|
// 1. Check if there is a custom notification component first
|
|
683
673
|
var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
684
674
|
|
|
@@ -697,7 +687,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
|
|
|
697
687
|
case constants.NOTIFICATION_KINDS_PAGE.info:
|
|
698
688
|
case constants.NOTIFICATION_KINDS_PAGE.success:
|
|
699
689
|
{
|
|
700
|
-
_valuesInstanceProperty__default[
|
|
690
|
+
_valuesInstanceProperty__default["default"](notification);
|
|
701
691
|
var genericNotification = _objectWithoutProperties(notification, _excluded3);
|
|
702
692
|
|
|
703
693
|
return jsxRuntime.jsx(GenericNotification, {
|
|
@@ -730,7 +720,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
|
|
|
730
720
|
|
|
731
721
|
return jsxRuntime.jsx(UnexpectedErrorNotification, {
|
|
732
722
|
notification: _objectSpread$1(_objectSpread$1({}, _errorNotification), {}, {
|
|
733
|
-
values: _valuesInstanceProperty__default[
|
|
723
|
+
values: _valuesInstanceProperty__default["default"](notification)
|
|
734
724
|
}),
|
|
735
725
|
dismiss: function dismiss() {
|
|
736
726
|
dispatch(notifications.removeNotification(notification.id));
|
|
@@ -751,7 +741,7 @@ var NotificationsListSide = function NotificationsListSide(props) {
|
|
|
751
741
|
var notifications$1 = reactRedux.useSelector(selectSideNotifications);
|
|
752
742
|
return jsxRuntime.jsx("div", {
|
|
753
743
|
css: getStyles(props),
|
|
754
|
-
children: _mapInstanceProperty__default[
|
|
744
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
|
|
755
745
|
// 1. Check if there is a custom notification component first
|
|
756
746
|
var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
757
747
|
|
|
@@ -801,9 +791,9 @@ var NotificationsList = function NotificationsList(props) {
|
|
|
801
791
|
|
|
802
792
|
NotificationsList.displayName = 'NotificationsList';
|
|
803
793
|
|
|
804
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
794
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
805
795
|
|
|
806
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default[
|
|
796
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
807
797
|
var defaultProps = {
|
|
808
798
|
domain: constants.NOTIFICATION_DOMAINS.SIDE,
|
|
809
799
|
kind: constants.NOTIFICATION_KINDS_SIDE.success
|
|
@@ -817,7 +807,7 @@ var Notifier = function Notifier(props) {
|
|
|
817
807
|
domain: props.domain,
|
|
818
808
|
kind: props.kind,
|
|
819
809
|
text: props.text
|
|
820
|
-
}, isNumber__default[
|
|
810
|
+
}, isNumber__default["default"](props.dismissAfter) ? _objectSpread(_objectSpread({}, props.meta), {}, {
|
|
821
811
|
dismissAfter: props.dismissAfter
|
|
822
812
|
}) : props.meta);
|
|
823
813
|
return function () {
|
|
@@ -830,11 +820,11 @@ var Notifier = function Notifier(props) {
|
|
|
830
820
|
};
|
|
831
821
|
|
|
832
822
|
Notifier.propTypes = {
|
|
833
|
-
domain: _pt__default[
|
|
834
|
-
kind: _pt__default[
|
|
835
|
-
text: _pt__default[
|
|
836
|
-
meta: _pt__default[
|
|
837
|
-
dismissAfter: _pt__default[
|
|
823
|
+
domain: _pt__default["default"].any.isRequired,
|
|
824
|
+
kind: _pt__default["default"].any.isRequired,
|
|
825
|
+
text: _pt__default["default"].string,
|
|
826
|
+
meta: _pt__default["default"].objectOf(_pt__default["default"].any),
|
|
827
|
+
dismissAfter: _pt__default["default"].number
|
|
838
828
|
};
|
|
839
829
|
Notifier.displayName = 'Notifier';
|
|
840
830
|
Notifier.defaultProps = defaultProps;
|
|
@@ -33,8 +33,8 @@ import { createSelector } from 'reselect';
|
|
|
33
33
|
import isNumber from 'lodash/isNumber';
|
|
34
34
|
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
35
35
|
|
|
36
|
-
// NOTE: This string will be replaced
|
|
37
|
-
var version =
|
|
36
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
37
|
+
var version = "20.10.6";
|
|
38
38
|
|
|
39
39
|
var Context = /*#__PURE__*/createContext(function () {
|
|
40
40
|
return null;
|
|
@@ -554,32 +554,22 @@ var selectNotifications = function selectNotifications(state) {
|
|
|
554
554
|
return state.notifications;
|
|
555
555
|
};
|
|
556
556
|
var selectGlobalNotifications = createSelector(selectNotifications, function (notifications) {
|
|
557
|
-
var _context
|
|
558
|
-
|
|
559
|
-
return (
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
).call(_context, 0, 1)
|
|
564
|
-
);
|
|
557
|
+
var _context;
|
|
558
|
+
|
|
559
|
+
return _sliceInstanceProperty(_context = _filterInstanceProperty(notifications).call(notifications, function (notification) {
|
|
560
|
+
return notification.domain === NOTIFICATION_DOMAINS.GLOBAL;
|
|
561
|
+
}) // Return only 1 at a time
|
|
562
|
+
).call(_context, 0, 1);
|
|
565
563
|
});
|
|
566
564
|
var selectPageNotifications = createSelector(selectNotifications, function (notifications) {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
_filterInstanceProperty(_context3 = notifications).call(_context3, function (notification) {
|
|
571
|
-
return notification.domain === NOTIFICATION_DOMAINS.PAGE;
|
|
572
|
-
})
|
|
573
|
-
);
|
|
565
|
+
return _filterInstanceProperty(notifications).call(notifications, function (notification) {
|
|
566
|
+
return notification.domain === NOTIFICATION_DOMAINS.PAGE;
|
|
567
|
+
});
|
|
574
568
|
});
|
|
575
569
|
var selectSideNotifications = createSelector(selectNotifications, function (notifications) {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
_filterInstanceProperty(_context4 = notifications).call(_context4, function (notification) {
|
|
580
|
-
return notification.domain === NOTIFICATION_DOMAINS.SIDE;
|
|
581
|
-
})
|
|
582
|
-
);
|
|
570
|
+
return _filterInstanceProperty(notifications).call(notifications, function (notification) {
|
|
571
|
+
return notification.domain === NOTIFICATION_DOMAINS.SIDE;
|
|
572
|
+
});
|
|
583
573
|
});
|
|
584
574
|
|
|
585
575
|
var getStyles = function getStyles(props) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Props } from './map-notification-to-component';
|
|
2
|
-
export declare type TProps = Props;
|
|
3
|
-
export { default } from './map-notification-to-component';
|
|
4
|
-
export { useCustomNotificationComponent } from './map-notification-to-component';
|
|
1
|
+
import type { Props } from './map-notification-to-component';
|
|
2
|
+
export declare type TProps = Props;
|
|
3
|
+
export { default } from './map-notification-to-component';
|
|
4
|
+
export { useCustomNotificationComponent } from './map-notification-to-component';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { TAppNotificationGlobal, TAppNotificationPage, TAppNotificationSide } from '@commercetools-frontend/constants';
|
|
2
|
-
import { ElementType, ReactNode } from 'react';
|
|
3
|
-
export declare type Props = {
|
|
4
|
-
mapNotificationToComponent: (notification: TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide) => ElementType | null;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
};
|
|
7
|
-
declare function NotificationProviderForCustomComponent(props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
-
declare namespace NotificationProviderForCustomComponent {
|
|
9
|
-
var displayName: string;
|
|
10
|
-
}
|
|
11
|
-
export declare const useCustomNotificationComponent: () => (notification: TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide) => ElementType | null;
|
|
12
|
-
export default NotificationProviderForCustomComponent;
|
|
1
|
+
import type { TAppNotificationGlobal, TAppNotificationPage, TAppNotificationSide } from '@commercetools-frontend/constants';
|
|
2
|
+
import { ElementType, ReactNode } from 'react';
|
|
3
|
+
export declare type Props = {
|
|
4
|
+
mapNotificationToComponent: (notification: TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide) => ElementType | null;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare function NotificationProviderForCustomComponent(props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare namespace NotificationProviderForCustomComponent {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const useCustomNotificationComponent: () => (notification: TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide) => ElementType | null;
|
|
12
|
+
export default NotificationProviderForCustomComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './notification';
|
|
1
|
+
export { default } from './notification';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
hideNotification: {
|
|
3
|
-
id: string;
|
|
4
|
-
description: string;
|
|
5
|
-
defaultMessage: string;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
export default _default;
|
|
1
|
+
declare const _default: {
|
|
2
|
+
hideNotification: {
|
|
3
|
+
id: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defaultMessage: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { TAppNotificationKind, TAppNotificationDomain } from '@commercetools-frontend/constants';
|
|
2
|
-
import { ReactNode, SyntheticEvent } from 'react';
|
|
3
|
-
export declare type Props = {
|
|
4
|
-
domain: TAppNotificationDomain;
|
|
5
|
-
type: TAppNotificationKind;
|
|
6
|
-
fixed: boolean;
|
|
7
|
-
onCloseClick?: (event: SyntheticEvent) => void;
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
};
|
|
10
|
-
declare const Notification: {
|
|
11
|
-
(props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
-
displayName: string;
|
|
13
|
-
defaultProps: Pick<Props, "fixed">;
|
|
14
|
-
};
|
|
15
|
-
export default Notification;
|
|
1
|
+
import type { TAppNotificationKind, TAppNotificationDomain } from '@commercetools-frontend/constants';
|
|
2
|
+
import { ReactNode, SyntheticEvent } from 'react';
|
|
3
|
+
export declare type Props = {
|
|
4
|
+
domain: TAppNotificationDomain;
|
|
5
|
+
type: TAppNotificationKind;
|
|
6
|
+
fixed: boolean;
|
|
7
|
+
onCloseClick?: (event: SyntheticEvent) => void;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare const Notification: {
|
|
11
|
+
(props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
defaultProps: Pick<Props, "fixed">;
|
|
14
|
+
};
|
|
15
|
+
export default Notification;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { TAppNotificationKind, TAppNotificationDomain } from '@commercetools-frontend/constants';
|
|
2
|
-
declare type StyleProps = {
|
|
3
|
-
type: TAppNotificationKind;
|
|
4
|
-
domain: TAppNotificationDomain;
|
|
5
|
-
fixed: boolean;
|
|
6
|
-
};
|
|
7
|
-
declare const getStylesForIcon: (props: StyleProps) => import("@emotion/utils").SerializedStyles;
|
|
8
|
-
declare const getStylesForContent: (props: StyleProps) => import("@emotion/utils").SerializedStyles;
|
|
9
|
-
declare const getStylesForNotification: (props: StyleProps) => import("@emotion/utils").SerializedStyles;
|
|
10
|
-
export { getStylesForIcon, getStylesForContent, getStylesForNotification };
|
|
1
|
+
import type { TAppNotificationKind, TAppNotificationDomain } from '@commercetools-frontend/constants';
|
|
2
|
+
declare type StyleProps = {
|
|
3
|
+
type: TAppNotificationKind;
|
|
4
|
+
domain: TAppNotificationDomain;
|
|
5
|
+
fixed: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const getStylesForIcon: (props: StyleProps) => import("@emotion/utils").SerializedStyles;
|
|
8
|
+
declare const getStylesForContent: (props: StyleProps) => import("@emotion/utils").SerializedStyles;
|
|
9
|
+
declare const getStylesForNotification: (props: StyleProps) => import("@emotion/utils").SerializedStyles;
|
|
10
|
+
export { getStylesForIcon, getStylesForContent, getStylesForNotification };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { TAppNotification, TAppNotificationValuesApiError } from '@commercetools-frontend/constants';
|
|
2
|
-
import { SyntheticEvent } from 'react';
|
|
3
|
-
import { NOTIFICATION_DOMAINS, NOTIFICATION_KINDS_PAGE } from '@commercetools-frontend/constants';
|
|
4
|
-
declare type Props = {
|
|
5
|
-
notification: TAppNotification<{
|
|
6
|
-
domain: typeof NOTIFICATION_DOMAINS.PAGE;
|
|
7
|
-
kind: typeof NOTIFICATION_KINDS_PAGE['api-error'];
|
|
8
|
-
values: TAppNotificationValuesApiError;
|
|
9
|
-
}>;
|
|
10
|
-
dismiss: (event: SyntheticEvent) => void;
|
|
11
|
-
};
|
|
12
|
-
declare const ApiErrorNotification: {
|
|
13
|
-
(props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
14
|
-
displayName: string;
|
|
15
|
-
};
|
|
16
|
-
export default ApiErrorNotification;
|
|
1
|
+
import type { TAppNotification, TAppNotificationValuesApiError } from '@commercetools-frontend/constants';
|
|
2
|
+
import { SyntheticEvent } from 'react';
|
|
3
|
+
import { NOTIFICATION_DOMAINS, NOTIFICATION_KINDS_PAGE } from '@commercetools-frontend/constants';
|
|
4
|
+
declare type Props = {
|
|
5
|
+
notification: TAppNotification<{
|
|
6
|
+
domain: typeof NOTIFICATION_DOMAINS.PAGE;
|
|
7
|
+
kind: typeof NOTIFICATION_KINDS_PAGE['api-error'];
|
|
8
|
+
values: TAppNotificationValuesApiError;
|
|
9
|
+
}>;
|
|
10
|
+
dismiss: (event: SyntheticEvent) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const ApiErrorNotification: {
|
|
13
|
+
(props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
export default ApiErrorNotification;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './api-error';
|
|
1
|
+
export { default } from './api-error';
|
package/dist/declarations/src/components/notification-kinds/api-error-message/api-error-message.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import type { TAppNotificationApiError } from '@commercetools-frontend/constants';
|
|
2
|
-
declare type ExtraErrorFields = {
|
|
3
|
-
errorByExtension?: {
|
|
4
|
-
id: string;
|
|
5
|
-
key?: string;
|
|
6
|
-
};
|
|
7
|
-
localizedMessage?: {
|
|
8
|
-
[locale: string]: string;
|
|
9
|
-
};
|
|
10
|
-
field?: string;
|
|
11
|
-
duplicateValue?: string;
|
|
12
|
-
invalidValue?: string | {
|
|
13
|
-
overlappingPrices: string;
|
|
14
|
-
} | {
|
|
15
|
-
validFrom: string;
|
|
16
|
-
validUntil: string;
|
|
17
|
-
};
|
|
18
|
-
detailedErrorMessage?: string;
|
|
19
|
-
attribute?: {
|
|
20
|
-
name: string;
|
|
21
|
-
};
|
|
22
|
-
referencedBy?: string;
|
|
23
|
-
};
|
|
24
|
-
declare type Props = {
|
|
25
|
-
error: TAppNotificationApiError<ExtraErrorFields>;
|
|
26
|
-
};
|
|
27
|
-
declare const ApiErrorMessage: {
|
|
28
|
-
(props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
29
|
-
displayName: string;
|
|
30
|
-
};
|
|
31
|
-
export default ApiErrorMessage;
|
|
1
|
+
import type { TAppNotificationApiError } from '@commercetools-frontend/constants';
|
|
2
|
+
declare type ExtraErrorFields = {
|
|
3
|
+
errorByExtension?: {
|
|
4
|
+
id: string;
|
|
5
|
+
key?: string;
|
|
6
|
+
};
|
|
7
|
+
localizedMessage?: {
|
|
8
|
+
[locale: string]: string;
|
|
9
|
+
};
|
|
10
|
+
field?: string;
|
|
11
|
+
duplicateValue?: string;
|
|
12
|
+
invalidValue?: string | {
|
|
13
|
+
overlappingPrices: string;
|
|
14
|
+
} | {
|
|
15
|
+
validFrom: string;
|
|
16
|
+
validUntil: string;
|
|
17
|
+
};
|
|
18
|
+
detailedErrorMessage?: string;
|
|
19
|
+
attribute?: {
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
referencedBy?: string;
|
|
23
|
+
};
|
|
24
|
+
declare type Props = {
|
|
25
|
+
error: TAppNotificationApiError<ExtraErrorFields>;
|
|
26
|
+
};
|
|
27
|
+
declare const ApiErrorMessage: {
|
|
28
|
+
(props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
export default ApiErrorMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './api-error-message';
|
|
1
|
+
export { default } from './api-error-message';
|