vc-error-handlers 0.1.3 → 0.1.5

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