contentoh-components-library 21.3.10 → 21.3.12

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.
@@ -165,7 +165,6 @@ var ContentChat = function ContentChat(props) {
165
165
 
166
166
  (0, _react.useEffect)(function () {
167
167
  return function () {
168
- console.log("componente chat desmontado");
169
168
  if (processUpdateID !== undefined) clearTimeout(processUpdateID);
170
169
  };
171
170
  }, []); // al cargar el componente
@@ -192,9 +191,8 @@ var ContentChat = function ContentChat(props) {
192
191
  (0, _react.useEffect)(function () {
193
192
  //return; -- descomentarizar para hacer pruebas sin update
194
193
  if (startUpdate == 0) return;
195
- console.log("START UPDATE en 5s");
196
194
  var processID = setTimeout(function () {
197
- console.log("update");
195
+ console.log("update chat execute");
198
196
  setRunUpdate(function (prev) {
199
197
  return prev + 1;
200
198
  });
@@ -256,7 +254,6 @@ var ContentChat = function ContentChat(props) {
256
254
 
257
255
  case 9:
258
256
  // success
259
- console.log(response.body);
260
257
  setCurrentUser({
261
258
  id: response.body.data.currentUserId,
262
259
  companyId: response.body.data.currentCompanyId
@@ -272,7 +269,7 @@ var ContentChat = function ContentChat(props) {
272
269
  });
273
270
  setIsLoading(false);
274
271
 
275
- case 16:
272
+ case 15:
276
273
  case "end":
277
274
  return _context.stop();
278
275
  }
@@ -329,7 +326,6 @@ var ContentChat = function ContentChat(props) {
329
326
 
330
327
  case 11:
331
328
  // success
332
- console.log(response.body);
333
329
  setCurrentUser({
334
330
  id: response.body.data.currentUserId,
335
331
  companyId: response.body.data.currentCompanyId
@@ -360,9 +356,7 @@ var ContentChat = function ContentChat(props) {
360
356
 
361
357
  if (!companyActive && companiesIdList.length) {
362
358
  companyActive = Number(companiesIdList[0]);
363
- } //console.log("companies: ", companiesList);
364
- //console.log("companyActive: ", companyActive);
365
-
359
+ }
366
360
 
367
361
  setCompanies(companiesList);
368
362
  if (companyActive) setActiveCompanyId(companyActive);
@@ -371,7 +365,7 @@ var ContentChat = function ContentChat(props) {
371
365
  });
372
366
  setIsLoading(false);
373
367
 
374
- case 24:
368
+ case 23:
375
369
  case "end":
376
370
  return _context2.stop();
377
371
  }
@@ -393,7 +387,6 @@ var ContentChat = function ContentChat(props) {
393
387
  while (1) {
394
388
  switch (_context3.prev = _context3.next) {
395
389
  case 0:
396
- console.log("\n======== INITIAL chat =======");
397
390
  stopUpdate(); // finalizamos el temporizador
398
391
 
399
392
  dataUser = {
@@ -401,27 +394,18 @@ var ContentChat = function ContentChat(props) {
401
394
  companyId: (_dataChat$currentUser2 = dataChat.currentUser) === null || _dataChat$currentUser2 === void 0 ? void 0 : _dataChat$currentUser2.companyId,
402
395
  isUserTech: (_dataChat$currentUser3 = dataChat.currentUser) === null || _dataChat$currentUser3 === void 0 ? void 0 : _dataChat$currentUser3.isUserTech
403
396
  };
404
- /*
405
- console.log("values send query:", {
406
- id: dataChat.id,
407
- getType: "initial",
408
- currentUser: dataUser,
409
- currentItemsFront: getItemsIdSingleChat(),
410
- });
411
- */
412
-
413
397
  paramsQuery = {
414
398
  id: JSON.stringify(dataChat.id),
415
399
  getType: "initial",
416
400
  currentUser: (0, _utils.encodeUriJson)(dataUser),
417
401
  currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
418
402
  };
419
- _context3.next = 6;
403
+ _context3.next = 5;
420
404
  return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
421
405
  Authorization: (_dataChat$currentUser4 = dataChat.currentUser) === null || _dataChat$currentUser4 === void 0 ? void 0 : _dataChat$currentUser4.token
422
406
  });
423
407
 
424
- case 6:
408
+ case 5:
425
409
  response = _context3.sent;
426
410
  // programar update en 20s
427
411
  setStartUpdate(function (prev) {
@@ -429,7 +413,7 @@ var ContentChat = function ContentChat(props) {
429
413
  });
430
414
 
431
415
  if (response.body) {
432
- _context3.next = 12;
416
+ _context3.next = 11;
433
417
  break;
434
418
  }
435
419
 
@@ -442,9 +426,8 @@ var ContentChat = function ContentChat(props) {
442
426
  setIsLoading(false);
443
427
  return _context3.abrupt("return");
444
428
 
445
- case 12:
429
+ case 11:
446
430
  // success
447
- console.log("response initial:", response.body);
448
431
  setLastUpdateDate(response.body.data.lastUpdateDate);
449
432
  setAllUsers(response.body.users);
450
433
  setSingleChat({
@@ -457,7 +440,7 @@ var ContentChat = function ContentChat(props) {
457
440
  });
458
441
  setIsLoading(false);
459
442
 
460
- case 18:
443
+ case 16:
461
444
  case "end":
462
445
  return _context3.stop();
463
446
  }
@@ -508,8 +491,7 @@ var ContentChat = function ContentChat(props) {
508
491
 
509
492
  case 8:
510
493
  // success
511
- console.log(response.body); // actualizar la lista de los users
512
-
494
+ // actualizar la lista de los users
513
495
  updateAllUsers(response.body.users); // actualizar los items del chat
514
496
 
515
497
  newSingleChat = (0, _objectSpread3.default)({}, singleChat);
@@ -517,7 +499,7 @@ var ContentChat = function ContentChat(props) {
517
499
  newSingleChat.enabledLoadMore = response.body.items.length === 50;
518
500
  setSingleChat(newSingleChat);
519
501
 
520
- case 14:
502
+ case 13:
521
503
  case "end":
522
504
  return _context4.stop();
523
505
  }
@@ -568,8 +550,7 @@ var ContentChat = function ContentChat(props) {
568
550
 
569
551
  case 9:
570
552
  // success
571
- console.log(response.body); // actualizar la lista de los users
572
-
553
+ // actualizar la lista de los users
573
554
  updateAllUsers(response.body.users); // actualizar los items del chat y la lista de users
574
555
 
575
556
  company.items = addOldItemsChat(company.items, response.body.items);
@@ -578,7 +559,7 @@ var ContentChat = function ContentChat(props) {
578
559
  return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, activeCompanyId, company));
579
560
  });
580
561
 
581
- case 14:
562
+ case 13:
582
563
  case "end":
583
564
  return _context5.stop();
584
565
  }
@@ -601,7 +582,6 @@ var ContentChat = function ContentChat(props) {
601
582
  while (1) {
602
583
  switch (_context6.prev = _context6.next) {
603
584
  case 0:
604
- console.log("\n======== LOAD MORE chat =======");
605
585
  stopUpdate(); // finalizamos el temporizador
606
586
 
607
587
  date = singleChat.items[singleChat.items.length - 1].date;
@@ -617,12 +597,12 @@ var ContentChat = function ContentChat(props) {
617
597
  currentUser: (0, _utils.encodeUriJson)(dataUser),
618
598
  currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
619
599
  };
620
- _context6.next = 7;
600
+ _context6.next = 6;
621
601
  return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
622
602
  Authorization: (_dataChat$currentUser8 = dataChat.currentUser) === null || _dataChat$currentUser8 === void 0 ? void 0 : _dataChat$currentUser8.token
623
603
  });
624
604
 
625
- case 7:
605
+ case 6:
626
606
  response = _context6.sent;
627
607
  //programar update en 20s
628
608
  setStartUpdate(function (prev) {
@@ -630,7 +610,7 @@ var ContentChat = function ContentChat(props) {
630
610
  });
631
611
 
632
612
  if (response.body) {
633
- _context6.next = 11;
613
+ _context6.next = 10;
634
614
  break;
635
615
  }
636
616
 
@@ -639,10 +619,9 @@ var ContentChat = function ContentChat(props) {
639
619
  message: response.errorDetail
640
620
  });
641
621
 
642
- case 11:
622
+ case 10:
643
623
  // success
644
- console.log("response loadMore:", response.body); // actualizar la lista de los users
645
-
624
+ // actualizar la lista de los users
646
625
  updateAllUsers(response.body.users); // actualizar los items del chat
647
626
 
648
627
  newSingleChat = (0, _objectSpread3.default)({}, singleChat);
@@ -650,7 +629,7 @@ var ContentChat = function ContentChat(props) {
650
629
  newSingleChat.enabledLoadMore = response.body.items.length === 50;
651
630
  setSingleChat(newSingleChat);
652
631
 
653
- case 17:
632
+ case 15:
654
633
  case "end":
655
634
  return _context6.stop();
656
635
  }
@@ -674,21 +653,20 @@ var ContentChat = function ContentChat(props) {
674
653
  while (1) {
675
654
  switch (_context7.prev = _context7.next) {
676
655
  case 0:
677
- console.log(lastUpdateDate);
678
656
  paramsQuery = {
679
657
  getType: "updateLatest",
680
658
  id: JSON.stringify(dataChat.id),
681
659
  version: JSON.stringify(dataChat.version),
682
660
  date: encodeURIComponent(lastUpdateDate)
683
661
  };
684
- _context7.next = 4;
662
+ _context7.next = 3;
685
663
  return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
686
664
 
687
- case 4:
665
+ case 3:
688
666
  response = _context7.sent;
689
667
 
690
668
  if (response.body) {
691
- _context7.next = 8;
669
+ _context7.next = 7;
692
670
  break;
693
671
  }
694
672
 
@@ -698,9 +676,8 @@ var ContentChat = function ContentChat(props) {
698
676
  });
699
677
  return _context7.abrupt("return");
700
678
 
701
- case 8:
679
+ case 7:
702
680
  // success
703
- console.log(response.body);
704
681
  setLastUpdateDate(response.body.data.lastUpdateDate); // actualizar la lista de los users
705
682
 
706
683
  updateAllUsers(response.body.users); // actualizar los items del chat
@@ -709,7 +686,7 @@ var ContentChat = function ContentChat(props) {
709
686
  newSingleChat.items = addNewItemsChat(newSingleChat.items, response.body.items);
710
687
  setSingleChat(newSingleChat);
711
688
 
712
- case 14:
689
+ case 12:
713
690
  case "end":
714
691
  return _context7.stop();
715
692
  }
@@ -729,7 +706,6 @@ var ContentChat = function ContentChat(props) {
729
706
  while (1) {
730
707
  switch (_context8.prev = _context8.next) {
731
708
  case 0:
732
- console.log(lastUpdateDate);
733
709
  paramsQuery = {
734
710
  getType: "updateLatest",
735
711
  id: JSON.stringify(dataChat.id),
@@ -741,14 +717,14 @@ var ContentChat = function ContentChat(props) {
741
717
  othersCompanyId: encodeURIComponent(JSON.stringify(Object.keys(companies))),
742
718
  date: encodeURIComponent(lastUpdateDate)
743
719
  };
744
- _context8.next = 4;
720
+ _context8.next = 3;
745
721
  return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
746
722
 
747
- case 4:
723
+ case 3:
748
724
  response = _context8.sent;
749
725
 
750
726
  if (response.body) {
751
- _context8.next = 8;
727
+ _context8.next = 7;
752
728
  break;
753
729
  }
754
730
 
@@ -758,10 +734,9 @@ var ContentChat = function ContentChat(props) {
758
734
  });
759
735
  return _context8.abrupt("return");
760
736
 
761
- case 8:
737
+ case 7:
762
738
  // success
763
- console.log(response.body); // cuando cambie la lista de chats por un cambio de version o estatus
764
-
739
+ // cuando cambie la lista de chats por un cambio de version o estatus
765
740
  if (response.body.data.status) {
766
741
  setIsLoading(true);
767
742
  setTimeout(function () {
@@ -791,9 +766,7 @@ var ContentChat = function ContentChat(props) {
791
766
 
792
767
  if (!companyActive && companiesIdList.length) {
793
768
  companyActive = Number(companiesIdList[0]);
794
- } //console.log("new companies: ", companiesList);
795
- //console.log("new companyActive: ", companyActive);
796
-
769
+ }
797
770
 
798
771
  setCompanies(companiesList);
799
772
  if (companyActive) setActiveCompanyId(companyActive);
@@ -811,12 +784,11 @@ var ContentChat = function ContentChat(props) {
811
784
  companiesList = (0, _objectSpread3.default)({}, companies);
812
785
  Object.keys(response.body.companies).forEach(function (companyId) {
813
786
  companiesList[companyId].items = addNewItemsChat(companiesList[companyId].items, response.body.companies[companyId].items);
814
- }); //console.log("new items companies: ", companiesList);
815
-
787
+ });
816
788
  setCompanies(companiesList);
817
789
  }
818
790
 
819
- case 10:
791
+ case 8:
820
792
  case "end":
821
793
  return _context8.stop();
822
794
  }
@@ -838,23 +810,11 @@ var ContentChat = function ContentChat(props) {
838
810
  while (1) {
839
811
  switch (_context9.prev = _context9.next) {
840
812
  case 0:
841
- console.log("\n======== UPDATE chat =======");
842
- console.log("lastUpdate:", lastUpdateDate);
843
813
  dataUser = {
844
814
  id: (_dataChat$currentUser9 = dataChat.currentUser) === null || _dataChat$currentUser9 === void 0 ? void 0 : _dataChat$currentUser9.id,
845
815
  companyId: (_dataChat$currentUser10 = dataChat.currentUser) === null || _dataChat$currentUser10 === void 0 ? void 0 : _dataChat$currentUser10.companyId,
846
816
  isUserTech: (_dataChat$currentUser11 = dataChat.currentUser) === null || _dataChat$currentUser11 === void 0 ? void 0 : _dataChat$currentUser11.isUserTech
847
817
  };
848
- /*
849
- console.log("values send query:", {
850
- id: dataChat.id,
851
- getType: "updateLatest",
852
- date: lastUpdateDate,
853
- currentUser: dataUser,
854
- currentItemsFront: getItemsIdSingleChat(),
855
- });
856
- */
857
-
858
818
  paramsQuery = {
859
819
  id: JSON.stringify(dataChat.id),
860
820
  getType: "updateLatest",
@@ -862,12 +822,12 @@ var ContentChat = function ContentChat(props) {
862
822
  currentUser: (0, _utils.encodeUriJson)(dataUser),
863
823
  currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
864
824
  };
865
- _context9.next = 6;
825
+ _context9.next = 4;
866
826
  return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
867
827
  Authorization: (_dataChat$currentUser12 = dataChat.currentUser) === null || _dataChat$currentUser12 === void 0 ? void 0 : _dataChat$currentUser12.token
868
828
  });
869
829
 
870
- case 6:
830
+ case 4:
871
831
  response = _context9.sent;
872
832
  //programar update en 20s
873
833
  setStartUpdate(function (prev) {
@@ -875,7 +835,7 @@ var ContentChat = function ContentChat(props) {
875
835
  });
876
836
 
877
837
  if (response.body) {
878
- _context9.next = 12;
838
+ _context9.next = 10;
879
839
  break;
880
840
  }
881
841
 
@@ -899,12 +859,11 @@ var ContentChat = function ContentChat(props) {
899
859
  });
900
860
  return _context9.abrupt("return");
901
861
 
902
- case 12:
862
+ case 10:
903
863
  // limpiar error update
904
864
  if (errorUpdate.startDate) {
905
865
  setErrorUpdate({});
906
866
  } // success
907
- //console.log("response update:", response.body);
908
867
 
909
868
 
910
869
  setLastUpdateDate(response.body.data.lastUpdateDate); // actualizar la lista de los users
@@ -916,7 +875,7 @@ var ContentChat = function ContentChat(props) {
916
875
  newSingleChat.statusChat = response.body.data.statusChat;
917
876
  setSingleChat(newSingleChat);
918
877
 
919
- case 19:
878
+ case 17:
920
879
  case "end":
921
880
  return _context9.stop();
922
881
  }
@@ -1023,84 +982,82 @@ var ContentChat = function ContentChat(props) {
1023
982
  return _context10.finish(19);
1024
983
 
1025
984
  case 22:
1026
- console.log("======= create items ========");
1027
- console.log("items a enviar:", items);
1028
985
  stopUpdate(); // finalizamos el temporizador
1029
986
  // enviar items a la BD
1030
987
 
1031
988
  if (!(chatType === "merchant_product")) {
1032
- _context10.next = 31;
989
+ _context10.next = 29;
1033
990
  break;
1034
991
  }
1035
992
 
1036
- _context10.next = 28;
993
+ _context10.next = 26;
1037
994
  return createItemsMerchantProduct(items);
1038
995
 
1039
- case 28:
996
+ case 26:
1040
997
  errorCreate = _context10.sent;
1041
- _context10.next = 40;
998
+ _context10.next = 38;
1042
999
  break;
1043
1000
 
1044
- case 31:
1001
+ case 29:
1045
1002
  if (!(chatType === "order_product")) {
1046
- _context10.next = 37;
1003
+ _context10.next = 35;
1047
1004
  break;
1048
1005
  }
1049
1006
 
1050
- _context10.next = 34;
1007
+ _context10.next = 32;
1051
1008
  return createItemsOrderProduct(items);
1052
1009
 
1053
- case 34:
1010
+ case 32:
1054
1011
  errorCreate = _context10.sent;
1055
- _context10.next = 40;
1012
+ _context10.next = 38;
1056
1013
  break;
1057
1014
 
1058
- case 37:
1059
- _context10.next = 39;
1015
+ case 35:
1016
+ _context10.next = 37;
1060
1017
  return createItemsTicket(items);
1061
1018
 
1062
- case 39:
1019
+ case 37:
1063
1020
  errorCreate = _context10.sent;
1064
1021
 
1065
- case 40:
1022
+ case 38:
1066
1023
  if (!(chatType === "merchant_product")) {
1067
- _context10.next = 45;
1024
+ _context10.next = 43;
1068
1025
  break;
1069
1026
  }
1070
1027
 
1071
- _context10.next = 43;
1028
+ _context10.next = 41;
1072
1029
  return getUpdateLatestMerchantProduct();
1073
1030
 
1074
- case 43:
1075
- _context10.next = 52;
1031
+ case 41:
1032
+ _context10.next = 50;
1076
1033
  break;
1077
1034
 
1078
- case 45:
1035
+ case 43:
1079
1036
  if (!(chatType === "order_product")) {
1080
- _context10.next = 50;
1037
+ _context10.next = 48;
1081
1038
  break;
1082
1039
  }
1083
1040
 
1084
- _context10.next = 48;
1041
+ _context10.next = 46;
1085
1042
  return getUpdateLatestOrderProduct();
1086
1043
 
1087
- case 48:
1088
- _context10.next = 52;
1044
+ case 46:
1045
+ _context10.next = 50;
1089
1046
  break;
1090
1047
 
1091
- case 50:
1092
- _context10.next = 52;
1048
+ case 48:
1049
+ _context10.next = 50;
1093
1050
  return getUpdateLatestTicket();
1094
1051
 
1095
- case 52:
1052
+ case 50:
1096
1053
  if (!errorCreate) {
1097
- _context10.next = 54;
1054
+ _context10.next = 52;
1098
1055
  break;
1099
1056
  }
1100
1057
 
1101
1058
  return _context10.abrupt("return", errorCreate);
1102
1059
 
1103
- case 54:
1060
+ case 52:
1104
1061
  case "end":
1105
1062
  return _context10.stop();
1106
1063
  }
@@ -1124,21 +1081,20 @@ var ContentChat = function ContentChat(props) {
1124
1081
  switch (_context11.prev = _context11.next) {
1125
1082
  case 0:
1126
1083
  items = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : [];
1127
- console.log("create items merchants");
1128
1084
  paramsBody = {
1129
1085
  id: JSON.stringify(dataChat.id),
1130
1086
  version: JSON.stringify(dataChat.version),
1131
1087
  userId: JSON.stringify(currentUser.id),
1132
1088
  items: JSON.stringify(items)
1133
1089
  };
1134
- _context11.next = 5;
1090
+ _context11.next = 4;
1135
1091
  return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody);
1136
1092
 
1137
- case 5:
1093
+ case 4:
1138
1094
  response = _context11.sent;
1139
1095
 
1140
1096
  if (response.body) {
1141
- _context11.next = 8;
1097
+ _context11.next = 7;
1142
1098
  break;
1143
1099
  }
1144
1100
 
@@ -1147,7 +1103,7 @@ var ContentChat = function ContentChat(props) {
1147
1103
  errorDetail: response.errorDetail
1148
1104
  });
1149
1105
 
1150
- case 8:
1106
+ case 7:
1151
1107
  case "end":
1152
1108
  return _context11.stop();
1153
1109
  }
@@ -1171,7 +1127,6 @@ var ContentChat = function ContentChat(props) {
1171
1127
  switch (_context12.prev = _context12.next) {
1172
1128
  case 0:
1173
1129
  items = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : [];
1174
- console.log("create items order");
1175
1130
  paramsBody = {
1176
1131
  id: JSON.stringify(dataChat.id),
1177
1132
  version: JSON.stringify(currentArticle.version),
@@ -1181,15 +1136,14 @@ var ContentChat = function ContentChat(props) {
1181
1136
  sentCompanyId: JSON.stringify(currentUser.companyId),
1182
1137
  receivedCompanyId: JSON.stringify(activeCompanyId)
1183
1138
  };
1184
- console.log(paramsBody);
1185
- _context12.next = 6;
1139
+ _context12.next = 4;
1186
1140
  return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody);
1187
1141
 
1188
- case 6:
1142
+ case 4:
1189
1143
  response = _context12.sent;
1190
1144
 
1191
1145
  if (response.body) {
1192
- _context12.next = 9;
1146
+ _context12.next = 7;
1193
1147
  break;
1194
1148
  }
1195
1149
 
@@ -1198,7 +1152,7 @@ var ContentChat = function ContentChat(props) {
1198
1152
  errorDetail: response.errorDetail
1199
1153
  });
1200
1154
 
1201
- case 9:
1155
+ case 7:
1202
1156
  case "end":
1203
1157
  return _context12.stop();
1204
1158
  }
@@ -1307,8 +1261,7 @@ var ContentChat = function ContentChat(props) {
1307
1261
  items.push(item);
1308
1262
  itemsId[item.id] = true;
1309
1263
  }
1310
- }); //console.log("newItems: ", items);
1311
-
1264
+ });
1312
1265
  return items;
1313
1266
  };
1314
1267
 
@@ -1316,18 +1269,16 @@ var ContentChat = function ContentChat(props) {
1316
1269
  var currentItems = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1317
1270
  var newItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1318
1271
  var items = currentItems.slice();
1319
- var itemsId = {};
1320
- items.forEach(function (item) {
1321
- itemsId[item.id] = true;
1272
+ var itemsId = items.map(function (item) {
1273
+ return item.id;
1322
1274
  });
1323
1275
 
1324
1276
  for (var i = newItems.length - 1; i >= 0; i--) {
1325
- if (!itemsId[newItems[i].id]) {
1326
- items.unshift(newItems[i]);
1327
- itemsId[newItems[i].id] = true;
1277
+ if (!itemsId.includes(newItems[i].id)) {
1278
+ items.push(newItems[i]);
1279
+ itemsId.push(newItems[i].id);
1328
1280
  }
1329
- } //console.log("newItems: ", items);
1330
-
1281
+ }
1331
1282
 
1332
1283
  return items;
1333
1284
  };
@@ -1339,8 +1290,7 @@ var ContentChat = function ContentChat(props) {
1339
1290
  if (!currentUsers[userId]) {
1340
1291
  currentUsers[userId] = newUsers[userId];
1341
1292
  }
1342
- }); //console.log("newUsers: ", currentUsers);
1343
-
1293
+ });
1344
1294
  setAllUsers(currentUsers);
1345
1295
  };
1346
1296
 
@@ -1378,7 +1328,7 @@ var ContentChat = function ContentChat(props) {
1378
1328
  var items;
1379
1329
  var enabledLoadMore;
1380
1330
 
1381
- if (chatType === "merchant_product" || chatType === "ticket") {
1331
+ if (["merchant_product", "ticket"].includes(chatType)) {
1382
1332
  items = singleChat.items;
1383
1333
  enabledLoadMore = singleChat.enabledLoadMore;
1384
1334
  } // ORDER_PRODUCT