contentoh-components-library 21.5.85 → 21.5.87
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/components/atoms/GeneralButton/styles.js +1 -1
- package/dist/components/molecules/TagAndInput/index.js +55 -14
- package/dist/components/molecules/TagAndInput/styles.js +1 -1
- package/dist/components/organisms/ChangeStatusModal/index.js +531 -0
- package/dist/components/organisms/ChangeStatusModal/styles.js +85 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +108 -231
- package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +48 -2
- package/dist/components/pages/RetailerProductEdition/index.js +329 -101
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/contexts/AiProductEdition.js +75 -22
- package/dist/global-files/statusDictionary.js +103 -0
- package/package.json +1 -1
- package/src/components/atoms/GeneralButton/styles.js +4 -0
- package/src/components/molecules/TagAndInput/index.js +32 -2
- package/src/components/molecules/TagAndInput/styles.js +11 -0
- package/src/components/organisms/ChangeStatusModal/index.jsx +488 -0
- package/src/components/organisms/ChangeStatusModal/styles.js +333 -0
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +107 -259
- package/src/components/pages/RetailerProductEdition/context/reducers/product.js +55 -0
- package/src/components/pages/RetailerProductEdition/index.js +236 -78
- package/src/components/pages/RetailerProductEdition/styles.js +6 -0
- package/src/contexts/AiProductEdition.jsx +46 -0
- package/src/global-files/statusDictionary.js +103 -0
|
@@ -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-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-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) {
|
|
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
|
|
|
@@ -117,13 +117,18 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
117
117
|
isAiGenerated = _useState10[0],
|
|
118
118
|
setIsAiGenerated = _useState10[1];
|
|
119
119
|
|
|
120
|
+
var _useState11 = (0, _react.useState)(""),
|
|
121
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
122
|
+
errorMessage = _useState12[0],
|
|
123
|
+
setErrorMessage = _useState12[1];
|
|
124
|
+
|
|
120
125
|
function handlerAiGeneration(_x) {
|
|
121
126
|
return _handlerAiGeneration.apply(this, arguments);
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
function _handlerAiGeneration() {
|
|
125
130
|
_handlerAiGeneration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref2) {
|
|
126
|
-
var type, currentSuggestions, aiSuggestions;
|
|
131
|
+
var type, currentSuggestions, aiSuggestions, errorMsg;
|
|
127
132
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
128
133
|
while (1) {
|
|
129
134
|
switch (_context.prev = _context.next) {
|
|
@@ -158,8 +163,9 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
158
163
|
return _context.abrupt("return", setIsAiActive(true));
|
|
159
164
|
|
|
160
165
|
case 9:
|
|
166
|
+
setErrorMessage("");
|
|
161
167
|
setIsAiGenerationLoading(true);
|
|
162
|
-
_context.next =
|
|
168
|
+
_context.next = 13;
|
|
163
169
|
return generateProductSuggestions({
|
|
164
170
|
inputName: label,
|
|
165
171
|
currentValue: value,
|
|
@@ -173,26 +179,38 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
173
179
|
attributeId: isBenefitInput ? inputId : null
|
|
174
180
|
});
|
|
175
181
|
|
|
176
|
-
case
|
|
182
|
+
case 13:
|
|
177
183
|
aiSuggestions = _context.sent;
|
|
178
184
|
|
|
179
185
|
if (!(!aiSuggestions && aiSuggestions.length === 0)) {
|
|
180
|
-
_context.next =
|
|
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;
|
|
181
198
|
break;
|
|
182
199
|
}
|
|
183
200
|
|
|
184
|
-
console.log(
|
|
201
|
+
console.log('Error: ', aiSuggestions.error);
|
|
202
|
+
setErrorMessage(aiSuggestions.error);
|
|
185
203
|
setIsAiGenerationLoading(false);
|
|
186
204
|
return _context.abrupt("return");
|
|
187
205
|
|
|
188
|
-
case
|
|
206
|
+
case 24:
|
|
189
207
|
setSuggestions(function (prev) {
|
|
190
208
|
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, inputId, aiSuggestions));
|
|
191
209
|
});
|
|
192
210
|
setIsAiActive(true);
|
|
193
211
|
setIsAiGenerationLoading(false);
|
|
194
212
|
|
|
195
|
-
case
|
|
213
|
+
case 27:
|
|
196
214
|
case "end":
|
|
197
215
|
return _context.stop();
|
|
198
216
|
}
|
|
@@ -208,7 +226,7 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
208
226
|
|
|
209
227
|
function _handlerRegenerateSuggestions() {
|
|
210
228
|
_handlerRegenerateSuggestions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref3) {
|
|
211
|
-
var _ref3$type, type, currentSuggestions, aiSuggestions;
|
|
229
|
+
var _ref3$type, type, currentSuggestions, aiSuggestions, errorMsg;
|
|
212
230
|
|
|
213
231
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
214
232
|
while (1) {
|
|
@@ -224,9 +242,10 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
224
242
|
return _context2.abrupt("return");
|
|
225
243
|
|
|
226
244
|
case 3:
|
|
245
|
+
setErrorMessage("");
|
|
227
246
|
setIsAiRegenerationLoading(true);
|
|
228
247
|
currentSuggestions = suggestions === null || suggestions === void 0 ? void 0 : suggestions[inputId];
|
|
229
|
-
_context2.next =
|
|
248
|
+
_context2.next = 8;
|
|
230
249
|
return regenerateProductSuggestions({
|
|
231
250
|
inputName: label,
|
|
232
251
|
currentValue: value,
|
|
@@ -240,25 +259,42 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
240
259
|
attributeId: isBenefitInput ? inputId : null
|
|
241
260
|
});
|
|
242
261
|
|
|
243
|
-
case
|
|
262
|
+
case 8:
|
|
244
263
|
aiSuggestions = _context2.sent;
|
|
245
264
|
|
|
246
265
|
if (!(!aiSuggestions && aiSuggestions.length === 0)) {
|
|
247
|
-
_context2.next =
|
|
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;
|
|
248
283
|
break;
|
|
249
284
|
}
|
|
250
285
|
|
|
251
|
-
console.log(
|
|
286
|
+
console.log('Error: ', aiSuggestions.error);
|
|
287
|
+
setErrorMessage(aiSuggestions.error);
|
|
252
288
|
setIsAiRegenerationLoading(false);
|
|
253
289
|
return _context2.abrupt("return");
|
|
254
290
|
|
|
255
|
-
case
|
|
291
|
+
case 21:
|
|
256
292
|
setSuggestions(function (prev) {
|
|
257
293
|
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, inputId, [].concat((0, _toConsumableArray2.default)(currentSuggestions), (0, _toConsumableArray2.default)(aiSuggestions))));
|
|
258
294
|
});
|
|
259
295
|
setIsAiRegenerationLoading(false);
|
|
260
296
|
|
|
261
|
-
case
|
|
297
|
+
case 23:
|
|
262
298
|
case "end":
|
|
263
299
|
return _context2.stop();
|
|
264
300
|
}
|
|
@@ -403,6 +439,11 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
403
439
|
children: "Atributo generado con IA"
|
|
404
440
|
})]
|
|
405
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
|
+
})
|
|
406
447
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GeneralInput, {
|
|
407
448
|
inputId: inputId,
|
|
408
449
|
inputType: inputType,
|
|
@@ -15,7 +15,7 @@ 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 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"])), _variables.FontFamily.Raleway, _variables.GlobalColors.white, function (_ref) {
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .title-container {\n position: relative;\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n font-family: ", ";\n\n .titles{\n display: flex;\n gap: .5rem;\n align-items: center;\n }\n\n .icon_information{\n width: 1.35rem;\n height: 1.35rem;\n filter: brightness(.35);\n margin-top: 10px;\n }\n\n .tooltip {\n display: none;\n position: absolute;\n background-color: ", ";\n color: ", ";\n font-size: 14px;\n line-height: 19px;\n left: 0;\n top: 0;\n height: fit-content;\n transition: display 2s;\n }\n\n .ai-generated{\n\n display: flex;\n align-items: items-center;\n gap: .5rem;\n font-size: 11px;\n background-color: rgba(224, 57, 167, 0.025);\n border: 1px solid rgba(224, 57, 167, 0.1);\n padding: .25rem .5rem;\n border-radius: 5px;\n margin-left: 0.5rem;\n margin-top: 7px;\n cursor: default;\n\n > img {\n width: 0.75rem;\n height: 0.75rem;\n }\n\n }\n\n &:hover {\n .tooltip {\n display: block;\n }\n }\n\n\n }\n\n & > :first-child {\n & + * {\n margin-top: ", "px;\n }\n }\n & + * {\n margin-top: ", "px;\n }\n\n .error-message-container {\n\n font-family: \"Raleway\";\n font-size: 12px;\n font-weight: 500;\n color: #E1251B;\n margin-bottom: 8px;\n margin-top: 0;\n\n }\n"])), _variables.FontFamily.Raleway, _variables.GlobalColors.white, function (_ref) {
|
|
19
19
|
var color = _ref.color;
|
|
20
20
|
return color ? color : _variables.GlobalColors.s5;
|
|
21
21
|
}, function (_ref2) {
|