contentoh-components-library 21.6.57 → 21.6.58

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.
@@ -39,6 +39,10 @@ var _data = require("../../../global-files/data");
39
39
 
40
40
  var _customHooks = require("../../../global-files/customHooks");
41
41
 
42
+ var _useDigitalAssets = require("../../../global-files/digital-assets/useDigitalAssets");
43
+
44
+ var _assets = require("../../../global-files/digital-assets/assets.reducer");
45
+
42
46
  var _GeneralButton = require("../../atoms/GeneralButton");
43
47
 
44
48
  var _GenericModal = require("../../atoms/GenericModal");
@@ -53,6 +57,8 @@ var _GalleryElement = require("../../molecules/GalleryElement");
53
57
 
54
58
  var _GalleryHeader = require("../../molecules/GalleryHeader");
55
59
 
60
+ var _GalleryTrayTabs = require("../../molecules/GalleryTrayTabs");
61
+
56
62
  var _HeaderTop = require("../../molecules/HeaderTop");
57
63
 
58
64
  var _index = require("../../molecules/TagAndInput/index");
@@ -63,6 +69,8 @@ var _FullTabsMenu = require("../../organisms/FullTabsMenu");
63
69
 
64
70
  var _ImageDataTable = require("../../organisms/ImageDataTable");
65
71
 
72
+ var _DigitalAssetsTray = require("../../organisms/DigitalAssetsTray");
73
+
66
74
  var _ImagePreviewer = require("../../organisms/ImagePreviewer");
67
75
 
68
76
  var _InputGroup = require("../../organisms/InputGroup");
@@ -100,7 +108,7 @@ var _jsxRuntime = require("react/jsx-runtime");
100
108
  var _excluded = ["attributes"];
101
109
 
102
110
  var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
103
- var _state$product, _location$state4, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _state$product8, _state$product19, _pendingPropagation$k, _state$product24, _family$variants2, _variantGroup$members3, _variantGroup$group, _state$product25, _state$product26, _state$product27, _state$active_retaile5, _state$product28, _state$product29, _state$product30, _variantGroup$group2, _location$state5, _location$state6, _state$active_retaile6, _state$active_retaile7, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile8, _state$product31, _state$product32, _state$product33, _state$product34, _family$variants3, _family$variants4, _family$variants5, _variantGroup$members4, _variantGroup$members5, _state$active_percent, _state$active_percent2, _state$active_retaile9, _state$active_retaile10, _state$active_retaile11, _state$product40, _state$descriptions_i, _state$services3, _state$services3$data, _state$product41, _state$product42, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product43, _state$images_values12;
111
+ var _state$product, _state$product$id_art, _state$product2, _location$state4, _state$product4, _state$product5, _state$product6, _state$product7, _state$product8, _state$product9, _state$product20, _pendingPropagation$k, _state$product25, _family$variants2, _variantGroup$members3, _variantGroup$group, _state$product26, _state$product27, _state$product28, _state$active_retaile5, _state$product29, _state$product30, _state$product31, _variantGroup$group2, _location$state5, _location$state6, _state$active_retaile6, _state$active_retaile7, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile8, _state$product32, _state$product33, _state$product34, _state$product35, _family$variants3, _family$variants4, _family$variants5, _variantGroup$members4, _variantGroup$members5, _state$active_percent, _state$active_percent2, _state$active_retaile9, _state$active_retaile10, _state$active_retaile11, _state$product41, _state$descriptions_i, _state$services3, _state$services3$data, _state$product42, _state$product43, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product44, _state$images_values$3, _state$images_values12, _state$images_values13, _state$images_values14;
104
112
 
105
113
  var tabsSections = _ref.tabsSections,
106
114
  _ref$productSelected = _ref.productSelected,
@@ -116,7 +124,9 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
116
124
  setShowContentohRequestModal = _ref.setShowContentohRequestModal,
117
125
  showSurvey = _ref.showSurvey,
118
126
  company = _ref.company,
119
- addToCart = _ref.addToCart;
127
+ addToCart = _ref.addToCart,
128
+ _ref$enableDigitalAss = _ref.enableDigitalAssets,
129
+ enableDigitalAssets = _ref$enableDigitalAss === void 0 ? false : _ref$enableDigitalAss;
120
130
 
121
131
  var _useProviderProductEd = (0, _providerProductEdition.useProviderProductEdition)(),
122
132
  state = _useProviderProductEd.state,
@@ -125,6 +135,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
125
135
  saveDescriptions = _useProviderProductEd.saveDescriptions,
126
136
  updateImages = _useProviderProductEd.updateImages,
127
137
  deleteImages = _useProviderProductEd.deleteImages,
138
+ saveAssets = _useProviderProductEd.saveAssets,
139
+ registerUploadedAssets = _useProviderProductEd.registerUploadedAssets,
128
140
  handleOnDownloadImages = _useProviderProductEd.handleOnDownloadImages,
129
141
  createComment = _useProviderProductEd.createComment;
130
142
 
@@ -240,6 +252,63 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
240
252
  _useState36 = (0, _slicedToArray2.default)(_useState35, 2),
241
253
  origin = _useState36[0],
242
254
  setOrigin = _useState36[1];
255
+ /*
256
+ Bandeja de activos digitales. La lista vive en el reducer de la ficha
257
+ (`state.assets_values`), igual que las imágenes, para que el guardado del
258
+ contexto pueda leerla. El hook solo aporta validación y ciclo de vida.
259
+ */
260
+
261
+
262
+ var _useState37 = (0, _react.useState)([]),
263
+ _useState38 = (0, _slicedToArray2.default)(_useState37, 2),
264
+ assetNotices = _useState38[0],
265
+ setAssetNotices = _useState38[1];
266
+
267
+ var digitalAssets = (0, _useDigitalAssets.useDigitalAssets)({
268
+ assets: state.assets_values,
269
+ dispatch: dispatch,
270
+ notices: assetNotices,
271
+ setNotices: setAssetNotices,
272
+ // Con los dos, la subida a S3 arranca sola al soltar los archivos. Sin
273
+ // ellos —en Storybook, por ejemplo— la bandeja funciona igual pero no sube.
274
+ articleId: (_state$product$id_art = (_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.id_article) !== null && _state$product$id_art !== void 0 ? _state$product$id_art : null,
275
+ token: token,
276
+ // Al terminar la subida el activo queda registrado solo, sin esperar al
277
+ // botón de guardar: con la barra llena, nadie supone que falta un paso.
278
+ onUploaded: function onUploaded(uploaded) {
279
+ return registerUploadedAssets(token, uploaded);
280
+ }
281
+ });
282
+
283
+ var _useState39 = (0, _react.useState)(_GalleryTrayTabs.TRAYS.IMAGES),
284
+ _useState40 = (0, _slicedToArray2.default)(_useState39, 2),
285
+ activeTray = _useState40[0],
286
+ setActiveTray = _useState40[1];
287
+
288
+ var currentTray = enableDigitalAssets ? activeTray : _GalleryTrayTabs.TRAYS.IMAGES;
289
+ /*
290
+ De qué artículo se cargaron ya los activos. `state.services` se recalcula
291
+ cada vez que cambia la cadena activa, pero los activos son generales: no
292
+ dependen de la cadena, así que recargarlos borraría lo que el usuario
293
+ acaba de soltar y todavía no guarda. Por eso se cargan una sola vez por
294
+ artículo.
295
+ */
296
+
297
+ var assetsLoadedFor = (0, _react.useRef)(null);
298
+
299
+ var handleOnSetSelectedAssets = function handleOnSetSelectedAssets(assets) {
300
+ return dispatch({
301
+ type: "SET_SELECTED_ASSETS",
302
+ payload: assets
303
+ });
304
+ };
305
+
306
+ var handleOnSetAllAssetsChecked = function handleOnSetAllAssetsChecked(isChecked) {
307
+ return dispatch({
308
+ type: "TOGGLE_CHECK_ALL_ASSETS",
309
+ payload: isChecked
310
+ });
311
+ };
243
312
 
244
313
  var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
245
314
  _useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
@@ -366,19 +435,19 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
366
435
  de antes hasta que alguien cierra y reabre el producto.
367
436
  */
368
437
 
369
- var _useState37 = (0, _react.useState)(0),
370
- _useState38 = (0, _slicedToArray2.default)(_useState37, 2),
371
- linkNonce = _useState38[0],
372
- setLinkNonce = _useState38[1]; // Setter de los servicios y porcentages del producto
438
+ var _useState41 = (0, _react.useState)(0),
439
+ _useState42 = (0, _slicedToArray2.default)(_useState41, 2),
440
+ linkNonce = _useState42[0],
441
+ setLinkNonce = _useState42[1]; // Setter de los servicios y porcentages del producto
373
442
 
374
443
 
375
444
  (0, _react.useEffect)(function () {
376
445
  if (!state.product || !state.active_retailer) return;
377
446
  console.log("Fetch services and percentages");
378
- var _state$product2 = state.product,
379
- id_article = _state$product2.id_article,
380
- version = _state$product2.version,
381
- id_order = _state$product2.id_order;
447
+ var _state$product3 = state.product,
448
+ id_article = _state$product3.id_article,
449
+ version = _state$product3.version,
450
+ id_order = _state$product3.id_order;
382
451
  var _state$active_retaile = state.active_retailer,
383
452
  category = _state$active_retaile.category,
384
453
  id_category = _state$active_retaile.id_category,
@@ -487,6 +556,17 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
487
556
  type: "SET_SERVICES_DATA",
488
557
  payload: servicesDataRes
489
558
  });
559
+ /*
560
+ Activos digitales. `services[2].assets` todavía no existe en la
561
+ respuesta del backend: hasta que exista, esto no hace nada, y el día
562
+ que llegue la bandeja se llena sola sin tocar nada más.
563
+ */
564
+
565
+ if (Array.isArray(services[2].assets) && assetsLoadedFor.current !== id_article) {
566
+ assetsLoadedFor.current = id_article;
567
+ digitalAssets.replaceAll(services[2].assets);
568
+ }
569
+
490
570
  dispatch({
491
571
  type: "SET_PERCENTAGES",
492
572
  payload: percentages
@@ -502,11 +582,11 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
502
582
  type: "SET_ACTIVE_PERCENTAGES",
503
583
  payload: activePercentage
504
584
  });
505
- _context2.next = 32;
585
+ _context2.next = 33;
506
586
  break;
507
587
 
508
- case 28:
509
- _context2.prev = 28;
588
+ case 29:
589
+ _context2.prev = 29;
510
590
  _context2.t0 = _context2["catch"](1);
511
591
  console.error("Error fetching data:", _context2.t0);
512
592
  dispatch({
@@ -514,20 +594,20 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
514
594
  payload: _context2.t0
515
595
  });
516
596
 
517
- case 32:
518
- _context2.prev = 32;
597
+ case 33:
598
+ _context2.prev = 33;
519
599
  dispatch({
520
600
  type: "SET_LOADING",
521
601
  payload: false
522
602
  });
523
- return _context2.finish(32);
603
+ return _context2.finish(33);
524
604
 
525
- case 35:
605
+ case 36:
526
606
  case "end":
527
607
  return _context2.stop();
528
608
  }
529
609
  }
530
- }, _callee2, null, [[1, 28, 32, 35]]);
610
+ }, _callee2, null, [[1, 29, 33, 36]]);
531
611
  }));
532
612
 
533
613
  return function fetchData() {
@@ -536,7 +616,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
536
616
  }();
537
617
 
538
618
  fetchData();
539
- }, [(_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.datasheet_status, (_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.description_status, (_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.images_status, (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.status, (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.percentages, (_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.version, state.active_retailer, token, linkNonce]); // Actualizador de campos del ui para que coincidan con el retailer activo
619
+ }, [(_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.datasheet_status, (_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.description_status, (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.images_status, (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.status, (_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.percentages, (_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.version, state.active_retailer, token, linkNonce]); // Actualizador de campos del ui para que coincidan con el retailer activo
540
620
 
541
621
  (0, _react.useEffect)(function () {
542
622
  if (!state.active_retailer) return;
@@ -595,9 +675,9 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
595
675
  }, [state.services]); // Helper functions
596
676
 
597
677
  var canShowValidationButtons = function canShowValidationButtons() {
598
- var _state$product9;
678
+ var _state$product10;
599
679
 
600
- if (!((_state$product9 = state.product) !== null && _state$product9 !== void 0 && _state$product9.statusByRetailer)) return false;
680
+ if (!((_state$product10 = state.product) !== null && _state$product10 !== void 0 && _state$product10.statusByRetailer)) return false;
601
681
 
602
682
  try {
603
683
  var currentService = (0, _utils.getConceptByTab)(state.active_tab); // const currentStatus = state.product[`${currentService}_status`];
@@ -718,12 +798,63 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
718
798
  };
719
799
 
720
800
  var handleOnClickSaveImages = function handleOnClickSaveImages() {
721
- var _state$product10, _state$product10$serv;
801
+ var _state$product11, _state$product11$serv;
722
802
 
723
- if (((_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : (_state$product10$serv = _state$product10.services) === null || _state$product10$serv === void 0 ? void 0 : _state$product10$serv.images) === 1) {
803
+ if (((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : (_state$product11$serv = _state$product11.services) === null || _state$product11$serv === void 0 ? void 0 : _state$product11$serv.images) === 1) {
724
804
  updateImages();
725
805
  }
726
806
  };
807
+ /*
808
+ Guarda los activos y fuerza la recarga si algo se escribió.
809
+ Esta pantalla no tiene una función `loadData` reutilizable como
810
+ RetailerProductEdition: la carga de servicios vive en un `useEffect` que
811
+ solo se dispara por sus dependencias. `linkNonce` ya existe ahí para eso
812
+ mismo —forzar un refetch sin recargar la página—, así que se reutiliza en
813
+ vez de duplicar el mecanismo.
814
+ La recarga no es opcional: un activo recién creado sigue en memoria con su
815
+ id temporal y sin el id de la base. Sin volver a leer, el siguiente
816
+ guardado lo mandaría otra vez como nuevo y se duplicaría.
817
+ */
818
+
819
+
820
+ var handleOnSaveAssets = /*#__PURE__*/function () {
821
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
822
+ var guardado;
823
+ return _regenerator.default.wrap(function _callee3$(_context3) {
824
+ while (1) {
825
+ switch (_context3.prev = _context3.next) {
826
+ case 0:
827
+ _context3.next = 2;
828
+ return saveAssets(token);
829
+
830
+ case 2:
831
+ guardado = _context3.sent;
832
+
833
+ if (guardado) {
834
+ _context3.next = 5;
835
+ break;
836
+ }
837
+
838
+ return _context3.abrupt("return");
839
+
840
+ case 5:
841
+ assetsLoadedFor.current = null;
842
+ setLinkNonce(function (n) {
843
+ return n + 1;
844
+ });
845
+
846
+ case 7:
847
+ case "end":
848
+ return _context3.stop();
849
+ }
850
+ }
851
+ }, _callee3);
852
+ }));
853
+
854
+ return function handleOnSaveAssets() {
855
+ return _ref7.apply(this, arguments);
856
+ };
857
+ }();
727
858
 
728
859
  var handleOnApproveAll = function handleOnApproveAll() {
729
860
  var currentOrigin = origin[state.active_tab];
@@ -813,8 +944,106 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
813
944
  var handleOnReject = function handleOnReject() {
814
945
  setShowRejectModal(true);
815
946
  };
947
+ /*
948
+ Descarga de activos: los seleccionados, o todos si no hay selección — el
949
+ mismo criterio que usa la descarga de imágenes.
950
+ Solo se descarga lo que ya está en S3. Un activo recién soltado vive como
951
+ referencia al archivo del disco del usuario: "descargarlo" le devolvería el
952
+ archivo que él mismo acaba de elegir, lo cual no tiene sentido.
953
+ */
954
+
955
+
956
+ var handleOnDownloadAssets = function handleOnDownloadAssets() {
957
+ var seleccion = state.selected_assets.length ? state.selected_assets : state.assets_values;
958
+ var descargables = seleccion.filter(function (asset) {
959
+ return asset.id && asset.url;
960
+ });
961
+
962
+ if (descargables.length === 0) {
963
+ dispatch({
964
+ type: "SET_MODAL",
965
+ payload: {
966
+ show: true,
967
+ title: "Nada que descargar",
968
+ message: "Los activos seleccionados todavía no se han guardado. Guárdalos primero.",
969
+ image: _genericModalWarning.default
970
+ }
971
+ });
972
+ return;
973
+ }
974
+
975
+ descargables.forEach(function (asset) {
976
+ return (0, _fileSaver.saveAs)(asset.url, asset.name);
977
+ });
978
+ };
979
+ /*
980
+ Borrado en lote de activos.
981
+ A diferencia de las imágenes, que se borran contra el backend en el
982
+ momento, los activos se quitan de la bandeja y su baja viaja en el mismo
983
+ PUT del guardado (`deleteAssets`). Es lo que permite al usuario deshacerse
984
+ de un borrado por error: basta con no guardar. El mensaje lo dice, para que
985
+ nadie se quede pensando que ya se aplicó.
986
+ */
987
+
988
+
989
+ var handleOnAskToDeleteAssets = function handleOnAskToDeleteAssets() {
990
+ if (state.selected_assets.length === 0) {
991
+ dispatch({
992
+ type: "SET_MODAL",
993
+ payload: {
994
+ show: true,
995
+ title: "Eliminar activos digitales",
996
+ message: "No has seleccionado ningún activo para eliminar.",
997
+ image: _genericModalWarning.default
998
+ }
999
+ });
1000
+ return;
1001
+ }
1002
+
1003
+ var seleccionados = state.selected_assets;
1004
+ dispatch({
1005
+ type: "SET_MODAL",
1006
+ payload: {
1007
+ show: true,
1008
+ title: "Eliminar activos digitales",
1009
+ message: "Se quitar\xE1n ".concat(seleccionados.length, " activo(s) de la bandeja. El borrado se aplica al guardar."),
1010
+ image: _genericModalWarning.default,
1011
+ buttons: [{
1012
+ text: "Cancelar",
1013
+ buttonType: "general-white-button",
1014
+ action: function action() {
1015
+ return dispatch({
1016
+ type: "SET_MODAL",
1017
+ payload: {
1018
+ show: false
1019
+ }
1020
+ });
1021
+ }
1022
+ }, {
1023
+ text: "Eliminar",
1024
+ buttonType: "general-button-default",
1025
+ action: function action() {
1026
+ dispatch({
1027
+ type: "SET_MODAL",
1028
+ payload: {
1029
+ show: false
1030
+ }
1031
+ });
1032
+ seleccionados.forEach(function (asset) {
1033
+ return digitalAssets.removeAsset(asset);
1034
+ });
1035
+ }
1036
+ }]
1037
+ }
1038
+ });
1039
+ };
816
1040
 
817
1041
  var handleOnAskToDeleteImages = function handleOnAskToDeleteImages() {
1042
+ if (currentTray === _GalleryTrayTabs.TRAYS.ASSETS) {
1043
+ handleOnAskToDeleteAssets();
1044
+ return;
1045
+ }
1046
+
818
1047
  if (state.selected_images.length === 0) {
819
1048
  dispatch({
820
1049
  type: "SET_MODAL",
@@ -925,13 +1154,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
925
1154
 
926
1155
 
927
1156
  var destinosPosibles = function destinosPosibles() {
928
- var _state$product11, _variantGroup$members, _state$product$varian, _state$product12;
1157
+ var _state$product12, _variantGroup$members, _state$product$varian, _state$product13;
929
1158
 
930
- if ((_state$product11 = state.product) !== null && _state$product11 !== void 0 && _state$product11.parentArticleId) return 0;
1159
+ if ((_state$product12 = state.product) !== null && _state$product12 !== void 0 && _state$product12.parentArticleId) return 0;
931
1160
  var companeras = ((_variantGroup$members = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.members) !== null && _variantGroup$members !== void 0 ? _variantGroup$members : []).filter(function (m) {
932
1161
  return !m.isCurrent;
933
1162
  });
934
- return ((_state$product$varian = (_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 0) + companeras.length;
1163
+ return ((_state$product$varian = (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 0) + companeras.length;
935
1164
  };
936
1165
 
937
1166
  var handleOnClickSave = function handleOnClickSave() {
@@ -969,7 +1198,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
969
1198
 
970
1199
  case "Ficha técnica":
971
1200
  {
972
- var _variantGroup$members2, _state$product13, _state$product14;
1201
+ var _variantGroup$members2, _state$product14, _state$product15;
973
1202
 
974
1203
  // Guardar un padre con hijos abre la decisión de propagar. Sin este
975
1204
  // paso el cambio se queda solo en el padre y los hijos se van
@@ -996,8 +1225,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
996
1225
  él no queda ningún destino posible.
997
1226
  */
998
1227
 
999
- var esHijo = !!((_state$product13 = state.product) !== null && _state$product13 !== void 0 && _state$product13.parentArticleId);
1000
- var hayDestinos = !esHijo && (((_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.variantsCount) > 0 || companeras.length > 0);
1228
+ var esHijo = !!((_state$product14 = state.product) !== null && _state$product14 !== void 0 && _state$product14.parentArticleId);
1229
+ var hayDestinos = !esHijo && (((_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.variantsCount) > 0 || companeras.length > 0);
1001
1230
  var cambios = cambiosDeFichaTecnica();
1002
1231
 
1003
1232
  if (hayDestinos && cambios.length > 0) {
@@ -1021,6 +1250,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1021
1250
  }
1022
1251
 
1023
1252
  case "Imágenes":
1253
+ // Se guarda la bandeja que el usuario tiene a la vista: guardar las
1254
+ // dos de golpe mandaría cambios de la otra bandeja que quizá no dio
1255
+ // por terminados.
1256
+ if (currentTray === _GalleryTrayTabs.TRAYS.ASSETS) {
1257
+ handleOnSaveAssets();
1258
+ return;
1259
+ }
1260
+
1024
1261
  updateImages(token);
1025
1262
  break;
1026
1263
 
@@ -1063,30 +1300,30 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1063
1300
 
1064
1301
 
1065
1302
  var loadFamily = /*#__PURE__*/function () {
1066
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
1303
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
1067
1304
  var forzar,
1068
- _state$product15,
1305
+ _state$product16,
1069
1306
  res,
1070
- _args3 = arguments;
1307
+ _args4 = arguments;
1071
1308
 
1072
- return _regenerator.default.wrap(function _callee3$(_context3) {
1309
+ return _regenerator.default.wrap(function _callee4$(_context4) {
1073
1310
  while (1) {
1074
- switch (_context3.prev = _context3.next) {
1311
+ switch (_context4.prev = _context4.next) {
1075
1312
  case 0:
1076
- forzar = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
1313
+ forzar = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : false;
1077
1314
 
1078
1315
  if (!(family && !forzar)) {
1079
- _context3.next = 3;
1316
+ _context4.next = 3;
1080
1317
  break;
1081
1318
  }
1082
1319
 
1083
- return _context3.abrupt("return", family);
1320
+ return _context4.abrupt("return", family);
1084
1321
 
1085
1322
  case 3:
1086
- _context3.prev = 3;
1087
- _context3.next = 6;
1323
+ _context4.prev = 3;
1324
+ _context4.next = 6;
1088
1325
  return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/family"), {
1089
- articleId: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_article
1326
+ articleId: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.id_article
1090
1327
  }, {
1091
1328
  headers: {
1092
1329
  Authorization: token
@@ -1094,15 +1331,15 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1094
1331
  });
1095
1332
 
1096
1333
  case 6:
1097
- res = _context3.sent;
1334
+ res = _context4.sent;
1098
1335
  setFamily((0, _api.readPayload)(res));
1099
- _context3.next = 14;
1336
+ _context4.next = 14;
1100
1337
  break;
1101
1338
 
1102
1339
  case 10:
1103
- _context3.prev = 10;
1104
- _context3.t0 = _context3["catch"](3);
1105
- console.error("loadFamily: ", _context3.t0);
1340
+ _context4.prev = 10;
1341
+ _context4.t0 = _context4["catch"](3);
1342
+ console.error("loadFamily: ", _context4.t0);
1106
1343
  setFamily({
1107
1344
  variants: [],
1108
1345
  parent: null,
@@ -1111,14 +1348,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1111
1348
 
1112
1349
  case 14:
1113
1350
  case "end":
1114
- return _context3.stop();
1351
+ return _context4.stop();
1115
1352
  }
1116
1353
  }
1117
- }, _callee3, null, [[3, 10]]);
1354
+ }, _callee4, null, [[3, 10]]);
1118
1355
  }));
1119
1356
 
1120
1357
  return function loadFamily() {
1121
- return _ref7.apply(this, arguments);
1358
+ return _ref8.apply(this, arguments);
1122
1359
  };
1123
1360
  }();
1124
1361
  /*
@@ -1152,30 +1389,30 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1152
1389
 
1153
1390
 
1154
1391
  var openMultipleEdition = /*#__PURE__*/function () {
1155
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
1392
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
1156
1393
  var _family$variants;
1157
1394
 
1158
1395
  var ids, res, _readPayload, data, productos;
1159
1396
 
1160
- return _regenerator.default.wrap(function _callee4$(_context4) {
1397
+ return _regenerator.default.wrap(function _callee5$(_context5) {
1161
1398
  while (1) {
1162
- switch (_context4.prev = _context4.next) {
1399
+ switch (_context5.prev = _context5.next) {
1163
1400
  case 0:
1164
1401
  ids = ((_family$variants = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants !== void 0 ? _family$variants : []).map(function (variant) {
1165
1402
  return variant.articleId;
1166
1403
  });
1167
1404
 
1168
1405
  if (ids.length) {
1169
- _context4.next = 3;
1406
+ _context5.next = 3;
1170
1407
  break;
1171
1408
  }
1172
1409
 
1173
- return _context4.abrupt("return");
1410
+ return _context5.abrupt("return");
1174
1411
 
1175
1412
  case 3:
1176
1413
  setPreparandoEdicionMultiple(true);
1177
- _context4.prev = 4;
1178
- _context4.next = 7;
1414
+ _context5.prev = 4;
1415
+ _context5.next = 7;
1179
1416
  return _axios.default.get("".concat(process.env.REACT_APP_NEW_ARTICLES_ENDPOINT), {
1180
1417
  params: {
1181
1418
  listType: "general",
@@ -1187,34 +1424,34 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1187
1424
  });
1188
1425
 
1189
1426
  case 7:
1190
- res = _context4.sent;
1427
+ res = _context5.sent;
1191
1428
  _readPayload = (0, _api.readPayload)(res), data = _readPayload.data;
1192
1429
  productos = (data !== null && data !== void 0 ? data : []).filter(function (item) {
1193
1430
  return ids.includes(Number(item.id_article));
1194
1431
  });
1195
1432
 
1196
1433
  if (productos.length) {
1197
- _context4.next = 13;
1434
+ _context5.next = 13;
1198
1435
  break;
1199
1436
  }
1200
1437
 
1201
1438
  console.error("openMultipleEdition: sin productos que abrir");
1202
- return _context4.abrupt("return");
1439
+ return _context5.abrupt("return");
1203
1440
 
1204
1441
  case 13:
1205
1442
  sessionStorage.setItem("multipleEditionList", JSON.stringify(productos.sort(function (a, b) {
1206
1443
  return a.id_article - b.id_article;
1207
1444
  })));
1208
1445
  window.location.assign("/products/multipleEdition");
1209
- _context4.next = 21;
1446
+ _context5.next = 21;
1210
1447
  break;
1211
1448
 
1212
1449
  case 17:
1213
- _context4.prev = 17;
1214
- _context4.t0 = _context4["catch"](4);
1450
+ _context5.prev = 17;
1451
+ _context5.t0 = _context5["catch"](4);
1215
1452
  // Se avisa y se queda donde está: navegar con la lista vieja abriría otros
1216
1453
  // productos, y navegar sin lista deja la pantalla rota.
1217
- console.error("openMultipleEdition: ", _context4.t0);
1454
+ console.error("openMultipleEdition: ", _context5.t0);
1218
1455
  dispatch({
1219
1456
  type: "SET_MODAL",
1220
1457
  payload: {
@@ -1226,20 +1463,20 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1226
1463
  });
1227
1464
 
1228
1465
  case 21:
1229
- _context4.prev = 21;
1466
+ _context5.prev = 21;
1230
1467
  setPreparandoEdicionMultiple(false);
1231
- return _context4.finish(21);
1468
+ return _context5.finish(21);
1232
1469
 
1233
1470
  case 24:
1234
1471
  case "end":
1235
- return _context4.stop();
1472
+ return _context5.stop();
1236
1473
  }
1237
1474
  }
1238
- }, _callee4, null, [[4, 17, 21, 24]]);
1475
+ }, _callee5, null, [[4, 17, 21, 24]]);
1239
1476
  }));
1240
1477
 
1241
1478
  return function openMultipleEdition() {
1242
- return _ref8.apply(this, arguments);
1479
+ return _ref9.apply(this, arguments);
1243
1480
  };
1244
1481
  }();
1245
1482
  /*
@@ -1251,10 +1488,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1251
1488
  */
1252
1489
 
1253
1490
 
1254
- var _useState39 = (0, _react.useState)(null),
1255
- _useState40 = (0, _slicedToArray2.default)(_useState39, 2),
1256
- porDesvincular = _useState40[0],
1257
- setPorDesvincular = _useState40[1];
1491
+ var _useState43 = (0, _react.useState)(null),
1492
+ _useState44 = (0, _slicedToArray2.default)(_useState43, 2),
1493
+ porDesvincular = _useState44[0],
1494
+ setPorDesvincular = _useState44[1];
1258
1495
  /*
1259
1496
  Después de desvincular, esta ficha cambia de forma.
1260
1497
  Si el producto se soltó de su padre, deja de ser hijo y vuelve a poder ligar
@@ -1265,14 +1502,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1265
1502
 
1266
1503
 
1267
1504
  var handleOnUnlinked = function handleOnUnlinked(result) {
1268
- var _state$product$varian2, _state$product16, _updatedProduct$varia;
1505
+ var _state$product$varian2, _state$product17, _updatedProduct$varia;
1269
1506
 
1270
1507
  if (!result) return;
1271
1508
  var updatedProduct = result.mode === "self" ? (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
1272
1509
  parentArticleId: null,
1273
1510
  variantsCount: 0
1274
1511
  }) : (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
1275
- variantsCount: Math.max(((_state$product$varian2 = (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.variantsCount) !== null && _state$product$varian2 !== void 0 ? _state$product$varian2 : 1) - 1, 0)
1512
+ variantsCount: Math.max(((_state$product$varian2 = (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.variantsCount) !== null && _state$product$varian2 !== void 0 ? _state$product$varian2 : 1) - 1, 0)
1276
1513
  });
1277
1514
  dispatch({
1278
1515
  type: "SET_PRODUCT",
@@ -1320,31 +1557,31 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1320
1557
 
1321
1558
 
1322
1559
  var loadVariantGroup = /*#__PURE__*/function () {
1323
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
1560
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
1324
1561
  var forzar,
1325
- _state$product17,
1562
+ _state$product18,
1326
1563
  res,
1327
1564
  data,
1328
- _args5 = arguments;
1565
+ _args6 = arguments;
1329
1566
 
1330
- return _regenerator.default.wrap(function _callee5$(_context5) {
1567
+ return _regenerator.default.wrap(function _callee6$(_context6) {
1331
1568
  while (1) {
1332
- switch (_context5.prev = _context5.next) {
1569
+ switch (_context6.prev = _context6.next) {
1333
1570
  case 0:
1334
- forzar = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : false;
1571
+ forzar = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : false;
1335
1572
 
1336
1573
  if (!(variantGroup && !forzar)) {
1337
- _context5.next = 3;
1574
+ _context6.next = 3;
1338
1575
  break;
1339
1576
  }
1340
1577
 
1341
- return _context5.abrupt("return", variantGroup);
1578
+ return _context6.abrupt("return", variantGroup);
1342
1579
 
1343
1580
  case 3:
1344
- _context5.prev = 3;
1345
- _context5.next = 6;
1581
+ _context6.prev = 3;
1582
+ _context6.next = 6;
1346
1583
  return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/group"), {
1347
- articleId: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.id_article
1584
+ articleId: (_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.id_article
1348
1585
  }, {
1349
1586
  headers: {
1350
1587
  Authorization: token
@@ -1352,55 +1589,55 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1352
1589
  });
1353
1590
 
1354
1591
  case 6:
1355
- res = _context5.sent;
1592
+ res = _context6.sent;
1356
1593
  data = (0, _api.readPayload)(res);
1357
1594
  setVariantGroup(data);
1358
- return _context5.abrupt("return", data);
1595
+ return _context6.abrupt("return", data);
1359
1596
 
1360
1597
  case 12:
1361
- _context5.prev = 12;
1362
- _context5.t0 = _context5["catch"](3);
1363
- console.error("loadVariantGroup: ", _context5.t0);
1598
+ _context6.prev = 12;
1599
+ _context6.t0 = _context6["catch"](3);
1600
+ console.error("loadVariantGroup: ", _context6.t0);
1364
1601
  setVariantGroup({
1365
1602
  group: null,
1366
1603
  members: [],
1367
1604
  error: true
1368
1605
  });
1369
- return _context5.abrupt("return", null);
1606
+ return _context6.abrupt("return", null);
1370
1607
 
1371
1608
  case 17:
1372
1609
  case "end":
1373
- return _context5.stop();
1610
+ return _context6.stop();
1374
1611
  }
1375
1612
  }
1376
- }, _callee5, null, [[3, 12]]);
1613
+ }, _callee6, null, [[3, 12]]);
1377
1614
  }));
1378
1615
 
1379
1616
  return function loadVariantGroup() {
1380
- return _ref9.apply(this, arguments);
1617
+ return _ref10.apply(this, arguments);
1381
1618
  };
1382
1619
  }();
1383
1620
 
1384
1621
  (0, _react.useEffect)(function () {
1385
- var _state$product18;
1622
+ var _state$product19;
1386
1623
 
1387
- if (!((_state$product18 = state.product) !== null && _state$product18 !== void 0 && _state$product18.id_article)) return;
1624
+ if (!((_state$product19 = state.product) !== null && _state$product19 !== void 0 && _state$product19.id_article)) return;
1388
1625
  loadVariantGroup(true); // eslint-disable-next-line react-hooks/exhaustive-deps
1389
- }, [(_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.id_article]); // Saca el producto del grupo. Los demás miembros siguen agrupados entre ellos;
1626
+ }, [(_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.id_article]); // Saca el producto del grupo. Los demás miembros siguen agrupados entre ellos;
1390
1627
  // si era el último, el grupo deja de existir, porque no vive en ninguna tabla.
1391
1628
 
1392
1629
  var handleOnLeaveGroup = /*#__PURE__*/function () {
1393
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
1394
- var _state$product20, res;
1630
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
1631
+ var _state$product21, res;
1395
1632
 
1396
- return _regenerator.default.wrap(function _callee6$(_context6) {
1633
+ return _regenerator.default.wrap(function _callee7$(_context7) {
1397
1634
  while (1) {
1398
- switch (_context6.prev = _context6.next) {
1635
+ switch (_context7.prev = _context7.next) {
1399
1636
  case 0:
1400
- _context6.prev = 0;
1401
- _context6.next = 3;
1637
+ _context7.prev = 0;
1638
+ _context7.next = 3;
1402
1639
  return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/leave"), {
1403
- articleId: (_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.id_article
1640
+ articleId: (_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.id_article
1404
1641
  }, {
1405
1642
  headers: {
1406
1643
  Authorization: token
@@ -1408,16 +1645,16 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1408
1645
  });
1409
1646
 
1410
1647
  case 3:
1411
- res = _context6.sent;
1648
+ res = _context7.sent;
1412
1649
  setVariantGroup((0, _api.readPayload)(res));
1413
1650
  setShowGroup(false);
1414
- _context6.next = 12;
1651
+ _context7.next = 12;
1415
1652
  break;
1416
1653
 
1417
1654
  case 8:
1418
- _context6.prev = 8;
1419
- _context6.t0 = _context6["catch"](0);
1420
- console.error("leaveVariantGroup: ", _context6.t0);
1655
+ _context7.prev = 8;
1656
+ _context7.t0 = _context7["catch"](0);
1657
+ console.error("leaveVariantGroup: ", _context7.t0);
1421
1658
  dispatch({
1422
1659
  type: "SET_MODAL",
1423
1660
  payload: {
@@ -1443,28 +1680,28 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1443
1680
 
1444
1681
  case 12:
1445
1682
  case "end":
1446
- return _context6.stop();
1683
+ return _context7.stop();
1447
1684
  }
1448
1685
  }
1449
- }, _callee6, null, [[0, 8]]);
1686
+ }, _callee7, null, [[0, 8]]);
1450
1687
  }));
1451
1688
 
1452
1689
  return function handleOnLeaveGroup() {
1453
- return _ref10.apply(this, arguments);
1690
+ return _ref11.apply(this, arguments);
1454
1691
  };
1455
1692
  }();
1456
1693
 
1457
1694
  var openVariant = /*#__PURE__*/function () {
1458
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(articleId) {
1695
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(articleId) {
1459
1696
  var res, _readPayload2, data, encontrado;
1460
1697
 
1461
- return _regenerator.default.wrap(function _callee7$(_context7) {
1698
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1462
1699
  while (1) {
1463
- switch (_context7.prev = _context7.next) {
1700
+ switch (_context8.prev = _context8.next) {
1464
1701
  case 0:
1465
1702
  setLoadingVariant(articleId);
1466
- _context7.prev = 1;
1467
- _context7.next = 4;
1703
+ _context8.prev = 1;
1704
+ _context8.next = 4;
1468
1705
  return _axios.default.get("".concat(process.env.REACT_APP_NEW_ARTICLES_ENDPOINT), {
1469
1706
  params: {
1470
1707
  listType: "general",
@@ -1476,7 +1713,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1476
1713
  });
1477
1714
 
1478
1715
  case 4:
1479
- res = _context7.sent;
1716
+ res = _context8.sent;
1480
1717
  // read-articles-v2 responde { count, data: [...] }.
1481
1718
  _readPayload2 = (0, _api.readPayload)(res), data = _readPayload2.data;
1482
1719
  encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
@@ -1496,33 +1733,33 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1496
1733
  }));
1497
1734
  }
1498
1735
 
1499
- _context7.next = 13;
1736
+ _context8.next = 13;
1500
1737
  break;
1501
1738
 
1502
1739
  case 10:
1503
- _context7.prev = 10;
1504
- _context7.t0 = _context7["catch"](1);
1740
+ _context8.prev = 10;
1741
+ _context8.t0 = _context8["catch"](1);
1505
1742
  // Si la consulta falla se navega igual: la pantalla mostrará el producto
1506
1743
  // que hubiera en sessionStorage, que es el comportamiento de siempre.
1507
1744
  // Peor sería dejar el clic sin efecto y que pareciera que no responde.
1508
- console.error("openVariant: ", _context7.t0);
1745
+ console.error("openVariant: ", _context8.t0);
1509
1746
 
1510
1747
  case 13:
1511
- _context7.prev = 13;
1748
+ _context8.prev = 13;
1512
1749
  setLoadingVariant(null);
1513
1750
  window.location.assign("/products/".concat(articleId, "/datasheet"));
1514
- return _context7.finish(13);
1751
+ return _context8.finish(13);
1515
1752
 
1516
1753
  case 17:
1517
1754
  case "end":
1518
- return _context7.stop();
1755
+ return _context8.stop();
1519
1756
  }
1520
1757
  }
1521
- }, _callee7, null, [[1, 10, 13, 17]]);
1758
+ }, _callee8, null, [[1, 10, 13, 17]]);
1522
1759
  }));
1523
1760
 
1524
1761
  return function openVariant(_x2) {
1525
- return _ref11.apply(this, arguments);
1762
+ return _ref12.apply(this, arguments);
1526
1763
  };
1527
1764
  }();
1528
1765
  /*
@@ -1538,11 +1775,11 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1538
1775
 
1539
1776
 
1540
1777
  var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
1541
- var _state$product$varian3, _state$product21, _result$linked, _result$parentArticle;
1778
+ var _state$product$varian3, _state$product22, _result$linked, _result$parentArticle;
1542
1779
 
1543
1780
  if (!result) return;
1544
1781
  var updatedProduct = result.mode === "children" ? (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
1545
- variantsCount: ((_state$product$varian3 = (_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.variantsCount) !== null && _state$product$varian3 !== void 0 ? _state$product$varian3 : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
1782
+ variantsCount: ((_state$product$varian3 = (_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.variantsCount) !== null && _state$product$varian3 !== void 0 ? _state$product$varian3 : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
1546
1783
  }) : (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
1547
1784
  parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
1548
1785
  variantsCount: 0
@@ -1600,31 +1837,31 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1600
1837
 
1601
1838
 
1602
1839
  var handleOnRestoreInheritance = /*#__PURE__*/function () {
1603
- var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(attributeId) {
1604
- var _state$product22;
1840
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(attributeId) {
1841
+ var _state$product23;
1605
1842
 
1606
1843
  var kind,
1607
1844
  esDescripcion,
1608
1845
  res,
1609
1846
  data,
1610
- _args8 = arguments;
1611
- return _regenerator.default.wrap(function _callee8$(_context8) {
1847
+ _args9 = arguments;
1848
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1612
1849
  while (1) {
1613
- switch (_context8.prev = _context8.next) {
1850
+ switch (_context9.prev = _context9.next) {
1614
1851
  case 0:
1615
- kind = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : "attribute";
1852
+ kind = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : "attribute";
1616
1853
 
1617
- if (!(!attributeId || !((_state$product22 = state.product) !== null && _state$product22 !== void 0 && _state$product22.id_article))) {
1618
- _context8.next = 3;
1854
+ if (!(!attributeId || !((_state$product23 = state.product) !== null && _state$product23 !== void 0 && _state$product23.id_article))) {
1855
+ _context9.next = 3;
1619
1856
  break;
1620
1857
  }
1621
1858
 
1622
- return _context8.abrupt("return");
1859
+ return _context9.abrupt("return");
1623
1860
 
1624
1861
  case 3:
1625
1862
  esDescripcion = kind === "description";
1626
- _context8.prev = 4;
1627
- _context8.next = 7;
1863
+ _context9.prev = 4;
1864
+ _context9.next = 7;
1628
1865
  return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread4.default)({
1629
1866
  articleId: state.product.id_article
1630
1867
  }, esDescripcion ? {
@@ -1638,13 +1875,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1638
1875
  });
1639
1876
 
1640
1877
  case 7:
1641
- res = _context8.sent;
1878
+ res = _context9.sent;
1642
1879
  // El API responde 200 aunque la lambda haya devuelto 400: el resultado
1643
1880
  // real viaja en el cuerpo y readPayload lo convierte en excepción.
1644
1881
  data = (0, _api.readPayload)(res);
1645
1882
 
1646
1883
  if (!esDescripcion) {
1647
- _context8.next = 12;
1884
+ _context9.next = 12;
1648
1885
  break;
1649
1886
  }
1650
1887
 
@@ -1658,7 +1895,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1658
1895
  };
1659
1896
  })
1660
1897
  });
1661
- return _context8.abrupt("return");
1898
+ return _context9.abrupt("return");
1662
1899
 
1663
1900
  case 12:
1664
1901
  dispatch({
@@ -1671,24 +1908,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1671
1908
  };
1672
1909
  })
1673
1910
  });
1674
- _context8.next = 18;
1911
+ _context9.next = 18;
1675
1912
  break;
1676
1913
 
1677
1914
  case 15:
1678
- _context8.prev = 15;
1679
- _context8.t0 = _context8["catch"](4);
1680
- console.error("restoreInheritance: ", _context8.t0);
1915
+ _context9.prev = 15;
1916
+ _context9.t0 = _context9["catch"](4);
1917
+ console.error("restoreInheritance: ", _context9.t0);
1681
1918
 
1682
1919
  case 18:
1683
1920
  case "end":
1684
- return _context8.stop();
1921
+ return _context9.stop();
1685
1922
  }
1686
1923
  }
1687
- }, _callee8, null, [[4, 15]]);
1924
+ }, _callee9, null, [[4, 15]]);
1688
1925
  }));
1689
1926
 
1690
1927
  return function handleOnRestoreInheritance(_x3) {
1691
- return _ref12.apply(this, arguments);
1928
+ return _ref13.apply(this, arguments);
1692
1929
  };
1693
1930
  }();
1694
1931
 
@@ -1723,14 +1960,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1723
1960
  };
1724
1961
 
1725
1962
  var sendEvaluation = /*#__PURE__*/function () {
1726
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
1727
- var _state$product$id_ord, _state$active_retaile4, _state$product$status, _state$product$status2, _state$product23;
1963
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
1964
+ var _state$product$id_ord, _state$active_retaile4, _state$product$status, _state$product$status2, _state$product24;
1728
1965
 
1729
1966
  var concept, articleId, orderId, retailerId, evalStatus, data, _newStatuses$newStatu, _state$services_data, res, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, updatedServicesData;
1730
1967
 
1731
- return _regenerator.default.wrap(function _callee9$(_context9) {
1968
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1732
1969
  while (1) {
1733
- switch (_context9.prev = _context9.next) {
1970
+ switch (_context10.prev = _context10.next) {
1734
1971
  case 0:
1735
1972
  dispatch({
1736
1973
  type: "SET_SAVING",
@@ -1740,23 +1977,23 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1740
1977
  articleId = state.product.id_article;
1741
1978
  orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
1742
1979
  retailerId = (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.id_retailer;
1743
- 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$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.version_status);
1980
+ 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$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.version_status);
1744
1981
  data = {
1745
1982
  articleId: articleId,
1746
1983
  orderId: orderId,
1747
1984
  concept: concept,
1748
1985
  evalStatus: evalStatus
1749
1986
  };
1750
- _context9.prev = 7;
1987
+ _context10.prev = 7;
1751
1988
 
1752
1989
  if (!result) {
1753
- _context9.next = 22;
1990
+ _context10.next = 22;
1754
1991
  break;
1755
1992
  }
1756
1993
 
1757
1994
  data.result = result;
1758
1995
  data.retailerId = retailerId;
1759
- _context9.next = 13;
1996
+ _context10.next = 13;
1760
1997
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1761
1998
  headers: {
1762
1999
  Authorization: token
@@ -1764,7 +2001,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1764
2001
  });
1765
2002
 
1766
2003
  case 13:
1767
- res = _context9.sent;
2004
+ res = _context10.sent;
1768
2005
  newStatuses = JSON.parse(res.data.body);
1769
2006
  serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")]; // Actualizar el producto con los nuevos estados
1770
2007
 
@@ -1801,13 +2038,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1801
2038
  });
1802
2039
 
1803
2040
  case 22:
1804
- _context9.next = 28;
2041
+ _context10.next = 28;
1805
2042
  break;
1806
2043
 
1807
2044
  case 24:
1808
- _context9.prev = 24;
1809
- _context9.t0 = _context9["catch"](7);
1810
- console.error("Error sending evaluation:", _context9.t0);
2045
+ _context10.prev = 24;
2046
+ _context10.t0 = _context10["catch"](7);
2047
+ console.error("Error sending evaluation:", _context10.t0);
1811
2048
  dispatch({
1812
2049
  type: "SET_MODAL",
1813
2050
  payload: {
@@ -1819,32 +2056,32 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1819
2056
  });
1820
2057
 
1821
2058
  case 28:
1822
- _context9.prev = 28;
2059
+ _context10.prev = 28;
1823
2060
  dispatch({
1824
2061
  type: "SET_SAVING",
1825
2062
  payload: false
1826
2063
  });
1827
- return _context9.finish(28);
2064
+ return _context10.finish(28);
1828
2065
 
1829
2066
  case 31:
1830
2067
  case "end":
1831
- return _context9.stop();
2068
+ return _context10.stop();
1832
2069
  }
1833
2070
  }
1834
- }, _callee9, null, [[7, 24, 28, 31]]);
2071
+ }, _callee10, null, [[7, 24, 28, 31]]);
1835
2072
  }));
1836
2073
 
1837
2074
  return function sendEvaluation(_x4) {
1838
- return _ref13.apply(this, arguments);
2075
+ return _ref14.apply(this, arguments);
1839
2076
  };
1840
2077
  }();
1841
2078
 
1842
2079
  var evaluationToRetailer = /*#__PURE__*/function () {
1843
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
2080
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
1844
2081
  var data, statusComplete, updatedProduct;
1845
- return _regenerator.default.wrap(function _callee10$(_context10) {
2082
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1846
2083
  while (1) {
1847
- switch (_context10.prev = _context10.next) {
2084
+ switch (_context11.prev = _context11.next) {
1848
2085
  case 0:
1849
2086
  dispatch({
1850
2087
  type: "SET_SAVING",
@@ -1856,8 +2093,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1856
2093
  versionId: state.product.version,
1857
2094
  status: result
1858
2095
  };
1859
- _context10.prev = 2;
1860
- _context10.next = 5;
2096
+ _context11.prev = 2;
2097
+ _context11.next = 5;
1861
2098
  return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
1862
2099
  headers: {
1863
2100
  Authorization: token
@@ -1887,13 +2124,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1887
2124
  image: _genericModalCheck.default
1888
2125
  }
1889
2126
  });
1890
- _context10.next = 15;
2127
+ _context11.next = 15;
1891
2128
  break;
1892
2129
 
1893
2130
  case 11:
1894
- _context10.prev = 11;
1895
- _context10.t0 = _context10["catch"](2);
1896
- console.error("Error evaluating to retailer:", _context10.t0);
2131
+ _context11.prev = 11;
2132
+ _context11.t0 = _context11["catch"](2);
2133
+ console.error("Error evaluating to retailer:", _context11.t0);
1897
2134
  dispatch({
1898
2135
  type: "SET_MODAL",
1899
2136
  payload: {
@@ -1905,23 +2142,23 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1905
2142
  });
1906
2143
 
1907
2144
  case 15:
1908
- _context10.prev = 15;
2145
+ _context11.prev = 15;
1909
2146
  dispatch({
1910
2147
  type: "SET_SAVING",
1911
2148
  payload: false
1912
2149
  });
1913
- return _context10.finish(15);
2150
+ return _context11.finish(15);
1914
2151
 
1915
2152
  case 18:
1916
2153
  case "end":
1917
- return _context10.stop();
2154
+ return _context11.stop();
1918
2155
  }
1919
2156
  }
1920
- }, _callee10, null, [[2, 11, 15, 18]]);
2157
+ }, _callee11, null, [[2, 11, 15, 18]]);
1921
2158
  }));
1922
2159
 
1923
2160
  return function evaluationToRetailer(_x5) {
1924
- return _ref14.apply(this, arguments);
2161
+ return _ref15.apply(this, arguments);
1925
2162
  };
1926
2163
  }();
1927
2164
 
@@ -2052,18 +2289,18 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2052
2289
  };
2053
2290
 
2054
2291
  var handleOnEvaluateAll = /*#__PURE__*/function () {
2055
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
2292
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(result) {
2056
2293
  var _state$product$id_ord2, _state$services_data2, evaluationArray, conceptArray, dataGeneral, isProvider, userType, status, updatedStatusByRetailer, updatedProduct;
2057
2294
 
2058
- return _regenerator.default.wrap(function _callee11$(_context11) {
2295
+ return _regenerator.default.wrap(function _callee12$(_context12) {
2059
2296
  while (1) {
2060
- switch (_context11.prev = _context11.next) {
2297
+ switch (_context12.prev = _context12.next) {
2061
2298
  case 0:
2062
2299
  dispatch({
2063
2300
  type: "SET_SAVING",
2064
2301
  payload: true
2065
2302
  });
2066
- _context11.prev = 1;
2303
+ _context12.prev = 1;
2067
2304
  evaluationArray = [];
2068
2305
  conceptArray = ["description", "datasheet", "images"];
2069
2306
  dataGeneral = {
@@ -2094,7 +2331,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2094
2331
  }));
2095
2332
  }); // Ejecutar todas las evaluaciones
2096
2333
 
2097
- _context11.next = 9;
2334
+ _context12.next = 9;
2098
2335
  return Promise.all(evaluationArray);
2099
2336
 
2100
2337
  case 9:
@@ -2139,13 +2376,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2139
2376
  image: _genericModalCheck.default
2140
2377
  }
2141
2378
  });
2142
- _context11.next = 24;
2379
+ _context12.next = 24;
2143
2380
  break;
2144
2381
 
2145
2382
  case 20:
2146
- _context11.prev = 20;
2147
- _context11.t0 = _context11["catch"](1);
2148
- console.error("Error evaluating all:", _context11.t0);
2383
+ _context12.prev = 20;
2384
+ _context12.t0 = _context12["catch"](1);
2385
+ console.error("Error evaluating all:", _context12.t0);
2149
2386
  dispatch({
2150
2387
  type: "SET_MODAL",
2151
2388
  payload: {
@@ -2157,24 +2394,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2157
2394
  });
2158
2395
 
2159
2396
  case 24:
2160
- _context11.prev = 24;
2397
+ _context12.prev = 24;
2161
2398
  dispatch({
2162
2399
  type: "SET_SAVING",
2163
2400
  payload: false
2164
2401
  });
2165
2402
  setRejectAll(false);
2166
- return _context11.finish(24);
2403
+ return _context12.finish(24);
2167
2404
 
2168
2405
  case 28:
2169
2406
  case "end":
2170
- return _context11.stop();
2407
+ return _context12.stop();
2171
2408
  }
2172
2409
  }
2173
- }, _callee11, null, [[1, 20, 24, 28]]);
2410
+ }, _callee12, null, [[1, 20, 24, 28]]);
2174
2411
  }));
2175
2412
 
2176
2413
  return function handleOnEvaluateAll(_x6) {
2177
- return _ref15.apply(this, arguments);
2414
+ return _ref16.apply(this, arguments);
2178
2415
  };
2179
2416
  }();
2180
2417
 
@@ -2225,7 +2462,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2225
2462
  }), pendingPropagation && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PropagateChangesModal.PropagateChangesModal, {
2226
2463
  changedAttributes: pendingPropagation.cambios,
2227
2464
  kind: (_pendingPropagation$k = pendingPropagation.kind) !== null && _pendingPropagation$k !== void 0 ? _pendingPropagation$k : "datasheet",
2228
- variants: (_state$product24 = state.product) !== null && _state$product24 !== void 0 && _state$product24.parentArticleId ? [] : ((_family$variants2 = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants2 !== void 0 ? _family$variants2 : []).filter(function (v) {
2465
+ variants: (_state$product25 = state.product) !== null && _state$product25 !== void 0 && _state$product25.parentArticleId ? [] : ((_family$variants2 = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants2 !== void 0 ? _family$variants2 : []).filter(function (v) {
2229
2466
  return !v.isCurrent;
2230
2467
  }),
2231
2468
  groupMembers: ((_variantGroup$members3 = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.members) !== null && _variantGroup$members3 !== void 0 ? _variantGroup$members3 : []).filter(function (m) {
@@ -2265,9 +2502,9 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2265
2502
  }
2266
2503
  }
2267
2504
  }), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
2268
- articleId: (_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.id_article,
2269
- articleName: (_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.name,
2270
- articleUpc: (_state$product27 = state.product) === null || _state$product27 === void 0 ? void 0 : _state$product27.upc,
2505
+ articleId: (_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.id_article,
2506
+ articleName: (_state$product27 = state.product) === null || _state$product27 === void 0 ? void 0 : _state$product27.name,
2507
+ articleUpc: (_state$product28 = state.product) === null || _state$product28 === void 0 ? void 0 : _state$product28.upc,
2271
2508
  activeRetailerId: (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.id_retailer,
2272
2509
  token: token,
2273
2510
  onClose: function onClose() {
@@ -2275,9 +2512,9 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2275
2512
  },
2276
2513
  onLinked: handleOnLinkedVariants
2277
2514
  }), showGroupModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VariantGroupModal.VariantGroupModal, {
2278
- articleId: (_state$product28 = state.product) === null || _state$product28 === void 0 ? void 0 : _state$product28.id_article,
2279
- articleName: (_state$product29 = state.product) === null || _state$product29 === void 0 ? void 0 : _state$product29.name,
2280
- articleUpc: (_state$product30 = state.product) === null || _state$product30 === void 0 ? void 0 : _state$product30.upc,
2515
+ articleId: (_state$product29 = state.product) === null || _state$product29 === void 0 ? void 0 : _state$product29.id_article,
2516
+ articleName: (_state$product30 = state.product) === null || _state$product30 === void 0 ? void 0 : _state$product30.name,
2517
+ articleUpc: (_state$product31 = state.product) === null || _state$product31 === void 0 ? void 0 : _state$product31.upc,
2281
2518
  currentGroup: (_variantGroup$group2 = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) !== null && _variantGroup$group2 !== void 0 ? _variantGroup$group2 : null,
2282
2519
  token: token,
2283
2520
  onClose: function onClose() {
@@ -2353,21 +2590,21 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2353
2590
  type: "pink",
2354
2591
  label: "Aceptar",
2355
2592
  size: 12,
2356
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
2593
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
2357
2594
  var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
2358
- return _regenerator.default.wrap(function _callee12$(_context12) {
2595
+ return _regenerator.default.wrap(function _callee13$(_context13) {
2359
2596
  while (1) {
2360
- switch (_context12.prev = _context12.next) {
2597
+ switch (_context13.prev = _context13.next) {
2361
2598
  case 0:
2362
2599
  elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
2363
2600
 
2364
2601
  if (!(!elements || elements.length === 0)) {
2365
- _context12.next = 4;
2602
+ _context13.next = 4;
2366
2603
  break;
2367
2604
  }
2368
2605
 
2369
2606
  console.error("Elemento no encontrado");
2370
- return _context12.abrupt("return");
2607
+ return _context13.abrupt("return");
2371
2608
 
2372
2609
  case 4:
2373
2610
  isMessageEmpty = Array.from(elements).every(function (el) {
@@ -2376,7 +2613,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2376
2613
  });
2377
2614
 
2378
2615
  if (!isMessageEmpty) {
2379
- _context12.next = 10;
2616
+ _context13.next = 10;
2380
2617
  break;
2381
2618
  }
2382
2619
 
@@ -2391,13 +2628,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2391
2628
  container.appendChild(alert);
2392
2629
  }
2393
2630
 
2394
- return _context12.abrupt("return");
2631
+ return _context13.abrupt("return");
2395
2632
 
2396
2633
  case 10:
2397
2634
  fullMessage = Array.from(elements).map(function (element) {
2398
2635
  return element.innerHTML;
2399
2636
  }).join("").replace(/<br\s*\/?>/gi, "\n");
2400
- _context12.next = 13;
2637
+ _context13.next = 13;
2401
2638
  return createComment(fullMessage, token);
2402
2639
 
2403
2640
  case 13:
@@ -2406,10 +2643,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2406
2643
 
2407
2644
  case 15:
2408
2645
  case "end":
2409
- return _context12.stop();
2646
+ return _context13.stop();
2410
2647
  }
2411
2648
  }
2412
- }, _callee12);
2649
+ }, _callee13);
2413
2650
  }))
2414
2651
  }, "btn-Aceptar")]
2415
2652
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
@@ -2436,7 +2673,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2436
2673
  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] : {},
2437
2674
  assignationsImages: assig,
2438
2675
  retailerSelected: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.id_retailer,
2439
- imagesStatus: ((_state$product31 = state.product) === null || _state$product31 === void 0 ? void 0 : _state$product31.images_status) || "-",
2676
+ imagesStatus: ((_state$product32 = state.product) === null || _state$product32 === void 0 ? void 0 : _state$product32.images_status) || "-",
2440
2677
  isRetailer: isRetailer,
2441
2678
  setShowVersionSelector: setShowVersionSelector,
2442
2679
  version: state.product.version,
@@ -2449,7 +2686,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2449
2686
  className: "product-information",
2450
2687
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2451
2688
  className: "product-information",
2452
- children: [!((_state$product32 = state.product) !== null && _state$product32 !== void 0 && _state$product32.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2689
+ children: [!((_state$product33 = state.product) !== null && _state$product33 !== void 0 && _state$product33.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2453
2690
  className: "variants-actions",
2454
2691
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
2455
2692
  type: "button",
@@ -2458,7 +2695,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2458
2695
  return setShowLinkVariants(true);
2459
2696
  },
2460
2697
  children: "Ligar productos"
2461
- }), ((_state$product33 = state.product) === null || _state$product33 === void 0 ? void 0 : _state$product33.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2698
+ }), ((_state$product34 = state.product) === null || _state$product34 === void 0 ? void 0 : _state$product34.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2462
2699
  type: "button",
2463
2700
  className: "variants-count",
2464
2701
  "aria-expanded": showFamily,
@@ -2473,7 +2710,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2473
2710
  children: showFamily ? " ▴" : " ▾"
2474
2711
  })]
2475
2712
  })]
2476
- }), ((_state$product34 = state.product) === null || _state$product34 === void 0 ? void 0 : _state$product34.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2713
+ }), ((_state$product35 = state.product) === null || _state$product35 === void 0 ? void 0 : _state$product35.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2477
2714
  className: "variants-actions",
2478
2715
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2479
2716
  type: "button",
@@ -2522,13 +2759,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2522
2759
  className: "desvincular",
2523
2760
  title: "Dejar de ser hijo de este producto",
2524
2761
  onClick: function onClick() {
2525
- var _state$product35, _state$product36, _state$product37;
2762
+ var _state$product36, _state$product37, _state$product38;
2526
2763
 
2527
2764
  return setPorDesvincular({
2528
2765
  mode: "self",
2529
- childArticleId: (_state$product35 = state.product) === null || _state$product35 === void 0 ? void 0 : _state$product35.id_article,
2530
- childName: (_state$product36 = state.product) === null || _state$product36 === void 0 ? void 0 : _state$product36.name,
2531
- childUpc: (_state$product37 = state.product) === null || _state$product37 === void 0 ? void 0 : _state$product37.upc,
2766
+ childArticleId: (_state$product36 = state.product) === null || _state$product36 === void 0 ? void 0 : _state$product36.id_article,
2767
+ childName: (_state$product37 = state.product) === null || _state$product37 === void 0 ? void 0 : _state$product37.name,
2768
+ childUpc: (_state$product38 = state.product) === null || _state$product38 === void 0 ? void 0 : _state$product38.upc,
2532
2769
  parentName: family.parent.name,
2533
2770
  parentUpc: family.parent.upc
2534
2771
  });
@@ -2560,15 +2797,15 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2560
2797
  className: "desvincular",
2561
2798
  title: "Desvincular este hijo",
2562
2799
  onClick: function onClick() {
2563
- var _state$product38, _state$product39;
2800
+ var _state$product39, _state$product40;
2564
2801
 
2565
2802
  return setPorDesvincular({
2566
2803
  mode: "child",
2567
2804
  childArticleId: variant.articleId,
2568
2805
  childName: variant.name,
2569
2806
  childUpc: variant.upc,
2570
- parentName: (_state$product38 = state.product) === null || _state$product38 === void 0 ? void 0 : _state$product38.name,
2571
- parentUpc: (_state$product39 = state.product) === null || _state$product39 === void 0 ? void 0 : _state$product39.upc
2807
+ parentName: (_state$product39 = state.product) === null || _state$product39 === void 0 ? void 0 : _state$product39.name,
2808
+ parentUpc: (_state$product40 = state.product) === null || _state$product40 === void 0 ? void 0 : _state$product40.upc
2572
2809
  });
2573
2810
  },
2574
2811
  children: "Desvincular"
@@ -2677,7 +2914,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2677
2914
  updatedImages: state.updated_images_values,
2678
2915
  images: state.services.images // actions
2679
2916
  ,
2680
- downloadImages: handleOnDownloadImages,
2917
+ downloadImages: currentTray === _GalleryTrayTabs.TRAYS.ASSETS ? handleOnDownloadAssets : handleOnDownloadImages,
2681
2918
  askToDeleteImages: handleOnAskToDeleteImages,
2682
2919
  showSaveButton: canShowSaveButton(state.product.version_status),
2683
2920
  onClickSave: handleOnClickSave // setters
@@ -2695,7 +2932,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2695
2932
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2696
2933
  className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
2697
2934
  children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2698
- children: [state.active_tab === "Descripción" && (((_state$product40 = state.product) === null || _state$product40 === void 0 ? void 0 : _state$product40.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, {
2935
+ children: [state.active_tab === "Descripción" && (((_state$product41 = state.product) === null || _state$product41 === void 0 ? void 0 : _state$product41.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, {
2699
2936
  activeSection: state.active_tab,
2700
2937
  inputGroup: state.descriptions_inputs[0],
2701
2938
  updatedDescriptions: state.updated_descriptions_inputs
@@ -2706,7 +2943,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2706
2943
  ,
2707
2944
  variant: (_state$services3 = state.services) === null || _state$services3 === void 0 ? void 0 : (_state$services3$data = _state$services3.datasheets) === null || _state$services3$data === void 0 ? void 0 : _state$services3$data.variant,
2708
2945
  onRestoreInheritance: handleOnRestoreInheritance,
2709
- articleId: (_state$product41 = state.product) === null || _state$product41 === void 0 ? void 0 : _state$product41.id_article,
2946
+ articleId: (_state$product42 = state.product) === null || _state$product42 === void 0 ? void 0 : _state$product42.id_article,
2710
2947
  version: state.product.version,
2711
2948
  isShowbox: false,
2712
2949
  dinamicHeight: true,
@@ -2718,7 +2955,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2718
2955
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
2719
2956
  text: "No cuentas con este servicio",
2720
2957
  headerType: "input-name-header"
2721
- })), state.active_tab === "Ficha técnica" && (((_state$product42 = state.product) === null || _state$product42 === void 0 ? void 0 : _state$product42.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
2958
+ })), state.active_tab === "Ficha técnica" && (((_state$product43 = state.product) === null || _state$product43 === void 0 ? void 0 : _state$product43.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
2722
2959
  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) {
2723
2960
  var _state$datasheets_inp4, _state$services4, _state$services4$data, _state$services$datas3;
2724
2961
 
@@ -2748,14 +2985,32 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2748
2985
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
2749
2986
  text: "No cuentas con este servicio",
2750
2987
  headerType: "input-name-header"
2751
- })), state.active_tab === "Imágenes" && (((_state$product43 = state.product) === null || _state$product43 === void 0 ? void 0 : _state$product43.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2752
- children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
2988
+ })), state.active_tab === "Imágenes" && (((_state$product44 = state.product) === null || _state$product44 === void 0 ? void 0 : _state$product44.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2989
+ children: [enableDigitalAssets && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryTrayTabs.GalleryTrayTabs, {
2990
+ activeTray: currentTray,
2991
+ setActiveTray: setActiveTray,
2992
+ imagesCount: (_state$images_values$3 = (_state$images_values12 = state.images_values) === null || _state$images_values12 === void 0 ? void 0 : (_state$images_values13 = _state$images_values12.values) === null || _state$images_values13 === void 0 ? void 0 : _state$images_values13.length) !== null && _state$images_values$3 !== void 0 ? _state$images_values$3 : 0,
2993
+ assetsCount: digitalAssets.assets.length
2994
+ }), currentTray === _GalleryTrayTabs.TRAYS.ASSETS && /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
2995
+ className: "container",
2996
+ style: {
2997
+ position: "relative"
2998
+ },
2999
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DigitalAssetsTray.DigitalAssetsTray, (0, _objectSpread4.default)((0, _objectSpread4.default)({}, digitalAssets), {}, {
3000
+ unsaved: (0, _assets.countUnsavedAssets)(state),
3001
+ gridLayout: imageLayout,
3002
+ readOnly: false,
3003
+ selectedAssets: state.selected_assets,
3004
+ setSelectedAssets: handleOnSetSelectedAssets,
3005
+ setCheckAll: handleOnSetAllAssetsChecked
3006
+ }))
3007
+ }), currentTray === _GalleryTrayTabs.TRAYS.IMAGES && !imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
2753
3008
  checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
2754
3009
  ,
2755
3010
  setCheckAll: handleOnSetCheckAll // Toggler de true o false para el checkbox "Seleccionar todo"
2756
3011
  ,
2757
3012
  setSelectedImages: handleOnSetSelectedImages
2758
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
3013
+ }), currentTray === _GalleryTrayTabs.TRAYS.IMAGES && /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
2759
3014
  className: "container",
2760
3015
  style: {
2761
3016
  position: "relative"
@@ -2771,7 +3026,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2771
3026
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
2772
3027
  children: thumbs()
2773
3028
  })]
2774
- })), ((_state$images_values12 = state.images_values) === null || _state$images_values12 === void 0 ? void 0 : _state$images_values12.values.length) === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3029
+ })), ((_state$images_values14 = state.images_values) === null || _state$images_values14 === void 0 ? void 0 : _state$images_values14.values.length) === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2775
3030
  style: {
2776
3031
  position: "absolute",
2777
3032
  top: "50%",