contentoh-components-library 21.4.70 → 21.4.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.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -36,43 +36,45 @@ ProviderProductEditionDefault.args = {
36
36
  category: 287,
37
37
  version: 1,
38
38
  productSelected: {
39
- id_article: 39550,
40
- upc: 43654697,
41
- name: "Campana de Cocina",
42
- timestamp: "2023-08-04T22:23:40.000Z",
43
- categoryName: "Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
44
- id_category: 287,
39
+ category: "Accesorios Decorativos|Accesorios Decorativos",
40
+ company_name: "Demo",
41
+ company_id: 923,
42
+ id_category: "2028",
43
+ id_article: 118465,
44
+ name: "VELA AROMA 18 OZ MAN/CAN",
45
+ upc: "Modelo6",
46
+ isVisible: 1,
47
+ retailers: [{
48
+ id: 68,
49
+ name: "The Home Depot Onboarding"
50
+ }],
45
51
  version: 1,
46
52
  retailersAvailable: [{
47
- name: "The Home Depot Golden",
48
- id: 58
49
- }, {
50
- name: "The Home Depot Onboarding",
51
- id: 68
52
- }],
53
- percentage: "89"
53
+ id: 68,
54
+ name: "The Home Depot Onboarding"
55
+ }]
54
56
  },
55
57
  productToEdit: {
56
- idCategory: 287,
57
- ArticleId: 39550,
58
+ idCategory: "2028",
59
+ ArticleId: 118465,
58
60
  product: [{
59
- id_article: 39550,
60
- upc: 43654697,
61
- name: "Campana de Cocina",
62
- timestamp: "2023-08-04T22:23:40.000Z",
63
- categoryName: "Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
64
- id_category: 287,
61
+ category: "Accesorios Decorativos|Accesorios Decorativos",
62
+ company_name: "Demo",
63
+ company_id: 923,
64
+ id_category: "2028",
65
+ id_article: 118465,
66
+ name: "VELA AROMA 18 OZ MAN/CAN",
67
+ upc: "Modelo6",
68
+ isVisible: 1,
69
+ retailers: [{
70
+ id: 68,
71
+ name: "The Home Depot Onboarding"
72
+ }],
65
73
  version: 1,
66
74
  retailersAvailable: [{
67
- name: "The Home Depot Golden",
68
- id: 58,
69
- percentage: 100
70
- }, {
71
- name: "The Home Depot Onboarding",
72
75
  id: 68,
73
- percentage: 78
74
- }],
75
- percentage: "89"
76
+ name: "The Home Depot Onboarding"
77
+ }]
76
78
  }]
77
79
  },
78
80
  location: {
@@ -118,7 +120,7 @@ ProviderProductEditionDefault.args = {
118
120
  products_limit: "5000",
119
121
  type: "Enterprise"
120
122
  },
121
- src: "https://content-management-profile.s3.amazonaws.com/id-191/191.png?1697171804447"
123
+ src: "https://content-management-profile.s3.amazonaws.com/id-191/191.png?1701729602068"
122
124
  },
123
125
  company: {
124
126
  id_company: 923,
@@ -136,18 +138,12 @@ ProviderProductEditionDefault.args = {
136
138
  financedRetailers: [{
137
139
  id: 68,
138
140
  name: "The Home Depot Onboarding",
139
- country: "México",
140
- id_region: 1,
141
- active: 1,
142
- flow: 1
141
+ country: "México"
143
142
  }],
144
143
  retailers: [{
145
144
  id: 68,
146
145
  name: "The Home Depot Onboarding",
147
- country: "México",
148
- id_region: 1,
149
- active: 1,
150
- flow: 1
146
+ country: "México"
151
147
  }]
152
148
  },
153
149
  showSurvey: function showSurvey(v) {
@@ -162,29 +162,37 @@ var reducerImages = function reducerImages(state, action) {
162
162
 
163
163
  case "orderImages":
164
164
  {
165
- var _inputsByRetailer = state.inputsByRetailer,
165
+ var _state$inputsByRetail = state.inputsByRetailer,
166
+ _inputsByRetailer = _state$inputsByRetail === void 0 ? {} : _state$inputsByRetail,
166
167
  valuesInitial = state.valuesInitial,
167
168
  inputsInitial = state.inputsInitial,
168
169
  inputs = state.inputs;
169
170
 
170
171
  try {
171
- var _inputsByRetailer$act;
172
-
173
172
  var orderedImages = [];
174
173
  var imageIdArray = [];
175
- if (action !== null && action !== void 0 && action.retailerId && !_inputsByRetailer[action.retailerId]) _inputsByRetailer[action.retailerId] = [];
176
- action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
177
- imageIdArray.push(input.id_image);
178
- valuesInitial.forEach(function (value) {
179
- if (value.image_id === input.id_image) orderedImages.push(value);
174
+
175
+ if (action !== null && action !== void 0 && action.retailerId && !_inputsByRetailer[action.retailerId]) {
176
+ _inputsByRetailer[action.retailerId] = [];
177
+ }
178
+
179
+ if (action.retailerId) {
180
+ var _inputsByRetailer$act;
181
+
182
+ (_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
183
+ imageIdArray.push(input.id_image);
184
+ valuesInitial.forEach(function (value) {
185
+ if (value.image_id === input.id_image) orderedImages.push(value);
186
+ });
180
187
  });
181
- }));
188
+ }
189
+
182
190
  inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
183
191
  return imageIdArray.includes(input.id);
184
192
  });
185
193
  values = orderedImages.length > 0 ? orderedImages : [];
186
194
  } catch (error) {
187
- console.log(error);
195
+ console.log(action.action, error);
188
196
  }
189
197
 
190
198
  return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
@@ -887,7 +895,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
887
895
  var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
888
896
  var _product$article, _product$article2, _product$article3, _services$, _services$$values;
889
897
 
890
- var services;
898
+ var services, data;
891
899
  return _regenerator.default.wrap(function _callee8$(_context8) {
892
900
  while (1) {
893
901
  switch (_context8.prev = _context8.next) {
@@ -908,14 +916,20 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
908
916
  init: services[2]
909
917
  });
910
918
  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);
919
+ data = [(0, _objectSpread3.default)((0, _objectSpread3.default)({}, product), {}, {
920
+ retailersAvailable: product.retailersAvailable.map(function (_ref7) {
921
+ var id = _ref7.id;
922
+ return id;
923
+ })
924
+ })];
911
925
  (0, _data.getPercentage)({
912
- data: [product]
926
+ data: data
913
927
  }).then(function (res) {
914
- return setPercentages(res[0]);
928
+ setPercentages(res[0]);
915
929
  });
916
930
  setLoading(false);
917
931
 
918
- case 10:
932
+ case 11:
919
933
  case "end":
920
934
  return _context8.stop();
921
935
  }
@@ -929,7 +943,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
929
943
  }();
930
944
 
931
945
  var getServices = /*#__PURE__*/function () {
932
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
946
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
933
947
  var _product$article4;
934
948
 
935
949
  var productInOrder, idArticle, retailers, active, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailerResponse;
@@ -974,7 +988,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
974
988
  }));
975
989
 
976
990
  return function getServices() {
977
- return _ref7.apply(this, arguments);
991
+ return _ref8.apply(this, arguments);
978
992
  };
979
993
  }();
980
994
 
@@ -1004,14 +1018,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1004
1018
  };
1005
1019
 
1006
1020
  var getCart = /*#__PURE__*/function () {
1007
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1021
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1022
+ var _Object$values;
1023
+
1008
1024
  var res, arr;
1009
1025
  return _regenerator.default.wrap(function _callee10$(_context10) {
1010
1026
  while (1) {
1011
1027
  switch (_context10.prev = _context10.next) {
1012
1028
  case 0:
1013
1029
  _context10.next = 2;
1014
- return _axios.default.get(process.env.REACT_APP_CART, {
1030
+ return _axios.default.get("".concat(process.env.REACT_APP_CART, "/general/"), {
1015
1031
  headers: {
1016
1032
  Authorization: token
1017
1033
  }
@@ -1019,9 +1035,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1019
1035
 
1020
1036
  case 2:
1021
1037
  res = _context10.sent;
1022
- arr = JSON.parse(res.data.body).data.map(function (e) {
1038
+ arr = (_Object$values = Object.values(JSON.parse(res.data.body).data)) === null || _Object$values === void 0 ? void 0 : _Object$values.map(function (e) {
1023
1039
  return e.article_id;
1024
- });
1040
+ }).filter(Boolean);
1025
1041
  setInCart(arr.some(function (e) {
1026
1042
  return e.articleId === product.id_article;
1027
1043
  }));
@@ -1035,7 +1051,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1035
1051
  }));
1036
1052
 
1037
1053
  return function getCart() {
1038
- return _ref8.apply(this, arguments);
1054
+ return _ref9.apply(this, arguments);
1039
1055
  };
1040
1056
  }();
1041
1057
 
@@ -1148,11 +1164,13 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1148
1164
  var _images$inputs;
1149
1165
 
1150
1166
  var imageInputs = images === null || images === void 0 ? void 0 : (_images$inputs = images.inputs) === null || _images$inputs === void 0 ? void 0 : _images$inputs.map(function (e) {
1167
+ var _images$values2;
1168
+
1151
1169
  return {
1152
1170
  value: e === null || e === void 0 ? void 0 : e.id,
1153
1171
  name: e === null || e === void 0 ? void 0 : e.name,
1154
1172
  required: e === null || e === void 0 ? void 0 : e.required,
1155
- active: images === null || images === void 0 ? void 0 : images.values.some(function (value) {
1173
+ active: images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.some(function (value) {
1156
1174
  return (value === null || value === void 0 ? void 0 : value.image_id) === (e === null || e === void 0 ? void 0 : e.id);
1157
1175
  })
1158
1176
  };
@@ -1161,7 +1179,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1161
1179
  }, [images]);
1162
1180
 
1163
1181
  var saveDescriptions = /*#__PURE__*/function () {
1164
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1182
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1165
1183
  var dataObject, res;
1166
1184
  return _regenerator.default.wrap(function _callee11$(_context11) {
1167
1185
  while (1) {
@@ -1212,21 +1230,21 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1212
1230
  }));
1213
1231
 
1214
1232
  return function saveDescriptions() {
1215
- return _ref9.apply(this, arguments);
1233
+ return _ref10.apply(this, arguments);
1216
1234
  };
1217
1235
  }();
1218
1236
 
1219
1237
  var saveDatasheets = /*#__PURE__*/function () {
1220
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1238
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1221
1239
  var parseBoxData, dataObject, res;
1222
1240
  return _regenerator.default.wrap(function _callee12$(_context12) {
1223
1241
  while (1) {
1224
1242
  switch (_context12.prev = _context12.next) {
1225
1243
  case 0:
1226
1244
  parseBoxData = [];
1227
- Object.entries(boxData).forEach(function (_ref11, index) {
1228
- var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
1229
- box = _ref12[1];
1245
+ Object.entries(boxData).forEach(function (_ref12, index) {
1246
+ var _ref13 = (0, _slicedToArray2.default)(_ref12, 2),
1247
+ box = _ref13[1];
1230
1248
 
1231
1249
  var value = box.value;
1232
1250
  var attributesIds = Object.keys(value);
@@ -1278,9 +1296,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1278
1296
  console.log(_context12.t0);
1279
1297
 
1280
1298
  case 18:
1281
- console.log(dataObject);
1282
-
1283
- case 19:
1284
1299
  case "end":
1285
1300
  return _context12.stop();
1286
1301
  }
@@ -1289,12 +1304,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1289
1304
  }));
1290
1305
 
1291
1306
  return function saveDatasheets() {
1292
- return _ref10.apply(this, arguments);
1307
+ return _ref11.apply(this, arguments);
1293
1308
  };
1294
1309
  }();
1295
1310
 
1296
1311
  var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1297
- var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
1312
+ var _images$values3, _data$articleData, _data$articleData2, _data$updateImages;
1298
1313
 
1299
1314
  var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
1300
1315
 
@@ -1302,7 +1317,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1302
1317
  while (1) {
1303
1318
  switch (_context13.prev = _context13.next) {
1304
1319
  case 0:
1305
- imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
1320
+ imagesList = images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.slice();
1306
1321
  imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
1307
1322
  acc[image === null || image === void 0 ? void 0 : image.image_id] = ++acc[image === null || image === void 0 ? void 0 : image.image_id] || 0;
1308
1323
  return acc;
@@ -1484,7 +1499,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1484
1499
  };
1485
1500
 
1486
1501
  var createComment = /*#__PURE__*/function () {
1487
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
1502
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
1488
1503
  var messages,
1489
1504
  retailerId,
1490
1505
  data,
@@ -1519,7 +1534,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1519
1534
  }));
1520
1535
 
1521
1536
  return function createComment() {
1522
- return _ref15.apply(this, arguments);
1537
+ return _ref16.apply(this, arguments);
1523
1538
  };
1524
1539
  }();
1525
1540
 
@@ -1528,7 +1543,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1528
1543
  }, [activeTab]);
1529
1544
 
1530
1545
  var commentRevised = /*#__PURE__*/function () {
1531
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1546
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1532
1547
  var data;
1533
1548
  return _regenerator.default.wrap(function _callee16$(_context16) {
1534
1549
  while (1) {
@@ -1556,12 +1571,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1556
1571
  }));
1557
1572
 
1558
1573
  return function commentRevised() {
1559
- return _ref16.apply(this, arguments);
1574
+ return _ref17.apply(this, arguments);
1560
1575
  };
1561
1576
  }();
1562
1577
 
1563
1578
  var setAssignation = /*#__PURE__*/function () {
1564
- var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
1579
+ var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
1565
1580
  var concept, productTemp, data;
1566
1581
  return _regenerator.default.wrap(function _callee17$(_context17) {
1567
1582
  while (1) {
@@ -1618,18 +1633,18 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1618
1633
  }));
1619
1634
 
1620
1635
  return function setAssignation(_x4, _x5) {
1621
- return _ref17.apply(this, arguments);
1636
+ return _ref18.apply(this, arguments);
1622
1637
  };
1623
1638
  }();
1624
1639
 
1625
1640
  var downloadImages = function downloadImages() {
1626
- var _images$values3;
1641
+ var _images$values4;
1627
1642
 
1628
1643
  selectedImages.length > 0 ? selectedImages.forEach(function (e) {
1629
1644
  if (e.id) {
1630
1645
  (0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.upc || product.article.upc, "_").concat(e.name, ".").concat(e.ext));
1631
1646
  }
1632
- }) : images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.forEach(function (e) {
1647
+ }) : images === null || images === void 0 ? void 0 : (_images$values4 = images.values) === null || _images$values4 === void 0 ? void 0 : _images$values4.forEach(function (e) {
1633
1648
  if (e.id) {
1634
1649
  (0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.upc || product.article.upc, "_").concat(e.name, ".").concat(e.ext));
1635
1650
  }
@@ -1702,7 +1717,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1702
1717
  };
1703
1718
 
1704
1719
  var sendEvaluation = /*#__PURE__*/function () {
1705
- var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(result) {
1720
+ var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(result) {
1706
1721
  var _productTemp$id_order2;
1707
1722
 
1708
1723
  var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, showSurveyByProvider, showSurveyByRetailer, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status;
@@ -1807,12 +1822,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1807
1822
  }));
1808
1823
 
1809
1824
  return function sendEvaluation(_x6) {
1810
- return _ref18.apply(this, arguments);
1825
+ return _ref19.apply(this, arguments);
1811
1826
  };
1812
1827
  }();
1813
1828
 
1814
1829
  var validateAll = /*#__PURE__*/function () {
1815
- var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
1830
+ var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
1816
1831
  var _product$id_order2, evaluationArray, conceptArray, dataGeneral, userType, productTemp, status, retailerStatusCopy;
1817
1832
 
1818
1833
  return _regenerator.default.wrap(function _callee19$(_context19) {
@@ -1898,12 +1913,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1898
1913
  }));
1899
1914
 
1900
1915
  return function validateAll(_x7) {
1901
- return _ref19.apply(this, arguments);
1916
+ return _ref20.apply(this, arguments);
1902
1917
  };
1903
1918
  }();
1904
1919
 
1905
1920
  var evaluationToRetailer = /*#__PURE__*/function () {
1906
- var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
1921
+ var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
1907
1922
  var data, prod, statusComplete;
1908
1923
  return _regenerator.default.wrap(function _callee20$(_context20) {
1909
1924
  while (1) {
@@ -1945,7 +1960,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1945
1960
  }));
1946
1961
 
1947
1962
  return function evaluationToRetailer(_x8) {
1948
- return _ref20.apply(this, arguments);
1963
+ return _ref21.apply(this, arguments);
1949
1964
  };
1950
1965
  }();
1951
1966
 
@@ -1989,10 +2004,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1989
2004
  }];
1990
2005
 
1991
2006
  var sendToEvaluation = function sendToEvaluation(result) {
1992
- console.log({
1993
- result: result
1994
- });
1995
-
1996
2007
  if (result === "A") {
1997
2008
  if (origin[activeTab] === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
1998
2009
  setDataGenericModal(function (prev) {
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.71",
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,15 @@ 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
+ ...product,
498
+ retailersAvailable: product.retailersAvailable.map(({ id }) => id),
499
+ },
500
+ ];
501
+ getPercentage({ data }).then((res) => {
502
+ setPercentages(res[0]);
503
+ });
489
504
  setLoading(false);
490
505
  };
491
506
 
@@ -545,12 +560,14 @@ export const ProviderProductEdition = ({
545
560
  };
546
561
 
547
562
  const getCart = async () => {
548
- const res = await axios.get(process.env.REACT_APP_CART, {
563
+ const res = await axios.get(`${process.env.REACT_APP_CART}/general/`, {
549
564
  headers: {
550
565
  Authorization: token,
551
566
  },
552
567
  });
553
- const arr = JSON.parse(res.data.body).data.map((e) => e.article_id);
568
+ const arr = Object.values(JSON.parse(res.data.body).data)
569
+ ?.map((e) => e.article_id)
570
+ .filter(Boolean);
554
571
  setInCart(arr.some((e) => e.articleId === product.id_article));
555
572
  };
556
573
 
@@ -648,7 +665,7 @@ export const ProviderProductEdition = ({
648
665
  value: e?.id,
649
666
  name: e?.name,
650
667
  required: e?.required,
651
- active: images?.values.some((value) => value?.image_id === e?.id),
668
+ active: images?.values?.some((value) => value?.image_id === e?.id),
652
669
  }));
653
670
  setSocketType(imageInputs);
654
671
  }, [images]);
@@ -692,7 +709,7 @@ export const ProviderProductEdition = ({
692
709
  attributeId,
693
710
  value: valueOfAtribute,
694
711
  boxId,
695
- })
712
+ });
696
713
  });
697
714
  });
698
715
 
@@ -700,8 +717,8 @@ export const ProviderProductEdition = ({
700
717
  articleId: product?.id_article,
701
718
  articleData: updatedDatasheets,
702
719
  ...(parseBoxData.length > 0 && { boxData: parseBoxData }),
703
- };
704
-
720
+ };
721
+
705
722
  if (product?.orderId) dataObject["orderId"] = product?.orderId;
706
723
  try {
707
724
  const res = await axios.put(
@@ -720,8 +737,7 @@ export const ProviderProductEdition = ({
720
737
  }
721
738
  } catch (error) {
722
739
  console.log(error);
723
- }
724
- console.log(dataObject)
740
+ }
725
741
  };
726
742
 
727
743
  const updateImages = useCallback(async () => {
@@ -1154,13 +1170,6 @@ export const ProviderProductEdition = ({
1154
1170
  }
1155
1171
  };
1156
1172
 
1157
-
1158
-
1159
-
1160
-
1161
-
1162
-
1163
-
1164
1173
  const evaluationToRetailer = async (result) => {
1165
1174
  const data = {
1166
1175
  articleId: product.id_article,
@@ -1240,7 +1249,6 @@ export const ProviderProductEdition = ({
1240
1249
  },
1241
1250
  ];
1242
1251
  const sendToEvaluation = (result) => {
1243
- console.log({ result });
1244
1252
  if (result === "A") {
1245
1253
  if (
1246
1254
  origin[activeTab] === "RequestWithoutContentoh" &&
@@ -122,9 +122,7 @@ export const getPercentage = async (params = {}) => {
122
122
  },
123
123
  }
124
124
  )
125
- .then((response) => {
126
- return [response.data];
127
- })
125
+ .then((response) => [response.data])
128
126
  .catch((err) => console.log(err, "Errror"));
129
127
  };
130
128