@hmcts/ccd-case-ui-toolkit 7.0.38-client-context → 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 -54
  5. package/esm2020/lib/shared/components/case-editor/services/event-completion-state-machine.service.mjs +6 -9
  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 -113
  13. package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  14. package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs +66 -113
  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,11 +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
- console.log('response barking mad', response);
7692
- this.updateClientContextStorage(response.headers);
7693
- return FieldsUtils.handleNestedDynamicLists(response.body);
7681
+ .get(url, { headers, observe: 'body' })
7682
+ .pipe(map(body => {
7683
+ return FieldsUtils.handleNestedDynamicLists(body);
7694
7684
  }), catchError(error => {
7695
7685
  this.errorService.setError(error);
7696
7686
  return throwError(error);
@@ -7699,17 +7689,13 @@ class CasesService {
7699
7689
  createEvent(caseDetails, eventData) {
7700
7690
  const caseId = caseDetails.case_id;
7701
7691
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/events`;
7702
- let headers = new HttpHeaders()
7692
+ const headers = new HttpHeaders()
7703
7693
  .set('experimental', 'true')
7704
7694
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_EVENT)
7705
7695
  .set('Content-Type', 'application/json');
7706
- headers = this.addClientContextHeader(headers);
7707
7696
  return this.http
7708
- .post(url, eventData, { headers, observe: 'response' })
7709
- .pipe(map((response) => {
7710
- this.updateClientContextStorage(response.headers);
7711
- return response.body;
7712
- }), catchError(error => {
7697
+ .post(url, eventData, { headers, observe: 'body' })
7698
+ .pipe(catchError(error => {
7713
7699
  this.errorService.setError(error);
7714
7700
  return throwError(error);
7715
7701
  }));
@@ -7717,17 +7703,13 @@ class CasesService {
7717
7703
  validateCase(ctid, eventData, pageId) {
7718
7704
  const pageIdString = pageId ? `?pageId=${pageId}` : '';
7719
7705
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/validate${pageIdString}`;
7720
- let headers = new HttpHeaders()
7706
+ const headers = new HttpHeaders()
7721
7707
  .set('experimental', 'true')
7722
7708
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE)
7723
7709
  .set('Content-Type', 'application/json');
7724
- headers = this.addClientContextHeader(headers);
7725
7710
  return this.http
7726
- .post(url, eventData, { headers, observe: 'response' })
7727
- .pipe(map((response) => {
7728
- this.updateClientContextStorage(response.headers);
7729
- return response.body;
7730
- }), catchError(error => {
7711
+ .post(url, eventData, { headers, observe: 'body' })
7712
+ .pipe(catchError(error => {
7731
7713
  this.errorService.setError(error);
7732
7714
  return throwError(error);
7733
7715
  }));
@@ -7738,34 +7720,26 @@ class CasesService {
7738
7720
  ignoreWarning = 'true';
7739
7721
  }
7740
7722
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/cases?ignore-warning=${ignoreWarning}`;
7741
- let headers = new HttpHeaders()
7723
+ const headers = new HttpHeaders()
7742
7724
  .set('experimental', 'true')
7743
7725
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_CASE)
7744
7726
  .set('Content-Type', 'application/json');
7745
- headers = this.addClientContextHeader(headers);
7746
7727
  return this.http
7747
- .post(url, eventData, { headers, observe: 'response' })
7748
- .pipe(map((response) => {
7749
- this.updateClientContextStorage(response.headers);
7750
- return response.body;
7751
- }), catchError(error => {
7728
+ .post(url, eventData, { headers, observe: 'body' })
7729
+ .pipe(catchError(error => {
7752
7730
  this.errorService.setError(error);
7753
7731
  return throwError(error);
7754
7732
  }));
7755
7733
  }
7756
7734
  getPrintDocuments(caseId) {
7757
7735
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/documents`;
7758
- let headers = new HttpHeaders()
7736
+ const headers = new HttpHeaders()
7759
7737
  .set('experimental', 'true')
7760
7738
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DOCUMENTS)
7761
7739
  .set('Content-Type', 'application/json');
7762
- headers = this.addClientContextHeader(headers);
7763
7740
  return this.http
7764
- .get(url, { headers, observe: 'response' })
7765
- .pipe(map((response) => {
7766
- this.updateClientContextStorage(response.headers);
7767
- return response.body.documentResources;
7768
- }), catchError(error => {
7741
+ .get(url, { headers, observe: 'body' })
7742
+ .pipe(map(body => body.documentResources), catchError(error => {
7769
7743
  this.errorService.setError(error);
7770
7744
  return throwError(error);
7771
7745
  }));
@@ -7798,6 +7772,17 @@ class CasesService {
7798
7772
  wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
7799
7773
  });
7800
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
+ }
7801
7786
  getCourtOrHearingCentreName(locationId) {
7802
7787
  return this.http.post(`/api/locations/getLocationsById`, { locations: [{ locationId }] });
7803
7788
  }
@@ -7864,25 +7849,6 @@ class CasesService {
7864
7849
  .get(url)
7865
7850
  .pipe(catchError(error => throwError(error)));
7866
7851
  }
7867
- addClientContextHeader(headers) {
7868
- const clientContextDetails = this.sessionStorageService.getItem('clientContext');
7869
- if (clientContextDetails) {
7870
- // may require URI encoding in certain circumstances
7871
- const clientContext = window.btoa(clientContextDetails);
7872
- if (clientContext) {
7873
- headers = headers.set('Client-Context', clientContext);
7874
- }
7875
- }
7876
- return headers;
7877
- }
7878
- updateClientContextStorage(headers) {
7879
- // for mocking - TODO: Kasi Remove/Uncomment for testing
7880
- // headers = this.setMockClientContextHeader(headers);
7881
- if (headers && headers.get('Client-Context')) {
7882
- const clientContextString = window.atob(headers.get('Client-Context'));
7883
- this.sessionStorageService.setItem('clientContext', clientContextString);
7884
- }
7885
- }
7886
7852
  }
7887
7853
  // Internal (UI) API
7888
7854
  CasesService.V2_MEDIATYPE_CASE_VIEW = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-case-view.v2+json';
@@ -8373,7 +8339,8 @@ class EventCompletionStateMachineService {
8373
8339
  entryActionForStateCompleteEventAndTask(state, context) {
8374
8340
  // Trigger final state to complete processing of state machine
8375
8341
  state.trigger(EventCompletionStates.Final);
8376
- if (this.getTaskFromClientContext(context)) {
8342
+ const taskStr = context.sessionStorageService.getItem('taskToComplete');
8343
+ if (taskStr) {
8377
8344
  context.sessionStorageService.setItem('assignNeeded', 'false');
8378
8345
  // just set event can be completed
8379
8346
  context.component.eventCanBeCompleted.emit(true);
@@ -8392,7 +8359,9 @@ class EventCompletionStateMachineService {
8392
8359
  entryActionForStateTaskUnassigned(state, context) {
8393
8360
  // Trigger final state to complete processing of state machine
8394
8361
  state.trigger(EventCompletionStates.Final);
8395
- if (this.getTaskFromClientContext(context)) {
8362
+ // Get task details
8363
+ const taskStr = context.sessionStorageService.getItem('taskToComplete');
8364
+ if (taskStr) {
8396
8365
  context.sessionStorageService.setItem('assignNeeded', 'true');
8397
8366
  context.component.eventCanBeCompleted.emit(true);
8398
8367
  }
@@ -8427,11 +8396,6 @@ class EventCompletionStateMachineService {
8427
8396
  addTransitionsForStateTaskUnassigned() {
8428
8397
  this.stateTaskUnassigned.addTransition(EventCompletionStates.Final, this.stateFinal);
8429
8398
  }
8430
- getTaskFromClientContext(context) {
8431
- const clientContextStr = context.sessionStorageService.getItem('clientContext');
8432
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8433
- return userTask ? userTask.task_data : null;
8434
- }
8435
8399
  }
8436
8400
  EventCompletionStateMachineService.ɵfac = function EventCompletionStateMachineService_Factory(t) { return new (t || EventCompletionStateMachineService)(); };
8437
8401
  EventCompletionStateMachineService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventCompletionStateMachineService, factory: EventCompletionStateMachineService.ɵfac });
@@ -8890,9 +8854,11 @@ class CaseEditComponent {
8890
8854
  this.isSubmitting = true;
8891
8855
  // We have to run the event completion checks if task in session storage
8892
8856
  // and if the task is in session storage, then is it associated to the case
8893
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
8894
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8895
- 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
+ }
8896
8862
  if (taskInSessionStorage && taskInSessionStorage.case_id === this.getCaseId(caseDetails)) {
8897
8863
  // Show event completion component to perform event completion checks
8898
8864
  this.eventCompletionParams = ({
@@ -9091,16 +9057,14 @@ class CaseEditComponent {
9091
9057
  });
9092
9058
  }
9093
9059
  postCompleteTaskIfRequired() {
9094
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
9095
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9096
- const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
9060
+ const taskStr = this.sessionStorageService.getItem('taskToComplete');
9097
9061
  const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
9098
- if (task && assignNeeded && taskToBeCompleted) {
9099
- // const task: Task = JSON.parse(taskStr);
9062
+ if (taskStr && assignNeeded) {
9063
+ const task = JSON.parse(taskStr);
9100
9064
  return this.workAllocationService.assignAndCompleteTask(task.id);
9101
9065
  }
9102
- else if (task && taskToBeCompleted) {
9103
- // const task: Task = JSON.parse(taskStr);
9066
+ else if (taskStr) {
9067
+ const task = JSON.parse(taskStr);
9104
9068
  return this.workAllocationService.completeTask(task.id);
9105
9069
  }
9106
9070
  return of(true);
@@ -10624,12 +10588,8 @@ class CaseEventCompletionTaskReassignedComponent {
10624
10588
  }
10625
10589
  onContinue() {
10626
10590
  // Get task details
10627
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
10628
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
10629
- const task = userTask ? userTask.task_data : null;
10630
- // not complete_task not utilised here as related to event completion
10631
- // service wanting task associated with event to not be completed not directly relevant
10632
- if (task) {
10591
+ const taskStr = this.sessionStorageService.getItem('taskToComplete');
10592
+ if (taskStr) {
10633
10593
  this.sessionStorageService.setItem('assignNeeded', 'true');
10634
10594
  // set event can be completed to true
10635
10595
  this.parentComponent.eventCanBeCompleted.emit(true);
@@ -11365,7 +11325,7 @@ function CaseFileViewFieldComponent_div_2_ng_container_8_Template(rf, ctx) { if
11365
11325
  } if (rf & 2) {
11366
11326
  const ctx_r5 = i0.ɵɵnextContext(2);
11367
11327
  i0.ɵɵadvance(1);
11368
- 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());
11369
11329
  } }
11370
11330
  function CaseFileViewFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11371
11331
  const _r7 = i0.ɵɵgetCurrentView();
@@ -11377,7 +11337,7 @@ function CaseFileViewFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11377
11337
  i0.ɵɵelementEnd()();
11378
11338
  i0.ɵɵelement(6, "div", 16);
11379
11339
  i0.ɵɵelementStart(7, "div", 17);
11380
- 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);
11381
11341
  i0.ɵɵelementEnd()()();
11382
11342
  } if (rf & 2) {
11383
11343
  const ctx_r2 = i0.ɵɵnextContext();
@@ -11387,16 +11347,20 @@ function CaseFileViewFieldComponent_div_2_Template(rf, ctx) { if (rf & 1) {
11387
11347
  i0.ɵɵproperty("ngIf", ctx_r2.currentDocument);
11388
11348
  } }
11389
11349
  class CaseFileViewFieldComponent {
11390
- constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService) {
11350
+ constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService, caseNotifier, abstractConfig) {
11391
11351
  this.elementRef = elementRef;
11392
11352
  this.route = route;
11393
11353
  this.caseFileViewService = caseFileViewService;
11394
11354
  this.documentManagementService = documentManagementService;
11395
11355
  this.loadingService = loadingService;
11396
11356
  this.sessionStorageService = sessionStorageService;
11357
+ this.caseNotifier = caseNotifier;
11358
+ this.abstractConfig = abstractConfig;
11397
11359
  this.allowMoving = true;
11398
11360
  this.getCategoriesAndDocumentsError = false;
11399
11361
  this.errorMessages = [];
11362
+ this.icp_jurisdictions = [];
11363
+ this.icpEnabled = false;
11400
11364
  }
11401
11365
  ngOnInit() {
11402
11366
  const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
@@ -11413,6 +11377,8 @@ class CaseFileViewFieldComponent {
11413
11377
  const acls = this.caseField.acls.filter(acl => userInfo.roles.includes(acl.role));
11414
11378
  // As there can be more than one intersecting role, if any acls are update: true
11415
11379
  this.allowMoving = acls.some(acl => acl.update);
11380
+ this.icp_jurisdictions = this.abstractConfig.getIcpJurisdictions();
11381
+ this.icpEnabled = this.abstractConfig.getIcpEnable();
11416
11382
  }
11417
11383
  ngAfterViewInit() {
11418
11384
  const slider = this.elementRef.nativeElement.querySelector('.slider');
@@ -11471,10 +11437,13 @@ class CaseFileViewFieldComponent {
11471
11437
  this.categoriesAndDocumentsSubscription.unsubscribe();
11472
11438
  }
11473
11439
  }
11440
+ isIcpEnabled() {
11441
+ return this.icpEnabled && ((this.icp_jurisdictions?.length < 1) || this.icp_jurisdictions.includes(this.caseNotifier?.cachedCaseView?.case_type?.jurisdiction.id));
11442
+ }
11474
11443
  }
11475
11444
  CaseFileViewFieldComponent.PARAM_CASE_ID = 'cid';
11476
- 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)); };
11477
- 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) {
11478
11447
  i0.ɵɵtemplate(0, CaseFileViewFieldComponent_ng_container_0_Template, 8, 1, "ng-container", 0);
11479
11448
  i0.ɵɵtemplate(1, CaseFileViewFieldComponent_div_1_Template, 5, 0, "div", 1);
11480
11449
  i0.ɵɵtemplate(2, CaseFileViewFieldComponent_div_2_Template, 9, 3, "div", 0);
@@ -11487,8 +11456,8 @@ CaseFileViewFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
11487
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}"] });
11488
11457
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseFileViewFieldComponent, [{
11489
11458
  type: Component,
11490
- 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"] }]
11491
- }], 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); })();
11492
11461
 
11493
11462
  class CaseFlagStateService {
11494
11463
  constructor() {
@@ -32353,26 +32322,18 @@ class EventStartGuard {
32353
32322
  task = tasksAssignedToUser[0];
32354
32323
  }
32355
32324
  // if one task assigned to user, allow user to complete event
32356
- const storeClientContext = {
32357
- client_context: {
32358
- user_task: {
32359
- task_data: task,
32360
- complete_task: true
32361
- }
32362
- }
32363
- };
32364
- this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
32325
+ this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
32365
32326
  return true;
32366
32327
  }
32367
32328
  }
32368
32329
  removeTaskFromSessionStorage() {
32369
- this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
32330
+ this.sessionStorageService.removeItem(EventStartGuard.TASK_TO_COMPLETE);
32370
32331
  }
32371
32332
  checkForTasks(payload, caseId, eventId, taskId) {
32372
32333
  if (taskId && payload?.tasks?.length > 0) {
32373
32334
  const task = payload.tasks.find((t) => t.id == taskId);
32374
32335
  if (task) {
32375
- this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(task));
32336
+ this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
32376
32337
  }
32377
32338
  else {
32378
32339
  this.removeTaskFromSessionStorage();
@@ -32394,7 +32355,7 @@ class EventStartGuard {
32394
32355
  }
32395
32356
  }
32396
32357
  }
32397
- EventStartGuard.CLIENT_CONTEXT = 'clientContext';
32358
+ EventStartGuard.TASK_TO_COMPLETE = 'taskToComplete';
32398
32359
  EventStartGuard.ɵfac = function EventStartGuard_Factory(t) { return new (t || EventStartGuard)(i0.ɵɵinject(WorkAllocationService), i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(SessionStorageService)); };
32399
32360
  EventStartGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventStartGuard, factory: EventStartGuard.ɵfac });
32400
32361
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EventStartGuard, [{
@@ -32532,17 +32493,9 @@ class EventStartStateMachineService {
32532
32493
  task = context.tasks[0];
32533
32494
  }
32534
32495
  const taskStr = JSON.stringify(task);
32535
- console.log('entryActionForStateOneTaskAssignedToUser: setting client context task_data to ' + taskStr);
32496
+ console.log('entryActionForStateOneTaskAssignedToUser: setting taskToComplete to ' + taskStr);
32536
32497
  // Store task to session
32537
- const clientContext = {
32538
- client_context: {
32539
- user_task: {
32540
- task_data: task,
32541
- complete_task: true
32542
- }
32543
- }
32544
- };
32545
- context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
32498
+ context.sessionStorageService.setItem('taskToComplete', taskStr);
32546
32499
  // Allow user to perform the event
32547
32500
  context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
32548
32501
  }