@hmcts/ccd-case-ui-toolkit 7.3.53-exui-2906-activity-tracker-14 → 7.3.53-exui-2906-activity-tracker-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.
@@ -11,7 +11,7 @@ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormArray, FormGroup, FormControl, Va
11
11
  import { BehaviorSubject, throwError, Subject, EMPTY, Observable, ReplaySubject, of, timer, skip, forkJoin, fromEvent, Subscription, combineLatest } from 'rxjs';
12
12
  import * as i1$2 from '@angular/common/http';
13
13
  import { HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
14
- import { distinctUntilChanged, catchError, filter, map, publish, refCount, delay, switchMap, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, take, debounceTime, first, takeUntil } from 'rxjs/operators';
14
+ import { distinctUntilChanged, catchError, filter, map, publish, refCount, delay, switchMap, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, take, debounceTime, first, takeUntil, skip as skip$1 } from 'rxjs/operators';
15
15
  import { connect } from 'socket.io-client';
16
16
  import { polling } from 'rx-polling-hmcts';
17
17
  import { Type, Exclude, Expose, plainToClassFromExist, plainToClass } from 'class-transformer';
@@ -2545,6 +2545,7 @@ class ActivitySocketService {
2545
2545
  if (!state.allowWebSockets || socket !== state.socket || state.owners.size === 0 || state.reconnectTimer) {
2546
2546
  return;
2547
2547
  }
2548
+ console.warn('Activity socket connection lost, scheduling reconnect...');
2548
2549
  state.reconnectTimer = setTimeout(() => {
2549
2550
  state.reconnectTimer = undefined;
2550
2551
  if (socket === state.socket && state.owners.size > 0 && !ActivitySocketService.isSocketActive(socket)) {
@@ -2557,7 +2558,9 @@ class ActivitySocketService {
2557
2558
  }
2558
2559
  static getReconnectDelayMs() {
2559
2560
  const delayRange = ACTIVITY_SOCKET_RECONNECT_DELAY_MAX_MS - ACTIVITY_SOCKET_RECONNECT_DELAY_MIN_MS + 1;
2560
- return ActivitySocketService.getCryptoRandomInt(delayRange) + ACTIVITY_SOCKET_RECONNECT_DELAY_MIN_MS;
2561
+ const randomDelay = ActivitySocketService.getCryptoRandomInt(delayRange) + ACTIVITY_SOCKET_RECONNECT_DELAY_MIN_MS;
2562
+ console.log(`Activity socket reconnect scheduled in ${randomDelay}ms`);
2563
+ return randomDelay;
2561
2564
  }
2562
2565
  // Returns an unbiased crypto-random integer from 0 inclusive to exclusiveMax exclusive.
2563
2566
  static getCryptoRandomInt(exclusiveMax) {
@@ -41734,6 +41737,7 @@ class SearchResultComponent {
41734
41737
  selectedCases = [];
41735
41738
  lastWatchedCaseIds = [];
41736
41739
  lastWatchedCaseIdsKey = null;
41740
+ socketConnectSubscription;
41737
41741
  alphabeticalCompare = (left, right) => left.localeCompare(right);
41738
41742
  constructor(searchResultViewItemComparatorFactory, appConfig, activityService, caseReferencePipe, placeholderService, browserService, sessionStorageService, activitySocketService) {
41739
41743
  this.activityService = activityService;
@@ -41756,8 +41760,14 @@ class SearchResultComponent {
41756
41760
  }
41757
41761
  this.sessionStorageService.removeItem('eventUrl');
41758
41762
  this.selection.emit(this.selectedCases);
41763
+ if (!isSolicitorUser(this.sessionStorageService)) {
41764
+ this.socketConnectSubscription = this.activitySocketService.connected
41765
+ .pipe(skip$1(1), distinctUntilChanged(), filter(connected => connected))
41766
+ .subscribe(() => this.watchResults(true));
41767
+ }
41759
41768
  }
41760
41769
  ngOnDestroy() {
41770
+ this.socketConnectSubscription?.unsubscribe();
41761
41771
  if (this.activitySocketService.isEnabled && this.lastWatchedCaseIdsKey !== null) {
41762
41772
  this.activitySocketService.stopAllCase(this.lastWatchedCaseIds, true);
41763
41773
  }
@@ -42048,11 +42058,11 @@ class SearchResultComponent {
42048
42058
  }
42049
42059
  }
42050
42060
  }
42051
- watchResults() {
42061
+ watchResults(force = false) {
42052
42062
  if (this.activitySocketService.isEnabled) {
42053
42063
  const caseIds = this.resultView?.results?.map(value => value.case_id) ?? [];
42054
42064
  const watchKey = [...caseIds].sort(this.alphabeticalCompare).join(',');
42055
- if (watchKey === this.lastWatchedCaseIdsKey) {
42065
+ if (!force && watchKey === this.lastWatchedCaseIdsKey) {
42056
42066
  return;
42057
42067
  }
42058
42068
  this.lastWatchedCaseIdsKey = watchKey;
@@ -42111,7 +42121,7 @@ class SearchResultComponent {
42111
42121
  }], sortHandler: [{
42112
42122
  type: Output
42113
42123
  }] }); })();
42114
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SearchResultComponent, { className: "SearchResultComponent", filePath: "lib/shared/components/search-result/search-result.component.ts", lineNumber: 20 }); })();
42124
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SearchResultComponent, { className: "SearchResultComponent", filePath: "lib/shared/components/search-result/search-result.component.ts", lineNumber: 22 }); })();
42115
42125
 
42116
42126
  class SearchResultModule {
42117
42127
  static ɵfac = function SearchResultModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SearchResultModule)(); };