@commercetools-frontend/react-notifications 20.10.1 → 20.11.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.
- 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/notifications-list/selectors.d.ts +9 -3
- package/dist/declarations/src/version.d.ts +1 -1
- package/package.json +10 -14
|
@@ -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.11.0";
|
|
64
64
|
|
|
65
65
|
var Context = /*#__PURE__*/react.createContext(function () {
|
|
66
66
|
return null;
|
|
@@ -74,8 +74,8 @@ function NotificationProviderForCustomComponent(props) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
NotificationProviderForCustomComponent.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
77
|
-
mapNotificationToComponent: _pt__default[
|
|
78
|
-
children: _pt__default[
|
|
77
|
+
mapNotificationToComponent: _pt__default["default"].func.isRequired,
|
|
78
|
+
children: _pt__default["default"].node.isRequired
|
|
79
79
|
} : {};
|
|
80
80
|
NotificationProviderForCustomComponent.displayName = 'NotificationProviderForCustomComponent';
|
|
81
81
|
var useCustomNotificationComponent = function useCustomNotificationComponent() {
|
|
@@ -83,8 +83,8 @@ var useCustomNotificationComponent = function useCustomNotificationComponent() {
|
|
|
83
83
|
}; // Exports
|
|
84
84
|
|
|
85
85
|
function filterDataAttributes(obj) {
|
|
86
|
-
return omitBy__default[
|
|
87
|
-
return !_startsWithInstanceProperty__default[
|
|
86
|
+
return omitBy__default["default"](obj, function (_value, key) {
|
|
87
|
+
return !_startsWithInstanceProperty__default["default"](key).call(key, 'data-');
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -152,9 +152,9 @@ var getStylesForNotification = function getStylesForNotification(props) {
|
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
154
|
|
|
155
|
-
function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
155
|
+
function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
156
156
|
|
|
157
|
-
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default[
|
|
157
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
158
158
|
|
|
159
159
|
var NotificationIcon = function NotificationIcon(props) {
|
|
160
160
|
if (props.type === constants.NOTIFICATION_KINDS_SIDE.error) return jsxRuntime.jsx(icons.ErrorIcon, {
|
|
@@ -172,8 +172,8 @@ var NotificationIcon = function NotificationIcon(props) {
|
|
|
172
172
|
};
|
|
173
173
|
|
|
174
174
|
NotificationIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
175
|
-
type: _pt__default[
|
|
176
|
-
color: _pt__default[
|
|
175
|
+
type: _pt__default["default"].any.isRequired,
|
|
176
|
+
color: _pt__default["default"].oneOf(['error', 'warning', 'info', 'solid', 'neutral60', 'surface', 'primary', 'primary40']).isRequired
|
|
177
177
|
} : {};
|
|
178
178
|
NotificationIcon.displayName = 'NotificationIcon';
|
|
179
179
|
var defaultProps$1 = {
|
|
@@ -189,7 +189,7 @@ var Notification = function Notification(props) {
|
|
|
189
189
|
css: getStylesForContent(props),
|
|
190
190
|
children: props.children
|
|
191
191
|
}), props.onCloseClick ? jsxRuntime.jsx("div", {
|
|
192
|
-
children: jsxRuntime.jsx(IconButton__default[
|
|
192
|
+
children: jsxRuntime.jsx(IconButton__default["default"], {
|
|
193
193
|
label: intl.formatMessage(messages.hideNotification),
|
|
194
194
|
onClick: props.onCloseClick,
|
|
195
195
|
icon: jsxRuntime.jsx(icons.CloseBoldIcon, {}),
|
|
@@ -206,11 +206,11 @@ var Notification = function Notification(props) {
|
|
|
206
206
|
};
|
|
207
207
|
|
|
208
208
|
Notification.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
209
|
-
domain: _pt__default[
|
|
210
|
-
type: _pt__default[
|
|
211
|
-
fixed: _pt__default[
|
|
212
|
-
onCloseClick: _pt__default[
|
|
213
|
-
children: _pt__default[
|
|
209
|
+
domain: _pt__default["default"].any.isRequired,
|
|
210
|
+
type: _pt__default["default"].any.isRequired,
|
|
211
|
+
fixed: _pt__default["default"].bool.isRequired,
|
|
212
|
+
onCloseClick: _pt__default["default"].func,
|
|
213
|
+
children: _pt__default["default"].node.isRequired
|
|
214
214
|
} : {};
|
|
215
215
|
Notification.displayName = 'Notification';
|
|
216
216
|
Notification.defaultProps = defaultProps$1;
|
|
@@ -225,8 +225,8 @@ var GenericNotification = function GenericNotification(props) {
|
|
|
225
225
|
};
|
|
226
226
|
|
|
227
227
|
GenericNotification.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
228
|
-
notification: _pt__default[
|
|
229
|
-
dismiss: _pt__default[
|
|
228
|
+
notification: _pt__default["default"].any.isRequired,
|
|
229
|
+
dismiss: _pt__default["default"].func.isRequired
|
|
230
230
|
} : {};
|
|
231
231
|
GenericNotification.displayName = 'GenericNotification';
|
|
232
232
|
|
|
@@ -371,9 +371,9 @@ var apiErrorMessages = reactIntl.defineMessages({
|
|
|
371
371
|
}
|
|
372
372
|
});
|
|
373
373
|
|
|
374
|
-
function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
374
|
+
function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
375
375
|
|
|
376
|
-
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context6; _forEachInstanceProperty__default[
|
|
376
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context6; _forEachInstanceProperty__default["default"](_context6 = ownKeys$3(Object(source), true)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context7; _forEachInstanceProperty__default["default"](_context7 = ownKeys$3(Object(source))).call(_context7, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
377
377
|
var regexInvalidOperationRequiredAttribute = /Required attribute '(.*)' cannot be removed/;
|
|
378
378
|
|
|
379
379
|
// The values passed to the Intl message must be a map of scalar values.
|
|
@@ -408,7 +408,7 @@ var FormattedErrorMessage = function FormattedErrorMessage(props) {
|
|
|
408
408
|
// This error is not mapped / translated yet,
|
|
409
409
|
// we log, report it to sentry and show the original error, unless `error.code` is `invalid_scope`
|
|
410
410
|
// which an error code emitted for expired project(s)
|
|
411
|
-
if (props.error.code !== 'invalid_scope' && !_includesInstanceProperty__default[
|
|
411
|
+
if (props.error.code !== 'invalid_scope' && !_includesInstanceProperty__default["default"](_context = props.error.message).call(_context, 'has expired')) {
|
|
412
412
|
sentry.reportErrorToSentry(new Error('Unmapped error'), {
|
|
413
413
|
extra: props.error
|
|
414
414
|
});
|
|
@@ -424,12 +424,12 @@ var FormattedErrorMessage = function FormattedErrorMessage(props) {
|
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
427
|
-
children: _filterInstanceProperty__default[
|
|
427
|
+
children: _filterInstanceProperty__default["default"](_context2 = [props.error.message, props.error.detailedErrorMessage && "(".concat(props.error.detailedErrorMessage, ")")]).call(_context2, Boolean).join(' ')
|
|
428
428
|
});
|
|
429
429
|
};
|
|
430
430
|
|
|
431
431
|
FormattedErrorMessage.propTypes = {
|
|
432
|
-
error: _pt__default[
|
|
432
|
+
error: _pt__default["default"].any.isRequired
|
|
433
433
|
};
|
|
434
434
|
FormattedErrorMessage.displayName = 'FormattedErrorMessage';
|
|
435
435
|
|
|
@@ -448,7 +448,7 @@ var ApiErrorMessage = function ApiErrorMessage(props) {
|
|
|
448
448
|
};
|
|
449
449
|
|
|
450
450
|
ApiErrorMessage.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
451
|
-
error: _pt__default[
|
|
451
|
+
error: _pt__default["default"].any.isRequired
|
|
452
452
|
} : {};
|
|
453
453
|
ApiErrorMessage.displayName = 'ApiErrorMessage';
|
|
454
454
|
|
|
@@ -472,15 +472,15 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
|
|
|
472
472
|
slugValue: error.duplicateValue
|
|
473
473
|
}); // Try to match the error with a custom error message
|
|
474
474
|
|
|
475
|
-
if (has__default[
|
|
475
|
+
if (has__default["default"](error, 'invalidValue') && has__default["default"](error.invalidValue, 'overlappingPrices')) return intl.formatMessage(apiErrorMessages.OverlappingPrices);
|
|
476
476
|
|
|
477
|
-
if (error.code === 'InvalidOperation' && _includesInstanceProperty__default[
|
|
477
|
+
if (error.code === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context3 = error.message).call(_context3, 'validFrom') && _includesInstanceProperty__default["default"](_context4 = error.message).call(_context4, 'validUntil')) {
|
|
478
478
|
return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
|
|
479
479
|
field: 'validFrom'
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
-
if (error.code === 'InvalidOperation' && _includesInstanceProperty__default[
|
|
483
|
+
if (error.code === 'InvalidOperation' && _includesInstanceProperty__default["default"](_context5 = error.message).call(_context5, 'Duplicate tax rate for')) {
|
|
484
484
|
return intl.formatMessage(apiErrorMessages.TaxCategoryDuplicateCountry);
|
|
485
485
|
}
|
|
486
486
|
|
|
@@ -494,7 +494,7 @@ function getSpecialFormattedMessageByErrorCode(error, intl) {
|
|
|
494
494
|
// errors. We should investigate this further.
|
|
495
495
|
|
|
496
496
|
|
|
497
|
-
if (error.code === 'InvalidField' && error.field === 'price' && has__default[
|
|
497
|
+
if (error.code === 'InvalidField' && error.field === 'price' && has__default["default"](error, 'invalidValue') && has__default["default"](error.invalidValue, 'validFrom') && has__default["default"](error.invalidValue, 'validUntil')) return intl.formatMessage(apiErrorMessages.InvalidDateRange, {
|
|
498
498
|
field: error.field
|
|
499
499
|
});
|
|
500
500
|
|
|
@@ -519,7 +519,7 @@ var ApiErrorNotification = function ApiErrorNotification(props) {
|
|
|
519
519
|
domain: props.notification.domain,
|
|
520
520
|
onCloseClick: props.dismiss,
|
|
521
521
|
children: jsxRuntime.jsx("ul", {
|
|
522
|
-
children: _valuesInstanceProperty__default[
|
|
522
|
+
children: _valuesInstanceProperty__default["default"](props.notification) && _mapInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](props.notification).errors).call(_context, function (error, idx) {
|
|
523
523
|
var shouldLogErrorToConsole = !error.code && process.env.NODE_ENV === 'development';
|
|
524
524
|
|
|
525
525
|
if (shouldLogErrorToConsole) {
|
|
@@ -544,33 +544,33 @@ var ApiErrorNotification = function ApiErrorNotification(props) {
|
|
|
544
544
|
};
|
|
545
545
|
|
|
546
546
|
ApiErrorNotification.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
547
|
-
notification: _pt__default[
|
|
548
|
-
dismiss: _pt__default[
|
|
547
|
+
notification: _pt__default["default"].any.isRequired,
|
|
548
|
+
dismiss: _pt__default["default"].func.isRequired
|
|
549
549
|
} : {};
|
|
550
550
|
ApiErrorNotification.displayName = 'ApiErrorNotification';
|
|
551
551
|
|
|
552
|
-
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
552
|
+
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
553
553
|
|
|
554
|
-
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default[
|
|
554
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
555
555
|
|
|
556
556
|
var UnexpectedErrorNotification = function UnexpectedErrorNotification(props) {
|
|
557
557
|
return jsxRuntime.jsx(Notification, {
|
|
558
558
|
type: "error",
|
|
559
559
|
domain: props.notification.domain,
|
|
560
560
|
onCloseClick: props.dismiss,
|
|
561
|
-
children: jsxRuntime.jsxs(Spacings__default[
|
|
561
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
562
562
|
children: [jsxRuntime.jsx("div", {
|
|
563
563
|
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, apiErrorMessages.General))
|
|
564
|
-
}), _valuesInstanceProperty__default[
|
|
565
|
-
children: "ID (".concat(_valuesInstanceProperty__default[
|
|
564
|
+
}), _valuesInstanceProperty__default["default"](props.notification) && _valuesInstanceProperty__default["default"](props.notification).errorId && jsxRuntime.jsx("div", {
|
|
565
|
+
children: "ID (".concat(_valuesInstanceProperty__default["default"](props.notification).errorId, ")")
|
|
566
566
|
})]
|
|
567
567
|
})
|
|
568
568
|
});
|
|
569
569
|
};
|
|
570
570
|
|
|
571
571
|
UnexpectedErrorNotification.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
572
|
-
notification: _pt__default[
|
|
573
|
-
dismiss: _pt__default[
|
|
572
|
+
notification: _pt__default["default"].any.isRequired,
|
|
573
|
+
dismiss: _pt__default["default"].func.isRequired
|
|
574
574
|
} : {};
|
|
575
575
|
UnexpectedErrorNotification.displayName = 'UnexpectedErrorNotification';
|
|
576
576
|
|
|
@@ -580,32 +580,22 @@ var selectNotifications = function selectNotifications(state) {
|
|
|
580
580
|
return state.notifications;
|
|
581
581
|
};
|
|
582
582
|
var selectGlobalNotifications = reselect.createSelector(selectNotifications, function (notifications) {
|
|
583
|
-
var _context
|
|
584
|
-
|
|
585
|
-
return (
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
).call(_context, 0, 1)
|
|
590
|
-
);
|
|
583
|
+
var _context;
|
|
584
|
+
|
|
585
|
+
return _sliceInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
|
|
586
|
+
return notification.domain === constants.NOTIFICATION_DOMAINS.GLOBAL;
|
|
587
|
+
}) // Return only 1 at a time
|
|
588
|
+
).call(_context, 0, 1);
|
|
591
589
|
});
|
|
592
590
|
var selectPageNotifications = reselect.createSelector(selectNotifications, function (notifications) {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
_filterInstanceProperty__default['default'](_context3 = notifications).call(_context3, function (notification) {
|
|
597
|
-
return notification.domain === constants.NOTIFICATION_DOMAINS.PAGE;
|
|
598
|
-
})
|
|
599
|
-
);
|
|
591
|
+
return _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
|
|
592
|
+
return notification.domain === constants.NOTIFICATION_DOMAINS.PAGE;
|
|
593
|
+
});
|
|
600
594
|
});
|
|
601
595
|
var selectSideNotifications = reselect.createSelector(selectNotifications, function (notifications) {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
_filterInstanceProperty__default['default'](_context4 = notifications).call(_context4, function (notification) {
|
|
606
|
-
return notification.domain === constants.NOTIFICATION_DOMAINS.SIDE;
|
|
607
|
-
})
|
|
608
|
-
);
|
|
596
|
+
return _filterInstanceProperty__default["default"](notifications).call(notifications, function (notification) {
|
|
597
|
+
return notification.domain === constants.NOTIFICATION_DOMAINS.SIDE;
|
|
598
|
+
});
|
|
609
599
|
});
|
|
610
600
|
|
|
611
601
|
var getStyles = function getStyles(props) {
|
|
@@ -632,9 +622,9 @@ var _excluded = ["values"],
|
|
|
632
622
|
_excluded4 = ["text"],
|
|
633
623
|
_excluded5 = ["text"];
|
|
634
624
|
|
|
635
|
-
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
625
|
+
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
636
626
|
|
|
637
|
-
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[
|
|
627
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
638
628
|
|
|
639
629
|
var NotificationsListGlobal = function NotificationsListGlobal(props) {
|
|
640
630
|
var dispatch = reactRedux.useDispatch();
|
|
@@ -642,7 +632,7 @@ var NotificationsListGlobal = function NotificationsListGlobal(props) {
|
|
|
642
632
|
var notifications$1 = reactRedux.useSelector(selectGlobalNotifications);
|
|
643
633
|
return jsxRuntime.jsx("div", {
|
|
644
634
|
css: getStyles(props),
|
|
645
|
-
children: _mapInstanceProperty__default[
|
|
635
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
|
|
646
636
|
// 1. Check if there is a custom notification component first
|
|
647
637
|
var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
648
638
|
|
|
@@ -661,7 +651,7 @@ var NotificationsListGlobal = function NotificationsListGlobal(props) {
|
|
|
661
651
|
case constants.NOTIFICATION_KINDS_GLOBAL.info:
|
|
662
652
|
case constants.NOTIFICATION_KINDS_GLOBAL.success:
|
|
663
653
|
{
|
|
664
|
-
_valuesInstanceProperty__default[
|
|
654
|
+
_valuesInstanceProperty__default["default"](notification);
|
|
665
655
|
var genericNotification = _objectWithoutProperties(notification, _excluded);
|
|
666
656
|
|
|
667
657
|
return jsxRuntime.jsx(GenericNotification, {
|
|
@@ -707,7 +697,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
|
|
|
707
697
|
var notifications$1 = reactRedux.useSelector(selectPageNotifications);
|
|
708
698
|
return jsxRuntime.jsx("div", {
|
|
709
699
|
css: getStyles(props),
|
|
710
|
-
children: _mapInstanceProperty__default[
|
|
700
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
|
|
711
701
|
// 1. Check if there is a custom notification component first
|
|
712
702
|
var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
713
703
|
|
|
@@ -726,7 +716,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
|
|
|
726
716
|
case constants.NOTIFICATION_KINDS_PAGE.info:
|
|
727
717
|
case constants.NOTIFICATION_KINDS_PAGE.success:
|
|
728
718
|
{
|
|
729
|
-
_valuesInstanceProperty__default[
|
|
719
|
+
_valuesInstanceProperty__default["default"](notification);
|
|
730
720
|
var genericNotification = _objectWithoutProperties(notification, _excluded3);
|
|
731
721
|
|
|
732
722
|
return jsxRuntime.jsx(GenericNotification, {
|
|
@@ -759,7 +749,7 @@ var NotificationsListPage = function NotificationsListPage(props) {
|
|
|
759
749
|
|
|
760
750
|
return jsxRuntime.jsx(UnexpectedErrorNotification, {
|
|
761
751
|
notification: _objectSpread$1(_objectSpread$1({}, _errorNotification), {}, {
|
|
762
|
-
values: _valuesInstanceProperty__default[
|
|
752
|
+
values: _valuesInstanceProperty__default["default"](notification)
|
|
763
753
|
}),
|
|
764
754
|
dismiss: function dismiss() {
|
|
765
755
|
dispatch(notifications.removeNotification(notification.id));
|
|
@@ -780,7 +770,7 @@ var NotificationsListSide = function NotificationsListSide(props) {
|
|
|
780
770
|
var notifications$1 = reactRedux.useSelector(selectSideNotifications);
|
|
781
771
|
return jsxRuntime.jsx("div", {
|
|
782
772
|
css: getStyles(props),
|
|
783
|
-
children: _mapInstanceProperty__default[
|
|
773
|
+
children: _mapInstanceProperty__default["default"](notifications$1).call(notifications$1, function (notification) {
|
|
784
774
|
// 1. Check if there is a custom notification component first
|
|
785
775
|
var CustomNotificationComponent = mapCustomNotificationToComponent(notification);
|
|
786
776
|
|
|
@@ -830,9 +820,9 @@ var NotificationsList = function NotificationsList(props) {
|
|
|
830
820
|
|
|
831
821
|
NotificationsList.displayName = 'NotificationsList';
|
|
832
822
|
|
|
833
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
823
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
834
824
|
|
|
835
|
-
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[
|
|
825
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
836
826
|
var defaultProps = {
|
|
837
827
|
domain: constants.NOTIFICATION_DOMAINS.SIDE,
|
|
838
828
|
kind: constants.NOTIFICATION_KINDS_SIDE.success
|
|
@@ -846,7 +836,7 @@ var Notifier = function Notifier(props) {
|
|
|
846
836
|
domain: props.domain,
|
|
847
837
|
kind: props.kind,
|
|
848
838
|
text: props.text
|
|
849
|
-
}, isNumber__default[
|
|
839
|
+
}, isNumber__default["default"](props.dismissAfter) ? _objectSpread(_objectSpread({}, props.meta), {}, {
|
|
850
840
|
dismissAfter: props.dismissAfter
|
|
851
841
|
}) : props.meta);
|
|
852
842
|
return function () {
|
|
@@ -859,11 +849,11 @@ var Notifier = function Notifier(props) {
|
|
|
859
849
|
};
|
|
860
850
|
|
|
861
851
|
Notifier.propTypes = {
|
|
862
|
-
domain: _pt__default[
|
|
863
|
-
kind: _pt__default[
|
|
864
|
-
text: _pt__default[
|
|
865
|
-
meta: _pt__default[
|
|
866
|
-
dismissAfter: _pt__default[
|
|
852
|
+
domain: _pt__default["default"].any.isRequired,
|
|
853
|
+
kind: _pt__default["default"].any.isRequired,
|
|
854
|
+
text: _pt__default["default"].string,
|
|
855
|
+
meta: _pt__default["default"].objectOf(_pt__default["default"].any),
|
|
856
|
+
dismissAfter: _pt__default["default"].number
|
|
867
857
|
};
|
|
868
858
|
Notifier.displayName = 'Notifier';
|
|
869
859
|
Notifier.defaultProps = defaultProps;
|
|
@@ -59,8 +59,8 @@ var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
|
59
59
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
60
60
|
var isNumber__default = /*#__PURE__*/_interopDefault(isNumber);
|
|
61
61
|
|
|
62
|
-
// NOTE: This string will be replaced
|
|
63
|
-
var version =
|
|
62
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
63
|
+
var version = "20.11.0";
|
|
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.11.0";
|
|
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,6 +1,12 @@
|
|
|
1
1
|
import type { TAppNotificationGlobal, TAppNotificationPage, TAppNotificationSide } from '@commercetools-frontend/constants';
|
|
2
2
|
import type { TAppState } from './types';
|
|
3
3
|
export declare const selectNotifications: (state: TAppState) => (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[];
|
|
4
|
-
export declare const selectGlobalNotifications: import("reselect").OutputSelector<TAppState, TAppNotificationGlobal[], (
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare const selectGlobalNotifications: import("reselect").OutputSelector<[(state: TAppState) => (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[]], TAppNotificationGlobal[], never, ((args_0: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[], ...args_1: unknown[]) => TAppNotificationGlobal[]) & ((...args: any[]) => any) & {
|
|
5
|
+
clearCache: () => void;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const selectPageNotifications: import("reselect").OutputSelector<[(state: TAppState) => (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[]], TAppNotificationPage[], never, ((args_0: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[], ...args_1: unknown[]) => TAppNotificationPage[]) & ((...args: any[]) => any) & {
|
|
8
|
+
clearCache: () => void;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const selectSideNotifications: import("reselect").OutputSelector<[(state: TAppState) => (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[]], TAppNotificationSide[], never, ((args_0: (TAppNotificationGlobal | TAppNotificationPage | TAppNotificationSide)[], ...args_1: unknown[]) => TAppNotificationSide[]) & ((...args: any[]) => any) & {
|
|
11
|
+
clearCache: () => void;
|
|
12
|
+
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "
|
|
1
|
+
declare const _default: "__@APPLICATION_KIT_PACKAGE/VERSION_OF_RELEASE__";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/react-notifications",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.11.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": {
|
|
@@ -11,28 +11,24 @@
|
|
|
11
11
|
"homepage": "https://docs.commercetools.com/custom-applications",
|
|
12
12
|
"keywords": ["javascript", "frontend", "react", "toolkit"],
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"private": false,
|
|
15
14
|
"publishConfig": {
|
|
16
15
|
"access": "public"
|
|
17
16
|
},
|
|
18
17
|
"main": "dist/commercetools-frontend-react-notifications.cjs.js",
|
|
19
18
|
"module": "dist/commercetools-frontend-react-notifications.esm.js",
|
|
20
19
|
"files": ["dist", "package.json", "LICENSE", "README.md"],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"prepare": "./../../scripts/version.js replace"
|
|
23
|
-
},
|
|
24
20
|
"dependencies": {
|
|
25
21
|
"@babel/runtime": "7.15.4",
|
|
26
22
|
"@babel/runtime-corejs3": "7.15.4",
|
|
27
|
-
"@commercetools-frontend/actions-global": "20.
|
|
28
|
-
"@commercetools-frontend/constants": "20.
|
|
29
|
-
"@commercetools-frontend/notifications": "20.10.
|
|
30
|
-
"@commercetools-frontend/sentry": "20.
|
|
23
|
+
"@commercetools-frontend/actions-global": "20.11.0",
|
|
24
|
+
"@commercetools-frontend/constants": "20.11.0",
|
|
25
|
+
"@commercetools-frontend/notifications": "20.10.6",
|
|
26
|
+
"@commercetools-frontend/sentry": "20.11.0",
|
|
31
27
|
"@commercetools-uikit/design-system": "^12.2.2",
|
|
32
28
|
"@commercetools-uikit/icon-button": "^12.2.2",
|
|
33
29
|
"@commercetools-uikit/icons": "^12.2.2",
|
|
34
30
|
"@commercetools-uikit/spacings": "^12.2.2",
|
|
35
|
-
"@emotion/react": "11.
|
|
31
|
+
"@emotion/react": "11.5.0",
|
|
36
32
|
"@emotion/styled": "11.3.0",
|
|
37
33
|
"@types/history": "4.7.9",
|
|
38
34
|
"@types/lodash": "^4.14.167",
|
|
@@ -46,14 +42,14 @@
|
|
|
46
42
|
"moment": "^2.29.1",
|
|
47
43
|
"moment-timezone": "^0.5.32",
|
|
48
44
|
"prop-types": "15.7.2",
|
|
49
|
-
"reselect": "4.
|
|
45
|
+
"reselect": "4.1.0"
|
|
50
46
|
},
|
|
51
47
|
"devDependencies": {
|
|
52
|
-
"@testing-library/react": "12.1.
|
|
48
|
+
"@testing-library/react": "12.1.2",
|
|
53
49
|
"react": "17.0.2",
|
|
54
50
|
"react-dom": "17.0.2",
|
|
55
|
-
"react-intl": "5.
|
|
56
|
-
"react-redux": "7.2.
|
|
51
|
+
"react-intl": "5.21.0",
|
|
52
|
+
"react-redux": "7.2.6",
|
|
57
53
|
"react-router-dom": "5.3.0"
|
|
58
54
|
},
|
|
59
55
|
"peerDependencies": {
|