@hmcts/ccd-case-ui-toolkit 7.1.32-rc1 → 7.1.32-return-application-task-not-completing

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.
@@ -9396,8 +9396,9 @@ class CaseEditComponent {
9396
9396
  // EXUI-2668 - Ensure description for task includes event ID
9397
9397
  // Note - This is a failsafe for an edge case that may never occur again
9398
9398
  // Description may not include eventId in some cases which may mean task not completed (however this will be easy to check)
9399
+ // In instances of the above taskEventCompletionInfo will be created to block this check from occurring
9399
9400
  this.abstractConfig.logMessage(`checking taskIsForEvent: task ID ${task.id}, task description ${task.description}, event name ${eventDetails.eventId}`);
9400
- return task.case_id === eventDetails.caseId && task.description?.includes(eventDetails.eventId);
9401
+ return task.case_id === eventDetails.caseId && (task.description && task.description.includes(eventDetails.eventId));
9401
9402
  }
9402
9403
  static ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i4.FormBuilder), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(FieldsPurger), i0.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0.ɵɵdirectiveInject(WizardFactoryService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(WindowService), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService), i0.ɵɵdirectiveInject(WorkAllocationService), i0.ɵɵdirectiveInject(AlertService), i0.ɵɵdirectiveInject(AbstractAppConfig), i0.ɵɵdirectiveInject(ReadCookieService)); };
9403
9404
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEditComponent, selectors: [["ccd-case-edit"]], inputs: { eventTrigger: "eventTrigger", submit: "submit", validate: "validate", saveDraft: "saveDraft", caseDetails: "caseDetails" }, outputs: { cancelled: "cancelled", submitted: "submitted" }, features: [i0.ɵɵProvidersFeature([GreyBarService])], decls: 1, vars: 0, template: function CaseEditComponent_Template(rf, ctx) { if (rf & 1) {
@@ -34470,7 +34471,7 @@ class EventStartGuard {
34470
34471
  }
34471
34472
  return of(false);
34472
34473
  }
34473
- checkTaskInEventNotRequired(payload, caseId, taskId) {
34474
+ checkTaskInEventNotRequired(payload, caseId, taskId, eventId, userId) {
34474
34475
  if (!payload || !payload.tasks) {
34475
34476
  return true;
34476
34477
  }
@@ -34500,20 +34501,7 @@ class EventStartGuard {
34500
34501
  else {
34501
34502
  task = tasksAssignedToUser[0];
34502
34503
  }
34503
- const currentLanguage = this.cookieService.getCookie('exui-preferred-language');
34504
- // if one task assigned to user, allow user to complete event
34505
- const storeClientContext = {
34506
- client_context: {
34507
- user_task: {
34508
- task_data: task,
34509
- complete_task: true
34510
- },
34511
- user_language: {
34512
- language: currentLanguage
34513
- }
34514
- }
34515
- };
34516
- this.sessionStorageService.setItem(CaseEditComponent.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
34504
+ this.setClientContextStorage(task, caseId, eventId, userId);
34517
34505
  return true;
34518
34506
  }
34519
34507
  }
@@ -34521,28 +34509,7 @@ class EventStartGuard {
34521
34509
  if (taskId && payload?.tasks?.length > 0) {
34522
34510
  const task = payload.tasks.find((t) => t.id == taskId);
34523
34511
  if (task) {
34524
- // Store task to session
34525
- const taskEventCompletionInfo = {
34526
- caseId: caseId,
34527
- eventId: eventId,
34528
- userId: userId,
34529
- taskId: task.id,
34530
- createdTimestamp: Date.now()
34531
- };
34532
- const currentLanguage = this.cookieService.getCookie('exui-preferred-language');
34533
- const storeClientContext = {
34534
- client_context: {
34535
- user_task: {
34536
- task_data: task,
34537
- complete_task: true
34538
- },
34539
- user_language: {
34540
- language: currentLanguage
34541
- }
34542
- }
34543
- };
34544
- this.sessionStorageService.setItem(CaseEditComponent.TASK_EVENT_COMPLETION_INFO, JSON.stringify(taskEventCompletionInfo));
34545
- this.sessionStorageService.setItem(CaseEditComponent.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
34512
+ this.setClientContextStorage(task, caseId, eventId, userId);
34546
34513
  }
34547
34514
  else {
34548
34515
  removeTaskFromClientContext(this.sessionStorageService);
@@ -34560,9 +34527,34 @@ class EventStartGuard {
34560
34527
  return of(false);
34561
34528
  }
34562
34529
  else {
34563
- return of(this.checkTaskInEventNotRequired(payload, caseId, taskId));
34530
+ return of(this.checkTaskInEventNotRequired(payload, caseId, taskId, eventId, userId));
34564
34531
  }
34565
34532
  }
34533
+ // EXUI-2743 - Make taskEventCompletionInfo always available in session storage with client context
34534
+ setClientContextStorage(task, caseId, eventId, userId) {
34535
+ // Store task to session
34536
+ const taskEventCompletionInfo = {
34537
+ caseId: caseId,
34538
+ eventId: eventId,
34539
+ userId: userId,
34540
+ taskId: task.id,
34541
+ createdTimestamp: Date.now()
34542
+ };
34543
+ const currentLanguage = this.cookieService.getCookie('exui-preferred-language');
34544
+ const storeClientContext = {
34545
+ client_context: {
34546
+ user_task: {
34547
+ task_data: task,
34548
+ complete_task: true
34549
+ },
34550
+ user_language: {
34551
+ language: currentLanguage
34552
+ }
34553
+ }
34554
+ };
34555
+ this.sessionStorageService.setItem(CaseEditComponent.TASK_EVENT_COMPLETION_INFO, JSON.stringify(taskEventCompletionInfo));
34556
+ this.sessionStorageService.setItem(CaseEditComponent.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
34557
+ }
34566
34558
  static ɵfac = function EventStartGuard_Factory(t) { return new (t || EventStartGuard)(i0.ɵɵinject(WorkAllocationService), i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(SessionStorageService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(ReadCookieService)); };
34567
34559
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventStartGuard, factory: EventStartGuard.ɵfac });
34568
34560
  }