@hmcts/ccd-case-ui-toolkit 6.19.5-hotfix-EUI-8679-8770 → 6.19.5-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.
@@ -14635,19 +14635,18 @@
14635
14635
  var _c1$k = function (a0) { return { "form-group-error bottom-30": a0 }; };
14636
14636
  var WriteDocumentFieldComponent = /** @class */ (function (_super) {
14637
14637
  __extends(WriteDocumentFieldComponent, _super);
14638
- function WriteDocumentFieldComponent(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService, jurisdictionService) {
14638
+ function WriteDocumentFieldComponent(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService) {
14639
14639
  var _this = _super.call(this) || this;
14640
14640
  _this.appConfig = appConfig;
14641
14641
  _this.caseNotifier = caseNotifier;
14642
14642
  _this.documentManagement = documentManagement;
14643
14643
  _this.dialog = dialog;
14644
14644
  _this.fileUploadStateService = fileUploadStateService;
14645
- _this.jurisdictionService = jurisdictionService;
14646
14645
  _this.valid = true;
14647
14646
  return _this;
14648
14647
  }
14649
14648
  WriteDocumentFieldComponent.prototype.clickout = function (event) {
14650
- // Capturing the event of the associated ElementRef <input type="file" #fileInpu
14649
+ // Capturing the event of of the associated ElementRef <input type="file" #fileInpu
14651
14650
  if (this.fileInput.nativeElement.contains(event.target)) {
14652
14651
  this.clickInsideTheDocument = true;
14653
14652
  }
@@ -14657,10 +14656,6 @@
14657
14656
  };
14658
14657
  WriteDocumentFieldComponent.prototype.ngOnInit = function () {
14659
14658
  this.secureModeOn = this.appConfig.getDocumentSecureMode();
14660
- console.info('writeDocumentField.ngInit: secure mode = ' + this.secureModeOn);
14661
- if (this.secureModeOn) {
14662
- this.subscribeToCaseDetails();
14663
- }
14664
14659
  this.dialogConfig = initDialog();
14665
14660
  // EUI-3403. The field was not being registered when there was no value and the field
14666
14661
  // itself was not mandatory, which meant that show_conditions would not be evaluated.
@@ -14673,6 +14668,9 @@
14673
14668
  else {
14674
14669
  this.createDocumentForm(document);
14675
14670
  }
14671
+ if (this.appConfig.getDocumentSecureMode()) {
14672
+ this.subscribeToCaseDetails();
14673
+ }
14676
14674
  };
14677
14675
  WriteDocumentFieldComponent.prototype.ngOnDestroy = function () {
14678
14676
  if (this.fileUploadSubscription) {
@@ -14681,11 +14679,8 @@
14681
14679
  if (this.dialogSubscription) {
14682
14680
  this.dialogSubscription.unsubscribe();
14683
14681
  }
14684
- if (this.caseNotifierSubscription) {
14685
- this.caseNotifierSubscription.unsubscribe();
14686
- }
14687
- if (this.jurisdictionSubs) {
14688
- this.jurisdictionSubs.unsubscribe();
14682
+ if (this.caseEventSubscription) {
14683
+ this.caseEventSubscription.unsubscribe();
14689
14684
  }
14690
14685
  };
14691
14686
  WriteDocumentFieldComponent.prototype.isUploadInProgress = function () {
@@ -14737,9 +14732,7 @@
14737
14732
  WriteDocumentFieldComponent.prototype.triggerReplace = function () {
14738
14733
  if (this.confirmReplaceResult === 'Replace') {
14739
14734
  this.openFileDialog();
14740
- return true;
14741
14735
  }
14742
- return false;
14743
14736
  };
14744
14737
  WriteDocumentFieldComponent.prototype.getUploadedFileName = function () {
14745
14738
  if (this.uploadedDocument) {
@@ -14774,30 +14767,11 @@
14774
14767
  _this.triggerReplace();
14775
14768
  });
14776
14769
  };
14777
- // Depending on the context, we can get the case type and jurisdiction from different sources
14778
- // If we are running an event, the caseNotifier will have the current case
14779
- // If we are creating a case, the case doesn't exist yet, so the caseNotifier can't help
14780
- // Instead we can use the eventTrigger to get the case type, and the jurisdiction service to
14781
- // get the currently selected jurisdiction
14782
14770
  WriteDocumentFieldComponent.prototype.subscribeToCaseDetails = function () {
14783
14771
  var _this = this;
14784
- this.caseNotifierSubscription = this.caseNotifier.caseView.subscribe({
14772
+ this.caseEventSubscription = this.caseNotifier.caseView.subscribe({
14785
14773
  next: function (caseDetails) {
14786
- var _a, _b;
14787
- _this.caseTypeId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_id;
14788
- _this.jurisdictionId = (_b = (_a = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_type) === null || _a === void 0 ? void 0 : _a.jurisdiction) === null || _b === void 0 ? void 0 : _b.id;
14789
- console.info("caseNotifier.next: caseType=" + _this.caseTypeId + " juris=" + _this.jurisdictionId);
14790
- }
14791
- });
14792
- this.jurisdictionSubs = this.jurisdictionService.selectedJurisdictionBS.subscribe({
14793
- next: function (jurisdiction) {
14794
- if (jurisdiction) {
14795
- _this.jurisdictionId = jurisdiction.id;
14796
- if (jurisdiction.currentCaseType) {
14797
- _this.caseTypeId = jurisdiction.currentCaseType.id;
14798
- }
14799
- }
14800
- console.info("selectedJurisdiction.next: caseType=" + _this.caseTypeId + " juris=" + _this.jurisdictionId);
14774
+ _this.caseDetails = caseDetails;
14801
14775
  }
14802
14776
  });
14803
14777
  };
@@ -14861,8 +14835,13 @@
14861
14835
  documentUpload.append('files', selectedFile, selectedFile.name);
14862
14836
  documentUpload.append('classification', 'PUBLIC');
14863
14837
  if (this.appConfig.getDocumentSecureMode()) {
14864
- var caseTypeId = this.caseTypeId ? this.caseTypeId : null;
14865
- var caseTypeJurisdictionId = this.jurisdictionId ? this.jurisdictionId : null;
14838
+ var caseTypeId = this.caseDetails &&
14839
+ this.caseDetails.case_type &&
14840
+ this.caseDetails.case_type.id ? this.caseDetails.case_type.id : null;
14841
+ var caseTypeJurisdictionId = this.caseDetails &&
14842
+ this.caseDetails.case_type &&
14843
+ this.caseDetails.case_type.jurisdiction &&
14844
+ this.caseDetails.case_type.jurisdiction.id ? this.caseDetails.case_type.jurisdiction.id : null;
14866
14845
  documentUpload.append('caseTypeId', caseTypeId);
14867
14846
  documentUpload.append('jurisdictionId', caseTypeJurisdictionId);
14868
14847
  }
@@ -14910,7 +14889,7 @@
14910
14889
  WriteDocumentFieldComponent.UPLOAD_ERROR_FILE_REQUIRED = 'File required';
14911
14890
  WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE = 'Document upload facility is not available at the moment';
14912
14891
  WriteDocumentFieldComponent.UPLOAD_WAITING_FILE_STATUS = 'Uploading...';
14913
- WriteDocumentFieldComponent.ɵfac = function WriteDocumentFieldComponent_Factory(t) { return new (t || WriteDocumentFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(DocumentManagementService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(FileUploadStateService), i0__namespace.ɵɵdirectiveInject(JurisdictionService)); };
14892
+ WriteDocumentFieldComponent.ɵfac = function WriteDocumentFieldComponent_Factory(t) { return new (t || WriteDocumentFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(DocumentManagementService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(FileUploadStateService)); };
14914
14893
  WriteDocumentFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteDocumentFieldComponent, selectors: [["ccd-write-document-field"]], viewQuery: function WriteDocumentFieldComponent_Query(rf, ctx) {
14915
14894
  if (rf & 1) {
14916
14895
  i0__namespace.ɵɵviewQuery(_c0$N, 1);
@@ -14988,7 +14967,7 @@
14988
14967
  selector: 'ccd-write-document-field',
14989
14968
  templateUrl: './write-document-field.html'
14990
14969
  }]
14991
- }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1__namespace$3.MatDialog }, { type: FileUploadStateService }, { type: JurisdictionService }]; }, { fileInput: [{
14970
+ }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1__namespace$3.MatDialog }, { type: FileUploadStateService }]; }, { fileInput: [{
14992
14971
  type: i0.ViewChild,
14993
14972
  args: ['fileInput', { static: false }]
14994
14973
  }], clickout: [{
@@ -31031,7 +31010,7 @@
31031
31010
  else {
31032
31011
  console.info('getAndCacheCaseView - Path B.');
31033
31012
  return this.caseNotifier.fetchAndRefresh(cid)
31034
- .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); }))
31013
+ .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); }))
31035
31014
  .toPromise();
31036
31015
  }
31037
31016
  }
@@ -31044,9 +31023,9 @@
31044
31023
  _this.caseNotifier.cachedCaseView = classTransformer.plainToClassFromExist(new CaseView(), caseView);
31045
31024
  _this.caseNotifier.announceCase(_this.caseNotifier.cachedCaseView);
31046
31025
  return _this.caseNotifier.cachedCaseView;
31047
- }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); })).toPromise();
31026
+ }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); })).toPromise();
31048
31027
  };
31049
- CaseResolver.prototype.processErrorInCaseFetch = function (error) {
31028
+ CaseResolver.prototype.processErrorInCaseFetch = function (error, caseReference) {
31050
31029
  console.error('!!! processErrorInCaseFetch !!!');
31051
31030
  console.error(error);
31052
31031
  // TODO Should be logged to remote logging infrastructure
@@ -31054,12 +31033,16 @@
31054
31033
  this.router.navigate(['/search/noresults']);
31055
31034
  return rxjs.of(null);
31056
31035
  }
31057
- console.error(error);
31058
31036
  if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
31059
31037
  this.router.navigate(['/list/case']);
31060
31038
  return rxjs.of(null);
31061
31039
  }
31062
- if (error.status !== 401 && error.status !== 403) {
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) {
31063
31046
  this.router.navigate(['/error']);
31064
31047
  }
31065
31048
  this.goToDefaultPage();