@commercetools-frontend/notifications 20.5.2 → 20.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-notifications.cjs.dev.js +9 -9
- package/dist/commercetools-frontend-notifications.cjs.prod.js +9 -9
- package/dist/commercetools-frontend-notifications.esm.js +2 -2
- package/dist/declarations/src/action-creators.d.ts +3 -3
- package/dist/declarations/src/action-types.d.ts +2 -2
- package/dist/declarations/src/index.d.ts +6 -6
- package/dist/declarations/src/middleware.d.ts +11 -11
- package/dist/declarations/src/reducer.d.ts +2 -2
- package/dist/declarations/src/types.d.ts +20 -20
- package/dist/declarations/src/version.d.ts +2 -2
- package/package.json +4 -8
|
@@ -32,8 +32,8 @@ var _Map__default = /*#__PURE__*/_interopDefault(_Map);
|
|
|
32
32
|
var _setTimeout__default = /*#__PURE__*/_interopDefault(_setTimeout);
|
|
33
33
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
34
34
|
|
|
35
|
-
// NOTE: This string will be replaced
|
|
36
|
-
var version =
|
|
35
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
36
|
+
var version = "20.10.6";
|
|
37
37
|
|
|
38
38
|
var ADD_NOTIFICATION = 'ADD_NOTIFICATION';
|
|
39
39
|
var REMOVE_NOTIFICATION = 'REMOVE_NOTIFICATION';
|
|
@@ -55,17 +55,17 @@ function removeNotification(id) {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
58
|
+
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; }
|
|
59
59
|
|
|
60
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty__default[
|
|
60
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source), true)).call(_context2, 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 _context3; _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
61
61
|
|
|
62
62
|
var isNotificationAction = function isNotificationAction(action) {
|
|
63
63
|
var _context;
|
|
64
64
|
|
|
65
|
-
return _includesInstanceProperty__default[
|
|
65
|
+
return _includesInstanceProperty__default["default"](_context = [ADD_NOTIFICATION, REMOVE_NOTIFICATION]).call(_context, action.type);
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
var dismissCallbacksMap = new _Map__default[
|
|
68
|
+
var dismissCallbacksMap = new _Map__default["default"]();
|
|
69
69
|
var id = 0;
|
|
70
70
|
|
|
71
71
|
var middleware = function middleware(_ref) {
|
|
@@ -90,7 +90,7 @@ var middleware = function middleware(_ref) {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
if (action.meta) {
|
|
93
|
-
if (action.meta.dismissAfter) _setTimeout__default[
|
|
93
|
+
if (action.meta.dismissAfter) _setTimeout__default["default"](dismissCallback, action.meta.dismissAfter);
|
|
94
94
|
if (typeof action.meta.onDismiss === 'function') dismissCallbacksMap.set(notification.id, action.meta.onDismiss);
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -128,11 +128,11 @@ function notificationsReducer() {
|
|
|
128
128
|
{
|
|
129
129
|
var _context;
|
|
130
130
|
|
|
131
|
-
return _concatInstanceProperty__default[
|
|
131
|
+
return _concatInstanceProperty__default["default"](_context = [action.payload]).call(_context, _toConsumableArray(state));
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
case REMOVE_NOTIFICATION:
|
|
135
|
-
return _filterInstanceProperty__default[
|
|
135
|
+
return _filterInstanceProperty__default["default"](state).call(state, function (notification) {
|
|
136
136
|
return action.payload.id !== notification.id;
|
|
137
137
|
});
|
|
138
138
|
|
|
@@ -32,8 +32,8 @@ var _Map__default = /*#__PURE__*/_interopDefault(_Map);
|
|
|
32
32
|
var _setTimeout__default = /*#__PURE__*/_interopDefault(_setTimeout);
|
|
33
33
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
34
34
|
|
|
35
|
-
// NOTE: This string will be replaced
|
|
36
|
-
var version =
|
|
35
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
36
|
+
var version = "20.10.6";
|
|
37
37
|
|
|
38
38
|
var ADD_NOTIFICATION = 'ADD_NOTIFICATION';
|
|
39
39
|
var REMOVE_NOTIFICATION = 'REMOVE_NOTIFICATION';
|
|
@@ -55,17 +55,17 @@ function removeNotification(id) {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
58
|
+
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; }
|
|
59
59
|
|
|
60
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty__default[
|
|
60
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source), true)).call(_context2, 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 _context3; _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
61
61
|
|
|
62
62
|
var isNotificationAction = function isNotificationAction(action) {
|
|
63
63
|
var _context;
|
|
64
64
|
|
|
65
|
-
return _includesInstanceProperty__default[
|
|
65
|
+
return _includesInstanceProperty__default["default"](_context = [ADD_NOTIFICATION, REMOVE_NOTIFICATION]).call(_context, action.type);
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
var dismissCallbacksMap = new _Map__default[
|
|
68
|
+
var dismissCallbacksMap = new _Map__default["default"]();
|
|
69
69
|
var id = 0;
|
|
70
70
|
|
|
71
71
|
var middleware = function middleware(_ref) {
|
|
@@ -90,7 +90,7 @@ var middleware = function middleware(_ref) {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
if (action.meta) {
|
|
93
|
-
if (action.meta.dismissAfter) _setTimeout__default[
|
|
93
|
+
if (action.meta.dismissAfter) _setTimeout__default["default"](dismissCallback, action.meta.dismissAfter);
|
|
94
94
|
if (typeof action.meta.onDismiss === 'function') dismissCallbacksMap.set(notification.id, action.meta.onDismiss);
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -128,11 +128,11 @@ function notificationsReducer() {
|
|
|
128
128
|
{
|
|
129
129
|
var _context;
|
|
130
130
|
|
|
131
|
-
return _concatInstanceProperty__default[
|
|
131
|
+
return _concatInstanceProperty__default["default"](_context = [action.payload]).call(_context, _toConsumableArray(state));
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
case REMOVE_NOTIFICATION:
|
|
135
|
-
return _filterInstanceProperty__default[
|
|
135
|
+
return _filterInstanceProperty__default["default"](state).call(state, function (notification) {
|
|
136
136
|
return action.payload.id !== notification.id;
|
|
137
137
|
});
|
|
138
138
|
|
|
@@ -13,8 +13,8 @@ import _setTimeout from '@babel/runtime-corejs3/core-js-stable/set-timeout';
|
|
|
13
13
|
import _toConsumableArray from '@babel/runtime-corejs3/helpers/esm/toConsumableArray';
|
|
14
14
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
15
15
|
|
|
16
|
-
// NOTE: This string will be replaced
|
|
17
|
-
var version =
|
|
16
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
17
|
+
var version = "20.10.6";
|
|
18
18
|
|
|
19
19
|
var ADD_NOTIFICATION = 'ADD_NOTIFICATION';
|
|
20
20
|
var REMOVE_NOTIFICATION = 'REMOVE_NOTIFICATION';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { TNotificationMetaOptions, TRemoveNotificationAction, TNotification, TAddNotificationAction } from './types';
|
|
2
|
-
export declare function addNotification<Payload extends TNotification>(notification: Payload, meta?: TNotificationMetaOptions): TAddNotificationAction<Payload>;
|
|
3
|
-
export declare function removeNotification(id: TNotification['id']): TRemoveNotificationAction;
|
|
1
|
+
import type { TNotificationMetaOptions, TRemoveNotificationAction, TNotification, TAddNotificationAction } from './types';
|
|
2
|
+
export declare function addNotification<Payload extends TNotification>(notification: Payload, meta?: TNotificationMetaOptions): TAddNotificationAction<Payload>;
|
|
3
|
+
export declare function removeNotification(id: TNotification['id']): TRemoveNotificationAction;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ADD_NOTIFICATION = "ADD_NOTIFICATION";
|
|
2
|
-
export declare const REMOVE_NOTIFICATION = "REMOVE_NOTIFICATION";
|
|
1
|
+
export declare const ADD_NOTIFICATION = "ADD_NOTIFICATION";
|
|
2
|
+
export declare const REMOVE_NOTIFICATION = "REMOVE_NOTIFICATION";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { default as version } from './version';
|
|
2
|
-
export
|
|
3
|
-
export { default as
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
1
|
+
export { default as version } from './version';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export { default as middleware } from './middleware';
|
|
4
|
+
export { default as reducer } from './reducer';
|
|
5
|
+
export { addNotification, removeNotification } from './action-creators';
|
|
6
|
+
export { ADD_NOTIFICATION, REMOVE_NOTIFICATION } from './action-types';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Dispatch, MiddlewareAPI } from 'redux';
|
|
2
|
-
import type { TNotification, TNotificationAction } from './types';
|
|
3
|
-
declare const middleware: <Payload extends TNotification>({ dispatch }: MiddlewareAPI) => (next: Dispatch<TNotificationAction<Payload>>) => (action: TNotificationAction<Payload>) => import("./types").TRemoveNotificationAction | {
|
|
4
|
-
payload: Payload & {
|
|
5
|
-
id: number;
|
|
6
|
-
};
|
|
7
|
-
dismiss: () => void;
|
|
8
|
-
meta?: import("./types").TNotificationMetaOptions | undefined;
|
|
9
|
-
type: "ADD_NOTIFICATION";
|
|
10
|
-
};
|
|
11
|
-
export default middleware;
|
|
1
|
+
import type { Dispatch, MiddlewareAPI } from 'redux';
|
|
2
|
+
import type { TNotification, TNotificationAction } from './types';
|
|
3
|
+
declare const middleware: <Payload extends TNotification>({ dispatch }: MiddlewareAPI) => (next: Dispatch<TNotificationAction<Payload>>) => (action: TNotificationAction<Payload>) => import("./types").TRemoveNotificationAction | {
|
|
4
|
+
payload: Payload & {
|
|
5
|
+
id: number;
|
|
6
|
+
};
|
|
7
|
+
dismiss: () => void;
|
|
8
|
+
meta?: import("./types").TNotificationMetaOptions | undefined;
|
|
9
|
+
type: "ADD_NOTIFICATION";
|
|
10
|
+
};
|
|
11
|
+
export default middleware;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { TNotification, TNotificationAction, TNotificationState } from './types';
|
|
2
|
-
export default function notificationsReducer<Payload extends TNotification>(state: TNotificationState<Payload> | undefined, action: TNotificationAction<Payload>): TNotificationState<Payload>;
|
|
1
|
+
import type { TNotification, TNotificationAction, TNotificationState } from './types';
|
|
2
|
+
export default function notificationsReducer<Payload extends TNotification>(state: TNotificationState<Payload> | undefined, action: TNotificationAction<Payload>): TNotificationState<Payload>;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { Action } from 'redux';
|
|
2
|
-
import { ADD_NOTIFICATION, REMOVE_NOTIFICATION } from './action-types';
|
|
3
|
-
export declare type TNotification = {
|
|
4
|
-
id: number;
|
|
5
|
-
};
|
|
6
|
-
export declare type TNotificationOnDismiss = (id: TNotification['id']) => void;
|
|
7
|
-
export declare type TNotificationMetaOptions = {
|
|
8
|
-
dismissAfter?: number;
|
|
9
|
-
onDismiss?: TNotificationOnDismiss;
|
|
10
|
-
};
|
|
11
|
-
export interface TAddNotificationAction<Payload extends TNotification> extends Action<typeof ADD_NOTIFICATION> {
|
|
12
|
-
payload: Payload;
|
|
13
|
-
meta?: TNotificationMetaOptions;
|
|
14
|
-
dismiss?: () => void;
|
|
15
|
-
}
|
|
16
|
-
export interface TRemoveNotificationAction extends Action<typeof REMOVE_NOTIFICATION> {
|
|
17
|
-
payload: TNotification;
|
|
18
|
-
}
|
|
19
|
-
export declare type TNotificationAction<Payload extends TNotification> = TAddNotificationAction<Payload> | TRemoveNotificationAction;
|
|
20
|
-
export declare type TNotificationState<Payload extends TNotification> = Payload[];
|
|
1
|
+
import type { Action } from 'redux';
|
|
2
|
+
import { ADD_NOTIFICATION, REMOVE_NOTIFICATION } from './action-types';
|
|
3
|
+
export declare type TNotification = {
|
|
4
|
+
id: number;
|
|
5
|
+
};
|
|
6
|
+
export declare type TNotificationOnDismiss = (id: TNotification['id']) => void;
|
|
7
|
+
export declare type TNotificationMetaOptions = {
|
|
8
|
+
dismissAfter?: number;
|
|
9
|
+
onDismiss?: TNotificationOnDismiss;
|
|
10
|
+
};
|
|
11
|
+
export interface TAddNotificationAction<Payload extends TNotification> extends Action<typeof ADD_NOTIFICATION> {
|
|
12
|
+
payload: Payload;
|
|
13
|
+
meta?: TNotificationMetaOptions;
|
|
14
|
+
dismiss?: () => void;
|
|
15
|
+
}
|
|
16
|
+
export interface TRemoveNotificationAction extends Action<typeof REMOVE_NOTIFICATION> {
|
|
17
|
+
payload: TNotification;
|
|
18
|
+
}
|
|
19
|
+
export declare type TNotificationAction<Payload extends TNotification> = TAddNotificationAction<Payload> | TRemoveNotificationAction;
|
|
20
|
+
export declare type TNotificationState<Payload extends TNotification> = Payload[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: "__@APPLICATION_KIT_PACKAGE/VERSION_OF_RELEASE__";
|
|
2
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/notifications",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.10.6",
|
|
4
4
|
"description": "A general-purpose notification system built on top of redux",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -11,22 +11,18 @@
|
|
|
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-notifications.cjs.js",
|
|
19
18
|
"module": "dist/commercetools-frontend-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
|
-
"@babel/runtime": "7.
|
|
26
|
-
"@babel/runtime-corejs3": "7.
|
|
21
|
+
"@babel/runtime": "7.15.4",
|
|
22
|
+
"@babel/runtime-corejs3": "7.15.4"
|
|
27
23
|
},
|
|
28
24
|
"devDependencies": {
|
|
29
|
-
"redux": "4.1.
|
|
25
|
+
"redux": "4.1.1"
|
|
30
26
|
},
|
|
31
27
|
"peerDependencies": {
|
|
32
28
|
"redux": "4.x"
|