@evlop/commons 1.0.120 → 1.0.123
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +1 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/useAction.d.ts +2 -11
- package/dist/src/hooks/useAction.d.ts.map +1 -1
- package/dist/src/hooks/useAction.js +9 -38
- package/dist/src/hooks/useAction.js.map +1 -1
- package/dist/src/hooks/useActionable.d.ts +21 -0
- package/dist/src/hooks/useActionable.d.ts.map +1 -0
- package/dist/src/hooks/useActionable.js +54 -0
- package/dist/src/hooks/useActionable.js.map +1 -0
- package/dist/src/reducers/config/index.d.ts +1 -1
- package/dist/src/reducers/config/index.d.ts.map +1 -1
- package/dist/src/reducers/config/index.js +4 -4
- package/dist/src/reducers/config/index.js.map +1 -1
- package/dist/src/reducers/index.d.ts +2 -0
- package/dist/src/reducers/index.d.ts.map +1 -1
- package/dist/src/reducers/index.js +3 -0
- package/dist/src/reducers/index.js.map +1 -1
- package/dist/src/reducers/notifications.d.ts +58 -0
- package/dist/src/reducers/notifications.d.ts.map +1 -0
- package/dist/src/reducers/notifications.js +41 -0
- package/dist/src/reducers/notifications.js.map +1 -0
- package/package.json +1 -1
@@ -21,6 +21,7 @@ export * from './useMenuItems';
|
|
21
21
|
export * from './useEditable';
|
22
22
|
export * from './usePage';
|
23
23
|
export * from './useParams';
|
24
|
+
export * from './useActionable';
|
24
25
|
export * from './useAction';
|
25
26
|
export * from './usePastePlainText';
|
26
27
|
export * from './useResponsive';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.tsx"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;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AChC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
package/dist/src/hooks/index.js
CHANGED
@@ -33,6 +33,7 @@ __exportStar(require("./useMenuItems"), exports);
|
|
33
33
|
__exportStar(require("./useEditable"), exports);
|
34
34
|
__exportStar(require("./usePage"), exports);
|
35
35
|
__exportStar(require("./useParams"), exports);
|
36
|
+
__exportStar(require("./useActionable"), exports);
|
36
37
|
__exportStar(require("./useAction"), exports);
|
37
38
|
__exportStar(require("./usePastePlainText"), exports);
|
38
39
|
__exportStar(require("./useResponsive"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+B;AAC/B,yDAAuC;AACvC,8CAA4B;AAC5B,kDAAgC;AAChC,4CAA0B;AAC1B,6CAA2B;AAC3B,qDAAmC;AACnC,gDAA8B;AAC9B,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,6CAA2B;AAC3B,kDAAgC;AAChC,0DAAwC;AACxC,wDAAsC;AACtC,gEAA8C;AAC9C,6DAA2C;AAC3C,4DAA0C;AAC1C,oDAAkC;AAClC,iDAA+B;AAC/B,gDAA8B;AAC9B,4CAA0B;AAC1B,8CAA4B;AAC5B,8CAA4B;AAC5B,sDAAoC;AACpC,kDAAgC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+B;AAC/B,yDAAuC;AACvC,8CAA4B;AAC5B,kDAAgC;AAChC,4CAA0B;AAC1B,6CAA2B;AAC3B,qDAAmC;AACnC,gDAA8B;AAC9B,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,6CAA2B;AAC3B,kDAAgC;AAChC,0DAAwC;AACxC,wDAAsC;AACtC,gEAA8C;AAC9C,6DAA2C;AAC3C,4DAA0C;AAC1C,oDAAkC;AAClC,iDAA+B;AAC/B,gDAA8B;AAC9B,4CAA0B;AAC1B,8CAA4B;AAC5B,kDAAgC;AAChC,8CAA4B;AAC5B,sDAAoC;AACpC,kDAAgC"}
|
@@ -1,18 +1,9 @@
|
|
1
|
+
import { Action } from './useActionable';
|
1
2
|
/**
|
2
3
|
* get a action function for
|
3
4
|
* @param action action object ot function
|
4
5
|
* @returns function
|
5
6
|
*/
|
6
|
-
|
7
|
-
link: string;
|
8
|
-
bindKey: string;
|
9
|
-
route: string;
|
10
|
-
navigate: Array<string> | string;
|
11
|
-
page: Array<string> | string;
|
12
|
-
dispatch: Object | Function;
|
13
|
-
callback: Function;
|
14
|
-
}
|
15
|
-
declare type Action = ActionObject | Function | any;
|
16
|
-
export declare const useAction: (action: Action) => (event: any) => any;
|
7
|
+
export declare const useAction: (action?: Action) => (event: any) => any;
|
17
8
|
export default useAction;
|
18
9
|
//# sourceMappingURL=useAction.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useAction.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"useAction.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":"AACA,OAAsB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGxD;;;;GAIG;AAEH,eAAO,MAAM,SAAS,YAAa,MAAM,wBAIxC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
@@ -5,45 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.useAction = void 0;
|
7
7
|
const react_1 = require("react");
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
const useActionable_1 = __importDefault(require("./useActionable"));
|
9
|
+
// link, callback, dispatch, navigate
|
10
|
+
/**
|
11
|
+
* get a action function for
|
12
|
+
* @param action action object ot function
|
13
|
+
* @returns function
|
14
|
+
*/
|
14
15
|
const useAction = (action) => {
|
15
|
-
const
|
16
|
-
|
17
|
-
const scope = useScope_1.useScope();
|
18
|
-
const template = useTemplate_1.default();
|
19
|
-
return react_1.useCallback((event) => {
|
20
|
-
let actionToUse = action;
|
21
|
-
while (actionToUse && actionToUse.bindKey) {
|
22
|
-
actionToUse = lodash_1.get(scope, actionToUse.bindKey);
|
23
|
-
}
|
24
|
-
if (typeof actionToUse === 'function')
|
25
|
-
return actionToUse(event);
|
26
|
-
if (actionToUse) {
|
27
|
-
const { link, navigate, push, page, params, dispatch: dispatchAction, route, callback } = actionToUse;
|
28
|
-
if (link)
|
29
|
-
return navigator.openURL(template(link));
|
30
|
-
if (navigate)
|
31
|
-
return navigator.navigate(...lodash_1.castArray(JSON.parse(template(JSON.stringify(navigate)))));
|
32
|
-
if (push)
|
33
|
-
return navigator.push(...lodash_1.castArray(JSON.parse(template(JSON.stringify(navigate)))));
|
34
|
-
if (page) {
|
35
|
-
const routeParams = lodash_2.mapValues(params, (paramValue) => template(paramValue.toString()));
|
36
|
-
return navigator.openPage(page, routeParams);
|
37
|
-
}
|
38
|
-
;
|
39
|
-
if (route)
|
40
|
-
return navigator.openRoute(template(route));
|
41
|
-
if (dispatchAction)
|
42
|
-
return dispatch(dispatchAction);
|
43
|
-
if (callback)
|
44
|
-
return callback({ event, navigator, dispatch });
|
45
|
-
}
|
46
|
-
}, [action, navigator, dispatch, template, scope]);
|
16
|
+
const createActionHandeller = useActionable_1.default();
|
17
|
+
return react_1.useMemo(() => createActionHandeller(action), [action, createActionHandeller]);
|
47
18
|
};
|
48
19
|
exports.useAction = useAction;
|
49
20
|
exports.default = exports.useAction;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useAction.js","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":";;;;;;AAAA,
|
1
|
+
{"version":3,"file":"useAction.js","sourceRoot":"","sources":["../../../src/hooks/useAction.tsx"],"names":[],"mappings":";;;;;;AAAA,iCAAgC;AAChC,oEAAwD;AAExD,qCAAqC;AACrC;;;;GAIG;AAEI,MAAM,SAAS,GAAG,CAAC,MAAe,EAAC,EAAE;IACxC,MAAM,qBAAqB,GAAG,uBAAa,EAAE,CAAC;IAE9C,OAAO,eAAO,CAAC,GAAE,EAAE,CAAA,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AACvF,CAAC,CAAC;AAJW,QAAA,SAAS,aAIpB;AAEF,kBAAe,iBAAS,CAAC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/**
|
2
|
+
* get a action function for
|
3
|
+
* @param action action object ot function
|
4
|
+
* @returns function
|
5
|
+
*/
|
6
|
+
export interface ActionObject {
|
7
|
+
link: string;
|
8
|
+
bindKey: string;
|
9
|
+
route: string;
|
10
|
+
navigate: Array<string> | string;
|
11
|
+
page: Array<string> | string;
|
12
|
+
dispatch: Object | Function;
|
13
|
+
callback: Function;
|
14
|
+
}
|
15
|
+
export declare type Action = ActionObject | Function | any;
|
16
|
+
/**
|
17
|
+
* @description a function to map action into action handeller function
|
18
|
+
*/
|
19
|
+
export declare const useActionable: () => (action: Action) => (event: any) => any;
|
20
|
+
export default useActionable;
|
21
|
+
//# sourceMappingURL=useActionable.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useActionable.d.ts","sourceRoot":"","sources":["../../../src/hooks/useActionable.tsx"],"names":[],"mappings":"AASA;;;;GAIG;AAEF,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,QAAQ,EAAE,QAAQ,CAAC;CACtB;AAED,oBAAY,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,GAAG,CAAA;AAElD;;GAEG;AACJ,eAAO,MAAM,aAAa,iBAM8B,MAAM,aAAa,GAAG,QA0B7E,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.useActionable = void 0;
|
7
|
+
const react_1 = require("react");
|
8
|
+
const react_redux_1 = require("react-redux");
|
9
|
+
const lodash_1 = require("lodash");
|
10
|
+
const useNavigator_1 = require("./useNavigator");
|
11
|
+
const useScope_1 = require("./useScope");
|
12
|
+
const useTemplate_1 = __importDefault(require("./useTemplate"));
|
13
|
+
const lodash_2 = require("lodash");
|
14
|
+
/**
|
15
|
+
* @description a function to map action into action handeller function
|
16
|
+
*/
|
17
|
+
const useActionable = () => {
|
18
|
+
const navigator = useNavigator_1.useNavigator();
|
19
|
+
const dispatch = react_redux_1.useDispatch();
|
20
|
+
const scope = useScope_1.useScope();
|
21
|
+
const template = useTemplate_1.default();
|
22
|
+
const createActionHandeller = react_1.useCallback((action) => (event) => {
|
23
|
+
let actionToUse = action;
|
24
|
+
while (actionToUse && actionToUse.bindKey) {
|
25
|
+
actionToUse = lodash_1.get(scope, actionToUse.bindKey);
|
26
|
+
}
|
27
|
+
if (typeof actionToUse === 'function')
|
28
|
+
return actionToUse(event);
|
29
|
+
if (actionToUse) {
|
30
|
+
const { link, navigate, push, page, params, dispatch: dispatchAction, route, callback } = actionToUse;
|
31
|
+
if (link)
|
32
|
+
return navigator.openURL(template(link));
|
33
|
+
if (navigate)
|
34
|
+
return navigator.navigate(...lodash_1.castArray(JSON.parse(template(JSON.stringify(navigate)))));
|
35
|
+
if (push)
|
36
|
+
return navigator.push(...lodash_1.castArray(JSON.parse(template(JSON.stringify(navigate)))));
|
37
|
+
if (page) {
|
38
|
+
const routeParams = lodash_2.mapValues(params, (paramValue) => template(paramValue.toString()));
|
39
|
+
return navigator.openPage(page, routeParams);
|
40
|
+
}
|
41
|
+
;
|
42
|
+
if (route)
|
43
|
+
return navigator.openRoute(template(route));
|
44
|
+
if (dispatchAction)
|
45
|
+
return dispatch(dispatchAction);
|
46
|
+
if (callback)
|
47
|
+
return callback({ event, navigator, dispatch });
|
48
|
+
}
|
49
|
+
}, [navigator, dispatch, template, scope]);
|
50
|
+
return createActionHandeller;
|
51
|
+
};
|
52
|
+
exports.useActionable = useActionable;
|
53
|
+
exports.default = exports.useActionable;
|
54
|
+
//# sourceMappingURL=useActionable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useActionable.js","sourceRoot":"","sources":["../../../src/hooks/useActionable.tsx"],"names":[],"mappings":";;;;;;AAAA,iCAA6C;AAC7C,6CAA0C;AAC1C,mCAAwC;AACxC,iDAA4C;AAC5C,yCAAoC;AACpC,gEAAwC;AACxC,mCAAiC;AAqBhC;;GAEG;AACG,MAAM,aAAa,GAAG,GAAE,EAAE;IAC7B,MAAM,SAAS,GAAG,2BAAY,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,yBAAW,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,mBAAQ,EAAE,CAAC;IACzB,MAAM,QAAQ,GAAG,qBAAW,EAAE,CAAC;IAE/B,MAAM,qBAAqB,GAAI,mBAAW,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,KAAU,EAAE,EAAE;QAC1E,IAAI,WAAW,GAAG,MAAM,CAAC;QAEzB,OAAO,WAAW,IAAI,WAAW,CAAC,OAAO,EAAC;YACtC,WAAW,GAAG,YAAG,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;SACjD;Q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,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAE3C,OAAO,qBAAqB,CAAC;AACjC,CAAC,CAAC;AAhCW,QAAA,aAAa,iBAgCxB;AAEF,kBAAe,qBAAa,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export declare const ADD_SETTINGS_FIELD = "ADD_SETTINGS_FIELD";
|
2
2
|
export declare const ADD_SITE_PAGE = "ADD_SITE_PAGE";
|
3
3
|
export declare const UPDATE_THEME = "UPDATE_SITE_THEME";
|
4
|
-
export declare const
|
4
|
+
export declare const SET_CONFIG = "SET_CONFIG";
|
5
5
|
export declare const GET_CONFIG_REQUEST = "GET_CONFIG_REQUEST";
|
6
6
|
export declare const GET_CONFIG_SUCCESS = "GET_CONFIG_SUCCESS";
|
7
7
|
export declare const GET_CONFIG_FAILURE = "GET_CONFIG_FAILURE";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/reducers/config/index.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,YAAY,sBAAsB,CAAC;AAChD,eAAO,MAAM,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/reducers/config/index.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,YAAY,sBAAsB,CAAC;AAChD,eAAO,MAAM,UAAU,eAAe,CAAC;AAEvC,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,wBAAgB,gBAAgB,CAAC,KAAK,KAAA,EAAE,UAAU,SAAQ;;;;EAMzD;AAED,eAAO,MAAM,SAAS;;;;;;;;;CAOpB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;CAQrB,CAAC;AAEH,aAAK,WAAW,GAAG;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,CAAC;AAE9C,QAAA,MAAM,MAAM;;;CA6BX,CAAA;AAID,eAAe,MAAM,CAAC"}
|
@@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.saveConfig = exports.getConfig = exports.addSettingsField = exports.SAVE_CONFIG_FAILURE = exports.SAVE_CONFIG_SUCCESS = exports.SAVE_CONFIG_REQUEST = exports.GET_CONFIG_FAILURE = exports.GET_CONFIG_SUCCESS = exports.GET_CONFIG_REQUEST = exports.
|
6
|
+
exports.saveConfig = exports.getConfig = exports.addSettingsField = exports.SAVE_CONFIG_FAILURE = exports.SAVE_CONFIG_SUCCESS = exports.SAVE_CONFIG_REQUEST = exports.GET_CONFIG_FAILURE = exports.GET_CONFIG_SUCCESS = exports.GET_CONFIG_REQUEST = exports.SET_CONFIG = exports.UPDATE_THEME = exports.ADD_SITE_PAGE = exports.ADD_SETTINGS_FIELD = void 0;
|
7
7
|
const redux_rest_1 = require("@mukti107/redux-rest");
|
8
8
|
const lodash_1 = require("lodash");
|
9
9
|
const initialState_1 = __importDefault(require("./initialState"));
|
10
10
|
exports.ADD_SETTINGS_FIELD = 'ADD_SETTINGS_FIELD';
|
11
11
|
exports.ADD_SITE_PAGE = 'ADD_SITE_PAGE';
|
12
12
|
exports.UPDATE_THEME = 'UPDATE_SITE_THEME';
|
13
|
-
exports.
|
13
|
+
exports.SET_CONFIG = 'SET_CONFIG';
|
14
14
|
exports.GET_CONFIG_REQUEST = 'GET_CONFIG_REQUEST';
|
15
15
|
exports.GET_CONFIG_SUCCESS = 'GET_CONFIG_SUCCESS';
|
16
16
|
exports.GET_CONFIG_FAILURE = 'GET_CONFIG_FAILURE';
|
@@ -49,8 +49,8 @@ const config = (state = initialState_1.default, action) => {
|
|
49
49
|
case exports.SAVE_CONFIG_SUCCESS:
|
50
50
|
case exports.GET_CONFIG_SUCCESS:
|
51
51
|
return Object.assign(Object.assign({}, state), { data: Object.assign(Object.assign({}, state.data), { [action.configName]: action.response }) });
|
52
|
-
case exports.
|
53
|
-
return Object.assign(Object.assign({}, state), { data: lodash_1.set(lodash_1.cloneDeep(state.data)
|
52
|
+
case exports.SET_CONFIG:
|
53
|
+
return Object.assign(Object.assign({}, state), { data: lodash_1.reduce(action.values, (oldState, value, path) => lodash_1.set(oldState, path, value), lodash_1.cloneDeep(state.data)) });
|
54
54
|
case exports.ADD_SETTINGS_FIELD: {
|
55
55
|
const { fields: { [action.configName]: fields = [] } } = state;
|
56
56
|
return Object.assign(Object.assign({}, state), { fields: Object.assign(Object.assign({}, state.fields), { [action.configName]: [...fields, action.field] }) });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/reducers/config/index.tsx"],"names":[],"mappings":";;;;;;AAAA,qDAAgD;AAChD,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/reducers/config/index.tsx"],"names":[],"mappings":";;;;;;AAAA,qDAAgD;AAChD,mCAAgD;AAChD,kEAAgD;AAEnC,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,aAAa,GAAG,eAAe,CAAC;AAChC,QAAA,YAAY,GAAG,mBAAmB,CAAC;AACnC,QAAA,UAAU,GAAG,YAAY,CAAC;AAE1B,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,Q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C,EAAE,MAAM,CAAC,QAAQ,OAE1C;QACN,KAAK,kBAAU;YACX,uCACO,KAAK,KACR,IAAI,EAAE,eAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,YAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,kBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAC3G;QACN,KAAK,0BAAkB,CAAC,CAAA;YACpB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;YAC/D,uCACO,KAAK,KACR,MAAM,kCACC,KAAK,CAAC,MAAM,KACf,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,MAAM,CAAC,KAAK,CAAE,OAErD;SACL;QACD;YACI,OAAO,KAAK,CAAC;KACpB;AACL,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;AAEtB,kBAAe,MAAM,CAAC"}
|
@@ -34,6 +34,7 @@ export declare const reducers: {
|
|
34
34
|
};
|
35
35
|
routes: (state: any, action: any) => any;
|
36
36
|
modals: (state: any, action: any) => any;
|
37
|
+
notifications: (state: import("./notifications").Notification[], action: any) => any[];
|
37
38
|
files: (state: any, action: any) => any;
|
38
39
|
};
|
39
40
|
export * from './adminMenus';
|
@@ -47,6 +48,7 @@ export * from './fonts';
|
|
47
48
|
export * from './pages';
|
48
49
|
export * from './icons';
|
49
50
|
export * from './modals';
|
51
|
+
export * from './notifications';
|
50
52
|
export * from './routes';
|
51
53
|
export * from './user';
|
52
54
|
export default reducers;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reducers/index.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reducers/index.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,eAAe,KAAyB,CAAC;AACtD,eAAO,MAAM,iBAAiB,KAA2B,CAAC;AAC1D,eAAO,MAAM,qBAAqB,KAAgC,CAAC;AACnE,eAAO,MAAM,eAAe,KAAyB,CAAC;AACtD,eAAO,MAAM,iBAAiB,KAA2B,CAAC;AAC1D,eAAO,MAAM,gBAAgB,KAA2B,CAAC;AAEzD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBpB,CAAC;AAEF,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AAEvB,eAAe,QAAQ,CAAC"}
|
@@ -23,6 +23,7 @@ const user_1 = __importDefault(require("./user"));
|
|
23
23
|
const routes_1 = __importDefault(require("./routes"));
|
24
24
|
const icons_1 = __importDefault(require("./icons"));
|
25
25
|
const modals_1 = __importDefault(require("./modals"));
|
26
|
+
const notifications_1 = __importDefault(require("./notifications"));
|
26
27
|
const files_1 = __importDefault(require("./files"));
|
27
28
|
const fonts_1 = __importDefault(require("./fonts"));
|
28
29
|
const pages_1 = __importDefault(require("./pages"));
|
@@ -54,6 +55,7 @@ exports.reducers = {
|
|
54
55
|
config: config_1.default,
|
55
56
|
routes: routes_1.default,
|
56
57
|
modals: modals_1.default,
|
58
|
+
notifications: notifications_1.default,
|
57
59
|
files: files_1.default,
|
58
60
|
};
|
59
61
|
__exportStar(require("./adminMenus"), exports);
|
@@ -67,6 +69,7 @@ __exportStar(require("./fonts"), exports);
|
|
67
69
|
__exportStar(require("./pages"), exports);
|
68
70
|
__exportStar(require("./icons"), exports);
|
69
71
|
__exportStar(require("./modals"), exports);
|
72
|
+
__exportStar(require("./notifications"), exports);
|
70
73
|
__exportStar(require("./routes"), exports);
|
71
74
|
__exportStar(require("./user"), exports);
|
72
75
|
exports.default = exports.reducers;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reducers/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAkD;AAClD,qDAAuD;AACvD,sDAA8B;AAC9B,8DAAsC;AACtC,wDAAgC;AAChC,kDAA0B;AAC1B,sDAA8B;AAC9B,oDAA4B;AAC5B,sDAA8B;AAC9B,oDAA4B;AAC5B,oDAA4B;AAC5B,oDAA4B;AAC5B,8DAAsC;AACtC,8DAAsC;AACtC,8DAAsC;AAEtC,MAAM,cAAc,GAAG,8BAAiB,CAAC;AAE5B,QAAA,eAAe,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AACzC,QAAA,iBAAiB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC7C,QAAA,qBAAqB,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AACtD,QAAA,eAAe,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AACzC,QAAA,iBAAiB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC7C,QAAA,gBAAgB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AAE5C,QAAA,QAAQ,GAAG;IACpB,KAAK,EAAL,eAAK;IACL,KAAK,EAAE,uBAAe,CAAC,OAAO;IAC9B,OAAO,EAAE,yBAAiB,CAAC,OAAO;IAClC,OAAO,EAAE,wBAAgB,CAAC,OAAO;IACjC,OAAO,EAAE,yBAAiB,CAAC,OAAO;IAClC,UAAU,EAAV,oBAAU;IACV,IAAI,EAAE,oBAAW;IACjB,IAAI,EAAJ,cAAI;IACJ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AAK;IACL,KAAK,EAAE,uBAAe,CAAC,OAAO;IAC9B,OAAO,EAAE,yBAAiB,CAAC,OAAO;IAClC,OAAO,EAAE,wBAAgB,CAAC,OAAO;IACjC,OAAO,EAAE,yBAAiB,CAAC,OAAO;IAClC,UAAU,EAAV,oBAAU;IACV,IAAI,EAAE,oBAAW;IACjB,IAAI,EAAJ,cAAI;IACJ,OAAO,EAAP,iBAAO;IACP,UAAU,EAAV,oBAAU;IACV,UAAU,EAAV,oBAAU;IACV,UAAU,EAAV,oBAAU;IACV,KAAK,EAAL,eAAK;IACL,KAAK,EAAL,eAAK;IACL,MAAM,EAAN,gBAAM;IACN,MAAM,EAAN,gBAAM;IACN,MAAM,EAAN,gBAAM;IACN,aAAa,EAAb,uBAAa;IACb,KAAK,EAAL,eAAK;CACR,CAAC;AAEF,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B;AAC7B,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,kDAAgC;AAChC,2CAAyB;AACzB,yCAAuB;AAEvB,kBAAe,gBAAQ,CAAC"}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
export declare const SHOW_NOTIFICATION = "notification/show";
|
2
|
+
export declare const REMOVE_NOTIFICATION = "notification/remove";
|
3
|
+
export interface Notification {
|
4
|
+
/**
|
5
|
+
* @description notification id
|
6
|
+
*/
|
7
|
+
id?: string;
|
8
|
+
/**
|
9
|
+
* @description notification title
|
10
|
+
*/
|
11
|
+
title: string;
|
12
|
+
/**
|
13
|
+
* @description notification message
|
14
|
+
*/
|
15
|
+
message?: string;
|
16
|
+
type?: 'info' | 'success' | 'error' | 'warning';
|
17
|
+
/**
|
18
|
+
* @description icon for notification
|
19
|
+
*/
|
20
|
+
icon?: string;
|
21
|
+
/**
|
22
|
+
* @description where should the notification be displayed
|
23
|
+
*/
|
24
|
+
position: 'top' | 'top-right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'top-left';
|
25
|
+
/**
|
26
|
+
* Action buttons for notification
|
27
|
+
*/
|
28
|
+
buttons?: Array<{
|
29
|
+
title: string;
|
30
|
+
action: any;
|
31
|
+
}>;
|
32
|
+
/**
|
33
|
+
* @description for how long should the notification be displayed (in millisseconds)
|
34
|
+
* @default 5000
|
35
|
+
*/
|
36
|
+
timeout: number;
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* @description show in-app notification to user
|
40
|
+
* @param notification notification tp be displayed
|
41
|
+
* @returns redux action to show notification
|
42
|
+
*/
|
43
|
+
export declare const showNotification: (notification: Notification) => {
|
44
|
+
type: string;
|
45
|
+
notification: {
|
46
|
+
id: string;
|
47
|
+
timeout: number;
|
48
|
+
type: string;
|
49
|
+
position: string;
|
50
|
+
} & Notification;
|
51
|
+
};
|
52
|
+
export declare const removeNotification: (id: any) => {
|
53
|
+
type: string;
|
54
|
+
id: any;
|
55
|
+
};
|
56
|
+
declare const _default: (state: Array<Notification>, action: any) => any[];
|
57
|
+
export default _default;
|
58
|
+
//# sourceMappingURL=notifications.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/reducers/notifications.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAC,SAAS,GAAC,OAAO,GAAC,SAAS,CAAC;IAC1C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,KAAK,GAAC,WAAW,GAAC,cAAc,GAAC,QAAQ,GAAC,aAAa,GAAC,UAAU,CAAC;IAC7E;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,GAAG,CAAC;KACf,CAAC,CAAA;IACF;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,iBAAkB,YAAY;;;;;;;;CAGzD,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;CAG7B,CAAC;gCAIoB,MAAM,YAAY,CAAC;AAA1C,wBAgBC"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.removeNotification = exports.showNotification = exports.REMOVE_NOTIFICATION = exports.SHOW_NOTIFICATION = void 0;
|
4
|
+
const lodash_1 = require("lodash");
|
5
|
+
exports.SHOW_NOTIFICATION = 'notification/show';
|
6
|
+
exports.REMOVE_NOTIFICATION = 'notification/remove';
|
7
|
+
/**
|
8
|
+
* @description show in-app notification to user
|
9
|
+
* @param notification notification tp be displayed
|
10
|
+
* @returns redux action to show notification
|
11
|
+
*/
|
12
|
+
const showNotification = (notification) => ({
|
13
|
+
type: exports.SHOW_NOTIFICATION,
|
14
|
+
notification: lodash_1.defaults(notification, { id: lodash_1.random(Number.MAX_SAFE_INTEGER).toString(36), timeout: 5000, type: 'info', position: 'bottom-right' }),
|
15
|
+
});
|
16
|
+
exports.showNotification = showNotification;
|
17
|
+
const removeNotification = (id) => ({
|
18
|
+
type: exports.REMOVE_NOTIFICATION,
|
19
|
+
id,
|
20
|
+
});
|
21
|
+
exports.removeNotification = removeNotification;
|
22
|
+
let initialState = [];
|
23
|
+
exports.default = (state = initialState, action) => {
|
24
|
+
switch (action.type) {
|
25
|
+
case exports.SHOW_NOTIFICATION:
|
26
|
+
const notification = action.notification;
|
27
|
+
if (lodash_1.some(state, { id: notification.id })) {
|
28
|
+
// replace notification if notification with same id already exists
|
29
|
+
return state.map(_notification => notification.id === _notification.id ? notification : _notification);
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
// append notification to state
|
33
|
+
return [...state, action.notification,];
|
34
|
+
}
|
35
|
+
case exports.REMOVE_NOTIFICATION:
|
36
|
+
return state.filter(m => m.id !== action.id);
|
37
|
+
default:
|
38
|
+
return state;
|
39
|
+
}
|
40
|
+
};
|
41
|
+
//# sourceMappingURL=notifications.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../src/reducers/notifications.tsx"],"names":[],"mappings":";;;AAAA,mCAAgE;AAEnD,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AACxC,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAsCzD;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,YAA0B,EAAC,EAAE,CAAA,CAAC;IAC3D,IAAI,EAAE,yBAAiB;IACvB,YAAY,EAAE,iBAAQ,CAAC,YAAY,EAAE,EAAC,EAAE,EAAE,eAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;CACnJ,CAAC,CAAC;AAHU,QAAA,gBAAgB,oBAG1B;AAEI,MAAM,kBAAkB,GAAG,CAAC,EAAE,EAAC,EAAE,CAAA,CAAC;IACrC,IAAI,EAAE,2BAAmB;IACzB,EAAE;CACL,CAAC,CAAC;AAHU,QAAA,kBAAkB,sBAG5B;AAEH,IAAI,YAAY,GAAuB,EAAE,CAAC;AAE1C,kBAAe,CAAC,QAA6B,YAAY,EAAE,MAAM,EAAC,EAAE;IAChE,QAAQ,MAAM,CAAC,IAAI,EAAE;QACjB,KAAK,yBAAiB;YAClB,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;YACzC,IAAG,aAAI,C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