@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.
@@ -7708,7 +7708,6 @@
7708
7708
  return this.httpService.get('/aggregated/caseworkers/:uid/jurisdictions?access=read');
7709
7709
  };
7710
7710
  JurisdictionService.prototype.announceSelectedJurisdiction = function (jurisdiction) {
7711
- console.info('Announcing selected jurisdiction = ' + (jurisdiction === null || jurisdiction === void 0 ? void 0 : jurisdiction.id));
7712
7711
  this.selectedJurisdictionSource.next(jurisdiction);
7713
7712
  this.selectedJurisdictionBS.next(jurisdiction);
7714
7713
  };
@@ -9374,23 +9373,16 @@
9374
9373
  this.cachedCaseView = null;
9375
9374
  };
9376
9375
  CaseNotifier.prototype.announceCase = function (c) {
9377
- console.info('announceCase started.');
9378
9376
  this.caseViewSource.next(c);
9379
- console.info('announceCase finished.');
9380
9377
  };
9381
9378
  CaseNotifier.prototype.fetchAndRefresh = function (cid) {
9382
9379
  var _this = this;
9383
- console.info('fetchAndRefresh started.');
9384
9380
  return this.casesService
9385
9381
  .getCaseViewV2(cid)
9386
9382
  .pipe(operators.map(function (caseView) {
9387
- console.info('mapping caseView started.');
9388
- // this.casesService.syncWait(10);
9389
- // throw new Error('******************************************************');
9390
9383
  _this.cachedCaseView = classTransformer.plainToClassFromExist(new CaseView(), caseView);
9391
9384
  _this.setBasicFields(_this.cachedCaseView.tabs);
9392
9385
  _this.announceCase(_this.cachedCaseView);
9393
- console.info('mapping caseView finished. Returning it.');
9394
9386
  return _this.cachedCaseView;
9395
9387
  }));
9396
9388
  };
@@ -14675,18 +14667,19 @@
14675
14667
  var _c1$k = function (a0) { return { "form-group-error bottom-30": a0 }; };
14676
14668
  var WriteDocumentFieldComponent = /** @class */ (function (_super) {
14677
14669
  __extends(WriteDocumentFieldComponent, _super);
14678
- function WriteDocumentFieldComponent(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService) {
14670
+ function WriteDocumentFieldComponent(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService, jurisdictionService) {
14679
14671
  var _this = _super.call(this) || this;
14680
14672
  _this.appConfig = appConfig;
14681
14673
  _this.caseNotifier = caseNotifier;
14682
14674
  _this.documentManagement = documentManagement;
14683
14675
  _this.dialog = dialog;
14684
14676
  _this.fileUploadStateService = fileUploadStateService;
14677
+ _this.jurisdictionService = jurisdictionService;
14685
14678
  _this.valid = true;
14686
14679
  return _this;
14687
14680
  }
14688
14681
  WriteDocumentFieldComponent.prototype.clickout = function (event) {
14689
- // Capturing the event of of the associated ElementRef <input type="file" #fileInpu
14682
+ // Capturing the event of the associated ElementRef <input type="file" #fileInpu
14690
14683
  if (this.fileInput.nativeElement.contains(event.target)) {
14691
14684
  this.clickInsideTheDocument = true;
14692
14685
  }
@@ -14696,6 +14689,9 @@
14696
14689
  };
14697
14690
  WriteDocumentFieldComponent.prototype.ngOnInit = function () {
14698
14691
  this.secureModeOn = this.appConfig.getDocumentSecureMode();
14692
+ if (this.secureModeOn) {
14693
+ this.subscribeToCaseDetails();
14694
+ }
14699
14695
  this.dialogConfig = initDialog();
14700
14696
  // EUI-3403. The field was not being registered when there was no value and the field
14701
14697
  // itself was not mandatory, which meant that show_conditions would not be evaluated.
@@ -14708,9 +14704,6 @@
14708
14704
  else {
14709
14705
  this.createDocumentForm(document);
14710
14706
  }
14711
- if (this.appConfig.getDocumentSecureMode()) {
14712
- this.subscribeToCaseDetails();
14713
- }
14714
14707
  };
14715
14708
  WriteDocumentFieldComponent.prototype.ngOnDestroy = function () {
14716
14709
  if (this.fileUploadSubscription) {
@@ -14719,8 +14712,11 @@
14719
14712
  if (this.dialogSubscription) {
14720
14713
  this.dialogSubscription.unsubscribe();
14721
14714
  }
14722
- if (this.caseEventSubscription) {
14723
- this.caseEventSubscription.unsubscribe();
14715
+ if (this.caseNotifierSubscription) {
14716
+ this.caseNotifierSubscription.unsubscribe();
14717
+ }
14718
+ if (this.jurisdictionSubs) {
14719
+ this.jurisdictionSubs.unsubscribe();
14724
14720
  }
14725
14721
  };
14726
14722
  WriteDocumentFieldComponent.prototype.isUploadInProgress = function () {
@@ -14772,7 +14768,9 @@
14772
14768
  WriteDocumentFieldComponent.prototype.triggerReplace = function () {
14773
14769
  if (this.confirmReplaceResult === 'Replace') {
14774
14770
  this.openFileDialog();
14771
+ return true;
14775
14772
  }
14773
+ return false;
14776
14774
  };
14777
14775
  WriteDocumentFieldComponent.prototype.getUploadedFileName = function () {
14778
14776
  if (this.uploadedDocument) {
@@ -14807,11 +14805,28 @@
14807
14805
  _this.triggerReplace();
14808
14806
  });
14809
14807
  };
14808
+ // Depending on the context, we can get the case type and jurisdiction from different sources
14809
+ // If we are running an event, the caseNotifier will have the current case
14810
+ // If we are creating a case, the case doesn't exist yet, so the caseNotifier can't help
14811
+ // Instead we can use the eventTrigger to get the case type, and the jurisdiction service to
14812
+ // get the currently selected jurisdiction
14810
14813
  WriteDocumentFieldComponent.prototype.subscribeToCaseDetails = function () {
14811
14814
  var _this = this;
14812
- this.caseEventSubscription = this.caseNotifier.caseView.subscribe({
14815
+ this.caseNotifierSubscription = this.caseNotifier.caseView.subscribe({
14813
14816
  next: function (caseDetails) {
14814
- _this.caseDetails = caseDetails;
14817
+ var _a, _b;
14818
+ _this.caseTypeId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_id;
14819
+ _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;
14820
+ }
14821
+ });
14822
+ this.jurisdictionSubs = this.jurisdictionService.selectedJurisdictionBS.subscribe({
14823
+ next: function (jurisdiction) {
14824
+ if (jurisdiction) {
14825
+ _this.jurisdictionId = jurisdiction.id;
14826
+ if (jurisdiction.currentCaseType) {
14827
+ _this.caseTypeId = jurisdiction.currentCaseType.id;
14828
+ }
14829
+ }
14815
14830
  }
14816
14831
  });
14817
14832
  };
@@ -14875,13 +14890,8 @@
14875
14890
  documentUpload.append('files', selectedFile, selectedFile.name);
14876
14891
  documentUpload.append('classification', 'PUBLIC');
14877
14892
  if (this.appConfig.getDocumentSecureMode()) {
14878
- var caseTypeId = this.caseDetails &&
14879
- this.caseDetails.case_type &&
14880
- this.caseDetails.case_type.id ? this.caseDetails.case_type.id : null;
14881
- var caseTypeJurisdictionId = this.caseDetails &&
14882
- this.caseDetails.case_type &&
14883
- this.caseDetails.case_type.jurisdiction &&
14884
- this.caseDetails.case_type.jurisdiction.id ? this.caseDetails.case_type.jurisdiction.id : null;
14893
+ var caseTypeId = this.caseTypeId ? this.caseTypeId : null;
14894
+ var caseTypeJurisdictionId = this.jurisdictionId ? this.jurisdictionId : null;
14885
14895
  documentUpload.append('caseTypeId', caseTypeId);
14886
14896
  documentUpload.append('jurisdictionId', caseTypeJurisdictionId);
14887
14897
  }
@@ -14929,7 +14939,7 @@
14929
14939
  WriteDocumentFieldComponent.UPLOAD_ERROR_FILE_REQUIRED = 'File required';
14930
14940
  WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE = 'Document upload facility is not available at the moment';
14931
14941
  WriteDocumentFieldComponent.UPLOAD_WAITING_FILE_STATUS = 'Uploading...';
14932
- 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)); };
14942
+ 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)); };
14933
14943
  WriteDocumentFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteDocumentFieldComponent, selectors: [["ccd-write-document-field"]], viewQuery: function WriteDocumentFieldComponent_Query(rf, ctx) {
14934
14944
  if (rf & 1) {
14935
14945
  i0__namespace.ɵɵviewQuery(_c0$N, 1);
@@ -15007,7 +15017,7 @@
15007
15017
  selector: 'ccd-write-document-field',
15008
15018
  templateUrl: './write-document-field.html'
15009
15019
  }]
15010
- }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1__namespace$3.MatDialog }, { type: FileUploadStateService }]; }, { fileInput: [{
15020
+ }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1__namespace$3.MatDialog }, { type: FileUploadStateService }, { type: JurisdictionService }]; }, { fileInput: [{
15011
15021
  type: i0.ViewChild,
15012
15022
  args: ['fileInput', { static: false }]
15013
15023
  }], clickout: [{