sysone-api-mapper 1.0.136 → 1.0.137
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/package.json +2 -1
- package/src/mapper/Mapper.js +7 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sysone-api-mapper",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.137",
|
|
4
4
|
"description": "Paquete mapper para portal de productores",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
18
18
|
"@babel/preset-env": "^7.20.2",
|
|
19
19
|
"@babel/preset-react": "^7.18.6",
|
|
20
|
+
"@sysone/components": "^1.0.166-dev",
|
|
20
21
|
"antd": "^4.21.4",
|
|
21
22
|
"axios": "^1.6.0",
|
|
22
23
|
"babel-loader": "^9.1.2",
|
package/src/mapper/Mapper.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import axiosInstance from "../../axiosInstance";
|
|
2
2
|
import { methods, tenantsConfig } from "./endpointsConfig";
|
|
3
|
+
import {
|
|
4
|
+
SecurityManager,
|
|
5
|
+
} from "@sysone/components";
|
|
3
6
|
|
|
4
7
|
const getApiMapperConfig = () => {
|
|
5
8
|
// 1. Intentar desde variables de entorno compiladas (Webpack DefinePlugin)
|
|
@@ -30,22 +33,18 @@ const getApiMapperConfig = () => {
|
|
|
30
33
|
};
|
|
31
34
|
|
|
32
35
|
const getSalesAgent = () => {
|
|
33
|
-
return
|
|
34
|
-
window.__INTERMEDIARY_CODE__ ||
|
|
35
|
-
null;
|
|
36
|
+
return SecurityManager.getExtra("salesAgent") || null;
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
const getSalesChannel = () => {
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
null;
|
|
40
|
+
return SecurityManager.getExtra("salesAgent") || null;
|
|
41
|
+
// si "sales-channel" no tiene su propio campo en extras, usa el mismo que agent
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const getDynamicHeaders = (tenant) => {
|
|
45
45
|
if (tenant === "cnp") {
|
|
46
46
|
// Intenta obtener el X-Agent de localStorage (inyectado desde el front)
|
|
47
|
-
const xAgent =
|
|
48
|
-
window.__INTERMEDIARY_CODE__ ||
|
|
47
|
+
const xAgent = SecurityManager.getExtra("intermediaryCode") ||
|
|
49
48
|
configs.cnp.headers["X-Agent"];
|
|
50
49
|
|
|
51
50
|
const salesCode = getSalesAgent();
|