@hmcts/ccd-case-ui-toolkit 7.1.0-query-management → 7.1.2-query-management

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 (32) 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-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.mjs +17 -15
  3. package/esm2022/lib/shared/components/case-editor/services/cases.service.mjs +53 -27
  4. package/esm2022/lib/shared/components/case-editor/services/event-completion-state-machine.service.mjs +13 -6
  5. package/esm2022/lib/shared/components/case-editor/services/work-allocation.service.mjs +9 -3
  6. package/esm2022/lib/shared/components/event-start/event-guard/event-start.guard.mjs +13 -5
  7. package/esm2022/lib/shared/components/event-start/services/event-start-state-machine.service.mjs +11 -3
  8. package/esm2022/lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.mjs +2 -6
  9. package/esm2022/lib/shared/components/palette/query-management/utils/query-management.utils.mjs +4 -4
  10. package/esm2022/lib/shared/domain/work-allocation/Task.mjs +1 -1
  11. package/esm2022/lib/shared/services/fields/fields.utils.mjs +8 -1
  12. package/esm2022/lib/shared/services/profile/profile.service.mjs +2 -1
  13. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +120 -59
  14. package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
  15. package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
  16. 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
  17. 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
  18. package/lib/shared/components/case-editor/services/cases.service.d.ts +2 -1
  19. package/lib/shared/components/case-editor/services/cases.service.d.ts.map +1 -1
  20. package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts +1 -0
  21. package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts.map +1 -1
  22. package/lib/shared/components/case-editor/services/work-allocation.service.d.ts.map +1 -1
  23. package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts +1 -1
  24. package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts.map +1 -1
  25. package/lib/shared/components/event-start/services/event-start-state-machine.service.d.ts.map +1 -1
  26. package/lib/shared/components/palette/query-management/components/query-check-your-answers/query-check-your-answers.component.d.ts.map +1 -1
  27. package/lib/shared/components/palette/query-management/utils/query-management.utils.d.ts.map +1 -1
  28. package/lib/shared/domain/work-allocation/Task.d.ts +4 -0
  29. package/lib/shared/domain/work-allocation/Task.d.ts.map +1 -1
  30. package/lib/shared/services/fields/fields.utils.d.ts +2 -0
  31. package/lib/shared/services/fields/fields.utils.d.ts.map +1 -1
  32. package/package.json +1 -1
@@ -4341,6 +4341,13 @@ class FieldsUtils {
4341
4341
  return '';
4342
4342
  }
4343
4343
  }
4344
+ static getUserTaskFromClientContext(clientContextStr) {
4345
+ if (clientContextStr) {
4346
+ let clientContext = JSON.parse(clientContextStr);
4347
+ return clientContext.client_context.user_task;
4348
+ }
4349
+ return null;
4350
+ }
4344
4351
  buildCanShowPredicate(eventTrigger, form) {
4345
4352
  const currentState = this.getCurrentEventState(eventTrigger, form);
4346
4353
  return (page) => {
@@ -7177,6 +7184,7 @@ class ProfileService {
7177
7184
  .set('experimental', 'true')
7178
7185
  .set('Accept', ProfileService.V2_MEDIATYPE_USER_PROFILE)
7179
7186
  .set('Content-Type', 'application/json');
7187
+ // Not adding client context header because header is added to call immediately afterwards
7180
7188
  return this.httpService
7181
7189
  .get(url, { headers, observe: 'body' })
7182
7190
  .pipe(map((p) => plainToClass(Profile, p)));
@@ -8073,6 +8081,7 @@ class CasesService {
8073
8081
  let headers = new HttpHeaders();
8074
8082
  headers = headers.set('experimental', 'true');
8075
8083
  headers = headers.set('Content-Type', 'application/json');
8084
+ headers = this.addClientContextHeader(headers);
8076
8085
  if (Draft.isDraft(caseId)) {
8077
8086
  headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_DRAFT_TRIGGER);
8078
8087
  }
@@ -8083,9 +8092,10 @@ class CasesService {
8083
8092
  headers = headers.set('Accept', CasesService.V2_MEDIATYPE_START_CASE_TRIGGER);
8084
8093
  }
8085
8094
  return this.http
8086
- .get(url, { headers, observe: 'body' })
8087
- .pipe(map(body => {
8088
- return FieldsUtils.handleNestedDynamicLists(body);
8095
+ .get(url, { headers, observe: 'response' })
8096
+ .pipe(map((response) => {
8097
+ this.updateClientContextStorage(response.headers);
8098
+ return FieldsUtils.handleNestedDynamicLists(response.body);
8089
8099
  }), catchError(error => {
8090
8100
  this.errorService.setError(error);
8091
8101
  return throwError(error);
@@ -8094,13 +8104,17 @@ class CasesService {
8094
8104
  createEvent(caseDetails, eventData) {
8095
8105
  const caseId = caseDetails.case_id;
8096
8106
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/events`;
8097
- const headers = new HttpHeaders()
8107
+ let headers = new HttpHeaders()
8098
8108
  .set('experimental', 'true')
8099
8109
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_EVENT)
8100
8110
  .set('Content-Type', 'application/json');
8111
+ headers = this.addClientContextHeader(headers);
8101
8112
  return this.http
8102
- .post(url, eventData, { headers, observe: 'body' })
8103
- .pipe(catchError(error => {
8113
+ .post(url, eventData, { headers, observe: 'response' })
8114
+ .pipe(map((response) => {
8115
+ this.updateClientContextStorage(response.headers);
8116
+ return response.body;
8117
+ }), catchError(error => {
8104
8118
  this.errorService.setError(error);
8105
8119
  return throwError(error);
8106
8120
  }));
@@ -8108,13 +8122,17 @@ class CasesService {
8108
8122
  validateCase(ctid, eventData, pageId) {
8109
8123
  const pageIdString = pageId ? `?pageId=${pageId}` : '';
8110
8124
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/validate${pageIdString}`;
8111
- const headers = new HttpHeaders()
8125
+ let headers = new HttpHeaders()
8112
8126
  .set('experimental', 'true')
8113
8127
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE)
8114
8128
  .set('Content-Type', 'application/json');
8129
+ headers = this.addClientContextHeader(headers);
8115
8130
  return this.http
8116
- .post(url, eventData, { headers, observe: 'body' })
8117
- .pipe(catchError(error => {
8131
+ .post(url, eventData, { headers, observe: 'response' })
8132
+ .pipe(map((response) => {
8133
+ this.updateClientContextStorage(response.headers);
8134
+ return response.body;
8135
+ }), catchError(error => {
8118
8136
  this.errorService.setError(error);
8119
8137
  return throwError(error);
8120
8138
  }));
@@ -8125,26 +8143,34 @@ class CasesService {
8125
8143
  ignoreWarning = 'true';
8126
8144
  }
8127
8145
  const url = `${this.appConfig.getCaseDataUrl()}/case-types/${ctid}/cases?ignore-warning=${ignoreWarning}`;
8128
- const headers = new HttpHeaders()
8146
+ let headers = new HttpHeaders()
8129
8147
  .set('experimental', 'true')
8130
8148
  .set('Accept', CasesService.V2_MEDIATYPE_CREATE_CASE)
8131
8149
  .set('Content-Type', 'application/json');
8150
+ headers = this.addClientContextHeader(headers);
8132
8151
  return this.http
8133
- .post(url, eventData, { headers, observe: 'body' })
8134
- .pipe(catchError(error => {
8152
+ .post(url, eventData, { headers, observe: 'response' })
8153
+ .pipe(map((response) => {
8154
+ this.updateClientContextStorage(response.headers);
8155
+ return response.body;
8156
+ }), catchError(error => {
8135
8157
  this.errorService.setError(error);
8136
8158
  return throwError(error);
8137
8159
  }));
8138
8160
  }
8139
8161
  getPrintDocuments(caseId) {
8140
8162
  const url = `${this.appConfig.getCaseDataUrl()}/cases/${caseId}/documents`;
8141
- const headers = new HttpHeaders()
8163
+ let headers = new HttpHeaders()
8142
8164
  .set('experimental', 'true')
8143
8165
  .set('Accept', CasesService.V2_MEDIATYPE_CASE_DOCUMENTS)
8144
8166
  .set('Content-Type', 'application/json');
8167
+ headers = this.addClientContextHeader(headers);
8145
8168
  return this.http
8146
- .get(url, { headers, observe: 'body' })
8147
- .pipe(map(body => body.documentResources), catchError(error => {
8169
+ .get(url, { headers, observe: 'response' })
8170
+ .pipe(map((response) => {
8171
+ this.updateClientContextStorage(response.headers);
8172
+ return response.body.documentResources;
8173
+ }), catchError(error => {
8148
8174
  this.errorService.setError(error);
8149
8175
  return throwError(error);
8150
8176
  }));
@@ -8177,17 +8203,6 @@ class CasesService {
8177
8203
  wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
8178
8204
  });
8179
8205
  }
8180
- /*
8181
- Checks if the user has role of pui-case-manager and returns true or false
8182
- */
8183
- isPuiCaseManager() {
8184
- const userInfoStr = this.sessionStorageService.getItem('userDetails');
8185
- if (userInfoStr) {
8186
- const userInfo = JSON.parse(userInfoStr);
8187
- return userInfo && userInfo.roles && (userInfo.roles.indexOf(CasesService.PUI_CASE_MANAGER) !== -1);
8188
- }
8189
- return false;
8190
- }
8191
8206
  getCourtOrHearingCentreName(locationId) {
8192
8207
  return this.http.post(`/api/locations/getLocationsById`, { locations: [{ locationId }] });
8193
8208
  }
@@ -8254,6 +8269,25 @@ class CasesService {
8254
8269
  .get(url)
8255
8270
  .pipe(catchError(error => throwError(error)));
8256
8271
  }
8272
+ addClientContextHeader(headers) {
8273
+ const clientContextDetails = this.sessionStorageService.getItem('clientContext');
8274
+ if (clientContextDetails) {
8275
+ // may require URI encoding in certain circumstances
8276
+ const clientContext = window.btoa(clientContextDetails);
8277
+ if (clientContext) {
8278
+ headers = headers.set('Client-Context', clientContext);
8279
+ }
8280
+ }
8281
+ return headers;
8282
+ }
8283
+ updateClientContextStorage(headers) {
8284
+ // for mocking - TODO: Kasi Remove/Uncomment for testing
8285
+ // headers = this.setMockClientContextHeader(headers);
8286
+ if (headers && headers.get('Client-Context')) {
8287
+ const clientContextString = window.atob(headers.get('Client-Context'));
8288
+ this.sessionStorageService.setItem('clientContext', clientContextString);
8289
+ }
8290
+ }
8257
8291
  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)); };
8258
8292
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
8259
8293
  }
@@ -8766,8 +8800,9 @@ class EventCompletionStateMachineService {
8766
8800
  entryActionForStateCompleteEventAndTask(state, context) {
8767
8801
  // Trigger final state to complete processing of state machine
8768
8802
  state.trigger(EventCompletionStates.Final);
8769
- const taskStr = context.sessionStorageService.getItem('taskToComplete');
8770
- if (taskStr) {
8803
+ const clientContextStr = context.sessionStorageService.getItem('clientContext');
8804
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8805
+ if (userTask?.task_data) {
8771
8806
  context.sessionStorageService.setItem('assignNeeded', 'false');
8772
8807
  // just set event can be completed
8773
8808
  context.component.eventCanBeCompleted.emit(true);
@@ -8786,9 +8821,9 @@ class EventCompletionStateMachineService {
8786
8821
  entryActionForStateTaskUnassigned(state, context) {
8787
8822
  // Trigger final state to complete processing of state machine
8788
8823
  state.trigger(EventCompletionStates.Final);
8789
- // Get task details
8790
- const taskStr = context.sessionStorageService.getItem('taskToComplete');
8791
- if (taskStr) {
8824
+ const clientContextStr = context.sessionStorageService.getItem('clientContext');
8825
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8826
+ if (userTask?.task_data) {
8792
8827
  context.sessionStorageService.setItem('assignNeeded', 'true');
8793
8828
  context.component.eventCanBeCompleted.emit(true);
8794
8829
  }
@@ -8823,6 +8858,11 @@ class EventCompletionStateMachineService {
8823
8858
  addTransitionsForStateTaskUnassigned() {
8824
8859
  this.stateTaskUnassigned.addTransition(EventCompletionStates.Final, this.stateFinal);
8825
8860
  }
8861
+ taskPresentInSessionStorage(context) {
8862
+ const clientContextStr = context.sessionStorageService.getItem('clientContext');
8863
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
8864
+ return !!userTask.task_data;
8865
+ }
8826
8866
  static ɵfac = function EventCompletionStateMachineService_Factory(t) { return new (t || EventCompletionStateMachineService)(); };
8827
8867
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: EventCompletionStateMachineService, factory: EventCompletionStateMachineService.ɵfac });
8828
8868
  }
@@ -8949,8 +8989,14 @@ class WorkAllocationService {
8949
8989
  }
8950
8990
  isWAEnabled(jurisdiction, caseType) {
8951
8991
  this.features = this.appConfig.getWAServiceConfig();
8952
- const ftstr = JSON.stringify(this.features);
8953
- this.appConfig.logMessage(`isWAEnabled: wa-service-config returning ${ftstr.length > 0}`);
8992
+ if (this.features) {
8993
+ const ftstr = JSON.stringify(this.features);
8994
+ this.appConfig?.logMessage(`isWAEnabled: wa-service-config returning ${ftstr?.length > 0}`);
8995
+ }
8996
+ else {
8997
+ this.appConfig?.logMessage(`isWAEnabled: wa-service-config returning no features`);
8998
+ return false;
8999
+ }
8954
9000
  let enabled = false;
8955
9001
  if (!jurisdiction || !caseType) {
8956
9002
  const caseInfo = JSON.parse(this.sessionStorageService.getItem('caseInfo'));
@@ -9332,13 +9378,12 @@ class CaseEditComponent {
9332
9378
  this.isSubmitting = true;
9333
9379
  // We have to run the event completion checks if task in session storage
9334
9380
  // and if the task is in session storage, then is it associated to the case
9335
- let taskInSessionStorage;
9381
+ const clientContextStr = this.sessionStorageService.getItem('clientContext');
9382
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9383
+ const taskInSessionStorage = userTask ? userTask.task_data : null;
9336
9384
  let taskEventInSessionStorage;
9337
9385
  const taskStr = this.sessionStorageService.getItem('taskToComplete');
9338
9386
  const taskEventStr = this.sessionStorageService.getItem('taskEvent');
9339
- if (taskStr) {
9340
- taskInSessionStorage = JSON.parse(taskStr);
9341
- }
9342
9387
  if (taskEventStr) {
9343
9388
  taskEventInSessionStorage = JSON.parse(taskEventStr);
9344
9389
  }
@@ -9549,15 +9594,15 @@ class CaseEditComponent {
9549
9594
  });
9550
9595
  }
9551
9596
  postCompleteTaskIfRequired() {
9552
- const taskStr = this.sessionStorageService.getItem('taskToComplete');
9597
+ const clientContextStr = this.sessionStorageService.getItem('clientContext');
9598
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
9599
+ const [task, taskToBeCompleted] = userTask ? [userTask.task_data, userTask.complete_task] : [null, false];
9553
9600
  const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
9554
- if (taskStr && assignNeeded) {
9555
- const task = JSON.parse(taskStr);
9601
+ if (task && assignNeeded && taskToBeCompleted) {
9556
9602
  this.abstractConfig.logMessage(`postCompleteTaskIfRequired with assignNeeded: taskId ${task.id} and event name ${this.eventTrigger.name}`);
9557
9603
  return this.workAllocationService.assignAndCompleteTask(task.id, this.eventTrigger.name);
9558
9604
  }
9559
- else if (taskStr) {
9560
- const task = JSON.parse(taskStr);
9605
+ else if (task && taskToBeCompleted) {
9561
9606
  this.abstractConfig.logMessage(`postCompleteTaskIfRequired: taskId ${task.id} and event name ${this.eventTrigger.name}`);
9562
9607
  return this.workAllocationService.completeTask(task.id, this.eventTrigger.name);
9563
9608
  }
@@ -11159,8 +11204,12 @@ class CaseEventCompletionTaskReassignedComponent {
11159
11204
  }
11160
11205
  onContinue() {
11161
11206
  // Get task details
11162
- const taskStr = this.sessionStorageService.getItem('taskToComplete');
11163
- if (taskStr) {
11207
+ const clientContextStr = this.sessionStorageService.getItem('clientContext');
11208
+ const userTask = FieldsUtils.getUserTaskFromClientContext(clientContextStr);
11209
+ const task = userTask ? userTask.task_data : null;
11210
+ // not complete_task not utilised here as related to event completion
11211
+ // service wanting task associated with event to not be completed not directly relevant
11212
+ if (task) {
11164
11213
  this.sessionStorageService.setItem('assignNeeded', 'true');
11165
11214
  // set event can be completed to true
11166
11215
  this.parentComponent.eventCanBeCompleted.emit(true);
@@ -11184,7 +11233,7 @@ class CaseEventCompletionTaskReassignedComponent {
11184
11233
  type: Inject,
11185
11234
  args: [COMPONENT_PORTAL_INJECTION_TOKEN]
11186
11235
  }] }, { type: i1$1.ActivatedRoute }, { type: WorkAllocationService }, { type: SessionStorageService }, { type: JudicialworkerService }, { type: CaseworkerService }, { type: AlertService }], null); })();
11187
- (() => { (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 }); })();
11236
+ (() => { (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 }); })();
11188
11237
 
11189
11238
  function CaseEventCompletionComponent_ng_template_0_Template(rf, ctx) { }
11190
11239
  const COMPONENT_PORTAL_INJECTION_TOKEN = new InjectionToken('');
@@ -19543,14 +19592,14 @@ class QualifyingQuestionOptionsComponent {
19543
19592
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QualifyingQuestionOptionsComponent, { className: "QualifyingQuestionOptionsComponent", filePath: "lib/shared/components/palette/query-management/components/qualifying-questions/qualifying-question-options/qualifying-question-options.component.ts", lineNumber: 12 }); })();
19544
19593
 
19545
19594
  class QueryManagementUtils {
19546
- static caseLevelCaseFieldId = 'qmCaseQueriesCollection';
19595
+ static caseLevelCaseFieldId = 'CaseQueriesCollection';
19547
19596
  static FIELD_TYPE_COLLECTION = 'Collection';
19548
19597
  static FIELD_TYPE_COMPLEX = 'Complex';
19549
19598
  static extractCaseQueriesFromCaseField(caseField, caseFieldId) {
19550
- const { field_type, value, id } = caseField;
19599
+ const { field_type, value } = caseField;
19551
19600
  // Handle Complex type fields
19552
19601
  if (field_type.type === QueryManagementUtils.FIELD_TYPE_COMPLEX) {
19553
- if (id === QueryManagementUtils.caseLevelCaseFieldId || QueryManagementUtils.isNonEmptyObject(value)) {
19602
+ if (field_type.id === QueryManagementUtils.caseLevelCaseFieldId || QueryManagementUtils.isNonEmptyObject(value)) {
19554
19603
  return value;
19555
19604
  }
19556
19605
  return '';
@@ -20004,8 +20053,6 @@ class QueryCheckYourAnswersComponent {
20004
20053
  }
20005
20054
  });
20006
20055
  this.isCaseQueriesClollectionDataPresent();
20007
- console.log('this.caseQueriesCollections', this.caseQueriesCollections);
20008
- console.log('this.isCaseQueriesClollectionDataPresent()', this.isCaseQueriesClollectionDataPresent());
20009
20056
  }
20010
20057
  ngOnDestroy() {
20011
20058
  this.createEventSubscription?.unsubscribe();
@@ -20096,12 +20143,9 @@ class QueryCheckYourAnswersComponent {
20096
20143
  return newQueryData;
20097
20144
  }
20098
20145
  isCaseQueriesClollectionDataPresent() {
20099
- console.log('this.route.snapshot?.data?.case?.tabs', this.route.snapshot?.data?.case?.tabs);
20100
20146
  if (this.route.snapshot?.data?.case?.tabs) {
20101
20147
  this.caseQueriesCollections = this.route.snapshot.data.case.tabs
20102
20148
  .filter((tab) => tab?.fields?.some((caseField) => caseField.field_type.type === 'ComponentLauncher' && caseField.id === 'QueryManagement1'))[0]?.fields?.reduce((acc, caseField) => {
20103
- console.log('acc, caseField', acc, caseField);
20104
- console.log('caseField --- ', typeof caseField, caseField);
20105
20149
  // Extract the ID based on conditions, updating this.fieldId dynamically
20106
20150
  this.extractIdBasedOnConditions(caseField);
20107
20151
  const extractedCaseQueriesFromCaseField = QueryManagementUtils.extractCaseQueriesFromCaseField(caseField, caseField.id);
@@ -20114,6 +20158,7 @@ class QueryCheckYourAnswersComponent {
20114
20158
  }
20115
20159
  extractIdBasedOnConditions(data) {
20116
20160
  // Check if field_type.id is 'CaseQueriesCollection' and field_type.type is 'Complex'
20161
+ console.log('data ------', data);
20117
20162
  if (data.field_type.id === this.CASE_QUERIES_COLLECTION_ID &&
20118
20163
  data.field_type.type === this.FIELD_TYPE_COMPLEX) {
20119
20164
  // Set the field ID dynamically based on the extracted data
@@ -33897,7 +33942,7 @@ class EventStartGuard {
33897
33942
  workAllocationService;
33898
33943
  router;
33899
33944
  sessionStorageService;
33900
- static TASK_TO_COMPLETE = 'taskToComplete';
33945
+ static CLIENT_CONTEXT = 'clientContext';
33901
33946
  constructor(workAllocationService, router, sessionStorageService) {
33902
33947
  this.workAllocationService = workAllocationService;
33903
33948
  this.router = router;
@@ -33948,18 +33993,26 @@ class EventStartGuard {
33948
33993
  task = tasksAssignedToUser[0];
33949
33994
  }
33950
33995
  // if one task assigned to user, allow user to complete event
33951
- this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
33996
+ const storeClientContext = {
33997
+ client_context: {
33998
+ user_task: {
33999
+ task_data: task,
34000
+ complete_task: true
34001
+ }
34002
+ }
34003
+ };
34004
+ this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(storeClientContext));
33952
34005
  return true;
33953
34006
  }
33954
34007
  }
33955
34008
  removeTaskFromSessionStorage() {
33956
- this.sessionStorageService.removeItem(EventStartGuard.TASK_TO_COMPLETE);
34009
+ this.sessionStorageService.removeItem(EventStartGuard.CLIENT_CONTEXT);
33957
34010
  }
33958
34011
  checkForTasks(payload, caseId, eventId, taskId) {
33959
34012
  if (taskId && payload?.tasks?.length > 0) {
33960
34013
  const task = payload.tasks.find((t) => t.id == taskId);
33961
34014
  if (task) {
33962
- this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
34015
+ this.sessionStorageService.setItem(EventStartGuard.CLIENT_CONTEXT, JSON.stringify(task));
33963
34016
  }
33964
34017
  else {
33965
34018
  this.removeTaskFromSessionStorage();
@@ -34127,9 +34180,17 @@ class EventStartStateMachineService {
34127
34180
  task = context.tasks[0];
34128
34181
  }
34129
34182
  const taskStr = JSON.stringify(task);
34130
- console.log('entryActionForStateOneTaskAssignedToUser: setting taskToComplete to ' + taskStr);
34183
+ console.log('entryActionForStateOneTaskAssignedToUser: setting client context task_data to ' + taskStr);
34131
34184
  // Store task to session
34132
- context.sessionStorageService.setItem('taskToComplete', taskStr);
34185
+ const clientContext = {
34186
+ client_context: {
34187
+ user_task: {
34188
+ task_data: task,
34189
+ complete_task: true
34190
+ }
34191
+ }
34192
+ };
34193
+ context.sessionStorageService.setItem('clientContext', JSON.stringify(clientContext));
34133
34194
  // Allow user to perform the event
34134
34195
  context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
34135
34196
  }