@3sc/common-component 0.0.1

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.
Files changed (90) hide show
  1. package/README.md +20 -0
  2. package/dist/App.js +17 -0
  3. package/dist/App.test.js +10 -0
  4. package/dist/components/alert/index.js +104 -0
  5. package/dist/components/alert/style.scss +22 -0
  6. package/dist/components/bell.js +44 -0
  7. package/dist/components/index.js +13 -0
  8. package/dist/components/my-dialog.js +80 -0
  9. package/dist/config/axios.js +40 -0
  10. package/dist/config/mui-provider.js +18 -0
  11. package/dist/config/my-context.js +54 -0
  12. package/dist/config/theme.js +18 -0
  13. package/dist/helper/common-fun.js +12 -0
  14. package/dist/index.css +13 -0
  15. package/dist/index.js +15 -0
  16. package/dist/modules/index.js +12 -0
  17. package/dist/modules/notification.js +23 -0
  18. package/dist/reportWebVitals.js +30 -0
  19. package/dist/sass/_base.scss +271 -0
  20. package/dist/sass/_colors.scss +2 -0
  21. package/dist/sass/_typography.scss +1 -0
  22. package/dist/sass/fonts/montserrat-v25-latin-300.eot +0 -0
  23. package/dist/sass/fonts/montserrat-v25-latin-300.svg +326 -0
  24. package/dist/sass/fonts/montserrat-v25-latin-300.ttf +0 -0
  25. package/dist/sass/fonts/montserrat-v25-latin-300.woff +0 -0
  26. package/dist/sass/fonts/montserrat-v25-latin-300.woff2 +0 -0
  27. package/dist/sass/fonts/montserrat-v25-latin-500.eot +0 -0
  28. package/dist/sass/fonts/montserrat-v25-latin-500.svg +328 -0
  29. package/dist/sass/fonts/montserrat-v25-latin-500.ttf +0 -0
  30. package/dist/sass/fonts/montserrat-v25-latin-500.woff +0 -0
  31. package/dist/sass/fonts/montserrat-v25-latin-500.woff2 +0 -0
  32. package/dist/sass/fonts/montserrat-v25-latin-600.eot +0 -0
  33. package/dist/sass/fonts/montserrat-v25-latin-600.svg +329 -0
  34. package/dist/sass/fonts/montserrat-v25-latin-600.ttf +0 -0
  35. package/dist/sass/fonts/montserrat-v25-latin-600.woff +0 -0
  36. package/dist/sass/fonts/montserrat-v25-latin-600.woff2 +0 -0
  37. package/dist/sass/fonts/montserrat-v25-latin-700.eot +0 -0
  38. package/dist/sass/fonts/montserrat-v25-latin-700.svg +329 -0
  39. package/dist/sass/fonts/montserrat-v25-latin-700.ttf +0 -0
  40. package/dist/sass/fonts/montserrat-v25-latin-700.woff +0 -0
  41. package/dist/sass/fonts/montserrat-v25-latin-700.woff2 +0 -0
  42. package/dist/sass/fonts/montserrat-v25-latin-800.eot +0 -0
  43. package/dist/sass/fonts/montserrat-v25-latin-800.svg +329 -0
  44. package/dist/sass/fonts/montserrat-v25-latin-800.ttf +0 -0
  45. package/dist/sass/fonts/montserrat-v25-latin-800.woff +0 -0
  46. package/dist/sass/fonts/montserrat-v25-latin-800.woff2 +0 -0
  47. package/dist/sass/fonts/montserrat-v25-latin-regular.eot +0 -0
  48. package/dist/sass/fonts/montserrat-v25-latin-regular.svg +327 -0
  49. package/dist/sass/fonts/montserrat-v25-latin-regular.ttf +0 -0
  50. package/dist/sass/fonts/montserrat-v25-latin-regular.woff +0 -0
  51. package/dist/sass/fonts/montserrat-v25-latin-regular.woff2 +0 -0
  52. package/dist/sass/fonts/poppins-v20-latin-300.eot +0 -0
  53. package/dist/sass/fonts/poppins-v20-latin-300.svg +321 -0
  54. package/dist/sass/fonts/poppins-v20-latin-300.ttf +0 -0
  55. package/dist/sass/fonts/poppins-v20-latin-300.woff +0 -0
  56. package/dist/sass/fonts/poppins-v20-latin-300.woff2 +0 -0
  57. package/dist/sass/fonts/poppins-v20-latin-500.eot +0 -0
  58. package/dist/sass/fonts/poppins-v20-latin-500.svg +323 -0
  59. package/dist/sass/fonts/poppins-v20-latin-500.ttf +0 -0
  60. package/dist/sass/fonts/poppins-v20-latin-500.woff +0 -0
  61. package/dist/sass/fonts/poppins-v20-latin-500.woff2 +0 -0
  62. package/dist/sass/fonts/poppins-v20-latin-600.eot +0 -0
  63. package/dist/sass/fonts/poppins-v20-latin-600.svg +322 -0
  64. package/dist/sass/fonts/poppins-v20-latin-600.ttf +0 -0
  65. package/dist/sass/fonts/poppins-v20-latin-600.woff +0 -0
  66. package/dist/sass/fonts/poppins-v20-latin-600.woff2 +0 -0
  67. package/dist/sass/fonts/poppins-v20-latin-700.eot +0 -0
  68. package/dist/sass/fonts/poppins-v20-latin-700.svg +322 -0
  69. package/dist/sass/fonts/poppins-v20-latin-700.ttf +0 -0
  70. package/dist/sass/fonts/poppins-v20-latin-700.woff +0 -0
  71. package/dist/sass/fonts/poppins-v20-latin-700.woff2 +0 -0
  72. package/dist/sass/fonts/poppins-v20-latin-800.eot +0 -0
  73. package/dist/sass/fonts/poppins-v20-latin-800.svg +320 -0
  74. package/dist/sass/fonts/poppins-v20-latin-800.ttf +0 -0
  75. package/dist/sass/fonts/poppins-v20-latin-800.woff +0 -0
  76. package/dist/sass/fonts/poppins-v20-latin-800.woff2 +0 -0
  77. package/dist/sass/fonts/poppins-v20-latin-regular.eot +0 -0
  78. package/dist/sass/fonts/poppins-v20-latin-regular.svg +323 -0
  79. package/dist/sass/fonts/poppins-v20-latin-regular.ttf +0 -0
  80. package/dist/sass/fonts/poppins-v20-latin-regular.woff +0 -0
  81. package/dist/sass/fonts/poppins-v20-latin-regular.woff2 +0 -0
  82. package/dist/sass/main.scss +3 -0
  83. package/dist/services/notification.js +33 -0
  84. package/dist/setupTests.js +3 -0
  85. package/dist/utils/Constant.js +15 -0
  86. package/dist/utils/EndPoint.js +10 -0
  87. package/dist/utils/Env.js +14 -0
  88. package/dist/utils/LocalStorage.js +12 -0
  89. package/dist/utils/StatusCode.js +16 -0
  90. package/package.json +60 -0
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # Introduction
2
+ TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
3
+
4
+ # Getting Started
5
+ TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
6
+ 1. Installation process
7
+ 2. Software dependencies
8
+ 3. Latest releases
9
+ 4. API references
10
+
11
+ # Build and Test
12
+ TODO: Describe and show how to build your code and run the tests.
13
+
14
+ # Contribute
15
+ TODO: Explain how other users and developers can contribute to make your code better.
16
+
17
+ If you want to learn more about creating good readme files then refer the following [guidelines](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops). You can also seek inspiration from the below readme files:
18
+ - [ASP.NET Core](https://github.com/aspnet/Home)
19
+ - [Visual Studio Code](https://github.com/Microsoft/vscode)
20
+ - [Chakra Core](https://github.com/Microsoft/ChakraCore)
package/dist/App.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _modules = require("./modules");
8
+ function App() {
9
+ return /*#__PURE__*/React.createElement("div", {
10
+ className: "App"
11
+ }, "hello", /*#__PURE__*/React.createElement(_modules.Notification, {
12
+ tenantId: "e9cbadf0-a2c3-4f0b-b358-e9368ccd093c",
13
+ buId: "1b97f147-5c15-4bd4-9d5d-8a63129caf3d",
14
+ snopId: "dee67439-9306-408a-b79c-99c4265dc5a3"
15
+ }));
16
+ }
17
+ var _default = exports.default = App;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ var _react = require("@testing-library/react");
4
+ var _App = _interopRequireDefault(require("./App"));
5
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+ test('renders learn react link', () => {
7
+ (0, _react.render)( /*#__PURE__*/React.createElement(_App.default, null));
8
+ const linkElement = _react.screen.getByText(/learn react/i);
9
+ expect(linkElement).toBeInTheDocument();
10
+ });
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("core-js/modules/web.dom-collections.iterator.js");
8
+ require("core-js/modules/es.promise.js");
9
+ var _material = require("@mui/material");
10
+ var _bell = _interopRequireDefault(require("../bell"));
11
+ var _myDialog = _interopRequireDefault(require("../my-dialog"));
12
+ var _react = require("react");
13
+ require("./style.scss");
14
+ var _myContext = require("../../config/my-context");
15
+ var _notification = require("../../services/notification");
16
+ var _StatusCode = _interopRequireDefault(require("../../utils/StatusCode"));
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ const Alert = _ref => {
19
+ let {
20
+ tenantId,
21
+ buId,
22
+ snopId
23
+ } = _ref;
24
+ const dispatch = (0, _react.useContext)(_myContext.TasksDispatchContext);
25
+ const {
26
+ loading,
27
+ data,
28
+ isMarkAllAsRead
29
+ } = (0, _react.useContext)(_myContext.TasksContext);
30
+ const [open, setOpen] = (0, _react.useState)(false);
31
+ const fetchNotification = (0, _react.useCallback)(async () => {
32
+ dispatch({
33
+ type: "loading",
34
+ loading: true
35
+ });
36
+ dispatch({
37
+ type: "success",
38
+ data: []
39
+ });
40
+ try {
41
+ const res = await (0, _notification.getNotification)({
42
+ tenantId,
43
+ buId,
44
+ snopId
45
+ });
46
+ if (res.status === _StatusCode.default.OK) {
47
+ var _res$data;
48
+ dispatch({
49
+ type: "success",
50
+ data: ((_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.responseData) === null || _res$data === void 0 ? void 0 : _res$data.response) || []
51
+ });
52
+ }
53
+ } catch (err) {
54
+ dispatch({
55
+ type: "error",
56
+ error: "Something went wrong!"
57
+ });
58
+ } finally {
59
+ dispatch({
60
+ type: "loading",
61
+ loading: false
62
+ });
63
+ }
64
+ }, [tenantId, buId, snopId, dispatch]);
65
+ (0, _react.useEffect)(() => {
66
+ fetchNotification();
67
+ }, [fetchNotification]);
68
+ const handleOpen = () => {
69
+ setOpen(!open);
70
+ };
71
+ const handleClose = () => setOpen(!open);
72
+ const handleRefresh = () => {
73
+ fetchNotification();
74
+ };
75
+ const handleShowAll = () => {};
76
+ const handleMarkAllAsRead = () => {};
77
+ console.log("loading", loading, data);
78
+ return /*#__PURE__*/React.createElement(_material.Box, null, /*#__PURE__*/React.createElement(_material.Box, {
79
+ sx: {
80
+ display: "flex",
81
+ justifyContent: "center"
82
+ }
83
+ }, /*#__PURE__*/React.createElement(_bell.default, {
84
+ count: (data === null || data === void 0 ? void 0 : data.length) || 0,
85
+ handleClick: handleOpen
86
+ })), /*#__PURE__*/React.createElement(_myDialog.default, {
87
+ title: "Alerts",
88
+ open: open,
89
+ loading: loading || false,
90
+ isMarkAllAsRead: isMarkAllAsRead || false,
91
+ onClose: handleClose,
92
+ onRefresh: handleRefresh,
93
+ handleShowAll: handleShowAll,
94
+ handleMarkAllAsRead: handleMarkAllAsRead
95
+ }, /*#__PURE__*/React.createElement(_material.Box, {
96
+ sx: {
97
+ display: "flex",
98
+ justifyContent: "center",
99
+ alignItems: "center",
100
+ height: 320
101
+ }
102
+ }, loading ? /*#__PURE__*/React.createElement(_material.CircularProgress, null) : /*#__PURE__*/React.createElement(_material.Box, null, "Alert"))));
103
+ };
104
+ var _default = exports.default = Alert;
@@ -0,0 +1,22 @@
1
+ @import "../../sass/main.scss";
2
+ .notification-dialog {
3
+ .title {
4
+ color: $secondary-color;
5
+ font-family: Montserrat, sans-serif;
6
+ font-size: 1.2rem;
7
+ font-weight: 600;
8
+ }
9
+
10
+ .dialog-action {
11
+ display: flex;
12
+ align-items: center;
13
+ justify-content: space-between;
14
+
15
+ .view-all {
16
+ color: #1d1d1b;
17
+ font-family: Montserrat, sans-serif;
18
+ font-weight: 500;
19
+ text-transform: initial;
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol.description.js");
4
+ require("core-js/modules/es.object.assign.js");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _NotificationsOutlined = _interopRequireDefault(require("@mui/icons-material/NotificationsOutlined"));
10
+ var _material = require("@mui/material");
11
+ var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
12
+ const _excluded = ["count", "handleClick"];
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
19
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
21
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
22
+ const Bell = _ref => {
23
+ let {
24
+ count,
25
+ handleClick
26
+ } = _ref,
27
+ otherProps = _objectWithoutProperties(_ref, _excluded);
28
+ return /*#__PURE__*/React.createElement(_material.IconButton, {
29
+ onClick: handleClick
30
+ }, /*#__PURE__*/React.createElement(_Badge.default, _extends({}, otherProps, {
31
+ badgeContent: count,
32
+ overlap: "circular",
33
+ color: "primary"
34
+ }), /*#__PURE__*/React.createElement(_NotificationsOutlined.default, {
35
+ sx: _objectSpread({
36
+ fontSize: "3.5rem"
37
+ }, count > 0 ? {
38
+ color: "primary.main"
39
+ } : {
40
+ color: "secondary.main"
41
+ })
42
+ })));
43
+ };
44
+ var _default = exports.default = Bell;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Notification", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _notification.default;
10
+ }
11
+ });
12
+ var _notification = _interopRequireDefault(require("../modules/notification"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.assign.js");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _material = require("@mui/material");
9
+ var _styles = require("@mui/material/styles");
10
+ var _Refresh = _interopRequireDefault(require("@mui/icons-material/Refresh"));
11
+ var _colors = require("@mui/material/colors");
12
+ const _excluded = ["title", "children", "onRefresh", "loading", "handleShowAll", "handleMarkAllAsRead", "isMarkAllAsRead"];
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
+ const CustomizeDialog = (0, _styles.styled)(_material.Dialog)(_ref => {
18
+ let {
19
+ theme
20
+ } = _ref;
21
+ return {
22
+ "& .MuiPaper-root": {
23
+ width: 350,
24
+ borderRadius: 8,
25
+ border: "1px solid ".concat(_colors.grey[50]),
26
+ boxShadow: theme.shadows[5]
27
+ },
28
+ "& .MuiDialogContent-root": {
29
+ padding: theme.spacing(1)
30
+ },
31
+ "& .MuiDialogActions-root": {
32
+ padding: "".concat(theme.spacing(0.2), " ").concat(theme.spacing(0.5), "}")
33
+ }
34
+ };
35
+ });
36
+ const MyDialog = _ref2 => {
37
+ let {
38
+ title,
39
+ children,
40
+ onRefresh,
41
+ loading,
42
+ handleShowAll,
43
+ handleMarkAllAsRead,
44
+ isMarkAllAsRead
45
+ } = _ref2,
46
+ otherProps = _objectWithoutProperties(_ref2, _excluded);
47
+ return /*#__PURE__*/React.createElement(CustomizeDialog, _extends({}, otherProps, {
48
+ className: "notification-dialog"
49
+ }), /*#__PURE__*/React.createElement(_material.DialogTitle, {
50
+ sx: {
51
+ p: 1
52
+ }
53
+ }, /*#__PURE__*/React.createElement(_material.Box, null, /*#__PURE__*/React.createElement(_material.Typography, {
54
+ variant: "h6",
55
+ className: "title"
56
+ }, title), /*#__PURE__*/React.createElement(_material.IconButton, {
57
+ disabled: loading,
58
+ "aria-label": "close",
59
+ sx: {
60
+ position: "absolute",
61
+ right: 8,
62
+ top: 8,
63
+ color: "primary.main"
64
+ },
65
+ onClick: onRefresh
66
+ }, /*#__PURE__*/React.createElement(_Refresh.default, {
67
+ fontSize: "small"
68
+ })))), /*#__PURE__*/React.createElement(_material.DialogContent, {
69
+ dividers: true
70
+ }, children), /*#__PURE__*/React.createElement(_material.DialogActions, {
71
+ className: "dialog-action"
72
+ }, /*#__PURE__*/React.createElement(_material.Button, {
73
+ onClick: handleShowAll,
74
+ className: "view-all"
75
+ }, "Show all"), isMarkAllAsRead && /*#__PURE__*/React.createElement(_material.Button, {
76
+ className: "view-all",
77
+ onClick: handleMarkAllAsRead
78
+ }, "Mark all as read")));
79
+ };
80
+ var _default = exports.default = MyDialog;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("core-js/modules/es.promise.js");
8
+ var _axios = _interopRequireDefault(require("axios"));
9
+ var _Env = _interopRequireDefault(require("../utils/Env"));
10
+ var _LocalStorage = _interopRequireDefault(require("../utils/LocalStorage"));
11
+ var _Constant = require("../utils/Constant");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ const instanceAxios = _axios.default.create({
14
+ baseURL: _Env.default.BASE_URL,
15
+ headers: {
16
+ "Content-Type": "application/json",
17
+ Authorization: "".concat(_Constant.OTHER_CONSTANT.BEARER, " ").concat(_LocalStorage.default.TOKEN)
18
+ }
19
+ });
20
+
21
+ // Add a request interceptor
22
+ instanceAxios.interceptors.request.use(function (config) {
23
+ // Do something before request is sent
24
+ return config;
25
+ }, function (error) {
26
+ // Do something with request error
27
+ return Promise.reject(error);
28
+ });
29
+
30
+ // Add a response interceptor
31
+ instanceAxios.interceptors.response.use(function (response) {
32
+ // Any status code that lie within the range of 2xx cause this function to trigger
33
+ // Do something with response data
34
+ return response;
35
+ }, function (error) {
36
+ // Any status codes that falls outside the range of 2xx cause this function to trigger
37
+ // Do something with response error
38
+ return Promise.reject(error);
39
+ });
40
+ var _default = exports.default = instanceAxios;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _material = require("@mui/material");
8
+ var _theme = _interopRequireDefault(require("./theme"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function MuiProvider(_ref) {
11
+ let {
12
+ children
13
+ } = _ref;
14
+ return /*#__PURE__*/React.createElement(_material.ThemeProvider, {
15
+ theme: _theme.default
16
+ }, children);
17
+ }
18
+ var _default = exports.default = MuiProvider;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol.description.js");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.TasksDispatchContext = exports.TasksContext = void 0;
8
+ require("core-js/modules/web.dom-collections.iterator.js");
9
+ var _react = require("react");
10
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
14
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ const TasksContext = exports.TasksContext = /*#__PURE__*/(0, _react.createContext)(null);
16
+ const TasksDispatchContext = exports.TasksDispatchContext = /*#__PURE__*/(0, _react.createContext)(null);
17
+ function MyContext(_ref) {
18
+ let {
19
+ children
20
+ } = _ref;
21
+ const [tasks, dispatch] = (0, _react.useReducer)(tasksReducer, initialTasks);
22
+ return /*#__PURE__*/React.createElement(TasksContext.Provider, {
23
+ value: tasks
24
+ }, /*#__PURE__*/React.createElement(TasksDispatchContext.Provider, {
25
+ value: dispatch
26
+ }, children));
27
+ }
28
+ var _default = exports.default = MyContext;
29
+ function tasksReducer(tasks, action) {
30
+ switch (action.type) {
31
+ case "loading":
32
+ return _objectSpread(_objectSpread({}, tasks), {}, {
33
+ loading: action.loading
34
+ });
35
+ case "success":
36
+ {
37
+ return _objectSpread(_objectSpread({}, tasks), {}, {
38
+ data: action.data
39
+ });
40
+ }
41
+ case "error":
42
+ return _objectSpread(_objectSpread({}, tasks), {}, {
43
+ error: action.error
44
+ });
45
+ default:
46
+ throw new Error("Unhandled action type: ".concat(action));
47
+ }
48
+ }
49
+ const initialTasks = {
50
+ loading: false,
51
+ data: [],
52
+ error: "",
53
+ isMarkAllAsRead: true
54
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _material = require("@mui/material");
8
+ const theme = (0, _material.createTheme)({
9
+ palette: {
10
+ primary: {
11
+ main: "#E94F1C"
12
+ },
13
+ secondary: {
14
+ main: "#1D1D1B"
15
+ }
16
+ }
17
+ });
18
+ var _default = exports.default = theme;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getLocalStorage = void 0;
7
+ const getLocalStorage = key => {
8
+ let data = localStorage.getItem(key);
9
+ if (!data) return null;
10
+ return JSON.parse(localStorage.getItem(data));
11
+ };
12
+ exports.getLocalStorage = getLocalStorage;
package/dist/index.css ADDED
@@ -0,0 +1,13 @@
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ }
9
+
10
+ code {
11
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
+ monospace;
13
+ }
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ var _react = _interopRequireDefault(require("react"));
4
+ var _client = _interopRequireDefault(require("react-dom/client"));
5
+ require("./index.css");
6
+ var _App = _interopRequireDefault(require("./App"));
7
+ var _reportWebVitals = _interopRequireDefault(require("./reportWebVitals"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const root = _client.default.createRoot(document.getElementById('root'));
10
+ root.render( /*#__PURE__*/_react.default.createElement(_react.default.StrictMode, null, /*#__PURE__*/_react.default.createElement(_App.default, null)));
11
+
12
+ // If you want to start measuring performance in your app, pass a function
13
+ // to log results (for example: reportWebVitals(console.log))
14
+ // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
15
+ (0, _reportWebVitals.default)();
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Notification", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _notification.Notification;
10
+ }
11
+ });
12
+ var _notification = require("./notification");
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Notification = void 0;
7
+ var _alert = _interopRequireDefault(require("../components/alert"));
8
+ var _muiProvider = _interopRequireDefault(require("../config/mui-provider"));
9
+ var _myContext = _interopRequireDefault(require("../config/my-context"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ const Notification = _ref => {
12
+ let {
13
+ tenantId,
14
+ buId,
15
+ snopId
16
+ } = _ref;
17
+ return /*#__PURE__*/React.createElement(_muiProvider.default, null, /*#__PURE__*/React.createElement(_myContext.default, null, /*#__PURE__*/React.createElement(_alert.default, {
18
+ tenantId: tenantId,
19
+ buId: buId,
20
+ snopId: snopId
21
+ })));
22
+ };
23
+ exports.Notification = Notification;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("core-js/modules/es.promise.js");
8
+ require("core-js/modules/es.weak-map.js");
9
+ require("core-js/modules/web.dom-collections.iterator.js");
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ const reportWebVitals = onPerfEntry => {
13
+ if (onPerfEntry && onPerfEntry instanceof Function) {
14
+ Promise.resolve().then(() => _interopRequireWildcard(require('web-vitals'))).then(_ref => {
15
+ let {
16
+ getCLS,
17
+ getFID,
18
+ getFCP,
19
+ getLCP,
20
+ getTTFB
21
+ } = _ref;
22
+ getCLS(onPerfEntry);
23
+ getFID(onPerfEntry);
24
+ getFCP(onPerfEntry);
25
+ getLCP(onPerfEntry);
26
+ getTTFB(onPerfEntry);
27
+ });
28
+ }
29
+ };
30
+ var _default = exports.default = reportWebVitals;