contentoh-components-library 21.6.34 → 21.6.36

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.
@@ -75,6 +75,8 @@ var _Modal = require("../../organisms/Modal");
75
75
 
76
76
  var _LinkVariantsModal = require("../../organisms/LinkVariantsModal");
77
77
 
78
+ var _UnlinkVariantModal = require("../../organisms/UnlinkVariantModal");
79
+
78
80
  var _PropagateChangesModal = require("../../organisms/PropagateChangesModal");
79
81
 
80
82
  var _api = require("../../organisms/LinkVariantsModal/api");
@@ -160,81 +162,81 @@ function regenerateVideoThumbnails(_x) {
160
162
  }
161
163
 
162
164
  function _regenerateVideoThumbnails() {
163
- _regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(values) {
164
- return _regenerator.default.wrap(function _callee17$(_context17) {
165
+ _regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(values) {
166
+ return _regenerator.default.wrap(function _callee18$(_context18) {
165
167
  while (1) {
166
- switch (_context17.prev = _context17.next) {
168
+ switch (_context18.prev = _context18.next) {
167
169
  case 0:
168
170
  if (Array.isArray(values)) {
169
- _context17.next = 2;
171
+ _context18.next = 2;
170
172
  break;
171
173
  }
172
174
 
173
- return _context17.abrupt("return", values);
175
+ return _context18.abrupt("return", values);
174
176
 
175
177
  case 2:
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
+ return _context18.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
179
+ var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(value) {
178
180
  var base64, videoSrc, thumbnail;
179
- return _regenerator.default.wrap(function _callee16$(_context16) {
181
+ return _regenerator.default.wrap(function _callee17$(_context17) {
180
182
  while (1) {
181
- switch (_context16.prev = _context16.next) {
183
+ switch (_context17.prev = _context17.next) {
182
184
  case 0:
183
185
  if (!((value === null || value === void 0 ? void 0 : value.ext) !== "mp4" || !(value !== null && value !== void 0 && value.srcDB))) {
184
- _context16.next = 2;
186
+ _context17.next = 2;
185
187
  break;
186
188
  }
187
189
 
188
- return _context16.abrupt("return", value);
190
+ return _context17.abrupt("return", value);
189
191
 
190
192
  case 2:
191
- _context16.prev = 2;
192
- _context16.next = 5;
193
+ _context17.prev = 2;
194
+ _context17.next = 5;
193
195
  return convertirVideoABase64("https://" + process.env.REACT_APP_IMAGES_BUCKET + ".s3.amazonaws.com/" + value.srcDB);
194
196
 
195
197
  case 5:
196
- base64 = _context16.sent;
198
+ base64 = _context17.sent;
197
199
  videoSrc = "data:video/mp4;base64," + base64.split(",")[1];
198
- _context16.next = 9;
200
+ _context17.next = 9;
199
201
  return (0, _generateThumnail.default)(videoSrc, 2);
200
202
 
201
203
  case 9:
202
- thumbnail = _context16.sent;
203
- return _context16.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
204
+ thumbnail = _context17.sent;
205
+ return _context17.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
204
206
  src: thumbnail
205
207
  }));
206
208
 
207
209
  case 13:
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);
210
+ _context17.prev = 13;
211
+ _context17.t0 = _context17["catch"](2);
212
+ console.error("Error al generar thumbnail del video:", _context17.t0);
213
+ return _context17.abrupt("return", value);
212
214
 
213
215
  case 17:
214
216
  case "end":
215
- return _context16.stop();
217
+ return _context17.stop();
216
218
  }
217
219
  }
218
- }, _callee16, null, [[2, 13]]);
220
+ }, _callee17, null, [[2, 13]]);
219
221
  }));
220
222
 
221
- return function (_x9) {
222
- return _ref19.apply(this, arguments);
223
+ return function (_x10) {
224
+ return _ref21.apply(this, arguments);
223
225
  };
224
226
  }())));
225
227
 
226
228
  case 3:
227
229
  case "end":
228
- return _context17.stop();
230
+ return _context18.stop();
229
231
  }
230
232
  }
231
- }, _callee17);
233
+ }, _callee18);
232
234
  }));
233
235
  return _regenerateVideoThumbnails.apply(this, arguments);
234
236
  }
235
237
 
236
238
  var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
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;
239
+ var _state$product10, _family$variants, _state$product11, _state$errors, _family$variants2, _state$product15, _state$product16, _state$product17, _state$active_retaile5, _location$state, _location$state2, _state$active_retaile6, _state$active_retaile7, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product18, _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$product24, _state$services2, _state$services2$data, _state$product25, _state$product26, _state$datasheets_inp, _state$datasheets_inp2, _state$product27, _state$images_values12, _state$comment;
238
240
 
239
241
  var tabsSections = _ref.tabsSections,
240
242
  _ref$productSelected = _ref.productSelected,
@@ -330,38 +332,57 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
330
332
 
331
333
  var _useState27 = (0, _react.useState)(null),
332
334
  _useState28 = (0, _slicedToArray2.default)(_useState27, 2),
333
- pendingPropagation = _useState28[0],
334
- setPendingPropagation = _useState28[1];
335
+ loadingVariant = _useState28[0],
336
+ setLoadingVariant = _useState28[1]; // Qué vínculo se está por romper, o null si no hay diálogo abierto. Guarda al
337
+ // HIJO, que es quien lleva la relación y lo que pide la acción `unlink`.
338
+
335
339
 
336
- var _useState29 = (0, _react.useState)(false),
340
+ var _useState29 = (0, _react.useState)(null),
337
341
  _useState30 = (0, _slicedToArray2.default)(_useState29, 2),
338
- preparandoPropagacion = _useState30[0],
339
- setPreparandoPropagacion = _useState30[1];
342
+ porDesvincular = _useState30[0],
343
+ setPorDesvincular = _useState30[1]; // Por qué un salto no se pudo hacer. Vive aparte de `family.error` porque no
344
+ // es un fallo al leer la familia, sino al abrir uno de sus miembros.
345
+
340
346
 
341
- var _useState31 = (0, _react.useState)([]),
347
+ var _useState31 = (0, _react.useState)(null),
342
348
  _useState32 = (0, _slicedToArray2.default)(_useState31, 2),
343
- auditServices = _useState32[0],
344
- setAuditServices = _useState32[1];
349
+ avisoFamilia = _useState32[0],
350
+ setAvisoFamilia = _useState32[1];
345
351
 
346
- var _useState33 = (0, _react.useState)([]),
352
+ var _useState33 = (0, _react.useState)(null),
347
353
  _useState34 = (0, _slicedToArray2.default)(_useState33, 2),
348
- auditDatasheets = _useState34[0],
349
- setAuditDatasheets = _useState34[1];
354
+ pendingPropagation = _useState34[0],
355
+ setPendingPropagation = _useState34[1];
350
356
 
351
- var _useState35 = (0, _react.useState)([]),
357
+ var _useState35 = (0, _react.useState)(false),
352
358
  _useState36 = (0, _slicedToArray2.default)(_useState35, 2),
353
- auditDescriptions = _useState36[0],
354
- setAuditDescriptions = _useState36[1];
359
+ preparandoPropagacion = _useState36[0],
360
+ setPreparandoPropagacion = _useState36[1];
355
361
 
356
- var _useState37 = (0, _react.useState)(false),
362
+ var _useState37 = (0, _react.useState)([]),
357
363
  _useState38 = (0, _slicedToArray2.default)(_useState37, 2),
358
- showModal = _useState38[0],
359
- setShowModal = _useState38[1];
364
+ auditServices = _useState38[0],
365
+ setAuditServices = _useState38[1];
360
366
 
361
- var _useState39 = (0, _react.useState)(false),
367
+ var _useState39 = (0, _react.useState)([]),
362
368
  _useState40 = (0, _slicedToArray2.default)(_useState39, 2),
363
- compare = _useState40[0],
364
- setCompare = _useState40[1];
369
+ auditDatasheets = _useState40[0],
370
+ setAuditDatasheets = _useState40[1];
371
+
372
+ var _useState41 = (0, _react.useState)([]),
373
+ _useState42 = (0, _slicedToArray2.default)(_useState41, 2),
374
+ auditDescriptions = _useState42[0],
375
+ setAuditDescriptions = _useState42[1];
376
+
377
+ var _useState43 = (0, _react.useState)(false),
378
+ _useState44 = (0, _slicedToArray2.default)(_useState43, 2),
379
+ showModal = _useState44[0],
380
+ setShowModal = _useState44[1];
381
+
382
+ var _useState45 = (0, _react.useState)(false),
383
+ _useState46 = (0, _slicedToArray2.default)(_useState45, 2),
384
+ compare = _useState46[0],
385
+ setCompare = _useState46[1];
365
386
 
366
387
  var _useDropzone = (0, _reactDropzone.useDropzone)({
367
388
  accept: "image/*, video/mp4",
@@ -497,10 +518,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
497
518
  isDragActive = _useDropzone.isDragActive,
498
519
  open = _useDropzone.open;
499
520
 
500
- var _useState41 = (0, _react.useState)(false),
501
- _useState42 = (0, _slicedToArray2.default)(_useState41, 2),
502
- openChangeStatusModal = _useState42[0],
503
- setOpenChangeStatusModal = _useState42[1];
521
+ var _useState47 = (0, _react.useState)(false),
522
+ _useState48 = (0, _slicedToArray2.default)(_useState47, 2),
523
+ openChangeStatusModal = _useState48[0],
524
+ setOpenChangeStatusModal = _useState48[1];
504
525
 
505
526
  var thumbs = function thumbs() {
506
527
  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;
@@ -1220,30 +1241,175 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1220
1241
  }).length;
1221
1242
  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
1243
  /*
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).
1244
+ Abre otro producto de la familia.
1245
+ Cambiar la URL no basta: esta pantalla no lee el producto de la ruta sino de
1246
+ sessionStorage —el router hace JSON.parse(sessionStorage.productSelected) y
1247
+ se lo pasa como prop—, así que navegar sin precargar dejaría la URL nueva
1248
+ mostrando el producto anterior. Por eso primero se trae el destino y se
1249
+ escriben las tres llaves que el listado escribe al hacer clic en una fila
1250
+ (productSelected, version, productEdit), y solo entonces se navega.
1251
+ Se pide a /ordered-services y no a read-articles-v2, que es lo que usa la
1252
+ aplicación de clientes: aquel filtra por la compañía del usuario y el equipo
1253
+ interno es de ContentOh trabajando productos de sus clientes, así que ahí no
1254
+ devolvería nada. /ordered-services es el mismo endpoint del listado de esta
1255
+ aplicación, así que el objeto llega con la forma exacta que normalizeProduct
1256
+ espera —con `article` anidado, `statusByRetailer` y `categoryRetailer`—.
1257
+ Un producto de la familia puede no estar en ninguna orden de trabajo: la
1258
+ relación padre/hijo vive en `article` y no exige haber pasado por ContentOh.
1259
+ En ese caso no hay nada que abrir aquí, y se dice en vez de navegar a una
1260
+ pantalla que mostraría el producto equivocado.
1261
+ */
1262
+
1263
+ /*
1264
+ Después de desvincular, esta ficha cambia de forma: si se soltó de su padre
1265
+ vuelve a poder ligar, y si soltó a un hijo pierde uno de la cuenta. En esta
1266
+ pantalla el bloque de parentesco se decide con `family`, así que hay que
1267
+ repreguntarla —vaciarla lo haría desaparecer, que es el error que ya se
1268
+ cometió una vez aquí—.
1233
1269
  */
1234
1270
 
1271
+ var handleOnUnlinked = function handleOnUnlinked(result) {
1272
+ var _state$product$varian, _state$product12, _updatedProduct$varia;
1273
+
1274
+ if (!result) return;
1275
+ var updatedProduct = result.mode === "self" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1276
+ parentArticleId: null,
1277
+ variantsCount: 0
1278
+ }) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1279
+ variantsCount: Math.max(((_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 : 1) - 1, 0)
1280
+ });
1281
+ dispatch({
1282
+ type: "SET_PRODUCT",
1283
+ payload: updatedProduct
1284
+ }); // Se PARCHEA lo guardado: ahí vive el producto con la forma del listado
1285
+ // —`article` anidado, servicios, cadenas— y escribir encima la versión
1286
+ // aplanada de esta pantalla lo dejaría mutilado en el siguiente F5.
1287
+
1288
+ try {
1289
+ var _sessionStorage$getIt;
1290
+
1291
+ var guardado = JSON.parse((_sessionStorage$getIt = sessionStorage.getItem("productSelected")) !== null && _sessionStorage$getIt !== void 0 ? _sessionStorage$getIt : "null");
1292
+
1293
+ if (guardado) {
1294
+ var _updatedProduct$paren;
1295
+
1296
+ sessionStorage.setItem("productSelected", JSON.stringify((0, _objectSpread5.default)((0, _objectSpread5.default)({}, guardado), {}, {
1297
+ variantsCount: updatedProduct.variantsCount,
1298
+ parentArticleId: (_updatedProduct$paren = updatedProduct.parentArticleId) !== null && _updatedProduct$paren !== void 0 ? _updatedProduct$paren : null
1299
+ })));
1300
+ }
1301
+ } catch (error) {
1302
+ console.error("unlinkVariant/sessionStorage: ", error);
1303
+ }
1304
+ /*
1305
+ Si ya no queda familia, se cierra el desplegable: su botón desaparece con
1306
+ el vínculo, y dejarlo abierto pinta una caja que dice «no tiene hijos» y
1307
+ que nadie puede cerrar.
1308
+ */
1309
+
1310
+
1311
+ if (!updatedProduct.parentArticleId && ((_updatedProduct$varia = updatedProduct.variantsCount) !== null && _updatedProduct$varia !== void 0 ? _updatedProduct$varia : 0) === 0) {
1312
+ setShowFamily(false);
1313
+ }
1314
+
1315
+ loadFamily(true); // Al desvincular el servidor pone `is_overridden = 0` en todas las
1316
+ // versiones, así que los chips de herencia tienen que dejar de dibujarse.
1317
+ // Sin `enableLoading` para no parpadear el esqueleto encima de una pantalla
1318
+ // que ya está pintada.
1319
+
1320
+ loadData(false);
1321
+ };
1322
+
1323
+ var openFamilyMember = /*#__PURE__*/function () {
1324
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(articleId) {
1325
+ var _readPayload, res, _ref10, data, encontrado;
1326
+
1327
+ return _regenerator.default.wrap(function _callee6$(_context6) {
1328
+ while (1) {
1329
+ switch (_context6.prev = _context6.next) {
1330
+ case 0:
1331
+ setLoadingVariant(articleId);
1332
+ setAvisoFamilia(null);
1333
+ _context6.prev = 2;
1334
+ _context6.next = 5;
1335
+ return _axios.default.get("".concat(process.env.REACT_APP_ORDERED_SERVICES_ENDPOINT), {
1336
+ params: {
1337
+ filterByIdArticle: articleId,
1338
+ includeFilters: false
1339
+ },
1340
+ headers: {
1341
+ Authorization: token
1342
+ }
1343
+ });
1344
+
1345
+ case 5:
1346
+ res = _context6.sent;
1347
+ // read-order-services responde { total, data: [...] }. La vista trae una
1348
+ // fila por orden, así que puede haber varias del mismo artículo; llegan
1349
+ // ordenadas por order_id DESC y la primera es la orden más reciente.
1350
+ _ref10 = (_readPayload = (0, _api.readPayload)(res)) !== null && _readPayload !== void 0 ? _readPayload : {}, data = _ref10.data;
1351
+ encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
1352
+ var _item$article;
1353
+
1354
+ return Number(item === null || item === void 0 ? void 0 : (_item$article = item.article) === null || _item$article === void 0 ? void 0 : _item$article.id_article) === Number(articleId);
1355
+ });
1356
+
1357
+ if (encontrado) {
1358
+ _context6.next = 11;
1359
+ break;
1360
+ }
1361
+
1362
+ setAvisoFamilia("Ese producto no está en ninguna orden de trabajo, así que no se puede abrir desde aquí.");
1363
+ return _context6.abrupt("return");
1364
+
1365
+ case 11:
1366
+ sessionStorage.setItem("productSelected", JSON.stringify(encontrado));
1367
+ sessionStorage.setItem("version", JSON.stringify(encontrado.version));
1368
+ sessionStorage.setItem("productEdit", JSON.stringify({
1369
+ ArticleId: encontrado.article.id_article,
1370
+ categoryId: encontrado.article.id_article,
1371
+ product: [encontrado]
1372
+ }));
1373
+ window.location.assign("/EditProducts");
1374
+ _context6.next = 21;
1375
+ break;
1376
+
1377
+ case 17:
1378
+ _context6.prev = 17;
1379
+ _context6.t0 = _context6["catch"](2);
1380
+ console.error("openFamilyMember: ", _context6.t0);
1381
+ setAvisoFamilia("No se pudo abrir ese producto. Intenta de nuevo.");
1382
+
1383
+ case 21:
1384
+ _context6.prev = 21;
1385
+ setLoadingVariant(null);
1386
+ return _context6.finish(21);
1387
+
1388
+ case 24:
1389
+ case "end":
1390
+ return _context6.stop();
1391
+ }
1392
+ }
1393
+ }, _callee6, null, [[2, 17, 21, 24]]);
1394
+ }));
1395
+
1396
+ return function openFamilyMember(_x3) {
1397
+ return _ref9.apply(this, arguments);
1398
+ };
1399
+ }();
1235
1400
  /*
1236
1401
  Refresca tras ligar, sin recargar la página: el producto sale de
1237
1402
  sessionStorage, así que un F5 devolvería el mismo objeto y el contador
1238
1403
  seguiría igual.
1239
1404
  */
1240
1405
 
1406
+
1241
1407
  var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
1242
- var _state$product$varian, _state$product12, _result$linked, _result$parentArticle;
1408
+ var _state$product$varian2, _state$product13, _result$linked, _result$parentArticle;
1243
1409
 
1244
1410
  if (!result) return;
1245
1411
  var updatedProduct = result.mode === "children" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1246
- 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
1412
+ variantsCount: ((_state$product$varian2 = (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.variantsCount) !== null && _state$product$varian2 !== void 0 ? _state$product$varian2 : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
1247
1413
  }) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1248
1414
  parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
1249
1415
  variantsCount: 0
@@ -1252,10 +1418,33 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1252
1418
  type: "SET_PRODUCT",
1253
1419
  payload: updatedProduct
1254
1420
  });
1421
+ /*
1422
+ En sessionStorage se PARCHEA lo guardado; no se reemplaza.
1423
+ Lo que hay ahí es el producto tal como lo devuelve el listado de esta
1424
+ aplicación: con `article` anidado, `statusByRetailer`, `categoryRetailer`
1425
+ y los servicios. `updatedProduct` es la versión aplanada que usa esta
1426
+ pantalla, y escribirla encima tiraba todo eso: al siguiente F5 la ficha se
1427
+ reconstruía desde un objeto mutilado —sin relaciones de cadena, sin
1428
+ estatus por cadena— aunque en pantalla se viera bien hasta entonces.
1429
+ De ligar solo cambian dos cosas, y son las dos que se copian aquí.
1430
+ */
1255
1431
 
1256
1432
  try {
1257
- sessionStorage.setItem("productSelected", JSON.stringify(updatedProduct));
1433
+ var _sessionStorage$getIt2;
1434
+
1435
+ var guardado = JSON.parse((_sessionStorage$getIt2 = sessionStorage.getItem("productSelected")) !== null && _sessionStorage$getIt2 !== void 0 ? _sessionStorage$getIt2 : "null");
1436
+
1437
+ if (guardado) {
1438
+ var _updatedProduct$paren2;
1439
+
1440
+ sessionStorage.setItem("productSelected", JSON.stringify((0, _objectSpread5.default)((0, _objectSpread5.default)({}, guardado), {}, {
1441
+ variantsCount: updatedProduct.variantsCount,
1442
+ parentArticleId: (_updatedProduct$paren2 = updatedProduct.parentArticleId) !== null && _updatedProduct$paren2 !== void 0 ? _updatedProduct$paren2 : null
1443
+ })));
1444
+ }
1258
1445
  } catch (error) {
1446
+ // Un sessionStorage inaccesible no debe tumbar la pantalla: el estado en
1447
+ // memoria ya quedó bien y es lo que el usuario está viendo.
1259
1448
  console.error("linkVariants/sessionStorage: ", error);
1260
1449
  }
1261
1450
  /*
@@ -1294,31 +1483,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1294
1483
 
1295
1484
 
1296
1485
  var handleOnRestoreInheritance = /*#__PURE__*/function () {
1297
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(attributeId) {
1298
- var _state$product13;
1486
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(attributeId) {
1487
+ var _state$product14;
1299
1488
 
1300
1489
  var kind,
1301
1490
  esDescripcion,
1302
1491
  res,
1303
1492
  data,
1304
- _args6 = arguments;
1305
- return _regenerator.default.wrap(function _callee6$(_context6) {
1493
+ _args7 = arguments;
1494
+ return _regenerator.default.wrap(function _callee7$(_context7) {
1306
1495
  while (1) {
1307
- switch (_context6.prev = _context6.next) {
1496
+ switch (_context7.prev = _context7.next) {
1308
1497
  case 0:
1309
- kind = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : "attribute";
1498
+ kind = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : "attribute";
1310
1499
 
1311
- if (!(!attributeId || !((_state$product13 = state.product) !== null && _state$product13 !== void 0 && _state$product13.id_article))) {
1312
- _context6.next = 3;
1500
+ if (!(!attributeId || !((_state$product14 = state.product) !== null && _state$product14 !== void 0 && _state$product14.id_article))) {
1501
+ _context7.next = 3;
1313
1502
  break;
1314
1503
  }
1315
1504
 
1316
- return _context6.abrupt("return");
1505
+ return _context7.abrupt("return");
1317
1506
 
1318
1507
  case 3:
1319
1508
  esDescripcion = kind === "description";
1320
- _context6.prev = 4;
1321
- _context6.next = 7;
1509
+ _context7.prev = 4;
1510
+ _context7.next = 7;
1322
1511
  return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread5.default)({
1323
1512
  articleId: state.product.id_article
1324
1513
  }, esDescripcion ? {
@@ -1332,11 +1521,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1332
1521
  });
1333
1522
 
1334
1523
  case 7:
1335
- res = _context6.sent;
1524
+ res = _context7.sent;
1336
1525
  data = (0, _api.readPayload)(res);
1337
1526
 
1338
1527
  if (!esDescripcion) {
1339
- _context6.next = 12;
1528
+ _context7.next = 12;
1340
1529
  break;
1341
1530
  }
1342
1531
 
@@ -1350,7 +1539,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1350
1539
  };
1351
1540
  })
1352
1541
  });
1353
- return _context6.abrupt("return");
1542
+ return _context7.abrupt("return");
1354
1543
 
1355
1544
  case 12:
1356
1545
  dispatch({
@@ -1363,24 +1552,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1363
1552
  };
1364
1553
  })
1365
1554
  });
1366
- _context6.next = 18;
1555
+ _context7.next = 18;
1367
1556
  break;
1368
1557
 
1369
1558
  case 15:
1370
- _context6.prev = 15;
1371
- _context6.t0 = _context6["catch"](4);
1372
- console.error("restoreInheritance: ", _context6.t0);
1559
+ _context7.prev = 15;
1560
+ _context7.t0 = _context7["catch"](4);
1561
+ console.error("restoreInheritance: ", _context7.t0);
1373
1562
 
1374
1563
  case 18:
1375
1564
  case "end":
1376
- return _context6.stop();
1565
+ return _context7.stop();
1377
1566
  }
1378
1567
  }
1379
- }, _callee6, null, [[4, 15]]);
1568
+ }, _callee7, null, [[4, 15]]);
1380
1569
  }));
1381
1570
 
1382
- return function handleOnRestoreInheritance(_x3) {
1383
- return _ref9.apply(this, arguments);
1571
+ return function handleOnRestoreInheritance(_x4) {
1572
+ return _ref11.apply(this, arguments);
1384
1573
  };
1385
1574
  }();
1386
1575
  /*
@@ -1407,30 +1596,30 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1407
1596
  };
1408
1597
 
1409
1598
  var handleOnClickSave = /*#__PURE__*/function () {
1410
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
1599
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1411
1600
  var esPadre, cambios;
1412
- return _regenerator.default.wrap(function _callee7$(_context7) {
1601
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1413
1602
  while (1) {
1414
- switch (_context7.prev = _context7.next) {
1603
+ switch (_context8.prev = _context8.next) {
1415
1604
  case 0:
1416
1605
  if (!(state.saving || preparandoPropagacion)) {
1417
- _context7.next = 2;
1606
+ _context8.next = 2;
1418
1607
  break;
1419
1608
  }
1420
1609
 
1421
- return _context7.abrupt("return");
1610
+ return _context8.abrupt("return");
1422
1611
 
1423
1612
  case 2:
1424
- _context7.t0 = state.active_tab;
1425
- _context7.next = _context7.t0 === "Descripción" ? 5 : _context7.t0 === "Ficha técnica" ? 8 : _context7.t0 === "Imágenes" ? 17 : 20;
1613
+ _context8.t0 = state.active_tab;
1614
+ _context8.next = _context8.t0 === "Descripción" ? 5 : _context8.t0 === "Ficha técnica" ? 8 : _context8.t0 === "Imágenes" ? 17 : 20;
1426
1615
  break;
1427
1616
 
1428
1617
  case 5:
1429
- _context7.next = 7;
1618
+ _context8.next = 7;
1430
1619
  return saveDescriptions(token);
1431
1620
 
1432
1621
  case 7:
1433
- return _context7.abrupt("break", 21);
1622
+ return _context8.abrupt("break", 21);
1434
1623
 
1435
1624
  case 8:
1436
1625
  // Guardar un padre con hijos abre la decisión de propagar. Sin este
@@ -1440,7 +1629,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1440
1629
  cambios = cambiosDeFichaTecnica();
1441
1630
 
1442
1631
  if (!(esPadre && cambios.length > 0)) {
1443
- _context7.next = 14;
1632
+ _context8.next = 14;
1444
1633
  break;
1445
1634
  }
1446
1635
 
@@ -1452,39 +1641,39 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1452
1641
  }).finally(function () {
1453
1642
  return setPreparandoPropagacion(false);
1454
1643
  });
1455
- return _context7.abrupt("return");
1644
+ return _context8.abrupt("return");
1456
1645
 
1457
1646
  case 14:
1458
- _context7.next = 16;
1647
+ _context8.next = 16;
1459
1648
  return saveDatasheets(token);
1460
1649
 
1461
1650
  case 16:
1462
- return _context7.abrupt("break", 21);
1651
+ return _context8.abrupt("break", 21);
1463
1652
 
1464
1653
  case 17:
1465
- _context7.next = 19;
1654
+ _context8.next = 19;
1466
1655
  return updateImages(token);
1467
1656
 
1468
1657
  case 19:
1469
- return _context7.abrupt("break", 21);
1658
+ return _context8.abrupt("break", 21);
1470
1659
 
1471
1660
  case 20:
1472
- return _context7.abrupt("break", 21);
1661
+ return _context8.abrupt("break", 21);
1473
1662
 
1474
1663
  case 21:
1475
- _context7.next = 23;
1664
+ _context8.next = 23;
1476
1665
  return loadData(false);
1477
1666
 
1478
1667
  case 23:
1479
1668
  case "end":
1480
- return _context7.stop();
1669
+ return _context8.stop();
1481
1670
  }
1482
1671
  }
1483
- }, _callee7);
1672
+ }, _callee8);
1484
1673
  }));
1485
1674
 
1486
1675
  return function handleOnClickSave() {
1487
- return _ref10.apply(this, arguments);
1676
+ return _ref12.apply(this, arguments);
1488
1677
  };
1489
1678
  }();
1490
1679
 
@@ -1552,24 +1741,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1552
1741
  };
1553
1742
 
1554
1743
  var handleOnApproveSingleService = /*#__PURE__*/function () {
1555
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1556
- return _regenerator.default.wrap(function _callee8$(_context8) {
1744
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
1745
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1557
1746
  while (1) {
1558
- switch (_context8.prev = _context8.next) {
1747
+ switch (_context9.prev = _context9.next) {
1559
1748
  case 0:
1560
- _context8.next = 2;
1749
+ _context9.next = 2;
1561
1750
  return sendSingleEvaluation("A");
1562
1751
 
1563
1752
  case 2:
1564
1753
  case "end":
1565
- return _context8.stop();
1754
+ return _context9.stop();
1566
1755
  }
1567
1756
  }
1568
- }, _callee8);
1757
+ }, _callee9);
1569
1758
  }));
1570
1759
 
1571
1760
  return function handleOnApproveSingleService() {
1572
- return _ref11.apply(this, arguments);
1761
+ return _ref13.apply(this, arguments);
1573
1762
  };
1574
1763
  }();
1575
1764
 
@@ -1578,21 +1767,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1578
1767
  };
1579
1768
 
1580
1769
  var sendSingleEvaluation = /*#__PURE__*/function () {
1581
- var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
1770
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
1582
1771
  var _state$product$id_ord, _state$active_retaile4;
1583
1772
 
1584
1773
  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;
1585
1774
 
1586
- return _regenerator.default.wrap(function _callee9$(_context9) {
1775
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1587
1776
  while (1) {
1588
- switch (_context9.prev = _context9.next) {
1777
+ switch (_context10.prev = _context10.next) {
1589
1778
  case 0:
1590
1779
  if (!state.saving) {
1591
- _context9.next = 2;
1780
+ _context10.next = 2;
1592
1781
  break;
1593
1782
  }
1594
1783
 
1595
- return _context9.abrupt("return");
1784
+ return _context10.abrupt("return");
1596
1785
 
1597
1786
  case 2:
1598
1787
  dispatch({
@@ -1613,16 +1802,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1613
1802
  retailerId: retailerId
1614
1803
  };
1615
1804
  activeTab = state.active_tab;
1616
- _context9.prev = 11;
1805
+ _context10.prev = 11;
1617
1806
 
1618
1807
  if (!result) {
1619
- _context9.next = 28;
1808
+ _context10.next = 28;
1620
1809
  break;
1621
1810
  }
1622
1811
 
1623
1812
  data.result = result;
1624
1813
  data.retailerId = retailerId;
1625
- _context9.next = 17;
1814
+ _context10.next = 17;
1626
1815
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1627
1816
  headers: {
1628
1817
  Authorization: token
@@ -1630,7 +1819,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1630
1819
  });
1631
1820
 
1632
1821
  case 17:
1633
- res = _context9.sent;
1822
+ res = _context10.sent;
1634
1823
  newStatuses = JSON.parse(res.data.body);
1635
1824
  serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
1636
1825
  articleStatus = newStatuses.newArticleStatus[articleId];
@@ -1661,7 +1850,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1661
1850
  image: _genericModalCheck.default
1662
1851
  }
1663
1852
  });
1664
- _context9.next = 33;
1853
+ _context10.next = 33;
1665
1854
  break;
1666
1855
 
1667
1856
  case 28:
@@ -1677,7 +1866,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1677
1866
  icon = _genericModalCheck.default;
1678
1867
  }
1679
1868
 
1680
- _context9.next = 32;
1869
+ _context10.next = 32;
1681
1870
  return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1682
1871
  headers: {
1683
1872
  Authorization: token
@@ -1685,7 +1874,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1685
1874
  });
1686
1875
 
1687
1876
  case 32:
1688
- res = _context9.sent;
1877
+ res = _context10.sent;
1689
1878
 
1690
1879
  case 33:
1691
1880
  if (res.data.statusCode === 200) {
@@ -1770,13 +1959,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1770
1959
  });
1771
1960
  }
1772
1961
 
1773
- _context9.next = 40;
1962
+ _context10.next = 40;
1774
1963
  break;
1775
1964
 
1776
1965
  case 36:
1777
- _context9.prev = 36;
1778
- _context9.t0 = _context9["catch"](11);
1779
- console.error("Error sending evaluation:", _context9.t0);
1966
+ _context10.prev = 36;
1967
+ _context10.t0 = _context10["catch"](11);
1968
+ console.error("Error sending evaluation:", _context10.t0);
1780
1969
  dispatch({
1781
1970
  type: "SET_MODAL",
1782
1971
  payload: {
@@ -1788,45 +1977,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1788
1977
  });
1789
1978
 
1790
1979
  case 40:
1791
- _context9.prev = 40;
1980
+ _context10.prev = 40;
1792
1981
  dispatch({
1793
1982
  type: "SET_SAVING",
1794
1983
  payload: false
1795
1984
  });
1796
- return _context9.finish(40);
1985
+ return _context10.finish(40);
1797
1986
 
1798
1987
  case 43:
1799
1988
  case "end":
1800
- return _context9.stop();
1989
+ return _context10.stop();
1801
1990
  }
1802
1991
  }
1803
- }, _callee9, null, [[11, 36, 40, 43]]);
1992
+ }, _callee10, null, [[11, 36, 40, 43]]);
1804
1993
  }));
1805
1994
 
1806
- return function sendSingleEvaluation(_x4) {
1807
- return _ref12.apply(this, arguments);
1995
+ return function sendSingleEvaluation(_x5) {
1996
+ return _ref14.apply(this, arguments);
1808
1997
  };
1809
1998
  }();
1810
1999
 
1811
2000
  var handleOnApproveAllServices = /*#__PURE__*/function () {
1812
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1813
- return _regenerator.default.wrap(function _callee10$(_context10) {
2001
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
2002
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1814
2003
  while (1) {
1815
- switch (_context10.prev = _context10.next) {
2004
+ switch (_context11.prev = _context11.next) {
1816
2005
  case 0:
1817
- _context10.next = 2;
2006
+ _context11.next = 2;
1818
2007
  return sendBulkEvaluation("A");
1819
2008
 
1820
2009
  case 2:
1821
2010
  case "end":
1822
- return _context10.stop();
2011
+ return _context11.stop();
1823
2012
  }
1824
2013
  }
1825
- }, _callee10);
2014
+ }, _callee11);
1826
2015
  }));
1827
2016
 
1828
2017
  return function handleOnApproveAllServices() {
1829
- return _ref13.apply(this, arguments);
2018
+ return _ref15.apply(this, arguments);
1830
2019
  };
1831
2020
  }();
1832
2021
 
@@ -1836,18 +2025,18 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1836
2025
  };
1837
2026
 
1838
2027
  var sendBulkEvaluation = /*#__PURE__*/function () {
1839
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
2028
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(result) {
1840
2029
  var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, updatedServicesData;
1841
2030
 
1842
- return _regenerator.default.wrap(function _callee11$(_context11) {
2031
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1843
2032
  while (1) {
1844
- switch (_context11.prev = _context11.next) {
2033
+ switch (_context12.prev = _context12.next) {
1845
2034
  case 0:
1846
2035
  dispatch({
1847
2036
  type: "SET_SAVING",
1848
2037
  payload: true
1849
2038
  });
1850
- _context11.prev = 1;
2039
+ _context12.prev = 1;
1851
2040
  evaluationArray = [];
1852
2041
  conceptArray = (0, _utils.getConceptsByRole)(user.id_role);
1853
2042
  (_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret, idx) {
@@ -1872,7 +2061,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1872
2061
  }));
1873
2062
  }
1874
2063
  });
1875
- _context11.next = 7;
2064
+ _context12.next = 7;
1876
2065
  return Promise.all(evaluationArray);
1877
2066
 
1878
2067
  case 7:
@@ -1927,41 +2116,41 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1927
2116
  image: _genericModalCheck.default
1928
2117
  }
1929
2118
  });
1930
- _context11.next = 19;
2119
+ _context12.next = 19;
1931
2120
  break;
1932
2121
 
1933
2122
  case 16:
1934
- _context11.prev = 16;
1935
- _context11.t0 = _context11["catch"](1);
1936
- console.error("Error in bulk evaluation:", _context11.t0);
2123
+ _context12.prev = 16;
2124
+ _context12.t0 = _context12["catch"](1);
2125
+ console.error("Error in bulk evaluation:", _context12.t0);
1937
2126
 
1938
2127
  case 19:
1939
- _context11.prev = 19;
2128
+ _context12.prev = 19;
1940
2129
  dispatch({
1941
2130
  type: "SET_SAVING",
1942
2131
  payload: false
1943
2132
  });
1944
- return _context11.finish(19);
2133
+ return _context12.finish(19);
1945
2134
 
1946
2135
  case 22:
1947
2136
  case "end":
1948
- return _context11.stop();
2137
+ return _context12.stop();
1949
2138
  }
1950
2139
  }
1951
- }, _callee11, null, [[1, 16, 19, 22]]);
2140
+ }, _callee12, null, [[1, 16, 19, 22]]);
1952
2141
  }));
1953
2142
 
1954
- return function sendBulkEvaluation(_x5) {
1955
- return _ref14.apply(this, arguments);
2143
+ return function sendBulkEvaluation(_x6) {
2144
+ return _ref16.apply(this, arguments);
1956
2145
  };
1957
2146
  }();
1958
2147
 
1959
2148
  var handleOnChangeAssignations = /*#__PURE__*/function () {
1960
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(assignationType, assignationId) {
2149
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(assignationType, assignationId) {
1961
2150
  var concept, data, updatedProduct;
1962
- return _regenerator.default.wrap(function _callee12$(_context12) {
2151
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1963
2152
  while (1) {
1964
- switch (_context12.prev = _context12.next) {
2153
+ switch (_context13.prev = _context13.next) {
1965
2154
  case 0:
1966
2155
  concept = (0, _utils.getConceptByTab)(state.active_tab);
1967
2156
  data = {
@@ -1972,7 +2161,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1972
2161
  concept: concept,
1973
2162
  userId: assignationId
1974
2163
  };
1975
- _context12.next = 4;
2164
+ _context13.next = 4;
1976
2165
  return (0, _axios.default)({
1977
2166
  method: "post",
1978
2167
  url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
@@ -1991,14 +2180,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1991
2180
 
1992
2181
  case 6:
1993
2182
  case "end":
1994
- return _context12.stop();
2183
+ return _context13.stop();
1995
2184
  }
1996
2185
  }
1997
- }, _callee12);
2186
+ }, _callee13);
1998
2187
  }));
1999
2188
 
2000
- return function handleOnChangeAssignations(_x6, _x7) {
2001
- return _ref15.apply(this, arguments);
2189
+ return function handleOnChangeAssignations(_x7, _x8) {
2190
+ return _ref17.apply(this, arguments);
2002
2191
  };
2003
2192
  }();
2004
2193
 
@@ -2033,16 +2222,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2033
2222
  };
2034
2223
 
2035
2224
  var handleOnSubmitComment = /*#__PURE__*/function () {
2036
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(e) {
2225
+ var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(e) {
2037
2226
  var commentText;
2038
- return _regenerator.default.wrap(function _callee13$(_context13) {
2227
+ return _regenerator.default.wrap(function _callee14$(_context14) {
2039
2228
  while (1) {
2040
- switch (_context13.prev = _context13.next) {
2229
+ switch (_context14.prev = _context14.next) {
2041
2230
  case 0:
2042
2231
  e.preventDefault();
2043
2232
  commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
2044
- _context13.prev = 2;
2045
- _context13.next = 5;
2233
+ _context14.prev = 2;
2234
+ _context14.next = 5;
2046
2235
  return createComment(commentText, token);
2047
2236
 
2048
2237
  case 5:
@@ -2055,13 +2244,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2055
2244
  image: _genericModalCheck.default
2056
2245
  }
2057
2246
  });
2058
- _context13.next = 12;
2247
+ _context14.next = 12;
2059
2248
  break;
2060
2249
 
2061
2250
  case 8:
2062
- _context13.prev = 8;
2063
- _context13.t0 = _context13["catch"](2);
2064
- console.error("Error saving comment:", _context13.t0);
2251
+ _context14.prev = 8;
2252
+ _context14.t0 = _context14["catch"](2);
2253
+ console.error("Error saving comment:", _context14.t0);
2065
2254
  dispatch({
2066
2255
  type: "SET_MODAL",
2067
2256
  payload: {
@@ -2074,14 +2263,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2074
2263
 
2075
2264
  case 12:
2076
2265
  case "end":
2077
- return _context13.stop();
2266
+ return _context14.stop();
2078
2267
  }
2079
2268
  }
2080
- }, _callee13, null, [[2, 8]]);
2269
+ }, _callee14, null, [[2, 8]]);
2081
2270
  }));
2082
2271
 
2083
- return function handleOnSubmitComment(_x8) {
2084
- return _ref16.apply(this, arguments);
2272
+ return function handleOnSubmitComment(_x9) {
2273
+ return _ref18.apply(this, arguments);
2085
2274
  };
2086
2275
  }();
2087
2276
 
@@ -2416,16 +2605,22 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2416
2605
  saveDatasheets(token, propagation !== null && propagation !== void 0 ? propagation : undefined);
2417
2606
  }
2418
2607
  }), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
2419
- articleId: (_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.id_article,
2420
- articleName: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.name,
2421
- articleUpc: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.upc,
2608
+ articleId: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_article,
2609
+ articleName: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.name,
2610
+ articleUpc: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.upc,
2422
2611
  activeRetailerId: (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.id_retailer,
2423
2612
  token: token,
2424
2613
  onClose: function onClose() {
2425
2614
  return setShowLinkVariants(false);
2426
2615
  },
2427
2616
  onLinked: handleOnLinkedVariants
2428
- }), showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
2617
+ }), porDesvincular && /*#__PURE__*/(0, _jsxRuntime.jsx)(_UnlinkVariantModal.UnlinkVariantModal, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, porDesvincular), {}, {
2618
+ token: token,
2619
+ onClose: function onClose() {
2620
+ return setPorDesvincular(null);
2621
+ },
2622
+ onUnlinked: handleOnUnlinked
2623
+ })), showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
2429
2624
  title: rejectAll ? "Agregar mensaje para rechazar todo" : "Agregar mensaje de rechazo",
2430
2625
  show: showRejectModal,
2431
2626
  customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
@@ -2445,21 +2640,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2445
2640
  type: "pink",
2446
2641
  label: "Aceptar",
2447
2642
  size: 12,
2448
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
2643
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
2449
2644
  var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
2450
- return _regenerator.default.wrap(function _callee14$(_context14) {
2645
+ return _regenerator.default.wrap(function _callee15$(_context15) {
2451
2646
  while (1) {
2452
- switch (_context14.prev = _context14.next) {
2647
+ switch (_context15.prev = _context15.next) {
2453
2648
  case 0:
2454
2649
  elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
2455
2650
 
2456
2651
  if (!(!elements || elements.length === 0)) {
2457
- _context14.next = 4;
2652
+ _context15.next = 4;
2458
2653
  break;
2459
2654
  }
2460
2655
 
2461
2656
  console.error("Elemento no encontrado");
2462
- return _context14.abrupt("return");
2657
+ return _context15.abrupt("return");
2463
2658
 
2464
2659
  case 4:
2465
2660
  isMessageEmpty = Array.from(elements).every(function (el) {
@@ -2468,7 +2663,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2468
2663
  });
2469
2664
 
2470
2665
  if (!isMessageEmpty) {
2471
- _context14.next = 10;
2666
+ _context15.next = 10;
2472
2667
  break;
2473
2668
  }
2474
2669
 
@@ -2483,13 +2678,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2483
2678
  container.appendChild(alert);
2484
2679
  }
2485
2680
 
2486
- return _context14.abrupt("return");
2681
+ return _context15.abrupt("return");
2487
2682
 
2488
2683
  case 10:
2489
2684
  fullMessage = Array.from(elements).map(function (element) {
2490
2685
  return element.innerHTML;
2491
2686
  }).join("").replace(/<br\s*\/?>/gi, "\n");
2492
- _context14.next = 13;
2687
+ _context15.next = 13;
2493
2688
  return createComment(fullMessage, token);
2494
2689
 
2495
2690
  case 13:
@@ -2498,10 +2693,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2498
2693
 
2499
2694
  case 15:
2500
2695
  case "end":
2501
- return _context14.stop();
2696
+ return _context15.stop();
2502
2697
  }
2503
2698
  }
2504
- }, _callee14);
2699
+ }, _callee15);
2505
2700
  }))
2506
2701
  }, "btn-Aceptar")]
2507
2702
  }), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
@@ -2579,7 +2774,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2579
2774
  lists: state.images_values || [],
2580
2775
  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] : {},
2581
2776
  assignationsImages: state.collaborator_assignations["Imágenes"],
2582
- imagesStatus: ((_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.images_status) || "-",
2777
+ imagesStatus: ((_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.images_status) || "-",
2583
2778
  retailerSelected: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.id_retailer,
2584
2779
  isRetailer: isRetailer,
2585
2780
  version: state.product.version,
@@ -2644,34 +2839,87 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2644
2839
  className: "loading",
2645
2840
  children: "No se pudo cargar la familia de este producto."
2646
2841
  }), (family === null || family === void 0 ? void 0 : family.parent) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2647
- className: "family-row parent",
2648
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2649
- className: "role",
2650
- children: "Producto padre"
2651
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2652
- className: "name",
2653
- children: family.parent.name
2654
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2655
- className: "upc",
2656
- children: family.parent.upc
2657
- })]
2658
- }), family === null || family === void 0 ? void 0 : (_family$variants3 = family.variants) === null || _family$variants3 === void 0 ? void 0 : _family$variants3.map(function (variant) {
2659
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2660
- className: "family-row".concat(variant.isCurrent ? " current" : ""),
2842
+ className: "family-item",
2843
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2844
+ type: "button",
2845
+ className: "family-row parent",
2846
+ disabled: loadingVariant !== null,
2847
+ onClick: function onClick() {
2848
+ return openFamilyMember(family.parent.articleId);
2849
+ },
2661
2850
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2662
2851
  className: "role",
2663
- children: variant.isCurrent ? "Estás aquí" : "Hijo"
2852
+ children: loadingVariant === family.parent.articleId ? "Abriendo…" : "Producto padre"
2664
2853
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2665
2854
  className: "name",
2666
- children: variant.name
2855
+ children: family.parent.name
2667
2856
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2668
2857
  className: "upc",
2669
- children: variant.upc
2858
+ children: family.parent.upc
2859
+ })]
2860
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
2861
+ type: "button",
2862
+ className: "desvincular",
2863
+ title: "Dejar de ser hijo de este producto",
2864
+ onClick: function onClick() {
2865
+ var _state$product19, _state$product20, _state$product21;
2866
+
2867
+ return setPorDesvincular({
2868
+ mode: "self",
2869
+ childArticleId: (_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.id_article,
2870
+ childName: (_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.name,
2871
+ childUpc: (_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.upc,
2872
+ parentName: family.parent.name,
2873
+ parentUpc: family.parent.upc
2874
+ });
2875
+ },
2876
+ children: "Desvincular"
2877
+ })]
2878
+ }), family === null || family === void 0 ? void 0 : (_family$variants3 = family.variants) === null || _family$variants3 === void 0 ? void 0 : _family$variants3.map(function (variant) {
2879
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2880
+ className: "family-item",
2881
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2882
+ type: "button",
2883
+ className: "family-row".concat(variant.isCurrent ? " current" : ""),
2884
+ disabled: variant.isCurrent || loadingVariant !== null,
2885
+ onClick: function onClick() {
2886
+ return openFamilyMember(variant.articleId);
2887
+ },
2888
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2889
+ className: "role",
2890
+ children: loadingVariant === variant.articleId ? "Abriendo…" : variant.isCurrent ? "Estás aquí" : "Hijo"
2891
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2892
+ className: "name",
2893
+ children: variant.name
2894
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2895
+ className: "upc",
2896
+ children: variant.upc
2897
+ })]
2898
+ }), !family.parent && !variant.isCurrent && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
2899
+ type: "button",
2900
+ className: "desvincular",
2901
+ title: "Desvincular este hijo",
2902
+ onClick: function onClick() {
2903
+ var _state$product22, _state$product23;
2904
+
2905
+ return setPorDesvincular({
2906
+ mode: "child",
2907
+ childArticleId: variant.articleId,
2908
+ childName: variant.name,
2909
+ childUpc: variant.upc,
2910
+ parentName: (_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.name,
2911
+ parentUpc: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.upc
2912
+ });
2913
+ },
2914
+ children: "Desvincular"
2670
2915
  })]
2671
2916
  }, variant.articleId);
2672
2917
  }), family && !family.error && !((_family$variants4 = family.variants) !== null && _family$variants4 !== void 0 && _family$variants4.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
2673
2918
  className: "loading",
2674
2919
  children: "Este producto no tiene hijos."
2920
+ }), avisoFamilia && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
2921
+ className: "loading",
2922
+ children: avisoFamilia
2675
2923
  })]
2676
2924
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader // states
2677
2925
  , {
@@ -2731,7 +2979,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2731
2979
  className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
2732
2980
  id: "services-information-container",
2733
2981
  children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2734
- 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, {
2982
+ children: [state.active_tab === "Descripción" && (((_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
2735
2983
  activeSection: state.active_tab,
2736
2984
  inputGroup: state.descriptions_inputs[0],
2737
2985
  updatedDescriptions: state.updated_descriptions_inputs
@@ -2740,7 +2988,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2740
2988
  ,
2741
2989
  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,
2742
2990
  onRestoreInheritance: handleOnRestoreInheritance,
2743
- articleId: (_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.id_article,
2991
+ articleId: (_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.id_article,
2744
2992
  version: state.product.version,
2745
2993
  auditInputGroup: auditDescriptions[0],
2746
2994
  setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
@@ -2749,7 +2997,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2749
2997
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
2750
2998
  text: "No cuentas con este servicio",
2751
2999
  headerType: "input-name-header"
2752
- })), 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, {
3000
+ })), state.active_tab === "Ficha técnica" && (((_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
2753
3001
  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) {
2754
3002
  var _state$services3, _state$services3$data;
2755
3003
 
@@ -2770,7 +3018,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2770
3018
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
2771
3019
  text: "No cuentas con este servicio",
2772
3020
  headerType: "input-name-header"
2773
- })), 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, {
3021
+ })), state.active_tab === "Imágenes" && (((_state$product27 = state.product) === null || _state$product27 === void 0 ? void 0 : _state$product27.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2774
3022
  children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
2775
3023
  checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
2776
3024
  ,
@@ -2862,20 +3110,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2862
3110
  reviewed: crossComment
2863
3111
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
2864
3112
  buttonType: "circular-button accept-button",
2865
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
2866
- return _regenerator.default.wrap(function _callee15$(_context15) {
3113
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
3114
+ return _regenerator.default.wrap(function _callee16$(_context16) {
2867
3115
  while (1) {
2868
- switch (_context15.prev = _context15.next) {
3116
+ switch (_context16.prev = _context16.next) {
2869
3117
  case 0:
2870
3118
  setCrossComment(true);
2871
3119
  commentRevised();
2872
3120
 
2873
3121
  case 2:
2874
3122
  case "end":
2875
- return _context15.stop();
3123
+ return _context16.stop();
2876
3124
  }
2877
3125
  }
2878
- }, _callee15);
3126
+ }, _callee16);
2879
3127
  }))
2880
3128
  })]
2881
3129
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {