contentoh-components-library 21.5.92 → 21.5.93

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 (70) hide show
  1. package/dist/components/atoms/GeneralButton/styles.js +1 -1
  2. package/dist/components/atoms/GeneralInput/index.js +54 -245
  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 +12 -13
  8. package/dist/components/molecules/TagAndInput/index.js +24 -361
  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 +362 -368
  15. package/dist/components/pages/ProviderProductEdition/utils.js +0 -1
  16. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +196 -179
  17. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +260 -59
  18. package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +38 -50
  19. package/dist/components/pages/RetailerProductEdition/index.js +2234 -1716
  20. package/dist/components/pages/RetailerProductEdition/styles.js +2 -4
  21. package/dist/components/pages/RetailerProductEdition/utils.js +2 -251
  22. package/dist/contexts/AiProductEdition.js +158 -230
  23. package/package.json +2 -4
  24. package/src/components/atoms/GeneralButton/styles.js +0 -4
  25. package/src/components/atoms/GeneralInput/index.js +60 -237
  26. package/src/components/atoms/GeneralInput/styles.js +0 -81
  27. package/src/components/atoms/InputFormatter/index.js +51 -200
  28. package/src/components/atoms/InputFormatter/styles.js +0 -284
  29. package/src/components/molecules/StatusAsignationInfo/index.js +1 -9
  30. package/src/components/molecules/TabsMenu/index.js +11 -12
  31. package/src/components/molecules/TagAndInput/index.js +21 -286
  32. package/src/components/molecules/TagAndInput/styles.js +17 -59
  33. package/src/components/organisms/FullProductNameHeader/index.js +28 -4
  34. package/src/components/organisms/FullTabsMenu/index.js +1 -1
  35. package/src/components/organisms/InputGroup/index.js +4 -12
  36. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +202 -174
  37. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
  38. package/src/components/pages/ProviderProductEdition/index.js +452 -453
  39. package/src/components/pages/ProviderProductEdition/utils.js +2 -2
  40. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +224 -201
  41. package/src/components/pages/RetailerProductEdition/index.js +1718 -1547
  42. package/src/components/pages/RetailerProductEdition/styles.js +2 -67
  43. package/src/components/pages/RetailerProductEdition/utils.js +0 -240
  44. package/dist/ai/utils/compare-strings.js +0 -45
  45. package/dist/components/organisms/ChangeStatusModal/index.js +0 -531
  46. package/dist/components/organisms/ChangeStatusModal/styles.js +0 -85
  47. package/dist/global-files/statusDictionary.js +0 -103
  48. package/src/ai/utils/compare-strings.js +0 -45
  49. package/src/assets/images/Icons/arrow.png +0 -0
  50. package/src/assets/images/Icons/cancel.png +0 -0
  51. package/src/assets/images/Icons/ia-icon.png +0 -0
  52. package/src/assets/images/Icons/loading.svg +0 -5
  53. package/src/assets/images/Icons/reload.png +0 -0
  54. package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +0 -10
  55. package/src/components/atoms/RetailerSelector/index.js +0 -3
  56. package/src/components/atoms/RetailerSelector/styles.js +0 -0
  57. package/src/components/organisms/ChangeStatusModal/index.jsx +0 -488
  58. package/src/components/organisms/ChangeStatusModal/styles.js +0 -333
  59. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +0 -575
  60. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +0 -62
  61. package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +0 -344
  62. package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +0 -155
  63. package/src/components/pages/RetailerProductEdition/context/reducers/product.js +0 -114
  64. package/src/components/pages/RetailerProductEdition/context/reducers/system.js +0 -60
  65. package/src/components/pages/RetailerProductEdition/index_old.js +0 -1979
  66. package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +0 -101
  67. package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +0 -115
  68. package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +0 -174
  69. package/src/contexts/AiProductEdition.jsx +0 -339
  70. package/src/global-files/statusDictionary.js +0 -103
@@ -47,7 +47,7 @@ var _variables = require("../../../global-files/variables");
47
47
 
48
48
  var _templateObject;
49
49
 
50
- var Container = _styledComponents.default.button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background-color: #e33aa9;\n border: none;\n border-radius: 30px;\n color: #fff;\n font-family: ", ";\n font-style: normal;\n font-weight: normal;\n font-size: 18px;\n line-height: 22px;\n padding: 10px 25px;\n cursor: pointer;\n\n &:hover {\n opacity: 0.7;\n }\n\n &.general-purple-button {\n background-color: #603888;\n }\n\n &.general-pink-button {\n background-color: #E33AA9;\n }\n\n &.general-transparent-button {\n background-color: transparent;\n border: 1px solid #503d66;\n color: #503d66;\n }\n &.general-white-button {\n background-color: ", ";\n color: ", ";\n }\n\n &.general-green-button {\n background-color: #71de56;\n }\n\n &.circular-button {\n width: 25px;\n height: 25px;\n padding: 0;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n\n &.accept-button {\n background-image: url(", ");\n }\n\n &.reject-button {\n background-image: url(", ");\n }\n\n &.null-button {\n background-image: url(", ");\n }\n\n &.save-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n\n &:hover {\n background-image: url(", ");\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.delete-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n background-size: 15px;\n\n &:hover {\n background-image: url(", ");\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.download-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n background-size: 15px;\n\n &:hover {\n color: white;\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.disabled {\n opacity: 0.5;\n }\n\n img {\n width: 100%;\n }\n\n &.version-button {\n color: ", ";\n border: 1px solid ", ";\n border-radius: 15px;\n font-size: 12px;\n line-height: 25px;\n text-align: center;\n filter: brightness(.35);\n }\n }\n\n &.general-arrow-button {\n background-image: url(", ");\n width: 27px;\n height: 27px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n }\n\n &.close-button {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.close-buttonv2 {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.close-button-white {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.open-modal-button {\n background-color: transparent;\n border: none;\n cursor: pointer;\n position: absolute;\n right: 10px;\n bottom: 10px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n width: 21px;\n height: 21px;\n padding: 0;\n border-radius: 0;\n background-image: url(", ");\n }\n\n &.grid-layout,\n &.row-layout {\n background-color: transparent;\n background-repeat: no-repeat;\n width: 24px;\n height: 24px;\n padding: 0;\n }\n\n &.grid-layout {\n background-image: url(", ");\n }\n\n &.row-layout {\n background-image: url(", ");\n }\n\n &.general-button-disabled {\n background-color: grey;\n color: ", ";\n\n &:hover {\n opacity: 1;\n }\n }\n &.general-button-rec {\n background:#85BC5B;\n color: ", ";\n padding: 4px 5px;\n border-radius: 3px;\n font-size: 10px;\n height: 20px;\n line-height: 12px;\n text-align: center;\n }\n\n &.general-button-sol {\n background-color: #e33aa9;\n border: none;\n border-radius: 50px;\n color: ", ";\n height: 34px;\n font-family: Avenir Next;\n font-style: normal;\n font-weight: normal;\n font-size: 12px;\n line-height: 14px;\n padding: 10px 15px;\n cursor: pointer;\n }\n"])), function (props) {
50
+ var Container = _styledComponents.default.button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background-color: #e33aa9;\n border: none;\n border-radius: 30px;\n color: #fff;\n font-family: ", ";\n font-style: normal;\n font-weight: normal;\n font-size: 18px;\n line-height: 22px;\n padding: 10px 25px;\n cursor: pointer;\n\n &:hover {\n opacity: 0.7;\n }\n\n &.general-purple-button {\n background-color: #603888;\n }\n\n &.general-transparent-button {\n background-color: transparent;\n border: 1px solid #503d66;\n color: #503d66;\n }\n &.general-white-button {\n background-color: ", ";\n color: ", ";\n }\n\n &.general-green-button {\n background-color: #71de56;\n }\n\n &.circular-button {\n width: 25px;\n height: 25px;\n padding: 0;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n\n &.accept-button {\n background-image: url(", ");\n }\n\n &.reject-button {\n background-image: url(", ");\n }\n\n &.null-button {\n background-image: url(", ");\n }\n\n &.save-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n\n &:hover {\n background-image: url(", ");\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.delete-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n background-size: 15px;\n\n &:hover {\n background-image: url(", ");\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.download-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n background-size: 15px;\n\n &:hover {\n color: white;\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.disabled {\n opacity: 0.5;\n }\n\n img {\n width: 100%;\n }\n\n &.version-button {\n color: ", ";\n border: 1px solid ", ";\n border-radius: 15px;\n font-size: 12px;\n line-height: 25px;\n text-align: center;\n filter: brightness(.35);\n }\n }\n\n &.general-arrow-button {\n background-image: url(", ");\n width: 27px;\n height: 27px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n }\n\n &.close-button {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.close-buttonv2 {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.close-button-white {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.open-modal-button {\n background-color: transparent;\n border: none;\n cursor: pointer;\n position: absolute;\n right: 10px;\n bottom: 10px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n width: 21px;\n height: 21px;\n padding: 0;\n border-radius: 0;\n background-image: url(", ");\n }\n\n &.grid-layout,\n &.row-layout {\n background-color: transparent;\n background-repeat: no-repeat;\n width: 24px;\n height: 24px;\n padding: 0;\n }\n\n &.grid-layout {\n background-image: url(", ");\n }\n\n &.row-layout {\n background-image: url(", ");\n }\n\n &.general-button-disabled {\n background-color: grey;\n color: ", ";\n\n &:hover {\n opacity: 1;\n }\n }\n &.general-button-rec {\n background:#85BC5B;\n color: ", ";\n padding: 4px 5px;\n border-radius: 3px;\n font-size: 10px;\n height: 20px;\n line-height: 12px;\n text-align: center;\n }\n\n &.general-button-sol {\n background-color: #e33aa9;\n border: none;\n border-radius: 50px;\n color: ", ";\n height: 34px;\n font-family: Avenir Next;\n font-style: normal;\n font-weight: normal;\n font-size: 12px;\n line-height: 14px;\n padding: 10px 15px;\n cursor: pointer;\n }\n"])), function (props) {
51
51
  return props.buttonFont;
52
52
  }, _variables.GlobalColors.s1, _variables.GlobalColors.original_purpura, _acceptIcon.default, _rejectIcon.default, _nullIcon.default, _saveIcon.default, _variables.GlobalColors.color_gray, _saveIconHover.default, _variables.GlobalColors.color_pink, _variables.GlobalColors.color_pink, _deleteIcon.default, _variables.GlobalColors.s3, _deleteIconHover.default, _variables.GlobalColors.magenta_s2, _variables.GlobalColors.magenta_s2, _downloadIcon.default, _variables.GlobalColors.s3, _variables.GlobalColors.magenta_s2, _variables.GlobalColors.magenta_s2, _variables.GlobalColors.color_purple, _variables.GlobalColors.color_purple, _arrowIcon.default, _closeIcon.default, _closeIconv.default, _closeIconWhite.default, _openModal.default, _rowLayout.default, _gridLayout.default, _variables.GlobalColors.white, _variables.GlobalColors.white, _variables.GlobalColors.white);
53
53
 
@@ -17,27 +17,9 @@ var _InputFormatter = require("../InputFormatter");
17
17
 
18
18
  var _CheckBox = require("../CheckBox");
19
19
 
20
- var _iaIcon = _interopRequireDefault(require("../../../assets/images/Icons/ia-icon.png"));
21
-
22
- var _loading = _interopRequireDefault(require("../../../assets/images/Icons/loading.svg"));
23
-
24
- var _arrow = _interopRequireDefault(require("../../../assets/images/Icons/arrow.png"));
25
-
26
- var _cancel = _interopRequireDefault(require("../../../assets/images/Icons/cancel.png"));
27
-
28
- var _reload = _interopRequireDefault(require("../../../assets/images/Icons/reload.png"));
29
-
30
- var _AiProductEdition = require("../../../contexts/AiProductEdition");
31
-
32
- var _styles2 = require("../InputFormatter/styles");
33
-
34
- var _compareStrings = require("../../../ai/utils/compare-strings");
35
-
36
20
  var _jsxRuntime = require("react/jsx-runtime");
37
21
 
38
22
  var GeneralInput = function GeneralInput(_ref) {
39
- var _currentSuggestion$in, _currentSuggestion$in2, _currentSuggestion$in3, _suggestions$inputId2, _currentSuggestion$in4, _suggestions$inputId3;
40
-
41
23
  var inputType = _ref.inputType,
42
24
  inputId = _ref.inputId,
43
25
  inputName = _ref.inputName,
@@ -62,34 +44,7 @@ var GeneralInput = function GeneralInput(_ref) {
62
44
  inputOnChange = _ref.inputOnChange,
63
45
  disabled = _ref.disabled,
64
46
  onKeyDown = _ref.onKeyDown,
65
- auditClass = _ref.auditClass,
66
- _ref$hasAiGeneration = _ref.hasAiGeneration,
67
- hasAiGeneration = _ref$hasAiGeneration === void 0 ? false : _ref$hasAiGeneration,
68
- _ref$isBenefitInput = _ref.isBenefitInput,
69
- isBenefitInput = _ref$isBenefitInput === void 0 ? false : _ref$isBenefitInput,
70
- _ref$isAiGenerationLo = _ref.isAiGenerationLoading,
71
- isAiGenerationLoading = _ref$isAiGenerationLo === void 0 ? false : _ref$isAiGenerationLo,
72
- _ref$isAiRegeneration = _ref.isAiRegenerationLoading,
73
- isAiRegenerationLoading = _ref$isAiRegeneration === void 0 ? false : _ref$isAiRegeneration,
74
- _ref$isAiActive = _ref.isAiActive,
75
- isAiActive = _ref$isAiActive === void 0 ? false : _ref$isAiActive,
76
- _ref$isAiAvailable = _ref.isAiAvailable,
77
- isAiAvailable = _ref$isAiAvailable === void 0 ? false : _ref$isAiAvailable,
78
- _ref$aiGenerated = _ref.aiGenerated,
79
- aiGenerated = _ref$aiGenerated === void 0 ? false : _ref$aiGenerated,
80
- _ref$setIsAiActive = _ref.setIsAiActive,
81
- setIsAiActive = _ref$setIsAiActive === void 0 ? function () {} : _ref$setIsAiActive,
82
- _ref$handlerAiGenerat = _ref.handlerAiGeneration,
83
- _handlerAiGeneration = _ref$handlerAiGenerat === void 0 ? function () {} : _ref$handlerAiGenerat,
84
- _ref$handlerRegenerat = _ref.handlerRegenerateSuggestions,
85
- _handlerRegenerateSuggestions = _ref$handlerRegenerat === void 0 ? function () {} : _ref$handlerRegenerat,
86
- _ref$handleChangeSugg = _ref.handleChangeSuggestion,
87
- handleChangeSuggestion = _ref$handleChangeSugg === void 0 ? function () {} : _ref$handleChangeSugg;
88
-
89
- var _useAiProductEdition = (0, _AiProductEdition.useAiProductEdition)(),
90
- suggestions = _useAiProductEdition.suggestions,
91
- currentSuggestion = _useAiProductEdition.currentSuggestion,
92
- setCurrentSuggestionValue = _useAiProductEdition.setCurrentSuggestionValue;
47
+ auditClass = _ref.auditClass;
93
48
 
94
49
  var _useState = (0, _react.useState)({
95
50
  value: inputValue
@@ -103,27 +58,28 @@ var GeneralInput = function GeneralInput(_ref) {
103
58
  requiredEmpty = _useState4[0],
104
59
  setRequiredEmpty = _useState4[1];
105
60
 
106
- var _useState5 = (0, _react.useState)(false),
107
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
108
- aiSuggestionAccepted = _useState6[0],
109
- setAiSuggestionAccepted = _useState6[1];
110
-
111
- var _useState7 = (0, _react.useState)(inputValue),
112
- _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
113
- valueAccepted = _useState8[0],
114
- setValueAccepted = _useState8[1];
61
+ var onHandleChange = function onHandleChange(evt) {
62
+ if (validateInput) {
63
+ setTextValue({
64
+ value: validateInput(evt, position, inputsArray)
65
+ });
66
+ } else if (updatedDatasheets || updatedDescriptions || inputType === "textarea") {
67
+ var generalValue;
115
68
 
116
- var updateParentData = function updateParentData(generalValue, isAiAccepted) {
117
- var newBaseValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
118
- setTextValue({
119
- value: generalValue
120
- });
121
- var baseToCompare = newBaseValue !== null ? newBaseValue : valueAccepted;
122
- var similarity = (0, _compareStrings.getTextSimilarityPercentage)(baseToCompare, generalValue);
123
- var generatedWithAi = (isAiAccepted || aiGenerated) && similarity >= 50;
69
+ if ((optionList === null || optionList === void 0 ? void 0 : optionList.length) > 0) {
70
+ var valueSelected = evt.target.value;
71
+ generalValue = valueSelected;
72
+ setTextValue({
73
+ value: generalValue
74
+ });
75
+ } else {
76
+ generalValue = inputType === "checkbox" ? evt.target.checked : evt.target.value;
77
+ setTextValue({
78
+ value: generalValue
79
+ });
80
+ }
124
81
 
125
- if (updatedDatasheets || updatedDescriptions || inputType === "textarea") {
126
- var dataSave = (updatedDatasheets === null || updatedDatasheets === void 0 ? void 0 : updatedDatasheets.slice()) || [];
82
+ var dataSave = updatedDatasheets === null || updatedDatasheets === void 0 ? void 0 : updatedDatasheets.slice();
127
83
 
128
84
  if ((dataSave === null || dataSave === void 0 ? void 0 : dataSave.length) > 0) {
129
85
  var index = dataSave.findIndex(function (e) {
@@ -131,52 +87,25 @@ var GeneralInput = function GeneralInput(_ref) {
131
87
  });
132
88
 
133
89
  if (index !== -1) {
134
- if (generalValue !== inputValue) {
135
- dataSave[index].value = generalValue;
136
- dataSave[index].aiSuggestionAccepted = generatedWithAi;
137
- } else {
138
- dataSave.splice(index, 1);
139
- }
90
+ if (generalValue !== inputValue) dataSave[index].value = generalValue;else dataSave.splice(index, 1);
140
91
  } else {
141
- if (generalValue !== inputValue) {
142
- dataSave.push({
143
- articleId: articleId,
144
- attributeId: inputId,
145
- value: generalValue,
146
- aiSuggestionAccepted: generatedWithAi
147
- });
148
- }
92
+ dataSave.push({
93
+ articleId: articleId,
94
+ attributeId: inputId,
95
+ value: generalValue
96
+ });
149
97
  }
150
98
  } else {
151
99
  if (generalValue !== inputValue) {
152
100
  dataSave.push({
153
101
  articleId: articleId,
154
102
  attributeId: inputId,
155
- value: generalValue,
156
- aiSuggestionAccepted: generatedWithAi
103
+ value: generalValue
157
104
  });
158
105
  }
159
106
  }
160
107
 
161
108
  setUpdatedDatasheets(dataSave);
162
- }
163
- };
164
-
165
- var onHandleChange = function onHandleChange(evt) {
166
- if (validateInput) {
167
- setTextValue({
168
- value: validateInput(evt, position, inputsArray)
169
- });
170
- } else if (updatedDatasheets || updatedDescriptions || inputType === "textarea") {
171
- var generalValue;
172
-
173
- if ((optionList === null || optionList === void 0 ? void 0 : optionList.length) > 0) {
174
- generalValue = evt.target.value;
175
- } else {
176
- generalValue = inputType === "checkbox" ? evt.target.checked : evt.target.value;
177
- }
178
-
179
- updateParentData(generalValue, aiSuggestionAccepted);
180
109
  } else {
181
110
  setTextValue({
182
111
  value: evt.target.value
@@ -185,50 +114,21 @@ var GeneralInput = function GeneralInput(_ref) {
185
114
  }
186
115
  };
187
116
 
188
- (0, _react.useEffect)(function () {
189
- var _suggestions$inputId;
190
-
191
- if (Object.keys(suggestions).length === 0) return;
192
- if (currentSuggestion !== null && currentSuggestion !== void 0 && currentSuggestion[inputId]) return;
193
- var firstSuggestion = suggestions === null || suggestions === void 0 ? void 0 : (_suggestions$inputId = suggestions[inputId]) === null || _suggestions$inputId === void 0 ? void 0 : _suggestions$inputId[0];
194
- if (!firstSuggestion) return;
195
- setCurrentSuggestionValue({
196
- inputId: inputId,
197
- index: 0,
198
- value: firstSuggestion === null || firstSuggestion === void 0 ? void 0 : firstSuggestion.value
199
- });
200
- }, [suggestions]);
201
- (0, _react.useEffect)(function () {
202
- if (!isAiActive) return;
203
- setAiSuggestionAccepted(false);
204
- }, [isAiActive]);
205
- (0, _react.useEffect)(function () {
206
- if (!isAiActive && !aiSuggestionAccepted) {
207
- setTextValue({
208
- value: valueAccepted
209
- });
210
- }
211
- }, [suggestions, isAiActive]);
212
117
  (0, _react.useEffect)(function () {
213
118
  var _textValue$value;
214
119
 
215
120
  setRequiredEmpty(isRequired && (((_textValue$value = textValue.value) === null || _textValue$value === void 0 ? void 0 : _textValue$value.length) === 0 || textValue.value === undefined));
216
- }, [textValue]); // const numberInputOnWheelPreventChange = (e) => {
217
- // // Prevent the input value change
218
- // e.target.blur();
219
- // // Prevent the page/container scrolling
220
- // e.stopPropagation();
221
- // // Refocus immediately, on the next tick (after the current function is done)
222
- // setTimeout(() => e.target.focus(), 0);
223
- // };
224
- //AI Generation
121
+ }, [textValue]);
122
+
123
+ var numberInputOnWheelPreventChange = function numberInputOnWheelPreventChange(e) {
124
+ // Prevent the input value change
125
+ e.target.blur(); // Prevent the page/container scrolling
126
+
127
+ e.stopPropagation(); // Refocus immediately, on the next tick (after the current function is done)
225
128
 
226
- var handleAcceptSuggestion = function handleAcceptSuggestion(suggestionValue) {
227
- if (!suggestionValue) return;
228
- setValueAccepted(suggestionValue);
229
- setAiSuggestionAccepted(true);
230
- setIsAiActive(false);
231
- updateParentData(suggestionValue, true, suggestionValue);
129
+ setTimeout(function () {
130
+ return e.target.focus();
131
+ }, 0);
232
132
  };
233
133
 
234
134
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
@@ -257,94 +157,21 @@ var GeneralInput = function GeneralInput(_ref) {
257
157
  },
258
158
  defaultChecked: textValue.value === "true" ? true : false,
259
159
  disabled: disabled
260
- }) : inputType !== "textarea" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
261
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles2.InputContainer, {
262
- className: hasAiGeneration ? "ai-generation" : "",
263
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
264
- type: inputType,
265
- disabled: disabled,
266
- id: inputId,
267
- size: inputSize,
268
- className: "general-input ".concat(isAiActive && isBenefitInput && "ia-input"),
269
- placeholder: inputPlaceholder,
270
- value: isAiActive ? currentSuggestion === null || currentSuggestion === void 0 ? void 0 : (_currentSuggestion$in = currentSuggestion[inputId]) === null || _currentSuggestion$in === void 0 ? void 0 : _currentSuggestion$in.value : textValue.value,
271
- onInput: function onInput(e) {
272
- return onHandleChange(e);
273
- },
274
- maxLength: maxChar,
275
- required: isRequired,
276
- onKeyDown: onKeyDown // onWheel={numberInputOnWheelPreventChange}
277
-
278
- }), hasAiGeneration && isBenefitInput && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
279
- className: "icon_container ".concat(isAiAvailable ? "ai-available" : '', " ").concat(isAiActive ? 'ai-active' : ''),
280
- title: !isAiAvailable ? 'Debes de completar ficha técnica e imágenes para desbloquear la generación con IA' : '',
281
- onClick: function onClick() {
282
- _handlerAiGeneration({
283
- type: "attribute"
284
- });
285
- },
286
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
287
- className: "".concat(isAiGenerationLoading ? 'loading' : ''),
288
- src: isAiGenerationLoading ? _loading.default : isAiActive ? _cancel.default : _iaIcon.default
289
- })
290
- })]
291
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles2.BottomContainer, {
292
- className: isAiActive ? "with-ai" : "",
293
- children: isAiActive && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
294
- className: "ai-options",
295
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles2.OptionsContainer, {
296
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
297
- className: "arrow ".concat((currentSuggestion === null || currentSuggestion === void 0 ? void 0 : (_currentSuggestion$in2 = currentSuggestion[inputId]) === null || _currentSuggestion$in2 === void 0 ? void 0 : _currentSuggestion$in2.index) === 0 && "disabled"),
298
- onClick: function onClick() {
299
- handleChangeSuggestion({
300
- action: "prev"
301
- });
302
- },
303
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
304
- src: _arrow.default,
305
- alt: ""
306
- })
307
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
308
- children: [(currentSuggestion === null || currentSuggestion === void 0 ? void 0 : (_currentSuggestion$in3 = currentSuggestion[inputId]) === null || _currentSuggestion$in3 === void 0 ? void 0 : _currentSuggestion$in3.index) + 1 || 1, "/", suggestions === null || suggestions === void 0 ? void 0 : (_suggestions$inputId2 = suggestions[inputId]) === null || _suggestions$inputId2 === void 0 ? void 0 : _suggestions$inputId2.length]
309
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
310
- className: "arrow right ".concat((currentSuggestion === null || currentSuggestion === void 0 ? void 0 : (_currentSuggestion$in4 = currentSuggestion[inputId]) === null || _currentSuggestion$in4 === void 0 ? void 0 : _currentSuggestion$in4.index) === (suggestions === null || suggestions === void 0 ? void 0 : (_suggestions$inputId3 = suggestions[inputId]) === null || _suggestions$inputId3 === void 0 ? void 0 : _suggestions$inputId3.length) - 1 && "disabled"),
311
- onClick: function onClick() {},
312
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
313
- onClick: function onClick() {
314
- handleChangeSuggestion({
315
- action: "next"
316
- });
317
- },
318
- src: _arrow.default,
319
- alt: "ai icon"
320
- })
321
- })]
322
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles2.ButtonsContainer, {
323
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
324
- className: "reload-suggestions ".concat(isAiRegenerationLoading && "loading"),
325
- onClick: function onClick() {
326
- _handlerRegenerateSuggestions({
327
- type: "attribute"
328
- });
329
- },
330
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
331
- className: "",
332
- src: isAiRegenerationLoading ? _loading.default : _reload.default
333
- })
334
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
335
- className: "accept-suggestion",
336
- onClick: function onClick() {
337
- var _currentSuggestion$in5;
338
-
339
- handleAcceptSuggestion(currentSuggestion === null || currentSuggestion === void 0 ? void 0 : (_currentSuggestion$in5 = currentSuggestion[inputId]) === null || _currentSuggestion$in5 === void 0 ? void 0 : _currentSuggestion$in5.value);
340
- },
341
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
342
- children: "Aceptar sugerencia"
343
- })
344
- })]
345
- })]
346
- })
347
- })]
160
+ }) : inputType !== "textarea" ? /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
161
+ type: inputType,
162
+ disabled: disabled,
163
+ id: inputId,
164
+ size: inputSize,
165
+ className: "general-input",
166
+ placeholder: inputPlaceholder,
167
+ value: textValue.value,
168
+ onInput: function onInput(e) {
169
+ return onHandleChange(e);
170
+ },
171
+ maxLength: maxChar,
172
+ required: isRequired,
173
+ onKeyDown: onKeyDown,
174
+ onWheel: numberInputOnWheelPreventChange
348
175
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputFormatter.InputFormatter, {
349
176
  name: inputName,
350
177
  inputId: inputId,
@@ -356,25 +183,7 @@ var GeneralInput = function GeneralInput(_ref) {
356
183
  setUpdatedDescriptions: setUpdatedDescriptions,
357
184
  maxChar: maxChar,
358
185
  isRequired: isRequired,
359
- disabled: disabled,
360
- hasAiGeneration: hasAiGeneration && inputId != 'commentary-box',
361
- isAiAvailable: isAiAvailable,
362
- aiGenerated: aiGenerated,
363
- handlerAiGeneration: function handlerAiGeneration() {
364
- _handlerAiGeneration({
365
- type: "description"
366
- });
367
- },
368
- handlerRegenerateSuggestions: function handlerRegenerateSuggestions() {
369
- _handlerRegenerateSuggestions({
370
- type: "description"
371
- });
372
- },
373
- handleChangeSuggestion: handleChangeSuggestion,
374
- isAiGenerationLoading: isAiGenerationLoading,
375
- isAiRegenerationLoading: isAiRegenerationLoading,
376
- isAiActive: isAiActive,
377
- setIsAiActive: setIsAiActive
186
+ disabled: disabled
378
187
  })
379
188
  });
380
189
  };
@@ -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.InputContainer = exports.Container = void 0;
8
+ exports.Container = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
11
 
@@ -13,7 +13,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
14
  var _variables = require("../../../global-files/variables");
15
15
 
16
- var _templateObject, _templateObject2;
16
+ var _templateObject;
17
17
 
18
18
  var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n\n > div {\n label {\n &:before {\n outline: 1px solid ", ";\n }\n }\n }\n\n input,\n textarea {\n width: 100%;\n border: 1px solid\n ", ";\n\n font-family: ", ";\n color: ", ";\n font-weight: normal;\n font-size: 12px;\n line-height: 15px;\n padding: 10px;\n outline: none;\n border-radius: 5px;\n resize: none;\n\n &:focus {\n border: 1px solid ", ";\n }\n }\n\n select {\n background: #fafafa;\n outline: none;\n border: 1px solid\n ", ";\n width: 100%;\n cursor: pointer;\n font-family: ", ";\n color: ", ";\n font-size: 12px;\n line-height: 21px;\n padding: 10px;\n border-right: 2px solid #e33aa9;\n\n &:focus {\n border: 1px solid ", ";\n }\n }\n\n p {\n font-family: ", ";\n font-size: 12px;\n color: ", ";\n }\n\n &.audit-class {\n input,\n .quill {\n border: 1px solid #8a6caa;\n background-color: #ededfc;\n }\n }\n\n .btnReviewState {\n display: \"flex\";\n flex-direction: \"column\";\n border: 1px solid lightgray;\n border-radius: 3px;\n z-index: 1000;\n /* position: absolute; */\n }\n\n .btnReviewState button {\n border: none;\n background: white;\n border-radius: 3px;\n }\n .btnReviewState button:hover {\n background: lightgray;\n }\n"])), function (_ref) {
19
19
  var isRequired = _ref.isRequired;
@@ -26,8 +26,4 @@ var Container = _styledComponents.default.div(_templateObject || (_templateObjec
26
26
  return isRequired ? "red" : "".concat(_variables.GlobalColors.s2);
27
27
  }, _variables.FontFamily.AvenirNext, _variables.GlobalColors.deep_gray, _variables.GlobalColors.magenta_s2, _variables.FontFamily.Raleway, _variables.GlobalColors.deep_gray);
28
28
 
29
- exports.Container = Container;
30
-
31
- var InputContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\n &.ai-generation {\n position: relative;\n\n cursor: pointer;\n\n .ia-input {\n padding-right: 2.5rem;\n }\n\n .icon_container {\n position: absolute;\n right: 10px;\n top: 50%;\n transform: translateY(-50%);\n width: 20px;\n height: 20px;\n padding: 4px;\n\n border-radius: 50%;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1;\n\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n background: linear-gradient(\n 120deg,\n #ffffff 10%,\n #ffe0f4 50%,\n #ffffff 90%\n );\n background-size: 200% 200%;\n\n animation: ai-shimmer 3s ease-in-out infinite alternate;\n z-index: -1;\n }\n\n &.ai-available::before{\n\n background: gray;\n background-size: 200% 200%;\n\n }\n\n img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n position: relative;\n z-index: 2;\n }\n\n img.loading {\n width: 20px;\n height: 20px;\n }\n\n }\n }\n\n @keyframes ai-shimmer {\n 0% {\n background-position: 0% 50%;\n }\n 100% {\n background-position: 100% 50%;\n }\n }\n\n"])));
32
-
33
- exports.InputContainer = InputContainer;
29
+ exports.Container = Container;