@hmcts/ccd-case-ui-toolkit 4.13.8-event-start-task-not-required → 4.13.8-event-start-markdown-changes-next-steps

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.
package/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @hmcts/ccd-case-ui-toolkit - Case UI Toolkit
3
- * @version v4.13.8-event-start-task-not-required
3
+ * @version v4.13.8-event-start-markdown-changes-next-steps
4
4
  * @link undefined
5
5
  * @license MIT
6
6
  */
@@ -26642,10 +26642,10 @@ var EventStartGuard = /** @class */ (function () {
26642
26642
  return rxjs_1.of(false);
26643
26643
  }
26644
26644
  else {
26645
- return rxjs_1.of(this.checkTaskInEventNotRequired(payload, caseId, eventId));
26645
+ return rxjs_1.of(this.checkTaskInEventNotRequired(payload, caseId, taskId));
26646
26646
  }
26647
26647
  };
26648
- EventStartGuard.prototype.checkTaskInEventNotRequired = function (payload, caseId, eventId) {
26648
+ EventStartGuard.prototype.checkTaskInEventNotRequired = function (payload, caseId, taskId) {
26649
26649
  var taskNumber = payload.tasks.length;
26650
26650
  if (taskNumber === 0) {
26651
26651
  // if there are no tasks just carry on
@@ -26661,14 +26661,21 @@ var EventStartGuard = /** @class */ (function () {
26661
26661
  // if no tasks assigned to user carry on
26662
26662
  return true;
26663
26663
  }
26664
- else if (tasksAssignedToUser.length > 1) {
26664
+ else if (tasksAssignedToUser.length > 1 && !taskId) {
26665
26665
  // if more than one task assigned to the user then give multiple tasks error
26666
26666
  this.router.navigate(["/cases/case-details/" + caseId + "/multiple-tasks-exist"]);
26667
26667
  return false;
26668
26668
  }
26669
26669
  else {
26670
+ var task = void 0;
26671
+ if (taskId) {
26672
+ task = payload.tasks.find(function (x) { return x.id === taskId; });
26673
+ }
26674
+ else {
26675
+ task = tasksAssignedToUser[0];
26676
+ }
26670
26677
  // if one task assigned to user, allow user to complete event
26671
- this.sessionStorageService.setItem('taskToComplete', JSON.stringify(tasksAssignedToUser[0]));
26678
+ this.sessionStorageService.setItem('taskToComplete', JSON.stringify(task));
26672
26679
  return true;
26673
26680
  }
26674
26681
  };