contentoh-components-library 21.5.98 → 21.5.99

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 (63) hide show
  1. package/dist/components/atoms/GeneralButton/styles.js +1 -1
  2. package/dist/components/atoms/GeneralInput/index.js +54 -249
  3. package/dist/components/atoms/GeneralInput/styles.js +3 -7
  4. package/dist/components/atoms/InputFormatter/index.js +68 -223
  5. package/dist/components/atoms/InputFormatter/styles.js +4 -20
  6. package/dist/components/molecules/StatusAsignationInfo/index.js +1 -11
  7. package/dist/components/molecules/TabsMenu/index.js +1 -13
  8. package/dist/components/molecules/TagAndInput/index.js +24 -364
  9. package/dist/components/molecules/TagAndInput/styles.js +2 -2
  10. package/dist/components/organisms/FullProductNameHeader/index.js +22 -6
  11. package/dist/components/organisms/InputGroup/index.js +18 -22
  12. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +337 -150
  13. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +15 -15
  14. package/dist/components/pages/ProviderProductEdition/index.js +377 -413
  15. package/dist/components/pages/ProviderProductEdition/utils.js +0 -1
  16. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +211 -125
  17. package/dist/components/pages/RetailerProductEdition/index.js +2236 -1738
  18. package/dist/components/pages/RetailerProductEdition/styles.js +2 -4
  19. package/dist/components/pages/RetailerProductEdition/utils.js +2 -251
  20. package/package.json +2 -4
  21. package/src/components/atoms/GeneralButton/styles.js +0 -4
  22. package/src/components/atoms/GeneralInput/index.js +60 -241
  23. package/src/components/atoms/GeneralInput/styles.js +0 -81
  24. package/src/components/atoms/InputFormatter/index.js +51 -200
  25. package/src/components/atoms/InputFormatter/styles.js +0 -284
  26. package/src/components/molecules/StatusAsignationInfo/index.js +1 -9
  27. package/src/components/molecules/TabsMenu/index.js +0 -12
  28. package/src/components/molecules/TagAndInput/index.js +21 -294
  29. package/src/components/molecules/TagAndInput/styles.js +17 -59
  30. package/src/components/organisms/FullProductNameHeader/index.js +28 -4
  31. package/src/components/organisms/FullTabsMenu/index.js +1 -1
  32. package/src/components/organisms/InputGroup/index.js +4 -12
  33. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +202 -174
  34. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
  35. package/src/components/pages/ProviderProductEdition/index.js +418 -486
  36. package/src/components/pages/ProviderProductEdition/utils.js +2 -2
  37. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +243 -136
  38. package/src/components/pages/RetailerProductEdition/index.js +1717 -1563
  39. package/src/components/pages/RetailerProductEdition/styles.js +2 -67
  40. package/src/components/pages/RetailerProductEdition/utils.js +0 -240
  41. package/src/ai/utils/compare-strings.js +0 -45
  42. package/src/assets/images/Icons/arrow.png +0 -0
  43. package/src/assets/images/Icons/cancel.png +0 -0
  44. package/src/assets/images/Icons/ia-icon.png +0 -0
  45. package/src/assets/images/Icons/loading.svg +0 -5
  46. package/src/assets/images/Icons/reload.png +0 -0
  47. package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +0 -10
  48. package/src/components/atoms/RetailerSelector/index.js +0 -3
  49. package/src/components/atoms/RetailerSelector/styles.js +0 -0
  50. package/src/components/organisms/ChangeStatusModal/index.jsx +0 -488
  51. package/src/components/organisms/ChangeStatusModal/styles.js +0 -333
  52. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +0 -575
  53. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +0 -62
  54. package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +0 -344
  55. package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +0 -155
  56. package/src/components/pages/RetailerProductEdition/context/reducers/product.js +0 -114
  57. package/src/components/pages/RetailerProductEdition/context/reducers/system.js +0 -60
  58. package/src/components/pages/RetailerProductEdition/index_old.js +0 -1979
  59. package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +0 -101
  60. package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +0 -115
  61. package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +0 -174
  62. package/src/contexts/AiProductEdition.jsx +0 -347
  63. package/src/global-files/statusDictionary.js +0 -103
@@ -11,13 +11,11 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
11
11
 
12
12
  var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
- var _variables = require("../../../global-files/variables");
15
-
16
14
  var _templateObject;
17
15
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .action-buttons{\n display: flex;\n flex-direction: column;\n gap: 1rem;\n }\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button,\n .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n\n .required-inputs-message {\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n padding: 10px;\n display: flex;\n align-items: center;\n\n p + * {\n margin-top: 10px;\n }\n\n button {\n min-width: fit-content;\n }\n }\n }\n }\n #modal-message-box {\n width: 400px;\n height: 100px;\n }\n .container {\n width: 100%;\n height: 90%;\n .dropzone {\n height: 100%;\n width: 100%;\n position: relative;\n transition: all 0.5s ease;\n\n &.drag-active {\n background-color: rgba(", ", 0.05);\n border: 2px dashed ", ";\n border-radius: 8px;\n\n aside {\n opacity: 0.3;\n pointer-events: none;\n }\n }\n\n .drag-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(", ", 0.1);\n border-radius: 8px;\n pointer-events: none;\n z-index: 10;\n\n p {\n font-family: ", ";\n font-size: 24px;\n font-weight: 600;\n color: ", ";\n text-align: center;\n padding: 20px;\n background-color: ", ";\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n }\n }\n }\n }\n"])), function (_ref) {
16
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: calc(100% - 341px);\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button,\n .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n }\n }\n #modal-message-box {\n width: 400px;\n height: 100px;\n }\n .container {\n width: 100%;\n height: 100%;\n .dropzone {\n height: 100%;\n width: 100%;\n }\n }\n"])), function (_ref) {
19
17
  var headerTop = _ref.headerTop;
20
18
  return headerTop;
21
- }, _variables.FontFamily.AvenirNext, _variables.GlobalColors.color_gray, _variables.GlobalColors.rgb_color_pink, _variables.GlobalColors.color_pink, _variables.GlobalColors.rgb_color_pink, _variables.FontFamily.AvenirNext, _variables.GlobalColors.color_pink, _variables.GlobalColors.white);
19
+ });
22
20
 
23
21
  exports.Container = Container;
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.translateService = exports.translateConcept = exports.sendMessage = exports.normalizeProduct = exports.getStatusArrayByRole = exports.getInputsData = exports.getConceptsByRole = exports.getConceptByTab = exports.getAuditVersion = exports.createMessage = exports.calculateRequiredNull = exports.buildCollaboratorAssignations = void 0;
8
+ exports.translateService = exports.sendMessage = exports.getInputsData = exports.getAuditVersion = exports.createMessage = void 0;
9
9
 
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
 
@@ -123,253 +123,4 @@ var sendMessage = /*#__PURE__*/function () {
123
123
  };
124
124
  }();
125
125
 
126
- exports.sendMessage = sendMessage;
127
-
128
- var normalizeProduct = function normalizeProduct(product) {
129
- // Handle case where product might be wrapped in a product property
130
- var productData = product.product || product;
131
- var article = productData.article || {};
132
- var categoryRetailer = productData.categoryRetailer || article.categoryRetailer;
133
- var categoryRetailerNormalized = categoryRetailer ? categoryRetailer.map(function (rel) {
134
- return {
135
- id_retailer: rel.id_retailer || rel.retailer_id,
136
- retailer: rel.retailer_name || rel.retailerName,
137
- name: rel.retailer_name || rel.retailerName,
138
- id_category: rel.id_category,
139
- category: rel.category_name || rel.categoryName,
140
- image: "https://content-management-images.s3.amazonaws.com/retailers/".concat(rel.id_retailer || rel.retailer_id, ".png")
141
- };
142
- }) : null; // extraer los retailer_id de statusByRetailer donde task_group_id no sea nulo
143
-
144
- var retailersIdsInOrder = productData.statusByRetailer ? productData.statusByRetailer.map(function (status) {
145
- return status.retailer_id;
146
- }) : [];
147
- var categoryRetailerInOrder = categoryRetailerNormalized.filter(function (rel) {
148
- return retailersIdsInOrder.includes(rel.id_retailer);
149
- });
150
- return {
151
- id_article: productData.id_article || article.id_article || 0,
152
- upc: productData.upc || article.upc || null,
153
- sku: productData.sku || article.sku || null,
154
- name: productData.name || article.name || null,
155
- timestamp: productData.timestamp || article.timestamp || null,
156
- id_user: productData.id_user || article.id_user || null,
157
- categoryName: productData.category || article.category || null,
158
- id_category: productData.id_category || article.id_category || null,
159
- retailersAvailable: productData.retailersAvailable || null,
160
- categoryRetailer: categoryRetailerNormalized || null,
161
- percentages: productData.percentages || null,
162
- summary: productData.summary || null,
163
- version: productData.version || 0,
164
- id_order: productData.orderId || 0,
165
- status: productData.status || null,
166
- datasheet_status: productData.datasheet_status || null,
167
- description_status: productData.description_status || null,
168
- images_status: productData.images_status || null,
169
- brand: productData.brand || null,
170
- services: productData.services || null,
171
- country: article.country || null,
172
- id_company: article.company_id || null,
173
- company: article.company_name || null,
174
- id_datasheet_especialist: article.id_datasheet_especialist || 0,
175
- id_datasheet_facilitator: article.id_datasheet_facilitator || null,
176
- id_description_especialist: article.id_description_especialist || 0,
177
- id_description_facilitator: article.id_description_facilitator || null,
178
- id_images_especialist: article.id_images_especialist || 0,
179
- id_images_facilitator: article.id_images_facilitator || null,
180
- id_auditor: article.id_auditor || 0,
181
- statusByRetailer: productData.statusByRetailer || null,
182
- categoryRetailerInOrder: categoryRetailerInOrder || null
183
- };
184
- };
185
-
186
- exports.normalizeProduct = normalizeProduct;
187
- var TAB_TO_CONCEPT = {
188
- Descripción: "description",
189
- "Ficha técnica": "datasheet",
190
- Imágenes: "images"
191
- };
192
- var CONCEPT_TO_TAB = {
193
- description: "Descripción",
194
- datasheet: "Ficha técnica",
195
- images: "Imágenes"
196
- };
197
-
198
- var getConceptByTab = function getConceptByTab(tab) {
199
- return TAB_TO_CONCEPT[tab];
200
- };
201
-
202
- exports.getConceptByTab = getConceptByTab;
203
-
204
- var translateConcept = function translateConcept(concept) {
205
- return CONCEPT_TO_TAB[concept];
206
- };
207
-
208
- exports.translateConcept = translateConcept;
209
-
210
- var getStatusArrayByRole = function getStatusArrayByRole(idRole) {
211
- switch (idRole) {
212
- case 7:
213
- case 8:
214
- return ["PA", "AS", "CA", "RC", "RA", "RP", "RCA"];
215
-
216
- case 4:
217
- case 5:
218
- return ["RC", "AC", "AA", "AP", "ACA"];
219
-
220
- case 6:
221
- return ["RP", "RCA", "AC", "RA"];
222
-
223
- default:
224
- return [];
225
- }
226
- };
227
-
228
- exports.getStatusArrayByRole = getStatusArrayByRole;
229
-
230
- var getConceptsByRole = function getConceptsByRole(idRole) {
231
- switch (idRole) {
232
- case 4:
233
- return ["description", "datasheet"];
234
-
235
- case 5:
236
- return ["images"];
237
-
238
- default:
239
- return ["description", "datasheet", "images"];
240
- }
241
- };
242
-
243
- exports.getConceptsByRole = getConceptsByRole;
244
-
245
- var buildCollaboratorAssignations = function buildCollaboratorAssignations(product, users) {
246
- return {
247
- Descripción: {
248
- assignations: [{
249
- collaboratorType: "especialist",
250
- id: product.id_description_especialist
251
- }, {
252
- collaboratorType: "facilitator",
253
- id: product.id_description_facilitator
254
- }],
255
- collaborators: {
256
- especialist: users[0] || [],
257
- facilitator: users[2] || []
258
- }
259
- },
260
- "Ficha técnica": {
261
- assignations: [{
262
- collaboratorType: "especialist",
263
- id: product.id_datasheet_especialist
264
- }, {
265
- collaboratorType: "facilitator",
266
- id: product.id_datasheet_facilitator
267
- }],
268
- collaborators: {
269
- especialist: users[0] || [],
270
- facilitator: users[2] || []
271
- }
272
- },
273
- Imágenes: {
274
- assignations: [{
275
- collaboratorType: "especialist",
276
- id: product.id_images_especialist
277
- }, {
278
- collaboratorType: "facilitator",
279
- id: product.id_images_facilitator
280
- }],
281
- collaborators: {
282
- especialist: users[1] || [],
283
- facilitator: users[3] || []
284
- }
285
- }
286
- };
287
- };
288
-
289
- exports.buildCollaboratorAssignations = buildCollaboratorAssignations;
290
-
291
- var calculateRequiredNull = function calculateRequiredNull(services, servicesData, activeRetailerId) {
292
- var _services$3, _services$4, _services$5, _services$5$retailerM, _services$7, _services$7$values;
293
-
294
- var result = {
295
- "Ficha técnica": 0,
296
- Descripción: 0,
297
- Imágenes: 0
298
- };
299
-
300
- var isServiceRequested = function isServiceRequested(retailerId, concept) {
301
- return servicesData === null || servicesData === void 0 ? void 0 : servicesData.some(function (srv) {
302
- return srv.id_retailer === retailerId && srv.service === concept;
303
- });
304
- }; // Ficha técnica: contar inputs requeridos sin valor
305
-
306
-
307
- var datasheetInputs = ((_services$3 = services[0]) === null || _services$3 === void 0 ? void 0 : _services$3.inputs) || {};
308
- var datasheetsByRetailer = Object.values(services[0]).filter(function (item) {
309
- var _item$retailer;
310
-
311
- return (item === null || item === void 0 ? void 0 : (_item$retailer = item.retailer) === null || _item$retailer === void 0 ? void 0 : _item$retailer.id) === activeRetailerId;
312
- });
313
- datasheetsByRetailer.forEach(function (datasheet) {
314
- var _datasheet$retailer;
315
-
316
- if (!isServiceRequested((_datasheet$retailer = datasheet.retailer) === null || _datasheet$retailer === void 0 ? void 0 : _datasheet$retailer.id, "datasheet")) return;
317
- Object.values(datasheet.data || {}).forEach(function (dataGroup) {
318
- var _dataGroup$inputs;
319
-
320
- (_dataGroup$inputs = dataGroup.inputs) === null || _dataGroup$inputs === void 0 ? void 0 : _dataGroup$inputs.forEach(function (inputId) {
321
- var input = datasheetInputs[inputId];
322
-
323
- if (input !== null && input !== void 0 && input.required && (input === null || input === void 0 ? void 0 : input.id_retailer) === activeRetailerId && !(input !== null && input !== void 0 && input.value)) {
324
- result["Ficha técnica"]++;
325
- }
326
- });
327
- });
328
- }); // Descripción: contar inputs requeridos sin valor
329
-
330
- var htmlTagsRegex = /(<\/?p>)|(<\/?strong>)|(<br>)/gm;
331
- var descriptions = (_services$4 = services[1]) === null || _services$4 === void 0 ? void 0 : _services$4.filter(function (desc) {
332
- return desc.id === activeRetailerId;
333
- });
334
- descriptions === null || descriptions === void 0 ? void 0 : descriptions.forEach(function (description) {
335
- var _description$inputs;
336
-
337
- if (!isServiceRequested(description.id, "description")) return;
338
- (_description$inputs = description.inputs) === null || _description$inputs === void 0 ? void 0 : _description$inputs.forEach(function (input) {
339
- var _input$value;
340
-
341
- var valueClean = ((_input$value = input.value) === null || _input$value === void 0 ? void 0 : _input$value.replace(htmlTagsRegex, "")) || "";
342
-
343
- if (input.required && !valueClean) {
344
- result["Descripción"]++;
345
- }
346
- });
347
- }); // Imágenes: contar imágenes requeridas sin valor
348
-
349
- var retailerMandatories = ((_services$5 = services[2]) === null || _services$5 === void 0 ? void 0 : (_services$5$retailerM = _services$5.retailerMandatories) === null || _services$5$retailerM === void 0 ? void 0 : _services$5$retailerM.flat()) || [];
350
- var requestedRetailers = retailerMandatories.filter(function (rm) {
351
- return servicesData === null || servicesData === void 0 ? void 0 : servicesData.some(function (srv) {
352
- return srv.id_retailer === rm.id_retailer;
353
- });
354
- });
355
- var requiredImageIds = new Set(requestedRetailers.filter(function (rm) {
356
- var _services$6, _services$6$inputs;
357
-
358
- return (_services$6 = services[2]) === null || _services$6 === void 0 ? void 0 : (_services$6$inputs = _services$6.inputs) === null || _services$6$inputs === void 0 ? void 0 : _services$6$inputs.some(function (input) {
359
- return input.id === rm.id_image && input.required === 1;
360
- });
361
- }).map(function (rm) {
362
- return rm.id_image;
363
- }));
364
- var existingImageIds = new Set(((_services$7 = services[2]) === null || _services$7 === void 0 ? void 0 : (_services$7$values = _services$7.values) === null || _services$7$values === void 0 ? void 0 : _services$7$values.map(function (img) {
365
- return img.image_id;
366
- })) || []);
367
- requiredImageIds.forEach(function (imageId) {
368
- if (!existingImageIds.has(imageId)) {
369
- result["Imágenes"]++;
370
- }
371
- });
372
- return result;
373
- };
374
-
375
- exports.calculateRequiredNull = calculateRequiredNull;
126
+ exports.sendMessage = sendMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.5.98",
3
+ "version": "21.5.99",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -12,7 +12,6 @@
12
12
  "@fortawesome/free-regular-svg-icons": "^6.2.0",
13
13
  "@fortawesome/free-solid-svg-icons": "^6.2.0",
14
14
  "@fortawesome/react-fontawesome": "^0.2.0",
15
- "@google/genai": "^1.35.0",
16
15
  "@mui/icons-material": "^5.11.16",
17
16
  "@mui/material": "^5.12.0",
18
17
  "@mui/styled-engine-sc": "^5.12.0",
@@ -52,8 +51,7 @@
52
51
  "styled-components": "^5.3.9",
53
52
  "swiper": "^8.4.4",
54
53
  "uuid": "^8.3.2",
55
- "web-vitals": "^1.0.1",
56
- "zod": "^4.3.5"
54
+ "web-vitals": "^1.0.1"
57
55
  },
58
56
  "scripts": {
59
57
  "start": "start-storybook -p 6006",
@@ -38,10 +38,6 @@ export const Container = styled.button`
38
38
  background-color: #603888;
39
39
  }
40
40
 
41
- &.general-pink-button {
42
- background-color: #E33AA9;
43
- }
44
-
45
41
  &.general-transparent-button {
46
42
  background-color: transparent;
47
43
  border: 1px solid #503d66;