@hmcts/ccd-case-ui-toolkit 6.19.15-prerelease-datetime-picker-fix-new → 6.19.15-restricted-case-access

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 (28) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +43 -27
  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/app.config.js +1 -1
  6. package/esm2015/lib/shared/components/case-editor/case-edit/case-edit.component.js +3 -3
  7. package/esm2015/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.js +2 -2
  8. package/esm2015/lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.js +5 -2
  9. package/esm2015/lib/shared/components/case-editor/services/valid-page-list-caseFields.service.js +7 -7
  10. package/esm2015/lib/shared/components/case-viewer/services/case.resolver.js +16 -9
  11. package/esm2015/lib/shared/components/palette/datetime-picker/datetime-picker-utils.js +3 -3
  12. package/esm2015/lib/shared/domain/http/http-error.model.js +8 -1
  13. package/esm2015/lib/shared/pipes/complex/ccd-read-fields-filter.pipe.js +2 -2
  14. package/esm2015/lib/shared/services/form/form-value.service.js +2 -2
  15. package/esm2015/lib/shared/services/http/http-error.service.js +4 -5
  16. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +40 -26
  17. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  18. package/lib/app.config.d.ts +2 -0
  19. package/lib/app.config.d.ts.map +1 -1
  20. package/lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.d.ts +2 -0
  21. package/lib/shared/components/case-editor/case-edit-submit/case-edit-submit.component.d.ts.map +1 -1
  22. package/lib/shared/components/case-editor/services/valid-page-list-caseFields.service.d.ts +2 -2
  23. package/lib/shared/components/case-editor/services/valid-page-list-caseFields.service.d.ts.map +1 -1
  24. package/lib/shared/components/case-viewer/services/case.resolver.d.ts +3 -1
  25. package/lib/shared/components/case-viewer/services/case.resolver.d.ts.map +1 -1
  26. package/lib/shared/domain/http/http-error.model.d.ts.map +1 -1
  27. package/lib/shared/services/http/http-error.service.d.ts.map +1 -1
  28. package/package.json +1 -1
@@ -1985,6 +1985,13 @@
1985
1985
  error[key] = response.error.hasOwnProperty(key) && response.error[key] ? response.error[key] : error[key];
1986
1986
  });
1987
1987
  }
1988
+ // Error object in HttpErrorResponse will be empty for 403 errors
1989
+ // Set the error properties of HttpError accordingly
1990
+ if ((response === null || response === void 0 ? void 0 : response.status) === 403) {
1991
+ error.error = response.statusText;
1992
+ error.status = response.status;
1993
+ error.message = response.message;
1994
+ }
1988
1995
  return error;
1989
1996
  };
1990
1997
  return HttpError;
@@ -2083,14 +2090,13 @@
2083
2090
  this.authService = authService;
2084
2091
  }
2085
2092
  HttpErrorService.convertToHttpError = function (error) {
2093
+ var _a;
2086
2094
  if (error instanceof HttpError) {
2087
2095
  return error;
2088
2096
  }
2089
2097
  var httpError = new HttpError();
2090
2098
  if (error instanceof i1$2.HttpErrorResponse) {
2091
- if (error.headers
2092
- && error.headers.get(HttpErrorService.CONTENT_TYPE)
2093
- && error.headers.get(HttpErrorService.CONTENT_TYPE).indexOf(HttpErrorService.JSON) !== -1) {
2099
+ if (((_a = error.headers) === null || _a === void 0 ? void 0 : _a.get(HttpErrorService.CONTENT_TYPE).indexOf(HttpErrorService.JSON)) !== -1) {
2094
2100
  try {
2095
2101
  httpError = HttpError.from(error);
2096
2102
  }
@@ -2125,7 +2131,7 @@
2125
2131
  console.error('Handling error in http error service.');
2126
2132
  console.error(error);
2127
2133
  var httpError = HttpErrorService.convertToHttpError(error);
2128
- if (redirectIfNotAuthorised && (httpError.status === 401 || httpError.status === 403)) {
2134
+ if (redirectIfNotAuthorised && httpError.status === 401) {
2129
2135
  this.authService.signIn();
2130
2136
  }
2131
2137
  return rxjs.throwError(httpError);
@@ -6403,7 +6409,7 @@
6403
6409
  if (!FormValueService.isLabel(field) && FormValueService.isReadOnly(field)) {
6404
6410
  return "continue";
6405
6411
  }
6406
- if (field.hidden === true && field.display_context !== 'HIDDEN' && field.id !== 'caseLinks') {
6412
+ if (field.hidden === true && field.display_context !== 'HIDDEN' && field.id !== 'caseLinks' && !field.retain_hidden_value) {
6407
6413
  // Delete anything that is hidden (that is NOT readonly), and that
6408
6414
  // hasn't had its display_context overridden to make it hidden.
6409
6415
  delete data[field.id];
@@ -9889,14 +9895,13 @@
9889
9895
  function ValidPageListCaseFieldsService(fieldsUtils) {
9890
9896
  this.fieldsUtils = fieldsUtils;
9891
9897
  }
9892
- ValidPageListCaseFieldsService.prototype.isShown = function (page, eventTriggerFields, data) {
9898
+ ValidPageListCaseFieldsService.prototype.isShown = function (page, eventTriggerFields, formFields) {
9893
9899
  var fields = this.fieldsUtils
9894
- .mergeCaseFieldsAndFormFields(eventTriggerFields, data);
9900
+ .mergeCaseFieldsAndFormFields(eventTriggerFields, formFields);
9895
9901
  return page.parsedShowCondition.match(fields);
9896
9902
  };
9897
- ValidPageListCaseFieldsService.prototype.deleteNonValidatedFields = function (validPageList, caseEventDatadata, eventTriggerFields, fromPreviousPage) {
9898
- if (fromPreviousPage === void 0) { fromPreviousPage = false; }
9899
- var pageListCaseFields = this.validPageListCaseFields(validPageList, caseEventDatadata, eventTriggerFields);
9903
+ ValidPageListCaseFieldsService.prototype.deleteNonValidatedFields = function (validPageList, caseEventDatadata, eventTriggerFields, fromPreviousPage, formFields) {
9904
+ var pageListCaseFields = this.validPageListCaseFields(validPageList, eventTriggerFields, formFields);
9900
9905
  if (!fromPreviousPage && pageListCaseFields.length > 0) {
9901
9906
  Object.keys(caseEventDatadata).forEach(function (key) {
9902
9907
  if (pageListCaseFields.findIndex(function (element) { return element.id === key; }) < 0) {
@@ -9905,11 +9910,11 @@
9905
9910
  });
9906
9911
  }
9907
9912
  };
9908
- ValidPageListCaseFieldsService.prototype.validPageListCaseFields = function (validPageList, data, eventTriggerFields) {
9913
+ ValidPageListCaseFieldsService.prototype.validPageListCaseFields = function (validPageList, eventTriggerFields, formFields) {
9909
9914
  var _this = this;
9910
9915
  var validPageListCaseFields = [];
9911
9916
  validPageList.forEach(function (page) {
9912
- if (_this.isShown(page, eventTriggerFields, data)) {
9917
+ if (_this.isShown(page, eventTriggerFields, formFields)) {
9913
9918
  page.case_fields.forEach(function (field) { return validPageListCaseFields.push(field); });
9914
9919
  }
9915
9920
  });
@@ -10114,8 +10119,8 @@
10114
10119
  // Remove "Launcher"-type fields (these have no values and are not intended to be persisted)
10115
10120
  this.formValueService.removeCaseFieldsOfType(caseEventData.data, eventTrigger.case_fields, ['FlagLauncher', 'ComponentLauncher']);
10116
10121
  // delete fields which are not part of the case event journey wizard pages case fields
10117
- this.validPageListCaseFieldsService.deleteNonValidatedFields(this.validPageList, caseEventData.data, eventTrigger.case_fields, false);
10118
- var pageListCaseFields = this.validPageListCaseFieldsService.validPageListCaseFields(this.validPageList, caseEventData.data, eventTrigger.case_fields);
10122
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.validPageList, caseEventData.data, eventTrigger.case_fields, false, form.controls['data'].value);
10123
+ var pageListCaseFields = this.validPageListCaseFieldsService.validPageListCaseFields(this.validPageList, eventTrigger.case_fields, form.controls['data'].value);
10119
10124
  // Remove unnecessary case fields which are hidden, only if the submission is *not* for Case Flags
10120
10125
  if (!this.isCaseFlagSubmission) {
10121
10126
  this.formValueService.removeUnnecessaryFields(caseEventData.data, pageListCaseFields, true, true);
@@ -11494,7 +11499,7 @@
11494
11499
  // Get hold of the CaseEventData.
11495
11500
  var caseEventData = this.formValueService.sanitise(formFields);
11496
11501
  // delete fields which are not part of the case event journey wizard pages case fields
11497
- this.validPageListCaseFieldsService.deleteNonValidatedFields(this.caseEdit.validPageList, caseEventData.data, this.eventTrigger.case_fields, fromPreviousPage);
11502
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.caseEdit.validPageList, caseEventData.data, this.eventTrigger.case_fields, fromPreviousPage, this.editForm.controls['data'].value);
11498
11503
  // Tidy it up before we return it.
11499
11504
  this.formValueService.removeUnnecessaryFields(caseEventData.data, caseFields, clearEmpty, clearNonCase, fromPreviousPage, this.currentPage.case_fields);
11500
11505
  return caseEventData;
@@ -25030,10 +25035,10 @@
25030
25035
 
25031
25036
  var CUSTOM_MOMENT_FORMATS = {
25032
25037
  parse: {
25033
- dateInput: 'DD-MM-YYYY HH:mm:ss'
25038
+ dateInput: 'YYYY MM DD HH:mm:ss'
25034
25039
  },
25035
25040
  display: {
25036
- dateInput: 'DD-MM-YYYY HH:mm:ss',
25041
+ dateInput: 'YYYY MM DD HH:mm:ss',
25037
25042
  monthYearLabel: 'MMMM YYYY',
25038
25043
  dateA11yLabel: 'EEE/MMM/YYYY',
25039
25044
  monthYearA11yLabel: 'MMMM YYYY',
@@ -26555,7 +26560,7 @@
26555
26560
  var checkConditionalShowAgainst = values;
26556
26561
  var formGroupAvailable = false;
26557
26562
  if (formGroup) {
26558
- checkConditionalShowAgainst = formGroup.parent.getRawValue().data;
26563
+ checkConditionalShowAgainst = formGroup.value ? formGroup.parent.getRawValue().data : formGroup;
26559
26564
  formGroupAvailable = true;
26560
26565
  if (idPrefix !== undefined) {
26561
26566
  if (idPrefix !== '') {
@@ -27573,7 +27578,7 @@
27573
27578
  var page_r13 = i0__namespace.ɵɵnextContext().$implicit;
27574
27579
  var ctx_r14 = i0__namespace.ɵɵnextContext(3);
27575
27580
  i0__namespace.ɵɵadvance(1);
27576
- i0__namespace.ɵɵproperty("ngForOf", i0__namespace.ɵɵpipeBind1(2, 1, i0__namespace.ɵɵpipeBindV(3, 3, i0__namespace.ɵɵpureFunction2(12, _c0$f, i0__namespace.ɵɵpipeBind2(4, 9, page_r13, ctx_r14.editForm), ctx_r14.editForm.controls["data"]))));
27581
+ i0__namespace.ɵɵproperty("ngForOf", i0__namespace.ɵɵpipeBind1(2, 1, i0__namespace.ɵɵpipeBindV(3, 3, i0__namespace.ɵɵpureFunction2(12, _c0$f, i0__namespace.ɵɵpipeBind2(4, 9, page_r13, ctx_r14.editForm), ctx_r14.allFieldsValues))));
27577
27582
  }
27578
27583
  }
27579
27584
  function CaseEditSubmitComponent_div_0_ng_container_11_ng_container_7_Template(rf, ctx) {
@@ -27826,6 +27831,7 @@
27826
27831
  });
27827
27832
  CaseEditSubmitComponent.prototype.ngOnInit = function () {
27828
27833
  var _this = this;
27834
+ var _a, _b, _c;
27829
27835
  this.profileSubscription = this.profileNotifier.profile.subscribe(function (_) { return _this.profile = _; });
27830
27836
  this.eventTrigger = this.caseEdit.eventTrigger;
27831
27837
  this.triggerText = this.eventTrigger.end_button_label || CallbackErrorsComponent.TRIGGER_TEXT_SUBMIT;
@@ -27834,6 +27840,11 @@
27834
27840
  this.showSummaryFields = this.sortFieldsByShowSummaryContent(this.eventTrigger.case_fields);
27835
27841
  this.caseEdit.isSubmitting = false;
27836
27842
  this.contextFields = this.getCaseFields();
27843
+ this.metadataFieldsObject = (_c = (_b = (_a = this.caseEdit) === null || _a === void 0 ? void 0 : _a.caseDetails) === null || _b === void 0 ? void 0 : _b.metadataFields) === null || _c === void 0 ? void 0 : _c.reduce(function (o, key) {
27844
+ var _d;
27845
+ return Object.assign(o, (_d = {}, _d[key.id] = key.value, _d));
27846
+ }, {});
27847
+ this.allFieldsValues = Object.assign(this.metadataFieldsObject ? this.metadataFieldsObject : {}, this.editForm.getRawValue().data);
27837
27848
  // Indicates if the submission is for a Case Flag, as opposed to a "regular" form submission, by the presence of
27838
27849
  // a FlagLauncher field in the event trigger
27839
27850
  this.caseEdit.isCaseFlagSubmission =
@@ -31076,13 +31087,14 @@
31076
31087
  i0__namespace.ɵɵsetComponentScope(CaseTimelineComponent, [i2__namespace.NgIf, i2__namespace.NgSwitch, i2__namespace.NgSwitchCase, EventLogComponent, CaseHistoryComponent], [i1__namespace.RpxTranslatePipe]);
31077
31088
 
31078
31089
  var CaseResolver = /** @class */ (function () {
31079
- function CaseResolver(caseNotifier, draftService, navigationNotifierService, router, sessionStorage) {
31090
+ function CaseResolver(caseNotifier, draftService, navigationNotifierService, router, sessionStorage, appConfig) {
31080
31091
  var _this = this;
31081
31092
  this.caseNotifier = caseNotifier;
31082
31093
  this.draftService = draftService;
31083
31094
  this.navigationNotifierService = navigationNotifierService;
31084
31095
  this.router = router;
31085
31096
  this.sessionStorage = sessionStorage;
31097
+ this.appConfig = appConfig;
31086
31098
  router.events.pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }))
31087
31099
  .subscribe(function (event) {
31088
31100
  _this.previousUrl = event.url;
@@ -31128,7 +31140,7 @@
31128
31140
  else {
31129
31141
  console.info('getAndCacheCaseView - Path B.');
31130
31142
  return this.caseNotifier.fetchAndRefresh(cid)
31131
- .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); }))
31143
+ .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); }))
31132
31144
  .toPromise();
31133
31145
  }
31134
31146
  }
@@ -31141,9 +31153,9 @@
31141
31153
  _this.caseNotifier.cachedCaseView = classTransformer.plainToClassFromExist(new CaseView(), caseView);
31142
31154
  _this.caseNotifier.announceCase(_this.caseNotifier.cachedCaseView);
31143
31155
  return _this.caseNotifier.cachedCaseView;
31144
- }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); })).toPromise();
31156
+ }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); })).toPromise();
31145
31157
  };
31146
- CaseResolver.prototype.processErrorInCaseFetch = function (error) {
31158
+ CaseResolver.prototype.processErrorInCaseFetch = function (error, caseReference) {
31147
31159
  console.error('!!! processErrorInCaseFetch !!!');
31148
31160
  console.error(error);
31149
31161
  // TODO Should be logged to remote logging infrastructure
@@ -31151,12 +31163,16 @@
31151
31163
  this.router.navigate(['/search/noresults']);
31152
31164
  return rxjs.of(null);
31153
31165
  }
31154
- console.error(error);
31155
31166
  if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
31156
31167
  this.router.navigate(['/list/case']);
31157
31168
  return rxjs.of(null);
31158
31169
  }
31159
- if (error.status !== 401 && error.status !== 403) {
31170
+ // Error 403 and enable-restricted-case-access Launch Darkly flag is enabled, navigate to restricted case access page
31171
+ if (error.status === 403 && this.appConfig.getEnableRestrictedCaseAccessConfig()) {
31172
+ this.router.navigate(["/cases/restricted-case-access/" + caseReference]);
31173
+ return rxjs.of(null);
31174
+ }
31175
+ if (error.status !== 401) {
31160
31176
  this.router.navigate(['/error']);
31161
31177
  }
31162
31178
  this.goToDefaultPage();
@@ -31183,12 +31199,12 @@
31183
31199
  CaseResolver.CASE_CREATED_MSG = 'The case has been created successfully';
31184
31200
  CaseResolver.defaultWAPage = '/work/my-work/list';
31185
31201
  CaseResolver.defaultPage = '/cases';
31186
- CaseResolver.ɵfac = function CaseResolver_Factory(t) { return new (t || CaseResolver)(i0__namespace.ɵɵinject(CaseNotifier), i0__namespace.ɵɵinject(DraftService), i0__namespace.ɵɵinject(NavigationNotifierService), i0__namespace.ɵɵinject(i1__namespace$1.Router), i0__namespace.ɵɵinject(SessionStorageService)); };
31202
+ CaseResolver.ɵfac = function CaseResolver_Factory(t) { return new (t || CaseResolver)(i0__namespace.ɵɵinject(CaseNotifier), i0__namespace.ɵɵinject(DraftService), i0__namespace.ɵɵinject(NavigationNotifierService), i0__namespace.ɵɵinject(i1__namespace$1.Router), i0__namespace.ɵɵinject(SessionStorageService), i0__namespace.ɵɵinject(AbstractAppConfig)); };
31187
31203
  CaseResolver.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: CaseResolver, factory: CaseResolver.ɵfac });
31188
31204
  (function () {
31189
31205
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CaseResolver, [{
31190
31206
  type: i0.Injectable
31191
- }], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1__namespace$1.Router }, { type: SessionStorageService }]; }, null);
31207
+ }], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1__namespace$1.Router }, { type: SessionStorageService }, { type: AbstractAppConfig }]; }, null);
31192
31208
  })();
31193
31209
 
31194
31210
  var EventTriggerResolver = /** @class */ (function () {