contentoh-components-library 21.6.21 → 21.6.23

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$product12, _state$product13, _state$product14, _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$product15, _state$product16, _state$product17, _state$active_percent, _state$active_percent2, _state$active_retaile7, _state$active_retaile8, _state$active_retaile9, _state$product18, _state$descriptions_i, _state$product19, _state$product20, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product21, _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, _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;
92
92
 
93
93
  var tabsSections = _ref.tabsSections,
94
94
  _ref$productSelected = _ref.productSelected,
@@ -133,39 +133,49 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
133
133
  showLinkVariants = _useState6[0],
134
134
  setShowLinkVariants = _useState6[1];
135
135
 
136
- var _useState7 = (0, _react.useState)(false),
136
+ var _useState7 = (0, _react.useState)(null),
137
137
  _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
138
- showRejectModal = _useState8[0],
139
- setShowRejectModal = _useState8[1];
138
+ family = _useState8[0],
139
+ setFamily = _useState8[1];
140
140
 
141
- var _useState9 = (0, _react.useState)(0),
141
+ var _useState9 = (0, _react.useState)(false),
142
142
  _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
143
- headerTop = _useState10[0],
144
- setHeaderTop = _useState10[1];
143
+ showFamily = _useState10[0],
144
+ setShowFamily = _useState10[1];
145
145
 
146
- var _useState11 = (0, _react.useState)({}),
146
+ var _useState11 = (0, _react.useState)(false),
147
147
  _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
148
- assig = _useState12[0],
149
- setAssig = _useState12[1];
148
+ showRejectModal = _useState12[0],
149
+ setShowRejectModal = _useState12[1];
150
150
 
151
- var _useState13 = (0, _react.useState)(false),
151
+ var _useState13 = (0, _react.useState)(0),
152
152
  _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
153
- imageLayout = _useState14[0],
154
- setImageLayout = _useState14[1];
153
+ headerTop = _useState14[0],
154
+ setHeaderTop = _useState14[1];
155
155
 
156
- var _useState15 = (0, _react.useState)(false),
156
+ var _useState15 = (0, _react.useState)({}),
157
157
  _useState16 = (0, _slicedToArray2.default)(_useState15, 2),
158
- rejectAll = _useState16[0],
159
- setRejectAll = _useState16[1];
158
+ assig = _useState16[0],
159
+ setAssig = _useState16[1];
160
160
 
161
- var _useState17 = (0, _react.useState)({
161
+ var _useState17 = (0, _react.useState)(false),
162
+ _useState18 = (0, _slicedToArray2.default)(_useState17, 2),
163
+ imageLayout = _useState18[0],
164
+ setImageLayout = _useState18[1];
165
+
166
+ var _useState19 = (0, _react.useState)(false),
167
+ _useState20 = (0, _slicedToArray2.default)(_useState19, 2),
168
+ rejectAll = _useState20[0],
169
+ setRejectAll = _useState20[1];
170
+
171
+ var _useState21 = (0, _react.useState)({
162
172
  "Ficha técnica": null,
163
173
  Descripción: null,
164
174
  Imágenes: null
165
175
  }),
166
- _useState18 = (0, _slicedToArray2.default)(_useState17, 2),
167
- origin = _useState18[0],
168
- setOrigin = _useState18[1];
176
+ _useState22 = (0, _slicedToArray2.default)(_useState21, 2),
177
+ origin = _useState22[0],
178
+ setOrigin = _useState22[1];
169
179
 
170
180
  var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
171
181
  _useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
@@ -821,6 +831,121 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
821
831
  payload: items
822
832
  });
823
833
  };
834
+ /*
835
+ Trae la familia del producto: sus variantes, o sus hermanas si el abierto es
836
+ una de ellas.
837
+ Se pide al abrir la sección y no al montar la pantalla: la mayoría de los
838
+ productos no son familia, y una llamada por ficha para no mostrar nada es
839
+ peso que paga todo el mundo por el caso de unos pocos.
840
+ */
841
+
842
+
843
+ var loadFamily = /*#__PURE__*/function () {
844
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
845
+ var _state$product10, res;
846
+
847
+ return _regenerator.default.wrap(function _callee3$(_context3) {
848
+ while (1) {
849
+ switch (_context3.prev = _context3.next) {
850
+ case 0:
851
+ if (!family) {
852
+ _context3.next = 2;
853
+ break;
854
+ }
855
+
856
+ return _context3.abrupt("return");
857
+
858
+ case 2:
859
+ _context3.prev = 2;
860
+ _context3.next = 5;
861
+ return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/family"), {
862
+ articleId: (_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.id_article
863
+ }, {
864
+ headers: {
865
+ Authorization: token
866
+ }
867
+ });
868
+
869
+ case 5:
870
+ res = _context3.sent;
871
+ setFamily((0, _api.readPayload)(res));
872
+ _context3.next = 13;
873
+ break;
874
+
875
+ case 9:
876
+ _context3.prev = 9;
877
+ _context3.t0 = _context3["catch"](2);
878
+ console.error("loadFamily: ", _context3.t0);
879
+ setFamily({
880
+ variants: [],
881
+ parent: null,
882
+ error: true
883
+ });
884
+
885
+ case 13:
886
+ case "end":
887
+ return _context3.stop();
888
+ }
889
+ }
890
+ }, _callee3, null, [[2, 9]]);
891
+ }));
892
+
893
+ return function loadFamily() {
894
+ return _ref7.apply(this, arguments);
895
+ };
896
+ }();
897
+
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
+ };
903
+ /*
904
+ Refresca la ficha después de ligar, sin recargar la página.
905
+ Recargar no servía: el producto de esta pantalla viene del listado —por
906
+ sessionStorage—, así que tras el refresh volvía el mismo objeto de antes y el
907
+ contador seguía mostrando el número viejo. Además una recarga se lleva lo que
908
+ el usuario tenga sin guardar.
909
+ Los dos modos tienen efectos opuestos sobre este producto: ligando hijos GANA
910
+ variantes; ligándose a un padre pasa a SER una, y entonces el botón de ligar
911
+ desaparece porque la jerarquía es de un solo nivel.
912
+ */
913
+
914
+
915
+ var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
916
+ var _state$product$varian, _state$product11, _result$linked, _result$parentArticle;
917
+
918
+ if (!result) return;
919
+ var updatedProduct = result.mode === "children" ? (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
920
+ variantsCount: ((_state$product$varian = (_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
921
+ }) : (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
922
+ parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
923
+ variantsCount: 0
924
+ });
925
+ dispatch({
926
+ type: "SET_PRODUCT",
927
+ payload: updatedProduct
928
+ }); // La lista cacheada quedó vieja: se descarta para que vuelva a pedirse.
929
+
930
+ setFamily(null); // Y en sessionStorage, que es de donde sale el producto al recargar. Sin
931
+ // esto el arreglo dura hasta el siguiente F5 y vuelve el contador viejo,
932
+ // que es justo el síntoma que se reportó.
933
+
934
+ try {
935
+ sessionStorage.setItem("productSelected", JSON.stringify(updatedProduct));
936
+ var productEdit = JSON.parse(sessionStorage.getItem("productEdit"));
937
+
938
+ if (productEdit) {
939
+ sessionStorage.setItem("productEdit", JSON.stringify((0, _objectSpread4.default)((0, _objectSpread4.default)({}, productEdit), {}, {
940
+ product: updatedProduct
941
+ })));
942
+ }
943
+ } catch (error) {
944
+ // Un sessionStorage inaccesible no debe tumbar la pantalla: el estado en
945
+ // memoria ya quedó bien y es lo que el usuario está viendo.
946
+ console.error("linkVariants/sessionStorage: ", error);
947
+ }
948
+ };
824
949
  /*
825
950
  Acción "Volver a heredar del producto" de los chips de herencia.
826
951
  La inicia la variante, no el padre, y descarta un valor capturado a mano: por
@@ -833,24 +958,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
833
958
 
834
959
 
835
960
  var handleOnRestoreInheritance = /*#__PURE__*/function () {
836
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(attributeId) {
837
- var _state$product10;
961
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(attributeId) {
962
+ var _state$product12;
838
963
 
839
964
  var res, data;
840
- return _regenerator.default.wrap(function _callee3$(_context3) {
965
+ return _regenerator.default.wrap(function _callee4$(_context4) {
841
966
  while (1) {
842
- switch (_context3.prev = _context3.next) {
967
+ switch (_context4.prev = _context4.next) {
843
968
  case 0:
844
- if (!(!attributeId || !((_state$product10 = state.product) !== null && _state$product10 !== void 0 && _state$product10.id_article))) {
845
- _context3.next = 2;
969
+ if (!(!attributeId || !((_state$product12 = state.product) !== null && _state$product12 !== void 0 && _state$product12.id_article))) {
970
+ _context4.next = 2;
846
971
  break;
847
972
  }
848
973
 
849
- return _context3.abrupt("return");
974
+ return _context4.abrupt("return");
850
975
 
851
976
  case 2:
852
- _context3.prev = 2;
853
- _context3.next = 5;
977
+ _context4.prev = 2;
978
+ _context4.next = 5;
854
979
  return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), {
855
980
  articleId: state.product.id_article,
856
981
  attributes: [Number(attributeId)]
@@ -861,7 +986,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
861
986
  });
862
987
 
863
988
  case 5:
864
- res = _context3.sent;
989
+ res = _context4.sent;
865
990
  // El API responde 200 aunque la lambda haya devuelto 400: el resultado
866
991
  // real viaja en el cuerpo y readPayload lo convierte en excepción.
867
992
  data = (0, _api.readPayload)(res);
@@ -875,24 +1000,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
875
1000
  };
876
1001
  })
877
1002
  });
878
- _context3.next = 13;
1003
+ _context4.next = 13;
879
1004
  break;
880
1005
 
881
1006
  case 10:
882
- _context3.prev = 10;
883
- _context3.t0 = _context3["catch"](2);
884
- console.error("restoreInheritance: ", _context3.t0);
1007
+ _context4.prev = 10;
1008
+ _context4.t0 = _context4["catch"](2);
1009
+ console.error("restoreInheritance: ", _context4.t0);
885
1010
 
886
1011
  case 13:
887
1012
  case "end":
888
- return _context3.stop();
1013
+ return _context4.stop();
889
1014
  }
890
1015
  }
891
- }, _callee3, null, [[2, 10]]);
1016
+ }, _callee4, null, [[2, 10]]);
892
1017
  }));
893
1018
 
894
1019
  return function handleOnRestoreInheritance(_x2) {
895
- return _ref7.apply(this, arguments);
1020
+ return _ref8.apply(this, arguments);
896
1021
  };
897
1022
  }();
898
1023
 
@@ -927,14 +1052,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
927
1052
  };
928
1053
 
929
1054
  var sendEvaluation = /*#__PURE__*/function () {
930
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(result) {
931
- var _state$product$id_ord, _state$active_retaile2, _state$product$status, _state$product$status2, _state$product11;
1055
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(result) {
1056
+ var _state$product$id_ord, _state$active_retaile2, _state$product$status, _state$product$status2, _state$product13;
932
1057
 
933
1058
  var concept, articleId, orderId, retailerId, evalStatus, data, _newStatuses$newStatu, _state$services_data, res, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, updatedServicesData;
934
1059
 
935
- return _regenerator.default.wrap(function _callee4$(_context4) {
1060
+ return _regenerator.default.wrap(function _callee5$(_context5) {
936
1061
  while (1) {
937
- switch (_context4.prev = _context4.next) {
1062
+ switch (_context5.prev = _context5.next) {
938
1063
  case 0:
939
1064
  dispatch({
940
1065
  type: "SET_SAVING",
@@ -944,23 +1069,23 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
944
1069
  articleId = state.product.id_article;
945
1070
  orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
946
1071
  retailerId = (_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id_retailer;
947
- evalStatus = ((_state$product$status = state.product.statusByRetailer) === null || _state$product$status === void 0 ? void 0 : (_state$product$status2 = _state$product$status[retailerId]) === null || _state$product$status2 === void 0 ? void 0 : _state$product$status2[concept]) || state.product["".concat(concept, "_status")] || ((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.version_status);
1072
+ evalStatus = ((_state$product$status = state.product.statusByRetailer) === null || _state$product$status === void 0 ? void 0 : (_state$product$status2 = _state$product$status[retailerId]) === null || _state$product$status2 === void 0 ? void 0 : _state$product$status2[concept]) || state.product["".concat(concept, "_status")] || ((_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.version_status);
948
1073
  data = {
949
1074
  articleId: articleId,
950
1075
  orderId: orderId,
951
1076
  concept: concept,
952
1077
  evalStatus: evalStatus
953
1078
  };
954
- _context4.prev = 7;
1079
+ _context5.prev = 7;
955
1080
 
956
1081
  if (!result) {
957
- _context4.next = 22;
1082
+ _context5.next = 22;
958
1083
  break;
959
1084
  }
960
1085
 
961
1086
  data.result = result;
962
1087
  data.retailerId = retailerId;
963
- _context4.next = 13;
1088
+ _context5.next = 13;
964
1089
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
965
1090
  headers: {
966
1091
  Authorization: token
@@ -968,7 +1093,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
968
1093
  });
969
1094
 
970
1095
  case 13:
971
- res = _context4.sent;
1096
+ res = _context5.sent;
972
1097
  newStatuses = JSON.parse(res.data.body);
973
1098
  serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")]; // Actualizar el producto con los nuevos estados
974
1099
 
@@ -1005,13 +1130,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1005
1130
  });
1006
1131
 
1007
1132
  case 22:
1008
- _context4.next = 28;
1133
+ _context5.next = 28;
1009
1134
  break;
1010
1135
 
1011
1136
  case 24:
1012
- _context4.prev = 24;
1013
- _context4.t0 = _context4["catch"](7);
1014
- console.error("Error sending evaluation:", _context4.t0);
1137
+ _context5.prev = 24;
1138
+ _context5.t0 = _context5["catch"](7);
1139
+ console.error("Error sending evaluation:", _context5.t0);
1015
1140
  dispatch({
1016
1141
  type: "SET_MODAL",
1017
1142
  payload: {
@@ -1023,32 +1148,32 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1023
1148
  });
1024
1149
 
1025
1150
  case 28:
1026
- _context4.prev = 28;
1151
+ _context5.prev = 28;
1027
1152
  dispatch({
1028
1153
  type: "SET_SAVING",
1029
1154
  payload: false
1030
1155
  });
1031
- return _context4.finish(28);
1156
+ return _context5.finish(28);
1032
1157
 
1033
1158
  case 31:
1034
1159
  case "end":
1035
- return _context4.stop();
1160
+ return _context5.stop();
1036
1161
  }
1037
1162
  }
1038
- }, _callee4, null, [[7, 24, 28, 31]]);
1163
+ }, _callee5, null, [[7, 24, 28, 31]]);
1039
1164
  }));
1040
1165
 
1041
1166
  return function sendEvaluation(_x3) {
1042
- return _ref8.apply(this, arguments);
1167
+ return _ref9.apply(this, arguments);
1043
1168
  };
1044
1169
  }();
1045
1170
 
1046
1171
  var evaluationToRetailer = /*#__PURE__*/function () {
1047
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(result) {
1172
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(result) {
1048
1173
  var data, statusComplete, updatedProduct;
1049
- return _regenerator.default.wrap(function _callee5$(_context5) {
1174
+ return _regenerator.default.wrap(function _callee6$(_context6) {
1050
1175
  while (1) {
1051
- switch (_context5.prev = _context5.next) {
1176
+ switch (_context6.prev = _context6.next) {
1052
1177
  case 0:
1053
1178
  dispatch({
1054
1179
  type: "SET_SAVING",
@@ -1060,8 +1185,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1060
1185
  versionId: state.product.version,
1061
1186
  status: result
1062
1187
  };
1063
- _context5.prev = 2;
1064
- _context5.next = 5;
1188
+ _context6.prev = 2;
1189
+ _context6.next = 5;
1065
1190
  return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
1066
1191
  headers: {
1067
1192
  Authorization: token
@@ -1091,13 +1216,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1091
1216
  image: _genericModalCheck.default
1092
1217
  }
1093
1218
  });
1094
- _context5.next = 15;
1219
+ _context6.next = 15;
1095
1220
  break;
1096
1221
 
1097
1222
  case 11:
1098
- _context5.prev = 11;
1099
- _context5.t0 = _context5["catch"](2);
1100
- console.error("Error evaluating to retailer:", _context5.t0);
1223
+ _context6.prev = 11;
1224
+ _context6.t0 = _context6["catch"](2);
1225
+ console.error("Error evaluating to retailer:", _context6.t0);
1101
1226
  dispatch({
1102
1227
  type: "SET_MODAL",
1103
1228
  payload: {
@@ -1109,23 +1234,23 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1109
1234
  });
1110
1235
 
1111
1236
  case 15:
1112
- _context5.prev = 15;
1237
+ _context6.prev = 15;
1113
1238
  dispatch({
1114
1239
  type: "SET_SAVING",
1115
1240
  payload: false
1116
1241
  });
1117
- return _context5.finish(15);
1242
+ return _context6.finish(15);
1118
1243
 
1119
1244
  case 18:
1120
1245
  case "end":
1121
- return _context5.stop();
1246
+ return _context6.stop();
1122
1247
  }
1123
1248
  }
1124
- }, _callee5, null, [[2, 11, 15, 18]]);
1249
+ }, _callee6, null, [[2, 11, 15, 18]]);
1125
1250
  }));
1126
1251
 
1127
1252
  return function evaluationToRetailer(_x4) {
1128
- return _ref9.apply(this, arguments);
1253
+ return _ref10.apply(this, arguments);
1129
1254
  };
1130
1255
  }();
1131
1256
 
@@ -1256,18 +1381,18 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1256
1381
  };
1257
1382
 
1258
1383
  var handleOnEvaluateAll = /*#__PURE__*/function () {
1259
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(result) {
1384
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
1260
1385
  var _state$product$id_ord2, _state$services_data2, evaluationArray, conceptArray, dataGeneral, isProvider, userType, status, updatedStatusByRetailer, updatedProduct;
1261
1386
 
1262
- return _regenerator.default.wrap(function _callee6$(_context6) {
1387
+ return _regenerator.default.wrap(function _callee7$(_context7) {
1263
1388
  while (1) {
1264
- switch (_context6.prev = _context6.next) {
1389
+ switch (_context7.prev = _context7.next) {
1265
1390
  case 0:
1266
1391
  dispatch({
1267
1392
  type: "SET_SAVING",
1268
1393
  payload: true
1269
1394
  });
1270
- _context6.prev = 1;
1395
+ _context7.prev = 1;
1271
1396
  evaluationArray = [];
1272
1397
  conceptArray = ["description", "datasheet", "images"];
1273
1398
  dataGeneral = {
@@ -1298,7 +1423,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1298
1423
  }));
1299
1424
  }); // Ejecutar todas las evaluaciones
1300
1425
 
1301
- _context6.next = 9;
1426
+ _context7.next = 9;
1302
1427
  return Promise.all(evaluationArray);
1303
1428
 
1304
1429
  case 9:
@@ -1343,13 +1468,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1343
1468
  image: _genericModalCheck.default
1344
1469
  }
1345
1470
  });
1346
- _context6.next = 24;
1471
+ _context7.next = 24;
1347
1472
  break;
1348
1473
 
1349
1474
  case 20:
1350
- _context6.prev = 20;
1351
- _context6.t0 = _context6["catch"](1);
1352
- console.error("Error evaluating all:", _context6.t0);
1475
+ _context7.prev = 20;
1476
+ _context7.t0 = _context7["catch"](1);
1477
+ console.error("Error evaluating all:", _context7.t0);
1353
1478
  dispatch({
1354
1479
  type: "SET_MODAL",
1355
1480
  payload: {
@@ -1361,24 +1486,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1361
1486
  });
1362
1487
 
1363
1488
  case 24:
1364
- _context6.prev = 24;
1489
+ _context7.prev = 24;
1365
1490
  dispatch({
1366
1491
  type: "SET_SAVING",
1367
1492
  payload: false
1368
1493
  });
1369
1494
  setRejectAll(false);
1370
- return _context6.finish(24);
1495
+ return _context7.finish(24);
1371
1496
 
1372
1497
  case 28:
1373
1498
  case "end":
1374
- return _context6.stop();
1499
+ return _context7.stop();
1375
1500
  }
1376
1501
  }
1377
- }, _callee6, null, [[1, 20, 24, 28]]);
1502
+ }, _callee7, null, [[1, 20, 24, 28]]);
1378
1503
  }));
1379
1504
 
1380
1505
  return function handleOnEvaluateAll(_x5) {
1381
- return _ref10.apply(this, arguments);
1506
+ return _ref11.apply(this, arguments);
1382
1507
  };
1383
1508
  }();
1384
1509
 
@@ -1427,17 +1552,17 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1427
1552
  setShowVersionSelector: setShowVersionSelector,
1428
1553
  jwt: token
1429
1554
  }), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
1430
- articleId: (_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.id_article,
1431
- articleName: (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.name,
1432
- articleUpc: (_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.upc,
1555
+ articleId: (_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.id_article,
1556
+ articleName: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.name,
1557
+ articleUpc: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.upc,
1433
1558
  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,
1434
1561
  token: token,
1435
1562
  onClose: function onClose() {
1436
1563
  return setShowLinkVariants(false);
1437
1564
  },
1438
- onLinked: function onLinked() {
1439
- return window.location.reload();
1440
- }
1565
+ onLinked: handleOnLinkedVariants
1441
1566
  }), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
1442
1567
  images: state.images_values,
1443
1568
  setShowModal: setShowModal,
@@ -1498,21 +1623,21 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1498
1623
  type: "pink",
1499
1624
  label: "Aceptar",
1500
1625
  size: 12,
1501
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
1626
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1502
1627
  var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
1503
- return _regenerator.default.wrap(function _callee7$(_context7) {
1628
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1504
1629
  while (1) {
1505
- switch (_context7.prev = _context7.next) {
1630
+ switch (_context8.prev = _context8.next) {
1506
1631
  case 0:
1507
1632
  elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
1508
1633
 
1509
1634
  if (!(!elements || elements.length === 0)) {
1510
- _context7.next = 4;
1635
+ _context8.next = 4;
1511
1636
  break;
1512
1637
  }
1513
1638
 
1514
1639
  console.error("Elemento no encontrado");
1515
- return _context7.abrupt("return");
1640
+ return _context8.abrupt("return");
1516
1641
 
1517
1642
  case 4:
1518
1643
  isMessageEmpty = Array.from(elements).every(function (el) {
@@ -1521,7 +1646,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1521
1646
  });
1522
1647
 
1523
1648
  if (!isMessageEmpty) {
1524
- _context7.next = 10;
1649
+ _context8.next = 10;
1525
1650
  break;
1526
1651
  }
1527
1652
 
@@ -1536,13 +1661,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1536
1661
  container.appendChild(alert);
1537
1662
  }
1538
1663
 
1539
- return _context7.abrupt("return");
1664
+ return _context8.abrupt("return");
1540
1665
 
1541
1666
  case 10:
1542
1667
  fullMessage = Array.from(elements).map(function (element) {
1543
1668
  return element.innerHTML;
1544
1669
  }).join("").replace(/<br\s*\/?>/gi, "\n");
1545
- _context7.next = 13;
1670
+ _context8.next = 13;
1546
1671
  return createComment(fullMessage, token);
1547
1672
 
1548
1673
  case 13:
@@ -1551,10 +1676,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1551
1676
 
1552
1677
  case 15:
1553
1678
  case "end":
1554
- return _context7.stop();
1679
+ return _context8.stop();
1555
1680
  }
1556
1681
  }
1557
- }, _callee7);
1682
+ }, _callee8);
1558
1683
  }))
1559
1684
  }, "btn-Aceptar")]
1560
1685
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
@@ -1581,7 +1706,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1581
1706
  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] : {},
1582
1707
  assignationsImages: assig,
1583
1708
  retailerSelected: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
1584
- imagesStatus: ((_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.images_status) || "-",
1709
+ imagesStatus: ((_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.images_status) || "-",
1585
1710
  isRetailer: isRetailer,
1586
1711
  setShowVersionSelector: setShowVersionSelector,
1587
1712
  version: state.product.version,
@@ -1594,7 +1719,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1594
1719
  className: "product-information",
1595
1720
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1596
1721
  className: "product-information",
1597
- children: [!((_state$product16 = state.product) !== null && _state$product16 !== void 0 && _state$product16.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1722
+ children: [!((_state$product20 = state.product) !== null && _state$product20 !== void 0 && _state$product20.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1598
1723
  className: "variants-actions",
1599
1724
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
1600
1725
  type: "button",
@@ -1603,9 +1728,84 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1603
1728
  return setShowLinkVariants(true);
1604
1729
  },
1605
1730
  children: "Ligar productos"
1606
- }), ((_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1731
+ }), ((_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
1732
+ type: "button",
1607
1733
  className: "variants-count",
1608
- children: [state.product.variantsCount, " variante", state.product.variantsCount === 1 ? "" : "s"]
1734
+ "aria-expanded": showFamily,
1735
+ onClick: function onClick() {
1736
+ setShowFamily(function (abierto) {
1737
+ return !abierto;
1738
+ });
1739
+ loadFamily();
1740
+ },
1741
+ children: [state.product.variantsCount, " variante", state.product.variantsCount === 1 ? "" : "s", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1742
+ "aria-hidden": "true",
1743
+ children: showFamily ? " ▴" : " ▾"
1744
+ })]
1745
+ })]
1746
+ }), ((_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1747
+ className: "variants-actions",
1748
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
1749
+ type: "button",
1750
+ className: "variants-count",
1751
+ "aria-expanded": showFamily,
1752
+ onClick: function onClick() {
1753
+ setShowFamily(function (abierto) {
1754
+ return !abierto;
1755
+ });
1756
+ loadFamily();
1757
+ },
1758
+ children: ["Variante de otro producto", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1759
+ "aria-hidden": "true",
1760
+ children: showFamily ? " ▴" : " ▾"
1761
+ })]
1762
+ })
1763
+ }), showFamily && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1764
+ className: "variants-family",
1765
+ children: [!family && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1766
+ className: "loading",
1767
+ children: "Cargando familia\u2026"
1768
+ }), (family === null || family === void 0 ? void 0 : family.error) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1769
+ className: "loading",
1770
+ children: "No se pudo cargar la familia de este producto."
1771
+ }), (family === null || family === void 0 ? void 0 : family.parent) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
1772
+ type: "button",
1773
+ className: "family-row parent",
1774
+ onClick: function onClick() {
1775
+ return openVariant(family.parent.articleId);
1776
+ },
1777
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1778
+ className: "role",
1779
+ children: "Producto padre"
1780
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1781
+ className: "name",
1782
+ children: family.parent.name
1783
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1784
+ className: "upc",
1785
+ children: family.parent.upc
1786
+ })]
1787
+ }), family === null || family === void 0 ? void 0 : (_family$variants = family.variants) === null || _family$variants === void 0 ? void 0 : _family$variants.map(function (variant) {
1788
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
1789
+ type: "button",
1790
+ className: "family-row".concat(variant.isCurrent ? " current" : ""),
1791
+ disabled: variant.isCurrent,
1792
+ onClick: function onClick() {
1793
+ return openVariant(variant.articleId);
1794
+ },
1795
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1796
+ className: "role",
1797
+ children: variant.isCurrent ? "Estás aquí" : "Variante"
1798
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1799
+ className: "name",
1800
+ children: variant.name
1801
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1802
+ className: "upc",
1803
+ children: variant.upc
1804
+ })]
1805
+ }, variant.articleId);
1806
+ }), family && !family.error && !((_family$variants2 = family.variants) !== null && _family$variants2 !== void 0 && _family$variants2.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1807
+ className: "loading",
1808
+ children: "Este producto no tiene variantes."
1609
1809
  })]
1610
1810
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
1611
1811
  headerData: state.product,
@@ -1657,11 +1857,11 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1657
1857
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1658
1858
  className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
1659
1859
  children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1660
- children: [state.active_tab === "Descripción" && (((_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.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, {
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, {
1661
1861
  activeSection: state.active_tab,
1662
1862
  inputGroup: state.descriptions_inputs[0],
1663
1863
  updatedDescriptions: state.updated_descriptions_inputs,
1664
- articleId: (_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.id_article,
1864
+ articleId: (_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.id_article,
1665
1865
  version: state.product.version,
1666
1866
  isShowbox: false,
1667
1867
  dinamicHeight: true,
@@ -1673,7 +1873,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1673
1873
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1674
1874
  text: "No cuentas con este servicio",
1675
1875
  headerType: "input-name-header"
1676
- })), 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, {
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, {
1677
1877
  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) {
1678
1878
  var _state$datasheets_inp4, _state$services, _state$services$datas, _state$services$datas2;
1679
1879
 
@@ -1703,7 +1903,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1703
1903
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1704
1904
  text: "No cuentas con este servicio",
1705
1905
  headerType: "input-name-header"
1706
- })), 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, {
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, {
1707
1907
  children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1708
1908
  checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
1709
1909
  ,