@hmcts/ccd-case-ui-toolkit 7.0.61 → 7.0.63-incorrect-font-size-fix

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 (29) hide show
  1. package/esm2022/lib/shared/components/case-editor/case-edit/case-edit.component.mjs +9 -10
  2. package/esm2022/lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.mjs +3 -3
  3. package/esm2022/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.mjs +17 -15
  4. package/esm2022/lib/shared/components/case-editor/services/cases.service.mjs +53 -27
  5. package/esm2022/lib/shared/components/case-editor/services/event-completion-state-machine.service.mjs +13 -6
  6. package/esm2022/lib/shared/components/case-editor/services/work-allocation.service.mjs +9 -3
  7. package/esm2022/lib/shared/components/event-start/event-guard/event-start.guard.mjs +13 -5
  8. package/esm2022/lib/shared/components/event-start/services/event-start-state-machine.service.mjs +11 -3
  9. package/esm2022/lib/shared/domain/work-allocation/Task.mjs +1 -1
  10. package/esm2022/lib/shared/services/fields/fields.utils.mjs +8 -1
  11. package/esm2022/lib/shared/services/profile/profile.service.mjs +2 -1
  12. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +118 -53
  13. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  14. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
  15. package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.d.ts +1 -2
  16. 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
  17. package/lib/shared/components/case-editor/services/cases.service.d.ts +2 -1
  18. package/lib/shared/components/case-editor/services/cases.service.d.ts.map +1 -1
  19. package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts +1 -0
  20. package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts.map +1 -1
  21. package/lib/shared/components/case-editor/services/work-allocation.service.d.ts.map +1 -1
  22. package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts +1 -1
  23. package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts.map +1 -1
  24. package/lib/shared/components/event-start/services/event-start-state-machine.service.d.ts.map +1 -1
  25. package/lib/shared/domain/work-allocation/Task.d.ts +4 -0
  26. package/lib/shared/domain/work-allocation/Task.d.ts.map +1 -1
  27. package/lib/shared/services/fields/fields.utils.d.ts +2 -0
  28. package/lib/shared/services/fields/fields.utils.d.ts.map +1 -1
  29. package/package.json +1 -1
@@ -4340,6 +4340,13 @@ class FieldsUtils {
4340
4340
  return '';
4341
4341
  }
4342
4342
  }
4343
+ static getUserTaskFromClientContext(clientContextStr) {
4344
+ if (clientContextStr) {
4345
+ let clientContext = JSON.parse(clientContextStr);
4346
+ return clientContext.client_context.user_task;
4347
+ }
4348
+ return null;
4349
+ }
4343
4350
  buildCanShowPredicate(eventTrigger, form) {
4344
4351
  const currentState = this.getCurrentEventState(eventTrigger, form);
4345
4352
  return (page) => {
@@ -7175,6 +7182,7 @@ class ProfileService {
7175
7182
  .set('experimental', 'true')
7176
7183
  .set('Accept', ProfileService.V2_MEDIATYPE_USER_PROFILE)
7177
7184
  .set('Content-Type', 'application/json');
7185
+ // Not adding client context header because header is added to call immediately afterwards
7178
7186
  return this.httpService
7179
7187
  .get(url, { headers, observe: 'body' })
7180
7188
  .pipe(map((p) => plainToClass(Profile, p)));
@@ -8071,6 +8079,7 @@ class CasesService {
8071
8079
  let headers = new HttpHeaders();
8072
8080
  headers = headers.set('experimental', 'true');
8073
8081
  headers = headers.set('Content-Type', 'application/json');
8082
+ headers = this.addClientContextHeader(headers);
8074
8083
  if (Draft.isDraft(caseId)) {
8075
8084
  headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_DRAFT_TRIGGER);
8076
8085
  }
@@ -8081,9 +8090,10 @@ class CasesService {
8081
8090
  headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_CASE_TRIGGER);
8082
8091
  }
8083
8092
  return this.http
8084
- .get(url, { headers, observe: 'body' })
8085
- .pipe(map(body => {
8086
- return FieldsUtils.handleNestedDynamicLists(body);
8093
+ .get(url, { headers, observe: 'response' })
8094
+ .pipe(map((response) => {
8095
+ this.updateClientContextStorage(response.headers);
8096
+ return FieldsUtils.handleNestedDynamicLists(response.body);
8087
8097
  }), catchError(error => {
8088
8098
  this.errorService.setError(error);
8089
8099
  return throwError(error);
@@ -8092,13 +8102,17 @@ class CasesService {
8092
8102
  createEvent(caseDetails, eventData) {
8093
8103
  const caseId = caseDetails.case_id;
8094
8104
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/events`;
8095
- const headers = new HttpHeaders()
8105
+ let headers = new HttpHeaders()
8096
8106
  .set('experimental', 'true')
8097
8107
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_EVENT)
8098
8108
  .set('Content-Type', 'application/json');
8109
+ headers = this.addClientContextHeader(headers);
8099
8110
  return this.http
8100
- .post(url, eventData, { headers, observe: 'body' })
8101
- .pipe(catchError(error => {
8111
+ .post(url, eventData, { headers, observe: 'response' })
8112
+ .pipe(map((response) => {
8113
+ this.updateClientContextStorage(response.headers);
8114
+ return response.body;
8115
+ }), catchError(error => {
8102
8116
  this.errorService.setError(error);
8103
8117
  return throwError(error);
8104
8118
  }));
@@ -8106,13 +8120,17 @@ class CasesService {
8106
8120
  validateCase(ctid, eventData, pageId) {
8107
8121
  const pageIdString = pageId ? `?pageId=${pageId}` : '';
8108
8122
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/validate${pageIdString}`;
8109
- const headers = new HttpHeaders()
8123
+ let headers = new HttpHeaders()
8110
8124
  .set('experimental', 'true')
8111
8125
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE)
8112
8126
  .set('Content-Type', 'application/json');
8127
+ headers = this.addClientContextHeader(headers);
8113
8128
  return this.http
8114
- .post(url, eventData, { headers, observe: 'body' })
8115
- .pipe(catchError(error => {
8129
+ .post(url, eventData, { headers, observe: 'response' })
8130
+ .pipe(map((response) => {
8131
+ this.updateClientContextStorage(response.headers);
8132
+ return response.body;
8133
+ }), catchError(error => {
8116
8134
  this.errorService.setError(error);
8117
8135
  return throwError(error);
8118
8136
  }));
@@ -8123,26 +8141,34 @@ class CasesService {
8123
8141
  ignoreWarning = 'true';
8124
8142
  }
8125
8143
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/cases?ignore-warning=${ignoreWarning}`;
8126
- const headers = new HttpHeaders()
8144
+ let headers = new HttpHeaders()
8127
8145
  .set('experimental', 'true')
8128
8146
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_CASE)
8129
8147
  .set('Content-Type', 'application/json');
8148
+ headers = this.addClientContextHeader(headers);
8130
8149
  return this.http
8131
- .post(url, eventData, { headers, observe: 'body' })
8132
- .pipe(catchError(error => {
8150
+ .post(url, eventData, { headers, observe: 'response' })
8151
+ .pipe(map((response) => {
8152
+ this.updateClientContextStorage(response.headers);
8153
+ return response.body;
8154
+ }), catchError(error => {
8133
8155
  this.errorService.setError(error);
8134
8156
  return throwError(error);
8135
8157
  }));
8136
8158
  }
8137
8159
  getPrintDocuments(caseId) {
8138
8160
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/documents`;
8139
- const headers = new HttpHeaders()
8161
+ let headers = new HttpHeaders()
8140
8162
  .set('experimental', 'true')
8141
8163
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DOCUMENTS)
8142
8164
  .set('Content-Type', 'application/json');
8165
+ headers = this.addClientContextHeader(headers);
8143
8166
  return this.http
8144
- .get(url, { headers, observe: 'body' })
8145
- .pipe(map(body => body.documentResources), catchError(error => {
8167
+ .get(url, { headers, observe: 'response' })
8168
+ .pipe(map((response) => {
8169
+ this.updateClientContextStorage(response.headers);
8170
+ return response.body.documentResources;
8171
+ }), catchError(error => {
8146
8172
  this.errorService.setError(error);
8147
8173
  return throwError(error);
8148
8174
  }));
@@ -8175,17 +8201,6 @@ class CasesService {
8175
8201
  wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
8176
8202
  });
8177
8203
  }
8178
- /*
8179
- Checks if the user has role of pui-case-manager and returns true or false
8180
- */
8181
- isPuiCaseManager() {
8182
- const userInfoStr = this.sessionStorageService.getItem('userDetails');
8183
- if (userInfoStr) {
8184
- const userInfo = JSON.parse(userInfoStr);
8185
- return userInfo && userInfo.roles && (userInfo.roles.indexOf(CasesService.PUI_CASE_MANAGER) !== -1);
8186
- }
8187
- return false;
8188
- }
8189
8204
  getCourtOrHearingCentreName(locationId) {
8190
8205
  return this.http.post(`/api/locations/getLocationsById`, { locations: [{ locationId }] });
8191
8206
  }
@@ -8252,6 +8267,25 @@ class CasesService {
8252
8267
  .get(url)
8253
8268
  .pipe(catchError(error => throwError(error)));
8254
8269
  }
8270
+ addClientContextHeader(headers) {
8271
+ const clientContextDetails = this.sessionStorageService.getItem('clientContext');
8272
+ if (clientContextDetails) {
8273
+ // may require URI encoding in certain circumstances
8274
+ const clientContext = window.btoa(clientContextDetails);
8275
+ if (clientContext) {
8276
+ headers = headers.set('Client-Context', clientContext);
8277
+ }
8278
+ }
8279
+ return headers;
8280
+ }
8281
+ updateClientContextStorage(headers) {
8282
+ // for mocking - TODO: Kasi Remove/Uncomment for testing
8283
+ // headers = this.setMockClientContextHeader(headers);
8284
+ if (headers && headers.get('Client-Context')) {
8285
+ const clientContextString = window.atob(headers.get('Client-Context'));
8286
+ this.sessionStorageService.setItem('clientContext', clientContextString);
8287
+ }
8288
+ }
8255
8289
  static ɵfac = function CasesService_Factory(t) { return new (t || CasesService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(OrderService), i0.ɵɵinject(HttpErrorService), i0.ɵɵinject(WizardPageFieldToCaseFieldMapper), i0.ɵɵinject(LoadingService), i0.ɵɵinject(SessionStorageService), i0.ɵɵinject(RetryUtil)); };
8256
8290
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
8257
8291
  }
@@ -8764,8 +8798,9 @@ class EventCompletionStateMachineService {
8764
8798
  entryActionForStateCompleteEventAndTask(state, context) {
8765
8799
  // Trigger final state to complete processing of state machine
8766
8800
  state.trigger(EventCompletionStates.Final);
8767
- const taskStr = context.sessionStorageService.getItem('taskToComplete');
8768
- if (taskStr) {
8801
+ const clientContextStr = context.sessionStorageService.getItem('clientContext');
8802
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8803
+ if (userTask?.task_data) {
8769
8804
  context.sessionStorageService.setItem('assignNeeded', 'false');
8770
8805
  // just set event can be completed
8771
8806
  context.component.eventCanBeCompleted.emit(true);
@@ -8784,9 +8819,9 @@ class EventCompletionStateMachineService {
8784
8819
  entryActionForStateTaskUnassigned(state, context) {
8785
8820
  // Trigger final state to complete processing of state machine
8786
8821
  state.trigger(EventCompletionStates.Final);
8787
- // Get task details
8788
- const taskStr = context.sessionStorageService.getItem('taskToComplete');
8789
- if (taskStr) {
8822
+ const clientContextStr = context.sessionStorageService.getItem('clientContext');
8823
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8824
+ if (userTask?.task_data) {
8790
8825
  context.sessionStorageService.setItem('assignNeeded', 'true');
8791
8826
  context.component.eventCanBeCompleted.emit(true);
8792
8827
  }
@@ -8821,6 +8856,11 @@ class EventCompletionStateMachineService {
8821
8856
  addTransitionsForStateTaskUnassigned() {
8822
8857
  this.stateTaskUnassigned.addTransition(EventCompletionStates.Final, this.stateFinal);
8823
8858
  }
8859
+ taskPresentInSessionStorage(context) {
8860
+ const clientContextStr = context.sessionStorageService.getItem('clientContext');
8861
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8862
+ return !!userTask.task_data;
8863
+ }
8824
8864
  static ɵfac = function EventCompletionStateMachineService_Factory(t) { return new (t || EventCompletionStateMachineService)(); };
8825
8865
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventCompletionStateMachineService, factory: EventCompletionStateMachineService.ɵfac });
8826
8866
  }
@@ -8947,8 +8987,14 @@ class WorkAllocationService {
8947
8987
  }
8948
8988
  isWAEnabled(jurisdiction, caseType) {
8949
8989
  this.features = this.appConfig.getWAServiceConfig();
8950
- const ftstr = JSON.stringify(this.features);
8951
- this.appConfig.logMessage(`isWAEnabled: wa-service-config returning ${ftstr.length > 0}`);
8990
+ if (this.features) {
8991
+ const ftstr = JSON.stringify(this.features);
8992
+ this.appConfig?.logMessage(`isWAEnabled: wa-service-config returning ${ftstr?.length > 0}`);
8993
+ }
8994
+ else {
8995
+ this.appConfig?.logMessage(`isWAEnabled: wa-service-config returning no features`);
8996
+ return false;
8997
+ }
8952
8998
  let enabled = false;
8953
8999
  if (!jurisdiction || !caseType) {
8954
9000
  const caseInfo = JSON.parse(this.sessionStorageService.getItem('caseInfo'));
@@ -9330,13 +9376,12 @@ class CaseEditComponent {
9330
9376
  this.isSubmitting = true;
9331
9377
  // We have to run the event completion checks if task in session storage
9332
9378
  // and if the task is in session storage, then is it associated to the case
9333
- let taskInSessionStorage;
9379
+ const clientContextStr = this.sessionStorageService.getItem('clientContext');
9380
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9381
+ const taskInSessionStorage = userTask ? userTask.task_data : null;
9334
9382
  let taskEventInSessionStorage;
9335
9383
  const taskStr = this.sessionStorageService.getItem('taskToComplete');
9336
9384
  const taskEventStr = this.sessionStorageService.getItem('taskEvent');
9337
- if (taskStr) {
9338
- taskInSessionStorage = JSON.parse(taskStr);
9339
- }
9340
9385
  if (taskEventStr) {
9341
9386
  taskEventInSessionStorage = JSON.parse(taskEventStr);
9342
9387
  }
@@ -9547,15 +9592,15 @@ class CaseEditComponent {
9547
9592
  });
9548
9593
  }
9549
9594
  postCompleteTaskIfRequired() {
9550
- const taskStr = this.sessionStorageService.getItem('taskToComplete');
9595
+ const clientContextStr = this.sessionStorageService.getItem('clientContext');
9596
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9597
+ const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
9551
9598
  const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
9552
- if (taskStr && assignNeeded) {
9553
- const task = JSON.parse(taskStr);
9599
+ if (task && assignNeeded && taskToBeCompleted) {
9554
9600
  this.abstractConfig.logMessage(`postCompleteTaskIfRequired with assignNeeded: taskId ${task.id} and event name ${this.eventTrigger.name}`);
9555
9601
  return this.workAllocationService.assignAndCompleteTask(task.id, this.eventTrigger.name);
9556
9602
  }
9557
- else if (taskStr) {
9558
- const task = JSON.parse(taskStr);
9603
+ else if (task && taskToBeCompleted) {
9559
9604
  this.abstractConfig.logMessage(`postCompleteTaskIfRequired: taskId ${task.id} and event name ${this.eventTrigger.name}`);
9560
9605
  return this.workAllocationService.completeTask(task.id, this.eventTrigger.name);
9561
9606
  }
@@ -11157,8 +11202,12 @@ class CaseEventCompletionTaskReassignedComponent {
11157
11202
  }
11158
11203
  onContinue() {
11159
11204
  // Get task details
11160
- const taskStr = this.sessionStorageService.getItem('taskToComplete');
11161
- if (taskStr) {
11205
+ const clientContextStr = this.sessionStorageService.getItem('clientContext');
11206
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
11207
+ const task = userTask ? userTask.task_data : null;
11208
+ // not complete_task not utilised here as related to event completion
11209
+ // service wanting task associated with event to not be completed not directly relevant
11210
+ if (task) {
11162
11211
  this.sessionStorageService.setItem('assignNeeded', 'true');
11163
11212
  // set event can be completed to true
11164
11213
  this.parentComponent.eventCanBeCompleted.emit(true);
@@ -11182,7 +11231,7 @@ class CaseEventCompletionTaskReassignedComponent {
11182
11231
  type: Inject,
11183
11232
  args: [COMPONENT_PORTAL_INJECTION_TOKEN]
11184
11233
  }] }, { type: i1$1.ActivatedRoute }, { type: WorkAllocationService }, { type: SessionStorageService }, { type: JudicialworkerService }, { type: CaseworkerService }, { type: AlertService }], null); })();
11185
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEventCompletionTaskReassignedComponent, { className: "CaseEventCompletionTaskReassignedComponent", filePath: "lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.ts", lineNumber: 16 }); })();
11234
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEventCompletionTaskReassignedComponent, { className: "CaseEventCompletionTaskReassignedComponent", filePath: "lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.ts", lineNumber: 19 }); })();
11186
11235
 
11187
11236
  function CaseEventCompletionComponent_ng_template_0_Template(rf, ctx) { }
11188
11237
  const COMPONENT_PORTAL_INJECTION_TOKEN = new InjectionToken('');
@@ -29032,7 +29081,7 @@ class CaseEditSubmitComponent {
29032
29081
  return 'Cancel';
29033
29082
  }
29034
29083
  static ɵfac = function CaseEditSubmitComponent_Factory(t) { return new (t || CaseEditSubmitComponent)(i0.ɵɵdirectiveInject(CaseEditComponent), i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(CaseFieldService), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(OrderService), i0.ɵɵdirectiveInject(ProfileNotifier), i0.ɵɵdirectiveInject(FormValidatorsService)); };
29035
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEditSubmitComponent, selectors: [["ccd-case-edit-submit"]], decls: 23, vars: 21, consts: [["titleBlock", ""], ["idBlock", ""], [1, "govuk-heading-l"], [4, "ngIf", "ngIfThen", "ngIfElse"], [3, "error"], [3, "callbackErrorsContext", "callbackErrorsSubject"], [1, "check-your-answers", 3, "submit", "formGroup"], [4, "ngIf"], [3, "eventCompletionParams", "eventCanBeCompleted", 4, "ngIf"], [1, "form-group", "form-group-related"], ["class", "button button-secondary", "type", "button", 3, "disabled", "click", 4, "ngIf"], ["type", "submit", 1, "button", 3, "disabled"], [1, "cancel"], ["href", "javascript:void(0)", 3, "click"], [3, "content"], ["class", "heading-h2", 4, "ngIf"], [1, "heading-h2"], ["class", "text-16", 4, "ngIf"], ["aria-describedby", "check your answers table", 1, "form-table"], [4, "ngFor", "ngForOf"], [1, "text-16"], ["ccdLabelSubstitutor", "", 3, "caseField", "hidden", "formGroup", "contextFields"], ["class", "valign-top case-field-label", 4, "ngIf"], [1, "form-cell", "case-field-content"], [3, "formGroup", "topLevelFormGroup", "caseField", "context", "caseFields"], [1, "valign-top", "case-field-label"], [1, "valign-top", "check-your-answers__change", "case-field-change"], ["href", "javascript:void(0)", 3, "click", 4, "ngIf"], ["aria-describedby", "summary fields table", 1, "summary-fields"], [3, "ngSwitch"], ["ccdLabelSubstitutor", "", 3, "caseField", "formGroup", "contextFields", 4, "ngSwitchCase"], ["class", "compound-field", "ccdLabelSubstitutor", "", 3, "caseField", "formGroup", "contextFields", 4, "ngSwitchCase"], ["ccdLabelSubstitutor", "", 3, "caseField", "formGroup", "contextFields"], ["id", "summary-field-label"], [1, "form-cell"], [3, "formGroup", "caseField"], ["ccdLabelSubstitutor", "", 1, "compound-field", 3, "caseField", "formGroup", "contextFields"], ["colspan", "2"], [3, "formGroup", "caseField", "caseFields"], ["id", "fieldset-event", "formGroupName", "event"], [2, "display", "none"], [1, "form-group", 3, "ngClass"], ["for", "field-trigger-summary", 1, "form-label"], [1, "form-hint"], ["class", "error-message", 4, "ngIf"], ["type", "text", "id", "field-trigger-summary", "formControlName", "summary", "maxlength", "1024", 1, "form-control", "bottom-30", "width-50", 3, "ngClass"], ["for", "field-trigger-description", 1, "form-label"], ["id", "field-trigger-description", "formControlName", "description", "maxlength", "65536", 1, "form-control", "bottom-30", "width-50", 3, "ngClass"], [1, "error-message"], [3, "eventCanBeCompleted", "eventCompletionParams"], ["type", "button", 1, "button", "button-secondary", 3, "click", "disabled"]], template: function CaseEditSubmitComponent_Template(rf, ctx) { if (rf & 1) {
29084
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEditSubmitComponent, selectors: [["ccd-case-edit-submit"]], decls: 23, vars: 21, consts: [["titleBlock", ""], ["idBlock", ""], [1, "govuk-heading-l"], [4, "ngIf", "ngIfThen", "ngIfElse"], [3, "error"], [3, "callbackErrorsContext", "callbackErrorsSubject"], [1, "check-your-answers", 3, "submit", "formGroup"], [4, "ngIf"], [3, "eventCompletionParams", "eventCanBeCompleted", 4, "ngIf"], [1, "form-group", "form-group-related"], ["class", "button button-secondary", "type", "button", 3, "disabled", "click", 4, "ngIf"], ["type", "submit", 1, "button", 3, "disabled"], [1, "cancel"], ["href", "javascript:void(0)", 3, "click"], [3, "content"], ["class", "heading-h2", 4, "ngIf"], [1, "heading-h2"], ["class", "text-16", 4, "ngIf"], ["aria-describedby", "check your answers table", 1, "form-table"], [4, "ngFor", "ngForOf"], [1, "text-16"], ["ccdLabelSubstitutor", "", 3, "caseField", "hidden", "formGroup", "contextFields"], ["class", "valign-top case-field-label", 4, "ngIf"], [1, "form-cell", "case-field-content", "text-16"], [3, "formGroup", "topLevelFormGroup", "caseField", "context", "caseFields"], [1, "valign-top", "case-field-label"], [1, "valign-top", "check-your-answers__change", "case-field-change"], ["href", "javascript:void(0)", 3, "click", 4, "ngIf"], ["aria-describedby", "summary fields table", 1, "summary-fields"], [3, "ngSwitch"], ["ccdLabelSubstitutor", "", 3, "caseField", "formGroup", "contextFields", 4, "ngSwitchCase"], ["class", "compound-field", "ccdLabelSubstitutor", "", 3, "caseField", "formGroup", "contextFields", 4, "ngSwitchCase"], ["ccdLabelSubstitutor", "", 3, "caseField", "formGroup", "contextFields"], ["id", "summary-field-label"], [1, "form-cell"], [3, "formGroup", "caseField"], ["ccdLabelSubstitutor", "", 1, "compound-field", 3, "caseField", "formGroup", "contextFields"], ["colspan", "2"], [3, "formGroup", "caseField", "caseFields"], ["id", "fieldset-event", "formGroupName", "event"], [2, "display", "none"], [1, "form-group", 3, "ngClass"], ["for", "field-trigger-summary", 1, "form-label"], [1, "form-hint"], ["class", "error-message", 4, "ngIf"], ["type", "text", "id", "field-trigger-summary", "formControlName", "summary", "maxlength", "1024", 1, "form-control", "bottom-30", "width-50", 3, "ngClass"], ["for", "field-trigger-description", 1, "form-label"], ["id", "field-trigger-description", "formControlName", "description", "maxlength", "65536", 1, "form-control", "bottom-30", "width-50", 3, "ngClass"], [1, "error-message"], [3, "eventCanBeCompleted", "eventCompletionParams"], ["type", "button", 1, "button", "button-secondary", 3, "click", "disabled"]], template: function CaseEditSubmitComponent_Template(rf, ctx) { if (rf & 1) {
29036
29085
  const _r1 = i0.ɵɵgetCurrentView();
29037
29086
  i0.ɵɵelementStart(0, "div")(1, "h1", 2);
29038
29087
  i0.ɵɵtext(2);
@@ -29088,7 +29137,7 @@ class CaseEditSubmitComponent {
29088
29137
  }
29089
29138
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditSubmitComponent, [{
29090
29139
  type: Component,
29091
- args: [{ selector: 'ccd-case-edit-submit', template: "<div>\n <!-- Event trigger name -->\n <h1 class=\"govuk-heading-l\">{{eventTrigger.name | rpxTranslate}}</h1>\n\n <!--Case ID or Title -->\n <div *ngIf=\"getCaseTitle(); then titleBlock; else idBlock\"></div>\n <ng-template #titleBlock>\n <ccd-markdown [content]=\"getCaseTitle() | ccdCaseTitle: contextFields : editForm.controls['data']\"></ccd-markdown>\n </ng-template>\n <ng-template #idBlock>\n <h2 *ngIf=\"getCaseId()\" class=\"heading-h2\">#{{ getCaseId() | ccdCaseReference }}</h2>\n </ng-template>\n\n <ccd-case-edit-generic-errors [error]=\"caseEdit.error\"></ccd-case-edit-generic-errors>\n\n <ccd-callback-errors [callbackErrorsSubject]=\"caseEdit.callbackErrorsSubject\"\n (callbackErrorsContext)=\"callbackErrorsNotify($event)\"></ccd-callback-errors>\n\n <form class=\"check-your-answers\" [formGroup]=\"editForm\" (submit)=\"submit()\">\n <div *ngIf=\"!caseEdit.isEventCompletionChecksRequired\">\n <ng-container *ngIf=\"checkYourAnswerFieldsToDisplayExists()\">\n <h2 class=\"heading-h2\">{{pageTitle | rpxTranslate }}</h2>\n <span class=\"text-16\" *ngIf=\"!caseEdit.isCaseFlagSubmission\">{{'Check the information below carefully.' | rpxTranslate}}</span>\n\n <table class=\"form-table\" aria-describedby=\"check your answers table\">\n <tbody>\n <ng-container *ngFor=\"let page of wizard.pages\">\n <ng-container *ngIf=\"isShown(page)\">\n <ng-container *ngFor=\"let field of page\n | ccdPageFields: editForm\n | ccdReadFieldsFilter: false :undefined :true :allFieldsValues\n | ccdCYAPageLabelFilter\">\n <ng-container *ngIf=\"canShowFieldInCYA(field)\">\n <tr ccdLabelSubstitutor [caseField]=\"field\" [hidden]=\"field.hidden\"\n [formGroup]=\"editForm.controls['data']\" [contextFields]=\"contextFields\">\n <th *ngIf=\"!isLabel(field) && !caseEdit.isCaseFlagSubmission\" class=\"valign-top case-field-label\">\n <span class=\"text-16\">{{field.label | rpxTranslate}}</span>\n </th>\n <td class=\"form-cell case-field-content\" [attr.colspan]=\"isLabel(field) ? '2' : '1'\">\n <ccd-field-read\n [formGroup]=\"editForm.controls['data']\" [topLevelFormGroup]=\"editForm.controls['data']\"\n [caseField]=\"summaryCaseField(field)\" [context]=\"paletteContext\" [caseFields]=\"contextFields\"></ccd-field-read>\n </td>\n <ng-container *ngIf=\"!caseEdit.isCaseFlagSubmission\">\n <td class=\"valign-top check-your-answers__change case-field-change\">\n <a *ngIf=\"isChangeAllowed(field)\" (click)=\"navigateToPage(page.id)\"\n href=\"javascript:void(0)\">\n <span class=\"text-16\" attr.aria-label=\"{{'Change' | rpxTranslate}} {{ field.label | rpxTranslate }}\">\n {{'Change' | rpxTranslate}}\n </span>\n </a>\n </td>\n </ng-container>\n </tr>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n </tbody>\n </table>\n </ng-container>\n <ng-container *ngIf=\"readOnlySummaryFieldsToDisplayExists()\">\n\n <table class=\"summary-fields\" aria-describedby=\"summary fields table\">\n <tbody>\n <ng-container *ngFor=\"let field of showSummaryFields\">\n <ng-container [ngSwitch]=\"!(field | ccdIsCompound)\">\n <tr *ngSwitchCase=\"true\" ccdLabelSubstitutor [caseField]=\"field\" [formGroup]=\"editForm.controls['data']\" [contextFields]=\"contextFields\">\n <th id=\"summary-field-label\">{{field.label}}</th>\n <td class=\"form-cell\">\n <ccd-field-read [formGroup]=\"editForm.controls['data']\" [caseField]=\"summaryCaseField(field)\"></ccd-field-read>\n </td>\n </tr>\n <tr *ngSwitchCase=\"false\" class=\"compound-field\" ccdLabelSubstitutor [caseField]=\"field\" [formGroup]=\"editForm.controls['data']\" [contextFields]=\"contextFields\">\n <td colspan=\"2\">\n <ccd-field-read [formGroup]=\"editForm.controls['data']\" [caseField]=\"summaryCaseField(field)\" [caseFields]=\"contextFields\"></ccd-field-read>\n </td>\n </tr>\n </ng-container>\n </ng-container>\n </tbody>\n </table>\n </ng-container>\n <ng-container *ngIf=\"showEventNotes()\">\n <fieldset id=\"fieldset-event\" formGroupName=\"event\">\n <legend style=\"display: none;\"></legend>\n <div class=\"form-group\" [ngClass]=\"{'form-group-error': !!summary && !summary.valid && (summary.dirty || summary.touched)}\">\n <label for=\"field-trigger-summary\" class=\"form-label\">\n Event summary (optional)\n <span class=\"form-hint\">A few words describing the purpose of the event.</span>\n </label>\n <span class=\"error-message\" *ngIf=\"summary?.errors && (summary.dirty || summary.touched)\">\n {{summary.errors | ccdFirstError: eventSummaryLabel | rpxTranslate}}\n </span>\n <input type=\"text\" id=\"field-trigger-summary\" class=\"form-control bottom-30 width-50\"\n [ngClass]=\"{'govuk-input--error': summary?.errors && (summary.dirty || summary.touched)}\" formControlName=\"summary\" maxlength=\"1024\">\n </div>\n <div class=\"form-group\" [ngClass]=\"{'form-group-error': !!description && !description.valid && (description.dirty || description.touched)}\">\n <label for=\"field-trigger-description\" class=\"form-label\">Event description (optional)</label>\n <span class=\"error-message\" *ngIf=\"description?.errors && (description.dirty || description.touched)\">\n {{description.errors | ccdFirstError: eventDescriptionLabel | rpxTranslate}}\n </span>\n <textarea id=\"field-trigger-description\" class=\"form-control bottom-30 width-50\" formControlName=\"description\"\n [ngClass]=\"{'govuk-input--error': description?.errors && (description.dirty || description.touched)}\" maxlength=\"65536\"></textarea>\n </div>\n </fieldset>\n </ng-container>\n </div>\n <ccd-case-event-completion *ngIf=\"caseEdit.isEventCompletionChecksRequired\"\n [eventCompletionParams]=\"caseEdit.eventCompletionParams\"\n (eventCanBeCompleted)=\"onEventCanBeCompleted($event)\">\n </ccd-case-event-completion>\n <div class=\"form-group form-group-related\">\n <button *ngIf=\"!caseEdit.isCaseFlagSubmission\" class=\"button button-secondary\" type=\"button\" [disabled]=\"!hasPrevious() || caseEdit.isSubmitting\" (click)=\"previous()\">\n {{'Previous' | rpxTranslate}}\n </button>\n <button type=\"submit\" [disabled]=\"isDisabled\" class=\"button\">\n {{triggerText | rpxTranslate}}\n </button>\n </div>\n <p class=\"cancel\">\n <a (click)=\"cancel()\" href=\"javascript:void(0)\" [class.disabled]=\"caseEdit.isSubmitting\">{{getCancelText() | rpxTranslate}}</a>\n </p>\n </form>\n</div>\n\n", styles: ["#fieldset-case-data{margin-bottom:30px}#fieldset-case-data th{width:1%;white-space:nowrap;vertical-align:top}.compound-field td{padding:0}#confirmation-header{width:630px;background-color:#17958b;border:solid 1px #979797;color:#fff;text-align:center}#confirmation-body{width:630px;background-color:#fff}.valign-top{vertical-align:top}.summary-fields{margin-bottom:30px}.summary-fields tbody tr th,.summary-fields tbody tr td{border-bottom:0px}a.disabled{pointer-events:none;cursor:default}.case-field-label{width:45%}.case-field-content{width:50%}.no-bottom-border{border-bottom:none}.case-field-change{width:5%}\n"] }]
29140
+ args: [{ selector: 'ccd-case-edit-submit', template: "<div>\n <!-- Event trigger name -->\n <h1 class=\"govuk-heading-l\">{{eventTrigger.name | rpxTranslate}}</h1>\n\n <!--Case ID or Title -->\n <div *ngIf=\"getCaseTitle(); then titleBlock; else idBlock\"></div>\n <ng-template #titleBlock>\n <ccd-markdown [content]=\"getCaseTitle() | ccdCaseTitle: contextFields : editForm.controls['data']\"></ccd-markdown>\n </ng-template>\n <ng-template #idBlock>\n <h2 *ngIf=\"getCaseId()\" class=\"heading-h2\">#{{ getCaseId() | ccdCaseReference }}</h2>\n </ng-template>\n\n <ccd-case-edit-generic-errors [error]=\"caseEdit.error\"></ccd-case-edit-generic-errors>\n\n <ccd-callback-errors [callbackErrorsSubject]=\"caseEdit.callbackErrorsSubject\"\n (callbackErrorsContext)=\"callbackErrorsNotify($event)\"></ccd-callback-errors>\n\n <form class=\"check-your-answers\" [formGroup]=\"editForm\" (submit)=\"submit()\">\n <div *ngIf=\"!caseEdit.isEventCompletionChecksRequired\">\n <ng-container *ngIf=\"checkYourAnswerFieldsToDisplayExists()\">\n <h2 class=\"heading-h2\">{{pageTitle | rpxTranslate }}</h2>\n <span class=\"text-16\" *ngIf=\"!caseEdit.isCaseFlagSubmission\">{{'Check the information below carefully.' | rpxTranslate}}</span>\n\n <table class=\"form-table\" aria-describedby=\"check your answers table\">\n <tbody>\n <ng-container *ngFor=\"let page of wizard.pages\">\n <ng-container *ngIf=\"isShown(page)\">\n <ng-container *ngFor=\"let field of page\n | ccdPageFields: editForm\n | ccdReadFieldsFilter: false :undefined :true :allFieldsValues\n | ccdCYAPageLabelFilter\">\n <ng-container *ngIf=\"canShowFieldInCYA(field)\">\n <tr ccdLabelSubstitutor [caseField]=\"field\" [hidden]=\"field.hidden\"\n [formGroup]=\"editForm.controls['data']\" [contextFields]=\"contextFields\">\n <th *ngIf=\"!isLabel(field) && !caseEdit.isCaseFlagSubmission\" class=\"valign-top case-field-label\">\n <span class=\"text-16\">{{field.label | rpxTranslate}}</span>\n </th>\n <td class=\"form-cell case-field-content text-16\" [attr.colspan]=\"isLabel(field) ? '2' : '1'\">\n <ccd-field-read\n [formGroup]=\"editForm.controls['data']\" [topLevelFormGroup]=\"editForm.controls['data']\"\n [caseField]=\"summaryCaseField(field)\" [context]=\"paletteContext\" [caseFields]=\"contextFields\"></ccd-field-read>\n </td>\n <ng-container *ngIf=\"!caseEdit.isCaseFlagSubmission\">\n <td class=\"valign-top check-your-answers__change case-field-change\">\n <a *ngIf=\"isChangeAllowed(field)\" (click)=\"navigateToPage(page.id)\"\n href=\"javascript:void(0)\">\n <span class=\"text-16\" attr.aria-label=\"{{'Change' | rpxTranslate}} {{ field.label | rpxTranslate }}\">\n {{'Change' | rpxTranslate}}\n </span>\n </a>\n </td>\n </ng-container>\n </tr>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n </tbody>\n </table>\n </ng-container>\n <ng-container *ngIf=\"readOnlySummaryFieldsToDisplayExists()\">\n\n <table class=\"summary-fields\" aria-describedby=\"summary fields table\">\n <tbody>\n <ng-container *ngFor=\"let field of showSummaryFields\">\n <ng-container [ngSwitch]=\"!(field | ccdIsCompound)\">\n <tr *ngSwitchCase=\"true\" ccdLabelSubstitutor [caseField]=\"field\" [formGroup]=\"editForm.controls['data']\" [contextFields]=\"contextFields\">\n <th id=\"summary-field-label\">{{field.label}}</th>\n <td class=\"form-cell\">\n <ccd-field-read [formGroup]=\"editForm.controls['data']\" [caseField]=\"summaryCaseField(field)\"></ccd-field-read>\n </td>\n </tr>\n <tr *ngSwitchCase=\"false\" class=\"compound-field\" ccdLabelSubstitutor [caseField]=\"field\" [formGroup]=\"editForm.controls['data']\" [contextFields]=\"contextFields\">\n <td colspan=\"2\">\n <ccd-field-read [formGroup]=\"editForm.controls['data']\" [caseField]=\"summaryCaseField(field)\" [caseFields]=\"contextFields\"></ccd-field-read>\n </td>\n </tr>\n </ng-container>\n </ng-container>\n </tbody>\n </table>\n </ng-container>\n <ng-container *ngIf=\"showEventNotes()\">\n <fieldset id=\"fieldset-event\" formGroupName=\"event\">\n <legend style=\"display: none;\"></legend>\n <div class=\"form-group\" [ngClass]=\"{'form-group-error': !!summary && !summary.valid && (summary.dirty || summary.touched)}\">\n <label for=\"field-trigger-summary\" class=\"form-label\">\n Event summary (optional)\n <span class=\"form-hint\">A few words describing the purpose of the event.</span>\n </label>\n <span class=\"error-message\" *ngIf=\"summary?.errors && (summary.dirty || summary.touched)\">\n {{summary.errors | ccdFirstError: eventSummaryLabel | rpxTranslate}}\n </span>\n <input type=\"text\" id=\"field-trigger-summary\" class=\"form-control bottom-30 width-50\"\n [ngClass]=\"{'govuk-input--error': summary?.errors && (summary.dirty || summary.touched)}\" formControlName=\"summary\" maxlength=\"1024\">\n </div>\n <div class=\"form-group\" [ngClass]=\"{'form-group-error': !!description && !description.valid && (description.dirty || description.touched)}\">\n <label for=\"field-trigger-description\" class=\"form-label\">Event description (optional)</label>\n <span class=\"error-message\" *ngIf=\"description?.errors && (description.dirty || description.touched)\">\n {{description.errors | ccdFirstError: eventDescriptionLabel | rpxTranslate}}\n </span>\n <textarea id=\"field-trigger-description\" class=\"form-control bottom-30 width-50\" formControlName=\"description\"\n [ngClass]=\"{'govuk-input--error': description?.errors && (description.dirty || description.touched)}\" maxlength=\"65536\"></textarea>\n </div>\n </fieldset>\n </ng-container>\n </div>\n <ccd-case-event-completion *ngIf=\"caseEdit.isEventCompletionChecksRequired\"\n [eventCompletionParams]=\"caseEdit.eventCompletionParams\"\n (eventCanBeCompleted)=\"onEventCanBeCompleted($event)\">\n </ccd-case-event-completion>\n <div class=\"form-group form-group-related\">\n <button *ngIf=\"!caseEdit.isCaseFlagSubmission\" class=\"button button-secondary\" type=\"button\" [disabled]=\"!hasPrevious() || caseEdit.isSubmitting\" (click)=\"previous()\">\n {{'Previous' | rpxTranslate}}\n </button>\n <button type=\"submit\" [disabled]=\"isDisabled\" class=\"button\">\n {{triggerText | rpxTranslate}}\n </button>\n </div>\n <p class=\"cancel\">\n <a (click)=\"cancel()\" href=\"javascript:void(0)\" [class.disabled]=\"caseEdit.isSubmitting\">{{getCancelText() | rpxTranslate}}</a>\n </p>\n </form>\n</div>\n\n", styles: ["#fieldset-case-data{margin-bottom:30px}#fieldset-case-data th{width:1%;white-space:nowrap;vertical-align:top}.compound-field td{padding:0}#confirmation-header{width:630px;background-color:#17958b;border:solid 1px #979797;color:#fff;text-align:center}#confirmation-body{width:630px;background-color:#fff}.valign-top{vertical-align:top}.summary-fields{margin-bottom:30px}.summary-fields tbody tr th,.summary-fields tbody tr td{border-bottom:0px}a.disabled{pointer-events:none;cursor:default}.case-field-label{width:45%}.case-field-content{width:50%}.no-bottom-border{border-bottom:none}.case-field-change{width:5%}\n"] }]
29092
29141
  }], () => [{ type: CaseEditComponent }, { type: FieldsUtils }, { type: CaseFieldService }, { type: i1$1.ActivatedRoute }, { type: OrderService }, { type: ProfileNotifier }, { type: FormValidatorsService }], null); })();
29093
29142
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditSubmitComponent, { className: "CaseEditSubmitComponent", filePath: "lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.ts", lineNumber: 27 }); })();
29094
29143
 
@@ -33552,7 +33601,7 @@ class EventStartGuard {
33552
33601
  workAllocationService;
33553
33602
  router;
33554
33603
  sessionStorageService;
33555
- static TASK_TO_COMPLETE = 'taskToComplete';
33604
+ static CLIENT_CONTEXT = 'clientContext';
33556
33605
  constructor(workAllocationService, router, sessionStorageService) {
33557
33606
  this.workAllocationService = workAllocationService;
33558
33607
  this.router = router;
@@ -33603,18 +33652,26 @@ class EventStartGuard {
33603
33652
  task = tasksAssignedToUser[0];
33604
33653
  }
33605
33654
  // if one task assigned to user, allow user to complete event
33606
- this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
33655
+ const storeClientContext = {
33656
+ client_context: {
33657
+ user_task: {
33658
+ task_data: task,
33659
+ complete_task: true
33660
+ }
33661
+ }
33662
+ };
33663
+ this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
33607
33664
  return true;
33608
33665
  }
33609
33666
  }
33610
33667
  removeTaskFromSessionStorage() {
33611
- this.sessionStorageService.removeItem(EventStartGuard.TASK_TO_COMPLETE);
33668
+ this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
33612
33669
  }
33613
33670
  checkForTasks(payload, caseId, eventId, taskId) {
33614
33671
  if (taskId && payload?.tasks?.length > 0) {
33615
33672
  const task = payload.tasks.find((t) => t.id == taskId);
33616
33673
  if (task) {
33617
- this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
33674
+ this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(task));
33618
33675
  }
33619
33676
  else {
33620
33677
  this.removeTaskFromSessionStorage();
@@ -33782,9 +33839,17 @@ class EventStartStateMachineService {
33782
33839
  task = context.tasks[0];
33783
33840
  }
33784
33841
  const taskStr = JSON.stringify(task);
33785
- console.log('entryActionForStateOneTaskAssignedToUser: setting taskToComplete to ' + taskStr);
33842
+ console.log('entryActionForStateOneTaskAssignedToUser: setting client context task_data to ' + taskStr);
33786
33843
  // Store task to session
33787
- context.sessionStorageService.setItem('taskToComplete', taskStr);
33844
+ const clientContext = {
33845
+ client_context: {
33846
+ user_task: {
33847
+ task_data: task,
33848
+ complete_task: true
33849
+ }
33850
+ }
33851
+ };
33852
+ context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
33788
33853
  // Allow user to perform the event
33789
33854
  context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
33790
33855
  }