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
@@ -17,25 +17,9 @@ var _react = require("react");
17
17
 
18
18
  var _styles = require("./styles");
19
19
 
20
- var _iaIcon = _interopRequireDefault(require("../../../assets/images/Icons/ia-icon.png"));
21
-
22
- var _arrow = _interopRequireDefault(require("../../../assets/images/Icons/arrow.png"));
23
-
24
- var _loading = _interopRequireDefault(require("../../../assets/images/Icons/loading.svg"));
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 _compareStrings = require("../../../ai/utils/compare-strings");
33
-
34
20
  var _jsxRuntime = require("react/jsx-runtime");
35
21
 
36
22
  var InputFormatter = function InputFormatter(_ref) {
37
- var _currentSuggestion$in, _currentSuggestion$in2, _currentSuggestion$in3, _suggestions$inputId, _currentSuggestion$in4, _suggestions$inputId2;
38
-
39
23
  var _ref$mainValue = _ref.mainValue,
40
24
  mainValue = _ref$mainValue === void 0 ? "" : _ref$mainValue,
41
25
  inputId = _ref.inputId,
@@ -44,69 +28,35 @@ var InputFormatter = function InputFormatter(_ref) {
44
28
  setUpdatedDescriptions = _ref.setUpdatedDescriptions,
45
29
  isRequired = _ref.isRequired,
46
30
  maxChar = _ref.maxChar,
47
- disabled = _ref.disabled,
48
- _ref$hasAiGeneration = _ref.hasAiGeneration,
49
- hasAiGeneration = _ref$hasAiGeneration === void 0 ? false : _ref$hasAiGeneration,
50
- _ref$isAiGenerationLo = _ref.isAiGenerationLoading,
51
- isAiGenerationLoading = _ref$isAiGenerationLo === void 0 ? false : _ref$isAiGenerationLo,
52
- _ref$isAiRegeneration = _ref.isAiRegenerationLoading,
53
- isAiRegenerationLoading = _ref$isAiRegeneration === void 0 ? false : _ref$isAiRegeneration,
54
- _ref$isAiActive = _ref.isAiActive,
55
- isAiActive = _ref$isAiActive === void 0 ? false : _ref$isAiActive,
56
- _ref$isAiAvailable = _ref.isAiAvailable,
57
- isAiAvailable = _ref$isAiAvailable === void 0 ? false : _ref$isAiAvailable,
58
- _ref$aiGenerated = _ref.aiGenerated,
59
- aiGenerated = _ref$aiGenerated === void 0 ? false : _ref$aiGenerated,
60
- _ref$setIsAiActive = _ref.setIsAiActive,
61
- setIsAiActive = _ref$setIsAiActive === void 0 ? function () {} : _ref$setIsAiActive,
62
- _ref$handlerAiGenerat = _ref.handlerAiGeneration,
63
- handlerAiGeneration = _ref$handlerAiGenerat === void 0 ? function () {} : _ref$handlerAiGenerat,
64
- _ref$handlerRegenerat = _ref.handlerRegenerateSuggestions,
65
- handlerRegenerateSuggestions = _ref$handlerRegenerat === void 0 ? function () {} : _ref$handlerRegenerat,
66
- _ref$handleChangeSugg = _ref.handleChangeSuggestion,
67
- handleChangeSuggestion = _ref$handleChangeSugg === void 0 ? function () {} : _ref$handleChangeSugg;
31
+ disabled = _ref.disabled;
68
32
 
69
- var _useAiProductEdition = (0, _AiProductEdition.useAiProductEdition)(),
70
- suggestions = _useAiProductEdition.suggestions,
71
- currentSuggestion = _useAiProductEdition.currentSuggestion;
72
-
73
- var _useState = (0, _react.useState)(false),
33
+ var _useState = (0, _react.useState)(mainValue),
74
34
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
75
- aiSuggestionAccepted = _useState2[0],
76
- setAiSuggestionAccepted = _useState2[1];
35
+ inputValue = _useState2[0],
36
+ setInputValue = _useState2[1];
77
37
 
78
- var _useState3 = (0, _react.useState)(mainValue),
38
+ var _useState3 = (0, _react.useState)(false),
79
39
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
80
- valueAccepted = _useState4[0],
81
- setValueAccepted = _useState4[1];
40
+ selection = _useState4[0],
41
+ setSelection = _useState4[1];
82
42
 
83
- var _useState5 = (0, _react.useState)(mainValue),
84
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
85
- inputValue = _useState6[0],
86
- setInputValue = _useState6[1];
87
-
88
- var _useState7 = (0, _react.useState)(false),
89
- _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
90
- selection = _useState8[0],
91
- setSelection = _useState8[1];
92
-
93
- var _useState9 = (0, _react.useState)({
43
+ var _useState5 = (0, _react.useState)({
94
44
  left: 0,
95
45
  top: 0
96
46
  }),
97
- _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
98
- position = _useState10[0],
99
- setPosition = _useState10[1];
47
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
48
+ position = _useState6[0],
49
+ setPosition = _useState6[1];
100
50
 
101
- var _useState11 = (0, _react.useState)(0),
102
- _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
103
- charsCounter = _useState12[0],
104
- setCharsCounter = _useState12[1];
51
+ var _useState7 = (0, _react.useState)(0),
52
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
53
+ charsCounter = _useState8[0],
54
+ setCharsCounter = _useState8[1];
105
55
 
106
- var _useState13 = (0, _react.useState)({}),
107
- _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
108
- quillState = _useState14[0],
109
- setQuillState = _useState14[1];
56
+ var _useState9 = (0, _react.useState)({}),
57
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
58
+ quillState = _useState10[0],
59
+ setQuillState = _useState10[1];
110
60
 
111
61
  var maxLength = maxChar ? maxChar : 999;
112
62
 
@@ -147,50 +97,37 @@ var InputFormatter = function InputFormatter(_ref) {
147
97
 
148
98
  setCharsCounter(h.getLength() - 1);
149
99
  value = valueFormater(value);
150
- updateParentDescriptions(value, aiSuggestionAccepted);
151
- };
152
100
 
153
- var updateParentDescriptions = function updateParentDescriptions(finalValue, isAiAccepted) {
154
- if (!updatedDescriptions) return;
155
- var idInput = inputId;
156
- var dataSave = updatedDescriptions === null || updatedDescriptions === void 0 ? void 0 : updatedDescriptions.slice();
157
- var similarity = (0, _compareStrings.getTextSimilarityPercentage)(valueAccepted, inputValue);
158
- var generatedWithAi = isAiAccepted || aiGenerated && similarity >= 50;
101
+ if (updatedDescriptions) {
102
+ var idInput = inputId;
103
+ var dataSave = updatedDescriptions === null || updatedDescriptions === void 0 ? void 0 : updatedDescriptions.slice();
159
104
 
160
- if ((dataSave === null || dataSave === void 0 ? void 0 : dataSave.length) > 0) {
161
- var index = dataSave.findIndex(function (e) {
162
- return e.attributeId === idInput;
163
- });
105
+ if ((dataSave === null || dataSave === void 0 ? void 0 : dataSave.length) > 0) {
106
+ var index = dataSave.findIndex(function (e) {
107
+ return e.attributeId === idInput;
108
+ });
164
109
 
165
- if (index !== -1) {
166
- if (finalValue !== mainValue) {
167
- dataSave[index].value = finalValue;
168
- dataSave[index].aiSuggestionAccepted = generatedWithAi;
110
+ if (index !== -1) {
111
+ if (value !== mainValue) dataSave[index].value = value;else dataSave.splice(index, 1);
169
112
  } else {
170
- dataSave.splice(index, 1);
113
+ dataSave.push({
114
+ articleId: articleId,
115
+ attributeId: idInput,
116
+ value: value
117
+ });
171
118
  }
172
119
  } else {
173
- if (finalValue !== mainValue) {
120
+ if (value !== mainValue) {
174
121
  dataSave.push({
175
122
  articleId: articleId,
176
123
  attributeId: idInput,
177
- value: finalValue,
178
- aiSuggestionAccepted: generatedWithAi
124
+ value: value
179
125
  });
180
126
  }
181
127
  }
182
- } else {
183
- if (finalValue !== mainValue) {
184
- dataSave.push({
185
- articleId: articleId,
186
- attributeId: idInput,
187
- value: finalValue,
188
- aiSuggestionAccepted: generatedWithAi
189
- });
190
- }
191
- }
192
128
 
193
- setUpdatedDescriptions(dataSave);
129
+ setUpdatedDescriptions(dataSave);
130
+ }
194
131
  };
195
132
 
196
133
  var getSelection = function getSelection(range, a, b) {
@@ -205,135 +142,43 @@ var InputFormatter = function InputFormatter(_ref) {
205
142
  });
206
143
  setSelection((selected === null || selected === void 0 ? void 0 : selected.length) > 0);
207
144
  }
208
- }; //AI Generation
209
-
210
-
211
- var handleAcceptSuggestion = function handleAcceptSuggestion(suggestionValue) {
212
- if (!suggestionValue) return;
213
- setInputValue(suggestionValue);
214
- setValueAccepted(suggestionValue);
215
- setAiSuggestionAccepted(true);
216
- setIsAiActive(false); // Formateamos el valor sugerido igual que en el onChange
217
-
218
- var formattedSuggestion = valueFormater(suggestionValue); // Disparamos la actualización enviando "true" directamente
219
-
220
- updateParentDescriptions(formattedSuggestion, true);
221
145
  };
222
146
 
223
- (0, _react.useEffect)(function () {
224
- // Comprueba cuando la función de IA se cierra y no se acepto una sugerencia
225
- // Devuelve el valor inicial
226
- if (!isAiActive && !aiSuggestionAccepted) return setInputValue(valueAccepted);
227
- }, [suggestions, isAiActive]);
228
- (0, _react.useEffect)(function () {
229
- if (!isAiActive) return; // Comprueba si la sugerencia fue aceptada
230
-
231
- setAiSuggestionAccepted(false);
232
- }, [isAiActive]); //End Ai Generation
233
-
234
147
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
235
148
  isRequired: isRequired && (inputValue.replace(/<.*?>/gm, "").length === 0 || !inputValue),
236
149
  selection: selection,
237
150
  position: position,
238
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputContainer, {
239
- className: hasAiGeneration ? "ai-generation" : "",
240
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactQuill.default, {
241
- id: inputId + "",
242
- ref: function ref(el) {
243
- return setQuill(el);
244
- },
245
- value: isAiActive ? currentSuggestion === null || currentSuggestion === void 0 ? void 0 : (_currentSuggestion$in = currentSuggestion[inputId]) === null || _currentSuggestion$in === void 0 ? void 0 : _currentSuggestion$in.value : getValue(inputValue),
246
- readOnly: isAiActive || disabled,
247
- modules: {
248
- toolbar: false
249
- },
250
- onKeyPress: function onKeyPress(e) {
251
- if (charsCounter >= maxLength && e.key !== "Backspace") {
252
- e.preventDefault();
253
- }
254
- },
255
- onKeyDown: function onKeyDown(e) {
256
- var keysArray = ["Backspace", "Meta", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"];
257
-
258
- if (charsCounter >= maxLength && keysArray.every(function (key) {
259
- return e.key !== key;
260
- })) {
261
- e.preventDefault();
262
- }
263
- },
264
- onChange: function onChange(valueInput, user, range, h) {
265
- return _onChange(valueInput, h);
266
- },
267
- onChangeSelection: getSelection,
268
- className: "quill ".concat(hasAiGeneration && "has-ai", " ").concat(isAiActive && "ai-generation")
269
- }), hasAiGeneration && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
270
- className: "icon_container ".concat(isAiActive ? "ai-active" : '', " ").concat(isAiAvailable ? "ai-available" : ''),
271
- title: !isAiAvailable ? 'Debes de completar ficha técnica e imágenes para desbloquear la generación con IA' : '',
272
- onClick: handlerAiGeneration,
273
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
274
- className: isAiGenerationLoading ? "loading" : "",
275
- src: isAiGenerationLoading ? _loading.default : isAiActive ? _cancel.default : _iaIcon.default
276
- })
277
- })]
278
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.BottomContainer, {
279
- className: isAiActive ? "with-ai" : "",
280
- children: [isAiActive && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
281
- className: "ai-options",
282
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.OptionsContainer, {
283
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
284
- 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"),
285
- onClick: function onClick() {
286
- handleChangeSuggestion({
287
- action: "prev"
288
- });
289
- },
290
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
291
- src: _arrow.default,
292
- alt: ""
293
- })
294
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
295
- 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$inputId = suggestions[inputId]) === null || _suggestions$inputId === void 0 ? void 0 : _suggestions$inputId.length]
296
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
297
- 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$inputId2 = suggestions[inputId]) === null || _suggestions$inputId2 === void 0 ? void 0 : _suggestions$inputId2.length) - 1 && "disabled"),
298
- onClick: function onClick() {},
299
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
300
- onClick: function onClick() {
301
- handleChangeSuggestion({
302
- action: "next"
303
- });
304
- },
305
- src: _arrow.default,
306
- alt: "ai icon"
307
- })
308
- })]
309
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ButtonsContainer, {
310
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
311
- className: "reload-suggestions ".concat(isAiRegenerationLoading && "loading"),
312
- onClick: function onClick() {
313
- handlerRegenerateSuggestions({
314
- type: "description"
315
- });
316
- },
317
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
318
- className: "",
319
- src: isAiRegenerationLoading ? _loading.default : _reload.default
320
- })
321
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
322
- className: "accept-suggestion",
323
- onClick: function onClick() {
324
- var _currentSuggestion$in5;
325
-
326
- handleAcceptSuggestion(currentSuggestion === null || currentSuggestion === void 0 ? void 0 : (_currentSuggestion$in5 = currentSuggestion[inputId]) === null || _currentSuggestion$in5 === void 0 ? void 0 : _currentSuggestion$in5.value);
327
- },
328
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
329
- children: "Aceptar sugerencia"
330
- })
331
- })]
332
- })]
333
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
334
- className: "description-limit",
335
- children: [charsCounter, "/", maxLength]
336
- })]
151
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactQuill.default, {
152
+ id: inputId + "",
153
+ ref: function ref(el) {
154
+ return setQuill(el);
155
+ },
156
+ defaultValue: getValue(inputValue),
157
+ readOnly: disabled,
158
+ modules: {
159
+ toolbar: ["bold"]
160
+ },
161
+ onKeyPress: function onKeyPress(e) {
162
+ if (charsCounter >= maxLength && e.key !== "Backspace") {
163
+ e.preventDefault();
164
+ }
165
+ },
166
+ onKeyDown: function onKeyDown(e) {
167
+ var keysArray = ["Backspace", "Meta", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"];
168
+
169
+ if (charsCounter >= maxLength && keysArray.every(function (key) {
170
+ return e.key !== key;
171
+ })) {
172
+ e.preventDefault();
173
+ }
174
+ },
175
+ onChange: function onChange(valueInput, user, range, h) {
176
+ return _onChange(valueInput, h);
177
+ },
178
+ onChangeSelection: getSelection
179
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
180
+ className: "description-limit",
181
+ children: [charsCounter, "/", maxLength]
337
182
  })]
338
183
  });
339
184
  };
@@ -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.OptionsContainer = exports.InputContainer = exports.Container = exports.ButtonsContainer = exports.BottomContainer = void 0;
8
+ exports.Container = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
11
 
@@ -13,9 +13,9 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
14
  var _variables = require("../../../global-files/variables");
15
15
 
16
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
16
+ var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .quill {\n background-color: ", ";\n border: 1px solid\n ", ";\n position: relative;\n border-radius: 5px;\n\n &.has-ai {\n .ql-container {\n padding-right: 2.5rem;\n }\n }\n\n &.ai-generation {\n\n .ql-container {\n border: 1px solid #3F8AED;\n border-radius: 5px;\n background-color: rgba(59, 147, 224, 0.05);\n margin: 5px;\n margin-right: 2.5rem;\n }\n\n }\n\n .ql-toolbar {\n background-color: ", ";\n position: absolute;\n z-index: 10;\n border: 1px solid ", ";\n width: 45px;\n height: 45px;\n border-radius: 4px;\n visibility: ", ";\n top: ", "px;\n left: ", "px;\n }\n\n .ql-container {\n border: none;\n font-family: ", ";\n color: ", ";\n strong {\n font-family: ", ";\n }\n\n .ql-editor{\n padding: 8px 10px;\n }\n }\n }\n .description-limit {\n font-size: 12px;\n font-family: ", ";\n color: ", ";\n text-align: right;\n margin-top: 5px;\n }\n"])), _variables.GlobalColors.white, function (_ref) {
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .quill {\n background-color: ", ";\n border: 1px solid\n ", ";\n position: relative;\n border-radius: 5px;\n\n .ql-toolbar {\n background-color: ", ";\n position: absolute;\n z-index: 10;\n border: 1px solid ", ";\n width: 45px;\n height: 45px;\n border-radius: 4px;\n visibility: ", ";\n top: ", "px;\n left: ", "px;\n }\n\n .ql-container {\n border: none;\n font-family: ", ";\n color: ", ";\n strong {\n font-family: ", ";\n }\n\n .ql-editor{\n padding: 8px 10px;\n }\n }\n }\n .description-limit {\n font-size: 12px;\n font-family: ", ";\n color: ", ";\n text-align: right;\n margin-top: 5px;\n }\n"])), _variables.GlobalColors.white, function (_ref) {
19
19
  var focus = _ref.focus,
20
20
  isRequired = _ref.isRequired;
21
21
  return focus ? _variables.GlobalColors.magenta_s2 : isRequired ? "red" : _variables.GlobalColors.gray_light;
@@ -30,20 +30,4 @@ var Container = _styledComponents.default.div(_templateObject || (_templateObjec
30
30
  return position.left;
31
31
  }, _variables.FontFamily.AvenirNext, _variables.GlobalColors.deep_gray, _variables.FontFamily.Raleway_900, _variables.FontFamily.AvenirNext, _variables.GlobalColors.deep_gray);
32
32
 
33
- exports.Container = Container;
34
-
35
- var InputContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\n &.ai-generation {\n\n position: relative;\n\n > input[type=text] {\n padding-right: 2.5rem;\n }\n\n > input[type=text].ia-input {\n background-color: rgba(59, 147, 224, 0.05);\n border: 1px solid #3F8AED;\n }\n\n .icon_container {\n position: absolute;\n right: 10px;\n top: 7px;\n width: 22.5px;\n height: 22.5px;\n padding: 4px;\n\n cursor: not-allowed;\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: gray;\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 {\n cursor: pointer;\n }\n\n &.ai-available::before{\n background: linear-gradient(\n 120deg,\n #4285F4 20%,\n #33A3C8 50%,\n #4285F4 80%\n );\n background-size: 200% 200%;\n }\n\n &.ai-available::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0.75;\n\n background: linear-gradient(\n 135deg,\n rgba(255, 255, 255, 0) 0%,\n rgba(255, 255, 255, 0) 40%,\n rgba(255, 255, 255, 0.8) 50%,\n rgba(255, 255, 255, 0) 60%,\n rgba(255, 255, 255, 0) 100%\n );\n\n transform: scale(2) translate(-100%, -100%);\n z-index: 3;\n\n animation: ai-glint 3s infinite ease-in-out;\n }\n\n &.ai-available img.loading ~ ::after {\n animation: none;\n display: none;\n }\n\n &.ai-active::after {\n animation: none;\n display: none;\n }\n\n img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n position: relative;\n z-index: 2;\n filter: invert(1) grayscale(1) brightness(2);\n }\n\n img.loading {\n width: 22.5px;\n height: 22.5px;\n }\n\n &.ai-active::before {\n background: oklch(57.7% 0.245 27.325);\n }\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 @keyframes ai-glint {\n 0% {\n transform: scale(2) translate(-100%, -100%);\n }\n 70%, 100% {\n transform: scale(2) translate(100%, 100%);\n }\n }\n\n"])));
36
-
37
- exports.InputContainer = InputContainer;
38
-
39
- var BottomContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\n display: flex;\n align-items: center;\n padding-top: 5px;\n justify-content: flex-end;\n\n &.with-ai {\n justify-content: space-between;\n }\n\n > div.ai-options {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n }\n\n"])));
40
-
41
- exports.BottomContainer = BottomContainer;
42
-
43
- var OptionsContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\n display: flex;\n align-items: center;\n gap: 0.25rem;\n user-select: none;\n\n p {\n font-size: 12px;\n font-family: ", ";\n color: ", ";\n padding-top: 2px;\n }\n\n .arrow {\n width: 20px;\n height: 20px;\n cursor: pointer;\n padding: 2px;\n\n border-radius: 5px;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &.disabled {\n opacity: 0.5;\n filter: grayscale(1);\n cursor: not-allowed;\n }\n\n :hover {\n background-color: rgba(59, 147, 224, 0.1);\n }\n\n &.right {\n transform: rotate(180deg);\n }\n\n img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n }\n\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.deep_gray);
44
-
45
- exports.OptionsContainer = OptionsContainer;
46
-
47
- var ButtonsContainer = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n\n display: flex;\n align-items: center;\n gap: 0.5rem;\n\n .reload-suggestions {\n\n width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 5px;\n padding: 4px;\n cursor: pointer;\n\n &.loading {\n\n filter: grayscale(1);\n opacity: 0.75;\n cursor: not-allowed;\n\n > img {\n width: 20px;\n height: 20px;\n }\n\n }\n\n :hover {\n background-color: rgba(59, 147, 224, 0.1);\n }\n\n > img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n }\n\n .accept-suggestion {\n\n text-align: center;\n padding: 4px 5px;\n cursor: pointer;\n background-color: rgba(59, 147, 224, 0.05);\n\n border-radius: 5px;\n\n :hover {\n background-color: rgba(59, 147, 224, 0.1);\n }\n\n > p {\n font-size: 11px;\n }\n }\n\n"])));
48
-
49
- exports.ButtonsContainer = ButtonsContainer;
33
+ exports.Container = Container;
@@ -39,8 +39,6 @@ var _FinancedCompanies = require("./FinancedCompanies");
39
39
 
40
40
  var _variables = require("../../../global-files/variables");
41
41
 
42
- var _AiProductEdition = require("../../../contexts/AiProductEdition");
43
-
44
42
  var _jsxRuntime = require("react/jsx-runtime");
45
43
 
46
44
  var StatusAsignationInfo = function StatusAsignationInfo(_ref) {
@@ -83,9 +81,6 @@ var StatusAsignationInfo = function StatusAsignationInfo(_ref) {
83
81
 
84
82
  var isFinanced = _FinancedCompanies.FinancedCompanies.includes(user === null || user === void 0 ? void 0 : user.id_company);
85
83
 
86
- var _useAiProductEdition = (0, _AiProductEdition.useAiProductEdition)(),
87
- inputsUsingAi = _useAiProductEdition.inputsUsingAi;
88
-
89
84
  var closeAsignations = function closeAsignations(e) {
90
85
  if (!e.target.closest("#default-id") && showAsignationPanel) {
91
86
  document.removeEventListener("click", closeAsignations, false);
@@ -131,12 +126,7 @@ var StatusAsignationInfo = function StatusAsignationInfo(_ref) {
131
126
  ovalForm: true
132
127
  }), showSaveButton && !isFinanced && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
133
128
  buttonType: "circular-button save-button",
134
- onClick: function onClick() {
135
- if (Object.values(inputsUsingAi).some(function (input) {
136
- return !!(input !== null && input !== void 0 && input.using);
137
- })) return console.warn("Para guardar se debe de dejar de usar la generación con IA");
138
- onClickSave();
139
- }
129
+ onClick: onClickSave
140
130
  }), imagesSection && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
141
131
  className: "images-buttons",
142
132
  children: [showSaveButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
@@ -40,6 +40,17 @@ var TabsMenu = function TabsMenu(_ref) {
40
40
  sections = _useState2[0],
41
41
  setSections = _useState2[1];
42
42
 
43
+ (0, _react.useEffect)(function () {
44
+ if (!activeTab) return;
45
+ setSections(function (prev) {
46
+ var updated = {};
47
+ Object.keys(prev).forEach(function (key) {
48
+ updated[key] = key === activeTab;
49
+ });
50
+ return updated;
51
+ });
52
+ }, [activeTab]);
53
+
43
54
  var _useState3 = (0, _react.useState)(false),
44
55
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
45
56
  modal = _useState4[0],
@@ -58,19 +69,7 @@ var TabsMenu = function TabsMenu(_ref) {
58
69
  var _useState9 = (0, _react.useState)(),
59
70
  _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
60
71
  objeto = _useState10[0],
61
- setObjeto = _useState10[1]; // Sincronizar sections cuando activeTab cambia desde el exterior
62
-
63
-
64
- (0, _react.useEffect)(function () {
65
- if (activeTab && Object.keys(tabsSections).length > 0) {
66
- var tempArray = {};
67
- Object.keys(tabsSections).forEach(function (section) {
68
- tempArray[section] = section === activeTab;
69
- });
70
- setSections(tempArray);
71
- setImagesSection(activeTab === "Imágenes");
72
- }
73
- }, [activeTab, tabsSections]);
72
+ setObjeto = _useState10[1];
74
73
 
75
74
  var activeSection = function activeSection(key) {
76
75
  var array = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};