vc-error-handlers 0.1.97 → 0.1.98
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/featureFlag/feature-flag.module.mjs +1 -1
- package/esm2020/lib/shared/components/chunk-unavailable/chunk-unavailable.component.mjs +4 -3
- package/esm2020/lib/shared/components/component-level-server-error/component-level-server-error.component.mjs +5 -4
- package/esm2020/lib/shared/components/error-modal/error-modal.component.mjs +14 -11
- package/esm2020/lib/shared/components/page-not-found/page-not-found.component.mjs +25 -14
- package/esm2020/lib/shared/components/server-error/server-error.component.mjs +17 -6
- package/esm2020/lib/shared/components/session-expired/session-expired.component.mjs +4 -3
- package/esm2020/lib/shared/components/unauthorized/unauthorized.component.mjs +26 -10
- package/esm2020/lib/shared/constants/api-config.constants.mjs +7 -14
- package/esm2020/lib/shared/constants/error-handling.constants.mjs +15 -2
- package/esm2020/lib/shared/errorhandler/sentry-error.handler.mjs +6 -9
- package/esm2020/lib/shared/interceptors/http.interceptor.mjs +3 -3
- package/esm2020/lib/shared/services/global-error.service.mjs +24 -50
- package/esm2020/lib/shared/services/util.service.mjs +29 -2
- package/esm2020/lib/shared/types/global-error.types.mjs +1 -1
- package/esm2020/lib/vc-error-handlers.component.mjs +9 -12
- package/esm2020/public-api.mjs +1 -2
- package/fesm2015/vc-error-handlers.mjs +167 -138
- package/fesm2015/vc-error-handlers.mjs.map +1 -1
- package/fesm2020/vc-error-handlers.mjs +167 -138
- package/fesm2020/vc-error-handlers.mjs.map +1 -1
- package/lib/shared/components/chunk-unavailable/chunk-unavailable.component.d.ts +4 -0
- package/lib/shared/components/component-level-server-error/component-level-server-error.component.d.ts +4 -0
- package/lib/shared/components/error-modal/error-modal.component.d.ts +8 -4
- package/lib/shared/components/page-not-found/page-not-found.component.d.ts +8 -3
- package/lib/shared/components/server-error/server-error.component.d.ts +4 -0
- package/lib/shared/components/session-expired/session-expired.component.d.ts +4 -0
- package/lib/shared/components/unauthorized/unauthorized.component.d.ts +5 -0
- package/lib/shared/constants/api-config.constants.d.ts +2 -6
- package/lib/shared/constants/error-handling.constants.d.ts +13 -0
- package/lib/shared/errorhandler/sentry-error.handler.d.ts +1 -1
- package/lib/shared/services/global-error.service.d.ts +1 -1
- package/lib/shared/services/util.service.d.ts +10 -1
- package/lib/shared/types/global-error.types.d.ts +11 -0
- package/package.json +1 -1
- package/public-api.d.ts +0 -1
- package/esm2020/lib/shared/services/auth.service.mjs +0 -20
- package/lib/shared/services/auth.service.d.ts +0 -9
|
@@ -3,9 +3,9 @@ import { Injectable, Component, Input, Directive, ViewChild, NgModule, EventEmit
|
|
|
3
3
|
import { Subject, throwError } from 'rxjs';
|
|
4
4
|
import * as i3 from '@angular/router';
|
|
5
5
|
import { NavigationStart, NavigationEnd, NavigationError } from '@angular/router';
|
|
6
|
-
import * as i1 from '@vcomply/authorizer';
|
|
7
6
|
import * as i2 from '@angular/common';
|
|
8
7
|
import { CommonModule } from '@angular/common';
|
|
8
|
+
import * as i1 from '@vcomply/authorizer';
|
|
9
9
|
import * as i1$1 from '@angular/common/http';
|
|
10
10
|
import { HttpResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
11
11
|
import { retry, timeout, tap, catchError } from 'rxjs/operators';
|
|
@@ -41,18 +41,11 @@ var ErrorStatusCode;
|
|
|
41
41
|
|
|
42
42
|
const PAGE_LEVEL_API_CONFIG = [
|
|
43
43
|
{
|
|
44
|
-
method: '
|
|
45
|
-
path: '
|
|
46
|
-
query:
|
|
47
|
-
body:
|
|
48
|
-
pageCodes: ['
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
method: 'GET',
|
|
52
|
-
path: '/compliance_post',
|
|
53
|
-
query: { mode: 'xyz' },
|
|
54
|
-
body: { mode: 'abc' },
|
|
55
|
-
pageCodes: ['compliance:mr', 'risk:mr'],
|
|
44
|
+
method: '',
|
|
45
|
+
path: '',
|
|
46
|
+
query: null,
|
|
47
|
+
body: null,
|
|
48
|
+
pageCodes: [''],
|
|
56
49
|
},
|
|
57
50
|
];
|
|
58
51
|
const COMPONENT_LEVEL_API_CONFIG = [
|
|
@@ -190,7 +183,7 @@ const COMPONENT_LEVEL_API_CONFIG = [
|
|
|
190
183
|
},
|
|
191
184
|
{
|
|
192
185
|
method: 'POST',
|
|
193
|
-
path: '
|
|
186
|
+
path: 'memberDetailsbyIds',
|
|
194
187
|
query: null,
|
|
195
188
|
body: null,
|
|
196
189
|
},
|
|
@@ -318,12 +311,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
318
311
|
class UtilsService {
|
|
319
312
|
isJsonSubset(parentJson, subsetJson) {
|
|
320
313
|
for (let key in subsetJson) {
|
|
321
|
-
if (!parentJson.hasOwnProperty(key) ||
|
|
314
|
+
if (!parentJson.hasOwnProperty(key) ||
|
|
315
|
+
parentJson[key] !== subsetJson[key]) {
|
|
322
316
|
return false;
|
|
323
317
|
}
|
|
324
318
|
}
|
|
325
319
|
return true;
|
|
326
320
|
}
|
|
321
|
+
extractQueryParams(params) {
|
|
322
|
+
const query = {};
|
|
323
|
+
params.keys().forEach((key) => {
|
|
324
|
+
query[key] = params.get(key);
|
|
325
|
+
});
|
|
326
|
+
return query;
|
|
327
|
+
}
|
|
328
|
+
isStringEqual(apiMethod, requestMethod) {
|
|
329
|
+
return apiMethod === requestMethod;
|
|
330
|
+
}
|
|
331
|
+
isSubstringInString(apiPath, requestPath) {
|
|
332
|
+
return requestPath.includes(apiPath);
|
|
333
|
+
}
|
|
334
|
+
isSubsetOfObject(apiQuery, requestQuery) {
|
|
335
|
+
if (!apiQuery)
|
|
336
|
+
return true;
|
|
337
|
+
return this.isJsonSubset(requestQuery, apiQuery);
|
|
338
|
+
}
|
|
339
|
+
isSubsetOfArray(apiBody, requestBody) {
|
|
340
|
+
if (!apiBody)
|
|
341
|
+
return true;
|
|
342
|
+
return this.isJsonSubset(apiBody, requestBody);
|
|
343
|
+
}
|
|
344
|
+
isValueInArray(apiPageCodes, pageCode) {
|
|
345
|
+
return apiPageCodes.includes(pageCode);
|
|
346
|
+
}
|
|
327
347
|
}
|
|
328
348
|
UtilsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
329
349
|
UtilsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UtilsService, providedIn: 'root' });
|
|
@@ -388,11 +408,9 @@ class GlobalErrorService {
|
|
|
388
408
|
}
|
|
389
409
|
handleServerError(error, request) {
|
|
390
410
|
if (this.isPageLevelError(error, request)) {
|
|
391
|
-
console.log('page level error');
|
|
392
411
|
this.publishGlobalError(error);
|
|
393
412
|
}
|
|
394
413
|
else if (this.isComponentLevelError(error, request)) {
|
|
395
|
-
console.log('component level error');
|
|
396
414
|
this.publishLocalError(error, request);
|
|
397
415
|
}
|
|
398
416
|
}
|
|
@@ -403,60 +421,36 @@ class GlobalErrorService {
|
|
|
403
421
|
this.localError$.next({ error, request });
|
|
404
422
|
}
|
|
405
423
|
isPageLevelError(error, request) {
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
if (!isQuerySubset)
|
|
415
|
-
return false;
|
|
416
|
-
const isBodyMatch = this.utilService.isJsonSubset(apiConfig.body, body);
|
|
417
|
-
if (!isBodyMatch)
|
|
418
|
-
return false;
|
|
419
|
-
return apiConfig.pageCodes.includes(pageCode);
|
|
420
|
-
});
|
|
421
|
-
return isConfigMatched;
|
|
424
|
+
const requestDetails = {
|
|
425
|
+
method: request.method,
|
|
426
|
+
path: request.url,
|
|
427
|
+
query: this.utilService.extractQueryParams(request.params),
|
|
428
|
+
body: request.body,
|
|
429
|
+
pageCode: this.getPageCode(),
|
|
430
|
+
};
|
|
431
|
+
return this.pageLevelApiConfig.some((apiConfig) => this.isApiConfigMatching(apiConfig, requestDetails));
|
|
422
432
|
}
|
|
423
433
|
isComponentLevelError(error, request) {
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
query
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
return false;
|
|
432
|
-
if (!path.includes(apiConfig.path))
|
|
433
|
-
return false;
|
|
434
|
-
if (apiConfig.query) {
|
|
435
|
-
const isQuerySubset = this.utilService.isJsonSubset(query, apiConfig.query);
|
|
436
|
-
if (!isQuerySubset)
|
|
437
|
-
return false;
|
|
438
|
-
}
|
|
439
|
-
if (apiConfig.body) {
|
|
440
|
-
const isBodyMatch = this.utilService.isJsonSubset(apiConfig.body, body);
|
|
441
|
-
if (!isBodyMatch)
|
|
442
|
-
return false;
|
|
443
|
-
}
|
|
444
|
-
return true;
|
|
445
|
-
});
|
|
446
|
-
return isConfigFound;
|
|
447
|
-
}
|
|
448
|
-
parseRequest(request) {
|
|
449
|
-
const { method, url: path, params, body } = request;
|
|
450
|
-
const query = {};
|
|
451
|
-
params.keys().forEach((key) => {
|
|
452
|
-
query[key] = params.get(key);
|
|
453
|
-
});
|
|
454
|
-
return { method, path, query, body };
|
|
434
|
+
const requestDetails = {
|
|
435
|
+
method: request.method,
|
|
436
|
+
path: request.url,
|
|
437
|
+
query: this.utilService.extractQueryParams(request.params),
|
|
438
|
+
body: request.body,
|
|
439
|
+
};
|
|
440
|
+
return this.componentLevelApiConfig.some((apiConfig) => this.isApiConfigMatching(apiConfig, requestDetails));
|
|
455
441
|
}
|
|
456
442
|
getPageCode() {
|
|
457
443
|
const currentRoute = this.router.routerState.snapshot.root.firstChild;
|
|
458
444
|
return currentRoute?.data?.pageCode;
|
|
459
445
|
}
|
|
446
|
+
isApiConfigMatching(apiConfig, requestDetails) {
|
|
447
|
+
return (this.utilService.isStringEqual(apiConfig.method, requestDetails.method) &&
|
|
448
|
+
this.utilService.isSubstringInString(apiConfig.path, requestDetails.path) &&
|
|
449
|
+
this.utilService.isSubsetOfObject(apiConfig.query, requestDetails.query) &&
|
|
450
|
+
this.utilService.isSubsetOfArray(apiConfig.body, requestDetails.body) &&
|
|
451
|
+
(!apiConfig.pageCodes ||
|
|
452
|
+
this.utilService.isValueInArray(apiConfig.pageCodes, requestDetails.pageCode || '')));
|
|
453
|
+
}
|
|
460
454
|
}
|
|
461
455
|
GlobalErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GlobalErrorService, deps: [{ token: SnackBarService }, { token: UtilsService }, { token: i3.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
462
456
|
GlobalErrorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GlobalErrorService, providedIn: 'root' });
|
|
@@ -467,23 +461,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
467
461
|
}]
|
|
468
462
|
}], ctorParameters: function () { return [{ type: SnackBarService }, { type: UtilsService }, { type: i3.Router }]; } });
|
|
469
463
|
|
|
470
|
-
class AuthService {
|
|
471
|
-
constructor(authorizer) {
|
|
472
|
-
this.authorizer = authorizer;
|
|
473
|
-
}
|
|
474
|
-
logoutUser() {
|
|
475
|
-
this.authorizer.logout();
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AuthService, deps: [{ token: i1.AuthorizerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
479
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AuthService, providedIn: "root" });
|
|
480
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AuthService, decorators: [{
|
|
481
|
-
type: Injectable,
|
|
482
|
-
args: [{
|
|
483
|
-
providedIn: "root",
|
|
484
|
-
}]
|
|
485
|
-
}], ctorParameters: function () { return [{ type: i1.AuthorizerService }]; } });
|
|
486
|
-
|
|
487
464
|
class RouterService {
|
|
488
465
|
redirectToLogin() {
|
|
489
466
|
window.location.href =
|
|
@@ -503,6 +480,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
503
480
|
|
|
504
481
|
const VCOMPLY_LOGO_URL = 'https://cdn.v-comply.com/logo/prod/v-logo.svg';
|
|
505
482
|
const API_TIMEOUT_TIME = 1000 * 15;
|
|
483
|
+
const ORGANISATION_NAME = 'VCOMPLY TECHNOLOGIES, INC.';
|
|
484
|
+
const ERROR_FEATURE_FLAG = 'ff_error_handling';
|
|
506
485
|
const ERROR_CONFIG = {
|
|
507
486
|
PAGE_NOT_FOUND: {
|
|
508
487
|
imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
|
|
@@ -528,7 +507,7 @@ const ERROR_CONFIG = {
|
|
|
528
507
|
},
|
|
529
508
|
CHUNK_UNAVAILABLE: {
|
|
530
509
|
heading: 'Oops!',
|
|
531
|
-
description: '
|
|
510
|
+
description: 'Something went wrong. Please refresh the page or try again later.',
|
|
532
511
|
buttonText: 'REFRESH',
|
|
533
512
|
},
|
|
534
513
|
SERVER_ERROR: {
|
|
@@ -549,6 +528,17 @@ const ERROR_CONFIG = {
|
|
|
549
528
|
NETWORK_UNAVAILABLE: {
|
|
550
529
|
offlineMessage: "You're currently offline. Please check your internet connection and try again.",
|
|
551
530
|
},
|
|
531
|
+
};
|
|
532
|
+
const REDIRECTION_URL = {
|
|
533
|
+
compliance_dashboard: '/global-dashboard/compliance_dashboard',
|
|
534
|
+
};
|
|
535
|
+
const MODAL_ERROR_TYPES = {
|
|
536
|
+
CHUNK_NOT_FOUND: 'chunk_not_found',
|
|
537
|
+
SESSION_EXPIRED: 'session_expired',
|
|
538
|
+
};
|
|
539
|
+
const ALT_IMAGE_TEXT = {
|
|
540
|
+
ERROR_IMAGE: 'Error Image',
|
|
541
|
+
VCOMPLY_LOGO: 'VComply',
|
|
552
542
|
};
|
|
553
543
|
|
|
554
544
|
class SnackBarComponent {
|
|
@@ -605,7 +595,7 @@ class ErrorModalComponent {
|
|
|
605
595
|
this.authService = authService;
|
|
606
596
|
this.dialogConfig = dialogConfig;
|
|
607
597
|
this.routerService = routerService;
|
|
608
|
-
this.
|
|
598
|
+
this.errorTypes = MODAL_ERROR_TYPES;
|
|
609
599
|
this.data = {
|
|
610
600
|
heading: 'Message',
|
|
611
601
|
description: 'Description',
|
|
@@ -618,16 +608,18 @@ class ErrorModalComponent {
|
|
|
618
608
|
this.errorType = this.dialogConfig.data?.errorType;
|
|
619
609
|
}
|
|
620
610
|
onContinueAction() {
|
|
621
|
-
|
|
622
|
-
this.
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
611
|
+
switch (this.errorType) {
|
|
612
|
+
case this.errorTypes.SESSION_EXPIRED:
|
|
613
|
+
this.authService.logout();
|
|
614
|
+
this.routerService.redirectToLogin();
|
|
615
|
+
break;
|
|
616
|
+
case this.errorTypes.CHUNK_NOT_FOUND:
|
|
617
|
+
window.location.reload();
|
|
618
|
+
break;
|
|
627
619
|
}
|
|
628
620
|
}
|
|
629
621
|
}
|
|
630
|
-
ErrorModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ErrorModalComponent, deps: [{ token:
|
|
622
|
+
ErrorModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ErrorModalComponent, deps: [{ token: i1.AuthorizerService }, { token: DialogConfig }, { token: RouterService }], target: i0.ɵɵFactoryTarget.Component });
|
|
631
623
|
ErrorModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ErrorModalComponent, selector: "lib-vc-error-modal", inputs: { errorType: "errorType" }, ngImport: i0, template: ` <div class="error-dialog-box">
|
|
632
624
|
<div class="error-dialog-box-top">{{ data.heading }}</div>
|
|
633
625
|
<div class="error-dialog-box-mid">
|
|
@@ -652,7 +644,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
652
644
|
</button>
|
|
653
645
|
</div>
|
|
654
646
|
</div>`, styles: [".error-dialog-box{background:#fff;border-radius:.75rem;box-shadow:0 1px 10px #0003;width:27rem}.error-dialog-box-top{color:#000;font-size:16px;font-weight:500;border-radius:.75rem .75rem 0 0;display:flex;align-items:center;height:3.375rem;padding:0 1rem;margin-bottom:1rem}.error-dialog-box-mid{color:#565a6f;font-size:13px;min-height:5.5rem;padding:0 1rem}.error-dialog-box-bottom{display:flex;justify-content:end;padding:1rem}.error-dialog-box-bottom button.logIn-btn{background:#1e5dd3;border-radius:.125rem;border:none;color:#fff;cursor:pointer;font-size:11px;height:2rem;padding:.5rem .75rem}\n"] }]
|
|
655
|
-
}], ctorParameters: function () { return [{ type:
|
|
647
|
+
}], ctorParameters: function () { return [{ type: i1.AuthorizerService }, { type: DialogConfig }, { type: RouterService }]; }, propDecorators: { errorType: [{
|
|
656
648
|
type: Input
|
|
657
649
|
}] } });
|
|
658
650
|
|
|
@@ -836,6 +828,7 @@ class SessionExpiredComponent {
|
|
|
836
828
|
constructor(dialogService) {
|
|
837
829
|
this.dialogService = dialogService;
|
|
838
830
|
this.errorConfig = ERROR_CONFIG.SESSION_EXPIRED;
|
|
831
|
+
this.errorTypes = MODAL_ERROR_TYPES;
|
|
839
832
|
}
|
|
840
833
|
ngOnInit() {
|
|
841
834
|
this.openSessionExpiredModal();
|
|
@@ -843,7 +836,7 @@ class SessionExpiredComponent {
|
|
|
843
836
|
openSessionExpiredModal() {
|
|
844
837
|
this.dialogService.open(ErrorModalComponent, {
|
|
845
838
|
data: {
|
|
846
|
-
errorType:
|
|
839
|
+
errorType: this.errorTypes.SESSION_EXPIRED,
|
|
847
840
|
errorConfig: this.errorConfig,
|
|
848
841
|
},
|
|
849
842
|
position: 'center',
|
|
@@ -866,6 +859,8 @@ class UnauthorizedComponent {
|
|
|
866
859
|
this.currentYear = new Date().getFullYear();
|
|
867
860
|
this.errorConfig = ERROR_CONFIG.UNAUTHORIZED;
|
|
868
861
|
this.VcomplyLogo = VCOMPLY_LOGO_URL;
|
|
862
|
+
this.altImageText = ALT_IMAGE_TEXT;
|
|
863
|
+
this.organisationName = ORGANISATION_NAME;
|
|
869
864
|
}
|
|
870
865
|
redirectToSupport() {
|
|
871
866
|
window.location.href = this.errorConfig.mail;
|
|
@@ -875,14 +870,19 @@ UnauthorizedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", ve
|
|
|
875
870
|
UnauthorizedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: UnauthorizedComponent, selector: "lib-vc-error-unauthorized", ngImport: i0, template: `
|
|
876
871
|
<div class="errorPage">
|
|
877
872
|
<div class="errorPage-top">
|
|
878
|
-
<img
|
|
873
|
+
<img
|
|
874
|
+
[src]="VcomplyLogo"
|
|
875
|
+
[alt]="altImageText.VCOMPLY_LOGO"
|
|
876
|
+
width="24"
|
|
877
|
+
height="24"
|
|
878
|
+
/>
|
|
879
879
|
</div>
|
|
880
880
|
<div class="errorPage-container">
|
|
881
881
|
<div class="errorPage-inner">
|
|
882
882
|
<div class="errorPage-inner-image">
|
|
883
883
|
<img
|
|
884
884
|
[src]="errorConfig.imageUrl"
|
|
885
|
-
alt="
|
|
885
|
+
[alt]="altImageText.ERROR_IMAGE"
|
|
886
886
|
width="246"
|
|
887
887
|
height="178"
|
|
888
888
|
/>
|
|
@@ -892,7 +892,9 @@ UnauthorizedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
|
|
|
892
892
|
<div class="errorPage-text">{{ errorConfig.description }}</div>
|
|
893
893
|
<div class="errorPage-details">
|
|
894
894
|
{{ errorConfig.details }}
|
|
895
|
-
<a href="mailto:
|
|
895
|
+
<a [href]="'mailto:' + errorConfig.email">{{
|
|
896
|
+
errorConfig.email
|
|
897
|
+
}}</a>
|
|
896
898
|
{{ errorConfig.support }}.
|
|
897
899
|
</div>
|
|
898
900
|
<button class="errorPage-btn" (click)="redirectToSupport()">
|
|
@@ -901,7 +903,7 @@ UnauthorizedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
|
|
|
901
903
|
</div>
|
|
902
904
|
</div>
|
|
903
905
|
<div class="errorPage-copyright">
|
|
904
|
-
© {{ currentYear }},
|
|
906
|
+
© {{ currentYear }}, {{ organisationName }}
|
|
905
907
|
</div>
|
|
906
908
|
</div>
|
|
907
909
|
</div>
|
|
@@ -911,14 +913,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
911
913
|
args: [{ selector: 'lib-vc-error-unauthorized', template: `
|
|
912
914
|
<div class="errorPage">
|
|
913
915
|
<div class="errorPage-top">
|
|
914
|
-
<img
|
|
916
|
+
<img
|
|
917
|
+
[src]="VcomplyLogo"
|
|
918
|
+
[alt]="altImageText.VCOMPLY_LOGO"
|
|
919
|
+
width="24"
|
|
920
|
+
height="24"
|
|
921
|
+
/>
|
|
915
922
|
</div>
|
|
916
923
|
<div class="errorPage-container">
|
|
917
924
|
<div class="errorPage-inner">
|
|
918
925
|
<div class="errorPage-inner-image">
|
|
919
926
|
<img
|
|
920
927
|
[src]="errorConfig.imageUrl"
|
|
921
|
-
alt="
|
|
928
|
+
[alt]="altImageText.ERROR_IMAGE"
|
|
922
929
|
width="246"
|
|
923
930
|
height="178"
|
|
924
931
|
/>
|
|
@@ -928,7 +935,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
928
935
|
<div class="errorPage-text">{{ errorConfig.description }}</div>
|
|
929
936
|
<div class="errorPage-details">
|
|
930
937
|
{{ errorConfig.details }}
|
|
931
|
-
<a href="mailto:
|
|
938
|
+
<a [href]="'mailto:' + errorConfig.email">{{
|
|
939
|
+
errorConfig.email
|
|
940
|
+
}}</a>
|
|
932
941
|
{{ errorConfig.support }}.
|
|
933
942
|
</div>
|
|
934
943
|
<button class="errorPage-btn" (click)="redirectToSupport()">
|
|
@@ -937,7 +946,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
937
946
|
</div>
|
|
938
947
|
</div>
|
|
939
948
|
<div class="errorPage-copyright">
|
|
940
|
-
© {{ currentYear }},
|
|
949
|
+
© {{ currentYear }}, {{ organisationName }}
|
|
941
950
|
</div>
|
|
942
951
|
</div>
|
|
943
952
|
</div>
|
|
@@ -948,6 +957,7 @@ class ChunkUnavailableComponent {
|
|
|
948
957
|
constructor(dialogService) {
|
|
949
958
|
this.dialogService = dialogService;
|
|
950
959
|
this.errorConfig = ERROR_CONFIG.CHUNK_UNAVAILABLE;
|
|
960
|
+
this.errorType = MODAL_ERROR_TYPES;
|
|
951
961
|
}
|
|
952
962
|
ngOnInit() {
|
|
953
963
|
this.openSessionExpiredModal();
|
|
@@ -955,7 +965,7 @@ class ChunkUnavailableComponent {
|
|
|
955
965
|
openSessionExpiredModal() {
|
|
956
966
|
this.dialogService.open(ErrorModalComponent, {
|
|
957
967
|
data: {
|
|
958
|
-
errorType:
|
|
968
|
+
errorType: this.errorType.CHUNK_NOT_FOUND,
|
|
959
969
|
errorConfig: this.errorConfig,
|
|
960
970
|
},
|
|
961
971
|
position: 'center',
|
|
@@ -977,6 +987,7 @@ class ServerErrorComponent {
|
|
|
977
987
|
constructor() {
|
|
978
988
|
this.errorConfig = ERROR_CONFIG.SERVER_ERROR;
|
|
979
989
|
this.VcomplyLogo = VCOMPLY_LOGO_URL;
|
|
990
|
+
this.altImageText = ALT_IMAGE_TEXT;
|
|
980
991
|
}
|
|
981
992
|
refreshPage() {
|
|
982
993
|
window.location.reload();
|
|
@@ -986,14 +997,19 @@ ServerErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", ver
|
|
|
986
997
|
ServerErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ServerErrorComponent, selector: "lib-vc-error-server-error", ngImport: i0, template: `
|
|
987
998
|
<div class="errorPage">
|
|
988
999
|
<div class="errorPage-top">
|
|
989
|
-
<img
|
|
1000
|
+
<img
|
|
1001
|
+
[src]="VcomplyLogo"
|
|
1002
|
+
[alt]="altImageText.VCOMPLY_LOGO"
|
|
1003
|
+
width="24"
|
|
1004
|
+
height="24"
|
|
1005
|
+
/>
|
|
990
1006
|
</div>
|
|
991
1007
|
<div class="errorPage-container">
|
|
992
1008
|
<div class="errorPage-inner">
|
|
993
1009
|
<div class="errorPage-inner-image">
|
|
994
1010
|
<img
|
|
995
1011
|
[src]="errorConfig.imageUrl"
|
|
996
|
-
alt="
|
|
1012
|
+
[alt]="altImageText.ERROR_IMAGE"
|
|
997
1013
|
width="246"
|
|
998
1014
|
height="178"
|
|
999
1015
|
/>
|
|
@@ -1015,14 +1031,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
1015
1031
|
args: [{ selector: 'lib-vc-error-server-error', template: `
|
|
1016
1032
|
<div class="errorPage">
|
|
1017
1033
|
<div class="errorPage-top">
|
|
1018
|
-
<img
|
|
1034
|
+
<img
|
|
1035
|
+
[src]="VcomplyLogo"
|
|
1036
|
+
[alt]="altImageText.VCOMPLY_LOGO"
|
|
1037
|
+
width="24"
|
|
1038
|
+
height="24"
|
|
1039
|
+
/>
|
|
1019
1040
|
</div>
|
|
1020
1041
|
<div class="errorPage-container">
|
|
1021
1042
|
<div class="errorPage-inner">
|
|
1022
1043
|
<div class="errorPage-inner-image">
|
|
1023
1044
|
<img
|
|
1024
1045
|
[src]="errorConfig.imageUrl"
|
|
1025
|
-
alt="
|
|
1046
|
+
[alt]="altImageText.ERROR_IMAGE"
|
|
1026
1047
|
width="246"
|
|
1027
1048
|
height="178"
|
|
1028
1049
|
/>
|
|
@@ -1074,17 +1095,14 @@ class VcErrorHandlersComponent {
|
|
|
1074
1095
|
});
|
|
1075
1096
|
}
|
|
1076
1097
|
handleError(error) {
|
|
1077
|
-
|
|
1078
|
-
this.sessionExpired = true
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
}
|
|
1086
|
-
else if (error.status === ErrorStatusCode.NetworkUnavailable) {
|
|
1087
|
-
this.handleNetworkError();
|
|
1098
|
+
const errorHandlers = {
|
|
1099
|
+
[ErrorStatusCode.Unauthenticated]: () => (this.sessionExpired = true),
|
|
1100
|
+
[ErrorStatusCode.UnauthorizedAccess]: () => (this.unauthorized = true),
|
|
1101
|
+
[ErrorStatusCode.JSChunkUnavailable]: () => (this.chunkUnavailable = true),
|
|
1102
|
+
[ErrorStatusCode.NetworkUnavailable]: () => this.handleNetworkError(),
|
|
1103
|
+
};
|
|
1104
|
+
if (errorHandlers[error.status]) {
|
|
1105
|
+
errorHandlers[error.status]();
|
|
1088
1106
|
}
|
|
1089
1107
|
else if (this.errorService.isServerError(error)) {
|
|
1090
1108
|
this.serverError = true;
|
|
@@ -1137,28 +1155,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
1137
1155
|
}], ctorParameters: function () { return [{ type: GlobalErrorService }, { type: SnackBarService }]; } });
|
|
1138
1156
|
|
|
1139
1157
|
class PageNotFoundComponent {
|
|
1140
|
-
constructor(
|
|
1141
|
-
this.router = router;
|
|
1158
|
+
constructor() {
|
|
1142
1159
|
this.errorConfig = ERROR_CONFIG.PAGE_NOT_FOUND;
|
|
1143
1160
|
this.VcomplyLogo = VCOMPLY_LOGO_URL;
|
|
1161
|
+
this.altImageText = ALT_IMAGE_TEXT;
|
|
1144
1162
|
this.currentYear = new Date().getFullYear();
|
|
1163
|
+
this.redirectionUrl = REDIRECTION_URL;
|
|
1164
|
+
this.organisationName = ORGANISATION_NAME;
|
|
1145
1165
|
}
|
|
1146
1166
|
redirectToHome() {
|
|
1147
|
-
window.location.replace(
|
|
1167
|
+
window.location.replace(this.redirectionUrl.compliance_dashboard);
|
|
1148
1168
|
}
|
|
1149
1169
|
}
|
|
1150
|
-
PageNotFoundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PageNotFoundComponent, deps: [
|
|
1170
|
+
PageNotFoundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PageNotFoundComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1151
1171
|
PageNotFoundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: PageNotFoundComponent, selector: "lib-vc-error-page-not-found", ngImport: i0, template: `
|
|
1152
1172
|
<div class="errorPage">
|
|
1153
1173
|
<div class="errorPage-top">
|
|
1154
|
-
<img
|
|
1174
|
+
<img
|
|
1175
|
+
[src]="VcomplyLogo"
|
|
1176
|
+
[alt]="altImageText.VCOMPLY_LOGO"
|
|
1177
|
+
width="24"
|
|
1178
|
+
height="24"
|
|
1179
|
+
/>
|
|
1155
1180
|
</div>
|
|
1156
1181
|
<div class="errorPage-container">
|
|
1157
1182
|
<div class="errorPage-inner">
|
|
1158
1183
|
<div class="errorPage-inner-image">
|
|
1159
1184
|
<img
|
|
1160
1185
|
[src]="errorConfig.imageUrl"
|
|
1161
|
-
alt="
|
|
1186
|
+
[alt]="altImageText.ERROR_IMAGE"
|
|
1162
1187
|
width="246"
|
|
1163
1188
|
height="178"
|
|
1164
1189
|
/>
|
|
@@ -1173,7 +1198,7 @@ PageNotFoundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
|
|
|
1173
1198
|
</div>
|
|
1174
1199
|
</div>
|
|
1175
1200
|
<div class="errorPage-copyright">
|
|
1176
|
-
© {{ currentYear }},
|
|
1201
|
+
© {{ currentYear }}, {{ organisationName }}
|
|
1177
1202
|
</div>
|
|
1178
1203
|
</div>
|
|
1179
1204
|
</div>
|
|
@@ -1183,14 +1208,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
1183
1208
|
args: [{ selector: 'lib-vc-error-page-not-found', template: `
|
|
1184
1209
|
<div class="errorPage">
|
|
1185
1210
|
<div class="errorPage-top">
|
|
1186
|
-
<img
|
|
1211
|
+
<img
|
|
1212
|
+
[src]="VcomplyLogo"
|
|
1213
|
+
[alt]="altImageText.VCOMPLY_LOGO"
|
|
1214
|
+
width="24"
|
|
1215
|
+
height="24"
|
|
1216
|
+
/>
|
|
1187
1217
|
</div>
|
|
1188
1218
|
<div class="errorPage-container">
|
|
1189
1219
|
<div class="errorPage-inner">
|
|
1190
1220
|
<div class="errorPage-inner-image">
|
|
1191
1221
|
<img
|
|
1192
1222
|
[src]="errorConfig.imageUrl"
|
|
1193
|
-
alt="
|
|
1223
|
+
[alt]="altImageText.ERROR_IMAGE"
|
|
1194
1224
|
width="246"
|
|
1195
1225
|
height="178"
|
|
1196
1226
|
/>
|
|
@@ -1205,16 +1235,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
1205
1235
|
</div>
|
|
1206
1236
|
</div>
|
|
1207
1237
|
<div class="errorPage-copyright">
|
|
1208
|
-
© {{ currentYear }},
|
|
1238
|
+
© {{ currentYear }}, {{ organisationName }}
|
|
1209
1239
|
</div>
|
|
1210
1240
|
</div>
|
|
1211
1241
|
</div>
|
|
1212
1242
|
`, styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";.errorPage{background:#161b2f;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:9999}.errorPage-top{width:100%;height:3rem;display:flex;align-items:center;padding-left:.75rem}.errorPage-container{background:#f2f2f5;border-radius:.75rem;border:1px solid #e3e3e9;box-shadow:0 4px 8px #1d5dd31a;height:calc(100vh - 3.75rem);display:flex;align-items:center;justify-content:center;padding:0 4rem;margin:0 .75rem;position:relative}.errorPage-inner{display:flex;align-items:center}.errorPage-inner-image{width:16rem}.errorPage-inner-right{margin-left:2rem;width:calc(100% - 18rem)}.errorPage-inner-right .errorPage-heading{-webkit-text-fill-color:#e3e3e9;-webkit-text-stroke-color:#a9aab6;-webkit-text-stroke-width:1px;color:#e3e3e9;font-size:78px;font-weight:bold;line-height:110px;margin-bottom:1.5rem}.errorPage-inner-right .errorPage-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.errorPage-inner-right .errorPage-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:1.75rem}.errorPage-inner-right .errorPage-btn{background:#1e5dd3;border-radius:.25rem;border:none;color:#fff;display:inline-flex;align-items:center;font-size:11px;font-weight:500;line-height:2rem;padding:0 1rem}.errorPage-inner-right .errorPage-btn i{font-size:14px;margin-left:.25rem}.errorPage-copyright{font-size:11px;color:#787a8c;font-weight:500;position:absolute;bottom:8px;right:16px;line-height:16px}\n"] }]
|
|
1213
|
-
}]
|
|
1243
|
+
}] });
|
|
1214
1244
|
|
|
1215
1245
|
class ComponentLevelServerErrorComponent {
|
|
1216
1246
|
constructor() {
|
|
1217
1247
|
this.errorConfig = ERROR_CONFIG.COMPONENT_LEVEL_SERVER_ERROR;
|
|
1248
|
+
this.altImageText = ALT_IMAGE_TEXT;
|
|
1218
1249
|
this.VcomplyLogo = VCOMPLY_LOGO_URL;
|
|
1219
1250
|
this.onClick = new EventEmitter();
|
|
1220
1251
|
}
|
|
@@ -1226,7 +1257,7 @@ ComponentLevelServerErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersio
|
|
|
1226
1257
|
<div class="serverError-inner-image">
|
|
1227
1258
|
<img
|
|
1228
1259
|
[src]="errorConfig.imageUrl"
|
|
1229
|
-
alt="
|
|
1260
|
+
[alt]="altImageText.ERROR_IMAGE"
|
|
1230
1261
|
width="106"
|
|
1231
1262
|
height="76"
|
|
1232
1263
|
/>
|
|
@@ -1251,7 +1282,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
1251
1282
|
<div class="serverError-inner-image">
|
|
1252
1283
|
<img
|
|
1253
1284
|
[src]="errorConfig.imageUrl"
|
|
1254
|
-
alt="
|
|
1285
|
+
[alt]="altImageText.ERROR_IMAGE"
|
|
1255
1286
|
width="106"
|
|
1256
1287
|
height="76"
|
|
1257
1288
|
/>
|
|
@@ -1521,15 +1552,13 @@ class SentryErrorHandler {
|
|
|
1521
1552
|
}
|
|
1522
1553
|
handleError(error) {
|
|
1523
1554
|
const ERROR = error?.originalError || error;
|
|
1524
|
-
this.
|
|
1555
|
+
this.handleChunkError(ERROR);
|
|
1525
1556
|
Sentry.captureException(ERROR);
|
|
1526
1557
|
}
|
|
1527
|
-
|
|
1528
|
-
const
|
|
1529
|
-
if (
|
|
1530
|
-
|
|
1531
|
-
status: ErrorStatusCode.JSChunkUnavailable,
|
|
1532
|
-
});
|
|
1558
|
+
handleChunkError(error) {
|
|
1559
|
+
const chunkFailedMessage = /Loading chunk [\d]+ failed/;
|
|
1560
|
+
if (chunkFailedMessage.test(error?.message)) {
|
|
1561
|
+
window.location.reload();
|
|
1533
1562
|
}
|
|
1534
1563
|
}
|
|
1535
1564
|
}
|
|
@@ -1547,7 +1576,7 @@ class HttpReqInterceptor {
|
|
|
1547
1576
|
this.featureFlagService = featureFlagService;
|
|
1548
1577
|
}
|
|
1549
1578
|
intercept(req, next) {
|
|
1550
|
-
if (this.featureFlagService.isFeatureEnabled(
|
|
1579
|
+
if (this.featureFlagService.isFeatureEnabled(ERROR_FEATURE_FLAG)) {
|
|
1551
1580
|
return next.handle(req).pipe(timeout(API_TIMEOUT_TIME), tap((event) => {
|
|
1552
1581
|
if (event instanceof HttpResponse) {
|
|
1553
1582
|
this.errorService.handleSoftErrors(event);
|
|
@@ -1641,5 +1670,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
1641
1670
|
* Generated bundle index. Do not edit.
|
|
1642
1671
|
*/
|
|
1643
1672
|
|
|
1644
|
-
export {
|
|
1673
|
+
export { ChunkUnavailableComponent, ComponentLevelServerErrorComponent, ErrorModalComponent, FOR_ROOT_SENTRY_OPTIONS_TOKEN, GlobalErrorService, HttpReqInterceptor, PageNotFoundComponent, RouterService, ServerErrorComponent, SessionExpiredComponent, UnauthorizedComponent, VcErrorHandlersComponent, VcErrorHandlersModule, VcErrorHandlersService };
|
|
1645
1674
|
//# sourceMappingURL=vc-error-handlers.mjs.map
|