@3sc/common-component 0.0.5 → 0.0.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/App.js CHANGED
@@ -10,7 +10,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
10
10
  function App() {
11
11
  return /*#__PURE__*/_react.default.createElement("div", {
12
12
  className: "App"
13
- }, "hello", /*#__PURE__*/_react.default.createElement(_modules.Notification, null));
13
+ }, "hello", /*#__PURE__*/_react.default.createElement(_modules.Notification, {
14
+ baseURL: "https://scai-qa-api.3sc.ai"
15
+ }));
14
16
  }
15
17
  var _default = exports.default = App; // tenantId="9a33965c-162a-4089-8cb1-5e631e3cdd8a"
16
18
  // buId="d628f9a3-1968-4102-b578-727616b382f3"
@@ -33,7 +33,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
33
33
  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; }
34
34
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
35
35
  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); }
36
- const Alert = () => {
36
+ const Alert = _ref => {
37
+ let {
38
+ baseURL
39
+ } = _ref;
37
40
  const dispatch = (0, _react.useContext)(_myContext.TasksDispatchContext);
38
41
  const {
39
42
  loading,
@@ -62,7 +65,7 @@ const Alert = () => {
62
65
  }
63
66
  });
64
67
  try {
65
- const res = await (0, _notification.getNotification)();
68
+ const res = await (0, _notification.getNotification)(baseURL);
66
69
  if (res.status === _StatusCode.default.OK) {
67
70
  var _res$data, _res$data2;
68
71
  dispatch({
@@ -119,7 +122,7 @@ const Alert = () => {
119
122
  loading: true
120
123
  });
121
124
  try {
122
- const res = await (0, _notification.putNotification)(id);
125
+ const res = await (0, _notification.putNotification)(baseURL, id);
123
126
  if (res.status === _StatusCode.default.OK) {
124
127
  let count = 0;
125
128
  const newData = data.map(item => {
@@ -164,7 +167,7 @@ const Alert = () => {
164
167
  loading: true
165
168
  });
166
169
  try {
167
- const res = await (0, _notification.putNotification)(payload);
170
+ const res = await (0, _notification.putNotification)(baseURL, payload);
168
171
  if (res.status === _StatusCode.default.OK) {
169
172
  const newData = data.map(item => {
170
173
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -1,40 +1,41 @@
1
- "use strict";
1
+ // import axios from "axios";
2
+ // import Env from "../utils/Env";
3
+ // import LOCAL_STORAGE from "../utils/LocalStorage";
4
+ // import { OTHER_CONSTANT } from "../utils/Constant";
2
5
 
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
- });
6
+ // const instanceAxios = axios.create({
7
+ // baseURL: Env.BASE_URL,
8
+ // headers: {
9
+ // "Content-Type": "application/json",
10
+ // Authorization: `${OTHER_CONSTANT.BEARER} ${LOCAL_STORAGE.TOKEN}`,
11
+ // },
12
+ // });
20
13
 
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
- });
14
+ // // Add a request interceptor
15
+ // instanceAxios.interceptors.request.use(
16
+ // function (config) {
17
+ // // Do something before request is sent
18
+ // return config;
19
+ // },
20
+ // function (error) {
21
+ // // Do something with request error
22
+ // return Promise.reject(error);
23
+ // }
24
+ // );
29
25
 
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;
26
+ // // Add a response interceptor
27
+ // instanceAxios.interceptors.response.use(
28
+ // function (response) {
29
+ // // Any status code that lie within the range of 2xx cause this function to trigger
30
+ // // Do something with response data
31
+ // return response;
32
+ // },
33
+ // function (error) {
34
+ // // Any status codes that falls outside the range of 2xx cause this function to trigger
35
+ // // Do something with response error
36
+ // return Promise.reject(error);
37
+ // }
38
+ // );
39
+
40
+ // export default instanceAxios;
41
+ "use strict";
@@ -9,7 +9,12 @@ var _alert = _interopRequireDefault(require("../components/alert"));
9
9
  var _muiProvider = _interopRequireDefault(require("../config/mui-provider"));
10
10
  var _myContext = _interopRequireDefault(require("../config/my-context"));
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- const Notification = () => {
13
- return /*#__PURE__*/_react.default.createElement(_muiProvider.default, null, /*#__PURE__*/_react.default.createElement(_myContext.default, null, /*#__PURE__*/_react.default.createElement(_alert.default, null)));
12
+ const Notification = _ref => {
13
+ let {
14
+ baseURL
15
+ } = _ref;
16
+ return /*#__PURE__*/_react.default.createElement(_muiProvider.default, null, /*#__PURE__*/_react.default.createElement(_myContext.default, null, /*#__PURE__*/_react.default.createElement(_alert.default, {
17
+ baseURL: baseURL
18
+ })));
14
19
  };
15
20
  exports.Notification = Notification;
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.putNotification = exports.getNotification = void 0;
7
7
  require("core-js/modules/es.promise.js");
8
- var _axios = _interopRequireDefault(require("../config/axios"));
9
8
  var _Constant = require("../utils/Constant");
10
9
  var _EndPoint = _interopRequireDefault(require("../utils/EndPoint"));
11
10
  var _Env = _interopRequireDefault(require("../utils/Env"));
12
11
  var _LocalStorage = _interopRequireDefault(require("../utils/LocalStorage"));
12
+ var _axios = _interopRequireDefault(require("axios"));
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ // import instanceAxios from "../config/axios";
15
+
14
16
  const {
15
17
  TENANT_ID,
16
18
  BU_ID,
@@ -21,9 +23,9 @@ const {
21
23
  BU_IDS,
22
24
  SNOP_IDS
23
25
  } = _LocalStorage.default;
24
- const getNotification = async () => {
26
+ const getNotification = async baseURL => {
25
27
  try {
26
- const url = "".concat(_EndPoint.default.NOTIFICATION).concat(_Env.default.VERSION, "?").concat(TENANT_ID, "=").concat(TENANT_IDS, "&").concat(BU_ID, "=").concat(BU_IDS, "&").concat(SNOP_ID, "=").concat(SNOP_IDS);
28
+ const url = "".concat(baseURL).concat(_EndPoint.default.NOTIFICATION).concat(_Env.default.VERSION, "?").concat(TENANT_ID, "=").concat(TENANT_IDS, "&").concat(BU_ID, "=").concat(BU_IDS, "&").concat(SNOP_ID, "=").concat(SNOP_IDS);
27
29
  const response = await _axios.default.get(url);
28
30
  return response;
29
31
  } catch (e) {
@@ -32,9 +34,9 @@ const getNotification = async () => {
32
34
  }
33
35
  };
34
36
  exports.getNotification = getNotification;
35
- const putNotification = async payload => {
37
+ const putNotification = async (baseURL, payload) => {
36
38
  try {
37
- const url = "".concat(_EndPoint.default.NOTIFICATION).concat(_Env.default.VERSION, "?").concat(TENANT_ID, "=").concat(TENANT_IDS, "&").concat(BU_ID, "=").concat(BU_IDS, "&").concat(SNOP_ID, "=").concat(SNOP_IDS);
39
+ const url = "".concat(baseURL).concat(_EndPoint.default.NOTIFICATION).concat(_Env.default.VERSION, "?").concat(TENANT_ID, "=").concat(TENANT_IDS, "&").concat(BU_ID, "=").concat(BU_IDS, "&").concat(SNOP_ID, "=").concat(SNOP_IDS);
38
40
  const response = await _axios.default.put(url, payload);
39
41
  return response;
40
42
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3sc/common-component",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "keywords": [
5
5
  "react",
6
6
  "components",