contentoh-components-library 21.5.78 → 21.5.81

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.
Files changed (34) hide show
  1. package/dist/ai/utils/compare-strings.js +43 -0
  2. package/dist/components/atoms/GeneralInput/index.js +64 -36
  3. package/dist/components/atoms/GeneralInput/styles.js +1 -1
  4. package/dist/components/atoms/InputFormatter/index.js +45 -21
  5. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  6. package/dist/components/molecules/StatusAsignationInfo/index.js +11 -1
  7. package/dist/components/molecules/TagAndInput/index.js +110 -29
  8. package/dist/components/molecules/TagAndInput/styles.js +2 -2
  9. package/dist/components/organisms/InputGroup/index.js +22 -18
  10. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +92 -785
  11. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +59 -260
  12. package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +3 -41
  13. package/dist/components/pages/RetailerProductEdition/index.js +191 -123
  14. package/dist/contexts/AiProductEdition.js +179 -155
  15. package/package.json +1 -1
  16. package/src/ai/utils/compare-strings.js +43 -0
  17. package/src/components/atoms/GeneralInput/index.js +63 -42
  18. package/src/components/atoms/GeneralInput/styles.js +7 -0
  19. package/src/components/atoms/InputFormatter/index.js +51 -23
  20. package/src/components/atoms/InputFormatter/styles.js +62 -10
  21. package/src/components/molecules/StatusAsignationInfo/index.js +9 -1
  22. package/src/components/molecules/TagAndInput/index.js +113 -28
  23. package/src/components/molecules/TagAndInput/styles.js +48 -17
  24. package/src/components/organisms/FullTabsMenu/index.js +1 -1
  25. package/src/components/organisms/InputGroup/index.js +4 -0
  26. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +111 -832
  27. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +3 -221
  28. package/src/components/pages/RetailerProductEdition/context/reducers/product.js +3 -43
  29. package/src/components/pages/RetailerProductEdition/index.js +17 -15
  30. package/src/contexts/AiProductEdition.jsx +138 -96
  31. package/src/ai/prompts/attribute.prompt.js +0 -46
  32. package/src/ai/prompts/description.prompt.js +0 -52
  33. package/src/ai/schemas/attribute.schema.js +0 -23
  34. package/src/ai/schemas/description.schema.js +0 -19
@@ -35,8 +35,6 @@ var _errorModal = _interopRequireDefault(require("../../../../assets/images/gene
35
35
 
36
36
  var _utils = require("../utils");
37
37
 
38
- var _data = require("../../../../global-files/data");
39
-
40
38
  var _jsxRuntime = require("react/jsx-runtime");
41
39
 
42
40
  var _excluded = ["src"],
@@ -70,7 +68,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
70
68
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(token) {
71
69
  var _state$product, _state$product2;
72
70
 
73
- var dataObject, _state$product3, res, inputs, filledRequiredCount, body, newStatus, _state$product4, productFromLocalStorage, updatedProduct;
71
+ var dataObject, _state$product3, res, inputs, filledRequiredCount;
74
72
 
75
73
  return _regenerator.default.wrap(function _callee$(_context) {
76
74
  while (1) {
@@ -91,7 +89,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
91
89
  dataObject = {
92
90
  articleId: (_state$product = state.product) === null || _state$product === void 0 ? void 0 : _state$product.id_article,
93
91
  articleData: state.updated_descriptions_inputs
94
- };
92
+ }; // console.log({dataObject});
95
93
 
96
94
  if ((_state$product2 = state.product) !== null && _state$product2 !== void 0 && _state$product2.id_order) {
97
95
  dataObject.orderId = (_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.id_order;
@@ -134,36 +132,6 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
134
132
  filledRequiredCount += 1;
135
133
  }
136
134
  });
137
- body = JSON.parse(res.data.body);
138
- newStatus = body === null || body === void 0 ? void 0 : body.newStatus;
139
-
140
- if (newStatus) {
141
- productFromLocalStorage = JSON.parse(sessionStorage.getItem("productSelected"));
142
- updatedProduct = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, productFromLocalStorage || state.product), {}, {
143
- description_status: newStatus,
144
- statusByRetailer: ((productFromLocalStorage === null || productFromLocalStorage === void 0 ? void 0 : productFromLocalStorage.statusByRetailer) || ((_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.statusByRetailer) || []).map(function (retailerStatus) {
145
- return retailerStatus.service === "description" ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, retailerStatus), {}, {
146
- status: newStatus
147
- }) : retailerStatus;
148
- })
149
- });
150
- sessionStorage.setItem("productSelected", JSON.stringify(updatedProduct));
151
- dispatch({
152
- type: "UPDATE_DESCRIPTION_STATUS",
153
- payload: newStatus
154
- });
155
- dispatch({
156
- type: "SET_SERVICES_DATA",
157
- payload: (state.services_data || []).map(function (srv) {
158
- var _state$active_retaile;
159
-
160
- return srv.service === "description" && srv.id_retailer === ((_state$active_retaile = state.active_retailer) === null || _state$active_retaile === void 0 ? void 0 : _state$active_retaile.id_retailer) ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, srv), {}, {
161
- status: newStatus
162
- }) : srv;
163
- })
164
- });
165
- }
166
-
167
135
  dispatch({
168
136
  type: "SET_MISSING_REQUIRED_FIELDS",
169
137
  payload: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.missing_required_fields), {}, {
@@ -223,9 +191,9 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
223
191
 
224
192
  var saveDatasheets = /*#__PURE__*/function () {
225
193
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(token) {
226
- var _state$product5, _state$product6;
194
+ var _state$product4, _state$product5;
227
195
 
228
- var dataObject, _state$product7, res, _state$active_retaile2, datasheetInputs, retailerId, filledRequiredCount, body, newStatus, _state$product8, productFromLocalStorage, updatedProduct;
196
+ var dataObject, _state$product6, res, _state$active_retaile, datasheetInputs, retailerId, filledRequiredCount;
229
197
 
230
198
  return _regenerator.default.wrap(function _callee2$(_context2) {
231
199
  while (1) {
@@ -244,12 +212,12 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
244
212
  payload: true
245
213
  });
246
214
  dataObject = {
247
- articleId: (_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.id_article,
215
+ articleId: (_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.id_article,
248
216
  articleData: state.updated_datasheets_inputs
249
217
  };
250
218
 
251
- if ((_state$product6 = state.product) !== null && _state$product6 !== void 0 && _state$product6.id_order) {
252
- dataObject.orderId = (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.id_order;
219
+ if ((_state$product5 = state.product) !== null && _state$product5 !== void 0 && _state$product5.id_order) {
220
+ dataObject.orderId = (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.id_order;
253
221
  }
254
222
 
255
223
  _context2.prev = 5;
@@ -279,7 +247,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
279
247
  }); // Contar cuántos campos requeridos que antes estaban vacíos ahora tienen valor
280
248
 
281
249
  datasheetInputs = state.datasheets_inputs[1];
282
- retailerId = (_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id_retailer;
250
+ retailerId = (_state$active_retaile = state.active_retailer) === null || _state$active_retaile === void 0 ? void 0 : _state$active_retaile.id_retailer;
283
251
  filledRequiredCount = 0;
284
252
  state.updated_datasheets_inputs.forEach(function (updatedInput) {
285
253
  var key = "".concat(updatedInput.attributeId, "_").concat(retailerId);
@@ -289,36 +257,6 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
289
257
  filledRequiredCount += 1;
290
258
  }
291
259
  });
292
- body = JSON.parse(res.data.body);
293
- newStatus = body === null || body === void 0 ? void 0 : body.newStatus;
294
-
295
- if (newStatus) {
296
- productFromLocalStorage = JSON.parse(sessionStorage.getItem("productSelected"));
297
- updatedProduct = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, productFromLocalStorage || state.product), {}, {
298
- datasheet_status: newStatus,
299
- statusByRetailer: ((productFromLocalStorage === null || productFromLocalStorage === void 0 ? void 0 : productFromLocalStorage.statusByRetailer) || ((_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.statusByRetailer) || []).map(function (retailerStatus) {
300
- return retailerStatus.service === "datasheet" ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, retailerStatus), {}, {
301
- status: newStatus
302
- }) : retailerStatus;
303
- })
304
- });
305
- sessionStorage.setItem("productSelected", JSON.stringify(updatedProduct));
306
- dispatch({
307
- type: "UPDATE_DATASHEET_STATUS",
308
- payload: newStatus
309
- });
310
- dispatch({
311
- type: "SET_SERVICES_DATA",
312
- payload: (state.services_data || []).map(function (srv) {
313
- var _state$active_retaile3;
314
-
315
- return srv.service === "datasheet" && srv.id_retailer === ((_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer) ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, srv), {}, {
316
- status: newStatus
317
- }) : srv;
318
- })
319
- });
320
- }
321
-
322
260
  dispatch({
323
261
  type: "SET_MISSING_REQUIRED_FIELDS",
324
262
  payload: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.missing_required_fields), {}, {
@@ -372,10 +310,9 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
372
310
 
373
311
  var updateImages = /*#__PURE__*/function () {
374
312
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(token) {
375
- var _state$images_values, _state$product9, _state$product10, _state$product11, _data$articleData, _data$updateImages;
376
-
377
- var updatedImages, attrForImgs, generalAttrs, retailerKey, retailerAttrs, mergedAttrs, data, valid, promiseArray, res, imageBody, newStatus, _state$product12, productFromLocalStorage, updatedProduct, _freshImages$values, _state$product13, id_article, version, _state$active_retaile5, category, id_category, id_retailer, imagesRes, freshImages, orderMap, orderedValues, filteredValues;
313
+ var _state$images_values, _state$product7, _state$product8, _state$product9, _data$articleData, _data$updateImages;
378
314
 
315
+ var updatedImages, attrForImgs, generalAttrs, retailerKey, retailerAttrs, mergedAttrs, data, valid, promiseArray, res;
379
316
  return _regenerator.default.wrap(function _callee3$(_context3) {
380
317
  while (1) {
381
318
  switch (_context3.prev = _context3.next) {
@@ -409,7 +346,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
409
346
  return retailerAttr;
410
347
  });
411
348
  data = {
412
- articleId: (_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.id_article,
349
+ articleId: (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.id_article,
413
350
  attrReqImgs: mergedAttrs.map(function (e) {
414
351
  var _e$value;
415
352
 
@@ -425,18 +362,15 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
425
362
  return e.id;
426
363
  })
427
364
  };
428
- if ((_state$product10 = state.product) !== null && _state$product10 !== void 0 && _state$product10.orderId) data["orderId"] = (_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.orderId;
365
+ if ((_state$product8 = state.product) !== null && _state$product8 !== void 0 && _state$product8.orderId) data["orderId"] = (_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.orderId;
429
366
  valid = (data === null || data === void 0 ? void 0 : (_data$articleData = data.articleData) === null || _data$articleData === void 0 ? void 0 : _data$articleData.every(function (e) {
430
367
  return e === null || e === void 0 ? void 0 : e.image_id;
431
368
  })) && (data === null || data === void 0 ? void 0 : (_data$updateImages = data.updateImages) === null || _data$updateImages === void 0 ? void 0 : _data$updateImages.every(function (e) {
432
369
  return e === null || e === void 0 ? void 0 : e.image_id;
433
- }));
434
- console.log({
435
- data: data
436
- });
370
+ })); // console.log({ data });
437
371
 
438
372
  if (!valid) {
439
- _context3.next = 61;
373
+ _context3.next = 37;
440
374
  break;
441
375
  }
442
376
 
@@ -455,7 +389,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
455
389
  isApproved: true
456
390
  });
457
391
  });
458
- _context3.prev = 16;
392
+ _context3.prev = 15;
459
393
  promiseArray = data.articleData.map(function (e) {
460
394
  var file = Buffer.from(e.src.replace(/^data:image\/\w+;base64,/, ""), "base64");
461
395
  var params = {
@@ -466,10 +400,10 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
466
400
  };
467
401
  return myBucket.putObject(params).promise();
468
402
  });
469
- _context3.next = 20;
403
+ _context3.next = 19;
470
404
  return Promise.all(promiseArray);
471
405
 
472
- case 20:
406
+ case 19:
473
407
  // Eliminar el buffer base64 antes de enviar al endpoint para evitar error 413
474
408
  data.articleData = data.articleData.map(function (_ref5) {
475
409
  var src = _ref5.src,
@@ -481,7 +415,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
481
415
  rest = (0, _objectWithoutProperties2.default)(_ref6, _excluded2);
482
416
  return rest;
483
417
  });
484
- _context3.next = 24;
418
+ _context3.next = 23;
485
419
  return _axios.default.put(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, data, {
486
420
  params: {
487
421
  image: true,
@@ -492,137 +426,37 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
492
426
  }
493
427
  });
494
428
 
495
- case 24:
429
+ case 23:
496
430
  res = _context3.sent;
497
431
 
498
- if (!(res.data.statusCode === 200)) {
499
- _context3.next = 49;
500
- break;
501
- }
502
-
503
- // Limpiar las imágenes actualizadas
504
- dispatch({
505
- type: "SET_UPDATED_IMAGES_VALUES",
506
- payload: []
507
- });
508
- imageBody = JSON.parse(res.data.body);
509
- newStatus = imageBody === null || imageBody === void 0 ? void 0 : imageBody.newStatus;
510
-
511
- if (newStatus) {
512
- productFromLocalStorage = JSON.parse(sessionStorage.getItem("productSelected"));
513
- updatedProduct = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, productFromLocalStorage || state.product), {}, {
514
- images_status: newStatus,
515
- statusByRetailer: ((productFromLocalStorage === null || productFromLocalStorage === void 0 ? void 0 : productFromLocalStorage.statusByRetailer) || ((_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.statusByRetailer) || []).map(function (retailerStatus) {
516
- return retailerStatus.service === "images" ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, retailerStatus), {}, {
517
- status: newStatus
518
- }) : retailerStatus;
519
- })
520
- });
521
- sessionStorage.setItem("productSelected", JSON.stringify(updatedProduct));
522
- dispatch({
523
- type: "UPDATE_IMAGES_STATUS",
524
- payload: newStatus
525
- });
432
+ if (res.data.statusCode === 200) {
433
+ // Limpiar las imágenes actualizadas
526
434
  dispatch({
527
- type: "SET_SERVICES_DATA",
528
- payload: (state.services_data || []).map(function (srv) {
529
- var _state$active_retaile4;
530
-
531
- return srv.service === "images" && srv.id_retailer === ((_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.id_retailer) ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, srv), {}, {
532
- status: newStatus
533
- }) : srv;
534
- })
535
- });
536
- } // Refrescar images_values con datos reales del backend
537
-
538
-
539
- _context3.prev = 30;
540
- _state$product13 = state.product, id_article = _state$product13.id_article, version = _state$product13.version;
541
- _state$active_retaile5 = state.active_retailer, category = _state$active_retaile5.category, id_category = _state$active_retaile5.id_category, id_retailer = _state$active_retaile5.id_retailer;
542
- _context3.next = 35;
543
- return _axios.default.post("".concat(process.env.REACT_APP_ARTICLE_DATA_IMAGES_ENDPOINT, "?articleId=").concat(id_article, "&version=").concat(version), {
544
- category: category,
545
- retailersList: [id_retailer]
546
- }, {
547
- headers: {
548
- Authorization: token
549
- }
550
- });
435
+ type: "SET_UPDATED_IMAGES_VALUES",
436
+ payload: []
437
+ }); // Mostrar modal de éxito
551
438
 
552
- case 35:
553
- imagesRes = _context3.sent;
554
- freshImages = JSON.parse(imagesRes.data.body).data;
555
- freshImages.values = freshImages === null || freshImages === void 0 ? void 0 : (_freshImages$values = freshImages.values) === null || _freshImages$values === void 0 ? void 0 : _freshImages$values.map(function (value) {
556
- var _freshImages$inputs$f;
557
-
558
- value.name = (_freshImages$inputs$f = freshImages.inputs.find(function (e) {
559
- return e.id === value.image_id;
560
- })) === null || _freshImages$inputs$f === void 0 ? void 0 : _freshImages$inputs$f.name;
561
- return (0, _data.getImage)(value);
562
- });
563
- orderMap = freshImages.inputsByRetailer.flat().reduce(function (acc, item) {
564
- acc[item.id_image] = item.order;
565
- return acc;
566
- }, {});
567
- orderedValues = (0, _toConsumableArray2.default)(freshImages.values).sort(function (a, b) {
568
- var _orderMap$a$image_id, _orderMap$b$image_id;
569
-
570
- var orderA = (_orderMap$a$image_id = orderMap[a.image_id]) !== null && _orderMap$a$image_id !== void 0 ? _orderMap$a$image_id : Number.MAX_SAFE_INTEGER;
571
- var orderB = (_orderMap$b$image_id = orderMap[b.image_id]) !== null && _orderMap$b$image_id !== void 0 ? _orderMap$b$image_id : Number.MAX_SAFE_INTEGER;
572
- return orderA - orderB;
573
- });
574
- filteredValues = freshImages.values.filter(function (value) {
575
- return freshImages.inputsByRetailer.some(function (retailerInput) {
576
- return retailerInput.some(function (input) {
577
- return input.id_retailer === id_retailer && input.id_image === value.image_id;
578
- });
439
+ dispatch({
440
+ type: "SET_MODAL",
441
+ payload: {
442
+ show: true,
443
+ title: "",
444
+ message: "Imágenes guardadas con éxito",
445
+ image: _genericModalCheck.default
446
+ }
579
447
  });
580
- });
581
- dispatch({
582
- type: "SET_IMAGES_VALUES",
583
- payload: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, freshImages), {}, {
584
- values: filteredValues
585
- })
586
- });
587
- dispatch({
588
- type: "SET_SERVICES",
589
- payload: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.services), {}, {
590
- images: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, freshImages), {}, {
591
- values: orderedValues
592
- })
593
- })
594
- });
595
- _context3.next = 48;
596
- break;
597
-
598
- case 45:
599
- _context3.prev = 45;
600
- _context3.t0 = _context3["catch"](30);
601
- console.log("Error al refrescar images_values:", _context3.t0);
602
-
603
- case 48:
604
- // Mostrar modal de éxito
605
- dispatch({
606
- type: "SET_MODAL",
607
- payload: {
608
- show: true,
609
- title: "",
610
- message: "Imágenes guardadas con éxito",
611
- image: _genericModalCheck.default
612
- }
613
- });
448
+ }
614
449
 
615
- case 49:
616
- _context3.next = 56;
450
+ _context3.next = 32;
617
451
  break;
618
452
 
619
- case 51:
620
- _context3.prev = 51;
621
- _context3.t1 = _context3["catch"](16);
622
- console.log(_context3.t1);
453
+ case 27:
454
+ _context3.prev = 27;
455
+ _context3.t0 = _context3["catch"](15);
456
+ console.log(_context3.t0);
623
457
  dispatch({
624
458
  type: "SET_ERRORS",
625
- payload: [].concat((0, _toConsumableArray2.default)(state.errors), [_context3.t1])
459
+ payload: [].concat((0, _toConsumableArray2.default)(state.errors), [_context3.t0])
626
460
  });
627
461
  dispatch({
628
462
  type: "SET_MODAL",
@@ -634,19 +468,19 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
634
468
  }
635
469
  });
636
470
 
637
- case 56:
638
- _context3.prev = 56;
471
+ case 32:
472
+ _context3.prev = 32;
639
473
  dispatch({
640
474
  type: "SET_SAVING",
641
475
  payload: false
642
476
  });
643
- return _context3.finish(56);
477
+ return _context3.finish(32);
644
478
 
645
- case 59:
646
- _context3.next = 62;
479
+ case 35:
480
+ _context3.next = 38;
647
481
  break;
648
482
 
649
- case 61:
483
+ case 37:
650
484
  dispatch({
651
485
  type: "SET_MODAL",
652
486
  payload: {
@@ -657,12 +491,12 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
657
491
  }
658
492
  });
659
493
 
660
- case 62:
494
+ case 38:
661
495
  case "end":
662
496
  return _context3.stop();
663
497
  }
664
498
  }
665
- }, _callee3, null, [[16, 51, 56, 59], [30, 45]]);
499
+ }, _callee3, null, [[15, 27, 32, 35]]);
666
500
  }));
667
501
 
668
502
  return function updateImages(_x3) {
@@ -672,9 +506,9 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
672
506
 
673
507
  var saveImageAttrs = /*#__PURE__*/function () {
674
508
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(token) {
675
- var _state$images_values$, _state$images_values2, _state$images_values3, _state$product14, _state$product15, _state$product16;
509
+ var _state$images_values$, _state$images_values2, _state$images_values3, _state$product10, _state$product11, _state$product12;
676
510
 
677
- var activeImage, attrForImgs, data, _state$product17, _state$product18, res, attrBody, newStatus, _state$product19, productFromLocalStorage, updatedProduct;
511
+ var activeImage, attrForImgs, data, _state$product13, _state$product14, res;
678
512
 
679
513
  return _regenerator.default.wrap(function _callee4$(_context4) {
680
514
  while (1) {
@@ -695,7 +529,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
695
529
  activeImage = state.images_values.values[state.current_image];
696
530
  attrForImgs = (_state$images_values$ = (_state$images_values2 = state.images_values) === null || _state$images_values2 === void 0 ? void 0 : (_state$images_values3 = _state$images_values2.attrForImgs) === null || _state$images_values3 === void 0 ? void 0 : _state$images_values3.general) !== null && _state$images_values$ !== void 0 ? _state$images_values$ : [];
697
531
  data = {
698
- articleId: (_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.id_article,
532
+ articleId: (_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.id_article,
699
533
  attrReqImgs: attrForImgs.map(function (e) {
700
534
  var _e$value2;
701
535
 
@@ -708,8 +542,8 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
708
542
  updateImages: activeImage ? [activeImage] : []
709
543
  };
710
544
 
711
- if ((_state$product15 = state.product) !== null && _state$product15 !== void 0 && _state$product15.orderId || (_state$product16 = state.product) !== null && _state$product16 !== void 0 && _state$product16.id_order) {
712
- data.orderId = ((_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.orderId) || ((_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.id_order);
545
+ if ((_state$product11 = state.product) !== null && _state$product11 !== void 0 && _state$product11.orderId || (_state$product12 = state.product) !== null && _state$product12 !== void 0 && _state$product12.id_order) {
546
+ data.orderId = ((_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.orderId) || ((_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.id_order);
713
547
  }
714
548
 
715
549
  _context4.prev = 7;
@@ -732,36 +566,6 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
732
566
  type: "SET_UPDATED_ATTR_FOR_IMGS",
733
567
  payload: []
734
568
  });
735
- attrBody = JSON.parse(res.data.body);
736
- newStatus = attrBody === null || attrBody === void 0 ? void 0 : attrBody.newStatus;
737
-
738
- if (newStatus) {
739
- productFromLocalStorage = JSON.parse(sessionStorage.getItem("productSelected"));
740
- updatedProduct = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, productFromLocalStorage || state.product), {}, {
741
- images_status: newStatus,
742
- statusByRetailer: ((productFromLocalStorage === null || productFromLocalStorage === void 0 ? void 0 : productFromLocalStorage.statusByRetailer) || ((_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.statusByRetailer) || []).map(function (retailerStatus) {
743
- return retailerStatus.service === "images" ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, retailerStatus), {}, {
744
- status: newStatus
745
- }) : retailerStatus;
746
- })
747
- });
748
- sessionStorage.setItem("productSelected", JSON.stringify(updatedProduct));
749
- dispatch({
750
- type: "UPDATE_IMAGES_STATUS",
751
- payload: newStatus
752
- });
753
- dispatch({
754
- type: "SET_SERVICES_DATA",
755
- payload: (state.services_data || []).map(function (srv) {
756
- var _state$active_retaile6;
757
-
758
- return srv.service === "images" && srv.id_retailer === ((_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer) ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, srv), {}, {
759
- status: newStatus
760
- }) : srv;
761
- })
762
- });
763
- }
764
-
765
569
  dispatch({
766
570
  type: "SET_MODAL",
767
571
  payload: {
@@ -816,9 +620,9 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
816
620
  }();
817
621
 
818
622
  var handleOnDownloadImages = function handleOnDownloadImages() {
819
- var _state$product20, _state$product21, _state$product21$arti, _state$images_values4, _state$images_values5;
623
+ var _state$product15, _state$product16, _state$product16$arti, _state$images_values4, _state$images_values5;
820
624
 
821
- var upc = ((_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.upc) || ((_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : (_state$product21$arti = _state$product21.article) === null || _state$product21$arti === void 0 ? void 0 : _state$product21$arti.upc);
625
+ var upc = ((_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.upc) || ((_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : (_state$product16$arti = _state$product16.article) === null || _state$product16$arti === void 0 ? void 0 : _state$product16$arti.upc);
822
626
  state.selected_images.length > 0 ? state.selected_images.forEach(function (e) {
823
627
  if (e.id) {
824
628
  saveAs("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(upc, "_").concat(e.name, ".").concat(e.ext));
@@ -832,7 +636,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
832
636
 
833
637
  var deleteImages = /*#__PURE__*/function () {
834
638
  var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(token) {
835
- var imgsInBack, _state$product22, data;
639
+ var imgsInBack, _state$product17, data;
836
640
 
837
641
  return _regenerator.default.wrap(function _callee5$(_context5) {
838
642
  while (1) {
@@ -853,7 +657,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
853
657
  }
854
658
 
855
659
  data = {
856
- articleId: (_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.id_article,
660
+ articleId: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.id_article,
857
661
  deleteImages: imgsInBack
858
662
  };
859
663
  _context5.prev = 4;
@@ -933,7 +737,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
933
737
 
934
738
  var createComment = /*#__PURE__*/function () {
935
739
  var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(body, token) {
936
- var _state$product23, _state$product24, _state$product25;
740
+ var _state$product18, _state$product19, _state$product20;
937
741
 
938
742
  var concept, data;
939
743
  return _regenerator.default.wrap(function _callee6$(_context6) {
@@ -942,8 +746,8 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
942
746
  case 0:
943
747
  concept = (0, _utils.getConceptByTab)(state.active_tab);
944
748
  data = {
945
- articleId: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.id_article,
946
- orderId: ((_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.orderId) || ((_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.id_order),
749
+ articleId: (_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.id_article,
750
+ orderId: ((_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.orderId) || ((_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.id_order),
947
751
  message: body,
948
752
  concept: concept,
949
753
  version: state.product.version
@@ -1007,10 +811,5 @@ var useProviderProductEdition = function useProviderProductEdition() {
1007
811
 
1008
812
  return context;
1009
813
  };
1010
- /*
1011
- src: "https://d24s337exbt5zr.cloudfront.net/eyJidWNrZXQiOiJjb250ZW50LW1hbmFnZW1lbnQtaW1hZ2VzLXByb2QiLCJrZXkiOiJpZC0xNDQ3MTEvMy8xLTRjZGVjNTZkLTVjYWMtNGY3NC04ZWM0LWZmMmRmOTFjZDdiOS5qcGciLCJlZGl0cyI6eyJyZXNpemUiOnsid2lkdGgiOjEwMDAsImhlaWdodCI6MTAwMCwiZml0IjoiY29udGFpbiIsImJhY2tncm91bmQiOnsiciI6MjU1LCJnIjoyNTUsImIiOjI1NSwiYWxwaGEiOjF9fX19"
1012
- srcDB: "id-144711/3/1-4cdec56d-5cac-4f74-8ec4-ff2df91cd7b9.jpg"
1013
- */
1014
-
1015
814
 
1016
815
  exports.useProviderProductEdition = useProviderProductEdition;
@@ -20,9 +20,7 @@ var PRODUCT_ACTIONS = {
20
20
  SET_SERVICES: "SET_SERVICES",
21
21
  SET_SERVICES_DATA: "SET_SERVICES_DATA",
22
22
  SET_PRODUCT_VERSION: "SET_PRODUCT_VERSION",
23
- UPDATE_DESCRIPTION_STATUS: "UPDATE_DESCRIPTION_STATUS",
24
- UPDATE_DATASHEET_STATUS: "UPDATE_DATASHEET_STATUS",
25
- UPDATE_IMAGES_STATUS: "UPDATE_IMAGES_STATUS"
23
+ SET_PERCENTAGES: "SET_PERCENTAGES"
26
24
  };
27
25
  exports.PRODUCT_ACTIONS = PRODUCT_ACTIONS;
28
26
 
@@ -58,47 +56,11 @@ var productReducer = function productReducer(state, action) {
58
56
  });
59
57
  }
60
58
 
61
- case PRODUCT_ACTIONS.UPDATE_DESCRIPTION_STATUS:
59
+ case PRODUCT_ACTIONS.SET_PERCENTAGES:
62
60
  {
63
- var _state$product;
64
-
65
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
66
- product: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.product), {}, {
67
- statusByRetailer: (((_state$product = state.product) === null || _state$product === void 0 ? void 0 : _state$product.statusByRetailer) || []).map(function (retailerStatus) {
68
- return retailerStatus.service === "description" ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, retailerStatus), {}, {
69
- status: action.payload
70
- }) : retailerStatus;
71
- })
72
- })
73
- });
74
- }
75
-
76
- case PRODUCT_ACTIONS.UPDATE_DATASHEET_STATUS:
77
- {
78
- var _state$product2;
79
-
80
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
81
- product: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.product), {}, {
82
- statusByRetailer: (((_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.statusByRetailer) || []).map(function (retailerStatus) {
83
- return retailerStatus.service === "datasheet" ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, retailerStatus), {}, {
84
- status: action.payload
85
- }) : retailerStatus;
86
- })
87
- })
88
- });
89
- }
90
-
91
- case PRODUCT_ACTIONS.UPDATE_IMAGES_STATUS:
92
- {
93
- var _state$product3;
94
-
95
61
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
96
62
  product: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.product), {}, {
97
- statusByRetailer: (((_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.statusByRetailer) || []).map(function (retailerStatus) {
98
- return retailerStatus.service === "images" ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, retailerStatus), {}, {
99
- status: action.payload
100
- }) : retailerStatus;
101
- })
63
+ percentages: action.payload
102
64
  })
103
65
  });
104
66
  }