@hmcts/ccd-case-ui-toolkit 6.19.15-prerelease-service-id-params → 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 (26) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +36 -45
  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-viewer/services/case.resolver.js +16 -9
  7. package/esm2015/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.js +12 -26
  8. package/esm2015/lib/shared/domain/http/http-error.model.js +8 -1
  9. package/esm2015/lib/shared/services/common-data-service/common-data-service.js +1 -7
  10. package/esm2015/lib/shared/services/http/http-error.service.js +4 -5
  11. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +35 -43
  12. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  13. package/lib/app.config.d.ts +2 -0
  14. package/lib/app.config.d.ts.map +1 -1
  15. package/lib/shared/components/case-viewer/services/case.resolver.d.ts +3 -1
  16. package/lib/shared/components/case-viewer/services/case.resolver.d.ts.map +1 -1
  17. package/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.d.ts +3 -6
  18. package/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.d.ts.map +1 -1
  19. package/lib/shared/domain/http/http-error.model.d.ts.map +1 -1
  20. package/lib/shared/services/common-data-service/common-data-service.d.ts +0 -2
  21. package/lib/shared/services/common-data-service/common-data-service.d.ts.map +1 -1
  22. package/lib/shared/services/http/http-error.service.d.ts.map +1 -1
  23. package/package.json +1 -1
  24. package/esm2015/lib/shared/domain/case-view/service-org-response.model.js +0 -2
  25. package/lib/shared/domain/case-view/service-org-response.model.d.ts +0 -14
  26. package/lib/shared/domain/case-view/service-org-response.model.d.ts.map +0 -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);
@@ -18764,12 +18770,6 @@
18764
18770
  }
18765
18771
  return rxjs.of(null);
18766
18772
  };
18767
- CommonDataService.prototype.getServiceOrgData = function (url) {
18768
- if (url) {
18769
- return this.http.get(url, { observe: 'body' });
18770
- }
18771
- return rxjs.of(null);
18772
- };
18773
18773
  return CommonDataService;
18774
18774
  }());
18775
18775
  CommonDataService.ɵfac = function CommonDataService_Factory(t) { return new (t || CommonDataService)(i0__namespace.ɵɵinject(i1__namespace$2.HttpClient)); };
@@ -19034,7 +19034,6 @@
19034
19034
  _this.linkedCasesPages = exports.LinkedCasesPages;
19035
19035
  _this.linkedCasesEventTriggers = exports.LinkedCasesEventTriggers;
19036
19036
  _this.linkedCases = [];
19037
- _this.subscriptions = new rxjs.Subscription();
19038
19037
  return _this;
19039
19038
  }
19040
19039
  WriteLinkedCasesFieldComponent.prototype.ngOnInit = function () {
@@ -19045,17 +19044,17 @@
19045
19044
  // Clear validation errors
19046
19045
  this.caseEditDataService.clearFormValidationErrors();
19047
19046
  // Get linked case reasons from ref data
19047
+ this.getLinkedCaseReasons();
19048
19048
  this.linkedCasesService.editMode = false;
19049
- this.subscriptions.add(this.caseEditDataService.caseDetails$.subscribe({
19050
- next: function (caseDetails) { _this.initialiseCaseDetails(caseDetails); }
19051
- }));
19052
- this.getOrgService();
19053
- this.subscriptions.add(this.caseEditDataService.caseEventTriggerName$.subscribe({
19049
+ this.caseEditDataService.caseDetails$.subscribe({
19050
+ next: function (caseDetails) { return _this.initialiseCaseDetails(caseDetails); }
19051
+ });
19052
+ this.caseEditDataService.caseEventTriggerName$.subscribe({
19054
19053
  next: function (name) { return _this.linkedCasesService.isLinkedCasesEventTrigger = (name === exports.LinkedCasesEventTriggers.LINK_CASES); }
19055
- }));
19056
- this.subscriptions.add(this.caseEditDataService.caseEditForm$.subscribe({
19054
+ });
19055
+ this.caseEditDataService.caseEditForm$.subscribe({
19057
19056
  next: function (editForm) { return _this.caseEditForm = editForm; }
19058
- }));
19057
+ });
19059
19058
  };
19060
19059
  WriteLinkedCasesFieldComponent.prototype.initialiseCaseDetails = function (caseDetails) {
19061
19060
  if (caseDetails) {
@@ -19092,29 +19091,19 @@
19092
19091
  }
19093
19092
  }
19094
19093
  };
19095
- WriteLinkedCasesFieldComponent.prototype.getLinkedCaseReasons = function (serviceId) {
19094
+ WriteLinkedCasesFieldComponent.prototype.getLinkedCaseReasons = function () {
19096
19095
  var _this = this;
19097
- var reasonCodeAPIurl = this.appConfig.getRDCommonDataApiUrl() + "/lov/categories/CaseLinkingReasonCode?serviceId=" + serviceId;
19096
+ var reasonCodeAPIurl = this.appConfig.getRDCommonDataApiUrl() + "/lov/categories/CaseLinkingReasonCode";
19098
19097
  this.commonDataService.getRefData(reasonCodeAPIurl).subscribe({
19099
19098
  next: function (reasons) {
19100
19099
  // Sort in ascending order
19101
19100
  var linkCaseReasons = reasons.list_of_values.sort(function (a, b) { return (a.value_en > b.value_en) ? 1 : -1; });
19102
- _this.linkedCasesService.linkCaseReasons = linkCaseReasons === null || linkCaseReasons === void 0 ? void 0 : linkCaseReasons.filter(function (reason) { return reason.value_en !== 'Other'; });
19103
19101
  // Move Other option to the end of the list
19102
+ _this.linkedCasesService.linkCaseReasons = linkCaseReasons === null || linkCaseReasons === void 0 ? void 0 : linkCaseReasons.filter(function (reason) { return reason.value_en !== 'Other'; });
19104
19103
  _this.linkedCasesService.linkCaseReasons.push(linkCaseReasons === null || linkCaseReasons === void 0 ? void 0 : linkCaseReasons.find(function (reason) { return reason.value_en === 'Other'; }));
19105
19104
  }
19106
19105
  });
19107
19106
  };
19108
- WriteLinkedCasesFieldComponent.prototype.getOrgService = function () {
19109
- var _this = this;
19110
- var _a, _b;
19111
- var servicesApiUrl = "refdata/location/orgServices?ccdCaseType=" + ((_b = (_a = this.caseDetails) === null || _a === void 0 ? void 0 : _a.case_type) === null || _b === void 0 ? void 0 : _b.id);
19112
- this.commonDataService.getServiceOrgData(servicesApiUrl).subscribe(function (result) {
19113
- result.forEach(function (ids) {
19114
- _this.getLinkedCaseReasons(ids.service_id);
19115
- });
19116
- });
19117
- };
19118
19107
  WriteLinkedCasesFieldComponent.prototype.proceedToNextPage = function () {
19119
19108
  if (this.isAtFinalPage()) {
19120
19109
  // Continue button event must be allowed in final page
@@ -19155,8 +19144,8 @@
19155
19144
  var _this = this;
19156
19145
  this.casesService.getCaseViewV2(this.linkedCasesService.caseId).subscribe(function (caseView) {
19157
19146
  var caseViewFiltered = caseView.tabs.filter(function (tab) {
19158
- return tab.fields.some(function (_c) {
19159
- var field_type = _c.field_type;
19147
+ return tab.fields.some(function (_b) {
19148
+ var field_type = _b.field_type;
19160
19149
  return field_type && field_type.collection_field_type && field_type.collection_field_type.id === 'CaseLink';
19161
19150
  });
19162
19151
  });
@@ -19173,9 +19162,6 @@
19173
19162
  : exports.LinkedCasesPages.NO_LINKED_CASES;
19174
19163
  });
19175
19164
  };
19176
- WriteLinkedCasesFieldComponent.prototype.ngOnDestroy = function () {
19177
- this.subscriptions.unsubscribe();
19178
- };
19179
19165
  return WriteLinkedCasesFieldComponent;
19180
19166
  }(AbstractFieldWriteComponent));
19181
19167
  WriteLinkedCasesFieldComponent.ɵfac = function WriteLinkedCasesFieldComponent_Factory(t) { return new (t || WriteLinkedCasesFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CommonDataService), i0__namespace.ɵɵdirectiveInject(CasesService), i0__namespace.ɵɵdirectiveInject(LinkedCasesService), i0__namespace.ɵɵdirectiveInject(CaseEditDataService)); };
@@ -31101,13 +31087,14 @@
31101
31087
  i0__namespace.ɵɵsetComponentScope(CaseTimelineComponent, [i2__namespace.NgIf, i2__namespace.NgSwitch, i2__namespace.NgSwitchCase, EventLogComponent, CaseHistoryComponent], [i1__namespace.RpxTranslatePipe]);
31102
31088
 
31103
31089
  var CaseResolver = /** @class */ (function () {
31104
- function CaseResolver(caseNotifier, draftService, navigationNotifierService, router, sessionStorage) {
31090
+ function CaseResolver(caseNotifier, draftService, navigationNotifierService, router, sessionStorage, appConfig) {
31105
31091
  var _this = this;
31106
31092
  this.caseNotifier = caseNotifier;
31107
31093
  this.draftService = draftService;
31108
31094
  this.navigationNotifierService = navigationNotifierService;
31109
31095
  this.router = router;
31110
31096
  this.sessionStorage = sessionStorage;
31097
+ this.appConfig = appConfig;
31111
31098
  router.events.pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }))
31112
31099
  .subscribe(function (event) {
31113
31100
  _this.previousUrl = event.url;
@@ -31153,7 +31140,7 @@
31153
31140
  else {
31154
31141
  console.info('getAndCacheCaseView - Path B.');
31155
31142
  return this.caseNotifier.fetchAndRefresh(cid)
31156
- .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); }))
31143
+ .pipe(operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); }))
31157
31144
  .toPromise();
31158
31145
  }
31159
31146
  }
@@ -31166,9 +31153,9 @@
31166
31153
  _this.caseNotifier.cachedCaseView = classTransformer.plainToClassFromExist(new CaseView(), caseView);
31167
31154
  _this.caseNotifier.announceCase(_this.caseNotifier.cachedCaseView);
31168
31155
  return _this.caseNotifier.cachedCaseView;
31169
- }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error); })).toPromise();
31156
+ }), operators.catchError(function (error) { return _this.processErrorInCaseFetch(error, cid); })).toPromise();
31170
31157
  };
31171
- CaseResolver.prototype.processErrorInCaseFetch = function (error) {
31158
+ CaseResolver.prototype.processErrorInCaseFetch = function (error, caseReference) {
31172
31159
  console.error('!!! processErrorInCaseFetch !!!');
31173
31160
  console.error(error);
31174
31161
  // TODO Should be logged to remote logging infrastructure
@@ -31176,12 +31163,16 @@
31176
31163
  this.router.navigate(['/search/noresults']);
31177
31164
  return rxjs.of(null);
31178
31165
  }
31179
- console.error(error);
31180
31166
  if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
31181
31167
  this.router.navigate(['/list/case']);
31182
31168
  return rxjs.of(null);
31183
31169
  }
31184
- 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) {
31185
31176
  this.router.navigate(['/error']);
31186
31177
  }
31187
31178
  this.goToDefaultPage();
@@ -31208,12 +31199,12 @@
31208
31199
  CaseResolver.CASE_CREATED_MSG = 'The case has been created successfully';
31209
31200
  CaseResolver.defaultWAPage = '/work/my-work/list';
31210
31201
  CaseResolver.defaultPage = '/cases';
31211
- 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)); };
31212
31203
  CaseResolver.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: CaseResolver, factory: CaseResolver.ɵfac });
31213
31204
  (function () {
31214
31205
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CaseResolver, [{
31215
31206
  type: i0.Injectable
31216
- }], 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);
31217
31208
  })();
31218
31209
 
31219
31210
  var EventTriggerResolver = /** @class */ (function () {