@hmcts/ccd-case-ui-toolkit 7.2.41-remove-ld-feature-flags → 7.2.42-exui-2916

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 (19) hide show
  1. package/esm2022/lib/app.config.mjs +5 -2
  2. package/esm2022/lib/shared/components/case-viewer/case-viewer.component.mjs +10 -9
  3. package/esm2022/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder-sort/case-file-view-folder-sort.component.mjs +8 -10
  4. package/esm2022/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder.component.mjs +3 -5
  5. package/esm2022/lib/shared/components/palette/document/write-document-field.component.mjs +7 -11
  6. package/esm2022/lib/shared/directives/substitutor/label-substitutor.directive.mjs +30 -7
  7. package/esm2022/lib/shared/services/document-management/document-management.service.mjs +2 -8
  8. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +57 -44
  9. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  10. package/lib/app.config.d.ts +2 -3
  11. package/lib/app.config.d.ts.map +1 -1
  12. package/lib/shared/components/case-viewer/case-viewer.component.d.ts.map +1 -1
  13. package/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder-sort/case-file-view-folder-sort.component.d.ts.map +1 -1
  14. package/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder.component.d.ts.map +1 -1
  15. package/lib/shared/components/palette/document/write-document-field.component.d.ts.map +1 -1
  16. package/lib/shared/directives/substitutor/label-substitutor.directive.d.ts +7 -2
  17. package/lib/shared/directives/substitutor/label-substitutor.directive.d.ts.map +1 -1
  18. package/lib/shared/services/document-management/document-management.service.d.ts.map +1 -1
  19. package/package.json +1 -1
@@ -1245,6 +1245,9 @@ class AbstractAppConfig {
1245
1245
  getWAServiceConfig() {
1246
1246
  return undefined;
1247
1247
  }
1248
+ getAccessManagementMode() {
1249
+ return undefined;
1250
+ }
1248
1251
  getAccessManagementBasicViewMock() {
1249
1252
  return undefined;
1250
1253
  }
@@ -1305,6 +1308,7 @@ class CaseEditorConfig {
1305
1308
  work_allocation_api_url;
1306
1309
  user_info_api_url;
1307
1310
  wa_service_config;
1311
+ access_management_mode;
1308
1312
  access_management_basic_view_mock;
1309
1313
  access_management_request_review_mock;
1310
1314
  location_ref_api_url;
@@ -1317,7 +1321,6 @@ class CaseEditorConfig {
1317
1321
  case_flags_refdata_api_url;
1318
1322
  rd_common_data_api_url;
1319
1323
  case_data_store_api_url;
1320
- enable_case_file_view_version_1_1;
1321
1324
  icp_enabled;
1322
1325
  icp_jurisdictions;
1323
1326
  events_to_hide;
@@ -6599,21 +6602,33 @@ class LabelSubstitutorDirective {
6599
6602
  fieldsUtils;
6600
6603
  placeholderService;
6601
6604
  rpxTranslationPipe;
6605
+ rpxTranslationService;
6602
6606
  caseField;
6603
6607
  contextFields = [];
6604
6608
  formGroup;
6605
6609
  elementsToSubstitute = ['label', 'hint_text'];
6606
6610
  initialLabel;
6607
6611
  initialHintText;
6608
- constructor(fieldsUtils, placeholderService, rpxTranslationPipe) {
6612
+ languageSubscription;
6613
+ constructor(fieldsUtils, placeholderService, rpxTranslationPipe, rpxTranslationService) {
6609
6614
  this.fieldsUtils = fieldsUtils;
6610
6615
  this.placeholderService = placeholderService;
6611
6616
  this.rpxTranslationPipe = rpxTranslationPipe;
6617
+ this.rpxTranslationService = rpxTranslationService;
6612
6618
  }
6613
6619
  ngOnInit() {
6614
6620
  this.initialLabel = this.caseField.label;
6615
6621
  this.initialHintText = this.caseField.hint_text;
6616
6622
  this.formGroup = this.formGroup || new FormGroup({});
6623
+ this.languageSubscription = this.rpxTranslationService.language$.subscribe(() => {
6624
+ // timeout is required to prevent race conditions with translation pipe
6625
+ setTimeout(() => {
6626
+ this.onLanguageChange();
6627
+ }, 100);
6628
+ });
6629
+ this.applySubstitutions();
6630
+ }
6631
+ applySubstitutions() {
6617
6632
  const fields = this.getReadOnlyAndFormFields();
6618
6633
  if (this.shouldSubstitute('label')) {
6619
6634
  const oldLabel = this.caseField.label;
@@ -6623,7 +6638,7 @@ class LabelSubstitutorDirective {
6623
6638
  const translated = this.rpxTranslationPipe.transform(oldLabel);
6624
6639
  const transSubstitutedLabel = this.resolvePlaceholders(fields, translated);
6625
6640
  this.caseField.label = transSubstitutedLabel;
6626
- this.caseField.isTranslated = true;
6641
+ this.caseField.isTranslated = this.rpxTranslationService.language === 'cy';
6627
6642
  }
6628
6643
  else {
6629
6644
  this.caseField.label = substitutedLabel;
@@ -6637,13 +6652,24 @@ class LabelSubstitutorDirective {
6637
6652
  this.caseField.value = this.resolvePlaceholders(fields, this.caseField.value);
6638
6653
  }
6639
6654
  }
6640
- ngOnDestroy() {
6655
+ onLanguageChange() {
6656
+ this.resetToInitialValues();
6657
+ this.applySubstitutions();
6658
+ }
6659
+ resetToInitialValues() {
6641
6660
  if (this.initialLabel) {
6642
6661
  this.caseField.label = this.initialLabel;
6643
6662
  }
6644
6663
  if (this.initialHintText) {
6645
6664
  this.caseField.hint_text = this.initialHintText;
6646
6665
  }
6666
+ this.caseField.isTranslated = false;
6667
+ }
6668
+ ngOnDestroy() {
6669
+ this.resetToInitialValues();
6670
+ if (this.languageSubscription) {
6671
+ this.languageSubscription.unsubscribe();
6672
+ }
6647
6673
  }
6648
6674
  shouldSubstitute(element) {
6649
6675
  return this.elementsToSubstitute.find(e => e === element) !== undefined;
@@ -6670,13 +6696,13 @@ class LabelSubstitutorDirective {
6670
6696
  resolvePlaceholders(fields, stringToResolve) {
6671
6697
  return this.placeholderService.resolvePlaceholders(fields, stringToResolve);
6672
6698
  }
6673
- static ɵfac = function LabelSubstitutorDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LabelSubstitutorDirective)(i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(PlaceholderService), i0.ɵɵdirectiveInject(i1.RpxTranslatePipe)); };
6699
+ static ɵfac = function LabelSubstitutorDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LabelSubstitutorDirective)(i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(PlaceholderService), i0.ɵɵdirectiveInject(i1.RpxTranslatePipe), i0.ɵɵdirectiveInject(i1.RpxTranslationService)); };
6674
6700
  static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: LabelSubstitutorDirective, selectors: [["", "ccdLabelSubstitutor", ""]], inputs: { caseField: "caseField", contextFields: "contextFields", formGroup: "formGroup", elementsToSubstitute: "elementsToSubstitute" } });
6675
6701
  }
6676
6702
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LabelSubstitutorDirective, [{
6677
6703
  type: Directive,
6678
6704
  args: [{ selector: '[ccdLabelSubstitutor]' }]
6679
- }], () => [{ type: FieldsUtils }, { type: PlaceholderService }, { type: i1.RpxTranslatePipe }], { caseField: [{
6705
+ }], () => [{ type: FieldsUtils }, { type: PlaceholderService }, { type: i1.RpxTranslatePipe }, { type: i1.RpxTranslationService }], { caseField: [{
6680
6706
  type: Input
6681
6707
  }], contextFields: [{
6682
6708
  type: Input
@@ -7402,13 +7428,7 @@ class DocumentManagementService {
7402
7428
  isDocumentSecureModeEnabled() {
7403
7429
  const documentSecureModeCaseTypeExclusions = this.appConfig.getCdamExclusionList()?.split(',');
7404
7430
  const isDocumentOnExclusionList = documentSecureModeCaseTypeExclusions?.includes(this.caseTypeId);
7405
- const documentSecureModeEnabled = this.appConfig.getDocumentSecureMode();
7406
- // if the documentSecureModeEnabled is false, return false
7407
- if (!documentSecureModeEnabled) {
7408
- return false;
7409
- }
7410
- // if the documentSecureModeEnabled is true, and the case is not in the exclusion list, return true
7411
- if (documentSecureModeEnabled && !isDocumentOnExclusionList) {
7431
+ if (!isDocumentOnExclusionList) {
7412
7432
  return true;
7413
7433
  }
7414
7434
  // if documentSecureModeEnabled is true, and case is in the exclusion list, return false
@@ -15410,9 +15430,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
15410
15430
  if (this.uploadedDocument) {
15411
15431
  return this.uploadedDocument.get(WriteDocumentFieldComponent.DOCUMENT_FILENAME).value;
15412
15432
  }
15413
- else {
15414
- return undefined;
15415
- }
15433
+ return undefined;
15416
15434
  }
15417
15435
  resetUpload() {
15418
15436
  this.selectedFile = null;
@@ -15433,7 +15451,7 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
15433
15451
  }
15434
15452
  openDialog(dialogConfig) {
15435
15453
  const dialogRef = this.dialog.open(DocumentDialogComponent, dialogConfig);
15436
- this.dialogSubscription = dialogRef.beforeClosed().subscribe(result => {
15454
+ this.dialogSubscription = dialogRef.beforeClosed().subscribe((result) => {
15437
15455
  this.confirmReplaceResult = result;
15438
15456
  this.triggerReplace();
15439
15457
  });
@@ -15544,12 +15562,10 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
15544
15562
  const documentUpload = new FormData();
15545
15563
  documentUpload.append('files', selectedFile, selectedFile.name);
15546
15564
  documentUpload.append('classification', 'PUBLIC');
15547
- if (this.appConfig.getDocumentSecureMode()) {
15548
- const caseTypeId = this.caseTypeId ? this.caseTypeId : null;
15549
- const caseTypeJurisdictionId = this.jurisdictionId ? this.jurisdictionId : null;
15550
- documentUpload.append('caseTypeId', caseTypeId);
15551
- documentUpload.append('jurisdictionId', caseTypeJurisdictionId);
15552
- }
15565
+ const caseTypeId = this.caseTypeId ? this.caseTypeId : null;
15566
+ const caseTypeJurisdictionId = this.jurisdictionId ? this.jurisdictionId : null;
15567
+ documentUpload.append('caseTypeId', caseTypeId);
15568
+ documentUpload.append('jurisdictionId', caseTypeJurisdictionId);
15553
15569
  return documentUpload;
15554
15570
  }
15555
15571
  handleDocumentUploadResult(result) {
@@ -24776,20 +24792,18 @@ class CaseFileViewFolderSortComponent {
24776
24792
  sortDescending = new EventEmitter();
24777
24793
  overlayMenuItems = [
24778
24794
  { actionText: 'A to Z ascending', iconSrc: '/assets/img/sort/sort-down-arrow.svg', actionFn: () => this.sortAscending.emit(CaseFileViewSortColumns.DOCUMENT_NAME) },
24779
- { actionText: 'Z to A descending', iconSrc: '/assets/img/sort/sort-up-arrow.svg', actionFn: () => this.sortDescending.emit(CaseFileViewSortColumns.DOCUMENT_NAME) },
24795
+ { actionText: 'Z to A descending', iconSrc: '/assets/img/sort/sort-up-arrow.svg', actionFn: () => this.sortDescending.emit(CaseFileViewSortColumns.DOCUMENT_NAME) }
24780
24796
  ];
24781
24797
  constructor(appConfig) {
24782
24798
  this.appConfig = appConfig;
24783
24799
  }
24784
24800
  ngOnInit() {
24785
- if (this.appConfig.getEnableCaseFileViewVersion1_1()) {
24786
- this.overlayMenuItems = [
24787
- { actionText: 'A to Z ascending', iconSrc: '/assets/img/sort/sort-down-arrow.svg', actionFn: () => this.sortAscending.emit(CaseFileViewSortColumns.DOCUMENT_NAME) },
24788
- { actionText: 'Z to A descending', iconSrc: '/assets/img/sort/sort-up-arrow.svg', actionFn: () => this.sortDescending.emit(CaseFileViewSortColumns.DOCUMENT_NAME) },
24789
- { actionText: 'Recent first', iconSrc: '/assets/img/sort/sort-down-arrow.svg', actionFn: () => this.sortDescending.emit(CaseFileViewSortColumns.DOCUMENT_UPLOAD_TIMESTAMP) },
24790
- { actionText: 'Oldest first', iconSrc: '/assets/img/sort/sort-up-arrow.svg', actionFn: () => this.sortAscending.emit(CaseFileViewSortColumns.DOCUMENT_UPLOAD_TIMESTAMP) },
24791
- ];
24792
- }
24801
+ this.overlayMenuItems = [
24802
+ { actionText: 'A to Z ascending', iconSrc: '/assets/img/sort/sort-down-arrow.svg', actionFn: () => this.sortAscending.emit(CaseFileViewSortColumns.DOCUMENT_NAME) },
24803
+ { actionText: 'Z to A descending', iconSrc: '/assets/img/sort/sort-up-arrow.svg', actionFn: () => this.sortDescending.emit(CaseFileViewSortColumns.DOCUMENT_NAME) },
24804
+ { actionText: 'Recent first', iconSrc: '/assets/img/sort/sort-down-arrow.svg', actionFn: () => this.sortDescending.emit(CaseFileViewSortColumns.DOCUMENT_UPLOAD_TIMESTAMP) },
24805
+ { actionText: 'Oldest first', iconSrc: '/assets/img/sort/sort-up-arrow.svg', actionFn: () => this.sortAscending.emit(CaseFileViewSortColumns.DOCUMENT_UPLOAD_TIMESTAMP) }
24806
+ ];
24793
24807
  }
24794
24808
  static ɵfac = function CaseFileViewFolderSortComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaseFileViewFolderSortComponent)(i0.ɵɵdirectiveInject(AbstractAppConfig)); };
24795
24809
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseFileViewFolderSortComponent, selectors: [["ccd-case-file-view-folder-sort"]], outputs: { sortAscending: "sortAscending", sortDescending: "sortDescending" }, decls: 3, vars: 3, consts: [[3, "isOpenChange", "title", "menuItems", "isOpen"], ["trigger", ""], ["src", "/assets/img/sort/sort-arrows.svg", "alt", "Sort Arrows", 1, "sort-button-icon"]], template: function CaseFileViewFolderSortComponent_Template(rf, ctx) { if (rf & 1) {
@@ -25188,8 +25202,7 @@ class CaseFileViewFolderComponent {
25188
25202
  documentTreeNode.document_filename = document.document_filename;
25189
25203
  documentTreeNode.document_binary_url = document.document_binary_url;
25190
25204
  documentTreeNode.attribute_path = document.attribute_path;
25191
- documentTreeNode.upload_timestamp = this.appConfig.getEnableCaseFileViewVersion1_1()
25192
- && document.upload_timestamp ? document.upload_timestamp.toString() : '';
25205
+ documentTreeNode.upload_timestamp = document.upload_timestamp ? document.upload_timestamp.toString() : '';
25193
25206
  documentsToReturn.push(documentTreeNode);
25194
25207
  });
25195
25208
  return documentsToReturn;
@@ -25203,8 +25216,7 @@ class CaseFileViewFolderComponent {
25203
25216
  documentTreeNode.document_filename = document.document_filename;
25204
25217
  documentTreeNode.document_binary_url = document.document_binary_url;
25205
25218
  documentTreeNode.attribute_path = document.attribute_path;
25206
- documentTreeNode.upload_timestamp = this.appConfig.getEnableCaseFileViewVersion1_1()
25207
- && document.upload_timestamp ? document.upload_timestamp.toString() : '';
25219
+ documentTreeNode.upload_timestamp = document.upload_timestamp ? document.upload_timestamp.toString() : '';
25208
25220
  documents.push(documentTreeNode);
25209
25221
  });
25210
25222
  const uncategorisedNode = new DocumentTreeNode();
@@ -36185,7 +36197,7 @@ class CaseViewerComponent {
36185
36197
  this.setUserAccessType(this.caseDetails);
36186
36198
  }
36187
36199
  else {
36188
- this.caseSubscription = this.caseNotifier.caseView.subscribe((caseDetails) => {
36200
+ this.caseSubscription = this.caseNotifier.caseView.subscribe(caseDetails => {
36189
36201
  console.info('Setting the case into case viewer component as retrieved from XHR request.');
36190
36202
  this.caseDetails = caseDetails;
36191
36203
  this.setUserAccessType(this.caseDetails);
@@ -36194,8 +36206,8 @@ class CaseViewerComponent {
36194
36206
  }
36195
36207
  setUserAccessType(caseDetails) {
36196
36208
  if (caseDetails && Array.isArray(caseDetails.metadataFields)) {
36197
- const accessProcess = caseDetails.metadataFields.find((metadataField) => metadataField.id === CaseViewerComponent.METADATA_FIELD_ACCESS_PROCESS_ID);
36198
- const accessGranted = caseDetails.metadataFields.find((metadataField) => metadataField.id === CaseViewerComponent.METADATA_FIELD_ACCESS_GRANTED_ID);
36209
+ const accessProcess = caseDetails.metadataFields.find(metadataField => metadataField.id === CaseViewerComponent.METADATA_FIELD_ACCESS_PROCESS_ID);
36210
+ const accessGranted = caseDetails.metadataFields.find(metadataField => metadataField.id === CaseViewerComponent.METADATA_FIELD_ACCESS_GRANTED_ID);
36199
36211
  this.accessGranted = accessGranted ? accessGranted.value !== CaseViewerComponent.BASIC_USER_ACCESS_TYPES : false;
36200
36212
  this.userAccessType = accessProcess ? accessProcess.value : null;
36201
36213
  }
@@ -36204,7 +36216,10 @@ class CaseViewerComponent {
36204
36216
  return !!this.caseDetails;
36205
36217
  }
36206
36218
  hasStandardAccess() {
36207
- return !this.accessGranted ? CaseViewerComponent.NON_STANDARD_USER_ACCESS_TYPES.indexOf(this.userAccessType) === -1 : true;
36219
+ const featureToggleOn = this.appConfig.getAccessManagementMode();
36220
+ return featureToggleOn ?
36221
+ !this.accessGranted ? CaseViewerComponent.NON_STANDARD_USER_ACCESS_TYPES.indexOf(this.userAccessType) === -1 : true
36222
+ : true;
36208
36223
  }
36209
36224
  suffixDuplicateTabs(tabs) {
36210
36225
  const count = {};
@@ -36215,12 +36230,10 @@ class CaseViewerComponent {
36215
36230
  item = tabs[i].label;
36216
36231
  itemCount = count[item];
36217
36232
  itemCount = count[item] = (itemCount == null ? 1 : itemCount + 1);
36218
- if (count[item] > 1) {
36233
+ if (count[item] > 1)
36219
36234
  tabs[i].label = tabs[i].label + Array(count[item] - 1).fill('_').join('');
36220
- }
36221
- else {
36235
+ else
36222
36236
  firstOccurences[item] = i;
36223
- }
36224
36237
  }
36225
36238
  return tabs;
36226
36239
  }