@commercetools-frontend/actions-global 21.23.9 → 21.24.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.
|
@@ -39,13 +39,13 @@ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defin
|
|
|
39
39
|
var isNumber__default = /*#__PURE__*/_interopDefault(isNumber);
|
|
40
40
|
|
|
41
41
|
// NOTE: This string will be replaced on build time with the package version.
|
|
42
|
-
var version = "21.
|
|
42
|
+
var version = "21.24.0";
|
|
43
43
|
|
|
44
44
|
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); 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; }
|
|
45
45
|
|
|
46
46
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$1(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
47
47
|
function showNotification(notification) {
|
|
48
|
-
|
|
48
|
+
let meta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
49
49
|
if (process.env.NODE_ENV !== 'production') if (notification.domain) {
|
|
50
50
|
var _context;
|
|
51
51
|
|
|
@@ -53,15 +53,15 @@ function showNotification(notification) {
|
|
|
53
53
|
console.warn("Unknown notification domain \"".concat(notification.domain, "\""), notification);
|
|
54
54
|
} // eslint-disable-next-line no-console
|
|
55
55
|
else console.warn('Notification is missing domain', notification);
|
|
56
|
-
|
|
56
|
+
let dismissAfter = meta.dismissAfter;
|
|
57
57
|
if (!isNumber__default["default"](dismissAfter)) dismissAfter = notification.kind === constants.NOTIFICATION_KINDS_SIDE.success ? 5000 : 0;
|
|
58
58
|
return notifications.addNotification(notification, _objectSpread$1(_objectSpread$1({}, meta), {}, {
|
|
59
|
-
dismissAfter
|
|
59
|
+
dismissAfter
|
|
60
60
|
}));
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
function showApiErrorNotification(_ref) {
|
|
64
|
-
|
|
64
|
+
let errors = _ref.errors;
|
|
65
65
|
return showNotification({
|
|
66
66
|
id: 0,
|
|
67
67
|
domain: constants.DOMAINS.PAGE,
|
|
@@ -77,7 +77,7 @@ function showApiErrorNotification(_ref) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
function showUnexpectedErrorNotification() {
|
|
80
|
-
|
|
80
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
81
81
|
errorId = _ref.errorId;
|
|
82
82
|
|
|
83
83
|
return showNotification({
|
|
@@ -85,7 +85,7 @@ function showUnexpectedErrorNotification() {
|
|
|
85
85
|
domain: constants.DOMAINS.PAGE,
|
|
86
86
|
kind: 'unexpected-error',
|
|
87
87
|
values: {
|
|
88
|
-
errorId
|
|
88
|
+
errorId
|
|
89
89
|
}
|
|
90
90
|
}, {
|
|
91
91
|
dismissAfter: 0
|
|
@@ -97,15 +97,15 @@ function isApiError(error) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
function handleActionError(error) {
|
|
100
|
-
return
|
|
100
|
+
return dispatch => {
|
|
101
101
|
// On production we send the errors to Sentry.
|
|
102
102
|
// eslint-disable-next-line no-console
|
|
103
103
|
if (window.app.env !== 'production') console.error(error, error instanceof Error && error.stack);
|
|
104
104
|
|
|
105
105
|
if (!isApiError(error)) {
|
|
106
|
-
|
|
106
|
+
const errorId = sentry.reportErrorToSentry(error);
|
|
107
107
|
return dispatch(showUnexpectedErrorNotification({
|
|
108
|
-
errorId
|
|
108
|
+
errorId
|
|
109
109
|
}));
|
|
110
110
|
} // When unauthorized, log the user out.
|
|
111
111
|
|
|
@@ -138,9 +138,9 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["def
|
|
|
138
138
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _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; }
|
|
139
139
|
|
|
140
140
|
function useShowNotification(notificationFragment) {
|
|
141
|
-
|
|
142
|
-
return react.useCallback(
|
|
143
|
-
|
|
141
|
+
const dispatch = reactRedux.useDispatch();
|
|
142
|
+
return react.useCallback((content, meta) => {
|
|
143
|
+
const notification = showNotification(_objectSpread(_objectSpread({}, notificationFragment), content), meta);
|
|
144
144
|
return dispatch(notification);
|
|
145
145
|
}, [dispatch, notificationFragment]);
|
|
146
146
|
}
|
|
@@ -152,12 +152,9 @@ function useShowNotification(notificationFragment) {
|
|
|
152
152
|
* const showApiErrorNotification = useShowApiErrorNotification();
|
|
153
153
|
* showApiErrorNotification({ errors });
|
|
154
154
|
*/
|
|
155
|
-
|
|
156
155
|
function useShowApiErrorNotification() {
|
|
157
|
-
|
|
158
|
-
return react.useCallback(
|
|
159
|
-
return dispatch(showApiErrorNotification(options));
|
|
160
|
-
}, [dispatch]);
|
|
156
|
+
const dispatch = reactRedux.useDispatch();
|
|
157
|
+
return react.useCallback(options => dispatch(showApiErrorNotification(options)), [dispatch]);
|
|
161
158
|
}
|
|
162
159
|
|
|
163
160
|
/**
|
|
@@ -169,24 +166,18 @@ function useShowApiErrorNotification() {
|
|
|
169
166
|
*/
|
|
170
167
|
|
|
171
168
|
function useShowUnexpectedErrorNotification() {
|
|
172
|
-
|
|
173
|
-
return react.useCallback(
|
|
174
|
-
return dispatch(showUnexpectedErrorNotification(options));
|
|
175
|
-
}, [dispatch]);
|
|
169
|
+
const dispatch = reactRedux.useDispatch();
|
|
170
|
+
return react.useCallback(options => dispatch(showUnexpectedErrorNotification(options)), [dispatch]);
|
|
176
171
|
}
|
|
177
172
|
|
|
178
173
|
function useHideAllPageNotifications() {
|
|
179
|
-
|
|
180
|
-
return react.useCallback(
|
|
181
|
-
return dispatch(hideAllPageNotifications());
|
|
182
|
-
}, [dispatch]);
|
|
174
|
+
const dispatch = reactRedux.useDispatch();
|
|
175
|
+
return react.useCallback(() => dispatch(hideAllPageNotifications()), [dispatch]);
|
|
183
176
|
}
|
|
184
177
|
|
|
185
178
|
function useOnActionError() {
|
|
186
|
-
|
|
187
|
-
return react.useCallback(
|
|
188
|
-
return dispatch(handleActionError(error));
|
|
189
|
-
}, [dispatch]);
|
|
179
|
+
const dispatch = reactRedux.useDispatch();
|
|
180
|
+
return react.useCallback(error => dispatch(handleActionError(error)), [dispatch]);
|
|
190
181
|
}
|
|
191
182
|
|
|
192
183
|
exports.handleActionError = handleActionError;
|
|
@@ -37,22 +37,22 @@ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defin
|
|
|
37
37
|
var isNumber__default = /*#__PURE__*/_interopDefault(isNumber);
|
|
38
38
|
|
|
39
39
|
// NOTE: This string will be replaced on build time with the package version.
|
|
40
|
-
var version = "21.
|
|
40
|
+
var version = "21.24.0";
|
|
41
41
|
|
|
42
42
|
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); 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; }
|
|
43
43
|
|
|
44
44
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$1(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
45
45
|
function showNotification(notification) {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
let meta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
47
|
+
let dismissAfter = meta.dismissAfter;
|
|
48
48
|
if (!isNumber__default["default"](dismissAfter)) dismissAfter = notification.kind === constants.NOTIFICATION_KINDS_SIDE.success ? 5000 : 0;
|
|
49
49
|
return notifications.addNotification(notification, _objectSpread$1(_objectSpread$1({}, meta), {}, {
|
|
50
|
-
dismissAfter
|
|
50
|
+
dismissAfter
|
|
51
51
|
}));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function showApiErrorNotification(_ref) {
|
|
55
|
-
|
|
55
|
+
let errors = _ref.errors;
|
|
56
56
|
return showNotification({
|
|
57
57
|
id: 0,
|
|
58
58
|
domain: constants.DOMAINS.PAGE,
|
|
@@ -68,7 +68,7 @@ function showApiErrorNotification(_ref) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
function showUnexpectedErrorNotification() {
|
|
71
|
-
|
|
71
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
72
72
|
errorId = _ref.errorId;
|
|
73
73
|
|
|
74
74
|
return showNotification({
|
|
@@ -76,7 +76,7 @@ function showUnexpectedErrorNotification() {
|
|
|
76
76
|
domain: constants.DOMAINS.PAGE,
|
|
77
77
|
kind: 'unexpected-error',
|
|
78
78
|
values: {
|
|
79
|
-
errorId
|
|
79
|
+
errorId
|
|
80
80
|
}
|
|
81
81
|
}, {
|
|
82
82
|
dismissAfter: 0
|
|
@@ -88,15 +88,15 @@ function isApiError(error) {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function handleActionError(error) {
|
|
91
|
-
return
|
|
91
|
+
return dispatch => {
|
|
92
92
|
// On production we send the errors to Sentry.
|
|
93
93
|
// eslint-disable-next-line no-console
|
|
94
94
|
if (window.app.env !== 'production') console.error(error, error instanceof Error && error.stack);
|
|
95
95
|
|
|
96
96
|
if (!isApiError(error)) {
|
|
97
|
-
|
|
97
|
+
const errorId = sentry.reportErrorToSentry(error);
|
|
98
98
|
return dispatch(showUnexpectedErrorNotification({
|
|
99
|
-
errorId
|
|
99
|
+
errorId
|
|
100
100
|
}));
|
|
101
101
|
} // When unauthorized, log the user out.
|
|
102
102
|
|
|
@@ -129,9 +129,9 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["def
|
|
|
129
129
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _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; }
|
|
130
130
|
|
|
131
131
|
function useShowNotification(notificationFragment) {
|
|
132
|
-
|
|
133
|
-
return react.useCallback(
|
|
134
|
-
|
|
132
|
+
const dispatch = reactRedux.useDispatch();
|
|
133
|
+
return react.useCallback((content, meta) => {
|
|
134
|
+
const notification = showNotification(_objectSpread(_objectSpread({}, notificationFragment), content), meta);
|
|
135
135
|
return dispatch(notification);
|
|
136
136
|
}, [dispatch, notificationFragment]);
|
|
137
137
|
}
|
|
@@ -143,12 +143,9 @@ function useShowNotification(notificationFragment) {
|
|
|
143
143
|
* const showApiErrorNotification = useShowApiErrorNotification();
|
|
144
144
|
* showApiErrorNotification({ errors });
|
|
145
145
|
*/
|
|
146
|
-
|
|
147
146
|
function useShowApiErrorNotification() {
|
|
148
|
-
|
|
149
|
-
return react.useCallback(
|
|
150
|
-
return dispatch(showApiErrorNotification(options));
|
|
151
|
-
}, [dispatch]);
|
|
147
|
+
const dispatch = reactRedux.useDispatch();
|
|
148
|
+
return react.useCallback(options => dispatch(showApiErrorNotification(options)), [dispatch]);
|
|
152
149
|
}
|
|
153
150
|
|
|
154
151
|
/**
|
|
@@ -160,24 +157,18 @@ function useShowApiErrorNotification() {
|
|
|
160
157
|
*/
|
|
161
158
|
|
|
162
159
|
function useShowUnexpectedErrorNotification() {
|
|
163
|
-
|
|
164
|
-
return react.useCallback(
|
|
165
|
-
return dispatch(showUnexpectedErrorNotification(options));
|
|
166
|
-
}, [dispatch]);
|
|
160
|
+
const dispatch = reactRedux.useDispatch();
|
|
161
|
+
return react.useCallback(options => dispatch(showUnexpectedErrorNotification(options)), [dispatch]);
|
|
167
162
|
}
|
|
168
163
|
|
|
169
164
|
function useHideAllPageNotifications() {
|
|
170
|
-
|
|
171
|
-
return react.useCallback(
|
|
172
|
-
return dispatch(hideAllPageNotifications());
|
|
173
|
-
}, [dispatch]);
|
|
165
|
+
const dispatch = reactRedux.useDispatch();
|
|
166
|
+
return react.useCallback(() => dispatch(hideAllPageNotifications()), [dispatch]);
|
|
174
167
|
}
|
|
175
168
|
|
|
176
169
|
function useOnActionError() {
|
|
177
|
-
|
|
178
|
-
return react.useCallback(
|
|
179
|
-
return dispatch(handleActionError(error));
|
|
180
|
-
}, [dispatch]);
|
|
170
|
+
const dispatch = reactRedux.useDispatch();
|
|
171
|
+
return react.useCallback(error => dispatch(handleActionError(error)), [dispatch]);
|
|
181
172
|
}
|
|
182
173
|
|
|
183
174
|
exports.handleActionError = handleActionError;
|
|
@@ -19,13 +19,13 @@ import { useCallback } from 'react';
|
|
|
19
19
|
import { useDispatch } from 'react-redux';
|
|
20
20
|
|
|
21
21
|
// NOTE: This string will be replaced on build time with the package version.
|
|
22
|
-
var version = "21.
|
|
22
|
+
var version = "21.24.0";
|
|
23
23
|
|
|
24
24
|
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
25
|
|
|
26
26
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys$1(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys$1(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
27
|
function showNotification(notification) {
|
|
28
|
-
|
|
28
|
+
let meta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
29
29
|
if (process.env.NODE_ENV !== 'production') if (notification.domain) {
|
|
30
30
|
var _context;
|
|
31
31
|
|
|
@@ -33,15 +33,15 @@ function showNotification(notification) {
|
|
|
33
33
|
console.warn("Unknown notification domain \"".concat(notification.domain, "\""), notification);
|
|
34
34
|
} // eslint-disable-next-line no-console
|
|
35
35
|
else console.warn('Notification is missing domain', notification);
|
|
36
|
-
|
|
36
|
+
let dismissAfter = meta.dismissAfter;
|
|
37
37
|
if (!isNumber(dismissAfter)) dismissAfter = notification.kind === NOTIFICATION_KINDS_SIDE.success ? 5000 : 0;
|
|
38
38
|
return addNotification(notification, _objectSpread$1(_objectSpread$1({}, meta), {}, {
|
|
39
|
-
dismissAfter
|
|
39
|
+
dismissAfter
|
|
40
40
|
}));
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function showApiErrorNotification(_ref) {
|
|
44
|
-
|
|
44
|
+
let errors = _ref.errors;
|
|
45
45
|
return showNotification({
|
|
46
46
|
id: 0,
|
|
47
47
|
domain: DOMAINS.PAGE,
|
|
@@ -57,7 +57,7 @@ function showApiErrorNotification(_ref) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function showUnexpectedErrorNotification() {
|
|
60
|
-
|
|
60
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
61
61
|
errorId = _ref.errorId;
|
|
62
62
|
|
|
63
63
|
return showNotification({
|
|
@@ -65,7 +65,7 @@ function showUnexpectedErrorNotification() {
|
|
|
65
65
|
domain: DOMAINS.PAGE,
|
|
66
66
|
kind: 'unexpected-error',
|
|
67
67
|
values: {
|
|
68
|
-
errorId
|
|
68
|
+
errorId
|
|
69
69
|
}
|
|
70
70
|
}, {
|
|
71
71
|
dismissAfter: 0
|
|
@@ -77,15 +77,15 @@ function isApiError(error) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
function handleActionError(error) {
|
|
80
|
-
return
|
|
80
|
+
return dispatch => {
|
|
81
81
|
// On production we send the errors to Sentry.
|
|
82
82
|
// eslint-disable-next-line no-console
|
|
83
83
|
if (window.app.env !== 'production') console.error(error, error instanceof Error && error.stack);
|
|
84
84
|
|
|
85
85
|
if (!isApiError(error)) {
|
|
86
|
-
|
|
86
|
+
const errorId = reportErrorToSentry(error);
|
|
87
87
|
return dispatch(showUnexpectedErrorNotification({
|
|
88
|
-
errorId
|
|
88
|
+
errorId
|
|
89
89
|
}));
|
|
90
90
|
} // When unauthorized, log the user out.
|
|
91
91
|
|
|
@@ -118,9 +118,9 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
|
118
118
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
119
119
|
|
|
120
120
|
function useShowNotification(notificationFragment) {
|
|
121
|
-
|
|
122
|
-
return useCallback(
|
|
123
|
-
|
|
121
|
+
const dispatch = useDispatch();
|
|
122
|
+
return useCallback((content, meta) => {
|
|
123
|
+
const notification = showNotification(_objectSpread(_objectSpread({}, notificationFragment), content), meta);
|
|
124
124
|
return dispatch(notification);
|
|
125
125
|
}, [dispatch, notificationFragment]);
|
|
126
126
|
}
|
|
@@ -132,12 +132,9 @@ function useShowNotification(notificationFragment) {
|
|
|
132
132
|
* const showApiErrorNotification = useShowApiErrorNotification();
|
|
133
133
|
* showApiErrorNotification({ errors });
|
|
134
134
|
*/
|
|
135
|
-
|
|
136
135
|
function useShowApiErrorNotification() {
|
|
137
|
-
|
|
138
|
-
return useCallback(
|
|
139
|
-
return dispatch(showApiErrorNotification(options));
|
|
140
|
-
}, [dispatch]);
|
|
136
|
+
const dispatch = useDispatch();
|
|
137
|
+
return useCallback(options => dispatch(showApiErrorNotification(options)), [dispatch]);
|
|
141
138
|
}
|
|
142
139
|
|
|
143
140
|
/**
|
|
@@ -149,24 +146,18 @@ function useShowApiErrorNotification() {
|
|
|
149
146
|
*/
|
|
150
147
|
|
|
151
148
|
function useShowUnexpectedErrorNotification() {
|
|
152
|
-
|
|
153
|
-
return useCallback(
|
|
154
|
-
return dispatch(showUnexpectedErrorNotification(options));
|
|
155
|
-
}, [dispatch]);
|
|
149
|
+
const dispatch = useDispatch();
|
|
150
|
+
return useCallback(options => dispatch(showUnexpectedErrorNotification(options)), [dispatch]);
|
|
156
151
|
}
|
|
157
152
|
|
|
158
153
|
function useHideAllPageNotifications() {
|
|
159
|
-
|
|
160
|
-
return useCallback(
|
|
161
|
-
return dispatch(hideAllPageNotifications());
|
|
162
|
-
}, [dispatch]);
|
|
154
|
+
const dispatch = useDispatch();
|
|
155
|
+
return useCallback(() => dispatch(hideAllPageNotifications()), [dispatch]);
|
|
163
156
|
}
|
|
164
157
|
|
|
165
158
|
function useOnActionError() {
|
|
166
|
-
|
|
167
|
-
return useCallback(
|
|
168
|
-
return dispatch(handleActionError(error));
|
|
169
|
-
}, [dispatch]);
|
|
159
|
+
const dispatch = useDispatch();
|
|
160
|
+
return useCallback(error => dispatch(handleActionError(error)), [dispatch]);
|
|
170
161
|
}
|
|
171
162
|
|
|
172
163
|
export { handleActionError, hideAllPageNotifications, showApiErrorNotification, showNotification, showUnexpectedErrorNotification, useHideAllPageNotifications, useOnActionError, useShowApiErrorNotification, useShowNotification, useShowUnexpectedErrorNotification, version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/actions-global",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.24.0",
|
|
4
4
|
"description": "Global redux actions for a MC application",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@babel/runtime": "^7.20.13",
|
|
22
22
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
23
|
-
"@commercetools-frontend/browser-history": "21.
|
|
24
|
-
"@commercetools-frontend/constants": "21.
|
|
25
|
-
"@commercetools-frontend/notifications": "21.
|
|
26
|
-
"@commercetools-frontend/sentry": "21.
|
|
23
|
+
"@commercetools-frontend/browser-history": "21.24.0",
|
|
24
|
+
"@commercetools-frontend/constants": "21.24.0",
|
|
25
|
+
"@commercetools-frontend/notifications": "21.24.0",
|
|
26
|
+
"@commercetools-frontend/sentry": "21.24.0",
|
|
27
27
|
"@types/lodash": "^4.14.191",
|
|
28
28
|
"@types/react": "^17.0.53",
|
|
29
29
|
"@types/react-redux": "^7.1.25",
|