@hmcts/ccd-case-ui-toolkit 4.12.9-task-event-completion → 4.12.10-task-event-completion

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/RELEASE-NOTES.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ### Version 4.12.0
4
4
  Add refunds functionality
5
5
 
6
- ### Version 4.12.9-task-event-completion"
6
+ ### Version 4.12.10-task-event-completion"
7
7
  **Task event completion and state machine** Task event completion and state machine
8
8
 
9
9
  ### Version 4.7.6-tab-not-defined-error"
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.12.9-task-event-completion
3
+ * @version v4.12.10-task-event-completion
4
4
  * @link undefined
5
5
  * @license MIT
6
6
  */
@@ -21261,16 +21261,19 @@ var CasesService = /** @class */ (function () {
21261
21261
  });
21262
21262
  };
21263
21263
  CasesService.prototype.processTasksOnSuccess = function (caseData, eventData) {
21264
- // This is used a feature toggle to
21265
- // control the work allocation
21266
- if (this.appConfig.getWorkAllocationApiUrl() && !this.isPuiCaseManager()) {
21267
- this.workAllocationService.completeAppropriateTask(caseData.id, eventData.id, caseData.jurisdiction, caseData.case_type)
21268
- .subscribe(function () {
21269
- // Success. Do nothing.
21270
- }, function (error) {
21271
- // Show an appropriate warning about something that went wrong.
21272
- console.warn('Could not process tasks for this case event', error);
21273
- });
21264
+ // The following code is work allocation 1 related
21265
+ if (this.appConfig.getWorkAllocationApiUrl().toLowerCase() === 'workallocation') {
21266
+ // This is used a feature toggle to
21267
+ // control the work allocation
21268
+ if (!this.isPuiCaseManager()) {
21269
+ this.workAllocationService.completeAppropriateTask(caseData.id, eventData.id, caseData.jurisdiction, caseData.case_type)
21270
+ .subscribe(function () {
21271
+ // Success. Do nothing.
21272
+ }, function (error) {
21273
+ // Show an appropriate warning about something that went wrong.
21274
+ console.warn('Could not process tasks for this case event', error);
21275
+ });
21276
+ }
21274
21277
  }
21275
21278
  };
21276
21279
  /*
@@ -21437,8 +21440,25 @@ var EventCompletionStateMachineService = /** @class */ (function () {
21437
21440
  EventCompletionStateMachineService.prototype.entryActionForStateCompleteEventAndTask = function (state, context) {
21438
21441
  // Trigger final state to complete processing of state machine
21439
21442
  state.trigger(domain_1.EventCompletionStates.Final);
21440
- // Emit event to parent component
21441
- context.component.eventCanBeCompleted.emit(true);
21443
+ var taskStr = context.sessionStorageService.getItem('taskToComplete');
21444
+ if (taskStr) {
21445
+ // Task is in session storage
21446
+ var task = JSON.parse(taskStr);
21447
+ // Task already assigned to current user, just complete task
21448
+ context.workAllocationService.completeTask(task.id).subscribe(function (response) {
21449
+ // Emit event can be completed event
21450
+ context.component.eventCanBeCompleted.emit(true);
21451
+ }, function (error) {
21452
+ // Emit event cannot be completed event
21453
+ context.component.eventCanBeCompleted.emit(false);
21454
+ context.alertService.error(error.message);
21455
+ return rxjs_1.throwError(error);
21456
+ });
21457
+ }
21458
+ else {
21459
+ // Emit event cannot be completed event
21460
+ context.component.eventCanBeCompleted.emit(false);
21461
+ }
21442
21462
  };
21443
21463
  EventCompletionStateMachineService.prototype.entryActionForStateTaskAssignedToAnotherUser = function (state, context) {
21444
21464
  // Trigger final state to complete processing of state machine
@@ -26600,9 +26620,8 @@ var EventStartStateMachineService = /** @class */ (function () {
26600
26620
  context.router.navigate(["/cases/case-details/" + context.caseId + "/multiple-tasks-exist"], { relativeTo: context.route });
26601
26621
  };
26602
26622
  EventStartStateMachineService.prototype.finalAction = function (state) {
26603
- // TODO: Perform final actions, the state machine finished running
26604
- console.log('FINAL action here', state);
26605
- console.log('State is complete', state.isComplete);
26623
+ // Final actions can be performed here, the state machine finished running
26624
+ console.log('FINAL', state);
26606
26625
  };
26607
26626
  EventStartStateMachineService.prototype.addTransitionsForStateCheckForMatchingTasks = function () {
26608
26627
  // No tasks