@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
@@ -1360,6 +1360,7 @@ HttpError.DEFAULT_MESSAGE = 'Something unexpected happened, our technical staff
1360
1360
  HttpError.DEFAULT_STATUS = 500;
1361
1361
  HttpError.MESSAGE_ERROR_429 = 'Your request was rate limited. Please wait a few seconds before retrying your document upload';
1362
1362
 
1363
+ /* istanbul ignore file */
1363
1364
  class AbstractAppConfig {
1364
1365
  /**
1365
1366
  * Dummy version replacing deprecated `getRemotePrintServiceUrl()`, to be removed in next major release
@@ -3903,13 +3904,6 @@ class FieldsUtils {
3903
3904
  return '';
3904
3905
  }
3905
3906
  }
3906
- static getUserTaskFromClientContext(clientContextStr) {
3907
- if (clientContextStr) {
3908
- let clientContext = JSON.parse(clientContextStr);
3909
- return clientContext.client_context.user_task;
3910
- }
3911
- return null;
3912
- }
3913
3907
  buildCanShowPredicate(eventTrigger, form) {
3914
3908
  const currentState = this.getCurrentEventState(eventTrigger, form);
3915
3909
  return (page) => {
@@ -7074,7 +7068,6 @@ class ProfileService {
7074
7068
  .set('experimental', 'true')
7075
7069
  .set('Accept', ProfileService.V2_MEDIATYPE_USER_PROFILE)
7076
7070
  .set('Content-Type', 'application/json');
7077
- // Not adding client context header because header is added to call immediately afterwards
7078
7071
  return this.httpService
7079
7072
  .get(url, { headers, observe: 'body' })
7080
7073
  .pipe(map((p) => plainToClass(Profile, p)));
@@ -7969,7 +7962,6 @@ class CasesService {
7969
7962
  let headers = new HttpHeaders();
7970
7963
  headers = headers.set('experimental', 'true');
7971
7964
  headers = headers.set('Content-Type', 'application/json');
7972
- headers = this.addClientContextHeader(headers);
7973
7965
  if (Draft.isDraft(caseId)) {
7974
7966
  headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_DRAFT_TRIGGER);
7975
7967
  }
@@ -7980,10 +7972,9 @@ class CasesService {
7980
7972
  headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_CASE_TRIGGER);
7981
7973
  }
7982
7974
  return this.http
7983
- .get(url, { headers, observe: 'response' })
7984
- .pipe(map((response) => {
7985
- this.updateClientContextStorage(response.headers);
7986
- return FieldsUtils.handleNestedDynamicLists(response.body);
7975
+ .get(url, { headers, observe: 'body' })
7976
+ .pipe(map(body => {
7977
+ return FieldsUtils.handleNestedDynamicLists(body);
7987
7978
  }), catchError(error => {
7988
7979
  this.errorService.setError(error);
7989
7980
  return throwError(error);
@@ -7992,17 +7983,13 @@ class CasesService {
7992
7983
  createEvent(caseDetails, eventData) {
7993
7984
  const caseId = caseDetails.case_id;
7994
7985
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/events`;
7995
- let headers = new HttpHeaders()
7986
+ const headers = new HttpHeaders()
7996
7987
  .set('experimental', 'true')
7997
7988
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_EVENT)
7998
7989
  .set('Content-Type', 'application/json');
7999
- headers = this.addClientContextHeader(headers);
8000
7990
  return this.http
8001
- .post(url, eventData, { headers, observe: 'response' })
8002
- .pipe(map((response) => {
8003
- this.updateClientContextStorage(response.headers);
8004
- return response.body;
8005
- }), catchError(error => {
7991
+ .post(url, eventData, { headers, observe: 'body' })
7992
+ .pipe(catchError(error => {
8006
7993
  this.errorService.setError(error);
8007
7994
  return throwError(error);
8008
7995
  }));
@@ -8010,17 +7997,13 @@ class CasesService {
8010
7997
  validateCase(ctid, eventData, pageId) {
8011
7998
  const pageIdString = pageId ? `?pageId=${pageId}` : '';
8012
7999
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/validate${pageIdString}`;
8013
- let headers = new HttpHeaders()
8000
+ const headers = new HttpHeaders()
8014
8001
  .set('experimental', 'true')
8015
8002
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE)
8016
8003
  .set('Content-Type', 'application/json');
8017
- headers = this.addClientContextHeader(headers);
8018
8004
  return this.http
8019
- .post(url, eventData, { headers, observe: 'response' })
8020
- .pipe(map((response) => {
8021
- this.updateClientContextStorage(response.headers);
8022
- return response.body;
8023
- }), catchError(error => {
8005
+ .post(url, eventData, { headers, observe: 'body' })
8006
+ .pipe(catchError(error => {
8024
8007
  this.errorService.setError(error);
8025
8008
  return throwError(error);
8026
8009
  }));
@@ -8031,34 +8014,26 @@ class CasesService {
8031
8014
  ignoreWarning = 'true';
8032
8015
  }
8033
8016
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/cases?ignore-warning=${ignoreWarning}`;
8034
- let headers = new HttpHeaders()
8017
+ const headers = new HttpHeaders()
8035
8018
  .set('experimental', 'true')
8036
8019
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_CASE)
8037
8020
  .set('Content-Type', 'application/json');
8038
- headers = this.addClientContextHeader(headers);
8039
8021
  return this.http
8040
- .post(url, eventData, { headers, observe: 'response' })
8041
- .pipe(map((response) => {
8042
- this.updateClientContextStorage(response.headers);
8043
- return response.body;
8044
- }), catchError(error => {
8022
+ .post(url, eventData, { headers, observe: 'body' })
8023
+ .pipe(catchError(error => {
8045
8024
  this.errorService.setError(error);
8046
8025
  return throwError(error);
8047
8026
  }));
8048
8027
  }
8049
8028
  getPrintDocuments(caseId) {
8050
8029
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/documents`;
8051
- let headers = new HttpHeaders()
8030
+ const headers = new HttpHeaders()
8052
8031
  .set('experimental', 'true')
8053
8032
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DOCUMENTS)
8054
8033
  .set('Content-Type', 'application/json');
8055
- headers = this.addClientContextHeader(headers);
8056
8034
  return this.http
8057
- .get(url, { headers, observe: 'response' })
8058
- .pipe(map((response) => {
8059
- this.updateClientContextStorage(response.headers);
8060
- return response.body.documentResources;
8061
- }), catchError(error => {
8035
+ .get(url, { headers, observe: 'body' })
8036
+ .pipe(map(body => body.documentResources), catchError(error => {
8062
8037
  this.errorService.setError(error);
8063
8038
  return throwError(error);
8064
8039
  }));
@@ -8091,6 +8066,17 @@ class CasesService {
8091
8066
  wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
8092
8067
  });
8093
8068
  }
8069
+ /*
8070
+ Checks if the user has role of pui-case-manager and returns true or false
8071
+ */
8072
+ isPuiCaseManager() {
8073
+ const userInfoStr = this.sessionStorageService.getItem('userDetails');
8074
+ if (userInfoStr) {
8075
+ const userInfo = JSON.parse(userInfoStr);
8076
+ return userInfo && userInfo.roles && (userInfo.roles.indexOf(CasesService.PUI_CASE_MANAGER) !== -1);
8077
+ }
8078
+ return false;
8079
+ }
8094
8080
  getCourtOrHearingCentreName(locationId) {
8095
8081
  return this.http.post(`/api/locations/getLocationsById`, { locations: [{ locationId }] });
8096
8082
  }
@@ -8135,25 +8121,6 @@ class CasesService {
8135
8121
  .get(url)
8136
8122
  .pipe(catchError(error => throwError(error)));
8137
8123
  }
8138
- addClientContextHeader(headers) {
8139
- const clientContextDetails = this.sessionStorageService.getItem('clientContext');
8140
- if (clientContextDetails) {
8141
- // may require URI encoding in certain circumstances
8142
- const clientContext = window.btoa(clientContextDetails);
8143
- if (clientContext) {
8144
- headers = headers.set('Client-Context', clientContext);
8145
- }
8146
- }
8147
- return headers;
8148
- }
8149
- updateClientContextStorage(headers) {
8150
- // for mocking - TODO: Kasi Remove/Uncomment for testing
8151
- // headers = this.setMockClientContextHeader(headers);
8152
- if (headers && headers.get('Client-Context')) {
8153
- const clientContextString = window.atob(headers.get('Client-Context'));
8154
- this.sessionStorageService.setItem('clientContext', clientContextString);
8155
- }
8156
- }
8157
8124
  }
8158
8125
  // Internal (UI) API
8159
8126
  CasesService.V2_MEDIATYPE_CASE_VIEW = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-case-view.v2+json';
@@ -8667,9 +8634,8 @@ class EventCompletionStateMachineService {
8667
8634
  entryActionForStateCompleteEventAndTask(state, context) {
8668
8635
  // Trigger final state to complete processing of state machine
8669
8636
  state.trigger(EventCompletionStates.Final);
8670
- const clientContextStr = context.sessionStorageService.getItem('clientContext');
8671
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8672
- if (userTask === null || userTask === void 0 ? void 0 : userTask.task_data) {
8637
+ const taskStr = context.sessionStorageService.getItem('taskToComplete');
8638
+ if (taskStr) {
8673
8639
  context.sessionStorageService.setItem('assignNeeded', 'false');
8674
8640
  // just set event can be completed
8675
8641
  context.component.eventCanBeCompleted.emit(true);
@@ -8688,9 +8654,9 @@ class EventCompletionStateMachineService {
8688
8654
  entryActionForStateTaskUnassigned(state, context) {
8689
8655
  // Trigger final state to complete processing of state machine
8690
8656
  state.trigger(EventCompletionStates.Final);
8691
- const clientContextStr = context.sessionStorageService.getItem('clientContext');
8692
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8693
- if (userTask === null || userTask === void 0 ? void 0 : userTask.task_data) {
8657
+ // Get task details
8658
+ const taskStr = context.sessionStorageService.getItem('taskToComplete');
8659
+ if (taskStr) {
8694
8660
  context.sessionStorageService.setItem('assignNeeded', 'true');
8695
8661
  context.component.eventCanBeCompleted.emit(true);
8696
8662
  }
@@ -8725,12 +8691,6 @@ class EventCompletionStateMachineService {
8725
8691
  addTransitionsForStateTaskUnassigned() {
8726
8692
  this.stateTaskUnassigned.addTransition(EventCompletionStates.Final, this.stateFinal);
8727
8693
  }
8728
- taskPresentInSessionStorage(context) {
8729
- const clientContextStr = context.sessionStorageService.getItem('clientContext');
8730
- console.log('clienht cintedt ', clientContextStr);
8731
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8732
- return !!userTask.task_data;
8733
- }
8734
8694
  }
8735
8695
  EventCompletionStateMachineService.ɵfac = function EventCompletionStateMachineService_Factory(t) { return new (t || EventCompletionStateMachineService)(); };
8736
8696
  EventCompletionStateMachineService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventCompletionStateMachineService, factory: EventCompletionStateMachineService.ɵfac });
@@ -9199,9 +9159,11 @@ class CaseEditComponent {
9199
9159
  this.isSubmitting = true;
9200
9160
  // We have to run the event completion checks if task in session storage
9201
9161
  // and if the task is in session storage, then is it associated to the case
9202
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
9203
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9204
- const taskInSessionStorage = userTask ? userTask.task_data : null;
9162
+ let taskInSessionStorage;
9163
+ const taskStr = this.sessionStorageService.getItem('taskToComplete');
9164
+ if (taskStr) {
9165
+ taskInSessionStorage = JSON.parse(taskStr);
9166
+ }
9205
9167
  if (taskInSessionStorage && taskInSessionStorage.case_id === this.getCaseId(caseDetails)) {
9206
9168
  // Show event completion component to perform event completion checks
9207
9169
  this.eventCompletionParams = ({
@@ -9400,16 +9362,14 @@ class CaseEditComponent {
9400
9362
  });
9401
9363
  }
9402
9364
  postCompleteTaskIfRequired() {
9403
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
9404
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9405
- const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
9365
+ const taskStr = this.sessionStorageService.getItem('taskToComplete');
9406
9366
  const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
9407
- if (task && assignNeeded && taskToBeCompleted) {
9408
- // const task: Task = JSON.parse(taskStr);
9367
+ if (taskStr && assignNeeded) {
9368
+ const task = JSON.parse(taskStr);
9409
9369
  return this.workAllocationService.assignAndCompleteTask(task.id);
9410
9370
  }
9411
- else if (task && taskToBeCompleted) {
9412
- // const task: Task = JSON.parse(taskStr);
9371
+ else if (taskStr) {
9372
+ const task = JSON.parse(taskStr);
9413
9373
  return this.workAllocationService.completeTask(task.id);
9414
9374
  }
9415
9375
  return of(true);
@@ -11060,12 +11020,8 @@ class CaseEventCompletionTaskReassignedComponent {
11060
11020
  }
11061
11021
  onContinue() {
11062
11022
  // Get task details
11063
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
11064
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
11065
- const task = userTask ? userTask.task_data : null;
11066
- // not complete_task not utilised here as related to event completion
11067
- // service wanting task associated with event to not be completed not directly relevant
11068
- if (task) {
11023
+ const taskStr = this.sessionStorageService.getItem('taskToComplete');
11024
+ if (taskStr) {
11069
11025
  this.sessionStorageService.setItem('assignNeeded', 'true');
11070
11026
  // set event can be completed to true
11071
11027
  this.parentComponent.eventCanBeCompleted.emit(true);
@@ -11599,7 +11555,7 @@ function CaseFileViewFieldComponent_div_2_ng_container_8_Template(rf, ctx) {
11599
11555
  if (rf & 2) {
11600
11556
  const ctx_r5 = i0.ɵɵnextContext(2);
11601
11557
  i0.ɵɵadvance(1);
11602
- 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");
11558
+ 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());
11603
11559
  }
11604
11560
  }
11605
11561
  function CaseFileViewFieldComponent_div_2_Template(rf, ctx) {
@@ -11613,7 +11569,7 @@ function CaseFileViewFieldComponent_div_2_Template(rf, ctx) {
11613
11569
  i0.ɵɵelementEnd()();
11614
11570
  i0.ɵɵelement(6, "div", 16);
11615
11571
  i0.ɵɵelementStart(7, "div", 17);
11616
- i0.ɵɵtemplate(8, CaseFileViewFieldComponent_div_2_ng_container_8_Template, 2, 7, "ng-container", 0);
11572
+ i0.ɵɵtemplate(8, CaseFileViewFieldComponent_div_2_ng_container_8_Template, 2, 8, "ng-container", 0);
11617
11573
  i0.ɵɵelementEnd()()();
11618
11574
  }
11619
11575
  if (rf & 2) {
@@ -11625,16 +11581,20 @@ function CaseFileViewFieldComponent_div_2_Template(rf, ctx) {
11625
11581
  }
11626
11582
  }
11627
11583
  class CaseFileViewFieldComponent {
11628
- constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService) {
11584
+ constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService, caseNotifier, abstractConfig) {
11629
11585
  this.elementRef = elementRef;
11630
11586
  this.route = route;
11631
11587
  this.caseFileViewService = caseFileViewService;
11632
11588
  this.documentManagementService = documentManagementService;
11633
11589
  this.loadingService = loadingService;
11634
11590
  this.sessionStorageService = sessionStorageService;
11591
+ this.caseNotifier = caseNotifier;
11592
+ this.abstractConfig = abstractConfig;
11635
11593
  this.allowMoving = true;
11636
11594
  this.getCategoriesAndDocumentsError = false;
11637
11595
  this.errorMessages = [];
11596
+ this.icp_jurisdictions = [];
11597
+ this.icpEnabled = false;
11638
11598
  }
11639
11599
  ngOnInit() {
11640
11600
  const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
@@ -11651,6 +11611,8 @@ class CaseFileViewFieldComponent {
11651
11611
  const acls = this.caseField.acls.filter(acl => userInfo.roles.includes(acl.role));
11652
11612
  // As there can be more than one intersecting role, if any acls are update: true
11653
11613
  this.allowMoving = acls.some(acl => acl.update);
11614
+ this.icp_jurisdictions = this.abstractConfig.getIcpJurisdictions();
11615
+ this.icpEnabled = this.abstractConfig.getIcpEnable();
11654
11616
  }
11655
11617
  ngAfterViewInit() {
11656
11618
  const slider = this.elementRef.nativeElement.querySelector('.slider');
@@ -11709,10 +11671,14 @@ class CaseFileViewFieldComponent {
11709
11671
  this.categoriesAndDocumentsSubscription.unsubscribe();
11710
11672
  }
11711
11673
  }
11674
+ isIcpEnabled() {
11675
+ var _a, _b, _c, _d;
11676
+ return this.icpEnabled && ((((_a = this.icp_jurisdictions) === null || _a === void 0 ? void 0 : _a.length) < 1) || this.icp_jurisdictions.includes((_d = (_c = (_b = this.caseNotifier) === null || _b === void 0 ? void 0 : _b.cachedCaseView) === null || _c === void 0 ? void 0 : _c.case_type) === null || _d === void 0 ? void 0 : _d.jurisdiction.id));
11677
+ }
11712
11678
  }
11713
11679
  CaseFileViewFieldComponent.PARAM_CASE_ID = 'cid';
11714
- 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)); };
11715
- 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) {
11680
+ 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)); };
11681
+ 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) {
11716
11682
  if (rf & 1) {
11717
11683
  i0.ɵɵtemplate(0, CaseFileViewFieldComponent_ng_container_0_Template, 8, 1, "ng-container", 0);
11718
11684
  i0.ɵɵtemplate(1, CaseFileViewFieldComponent_div_1_Template, 5, 0, "div", 1);
@@ -11729,8 +11695,8 @@ CaseFileViewFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
11729
11695
  (function () {
11730
11696
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseFileViewFieldComponent, [{
11731
11697
  type: Component,
11732
- 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"] }]
11733
- }], function () { return [{ type: i0.ElementRef }, { type: i1$1.ActivatedRoute }, { type: CaseFileViewService }, { type: DocumentManagementService }, { type: LoadingService }, { type: SessionStorageService }]; }, null);
11698
+ 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"] }]
11699
+ }], function () { return [{ type: i0.ElementRef }, { type: i1$1.ActivatedRoute }, { type: CaseFileViewService }, { type: DocumentManagementService }, { type: LoadingService }, { type: SessionStorageService }, { type: CaseNotifier }, { type: AbstractAppConfig }]; }, null);
11734
11700
  })();
11735
11701
 
11736
11702
  class CaseFlagStateService {
@@ -35092,27 +35058,19 @@ class EventStartGuard {
35092
35058
  task = tasksAssignedToUser[0];
35093
35059
  }
35094
35060
  // if one task assigned to user, allow user to complete event
35095
- const storeClientContext = {
35096
- client_context: {
35097
- user_task: {
35098
- task_data: task,
35099
- complete_task: true
35100
- }
35101
- }
35102
- };
35103
- this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
35061
+ this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
35104
35062
  return true;
35105
35063
  }
35106
35064
  }
35107
35065
  removeTaskFromSessionStorage() {
35108
- this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
35066
+ this.sessionStorageService.removeItem(EventStartGuard.TASK_TO_COMPLETE);
35109
35067
  }
35110
35068
  checkForTasks(payload, caseId, eventId, taskId) {
35111
35069
  var _a;
35112
35070
  if (taskId && ((_a = payload === null || payload === void 0 ? void 0 : payload.tasks) === null || _a === void 0 ? void 0 : _a.length) > 0) {
35113
35071
  const task = payload.tasks.find((t) => t.id == taskId);
35114
35072
  if (task) {
35115
- this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(task));
35073
+ this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
35116
35074
  }
35117
35075
  else {
35118
35076
  this.removeTaskFromSessionStorage();
@@ -35134,7 +35092,7 @@ class EventStartGuard {
35134
35092
  }
35135
35093
  }
35136
35094
  }
35137
- EventStartGuard.CLIENT_CONTEXT = 'clientContext';
35095
+ EventStartGuard.TASK_TO_COMPLETE = 'taskToComplete';
35138
35096
  EventStartGuard.ɵfac = function EventStartGuard_Factory(t) { return new (t || EventStartGuard)(i0.ɵɵinject(WorkAllocationService), i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(SessionStorageService)); };
35139
35097
  EventStartGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventStartGuard, factory: EventStartGuard.ɵfac });
35140
35098
  (function () {
@@ -35274,17 +35232,9 @@ class EventStartStateMachineService {
35274
35232
  task = context.tasks[0];
35275
35233
  }
35276
35234
  const taskStr = JSON.stringify(task);
35277
- console.log('entryActionForStateOneTaskAssignedToUser: setting client context task_data to ' + taskStr);
35235
+ console.log('entryActionForStateOneTaskAssignedToUser: setting taskToComplete to ' + taskStr);
35278
35236
  // Store task to session
35279
- const clientContext = {
35280
- client_context: {
35281
- user_task: {
35282
- task_data: task,
35283
- complete_task: true
35284
- }
35285
- }
35286
- };
35287
- context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
35237
+ context.sessionStorageService.setItem('taskToComplete', taskStr);
35288
35238
  // Allow user to perform the event
35289
35239
  context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
35290
35240
  }