@hmcts/ccd-case-ui-toolkit 6.19.9-rc3 → 6.19.9-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.
@@ -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);
@@ -8700,6 +8706,7 @@
8700
8706
  childrenCaseFields.forEach(function (e) { return _this.hideParentIfAllChildrenHidden(e); });
8701
8707
  if (childrenCaseFields.length > 0 && this.allCaseFieldsHidden(childrenCaseFields)) {
8702
8708
  caseField.hidden = true;
8709
+ caseField.display_context = 'HIDDEN';
8703
8710
  }
8704
8711
  };
8705
8712
  WizardPageFieldToCaseFieldMapper.prototype.getCaseFieldChildren = function (caseField) {
@@ -31033,13 +31040,14 @@
31033
31040
  i0__namespace.ɵɵsetComponentScope(CaseTimelineComponent, [i2__namespace.NgIf, i2__namespace.NgSwitch, i2__namespace.NgSwitchCase, EventLogComponent, CaseHistoryComponent], [i1__namespace.RpxTranslatePipe]);
31034
31041
 
31035
31042
  var CaseResolver = /** @class */ (function () {
31036
- function CaseResolver(caseNotifier, draftService, navigationNotifierService, router, sessionStorage) {
31043
+ function CaseResolver(caseNotifier, draftService, navigationNotifierService, router, sessionStorage, appConfig) {
31037
31044
  var _this = this;
31038
31045
  this.caseNotifier = caseNotifier;
31039
31046
  this.draftService = draftService;
31040
31047
  this.navigationNotifierService = navigationNotifierService;
31041
31048
  this.router = router;
31042
31049
  this.sessionStorage = sessionStorage;
31050
+ this.appConfig = appConfig;
31043
31051
  router.events.pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }))
31044
31052
  .subscribe(function (event) {
31045
31053
  _this.previousUrl = event.url;
@@ -31085,7 +31093,7 @@
31085
31093
  else {
31086
31094
  console.info('getAndCacheCaseView - Path B.');
31087
31095
  return this.caseNotifier.fetchAndRefresh(cid)
31088
- .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); }))
31096
+ .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); }))
31089
31097
  .toPromise();
31090
31098
  }
31091
31099
  }
@@ -31098,9 +31106,9 @@
31098
31106
  _this.caseNotifier.cachedCaseView = classTransformer.plainToClassFromExist(new CaseView(), caseView);
31099
31107
  _this.caseNotifier.announceCase(_this.caseNotifier.cachedCaseView);
31100
31108
  return _this.caseNotifier.cachedCaseView;
31101
- }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); })).toPromise();
31109
+ }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); })).toPromise();
31102
31110
  };
31103
- CaseResolver.prototype.processErrorInCaseFetch = function (error) {
31111
+ CaseResolver.prototype.processErrorInCaseFetch = function (error, caseReference) {
31104
31112
  console.error('!!! processErrorInCaseFetch !!!');
31105
31113
  console.error(error);
31106
31114
  // TODO Should be logged to remote logging infrastructure
@@ -31108,12 +31116,16 @@
31108
31116
  this.router.navigate(['/search/noresults']);
31109
31117
  return rxjs.of(null);
31110
31118
  }
31111
- console.error(error);
31112
31119
  if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
31113
31120
  this.router.navigate(['/list/case']);
31114
31121
  return rxjs.of(null);
31115
31122
  }
31116
- if (error.status !== 401 && error.status !== 403) {
31123
+ // Error 403 and enable-restricted-case-access Launch Darkly flag is enabled, navigate to restricted case access page
31124
+ if (error.status === 403 && this.appConfig.getEnableRestrictedCaseAccessConfig()) {
31125
+ this.router.navigate(["/cases/restricted-case-access/" + caseReference]);
31126
+ return rxjs.of(null);
31127
+ }
31128
+ if (error.status !== 401) {
31117
31129
  this.router.navigate(['/error']);
31118
31130
  }
31119
31131
  this.goToDefaultPage();
@@ -31140,12 +31152,12 @@
31140
31152
  CaseResolver.CASE_CREATED_MSG = 'The case has been created successfully';
31141
31153
  CaseResolver.defaultWAPage = '/work/my-work/list';
31142
31154
  CaseResolver.defaultPage = '/cases';
31143
- 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)); };
31155
+ 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)); };
31144
31156
  CaseResolver.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: CaseResolver, factory: CaseResolver.ɵfac });
31145
31157
  (function () {
31146
31158
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CaseResolver, [{
31147
31159
  type: i0.Injectable
31148
- }], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1__namespace$1.Router }, { type: SessionStorageService }]; }, null);
31160
+ }], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1__namespace$1.Router }, { type: SessionStorageService }, { type: AbstractAppConfig }]; }, null);
31149
31161
  })();
31150
31162
 
31151
31163
  var EventTriggerResolver = /** @class */ (function () {