@hmcts/ccd-case-ui-toolkit 6.16.2-ccpay-upgrade → 6.18.0-restricted-case-access
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.
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +120 -25
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
- package/esm2015/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.js +24 -12
- package/esm2015/lib/shared/components/case-viewer/services/case.resolver.js +10 -6
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js +32 -16
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +12 -3
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
- package/lib/shared/components/case-viewer/services/case.resolver.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -9227,7 +9227,7 @@ class CaseEditPageComponent {
|
|
|
9227
9227
|
this.wizard = this.caseEdit.wizard;
|
|
9228
9228
|
this.caseFields = this.getCaseFields();
|
|
9229
9229
|
this.syncCaseEditDataService();
|
|
9230
|
-
this.route.params
|
|
9230
|
+
this.routeParamsSub = this.route.params
|
|
9231
9231
|
.subscribe(params => {
|
|
9232
9232
|
var _a, _b;
|
|
9233
9233
|
const pageId = params['page'];
|
|
@@ -9249,13 +9249,14 @@ class CaseEditPageComponent {
|
|
|
9249
9249
|
}
|
|
9250
9250
|
});
|
|
9251
9251
|
CaseEditPageComponent.setFocusToTop();
|
|
9252
|
-
this.caseEditDataService.caseEditForm$.subscribe({
|
|
9252
|
+
this.caseEditFormSub = this.caseEditDataService.caseEditForm$.subscribe({
|
|
9253
9253
|
next: editForm => this.editForm = editForm
|
|
9254
9254
|
});
|
|
9255
|
-
this.
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9255
|
+
this.caseIsLinkedCasesJourneyAtFinalStepSub =
|
|
9256
|
+
this.caseEditDataService.caseIsLinkedCasesJourneyAtFinalStep$.subscribe({
|
|
9257
|
+
next: isLinkedCasesJourneyAtFinalStep => this.isLinkedCasesJourneyAtFinalStep = isLinkedCasesJourneyAtFinalStep
|
|
9258
|
+
});
|
|
9259
|
+
this.caseTriggerSubmitEventSub = this.caseEditDataService.caseTriggerSubmitEvent$.subscribe({
|
|
9259
9260
|
next: state => {
|
|
9260
9261
|
if (state) {
|
|
9261
9262
|
this.caseEditDataService.setTriggerSubmitEvent(false);
|
|
@@ -9268,6 +9269,17 @@ class CaseEditPageComponent {
|
|
|
9268
9269
|
ngAfterViewChecked() {
|
|
9269
9270
|
this.cdRef.detectChanges();
|
|
9270
9271
|
}
|
|
9272
|
+
ngOnDestroy() {
|
|
9273
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9274
|
+
(_a = this.routeParamsSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
9275
|
+
(_b = this.caseEditFormSub) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
9276
|
+
(_c = this.caseIsLinkedCasesJourneyAtFinalStepSub) === null || _c === void 0 ? void 0 : _c.unsubscribe();
|
|
9277
|
+
(_d = this.caseTriggerSubmitEventSub) === null || _d === void 0 ? void 0 : _d.unsubscribe();
|
|
9278
|
+
(_e = this.validateSub) === null || _e === void 0 ? void 0 : _e.unsubscribe();
|
|
9279
|
+
(_f = this.dialogRefAfterClosedSub) === null || _f === void 0 ? void 0 : _f.unsubscribe();
|
|
9280
|
+
(_g = this.saveDraftSub) === null || _g === void 0 ? void 0 : _g.unsubscribe();
|
|
9281
|
+
(_h = this.caseFormValidationErrorsSub) === null || _h === void 0 ? void 0 : _h.unsubscribe();
|
|
9282
|
+
}
|
|
9271
9283
|
applyValuesChanged(valuesChanged) {
|
|
9272
9284
|
this.formValuesChanged = valuesChanged;
|
|
9273
9285
|
}
|
|
@@ -9341,7 +9353,7 @@ class CaseEditPageComponent {
|
|
|
9341
9353
|
this.generateErrorMessage(casefield.field_type.collection_field_type.complex_fields, c.get('value'), id);
|
|
9342
9354
|
});
|
|
9343
9355
|
}
|
|
9344
|
-
else if (FieldsUtils.
|
|
9356
|
+
else if (FieldsUtils.isCaseFieldOfType(casefield, ['FlagLauncher'])) {
|
|
9345
9357
|
// Check whether the case field DisplayContextParameter is signalling "create" mode or "update" mode
|
|
9346
9358
|
// (expected always to be one of the two), to set the correct error message
|
|
9347
9359
|
let action = '';
|
|
@@ -9395,7 +9407,7 @@ class CaseEditPageComponent {
|
|
|
9395
9407
|
this.caseEdit.error = null;
|
|
9396
9408
|
const caseEventData = this.buildCaseEventData();
|
|
9397
9409
|
const loadingSpinnerToken = this.loadingService.register();
|
|
9398
|
-
this.caseEdit.validate(caseEventData, this.currentPage.id)
|
|
9410
|
+
this.validateSub = this.caseEdit.validate(caseEventData, this.currentPage.id)
|
|
9399
9411
|
.pipe(finalize(() => {
|
|
9400
9412
|
this.loadingService.unregister(loadingSpinnerToken);
|
|
9401
9413
|
}))
|
|
@@ -9495,7 +9507,7 @@ class CaseEditPageComponent {
|
|
|
9495
9507
|
if (this.eventTrigger.can_save_draft) {
|
|
9496
9508
|
if (this.formValuesChanged) {
|
|
9497
9509
|
const dialogRef = this.dialog.open(SaveOrDiscardDialogComponent, this.dialogConfig);
|
|
9498
|
-
dialogRef.afterClosed().subscribe(result => {
|
|
9510
|
+
this.dialogRefAfterClosedSub = dialogRef.afterClosed().subscribe(result => {
|
|
9499
9511
|
if (result === 'Discard') {
|
|
9500
9512
|
this.discard();
|
|
9501
9513
|
}
|
|
@@ -9581,7 +9593,7 @@ class CaseEditPageComponent {
|
|
|
9581
9593
|
const draftCaseEventData = this.formValueService.sanitise(this.editForm.value);
|
|
9582
9594
|
draftCaseEventData.event_token = this.eventTrigger.event_token;
|
|
9583
9595
|
draftCaseEventData.ignore_warning = this.caseEdit.ignoreWarning;
|
|
9584
|
-
this.caseEdit.saveDraft(draftCaseEventData).subscribe((draft) => this.eventTrigger.case_id = DRAFT_PREFIX + draft.id, error => this.handleError(error));
|
|
9596
|
+
this.saveDraftSub = this.caseEdit.saveDraft(draftCaseEventData).subscribe((draft) => this.eventTrigger.case_id = DRAFT_PREFIX + draft.id, error => this.handleError(error));
|
|
9585
9597
|
}
|
|
9586
9598
|
}
|
|
9587
9599
|
getCaseFields() {
|
|
@@ -9644,7 +9656,7 @@ class CaseEditPageComponent {
|
|
|
9644
9656
|
this.caseEditDataService.setCaseEventTriggerName(this.eventTrigger.name);
|
|
9645
9657
|
this.caseEditDataService.setCaseTitle(this.getCaseTitle());
|
|
9646
9658
|
this.caseEditDataService.setCaseEditForm(this.editForm);
|
|
9647
|
-
this.caseEditDataService.caseFormValidationErrors$.subscribe({
|
|
9659
|
+
this.caseFormValidationErrorsSub = this.caseEditDataService.caseFormValidationErrors$.subscribe({
|
|
9648
9660
|
next: (validationErrors) => this.validationErrors = validationErrors
|
|
9649
9661
|
});
|
|
9650
9662
|
}
|
|
@@ -26099,7 +26111,7 @@ class CaseResolver {
|
|
|
26099
26111
|
}
|
|
26100
26112
|
else {
|
|
26101
26113
|
return this.caseNotifier.fetchAndRefresh(cid)
|
|
26102
|
-
.pipe(catchError(error => this.checkAuthorizationError(error)))
|
|
26114
|
+
.pipe(catchError(error => this.checkAuthorizationError(error, cid)))
|
|
26103
26115
|
.toPromise();
|
|
26104
26116
|
}
|
|
26105
26117
|
}
|
|
@@ -26111,20 +26123,24 @@ class CaseResolver {
|
|
|
26111
26123
|
this.caseNotifier.cachedCaseView = plainToClassFromExist(new CaseView(), caseView);
|
|
26112
26124
|
this.caseNotifier.announceCase(this.caseNotifier.cachedCaseView);
|
|
26113
26125
|
return this.caseNotifier.cachedCaseView;
|
|
26114
|
-
}), catchError(error => this.checkAuthorizationError(error))).toPromise();
|
|
26126
|
+
}), catchError(error => this.checkAuthorizationError(error, cid))).toPromise();
|
|
26115
26127
|
}
|
|
26116
|
-
checkAuthorizationError(error) {
|
|
26128
|
+
checkAuthorizationError(error, caseReference) {
|
|
26117
26129
|
// TODO Should be logged to remote logging infrastructure
|
|
26118
26130
|
if (error.status === 400) {
|
|
26119
26131
|
this.router.navigate(['/search/noresults']);
|
|
26120
26132
|
return of(null);
|
|
26121
26133
|
}
|
|
26122
|
-
console.error(error);
|
|
26123
26134
|
if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
|
|
26124
26135
|
this.router.navigate(['/list/case']);
|
|
26125
26136
|
return of(null);
|
|
26126
26137
|
}
|
|
26127
|
-
|
|
26138
|
+
// Error 403, navigate to restricted case access page
|
|
26139
|
+
if (error.status === 403) {
|
|
26140
|
+
this.router.navigate([`/cases/restricted-case-access/${caseReference}`]);
|
|
26141
|
+
return of(null);
|
|
26142
|
+
}
|
|
26143
|
+
if (error.status !== 401) {
|
|
26128
26144
|
this.router.navigate(['/error']);
|
|
26129
26145
|
}
|
|
26130
26146
|
this.goToDefaultPage();
|