contentoh-components-library 21.2.70 → 21.2.71

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,73 +31,162 @@ RetailerProductEditionDefault.args = {
31
31
  "Ficha técnica": false,
32
32
  Imágenes: false
33
33
  },
34
- token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJiMmNlNWIyYS02MDljLTRlNzktOWVhOS0yZjc0Y2ZmNDM4ODkiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6ImIyY2U1YjJhLTYwOWMtNGU3OS05ZWE5LTJmNzRjZmY0Mzg4OSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJhYWIzZDM1NS01MDYyLTQ2MTAtYjljZi03MjIyMTNlZTI4OWEiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY2MjA2NTU3NSwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY2MjA2OTE3NSwiaWF0IjoxNjYyMDY1NTc1LCJlbWFpbCI6ImF6YXJhdGVAY29udGVudG9oLmNvbSJ9.QtYQg6gjDDrfliKi9k5JnrJHRPt8Xh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Zh2bcMA926m3M3sa1NNmHPXlbDLt0qskcy19OHC5RL1MdvYeK5XpEdVbVKNeiWbsQpshJLqE0gb70EMYhh1mBxi7PKhi8HiCPFrUYRGbYTyVtGWN9CoqnVtoT2dag4MY2DSo6kVtH-M__Sw1UA5Y90INKutsBtx2GxW_uzeBzxxWpJ51WGvtsatUE0-_esd4yIZMvzgkzX-tCtIDzpZPI2x9HLeLdneEHnjM-zzI5ke8BQVCnbcv4q7kkETP0bWADApli0VJ5UBKRaL6_nNFqlDY0F6MWmz09LXirYV_jAoG09d4UCaa14u0VNDFKuIO08pSpiGcYXHOkh2C6Yw",
35
35
  productSelected: {
36
36
  services: {
37
37
  datasheets: 1,
38
38
  descriptions: 1,
39
39
  images: 1
40
40
  },
41
- orderId: 149,
42
- status: "IE",
43
- datasheet_status: "IE",
41
+ orderId: 3265,
42
+ status: "AA",
43
+ datasheet_status: "RP",
44
44
  prio: "none",
45
- version: 2,
46
- description_status: "IE",
47
- images_status: "IE",
45
+ version: 3,
46
+ description_status: "RP",
47
+ images_status: "AA",
48
+ statusByRetailer: {
49
+ 4: {
50
+ datasheet: "RP/RA/CA",
51
+ description: "RP/RA/CA",
52
+ images: "AP"
53
+ },
54
+ 5: {
55
+ datasheet: "RP/RA/AS",
56
+ description: "RP/RA/CA",
57
+ images: "AA"
58
+ },
59
+ 12: {
60
+ description: "RP/RA/CA",
61
+ images: "AA",
62
+ datasheet: "RP/RA/AS"
63
+ },
64
+ 13: {
65
+ datasheet: "RP/RA/AS",
66
+ description: "RP/RA/CA",
67
+ images: "AA"
68
+ },
69
+ 16: {
70
+ datasheet: "RP/RA/AS",
71
+ description: "RP/RA/CA",
72
+ images: "AA"
73
+ },
74
+ 29: {
75
+ datasheet: "RP/RA/AS",
76
+ description: "RP/RA/CA",
77
+ images: "AA"
78
+ },
79
+ 34: {
80
+ datasheet: "RP/RA/AC",
81
+ description: "RP/RA/AC",
82
+ images: "AA"
83
+ }
84
+ },
48
85
  article: {
49
- id_article: 76225,
50
- id_category: "2028",
51
- name: "Para documentar",
52
- upc: "222222222",
53
- timestamp: "2022-08-03T06:00:23.000Z",
54
- id_user: 59,
86
+ id_article: 78435,
87
+ id_category: "700",
88
+ name: "GAR S.ACT EA GEL SERUM 50ML",
89
+ upc: "7509552844672",
90
+ timestamp: "2022-07-27T04:02:57.000Z",
91
+ id_user: 342,
55
92
  status: "NULL",
56
93
  active: 1,
57
- company_id: 1,
58
- company_name: "Cadena Ismael",
59
- country: "México",
60
- id_order: 149,
61
- id_datasheet_especialist: 54,
62
- id_datasheet_facilitator: 52,
63
- id_description_especialist: 54,
64
- id_description_facilitator: 52,
65
- id_images_especialist: 55,
66
- id_images_facilitator: 53,
67
- id_auditor: 37,
94
+ company_id: 234,
95
+ SKU: null,
96
+ Descripcion: null,
97
+ Proveedor: null,
98
+ id_proveedor: 0,
99
+ company_name: "L'ORÉAL",
100
+ country: null,
101
+ id_order: 3265,
102
+ id_datasheet_especialist: 426,
103
+ id_datasheet_facilitator: null,
104
+ id_description_especialist: 405,
105
+ id_description_facilitator: null,
106
+ id_images_especialist: 1462,
107
+ id_images_facilitator: 160,
108
+ id_auditor: 9,
68
109
  id_recepcionist: null,
69
- category: "Decoración|Accesorios Decorativos|Accesorios Decorativos",
70
- missingAttributes: 0,
71
- missingDescriptions: 0,
72
- missingImages: 0
110
+ category: "Salud y Belleza|Cuidado Facial|Cremas, Mascarillas y Tratamientos",
111
+ missingAttributes: null,
112
+ missingDescriptions: null,
113
+ missingImages: null
73
114
  },
74
115
  retailers: [{
75
- id: 58,
76
- name: "The Home Depot Golden",
77
- percentage: 66.66666666666667,
78
- image: "https://content-management-images.s3.amazonaws.com/retailers/58.png",
79
- services: ["CA", "CA", "AS", "NA", "NA", "NA", "NA", "NA"]
116
+ id: 4,
117
+ name: "Walmart Super y Superama",
118
+ country: "México",
119
+ id_region: 1,
120
+ active: 1,
121
+ percentage: 100,
122
+ image: "https://content-management-images.s3.amazonaws.com/retailers/4.png",
123
+ services: ["RP/RA/CA", "RP/RA/CA", "AP", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA"]
124
+ }, {
125
+ id: 5,
126
+ name: "Chedraui",
127
+ country: "México",
128
+ id_region: 1,
129
+ active: 1,
130
+ percentage: 100,
131
+ image: "https://content-management-images.s3.amazonaws.com/retailers/5.png",
132
+ services: ["NA", "NA", "NA", "RP/RA/AS", "RP/RA/CA", "AA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA"]
80
133
  }, {
81
- id: 59,
82
- name: "The Home Depot Platinum",
83
- percentage: 66.66666666666667,
84
- image: "https://content-management-images.s3.amazonaws.com/retailers/59.png",
85
- services: ["NA", "NA", "NA", "AS", "NA", "NA", "NA", "NA"]
134
+ id: 6,
135
+ name: "HEB",
136
+ country: "México",
137
+ id_region: 1,
138
+ active: 1,
139
+ percentage: 100,
140
+ image: "https://content-management-images.s3.amazonaws.com/retailers/6.png",
141
+ services: ["NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA"]
86
142
  }, {
87
- id: 60,
88
- name: "The Home Depot Resizing",
89
- percentage: null,
90
- image: "https://content-management-images.s3.amazonaws.com/retailers/60.png",
91
- services: ["NA", "NA", "NA", "NA", "AS", "NA", "NA", "NA"]
143
+ id: 12,
144
+ name: "La Comer",
145
+ country: "México",
146
+ id_region: 1,
147
+ active: 1,
148
+ percentage: 100,
149
+ image: "https://content-management-images.s3.amazonaws.com/retailers/12.png",
150
+ services: ["NA", "NA", "NA", "NA", "NA", "NA", "RP/RA/AS", "RP/RA/CA", "AA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA"]
92
151
  }, {
93
- id: 61,
94
- name: "Home Depot TAB",
95
- percentage: null,
96
- image: "https://content-management-images.s3.amazonaws.com/retailers/61.png",
97
- services: ["NA", "NA", "NA", "NA", "NA", "CA", "CA", "AS"]
152
+ id: 13,
153
+ name: "Soriana",
154
+ country: "México",
155
+ id_region: 1,
156
+ active: 1,
157
+ percentage: 100,
158
+ image: "https://content-management-images.s3.amazonaws.com/retailers/13.png",
159
+ services: ["NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "RP/RA/AS", "RP/RA/CA", "AA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA"]
160
+ }, {
161
+ id: 16,
162
+ name: "Rappi",
163
+ country: "México",
164
+ id_region: 1,
165
+ active: 1,
166
+ percentage: 100,
167
+ image: "https://content-management-images.s3.amazonaws.com/retailers/16.png",
168
+ services: ["NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "RP/RA/AS", "RP/RA/CA", "AA", "NA", "NA", "NA", "NA", "NA", "NA"]
169
+ }, {
170
+ id: 29,
171
+ name: "Farmacias del Ahorro",
172
+ country: "México",
173
+ id_region: 1,
174
+ active: 1,
175
+ percentage: 100,
176
+ image: "https://content-management-images.s3.amazonaws.com/retailers/29.png",
177
+ services: ["NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "RP/RA/AS", "RP/RA/CA", "AA", "NA", "NA", "NA"]
178
+ }, {
179
+ id: 34,
180
+ name: "San Pablo",
181
+ country: "México",
182
+ id_region: 1,
183
+ active: 1,
184
+ percentage: 83.33333333333333,
185
+ image: "https://content-management-images.s3.amazonaws.com/retailers/34.png",
186
+ services: ["NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "RP/RA/AC", "RP/RA/AC", "AA"]
98
187
  }],
99
- country: "México",
100
- upc: "222222222"
188
+ country: null,
189
+ upc: "7509552844672"
101
190
  },
102
191
  location: {
103
192
  product: {
@@ -106,36 +195,36 @@ RetailerProductEditionDefault.args = {
106
195
  }
107
196
  },
108
197
  user: {
109
- id_user: 52,
110
- name: "FACILITADOR TXT PRUEBA",
111
- last_name: "",
112
- email: "azarate@contentoh.com",
113
- position: null,
198
+ id_user: 426,
199
+ name: "Especialista Textos",
200
+ last_name: " ",
201
+ email: "karafe3218@mom2kid.com",
202
+ position: "Tester",
114
203
  telephone: null,
115
204
  country: null,
116
- id_company: 2,
117
- id_cognito: "b2ce5b2a-609c-4e79-9ea9-2f74cff43889",
205
+ id_company: 254,
206
+ id_cognito: "8d010214-5bfa-43c3-96fb-c556dc05774b",
118
207
  birth_Date: null,
119
208
  about_me: null,
120
209
  zip_code: null,
121
210
  address: null,
122
211
  job: null,
123
212
  id_stripe: null,
124
- id_role: 4,
213
+ id_role: 7,
125
214
  active: 1,
126
215
  is_retailer: 0,
127
- email_notify: 0,
216
+ email_notify: null,
128
217
  membership: {
129
- id: 2,
130
- start_date: "2021-11-05T02:35:12.000Z",
131
- end_date: "2022-11-05T02:34:49.000Z",
132
- planID: 1,
133
- plan: "prod_KtkvuFFLpOdP6e",
134
- name: "Plan Free",
135
- user_limit: "1",
136
- products_limit: "3",
137
- type: "PyMES"
218
+ id: 750,
219
+ start_date: "2022-01-07T21:32:54.000Z",
220
+ end_date: "2023-01-07T21:32:54.000Z",
221
+ planID: 6,
222
+ plan: "prod_KvGd6YSTJyR3AP",
223
+ name: "Plan Small",
224
+ user_limit: "10",
225
+ products_limit: "1000",
226
+ type: "Enterprise"
138
227
  },
139
- src: "https://content-management-profile.s3.amazonaws.com/id-52/52.png?1662065576139"
228
+ src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1667253537878"
140
229
  }
141
230
  };
@@ -770,62 +770,65 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
770
770
 
771
771
  var saveDescriptions = /*#__PURE__*/function () {
772
772
  var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
773
- var _product$article9;
774
-
775
- var productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
773
+ var _product$article9, productTemp, _articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
776
774
 
777
775
  return _regenerator.default.wrap(function _callee5$(_context5) {
778
776
  while (1) {
779
777
  switch (_context5.prev = _context5.next) {
780
778
  case 0:
779
+ if (!updatedDescriptions) {
780
+ _context5.next = 24;
781
+ break;
782
+ }
783
+
781
784
  setLoading(true);
782
785
  productTemp = product;
783
- articleId = product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article;
786
+ _articleId = product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article;
784
787
  dataObject = {
785
- articleId: articleId,
788
+ articleId: _articleId,
786
789
  articleData: updatedDescriptions
787
790
  };
788
791
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
789
- _context5.prev = 5;
790
- _context5.next = 8;
792
+ _context5.prev = 6;
793
+ _context5.next = 9;
791
794
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
792
795
  headers: {
793
796
  Authorization: token
794
797
  }
795
798
  });
796
799
 
797
- case 8:
800
+ case 9:
798
801
  res = _context5.sent;
799
802
 
800
803
  if (!(res.data.statusCode === 200)) {
801
- _context5.next = 18;
804
+ _context5.next = 19;
802
805
  break;
803
806
  }
804
807
 
805
808
  _JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newArticleStatus = _JSON$parse2.newArticleStatus;
806
- if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
809
+ if (newArticleStatus) productTemp.status = newArticleStatus[_articleId];
807
810
  if (newStatus) productTemp.description_status = newStatus;
808
811
  setProduct(productTemp);
809
812
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
810
813
  setMessage("Descripciones guardadas con éxito");
811
- _context5.next = 18;
814
+ _context5.next = 19;
812
815
  return loadData();
813
816
 
814
- case 18:
815
- _context5.next = 23;
817
+ case 19:
818
+ _context5.next = 24;
816
819
  break;
817
820
 
818
- case 20:
819
- _context5.prev = 20;
820
- _context5.t0 = _context5["catch"](5);
821
+ case 21:
822
+ _context5.prev = 21;
823
+ _context5.t0 = _context5["catch"](6);
821
824
  console.log(_context5.t0);
822
825
 
823
- case 23:
826
+ case 24:
824
827
  case "end":
825
828
  return _context5.stop();
826
829
  }
827
830
  }
828
- }, _callee5, null, [[5, 20]]);
831
+ }, _callee5, null, [[6, 21]]);
829
832
  }));
830
833
 
831
834
  return function saveDescriptions() {
@@ -835,62 +838,65 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
835
838
 
836
839
  var saveDatasheets = /*#__PURE__*/function () {
837
840
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
838
- var _product$article10;
839
-
840
- var productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
841
+ var _product$article10, productTemp, _articleId2, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
841
842
 
842
843
  return _regenerator.default.wrap(function _callee6$(_context6) {
843
844
  while (1) {
844
845
  switch (_context6.prev = _context6.next) {
845
846
  case 0:
847
+ if (!(updatedDatasheets.length > 0)) {
848
+ _context6.next = 24;
849
+ break;
850
+ }
851
+
846
852
  setLoading(true);
847
853
  productTemp = product;
848
- articleId = product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article;
854
+ _articleId2 = product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article;
849
855
  dataObject = {
850
- articleId: articleId,
856
+ articleId: _articleId2,
851
857
  articleData: updatedDatasheets
852
858
  };
853
859
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
854
- _context6.prev = 5;
855
- _context6.next = 8;
860
+ _context6.prev = 6;
861
+ _context6.next = 9;
856
862
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
857
863
  headers: {
858
864
  Authorization: token
859
865
  }
860
866
  });
861
867
 
862
- case 8:
868
+ case 9:
863
869
  res = _context6.sent;
864
870
 
865
871
  if (!(res.data.statusCode === 200)) {
866
- _context6.next = 18;
872
+ _context6.next = 19;
867
873
  break;
868
874
  }
869
875
 
870
876
  _JSON$parse3 = JSON.parse(res.data.body), newStatus = _JSON$parse3.newStatus, newArticleStatus = _JSON$parse3.newArticleStatus;
871
- if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
877
+ if (newArticleStatus) productTemp.status = newArticleStatus[_articleId2];
872
878
  if (newStatus) productTemp.datasheet_status = newStatus;
873
879
  setProduct(productTemp);
874
880
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
875
881
  setMessage("Fichas técnicas guardadas");
876
- _context6.next = 18;
882
+ _context6.next = 19;
877
883
  return loadData();
878
884
 
879
- case 18:
880
- _context6.next = 23;
885
+ case 19:
886
+ _context6.next = 24;
881
887
  break;
882
888
 
883
- case 20:
884
- _context6.prev = 20;
885
- _context6.t0 = _context6["catch"](5);
889
+ case 21:
890
+ _context6.prev = 21;
891
+ _context6.t0 = _context6["catch"](6);
886
892
  console.log(_context6.t0);
887
893
 
888
- case 23:
894
+ case 24:
889
895
  case "end":
890
896
  return _context6.stop();
891
897
  }
892
898
  }
893
- }, _callee6, null, [[5, 20]]);
899
+ }, _callee6, null, [[6, 21]]);
894
900
  }));
895
901
 
896
902
  return function saveDatasheets() {
@@ -1219,7 +1225,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1219
1225
 
1220
1226
  var sendToFacilitator = /*#__PURE__*/function () {
1221
1227
  var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
1222
- var concept, productTemp, evalStatus, _articleId, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus;
1228
+ var concept, productTemp, evalStatus, _articleId3, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus;
1223
1229
 
1224
1230
  return _regenerator.default.wrap(function _callee9$(_context9) {
1225
1231
  while (1) {
@@ -1230,10 +1236,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1230
1236
  concept = getConcept(activeTab);
1231
1237
  productTemp = (0, _objectSpread2.default)({}, product);
1232
1238
  evalStatus = retailerStatus;
1233
- _articleId = product.article.id_article;
1239
+ _articleId3 = product.article.id_article;
1234
1240
  orderId = product.orderId;
1235
1241
  data = {
1236
- articleId: _articleId,
1242
+ articleId: _articleId3,
1237
1243
  orderId: orderId,
1238
1244
  concept: concept,
1239
1245
  evalStatus: evalStatus,
@@ -1287,7 +1293,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1287
1293
  }
1288
1294
 
1289
1295
  _JSON$parse5 = JSON.parse(res.data.body), newStatus = _JSON$parse5.newStatus, newOrderStatus = _JSON$parse5.newOrderStatus, newArticleStatus = _JSON$parse5.newArticleStatus;
1290
- if (newOrderStatus) productTemp.status = newArticleStatus[_articleId];
1296
+ if (newOrderStatus) productTemp.status = newArticleStatus[_articleId3];
1291
1297
  productTemp["".concat(concept, "_status")] = newStatus;
1292
1298
  _context9.next = 27;
1293
1299
  return loadData();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.2.70",
3
+ "version": "21.2.71",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -16,117 +16,391 @@ RetailerProductEditionDefault.args = {
16
16
  Imágenes: false,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1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8BQVCnbcv4q7kkETP0bWADApli0VJ5UBKRaL6_nNFqlDY0F6MWmz09LXirYV_jAoG09d4UCaa14u0VNDFKuIO08pSpiGcYXHOkh2C6Yw",
20
20
  productSelected: {
21
21
  services: {
22
22
  datasheets: 1,
23
23
  descriptions: 1,
24
24
  images: 1,
25
25
  },
26
- orderId: 149,
27
- status: "IE",
28
- datasheet_status: "IE",
26
+ orderId: 3265,
27
+ status: "AA",
28
+ datasheet_status: "RP",
29
29
  prio: "none",
30
- version: 2,
31
- description_status: "IE",
32
- images_status: "IE",
30
+ version: 3,
31
+ description_status: "RP",
32
+ images_status: "AA",
33
+ statusByRetailer: {
34
+ 4: {
35
+ datasheet: "RP/RA/CA",
36
+ description: "RP/RA/CA",
37
+ images: "AP",
38
+ },
39
+ 5: {
40
+ datasheet: "RP/RA/AS",
41
+ description: "RP/RA/CA",
42
+ images: "AA",
43
+ },
44
+ 12: {
45
+ description: "RP/RA/CA",
46
+ images: "AA",
47
+ datasheet: "RP/RA/AS",
48
+ },
49
+ 13: {
50
+ datasheet: "RP/RA/AS",
51
+ description: "RP/RA/CA",
52
+ images: "AA",
53
+ },
54
+ 16: {
55
+ datasheet: "RP/RA/AS",
56
+ description: "RP/RA/CA",
57
+ images: "AA",
58
+ },
59
+ 29: {
60
+ datasheet: "RP/RA/AS",
61
+ description: "RP/RA/CA",
62
+ images: "AA",
63
+ },
64
+ 34: {
65
+ datasheet: "RP/RA/AC",
66
+ description: "RP/RA/AC",
67
+ images: "AA",
68
+ },
69
+ },
33
70
  article: {
34
- id_article: 76225,
35
- id_category: "2028",
36
- name: "Para documentar",
37
- upc: "222222222",
38
- timestamp: "2022-08-03T06:00:23.000Z",
39
- id_user: 59,
71
+ id_article: 78435,
72
+ id_category: "700",
73
+ name: "GAR S.ACT EA GEL SERUM 50ML",
74
+ upc: "7509552844672",
75
+ timestamp: "2022-07-27T04:02:57.000Z",
76
+ id_user: 342,
40
77
  status: "NULL",
41
78
  active: 1,
42
- company_id: 1,
43
- company_name: "Cadena Ismael",
44
- country: "México",
45
- id_order: 149,
46
- id_datasheet_especialist: 54,
47
- id_datasheet_facilitator: 52,
48
- id_description_especialist: 54,
49
- id_description_facilitator: 52,
50
- id_images_especialist: 55,
51
- id_images_facilitator: 53,
52
- id_auditor: 37,
79
+ company_id: 234,
80
+ SKU: null,
81
+ Descripcion: null,
82
+ Proveedor: null,
83
+ id_proveedor: 0,
84
+ company_name: "L'ORÉAL",
85
+ country: null,
86
+ id_order: 3265,
87
+ id_datasheet_especialist: 426,
88
+ id_datasheet_facilitator: null,
89
+ id_description_especialist: 405,
90
+ id_description_facilitator: null,
91
+ id_images_especialist: 1462,
92
+ id_images_facilitator: 160,
93
+ id_auditor: 9,
53
94
  id_recepcionist: null,
54
- category: "Decoración|Accesorios Decorativos|Accesorios Decorativos",
55
- missingAttributes: 0,
56
- missingDescriptions: 0,
57
- missingImages: 0,
95
+ category:
96
+ "Salud y Belleza|Cuidado Facial|Cremas, Mascarillas y Tratamientos",
97
+ missingAttributes: null,
98
+ missingDescriptions: null,
99
+ missingImages: null,
58
100
  },
59
101
  retailers: [
60
102
  {
61
- id: 58,
62
- name: "The Home Depot Golden",
63
- percentage: 66.66666666666667,
103
+ id: 4,
104
+ name: "Walmart Super y Superama",
105
+ country: "México",
106
+ id_region: 1,
107
+ active: 1,
108
+ percentage: 100,
109
+ image:
110
+ "https://content-management-images.s3.amazonaws.com/retailers/4.png",
111
+ services: [
112
+ "RP/RA/CA",
113
+ "RP/RA/CA",
114
+ "AP",
115
+ "NA",
116
+ "NA",
117
+ "NA",
118
+ "NA",
119
+ "NA",
120
+ "NA",
121
+ "NA",
122
+ "NA",
123
+ "NA",
124
+ "NA",
125
+ "NA",
126
+ "NA",
127
+ "NA",
128
+ "NA",
129
+ "NA",
130
+ "NA",
131
+ "NA",
132
+ "NA",
133
+ ],
134
+ },
135
+ {
136
+ id: 5,
137
+ name: "Chedraui",
138
+ country: "México",
139
+ id_region: 1,
140
+ active: 1,
141
+ percentage: 100,
64
142
  image:
65
- "https://content-management-images.s3.amazonaws.com/retailers/58.png",
66
- services: ["CA", "CA", "AS", "NA", "NA", "NA", "NA", "NA"],
143
+ "https://content-management-images.s3.amazonaws.com/retailers/5.png",
144
+ services: [
145
+ "NA",
146
+ "NA",
147
+ "NA",
148
+ "RP/RA/AS",
149
+ "RP/RA/CA",
150
+ "AA",
151
+ "NA",
152
+ "NA",
153
+ "NA",
154
+ "NA",
155
+ "NA",
156
+ "NA",
157
+ "NA",
158
+ "NA",
159
+ "NA",
160
+ "NA",
161
+ "NA",
162
+ "NA",
163
+ "NA",
164
+ "NA",
165
+ "NA",
166
+ ],
67
167
  },
68
168
  {
69
- id: 59,
70
- name: "The Home Depot Platinum",
71
- percentage: 66.66666666666667,
169
+ id: 6,
170
+ name: "HEB",
171
+ country: "México",
172
+ id_region: 1,
173
+ active: 1,
174
+ percentage: 100,
72
175
  image:
73
- "https://content-management-images.s3.amazonaws.com/retailers/59.png",
74
- services: ["NA", "NA", "NA", "AS", "NA", "NA", "NA", "NA"],
176
+ "https://content-management-images.s3.amazonaws.com/retailers/6.png",
177
+ services: [
178
+ "NA",
179
+ "NA",
180
+ "NA",
181
+ "NA",
182
+ "NA",
183
+ "NA",
184
+ "NA",
185
+ "NA",
186
+ "NA",
187
+ "NA",
188
+ "NA",
189
+ "NA",
190
+ "NA",
191
+ "NA",
192
+ "NA",
193
+ "NA",
194
+ "NA",
195
+ "NA",
196
+ "NA",
197
+ "NA",
198
+ "NA",
199
+ ],
75
200
  },
76
201
  {
77
- id: 60,
78
- name: "The Home Depot Resizing",
79
- percentage: null,
202
+ id: 12,
203
+ name: "La Comer",
204
+ country: "México",
205
+ id_region: 1,
206
+ active: 1,
207
+ percentage: 100,
80
208
  image:
81
- "https://content-management-images.s3.amazonaws.com/retailers/60.png",
82
- services: ["NA", "NA", "NA", "NA", "AS", "NA", "NA", "NA"],
209
+ "https://content-management-images.s3.amazonaws.com/retailers/12.png",
210
+ services: [
211
+ "NA",
212
+ "NA",
213
+ "NA",
214
+ "NA",
215
+ "NA",
216
+ "NA",
217
+ "RP/RA/AS",
218
+ "RP/RA/CA",
219
+ "AA",
220
+ "NA",
221
+ "NA",
222
+ "NA",
223
+ "NA",
224
+ "NA",
225
+ "NA",
226
+ "NA",
227
+ "NA",
228
+ "NA",
229
+ "NA",
230
+ "NA",
231
+ "NA",
232
+ ],
83
233
  },
84
234
  {
85
- id: 61,
86
- name: "Home Depot TAB",
87
- percentage: null,
235
+ id: 13,
236
+ name: "Soriana",
237
+ country: "México",
238
+ id_region: 1,
239
+ active: 1,
240
+ percentage: 100,
88
241
  image:
89
- "https://content-management-images.s3.amazonaws.com/retailers/61.png",
90
- services: ["NA", "NA", "NA", "NA", "NA", "CA", "CA", "AS"],
242
+ "https://content-management-images.s3.amazonaws.com/retailers/13.png",
243
+ services: [
244
+ "NA",
245
+ "NA",
246
+ "NA",
247
+ "NA",
248
+ "NA",
249
+ "NA",
250
+ "NA",
251
+ "NA",
252
+ "NA",
253
+ "RP/RA/AS",
254
+ "RP/RA/CA",
255
+ "AA",
256
+ "NA",
257
+ "NA",
258
+ "NA",
259
+ "NA",
260
+ "NA",
261
+ "NA",
262
+ "NA",
263
+ "NA",
264
+ "NA",
265
+ ],
266
+ },
267
+ {
268
+ id: 16,
269
+ name: "Rappi",
270
+ country: "México",
271
+ id_region: 1,
272
+ active: 1,
273
+ percentage: 100,
274
+ image:
275
+ "https://content-management-images.s3.amazonaws.com/retailers/16.png",
276
+ services: [
277
+ "NA",
278
+ "NA",
279
+ "NA",
280
+ "NA",
281
+ "NA",
282
+ "NA",
283
+ "NA",
284
+ "NA",
285
+ "NA",
286
+ "NA",
287
+ "NA",
288
+ "NA",
289
+ "RP/RA/AS",
290
+ "RP/RA/CA",
291
+ "AA",
292
+ "NA",
293
+ "NA",
294
+ "NA",
295
+ "NA",
296
+ "NA",
297
+ "NA",
298
+ ],
299
+ },
300
+ {
301
+ id: 29,
302
+ name: "Farmacias del Ahorro",
303
+ country: "México",
304
+ id_region: 1,
305
+ active: 1,
306
+ percentage: 100,
307
+ image:
308
+ "https://content-management-images.s3.amazonaws.com/retailers/29.png",
309
+ services: [
310
+ "NA",
311
+ "NA",
312
+ "NA",
313
+ "NA",
314
+ "NA",
315
+ "NA",
316
+ "NA",
317
+ "NA",
318
+ "NA",
319
+ "NA",
320
+ "NA",
321
+ "NA",
322
+ "NA",
323
+ "NA",
324
+ "NA",
325
+ "RP/RA/AS",
326
+ "RP/RA/CA",
327
+ "AA",
328
+ "NA",
329
+ "NA",
330
+ "NA",
331
+ ],
332
+ },
333
+ {
334
+ id: 34,
335
+ name: "San Pablo",
336
+ country: "México",
337
+ id_region: 1,
338
+ active: 1,
339
+ percentage: 83.33333333333333,
340
+ image:
341
+ "https://content-management-images.s3.amazonaws.com/retailers/34.png",
342
+ services: [
343
+ "NA",
344
+ "NA",
345
+ "NA",
346
+ "NA",
347
+ "NA",
348
+ "NA",
349
+ "NA",
350
+ "NA",
351
+ "NA",
352
+ "NA",
353
+ "NA",
354
+ "NA",
355
+ "NA",
356
+ "NA",
357
+ "NA",
358
+ "NA",
359
+ "NA",
360
+ "NA",
361
+ "RP/RA/AC",
362
+ "RP/RA/AC",
363
+ "AA",
364
+ ],
91
365
  },
92
366
  ],
93
- country: "México",
94
- upc: "222222222",
367
+ country: null,
368
+ upc: "7509552844672",
95
369
  },
96
370
  location: {
97
371
  product: { articleId: 109485, versionId: 3 },
98
372
  },
99
373
  user: {
100
- id_user: 52,
101
- name: "FACILITADOR TXT PRUEBA",
102
- last_name: "",
103
- email: "azarate@contentoh.com",
104
- position: null,
374
+ id_user: 426,
375
+ name: "Especialista Textos",
376
+ last_name: " ",
377
+ email: "karafe3218@mom2kid.com",
378
+ position: "Tester",
105
379
  telephone: null,
106
380
  country: null,
107
- id_company: 2,
108
- id_cognito: "b2ce5b2a-609c-4e79-9ea9-2f74cff43889",
381
+ id_company: 254,
382
+ id_cognito: "8d010214-5bfa-43c3-96fb-c556dc05774b",
109
383
  birth_Date: null,
110
384
  about_me: null,
111
385
  zip_code: null,
112
386
  address: null,
113
387
  job: null,
114
388
  id_stripe: null,
115
- id_role: 4,
389
+ id_role: 7,
116
390
  active: 1,
117
391
  is_retailer: 0,
118
- email_notify: 0,
392
+ email_notify: null,
119
393
  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",
394
+ id: 750,
395
+ start_date: "2022-01-07T21:32:54.000Z",
396
+ end_date: "2023-01-07T21:32:54.000Z",
397
+ planID: 6,
398
+ plan: "prod_KvGd6YSTJyR3AP",
399
+ name: "Plan Small",
400
+ user_limit: "10",
401
+ products_limit: "1000",
402
+ type: "Enterprise",
129
403
  },
130
- src: "https://content-management-profile.s3.amazonaws.com/id-52/52.png?1662065576139",
404
+ src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1667253537878",
131
405
  },
132
406
  };
@@ -441,70 +441,82 @@ export const RetailerProductEdition = ({
441
441
  };
442
442
 
443
443
  const saveDescriptions = async () => {
444
- setLoading(true);
445
- const productTemp = product;
446
- const articleId = product?.article?.id_article;
447
- const dataObject = {
448
- articleId,
449
- articleData: updatedDescriptions,
450
- };
451
- if (product?.orderId) dataObject["orderId"] = product?.orderId;
452
- try {
453
- const res = await axios.put(
454
- `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
455
- dataObject,
456
- {
457
- headers: {
458
- Authorization: token,
459
- },
460
- }
461
- );
462
- if (res.data.statusCode === 200) {
463
- const { newStatus, newArticleStatus } = JSON.parse(res.data.body);
464
- if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
465
- if (newStatus) productTemp.description_status = newStatus;
466
- setProduct(productTemp);
467
- sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
444
+ if (updatedDescriptions) {
445
+ setLoading(true);
446
+ const productTemp = product;
447
+ const articleId = product?.article?.id_article;
448
+ const dataObject = {
449
+ articleId,
450
+ articleData: updatedDescriptions,
451
+ };
452
+ if (product?.orderId) dataObject["orderId"] = product?.orderId;
453
+ try {
454
+ const res = await axios.put(
455
+ `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
456
+ dataObject,
457
+ {
458
+ headers: {
459
+ Authorization: token,
460
+ },
461
+ }
462
+ );
463
+ if (res.data.statusCode === 200) {
464
+ const { newStatus, newArticleStatus } = JSON.parse(res.data.body);
465
+ if (newArticleStatus)
466
+ productTemp.status = newArticleStatus[articleId];
467
+ if (newStatus) productTemp.description_status = newStatus;
468
+ setProduct(productTemp);
469
+ sessionStorage.setItem(
470
+ "productSelected",
471
+ JSON.stringify(productTemp)
472
+ );
468
473
 
469
- setMessage("Descripciones guardadas con éxito");
470
- await loadData();
474
+ setMessage("Descripciones guardadas con éxito");
475
+ await loadData();
476
+ }
477
+ } catch (error) {
478
+ console.log(error);
471
479
  }
472
- } catch (error) {
473
- console.log(error);
474
480
  }
475
481
  };
476
482
 
477
483
  const saveDatasheets = async () => {
478
- setLoading(true);
479
- const productTemp = product;
480
- const articleId = product?.article?.id_article;
481
- const dataObject = {
482
- articleId,
483
- articleData: updatedDatasheets,
484
- };
485
- if (product?.orderId) dataObject["orderId"] = product?.orderId;
486
- try {
487
- const res = await axios.put(
488
- `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?datasheet=true&version=${version}`,
489
- dataObject,
490
- {
491
- headers: {
492
- Authorization: token,
493
- },
494
- }
495
- );
496
- if (res.data.statusCode === 200) {
497
- const { newStatus, newArticleStatus } = JSON.parse(res.data.body);
498
- if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
499
- if (newStatus) productTemp.datasheet_status = newStatus;
500
- setProduct(productTemp);
501
- sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
484
+ if (updatedDatasheets.length > 0) {
485
+ setLoading(true);
486
+ const productTemp = product;
487
+ const articleId = product?.article?.id_article;
488
+ const dataObject = {
489
+ articleId,
490
+ articleData: updatedDatasheets,
491
+ };
492
+ if (product?.orderId) dataObject["orderId"] = product?.orderId;
493
+ try {
494
+ const res = await axios.put(
495
+ `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?datasheet=true&version=${version}`,
496
+ dataObject,
497
+ {
498
+ headers: {
499
+ Authorization: token,
500
+ },
501
+ }
502
+ );
503
+ if (res.data.statusCode === 200) {
504
+ const { newStatus, newArticleStatus } = JSON.parse(res.data.body);
505
+ if (newArticleStatus)
506
+ productTemp.status = newArticleStatus[articleId];
507
+ if (newStatus) productTemp.datasheet_status = newStatus;
508
+ setProduct(productTemp);
509
+ sessionStorage.setItem(
510
+ "productSelected",
511
+ JSON.stringify(productTemp)
512
+ );
502
513
 
503
- setMessage("Fichas técnicas guardadas");
504
- await loadData();
514
+ setMessage("Fichas técnicas guardadas");
515
+ await loadData();
516
+ }
517
+ } catch (error) {
518
+ console.log(error);
505
519
  }
506
- } catch (error) {
507
- console.log(error);
508
520
  }
509
521
  };
510
522