@commercetools-frontend/actions-global 21.0.0 → 21.3.4

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.
@@ -37,7 +37,7 @@ 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.0.0";
40
+ var version = "21.3.4";
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
 
@@ -138,13 +138,6 @@ function hideAllPageNotifications() {
138
138
  function ownKeys(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; }
139
139
 
140
140
  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; }
141
- // a speficic notification.
142
- // Example:
143
- // const showSuccessNotification = useShowNotification({
144
- // domain: NOTIFICATION_DOMAINS.SIDE,
145
- // kind: NOTIFICATION_KINDS_SIDE.success,
146
- // });
147
- // showSuccessNotification({ text: "All good!" });
148
141
 
149
142
  function useShowNotification(notificationFragment) {
150
143
  var dispatch = reactRedux.useDispatch();
@@ -154,9 +147,13 @@ function useShowNotification(notificationFragment) {
154
147
  }, [dispatch, notificationFragment]);
155
148
  }
156
149
 
157
- // Example:
158
- // const showApiErrorNotification = useShowApiErrorNotification();
159
- // showApiErrorNotification({ errors });
150
+ /**
151
+ * Dispatch an API error notification.
152
+ *
153
+ * @example
154
+ * const showApiErrorNotification = useShowApiErrorNotification();
155
+ * showApiErrorNotification({ errors });
156
+ */
160
157
 
161
158
  function useShowApiErrorNotification() {
162
159
  var dispatch = reactRedux.useDispatch();
@@ -165,9 +162,13 @@ function useShowApiErrorNotification() {
165
162
  }, [dispatch]);
166
163
  }
167
164
 
168
- // Example:
169
- // const showUnexpectedErrorNotification = useShowUnexpectedErrorNotification();
170
- // showUnexpectedErrorNotification({ error });
165
+ /**
166
+ * Dispatch an unexpected error notification.
167
+ *
168
+ * @example
169
+ * const showUnexpectedErrorNotification = useShowUnexpectedErrorNotification();
170
+ * showUnexpectedErrorNotification({ errors });
171
+ */
171
172
 
172
173
  function useShowUnexpectedErrorNotification() {
173
174
  var dispatch = reactRedux.useDispatch();
@@ -35,7 +35,7 @@ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defin
35
35
  var isNumber__default = /*#__PURE__*/_interopDefault(isNumber);
36
36
 
37
37
  // NOTE: This string will be replaced on build time with the package version.
38
- var version = "21.0.0";
38
+ var version = "21.3.4";
39
39
 
40
40
  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; }
41
41
 
@@ -129,13 +129,6 @@ function hideAllPageNotifications() {
129
129
  function ownKeys(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; }
130
130
 
131
131
  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; }
132
- // a speficic notification.
133
- // Example:
134
- // const showSuccessNotification = useShowNotification({
135
- // domain: NOTIFICATION_DOMAINS.SIDE,
136
- // kind: NOTIFICATION_KINDS_SIDE.success,
137
- // });
138
- // showSuccessNotification({ text: "All good!" });
139
132
 
140
133
  function useShowNotification(notificationFragment) {
141
134
  var dispatch = reactRedux.useDispatch();
@@ -145,9 +138,13 @@ function useShowNotification(notificationFragment) {
145
138
  }, [dispatch, notificationFragment]);
146
139
  }
147
140
 
148
- // Example:
149
- // const showApiErrorNotification = useShowApiErrorNotification();
150
- // showApiErrorNotification({ errors });
141
+ /**
142
+ * Dispatch an API error notification.
143
+ *
144
+ * @example
145
+ * const showApiErrorNotification = useShowApiErrorNotification();
146
+ * showApiErrorNotification({ errors });
147
+ */
151
148
 
152
149
  function useShowApiErrorNotification() {
153
150
  var dispatch = reactRedux.useDispatch();
@@ -156,9 +153,13 @@ function useShowApiErrorNotification() {
156
153
  }, [dispatch]);
157
154
  }
158
155
 
159
- // Example:
160
- // const showUnexpectedErrorNotification = useShowUnexpectedErrorNotification();
161
- // showUnexpectedErrorNotification({ error });
156
+ /**
157
+ * Dispatch an unexpected error notification.
158
+ *
159
+ * @example
160
+ * const showUnexpectedErrorNotification = useShowUnexpectedErrorNotification();
161
+ * showUnexpectedErrorNotification({ errors });
162
+ */
162
163
 
163
164
  function useShowUnexpectedErrorNotification() {
164
165
  var dispatch = reactRedux.useDispatch();
@@ -18,7 +18,7 @@ import { useCallback } from 'react';
18
18
  import { useDispatch } from 'react-redux';
19
19
 
20
20
  // NOTE: This string will be replaced on build time with the package version.
21
- var version = "21.0.0";
21
+ var version = "21.3.4";
22
22
 
23
23
  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; }
24
24
 
@@ -119,13 +119,6 @@ function hideAllPageNotifications() {
119
119
  function ownKeys(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; }
120
120
 
121
121
  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; }
122
- // a speficic notification.
123
- // Example:
124
- // const showSuccessNotification = useShowNotification({
125
- // domain: NOTIFICATION_DOMAINS.SIDE,
126
- // kind: NOTIFICATION_KINDS_SIDE.success,
127
- // });
128
- // showSuccessNotification({ text: "All good!" });
129
122
 
130
123
  function useShowNotification(notificationFragment) {
131
124
  var dispatch = useDispatch();
@@ -135,9 +128,13 @@ function useShowNotification(notificationFragment) {
135
128
  }, [dispatch, notificationFragment]);
136
129
  }
137
130
 
138
- // Example:
139
- // const showApiErrorNotification = useShowApiErrorNotification();
140
- // showApiErrorNotification({ errors });
131
+ /**
132
+ * Dispatch an API error notification.
133
+ *
134
+ * @example
135
+ * const showApiErrorNotification = useShowApiErrorNotification();
136
+ * showApiErrorNotification({ errors });
137
+ */
141
138
 
142
139
  function useShowApiErrorNotification() {
143
140
  var dispatch = useDispatch();
@@ -146,9 +143,13 @@ function useShowApiErrorNotification() {
146
143
  }, [dispatch]);
147
144
  }
148
145
 
149
- // Example:
150
- // const showUnexpectedErrorNotification = useShowUnexpectedErrorNotification();
151
- // showUnexpectedErrorNotification({ error });
146
+ /**
147
+ * Dispatch an unexpected error notification.
148
+ *
149
+ * @example
150
+ * const showUnexpectedErrorNotification = useShowUnexpectedErrorNotification();
151
+ * showUnexpectedErrorNotification({ errors });
152
+ */
152
153
 
153
154
  function useShowUnexpectedErrorNotification() {
154
155
  var dispatch = useDispatch();
@@ -11,5 +11,17 @@ declare type ApiError = {
11
11
  };
12
12
  export declare type ActionError = Error | ApiError;
13
13
  export declare type DispatchActionError = ThunkDispatch<null, null, ReturnType<typeof showApiErrorNotification> | ReturnType<typeof showUnexpectedErrorNotification>>;
14
- export default function handleActionError(error: ActionError): (dispatch: DispatchActionError) => import("@commercetools-frontend/notifications").TAddNotificationAction<Pick<import("..").TApiErrorNotification, "id">> | null;
14
+ export default function handleActionError(error: ActionError): (dispatch: DispatchActionError) => import("@commercetools-frontend/notifications").TAddNotificationAction<import("@commercetools-frontend/constants").TAppNotificationOfDomain & {
15
+ kind: import("@commercetools-frontend/constants").TAppNotificationKindPage;
16
+ } & {
17
+ id: number;
18
+ text?: undefined;
19
+ values?: import("@commercetools-frontend/constants").TAppNotificationValuesApiError<{}> | undefined;
20
+ } & import("@commercetools-frontend/notifications").TNotification> | import("@commercetools-frontend/notifications").TAddNotificationAction<import("@commercetools-frontend/constants").TAppNotificationOfDomain & {
21
+ kind: import("@commercetools-frontend/constants").TAppNotificationKindPage;
22
+ } & {
23
+ id: number;
24
+ text?: undefined;
25
+ values?: import("@commercetools-frontend/constants").TAppNotificationValuesUnexpectedError | undefined;
26
+ } & import("@commercetools-frontend/notifications").TNotification> | null;
15
27
  export {};
@@ -1,2 +1,8 @@
1
- import type { TApiErrorNotification, TApiErrorNotificationOptions } from '../types';
2
- export default function showApiErrorNotification({ errors, }: TApiErrorNotificationOptions): import("@commercetools-frontend/notifications").TAddNotificationAction<Pick<TApiErrorNotification, "id">>;
1
+ import type { TApiErrorNotificationOptions } from '../types';
2
+ export default function showApiErrorNotification({ errors, }: TApiErrorNotificationOptions): import("@commercetools-frontend/notifications").TAddNotificationAction<import("@commercetools-frontend/constants").TAppNotificationOfDomain & {
3
+ kind: import("@commercetools-frontend/constants").TAppNotificationKindPage;
4
+ } & {
5
+ id: number;
6
+ text?: undefined;
7
+ values?: import("@commercetools-frontend/constants").TAppNotificationValuesApiError<{}> | undefined;
8
+ } & import("@commercetools-frontend/notifications").TNotification>;
@@ -1,3 +1,3 @@
1
- import type { TNotificationMetaOptions } from '@commercetools-frontend/notifications';
1
+ import type { TNotificationMetaOptions, TNotification } from '@commercetools-frontend/notifications';
2
2
  import type { TShowNotification } from '../types';
3
- export default function showNotification<Notification extends TShowNotification>(notification: Notification, meta?: TNotificationMetaOptions): import("@commercetools-frontend/notifications").TAddNotificationAction<Pick<Notification, "id">>;
3
+ export default function showNotification<Notification extends TShowNotification>(notification: Notification, meta?: TNotificationMetaOptions): import("@commercetools-frontend/notifications").TAddNotificationAction<Notification & TNotification>;
@@ -1,3 +1,8 @@
1
1
  import type { TAppNotificationValuesUnexpectedError } from '@commercetools-frontend/constants';
2
- import type { TUnexpectedErrorNotification } from '../types';
3
- export default function showUnexpectedErrorNotification({ errorId, }?: TAppNotificationValuesUnexpectedError): import("@commercetools-frontend/notifications").TAddNotificationAction<Pick<TUnexpectedErrorNotification, "id">>;
2
+ export default function showUnexpectedErrorNotification({ errorId, }?: TAppNotificationValuesUnexpectedError): import("@commercetools-frontend/notifications").TAddNotificationAction<import("@commercetools-frontend/constants").TAppNotificationOfDomain & {
3
+ kind: import("@commercetools-frontend/constants").TAppNotificationKindPage;
4
+ } & {
5
+ id: number;
6
+ text?: undefined;
7
+ values?: TAppNotificationValuesUnexpectedError | undefined;
8
+ } & import("@commercetools-frontend/notifications").TNotification>;
@@ -1,2 +1,14 @@
1
1
  import type { ActionError } from '../actions/handle-action-error';
2
- export default function useOnActionError(): (error: ActionError) => (dispatch: import("../actions/handle-action-error").DispatchActionError) => import("@commercetools-frontend/notifications").TAddNotificationAction<Pick<import("..").TApiErrorNotification, "id">> | null;
2
+ export default function useOnActionError(): (error: ActionError) => (dispatch: import("../actions/handle-action-error").DispatchActionError) => import("@commercetools-frontend/notifications").TAddNotificationAction<import("@commercetools-frontend/constants").TAppNotificationOfDomain & {
3
+ kind: import("@commercetools-frontend/constants").TAppNotificationKindPage;
4
+ } & {
5
+ id: number;
6
+ text?: undefined;
7
+ values?: import("@commercetools-frontend/constants").TAppNotificationValuesApiError<{}> | undefined;
8
+ } & import("@commercetools-frontend/notifications").TNotification> | import("@commercetools-frontend/notifications").TAddNotificationAction<import("@commercetools-frontend/constants").TAppNotificationOfDomain & {
9
+ kind: import("@commercetools-frontend/constants").TAppNotificationKindPage;
10
+ } & {
11
+ id: number;
12
+ text?: undefined;
13
+ values?: import("@commercetools-frontend/constants").TAppNotificationValuesUnexpectedError | undefined;
14
+ } & import("@commercetools-frontend/notifications").TNotification> | null;
@@ -1,2 +1,8 @@
1
1
  import type { TApiErrorNotificationOptions } from '../types';
2
- export default function useShowApiErrorNotification(): (options: TApiErrorNotificationOptions) => import("@commercetools-frontend/notifications").TAddNotificationAction<Pick<import("../types").TApiErrorNotification, "id">>;
2
+ export default function useShowApiErrorNotification(): (options: TApiErrorNotificationOptions) => import("@commercetools-frontend/notifications").TAddNotificationAction<import("@commercetools-frontend/constants").TAppNotificationOfDomain & {
3
+ kind: import("@commercetools-frontend/constants").TAppNotificationKindPage;
4
+ } & {
5
+ id: number;
6
+ text?: undefined;
7
+ values?: import("@commercetools-frontend/constants").TAppNotificationValuesApiError<{}> | undefined;
8
+ } & import("@commercetools-frontend/notifications").TNotification>;
@@ -1,3 +1,6 @@
1
- import type { TNotificationMetaOptions } from '@commercetools-frontend/notifications';
1
+ import type { TNotificationMetaOptions, TAddNotificationAction, TNotification } from '@commercetools-frontend/notifications';
2
2
  import type { TShowNotification } from '../types';
3
- export default function useShowNotification<Notification extends TShowNotification>(notificationFragment?: Partial<Notification>): (content: Notification, meta?: TNotificationMetaOptions | undefined) => import("@commercetools-frontend/notifications").TAddNotificationAction<Pick<Notification, "id">>;
3
+ declare type TNotificationHook<Notification extends TShowNotification> = (content: Notification, meta?: TNotificationMetaOptions) => TAddNotificationAction<Notification & TNotification>;
4
+ declare function useShowNotification<Notification extends TShowNotification>(): TNotificationHook<Notification>;
5
+ declare function useShowNotification<Notification extends TShowNotification>(notificationFragment: Partial<Notification>): TNotificationHook<Notification>;
6
+ export default useShowNotification;
@@ -1,2 +1,8 @@
1
1
  import type { TAppNotificationValuesUnexpectedError } from '@commercetools-frontend/constants';
2
- export default function useShowUnexpectedErrorNotification(): (options: TAppNotificationValuesUnexpectedError) => import("@commercetools-frontend/notifications").TAddNotificationAction<Pick<import("..").TUnexpectedErrorNotification, "id">>;
2
+ export default function useShowUnexpectedErrorNotification(): (options: TAppNotificationValuesUnexpectedError) => import("@commercetools-frontend/notifications").TAddNotificationAction<import("@commercetools-frontend/constants").TAppNotificationOfDomain & {
3
+ kind: import("@commercetools-frontend/constants").TAppNotificationKindPage;
4
+ } & {
5
+ id: number;
6
+ text?: undefined;
7
+ values?: TAppNotificationValuesUnexpectedError | undefined;
8
+ } & import("@commercetools-frontend/notifications").TNotification>;
@@ -1,16 +1,15 @@
1
- import type { TNotification } from '@commercetools-frontend/notifications';
2
1
  import type { TAppNotification, TAppNotificationDomain, TAppNotificationKind, TAppNotificationApiError, TAppNotificationValuesApiError, TAppNotificationValuesUnexpectedError } from '@commercetools-frontend/constants';
3
- export declare type TShowNotification = TNotification & {
2
+ export declare type TShowNotification = {
4
3
  domain: TAppNotificationDomain;
5
4
  kind: TAppNotificationKind;
6
5
  text?: string;
7
6
  };
8
- export declare type TApiErrorNotification = TNotification & TAppNotification<{
7
+ export declare type TApiErrorNotification = TAppNotification<{
9
8
  domain: 'page';
10
9
  kind: 'api-error';
11
10
  values: TAppNotificationValuesApiError;
12
11
  }>;
13
- export declare type TUnexpectedErrorNotification = TNotification & TAppNotification<{
12
+ export declare type TUnexpectedErrorNotification = TAppNotification<{
14
13
  domain: 'page';
15
14
  kind: 'unexpected-error';
16
15
  values: TAppNotificationValuesUnexpectedError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/actions-global",
3
- "version": "21.0.0",
3
+ "version": "21.3.4",
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": {
@@ -18,21 +18,21 @@
18
18
  "module": "dist/commercetools-frontend-actions-global.esm.js",
19
19
  "files": ["dist", "package.json", "LICENSE", "README.md"],
20
20
  "dependencies": {
21
- "@babel/runtime": "^7.16.7",
22
- "@babel/runtime-corejs3": "^7.16.8",
23
- "@commercetools-frontend/browser-history": "21.0.0",
24
- "@commercetools-frontend/constants": "21.0.0",
25
- "@commercetools-frontend/notifications": "21.0.0",
26
- "@commercetools-frontend/sentry": "21.0.0",
27
- "@types/lodash": "^4.14.178",
28
- "@types/react": "^17.0.38",
29
- "@types/react-redux": "^7.1.22",
21
+ "@babel/runtime": "^7.17.9",
22
+ "@babel/runtime-corejs3": "^7.17.9",
23
+ "@commercetools-frontend/browser-history": "21.3.4",
24
+ "@commercetools-frontend/constants": "21.3.4",
25
+ "@commercetools-frontend/notifications": "21.3.4",
26
+ "@commercetools-frontend/sentry": "21.3.4",
27
+ "@types/lodash": "^4.14.181",
28
+ "@types/react": "^17.0.44",
29
+ "@types/react-redux": "^7.1.23",
30
30
  "lodash": "4.17.21",
31
31
  "redux-thunk": "2.4.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "react": "17.0.2",
35
- "react-redux": "7.2.6",
35
+ "react-redux": "7.2.8",
36
36
  "redux": "4.1.2"
37
37
  },
38
38
  "peerDependencies": {