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

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.
@@ -9885,13 +9885,20 @@
9885
9885
  })();
9886
9886
 
9887
9887
  var ValidPageListCaseFieldsService = /** @class */ (function () {
9888
- function ValidPageListCaseFieldsService() {
9888
+ function ValidPageListCaseFieldsService(fieldsUtils) {
9889
+ this.fieldsUtils = fieldsUtils;
9889
9890
  }
9890
- ValidPageListCaseFieldsService.prototype.deleteNonValidatedFields = function (validPageList, data, notFromEventSubmit, fromPreviousPage) {
9891
+ ValidPageListCaseFieldsService.prototype.isShown = function (page, eventTriggerFields, data) {
9892
+ var fields = this.fieldsUtils
9893
+ .mergeCaseFieldsAndFormFields(eventTriggerFields, data);
9894
+ return page.parsedShowCondition.match(fields);
9895
+ };
9896
+ ValidPageListCaseFieldsService.prototype.deleteNonValidatedFields = function (validPageList, data, eventTriggerFields, fromPreviousPage) {
9897
+ var _this = this;
9891
9898
  if (fromPreviousPage === void 0) { fromPreviousPage = false; }
9892
9899
  var validPageListCaseFields = [];
9893
9900
  validPageList.forEach(function (page) {
9894
- if (notFromEventSubmit || ShowCondition.getInstance(page.show_condition).match(data)) {
9901
+ if (_this.isShown(page, eventTriggerFields, data)) {
9895
9902
  page.case_fields.forEach(function (field) { return validPageListCaseFields.push(field); });
9896
9903
  }
9897
9904
  });
@@ -9899,19 +9906,18 @@
9899
9906
  Object.keys(data).forEach(function (key) {
9900
9907
  if (validPageListCaseFields.findIndex(function (element) { return element.id === key; }) < 0) {
9901
9908
  delete data[key];
9902
- ;
9903
9909
  }
9904
9910
  });
9905
9911
  }
9906
9912
  };
9907
9913
  return ValidPageListCaseFieldsService;
9908
9914
  }());
9909
- ValidPageListCaseFieldsService.ɵfac = function ValidPageListCaseFieldsService_Factory(t) { return new (t || ValidPageListCaseFieldsService)(); };
9915
+ ValidPageListCaseFieldsService.ɵfac = function ValidPageListCaseFieldsService_Factory(t) { return new (t || ValidPageListCaseFieldsService)(i0__namespace.ɵɵinject(FieldsUtils)); };
9910
9916
  ValidPageListCaseFieldsService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: ValidPageListCaseFieldsService, factory: ValidPageListCaseFieldsService.ɵfac });
9911
9917
  (function () {
9912
9918
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(ValidPageListCaseFieldsService, [{
9913
9919
  type: i0.Injectable
9914
- }], null, null);
9920
+ }], function () { return [{ type: FieldsUtils }]; }, null);
9915
9921
  })();
9916
9922
 
9917
9923
  var CaseEditComponent = /** @class */ (function () {
@@ -10103,7 +10109,7 @@
10103
10109
  // Remove "Launcher"-type fields (these have no values and are not intended to be persisted)
10104
10110
  this.formValueService.removeCaseFieldsOfType(caseEventData.data, eventTrigger.case_fields, ['FlagLauncher', 'ComponentLauncher']);
10105
10111
  // delete fields which are not part of the case event journey wizard pages case fields
10106
- this.validPageListCaseFieldsService.deleteNonValidatedFields(this.validPageList, caseEventData.data, false);
10112
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.validPageList, caseEventData.data, eventTrigger.case_fields, false);
10107
10113
  caseEventData.event_token = eventTrigger.event_token;
10108
10114
  caseEventData.ignore_warning = this.ignoreWarning;
10109
10115
  if (this.confirmation) {
@@ -11478,7 +11484,7 @@
11478
11484
  // Get hold of the CaseEventData.
11479
11485
  var caseEventData = this.formValueService.sanitise(formFields);
11480
11486
  // delete fields which are not part of the case event journey wizard pages case fields
11481
- this.validPageListCaseFieldsService.deleteNonValidatedFields(this.caseEdit.validPageList, caseEventData.data, true, fromPreviousPage);
11487
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.caseEdit.validPageList, caseEventData.data, this.eventTrigger.case_fields, fromPreviousPage);
11482
11488
  // Tidy it up before we return it.
11483
11489
  this.formValueService.removeUnnecessaryFields(caseEventData.data, caseFields, clearEmpty, clearNonCase, fromPreviousPage, this.currentPage.case_fields);
11484
11490
  return caseEventData;
@@ -31012,13 +31018,14 @@
31012
31018
  i0__namespace.ɵɵsetComponentScope(CaseTimelineComponent, [i2__namespace.NgIf, i2__namespace.NgSwitch, i2__namespace.NgSwitchCase, EventLogComponent, CaseHistoryComponent], [i1__namespace.RpxTranslatePipe]);
31013
31019
 
31014
31020
  var CaseResolver = /** @class */ (function () {
31015
- function CaseResolver(caseNotifier, draftService, navigationNotifierService, router, sessionStorage) {
31021
+ function CaseResolver(caseNotifier, draftService, navigationNotifierService, router, sessionStorage, appConfig) {
31016
31022
  var _this = this;
31017
31023
  this.caseNotifier = caseNotifier;
31018
31024
  this.draftService = draftService;
31019
31025
  this.navigationNotifierService = navigationNotifierService;
31020
31026
  this.router = router;
31021
31027
  this.sessionStorage = sessionStorage;
31028
+ this.appConfig = appConfig;
31022
31029
  router.events.pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }))
31023
31030
  .subscribe(function (event) {
31024
31031
  _this.previousUrl = event.url;
@@ -31091,8 +31098,8 @@
31091
31098
  this.router.navigate(['/list/case']);
31092
31099
  return rxjs.of(null);
31093
31100
  }
31094
- // Error 403, navigate to restricted case access page
31095
- if (error.status === 403) {
31101
+ // Error 403 and enable-restricted-case-access Launch Darkly flag is enabled, navigate to restricted case access page
31102
+ if (error.status === 403 && this.appConfig.getEnableRestrictedCaseAccessConfig()) {
31096
31103
  this.router.navigate(["/cases/restricted-case-access/" + caseReference]);
31097
31104
  return rxjs.of(null);
31098
31105
  }
@@ -31123,12 +31130,12 @@
31123
31130
  CaseResolver.CASE_CREATED_MSG = 'The case has been created successfully';
31124
31131
  CaseResolver.defaultWAPage = '/work/my-work/list';
31125
31132
  CaseResolver.defaultPage = '/cases';
31126
- CaseResolver.ɵfac = function CaseResolver_Factory(t) { return new (t || CaseResolver)(i0__namespace.ɵɵinject(CaseNotifier), i0__namespace.ɵɵinject(DraftService), i0__namespace.ɵɵinject(NavigationNotifierService), i0__namespace.ɵɵinject(i1__namespace$1.Router), i0__namespace.ɵɵinject(SessionStorageService)); };
31133
+ CaseResolver.ɵfac = function CaseResolver_Factory(t) { return new (t || CaseResolver)(i0__namespace.ɵɵinject(CaseNotifier), i0__namespace.ɵɵinject(DraftService), i0__namespace.ɵɵinject(NavigationNotifierService), i0__namespace.ɵɵinject(i1__namespace$1.Router), i0__namespace.ɵɵinject(SessionStorageService), i0__namespace.ɵɵinject(AbstractAppConfig)); };
31127
31134
  CaseResolver.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: CaseResolver, factory: CaseResolver.ɵfac });
31128
31135
  (function () {
31129
31136
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CaseResolver, [{
31130
31137
  type: i0.Injectable
31131
- }], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1__namespace$1.Router }, { type: SessionStorageService }]; }, null);
31138
+ }], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1__namespace$1.Router }, { type: SessionStorageService }, { type: AbstractAppConfig }]; }, null);
31132
31139
  })();
31133
31140
 
31134
31141
  var EventTriggerResolver = /** @class */ (function () {