@hmcts/ccd-case-ui-toolkit 7.3.54-body-parser-update → 7.3.54-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.
@@ -8876,9 +8876,14 @@ class CaseEditWizardGuard {
8876
8876
  }
8877
8877
  goToFirst(wizard, canShowPredicate, route) {
8878
8878
  const firstPage = wizard.firstPage(canShowPredicate);
8879
- // If there’s no specific wizard page called, it makes another navigation to either the first page available or to the submit page
8880
- // TODO should find a way to navigate to target page without going through the whole loop (and make a second call to BE) again
8881
- return this.router.navigate([...this.parentUrlSegments(route), firstPage ? firstPage.id : 'submit'], { queryParams: route.queryParams });
8879
+ // This route transition is an internal wizard redirect used to append the first page id to the URL.
8880
+ // Mark it in navigation state so EventStartGuard can skip duplicate work allocation checks.
8881
+ return this.router.navigate([...this.parentUrlSegments(route), firstPage ? firstPage.id : 'submit'], {
8882
+ queryParams: route.queryParams,
8883
+ state: {
8884
+ [EVENT_START_FIRST_PAGE_REDIRECT]: true
8885
+ }
8886
+ });
8882
8887
  }
8883
8888
  goToSubmit(route) {
8884
8889
  return this.router.navigate([...this.parentUrlSegments(route), 'submit'], { queryParams: route.queryParams });
@@ -8918,10 +8923,10 @@ class CaseworkerService {
8918
8923
  this.appConfig = appConfig;
8919
8924
  this.errorService = errorService;
8920
8925
  }
8921
- getUserByIdamId(idamId) {
8922
- const url = `${this.appConfig.getWorkAllocationApiUrl()}/caseworker/getUserByIdamId`;
8926
+ getCaseworkers(serviceId) {
8927
+ const url = `${this.appConfig.getWorkAllocationApiUrl()}/caseworker/getUsersByServiceName`;
8923
8928
  return this.http
8924
- .post(url, idamId)
8929
+ .post(url, { services: [serviceId] })
8925
8930
  .pipe(catchError(error => {
8926
8931
  this.errorService.setError(error);
8927
8932
  return throwError(error);
@@ -10101,6 +10106,7 @@ class CaseEditComponent {
10101
10106
  }] }); })();
10102
10107
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditComponent, { className: "CaseEditComponent", filePath: "lib/shared/components/case-editor/case-edit/case-edit.component.ts", lineNumber: 39 }); })();
10103
10108
 
10109
+ const EVENT_START_FIRST_PAGE_REDIRECT = 'eventStartFirstPageRedirect';
10104
10110
  function convertNonASCIICharacter(character) {
10105
10111
  if (character === '£') {
10106
10112
  // pound sign will be frequently used and works for btoa despite being non-ASCII
@@ -12461,9 +12467,12 @@ class CaseEventCompletionTaskReassignedComponent {
12461
12467
  this.jurisdiction = task.jurisdiction;
12462
12468
  this.caseType = task.case_type_id;
12463
12469
  // Current user is a caseworker?
12464
- this.caseworkerSubscription = this.caseworkerService.getUserByIdamId(task.assignee).subscribe(caseworker => {
12465
- if (caseworker) {
12466
- this.assignedUserName = `${caseworker.firstName} ${caseworker.lastName}`;
12470
+ this.caseworkerSubscription = this.caseworkerService.getCaseworkers(task.jurisdiction).subscribe(result => {
12471
+ if (result && result[0].service === task.jurisdiction && result[0].caseworkers) {
12472
+ const caseworker = result[0].caseworkers.find(x => x.idamId === task.assignee);
12473
+ if (caseworker) {
12474
+ this.assignedUserName = `${caseworker.firstName} ${caseworker.lastName}`;
12475
+ }
12467
12476
  }
12468
12477
  if (!this.assignedUserName) {
12469
12478
  // Current user is a judicial user?
@@ -37572,9 +37581,12 @@ class TaskAssignedComponent {
37572
37581
  // Current user is a caseworker?
37573
37582
  this.jurisdiction = this.task.jurisdiction;
37574
37583
  this.caseType = this.task.case_type_id;
37575
- this.caseworkerSubscription = this.caseworkerService.getUserByIdamId(this.task.assignee).subscribe(caseworker => {
37576
- if (caseworker) {
37577
- this.assignedUserName = `${caseworker.firstName} ${caseworker.lastName}`;
37584
+ this.caseworkerSubscription = this.caseworkerService.getCaseworkers(this.task.jurisdiction).subscribe(result => {
37585
+ if (result && result[0].service === this.task.jurisdiction && result[0].caseworkers) {
37586
+ const caseworker = result[0].caseworkers.find(x => x.idamId === this.task.assignee);
37587
+ if (caseworker) {
37588
+ this.assignedUserName = `${caseworker.firstName} ${caseworker.lastName}`;
37589
+ }
37578
37590
  }
37579
37591
  if (!this.assignedUserName) {
37580
37592
  // Current user is a judicial user?
@@ -37866,6 +37878,10 @@ class EventStartGuard {
37866
37878
  }
37867
37879
  }
37868
37880
  return caseDataObservable.pipe(switchMap(() => {
37881
+ if (this.shouldSkipDuplicateWorkAllocationCall()) {
37882
+ this.abstractConfig.logMessage(`EventStartGuard: skipping duplicate work allocation call for caseId ${caseId} and eventId ${eventId}`);
37883
+ return of(true);
37884
+ }
37869
37885
  if (this.jurisdiction && this.caseType) {
37870
37886
  if (this.caseId === caseId) {
37871
37887
  return this.workAllocationService.getTasksByCaseIdAndEventId(eventId, caseId, this.caseType, this.jurisdiction)
@@ -37879,6 +37895,9 @@ class EventStartGuard {
37879
37895
  return of(false);
37880
37896
  }));
37881
37897
  }
37898
+ shouldSkipDuplicateWorkAllocationCall() {
37899
+ return this.router.getCurrentNavigation()?.extras?.state?.[EVENT_START_FIRST_PAGE_REDIRECT] === true;
37900
+ }
37882
37901
  checkTaskInEventNotRequired(payload, caseId, taskId, eventId, userId) {
37883
37902
  if (!payload || !payload.tasks) {
37884
37903
  return true;