contentoh-components-library 21.6.23 → 21.6.25

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.
@@ -88,7 +88,7 @@ var _AiProductEdition = require("../../../contexts/AiProductEdition");
88
88
  var _jsxRuntime = require("react/jsx-runtime");
89
89
 
90
90
  var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
91
- var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _state$product14, _state$product15, _state$product16, _state$active_retaile3, _state$product17, _state$product18, _location$state5, _location$state6, _state$active_retaile4, _state$active_retaile5, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile6, _state$product19, _state$product20, _state$product21, _state$product22, _family$variants, _family$variants2, _state$active_percent, _state$active_percent2, _state$active_retaile7, _state$active_retaile8, _state$active_retaile9, _state$product23, _state$descriptions_i, _state$product24, _state$product25, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product26, _state$images_values12;
91
+ var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _state$product14, _state$product15, _state$product16, _state$active_retaile3, _location$state5, _location$state6, _state$active_retaile4, _state$active_retaile5, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile6, _state$product17, _state$product18, _state$product19, _state$product20, _family$variants, _family$variants2, _state$active_percent, _state$active_percent2, _state$active_retaile7, _state$active_retaile8, _state$active_retaile9, _state$product21, _state$descriptions_i, _state$product22, _state$product23, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product24, _state$images_values12;
92
92
 
93
93
  var tabsSections = _ref.tabsSections,
94
94
  _ref$productSelected = _ref.productSelected,
@@ -143,39 +143,44 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
143
143
  showFamily = _useState10[0],
144
144
  setShowFamily = _useState10[1];
145
145
 
146
- var _useState11 = (0, _react.useState)(false),
146
+ var _useState11 = (0, _react.useState)(null),
147
147
  _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
148
- showRejectModal = _useState12[0],
149
- setShowRejectModal = _useState12[1];
148
+ loadingVariant = _useState12[0],
149
+ setLoadingVariant = _useState12[1];
150
150
 
151
- var _useState13 = (0, _react.useState)(0),
151
+ var _useState13 = (0, _react.useState)(false),
152
152
  _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
153
- headerTop = _useState14[0],
154
- setHeaderTop = _useState14[1];
153
+ showRejectModal = _useState14[0],
154
+ setShowRejectModal = _useState14[1];
155
155
 
156
- var _useState15 = (0, _react.useState)({}),
156
+ var _useState15 = (0, _react.useState)(0),
157
157
  _useState16 = (0, _slicedToArray2.default)(_useState15, 2),
158
- assig = _useState16[0],
159
- setAssig = _useState16[1];
158
+ headerTop = _useState16[0],
159
+ setHeaderTop = _useState16[1];
160
160
 
161
- var _useState17 = (0, _react.useState)(false),
161
+ var _useState17 = (0, _react.useState)({}),
162
162
  _useState18 = (0, _slicedToArray2.default)(_useState17, 2),
163
- imageLayout = _useState18[0],
164
- setImageLayout = _useState18[1];
163
+ assig = _useState18[0],
164
+ setAssig = _useState18[1];
165
165
 
166
166
  var _useState19 = (0, _react.useState)(false),
167
167
  _useState20 = (0, _slicedToArray2.default)(_useState19, 2),
168
- rejectAll = _useState20[0],
169
- setRejectAll = _useState20[1];
168
+ imageLayout = _useState20[0],
169
+ setImageLayout = _useState20[1];
170
170
 
171
- var _useState21 = (0, _react.useState)({
171
+ var _useState21 = (0, _react.useState)(false),
172
+ _useState22 = (0, _slicedToArray2.default)(_useState21, 2),
173
+ rejectAll = _useState22[0],
174
+ setRejectAll = _useState22[1];
175
+
176
+ var _useState23 = (0, _react.useState)({
172
177
  "Ficha técnica": null,
173
178
  Descripción: null,
174
179
  Imágenes: null
175
180
  }),
176
- _useState22 = (0, _slicedToArray2.default)(_useState21, 2),
177
- origin = _useState22[0],
178
- setOrigin = _useState22[1];
181
+ _useState24 = (0, _slicedToArray2.default)(_useState23, 2),
182
+ origin = _useState24[0],
183
+ setOrigin = _useState24[1];
179
184
 
180
185
  var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
181
186
  _useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
@@ -894,12 +899,91 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
894
899
  return _ref7.apply(this, arguments);
895
900
  };
896
901
  }();
902
+ /*
903
+ Abre otra variante de la familia.
904
+ Esta pantalla no lee el producto de la URL: lo lee de sessionStorage, donde
905
+ lo dejó el listado al hacer clic. Así que navegar a /products/:id sin más
906
+ cambia la barra de direcciones y deja el producto anterior en pantalla.
907
+ Por eso primero se trae el producto por su ID —no por su UPC: hay 12,024 UPC
908
+ repetidos entre artículos activos y 5,579 de esos casos caen dentro de la
909
+ misma compañía, así que el UPC no identifica— y se deja en sessionStorage con
910
+ la misma forma que usa el listado. Después se navega.
911
+ Es un rodeo, y lo es porque el origen del dato está mal puesto. Arreglarlo de
912
+ raíz —que la ficha lea de la URL— toca todas las plataformas y no cabe aquí.
913
+ */
897
914
 
898
- var openVariant = function openVariant(articleId) {
899
- // Se navega igual que el resto de la app, con el id en la ruta. Inventar
900
- // otra forma de abrir un producto es inventar otra forma de que se rompa.
901
- window.location.assign("/products/".concat(articleId, "/datasheet"));
902
- };
915
+
916
+ var openVariant = /*#__PURE__*/function () {
917
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(articleId) {
918
+ var res, _readPayload, data, encontrado;
919
+
920
+ return _regenerator.default.wrap(function _callee4$(_context4) {
921
+ while (1) {
922
+ switch (_context4.prev = _context4.next) {
923
+ case 0:
924
+ setLoadingVariant(articleId);
925
+ _context4.prev = 1;
926
+ _context4.next = 4;
927
+ return _axios.default.get("".concat(process.env.REACT_APP_NEW_ARTICLES_ENDPOINT), {
928
+ params: {
929
+ listType: "general",
930
+ filterByArticleId: articleId
931
+ },
932
+ headers: {
933
+ Authorization: token
934
+ }
935
+ });
936
+
937
+ case 4:
938
+ res = _context4.sent;
939
+ // read-articles-v2 responde { count, data: [...] }.
940
+ _readPayload = (0, _api.readPayload)(res), data = _readPayload.data;
941
+ encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
942
+ return Number(item.id_article) === Number(articleId);
943
+ });
944
+
945
+ if (encontrado) {
946
+ sessionStorage.setItem("productSelected", JSON.stringify((0, _objectSpread4.default)((0, _objectSpread4.default)({}, encontrado), {}, {
947
+ article: {
948
+ id_article: encontrado.id_article
949
+ }
950
+ })));
951
+ sessionStorage.setItem("productEdit", JSON.stringify({
952
+ ArticleId: encontrado.id_article,
953
+ idCategory: encontrado.id_category,
954
+ product: encontrado
955
+ }));
956
+ }
957
+
958
+ _context4.next = 13;
959
+ break;
960
+
961
+ case 10:
962
+ _context4.prev = 10;
963
+ _context4.t0 = _context4["catch"](1);
964
+ // Si la consulta falla se navega igual: la pantalla mostrará el producto
965
+ // que hubiera en sessionStorage, que es el comportamiento de siempre.
966
+ // Peor sería dejar el clic sin efecto y que pareciera que no responde.
967
+ console.error("openVariant: ", _context4.t0);
968
+
969
+ case 13:
970
+ _context4.prev = 13;
971
+ setLoadingVariant(null);
972
+ window.location.assign("/products/".concat(articleId, "/datasheet"));
973
+ return _context4.finish(13);
974
+
975
+ case 17:
976
+ case "end":
977
+ return _context4.stop();
978
+ }
979
+ }
980
+ }, _callee4, null, [[1, 10, 13, 17]]);
981
+ }));
982
+
983
+ return function openVariant(_x2) {
984
+ return _ref8.apply(this, arguments);
985
+ };
986
+ }();
903
987
  /*
904
988
  Refresca la ficha después de ligar, sin recargar la página.
905
989
  Recargar no servía: el producto de esta pantalla viene del listado —por
@@ -958,24 +1042,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
958
1042
 
959
1043
 
960
1044
  var handleOnRestoreInheritance = /*#__PURE__*/function () {
961
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(attributeId) {
1045
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(attributeId) {
962
1046
  var _state$product12;
963
1047
 
964
1048
  var res, data;
965
- return _regenerator.default.wrap(function _callee4$(_context4) {
1049
+ return _regenerator.default.wrap(function _callee5$(_context5) {
966
1050
  while (1) {
967
- switch (_context4.prev = _context4.next) {
1051
+ switch (_context5.prev = _context5.next) {
968
1052
  case 0:
969
1053
  if (!(!attributeId || !((_state$product12 = state.product) !== null && _state$product12 !== void 0 && _state$product12.id_article))) {
970
- _context4.next = 2;
1054
+ _context5.next = 2;
971
1055
  break;
972
1056
  }
973
1057
 
974
- return _context4.abrupt("return");
1058
+ return _context5.abrupt("return");
975
1059
 
976
1060
  case 2:
977
- _context4.prev = 2;
978
- _context4.next = 5;
1061
+ _context5.prev = 2;
1062
+ _context5.next = 5;
979
1063
  return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), {
980
1064
  articleId: state.product.id_article,
981
1065
  attributes: [Number(attributeId)]
@@ -986,7 +1070,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
986
1070
  });
987
1071
 
988
1072
  case 5:
989
- res = _context4.sent;
1073
+ res = _context5.sent;
990
1074
  // El API responde 200 aunque la lambda haya devuelto 400: el resultado
991
1075
  // real viaja en el cuerpo y readPayload lo convierte en excepción.
992
1076
  data = (0, _api.readPayload)(res);
@@ -1000,24 +1084,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1000
1084
  };
1001
1085
  })
1002
1086
  });
1003
- _context4.next = 13;
1087
+ _context5.next = 13;
1004
1088
  break;
1005
1089
 
1006
1090
  case 10:
1007
- _context4.prev = 10;
1008
- _context4.t0 = _context4["catch"](2);
1009
- console.error("restoreInheritance: ", _context4.t0);
1091
+ _context5.prev = 10;
1092
+ _context5.t0 = _context5["catch"](2);
1093
+ console.error("restoreInheritance: ", _context5.t0);
1010
1094
 
1011
1095
  case 13:
1012
1096
  case "end":
1013
- return _context4.stop();
1097
+ return _context5.stop();
1014
1098
  }
1015
1099
  }
1016
- }, _callee4, null, [[2, 10]]);
1100
+ }, _callee5, null, [[2, 10]]);
1017
1101
  }));
1018
1102
 
1019
- return function handleOnRestoreInheritance(_x2) {
1020
- return _ref8.apply(this, arguments);
1103
+ return function handleOnRestoreInheritance(_x3) {
1104
+ return _ref9.apply(this, arguments);
1021
1105
  };
1022
1106
  }();
1023
1107
 
@@ -1052,14 +1136,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1052
1136
  };
1053
1137
 
1054
1138
  var sendEvaluation = /*#__PURE__*/function () {
1055
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(result) {
1139
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(result) {
1056
1140
  var _state$product$id_ord, _state$active_retaile2, _state$product$status, _state$product$status2, _state$product13;
1057
1141
 
1058
1142
  var concept, articleId, orderId, retailerId, evalStatus, data, _newStatuses$newStatu, _state$services_data, res, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, updatedServicesData;
1059
1143
 
1060
- return _regenerator.default.wrap(function _callee5$(_context5) {
1144
+ return _regenerator.default.wrap(function _callee6$(_context6) {
1061
1145
  while (1) {
1062
- switch (_context5.prev = _context5.next) {
1146
+ switch (_context6.prev = _context6.next) {
1063
1147
  case 0:
1064
1148
  dispatch({
1065
1149
  type: "SET_SAVING",
@@ -1076,16 +1160,16 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1076
1160
  concept: concept,
1077
1161
  evalStatus: evalStatus
1078
1162
  };
1079
- _context5.prev = 7;
1163
+ _context6.prev = 7;
1080
1164
 
1081
1165
  if (!result) {
1082
- _context5.next = 22;
1166
+ _context6.next = 22;
1083
1167
  break;
1084
1168
  }
1085
1169
 
1086
1170
  data.result = result;
1087
1171
  data.retailerId = retailerId;
1088
- _context5.next = 13;
1172
+ _context6.next = 13;
1089
1173
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1090
1174
  headers: {
1091
1175
  Authorization: token
@@ -1093,7 +1177,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1093
1177
  });
1094
1178
 
1095
1179
  case 13:
1096
- res = _context5.sent;
1180
+ res = _context6.sent;
1097
1181
  newStatuses = JSON.parse(res.data.body);
1098
1182
  serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")]; // Actualizar el producto con los nuevos estados
1099
1183
 
@@ -1130,13 +1214,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1130
1214
  });
1131
1215
 
1132
1216
  case 22:
1133
- _context5.next = 28;
1217
+ _context6.next = 28;
1134
1218
  break;
1135
1219
 
1136
1220
  case 24:
1137
- _context5.prev = 24;
1138
- _context5.t0 = _context5["catch"](7);
1139
- console.error("Error sending evaluation:", _context5.t0);
1221
+ _context6.prev = 24;
1222
+ _context6.t0 = _context6["catch"](7);
1223
+ console.error("Error sending evaluation:", _context6.t0);
1140
1224
  dispatch({
1141
1225
  type: "SET_MODAL",
1142
1226
  payload: {
@@ -1148,32 +1232,32 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1148
1232
  });
1149
1233
 
1150
1234
  case 28:
1151
- _context5.prev = 28;
1235
+ _context6.prev = 28;
1152
1236
  dispatch({
1153
1237
  type: "SET_SAVING",
1154
1238
  payload: false
1155
1239
  });
1156
- return _context5.finish(28);
1240
+ return _context6.finish(28);
1157
1241
 
1158
1242
  case 31:
1159
1243
  case "end":
1160
- return _context5.stop();
1244
+ return _context6.stop();
1161
1245
  }
1162
1246
  }
1163
- }, _callee5, null, [[7, 24, 28, 31]]);
1247
+ }, _callee6, null, [[7, 24, 28, 31]]);
1164
1248
  }));
1165
1249
 
1166
- return function sendEvaluation(_x3) {
1167
- return _ref9.apply(this, arguments);
1250
+ return function sendEvaluation(_x4) {
1251
+ return _ref10.apply(this, arguments);
1168
1252
  };
1169
1253
  }();
1170
1254
 
1171
1255
  var evaluationToRetailer = /*#__PURE__*/function () {
1172
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(result) {
1256
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
1173
1257
  var data, statusComplete, updatedProduct;
1174
- return _regenerator.default.wrap(function _callee6$(_context6) {
1258
+ return _regenerator.default.wrap(function _callee7$(_context7) {
1175
1259
  while (1) {
1176
- switch (_context6.prev = _context6.next) {
1260
+ switch (_context7.prev = _context7.next) {
1177
1261
  case 0:
1178
1262
  dispatch({
1179
1263
  type: "SET_SAVING",
@@ -1185,8 +1269,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1185
1269
  versionId: state.product.version,
1186
1270
  status: result
1187
1271
  };
1188
- _context6.prev = 2;
1189
- _context6.next = 5;
1272
+ _context7.prev = 2;
1273
+ _context7.next = 5;
1190
1274
  return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
1191
1275
  headers: {
1192
1276
  Authorization: token
@@ -1216,13 +1300,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1216
1300
  image: _genericModalCheck.default
1217
1301
  }
1218
1302
  });
1219
- _context6.next = 15;
1303
+ _context7.next = 15;
1220
1304
  break;
1221
1305
 
1222
1306
  case 11:
1223
- _context6.prev = 11;
1224
- _context6.t0 = _context6["catch"](2);
1225
- console.error("Error evaluating to retailer:", _context6.t0);
1307
+ _context7.prev = 11;
1308
+ _context7.t0 = _context7["catch"](2);
1309
+ console.error("Error evaluating to retailer:", _context7.t0);
1226
1310
  dispatch({
1227
1311
  type: "SET_MODAL",
1228
1312
  payload: {
@@ -1234,23 +1318,23 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1234
1318
  });
1235
1319
 
1236
1320
  case 15:
1237
- _context6.prev = 15;
1321
+ _context7.prev = 15;
1238
1322
  dispatch({
1239
1323
  type: "SET_SAVING",
1240
1324
  payload: false
1241
1325
  });
1242
- return _context6.finish(15);
1326
+ return _context7.finish(15);
1243
1327
 
1244
1328
  case 18:
1245
1329
  case "end":
1246
- return _context6.stop();
1330
+ return _context7.stop();
1247
1331
  }
1248
1332
  }
1249
- }, _callee6, null, [[2, 11, 15, 18]]);
1333
+ }, _callee7, null, [[2, 11, 15, 18]]);
1250
1334
  }));
1251
1335
 
1252
- return function evaluationToRetailer(_x4) {
1253
- return _ref10.apply(this, arguments);
1336
+ return function evaluationToRetailer(_x5) {
1337
+ return _ref11.apply(this, arguments);
1254
1338
  };
1255
1339
  }();
1256
1340
 
@@ -1381,18 +1465,18 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1381
1465
  };
1382
1466
 
1383
1467
  var handleOnEvaluateAll = /*#__PURE__*/function () {
1384
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
1468
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(result) {
1385
1469
  var _state$product$id_ord2, _state$services_data2, evaluationArray, conceptArray, dataGeneral, isProvider, userType, status, updatedStatusByRetailer, updatedProduct;
1386
1470
 
1387
- return _regenerator.default.wrap(function _callee7$(_context7) {
1471
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1388
1472
  while (1) {
1389
- switch (_context7.prev = _context7.next) {
1473
+ switch (_context8.prev = _context8.next) {
1390
1474
  case 0:
1391
1475
  dispatch({
1392
1476
  type: "SET_SAVING",
1393
1477
  payload: true
1394
1478
  });
1395
- _context7.prev = 1;
1479
+ _context8.prev = 1;
1396
1480
  evaluationArray = [];
1397
1481
  conceptArray = ["description", "datasheet", "images"];
1398
1482
  dataGeneral = {
@@ -1423,7 +1507,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1423
1507
  }));
1424
1508
  }); // Ejecutar todas las evaluaciones
1425
1509
 
1426
- _context7.next = 9;
1510
+ _context8.next = 9;
1427
1511
  return Promise.all(evaluationArray);
1428
1512
 
1429
1513
  case 9:
@@ -1468,13 +1552,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1468
1552
  image: _genericModalCheck.default
1469
1553
  }
1470
1554
  });
1471
- _context7.next = 24;
1555
+ _context8.next = 24;
1472
1556
  break;
1473
1557
 
1474
1558
  case 20:
1475
- _context7.prev = 20;
1476
- _context7.t0 = _context7["catch"](1);
1477
- console.error("Error evaluating all:", _context7.t0);
1559
+ _context8.prev = 20;
1560
+ _context8.t0 = _context8["catch"](1);
1561
+ console.error("Error evaluating all:", _context8.t0);
1478
1562
  dispatch({
1479
1563
  type: "SET_MODAL",
1480
1564
  payload: {
@@ -1486,24 +1570,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1486
1570
  });
1487
1571
 
1488
1572
  case 24:
1489
- _context7.prev = 24;
1573
+ _context8.prev = 24;
1490
1574
  dispatch({
1491
1575
  type: "SET_SAVING",
1492
1576
  payload: false
1493
1577
  });
1494
1578
  setRejectAll(false);
1495
- return _context7.finish(24);
1579
+ return _context8.finish(24);
1496
1580
 
1497
1581
  case 28:
1498
1582
  case "end":
1499
- return _context7.stop();
1583
+ return _context8.stop();
1500
1584
  }
1501
1585
  }
1502
- }, _callee7, null, [[1, 20, 24, 28]]);
1586
+ }, _callee8, null, [[1, 20, 24, 28]]);
1503
1587
  }));
1504
1588
 
1505
- return function handleOnEvaluateAll(_x5) {
1506
- return _ref11.apply(this, arguments);
1589
+ return function handleOnEvaluateAll(_x6) {
1590
+ return _ref12.apply(this, arguments);
1507
1591
  };
1508
1592
  }();
1509
1593
 
@@ -1556,8 +1640,6 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1556
1640
  articleName: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.name,
1557
1641
  articleUpc: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.upc,
1558
1642
  activeRetailerId: (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer,
1559
- retailersAvailable: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.retailersAvailable,
1560
- categoriesAvailable: (_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.categoriesAvailable,
1561
1643
  token: token,
1562
1644
  onClose: function onClose() {
1563
1645
  return setShowLinkVariants(false);
@@ -1623,21 +1705,21 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1623
1705
  type: "pink",
1624
1706
  label: "Aceptar",
1625
1707
  size: 12,
1626
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1708
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
1627
1709
  var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
1628
- return _regenerator.default.wrap(function _callee8$(_context8) {
1710
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1629
1711
  while (1) {
1630
- switch (_context8.prev = _context8.next) {
1712
+ switch (_context9.prev = _context9.next) {
1631
1713
  case 0:
1632
1714
  elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
1633
1715
 
1634
1716
  if (!(!elements || elements.length === 0)) {
1635
- _context8.next = 4;
1717
+ _context9.next = 4;
1636
1718
  break;
1637
1719
  }
1638
1720
 
1639
1721
  console.error("Elemento no encontrado");
1640
- return _context8.abrupt("return");
1722
+ return _context9.abrupt("return");
1641
1723
 
1642
1724
  case 4:
1643
1725
  isMessageEmpty = Array.from(elements).every(function (el) {
@@ -1646,7 +1728,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1646
1728
  });
1647
1729
 
1648
1730
  if (!isMessageEmpty) {
1649
- _context8.next = 10;
1731
+ _context9.next = 10;
1650
1732
  break;
1651
1733
  }
1652
1734
 
@@ -1661,13 +1743,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1661
1743
  container.appendChild(alert);
1662
1744
  }
1663
1745
 
1664
- return _context8.abrupt("return");
1746
+ return _context9.abrupt("return");
1665
1747
 
1666
1748
  case 10:
1667
1749
  fullMessage = Array.from(elements).map(function (element) {
1668
1750
  return element.innerHTML;
1669
1751
  }).join("").replace(/<br\s*\/?>/gi, "\n");
1670
- _context8.next = 13;
1752
+ _context9.next = 13;
1671
1753
  return createComment(fullMessage, token);
1672
1754
 
1673
1755
  case 13:
@@ -1676,10 +1758,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1676
1758
 
1677
1759
  case 15:
1678
1760
  case "end":
1679
- return _context8.stop();
1761
+ return _context9.stop();
1680
1762
  }
1681
1763
  }
1682
- }, _callee8);
1764
+ }, _callee9);
1683
1765
  }))
1684
1766
  }, "btn-Aceptar")]
1685
1767
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
@@ -1706,7 +1788,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1706
1788
  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] : {},
1707
1789
  assignationsImages: assig,
1708
1790
  retailerSelected: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
1709
- imagesStatus: ((_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.images_status) || "-",
1791
+ imagesStatus: ((_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.images_status) || "-",
1710
1792
  isRetailer: isRetailer,
1711
1793
  setShowVersionSelector: setShowVersionSelector,
1712
1794
  version: state.product.version,
@@ -1719,7 +1801,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1719
1801
  className: "product-information",
1720
1802
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1721
1803
  className: "product-information",
1722
- children: [!((_state$product20 = state.product) !== null && _state$product20 !== void 0 && _state$product20.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1804
+ children: [!((_state$product18 = state.product) !== null && _state$product18 !== void 0 && _state$product18.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1723
1805
  className: "variants-actions",
1724
1806
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
1725
1807
  type: "button",
@@ -1728,7 +1810,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1728
1810
  return setShowLinkVariants(true);
1729
1811
  },
1730
1812
  children: "Ligar productos"
1731
- }), ((_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
1813
+ }), ((_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
1732
1814
  type: "button",
1733
1815
  className: "variants-count",
1734
1816
  "aria-expanded": showFamily,
@@ -1743,7 +1825,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1743
1825
  children: showFamily ? " ▴" : " ▾"
1744
1826
  })]
1745
1827
  })]
1746
- }), ((_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1828
+ }), ((_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1747
1829
  className: "variants-actions",
1748
1830
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
1749
1831
  type: "button",
@@ -1771,12 +1853,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1771
1853
  }), (family === null || family === void 0 ? void 0 : family.parent) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
1772
1854
  type: "button",
1773
1855
  className: "family-row parent",
1856
+ disabled: loadingVariant !== null,
1774
1857
  onClick: function onClick() {
1775
1858
  return openVariant(family.parent.articleId);
1776
1859
  },
1777
1860
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1778
1861
  className: "role",
1779
- children: "Producto padre"
1862
+ children: loadingVariant === family.parent.articleId ? "Abriendo…" : "Producto padre"
1780
1863
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1781
1864
  className: "name",
1782
1865
  children: family.parent.name
@@ -1788,13 +1871,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1788
1871
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
1789
1872
  type: "button",
1790
1873
  className: "family-row".concat(variant.isCurrent ? " current" : ""),
1791
- disabled: variant.isCurrent,
1874
+ disabled: variant.isCurrent || loadingVariant !== null,
1792
1875
  onClick: function onClick() {
1793
1876
  return openVariant(variant.articleId);
1794
1877
  },
1795
1878
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1796
1879
  className: "role",
1797
- children: variant.isCurrent ? "Estás aquí" : "Variante"
1880
+ children: loadingVariant === variant.articleId ? "Abriendo…" : variant.isCurrent ? "Estás aquí" : "Variante"
1798
1881
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1799
1882
  className: "name",
1800
1883
  children: variant.name
@@ -1857,11 +1940,11 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1857
1940
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1858
1941
  className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
1859
1942
  children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1860
- children: [state.active_tab === "Descripción" && (((_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.description_status) !== "NS" ? (_state$descriptions_i = state.descriptions_inputs) !== null && _state$descriptions_i !== void 0 && _state$descriptions_i[0] ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1943
+ children: [state.active_tab === "Descripción" && (((_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.description_status) !== "NS" ? (_state$descriptions_i = state.descriptions_inputs) !== null && _state$descriptions_i !== void 0 && _state$descriptions_i[0] ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1861
1944
  activeSection: state.active_tab,
1862
1945
  inputGroup: state.descriptions_inputs[0],
1863
1946
  updatedDescriptions: state.updated_descriptions_inputs,
1864
- articleId: (_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.id_article,
1947
+ articleId: (_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.id_article,
1865
1948
  version: state.product.version,
1866
1949
  isShowbox: false,
1867
1950
  dinamicHeight: true,
@@ -1873,7 +1956,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1873
1956
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1874
1957
  text: "No cuentas con este servicio",
1875
1958
  headerType: "input-name-header"
1876
- })), state.active_tab === "Ficha técnica" && (((_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1959
+ })), state.active_tab === "Ficha técnica" && (((_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1877
1960
  children: ((_state$datasheets_inp = state.datasheets_inputs) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp[0]) === null || _state$datasheets_inp2 === void 0 ? void 0 : (_state$datasheets_inp3 = _state$datasheets_inp2.data) === null || _state$datasheets_inp3 === void 0 ? void 0 : _state$datasheets_inp3.length) > 0 ? state.datasheets_inputs[0].data.map(function (dataGroup, index) {
1878
1961
  var _state$datasheets_inp4, _state$services, _state$services$datas, _state$services$datas2;
1879
1962
 
@@ -1903,7 +1986,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1903
1986
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1904
1987
  text: "No cuentas con este servicio",
1905
1988
  headerType: "input-name-header"
1906
- })), state.active_tab === "Imágenes" && (((_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1989
+ })), state.active_tab === "Imágenes" && (((_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1907
1990
  children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1908
1991
  checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
1909
1992
  ,