contentoh-components-library 21.5.87 → 21.5.88

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.
@@ -33,71 +33,120 @@ RetailerProductEditionDefault.args = {
33
33
  },
34
34
  token: "eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI4ZDAxMDIxNC01YmZhLTQzYzMtOTZmYi1jNTU2ZGMwNTc3NGIiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwiY29nbml0bzp1c2VybmFtZSI6IjhkMDEwMjE0LTViZmEtNDNjMy05NmZiLWM1NTZkYzA1Nzc0YiIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiI1MDgwMTVmMy1mZGVkLTQ2ODUtYTIxNy1mYzgyMTg0ZWRmNGMiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTc2ODI1MzE3NywibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTc2ODI1Njc3NywiaWF0IjoxNzY4MjUzMTc3LCJlbWFpbCI6ImthcmFmZTMyMThAbW9tMmtpZC5jb20ifQ.QiZiscuTvrur0g328Zmh2bI-kZyg7YO_T5jT63096JNuSxGnX9wpK87cVTV1dED4ruD-2NMsgLShUIMcklAg17FL6i5_vCuB1dSIDY0LaybvSpriFJaVVdMUIMGFi_1Q7bI9qqyXYkevcf-HO33vVPdU-_-4-u8YRd-QganUk35vPYPh9vFJWbC0Qtvv25ZR4L2xuRIXx4e7StlTvZXysnYL8A84jkK1zn6d77V-9GqQQW8exO6sBW7R6cGt55vnF80NIfG_9lAqCK0PcZH4o50aqrAVhtfV5edlEmXBHeGK5R3Sz5iTeKb51QF3TWVFZCYGvQJ7FShulUWHcm3X2Q",
35
35
  productSelected: {
36
- "articleId": 145186,
36
+ "articleId": 145199,
37
37
  "services": {
38
38
  "datasheets": 1,
39
39
  "descriptions": 1,
40
- "images": 1
40
+ "images": 0
41
41
  },
42
- "orderId": 10449,
42
+ "orderId": 10457,
43
43
  "city": "CDMX, México",
44
44
  "status": "AS",
45
- "datasheet_status": "AC",
45
+ "datasheet_status": "AS",
46
46
  "prio": "none",
47
47
  "version": 3,
48
48
  "description_status": "AS",
49
- "images_status": "AC",
49
+ "images_status": "NS",
50
50
  "statusByRetailer": [{
51
- "status": "AC",
51
+ "status": "AS",
52
+ "service": "datasheet",
53
+ "retailer_id": 9,
54
+ "task_user_group_id": 2
55
+ }, {
56
+ "status": "AS",
57
+ "service": "description",
58
+ "retailer_id": 9,
59
+ "task_user_group_id": 2
60
+ }, {
61
+ "status": "AS",
62
+ "service": "datasheet",
63
+ "retailer_id": 19,
64
+ "task_user_group_id": 2
65
+ }, {
66
+ "status": "AS",
67
+ "service": "description",
68
+ "retailer_id": 19,
69
+ "task_user_group_id": 2
70
+ }, {
71
+ "status": "AS",
52
72
  "service": "datasheet",
53
- "retailer_id": 70,
54
- "task_user_group_id": 4
73
+ "retailer_id": 24,
74
+ "task_user_group_id": 2
55
75
  }, {
56
76
  "status": "AS",
57
77
  "service": "description",
58
- "retailer_id": 70,
78
+ "retailer_id": 24,
59
79
  "task_user_group_id": 2
60
80
  }, {
61
- "status": "AC",
62
- "service": "images",
63
- "retailer_id": 70,
64
- "task_user_group_id": 4
81
+ "status": "AS",
82
+ "service": "datasheet",
83
+ "retailer_id": 1011,
84
+ "task_user_group_id": 2
85
+ }, {
86
+ "status": "AS",
87
+ "service": "description",
88
+ "retailer_id": 1011,
89
+ "task_user_group_id": 2
65
90
  }],
66
91
  "article": {
67
- "id_article": 145186,
68
- "id_category": "4007",
92
+ "id_article": 145199,
93
+ "id_category": "10001",
69
94
  "brand": null,
70
- "name": "Mayonesa",
71
- "upc": "098928",
72
- "sku": "899",
73
- "timestamp": "2026-04-23T16:02:14.000Z",
95
+ "name": "Serna Status Bug 4",
96
+ "upc": "14615181351",
97
+ "sku": "156845131",
98
+ "timestamp": "2026-05-05T15:08:54.000Z",
74
99
  "active": 1,
75
100
  "company_id": 291,
76
101
  "company_name": "LATAM LOGISTICS",
77
102
  "country": "México",
78
- "id_order": 10449,
103
+ "id_order": 10457,
79
104
  "id_datasheet_especialist": 426,
80
105
  "id_datasheet_facilitator": null,
81
106
  "id_description_especialist": 426,
82
107
  "id_description_facilitator": null,
83
- "id_images_especialist": 427,
108
+ "id_images_especialist": null,
84
109
  "id_images_facilitator": null,
85
110
  "id_auditor": 425,
86
111
  "id_recepcionist": null,
87
- "category": "Abarrotes Procesados|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
112
+ "category": "Departamento Hanseatik|Categoría Hanseatik|Subcategoría Hanseatik",
88
113
  "categoryRetailer": [{
89
- "id_category": 4007,
90
- "id_retailer": 70,
91
- "category_name": "Abarrotes Procesados|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
92
- "retailer_name": "Bodega Aurrera"
114
+ "id_category": 3432,
115
+ "id_retailer": 24,
116
+ "category_name": "Bebés Alsuper|Bebés|Bebés",
117
+ "retailer_name": "Alsuper"
118
+ }, {
119
+ "id_category": 3579,
120
+ "id_retailer": 1011,
121
+ "category_name": "Categoría Genérica Farmatodo|Categoría Genérica|Categoría Genérica",
122
+ "retailer_name": "Farmatodo"
123
+ }, {
124
+ "id_category": 6795,
125
+ "id_retailer": 19,
126
+ "category_name": "Categoría Generica Costco|Categoría Generica|Categoría Generica",
127
+ "retailer_name": "Costco"
128
+ }, {
129
+ "id_category": 10001,
130
+ "id_retailer": 9,
131
+ "category_name": "Departamento Hanseatik|Categoría Hanseatik|Subcategoría Hanseatik",
132
+ "retailer_name": "Amazon"
93
133
  }]
94
134
  },
95
135
  "retailers": [{
96
- "id": 70,
97
- "name": "Bodega Aurrera"
136
+ "id": 9,
137
+ "name": "Amazon"
138
+ }, {
139
+ "id": 19,
140
+ "name": "Costco"
141
+ }, {
142
+ "id": 24,
143
+ "name": "Alsuper"
144
+ }, {
145
+ "id": 1011,
146
+ "name": "Farmatodo"
98
147
  }],
99
148
  "country": "México",
100
- "upc": "098928"
149
+ "upc": "14615181351"
101
150
  },
102
151
  // location: {
103
152
  // product: { articleId: 126855, versionId: 3 },
@@ -107,41 +156,42 @@ RetailerProductEditionDefault.args = {
107
156
  // },
108
157
  // },
109
158
  // EDICION IMAGENES
110
- user: {
111
- "id_user": 427,
112
- "name": "Especialista Edición",
113
- "last_name": null,
114
- "email": "kikije1467@mtlcz.com",
115
- "position": "Tester",
116
- "telephone": null,
117
- "country": null,
118
- "id_company": 254,
119
- "id_cognito": "c7e5a6a4-2b3f-4d54-af98-9e09a4cbc01e",
120
- "birth_Date": null,
121
- "about_me": null,
122
- "zip_code": null,
123
- "address": null,
124
- "job": null,
125
- "id_stripe": null,
126
- "id_role": 8,
127
- "active": 1,
128
- "is_retailer": 0,
129
- "email_notify": null,
130
- "is_user_tech": null,
131
- "is_onboarding": 0,
132
- "membership": {
133
- "id": 750,
134
- "start_date": "2022-01-07T21:32:54.000Z",
135
- "end_date": "2023-01-07T21:32:54.000Z",
136
- "planID": 6,
137
- "plan": "prod_KvGd6YSTJyR3AP",
138
- "name": "Plan Small",
139
- "user_limit": "10",
140
- "products_limit": "1000",
141
- "type": "Enterprise"
142
- },
143
- "src": "https://content-management-profile-prod.s3.amazonaws.com/id-427/427.png?1775592220312"
144
- } //TEXTOS
159
+ // user: {
160
+ // "id_user": 427,
161
+ // "name": "Especialista Edición",
162
+ // "last_name": null,
163
+ // "email": "kikije1467@mtlcz.com",
164
+ // "position": "Tester",
165
+ // "telephone": null,
166
+ // "country": null,
167
+ // "id_company": 254,
168
+ // "id_cognito": "c7e5a6a4-2b3f-4d54-af98-9e09a4cbc01e",
169
+ // "birth_Date": null,
170
+ // "about_me": null,
171
+ // "zip_code": null,
172
+ // "address": null,
173
+ // "job": null,
174
+ // "id_stripe": null,
175
+ // "id_role": 8,
176
+ // "active": 1,
177
+ // "is_retailer": 0,
178
+ // "email_notify": null,
179
+ // "is_user_tech": null,
180
+ // "is_onboarding": 0,
181
+ // "membership": {
182
+ // "id": 750,
183
+ // "start_date": "2022-01-07T21:32:54.000Z",
184
+ // "end_date": "2023-01-07T21:32:54.000Z",
185
+ // "planID": 6,
186
+ // "plan": "prod_KvGd6YSTJyR3AP",
187
+ // "name": "Plan Small",
188
+ // "user_limit": "10",
189
+ // "products_limit": "1000",
190
+ // "type": "Enterprise"
191
+ // },
192
+ // "src": "https://content-management-profile-prod.s3.amazonaws.com/id-427/427.png?1775592220312"
193
+ // },
194
+ //TEXTOS
145
195
  // user: {
146
196
  // "id_user": 442,
147
197
  // "name": "Especialista",
@@ -178,40 +228,39 @@ RetailerProductEditionDefault.args = {
178
228
  // },
179
229
  // "src": "https://content-management-profile.s3.amazonaws.com/id-442/442.png?1760636567736"
180
230
  // },
181
- // user: {
182
- // id_user: 426,
183
- // name: "Especialista Textos",
184
- // last_name: null,
185
- // email: "karafe3218@mom2kid.com",
186
- // position: "Tester",
187
- // telephone: null,
188
- // country: null,
189
- // id_company: 254,
190
- // id_cognito: "8d010214-5bfa-43c3-96fb-c556dc05774b",
191
- // birth_Date: null,
192
- // about_me: null,
193
- // zip_code: null,
194
- // address: null,
195
- // job: null,
196
- // id_stripe: null,
197
- // id_role: 7,
198
- // active: 1,
199
- // is_retailer: 0,
200
- // email_notify: null,
201
- // is_user_tech: null,
202
- // is_onboarding: 0,
203
- // membership: {
204
- // id: 750,
205
- // start_date: "2022-01-07T21:32:54.000Z",
206
- // end_date: "2023-01-07T21:32:54.000Z",
207
- // planID: 6,
208
- // plan: "prod_KvGd6YSTJyR3AP",
209
- // name: "Plan Small",
210
- // user_limit: "10",
211
- // products_limit: "1000",
212
- // type: "Enterprise",
213
- // },
214
- // src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1768253179478",
215
- // },
216
-
231
+ user: {
232
+ id_user: 426,
233
+ name: "Especialista Textos",
234
+ last_name: null,
235
+ email: "karafe3218@mom2kid.com",
236
+ position: "Tester",
237
+ telephone: null,
238
+ country: null,
239
+ id_company: 254,
240
+ id_cognito: "8d010214-5bfa-43c3-96fb-c556dc05774b",
241
+ birth_Date: null,
242
+ about_me: null,
243
+ zip_code: null,
244
+ address: null,
245
+ job: null,
246
+ id_stripe: null,
247
+ id_role: 7,
248
+ active: 1,
249
+ is_retailer: 0,
250
+ email_notify: null,
251
+ is_user_tech: null,
252
+ is_onboarding: 0,
253
+ membership: {
254
+ id: 750,
255
+ start_date: "2022-01-07T21:32:54.000Z",
256
+ end_date: "2023-01-07T21:32:54.000Z",
257
+ planID: 6,
258
+ plan: "prod_KvGd6YSTJyR3AP",
259
+ name: "Plan Small",
260
+ user_limit: "10",
261
+ products_limit: "1000",
262
+ type: "Enterprise"
263
+ },
264
+ src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1768253179478"
265
+ }
217
266
  };
@@ -45,26 +45,28 @@ var productReducer = function productReducer(state, action) {
45
45
 
46
46
  case PRODUCT_ACTIONS.SET_RETAILER_STATUS:
47
47
  {
48
+ var _action$payload$find, _action$payload$find2, _action$payload$find3;
49
+
48
50
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
49
51
  product: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.product), {}, {
50
52
  status: getMinorStatus(action.payload.map(function (status) {
51
53
  return status === null || status === void 0 ? void 0 : status.status;
52
54
  })),
53
- description_status: action.payload.find(function (status) {
55
+ description_status: ((_action$payload$find = action.payload.find(function (status) {
54
56
  var _state$active_retaile;
55
57
 
56
58
  return (status === null || status === void 0 ? void 0 : status.service) === "description" && (status === null || status === void 0 ? void 0 : status.retailer_id) === (state === null || state === void 0 ? void 0 : (_state$active_retaile = state.active_retailer) === null || _state$active_retaile === void 0 ? void 0 : _state$active_retaile.id_retailer);
57
- }).status || "NS",
58
- datasheet_status: action.payload.find(function (status) {
59
+ })) === null || _action$payload$find === void 0 ? void 0 : _action$payload$find.status) || "NS",
60
+ datasheet_status: ((_action$payload$find2 = action.payload.find(function (status) {
59
61
  var _state$active_retaile2;
60
62
 
61
63
  return (status === null || status === void 0 ? void 0 : status.service) === "datasheet" && (status === null || status === void 0 ? void 0 : status.retailer_id) === (state === null || state === void 0 ? void 0 : (_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id_retailer);
62
- }).status || "NS",
63
- images_status: action.payload.find(function (status) {
64
+ })) === null || _action$payload$find2 === void 0 ? void 0 : _action$payload$find2.status) || "NS",
65
+ images_status: ((_action$payload$find3 = action.payload.find(function (status) {
64
66
  var _state$active_retaile3;
65
67
 
66
68
  return (status === null || status === void 0 ? void 0 : status.service) === "images" && (status === null || status === void 0 ? void 0 : status.retailer_id) === (state === null || state === void 0 ? void 0 : (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer);
67
- }).status || "NS",
69
+ })) === null || _action$payload$find3 === void 0 ? void 0 : _action$payload$find3.status) || "NS",
68
70
  statusByRetailer: action.payload
69
71
  })
70
72
  });
@@ -105,6 +107,8 @@ var productReducer = function productReducer(state, action) {
105
107
  exports.productReducer = productReducer;
106
108
 
107
109
  function getMinorStatus() {
110
+ var _STATUS_DICTIONARY$NS;
111
+
108
112
  var servicesStatus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
109
113
  if (!servicesStatus || servicesStatus.length === 0) return _statusDictionary.STATUS_DICTIONARY.NS.name;
110
114
  console.log({
@@ -117,5 +121,5 @@ function getMinorStatus() {
117
121
  if (!minorObj || typeof minorObj.weight === "undefined") return current;
118
122
  return currentObj.weight < minorObj.weight ? currentObj : minorObj;
119
123
  }, servicesStatus[0] || _statusDictionary.STATUS_DICTIONARY.NS);
120
- return (winner === null || winner === void 0 ? void 0 : winner.status) || _statusDictionary.STATUS_DICTIONARY.NS.status;
124
+ return (winner === null || winner === void 0 ? void 0 : winner.status) || ((_STATUS_DICTIONARY$NS = _statusDictionary.STATUS_DICTIONARY.NS) === null || _STATUS_DICTIONARY$NS === void 0 ? void 0 : _STATUS_DICTIONARY$NS.status);
121
125
  }
@@ -985,7 +985,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
985
985
  var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
986
986
  var _state$product$id_ord, _state$active_retaile3;
987
987
 
988
- var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, retailers, messageToChat, messageData, _updatedProduct, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
988
+ var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
989
989
 
990
990
  return _regenerator.default.wrap(function _callee7$(_context7) {
991
991
  while (1) {
@@ -1064,6 +1064,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1064
1064
  break;
1065
1065
 
1066
1066
  case 26:
1067
+ //Caso del botón "Enviar evaluación"
1068
+ //Se construye el mensaje y se actualiza el estatus
1067
1069
  specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
1068
1070
 
1069
1071
  if (specialistDone) {
@@ -1085,52 +1087,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1085
1087
  res = _context7.sent;
1086
1088
 
1087
1089
  case 31:
1088
- if (!(res.data.statusCode === 200)) {
1089
- _context7.next = 43;
1090
- break;
1091
- }
1092
-
1093
- _JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newOrderStatus = _JSON$parse2.newOrderStatus, newArticleStatus = _JSON$parse2.newArticleStatus;
1094
- retailers = state.product.categoryRetailer.map(function (r) {
1095
- return {
1096
- id: r.id_retailer,
1097
- name: r.retailerName
1098
- };
1099
- });
1100
- messageToChat = (0, _utils.createMessage)(retailers, retailerId, evalStatus, newStatus, activeTab);
1101
- messageData = {
1102
- paramsBody: {
1103
- id: articleId,
1104
- version: state.product.version,
1105
- items: [{
1106
- type: "status",
1107
- value: messageToChat
1108
- }],
1109
- retailerId: retailerId,
1110
- status: state.product.status
1111
- },
1112
- paramsHeader: {
1113
- Authorization: token
1114
- }
1115
- };
1116
- _context7.next = 38;
1117
- return (0, _utils.sendMessage)(messageData);
1118
-
1119
- case 38:
1120
- _updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, (_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread2, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
1121
- if (item.retailer_id === retailerId && item.service === concept) {
1122
- return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
1123
- status: newStatus
1124
- });
1125
- }
1126
-
1127
- return item;
1128
- })), _objectSpread2));
1129
- sessionProduct = sessionStorage.getItem("productSelected");
1130
-
1131
- if (sessionProduct) {
1132
- productInSession = JSON.parse(sessionProduct);
1133
- updatedProductInSession = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, productInSession), {}, (_objectSpread3 = {}, (0, _defineProperty2.default)(_objectSpread3, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread3, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
1090
+ if (res.data.statusCode === 200) {
1091
+ _JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newOrderStatus = _JSON$parse2.newOrderStatus, newArticleStatus = _JSON$parse2.newArticleStatus; // const retailers = state.product.categoryRetailer.map((r) => ({
1092
+ // id: r.id_retailer,
1093
+ // name: r.retailerName,
1094
+ // }));
1095
+ // const messageToChat = createMessage(
1096
+ // retailers,
1097
+ // retailerId,
1098
+ // evalStatus,
1099
+ // newStatus,
1100
+ // activeTab,
1101
+ // );
1102
+ // const messageData = {
1103
+ // paramsBody: {
1104
+ // id: articleId,
1105
+ // version: state.product.version,
1106
+ // items: [{ type: "status", value: messageToChat }],
1107
+ // retailerId: retailerId,
1108
+ // status: state.product.status,
1109
+ // },
1110
+ // paramsHeader: { Authorization: token },
1111
+ // };
1112
+ // await sendMessage(messageData);
1113
+
1114
+ _updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, (_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread2, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
1134
1115
  if (item.retailer_id === retailerId && item.service === concept) {
1135
1116
  return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
1136
1117
  status: newStatus
@@ -1138,33 +1119,56 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1138
1119
  }
1139
1120
 
1140
1121
  return item;
1141
- })), _objectSpread3));
1142
- sessionStorage.setItem("productSelected", JSON.stringify(updatedProductInSession));
1143
- }
1122
+ })), _objectSpread2)); //Actualizamos el services_data en el servicio específico del retailer actual
1123
+
1124
+ updatedServicesData = (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : _state$services_data.map(function (service) {
1125
+ return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, service), {}, {
1126
+ status: (service === null || service === void 0 ? void 0 : service.id_retailer) === retailerId && (service === null || service === void 0 ? void 0 : service.service) === concept ? newStatus : service === null || service === void 0 ? void 0 : service.status
1127
+ });
1128
+ });
1129
+ sessionProduct = sessionStorage.getItem("productSelected");
1130
+
1131
+ if (sessionProduct) {
1132
+ productInSession = JSON.parse(sessionProduct);
1133
+ updatedProductInSession = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, productInSession), {}, (_objectSpread3 = {}, (0, _defineProperty2.default)(_objectSpread3, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread3, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
1134
+ if (item.retailer_id === retailerId && item.service === concept) {
1135
+ return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
1136
+ status: newStatus
1137
+ });
1138
+ }
1139
+
1140
+ return item;
1141
+ })), _objectSpread3));
1142
+ sessionStorage.setItem("productSelected", JSON.stringify(updatedProductInSession));
1143
+ }
1144
+
1145
+ if (message) {
1146
+ dispatch({
1147
+ type: "SET_MODAL",
1148
+ payload: {
1149
+ show: true,
1150
+ title: "",
1151
+ message: message,
1152
+ image: _genericModalCheck.default
1153
+ }
1154
+ });
1155
+ }
1144
1156
 
1145
- if (message) {
1146
1157
  dispatch({
1147
- type: "SET_MODAL",
1148
- payload: {
1149
- show: true,
1150
- title: "",
1151
- message: message,
1152
- image: _genericModalCheck.default
1153
- }
1158
+ type: "SET_PRODUCT",
1159
+ payload: _updatedProduct
1160
+ });
1161
+ dispatch({
1162
+ type: "SET_SERVICES_DATA",
1163
+ payload: updatedServicesData
1154
1164
  });
1155
1165
  }
1156
1166
 
1157
- dispatch({
1158
- type: "SET_PRODUCT",
1159
- payload: _updatedProduct
1160
- });
1161
-
1162
- case 43:
1163
- _context7.next = 49;
1167
+ _context7.next = 38;
1164
1168
  break;
1165
1169
 
1166
- case 45:
1167
- _context7.prev = 45;
1170
+ case 34:
1171
+ _context7.prev = 34;
1168
1172
  _context7.t0 = _context7["catch"](11);
1169
1173
  console.error("Error sending evaluation:", _context7.t0);
1170
1174
  dispatch({
@@ -1177,20 +1181,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1177
1181
  }
1178
1182
  });
1179
1183
 
1180
- case 49:
1181
- _context7.prev = 49;
1184
+ case 38:
1185
+ _context7.prev = 38;
1182
1186
  dispatch({
1183
1187
  type: "SET_SAVING",
1184
1188
  payload: false
1185
1189
  });
1186
- return _context7.finish(49);
1190
+ return _context7.finish(38);
1187
1191
 
1188
- case 52:
1192
+ case 41:
1189
1193
  case "end":
1190
1194
  return _context7.stop();
1191
1195
  }
1192
1196
  }
1193
- }, _callee7, null, [[11, 45, 49, 52]]);
1197
+ }, _callee7, null, [[11, 34, 38, 41]]);
1194
1198
  }));
1195
1199
 
1196
1200
  return function sendSingleEvaluation(_x2) {
@@ -1227,7 +1231,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1227
1231
 
1228
1232
  var sendBulkEvaluation = /*#__PURE__*/function () {
1229
1233
  var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
1230
- var _state$services_data, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, productInSession, updatedProductInSession;
1234
+ var _state$services_data2, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, productInSession, updatedProductInSession;
1231
1235
 
1232
1236
  return _regenerator.default.wrap(function _callee9$(_context9) {
1233
1237
  while (1) {
@@ -1241,7 +1245,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1241
1245
  evaluationArray = [];
1242
1246
  conceptArray = (0, _utils.getConceptsByRole)(user.id_role); // Crear todas las evaluaciones para cada servicio y retailer
1243
1247
 
1244
- (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : _state$services_data.forEach(function (ret) {
1248
+ (_state$services_data2 = state.services_data) === null || _state$services_data2 === void 0 ? void 0 : _state$services_data2.forEach(function (ret) {
1245
1249
  var service = ret.service,
1246
1250
  id_retailer = ret.id_retailer,
1247
1251
  status = ret.status;
@@ -1505,7 +1509,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1505
1509
  case 4:
1506
1510
  case 5:
1507
1511
  var filteredSrv45 = servicesByTab === null || servicesByTab === void 0 ? void 0 : servicesByTab.filter(function (serv) {
1508
- return statusArray.includes(serv.status);
1512
+ return statusArray.includes(serv === null || serv === void 0 ? void 0 : serv.status);
1509
1513
  });
1510
1514
  var condition45 = unvalidated && ["CA", "IE"].includes(product === null || product === void 0 ? void 0 : product.status) && (filteredSrv45 === null || filteredSrv45 === void 0 ? void 0 : filteredSrv45.length) === (servicesByTab === null || servicesByTab === void 0 ? void 0 : servicesByTab.length);
1511
1515
  return condition45;
@@ -1513,7 +1517,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1513
1517
  case 6:
1514
1518
  var statusInArray = statusArray.includes(product === null || product === void 0 ? void 0 : product.status);
1515
1519
  var allSrvValid = (_srv = srv) === null || _srv === void 0 ? void 0 : _srv.every(function (serv) {
1516
- return ["RA", "AA", "AP", "ACA"].includes(serv.status);
1520
+ return ["RA", "AA", "AP", "ACA"].includes(serv === null || serv === void 0 ? void 0 : serv.status);
1517
1521
  });
1518
1522
  var condition6 = statusInArray && allSrvValid && auditorUnvalidated;
1519
1523
  return condition6;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.5.87",
3
+ "version": "21.5.88",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -18,79 +18,139 @@ RetailerProductEditionDefault.args = {
18
18
  token:
19
19
  "eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI4ZDAxMDIxNC01YmZhLTQzYzMtOTZmYi1jNTU2ZGMwNTc3NGIiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwiY29nbml0bzp1c2VybmFtZSI6IjhkMDEwMjE0LTViZmEtNDNjMy05NmZiLWM1NTZkYzA1Nzc0YiIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiI1MDgwMTVmMy1mZGVkLTQ2ODUtYTIxNy1mYzgyMTg0ZWRmNGMiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTc2ODI1MzE3NywibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTc2ODI1Njc3NywiaWF0IjoxNzY4MjUzMTc3LCJlbWFpbCI6ImthcmFmZTMyMThAbW9tMmtpZC5jb20ifQ.QiZiscuTvrur0g328Zmh2bI-kZyg7YO_T5jT63096JNuSxGnX9wpK87cVTV1dED4ruD-2NMsgLShUIMcklAg17FL6i5_vCuB1dSIDY0LaybvSpriFJaVVdMUIMGFi_1Q7bI9qqyXYkevcf-HO33vVPdU-_-4-u8YRd-QganUk35vPYPh9vFJWbC0Qtvv25ZR4L2xuRIXx4e7StlTvZXysnYL8A84jkK1zn6d77V-9GqQQW8exO6sBW7R6cGt55vnF80NIfG_9lAqCK0PcZH4o50aqrAVhtfV5edlEmXBHeGK5R3Sz5iTeKb51QF3TWVFZCYGvQJ7FShulUWHcm3X2Q",
20
20
  productSelected: {
21
- "articleId": 145186,
21
+ "articleId": 145199,
22
22
  "services": {
23
23
  "datasheets": 1,
24
24
  "descriptions": 1,
25
- "images": 1
25
+ "images": 0
26
26
  },
27
- "orderId": 10449,
27
+ "orderId": 10457,
28
28
  "city": "CDMX, México",
29
29
  "status": "AS",
30
- "datasheet_status": "AC",
30
+ "datasheet_status": "AS",
31
31
  "prio": "none",
32
32
  "version": 3,
33
33
  "description_status": "AS",
34
- "images_status": "AC",
34
+ "images_status": "NS",
35
35
  "statusByRetailer": [
36
36
  {
37
- "status": "AC",
37
+ "status": "AS",
38
+ "service": "datasheet",
39
+ "retailer_id": 9,
40
+ "task_user_group_id": 2
41
+ },
42
+ {
43
+ "status": "AS",
44
+ "service": "description",
45
+ "retailer_id": 9,
46
+ "task_user_group_id": 2
47
+ },
48
+ {
49
+ "status": "AS",
50
+ "service": "datasheet",
51
+ "retailer_id": 19,
52
+ "task_user_group_id": 2
53
+ },
54
+ {
55
+ "status": "AS",
56
+ "service": "description",
57
+ "retailer_id": 19,
58
+ "task_user_group_id": 2
59
+ },
60
+ {
61
+ "status": "AS",
38
62
  "service": "datasheet",
39
- "retailer_id": 70,
40
- "task_user_group_id": 4
63
+ "retailer_id": 24,
64
+ "task_user_group_id": 2
41
65
  },
42
66
  {
43
67
  "status": "AS",
44
68
  "service": "description",
45
- "retailer_id": 70,
69
+ "retailer_id": 24,
70
+ "task_user_group_id": 2
71
+ },
72
+ {
73
+ "status": "AS",
74
+ "service": "datasheet",
75
+ "retailer_id": 1011,
46
76
  "task_user_group_id": 2
47
77
  },
48
78
  {
49
- "status": "AC",
50
- "service": "images",
51
- "retailer_id": 70,
52
- "task_user_group_id": 4
79
+ "status": "AS",
80
+ "service": "description",
81
+ "retailer_id": 1011,
82
+ "task_user_group_id": 2
53
83
  }
54
84
  ],
55
85
  "article": {
56
- "id_article": 145186,
57
- "id_category": "4007",
86
+ "id_article": 145199,
87
+ "id_category": "10001",
58
88
  "brand": null,
59
- "name": "Mayonesa",
60
- "upc": "098928",
61
- "sku": "899",
62
- "timestamp": "2026-04-23T16:02:14.000Z",
89
+ "name": "Serna Status Bug 4",
90
+ "upc": "14615181351",
91
+ "sku": "156845131",
92
+ "timestamp": "2026-05-05T15:08:54.000Z",
63
93
  "active": 1,
64
94
  "company_id": 291,
65
95
  "company_name": "LATAM LOGISTICS",
66
96
  "country": "México",
67
- "id_order": 10449,
97
+ "id_order": 10457,
68
98
  "id_datasheet_especialist": 426,
69
99
  "id_datasheet_facilitator": null,
70
100
  "id_description_especialist": 426,
71
101
  "id_description_facilitator": null,
72
- "id_images_especialist": 427,
102
+ "id_images_especialist": null,
73
103
  "id_images_facilitator": null,
74
104
  "id_auditor": 425,
75
105
  "id_recepcionist": null,
76
- "category": "Abarrotes Procesados|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
106
+ "category": "Departamento Hanseatik|Categoría Hanseatik|Subcategoría Hanseatik",
77
107
  "categoryRetailer": [
78
108
  {
79
- "id_category": 4007,
80
- "id_retailer": 70,
81
- "category_name": "Abarrotes Procesados|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
82
- "retailer_name": "Bodega Aurrera"
109
+ "id_category": 3432,
110
+ "id_retailer": 24,
111
+ "category_name": "Bebés Alsuper|Bebés|Bebés",
112
+ "retailer_name": "Alsuper"
113
+ },
114
+ {
115
+ "id_category": 3579,
116
+ "id_retailer": 1011,
117
+ "category_name": "Categoría Genérica Farmatodo|Categoría Genérica|Categoría Genérica",
118
+ "retailer_name": "Farmatodo"
119
+ },
120
+ {
121
+ "id_category": 6795,
122
+ "id_retailer": 19,
123
+ "category_name": "Categoría Generica Costco|Categoría Generica|Categoría Generica",
124
+ "retailer_name": "Costco"
125
+ },
126
+ {
127
+ "id_category": 10001,
128
+ "id_retailer": 9,
129
+ "category_name": "Departamento Hanseatik|Categoría Hanseatik|Subcategoría Hanseatik",
130
+ "retailer_name": "Amazon"
83
131
  }
84
132
  ]
85
133
  },
86
134
  "retailers": [
87
135
  {
88
- "id": 70,
89
- "name": "Bodega Aurrera"
136
+ "id": 9,
137
+ "name": "Amazon"
138
+ },
139
+ {
140
+ "id": 19,
141
+ "name": "Costco"
142
+ },
143
+ {
144
+ "id": 24,
145
+ "name": "Alsuper"
146
+ },
147
+ {
148
+ "id": 1011,
149
+ "name": "Farmatodo"
90
150
  }
91
151
  ],
92
152
  "country": "México",
93
- "upc": "098928"
153
+ "upc": "14615181351"
94
154
  },
95
155
 
96
156
  // location: {
@@ -103,41 +163,41 @@ RetailerProductEditionDefault.args = {
103
163
 
104
164
  // EDICION IMAGENES
105
165
 
106
- user: {
107
- "id_user": 427,
108
- "name": "Especialista Edición",
109
- "last_name": null,
110
- "email": "kikije1467@mtlcz.com",
111
- "position": "Tester",
112
- "telephone": null,
113
- "country": null,
114
- "id_company": 254,
115
- "id_cognito": "c7e5a6a4-2b3f-4d54-af98-9e09a4cbc01e",
116
- "birth_Date": null,
117
- "about_me": null,
118
- "zip_code": null,
119
- "address": null,
120
- "job": null,
121
- "id_stripe": null,
122
- "id_role": 8,
123
- "active": 1,
124
- "is_retailer": 0,
125
- "email_notify": null,
126
- "is_user_tech": null,
127
- "is_onboarding": 0,
128
- "membership": {
129
- "id": 750,
130
- "start_date": "2022-01-07T21:32:54.000Z",
131
- "end_date": "2023-01-07T21:32:54.000Z",
132
- "planID": 6,
133
- "plan": "prod_KvGd6YSTJyR3AP",
134
- "name": "Plan Small",
135
- "user_limit": "10",
136
- "products_limit": "1000",
137
- "type": "Enterprise"
138
- },
139
- "src": "https://content-management-profile-prod.s3.amazonaws.com/id-427/427.png?1775592220312"
140
- },
166
+ // user: {
167
+ // "id_user": 427,
168
+ // "name": "Especialista Edición",
169
+ // "last_name": null,
170
+ // "email": "kikije1467@mtlcz.com",
171
+ // "position": "Tester",
172
+ // "telephone": null,
173
+ // "country": null,
174
+ // "id_company": 254,
175
+ // "id_cognito": "c7e5a6a4-2b3f-4d54-af98-9e09a4cbc01e",
176
+ // "birth_Date": null,
177
+ // "about_me": null,
178
+ // "zip_code": null,
179
+ // "address": null,
180
+ // "job": null,
181
+ // "id_stripe": null,
182
+ // "id_role": 8,
183
+ // "active": 1,
184
+ // "is_retailer": 0,
185
+ // "email_notify": null,
186
+ // "is_user_tech": null,
187
+ // "is_onboarding": 0,
188
+ // "membership": {
189
+ // "id": 750,
190
+ // "start_date": "2022-01-07T21:32:54.000Z",
191
+ // "end_date": "2023-01-07T21:32:54.000Z",
192
+ // "planID": 6,
193
+ // "plan": "prod_KvGd6YSTJyR3AP",
194
+ // "name": "Plan Small",
195
+ // "user_limit": "10",
196
+ // "products_limit": "1000",
197
+ // "type": "Enterprise"
198
+ // },
199
+ // "src": "https://content-management-profile-prod.s3.amazonaws.com/id-427/427.png?1775592220312"
200
+ // },
141
201
 
142
202
  //TEXTOS
143
203
 
@@ -178,39 +238,39 @@ user: {
178
238
  // "src": "https://content-management-profile.s3.amazonaws.com/id-442/442.png?1760636567736"
179
239
  // },
180
240
 
181
- // user: {
182
- // id_user: 426,
183
- // name: "Especialista Textos",
184
- // last_name: null,
185
- // email: "karafe3218@mom2kid.com",
186
- // position: "Tester",
187
- // telephone: null,
188
- // country: null,
189
- // id_company: 254,
190
- // id_cognito: "8d010214-5bfa-43c3-96fb-c556dc05774b",
191
- // birth_Date: null,
192
- // about_me: null,
193
- // zip_code: null,
194
- // address: null,
195
- // job: null,
196
- // id_stripe: null,
197
- // id_role: 7,
198
- // active: 1,
199
- // is_retailer: 0,
200
- // email_notify: null,
201
- // is_user_tech: null,
202
- // is_onboarding: 0,
203
- // membership: {
204
- // id: 750,
205
- // start_date: "2022-01-07T21:32:54.000Z",
206
- // end_date: "2023-01-07T21:32:54.000Z",
207
- // planID: 6,
208
- // plan: "prod_KvGd6YSTJyR3AP",
209
- // name: "Plan Small",
210
- // user_limit: "10",
211
- // products_limit: "1000",
212
- // type: "Enterprise",
213
- // },
214
- // src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1768253179478",
215
- // },
241
+ user: {
242
+ id_user: 426,
243
+ name: "Especialista Textos",
244
+ last_name: null,
245
+ email: "karafe3218@mom2kid.com",
246
+ position: "Tester",
247
+ telephone: null,
248
+ country: null,
249
+ id_company: 254,
250
+ id_cognito: "8d010214-5bfa-43c3-96fb-c556dc05774b",
251
+ birth_Date: null,
252
+ about_me: null,
253
+ zip_code: null,
254
+ address: null,
255
+ job: null,
256
+ id_stripe: null,
257
+ id_role: 7,
258
+ active: 1,
259
+ is_retailer: 0,
260
+ email_notify: null,
261
+ is_user_tech: null,
262
+ is_onboarding: 0,
263
+ membership: {
264
+ id: 750,
265
+ start_date: "2022-01-07T21:32:54.000Z",
266
+ end_date: "2023-01-07T21:32:54.000Z",
267
+ planID: 6,
268
+ plan: "prod_KvGd6YSTJyR3AP",
269
+ name: "Plan Small",
270
+ user_limit: "10",
271
+ products_limit: "1000",
272
+ type: "Enterprise",
273
+ },
274
+ src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1768253179478",
275
+ },
216
276
  };
@@ -44,19 +44,19 @@ export const productReducer = (state, action) => {
44
44
  (status) =>
45
45
  status?.service === "description" &&
46
46
  status?.retailer_id === state?.active_retailer?.id_retailer,
47
- ).status || "NS",
47
+ )?.status || "NS",
48
48
  datasheet_status:
49
49
  action.payload.find(
50
50
  (status) =>
51
51
  status?.service === "datasheet" &&
52
52
  status?.retailer_id === state?.active_retailer?.id_retailer,
53
- ).status || "NS",
53
+ )?.status || "NS",
54
54
  images_status:
55
55
  action.payload.find(
56
56
  (status) =>
57
57
  status?.service === "images" &&
58
58
  status?.retailer_id === state?.active_retailer?.id_retailer,
59
- ).status || "NS",
59
+ )?.status || "NS",
60
60
  statusByRetailer: action.payload,
61
61
  },
62
62
  };
@@ -110,5 +110,5 @@ function getMinorStatus(servicesStatus = []) {
110
110
  return currentObj.weight < minorObj.weight ? currentObj : minorObj;
111
111
  }, servicesStatus[0] || STATUS_DICTIONARY.NS);
112
112
 
113
- return winner?.status || STATUS_DICTIONARY.NS.status;
113
+ return winner?.status || STATUS_DICTIONARY.NS?.status;
114
114
  }
@@ -696,9 +696,11 @@ const RetailerProductEditionView = ({
696
696
 
697
697
  const sendSingleEvaluation = async (result) => {
698
698
  if (state.saving) return;
699
+
699
700
  dispatch({ type: "SET_SAVING", payload: true });
700
701
 
701
702
  const concept = getConceptByTab(state.active_tab);
703
+
702
704
  const articleId = state.product.id_article;
703
705
  const orderId = state.product.id_order ?? state.product.orderId;
704
706
  const sectionStatusKey = `${concept}_status`;
@@ -713,6 +715,7 @@ const RetailerProductEditionView = ({
713
715
  const activeTab = state.active_tab;
714
716
 
715
717
  try {
718
+ //Esto solo se ejecutará cuando se aprueba o rechaza desde el modal superior derecho
716
719
  if (result) {
717
720
  data.result = result;
718
721
  data.retailerId = retailerId;
@@ -757,7 +760,10 @@ const RetailerProductEditionView = ({
757
760
  image: successIcon,
758
761
  },
759
762
  });
760
- } else {
763
+ } else { //Caso del botón "Enviar evaluación"
764
+
765
+ //Se construye el mensaje y se actualiza el estatus
766
+
761
767
  const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
762
768
 
763
769
  if (specialistDone) {
@@ -772,39 +778,41 @@ const RetailerProductEditionView = ({
772
778
  message = "Evaluación enviada";
773
779
  icon = successIcon;
774
780
  }
781
+
775
782
  res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
776
783
  headers: {
777
784
  Authorization: token,
778
785
  },
779
786
  });
780
787
  }
788
+
781
789
  if (res.data.statusCode === 200) {
782
- const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse(
783
- res.data.body,
784
- );
785
- const retailers = state.product.categoryRetailer.map((r) => ({
786
- id: r.id_retailer,
787
- name: r.retailerName,
788
- }));
789
- const messageToChat = createMessage(
790
- retailers,
791
- retailerId,
792
- evalStatus,
793
- newStatus,
794
- activeTab,
795
- );
796
790
 
797
- const messageData = {
798
- paramsBody: {
799
- id: articleId,
800
- version: state.product.version,
801
- items: [{ type: "status", value: messageToChat }],
802
- retailerId: retailerId,
803
- status: state.product.status,
804
- },
805
- paramsHeader: { Authorization: token },
806
- };
807
- await sendMessage(messageData);
791
+ const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse( res.data.body );
792
+
793
+ // const retailers = state.product.categoryRetailer.map((r) => ({
794
+ // id: r.id_retailer,
795
+ // name: r.retailerName,
796
+ // }));
797
+ // const messageToChat = createMessage(
798
+ // retailers,
799
+ // retailerId,
800
+ // evalStatus,
801
+ // newStatus,
802
+ // activeTab,
803
+ // );
804
+
805
+ // const messageData = {
806
+ // paramsBody: {
807
+ // id: articleId,
808
+ // version: state.product.version,
809
+ // items: [{ type: "status", value: messageToChat }],
810
+ // retailerId: retailerId,
811
+ // status: state.product.status,
812
+ // },
813
+ // paramsHeader: { Authorization: token },
814
+ // };
815
+ // await sendMessage(messageData);
808
816
 
809
817
  const updatedProduct = {
810
818
  ...state.product,
@@ -818,7 +826,15 @@ const RetailerProductEditionView = ({
818
826
  }),
819
827
  };
820
828
 
829
+ //Actualizamos el services_data en el servicio específico del retailer actual
830
+
831
+ const updatedServicesData = state.services_data?.map(service => ({
832
+ ...service,
833
+ status: service?.id_retailer === retailerId && service?.service === concept ? newStatus : service?.status
834
+ }));
835
+
821
836
  const sessionProduct = sessionStorage.getItem("productSelected");
837
+
822
838
  if (sessionProduct) {
823
839
  const productInSession = JSON.parse(sessionProduct);
824
840
  const updatedProductInSession = {
@@ -850,6 +866,7 @@ const RetailerProductEditionView = ({
850
866
  }
851
867
 
852
868
  dispatch({ type: "SET_PRODUCT", payload: updatedProduct });
869
+ dispatch({ type: "SET_SERVICES_DATA", payload: updatedServicesData });
853
870
  }
854
871
  } catch (error) {
855
872
  console.error("Error sending evaluation:", error);
@@ -1097,6 +1114,7 @@ const RetailerProductEditionView = ({
1097
1114
  switch (id_rol) {
1098
1115
  case 7:
1099
1116
  case 8:
1117
+
1100
1118
  const conditionOne = statusArray.includes(statusByActiveService);
1101
1119
  const conditionTwo = statusArray.includes(product?.status);
1102
1120
  const conditionThree =
@@ -1105,10 +1123,11 @@ const RetailerProductEditionView = ({
1105
1123
  ).length === servicesByTab.length;
1106
1124
 
1107
1125
  return (conditionOne && conditionTwo) || conditionThree;
1126
+
1108
1127
  case 4:
1109
1128
  case 5:
1110
1129
  const filteredSrv45 = servicesByTab?.filter((serv) =>
1111
- statusArray.includes(serv.status),
1130
+ statusArray.includes(serv?.status),
1112
1131
  );
1113
1132
  const condition45 =
1114
1133
  unvalidated &&
@@ -1118,7 +1137,7 @@ const RetailerProductEditionView = ({
1118
1137
  case 6:
1119
1138
  const statusInArray = statusArray.includes(product?.status);
1120
1139
  const allSrvValid = srv?.every((serv) =>
1121
- ["RA", "AA", "AP", "ACA"].includes(serv.status),
1140
+ ["RA", "AA", "AP", "ACA"].includes(serv?.status),
1122
1141
  );
1123
1142
  const condition6 = statusInArray && allSrvValid && auditorUnvalidated;
1124
1143
  return condition6;