@hmcts/ccd-case-ui-toolkit 6.19.15 → 6.19.16-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.
@@ -1985,6 +1985,13 @@
1985
1985
  error[key] = response.error.hasOwnProperty(key) && response.error[key] ? response.error[key] : error[key];
1986
1986
  });
1987
1987
  }
1988
+ // Error object in HttpErrorResponse will be empty for 403 errors
1989
+ // Set the error properties of HttpError accordingly
1990
+ if ((response === null || response === void 0 ? void 0 : response.status) === 403) {
1991
+ error.error = response.statusText;
1992
+ error.status = response.status;
1993
+ error.message = response.message;
1994
+ }
1988
1995
  return error;
1989
1996
  };
1990
1997
  return HttpError;
@@ -2083,14 +2090,13 @@
2083
2090
  this.authService = authService;
2084
2091
  }
2085
2092
  HttpErrorService.convertToHttpError = function (error) {
2093
+ var _a;
2086
2094
  if (error instanceof HttpError) {
2087
2095
  return error;
2088
2096
  }
2089
2097
  var httpError = new HttpError();
2090
2098
  if (error instanceof i1$2.HttpErrorResponse) {
2091
- if (error.headers
2092
- && error.headers.get(HttpErrorService.CONTENT_TYPE)
2093
- && error.headers.get(HttpErrorService.CONTENT_TYPE).indexOf(HttpErrorService.JSON) !== -1) {
2099
+ if (((_a = error.headers) === null || _a === void 0 ? void 0 : _a.get(HttpErrorService.CONTENT_TYPE).indexOf(HttpErrorService.JSON)) !== -1) {
2094
2100
  try {
2095
2101
  httpError = HttpError.from(error);
2096
2102
  }
@@ -2125,7 +2131,7 @@
2125
2131
  console.error('Handling error in http error service.');
2126
2132
  console.error(error);
2127
2133
  var httpError = HttpErrorService.convertToHttpError(error);
2128
- if (redirectIfNotAuthorised && (httpError.status === 401 || httpError.status === 403)) {
2134
+ if (redirectIfNotAuthorised && httpError.status === 401) {
2129
2135
  this.authService.signIn();
2130
2136
  }
2131
2137
  return rxjs.throwError(httpError);
@@ -8636,7 +8642,7 @@
8636
8642
  var caseFieldLeaf;
8637
8643
  var children = this.getCaseFieldChildren(caseField);
8638
8644
  if (children.length > 0) {
8639
- var _a = __read(caseFieldIds), _ = _a[0], tail = _a.slice(1);
8645
+ var _b = __read(caseFieldIds), _ = _b[0], tail = _b.slice(1);
8640
8646
  caseFieldLeaf = this.getCaseFieldLeaf(tail, children);
8641
8647
  }
8642
8648
  else {
@@ -8674,7 +8680,7 @@
8674
8680
  return pathPrefix.length === 0 ? caseField : pathPrefix + "." + caseField;
8675
8681
  };
8676
8682
  WizardPageFieldToCaseFieldMapper.prototype.getCaseFieldLeaf = function (caseFieldId, caseFields) {
8677
- var _a = __read(caseFieldId), head = _a[0], tail = _a.slice(1);
8683
+ var _b = __read(caseFieldId), head = _b[0], tail = _b.slice(1);
8678
8684
  if (caseFieldId.length === 1) {
8679
8685
  var caseLeaf = caseFields.find(function (e) { return e.id === head; });
8680
8686
  if (!caseLeaf) {
@@ -8696,11 +8702,15 @@
8696
8702
  };
8697
8703
  WizardPageFieldToCaseFieldMapper.prototype.hideParentIfAllChildrenHidden = function (caseField) {
8698
8704
  var _this = this;
8705
+ var _a;
8699
8706
  var childrenCaseFields = this.getCaseFieldChildren(caseField);
8700
8707
  childrenCaseFields.forEach(function (e) { return _this.hideParentIfAllChildrenHidden(e); });
8708
+ // filter out judicialuser field to avoid issue with the field to be hide/unhide based on the selection
8701
8709
  if (childrenCaseFields.length > 0 && this.allCaseFieldsHidden(childrenCaseFields)) {
8702
8710
  caseField.hidden = true;
8703
- caseField.display_context = 'HIDDEN';
8711
+ if (caseField.field_type.id !== 'JudicialUser' && ((_a = caseField.field_type.collection_field_type) === null || _a === void 0 ? void 0 : _a.id) !== 'JudicialUser') {
8712
+ caseField.display_context = 'HIDDEN';
8713
+ }
8704
8714
  }
8705
8715
  };
8706
8716
  WizardPageFieldToCaseFieldMapper.prototype.getCaseFieldChildren = function (caseField) {
@@ -8714,7 +8724,7 @@
8714
8724
  return childrenCaseFields;
8715
8725
  };
8716
8726
  WizardPageFieldToCaseFieldMapper.prototype.allCaseFieldsHidden = function (children) {
8717
- return !children.some(function (e) { return e.hidden !== true; });
8727
+ return children.every(function (e) { return e.display_context === 'HIDDEN'; });
8718
8728
  };
8719
8729
  return WizardPageFieldToCaseFieldMapper;
8720
8730
  }());
@@ -31081,13 +31091,14 @@
31081
31091
  i0__namespace.ɵɵsetComponentScope(CaseTimelineComponent, [i2__namespace.NgIf, i2__namespace.NgSwitch, i2__namespace.NgSwitchCase, EventLogComponent, CaseHistoryComponent], [i1__namespace.RpxTranslatePipe]);
31082
31092
 
31083
31093
  var CaseResolver = /** @class */ (function () {
31084
- function CaseResolver(caseNotifier, draftService, navigationNotifierService, router, sessionStorage) {
31094
+ function CaseResolver(caseNotifier, draftService, navigationNotifierService, router, sessionStorage, appConfig) {
31085
31095
  var _this = this;
31086
31096
  this.caseNotifier = caseNotifier;
31087
31097
  this.draftService = draftService;
31088
31098
  this.navigationNotifierService = navigationNotifierService;
31089
31099
  this.router = router;
31090
31100
  this.sessionStorage = sessionStorage;
31101
+ this.appConfig = appConfig;
31091
31102
  router.events.pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }))
31092
31103
  .subscribe(function (event) {
31093
31104
  _this.previousUrl = event.url;
@@ -31133,7 +31144,7 @@
31133
31144
  else {
31134
31145
  console.info('getAndCacheCaseView - Path B.');
31135
31146
  return this.caseNotifier.fetchAndRefresh(cid)
31136
- .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); }))
31147
+ .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); }))
31137
31148
  .toPromise();
31138
31149
  }
31139
31150
  }
@@ -31146,9 +31157,9 @@
31146
31157
  _this.caseNotifier.cachedCaseView = classTransformer.plainToClassFromExist(new CaseView(), caseView);
31147
31158
  _this.caseNotifier.announceCase(_this.caseNotifier.cachedCaseView);
31148
31159
  return _this.caseNotifier.cachedCaseView;
31149
- }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); })).toPromise();
31160
+ }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); })).toPromise();
31150
31161
  };
31151
- CaseResolver.prototype.processErrorInCaseFetch = function (error) {
31162
+ CaseResolver.prototype.processErrorInCaseFetch = function (error, caseReference) {
31152
31163
  console.error('!!! processErrorInCaseFetch !!!');
31153
31164
  console.error(error);
31154
31165
  // TODO Should be logged to remote logging infrastructure
@@ -31156,12 +31167,16 @@
31156
31167
  this.router.navigate(['/search/noresults']);
31157
31168
  return rxjs.of(null);
31158
31169
  }
31159
- console.error(error);
31160
31170
  if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
31161
31171
  this.router.navigate(['/list/case']);
31162
31172
  return rxjs.of(null);
31163
31173
  }
31164
- if (error.status !== 401 && error.status !== 403) {
31174
+ // Error 403 and enable-restricted-case-access Launch Darkly flag is enabled, navigate to restricted case access page
31175
+ if (error.status === 403 && this.appConfig.getEnableRestrictedCaseAccessConfig()) {
31176
+ this.router.navigate(["/cases/restricted-case-access/" + caseReference]);
31177
+ return rxjs.of(null);
31178
+ }
31179
+ if (error.status !== 401) {
31165
31180
  this.router.navigate(['/error']);
31166
31181
  }
31167
31182
  this.goToDefaultPage();
@@ -31188,12 +31203,12 @@
31188
31203
  CaseResolver.CASE_CREATED_MSG = 'The case has been created successfully';
31189
31204
  CaseResolver.defaultWAPage = '/work/my-work/list';
31190
31205
  CaseResolver.defaultPage = '/cases';
31191
- 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)); };
31206
+ 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)); };
31192
31207
  CaseResolver.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: CaseResolver, factory: CaseResolver.ɵfac });
31193
31208
  (function () {
31194
31209
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CaseResolver, [{
31195
31210
  type: i0.Injectable
31196
- }], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1__namespace$1.Router }, { type: SessionStorageService }]; }, null);
31211
+ }], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1__namespace$1.Router }, { type: SessionStorageService }, { type: AbstractAppConfig }]; }, null);
31197
31212
  })();
31198
31213
 
31199
31214
  var EventTriggerResolver = /** @class */ (function () {