contentoh-components-library 21.6.61 → 21.6.63

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.
Files changed (102) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/dist/ai/prompts/attribute.prompt.js +28 -0
  3. package/dist/ai/prompts/description.prompt.js +33 -0
  4. package/dist/ai/schemas/attribute.schema.js +35 -0
  5. package/dist/ai/schemas/description.schema.js +27 -0
  6. package/dist/components/atoms/MetricCard/index.js +3 -1
  7. package/dist/components/organisms/DashboardMetric/DashboardMetric.stories.js +12 -2
  8. package/dist/components/organisms/DashboardMetric/index.js +24 -1
  9. package/dist/components/organisms/DashboardMetric/styles.js +1 -1
  10. package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +11 -5
  11. package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +58 -31
  12. package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +5 -1
  13. package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +3 -40
  14. package/dist/components/pages/CreatorsProductEdition/sections/ImagesSection.js +18 -3
  15. package/dist/components/pages/CreatorsProductEdition/sections/StatusChip.js +4 -13
  16. package/dist/components/pages/CreatorsProductEdition/sections/TabsBar.js +10 -0
  17. package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +10 -2
  18. package/dist/components/pages/Dashboard/dashboardUtils.js +3 -3
  19. package/dist/components/pages/Dashboard/index.js +102 -88
  20. package/dist/components/pages/Dashboard/styles.js +1 -1
  21. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -15
  22. package/dist/components/pages/RetailerProductEdition/index.js +40 -57
  23. package/dist/components/pages/RetailerProductEdition/utils.js +2 -6
  24. package/dist/index.js +0 -13
  25. package/package.json +1 -1
  26. package/src/components/atoms/MetricCard/index.js +2 -2
  27. package/src/components/organisms/DashboardMetric/DashboardMetric.stories.js +11 -0
  28. package/src/components/organisms/DashboardMetric/index.js +13 -1
  29. package/src/components/organisms/DashboardMetric/styles.js +13 -0
  30. package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +22 -3
  31. package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +36 -1
  32. package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +15 -3
  33. package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +8 -18
  34. package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +24 -2
  35. package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +4 -8
  36. package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +9 -0
  37. package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +6 -0
  38. package/src/components/pages/Dashboard/dashboardUtils.js +3 -3
  39. package/src/components/pages/Dashboard/index.js +62 -106
  40. package/src/components/pages/Dashboard/styles.js +17 -12
  41. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +0 -12
  42. package/src/components/pages/RetailerProductEdition/index.js +3 -28
  43. package/src/components/pages/RetailerProductEdition/utils.js +0 -5
  44. package/src/index.js +0 -1
  45. package/dist/components/organisms/ServicesNavigation/ServiceToolbar.js +0 -210
  46. package/dist/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +0 -138
  47. package/dist/components/organisms/ServicesNavigation/ServicesRail.js +0 -705
  48. package/dist/components/organisms/ServicesNavigation/catalog.js +0 -505
  49. package/dist/components/organisms/ServicesNavigation/index.js +0 -337
  50. package/dist/components/organisms/ServicesNavigation/model.js +0 -167
  51. package/dist/components/organisms/ServicesNavigation/ui.js +0 -371
  52. package/dist/components/organisms/ServicesNavigation/views.js +0 -1237
  53. package/dist/components/organisms/ServicesWorkspace/AssigneePicker.js +0 -459
  54. package/dist/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +0 -119
  55. package/dist/components/organisms/ServicesWorkspace/demo.js +0 -137
  56. package/dist/components/organisms/ServicesWorkspace/index.js +0 -813
  57. package/dist/components/organisms/ServicesWorkspace/servicesModel.js +0 -351
  58. package/dist/components/organisms/ServicesWorkspace/tooltipStyles.js +0 -37
  59. package/dist/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +0 -387
  60. package/dist/components/pages/ProductEdition/ProductEdition.stories.js +0 -148
  61. package/dist/components/pages/ProductEdition/ProductEditionView.js +0 -1355
  62. package/dist/components/pages/ProductEdition/ServiceHeader.js +0 -142
  63. package/dist/components/pages/ProductEdition/api.js +0 -256
  64. package/dist/components/pages/ProductEdition/index.js +0 -37
  65. package/dist/components/pages/ProductEdition/permissions.js +0 -200
  66. package/dist/components/pages/ProductEdition/permissions.test.js +0 -320
  67. package/dist/components/pages/ProductEdition/sections/CatalogServicePanel.js +0 -237
  68. package/dist/components/pages/ProductEdition/sections/EditionTopBar.js +0 -174
  69. package/dist/components/pages/ProductEdition/sections/ImagePanel.js +0 -440
  70. package/dist/components/pages/ProductEdition/sections/ServiceTeam.js +0 -275
  71. package/dist/components/pages/ProductEdition/sections/ServiceTools.js +0 -186
  72. package/dist/components/pages/ProductEdition/services.js +0 -233
  73. package/dist/components/pages/ProductEdition/services.test.js +0 -195
  74. package/src/components/organisms/ServicesNavigation/ServiceToolbar.jsx +0 -143
  75. package/src/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +0 -101
  76. package/src/components/organisms/ServicesNavigation/ServicesRail.jsx +0 -591
  77. package/src/components/organisms/ServicesNavigation/catalog.js +0 -180
  78. package/src/components/organisms/ServicesNavigation/index.jsx +0 -232
  79. package/src/components/organisms/ServicesNavigation/model.js +0 -85
  80. package/src/components/organisms/ServicesNavigation/ui.jsx +0 -229
  81. package/src/components/organisms/ServicesNavigation/views.jsx +0 -705
  82. package/src/components/organisms/ServicesWorkspace/AssigneePicker.js +0 -348
  83. package/src/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +0 -61
  84. package/src/components/organisms/ServicesWorkspace/demo.js +0 -58
  85. package/src/components/organisms/ServicesWorkspace/index.js +0 -556
  86. package/src/components/organisms/ServicesWorkspace/servicesModel.js +0 -203
  87. package/src/components/organisms/ServicesWorkspace/tooltipStyles.js +0 -27
  88. package/src/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +0 -175
  89. package/src/components/pages/ProductEdition/ProductEdition.stories.js +0 -106
  90. package/src/components/pages/ProductEdition/ProductEditionView.jsx +0 -1142
  91. package/src/components/pages/ProductEdition/ServiceHeader.jsx +0 -104
  92. package/src/components/pages/ProductEdition/api.js +0 -84
  93. package/src/components/pages/ProductEdition/index.js +0 -21
  94. package/src/components/pages/ProductEdition/permissions.js +0 -128
  95. package/src/components/pages/ProductEdition/permissions.test.js +0 -249
  96. package/src/components/pages/ProductEdition/sections/CatalogServicePanel.jsx +0 -123
  97. package/src/components/pages/ProductEdition/sections/EditionTopBar.jsx +0 -134
  98. package/src/components/pages/ProductEdition/sections/ImagePanel.jsx +0 -342
  99. package/src/components/pages/ProductEdition/sections/ServiceTeam.jsx +0 -184
  100. package/src/components/pages/ProductEdition/sections/ServiceTools.jsx +0 -134
  101. package/src/components/pages/ProductEdition/services.js +0 -187
  102. package/src/components/pages/ProductEdition/services.test.js +0 -88
@@ -11,18 +11,18 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
11
11
 
12
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
13
 
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
15
+
14
16
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));
15
17
 
18
+ var _objectSpread5 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
19
+
16
20
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
17
21
 
18
22
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
19
23
 
20
24
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
21
25
 
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
23
-
24
- var _objectSpread6 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
25
-
26
26
  var _react = require("react");
27
27
 
28
28
  var _axios = _interopRequireDefault(require("axios"));
@@ -117,8 +117,6 @@ var _AiProductEdition = require("../../../contexts/AiProductEdition");
117
117
 
118
118
  var _ChangeStatusModal = _interopRequireDefault(require("../../organisms/ChangeStatusModal"));
119
119
 
120
- var _ServicesWorkspace = _interopRequireDefault(require("../../organisms/ServicesWorkspace"));
121
-
122
120
  var _material = require("@mui/material");
123
121
 
124
122
  var _jsxRuntime = require("react/jsx-runtime");
@@ -141,17 +139,11 @@ function obtenerDuracionVideoBase64(base64Data) {
141
139
  video.addEventListener("error", reject);
142
140
  });
143
141
  }
144
- /** Pestaña con todos los servicios del producto (ver organisms/ServicesWorkspace). */
145
-
146
-
147
- var SERVICES_TAB = "Servicios";
148
142
 
149
143
  var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
150
- var _state$product$id_art, _state$product, _state$product11, _family$variants, _state$product12, _state$product16, _state$errors, _pendingPropagation$k, _family$variants2, _variantGroup$members3, _variantGroup$group, _state$product20, _state$product21, _state$product22, _state$active_retaile7, _state$product23, _state$product24, _state$product25, _variantGroup$group2, _location$state, _location$state2, _state$active_retaile8, _state$active_retaile9, _state$images_values$2, _state$images_values10, _state$images_values11, _state$images_values12, _state$images_values13, _state$product26, _state$active_retaile10, _family$variants3, _family$variants4, _variantGroup$members4, _variantGroup$members5, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile11, _state$active_retaile12, _state$active_retaile13, _state$product$catego, _state$product32, _state$product33, _state$services3, _state$services3$data, _state$product34, _state$product35, _state$datasheets_inp, _state$datasheets_inp2, _state$product36, _state$images_values$3, _state$images_values14, _state$images_values15, _state$images_values16, _state$images_values17, _state$comment;
144
+ var _state$product$id_art, _state$product, _state$product11, _family$variants, _state$product12, _state$product16, _state$errors, _pendingPropagation$k, _family$variants2, _variantGroup$members3, _variantGroup$group, _state$product20, _state$product21, _state$product22, _state$active_retaile7, _state$product23, _state$product24, _state$product25, _variantGroup$group2, _location$state, _location$state2, _state$active_retaile8, _state$active_retaile9, _state$images_values$2, _state$images_values10, _state$images_values11, _state$images_values12, _state$images_values13, _state$product26, _state$active_retaile10, _family$variants3, _family$variants4, _variantGroup$members4, _variantGroup$members5, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile11, _state$active_retaile12, _state$active_retaile13, _state$product32, _state$services3, _state$services3$data, _state$product33, _state$product34, _state$datasheets_inp, _state$datasheets_inp2, _state$product35, _state$images_values$3, _state$images_values14, _state$images_values15, _state$images_values16, _state$images_values17, _state$comment;
151
145
 
152
146
  var tabsSections = _ref.tabsSections,
153
- _ref$showServicesTab = _ref.showServicesTab,
154
- showServicesTab = _ref$showServicesTab === void 0 ? false : _ref$showServicesTab,
155
147
  _ref$productSelected = _ref.productSelected,
156
148
  productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
157
149
  _ref$user = _ref.user,
@@ -174,10 +166,6 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
174
166
  createComment = _useProviderProductEd.createComment;
175
167
 
176
168
  var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
177
- var tabs = (0, _react.useMemo)(function () {
178
- return showServicesTab ? (0, _objectSpread6.default)((0, _objectSpread6.default)({}, tabsSections), {}, (0, _defineProperty2.default)({}, SERVICES_TAB, false)) : tabsSections;
179
- }, [tabsSections, showServicesTab]);
180
- var isServicesTab = state.active_tab === SERVICES_TAB;
181
169
 
182
170
  var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
183
171
  _useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
@@ -914,7 +902,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
914
902
  // para no reventar en Object.values(undefined).
915
903
 
916
904
  retailerDatasheets = (_services$ = services[0]) === null || _services$ === void 0 ? void 0 : _services$[id_retailer];
917
- datasheetsActiveRetailer = (0, _objectSpread6.default)((0, _objectSpread6.default)({}, retailerDatasheets), {}, {
905
+ datasheetsActiveRetailer = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, retailerDatasheets), {}, {
918
906
  data: Object.values((_retailerDatasheets$d = retailerDatasheets === null || retailerDatasheets === void 0 ? void 0 : retailerDatasheets.data) !== null && _retailerDatasheets$d !== void 0 ? _retailerDatasheets$d : {})
919
907
  });
920
908
  descriptionsActiveRetailer = services[1].filter(function (item) {
@@ -943,7 +931,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
943
931
  payload: {
944
932
  datasheets: services[0],
945
933
  descriptions: services[1],
946
- images: (0, _objectSpread6.default)((0, _objectSpread6.default)({}, services[2]), {}, {
934
+ images: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
947
935
  values: orderedValues
948
936
  })
949
937
  }
@@ -979,7 +967,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
979
967
  });
980
968
  dispatch({
981
969
  type: "SET_IMAGES_VALUES",
982
- payload: (0, _objectSpread6.default)((0, _objectSpread6.default)({}, services[2]), {}, {
970
+ payload: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
983
971
  values: filteredValues
984
972
  })
985
973
  });
@@ -1413,10 +1401,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1413
1401
  var _state$product$varian, _state$product13, _updatedProduct$varia;
1414
1402
 
1415
1403
  if (!result) return;
1416
- var updatedProduct = result.mode === "self" ? (0, _objectSpread6.default)((0, _objectSpread6.default)({}, state.product), {}, {
1404
+ var updatedProduct = result.mode === "self" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1417
1405
  parentArticleId: null,
1418
1406
  variantsCount: 0
1419
- }) : (0, _objectSpread6.default)((0, _objectSpread6.default)({}, state.product), {}, {
1407
+ }) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1420
1408
  variantsCount: Math.max(((_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 : 1) - 1, 0)
1421
1409
  });
1422
1410
  dispatch({
@@ -1434,7 +1422,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1434
1422
  if (guardado) {
1435
1423
  var _updatedProduct$paren;
1436
1424
 
1437
- sessionStorage.setItem("productSelected", JSON.stringify((0, _objectSpread6.default)((0, _objectSpread6.default)({}, guardado), {}, {
1425
+ sessionStorage.setItem("productSelected", JSON.stringify((0, _objectSpread5.default)((0, _objectSpread5.default)({}, guardado), {}, {
1438
1426
  variantsCount: updatedProduct.variantsCount,
1439
1427
  parentArticleId: (_updatedProduct$paren = updatedProduct.parentArticleId) !== null && _updatedProduct$paren !== void 0 ? _updatedProduct$paren : null
1440
1428
  })));
@@ -1689,9 +1677,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1689
1677
  var _state$product$varian2, _state$product18, _result$linked, _result$parentArticle;
1690
1678
 
1691
1679
  if (!result) return;
1692
- var updatedProduct = result.mode === "children" ? (0, _objectSpread6.default)((0, _objectSpread6.default)({}, state.product), {}, {
1680
+ var updatedProduct = result.mode === "children" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1693
1681
  variantsCount: ((_state$product$varian2 = (_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.variantsCount) !== null && _state$product$varian2 !== void 0 ? _state$product$varian2 : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
1694
- }) : (0, _objectSpread6.default)((0, _objectSpread6.default)({}, state.product), {}, {
1682
+ }) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1695
1683
  parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
1696
1684
  variantsCount: 0
1697
1685
  });
@@ -1718,7 +1706,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1718
1706
  if (guardado) {
1719
1707
  var _updatedProduct$paren2;
1720
1708
 
1721
- sessionStorage.setItem("productSelected", JSON.stringify((0, _objectSpread6.default)((0, _objectSpread6.default)({}, guardado), {}, {
1709
+ sessionStorage.setItem("productSelected", JSON.stringify((0, _objectSpread5.default)((0, _objectSpread5.default)({}, guardado), {}, {
1722
1710
  variantsCount: updatedProduct.variantsCount,
1723
1711
  parentArticleId: (_updatedProduct$paren2 = updatedProduct.parentArticleId) !== null && _updatedProduct$paren2 !== void 0 ? _updatedProduct$paren2 : null
1724
1712
  })));
@@ -1789,7 +1777,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1789
1777
  esDescripcion = kind === "description";
1790
1778
  _context11.prev = 4;
1791
1779
  _context11.next = 7;
1792
- return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread6.default)({
1780
+ return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread5.default)({
1793
1781
  articleId: state.product.id_article
1794
1782
  }, esDescripcion ? {
1795
1783
  descriptions: [Number(attributeId)]
@@ -2346,7 +2334,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2346
2334
  var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
2347
2335
  var _state$product$id_ord, _state$active_retaile6;
2348
2336
 
2349
- var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, articleStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread3, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _articleStatus, updatedStatusByRetailerForSend, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread4, productInSession, updatedProductInSession;
2337
+ var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, articleStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _articleStatus, updatedStatusByRetailerForSend, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
2350
2338
 
2351
2339
  return _regenerator.default.wrap(function _callee14$(_context14) {
2352
2340
  while (1) {
@@ -2404,11 +2392,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2404
2392
  }); // Actualizar el producto con los nuevos estados
2405
2393
 
2406
2394
  updatedStatusByRetailer = state.product.statusByRetailer.map(function (item) {
2407
- return item.retailer_id === retailerId && item.service === concept ? (0, _objectSpread6.default)((0, _objectSpread6.default)({}, item), {}, {
2395
+ return item.retailer_id === retailerId && item.service === concept ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
2408
2396
  status: serviceStatus
2409
2397
  }) : item;
2410
2398
  });
2411
- updatedProduct = (0, _objectSpread6.default)((0, _objectSpread6.default)({}, state.product), {}, {
2399
+ updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
2412
2400
  statusByRetailer: updatedStatusByRetailer,
2413
2401
  status: (0, _product.getMinorStatusFromRetailer)(updatedStatusByRetailer)
2414
2402
  });
@@ -2483,17 +2471,17 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2483
2471
 
2484
2472
  updatedStatusByRetailerForSend = state.product.statusByRetailer.map(function (item) {
2485
2473
  if (item.retailer_id === retailerId && item.service === concept) {
2486
- return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, item), {}, {
2474
+ return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
2487
2475
  status: newStatus
2488
2476
  });
2489
2477
  }
2490
2478
 
2491
2479
  return item;
2492
2480
  });
2493
- _updatedProduct = (0, _objectSpread6.default)((0, _objectSpread6.default)({}, state.product), {}, (_objectSpread3 = {}, (0, _defineProperty2.default)(_objectSpread3, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread3, "statusByRetailer", updatedStatusByRetailerForSend), (0, _defineProperty2.default)(_objectSpread3, "status", (0, _product.getMinorStatusFromRetailer)(updatedStatusByRetailerForSend)), _objectSpread3)); //Actualizamos el services_data en el servicio específico del retailer actual
2481
+ _updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, (_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread2, "statusByRetailer", updatedStatusByRetailerForSend), (0, _defineProperty2.default)(_objectSpread2, "status", (0, _product.getMinorStatusFromRetailer)(updatedStatusByRetailerForSend)), _objectSpread2)); //Actualizamos el services_data en el servicio específico del retailer actual
2494
2482
 
2495
2483
  updatedServicesData = (_state$services_data2 = state.services_data) === null || _state$services_data2 === void 0 ? void 0 : _state$services_data2.map(function (service) {
2496
- return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, service), {}, {
2484
+ return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, service), {}, {
2497
2485
  status: (service === null || service === void 0 ? void 0 : service.id_retailer) === retailerId && (service === null || service === void 0 ? void 0 : service.service) === concept ? newStatus : service === null || service === void 0 ? void 0 : service.status
2498
2486
  });
2499
2487
  });
@@ -2501,15 +2489,15 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2501
2489
 
2502
2490
  if (sessionProduct) {
2503
2491
  productInSession = JSON.parse(sessionProduct);
2504
- updatedProductInSession = (0, _objectSpread6.default)((0, _objectSpread6.default)({}, productInSession), {}, (_objectSpread4 = {}, (0, _defineProperty2.default)(_objectSpread4, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread4, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
2492
+ updatedProductInSession = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, productInSession), {}, (_objectSpread3 = {}, (0, _defineProperty2.default)(_objectSpread3, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread3, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
2505
2493
  if (item.retailer_id === retailerId && item.service === concept) {
2506
- return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, item), {}, {
2494
+ return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
2507
2495
  status: newStatus
2508
2496
  });
2509
2497
  }
2510
2498
 
2511
2499
  return item;
2512
- })), _objectSpread4));
2500
+ })), _objectSpread3));
2513
2501
  sessionStorage.setItem("productSelected", JSON.stringify(updatedProductInSession));
2514
2502
  }
2515
2503
 
@@ -2661,12 +2649,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2661
2649
  status = "".concat(result, "A"); // Actualizar el statusByRetailer para todos los retailers y conceptos
2662
2650
 
2663
2651
  updatedStatusByRetailer = state.product.statusByRetailer.map(function (item) {
2664
- return conceptArray.includes(item.service) ? (0, _objectSpread6.default)((0, _objectSpread6.default)({}, item), {}, {
2652
+ return conceptArray.includes(item.service) ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
2665
2653
  status: status
2666
2654
  }) : item;
2667
2655
  }); // Actualizar el producto con los nuevos estados
2668
2656
 
2669
- updatedProduct = (0, _objectSpread6.default)((0, _objectSpread6.default)({}, state.product), {}, {
2657
+ updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
2670
2658
  article_status: status,
2671
2659
  status: (0, _product.getMinorStatusFromRetailer)(updatedStatusByRetailer),
2672
2660
  datasheet_status: state.product.datasheet_status === "NA" ? "NA" : status,
@@ -2679,7 +2667,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2679
2667
  payload: updatedProduct
2680
2668
  });
2681
2669
  updatedServicesData = state.services_data.map(function (service) {
2682
- return conceptArray.includes(service.service) ? (0, _objectSpread6.default)((0, _objectSpread6.default)({}, service), {}, {
2670
+ return conceptArray.includes(service.service) ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, service), {}, {
2683
2671
  status: status
2684
2672
  }) : service;
2685
2673
  });
@@ -2765,7 +2753,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2765
2753
  });
2766
2754
 
2767
2755
  case 4:
2768
- updatedProduct = (0, _objectSpread6.default)((0, _objectSpread6.default)({}, state.product), {}, (0, _defineProperty2.default)({}, "id_".concat(concept, "_").concat(assignationType), assignationId));
2756
+ updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, (0, _defineProperty2.default)({}, "id_".concat(concept, "_").concat(assignationType), assignationId));
2769
2757
  dispatch({
2770
2758
  type: "SET_PRODUCT",
2771
2759
  payload: updatedProduct
@@ -3231,7 +3219,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3231
3219
  destinos = (0, _objectWithoutProperties2.default)(propagation, _excluded);
3232
3220
 
3233
3221
  if (esDescripcion) {
3234
- saveDescriptions(token, (0, _objectSpread6.default)((0, _objectSpread6.default)({}, destinos), {}, {
3222
+ saveDescriptions(token, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, destinos), {}, {
3235
3223
  descriptions: attributes
3236
3224
  }));
3237
3225
  } else {
@@ -3261,7 +3249,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3261
3249
  setVariantGroup(result);
3262
3250
  setShowGroup(true);
3263
3251
  }
3264
- }), porDesvincular && /*#__PURE__*/(0, _jsxRuntime.jsx)(_UnlinkVariantModal.UnlinkVariantModal, (0, _objectSpread6.default)((0, _objectSpread6.default)({}, porDesvincular), {}, {
3252
+ }), porDesvincular && /*#__PURE__*/(0, _jsxRuntime.jsx)(_UnlinkVariantModal.UnlinkVariantModal, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, porDesvincular), {}, {
3265
3253
  token: token,
3266
3254
  onClose: function onClose() {
3267
3255
  return setPorDesvincular(null);
@@ -3664,7 +3652,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3664
3652
  showApproveRejectAll: canShowBulkEvaluationButtons() || isAuditorAssigned() || isUserAssignedToService(),
3665
3653
  showValidationButtons: canShowSingleEvaluationButtons() && (isAuditorAssigned() || isUserAssignedToService())
3666
3654
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
3667
- tabsSections: tabs,
3655
+ tabsSections: tabsSections,
3668
3656
  status: getStatusByCurrentServiceAndRetailer(),
3669
3657
  activeTab: state.active_tab,
3670
3658
  isRetailer: isRetailer,
@@ -3699,12 +3687,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3699
3687
  className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
3700
3688
  id: "services-information-container",
3701
3689
  children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
3702
- children: [isServicesTab && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ServicesWorkspace.default, {
3703
- product: state.product,
3704
- retailers: (_state$product$catego = (_state$product32 = state.product) === null || _state$product32 === void 0 ? void 0 : _state$product32.categoryRetailerInOrder) !== null && _state$product$catego !== void 0 ? _state$product$catego : [],
3705
- canAssign: ![7, 8].includes(user.id_role),
3706
- onOpenEditor: handleOnChangeActiveTab
3707
- }), state.active_tab === "Descripción" && (((_state$product33 = state.product) === null || _state$product33 === void 0 ? void 0 : _state$product33.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
3690
+ children: [state.active_tab === "Descripción" && (((_state$product32 = state.product) === null || _state$product32 === void 0 ? void 0 : _state$product32.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
3708
3691
  activeSection: state.active_tab,
3709
3692
  inputGroup: state.descriptions_inputs[0],
3710
3693
  updatedDescriptions: state.updated_descriptions_inputs
@@ -3713,7 +3696,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3713
3696
  ,
3714
3697
  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,
3715
3698
  onRestoreInheritance: handleOnRestoreInheritance,
3716
- articleId: (_state$product34 = state.product) === null || _state$product34 === void 0 ? void 0 : _state$product34.id_article,
3699
+ articleId: (_state$product33 = state.product) === null || _state$product33 === void 0 ? void 0 : _state$product33.id_article,
3717
3700
  version: state.product.version,
3718
3701
  auditInputGroup: auditDescriptions[0],
3719
3702
  setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
@@ -3722,7 +3705,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3722
3705
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
3723
3706
  text: "No cuentas con este servicio",
3724
3707
  headerType: "input-name-header"
3725
- })), state.active_tab === "Ficha técnica" && (((_state$product35 = state.product) === null || _state$product35 === void 0 ? void 0 : _state$product35.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
3708
+ })), state.active_tab === "Ficha técnica" && (((_state$product34 = state.product) === null || _state$product34 === void 0 ? void 0 : _state$product34.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
3726
3709
  children: (_state$datasheets_inp = state.datasheets_inputs[0]) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp.data) === null || _state$datasheets_inp2 === void 0 ? void 0 : _state$datasheets_inp2.map(function (dataGroup, index) {
3727
3710
  var _state$services4, _state$services4$data;
3728
3711
 
@@ -3743,7 +3726,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3743
3726
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
3744
3727
  text: "No cuentas con este servicio",
3745
3728
  headerType: "input-name-header"
3746
- })), state.active_tab === "Imágenes" && (((_state$product36 = state.product) === null || _state$product36 === void 0 ? void 0 : _state$product36.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
3729
+ })), state.active_tab === "Imágenes" && (((_state$product35 = state.product) === null || _state$product35 === void 0 ? void 0 : _state$product35.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
3747
3730
  children: [enableDigitalAssets && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryTrayTabs.GalleryTrayTabs, {
3748
3731
  activeTray: currentTray,
3749
3732
  setActiveTray: setActiveTray,
@@ -3754,7 +3737,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3754
3737
  style: {
3755
3738
  position: "relative"
3756
3739
  },
3757
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DigitalAssetsTray.DigitalAssetsTray, (0, _objectSpread6.default)((0, _objectSpread6.default)({}, digitalAssets), {}, {
3740
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DigitalAssetsTray.DigitalAssetsTray, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, digitalAssets), {}, {
3758
3741
  unsaved: (0, _assets.countUnsavedAssets)(state),
3759
3742
  gridLayout: imageLayout,
3760
3743
  readOnly: !isAuditorAssigned() && !isUserAssignedToService(),
@@ -3774,10 +3757,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3774
3757
  style: {
3775
3758
  position: "relative"
3776
3759
  },
3777
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread6.default)((0, _objectSpread6.default)({}, getRootProps({
3760
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, getRootProps({
3778
3761
  className: "dropzone ".concat(isDragActive ? "drag-active" : "")
3779
3762
  })), {}, {
3780
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread6.default)({}, getInputProps())), isDragActive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3763
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread5.default)({}, getInputProps())), isDragActive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3781
3764
  className: "drag-overlay",
3782
3765
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
3783
3766
  children: "Suelta las im\xE1genes aqu\xED"
@@ -3827,7 +3810,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3827
3810
  headerType: "input-name-header"
3828
3811
  }))]
3829
3812
  })
3830
- }), !isServicesTab && (isUserAssignedToService(state.active_tab) || isAuditorAssigned()) && state.product["".concat((0, _utils.getConceptByTab)(state.active_tab), "_status")] !== "NS" && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3813
+ }), (isUserAssignedToService(state.active_tab) || isAuditorAssigned()) && state.product["".concat((0, _utils.getConceptByTab)(state.active_tab), "_status")] !== "NS" && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3831
3814
  className: "commentary-box",
3832
3815
  children: [!state.comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3833
3816
  className: "commentary",
@@ -3901,7 +3884,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3901
3884
 
3902
3885
  var RetailerProductEdition = function RetailerProductEdition(props) {
3903
3886
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_providerProductEdition.ProviderProductEditionProvider, {
3904
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RetailerProductEditionView, (0, _objectSpread6.default)({}, props))
3887
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RetailerProductEditionView, (0, _objectSpread5.default)({}, props))
3905
3888
  });
3906
3889
  };
3907
3890
 
@@ -128,7 +128,7 @@ var sendMessage = /*#__PURE__*/function () {
128
128
  exports.sendMessage = sendMessage;
129
129
 
130
130
  var normalizeProduct = function normalizeProduct(product) {
131
- var _ref5, _productData$parentAr, _ref6, _productData$parent, _ref7, _productData$variants, _productData$serviceS, _productData$demo_ser;
131
+ var _ref5, _productData$parentAr, _ref6, _productData$parent, _ref7, _productData$variants;
132
132
 
133
133
  // Handle case where product might be wrapped in a product property
134
134
  var productData = product.product || product;
@@ -194,11 +194,7 @@ var normalizeProduct = function normalizeProduct(product) {
194
194
  id_images_facilitator: article.id_images_facilitator || null,
195
195
  id_auditor: article.id_auditor || 0,
196
196
  statusByRetailer: productData.statusByRetailer || null,
197
- categoryRetailerInOrder: categoryRetailerInOrder || null,
198
- // Servicios para la pestaña "Servicios": estatus por servicio del listado
199
- // ligero de Creators (view=summary) y, en modo demo, los de ejemplo.
200
- serviceStatuses: (_productData$serviceS = productData.serviceStatuses) !== null && _productData$serviceS !== void 0 ? _productData$serviceS : null,
201
- demo_services: (_productData$demo_ser = productData.demo_services) !== null && _productData$demo_ser !== void 0 ? _productData$demo_ser : null
197
+ categoryRetailerInOrder: categoryRetailerInOrder || null
202
198
  };
203
199
  };
204
200
 
package/dist/index.js CHANGED
@@ -1447,19 +1447,6 @@ Object.keys(_CreatorsProductEdition).forEach(function (key) {
1447
1447
  });
1448
1448
  });
1449
1449
 
1450
- var _ProductEdition = require("./components/pages/ProductEdition");
1451
-
1452
- Object.keys(_ProductEdition).forEach(function (key) {
1453
- if (key === "default" || key === "__esModule") return;
1454
- if (key in exports && exports[key] === _ProductEdition[key]) return;
1455
- Object.defineProperty(exports, key, {
1456
- enumerable: true,
1457
- get: function get() {
1458
- return _ProductEdition[key];
1459
- }
1460
- });
1461
- });
1462
-
1463
1450
  var _ProviderProductEdition = require("./components/pages/ProviderProductEdition");
1464
1451
 
1465
1452
  Object.keys(_ProviderProductEdition).forEach(function (key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.6.61",
3
+ "version": "21.6.63",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -1,8 +1,8 @@
1
1
  import { Container } from "./styles";
2
2
 
3
- export const MetricCard = ({ label, number }) => {
3
+ export const MetricCard = ({ label, number, hint }) => {
4
4
  return (
5
- <Container>
5
+ <Container title={hint}>
6
6
  <p>{label}</p>
7
7
  <p>{number}</p>
8
8
  </Container>
@@ -26,3 +26,14 @@ DashboardMetricDefault.args = {
26
26
  RP: 49,
27
27
  },
28
28
  };
29
+
30
+ export const DashboardMetricDoughnut = Template.bind({});
31
+ DashboardMetricDoughnut.args = {
32
+ ...DashboardMetricDefault.args,
33
+ type: "doughnut",
34
+ displayLegend: true,
35
+ showPercent: true,
36
+ displayScale: false,
37
+ total: 1610,
38
+ totalFiltered: 1610,
39
+ };
@@ -1,3 +1,4 @@
1
+ import { useEffect, useState } from "react";
1
2
  import { Container } from "./styles";
2
3
  import { Graphic } from "../../atoms/Graphic";
3
4
  import {
@@ -20,6 +21,17 @@ export const DashboardMetric = ({
20
21
  total,
21
22
  totalFiltered,
22
23
  }) => {
24
+ // Chart.js coloca la leyenda por opción, no por CSS: en pantallas angostas
25
+ // va abajo, porque a un lado deja la gráfica en nada.
26
+ const [isNarrow, setIsNarrow] = useState(false);
27
+ useEffect(() => {
28
+ const media = window.matchMedia("(max-width: 600px)");
29
+ const update = () => setIsNarrow(media.matches);
30
+ update();
31
+ media.addEventListener("change", update);
32
+ return () => media.removeEventListener("change", update);
33
+ }, []);
34
+
23
35
  const labels =
24
36
  type === "doughnut"
25
37
  ? Object.entries(dataObject).map(
@@ -75,7 +87,7 @@ export const DashboardMetric = ({
75
87
  },
76
88
  },
77
89
  legend: {
78
- position: "right",
90
+ position: isNarrow ? "bottom" : "right",
79
91
  display: displayLegend,
80
92
  labels: {
81
93
  usePointStyle: true,
@@ -7,6 +7,19 @@ export const Container = styled.div`
7
7
  padding: 24px;
8
8
  position: relative;
9
9
 
10
+ @media (max-width: 600px) {
11
+ padding: 12px;
12
+
13
+ .graphic-cotainer {
14
+ padding: 5px;
15
+ }
16
+
17
+ /* Va rotada y fuera del recuadro; con el padding chico se encima. */
18
+ > p.y-label {
19
+ display: none;
20
+ }
21
+ }
22
+
10
23
  .text-container {
11
24
  p {
12
25
  font-family: ${FontFamily.Raleway};
@@ -67,6 +67,8 @@ export const CreatorsProductEditionView = ({
67
67
  isRetailer,
68
68
  digitalAssets,
69
69
  currentTray,
70
+ hasImagesService,
71
+ canEditAssets,
70
72
  assetsLoadedFor,
71
73
  handleOnSetSelectedAssets,
72
74
  handleOnSetAllAssetsChecked,
@@ -635,7 +637,14 @@ export const CreatorsProductEditionView = ({
635
637
  : handleOnDownloadImages
636
638
  }
637
639
  askToDeleteImages={handleOnAskToDeleteImages}
638
- showSaveButton={isAuditorAssigned() || isUserAssignedToService()}
640
+ // En la bandeja de activos el permiso es el de los activos: sin
641
+ // servicio de imágenes nadie está asignado a él y el botón de
642
+ // guardar desaparecería justo donde sí hay algo que guardar.
643
+ showSaveButton={
644
+ currentTray === TRAYS.ASSETS
645
+ ? canEditAssets()
646
+ : isAuditorAssigned() || isUserAssignedToService()
647
+ }
639
648
  onClickSave={handleOnClickSave}
640
649
  // validations
641
650
  canAssign={![7, 8].includes(user.id_role)}
@@ -699,13 +708,19 @@ export const CreatorsProductEditionView = ({
699
708
  ) : (
700
709
  <NoService />
701
710
  ))}
711
+ {/*
712
+ Los activos digitales no son parte del servicio de
713
+ imágenes: su bandeja sigue disponible aunque el producto no
714
+ tenga ese servicio contratado.
715
+ */}
702
716
  {state.active_tab === "Imágenes" &&
703
- (state.product?.images_status !== "NS" ? (
717
+ (hasImagesService || enableDigitalAssets ? (
704
718
  <ImagesSection
705
719
  imagesValues={state.images_values}
706
720
  selectedImages={state.selected_images}
707
721
  imageLayout={imageLayout}
708
722
  enableDigitalAssets={enableDigitalAssets}
723
+ hasImagesService={hasImagesService}
709
724
  currentTray={currentTray}
710
725
  setActiveTray={setActiveTray}
711
726
  digitalAssets={digitalAssets}
@@ -713,7 +728,11 @@ export const CreatorsProductEditionView = ({
713
728
  selectedAssets={state.selected_assets}
714
729
  setSelectedAssets={handleOnSetSelectedAssets}
715
730
  setAllAssetsChecked={handleOnSetAllAssetsChecked}
716
- canEdit={isAuditorAssigned() || isUserAssignedToService()}
731
+ canEdit={
732
+ currentTray === TRAYS.ASSETS
733
+ ? canEditAssets()
734
+ : isAuditorAssigned() || isUserAssignedToService()
735
+ }
717
736
  setCheckAll={handleOnSetCheckAll}
718
737
  setSelectedImages={handleOnSetSelectedImages}
719
738
  onChangeCurrentImage={handleOnChangeCurrentImage}
@@ -253,7 +253,18 @@ export const useCreatorsProductEdition = ({
253
253
  onUploaded: (uploaded) => registerUploadedAssets(token, uploaded),
254
254
  });
255
255
  const [activeTray, setActiveTray] = useState(TRAYS.IMAGES);
256
- const currentTray = enableDigitalAssets ? activeTray : TRAYS.IMAGES;
256
+
257
+ /*
258
+ Los activos digitales no pertenecen al servicio de imágenes: se suben
259
+ aunque el producto no lo tenga contratado. Sin ese servicio solo queda su
260
+ bandeja, así que la vista abre directamente en ella.
261
+ */
262
+ const hasImagesService = state.product?.images_status !== "NS";
263
+ const currentTray = !enableDigitalAssets
264
+ ? TRAYS.IMAGES
265
+ : hasImagesService
266
+ ? activeTray
267
+ : TRAYS.ASSETS;
257
268
 
258
269
  /*
259
270
  De qué artículo se cargaron ya los activos.
@@ -704,6 +715,28 @@ export const useCreatorsProductEdition = ({
704
715
  return isAssigned && validUser;
705
716
  };
706
717
 
718
+ /*
719
+ Permiso sobre la bandeja de activos digitales.
720
+
721
+ No son parte del servicio de imágenes, así que no pueden depender de estar
722
+ asignado a él: sin ese servicio nadie lo está y la bandeja quedaría de solo
723
+ lectura. En ese caso vale la asignación a cualquier otro servicio del
724
+ producto.
725
+ */
726
+ const canEditAssets = () => {
727
+ if (isAuditorAssigned() || isUserAssignedToService()) return true;
728
+ if (hasImagesService) return false;
729
+
730
+ const allowedRoles = [1, 4, 5, 6, 7, 8];
731
+ if (!allowedRoles.includes(user?.id_role)) return false;
732
+
733
+ return ["description", "datasheet"].some(
734
+ (concept) =>
735
+ isAssignedAs("especialist", concept) ||
736
+ isAssignedAs("facilitator", concept),
737
+ );
738
+ };
739
+
707
740
  const canShowSingleEvaluationButtons = (action) => {
708
741
  let concept = getConceptByTab(action || state.active_tab);
709
742
 
@@ -2105,6 +2138,8 @@ export const useCreatorsProductEdition = ({
2105
2138
  isRetailer,
2106
2139
  digitalAssets,
2107
2140
  currentTray,
2141
+ hasImagesService,
2142
+ canEditAssets,
2108
2143
  assetsLoadedFor,
2109
2144
  handleOnSetSelectedAssets,
2110
2145
  handleOnSetAllAssetsChecked,
@@ -190,13 +190,21 @@ const buildFamily = (familia) => {
190
190
  /**
191
191
  * Crea las respuestas.
192
192
  * - `images: false` simula un producto sin imágenes.
193
+ * - `imagesService: false` simula un producto sin el servicio de imágenes
194
+ * contratado: sin su renglón en los servicios, el estatus queda en "NS".
193
195
  * - `delSolStatus` cambia el estatus de los tres servicios de Del Sol; con
194
196
  * "AC" el auditor asignado puede validar o rechazar.
195
197
  * - `familia`: "padre" (este producto con dos hijos) o "hijo" (este producto
196
198
  * es hijo de otro, con un hermano).
197
199
  * - `grupo`: el producto está en un grupo de variantes con otros dos.
198
200
  */
199
- export const buildFixtures = ({ images = true, delSolStatus, familia, grupo = false } = {}) => ({
201
+ export const buildFixtures = ({
202
+ images = true,
203
+ imagesService = true,
204
+ delSolStatus,
205
+ familia,
206
+ grupo = false,
207
+ } = {}) => ({
200
208
  comments: {
201
209
  description: lambda({ message: "OK", data: [comment(15886, "description", "Revisar la longitud del header.")], order: null }),
202
210
  datasheet: lambda({ message: "OK", data: [comment(15885, "datasheet", "Rechazo")], order: null }),
@@ -269,10 +277,14 @@ export const buildFixtures = ({ images = true, delSolStatus, familia, grupo = fa
269
277
  data: [
270
278
  service(36, "datasheet", "RA/AS", 2),
271
279
  service(36, "description", "RA/AS", 2),
272
- service(36, "images", "AA", 5),
273
280
  service(38, "datasheet", delSolStatus ?? "RA/AS", 2),
274
281
  service(38, "description", delSolStatus ?? "RA/AS", 2),
275
- service(38, "images", delSolStatus ?? "AA", 5),
282
+ ...(imagesService
283
+ ? [
284
+ service(36, "images", "AA", 5),
285
+ service(38, "images", delSolStatus ?? "AA", 5),
286
+ ]
287
+ : []),
276
288
  ],
277
289
  }),
278
290
  percentages: lambda([