vineanova-redux-artifacts 1.83.0 → 1.85.0
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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
7
8
|
var _axios = _interopRequireDefault(require("axios"));
|
|
8
9
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
9
10
|
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
|
@@ -29,21 +30,25 @@ var ServiceConfigClass = /*#__PURE__*/function () {
|
|
|
29
30
|
value: function initConfig(config) {
|
|
30
31
|
this.config = config;
|
|
31
32
|
}
|
|
33
|
+
}, {
|
|
34
|
+
key: "isTestEnv",
|
|
35
|
+
value: function isTestEnv() {
|
|
36
|
+
var isTest = (0, _get["default"])(this.config, 'environment.isTest', null);
|
|
37
|
+
var isLocalHost = (0, _get["default"])(this.config, 'environment.isLocalHost', null);
|
|
38
|
+
return isTest || isLocalHost;
|
|
39
|
+
}
|
|
32
40
|
}, {
|
|
33
41
|
key: "getBaseUri",
|
|
34
42
|
value: function getBaseUri(serviceType) {
|
|
35
43
|
_winstonLogger["default"].debug(this.config);
|
|
36
|
-
var userEmail =
|
|
44
|
+
var userEmail = (0, _get["default"])(this.config, 'user.email', null);
|
|
37
45
|
var isDemoUser = userEmail === 'VineaNovaDemoAdmin.com' && serviceType !== 'login';
|
|
38
|
-
var isTest = get(this.config, 'environment.isTest', null);
|
|
39
|
-
var isLocalHost = get(this.config, 'environment.isLocalHost', null);
|
|
40
|
-
isTest = isTest || isLocalHost;
|
|
41
46
|
if (serviceType === 'mock' || isDemoUser) {
|
|
42
47
|
apiUrl = mockApiUrl;
|
|
43
48
|
} else if (serviceType === 'login') {
|
|
44
|
-
apiUrl =
|
|
49
|
+
apiUrl = this.isTestEnv() ? process.env.REACT_APP_COMMON_USER_API : process.env.REACT_APP_PROD_COMMON_USER_API;
|
|
45
50
|
} else {
|
|
46
|
-
apiUrl =
|
|
51
|
+
apiUrl = this.isTestEnv() ? process.env.REACT_APP_CORE_API : process.env.REACT_APP_PROD_CORE_API;
|
|
47
52
|
}
|
|
48
53
|
return apiUrl;
|
|
49
54
|
}
|
|
@@ -78,6 +83,7 @@ var ServiceConfigClass = /*#__PURE__*/function () {
|
|
|
78
83
|
_winstonLogger["default"].debug("serviceType", {
|
|
79
84
|
serviceType: serviceType
|
|
80
85
|
});
|
|
86
|
+
var isTest = this.isTestEnv();
|
|
81
87
|
var _this$config$user = this.config.user,
|
|
82
88
|
accessToken = _this$config$user.accessToken,
|
|
83
89
|
orgDetails = _this$config$user.orgDetails;
|
|
@@ -95,6 +101,8 @@ var ServiceConfigClass = /*#__PURE__*/function () {
|
|
|
95
101
|
});
|
|
96
102
|
client.interceptors.request.use(function (config) {
|
|
97
103
|
// Do something before request is sent
|
|
104
|
+
var appCode = isTest ? process.env.REACT_APP_FUNCTION_CODE : process.env.REACT_APP_PROD_FUNCTION_CODE;
|
|
105
|
+
config.params.code = appCode;
|
|
98
106
|
config.headers.Authorization = "Bearer ".concat(accessToken);
|
|
99
107
|
config.headers["x-orgname"] = displayName;
|
|
100
108
|
config.headers["x-tid"] = id;
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable class-methods-use-this */
|
|
2
2
|
/* eslint-disable no-param-reassign */
|
|
3
|
+
import get from 'lodash/get';
|
|
3
4
|
import axios from "axios";
|
|
4
5
|
import isEmpty from "lodash/isEmpty";
|
|
5
6
|
import isNil from "lodash/isNil";
|
|
@@ -19,23 +20,26 @@ class ServiceConfigClass {
|
|
|
19
20
|
this.config = config;
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
isTestEnv() {
|
|
24
|
+
const isTest = get(this.config, 'environment.isTest', null);
|
|
25
|
+
const isLocalHost = get(this.config, 'environment.isLocalHost', null);
|
|
26
|
+
return isTest || isLocalHost;
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
getBaseUri(serviceType) {
|
|
23
30
|
logger.debug(this.config);
|
|
24
31
|
const userEmail = get(this.config, 'user.email', null);
|
|
25
32
|
const isDemoUser =
|
|
26
33
|
userEmail === 'VineaNovaDemoAdmin.com' && serviceType !== 'login';
|
|
27
|
-
let isTest = get(this.config, 'environment.isTest', null);
|
|
28
|
-
const isLocalHost = get(this.config, 'environment.isLocalHost', null);
|
|
29
|
-
isTest = isTest || isLocalHost;
|
|
30
34
|
|
|
31
35
|
if (serviceType === 'mock' || isDemoUser) {
|
|
32
36
|
apiUrl = mockApiUrl;
|
|
33
37
|
} else if (serviceType === 'login') {
|
|
34
|
-
apiUrl =
|
|
38
|
+
apiUrl = this.isTestEnv()
|
|
35
39
|
? process.env.REACT_APP_COMMON_USER_API
|
|
36
40
|
: process.env.REACT_APP_PROD_COMMON_USER_API;
|
|
37
41
|
} else {
|
|
38
|
-
apiUrl =
|
|
42
|
+
apiUrl = this.isTestEnv()
|
|
39
43
|
? process.env.REACT_APP_CORE_API
|
|
40
44
|
: process.env.REACT_APP_PROD_CORE_API;
|
|
41
45
|
}
|
|
@@ -65,6 +69,7 @@ class ServiceConfigClass {
|
|
|
65
69
|
request(options, serviceType) {
|
|
66
70
|
// logger.debug('currentConfig', this.config);
|
|
67
71
|
logger.debug("serviceType", { serviceType });
|
|
72
|
+
const isTest = this.isTestEnv();
|
|
68
73
|
const { accessToken, orgDetails } = this.config.user;
|
|
69
74
|
if (isEmpty(accessToken) || isNil(accessToken) || isEmpty(orgDetails)) {
|
|
70
75
|
throw new Error("serviceConfig -> No Access token available");
|
|
@@ -82,6 +87,10 @@ class ServiceConfigClass {
|
|
|
82
87
|
client.interceptors.request.use(
|
|
83
88
|
(config) => {
|
|
84
89
|
// Do something before request is sent
|
|
90
|
+
const appCode = isTest
|
|
91
|
+
? process.env.REACT_APP_FUNCTION_CODE
|
|
92
|
+
: process.env.REACT_APP_PROD_FUNCTION_CODE;
|
|
93
|
+
config.params.code = appCode;
|
|
85
94
|
config.headers.Authorization = `Bearer ${accessToken}`;
|
|
86
95
|
config.headers["x-orgname"] = displayName;
|
|
87
96
|
config.headers["x-tid"] = id;
|