contentoh-components-library 21.6.12 → 21.6.14
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/dist/components/atoms/GeneralInput/index.js +1 -14
- package/dist/components/organisms/FullProductNameHeader/index.js +10 -9
- package/dist/components/pages/ProviderProductEdition/index.js +57 -39
- package/dist/components/pages/ProviderProductEdition/utils.js +2 -2
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +41 -32
- package/dist/components/pages/RetailerProductEdition/index.js +227 -24
- package/dist/global-files/data.js +5 -4
- package/package.json +1 -1
- package/src/components/atoms/GeneralInput/index.js +1 -11
- package/src/components/organisms/FullProductNameHeader/index.js +20 -13
- package/src/components/pages/ProviderProductEdition/index.js +93 -66
- package/src/components/pages/ProviderProductEdition/utils.js +7 -3
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +22 -7
- package/src/components/pages/RetailerProductEdition/index.js +170 -39
- package/src/global-files/data.js +2 -1
|
@@ -17,10 +17,10 @@ var _objectSpread5 = _interopRequireDefault(require("@babel/runtime/helpers/esm/
|
|
|
17
17
|
|
|
18
18
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
19
19
|
|
|
20
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
21
|
-
|
|
22
20
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
23
21
|
|
|
22
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
23
|
+
|
|
24
24
|
var _react = require("react");
|
|
25
25
|
|
|
26
26
|
var _axios = _interopRequireDefault(require("axios"));
|
|
@@ -89,6 +89,8 @@ var _styles = require("./styles");
|
|
|
89
89
|
|
|
90
90
|
var _Commentary = require("../../atoms/Commentary");
|
|
91
91
|
|
|
92
|
+
var _generateThumnail = _interopRequireDefault(require("./generateThumnail"));
|
|
93
|
+
|
|
92
94
|
var _AiProductEdition = require("../../../contexts/AiProductEdition");
|
|
93
95
|
|
|
94
96
|
var _ChangeStatusModal = _interopRequireDefault(require("../../organisms/ChangeStatusModal"));
|
|
@@ -104,6 +106,127 @@ var allowedAccountsToViewChangeStatus = ["mperez@contentoh.com", "gmorales@conte
|
|
|
104
106
|
"ladiboh785@mi166.com" //QA
|
|
105
107
|
];
|
|
106
108
|
|
|
109
|
+
function obtenerDuracionVideoBase64(base64Data) {
|
|
110
|
+
return new Promise(function (resolve, reject) {
|
|
111
|
+
var video = document.createElement("video");
|
|
112
|
+
video.src = base64Data;
|
|
113
|
+
video.addEventListener("loadedmetadata", function () {
|
|
114
|
+
resolve(video.duration);
|
|
115
|
+
});
|
|
116
|
+
video.addEventListener("error", reject);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function convertirVideoABase64(url) {
|
|
121
|
+
return new Promise(function (resolve, reject) {
|
|
122
|
+
var xhr = new XMLHttpRequest();
|
|
123
|
+
xhr.open("GET", url, true);
|
|
124
|
+
xhr.responseType = "blob";
|
|
125
|
+
|
|
126
|
+
xhr.onload = function () {
|
|
127
|
+
if (xhr.status === 200) {
|
|
128
|
+
var blob = xhr.response;
|
|
129
|
+
var reader = new FileReader();
|
|
130
|
+
|
|
131
|
+
reader.onloadend = function () {
|
|
132
|
+
resolve(reader.result);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
reader.readAsDataURL(blob);
|
|
136
|
+
} else {
|
|
137
|
+
reject(new Error("Error al cargar el video"));
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
xhr.onerror = function () {
|
|
142
|
+
reject(new Error("Error de red al cargar el video"));
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
xhr.send();
|
|
146
|
+
});
|
|
147
|
+
} // Para videos ya guardados, `getImage` deja en `src` una URL del
|
|
148
|
+
// redimensionador de imágenes que no sirve para mp4. Descargamos el video
|
|
149
|
+
// desde S3 (srcDB) y generamos un thumbnail JPEG para mostrarlo en la galería.
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
function regenerateVideoThumbnails(_x) {
|
|
153
|
+
return _regenerateVideoThumbnails.apply(this, arguments);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function _regenerateVideoThumbnails() {
|
|
157
|
+
_regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(values) {
|
|
158
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
159
|
+
while (1) {
|
|
160
|
+
switch (_context15.prev = _context15.next) {
|
|
161
|
+
case 0:
|
|
162
|
+
if (Array.isArray(values)) {
|
|
163
|
+
_context15.next = 2;
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return _context15.abrupt("return", values);
|
|
168
|
+
|
|
169
|
+
case 2:
|
|
170
|
+
return _context15.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
|
|
171
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(value) {
|
|
172
|
+
var base64, videoSrc, thumbnail;
|
|
173
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
174
|
+
while (1) {
|
|
175
|
+
switch (_context14.prev = _context14.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
if (!((value === null || value === void 0 ? void 0 : value.ext) !== "mp4" || !(value !== null && value !== void 0 && value.srcDB))) {
|
|
178
|
+
_context14.next = 2;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return _context14.abrupt("return", value);
|
|
183
|
+
|
|
184
|
+
case 2:
|
|
185
|
+
_context14.prev = 2;
|
|
186
|
+
_context14.next = 5;
|
|
187
|
+
return convertirVideoABase64("https://" + process.env.REACT_APP_IMAGES_BUCKET + ".s3.amazonaws.com/" + value.srcDB);
|
|
188
|
+
|
|
189
|
+
case 5:
|
|
190
|
+
base64 = _context14.sent;
|
|
191
|
+
videoSrc = "data:video/mp4;base64," + base64.split(",")[1];
|
|
192
|
+
_context14.next = 9;
|
|
193
|
+
return (0, _generateThumnail.default)(videoSrc, 2);
|
|
194
|
+
|
|
195
|
+
case 9:
|
|
196
|
+
thumbnail = _context14.sent;
|
|
197
|
+
return _context14.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
|
|
198
|
+
src: thumbnail
|
|
199
|
+
}));
|
|
200
|
+
|
|
201
|
+
case 13:
|
|
202
|
+
_context14.prev = 13;
|
|
203
|
+
_context14.t0 = _context14["catch"](2);
|
|
204
|
+
console.error("Error al generar thumbnail del video:", _context14.t0);
|
|
205
|
+
return _context14.abrupt("return", value);
|
|
206
|
+
|
|
207
|
+
case 17:
|
|
208
|
+
case "end":
|
|
209
|
+
return _context14.stop();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}, _callee14, null, [[2, 13]]);
|
|
213
|
+
}));
|
|
214
|
+
|
|
215
|
+
return function (_x8) {
|
|
216
|
+
return _ref17.apply(this, arguments);
|
|
217
|
+
};
|
|
218
|
+
}())));
|
|
219
|
+
|
|
220
|
+
case 3:
|
|
221
|
+
case "end":
|
|
222
|
+
return _context15.stop();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}, _callee15);
|
|
226
|
+
}));
|
|
227
|
+
return _regenerateVideoThumbnails.apply(this, arguments);
|
|
228
|
+
}
|
|
229
|
+
|
|
107
230
|
var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
108
231
|
var _location$state, _location$state2, _state$active_retaile4, _state$active_retaile5, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product8, _state$active_retaile6, _state$active_retaile7, _state$active_retaile8, _state$active_retaile9, _state$product9, _state$product10, _state$product11, _state$datasheets_inp, _state$datasheets_inp2, _state$product12, _state$images_values12, _state$comment;
|
|
109
232
|
|
|
@@ -209,7 +332,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
209
332
|
setCompare = _useState30[1];
|
|
210
333
|
|
|
211
334
|
var _useDropzone = (0, _reactDropzone.useDropzone)({
|
|
212
|
-
accept: "image
|
|
335
|
+
accept: "image/*, video/mp4",
|
|
213
336
|
noKeyboard: true,
|
|
214
337
|
multiple: true,
|
|
215
338
|
noClick: true,
|
|
@@ -220,7 +343,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
220
343
|
|
|
221
344
|
reader.onload = /*#__PURE__*/function () {
|
|
222
345
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
|
|
223
|
-
var fileName, fileExtension, fileDataURL, img;
|
|
346
|
+
var fileName, fileExtension, fileDataURL, img, duracion;
|
|
224
347
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
225
348
|
while (1) {
|
|
226
349
|
switch (_context.prev = _context.next) {
|
|
@@ -229,6 +352,71 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
229
352
|
fileExtension = fileName.split(".").pop();
|
|
230
353
|
fileDataURL = e.target.result;
|
|
231
354
|
img = new Image();
|
|
355
|
+
|
|
356
|
+
if (!(fileExtension === "mp4")) {
|
|
357
|
+
_context.next = 22;
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
_context.prev = 5;
|
|
362
|
+
_context.next = 8;
|
|
363
|
+
return obtenerDuracionVideoBase64(fileDataURL);
|
|
364
|
+
|
|
365
|
+
case 8:
|
|
366
|
+
duracion = _context.sent;
|
|
367
|
+
|
|
368
|
+
if (!(duracion <= 10 || duracion >= 600)) {
|
|
369
|
+
_context.next = 12;
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
dispatch({
|
|
374
|
+
type: "SET_MODAL",
|
|
375
|
+
payload: {
|
|
376
|
+
show: true,
|
|
377
|
+
title: "Hubo un error al subir el video",
|
|
378
|
+
message: "Los videos deben durar entre 15 segundos y 10 minutos",
|
|
379
|
+
image: _errorModal.default
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
return _context.abrupt("return");
|
|
383
|
+
|
|
384
|
+
case 12:
|
|
385
|
+
_context.next = 14;
|
|
386
|
+
return (0, _generateThumnail.default)(fileDataURL, 2);
|
|
387
|
+
|
|
388
|
+
case 14:
|
|
389
|
+
img.src = _context.sent;
|
|
390
|
+
|
|
391
|
+
img.onload = function () {
|
|
392
|
+
var newImg = {
|
|
393
|
+
src: img.src,
|
|
394
|
+
name: fileName,
|
|
395
|
+
ext: fileExtension,
|
|
396
|
+
width: img.width,
|
|
397
|
+
height: img.height,
|
|
398
|
+
video_src: fileDataURL,
|
|
399
|
+
isApproved: true // VALIDAR QUE SOLO SEA PARA RADIOSHACK
|
|
400
|
+
|
|
401
|
+
};
|
|
402
|
+
dispatch({
|
|
403
|
+
type: "ADD_IMAGE_VALUE",
|
|
404
|
+
payload: newImg
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
_context.next = 21;
|
|
409
|
+
break;
|
|
410
|
+
|
|
411
|
+
case 18:
|
|
412
|
+
_context.prev = 18;
|
|
413
|
+
_context.t0 = _context["catch"](5);
|
|
414
|
+
console.error("Error al obtener la duración del video:", _context.t0);
|
|
415
|
+
|
|
416
|
+
case 21:
|
|
417
|
+
return _context.abrupt("return");
|
|
418
|
+
|
|
419
|
+
case 22:
|
|
232
420
|
img.src = fileDataURL;
|
|
233
421
|
|
|
234
422
|
img.onload = function () {
|
|
@@ -240,6 +428,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
240
428
|
ext: fileExtension,
|
|
241
429
|
width: width,
|
|
242
430
|
height: height,
|
|
431
|
+
video_src: "",
|
|
243
432
|
isApproved: true // VALIDAR QUE SOLO SEA PARA RADIOSHACK
|
|
244
433
|
|
|
245
434
|
};
|
|
@@ -249,15 +438,15 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
249
438
|
});
|
|
250
439
|
};
|
|
251
440
|
|
|
252
|
-
case
|
|
441
|
+
case 24:
|
|
253
442
|
case "end":
|
|
254
443
|
return _context.stop();
|
|
255
444
|
}
|
|
256
445
|
}
|
|
257
|
-
}, _callee);
|
|
446
|
+
}, _callee, null, [[5, 18]]);
|
|
258
447
|
}));
|
|
259
448
|
|
|
260
|
-
return function (
|
|
449
|
+
return function (_x2) {
|
|
261
450
|
return _ref2.apply(this, arguments);
|
|
262
451
|
};
|
|
263
452
|
}();
|
|
@@ -507,6 +696,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
507
696
|
datasheetsActiveRetailer,
|
|
508
697
|
descriptionsActiveRetailer,
|
|
509
698
|
filteredValues,
|
|
699
|
+
orderedValuesWithThumbs,
|
|
700
|
+
filteredValuesWithThumbs,
|
|
510
701
|
_args4 = arguments;
|
|
511
702
|
|
|
512
703
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
@@ -602,7 +793,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
602
793
|
dispatch({
|
|
603
794
|
type: "SET_COMMENTS",
|
|
604
795
|
payload: commentsMap
|
|
605
|
-
});
|
|
796
|
+
});
|
|
797
|
+
console.log("services", services); // Ordenamiento de imágenes
|
|
606
798
|
|
|
607
799
|
orderMap = services[2].inputsByRetailer.flat().reduce(function (acc, item) {
|
|
608
800
|
acc[item.id_image] = item.order;
|
|
@@ -629,15 +821,26 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
629
821
|
return input.id_retailer === id_retailer && input.id_image === value.image_id;
|
|
630
822
|
});
|
|
631
823
|
});
|
|
632
|
-
}); //
|
|
824
|
+
}); // Regenerar thumbnails de videos guardados para que se muestren.
|
|
825
|
+
|
|
826
|
+
_context4.next = 30;
|
|
827
|
+
return regenerateVideoThumbnails(orderedValues);
|
|
633
828
|
|
|
829
|
+
case 30:
|
|
830
|
+
orderedValuesWithThumbs = _context4.sent;
|
|
831
|
+
_context4.next = 33;
|
|
832
|
+
return regenerateVideoThumbnails(filteredValues);
|
|
833
|
+
|
|
834
|
+
case 33:
|
|
835
|
+
filteredValuesWithThumbs = _context4.sent;
|
|
836
|
+
// Dispatch consolidado
|
|
634
837
|
dispatch({
|
|
635
838
|
type: "SET_SERVICES",
|
|
636
839
|
payload: {
|
|
637
840
|
datasheets: services[0],
|
|
638
841
|
descriptions: services[1],
|
|
639
842
|
images: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
640
|
-
values:
|
|
843
|
+
values: orderedValuesWithThumbs
|
|
641
844
|
})
|
|
642
845
|
}
|
|
643
846
|
});
|
|
@@ -668,7 +871,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
668
871
|
dispatch({
|
|
669
872
|
type: "SET_IMAGES_VALUES",
|
|
670
873
|
payload: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
671
|
-
values:
|
|
874
|
+
values: filteredValuesWithThumbs
|
|
672
875
|
})
|
|
673
876
|
}); // Calcular campos requeridos sin valor
|
|
674
877
|
|
|
@@ -681,11 +884,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
681
884
|
loadAuditableData();
|
|
682
885
|
}
|
|
683
886
|
|
|
684
|
-
_context4.next =
|
|
887
|
+
_context4.next = 49;
|
|
685
888
|
break;
|
|
686
889
|
|
|
687
|
-
case
|
|
688
|
-
_context4.prev =
|
|
890
|
+
case 45:
|
|
891
|
+
_context4.prev = 45;
|
|
689
892
|
_context4.t0 = _context4["catch"](2);
|
|
690
893
|
console.log("Error loading data: ", _context4.t0);
|
|
691
894
|
dispatch({
|
|
@@ -693,20 +896,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
693
896
|
payload: [_context4.t0.message]
|
|
694
897
|
});
|
|
695
898
|
|
|
696
|
-
case
|
|
697
|
-
_context4.prev =
|
|
899
|
+
case 49:
|
|
900
|
+
_context4.prev = 49;
|
|
698
901
|
dispatch({
|
|
699
902
|
type: "SET_LOADING",
|
|
700
903
|
payload: false
|
|
701
904
|
});
|
|
702
|
-
return _context4.finish(
|
|
905
|
+
return _context4.finish(49);
|
|
703
906
|
|
|
704
|
-
case
|
|
907
|
+
case 52:
|
|
705
908
|
case "end":
|
|
706
909
|
return _context4.stop();
|
|
707
910
|
}
|
|
708
911
|
}
|
|
709
|
-
}, _callee4, null, [[2,
|
|
912
|
+
}, _callee4, null, [[2, 45, 49, 52]]);
|
|
710
913
|
}));
|
|
711
914
|
|
|
712
915
|
return function loadData() {
|
|
@@ -1223,7 +1426,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1223
1426
|
}, _callee7, null, [[11, 36, 40, 43]]);
|
|
1224
1427
|
}));
|
|
1225
1428
|
|
|
1226
|
-
return function sendSingleEvaluation(
|
|
1429
|
+
return function sendSingleEvaluation(_x3) {
|
|
1227
1430
|
return _ref10.apply(this, arguments);
|
|
1228
1431
|
};
|
|
1229
1432
|
}();
|
|
@@ -1371,7 +1574,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1371
1574
|
}, _callee9, null, [[1, 16, 19, 22]]);
|
|
1372
1575
|
}));
|
|
1373
1576
|
|
|
1374
|
-
return function sendBulkEvaluation(
|
|
1577
|
+
return function sendBulkEvaluation(_x4) {
|
|
1375
1578
|
return _ref12.apply(this, arguments);
|
|
1376
1579
|
};
|
|
1377
1580
|
}();
|
|
@@ -1417,7 +1620,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1417
1620
|
}, _callee10);
|
|
1418
1621
|
}));
|
|
1419
1622
|
|
|
1420
|
-
return function handleOnChangeAssignations(
|
|
1623
|
+
return function handleOnChangeAssignations(_x5, _x6) {
|
|
1421
1624
|
return _ref13.apply(this, arguments);
|
|
1422
1625
|
};
|
|
1423
1626
|
}();
|
|
@@ -1500,7 +1703,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1500
1703
|
}, _callee11, null, [[2, 8]]);
|
|
1501
1704
|
}));
|
|
1502
1705
|
|
|
1503
|
-
return function handleOnSubmitComment(
|
|
1706
|
+
return function handleOnSubmitComment(_x7) {
|
|
1504
1707
|
return _ref14.apply(this, arguments);
|
|
1505
1708
|
};
|
|
1506
1709
|
}();
|
|
@@ -1562,7 +1765,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1562
1765
|
};
|
|
1563
1766
|
|
|
1564
1767
|
var handleOnChangeProductVersion = function handleOnChangeProductVersion(version) {
|
|
1565
|
-
console.log(
|
|
1768
|
+
console.log("se cambia la version");
|
|
1566
1769
|
dispatch({
|
|
1567
1770
|
type: "SET_PRODUCT_VERSION",
|
|
1568
1771
|
payload: version
|
|
@@ -297,9 +297,9 @@ exports.getNewStatus = getNewStatus;
|
|
|
297
297
|
|
|
298
298
|
var getServicesData = /*#__PURE__*/function () {
|
|
299
299
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(_ref5) {
|
|
300
|
-
var _servicesResponse$dat;
|
|
300
|
+
var _servicesResponse$dat, _JSON$parse$data;
|
|
301
301
|
|
|
302
|
-
var articleId, orderId, end, token, servicesResponse;
|
|
302
|
+
var articleId, orderId, end, token, servicesResponse, body;
|
|
303
303
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
304
304
|
while (1) {
|
|
305
305
|
switch (_context5.prev = _context5.next) {
|
|
@@ -319,9 +319,10 @@ var getServicesData = /*#__PURE__*/function () {
|
|
|
319
319
|
|
|
320
320
|
case 3:
|
|
321
321
|
servicesResponse = _context5.sent;
|
|
322
|
-
|
|
322
|
+
body = servicesResponse === null || servicesResponse === void 0 ? void 0 : (_servicesResponse$dat = servicesResponse.data) === null || _servicesResponse$dat === void 0 ? void 0 : _servicesResponse$dat.body;
|
|
323
|
+
return _context5.abrupt("return", body ? (_JSON$parse$data = JSON.parse(body).data) !== null && _JSON$parse$data !== void 0 ? _JSON$parse$data : [] : []);
|
|
323
324
|
|
|
324
|
-
case
|
|
325
|
+
case 6:
|
|
325
326
|
case "end":
|
|
326
327
|
return _context5.stop();
|
|
327
328
|
}
|
package/package.json
CHANGED
|
@@ -54,16 +54,6 @@ export const GeneralInput = ({
|
|
|
54
54
|
|
|
55
55
|
}) => {
|
|
56
56
|
|
|
57
|
-
const parseOptionList = (list) => {
|
|
58
|
-
if (Array.isArray(list)) return list;
|
|
59
|
-
if (!list) return [];
|
|
60
|
-
try {
|
|
61
|
-
return JSON.parse(list);
|
|
62
|
-
} catch {
|
|
63
|
-
return String(list).split(",").map((s) => s.trim()).filter(Boolean);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
57
|
const {
|
|
68
58
|
isCreators,
|
|
69
59
|
suggestions,
|
|
@@ -221,7 +211,7 @@ export const GeneralInput = ({
|
|
|
221
211
|
disabled={disabled}
|
|
222
212
|
>
|
|
223
213
|
<option value="">{description}</option>
|
|
224
|
-
{
|
|
214
|
+
{JSON.parse(optionList || "[]").map((element, index) => (
|
|
225
215
|
<option key={element + "-" + index} value={element}>
|
|
226
216
|
{element}
|
|
227
217
|
</option>
|
|
@@ -22,6 +22,7 @@ export const FullProductNameHeader = ({
|
|
|
22
22
|
toggleObservation,
|
|
23
23
|
// handleClickOutside,
|
|
24
24
|
hideObservation,
|
|
25
|
+
showStatus = true,
|
|
25
26
|
}) => {
|
|
26
27
|
const [retailers, setRetailers] = useState([]);
|
|
27
28
|
const [retailerIndex, setRetailerIndex] = useState(null);
|
|
@@ -45,13 +46,14 @@ export const FullProductNameHeader = ({
|
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
useEffect(() => {
|
|
48
|
-
const
|
|
49
|
-
headerData?.article?.categoryRetailer
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
)
|
|
49
|
+
const source =
|
|
50
|
+
headerData?.article?.categoryRetailer ||
|
|
51
|
+
headerData?.categoryRetailerInOrder ||
|
|
52
|
+
headerData?.categoryRetailer;
|
|
53
|
+
|
|
54
|
+
const index = source?.findIndex(
|
|
55
|
+
(retailer) => retailer?.id_retailer === activeRetailer?.id
|
|
56
|
+
) ?? -1;
|
|
55
57
|
|
|
56
58
|
setRetailerIndex(index);
|
|
57
59
|
}, [activeRetailer]);
|
|
@@ -61,9 +63,11 @@ export const FullProductNameHeader = ({
|
|
|
61
63
|
<ProductNameHeader
|
|
62
64
|
productName={headerData?.article?.name || headerData?.name}
|
|
63
65
|
statusType={
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
showStatus
|
|
67
|
+
? headerData?.version_status ||
|
|
68
|
+
headerData?.status ||
|
|
69
|
+
headerData?.article_status
|
|
70
|
+
: null
|
|
67
71
|
}
|
|
68
72
|
percentRequired={percent}
|
|
69
73
|
percent={percent?.toFixed(0)}
|
|
@@ -89,11 +93,14 @@ export const FullProductNameHeader = ({
|
|
|
89
93
|
},
|
|
90
94
|
{
|
|
91
95
|
feature: "Categoría",
|
|
92
|
-
value:
|
|
96
|
+
value: (
|
|
93
97
|
headerData?.article?.categoryRetailer?.[retailerIndex]
|
|
94
98
|
?.category_name ||
|
|
95
|
-
headerData?.
|
|
96
|
-
headerData
|
|
99
|
+
headerData?.categoryRetailerInOrder?.[retailerIndex]?.category ||
|
|
100
|
+
headerData?.categoryRetailer?.[retailerIndex]?.category ||
|
|
101
|
+
headerData.categoryName ||
|
|
102
|
+
""
|
|
103
|
+
).replace(/\|/g, " | "),
|
|
97
104
|
},
|
|
98
105
|
{
|
|
99
106
|
feature: "Prov",
|