@hmcts/ccd-case-ui-toolkit 6.19.6-rc1 → 6.19.6-rc2

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.
@@ -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
  }
@@ -12768,17 +12760,18 @@ function WriteDocumentFieldComponent_ccd_read_document_field_10_Template(rf, ctx
12768
12760
  } }
12769
12761
  const _c1$k = function (a0) { return { "form-group-error bottom-30": a0 }; };
12770
12762
  class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12771
- constructor(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService) {
12763
+ constructor(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService, jurisdictionService) {
12772
12764
  super();
12773
12765
  this.appConfig = appConfig;
12774
12766
  this.caseNotifier = caseNotifier;
12775
12767
  this.documentManagement = documentManagement;
12776
12768
  this.dialog = dialog;
12777
12769
  this.fileUploadStateService = fileUploadStateService;
12770
+ this.jurisdictionService = jurisdictionService;
12778
12771
  this.valid = true;
12779
12772
  }
12780
12773
  clickout(event) {
12781
- // Capturing the event of of the associated ElementRef <input type="file" #fileInpu
12774
+ // Capturing the event of the associated ElementRef <input type="file" #fileInpu
12782
12775
  if (this.fileInput.nativeElement.contains(event.target)) {
12783
12776
  this.clickInsideTheDocument = true;
12784
12777
  }
@@ -12788,6 +12781,9 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12788
12781
  }
12789
12782
  ngOnInit() {
12790
12783
  this.secureModeOn = this.appConfig.getDocumentSecureMode();
12784
+ if (this.secureModeOn) {
12785
+ this.subscribeToCaseDetails();
12786
+ }
12791
12787
  this.dialogConfig = initDialog();
12792
12788
  // EUI-3403. The field was not being registered when there was no value and the field
12793
12789
  // itself was not mandatory, which meant that show_conditions would not be evaluated.
@@ -12800,9 +12796,6 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12800
12796
  else {
12801
12797
  this.createDocumentForm(document);
12802
12798
  }
12803
- if (this.appConfig.getDocumentSecureMode()) {
12804
- this.subscribeToCaseDetails();
12805
- }
12806
12799
  }
12807
12800
  ngOnDestroy() {
12808
12801
  if (this.fileUploadSubscription) {
@@ -12811,8 +12804,11 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12811
12804
  if (this.dialogSubscription) {
12812
12805
  this.dialogSubscription.unsubscribe();
12813
12806
  }
12814
- if (this.caseEventSubscription) {
12815
- this.caseEventSubscription.unsubscribe();
12807
+ if (this.caseNotifierSubscription) {
12808
+ this.caseNotifierSubscription.unsubscribe();
12809
+ }
12810
+ if (this.jurisdictionSubs) {
12811
+ this.jurisdictionSubs.unsubscribe();
12816
12812
  }
12817
12813
  }
12818
12814
  isUploadInProgress() {
@@ -12863,7 +12859,9 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12863
12859
  triggerReplace() {
12864
12860
  if (this.confirmReplaceResult === 'Replace') {
12865
12861
  this.openFileDialog();
12862
+ return true;
12866
12863
  }
12864
+ return false;
12867
12865
  }
12868
12866
  getUploadedFileName() {
12869
12867
  if (this.uploadedDocument) {
@@ -12897,10 +12895,27 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12897
12895
  this.triggerReplace();
12898
12896
  });
12899
12897
  }
12898
+ // Depending on the context, we can get the case type and jurisdiction from different sources
12899
+ // If we are running an event, the caseNotifier will have the current case
12900
+ // If we are creating a case, the case doesn't exist yet, so the caseNotifier can't help
12901
+ // Instead we can use the eventTrigger to get the case type, and the jurisdiction service to
12902
+ // get the currently selected jurisdiction
12900
12903
  subscribeToCaseDetails() {
12901
- this.caseEventSubscription = this.caseNotifier.caseView.subscribe({
12904
+ this.caseNotifierSubscription = this.caseNotifier.caseView.subscribe({
12902
12905
  next: (caseDetails) => {
12903
- this.caseDetails = caseDetails;
12906
+ var _a, _b;
12907
+ this.caseTypeId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_id;
12908
+ 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;
12909
+ }
12910
+ });
12911
+ this.jurisdictionSubs = this.jurisdictionService.selectedJurisdictionBS.subscribe({
12912
+ next: (jurisdiction) => {
12913
+ if (jurisdiction) {
12914
+ this.jurisdictionId = jurisdiction.id;
12915
+ if (jurisdiction.currentCaseType) {
12916
+ this.caseTypeId = jurisdiction.currentCaseType.id;
12917
+ }
12918
+ }
12904
12919
  }
12905
12920
  });
12906
12921
  }
@@ -12964,13 +12979,8 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
12964
12979
  documentUpload.append('files', selectedFile, selectedFile.name);
12965
12980
  documentUpload.append('classification', 'PUBLIC');
12966
12981
  if (this.appConfig.getDocumentSecureMode()) {
12967
- const caseTypeId = this.caseDetails &&
12968
- this.caseDetails.case_type &&
12969
- this.caseDetails.case_type.id ? this.caseDetails.case_type.id : null;
12970
- const caseTypeJurisdictionId = this.caseDetails &&
12971
- this.caseDetails.case_type &&
12972
- this.caseDetails.case_type.jurisdiction &&
12973
- this.caseDetails.case_type.jurisdiction.id ? this.caseDetails.case_type.jurisdiction.id : null;
12982
+ const caseTypeId = this.caseTypeId ? this.caseTypeId : null;
12983
+ const caseTypeJurisdictionId = this.jurisdictionId ? this.jurisdictionId : null;
12974
12984
  documentUpload.append('caseTypeId', caseTypeId);
12975
12985
  documentUpload.append('jurisdictionId', caseTypeJurisdictionId);
12976
12986
  }
@@ -13017,7 +13027,7 @@ WriteDocumentFieldComponent.DOCUMENT_HASH = 'document_hash';
13017
13027
  WriteDocumentFieldComponent.UPLOAD_ERROR_FILE_REQUIRED = 'File required';
13018
13028
  WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE = 'Document upload facility is not available at the moment';
13019
13029
  WriteDocumentFieldComponent.UPLOAD_WAITING_FILE_STATUS = 'Uploading...';
13020
- 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)); };
13030
+ 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)); };
13021
13031
  WriteDocumentFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteDocumentFieldComponent, selectors: [["ccd-write-document-field"]], viewQuery: function WriteDocumentFieldComponent_Query(rf, ctx) { if (rf & 1) {
13022
13032
  i0.ɵɵviewQuery(_c0$N, 1);
13023
13033
  } if (rf & 2) {
@@ -13086,7 +13096,7 @@ WriteDocumentFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteDocument
13086
13096
  selector: 'ccd-write-document-field',
13087
13097
  templateUrl: './write-document-field.html'
13088
13098
  }]
13089
- }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1$3.MatDialog }, { type: FileUploadStateService }]; }, { fileInput: [{
13099
+ }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1$3.MatDialog }, { type: FileUploadStateService }, { type: JurisdictionService }]; }, { fileInput: [{
13090
13100
  type: ViewChild,
13091
13101
  args: ['fileInput', { static: false }]
13092
13102
  }], clickout: [{