contentoh-components-library 21.6.19 → 21.6.21
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.
- package/.env.test +2 -1
- package/dist/components/atoms/InheritanceTag/index.js +8 -0
- package/dist/components/molecules/TagAndInput/index.js +1 -0
- package/dist/components/molecules/TagAndInputv2/index.js +1 -0
- package/dist/components/organisms/LinkVariantsModal/api.js +102 -0
- package/dist/components/organisms/LinkVariantsModal/index.js +620 -0
- package/dist/components/organisms/LinkVariantsModal/styles.js +60 -0
- package/dist/components/pages/ProviderProductEdition/context/reducers/inputs.js +8 -2
- package/dist/components/pages/ProviderProductEdition/index.js +198 -89
- package/dist/components/pages/ProviderProductEdition/styles.js +2 -2
- package/dist/components/pages/ProviderProductEdition/utils.js +8 -0
- package/dist/index.js +25 -12
- package/package.json +1 -1
- package/src/components/atoms/InheritanceTag/index.js +7 -0
- package/src/components/molecules/TagAndInput/index.js +1 -0
- package/src/components/molecules/TagAndInputv2/index.js +1 -0
- package/src/components/organisms/LinkVariantsModal/api.js +61 -0
- package/src/components/organisms/LinkVariantsModal/index.js +479 -0
- package/src/components/organisms/LinkVariantsModal/styles.js +264 -0
- package/src/components/pages/ProviderProductEdition/context/reducers/inputs.js +21 -13
- package/src/components/pages/ProviderProductEdition/index.js +76 -0
- package/src/components/pages/ProviderProductEdition/styles.js +23 -0
- package/src/components/pages/ProviderProductEdition/utils.js +8 -0
- package/src/index.js +1 -0
- package/dist/ai/prompts/attribute.prompt.js +0 -28
- package/dist/ai/prompts/description.prompt.js +0 -33
- package/dist/ai/schemas/attribute.schema.js +0 -35
- package/dist/ai/schemas/description.schema.js +0 -27
|
@@ -65,6 +65,10 @@ var _ImagePreviewer = require("../../organisms/ImagePreviewer");
|
|
|
65
65
|
|
|
66
66
|
var _InputGroup = require("../../organisms/InputGroup");
|
|
67
67
|
|
|
68
|
+
var _LinkVariantsModal = require("../../organisms/LinkVariantsModal");
|
|
69
|
+
|
|
70
|
+
var _api = require("../../organisms/LinkVariantsModal/api");
|
|
71
|
+
|
|
68
72
|
var _ProductImageModal = require("../../organisms/ProductImageModal");
|
|
69
73
|
|
|
70
74
|
var _VersionSelector = require("../../organisms/VersionSelector");
|
|
@@ -84,7 +88,7 @@ var _AiProductEdition = require("../../../contexts/AiProductEdition");
|
|
|
84
88
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
85
89
|
|
|
86
90
|
var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
87
|
-
var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _location$state5, _location$state6, _state$
|
|
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;
|
|
88
92
|
|
|
89
93
|
var tabsSections = _ref.tabsSections,
|
|
90
94
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -126,37 +130,42 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
126
130
|
|
|
127
131
|
var _useState5 = (0, _react.useState)(false),
|
|
128
132
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
showLinkVariants = _useState6[0],
|
|
134
|
+
setShowLinkVariants = _useState6[1];
|
|
131
135
|
|
|
132
|
-
var _useState7 = (0, _react.useState)(
|
|
136
|
+
var _useState7 = (0, _react.useState)(false),
|
|
133
137
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
showRejectModal = _useState8[0],
|
|
139
|
+
setShowRejectModal = _useState8[1];
|
|
136
140
|
|
|
137
|
-
var _useState9 = (0, _react.useState)(
|
|
141
|
+
var _useState9 = (0, _react.useState)(0),
|
|
138
142
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
headerTop = _useState10[0],
|
|
144
|
+
setHeaderTop = _useState10[1];
|
|
141
145
|
|
|
142
|
-
var _useState11 = (0, _react.useState)(
|
|
146
|
+
var _useState11 = (0, _react.useState)({}),
|
|
143
147
|
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
144
|
-
|
|
145
|
-
|
|
148
|
+
assig = _useState12[0],
|
|
149
|
+
setAssig = _useState12[1];
|
|
146
150
|
|
|
147
151
|
var _useState13 = (0, _react.useState)(false),
|
|
148
152
|
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
149
|
-
|
|
150
|
-
|
|
153
|
+
imageLayout = _useState14[0],
|
|
154
|
+
setImageLayout = _useState14[1];
|
|
151
155
|
|
|
152
|
-
var _useState15 = (0, _react.useState)(
|
|
156
|
+
var _useState15 = (0, _react.useState)(false),
|
|
157
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
158
|
+
rejectAll = _useState16[0],
|
|
159
|
+
setRejectAll = _useState16[1];
|
|
160
|
+
|
|
161
|
+
var _useState17 = (0, _react.useState)({
|
|
153
162
|
"Ficha técnica": null,
|
|
154
163
|
Descripción: null,
|
|
155
164
|
Imágenes: null
|
|
156
165
|
}),
|
|
157
|
-
|
|
158
|
-
origin =
|
|
159
|
-
setOrigin =
|
|
166
|
+
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
167
|
+
origin = _useState18[0],
|
|
168
|
+
setOrigin = _useState18[1];
|
|
160
169
|
|
|
161
170
|
var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
|
|
162
171
|
_useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
|
|
@@ -812,6 +821,80 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
812
821
|
payload: items
|
|
813
822
|
});
|
|
814
823
|
};
|
|
824
|
+
/*
|
|
825
|
+
Acción "Volver a heredar del producto" de los chips de herencia.
|
|
826
|
+
La inicia la variante, no el padre, y descarta un valor capturado a mano: por
|
|
827
|
+
eso el endpoint exige la lista explícita de atributos y no acepta un "todos"
|
|
828
|
+
implícito.
|
|
829
|
+
El repintado es en sitio, con lo que devuelve el propio endpoint. La
|
|
830
|
+
alternativa —recargar la ficha— se llevaría por delante lo que el usuario
|
|
831
|
+
tenga sin guardar en las otras pestañas.
|
|
832
|
+
*/
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
var handleOnRestoreInheritance = /*#__PURE__*/function () {
|
|
836
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(attributeId) {
|
|
837
|
+
var _state$product10;
|
|
838
|
+
|
|
839
|
+
var res, data;
|
|
840
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
841
|
+
while (1) {
|
|
842
|
+
switch (_context3.prev = _context3.next) {
|
|
843
|
+
case 0:
|
|
844
|
+
if (!(!attributeId || !((_state$product10 = state.product) !== null && _state$product10 !== void 0 && _state$product10.id_article))) {
|
|
845
|
+
_context3.next = 2;
|
|
846
|
+
break;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
return _context3.abrupt("return");
|
|
850
|
+
|
|
851
|
+
case 2:
|
|
852
|
+
_context3.prev = 2;
|
|
853
|
+
_context3.next = 5;
|
|
854
|
+
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), {
|
|
855
|
+
articleId: state.product.id_article,
|
|
856
|
+
attributes: [Number(attributeId)]
|
|
857
|
+
}, {
|
|
858
|
+
headers: {
|
|
859
|
+
Authorization: token
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
case 5:
|
|
864
|
+
res = _context3.sent;
|
|
865
|
+
// El API responde 200 aunque la lambda haya devuelto 400: el resultado
|
|
866
|
+
// real viaja en el cuerpo y readPayload lo convierte en excepción.
|
|
867
|
+
data = (0, _api.readPayload)(res);
|
|
868
|
+
dispatch({
|
|
869
|
+
type: "UPDATE_DATASHEETS_INPUTS",
|
|
870
|
+
payload: (data.values || []).map(function (item) {
|
|
871
|
+
return {
|
|
872
|
+
attributeId: item.id,
|
|
873
|
+
value: item.value,
|
|
874
|
+
isOverridden: 0
|
|
875
|
+
};
|
|
876
|
+
})
|
|
877
|
+
});
|
|
878
|
+
_context3.next = 13;
|
|
879
|
+
break;
|
|
880
|
+
|
|
881
|
+
case 10:
|
|
882
|
+
_context3.prev = 10;
|
|
883
|
+
_context3.t0 = _context3["catch"](2);
|
|
884
|
+
console.error("restoreInheritance: ", _context3.t0);
|
|
885
|
+
|
|
886
|
+
case 13:
|
|
887
|
+
case "end":
|
|
888
|
+
return _context3.stop();
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
}, _callee3, null, [[2, 10]]);
|
|
892
|
+
}));
|
|
893
|
+
|
|
894
|
+
return function handleOnRestoreInheritance(_x2) {
|
|
895
|
+
return _ref7.apply(this, arguments);
|
|
896
|
+
};
|
|
897
|
+
}();
|
|
815
898
|
|
|
816
899
|
var handleOnSetSelectedImages = function handleOnSetSelectedImages() {
|
|
817
900
|
/*
|
|
@@ -844,14 +927,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
844
927
|
};
|
|
845
928
|
|
|
846
929
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
847
|
-
var
|
|
848
|
-
var _state$product$id_ord, _state$active_retaile2, _state$product$status, _state$product$status2, _state$
|
|
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;
|
|
849
932
|
|
|
850
933
|
var concept, articleId, orderId, retailerId, evalStatus, data, _newStatuses$newStatu, _state$services_data, res, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, updatedServicesData;
|
|
851
934
|
|
|
852
|
-
return _regenerator.default.wrap(function
|
|
935
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
853
936
|
while (1) {
|
|
854
|
-
switch (
|
|
937
|
+
switch (_context4.prev = _context4.next) {
|
|
855
938
|
case 0:
|
|
856
939
|
dispatch({
|
|
857
940
|
type: "SET_SAVING",
|
|
@@ -861,23 +944,23 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
861
944
|
articleId = state.product.id_article;
|
|
862
945
|
orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
|
|
863
946
|
retailerId = (_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id_retailer;
|
|
864
|
-
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$
|
|
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);
|
|
865
948
|
data = {
|
|
866
949
|
articleId: articleId,
|
|
867
950
|
orderId: orderId,
|
|
868
951
|
concept: concept,
|
|
869
952
|
evalStatus: evalStatus
|
|
870
953
|
};
|
|
871
|
-
|
|
954
|
+
_context4.prev = 7;
|
|
872
955
|
|
|
873
956
|
if (!result) {
|
|
874
|
-
|
|
957
|
+
_context4.next = 22;
|
|
875
958
|
break;
|
|
876
959
|
}
|
|
877
960
|
|
|
878
961
|
data.result = result;
|
|
879
962
|
data.retailerId = retailerId;
|
|
880
|
-
|
|
963
|
+
_context4.next = 13;
|
|
881
964
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
882
965
|
headers: {
|
|
883
966
|
Authorization: token
|
|
@@ -885,7 +968,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
885
968
|
});
|
|
886
969
|
|
|
887
970
|
case 13:
|
|
888
|
-
res =
|
|
971
|
+
res = _context4.sent;
|
|
889
972
|
newStatuses = JSON.parse(res.data.body);
|
|
890
973
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")]; // Actualizar el producto con los nuevos estados
|
|
891
974
|
|
|
@@ -922,13 +1005,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
922
1005
|
});
|
|
923
1006
|
|
|
924
1007
|
case 22:
|
|
925
|
-
|
|
1008
|
+
_context4.next = 28;
|
|
926
1009
|
break;
|
|
927
1010
|
|
|
928
1011
|
case 24:
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
console.error("Error sending evaluation:",
|
|
1012
|
+
_context4.prev = 24;
|
|
1013
|
+
_context4.t0 = _context4["catch"](7);
|
|
1014
|
+
console.error("Error sending evaluation:", _context4.t0);
|
|
932
1015
|
dispatch({
|
|
933
1016
|
type: "SET_MODAL",
|
|
934
1017
|
payload: {
|
|
@@ -940,32 +1023,32 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
940
1023
|
});
|
|
941
1024
|
|
|
942
1025
|
case 28:
|
|
943
|
-
|
|
1026
|
+
_context4.prev = 28;
|
|
944
1027
|
dispatch({
|
|
945
1028
|
type: "SET_SAVING",
|
|
946
1029
|
payload: false
|
|
947
1030
|
});
|
|
948
|
-
return
|
|
1031
|
+
return _context4.finish(28);
|
|
949
1032
|
|
|
950
1033
|
case 31:
|
|
951
1034
|
case "end":
|
|
952
|
-
return
|
|
1035
|
+
return _context4.stop();
|
|
953
1036
|
}
|
|
954
1037
|
}
|
|
955
|
-
},
|
|
1038
|
+
}, _callee4, null, [[7, 24, 28, 31]]);
|
|
956
1039
|
}));
|
|
957
1040
|
|
|
958
|
-
return function sendEvaluation(
|
|
959
|
-
return
|
|
1041
|
+
return function sendEvaluation(_x3) {
|
|
1042
|
+
return _ref8.apply(this, arguments);
|
|
960
1043
|
};
|
|
961
1044
|
}();
|
|
962
1045
|
|
|
963
1046
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
964
|
-
var
|
|
1047
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(result) {
|
|
965
1048
|
var data, statusComplete, updatedProduct;
|
|
966
|
-
return _regenerator.default.wrap(function
|
|
1049
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
967
1050
|
while (1) {
|
|
968
|
-
switch (
|
|
1051
|
+
switch (_context5.prev = _context5.next) {
|
|
969
1052
|
case 0:
|
|
970
1053
|
dispatch({
|
|
971
1054
|
type: "SET_SAVING",
|
|
@@ -977,8 +1060,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
977
1060
|
versionId: state.product.version,
|
|
978
1061
|
status: result
|
|
979
1062
|
};
|
|
980
|
-
|
|
981
|
-
|
|
1063
|
+
_context5.prev = 2;
|
|
1064
|
+
_context5.next = 5;
|
|
982
1065
|
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
983
1066
|
headers: {
|
|
984
1067
|
Authorization: token
|
|
@@ -1008,13 +1091,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1008
1091
|
image: _genericModalCheck.default
|
|
1009
1092
|
}
|
|
1010
1093
|
});
|
|
1011
|
-
|
|
1094
|
+
_context5.next = 15;
|
|
1012
1095
|
break;
|
|
1013
1096
|
|
|
1014
1097
|
case 11:
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
console.error("Error evaluating to retailer:",
|
|
1098
|
+
_context5.prev = 11;
|
|
1099
|
+
_context5.t0 = _context5["catch"](2);
|
|
1100
|
+
console.error("Error evaluating to retailer:", _context5.t0);
|
|
1018
1101
|
dispatch({
|
|
1019
1102
|
type: "SET_MODAL",
|
|
1020
1103
|
payload: {
|
|
@@ -1026,23 +1109,23 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1026
1109
|
});
|
|
1027
1110
|
|
|
1028
1111
|
case 15:
|
|
1029
|
-
|
|
1112
|
+
_context5.prev = 15;
|
|
1030
1113
|
dispatch({
|
|
1031
1114
|
type: "SET_SAVING",
|
|
1032
1115
|
payload: false
|
|
1033
1116
|
});
|
|
1034
|
-
return
|
|
1117
|
+
return _context5.finish(15);
|
|
1035
1118
|
|
|
1036
1119
|
case 18:
|
|
1037
1120
|
case "end":
|
|
1038
|
-
return
|
|
1121
|
+
return _context5.stop();
|
|
1039
1122
|
}
|
|
1040
1123
|
}
|
|
1041
|
-
},
|
|
1124
|
+
}, _callee5, null, [[2, 11, 15, 18]]);
|
|
1042
1125
|
}));
|
|
1043
1126
|
|
|
1044
|
-
return function evaluationToRetailer(
|
|
1045
|
-
return
|
|
1127
|
+
return function evaluationToRetailer(_x4) {
|
|
1128
|
+
return _ref9.apply(this, arguments);
|
|
1046
1129
|
};
|
|
1047
1130
|
}();
|
|
1048
1131
|
|
|
@@ -1173,18 +1256,18 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1173
1256
|
};
|
|
1174
1257
|
|
|
1175
1258
|
var handleOnEvaluateAll = /*#__PURE__*/function () {
|
|
1176
|
-
var
|
|
1259
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(result) {
|
|
1177
1260
|
var _state$product$id_ord2, _state$services_data2, evaluationArray, conceptArray, dataGeneral, isProvider, userType, status, updatedStatusByRetailer, updatedProduct;
|
|
1178
1261
|
|
|
1179
|
-
return _regenerator.default.wrap(function
|
|
1262
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1180
1263
|
while (1) {
|
|
1181
|
-
switch (
|
|
1264
|
+
switch (_context6.prev = _context6.next) {
|
|
1182
1265
|
case 0:
|
|
1183
1266
|
dispatch({
|
|
1184
1267
|
type: "SET_SAVING",
|
|
1185
1268
|
payload: true
|
|
1186
1269
|
});
|
|
1187
|
-
|
|
1270
|
+
_context6.prev = 1;
|
|
1188
1271
|
evaluationArray = [];
|
|
1189
1272
|
conceptArray = ["description", "datasheet", "images"];
|
|
1190
1273
|
dataGeneral = {
|
|
@@ -1215,7 +1298,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1215
1298
|
}));
|
|
1216
1299
|
}); // Ejecutar todas las evaluaciones
|
|
1217
1300
|
|
|
1218
|
-
|
|
1301
|
+
_context6.next = 9;
|
|
1219
1302
|
return Promise.all(evaluationArray);
|
|
1220
1303
|
|
|
1221
1304
|
case 9:
|
|
@@ -1260,13 +1343,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1260
1343
|
image: _genericModalCheck.default
|
|
1261
1344
|
}
|
|
1262
1345
|
});
|
|
1263
|
-
|
|
1346
|
+
_context6.next = 24;
|
|
1264
1347
|
break;
|
|
1265
1348
|
|
|
1266
1349
|
case 20:
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
console.error("Error evaluating all:",
|
|
1350
|
+
_context6.prev = 20;
|
|
1351
|
+
_context6.t0 = _context6["catch"](1);
|
|
1352
|
+
console.error("Error evaluating all:", _context6.t0);
|
|
1270
1353
|
dispatch({
|
|
1271
1354
|
type: "SET_MODAL",
|
|
1272
1355
|
payload: {
|
|
@@ -1278,24 +1361,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1278
1361
|
});
|
|
1279
1362
|
|
|
1280
1363
|
case 24:
|
|
1281
|
-
|
|
1364
|
+
_context6.prev = 24;
|
|
1282
1365
|
dispatch({
|
|
1283
1366
|
type: "SET_SAVING",
|
|
1284
1367
|
payload: false
|
|
1285
1368
|
});
|
|
1286
1369
|
setRejectAll(false);
|
|
1287
|
-
return
|
|
1370
|
+
return _context6.finish(24);
|
|
1288
1371
|
|
|
1289
1372
|
case 28:
|
|
1290
1373
|
case "end":
|
|
1291
|
-
return
|
|
1374
|
+
return _context6.stop();
|
|
1292
1375
|
}
|
|
1293
1376
|
}
|
|
1294
|
-
},
|
|
1377
|
+
}, _callee6, null, [[1, 20, 24, 28]]);
|
|
1295
1378
|
}));
|
|
1296
1379
|
|
|
1297
|
-
return function handleOnEvaluateAll(
|
|
1298
|
-
return
|
|
1380
|
+
return function handleOnEvaluateAll(_x5) {
|
|
1381
|
+
return _ref10.apply(this, arguments);
|
|
1299
1382
|
};
|
|
1300
1383
|
}();
|
|
1301
1384
|
|
|
@@ -1343,6 +1426,18 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1343
1426
|
currentVersion: state.product.version,
|
|
1344
1427
|
setShowVersionSelector: setShowVersionSelector,
|
|
1345
1428
|
jwt: token
|
|
1429
|
+
}), 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,
|
|
1433
|
+
activeRetailerId: (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer,
|
|
1434
|
+
token: token,
|
|
1435
|
+
onClose: function onClose() {
|
|
1436
|
+
return setShowLinkVariants(false);
|
|
1437
|
+
},
|
|
1438
|
+
onLinked: function onLinked() {
|
|
1439
|
+
return window.location.reload();
|
|
1440
|
+
}
|
|
1346
1441
|
}), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
|
|
1347
1442
|
images: state.images_values,
|
|
1348
1443
|
setShowModal: setShowModal,
|
|
@@ -1403,21 +1498,21 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1403
1498
|
type: "pink",
|
|
1404
1499
|
label: "Aceptar",
|
|
1405
1500
|
size: 12,
|
|
1406
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1501
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
1407
1502
|
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
1408
|
-
return _regenerator.default.wrap(function
|
|
1503
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1409
1504
|
while (1) {
|
|
1410
|
-
switch (
|
|
1505
|
+
switch (_context7.prev = _context7.next) {
|
|
1411
1506
|
case 0:
|
|
1412
1507
|
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
1413
1508
|
|
|
1414
1509
|
if (!(!elements || elements.length === 0)) {
|
|
1415
|
-
|
|
1510
|
+
_context7.next = 4;
|
|
1416
1511
|
break;
|
|
1417
1512
|
}
|
|
1418
1513
|
|
|
1419
1514
|
console.error("Elemento no encontrado");
|
|
1420
|
-
return
|
|
1515
|
+
return _context7.abrupt("return");
|
|
1421
1516
|
|
|
1422
1517
|
case 4:
|
|
1423
1518
|
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
@@ -1426,7 +1521,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1426
1521
|
});
|
|
1427
1522
|
|
|
1428
1523
|
if (!isMessageEmpty) {
|
|
1429
|
-
|
|
1524
|
+
_context7.next = 10;
|
|
1430
1525
|
break;
|
|
1431
1526
|
}
|
|
1432
1527
|
|
|
@@ -1441,13 +1536,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1441
1536
|
container.appendChild(alert);
|
|
1442
1537
|
}
|
|
1443
1538
|
|
|
1444
|
-
return
|
|
1539
|
+
return _context7.abrupt("return");
|
|
1445
1540
|
|
|
1446
1541
|
case 10:
|
|
1447
1542
|
fullMessage = Array.from(elements).map(function (element) {
|
|
1448
1543
|
return element.innerHTML;
|
|
1449
1544
|
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
1450
|
-
|
|
1545
|
+
_context7.next = 13;
|
|
1451
1546
|
return createComment(fullMessage, token);
|
|
1452
1547
|
|
|
1453
1548
|
case 13:
|
|
@@ -1456,10 +1551,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1456
1551
|
|
|
1457
1552
|
case 15:
|
|
1458
1553
|
case "end":
|
|
1459
|
-
return
|
|
1554
|
+
return _context7.stop();
|
|
1460
1555
|
}
|
|
1461
1556
|
}
|
|
1462
|
-
},
|
|
1557
|
+
}, _callee7);
|
|
1463
1558
|
}))
|
|
1464
1559
|
}, "btn-Aceptar")]
|
|
1465
1560
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -1469,8 +1564,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1469
1564
|
productSelected: state.product,
|
|
1470
1565
|
token: token,
|
|
1471
1566
|
activeRetailer: {
|
|
1472
|
-
id: (_state$
|
|
1473
|
-
name: (_state$
|
|
1567
|
+
id: (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.id_retailer,
|
|
1568
|
+
name: (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.retailer
|
|
1474
1569
|
}
|
|
1475
1570
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1476
1571
|
className: "data-container",
|
|
@@ -1485,8 +1580,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1485
1580
|
lists: state.images_values || [],
|
|
1486
1581
|
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] : {},
|
|
1487
1582
|
assignationsImages: assig,
|
|
1488
|
-
retailerSelected: (_state$
|
|
1489
|
-
imagesStatus: ((_state$
|
|
1583
|
+
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) || "-",
|
|
1490
1585
|
isRetailer: isRetailer,
|
|
1491
1586
|
setShowVersionSelector: setShowVersionSelector,
|
|
1492
1587
|
version: state.product.version,
|
|
@@ -1499,13 +1594,26 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1499
1594
|
className: "product-information",
|
|
1500
1595
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1501
1596
|
className: "product-information",
|
|
1502
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
1597
|
+
children: [!((_state$product16 = state.product) !== null && _state$product16 !== void 0 && _state$product16.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1598
|
+
className: "variants-actions",
|
|
1599
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
1600
|
+
type: "button",
|
|
1601
|
+
className: "link-variants",
|
|
1602
|
+
onClick: function onClick() {
|
|
1603
|
+
return setShowLinkVariants(true);
|
|
1604
|
+
},
|
|
1605
|
+
children: "Ligar productos"
|
|
1606
|
+
}), ((_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1607
|
+
className: "variants-count",
|
|
1608
|
+
children: [state.product.variantsCount, " variante", state.product.variantsCount === 1 ? "" : "s"]
|
|
1609
|
+
})]
|
|
1610
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
|
|
1503
1611
|
headerData: state.product,
|
|
1504
1612
|
percent: (_state$active_percent = state.active_percentage) === null || _state$active_percent === void 0 ? void 0 : (_state$active_percent2 = _state$active_percent.percentagesGeneral) === null || _state$active_percent2 === void 0 ? void 0 : _state$active_percent2.required,
|
|
1505
1613
|
activeRetailer: {
|
|
1506
|
-
id: (_state$
|
|
1507
|
-
name: (_state$
|
|
1508
|
-
image: (_state$
|
|
1614
|
+
id: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.id_retailer,
|
|
1615
|
+
name: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.retailer,
|
|
1616
|
+
image: (_state$active_retaile9 = state.active_retailer) === null || _state$active_retaile9 === void 0 ? void 0 : _state$active_retaile9.image
|
|
1509
1617
|
},
|
|
1510
1618
|
showValidationButtons: canShowValidationButtons(),
|
|
1511
1619
|
showApproveRejectAll: canShowValidationButtons(),
|
|
@@ -1549,11 +1657,11 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1549
1657
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1550
1658
|
className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
|
|
1551
1659
|
children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1552
|
-
children: [state.active_tab === "Descripción" && (((_state$
|
|
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, {
|
|
1553
1661
|
activeSection: state.active_tab,
|
|
1554
1662
|
inputGroup: state.descriptions_inputs[0],
|
|
1555
1663
|
updatedDescriptions: state.updated_descriptions_inputs,
|
|
1556
|
-
articleId: (_state$
|
|
1664
|
+
articleId: (_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.id_article,
|
|
1557
1665
|
version: state.product.version,
|
|
1558
1666
|
isShowbox: false,
|
|
1559
1667
|
dinamicHeight: true,
|
|
@@ -1565,7 +1673,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1565
1673
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1566
1674
|
text: "No cuentas con este servicio",
|
|
1567
1675
|
headerType: "input-name-header"
|
|
1568
|
-
})), state.active_tab === "Ficha técnica" && (((_state$
|
|
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, {
|
|
1569
1677
|
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) {
|
|
1570
1678
|
var _state$datasheets_inp4, _state$services, _state$services$datas, _state$services$datas2;
|
|
1571
1679
|
|
|
@@ -1577,6 +1685,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1577
1685
|
inputGroup: dataGroup,
|
|
1578
1686
|
dataInputs: (_state$datasheets_inp4 = state.datasheets_inputs[1]) !== null && _state$datasheets_inp4 !== void 0 ? _state$datasheets_inp4 : [],
|
|
1579
1687
|
variant: (_state$services = state.services) === null || _state$services === void 0 ? void 0 : (_state$services$datas = _state$services.datasheets) === null || _state$services$datas === void 0 ? void 0 : _state$services$datas.variant,
|
|
1688
|
+
onRestoreInheritance: handleOnRestoreInheritance,
|
|
1580
1689
|
activeRetailer: state.services.datasheets[state.active_retailer.id_retailer],
|
|
1581
1690
|
groupData: (_state$services$datas2 = state.services.datasheets[state.active_retailer.id_retailer]) === null || _state$services$datas2 === void 0 ? void 0 : _state$services$datas2.data,
|
|
1582
1691
|
updatedDatasheets: state.updated_datasheets_inputs,
|
|
@@ -1594,7 +1703,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1594
1703
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1595
1704
|
text: "No cuentas con este servicio",
|
|
1596
1705
|
headerType: "input-name-header"
|
|
1597
|
-
})), state.active_tab === "Imágenes" && (((_state$
|
|
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, {
|
|
1598
1707
|
children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
1599
1708
|
checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
|
|
1600
1709
|
,
|
|
@@ -15,9 +15,9 @@ var _variables = require("../../../global-files/variables");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject;
|
|
17
17
|
|
|
18
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button,\n .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n\n .required-inputs-message {\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n padding: 10px;\n display: flex;\n align-items: center;\n\n p + * {\n margin-top: 10px;\n }\n\n button {\n min-width: fit-content;\n }\n }\n }\n }\n #modal-message-box {\n width: 400px;\n height: 100px;\n }\n .container {\n width: 100%;\n height: 90%;\n .dropzone {\n height: 100%;\n width: 100%;\n position: relative;\n transition: all 0.5s ease;\n\n &.drag-active {\n background-color: rgba(", ", 0.05);\n border: 2px dashed ", ";\n border-radius: 8px;\n\n aside {\n opacity: 0.3;\n pointer-events: none;\n }\n }\n\n .drag-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(", ", 0.1);\n border-radius: 8px;\n pointer-events: none;\n z-index: 10;\n\n p {\n font-family: ", ";\n font-size: 24px;\n font-weight: 600;\n color: ", ";\n text-align: center;\n padding: 20px;\n background-color: ", ";\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n }\n }\n }\n }\n"])), function (_ref) {
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button,\n .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n\n .required-inputs-message {\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n padding: 10px;\n display: flex;\n align-items: center;\n\n p + * {\n margin-top: 10px;\n }\n\n button {\n min-width: fit-content;\n }\n }\n }\n }\n #modal-message-box {\n width: 400px;\n height: 100px;\n }\n .container {\n width: 100%;\n height: 90%;\n .dropzone {\n height: 100%;\n width: 100%;\n position: relative;\n transition: all 0.5s ease;\n\n &.drag-active {\n background-color: rgba(", ", 0.05);\n border: 2px dashed ", ";\n border-radius: 8px;\n\n aside {\n opacity: 0.3;\n pointer-events: none;\n }\n }\n\n .drag-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(", ", 0.1);\n border-radius: 8px;\n pointer-events: none;\n z-index: 10;\n\n p {\n font-family: ", ";\n font-size: 24px;\n font-weight: 600;\n color: ", ";\n text-align: center;\n padding: 20px;\n background-color: ", ";\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n }\n }\n }\n }\n .variants-actions {\n display: flex;\n align-items: center;\n gap: 10px;\n margin-bottom: 8px;\n\n .link-variants {\n border: 1px solid ", ";\n border-radius: 6px;\n background: none;\n padding: 6px 12px;\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n cursor: pointer;\n }\n\n .variants-count {\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n }\n }\n"])), function (_ref) {
|
|
19
19
|
var headerTop = _ref.headerTop;
|
|
20
20
|
return headerTop;
|
|
21
|
-
}, _variables.FontFamily.AvenirNext, _variables.GlobalColors.color_gray, _variables.GlobalColors.rgb_color_pink, _variables.GlobalColors.color_pink, _variables.GlobalColors.rgb_color_pink, _variables.FontFamily.AvenirNext, _variables.GlobalColors.color_pink, _variables.GlobalColors.white);
|
|
21
|
+
}, _variables.FontFamily.AvenirNext, _variables.GlobalColors.color_gray, _variables.GlobalColors.rgb_color_pink, _variables.GlobalColors.color_pink, _variables.GlobalColors.rgb_color_pink, _variables.FontFamily.AvenirNext, _variables.GlobalColors.color_pink, _variables.GlobalColors.white, _variables.GlobalColors.original_magenta, _variables.FontFamily.Raleway_600, _variables.GlobalColors.original_magenta, _variables.FontFamily.Raleway_500, _variables.GlobalColors.gray);
|
|
22
22
|
|
|
23
23
|
exports.Container = Container;
|
|
@@ -8,6 +8,8 @@ exports.normalizeProduct = exports.getConceptByTab = void 0;
|
|
|
8
8
|
var _statusDictionary = require("../../../global-files/statusDictionary");
|
|
9
9
|
|
|
10
10
|
var normalizeProduct = function normalizeProduct(product) {
|
|
11
|
+
var _ref, _productData$parentAr, _ref2, _productData$parent, _ref3, _productData$variants;
|
|
12
|
+
|
|
11
13
|
// Handle case where product might be wrapped in a product property
|
|
12
14
|
var productData = product.product || product;
|
|
13
15
|
var article = productData.article || {};
|
|
@@ -43,6 +45,12 @@ var normalizeProduct = function normalizeProduct(product) {
|
|
|
43
45
|
percentages: productData.percentages || null,
|
|
44
46
|
summary: productData.summary || null,
|
|
45
47
|
version: productData.version || 0,
|
|
48
|
+
// Parentesco. read-articles-v2 ya lo devuelve; sin arrastrarlo hasta aquí la
|
|
49
|
+
// pantalla de edición no puede saber si el producto pertenece a una familia.
|
|
50
|
+
// Ojo con `?? null` en vez de `|| null`: variantsCount 0 es un dato válido.
|
|
51
|
+
parentArticleId: (_ref = (_productData$parentAr = productData.parentArticleId) !== null && _productData$parentAr !== void 0 ? _productData$parentAr : article.parentArticleId) !== null && _ref !== void 0 ? _ref : null,
|
|
52
|
+
parent: (_ref2 = (_productData$parent = productData.parent) !== null && _productData$parent !== void 0 ? _productData$parent : article.parent) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
53
|
+
variantsCount: (_ref3 = (_productData$variants = productData.variantsCount) !== null && _productData$variants !== void 0 ? _productData$variants : article.variantsCount) !== null && _ref3 !== void 0 ? _ref3 : 0,
|
|
46
54
|
// from tasks
|
|
47
55
|
id_order: productData.orderId || null,
|
|
48
56
|
status: productData.statusByRetailer ? (0, _statusDictionary.getMinorStatusFromRetailerMap)(productData.statusByRetailer) : productData.status || null,
|