contentoh-components-library 21.6.42 → 21.6.44
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.
|
@@ -236,7 +236,7 @@ function _regenerateVideoThumbnails() {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
239
|
-
var _state$product10, _family$variants, _state$product11, _state$errors, _family$variants2, _state$product15, _state$product16, _state$product17, _state$
|
|
239
|
+
var _state$product10, _family$variants, _state$product11, _state$errors, _family$variants2, _state$product15, _state$product16, _state$product17, _state$active_retaile6, _location$state, _location$state2, _state$active_retaile7, _state$active_retaile8, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product18, _state$active_retaile9, _family$variants3, _family$variants4, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile10, _state$active_retaile11, _state$active_retaile12, _state$product24, _state$services2, _state$services2$data, _state$product25, _state$product26, _state$datasheets_inp, _state$datasheets_inp2, _state$product27, _state$images_values12, _state$comment;
|
|
240
240
|
|
|
241
241
|
var tabsSections = _ref.tabsSections,
|
|
242
242
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -740,6 +740,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
740
740
|
versionSelected,
|
|
741
741
|
_services$,
|
|
742
742
|
_retailerDatasheets$d,
|
|
743
|
+
_state$active_retaile2,
|
|
743
744
|
_state$product4,
|
|
744
745
|
id_article,
|
|
745
746
|
version,
|
|
@@ -767,6 +768,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
767
768
|
retailerDatasheets,
|
|
768
769
|
datasheetsActiveRetailer,
|
|
769
770
|
descriptionsActiveRetailer,
|
|
771
|
+
activeRetailerId,
|
|
770
772
|
filteredValues,
|
|
771
773
|
orderedValuesWithThumbs,
|
|
772
774
|
filteredValuesWithThumbs,
|
|
@@ -911,23 +913,33 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
911
913
|
descriptionsActiveRetailer = services[1].filter(function (item) {
|
|
912
914
|
return item.id === id_retailer;
|
|
913
915
|
});
|
|
916
|
+
/**
|
|
917
|
+
* El id del retailer activo viene con dos nombres según de dónde salga:
|
|
918
|
+
* `categoryRetailerInOrder` lo trae como `id_retailer`, mientras que los
|
|
919
|
+
* retailers de `read-data-images` lo traen como `id`. Si se compara solo
|
|
920
|
+
* contra uno, al cambiar de cadena el otro queda `undefined`, la
|
|
921
|
+
* comparación es siempre falsa y `filteredValues` sale vacío — la imagen
|
|
922
|
+
* existe, el backend la devuelve, y aun así no se pinta ninguna.
|
|
923
|
+
*/
|
|
924
|
+
|
|
925
|
+
activeRetailerId = id_retailer !== null && id_retailer !== void 0 ? id_retailer : (_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id;
|
|
914
926
|
filteredValues = services[2].values.filter(function (value) {
|
|
915
927
|
return services[2].inputsByRetailer.some(function (retailerInput) {
|
|
916
928
|
return retailerInput.some(function (input) {
|
|
917
|
-
return input.id_retailer ===
|
|
929
|
+
return Number(input.id_retailer) === Number(activeRetailerId) && Number(input.id_image) === Number(value.image_id);
|
|
918
930
|
});
|
|
919
931
|
});
|
|
920
932
|
}); // Regenerar thumbnails de videos guardados para que se muestren.
|
|
921
933
|
|
|
922
|
-
_context4.next =
|
|
934
|
+
_context4.next = 35;
|
|
923
935
|
return regenerateVideoThumbnails(orderedValues);
|
|
924
936
|
|
|
925
|
-
case
|
|
937
|
+
case 35:
|
|
926
938
|
orderedValuesWithThumbs = _context4.sent;
|
|
927
|
-
_context4.next =
|
|
939
|
+
_context4.next = 38;
|
|
928
940
|
return regenerateVideoThumbnails(filteredValues);
|
|
929
941
|
|
|
930
|
-
case
|
|
942
|
+
case 38:
|
|
931
943
|
filteredValuesWithThumbs = _context4.sent;
|
|
932
944
|
// Dispatch consolidado
|
|
933
945
|
dispatch({
|
|
@@ -980,11 +992,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
980
992
|
loadAuditableData();
|
|
981
993
|
}
|
|
982
994
|
|
|
983
|
-
_context4.next =
|
|
995
|
+
_context4.next = 54;
|
|
984
996
|
break;
|
|
985
997
|
|
|
986
|
-
case
|
|
987
|
-
_context4.prev =
|
|
998
|
+
case 50:
|
|
999
|
+
_context4.prev = 50;
|
|
988
1000
|
_context4.t0 = _context4["catch"](2);
|
|
989
1001
|
console.log("Error loading data: ", _context4.t0);
|
|
990
1002
|
dispatch({
|
|
@@ -992,20 +1004,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
992
1004
|
payload: [_context4.t0.message]
|
|
993
1005
|
});
|
|
994
1006
|
|
|
995
|
-
case
|
|
996
|
-
_context4.prev =
|
|
1007
|
+
case 54:
|
|
1008
|
+
_context4.prev = 54;
|
|
997
1009
|
dispatch({
|
|
998
1010
|
type: "SET_LOADING",
|
|
999
1011
|
payload: false
|
|
1000
1012
|
});
|
|
1001
|
-
return _context4.finish(
|
|
1013
|
+
return _context4.finish(54);
|
|
1002
1014
|
|
|
1003
|
-
case
|
|
1015
|
+
case 57:
|
|
1004
1016
|
case "end":
|
|
1005
1017
|
return _context4.stop();
|
|
1006
1018
|
}
|
|
1007
1019
|
}
|
|
1008
|
-
}, _callee4, null, [[2,
|
|
1020
|
+
}, _callee4, null, [[2, 50, 54, 57]]);
|
|
1009
1021
|
}));
|
|
1010
1022
|
|
|
1011
1023
|
return function loadData() {
|
|
@@ -1108,9 +1120,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1108
1120
|
|
|
1109
1121
|
var concept = (0, _utils.getConceptByTab)(action || state.active_tab);
|
|
1110
1122
|
var retailerStatus = (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : (_state$services_data$ = _state$services_data.find(function (srv) {
|
|
1111
|
-
var _state$
|
|
1123
|
+
var _state$active_retaile3;
|
|
1112
1124
|
|
|
1113
|
-
return srv.id_retailer === ((_state$
|
|
1125
|
+
return srv.id_retailer === ((_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer) && srv.service === concept;
|
|
1114
1126
|
})) === null || _state$services_data$ === void 0 ? void 0 : (_state$services_data$2 = _state$services_data$.status) === null || _state$services_data$2 === void 0 ? void 0 : _state$services_data$2.replace(/.*\//, ""); // Se SUMA la vía por asignación a la que ya había por rol; no la
|
|
1115
1127
|
// reemplaza. Así los coordinadores y el administrador conservan su acceso
|
|
1116
1128
|
// tal cual, y el especialista que además es auditor alcanza la segunda fase.
|
|
@@ -1618,9 +1630,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1618
1630
|
|
|
1619
1631
|
|
|
1620
1632
|
var cambiosDeFichaTecnica = function cambiosDeFichaTecnica() {
|
|
1621
|
-
var _state$
|
|
1633
|
+
var _state$active_retaile4, _state$services$datas, _state$services, _state$services$datas2, _state$updated_datash;
|
|
1622
1634
|
|
|
1623
|
-
var retailerId = (_state$
|
|
1635
|
+
var retailerId = (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.id_retailer;
|
|
1624
1636
|
var inputs = (_state$services$datas = (_state$services = state.services) === null || _state$services === void 0 ? void 0 : (_state$services$datas2 = _state$services.datasheets) === null || _state$services$datas2 === void 0 ? void 0 : _state$services$datas2.inputs) !== null && _state$services$datas !== void 0 ? _state$services$datas : {};
|
|
1625
1637
|
return ((_state$updated_datash = state.updated_datasheets_inputs) !== null && _state$updated_datash !== void 0 ? _state$updated_datash : []).map(function (item) {
|
|
1626
1638
|
var _input$name;
|
|
@@ -1885,7 +1897,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1885
1897
|
|
|
1886
1898
|
var sendSingleEvaluation = /*#__PURE__*/function () {
|
|
1887
1899
|
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
|
|
1888
|
-
var _state$product$id_ord, _state$
|
|
1900
|
+
var _state$product$id_ord, _state$active_retaile5;
|
|
1889
1901
|
|
|
1890
1902
|
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;
|
|
1891
1903
|
|
|
@@ -1910,7 +1922,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1910
1922
|
orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
|
|
1911
1923
|
sectionStatusKey = "".concat(concept, "_status");
|
|
1912
1924
|
evalStatus = state.product[sectionStatusKey];
|
|
1913
|
-
retailerId = (_state$
|
|
1925
|
+
retailerId = (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.id_retailer;
|
|
1914
1926
|
data = {
|
|
1915
1927
|
articleId: articleId,
|
|
1916
1928
|
orderId: orderId,
|
|
@@ -2725,7 +2737,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2725
2737
|
articleId: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_article,
|
|
2726
2738
|
articleName: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.name,
|
|
2727
2739
|
articleUpc: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.upc,
|
|
2728
|
-
activeRetailerId: (_state$
|
|
2740
|
+
activeRetailerId: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
|
|
2729
2741
|
token: token,
|
|
2730
2742
|
onClose: function onClose() {
|
|
2731
2743
|
return setShowLinkVariants(false);
|
|
@@ -2874,8 +2886,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2874
2886
|
productSelected: state.product,
|
|
2875
2887
|
token: token,
|
|
2876
2888
|
activeRetailer: {
|
|
2877
|
-
id: (_state$
|
|
2878
|
-
name: (_state$
|
|
2889
|
+
id: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.id_retailer,
|
|
2890
|
+
name: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.retailer
|
|
2879
2891
|
}
|
|
2880
2892
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2881
2893
|
className: "data-container",
|
|
@@ -2892,7 +2904,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2892
2904
|
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] : {},
|
|
2893
2905
|
assignationsImages: state.collaborator_assignations["Imágenes"],
|
|
2894
2906
|
imagesStatus: ((_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.images_status) || "-",
|
|
2895
|
-
retailerSelected: (_state$
|
|
2907
|
+
retailerSelected: (_state$active_retaile9 = state.active_retailer) === null || _state$active_retaile9 === void 0 ? void 0 : _state$active_retaile9.id_retailer,
|
|
2896
2908
|
isRetailer: isRetailer,
|
|
2897
2909
|
version: state.product.version,
|
|
2898
2910
|
shotThd: shotThd,
|
|
@@ -3044,9 +3056,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3044
3056
|
productObservation: observation,
|
|
3045
3057
|
percent: (_state$active_percent = (_state$active_percent2 = state.active_percentage) === null || _state$active_percent2 === void 0 ? void 0 : (_state$active_percent3 = _state$active_percent2.percentagesGeneral) === null || _state$active_percent3 === void 0 ? void 0 : _state$active_percent3.required) !== null && _state$active_percent !== void 0 ? _state$active_percent : 0,
|
|
3046
3058
|
activeRetailer: {
|
|
3047
|
-
id: (_state$
|
|
3048
|
-
name: (_state$
|
|
3049
|
-
image: (_state$
|
|
3059
|
+
id: (_state$active_retaile10 = state.active_retailer) === null || _state$active_retaile10 === void 0 ? void 0 : _state$active_retaile10.id_retailer,
|
|
3060
|
+
name: (_state$active_retaile11 = state.active_retailer) === null || _state$active_retaile11 === void 0 ? void 0 : _state$active_retaile11.retailer,
|
|
3061
|
+
image: (_state$active_retaile12 = state.active_retailer) === null || _state$active_retaile12 === void 0 ? void 0 : _state$active_retaile12.image
|
|
3050
3062
|
},
|
|
3051
3063
|
servicesData: state.services_data ? state.services_data : null,
|
|
3052
3064
|
isObservationVisible: isObservationVisible // actions
|
|
@@ -54,12 +54,31 @@ var getRetailerServices = /*#__PURE__*/function () {
|
|
|
54
54
|
descriptions = JSON.parse(responseArray[1].data.body).data;
|
|
55
55
|
images = JSON.parse(responseArray[2].data.body).data;
|
|
56
56
|
images.values = images === null || images === void 0 ? void 0 : (_images$values = images.values) === null || _images$values === void 0 ? void 0 : _images$values.map(function (value) {
|
|
57
|
-
var _images$inputs$find;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
var _value$image_id, _images$inputs$find;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* La fila de `rel_article_image` trae la columna `id_image`; el resto del
|
|
61
|
+
* front lee `image_id`. Sin normalizarlo aquí queda `undefined`, y eso
|
|
62
|
+
* rompe DOS cosas a la vez:
|
|
63
|
+
*
|
|
64
|
+
* - `getImage` toma su rama `else` y deja `src` con la clave cruda de
|
|
65
|
+
* S3 en lugar de la URL de CloudFront, así que la etiqueta <img>
|
|
66
|
+
* apunta a una ruta relativa.
|
|
67
|
+
* - el filtro `filteredValues` de `RetailerProductEdition` compara
|
|
68
|
+
* `value.image_id` contra las reglas del retailer, no encuentra
|
|
69
|
+
* coincidencia y descarta la imagen.
|
|
70
|
+
*
|
|
71
|
+
* Resultado: la pantalla dice «Este producto no tiene imágenes» aunque la
|
|
72
|
+
* fila exista y el archivo esté en S3. Antes de guardar sí se veía, porque
|
|
73
|
+
* el objeto que arma el front al elegir el archivo sí trae `image_id`.
|
|
74
|
+
*/
|
|
75
|
+
var normalized = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, value), {}, {
|
|
76
|
+
image_id: (_value$image_id = value.image_id) !== null && _value$image_id !== void 0 ? _value$image_id : value.id_image
|
|
77
|
+
});
|
|
78
|
+
normalized.name = (_images$inputs$find = images.inputs.find(function (e) {
|
|
79
|
+
return e.id === normalized.image_id;
|
|
61
80
|
})) === null || _images$inputs$find === void 0 ? void 0 : _images$inputs$find.name;
|
|
62
|
-
return getImage(
|
|
81
|
+
return getImage(normalized);
|
|
63
82
|
});
|
|
64
83
|
return _context.abrupt("return", [datasheets, descriptions, images]);
|
|
65
84
|
|
|
@@ -88,7 +107,14 @@ var getImage = function getImage(imageGeneral) {
|
|
|
88
107
|
var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 250;
|
|
89
108
|
|
|
90
109
|
try {
|
|
91
|
-
var
|
|
110
|
+
var _imageGeneral$image_i;
|
|
111
|
+
|
|
112
|
+
// `id_image` es el nombre de la columna en base de datos; `image_id` el que
|
|
113
|
+
// usa el front. Se acepta cualquiera de los dos para que la URL se arme
|
|
114
|
+
// igual, venga la imagen del backend o del estado local.
|
|
115
|
+
var image = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, imageGeneral), {}, {
|
|
116
|
+
image_id: (_imageGeneral$image_i = imageGeneral.image_id) !== null && _imageGeneral$image_i !== void 0 ? _imageGeneral$image_i : imageGeneral.id_image
|
|
117
|
+
});
|
|
92
118
|
var ext = image.src.split(".");
|
|
93
119
|
var uuid = ext[0].split("-");
|
|
94
120
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, image), {}, {
|
package/package.json
CHANGED
|
@@ -579,12 +579,22 @@ const RetailerProductEditionView = ({
|
|
|
579
579
|
(item) => item.id === id_retailer,
|
|
580
580
|
);
|
|
581
581
|
|
|
582
|
+
/**
|
|
583
|
+
* El id del retailer activo viene con dos nombres según de dónde salga:
|
|
584
|
+
* `categoryRetailerInOrder` lo trae como `id_retailer`, mientras que los
|
|
585
|
+
* retailers de `read-data-images` lo traen como `id`. Si se compara solo
|
|
586
|
+
* contra uno, al cambiar de cadena el otro queda `undefined`, la
|
|
587
|
+
* comparación es siempre falsa y `filteredValues` sale vacío — la imagen
|
|
588
|
+
* existe, el backend la devuelve, y aun así no se pinta ninguna.
|
|
589
|
+
*/
|
|
590
|
+
const activeRetailerId = id_retailer ?? state.active_retailer?.id;
|
|
591
|
+
|
|
582
592
|
const filteredValues = services[2].values.filter((value) => {
|
|
583
593
|
return services[2].inputsByRetailer.some((retailerInput) =>
|
|
584
594
|
retailerInput.some(
|
|
585
595
|
(input) =>
|
|
586
|
-
input.id_retailer ===
|
|
587
|
-
input.id_image === value.image_id,
|
|
596
|
+
Number(input.id_retailer) === Number(activeRetailerId) &&
|
|
597
|
+
Number(input.id_image) === Number(value.image_id),
|
|
588
598
|
),
|
|
589
599
|
);
|
|
590
600
|
});
|
package/src/global-files/data.js
CHANGED
|
@@ -35,8 +35,30 @@ export const getRetailerServices = async (
|
|
|
35
35
|
const images = JSON.parse(responseArray[2].data.body).data;
|
|
36
36
|
|
|
37
37
|
images.values = images?.values?.map((value) => {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* La fila de `rel_article_image` trae la columna `id_image`; el resto del
|
|
40
|
+
* front lee `image_id`. Sin normalizarlo aquí queda `undefined`, y eso
|
|
41
|
+
* rompe DOS cosas a la vez:
|
|
42
|
+
*
|
|
43
|
+
* - `getImage` toma su rama `else` y deja `src` con la clave cruda de
|
|
44
|
+
* S3 en lugar de la URL de CloudFront, así que la etiqueta <img>
|
|
45
|
+
* apunta a una ruta relativa.
|
|
46
|
+
* - el filtro `filteredValues` de `RetailerProductEdition` compara
|
|
47
|
+
* `value.image_id` contra las reglas del retailer, no encuentra
|
|
48
|
+
* coincidencia y descarta la imagen.
|
|
49
|
+
*
|
|
50
|
+
* Resultado: la pantalla dice «Este producto no tiene imágenes» aunque la
|
|
51
|
+
* fila exista y el archivo esté en S3. Antes de guardar sí se veía, porque
|
|
52
|
+
* el objeto que arma el front al elegir el archivo sí trae `image_id`.
|
|
53
|
+
*/
|
|
54
|
+
const normalized = {
|
|
55
|
+
...value,
|
|
56
|
+
image_id: value.image_id ?? value.id_image,
|
|
57
|
+
};
|
|
58
|
+
normalized.name = images.inputs.find(
|
|
59
|
+
(e) => e.id === normalized.image_id
|
|
60
|
+
)?.name;
|
|
61
|
+
return getImage(normalized);
|
|
40
62
|
});
|
|
41
63
|
|
|
42
64
|
return [datasheets, descriptions, images];
|
|
@@ -47,7 +69,13 @@ export const getRetailerServices = async (
|
|
|
47
69
|
|
|
48
70
|
export const getImage = (imageGeneral, width = 250, height = 250) => {
|
|
49
71
|
try {
|
|
50
|
-
|
|
72
|
+
// `id_image` es el nombre de la columna en base de datos; `image_id` el que
|
|
73
|
+
// usa el front. Se acepta cualquiera de los dos para que la URL se arme
|
|
74
|
+
// igual, venga la imagen del backend o del estado local.
|
|
75
|
+
const image = {
|
|
76
|
+
...imageGeneral,
|
|
77
|
+
image_id: imageGeneral.image_id ?? imageGeneral.id_image,
|
|
78
|
+
};
|
|
51
79
|
const ext = image.src.split(".");
|
|
52
80
|
const uuid = ext[0].split("-");
|
|
53
81
|
return {
|