contentoh-components-library 21.6.31 → 21.6.33

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.
Files changed (31) hide show
  1. package/dist/ai/prompts/attribute.prompt.js +28 -0
  2. package/dist/ai/prompts/description.prompt.js +33 -0
  3. package/dist/ai/schemas/attribute.schema.js +35 -0
  4. package/dist/ai/schemas/description.schema.js +27 -0
  5. package/dist/components/atoms/InheritanceTag/InheritanceTag.stories.js +5 -5
  6. package/dist/components/atoms/InheritanceTag/index.js +6 -6
  7. package/dist/components/organisms/InputGroup/index.js +12 -1
  8. package/dist/components/organisms/LinkVariantsModal/index.js +269 -356
  9. package/dist/components/organisms/LinkVariantsModal/styles.js +14 -5
  10. package/dist/components/organisms/PropagateChangesModal/index.js +12 -13
  11. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +5 -5
  12. package/dist/components/pages/ProviderProductEdition/context/reducers/inputs.js +5 -2
  13. package/dist/components/pages/ProviderProductEdition/index.js +76 -33
  14. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +5 -5
  15. package/dist/components/pages/RetailerProductEdition/context/reducers/inputs.js +5 -2
  16. package/dist/components/pages/RetailerProductEdition/index.js +303 -309
  17. package/dist/components/pages/RetailerProductEdition/styles.js +2 -2
  18. package/package.json +1 -1
  19. package/src/components/atoms/InheritanceTag/InheritanceTag.stories.js +3 -3
  20. package/src/components/atoms/InheritanceTag/index.js +6 -6
  21. package/src/components/organisms/InputGroup/index.js +12 -0
  22. package/src/components/organisms/LinkVariantsModal/index.js +260 -287
  23. package/src/components/organisms/LinkVariantsModal/styles.js +65 -32
  24. package/src/components/organisms/PropagateChangesModal/index.js +19 -17
  25. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +4 -4
  26. package/src/components/pages/ProviderProductEdition/context/reducers/inputs.js +13 -1
  27. package/src/components/pages/ProviderProductEdition/index.js +48 -20
  28. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +4 -4
  29. package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +13 -1
  30. package/src/components/pages/RetailerProductEdition/index.js +89 -73
  31. package/src/components/pages/RetailerProductEdition/styles.js +0 -11
@@ -160,81 +160,81 @@ function regenerateVideoThumbnails(_x) {
160
160
  }
161
161
 
162
162
  function _regenerateVideoThumbnails() {
163
- _regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(values) {
164
- return _regenerator.default.wrap(function _callee18$(_context18) {
163
+ _regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(values) {
164
+ return _regenerator.default.wrap(function _callee17$(_context17) {
165
165
  while (1) {
166
- switch (_context18.prev = _context18.next) {
166
+ switch (_context17.prev = _context17.next) {
167
167
  case 0:
168
168
  if (Array.isArray(values)) {
169
- _context18.next = 2;
169
+ _context17.next = 2;
170
170
  break;
171
171
  }
172
172
 
173
- return _context18.abrupt("return", values);
173
+ return _context17.abrupt("return", values);
174
174
 
175
175
  case 2:
176
- return _context18.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
177
- var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(value) {
176
+ return _context17.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
177
+ var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(value) {
178
178
  var base64, videoSrc, thumbnail;
179
- return _regenerator.default.wrap(function _callee17$(_context17) {
179
+ return _regenerator.default.wrap(function _callee16$(_context16) {
180
180
  while (1) {
181
- switch (_context17.prev = _context17.next) {
181
+ switch (_context16.prev = _context16.next) {
182
182
  case 0:
183
183
  if (!((value === null || value === void 0 ? void 0 : value.ext) !== "mp4" || !(value !== null && value !== void 0 && value.srcDB))) {
184
- _context17.next = 2;
184
+ _context16.next = 2;
185
185
  break;
186
186
  }
187
187
 
188
- return _context17.abrupt("return", value);
188
+ return _context16.abrupt("return", value);
189
189
 
190
190
  case 2:
191
- _context17.prev = 2;
192
- _context17.next = 5;
191
+ _context16.prev = 2;
192
+ _context16.next = 5;
193
193
  return convertirVideoABase64("https://" + process.env.REACT_APP_IMAGES_BUCKET + ".s3.amazonaws.com/" + value.srcDB);
194
194
 
195
195
  case 5:
196
- base64 = _context17.sent;
196
+ base64 = _context16.sent;
197
197
  videoSrc = "data:video/mp4;base64," + base64.split(",")[1];
198
- _context17.next = 9;
198
+ _context16.next = 9;
199
199
  return (0, _generateThumnail.default)(videoSrc, 2);
200
200
 
201
201
  case 9:
202
- thumbnail = _context17.sent;
203
- return _context17.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
202
+ thumbnail = _context16.sent;
203
+ return _context16.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
204
204
  src: thumbnail
205
205
  }));
206
206
 
207
207
  case 13:
208
- _context17.prev = 13;
209
- _context17.t0 = _context17["catch"](2);
210
- console.error("Error al generar thumbnail del video:", _context17.t0);
211
- return _context17.abrupt("return", value);
208
+ _context16.prev = 13;
209
+ _context16.t0 = _context16["catch"](2);
210
+ console.error("Error al generar thumbnail del video:", _context16.t0);
211
+ return _context16.abrupt("return", value);
212
212
 
213
213
  case 17:
214
214
  case "end":
215
- return _context17.stop();
215
+ return _context16.stop();
216
216
  }
217
217
  }
218
- }, _callee17, null, [[2, 13]]);
218
+ }, _callee16, null, [[2, 13]]);
219
219
  }));
220
220
 
221
- return function (_x10) {
222
- return _ref20.apply(this, arguments);
221
+ return function (_x9) {
222
+ return _ref19.apply(this, arguments);
223
223
  };
224
224
  }())));
225
225
 
226
226
  case 3:
227
227
  case "end":
228
- return _context18.stop();
228
+ return _context17.stop();
229
229
  }
230
230
  }
231
- }, _callee18);
231
+ }, _callee17);
232
232
  }));
233
233
  return _regenerateVideoThumbnails.apply(this, arguments);
234
234
  }
235
235
 
236
236
  var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
237
- var _state$errors, _family$variants, _state$product12, _state$product13, _state$product14, _state$active_retaile5, _location$state, _location$state2, _state$active_retaile6, _state$active_retaile7, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product15, _state$active_retaile8, _state$product16, _state$product17, _state$product18, _family$variants2, _family$variants3, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile9, _state$active_retaile10, _state$active_retaile11, _state$product19, _state$product20, _state$product21, _state$datasheets_inp, _state$datasheets_inp2, _state$product22, _state$images_values12, _state$comment;
237
+ var _state$product10, _family$variants, _state$product11, _state$errors, _family$variants2, _state$product14, _state$product15, _state$product16, _state$active_retaile5, _location$state, _location$state2, _state$active_retaile6, _state$active_retaile7, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product17, _state$active_retaile8, _family$variants3, _family$variants4, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile9, _state$active_retaile10, _state$active_retaile11, _state$product18, _state$services2, _state$services2$data, _state$product19, _state$product20, _state$datasheets_inp, _state$datasheets_inp2, _state$product21, _state$images_values12, _state$comment;
238
238
 
239
239
  var tabsSections = _ref.tabsSections,
240
240
  _ref$productSelected = _ref.productSelected,
@@ -310,7 +310,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
310
310
  var _useState19 = (0, _react.useState)(false),
311
311
  _useState20 = (0, _slicedToArray2.default)(_useState19, 2),
312
312
  rejectAll = _useState20[0],
313
- setRejectAll = _useState20[1]; // Variantes: mismo comportamiento que la ficha de la aplicación de clientes.
313
+ setRejectAll = _useState20[1]; // Padre/hijo: mismo comportamiento que la ficha de la aplicación de clientes.
314
314
 
315
315
 
316
316
  var _useState21 = (0, _react.useState)(false),
@@ -330,43 +330,38 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
330
330
 
331
331
  var _useState27 = (0, _react.useState)(null),
332
332
  _useState28 = (0, _slicedToArray2.default)(_useState27, 2),
333
- loadingVariant = _useState28[0],
334
- setLoadingVariant = _useState28[1];
333
+ pendingPropagation = _useState28[0],
334
+ setPendingPropagation = _useState28[1];
335
335
 
336
- var _useState29 = (0, _react.useState)(null),
336
+ var _useState29 = (0, _react.useState)(false),
337
337
  _useState30 = (0, _slicedToArray2.default)(_useState29, 2),
338
- pendingPropagation = _useState30[0],
339
- setPendingPropagation = _useState30[1];
338
+ preparandoPropagacion = _useState30[0],
339
+ setPreparandoPropagacion = _useState30[1];
340
340
 
341
- var _useState31 = (0, _react.useState)(false),
341
+ var _useState31 = (0, _react.useState)([]),
342
342
  _useState32 = (0, _slicedToArray2.default)(_useState31, 2),
343
- preparandoPropagacion = _useState32[0],
344
- setPreparandoPropagacion = _useState32[1];
343
+ auditServices = _useState32[0],
344
+ setAuditServices = _useState32[1];
345
345
 
346
346
  var _useState33 = (0, _react.useState)([]),
347
347
  _useState34 = (0, _slicedToArray2.default)(_useState33, 2),
348
- auditServices = _useState34[0],
349
- setAuditServices = _useState34[1];
348
+ auditDatasheets = _useState34[0],
349
+ setAuditDatasheets = _useState34[1];
350
350
 
351
351
  var _useState35 = (0, _react.useState)([]),
352
352
  _useState36 = (0, _slicedToArray2.default)(_useState35, 2),
353
- auditDatasheets = _useState36[0],
354
- setAuditDatasheets = _useState36[1];
353
+ auditDescriptions = _useState36[0],
354
+ setAuditDescriptions = _useState36[1];
355
355
 
356
- var _useState37 = (0, _react.useState)([]),
356
+ var _useState37 = (0, _react.useState)(false),
357
357
  _useState38 = (0, _slicedToArray2.default)(_useState37, 2),
358
- auditDescriptions = _useState38[0],
359
- setAuditDescriptions = _useState38[1];
358
+ showModal = _useState38[0],
359
+ setShowModal = _useState38[1];
360
360
 
361
361
  var _useState39 = (0, _react.useState)(false),
362
362
  _useState40 = (0, _slicedToArray2.default)(_useState39, 2),
363
- showModal = _useState40[0],
364
- setShowModal = _useState40[1];
365
-
366
- var _useState41 = (0, _react.useState)(false),
367
- _useState42 = (0, _slicedToArray2.default)(_useState41, 2),
368
- compare = _useState42[0],
369
- setCompare = _useState42[1];
363
+ compare = _useState40[0],
364
+ setCompare = _useState40[1];
370
365
 
371
366
  var _useDropzone = (0, _reactDropzone.useDropzone)({
372
367
  accept: "image/*, video/mp4",
@@ -502,10 +497,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
502
497
  isDragActive = _useDropzone.isDragActive,
503
498
  open = _useDropzone.open;
504
499
 
505
- var _useState43 = (0, _react.useState)(false),
506
- _useState44 = (0, _slicedToArray2.default)(_useState43, 2),
507
- openChangeStatusModal = _useState44[0],
508
- setOpenChangeStatusModal = _useState44[1];
500
+ var _useState41 = (0, _react.useState)(false),
501
+ _useState42 = (0, _slicedToArray2.default)(_useState41, 2),
502
+ openChangeStatusModal = _useState42[0],
503
+ setOpenChangeStatusModal = _useState42[1];
509
504
 
510
505
  var thumbs = function thumbs() {
511
506
  var _state$images_values, _state$images_values$, _state$images_values4, _state$images_values5, _state$images_values6, _state$images_values7, _state$images_values8, _state$images_values9;
@@ -1133,7 +1128,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1133
1128
  }
1134
1129
  };
1135
1130
  /*
1136
- Trae la familia: las variantes del producto, o sus hermanas si el abierto es
1131
+ Trae la familia: los hijos del producto, o sus hermanos si el abierto es
1137
1132
  una de ellas. Se pide al abrir la sección y no al montar la pantalla: la
1138
1133
  mayoría de los productos no son familia.
1139
1134
  */
@@ -1141,22 +1136,28 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1141
1136
 
1142
1137
  var loadFamily = /*#__PURE__*/function () {
1143
1138
  var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
1144
- var _state$product8, res, data;
1139
+ var forzar,
1140
+ _state$product8,
1141
+ res,
1142
+ data,
1143
+ _args5 = arguments;
1145
1144
 
1146
1145
  return _regenerator.default.wrap(function _callee5$(_context5) {
1147
1146
  while (1) {
1148
1147
  switch (_context5.prev = _context5.next) {
1149
1148
  case 0:
1150
- if (!family) {
1151
- _context5.next = 2;
1149
+ forzar = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : false;
1150
+
1151
+ if (!(family && !forzar)) {
1152
+ _context5.next = 3;
1152
1153
  break;
1153
1154
  }
1154
1155
 
1155
1156
  return _context5.abrupt("return", family);
1156
1157
 
1157
- case 2:
1158
- _context5.prev = 2;
1159
- _context5.next = 5;
1158
+ case 3:
1159
+ _context5.prev = 3;
1160
+ _context5.next = 6;
1160
1161
  return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/family"), {
1161
1162
  articleId: (_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.id_article
1162
1163
  }, {
@@ -1165,15 +1166,15 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1165
1166
  }
1166
1167
  });
1167
1168
 
1168
- case 5:
1169
+ case 6:
1169
1170
  res = _context5.sent;
1170
1171
  data = (0, _api.readPayload)(res);
1171
1172
  setFamily(data);
1172
1173
  return _context5.abrupt("return", data);
1173
1174
 
1174
- case 11:
1175
- _context5.prev = 11;
1176
- _context5.t0 = _context5["catch"](2);
1175
+ case 12:
1176
+ _context5.prev = 12;
1177
+ _context5.t0 = _context5["catch"](3);
1177
1178
  console.error("loadFamily: ", _context5.t0);
1178
1179
  setFamily({
1179
1180
  variants: [],
@@ -1182,12 +1183,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1182
1183
  });
1183
1184
  return _context5.abrupt("return", null);
1184
1185
 
1185
- case 16:
1186
+ case 17:
1186
1187
  case "end":
1187
1188
  return _context5.stop();
1188
1189
  }
1189
1190
  }
1190
- }, _callee5, null, [[2, 11]]);
1191
+ }, _callee5, null, [[3, 12]]);
1191
1192
  }));
1192
1193
 
1193
1194
  return function loadFamily() {
@@ -1195,89 +1196,53 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1195
1196
  };
1196
1197
  }();
1197
1198
  /*
1198
- Abre otra variante. Esta pantalla lee el producto de sessionStorage, no de la
1199
- URL, así que hay que dejarlo ahí antes de navegar; si no, cambia la dirección
1200
- y sigue mostrando el producto anterior.
1201
- Se pide por ID y no por UPC: hay 12,024 UPC repetidos entre artículos activos
1202
- y 5,579 de esos casos caen dentro de la misma compañía.
1199
+ En Creators el parentesco se pregunta, no viene con el producto.
1200
+ Su listado sale del endpoint de reportes, que no trae `variantsCount` ni
1201
+ `parentArticleId`: esas columnas se agregaron a las vistas pero DynamoDB no
1202
+ las tiene hasta que se corra el recorrido de datos. Y aunque las tuviera,
1203
+ dependería de lo actualizado que esté ese recorrido.
1204
+ Preguntar a `family` cuesta una llamada por ficha y da el dato de la base, no
1205
+ de una copia. Además aplica el alcance del perfil (§5.1): al equipo interno le
1206
+ devuelve los productos solicitados a ContentOh, que es justo lo que puede
1207
+ tocar.
1203
1208
  */
1204
1209
 
1205
1210
 
1206
- var openVariant = /*#__PURE__*/function () {
1207
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(articleId) {
1208
- var res, _readPayload, data, encontrado;
1209
-
1210
- return _regenerator.default.wrap(function _callee6$(_context6) {
1211
- while (1) {
1212
- switch (_context6.prev = _context6.next) {
1213
- case 0:
1214
- setLoadingVariant(articleId);
1215
- _context6.prev = 1;
1216
- _context6.next = 4;
1217
- return _axios.default.get("".concat(process.env.REACT_APP_NEW_ARTICLES_ENDPOINT), {
1218
- params: {
1219
- listType: "general",
1220
- filterByArticleId: articleId
1221
- },
1222
- headers: {
1223
- Authorization: token
1224
- }
1225
- });
1226
-
1227
- case 4:
1228
- res = _context6.sent;
1229
- _readPayload = (0, _api.readPayload)(res), data = _readPayload.data;
1230
- encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
1231
- return Number(item.id_article) === Number(articleId);
1232
- });
1233
-
1234
- if (encontrado) {
1235
- sessionStorage.setItem("productSelected", JSON.stringify((0, _objectSpread5.default)((0, _objectSpread5.default)({}, encontrado), {}, {
1236
- article: {
1237
- id_article: encontrado.id_article
1238
- }
1239
- })));
1240
- }
1241
-
1242
- _context6.next = 13;
1243
- break;
1244
-
1245
- case 10:
1246
- _context6.prev = 10;
1247
- _context6.t0 = _context6["catch"](1);
1248
- // Se navega igual: dejar el clic sin efecto parecería que no responde.
1249
- console.error("openVariant: ", _context6.t0);
1211
+ (0, _react.useEffect)(function () {
1212
+ var _state$product9;
1250
1213
 
1251
- case 13:
1252
- _context6.prev = 13;
1253
- setLoadingVariant(null);
1254
- window.location.assign("/EditProducts");
1255
- return _context6.finish(13);
1214
+ if (!((_state$product9 = state.product) !== null && _state$product9 !== void 0 && _state$product9.id_article)) return;
1215
+ loadFamily(true); // eslint-disable-next-line react-hooks/exhaustive-deps
1216
+ }, [(_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.id_article]); // El conteo sale de la familia recién consultada, no del producto.
1256
1217
 
1257
- case 17:
1258
- case "end":
1259
- return _context6.stop();
1260
- }
1261
- }
1262
- }, _callee6, null, [[1, 10, 13, 17]]);
1263
- }));
1218
+ var hijosDelProducto = family !== null && family !== void 0 && family.error ? 0 : ((_family$variants = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants !== void 0 ? _family$variants : []).filter(function (v) {
1219
+ return !v.isCurrent;
1220
+ }).length;
1221
+ var esHijoDeOtro = family !== null && family !== void 0 && family.error ? !!((_state$product11 = state.product) !== null && _state$product11 !== void 0 && _state$product11.parentArticleId) : !!(family !== null && family !== void 0 && family.parent);
1222
+ /*
1223
+ En Creators la lista de familia es INFORMATIVA: no se salta a otro producto.
1224
+ Saltar exige precargar el producto destino, y el endpoint que hace eso en la
1225
+ aplicación de clientes —read-articles-v2— filtra por la compañía del usuario:
1226
+ `AND a.company_id = <la del usuario>`. El equipo interno pertenece a ContentOh
1227
+ y trabaja productos de sus clientes, así que ahí no devuelve nada.
1228
+ Navegar sin precargar sería peor que no ofrecerlo: esta pantalla lee el
1229
+ producto de sessionStorage, así que cambiaría la URL y seguiría mostrando el
1230
+ producto anterior, dando a entender que se cambió de producto cuando no.
1231
+ Para habilitarlo hace falta una forma de traer un producto por id sin filtro
1232
+ de compañía, respetando el alcance del perfil interno (§5.1 del contrato).
1233
+ */
1264
1234
 
1265
- return function openVariant(_x3) {
1266
- return _ref9.apply(this, arguments);
1267
- };
1268
- }();
1269
1235
  /*
1270
1236
  Refresca tras ligar, sin recargar: el producto sale de sessionStorage, así que
1271
1237
  un refresh devolvería el mismo objeto y el contador seguiría igual.
1272
1238
  */
1273
1239
 
1274
-
1275
1240
  var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
1276
- var _state$product$varian, _state$product9, _result$linked, _result$parentArticle;
1241
+ var _state$product$varian, _state$product12, _result$linked, _result$parentArticle;
1277
1242
 
1278
1243
  if (!result) return;
1279
1244
  var updatedProduct = result.mode === "children" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1280
- variantsCount: ((_state$product$varian = (_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
1245
+ variantsCount: ((_state$product$varian = (_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
1281
1246
  }) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1282
1247
  parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
1283
1248
  variantsCount: 0
@@ -1299,38 +1264,73 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1299
1264
  el endpoint: recargar la ficha se llevaría lo que haya sin guardar.
1300
1265
  */
1301
1266
 
1267
+ /*
1268
+ `kind` distingue de qué pestaña salió el chip. Las descripciones viven en
1269
+ `rel_article_description` y la ficha técnica en `article_data`: el endpoint
1270
+ recibe una lista o la otra.
1271
+ */
1272
+
1302
1273
 
1303
1274
  var handleOnRestoreInheritance = /*#__PURE__*/function () {
1304
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(attributeId) {
1305
- var _state$product10;
1275
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(attributeId) {
1276
+ var _state$product13;
1306
1277
 
1307
- var res, data;
1308
- return _regenerator.default.wrap(function _callee7$(_context7) {
1278
+ var kind,
1279
+ esDescripcion,
1280
+ res,
1281
+ data,
1282
+ _args6 = arguments;
1283
+ return _regenerator.default.wrap(function _callee6$(_context6) {
1309
1284
  while (1) {
1310
- switch (_context7.prev = _context7.next) {
1285
+ switch (_context6.prev = _context6.next) {
1311
1286
  case 0:
1312
- if (!(!attributeId || !((_state$product10 = state.product) !== null && _state$product10 !== void 0 && _state$product10.id_article))) {
1313
- _context7.next = 2;
1287
+ kind = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : "attribute";
1288
+
1289
+ if (!(!attributeId || !((_state$product13 = state.product) !== null && _state$product13 !== void 0 && _state$product13.id_article))) {
1290
+ _context6.next = 3;
1314
1291
  break;
1315
1292
  }
1316
1293
 
1317
- return _context7.abrupt("return");
1318
-
1319
- case 2:
1320
- _context7.prev = 2;
1321
- _context7.next = 5;
1322
- return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), {
1323
- articleId: state.product.id_article,
1294
+ return _context6.abrupt("return");
1295
+
1296
+ case 3:
1297
+ esDescripcion = kind === "description";
1298
+ _context6.prev = 4;
1299
+ _context6.next = 7;
1300
+ return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread5.default)({
1301
+ articleId: state.product.id_article
1302
+ }, esDescripcion ? {
1303
+ descriptions: [Number(attributeId)]
1304
+ } : {
1324
1305
  attributes: [Number(attributeId)]
1325
- }, {
1306
+ }), {
1326
1307
  headers: {
1327
1308
  Authorization: token
1328
1309
  }
1329
1310
  });
1330
1311
 
1331
- case 5:
1332
- res = _context7.sent;
1312
+ case 7:
1313
+ res = _context6.sent;
1333
1314
  data = (0, _api.readPayload)(res);
1315
+
1316
+ if (!esDescripcion) {
1317
+ _context6.next = 12;
1318
+ break;
1319
+ }
1320
+
1321
+ dispatch({
1322
+ type: "UPDATE_DESCRIPTIONS_INPUTS",
1323
+ payload: (data.descriptionValues || []).map(function (item) {
1324
+ return {
1325
+ attributeId: item.id_description,
1326
+ value: item.value,
1327
+ isOverridden: 0
1328
+ };
1329
+ })
1330
+ });
1331
+ return _context6.abrupt("return");
1332
+
1333
+ case 12:
1334
1334
  dispatch({
1335
1335
  type: "UPDATE_DATASHEETS_INPUTS",
1336
1336
  payload: (data.values || []).map(function (item) {
@@ -1341,24 +1341,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1341
1341
  };
1342
1342
  })
1343
1343
  });
1344
- _context7.next = 13;
1344
+ _context6.next = 18;
1345
1345
  break;
1346
1346
 
1347
- case 10:
1348
- _context7.prev = 10;
1349
- _context7.t0 = _context7["catch"](2);
1350
- console.error("restoreInheritance: ", _context7.t0);
1347
+ case 15:
1348
+ _context6.prev = 15;
1349
+ _context6.t0 = _context6["catch"](4);
1350
+ console.error("restoreInheritance: ", _context6.t0);
1351
1351
 
1352
- case 13:
1352
+ case 18:
1353
1353
  case "end":
1354
- return _context7.stop();
1354
+ return _context6.stop();
1355
1355
  }
1356
1356
  }
1357
- }, _callee7, null, [[2, 10]]);
1357
+ }, _callee6, null, [[4, 15]]);
1358
1358
  }));
1359
1359
 
1360
- return function handleOnRestoreInheritance(_x4) {
1361
- return _ref10.apply(this, arguments);
1360
+ return function handleOnRestoreInheritance(_x3) {
1361
+ return _ref9.apply(this, arguments);
1362
1362
  };
1363
1363
  }();
1364
1364
  /*
@@ -1385,41 +1385,40 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1385
1385
  };
1386
1386
 
1387
1387
  var handleOnClickSave = /*#__PURE__*/function () {
1388
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1389
- var _state$product11, esPadre, cambios;
1390
-
1391
- return _regenerator.default.wrap(function _callee8$(_context8) {
1388
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
1389
+ var esPadre, cambios;
1390
+ return _regenerator.default.wrap(function _callee7$(_context7) {
1392
1391
  while (1) {
1393
- switch (_context8.prev = _context8.next) {
1392
+ switch (_context7.prev = _context7.next) {
1394
1393
  case 0:
1395
1394
  if (!(state.saving || preparandoPropagacion)) {
1396
- _context8.next = 2;
1395
+ _context7.next = 2;
1397
1396
  break;
1398
1397
  }
1399
1398
 
1400
- return _context8.abrupt("return");
1399
+ return _context7.abrupt("return");
1401
1400
 
1402
1401
  case 2:
1403
- _context8.t0 = state.active_tab;
1404
- _context8.next = _context8.t0 === "Descripción" ? 5 : _context8.t0 === "Ficha técnica" ? 8 : _context8.t0 === "Imágenes" ? 17 : 20;
1402
+ _context7.t0 = state.active_tab;
1403
+ _context7.next = _context7.t0 === "Descripción" ? 5 : _context7.t0 === "Ficha técnica" ? 8 : _context7.t0 === "Imágenes" ? 17 : 20;
1405
1404
  break;
1406
1405
 
1407
1406
  case 5:
1408
- _context8.next = 7;
1407
+ _context7.next = 7;
1409
1408
  return saveDescriptions(token);
1410
1409
 
1411
1410
  case 7:
1412
- return _context8.abrupt("break", 21);
1411
+ return _context7.abrupt("break", 21);
1413
1412
 
1414
1413
  case 8:
1415
- // Guardar un padre con variantes abre la decisión de propagar. Sin este
1416
- // paso el cambio se queda solo en el padre y las variantes se van
1414
+ // Guardar un padre con hijos abre la decisión de propagar. Sin este
1415
+ // paso el cambio se queda solo en el padre y los hijos se van
1417
1416
  // separando de él sin que nadie lo note.
1418
- esPadre = ((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.variantsCount) > 0;
1417
+ esPadre = hijosDelProducto > 0;
1419
1418
  cambios = cambiosDeFichaTecnica();
1420
1419
 
1421
1420
  if (!(esPadre && cambios.length > 0)) {
1422
- _context8.next = 14;
1421
+ _context7.next = 14;
1423
1422
  break;
1424
1423
  }
1425
1424
 
@@ -1431,39 +1430,39 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1431
1430
  }).finally(function () {
1432
1431
  return setPreparandoPropagacion(false);
1433
1432
  });
1434
- return _context8.abrupt("return");
1433
+ return _context7.abrupt("return");
1435
1434
 
1436
1435
  case 14:
1437
- _context8.next = 16;
1436
+ _context7.next = 16;
1438
1437
  return saveDatasheets(token);
1439
1438
 
1440
1439
  case 16:
1441
- return _context8.abrupt("break", 21);
1440
+ return _context7.abrupt("break", 21);
1442
1441
 
1443
1442
  case 17:
1444
- _context8.next = 19;
1443
+ _context7.next = 19;
1445
1444
  return updateImages(token);
1446
1445
 
1447
1446
  case 19:
1448
- return _context8.abrupt("break", 21);
1447
+ return _context7.abrupt("break", 21);
1449
1448
 
1450
1449
  case 20:
1451
- return _context8.abrupt("break", 21);
1450
+ return _context7.abrupt("break", 21);
1452
1451
 
1453
1452
  case 21:
1454
- _context8.next = 23;
1453
+ _context7.next = 23;
1455
1454
  return loadData(false);
1456
1455
 
1457
1456
  case 23:
1458
1457
  case "end":
1459
- return _context8.stop();
1458
+ return _context7.stop();
1460
1459
  }
1461
1460
  }
1462
- }, _callee8);
1461
+ }, _callee7);
1463
1462
  }));
1464
1463
 
1465
1464
  return function handleOnClickSave() {
1466
- return _ref11.apply(this, arguments);
1465
+ return _ref10.apply(this, arguments);
1467
1466
  };
1468
1467
  }();
1469
1468
 
@@ -1531,24 +1530,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1531
1530
  };
1532
1531
 
1533
1532
  var handleOnApproveSingleService = /*#__PURE__*/function () {
1534
- var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
1535
- return _regenerator.default.wrap(function _callee9$(_context9) {
1533
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1534
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1536
1535
  while (1) {
1537
- switch (_context9.prev = _context9.next) {
1536
+ switch (_context8.prev = _context8.next) {
1538
1537
  case 0:
1539
- _context9.next = 2;
1538
+ _context8.next = 2;
1540
1539
  return sendSingleEvaluation("A");
1541
1540
 
1542
1541
  case 2:
1543
1542
  case "end":
1544
- return _context9.stop();
1543
+ return _context8.stop();
1545
1544
  }
1546
1545
  }
1547
- }, _callee9);
1546
+ }, _callee8);
1548
1547
  }));
1549
1548
 
1550
1549
  return function handleOnApproveSingleService() {
1551
- return _ref12.apply(this, arguments);
1550
+ return _ref11.apply(this, arguments);
1552
1551
  };
1553
1552
  }();
1554
1553
 
@@ -1557,21 +1556,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1557
1556
  };
1558
1557
 
1559
1558
  var sendSingleEvaluation = /*#__PURE__*/function () {
1560
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
1559
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
1561
1560
  var _state$product$id_ord, _state$active_retaile4;
1562
1561
 
1563
1562
  var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, articleStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _articleStatus, updatedStatusByRetailerForSend, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
1564
1563
 
1565
- return _regenerator.default.wrap(function _callee10$(_context10) {
1564
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1566
1565
  while (1) {
1567
- switch (_context10.prev = _context10.next) {
1566
+ switch (_context9.prev = _context9.next) {
1568
1567
  case 0:
1569
1568
  if (!state.saving) {
1570
- _context10.next = 2;
1569
+ _context9.next = 2;
1571
1570
  break;
1572
1571
  }
1573
1572
 
1574
- return _context10.abrupt("return");
1573
+ return _context9.abrupt("return");
1575
1574
 
1576
1575
  case 2:
1577
1576
  dispatch({
@@ -1592,16 +1591,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1592
1591
  retailerId: retailerId
1593
1592
  };
1594
1593
  activeTab = state.active_tab;
1595
- _context10.prev = 11;
1594
+ _context9.prev = 11;
1596
1595
 
1597
1596
  if (!result) {
1598
- _context10.next = 28;
1597
+ _context9.next = 28;
1599
1598
  break;
1600
1599
  }
1601
1600
 
1602
1601
  data.result = result;
1603
1602
  data.retailerId = retailerId;
1604
- _context10.next = 17;
1603
+ _context9.next = 17;
1605
1604
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1606
1605
  headers: {
1607
1606
  Authorization: token
@@ -1609,7 +1608,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1609
1608
  });
1610
1609
 
1611
1610
  case 17:
1612
- res = _context10.sent;
1611
+ res = _context9.sent;
1613
1612
  newStatuses = JSON.parse(res.data.body);
1614
1613
  serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
1615
1614
  articleStatus = newStatuses.newArticleStatus[articleId];
@@ -1640,7 +1639,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1640
1639
  image: _genericModalCheck.default
1641
1640
  }
1642
1641
  });
1643
- _context10.next = 33;
1642
+ _context9.next = 33;
1644
1643
  break;
1645
1644
 
1646
1645
  case 28:
@@ -1656,7 +1655,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1656
1655
  icon = _genericModalCheck.default;
1657
1656
  }
1658
1657
 
1659
- _context10.next = 32;
1658
+ _context9.next = 32;
1660
1659
  return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1661
1660
  headers: {
1662
1661
  Authorization: token
@@ -1664,7 +1663,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1664
1663
  });
1665
1664
 
1666
1665
  case 32:
1667
- res = _context10.sent;
1666
+ res = _context9.sent;
1668
1667
 
1669
1668
  case 33:
1670
1669
  if (res.data.statusCode === 200) {
@@ -1749,13 +1748,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1749
1748
  });
1750
1749
  }
1751
1750
 
1752
- _context10.next = 40;
1751
+ _context9.next = 40;
1753
1752
  break;
1754
1753
 
1755
1754
  case 36:
1756
- _context10.prev = 36;
1757
- _context10.t0 = _context10["catch"](11);
1758
- console.error("Error sending evaluation:", _context10.t0);
1755
+ _context9.prev = 36;
1756
+ _context9.t0 = _context9["catch"](11);
1757
+ console.error("Error sending evaluation:", _context9.t0);
1759
1758
  dispatch({
1760
1759
  type: "SET_MODAL",
1761
1760
  payload: {
@@ -1767,45 +1766,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1767
1766
  });
1768
1767
 
1769
1768
  case 40:
1770
- _context10.prev = 40;
1769
+ _context9.prev = 40;
1771
1770
  dispatch({
1772
1771
  type: "SET_SAVING",
1773
1772
  payload: false
1774
1773
  });
1775
- return _context10.finish(40);
1774
+ return _context9.finish(40);
1776
1775
 
1777
1776
  case 43:
1778
1777
  case "end":
1779
- return _context10.stop();
1778
+ return _context9.stop();
1780
1779
  }
1781
1780
  }
1782
- }, _callee10, null, [[11, 36, 40, 43]]);
1781
+ }, _callee9, null, [[11, 36, 40, 43]]);
1783
1782
  }));
1784
1783
 
1785
- return function sendSingleEvaluation(_x5) {
1786
- return _ref13.apply(this, arguments);
1784
+ return function sendSingleEvaluation(_x4) {
1785
+ return _ref12.apply(this, arguments);
1787
1786
  };
1788
1787
  }();
1789
1788
 
1790
1789
  var handleOnApproveAllServices = /*#__PURE__*/function () {
1791
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1792
- return _regenerator.default.wrap(function _callee11$(_context11) {
1790
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1791
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1793
1792
  while (1) {
1794
- switch (_context11.prev = _context11.next) {
1793
+ switch (_context10.prev = _context10.next) {
1795
1794
  case 0:
1796
- _context11.next = 2;
1795
+ _context10.next = 2;
1797
1796
  return sendBulkEvaluation("A");
1798
1797
 
1799
1798
  case 2:
1800
1799
  case "end":
1801
- return _context11.stop();
1800
+ return _context10.stop();
1802
1801
  }
1803
1802
  }
1804
- }, _callee11);
1803
+ }, _callee10);
1805
1804
  }));
1806
1805
 
1807
1806
  return function handleOnApproveAllServices() {
1808
- return _ref14.apply(this, arguments);
1807
+ return _ref13.apply(this, arguments);
1809
1808
  };
1810
1809
  }();
1811
1810
 
@@ -1815,18 +1814,18 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1815
1814
  };
1816
1815
 
1817
1816
  var sendBulkEvaluation = /*#__PURE__*/function () {
1818
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(result) {
1817
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
1819
1818
  var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, updatedServicesData;
1820
1819
 
1821
- return _regenerator.default.wrap(function _callee12$(_context12) {
1820
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1822
1821
  while (1) {
1823
- switch (_context12.prev = _context12.next) {
1822
+ switch (_context11.prev = _context11.next) {
1824
1823
  case 0:
1825
1824
  dispatch({
1826
1825
  type: "SET_SAVING",
1827
1826
  payload: true
1828
1827
  });
1829
- _context12.prev = 1;
1828
+ _context11.prev = 1;
1830
1829
  evaluationArray = [];
1831
1830
  conceptArray = (0, _utils.getConceptsByRole)(user.id_role);
1832
1831
  (_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret, idx) {
@@ -1851,7 +1850,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1851
1850
  }));
1852
1851
  }
1853
1852
  });
1854
- _context12.next = 7;
1853
+ _context11.next = 7;
1855
1854
  return Promise.all(evaluationArray);
1856
1855
 
1857
1856
  case 7:
@@ -1906,41 +1905,41 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1906
1905
  image: _genericModalCheck.default
1907
1906
  }
1908
1907
  });
1909
- _context12.next = 19;
1908
+ _context11.next = 19;
1910
1909
  break;
1911
1910
 
1912
1911
  case 16:
1913
- _context12.prev = 16;
1914
- _context12.t0 = _context12["catch"](1);
1915
- console.error("Error in bulk evaluation:", _context12.t0);
1912
+ _context11.prev = 16;
1913
+ _context11.t0 = _context11["catch"](1);
1914
+ console.error("Error in bulk evaluation:", _context11.t0);
1916
1915
 
1917
1916
  case 19:
1918
- _context12.prev = 19;
1917
+ _context11.prev = 19;
1919
1918
  dispatch({
1920
1919
  type: "SET_SAVING",
1921
1920
  payload: false
1922
1921
  });
1923
- return _context12.finish(19);
1922
+ return _context11.finish(19);
1924
1923
 
1925
1924
  case 22:
1926
1925
  case "end":
1927
- return _context12.stop();
1926
+ return _context11.stop();
1928
1927
  }
1929
1928
  }
1930
- }, _callee12, null, [[1, 16, 19, 22]]);
1929
+ }, _callee11, null, [[1, 16, 19, 22]]);
1931
1930
  }));
1932
1931
 
1933
- return function sendBulkEvaluation(_x6) {
1934
- return _ref15.apply(this, arguments);
1932
+ return function sendBulkEvaluation(_x5) {
1933
+ return _ref14.apply(this, arguments);
1935
1934
  };
1936
1935
  }();
1937
1936
 
1938
1937
  var handleOnChangeAssignations = /*#__PURE__*/function () {
1939
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(assignationType, assignationId) {
1938
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(assignationType, assignationId) {
1940
1939
  var concept, data, updatedProduct;
1941
- return _regenerator.default.wrap(function _callee13$(_context13) {
1940
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1942
1941
  while (1) {
1943
- switch (_context13.prev = _context13.next) {
1942
+ switch (_context12.prev = _context12.next) {
1944
1943
  case 0:
1945
1944
  concept = (0, _utils.getConceptByTab)(state.active_tab);
1946
1945
  data = {
@@ -1951,7 +1950,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1951
1950
  concept: concept,
1952
1951
  userId: assignationId
1953
1952
  };
1954
- _context13.next = 4;
1953
+ _context12.next = 4;
1955
1954
  return (0, _axios.default)({
1956
1955
  method: "post",
1957
1956
  url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
@@ -1970,14 +1969,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1970
1969
 
1971
1970
  case 6:
1972
1971
  case "end":
1973
- return _context13.stop();
1972
+ return _context12.stop();
1974
1973
  }
1975
1974
  }
1976
- }, _callee13);
1975
+ }, _callee12);
1977
1976
  }));
1978
1977
 
1979
- return function handleOnChangeAssignations(_x7, _x8) {
1980
- return _ref16.apply(this, arguments);
1978
+ return function handleOnChangeAssignations(_x6, _x7) {
1979
+ return _ref15.apply(this, arguments);
1981
1980
  };
1982
1981
  }();
1983
1982
 
@@ -2012,16 +2011,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2012
2011
  };
2013
2012
 
2014
2013
  var handleOnSubmitComment = /*#__PURE__*/function () {
2015
- var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(e) {
2014
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(e) {
2016
2015
  var commentText;
2017
- return _regenerator.default.wrap(function _callee14$(_context14) {
2016
+ return _regenerator.default.wrap(function _callee13$(_context13) {
2018
2017
  while (1) {
2019
- switch (_context14.prev = _context14.next) {
2018
+ switch (_context13.prev = _context13.next) {
2020
2019
  case 0:
2021
2020
  e.preventDefault();
2022
2021
  commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
2023
- _context14.prev = 2;
2024
- _context14.next = 5;
2022
+ _context13.prev = 2;
2023
+ _context13.next = 5;
2025
2024
  return createComment(commentText, token);
2026
2025
 
2027
2026
  case 5:
@@ -2034,13 +2033,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2034
2033
  image: _genericModalCheck.default
2035
2034
  }
2036
2035
  });
2037
- _context14.next = 12;
2036
+ _context13.next = 12;
2038
2037
  break;
2039
2038
 
2040
2039
  case 8:
2041
- _context14.prev = 8;
2042
- _context14.t0 = _context14["catch"](2);
2043
- console.error("Error saving comment:", _context14.t0);
2040
+ _context13.prev = 8;
2041
+ _context13.t0 = _context13["catch"](2);
2042
+ console.error("Error saving comment:", _context13.t0);
2044
2043
  dispatch({
2045
2044
  type: "SET_MODAL",
2046
2045
  payload: {
@@ -2053,14 +2052,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2053
2052
 
2054
2053
  case 12:
2055
2054
  case "end":
2056
- return _context14.stop();
2055
+ return _context13.stop();
2057
2056
  }
2058
2057
  }
2059
- }, _callee14, null, [[2, 8]]);
2058
+ }, _callee13, null, [[2, 8]]);
2060
2059
  }));
2061
2060
 
2062
- return function handleOnSubmitComment(_x9) {
2063
- return _ref17.apply(this, arguments);
2061
+ return function handleOnSubmitComment(_x8) {
2062
+ return _ref16.apply(this, arguments);
2064
2063
  };
2065
2064
  }();
2066
2065
 
@@ -2383,7 +2382,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2383
2382
  headerTop: headerTop,
2384
2383
  children: [pendingPropagation && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PropagateChangesModal.PropagateChangesModal, {
2385
2384
  changedAttributes: pendingPropagation.cambios,
2386
- variants: ((_family$variants = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants !== void 0 ? _family$variants : []).filter(function (v) {
2385
+ variants: ((_family$variants2 = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants2 !== void 0 ? _family$variants2 : []).filter(function (v) {
2387
2386
  return !v.isCurrent;
2388
2387
  }),
2389
2388
  saving: state.saving,
@@ -2395,9 +2394,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2395
2394
  saveDatasheets(token, propagation !== null && propagation !== void 0 ? propagation : undefined);
2396
2395
  }
2397
2396
  }), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
2398
- articleId: (_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.id_article,
2399
- articleName: (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.name,
2400
- articleUpc: (_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.upc,
2397
+ articleId: (_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.id_article,
2398
+ articleName: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.name,
2399
+ articleUpc: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.upc,
2401
2400
  activeRetailerId: (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.id_retailer,
2402
2401
  token: token,
2403
2402
  onClose: function onClose() {
@@ -2424,21 +2423,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2424
2423
  type: "pink",
2425
2424
  label: "Aceptar",
2426
2425
  size: 12,
2427
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
2426
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
2428
2427
  var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
2429
- return _regenerator.default.wrap(function _callee15$(_context15) {
2428
+ return _regenerator.default.wrap(function _callee14$(_context14) {
2430
2429
  while (1) {
2431
- switch (_context15.prev = _context15.next) {
2430
+ switch (_context14.prev = _context14.next) {
2432
2431
  case 0:
2433
2432
  elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
2434
2433
 
2435
2434
  if (!(!elements || elements.length === 0)) {
2436
- _context15.next = 4;
2435
+ _context14.next = 4;
2437
2436
  break;
2438
2437
  }
2439
2438
 
2440
2439
  console.error("Elemento no encontrado");
2441
- return _context15.abrupt("return");
2440
+ return _context14.abrupt("return");
2442
2441
 
2443
2442
  case 4:
2444
2443
  isMessageEmpty = Array.from(elements).every(function (el) {
@@ -2447,7 +2446,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2447
2446
  });
2448
2447
 
2449
2448
  if (!isMessageEmpty) {
2450
- _context15.next = 10;
2449
+ _context14.next = 10;
2451
2450
  break;
2452
2451
  }
2453
2452
 
@@ -2462,13 +2461,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2462
2461
  container.appendChild(alert);
2463
2462
  }
2464
2463
 
2465
- return _context15.abrupt("return");
2464
+ return _context14.abrupt("return");
2466
2465
 
2467
2466
  case 10:
2468
2467
  fullMessage = Array.from(elements).map(function (element) {
2469
2468
  return element.innerHTML;
2470
2469
  }).join("").replace(/<br\s*\/?>/gi, "\n");
2471
- _context15.next = 13;
2470
+ _context14.next = 13;
2472
2471
  return createComment(fullMessage, token);
2473
2472
 
2474
2473
  case 13:
@@ -2477,10 +2476,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2477
2476
 
2478
2477
  case 15:
2479
2478
  case "end":
2480
- return _context15.stop();
2479
+ return _context14.stop();
2481
2480
  }
2482
2481
  }
2483
- }, _callee15);
2482
+ }, _callee14);
2484
2483
  }))
2485
2484
  }, "btn-Aceptar")]
2486
2485
  }), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
@@ -2558,7 +2557,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2558
2557
  lists: state.images_values || [],
2559
2558
  activeImage: (_state$images_values10 = state.images_values) !== null && _state$images_values10 !== void 0 && _state$images_values10.values ? (_state$images_values11 = state.images_values) === null || _state$images_values11 === void 0 ? void 0 : _state$images_values11.values[state.current_image] : {},
2560
2559
  assignationsImages: state.collaborator_assignations["Imágenes"],
2561
- imagesStatus: ((_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.images_status) || "-",
2560
+ imagesStatus: ((_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.images_status) || "-",
2562
2561
  retailerSelected: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.id_retailer,
2563
2562
  isRetailer: isRetailer,
2564
2563
  version: state.product.version,
@@ -2573,7 +2572,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2573
2572
  })]
2574
2573
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2575
2574
  className: "product-information",
2576
- children: [!((_state$product16 = state.product) !== null && _state$product16 !== void 0 && _state$product16.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2575
+ children: [!esHijoDeOtro && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2577
2576
  className: "variants-actions",
2578
2577
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
2579
2578
  type: "button",
@@ -2582,7 +2581,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2582
2581
  return setShowLinkVariants(true);
2583
2582
  },
2584
2583
  children: "Ligar productos"
2585
- }), ((_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2584
+ }), hijosDelProducto > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2586
2585
  type: "button",
2587
2586
  className: "variants-count",
2588
2587
  "aria-expanded": showFamily,
@@ -2592,12 +2591,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2592
2591
  });
2593
2592
  loadFamily();
2594
2593
  },
2595
- children: [state.product.variantsCount, " variante", state.product.variantsCount === 1 ? "" : "s", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2594
+ children: [hijosDelProducto, " hijo", hijosDelProducto === 1 ? "" : "s", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2596
2595
  "aria-hidden": "true",
2597
2596
  children: showFamily ? " ▴" : " ▾"
2598
2597
  })]
2599
2598
  })]
2600
- }), ((_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2599
+ }), esHijoDeOtro && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2601
2600
  className: "variants-actions",
2602
2601
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2603
2602
  type: "button",
@@ -2609,7 +2608,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2609
2608
  });
2610
2609
  loadFamily();
2611
2610
  },
2612
- children: ["Variante de otro producto", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2611
+ children: ["Hijo de otro producto", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2613
2612
  "aria-hidden": "true",
2614
2613
  children: showFamily ? " ▴" : " ▾"
2615
2614
  })]
@@ -2622,16 +2621,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2622
2621
  }), (family === null || family === void 0 ? void 0 : family.error) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
2623
2622
  className: "loading",
2624
2623
  children: "No se pudo cargar la familia de este producto."
2625
- }), (family === null || family === void 0 ? void 0 : family.parent) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2626
- type: "button",
2624
+ }), (family === null || family === void 0 ? void 0 : family.parent) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2627
2625
  className: "family-row parent",
2628
- disabled: loadingVariant !== null,
2629
- onClick: function onClick() {
2630
- return openVariant(family.parent.articleId);
2631
- },
2632
2626
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2633
2627
  className: "role",
2634
- children: loadingVariant === family.parent.articleId ? "Abriendo…" : "Producto padre"
2628
+ children: "Producto padre"
2635
2629
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2636
2630
  className: "name",
2637
2631
  children: family.parent.name
@@ -2639,17 +2633,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2639
2633
  className: "upc",
2640
2634
  children: family.parent.upc
2641
2635
  })]
2642
- }), family === null || family === void 0 ? void 0 : (_family$variants2 = family.variants) === null || _family$variants2 === void 0 ? void 0 : _family$variants2.map(function (variant) {
2643
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2644
- type: "button",
2636
+ }), family === null || family === void 0 ? void 0 : (_family$variants3 = family.variants) === null || _family$variants3 === void 0 ? void 0 : _family$variants3.map(function (variant) {
2637
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2645
2638
  className: "family-row".concat(variant.isCurrent ? " current" : ""),
2646
- disabled: variant.isCurrent || loadingVariant !== null,
2647
- onClick: function onClick() {
2648
- return openVariant(variant.articleId);
2649
- },
2650
2639
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2651
2640
  className: "role",
2652
- children: loadingVariant === variant.articleId ? "Abriendo…" : variant.isCurrent ? "Estás aquí" : "Variante"
2641
+ children: variant.isCurrent ? "Estás aquí" : "Hijo"
2653
2642
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2654
2643
  className: "name",
2655
2644
  children: variant.name
@@ -2658,9 +2647,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2658
2647
  children: variant.upc
2659
2648
  })]
2660
2649
  }, variant.articleId);
2661
- }), family && !family.error && !((_family$variants3 = family.variants) !== null && _family$variants3 !== void 0 && _family$variants3.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
2650
+ }), family && !family.error && !((_family$variants4 = family.variants) !== null && _family$variants4 !== void 0 && _family$variants4.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
2662
2651
  className: "loading",
2663
- children: "Este producto no tiene variantes."
2652
+ children: "Este producto no tiene hijos."
2664
2653
  })]
2665
2654
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader // states
2666
2655
  , {
@@ -2720,11 +2709,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2720
2709
  className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
2721
2710
  id: "services-information-container",
2722
2711
  children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2723
- children: [state.active_tab === "Descripción" && (((_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
2712
+ children: [state.active_tab === "Descripción" && (((_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
2724
2713
  activeSection: state.active_tab,
2725
2714
  inputGroup: state.descriptions_inputs[0],
2726
- updatedDescriptions: state.updated_descriptions_inputs,
2727
- articleId: (_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.id_article,
2715
+ updatedDescriptions: state.updated_descriptions_inputs
2716
+ /* El parentesco es del producto, no del servicio: los
2717
+ dos endpoints lo devuelven igual. */
2718
+ ,
2719
+ variant: (_state$services2 = state.services) === null || _state$services2 === void 0 ? void 0 : (_state$services2$data = _state$services2.datasheets) === null || _state$services2$data === void 0 ? void 0 : _state$services2$data.variant,
2720
+ onRestoreInheritance: handleOnRestoreInheritance,
2721
+ articleId: (_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.id_article,
2728
2722
  version: state.product.version,
2729
2723
  auditInputGroup: auditDescriptions[0],
2730
2724
  setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
@@ -2733,9 +2727,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2733
2727
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
2734
2728
  text: "No cuentas con este servicio",
2735
2729
  headerType: "input-name-header"
2736
- })), state.active_tab === "Ficha técnica" && (((_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
2730
+ })), state.active_tab === "Ficha técnica" && (((_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
2737
2731
  children: (_state$datasheets_inp = state.datasheets_inputs[0]) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp.data) === null || _state$datasheets_inp2 === void 0 ? void 0 : _state$datasheets_inp2.map(function (dataGroup, index) {
2738
- var _state$services2, _state$services2$data;
2732
+ var _state$services3, _state$services3$data;
2739
2733
 
2740
2734
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
2741
2735
  articleId: state.product.id_article,
@@ -2743,7 +2737,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2743
2737
  activeSection: state.active_tab,
2744
2738
  inputGroup: dataGroup,
2745
2739
  dataInputs: state.datasheets_inputs[1],
2746
- variant: (_state$services2 = state.services) === null || _state$services2 === void 0 ? void 0 : (_state$services2$data = _state$services2.datasheets) === null || _state$services2$data === void 0 ? void 0 : _state$services2$data.variant,
2740
+ variant: (_state$services3 = state.services) === null || _state$services3 === void 0 ? void 0 : (_state$services3$data = _state$services3.datasheets) === null || _state$services3$data === void 0 ? void 0 : _state$services3$data.variant,
2747
2741
  onRestoreInheritance: handleOnRestoreInheritance,
2748
2742
  auditInputs: auditDatasheets[1],
2749
2743
  updatedDatasheets: state.updated_datasheets_inputs,
@@ -2754,7 +2748,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2754
2748
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
2755
2749
  text: "No cuentas con este servicio",
2756
2750
  headerType: "input-name-header"
2757
- })), state.active_tab === "Imágenes" && (((_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2751
+ })), state.active_tab === "Imágenes" && (((_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2758
2752
  children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
2759
2753
  checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
2760
2754
  ,
@@ -2846,20 +2840,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2846
2840
  reviewed: crossComment
2847
2841
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
2848
2842
  buttonType: "circular-button accept-button",
2849
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
2850
- return _regenerator.default.wrap(function _callee16$(_context16) {
2843
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
2844
+ return _regenerator.default.wrap(function _callee15$(_context15) {
2851
2845
  while (1) {
2852
- switch (_context16.prev = _context16.next) {
2846
+ switch (_context15.prev = _context15.next) {
2853
2847
  case 0:
2854
2848
  setCrossComment(true);
2855
2849
  commentRevised();
2856
2850
 
2857
2851
  case 2:
2858
2852
  case "end":
2859
- return _context16.stop();
2853
+ return _context15.stop();
2860
2854
  }
2861
2855
  }
2862
- }, _callee16);
2856
+ }, _callee15);
2863
2857
  }))
2864
2858
  })]
2865
2859
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {