sysone-api-mapper 1.0.40 → 1.0.42

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sysone-api-mapper",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "description": "Paquete mapper para portal de productores",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -38,6 +38,7 @@ const configs = {
38
38
  headers: {
39
39
  ["X-Channel"]: API_MAPPER.cnp.headers["X-Chanel"],
40
40
  ["X-Agent"]: API_MAPPER.cnp.headers["X-Agent"],
41
+ ["X-Client"]: API_MAPPER.cnp.headers["X-Client"],
41
42
  ["Ocp-Apim-Subscription-Key"]: API_MAPPER.cnp.headers["Ocp-Apim-Subscription-Key"],
42
43
  ["X-Origin"]: "sysone-api-mapper"
43
44
  },
@@ -67,30 +68,18 @@ export const apiMapper = async (
67
68
  }
68
69
 
69
70
  if (tenant === "cnp") {
70
- const xClientValue = additionalHeaders["X-Client"] ||
71
- (typeof window !== 'undefined' && localStorage.getItem("intermediaryCode")) ||
72
- configs.cnp.headers["X-Client"];
73
-
74
- // Asegurarse de que X-Client esté presente
75
- if (!additionalHeaders["X-Client"] && intermediaryCode) {
76
- additionalHeaders["X-Client"] = intermediaryCode;
77
- }
78
-
79
- // Validar que se haya proporcionado X-Client
80
- if (!xClientValue) {
81
- throw new Error("Header X-Client es requerido para requests CNP");
82
- }
71
+ console.log("🚀 ~ apiMapper ~ additionalHeaders:", additionalHeaders)
83
72
 
84
73
  config = {
85
74
  ...configs.cnp,
86
75
  headers: {
87
76
  ...configs.cnp.headers,
88
77
  ...additionalHeaders,
89
- // Sobrescribe X-Client con el valor determinado
90
- ["X-Client"]: xClientValue
78
+ ["X-Client"]: additionalHeaders["X-Client"] || configs.cnp.headers["X-Client"],
91
79
  }
92
80
  }
93
81
  } else {
82
+ // Para cualquier otro tenant, usar config default pero sobreescribir X-Tenant y X-User
94
83
  config = {
95
84
  ...configs.default,
96
85
  headers: {