contentoh-components-library 21.0.62 → 21.0.63

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.
@@ -82,10 +82,9 @@ var InputFormatter = function InputFormatter(_ref) {
82
82
 
83
83
  try {
84
84
  if (h.getLength() - 1 <= maxLength) {
85
- setInputValue(function (val) {
86
- return val = valueInput.replace(/<\/?span.*?>/gm, "");
87
- });
88
- value = valueInput;
85
+ var unformattedText = valueInput.replace(/<li.*?>/gm, " - ").replace(/<\/li>/gm, "\n").replace(/<\/p><p>/gm, "\n").replaceAll(/<\/?(?!\/?strong).*?>/gm, "");
86
+ setInputValue(valueInput);
87
+ value = unformattedText;
89
88
  } else {
90
89
  quillState.deleteText(maxLength, quillState.getLength());
91
90
  setInputValue(function (val) {
@@ -41,26 +41,26 @@ RetailerProductEditionDefault.args = {
41
41
  descriptions: 1,
42
42
  images: 1
43
43
  },
44
- orderId: 105,
45
- status: "AF",
46
- datasheet_status: "AA",
44
+ orderId: 152,
45
+ status: "ASSIGNED",
46
+ datasheet_status: "IN_PROGRESS",
47
47
  prio: "none",
48
- version: 2,
49
- description_status: "AF",
50
- images_status: "AF",
48
+ version: 3,
49
+ description_status: "IN_PROGRESS",
50
+ images_status: "IN_PROGRESS",
51
51
  article: {
52
- id_article: 306,
53
- id_category: "697",
54
- name: "Shampoo anticaida",
55
- upc: "234454365",
56
- timestamp: "2022-03-17T17:24:57.000Z",
52
+ id_article: 343,
53
+ id_category: "2898",
54
+ name: "Producto prueba dos ",
55
+ upc: "2004202212",
56
+ timestamp: "2022-04-20T17:01:17.000Z",
57
57
  id_user: 28,
58
58
  status: "NULL",
59
59
  active: 1,
60
60
  company_id: 1,
61
61
  company_name: "COMPANY DEV",
62
- country: "Colombia",
63
- id_order: 105,
62
+ country: "México",
63
+ id_order: 152,
64
64
  id_datasheet_especialist: 54,
65
65
  id_datasheet_facilitator: 52,
66
66
  id_description_especialist: 54,
@@ -69,62 +69,44 @@ RetailerProductEditionDefault.args = {
69
69
  id_images_facilitator: 53,
70
70
  id_auditor: 30,
71
71
  id_recepcionist: null,
72
- category: "SALUD Y BELLEZA|CUIDADO DEL CABELLO|SHAMPOOS Y ACONDICIONADORES",
73
- missingAttributes: 43,
74
- missingDescriptions: 3,
75
- missingImages: 4
72
+ category: "HALLOWEN|DECORACIÓN E INFLABLES|DECORACIÓN E INFLABLES",
73
+ missingAttributes: null,
74
+ missingDescriptions: null,
75
+ missingImages: null
76
76
  },
77
77
  retailers: [{
78
- id: 4,
79
- name: "Walmart Super y Superama",
80
- country: "México",
81
- id_region: 1,
82
- active: 1
83
- }, {
84
- id: 5,
85
- name: "Chedraui",
86
- country: "México",
87
- id_region: 1,
88
- active: 1
89
- }, {
90
- id: 9,
91
- name: "Amazon",
92
- country: "México",
93
- id_region: 1,
94
- active: 1
95
- }, {
96
- id: 12,
97
- name: "La Comer",
98
- country: "México",
99
- id_region: 1,
100
- active: 1
101
- }, {
102
- id: 20,
103
- name: "Cornershop",
78
+ id: 58,
79
+ name: "The Home Depot",
104
80
  country: "México",
105
81
  id_region: 1,
106
82
  active: 1
107
83
  }],
108
- country: "Colombia",
109
- upc: "234454365"
84
+ country: "México",
85
+ upc: "2004202212"
86
+ },
87
+ location: {
88
+ product: {
89
+ articleId: 109485,
90
+ versionId: 3
91
+ }
110
92
  },
111
93
  user: {
112
- id_user: 30,
113
- name: "Admin",
114
- last_name: "Ulises",
115
- email: "salmeron.5@hotmail.com",
116
- position: "Admin",
94
+ id_user: 54,
95
+ name: "ESPECIALISTA TXTS PRUEBA",
96
+ last_name: "",
97
+ email: "rlegorreta@contentoh.com",
98
+ position: null,
117
99
  telephone: null,
118
- country: "México",
100
+ country: null,
119
101
  id_company: 2,
120
- id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
102
+ id_cognito: "ca1d24ab-e992-4c19-b4e1-2fe6f720c16b",
121
103
  birth_Date: null,
122
104
  about_me: null,
123
105
  zip_code: null,
124
106
  address: null,
125
107
  job: null,
126
108
  id_stripe: null,
127
- id_role: 6,
109
+ id_role: 7,
128
110
  active: 1,
129
111
  is_retailer: 0,
130
112
  membership: {
@@ -138,6 +120,6 @@ RetailerProductEditionDefault.args = {
138
120
  products_limit: "3",
139
121
  type: "PyMES"
140
122
  },
141
- src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1649896700986"
123
+ src: "https://content-management-profile.s3.amazonaws.com/id-54/54.png?1653425316222"
142
124
  }
143
125
  };
@@ -123,13 +123,15 @@ var myBucket = new _awsSdk.default.S3({
123
123
  });
124
124
 
125
125
  var RetailerProductEdition = function RetailerProductEdition(_ref) {
126
- var _productSelected$reta, _product$services5, _datasheets$, _datasheets$$data, _product$article6;
126
+ var _product$retailers, _product$services5, _datasheets$, _datasheets$$data, _product$article13;
127
127
 
128
128
  var tabsSections = _ref.tabsSections,
129
129
  _ref$productSelected = _ref.productSelected,
130
130
  productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
131
131
  _ref$user = _ref.user,
132
132
  user = _ref$user === void 0 ? {} : _ref$user,
133
+ _ref$location = _ref.location,
134
+ location = _ref$location === void 0 ? {} : _ref$location,
133
135
  token = _ref.token;
134
136
 
135
137
  var _useState = (0, _react.useState)("Descripción"),
@@ -252,7 +254,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
252
254
  dataImages = _useState22[0],
253
255
  setDataImages = _useState22[1];
254
256
 
255
- var _useState23 = (0, _react.useState)(new Array(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$reta = productSelected.retailers) === null || _productSelected$reta === void 0 ? void 0 : _productSelected$reta.length).fill({
257
+ var _useState23 = (0, _react.useState)(new Array(product === null || product === void 0 ? void 0 : (_product$retailers = product.retailers) === null || _product$retailers === void 0 ? void 0 : _product$retailers.length).fill({
256
258
  percentage: 0
257
259
  })),
258
260
  _useState24 = (0, _slicedToArray2.default)(_useState23, 2),
@@ -264,7 +266,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
264
266
  activePercentage = _useState26[0],
265
267
  setActivePercentage = _useState26[1];
266
268
 
267
- var _useState27 = (0, _react.useState)(productSelected === null || productSelected === void 0 ? void 0 : productSelected.retailers[0]),
269
+ var _useState27 = (0, _react.useState)({}),
268
270
  _useState28 = (0, _slicedToArray2.default)(_useState27, 2),
269
271
  activeRetailer = _useState28[0],
270
272
  setActiveRetailer = _useState28[1];
@@ -294,7 +296,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
294
296
  icon = _useState38[0],
295
297
  setIcon = _useState38[1];
296
298
 
297
- var _useState39 = (0, _react.useState)(productSelected === null || productSelected === void 0 ? void 0 : productSelected.version),
299
+ var _useState39 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
298
300
  _useState40 = (0, _slicedToArray2.default)(_useState39, 2),
299
301
  version = _useState40[0],
300
302
  setVersion = _useState40[1];
@@ -371,7 +373,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
371
373
 
372
374
  var loadData = /*#__PURE__*/function () {
373
375
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
374
- var _productSelected$arti, _productSelected$arti2, _services$, _services$$values;
376
+ var _product$article, _product$article2, _services$, _services$$values;
375
377
 
376
378
  var services;
377
379
  return _regenerator.default.wrap(function _callee2$(_context2) {
@@ -379,26 +381,27 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
379
381
  switch (_context2.prev = _context2.next) {
380
382
  case 0:
381
383
  _context2.next = 2;
382
- return (0, _data2.getRetailerServices)(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti = productSelected.article) === null || _productSelected$arti === void 0 ? void 0 : _productSelected$arti.id_article, parseInt(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti2 = productSelected.article) === null || _productSelected$arti2 === void 0 ? void 0 : _productSelected$arti2.id_category), productSelected === null || productSelected === void 0 ? void 0 : productSelected.version);
384
+ return (0, _data2.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article, parseInt(product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.id_category), product === null || product === void 0 ? void 0 : product.version);
383
385
 
384
386
  case 2:
385
387
  services = _context2.sent;
386
388
  //Converts the data inside the datasheets object to array
387
- setServices(services); //setActiveRetailer(productSelected?.retailers[0]);
389
+ setServices(services); //setActiveRetailer(product?.retailers[0]);
388
390
 
389
391
  setImages({
390
392
  action: "init",
391
393
  init: services[2]
392
394
  });
393
395
  if (((_services$ = services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
396
+ setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
394
397
  (0, _data2.getPercentage)({
395
- data: [productSelected]
398
+ data: [product]
396
399
  }).then(function (res) {
397
400
  return setPercentages(res);
398
401
  });
399
402
  setLoading(false);
400
403
 
401
- case 8:
404
+ case 9:
402
405
  case "end":
403
406
  return _context2.stop();
404
407
  }
@@ -413,7 +416,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
413
416
 
414
417
  var getServices = /*#__PURE__*/function () {
415
418
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
416
- var _product$article, _product$article2, _servicesResponse$dat;
419
+ var _product$article3, _product$article4, _servicesResponse$dat;
417
420
 
418
421
  var servicesResponse, parsedResponse;
419
422
  return _regenerator.default.wrap(function _callee3$(_context3) {
@@ -421,7 +424,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
421
424
  switch (_context3.prev = _context3.next) {
422
425
  case 0:
423
426
  _context3.next = 2;
424
- return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article, "&orderId=").concat(product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.id_order, "&end=true"));
427
+ return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_article, "&orderId=").concat(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_order, "&end=true"));
425
428
 
426
429
  case 2:
427
430
  servicesResponse = _context3.sent;
@@ -457,7 +460,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
457
460
 
458
461
  var getComments = /*#__PURE__*/function () {
459
462
  var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
460
- var _productSelected$arti3, _productSelected$arti4, _productSelected$arti5;
463
+ var _product$article5, _product$article6, _product$article7;
461
464
 
462
465
  var tab,
463
466
  commentsResponse,
@@ -469,7 +472,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
469
472
  case 0:
470
473
  tab = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "Descripción";
471
474
  _context4.next = 3;
472
- return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti3 = productSelected.article) === null || _productSelected$arti3 === void 0 ? void 0 : _productSelected$arti3.id_article, "&concept=description&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti4 = productSelected.article) === null || _productSelected$arti4 === void 0 ? void 0 : _productSelected$arti4.id_article, "&concept=datasheet&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti5 = productSelected.article) === null || _productSelected$arti5 === void 0 ? void 0 : _productSelected$arti5.id_article, "&concept=images&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version))]);
475
+ return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.id_article, "&concept=description&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_article, "&concept=datasheet&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article7 = product.article) === null || _product$article7 === void 0 ? void 0 : _product$article7.id_article, "&concept=images&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version))]);
473
476
 
474
477
  case 3:
475
478
  commentsResponse = _context4.sent;
@@ -501,7 +504,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
501
504
  while (1) {
502
505
  switch (_context5.prev = _context5.next) {
503
506
  case 0:
504
- loadData(); // getPercentage({ data: [productSelected] }).then((res) =>
507
+ loadData(); // getPercentage({ data: [product] }).then((res) =>
505
508
  // setPercentages(res)
506
509
  // );
507
510
 
@@ -544,7 +547,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
544
547
  }
545
548
  }
546
549
  }, _callee5);
547
- })), []);
550
+ })), [product]);
548
551
 
549
552
  var loadAssignations = function loadAssignations(currentProduct) {
550
553
  var _currentProduct$artic, _currentProduct$artic2, _currentProduct$artic3, _currentProduct$artic4, _currentProduct$artic5, _currentProduct$artic6;
@@ -593,25 +596,25 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
593
596
  };
594
597
 
595
598
  (0, _react.useEffect)(function () {
596
- loadAssignations(productSelected);
599
+ loadAssignations(product);
597
600
  }, [userGroups]);
598
601
  (0, _react.useEffect)(function () {
599
- var _productSelected$reta2, _productSelected$reta3;
602
+ var _product$retailers2, _product$retailers$;
600
603
 
601
- productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$reta2 = productSelected.retailers) === null || _productSelected$reta2 === void 0 ? void 0 : _productSelected$reta2.forEach(function (retailer) {
604
+ product === null || product === void 0 ? void 0 : (_product$retailers2 = product.retailers) === null || _product$retailers2 === void 0 ? void 0 : _product$retailers2.forEach(function (retailer) {
602
605
  var _percentages$filter$;
603
606
 
604
607
  retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$filter$ = percentages.filter(function (percent) {
605
608
  return (retailer === null || retailer === void 0 ? void 0 : retailer.id) === (percent === null || percent === void 0 ? void 0 : percent.id_retailer);
606
609
  })[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
607
610
  });
608
- setActivePercentage(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$reta3 = productSelected.retailers[0]) === null || _productSelected$reta3 === void 0 ? void 0 : _productSelected$reta3.percentage);
611
+ setActivePercentage(product === null || product === void 0 ? void 0 : (_product$retailers$ = product.retailers[0]) === null || _product$retailers$ === void 0 ? void 0 : _product$retailers$.percentage);
609
612
  }, [percentages]);
610
613
  (0, _react.useEffect)(function () {
611
614
  if (services.length > 0) {
612
- var _services$2, _services$3;
615
+ var _services$0$activeRet, _services$2, _services$3;
613
616
 
614
- if (services[0][activeRetailer.id].data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
617
+ if ((_services$0$activeRet = services[0][activeRetailer.id]) !== null && _services$0$activeRet !== void 0 && _services$0$activeRet.data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
615
618
  setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
616
619
  var datagroups = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id];
617
620
  var inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs;
@@ -666,44 +669,51 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
666
669
 
667
670
  var saveDescriptions = /*#__PURE__*/function () {
668
671
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
669
- var _productSelected$arti6;
672
+ var _product$article8;
670
673
 
671
- var dataObject;
674
+ var productTemp, dataObject;
672
675
  return _regenerator.default.wrap(function _callee6$(_context6) {
673
676
  while (1) {
674
677
  switch (_context6.prev = _context6.next) {
675
678
  case 0:
676
679
  setLoading(true);
680
+ productTemp = product;
677
681
  dataObject = {
678
- articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti6 = productSelected.article) === null || _productSelected$arti6 === void 0 ? void 0 : _productSelected$arti6.id_article,
682
+ articleId: product === null || product === void 0 ? void 0 : (_product$article8 = product.article) === null || _product$article8 === void 0 ? void 0 : _product$article8.id_article,
679
683
  articleData: updatedDescriptions
680
684
  };
681
- if (productSelected !== null && productSelected !== void 0 && productSelected.orderId) dataObject["orderId"] = productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId;
682
- _context6.prev = 3;
683
- _context6.next = 6;
685
+ if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
686
+ _context6.prev = 4;
687
+ _context6.next = 7;
684
688
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
685
689
  headers: {
686
690
  Authorization: token
687
691
  }
688
692
  });
689
693
 
690
- case 6:
694
+ case 7:
695
+ if (productTemp.status === "ASSIGNED") {
696
+ productTemp.status = "IN_PROGRESS";
697
+ setProduct(productTemp);
698
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
699
+ }
700
+
691
701
  setMessage("Descripciones guardadas con éxito");
692
702
  loadData();
693
- _context6.next = 13;
703
+ _context6.next = 15;
694
704
  break;
695
705
 
696
- case 10:
697
- _context6.prev = 10;
698
- _context6.t0 = _context6["catch"](3);
706
+ case 12:
707
+ _context6.prev = 12;
708
+ _context6.t0 = _context6["catch"](4);
699
709
  console.log(_context6.t0);
700
710
 
701
- case 13:
711
+ case 15:
702
712
  case "end":
703
713
  return _context6.stop();
704
714
  }
705
715
  }
706
- }, _callee6, null, [[3, 10]]);
716
+ }, _callee6, null, [[4, 12]]);
707
717
  }));
708
718
 
709
719
  return function saveDescriptions() {
@@ -713,7 +723,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
713
723
 
714
724
  var saveDatasheets = /*#__PURE__*/function () {
715
725
  var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
716
- var _productSelected$arti7;
726
+ var _product$article9;
717
727
 
718
728
  var dataObject;
719
729
  return _regenerator.default.wrap(function _callee7$(_context7) {
@@ -722,10 +732,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
722
732
  case 0:
723
733
  setLoading(true);
724
734
  dataObject = {
725
- articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti7 = productSelected.article) === null || _productSelected$arti7 === void 0 ? void 0 : _productSelected$arti7.id_article,
735
+ articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
726
736
  articleData: updatedDatasheets
727
737
  };
728
- if (productSelected !== null && productSelected !== void 0 && productSelected.orderId) dataObject["orderId"] = productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId;
738
+ if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
729
739
  _context7.prev = 3;
730
740
  _context7.next = 6;
731
741
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
@@ -736,21 +746,28 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
736
746
 
737
747
  case 6:
738
748
  setMessage("Fichas técnicas guardadas");
749
+
750
+ if (productTemp.status === "ASSIGNED") {
751
+ productTemp.status = "IN_PROGRESS";
752
+ setProduct(productTemp);
753
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
754
+ }
755
+
739
756
  loadData();
740
- _context7.next = 13;
757
+ _context7.next = 14;
741
758
  break;
742
759
 
743
- case 10:
744
- _context7.prev = 10;
760
+ case 11:
761
+ _context7.prev = 11;
745
762
  _context7.t0 = _context7["catch"](3);
746
763
  console.log(_context7.t0);
747
764
 
748
- case 13:
765
+ case 14:
749
766
  case "end":
750
767
  return _context7.stop();
751
768
  }
752
769
  }
753
- }, _callee7, null, [[3, 10]]);
770
+ }, _callee7, null, [[3, 11]]);
754
771
  }));
755
772
 
756
773
  return function saveDatasheets() {
@@ -759,7 +776,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
759
776
  }();
760
777
 
761
778
  var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
762
- var _images$values2, _product$article3, _data$articleData, _data$articleData2, _data$updateImages;
779
+ var _images$values2, _product$article10, _data$articleData, _data$articleData2, _data$updateImages;
763
780
 
764
781
  var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
765
782
 
@@ -778,7 +795,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
778
795
  attrForImgs = Object.values(images === null || images === void 0 ? void 0 : images.attrForImgs);
779
796
  attrForImgs.pop();
780
797
  data = {
781
- articleId: product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_article,
798
+ articleId: product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article,
782
799
  attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
783
800
  var _e$, _e$2;
784
801
 
@@ -794,7 +811,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
794
811
  return e.id;
795
812
  })
796
813
  };
797
- if (productSelected !== null && productSelected !== void 0 && productSelected.orderId) data["orderId"] = productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId;
814
+ if (product !== null && product !== void 0 && product.orderId) data["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
798
815
  valid = (data === null || data === void 0 ? void 0 : (_data$articleData = data.articleData) === null || _data$articleData === void 0 ? void 0 : _data$articleData.length) === 0 ? true : data === null || data === void 0 ? void 0 : (_data$articleData2 = data.articleData) === null || _data$articleData2 === void 0 ? void 0 : _data$articleData2.every(function (e, i) {
799
816
  if (e !== null && e !== void 0 && e.image_id && e !== null && e !== void 0 && e.packing_type && e !== null && e !== void 0 && e.image_type) {
800
817
  return true;
@@ -892,7 +909,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
892
909
  e.imageID = e.image_id;
893
910
  e.packingType = e.packing_type;
894
911
  e.imageType = e.image_type;
895
- if (productSelected !== null && productSelected !== void 0 && productSelected.orderId) e["orderId"] = productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId;
912
+ if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
896
913
  return e;
897
914
  });
898
915
  _context9.prev = 3;
@@ -928,7 +945,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
928
945
  });
929
946
 
930
947
  var _srv$filter = srv.filter(function (serv) {
931
- return serv.id_retailer === activeRetailer.id;
948
+ return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
932
949
  }),
933
950
  _srv$filter2 = (0, _slicedToArray2.default)(_srv$filter, 1),
934
951
  srvActive = _srv$filter2[0];
@@ -976,12 +993,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
976
993
  concept = action ? action : concept;
977
994
 
978
995
  var _servicesData$filter = servicesData.filter(function (srv) {
979
- return srv.id_retailer === activeRetailer.id && srv.service === concept;
996
+ return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
980
997
  }),
981
998
  _servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
982
999
  retailerStatus = _servicesData$filter2[0];
983
1000
 
984
- return (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "AF" && ( //sessionStorage productSelected
1001
+ return (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "AF" && ( //sessionStorage product
985
1002
  user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RP" && (user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RC" && (user.id_role === 1 || user.id_role === 6);
986
1003
  };
987
1004
 
@@ -1006,7 +1023,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1006
1023
 
1007
1024
  var sendToFacilitator = /*#__PURE__*/function () {
1008
1025
  var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
1009
- var concept, productTemp, evalStatus, data, specialistDone, statusArr, newStatus;
1026
+ var concept, _productTemp, evalStatus, data, specialistDone, statusArr, newStatus;
1027
+
1010
1028
  return _regenerator.default.wrap(function _callee10$(_context10) {
1011
1029
  while (1) {
1012
1030
  switch (_context10.prev = _context10.next) {
@@ -1014,7 +1032,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1014
1032
  setLoading(true);
1015
1033
  _context10.prev = 1;
1016
1034
  concept = getConcept(activeTab);
1017
- productTemp = (0, _objectSpread2.default)({}, product);
1035
+ _productTemp = (0, _objectSpread2.default)({}, product);
1018
1036
  evalStatus = product["".concat(concept, "_status")];
1019
1037
  data = {};
1020
1038
 
@@ -1068,9 +1086,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1068
1086
  servicesData.forEach(function (srv) {
1069
1087
  srv.service === concept && statusArr.push(srv.status);
1070
1088
  });
1071
- productTemp["".concat(concept, "_status")] = (0, _data2.getNewStatus)(statusArr);
1072
- newStatus = (0, _data2.getNewStatus)([productTemp.datasheet_status, productTemp.description_status, productTemp.images_status]);
1073
- productTemp.status = newStatus;
1089
+ _productTemp["".concat(concept, "_status")] = (0, _data2.getNewStatus)(statusArr);
1090
+ newStatus = (0, _data2.getNewStatus)([_productTemp.datasheet_status, _productTemp.description_status, _productTemp.images_status]);
1091
+ _productTemp.status = newStatus;
1074
1092
  data = {
1075
1093
  articleId: product.article.id_article,
1076
1094
  orderId: product.orderId,
@@ -1105,8 +1123,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1105
1123
  getServices();
1106
1124
 
1107
1125
  case 32:
1108
- sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1109
- setProduct(productTemp);
1126
+ sessionStorage.setItem("productSelected", JSON.stringify(_productTemp));
1127
+ setProduct(_productTemp);
1110
1128
  _context10.next = 39;
1111
1129
  break;
1112
1130
 
@@ -1165,16 +1183,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1165
1183
  }
1166
1184
  }
1167
1185
 
1168
- return productSelected.article["id_".concat(concept, "_").concat(rol)] === user.id_user && validUser;
1186
+ return product.article["id_".concat(concept, "_").concat(rol)] === user.id_user && validUser;
1169
1187
  };
1170
1188
 
1171
1189
  var auditorAssigned = function auditorAssigned() {
1172
- return (productSelected === null || productSelected === void 0 ? void 0 : productSelected.article["id_auditor"]) === user.id_user;
1190
+ return (product === null || product === void 0 ? void 0 : product.article["id_auditor"]) === user.id_user;
1173
1191
  };
1174
1192
 
1175
1193
  var createComment = /*#__PURE__*/function () {
1176
1194
  var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e, body, tab) {
1177
- var _product$article4;
1195
+ var _product$article11;
1178
1196
 
1179
1197
  var concept, data;
1180
1198
  return _regenerator.default.wrap(function _callee11$(_context11) {
@@ -1200,7 +1218,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1200
1218
 
1201
1219
  case 10:
1202
1220
  data = {
1203
- articleId: product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article,
1221
+ articleId: product === null || product === void 0 ? void 0 : (_product$article11 = product.article) === null || _product$article11 === void 0 ? void 0 : _product$article11.id_article,
1204
1222
  orderId: product === null || product === void 0 ? void 0 : product.orderId,
1205
1223
  message: body,
1206
1224
  concept: concept,
@@ -1319,7 +1337,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1319
1337
 
1320
1338
  var setAssignation = /*#__PURE__*/function () {
1321
1339
  var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(assignationType, assignationId) {
1322
- var _product$article5;
1340
+ var _product$article12;
1323
1341
 
1324
1342
  var concept, productTemp, data;
1325
1343
  return _regenerator.default.wrap(function _callee13$(_context13) {
@@ -1344,12 +1362,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1344
1362
  return _context13.abrupt("break", 10);
1345
1363
 
1346
1364
  case 10:
1347
- productTemp = productSelected;
1365
+ productTemp = product;
1348
1366
  productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
1349
1367
  data = (0, _defineProperty2.default)({
1350
1368
  articleList: [{
1351
1369
  orderId: product.orderId,
1352
- articleId: product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.id_article
1370
+ articleId: product === null || product === void 0 ? void 0 : (_product$article12 = product.article) === null || _product$article12 === void 0 ? void 0 : _product$article12.id_article
1353
1371
  }],
1354
1372
  concept: concept
1355
1373
  }, "".concat(assignationType, "Id"), assignationId);
@@ -1509,7 +1527,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1509
1527
  var retailerService = {};
1510
1528
 
1511
1529
  var _arr$filter = arr === null || arr === void 0 ? void 0 : arr.filter(function (service) {
1512
- return service.id_retailer === activeRetailer.id && service.service === concept;
1530
+ return service.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && service.service === concept;
1513
1531
  });
1514
1532
 
1515
1533
  var _arr$filter2 = (0, _slicedToArray2.default)(_arr$filter, 1);
@@ -1541,10 +1559,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1541
1559
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
1542
1560
  lists: images,
1543
1561
  activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
1544
- retailerSelected: activeRetailer.id,
1562
+ retailerSelected: activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id,
1545
1563
  setImages: setImages,
1546
1564
  assignationsImages: assig["Imágenes"],
1547
- imagesStatus: productSelected === null || productSelected === void 0 ? void 0 : productSelected.images_status,
1565
+ imagesStatus: product === null || product === void 0 ? void 0 : product.images_status,
1548
1566
  setAssignation: setAssignation,
1549
1567
  isRetailer: isRetailer,
1550
1568
  onClickSave: function onClickSave() {
@@ -1606,7 +1624,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1606
1624
  setCheckAll: setCheckAll
1607
1625
  }), activeTab === "Ficha técnica" && ((product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" ? (_datasheets$ = datasheets[0]) === null || _datasheets$ === void 0 ? void 0 : (_datasheets$$data = _datasheets$.data) === null || _datasheets$$data === void 0 ? void 0 : _datasheets$$data.map(function (dataGroup, index) {
1608
1626
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1609
- articleId: productSelected.article.id_article,
1627
+ articleId: product.article.id_article,
1610
1628
  version: version,
1611
1629
  activeSection: activeTab,
1612
1630
  inputGroup: dataGroup,
@@ -1622,7 +1640,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1622
1640
  inputGroup: descriptions[0],
1623
1641
  updatedDescriptions: updatedDescriptions,
1624
1642
  setUpdatedDescriptions: setUpdatedDescriptions,
1625
- articleId: product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_article,
1643
+ articleId: product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article,
1626
1644
  version: version,
1627
1645
  dinamicHeight: true
1628
1646
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.62",
3
+ "version": "21.0.63",
4
4
  "dependencies": {
5
5
  "@babel/runtime": "^7.17.2",
6
6
  "@storybook/addon-postcss": "^2.0.0",