@hmcts/ccd-case-ui-toolkit 7.2.54-3455-rc1 → 7.2.54-3455-rc3
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';
|
|
@@ -7956,8 +7956,7 @@ class WindowService {
|
|
|
7956
7956
|
return window.confirm(message);
|
|
7957
7957
|
}
|
|
7958
7958
|
alert(message) {
|
|
7959
|
-
window.alert(message);
|
|
7960
|
-
return Promise.resolve();
|
|
7959
|
+
return window.alert(message);
|
|
7961
7960
|
}
|
|
7962
7961
|
static ɵfac = function WindowService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || WindowService)(); };
|
|
7963
7962
|
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: WindowService, factory: WindowService.ɵfac });
|
|
@@ -9252,9 +9251,6 @@ class CaseEditComponent {
|
|
|
9252
9251
|
error;
|
|
9253
9252
|
callbackErrorsSubject = new Subject();
|
|
9254
9253
|
validPageList = [];
|
|
9255
|
-
pageRefreshAcknowledged = false;
|
|
9256
|
-
backButtonDuringRefresh = false;
|
|
9257
|
-
backSubscription;
|
|
9258
9254
|
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService, alertService, abstractConfig, cookieService) {
|
|
9259
9255
|
this.fb = fb;
|
|
9260
9256
|
this.caseNotifier = caseNotifier;
|
|
@@ -9279,9 +9275,7 @@ class CaseEditComponent {
|
|
|
9279
9275
|
this.wizard = this.wizardFactory.create(this.eventTrigger);
|
|
9280
9276
|
this.initialUrl = this.sessionStorageService.getItem('eventUrl');
|
|
9281
9277
|
this.isPageRefreshed = JSON.parse(this.sessionStorageService.getItem('isPageRefreshed'));
|
|
9282
|
-
|
|
9283
|
-
this.monitorBackButtonDuringRefresh();
|
|
9284
|
-
void this.checkPageRefresh();
|
|
9278
|
+
this.checkPageRefresh();
|
|
9285
9279
|
this.form = this.fb.group({
|
|
9286
9280
|
data: new FormGroup({}),
|
|
9287
9281
|
event: this.fb.group({
|
|
@@ -9299,36 +9293,12 @@ class CaseEditComponent {
|
|
|
9299
9293
|
if (this.callbackErrorsSubject) {
|
|
9300
9294
|
this.callbackErrorsSubject.unsubscribe();
|
|
9301
9295
|
}
|
|
9302
|
-
this.backSubscription?.unsubscribe();
|
|
9303
9296
|
}
|
|
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;
|
|
9297
|
+
checkPageRefresh() {
|
|
9319
9298
|
if (this.isPageRefreshed && this.initialUrl) {
|
|
9320
9299
|
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);
|
|
9300
|
+
this.windowsService.alert(CaseEditComponent.ALERT_MESSAGE);
|
|
9301
|
+
this.router.navigate([this.initialUrl], { relativeTo: this.route });
|
|
9332
9302
|
return true;
|
|
9333
9303
|
}
|
|
9334
9304
|
// if the url contains /submit there is the potential that the user has gone straight to the submit page
|
|
@@ -9336,9 +9306,10 @@ class CaseEditComponent {
|
|
|
9336
9306
|
if (this.router.url.indexOf('/submit') !== -1 && !this.initialUrl) {
|
|
9337
9307
|
// we only want to check if the user has done this if there is a multi-page journey
|
|
9338
9308
|
if (this.eventTrigger.wizard_pages && this.eventTrigger.wizard_pages.length > 0) {
|
|
9309
|
+
console.log('User has navigated to the end of an event journey directly, reset their journey');
|
|
9339
9310
|
const firstPage = this.eventTrigger.wizard_pages.reduce((min, page) => page.order < min.order ? page : min, this.eventTrigger.wizard_pages[0]);
|
|
9340
|
-
|
|
9341
|
-
|
|
9311
|
+
this.windowsService.alert(CaseEditComponent.ALERT_MESSAGE);
|
|
9312
|
+
this.router.navigate([firstPage ? firstPage.id : 'submit'], { relativeTo: this.route });
|
|
9342
9313
|
}
|
|
9343
9314
|
}
|
|
9344
9315
|
return false;
|
|
@@ -9432,7 +9403,7 @@ class CaseEditComponent {
|
|
|
9432
9403
|
}
|
|
9433
9404
|
const eventId = this.getEventId(form);
|
|
9434
9405
|
const caseId = this.getCaseId(caseDetails);
|
|
9435
|
-
const userId = userInfo
|
|
9406
|
+
const userId = userInfo.id ? userInfo.id : userInfo.uid;
|
|
9436
9407
|
const eventDetails = { eventId, caseId, userId, assignNeeded };
|
|
9437
9408
|
if (this.taskExistsForThisEvent(taskInSessionStorage, taskEventCompletionInfo, eventDetails)) {
|
|
9438
9409
|
this.abstractConfig.logMessage(`task exist for this event for caseId and eventId as ${caseId} ${eventId}`);
|