contentoh-components-library 21.5.99 → 21.6.1

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 (64) hide show
  1. package/dist/components/atoms/GeneralButton/styles.js +1 -1
  2. package/dist/components/atoms/GeneralInput/index.js +249 -54
  3. package/dist/components/atoms/GeneralInput/styles.js +7 -3
  4. package/dist/components/atoms/InputFormatter/index.js +223 -68
  5. package/dist/components/atoms/InputFormatter/styles.js +20 -4
  6. package/dist/components/molecules/StatusAsignationInfo/index.js +11 -1
  7. package/dist/components/molecules/TabsMenu/index.js +13 -1
  8. package/dist/components/molecules/TagAndInput/index.js +364 -24
  9. package/dist/components/molecules/TagAndInput/styles.js +2 -2
  10. package/dist/components/organisms/FullProductNameHeader/index.js +6 -22
  11. package/dist/components/organisms/InputGroup/index.js +22 -18
  12. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +150 -337
  13. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +15 -15
  14. package/dist/components/pages/ProviderProductEdition/index.js +393 -352
  15. package/dist/components/pages/ProviderProductEdition/utils.js +1 -0
  16. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +125 -211
  17. package/dist/components/pages/RetailerProductEdition/index.js +1743 -2239
  18. package/dist/components/pages/RetailerProductEdition/styles.js +4 -2
  19. package/dist/components/pages/RetailerProductEdition/utils.js +251 -2
  20. package/dist/contexts/AiProductEdition.js +34 -22
  21. package/package.json +4 -2
  22. package/src/ai/utils/compare-strings.js +45 -0
  23. package/src/assets/images/Icons/arrow.png +0 -0
  24. package/src/assets/images/Icons/cancel.png +0 -0
  25. package/src/assets/images/Icons/ia-icon.png +0 -0
  26. package/src/assets/images/Icons/loading.svg +5 -0
  27. package/src/assets/images/Icons/reload.png +0 -0
  28. package/src/components/atoms/GeneralButton/styles.js +4 -0
  29. package/src/components/atoms/GeneralInput/index.js +241 -60
  30. package/src/components/atoms/GeneralInput/styles.js +81 -0
  31. package/src/components/atoms/InputFormatter/index.js +200 -51
  32. package/src/components/atoms/InputFormatter/styles.js +284 -0
  33. package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +10 -0
  34. package/src/components/atoms/RetailerSelector/index.js +3 -0
  35. package/src/components/atoms/RetailerSelector/styles.js +0 -0
  36. package/src/components/molecules/StatusAsignationInfo/index.js +9 -1
  37. package/src/components/molecules/TabsMenu/index.js +12 -0
  38. package/src/components/molecules/TagAndInput/index.js +294 -21
  39. package/src/components/molecules/TagAndInput/styles.js +59 -17
  40. package/src/components/organisms/ChangeStatusModal/index.jsx +488 -0
  41. package/src/components/organisms/ChangeStatusModal/styles.js +333 -0
  42. package/src/components/organisms/FullProductNameHeader/index.js +4 -28
  43. package/src/components/organisms/FullTabsMenu/index.js +1 -1
  44. package/src/components/organisms/InputGroup/index.js +12 -4
  45. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +174 -202
  46. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
  47. package/src/components/pages/ProviderProductEdition/index.js +486 -417
  48. package/src/components/pages/ProviderProductEdition/utils.js +2 -2
  49. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +136 -243
  50. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +575 -0
  51. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +62 -0
  52. package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +344 -0
  53. package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +155 -0
  54. package/src/components/pages/RetailerProductEdition/context/reducers/product.js +114 -0
  55. package/src/components/pages/RetailerProductEdition/context/reducers/system.js +60 -0
  56. package/src/components/pages/RetailerProductEdition/index.js +1580 -1719
  57. package/src/components/pages/RetailerProductEdition/index_old.js +1979 -0
  58. package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +101 -0
  59. package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +115 -0
  60. package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +174 -0
  61. package/src/components/pages/RetailerProductEdition/styles.js +67 -2
  62. package/src/components/pages/RetailerProductEdition/utils.js +240 -0
  63. package/src/contexts/AiProductEdition.jsx +356 -0
  64. package/src/global-files/statusDictionary.js +103 -0
@@ -7,7 +7,15 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.TagAndInput = void 0;
9
9
 
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
13
+
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
15
+
16
+ var _objectSpread6 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
17
+
18
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
11
19
 
12
20
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
13
21
 
@@ -29,6 +37,10 @@ var _SliderToolTip = require("../../atoms/SliderToolTip");
29
37
 
30
38
  var _Tooltip = require("../../atoms/Tooltip");
31
39
 
40
+ var _AiProductEdition = require("../../../contexts/AiProductEdition");
41
+
42
+ var _iaIcon = _interopRequireDefault(require("../../../assets/images/Icons/ia-icon.png"));
43
+
32
44
  var _jsxRuntime = require("react/jsx-runtime");
33
45
 
34
46
  var TagAndInput = function TagAndInput(_ref) {
@@ -50,6 +62,7 @@ var TagAndInput = function TagAndInput(_ref) {
50
62
  inputRows = _ref.inputRows,
51
63
  maxChar = _ref.maxChar,
52
64
  required = _ref.required,
65
+ aiGenerated = _ref.aiGenerated,
53
66
  optionList = _ref.optionList,
54
67
  description = _ref.description,
55
68
  inputOnChange = _ref.inputOnChange,
@@ -68,15 +81,274 @@ var TagAndInput = function TagAndInput(_ref) {
68
81
  boxOnboardingList = _useState2[0],
69
82
  setBoxOnboardingList = _useState2[1];
70
83
 
84
+ var _useAiProductEdition = (0, _AiProductEdition.useAiProductEdition)(),
85
+ isCreators = _useAiProductEdition.isCreators,
86
+ generateProductSuggestions = _useAiProductEdition.generateProductSuggestions,
87
+ regenerateProductSuggestions = _useAiProductEdition.regenerateProductSuggestions,
88
+ suggestions = _useAiProductEdition.suggestions,
89
+ setSuggestions = _useAiProductEdition.setSuggestions,
90
+ currentSuggestion = _useAiProductEdition.currentSuggestion,
91
+ setCurrentSuggestionValue = _useAiProductEdition.setCurrentSuggestionValue,
92
+ isAiAvailable = _useAiProductEdition.isAiAvailable,
93
+ inputsGeneratedWithAi = _useAiProductEdition.inputsGeneratedWithAi,
94
+ setInputsGeneratedWithAi = _useAiProductEdition.setInputsGeneratedWithAi,
95
+ inputsUsingAi = _useAiProductEdition.inputsUsingAi,
96
+ setInputsUsingAi = _useAiProductEdition.setInputsUsingAi;
97
+
98
+ var isBenefitInput = label === null || label === void 0 ? void 0 : label.toLowerCase().includes("beneficios");
99
+
100
+ var _useState3 = (0, _react.useState)(false),
101
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
102
+ isAiGenerationLoading = _useState4[0],
103
+ setIsAiGenerationLoading = _useState4[1];
104
+
105
+ var _useState5 = (0, _react.useState)(false),
106
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
107
+ isAiActive = _useState6[0],
108
+ setIsAiActive = _useState6[1];
109
+
110
+ var _useState7 = (0, _react.useState)(false),
111
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
112
+ isAiRegenerationLoading = _useState8[0],
113
+ setIsAiRegenerationLoading = _useState8[1];
114
+
115
+ var _useState9 = (0, _react.useState)(false),
116
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
117
+ isAiGenerated = _useState10[0],
118
+ setIsAiGenerated = _useState10[1];
119
+
120
+ var _useState11 = (0, _react.useState)(""),
121
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
122
+ errorMessage = _useState12[0],
123
+ setErrorMessage = _useState12[1];
124
+
125
+ function handlerAiGeneration(_x) {
126
+ return _handlerAiGeneration.apply(this, arguments);
127
+ }
128
+
129
+ function _handlerAiGeneration() {
130
+ _handlerAiGeneration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref2) {
131
+ var type, currentSuggestions, aiSuggestions, errorMsg;
132
+ return _regenerator.default.wrap(function _callee$(_context) {
133
+ while (1) {
134
+ switch (_context.prev = _context.next) {
135
+ case 0:
136
+ type = _ref2.type;
137
+
138
+ if (!(isAiGenerationLoading || !isAiAvailable)) {
139
+ _context.next = 3;
140
+ break;
141
+ }
142
+
143
+ return _context.abrupt("return");
144
+
145
+ case 3:
146
+ if (!isAiActive) {
147
+ _context.next = 6;
148
+ break;
149
+ }
150
+
151
+ setIsAiActive(false);
152
+ return _context.abrupt("return");
153
+
154
+ case 6:
155
+ //Si ya tiene sugerencias generadas, se las mostramos
156
+ currentSuggestions = suggestions === null || suggestions === void 0 ? void 0 : suggestions[inputId];
157
+
158
+ if (!(Array.isArray(currentSuggestions) && currentSuggestions.length > 0)) {
159
+ _context.next = 9;
160
+ break;
161
+ }
162
+
163
+ return _context.abrupt("return", setIsAiActive(true));
164
+
165
+ case 9:
166
+ setErrorMessage("");
167
+ setIsAiGenerationLoading(true);
168
+ _context.next = 13;
169
+ return generateProductSuggestions({
170
+ inputName: label,
171
+ currentValue: value,
172
+ description: description,
173
+ maxChar: maxChar !== null && maxChar !== void 0 ? maxChar : 99,
174
+ type: type,
175
+ // Informacion del producto
176
+ articleId: articleId,
177
+ versionId: version,
178
+ descriptionId: !isBenefitInput ? inputId : null,
179
+ attributeId: isBenefitInput ? inputId : null
180
+ });
181
+
182
+ case 13:
183
+ aiSuggestions = _context.sent;
184
+
185
+ if (!(!aiSuggestions && aiSuggestions.length === 0)) {
186
+ _context.next = 19;
187
+ break;
188
+ }
189
+
190
+ errorMsg = "Error: No se recibieron sugerencias de IA";
191
+ console.log(errorMsg);
192
+ setIsAiGenerationLoading(false);
193
+ return _context.abrupt("return");
194
+
195
+ case 19:
196
+ if (!(aiSuggestions !== null && aiSuggestions !== void 0 && aiSuggestions.error)) {
197
+ _context.next = 24;
198
+ break;
199
+ }
200
+
201
+ console.log('Error: ', aiSuggestions.error);
202
+ setErrorMessage(aiSuggestions.error);
203
+ setIsAiGenerationLoading(false);
204
+ return _context.abrupt("return");
205
+
206
+ case 24:
207
+ setSuggestions(function (prev) {
208
+ return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, inputId, aiSuggestions));
209
+ });
210
+ setIsAiActive(true);
211
+ setIsAiGenerationLoading(false);
212
+
213
+ case 27:
214
+ case "end":
215
+ return _context.stop();
216
+ }
217
+ }
218
+ }, _callee);
219
+ }));
220
+ return _handlerAiGeneration.apply(this, arguments);
221
+ }
222
+
223
+ function handlerRegenerateSuggestions(_x2) {
224
+ return _handlerRegenerateSuggestions.apply(this, arguments);
225
+ }
226
+
227
+ function _handlerRegenerateSuggestions() {
228
+ _handlerRegenerateSuggestions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref3) {
229
+ var _ref3$type, type, currentSuggestions, aiSuggestions, errorMsg;
230
+
231
+ return _regenerator.default.wrap(function _callee2$(_context2) {
232
+ while (1) {
233
+ switch (_context2.prev = _context2.next) {
234
+ case 0:
235
+ _ref3$type = _ref3.type, type = _ref3$type === void 0 ? "description" : _ref3$type;
236
+
237
+ if (!isAiRegenerationLoading) {
238
+ _context2.next = 3;
239
+ break;
240
+ }
241
+
242
+ return _context2.abrupt("return");
243
+
244
+ case 3:
245
+ setErrorMessage("");
246
+ setIsAiRegenerationLoading(true);
247
+ currentSuggestions = suggestions === null || suggestions === void 0 ? void 0 : suggestions[inputId];
248
+ _context2.next = 8;
249
+ return regenerateProductSuggestions({
250
+ inputName: label,
251
+ currentValue: value,
252
+ description: description,
253
+ maxChar: maxChar !== null && maxChar !== void 0 ? maxChar : 99,
254
+ type: type,
255
+ //Información del producto
256
+ articleId: articleId,
257
+ versionId: version,
258
+ descriptionId: !isBenefitInput ? inputId : null,
259
+ attributeId: isBenefitInput ? inputId : null
260
+ });
261
+
262
+ case 8:
263
+ aiSuggestions = _context2.sent;
264
+
265
+ if (!(!aiSuggestions && aiSuggestions.length === 0)) {
266
+ _context2.next = 15;
267
+ break;
268
+ }
269
+
270
+ errorMsg = "Error: No se recibieron sugerencias de IA";
271
+ console.log(errorMsg);
272
+ setErrorMessage(errorMsg);
273
+ setIsAiRegenerationLoading(false);
274
+ return _context2.abrupt("return");
275
+
276
+ case 15:
277
+ console.log({
278
+ aiSuggestionsRenew: aiSuggestions
279
+ });
280
+
281
+ if (!(aiSuggestions !== null && aiSuggestions !== void 0 && aiSuggestions.error)) {
282
+ _context2.next = 21;
283
+ break;
284
+ }
285
+
286
+ console.log('Error: ', aiSuggestions.error);
287
+ setErrorMessage(aiSuggestions.error);
288
+ setIsAiRegenerationLoading(false);
289
+ return _context2.abrupt("return");
290
+
291
+ case 21:
292
+ setSuggestions(function (prev) {
293
+ return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, inputId, [].concat((0, _toConsumableArray2.default)(currentSuggestions), (0, _toConsumableArray2.default)(aiSuggestions))));
294
+ });
295
+ setIsAiRegenerationLoading(false);
296
+
297
+ case 23:
298
+ case "end":
299
+ return _context2.stop();
300
+ }
301
+ }
302
+ }, _callee2);
303
+ }));
304
+ return _handlerRegenerateSuggestions.apply(this, arguments);
305
+ }
306
+
307
+ var handleChangeSuggestion = function handleChangeSuggestion(_ref4) {
308
+ var _currentSuggestion$in, _inputSuggestions$pre, _inputSuggestions$nex;
309
+
310
+ var _ref4$action = _ref4.action,
311
+ action = _ref4$action === void 0 ? "next" : _ref4$action;
312
+ var inputSuggestions = suggestions === null || suggestions === void 0 ? void 0 : suggestions[inputId];
313
+ if (!inputSuggestions || !Array.isArray(inputSuggestions)) return console.log("Error: No existe la sugerencia");
314
+ var currentIndex = currentSuggestion === null || currentSuggestion === void 0 ? void 0 : (_currentSuggestion$in = currentSuggestion[inputId]) === null || _currentSuggestion$in === void 0 ? void 0 : _currentSuggestion$in.index;
315
+ if (!currentIndex && currentIndex != 0) return console.log("Error: No existe un indice en la sugerencia actual");
316
+
317
+ switch (action) {
318
+ case "prev":
319
+ if (currentIndex === 0) return;
320
+ var prevIndex = currentIndex - 1;
321
+ setCurrentSuggestionValue({
322
+ inputId: inputId,
323
+ index: prevIndex,
324
+ value: (_inputSuggestions$pre = inputSuggestions[prevIndex]) === null || _inputSuggestions$pre === void 0 ? void 0 : _inputSuggestions$pre.value
325
+ });
326
+ break;
327
+
328
+ case "next":
329
+ if (currentIndex === inputSuggestions.length - 1) return;
330
+ var nextIndex = currentIndex + 1;
331
+ setCurrentSuggestionValue({
332
+ inputId: inputId,
333
+ index: nextIndex,
334
+ value: (_inputSuggestions$nex = inputSuggestions[nextIndex]) === null || _inputSuggestions$nex === void 0 ? void 0 : _inputSuggestions$nex.value
335
+ });
336
+ break;
337
+
338
+ default:
339
+ break;
340
+ }
341
+ };
342
+
71
343
  (0, _react.useEffect)(function () {
72
344
  var temp = {};
73
345
  var maxBoxId = 0;
74
346
  inputGroup === null || inputGroup === void 0 ? void 0 : inputGroup.inputs.forEach(function (attrId) {
75
347
  if (!dataInputs[attrId].box) return;
76
- Object.entries(dataInputs[attrId].box).forEach(function (_ref2) {
77
- var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
78
- boxId = _ref3[0],
79
- value = _ref3[1];
348
+ Object.entries(dataInputs[attrId].box).forEach(function (_ref5) {
349
+ var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
350
+ boxId = _ref6[0],
351
+ value = _ref6[1];
80
352
 
81
353
  if (boxId > maxBoxId) maxBoxId = boxId;
82
354
  if (!temp[boxId]) temp[boxId] = {};
@@ -98,28 +370,83 @@ var TagAndInput = function TagAndInput(_ref) {
98
370
  (0, _react.useEffect)(function () {
99
371
  onChange && onChange(boxOnboardingList);
100
372
  }, [boxOnboardingList]);
373
+ (0, _react.useEffect)(function () {
374
+ if (!isCreators) return;
375
+ var currentDescriptionUpdate = Array.isArray(updatedDescriptions) ? updatedDescriptions.find(function (desc) {
376
+ return (desc === null || desc === void 0 ? void 0 : desc.attributeId) === inputId;
377
+ }) : null;
378
+ var currentDatasheetUpdate = Array.isArray(updatedDatasheets) ? updatedDatasheets.find(function (data) {
379
+ return (data === null || data === void 0 ? void 0 : data.attributeId) === inputId;
380
+ }) : null;
381
+ var calculatedIsAiGenerated = aiGenerated;
382
+
383
+ if (currentDescriptionUpdate) {
384
+ calculatedIsAiGenerated = currentDescriptionUpdate.aiSuggestionAccepted;
385
+ } else if (currentDatasheetUpdate) {
386
+ calculatedIsAiGenerated = currentDatasheetUpdate.aiSuggestionAccepted;
387
+ }
388
+
389
+ setInputsGeneratedWithAi(function (prev) {
390
+ return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, "".concat(inputId, "-").concat(inputType, "-").concat(version), {
391
+ inputType: inputType,
392
+ inputId: inputId,
393
+ version: version,
394
+ isAiGenerated: !!calculatedIsAiGenerated,
395
+ label: label
396
+ }));
397
+ });
398
+ }, [updatedDescriptions, updatedDatasheets, aiGenerated, inputId]);
399
+ (0, _react.useEffect)(function () {
400
+ var _inputsGeneratedWithA;
401
+
402
+ if (!isCreators) return;
403
+ setIsAiGenerated(!!((_inputsGeneratedWithA = inputsGeneratedWithAi["".concat(inputId, "-").concat(inputType, "-").concat(version)]) !== null && _inputsGeneratedWithA !== void 0 && _inputsGeneratedWithA.isAiGenerated));
404
+ }, [inputsGeneratedWithAi]);
405
+ (0, _react.useEffect)(function () {
406
+ if (!isCreators) return;
407
+ setInputsUsingAi(function (prev) {
408
+ return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, "".concat(inputId, "-").concat(inputType, "-").concat(version), {
409
+ using: isAiActive
410
+ }));
411
+ });
412
+ }, [isAiActive]);
101
413
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
102
414
  inputType: inputType,
103
415
  className: "input-container",
104
416
  children: [(label === null || label === void 0 ? void 0 : label.length) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
105
417
  className: "title-container",
106
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
107
- text: label,
108
- headerType: "input-name-header",
109
- color: color
110
- }), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.Tooltip, {
111
- componentTooltip: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
112
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
113
- children: description
114
- })
115
- }),
116
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
117
- src: _infoIcon.default,
118
- alt: "info icon",
119
- className: 'icon_information'
120
- }),
121
- classNameTooltip: "container-tooltip"
122
- })]
418
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
419
+ className: "titles",
420
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
421
+ text: label,
422
+ headerType: "input-name-header",
423
+ color: color
424
+ }), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.Tooltip, {
425
+ componentTooltip: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
426
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
427
+ children: description
428
+ })
429
+ }),
430
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
431
+ src: _infoIcon.default,
432
+ alt: "info icon",
433
+ className: 'icon_information'
434
+ }),
435
+ classNameTooltip: "container-tooltip"
436
+ })]
437
+ }), isCreators && isAiGenerated ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
438
+ className: "ai-generated",
439
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
440
+ src: _iaIcon.default
441
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
442
+ children: "Atributo generado con IA"
443
+ })]
444
+ }) : null]
445
+ }), errorMessage && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
446
+ className: "error-message-container",
447
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
448
+ children: errorMessage
449
+ })
123
450
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GeneralInput, {
124
451
  inputId: inputId,
125
452
  inputType: inputType,
@@ -143,7 +470,20 @@ var TagAndInput = function TagAndInput(_ref) {
143
470
  description: description,
144
471
  inputOnChange: inputOnChange,
145
472
  onKeyDown: onKeyDown,
146
- auditClass: auditClass,
473
+ auditClass: auditClass // AI Generation
474
+ ,
475
+ hasAiGeneration: isCreators,
476
+ isBenefitInput: isBenefitInput,
477
+ isAiGenerationLoading: isAiGenerationLoading,
478
+ isAiRegenerationLoading: isAiRegenerationLoading,
479
+ isAiActive: isAiActive,
480
+ setIsAiActive: setIsAiActive,
481
+ isAiAvailable: isAiAvailable,
482
+ aiGenerated: aiGenerated // aiSuggestions={aiSuggestions}
483
+ ,
484
+ handlerAiGeneration: handlerAiGeneration,
485
+ handlerRegenerateSuggestions: handlerRegenerateSuggestions,
486
+ handleChangeSuggestion: handleChangeSuggestion,
147
487
  onChange: function onChange(e) {
148
488
  setBoxOnboardingList(function (prev) {
149
489
  return prev.map(function (box, i) {
@@ -151,7 +491,7 @@ var TagAndInput = function TagAndInput(_ref) {
151
491
  return box;
152
492
  }
153
493
 
154
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, box), {}, {
494
+ return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, box), {}, {
155
495
  value: e
156
496
  });
157
497
  });
@@ -15,10 +15,10 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .title-container {\n position: relative;\n\n display: flex;\n align-items: center;\n gap: .5rem;\n\n .icon_information{\n width: 1.35rem;\n height: 1.35rem;\n filter: brightness(.35);\n }\n\n .tooltip {\n display: none;\n position: absolute;\n background-color: ", ";\n color: ", ";\n font-family: ", ";\n font-size: 14px;\n line-height: 19px;\n left: 0;\n top: 0;\n height: fit-content;\n transition: display 2s;\n }\n\n &:hover {\n .tooltip {\n display: block;\n }\n }\n }\n\n & > :first-child {\n & + * {\n margin-top: ", "px;\n }\n }\n & + * {\n margin-top: ", "px;\n }\n"])), _variables.GlobalColors.white, function (_ref) {
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .title-container {\n position: relative;\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n font-family: ", ";\n\n .titles{\n display: flex;\n gap: .5rem;\n align-items: center;\n }\n\n .icon_information{\n width: 1.35rem;\n height: 1.35rem;\n filter: brightness(.35);\n margin-top: 10px;\n }\n\n .tooltip {\n display: none;\n position: absolute;\n background-color: ", ";\n color: ", ";\n font-size: 14px;\n line-height: 19px;\n left: 0;\n top: 0;\n height: fit-content;\n transition: display 2s;\n }\n\n .ai-generated{\n\n display: flex;\n align-items: items-center;\n gap: .5rem;\n font-size: 11px;\n background-color: rgba(224, 57, 167, 0.025);\n border: 1px solid rgba(224, 57, 167, 0.1);\n padding: .25rem .5rem;\n border-radius: 5px;\n margin-left: 0.5rem;\n margin-top: 7px;\n cursor: default;\n\n > img {\n width: 0.75rem;\n height: 0.75rem;\n }\n\n }\n\n &:hover {\n .tooltip {\n display: block;\n }\n }\n\n\n }\n\n & > :first-child {\n & + * {\n margin-top: ", "px;\n }\n }\n & + * {\n margin-top: ", "px;\n }\n\n .error-message-container {\n\n font-family: \"Raleway\";\n font-size: 12px;\n font-weight: 500;\n color: #E1251B;\n margin-bottom: 8px;\n margin-top: 0;\n\n }\n"])), _variables.FontFamily.Raleway, _variables.GlobalColors.white, function (_ref) {
19
19
  var color = _ref.color;
20
20
  return color ? color : _variables.GlobalColors.s5;
21
- }, _variables.FontFamily.Raleway, function (_ref2) {
21
+ }, function (_ref2) {
22
22
  var inputType = _ref2.inputType;
23
23
  return inputType !== "textarea" ? 4 : 15;
24
24
  }, function (_ref3) {
@@ -51,32 +51,16 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
51
51
  setRetailerIndex = _useState4[1];
52
52
 
53
53
  (0, _react.useEffect)(function () {
54
- // necesitamos definir los retailers que se deberan de mostrar en el selecto de retailers
55
- // Si se viene desde la vista de productos se deben usar los de categoryRetailer
56
- // Si se vene desde la vista de tareas entonces se debe trabajar con los retailers que esten en statusByRetailer
57
- var ifFromTasks = headerData.statusByRetailer;
54
+ var ifFromTasks = headerData.statusByRetailer ? true : false;
58
55
  var categoryRetailer = headerData.categoryRetailer || headerData.article.categoryRetailer;
59
- var categoryRetailerNormalized = categoryRetailer ? categoryRetailer.map(function (rel) {
60
- return {
61
- id_retailer: rel.id_retailer || rel.retailer_id,
62
- retailer: rel.retailer_name || rel.retailerName || rel.retailer,
63
- name: rel.retailer_name || rel.retailerName || rel.retailer,
64
- id_category: rel.id_category,
65
- category: rel.category_name || rel.categoryName || rel.category,
66
- image: "https://content-management-images.s3.amazonaws.com/retailers/".concat(rel.id_retailer || rel.retailer_id, ".png")
67
- };
68
- }) : null;
69
- var retailersIdsFromStatusByRetailer = Object.keys(headerData.statusByRetailer || {}).map(function (id) {
70
- return parseInt(id, 10);
71
- });
72
56
 
73
57
  if (ifFromTasks) {
74
- var categoryRetailerInOrder = categoryRetailerNormalized.filter(function (rel) {
75
- return retailersIdsFromStatusByRetailer.includes(rel.id_retailer);
76
- });
77
- setRetailers(categoryRetailerInOrder);
58
+ setRetailers(headerData.categoryRetailerInOrder);
78
59
  } else {
79
- setRetailers(categoryRetailerNormalized);
60
+ console.log({
61
+ categoryRetailer: categoryRetailer
62
+ });
63
+ setRetailers(categoryRetailer);
80
64
  }
81
65
  }, [servicesData]);
82
66
 
@@ -183,7 +183,7 @@ var InputGroup = function InputGroup(_ref) {
183
183
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
184
184
  className: "inputs-container",
185
185
  children: inputGroup === null || inputGroup === void 0 ? void 0 : (_inputGroup$inputs = inputGroup.inputs) === null || _inputGroup$inputs === void 0 ? void 0 : _inputGroup$inputs.map(function (input, index) {
186
- var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _dataInputs$input8, _dataInputs$input9, _dataInputs$input10, _dataInputs$input11, _dataInputs$input12, _dataInputs$input13, _dataInputs$input14, _dataInputs$input15, _dataInputs$input16, _auditInputs$input, _dataInputs$input17, _dataInputs$input18, _dataInputs$input19, _dataInputs$input20, _dataInputs$input21, _dataInputs$input22, _auditInputGroup$inpu, _auditInputGroup$inpu2;
186
+ var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _dataInputs$input8, _dataInputs$input9, _dataInputs$input10, _dataInputs$input11, _dataInputs$input12, _dataInputs$input13, _dataInputs$input14, _dataInputs$input15, _dataInputs$input16, _auditInputs$input, _dataInputs$input17, _dataInputs$input18, _dataInputs$input19, _dataInputs$input20, _dataInputs$input21, _dataInputs$input22, _dataInputs$input23, _auditInputGroup$inpu, _auditInputGroup$inpu2;
187
187
 
188
188
  return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
189
189
  className: ((_dataInputs$input = dataInputs[input]) === null || _dataInputs$input === void 0 ? void 0 : _dataInputs$input.id) === 6700 || ((_dataInputs$input2 = dataInputs[input]) === null || _dataInputs$input2 === void 0 ? void 0 : _dataInputs$input2.id) === 6701 ? "inputs-validation-onboarding" : "inputs-validation",
@@ -206,11 +206,12 @@ var InputGroup = function InputGroup(_ref) {
206
206
  inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
207
207
  articleId: articleId,
208
208
  isRequired: (_dataInputs$input18 = dataInputs[input]) === null || _dataInputs$input18 === void 0 ? void 0 : _dataInputs$input18.required,
209
+ aiGenerated: (_dataInputs$input19 = dataInputs[input]) === null || _dataInputs$input19 === void 0 ? void 0 : _dataInputs$input19.ai_generated,
209
210
  updatedDatasheets: updatedDatasheets,
210
211
  setUpdatedDatasheets: setUpdatedDatasheets,
211
- maxChar: (_dataInputs$input19 = dataInputs[input]) !== null && _dataInputs$input19 !== void 0 && _dataInputs$input19.max_chars ? (_dataInputs$input20 = dataInputs[input]) === null || _dataInputs$input20 === void 0 ? void 0 : _dataInputs$input20.max_chars : 999,
212
- optionList: (_dataInputs$input21 = dataInputs[input]) === null || _dataInputs$input21 === void 0 ? void 0 : _dataInputs$input21.option_list,
213
- description: (_dataInputs$input22 = dataInputs[input]) === null || _dataInputs$input22 === void 0 ? void 0 : _dataInputs$input22.description,
212
+ maxChar: (_dataInputs$input20 = dataInputs[input]) !== null && _dataInputs$input20 !== void 0 && _dataInputs$input20.max_chars ? (_dataInputs$input21 = dataInputs[input]) === null || _dataInputs$input21 === void 0 ? void 0 : _dataInputs$input21.max_chars : 999,
213
+ optionList: (_dataInputs$input22 = dataInputs[input]) === null || _dataInputs$input22 === void 0 ? void 0 : _dataInputs$input22.option_list,
214
+ description: (_dataInputs$input23 = dataInputs[input]) === null || _dataInputs$input23 === void 0 ? void 0 : _dataInputs$input23.description,
214
215
  showTooltip: true,
215
216
  auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
216
217
  }, index + "-" + ((_dataInputs$input10 = dataInputs[input]) === null || _dataInputs$input10 === void 0 ? void 0 : _dataInputs$input10.value) + "-" + ((_dataInputs$input11 = dataInputs[input]) === null || _dataInputs$input11 === void 0 ? void 0 : _dataInputs$input11.id) + "-" + compare)]
@@ -230,6 +231,7 @@ var InputGroup = function InputGroup(_ref) {
230
231
  label: (input === null || input === void 0 ? void 0 : input.name) + (input.required ? "*" : ""),
231
232
  value: compare ? auditInputGroup === null || auditInputGroup === void 0 ? void 0 : (_auditInputGroup$inpu = auditInputGroup.inputs[index]) === null || _auditInputGroup$inpu === void 0 ? void 0 : _auditInputGroup$inpu.value : input === null || input === void 0 ? void 0 : input.value,
232
233
  isRequired: input.required,
234
+ aiGenerated: input === null || input === void 0 ? void 0 : input.ai_generated,
233
235
  disabled: input.id === 44186 || input.id === 44187 ? false : input === null || input === void 0 ? void 0 : input.isApproved,
234
236
  maxChar: input.max_chars,
235
237
  inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
@@ -253,34 +255,35 @@ var InputGroup = function InputGroup(_ref) {
253
255
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
254
256
  className: "inputs-container",
255
257
  children: inputGroup === null || inputGroup === void 0 ? void 0 : (_inputGroup$inputs2 = inputGroup.inputs) === null || _inputGroup$inputs2 === void 0 ? void 0 : _inputGroup$inputs2.map(function (input, index) {
256
- var _dataInputs$input23, _dataInputs$input24, _dataInputs$input25, _dataInputs$input26, _dataInputs$input27, _dataInputs$input28, _dataInputs$input29, _auditInputs$input2, _dataInputs$input30, _dataInputs$input31, _dataInputs$input32, _dataInputs$input33, _dataInputs$input34, _dataInputs$input35, _dataInputs$input36, _dataInputs$input37, _dataInputs$input38, _dataInputs$input39, _auditInputGroup$inpu3, _auditInputGroup$inpu4;
258
+ var _dataInputs$input24, _dataInputs$input25, _dataInputs$input26, _dataInputs$input27, _dataInputs$input28, _dataInputs$input29, _dataInputs$input30, _dataInputs$input31, _dataInputs$input32, _auditInputs$input2, _dataInputs$input33, _dataInputs$input34, _dataInputs$input35, _dataInputs$input36, _dataInputs$input37, _dataInputs$input38, _dataInputs$input39, _dataInputs$input40, _dataInputs$input41, _dataInputs$input42, _dataInputs$input43, _auditInputGroup$inpu3, _auditInputGroup$inpu4;
257
259
 
258
260
  return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
259
261
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
260
262
  //disabled={input === 40001}
261
- disabled: (_dataInputs$input25 = dataInputs[input]) === null || _dataInputs$input25 === void 0 ? void 0 : _dataInputs$input25.isApproved,
262
- inputId: (_dataInputs$input26 = dataInputs[input]) === null || _dataInputs$input26 === void 0 ? void 0 : _dataInputs$input26.id,
263
+ disabled: (_dataInputs$input26 = dataInputs[input]) === null || _dataInputs$input26 === void 0 ? void 0 : _dataInputs$input26.isApproved,
264
+ inputId: (_dataInputs$input27 = dataInputs[input]) === null || _dataInputs$input27 === void 0 ? void 0 : _dataInputs$input27.id,
263
265
  version: version,
264
- inputType: inputTypeValue((_dataInputs$input27 = dataInputs[input]) === null || _dataInputs$input27 === void 0 ? void 0 : _dataInputs$input27.type),
265
- label: ((_dataInputs$input28 = dataInputs[input]) === null || _dataInputs$input28 === void 0 ? void 0 : _dataInputs$input28.name) + ((_dataInputs$input29 = dataInputs[input]) !== null && _dataInputs$input29 !== void 0 && _dataInputs$input29.required ? "*" : ""),
266
- value: compare ? (_auditInputs$input2 = auditInputs[input]) === null || _auditInputs$input2 === void 0 ? void 0 : _auditInputs$input2.value : (_dataInputs$input30 = dataInputs[input]) === null || _dataInputs$input30 === void 0 ? void 0 : _dataInputs$input30.value,
266
+ inputType: inputTypeValue((_dataInputs$input28 = dataInputs[input]) === null || _dataInputs$input28 === void 0 ? void 0 : _dataInputs$input28.type),
267
+ label: ((_dataInputs$input29 = dataInputs[input]) === null || _dataInputs$input29 === void 0 ? void 0 : _dataInputs$input29.name) + ((_dataInputs$input30 = dataInputs[input]) !== null && _dataInputs$input30 !== void 0 && _dataInputs$input30.required ? "*" : ""),
268
+ value: (_dataInputs$input31 = dataInputs[input]) !== null && _dataInputs$input31 !== void 0 && _dataInputs$input31.box ? Object.values((_dataInputs$input32 = dataInputs[input]) === null || _dataInputs$input32 === void 0 ? void 0 : _dataInputs$input32.box)[0] : compare ? (_auditInputs$input2 = auditInputs[input]) === null || _auditInputs$input2 === void 0 ? void 0 : _auditInputs$input2.value : (_dataInputs$input33 = dataInputs[input]) === null || _dataInputs$input33 === void 0 ? void 0 : _dataInputs$input33.value,
267
269
  inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
268
270
  articleId: articleId,
269
- isRequired: (_dataInputs$input31 = dataInputs[input]) === null || _dataInputs$input31 === void 0 ? void 0 : _dataInputs$input31.required,
271
+ isRequired: (_dataInputs$input34 = dataInputs[input]) === null || _dataInputs$input34 === void 0 ? void 0 : _dataInputs$input34.required,
272
+ aiGenerated: (_dataInputs$input35 = dataInputs[input]) === null || _dataInputs$input35 === void 0 ? void 0 : _dataInputs$input35.ai_generated,
270
273
  updatedDatasheets: updatedDatasheets,
271
274
  setUpdatedDatasheets: setUpdatedDatasheets,
272
- maxChar: (_dataInputs$input32 = dataInputs[input]) !== null && _dataInputs$input32 !== void 0 && _dataInputs$input32.max_chars ? (_dataInputs$input33 = dataInputs[input]) === null || _dataInputs$input33 === void 0 ? void 0 : _dataInputs$input33.max_chars : 999,
273
- optionList: (_dataInputs$input34 = dataInputs[input]) === null || _dataInputs$input34 === void 0 ? void 0 : _dataInputs$input34.option_list,
274
- description: (_dataInputs$input35 = dataInputs[input]) === null || _dataInputs$input35 === void 0 ? void 0 : _dataInputs$input35.description,
275
+ maxChar: (_dataInputs$input36 = dataInputs[input]) !== null && _dataInputs$input36 !== void 0 && _dataInputs$input36.max_chars ? (_dataInputs$input37 = dataInputs[input]) === null || _dataInputs$input37 === void 0 ? void 0 : _dataInputs$input37.max_chars : 999,
276
+ optionList: (_dataInputs$input38 = dataInputs[input]) === null || _dataInputs$input38 === void 0 ? void 0 : _dataInputs$input38.option_list,
277
+ description: (_dataInputs$input39 = dataInputs[input]) === null || _dataInputs$input39 === void 0 ? void 0 : _dataInputs$input39.description,
275
278
  showTooltip: true,
276
279
  inputGroup: inputGroup,
277
280
  dataInputs: dataInputs,
278
281
  onChange: setUpdatedBoxData,
279
282
  auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
280
- }, index + "-" + ((_dataInputs$input23 = dataInputs[input]) === null || _dataInputs$input23 === void 0 ? void 0 : _dataInputs$input23.value) + "-" + ((_dataInputs$input24 = dataInputs[input]) === null || _dataInputs$input24 === void 0 ? void 0 : _dataInputs$input24.id) + "-" + compare), ((_dataInputs$input36 = dataInputs[input]) === null || _dataInputs$input36 === void 0 ? void 0 : _dataInputs$input36.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
281
- inputId: (_dataInputs$input37 = dataInputs[input]) === null || _dataInputs$input37 === void 0 ? void 0 : _dataInputs$input37.id,
282
- isApproved: (_dataInputs$input38 = dataInputs[input]) === null || _dataInputs$input38 === void 0 ? void 0 : _dataInputs$input38.isApproved,
283
- comment: (_dataInputs$input39 = dataInputs[input]) === null || _dataInputs$input39 === void 0 ? void 0 : _dataInputs$input39.comment,
283
+ }, index + "-" + ((_dataInputs$input24 = dataInputs[input]) === null || _dataInputs$input24 === void 0 ? void 0 : _dataInputs$input24.value) + "-" + ((_dataInputs$input25 = dataInputs[input]) === null || _dataInputs$input25 === void 0 ? void 0 : _dataInputs$input25.id) + "-" + compare), ((_dataInputs$input40 = dataInputs[input]) === null || _dataInputs$input40 === void 0 ? void 0 : _dataInputs$input40.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
284
+ inputId: (_dataInputs$input41 = dataInputs[input]) === null || _dataInputs$input41 === void 0 ? void 0 : _dataInputs$input41.id,
285
+ isApproved: (_dataInputs$input42 = dataInputs[input]) === null || _dataInputs$input42 === void 0 ? void 0 : _dataInputs$input42.isApproved,
286
+ comment: (_dataInputs$input43 = dataInputs[input]) === null || _dataInputs$input43 === void 0 ? void 0 : _dataInputs$input43.comment,
284
287
  handleImgClick: handleImgClick,
285
288
  changeImageBtn: changeImageBtn,
286
289
  showDivState: showDivStates,
@@ -303,6 +306,7 @@ var InputGroup = function InputGroup(_ref) {
303
306
  label: (input === null || input === void 0 ? void 0 : input.name) + (input.required ? "*" : ""),
304
307
  value: compare ? auditInputGroup === null || auditInputGroup === void 0 ? void 0 : (_auditInputGroup$inpu3 = auditInputGroup.inputs[index]) === null || _auditInputGroup$inpu3 === void 0 ? void 0 : _auditInputGroup$inpu3.value : input === null || input === void 0 ? void 0 : input.value,
305
308
  isRequired: input.required,
309
+ aiGenerated: input === null || input === void 0 ? void 0 : input.ai_generated,
306
310
  maxChar: input.max_chars,
307
311
  inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
308
312
  updatedDescriptions: updatedDescriptions,