contentoh-components-library 21.6.21 → 21.6.22

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.
@@ -23,6 +23,10 @@ var _jsxRuntime = require("react/jsx-runtime");
23
23
  * que llamarlo "Heredado" es falso además de ruidoso. Sin esto la ficha de una
24
24
  * variante sale con el chip repetido en cada campo, incluidos los obligatorios en
25
25
  * rojo que están sin capturar, y la marca deja de distinguir nada.
26
+ *
27
+ * Tampoco la lleva un atributo NO heredable. El UPC y el SKU son la identidad del
28
+ * producto: el servidor los excluye de link y propagate, así que pintarlos como
29
+ * "Propio" y ofrecer "Volver a heredar" daría un botón incapaz de hacer nada.
26
30
  */
27
31
  var InheritanceTag = function InheritanceTag(_ref) {
28
32
  var _ref$isVariant = _ref.isVariant,
@@ -31,6 +35,8 @@ var InheritanceTag = function InheritanceTag(_ref) {
31
35
  isOverridden = _ref$isOverridden === void 0 ? false : _ref$isOverridden,
32
36
  _ref$hasValue = _ref.hasValue,
33
37
  hasValue = _ref$hasValue === void 0 ? true : _ref$hasValue,
38
+ _ref$inheritable = _ref.inheritable,
39
+ inheritable = _ref$inheritable === void 0 ? true : _ref$inheritable,
34
40
  parentUpc = _ref.parentUpc,
35
41
  onRestore = _ref.onRestore,
36
42
  _ref$restoreLabel = _ref.restoreLabel,
@@ -39,6 +45,7 @@ var InheritanceTag = function InheritanceTag(_ref) {
39
45
  className = _ref$className === void 0 ? "" : _ref$className;
40
46
  if (!isVariant) return null;
41
47
  if (!hasValue) return null;
48
+ if (!inheritable) return null;
42
49
  var state = isOverridden ? "own" : "inherited";
43
50
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
44
51
  className: "inheritance-tag ".concat(state, " ").concat(className),
@@ -79,6 +79,7 @@ var TagAndInput = function TagAndInput(_ref) {
79
79
  boxOnboardingData = _ref.boxOnboardingData,
80
80
  isVariant = _ref.isVariant,
81
81
  isOverridden = _ref.isOverridden,
82
+ inheritable = _ref.inheritable,
82
83
  parentUpc = _ref.parentUpc,
83
84
  onRestoreInheritance = _ref.onRestoreInheritance;
84
85
 
@@ -431,6 +432,7 @@ var TagAndInput = function TagAndInput(_ref) {
431
432
  isVariant: isVariant,
432
433
  isOverridden: isOverridden,
433
434
  hasValue: "".concat(value !== null && value !== void 0 ? value : "").trim() !== "",
435
+ inheritable: inheritable,
434
436
  parentUpc: parentUpc,
435
437
  onRestore: onRestoreInheritance ? function () {
436
438
  return onRestoreInheritance(inputId);
@@ -48,6 +48,7 @@ var TagAndInputv2 = function TagAndInputv2(_ref) {
48
48
  showMissingChars = _ref.showMissingChars,
49
49
  isVariant = _ref.isVariant,
50
50
  isOverridden = _ref.isOverridden,
51
+ inheritable = _ref.inheritable,
51
52
  parentUpc = _ref.parentUpc,
52
53
  onRestoreInheritance = _ref.onRestoreInheritance;
53
54
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
@@ -71,6 +72,7 @@ var TagAndInputv2 = function TagAndInputv2(_ref) {
71
72
  isVariant: isVariant,
72
73
  isOverridden: isOverridden,
73
74
  hasValue: "".concat(value !== null && value !== void 0 ? value : "").trim() !== "",
75
+ inheritable: inheritable,
74
76
  parentUpc: parentUpc,
75
77
  onRestore: onRestoreInheritance ? function () {
76
78
  return onRestoreInheritance(inputId);
@@ -185,7 +185,7 @@ var InputGroup = function InputGroup(_ref) {
185
185
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
186
186
  className: "inputs-container",
187
187
  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) {
188
- 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, _dataInputs$input24, _variant$parent, _auditInputGroup$inpu, _auditInputGroup$inpu2;
188
+ 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, _dataInputs$input24, _dataInputs$input25, _variant$parent, _auditInputGroup$inpu, _auditInputGroup$inpu2;
189
189
 
190
190
  return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
191
191
  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",
@@ -217,6 +217,7 @@ var InputGroup = function InputGroup(_ref) {
217
217
  showTooltip: true,
218
218
  isVariant: variant === null || variant === void 0 ? void 0 : variant.isVariant,
219
219
  isOverridden: (_dataInputs$input24 = dataInputs[input]) === null || _dataInputs$input24 === void 0 ? void 0 : _dataInputs$input24.isOverridden,
220
+ inheritable: (_dataInputs$input25 = dataInputs[input]) === null || _dataInputs$input25 === void 0 ? void 0 : _dataInputs$input25.inheritable,
220
221
  parentUpc: variant === null || variant === void 0 ? void 0 : (_variant$parent = variant.parent) === null || _variant$parent === void 0 ? void 0 : _variant$parent.upc,
221
222
  onRestoreInheritance: onRestoreInheritance,
222
223
  auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
@@ -261,35 +262,35 @@ var InputGroup = function InputGroup(_ref) {
261
262
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
262
263
  className: "inputs-container",
263
264
  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) {
264
- var _dataInputs$input25, _dataInputs$input26, _dataInputs$input27, _dataInputs$input28, _dataInputs$input29, _dataInputs$input30, _dataInputs$input31, _dataInputs$input32, _dataInputs$input33, _auditInputs$input2, _dataInputs$input34, _dataInputs$input35, _dataInputs$input36, _dataInputs$input37, _dataInputs$input38, _dataInputs$input39, _dataInputs$input40, _dataInputs$input41, _dataInputs$input42, _dataInputs$input43, _dataInputs$input44, _auditInputGroup$inpu3, _auditInputGroup$inpu4;
265
+ var _dataInputs$input26, _dataInputs$input27, _dataInputs$input28, _dataInputs$input29, _dataInputs$input30, _dataInputs$input31, _dataInputs$input32, _dataInputs$input33, _dataInputs$input34, _auditInputs$input2, _dataInputs$input35, _dataInputs$input36, _dataInputs$input37, _dataInputs$input38, _dataInputs$input39, _dataInputs$input40, _dataInputs$input41, _dataInputs$input42, _dataInputs$input43, _dataInputs$input44, _dataInputs$input45, _auditInputGroup$inpu3, _auditInputGroup$inpu4;
265
266
 
266
267
  return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
267
268
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
268
269
  //disabled={input === 40001}
269
- disabled: (_dataInputs$input27 = dataInputs[input]) === null || _dataInputs$input27 === void 0 ? void 0 : _dataInputs$input27.isApproved,
270
- inputId: (_dataInputs$input28 = dataInputs[input]) === null || _dataInputs$input28 === void 0 ? void 0 : _dataInputs$input28.id,
270
+ disabled: (_dataInputs$input28 = dataInputs[input]) === null || _dataInputs$input28 === void 0 ? void 0 : _dataInputs$input28.isApproved,
271
+ inputId: (_dataInputs$input29 = dataInputs[input]) === null || _dataInputs$input29 === void 0 ? void 0 : _dataInputs$input29.id,
271
272
  version: version,
272
- inputType: inputTypeValue((_dataInputs$input29 = dataInputs[input]) === null || _dataInputs$input29 === void 0 ? void 0 : _dataInputs$input29.type),
273
- label: ((_dataInputs$input30 = dataInputs[input]) === null || _dataInputs$input30 === void 0 ? void 0 : _dataInputs$input30.name) + ((_dataInputs$input31 = dataInputs[input]) !== null && _dataInputs$input31 !== void 0 && _dataInputs$input31.required ? "*" : ""),
274
- value: (_dataInputs$input32 = dataInputs[input]) !== null && _dataInputs$input32 !== void 0 && _dataInputs$input32.box ? Object.values((_dataInputs$input33 = dataInputs[input]) === null || _dataInputs$input33 === void 0 ? void 0 : _dataInputs$input33.box)[0] : compare ? (_auditInputs$input2 = auditInputs[input]) === null || _auditInputs$input2 === void 0 ? void 0 : _auditInputs$input2.value : (_dataInputs$input34 = dataInputs[input]) === null || _dataInputs$input34 === void 0 ? void 0 : _dataInputs$input34.value,
273
+ inputType: inputTypeValue((_dataInputs$input30 = dataInputs[input]) === null || _dataInputs$input30 === void 0 ? void 0 : _dataInputs$input30.type),
274
+ label: ((_dataInputs$input31 = dataInputs[input]) === null || _dataInputs$input31 === void 0 ? void 0 : _dataInputs$input31.name) + ((_dataInputs$input32 = dataInputs[input]) !== null && _dataInputs$input32 !== void 0 && _dataInputs$input32.required ? "*" : ""),
275
+ value: (_dataInputs$input33 = dataInputs[input]) !== null && _dataInputs$input33 !== void 0 && _dataInputs$input33.box ? Object.values((_dataInputs$input34 = dataInputs[input]) === null || _dataInputs$input34 === void 0 ? void 0 : _dataInputs$input34.box)[0] : compare ? (_auditInputs$input2 = auditInputs[input]) === null || _auditInputs$input2 === void 0 ? void 0 : _auditInputs$input2.value : (_dataInputs$input35 = dataInputs[input]) === null || _dataInputs$input35 === void 0 ? void 0 : _dataInputs$input35.value,
275
276
  inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
276
277
  articleId: articleId,
277
- isRequired: (_dataInputs$input35 = dataInputs[input]) === null || _dataInputs$input35 === void 0 ? void 0 : _dataInputs$input35.required,
278
- aiGenerated: (_dataInputs$input36 = dataInputs[input]) === null || _dataInputs$input36 === void 0 ? void 0 : _dataInputs$input36.ai_generated,
278
+ isRequired: (_dataInputs$input36 = dataInputs[input]) === null || _dataInputs$input36 === void 0 ? void 0 : _dataInputs$input36.required,
279
+ aiGenerated: (_dataInputs$input37 = dataInputs[input]) === null || _dataInputs$input37 === void 0 ? void 0 : _dataInputs$input37.ai_generated,
279
280
  updatedDatasheets: updatedDatasheets,
280
281
  setUpdatedDatasheets: setUpdatedDatasheets,
281
- maxChar: (_dataInputs$input37 = dataInputs[input]) !== null && _dataInputs$input37 !== void 0 && _dataInputs$input37.max_chars ? (_dataInputs$input38 = dataInputs[input]) === null || _dataInputs$input38 === void 0 ? void 0 : _dataInputs$input38.max_chars : 999,
282
- optionList: (_dataInputs$input39 = dataInputs[input]) === null || _dataInputs$input39 === void 0 ? void 0 : _dataInputs$input39.option_list,
283
- description: (_dataInputs$input40 = dataInputs[input]) === null || _dataInputs$input40 === void 0 ? void 0 : _dataInputs$input40.description,
282
+ maxChar: (_dataInputs$input38 = dataInputs[input]) !== null && _dataInputs$input38 !== void 0 && _dataInputs$input38.max_chars ? (_dataInputs$input39 = dataInputs[input]) === null || _dataInputs$input39 === void 0 ? void 0 : _dataInputs$input39.max_chars : 999,
283
+ optionList: (_dataInputs$input40 = dataInputs[input]) === null || _dataInputs$input40 === void 0 ? void 0 : _dataInputs$input40.option_list,
284
+ description: (_dataInputs$input41 = dataInputs[input]) === null || _dataInputs$input41 === void 0 ? void 0 : _dataInputs$input41.description,
284
285
  showTooltip: true,
285
286
  inputGroup: inputGroup,
286
287
  dataInputs: dataInputs,
287
288
  onChange: setUpdatedBoxData,
288
289
  auditClass: compare && !isEquals(dataInputs[input].value, auditInputs[input].value) ? "audit-class" : ""
289
- }, index + "-" + ((_dataInputs$input25 = dataInputs[input]) === null || _dataInputs$input25 === void 0 ? void 0 : _dataInputs$input25.value) + "-" + ((_dataInputs$input26 = dataInputs[input]) === null || _dataInputs$input26 === void 0 ? void 0 : _dataInputs$input26.id) + "-" + compare), ((_dataInputs$input41 = dataInputs[input]) === null || _dataInputs$input41 === void 0 ? void 0 : _dataInputs$input41.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
290
- inputId: (_dataInputs$input42 = dataInputs[input]) === null || _dataInputs$input42 === void 0 ? void 0 : _dataInputs$input42.id,
291
- isApproved: (_dataInputs$input43 = dataInputs[input]) === null || _dataInputs$input43 === void 0 ? void 0 : _dataInputs$input43.isApproved,
292
- comment: (_dataInputs$input44 = dataInputs[input]) === null || _dataInputs$input44 === void 0 ? void 0 : _dataInputs$input44.comment,
290
+ }, index + "-" + ((_dataInputs$input26 = dataInputs[input]) === null || _dataInputs$input26 === void 0 ? void 0 : _dataInputs$input26.value) + "-" + ((_dataInputs$input27 = dataInputs[input]) === null || _dataInputs$input27 === void 0 ? void 0 : _dataInputs$input27.id) + "-" + compare), ((_dataInputs$input42 = dataInputs[input]) === null || _dataInputs$input42 === void 0 ? void 0 : _dataInputs$input42.isApproved) === false && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputReviewSection, {
291
+ inputId: (_dataInputs$input43 = dataInputs[input]) === null || _dataInputs$input43 === void 0 ? void 0 : _dataInputs$input43.id,
292
+ isApproved: (_dataInputs$input44 = dataInputs[input]) === null || _dataInputs$input44 === void 0 ? void 0 : _dataInputs$input44.isApproved,
293
+ comment: (_dataInputs$input45 = dataInputs[input]) === null || _dataInputs$input45 === void 0 ? void 0 : _dataInputs$input45.comment,
293
294
  handleImgClick: handleImgClick,
294
295
  changeImageBtn: changeImageBtn,
295
296
  showDivState: showDivStates,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.6.21",
3
+ "version": "21.6.22",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -14,11 +14,16 @@ import { Container } from "./styles";
14
14
  * que llamarlo "Heredado" es falso además de ruidoso. Sin esto la ficha de una
15
15
  * variante sale con el chip repetido en cada campo, incluidos los obligatorios en
16
16
  * rojo que están sin capturar, y la marca deja de distinguir nada.
17
+ *
18
+ * Tampoco la lleva un atributo NO heredable. El UPC y el SKU son la identidad del
19
+ * producto: el servidor los excluye de link y propagate, así que pintarlos como
20
+ * "Propio" y ofrecer "Volver a heredar" daría un botón incapaz de hacer nada.
17
21
  */
18
22
  export const InheritanceTag = ({
19
23
  isVariant = false,
20
24
  isOverridden = false,
21
25
  hasValue = true,
26
+ inheritable = true,
22
27
  parentUpc,
23
28
  onRestore,
24
29
  restoreLabel = "Volver a heredar",
@@ -26,6 +31,7 @@ export const InheritanceTag = ({
26
31
  }) => {
27
32
  if (!isVariant) return null;
28
33
  if (!hasValue) return null;
34
+ if (!inheritable) return null;
29
35
 
30
36
  const state = isOverridden ? "own" : "inherited";
31
37
 
@@ -47,6 +47,7 @@ export const TagAndInput = ({
47
47
  boxOnboardingData,
48
48
  isVariant,
49
49
  isOverridden,
50
+ inheritable,
50
51
  parentUpc,
51
52
  onRestoreInheritance,
52
53
  }) => {
@@ -332,6 +333,7 @@ export const TagAndInput = ({
332
333
  isVariant={isVariant}
333
334
  isOverridden={isOverridden}
334
335
  hasValue={`${value ?? ""}`.trim() !== ""}
336
+ inheritable={inheritable}
335
337
  parentUpc={parentUpc}
336
338
  onRestore={
337
339
  onRestoreInheritance
@@ -36,6 +36,7 @@ export const TagAndInputv2 = ({
36
36
  showMissingChars,
37
37
  isVariant,
38
38
  isOverridden,
39
+ inheritable,
39
40
  parentUpc,
40
41
  onRestoreInheritance,
41
42
  }) => {
@@ -64,6 +65,7 @@ export const TagAndInputv2 = ({
64
65
  isVariant={isVariant}
65
66
  isOverridden={isOverridden}
66
67
  hasValue={`${value ?? ""}`.trim() !== ""}
68
+ inheritable={inheritable}
67
69
  parentUpc={parentUpc}
68
70
  onRestore={
69
71
  onRestoreInheritance
@@ -234,6 +234,7 @@ export const InputGroup = ({
234
234
  showTooltip={true}
235
235
  isVariant={variant?.isVariant}
236
236
  isOverridden={dataInputs[input]?.isOverridden}
237
+ inheritable={dataInputs[input]?.inheritable}
237
238
  parentUpc={variant?.parent?.upc}
238
239
  onRestoreInheritance={onRestoreInheritance}
239
240
  auditClass={