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

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
  };
@@ -10213,7 +10205,9 @@
10213
10205
  rawFormValueData[key] = parentField.formatted_value[caseField.id];
10214
10206
  }
10215
10207
  else {
10216
- rawFormValueData[key] = caseField.formatted_value;
10208
+ if (!(caseField.hidden && caseField.retain_hidden_value)) {
10209
+ rawFormValueData[key] = caseField.formatted_value;
10210
+ }
10217
10211
  }
10218
10212
  }
10219
10213
  }
@@ -14675,18 +14669,19 @@
14675
14669
  var _c1$k = function (a0) { return { "form-group-error bottom-30": a0 }; };
14676
14670
  var WriteDocumentFieldComponent = /** @class */ (function (_super) {
14677
14671
  __extends(WriteDocumentFieldComponent, _super);
14678
- function WriteDocumentFieldComponent(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService) {
14672
+ function WriteDocumentFieldComponent(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService, jurisdictionService) {
14679
14673
  var _this = _super.call(this) || this;
14680
14674
  _this.appConfig = appConfig;
14681
14675
  _this.caseNotifier = caseNotifier;
14682
14676
  _this.documentManagement = documentManagement;
14683
14677
  _this.dialog = dialog;
14684
14678
  _this.fileUploadStateService = fileUploadStateService;
14679
+ _this.jurisdictionService = jurisdictionService;
14685
14680
  _this.valid = true;
14686
14681
  return _this;
14687
14682
  }
14688
14683
  WriteDocumentFieldComponent.prototype.clickout = function (event) {
14689
- // Capturing the event of of the associated ElementRef <input type="file" #fileInpu
14684
+ // Capturing the event of the associated ElementRef <input type="file" #fileInpu
14690
14685
  if (this.fileInput.nativeElement.contains(event.target)) {
14691
14686
  this.clickInsideTheDocument = true;
14692
14687
  }
@@ -14696,6 +14691,9 @@
14696
14691
  };
14697
14692
  WriteDocumentFieldComponent.prototype.ngOnInit = function () {
14698
14693
  this.secureModeOn = this.appConfig.getDocumentSecureMode();
14694
+ if (this.secureModeOn) {
14695
+ this.subscribeToCaseDetails();
14696
+ }
14699
14697
  this.dialogConfig = initDialog();
14700
14698
  // EUI-3403. The field was not being registered when there was no value and the field
14701
14699
  // itself was not mandatory, which meant that show_conditions would not be evaluated.
@@ -14708,9 +14706,6 @@
14708
14706
  else {
14709
14707
  this.createDocumentForm(document);
14710
14708
  }
14711
- if (this.appConfig.getDocumentSecureMode()) {
14712
- this.subscribeToCaseDetails();
14713
- }
14714
14709
  };
14715
14710
  WriteDocumentFieldComponent.prototype.ngOnDestroy = function () {
14716
14711
  if (this.fileUploadSubscription) {
@@ -14719,8 +14714,11 @@
14719
14714
  if (this.dialogSubscription) {
14720
14715
  this.dialogSubscription.unsubscribe();
14721
14716
  }
14722
- if (this.caseEventSubscription) {
14723
- this.caseEventSubscription.unsubscribe();
14717
+ if (this.caseNotifierSubscription) {
14718
+ this.caseNotifierSubscription.unsubscribe();
14719
+ }
14720
+ if (this.jurisdictionSubs) {
14721
+ this.jurisdictionSubs.unsubscribe();
14724
14722
  }
14725
14723
  };
14726
14724
  WriteDocumentFieldComponent.prototype.isUploadInProgress = function () {
@@ -14772,7 +14770,9 @@
14772
14770
  WriteDocumentFieldComponent.prototype.triggerReplace = function () {
14773
14771
  if (this.confirmReplaceResult === 'Replace') {
14774
14772
  this.openFileDialog();
14773
+ return true;
14775
14774
  }
14775
+ return false;
14776
14776
  };
14777
14777
  WriteDocumentFieldComponent.prototype.getUploadedFileName = function () {
14778
14778
  if (this.uploadedDocument) {
@@ -14807,11 +14807,28 @@
14807
14807
  _this.triggerReplace();
14808
14808
  });
14809
14809
  };
14810
+ // Depending on the context, we can get the case type and jurisdiction from different sources
14811
+ // If we are running an event, the caseNotifier will have the current case
14812
+ // If we are creating a case, the case doesn't exist yet, so the caseNotifier can't help
14813
+ // Instead we can use the eventTrigger to get the case type, and the jurisdiction service to
14814
+ // get the currently selected jurisdiction
14810
14815
  WriteDocumentFieldComponent.prototype.subscribeToCaseDetails = function () {
14811
14816
  var _this = this;
14812
- this.caseEventSubscription = this.caseNotifier.caseView.subscribe({
14817
+ this.caseNotifierSubscription = this.caseNotifier.caseView.subscribe({
14813
14818
  next: function (caseDetails) {
14814
- _this.caseDetails = caseDetails;
14819
+ var _a, _b;
14820
+ _this.caseTypeId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_id;
14821
+ _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;
14822
+ }
14823
+ });
14824
+ this.jurisdictionSubs = this.jurisdictionService.selectedJurisdictionBS.subscribe({
14825
+ next: function (jurisdiction) {
14826
+ if (jurisdiction) {
14827
+ _this.jurisdictionId = jurisdiction.id;
14828
+ if (jurisdiction.currentCaseType) {
14829
+ _this.caseTypeId = jurisdiction.currentCaseType.id;
14830
+ }
14831
+ }
14815
14832
  }
14816
14833
  });
14817
14834
  };
@@ -14875,13 +14892,8 @@
14875
14892
  documentUpload.append('files', selectedFile, selectedFile.name);
14876
14893
  documentUpload.append('classification', 'PUBLIC');
14877
14894
  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;
14895
+ var caseTypeId = this.caseTypeId ? this.caseTypeId : null;
14896
+ var caseTypeJurisdictionId = this.jurisdictionId ? this.jurisdictionId : null;
14885
14897
  documentUpload.append('caseTypeId', caseTypeId);
14886
14898
  documentUpload.append('jurisdictionId', caseTypeJurisdictionId);
14887
14899
  }
@@ -14929,7 +14941,7 @@
14929
14941
  WriteDocumentFieldComponent.UPLOAD_ERROR_FILE_REQUIRED = 'File required';
14930
14942
  WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE = 'Document upload facility is not available at the moment';
14931
14943
  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)); };
14944
+ 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
14945
  WriteDocumentFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteDocumentFieldComponent, selectors: [["ccd-write-document-field"]], viewQuery: function WriteDocumentFieldComponent_Query(rf, ctx) {
14934
14946
  if (rf & 1) {
14935
14947
  i0__namespace.ɵɵviewQuery(_c0$N, 1);
@@ -15007,7 +15019,7 @@
15007
15019
  selector: 'ccd-write-document-field',
15008
15020
  templateUrl: './write-document-field.html'
15009
15021
  }]
15010
- }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1__namespace$3.MatDialog }, { type: FileUploadStateService }]; }, { fileInput: [{
15022
+ }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1__namespace$3.MatDialog }, { type: FileUploadStateService }, { type: JurisdictionService }]; }, { fileInput: [{
15011
15023
  type: i0.ViewChild,
15012
15024
  args: ['fileInput', { static: false }]
15013
15025
  }], clickout: [{