@hmcts/ccd-case-ui-toolkit 6.19.5-restricted-case-access → 6.19.6-rc1

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.
Files changed (20) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +55 -17
  2. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
  3. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
  4. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
  5. package/esm2015/lib/shared/components/case-editor/case-edit/case-edit.component.js +10 -4
  6. package/esm2015/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.js +12 -4
  7. package/esm2015/lib/shared/components/case-editor/case-editor.module.js +6 -3
  8. package/esm2015/lib/shared/components/case-editor/services/valid-page-list-caseFields.service.js +27 -0
  9. package/esm2015/lib/shared/components/case-viewer/services/case.resolver.js +6 -10
  10. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +49 -17
  11. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  12. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts +4 -1
  13. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
  14. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +4 -2
  15. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
  16. package/lib/shared/components/case-editor/case-editor.module.d.ts.map +1 -1
  17. package/lib/shared/components/case-editor/services/valid-page-list-caseFields.service.d.ts +8 -0
  18. package/lib/shared/components/case-editor/services/valid-page-list-caseFields.service.d.ts.map +1 -0
  19. package/lib/shared/components/case-viewer/services/case.resolver.d.ts.map +1 -1
  20. package/package.json +1 -1
@@ -9892,8 +9892,38 @@
9892
9892
  }], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null);
9893
9893
  })();
9894
9894
 
9895
+ var ValidPageListCaseFieldsService = /** @class */ (function () {
9896
+ function ValidPageListCaseFieldsService() {
9897
+ }
9898
+ ValidPageListCaseFieldsService.prototype.deleteNonValidatedFields = function (validPageList, data, notFromEventSubmit, fromPreviousPage) {
9899
+ if (fromPreviousPage === void 0) { fromPreviousPage = false; }
9900
+ var validPageListCaseFields = [];
9901
+ validPageList.forEach(function (page) {
9902
+ if (notFromEventSubmit || ShowCondition.getInstance(page.show_condition).match(data)) {
9903
+ page.case_fields.forEach(function (field) { return validPageListCaseFields.push(field); });
9904
+ }
9905
+ });
9906
+ if (!fromPreviousPage && validPageListCaseFields.length > 0) {
9907
+ Object.keys(data).forEach(function (key) {
9908
+ if (validPageListCaseFields.findIndex(function (element) { return element.id === key; }) < 0) {
9909
+ delete data[key];
9910
+ ;
9911
+ }
9912
+ });
9913
+ }
9914
+ };
9915
+ return ValidPageListCaseFieldsService;
9916
+ }());
9917
+ ValidPageListCaseFieldsService.ɵfac = function ValidPageListCaseFieldsService_Factory(t) { return new (t || ValidPageListCaseFieldsService)(); };
9918
+ ValidPageListCaseFieldsService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: ValidPageListCaseFieldsService, factory: ValidPageListCaseFieldsService.ɵfac });
9919
+ (function () {
9920
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(ValidPageListCaseFieldsService, [{
9921
+ type: i0.Injectable
9922
+ }], null, null);
9923
+ })();
9924
+
9895
9925
  var CaseEditComponent = /** @class */ (function () {
9896
- function CaseEditComponent(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService) {
9926
+ function CaseEditComponent(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService) {
9897
9927
  this.fb = fb;
9898
9928
  this.caseNotifier = caseNotifier;
9899
9929
  this.router = router;
@@ -9907,6 +9937,7 @@
9907
9937
  this.formValueService = formValueService;
9908
9938
  this.formErrorService = formErrorService;
9909
9939
  this.loadingService = loadingService;
9940
+ this.validPageListCaseFieldsService = validPageListCaseFieldsService;
9910
9941
  this.cancelled = new i0.EventEmitter();
9911
9942
  this.submitted = new i0.EventEmitter();
9912
9943
  this.isEventCompletionChecksRequired = false;
@@ -9914,6 +9945,7 @@
9914
9945
  this.ignoreWarning = false;
9915
9946
  this.isLinkedCasesSubmission = false;
9916
9947
  this.callbackErrorsSubject = new rxjs.Subject();
9948
+ this.validPageList = [];
9917
9949
  }
9918
9950
  CaseEditComponent.prototype.ngOnInit = function () {
9919
9951
  var _this = this;
@@ -10078,6 +10110,8 @@
10078
10110
  this.formValueService.populateLinkedCasesDetailsFromCaseFields(caseEventData.data, eventTrigger.case_fields);
10079
10111
  // Remove "Launcher"-type fields (these have no values and are not intended to be persisted)
10080
10112
  this.formValueService.removeCaseFieldsOfType(caseEventData.data, eventTrigger.case_fields, ['FlagLauncher', 'ComponentLauncher']);
10113
+ // delete fields which are not part of the case event journey wizard pages case fields
10114
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.validPageList, caseEventData.data, false);
10081
10115
  caseEventData.event_token = eventTrigger.event_token;
10082
10116
  caseEventData.ignore_warning = this.ignoreWarning;
10083
10117
  if (this.confirmation) {
@@ -10245,7 +10279,7 @@
10245
10279
  }());
10246
10280
  CaseEditComponent.ORIGIN_QUERY_PARAM = 'origin';
10247
10281
  CaseEditComponent.ALERT_MESSAGE = 'Page is being refreshed so you will be redirected to the first page of this event.';
10248
- CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0__namespace.ɵɵdirectiveInject(i2__namespace$1.FormBuilder), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.Router), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FieldsUtils), i0__namespace.ɵɵdirectiveInject(FieldsPurger), i0__namespace.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0__namespace.ɵɵdirectiveInject(WizardFactoryService), i0__namespace.ɵɵdirectiveInject(SessionStorageService), i0__namespace.ɵɵdirectiveInject(WindowService), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(LoadingService)); };
10282
+ CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0__namespace.ɵɵdirectiveInject(i2__namespace$1.FormBuilder), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.Router), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FieldsUtils), i0__namespace.ɵɵdirectiveInject(FieldsPurger), i0__namespace.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0__namespace.ɵɵdirectiveInject(WizardFactoryService), i0__namespace.ɵɵdirectiveInject(SessionStorageService), i0__namespace.ɵɵdirectiveInject(WindowService), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(LoadingService), i0__namespace.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
10249
10283
  CaseEditComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: CaseEditComponent, selectors: [["ccd-case-edit"]], inputs: { eventTrigger: "eventTrigger", submit: "submit", validate: "validate", saveDraft: "saveDraft", caseDetails: "caseDetails" }, outputs: { cancelled: "cancelled", submitted: "submitted" }, features: [i0__namespace.ɵɵProvidersFeature([GreyBarService])], decls: 1, vars: 0, template: function CaseEditComponent_Template(rf, ctx) {
10250
10284
  if (rf & 1) {
10251
10285
  i0__namespace.ɵɵelement(0, "router-outlet");
@@ -10260,7 +10294,7 @@
10260
10294
  styleUrls: ['../case-edit.scss'],
10261
10295
  providers: [GreyBarService]
10262
10296
  }]
10263
- }], function () { return [{ type: i2__namespace$1.FormBuilder }, { type: CaseNotifier }, { type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }]; }, { eventTrigger: [{
10297
+ }], function () { return [{ type: i2__namespace$1.FormBuilder }, { type: CaseNotifier }, { type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, { eventTrigger: [{
10264
10298
  type: i0.Input
10265
10299
  }], submit: [{
10266
10300
  type: i0.Input
@@ -10956,7 +10990,7 @@
10956
10990
  }
10957
10991
  }
10958
10992
  var CaseEditPageComponent = /** @class */ (function () {
10959
- function CaseEditPageComponent(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService) {
10993
+ function CaseEditPageComponent(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService, validPageListCaseFieldsService) {
10960
10994
  this.caseEdit = caseEdit;
10961
10995
  this.route = route;
10962
10996
  this.formValueService = formValueService;
@@ -10967,6 +11001,7 @@
10967
11001
  this.caseFieldService = caseFieldService;
10968
11002
  this.caseEditDataService = caseEditDataService;
10969
11003
  this.loadingService = loadingService;
11004
+ this.validPageListCaseFieldsService = validPageListCaseFieldsService;
10970
11005
  this.triggerTextStart = CaseEditPageComponent.TRIGGER_TEXT_START;
10971
11006
  this.triggerTextIgnoreWarnings = CaseEditPageComponent.TRIGGER_TEXT_CONTINUE;
10972
11007
  this.formValuesChanged = false;
@@ -11177,6 +11212,9 @@
11177
11212
  }
11178
11213
  }
11179
11214
  if (!this.caseEdit.isSubmitting && !this.currentPageIsNotValid()) {
11215
+ if (this.caseEdit.validPageList.findIndex(function (page) { return page.id === _this.currentPage.id; }) === -1) {
11216
+ this.caseEdit.validPageList.push(this.currentPage);
11217
+ }
11180
11218
  this.caseEdit.isSubmitting = true;
11181
11219
  this.caseEdit.error = null;
11182
11220
  var caseEventData = this.buildCaseEventData();
@@ -11445,6 +11483,8 @@
11445
11483
  this.formValueService.sanitiseDynamicLists(caseFields, formFields);
11446
11484
  // Get hold of the CaseEventData.
11447
11485
  var caseEventData = this.formValueService.sanitise(formFields);
11486
+ // delete fields which are not part of the case event journey wizard pages case fields
11487
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.caseEdit.validPageList, caseEventData.data, true, fromPreviousPage);
11448
11488
  // Tidy it up before we return it.
11449
11489
  this.formValueService.removeUnnecessaryFields(caseEventData.data, caseFields, clearEmpty, clearNonCase, fromPreviousPage, this.currentPage.case_fields);
11450
11490
  return caseEventData;
@@ -11487,7 +11527,7 @@
11487
11527
  CaseEditPageComponent.TRIGGER_TEXT_START = 'Continue';
11488
11528
  CaseEditPageComponent.TRIGGER_TEXT_SAVE = 'Save and continue';
11489
11529
  CaseEditPageComponent.TRIGGER_TEXT_CONTINUE = 'Ignore Warning and Continue';
11490
- CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0__namespace.ɵɵdirectiveInject(CaseEditComponent), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(PageValidationService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(CaseFieldService), i0__namespace.ɵɵdirectiveInject(CaseEditDataService), i0__namespace.ɵɵdirectiveInject(LoadingService)); };
11530
+ CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0__namespace.ɵɵdirectiveInject(CaseEditComponent), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(PageValidationService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(CaseFieldService), i0__namespace.ɵɵdirectiveInject(CaseEditDataService), i0__namespace.ɵɵdirectiveInject(LoadingService), i0__namespace.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
11491
11531
  CaseEditPageComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: CaseEditPageComponent, selectors: [["ccd-case-edit-page"]], decls: 12, vars: 11, consts: [[4, "ngIf"], [4, "ngIf", "ngIfThen", "ngIfElse"], ["titleBlock", ""], ["idBlock", ""], ["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], [3, "error"], [3, "triggerTextContinue", "triggerTextIgnore", "callbackErrorsSubject", "callbackErrorsContext"], [1, "width-50"], ["class", "form", 3, "formGroup", "submit", 4, "ngIf"], [3, "eventCompletionParams", "eventCanBeCompleted", 4, "ngIf"], ["class", "govuk-heading-l", 4, "ngIf"], [1, "govuk-heading-l"], [1, "govuk-caption-l"], [3, "content"], ["class", "heading-h2", 4, "ngIf"], [1, "heading-h2"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], ["class", "govuk-error-summary__body", 4, "ngFor", "ngForOf"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [1, "validation-error", 3, "click"], [1, "form", 3, "formGroup", "submit"], ["id", "fieldset-case-data"], [2, "display", "none"], ["id", "caseEditForm", 3, "fields", "formGroup", "caseFields", "pageChangeSubject", "valuesChanged", 4, "ngIf"], ["class", "grid-row", 4, "ngIf"], [1, "form-group", "form-group-related"], ["type", "button", 1, "button", "button-secondary", 3, "disabled", "click"], ["type", "submit", 1, "button", 3, "disabled"], [1, "cancel"], ["href", "javascript:void(0)", 3, "click"], ["id", "caseEditForm", 3, "fields", "formGroup", "caseFields", "pageChangeSubject", "valuesChanged"], [1, "grid-row"], [1, "column-two-thirds", "rightBorderSeparator"], ["id", "caseEditForm1", 3, "fields", "formGroup", "caseFields"], [1, "column-one-third"], ["id", "caseEditForm2", 3, "fields", "formGroup", "caseFields"], [3, "eventCompletionParams", "eventCanBeCompleted"]], template: function CaseEditPageComponent_Template(rf, ctx) {
11492
11532
  if (rf & 1) {
11493
11533
  i0__namespace.ɵɵtemplate(0, CaseEditPageComponent_ng_container_0_Template, 3, 2, "ng-container", 0);
@@ -11530,7 +11570,7 @@
11530
11570
  templateUrl: 'case-edit-page.html',
11531
11571
  styleUrls: ['./case-edit-page.scss']
11532
11572
  }]
11533
- }], function () { return [{ type: CaseEditComponent }, { type: i1__namespace$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0__namespace.ChangeDetectorRef }, { type: PageValidationService }, { type: i1__namespace$3.MatDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }]; }, null);
11573
+ }], function () { return [{ type: CaseEditComponent }, { type: i1__namespace$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0__namespace.ChangeDetectorRef }, { type: PageValidationService }, { type: i1__namespace$3.MatDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, null);
11534
11574
  })();
11535
11575
 
11536
11576
  var CallbackErrorsContext = /** @class */ (function () {
@@ -28604,7 +28644,8 @@
28604
28644
  JudicialworkerService,
28605
28645
  CaseworkerService,
28606
28646
  SessionStorageService,
28607
- EventCompletionStateMachineService
28647
+ EventCompletionStateMachineService,
28648
+ ValidPageListCaseFieldsService
28608
28649
  ], imports: [[
28609
28650
  i2.CommonModule,
28610
28651
  i1$1.RouterModule,
@@ -28720,7 +28761,8 @@
28720
28761
  JudicialworkerService,
28721
28762
  CaseworkerService,
28722
28763
  SessionStorageService,
28723
- EventCompletionStateMachineService
28764
+ EventCompletionStateMachineService,
28765
+ ValidPageListCaseFieldsService
28724
28766
  ]
28725
28767
  }]
28726
28768
  }], null, null);
@@ -31010,7 +31052,7 @@
31010
31052
  else {
31011
31053
  console.info('getAndCacheCaseView - Path B.');
31012
31054
  return this.caseNotifier.fetchAndRefresh(cid)
31013
- .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); }))
31055
+ .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); }))
31014
31056
  .toPromise();
31015
31057
  }
31016
31058
  }
@@ -31023,9 +31065,9 @@
31023
31065
  _this.caseNotifier.cachedCaseView = classTransformer.plainToClassFromExist(new CaseView(), caseView);
31024
31066
  _this.caseNotifier.announceCase(_this.caseNotifier.cachedCaseView);
31025
31067
  return _this.caseNotifier.cachedCaseView;
31026
- }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); })).toPromise();
31068
+ }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); })).toPromise();
31027
31069
  };
31028
- CaseResolver.prototype.processErrorInCaseFetch = function (error, caseReference) {
31070
+ CaseResolver.prototype.processErrorInCaseFetch = function (error) {
31029
31071
  console.error('!!! processErrorInCaseFetch !!!');
31030
31072
  console.error(error);
31031
31073
  // TODO Should be logged to remote logging infrastructure
@@ -31033,16 +31075,12 @@
31033
31075
  this.router.navigate(['/search/noresults']);
31034
31076
  return rxjs.of(null);
31035
31077
  }
31078
+ console.error(error);
31036
31079
  if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
31037
31080
  this.router.navigate(['/list/case']);
31038
31081
  return rxjs.of(null);
31039
31082
  }
31040
- // Error 403, navigate to restricted case access page
31041
- if (error.status === 403) {
31042
- this.router.navigate(["/cases/restricted-case-access/" + caseReference]);
31043
- return rxjs.of(null);
31044
- }
31045
- if (error.status !== 401) {
31083
+ if (error.status !== 401 && error.status !== 403) {
31046
31084
  this.router.navigate(['/error']);
31047
31085
  }
31048
31086
  this.goToDefaultPage();