quickblox-react-ui-kit 0.5.0-beta.13 → 0.5.0-beta.15

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 (109) hide show
  1. package/dist/CommonTypes/CommonTypes.d.ts +2 -0
  2. package/dist/CommonTypes/CommonTypes.d.ts.map +1 -1
  3. package/dist/Data/DefaultConfigurations.d.ts.map +1 -1
  4. package/dist/Data/source/remote/RemoteDataSource.d.ts +3 -0
  5. package/dist/Data/source/remote/RemoteDataSource.d.ts.map +1 -1
  6. package/dist/Domain/use_cases/CreateDialogUseCase.d.ts.map +1 -1
  7. package/dist/Domain/use_cases/ForwardMessagesUseCase.d.ts.map +1 -1
  8. package/dist/Domain/use_cases/GetAllDialogsUseCase.d.ts.map +1 -1
  9. package/dist/Domain/use_cases/GetAllDialogsUseCaseWithMock.d.ts.map +1 -1
  10. package/dist/Domain/use_cases/GetAllMessagesForDialog.d.ts.map +1 -1
  11. package/dist/Domain/use_cases/GetAllUsersUseCase.d.ts.map +1 -1
  12. package/dist/Domain/use_cases/GetDialogByIdUseCase.d.ts.map +1 -1
  13. package/dist/Domain/use_cases/GetUsersByIdsUseCase.d.ts.map +1 -1
  14. package/dist/Domain/use_cases/LeaveDialogUseCase.d.ts.map +1 -1
  15. package/dist/Domain/use_cases/RemoveUsersFromTheDialogUseCase.d.ts.map +1 -1
  16. package/dist/Domain/use_cases/ReplyMessagesUseCase.d.ts.map +1 -1
  17. package/dist/Domain/use_cases/SendTextMessageUseCase.d.ts.map +1 -1
  18. package/dist/Domain/use_cases/SubscribeToDialogEventsUseCase.d.ts.map +1 -1
  19. package/dist/Domain/use_cases/SubscribeToDialogsUpdatesUseCase.d.ts.map +1 -1
  20. package/dist/Domain/use_cases/SyncDialogsUseCase.d.ts.map +1 -1
  21. package/dist/Domain/use_cases/UpdateCurrentDialogInDataSourceUseCase.d.ts.map +1 -1
  22. package/dist/Domain/use_cases/UpdateDialogUseCase.d.ts.map +1 -1
  23. package/dist/Domain/use_cases/UploadFileUseCase.d.ts.map +1 -1
  24. package/dist/Domain/use_cases/UserTypingMessageUseCase.d.ts.map +1 -1
  25. package/dist/Domain/use_cases/ai/AIAnswerAssistUseCase.d.ts.map +1 -1
  26. package/dist/Domain/use_cases/ai/AIAnswerAssistWithProxyUseCase.d.ts.map +1 -1
  27. package/dist/Domain/use_cases/ai/AIAnswerAssistWithSDKUseCase.d.ts.map +1 -1
  28. package/dist/Domain/use_cases/ai/AIRephraseUseCase.d.ts.map +1 -1
  29. package/dist/Domain/use_cases/ai/AIRephraseWithProxyUseCase.d.ts.map +1 -1
  30. package/dist/Domain/use_cases/ai/AITranslateUseCase.d.ts.map +1 -1
  31. package/dist/Domain/use_cases/ai/AITranslateWithProxyUseCase.d.ts.map +1 -1
  32. package/dist/Domain/use_cases/ai/AITranslateWithSDKUseCase.d.ts.map +1 -1
  33. package/dist/Domain/use_cases/base/Subscribable/SubscriptionPerformer.d.ts.map +1 -1
  34. package/dist/Presentation/Views/Dialog/MessageItem/MessageItem.d.ts +3 -2
  35. package/dist/Presentation/Views/Dialog/MessageItem/MessageItem.d.ts.map +1 -1
  36. package/dist/Presentation/Views/Dialog/useDialogViewModel.d.ts.map +1 -1
  37. package/dist/Presentation/Views/DialogInfo/UsersList/useUsersListViewModel.d.ts.map +1 -1
  38. package/dist/Presentation/Views/DialogList/useDialogListViewModel.d.ts.map +1 -1
  39. package/dist/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.d.ts.map +1 -1
  40. package/dist/QBconfig.d.ts.map +1 -1
  41. package/dist/index-ui.js +65 -202
  42. package/package.json +1 -1
  43. package/src/CommonTypes/CommonTypes.ts +2 -0
  44. package/src/Data/DefaultConfigurations.ts +2 -0
  45. package/src/Data/source/remote/RemoteDataSource.ts +72 -166
  46. package/src/Domain/use_cases/CreateDialogUseCase.ts +0 -1
  47. package/src/Domain/use_cases/ForwardMessagesUseCase.ts +0 -1
  48. package/src/Domain/use_cases/GetAllDialogsUseCase.ts +0 -1
  49. package/src/Domain/use_cases/GetAllDialogsUseCaseWithMock.ts +0 -2
  50. package/src/Domain/use_cases/GetAllMessagesForDialog.ts +0 -1
  51. package/src/Domain/use_cases/GetAllUsersUseCase.ts +0 -1
  52. package/src/Domain/use_cases/GetDialogByIdUseCase.ts +0 -2
  53. package/src/Domain/use_cases/GetUsersByIdsUseCase.ts +0 -3
  54. package/src/Domain/use_cases/LeaveDialogUseCase.ts +0 -1
  55. package/src/Domain/use_cases/RemoveUsersFromTheDialogUseCase.ts +0 -1
  56. package/src/Domain/use_cases/ReplyMessagesUseCase.ts +0 -2
  57. package/src/Domain/use_cases/SendTextMessageUseCase.ts +0 -3
  58. package/src/Domain/use_cases/SubscribeToDialogEventsUseCase.ts +0 -1
  59. package/src/Domain/use_cases/SubscribeToDialogsUpdatesUseCase.ts +0 -1
  60. package/src/Domain/use_cases/SyncDialogsUseCase.ts +0 -1
  61. package/src/Domain/use_cases/UpdateCurrentDialogInDataSourceUseCase.ts +0 -2
  62. package/src/Domain/use_cases/UpdateDialogUseCase.ts +0 -2
  63. package/src/Domain/use_cases/UploadFileUseCase.ts +0 -2
  64. package/src/Domain/use_cases/UserTypingMessageUseCase.ts +0 -2
  65. package/src/Domain/use_cases/ai/AIAnswerAssistUseCase.ts +0 -2
  66. package/src/Domain/use_cases/ai/AIAnswerAssistWithProxyUseCase.ts +0 -3
  67. package/src/Domain/use_cases/ai/AIAnswerAssistWithSDKUseCase.ts +0 -2
  68. package/src/Domain/use_cases/ai/AIRephraseUseCase.ts +0 -2
  69. package/src/Domain/use_cases/ai/AIRephraseWithProxyUseCase.ts +0 -3
  70. package/src/Domain/use_cases/ai/AITranslateUseCase.ts +0 -2
  71. package/src/Domain/use_cases/ai/AITranslateWithProxyUseCase.ts +0 -3
  72. package/src/Domain/use_cases/ai/AITranslateWithSDKUseCase.ts +0 -3
  73. package/src/Domain/use_cases/base/Subscribable/SubscriptionPerformer.ts +0 -1
  74. package/src/Presentation/Views/Dialog/MessageItem/MessageItem.tsx +4 -1
  75. package/src/Presentation/Views/Dialog/useDialogViewModel.ts +0 -5
  76. package/src/Presentation/Views/DialogInfo/UsersList/useUsersListViewModel.ts +0 -3
  77. package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +0 -1
  78. package/src/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +6 -1
  79. package/src/QBconfig.ts +2 -0
  80. package/src/hooks/useQuickBloxUIKit.ts +1 -1
  81. package/storybook-static/161.53da4e03.iframe.bundle.js +2 -0
  82. package/storybook-static/{756.92971caf.iframe.bundle.js.LICENSE.txt → 161.53da4e03.iframe.bundle.js.LICENSE.txt} +0 -10
  83. package/storybook-static/217.3c66ff1e.iframe.bundle.js +405 -0
  84. package/storybook-static/217.3c66ff1e.iframe.bundle.js.LICENSE.txt +9 -0
  85. package/storybook-static/{756.92971caf.iframe.bundle.js.map → 217.3c66ff1e.iframe.bundle.js.map} +1 -1
  86. package/storybook-static/844.6041e1a5.iframe.bundle.js +95 -0
  87. package/storybook-static/844.6041e1a5.iframe.bundle.js.map +1 -0
  88. package/storybook-static/iframe.html +3 -3
  89. package/storybook-static/{main.c2fb2ab0.iframe.bundle.js → main.59f682e8.iframe.bundle.js} +1 -1
  90. package/storybook-static/project.json +1 -1
  91. package/storybook-static/runtime~main.5a7ba727.iframe.bundle.js +1 -0
  92. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +24 -24
  93. package/storybook-static/sb-addons/essentials-backgrounds-5/manager-bundle.js +1 -1
  94. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +8 -8
  95. package/storybook-static/sb-addons/essentials-docs-4/manager-bundle.js +5 -5
  96. package/storybook-static/sb-addons/essentials-measure-8/manager-bundle.js +1 -1
  97. package/storybook-static/sb-addons/essentials-outline-9/manager-bundle.js +1 -1
  98. package/storybook-static/sb-addons/essentials-viewport-6/manager-bundle.js +1 -1
  99. package/storybook-static/sb-addons/interactions-11/manager-bundle.js +20 -20
  100. package/storybook-static/sb-addons/onboarding-1/manager-bundle.js +1 -1
  101. package/storybook-static/sb-manager/globals-module-info.js +5 -0
  102. package/storybook-static/sb-manager/globals-runtime.js +11936 -11584
  103. package/storybook-static/sb-manager/runtime.js +144 -144
  104. package/storybook-static/sb-preview/runtime.js +3 -5
  105. package/storybook-static/756.92971caf.iframe.bundle.js +0 -405
  106. package/storybook-static/844.642791cb.iframe.bundle.js +0 -95
  107. package/storybook-static/844.642791cb.iframe.bundle.js.map +0 -1
  108. package/storybook-static/runtime~main.df48e830.iframe.bundle.js +0 -1
  109. /package/storybook-static/{844.642791cb.iframe.bundle.js.LICENSE.txt → 844.6041e1a5.iframe.bundle.js.LICENSE.txt} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickblox-react-ui-kit",
3
- "version": "0.5.0-beta.13",
3
+ "version": "0.5.0-beta.15",
4
4
  "main": "dist/index-ui.js",
5
5
  "types": "dist/index-ui.d.ts",
6
6
  "license": "MIT",
@@ -85,6 +85,8 @@ export interface QBUIKitConfig extends QBConfig {
85
85
  chatProtocol: {
86
86
  active: number;
87
87
  };
88
+ pingLocalhostTimeInterval: number;
89
+ chatReconnectionTimeInterval: number
88
90
  debug: boolean;
89
91
  enableForwarding: boolean;
90
92
  enableReplying: boolean;
@@ -260,6 +260,8 @@ export class DefaultConfigurations {
260
260
  chatProtocol: {
261
261
  active: 2,
262
262
  },
263
+ pingLocalhostTimeInterval: 0,
264
+ chatReconnectionTimeInterval: 3,
263
265
  debug: true,
264
266
  enableForwarding: true,
265
267
  enableReplying: true,
@@ -212,7 +212,6 @@ export class RemoteDataSource implements IRemoteDataSource {
212
212
 
213
213
  //
214
214
  constructor() {
215
- console.log('CONSTRUCTOR RemoteDataSourceMock');
216
215
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
217
216
  // @ts-ignore
218
217
  console.log('QB inside RemoteDataSource:', window.QB);
@@ -237,7 +236,8 @@ export class RemoteDataSource implements IRemoteDataSource {
237
236
  new SubscriptionPerformer<RemoteMessageDTO>();
238
237
  this.subscriptionOnSystemMessages[NotificationTypes.NEW_DIALOG] =
239
238
  new SubscriptionPerformer<RemoteMessageDTO>();
240
- this.startUserCachePreload();
239
+
240
+ // this.startUserCachePreload(); //TODO: uncomment this line after test [CSAMPLES-4065] is done
241
241
  }
242
242
 
243
243
  // eslint-disable-next-line class-methods-use-this
@@ -789,10 +789,6 @@ export class RemoteDataSource implements IRemoteDataSource {
789
789
  error,
790
790
  )}, current auth status is: ${this.authProcessed ? 'true' : 'false'}`,
791
791
  );
792
- this.subscriptionOnSessionExpiredListener.informSubscribers(
793
- true,
794
- EventMessageType.LocalMessage,
795
- );
796
792
  };
797
793
 
798
794
  QB.chat.onReadStatusListener = (messageId, dialogId, userId) => {
@@ -913,6 +909,7 @@ export class RemoteDataSource implements IRemoteDataSource {
913
909
  private async joinGroupDialog(dialogId: string): Promise<void> {
914
910
  try {
915
911
  await QBJoinGroupDialog(dialogId).catch(() => {
912
+ this.joinStatusMap.set(dialogId, false);
916
913
  throw new RemoteDataSourceException(
917
914
  INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_MESSAGE,
918
915
  INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_CODE,
@@ -925,198 +922,104 @@ export class RemoteDataSource implements IRemoteDataSource {
925
922
  }
926
923
  }
927
924
 
925
+ //version 0.5.0-beta.11,12,14
926
+ private startJoinRetryProcess(): void {
927
+ if (this.joinCheckInterval) return;
928
+
929
+ this.joinCheckInterval = setInterval(async () => {
930
+ const dialogsToRetry = Array.from(this.joinStatusMap.entries())
931
+ .filter(([_, isJoined]) => !isJoined)
932
+ .map(([id]) => id);
933
+
934
+ if (dialogsToRetry.length === 0) {
935
+ clearInterval(this.joinCheckInterval!);
936
+ this.joinCheckInterval = null;
937
+ console.log('All dialogs successfully joined. Stopping retry process.');
938
+ return;
939
+ }
940
+
941
+ console.log(`Retrying join for ${dialogsToRetry.length} dialogs...`);
942
+ await this.processDialogs(dialogsToRetry);
943
+ }, 7000);
944
+ }
945
+
946
+ private async processDialogsInBackground(dialogIds: string[]): Promise<void> {
947
+ const BATCH_SIZE = 12;
948
+
949
+ console.log(`Starting background processing for ${dialogIds.length} dialogs`);
950
+
951
+ for (let i = 0; i < dialogIds.length; i += BATCH_SIZE) {
952
+ const batch = dialogIds.slice(i, i + BATCH_SIZE);
953
+
954
+ console.log(`Processing batch ${i / BATCH_SIZE + 1}:`, batch);
955
+
956
+ await Promise.all(batch.map((id) => this.joinGroupDialog(id)));
957
+ console.log(`Batch ${i / BATCH_SIZE + 1} completed.`);
958
+
959
+ await new Promise((resolve) => setTimeout(resolve, 1500));
960
+ }
961
+
962
+ console.log('Background processing complete.');
963
+ }
964
+
965
+ private async processDialogs(dialogIds: string[]): Promise<void> {
966
+ await Promise.all(dialogIds.map((id) => this.joinGroupDialog(id)));
967
+ }
968
+
928
969
  async getDialogs(pagination?: Pagination): Promise<RemoteDialogsDTO> {
929
970
  let currentPagination: Pagination = pagination || new Pagination();
930
971
 
931
- console.log(
932
- 'call getDialogs in RemoteDataSourceMock param pagination: ',
933
- JSON.stringify(pagination),
934
- );
935
- console.log(
936
- 'call getDialogs in RemoteDataSourceMock with result pagination: ',
937
- JSON.stringify(currentPagination),
938
- );
939
972
  const pageNumber = currentPagination.getCurrentPage() || 1;
940
-
941
- console.log('pageNumber: ', pageNumber);
942
973
  const perPage = currentPagination.perPage || 100;
943
974
 
944
- console.log('perPage: ', perPage);
945
975
  const params = {
946
- created_at: {
947
- lt: Date.now() / 1000,
948
- },
949
- // sort_desc: 'created_at',// artan 19.0.2024
976
+ created_at: { lt: Date.now() / 1000 },
950
977
  sort_desc: 'updated_at',
951
978
  page: pageNumber,
952
- // per_page: perPage,
953
979
  limit: perPage,
954
- type: {
955
- in: [2, 3],
956
- },
980
+ type: { in: [2, 3] },
957
981
  };
958
- // filter['type[in]'] = [3, 2].join(',');
959
982
 
960
- console.log(
961
- 'call getDialogs in RemoteDataSourceMock with params: ',
962
- JSON.stringify(params),
963
- );
964
983
  const dialogsDTO: Array<RemoteDialogDTO> = [];
984
+ const joinDialogIds: string[] = [];
965
985
  const qbDialogs: QBGetDialogResult | undefined = await QBGetDialogs(params);
966
986
 
967
987
  if (qbDialogs) {
968
- console.log(
969
- `request completed. have: total_entries ${
970
- qbDialogs.total_entries
971
- }, limit: ${qbDialogs.limit}, skip: ${
972
- qbDialogs.skip
973
- } items: ${JSON.stringify(qbDialogs.items)}`,
974
- );
975
988
  currentPagination = new Pagination(0, perPage);
976
989
  currentPagination.totalPages = qbDialogs.total_entries / perPage;
977
990
  currentPagination.setCurrentPage(pageNumber);
978
991
 
979
- // eslint-disable-next-line no-restricted-syntax
980
992
  for (const item of qbDialogs.items) {
981
993
  const qbEntity: QBChatDialog = item;
982
- if (!qbEntity) {
983
- continue;
984
- }
985
- const newDTO: RemoteDialogDTO =
986
- // eslint-disable-next-line no-await-in-loop
987
- await this.getCurrentDialogDTOMapper().toTDO(qbEntity);
994
+ if (!qbEntity) continue;
995
+
996
+ const newDTO: RemoteDialogDTO = await this.getCurrentDialogDTOMapper().toTDO(qbEntity);
997
+
998
+ if (newDTO.type === DialogType.group && !this.processedDialogs.has(newDTO.id)) {
999
+ this.processedDialogs.add(newDTO.id);
988
1000
 
989
- if (newDTO.type === DialogType.group) {
990
- // eslint-disable-next-line no-await-in-loop
991
1001
  if (!this.joinStatusMap.has(newDTO.id)) {
992
- await this.joinGroupDialog(newDTO.id);
1002
+ this.joinStatusMap.set(newDTO.id, false);
1003
+ joinDialogIds.push(newDTO.id);
993
1004
  }
994
- // await QBJoinGroupDialog(newDTO.id).catch((reason) => {
995
- // console.log('getDialogs. QBJoinGroupDialog error', reason);
996
- // throw new RemoteDataSourceException(
997
- // INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_MESSAGE,
998
- // INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_CODE,
999
- // );
1000
- // });
1001
1005
  }
1002
1006
 
1003
- //
1004
- // const currentUserId = this._authInformation?.userId || 0;
1005
- // const statusMessageParams: QBMessageStatusParams = {
1006
- // userId: newDTO.lastMessageUserId || currentUserId,
1007
- // dialogId: newDTO.id,
1008
- // messageId: newDTO.lastMessageId,
1009
- // };
1010
- //
1011
- // // eslint-disable-next-line @typescript-eslint/no-unsafe-call
1012
- // QBChatMarkMessageDelivered(statusMessageParams);
1013
-
1014
1007
  dialogsDTO.push(newDTO);
1015
1008
  }
1009
+
1010
+ const firstBatch = joinDialogIds.slice(0, 24);
1011
+ await this.processDialogs(firstBatch);
1012
+
1013
+ const remainingDialogs = joinDialogIds.slice(24);
1014
+ if (remainingDialogs.length) {
1015
+ await this.processDialogsInBackground(remainingDialogs);
1016
+ this.startJoinRetryProcess();
1017
+ }
1016
1018
  }
1017
1019
 
1018
1020
  return Promise.resolve(new RemoteDialogsDTO(dialogsDTO, currentPagination));
1019
1021
  }
1020
1022
 
1021
- //version 0.5.0-beta.11 - 12
1022
- // private startJoinRetryProcess(): void {
1023
- // if (this.joinCheckInterval) return; // Избегаем дублирования таймера
1024
- //
1025
- // this.joinCheckInterval = setInterval(async () => {
1026
- // const dialogsToRetry = Array.from(this.joinStatusMap.entries())
1027
- // .filter(([_, isJoined]) => !isJoined) // Только неприсоединённые
1028
- // .map(([id]) => id);
1029
- //
1030
- // if (dialogsToRetry.length === 0) {
1031
- // clearInterval(this.joinCheckInterval!);
1032
- // this.joinCheckInterval = null;
1033
- // console.log('All dialogs successfully joined. Stopping retry process.');
1034
- // return;
1035
- // }
1036
- //
1037
- // console.log(`Retrying join for ${dialogsToRetry.length} dialogs...`);
1038
- // await this.processDialogs(dialogsToRetry);
1039
- // }, 7000);
1040
- // }
1041
- //
1042
- // private async processDialogsInBackground(dialogIds: string[]): Promise<void> {
1043
- // const BATCH_SIZE = 12;
1044
- //
1045
- // console.log(`Starting background processing for ${dialogIds.length} dialogs`);
1046
- //
1047
- // for (let i = 0; i < dialogIds.length; i += BATCH_SIZE) {
1048
- // const batch = dialogIds.slice(i, i + BATCH_SIZE);
1049
- //
1050
- // console.log(`Processing batch ${i / BATCH_SIZE + 1}:`, batch);
1051
- //
1052
- // await Promise.all(batch.map((id) => this.joinGroupDialog(id)));
1053
- // console.log(`Batch ${i / BATCH_SIZE + 1} completed.`);
1054
- //
1055
- // await new Promise((resolve) => setTimeout(resolve, 1500));
1056
- // }
1057
- //
1058
- // console.log('Background processing complete.');
1059
- // }
1060
- //
1061
- // private async processDialogs(dialogIds: string[]): Promise<void> {
1062
- // await Promise.all(dialogIds.map((id) => this.joinGroupDialog(id)));
1063
- // }
1064
- //
1065
- // async getDialogs(pagination?: Pagination): Promise<RemoteDialogsDTO> {
1066
- // let currentPagination: Pagination = pagination || new Pagination();
1067
- //
1068
- // const pageNumber = currentPagination.getCurrentPage() || 1;
1069
- // const perPage = currentPagination.perPage || 100;
1070
- //
1071
- // const params = {
1072
- // created_at: { lt: Date.now() / 1000 },
1073
- // sort_desc: 'updated_at',
1074
- // page: pageNumber,
1075
- // limit: perPage,
1076
- // type: { in: [2, 3] },
1077
- // };
1078
- //
1079
- // const dialogsDTO: Array<RemoteDialogDTO> = [];
1080
- // const joinDialogIds: string[] = [];
1081
- // const qbDialogs: QBGetDialogResult | undefined = await QBGetDialogs(params);
1082
- //
1083
- // if (qbDialogs) {
1084
- // currentPagination = new Pagination(0, perPage);
1085
- // currentPagination.totalPages = qbDialogs.total_entries / perPage;
1086
- // currentPagination.setCurrentPage(pageNumber);
1087
- //
1088
- // for (const item of qbDialogs.items) {
1089
- // const qbEntity: QBChatDialog = item;
1090
- // if (!qbEntity) continue;
1091
- //
1092
- // const newDTO: RemoteDialogDTO = await this.getCurrentDialogDTOMapper().toTDO(qbEntity);
1093
- //
1094
- // if (newDTO.type === DialogType.group && !this.processedDialogs.has(newDTO.id)) {
1095
- // this.processedDialogs.add(newDTO.id);
1096
- //
1097
- // // Если уже есть в Map — пропускаем, иначе добавляем в joinDialogIds
1098
- // if (!this.joinStatusMap.has(newDTO.id)) {
1099
- // this.joinStatusMap.set(newDTO.id, false);
1100
- // joinDialogIds.push(newDTO.id);
1101
- // }
1102
- // }
1103
- //
1104
- // dialogsDTO.push(newDTO);
1105
- // }
1106
- //
1107
- // const firstBatch = joinDialogIds.slice(0, 12);
1108
- // await this.processDialogs(firstBatch);
1109
- //
1110
- // const remainingDialogs = joinDialogIds.slice(12);
1111
- // if (remainingDialogs.length) {
1112
- // await this.processDialogsInBackground(remainingDialogs);
1113
- // this.startJoinRetryProcess();
1114
- // }
1115
- // }
1116
- //
1117
- // return Promise.resolve(new RemoteDialogsDTO(dialogsDTO, currentPagination));
1118
- // }
1119
-
1120
1023
  //tested in 0.5.0-beta.10
1121
1024
  // private async processDialogs(dialogIds: string[]): Promise<void> {
1122
1025
  // await Promise.all(dialogIds.map((id) => this.joinGroupDialog(id)));
@@ -1829,7 +1732,10 @@ export class RemoteDataSource implements IRemoteDataSource {
1829
1732
  qbMessageId = await QBChatSendMessage(dialogJid, qbEntity);
1830
1733
  }catch (e) {
1831
1734
  qbMessageId = undefined;
1832
- console.log('Error: send message throw: ', stringifyError(e));
1735
+ const errorMessage = `Error in DataSource: send message throw: ${stringifyError(e)}`;
1736
+ console.log('Error in DataSource: send message throw: ', errorMessage);
1737
+ console.warn('Error in DataSource: send message throw: ', errorMessage);
1738
+ console.error('Error in DataSource: send message throw: ', errorMessage);
1833
1739
  }
1834
1740
  }
1835
1741
 
@@ -1841,7 +1747,7 @@ export class RemoteDataSource implements IRemoteDataSource {
1841
1747
  ),
1842
1748
  );
1843
1749
  }
1844
- console.log('regular message was sent');
1750
+ console.log(`DataSource: regular message was sent, id: ${qbMessageId}`);
1845
1751
  // eslint-disable-next-line no-param-reassign
1846
1752
  dto.id = qbMessageId;
1847
1753
 
@@ -23,7 +23,6 @@ export class CreateDialogUseCase implements IUseCase<void, DialogEntity> {
23
23
  newDialog: GroupDialogEntity,
24
24
  textInformationMessage: string,
25
25
  ) {
26
- console.log('CONSTRUCTOR CreateDialogUseCase');
27
26
  this.dialogRepository = dialogRepository;
28
27
  this.newDialog = newDialog;
29
28
  this.eventMessagesRepository = eventMessagesRepository;
@@ -23,7 +23,6 @@ export class ForwardMessagesUseCase implements IUseCase<void, boolean> {
23
23
  relatedMessage: MessageEntity,
24
24
  userName: string,
25
25
  ) {
26
- console.log('CONSTRUCTOR ForwardMessagesUseCase');
27
26
  this.messagesRepository = messagesRepository;
28
27
  this.relatedMessage = relatedMessage;
29
28
  this.targetDialogs = targetDialogs;
@@ -8,7 +8,6 @@ export class GetAllDialogsUseCase
8
8
  private dialogRepository: DialogsRepository;
9
9
 
10
10
  constructor(dialogRepository: DialogsRepository) {
11
- console.log('CONSTRUCTOR GetAllDialogsUseCase');
12
11
  this.dialogRepository = dialogRepository;
13
12
  }
14
13
 
@@ -11,13 +11,11 @@ export class GetAllDialogsUseCaseWithMock
11
11
  private readonly pagination: Pagination;
12
12
 
13
13
  constructor(dialogRepository: DialogsRepository, pagination?: Pagination) {
14
- console.log('CONSTRUCTOR GetAllDialogsUseCaseWithMock');
15
14
  this.dialogRepository = dialogRepository;
16
15
  this.pagination = pagination || new Pagination();
17
16
  }
18
17
 
19
18
  async execute(): Promise<PaginatedResult<DialogEntity>> {
20
- console.log('execute GetAllDialogsUseCaseWithMock');
21
19
  const fromRemote: PaginatedResult<DialogEntity> =
22
20
  await this.dialogRepository.getDialogsFromRemote(this.pagination);
23
21
 
@@ -17,7 +17,6 @@ export class GetAllMessagesForDialogMock
17
17
  dialogId: string,
18
18
  currentPagination: Pagination,
19
19
  ) {
20
- console.log('CONSTRUCTOR GetAllMessagesForDialog');
21
20
  this.messagesRepository = messagesRepository;
22
21
  this.dialogId = dialogId;
23
22
  this.currentPagination = currentPagination;
@@ -17,7 +17,6 @@ export class GetAllUsersUseCase
17
17
  currentPagination: Pagination,
18
18
  filter: string,
19
19
  ) {
20
- console.log('CONSTRUCTOR GetUsersByIdsUseCase');
21
20
  this.usersRepository = usersRepository;
22
21
  this.currentPagination = currentPagination;
23
22
  this.filter = filter;
@@ -8,13 +8,11 @@ export class GetDialogByIdUseCase implements IUseCase<void, DialogEntity> {
8
8
  private readonly dialogId: string;
9
9
 
10
10
  constructor(dialogRepository: DialogsRepository, dialogId: string) {
11
- console.log('CONSTRUCTOR GetDialogByIdUseCase');
12
11
  this.dialogRepository = dialogRepository;
13
12
  this.dialogId = dialogId;
14
13
  }
15
14
 
16
15
  async execute(): Promise<DialogEntity> {
17
- console.log('execute GetAllDialogsUseCaseWithMock');
18
16
  const fromRemote: DialogEntity =
19
17
  await this.dialogRepository.getDialogFromRemote(this.dialogId);
20
18
 
@@ -8,14 +8,11 @@ export class GetUsersByIdsUseCase implements IUseCase<void, Array<UserEntity>> {
8
8
  private userIds: Array<number>;
9
9
 
10
10
  constructor(usersRepository: UsersRepository, userIds: Array<number>) {
11
- console.log('CONSTRUCTOR GetUsersByIdsUseCase');
12
11
  this.usersRepository = usersRepository;
13
12
  this.userIds = userIds;
14
13
  }
15
14
 
16
15
  execute(): Promise<Array<UserEntity>> {
17
- console.log('execute GetUsersByIdsUseCase');
18
-
19
16
  // return this.usersRepository.getUsersFromLocal(this.userIds);
20
17
  return this.usersRepository.getUsersFromRemote(this.userIds);
21
18
  }
@@ -36,7 +36,6 @@ export class LeaveDialogUseCase implements IUseCase<void, boolean> {
36
36
  leaveType: DialogLeaveTypeArcheType,
37
37
  textInformationMessage: string,
38
38
  ) {
39
- console.log('CONSTRUCTOR LeaveDialogUseCase');
40
39
  this.eventMessagesRepository = eventMessagesRepository;
41
40
  this.dialogRepository = dialogRepository;
42
41
  this.dialogToLeave = dialog;
@@ -30,7 +30,6 @@ export class RemoveUsersFromTheDialogUseCase
30
30
  usersIds: Array<number>,
31
31
  textInformationMessage: string,
32
32
  ) {
33
- console.log('CONSTRUCTOR LeaveDialogUseCase');
34
33
  this.eventMessagesRepository = eventMessagesRepository;
35
34
  this.dialogRepository = dialogRepository;
36
35
  this.dialogToLeave = dialog;
@@ -14,14 +14,12 @@ export class ReplyMessagesUseCase implements IUseCase<void, MessageEntity> {
14
14
  messagesToReply: MessageEntity[],
15
15
  relatedMessage: MessageEntity,
16
16
  ) {
17
- console.log('CONSTRUCTOR ReplyMessagesUseCase');
18
17
  this.messagesRepository = messagesRepository;
19
18
  this.relatedMessage = relatedMessage;
20
19
  this.messagesToReply = messagesToReply;
21
20
  }
22
21
 
23
22
  async execute(): Promise<MessageEntity> {
24
- console.log('execute ReplyMessagesUseCase');
25
23
  this.relatedMessage.qb_original_messages = this.messagesToReply;
26
24
  this.relatedMessage.qb_message_action = 'reply';
27
25
  this.relatedMessage.origin_sender_name =
@@ -11,14 +11,11 @@ export class SendTextMessageUseCase implements IUseCase<void, MessageEntity> {
11
11
  messagesRepository: MessagesRepository,
12
12
  messageToSend: MessageEntity,
13
13
  ) {
14
- console.log('CONSTRUCTOR SendTextMessageUseCase');
15
14
  this.messagesRepository = messagesRepository;
16
15
  this.messageToSend = messageToSend;
17
16
  }
18
17
 
19
18
  async execute(): Promise<MessageEntity> {
20
- console.log('execute SendTextMessageUseCase');
21
-
22
19
  const sentMessage: MessageEntity =
23
20
  await this.messagesRepository.sendMessageToRemote(this.messageToSend);
24
21
 
@@ -19,7 +19,6 @@ export class SubscribeToDialogEventsUseCase extends BaseUseCase<
19
19
  eventMessagesRepository: EventMessagesRepository,
20
20
  nameSubscription: string = SubscriptionPerformer.DEFAULT_SUBSCRIPTION_NAME,
21
21
  ) {
22
- console.log('CONSTRUCTOR SubscribeToDialogsUpdatesUseCaseWithMock');
23
22
  super();
24
23
  this.callBackExecute = undefined;
25
24
 
@@ -14,7 +14,6 @@ export class SubscribeToDialogsUpdatesUseCase extends BaseUseCase<
14
14
  private dialogs: Array<DialogEntity> = [];
15
15
 
16
16
  constructor(dialogRepository: DialogsRepository) {
17
- console.log('CONSTRUCTOR SubscribeToDialogsUpdatesUseCase');
18
17
  super();
19
18
  this.callBackExecute = undefined;
20
19
 
@@ -27,7 +27,6 @@ export class SyncDialogsUseCase extends BaseUseCase<boolean, boolean> {
27
27
  eventMessagesRepository: EventMessagesRepository,
28
28
  ) {
29
29
  super();
30
- console.log('CONSTRUCTOR SyncDialogsUseCaseWithMock');
31
30
  this.callBackExecute = undefined;
32
31
 
33
32
  this.dialogRepository = dialogRepository;
@@ -18,14 +18,12 @@ export class UpdateCurrentDialogInDataSourceUseCase
18
18
  updateDialog: GroupDialogEntity,
19
19
  qbConfig: QBUIKitConfig,
20
20
  ) {
21
- console.log('CONSTRUCTOR UpdateCurrentDialogInDataSourceUseCase');
22
21
  this.dialogRepository = dialogRepository;
23
22
  this.updateDialog = updateDialog;
24
23
  this.qbConfig = qbConfig;
25
24
  }
26
25
 
27
26
  async execute(): Promise<DialogEntity> {
28
- console.log('execute UpdateCurrentDialogInDataSourceUseCase');
29
27
  const result: DialogEntity =
30
28
  await this.dialogRepository.updateCurrentDialogInLocalDataSource(
31
29
  this.updateDialog,
@@ -22,7 +22,6 @@ export class UpdateDialogUseCase implements IUseCase<void, DialogEntity> {
22
22
  updateDialog: GroupDialogEntity,
23
23
  textInformationMessage: string,
24
24
  ) {
25
- console.log('CONSTRUCTOR UpdateDialogUseCase');
26
25
  this.dialogRepository = dialogRepository;
27
26
  this.updateDialog = updateDialog;
28
27
  this.eventMessagesRepository = eventMessagesRepository;
@@ -30,7 +29,6 @@ export class UpdateDialogUseCase implements IUseCase<void, DialogEntity> {
30
29
  }
31
30
 
32
31
  async execute(): Promise<DialogEntity> {
33
- console.log('execute UpdateDialogUseCase');
34
32
  const result: DialogEntity =
35
33
  await this.dialogRepository.updateDialogInRemote(this.updateDialog);
36
34
 
@@ -8,13 +8,11 @@ export class UploadFileUseCase implements IUseCase<void, FileEntity> {
8
8
  private fileEntity: FileEntity;
9
9
 
10
10
  constructor(fileRepository: FileRepository, fileEntity: FileEntity) {
11
- console.log('CONSTRUCTOR UploadFileUseCase');
12
11
  this.fileRepository = fileRepository;
13
12
  this.fileEntity = fileEntity;
14
13
  }
15
14
 
16
15
  async execute(): Promise<FileEntity> {
17
- console.log('execute UploadFileUseCase');
18
16
  const result: FileEntity = await this.fileRepository.saveFileInRemote(
19
17
  this.fileEntity,
20
18
  );
@@ -20,14 +20,12 @@ export class UserTypingMessageUseCase implements IUseCase<void, void> {
20
20
  dialog: DialogEntity,
21
21
  senderId: number,
22
22
  ) {
23
- console.log('CONSTRUCTOR SendUserIsTypingMessageUseCase');
24
23
  this.messagesRepository = messagesRepository;
25
24
  this.dialog = dialog;
26
25
  this.senderId = senderId;
27
26
  }
28
27
 
29
28
  async execute(): Promise<void> {
30
- console.log('execute SendUserIsTypingMessageUseCase');
31
29
  this._typingTime = Date.now();
32
30
  if (!this._typingTimer) {
33
31
  await this.messagesRepository.typingMessageStart(
@@ -27,7 +27,6 @@ export class AIAnswerAssistUseCase implements IUseCase<void, string> {
27
27
  sessionToken: string,
28
28
  openAIModel = 'gpt-3.5-turbo',
29
29
  ) {
30
- console.log('CONSTRUCTOR AIRephraseUseCase');
31
30
  this.api = api;
32
31
  this.openAIModel = openAIModel;
33
32
  this.port = port;
@@ -38,7 +37,6 @@ export class AIAnswerAssistUseCase implements IUseCase<void, string> {
38
37
  }
39
38
 
40
39
  async execute(): Promise<string> {
41
- console.log('execute AIRephraseUseCase');
42
40
  const settings =
43
41
  QBAIAnswerAssistant.createDefaultAIAnswerAssistantSettings();
44
42
 
@@ -27,7 +27,6 @@ export class AIAnswerAssistWithProxyUseCase implements IUseCase<void, string> {
27
27
  sessionToken: string,
28
28
  openAIModel = 'gpt-3.5-turbo',
29
29
  ) {
30
- console.log('CONSTRUCTOR AIRephraseUseCase');
31
30
  this.api = api;
32
31
  this.openAIModel = openAIModel;
33
32
  this.port = port;
@@ -38,8 +37,6 @@ export class AIAnswerAssistWithProxyUseCase implements IUseCase<void, string> {
38
37
  }
39
38
 
40
39
  async execute(): Promise<string> {
41
- console.log('execute AIRephraseUseCase');
42
-
43
40
  const settings =
44
41
  QBAIAnswerAssistant.createDefaultAIAnswerAssistantSettings();
45
42
 
@@ -22,7 +22,6 @@ export class AIAnswerAssistWithSDKUseCase implements IUseCase<void, string> {
22
22
  dataSource: IRemoteDataSource,
23
23
  smartChatAssistantId: string,
24
24
  ) {
25
- console.log('CONSTRUCTOR AIAnswerAssistWithSDKUseCase');
26
25
  this.textToSend = textToSend;
27
26
  this.dialogMessages = dialogMessages;
28
27
  this.dataSource = dataSource;
@@ -30,7 +29,6 @@ export class AIAnswerAssistWithSDKUseCase implements IUseCase<void, string> {
30
29
  }
31
30
 
32
31
  async execute(): Promise<string> {
33
- console.log('execute AIAnswerAssistWithSDKUseCase');
34
32
  const history: AIChatMessage[] = this.dialogMessages.map(
35
33
  (msg: IChatMessage) => {
36
34
  return {
@@ -31,7 +31,6 @@ export class AIRephraseUseCase implements IUseCase<void, string> {
31
31
  sessionToken: string,
32
32
  openAIModel = 'gpt-3.5-turbo',
33
33
  ) {
34
- console.log('CONSTRUCTOR AIRephraseUseCase');
35
34
  this.api = api;
36
35
  this.openAIModel = openAIModel;
37
36
  this.port = port;
@@ -43,7 +42,6 @@ export class AIRephraseUseCase implements IUseCase<void, string> {
43
42
  }
44
43
 
45
44
  async execute(): Promise<string> {
46
- console.log('execute AIRephraseUseCase');
47
45
 
48
46
  const settings = QBAIRephrase.createDefaultAIRephraseSettings();
49
47
 
@@ -31,7 +31,6 @@ export class AIRephraseWithProxyUseCase implements IUseCase<void, string> {
31
31
  sessionToken: string,
32
32
  openAIModel = 'gpt-3.5-turbo',
33
33
  ) {
34
- console.log('CONSTRUCTOR AIRephraseUseCase');
35
34
  this.api = api;
36
35
  this.openAIModel = openAIModel;
37
36
  this.port = port;
@@ -43,8 +42,6 @@ export class AIRephraseWithProxyUseCase implements IUseCase<void, string> {
43
42
  }
44
43
 
45
44
  async execute(): Promise<string> {
46
- console.log('execute AIRephraseUseCase');
47
-
48
45
  const settings = QBAIRephrase.createDefaultAIRephraseSettings();
49
46
 
50
47
  settings.token = this.sessionToken;