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

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.
@@ -79,6 +79,9 @@ export declare class RemoteDataSource implements IRemoteDataSource {
79
79
  releaseEventsHandlers(): void;
80
80
  loginWithUser(authParams: LoginData): Promise<void>;
81
81
  private joinGroupDialog;
82
+ private startJoinRetryProcess;
83
+ private processDialogsInBackground;
84
+ private processDialogs;
82
85
  getDialogs(pagination?: Pagination): Promise<RemoteDialogsDTO>;
83
86
  createDialog(dto: RemoteDialogDTO): Promise<RemoteDialogDTO>;
84
87
  updateDialog(dto: RemoteDialogDTO): Promise<RemoteDialogDTO>;
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteDataSource.d.ts","sourceRoot":"","sources":["../../../../src/Data/source/remote/RemoteDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAgBL,aAAa,EACb,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAQnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAmBL,YAAY,EAWb,MAAM,uBAAuB,CAAC;AAU/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,EAAE,qBAAqB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AuDvB,kBAAkB,CACtB,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAsBV,iBAAiB,CACrB,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAUV,WAAW,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAoF7D,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IA+B1D,aAAa,CAEjB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,gBAAgB,CAAC;IA8BtB,aAAa,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCnD,UAAU,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAuCtD,OAAO,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAKnD,UAAU,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7C,+BAA+B,CAEnC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;CAGjB"}
package/dist/index-ui.js CHANGED
@@ -65939,6 +65939,7 @@ class RemoteDataSource {
65939
65939
  async joinGroupDialog(dialogId) {
65940
65940
  try {
65941
65941
  await QBJoinGroupDialog(dialogId).catch(() => {
65942
+ this.joinStatusMap.set(dialogId, false);
65942
65943
  throw new RemoteDataSourceException(INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_MESSAGE, INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_CODE);
65943
65944
  });
65944
65945
  this.joinStatusMap.set(dialogId, true);
@@ -65948,171 +65949,81 @@ class RemoteDataSource {
65948
65949
  this.joinStatusMap.set(dialogId, false);
65949
65950
  }
65950
65951
  }
65952
+ //version 0.5.0-beta.11,12,14
65953
+ startJoinRetryProcess() {
65954
+ if (this.joinCheckInterval)
65955
+ return;
65956
+ this.joinCheckInterval = setInterval(async () => {
65957
+ const dialogsToRetry = Array.from(this.joinStatusMap.entries())
65958
+ .filter(([_, isJoined]) => !isJoined)
65959
+ .map(([id]) => id);
65960
+ if (dialogsToRetry.length === 0) {
65961
+ clearInterval(this.joinCheckInterval);
65962
+ this.joinCheckInterval = null;
65963
+ console.log('All dialogs successfully joined. Stopping retry process.');
65964
+ return;
65965
+ }
65966
+ console.log(`Retrying join for ${dialogsToRetry.length} dialogs...`);
65967
+ await this.processDialogs(dialogsToRetry);
65968
+ }, 7000);
65969
+ }
65970
+ async processDialogsInBackground(dialogIds) {
65971
+ const BATCH_SIZE = 12;
65972
+ console.log(`Starting background processing for ${dialogIds.length} dialogs`);
65973
+ for (let i = 0; i < dialogIds.length; i += BATCH_SIZE) {
65974
+ const batch = dialogIds.slice(i, i + BATCH_SIZE);
65975
+ console.log(`Processing batch ${i / BATCH_SIZE + 1}:`, batch);
65976
+ await Promise.all(batch.map((id) => this.joinGroupDialog(id)));
65977
+ console.log(`Batch ${i / BATCH_SIZE + 1} completed.`);
65978
+ await new Promise((resolve) => setTimeout(resolve, 1500));
65979
+ }
65980
+ console.log('Background processing complete.');
65981
+ }
65982
+ async processDialogs(dialogIds) {
65983
+ await Promise.all(dialogIds.map((id) => this.joinGroupDialog(id)));
65984
+ }
65951
65985
  async getDialogs(pagination) {
65952
65986
  let currentPagination = pagination || new Pagination();
65953
- console.log('call getDialogs in RemoteDataSourceMock param pagination: ', JSON.stringify(pagination));
65954
- console.log('call getDialogs in RemoteDataSourceMock with result pagination: ', JSON.stringify(currentPagination));
65955
65987
  const pageNumber = currentPagination.getCurrentPage() || 1;
65956
- console.log('pageNumber: ', pageNumber);
65957
65988
  const perPage = currentPagination.perPage || 100;
65958
- console.log('perPage: ', perPage);
65959
65989
  const params = {
65960
- created_at: {
65961
- lt: Date.now() / 1000,
65962
- },
65963
- // sort_desc: 'created_at',// artan 19.0.2024
65990
+ created_at: { lt: Date.now() / 1000 },
65964
65991
  sort_desc: 'updated_at',
65965
65992
  page: pageNumber,
65966
- // per_page: perPage,
65967
65993
  limit: perPage,
65968
- type: {
65969
- in: [2, 3],
65970
- },
65994
+ type: { in: [2, 3] },
65971
65995
  };
65972
- // filter['type[in]'] = [3, 2].join(',');
65973
- console.log('call getDialogs in RemoteDataSourceMock with params: ', JSON.stringify(params));
65974
65996
  const dialogsDTO = [];
65997
+ const joinDialogIds = [];
65975
65998
  const qbDialogs = await QBGetDialogs(params);
65976
65999
  if (qbDialogs) {
65977
- console.log(`request completed. have: total_entries ${qbDialogs.total_entries}, limit: ${qbDialogs.limit}, skip: ${qbDialogs.skip} items: ${JSON.stringify(qbDialogs.items)}`);
65978
66000
  currentPagination = new Pagination(0, perPage);
65979
66001
  currentPagination.totalPages = qbDialogs.total_entries / perPage;
65980
66002
  currentPagination.setCurrentPage(pageNumber);
65981
- // eslint-disable-next-line no-restricted-syntax
65982
66003
  for (const item of qbDialogs.items) {
65983
66004
  const qbEntity = item;
65984
- if (!qbEntity) {
66005
+ if (!qbEntity)
65985
66006
  continue;
65986
- }
65987
- const newDTO =
65988
- // eslint-disable-next-line no-await-in-loop
65989
- await this.getCurrentDialogDTOMapper().toTDO(qbEntity);
65990
- if (newDTO.type === DialogType.group) {
65991
- // eslint-disable-next-line no-await-in-loop
66007
+ const newDTO = await this.getCurrentDialogDTOMapper().toTDO(qbEntity);
66008
+ if (newDTO.type === DialogType.group && !this.processedDialogs.has(newDTO.id)) {
66009
+ this.processedDialogs.add(newDTO.id);
65992
66010
  if (!this.joinStatusMap.has(newDTO.id)) {
65993
- await this.joinGroupDialog(newDTO.id);
66011
+ this.joinStatusMap.set(newDTO.id, false);
66012
+ joinDialogIds.push(newDTO.id);
65994
66013
  }
65995
- // await QBJoinGroupDialog(newDTO.id).catch((reason) => {
65996
- // console.log('getDialogs. QBJoinGroupDialog error', reason);
65997
- // throw new RemoteDataSourceException(
65998
- // INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_MESSAGE,
65999
- // INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_CODE,
66000
- // );
66001
- // });
66002
66014
  }
66003
- //
66004
- // const currentUserId = this._authInformation?.userId || 0;
66005
- // const statusMessageParams: QBMessageStatusParams = {
66006
- // userId: newDTO.lastMessageUserId || currentUserId,
66007
- // dialogId: newDTO.id,
66008
- // messageId: newDTO.lastMessageId,
66009
- // };
66010
- //
66011
- // // eslint-disable-next-line @typescript-eslint/no-unsafe-call
66012
- // QBChatMarkMessageDelivered(statusMessageParams);
66013
66015
  dialogsDTO.push(newDTO);
66014
66016
  }
66017
+ const firstBatch = joinDialogIds.slice(0, 24);
66018
+ await this.processDialogs(firstBatch);
66019
+ const remainingDialogs = joinDialogIds.slice(24);
66020
+ if (remainingDialogs.length) {
66021
+ await this.processDialogsInBackground(remainingDialogs);
66022
+ this.startJoinRetryProcess();
66023
+ }
66015
66024
  }
66016
66025
  return Promise.resolve(new RemoteDialogsDTO(dialogsDTO, currentPagination));
66017
66026
  }
66018
- //version 0.5.0-beta.11 - 12
66019
- // private startJoinRetryProcess(): void {
66020
- // if (this.joinCheckInterval) return; // Избегаем дублирования таймера
66021
- //
66022
- // this.joinCheckInterval = setInterval(async () => {
66023
- // const dialogsToRetry = Array.from(this.joinStatusMap.entries())
66024
- // .filter(([_, isJoined]) => !isJoined) // Только неприсоединённые
66025
- // .map(([id]) => id);
66026
- //
66027
- // if (dialogsToRetry.length === 0) {
66028
- // clearInterval(this.joinCheckInterval!);
66029
- // this.joinCheckInterval = null;
66030
- // console.log('All dialogs successfully joined. Stopping retry process.');
66031
- // return;
66032
- // }
66033
- //
66034
- // console.log(`Retrying join for ${dialogsToRetry.length} dialogs...`);
66035
- // await this.processDialogs(dialogsToRetry);
66036
- // }, 7000);
66037
- // }
66038
- //
66039
- // private async processDialogsInBackground(dialogIds: string[]): Promise<void> {
66040
- // const BATCH_SIZE = 12;
66041
- //
66042
- // console.log(`Starting background processing for ${dialogIds.length} dialogs`);
66043
- //
66044
- // for (let i = 0; i < dialogIds.length; i += BATCH_SIZE) {
66045
- // const batch = dialogIds.slice(i, i + BATCH_SIZE);
66046
- //
66047
- // console.log(`Processing batch ${i / BATCH_SIZE + 1}:`, batch);
66048
- //
66049
- // await Promise.all(batch.map((id) => this.joinGroupDialog(id)));
66050
- // console.log(`Batch ${i / BATCH_SIZE + 1} completed.`);
66051
- //
66052
- // await new Promise((resolve) => setTimeout(resolve, 1500));
66053
- // }
66054
- //
66055
- // console.log('Background processing complete.');
66056
- // }
66057
- //
66058
- // private async processDialogs(dialogIds: string[]): Promise<void> {
66059
- // await Promise.all(dialogIds.map((id) => this.joinGroupDialog(id)));
66060
- // }
66061
- //
66062
- // async getDialogs(pagination?: Pagination): Promise<RemoteDialogsDTO> {
66063
- // let currentPagination: Pagination = pagination || new Pagination();
66064
- //
66065
- // const pageNumber = currentPagination.getCurrentPage() || 1;
66066
- // const perPage = currentPagination.perPage || 100;
66067
- //
66068
- // const params = {
66069
- // created_at: { lt: Date.now() / 1000 },
66070
- // sort_desc: 'updated_at',
66071
- // page: pageNumber,
66072
- // limit: perPage,
66073
- // type: { in: [2, 3] },
66074
- // };
66075
- //
66076
- // const dialogsDTO: Array<RemoteDialogDTO> = [];
66077
- // const joinDialogIds: string[] = [];
66078
- // const qbDialogs: QBGetDialogResult | undefined = await QBGetDialogs(params);
66079
- //
66080
- // if (qbDialogs) {
66081
- // currentPagination = new Pagination(0, perPage);
66082
- // currentPagination.totalPages = qbDialogs.total_entries / perPage;
66083
- // currentPagination.setCurrentPage(pageNumber);
66084
- //
66085
- // for (const item of qbDialogs.items) {
66086
- // const qbEntity: QBChatDialog = item;
66087
- // if (!qbEntity) continue;
66088
- //
66089
- // const newDTO: RemoteDialogDTO = await this.getCurrentDialogDTOMapper().toTDO(qbEntity);
66090
- //
66091
- // if (newDTO.type === DialogType.group && !this.processedDialogs.has(newDTO.id)) {
66092
- // this.processedDialogs.add(newDTO.id);
66093
- //
66094
- // // Если уже есть в Map — пропускаем, иначе добавляем в joinDialogIds
66095
- // if (!this.joinStatusMap.has(newDTO.id)) {
66096
- // this.joinStatusMap.set(newDTO.id, false);
66097
- // joinDialogIds.push(newDTO.id);
66098
- // }
66099
- // }
66100
- //
66101
- // dialogsDTO.push(newDTO);
66102
- // }
66103
- //
66104
- // const firstBatch = joinDialogIds.slice(0, 12);
66105
- // await this.processDialogs(firstBatch);
66106
- //
66107
- // const remainingDialogs = joinDialogIds.slice(12);
66108
- // if (remainingDialogs.length) {
66109
- // await this.processDialogsInBackground(remainingDialogs);
66110
- // this.startJoinRetryProcess();
66111
- // }
66112
- // }
66113
- //
66114
- // return Promise.resolve(new RemoteDialogsDTO(dialogsDTO, currentPagination));
66115
- // }
66116
66027
  //tested in 0.5.0-beta.10
66117
66028
  // private async processDialogs(dialogIds: string[]): Promise<void> {
66118
66029
  // await Promise.all(dialogIds.map((id) => this.joinGroupDialog(id)));
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.14",
4
4
  "main": "dist/index-ui.js",
5
5
  "types": "dist/index-ui.d.ts",
6
6
  "license": "MIT",
@@ -913,6 +913,7 @@ export class RemoteDataSource implements IRemoteDataSource {
913
913
  private async joinGroupDialog(dialogId: string): Promise<void> {
914
914
  try {
915
915
  await QBJoinGroupDialog(dialogId).catch(() => {
916
+ this.joinStatusMap.set(dialogId, false);
916
917
  throw new RemoteDataSourceException(
917
918
  INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_MESSAGE,
918
919
  INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_CODE,
@@ -925,198 +926,104 @@ export class RemoteDataSource implements IRemoteDataSource {
925
926
  }
926
927
  }
927
928
 
929
+ //version 0.5.0-beta.11,12,14
930
+ private startJoinRetryProcess(): void {
931
+ if (this.joinCheckInterval) return;
932
+
933
+ this.joinCheckInterval = setInterval(async () => {
934
+ const dialogsToRetry = Array.from(this.joinStatusMap.entries())
935
+ .filter(([_, isJoined]) => !isJoined)
936
+ .map(([id]) => id);
937
+
938
+ if (dialogsToRetry.length === 0) {
939
+ clearInterval(this.joinCheckInterval!);
940
+ this.joinCheckInterval = null;
941
+ console.log('All dialogs successfully joined. Stopping retry process.');
942
+ return;
943
+ }
944
+
945
+ console.log(`Retrying join for ${dialogsToRetry.length} dialogs...`);
946
+ await this.processDialogs(dialogsToRetry);
947
+ }, 7000);
948
+ }
949
+
950
+ private async processDialogsInBackground(dialogIds: string[]): Promise<void> {
951
+ const BATCH_SIZE = 12;
952
+
953
+ console.log(`Starting background processing for ${dialogIds.length} dialogs`);
954
+
955
+ for (let i = 0; i < dialogIds.length; i += BATCH_SIZE) {
956
+ const batch = dialogIds.slice(i, i + BATCH_SIZE);
957
+
958
+ console.log(`Processing batch ${i / BATCH_SIZE + 1}:`, batch);
959
+
960
+ await Promise.all(batch.map((id) => this.joinGroupDialog(id)));
961
+ console.log(`Batch ${i / BATCH_SIZE + 1} completed.`);
962
+
963
+ await new Promise((resolve) => setTimeout(resolve, 1500));
964
+ }
965
+
966
+ console.log('Background processing complete.');
967
+ }
968
+
969
+ private async processDialogs(dialogIds: string[]): Promise<void> {
970
+ await Promise.all(dialogIds.map((id) => this.joinGroupDialog(id)));
971
+ }
972
+
928
973
  async getDialogs(pagination?: Pagination): Promise<RemoteDialogsDTO> {
929
974
  let currentPagination: Pagination = pagination || new Pagination();
930
975
 
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
976
  const pageNumber = currentPagination.getCurrentPage() || 1;
940
-
941
- console.log('pageNumber: ', pageNumber);
942
977
  const perPage = currentPagination.perPage || 100;
943
978
 
944
- console.log('perPage: ', perPage);
945
979
  const params = {
946
- created_at: {
947
- lt: Date.now() / 1000,
948
- },
949
- // sort_desc: 'created_at',// artan 19.0.2024
980
+ created_at: { lt: Date.now() / 1000 },
950
981
  sort_desc: 'updated_at',
951
982
  page: pageNumber,
952
- // per_page: perPage,
953
983
  limit: perPage,
954
- type: {
955
- in: [2, 3],
956
- },
984
+ type: { in: [2, 3] },
957
985
  };
958
- // filter['type[in]'] = [3, 2].join(',');
959
986
 
960
- console.log(
961
- 'call getDialogs in RemoteDataSourceMock with params: ',
962
- JSON.stringify(params),
963
- );
964
987
  const dialogsDTO: Array<RemoteDialogDTO> = [];
988
+ const joinDialogIds: string[] = [];
965
989
  const qbDialogs: QBGetDialogResult | undefined = await QBGetDialogs(params);
966
990
 
967
991
  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
992
  currentPagination = new Pagination(0, perPage);
976
993
  currentPagination.totalPages = qbDialogs.total_entries / perPage;
977
994
  currentPagination.setCurrentPage(pageNumber);
978
995
 
979
- // eslint-disable-next-line no-restricted-syntax
980
996
  for (const item of qbDialogs.items) {
981
997
  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);
998
+ if (!qbEntity) continue;
999
+
1000
+ const newDTO: RemoteDialogDTO = await this.getCurrentDialogDTOMapper().toTDO(qbEntity);
1001
+
1002
+ if (newDTO.type === DialogType.group && !this.processedDialogs.has(newDTO.id)) {
1003
+ this.processedDialogs.add(newDTO.id);
988
1004
 
989
- if (newDTO.type === DialogType.group) {
990
- // eslint-disable-next-line no-await-in-loop
991
1005
  if (!this.joinStatusMap.has(newDTO.id)) {
992
- await this.joinGroupDialog(newDTO.id);
1006
+ this.joinStatusMap.set(newDTO.id, false);
1007
+ joinDialogIds.push(newDTO.id);
993
1008
  }
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
1009
  }
1002
1010
 
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
1011
  dialogsDTO.push(newDTO);
1015
1012
  }
1013
+
1014
+ const firstBatch = joinDialogIds.slice(0, 24);
1015
+ await this.processDialogs(firstBatch);
1016
+
1017
+ const remainingDialogs = joinDialogIds.slice(24);
1018
+ if (remainingDialogs.length) {
1019
+ await this.processDialogsInBackground(remainingDialogs);
1020
+ this.startJoinRetryProcess();
1021
+ }
1016
1022
  }
1017
1023
 
1018
1024
  return Promise.resolve(new RemoteDialogsDTO(dialogsDTO, currentPagination));
1019
1025
  }
1020
1026
 
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
1027
  //tested in 0.5.0-beta.10
1121
1028
  // private async processDialogs(dialogIds: string[]): Promise<void> {
1122
1029
  // await Promise.all(dialogIds.map((id) => this.joinGroupDialog(id)));
@@ -1 +1 @@
1
- {"generatedAt":1742826292514,"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.2.0","@testing-library/user-event":null,"@types/jest":"27.5.2"},"hasRouterPackage":true,"packageManager":{"type":"npm","version":"10.2.4"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-webpack5","options":{}},"builder":"@storybook/builder-webpack5","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":2,"storybookVersion":"8.6.4","storybookVersionSpecifier":"^8.5.8","language":"typescript","storybookPackages":{"@storybook/blocks":{"version":"8.6.4"},"@storybook/react":{"version":"8.6.4"},"@storybook/react-webpack5":{"version":"8.6.4"},"@storybook/test":{"version":"8.6.4"},"eslint-plugin-storybook":{"version":"0.11.4"},"storybook":{"version":"8.6.4"}},"addons":{"@storybook/addon-webpack5-compiler-swc":{"version":"2.1.0"},"@storybook/addon-onboarding":{"version":"8.6.4"},"@storybook/addon-essentials":{"version":"8.6.4"},"@chromatic-com/storybook":{"version":"3.2.5"},"@storybook/addon-interactions":{"version":"8.6.4"}}}
1
+ {"generatedAt":1742828004982,"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.2.0","@testing-library/user-event":null,"@types/jest":"27.5.2"},"hasRouterPackage":true,"packageManager":{"type":"npm","version":"10.2.4"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-webpack5","options":{}},"builder":"@storybook/builder-webpack5","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":2,"storybookVersion":"8.6.4","storybookVersionSpecifier":"^8.5.8","language":"typescript","storybookPackages":{"@storybook/blocks":{"version":"8.6.4"},"@storybook/react":{"version":"8.6.4"},"@storybook/react-webpack5":{"version":"8.6.4"},"@storybook/test":{"version":"8.6.4"},"eslint-plugin-storybook":{"version":"0.11.4"},"storybook":{"version":"8.6.4"}},"addons":{"@storybook/addon-webpack5-compiler-swc":{"version":"2.1.0"},"@storybook/addon-onboarding":{"version":"8.6.4"},"@storybook/addon-essentials":{"version":"8.6.4"},"@chromatic-com/storybook":{"version":"3.2.5"},"@storybook/addon-interactions":{"version":"8.6.4"}}}