contentoh-components-library 21.6.49 → 21.6.50

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 (90) hide show
  1. package/.claude/launch.json +14 -0
  2. package/.env.test +1 -0
  3. package/dist/ai/prompts/attribute.prompt.js +28 -0
  4. package/dist/ai/prompts/description.prompt.js +33 -0
  5. package/dist/ai/schemas/attribute.schema.js +35 -0
  6. package/dist/ai/schemas/description.schema.js +27 -0
  7. package/dist/components/atoms/AssetPreview/AssetPreview.stories.js +118 -0
  8. package/dist/components/atoms/AssetPreview/index.js +150 -0
  9. package/dist/components/atoms/AssetPreview/styles.js +28 -0
  10. package/dist/components/atoms/IconFile/index.js +85 -2
  11. package/dist/components/atoms/IconFile/styles.js +1 -1
  12. package/dist/components/atoms/ProductImage/ProductImage.stories.js +70 -2
  13. package/dist/components/atoms/ProductImage/index.js +100 -27
  14. package/dist/components/atoms/ProductImage/styles.js +3 -1
  15. package/dist/components/molecules/EditionActiveImage/index.js +4 -2
  16. package/dist/components/molecules/GalleryAssetElement/GalleryAssetElement.stories.js +147 -0
  17. package/dist/components/molecules/GalleryAssetElement/index.js +178 -0
  18. package/dist/components/molecules/GalleryAssetElement/styles.js +26 -0
  19. package/dist/components/molecules/GalleryElement/index.js +13 -4
  20. package/dist/components/molecules/GalleryHeader/index.js +96 -24
  21. package/dist/components/molecules/GalleryHeader/styles.js +4 -1
  22. package/dist/components/molecules/GalleryTrayTabs/GalleryTrayTabs.stories.js +56 -0
  23. package/dist/components/molecules/GalleryTrayTabs/index.js +60 -0
  24. package/dist/components/molecules/GalleryTrayTabs/styles.js +20 -0
  25. package/dist/components/molecules/ImageSelector/index.js +1 -0
  26. package/dist/components/organisms/DigitalAssetsTray/DigitalAssetsTray.stories.js +171 -0
  27. package/dist/components/organisms/DigitalAssetsTray/index.js +211 -0
  28. package/dist/components/organisms/DigitalAssetsTray/styles.js +22 -0
  29. package/dist/components/organisms/ImagePreviewer/index.js +1 -0
  30. package/dist/components/organisms/ProductImageModal/index.js +3 -2
  31. package/dist/components/organisms/PropagateChangesModal/index.js +12 -1
  32. package/dist/components/organisms/PropagateChangesModal/non-propagable.js +45 -0
  33. package/dist/components/pages/ProviderProductEdition/index.js +11 -1
  34. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +330 -15
  35. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +12 -2
  36. package/dist/components/pages/RetailerProductEdition/index.js +605 -414
  37. package/dist/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +1 -0
  38. package/dist/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +45 -145
  39. package/dist/global-files/data.js +16 -3
  40. package/dist/global-files/digital-assets/assetTypes.js +480 -0
  41. package/dist/global-files/digital-assets/assets.actions.js +64 -0
  42. package/dist/global-files/digital-assets/assets.adapter.js +304 -0
  43. package/dist/global-files/digital-assets/assets.mock.js +136 -0
  44. package/dist/global-files/digital-assets/assets.reducer.js +220 -0
  45. package/dist/global-files/digital-assets/uploadAssets.js +179 -0
  46. package/dist/global-files/digital-assets/useDigitalAssets.js +522 -0
  47. package/dist/index.js +142 -90
  48. package/docs/activos-digitales.md +273 -0
  49. package/package.json +1 -1
  50. package/src/components/atoms/AssetPreview/AssetPreview.stories.js +78 -0
  51. package/src/components/atoms/AssetPreview/index.js +119 -0
  52. package/src/components/atoms/AssetPreview/styles.js +190 -0
  53. package/src/components/atoms/IconFile/index.js +28 -1
  54. package/src/components/atoms/IconFile/styles.js +8 -0
  55. package/src/components/atoms/ProductImage/ProductImage.stories.js +38 -0
  56. package/src/components/atoms/ProductImage/index.js +95 -20
  57. package/src/components/atoms/ProductImage/styles.js +92 -7
  58. package/src/components/molecules/EditionActiveImage/index.js +2 -2
  59. package/src/components/molecules/GalleryAssetElement/GalleryAssetElement.stories.js +102 -0
  60. package/src/components/molecules/GalleryAssetElement/index.js +162 -0
  61. package/src/components/molecules/GalleryAssetElement/styles.js +159 -0
  62. package/src/components/molecules/GalleryElement/index.js +9 -0
  63. package/src/components/molecules/GalleryHeader/index.js +65 -13
  64. package/src/components/molecules/GalleryHeader/styles.js +2 -1
  65. package/src/components/molecules/GalleryTrayTabs/GalleryTrayTabs.stories.js +32 -0
  66. package/src/components/molecules/GalleryTrayTabs/index.js +41 -0
  67. package/src/components/molecules/GalleryTrayTabs/styles.js +52 -0
  68. package/src/components/molecules/ImageSelector/index.js +1 -0
  69. package/src/components/organisms/DigitalAssetsTray/DigitalAssetsTray.stories.js +101 -0
  70. package/src/components/organisms/DigitalAssetsTray/index.js +189 -0
  71. package/src/components/organisms/DigitalAssetsTray/styles.js +183 -0
  72. package/src/components/organisms/ImagePreviewer/index.js +1 -0
  73. package/src/components/organisms/ProductImageModal/index.js +1 -0
  74. package/src/components/organisms/PropagateChangesModal/index.js +11 -1
  75. package/src/components/organisms/PropagateChangesModal/non-propagable.js +29 -0
  76. package/src/components/pages/ProviderProductEdition/index.js +10 -1
  77. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +201 -0
  78. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +12 -0
  79. package/src/components/pages/RetailerProductEdition/index.js +366 -140
  80. package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +1 -0
  81. package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +51 -104
  82. package/src/global-files/data.js +17 -2
  83. package/src/global-files/digital-assets/assetTypes.js +419 -0
  84. package/src/global-files/digital-assets/assets.actions.js +50 -0
  85. package/src/global-files/digital-assets/assets.adapter.js +229 -0
  86. package/src/global-files/digital-assets/assets.mock.js +122 -0
  87. package/src/global-files/digital-assets/assets.reducer.js +197 -0
  88. package/src/global-files/digital-assets/uploadAssets.js +109 -0
  89. package/src/global-files/digital-assets/useDigitalAssets.js +329 -0
  90. package/src/index.js +4 -0
@@ -31,6 +31,7 @@ ImageEditor.args = {
31
31
  "Ficha técnica": false,
32
32
  Imágenes: true
33
33
  },
34
+ enableDig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g2UP3H5gzcbcuxgtjNuyhqaXGnoCBsPhu6SOAwWLEu1pZMty88OFteEWEdxJxCbzKaj8IomT8U4Tjiti4tshMkXRnxHBqAkGzLDu3ypbG4S31CR7RgDxRIVqntw",
35
35
  productSelected: {
36
- orderId: 10424,
37
- status: "CA",
38
- datasheet_status: "CA",
39
- prio: "none",
40
- version: 3,
41
- description_status: "CA",
42
- images_status: "CA",
43
- brand: "Marca",
44
- retailerOrder: 0,
45
- missing: {
46
- datasheet: null,
47
- descriptions: null,
48
- images: null
49
- },
36
+ articleId: 140554,
50
37
  services: {
51
- datasheets: 1,
52
- descriptions: 1,
38
+ datasheets: 0,
39
+ descriptions: 0,
53
40
  images: 1
54
41
  },
42
+ orderId: 9981,
43
+ city: "CDMX",
44
+ status: "AA",
45
+ datasheet_status: "NS",
46
+ prio: "none",
47
+ version: 5,
48
+ description_status: "NS",
49
+ images_status: "AA",
50
+ statusByRetailer: [{
51
+ status: "AA",
52
+ service: "images",
53
+ retailer_id: 17,
54
+ task_user_group_id: 5
55
+ }],
55
56
  article: {
56
- category: "Categoría Genérica Rappi|Categoría Genérica|Categoría Genérica",
57
- company_name: "Walmart SA de CV",
57
+ id_article: 140554,
58
+ id_category: 264,
59
+ brand: null,
60
+ name: "AOX RI Suplemento alimenticio 30 caps de 600 mg c/u",
61
+ upc: "123456789",
62
+ sku: "123456789",
63
+ timestamp: "2025-06-12T00:02:27.000Z",
64
+ active: 1,
65
+ company_id: 1541,
66
+ company_name: "Uniq Balance",
58
67
  country: "México",
59
- id_category: "4911",
60
- id_datasheet_especialist: 426,
68
+ id_order: 9981,
69
+ id_datasheet_especialist: null,
61
70
  id_datasheet_facilitator: null,
62
- id_description_especialist: 426,
71
+ id_description_especialist: null,
63
72
  id_description_facilitator: null,
64
- id_images_especialist: 427,
73
+ id_images_especialist: null,
65
74
  id_images_facilitator: null,
66
- id_order: 10424,
67
- id_article: 144832,
68
- id_auditor: 425,
69
- name: "Copia prod cadenas 1",
70
- timestamp: "2025-11-16T00:32:13.000Z",
71
- upc: "100023",
72
- sku: "900006",
75
+ id_auditor: null,
76
+ id_recepcionist: null,
77
+ category: "Farmacia|Farmacia OTC|Suplementos Alimenticios",
73
78
  categoryRetailer: [{
74
- id_category: 3431,
75
- id_retailer: 24,
76
- category_name: "Abarrotes Básicos Alsuper|Abarrotes Básicos|Abarrotes Básicos",
77
- retailer_name: "Alsuper"
78
- }, {
79
- id_category: 3435,
80
- id_retailer: 21,
81
- category_name: "Bebés Cuidado e Higiene|Bebés Cuidado e Higiene|Bebés Cuidado e Higiene",
82
- retailer_name: "Anicetos"
83
- }, {
84
- id_category: 3438,
85
- id_retailer: 1008,
86
- category_name: "Categoría Genérica App Olímpica|Categoría Genérica|Categoría Genérica",
87
- retailer_name: "App Olímpica"
88
- }, {
89
- id_category: 3439,
90
- id_retailer: 2004,
91
- category_name: "Categoría Genérica Automercado|Categoría Genérica Automercado|Categoría Genérica Automercado",
92
- retailer_name: "Automercado"
93
- }, {
94
- id_category: 4774,
95
- id_retailer: 1032,
96
- category_name: "Categoría Genérica IMPIRA Colombia|Categoría Genérica|Categoría Genérica",
97
- retailer_name: "IMPIRA Colombia"
98
- }, {
99
- id_category: 4911,
100
- id_retailer: 16,
101
- category_name: "Categoría Genérica Rappi|Categoría Genérica|Categoría Genérica",
102
- retailer_name: "Rappi"
103
- }, {
104
- id_category: 6103,
105
- id_retailer: 9,
106
- category_name: "Alimentos y Bebidas|Amazon Súper|Abarrotes",
107
- retailer_name: "Amazon"
108
- }, {
109
- id_category: 6792,
110
- id_retailer: 32,
111
- category_name: "Categoría Salud y Belleza Coppel|Categoría Salud y Belleza|Categoría Salud y Belleza",
112
- retailer_name: "Coppel"
113
- }, {
114
- id_category: 7008,
115
- id_retailer: 3,
116
- category_name: "Bebés|Accesorios para Bebés|Accesorios para Bebés",
117
- retailer_name: "Sam´s Club"
79
+ id_category: 264,
80
+ id_retailer: 17,
81
+ category_name: "Farmacia|Farmacia OTC|Suplementos Alimenticios",
82
+ retailer_name: "Genérico"
118
83
  }]
119
84
  },
120
85
  retailers: [{
121
- id: 3,
122
- name: "Sam´s Club"
123
- }, {
124
- id: 16,
125
- name: "Rappi"
126
- }, {
127
- id: 32,
128
- name: "Coppel"
129
- }, {
130
- id: 1008,
131
- name: "App Olímpica"
86
+ id: 17,
87
+ name: "Genérico"
132
88
  }],
133
- statusByRetailer: [{
134
- status: "RA/AS",
135
- service: "datasheet",
136
- retailer_id: 3
137
- }, {
138
- status: "RA/AS",
139
- service: "description",
140
- retailer_id: 3
141
- }, {
142
- status: "AA",
143
- service: "images",
144
- retailer_id: 3
145
- }, {
146
- status: "AC",
147
- service: "datasheet",
148
- retailer_id: 16
149
- }, {
150
- status: "AC",
151
- service: "description",
152
- retailer_id: 16
153
- }, {
154
- status: "AC",
155
- service: "images",
156
- retailer_id: 16
157
- }, {
158
- status: "AC",
159
- service: "datasheet",
160
- retailer_id: 32
161
- }, {
162
- status: "AC",
163
- service: "description",
164
- retailer_id: 32
165
- }, {
166
- status: "AC",
167
- service: "images",
168
- retailer_id: 32
169
- }, {
170
- status: "PA",
171
- service: "datasheet",
172
- retailer_id: 1032
173
- }, {
174
- status: "PA",
175
- service: "description",
176
- retailer_id: 1032
177
- }, {
178
- status: "PA",
179
- service: "images",
180
- retailer_id: 1032
181
- }, {
182
- status: "PA",
183
- service: "datasheet",
184
- retailer_id: 2004
185
- }, {
186
- status: "PA",
187
- service: "description",
188
- retailer_id: 2004
189
- }, {
190
- status: "PA",
191
- service: "images",
192
- retailer_id: 2004
193
- }]
89
+ variantsCount: 0,
90
+ parent: null,
91
+ parentArticleId: null,
92
+ country: "México",
93
+ upc: "123456789"
194
94
  },
195
95
  user: {
196
96
  id_user: 426,
@@ -107,7 +107,7 @@ var getImage = function getImage(imageGeneral) {
107
107
  var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 250;
108
108
 
109
109
  try {
110
- var _imageGeneral$image_i;
110
+ var _imageGeneral$image_i, _ext;
111
111
 
112
112
  // `id_image` es el nombre de la columna en base de datos; `image_id` el que
113
113
  // usa el front. Se acepta cualquiera de los dos para que la URL se arme
@@ -117,14 +117,27 @@ var getImage = function getImage(imageGeneral) {
117
117
  });
118
118
  var ext = image.src.split(".");
119
119
  var uuid = ext[0].split("-");
120
+ var extension = (_ext = ext[ext.length - 1]) === null || _ext === void 0 ? void 0 : _ext.toLowerCase();
121
+ /*
122
+ El redimensionador de CloudFront reprocesa el archivo con sharp: sirve
123
+ para una foto de producto y destruye todo lo demás. Un mp4 devuelve un
124
+ error que la etiqueta <video> no puede reproducir, y un gif animado sale
125
+ aplanado a un solo fotograma.
126
+ Por eso solo los formatos que sharp sabe redimensionar pasan por el
127
+ resizer; el resto se queda con la URL directa a S3, que es la misma que
128
+ usa la descarga de imágenes. Sin esto hacía falta bajar cada video
129
+ completo a base64 solo para generarle una miniatura.
130
+ */
131
+
132
+ var isResizable = ["jpg", "jpeg", "png", "webp", "tiff", "avif"].includes(extension);
120
133
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, image), {}, {
121
134
  version: image.id_version,
122
- ext: ext[ext.length - 1],
135
+ ext: extension,
123
136
  uuid: uuid.reduce(function (prevVal, currVal, idx) {
124
137
  if (idx < 2) return "";else return idx === 2 ? currVal : prevVal + "-" + currVal;
125
138
  }, "") || (0, _uuid.v4)(),
126
139
  srcDB: image.src,
127
- src: image.image_id ? "https://d24s337exbt5zr.cloudfront.net/" + _jsBase.Base64.encode(JSON.stringify({
140
+ src: image.image_id && !isResizable ? "https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(image.src) : image.image_id ? "https://d24s337exbt5zr.cloudfront.net/" + _jsBase.Base64.encode(JSON.stringify({
128
141
  bucket: process.env.REACT_APP_IMAGES_BUCKET,
129
142
  key: image.src,
130
143
  edits: {