contentoh-components-library 21.6.22 → 21.6.23

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.
@@ -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.Section = exports.SearchRow = exports.Panel = exports.Overlay = exports.ModeSwitch = exports.Message = exports.List = exports.Header = exports.Footer = exports.Body = exports.AttributeList = void 0;
8
+ exports.SectionHead = exports.Section = exports.SearchRow = exports.Panel = exports.Overlay = exports.ModeSwitch = exports.Message = exports.List = exports.ImageGrid = exports.Header = exports.Footer = exports.Body = exports.AttributeList = exports.AddRetailer = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
11
 
@@ -15,7 +15,7 @@ require("../../../global-files/global-styles.css");
15
15
 
16
16
  var _variables = require("../../../global-files/variables");
17
17
 
18
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
18
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
19
19
 
20
20
  var Overlay = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: fixed;\n inset: 0;\n z-index: 100;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(40, 31, 51, 0.45);\n"])));
21
21
 
@@ -57,4 +57,16 @@ exports.Message = Message;
57
57
 
58
58
  var Footer = _styledComponents.default.div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 16px 24px;\n border-top: 1px solid ", ";\n\n .summary {\n font-size: 12px;\n color: ", ";\n }\n\n .actions {\n display: flex;\n gap: 8px;\n margin-left: auto;\n }\n\n button {\n height: 36px;\n padding: 0 18px;\n border-radius: 6px;\n font-family: ", ";\n font-size: 12px;\n cursor: pointer;\n }\n\n button.secondary {\n border: 1px solid ", ";\n background-color: ", ";\n color: ", ";\n }\n\n button.primary {\n border: none;\n background-color: ", ";\n color: ", ";\n }\n\n button:disabled {\n opacity: 0.5;\n cursor: default;\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.gray, _variables.FontFamily.Raleway_600, _variables.GlobalColors.s2, _variables.GlobalColors.white, _variables.GlobalColors.gray, _variables.GlobalColors.original_magenta, _variables.GlobalColors.white);
59
59
 
60
- exports.Footer = Footer;
60
+ exports.Footer = Footer;
61
+
62
+ var SectionHead = _styledComponents.default.div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 6px;\n\n .toggle {\n flex: 1;\n display: flex;\n align-items: center;\n gap: 8px;\n border: none;\n background: none;\n padding: 0;\n cursor: pointer;\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n text-align: left;\n }\n\n .toggle .count {\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n }\n\n .all {\n border: none;\n background: none;\n padding: 0;\n cursor: pointer;\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n text-decoration: underline;\n }\n"])), _variables.FontFamily.Raleway_600, _variables.GlobalColors.deep_gray, _variables.FontFamily.Raleway_500, _variables.GlobalColors.gray, _variables.FontFamily.Raleway_500, _variables.GlobalColors.original_magenta);
63
+
64
+ exports.SectionHead = SectionHead;
65
+
66
+ var ImageGrid = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (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 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: 10px;\n color: ", ";\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.original_magenta, _variables.GlobalColors.rgb_color_pink, _variables.GlobalColors.s2, _variables.GlobalColors.gray);
67
+
68
+ exports.ImageGrid = ImageGrid;
69
+
70
+ var AddRetailer = _styledComponents.default.div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n gap: 8px;\n margin-bottom: 16px;\n\n select {\n flex: 1;\n height: 32px;\n padding: 0 8px;\n border: 1px solid ", ";\n border-radius: 6px;\n font-family: ", ";\n font-size: 12px;\n color: ", ";\n background-color: ", ";\n }\n\n button {\n height: 32px;\n padding: 0 14px;\n border: 1px solid ", ";\n border-radius: 6px;\n background: none;\n font-family: ", ";\n font-size: 12px;\n color: ", ";\n cursor: pointer;\n }\n\n button:disabled {\n opacity: 0.4;\n cursor: default;\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.Raleway, _variables.GlobalColors.deep_gray, _variables.GlobalColors.white, _variables.GlobalColors.original_magenta, _variables.FontFamily.Raleway_600, _variables.GlobalColors.original_magenta);
71
+
72
+ exports.AddRetailer = AddRetailer;
@@ -189,7 +189,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
189
189
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(token) {
190
190
  var _state$product4, _state$product5;
191
191
 
192
- var dataObject, _state$product6, res;
192
+ var dataObject, _state$product6, res, _state$services$datas, _state$services, _state$services$datas2, _state$services$datas3, _state$product7, esVariante;
193
193
 
194
194
  return _regenerator.default.wrap(function _callee2$(_context2) {
195
195
  while (1) {
@@ -238,10 +238,19 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
238
238
  dispatch({
239
239
  type: "SET_UPDATED_DATASHEETS_INPUTS",
240
240
  payload: []
241
- });
241
+ }); // En una variante, todo atributo que el hijo toca deja de ser heredado:
242
+ // update-articles-data le pone is_overridden = 1 en la base. Si aquí solo
243
+ // se refresca el valor, el chip sigue diciendo "Heredado" hasta la
244
+ // siguiente carga de la ficha, y el usuario ve una marca que ya es falsa.
245
+
246
+ 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);
242
247
  dispatch({
243
248
  type: "UPDATE_DATASHEETS_INPUTS",
244
- payload: state.updated_datasheets_inputs
249
+ payload: esVariante ? state.updated_datasheets_inputs.map(function (item) {
250
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
251
+ isOverridden: 1
252
+ });
253
+ }) : state.updated_datasheets_inputs
245
254
  }); // Mostrar modal de éxito
246
255
 
247
256
  dispatch({
@@ -290,7 +299,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
290
299
 
291
300
  var updateImages = /*#__PURE__*/function () {
292
301
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(token) {
293
- var _state$product7, _state$images_values, _state$product8, _state$product9, _data$articleData, _data$updateImages;
302
+ var _state$product8, _state$images_values, _state$product9, _state$product10, _data$articleData, _data$updateImages;
294
303
 
295
304
  var updatedImages, data, valid, promiseArray, res;
296
305
  return _regenerator.default.wrap(function _callee3$(_context3) {
@@ -307,7 +316,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
307
316
  case 2:
308
317
  updatedImages = state.updated_images_values;
309
318
  data = {
310
- articleId: (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.id_article,
319
+ articleId: (_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.id_article,
311
320
  attrReqImgs: Object.values((_state$images_values = state.images_values) === null || _state$images_values === void 0 ? void 0 : _state$images_values.attrForImgs).slice(0, -1).map(function (e) {
312
321
  var _e$, _e$0$value, _e$2;
313
322
 
@@ -323,7 +332,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
323
332
  return e.id;
324
333
  })
325
334
  };
326
- if ((_state$product8 = state.product) !== null && _state$product8 !== void 0 && _state$product8.orderId) data["orderId"] = (_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.orderId;
335
+ if ((_state$product9 = state.product) !== null && _state$product9 !== void 0 && _state$product9.orderId) data["orderId"] = (_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.orderId;
327
336
  valid = (data === null || data === void 0 ? void 0 : (_data$articleData = data.articleData) === null || _data$articleData === void 0 ? void 0 : _data$articleData.every(function (e) {
328
337
  return e === null || e === void 0 ? void 0 : e.image_id;
329
338
  })) && (data === null || data === void 0 ? void 0 : (_data$updateImages = data.updateImages) === null || _data$updateImages === void 0 ? void 0 : _data$updateImages.every(function (e) {
@@ -455,9 +464,9 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
455
464
  }();
456
465
 
457
466
  var handleOnDownloadImages = function handleOnDownloadImages() {
458
- var _state$product10, _state$product11, _state$product11$arti, _state$images_values2, _state$images_values3;
467
+ var _state$product11, _state$product12, _state$product12$arti, _state$images_values2, _state$images_values3;
459
468
 
460
- var upc = ((_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.upc) || ((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : (_state$product11$arti = _state$product11.article) === null || _state$product11$arti === void 0 ? void 0 : _state$product11$arti.upc);
469
+ var upc = ((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.upc) || ((_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : (_state$product12$arti = _state$product12.article) === null || _state$product12$arti === void 0 ? void 0 : _state$product12$arti.upc);
461
470
  state.selected_images.length > 0 ? state.selected_images.forEach(function (e) {
462
471
  if (e.id) {
463
472
  saveAs("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(upc, "_").concat(e.name, ".").concat(e.ext));
@@ -471,7 +480,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
471
480
 
472
481
  var deleteImages = /*#__PURE__*/function () {
473
482
  var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(token) {
474
- var imgsInBack, _state$product12, data;
483
+ var imgsInBack, _state$product13, data;
475
484
 
476
485
  return _regenerator.default.wrap(function _callee4$(_context4) {
477
486
  while (1) {
@@ -492,7 +501,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
492
501
  }
493
502
 
494
503
  data = {
495
- articleId: (_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.id_article,
504
+ articleId: (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.id_article,
496
505
  deleteImages: imgsInBack
497
506
  };
498
507
  _context4.prev = 4;
@@ -568,7 +577,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
568
577
 
569
578
  var createComment = /*#__PURE__*/function () {
570
579
  var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(body, token) {
571
- var _state$product13, _state$product14, _state$product15;
580
+ var _state$product14, _state$product15, _state$product16;
572
581
 
573
582
  var concept, data;
574
583
  return _regenerator.default.wrap(function _callee5$(_context5) {
@@ -577,8 +586,8 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
577
586
  case 0:
578
587
  concept = (0, _utils.getConceptByTab)(state.active_tab);
579
588
  data = {
580
- articleId: (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.id_article,
581
- orderId: ((_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.orderId) || ((_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_order),
589
+ articleId: (_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.id_article,
590
+ orderId: ((_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.orderId) || ((_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.id_order),
582
591
  message: body,
583
592
  concept: concept,
584
593
  version: state.product.version