@hmcts/ccd-case-ui-toolkit 5.0.54-rollback-case-link → 5.0.55-rollback-case-link

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 (23) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +23 -33
  2. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
  3. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
  4. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
  5. package/esm2015/lib/shared/components/case-editor/case-access-utils/index.js +10 -1
  6. package/esm2015/lib/shared/components/case-editor/services/cases.service.js +5 -25
  7. package/esm2015/lib/shared/domain/case-view/role-request.model.js +1 -1
  8. package/esm2015/lib/shared/domain/user/user-info.model.js +1 -1
  9. package/esm2015/lib/shared/services/fields/fields.utils.js +2 -2
  10. package/esm2015/lib/shared/services/form/form-value.service.js +10 -9
  11. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +23 -33
  12. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  13. package/lib/shared/components/case-editor/case-access-utils/index.d.ts +3 -0
  14. package/lib/shared/components/case-editor/case-access-utils/index.d.ts.map +1 -1
  15. package/lib/shared/components/case-editor/services/cases.service.d.ts +0 -2
  16. package/lib/shared/components/case-editor/services/cases.service.d.ts.map +1 -1
  17. package/lib/shared/domain/case-view/role-request.model.d.ts +1 -1
  18. package/lib/shared/domain/case-view/role-request.model.d.ts.map +1 -1
  19. package/lib/shared/domain/user/user-info.model.d.ts +2 -0
  20. package/lib/shared/domain/user/user-info.model.d.ts.map +1 -1
  21. package/lib/shared/services/form/form-value.service.d.ts +0 -3
  22. package/lib/shared/services/form/form-value.service.d.ts.map +1 -1
  23. package/package.json +1 -1
@@ -3499,7 +3499,7 @@ class FieldsUtils {
3499
3499
  // If the Flags CaseField has a value, it is a root-level Complex field; if it does not, it is a Flags
3500
3500
  // CaseField that is a sub-field within another Complex field, so use the currentValue value (if any)
3501
3501
  // instead. The exception to this is the "caseFlags" Flags CaseField, which will have an empty object value
3502
- // initially or could be null or undefined, because no party name is required
3502
+ // initially, because no party name is required
3503
3503
  if (caseField.value && FieldsUtils.isNonEmptyObject(caseField.value) ||
3504
3504
  caseField.id === this.caseLevelCaseFlagsFieldId) {
3505
3505
  flags.push(this.mapCaseFieldToFlagsWithFormGroupPathObject(caseField, pathToFlagsFormGroup));
@@ -5251,9 +5251,6 @@ class FormValueService {
5251
5251
  // Clear out any MultiSelect labels.
5252
5252
  FormValueService.removeMultiSelectLabels(data);
5253
5253
  }
5254
- /**
5255
- * Remove any empty or invalid array with only id
5256
- */
5257
5254
  removeInvalidCollectionData(data, field) {
5258
5255
  if (data[field.id] && data[field.id].length > 0) {
5259
5256
  for (const objCollection of data[field.id]) {
@@ -5312,13 +5309,17 @@ class FormValueService {
5312
5309
  // nothing for a given case field ID (hence the use of hasOwnProperty())
5313
5310
  if (data.hasOwnProperty(caseField.id) && caseField.value) {
5314
5311
  // Create new object for the case field ID within the data object, if necessary
5315
- if (!data[caseField.id]) {
5316
- data[caseField.id] = {};
5312
+ if (data[caseField.id]) {
5313
+ // Copy all values from the corresponding CaseField; this ensures all nested flag data (for example, a
5314
+ // Flags field within a Complex field or a collection of Complex fields) is copied across
5315
+ Object.keys(data[caseField.id]).forEach(key => {
5316
+ if (caseField.value.hasOwnProperty(key)) {
5317
+ data[caseField.id][key] = caseField.value[key];
5318
+ }
5319
+ });
5317
5320
  }
5318
- // Copy all values from the corresponding CaseField; this ensures all nested flag data (for example, a
5319
- // Flags field within a Complex field or a collection of Complex fields) is copied across
5320
- Object.keys(caseField.value).forEach(key => data[caseField.id][key] = caseField.value[key]);
5321
5321
  }
5322
+ ;
5322
5323
  });
5323
5324
  }
5324
5325
  }
@@ -6728,6 +6729,9 @@ class CaseAccessUtils {
6728
6729
  else if (this.roleOrCategoryExists(CaseAccessUtils.ADMIN_ROLE, CaseAccessUtils.ADMIN_ROLE_CATEGORY, roleKeywords, roleCategories)) {
6729
6730
  return CaseAccessUtils.ADMIN_ROLE_CATEGORY;
6730
6731
  }
6732
+ else if (this.roleOrCategoryExists(CaseAccessUtils.CTSC_ROLE, CaseAccessUtils.CTSC_ROLE_CATEGORY, roleKeywords, roleCategories)) {
6733
+ return CaseAccessUtils.CTSC_ROLE_CATEGORY;
6734
+ }
6731
6735
  else {
6732
6736
  return CaseAccessUtils.LEGAL_OPERATIONS_ROLE_CATEGORY;
6733
6737
  }
@@ -6752,6 +6756,9 @@ class CaseAccessUtils {
6752
6756
  case CaseAccessUtils.ADMIN_ROLE_CATEGORY:
6753
6757
  roleName = `${accessType}-access-${CaseAccessUtils.ADMIN_ROLE_NAME}`;
6754
6758
  break;
6759
+ case CaseAccessUtils.CTSC_ROLE_CATEGORY:
6760
+ roleName = `${accessType}-access-${CaseAccessUtils.CTSC_ROLE_NAME}`;
6761
+ break;
6755
6762
  default:
6756
6763
  roleName = `${accessType}-access-${CaseAccessUtils.LEGAL_OPERATIONS_ROLE_NAME}`;
6757
6764
  break;
@@ -6808,6 +6815,9 @@ CaseAccessUtils.LEGAL_OPERATIONS_ROLE_NAME = 'legal-ops';
6808
6815
  CaseAccessUtils.CITIZEN_ROLE = 'citizen';
6809
6816
  CaseAccessUtils.CITIZEN_ROLE_CATEGORY = 'CITIZEN';
6810
6817
  CaseAccessUtils.CITIZEN_ROLE_NAME = 'citizen';
6818
+ CaseAccessUtils.CTSC_ROLE = 'ctsc';
6819
+ CaseAccessUtils.CTSC_ROLE_CATEGORY = 'CTSC';
6820
+ CaseAccessUtils.CTSC_ROLE_NAME = 'ctsc';
6811
6821
 
6812
6822
  class WizardPageFieldToCaseFieldMapper {
6813
6823
  mapAll(wizardPageFields, caseFields) {
@@ -7207,7 +7217,7 @@ class CasesService {
7207
7217
  .set('Content-Type', 'application/json');
7208
7218
  return this.http
7209
7219
  .post(url, eventData, { headers, observe: 'body' })
7210
- .pipe(map(body => this.processResponseBody(body, eventData)), catchError(error => {
7220
+ .pipe(catchError(error => {
7211
7221
  this.errorService.setError(error);
7212
7222
  return throwError(error);
7213
7223
  }));
@@ -7240,7 +7250,7 @@ class CasesService {
7240
7250
  .set('Content-Type', 'application/json');
7241
7251
  return this.http
7242
7252
  .post(url, eventData, { headers, observe: 'body' })
7243
- .pipe(map(body => this.processResponseBody(body, eventData)), catchError(error => {
7253
+ .pipe(catchError(error => {
7244
7254
  this.errorService.setError(error);
7245
7255
  return throwError(error);
7246
7256
  }));
@@ -7279,10 +7289,6 @@ class CasesService {
7279
7289
  }
7280
7290
  return url;
7281
7291
  }
7282
- processResponseBody(body, eventData) {
7283
- this.processTasksOnSuccess(body, eventData.event);
7284
- return body;
7285
- }
7286
7292
  initialiseEventTrigger(eventTrigger) {
7287
7293
  if (!eventTrigger.wizard_pages) {
7288
7294
  eventTrigger.wizard_pages = [];
@@ -7292,22 +7298,6 @@ class CasesService {
7292
7298
  wizardPage.case_fields = this.orderService.sort(this.wizardPageFieldToCaseFieldMapper.mapAll(wizardPage.wizard_page_fields, eventTrigger.case_fields));
7293
7299
  });
7294
7300
  }
7295
- processTasksOnSuccess(caseData, eventData) {
7296
- // The following code is work allocation 1 related
7297
- if (this.appConfig.getWorkAllocationApiUrl().toLowerCase() === 'workallocation') {
7298
- // This is used a feature toggle to
7299
- // control the work allocation
7300
- if (!this.isPuiCaseManager()) {
7301
- this.workAllocationService.completeAppropriateTask(caseData.id, eventData.id, caseData.jurisdiction, caseData.case_type)
7302
- .subscribe(() => {
7303
- // Success. Do nothing.
7304
- }, error => {
7305
- // Show an appropriate warning about something that went wrong.
7306
- console.warn('Could not process tasks for this case event', error);
7307
- });
7308
- }
7309
- }
7310
- }
7311
7301
  /*
7312
7302
  Checks if the user has role of pui-case-manager and returns true or false
7313
7303
  */
@@ -7330,7 +7320,7 @@ class CasesService {
7330
7320
  if (userInfoStr) {
7331
7321
  userInfo = JSON.parse(userInfoStr);
7332
7322
  }
7333
- const roleCategory = camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
7323
+ const roleCategory = userInfo.roleCategory || camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
7334
7324
  const roleName = camUtils.getAMRoleName('challenged', roleCategory);
7335
7325
  const beginTime = new Date();
7336
7326
  const endTime = new Date(new Date().setUTCHours(23, 59, 59, 999));
@@ -7347,7 +7337,7 @@ class CasesService {
7347
7337
  if (userInfoStr) {
7348
7338
  userInfo = JSON.parse(userInfoStr);
7349
7339
  }
7350
- const roleCategory = camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
7340
+ const roleCategory = userInfo.roleCategory || camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
7351
7341
  const roleName = camUtils.getAMRoleName('specific', roleCategory);
7352
7342
  const id = userInfo.id ? userInfo.id : userInfo.uid;
7353
7343
  const payload = camUtils.getAMPayload(null, id, roleName, roleCategory, 'SPECIFIC', caseId, sar, null, null, true);