@hmcts/ccd-case-ui-toolkit 6.19.5-restricted-case-access → 6.19.5-view-case-link

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.
Files changed (21) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +42 -35
  2. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
  3. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
  4. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
  5. package/esm2015/lib/shared/components/case-editor/case-editor.module.js +2 -2
  6. package/esm2015/lib/shared/components/case-editor/services/case.notifier.js +1 -8
  7. package/esm2015/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.js +2 -1
  8. package/esm2015/lib/shared/components/case-viewer/services/case.resolver.js +6 -10
  9. package/esm2015/lib/shared/components/create-case-filters/create-case-filters.component.js +1 -1
  10. package/esm2015/lib/shared/components/palette/document/write-document-field.component.js +40 -20
  11. package/esm2015/lib/shared/services/jurisdiction/jurisdiction.service.js +1 -2
  12. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +42 -35
  13. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  14. package/lib/shared/components/case-editor/services/case.notifier.d.ts.map +1 -1
  15. package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts.map +1 -1
  16. package/lib/shared/components/case-viewer/services/case.resolver.d.ts.map +1 -1
  17. package/lib/shared/components/create-case-filters/create-case-filters.component.d.ts.map +1 -1
  18. package/lib/shared/components/palette/document/write-document-field.component.d.ts +8 -4
  19. package/lib/shared/components/palette/document/write-document-field.component.d.ts.map +1 -1
  20. package/lib/shared/services/jurisdiction/jurisdiction.service.d.ts.map +1 -1
  21. package/package.json +1 -1
@@ -6528,7 +6528,6 @@ class JurisdictionService {
6528
6528
  return this.httpService.get('/aggregated/caseworkers/:uid/jurisdictions?access=read');
6529
6529
  }
6530
6530
  announceSelectedJurisdiction(jurisdiction) {
6531
- console.info('Announcing selected jurisdiction = ' + (jurisdiction === null || jurisdiction === void 0 ? void 0 : jurisdiction.id));
6532
6531
  this.selectedJurisdictionSource.next(jurisdiction);
6533
6532
  this.selectedJurisdictionBS.next(jurisdiction);
6534
6533
  }
@@ -8026,22 +8025,15 @@ class CaseNotifier {
8026
8025
  this.cachedCaseView = null;
8027
8026
  }
8028
8027
  announceCase(c) {
8029
- console.info('announceCase started.');
8030
8028
  this.caseViewSource.next(c);
8031
- console.info('announceCase finished.');
8032
8029
  }
8033
8030
  fetchAndRefresh(cid) {
8034
- console.info('fetchAndRefresh started.');
8035
8031
  return this.casesService
8036
8032
  .getCaseViewV2(cid)
8037
8033
  .pipe(map(caseView => {
8038
- console.info('mapping caseView started.');
8039
- // this.casesService.syncWait(10);
8040
- // throw new Error('******************************************************');
8041
8034
  this.cachedCaseView = plainToClassFromExist(new CaseView(), caseView);
8042
8035
  this.setBasicFields(this.cachedCaseView.tabs);
8043
8036
  this.announceCase(this.cachedCaseView);
8044
- console.info('mapping caseView finished. Returning it.');
8045
8037
  return this.cachedCaseView;
8046
8038
  }));
8047
8039
  }
@@ -12734,17 +12726,18 @@ function WriteDocumentFieldComponent_ccd_read_document_field_10_Template(rf, ctx
12734
12726
  } }
12735
12727
  const _c1$k = function (a0) { return { "form-group-error bottom-30": a0 }; };
12736
12728
  class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12737
- constructor(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService) {
12729
+ constructor(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService, jurisdictionService) {
12738
12730
  super();
12739
12731
  this.appConfig = appConfig;
12740
12732
  this.caseNotifier = caseNotifier;
12741
12733
  this.documentManagement = documentManagement;
12742
12734
  this.dialog = dialog;
12743
12735
  this.fileUploadStateService = fileUploadStateService;
12736
+ this.jurisdictionService = jurisdictionService;
12744
12737
  this.valid = true;
12745
12738
  }
12746
12739
  clickout(event) {
12747
- // Capturing the event of of the associated ElementRef <input type="file" #fileInpu
12740
+ // Capturing the event of the associated ElementRef <input type="file" #fileInpu
12748
12741
  if (this.fileInput.nativeElement.contains(event.target)) {
12749
12742
  this.clickInsideTheDocument = true;
12750
12743
  }
@@ -12754,6 +12747,9 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12754
12747
  }
12755
12748
  ngOnInit() {
12756
12749
  this.secureModeOn = this.appConfig.getDocumentSecureMode();
12750
+ if (this.secureModeOn) {
12751
+ this.subscribeToCaseDetails();
12752
+ }
12757
12753
  this.dialogConfig = initDialog();
12758
12754
  // EUI-3403. The field was not being registered when there was no value and the field
12759
12755
  // itself was not mandatory, which meant that show_conditions would not be evaluated.
@@ -12766,9 +12762,6 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12766
12762
  else {
12767
12763
  this.createDocumentForm(document);
12768
12764
  }
12769
- if (this.appConfig.getDocumentSecureMode()) {
12770
- this.subscribeToCaseDetails();
12771
- }
12772
12765
  }
12773
12766
  ngOnDestroy() {
12774
12767
  if (this.fileUploadSubscription) {
@@ -12777,8 +12770,11 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12777
12770
  if (this.dialogSubscription) {
12778
12771
  this.dialogSubscription.unsubscribe();
12779
12772
  }
12780
- if (this.caseEventSubscription) {
12781
- this.caseEventSubscription.unsubscribe();
12773
+ if (this.caseNotifierSubscription) {
12774
+ this.caseNotifierSubscription.unsubscribe();
12775
+ }
12776
+ if (this.jurisdictionSubs) {
12777
+ this.jurisdictionSubs.unsubscribe();
12782
12778
  }
12783
12779
  }
12784
12780
  isUploadInProgress() {
@@ -12829,7 +12825,9 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12829
12825
  triggerReplace() {
12830
12826
  if (this.confirmReplaceResult === 'Replace') {
12831
12827
  this.openFileDialog();
12828
+ return true;
12832
12829
  }
12830
+ return false;
12833
12831
  }
12834
12832
  getUploadedFileName() {
12835
12833
  if (this.uploadedDocument) {
@@ -12863,10 +12861,27 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12863
12861
  this.triggerReplace();
12864
12862
  });
12865
12863
  }
12864
+ // Depending on the context, we can get the case type and jurisdiction from different sources
12865
+ // If we are running an event, the caseNotifier will have the current case
12866
+ // If we are creating a case, the case doesn't exist yet, so the caseNotifier can't help
12867
+ // Instead we can use the eventTrigger to get the case type, and the jurisdiction service to
12868
+ // get the currently selected jurisdiction
12866
12869
  subscribeToCaseDetails() {
12867
- this.caseEventSubscription = this.caseNotifier.caseView.subscribe({
12870
+ this.caseNotifierSubscription = this.caseNotifier.caseView.subscribe({
12868
12871
  next: (caseDetails) => {
12869
- this.caseDetails = caseDetails;
12872
+ var _a, _b;
12873
+ this.caseTypeId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_id;
12874
+ 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;
12875
+ }
12876
+ });
12877
+ this.jurisdictionSubs = this.jurisdictionService.selectedJurisdictionBS.subscribe({
12878
+ next: (jurisdiction) => {
12879
+ if (jurisdiction) {
12880
+ this.jurisdictionId = jurisdiction.id;
12881
+ if (jurisdiction.currentCaseType) {
12882
+ this.caseTypeId = jurisdiction.currentCaseType.id;
12883
+ }
12884
+ }
12870
12885
  }
12871
12886
  });
12872
12887
  }
@@ -12930,13 +12945,8 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12930
12945
  documentUpload.append('files', selectedFile, selectedFile.name);
12931
12946
  documentUpload.append('classification', 'PUBLIC');
12932
12947
  if (this.appConfig.getDocumentSecureMode()) {
12933
- const caseTypeId = this.caseDetails &&
12934
- this.caseDetails.case_type &&
12935
- this.caseDetails.case_type.id ? this.caseDetails.case_type.id : null;
12936
- const caseTypeJurisdictionId = this.caseDetails &&
12937
- this.caseDetails.case_type &&
12938
- this.caseDetails.case_type.jurisdiction &&
12939
- this.caseDetails.case_type.jurisdiction.id ? this.caseDetails.case_type.jurisdiction.id : null;
12948
+ const caseTypeId = this.caseTypeId ? this.caseTypeId : null;
12949
+ const caseTypeJurisdictionId = this.jurisdictionId ? this.jurisdictionId : null;
12940
12950
  documentUpload.append('caseTypeId', caseTypeId);
12941
12951
  documentUpload.append('jurisdictionId', caseTypeJurisdictionId);
12942
12952
  }
@@ -12983,7 +12993,7 @@ WriteDocumentFieldComponent.DOCUMENT_HASH = 'document_hash';
12983
12993
  WriteDocumentFieldComponent.UPLOAD_ERROR_FILE_REQUIRED = 'File required';
12984
12994
  WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE = 'Document upload facility is not available at the moment';
12985
12995
  WriteDocumentFieldComponent.UPLOAD_WAITING_FILE_STATUS = 'Uploading...';
12986
- WriteDocumentFieldComponent.ɵfac = function WriteDocumentFieldComponent_Factory(t) { return new (t || WriteDocumentFieldComponent)(i0.ɵɵdirectiveInject(AbstractAppConfig), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(DocumentManagementService), i0.ɵɵdirectiveInject(i1$3.MatDialog), i0.ɵɵdirectiveInject(FileUploadStateService)); };
12996
+ WriteDocumentFieldComponent.ɵfac = function WriteDocumentFieldComponent_Factory(t) { return new (t || WriteDocumentFieldComponent)(i0.ɵɵdirectiveInject(AbstractAppConfig), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(DocumentManagementService), i0.ɵɵdirectiveInject(i1$3.MatDialog), i0.ɵɵdirectiveInject(FileUploadStateService), i0.ɵɵdirectiveInject(JurisdictionService)); };
12987
12997
  WriteDocumentFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteDocumentFieldComponent, selectors: [["ccd-write-document-field"]], viewQuery: function WriteDocumentFieldComponent_Query(rf, ctx) { if (rf & 1) {
12988
12998
  i0.ɵɵviewQuery(_c0$N, 1);
12989
12999
  } if (rf & 2) {
@@ -13052,7 +13062,7 @@ WriteDocumentFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteDocument
13052
13062
  selector: 'ccd-write-document-field',
13053
13063
  templateUrl: './write-document-field.html'
13054
13064
  }]
13055
- }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1$3.MatDialog }, { type: FileUploadStateService }]; }, { fileInput: [{
13065
+ }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1$3.MatDialog }, { type: FileUploadStateService }, { type: JurisdictionService }]; }, { fileInput: [{
13056
13066
  type: ViewChild,
13057
13067
  args: ['fileInput', { static: false }]
13058
13068
  }], clickout: [{
@@ -27061,7 +27071,7 @@ class CaseResolver {
27061
27071
  else {
27062
27072
  console.info('getAndCacheCaseView - Path B.');
27063
27073
  return this.caseNotifier.fetchAndRefresh(cid)
27064
- .pipe(catchError(error => this.processErrorInCaseFetch(error, cid)))
27074
+ .pipe(catchError(error => this.processErrorInCaseFetch(error)))
27065
27075
  .toPromise();
27066
27076
  }
27067
27077
  }
@@ -27073,9 +27083,9 @@ class CaseResolver {
27073
27083
  this.caseNotifier.cachedCaseView = plainToClassFromExist(new CaseView(), caseView);
27074
27084
  this.caseNotifier.announceCase(this.caseNotifier.cachedCaseView);
27075
27085
  return this.caseNotifier.cachedCaseView;
27076
- }), catchError(error => this.processErrorInCaseFetch(error, cid))).toPromise();
27086
+ }), catchError(error => this.processErrorInCaseFetch(error))).toPromise();
27077
27087
  }
27078
- processErrorInCaseFetch(error, caseReference) {
27088
+ processErrorInCaseFetch(error) {
27079
27089
  console.error('!!! processErrorInCaseFetch !!!');
27080
27090
  console.error(error);
27081
27091
  // TODO Should be logged to remote logging infrastructure
@@ -27083,16 +27093,12 @@ class CaseResolver {
27083
27093
  this.router.navigate(['/search/noresults']);
27084
27094
  return of(null);
27085
27095
  }
27096
+ console.error(error);
27086
27097
  if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
27087
27098
  this.router.navigate(['/list/case']);
27088
27099
  return of(null);
27089
27100
  }
27090
- // Error 403, navigate to restricted case access page
27091
- if (error.status === 403) {
27092
- this.router.navigate([`/cases/restricted-case-access/${caseReference}`]);
27093
- return of(null);
27094
- }
27095
- if (error.status !== 401) {
27101
+ if (error.status !== 401 && error.status !== 403) {
27096
27102
  this.router.navigate(['/error']);
27097
27103
  }
27098
27104
  this.goToDefaultPage();
@@ -28253,6 +28259,7 @@ class CaseFullAccessViewComponent {
28253
28259
  const targetTabIndex = this.tabGroup._tabs.toArray().findIndex(tab => tab.textLabel === triggerOutputEventText);
28254
28260
  if (targetTabIndex > -1) {
28255
28261
  this.selectedTabIndex = targetTabIndex;
28262
+ this.tabGroup.selectedIndex = targetTabIndex;
28256
28263
  }
28257
28264
  }
28258
28265
  hasActiveCaseFlags() {