contentoh-components-library 21.6.32 → 21.6.33

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 (29) hide show
  1. package/dist/ai/prompts/attribute.prompt.js +28 -0
  2. package/dist/ai/prompts/description.prompt.js +33 -0
  3. package/dist/ai/schemas/attribute.schema.js +35 -0
  4. package/dist/ai/schemas/description.schema.js +27 -0
  5. package/dist/components/atoms/InheritanceTag/InheritanceTag.stories.js +5 -5
  6. package/dist/components/atoms/InheritanceTag/index.js +6 -6
  7. package/dist/components/organisms/InputGroup/index.js +12 -1
  8. package/dist/components/organisms/LinkVariantsModal/index.js +269 -356
  9. package/dist/components/organisms/LinkVariantsModal/styles.js +14 -5
  10. package/dist/components/organisms/PropagateChangesModal/index.js +12 -13
  11. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +5 -5
  12. package/dist/components/pages/ProviderProductEdition/context/reducers/inputs.js +5 -2
  13. package/dist/components/pages/ProviderProductEdition/index.js +76 -33
  14. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +5 -5
  15. package/dist/components/pages/RetailerProductEdition/context/reducers/inputs.js +5 -2
  16. package/dist/components/pages/RetailerProductEdition/index.js +75 -35
  17. package/package.json +1 -1
  18. package/src/components/atoms/InheritanceTag/InheritanceTag.stories.js +3 -3
  19. package/src/components/atoms/InheritanceTag/index.js +6 -6
  20. package/src/components/organisms/InputGroup/index.js +12 -0
  21. package/src/components/organisms/LinkVariantsModal/index.js +260 -287
  22. package/src/components/organisms/LinkVariantsModal/styles.js +65 -32
  23. package/src/components/organisms/PropagateChangesModal/index.js +19 -17
  24. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +4 -4
  25. package/src/components/pages/ProviderProductEdition/context/reducers/inputs.js +13 -1
  26. package/src/components/pages/ProviderProductEdition/index.js +48 -20
  27. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +4 -4
  28. package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +13 -1
  29. package/src/components/pages/RetailerProductEdition/index.js +48 -20
@@ -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.Tabs = exports.Section = exports.SearchRow = exports.Panel = exports.Paging = exports.Overlay = exports.ModeSwitch = exports.Message = exports.List = exports.ImageGrid = exports.Header = exports.Footer = exports.Choices = exports.Body = exports.Block = exports.AttributeList = exports.AddRetailer = void 0;
8
+ exports.Tabs = exports.Section = exports.SearchRow = exports.Panel = exports.Paging = exports.Overlay = exports.ModeSwitch = exports.Message = exports.List = exports.ImageGrid = exports.Header = exports.Footer = exports.Direction = exports.Choices = exports.Body = exports.Block = exports.AttributeList = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
11
 
@@ -51,7 +51,7 @@ var SearchRow = _styledComponents.default.form(_templateObject6 || (_templateObj
51
51
 
52
52
  exports.SearchRow = SearchRow;
53
53
 
54
- var List = _styledComponents.default.ul(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n margin: 0 0 16px;\n padding: 0;\n border: 1px solid ", ";\n border-radius: 6px;\n\n li + li {\n border-top: 1px solid ", ";\n }\n\n label {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 12px;\n cursor: pointer;\n font-size: 13px;\n color: ", ";\n }\n\n .meta {\n display: block;\n font-size: 12px;\n color: ", ";\n }\n\n .logo {\n width: 24px;\n height: 24px;\n object-fit: contain;\n border-radius: 3px;\n flex-shrink: 0;\n }\n\n li {\n display: flex;\n align-items: center;\n }\n\n li > label {\n flex: 1;\n min-width: 0;\n }\n\n .quitar {\n flex-shrink: 0;\n margin-right: 10px;\n border: none;\n background: none;\n padding: 2px 6px;\n cursor: pointer;\n font-size: 16px;\n line-height: 1;\n color: ", ";\n }\n\n .quitar:hover {\n color: ", ";\n }\n\n .count {\n margin-left: auto;\n font-size: 12px;\n color: ", ";\n white-space: nowrap;\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.s2, _variables.GlobalColors.deep_gray, _variables.GlobalColors.gray, _variables.GlobalColors.gray, PINK, PINK);
54
+ var List = _styledComponents.default.ul(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n margin: 0 0 16px;\n padding: 0;\n border: 1px solid ", ";\n border-radius: 6px;\n\n li + li {\n border-top: 1px solid ", ";\n }\n\n label {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 12px;\n cursor: pointer;\n font-size: 13px;\n color: ", ";\n }\n\n .meta {\n display: block;\n font-size: 12px;\n color: ", ";\n }\n\n .logo {\n width: 24px;\n height: 24px;\n object-fit: contain;\n border-radius: 3px;\n flex-shrink: 0;\n }\n\n li {\n display: flex;\n align-items: center;\n }\n\n li > label {\n flex: 1;\n min-width: 0;\n }\n\n .count {\n margin-left: auto;\n font-size: 12px;\n color: ", ";\n white-space: nowrap;\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.s2, _variables.GlobalColors.deep_gray, _variables.GlobalColors.gray, PINK);
55
55
 
56
56
  exports.List = List;
57
57
  var AttributeList = (0, _styledComponents.default)(List)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n max-height: 220px;\n overflow-y: auto;\n\n .note {\n display: block;\n font-size: 11px;\n font-style: italic;\n color: ", ";\n }\n\n .value {\n margin-left: auto;\n max-width: 45%;\n font-size: 12px;\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])), _variables.GlobalColors.gray, _variables.GlobalColors.gray);
@@ -61,7 +61,7 @@ var Section = _styledComponents.default.div(_templateObject9 || (_templateObject
61
61
 
62
62
  exports.Section = Section;
63
63
 
64
- var Message = _styledComponents.default.p(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 0 12px;\n padding: 10px 12px;\n border-radius: 6px;\n font-size: 13px;\n line-height: 1.4;\n background-color: ", ";\n color: ", ";\n\n &.error {\n background-color: rgba(", ", 0.1);\n color: ", ";\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.deep_gray, PINK_RGB, PINK);
64
+ var Message = _styledComponents.default.p(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 0 12px;\n padding: 10px 12px;\n border-radius: 6px;\n font-size: 13px;\n line-height: 1.4;\n background-color: ", ";\n color: ", ";\n\n &.error {\n background-color: rgba(", ", 0.1);\n color: ", ";\n }\n\n /* Aviso, no error: el padre ya tiene hijos y planchar les cambia el origen.\n Se puede continuar, as\xED que no usa el rosa de rechazo. */\n &.aviso {\n background-color: rgba(", ", 0.06);\n border-left: 3px solid ", ";\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.deep_gray, PINK_RGB, PINK, PINK_RGB, PINK);
65
65
 
66
66
  exports.Message = Message;
67
67
 
@@ -70,12 +70,21 @@ var Footer = _styledComponents.default.div(_templateObject11 || (_templateObject
70
70
  exports.Footer = Footer;
71
71
 
72
72
  var ImageGrid = _styledComponents.default.div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));\n gap: 8px;\n margin-bottom: 16px;\n\n label {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 6px;\n border: 1px solid ", ";\n border-radius: 6px;\n cursor: pointer;\n }\n\n label.picked {\n border-color: ", ";\n background-color: rgba(", ", 0.06);\n }\n\n label.locked {\n cursor: default;\n }\n\n label input {\n position: absolute;\n top: 8px;\n left: 8px;\n }\n\n label img {\n width: 100%;\n height: 72px;\n object-fit: contain;\n background-color: ", ";\n border-radius: 4px;\n }\n\n label span {\n font-size: 11px;\n color: ", ";\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])), _variables.GlobalColors.s2, PINK, PINK_RGB, _variables.GlobalColors.s2, _variables.GlobalColors.gray);
73
+ /*
74
+ Padre → hijo, dibujado.
75
+
76
+ El paso de herencia escribe en una dirección sola y hasta ahora no la decía:
77
+ el modo se elige en la pantalla anterior y desaparece de la vista. Con dos
78
+ tarjetas y una flecha se lee de un golpe, sin tener que reconstruirlo del
79
+ texto de cada bloque.
80
+ */
81
+
73
82
 
74
83
  exports.ImageGrid = ImageGrid;
75
84
 
76
- var AddRetailer = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-wrap: wrap;\n align-items: flex-end;\n gap: 8px;\n margin-bottom: 16px;\n\n button {\n height: 38px;\n padding: 0 14px;\n border: 1px solid ", ";\n border-radius: 6px;\n background: none;\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n cursor: pointer;\n flex-shrink: 0;\n }\n\n button:disabled {\n opacity: 0.4;\n cursor: default;\n }\n"])), PINK, _variables.FontFamily.Raleway_600, PINK);
85
+ var Direction = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: stretch;\n gap: 10px;\n margin-bottom: 12px;\n\n .lado {\n flex: 1 1 0;\n min-width: 0;\n padding: 10px 12px;\n border: 1px solid ", ";\n border-radius: 6px;\n background-color: ", ";\n }\n\n /* El padre es el que manda en esta pantalla, y se marca como tal. */\n .lado:first-of-type {\n border-color: rgba(", ", 0.45);\n background-color: rgba(", ", 0.05);\n }\n\n .rol {\n display: block;\n font-family: ", ";\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n color: ", ";\n }\n\n strong {\n display: block;\n margin-top: 2px;\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n /* Cu\xE1l de los dos es la ficha abierta: sin esto, en modo \"este producto es\n hijo de otro\" no se sabe de qu\xE9 lado est\xE1 uno. */\n .actual {\n display: block;\n margin-top: 2px;\n font-size: 11px;\n font-style: italic;\n color: ", ";\n }\n\n .flecha {\n align-self: center;\n flex-shrink: 0;\n font-size: 20px;\n line-height: 1;\n color: ", ";\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.white, PINK_RGB, PINK_RGB, _variables.FontFamily.Raleway_600, PINK, _variables.FontFamily.Raleway_600, _variables.GlobalColors.deep_gray, _variables.GlobalColors.gray, PINK);
77
86
 
78
- exports.AddRetailer = AddRetailer;
87
+ exports.Direction = Direction;
79
88
 
80
89
  var Block = _styledComponents.default.section(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n margin-bottom: 20px;\n padding-bottom: 16px;\n border-bottom: 1px solid ", ";\n\n &:last-of-type {\n border-bottom: none;\n }\n\n h3 {\n display: flex;\n align-items: center;\n gap: 8px;\n margin: 0 0 8px;\n font-family: ", ";\n font-size: 14px;\n color: ", ";\n }\n\n h3 .paso {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background-color: ", ";\n color: ", ";\n font-size: 11px;\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.Raleway_600, _variables.GlobalColors.deep_gray, PINK, _variables.GlobalColors.white);
81
90
 
@@ -21,14 +21,13 @@ var _jsxRuntime = require("react/jsx-runtime");
21
21
  Diálogo de propagación al guardar un producto padre.
22
22
 
23
23
  Aparece cuando se guardan cambios de ficha técnica en un producto que tiene
24
- variantes. El backend NO propaga nada por su cuenta: solo baja a los hijos lo
25
- que venga en `propagation`, y esa lista la arma esta pantalla. Guardar sin
26
- abrirla, o cerrarla sin propagar, deja al padre modificado y a las variantes
27
- como estaban.
24
+ hijos. El backend NO propaga nada por su cuenta: solo baja a los hijos lo que
25
+ venga en `propagation`, y esa lista la arma esta pantalla. Guardar sin abrirla,
26
+ o cerrarla sin propagar, deja al padre modificado y a los hijos como estaban.
28
27
 
29
28
  props (* requerido):
30
29
  - *changedAttributes: [{ id, name, value }] lo que se acaba de editar
31
- - *variants: [{ articleId, name, upc }] las variantes activas del padre
30
+ - *variants: [{ articleId, name, upc }] los hijos activos del padre
32
31
  - *onCancel: cerrar sin guardar nada
33
32
  - *onConfirm: (propagation | null) => void
34
33
  null → guardar solo el padre
@@ -99,13 +98,13 @@ var PropagateChangesModal = function PropagateChangesModal(_ref) {
99
98
  },
100
99
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Header, {
101
100
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
102
- children: ["Este producto tiene ", variants.length, " variante", variants.length === 1 ? "" : "s"]
101
+ children: ["Este producto tiene ", variants.length, " hijo", variants.length === 1 ? "" : "s"]
103
102
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
104
- children: ["Cambiaste ", changedAttributes.length, " atributo", changedAttributes.length === 1 ? "" : "s", ". Elige cu\xE1les bajan a las variantes; el resto se guarda solo en este producto."]
103
+ children: ["Cambiaste ", changedAttributes.length, " atributo", changedAttributes.length === 1 ? "" : "s", ". Elige cu\xE1les bajan a los hijos; el resto se guarda solo en este producto."]
105
104
  })]
106
105
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Body, {
107
106
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
108
- children: "\xBFQu\xE9 se baja a las variantes?"
107
+ children: "\xBFQu\xE9 se baja a los hijos?"
109
108
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.List, {
110
109
  children: changedAttributes.map(function (attribute) {
111
110
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
@@ -138,9 +137,9 @@ var PropagateChangesModal = function PropagateChangesModal(_ref) {
138
137
  return setScope("all");
139
138
  }
140
139
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
141
- children: ["A todas", /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
140
+ children: ["A todos", /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
142
141
  className: "hint",
143
- children: [variants.length, " variante", variants.length === 1 ? "" : "s", " activa", variants.length === 1 ? "" : "s", "."]
142
+ children: [variants.length, " hijo", variants.length === 1 ? "" : "s", " activo", variants.length === 1 ? "" : "s", "."]
144
143
  })]
145
144
  })]
146
145
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
@@ -175,15 +174,15 @@ var PropagateChangesModal = function PropagateChangesModal(_ref) {
175
174
  }, variant.articleId);
176
175
  })
177
176
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Note, {
178
- children: "Una variante que haya editado alguno de estos atributos por su cuenta conserva su valor. Para devolverlo al del padre est\xE1 la acci\xF3n \xABVolver a heredar\xBB en la ficha de esa variante."
177
+ children: "Un hijo que haya editado alguno de estos atributos por su cuenta conserva su valor. Para devolverlo al del padre est\xE1 la acci\xF3n \xABVolver a heredar\xBB en la ficha de ese hijo."
179
178
  }), enSegundoPlano && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Note, {
180
179
  className: "accent",
181
- children: ["Son m\xE1s de ", UMBRAL_SEGUNDO_PLANO, " variantes, as\xED que la propagaci\xF3n corre en segundo plano: el guardado termina antes de que todas est\xE9n actualizadas."]
180
+ children: ["Son m\xE1s de ", UMBRAL_SEGUNDO_PLANO, " hijos, as\xED que la propagaci\xF3n corre en segundo plano: el guardado termina antes de que todas est\xE9n actualizadas."]
182
181
  })]
183
182
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Footer, {
184
183
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
185
184
  className: "resumen",
186
- children: puedePropagar ? "".concat(chosenAttributes.length, " atributo(s) a ").concat(destinatarios, " variante(s).") : "No se bajará nada a las variantes."
185
+ children: puedePropagar ? "".concat(chosenAttributes.length, " atributo(s) a ").concat(destinatarios, " hijo(s).") : "No se bajará nada a los hijos."
187
186
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
188
187
  type: "button",
189
188
  className: "secondary",
@@ -188,7 +188,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
188
188
  `propagation` es opcional y solo lo manda la ficha de un producto padre, con
189
189
  lo que el usuario eligió en el diálogo: { attributes: [...], targetChildren }.
190
190
  Sin ese bloque el backend no propaga nada. Es deliberado: bajar un cambio a
191
- las variantes tiene que ser una decisión, no un efecto secundario de guardar.
191
+ los hijos tiene que ser una decisión, no un efecto secundario de guardar.
192
192
  */
193
193
 
194
194
 
@@ -196,7 +196,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
196
196
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(token, propagation) {
197
197
  var _state$product4, _state$product5;
198
198
 
199
- var dataObject, _state$product6, res, _state$services$datas, _state$services, _state$services$datas2, _state$services$datas3, _state$product7, esVariante;
199
+ var dataObject, _state$product6, res, _state$services$datas, _state$services, _state$services$datas2, _state$services$datas3, _state$product7, esHijo;
200
200
 
201
201
  return _regenerator.default.wrap(function _callee2$(_context2) {
202
202
  while (1) {
@@ -247,15 +247,15 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
247
247
  dispatch({
248
248
  type: "SET_UPDATED_DATASHEETS_INPUTS",
249
249
  payload: []
250
- }); // En una variante, todo atributo que el hijo toca deja de ser heredado:
250
+ }); // En un hijo, todo atributo que se toca deja de ser heredado:
251
251
  // update-articles-data le pone is_overridden = 1 en la base. Si aquí solo
252
252
  // se refresca el valor, el chip sigue diciendo "Heredado" hasta la
253
253
  // siguiente carga de la ficha, y el usuario ve una marca que ya es falsa.
254
254
 
255
- esVariante = (_state$services$datas = (_state$services = state.services) === null || _state$services === void 0 ? void 0 : (_state$services$datas2 = _state$services.datasheets) === null || _state$services$datas2 === void 0 ? void 0 : (_state$services$datas3 = _state$services$datas2.variant) === null || _state$services$datas3 === void 0 ? void 0 : _state$services$datas3.isVariant) !== null && _state$services$datas !== void 0 ? _state$services$datas : !!((_state$product7 = state.product) !== null && _state$product7 !== void 0 && _state$product7.parentArticleId);
255
+ esHijo = (_state$services$datas = (_state$services = state.services) === null || _state$services === void 0 ? void 0 : (_state$services$datas2 = _state$services.datasheets) === null || _state$services$datas2 === void 0 ? void 0 : (_state$services$datas3 = _state$services$datas2.variant) === null || _state$services$datas3 === void 0 ? void 0 : _state$services$datas3.isVariant) !== null && _state$services$datas !== void 0 ? _state$services$datas : !!((_state$product7 = state.product) !== null && _state$product7 !== void 0 && _state$product7.parentArticleId);
256
256
  dispatch({
257
257
  type: "UPDATE_DATASHEETS_INPUTS",
258
- payload: esVariante ? state.updated_datasheets_inputs.map(function (item) {
258
+ payload: esHijo ? state.updated_datasheets_inputs.map(function (item) {
259
259
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
260
260
  isOverridden: 1
261
261
  });
@@ -67,9 +67,12 @@ var inputsReducer = function inputsReducer(state, action) {
67
67
  var updatedInput = action.payload.find(function (updated) {
68
68
  return updated.attributeId === input.id;
69
69
  });
70
- return updatedInput ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, input), {}, {
70
+ if (!updatedInput) return input;
71
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, input), {}, {
71
72
  value: updatedInput.value
72
- }) : input;
73
+ }, updatedInput.isOverridden === undefined ? {} : {
74
+ isOverridden: updatedInput.isOverridden
75
+ });
73
76
  }); // Tambien actualizarlo dentro de services.descriptions
74
77
  // buscar el index del retailer activo en services
75
78
 
@@ -90,7 +90,7 @@ var _AiProductEdition = require("../../../contexts/AiProductEdition");
90
90
  var _jsxRuntime = require("react/jsx-runtime");
91
91
 
92
92
  var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
93
- var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _family$variants2, _state$product15, _state$product16, _state$product17, _state$active_retaile4, _location$state5, _location$state6, _state$active_retaile5, _state$active_retaile6, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile7, _state$product18, _state$product19, _state$product20, _state$product21, _family$variants3, _family$variants4, _family$variants5, _state$active_percent, _state$active_percent2, _state$active_retaile8, _state$active_retaile9, _state$active_retaile10, _state$product22, _state$descriptions_i, _state$product23, _state$product24, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product25, _state$images_values12;
93
+ var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _family$variants2, _state$product15, _state$product16, _state$product17, _state$active_retaile4, _location$state5, _location$state6, _state$active_retaile5, _state$active_retaile6, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile7, _state$product18, _state$product19, _state$product20, _state$product21, _family$variants3, _family$variants4, _family$variants5, _state$active_percent, _state$active_percent2, _state$active_retaile8, _state$active_retaile9, _state$active_retaile10, _state$product22, _state$descriptions_i, _state$services2, _state$services2$data, _state$product23, _state$product24, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product25, _state$images_values12;
94
94
 
95
95
  var tabsSections = _ref.tabsSections,
96
96
  _ref$productSelected = _ref.productSelected,
@@ -846,15 +846,15 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
846
846
  {
847
847
  var _state$product10;
848
848
 
849
- // Guardar un padre con variantes abre la decisión de propagar. Sin este
850
- // paso el cambio se queda solo en el padre y las variantes se van
849
+ // Guardar un padre con hijos abre la decisión de propagar. Sin este
850
+ // paso el cambio se queda solo en el padre y los hijos se van
851
851
  // separando de él sin que nadie lo note.
852
852
  var esPadre = ((_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.variantsCount) > 0;
853
853
  var cambios = cambiosDeFichaTecnica();
854
854
 
855
855
  if (esPadre && cambios.length > 0) {
856
856
  // Se espera a tener la familia antes de abrir: si no, el diálogo
857
- // aparece diciendo "0 variantes" hasta que llega la respuesta, que es
857
+ // aparece diciendo "0 hijos" hasta que llega la respuesta, que es
858
858
  // justo lo contrario de lo que va a preguntar.
859
859
  setPreparandoPropagacion(true);
860
860
  loadFamily().then(function () {
@@ -905,7 +905,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
905
905
  });
906
906
  };
907
907
  /*
908
- Trae la familia del producto: sus variantes, o sus hermanas si el abierto es
908
+ Trae la familia del producto: sus hijos, o sus hermanos si el abierto es
909
909
  una de ellas.
910
910
  Se pide al abrir la sección y no al montar la pantalla: la mayoría de los
911
911
  productos no son familia, y una llamada por ficha para no mostrar nada es
@@ -968,7 +968,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
968
968
  };
969
969
  }();
970
970
  /*
971
- Abre otra variante de la familia.
971
+ Abre otro producto de la familia.
972
972
  Esta pantalla no lee el producto de la URL: lo lee de sessionStorage, donde
973
973
  lo dejó el listado al hacer clic. Así que navegar a /products/:id sin más
974
974
  cambia la barra de direcciones y deja el producto anterior en pantalla.
@@ -981,7 +981,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
981
981
  */
982
982
 
983
983
  /*
984
- Abre la edición múltiple con las variantes de la familia ya cargadas.
984
+ Abre la edición múltiple con los hijos de la familia ya cargados.
985
985
  Esa pantalla lee `multipleEditionList` de sessionStorage —así la deja el
986
986
  listado al pulsar "editar varios"— y necesita el PRODUCTO COMPLETO de cada
987
987
  uno, no solo su id: pinta el UPC, el nombre, parte `categoryName` por "|",
@@ -1066,7 +1066,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1066
1066
  payload: {
1067
1067
  show: true,
1068
1068
  title: "",
1069
- message: "No se pudieron cargar las variantes para editarlas juntas.",
1069
+ message: "No se pudieron cargar los hijos para editarlos juntos.",
1070
1070
  image: _errorModal.default
1071
1071
  }
1072
1072
  });
@@ -1167,7 +1167,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1167
1167
  contador seguía mostrando el número viejo. Además una recarga se lleva lo que
1168
1168
  el usuario tenga sin guardar.
1169
1169
  Los dos modos tienen efectos opuestos sobre este producto: ligando hijos GANA
1170
- variantes; ligándose a un padre pasa a SER una, y entonces el botón de ligar
1170
+ hijos; ligándose a un padre pasa a SER uno, y entonces el botón de ligar
1171
1171
  desaparece porque la jerarquía es de un solo nivel.
1172
1172
  */
1173
1173
 
@@ -1208,7 +1208,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1208
1208
  };
1209
1209
  /*
1210
1210
  Acción "Volver a heredar del producto" de los chips de herencia.
1211
- La inicia la variante, no el padre, y descarta un valor capturado a mano: por
1211
+ La inicia el hijo, no el padre, y descarta un valor capturado a mano: por
1212
1212
  eso el endpoint exige la lista explícita de atributos y no acepta un "todos"
1213
1213
  implícito.
1214
1214
  El repintado es en sitio, con lo que devuelve el propio endpoint. La
@@ -1216,40 +1216,76 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1216
1216
  tenga sin guardar en las otras pestañas.
1217
1217
  */
1218
1218
 
1219
+ /*
1220
+ `kind` distingue de qué pestaña salió el chip. Las descripciones viven en
1221
+ `rel_article_description` y la ficha técnica en `article_data`: el endpoint
1222
+ recibe una lista o la otra, y lo que devuelve se repinta en su propio
1223
+ reducer.
1224
+ */
1225
+
1219
1226
 
1220
1227
  var handleOnRestoreInheritance = /*#__PURE__*/function () {
1221
1228
  var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(attributeId) {
1222
1229
  var _state$product13;
1223
1230
 
1224
- var res, data;
1231
+ var kind,
1232
+ esDescripcion,
1233
+ res,
1234
+ data,
1235
+ _args6 = arguments;
1225
1236
  return _regenerator.default.wrap(function _callee6$(_context6) {
1226
1237
  while (1) {
1227
1238
  switch (_context6.prev = _context6.next) {
1228
1239
  case 0:
1240
+ kind = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : "attribute";
1241
+
1229
1242
  if (!(!attributeId || !((_state$product13 = state.product) !== null && _state$product13 !== void 0 && _state$product13.id_article))) {
1230
- _context6.next = 2;
1243
+ _context6.next = 3;
1231
1244
  break;
1232
1245
  }
1233
1246
 
1234
1247
  return _context6.abrupt("return");
1235
1248
 
1236
- case 2:
1237
- _context6.prev = 2;
1238
- _context6.next = 5;
1239
- return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), {
1240
- articleId: state.product.id_article,
1249
+ case 3:
1250
+ esDescripcion = kind === "description";
1251
+ _context6.prev = 4;
1252
+ _context6.next = 7;
1253
+ return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread4.default)({
1254
+ articleId: state.product.id_article
1255
+ }, esDescripcion ? {
1256
+ descriptions: [Number(attributeId)]
1257
+ } : {
1241
1258
  attributes: [Number(attributeId)]
1242
- }, {
1259
+ }), {
1243
1260
  headers: {
1244
1261
  Authorization: token
1245
1262
  }
1246
1263
  });
1247
1264
 
1248
- case 5:
1265
+ case 7:
1249
1266
  res = _context6.sent;
1250
1267
  // El API responde 200 aunque la lambda haya devuelto 400: el resultado
1251
1268
  // real viaja en el cuerpo y readPayload lo convierte en excepción.
1252
1269
  data = (0, _api.readPayload)(res);
1270
+
1271
+ if (!esDescripcion) {
1272
+ _context6.next = 12;
1273
+ break;
1274
+ }
1275
+
1276
+ dispatch({
1277
+ type: "UPDATE_DESCRIPTIONS_INPUTS",
1278
+ payload: (data.descriptionValues || []).map(function (item) {
1279
+ return {
1280
+ attributeId: item.id_description,
1281
+ value: item.value,
1282
+ isOverridden: 0
1283
+ };
1284
+ })
1285
+ });
1286
+ return _context6.abrupt("return");
1287
+
1288
+ case 12:
1253
1289
  dispatch({
1254
1290
  type: "UPDATE_DATASHEETS_INPUTS",
1255
1291
  payload: (data.values || []).map(function (item) {
@@ -1260,20 +1296,20 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1260
1296
  };
1261
1297
  })
1262
1298
  });
1263
- _context6.next = 13;
1299
+ _context6.next = 18;
1264
1300
  break;
1265
1301
 
1266
- case 10:
1267
- _context6.prev = 10;
1268
- _context6.t0 = _context6["catch"](2);
1302
+ case 15:
1303
+ _context6.prev = 15;
1304
+ _context6.t0 = _context6["catch"](4);
1269
1305
  console.error("restoreInheritance: ", _context6.t0);
1270
1306
 
1271
- case 13:
1307
+ case 18:
1272
1308
  case "end":
1273
1309
  return _context6.stop();
1274
1310
  }
1275
1311
  }
1276
- }, _callee6, null, [[2, 10]]);
1312
+ }, _callee6, null, [[4, 15]]);
1277
1313
  }));
1278
1314
 
1279
1315
  return function handleOnRestoreInheritance(_x3) {
@@ -2009,7 +2045,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2009
2045
  });
2010
2046
  loadFamily();
2011
2047
  },
2012
- children: [state.product.variantsCount, " variante", state.product.variantsCount === 1 ? "" : "s", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2048
+ children: [state.product.variantsCount, " hijo", state.product.variantsCount === 1 ? "" : "s", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2013
2049
  "aria-hidden": "true",
2014
2050
  children: showFamily ? " ▴" : " ▾"
2015
2051
  })]
@@ -2026,7 +2062,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2026
2062
  });
2027
2063
  loadFamily();
2028
2064
  },
2029
- children: ["Variante de otro producto", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2065
+ children: ["Hijo de otro producto", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2030
2066
  "aria-hidden": "true",
2031
2067
  children: showFamily ? " ▴" : " ▾"
2032
2068
  })]
@@ -2066,7 +2102,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2066
2102
  },
2067
2103
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2068
2104
  className: "role",
2069
- children: loadingVariant === variant.articleId ? "Abriendo…" : variant.isCurrent ? "Estás aquí" : "Variante"
2105
+ children: loadingVariant === variant.articleId ? "Abriendo…" : variant.isCurrent ? "Estás aquí" : "Hijo"
2070
2106
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2071
2107
  className: "name",
2072
2108
  children: variant.name
@@ -2077,13 +2113,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2077
2113
  }, variant.articleId);
2078
2114
  }), family && !family.error && !((_family$variants4 = family.variants) !== null && _family$variants4 !== void 0 && _family$variants4.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
2079
2115
  className: "loading",
2080
- children: "Este producto no tiene variantes."
2116
+ children: "Este producto no tiene hijos."
2081
2117
  }), (family === null || family === void 0 ? void 0 : (_family$variants5 = family.variants) === null || _family$variants5 === void 0 ? void 0 : _family$variants5.length) > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
2082
2118
  type: "button",
2083
2119
  className: "editar-juntas",
2084
2120
  disabled: preparandoEdicionMultiple,
2085
2121
  onClick: openMultipleEdition,
2086
- children: preparandoEdicionMultiple ? "Abriendo…" : "Editar las ".concat(family.variants.length, " variantes juntas")
2122
+ children: preparandoEdicionMultiple ? "Abriendo…" : "Editar los ".concat(family.variants.length, " hijos juntos")
2087
2123
  })]
2088
2124
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
2089
2125
  headerData: state.product,
@@ -2138,7 +2174,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2138
2174
  children: [state.active_tab === "Descripción" && (((_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.description_status) !== "NS" ? (_state$descriptions_i = state.descriptions_inputs) !== null && _state$descriptions_i !== void 0 && _state$descriptions_i[0] ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
2139
2175
  activeSection: state.active_tab,
2140
2176
  inputGroup: state.descriptions_inputs[0],
2141
- updatedDescriptions: state.updated_descriptions_inputs,
2177
+ updatedDescriptions: state.updated_descriptions_inputs
2178
+ /* El parentesco es del producto, no del servicio:
2179
+ los dos endpoints lo devuelven igual. Se toma de
2180
+ la ficha técnica para no depender de que la
2181
+ llamada de descripciones traiga el bloque. */
2182
+ ,
2183
+ variant: (_state$services2 = state.services) === null || _state$services2 === void 0 ? void 0 : (_state$services2$data = _state$services2.datasheets) === null || _state$services2$data === void 0 ? void 0 : _state$services2$data.variant,
2184
+ onRestoreInheritance: handleOnRestoreInheritance,
2142
2185
  articleId: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.id_article,
2143
2186
  version: state.product.version,
2144
2187
  isShowbox: false,
@@ -2153,7 +2196,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2153
2196
  headerType: "input-name-header"
2154
2197
  })), state.active_tab === "Ficha técnica" && (((_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
2155
2198
  children: ((_state$datasheets_inp = state.datasheets_inputs) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp[0]) === null || _state$datasheets_inp2 === void 0 ? void 0 : (_state$datasheets_inp3 = _state$datasheets_inp2.data) === null || _state$datasheets_inp3 === void 0 ? void 0 : _state$datasheets_inp3.length) > 0 ? state.datasheets_inputs[0].data.map(function (dataGroup, index) {
2156
- var _state$datasheets_inp4, _state$services2, _state$services2$data, _state$services$datas3;
2199
+ var _state$datasheets_inp4, _state$services3, _state$services3$data, _state$services$datas3;
2157
2200
 
2158
2201
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
2159
2202
  index: index,
@@ -2162,7 +2205,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2162
2205
  activeSection: state.active_tab,
2163
2206
  inputGroup: dataGroup,
2164
2207
  dataInputs: (_state$datasheets_inp4 = state.datasheets_inputs[1]) !== null && _state$datasheets_inp4 !== void 0 ? _state$datasheets_inp4 : [],
2165
- variant: (_state$services2 = state.services) === null || _state$services2 === void 0 ? void 0 : (_state$services2$data = _state$services2.datasheets) === null || _state$services2$data === void 0 ? void 0 : _state$services2$data.variant,
2208
+ variant: (_state$services3 = state.services) === null || _state$services3 === void 0 ? void 0 : (_state$services3$data = _state$services3.datasheets) === null || _state$services3$data === void 0 ? void 0 : _state$services3$data.variant,
2166
2209
  onRestoreInheritance: handleOnRestoreInheritance,
2167
2210
  activeRetailer: state.services.datasheets[state.active_retailer.id_retailer],
2168
2211
  groupData: (_state$services$datas3 = state.services.datasheets[state.active_retailer.id_retailer]) === null || _state$services$datas3 === void 0 ? void 0 : _state$services$datas3.data,
@@ -193,7 +193,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
193
193
  /*
194
194
  `propagation` es opcional y solo lo manda la ficha de un producto padre, con
195
195
  lo que el usuario eligió en el diálogo. Sin ese bloque el backend no propaga
196
- nada: bajar un cambio a las variantes es una decisión, no un efecto
196
+ nada: bajar un cambio a los hijos es una decisión, no un efecto
197
197
  secundario de guardar.
198
198
  */
199
199
 
@@ -202,7 +202,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
202
202
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(token, propagation) {
203
203
  var _state$product4, _state$product5;
204
204
 
205
- var dataObject, _state$product6, res, _state$services$datas, _state$services, _state$services$datas2, _state$services$datas3, _state$product7, _state$active_retaile, esVariante, datasheetInputs, retailerId, filledRequiredCount;
205
+ var dataObject, _state$product6, res, _state$services$datas, _state$services, _state$services$datas2, _state$services$datas3, _state$product7, _state$active_retaile, esHijo, datasheetInputs, retailerId, filledRequiredCount;
206
206
 
207
207
  return _regenerator.default.wrap(function _callee2$(_context2) {
208
208
  while (1) {
@@ -251,15 +251,15 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
251
251
  dispatch({
252
252
  type: "SET_UPDATED_DATASHEETS_INPUTS",
253
253
  payload: []
254
- }); // En una variante, todo atributo que el hijo toca deja de ser heredado:
254
+ }); // En un hijo, todo atributo que se toca deja de ser heredado:
255
255
  // update-articles-data le pone is_overridden = 1 en la base. Sin
256
256
  // reflejarlo aquí, el chip sigue diciendo "Heredado" hasta la siguiente
257
257
  // carga de la ficha, y el usuario ve una marca que ya es falsa.
258
258
 
259
- esVariante = (_state$services$datas = (_state$services = state.services) === null || _state$services === void 0 ? void 0 : (_state$services$datas2 = _state$services.datasheets) === null || _state$services$datas2 === void 0 ? void 0 : (_state$services$datas3 = _state$services$datas2.variant) === null || _state$services$datas3 === void 0 ? void 0 : _state$services$datas3.isVariant) !== null && _state$services$datas !== void 0 ? _state$services$datas : !!((_state$product7 = state.product) !== null && _state$product7 !== void 0 && _state$product7.parentArticleId);
259
+ esHijo = (_state$services$datas = (_state$services = state.services) === null || _state$services === void 0 ? void 0 : (_state$services$datas2 = _state$services.datasheets) === null || _state$services$datas2 === void 0 ? void 0 : (_state$services$datas3 = _state$services$datas2.variant) === null || _state$services$datas3 === void 0 ? void 0 : _state$services$datas3.isVariant) !== null && _state$services$datas !== void 0 ? _state$services$datas : !!((_state$product7 = state.product) !== null && _state$product7 !== void 0 && _state$product7.parentArticleId);
260
260
  dispatch({
261
261
  type: "UPDATE_DATASHEETS_INPUTS",
262
- payload: esVariante ? state.updated_datasheets_inputs.map(function (item) {
262
+ payload: esHijo ? state.updated_datasheets_inputs.map(function (item) {
263
263
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
264
264
  isOverridden: 1
265
265
  });
@@ -76,9 +76,12 @@ var inputsReducer = function inputsReducer(state, action) {
76
76
  var updatedInput = action.payload.find(function (updated) {
77
77
  return updated.attributeId === input.id;
78
78
  });
79
- return updatedInput ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, input), {}, {
79
+ if (!updatedInput) return input;
80
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, input), {}, {
80
81
  value: updatedInput.value
81
- }) : input;
82
+ }, updatedInput.isOverridden === undefined ? {} : {
83
+ isOverridden: updatedInput.isOverridden
84
+ });
82
85
  }); // Tambien actualizarlo dentro de services.descriptions
83
86
  // buscar el index del retailer activo en services
84
87