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
@@ -456,14 +456,44 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
456
456
 
457
457
  var loadData = /*#__PURE__*/function () {
458
458
  var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
459
- var _JSON$parse$0$relatio, _JSON$parse, _JSON$parse$, _percentagesRes$, _state$product4, id_article, version, id_order, _state$active_retaile, category, id_category, id_retailer, data, headers, _yield$Promise$all, _yield$Promise$all2, services, percentagesRes, servicesDataRes, commentsResponse, percentages, commentsMap, orderMap, orderedValues, retailerDatasheets, datasheetsActiveRetailer, descriptionsActiveRetailer, filteredValues;
459
+ var enableLoading,
460
+ _JSON$parse$0$relatio,
461
+ _JSON$parse,
462
+ _JSON$parse$,
463
+ _percentagesRes$,
464
+ _state$product4,
465
+ id_article,
466
+ version,
467
+ id_order,
468
+ _state$active_retaile,
469
+ category,
470
+ id_category,
471
+ id_retailer,
472
+ data,
473
+ headers,
474
+ _yield$Promise$all,
475
+ _yield$Promise$all2,
476
+ services,
477
+ percentagesRes,
478
+ servicesDataRes,
479
+ commentsResponse,
480
+ percentages,
481
+ commentsMap,
482
+ orderMap,
483
+ orderedValues,
484
+ retailerDatasheets,
485
+ datasheetsActiveRetailer,
486
+ descriptionsActiveRetailer,
487
+ filteredValues,
488
+ _args4 = arguments;
460
489
 
461
490
  return _regenerator.default.wrap(function _callee4$(_context4) {
462
491
  while (1) {
463
492
  switch (_context4.prev = _context4.next) {
464
493
  case 0:
465
- _context4.prev = 0;
466
- dispatch({
494
+ enableLoading = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : true;
495
+ _context4.prev = 1;
496
+ if (enableLoading) dispatch({
467
497
  type: "SET_LOADING",
468
498
  payload: true
469
499
  });
@@ -481,7 +511,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
481
511
  headers = {
482
512
  Authorization: token
483
513
  };
484
- _context4.next = 8;
514
+ _context4.next = 9;
485
515
  return Promise.all([(0, _data.getRetailerServices)(id_article, category, id_category, version, token, id_retailer), (0, _data.getPercentage)({
486
516
  data: data,
487
517
  headers: headers
@@ -514,7 +544,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
514
544
  }
515
545
  })])]);
516
546
 
517
- case 8:
547
+ case 9:
518
548
  _yield$Promise$all = _context4.sent;
519
549
  _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 4);
520
550
  services = _yield$Promise$all2[0];
@@ -617,32 +647,32 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
617
647
  loadAuditableData();
618
648
  }
619
649
 
620
- _context4.next = 39;
650
+ _context4.next = 40;
621
651
  break;
622
652
 
623
- case 35:
624
- _context4.prev = 35;
625
- _context4.t0 = _context4["catch"](0);
653
+ case 36:
654
+ _context4.prev = 36;
655
+ _context4.t0 = _context4["catch"](1);
626
656
  console.log("Error loading data: ", _context4.t0);
627
657
  dispatch({
628
658
  type: "SET_ERRORS",
629
659
  payload: [_context4.t0.message]
630
660
  });
631
661
 
632
- case 39:
633
- _context4.prev = 39;
662
+ case 40:
663
+ _context4.prev = 40;
634
664
  dispatch({
635
665
  type: "SET_LOADING",
636
666
  payload: false
637
667
  });
638
- return _context4.finish(39);
668
+ return _context4.finish(40);
639
669
 
640
- case 42:
670
+ case 43:
641
671
  case "end":
642
672
  return _context4.stop();
643
673
  }
644
674
  }
645
- }, _callee4, null, [[0, 35, 39, 42]]);
675
+ }, _callee4, null, [[1, 36, 40, 43]]);
646
676
  }));
647
677
 
648
678
  return function loadData() {
@@ -654,7 +684,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
654
684
  if (state.active_retailer) {
655
685
  loadData();
656
686
  }
657
- }, [state.active_retailer, state.product]);
687
+ }, [state.active_retailer]);
658
688
 
659
689
  var handleOnChangeCurrentImage = function handleOnChangeCurrentImage(index) {
660
690
  if (typeof index === "number") {
@@ -781,26 +811,64 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
781
811
  }
782
812
  };
783
813
 
784
- var handleOnClickSave = function handleOnClickSave() {
785
- if (state.saving) return;
814
+ var handleOnClickSave = /*#__PURE__*/function () {
815
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
816
+ return _regenerator.default.wrap(function _callee5$(_context5) {
817
+ while (1) {
818
+ switch (_context5.prev = _context5.next) {
819
+ case 0:
820
+ if (!state.saving) {
821
+ _context5.next = 2;
822
+ break;
823
+ }
786
824
 
787
- switch (state.active_tab) {
788
- case "Descripción":
789
- saveDescriptions(token);
790
- break;
825
+ return _context5.abrupt("return");
791
826
 
792
- case "Ficha técnica":
793
- saveDatasheets(token);
794
- break;
827
+ case 2:
828
+ _context5.t0 = state.active_tab;
829
+ _context5.next = _context5.t0 === "Descripción" ? 5 : _context5.t0 === "Ficha técnica" ? 8 : _context5.t0 === "Imágenes" ? 11 : 14;
830
+ break;
795
831
 
796
- case "Imágenes":
797
- updateImages(token);
798
- break;
832
+ case 5:
833
+ _context5.next = 7;
834
+ return saveDescriptions(token);
799
835
 
800
- default:
801
- break;
802
- }
803
- };
836
+ case 7:
837
+ return _context5.abrupt("break", 15);
838
+
839
+ case 8:
840
+ _context5.next = 10;
841
+ return saveDatasheets(token);
842
+
843
+ case 10:
844
+ return _context5.abrupt("break", 15);
845
+
846
+ case 11:
847
+ _context5.next = 13;
848
+ return updateImages(token);
849
+
850
+ case 13:
851
+ return _context5.abrupt("break", 15);
852
+
853
+ case 14:
854
+ return _context5.abrupt("break", 15);
855
+
856
+ case 15:
857
+ _context5.next = 17;
858
+ return loadData(false);
859
+
860
+ case 17:
861
+ case "end":
862
+ return _context5.stop();
863
+ }
864
+ }
865
+ }, _callee5);
866
+ }));
867
+
868
+ return function handleOnClickSave() {
869
+ return _ref8.apply(this, arguments);
870
+ };
871
+ }();
804
872
 
805
873
  var handleOnSetUpdatedDescriptions = function handleOnSetUpdatedDescriptions(items) {
806
874
  dispatch({
@@ -866,24 +934,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
866
934
  };
867
935
 
868
936
  var handleOnApproveSingleService = /*#__PURE__*/function () {
869
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
870
- return _regenerator.default.wrap(function _callee5$(_context5) {
937
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
938
+ return _regenerator.default.wrap(function _callee6$(_context6) {
871
939
  while (1) {
872
- switch (_context5.prev = _context5.next) {
940
+ switch (_context6.prev = _context6.next) {
873
941
  case 0:
874
- _context5.next = 2;
942
+ _context6.next = 2;
875
943
  return sendSingleEvaluation("A");
876
944
 
877
945
  case 2:
878
946
  case "end":
879
- return _context5.stop();
947
+ return _context6.stop();
880
948
  }
881
949
  }
882
- }, _callee5);
950
+ }, _callee6);
883
951
  }));
884
952
 
885
953
  return function handleOnApproveSingleService() {
886
- return _ref8.apply(this, arguments);
954
+ return _ref9.apply(this, arguments);
887
955
  };
888
956
  }();
889
957
 
@@ -892,21 +960,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
892
960
  };
893
961
 
894
962
  var sendSingleEvaluation = /*#__PURE__*/function () {
895
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(result) {
963
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
896
964
  var _state$product$id_ord, _state$active_retaile3;
897
965
 
898
966
  var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, retailers, messageToChat, messageData, _updatedProduct, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
899
967
 
900
- return _regenerator.default.wrap(function _callee6$(_context6) {
968
+ return _regenerator.default.wrap(function _callee7$(_context7) {
901
969
  while (1) {
902
- switch (_context6.prev = _context6.next) {
970
+ switch (_context7.prev = _context7.next) {
903
971
  case 0:
904
972
  if (!state.saving) {
905
- _context6.next = 2;
973
+ _context7.next = 2;
906
974
  break;
907
975
  }
908
976
 
909
- return _context6.abrupt("return");
977
+ return _context7.abrupt("return");
910
978
 
911
979
  case 2:
912
980
  dispatch({
@@ -917,7 +985,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
917
985
  articleId = state.product.id_article;
918
986
  orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
919
987
  sectionStatusKey = "".concat(concept, "_status");
920
- evalStatus = getStatusByCurrentServiceAndRetailer() || state.product[sectionStatusKey] || "NA";
988
+ evalStatus = state.product[sectionStatusKey];
921
989
  retailerId = (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer;
922
990
  data = {
923
991
  articleId: articleId,
@@ -927,16 +995,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
927
995
  retailerId: retailerId
928
996
  };
929
997
  activeTab = state.active_tab;
930
- _context6.prev = 11;
998
+ _context7.prev = 11;
931
999
 
932
1000
  if (!result) {
933
- _context6.next = 26;
1001
+ _context7.next = 26;
934
1002
  break;
935
1003
  }
936
1004
 
937
1005
  data.result = result;
938
1006
  data.retailerId = retailerId;
939
- _context6.next = 17;
1007
+ _context7.next = 17;
940
1008
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
941
1009
  headers: {
942
1010
  Authorization: token
@@ -944,7 +1012,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
944
1012
  });
945
1013
 
946
1014
  case 17:
947
- res = _context6.sent;
1015
+ res = _context7.sent;
948
1016
  newStatuses = JSON.parse(res.data.body);
949
1017
  serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")]; // Actualizar el producto con los nuevos estados
950
1018
 
@@ -970,7 +1038,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
970
1038
  image: _genericModalCheck.default
971
1039
  }
972
1040
  });
973
- _context6.next = 31;
1041
+ _context7.next = 31;
974
1042
  break;
975
1043
 
976
1044
  case 26:
@@ -984,7 +1052,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
984
1052
  icon = _genericModalCheck.default;
985
1053
  }
986
1054
 
987
- _context6.next = 30;
1055
+ _context7.next = 30;
988
1056
  return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
989
1057
  headers: {
990
1058
  Authorization: token
@@ -992,11 +1060,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
992
1060
  });
993
1061
 
994
1062
  case 30:
995
- res = _context6.sent;
1063
+ res = _context7.sent;
996
1064
 
997
1065
  case 31:
998
1066
  if (!(res.data.statusCode === 200)) {
999
- _context6.next = 43;
1067
+ _context7.next = 43;
1000
1068
  break;
1001
1069
  }
1002
1070
 
@@ -1023,7 +1091,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1023
1091
  Authorization: token
1024
1092
  }
1025
1093
  };
1026
- _context6.next = 38;
1094
+ _context7.next = 38;
1027
1095
  return (0, _utils.sendMessage)(messageData);
1028
1096
 
1029
1097
  case 38:
@@ -1070,13 +1138,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1070
1138
  });
1071
1139
 
1072
1140
  case 43:
1073
- _context6.next = 49;
1141
+ _context7.next = 49;
1074
1142
  break;
1075
1143
 
1076
1144
  case 45:
1077
- _context6.prev = 45;
1078
- _context6.t0 = _context6["catch"](11);
1079
- console.error("Error sending evaluation:", _context6.t0);
1145
+ _context7.prev = 45;
1146
+ _context7.t0 = _context7["catch"](11);
1147
+ console.error("Error sending evaluation:", _context7.t0);
1080
1148
  dispatch({
1081
1149
  type: "SET_MODAL",
1082
1150
  payload: {
@@ -1088,45 +1156,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1088
1156
  });
1089
1157
 
1090
1158
  case 49:
1091
- _context6.prev = 49;
1159
+ _context7.prev = 49;
1092
1160
  dispatch({
1093
1161
  type: "SET_SAVING",
1094
1162
  payload: false
1095
1163
  });
1096
- return _context6.finish(49);
1164
+ return _context7.finish(49);
1097
1165
 
1098
1166
  case 52:
1099
1167
  case "end":
1100
- return _context6.stop();
1168
+ return _context7.stop();
1101
1169
  }
1102
1170
  }
1103
- }, _callee6, null, [[11, 45, 49, 52]]);
1171
+ }, _callee7, null, [[11, 45, 49, 52]]);
1104
1172
  }));
1105
1173
 
1106
1174
  return function sendSingleEvaluation(_x2) {
1107
- return _ref9.apply(this, arguments);
1175
+ return _ref10.apply(this, arguments);
1108
1176
  };
1109
1177
  }();
1110
1178
 
1111
1179
  var handleOnApproveAllServices = /*#__PURE__*/function () {
1112
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
1113
- return _regenerator.default.wrap(function _callee7$(_context7) {
1180
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1181
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1114
1182
  while (1) {
1115
- switch (_context7.prev = _context7.next) {
1183
+ switch (_context8.prev = _context8.next) {
1116
1184
  case 0:
1117
- _context7.next = 2;
1185
+ _context8.next = 2;
1118
1186
  return sendBulkEvaluation("A");
1119
1187
 
1120
1188
  case 2:
1121
1189
  case "end":
1122
- return _context7.stop();
1190
+ return _context8.stop();
1123
1191
  }
1124
1192
  }
1125
- }, _callee7);
1193
+ }, _callee8);
1126
1194
  }));
1127
1195
 
1128
1196
  return function handleOnApproveAllServices() {
1129
- return _ref10.apply(this, arguments);
1197
+ return _ref11.apply(this, arguments);
1130
1198
  };
1131
1199
  }();
1132
1200
 
@@ -1136,18 +1204,18 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1136
1204
  };
1137
1205
 
1138
1206
  var sendBulkEvaluation = /*#__PURE__*/function () {
1139
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(result) {
1207
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
1140
1208
  var _state$services_data, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, productInSession, updatedProductInSession;
1141
1209
 
1142
- return _regenerator.default.wrap(function _callee8$(_context8) {
1210
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1143
1211
  while (1) {
1144
- switch (_context8.prev = _context8.next) {
1212
+ switch (_context9.prev = _context9.next) {
1145
1213
  case 0:
1146
1214
  dispatch({
1147
1215
  type: "SET_SAVING",
1148
1216
  payload: true
1149
1217
  });
1150
- _context8.prev = 1;
1218
+ _context9.prev = 1;
1151
1219
  evaluationArray = [];
1152
1220
  conceptArray = (0, _utils.getConceptsByRole)(user.id_role); // Crear todas las evaluaciones para cada servicio y retailer
1153
1221
 
@@ -1173,7 +1241,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1173
1241
  }));
1174
1242
  }
1175
1243
  });
1176
- _context8.next = 7;
1244
+ _context9.next = 7;
1177
1245
  return Promise.all(evaluationArray);
1178
1246
 
1179
1247
  case 7:
@@ -1220,41 +1288,41 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1220
1288
  image: _genericModalCheck.default
1221
1289
  }
1222
1290
  });
1223
- _context8.next = 21;
1291
+ _context9.next = 21;
1224
1292
  break;
1225
1293
 
1226
1294
  case 18:
1227
- _context8.prev = 18;
1228
- _context8.t0 = _context8["catch"](1);
1229
- console.error("Error in bulk evaluation:", _context8.t0);
1295
+ _context9.prev = 18;
1296
+ _context9.t0 = _context9["catch"](1);
1297
+ console.error("Error in bulk evaluation:", _context9.t0);
1230
1298
 
1231
1299
  case 21:
1232
- _context8.prev = 21;
1300
+ _context9.prev = 21;
1233
1301
  dispatch({
1234
1302
  type: "SET_SAVING",
1235
1303
  payload: false
1236
1304
  });
1237
- return _context8.finish(21);
1305
+ return _context9.finish(21);
1238
1306
 
1239
1307
  case 24:
1240
1308
  case "end":
1241
- return _context8.stop();
1309
+ return _context9.stop();
1242
1310
  }
1243
1311
  }
1244
- }, _callee8, null, [[1, 18, 21, 24]]);
1312
+ }, _callee9, null, [[1, 18, 21, 24]]);
1245
1313
  }));
1246
1314
 
1247
1315
  return function sendBulkEvaluation(_x3) {
1248
- return _ref11.apply(this, arguments);
1316
+ return _ref12.apply(this, arguments);
1249
1317
  };
1250
1318
  }();
1251
1319
 
1252
1320
  var handleOnChangeAssignations = /*#__PURE__*/function () {
1253
- var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(assignationType, assignationId) {
1321
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(assignationType, assignationId) {
1254
1322
  var concept, data, updatedProduct;
1255
- return _regenerator.default.wrap(function _callee9$(_context9) {
1323
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1256
1324
  while (1) {
1257
- switch (_context9.prev = _context9.next) {
1325
+ switch (_context10.prev = _context10.next) {
1258
1326
  case 0:
1259
1327
  concept = (0, _utils.getConceptByTab)(state.active_tab);
1260
1328
  data = {
@@ -1265,7 +1333,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1265
1333
  concept: concept,
1266
1334
  userId: assignationId
1267
1335
  };
1268
- _context9.next = 4;
1336
+ _context10.next = 4;
1269
1337
  return (0, _axios.default)({
1270
1338
  method: "post",
1271
1339
  url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
@@ -1284,14 +1352,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1284
1352
 
1285
1353
  case 6:
1286
1354
  case "end":
1287
- return _context9.stop();
1355
+ return _context10.stop();
1288
1356
  }
1289
1357
  }
1290
- }, _callee9);
1358
+ }, _callee10);
1291
1359
  }));
1292
1360
 
1293
1361
  return function handleOnChangeAssignations(_x4, _x5) {
1294
- return _ref12.apply(this, arguments);
1362
+ return _ref13.apply(this, arguments);
1295
1363
  };
1296
1364
  }();
1297
1365
 
@@ -1326,16 +1394,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1326
1394
  };
1327
1395
 
1328
1396
  var handleOnSubmitComment = /*#__PURE__*/function () {
1329
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(e) {
1397
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e) {
1330
1398
  var commentText;
1331
- return _regenerator.default.wrap(function _callee10$(_context10) {
1399
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1332
1400
  while (1) {
1333
- switch (_context10.prev = _context10.next) {
1401
+ switch (_context11.prev = _context11.next) {
1334
1402
  case 0:
1335
1403
  e.preventDefault();
1336
1404
  commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
1337
- _context10.prev = 2;
1338
- _context10.next = 5;
1405
+ _context11.prev = 2;
1406
+ _context11.next = 5;
1339
1407
  return createComment(commentText, token);
1340
1408
 
1341
1409
  case 5:
@@ -1348,13 +1416,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1348
1416
  image: _genericModalCheck.default
1349
1417
  }
1350
1418
  });
1351
- _context10.next = 12;
1419
+ _context11.next = 12;
1352
1420
  break;
1353
1421
 
1354
1422
  case 8:
1355
- _context10.prev = 8;
1356
- _context10.t0 = _context10["catch"](2);
1357
- console.error("Error saving comment:", _context10.t0);
1423
+ _context11.prev = 8;
1424
+ _context11.t0 = _context11["catch"](2);
1425
+ console.error("Error saving comment:", _context11.t0);
1358
1426
  dispatch({
1359
1427
  type: "SET_MODAL",
1360
1428
  payload: {
@@ -1367,14 +1435,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1367
1435
 
1368
1436
  case 12:
1369
1437
  case "end":
1370
- return _context10.stop();
1438
+ return _context11.stop();
1371
1439
  }
1372
1440
  }
1373
- }, _callee10, null, [[2, 8]]);
1441
+ }, _callee11, null, [[2, 8]]);
1374
1442
  }));
1375
1443
 
1376
1444
  return function handleOnSubmitComment(_x6) {
1377
- return _ref13.apply(this, arguments);
1445
+ return _ref14.apply(this, arguments);
1378
1446
  };
1379
1447
  }();
1380
1448
 
@@ -1444,11 +1512,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1444
1512
  if (state.loading || !state.services || !state.product) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1445
1513
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {})
1446
1514
  });
1447
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AiProductEdition.AiProductEditionProvider, {
1448
- activeRetailer: state.active_retailer,
1449
- isCreatorsEdition: false,
1450
- productSelected: state.product,
1451
- children: ["\\", " ", /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1515
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AiProductEdition.AiProductEditionProvider, {
1516
+ isCreatorsEdition: true,
1517
+ user: user,
1518
+ token: token,
1519
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1452
1520
  headerTop: headerTop,
1453
1521
  children: [showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
1454
1522
  title: rejectAll ? "Agregar mensaje para rechazar todo" : "Agregar mensaje de rechazo",
@@ -1470,21 +1538,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1470
1538
  type: "pink",
1471
1539
  label: "Aceptar",
1472
1540
  size: 12,
1473
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1541
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1474
1542
  var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
1475
- return _regenerator.default.wrap(function _callee11$(_context11) {
1543
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1476
1544
  while (1) {
1477
- switch (_context11.prev = _context11.next) {
1545
+ switch (_context12.prev = _context12.next) {
1478
1546
  case 0:
1479
1547
  elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
1480
1548
 
1481
1549
  if (!(!elements || elements.length === 0)) {
1482
- _context11.next = 4;
1550
+ _context12.next = 4;
1483
1551
  break;
1484
1552
  }
1485
1553
 
1486
1554
  console.error("Elemento no encontrado");
1487
- return _context11.abrupt("return");
1555
+ return _context12.abrupt("return");
1488
1556
 
1489
1557
  case 4:
1490
1558
  isMessageEmpty = Array.from(elements).every(function (el) {
@@ -1493,7 +1561,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1493
1561
  });
1494
1562
 
1495
1563
  if (!isMessageEmpty) {
1496
- _context11.next = 10;
1564
+ _context12.next = 10;
1497
1565
  break;
1498
1566
  }
1499
1567
 
@@ -1508,13 +1576,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1508
1576
  container.appendChild(alert);
1509
1577
  }
1510
1578
 
1511
- return _context11.abrupt("return");
1579
+ return _context12.abrupt("return");
1512
1580
 
1513
1581
  case 10:
1514
1582
  fullMessage = Array.from(elements).map(function (element) {
1515
1583
  return element.innerHTML;
1516
1584
  }).join("").replace(/<br\s*\/?>/gi, "\n");
1517
- _context11.next = 13;
1585
+ _context12.next = 13;
1518
1586
  return createComment(fullMessage, token);
1519
1587
 
1520
1588
  case 13:
@@ -1523,10 +1591,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1523
1591
 
1524
1592
  case 15:
1525
1593
  case "end":
1526
- return _context11.stop();
1594
+ return _context12.stop();
1527
1595
  }
1528
1596
  }
1529
- }, _callee11);
1597
+ }, _callee12);
1530
1598
  }))
1531
1599
  }, "btn-Aceptar")]
1532
1600
  }), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
@@ -1798,20 +1866,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1798
1866
  reviewed: crossComment
1799
1867
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1800
1868
  buttonType: "circular-button accept-button",
1801
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1802
- return _regenerator.default.wrap(function _callee12$(_context12) {
1869
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1870
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1803
1871
  while (1) {
1804
- switch (_context12.prev = _context12.next) {
1872
+ switch (_context13.prev = _context13.next) {
1805
1873
  case 0:
1806
1874
  setCrossComment(true);
1807
1875
  commentRevised();
1808
1876
 
1809
1877
  case 2:
1810
1878
  case "end":
1811
- return _context12.stop();
1879
+ return _context13.stop();
1812
1880
  }
1813
1881
  }
1814
- }, _callee12);
1882
+ }, _callee13);
1815
1883
  }))
1816
1884
  })]
1817
1885
  }), [7, 8].includes(user.id_role) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
@@ -1822,7 +1890,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1822
1890
  })]
1823
1891
  })]
1824
1892
  })]
1825
- })]
1893
+ })
1826
1894
  });
1827
1895
  };
1828
1896