vc-error-handlers 0.1.2 → 0.1.4

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 (57) hide show
  1. package/esm2020/lib/shared/components/chunk-unavailable/chunk-unavailable.component.mjs +14 -0
  2. package/esm2020/lib/shared/components/page-not-found/page-not-found.component.mjs +81 -0
  3. package/esm2020/lib/shared/components/server-error/server-error.component.mjs +14 -0
  4. package/esm2020/lib/shared/components/session-expired/session-expired.component.mjs +25 -0
  5. package/esm2020/lib/shared/components/session-expired-modal/session-expired-modal.component.mjs +54 -0
  6. package/esm2020/lib/shared/components/unauthorized/unauthorized.component.mjs +77 -0
  7. package/esm2020/lib/shared/constants/error-handling.constants.mjs +27 -0
  8. package/esm2020/lib/shared/errorhandler/sentry-error.handler.mjs +8 -5
  9. package/esm2020/lib/shared/interceptors/http.interceptor.mjs +31 -0
  10. package/esm2020/lib/shared/services/auth.service.mjs +20 -0
  11. package/esm2020/lib/shared/services/global-error.service.mjs +27 -0
  12. package/esm2020/lib/shared/services/router.service.mjs +19 -0
  13. package/esm2020/lib/shared/types/global-error.types.mjs +19 -0
  14. package/esm2020/lib/ui-kit/dialog/dialog-config.mjs +3 -0
  15. package/esm2020/lib/ui-kit/dialog/dialog-injector.mjs +15 -0
  16. package/esm2020/lib/ui-kit/dialog/dialog-ref.mjs +13 -0
  17. package/esm2020/lib/ui-kit/dialog/dialog.component.mjs +85 -0
  18. package/esm2020/lib/ui-kit/dialog/dialog.module.mjs +21 -0
  19. package/esm2020/lib/ui-kit/dialog/dialog.service.mjs +52 -0
  20. package/esm2020/lib/ui-kit/dialog/insertion.directive.mjs +16 -0
  21. package/esm2020/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.mjs +51 -0
  22. package/esm2020/lib/ui-kit/snack-bar/snack-bar.module.mjs +18 -0
  23. package/esm2020/lib/ui-kit/snack-bar/snack-bar.service.mjs +32 -0
  24. package/esm2020/lib/vc-error-handlers.component.mjs +33 -13
  25. package/esm2020/lib/vc-error-handlers.module.mjs +52 -7
  26. package/esm2020/public-api.mjs +11 -1
  27. package/fesm2015/vc-error-handlers.mjs +724 -22
  28. package/fesm2015/vc-error-handlers.mjs.map +1 -1
  29. package/fesm2020/vc-error-handlers.mjs +724 -22
  30. package/fesm2020/vc-error-handlers.mjs.map +1 -1
  31. package/lib/shared/components/chunk-unavailable/chunk-unavailable.component.d.ts +8 -0
  32. package/lib/shared/components/page-not-found/page-not-found.component.d.ts +14 -0
  33. package/lib/shared/components/server-error/server-error.component.d.ts +8 -0
  34. package/lib/shared/components/session-expired/session-expired.component.d.ts +15 -0
  35. package/lib/shared/components/session-expired-modal/session-expired-modal.component.d.ts +22 -0
  36. package/lib/shared/components/unauthorized/unauthorized.component.d.ts +16 -0
  37. package/lib/shared/constants/error-handling.constants.d.ts +26 -0
  38. package/lib/shared/errorhandler/sentry-error.handler.d.ts +4 -2
  39. package/lib/shared/interceptors/http.interceptor.d.ts +14 -0
  40. package/lib/shared/services/auth.service.d.ts +9 -0
  41. package/lib/shared/services/global-error.service.d.ts +12 -0
  42. package/lib/shared/services/router.service.d.ts +6 -0
  43. package/lib/shared/types/global-error.types.d.ts +19 -0
  44. package/lib/ui-kit/dialog/dialog-config.d.ts +6 -0
  45. package/lib/ui-kit/dialog/dialog-injector.d.ts +7 -0
  46. package/lib/ui-kit/dialog/dialog-ref.d.ts +7 -0
  47. package/lib/ui-kit/dialog/dialog.component.d.ts +33 -0
  48. package/lib/ui-kit/dialog/dialog.module.d.ts +9 -0
  49. package/lib/ui-kit/dialog/dialog.service.d.ts +17 -0
  50. package/lib/ui-kit/dialog/insertion.directive.d.ts +8 -0
  51. package/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.d.ts +20 -0
  52. package/lib/ui-kit/snack-bar/snack-bar.module.d.ts +8 -0
  53. package/lib/ui-kit/snack-bar/snack-bar.service.d.ts +11 -0
  54. package/lib/vc-error-handlers.component.d.ts +10 -4
  55. package/lib/vc-error-handlers.module.d.ts +9 -1
  56. package/package.json +2 -2
  57. package/public-api.d.ts +10 -0
@@ -1,6 +1,14 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Component, Optional, InjectionToken, ErrorHandler, NgModule } from '@angular/core';
2
+ import { Injectable, Component, Directive, ViewChild, NgModule, Optional, InjectionToken, ErrorHandler } from '@angular/core';
3
+ import { Subject, throwError } from 'rxjs';
4
+ import * as i1 from '@vcomply/authorizer';
5
+ import * as i4 from '@angular/common';
6
+ import { CommonModule } from '@angular/common';
7
+ import * as i3 from '@angular/router';
8
+ import { NavigationStart, NavigationEnd, NavigationError } from '@angular/router';
9
+ import { HTTP_INTERCEPTORS } from '@angular/common/http';
3
10
  import * as Sentry from '@sentry/angular-ivy';
11
+ import { timeout, retry, catchError } from 'rxjs/operators';
4
12
 
5
13
  class VcErrorHandlersService {
6
14
  constructor() { }
@@ -14,30 +22,662 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
14
22
  }]
15
23
  }], ctorParameters: function () { return []; } });
16
24
 
17
- class VcErrorHandlersComponent {
18
- constructor() { }
25
+ var ErrorStatusCode;
26
+ (function (ErrorStatusCode) {
27
+ ErrorStatusCode[ErrorStatusCode["URLNotFound"] = 404] = "URLNotFound";
28
+ ErrorStatusCode[ErrorStatusCode["UnauthorizedAccess"] = 403] = "UnauthorizedAccess";
29
+ ErrorStatusCode[ErrorStatusCode["RequestTimeout"] = 408] = "RequestTimeout";
30
+ ErrorStatusCode[ErrorStatusCode["Unauthenticated"] = 401] = "Unauthenticated";
31
+ // Server-side errors
32
+ ErrorStatusCode[ErrorStatusCode["InternalServerError"] = 500] = "InternalServerError";
33
+ ErrorStatusCode[ErrorStatusCode["ServiceUnavailable"] = 503] = "ServiceUnavailable";
34
+ ErrorStatusCode[ErrorStatusCode["NetworkError"] = 502] = "NetworkError";
35
+ // Network unavailability/offline case
36
+ ErrorStatusCode[ErrorStatusCode["NetworkUnavailable"] = 0] = "NetworkUnavailable";
37
+ // Application-specific errors
38
+ ErrorStatusCode[ErrorStatusCode["JSChunkUnavailable"] = 600] = "JSChunkUnavailable";
39
+ ErrorStatusCode[ErrorStatusCode["SoftError"] = 601] = "SoftError";
40
+ ErrorStatusCode[ErrorStatusCode["NotFoundError"] = 602] = "NotFoundError";
41
+ ErrorStatusCode[ErrorStatusCode["includes"] = 603] = "includes";
42
+ })(ErrorStatusCode || (ErrorStatusCode = {}));
43
+
44
+ class GlobalErrorService {
45
+ constructor() {
46
+ this.errorCodes = ErrorStatusCode;
47
+ this.globalError$ = new Subject();
48
+ this.localError$ = new Subject();
49
+ }
50
+ handleError(error, request) {
51
+ if (this.errorCodes.Unauthenticated ||
52
+ this.errorCodes.UnauthorizedAccess ||
53
+ this.errorCodes.NetworkUnavailable) {
54
+ this.globalError$.next(error);
55
+ }
56
+ }
57
+ }
58
+ GlobalErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GlobalErrorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
59
+ GlobalErrorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GlobalErrorService, providedIn: 'root' });
60
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GlobalErrorService, decorators: [{
61
+ type: Injectable,
62
+ args: [{
63
+ providedIn: 'root',
64
+ }]
65
+ }] });
66
+
67
+ class AuthService {
68
+ constructor(authorizer) {
69
+ this.authorizer = authorizer;
70
+ }
71
+ logoutUser() {
72
+ this.authorizer.logout();
73
+ }
74
+ }
75
+ AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AuthService, deps: [{ token: i1.AuthorizerService }], target: i0.ɵɵFactoryTarget.Injectable });
76
+ AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AuthService, providedIn: "root" });
77
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: AuthService, decorators: [{
78
+ type: Injectable,
79
+ args: [{
80
+ providedIn: "root",
81
+ }]
82
+ }], ctorParameters: function () { return [{ type: i1.AuthorizerService }]; } });
83
+
84
+ class RouterService {
85
+ redirectToLogin() {
86
+ window.location.href =
87
+ `https://${window.location.host}/` +
88
+ 'signin?redirectURL=' +
89
+ encodeURIComponent(window.location.href);
90
+ }
91
+ }
92
+ RouterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: RouterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
93
+ RouterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: RouterService, providedIn: 'root' });
94
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: RouterService, decorators: [{
95
+ type: Injectable,
96
+ args: [{
97
+ providedIn: 'root',
98
+ }]
99
+ }] });
100
+
101
+ const VCOMPLY_IMAGE_URL = 'https://cdn.v-comply.com/logo/prod/v-logo.svg';
102
+ const API_TIMEOUT_TIME = 1000 * 15;
103
+ const API_RETRY_COUNT = 2;
104
+ const ERROR_CONFIG = {
105
+ PAGE_NOT_FOUND: {
106
+ imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
107
+ title: 'Oops!',
108
+ description: "The page you're looking for doesn't exist.",
109
+ details: 'Please check the URL or return to the homepage.',
110
+ buttonText: 'GO TO DASHBOARD',
111
+ },
112
+ UNAUTHORIZED: {
113
+ imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
114
+ title: 'Oops!',
115
+ description: "You don't have permission to access this page.",
116
+ details: 'If you believe this is an error, please contact',
117
+ email: 'help@v-comply.com',
118
+ support: 'for support',
119
+ buttonText: 'CONTACT SUPPORT',
120
+ },
121
+ SESSION_EXPIRED: {
122
+ heading: 'Session Expired!',
123
+ description: 'Your session has expired. Please log in again to continue using the app.',
124
+ buttonText: 'LOGIN',
125
+ },
126
+ };
127
+
128
+ class DialogConfig {
129
+ }
130
+
131
+ class SessionExpiredModalComponent {
132
+ constructor(dialogConfig, authService, routerService) {
133
+ this.dialogConfig = dialogConfig;
134
+ this.authService = authService;
135
+ this.routerService = routerService;
136
+ this.errorConfig = ERROR_CONFIG.SESSION_EXPIRED;
137
+ this.animation = false;
138
+ this.data = {
139
+ header: 'Message',
140
+ description: 'Description',
141
+ buttonText: 'Click Action',
142
+ };
143
+ this.data = this.dialogConfig.data;
144
+ }
145
+ ngOnInit() {
146
+ this.animation = true;
147
+ setTimeout(() => {
148
+ this.animation = false;
149
+ }, 300);
150
+ }
151
+ onContinueAction() {
152
+ this.authService.logoutUser();
153
+ this.routerService.redirectToLogin();
154
+ }
155
+ }
156
+ SessionExpiredModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SessionExpiredModalComponent, deps: [{ token: DialogConfig }, { token: AuthService }, { token: RouterService }], target: i0.ɵɵFactoryTarget.Component });
157
+ SessionExpiredModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: SessionExpiredModalComponent, selector: "lib-session-expired-modal", ngImport: i0, template: ` <div class="error-dialog-box">
158
+ <div class="error-dialog-box-top">{{ errorConfig.heading }}</div>
159
+ <div class="error-dialog-box-mid">
160
+ {{ errorConfig.description }}
161
+ </div>
162
+ <div class="error-dialog-box-bottom">
163
+ <button class="logIn-btn">{{ errorConfig.buttonText }}</button>
164
+ </div>
165
+ </div>`, isInline: true, 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"] });
166
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SessionExpiredModalComponent, decorators: [{
167
+ type: Component,
168
+ args: [{ selector: 'lib-session-expired-modal', template: ` <div class="error-dialog-box">
169
+ <div class="error-dialog-box-top">{{ errorConfig.heading }}</div>
170
+ <div class="error-dialog-box-mid">
171
+ {{ errorConfig.description }}
172
+ </div>
173
+ <div class="error-dialog-box-bottom">
174
+ <button class="logIn-btn">{{ errorConfig.buttonText }}</button>
175
+ </div>
176
+ </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"] }]
177
+ }], ctorParameters: function () { return [{ type: DialogConfig }, { type: AuthService }, { type: RouterService }]; } });
178
+
179
+ class InsertionDirective {
180
+ constructor(viewContainerRef) {
181
+ this.viewContainerRef = viewContainerRef;
182
+ }
183
+ }
184
+ InsertionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: InsertionDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
185
+ InsertionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: InsertionDirective, selector: "[appInsertion]", ngImport: i0 });
186
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: InsertionDirective, decorators: [{
187
+ type: Directive,
188
+ args: [{
189
+ selector: '[appInsertion]',
190
+ }]
191
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
192
+
193
+ class DialogRef {
194
+ constructor() {
195
+ this.afterDialogClosed = new Subject();
196
+ this.afterClosed = this.afterDialogClosed.asObservable();
197
+ }
198
+ close(result) {
199
+ // debugger
200
+ this.afterDialogClosed.next(result);
201
+ document.body.style.overflow = 'auto';
202
+ }
203
+ }
204
+
205
+ class DialogComponent {
206
+ constructor(componentFactoryResolver, cd, dialogRef, config, router) {
207
+ this.componentFactoryResolver = componentFactoryResolver;
208
+ this.cd = cd;
209
+ this.dialogRef = dialogRef;
210
+ this.config = config;
211
+ this.router = router;
212
+ this.animation = true;
213
+ this.onDialogClose = new Subject();
214
+ this.onClose = this.onDialogClose.asObservable();
215
+ // this.componentRef = this.componentRef;
216
+ // this.animate = this.animate;
217
+ // this.insertionPoint = this.insertionPoint;
218
+ // this.childComponentType = this.childComponentType;
219
+ }
19
220
  ngOnInit() {
221
+ this.position = this.config.position;
222
+ this.background = this.config.background;
223
+ document.body.style.overflow = 'hidden';
224
+ setTimeout(() => {
225
+ this.animation = false;
226
+ }, 200);
227
+ this.routeAction();
228
+ }
229
+ routeAction() {
230
+ this.router.events.subscribe((event) => {
231
+ if (event instanceof NavigationStart) {
232
+ // Show loading indicator
233
+ }
234
+ if (event instanceof NavigationEnd) {
235
+ // Hide loading indicator
236
+ this.dialogRef.close();
237
+ }
238
+ if (event instanceof NavigationError) {
239
+ // Hide loading indicator
240
+ // Present error to user
241
+ }
242
+ });
243
+ }
244
+ ngAfterViewInit() {
245
+ this.loadChildComponent(this.childComponentType);
246
+ this.cd.detectChanges();
247
+ }
248
+ onOverlayClicked(evt) {
249
+ // this.dialogRef.close();
250
+ }
251
+ onDialogClicked(evt) {
252
+ evt.stopPropagation();
253
+ }
254
+ loadChildComponent(componentType) {
255
+ const componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentType);
256
+ const viewContainerRef = this.insertionPoint.viewContainerRef;
257
+ viewContainerRef.clear();
258
+ this.componentRef = viewContainerRef.createComponent(componentFactory);
259
+ }
260
+ ngOnDestroy() {
261
+ if (this.componentRef) {
262
+ this.componentRef.destroy();
263
+ }
264
+ }
265
+ close(data) {
266
+ this.onDialogClose.next(data);
267
+ document.body.style.overflow = 'auto';
20
268
  }
21
269
  }
22
- VcErrorHandlersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
270
+ DialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogComponent, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ChangeDetectorRef }, { token: DialogRef }, { token: DialogConfig }, { token: i3.Router }], target: i0.ɵɵFactoryTarget.Component });
271
+ DialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: DialogComponent, selector: "app-dialog", viewQueries: [{ propertyName: "insertionPoint", first: true, predicate: InsertionDirective, descendants: true, static: true }], ngImport: i0, template: "<div\r\n class=\"overlay\"\r\n (click)=\"onOverlayClicked($event)\"\r\n [ngClass]=\"{\r\n top: position === 'TOP',\r\n right: position === 'RIGHT',\r\n bottom: position === 'BOTTOM',\r\n left: position === 'LEFT',\r\n center: position === 'CENTER',\r\n black: background === 'black',\r\n whiteBlur: background === 'whiteBlur'\r\n }\" [class.pointer-none]=\"pointer === 'none'\"\r\n>\r\n <div\r\n class=\"dialog\"\r\n [class.animate]=\"animation\"\r\n (click)=\"onDialogClicked($event)\"\r\n [ngClass]=\"{\r\n top: position === 'TOP',\r\n right: position === 'RIGHT',\r\n bottom: position === 'BOTTOM',\r\n left: position === 'LEFT',\r\n center: position === 'CENTER'\r\n }\"\r\n >\r\n <ng-template appInsertion></ng-template>\r\n </div>\r\n</div>\r\n", styles: [".overlay{display:flex;position:fixed;top:0;bottom:0;left:0;right:0;align-items:center;justify-content:center;z-index:2147483009!important}.overlay.low{z-index:1}.overlay.black{background:#161b2fcc}.overlay.whiteBlur{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.overlay.top{align-items:flex-start}.overlay.right{justify-content:flex-end}.overlay.bottom{align-items:flex-end}.overlay.left{justify-content:flex-start}.dialog{position:relative}.dialog.animate.top{animation:animate-top .2s cubic-bezier(.25,.46,.45,.94) both}@keyframes animate-top{0%{transform:translateY(-100px)}to{transform:translateY(0)}}.dialog.animate.right{animation:animate-right .2s cubic-bezier(.25,.46,.45,.94) both}@keyframes animate-right{0%{transform:translate(100%)}to{transform:translate(0)}}.pointer-none{pointer-events:none}\n"], directives: [{ type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: InsertionDirective, selector: "[appInsertion]" }] });
272
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogComponent, decorators: [{
273
+ type: Component,
274
+ args: [{ selector: 'app-dialog', template: "<div\r\n class=\"overlay\"\r\n (click)=\"onOverlayClicked($event)\"\r\n [ngClass]=\"{\r\n top: position === 'TOP',\r\n right: position === 'RIGHT',\r\n bottom: position === 'BOTTOM',\r\n left: position === 'LEFT',\r\n center: position === 'CENTER',\r\n black: background === 'black',\r\n whiteBlur: background === 'whiteBlur'\r\n }\" [class.pointer-none]=\"pointer === 'none'\"\r\n>\r\n <div\r\n class=\"dialog\"\r\n [class.animate]=\"animation\"\r\n (click)=\"onDialogClicked($event)\"\r\n [ngClass]=\"{\r\n top: position === 'TOP',\r\n right: position === 'RIGHT',\r\n bottom: position === 'BOTTOM',\r\n left: position === 'LEFT',\r\n center: position === 'CENTER'\r\n }\"\r\n >\r\n <ng-template appInsertion></ng-template>\r\n </div>\r\n</div>\r\n", styles: [".overlay{display:flex;position:fixed;top:0;bottom:0;left:0;right:0;align-items:center;justify-content:center;z-index:2147483009!important}.overlay.low{z-index:1}.overlay.black{background:#161b2fcc}.overlay.whiteBlur{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.overlay.top{align-items:flex-start}.overlay.right{justify-content:flex-end}.overlay.bottom{align-items:flex-end}.overlay.left{justify-content:flex-start}.dialog{position:relative}.dialog.animate.top{animation:animate-top .2s cubic-bezier(.25,.46,.45,.94) both}@keyframes animate-top{0%{transform:translateY(-100px)}to{transform:translateY(0)}}.dialog.animate.right{animation:animate-right .2s cubic-bezier(.25,.46,.45,.94) both}@keyframes animate-right{0%{transform:translate(100%)}to{transform:translate(0)}}.pointer-none{pointer-events:none}\n"] }]
275
+ }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.ChangeDetectorRef }, { type: DialogRef }, { type: DialogConfig }, { type: i3.Router }]; }, propDecorators: { insertionPoint: [{
276
+ type: ViewChild,
277
+ args: [InsertionDirective, { static: true }]
278
+ }] } });
279
+
280
+ class DialogModule {
281
+ }
282
+ DialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
283
+ DialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogModule, declarations: [DialogComponent, InsertionDirective], imports: [CommonModule], exports: [DialogComponent] });
284
+ DialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogModule, providers: [DialogRef], imports: [[CommonModule]] });
285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogModule, decorators: [{
286
+ type: NgModule,
287
+ args: [{
288
+ imports: [CommonModule],
289
+ declarations: [DialogComponent, InsertionDirective],
290
+ providers: [DialogRef],
291
+ exports: [DialogComponent]
292
+ }]
293
+ }] });
294
+
295
+ class DialogInjector {
296
+ constructor(parentDialogInjector, dialogAdditionalTokens) {
297
+ this.parentDialogInjector = parentDialogInjector;
298
+ this.dialogAdditionalTokens = dialogAdditionalTokens;
299
+ }
300
+ // get(token: any, notFoundValue?: any){return; }
301
+ get(token, notFoundValue, flags) {
302
+ const value = this.dialogAdditionalTokens.get(token);
303
+ if (value) {
304
+ return value;
305
+ }
306
+ return this.parentDialogInjector.get(token, notFoundValue);
307
+ }
308
+ }
309
+
310
+ class DialogService {
311
+ constructor(componentFactoryResolver, appRef, injector) {
312
+ this.componentFactoryResolver = componentFactoryResolver;
313
+ this.appRef = appRef;
314
+ this.injector = injector;
315
+ }
316
+ open(componentType, config) {
317
+ const dialogRef = this.appendDialogComponentToBody(config);
318
+ this.dialogComponentRef.instance.childComponentType = componentType;
319
+ return dialogRef;
320
+ }
321
+ appendDialogComponentToBody(config) {
322
+ const map = new WeakMap();
323
+ map.set(DialogConfig, config);
324
+ const dialogRef = new DialogRef();
325
+ map.set(DialogRef, dialogRef);
326
+ const sub = dialogRef.afterClosed.subscribe(() => {
327
+ this.removeDialogComponentFromBody();
328
+ sub.unsubscribe();
329
+ });
330
+ const componentFactory = this.componentFactoryResolver.resolveComponentFactory(DialogComponent);
331
+ const componentRef = componentFactory.create(new DialogInjector(this.injector, map));
332
+ this.appRef.attachView(componentRef.hostView);
333
+ const domElem = componentRef.hostView.rootNodes[0];
334
+ document.body.appendChild(domElem);
335
+ this.dialogComponentRef = componentRef;
336
+ this.dialogComponentRef.instance.onClose.subscribe(() => {
337
+ this.removeDialogComponentFromBody();
338
+ });
339
+ return dialogRef;
340
+ }
341
+ removeDialogComponentFromBody() {
342
+ this.appRef.detachView(this.dialogComponentRef.hostView);
343
+ this.dialogComponentRef.destroy();
344
+ }
345
+ }
346
+ DialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogService, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ApplicationRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
347
+ DialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogService, providedIn: DialogModule });
348
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogService, decorators: [{
349
+ type: Injectable,
350
+ args: [{
351
+ providedIn: DialogModule,
352
+ }]
353
+ }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.ApplicationRef }, { type: i0.Injector }]; } });
354
+
355
+ class SessionExpiredComponent {
356
+ constructor(dialogService) {
357
+ this.dialogService = dialogService;
358
+ this.errorConfig = ERROR_CONFIG.SESSION_EXPIRED;
359
+ }
360
+ ngOnInit() {
361
+ this.dialogService.open(SessionExpiredModalComponent, {
362
+ data: this.errorConfig,
363
+ position: 'center',
364
+ background: 'whiteBlur',
365
+ });
366
+ }
367
+ }
368
+ SessionExpiredComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SessionExpiredComponent, deps: [{ token: DialogService }], target: i0.ɵɵFactoryTarget.Component });
369
+ SessionExpiredComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: SessionExpiredComponent, selector: "lib-session-expired", ngImport: i0, template: ``, isInline: true });
370
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SessionExpiredComponent, decorators: [{
371
+ type: Component,
372
+ args: [{ selector: 'lib-session-expired', template: ``, styles: [] }]
373
+ }], ctorParameters: function () { return [{ type: DialogService }]; } });
374
+
375
+ class UnauthorizedComponent {
376
+ constructor() {
377
+ this.errorConfig = ERROR_CONFIG.UNAUTHORIZED;
378
+ this.VcomplyImage = VCOMPLY_IMAGE_URL;
379
+ }
380
+ redirectToSupport() { }
381
+ }
382
+ UnauthorizedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UnauthorizedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
383
+ UnauthorizedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: UnauthorizedComponent, selector: "lib-unauthorized", ngImport: i0, template: `
384
+ <div class="errorPage">
385
+ <div class="errorPage-top">
386
+ <img src="VcomplyImage" alt="VComply" width="24" height="24" />
387
+ </div>
388
+ <div class="errorPage-container">
389
+ <div class="errorPage-inner">
390
+ <div class="errorPage-inner-image">
391
+ <img
392
+ [src]="errorConfig.imageUrl"
393
+ alt="Error Image"
394
+ width="256"
395
+ height="256"
396
+ />
397
+ </div>
398
+ <div class="errorPage-inner-right">
399
+ <div class="errorPage-heading">{{ errorConfig.title }}</div>
400
+ <div class="errorPage-text">{{ errorConfig.description }}</div>
401
+ <div class="errorPage-details">
402
+ {{ errorConfig.details }}
403
+ <a href="mailto:{help@v-comply.com}">{{ errorConfig.email }}</a>
404
+ {{ errorConfig.support }}.
405
+ </div>
406
+ <button class="errorPage-btn" (click)="redirectToSupport()">
407
+ {{ errorConfig.buttonText }} <i class="icons">&#xe96a;</i>
408
+ </button>
409
+ </div>
410
+ </div>
411
+ </div>
412
+ </div>
413
+ `, isInline: true, 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}.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}\n"] });
414
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UnauthorizedComponent, decorators: [{
415
+ type: Component,
416
+ args: [{ selector: 'lib-unauthorized', template: `
417
+ <div class="errorPage">
418
+ <div class="errorPage-top">
419
+ <img src="VcomplyImage" alt="VComply" width="24" height="24" />
420
+ </div>
421
+ <div class="errorPage-container">
422
+ <div class="errorPage-inner">
423
+ <div class="errorPage-inner-image">
424
+ <img
425
+ [src]="errorConfig.imageUrl"
426
+ alt="Error Image"
427
+ width="256"
428
+ height="256"
429
+ />
430
+ </div>
431
+ <div class="errorPage-inner-right">
432
+ <div class="errorPage-heading">{{ errorConfig.title }}</div>
433
+ <div class="errorPage-text">{{ errorConfig.description }}</div>
434
+ <div class="errorPage-details">
435
+ {{ errorConfig.details }}
436
+ <a href="mailto:{help@v-comply.com}">{{ errorConfig.email }}</a>
437
+ {{ errorConfig.support }}.
438
+ </div>
439
+ <button class="errorPage-btn" (click)="redirectToSupport()">
440
+ {{ errorConfig.buttonText }} <i class="icons">&#xe96a;</i>
441
+ </button>
442
+ </div>
443
+ </div>
444
+ </div>
445
+ </div>
446
+ `, 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}.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}\n"] }]
447
+ }] });
448
+
449
+ class VcErrorHandlersComponent {
450
+ constructor(globalErrorService) {
451
+ this.globalErrorService = globalErrorService;
452
+ this.errorCodes = ErrorStatusCode;
453
+ this.unauthorized = false;
454
+ this.sessionExpired = false;
455
+ this.networkUnavailable = false;
456
+ this.globalErrorService.globalError$.subscribe((error) => {
457
+ this.handleError(error);
458
+ });
459
+ }
460
+ handleError(error) {
461
+ if (error.status === this.errorCodes.Unauthenticated) {
462
+ this.sessionExpired = true;
463
+ }
464
+ else if (error.status === this.errorCodes.UnauthorizedAccess) {
465
+ this.unauthorized = true;
466
+ }
467
+ else if (error.status === this.errorCodes.NetworkUnavailable) {
468
+ this.networkUnavailable = true;
469
+ }
470
+ }
471
+ }
472
+ VcErrorHandlersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersComponent, deps: [{ token: GlobalErrorService }], target: i0.ɵɵFactoryTarget.Component });
23
473
  VcErrorHandlersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: VcErrorHandlersComponent, selector: "lib-vc-error-handlers", ngImport: i0, template: `
24
- <p>
25
- vc-error-handlers works!
26
- </p>
27
- `, isInline: true });
474
+ <lib-session-expired *ngIf="sessionExpired"></lib-session-expired>
475
+ <lib-unauthorized *ngIf="unauthorized"></lib-unauthorized>
476
+ `, isInline: true, components: [{ type: SessionExpiredComponent, selector: "lib-session-expired" }, { type: UnauthorizedComponent, selector: "lib-unauthorized" }] });
28
477
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersComponent, decorators: [{
29
478
  type: Component,
30
479
  args: [{
31
480
  selector: 'lib-vc-error-handlers',
32
481
  template: `
33
- <p>
34
- vc-error-handlers works!
35
- </p>
482
+ <lib-session-expired *ngIf="sessionExpired"></lib-session-expired>
483
+ <lib-unauthorized *ngIf="unauthorized"></lib-unauthorized>
36
484
  `,
37
- styles: []
485
+ styles: [],
38
486
  }]
487
+ }], ctorParameters: function () { return [{ type: GlobalErrorService }]; } });
488
+
489
+ class PageNotFoundComponent {
490
+ constructor() {
491
+ this.errorConfig = ERROR_CONFIG.PAGE_NOT_FOUND;
492
+ this.VcomplyImage = VCOMPLY_IMAGE_URL;
493
+ }
494
+ redirectToHome() {
495
+ // Redirect to home page
496
+ }
497
+ }
498
+ PageNotFoundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PageNotFoundComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
499
+ PageNotFoundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: PageNotFoundComponent, selector: "lib-not-found", ngImport: i0, template: `
500
+ <div class="errorPage">
501
+ <div class="errorPage-top">
502
+ <img
503
+ src="VcomplyImage"
504
+ alt="VComply"
505
+ width="24"
506
+ height="24"
507
+ />
508
+ </div>
509
+ <div class="errorPage-container">
510
+ <div class="errorPage-inner">
511
+ <div class="errorPage-inner-image">
512
+ <img
513
+ [src]="errorConfig.imageUrl"
514
+ alt="Error Image"
515
+ width="256"
516
+ height="256"
517
+ />
518
+ </div>
519
+ <div class="errorPage-inner-right">
520
+ <div class="errorPage-heading">{{ errorConfig.title }}</div>
521
+ <div class="errorPage-text">{{ errorConfig.description }}</div>
522
+ <div class="errorPage-details">{{ errorConfig.details }}</div>
523
+ <button class="errorPage-btn" (click)="redirectToHome()">
524
+ {{ errorConfig.buttonText }} <i class="icons">&#xe96a;</i>
525
+ </button>
526
+ </div>
527
+ </div>
528
+ </div>
529
+ </div>
530
+ `, isInline: true, 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}.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}\n"] });
531
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PageNotFoundComponent, decorators: [{
532
+ type: Component,
533
+ args: [{ selector: 'lib-not-found', template: `
534
+ <div class="errorPage">
535
+ <div class="errorPage-top">
536
+ <img
537
+ src="VcomplyImage"
538
+ alt="VComply"
539
+ width="24"
540
+ height="24"
541
+ />
542
+ </div>
543
+ <div class="errorPage-container">
544
+ <div class="errorPage-inner">
545
+ <div class="errorPage-inner-image">
546
+ <img
547
+ [src]="errorConfig.imageUrl"
548
+ alt="Error Image"
549
+ width="256"
550
+ height="256"
551
+ />
552
+ </div>
553
+ <div class="errorPage-inner-right">
554
+ <div class="errorPage-heading">{{ errorConfig.title }}</div>
555
+ <div class="errorPage-text">{{ errorConfig.description }}</div>
556
+ <div class="errorPage-details">{{ errorConfig.details }}</div>
557
+ <button class="errorPage-btn" (click)="redirectToHome()">
558
+ {{ errorConfig.buttonText }} <i class="icons">&#xe96a;</i>
559
+ </button>
560
+ </div>
561
+ </div>
562
+ </div>
563
+ </div>
564
+ `, 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}.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}\n"] }]
565
+ }] });
566
+
567
+ class ChunkUnavailableComponent {
568
+ constructor() { }
569
+ ngOnInit() {
570
+ }
571
+ }
572
+ ChunkUnavailableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChunkUnavailableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
573
+ ChunkUnavailableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChunkUnavailableComponent, selector: "lib-chunk-unavailable", ngImport: i0, template: "<p>chunk-unavailable works!</p>\r\n", styles: [""] });
574
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChunkUnavailableComponent, decorators: [{
575
+ type: Component,
576
+ args: [{ selector: 'lib-chunk-unavailable', template: "<p>chunk-unavailable works!</p>\r\n", styles: [""] }]
39
577
  }], ctorParameters: function () { return []; } });
40
578
 
579
+ class ServerErrorComponent {
580
+ constructor() { }
581
+ ngOnInit() {
582
+ }
583
+ }
584
+ ServerErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ServerErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
585
+ ServerErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ServerErrorComponent, selector: "lib-server-error", ngImport: i0, template: "<p>server-error works!</p>\r\n", styles: [""] });
586
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ServerErrorComponent, decorators: [{
587
+ type: Component,
588
+ args: [{ selector: 'lib-server-error', template: "<p>server-error works!</p>\r\n", styles: [""] }]
589
+ }], ctorParameters: function () { return []; } });
590
+
591
+ class SnackBarService {
592
+ constructor() {
593
+ this.snackbarSubject = new Subject();
594
+ this.snackbarState = this.snackbarSubject.asObservable();
595
+ }
596
+ show(message, type) {
597
+ this.snackbarSubject.next({
598
+ show: true,
599
+ message,
600
+ icon: type,
601
+ });
602
+ }
603
+ hide() {
604
+ this.snackbarSubject.next({
605
+ show: false,
606
+ message: '',
607
+ icon: '',
608
+ });
609
+ }
610
+ }
611
+ SnackBarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
612
+ SnackBarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarService, providedIn: 'root' });
613
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarService, decorators: [{
614
+ type: Injectable,
615
+ args: [{
616
+ providedIn: 'root',
617
+ }]
618
+ }], ctorParameters: function () { return []; } });
619
+
620
+ class SnackBarComponent {
621
+ constructor(snackbarService) {
622
+ this.snackbarService = snackbarService;
623
+ this.show = false;
624
+ this.message = '--';
625
+ this.icon = '&#xe914;';
626
+ this.type = 'alert';
627
+ this.icons = {
628
+ success: '&#xe93d;',
629
+ warning: '&#xe914;',
630
+ info: '&#xe932;',
631
+ alert: '&#xe914;',
632
+ error: '&#xeaae;',
633
+ };
634
+ }
635
+ ngOnInit() {
636
+ this.snackbarSubscription = this.snackbarService.snackbarState.subscribe((state) => {
637
+ if (state.icon && Object.keys(this.icons).includes(state === null || state === void 0 ? void 0 : state.icon)) {
638
+ this.icon = this.icons[state.icon];
639
+ this.type = state === null || state === void 0 ? void 0 : state.icon;
640
+ }
641
+ this.message = state.message;
642
+ this.show = state.show;
643
+ this.setAutoClose();
644
+ });
645
+ }
646
+ setAutoClose() {
647
+ setTimeout(() => {
648
+ this.show = false;
649
+ this.close();
650
+ }, 3000);
651
+ }
652
+ close() {
653
+ this.show = false;
654
+ this.snackbarService.hide();
655
+ }
656
+ ngOnDestroy() {
657
+ this.snackbarSubscription.unsubscribe();
658
+ }
659
+ }
660
+ SnackBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarComponent, deps: [{ token: SnackBarService }], target: i0.ɵɵFactoryTarget.Component });
661
+ SnackBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: SnackBarComponent, selector: "app-snack-bar", ngImport: i0, template: "<div class=\"workflow-snackbar\" *ngIf=\"show\">\r\n <div class=\"workflow-snackbar-inner\">\r\n <div class=\"workflow-snackbarText\">\r\n <!-- &#xe914; -->\r\n <i class=\"icons\" [class]=\"type\" [innerHTML]=\"icon\"></i> <span [innerHTML]=\"message\">{{ message }}</span>\r\n </div>\r\n <button (click)=\"close()\">[ <span>Close</span> ]</button>\r\n </div>\r\n </div>", styles: ["::ng-deep .workflow-snackbar{position:fixed;top:20px;left:0;right:0;display:flex;align-items:center;justify-content:center;z-index:2147483647!important;pointer-events:none;animation:slide-top .3s cubic-bezier(.25,.46,.45,.94) both}::ng-deep .workflow-snackbar.white{background-color:#fff;color:#000;z-index:20}::ng-deep .workflow-snackbar.white button{color:#f6882f;font-size:11px;font-weight:400;pointer-events:all}::ng-deep .workflow-snackbar .workflow-snackbar-inner{display:flex;max-width:500px;min-width:450px;align-items:center;justify-content:space-between;padding:10px;background:#ffffff;border-radius:3px;box-shadow:0 0 10px #0003;min-height:55px;pointer-events:auto}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText{color:#161b2f;font-size:13px;display:flex;align-items:center;width:calc(100% - 70px)}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i{background:#f1f1f1;color:#d93b41;border-radius:50px;font-size:16px;width:30px;height:30px;text-align:center;line-height:28px;margin-right:10px;min-width:30px}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i.success{color:#34aa44}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i.warning{color:#f0b819}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i.info{color:#1e5dd3}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i.alert,::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i.error{color:#d93b41}::ng-deep .workflow-snackbar .workflow-snackbar-inner button{background:transparent;border:none;font-size:11px;padding:0;position:relative;color:#747576;width:65px;text-align:right;cursor:pointer;text-transform:uppercase}::ng-deep .workflow-snackbar .workflow-snackbar-inner button span{color:#1e5dd3;font-weight:500}::ng-deep .workflow-snackbar .workflow-snackbar-inner button:focus{outline:none}@keyframes slide-top{0%{transform:translateY(-100%);opacity:0}to{transform:translateY(0);opacity:1}}\n"], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
662
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarComponent, decorators: [{
663
+ type: Component,
664
+ args: [{ selector: 'app-snack-bar', template: "<div class=\"workflow-snackbar\" *ngIf=\"show\">\r\n <div class=\"workflow-snackbar-inner\">\r\n <div class=\"workflow-snackbarText\">\r\n <!-- &#xe914; -->\r\n <i class=\"icons\" [class]=\"type\" [innerHTML]=\"icon\"></i> <span [innerHTML]=\"message\">{{ message }}</span>\r\n </div>\r\n <button (click)=\"close()\">[ <span>Close</span> ]</button>\r\n </div>\r\n </div>", styles: ["::ng-deep .workflow-snackbar{position:fixed;top:20px;left:0;right:0;display:flex;align-items:center;justify-content:center;z-index:2147483647!important;pointer-events:none;animation:slide-top .3s cubic-bezier(.25,.46,.45,.94) both}::ng-deep .workflow-snackbar.white{background-color:#fff;color:#000;z-index:20}::ng-deep .workflow-snackbar.white button{color:#f6882f;font-size:11px;font-weight:400;pointer-events:all}::ng-deep .workflow-snackbar .workflow-snackbar-inner{display:flex;max-width:500px;min-width:450px;align-items:center;justify-content:space-between;padding:10px;background:#ffffff;border-radius:3px;box-shadow:0 0 10px #0003;min-height:55px;pointer-events:auto}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText{color:#161b2f;font-size:13px;display:flex;align-items:center;width:calc(100% - 70px)}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i{background:#f1f1f1;color:#d93b41;border-radius:50px;font-size:16px;width:30px;height:30px;text-align:center;line-height:28px;margin-right:10px;min-width:30px}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i.success{color:#34aa44}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i.warning{color:#f0b819}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i.info{color:#1e5dd3}::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i.alert,::ng-deep .workflow-snackbar .workflow-snackbar-inner .workflow-snackbarText i.error{color:#d93b41}::ng-deep .workflow-snackbar .workflow-snackbar-inner button{background:transparent;border:none;font-size:11px;padding:0;position:relative;color:#747576;width:65px;text-align:right;cursor:pointer;text-transform:uppercase}::ng-deep .workflow-snackbar .workflow-snackbar-inner button span{color:#1e5dd3;font-weight:500}::ng-deep .workflow-snackbar .workflow-snackbar-inner button:focus{outline:none}@keyframes slide-top{0%{transform:translateY(-100%);opacity:0}to{transform:translateY(0);opacity:1}}\n"] }]
665
+ }], ctorParameters: function () { return [{ type: SnackBarService }]; } });
666
+
667
+ class SnackBarModule {
668
+ }
669
+ SnackBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
670
+ SnackBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarModule, declarations: [SnackBarComponent], imports: [CommonModule], exports: [SnackBarComponent] });
671
+ SnackBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarModule, imports: [[CommonModule]] });
672
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarModule, decorators: [{
673
+ type: NgModule,
674
+ args: [{
675
+ declarations: [SnackBarComponent],
676
+ imports: [CommonModule],
677
+ exports: [SnackBarComponent],
678
+ }]
679
+ }] });
680
+
41
681
  class Configurations {
42
682
  constructor() {
43
683
  this.sentryConfig = {};
@@ -45,7 +685,8 @@ class Configurations {
45
685
  }
46
686
 
47
687
  class SentryErrorHandler {
48
- constructor(config) {
688
+ constructor(authorizerService, config) {
689
+ this.authorizerService = authorizerService;
49
690
  if (config === null || config === void 0 ? void 0 : config.sentryConfig) {
50
691
  const SENTRY_CONFIG = config.sentryConfig;
51
692
  Sentry.init({
@@ -60,6 +701,7 @@ class SentryErrorHandler {
60
701
  replaysSessionSampleRate: SENTRY_CONFIG.REPLAY_SESSION_SAMPLE_RATE,
61
702
  replaysOnErrorSampleRate: SENTRY_CONFIG.REPLAY_ON_ERROR_SAMPLE_RATE,
62
703
  });
704
+ Sentry.setUser({ userDetails: this.authorizerService.getUser() });
63
705
  }
64
706
  }
65
707
  handleError(error) {
@@ -74,16 +716,40 @@ class SentryErrorHandler {
74
716
  }
75
717
  }
76
718
  }
77
- SentryErrorHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SentryErrorHandler, deps: [{ token: Configurations, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
719
+ SentryErrorHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SentryErrorHandler, deps: [{ token: i1.AuthorizerService }, { token: Configurations, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
78
720
  SentryErrorHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SentryErrorHandler });
79
721
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SentryErrorHandler, decorators: [{
80
722
  type: Injectable
81
723
  }], ctorParameters: function () {
82
- return [{ type: Configurations, decorators: [{
724
+ return [{ type: i1.AuthorizerService }, { type: Configurations, decorators: [{
83
725
  type: Optional
84
726
  }] }];
85
727
  } });
86
728
 
729
+ class HttpReqInterceptor {
730
+ constructor(errorService) {
731
+ this.errorService = errorService;
732
+ this.errorCodes = ErrorStatusCode;
733
+ }
734
+ intercept(req, next) {
735
+ return next.handle(req).pipe(timeout(API_TIMEOUT_TIME), retry(API_RETRY_COUNT), catchError((error) => {
736
+ if (this.canNotifyErrorService(error.status)) {
737
+ this.errorService.handleError(error, req);
738
+ }
739
+ return throwError(error);
740
+ }));
741
+ }
742
+ canNotifyErrorService(statusCode) {
743
+ const manageableCodes = Object.values(ErrorStatusCode).filter((value) => typeof value === 'number');
744
+ return manageableCodes.includes(statusCode);
745
+ }
746
+ }
747
+ HttpReqInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HttpReqInterceptor, deps: [{ token: GlobalErrorService }], target: i0.ɵɵFactoryTarget.Injectable });
748
+ HttpReqInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HttpReqInterceptor });
749
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HttpReqInterceptor, decorators: [{
750
+ type: Injectable
751
+ }], ctorParameters: function () { return [{ type: GlobalErrorService }]; } });
752
+
87
753
  const FOR_ROOT_SENTRY_OPTIONS_TOKEN = new InjectionToken('forRoot() SentryErrorHandler options');
88
754
  class VcErrorHandlersModule {
89
755
  static forRoot(environmentConfig) {
@@ -94,15 +760,50 @@ class VcErrorHandlersModule {
94
760
  }
95
761
  }
96
762
  VcErrorHandlersModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
97
- VcErrorHandlersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, declarations: [VcErrorHandlersComponent], exports: [VcErrorHandlersComponent] });
98
- VcErrorHandlersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, providers: [{ provide: ErrorHandler, useClass: SentryErrorHandler }], imports: [[]] });
763
+ VcErrorHandlersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, bootstrap: [VcErrorHandlersComponent], declarations: [VcErrorHandlersComponent,
764
+ PageNotFoundComponent,
765
+ UnauthorizedComponent,
766
+ SessionExpiredComponent,
767
+ ChunkUnavailableComponent,
768
+ ServerErrorComponent,
769
+ SessionExpiredModalComponent], imports: [DialogModule, SnackBarModule], exports: [VcErrorHandlersComponent,
770
+ PageNotFoundComponent,
771
+ UnauthorizedComponent,
772
+ SessionExpiredComponent,
773
+ ChunkUnavailableComponent,
774
+ ServerErrorComponent,
775
+ SessionExpiredModalComponent] });
776
+ VcErrorHandlersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, providers: [
777
+ { provide: ErrorHandler, useClass: SentryErrorHandler },
778
+ { provide: HTTP_INTERCEPTORS, useClass: HttpReqInterceptor, multi: true },
779
+ ], imports: [[DialogModule, SnackBarModule]] });
99
780
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, decorators: [{
100
781
  type: NgModule,
101
782
  args: [{
102
- declarations: [VcErrorHandlersComponent],
103
- imports: [],
104
- exports: [VcErrorHandlersComponent],
105
- providers: [{ provide: ErrorHandler, useClass: SentryErrorHandler }],
783
+ declarations: [
784
+ VcErrorHandlersComponent,
785
+ PageNotFoundComponent,
786
+ UnauthorizedComponent,
787
+ SessionExpiredComponent,
788
+ ChunkUnavailableComponent,
789
+ ServerErrorComponent,
790
+ SessionExpiredModalComponent,
791
+ ],
792
+ imports: [DialogModule, SnackBarModule],
793
+ exports: [
794
+ VcErrorHandlersComponent,
795
+ PageNotFoundComponent,
796
+ UnauthorizedComponent,
797
+ SessionExpiredComponent,
798
+ ChunkUnavailableComponent,
799
+ ServerErrorComponent,
800
+ SessionExpiredModalComponent,
801
+ ],
802
+ providers: [
803
+ { provide: ErrorHandler, useClass: SentryErrorHandler },
804
+ { provide: HTTP_INTERCEPTORS, useClass: HttpReqInterceptor, multi: true },
805
+ ],
806
+ bootstrap: [VcErrorHandlersComponent],
106
807
  }]
107
808
  }] });
108
809
 
@@ -114,4 +815,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
114
815
  * Generated bundle index. Do not edit.
115
816
  */
116
817
 
117
- export { FOR_ROOT_SENTRY_OPTIONS_TOKEN, VcErrorHandlersComponent, VcErrorHandlersModule, VcErrorHandlersService };
818
+ export { AuthService, ChunkUnavailableComponent, FOR_ROOT_SENTRY_OPTIONS_TOKEN, GlobalErrorService, HttpReqInterceptor, PageNotFoundComponent, RouterService, ServerErrorComponent, SessionExpiredComponent, SessionExpiredModalComponent, UnauthorizedComponent, VcErrorHandlersComponent, VcErrorHandlersModule, VcErrorHandlersService };
819
+ //# sourceMappingURL=vc-error-handlers.mjs.map