@hmcts/ccd-case-ui-toolkit 7.3.43-exui-4368-rc-1 → 7.3.43-exui-3229

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.
@@ -6624,7 +6624,6 @@ class LabelSubstitutorDirective {
6624
6624
  contextFields = [];
6625
6625
  formGroup;
6626
6626
  elementsToSubstitute = ['label', 'hint_text'];
6627
- initialLabel;
6628
6627
  initialHintText;
6629
6628
  languageSubscription;
6630
6629
  constructor(fieldsUtils, placeholderService, rpxTranslationPipe, rpxTranslationService) {
@@ -6634,10 +6633,9 @@ class LabelSubstitutorDirective {
6634
6633
  this.rpxTranslationService = rpxTranslationService;
6635
6634
  }
6636
6635
  ngOnInit() {
6637
- this.initialLabel = this.caseField.label;
6638
6636
  this.initialHintText = this.caseField.hint_text;
6639
- this.noCacheProcessing();
6640
6637
  this.caseField.originalLabel = this.caseField.label;
6638
+ this.noCacheProcessing();
6641
6639
  this.formGroup = this.formGroup || new FormGroup({});
6642
6640
  this.languageSubscription = this.rpxTranslationService.language$.pipe(skip(1)).subscribe(() => {
6643
6641
  this.onLanguageChange();
@@ -6660,17 +6658,15 @@ class LabelSubstitutorDirective {
6660
6658
  }
6661
6659
  }
6662
6660
  }
6663
- applySubstitutions(isLanguageChange = false) {
6661
+ applySubstitutions() {
6664
6662
  const fields = this.getReadOnlyAndFormFields();
6665
6663
  if (this.shouldSubstitute('label')) {
6666
6664
  const oldLabel = this.caseField.label;
6667
6665
  const substitutedLabel = this.resolvePlaceholders(fields, this.caseField.label);
6668
6666
  if (oldLabel && oldLabel !== substitutedLabel) {
6669
6667
  // we need to translate the uninterpolated data then substitute the values in translated string
6670
- this.caseField.originalLabel = oldLabel;
6671
- const translated = isLanguageChange && this.rpxTranslationService.language === 'en'
6672
- ? oldLabel
6673
- : this.rpxTranslationPipe.transform(oldLabel);
6668
+ this.caseField.originalLabel = substitutedLabel;
6669
+ const translated = this.rpxTranslationPipe.transform(oldLabel);
6674
6670
  const transSubstitutedLabel = this.resolvePlaceholders(fields, translated);
6675
6671
  this.caseField.label = transSubstitutedLabel;
6676
6672
  this.caseField.isTranslated = this.rpxTranslationService.language === 'cy' && translated !== oldLabel;
@@ -6688,16 +6684,13 @@ class LabelSubstitutorDirective {
6688
6684
  }
6689
6685
  }
6690
6686
  onLanguageChange() {
6691
- this.resetToInitialValues(true);
6692
- this.applySubstitutions(true);
6687
+ this.resetToInitialValues();
6688
+ this.applySubstitutions();
6693
6689
  }
6694
- resetToInitialValues(isLanguageChange = false) {
6695
- if (isLanguageChange && this.caseField?.originalLabel) {
6690
+ resetToInitialValues() {
6691
+ if (this.caseField?.originalLabel) {
6696
6692
  this.caseField.label = this.caseField.originalLabel;
6697
6693
  }
6698
- if (!isLanguageChange && this.initialLabel) {
6699
- this.caseField.label = this.initialLabel;
6700
- }
6701
6694
  if (this.initialHintText) {
6702
6695
  this.caseField.hint_text = this.initialHintText;
6703
6696
  }
@@ -8755,9 +8748,14 @@ class CaseEditWizardGuard {
8755
8748
  }
8756
8749
  goToFirst(wizard, canShowPredicate, route) {
8757
8750
  const firstPage = wizard.firstPage(canShowPredicate);
8758
- // If there’s no specific wizard page called, it makes another navigation to either the first page available or to the submit page
8759
- // TODO should find a way to navigate to target page without going through the whole loop (and make a second call to BE) again
8760
- return this.router.navigate([...this.parentUrlSegments(route), firstPage ? firstPage.id : 'submit'], { queryParams: route.queryParams });
8751
+ // This route transition is an internal wizard redirect used to append the first page id to the URL.
8752
+ // Mark it in navigation state so EventStartGuard can skip duplicate work allocation checks.
8753
+ return this.router.navigate([...this.parentUrlSegments(route), firstPage ? firstPage.id : 'submit'], {
8754
+ queryParams: route.queryParams,
8755
+ state: {
8756
+ [EVENT_START_FIRST_PAGE_REDIRECT]: true
8757
+ }
8758
+ });
8761
8759
  }
8762
8760
  goToSubmit(route) {
8763
8761
  return this.router.navigate([...this.parentUrlSegments(route), 'submit'], { queryParams: route.queryParams });
@@ -9979,6 +9977,7 @@ class CaseEditComponent {
9979
9977
  }] }); })();
9980
9978
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditComponent, { className: "CaseEditComponent", filePath: "lib/shared/components/case-editor/case-edit/case-edit.component.ts", lineNumber: 38 }); })();
9981
9979
 
9980
+ const EVENT_START_FIRST_PAGE_REDIRECT = 'eventStartFirstPageRedirect';
9982
9981
  function convertNonASCIICharacter(character) {
9983
9982
  if (character === '£') {
9984
9983
  // pound sign will be frequently used and works for btoa despite being non-ASCII
@@ -37465,6 +37464,10 @@ class EventStartGuard {
37465
37464
  }
37466
37465
  }
37467
37466
  return caseDataObservable.pipe(switchMap(() => {
37467
+ if (this.shouldSkipDuplicateWorkAllocationCall()) {
37468
+ this.abstractConfig.logMessage(`EventStartGuard: skipping duplicate work allocation call for caseId ${caseId} and eventId ${eventId}`);
37469
+ return of(true);
37470
+ }
37468
37471
  if (this.jurisdiction && this.caseType) {
37469
37472
  if (this.caseId === caseId) {
37470
37473
  return this.workAllocationService.getTasksByCaseIdAndEventId(eventId, caseId, this.caseType, this.jurisdiction)
@@ -37478,6 +37481,9 @@ class EventStartGuard {
37478
37481
  return of(false);
37479
37482
  }));
37480
37483
  }
37484
+ shouldSkipDuplicateWorkAllocationCall() {
37485
+ return this.router.getCurrentNavigation()?.extras?.state?.[EVENT_START_FIRST_PAGE_REDIRECT] === true;
37486
+ }
37481
37487
  checkTaskInEventNotRequired(payload, caseId, taskId, eventId, userId) {
37482
37488
  if (!payload || !payload.tasks) {
37483
37489
  return true;