@hmcts/ccd-case-ui-toolkit 6.19.12-restricted-case-access → 6.19.13

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.
@@ -1383,13 +1383,6 @@ class HttpError {
1383
1383
  error[key] = response.error.hasOwnProperty(key) && response.error[key] ? response.error[key] : error[key];
1384
1384
  });
1385
1385
  }
1386
- // Error object in HttpErrorResponse will be empty for 403 errors
1387
- // Set the error properties of HttpError accordingly
1388
- if ((response === null || response === void 0 ? void 0 : response.status) === 403) {
1389
- error.error = response.statusText;
1390
- error.status = response.status;
1391
- error.message = response.message;
1392
- }
1393
1386
  return error;
1394
1387
  }
1395
1388
  }
@@ -1430,13 +1423,14 @@ class HttpErrorService {
1430
1423
  this.authService = authService;
1431
1424
  }
1432
1425
  static convertToHttpError(error) {
1433
- var _a;
1434
1426
  if (error instanceof HttpError) {
1435
1427
  return error;
1436
1428
  }
1437
1429
  let httpError = new HttpError();
1438
1430
  if (error instanceof HttpErrorResponse) {
1439
- if (((_a = error.headers) === null || _a === void 0 ? void 0 : _a.get(HttpErrorService.CONTENT_TYPE).indexOf(HttpErrorService.JSON)) !== -1) {
1431
+ if (error.headers
1432
+ && error.headers.get(HttpErrorService.CONTENT_TYPE)
1433
+ && error.headers.get(HttpErrorService.CONTENT_TYPE).indexOf(HttpErrorService.JSON) !== -1) {
1440
1434
  try {
1441
1435
  httpError = HttpError.from(error);
1442
1436
  }
@@ -1470,7 +1464,7 @@ class HttpErrorService {
1470
1464
  console.error('Handling error in http error service.');
1471
1465
  console.error(error);
1472
1466
  const httpError = HttpErrorService.convertToHttpError(error);
1473
- if (redirectIfNotAuthorised && httpError.status === 401) {
1467
+ if (redirectIfNotAuthorised && (httpError.status === 401 || httpError.status === 403)) {
1474
1468
  this.authService.signIn();
1475
1469
  }
1476
1470
  return throwError(httpError);
@@ -12795,15 +12789,6 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12795
12789
  this.jurisdictionService = jurisdictionService;
12796
12790
  this.valid = true;
12797
12791
  }
12798
- clickout(event) {
12799
- // Capturing the event of the associated ElementRef <input type="file" #fileInpu
12800
- if (this.fileInput.nativeElement.contains(event.target)) {
12801
- this.clickInsideTheDocument = true;
12802
- }
12803
- else {
12804
- this.fileValidations();
12805
- }
12806
- }
12807
12792
  ngOnInit() {
12808
12793
  this.secureModeOn = this.appConfig.getDocumentSecureMode();
12809
12794
  if (this.secureModeOn) {
@@ -13058,8 +13043,6 @@ WriteDocumentFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteDocument
13058
13043
  } if (rf & 2) {
13059
13044
  let _t;
13060
13045
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.fileInput = _t.first);
13061
- } }, hostBindings: function WriteDocumentFieldComponent_HostBindings(rf, ctx) { if (rf & 1) {
13062
- i0.ɵɵlistener("click", function WriteDocumentFieldComponent_click_HostBindingHandler($event) { return ctx.clickout($event); }, false, i0.ɵɵresolveDocument);
13063
13046
  } }, features: [i0.ɵɵInheritDefinitionFeature], decls: 19, vars: 22, consts: [[1, "form-group", 3, "ngClass"], [3, "for"], [1, "form-label"], ["class", "form-hint", 4, "ngIf"], ["class", "error-message", 4, "ngIf"], [3, "caseField", 4, "ngIf"], [2, "position", "relative"], [3, "id", "click"], ["type", "file", 1, "form-control", "bottom-30", 3, "id", "accept", "keydown.Tab", "change"], ["fileInput", ""], [1, "form-group", "bottom-30"], ["type", "button", "aria-label", "Cancel upload", 1, "button", "button-secondary", 3, "disabled", "click"], [1, "form-hint"], [1, "error-message"], [3, "caseField"]], template: function WriteDocumentFieldComponent_Template(rf, ctx) { if (rf & 1) {
13064
13047
  i0.ɵɵelementStart(0, "div", 0);
13065
13048
  i0.ɵɵelementStart(1, "label", 1);
@@ -13124,9 +13107,6 @@ WriteDocumentFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteDocument
13124
13107
  }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1$3.MatDialog }, { type: FileUploadStateService }, { type: JurisdictionService }]; }, { fileInput: [{
13125
13108
  type: ViewChild,
13126
13109
  args: ['fileInput', { static: false }]
13127
- }], clickout: [{
13128
- type: HostListener,
13129
- args: ['document:click', ['$event']]
13130
13110
  }] }); })();
13131
13111
 
13132
13112
  class DynamicListPipe {
@@ -27141,13 +27121,12 @@ CaseTimelineModule.ɵinj = i0.ɵɵdefineInjector({ imports: [[
27141
27121
  i0.ɵɵsetComponentScope(CaseTimelineComponent, [i2.NgIf, i2.NgSwitch, i2.NgSwitchCase, EventLogComponent, CaseHistoryComponent], [i1.RpxTranslatePipe]);
27142
27122
 
27143
27123
  class CaseResolver {
27144
- constructor(caseNotifier, draftService, navigationNotifierService, router, sessionStorage, appConfig) {
27124
+ constructor(caseNotifier, draftService, navigationNotifierService, router, sessionStorage) {
27145
27125
  this.caseNotifier = caseNotifier;
27146
27126
  this.draftService = draftService;
27147
27127
  this.navigationNotifierService = navigationNotifierService;
27148
27128
  this.router = router;
27149
27129
  this.sessionStorage = sessionStorage;
27150
- this.appConfig = appConfig;
27151
27130
  router.events.pipe(filter(event => event instanceof NavigationEnd))
27152
27131
  .subscribe((event) => {
27153
27132
  this.previousUrl = event.url;
@@ -27192,7 +27171,7 @@ class CaseResolver {
27192
27171
  else {
27193
27172
  console.info('getAndCacheCaseView - Path B.');
27194
27173
  return this.caseNotifier.fetchAndRefresh(cid)
27195
- .pipe(catchError(error => this.processErrorInCaseFetch(error, cid)))
27174
+ .pipe(catchError(error => this.processErrorInCaseFetch(error)))
27196
27175
  .toPromise();
27197
27176
  }
27198
27177
  }
@@ -27204,9 +27183,9 @@ class CaseResolver {
27204
27183
  this.caseNotifier.cachedCaseView = plainToClassFromExist(new CaseView(), caseView);
27205
27184
  this.caseNotifier.announceCase(this.caseNotifier.cachedCaseView);
27206
27185
  return this.caseNotifier.cachedCaseView;
27207
- }), catchError(error => this.processErrorInCaseFetch(error, cid))).toPromise();
27186
+ }), catchError(error => this.processErrorInCaseFetch(error))).toPromise();
27208
27187
  }
27209
- processErrorInCaseFetch(error, caseReference) {
27188
+ processErrorInCaseFetch(error) {
27210
27189
  console.error('!!! processErrorInCaseFetch !!!');
27211
27190
  console.error(error);
27212
27191
  // TODO Should be logged to remote logging infrastructure
@@ -27214,16 +27193,12 @@ class CaseResolver {
27214
27193
  this.router.navigate(['/search/noresults']);
27215
27194
  return of(null);
27216
27195
  }
27196
+ console.error(error);
27217
27197
  if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
27218
27198
  this.router.navigate(['/list/case']);
27219
27199
  return of(null);
27220
27200
  }
27221
- // Error 403 and enable-restricted-case-access Launch Darkly flag is enabled, navigate to restricted case access page
27222
- if (error.status === 403 && this.appConfig.getEnableRestrictedCaseAccessConfig()) {
27223
- this.router.navigate([`/cases/restricted-case-access/${caseReference}`]);
27224
- return of(null);
27225
- }
27226
- if (error.status !== 401) {
27201
+ if (error.status !== 401 && error.status !== 403) {
27227
27202
  this.router.navigate(['/error']);
27228
27203
  }
27229
27204
  this.goToDefaultPage();
@@ -27249,11 +27224,11 @@ CaseResolver.PARAM_CASE_ID = 'cid';
27249
27224
  CaseResolver.CASE_CREATED_MSG = 'The case has been created successfully';
27250
27225
  CaseResolver.defaultWAPage = '/work/my-work/list';
27251
27226
  CaseResolver.defaultPage = '/cases';
27252
- CaseResolver.ɵfac = function CaseResolver_Factory(t) { return new (t || CaseResolver)(i0.ɵɵinject(CaseNotifier), i0.ɵɵinject(DraftService), i0.ɵɵinject(NavigationNotifierService), i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(SessionStorageService), i0.ɵɵinject(AbstractAppConfig)); };
27227
+ CaseResolver.ɵfac = function CaseResolver_Factory(t) { return new (t || CaseResolver)(i0.ɵɵinject(CaseNotifier), i0.ɵɵinject(DraftService), i0.ɵɵinject(NavigationNotifierService), i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(SessionStorageService)); };
27253
27228
  CaseResolver.ɵprov = i0.ɵɵdefineInjectable({ token: CaseResolver, factory: CaseResolver.ɵfac });
27254
27229
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseResolver, [{
27255
27230
  type: Injectable
27256
- }], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1$1.Router }, { type: SessionStorageService }, { type: AbstractAppConfig }]; }, null); })();
27231
+ }], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1$1.Router }, { type: SessionStorageService }]; }, null); })();
27257
27232
 
27258
27233
  class EventTriggerResolver {
27259
27234
  constructor(casesService, alertService, profileService, profileNotifier) {