@hmcts/ccd-case-ui-toolkit 4.12.6 → 4.12.7-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/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.6
3
+ * @version vv4.12.7-task-event-completion
4
4
  * @link undefined
5
5
  * @license MIT
6
6
  */
@@ -21990,8 +21990,8 @@ var WorkAllocationService = /** @class */ (function () {
21990
21990
  * @param eventId The ID of the event to find tasks for.
21991
21991
  * @param caseId The ID of the case to find tasks for.
21992
21992
  */
21993
- WorkAllocationService.prototype.getTasksByCaseIdAndEventId = function (eventId, caseId) {
21994
- return this.http.get(this.appConfig.getWorkAllocationApiUrl() + "/case/tasks/" + caseId + "/event/" + eventId);
21993
+ WorkAllocationService.prototype.getTasksByCaseIdAndEventId = function (eventId, caseId, caseType, jurisdiction) {
21994
+ return this.http.get(this.appConfig.getWorkAllocationApiUrl() + "/case/tasks/" + caseId + "/event/" + eventId + "/caseType/" + caseType + "/jurisdiction/" + jurisdiction);
21995
21995
  };
21996
21996
  /**
21997
21997
  * Call the API to get a task
@@ -26154,11 +26154,13 @@ var rxjs_1 = __webpack_require__(87318);
26154
26154
  var operators_1 = __webpack_require__(19443);
26155
26155
  var case_editor_1 = __webpack_require__(27070);
26156
26156
  var app_config_1 = __webpack_require__(35185);
26157
+ var services_1 = __webpack_require__(65010);
26157
26158
  var EventStartGuard = /** @class */ (function () {
26158
- function EventStartGuard(workAllocationService, router, appConfig) {
26159
+ function EventStartGuard(workAllocationService, router, appConfig, sessionStorageService) {
26159
26160
  this.workAllocationService = workAllocationService;
26160
26161
  this.router = router;
26161
26162
  this.appConfig = appConfig;
26163
+ this.sessionStorageService = sessionStorageService;
26162
26164
  }
26163
26165
  EventStartGuard.prototype.canActivate = function (route) {
26164
26166
  var _this = this;
@@ -26169,10 +26171,16 @@ var EventStartGuard = /** @class */ (function () {
26169
26171
  var taskId_1 = route.queryParams['tid'];
26170
26172
  // TODO: NavigationExtras should be used once Angular upgrade changes have been incorporated
26171
26173
  var isComplete = route.queryParams['isComplete'];
26172
- if (isComplete) {
26173
- return rxjs_1.of(true);
26174
+ var caseInfoStr = this.sessionStorageService.getItem('caseInfo');
26175
+ if (caseInfoStr) {
26176
+ var caseInfo = JSON.parse(caseInfoStr);
26177
+ if (caseInfo && caseInfo.cid === caseId_1) {
26178
+ if (isComplete) {
26179
+ return rxjs_1.of(true);
26180
+ }
26181
+ return this.workAllocationService.getTasksByCaseIdAndEventId(eventId_1, caseId_1, caseInfo.caseType, caseInfo.jurisdiction).pipe(operators_1.switchMap(function (payload) { return _this.checkForTasks(payload, caseId_1, eventId_1, taskId_1); }));
26182
+ }
26174
26183
  }
26175
- return this.workAllocationService.getTasksByCaseIdAndEventId(eventId_1, caseId_1).pipe(operators_1.switchMap(function (payload) { return _this.checkForTasks(payload, caseId_1, eventId_1, taskId_1); }));
26176
26184
  }
26177
26185
  else {
26178
26186
  // Checks not required, return true by default for Work Allocation 1
@@ -26190,7 +26198,8 @@ var EventStartGuard = /** @class */ (function () {
26190
26198
  core_1.Injectable(),
26191
26199
  __metadata("design:paramtypes", [case_editor_1.WorkAllocationService,
26192
26200
  router_1.Router,
26193
- app_config_1.AbstractAppConfig])
26201
+ app_config_1.AbstractAppConfig,
26202
+ services_1.SessionStorageService])
26194
26203
  ], EventStartGuard);
26195
26204
  return EventStartGuard;
26196
26205
  }());
@@ -26411,19 +26420,26 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
26411
26420
  var core_1 = __webpack_require__(57208);
26412
26421
  var case_editor_1 = __webpack_require__(27070);
26413
26422
  var operators_1 = __webpack_require__(19443);
26423
+ var services_1 = __webpack_require__(65010);
26414
26424
  var EventTasksResolverService = /** @class */ (function () {
26415
- function EventTasksResolverService(service) {
26425
+ function EventTasksResolverService(service, sessionStorageService) {
26416
26426
  this.service = service;
26427
+ this.sessionStorageService = sessionStorageService;
26417
26428
  }
26418
26429
  EventTasksResolverService.prototype.resolve = function (route) {
26419
26430
  var eventId = route.queryParamMap.get('eventId');
26420
26431
  var caseId = route.queryParamMap.get('caseId');
26421
- return this.service.getTasksByCaseIdAndEventId(eventId, caseId)
26422
- .pipe(operators_1.map(function (payload) { return payload.tasks; }));
26432
+ var caseInfoStr = this.sessionStorageService.getItem('caseInfo');
26433
+ var caseInfo = JSON.parse(caseInfoStr);
26434
+ if (caseInfo) {
26435
+ return this.service.getTasksByCaseIdAndEventId(eventId, caseId, caseInfo.caseType, caseInfo.jurisdiction)
26436
+ .pipe(operators_1.map(function (payload) { return payload.tasks; }));
26437
+ }
26423
26438
  };
26424
26439
  EventTasksResolverService = __decorate([
26425
26440
  core_1.Injectable(),
26426
- __metadata("design:paramtypes", [case_editor_1.WorkAllocationService])
26441
+ __metadata("design:paramtypes", [case_editor_1.WorkAllocationService,
26442
+ services_1.SessionStorageService])
26427
26443
  ], EventTasksResolverService);
26428
26444
  return EventTasksResolverService;
26429
26445
  }());
@@ -26513,7 +26529,9 @@ var EventStartStateMachineService = /** @class */ (function () {
26513
26529
  // Get number of tasks assigned to user
26514
26530
  var userInfoStr = context.sessionStorageService.getItem('userDetails');
26515
26531
  var userInfo = JSON.parse(userInfoStr);
26516
- var tasksAssignedToUser = context.tasks.filter(function (x) { return x.assignee === userInfo.id || x.assignee === userInfo.uid; });
26532
+ var tasksAssignedToUser = context.tasks.filter(function (x) {
26533
+ return x.task_state !== 'unassigned' && x.assignee === userInfo.id || x.assignee === userInfo.uid;
26534
+ });
26517
26535
  // Check if user initiated the event from task tab
26518
26536
  var isEventInitiatedFromTaskTab = context.taskId !== undefined && tasksAssignedToUser.findIndex(function (x) { return x.id === context.taskId; }) > -1;
26519
26537
  if (isEventInitiatedFromTaskTab) {