@hmcts/ccd-case-ui-toolkit 7.0.38-client-context-2 → 7.0.38-exui-1856-rc1

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.
Files changed (34) hide show
  1. package/esm2020/lib/app.config.mjs +2 -1
  2. package/esm2020/lib/shared/components/case-editor/case-edit/case-edit.component.mjs +11 -11
  3. package/esm2020/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.mjs +14 -16
  4. package/esm2020/lib/shared/components/case-editor/services/cases.service.mjs +27 -53
  5. package/esm2020/lib/shared/components/case-editor/services/event-completion-state-machine.service.mjs +6 -14
  6. package/esm2020/lib/shared/components/event-start/event-guard/event-start.guard.mjs +5 -13
  7. package/esm2020/lib/shared/components/event-start/services/event-start-state-machine.service.mjs +3 -11
  8. package/esm2020/lib/shared/components/palette/case-file-view/case-file-view-field.component.mjs +21 -8
  9. package/esm2020/lib/shared/domain/work-allocation/Task.mjs +1 -1
  10. package/esm2020/lib/shared/services/fields/fields.utils.mjs +1 -8
  11. package/esm2020/lib/shared/services/profile/profile.service.mjs +1 -2
  12. package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs +67 -117
  13. package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  14. package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs +66 -117
  15. package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  16. package/lib/app.config.d.ts +4 -0
  17. package/lib/app.config.d.ts.map +1 -1
  18. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
  19. package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.d.ts +2 -1
  20. package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.d.ts.map +1 -1
  21. package/lib/shared/components/case-editor/services/cases.service.d.ts +1 -2
  22. package/lib/shared/components/case-editor/services/cases.service.d.ts.map +1 -1
  23. package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts +0 -1
  24. package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts.map +1 -1
  25. package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts +1 -1
  26. package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts.map +1 -1
  27. package/lib/shared/components/event-start/services/event-start-state-machine.service.d.ts.map +1 -1
  28. package/lib/shared/components/palette/case-file-view/case-file-view-field.component.d.ts +8 -1
  29. package/lib/shared/components/palette/case-file-view/case-file-view-field.component.d.ts.map +1 -1
  30. package/lib/shared/domain/work-allocation/Task.d.ts +0 -4
  31. package/lib/shared/domain/work-allocation/Task.d.ts.map +1 -1
  32. package/lib/shared/services/fields/fields.utils.d.ts +0 -2
  33. package/lib/shared/services/fields/fields.utils.d.ts.map +1 -1
  34. package/package.json +1 -1
@@ -1183,6 +1183,7 @@ var DisplayMode;
1183
1183
  DisplayMode[DisplayMode["ICON"] = 1] = "ICON";
1184
1184
  })(DisplayMode || (DisplayMode = {}));
1185
1185
 
1186
+ /* istanbul ignore file */
1186
1187
  class AbstractAppConfig {
1187
1188
  /**
1188
1189
  * Dummy version replacing deprecated `getRemotePrintServiceUrl()`, to be removed in next major release
@@ -3909,13 +3910,6 @@ class FieldsUtils {
3909
3910
  return '';
3910
3911
  }
3911
3912
  }
3912
- static getUserTaskFromClientContext(clientContextStr) {
3913
- if (clientContextStr) {
3914
- let clientContext = JSON.parse(clientContextStr);
3915
- return clientContext.client_context.user_task;
3916
- }
3917
- return null;
3918
- }
3919
3913
  buildCanShowPredicate(eventTrigger, form) {
3920
3914
  const currentState = this.getCurrentEventState(eventTrigger, form);
3921
3915
  return (page) => {
@@ -6808,7 +6802,6 @@ class ProfileService {
6808
6802
  .set('experimental', 'true')
6809
6803
  .set('Accept', ProfileService.V2_MEDIATYPE_USER_PROFILE)
6810
6804
  .set('Content-Type', 'application/json');
6811
- // Not adding client context header because header is added to call immediately afterwards
6812
6805
  return this.httpService
6813
6806
  .get(url, { headers, observe: 'body' })
6814
6807
  .pipe(map((p) => plainToClass(Profile, p)));
@@ -7675,7 +7668,6 @@ class CasesService {
7675
7668
  let headers = new HttpHeaders();
7676
7669
  headers = headers.set('experimental', 'true');
7677
7670
  headers = headers.set('Content-Type', 'application/json');
7678
- headers = this.addClientContextHeader(headers);
7679
7671
  if (Draft.isDraft(caseId)) {
7680
7672
  headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_DRAFT_TRIGGER);
7681
7673
  }
@@ -7686,10 +7678,9 @@ class CasesService {
7686
7678
  headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_CASE_TRIGGER);
7687
7679
  }
7688
7680
  return this.http
7689
- .get(url, { headers, observe: 'response' })
7690
- .pipe(map((response) => {
7691
- this.updateClientContextStorage(response.headers);
7692
- return FieldsUtils.handleNestedDynamicLists(response.body);
7681
+ .get(url, { headers, observe: 'body' })
7682
+ .pipe(map(body => {
7683
+ return FieldsUtils.handleNestedDynamicLists(body);
7693
7684
  }), catchError(error => {
7694
7685
  this.errorService.setError(error);
7695
7686
  return throwError(error);
@@ -7698,17 +7689,13 @@ class CasesService {
7698
7689
  createEvent(caseDetails, eventData) {
7699
7690
  const caseId = caseDetails.case_id;
7700
7691
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/events`;
7701
- let headers = new HttpHeaders()
7692
+ const headers = new HttpHeaders()
7702
7693
  .set('experimental', 'true')
7703
7694
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_EVENT)
7704
7695
  .set('Content-Type', 'application/json');
7705
- headers = this.addClientContextHeader(headers);
7706
7696
  return this.http
7707
- .post(url, eventData, { headers, observe: 'response' })
7708
- .pipe(map((response) => {
7709
- this.updateClientContextStorage(response.headers);
7710
- return response.body;
7711
- }), catchError(error => {
7697
+ .post(url, eventData, { headers, observe: 'body' })
7698
+ .pipe(catchError(error => {
7712
7699
  this.errorService.setError(error);
7713
7700
  return throwError(error);
7714
7701
  }));
@@ -7716,17 +7703,13 @@ class CasesService {
7716
7703
  validateCase(ctid, eventData, pageId) {
7717
7704
  const pageIdString = pageId ? `?pageId=${pageId}` : '';
7718
7705
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/validate${pageIdString}`;
7719
- let headers = new HttpHeaders()
7706
+ const headers = new HttpHeaders()
7720
7707
  .set('experimental', 'true')
7721
7708
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE)
7722
7709
  .set('Content-Type', 'application/json');
7723
- headers = this.addClientContextHeader(headers);
7724
7710
  return this.http
7725
- .post(url, eventData, { headers, observe: 'response' })
7726
- .pipe(map((response) => {
7727
- this.updateClientContextStorage(response.headers);
7728
- return response.body;
7729
- }), catchError(error => {
7711
+ .post(url, eventData, { headers, observe: 'body' })
7712
+ .pipe(catchError(error => {
7730
7713
  this.errorService.setError(error);
7731
7714
  return throwError(error);
7732
7715
  }));
@@ -7737,34 +7720,26 @@ class CasesService {
7737
7720
  ignoreWarning = 'true';
7738
7721
  }
7739
7722
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/cases?ignore-warning=${ignoreWarning}`;
7740
- let headers = new HttpHeaders()
7723
+ const headers = new HttpHeaders()
7741
7724
  .set('experimental', 'true')
7742
7725
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_CASE)
7743
7726
  .set('Content-Type', 'application/json');
7744
- headers = this.addClientContextHeader(headers);
7745
7727
  return this.http
7746
- .post(url, eventData, { headers, observe: 'response' })
7747
- .pipe(map((response) => {
7748
- this.updateClientContextStorage(response.headers);
7749
- return response.body;
7750
- }), catchError(error => {
7728
+ .post(url, eventData, { headers, observe: 'body' })
7729
+ .pipe(catchError(error => {
7751
7730
  this.errorService.setError(error);
7752
7731
  return throwError(error);
7753
7732
  }));
7754
7733
  }
7755
7734
  getPrintDocuments(caseId) {
7756
7735
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/documents`;
7757
- let headers = new HttpHeaders()
7736
+ const headers = new HttpHeaders()
7758
7737
  .set('experimental', 'true')
7759
7738
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DOCUMENTS)
7760
7739
  .set('Content-Type', 'application/json');
7761
- headers = this.addClientContextHeader(headers);
7762
7740
  return this.http
7763
- .get(url, { headers, observe: 'response' })
7764
- .pipe(map((response) => {
7765
- this.updateClientContextStorage(response.headers);
7766
- return response.body.documentResources;
7767
- }), catchError(error => {
7741
+ .get(url, { headers, observe: 'body' })
7742
+ .pipe(map(body => body.documentResources), catchError(error => {
7768
7743
  this.errorService.setError(error);
7769
7744
  return throwError(error);
7770
7745
  }));
@@ -7797,6 +7772,17 @@ class CasesService {
7797
7772
  wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
7798
7773
  });
7799
7774
  }
7775
+ /*
7776
+ Checks if the user has role of pui-case-manager and returns true or false
7777
+ */
7778
+ isPuiCaseManager() {
7779
+ const userInfoStr = this.sessionStorageService.getItem('userDetails');
7780
+ if (userInfoStr) {
7781
+ const userInfo = JSON.parse(userInfoStr);
7782
+ return userInfo && userInfo.roles && (userInfo.roles.indexOf(CasesService.PUI_CASE_MANAGER) !== -1);
7783
+ }
7784
+ return false;
7785
+ }
7800
7786
  getCourtOrHearingCentreName(locationId) {
7801
7787
  return this.http.post(`/api/locations/getLocationsById`, { locations: [{ locationId }] });
7802
7788
  }
@@ -7863,25 +7849,6 @@ class CasesService {
7863
7849
  .get(url)
7864
7850
  .pipe(catchError(error => throwError(error)));
7865
7851
  }
7866
- addClientContextHeader(headers) {
7867
- const clientContextDetails = this.sessionStorageService.getItem('clientContext');
7868
- if (clientContextDetails) {
7869
- // may require URI encoding in certain circumstances
7870
- const clientContext = window.btoa(clientContextDetails);
7871
- if (clientContext) {
7872
- headers = headers.set('Client-Context', clientContext);
7873
- }
7874
- }
7875
- return headers;
7876
- }
7877
- updateClientContextStorage(headers) {
7878
- // for mocking - TODO: Kasi Remove/Uncomment for testing
7879
- // headers = this.setMockClientContextHeader(headers);
7880
- if (headers && headers.get('Client-Context')) {
7881
- const clientContextString = window.atob(headers.get('Client-Context'));
7882
- this.sessionStorageService.setItem('clientContext', clientContextString);
7883
- }
7884
- }
7885
7852
  }
7886
7853
  // Internal (UI) API
7887
7854
  CasesService.V2_MEDIATYPE_CASE_VIEW = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-case-view.v2+json';
@@ -8372,9 +8339,8 @@ class EventCompletionStateMachineService {
8372
8339
  entryActionForStateCompleteEventAndTask(state, context) {
8373
8340
  // Trigger final state to complete processing of state machine
8374
8341
  state.trigger(EventCompletionStates.Final);
8375
- const clientContextStr = context.sessionStorageService.getItem('clientContext');
8376
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8377
- if (userTask?.task_data) {
8342
+ const taskStr = context.sessionStorageService.getItem('taskToComplete');
8343
+ if (taskStr) {
8378
8344
  context.sessionStorageService.setItem('assignNeeded', 'false');
8379
8345
  // just set event can be completed
8380
8346
  context.component.eventCanBeCompleted.emit(true);
@@ -8393,9 +8359,9 @@ class EventCompletionStateMachineService {
8393
8359
  entryActionForStateTaskUnassigned(state, context) {
8394
8360
  // Trigger final state to complete processing of state machine
8395
8361
  state.trigger(EventCompletionStates.Final);
8396
- const clientContextStr = context.sessionStorageService.getItem('clientContext');
8397
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8398
- if (userTask?.task_data) {
8362
+ // Get task details
8363
+ const taskStr = context.sessionStorageService.getItem('taskToComplete');
8364
+ if (taskStr) {
8399
8365
  context.sessionStorageService.setItem('assignNeeded', 'true');
8400
8366
  context.component.eventCanBeCompleted.emit(true);
8401
8367
  }
@@ -8430,12 +8396,6 @@ class EventCompletionStateMachineService {
8430
8396
  addTransitionsForStateTaskUnassigned() {
8431
8397
  this.stateTaskUnassigned.addTransition(EventCompletionStates.Final, this.stateFinal);
8432
8398
  }
8433
- taskPresentInSessionStorage(context) {
8434
- const clientContextStr = context.sessionStorageService.getItem('clientContext');
8435
- console.log('clienht cintedt ', clientContextStr);
8436
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8437
- return !!userTask.task_data;
8438
- }
8439
8399
  }
8440
8400
  EventCompletionStateMachineService.ɵfac = function EventCompletionStateMachineService_Factory(t) { return new (t || EventCompletionStateMachineService)(); };
8441
8401
  EventCompletionStateMachineService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventCompletionStateMachineService, factory: EventCompletionStateMachineService.ɵfac });
@@ -8894,9 +8854,11 @@ class CaseEditComponent {
8894
8854
  this.isSubmitting = true;
8895
8855
  // We have to run the event completion checks if task in session storage
8896
8856
  // and if the task is in session storage, then is it associated to the case
8897
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
8898
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8899
- const taskInSessionStorage = userTask ? userTask.task_data : null;
8857
+ let taskInSessionStorage;
8858
+ const taskStr = this.sessionStorageService.getItem('taskToComplete');
8859
+ if (taskStr) {
8860
+ taskInSessionStorage = JSON.parse(taskStr);
8861
+ }
8900
8862
  if (taskInSessionStorage && taskInSessionStorage.case_id === this.getCaseId(caseDetails)) {
8901
8863
  // Show event completion component to perform event completion checks
8902
8864
  this.eventCompletionParams = ({
@@ -9095,16 +9057,14 @@ class CaseEditComponent {
9095
9057
  });
9096
9058
  }
9097
9059
  postCompleteTaskIfRequired() {
9098
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
9099
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9100
- const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
9060
+ const taskStr = this.sessionStorageService.getItem('taskToComplete');
9101
9061
  const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
9102
- if (task && assignNeeded && taskToBeCompleted) {
9103
- // const task: Task = JSON.parse(taskStr);
9062
+ if (taskStr && assignNeeded) {
9063
+ const task = JSON.parse(taskStr);
9104
9064
  return this.workAllocationService.assignAndCompleteTask(task.id);
9105
9065
  }
9106
- else if (task && taskToBeCompleted) {
9107
- // const task: Task = JSON.parse(taskStr);
9066
+ else if (taskStr) {
9067
+ const task = JSON.parse(taskStr);
9108
9068
  return this.workAllocationService.completeTask(task.id);
9109
9069
  }
9110
9070
  return of(true);
@@ -10628,12 +10588,8 @@ class CaseEventCompletionTaskReassignedComponent {
10628
10588
  }
10629
10589
  onContinue() {
10630
10590
  // Get task details
10631
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
10632
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
10633
- const task = userTask ? userTask.task_data : null;
10634
- // not complete_task not utilised here as related to event completion
10635
- // service wanting task associated with event to not be completed not directly relevant
10636
- if (task) {
10591
+ const taskStr = this.sessionStorageService.getItem('taskToComplete');
10592
+ if (taskStr) {
10637
10593
  this.sessionStorageService.setItem('assignNeeded', 'true');
10638
10594
  // set event can be completed to true
10639
10595
  this.parentComponent.eventCanBeCompleted.emit(true);
@@ -11369,7 +11325,7 @@ function CaseFileViewFieldComponent_div_2_ng_container_8_Template(rf, ctx) { if
11369
11325
  } if (rf & 2) {
11370
11326
  const ctx_r5 = i0.ɵɵnextContext(2);
11371
11327
  i0.ɵɵadvance(1);
11372
- i0.ɵɵproperty("url", ctx_r5.currentDocument.document_binary_url)("downloadFileName", ctx_r5.currentDocument.document_filename)("showToolbar", true)("contentType", ctx_r5.currentDocument.content_type)("enableAnnotations", true)("enableRedactions", true)("height", "94.5vh");
11328
+ i0.ɵɵproperty("url", ctx_r5.currentDocument.document_binary_url)("downloadFileName", ctx_r5.currentDocument.document_filename)("showToolbar", true)("contentType", ctx_r5.currentDocument.content_type)("enableAnnotations", true)("enableRedactions", true)("height", "94.5vh")("enableICP", ctx_r5.isIcpEnabled());
11373
11329
  } }
11374
11330
  function CaseFileViewFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11375
11331
  const _r7 = i0.ɵɵgetCurrentView();
@@ -11381,7 +11337,7 @@ function CaseFileViewFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11381
11337
  i0.ɵɵelementEnd()();
11382
11338
  i0.ɵɵelement(6, "div", 16);
11383
11339
  i0.ɵɵelementStart(7, "div", 17);
11384
- i0.ɵɵtemplate(8, CaseFileViewFieldComponent_div_2_ng_container_8_Template, 2, 7, "ng-container", 0);
11340
+ i0.ɵɵtemplate(8, CaseFileViewFieldComponent_div_2_ng_container_8_Template, 2, 8, "ng-container", 0);
11385
11341
  i0.ɵɵelementEnd()()();
11386
11342
  } if (rf & 2) {
11387
11343
  const ctx_r2 = i0.ɵɵnextContext();
@@ -11391,16 +11347,20 @@ function CaseFileViewFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11391
11347
  i0.ɵɵproperty("ngIf", ctx_r2.currentDocument);
11392
11348
  } }
11393
11349
  class CaseFileViewFieldComponent {
11394
- constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService) {
11350
+ constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService, caseNotifier, abstractConfig) {
11395
11351
  this.elementRef = elementRef;
11396
11352
  this.route = route;
11397
11353
  this.caseFileViewService = caseFileViewService;
11398
11354
  this.documentManagementService = documentManagementService;
11399
11355
  this.loadingService = loadingService;
11400
11356
  this.sessionStorageService = sessionStorageService;
11357
+ this.caseNotifier = caseNotifier;
11358
+ this.abstractConfig = abstractConfig;
11401
11359
  this.allowMoving = true;
11402
11360
  this.getCategoriesAndDocumentsError = false;
11403
11361
  this.errorMessages = [];
11362
+ this.icp_jurisdictions = [];
11363
+ this.icpEnabled = false;
11404
11364
  }
11405
11365
  ngOnInit() {
11406
11366
  const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
@@ -11417,6 +11377,8 @@ class CaseFileViewFieldComponent {
11417
11377
  const acls = this.caseField.acls.filter(acl => userInfo.roles.includes(acl.role));
11418
11378
  // As there can be more than one intersecting role, if any acls are update: true
11419
11379
  this.allowMoving = acls.some(acl => acl.update);
11380
+ this.icp_jurisdictions = this.abstractConfig.getIcpJurisdictions();
11381
+ this.icpEnabled = this.abstractConfig.getIcpEnable();
11420
11382
  }
11421
11383
  ngAfterViewInit() {
11422
11384
  const slider = this.elementRef.nativeElement.querySelector('.slider');
@@ -11475,10 +11437,13 @@ class CaseFileViewFieldComponent {
11475
11437
  this.categoriesAndDocumentsSubscription.unsubscribe();
11476
11438
  }
11477
11439
  }
11440
+ isIcpEnabled() {
11441
+ return this.icpEnabled && ((this.icp_jurisdictions?.length < 1) || this.icp_jurisdictions.includes(this.caseNotifier?.cachedCaseView?.case_type?.jurisdiction.id));
11442
+ }
11478
11443
  }
11479
11444
  CaseFileViewFieldComponent.PARAM_CASE_ID = 'cid';
11480
- CaseFileViewFieldComponent.ɵfac = function CaseFileViewFieldComponent_Factory(t) { return new (t || CaseFileViewFieldComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseFileViewService), i0.ɵɵdirectiveInject(DocumentManagementService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(SessionStorageService)); };
11481
- CaseFileViewFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseFileViewFieldComponent, selectors: [["ccd-case-file-view-field"]], decls: 3, vars: 3, consts: [[4, "ngIf"], ["class", "govuk-grid-column-two-thirds", 4, "ngIf"], ["id", "case-file-view-field-errors", "data-module", "govuk-error-summary", 1, "govuk-error-summary", "govuk-!-margin-bottom-4"], ["role", "alert"], [1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [4, "ngFor", "ngForOf"], ["href", "javascript:void(0);"], [1, "govuk-grid-column-two-thirds"], [1, "govuk-heading-xl"], [1, "govuk-body"], [1, "govuk-heading-l"], ["id", "case-file-view", 1, "govuk-form-group"], [1, "document-tree-container"], [1, "document-tree-container__tree", 3, "categoriesAndDocuments", "allowMoving", "clickedDocument", "moveDocument"], [1, "slider"], [1, "media-viewer-container"], [3, "url", "downloadFileName", "showToolbar", "contentType", "enableAnnotations", "enableRedactions", "height"]], template: function CaseFileViewFieldComponent_Template(rf, ctx) { if (rf & 1) {
11445
+ CaseFileViewFieldComponent.ɵfac = function CaseFileViewFieldComponent_Factory(t) { return new (t || CaseFileViewFieldComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseFileViewService), i0.ɵɵdirectiveInject(DocumentManagementService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(AbstractAppConfig)); };
11446
+ CaseFileViewFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseFileViewFieldComponent, selectors: [["ccd-case-file-view-field"]], decls: 3, vars: 3, consts: [[4, "ngIf"], ["class", "govuk-grid-column-two-thirds", 4, "ngIf"], ["id", "case-file-view-field-errors", "data-module", "govuk-error-summary", 1, "govuk-error-summary", "govuk-!-margin-bottom-4"], ["role", "alert"], [1, "govuk-error-summary__title"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [4, "ngFor", "ngForOf"], ["href", "javascript:void(0);"], [1, "govuk-grid-column-two-thirds"], [1, "govuk-heading-xl"], [1, "govuk-body"], [1, "govuk-heading-l"], ["id", "case-file-view", 1, "govuk-form-group"], [1, "document-tree-container"], [1, "document-tree-container__tree", 3, "categoriesAndDocuments", "allowMoving", "clickedDocument", "moveDocument"], [1, "slider"], [1, "media-viewer-container"], [3, "url", "downloadFileName", "showToolbar", "contentType", "enableAnnotations", "enableRedactions", "height", "enableICP"]], template: function CaseFileViewFieldComponent_Template(rf, ctx) { if (rf & 1) {
11482
11447
  i0.ɵɵtemplate(0, CaseFileViewFieldComponent_ng_container_0_Template, 8, 1, "ng-container", 0);
11483
11448
  i0.ɵɵtemplate(1, CaseFileViewFieldComponent_div_1_Template, 5, 0, "div", 1);
11484
11449
  i0.ɵɵtemplate(2, CaseFileViewFieldComponent_div_2_Template, 9, 3, "div", 0);
@@ -11491,8 +11456,8 @@ CaseFileViewFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
11491
11456
  } }, styles: ["#case-file-view[_ngcontent-%COMP%]{display:flex;border:2px solid #C9C9C9;height:100vh;position:relative}#case-file-view[_ngcontent-%COMP%] .document-tree-container[_ngcontent-%COMP%]{background-color:#faf8f8;width:30%;min-height:400px;min-width:10%}#case-file-view[_ngcontent-%COMP%] .slider[_ngcontent-%COMP%]{width:.2%;background-color:#6b6b6b}#case-file-view[_ngcontent-%COMP%] .slider[_ngcontent-%COMP%]:hover, #case-file-view[_ngcontent-%COMP%] .slider[_ngcontent-%COMP%]:focus{cursor:col-resize}#case-file-view[_ngcontent-%COMP%] .media-viewer-container[_ngcontent-%COMP%]{background-color:#dee0e2;flex:1 1 0;overflow:hidden}"] });
11492
11457
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseFileViewFieldComponent, [{
11493
11458
  type: Component,
11494
- args: [{ selector: 'ccd-case-file-view-field', template: "<ng-container *ngIf=\"errorMessages?.length\">\n <div\n id=\"case-file-view-field-errors\"\n class=\"govuk-error-summary govuk-!-margin-bottom-4\" data-module=\"govuk-error-summary\">\n <div role=\"alert\">\n <h2 class=\"govuk-error-summary__title\">\n There is a problem\n </h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li *ngFor=\"let errorMessage of errorMessages\">\n <a href=\"javascript:void(0);\">{{ errorMessage }}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-container>\n\n<div *ngIf=\"getCategoriesAndDocumentsError\" class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-xl\">Sorry, there is a problem with the service</h1>\n <p class=\"govuk-body\">Try again later.</p>\n</div>\n<div *ngIf=\"!getCategoriesAndDocumentsError\">\n <h2 class=\"govuk-heading-l\">Case file</h2>\n <div class=\"govuk-form-group\" id=\"case-file-view\">\n <!-- Document tree -->\n <div class=\"document-tree-container\">\n <ccd-case-file-view-folder\n class=\"document-tree-container__tree\"\n [categoriesAndDocuments]=\"categoriesAndDocuments$\"\n (clickedDocument)=\"setMediaViewerFile($event); resetErrorMessages()\"\n (moveDocument)=\"moveDocument($event)\"\n [allowMoving]=\"allowMoving\"\n ></ccd-case-file-view-folder>\n </div>\n <!-- Slider -->\n <div class=\"slider\"></div>\n <!-- Media viewer -->\n <div class=\"media-viewer-container\">\n <ng-container *ngIf=\"currentDocument\">\n <mv-media-viewer [url]=\"currentDocument.document_binary_url\"\n [downloadFileName]=\"currentDocument.document_filename\"\n [showToolbar]=\"true\"\n [contentType]=\"currentDocument.content_type\"\n [enableAnnotations]=\"true\"\n [enableRedactions]=\"true\"\n [height]=\"'94.5vh'\">\n </mv-media-viewer>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: ["#case-file-view{display:flex;border:2px solid #C9C9C9;height:100vh;position:relative}#case-file-view .document-tree-container{background-color:#faf8f8;width:30%;min-height:400px;min-width:10%}#case-file-view .slider{width:.2%;background-color:#6b6b6b}#case-file-view .slider:hover,#case-file-view .slider:focus{cursor:col-resize}#case-file-view .media-viewer-container{background-color:#dee0e2;flex:1 1 0;overflow:hidden}\n"] }]
11495
- }], function () { return [{ type: i0.ElementRef }, { type: i1$1.ActivatedRoute }, { type: CaseFileViewService }, { type: DocumentManagementService }, { type: LoadingService }, { type: SessionStorageService }]; }, null); })();
11459
+ args: [{ selector: 'ccd-case-file-view-field', template: "<ng-container *ngIf=\"errorMessages?.length\">\n <div\n id=\"case-file-view-field-errors\"\n class=\"govuk-error-summary govuk-!-margin-bottom-4\" data-module=\"govuk-error-summary\">\n <div role=\"alert\">\n <h2 class=\"govuk-error-summary__title\">\n There is a problem\n </h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li *ngFor=\"let errorMessage of errorMessages\">\n <a href=\"javascript:void(0);\">{{ errorMessage }}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</ng-container>\n\n<div *ngIf=\"getCategoriesAndDocumentsError\" class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-xl\">Sorry, there is a problem with the service</h1>\n <p class=\"govuk-body\">Try again later.</p>\n</div>\n<div *ngIf=\"!getCategoriesAndDocumentsError\">\n <h2 class=\"govuk-heading-l\">Case file</h2>\n <div class=\"govuk-form-group\" id=\"case-file-view\">\n <!-- Document tree -->\n <div class=\"document-tree-container\">\n <ccd-case-file-view-folder\n class=\"document-tree-container__tree\"\n [categoriesAndDocuments]=\"categoriesAndDocuments$\"\n (clickedDocument)=\"setMediaViewerFile($event); resetErrorMessages()\"\n (moveDocument)=\"moveDocument($event)\"\n [allowMoving]=\"allowMoving\"\n ></ccd-case-file-view-folder>\n </div>\n <!-- Slider -->\n <div class=\"slider\"></div>\n <!-- Media viewer -->\n <div class=\"media-viewer-container\">\n <ng-container *ngIf=\"currentDocument\">\n <mv-media-viewer [url]=\"currentDocument.document_binary_url\"\n [downloadFileName]=\"currentDocument.document_filename\"\n [showToolbar]=\"true\"\n [contentType]=\"currentDocument.content_type\"\n [enableAnnotations]=\"true\"\n [enableRedactions]=\"true\"\n [height]=\"'94.5vh'\"\n [enableICP]=\"isIcpEnabled()\">\n </mv-media-viewer>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: ["#case-file-view{display:flex;border:2px solid #C9C9C9;height:100vh;position:relative}#case-file-view .document-tree-container{background-color:#faf8f8;width:30%;min-height:400px;min-width:10%}#case-file-view .slider{width:.2%;background-color:#6b6b6b}#case-file-view .slider:hover,#case-file-view .slider:focus{cursor:col-resize}#case-file-view .media-viewer-container{background-color:#dee0e2;flex:1 1 0;overflow:hidden}\n"] }]
11460
+ }], function () { return [{ type: i0.ElementRef }, { type: i1$1.ActivatedRoute }, { type: CaseFileViewService }, { type: DocumentManagementService }, { type: LoadingService }, { type: SessionStorageService }, { type: CaseNotifier }, { type: AbstractAppConfig }]; }, null); })();
11496
11461
 
11497
11462
  class CaseFlagStateService {
11498
11463
  constructor() {
@@ -32357,26 +32322,18 @@ class EventStartGuard {
32357
32322
  task = tasksAssignedToUser[0];
32358
32323
  }
32359
32324
  // if one task assigned to user, allow user to complete event
32360
- const storeClientContext = {
32361
- client_context: {
32362
- user_task: {
32363
- task_data: task,
32364
- complete_task: true
32365
- }
32366
- }
32367
- };
32368
- this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
32325
+ this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
32369
32326
  return true;
32370
32327
  }
32371
32328
  }
32372
32329
  removeTaskFromSessionStorage() {
32373
- this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
32330
+ this.sessionStorageService.removeItem(EventStartGuard.TASK_TO_COMPLETE);
32374
32331
  }
32375
32332
  checkForTasks(payload, caseId, eventId, taskId) {
32376
32333
  if (taskId && payload?.tasks?.length > 0) {
32377
32334
  const task = payload.tasks.find((t) => t.id == taskId);
32378
32335
  if (task) {
32379
- this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(task));
32336
+ this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
32380
32337
  }
32381
32338
  else {
32382
32339
  this.removeTaskFromSessionStorage();
@@ -32398,7 +32355,7 @@ class EventStartGuard {
32398
32355
  }
32399
32356
  }
32400
32357
  }
32401
- EventStartGuard.CLIENT_CONTEXT = 'clientContext';
32358
+ EventStartGuard.TASK_TO_COMPLETE = 'taskToComplete';
32402
32359
  EventStartGuard.ɵfac = function EventStartGuard_Factory(t) { return new (t || EventStartGuard)(i0.ɵɵinject(WorkAllocationService), i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(SessionStorageService)); };
32403
32360
  EventStartGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventStartGuard, factory: EventStartGuard.ɵfac });
32404
32361
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EventStartGuard, [{
@@ -32536,17 +32493,9 @@ class EventStartStateMachineService {
32536
32493
  task = context.tasks[0];
32537
32494
  }
32538
32495
  const taskStr = JSON.stringify(task);
32539
- console.log('entryActionForStateOneTaskAssignedToUser: setting client context task_data to ' + taskStr);
32496
+ console.log('entryActionForStateOneTaskAssignedToUser: setting taskToComplete to ' + taskStr);
32540
32497
  // Store task to session
32541
- const clientContext = {
32542
- client_context: {
32543
- user_task: {
32544
- task_data: task,
32545
- complete_task: true
32546
- }
32547
- }
32548
- };
32549
- context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
32498
+ context.sessionStorageService.setItem('taskToComplete', taskStr);
32550
32499
  // Allow user to perform the event
32551
32500
  context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
32552
32501
  }