@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
@@ -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,11 +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
- console.log('response barking mad', response);
7986
- this.updateClientContextStorage(response.headers);
7987
- return FieldsUtils.handleNestedDynamicLists(response.body);
7975
+ .get(url, { headers, observe: 'body' })
7976
+ .pipe(map(body => {
7977
+ return FieldsUtils.handleNestedDynamicLists(body);
7988
7978
  }), catchError(error => {
7989
7979
  this.errorService.setError(error);
7990
7980
  return throwError(error);
@@ -7993,17 +7983,13 @@ class CasesService {
7993
7983
  createEvent(caseDetails, eventData) {
7994
7984
  const caseId = caseDetails.case_id;
7995
7985
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/events`;
7996
- let headers = new HttpHeaders()
7986
+ const headers = new HttpHeaders()
7997
7987
  .set('experimental', 'true')
7998
7988
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_EVENT)
7999
7989
  .set('Content-Type', 'application/json');
8000
- headers = this.addClientContextHeader(headers);
8001
7990
  return this.http
8002
- .post(url, eventData, { headers, observe: 'response' })
8003
- .pipe(map((response) => {
8004
- this.updateClientContextStorage(response.headers);
8005
- return response.body;
8006
- }), catchError(error => {
7991
+ .post(url, eventData, { headers, observe: 'body' })
7992
+ .pipe(catchError(error => {
8007
7993
  this.errorService.setError(error);
8008
7994
  return throwError(error);
8009
7995
  }));
@@ -8011,17 +7997,13 @@ class CasesService {
8011
7997
  validateCase(ctid, eventData, pageId) {
8012
7998
  const pageIdString = pageId ? `?pageId=${pageId}` : '';
8013
7999
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/validate${pageIdString}`;
8014
- let headers = new HttpHeaders()
8000
+ const headers = new HttpHeaders()
8015
8001
  .set('experimental', 'true')
8016
8002
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE)
8017
8003
  .set('Content-Type', 'application/json');
8018
- headers = this.addClientContextHeader(headers);
8019
8004
  return this.http
8020
- .post(url, eventData, { headers, observe: 'response' })
8021
- .pipe(map((response) => {
8022
- this.updateClientContextStorage(response.headers);
8023
- return response.body;
8024
- }), catchError(error => {
8005
+ .post(url, eventData, { headers, observe: 'body' })
8006
+ .pipe(catchError(error => {
8025
8007
  this.errorService.setError(error);
8026
8008
  return throwError(error);
8027
8009
  }));
@@ -8032,34 +8014,26 @@ class CasesService {
8032
8014
  ignoreWarning = 'true';
8033
8015
  }
8034
8016
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/cases?ignore-warning=${ignoreWarning}`;
8035
- let headers = new HttpHeaders()
8017
+ const headers = new HttpHeaders()
8036
8018
  .set('experimental', 'true')
8037
8019
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_CASE)
8038
8020
  .set('Content-Type', 'application/json');
8039
- headers = this.addClientContextHeader(headers);
8040
8021
  return this.http
8041
- .post(url, eventData, { headers, observe: 'response' })
8042
- .pipe(map((response) => {
8043
- this.updateClientContextStorage(response.headers);
8044
- return response.body;
8045
- }), catchError(error => {
8022
+ .post(url, eventData, { headers, observe: 'body' })
8023
+ .pipe(catchError(error => {
8046
8024
  this.errorService.setError(error);
8047
8025
  return throwError(error);
8048
8026
  }));
8049
8027
  }
8050
8028
  getPrintDocuments(caseId) {
8051
8029
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/documents`;
8052
- let headers = new HttpHeaders()
8030
+ const headers = new HttpHeaders()
8053
8031
  .set('experimental', 'true')
8054
8032
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DOCUMENTS)
8055
8033
  .set('Content-Type', 'application/json');
8056
- headers = this.addClientContextHeader(headers);
8057
8034
  return this.http
8058
- .get(url, { headers, observe: 'response' })
8059
- .pipe(map((response) => {
8060
- this.updateClientContextStorage(response.headers);
8061
- return response.body.documentResources;
8062
- }), catchError(error => {
8035
+ .get(url, { headers, observe: 'body' })
8036
+ .pipe(map(body => body.documentResources), catchError(error => {
8063
8037
  this.errorService.setError(error);
8064
8038
  return throwError(error);
8065
8039
  }));
@@ -8092,6 +8066,17 @@ class CasesService {
8092
8066
  wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
8093
8067
  });
8094
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
+ }
8095
8080
  getCourtOrHearingCentreName(locationId) {
8096
8081
  return this.http.post(`/api/locations/getLocationsById`, { locations: [{ locationId }] });
8097
8082
  }
@@ -8136,25 +8121,6 @@ class CasesService {
8136
8121
  .get(url)
8137
8122
  .pipe(catchError(error => throwError(error)));
8138
8123
  }
8139
- addClientContextHeader(headers) {
8140
- const clientContextDetails = this.sessionStorageService.getItem('clientContext');
8141
- if (clientContextDetails) {
8142
- // may require URI encoding in certain circumstances
8143
- const clientContext = window.btoa(clientContextDetails);
8144
- if (clientContext) {
8145
- headers = headers.set('Client-Context', clientContext);
8146
- }
8147
- }
8148
- return headers;
8149
- }
8150
- updateClientContextStorage(headers) {
8151
- // for mocking - TODO: Kasi Remove/Uncomment for testing
8152
- // headers = this.setMockClientContextHeader(headers);
8153
- if (headers && headers.get('Client-Context')) {
8154
- const clientContextString = window.atob(headers.get('Client-Context'));
8155
- this.sessionStorageService.setItem('clientContext', clientContextString);
8156
- }
8157
- }
8158
8124
  }
8159
8125
  // Internal (UI) API
8160
8126
  CasesService.V2_MEDIATYPE_CASE_VIEW = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.ui-case-view.v2+json';
@@ -8668,7 +8634,8 @@ class EventCompletionStateMachineService {
8668
8634
  entryActionForStateCompleteEventAndTask(state, context) {
8669
8635
  // Trigger final state to complete processing of state machine
8670
8636
  state.trigger(EventCompletionStates.Final);
8671
- if (this.getTaskFromClientContext(context)) {
8637
+ const taskStr = context.sessionStorageService.getItem('taskToComplete');
8638
+ if (taskStr) {
8672
8639
  context.sessionStorageService.setItem('assignNeeded', 'false');
8673
8640
  // just set event can be completed
8674
8641
  context.component.eventCanBeCompleted.emit(true);
@@ -8687,7 +8654,9 @@ class EventCompletionStateMachineService {
8687
8654
  entryActionForStateTaskUnassigned(state, context) {
8688
8655
  // Trigger final state to complete processing of state machine
8689
8656
  state.trigger(EventCompletionStates.Final);
8690
- if (this.getTaskFromClientContext(context)) {
8657
+ // Get task details
8658
+ const taskStr = context.sessionStorageService.getItem('taskToComplete');
8659
+ if (taskStr) {
8691
8660
  context.sessionStorageService.setItem('assignNeeded', 'true');
8692
8661
  context.component.eventCanBeCompleted.emit(true);
8693
8662
  }
@@ -8722,11 +8691,6 @@ class EventCompletionStateMachineService {
8722
8691
  addTransitionsForStateTaskUnassigned() {
8723
8692
  this.stateTaskUnassigned.addTransition(EventCompletionStates.Final, this.stateFinal);
8724
8693
  }
8725
- getTaskFromClientContext(context) {
8726
- const clientContextStr = context.sessionStorageService.getItem('clientContext');
8727
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8728
- return userTask ? userTask.task_data : null;
8729
- }
8730
8694
  }
8731
8695
  EventCompletionStateMachineService.ɵfac = function EventCompletionStateMachineService_Factory(t) { return new (t || EventCompletionStateMachineService)(); };
8732
8696
  EventCompletionStateMachineService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventCompletionStateMachineService, factory: EventCompletionStateMachineService.ɵfac });
@@ -9195,9 +9159,11 @@ class CaseEditComponent {
9195
9159
  this.isSubmitting = true;
9196
9160
  // We have to run the event completion checks if task in session storage
9197
9161
  // and if the task is in session storage, then is it associated to the case
9198
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
9199
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9200
- 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
+ }
9201
9167
  if (taskInSessionStorage && taskInSessionStorage.case_id === this.getCaseId(caseDetails)) {
9202
9168
  // Show event completion component to perform event completion checks
9203
9169
  this.eventCompletionParams = ({
@@ -9396,16 +9362,14 @@ class CaseEditComponent {
9396
9362
  });
9397
9363
  }
9398
9364
  postCompleteTaskIfRequired() {
9399
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
9400
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9401
- const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
9365
+ const taskStr = this.sessionStorageService.getItem('taskToComplete');
9402
9366
  const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
9403
- if (task && assignNeeded && taskToBeCompleted) {
9404
- // const task: Task = JSON.parse(taskStr);
9367
+ if (taskStr && assignNeeded) {
9368
+ const task = JSON.parse(taskStr);
9405
9369
  return this.workAllocationService.assignAndCompleteTask(task.id);
9406
9370
  }
9407
- else if (task && taskToBeCompleted) {
9408
- // const task: Task = JSON.parse(taskStr);
9371
+ else if (taskStr) {
9372
+ const task = JSON.parse(taskStr);
9409
9373
  return this.workAllocationService.completeTask(task.id);
9410
9374
  }
9411
9375
  return of(true);
@@ -11056,12 +11020,8 @@ class CaseEventCompletionTaskReassignedComponent {
11056
11020
  }
11057
11021
  onContinue() {
11058
11022
  // Get task details
11059
- const clientContextStr = this.sessionStorageService.getItem('clientContext');
11060
- const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
11061
- const task = userTask ? userTask.task_data : null;
11062
- // not complete_task not utilised here as related to event completion
11063
- // service wanting task associated with event to not be completed not directly relevant
11064
- if (task) {
11023
+ const taskStr = this.sessionStorageService.getItem('taskToComplete');
11024
+ if (taskStr) {
11065
11025
  this.sessionStorageService.setItem('assignNeeded', 'true');
11066
11026
  // set event can be completed to true
11067
11027
  this.parentComponent.eventCanBeCompleted.emit(true);
@@ -11595,7 +11555,7 @@ function CaseFileViewFieldComponent_div_2_ng_container_8_Template(rf, ctx) {
11595
11555
  if (rf & 2) {
11596
11556
  const ctx_r5 = i0.ɵɵnextContext(2);
11597
11557
  i0.ɵɵadvance(1);
11598
- 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());
11599
11559
  }
11600
11560
  }
11601
11561
  function CaseFileViewFieldComponent_div_2_Template(rf, ctx) {
@@ -11609,7 +11569,7 @@ function CaseFileViewFieldComponent_div_2_Template(rf, ctx) {
11609
11569
  i0.ɵɵelementEnd()();
11610
11570
  i0.ɵɵelement(6, "div", 16);
11611
11571
  i0.ɵɵelementStart(7, "div", 17);
11612
- 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);
11613
11573
  i0.ɵɵelementEnd()()();
11614
11574
  }
11615
11575
  if (rf & 2) {
@@ -11621,16 +11581,20 @@ function CaseFileViewFieldComponent_div_2_Template(rf, ctx) {
11621
11581
  }
11622
11582
  }
11623
11583
  class CaseFileViewFieldComponent {
11624
- constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService) {
11584
+ constructor(elementRef, route, caseFileViewService, documentManagementService, loadingService, sessionStorageService, caseNotifier, abstractConfig) {
11625
11585
  this.elementRef = elementRef;
11626
11586
  this.route = route;
11627
11587
  this.caseFileViewService = caseFileViewService;
11628
11588
  this.documentManagementService = documentManagementService;
11629
11589
  this.loadingService = loadingService;
11630
11590
  this.sessionStorageService = sessionStorageService;
11591
+ this.caseNotifier = caseNotifier;
11592
+ this.abstractConfig = abstractConfig;
11631
11593
  this.allowMoving = true;
11632
11594
  this.getCategoriesAndDocumentsError = false;
11633
11595
  this.errorMessages = [];
11596
+ this.icp_jurisdictions = [];
11597
+ this.icpEnabled = false;
11634
11598
  }
11635
11599
  ngOnInit() {
11636
11600
  const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
@@ -11647,6 +11611,8 @@ class CaseFileViewFieldComponent {
11647
11611
  const acls = this.caseField.acls.filter(acl => userInfo.roles.includes(acl.role));
11648
11612
  // As there can be more than one intersecting role, if any acls are update: true
11649
11613
  this.allowMoving = acls.some(acl => acl.update);
11614
+ this.icp_jurisdictions = this.abstractConfig.getIcpJurisdictions();
11615
+ this.icpEnabled = this.abstractConfig.getIcpEnable();
11650
11616
  }
11651
11617
  ngAfterViewInit() {
11652
11618
  const slider = this.elementRef.nativeElement.querySelector('.slider');
@@ -11705,10 +11671,14 @@ class CaseFileViewFieldComponent {
11705
11671
  this.categoriesAndDocumentsSubscription.unsubscribe();
11706
11672
  }
11707
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
+ }
11708
11678
  }
11709
11679
  CaseFileViewFieldComponent.PARAM_CASE_ID = 'cid';
11710
- 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)); };
11711
- 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) {
11712
11682
  if (rf & 1) {
11713
11683
  i0.ɵɵtemplate(0, CaseFileViewFieldComponent_ng_container_0_Template, 8, 1, "ng-container", 0);
11714
11684
  i0.ɵɵtemplate(1, CaseFileViewFieldComponent_div_1_Template, 5, 0, "div", 1);
@@ -11725,8 +11695,8 @@ CaseFileViewFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type:
11725
11695
  (function () {
11726
11696
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseFileViewFieldComponent, [{
11727
11697
  type: Component,
11728
- 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"] }]
11729
- }], 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);
11730
11700
  })();
11731
11701
 
11732
11702
  class CaseFlagStateService {
@@ -35088,27 +35058,19 @@ class EventStartGuard {
35088
35058
  task = tasksAssignedToUser[0];
35089
35059
  }
35090
35060
  // if one task assigned to user, allow user to complete event
35091
- const storeClientContext = {
35092
- client_context: {
35093
- user_task: {
35094
- task_data: task,
35095
- complete_task: true
35096
- }
35097
- }
35098
- };
35099
- this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
35061
+ this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
35100
35062
  return true;
35101
35063
  }
35102
35064
  }
35103
35065
  removeTaskFromSessionStorage() {
35104
- this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
35066
+ this.sessionStorageService.removeItem(EventStartGuard.TASK_TO_COMPLETE);
35105
35067
  }
35106
35068
  checkForTasks(payload, caseId, eventId, taskId) {
35107
35069
  var _a;
35108
35070
  if (taskId && ((_a = payload === null || payload === void 0 ? void 0 : payload.tasks) === null || _a === void 0 ? void 0 : _a.length) > 0) {
35109
35071
  const task = payload.tasks.find((t) => t.id == taskId);
35110
35072
  if (task) {
35111
- this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(task));
35073
+ this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
35112
35074
  }
35113
35075
  else {
35114
35076
  this.removeTaskFromSessionStorage();
@@ -35130,7 +35092,7 @@ class EventStartGuard {
35130
35092
  }
35131
35093
  }
35132
35094
  }
35133
- EventStartGuard.CLIENT_CONTEXT = 'clientContext';
35095
+ EventStartGuard.TASK_TO_COMPLETE = 'taskToComplete';
35134
35096
  EventStartGuard.ɵfac = function EventStartGuard_Factory(t) { return new (t || EventStartGuard)(i0.ɵɵinject(WorkAllocationService), i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(SessionStorageService)); };
35135
35097
  EventStartGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventStartGuard, factory: EventStartGuard.ɵfac });
35136
35098
  (function () {
@@ -35270,17 +35232,9 @@ class EventStartStateMachineService {
35270
35232
  task = context.tasks[0];
35271
35233
  }
35272
35234
  const taskStr = JSON.stringify(task);
35273
- console.log('entryActionForStateOneTaskAssignedToUser: setting client context task_data to ' + taskStr);
35235
+ console.log('entryActionForStateOneTaskAssignedToUser: setting taskToComplete to ' + taskStr);
35274
35236
  // Store task to session
35275
- const clientContext = {
35276
- client_context: {
35277
- user_task: {
35278
- task_data: task,
35279
- complete_task: true
35280
- }
35281
- }
35282
- };
35283
- context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
35237
+ context.sessionStorageService.setItem('taskToComplete', taskStr);
35284
35238
  // Allow user to perform the event
35285
35239
  context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
35286
35240
  }