contentoh-components-library 21.4.70 → 21.4.72

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.
@@ -31,63 +31,58 @@ RetailerProductEditionDefault.args = {
31
31
  "Ficha técnica": false,
32
32
  Imágenes: false
33
33
  },
34
- token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI5OGE0NzYxMy04ZGIyLTRlZjUtYjA0Mi01ZDU3MWRkZjIwMWIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4Mzg3NTIyNiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4Mzg3ODgyNiwiaWF0IjoxNjgzODc1MjI2LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.EtgmT_THMx-Zy_zB5yZK4gz6TXNTVVJEKFt5X0JK2UkGVrp_q_92YCEuejS4n976fyTez0jkwOee6IkVHLV71uZWRBDFt-3Yw4ZxfsZYPNJWhoHXGNxhMU8MCkSntfu597esBTk-VsUpstT5R7L-WJfN8viE7R-qVo-42RlPTG0TFrWA9q0oTcqjv8vbxLpOBUjiEpjmqRhg4blJZwgkGNta6MOlw1vfmisOVbo9wMvqwnCZ9xx9KMKoH9U4uNObK_JomjbvPmTmkcUXsE-wGSD7XcoSwtuhBngLC7-jiu1u8MvL_ff5Z0Qp70sSpLdUglcSS8d1Xf7j_fcZuJ5jKA",
34
+ token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxMGZiNTE4Mi1jMGI5LTQyZGUtYTAyZC1lOTJlZWI2NWFlN2QiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTcwMTkwMjA4NywibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTcwMTkwNTY4NywiaWF0IjoxNzAxOTAyMDg3LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.JpoKZHuzPZG2ttaT7Oz3CAPR7xZU19txSDyjGHIwya2zV9uOHxauS0-orNRry8lfpZHQt_ISF2W-XSARUvCG1SqTXi41-o53DsWfZhqe9dQk6DGDnvFzXFsaEbaxAPjTfYc491sHCpOjf4W98quBuzDZCRtdCsr9u3A0AnX8Lh1Jquvn83nrHN2ZeefpLyKc-xGGp50Oy6EnJgSK4PcAAV631nwYV9DfVaLb3SIWDrJIIuBjFjBBCXBcnGJBieErlnF-4gumHzsro_QqF-s7aq_3EJChAhfslFvczNSyDc-LXJVkpDuZW3TaYKlHwhoFxz1aMuYRFQ8xy5Pz8FDNKQ",
35
35
  productSelected: {
36
- services: {
37
- datasheets: 1,
38
- descriptions: 1,
39
- images: 1
40
- },
41
- orderId: 15275,
42
- status: "AC",
43
- datasheet_status: "AC",
36
+ orderId: 15190,
37
+ status: "RA",
38
+ datasheet_status: "NS",
44
39
  prio: "none",
45
40
  version: 3,
46
- description_status: "AC",
47
- images_status: "AC",
48
- statusByRetailer: {
49
- 34: {
50
- datasheet: "AC",
51
- description: "AC",
52
- images: "AC"
53
- }
41
+ description_status: "NS",
42
+ images_status: "RA",
43
+ brand: null,
44
+ retailerOrder: 0,
45
+ missing: {
46
+ datasheet: null,
47
+ descriptions: null,
48
+ images: null
49
+ },
50
+ services: {
51
+ datasheets: 0,
52
+ descriptions: 0,
53
+ images: 1
54
54
  },
55
55
  article: {
56
- id_article: 39485,
57
- id_category: "11",
58
- name: "Mix de nueces",
59
- upc: "7543453453",
60
- timestamp: "2023-07-14T21:02:54.000Z",
61
- id_user: 28,
62
- status: "NULL",
63
- active: 1,
64
- company_id: 1,
56
+ category: "Abarrotes Básicos|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
65
57
  company_name: "GRUPO BRAHMA",
66
58
  country: "México",
67
- id_order: 15275,
68
- id_datasheet_especialist: 54,
69
- id_datasheet_facilitator: 52,
70
- id_description_especialist: 54,
71
- id_description_facilitator: 52,
59
+ id_category: "4004",
60
+ id_datasheet_especialist: null,
61
+ id_datasheet_facilitator: null,
62
+ id_description_especialist: null,
63
+ id_description_facilitator: null,
72
64
  id_images_especialist: 55,
73
65
  id_images_facilitator: 53,
66
+ id_order: 15190,
67
+ id_article: 39364,
74
68
  id_auditor: 37,
75
- id_recepcionist: null,
76
- category: "Abarrotes|Abarrotes Secos|Frutos Secos",
77
- missingAttributes: 0,
78
- missingDescriptions: 0,
79
- missingImages: 0
69
+ name: "test 2 img ba",
70
+ timestamp: "2023-05-05T02:56:16.000Z",
71
+ upc: "4353242"
80
72
  },
81
73
  retailers: [{
82
- id: 34,
83
- name: "San Pablo"
74
+ id: 70,
75
+ name: "Bodega Aurrera"
84
76
  }],
85
- country: "México",
86
- upc: "7543453453"
77
+ statusByRetailer: {
78
+ 70: {
79
+ images: "RA/AC"
80
+ }
81
+ }
87
82
  },
88
83
  location: {
89
84
  product: {
90
- articleId: 354,
85
+ articleId: 39364,
91
86
  versionId: 3
92
87
  },
93
88
  state: {
@@ -103,7 +98,7 @@ RetailerProductEditionDefault.args = {
103
98
  position: "Auditor",
104
99
  telephone: "",
105
100
  country: "México",
106
- id_company: 2,
101
+ id_company: 254,
107
102
  id_cognito: "9a213128-6482-4c16-a4b6-6e64f225b1bd",
108
103
  birth_Date: null,
109
104
  about_me: "",
@@ -117,16 +112,16 @@ RetailerProductEditionDefault.args = {
117
112
  email_notify: 1,
118
113
  is_user_tech: null,
119
114
  membership: {
120
- id: 2,
121
- start_date: "2021-11-05T02:35:12.000Z",
122
- end_date: "2022-11-05T02:34:49.000Z",
123
- planID: 1,
124
- plan: "prod_KtkvuFFLpOdP6e",
125
- name: "Plan Free",
126
- user_limit: "1",
127
- products_limit: "3",
128
- type: "PyMES"
115
+ id: 137,
116
+ start_date: "2023-10-04T15:46:14.000Z",
117
+ end_date: "2024-10-04T08:46:09.000Z",
118
+ planID: 8,
119
+ plan: "prod_KtlhECVSFG2iro",
120
+ name: "Plan Pro",
121
+ user_limit: "50",
122
+ products_limit: "5000",
123
+ type: "Enterprise"
129
124
  },
130
- src: "https://content-management-profile.s3.amazonaws.com/id-37/37.png?1692750648813"
125
+ src: "https://content-management-profile.s3.amazonaws.com/id-37/37.png?1701902088068"
131
126
  }
132
127
  };
@@ -573,7 +573,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
573
573
 
574
574
  var loadData = /*#__PURE__*/function () {
575
575
  var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
576
- var _product$article4, _product$article5, _product$article6, _services$, _services$$values, _services;
576
+ var _product$article4, _product$article5, _product$article6, _services$, _services$$values, _product$retailersAva, _services, data, headers;
577
577
 
578
578
  return _regenerator.default.wrap(function _callee3$(_context3) {
579
579
  while (1) {
@@ -598,26 +598,39 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
598
598
  init: _services[2]
599
599
  });
600
600
  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);
601
+ data = [{
602
+ id_article: product.article.id_article,
603
+ id_category: product.article.id_category,
604
+ version: product.version,
605
+ id_retailer_array: ((_product$retailersAva = product.retailersAvailable) !== null && _product$retailersAva !== void 0 ? _product$retailersAva : product.retailers).map(function (_ref6) {
606
+ var id = _ref6.id;
607
+ return id;
608
+ })
609
+ }];
610
+ headers = {
611
+ Authorization: token
612
+ };
601
613
  (0, _data2.getPercentage)({
602
- data: [product]
614
+ data: data,
615
+ headers: headers
603
616
  }).then(function (res) {
604
- return setPercentages(res[0]);
617
+ setPercentages(res[0]);
605
618
  });
606
619
  setLoading(false);
607
- _context3.next = 16;
620
+ _context3.next = 18;
608
621
  break;
609
622
 
610
- case 13:
611
- _context3.prev = 13;
623
+ case 15:
624
+ _context3.prev = 15;
612
625
  _context3.t0 = _context3["catch"](0);
613
626
  console.log(_context3.t0);
614
627
 
615
- case 16:
628
+ case 18:
616
629
  case "end":
617
630
  return _context3.stop();
618
631
  }
619
632
  }
620
- }, _callee3, null, [[0, 13]]);
633
+ }, _callee3, null, [[0, 15]]);
621
634
  }));
622
635
 
623
636
  return function loadData() {
@@ -626,7 +639,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
626
639
  }();
627
640
 
628
641
  var getServices = /*#__PURE__*/function () {
629
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
642
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
630
643
  var _product$article7, _product$article8, _servicesResponse$dat;
631
644
 
632
645
  var servicesResponse, parsedResponse, retailers, retailerResponse, active;
@@ -659,7 +672,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
659
672
  }));
660
673
 
661
674
  return function getServices() {
662
- return _ref6.apply(this, arguments);
675
+ return _ref7.apply(this, arguments);
663
676
  };
664
677
  }();
665
678
 
@@ -673,7 +686,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
673
686
  };
674
687
 
675
688
  var getComments = /*#__PURE__*/function () {
676
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
689
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
677
690
  var _product$article9, _product$article10, _product$article11;
678
691
 
679
692
  var tab,
@@ -708,7 +721,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
708
721
  }));
709
722
 
710
723
  return function getComments() {
711
- return _ref7.apply(this, arguments);
724
+ return _ref8.apply(this, arguments);
712
725
  };
713
726
  }();
714
727
 
@@ -879,7 +892,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
879
892
  };
880
893
 
881
894
  var saveDescriptions = /*#__PURE__*/function () {
882
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
895
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
883
896
  var dataClean, _product$article12, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
884
897
 
885
898
  return _regenerator.default.wrap(function _callee7$(_context7) {
@@ -947,12 +960,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
947
960
  }));
948
961
 
949
962
  return function saveDescriptions() {
950
- return _ref9.apply(this, arguments);
963
+ return _ref10.apply(this, arguments);
951
964
  };
952
965
  }();
953
966
 
954
967
  var saveDatasheets = /*#__PURE__*/function () {
955
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
968
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
956
969
  var dataClean, _product$article13, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
957
970
 
958
971
  return _regenerator.default.wrap(function _callee8$(_context8) {
@@ -1020,7 +1033,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1020
1033
  }));
1021
1034
 
1022
1035
  return function saveDatasheets() {
1023
- return _ref10.apply(this, arguments);
1036
+ return _ref11.apply(this, arguments);
1024
1037
  };
1025
1038
  }();
1026
1039
 
@@ -1308,8 +1321,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1308
1321
  break;
1309
1322
  }
1310
1323
 
1311
- var services = servicesData.filter(function (_ref13) {
1312
- var service = _ref13.service;
1324
+ var services = servicesData.filter(function (_ref14) {
1325
+ var service = _ref14.service;
1313
1326
  return concepts.includes(service);
1314
1327
  });
1315
1328
  var adminFacilitatorCanEvaluate = services.every(function (srv) {
@@ -1419,7 +1432,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1419
1432
 
1420
1433
 
1421
1434
  var sendToFacilitator = /*#__PURE__*/function () {
1422
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
1435
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
1423
1436
  var concept, productTemp, evalStatus, articleId, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus, messageToChat, _data;
1424
1437
 
1425
1438
  return _regenerator.default.wrap(function _callee11$(_context11) {
@@ -1539,7 +1552,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1539
1552
  }));
1540
1553
 
1541
1554
  return function sendToFacilitator(_x) {
1542
- return _ref14.apply(this, arguments);
1555
+ return _ref15.apply(this, arguments);
1543
1556
  };
1544
1557
  }();
1545
1558
 
@@ -1570,7 +1583,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1570
1583
  };
1571
1584
 
1572
1585
  var createComment = /*#__PURE__*/function () {
1573
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1586
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1574
1587
  var messages,
1575
1588
  retailerId,
1576
1589
  data,
@@ -1605,7 +1618,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1605
1618
  }));
1606
1619
 
1607
1620
  return function createComment() {
1608
- return _ref15.apply(this, arguments);
1621
+ return _ref16.apply(this, arguments);
1609
1622
  };
1610
1623
  }();
1611
1624
 
@@ -1683,7 +1696,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1683
1696
  }, [activeTab]);
1684
1697
 
1685
1698
  var commentRevised = /*#__PURE__*/function () {
1686
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1699
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1687
1700
  var data;
1688
1701
  return _regenerator.default.wrap(function _callee13$(_context13) {
1689
1702
  while (1) {
@@ -1713,12 +1726,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1713
1726
  }));
1714
1727
 
1715
1728
  return function commentRevised() {
1716
- return _ref16.apply(this, arguments);
1729
+ return _ref17.apply(this, arguments);
1717
1730
  };
1718
1731
  }();
1719
1732
 
1720
1733
  var setAssignation = /*#__PURE__*/function () {
1721
- var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
1734
+ var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
1722
1735
  var _product$article16;
1723
1736
 
1724
1737
  var concept, productTemp, data;
@@ -1777,7 +1790,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1777
1790
  }));
1778
1791
 
1779
1792
  return function setAssignation(_x2, _x3) {
1780
- return _ref17.apply(this, arguments);
1793
+ return _ref18.apply(this, arguments);
1781
1794
  };
1782
1795
  }();
1783
1796
 
@@ -1947,7 +1960,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1947
1960
  // };
1948
1961
 
1949
1962
  var validateAll = /*#__PURE__*/function () {
1950
- var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
1963
+ var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
1951
1964
  var evaluationArray, conceptArray, messages, productTemp, messagesResponse;
1952
1965
  return _regenerator.default.wrap(function _callee15$(_context15) {
1953
1966
  while (1) {
@@ -2031,7 +2044,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
2031
2044
  }));
2032
2045
 
2033
2046
  return function validateAll(_x4) {
2034
- return _ref18.apply(this, arguments);
2047
+ return _ref19.apply(this, arguments);
2035
2048
  };
2036
2049
  }();
2037
2050
 
@@ -134,46 +134,31 @@ var getPercentage = /*#__PURE__*/function () {
134
134
 
135
135
  func = /*#__PURE__*/function () {
136
136
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
137
- var dataToSend, arrayRetailers, retailers;
137
+ var _params$headers$Autho, _params$headers;
138
+
139
+ var headers;
138
140
  return _regenerator.default.wrap(function _callee2$(_context2) {
139
141
  while (1) {
140
142
  switch (_context2.prev = _context2.next) {
141
143
  case 0:
142
- dataToSend = [];
143
- arrayRetailers = [];
144
- retailers = params.data[0].retailers || params.data[0].retailersAvailable;
145
- params.data.forEach(function (product, i) {
146
- dataToSend.push(product.article ? {
147
- id_article: product.article.id_article,
148
- id_category: product.article.id_category,
149
- version: product.version
150
- } : {
151
- id_article: product.id_article,
152
- id_category: product.id_category,
153
- version: product.version
154
- });
155
- retailers.forEach(function (retailer) {
156
- arrayRetailers.push(retailer.id);
157
- });
158
- dataToSend[i].id_retailer_array = arrayRetailers;
159
- });
160
- _context2.next = 6;
144
+ headers = {
145
+ Authorization: (_params$headers$Autho = params === null || params === void 0 ? void 0 : (_params$headers = params.headers) === null || _params$headers === void 0 ? void 0 : _params$headers.Authorization) !== null && _params$headers$Autho !== void 0 ? _params$headers$Autho : sessionStorage.getItem("jwt")
146
+ };
147
+ _context2.next = 3;
161
148
  return _axios.default.post(process.env.REACT_APP_VALID_EXPORT_ENDPOINT, {
162
- data: dataToSend
149
+ data: params.data
163
150
  }, {
164
- headers: {
165
- Authorization: sessionStorage.getItem("jwt")
166
- }
151
+ headers: headers
167
152
  }).then(function (response) {
168
153
  return [response.data];
169
154
  }).catch(function (err) {
170
155
  return console.log(err, "Errror");
171
156
  });
172
157
 
173
- case 6:
158
+ case 3:
174
159
  return _context2.abrupt("return", _context2.sent);
175
160
 
176
- case 7:
161
+ case 4:
177
162
  case "end":
178
163
  return _context2.stop();
179
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.4.70",
3
+ "version": "21.4.72",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -21,38 +21,54 @@ ProviderProductEditionDefault.args = {
21
21
  category: 287,
22
22
  version: 1,
23
23
  productSelected: {
24
- id_article: 39550,
25
- upc: 43654697,
26
- name: "Campana de Cocina",
27
- timestamp: "2023-08-04T22:23:40.000Z",
28
- categoryName:
29
- "Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
30
- id_category: 287,
24
+ category: "Accesorios Decorativos|Accesorios Decorativos",
25
+ company_name: "Demo",
26
+ company_id: 923,
27
+ id_category: "2028",
28
+ id_article: 118465,
29
+ name: "VELA AROMA 18 OZ MAN/CAN",
30
+ upc: "Modelo6",
31
+ isVisible: 1,
32
+ retailers: [
33
+ {
34
+ id: 68,
35
+ name: "The Home Depot Onboarding",
36
+ },
37
+ ],
31
38
  version: 1,
32
39
  retailersAvailable: [
33
- { name: "The Home Depot Golden", id: 58 },
34
- { name: "The Home Depot Onboarding", id: 68 },
40
+ {
41
+ id: 68,
42
+ name: "The Home Depot Onboarding",
43
+ },
35
44
  ],
36
- percentage: "89",
37
45
  },
38
46
  productToEdit: {
39
- idCategory: 287,
40
- ArticleId: 39550,
47
+ idCategory: "2028",
48
+ ArticleId: 118465,
41
49
  product: [
42
50
  {
43
- id_article: 39550,
44
- upc: 43654697,
45
- name: "Campana de Cocina",
46
- timestamp: "2023-08-04T22:23:40.000Z",
47
- categoryName:
48
- "Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
49
- id_category: 287,
51
+ category: "Accesorios Decorativos|Accesorios Decorativos",
52
+ company_name: "Demo",
53
+ company_id: 923,
54
+ id_category: "2028",
55
+ id_article: 118465,
56
+ name: "VELA AROMA 18 OZ MAN/CAN",
57
+ upc: "Modelo6",
58
+ isVisible: 1,
59
+ retailers: [
60
+ {
61
+ id: 68,
62
+ name: "The Home Depot Onboarding",
63
+ },
64
+ ],
50
65
  version: 1,
51
66
  retailersAvailable: [
52
- { name: "The Home Depot Golden", id: 58, percentage: 100 },
53
- { name: "The Home Depot Onboarding", id: 68, percentage: 78 },
67
+ {
68
+ id: 68,
69
+ name: "The Home Depot Onboarding",
70
+ },
54
71
  ],
55
- percentage: "89",
56
72
  },
57
73
  ],
58
74
  },
@@ -99,7 +115,7 @@ ProviderProductEditionDefault.args = {
99
115
  products_limit: "5000",
100
116
  type: "Enterprise",
101
117
  },
102
- src: "https://content-management-profile.s3.amazonaws.com/id-191/191.png?1697171804447",
118
+ src: "https://content-management-profile.s3.amazonaws.com/id-191/191.png?1701729602068",
103
119
  },
104
120
  company: {
105
121
  id_company: 923,
@@ -119,9 +135,6 @@ ProviderProductEditionDefault.args = {
119
135
  id: 68,
120
136
  name: "The Home Depot Onboarding",
121
137
  country: "México",
122
- id_region: 1,
123
- active: 1,
124
- flow: 1,
125
138
  },
126
139
  ],
127
140
  retailers: [
@@ -129,9 +142,6 @@ ProviderProductEditionDefault.args = {
129
142
  id: 68,
130
143
  name: "The Home Depot Onboarding",
131
144
  country: "México",
132
- id_region: 1,
133
- active: 1,
134
- flow: 1,
135
145
  },
136
146
  ],
137
147
  },
@@ -82,19 +82,26 @@ const reducerImages = (state, action) => {
82
82
  );
83
83
  return { ...state, values };
84
84
  case "orderImages": {
85
- let { inputsByRetailer, valuesInitial, inputsInitial, inputs } = state;
85
+ let {
86
+ inputsByRetailer = {},
87
+ valuesInitial,
88
+ inputsInitial,
89
+ inputs,
90
+ } = state;
86
91
  try {
87
92
  const orderedImages = [];
88
93
  const imageIdArray = [];
89
- if (action?.retailerId && !inputsByRetailer[action.retailerId])
94
+ if (action?.retailerId && !inputsByRetailer[action.retailerId]) {
90
95
  inputsByRetailer[action.retailerId] = [];
91
- action.retailerId &&
96
+ }
97
+ if (action.retailerId) {
92
98
  inputsByRetailer[action.retailerId]?.filter((input) => {
93
99
  imageIdArray.push(input.id_image);
94
100
  valuesInitial.forEach((value) => {
95
101
  if (value.image_id === input.id_image) orderedImages.push(value);
96
102
  });
97
103
  });
104
+ }
98
105
 
99
106
  inputs = inputsInitial?.filter((input) =>
100
107
  imageIdArray.includes(input.id)
@@ -102,7 +109,7 @@ const reducerImages = (state, action) => {
102
109
 
103
110
  values = orderedImages.length > 0 ? orderedImages : [];
104
111
  } catch (error) {
105
- console.log(error);
112
+ console.log(action.action, error);
106
113
  }
107
114
  return { ...state, values, inputs };
108
115
  }
@@ -485,7 +492,20 @@ export const ProviderProductEdition = ({
485
492
 
486
493
  setImages({ action: "init", init: services[2] });
487
494
  if (services[2]?.values?.length > 0) setActiveImage(0);
488
- getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
495
+ const data = [
496
+ {
497
+ id_article: product.id_article,
498
+ id_category: product.id_category,
499
+ version: product.version,
500
+ id_retailer_array: (
501
+ product.retailersAvailable ?? product.retailers
502
+ ).map(({ id }) => id),
503
+ },
504
+ ];
505
+ const headers = { Authorization: token };
506
+ getPercentage({ data, headers }).then((res) => {
507
+ setPercentages(res[0]);
508
+ });
489
509
  setLoading(false);
490
510
  };
491
511
 
@@ -545,12 +565,14 @@ export const ProviderProductEdition = ({
545
565
  };
546
566
 
547
567
  const getCart = async () => {
548
- const res = await axios.get(process.env.REACT_APP_CART, {
568
+ const res = await axios.get(`${process.env.REACT_APP_CART}/general/`, {
549
569
  headers: {
550
570
  Authorization: token,
551
571
  },
552
572
  });
553
- const arr = JSON.parse(res.data.body).data.map((e) => e.article_id);
573
+ const arr = Object.values(JSON.parse(res.data.body).data)
574
+ ?.map((e) => e.article_id)
575
+ .filter(Boolean);
554
576
  setInCart(arr.some((e) => e.articleId === product.id_article));
555
577
  };
556
578
 
@@ -648,7 +670,7 @@ export const ProviderProductEdition = ({
648
670
  value: e?.id,
649
671
  name: e?.name,
650
672
  required: e?.required,
651
- active: images?.values.some((value) => value?.image_id === e?.id),
673
+ active: images?.values?.some((value) => value?.image_id === e?.id),
652
674
  }));
653
675
  setSocketType(imageInputs);
654
676
  }, [images]);
@@ -692,7 +714,7 @@ export const ProviderProductEdition = ({
692
714
  attributeId,
693
715
  value: valueOfAtribute,
694
716
  boxId,
695
- })
717
+ });
696
718
  });
697
719
  });
698
720
 
@@ -700,8 +722,8 @@ export const ProviderProductEdition = ({
700
722
  articleId: product?.id_article,
701
723
  articleData: updatedDatasheets,
702
724
  ...(parseBoxData.length > 0 && { boxData: parseBoxData }),
703
- };
704
-
725
+ };
726
+
705
727
  if (product?.orderId) dataObject["orderId"] = product?.orderId;
706
728
  try {
707
729
  const res = await axios.put(
@@ -720,8 +742,7 @@ export const ProviderProductEdition = ({
720
742
  }
721
743
  } catch (error) {
722
744
  console.log(error);
723
- }
724
- console.log(dataObject)
745
+ }
725
746
  };
726
747
 
727
748
  const updateImages = useCallback(async () => {
@@ -1154,13 +1175,6 @@ export const ProviderProductEdition = ({
1154
1175
  }
1155
1176
  };
1156
1177
 
1157
-
1158
-
1159
-
1160
-
1161
-
1162
-
1163
-
1164
1178
  const evaluationToRetailer = async (result) => {
1165
1179
  const data = {
1166
1180
  articleId: product.id_article,
@@ -1240,7 +1254,6 @@ export const ProviderProductEdition = ({
1240
1254
  },
1241
1255
  ];
1242
1256
  const sendToEvaluation = (result) => {
1243
- console.log({ result });
1244
1257
  if (result === "A") {
1245
1258
  if (
1246
1259
  origin[activeTab] === "RequestWithoutContentoh" &&