@hmcts/ccd-case-ui-toolkit 7.0.0-rc7 → 7.0.0
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.
- package/esm2020/lib/app.config.mjs +1 -1
- package/esm2020/lib/shared/components/case-viewer/services/case.resolver.mjs +16 -9
- package/esm2020/lib/shared/domain/http/http-error.model.mjs +8 -1
- package/esm2020/lib/shared/services/http/http-error.service.mjs +3 -5
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs +23 -12
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs +22 -12
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/app.config.d.ts +2 -0
- package/lib/app.config.d.ts.map +1 -1
- package/lib/shared/components/case-viewer/services/case.resolver.d.ts +3 -1
- package/lib/shared/components/case-viewer/services/case.resolver.d.ts.map +1 -1
- package/lib/shared/domain/http/http-error.model.d.ts.map +1 -1
- package/lib/shared/services/http/http-error.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1247,6 +1247,13 @@ class HttpError {
|
|
|
1247
1247
|
error[key] = response.error.hasOwnProperty(key) && response.error[key] ? response.error[key] : error[key];
|
|
1248
1248
|
});
|
|
1249
1249
|
}
|
|
1250
|
+
// Error object in HttpErrorResponse will be empty for 403 errors
|
|
1251
|
+
// Set the error properties of HttpError accordingly
|
|
1252
|
+
if (response?.status === 403) {
|
|
1253
|
+
error.error = response.statusText;
|
|
1254
|
+
error.status = response.status;
|
|
1255
|
+
error.message = response.message;
|
|
1256
|
+
}
|
|
1250
1257
|
return error;
|
|
1251
1258
|
}
|
|
1252
1259
|
}
|
|
@@ -1292,9 +1299,7 @@ class HttpErrorService {
|
|
|
1292
1299
|
}
|
|
1293
1300
|
let httpError = new HttpError();
|
|
1294
1301
|
if (error instanceof HttpErrorResponse) {
|
|
1295
|
-
if (error.headers
|
|
1296
|
-
&& error.headers.get(HttpErrorService.CONTENT_TYPE)
|
|
1297
|
-
&& error.headers.get(HttpErrorService.CONTENT_TYPE).indexOf(HttpErrorService.JSON) !== -1) {
|
|
1302
|
+
if (error.headers?.get(HttpErrorService.CONTENT_TYPE).indexOf(HttpErrorService.JSON) !== -1) {
|
|
1298
1303
|
try {
|
|
1299
1304
|
httpError = HttpError.from(error);
|
|
1300
1305
|
}
|
|
@@ -1328,7 +1333,7 @@ class HttpErrorService {
|
|
|
1328
1333
|
console.error('Handling error in http error service.');
|
|
1329
1334
|
console.error(error);
|
|
1330
1335
|
const httpError = HttpErrorService.convertToHttpError(error);
|
|
1331
|
-
if (redirectIfNotAuthorised &&
|
|
1336
|
+
if (redirectIfNotAuthorised && httpError.status === 401) {
|
|
1332
1337
|
this.authService.signIn();
|
|
1333
1338
|
}
|
|
1334
1339
|
return throwError(httpError);
|
|
@@ -25798,12 +25803,13 @@ CaseTimelineModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [Commo
|
|
|
25798
25803
|
i0.ɵɵsetComponentScope(CaseTimelineComponent, function () { return [i1.NgIf, i1.NgSwitch, i1.NgSwitchCase, CaseHistoryComponent, EventLogComponent]; }, function () { return [i1$1.RpxTranslatePipe]; });
|
|
25799
25804
|
|
|
25800
25805
|
class CaseResolver {
|
|
25801
|
-
constructor(caseNotifier, draftService, navigationNotifierService, router, sessionStorage) {
|
|
25806
|
+
constructor(caseNotifier, draftService, navigationNotifierService, router, sessionStorage, appConfig) {
|
|
25802
25807
|
this.caseNotifier = caseNotifier;
|
|
25803
25808
|
this.draftService = draftService;
|
|
25804
25809
|
this.navigationNotifierService = navigationNotifierService;
|
|
25805
25810
|
this.router = router;
|
|
25806
25811
|
this.sessionStorage = sessionStorage;
|
|
25812
|
+
this.appConfig = appConfig;
|
|
25807
25813
|
router.events.pipe(filter(event => event instanceof NavigationEnd))
|
|
25808
25814
|
.subscribe((event) => {
|
|
25809
25815
|
this.previousUrl = event.url;
|
|
@@ -25848,7 +25854,7 @@ class CaseResolver {
|
|
|
25848
25854
|
else {
|
|
25849
25855
|
console.info('getAndCacheCaseView - Path B.');
|
|
25850
25856
|
return this.caseNotifier.fetchAndRefresh(cid)
|
|
25851
|
-
.pipe(catchError(error => this.processErrorInCaseFetch(error)))
|
|
25857
|
+
.pipe(catchError(error => this.processErrorInCaseFetch(error, cid)))
|
|
25852
25858
|
.toPromise();
|
|
25853
25859
|
}
|
|
25854
25860
|
}
|
|
@@ -25860,9 +25866,9 @@ class CaseResolver {
|
|
|
25860
25866
|
this.caseNotifier.cachedCaseView = plainToClassFromExist(new CaseView(), caseView);
|
|
25861
25867
|
this.caseNotifier.announceCase(this.caseNotifier.cachedCaseView);
|
|
25862
25868
|
return this.caseNotifier.cachedCaseView;
|
|
25863
|
-
}), catchError(error => this.processErrorInCaseFetch(error))).toPromise();
|
|
25869
|
+
}), catchError(error => this.processErrorInCaseFetch(error, cid))).toPromise();
|
|
25864
25870
|
}
|
|
25865
|
-
processErrorInCaseFetch(error) {
|
|
25871
|
+
processErrorInCaseFetch(error, caseReference) {
|
|
25866
25872
|
console.error('!!! processErrorInCaseFetch !!!');
|
|
25867
25873
|
console.error(error);
|
|
25868
25874
|
// TODO Should be logged to remote logging infrastructure
|
|
@@ -25870,12 +25876,16 @@ class CaseResolver {
|
|
|
25870
25876
|
this.router.navigate(['/search/noresults']);
|
|
25871
25877
|
return of(null);
|
|
25872
25878
|
}
|
|
25873
|
-
console.error(error);
|
|
25874
25879
|
if (CaseResolver.EVENT_REGEX.test(this.previousUrl) && error.status === 404) {
|
|
25875
25880
|
this.router.navigate(['/list/case']);
|
|
25876
25881
|
return of(null);
|
|
25877
25882
|
}
|
|
25878
|
-
|
|
25883
|
+
// Error 403 and enable-restricted-case-access Launch Darkly flag is enabled, navigate to restricted case access page
|
|
25884
|
+
if (error.status === 403 && this.appConfig.getEnableRestrictedCaseAccessConfig()) {
|
|
25885
|
+
this.router.navigate([`/cases/restricted-case-access/${caseReference}`]);
|
|
25886
|
+
return of(null);
|
|
25887
|
+
}
|
|
25888
|
+
if (error.status !== 401) {
|
|
25879
25889
|
this.router.navigate(['/error']);
|
|
25880
25890
|
}
|
|
25881
25891
|
this.goToDefaultPage();
|
|
@@ -25901,11 +25911,11 @@ CaseResolver.PARAM_CASE_ID = 'cid';
|
|
|
25901
25911
|
CaseResolver.CASE_CREATED_MSG = 'The case has been created successfully';
|
|
25902
25912
|
CaseResolver.defaultWAPage = '/work/my-work/list';
|
|
25903
25913
|
CaseResolver.defaultPage = '/cases';
|
|
25904
|
-
CaseResolver.ɵfac = function CaseResolver_Factory(t) { return new (t || CaseResolver)(i0.ɵɵinject(CaseNotifier), i0.ɵɵinject(DraftService), i0.ɵɵinject(NavigationNotifierService), i0.ɵɵinject(i1$2.Router), i0.ɵɵinject(SessionStorageService)); };
|
|
25914
|
+
CaseResolver.ɵfac = function CaseResolver_Factory(t) { return new (t || CaseResolver)(i0.ɵɵinject(CaseNotifier), i0.ɵɵinject(DraftService), i0.ɵɵinject(NavigationNotifierService), i0.ɵɵinject(i1$2.Router), i0.ɵɵinject(SessionStorageService), i0.ɵɵinject(AbstractAppConfig)); };
|
|
25905
25915
|
CaseResolver.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CaseResolver, factory: CaseResolver.ɵfac });
|
|
25906
25916
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseResolver, [{
|
|
25907
25917
|
type: Injectable
|
|
25908
|
-
}], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1$2.Router }, { type: SessionStorageService }]; }, null); })();
|
|
25918
|
+
}], function () { return [{ type: CaseNotifier }, { type: DraftService }, { type: NavigationNotifierService }, { type: i1$2.Router }, { type: SessionStorageService }, { type: AbstractAppConfig }]; }, null); })();
|
|
25909
25919
|
|
|
25910
25920
|
class EventTriggerResolver {
|
|
25911
25921
|
constructor(casesService, alertService, profileService, profileNotifier) {
|