contentoh-components-library 21.5.93 → 21.5.95
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.
- package/dist/ai/utils/compare-strings.js +45 -0
- package/dist/components/atoms/GeneralButton/styles.js +1 -1
- package/dist/components/atoms/GeneralInput/index.js +245 -54
- package/dist/components/atoms/GeneralInput/styles.js +7 -3
- package/dist/components/atoms/InputFormatter/index.js +223 -68
- package/dist/components/atoms/InputFormatter/styles.js +20 -4
- package/dist/components/molecules/StatusAsignationInfo/index.js +11 -1
- package/dist/components/molecules/TabsMenu/index.js +13 -12
- package/dist/components/molecules/TagAndInput/index.js +361 -24
- package/dist/components/molecules/TagAndInput/styles.js +2 -2
- package/dist/components/organisms/ChangeStatusModal/index.js +531 -0
- package/dist/components/organisms/ChangeStatusModal/styles.js +85 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +6 -22
- package/dist/components/organisms/InputGroup/index.js +22 -18
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +150 -337
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +15 -15
- package/dist/components/pages/ProviderProductEdition/index.js +408 -381
- package/dist/components/pages/ProviderProductEdition/utils.js +1 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +179 -196
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +59 -260
- package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +50 -38
- package/dist/components/pages/RetailerProductEdition/index.js +1719 -2237
- package/dist/components/pages/RetailerProductEdition/styles.js +4 -2
- package/dist/components/pages/RetailerProductEdition/utils.js +251 -2
- package/dist/contexts/AiProductEdition.js +230 -158
- package/dist/global-files/statusDictionary.js +103 -0
- package/package.json +4 -2
- package/src/ai/utils/compare-strings.js +45 -0
- package/src/assets/images/Icons/arrow.png +0 -0
- package/src/assets/images/Icons/cancel.png +0 -0
- package/src/assets/images/Icons/ia-icon.png +0 -0
- package/src/assets/images/Icons/loading.svg +5 -0
- package/src/assets/images/Icons/reload.png +0 -0
- package/src/components/atoms/GeneralButton/styles.js +4 -0
- package/src/components/atoms/GeneralInput/index.js +237 -60
- package/src/components/atoms/GeneralInput/styles.js +81 -0
- package/src/components/atoms/InputFormatter/index.js +200 -51
- package/src/components/atoms/InputFormatter/styles.js +284 -0
- package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +10 -0
- package/src/components/atoms/RetailerSelector/index.js +3 -0
- package/src/components/atoms/RetailerSelector/styles.js +0 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +9 -1
- package/src/components/molecules/TabsMenu/index.js +12 -11
- package/src/components/molecules/TagAndInput/index.js +286 -21
- package/src/components/molecules/TagAndInput/styles.js +59 -17
- package/src/components/organisms/ChangeStatusModal/index.jsx +488 -0
- package/src/components/organisms/ChangeStatusModal/styles.js +333 -0
- package/src/components/organisms/FullProductNameHeader/index.js +4 -28
- package/src/components/organisms/FullTabsMenu/index.js +1 -1
- package/src/components/organisms/InputGroup/index.js +12 -4
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +174 -202
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
- package/src/components/pages/ProviderProductEdition/index.js +489 -457
- package/src/components/pages/ProviderProductEdition/utils.js +2 -2
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +201 -224
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +575 -0
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +62 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +344 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +155 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/product.js +114 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/system.js +60 -0
- package/src/components/pages/RetailerProductEdition/index.js +1545 -1718
- package/src/components/pages/RetailerProductEdition/index_old.js +1979 -0
- package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +101 -0
- package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +115 -0
- package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +174 -0
- package/src/components/pages/RetailerProductEdition/styles.js +67 -2
- package/src/components/pages/RetailerProductEdition/utils.js +240 -0
- package/src/contexts/AiProductEdition.jsx +339 -0
- 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
|
|
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 (
|
|
77
|
-
var
|
|
78
|
-
boxId =
|
|
79
|
-
value =
|
|
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,80 @@ 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
|
+
var currentDescriptionUpdate = Array.isArray(updatedDescriptions) ? updatedDescriptions.find(function (desc) {
|
|
375
|
+
return (desc === null || desc === void 0 ? void 0 : desc.attributeId) === inputId;
|
|
376
|
+
}) : null;
|
|
377
|
+
var currentDatasheetUpdate = Array.isArray(updatedDatasheets) ? updatedDatasheets.find(function (data) {
|
|
378
|
+
return (data === null || data === void 0 ? void 0 : data.attributeId) === inputId;
|
|
379
|
+
}) : null;
|
|
380
|
+
var calculatedIsAiGenerated = aiGenerated;
|
|
381
|
+
|
|
382
|
+
if (currentDescriptionUpdate) {
|
|
383
|
+
calculatedIsAiGenerated = currentDescriptionUpdate.aiSuggestionAccepted;
|
|
384
|
+
} else if (currentDatasheetUpdate) {
|
|
385
|
+
calculatedIsAiGenerated = currentDatasheetUpdate.aiSuggestionAccepted;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
setInputsGeneratedWithAi(function (prev) {
|
|
389
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, "".concat(inputId, "-").concat(inputType, "-").concat(version), {
|
|
390
|
+
inputType: inputType,
|
|
391
|
+
inputId: inputId,
|
|
392
|
+
version: version,
|
|
393
|
+
isAiGenerated: !!calculatedIsAiGenerated,
|
|
394
|
+
label: label
|
|
395
|
+
}));
|
|
396
|
+
});
|
|
397
|
+
}, [updatedDescriptions, updatedDatasheets, aiGenerated, inputId]);
|
|
398
|
+
(0, _react.useEffect)(function () {
|
|
399
|
+
var _inputsGeneratedWithA;
|
|
400
|
+
|
|
401
|
+
setIsAiGenerated(!!((_inputsGeneratedWithA = inputsGeneratedWithAi["".concat(inputId, "-").concat(inputType, "-").concat(version)]) !== null && _inputsGeneratedWithA !== void 0 && _inputsGeneratedWithA.isAiGenerated));
|
|
402
|
+
}, [inputsGeneratedWithAi]);
|
|
403
|
+
(0, _react.useEffect)(function () {
|
|
404
|
+
setInputsUsingAi(function (prev) {
|
|
405
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, "".concat(inputId, "-").concat(inputType, "-").concat(version), {
|
|
406
|
+
using: isAiActive
|
|
407
|
+
}));
|
|
408
|
+
});
|
|
409
|
+
}, [isAiActive]);
|
|
101
410
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
102
411
|
inputType: inputType,
|
|
103
412
|
className: "input-container",
|
|
104
413
|
children: [(label === null || label === void 0 ? void 0 : label.length) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
105
414
|
className: "title-container",
|
|
106
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
415
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
416
|
+
className: "titles",
|
|
417
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
|
|
418
|
+
text: label,
|
|
419
|
+
headerType: "input-name-header",
|
|
420
|
+
color: color
|
|
421
|
+
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.Tooltip, {
|
|
422
|
+
componentTooltip: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
423
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
424
|
+
children: description
|
|
425
|
+
})
|
|
426
|
+
}),
|
|
427
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
428
|
+
src: _infoIcon.default,
|
|
429
|
+
alt: "info icon",
|
|
430
|
+
className: 'icon_information'
|
|
431
|
+
}),
|
|
432
|
+
classNameTooltip: "container-tooltip"
|
|
433
|
+
})]
|
|
434
|
+
}), isCreators && isAiGenerated ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
435
|
+
className: "ai-generated",
|
|
436
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
437
|
+
src: _iaIcon.default
|
|
438
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
439
|
+
children: "Atributo generado con IA"
|
|
440
|
+
})]
|
|
441
|
+
}) : null]
|
|
442
|
+
}), errorMessage && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
443
|
+
className: "error-message-container",
|
|
444
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
445
|
+
children: errorMessage
|
|
446
|
+
})
|
|
123
447
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GeneralInput, {
|
|
124
448
|
inputId: inputId,
|
|
125
449
|
inputType: inputType,
|
|
@@ -143,7 +467,20 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
143
467
|
description: description,
|
|
144
468
|
inputOnChange: inputOnChange,
|
|
145
469
|
onKeyDown: onKeyDown,
|
|
146
|
-
auditClass: auditClass
|
|
470
|
+
auditClass: auditClass // AI Generation
|
|
471
|
+
,
|
|
472
|
+
hasAiGeneration: isCreators,
|
|
473
|
+
isBenefitInput: isBenefitInput,
|
|
474
|
+
isAiGenerationLoading: isAiGenerationLoading,
|
|
475
|
+
isAiRegenerationLoading: isAiRegenerationLoading,
|
|
476
|
+
isAiActive: isAiActive,
|
|
477
|
+
setIsAiActive: setIsAiActive,
|
|
478
|
+
isAiAvailable: isAiAvailable,
|
|
479
|
+
aiGenerated: aiGenerated // aiSuggestions={aiSuggestions}
|
|
480
|
+
,
|
|
481
|
+
handlerAiGeneration: handlerAiGeneration,
|
|
482
|
+
handlerRegenerateSuggestions: handlerRegenerateSuggestions,
|
|
483
|
+
handleChangeSuggestion: handleChangeSuggestion,
|
|
147
484
|
onChange: function onChange(e) {
|
|
148
485
|
setBoxOnboardingList(function (prev) {
|
|
149
486
|
return prev.map(function (box, i) {
|
|
@@ -151,7 +488,7 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
151
488
|
return box;
|
|
152
489
|
}
|
|
153
490
|
|
|
154
|
-
return (0,
|
|
491
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, box), {}, {
|
|
155
492
|
value: e
|
|
156
493
|
});
|
|
157
494
|
});
|
|
@@ -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
|
|
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
|
-
},
|
|
21
|
+
}, function (_ref2) {
|
|
22
22
|
var inputType = _ref2.inputType;
|
|
23
23
|
return inputType !== "textarea" ? 4 : 15;
|
|
24
24
|
}, function (_ref3) {
|