@hmcts/ccd-case-ui-toolkit 7.2.54-3455-rc1 → 7.2.54-3455-rc2
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, skip, of, combineLatest, timer, forkJoin, fromEvent, Subscription } 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, map, publish, refCount, switchMap, debounceTime, take, delay, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, first,
|
|
14
|
+
import { distinctUntilChanged, catchError, map, publish, refCount, switchMap, debounceTime, take, delay, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, first, takeUntil, filter } from 'rxjs/operators';
|
|
15
15
|
import { polling } from 'rx-polling-hmcts';
|
|
16
16
|
import { Type, Exclude, Expose, plainToClassFromExist, plainToClass } from 'class-transformer';
|
|
17
17
|
import moment from 'moment';
|
|
@@ -9252,9 +9252,6 @@ class CaseEditComponent {
|
|
|
9252
9252
|
error;
|
|
9253
9253
|
callbackErrorsSubject = new Subject();
|
|
9254
9254
|
validPageList = [];
|
|
9255
|
-
pageRefreshAcknowledged = false;
|
|
9256
|
-
backButtonDuringRefresh = false;
|
|
9257
|
-
backSubscription;
|
|
9258
9255
|
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService, alertService, abstractConfig, cookieService) {
|
|
9259
9256
|
this.fb = fb;
|
|
9260
9257
|
this.caseNotifier = caseNotifier;
|
|
@@ -9279,9 +9276,7 @@ class CaseEditComponent {
|
|
|
9279
9276
|
this.wizard = this.wizardFactory.create(this.eventTrigger);
|
|
9280
9277
|
this.initialUrl = this.sessionStorageService.getItem('eventUrl');
|
|
9281
9278
|
this.isPageRefreshed = JSON.parse(this.sessionStorageService.getItem('isPageRefreshed'));
|
|
9282
|
-
|
|
9283
|
-
this.monitorBackButtonDuringRefresh();
|
|
9284
|
-
void this.checkPageRefresh();
|
|
9279
|
+
this.checkPageRefresh();
|
|
9285
9280
|
this.form = this.fb.group({
|
|
9286
9281
|
data: new FormGroup({}),
|
|
9287
9282
|
event: this.fb.group({
|
|
@@ -9299,36 +9294,12 @@ class CaseEditComponent {
|
|
|
9299
9294
|
if (this.callbackErrorsSubject) {
|
|
9300
9295
|
this.callbackErrorsSubject.unsubscribe();
|
|
9301
9296
|
}
|
|
9302
|
-
this.backSubscription?.unsubscribe();
|
|
9303
9297
|
}
|
|
9304
|
-
|
|
9305
|
-
if (!this.router?.events) {
|
|
9306
|
-
return;
|
|
9307
|
-
}
|
|
9308
|
-
this.backSubscription = this.router.events
|
|
9309
|
-
.pipe(filter(e => e instanceof NavigationStart && e.navigationTrigger === 'popstate'))
|
|
9310
|
-
.subscribe(() => {
|
|
9311
|
-
if (this.isPageRefreshed && !this.pageRefreshAcknowledged) {
|
|
9312
|
-
this.backButtonDuringRefresh = true;
|
|
9313
|
-
}
|
|
9314
|
-
});
|
|
9315
|
-
}
|
|
9316
|
-
async checkPageRefresh() {
|
|
9317
|
-
const targetUrl = this.initialUrl; // keep before removal
|
|
9318
|
-
this.pageRefreshAcknowledged = false;
|
|
9298
|
+
checkPageRefresh() {
|
|
9319
9299
|
if (this.isPageRefreshed && this.initialUrl) {
|
|
9320
9300
|
this.sessionStorageService.removeItem('eventUrl');
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
// force forward to target
|
|
9324
|
-
this.router.navigateByUrl(targetUrl, { replaceUrl: true });
|
|
9325
|
-
};
|
|
9326
|
-
window.addEventListener('popstate', blockPopstate, { once: true });
|
|
9327
|
-
await this.windowsService.alert(CaseEditComponent.ALERT_MESSAGE);
|
|
9328
|
-
this.pageRefreshAcknowledged = true;
|
|
9329
|
-
this.backButtonDuringRefresh = false;
|
|
9330
|
-
await this.router.navigateByUrl(targetUrl, { replaceUrl: true });
|
|
9331
|
-
window.removeEventListener('popstate', blockPopstate);
|
|
9301
|
+
this.windowsService.alert(CaseEditComponent.ALERT_MESSAGE);
|
|
9302
|
+
this.router.navigate([this.initialUrl], { relativeTo: this.route });
|
|
9332
9303
|
return true;
|
|
9333
9304
|
}
|
|
9334
9305
|
// if the url contains /submit there is the potential that the user has gone straight to the submit page
|
|
@@ -9336,9 +9307,10 @@ class CaseEditComponent {
|
|
|
9336
9307
|
if (this.router.url.indexOf('/submit') !== -1 && !this.initialUrl) {
|
|
9337
9308
|
// we only want to check if the user has done this if there is a multi-page journey
|
|
9338
9309
|
if (this.eventTrigger.wizard_pages && this.eventTrigger.wizard_pages.length > 0) {
|
|
9310
|
+
console.log('User has navigated to the end of an event journey directly, reset their journey');
|
|
9339
9311
|
const firstPage = this.eventTrigger.wizard_pages.reduce((min, page) => page.order < min.order ? page : min, this.eventTrigger.wizard_pages[0]);
|
|
9340
|
-
|
|
9341
|
-
|
|
9312
|
+
this.windowsService.alert(CaseEditComponent.ALERT_MESSAGE);
|
|
9313
|
+
this.router.navigate([firstPage ? firstPage.id : 'submit'], { relativeTo: this.route });
|
|
9342
9314
|
}
|
|
9343
9315
|
}
|
|
9344
9316
|
return false;
|
|
@@ -9432,7 +9404,7 @@ class CaseEditComponent {
|
|
|
9432
9404
|
}
|
|
9433
9405
|
const eventId = this.getEventId(form);
|
|
9434
9406
|
const caseId = this.getCaseId(caseDetails);
|
|
9435
|
-
const userId = userInfo
|
|
9407
|
+
const userId = userInfo.id ? userInfo.id : userInfo.uid;
|
|
9436
9408
|
const eventDetails = { eventId, caseId, userId, assignNeeded };
|
|
9437
9409
|
if (this.taskExistsForThisEvent(taskInSessionStorage, taskEventCompletionInfo, eventDetails)) {
|
|
9438
9410
|
this.abstractConfig.logMessage(`task exist for this event for caseId and eventId as ${caseId} ${eventId}`);
|