contentoh-components-library 21.5.78 → 21.5.81

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 (34) hide show
  1. package/dist/ai/utils/compare-strings.js +43 -0
  2. package/dist/components/atoms/GeneralInput/index.js +64 -36
  3. package/dist/components/atoms/GeneralInput/styles.js +1 -1
  4. package/dist/components/atoms/InputFormatter/index.js +45 -21
  5. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  6. package/dist/components/molecules/StatusAsignationInfo/index.js +11 -1
  7. package/dist/components/molecules/TagAndInput/index.js +110 -29
  8. package/dist/components/molecules/TagAndInput/styles.js +2 -2
  9. package/dist/components/organisms/InputGroup/index.js +22 -18
  10. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +92 -785
  11. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +59 -260
  12. package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +3 -41
  13. package/dist/components/pages/RetailerProductEdition/index.js +191 -123
  14. package/dist/contexts/AiProductEdition.js +179 -155
  15. package/package.json +1 -1
  16. package/src/ai/utils/compare-strings.js +43 -0
  17. package/src/components/atoms/GeneralInput/index.js +63 -42
  18. package/src/components/atoms/GeneralInput/styles.js +7 -0
  19. package/src/components/atoms/InputFormatter/index.js +51 -23
  20. package/src/components/atoms/InputFormatter/styles.js +62 -10
  21. package/src/components/molecules/StatusAsignationInfo/index.js +9 -1
  22. package/src/components/molecules/TagAndInput/index.js +113 -28
  23. package/src/components/molecules/TagAndInput/styles.js +48 -17
  24. package/src/components/organisms/FullTabsMenu/index.js +1 -1
  25. package/src/components/organisms/InputGroup/index.js +4 -0
  26. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +111 -832
  27. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +3 -221
  28. package/src/components/pages/RetailerProductEdition/context/reducers/product.js +3 -43
  29. package/src/components/pages/RetailerProductEdition/index.js +17 -15
  30. package/src/contexts/AiProductEdition.jsx +138 -96
  31. package/src/ai/prompts/attribute.prompt.js +0 -46
  32. package/src/ai/prompts/description.prompt.js +0 -52
  33. package/src/ai/schemas/attribute.schema.js +0 -23
  34. package/src/ai/schemas/description.schema.js +0 -19
@@ -15,10 +15,10 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .title-container {\n position: relative;\n\n display: flex;\n align-items: center;\n gap: .5rem;\n\n .icon_information{\n width: 1.35rem;\n height: 1.35rem;\n filter: brightness(.35);\n }\n\n .tooltip {\n display: none;\n position: absolute;\n background-color: ", ";\n color: ", ";\n font-family: ", ";\n font-size: 14px;\n line-height: 19px;\n left: 0;\n top: 0;\n height: fit-content;\n transition: display 2s;\n }\n\n &:hover {\n .tooltip {\n display: block;\n }\n }\n }\n\n & > :first-child {\n & + * {\n margin-top: ", "px;\n }\n }\n & + * {\n margin-top: ", "px;\n }\n"])), _variables.GlobalColors.white, function (_ref) {
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .title-container {\n position: relative;\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n font-family: ", ";\n\n .titles{\n display: flex;\n gap: .5rem;\n align-items: center;\n }\n\n .icon_information{\n width: 1.35rem;\n height: 1.35rem;\n filter: brightness(.35);\n margin-top: 10px;\n }\n\n .tooltip {\n display: none;\n position: absolute;\n background-color: ", ";\n color: ", ";\n font-size: 14px;\n line-height: 19px;\n left: 0;\n top: 0;\n height: fit-content;\n transition: display 2s;\n }\n\n .ai-generated{\n\n display: flex;\n align-items: items-center;\n gap: .5rem;\n font-size: 11px;\n background-color: rgba(224, 57, 167, 0.025);\n border: 1px solid rgba(224, 57, 167, 0.1);\n padding: .25rem .5rem;\n border-radius: 5px;\n margin-left: 0.5rem;\n margin-top: 7px;\n cursor: default;\n\n > img {\n width: 0.75rem;\n height: 0.75rem;\n }\n\n }\n\n &:hover {\n .tooltip {\n display: block;\n }\n }\n\n\n }\n\n & > :first-child {\n & + * {\n margin-top: ", "px;\n }\n }\n & + * {\n margin-top: ", "px;\n }\n"])), _variables.FontFamily.Raleway, _variables.GlobalColors.white, function (_ref) {
19
19
  var color = _ref.color;
20
20
  return color ? color : _variables.GlobalColors.s5;
21
- }, _variables.FontFamily.Raleway, function (_ref2) {
21
+ }, function (_ref2) {
22
22
  var inputType = _ref2.inputType;
23
23
  return inputType !== "textarea" ? 4 : 15;
24
24
  }, function (_ref3) {
@@ -183,7 +183,7 @@ var InputGroup = function InputGroup(_ref) {
183
183
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
184
184
  className: "inputs-container",
185
185
  children: inputGroup === null || inputGroup === void 0 ? void 0 : (_inputGroup$inputs = inputGroup.inputs) === null || _inputGroup$inputs === void 0 ? void 0 : _inputGroup$inputs.map(function (input, index) {
186
- var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _dataInputs$input8, _dataInputs$input9, _dataInputs$input10, _dataInputs$input11, _dataInputs$input12, _dataInputs$input13, _dataInputs$input14, _dataInputs$input15, _dataInputs$input16, _auditInputs$input, _dataInputs$input17, _dataInputs$input18, _dataInputs$input19, _dataInputs$input20, _dataInputs$input21, _dataInputs$input22, _auditInputGroup$inpu, _auditInputGroup$inpu2;
186
+ var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _dataInputs$input8, _dataInputs$input9, _dataInputs$input10, _dataInputs$input11, _dataInputs$input12, _dataInputs$input13, _dataInputs$input14, _dataInputs$input15, _dataInputs$input16, _auditInputs$input, _dataInputs$input17, _dataInputs$input18, _dataInputs$input19, _dataInputs$input20, _dataInputs$input21, _dataInputs$input22, _dataInputs$input23, _auditInputGroup$inpu, _auditInputGroup$inpu2;
187
187
 
188
188
  return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
189
189
  className: ((_dataInputs$input = dataInputs[input]) === null || _dataInputs$input === void 0 ? void 0 : _dataInputs$input.id) === 6700 || ((_dataInputs$input2 = dataInputs[input]) === null || _dataInputs$input2 === void 0 ? void 0 : _dataInputs$input2.id) === 6701 ? "inputs-validation-onboarding" : "inputs-validation",
@@ -206,11 +206,12 @@ var InputGroup = function InputGroup(_ref) {
206
206
  inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
207
207
  articleId: articleId,
208
208
  isRequired: (_dataInputs$input18 = dataInputs[input]) === null || _dataInputs$input18 === void 0 ? void 0 : _dataInputs$input18.required,
209
+ aiGenerated: (_dataInputs$input19 = dataInputs[input]) === null || _dataInputs$input19 === void 0 ? void 0 : _dataInputs$input19.ai_generated,
209
210
  updatedDatasheets: updatedDatasheets,
210
211
  setUpdatedDatasheets: setUpdatedDatasheets,
211
- maxChar: (_dataInputs$input19 = dataInputs[input]) !== null && _dataInputs$input19 !== void 0 && _dataInputs$input19.max_chars ? (_dataInputs$input20 = dataInputs[input]) === null || _dataInputs$input20 === void 0 ? void 0 : _dataInputs$input20.max_chars : 999,
212
- optionList: (_dataInputs$input21 = dataInputs[input]) === null || _dataInputs$input21 === void 0 ? void 0 : _dataInputs$input21.option_list,
213
- description: (_dataInputs$input22 = dataInputs[input]) === null || _dataInputs$input22 === void 0 ? void 0 : _dataInputs$input22.description,
212
+ maxChar: (_dataInputs$input20 = dataInputs[input]) !== null && _dataInputs$input20 !== void 0 && _dataInputs$input20.max_chars ? (_dataInputs$input21 = dataInputs[input]) === null || _dataInputs$input21 === void 0 ? void 0 : _dataInputs$input21.max_chars : 999,
213
+ optionList: (_dataInputs$input22 = dataInputs[input]) === null || _dataInputs$input22 === void 0 ? void 0 : _dataInputs$input22.option_list,
214
+ description: (_dataInputs$input23 = dataInputs[input]) === null || _dataInputs$input23 === void 0 ? void 0 : _dataInputs$input23.description,
214
215
  showTooltip: true,
215
216
  auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
216
217
  }, index + "-" + ((_dataInputs$input10 = dataInputs[input]) === null || _dataInputs$input10 === void 0 ? void 0 : _dataInputs$input10.value) + "-" + ((_dataInputs$input11 = dataInputs[input]) === null || _dataInputs$input11 === void 0 ? void 0 : _dataInputs$input11.id) + "-" + compare)]
@@ -230,6 +231,7 @@ var InputGroup = function InputGroup(_ref) {
230
231
  label: (input === null || input === void 0 ? void 0 : input.name) + (input.required ? "*" : ""),
231
232
  value: compare ? auditInputGroup === null || auditInputGroup === void 0 ? void 0 : (_auditInputGroup$inpu = auditInputGroup.inputs[index]) === null || _auditInputGroup$inpu === void 0 ? void 0 : _auditInputGroup$inpu.value : input === null || input === void 0 ? void 0 : input.value,
232
233
  isRequired: input.required,
234
+ aiGenerated: input === null || input === void 0 ? void 0 : input.ai_generated,
233
235
  disabled: input.id === 44186 || input.id === 44187 ? false : input === null || input === void 0 ? void 0 : input.isApproved,
234
236
  maxChar: input.max_chars,
235
237
  inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
@@ -253,34 +255,35 @@ var InputGroup = function InputGroup(_ref) {
253
255
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
254
256
  className: "inputs-container",
255
257
  children: inputGroup === null || inputGroup === void 0 ? void 0 : (_inputGroup$inputs2 = inputGroup.inputs) === null || _inputGroup$inputs2 === void 0 ? void 0 : _inputGroup$inputs2.map(function (input, index) {
256
- var _dataInputs$input23, _dataInputs$input24, _dataInputs$input25, _dataInputs$input26, _dataInputs$input27, _dataInputs$input28, _dataInputs$input29, _dataInputs$input30, _dataInputs$input31, _auditInputs$input2, _dataInputs$input32, _dataInputs$input33, _dataInputs$input34, _dataInputs$input35, _dataInputs$input36, _dataInputs$input37, _dataInputs$input38, _dataInputs$input39, _dataInputs$input40, _dataInputs$input41, _auditInputGroup$inpu3, _auditInputGroup$inpu4;
258
+ var _dataInputs$input24, _dataInputs$input25, _dataInputs$input26, _dataInputs$input27, _dataInputs$input28, _dataInputs$input29, _dataInputs$input30, _dataInputs$input31, _dataInputs$input32, _auditInputs$input2, _dataInputs$input33, _dataInputs$input34, _dataInputs$input35, _dataInputs$input36, _dataInputs$input37, _dataInputs$input38, _dataInputs$input39, _dataInputs$input40, _dataInputs$input41, _dataInputs$input42, _dataInputs$input43, _auditInputGroup$inpu3, _auditInputGroup$inpu4;
257
259
 
258
260
  return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
259
261
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
260
262
  //disabled={input === 40001}
261
- disabled: (_dataInputs$input25 = dataInputs[input]) === null || _dataInputs$input25 === void 0 ? void 0 : _dataInputs$input25.isApproved,
262
- inputId: (_dataInputs$input26 = dataInputs[input]) === null || _dataInputs$input26 === void 0 ? void 0 : _dataInputs$input26.id,
263
+ disabled: (_dataInputs$input26 = dataInputs[input]) === null || _dataInputs$input26 === void 0 ? void 0 : _dataInputs$input26.isApproved,
264
+ inputId: (_dataInputs$input27 = dataInputs[input]) === null || _dataInputs$input27 === void 0 ? void 0 : _dataInputs$input27.id,
263
265
  version: version,
264
- inputType: inputTypeValue((_dataInputs$input27 = dataInputs[input]) === null || _dataInputs$input27 === void 0 ? void 0 : _dataInputs$input27.type),
265
- label: ((_dataInputs$input28 = dataInputs[input]) === null || _dataInputs$input28 === void 0 ? void 0 : _dataInputs$input28.name) + ((_dataInputs$input29 = dataInputs[input]) !== null && _dataInputs$input29 !== void 0 && _dataInputs$input29.required ? "*" : ""),
266
- value: (_dataInputs$input30 = dataInputs[input]) !== null && _dataInputs$input30 !== void 0 && _dataInputs$input30.box ? Object.values((_dataInputs$input31 = dataInputs[input]) === null || _dataInputs$input31 === void 0 ? void 0 : _dataInputs$input31.box)[0] : compare ? (_auditInputs$input2 = auditInputs[input]) === null || _auditInputs$input2 === void 0 ? void 0 : _auditInputs$input2.value : (_dataInputs$input32 = dataInputs[input]) === null || _dataInputs$input32 === void 0 ? void 0 : _dataInputs$input32.value,
266
+ inputType: inputTypeValue((_dataInputs$input28 = dataInputs[input]) === null || _dataInputs$input28 === void 0 ? void 0 : _dataInputs$input28.type),
267
+ label: ((_dataInputs$input29 = dataInputs[input]) === null || _dataInputs$input29 === void 0 ? void 0 : _dataInputs$input29.name) + ((_dataInputs$input30 = dataInputs[input]) !== null && _dataInputs$input30 !== void 0 && _dataInputs$input30.required ? "*" : ""),
268
+ value: (_dataInputs$input31 = dataInputs[input]) !== null && _dataInputs$input31 !== void 0 && _dataInputs$input31.box ? Object.values((_dataInputs$input32 = dataInputs[input]) === null || _dataInputs$input32 === void 0 ? void 0 : _dataInputs$input32.box)[0] : compare ? (_auditInputs$input2 = auditInputs[input]) === null || _auditInputs$input2 === void 0 ? void 0 : _auditInputs$input2.value : (_dataInputs$input33 = dataInputs[input]) === null || _dataInputs$input33 === void 0 ? void 0 : _dataInputs$input33.value,
267
269
  inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
268
270
  articleId: articleId,
269
- isRequired: (_dataInputs$input33 = dataInputs[input]) === null || _dataInputs$input33 === void 0 ? void 0 : _dataInputs$input33.required,
271
+ isRequired: (_dataInputs$input34 = dataInputs[input]) === null || _dataInputs$input34 === void 0 ? void 0 : _dataInputs$input34.required,
272
+ aiGenerated: (_dataInputs$input35 = dataInputs[input]) === null || _dataInputs$input35 === void 0 ? void 0 : _dataInputs$input35.ai_generated,
270
273
  updatedDatasheets: updatedDatasheets,
271
274
  setUpdatedDatasheets: setUpdatedDatasheets,
272
- maxChar: (_dataInputs$input34 = dataInputs[input]) !== null && _dataInputs$input34 !== void 0 && _dataInputs$input34.max_chars ? (_dataInputs$input35 = dataInputs[input]) === null || _dataInputs$input35 === void 0 ? void 0 : _dataInputs$input35.max_chars : 999,
273
- optionList: (_dataInputs$input36 = dataInputs[input]) === null || _dataInputs$input36 === void 0 ? void 0 : _dataInputs$input36.option_list,
274
- description: (_dataInputs$input37 = dataInputs[input]) === null || _dataInputs$input37 === void 0 ? void 0 : _dataInputs$input37.description,
275
+ maxChar: (_dataInputs$input36 = dataInputs[input]) !== null && _dataInputs$input36 !== void 0 && _dataInputs$input36.max_chars ? (_dataInputs$input37 = dataInputs[input]) === null || _dataInputs$input37 === void 0 ? void 0 : _dataInputs$input37.max_chars : 999,
276
+ optionList: (_dataInputs$input38 = dataInputs[input]) === null || _dataInputs$input38 === void 0 ? void 0 : _dataInputs$input38.option_list,
277
+ description: (_dataInputs$input39 = dataInputs[input]) === null || _dataInputs$input39 === void 0 ? void 0 : _dataInputs$input39.description,
275
278
  showTooltip: true,
276
279
  inputGroup: inputGroup,
277
280
  dataInputs: dataInputs,
278
281
  onChange: setUpdatedBoxData,
279
282
  auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
280
- }, index + "-" + ((_dataInputs$input23 = dataInputs[input]) === null || _dataInputs$input23 === void 0 ? void 0 : _dataInputs$input23.value) + "-" + ((_dataInputs$input24 = dataInputs[input]) === null || _dataInputs$input24 === void 0 ? void 0 : _dataInputs$input24.id) + "-" + compare), ((_dataInputs$input38 = dataInputs[input]) === null || _dataInputs$input38 === void 0 ? void 0 : _dataInputs$input38.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
281
- inputId: (_dataInputs$input39 = dataInputs[input]) === null || _dataInputs$input39 === void 0 ? void 0 : _dataInputs$input39.id,
282
- isApproved: (_dataInputs$input40 = dataInputs[input]) === null || _dataInputs$input40 === void 0 ? void 0 : _dataInputs$input40.isApproved,
283
- comment: (_dataInputs$input41 = dataInputs[input]) === null || _dataInputs$input41 === void 0 ? void 0 : _dataInputs$input41.comment,
283
+ }, index + "-" + ((_dataInputs$input24 = dataInputs[input]) === null || _dataInputs$input24 === void 0 ? void 0 : _dataInputs$input24.value) + "-" + ((_dataInputs$input25 = dataInputs[input]) === null || _dataInputs$input25 === void 0 ? void 0 : _dataInputs$input25.id) + "-" + compare), ((_dataInputs$input40 = dataInputs[input]) === null || _dataInputs$input40 === void 0 ? void 0 : _dataInputs$input40.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
284
+ inputId: (_dataInputs$input41 = dataInputs[input]) === null || _dataInputs$input41 === void 0 ? void 0 : _dataInputs$input41.id,
285
+ isApproved: (_dataInputs$input42 = dataInputs[input]) === null || _dataInputs$input42 === void 0 ? void 0 : _dataInputs$input42.isApproved,
286
+ comment: (_dataInputs$input43 = dataInputs[input]) === null || _dataInputs$input43 === void 0 ? void 0 : _dataInputs$input43.comment,
284
287
  handleImgClick: handleImgClick,
285
288
  changeImageBtn: changeImageBtn,
286
289
  showDivState: showDivStates,
@@ -303,6 +306,7 @@ var InputGroup = function InputGroup(_ref) {
303
306
  label: (input === null || input === void 0 ? void 0 : input.name) + (input.required ? "*" : ""),
304
307
  value: compare ? auditInputGroup === null || auditInputGroup === void 0 ? void 0 : (_auditInputGroup$inpu3 = auditInputGroup.inputs[index]) === null || _auditInputGroup$inpu3 === void 0 ? void 0 : _auditInputGroup$inpu3.value : input === null || input === void 0 ? void 0 : input.value,
305
308
  isRequired: input.required,
309
+ aiGenerated: input === null || input === void 0 ? void 0 : input.ai_generated,
306
310
  maxChar: input.max_chars,
307
311
  inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
308
312
  updatedDescriptions: updatedDescriptions,